From ca6919cd30d5bb9bc7b0676ddf0145ec496ecc4c Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Mon, 2 Sep 2024 10:39:46 -0700 Subject: [PATCH] vmsdz/vmsms match fixes #449 #450 --- configure.py | 4 +- include/d/actor/d_a_obj_vmsdz.h | 17 ++++--- include/d/actor/d_a_obj_vmsms.h | 19 ++++--- src/d/actor/d_a_obj_vmsdz.cpp | 81 ++++++++++++++++++++++-------- src/d/actor/d_a_obj_vmsms.cpp | 89 ++++++++++++++++++++++++--------- 5 files changed, 149 insertions(+), 61 deletions(-) diff --git a/configure.py b/configure.py index 23b56cd3a..5375bccf0 100644 --- a/configure.py +++ b/configure.py @@ -1627,8 +1627,8 @@ def JSystemLib(lib_name, objects): ActorRel(Matching, "d_a_obj_vfan", extra_cflags=[ '-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_obj_vgnfd"), ActorRel(NonMatching, "d_a_obj_vmc"), - ActorRel(NonMatching, "d_a_obj_vmsdz"), - ActorRel(NonMatching, "d_a_obj_vmsms"), + ActorRel(Matching, "d_a_obj_vmsdz"), + ActorRel(Matching, "d_a_obj_vmsms"), ActorRel(NonMatching, "d_a_obj_volcano"), ActorRel(NonMatching, "d_a_obj_vtil"), ActorRel(NonMatching, "d_a_obj_vyasi"), diff --git a/include/d/actor/d_a_obj_vmsdz.h b/include/d/actor/d_a_obj_vmsdz.h index 7c1501435..9f1678920 100644 --- a/include/d/actor/d_a_obj_vmsdz.h +++ b/include/d/actor/d_a_obj_vmsdz.h @@ -2,19 +2,24 @@ #define D_A_OBJ_VMSDZ_H #include "f_op/f_op_actor.h" +#include "SSystem/SComponent/c_phase.h" class daObjVmsdz_c : public fopAc_ac_c { public: - void solidHeapCB(fopAc_ac_c*); - void create_heap(); + static BOOL solidHeapCB(fopAc_ac_c*); + BOOL create_heap(); s32 _create(); - BOOL _delete(); + bool _delete(); void init_mtx(); - BOOL _execute(); - BOOL _draw(); + bool _execute(); + bool _draw(); public: - /* Place member variables here */ + static const char M_arcname[]; + +public: + /* 0x290 */ J3DModel* mModel; + /* 0x294 */ request_of_phase_process_class mPhs; }; #endif /* D_A_OBJ_VMSDZ_H */ diff --git a/include/d/actor/d_a_obj_vmsms.h b/include/d/actor/d_a_obj_vmsms.h index 608d2d195..d4dda676f 100644 --- a/include/d/actor/d_a_obj_vmsms.h +++ b/include/d/actor/d_a_obj_vmsms.h @@ -2,21 +2,26 @@ #define D_A_OBJ_VMSMS_H #include "f_op/f_op_actor.h" +#include "SSystem/SComponent/c_phase.h" class daObjVmsms_c : public fopAc_ac_c { public: - void check_demo() const; // weak but not inlined? + bool check_demo() const; // weak but not inlined? - void solidHeapCB(fopAc_ac_c*); - void create_heap(); + static BOOL solidHeapCB(fopAc_ac_c*); + BOOL create_heap(); s32 _create(); - BOOL _delete(); + bool _delete(); void init_mtx(); - BOOL _execute(); - BOOL _draw(); + bool _execute(); + bool _draw(); public: - /* Place member variables here */ + static const char M_arcname[]; + +public: + /* 0x290 */ J3DModel* mModel; + /* 0x294 */ request_of_phase_process_class mPhs; }; #endif /* D_A_OBJ_VMSMS_H */ diff --git a/src/d/actor/d_a_obj_vmsdz.cpp b/src/d/actor/d_a_obj_vmsdz.cpp index ed2c6a6d3..dc0c829cb 100644 --- a/src/d/actor/d_a_obj_vmsdz.cpp +++ b/src/d/actor/d_a_obj_vmsdz.cpp @@ -4,67 +4,104 @@ // #include "d/actor/d_a_obj_vmsdz.h" +#include "d/d_com_inf_game.h" #include "d/d_procname.h" +#include "d/res/res_vmsdz.h" + +const char daObjVmsdz_c::M_arcname[6] = "VmsDZ"; /* 00000078-00000098 .text solidHeapCB__12daObjVmsdz_cFP10fopAc_ac_c */ -void daObjVmsdz_c::solidHeapCB(fopAc_ac_c*) { - /* Nonmatching */ +BOOL daObjVmsdz_c::solidHeapCB(fopAc_ac_c* i_ac) { + return ((daObjVmsdz_c*)i_ac)->create_heap(); } /* 00000098-0000015C .text create_heap__12daObjVmsdz_cFv */ -void daObjVmsdz_c::create_heap() { - /* Nonmatching */ +BOOL daObjVmsdz_c::create_heap() { + J3DModelData* mdl_data; + BOOL ret = FALSE; + + mdl_data = (J3DModelData*)dComIfG_getObjectRes(M_arcname, VMSDZ_BDL_VMSDZ); + JUT_ASSERT(0x59, mdl_data != NULL); + + if (mdl_data != NULL) { + mModel = mDoExt_J3DModel__create(mdl_data, 0, 0x11020203); + if (mModel != NULL) { + ret = TRUE; + } + } + + return ret; } /* 0000015C-00000208 .text _create__12daObjVmsdz_cFv */ s32 daObjVmsdz_c::_create() { - /* Nonmatching */ + s32 ret = cPhs_ERROR_e; + + fopAcM_SetupActor(this, daObjVmsdz_c); + + ret = dComIfG_resLoad(&mPhs, M_arcname); + if (ret == cPhs_COMPLEATE_e) { + ret = cPhs_ERROR_e; + if (fopAcM_entrySolidHeap(this, solidHeapCB, 0)) { + fopAcM_SetMtx(this, mModel->getBaseTRMtx()); + init_mtx(); + ret = cPhs_COMPLEATE_e; + } + } + + return ret; } /* 00000208-00000238 .text _delete__12daObjVmsdz_cFv */ -BOOL daObjVmsdz_c::_delete() { - /* Nonmatching */ +bool daObjVmsdz_c::_delete() { + dComIfG_resDelete(&mPhs, M_arcname); + return true; } /* 00000238-00000258 .text init_mtx__12daObjVmsdz_cFv */ void daObjVmsdz_c::init_mtx() { - /* Nonmatching */ + mModel->setBaseScale(scale); } /* 00000258-00000260 .text _execute__12daObjVmsdz_cFv */ -BOOL daObjVmsdz_c::_execute() { - /* Nonmatching */ +bool daObjVmsdz_c::_execute() { + return true; } /* 00000260-00000300 .text _draw__12daObjVmsdz_cFv */ -BOOL daObjVmsdz_c::_draw() { - /* Nonmatching */ +bool daObjVmsdz_c::_draw() { + g_env_light.settingTevStruct(TEV_TYPE_BG0, ¤t.pos, &tevStr); + g_env_light.setLightTevColorType(mModel, &tevStr); + dComIfGd_setListBG(); + mDoExt_modelUpdateDL(mModel); + dComIfGd_setList(); + return true; } namespace { /* 00000300-00000320 .text Mthd_Create__27@unnamed@d_a_obj_vmsdz_cpp@FPv */ -void Mthd_Create(void*) { - /* Nonmatching */ +s32 Mthd_Create(void* i_ac) { + return ((daObjVmsdz_c*)i_ac)->_create(); } /* 00000320-00000344 .text Mthd_Delete__27@unnamed@d_a_obj_vmsdz_cpp@FPv */ -void Mthd_Delete(void*) { - /* Nonmatching */ +BOOL Mthd_Delete(void* i_ac) { + return ((daObjVmsdz_c*)i_ac)->_delete(); } /* 00000344-00000368 .text Mthd_Execute__27@unnamed@d_a_obj_vmsdz_cpp@FPv */ -void Mthd_Execute(void*) { - /* Nonmatching */ +BOOL Mthd_Execute(void* i_ac) { + return ((daObjVmsdz_c*)i_ac)->_execute(); } /* 00000368-0000038C .text Mthd_Draw__27@unnamed@d_a_obj_vmsdz_cpp@FPv */ -void Mthd_Draw(void*) { - /* Nonmatching */ +BOOL Mthd_Draw(void* i_ac) { + return ((daObjVmsdz_c*)i_ac)->_draw(); } /* 0000038C-00000394 .text Mthd_IsDelete__27@unnamed@d_a_obj_vmsdz_cpp@FPv */ -void Mthd_IsDelete(void*) { - /* Nonmatching */ +BOOL Mthd_IsDelete(void* i_ac) { + return TRUE; } static actor_method_class Vmsdz_Mthd_Table = { diff --git a/src/d/actor/d_a_obj_vmsms.cpp b/src/d/actor/d_a_obj_vmsms.cpp index cb38c22d0..6ab4f5051 100644 --- a/src/d/actor/d_a_obj_vmsms.cpp +++ b/src/d/actor/d_a_obj_vmsms.cpp @@ -4,72 +4,113 @@ // #include "d/actor/d_a_obj_vmsms.h" +#include "d/d_com_inf_game.h" #include "d/d_procname.h" +#include "d/res/res_vmsms.h" + +const char daObjVmsms_c::M_arcname[6] = "VmsMS"; /* 00000078-00000098 .text solidHeapCB__12daObjVmsms_cFP10fopAc_ac_c */ -void daObjVmsms_c::solidHeapCB(fopAc_ac_c*) { - /* Nonmatching */ +BOOL daObjVmsms_c::solidHeapCB(fopAc_ac_c* i_ac) { + return ((daObjVmsms_c*)i_ac)->create_heap(); } /* 00000098-0000015C .text create_heap__12daObjVmsms_cFv */ -void daObjVmsms_c::create_heap() { - /* Nonmatching */ +BOOL daObjVmsms_c::create_heap() { + J3DModelData* mdl_data; + BOOL ret = FALSE; + + mdl_data = (J3DModelData*)dComIfG_getObjectRes(M_arcname, VMSMS_BDL_VMSMS); + JUT_ASSERT(0x5b, mdl_data != NULL); + + if (mdl_data != NULL) { + mModel = mDoExt_J3DModel__create(mdl_data, 0, 0x11020203); + if (mModel != NULL) { + ret = TRUE; + } + } + + return ret; } /* 0000015C-0000021C .text _create__12daObjVmsms_cFv */ s32 daObjVmsms_c::_create() { - /* Nonmatching */ + s32 ret = cPhs_ERROR_e; + + fopAcM_SetupActor(this, daObjVmsms_c); + + if (!check_demo()) { + ret = dComIfG_resLoad(&mPhs, M_arcname); + if (ret == cPhs_COMPLEATE_e) { + ret = cPhs_ERROR_e; + if (fopAcM_entrySolidHeap(this, solidHeapCB, 0)) { + fopAcM_SetMtx(this, mModel->getBaseTRMtx()); + init_mtx(); + ret = cPhs_COMPLEATE_e; + } + } + } + + return ret; } /* 0000021C-0000024C .text _delete__12daObjVmsms_cFv */ -BOOL daObjVmsms_c::_delete() { - /* Nonmatching */ +bool daObjVmsms_c::_delete() { + dComIfG_resDelete(&mPhs, M_arcname); + return true; } /* 0000024C-0000026C .text init_mtx__12daObjVmsms_cFv */ void daObjVmsms_c::init_mtx() { - /* Nonmatching */ + mModel->setBaseScale(scale); } /* 0000026C-000002A8 .text check_demo__12daObjVmsms_cCFv */ -void daObjVmsms_c::check_demo() const { - /* Nonmatching */ +bool daObjVmsms_c::check_demo() const { + return dComIfGs_isEventBit(0x2d04); } /* 000002A8-0000030C .text _execute__12daObjVmsms_cFv */ -BOOL daObjVmsms_c::_execute() { - /* Nonmatching */ +bool daObjVmsms_c::_execute() { + if (dComIfGp_event_runCheck()) { + if (dComIfGp_evmng_startCheck("master_sword")) + fopAcM_delete(this); + } + return true; } /* 0000030C-0000036C .text _draw__12daObjVmsms_cFv */ -BOOL daObjVmsms_c::_draw() { - /* Nonmatching */ +bool daObjVmsms_c::_draw() { + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, ¤t.pos, &tevStr); + g_env_light.setLightTevColorType(mModel, &tevStr); + mDoExt_modelUpdateDL(mModel); + return true; } namespace { /* 0000036C-0000038C .text Mthd_Create__27@unnamed@d_a_obj_vmsms_cpp@FPv */ -void Mthd_Create(void*) { - /* Nonmatching */ +s32 Mthd_Create(void* i_ac) { + return ((daObjVmsms_c*)i_ac)->_create(); } /* 0000038C-000003B0 .text Mthd_Delete__27@unnamed@d_a_obj_vmsms_cpp@FPv */ -void Mthd_Delete(void*) { - /* Nonmatching */ +BOOL Mthd_Delete(void* i_ac) { + return ((daObjVmsms_c*)i_ac)->_delete(); } /* 000003B0-000003D4 .text Mthd_Execute__27@unnamed@d_a_obj_vmsms_cpp@FPv */ -void Mthd_Execute(void*) { - /* Nonmatching */ +BOOL Mthd_Execute(void* i_ac) { + return ((daObjVmsms_c*)i_ac)->_execute(); } /* 000003D4-000003F8 .text Mthd_Draw__27@unnamed@d_a_obj_vmsms_cpp@FPv */ -void Mthd_Draw(void*) { - /* Nonmatching */ +BOOL Mthd_Draw(void* i_ac) { + return ((daObjVmsms_c*)i_ac)->_draw(); } /* 000003F8-00000400 .text Mthd_IsDelete__27@unnamed@d_a_obj_vmsms_cpp@FPv */ -void Mthd_IsDelete(void*) { - /* Nonmatching */ +BOOL Mthd_IsDelete(void* i_ac) { + return TRUE; } static actor_method_class Vmsms_Mthd_Table = {