From a00b1a546cc5ac4b9f60b9fef07d689ddfb588b9 Mon Sep 17 00:00:00 2001 From: Dylan Ascencio Date: Mon, 11 Sep 2023 20:48:59 -0400 Subject: [PATCH 1/8] Match d_a_boss_item.cpp --- configure.py | 2 +- include/d/d_com_inf_game.h | 4 +-- include/f_op/f_op_actor_mng.h | 4 +-- src/d/actor/d_a_boss_item.cpp | 67 +++++++++++++++++++++++++++++++---- 4 files changed, 65 insertions(+), 12 deletions(-) diff --git a/configure.py b/configure.py index 1e3b0c940..5524f5acd 100644 --- a/configure.py +++ b/configure.py @@ -534,7 +534,7 @@ def ActorRel(status, rel_name): ActorRel(NonMatching, "d_a_bmdfoot"), ActorRel(NonMatching, "d_a_bmdhand"), ActorRel(NonMatching, "d_a_bo"), - ActorRel(NonMatching, "d_a_boss_item"), + ActorRel(Matching, "d_a_boss_item"), ActorRel(NonMatching, "d_a_bpw"), ActorRel(NonMatching, "d_a_bst"), ActorRel(NonMatching, "d_a_btd"), diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 0318e26a0..f88ab2312 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -378,7 +378,7 @@ inline void dComIfGs_onSaveTbox(int i_stageNo, int i_no) { g_dComIfG_gameInfo.save.getSavedata().getSave(i_stageNo).getBit().onTbox(i_no); } -inline BOOL dComIfGs_isStageBossEnemy() { +BOOL dComIfGs_isStageBossEnemy(int i_stageNo) { return g_dComIfG_gameInfo.save.getMemory().getBit().isStageBossEnemy(); } @@ -386,7 +386,7 @@ inline void dComIfGs_onStageLife() { g_dComIfG_gameInfo.save.getMemory().getBit().onStageLife(); } -inline BOOL dComIfGs_isStageLife() { +BOOL dComIfGs_isStageLife(int i_stageNo) { return g_dComIfG_gameInfo.save.getMemory().getBit().isStageLife(); } diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index a3af34d01..02318cd94 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -507,8 +507,8 @@ s32 fopAcM_createItemFromTable(cXyz const* p_pos, int i_tableNo, int i_itemBitNo s32 fopAcM_createDemoItem(const cXyz* p_pos, int itemNo, int itemBitNo, const csXyz* p_angle, int roomNo, const cXyz* scale, u8 param_7); -s32 fopAcM_createItemForBoss(const cXyz* p_pos, int param_2, int roomNo, const csXyz* p_angle, - const cXyz* p_scale, f32 speedF, f32 speedY, int param_8); +s32 fopAcM_createItemForBoss(cXyz* p_pos, int param_2, int roomNo, csXyz* p_angle, + cXyz* p_scale, int param_8); s32 fopAcM_createItemForMidBoss(const cXyz* p_pos, int i_itemNo, int i_roomNo, const csXyz* p_angle, const cXyz* p_scale, int param_6, int param_7); diff --git a/src/d/actor/d_a_boss_item.cpp b/src/d/actor/d_a_boss_item.cpp index 1fb7e0466..92692c69b 100644 --- a/src/d/actor/d_a_boss_item.cpp +++ b/src/d/actor/d_a_boss_item.cpp @@ -3,21 +3,74 @@ // Translation Unit: d_a_boss_item.cpp // -#include "d_a_boss_item.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "f_op/f_op_actor.h" +#include "f_op/f_op_actor_mng.h" +#include "d/d_procname.h" #include "dolphin/types.h" +extern BOOL dComIfGs_isStageBossEnemy(int i_stageNo); +extern BOOL dComIfGs_isStageLife(int i_stageNo); + +class bossitem_class : public fopAc_ac_c { + s32 m0000; + s32 m0004; +}; + /* 00000078-00000080 .text daBossItem_IsDelete__FP14bossitem_class */ -void daBossItem_IsDelete(bossitem_class*) { - /* Nonmatching */ +BOOL daBossItem_IsDelete(bossitem_class* i_this) { + return TRUE; } /* 00000080-00000088 .text daBossItem_Delete__FP14bossitem_class */ -void daBossItem_Delete(bossitem_class*) { - /* Nonmatching */ +BOOL daBossItem_Delete(bossitem_class* i_this) { + return TRUE; } /* 00000088-00000128 .text daBossItem_Create__FP10fopAc_ac_c */ -void daBossItem_Create(fopAc_ac_c*) { - /* Nonmatching */ +s32 daBossItem_Create(fopAc_ac_c* i_this) { + bossitem_class* bItem = static_cast(i_this); + + fopAcM_SetupActor(bItem, bossitem_class); + + int stageNo = bItem->mBase.mParameters & 0xFF; + BOOL isStageBossDead = dComIfGs_isStageBossEnemy(stageNo); + + if (isStageBossDead && !dComIfGs_isStageLife(stageNo)) { + fopAcM_createItemForBoss( + &bItem->current.pos, + 1, + bItem->current.roomNo, + &bItem->current.angle, + 0, + 1 + ); + } + + return cPhs_ERROR_e; } +static actor_method_class daBossItem_METHODS = { + (process_method_func)daBossItem_Create, + (process_method_func)daBossItem_Delete, + (process_method_func)0, + (process_method_func)daBossItem_IsDelete, + (process_method_func)0, +}; + +extern actor_process_profile_definition g_profile_BOSSITEM = { + fpcLy_CURRENT_e, + 7, + fpcLy_CURRENT_e, + PROC_BOSSITEM, + &g_fpcLf_Method.mBase, + sizeof(bossitem_class), + 0, + 0, + &g_fopAc_Method.base, + 0x00FB, + &daBossItem_METHODS, + 0x00040000, + fopAc_ACTOR_e, + fopAc_CULLBOX_0_e, +}; From 358010fb49aa47ae32b6dd0ab736955d8f365a4d Mon Sep 17 00:00:00 2001 From: Dylan Ascencio Date: Mon, 11 Sep 2023 20:56:48 -0400 Subject: [PATCH 2/8] Revert changes to isStageBossEnemy and isStageLife --- include/d/d_com_inf_game.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index f88ab2312..0318e26a0 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -378,7 +378,7 @@ inline void dComIfGs_onSaveTbox(int i_stageNo, int i_no) { g_dComIfG_gameInfo.save.getSavedata().getSave(i_stageNo).getBit().onTbox(i_no); } -BOOL dComIfGs_isStageBossEnemy(int i_stageNo) { +inline BOOL dComIfGs_isStageBossEnemy() { return g_dComIfG_gameInfo.save.getMemory().getBit().isStageBossEnemy(); } @@ -386,7 +386,7 @@ inline void dComIfGs_onStageLife() { g_dComIfG_gameInfo.save.getMemory().getBit().onStageLife(); } -BOOL dComIfGs_isStageLife(int i_stageNo) { +inline BOOL dComIfGs_isStageLife() { return g_dComIfG_gameInfo.save.getMemory().getBit().isStageLife(); } From e138734288e0aae33860309d8754624e63aa5ffb Mon Sep 17 00:00:00 2001 From: Dylan Ascencio Date: Tue, 12 Sep 2023 01:16:57 -0400 Subject: [PATCH 3/8] Start on d_a_branch; match set_anim, solidHeapCB, isDelete --- include/m_Do/m_Do_ext.h | 12 +++ src/d/actor/d_a_branch.cpp | 153 ++++++++++++++++++++++++++++++++++--- 2 files changed, 153 insertions(+), 12 deletions(-) diff --git a/include/m_Do/m_Do_ext.h b/include/m_Do/m_Do_ext.h index b7265cd43..1ec7d640f 100644 --- a/include/m_Do/m_Do_ext.h +++ b/include/m_Do/m_Do_ext.h @@ -229,6 +229,18 @@ class mDoExt_McaMorfCallBack1_c { virtual void execute(u16, J3DTransformInfo*) = 0; }; +class mDoExt_McaMorfCallBack2_c { +public: + virtual void execute(u16, J3DTransformInfo*) = 0; +}; + +class mDoExt_McaMorf { +public: + mDoExt_McaMorf(J3DModelData*, mDoExt_McaMorfCallBack1_c*, mDoExt_McaMorfCallBack2_c*, J3DAnmTransform*, int, float, int, int, int, void*, unsigned long, unsigned long); + + void setAnm(J3DAnmTransform*, int, f32, f32, f32, f32, void*); +}; + class mDoExt_3DlineMat_c { public: /* 0x0 */ void* field_0x0; diff --git a/src/d/actor/d_a_branch.cpp b/src/d/actor/d_a_branch.cpp index a93039f8d..e3d138079 100644 --- a/src/d/actor/d_a_branch.cpp +++ b/src/d/actor/d_a_branch.cpp @@ -3,17 +3,58 @@ // Translation Unit: d_a_branch.cpp // -#include "d_a_branch.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "JSystem/JUtility/JUTAssert.h" +#include "f_op/f_op_actor.h" +#include "f_op/f_op_actor_mng.h" +#include "d/d_procname.h" +#include "m_Do/m_Do_ext.h" +#include "d/d_com_inf_game.h" +#include "d/d_resorce.h" #include "dolphin/types.h" + +class daBranch_c : public fopAc_ac_c { +public: + void set_mtx(); + void set_anim(int, int, int); + void demoPlay(mDoExt_McaMorf*); + + s32 CreateHeap(); + static s32 solidHeapCB(fopAc_ac_c*); + + request_of_phase_process_class mPhs; + s8 dummy[0x10]; + mDoExt_McaMorf* mAnims[2]; + + static char m_arcname[]; +}; + +char daBranch_c::m_arcname[] = "Kwood_00"; + /* 00000078-00000128 .text set_mtx__10daBranch_cFv */ void daBranch_c::set_mtx() { - /* Nonmatching */ + //for (int i = 0; i < 2; i ++) { + + // } } /* 00000128-000001E4 .text set_anim__10daBranch_cFiii */ -void daBranch_c::set_anim(int, int, int) { - /* Nonmatching */ +void daBranch_c::set_anim(int i_animIdx, int i_bckIdx, int i_basIdx) { + if (i_bckIdx > 0 && i_basIdx > 0) { + void* pSnd = g_dComIfG_gameInfo.mResControl.getObjectIDRes(m_arcname, i_basIdx); + void* pAnm = g_dComIfG_gameInfo.mResControl.getObjectIDRes(m_arcname, i_bckIdx); + + mAnims[i_animIdx]->setAnm( + static_cast(pAnm), + -1, + 0.0f, + 1.0f, + 0.0f, + -1.0f, + pSnd + ); + } } /* 000001E4-00000228 .text demoPlay__10daBranch_cFP14mDoExt_McaMorf */ @@ -22,13 +63,57 @@ void daBranch_c::demoPlay(mDoExt_McaMorf*) { } /* 00000228-00000248 .text solidHeapCB__10daBranch_cFP10fopAc_ac_c */ -void daBranch_c::solidHeapCB(fopAc_ac_c*) { - /* Nonmatching */ +s32 daBranch_c::solidHeapCB(fopAc_ac_c* i_this) { + daBranch_c* branch = static_cast(i_this); + return branch->CreateHeap(); } /* 00000248-0000049C .text CreateHeap__10daBranch_cFv */ -void daBranch_c::CreateHeap() { - /* Nonmatching */ +s32 daBranch_c::CreateHeap() { + BOOL status = TRUE; + + s32 ids[] = { + 8, 0, + 7, 2, + 6, 5 + }; + + for (int i = 0; i < 2; i++) { + void* modelRes = dRes_control_c::getIDRes(m_arcname, ids[i + 4], g_dComIfG_gameInfo.mResControl.mObjectInfo, 0x40); + void* bckRes = dRes_control_c::getIDRes(m_arcname, ids[i + 2], g_dComIfG_gameInfo.mResControl.mObjectInfo, 0x40); + + if (!modelRes) { + JUT_ASSERT(0x1CC, "modelData != 0"); + } + if (!bckRes) { + JUT_ASSERT(0x1CD, "bck != 0"); + } + + mDoExt_McaMorf* newMorf = new mDoExt_McaMorf( + (J3DModelData*)dRes_control_c::getIDRes(m_arcname, ids[i + 4], g_dComIfG_gameInfo.mResControl.mObjectInfo, 0x40), + 0, + 0, + (J3DAnmTransformKey*)dRes_control_c::getIDRes(m_arcname, ids[i + 2], g_dComIfG_gameInfo.mResControl.mObjectInfo, 0x40), + 0, + 1.0f, + 0, + -1, + 1, + 0, + 0, + 0x11020203 + ); + + mAnims[i] = newMorf; + if (mAnims[i] == 0) { + status = FALSE; + break; + } + + + } + + return status; } /* 0000049C-00000524 .text daBranch_Draw__FP10daBranch_c */ @@ -42,8 +127,8 @@ void daBranch_Execute(daBranch_c*) { } /* 0000060C-00000614 .text daBranch_IsDelete__FP10daBranch_c */ -void daBranch_IsDelete(daBranch_c*) { - /* Nonmatching */ +BOOL daBranch_IsDelete(daBranch_c*) { + return TRUE; } /* 00000614-00000694 .text daBranch_Delete__FP10daBranch_c */ @@ -52,7 +137,51 @@ void daBranch_Delete(daBranch_c*) { } /* 00000694-0000080C .text daBranch_Create__FP10fopAc_ac_c */ -void daBranch_Create(fopAc_ac_c*) { - /* Nonmatching */ +s32 daBranch_Create(fopAc_ac_c* i_this) { + daBranch_c* branch = static_cast(i_this); + + fopAcM_SetupActor(branch, daBranch_c); + + s32 state = dComIfG_resLoad(&branch->mPhs, daBranch_c::m_arcname); + if (state == cPhs_COMPLEATE_e) { + int solidHeapResult = fopAcM_entrySolidHeap(i_this, (heapCallbackFunc)daBranch_c::solidHeapCB, 0x4000); + + if (solidHeapResult & 0xFF == 0) { + for (int i = 0; i < 2; i++) { + //branch->mBase.m + } + + state = cPhs_ERROR_e; + } + else { + + } + } + + return state; } +static actor_method_class l_daBranch_Method = { + (process_method_func)daBranch_Create, + (process_method_func)daBranch_Delete, + (process_method_func)daBranch_Execute, + (process_method_func)daBranch_IsDelete, + (process_method_func)daBranch_Draw, +}; + +extern actor_process_profile_definition g_profile_BRANCH = { + fpcLy_CURRENT_e, + 7, + fpcLy_CURRENT_e, + PROC_BRANCH, + &g_fpcLf_Method.mBase, + sizeof(daBranch_c), + 0, + 0, + &g_fopAc_Method.base, + 0x0193, + &l_daBranch_Method, + 0x00044000, + fopAc_ACTOR_e, + fopAc_CULLBOX_CUSTOM_e, +}; From a3751afe583c7e3e7d410805137b94f602672b5c Mon Sep 17 00:00:00 2001 From: Dylan Ascencio Date: Tue, 12 Sep 2023 01:32:08 -0400 Subject: [PATCH 4/8] Add dComIfG_getObjectIDRes and clean up d_a_branch --- include/d/d_com_inf_game.h | 8 ++++++++ src/d/actor/d_a_branch.cpp | 17 +++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 46dc6be05..db22bfd60 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -589,6 +589,14 @@ inline void* dComIfG_getObjectRes(const char* arcName, int param_1) { return g_dComIfG_gameInfo.mResControl.getObjectRes(arcName, param_1); } +inline void* dComIfG_getObjectIDRes(const char* arcName, int id) { + return g_dComIfG_gameInfo.mResControl.getObjectIDRes(arcName, id); +} + +inline void* dComIfG_getObjectIDRes(const char* arcName, u16 id) { + return g_dComIfG_gameInfo.mResControl.getObjectIDRes(arcName, id); +} + /** * === PARTICLE === */ diff --git a/src/d/actor/d_a_branch.cpp b/src/d/actor/d_a_branch.cpp index e3d138079..5048b4d4a 100644 --- a/src/d/actor/d_a_branch.cpp +++ b/src/d/actor/d_a_branch.cpp @@ -23,9 +23,10 @@ class daBranch_c : public fopAc_ac_c { s32 CreateHeap(); static s32 solidHeapCB(fopAc_ac_c*); - request_of_phase_process_class mPhs; - s8 dummy[0x10]; - mDoExt_McaMorf* mAnims[2]; + /* 0x0290 */ request_of_phase_process_class mPhs; + /* 0x0294 */ s8 dummy[0x10]; + // ... + /* 0x02A8*/ mDoExt_McaMorf* mAnims[2]; static char m_arcname[]; }; @@ -34,16 +35,17 @@ char daBranch_c::m_arcname[] = "Kwood_00"; /* 00000078-00000128 .text set_mtx__10daBranch_cFv */ void daBranch_c::set_mtx() { + /* Nonmatching */ //for (int i = 0; i < 2; i ++) { - // } + //} } /* 00000128-000001E4 .text set_anim__10daBranch_cFiii */ void daBranch_c::set_anim(int i_animIdx, int i_bckIdx, int i_basIdx) { if (i_bckIdx > 0 && i_basIdx > 0) { - void* pSnd = g_dComIfG_gameInfo.mResControl.getObjectIDRes(m_arcname, i_basIdx); - void* pAnm = g_dComIfG_gameInfo.mResControl.getObjectIDRes(m_arcname, i_bckIdx); + void* pSnd = dComIfG_getObjectIDRes(m_arcname, i_basIdx); + void* pAnm = dComIfG_getObjectIDRes(m_arcname, i_bckIdx); mAnims[i_animIdx]->setAnm( static_cast(pAnm), @@ -70,6 +72,8 @@ s32 daBranch_c::solidHeapCB(fopAc_ac_c* i_this) { /* 00000248-0000049C .text CreateHeap__10daBranch_cFv */ s32 daBranch_c::CreateHeap() { + /* Nonmatching */ + BOOL status = TRUE; s32 ids[] = { @@ -138,6 +142,7 @@ void daBranch_Delete(daBranch_c*) { /* 00000694-0000080C .text daBranch_Create__FP10fopAc_ac_c */ s32 daBranch_Create(fopAc_ac_c* i_this) { + /* Nonmatching */ daBranch_c* branch = static_cast(i_this); fopAcM_SetupActor(branch, daBranch_c); From 002b40ac8f42dd3f381778de14bf9146c8162c4f Mon Sep 17 00:00:00 2001 From: Dylan Ascencio Date: Tue, 12 Sep 2023 01:55:28 -0400 Subject: [PATCH 5/8] Match d_a_branch::set_mtx() --- src/d/actor/d_a_branch.cpp | 44 ++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/src/d/actor/d_a_branch.cpp b/src/d/actor/d_a_branch.cpp index 5048b4d4a..1b9efbb36 100644 --- a/src/d/actor/d_a_branch.cpp +++ b/src/d/actor/d_a_branch.cpp @@ -9,8 +9,9 @@ #include "f_op/f_op_actor_mng.h" #include "d/d_procname.h" #include "m_Do/m_Do_ext.h" +#include "m_Do/m_Do_mtx.h" #include "d/d_com_inf_game.h" -#include "d/d_resorce.h" +#include "dolphin/mtx/mtx.h" #include "dolphin/types.h" @@ -24,9 +25,10 @@ class daBranch_c : public fopAc_ac_c { static s32 solidHeapCB(fopAc_ac_c*); /* 0x0290 */ request_of_phase_process_class mPhs; - /* 0x0294 */ s8 dummy[0x10]; - // ... - /* 0x02A8*/ mDoExt_McaMorf* mAnims[2]; + /* 0x0294 */ //s8 dummy[0x04]; + /* 0x0298 */ J3DModel* mModels[2]; + /* 0x02A0 */ s8 dummy2[0x08]; + /* 0x02A8 */ mDoExt_McaMorf* mAnims[2]; static char m_arcname[]; }; @@ -35,20 +37,30 @@ char daBranch_c::m_arcname[] = "Kwood_00"; /* 00000078-00000128 .text set_mtx__10daBranch_cFv */ void daBranch_c::set_mtx() { - /* Nonmatching */ - //for (int i = 0; i < 2; i ++) { + J3DModel* pMdl; + + for (int i = 0; i < 2; i ++) { + pMdl = mModels[i]; + + if (pMdl) { + pMdl->setBaseScale(mScale); - //} + MTXTrans(mDoMtx_stack_c::now, current.pos.x, current.pos.y, current.pos.z); + mDoMtx_XYZrotM(mDoMtx_stack_c::now, current.angle.x, current.angle.y, current.angle.z); + + MTXCopy(mDoMtx_stack_c::now, pMdl->getBaseTRMtx()); + } + } } /* 00000128-000001E4 .text set_anim__10daBranch_cFiii */ void daBranch_c::set_anim(int i_animIdx, int i_bckIdx, int i_basIdx) { if (i_bckIdx > 0 && i_basIdx > 0) { void* pSnd = dComIfG_getObjectIDRes(m_arcname, i_basIdx); - void* pAnm = dComIfG_getObjectIDRes(m_arcname, i_bckIdx); + J3DAnmTransform* pAnm = static_cast(dComIfG_getObjectIDRes(m_arcname, i_bckIdx)); mAnims[i_animIdx]->setAnm( - static_cast(pAnm), + pAnm, -1, 0.0f, 1.0f, @@ -76,21 +88,21 @@ s32 daBranch_c::CreateHeap() { BOOL status = TRUE; - s32 ids[] = { + int ids[] = { 8, 0, 7, 2, 6, 5 }; for (int i = 0; i < 2; i++) { - void* modelRes = dRes_control_c::getIDRes(m_arcname, ids[i + 4], g_dComIfG_gameInfo.mResControl.mObjectInfo, 0x40); - void* bckRes = dRes_control_c::getIDRes(m_arcname, ids[i + 2], g_dComIfG_gameInfo.mResControl.mObjectInfo, 0x40); + J3DModelData* modelData = static_cast(dComIfG_getObjectIDRes(m_arcname, ids[i + 4])); + J3DAnmTransformKey* bck = static_cast(dComIfG_getObjectIDRes(m_arcname, ids[i + 2])); - if (!modelRes) { - JUT_ASSERT(0x1CC, "modelData != 0"); + if (!modelData) { + JUT_ASSERT(0x1CC, modelData != 0); } - if (!bckRes) { - JUT_ASSERT(0x1CD, "bck != 0"); + if (!bck) { + JUT_ASSERT(0x1CD, bck != 0); } mDoExt_McaMorf* newMorf = new mDoExt_McaMorf( From 84d1c048f3d52d18efa94ee47f7e0f4c8a3ecbb8 Mon Sep 17 00:00:00 2001 From: Dylan Ascencio Date: Tue, 12 Sep 2023 18:27:45 -0400 Subject: [PATCH 6/8] Match some more of daBranch_c --- include/m_Do/m_Do_ext.h | 1 + src/d/actor/d_a_branch.cpp | 61 ++++++++++++++++++++++++++++---------- 2 files changed, 46 insertions(+), 16 deletions(-) diff --git a/include/m_Do/m_Do_ext.h b/include/m_Do/m_Do_ext.h index 1467a4406..747c1a007 100644 --- a/include/m_Do/m_Do_ext.h +++ b/include/m_Do/m_Do_ext.h @@ -246,6 +246,7 @@ class mDoExt_McaMorf /* : public J3DMtxCalcMaya */ { void setFrame(f32 frame) { mFrameCtrl.setFrame(frame); } void updateDL(); void play(Vec *, u32, u8); + void stopZelAnime(); u32 pad[0x50]; // J3DMtxCalcMaya /* 0x50 */ J3DModel* mpModel; diff --git a/src/d/actor/d_a_branch.cpp b/src/d/actor/d_a_branch.cpp index 163834057..c2d0e7b0d 100644 --- a/src/d/actor/d_a_branch.cpp +++ b/src/d/actor/d_a_branch.cpp @@ -12,12 +12,24 @@ #include "m_Do/m_Do_mtx.h" #include "d/d_com_inf_game.h" #include "d/d_kankyo.h" +#include "JSystem/J3DGraphBase/J3DMaterial.h" #include "dolphin/mtx/mtx.h" #include "dolphin/types.h" class daBranch_c : public fopAc_ac_c { public: + ~daBranch_c() { + for (int i = 0; i < 2; i++) { + mDoExt_McaMorf* anim = mAnims[i]; + if (anim != 0) { + anim->stopZelAnime(); + } + } + + dComIfG_resDelete(&mPhs, m_arcname); + } + void set_mtx(); void set_anim(int, int, int); void demoPlay(mDoExt_McaMorf*); @@ -31,6 +43,8 @@ class daBranch_c : public fopAc_ac_c { /* 0x02A8 */ mDoExt_McaMorf* mAnims[2]; /* 0x02B0 */ u8 dummy[0x08]; /* 0x02B8 */ u32 m02B8; + /* 0x02BC */ u8 m02BC; + /* 0x02BD */ u8 m02BD; static char m_arcname[]; }; @@ -87,28 +101,25 @@ s32 daBranch_c::solidHeapCB(fopAc_ac_c* i_this) { /* 00000248-0000049C .text CreateHeap__10daBranch_cFv */ s32 daBranch_c::CreateHeap() { /* Nonmatching */ - BOOL status = TRUE; + int basIds[] = { 8, 0 }; + int bckIds[] = { 7, 2 }; + int bmdIds[] = { 6, 5 }; + int t[] = {0, 0}; - int ids[] = { - 8, 0, - 7, 2, - 6, 5 - }; + BOOL status = TRUE; for (int i = 0; i < 2; i++) { - int curId = ids[i + 4]; - - J3DModelData* modelData = static_cast(dComIfG_getObjectIDRes(m_arcname, curId)); - J3DAnmTransformKey* bck = static_cast(dComIfG_getObjectIDRes(m_arcname, ids[i + 2])); + J3DModelData* modelData = static_cast(dComIfG_getObjectIDRes(m_arcname, bmdIds[i])); + J3DAnmTransformKey* bck = static_cast(dComIfG_getObjectIDRes(m_arcname, bckIds[i])); JUT_ASSERT(0x1CC, modelData != 0); JUT_ASSERT(0x1CD, bck != 0); mDoExt_McaMorf* newMorf = new mDoExt_McaMorf( - static_cast(dComIfG_getObjectIDRes(m_arcname, curId)), + static_cast(dComIfG_getObjectIDRes(m_arcname, bmdIds[i])), 0, 0, - static_cast(dComIfG_getObjectIDRes(m_arcname, ids[i + 2])), + static_cast(dComIfG_getObjectIDRes(m_arcname, bckIds[i])), 0, 1.0f, 0, @@ -132,7 +143,7 @@ s32 daBranch_c::CreateHeap() { } mAnims[i]->mFrameCtrl.setFrame(0.0f); - set_anim(i, ids[i + 2], ids[i]); + set_anim(i, bckIds[i], basIds[i]); } return status; @@ -192,8 +203,9 @@ BOOL daBranch_IsDelete(daBranch_c* i_this) { } /* 00000614-00000694 .text daBranch_Delete__FP10daBranch_c */ -void daBranch_Delete(daBranch_c* i_this) { - /* Nonmatching */ +BOOL daBranch_Delete(daBranch_c* i_this) { + i_this->~daBranch_c(); + return TRUE; } /* 00000694-0000080C .text daBranch_Create__FP10fopAc_ac_c */ @@ -209,13 +221,30 @@ s32 daBranch_Create(fopAc_ac_c* i_this) { if (solidHeapResult & 0xFF == 0) { for (int i = 0; i < 2; i++) { - //branch->mBase.m + branch->mAnims[i] = 0; } state = cPhs_ERROR_e; } else { + branch->mCullMtx = branch->mModels[0]->mBaseTransformMtx; + fopAcM_setCullSizeBox(i_this, 0.0f, 0.0f, -50.0f, 300.0f, 100.0f, 50.0f); + + branch->m02B8 = 6; + branch->m02BC = 0; + branch->m02BD = 0; + for (int i = 0; i < 2; i++) { + J3DModelData* modelData = branch->mModels[i]->mModelData; + + for (int j = 0; j < modelData->getMaterialNum(); j++) { + J3DMaterial* mat = modelData->getMaterialNodePointer(j); + if (mat) { + J3DFog* fog = mat->getPEBlock()->getFog(); + fog->field_0x0 = 2; + } + } + } } } From 9d280b51682fe319790acafad03227e1bf3a73d0 Mon Sep 17 00:00:00 2001 From: Dylan Ascencio Date: Tue, 12 Sep 2023 20:41:12 -0400 Subject: [PATCH 7/8] Match d_a_magma --- configure.py | 2 +- src/d/actor/d_a_magma.cpp | 71 +++++++++++++++++++++++++++++++++++---- 2 files changed, 65 insertions(+), 8 deletions(-) diff --git a/configure.py b/configure.py index a52bd174b..7b4136fbd 100644 --- a/configure.py +++ b/configure.py @@ -379,7 +379,7 @@ def ActorRel(status, rel_name): ActorRel(NonMatching, "d_a_lamp"), ActorRel(NonMatching, "d_a_lod_bg"), ActorRel(NonMatching, "d_a_lwood"), - ActorRel(NonMatching, "d_a_magma"), + ActorRel(Matching, "d_a_magma"), ActorRel(NonMatching, "d_a_majuu_flag"), ActorRel(NonMatching, "d_a_mdoor"), ActorRel(NonMatching, "d_a_msw"), diff --git a/src/d/actor/d_a_magma.cpp b/src/d/actor/d_a_magma.cpp index 7fa484d2d..cf428ba22 100644 --- a/src/d/actor/d_a_magma.cpp +++ b/src/d/actor/d_a_magma.cpp @@ -3,21 +3,78 @@ // Translation Unit: d_a_magma.cpp // -#include "d_a_magma.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "f_op/f_op_actor_mng.h" +#include "d/d_procname.h" +#include "d/d_com_inf_game.h" +#include "d/d_magma.h" #include "dolphin/types.h" + +class daMagma_c : public fopAc_ac_c { +public: + ~daMagma_c() { + dComIfG_resDelete(&mPhs, "Magma"); + } + + request_of_phase_process_class mPhs; +}; + /* 00000078-00000080 .text daMagma_IsDelete__FP9daMagma_c */ -void daMagma_IsDelete(daMagma_c*) { - /* Nonmatching */ +BOOL daMagma_IsDelete(daMagma_c* i_this) { + return TRUE; } /* 00000080-000000CC .text daMagma_Delete__FP9daMagma_c */ -void daMagma_Delete(daMagma_c*) { - /* Nonmatching */ +BOOL daMagma_Delete(daMagma_c* i_this) { + i_this->~daMagma_c(); + return TRUE; } /* 000000CC-00000178 .text daMagma_Create__FP10fopAc_ac_c */ -void daMagma_Create(fopAc_ac_c*) { - /* Nonmatching */ +s32 daMagma_Create(fopAc_ac_c* i_this) { + daMagma_c* magma = static_cast(i_this); + + fopAcM_SetupActor(magma, daMagma_c); + + int result = dComIfG_resLoad(&magma->mPhs, "Magma"); + if (result != cPhs_COMPLEATE_e) { + return result; + } + + if (g_dComIfG_gameInfo.play.createMagma()) { + g_dComIfG_gameInfo.play.mpMagmaPacket->newFloor( + magma->current.pos, + magma->mScale, + magma->getRoomNo(), + magma->mBase.mParameters + ); + } + + return cPhs_ERROR_e; } +static actor_method_class l_daMagma_Method = { + (process_method_func)daMagma_Create, + (process_method_func)daMagma_Delete, + (process_method_func)0, + (process_method_func)daMagma_IsDelete, + (process_method_func)0, +}; + +extern actor_process_profile_definition g_profile_MAGMA = { + fpcLy_CURRENT_e, + 7, + fpcPi_CURRENT_e, + PROC_MAGMA, + &g_fpcLf_Method.mBase, + sizeof(daMagma_c), + 0, + 0, + &g_fopAc_Method.base, + 0x01BC, + &l_daMagma_Method, + 0x00040180, + fopAc_ACTOR_e, + fopAc_CULLBOX_0_e +}; From 7a43b2358ecca8be73b53bfec0948947b5a4359e Mon Sep 17 00:00:00 2001 From: Dylan Ascencio Date: Tue, 12 Sep 2023 21:10:58 -0400 Subject: [PATCH 8/8] Minor changes to d_a_branch --- src/d/actor/d_a_branch.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/d/actor/d_a_branch.cpp b/src/d/actor/d_a_branch.cpp index c2d0e7b0d..ba3e2f4d8 100644 --- a/src/d/actor/d_a_branch.cpp +++ b/src/d/actor/d_a_branch.cpp @@ -61,10 +61,9 @@ void daBranch_c::set_mtx() { if (pMdl) { pMdl->setBaseScale(mScale); - MTXTrans(mDoMtx_stack_c::now, current.pos.x, current.pos.y, current.pos.z); - mDoMtx_XYZrotM(mDoMtx_stack_c::now, current.angle.x, current.angle.y, current.angle.z); - - MTXCopy(mDoMtx_stack_c::now, pMdl->getBaseTRMtx()); + mDoMtx_stack_c::transS(getPosition()); + mDoMtx_stack_c::XYZrotM(getAngle().x, getAngle().y, getAngle().z); + pMdl->i_setBaseTRMtx(mDoMtx_stack_c::get()); } } } @@ -142,7 +141,7 @@ s32 daBranch_c::CreateHeap() { break; } - mAnims[i]->mFrameCtrl.setFrame(0.0f); + mAnims[i]->setFrame(0.0f); set_anim(i, bckIds[i], basIds[i]); }