From d78a8571d101dbd513b160607797f22781e1753b Mon Sep 17 00:00:00 2001 From: Howard Luck Date: Sun, 21 Sep 2025 18:29:25 -0600 Subject: [PATCH] d_a_obj_ndoor OK (#2681) * d_a_obj_ndoor matching * fixes for taka --- configure.py | 4 +- include/d/actor/d_a_obj_ndoor.h | 15 +- src/d/actor/d_a_obj_ndoor.cpp | 327 +++++++++++++------------------- 3 files changed, 141 insertions(+), 205 deletions(-) diff --git a/configure.py b/configure.py index 97092468da4..414e6d84cca 100755 --- a/configure.py +++ b/configure.py @@ -1932,7 +1932,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_batta"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_bbox"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_bed"), - ActorRel(MatchingFor("GZ2E01"), "d_a_obj_bemos"), + ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_bemos"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_bhbridge"), # vtable order ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_bk_leaf"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_bky_rock"), @@ -2108,7 +2108,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_myogan"), ActorRel(NonMatching, "d_a_obj_nagaisu"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_nan"), - ActorRel(NonMatching, "d_a_obj_ndoor"), + ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_ndoor"), ActorRel(NonMatching, "d_a_obj_nougu"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_octhashi"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_oiltubo"), diff --git a/include/d/actor/d_a_obj_ndoor.h b/include/d/actor/d_a_obj_ndoor.h index 369e2d4cd81..b578644d138 100644 --- a/include/d/actor/d_a_obj_ndoor.h +++ b/include/d/actor/d_a_obj_ndoor.h @@ -1,6 +1,8 @@ #ifndef D_A_OBJ_NDOOR_H #define D_A_OBJ_NDOOR_H +#include "d/d_cc_d.h" +#include "d/d_cc_uty.h" #include "f_op/f_op_actor_mng.h" /** @@ -12,11 +14,18 @@ * */ class obj_ndoor_class : public fopAc_ac_c { -private: - /* 0x568 */ u8 field_0x568[0x718 - 0x568]; +public: + /* 0x568 */ request_of_phase_process_class mPhase; + /* 0x570 */ J3DModel* mpModel; + /* 0x574 */ s16 field_0x574; + /* 0x576 */ s16 field_0x576; + /* 0x578 */ s16 field_0x578; + /* 0x57C */ f32 field_0x57c; + /* 0x580 */ dCcD_Stts mStts; + /* 0x5BC */ dCcD_Sph mSph; + /* 0x6F4 */ dCcU_AtInfo mAtInfo; }; STATIC_ASSERT(sizeof(obj_ndoor_class) == 0x718); - #endif /* D_A_OBJ_NDOOR_H */ diff --git a/src/d/actor/d_a_obj_ndoor.cpp b/src/d/actor/d_a_obj_ndoor.cpp index 1d5ac692c10..bd48eb23005 100644 --- a/src/d/actor/d_a_obj_ndoor.cpp +++ b/src/d/actor/d_a_obj_ndoor.cpp @@ -1,232 +1,159 @@ /** * @file d_a_obj_ndoor.cpp - * -*/ + * + */ #include "d/dolzel_rel.h" #include "d/actor/d_a_obj_ndoor.h" +#include "d/actor/d_a_player.h" #include "d/d_cc_d.h" +#include "d/d_s_play.h" #include "dol2asm.h" - -// -// Forward References: -// - -extern "C" static void daObj_Ndoor_Draw__FP15obj_ndoor_class(); -extern "C" static void daObj_Ndoor_Execute__FP15obj_ndoor_class(); -extern "C" static bool daObj_Ndoor_IsDelete__FP15obj_ndoor_class(); -extern "C" static void daObj_Ndoor_Delete__FP15obj_ndoor_class(); -extern "C" static void useHeapInit__FP10fopAc_ac_c(); -extern "C" static void daObj_Ndoor_Create__FP10fopAc_ac_c(); -extern "C" void __dt__8cM3dGSphFv(); -extern "C" void __dt__8cM3dGAabFv(); -extern "C" extern char const* const d_a_obj_ndoor__stringBase0; - -// -// External References: -// - -extern "C" void mDoMtx_XrotM__FPA4_fs(); -extern "C" void mDoMtx_YrotM__FPA4_fs(); -extern "C" void mDoExt_modelUpdateDL__FP8J3DModel(); -extern "C" void mDoExt_J3DModel__create__FP12J3DModelDataUlUl(); -extern "C" void __ct__10fopAc_ac_cFv(); -extern "C" void fopAcM_entrySolidHeap__FP10fopAc_ac_cPFP10fopAc_ac_c_iUl(); -extern "C" void fopAcM_searchActorDistanceXZ__FPC10fopAc_ac_cPC10fopAc_ac_c(); -extern "C" void dComIfG_resLoad__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfG_resDelete__FP30request_of_phase_process_classPCc(); -extern "C" void getRes__14dRes_control_cFPCclP11dRes_info_ci(); -extern "C" void __ct__10dCcD_GSttsFv(); -extern "C" void Init__9dCcD_SttsFiiP10fopAc_ac_c(); -extern "C" void __ct__12dCcD_GObjInfFv(); -extern "C" void ChkTgHit__12dCcD_GObjInfFv(); -extern "C" void GetTgHitObj__12dCcD_GObjInfFv(); -extern "C" void Set__8dCcD_SphFRC11dCcD_SrcSph(); -extern "C" void at_power_check__FP11dCcU_AtInfo(); -extern "C" void settingTevStruct__18dScnKy_env_light_cFiP4cXyzP12dKy_tevstr_c(); -extern "C" void setLightTevColorType_MAJI__18dScnKy_env_light_cFP12J3DModelDataP12dKy_tevstr_c(); -extern "C" void Set__4cCcSFP8cCcD_Obj(); -extern "C" void SetC__8cM3dGSphFRC4cXyz(); -extern "C" void SetR__8cM3dGSphFf(); -extern "C" void cLib_addCalc0__FPfff(); -extern "C" void __dl__FPv(); -extern "C" extern void* __vt__8dCcD_Sph[36]; -extern "C" extern void* __vt__9dCcD_Stts[11]; -extern "C" extern void* __vt__12cCcD_SphAttr[25]; -extern "C" extern void* __vt__14cCcD_ShapeAttr[22]; -extern "C" extern void* __vt__9cCcD_Stts[8]; -extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" u8 sincosTable___5JMath[65536]; - -// -// Declarations: -// - /* 80CA3538-80CA359C 000078 0064+00 1/0 0/0 0/0 .text daObj_Ndoor_Draw__FP15obj_ndoor_class */ -static void daObj_Ndoor_Draw(obj_ndoor_class* param_0) { - // NONMATCHING +static int daObj_Ndoor_Draw(obj_ndoor_class* i_this) { + g_env_light.settingTevStruct(0x10, &i_this->current.pos, &i_this->tevStr); + g_env_light.setLightTevColorType_MAJI(i_this->mpModel, &i_this->tevStr); + mDoExt_modelUpdateDL(i_this->mpModel); + return 1; } -/* ############################################################################################## */ -/* 80CA3A44-80CA3A48 000000 0004+00 1/1 0/0 0/0 .rodata @3831 */ -SECTION_RODATA static f32 const lit_3831 = 350.0f; -COMPILER_STRIP_GATE(0x80CA3A44, &lit_3831); - -/* 80CA3A48-80CA3A4C 000004 0004+00 0/1 0/0 0/0 .rodata @3832 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3832 = 2500.0f; -COMPILER_STRIP_GATE(0x80CA3A48, &lit_3832); -#pragma pop - -/* 80CA3A4C-80CA3A50 000008 0004+00 0/1 0/0 0/0 .rodata @3833 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3833 = 25.0f; -COMPILER_STRIP_GATE(0x80CA3A4C, &lit_3833); -#pragma pop - -/* 80CA3A50-80CA3A54 00000C 0004+00 0/1 0/0 0/0 .rodata @3834 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3834 = 27000.0f; -COMPILER_STRIP_GATE(0x80CA3A50, &lit_3834); -#pragma pop - -/* 80CA3A54-80CA3A58 000010 0004+00 0/1 0/0 0/0 .rodata @3835 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3835 = 30.0f; -COMPILER_STRIP_GATE(0x80CA3A54, &lit_3835); -#pragma pop - -/* 80CA3A58-80CA3A5C 000014 0004+00 0/1 0/0 0/0 .rodata @3836 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3836 = 1.0f / 20.0f; -COMPILER_STRIP_GATE(0x80CA3A58, &lit_3836); -#pragma pop - -/* 80CA3A5C-80CA3A64 000018 0004+04 0/1 0/0 0/0 .rodata @3837 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3837[1 + 1 /* padding */] = { - 500.0f, - /* padding */ - 0.0f, -}; -COMPILER_STRIP_GATE(0x80CA3A5C, &lit_3837); -#pragma pop - -/* 80CA3A64-80CA3A6C 000020 0008+00 0/1 0/0 0/0 .rodata @3839 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3839[8] = { - 0x43, 0x30, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80CA3A64, &lit_3839); -#pragma pop - /* 80CA359C-80CA37A4 0000DC 0208+00 2/1 0/0 0/0 .text daObj_Ndoor_Execute__FP15obj_ndoor_class */ -static void daObj_Ndoor_Execute(obj_ndoor_class* param_0) { - // NONMATCHING +static int daObj_Ndoor_Execute(obj_ndoor_class* i_this) { + cXyz cStack_28; + + if (daPy_getPlayerActorClass()->checkFrontRollCrash() && + fopAcM_searchPlayerDistanceXZ(i_this) < 350.0f) + { + i_this->field_0x567 = 1; + } + + if (i_this->field_0x576 == 0 && i_this->mSph.ChkTgHit()) { + i_this->mAtInfo.mpCollider = i_this->mSph.GetTgHitObj(); + at_power_check(&i_this->mAtInfo); + + if (i_this->mAtInfo.mAttackPower <= 1) { + i_this->field_0x567 = 1; + } else { + i_this->field_0x567 = 2; + } + } + + if (i_this->field_0x567 != 0) { + f32 tmp = ZREG_F(6) + 2500.0f; + i_this->field_0x57c = tmp * i_this->field_0x567; + i_this->field_0x578 = 0; + i_this->field_0x567 = 0; + } + + i_this->shape_angle.x = + i_this->field_0x57c * cM_ssin(i_this->field_0x578 * (ZREG_S(2) + 0x1000)); + mDoMtx_stack_c::transS(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z); + mDoMtx_stack_c::YrotM(i_this->shape_angle.y); + mDoMtx_stack_c::XrotM(i_this->shape_angle.x); + i_this->mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); + cStack_28 = i_this->current.pos; + cStack_28.y -= ZREG_F(7) + 25.0f; + + if (i_this->field_0x576 != 0) { + i_this->field_0x576--; + cStack_28.y -= 27000.0f; + } + + i_this->mSph.SetC(cStack_28); + i_this->mSph.SetR(ZREG_F(8) + 30.0f); + dComIfG_Ccsp()->Set(&i_this->mSph); + i_this->field_0x578++; + cLib_addCalc0(&i_this->field_0x57c, 0.05f, (ZREG_F(5) + 500.0f)); + return 1; } /* 80CA37A4-80CA37AC 0002E4 0008+00 1/0 0/0 0/0 .text daObj_Ndoor_IsDelete__FP15obj_ndoor_class */ -static bool daObj_Ndoor_IsDelete(obj_ndoor_class* param_0) { - return true; +static int daObj_Ndoor_IsDelete(obj_ndoor_class* i_this) { + return 1; } -/* ############################################################################################## */ -/* 80CA3A6C-80CA3A6C 000028 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80CA3A6C = "Obj_ndoor"; -#pragma pop - /* 80CA37AC-80CA37DC 0002EC 0030+00 1/0 0/0 0/0 .text daObj_Ndoor_Delete__FP15obj_ndoor_class */ -static void daObj_Ndoor_Delete(obj_ndoor_class* param_0) { - // NONMATCHING +static int daObj_Ndoor_Delete(obj_ndoor_class* i_this) { + fopAcM_GetID(i_this); + dComIfG_resDelete(&i_this->mPhase, "Obj_ndoor"); + return 1; } /* 80CA37DC-80CA3848 00031C 006C+00 1/1 0/0 0/0 .text useHeapInit__FP10fopAc_ac_c */ -static void useHeapInit(fopAc_ac_c* param_0) { - // NONMATCHING +static int useHeapInit(fopAc_ac_c* i_this) { + obj_ndoor_class* a_this = (obj_ndoor_class*)i_this; + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Obj_ndoor", 3); + + if (modelData == NULL) { + JUT_ASSERT(305, modelData != 0); + } + + a_this->mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + return a_this->mpModel != NULL ? 1 : 0; } -/* ############################################################################################## */ -/* 80CA3A78-80CA3AB8 000000 0040+00 1/1 0/0 0/0 .data cc_sph_src$3869 */ -static dCcD_SrcSph cc_sph_src = { - { - {0x0, {{0x0, 0x0, 0x0}, {0xd8fbfdff, 0x3}, 0x0}}, // mObj - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg - {0x0}, // mGObjCo - }, // mObjInf - { - {{0.0f, 0.0f, 0.0f}, 40.0f} // mSph - } // mSphAttr -}; +/* 80CA3848-80CA39AC 000388 0164+00 1/0 0/0 0/0 .text daObj_Ndoor_Create__FP10fopAc_ac_c + */ +static int daObj_Ndoor_Create(fopAc_ac_c* i_this) { + static dCcD_SrcSph cc_sph_src = { + { + {0x0, {{0x0, 0x0, 0x0}, {0xd8fbfdff, 0x3}, 0x0}}, // mObj + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg + {0x0}, // mGObjCo + }, // mObjInf + { + {{0.0f, 0.0f, 0.0f}, 40.0f} // mSph + } // mSphAttr + }; + + obj_ndoor_class* a_this = (obj_ndoor_class*)i_this; + fopAcM_SetupActor(i_this, obj_ndoor_class); + cPhs__Step phase = (cPhs__Step)dComIfG_resLoad(&a_this->mPhase, "Obj_ndoor"); + + if (phase == cPhs_COMPLEATE_e) { + OS_REPORT("OBJ_NDOOR PARAM %x\n", fopAcM_GetParam(a_this)); + OS_REPORT("OBJ_NDOOR//////////////OBJ_NDOOR SET 1 !!\n"); + + if (fopAcM_entrySolidHeap(i_this, useHeapInit, 0x820) == false) { + OS_REPORT("//////////////OBJ_NDOOR SET NON !!\n"); + return cPhs_ERROR_e; + } + + OS_REPORT("//////////////OBJ_NDOOR SET 2 !!\n"); + a_this->mStts.Init(0xff, 0, a_this); + a_this->mSph.Set(cc_sph_src); + a_this->mSph.SetStts(&a_this->mStts); + fopAcM_SetMtx(a_this, a_this->mpModel->getBaseTRMtx()); + daObj_Ndoor_Execute(a_this); + } + + return phase; +} /* 80CA3AB8-80CA3AD8 -00001 0020+00 1/0 0/0 0/0 .data l_daObj_Ndoor_Method */ static actor_method_class l_daObj_Ndoor_Method = { - (process_method_func)daObj_Ndoor_Create__FP10fopAc_ac_c, - (process_method_func)daObj_Ndoor_Delete__FP15obj_ndoor_class, - (process_method_func)daObj_Ndoor_Execute__FP15obj_ndoor_class, - (process_method_func)daObj_Ndoor_IsDelete__FP15obj_ndoor_class, - (process_method_func)daObj_Ndoor_Draw__FP15obj_ndoor_class, + (process_method_func)daObj_Ndoor_Create, (process_method_func)daObj_Ndoor_Delete, + (process_method_func)daObj_Ndoor_Execute, (process_method_func)daObj_Ndoor_IsDelete, + (process_method_func)daObj_Ndoor_Draw, }; /* 80CA3AD8-80CA3B08 -00001 0030+00 0/0 0/0 1/0 .data g_profile_OBJ_NDOOR */ extern actor_process_profile_definition g_profile_OBJ_NDOOR = { - fpcLy_CURRENT_e, // mLayerID - 7, // mListID - fpcPi_CURRENT_e, // mListPrio - PROC_OBJ_NDOOR, // mProcName - &g_fpcLf_Method.base, // sub_method - sizeof(obj_ndoor_class), // mSize - 0, // mSizeOther - 0, // mParameters - &g_fopAc_Method.base, // sub_method - 76, // mPriority - &l_daObj_Ndoor_Method, // sub_method - 0x00040100, // mStatus - fopAc_ACTOR_e, // mActorType - fopAc_CULLBOX_0_e, // cullType + fpcLy_CURRENT_e, // mLayerID + 7, // mListID + fpcPi_CURRENT_e, // mListPrio + PROC_OBJ_NDOOR, // mProcName + &g_fpcLf_Method.base, // sub_method + sizeof(obj_ndoor_class), // mSize + 0, // mSizeOther + 0, // mParameters + &g_fopAc_Method.base, // sub_method + 76, // mPriority + &l_daObj_Ndoor_Method, // sub_method + 0x00040100, // mStatus + fopAc_ACTOR_e, // mActorType + fopAc_CULLBOX_0_e, // cullType }; - -/* 80CA3B08-80CA3B14 000090 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGSph */ -SECTION_DATA extern void* __vt__8cM3dGSph[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGSphFv, -}; - -/* 80CA3B14-80CA3B20 00009C 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGAab */ -SECTION_DATA extern void* __vt__8cM3dGAab[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGAabFv, -}; - -/* 80CA3848-80CA39AC 000388 0164+00 1/0 0/0 0/0 .text daObj_Ndoor_Create__FP10fopAc_ac_c - */ -static void daObj_Ndoor_Create(fopAc_ac_c* param_0) { - // NONMATCHING -} - -/* 80CA39AC-80CA39F4 0004EC 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGSphFv */ -// cM3dGSph::~cM3dGSph() { -extern "C" void __dt__8cM3dGSphFv() { - // NONMATCHING -} - -/* 80CA39F4-80CA3A3C 000534 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGAabFv */ -// cM3dGAab::~cM3dGAab() { -extern "C" void __dt__8cM3dGAabFv() { - // NONMATCHING -} - -/* 80CA3A6C-80CA3A6C 000028 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */