From 6f2587f2eebbf623d2d2c2465fcabaa0fa84bd16 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Mon, 8 Jan 2024 17:25:17 -0500 Subject: [PATCH] misc actor cleanup --- include/d/actor/d_a_kaji.h | 2 +- include/d/actor/d_a_rd.h | 6 +-- include/d/actor/d_a_tag_msg.h | 3 -- src/d/actor/d_a_obj_pbka.cpp | 95 +++++++++++++++++++---------------- src/d/actor/d_a_rectangle.cpp | 50 +++++++++--------- src/d/actor/d_a_swtact.cpp | 30 +++++------ src/d/actor/d_a_tag_msg.cpp | 50 +++++++++--------- 7 files changed, 119 insertions(+), 117 deletions(-) diff --git a/include/d/actor/d_a_kaji.h b/include/d/actor/d_a_kaji.h index e7db446fe..7d84a3b0f 100644 --- a/include/d/actor/d_a_kaji.h +++ b/include/d/actor/d_a_kaji.h @@ -12,7 +12,7 @@ class daKaji_c : public fopAc_ac_c { public: static const char M_arcname[]; - inline void set_mtx() { + void set_mtx() { mpMorf->getModel()->setBaseScale(mScale); mDoMtx_stack_c::transS(current.pos); mDoMtx_stack_c::ZXYrotM(shape_angle); diff --git a/include/d/actor/d_a_rd.h b/include/d/actor/d_a_rd.h index c6c807cdb..4118dfcbf 100644 --- a/include/d/actor/d_a_rd.h +++ b/include/d/actor/d_a_rd.h @@ -111,10 +111,10 @@ public: daRd_c() {} bool isAnm(s8 idx) { return mAnmPrmIdx == idx; } + void onIkari() { mbIkari = true; } + void offIkari() { mbIkari = false; } bool isIkari() { return mbIkari; } void modeProcInit(int newMode) { modeProc(PROC_INIT, newMode); } - void offIkari() { mbIkari = false; } - void onIkari() { mbIkari = true; } fopAc_ac_c* _searchNearDeadRd(fopAc_ac_c*); BOOL _nodeControl(J3DNode*, J3DModel*); @@ -153,7 +153,7 @@ public: void modeSwWait(); void modeKanokeInit(); void modeKanoke(); - void modeProc(daRd_c::Proc_e, int); + void modeProc(Proc_e, int); void setBrkAnm(s8); void setBtkAnm(s8); void setAnm(s8, bool); diff --git a/include/d/actor/d_a_tag_msg.h b/include/d/actor/d_a_tag_msg.h index 9bc295cef..efeb5d519 100644 --- a/include/d/actor/d_a_tag_msg.h +++ b/include/d/actor/d_a_tag_msg.h @@ -25,9 +25,6 @@ public: public: /* 0x290 */ u8 mAction; - /* 0x291 */ u8 field_0x291; - /* 0x292 */ u8 field_0x292; - /* 0x293 */ u8 field_0x293; }; #endif /* D_A_TAG_MSG_H */ diff --git a/src/d/actor/d_a_obj_pbka.cpp b/src/d/actor/d_a_obj_pbka.cpp index af98037a5..806518847 100644 --- a/src/d/actor/d_a_obj_pbka.cpp +++ b/src/d/actor/d_a_obj_pbka.cpp @@ -8,16 +8,6 @@ #include "m_Do/m_Do_mtx.h" #include "d/d_procname.h" -BOOL daObjPbka_c::_draw() { - dKy_tevstr_c * pTevStr; - g_env_light.settingTevStruct(TEV_TYPE_BG0, ¤t.pos, pTevStr = &mTevStr); - g_env_light.setLightTevColorType(mpModel, pTevStr); - dComIfGd_setListBG(); - mDoExt_modelUpdateDL(mpModel); - dComIfGd_setList(); - return true; -} - static int CheckCreateHeap(fopAc_ac_c* i_this) { daObjPbka_c* a_this = (daObjPbka_c*)i_this; return a_this->CreateHeap(); @@ -29,7 +19,7 @@ BOOL daObjPbka_c::CreateHeap() { JUT_ASSERT(0x51, modelData != 0); mpModel = mDoExt_J3DModel__create(modelData,0,0x11020203); if(mpModel == NULL) { - return false; + return FALSE; } return TRUE; } @@ -52,25 +42,41 @@ void daObjPbka_c::set_mtx() { mDoMtx_copy(mDoMtx_stack_c::get(), mpModel->mBaseTransformMtx); } -static cPhs__Step daObjPbka_Create(void* i_this) { - int cPhsStep; - daObjPbka_c* a_this = (daObjPbka_c*)i_this; - fopAcM_SetupActor(a_this, daObjPbka_c); +s32 daObjPbka_c::_create() { + fopAcM_SetupActor(this, daObjPbka_c); - cPhsStep = dComIfG_resLoad(&a_this->mPhase, "Pbka"); - if (cPhsStep == cPhs_COMPLEATE_e) { - if (fopAcM_entrySolidHeap(a_this, CheckCreateHeap, 0x680) == 0) { - cPhsStep = cPhs_ERROR_e; + int phase_state = dComIfG_resLoad(&mPhase, "Pbka"); + if (phase_state == cPhs_COMPLEATE_e) { + if (fopAcM_entrySolidHeap(this, CheckCreateHeap, 0x680) == 0) { + phase_state = cPhs_ERROR_e; } else { - a_this->CreateInit(); + CreateInit(); } } - return (cPhs__Step)cPhsStep; + return phase_state; +} + +static int daObjPbka_Create(void* i_this) { + return static_cast(i_this)->_create(); +} + +BOOL daObjPbka_c::_delete() { + dComIfG_resDelete(&mPhase,"Pbka"); + return TRUE; } static BOOL daObjPbka_Delete(void* i_this) { - daObjPbka_c* a_this = (daObjPbka_c*)i_this; - dComIfG_resDelete(&a_this->mPhase,"Pbka"); + static_cast(i_this)->_delete(); + return TRUE; +} + +BOOL daObjPbka_c::_draw() { + dKy_tevstr_c * pTevStr; + g_env_light.settingTevStruct(TEV_TYPE_BG0, ¤t.pos, pTevStr = &mTevStr); + g_env_light.setLightTevColorType(mpModel, pTevStr); + dComIfGd_setListBG(); + mDoExt_modelUpdateDL(mpModel); + dComIfGd_setList(); return TRUE; } @@ -79,15 +85,18 @@ static BOOL daObjPbka_Draw(void* i_this) { return a_this->_draw(); } -static BOOL daObjPbka_Execute(void* i_this) { - daObjPbka_c* a_this = (daObjPbka_c*)i_this; - a_this->current.angle.y += 0x500; - a_this->shape_angle.y = a_this->current.angle.y; - fopAcM_seStartCurrent(a_this, JA_SE_OBJ_BOMB_SHOP_FAN, 0); - a_this->set_mtx(); +BOOL daObjPbka_c::_execute() { + current.angle.y += 0x500; + shape_angle.y = current.angle.y; + fopAcM_seStartCurrent(this, JA_SE_OBJ_BOMB_SHOP_FAN, 0); + set_mtx(); return TRUE; } +static BOOL daObjPbka_Execute(void* i_this) { + return static_cast(i_this)->_execute(); +} + static BOOL daObjPbka_IsDelete(void*) { return TRUE; } @@ -101,18 +110,18 @@ static actor_method_class daObj_PbkaMethodTable = { }; actor_process_profile_definition g_profile_Obj_Pbka = { - fpcLy_CURRENT_e, - 7, - fpcLy_CURRENT_e, - PROC_Obj_Pbka, - &g_fpcLf_Method.mBase, - sizeof(daObjPbka_c), - 0, - 0, - &g_fopAc_Method.base, - 0x70, - &daObj_PbkaMethodTable, - fopAcStts_UNK40000_e | fopAcStts_CULL_e, - fopAc_ACTOR_e, - fopAc_CULLBOX_CUSTOM_e, + /* LayerID */ fpcLy_CURRENT_e, + /* ListID */ 7, + /* ListPrio */ fpcLy_CURRENT_e, + /* ProcName */ PROC_Obj_Pbka, + /* Proc SubMtd */ &g_fpcLf_Method.mBase, + /* Size */ sizeof(daObjPbka_c), + /* SizeOther */ 0, + /* Parameters */ 0, + /* Leaf SubMtd */ &g_fopAc_Method.base, + /* Priority */ 0x70, + /* Actor SubMtd */ &daObj_PbkaMethodTable, + /* Status */ fopAcStts_UNK40000_e | fopAcStts_CULL_e, + /* Group */ fopAc_ACTOR_e, + /* CullType */ fopAc_CULLBOX_CUSTOM_e, }; diff --git a/src/d/actor/d_a_rectangle.cpp b/src/d/actor/d_a_rectangle.cpp index 0a0f0466d..6333be7be 100644 --- a/src/d/actor/d_a_rectangle.cpp +++ b/src/d/actor/d_a_rectangle.cpp @@ -2,31 +2,31 @@ #include "d/actor/d_a_rectangle.h" #include "f_op/f_op_actor.h" #include "d/d_procname.h" -#include "dolphin/types.h" +#include "SSystem/SComponent/c_phase.h" /* 00000078-00000080 .text daRct_Draw__FP15RECTANGLE_class */ -static BOOL daRct_Draw(RECTANGLE_class*) { - return true; +static BOOL daRct_Draw(RECTANGLE_class* i_this) { + return TRUE; } /* 00000080-00000088 .text daRct_Execute__FP15RECTANGLE_class */ -static BOOL daRct_Execute(RECTANGLE_class*) { - return true; +static BOOL daRct_Execute(RECTANGLE_class* i_this) { + return TRUE; } /* 00000088-00000090 .text daRct_IsDelete__FP15RECTANGLE_class */ -static BOOL daRct_IsDelete(RECTANGLE_class*) { - return true; +static BOOL daRct_IsDelete(RECTANGLE_class* i_this) { + return TRUE; } /* 00000090-00000098 .text daRct_Delete__FP15RECTANGLE_class */ -static BOOL daRct_Delete(RECTANGLE_class*) { - return true; +static BOOL daRct_Delete(RECTANGLE_class* i_this) { + return TRUE; } /* 00000098-000000A0 .text daRct_Create__FP10fopAc_ac_c */ -static int daRct_Create(fopAc_ac_c*) { - return 0x4; +static int daRct_Create(fopAc_ac_c* i_this) { + return cPhs_COMPLEATE_e; } static actor_method_class l_daRct_Method = { @@ -38,18 +38,18 @@ static actor_method_class l_daRct_Method = { }; actor_process_profile_definition g_profile_RECTANGLE = { - fpcLy_CURRENT_e, - 7, - fpcLy_CURRENT_e, - PROC_RECTANGLE, - &g_fpcLf_Method.mBase, - sizeof(RECTANGLE_class), - 0, - 0, - &g_fopAc_Method.base, - 0x9F, - &l_daRct_Method, - fopAcStts_UNK40000_e, - fopAc_ACTOR_e, - fopAc_CULLBOX_0_e, + /* LayerID */ fpcLy_CURRENT_e, + /* ListID */ 7, + /* ListPrio */ fpcLy_CURRENT_e, + /* ProcName */ PROC_RECTANGLE, + /* Proc SubMtd */ &g_fpcLf_Method.mBase, + /* Size */ sizeof(RECTANGLE_class), + /* SizeOther */ 0, + /* Parameters */ 0, + /* Leaf SubMtd */ &g_fopAc_Method.base, + /* Priority */ 0x9F, + /* Actor SubMtd */ &l_daRct_Method, + /* Status */ fopAcStts_UNK40000_e, + /* Group */ fopAc_ACTOR_e, + /* CullType */ fopAc_CULLBOX_0_e, }; diff --git a/src/d/actor/d_a_swtact.cpp b/src/d/actor/d_a_swtact.cpp index 7b337fbc1..bc4cfd8b4 100644 --- a/src/d/actor/d_a_swtact.cpp +++ b/src/d/actor/d_a_swtact.cpp @@ -73,7 +73,7 @@ s32 daSwTact_c::_create() { s32 result = cPhs_COMPLEATE_e; if (daSwTact_prm::getModel(this) == 1) { - result = dComIfG_resLoad(&this->mPhs, m_arcname); + result = dComIfG_resLoad(&mPhs, m_arcname); if (result == cPhs_COMPLEATE_e) { if (!fopAcM_entrySolidHeap(this, CheckCreateHeap, 0x3000)) { @@ -212,18 +212,18 @@ actor_method_class daSwTactMethodTable = { }; actor_process_profile_definition g_profile_SW_TACT = { - fpcLy_CURRENT_e, - 7, - fpcPi_CURRENT_e, - PROC_SW_TACT, - &g_fpcLf_Method.mBase, - sizeof(daSwTact_c), - 0, - 0, - &g_fopAc_Method.base, - 0x013B, - &daSwTactMethodTable, - fopAcStts_CULL_e | fopAcStts_UNK4000_e | fopAcStts_UNK40000_e, - fopAc_ACTOR_e, - fopAc_CULLBOX_CUSTOM_e, + /* LayerID */ fpcLy_CURRENT_e, + /* ListID */ 7, + /* ListPrio */ fpcPi_CURRENT_e, + /* ProcName */ PROC_SW_TACT, + /* Proc SubMtd */ &g_fpcLf_Method.mBase, + /* Size */ sizeof(daSwTact_c), + /* SizeOther */ 0, + /* Parameters */ 0, + /* Leaf SubMtd */ &g_fopAc_Method.base, + /* Priority */ 0x013B, + /* Actor SubMtd */ &daSwTactMethodTable, + /* Status */ fopAcStts_CULL_e | fopAcStts_UNK4000_e | fopAcStts_UNK40000_e, + /* Group */ fopAc_ACTOR_e, + /* CullType */ fopAc_CULLBOX_CUSTOM_e, }; diff --git a/src/d/actor/d_a_tag_msg.cpp b/src/d/actor/d_a_tag_msg.cpp index e436c1bb4..87a7024f8 100644 --- a/src/d/actor/d_a_tag_msg.cpp +++ b/src/d/actor/d_a_tag_msg.cpp @@ -106,18 +106,14 @@ BOOL daTag_Msg_c::rangeCheck() { } BOOL daTag_Msg_c::otherCheck() { - daPy_lk_c *player; - short diff; - short actorAngle; - - actorAngle = fopAcM_searchActorAngleY(this, daPy_getPlayerActorClass()); - player = daPy_getPlayerLinkActorClass(); - if ((getType2() & 1) != 0) { + s16 targetAngle = fopAcM_searchPlayerAngleY(this); + daPy_lk_c* player = daPy_getPlayerLinkActorClass(); + if (getType2() & 1) { return TRUE; } JUT_ASSERT(0xC8, player); if (getMessage() == 0x1902) { - diff = (short)(actorAngle - this->orig.angle.y); + s16 diff = targetAngle - orig.angle.y; if (diff < 0) { diff = -diff; } @@ -125,11 +121,11 @@ BOOL daTag_Msg_c::otherCheck() { return FALSE; } } - actorAngle = (short)(actorAngle + 0x7fff) - player->current.angle.y; - if (actorAngle < 0) { - actorAngle = (short)-actorAngle; + targetAngle = (s16)(targetAngle + 0x7FFF) - player->current.angle.y; + if (targetAngle < 0) { + targetAngle = -targetAngle; } - if (actorAngle > 0x1000) { + if (targetAngle > 0x1000) { return FALSE; } @@ -201,7 +197,7 @@ static BOOL daTag_Msg_actionHunt(daTag_Msg_c* a_this) { daPy_getPlayerLinkActorClass()->onPlayerNoDraw(); } } else if (a_this->rangeCheck() != 0 && a_this->otherCheck() != 0) { - if ((a_this->getType2() & 1) != 0) { + if (a_this->getType2() & 1) { fopAcM_orderSpeakEvent(a_this); } a_this->mEvtInfo.mCondition |= dEvtCnd_CANTALK_e; @@ -291,18 +287,18 @@ static actor_method_class l_daTag_Msg_Method = { }; actor_process_profile_definition g_profile_TAG_MSG = { - fpcLy_CURRENT_e, - 7, - fpcPi_CURRENT_e, - PROC_TAG_MSG, - &g_fpcLf_Method.mBase, - sizeof(daTag_Msg_c), - 0, - 0, - &g_fopAc_Method.base, - 0x0121, - &l_daTag_Msg_Method, - fopAcStts_UNK4000_e | fopAcStts_UNK40000_e, - fopAc_ACTOR_e, - fopAc_CULLBOX_6_e, + /* LayerID */ fpcLy_CURRENT_e, + /* ListID */ 7, + /* ListPrio */ fpcPi_CURRENT_e, + /* ProcName */ PROC_TAG_MSG, + /* Proc SubMtd */ &g_fpcLf_Method.mBase, + /* Size */ sizeof(daTag_Msg_c), + /* SizeOther */ 0, + /* Parameters */ 0, + /* Leaf SubMtd */ &g_fopAc_Method.base, + /* Priority */ 0x0121, + /* Actor SubMtd */ &l_daTag_Msg_Method, + /* Status */ fopAcStts_UNK4000_e | fopAcStts_UNK40000_e, + /* Group */ fopAc_ACTOR_e, + /* CullType */ fopAc_CULLBOX_6_e, };