From 7b010f07c730d94ed0ca9f8cf02362675e47ebdf Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Tue, 15 Jul 2025 15:22:38 -0400 Subject: [PATCH] atdoor inlines --- configure.py | 2 +- include/d/actor/d_a_amiprop.h | 10 ++--- include/d/actor/d_a_atdoor.h | 10 ++--- include/d/actor/d_a_mtoge.h | 4 +- src/d/actor/d_a_amiprop.cpp | 55 +++++++++++------------ src/d/actor/d_a_atdoor.cpp | 83 +++++++++++++++++++++-------------- src/d/actor/d_a_mtoge.cpp | 10 ++--- 7 files changed, 95 insertions(+), 79 deletions(-) diff --git a/configure.py b/configure.py index 29ca0f3a2..694de946d 100755 --- a/configure.py +++ b/configure.py @@ -1471,7 +1471,7 @@ config.libs = [ ActorRel(Matching, "d_a_alldie"), ActorRel(Matching, "d_a_am", extra_cflags=['-pragma "nosyminline on"']), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_am2", extra_cflags=["-sym off"]), - ActorRel(MatchingFor("D44J01", "GZLJ01", "GZLE01", "GZLP01"), "d_a_amiprop", extra_cflags=['-pragma "nosyminline on"']), + ActorRel(Matching, "d_a_amiprop", extra_cflags=['-pragma "nosyminline on"']), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_arrow_iceeff", extra_cflags=['-pragma "nosyminline on"']), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_arrow_lighteff", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_beam"), diff --git a/include/d/actor/d_a_amiprop.h b/include/d/actor/d_a_amiprop.h index afed6b220..1cddd14fc 100644 --- a/include/d/actor/d_a_amiprop.h +++ b/include/d/actor/d_a_amiprop.h @@ -19,11 +19,11 @@ public: static const char m_arcname[]; public: - /* 0x290 */ request_of_phase_process_class unk_290; - /* 0x298 */ J3DModel* unk_298; - /* 0x29C */ dCcD_Stts unk_29C; - /* 0x2D8 */ dCcD_Cyl unk_2D8; - /* 0x408 */ dBgW* unk_408; + /* 0x290 */ request_of_phase_process_class mPhase; + /* 0x298 */ J3DModel* mpModel; + /* 0x29C */ dCcD_Stts mStts; + /* 0x2D8 */ dCcD_Cyl mCyl; + /* 0x408 */ dBgW* mpBgW; /* 0x40C */ Mtx unk_40C; /* 0x43C */ u32 unk_43C; /* 0x440 */ s32 unk_440; diff --git a/include/d/actor/d_a_atdoor.h b/include/d/actor/d_a_atdoor.h index 72a4de30c..8b86c2ea4 100644 --- a/include/d/actor/d_a_atdoor.h +++ b/include/d/actor/d_a_atdoor.h @@ -8,7 +8,7 @@ class daAtdoor_c : public fopAc_ac_c { public: inline BOOL draw(); inline BOOL execute(); - void setAction(unsigned char) {} + void setAction(u8 action) { mAction = action; } u8 getSwbit(); BOOL CreateHeap(); @@ -19,10 +19,10 @@ public: static const char M_arcname[]; public: - /* 0x290 */ request_of_phase_process_class unk_290; - /* 0x298 */ J3DModel* unk_298; - /* 0x29C */ dBgW* unk_29C; - /* 0x2A0 */ u8 unk_2A0; + /* 0x290 */ request_of_phase_process_class mPhase; + /* 0x298 */ J3DModel* mpModel; + /* 0x29C */ dBgW* mpBgW; + /* 0x2A0 */ u8 mAction; /* 0x2A2 */ s16 unk_2A2; }; // size = 0x2A4 diff --git a/include/d/actor/d_a_mtoge.h b/include/d/actor/d_a_mtoge.h index 80c4694c8..d38e82292 100644 --- a/include/d/actor/d_a_mtoge.h +++ b/include/d/actor/d_a_mtoge.h @@ -10,7 +10,7 @@ class daMtoge_c : public fopAc_ac_c { public: inline BOOL draw(); inline BOOL execute(); - void setAction(u8 action) { mState = action; } + void setAction(u8 action) { mAction = action; } u8 getSwbit(); BOOL CreateHeap(); @@ -24,7 +24,7 @@ public: /* 0x290 */ request_of_phase_process_class mPhaseProcReq; /* 0x298 */ J3DModel* mpModel; /* 0x29C */ dBgW* mpBgW; - /* 0x2A0 */ u8 mState; + /* 0x2A0 */ u8 mAction; /* 0x2A1 */ s8 m2A1; /* 0x2A2 */ s8 m2A2; /* 0x2A3 */ s8 m2A3; diff --git a/src/d/actor/d_a_amiprop.cpp b/src/d/actor/d_a_amiprop.cpp index 748e9e12d..84e087247 100644 --- a/src/d/actor/d_a_amiprop.cpp +++ b/src/d/actor/d_a_amiprop.cpp @@ -9,7 +9,9 @@ #include "d/d_cc_d.h" #include "d/d_com_inf_game.h" #include "d/d_bg_s_movebg_actor.h" +#if VERSION > VERSION_DEMO #include "d/d_vibration.h" +#endif #include "d/res/res_hami1.h" static dCcD_SrcCyl l_cyl_src = { @@ -56,14 +58,13 @@ namespace daAmiProp_prm { /* 00000078-000000D4 .text _delete__11daAmiProp_cFv */ bool daAmiProp_c::_delete() { -#if VERSION == VERSION_DEMO - dComIfG_Bgsp()->Release(unk_408); -#else - if (heap != NULL) { - dComIfG_Bgsp()->Release(unk_408); - } +#if VERSION > VERSION_DEMO + if (heap != NULL) #endif - dComIfG_resDeleteDemo(&unk_290, daAmiProp_c::m_arcname); + { + dComIfG_Bgsp()->Release(mpBgW); + } + dComIfG_resDeleteDemo(&mPhase, daAmiProp_c::m_arcname); return true; } @@ -77,21 +78,21 @@ BOOL daAmiProp_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(daAmiProp_c::m_arcname, HAMI1_BDL_HAMI1); JUT_ASSERT(VERSION_SELECT(250, 255, 255, 255), modelData != NULL); - unk_298 = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000022); - if (unk_298 == NULL) { + mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000022); + if (mpModel == NULL) { return FALSE; } - unk_298->setUserArea(reinterpret_cast(this)); + mpModel->setUserArea(reinterpret_cast(this)); setMoveBGMtx(); - unk_408 = new dBgW(); - if (unk_408 != NULL) { + mpBgW = new dBgW(); + if (mpBgW != NULL) { cBgD_t* dzb = (cBgD_t*)dComIfG_getObjectRes(daAmiProp_c::m_arcname, HAMI1_DZB_HAMI1); - if (unk_408->Set(dzb, cBgW::MOVE_BG_e, &unk_40C) == true) { + if (mpBgW->Set(dzb, cBgW::MOVE_BG_e, &unk_40C) == true) { return FALSE; } - unk_408->SetCrrFunc(dBgS_MoveBGProc_TypicalRotY); + mpBgW->SetCrrFunc(dBgS_MoveBGProc_TypicalRotY); } else { return FALSE; } @@ -101,23 +102,23 @@ BOOL daAmiProp_c::CreateHeap() { /* 00000244-00000318 .text CreateInit__11daAmiProp_cFv */ void daAmiProp_c::CreateInit() { - fopAcM_SetMtx(this, unk_298->getBaseTRMtx()); + fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); fopAcM_setCullSizeBox(this, -850.0f, -30.0f, -850.0f, 850.0f, 30.0f, 850.0f); fopAcM_setCullSizeFar(this, 1.0f); - unk_29C.Init(255, 255, this); - unk_2D8.Set(l_cyl_src); - unk_2D8.SetStts(&unk_29C); + mStts.Init(255, 255, this); + mCyl.Set(l_cyl_src); + mCyl.SetStts(&mStts); unk_43C = daAmiProp_prm::getSwitchNo(this); unk_446 = current.angle.x + 0x4000; - dComIfG_Bgsp()->Regist(unk_408, this); + dComIfG_Bgsp()->Regist(mpBgW, this); set_mtx(); - unk_408->Move(); + mpBgW->Move(); } /* 00000318-00000444 .text _create__11daAmiProp_cFv */ cPhs_State daAmiProp_c::_create() { fopAcM_SetupActor(this, daAmiProp_c); - cPhs_State ret = dComIfG_resLoad(&unk_290, daAmiProp_c::m_arcname); + cPhs_State ret = dComIfG_resLoad(&mPhase, daAmiProp_c::m_arcname); if (ret == cPhs_COMPLEATE_e) { if (!fopAcM_entrySolidHeap(this, CheckCreateHeap, 0xC00)) { @@ -131,10 +132,10 @@ cPhs_State daAmiProp_c::_create() { /* 000005FC-00000694 .text set_mtx__11daAmiProp_cFv */ void daAmiProp_c::set_mtx() { - unk_298->setBaseScale(scale); + mpModel->setBaseScale(scale); mDoMtx_stack_c::transS(current.pos); mDoMtx_stack_c::ZXYrotM(current.angle.x, current.angle.y, current.angle.z); - unk_298->setBaseTRMtx(mDoMtx_stack_c::get()); + mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); MTXCopy(mDoMtx_stack_c::get(), unk_40C); } @@ -169,7 +170,7 @@ bool daAmiProp_c::_execute() { if (tmp == 0) { unk_446 += 0x4000; unk_444 = false; -#if VERSION != VERSION_DEMO +#if VERSION > VERSION_DEMO dComIfGp_getVibration().StartShock(4, -0x21, cXyz(0.0f, 1.0f, 0.0f)); #endif } else { @@ -179,17 +180,17 @@ bool daAmiProp_c::_execute() { unk_440 = is_switch; set_mtx(); - unk_408->Move(); + mpBgW->Move(); return true; } /* 00000884-00000924 .text _draw__11daAmiProp_cFv */ bool daAmiProp_c::_draw() { g_env_light.settingTevStruct(TEV_TYPE_ACTOR, ¤t.pos, &tevStr); - g_env_light.setLightTevColorType(unk_298, &tevStr); + g_env_light.setLightTevColorType(mpModel, &tevStr); dComIfGd_setListBG(); - mDoExt_modelUpdateDL(unk_298); + mDoExt_modelUpdateDL(mpModel); dComIfGd_setList(); return true; } diff --git a/src/d/actor/d_a_atdoor.cpp b/src/d/actor/d_a_atdoor.cpp index 99ebcfe89..9cde9a372 100644 --- a/src/d/actor/d_a_atdoor.cpp +++ b/src/d/actor/d_a_atdoor.cpp @@ -9,6 +9,14 @@ #include "d/d_com_inf_game.h" #include "d/res/res_atdoor.h" +enum Action_e { + ACT_WAIT_e = 0, + ACT_CLOSE_WAIT_e = 1, + ACT_CLOSE_e = 2, + ACT_OPEN_WAIT_e = 3, + ACT_OPEN_e = 4, +}; + const char daAtdoor_c::M_arcname[] = "Atdoor"; /* 00000078-00000084 .text getSwbit__10daAtdoor_cFv */ @@ -24,15 +32,15 @@ static BOOL CheckCreateHeap(fopAc_ac_c* i_this) { /* 000000A4-000001E8 .text CreateHeap__10daAtdoor_cFv */ BOOL daAtdoor_c::CreateHeap() { J3DModelData* modelData = static_cast(dComIfG_getObjectRes(daAtdoor_c::M_arcname, ATDOOR_BDL_SDOOR01)); - JUT_ASSERT(VERSION_SELECT(112, 112, 112, 112), modelData != NULL); + JUT_ASSERT(112, modelData != NULL); - unk_298 = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000022); - if (unk_298 == NULL) { + mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000022); + if (mpModel == NULL) { return FALSE; } - unk_29C = new dBgW(); - if (unk_29C == NULL) { + mpBgW = new dBgW(); + if (mpBgW == NULL) { return FALSE; } @@ -43,7 +51,7 @@ BOOL daAtdoor_c::CreateHeap() { calcMtx(); - if (unk_29C->Set(dzb, cBgW::MOVE_BG_e, &unk_298->getBaseTRMtx()) == true) { + if (mpBgW->Set(dzb, cBgW::MOVE_BG_e, &mpModel->getBaseTRMtx()) == true) { return FALSE; } return TRUE; @@ -53,37 +61,37 @@ BOOL daAtdoor_c::CreateHeap() { void daAtdoor_c::calcMtx() { mDoMtx_stack_c::transS(current.pos); mDoMtx_stack_c::YrotM(home.angle.y - unk_2A2); - unk_298->setBaseTRMtx(mDoMtx_stack_c::get()); + mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); } /* 00000258-0000036C .text CreateInit__10daAtdoor_cFv */ bool daAtdoor_c::CreateInit() { s32 swBit = getSwbit(); - if (dComIfG_Bgsp()->Regist(unk_29C, this)) { - JUT_ASSERT(VERSION_SELECT(170, 170, 170, 170), NULL); + if (dComIfG_Bgsp()->Regist(mpBgW, this)) { + JUT_ASSERT(170, FALSE); } tevStr.mRoomNo = current.roomNo; if (swBit == 0xFF) { - unk_2A0 = 0; + mAction = ACT_WAIT_e; } else if (dComIfGs_isSwitch(swBit, fopAcM_GetRoomNo(this))) { - unk_2A0 = 3; + mAction = ACT_OPEN_WAIT_e; unk_2A2 = 0x4000; } else { - unk_2A0 = 1; + mAction = ACT_CLOSE_WAIT_e; } attention_info.position.y += 150.0f; eyePos.y += 150.0f; calcMtx(); - unk_29C->Move(); + mpBgW->Move(); return true; } /* 0000036C-00000418 .text create__10daAtdoor_cFv */ cPhs_State daAtdoor_c::create() { - cPhs_State ret = dComIfG_resLoad(&unk_290, daAtdoor_c::M_arcname); + cPhs_State ret = dComIfG_resLoad(&mPhase, daAtdoor_c::M_arcname); #if VERSION == VERSION_DEMO if (ret != cPhs_COMPLEATE_e) { return ret; @@ -113,7 +121,7 @@ bool daAtdoor_actionWait(daAtdoor_c* i_this) { bool daAtdoor_actionCloseWait(daAtdoor_c* i_this) { if (dComIfGs_isSwitch(i_this->getSwbit(), fopAcM_GetRoomNo(i_this))) { fopAcM_seStart(i_this, JA_SE_OBJ_TC_JAIL_DOOR_OP, 0); - i_this->unk_2A0 = 4; + i_this->setAction(ACT_OPEN_e); } return true; } @@ -122,19 +130,19 @@ bool daAtdoor_actionCloseWait(daAtdoor_c* i_this) { bool daAtdoor_actionClose(daAtdoor_c* i_this) { i_this->unk_2A2 -= 0x400; if (i_this->unk_2A2 <= 0) { - i_this->unk_2A0 = 1; + i_this->setAction(ACT_CLOSE_WAIT_e); i_this->unk_2A2 = 0; } i_this->calcMtx(); - i_this->unk_29C->Move(); + i_this->mpBgW->Move(); return true; } /* 00000530-00000594 .text daAtdoor_actionOpenWait__FP10daAtdoor_c */ bool daAtdoor_actionOpenWait(daAtdoor_c* i_this) { if (!dComIfGs_isSwitch(i_this->getSwbit(), fopAcM_GetRoomNo(i_this))) { - i_this->unk_2A0 = 2; + i_this->setAction(ACT_CLOSE_e); } return true; } @@ -143,25 +151,28 @@ bool daAtdoor_actionOpenWait(daAtdoor_c* i_this) { bool daAtdoor_actionOpen(daAtdoor_c* i_this) { i_this->unk_2A2 += 0x400; if (i_this->unk_2A2 >= 0x4000) { - i_this->unk_2A0 = 3; + i_this->setAction(ACT_OPEN_WAIT_e); i_this->unk_2A2 = 0x4000; } i_this->calcMtx(); - i_this->unk_29C->Move(); + i_this->mpBgW->Move(); return true; } +BOOL daAtdoor_c::draw() { + g_env_light.settingTevStruct(TEV_TYPE_BG0, ¤t.pos, &tevStr); + g_env_light.setLightTevColorType(mpModel, &tevStr); + mDoExt_modelUpdateDL(mpModel); + return TRUE; +} + /* 000005F8-00000658 .text daAtdoor_Draw__FP10daAtdoor_c */ static BOOL daAtdoor_Draw(daAtdoor_c* i_this) { - g_env_light.settingTevStruct(TEV_TYPE_BG0, &i_this->current.pos, &i_this->tevStr); - g_env_light.setLightTevColorType(i_this->unk_298, &i_this->tevStr); - mDoExt_modelUpdateDL(i_this->unk_298); - return TRUE; + return i_this->draw(); } -/* 00000658-00000694 .text daAtdoor_Execute__FP10daAtdoor_c */ -static BOOL daAtdoor_Execute(daAtdoor_c* i_this) { +BOOL daAtdoor_c::execute() { typedef bool (*actionFuncs)(daAtdoor_c*); static actionFuncs l_action[] = { daAtdoor_actionWait, @@ -171,10 +182,15 @@ static BOOL daAtdoor_Execute(daAtdoor_c* i_this) { daAtdoor_actionOpen, }; - l_action[i_this->unk_2A0](i_this); + l_action[mAction](this); return true; } +/* 00000658-00000694 .text daAtdoor_Execute__FP10daAtdoor_c */ +static BOOL daAtdoor_Execute(daAtdoor_c* i_this) { + return i_this->execute(); +} + /* 00000694-0000069C .text daAtdoor_IsDelete__FP10daAtdoor_c */ static BOOL daAtdoor_IsDelete(daAtdoor_c*) { return TRUE; @@ -182,15 +198,14 @@ static BOOL daAtdoor_IsDelete(daAtdoor_c*) { /* 0000069C-0000070C .text daAtdoor_Delete__FP10daAtdoor_c */ static BOOL daAtdoor_Delete(daAtdoor_c* i_this) { -#if VERSION == VERSION_DEMO - dComIfG_Bgsp()->Release(i_this->unk_29C); -#else - if (i_this->heap != NULL) { - dComIfG_Bgsp()->Release(i_this->unk_29C); - } +#if VERSION > VERSION_DEMO + if (i_this->heap != NULL) #endif + { + dComIfG_Bgsp()->Release(i_this->mpBgW); + } - dComIfG_resDeleteDemo(&i_this->unk_290, daAtdoor_c::M_arcname); + dComIfG_resDeleteDemo(&i_this->mPhase, daAtdoor_c::M_arcname); i_this->~daAtdoor_c(); return TRUE; diff --git a/src/d/actor/d_a_mtoge.cpp b/src/d/actor/d_a_mtoge.cpp index 974b34c28..fb7f70420 100644 --- a/src/d/actor/d_a_mtoge.cpp +++ b/src/d/actor/d_a_mtoge.cpp @@ -79,15 +79,15 @@ BOOL daMtoge_c::CreateInit() { tevStr.mRoomNo = fopAcM_GetRoomNo(this); if (sw == 0xFF) { - mState = ACT_WAIT; + mAction = ACT_WAIT; } else if (dComIfGs_isSwitch(sw + 1, fopAcM_GetRoomNo(this))) { - mState = ACT_WAIT; + mAction = ACT_WAIT; mHeightOffset = -300.0f; } else if (!dComIfGs_isSwitch(sw, fopAcM_GetRoomNo(this))) { - mState = ACT_HIND; + mAction = ACT_HIND; mHeightOffset = -300.0f; } else { - mState = ACT_ARRIVAL; + mAction = ACT_ARRIVAL; } calcMtx(); @@ -184,7 +184,7 @@ BOOL daMtoge_c::execute() { daMtoge_actionDown, }; - l_action[mState](this); + l_action[mAction](this); return TRUE; }