diff --git a/configure.py b/configure.py index b5bb14c5de2..4c21fe06882 100755 --- a/configure.py +++ b/configure.py @@ -2042,7 +2042,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01"), "d_a_obj_maki"), ActorRel(NonMatching, "d_a_obj_master_sword"), ActorRel(NonMatching, "d_a_obj_mato"), - ActorRel(NonMatching, "d_a_obj_mhole"), + ActorRel(MatchingFor("GZ2E01"), "d_a_obj_mhole"), ActorRel(NonMatching, "d_a_obj_mie"), ActorRel(MatchingFor("GZ2E01"), "d_a_obj_mirror_6pole"), ActorRel(NonMatching, "d_a_obj_mirror_chain"), diff --git a/include/d/actor/d_a_obj_mhole.h b/include/d/actor/d_a_obj_mhole.h index db1bff36605..44e1aea6f08 100644 --- a/include/d/actor/d_a_obj_mhole.h +++ b/include/d/actor/d_a_obj_mhole.h @@ -1,6 +1,7 @@ #ifndef D_A_OBJ_MHOLE_H #define D_A_OBJ_MHOLE_H +#include "d/d_cc_d.h" #include "f_op/f_op_actor_mng.h" /** @@ -13,27 +14,57 @@ */ class daObjMHole_c : public fopAc_ac_c { public: + enum EFF_ID_e { + EFF_LARGE_e, + EFF_SMALL_e + }; + /* 80C92FD8 */ void initBaseMtx(); /* 80C93014 */ void setBaseMtx(); - /* 80C9307C */ void Create(); - /* 80C93198 */ void checkParent(); - /* 80C93204 */ void CreateHeap(); - /* 80C934E0 */ void create(); - /* 80C936A8 */ void execute(); + /* 80C9307C */ int Create(); + /* 80C93198 */ int checkParent(); + /* 80C93204 */ int CreateHeap(); + /* 80C934E0 */ int create(); + /* 80C936A8 */ int execute(); /* 80C93928 */ void effectSet(); /* 80C93A88 */ void effectEnd(); - /* 80C93ADC */ void draw(); - /* 80C93CAC */ void _delete(); + /* 80C93ADC */ int draw(); + /* 80C93CAC */ int _delete(); void setOn() { mIsOn = TRUE; } + u8 getType() { return fopAcM_GetParamBit(this, 8, 4); } + u8 getKind() { return fopAcM_GetParamBit(this, 12, 4); } + u8 getSwbit() { return fopAcM_GetParamBit(this, 0, 8); } private: - /* 0x568 */ u8 field_0x568[0x700 - 0x568]; - /* 0x700 */ bool mIsOn; - /* 0x701 */ u8 field_0x701[0x734 - 0x701]; + /* 0x568 */ request_of_phase_process_class mPhase; + /* 0x570 */ J3DModel* mpModel; + /* 0x574 */ mDoExt_brkAnm* mpBrkAnm; + /* 0x574 */ mDoExt_btkAnm* mpBtk1Anm; + /* 0x57C */ mDoExt_btkAnm* mpBtk2Anm; + /* 0x580 */ dCcD_Stts mStts; + /* 0x5BC */ dCcD_Cps mCps; + /* 0x700 */ u8 mIsOn; + /* 0x701 */ u8 field_0x701; // Value set to mIsOn, but never used + /* 0x702 */ u8 mKind; + /* 0x704 */ JPABaseEmitter* mpEmitter[4]; + /* 0x714 */ Z2SoundObjSimple mSound; }; STATIC_ASSERT(sizeof(daObjMHole_c) == 0x734); +class daObjMHole_HIO_c : public mDoHIO_entry_c { +public: + /* 80C55D0C */ daObjMHole_HIO_c(); + /* 80C56970 */ ~daObjMHole_HIO_c() {} + + void genMessage(JORMContext*); + + /* 0x08 */ cXyz scale; + /* 0x14 */ u8 scale_adjust_on; + /* 0x15 */ u8 collision_display; + /* 0x16 */ u8 angle; + /* 0x18 */ csXyz angl; +}; #endif /* D_A_OBJ_MHOLE_H */ diff --git a/src/d/actor/d_a_obj_mhole.cpp b/src/d/actor/d_a_obj_mhole.cpp index 3ed10136114..d959441ac9c 100644 --- a/src/d/actor/d_a_obj_mhole.cpp +++ b/src/d/actor/d_a_obj_mhole.cpp @@ -1,418 +1,429 @@ /** * @file d_a_obj_mhole.cpp - * -*/ + * + */ #include "d/actor/d_a_obj_mhole.h" #include "d/d_cc_d.h" -#include "dol2asm.h" - - -// -// Forward References: -// - -extern "C" static void searchParentSub__FPvPv(); -extern "C" static void CheckCreateHeap__FP10fopAc_ac_c(); -extern "C" void initBaseMtx__12daObjMHole_cFv(); -extern "C" void setBaseMtx__12daObjMHole_cFv(); -extern "C" void Create__12daObjMHole_cFv(); -extern "C" void checkParent__12daObjMHole_cFv(); -extern "C" void CreateHeap__12daObjMHole_cFv(); -extern "C" void __dt__12J3DFrameCtrlFv(); -extern "C" void create__12daObjMHole_cFv(); -extern "C" void __dt__8cM3dGAabFv(); -extern "C" void execute__12daObjMHole_cFv(); -extern "C" void effectSet__12daObjMHole_cFv(); -extern "C" void effectEnd__12daObjMHole_cFv(); -extern "C" void draw__12daObjMHole_cFv(); -extern "C" void _delete__12daObjMHole_cFv(); -extern "C" static void daObjMHole_Draw__FP12daObjMHole_c(); -extern "C" static void daObjMHole_Execute__FP12daObjMHole_c(); -extern "C" static void daObjMHole_Delete__FP12daObjMHole_c(); -extern "C" static void daObjMHole_Create__FP10fopAc_ac_c(); -extern "C" extern char const* const d_a_obj_mhole__stringBase0; - -// -// External References: -// - -extern "C" void transS__14mDoMtx_stack_cFRC4cXyz(); -extern "C" void ZXYrotM__14mDoMtx_stack_cFRC5csXyz(); -extern "C" void play__14mDoExt_baseAnmFv(); -extern "C" void init__13mDoExt_btkAnmFP16J3DMaterialTableP19J3DAnmTextureSRTKeyiifss(); -extern "C" void entry__13mDoExt_btkAnmFP16J3DMaterialTablef(); -extern "C" void init__13mDoExt_brkAnmFP16J3DMaterialTableP15J3DAnmTevRegKeyiifss(); -extern "C" void entry__13mDoExt_brkAnmFP16J3DMaterialTablef(); -extern "C" void mDoExt_modelUpdateDL__FP8J3DModel(); -extern "C" void mDoExt_btkAnmRemove__FP12J3DModelData(); -extern "C" void mDoExt_brkAnmRemove__FP12J3DModelData(); -extern "C" void mDoExt_J3DModel__create__FP12J3DModelDataUlUl(); -extern "C" void __ct__10fopAc_ac_cFv(); -extern "C" void fopAc_IsActor__FPv(); -extern "C" void fopAcIt_Judge__FPFPvPv_PvPv(); -extern "C" void fopAcM_entrySolidHeap__FP10fopAc_ac_cPFP10fopAc_ac_c_iUl(); -extern "C" void fopAcM_setCullSizeBox2__FP10fopAc_ac_cP12J3DModelData(); -extern "C" void fpcEx_Search__FPFPvPv_PvPv(); -extern "C" void fpcSch_JudgeByID__FPvPv(); -extern "C" void dComIfG_resLoad__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfG_resDelete__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfGp_getReverb__Fi(); -extern "C" void isSwitch__10dSv_info_cCFii(); -extern "C" void getRes__14dRes_control_cFPCclP11dRes_info_ci(); -extern "C" void -set__13dPa_control_cFUcUsPC4cXyzPC12dKy_tevstr_cPC5csXyzPC4cXyzUcP18dPa_levelEcallBackScPC8_GXColorPC8_GXColorPC4cXyzf(); -extern "C" void dKyw_get_wind_vec__Fv(); -extern "C" void __ct__10dCcD_GSttsFv(); -extern "C" void Init__9dCcD_SttsFiiP10fopAc_ac_c(); -extern "C" void __ct__12dCcD_GObjInfFv(); -extern "C" void Set__8dCcD_CpsFRC11dCcD_SrcCps(); -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 __mi__4cXyzCFRC3Vec(); -extern "C" void __ct__8cM3dGCpsFv(); -extern "C" void Set__8cM3dGCpsFRC4cXyzRC4cXyzf(); -extern "C" void JPAGetXYZRotateMtx__FsssPA4_f(); -extern "C" void deleteObject__14Z2SoundObjBaseFv(); -extern "C" void __ct__16Z2SoundObjSimpleFv(); -extern "C" void* __nw__FUl(); -extern "C" void __dl__FPv(); -extern "C" void setEffectMtx__13J3DTexMtxInfoFPA4_f(); -extern "C" void simpleCalcMaterial__12J3DModelDataFUsPA4_f(); -extern "C" void init__12J3DFrameCtrlFs(); -extern "C" void _savegpr_25(); -extern "C" void _savegpr_26(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_25(); -extern "C" void _restgpr_26(); -extern "C" void _restgpr_29(); -extern "C" extern void* __vt__8dCcD_Cps[36]; -extern "C" extern void* __vt__9dCcD_Stts[11]; -extern "C" extern void* __vt__12cCcD_CpsAttr[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" extern u8 g_dComIfG_gameInfo[122384]; - -// -// Declarations: -// +#include "d/d_com_inf_game.h" +#include "d/d_debug_viewer.h" +#include "m_Do/m_Do_graphic.h" /* ############################################################################################## */ /* 80C93D88-80C93D90 000000 0008+00 5/5 0/0 0/0 .rodata l_bmd */ -SECTION_RODATA static u8 const l_bmd[8] = { - 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x05, -}; -COMPILER_STRIP_GATE(0x80C93D88, &l_bmd); +static u32 const l_bmd[2] = {5, 5}; /* 80C93D90-80C93D98 000008 0008+00 0/1 0/0 0/0 .rodata l_brk */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const l_brk[8] = { - 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, -}; -COMPILER_STRIP_GATE(0x80C93D90, &l_brk); -#pragma pop +static u32 const l_brk[2] = {8, 8}; /* 80C93D98-80C93DA0 000010 0008+00 0/1 0/0 0/0 .rodata l_btk1 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const l_btk1[8] = { - 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x0B, -}; -COMPILER_STRIP_GATE(0x80C93D98, &l_btk1); -#pragma pop +static u32 const l_btk1[2] = {11, 11}; /* 80C93DA0-80C93DA8 000018 0008+00 0/1 0/0 0/0 .rodata l_btk2 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const l_btk2[8] = { - 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, -}; -COMPILER_STRIP_GATE(0x80C93DA0, &l_btk2); -#pragma pop +static u32 const l_btk2[2] = {12, 12}; /* 80C93DA8-80C93DB0 000020 0008+00 0/1 0/0 0/0 .rodata l_length */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const l_length[8] = { - 0x44, 0xFA, 0x00, 0x00, 0x44, 0x7A, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80C93DA8, &l_length); -#pragma pop +static f32 const l_length[2] = {2000.0f, 1000.0f}; /* 80C93DB0-80C93DB8 000028 0008+00 0/1 0/0 0/0 .rodata l_size */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const l_size[8] = { - 0x43, 0x16, 0x00, 0x00, 0x43, 0xB9, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80C93DB0, &l_size); -#pragma pop +static f32 const l_size[2] = {150.0f, 370.0f}; -/* 80C93DB8-80C93DC0 000030 0004+04 0/4 0/0 0/0 .rodata @3656 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3656[4 + 4 /* padding */] = { - 0x00, - 0x00, - 0x00, - 0x00, - /* padding */ - 0x00, - 0x00, - 0x00, - 0x00, -}; -COMPILER_STRIP_GATE(0x80C93DB8, &lit_3656); -#pragma pop +/* 80C93E14-80C93E1C -00001 0008+00 3/3 0/0 0/0 .data l_arcName */ +static char const* l_arcName[2] = {"ef_MgnF_L", "ef_MgnF_S"}; -/* 80C93DC0-80C93DC8 000038 0008+00 0/1 0/0 0/0 .rodata @3657 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3657[8] = { - 0x3F, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +/* 80C93E1C-80C93E68 000008 004C+00 1/1 0/0 0/0 .data l_cps_src */ +dCcD_SrcCps l_cps_src = { + { + {0x0, {{AT_TYPE_40000, 0x0, 0x1d}, {0x0, 0x0}, 0x0}}, // mObj + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x6}, // mGObjAt + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x4}, // mGObjTg + {0x0}, // mGObjCo + }, // mObjInf + { + {{0.0f, 0.0f, 0.0f}, {0.0f, 1000.0f, 0.0f}, 150.0f}, // mCps + } // mCpsAttr }; -COMPILER_STRIP_GATE(0x80C93DC0, &lit_3657); -#pragma pop -/* 80C93DC8-80C93DD0 000040 0008+00 0/1 0/0 0/0 .rodata @3658 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3658[8] = { - 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80C93DC8, &lit_3658); -#pragma pop +#ifdef DEBUG +static daObjMHole_HIO_c l_HIO; -/* 80C93DD0-80C93DD8 000048 0008+00 0/1 0/0 0/0 .rodata @3659 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3659[8] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80C93DD0, &lit_3659); -#pragma pop +daObjMHole_HIO_c::daObjMHole_HIO_c() { + scale.set(1.0f, 1.0f, 1.0f); + scale_adjust_on = 0x0; + collision_display = 0x0; + angle = 0x0; + angl.set(0, 0, 0); +} -/* 80C93DD8-80C93DE0 000050 0004+04 0/1 0/0 0/0 .rodata @3660 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3660[1 + 1 /* padding */] = { - 10.0f, - /* padding */ - 0.0f, -}; -COMPILER_STRIP_GATE(0x80C93DD8, &lit_3660); -#pragma pop +void daObjMHole_HIO_c::genMessage(JORMContext* mctx) { + mctx->genLabel("マグネホール", 0, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 24); + mctx->genCheckBox("スケール調整ON", &scale_adjust_on, 0x1, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 24); + mctx->genSlider("Xスケール", &scale.x, 0.1f, 10.0f, 0, NULL, 0xffff, 0xffff, 0x200, 24); + mctx->genSlider("Yスケール", &scale.y, 0.1f, 10.0f, 0, NULL, 0xffff, 0xffff, 0x200, 24); + mctx->genSlider("Zスケール", &scale.z, 0.1f, 10.0f, 0, NULL, 0xffff, 0xffff, 0x200, 24); + mctx->genCheckBox("当たり表示", &collision_display, 0x1, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 24); + mctx->genCheckBox("アングル", &angle, 0x1, 0, NULL, 0xFFFF, 0xFFFF, 0x200, 24); + mctx->genSlider("X", &angl.x, -0x7FFF, 0x7FFF, 0, NULL, 0xffff, 0xffff, 0x200, 24); + mctx->genSlider("Y", &angl.y, -0x7FFF, 0x7FFF, 0, NULL, 0xffff, 0xffff, 0x200, 24); + mctx->genSlider("Z", &angl.z, -0x7FFF, 0x7FFF, 0, NULL, 0xffff, 0xffff, 0x200, 24); +} +#endif /* 80C92E58-80C92FB8 000078 0160+00 1/1 0/0 0/0 .text searchParentSub__FPvPv */ -static void searchParentSub(void* param_0, void* param_1) { - // NONMATCHING +static void* searchParentSub(void* i_magLift, void* i_mhole) { + daObjMHole_c* mhole = (daObjMHole_c*)i_mhole; + fopAc_ac_c* mag_lift = (fopAc_ac_c*)i_magLift; + + if (mag_lift != NULL && fopAcM_IsActor(mag_lift) && + fopAcM_GetProfName(mag_lift) == PROC_Obj_MagLift && + mag_lift->home.pos.abs(mhole->home.pos) < 10.0f) + { + return mag_lift; + } + + return NULL; } /* 80C92FB8-80C92FD8 0001D8 0020+00 1/1 0/0 0/0 .text CheckCreateHeap__FP10fopAc_ac_c */ -static void CheckCreateHeap(fopAc_ac_c* param_0) { - // NONMATCHING +static int CheckCreateHeap(fopAc_ac_c* p_actor) { + return static_cast(p_actor)->CreateHeap(); } /* 80C92FD8-80C93014 0001F8 003C+00 1/1 0/0 0/0 .text initBaseMtx__12daObjMHole_cFv */ void daObjMHole_c::initBaseMtx() { - // NONMATCHING + mpModel->setBaseScale(scale); + setBaseMtx(); } /* 80C93014-80C9307C 000234 0068+00 2/2 0/0 0/0 .text setBaseMtx__12daObjMHole_cFv */ void daObjMHole_c::setBaseMtx() { - // NONMATCHING +#ifdef DEBUG + if (l_HIO.scale_adjust_on != 0) { + scale = l_HIO.scale; + } + if (l_HIO.angle != 0) { + current.angle = l_HIO.angl; + shape_angle = current.angle; + } +#endif + + mpModel->setBaseScale(scale); + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::ZXYrotM(shape_angle); + mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); } -/* ############################################################################################## */ -/* 80C93DE0-80C93DE8 000058 0008+00 1/1 0/0 0/0 .rodata @3724 */ -SECTION_RODATA static u8 const lit_3724[8] = { - 0x43, 0x30, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80C93DE0, &lit_3724); - -/* 80C93E00-80C93E00 000078 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80C93E00 = "ef_MgnF_L"; -SECTION_DEAD static char const* const stringBase_80C93E0A = "ef_MgnF_S"; -#pragma pop - -/* 80C93E14-80C93E1C -00001 0008+00 3/3 0/0 0/0 .data l_arcName */ -SECTION_DATA static void* l_arcName[2] = { - (void*)&d_a_obj_mhole__stringBase0, - (void*)(((char*)&d_a_obj_mhole__stringBase0) + 0xA), -}; - -/* 80C93E1C-80C93E68 000008 004C+00 1/1 0/0 0/0 .data l_cps_src */ -static dCcD_SrcCps l_cps_src = { - { - {0x0, {{AT_TYPE_40000, 0x0, 0x1d}, {0x0, 0x0}, 0x0}}, // mObj - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x6}, // mGObjAt - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x4}, // mGObjTg - {0x0}, // mGObjCo - }, // mObjInf - { - {{0.0f, 0.0f, 0.0f}, {0.0f, 1000.0f, 0.0f}, 150.0f}, // mCps - } // mCpsAttr -}; - /* 80C9307C-80C93198 00029C 011C+00 1/1 0/0 0/0 .text Create__12daObjMHole_cFv */ -void daObjMHole_c::Create() { - // NONMATCHING +int daObjMHole_c::Create() { + if (getType() != 0x2) { + u8 sw_bit = getSwbit(); + u8 state = TRUE; + if (sw_bit != 0xFF && !fopAcM_isSwitch(this, sw_bit)) { + state = FALSE; + } + mIsOn = state; + } + if (mIsOn) { + mpBtk2Anm->setFrame(mpBtk2Anm->getEndFrame()); + } + + initBaseMtx(); + fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); + fopAcM_setCullSizeBox2(this, mpModel->getModelData()); + + mStts.Init(0xFF, 0xFF, this); + mCps.Set(l_cps_src); + mCps.SetStts(&mStts); + mSound.init(¤t.pos, 1); + + return 1; } /* 80C93198-80C93204 0003B8 006C+00 1/1 0/0 0/0 .text checkParent__12daObjMHole_cFv */ -void daObjMHole_c::checkParent() { - // NONMATCHING +int daObjMHole_c::checkParent() { + parentActorID = fopAcM_GetID(fpcM_Search(searchParentSub, this)); + if (parentActorID == fpcM_ERROR_PROCESS_ID_e) { + return FALSE; + } + return TRUE; } /* ############################################################################################## */ -/* 80C93DE8-80C93DEC 000060 0004+00 0/4 0/0 0/0 .rodata @3823 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3823 = 1.0f; -COMPILER_STRIP_GATE(0x80C93DE8, &lit_3823); -#pragma pop - -/* 80C93E68-80C93E88 -00001 0020+00 1/0 0/0 0/0 .data l_daObjMHole_Method */ -static actor_method_class l_daObjMHole_Method = { - (process_method_func)daObjMHole_Create__FP10fopAc_ac_c, - (process_method_func)daObjMHole_Delete__FP12daObjMHole_c, - (process_method_func)daObjMHole_Execute__FP12daObjMHole_c, - 0, - (process_method_func)daObjMHole_Draw__FP12daObjMHole_c, -}; - -/* 80C93E88-80C93EB8 -00001 0030+00 0/0 0/0 1/0 .data g_profile_Obj_MHole */ -extern actor_process_profile_definition g_profile_Obj_MHole = { - fpcLy_CURRENT_e, // mLayerID - 7, // mListID - fpcPi_CURRENT_e, // mListPrio - PROC_Obj_MHole, // mProcName - &g_fpcLf_Method.base, // sub_method - sizeof(daObjMHole_c), // mSize - 0, // mSizeOther - 0, // mParameters - &g_fopAc_Method.base, // sub_method - 589, // mPriority - &l_daObjMHole_Method, // sub_method - 0x00040100, // mStatus - fopAc_ACTOR_e, // mActorType - fopAc_CULLBOX_CUSTOM_e, // cullType -}; - -/* 80C93EB8-80C93EC4 0000A4 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, -}; - -/* 80C93EC4-80C93ED0 0000B0 000C+00 2/2 0/0 0/0 .data __vt__12J3DFrameCtrl */ -SECTION_DATA extern void* __vt__12J3DFrameCtrl[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12J3DFrameCtrlFv, -}; - /* 80C93204-80C93498 000424 0294+00 1/1 0/0 0/0 .text CreateHeap__12daObjMHole_cFv */ -void daObjMHole_c::CreateHeap() { - // NONMATCHING -} +int daObjMHole_c::CreateHeap() { + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName[mKind], l_bmd[mKind]); + JUT_ASSERT(336, modelData != 0); + mpModel = mDoExt_J3DModel__create(modelData, 0, 0x19000284); + if (mpModel == NULL) { + return FALSE; + } -/* 80C93498-80C934E0 0006B8 0048+00 1/0 0/0 0/0 .text __dt__12J3DFrameCtrlFv */ -// J3DFrameCtrl::~J3DFrameCtrl() { -extern "C" void __dt__12J3DFrameCtrlFv() { - // NONMATCHING + J3DAnmTevRegKey* pbrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName[mKind], l_brk[mKind]); + JUT_ASSERT(360, pbrk != 0); + mpBrkAnm = new mDoExt_brkAnm(); + if (mpBrkAnm == NULL || + !mpBrkAnm->init(modelData, pbrk, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1)) + { + return FALSE; + } + mpBrkAnm->setPlaySpeed(1.0f); + + { + J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName[mKind], l_btk1[mKind]); + JUT_ASSERT(375, pbtk != 0); + mpBtk1Anm = new mDoExt_btkAnm(); + if (mpBtk1Anm == NULL || + !mpBtk1Anm->init(modelData, pbtk, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1)) + { + return FALSE; + } + mpBtk1Anm->setPlaySpeed(1.0f); + } + + { + J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName[mKind], l_btk2[mKind]); + JUT_ASSERT(391, pbtk != 0); + mpBtk2Anm = new mDoExt_btkAnm(); + if (mpBtk2Anm == NULL || + !mpBtk2Anm->init(modelData, pbtk, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1)) + { + return FALSE; + } + mpBtk2Anm->setPlaySpeed(0.0f); + mpBtk2Anm->setFrame(0.0f); + } + + return TRUE; } /* 80C934E0-80C93660 000700 0180+00 1/1 0/0 0/0 .text create__12daObjMHole_cFv */ -void daObjMHole_c::create() { - // NONMATCHING -} +int daObjMHole_c::create() { + fopAcM_SetupActor(this, daObjMHole_c); -/* 80C93660-80C936A8 000880 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGAabFv */ -// cM3dGAab::~cM3dGAab() { -extern "C" void __dt__8cM3dGAabFv() { - // NONMATCHING + + mKind = getKind(); + if (getType() == 0x1 && !checkParent()) { + return cPhs_INIT_e; + } + + int phase = dComIfG_resLoad(&mPhase, l_arcName[mKind]); + if (phase == cPhs_COMPLEATE_e) { + if (!fopAcM_entrySolidHeap(this, CheckCreateHeap, 0x4000)) { + return cPhs_ERROR_e; + } + if (Create() == 0) { + return cPhs_ERROR_e; + } +#ifdef DEBUG + OSReport("MHole Param<%x> arc<%s>\n", fopAcM_GetParam(this), l_arcName[mKind]); + l_HIO.entryHIO("マグネホール"); +#endif + } + + return phase; } /* 80C936A8-80C93928 0008C8 0280+00 1/1 0/0 0/0 .text execute__12daObjMHole_cFv */ -void daObjMHole_c::execute() { - // NONMATCHING +int daObjMHole_c::execute() { + if (getType() == 0x1 && parentActorID != fpcM_ERROR_PROCESS_ID_e) { + fopAc_ac_c* actor = fopAcM_SearchByID(parentActorID); + if (actor != NULL) { + current.pos = actor->current.pos; + home.pos = current.pos; + } + } + + if (getType() != 0x2) { + u8 sw_bit = getSwbit(); + u8 state = TRUE; + if (sw_bit != 0xFF && !fopAcM_isSwitch(this, sw_bit)) { + state = FALSE; + } + mIsOn = state; + } + + cXyz end_pos = home.pos; + cXyz start_pos; + f32 start_y; + + if (mIsOn) { + start_y = scale.y * -l_length[mKind]; + } else { + start_y = 0.0f; + } + + start_pos.set(0.0f, start_y, 0.0f); + mDoMtx_stack_c::transS(home.pos); + mDoMtx_stack_c::ZXYrotM(shape_angle); + mDoMtx_stack_c::multVec(&start_pos, &start_pos); + mCps.cCcD_CpsAttr::Set(start_pos, end_pos, scale.x * l_size[mKind]); + cXyz length = end_pos - start_pos; + mCps.SetAtVec(length); + setBaseMtx(); + + if (mIsOn) { + dComIfG_Ccsp()->Set(&mCps); + mpBtk2Anm->setPlaySpeed(1.0f); + effectSet(); + } + + mpBrkAnm->play(); + mpBtk1Anm->play(); + mpBtk2Anm->play(); + if (mpEmitter[0] != NULL) { + mSound.startLevelSound(Z2SE_OBJ_MAGNE_EFFECT, 0, -1); + } + mSound.framework(0, dComIfGp_getReverb(fopAcM_GetRoomNo(this))); + field_0x701 = mIsOn; + + return 1; } /* ############################################################################################## */ -/* 80C93DEC-80C93DF4 000064 0008+00 0/1 0/0 0/0 .rodata l_eff_id_L$4030 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const l_eff_id_L[8] = { - 0x86, 0xEF, 0x86, 0xF0, 0x86, 0xF1, 0x86, 0xF2, -}; -COMPILER_STRIP_GATE(0x80C93DEC, &l_eff_id_L); -#pragma pop - -/* 80C93DF4-80C93DFC 00006C 0008+00 0/1 0/0 0/0 .rodata l_eff_id_S$4031 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const l_eff_id_S[8] = { - 0x86, 0xF3, 0x86, 0xF4, 0x86, 0xF5, 0x86, 0xF6, -}; -COMPILER_STRIP_GATE(0x80C93DF4, &l_eff_id_S); -#pragma pop - /* 80C93928-80C93A88 000B48 0160+00 1/1 0/0 0/0 .text effectSet__12daObjMHole_cFv */ void daObjMHole_c::effectSet() { - // NONMATCHING + static u16 const l_eff_id_L[4] = {0x86EF, 0x86F0, 0x86F1, 0x86F2}; + static u16 const l_eff_id_S[4] = {0x86F3, 0x86F4, 0x86F5, 0x86F6}; + + for (int i = 0; i < 4; i++) { + if (mpEmitter[i] == NULL) { + if (mKind == EFF_LARGE_e) { + mpEmitter[i] = dComIfGp_particle_set(l_eff_id_L[i], ¤t.pos, &shape_angle, + NULL, -1, NULL, -1, NULL, NULL, NULL); + } else if (mKind == EFF_SMALL_e) { + mpEmitter[i] = dComIfGp_particle_set(l_eff_id_S[i], ¤t.pos, &shape_angle, + NULL, -1, NULL, -1, NULL, NULL, NULL); + } + } else { + JGeometry::TVec3 emitter_rot; + emitter_rot.x = shape_angle.x; + emitter_rot.y = shape_angle.y; + emitter_rot.z = shape_angle.z; + mpEmitter[i]->setGlobalTranslation(current.pos); + mpEmitter[i]->setGlobalRotation(emitter_rot); + } + } } /* 80C93A88-80C93ADC 000CA8 0054+00 1/1 0/0 0/0 .text effectEnd__12daObjMHole_cFv */ void daObjMHole_c::effectEnd() { - // NONMATCHING + for (int i = 0; i < 4; i++) { + if (mpEmitter[i] != NULL) { + mpEmitter[i]->becomeInvalidEmitter(); + mpEmitter[i]->quitImmortalEmitter(); + mpEmitter[i] = NULL; + } + } } /* ############################################################################################## */ -/* 80C93DFC-80C93E00 000074 0004+00 0/1 0/0 0/0 .rodata @4217 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4217 = -1.0f / 100.0f; -COMPILER_STRIP_GATE(0x80C93DFC, &lit_4217); -#pragma pop - /* 80C93ADC-80C93CAC 000CFC 01D0+00 1/1 0/0 0/0 .text draw__12daObjMHole_cFv */ -void daObjMHole_c::draw() { - // NONMATCHING +int daObjMHole_c::draw() { + g_env_light.settingTevStruct(0x0, ¤t.pos, &tevStr); + g_env_light.setLightTevColorType_MAJI(mpModel, &tevStr); + + mpBrkAnm->entry(mpModel->getModelData()); + mpBtk1Anm->entry(mpModel->getModelData()); + mpBtk2Anm->entry(mpModel->getModelData()); + + dComIfGd_setListFilter(); + J3DModelData* modelData = mpModel->getModelData(); + for (u16 i = 0; i < modelData->getMaterialNum(); i++) { + if (i == 0 || i == 1) { + J3DMaterial* material = modelData->getMaterialNodePointer(i); + if (material->getTexGenBlock()->getTexMtx(0) != NULL) { + J3DTexMtxInfo* tex_mtx_info = + &material->getTexGenBlock()->getTexMtx(0)->getTexMtxInfo(); + if (tex_mtx_info != NULL) { + cXyz* unused = dKyw_get_wind_vec(); + cXyz unused2; + Mtx effect_mtx; + MTXLightPerspective(effect_mtx, dComIfGd_getView()->fovy, + dComIfGd_getView()->aspect, 1.0f, 1.0f, -0.01f, 0.0f); + mDoGph_gInf_c::setWideZoomLightProjection(effect_mtx); + tex_mtx_info->setEffectMtx(effect_mtx); + modelData->simpleCalcMaterial((MtxP)j3dDefaultMtx); + } + } + } + } + + mDoExt_modelUpdateDL(mpModel); + dComIfGd_setList(); + mDoExt_brkAnmRemove(mpModel->getModelData()); + mDoExt_btkAnmRemove(mpModel->getModelData()); + +#ifdef DEBUG + if (l_HIO.collision_display != 0) { + GXColor color = {0xFF, 0x0, 0x0, 0xFF}; + if (mCps.GetAtVecP() != NULL) { + dDbVw_drawArrowXlu(mCps.GetStart(), mCps.GetEnd(), color, 1, 12); + } + } +#endif + + return 1; } /* 80C93CAC-80C93D00 000ECC 0054+00 1/1 0/0 0/0 .text _delete__12daObjMHole_cFv */ -void daObjMHole_c::_delete() { - // NONMATCHING +int daObjMHole_c::_delete() { + effectEnd(); + mSound.deleteObject(); + dComIfG_resDelete(&mPhase, l_arcName[mKind]); +#ifdef DEBUG + l_HIO.removeHIO(); +#endif + + return 1; } -/* 80C93D00-80C93D20 000F20 0020+00 1/0 0/0 0/0 .text daObjMHole_Draw__FP12daObjMHole_c - */ -static void daObjMHole_Draw(daObjMHole_c* param_0) { - // NONMATCHING +/* 80C93D00-80C93D20 000F20 0020+00 1/0 0/0 0/0 .text daObjMHole_Draw__FP12daObjMHole_c */ +static int daObjMHole_Draw(daObjMHole_c* i_this) { + return i_this->draw(); } /* 80C93D20-80C93D40 000F40 0020+00 1/0 0/0 0/0 .text daObjMHole_Execute__FP12daObjMHole_c */ -static void daObjMHole_Execute(daObjMHole_c* param_0) { - // NONMATCHING +static int daObjMHole_Execute(daObjMHole_c* i_this) { + return i_this->execute(); } -/* 80C93D40-80C93D60 000F60 0020+00 1/0 0/0 0/0 .text daObjMHole_Delete__FP12daObjMHole_c - */ -static void daObjMHole_Delete(daObjMHole_c* param_0) { - // NONMATCHING +/* 80C93D40-80C93D60 000F60 0020+00 1/0 0/0 0/0 .text daObjMHole_Delete__FP12daObjMHole_c */ +static int daObjMHole_Delete(daObjMHole_c* i_this) { + fopAcM_RegisterDeleteID(i_this, "Hasu"); + return i_this->_delete(); } -/* 80C93D60-80C93D80 000F80 0020+00 1/0 0/0 0/0 .text daObjMHole_Create__FP10fopAc_ac_c - */ -static void daObjMHole_Create(fopAc_ac_c* param_0) { - // NONMATCHING +/* 80C93D60-80C93D80 000F80 0020+00 1/0 0/0 0/0 .text daObjMHole_Create__FP10fopAc_ac_c */ +static int daObjMHole_Create(fopAc_ac_c* i_this) { + fopAcM_RegisterCreateID(daObjMHole_c,i_this, "MHole"); + return static_cast(i_this)->create(); } +/* 80C93E68-80C93E88 -00001 0020+00 1/0 0/0 0/0 .data l_daObjMHole_Method */ +static actor_method_class l_daObjMHole_Method = { + (process_method_func)daObjMHole_Create, + (process_method_func)daObjMHole_Delete, + (process_method_func)daObjMHole_Execute, + NULL, + (process_method_func)daObjMHole_Draw, +}; + +/* 80C93E88-80C93EB8 -00001 0030+00 0/0 0/0 1/0 .data g_profile_Obj_MHole */ +extern actor_process_profile_definition g_profile_Obj_MHole = { + fpcLy_CURRENT_e, // mLayerID + 7, // mListID + fpcPi_CURRENT_e, // mListPrio + PROC_Obj_MHole, // mProcName + &g_fpcLf_Method.base, // sub_method + sizeof(daObjMHole_c), // mSize + 0, // mSizeOther + 0, // mParameters + &g_fopAc_Method.base, // sub_method + 589, // mPriority + &l_daObjMHole_Method, // sub_method + 0x00040100, // mStatus + fopAc_ACTOR_e, // mActorType + fopAc_CULLBOX_CUSTOM_e, // cullType +}; + /* 80C93E00-80C93E00 000078 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */