d_a_branch OK

This commit is contained in:
LagoLunatic
2024-01-06 20:38:25 -05:00
parent 73f07b4fac
commit 46fd062f47
8 changed files with 144 additions and 103 deletions
+1 -1
View File
@@ -1218,7 +1218,7 @@ config.libs = [
ActorRel(NonMatching, "d_a_att"),
ActorRel(NonMatching, "d_a_bflower"),
ActorRel(NonMatching, "d_a_bita"),
ActorRel(NonMatching, "d_a_branch"),
ActorRel(Matching, "d_a_branch"),
ActorRel(NonMatching, "d_a_bridge"),
ActorRel(NonMatching, "d_a_coming2"),
ActorRel(NonMatching, "d_a_coming3"),
+2 -1
View File
@@ -624,10 +624,11 @@ struct J3DFog : public J3DFogInfo {
explicit J3DFog(const J3DFogInfo& info) { J3DFogInfo::operator=(info); }
J3DFogInfo* getFogInfo() { return (J3DFogInfo*)this; }
void load() {
void load() const {
J3DGDSetFog(GXFogType(mType), mStartZ, mEndZ, mNearZ, mFarZ, mColor);
J3DGDSetFogRangeAdj(mAdjEnable, mCenter, (GXFogAdjTable*)mFogAdjTable);
}
void setType(u8 type) { mType = type; }
};
struct J3DAlphaCompInfo {
+2 -2
View File
@@ -25,8 +25,8 @@ public:
void set_anim(int, int, int);
void demoPlay(mDoExt_McaMorf*);
s32 CreateHeap();
static BOOL solidHeapCB(fopAc_ac_c*);
int CreateHeap();
static int solidHeapCB(fopAc_ac_c*);
MtxP getJointMtx(const char*);
+1 -1
View File
@@ -8,7 +8,7 @@ class daObjIce_c : public fopAc_ac_c {
public:
void param_get_swSave() const {}
void param_on_swSave() const {}
void setEffectMtx() {}
inline void setEffectMtx();
void chk_appear();
void set_mtx();
+21 -1
View File
@@ -47,6 +47,26 @@ public:
bool checkEnable(u16 mask) { return mFlags & mask; }
csXyz* getRatate() { return &mRotation; }
u32 getShapeId() { return mShapeId; }
void getAnmFrame() {}
void getAnmId() {}
void getAnmTransition() {}
void getOldAnmId() {}
void getOldScrId() {}
void getOldTevId() {}
void getOldTexId() {}
void getPrm() {}
void getScale() {}
void getTrans() {}
void onEnable(u16) {}
void setAnmFrameMax(f32) {}
void setModel(J3DModel*) {}
void setOldAnmId(u32) {}
void setOldScrId(u32) {}
void setOldTevId(u32) {}
void setOldTexId(u32) {}
void setTexAnmFrameMax(f32) {}
/* 0x04 */ u16 mFlags;
/* 0x06 */ u8 field_0x06[0x08 - 0x06];
@@ -54,7 +74,7 @@ public:
/* 0x14 */ cXyz mScaling;
/* 0x20 */ csXyz mRotation;
/* 0x26 */ u8 field_0x26[0x28 - 0x26];
/* 0x28 */ u32 mShape;
/* 0x28 */ u32 mShapeId;
/* 0x2C */ u32 mNextBckId;
/* 0x30 */ f32 mAnimationFrame;
/* 0x34 */ f32 mAnimationTransition;
+114 -96
View File
@@ -12,6 +12,27 @@
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "dolphin/mtx/mtx.h"
enum KWOOD_00_RES_FILE_ID {
/* BAS */
KWOOD_00_BAS_BREAK=0x0,
KWOOD_00_BAS_SWING=0x1,
KWOOD_00_BAS_SWING02=0x8,
/* BCK */
KWOOD_00_BCK_BREAK=0x2,
KWOOD_00_BCK_SWING=0x3,
KWOOD_00_BCK_SWING02=0x7,
/* BMDC */
KWOOD_00_BMD_WB=0x5,
KWOOD_00_BMD_WS=0x6,
};
static u16 anim_table[] = {
KWOOD_00_BCK_SWING02, KWOOD_00_BAS_SWING02,
KWOOD_00_BCK_SWING, KWOOD_00_BAS_SWING,
KWOOD_00_BCK_BREAK, KWOOD_00_BAS_BREAK,
};
char daBranch_c::m_arcname[] = "Kwood_00";
@@ -19,7 +40,7 @@ char daBranch_c::m_arcname[] = "Kwood_00";
void daBranch_c::set_mtx() {
J3DModel* pMdl;
for (int i = 0; i < 2; i ++) {
for (int i = 0; i < (s32)ARRAY_SIZE(mModel); i ++) {
pMdl = mModel[i];
if (pMdl) {
@@ -39,126 +60,120 @@ void daBranch_c::set_anim(int i_animIdx, int i_bckIdx, int i_basIdx) {
void* pSnd = dComIfG_getObjectIDRes(m_arcname, i_basIdx);
J3DAnmTransform* pAnm = static_cast<J3DAnmTransform*>(dComIfG_getObjectIDRes(m_arcname, i_bckIdx));
mAnims[i_animIdx]->setAnm(
pAnm,
-1,
0.0f,
1.0f,
0.0f,
-1.0f,
pSnd
);
mAnims[i_animIdx]->setAnm(pAnm, -1, 0.0f, 1.0f, 0.0f, -1.0f, pSnd);
}
}
/* 000001E4-00000228 .text demoPlay__10daBranch_cFP14mDoExt_McaMorf */
void daBranch_c::demoPlay(mDoExt_McaMorf*) {
/* Nonmatching */
void daBranch_c::demoPlay(mDoExt_McaMorf* morf) {
dDemo_setDemoData(this, 0x20, morf, m_arcname, 3, anim_table, 0, 0);
}
/* 00000228-00000248 .text solidHeapCB__10daBranch_cFP10fopAc_ac_c */
BOOL daBranch_c::solidHeapCB(fopAc_ac_c* i_this) {
int daBranch_c::solidHeapCB(fopAc_ac_c* i_this) {
daBranch_c* branch = static_cast<daBranch_c*>(i_this);
return branch->CreateHeap();
}
/* 00000248-0000049C .text CreateHeap__10daBranch_cFv */
s32 daBranch_c::CreateHeap() {
int daBranch_c::CreateHeap() {
/* Nonmatching */
int basIds[] = { 8, 0 };
int bckIds[] = { 7, 2 };
int bmdIds[] = { 6, 5 };
int t[] = {0, 0};
int bmd[] = { KWOOD_00_BMD_WS, KWOOD_00_BMD_WB };
int bck[] = { KWOOD_00_BCK_SWING02, KWOOD_00_BCK_BREAK };
int bas[] = { KWOOD_00_BAS_SWING02, KWOOD_00_BAS_BREAK };
BOOL status = TRUE;
for (int i = 0; i < 2; i++) {
J3DModelData* modelData = static_cast<J3DModelData*>(dComIfG_getObjectIDRes(m_arcname, bmdIds[i]));
J3DAnmTransformKey* bck = static_cast<J3DAnmTransformKey*>(dComIfG_getObjectIDRes(m_arcname, bckIds[i]));
for (int i = 0; i < (s32)ARRAY_SIZE(mAnims); i++) {
J3DModelData* modelData = static_cast<J3DModelData*>(dComIfG_getObjectIDRes(m_arcname, bmd[i]));
static_cast<J3DAnmTransformKey*>(dComIfG_getObjectIDRes(m_arcname, bck[i]));
JUT_ASSERT(0x1CC, modelData != 0);
JUT_ASSERT(0x1CD, bck != 0);
mDoExt_McaMorf* newMorf = new mDoExt_McaMorf(
static_cast<J3DModelData*>(dComIfG_getObjectIDRes(m_arcname, bmdIds[i])),
0,
0,
static_cast<J3DAnmTransformKey*>(dComIfG_getObjectIDRes(m_arcname, bckIds[i])),
-1,
1.0f,
0,
-1,
1,
0,
0,
0x11020203
mAnims[i] = new mDoExt_McaMorf(
static_cast<J3DModelData*>(dComIfG_getObjectIDRes(m_arcname, bmd[i])),
NULL, NULL,
static_cast<J3DAnmTransformKey*>(dComIfG_getObjectIDRes(m_arcname, bck[i])),
-1, 1.0f, 0, -1, 1, NULL,
0, 0x11020203
);
mAnims[i] = newMorf;
if (!mAnims[i]) {
status = FALSE;
break;
}
mModel[i] = newMorf->mpModel;
mModel[i] = mAnims[i]->getModel();
if (!mModel[i]) {
status = FALSE;
break;
}
mAnims[i]->setFrame(0.0f);
set_anim(i, bckIds[i], basIds[i]);
set_anim(i, bck[i], bas[i]);
}
return status;
}
/* 0000049C-00000524 .text daBranch_Draw__FP10daBranch_c */
static BOOL daBranch_Draw(daBranch_c* i_this) {
inline BOOL daBranch_c::draw() {
int activeIdx = 0;
if (i_this->m02B8 == 5) {
if (m02B8 == 5) {
activeIdx = 1;
}
g_env_light.settingTevStruct(TEV_TYPE_BG0, &i_this->current.pos, &i_this->mTevStr);
g_env_light.setLightTevColorType(i_this->mModel[activeIdx], &i_this->mTevStr);
g_env_light.settingTevStruct(TEV_TYPE_BG0, &current.pos, &mTevStr);
g_env_light.setLightTevColorType(mModel[activeIdx], &mTevStr);
i_this->mAnims[activeIdx]->updateDL();
mAnims[activeIdx]->updateDL();
return TRUE;
}
/* 0000049C-00000524 .text daBranch_Draw__FP10daBranch_c */
static BOOL daBranch_Draw(daBranch_c* i_this) {
daBranch_c* branch = static_cast<daBranch_c*>(i_this);
return branch->draw();
}
inline BOOL daBranch_c::execute() {
u8 demoId = mDemoActorId;
if (demoId == 0) {
if (m02B8 == 5) {
if (mAnims[1]) {
mAnims[1]->play(0, 0, 0);
}
}
else if (m02B8 == 6 && mAnims[0]) {
mAnims[0]->play(0, 0, 0);
}
}
else {
dDemo_actor_c* demoActor = dComIfGp_demo_getActor(demoId);
if (demoActor) {
m02B8 = demoActor->getShapeId();
if (m02B8 == 6) {
demoPlay(mAnims[0]);
}
else if (m02B8 == 5) {
demoPlay(mAnims[1]);
}
}
}
set_mtx();
return TRUE;
}
/* 00000524-0000060C .text daBranch_Execute__FP10daBranch_c */
static BOOL daBranch_Execute(daBranch_c* i_this) {
/* Nonmatching */
int demoId = i_this->mDemoActorId;
if (demoId == 0) {
if (i_this->m02B8 == 5) {
if (i_this->mAnims[1]) {
i_this->mAnims[1]->play(0, 0, 0);
}
}
else if (i_this->m02B8 == 6 && i_this->mAnims[0]) {
i_this->mAnims[0]->play(0, 0, 0);
}
}
else {
void* demoActor = g_dComIfG_gameInfo.play.mDemo;
if (demoActor) {
//i_this->m02B8 = demoActor->mShape;
if (i_this->m02B8 == 6) {
i_this->demoPlay(i_this->mAnims[0]);
}
else if (i_this->m02B8 == 5) {
i_this->demoPlay(i_this->mAnims[1]);
}
}
}
i_this->set_mtx();
daBranch_c* branch = static_cast<daBranch_c*>(i_this);
return branch->execute();
}
/* 0000060C-00000614 .text daBranch_IsDelete__FP10daBranch_c */
@@ -172,47 +187,50 @@ static BOOL daBranch_Delete(daBranch_c* i_this) {
return TRUE;
}
/* 00000694-0000080C .text daBranch_Create__FP10fopAc_ac_c */
static s32 daBranch_Create(fopAc_ac_c* i_this) {
/* Nonmatching */
daBranch_c* branch = static_cast<daBranch_c*>(i_this);
inline s32 daBranch_c::create() {
int phase_state;
fopAcM_SetupActor(branch, daBranch_c);
fopAcM_SetupActor(this, daBranch_c);
s32 state = dComIfG_resLoad(&branch->mPhs, daBranch_c::m_arcname);
if (state == cPhs_COMPLEATE_e) {
int solidHeapResult = fopAcM_entrySolidHeap(i_this, daBranch_c::solidHeapCB, 0x4000);
if (solidHeapResult & 0xFF == 0) {
for (int i = 0; i < 2; i++) {
branch->mAnims[i] = 0;
phase_state = dComIfG_resLoad(&mPhs, daBranch_c::m_arcname);
if (phase_state == cPhs_COMPLEATE_e) {
if (!fopAcM_entrySolidHeap(this, daBranch_c::solidHeapCB, 0x4000)) {
for (int i = 0; i < (s32)ARRAY_SIZE(mAnims); i++) {
mAnims[i] = NULL;
}
state = cPhs_ERROR_e;
phase_state = cPhs_ERROR_e;
}
else {
fopAcM_SetMtx(i_this, branch->mModel[0]->getBaseTRMtx());
fopAcM_setCullSizeBox(i_this, 0.0f, 0.0f, -50.0f, 300.0f, 100.0f, 50.0f);
fopAcM_SetMtx(this, mModel[0]->getBaseTRMtx());
fopAcM_setCullSizeBox(this, 0.0f, 0.0f, -50.0f, 300.0f, 100.0f, 50.0f);
branch->m02B8 = 6;
branch->m02BC = 0;
branch->m02BD = 0;
m02B8 = 6;
m02BC = 0;
m02BD = 0;
for (int i = 0; i < 2; i++) {
J3DModelData* modelData = branch->mModel[i]->mModelData;
set_mtx();
for (int j = 0; j < modelData->getMaterialNum(); j++) {
for (int i = 0; i < (s32)ARRAY_SIZE(mModel); i++) {
J3DModelData* modelData = mModel[i]->getModelData();
for (u16 j = 0; j < modelData->getMaterialNum(); j++) {
J3DMaterial* mat = modelData->getMaterialNodePointer(j);
if (mat) {
J3DFog* fog = mat->getPEBlock()->getFog();
fog->mType = 2;
mat->getFog()->setType(2);
}
}
}
}
}
return state;
return phase_state;
}
/* 00000694-0000080C .text daBranch_Create__FP10fopAc_ac_c */
static s32 daBranch_Create(fopAc_ac_c* i_this) {
daBranch_c* branch = static_cast<daBranch_c*>(i_this);
return branch->create();
}
static actor_method_class l_daBranch_Method = {
+2
View File
@@ -6,6 +6,8 @@
#include "d/actor/d_a_obj_ice.h"
#include "dolphin/types.h"
class J3DMaterial;
/* 00000078-000000F0 .text chk_appear__10daObjIce_cFv */
void daObjIce_c::chk_appear() {
/* Nonmatching */
+1 -1
View File
@@ -4,7 +4,7 @@
//
#include "d/actor/d_a_obj_lpalm.h"
#include "dolphin/types.h"
#include "m_Do/m_Do_ext.h"
/* 00000078-00000098 .text CheckCreateHeap__FP10fopAc_ac_c */
static BOOL CheckCreateHeap(fopAc_ac_c*) {