mirror of
https://github.com/zeldaret/tww.git
synced 2026-08-18 13:13:29 -04:00
Merge branch 'main' of https://github.com/Crain-32/tww
This commit is contained in:
@@ -242,18 +242,65 @@ f32 J3DAnmClusterFull::getWeight(u16 idx) const {
|
||||
return mWeight[maxFrame - 1 + getAnmTable()[idx].mOffset];
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
f32 J3DGetKeyFrameInterpolation(f32, J3DAnmKeyTableBase*, T*) {
|
||||
}
|
||||
|
||||
/* 802F1188-802F120C .text getWeight__16J3DAnmClusterKeyCFUs */
|
||||
f32 J3DAnmClusterKey::getWeight(u16) const {
|
||||
f32 J3DAnmClusterKey::getWeight(u16 idx) const {
|
||||
/* Nonmatching */
|
||||
J3DAnmKeyTableBase& table = mAnmTable[idx].mWeightTable;
|
||||
if (table.mMaxFrame != 0 && table.mMaxFrame != 1) {
|
||||
return J3DGetKeyFrameInterpolation<f32>(getFrame(), &table, &mWeight[table.mOffset]);
|
||||
} else if (table.mMaxFrame == 0) {
|
||||
return 1.0f;
|
||||
} else {
|
||||
return mWeight[table.mOffset];
|
||||
}
|
||||
}
|
||||
|
||||
/* 802F120C-802F14B4 .text getColor__18J3DAnmVtxColorFullCFUcUsP8_GXColor */
|
||||
void J3DAnmVtxColorFull::getColor(u8, u16, GXColor* dst) const {
|
||||
/* Nonmatching */
|
||||
void J3DAnmVtxColorFull::getColor(u8 col, u16 idx, GXColor* dst) const {
|
||||
{
|
||||
u16 maxFrame = getAnmTable(col)[idx].mRMaxFrame;
|
||||
if (0.0f <= getFrame() && getFrame() < maxFrame)
|
||||
dst->r = mColorR[(s32)getFrame() + getAnmTable(col)[idx].mROffset];
|
||||
else if (getFrame() < 0.0f)
|
||||
dst->r = mColorR[getAnmTable(col)[idx].mROffset];
|
||||
else
|
||||
dst->r = mColorR[maxFrame - 1 + getAnmTable(col)[idx].mROffset];
|
||||
}
|
||||
{
|
||||
u16 maxFrame = getAnmTable(col)[idx].mGMaxFrame;
|
||||
if (0.0f <= getFrame() && getFrame() < maxFrame)
|
||||
dst->g = mColorG[(s32)getFrame() + getAnmTable(col)[idx].mGOffset];
|
||||
else if (getFrame() < 0.0f)
|
||||
dst->g = mColorG[getAnmTable(col)[idx].mGOffset];
|
||||
else
|
||||
dst->g = mColorG[maxFrame - 1 + getAnmTable(col)[idx].mGOffset];
|
||||
}
|
||||
{
|
||||
u16 maxFrame = getAnmTable(col)[idx].mBMaxFrame;
|
||||
if (0.0f <= getFrame() && getFrame() < maxFrame)
|
||||
dst->b = mColorB[(s32)getFrame() + getAnmTable(col)[idx].mBOffset];
|
||||
else if (getFrame() < 0.0f)
|
||||
dst->b = mColorB[getAnmTable(col)[idx].mBOffset];
|
||||
else
|
||||
dst->b = mColorB[maxFrame - 1 + getAnmTable(col)[idx].mBOffset];
|
||||
}
|
||||
{
|
||||
u16 maxFrame = getAnmTable(col)[idx].mAMaxFrame;
|
||||
if (0.0f <= getFrame() && getFrame() < maxFrame)
|
||||
dst->a = mColorA[(s32)getFrame() + getAnmTable(col)[idx].mAOffset];
|
||||
else if (getFrame() < 0.0f)
|
||||
dst->a = mColorA[getAnmTable(col)[idx].mAOffset];
|
||||
else
|
||||
dst->a = mColorA[maxFrame - 1 + getAnmTable(col)[idx].mAOffset];
|
||||
}
|
||||
}
|
||||
|
||||
/* 802F14B4-802F17D0 .text getColor__17J3DAnmVtxColorKeyCFUcUsP8_GXColor */
|
||||
void J3DAnmVtxColorKey::getColor(u8, u16, GXColor* dst) const {
|
||||
void J3DAnmVtxColorKey::getColor(u8 col, u16 idx, GXColor* dst) const {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
@@ -382,11 +429,171 @@ void J3DAnmTextureSRTKey::searchUpdateMaterialID(J3DModelData* modelData) {
|
||||
/* 802F22E0-802F2624 .text getTevColorReg__15J3DAnmTevRegKeyCFUsP11_GXColorS10 */
|
||||
void J3DAnmTevRegKey::getTevColorReg(u16 idx, GXColorS10* dst) const {
|
||||
/* Nonmatching */
|
||||
{
|
||||
J3DAnmKeyTableBase& table = getAnmCRegKeyTable()[idx].mRTable;
|
||||
switch (table.mMaxFrame) {
|
||||
case 0:
|
||||
dst->r = 0;
|
||||
break;
|
||||
case 1:
|
||||
dst->r = mAnmCRegDataR[table.mOffset];
|
||||
break;
|
||||
default:
|
||||
f32 v = J3DGetKeyFrameInterpolation<s16>(getFrame(), &table, &mAnmCRegDataR[table.mOffset]);
|
||||
if (v < -1024.0f)
|
||||
dst->r = -1024;
|
||||
if (v > 1023.0f)
|
||||
dst->r = 1023;
|
||||
if (0.0f <= v && v <= 255.0f)
|
||||
dst->r = v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
J3DAnmKeyTableBase& table = getAnmCRegKeyTable()[idx].mGTable;
|
||||
switch (table.mMaxFrame) {
|
||||
case 0:
|
||||
dst->g = 0;
|
||||
break;
|
||||
case 1:
|
||||
dst->g = mAnmCRegDataG[table.mOffset];
|
||||
break;
|
||||
default:
|
||||
f32 v = J3DGetKeyFrameInterpolation<s16>(getFrame(), &table, &mAnmCRegDataG[table.mOffset]);
|
||||
if (v < -1024.0f)
|
||||
dst->g = -1024;
|
||||
if (v > 1023.0f)
|
||||
dst->g = 1023;
|
||||
if (0.0f <= v && v <= 255.0f)
|
||||
dst->g = v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
J3DAnmKeyTableBase& table = getAnmCRegKeyTable()[idx].mBTable;
|
||||
switch (table.mMaxFrame) {
|
||||
case 0:
|
||||
dst->b = 0;
|
||||
break;
|
||||
case 1:
|
||||
dst->b = mAnmCRegDataB[table.mOffset];
|
||||
break;
|
||||
default:
|
||||
f32 v = J3DGetKeyFrameInterpolation<s16>(getFrame(), &table, &mAnmCRegDataB[table.mOffset]);
|
||||
if (v < -1024.0f)
|
||||
dst->b = -1024;
|
||||
if (v > 1023.0f)
|
||||
dst->b = 1023;
|
||||
if (0.0f <= v && v <= 255.0f)
|
||||
dst->b = v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
J3DAnmKeyTableBase& table = getAnmCRegKeyTable()[idx].mATable;
|
||||
switch (table.mMaxFrame) {
|
||||
case 0:
|
||||
dst->a = 0;
|
||||
break;
|
||||
case 1:
|
||||
dst->a = mAnmCRegDataA[table.mOffset];
|
||||
break;
|
||||
default:
|
||||
f32 v = J3DGetKeyFrameInterpolation<s16>(getFrame(), &table, &mAnmCRegDataA[table.mOffset]);
|
||||
if (v < -1024.0f)
|
||||
dst->a = -1024;
|
||||
if (v > 1023.0f)
|
||||
dst->a = 1023;
|
||||
if (0.0f <= v && v <= 255.0f)
|
||||
dst->a = v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 802F2624-802F2968 .text getTevKonstReg__15J3DAnmTevRegKeyCFUsP8_GXColor */
|
||||
void J3DAnmTevRegKey::getTevKonstReg(u16 idx, GXColor* dst) const {
|
||||
/* Nonmatching */
|
||||
{
|
||||
J3DAnmKeyTableBase& table = getAnmKRegKeyTable()[idx].mRTable;
|
||||
switch (table.mMaxFrame) {
|
||||
case 0:
|
||||
dst->r = 0;
|
||||
break;
|
||||
case 1:
|
||||
dst->r = mAnmKRegDataR[table.mOffset];
|
||||
break;
|
||||
default:
|
||||
f32 v = J3DGetKeyFrameInterpolation<s16>(getFrame(), &table, &mAnmKRegDataR[table.mOffset]);
|
||||
if (v < 0.0f)
|
||||
dst->r = 0;
|
||||
if (v > 255.0f)
|
||||
dst->r = 255;
|
||||
if (0.0f <= v && v <= 255.0f)
|
||||
dst->r = v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
J3DAnmKeyTableBase& table = getAnmKRegKeyTable()[idx].mGTable;
|
||||
switch (table.mMaxFrame) {
|
||||
case 0:
|
||||
dst->g = 0;
|
||||
break;
|
||||
case 1:
|
||||
dst->g = mAnmKRegDataG[table.mOffset];
|
||||
break;
|
||||
default:
|
||||
f32 v = J3DGetKeyFrameInterpolation<s16>(getFrame(), &table, &mAnmKRegDataG[table.mOffset]);
|
||||
if (v < 0.0f)
|
||||
dst->g = 0;
|
||||
if (v > 255.0f)
|
||||
dst->g = 255;
|
||||
if (0.0f <= v && v <= 255.0f)
|
||||
dst->g = v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
J3DAnmKeyTableBase& table = getAnmKRegKeyTable()[idx].mBTable;
|
||||
switch (table.mMaxFrame) {
|
||||
case 0:
|
||||
dst->b = 0;
|
||||
break;
|
||||
case 1:
|
||||
dst->b = mAnmKRegDataB[table.mOffset];
|
||||
break;
|
||||
default:
|
||||
f32 v = J3DGetKeyFrameInterpolation<s16>(getFrame(), &table, &mAnmKRegDataB[table.mOffset]);
|
||||
if (v < 0.0f)
|
||||
dst->b = 0;
|
||||
if (v > 255.0f)
|
||||
dst->b = 255;
|
||||
if (0.0f <= v && v <= 255.0f)
|
||||
dst->b = v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
J3DAnmKeyTableBase& table = getAnmKRegKeyTable()[idx].mATable;
|
||||
switch (table.mMaxFrame) {
|
||||
case 0:
|
||||
dst->a = 0;
|
||||
break;
|
||||
case 1:
|
||||
dst->a = mAnmKRegDataA[table.mOffset];
|
||||
break;
|
||||
default:
|
||||
f32 v = J3DGetKeyFrameInterpolation<s16>(getFrame(), &table, &mAnmKRegDataA[table.mOffset]);
|
||||
if (v < 0.0f)
|
||||
dst->a = 0;
|
||||
if (v > 255.0f)
|
||||
dst->a = 255;
|
||||
if (0.0f <= v && v <= 255.0f)
|
||||
dst->a = v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 802F2968-802F2A64 .text searchUpdateMaterialID__15J3DAnmTevRegKeyFP16J3DMaterialTable */
|
||||
|
||||
@@ -343,8 +343,28 @@ void J3DAnmFullLoader_v15::readAnmVtxColor(const J3DAnmVtxColorFullData* param_1
|
||||
}
|
||||
|
||||
/* 803001B0-80300318 .text setAnmVtxColor__20J3DAnmFullLoader_v15FP18J3DAnmVtxColorFullPC22J3DAnmVtxColorFullData */
|
||||
void J3DAnmFullLoader_v15::setAnmVtxColor(J3DAnmVtxColorFull*, const J3DAnmVtxColorFullData*) {
|
||||
void J3DAnmFullLoader_v15::setAnmVtxColor(J3DAnmVtxColorFull* dst, const J3DAnmVtxColorFullData* data) {
|
||||
/* Nonmatching */
|
||||
dst->mFrameMax = data->mFrameMax;
|
||||
dst->mAttribute = data->field_0x8;
|
||||
dst->mFrame = 0.0f;
|
||||
dst->mAnmTableNum[0] = data->mAnmTableNum[0];
|
||||
dst->mAnmTableNum[1] = data->mAnmTableNum[1];
|
||||
dst->mpTable[0] = JSUConvertOffsetToPtr<J3DAnmColorFullTable>(data, (void*)data->mTableOffsets[0]);
|
||||
dst->mpTable[1] = JSUConvertOffsetToPtr<J3DAnmColorFullTable>(data, (void*)data->mTableOffsets[1]);
|
||||
dst->mAnmVtxColorIndexData[0] = JSUConvertOffsetToPtr<J3DAnmVtxColorIndexData>(data, (void*)data->mVtxColorIndexDataOffsets[0]);
|
||||
dst->mAnmVtxColorIndexData[1] = JSUConvertOffsetToPtr<J3DAnmVtxColorIndexData>(data, (void*)data->mVtxColorIndexDataOffsets[1]);
|
||||
void* indexPtr0 = JSUConvertOffsetToPtr<u16>(data, (void*)data->mVtxColorIndexPointerOffsets[0]);
|
||||
void* indexPtr1 = JSUConvertOffsetToPtr<u16>(data, (void*)data->mVtxColorIndexPointerOffsets[1]);
|
||||
|
||||
for (s32 i = 0; i < data->mIndexNum[0]; i++) {
|
||||
// dst->mpIndexPtr
|
||||
}
|
||||
|
||||
dst->mColorR = JSUConvertOffsetToPtr<u8>(data, (void*)data->mRValuesOffset);
|
||||
dst->mColorG = JSUConvertOffsetToPtr<u8>(data, (void*)data->mGValuesOffset);
|
||||
dst->mColorB = JSUConvertOffsetToPtr<u8>(data, (void*)data->mBValuesOffset);
|
||||
dst->mColorA = JSUConvertOffsetToPtr<u8>(data, (void*)data->mAValuesOffset);
|
||||
}
|
||||
|
||||
/* 80300318-80300464 .text load__19J3DAnmKeyLoader_v15FPCv */
|
||||
@@ -525,7 +545,7 @@ void J3DAnmKeyLoader_v15::setAnmCluster(J3DAnmClusterKey* param_1, const J3DAnmC
|
||||
param_1->mFrameMax = param_2->mFrameMax;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
param_1->mFrame = 0.0f;
|
||||
param_1->field_0x14 = JSUConvertOffsetToPtr<J3DAnmClusterKeyTable>(param_2, (void*)param_2->mTableOffset);
|
||||
param_1->mAnmTable = JSUConvertOffsetToPtr<J3DAnmClusterKeyTable>(param_2, (void*)param_2->mTableOffset);
|
||||
param_1->mWeight = JSUConvertOffsetToPtr<f32>(param_2, (void*)param_2->mWeightOffset);
|
||||
}
|
||||
|
||||
@@ -547,22 +567,22 @@ void J3DAnmKeyLoader_v15::setAnmTevReg(J3DAnmTevRegKey* param_1, const J3DAnmTev
|
||||
param_1->mAnmKRegKeyTable = JSUConvertOffsetToPtr<J3DAnmKRegKeyTable>(param_2, (void*)param_2->mKRegTableOffset);
|
||||
param_1->mKRegUpdateMaterialID = JSUConvertOffsetToPtr<u16>(param_2, (void*)param_2->mKRegUpdateMaterialIDOffset);
|
||||
param_1->mKRegUpdateMaterialName.setResource(JSUConvertOffsetToPtr<ResNTAB>(param_2, (void*)param_2->mKRegNameTabOffset));
|
||||
param_1->mCRegDataCount[0] = param_2->field_0x10;
|
||||
param_1->mCRegDataCount[1] = param_2->field_0x12;
|
||||
param_1->mCRegDataCount[2] = param_2->field_0x14;
|
||||
param_1->mCRegDataCount[3] = param_2->field_0x16;
|
||||
param_1->mAnmCRegData[0] = JSUConvertOffsetToPtr<s16>(param_2, (void*)param_2->mCRValuesOffset);
|
||||
param_1->mAnmCRegData[1] = JSUConvertOffsetToPtr<s16>(param_2, (void*)param_2->mCGValuesOffset);
|
||||
param_1->mAnmCRegData[2] = JSUConvertOffsetToPtr<s16>(param_2, (void*)param_2->mCBValuesOffset);
|
||||
param_1->mAnmCRegData[3] = JSUConvertOffsetToPtr<s16>(param_2, (void*)param_2->mCAValuesOffset);
|
||||
param_1->mKRegDataCount[0] = param_2->field_0x18;
|
||||
param_1->mKRegDataCount[1] = param_2->field_0x1a;
|
||||
param_1->mKRegDataCount[2] = param_2->field_0x1c;
|
||||
param_1->mKRegDataCount[3] = param_2->field_0x1e;
|
||||
param_1->mAnmKRegData[0] = JSUConvertOffsetToPtr<s16>(param_2, (void*)param_2->mKRValuesOffset);
|
||||
param_1->mAnmKRegData[1] = JSUConvertOffsetToPtr<s16>(param_2, (void*)param_2->mKGValuesOffset);
|
||||
param_1->mAnmKRegData[2] = JSUConvertOffsetToPtr<s16>(param_2, (void*)param_2->mKBValuesOffset);
|
||||
param_1->mAnmKRegData[3] = JSUConvertOffsetToPtr<s16>(param_2, (void*)param_2->mKAValuesOffset);
|
||||
param_1->mCRegDataCountR = param_2->field_0x10;
|
||||
param_1->mCRegDataCountG = param_2->field_0x12;
|
||||
param_1->mCRegDataCountB = param_2->field_0x14;
|
||||
param_1->mCRegDataCountA = param_2->field_0x16;
|
||||
param_1->mAnmCRegDataR = JSUConvertOffsetToPtr<s16>(param_2, (void*)param_2->mCRValuesOffset);
|
||||
param_1->mAnmCRegDataG = JSUConvertOffsetToPtr<s16>(param_2, (void*)param_2->mCGValuesOffset);
|
||||
param_1->mAnmCRegDataB = JSUConvertOffsetToPtr<s16>(param_2, (void*)param_2->mCBValuesOffset);
|
||||
param_1->mAnmCRegDataA = JSUConvertOffsetToPtr<s16>(param_2, (void*)param_2->mCAValuesOffset);
|
||||
param_1->mKRegDataCountR = param_2->field_0x18;
|
||||
param_1->mKRegDataCountG = param_2->field_0x1a;
|
||||
param_1->mKRegDataCountB = param_2->field_0x1c;
|
||||
param_1->mKRegDataCountA = param_2->field_0x1e;
|
||||
param_1->mAnmKRegDataR = JSUConvertOffsetToPtr<s16>(param_2, (void*)param_2->mKRValuesOffset);
|
||||
param_1->mAnmKRegDataG = JSUConvertOffsetToPtr<s16>(param_2, (void*)param_2->mKGValuesOffset);
|
||||
param_1->mAnmKRegDataB = JSUConvertOffsetToPtr<s16>(param_2, (void*)param_2->mKBValuesOffset);
|
||||
param_1->mAnmKRegDataA = JSUConvertOffsetToPtr<s16>(param_2, (void*)param_2->mKAValuesOffset);
|
||||
}
|
||||
|
||||
/* 80300C34-80300C5C .text readAnmVtxColor__19J3DAnmKeyLoader_v15FPC21J3DAnmVtxColorKeyData */
|
||||
@@ -571,6 +591,27 @@ void J3DAnmKeyLoader_v15::readAnmVtxColor(const J3DAnmVtxColorKeyData* param_1)
|
||||
}
|
||||
|
||||
/* 80300C5C-80300DC4 .text setAnmVtxColor__19J3DAnmKeyLoader_v15FP17J3DAnmVtxColorKeyPC21J3DAnmVtxColorKeyData */
|
||||
void J3DAnmKeyLoader_v15::setAnmVtxColor(J3DAnmVtxColorKey*, const J3DAnmVtxColorKeyData*) {
|
||||
void J3DAnmKeyLoader_v15::setAnmVtxColor(J3DAnmVtxColorKey* dst, const J3DAnmVtxColorKeyData* data) {
|
||||
/* Nonmatching */
|
||||
|
||||
dst->mFrameMax = data->mFrameMax;
|
||||
dst->mAttribute = data->field_0x8;
|
||||
dst->mFrame = 0.0f;
|
||||
dst->mAnmTableNum[0] = data->mAnmTableNum[0];
|
||||
dst->mAnmTableNum[1] = data->mAnmTableNum[1];
|
||||
dst->mpTable[0] = JSUConvertOffsetToPtr<J3DAnmColorKeyTable>(data, (void*)data->mTableOffsets[0]);
|
||||
dst->mpTable[1] = JSUConvertOffsetToPtr<J3DAnmColorKeyTable>(data, (void*)data->mTableOffsets[1]);
|
||||
dst->mAnmVtxColorIndexData[0] = JSUConvertOffsetToPtr<J3DAnmVtxColorIndexData>(data, (void*)data->mVtxColorIndexDataOffsets[0]);
|
||||
dst->mAnmVtxColorIndexData[1] = JSUConvertOffsetToPtr<J3DAnmVtxColorIndexData>(data, (void*)data->mVtxColorIndexDataOffsets[1]);
|
||||
void* indexPtr0 = JSUConvertOffsetToPtr<u16>(data, (void*)data->mVtxColorIndexPointerOffsets[0]);
|
||||
void* indexPtr1 = JSUConvertOffsetToPtr<u16>(data, (void*)data->mVtxColorIndexPointerOffsets[1]);
|
||||
|
||||
for (s32 i = 0; i < data->mIndexNum[0]; i++) {
|
||||
// dst->mpIndexPtr
|
||||
}
|
||||
|
||||
dst->mColorR = JSUConvertOffsetToPtr<s16>(data, (void*)data->mRValuesOffset);
|
||||
dst->mColorG = JSUConvertOffsetToPtr<s16>(data, (void*)data->mGValuesOffset);
|
||||
dst->mColorB = JSUConvertOffsetToPtr<s16>(data, (void*)data->mBValuesOffset);
|
||||
dst->mColorA = JSUConvertOffsetToPtr<s16>(data, (void*)data->mAValuesOffset);
|
||||
}
|
||||
|
||||
@@ -9,9 +9,8 @@
|
||||
|
||||
/* 802FE1A4-802FE1FC .text __ct__15J3DJointFactoryFRC13J3DJointBlock */
|
||||
J3DJointFactory::J3DJointFactory(const J3DJointBlock& jointBlock) {
|
||||
/* Nonmatching */
|
||||
mJointInitData = JSUConvertOffsetToPtr<J3DJointInitData>(&jointBlock, jointBlock.mpJointInitData);
|
||||
mIndexTable = JSUConvertOffsetToPtr<u16>(&jointBlock, jointBlock.mpIndexTable);
|
||||
mJointInitData = JSUConvertOffsetToPtr<J3DJointInitData>(&jointBlock, (u32)jointBlock.mpJointInitData);
|
||||
mIndexTable = JSUConvertOffsetToPtr<u16>(&jointBlock, (u32)jointBlock.mpIndexTable);
|
||||
}
|
||||
|
||||
/* 802FE1FC-802FE390 .text create__15J3DJointFactoryFi */
|
||||
|
||||
@@ -4,209 +4,637 @@
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphLoader/J3DMaterialFactory.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DModelLoader.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMatBlock.h"
|
||||
#include "JSystem/JSupport/JSupport.h"
|
||||
|
||||
/* 802F68F0-802F6B38 .text __ct__18J3DMaterialFactoryFRC16J3DMaterialBlock */
|
||||
J3DMaterialFactory::J3DMaterialFactory(const J3DMaterialBlock&) {
|
||||
/* Nonmatching */
|
||||
J3DMaterialFactory::J3DMaterialFactory(const J3DMaterialBlock& block) {
|
||||
mMaterialNum = block.mMaterialNum;
|
||||
mpMaterialInitData = JSUConvertOffsetToPtr<J3DMaterialInitData>(&block, block.mpMaterialInitData);
|
||||
mpMaterialID = JSUConvertOffsetToPtr<u16>(&block, block.mpMaterialID);
|
||||
|
||||
if (block.mpIndInitData != NULL && ((u32)block.mpIndInitData - (u32)block.mpNameTable) > 4)
|
||||
mpIndInitData = JSUConvertOffsetToPtr<J3DIndInitData>(&block, block.mpIndInitData);
|
||||
else
|
||||
mpIndInitData = NULL;
|
||||
|
||||
mpCullMode = JSUConvertOffsetToPtr<GXCullMode>(&block, block.mpCullMode);
|
||||
mpMatColor = JSUConvertOffsetToPtr<GXColor>(&block, block.mpMatColor);
|
||||
mpColorChanNum = JSUConvertOffsetToPtr<u8>(&block, block.mpColorChanNum);
|
||||
mpColorChanInfo = JSUConvertOffsetToPtr<J3DColorChanInfo>(&block, block.mpColorChanInfo);
|
||||
mpAmbColor = JSUConvertOffsetToPtr<GXColor>(&block, block.mpAmbColor);
|
||||
mpLightInfo = JSUConvertOffsetToPtr<J3DLightInfo>(&block, block.mpLightInfo);
|
||||
mpTexGenNum = JSUConvertOffsetToPtr<u8>(&block, block.mpTexGenNum);
|
||||
mpTexCoordInfo = JSUConvertOffsetToPtr<J3DTexCoordInfo>(&block, block.mpTexCoordInfo);
|
||||
mpTexCoord2Info = JSUConvertOffsetToPtr<J3DTexCoord2Info>(&block, block.mpTexCoord2Info);
|
||||
mpTexMtxInfo = JSUConvertOffsetToPtr<J3DTexMtxInfo>(&block, block.mpTexMtxInfo);
|
||||
field_0x44 = JSUConvertOffsetToPtr<J3DTexMtxInfo>(&block, block.field_0x44);
|
||||
mpTexNo = JSUConvertOffsetToPtr<u16>(&block, block.mpTexNo);
|
||||
mpTevOrderInfo = JSUConvertOffsetToPtr<J3DTevOrderInfo>(&block, block.mpTevOrderInfo);
|
||||
mpTevColor = JSUConvertOffsetToPtr<GXColorS10>(&block, block.mpTevColor);
|
||||
mpTevKColor = JSUConvertOffsetToPtr<GXColor>(&block, block.mpTevKColor);
|
||||
mpTevStageNum = JSUConvertOffsetToPtr<u8>(&block, block.mpTevStageNum);
|
||||
mpTevStageInfo = JSUConvertOffsetToPtr<J3DTevStageInfo>(&block, block.mpTevStageInfo);
|
||||
mpTevSwapModeInfo = JSUConvertOffsetToPtr<J3DTevSwapModeInfo>(&block, block.mpTevSwapModeInfo);
|
||||
mpTevSwapModeTableInfo = JSUConvertOffsetToPtr<J3DTevSwapModeTableInfo>(&block, block.mpTevSwapModeTableInfo);
|
||||
mpFogInfo = JSUConvertOffsetToPtr<J3DFogInfo>(&block, block.mpFogInfo);
|
||||
mpAlphaCompInfo = JSUConvertOffsetToPtr<J3DAlphaCompInfo>(&block, block.mpAlphaCompInfo);
|
||||
mpBlendInfo = JSUConvertOffsetToPtr<J3DBlendInfo>(&block, block.mpBlendInfo);
|
||||
mpZModeInfo = JSUConvertOffsetToPtr<J3DZModeInfo>(&block, block.mpZModeInfo);
|
||||
mpZCompLoc = JSUConvertOffsetToPtr<u8>(&block, block.mpZCompLoc);
|
||||
mpDither = JSUConvertOffsetToPtr<u8>(&block, block.mpDither);
|
||||
mpNBTScaleInfo = JSUConvertOffsetToPtr<J3DNBTScaleInfo>(&block, block.mpNBTScaleInfo);
|
||||
mpDisplayListInit = NULL;
|
||||
mpPatchingInfo = NULL;
|
||||
mpCurrentMtxInfo = NULL;
|
||||
field_0x84 = NULL;
|
||||
}
|
||||
|
||||
/* 802F6B38-802F6BC0 .text __ct__18J3DMaterialFactoryFRC18J3DMaterialDLBlock */
|
||||
J3DMaterialFactory::J3DMaterialFactory(const J3DMaterialDLBlock&) {
|
||||
J3DMaterialFactory::J3DMaterialFactory(const J3DMaterialDLBlock& block) {
|
||||
/* Nonmatching */
|
||||
mMaterialNum = block.mMaterialNum;
|
||||
mpMaterialInitData = NULL;
|
||||
mpDisplayListInit = JSUConvertOffsetToPtr<J3DDisplayListInit>(&block, block.mpDisplayListInit);
|
||||
mpPatchingInfo = JSUConvertOffsetToPtr<J3DPatchingInfo>(&block, block.mpPatchingInfo);
|
||||
mpCurrentMtxInfo = JSUConvertOffsetToPtr<J3DCurrentMtxInfo>(&block, block.mpCurrentMtxInfo);
|
||||
field_0x84 = JSUConvertOffsetToPtr<u8>(&block, block.field_0x18);
|
||||
}
|
||||
|
||||
/* 802F6BC0-802F6C08 .text countUniqueMaterials__18J3DMaterialFactoryFv */
|
||||
u16 J3DMaterialFactory::countUniqueMaterials() {
|
||||
/* Nonmatching */
|
||||
u16 num = 0;
|
||||
s32 maxID = -1;
|
||||
for (u16 i = 0; i < mMaterialNum; i++) {
|
||||
if (maxID < mpMaterialID[i]) {
|
||||
num++;
|
||||
maxID = mpMaterialID[i];
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/* 802F6C08-802F6C40 .text countTexGens__18J3DMaterialFactoryCFi */
|
||||
void J3DMaterialFactory::countTexGens(int) const {
|
||||
/* Nonmatching */
|
||||
u32 J3DMaterialFactory::countTexGens(int idx) const {
|
||||
u8 no = mpMaterialInitData[mpMaterialID[idx]].mTexGenNumIdx;
|
||||
if (no != 0xFF)
|
||||
return mpTexGenNum[no];
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 802F6C40-802F6CC8 .text countStages__18J3DMaterialFactoryCFi */
|
||||
void J3DMaterialFactory::countStages(int) const {
|
||||
/* Nonmatching */
|
||||
u32 J3DMaterialFactory::countStages(int idx) const {
|
||||
J3DMaterialInitData* initData = &mpMaterialInitData[mpMaterialID[idx]];
|
||||
|
||||
u32 texGenNum = 0;
|
||||
u32 tevStageNum = 0;
|
||||
|
||||
u8 no = initData->mTevStageNumIdx;
|
||||
if (no != 0xFF)
|
||||
tevStageNum = mpTevStageNum[no];
|
||||
|
||||
for (s32 i = 0; i < 8; i++)
|
||||
if (initData->mTexNoIdx[i] != 0xFFFF)
|
||||
texGenNum++;
|
||||
|
||||
if (tevStageNum != texGenNum && texGenNum != 0) {
|
||||
return tevStageNum > texGenNum ? tevStageNum : texGenNum;
|
||||
} else {
|
||||
return tevStageNum;
|
||||
}
|
||||
}
|
||||
|
||||
/* 802F6CC8-802F6D44 .text create__18J3DMaterialFactoryCFP11J3DMaterialQ218J3DMaterialFactory12MaterialTypeiUl */
|
||||
J3DMaterial* J3DMaterialFactory::create(J3DMaterial*, J3DMaterialFactory::MaterialType, int, unsigned long) const {
|
||||
J3DMaterial* J3DMaterialFactory::create(J3DMaterial* mat, J3DMaterialFactory::MaterialType type, int idx, u32 flag) const {
|
||||
/* Nonmatching */
|
||||
switch (type) {
|
||||
case MATERIAL_TYPE_NORMAL:
|
||||
return createNormalMaterial(mat, idx, flag);
|
||||
case MATERIAL_TYPE_LOCKED:
|
||||
return createLockedMaterial(mat, idx, flag);
|
||||
case MATERIAL_TYPE_PATCHED:
|
||||
return createPatchedMaterial(mat, idx, flag);
|
||||
}
|
||||
}
|
||||
|
||||
static inline u32 getMdlDataFlag_TevStageNum(u32 flag) { return (flag >> 16) & 0x1F; }
|
||||
static inline u32 getMdlDataFlag_TexGenFlag(u32 flag) { return flag & 0x0C000000; }
|
||||
static inline u32 getMdlDataFlag_PEFlag(u32 flag) { return flag & 0x30000000; }
|
||||
static inline u32 getMdlDataFlag_ColorFlag(u32 flag) { return flag & 0xC0000000; }
|
||||
|
||||
/* 802F6D44-802F768C .text createNormalMaterial__18J3DMaterialFactoryCFP11J3DMaterialiUl */
|
||||
void J3DMaterialFactory::createNormalMaterial(J3DMaterial*, int, unsigned long) const {
|
||||
J3DMaterial* J3DMaterialFactory::createNormalMaterial(J3DMaterial* mat, int idx, u32 flag) const {
|
||||
/* Nonmatching */
|
||||
if (mpDisplayListInit != NULL)
|
||||
return createLockedMaterial(mat, idx, flag);
|
||||
|
||||
u32 stageNum = countStages(idx);
|
||||
u32 tevStageNum = getMdlDataFlag_TevStageNum(flag);
|
||||
|
||||
if (stageNum > tevStageNum)
|
||||
tevStageNum = stageNum;
|
||||
|
||||
u32 texGenNum = countTexGens(idx);
|
||||
u32 texGenFlag = texGenNum > 4 ? 0 : getMdlDataFlag_TexGenFlag(flag);
|
||||
u32 colorFlag = getMdlDataFlag_ColorFlag(flag);
|
||||
u32 peFlag = getMdlDataFlag_PEFlag(flag);
|
||||
u32 indFlag = !!(flag & 0x01000000);
|
||||
|
||||
if (mat == NULL)
|
||||
mat = new J3DMaterial();
|
||||
|
||||
mat->mColorBlock = J3DMaterial::createColorBlock(colorFlag);
|
||||
mat->mTexGenBlock = J3DMaterial::createTexGenBlock(texGenFlag);
|
||||
mat->mTevBlock = J3DMaterial::createTevBlock(tevStageNum);
|
||||
mat->mIndBlock = J3DMaterial::createIndBlock(indFlag);
|
||||
mat->mPEBlock = J3DMaterial::createPEBlock(peFlag, getMaterialMode(idx));
|
||||
mat->mIndex = idx;
|
||||
mat->mMaterialMode = getMaterialMode(idx);
|
||||
mat->mColorBlock->setColorChanNum(newColorChanNum(idx));
|
||||
mat->mColorBlock->setCullMode(newCullMode(idx));
|
||||
mat->mTexGenBlock->setTexGenNum(newTexGenNum(idx));
|
||||
mat->mTexGenBlock->setNBTScale(newNBTScale(idx));
|
||||
mat->mPEBlock->setFog(newFog(idx));
|
||||
mat->mPEBlock->setAlphaComp(newAlphaComp(idx));
|
||||
mat->mPEBlock->setBlend(newBlend(idx));
|
||||
mat->mPEBlock->setZMode(newZMode(idx));
|
||||
mat->mPEBlock->setZCompLoc(newZCompLoc(idx));
|
||||
mat->mPEBlock->setDither(newDither(idx));
|
||||
mat->mTevBlock->setTevStageNum(newTevStageNum(idx));
|
||||
|
||||
for (u8 i = 0; i < tevStageNum; i++)
|
||||
mat->mTevBlock->setTexNo(i, newTexNo(idx, i));
|
||||
for (u8 i = 0; i < tevStageNum; i++)
|
||||
mat->mTevBlock->setTevOrder(i, newTevOrder(idx, i));
|
||||
for (u8 i = 0; i < tevStageNum; i++) {
|
||||
J3DMaterialInitData* initData = &mpMaterialInitData[mpMaterialID[idx]];
|
||||
mat->mTevBlock->setTevStage(i, newTevStage(idx, i));
|
||||
if (initData->mTevSwapModeIdx[i] != 0xFFFF) {
|
||||
mat->mTevBlock->getTevStage(i)->setTexSel(mpTevSwapModeInfo[initData->mTevSwapModeIdx[i]].mTexSel);
|
||||
mat->mTevBlock->getTevStage(i)->setRasSel(mpTevSwapModeInfo[initData->mTevSwapModeIdx[i]].mRasSel);
|
||||
}
|
||||
}
|
||||
for (u8 i = 0; i < 4; i++)
|
||||
mat->mTevBlock->setTevKColor(i, newTevKColor(idx, i));
|
||||
for (u8 i = 0; i < 4; i++)
|
||||
mat->mTevBlock->setTevColor(i, newTevColor(idx, i));
|
||||
for (u8 i = 0; i < 4; i++)
|
||||
mat->mTevBlock->setTevSwapModeTable(i, newTevSwapModeTable(idx, i));
|
||||
for (u8 i = 0; i < 2; i++)
|
||||
mat->mColorBlock->setAmbColor(i, newAmbColor(idx, i));
|
||||
for (u8 i = 0; i < 2; i++)
|
||||
mat->mColorBlock->setMatColor(i, newMatColor(idx, i));
|
||||
for (u8 i = 0; i < 4; i++)
|
||||
mat->mColorBlock->setColorChan(i, newColorChan(idx, i));
|
||||
for (u8 i = 0; i < texGenNum; i++) {
|
||||
J3DTexCoord texCoord = newTexCoord(idx, i);
|
||||
mat->mTexGenBlock->setTexCoord(i, &texCoord);
|
||||
}
|
||||
for (u8 i = 0; i < 8; i++) {
|
||||
mat->mTexGenBlock->setTexMtx(i, newTexMtx(idx, i));
|
||||
}
|
||||
J3DMaterialInitData* initData = &mpMaterialInitData[mpMaterialID[idx]];
|
||||
for (u8 i = 0; i < tevStageNum; i++) {
|
||||
if (initData->mTevKColorSel[i] != 0xff) {
|
||||
mat->mTevBlock->setTevKColorSel(i, initData->mTevKColorSel[i]);
|
||||
} else {
|
||||
mat->mTevBlock->setTevKColorSel(i, 0xc);
|
||||
}
|
||||
}
|
||||
for (u8 i = 0; i < tevStageNum; i++) {
|
||||
if (initData->mTevKAlphaSel[i] != 0xff) {
|
||||
mat->mTevBlock->setTevKAlphaSel(i, initData->mTevKAlphaSel[i]);
|
||||
} else {
|
||||
mat->mTevBlock->setTevKAlphaSel(i, 0x1c);
|
||||
}
|
||||
}
|
||||
if (mpIndInitData != NULL) {
|
||||
u8 indTexStageNum = newIndTexStageNum(idx);
|
||||
mat->mIndBlock->setIndTexStageNum(newIndTexStageNum(idx));
|
||||
for (u8 i = 0; i < indTexStageNum; i++)
|
||||
mat->mIndBlock->setIndTexMtx(i, newIndTexMtx(idx, i));
|
||||
for (u8 i = 0; i < indTexStageNum; i++)
|
||||
mat->mIndBlock->setIndTexOrder(i, newIndTexOrder(idx, i));
|
||||
for (u8 i = 0; i < indTexStageNum; i++)
|
||||
mat->mIndBlock->setIndTexCoordScale(i, newIndTexCoordScale(idx, i));
|
||||
for (u8 i = 0; i < tevStageNum; i++)
|
||||
mat->mTevBlock->setIndTevStage(i, newIndTevStage(idx, i));
|
||||
}
|
||||
return mat;
|
||||
}
|
||||
|
||||
/* 802F768C-802F7F98 .text createPatchedMaterial__18J3DMaterialFactoryCFP11J3DMaterialiUl */
|
||||
void J3DMaterialFactory::createPatchedMaterial(J3DMaterial*, int, unsigned long) const {
|
||||
J3DMaterial* J3DMaterialFactory::createPatchedMaterial(J3DMaterial* mat, int idx, u32 flag) const {
|
||||
/* Nonmatching */
|
||||
if (mat == NULL)
|
||||
mat = new J3DPatchedMaterial();
|
||||
|
||||
u32 indFlag = (flag & 0x03000000) ? 1 : 0;
|
||||
mat->mColorBlock = J3DMaterial::createColorBlock(0x40000000);
|
||||
|
||||
mat->mTexGenBlock = new J3DTexGenBlockPatched();
|
||||
mat->mTevBlock = new J3DTevBlockPatched();
|
||||
mat->mIndBlock = J3DMaterial::createIndBlock(indFlag);
|
||||
mat->mPEBlock = J3DMaterial::createPEBlock(0x10000000, getMaterialMode(idx));
|
||||
mat->mIndex = idx;
|
||||
mat->mMaterialMode = getMaterialMode(idx);
|
||||
mat->mTevBlock->setTevStageNum(newTevStageNum(idx));
|
||||
mat->mColorBlock->setColorChanNum(newColorChanNum(idx));
|
||||
mat->mColorBlock->setCullMode(newCullMode(idx));
|
||||
mat->mPEBlock->setFog(newFog(idx));
|
||||
mat->mPEBlock->setAlphaComp(newAlphaComp(idx));
|
||||
mat->mPEBlock->setBlend(newBlend(idx));
|
||||
mat->mPEBlock->setZMode(newZMode(idx));
|
||||
mat->mPEBlock->setZCompLoc(newZCompLoc(idx));
|
||||
mat->mPEBlock->setDither(newDither(idx));
|
||||
|
||||
u8 tevStageNum = mat->mTevBlock->getTevStageNum();
|
||||
for (u8 i = 0; i < 8; i++)
|
||||
mat->mTevBlock->setTexNo(i, newTexNo(idx, i));
|
||||
for (u8 i = 0; i < tevStageNum; i++)
|
||||
mat->mTevBlock->setTevOrder(i, newTevOrder(idx, i));
|
||||
for (u8 i = 0; i < 4; i++)
|
||||
mat->mTevBlock->setTevKColor(i, newTevKColor(idx, i));
|
||||
for (u8 i = 0; i < 4; i++)
|
||||
mat->mTevBlock->setTevColor(i, newTevColor(idx, i));
|
||||
for (u8 i = 0; i < tevStageNum; i++) {
|
||||
J3DMaterialInitData* initData = &mpMaterialInitData[mpMaterialID[idx]];
|
||||
mat->mTevBlock->setTevStage(i, newTevStage(idx, i));
|
||||
if (initData->mTevSwapModeIdx[i] != 0xFFFF) {
|
||||
mat->mTevBlock->getTevStage(i)->setTexSel(mpTevSwapModeInfo[initData->mTevSwapModeIdx[i]].mTexSel);
|
||||
mat->mTevBlock->getTevStage(i)->setRasSel(mpTevSwapModeInfo[initData->mTevSwapModeIdx[i]].mRasSel);
|
||||
}
|
||||
}
|
||||
J3DMaterialInitData* initData = &mpMaterialInitData[mpMaterialID[idx]];
|
||||
for (u8 i = 0; i < tevStageNum; i++) {
|
||||
if (initData->mTevKColorSel[i] != 0xff) {
|
||||
mat->mTevBlock->setTevKColorSel(i, initData->mTevKColorSel[i]);
|
||||
} else {
|
||||
mat->mTevBlock->setTevKColorSel(i, 0xc);
|
||||
}
|
||||
}
|
||||
for (u8 i = 0; i < 2; i++)
|
||||
mat->mColorBlock->setMatColor(i, newMatColor(idx, i));
|
||||
for (u8 i = 0; i < 4; i++)
|
||||
mat->mColorBlock->setColorChan(i, newColorChan(idx, i));
|
||||
|
||||
u32 texGenNum = countTexGens(idx);
|
||||
mat->mTexGenBlock->setTexGenNum(newTexGenNum(idx));
|
||||
for (u8 i = 0; i < 8; i++)
|
||||
mat->mTexGenBlock->setTexMtx(i, newTexMtx(idx, i));
|
||||
for (u8 i = 0; i < texGenNum; i++) {
|
||||
J3DTexCoord texCoord = newTexCoord(idx, i);
|
||||
mat->mTexGenBlock->setTexCoord(i, &texCoord);
|
||||
}
|
||||
if (mpIndInitData != NULL) {
|
||||
u8 indTexStageNum = newIndTexStageNum(idx);
|
||||
mat->mIndBlock->setIndTexStageNum(newIndTexStageNum(idx));
|
||||
for (u8 i = 0; i < indTexStageNum; i++)
|
||||
mat->mIndBlock->setIndTexMtx(i, newIndTexMtx(idx, i));
|
||||
for (u8 i = 0; i < indTexStageNum; i++)
|
||||
mat->mIndBlock->setIndTexOrder(i, newIndTexOrder(idx, i));
|
||||
for (u8 i = 0; i < indTexStageNum; i++)
|
||||
mat->mIndBlock->setIndTexCoordScale(i, newIndTexCoordScale(idx, i));
|
||||
for (u8 i = 0; i < tevStageNum; i++)
|
||||
mat->mTevBlock->setIndTevStage(i, newIndTevStage(idx, i));
|
||||
}
|
||||
return mat;
|
||||
}
|
||||
|
||||
/* 802F7F98-802F80F8 .text modifyPatchedCurrentMtx__18J3DMaterialFactoryCFP11J3DMateriali */
|
||||
void J3DMaterialFactory::modifyPatchedCurrentMtx(J3DMaterial*, int) const {
|
||||
void J3DMaterialFactory::modifyPatchedCurrentMtx(J3DMaterial* mat, int idx) const {
|
||||
/* Nonmatching */
|
||||
J3DTexCoord coord[8];
|
||||
u32 texGenNum = countTexGens(idx);
|
||||
for (u8 i = 0; i < texGenNum; i++)
|
||||
coord[i] = newTexCoord(idx, i);
|
||||
mat->mCurrentMtx.setCurrentTexMtx(
|
||||
coord[0].getTexGenMtx(),
|
||||
coord[1].getTexGenMtx(),
|
||||
coord[2].getTexGenMtx(),
|
||||
coord[3].getTexGenMtx(),
|
||||
coord[4].getTexGenMtx(),
|
||||
coord[5].getTexGenMtx(),
|
||||
coord[6].getTexGenMtx(),
|
||||
coord[7].getTexGenMtx()
|
||||
);
|
||||
}
|
||||
|
||||
/* 802F80F8-802F83A0 .text createLockedMaterial__18J3DMaterialFactoryCFP11J3DMaterialiUl */
|
||||
void J3DMaterialFactory::createLockedMaterial(J3DMaterial*, int, unsigned long) const {
|
||||
/* Nonmatching */
|
||||
J3DMaterial* J3DMaterialFactory::createLockedMaterial(J3DMaterial* mat, int idx, u32 flag) const {
|
||||
/* Nonmatching - J3DCurrentMtx constructor */
|
||||
if (mat == NULL) {
|
||||
mat = new J3DLockedMaterial();
|
||||
mat->mColorBlock = new J3DColorBlockNull();
|
||||
mat->mTexGenBlock = new J3DTexGenBlockNull();
|
||||
mat->mTevBlock = new J3DTevBlockNull();
|
||||
mat->mIndBlock = new J3DIndBlockNull();
|
||||
mat->mPEBlock = new J3DPEBlockNull();
|
||||
mat->mIndex = idx;
|
||||
mat->mMaterialMode = field_0x84[idx];
|
||||
}
|
||||
|
||||
mat->mCurrentMtx = J3DCurrentMtx(mpCurrentMtxInfo[idx]);
|
||||
mat->mColorBlock->setMatColorOffset(mpPatchingInfo[idx].mMatColorOffset);
|
||||
mat->mColorBlock->setColorChanOffset(mpPatchingInfo[idx].mColorChanOffset);
|
||||
mat->mTexGenBlock->setTexMtxOffset(mpPatchingInfo[idx].mTexMtxOffset);
|
||||
mat->mTevBlock->setTexNoOffset(mpPatchingInfo[idx].mTexNoOffset);
|
||||
mat->mTevBlock->setTevRegOffset(mpPatchingInfo[idx].mTevRegOffset);
|
||||
mat->mPEBlock->setFogOffset(mpPatchingInfo[idx].mFogOffset);
|
||||
if (mat->mSharedDLObj == NULL) {
|
||||
mat->mSharedDLObj = new J3DDisplayListObj();
|
||||
mat->mSharedDLObj->setSingleDisplayList((void*)(mpDisplayListInit[idx].mOffset + (u32)&mpDisplayListInit[idx]), mpDisplayListInit[idx].mSize);
|
||||
}
|
||||
return mat;
|
||||
}
|
||||
|
||||
/* 802F83A0-802F8420 .text calcSize__18J3DMaterialFactoryCFP11J3DMaterialQ218J3DMaterialFactory12MaterialTypeiUl */
|
||||
u32 J3DMaterialFactory::calcSize(J3DMaterial*, J3DMaterialFactory::MaterialType, int, unsigned long) const {
|
||||
/* Nonmatching */
|
||||
u32 J3DMaterialFactory::calcSize(J3DMaterial* mat, J3DMaterialFactory::MaterialType type, int idx, u32 flag) const {
|
||||
u32 ret = 0;
|
||||
switch (type) {
|
||||
case MATERIAL_TYPE_NORMAL:
|
||||
ret = calcSizeNormalMaterial(mat, idx, flag);
|
||||
break;
|
||||
case MATERIAL_TYPE_LOCKED:
|
||||
ret = calcSizeLockedMaterial(mat, idx, flag);
|
||||
break;
|
||||
case MATERIAL_TYPE_PATCHED:
|
||||
ret = calcSizePatchedMaterial(mat, idx, flag);
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 802F8420-802F8554 .text calcSizeNormalMaterial__18J3DMaterialFactoryCFP11J3DMaterialiUl */
|
||||
u32 J3DMaterialFactory::calcSizeNormalMaterial(J3DMaterial*, int, unsigned long) const {
|
||||
u32 J3DMaterialFactory::calcSizeNormalMaterial(J3DMaterial*, int, u32) const {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802F8554-802F8624 .text calcSizePatchedMaterial__18J3DMaterialFactoryCFP11J3DMaterialiUl */
|
||||
u32 J3DMaterialFactory::calcSizePatchedMaterial(J3DMaterial*, int, unsigned long) const {
|
||||
u32 J3DMaterialFactory::calcSizePatchedMaterial(J3DMaterial*, int, u32) const {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802F8624-802F863C .text calcSizeLockedMaterial__18J3DMaterialFactoryCFP11J3DMaterialiUl */
|
||||
u32 J3DMaterialFactory::calcSizeLockedMaterial(J3DMaterial*, int, unsigned long) const {
|
||||
u32 J3DMaterialFactory::calcSizeLockedMaterial(J3DMaterial*, int, u32) const {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802F863C-802F86CC .text newMatColor__18J3DMaterialFactoryCFii */
|
||||
void J3DMaterialFactory::newMatColor(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DGXColor J3DMaterialFactory::newMatColor(int idx, int stage) const {
|
||||
GXColor _ret = { 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
J3DGXColor ret(_ret);
|
||||
J3DMaterialInitData* initData = &mpMaterialInitData[mpMaterialID[idx]];
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mMatColorIdx[stage];
|
||||
if (no != 0xFFFF)
|
||||
return mpMatColor[no];
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 802F86CC-802F8704 .text newColorChanNum__18J3DMaterialFactoryCFi */
|
||||
void J3DMaterialFactory::newColorChanNum(int) const {
|
||||
/* Nonmatching */
|
||||
u8 J3DMaterialFactory::newColorChanNum(int idx) const {
|
||||
u8 no = mpMaterialInitData[mpMaterialID[idx]].mColorChanNumIdx;
|
||||
if (no != 0xFF)
|
||||
return mpColorChanNum[no];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 802F8704-802F88A8 .text newColorChan__18J3DMaterialFactoryCFii */
|
||||
void J3DMaterialFactory::newColorChan(int, int) const {
|
||||
J3DColorChan J3DMaterialFactory::newColorChan(int idx, int stage) const {
|
||||
/* Nonmatching */
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mColorChanIdx[stage];
|
||||
if (no != 0xFFFF)
|
||||
return J3DColorChan(mpColorChanInfo[no]);
|
||||
else
|
||||
return J3DColorChan();
|
||||
}
|
||||
|
||||
/* 802F88A8-802F8938 .text newAmbColor__18J3DMaterialFactoryCFii */
|
||||
void J3DMaterialFactory::newAmbColor(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DGXColor J3DMaterialFactory::newAmbColor(int idx, int stage) const {
|
||||
GXColor _ret = { 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
J3DGXColor ret(_ret);
|
||||
J3DMaterialInitData* initData = &mpMaterialInitData[mpMaterialID[idx]];
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mAmbColorIdx[stage];
|
||||
if (no != 0xFFFF)
|
||||
return mpAmbColor[no];
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 802F8938-802F8970 .text newTexGenNum__18J3DMaterialFactoryCFi */
|
||||
void J3DMaterialFactory::newTexGenNum(int) const {
|
||||
/* Nonmatching */
|
||||
u32 J3DMaterialFactory::newTexGenNum(int idx) const {
|
||||
u8 no = mpMaterialInitData[mpMaterialID[idx]].mTexGenNumIdx;
|
||||
if (no != 0xFF)
|
||||
return mpTexGenNum[no];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 802F8970-802F89E4 .text newTexCoord__18J3DMaterialFactoryCFii */
|
||||
void J3DMaterialFactory::newTexCoord(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DTexCoord J3DMaterialFactory::newTexCoord(int idx, int stage) const {
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mTexCoordIdx[stage];
|
||||
if (no != 0xFFFF)
|
||||
return J3DTexCoord(mpTexCoordInfo[no]);
|
||||
else
|
||||
return J3DTexCoord();
|
||||
}
|
||||
|
||||
/* 802F89E4-802F8AF4 .text newTexMtx__18J3DMaterialFactoryCFii */
|
||||
void J3DMaterialFactory::newTexMtx(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DTexMtx* J3DMaterialFactory::newTexMtx(int idx, int stage) const {
|
||||
J3DTexMtx* ret = NULL;
|
||||
J3DMaterialInitData* initData = &mpMaterialInitData[mpMaterialID[idx]];
|
||||
if (initData->mTexMtxIdx[stage] != 0xFFFF)
|
||||
ret = new J3DTexMtx(mpTexMtxInfo[initData->mTexMtxIdx[stage]]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 802F8AF4-802F8B34 .text newCullMode__18J3DMaterialFactoryCFi */
|
||||
void J3DMaterialFactory::newCullMode(int) const {
|
||||
/* Nonmatching */
|
||||
u8 J3DMaterialFactory::newCullMode(int idx) const {
|
||||
u8 no = mpMaterialInitData[mpMaterialID[idx]].mCullModeIdx;
|
||||
if (no != 0xFF)
|
||||
return mpCullMode[no];
|
||||
else
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
/* 802F8B34-802F8B7C .text newTexNo__18J3DMaterialFactoryCFii */
|
||||
void J3DMaterialFactory::newTexNo(int, int) const {
|
||||
/* Nonmatching */
|
||||
u16 J3DMaterialFactory::newTexNo(int idx, int stage) const {
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mTexNoIdx[stage];
|
||||
if (no != 0xFFFF)
|
||||
return mpTexNo[no];
|
||||
else
|
||||
return 0xFFFF;
|
||||
}
|
||||
|
||||
/* 802F8B7C-802F8BF0 .text newTevOrder__18J3DMaterialFactoryCFii */
|
||||
void J3DMaterialFactory::newTevOrder(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DTevOrder J3DMaterialFactory::newTevOrder(int idx, int stage) const {
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mTevOrderIdx[stage];
|
||||
if (no != 0xFFFF)
|
||||
return J3DTevOrder(mpTevOrderInfo[no]);
|
||||
else
|
||||
return J3DTevOrder();
|
||||
}
|
||||
|
||||
/* 802F8BF0-802F8C88 .text newTevColor__18J3DMaterialFactoryCFii */
|
||||
void J3DMaterialFactory::newTevColor(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DGXColorS10 J3DMaterialFactory::newTevColor(int idx, int stage) const {
|
||||
GXColorS10 _ret = { 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
J3DGXColorS10 ret(_ret);
|
||||
J3DMaterialInitData* initData = &mpMaterialInitData[mpMaterialID[idx]];
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mTevColorIdx[stage];
|
||||
if (no != 0xFFFF)
|
||||
return mpTevColor[no];
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 802F8C88-802F8D18 .text newTevKColor__18J3DMaterialFactoryCFii */
|
||||
void J3DMaterialFactory::newTevKColor(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DGXColor J3DMaterialFactory::newTevKColor(int idx, int stage) const {
|
||||
GXColor _ret = { 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
J3DGXColor ret(_ret);
|
||||
J3DMaterialInitData* initData = &mpMaterialInitData[mpMaterialID[idx]];
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mTevKColorIdx[stage];
|
||||
if (no != 0xFFFF)
|
||||
return mpTevKColor[no];
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 802F8D18-802F8D50 .text newTevStageNum__18J3DMaterialFactoryCFi */
|
||||
void J3DMaterialFactory::newTevStageNum(int) const {
|
||||
/* Nonmatching */
|
||||
u8 J3DMaterialFactory::newTevStageNum(int idx) const {
|
||||
u8 no = mpMaterialInitData[mpMaterialID[idx]].mTevStageNumIdx;
|
||||
if (no != 0xFF)
|
||||
return mpTevStageNum[no];
|
||||
else
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
/* 802F8D50-802F8DB0 .text newTevStage__18J3DMaterialFactoryCFii */
|
||||
void J3DMaterialFactory::newTevStage(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DTevStage J3DMaterialFactory::newTevStage(int idx, int stage) const {
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mTevStageIdx[stage];
|
||||
if (no != 0xFFFF)
|
||||
return J3DTevStage(mpTevStageInfo[no]);
|
||||
else
|
||||
return J3DTevStage();
|
||||
}
|
||||
|
||||
/* 802F8DB0-802F8E4C .text newTevSwapModeTable__18J3DMaterialFactoryCFii */
|
||||
void J3DMaterialFactory::newTevSwapModeTable(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DTevSwapModeTable J3DMaterialFactory::newTevSwapModeTable(int idx, int stage) const {
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mTevSwapModeTableIdx[stage];
|
||||
if (no != 0xFFFF)
|
||||
return J3DTevSwapModeTable(mpTevSwapModeTableInfo[no]);
|
||||
else
|
||||
return J3DTevSwapModeTable(j3dDefaultTevSwapModeTable);
|
||||
}
|
||||
|
||||
/* 802F8E4C-802F8E74 .text newIndTexStageNum__18J3DMaterialFactoryCFi */
|
||||
void J3DMaterialFactory::newIndTexStageNum(int) const {
|
||||
/* Nonmatching */
|
||||
u8 J3DMaterialFactory::newIndTexStageNum(int idx) const {
|
||||
if (mpIndInitData[idx].mEnabled == true)
|
||||
return mpIndInitData[idx].mIndTexStageNum;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 802F8E74-802F8ED4 .text newIndTexOrder__18J3DMaterialFactoryCFii */
|
||||
void J3DMaterialFactory::newIndTexOrder(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DIndTexOrder J3DMaterialFactory::newIndTexOrder(int idx, int stage) const {
|
||||
J3DIndTexOrder ret;
|
||||
if (mpIndInitData[idx].mEnabled == true)
|
||||
return J3DIndTexOrder(mpIndInitData[idx].mIndTexOrderInfo[stage]);
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 802F8ED4-802F8FD0 .text newIndTexMtx__18J3DMaterialFactoryCFii */
|
||||
void J3DMaterialFactory::newIndTexMtx(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DIndTexMtx J3DMaterialFactory::newIndTexMtx(int idx, int stage) const {
|
||||
J3DIndTexMtx ret;
|
||||
if (mpIndInitData[idx].mEnabled == true)
|
||||
return J3DIndTexMtx(mpIndInitData[idx].mIndTexMtxInfo[stage]);
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 802F8FD0-802F9164 .text newIndTevStage__18J3DMaterialFactoryCFii */
|
||||
void J3DMaterialFactory::newIndTevStage(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DIndTevStage J3DMaterialFactory::newIndTevStage(int idx, int stage) const {
|
||||
J3DIndTevStage ret;
|
||||
if (mpIndInitData[idx].mEnabled == true)
|
||||
return J3DIndTevStage(mpIndInitData[idx].mIndTevStageInfo[stage]);
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 802F9164-802F91C4 .text newIndTexCoordScale__18J3DMaterialFactoryCFii */
|
||||
void J3DMaterialFactory::newIndTexCoordScale(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DIndTexCoordScale J3DMaterialFactory::newIndTexCoordScale(int idx, int stage) const {
|
||||
J3DIndTexCoordScale ret;
|
||||
if (mpIndInitData[idx].mEnabled == true)
|
||||
return J3DIndTexCoordScale(mpIndInitData[idx].mIndTexCoordScaleInfo[stage]);
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 802F91C4-802F9348 .text newFog__18J3DMaterialFactoryCFi */
|
||||
void J3DMaterialFactory::newFog(int) const {
|
||||
/* Nonmatching */
|
||||
J3DFog* J3DMaterialFactory::newFog(int idx) const {
|
||||
J3DMaterialInitData* initData = &mpMaterialInitData[mpMaterialID[idx]];
|
||||
if (initData->mFogIdx != 0xFFFF)
|
||||
return new J3DFog(mpFogInfo[initData->mFogIdx]);
|
||||
else
|
||||
return new J3DFog();
|
||||
}
|
||||
|
||||
/* 802F9348-802F93C8 .text newAlphaComp__18J3DMaterialFactoryCFi */
|
||||
void J3DMaterialFactory::newAlphaComp(int) const {
|
||||
/* Nonmatching */
|
||||
J3DAlphaComp J3DMaterialFactory::newAlphaComp(int idx) const {
|
||||
/* Nonmatching - default constructor loads id 0xFFFF rather than j3dDefaultAlphaCompInfo */
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mAlphaCompIdx;
|
||||
if (no != 0xFFFF)
|
||||
return J3DAlphaComp(mpAlphaCompInfo[no]);
|
||||
else
|
||||
return J3DAlphaComp();
|
||||
}
|
||||
|
||||
/* 802F93C8-802F9444 .text newBlend__18J3DMaterialFactoryCFi */
|
||||
void J3DMaterialFactory::newBlend(int) const {
|
||||
/* Nonmatching */
|
||||
J3DBlend J3DMaterialFactory::newBlend(int idx) const {
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mBlendIdx;
|
||||
if (no != 0xFFFF)
|
||||
return J3DBlend(mpBlendInfo[no]);
|
||||
else
|
||||
return J3DBlend();
|
||||
}
|
||||
|
||||
/* 802F9444-802F94A4 .text newZMode__18J3DMaterialFactoryCFi */
|
||||
void J3DMaterialFactory::newZMode(int) const {
|
||||
/* Nonmatching */
|
||||
J3DZMode J3DMaterialFactory::newZMode(int idx) const {
|
||||
/* Nonmatching - J3DZModeInfo array seems to be 0x04-sized */
|
||||
u8 no = mpMaterialInitData[mpMaterialID[idx]].mZModeIdx;
|
||||
if (no != 0xFF)
|
||||
return J3DZMode(mpZModeInfo[no]);
|
||||
else
|
||||
return J3DZMode();
|
||||
}
|
||||
|
||||
/* 802F94A4-802F94DC .text newZCompLoc__18J3DMaterialFactoryCFi */
|
||||
void J3DMaterialFactory::newZCompLoc(int) const {
|
||||
/* Nonmatching */
|
||||
u8 J3DMaterialFactory::newZCompLoc(int idx) const {
|
||||
u8 no = mpMaterialInitData[mpMaterialID[idx]].mZCompLocIdx;
|
||||
if (no != 0xFF)
|
||||
return mpZCompLoc[no];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 802F94DC-802F9514 .text newDither__18J3DMaterialFactoryCFi */
|
||||
void J3DMaterialFactory::newDither(int) const {
|
||||
/* Nonmatching */
|
||||
u8 J3DMaterialFactory::newDither(int idx) const {
|
||||
u8 no = mpMaterialInitData[mpMaterialID[idx]].mDitherIdx;
|
||||
if (no != 0xFF)
|
||||
return mpDither[no];
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* 802F9514-802F95B8 .text newNBTScale__18J3DMaterialFactoryCFi */
|
||||
void J3DMaterialFactory::newNBTScale(int) const {
|
||||
/* Nonmatching */
|
||||
J3DNBTScale J3DMaterialFactory::newNBTScale(int idx) const {
|
||||
J3DNBTScale ret;
|
||||
u16 no = mpMaterialInitData[mpMaterialID[idx]].mNBTScaleIdx;
|
||||
if (no != 0xFFFF)
|
||||
return J3DNBTScale(mpNBTScaleInfo[no]);
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -4,44 +4,228 @@
|
||||
//
|
||||
|
||||
#include "JSystem/J3DGraphLoader/J3DShapeFactory.h"
|
||||
#include "JSystem/J3DGraphBase/J3DShape.h"
|
||||
#include "JSystem/J3DGraphBase/J3DShapeDraw.h"
|
||||
#include "JSystem/J3DGraphBase/J3DShapeMtx.h"
|
||||
#include "JSystem/JSupport/JSupport.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "dolphin/gx/GXAttr.h"
|
||||
#include "dolphin/os/OS.h"
|
||||
|
||||
/* 802FE3A8-802FE458 .text __ct__15J3DShapeFactoryFRC13J3DShapeBlock */
|
||||
J3DShapeFactory::J3DShapeFactory(const J3DShapeBlock&) {
|
||||
/* Nonmatching */
|
||||
J3DShapeFactory::J3DShapeFactory(const J3DShapeBlock& block) {
|
||||
mpShapeInitData = JSUConvertOffsetToPtr<J3DShapeInitData>(&block, (u32)block.mpShapeInitData);
|
||||
mpIndexTable = JSUConvertOffsetToPtr<u16>(&block, (u32)block.mpIndexTable);
|
||||
mpVtxDescList = JSUConvertOffsetToPtr<GXVtxDescList>(&block, (u32)block.mpVtxDescList);
|
||||
mpMtxTable = JSUConvertOffsetToPtr<u16>(&block, (u32)block.mpMtxTable);
|
||||
mpDisplayListData = JSUConvertOffsetToPtr<u8>(&block, (u32)block.mpDisplayListData);
|
||||
mpMtxInitData = JSUConvertOffsetToPtr<J3DShapeMtxInitData>(&block, (u32)block.mpMtxInitData);
|
||||
mpDrawInitData = JSUConvertOffsetToPtr<J3DShapeDrawInitData>(&block, (u32)block.mpDrawInitData);
|
||||
mpVcdVatCmdBuffer = NULL;
|
||||
}
|
||||
|
||||
/* 802FE458-802FE614 .text create__15J3DShapeFactoryFiUlP14_GXVtxDescList */
|
||||
J3DShape* J3DShapeFactory::create(int, u32, GXVtxDescList*) {
|
||||
/* Nonmatching */
|
||||
J3DShape* J3DShapeFactory::create(int no, u32 flag, GXVtxDescList* vtxDesc) {
|
||||
J3DShape* shape = new J3DShape();
|
||||
shape->mMtxGroupNum = getMtxGroupNum(no);
|
||||
shape->mRadius = getRadius(no);
|
||||
shape->mVtxDesc = getVtxDescList(no);
|
||||
shape->mShapeMtx = new J3DShapeMtx*[shape->mMtxGroupNum];
|
||||
shape->mShapeDraw = new J3DShapeDraw*[shape->mMtxGroupNum];
|
||||
shape->mMin = getMin(no);
|
||||
shape->mMax = getMax(no);
|
||||
shape->mVcdVatCmd = mpVcdVatCmdBuffer + no * J3DShape::kVcdVatDLSize;
|
||||
|
||||
for (s32 i = 0; i < shape->mMtxGroupNum; i++) {
|
||||
shape->mShapeMtx[i] = newShapeMtx(flag, no, i);
|
||||
shape->mShapeDraw[i] = newShapeDraw(no, i);
|
||||
}
|
||||
|
||||
shape->mIndex = no;
|
||||
return shape;
|
||||
}
|
||||
|
||||
static inline u32 getMdlDataFlag_MtxLoadType(u32 flag) {
|
||||
return flag & 0xF0;
|
||||
}
|
||||
|
||||
enum {
|
||||
J3DMdlDataFlag_Imm = 0x10,
|
||||
J3DMdlDataFlag_ConcatView = 0x20,
|
||||
};
|
||||
|
||||
enum {
|
||||
J3DShapeMtxType_Mtx = 0x00,
|
||||
J3DShapeMtxType_BBoard = 0x01,
|
||||
J3DShapeMtxType_YBBoard = 0x02,
|
||||
J3DShapeMtxType_Multi = 0x03,
|
||||
};
|
||||
|
||||
/* 802FE614-802FEA40 .text newShapeMtx__15J3DShapeFactoryCFUlii */
|
||||
J3DShapeMtx* J3DShapeFactory::newShapeMtx(u32, int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DShapeMtx* J3DShapeFactory::newShapeMtx(u32 flag, int shapeNo, int mtxGroupNo) const {
|
||||
J3DShapeMtx* ret = NULL;
|
||||
const J3DShapeInitData& shapeInitData = mpShapeInitData[mpIndexTable[shapeNo]];
|
||||
const J3DShapeMtxInitData& mtxInitData = (&mpMtxInitData[shapeInitData.mMtxInitDataIndex])[mtxGroupNo];
|
||||
|
||||
switch (getMdlDataFlag_MtxLoadType(flag)) {
|
||||
case J3DMdlDataFlag_Imm:
|
||||
switch (shapeInitData.mShapeMtxType) {
|
||||
case J3DShapeMtxType_Mtx:
|
||||
ret = new J3DShapeMtxImm(mtxInitData.mUseMtxIndex);
|
||||
break;
|
||||
case J3DShapeMtxType_BBoard:
|
||||
ret = new J3DShapeMtxBBoardImm(mtxInitData.mUseMtxIndex);
|
||||
break;
|
||||
case J3DShapeMtxType_YBBoard:
|
||||
ret = new J3DShapeMtxYBBoardImm(mtxInitData.mUseMtxIndex);
|
||||
break;
|
||||
case J3DShapeMtxType_Multi:
|
||||
ret = new J3DShapeMtxMultiImm(mtxInitData.mUseMtxIndex, mtxInitData.mUseMtxCount, &mpMtxTable[mtxInitData.mFirstUseMtxIndex]);
|
||||
break;
|
||||
default:
|
||||
OSReport("WRONG SHAPE MATRIX TYPE (J3DModelInit.cpp)\n");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case J3DMdlDataFlag_ConcatView:
|
||||
switch (shapeInitData.mShapeMtxType) {
|
||||
case J3DShapeMtxType_Mtx:
|
||||
ret = new J3DShapeMtxConcatView(mtxInitData.mUseMtxIndex);
|
||||
break;
|
||||
case J3DShapeMtxType_BBoard:
|
||||
ret = new J3DShapeMtxBBoardConcatView(mtxInitData.mUseMtxIndex);
|
||||
break;
|
||||
case J3DShapeMtxType_YBBoard:
|
||||
ret = new J3DShapeMtxYBBoardConcatView(mtxInitData.mUseMtxIndex);
|
||||
break;
|
||||
case J3DShapeMtxType_Multi:
|
||||
ret = new J3DShapeMtxMultiConcatView(mtxInitData.mUseMtxIndex, mtxInitData.mUseMtxCount, &mpMtxTable[mtxInitData.mFirstUseMtxIndex]);
|
||||
break;
|
||||
default:
|
||||
OSReport("WRONG SHAPE MATRIX TYPE (J3DModelInit.cpp)\n");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0:
|
||||
default:
|
||||
switch (shapeInitData.mShapeMtxType) {
|
||||
case J3DShapeMtxType_Mtx:
|
||||
case J3DShapeMtxType_BBoard:
|
||||
case J3DShapeMtxType_YBBoard:
|
||||
ret = new J3DShapeMtx(mtxInitData.mUseMtxIndex);
|
||||
break;
|
||||
case J3DShapeMtxType_Multi:
|
||||
ret = new J3DShapeMtxMulti(mtxInitData.mUseMtxIndex, mtxInitData.mUseMtxCount, &mpMtxTable[mtxInitData.mFirstUseMtxIndex]);
|
||||
break;
|
||||
default:
|
||||
OSReport("WRONG SHAPE MATRIX TYPE (J3DModelInit.cpp)\n");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 802FEA40-802FEACC .text newShapeDraw__15J3DShapeFactoryCFii */
|
||||
J3DShapeDraw* J3DShapeFactory::newShapeDraw(int, int) const {
|
||||
/* Nonmatching */
|
||||
J3DShapeDraw* J3DShapeFactory::newShapeDraw(int shapeNo, int mtxGroupNo) const {
|
||||
const J3DShapeInitData& shapeInitData = mpShapeInitData[mpIndexTable[shapeNo]];
|
||||
const J3DShapeDrawInitData& drawInitData = (&mpDrawInitData[shapeInitData.mDrawInitDataIndex])[mtxGroupNo];
|
||||
return new J3DShapeDraw(&mpDisplayListData[drawInitData.mDisplayListIndex], drawInitData.mDisplayListSize);
|
||||
}
|
||||
|
||||
/* 802FEACC-802FEB38 .text allocVcdVatCmdBuffer__15J3DShapeFactoryFUl */
|
||||
void J3DShapeFactory::allocVcdVatCmdBuffer(u32) {
|
||||
/* Nonmatching */
|
||||
void J3DShapeFactory::allocVcdVatCmdBuffer(u32 count) {
|
||||
mpVcdVatCmdBuffer = new (0x20) u8[J3DShape::kVcdVatDLSize * count];
|
||||
for (u32 i = 0; i < (J3DShape::kVcdVatDLSize * count) / 4; i++)
|
||||
((u32*)mpVcdVatCmdBuffer)[i] = 0;
|
||||
}
|
||||
|
||||
/* 802FEB38-802FEBCC .text calcSize__15J3DShapeFactoryFiUl */
|
||||
s32 J3DShapeFactory::calcSize(int, u32) {
|
||||
/* Nonmatching */
|
||||
s32 J3DShapeFactory::calcSize(int shapeNo, u32 flag) {
|
||||
s32 size = 0x68;
|
||||
|
||||
s32 mtxGroupNo = getMtxGroupNum(shapeNo);
|
||||
size += mtxGroupNo * 4;
|
||||
size += mtxGroupNo * 4;
|
||||
|
||||
for (u32 i = 0; i < mtxGroupNo; i++) {
|
||||
s32 shapeMtxSize = calcSizeShapeMtx(flag, shapeNo, i);
|
||||
size += shapeMtxSize;
|
||||
size += 0x0C;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 802FEBCC-802FEBDC .text calcSizeVcdVatCmdBuffer__15J3DShapeFactoryFUl */
|
||||
s32 J3DShapeFactory::calcSizeVcdVatCmdBuffer(u32) {
|
||||
/* Nonmatching */
|
||||
s32 J3DShapeFactory::calcSizeVcdVatCmdBuffer(u32 count) {
|
||||
return ALIGN_NEXT(count * J3DShape::kVcdVatDLSize, 0x20);
|
||||
}
|
||||
|
||||
/* 802FEBDC-802FED40 .text calcSizeShapeMtx__15J3DShapeFactoryCFUlii */
|
||||
s32 J3DShapeFactory::calcSizeShapeMtx(u32, int, int) const {
|
||||
/* Nonmatching */
|
||||
s32 J3DShapeFactory::calcSizeShapeMtx(u32 flag, int shapeNo, int mtxGrouNo) const {
|
||||
const J3DShapeInitData& shapeInitData = mpShapeInitData[mpIndexTable[shapeNo]];
|
||||
u32 ret = 0;
|
||||
|
||||
u32 mtxLoadType = getMdlDataFlag_MtxLoadType(flag);
|
||||
switch (mtxLoadType) {
|
||||
case J3DMdlDataFlag_Imm:
|
||||
switch (shapeInitData.mShapeMtxType) {
|
||||
case J3DShapeMtxType_Mtx:
|
||||
ret = 0x08;
|
||||
break;
|
||||
case J3DShapeMtxType_BBoard:
|
||||
ret = 0x08;
|
||||
break;
|
||||
case J3DShapeMtxType_YBBoard:
|
||||
ret = 0x08;
|
||||
break;
|
||||
case J3DShapeMtxType_Multi:
|
||||
ret = 0x10;
|
||||
break;
|
||||
default:
|
||||
OSReport("WRONG SHAPE MATRIX TYPE (J3DModelInit.cpp)\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case J3DMdlDataFlag_ConcatView:
|
||||
switch (shapeInitData.mShapeMtxType) {
|
||||
case J3DShapeMtxType_Mtx:
|
||||
ret = 0x08;
|
||||
break;
|
||||
case J3DShapeMtxType_BBoard:
|
||||
ret = 0x08;
|
||||
break;
|
||||
case J3DShapeMtxType_YBBoard:
|
||||
ret = 0x08;
|
||||
break;
|
||||
case J3DShapeMtxType_Multi:
|
||||
ret = 0x10;
|
||||
break;
|
||||
default:
|
||||
OSReport("WRONG SHAPE MATRIX TYPE (J3DModelInit.cpp)\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case 0:
|
||||
default:
|
||||
switch (shapeInitData.mShapeMtxType) {
|
||||
case J3DShapeMtxType_Mtx:
|
||||
case J3DShapeMtxType_BBoard:
|
||||
case J3DShapeMtxType_YBBoard:
|
||||
ret = 0x08;
|
||||
break;
|
||||
case J3DShapeMtxType_Multi:
|
||||
ret = 0x10;
|
||||
break;
|
||||
default:
|
||||
OSReport("WRONG SHAPE MATRIX TYPE (J3DModelInit.cpp)\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#include "dolphin/os/OS.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "MSL_C/new.h"
|
||||
|
||||
/* 802B1558-802B15D0 .text createRoot__10JKRExpHeapFib */
|
||||
JKRExpHeap* JKRExpHeap::createRoot(int maxHeaps, bool errorFlag) {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "JSystem/JParticle/JPADrawVisitor.h"
|
||||
#include "JSystem/JParticle/JPABaseShape.h"
|
||||
#include "JSystem/JParticle/JPAEmitter.h"
|
||||
#include "JSystem/JParticle/JPAExtraShape.h"
|
||||
#include "JSystem/JParticle/JPAParticle.h"
|
||||
#include "JSystem/JParticle/JPAResourceManager.h"
|
||||
#include "JSystem/JParticle/JPASweepShape.h"
|
||||
@@ -13,6 +14,10 @@
|
||||
#include "dolphin/gx/GX.h"
|
||||
#include "dolphin/mtx/mtx.h"
|
||||
|
||||
static inline u32 COLOR_MULTI(u32 a, u32 b) {
|
||||
return ((a * (b + 1)) * 0x10000) >> 24;
|
||||
}
|
||||
|
||||
JPADrawClipBoard* JPADrawContext::pcb;
|
||||
|
||||
/* 8025F960-8025FBE4 .text exec__20JPADrawExecLoadExTexFPC14JPADrawContext */
|
||||
@@ -338,7 +343,15 @@ void JPADrawExecRotationCross::exec(const JPADrawContext* ctx, JPABaseParticle*
|
||||
|
||||
/* 802632EC-80263380 .text exec__16JPADrawExecPointFPC14JPADrawContextP15JPABaseParticle */
|
||||
void JPADrawExecPoint::exec(const JPADrawContext* ctx, JPABaseParticle* ptcl) {
|
||||
/* Nonmatching */
|
||||
if (ptcl->isInvisibleParticle())
|
||||
return;
|
||||
|
||||
JGeometry::TVec3<f32> pos(ptcl->mPosition);
|
||||
|
||||
GXBegin(GX_POINTS, GX_VTXFMT0, 1);
|
||||
GXPosition3f32(pos.x, pos.y, pos.z);
|
||||
GXTexCoord2f32(0.0f, 0.0f);
|
||||
GXEnd();
|
||||
}
|
||||
|
||||
/* 80263380-80263508 .text exec__15JPADrawExecLineFPC14JPADrawContextP15JPABaseParticle */
|
||||
@@ -427,45 +440,50 @@ void JPADrawCalcColorEnv::calc(const JPADrawContext* ctx) {
|
||||
|
||||
/* 802647E0-8026486C .text calc__30JPADrawCalcColorAnmFrameNormalFPC14JPADrawContext */
|
||||
void JPADrawCalcColorAnmFrameNormal::calc(const JPADrawContext* ctx) {
|
||||
/* Nonmatching */
|
||||
s16 tick = ctx->pbe->mTick;
|
||||
s16 frame;
|
||||
if (tick < ctx->pbsp->getColorRegAnmMaxFrm()) {
|
||||
frame = tick;
|
||||
} else {
|
||||
frame = ctx->pbsp->getColorRegAnmMaxFrm();
|
||||
}
|
||||
s32 tick = ctx->pbe->mTick;
|
||||
s32 frame = (tick < ctx->pbsp->getColorRegAnmMaxFrm()) ? tick : ctx->pbsp->getColorRegAnmMaxFrm();
|
||||
JPADrawContext::pcb->mColorAnmFrame = frame;
|
||||
}
|
||||
|
||||
/* 8026486C-802648E0 .text calc__30JPADrawCalcColorAnmFrameRepeatFPC14JPADrawContext */
|
||||
void JPADrawCalcColorAnmFrameRepeat::calc(const JPADrawContext* ctx) {
|
||||
/* Nonmatching */
|
||||
f32 tick = ctx->pbe->mTick;
|
||||
s32 frame = ((u32)tick) % (ctx->pbsp->getColorRegAnmMaxFrm() + 1);
|
||||
JPADrawContext::pcb->mColorAnmFrame = frame;
|
||||
}
|
||||
|
||||
/* 802648E0-8026495C .text calc__31JPADrawCalcColorAnmFrameReverseFPC14JPADrawContext */
|
||||
void JPADrawCalcColorAnmFrameReverse::calc(const JPADrawContext* ctx) {
|
||||
/* Nonmatching */
|
||||
s32 tick = ctx->pbe->mTick;
|
||||
s32 frame = tick / ctx->pbsp->getColorRegAnmMaxFrm();
|
||||
JPADrawContext::pcb->mColorAnmFrame = frame;
|
||||
}
|
||||
|
||||
/* 8026495C-8026496C .text calc__29JPADrawCalcColorAnmFrameMergeFPC14JPADrawContext */
|
||||
void JPADrawCalcColorAnmFrameMerge::calc(const JPADrawContext* ctx) {
|
||||
/* Nonmatching */
|
||||
JPADrawContext::pcb->mColorAnmFrame = 0;
|
||||
}
|
||||
|
||||
/* 8026496C-8026497C .text calc__30JPADrawCalcColorAnmFrameRandomFPC14JPADrawContext */
|
||||
void JPADrawCalcColorAnmFrameRandom::calc(const JPADrawContext* ctx) {
|
||||
/* Nonmatching */
|
||||
JPADrawContext::pcb->mColorAnmFrame = 0;
|
||||
}
|
||||
|
||||
/* 8026497C-80264A34 .text calc__32JPADrawCalcTextureAnmIndexNormalFPC14JPADrawContext */
|
||||
void JPADrawCalcTextureAnmIndexNormal::calc(const JPADrawContext* ctx) {
|
||||
/* Nonmatching */
|
||||
s32 tick = ctx->pbe->mTick;
|
||||
s32 idx = ((ctx->pbsp->getTextureAnmKeyNum() - 1) < tick) ? ctx->pbsp->getTextureAnmKeyNum() - 1 : tick;
|
||||
ctx->mpDraw->mTexIdx = ctx->pTexIdx[ctx->pbsp->getTextureIndex(idx)];
|
||||
}
|
||||
|
||||
/* 80264A34-80264AD0 .text calc__32JPADrawCalcTextureAnmIndexRepeatFPC14JPADrawContext */
|
||||
void JPADrawCalcTextureAnmIndexRepeat::calc(const JPADrawContext* ctx) {
|
||||
/* Nonmatching */
|
||||
f32 tick = ctx->pbe->mTick;
|
||||
s32 maxFrame = ctx->pbsp->getTextureAnmKeyNum();
|
||||
s32 idx = ctx->pbsp->getTextureIndex((s32)tick % maxFrame);
|
||||
ctx->mpDraw->mTexIdx = ctx->pTexIdx[idx];
|
||||
}
|
||||
|
||||
/* 80264AD0-80264B80 .text calc__33JPADrawCalcTextureAnmIndexReverseFPC14JPADrawContext */
|
||||
@@ -485,12 +503,15 @@ void JPADrawCalcTextureAnmIndexRandom::calc(const JPADrawContext* ctx) {
|
||||
|
||||
/* 80264C10-80264C4C .text exec__19JPADrawExecCallBackFPC14JPADrawContext */
|
||||
void JPADrawExecCallBack::exec(const JPADrawContext* ctx) {
|
||||
/* Nonmatching */
|
||||
if (ctx->pbe->mpEmitterCallBack != NULL)
|
||||
ctx->pbe->mpEmitterCallBack->draw(ctx->pbe);
|
||||
}
|
||||
|
||||
/* 80264C4C-80264C88 .text exec__19JPADrawExecCallBackFPC14JPADrawContextP15JPABaseParticle */
|
||||
void JPADrawExecCallBack::exec(const JPADrawContext* ctx, JPABaseParticle* ptcl) {
|
||||
/* Nonmatching */
|
||||
JPABaseEmitter* pbe = ctx->pbe;
|
||||
if (ptcl->mpCallBack2 != NULL)
|
||||
ptcl->mpCallBack2->draw(pbe, ptcl);
|
||||
}
|
||||
|
||||
/* 80264C88-80264DB8 .text calc__17JPADrawCalcScaleXFPC14JPADrawContextP15JPABaseParticle */
|
||||
@@ -515,22 +536,24 @@ void JPADrawCalcScaleYBySpeed::calc(const JPADrawContext* ctx, JPABaseParticle*
|
||||
|
||||
/* 80265288-80265294 .text calc__23JPADrawCalcScaleCopyX2YFPC14JPADrawContextP15JPABaseParticle */
|
||||
void JPADrawCalcScaleCopyX2Y::calc(const JPADrawContext* ctx, JPABaseParticle* ptcl) {
|
||||
/* Nonmatching */
|
||||
ptcl->mScaleY = ptcl->mScaleX;
|
||||
}
|
||||
|
||||
/* 80265294-802652A4 .text calc__31JPADrawCalcScaleAnmTimingNormalFPC14JPADrawContextP15JPABaseParticle */
|
||||
void JPADrawCalcScaleAnmTimingNormal::calc(const JPADrawContext* ctx, JPABaseParticle* ptcl) {
|
||||
/* Nonmatching */
|
||||
JPADrawContext::pcb->mScaleAnmTiming = ptcl->mCurNormTime;
|
||||
}
|
||||
|
||||
/* 802652A4-80265374 .text calc__32JPADrawCalcScaleAnmTimingRepeatXFPC14JPADrawContextP15JPABaseParticle */
|
||||
void JPADrawCalcScaleAnmTimingRepeatX::calc(const JPADrawContext* ctx, JPABaseParticle* ptcl) {
|
||||
/* Nonmatching */
|
||||
s32 frame = ptcl->mCurFrame;
|
||||
JPADrawContext::pcb->mScaleAnmTiming = (frame % ctx->pesp->getAnmCycleX()) / (f32)ctx->pesp->getAnmCycleX();
|
||||
}
|
||||
|
||||
/* 80265374-80265444 .text calc__32JPADrawCalcScaleAnmTimingRepeatYFPC14JPADrawContextP15JPABaseParticle */
|
||||
void JPADrawCalcScaleAnmTimingRepeatY::calc(const JPADrawContext* ctx, JPABaseParticle* ptcl) {
|
||||
/* Nonmatching */
|
||||
s32 frame = ptcl->mCurFrame;
|
||||
JPADrawContext::pcb->mScaleAnmTiming = (frame % ctx->pesp->getAnmCycleY()) / (f32)ctx->pesp->getAnmCycleY();
|
||||
}
|
||||
|
||||
/* 80265444-80265588 .text calc__33JPADrawCalcScaleAnmTimingReverseXFPC14JPADrawContextP15JPABaseParticle */
|
||||
@@ -545,17 +568,18 @@ void JPADrawCalcScaleAnmTimingReverseY::calc(const JPADrawContext* ctx, JPABaseP
|
||||
|
||||
/* 802656CC-80265734 .text calc__19JPADrawCalcColorPrmFPC14JPADrawContextP15JPABaseParticle */
|
||||
void JPADrawCalcColorPrm::calc(const JPADrawContext* ctx, JPABaseParticle* ptcl) {
|
||||
/* Nonmatching */
|
||||
ptcl->mPrmColor = ctx->pbsp->getPrmColor(JPADrawContext::pcb->mColorAnmFrame);
|
||||
}
|
||||
|
||||
/* 80265734-8026579C .text calc__19JPADrawCalcColorEnvFPC14JPADrawContextP15JPABaseParticle */
|
||||
void JPADrawCalcColorEnv::calc(const JPADrawContext* ctx, JPABaseParticle* ptcl) {
|
||||
/* Nonmatching */
|
||||
ptcl->mEnvColor = ctx->pbsp->getEnvColor(JPADrawContext::pcb->mColorAnmFrame);
|
||||
}
|
||||
|
||||
/* 8026579C-802657E8 .text calc__31JPADrawCalcColorCopyFromEmitterFPC14JPADrawContextP15JPABaseParticle */
|
||||
void JPADrawCalcColorCopyFromEmitter::calc(const JPADrawContext* ctx, JPABaseParticle* ptcl) {
|
||||
/* Nonmatching */
|
||||
ptcl->mPrmColor = ctx->mpDraw->mPrmColor;
|
||||
ptcl->mEnvColor = ctx->mpDraw->mEnvColor;
|
||||
}
|
||||
|
||||
/* 802657E8-80265880 .text calc__30JPADrawCalcColorAnmFrameNormalFPC14JPADrawContextP15JPABaseParticle */
|
||||
@@ -630,10 +654,11 @@ void JPADrawCalcTextureAnmIndexRandom::calc(const JPADrawContext* ctx, JPABasePa
|
||||
|
||||
/* 8026640C-80266420 .text calc__24JPADrawCalcChildAlphaOutFPC14JPADrawContextP15JPABaseParticle */
|
||||
void JPADrawCalcChildAlphaOut::calc(const JPADrawContext* ctx, JPABaseParticle* ptcl) {
|
||||
/* Nonmatching */
|
||||
ptcl->mAlphaOut = 1.0f - ptcl->mCurNormTime;
|
||||
}
|
||||
|
||||
/* 80266420-80266450 .text calc__24JPADrawCalcChildScaleOutFPC14JPADrawContextP15JPABaseParticle */
|
||||
void JPADrawCalcChildScaleOut::calc(const JPADrawContext* ctx, JPABaseParticle* ptcl) {
|
||||
/* Nonmatching */
|
||||
ptcl->mScaleX = ptcl->mScaleOut * (1.0f - ptcl->mCurNormTime);
|
||||
ptcl->mScaleY = ptcl->mAlphaWaveRandom * (1.0f - ptcl->mCurNormTime);
|
||||
}
|
||||
|
||||
+283
-11
@@ -11,10 +11,17 @@
|
||||
#include "d/actor/d_a_item.h"
|
||||
#include "d/d_item_data.h"
|
||||
#include "d/actor/d_a_boko.h"
|
||||
#include "d/actor/d_a_bomb.h"
|
||||
#include "d/d_bg_s_lin_chk.h"
|
||||
#include "m_Do/m_Do_mtx.h"
|
||||
#include "d/actor/d_a_player.h"
|
||||
#include "d/d_s_play.h"
|
||||
#include "d/d_path.h"
|
||||
|
||||
static u8 hio_set;
|
||||
static u8 another_hit;
|
||||
static u32 ken;
|
||||
static u8 search_sp;
|
||||
static bkHIO_c l_bkHIO;
|
||||
|
||||
enum BK_RES_FILE_ID { // IDs and indexes are synced
|
||||
@@ -120,11 +127,11 @@ static void anm_init(bk_class* i_this, int bckFileIdx, f32 morf, u8 loopMode, f3
|
||||
return;
|
||||
}
|
||||
if (soundFileIdx >= 0) {
|
||||
void* soundAnm = dComIfG_getObjectRes("AM2", soundFileIdx);
|
||||
J3DAnmTransform* bckAnm = (J3DAnmTransform*)dComIfG_getObjectRes("AM2", bckFileIdx);
|
||||
void* soundAnm = dComIfG_getObjectRes("Bk", soundFileIdx);
|
||||
J3DAnmTransform* bckAnm = (J3DAnmTransform*)dComIfG_getObjectRes("Bk", bckFileIdx);
|
||||
i_this->mpMorf->setAnm(bckAnm, loopMode, morf, speed, 0.0f, -1.0f, soundAnm);
|
||||
} else {
|
||||
J3DAnmTransform* bckAnm = (J3DAnmTransform*)dComIfG_getObjectRes("AM2", bckFileIdx);
|
||||
J3DAnmTransform* bckAnm = (J3DAnmTransform*)dComIfG_getObjectRes("Bk", bckFileIdx);
|
||||
i_this->mpMorf->setAnm(bckAnm, loopMode, morf, speed, 0.0f, -1.0f, NULL);
|
||||
}
|
||||
}
|
||||
@@ -167,8 +174,60 @@ static void yari_off_check(bk_class* i_this) {
|
||||
}
|
||||
|
||||
/* 00000A1C-00000EE8 .text smoke_set_s__FP8bk_classf */
|
||||
static void smoke_set_s(bk_class* i_this, f32) {
|
||||
/* Nonmatching */
|
||||
static void smoke_set_s(bk_class* i_this, f32 rate) {
|
||||
dBgS_LinChk linChk;
|
||||
s32 attribCode;
|
||||
attribCode = 0;
|
||||
cXyz startPos = i_this->m0338;
|
||||
startPos.y += 100.0f;
|
||||
cXyz endPos = i_this->m0338;
|
||||
endPos.y -= 100.0f;
|
||||
linChk.Set(&startPos, &endPos, i_this);
|
||||
|
||||
dBgS* bgs = dComIfG_Bgsp(); // Fakematch? fixes regalloc
|
||||
if (bgs->LineCross(&linChk)) {
|
||||
endPos = linChk.GetCross();
|
||||
i_this->m0338.y = endPos.y;
|
||||
attribCode = bgs->GetAttributeCode(linChk);
|
||||
} else {
|
||||
i_this->m0338.y -= 20000.0f;
|
||||
}
|
||||
|
||||
if (i_this->m034F != 0 && attribCode != dBgS_Attr_GRASS_e) {
|
||||
return;
|
||||
}
|
||||
|
||||
i_this->m034F++;
|
||||
|
||||
switch (attribCode) {
|
||||
case dBgS_Attr_NORMAL_e:
|
||||
case dBgS_Attr_DIRT_e:
|
||||
case dBgS_Attr_WOOD_e:
|
||||
case dBgS_Attr_STONE_e:
|
||||
case dBgS_Attr_SAND_e:
|
||||
i_this->m0350.end();
|
||||
JPABaseEmitter* emitter1 = dComIfGp_particle_setToon(
|
||||
0x2022, &i_this->m0338, &i_this->m0344, NULL, 0xB9,
|
||||
&i_this->m0350, fopAcM_GetRoomNo(i_this)
|
||||
);
|
||||
if (emitter1) {
|
||||
emitter1->setRate(rate);
|
||||
emitter1->setSpread(1.0f);
|
||||
JGeometry::TVec3<f32> scale;
|
||||
scale.x = scale.y = scale.z = 1.2f;
|
||||
emitter1->setGlobalScale(scale);
|
||||
scale.x = scale.y = scale.z = 1.5f + g_regHIO.mChild[0].mFloatRegs[16];
|
||||
emitter1->setGlobalParticleScale(scale);
|
||||
}
|
||||
break;
|
||||
case dBgS_Attr_GRASS_e:
|
||||
JPABaseEmitter* emitter2 = dComIfGp_particle_set(0x24, &i_this->m0338, &i_this->m0344);
|
||||
if (emitter2) {
|
||||
emitter2->setRate(rate * 0.5f);
|
||||
emitter2->setMaxFrame(3);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* 00000EE8-000011F0 .text ground_smoke_set__FP8bk_class */
|
||||
@@ -245,8 +304,18 @@ static u32 search_wepon(bk_class* i_this) {
|
||||
}
|
||||
|
||||
/* 00002FB0-0000302C .text s_b_sub__FPvPv */
|
||||
static void s_b_sub(void*, void*) {
|
||||
/* Nonmatching */
|
||||
static void* s_b_sub(void* param_1, void*) {
|
||||
if (fopAc_IsActor(param_1) && fopAcM_GetName(param_1) == PROC_BOMB) {
|
||||
daBomb_c* bomb = (daBomb_c*)param_1;
|
||||
// TODO: why is it checking the bomb's params as a single field instead of just one param? bug?
|
||||
if (fopAcM_GetParam(bomb) != 0) {
|
||||
if (target_info_count < (s32)ARRAY_SIZE(target_info)) {
|
||||
target_info[target_info_count] = bomb;
|
||||
target_info_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* 0000302C-000033BC .text search_bomb__FP8bk_classi */
|
||||
@@ -317,7 +386,7 @@ static void walk_set(bk_class* i_this) {
|
||||
|
||||
/* 00003C34-00003C74 .text fight_run_set__FP8bk_class */
|
||||
static void fight_run_set(bk_class* i_this) {
|
||||
/* Nonmatching */
|
||||
anm_init(i_this, BK_BCK_BK_RUN, 10.0f, J3DFrameCtrl::LOOP_REPEAT_e, l_bkHIO.m070, BK_BAS_BK_RUN);
|
||||
}
|
||||
|
||||
/* 00003C74-00004104 .text path_check__FP8bk_classUc */
|
||||
@@ -553,9 +622,212 @@ static BOOL useHeapInit(fopAc_ac_c* i_this) {
|
||||
}
|
||||
|
||||
/* 0000E310-0000EA2C .text daBk_Create__FP10fopAc_ac_c */
|
||||
static s32 daBk_Create(fopAc_ac_c* i_this) {
|
||||
/* Nonmatching */
|
||||
fopAcM_SetupActor(i_this, bk_class);
|
||||
static s32 daBk_Create(fopAc_ac_c* i_actor) {
|
||||
/* Nonmatching - data */
|
||||
fopAcM_SetupActor(i_actor, bk_class);
|
||||
bk_class* i_this = (bk_class*)i_actor;
|
||||
|
||||
s32 phase_state = dComIfG_resLoad(&i_this->mPhs, "Bk");
|
||||
if (phase_state == cPhs_COMPLEATE_e) {
|
||||
i_this->mGbaName = 1;
|
||||
|
||||
if (strcmp(dComIfGp_getStartStageName(), "ITest63") == 0 ||
|
||||
strcmp(dComIfGp_getStartStageName(), "GanonJ") == 0)
|
||||
{
|
||||
search_sp = 1;
|
||||
} else {
|
||||
search_sp = 0;
|
||||
}
|
||||
|
||||
i_this->mType = fopAcM_GetParam(i_this) & 0xF;
|
||||
i_this->m02B9 = fopAcM_GetParam(i_this) & 0x10;
|
||||
i_this->m02D4 = fopAcM_GetParam(i_this) & 0x20;
|
||||
if (i_this->mType == 0xB) {
|
||||
i_this->m02D4 = 0;
|
||||
i_this->m02DC = 1;
|
||||
i_this->mType = 4;
|
||||
}
|
||||
i_this->m02D5 = fopAcM_GetParam(i_this) & 0xC0;
|
||||
i_this->m02B5 = fopAcM_GetParam(i_this) >> 8 & 0xFF;
|
||||
i_this->m02B6 = fopAcM_GetParam(i_this) >> 16 & 0xFF;
|
||||
i_this->m02B7 = fopAcM_GetParam(i_this) >> 24 & 0xFF;
|
||||
i_this->m02B8 = i_this->current.angle.z;
|
||||
i_this->current.angle.z = 0;
|
||||
i_this->current.angle.x = 0;
|
||||
if (i_this->m02B8 == 0xFF) {
|
||||
i_this->m02B8 = 0;
|
||||
}
|
||||
|
||||
if (i_this->m02B8 != 0) {
|
||||
if (dComIfGs_isSwitch(i_this->m02B8, fopAcM_GetRoomNo(i_this))) {
|
||||
return cPhs_ERROR_e;
|
||||
}
|
||||
}
|
||||
if (i_this->m02B9 != 0) {
|
||||
if (dComIfGs_isSwitch(i_this->m02B7, fopAcM_GetRoomNo(i_this))) {
|
||||
return cPhs_ERROR_e;
|
||||
}
|
||||
i_this->m02B7 = 0xFF;
|
||||
}
|
||||
|
||||
i_this->mItemTableIdx = dComIfGp_CharTbl()->GetNameIndex("Bk", 0);
|
||||
|
||||
if (!fopAcM_entrySolidHeap(i_this, useHeapInit, 0x17B20)) {
|
||||
return cPhs_ERROR_e;
|
||||
}
|
||||
|
||||
if (!hio_set) {
|
||||
l_bkHIO.mChildID = mDoHIO_root.mDoHIO_createChild("ボコちゃん", &l_bkHIO);
|
||||
i_this->m121D = 1;
|
||||
hio_set = 1;
|
||||
}
|
||||
|
||||
ken = 0;
|
||||
|
||||
if (!i_this->mpMorf || !i_this->mpMorf->getModel()) {
|
||||
return cPhs_ERROR_e;
|
||||
}
|
||||
|
||||
fopAcM_SetMin(i_this, -200.0f, -50.0f, -100.0f);
|
||||
fopAcM_SetMax(i_this, 125.0f, 250.0f, 250.0f);
|
||||
fopAcM_SetMtx(i_this, i_this->mpMorf->getModel()->getBaseTRMtx());
|
||||
i_this->mpMorf->getModel()->setUserArea((u32)i_this);
|
||||
i_this->initBt(162.5f, 125.0f);
|
||||
|
||||
i_this->mDamageReaction.m70C = 1;
|
||||
i_this->mDamageReaction.mSpawnY = i_this->current.pos.y;
|
||||
i_this->mDamageReaction.mMaxFallDistance = 1000.0f;
|
||||
|
||||
if (i_this->m02B6 != 0xFF) {
|
||||
i_this->m1218 = dPath_GetRoomPath(i_this->m02B6, fopAcM_GetRoomNo(i_this));
|
||||
if (i_this->m1218 == NULL) {
|
||||
return cPhs_ERROR_e;
|
||||
}
|
||||
i_this->m1215 = i_this->m02B6 + 1;
|
||||
i_this->m1217 = 1;
|
||||
}
|
||||
|
||||
if (i_this->mType == 4 || i_this->mType == 0xA) {
|
||||
i_this->mDamageReaction.mState = 1;
|
||||
if (i_this->mType == 0xA) {
|
||||
i_this->mDamageReaction.m004 = -0x14;
|
||||
fopAcM_OnStatus(i_this, fopAcStts_BOSS_e);
|
||||
} else {
|
||||
i_this->mDamageReaction.m004 = -1;
|
||||
}
|
||||
i_this->m0302 = 1000.0f + cM_rndF(1000.0f);
|
||||
} else if (i_this->mType == 6) {
|
||||
i_this->mDamageReaction.mState = 2;
|
||||
i_this->mDamageReaction.mMaxFallDistance = 300.0f;
|
||||
} else if (i_this->mType == 7) {
|
||||
i_this->mDamageReaction.mState = 0x1D;
|
||||
i_this->mDamageReaction.mMaxFallDistance = 300.0f;
|
||||
} else if (i_this->mType == 5) {
|
||||
anm_init(i_this, BK_BCK_BK_HAKOBI, 1.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, -1);
|
||||
i_this->mDamageReaction.mState = 0x1E;
|
||||
i_this->mDamageReaction.mMaxFallDistance = 100000.0f;
|
||||
} else if (i_this->mType == 2 || i_this->mType == 3) {
|
||||
i_this->m02BA = 0xFF;
|
||||
i_this->mDamageReaction.mState = 0xF;
|
||||
i_this->m030E = 0xA;
|
||||
} else if (i_this->mType == 9) {
|
||||
i_this->mDamageReaction.mState = 3;
|
||||
i_this->m1216 = i_this->current.angle.z;
|
||||
i_this->m1217 = i_this->current.angle.y;
|
||||
i_this->current.angle.z = 0;
|
||||
i_this->current.angle.y = 0;
|
||||
}
|
||||
|
||||
if (i_this->m02B7 != 0xFF) {
|
||||
if (i_this->mType != 6) {
|
||||
i_this->m02BA = i_this->m02B7 + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (i_this->mType == 0xF) {
|
||||
i_this->mDamageReaction.mState = 0x17;
|
||||
i_this->m02BA = 0;
|
||||
}
|
||||
|
||||
if (i_this->mType != 8 && i_this->m02DC == 0 &&
|
||||
strcmp(dComIfGp_getStartStageName(), "A_mori") != 0)
|
||||
{
|
||||
u32 weaponType; // TODO enum
|
||||
if (i_this->m02D5 & 0x40) {
|
||||
weaponType = 1;
|
||||
} else if (i_this->m02D5 & 0x80) {
|
||||
weaponType = 7;
|
||||
} else {
|
||||
weaponType = 0;
|
||||
}
|
||||
i_this->m1200 = fopAcM_create(PROC_BOKO, weaponType, &i_this->current.pos, fopAcM_GetRoomNo(i_this));
|
||||
i_this->m1214 = 1;
|
||||
i_this->m02D5 &= 0x40;
|
||||
} else {
|
||||
i_this->m11F3 = 1;
|
||||
}
|
||||
|
||||
i_this->mDamageReaction.mAcch.Set(
|
||||
&fopAcM_GetPosition_p(i_this), &fopAcM_GetOldPosition_p(i_this),
|
||||
i_this, 1, &i_this->mDamageReaction.mAcchCir,
|
||||
&fopAcM_GetSpeed_p(i_this)
|
||||
);
|
||||
i_this->mDamageReaction.mAcchCir.SetWall(40.0f, 40.0f);
|
||||
i_this->mDamageReaction.mAcch.ClrRoofNone();
|
||||
i_this->mDamageReaction.mAcch.SetRoofCrrHeight(80.0f + g_regHIO.mChild[0].mFloatRegs[7]);
|
||||
i_this->mDamageReaction.mAcch.OnLineCheck();
|
||||
i_this->mDamageReaction.mInvincibleTimer = 5;
|
||||
|
||||
if (i_this->m02D4 != 0) {
|
||||
i_this->mMaxHealth = i_this->mHealth = 7;
|
||||
} else {
|
||||
i_this->mMaxHealth = i_this->mHealth = 5;
|
||||
}
|
||||
|
||||
i_this->mDamageReaction.mStts.Init(0xC8, 0xFF, i_this);
|
||||
static dCcD_SrcCyl co_cyl_src = {}; // TODO
|
||||
i_this->m0B88.Set(co_cyl_src);
|
||||
i_this->m0B88.SetStts(&i_this->mDamageReaction.mStts);
|
||||
static dCcD_SrcCyl tg_cyl_src = {}; // TODO
|
||||
i_this->m0CB8.Set(tg_cyl_src);
|
||||
i_this->m0CB8.SetStts(&i_this->mDamageReaction.mStts);
|
||||
static dCcD_SrcSph head_sph_src = {}; // TODO
|
||||
i_this->m0DE8.Set(head_sph_src);
|
||||
i_this->m0DE8.SetStts(&i_this->mDamageReaction.mStts);
|
||||
static dCcD_SrcSph wepon_sph_src = {}; // TODO
|
||||
i_this->m1040.Set(wepon_sph_src);
|
||||
i_this->m1040.SetStts(&i_this->mDamageReaction.mStts);
|
||||
static dCcD_SrcSph defence_sph_src = {}; // TODO
|
||||
i_this->m0F14.Set(defence_sph_src);
|
||||
i_this->m0F14.SetStts(&i_this->mDamageReaction.mStts);
|
||||
|
||||
i_this->m02CC = 5;
|
||||
i_this->model = i_this->mpMorf->getModel();
|
||||
|
||||
i_this->mEnemyIce.mpActor = i_this;
|
||||
i_this->mEnemyIce.mWallRadius = 50.0f + g_regHIO.mChild[0].mFloatRegs[4];
|
||||
i_this->mEnemyIce.mCylHeight = 180.0f + g_regHIO.mChild[0].mFloatRegs[5];
|
||||
i_this->mEnemyIce.mDeathSwitch = i_this->m02B8;
|
||||
|
||||
i_this->mEnemyFire.mpMcaMorf = i_this->mpMorf;
|
||||
i_this->mEnemyFire.mpActor = i_this;
|
||||
static u8 fire_j[10] = {
|
||||
// TODO
|
||||
};
|
||||
static f32 fire_sc[10] = {
|
||||
// TODO
|
||||
};
|
||||
for (int i = 0; i < ARRAY_SIZE(i_this->mEnemyFire.mFlameJntIdxs); i++) {
|
||||
i_this->mEnemyFire.mFlameJntIdxs[i] = fire_j[i];
|
||||
i_this->mEnemyFire.mParticleScale[i] = fire_sc[i];
|
||||
}
|
||||
|
||||
i_this->mItemStealLeft = 3;
|
||||
|
||||
daBk_Execute(i_this);
|
||||
}
|
||||
|
||||
return phase_state;
|
||||
}
|
||||
|
||||
static actor_method_class l_daBk_Method = {
|
||||
|
||||
Reference in New Issue
Block a user