diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index 97a4eaf9767..51b0b19cd5f 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -91,6 +91,8 @@ class dBgS_WtrChk; class fopAcM_wt_c { public: static dBgS_WtrChk* getWaterCheck() { return (dBgS_WtrChk*)&mWaterCheck; } + static f32 getWaterY() { return mWaterY[0]; } + static bool waterCheck(const cXyz*); static u8 mWaterCheck[84 + 4 /* padding */]; static f32 mWaterY[1 + 1 /* padding */]; diff --git a/include/rel/d/a/d_a_dshutter/d_a_dshutter.h b/include/rel/d/a/d_a_dshutter/d_a_dshutter.h index 392a5ac7fcd..445f69a430b 100644 --- a/include/rel/d/a/d_a_dshutter/d_a_dshutter.h +++ b/include/rel/d/a/d_a_dshutter/d_a_dshutter.h @@ -1,6 +1,79 @@ #ifndef D_A_DSHUTTER_H #define D_A_DSHUTTER_H -#include "dolphin/types.h" +#include "d/bg/d_bg_s_movebg_actor.h" +#include "d/com/d_com_inf_game.h" +#include "f_op/f_op_actor_mng.h" + +class daDsh_c : public dBgS_MoveBgActor { +public: + class action_c { + public: + typedef int (daDsh_c::*actionFunc)(); + + /* action_c(actionFunc i_initFunc, actionFunc i_execFunc) { + mInitFunc = i_initFunc; + mExecuteFunc = i_execFunc; + } */ + + actionFunc& getInit() { return mInitFunc; } + actionFunc& getExecute() { return mExecuteFunc; } + + /* 0x0 */ actionFunc mInitFunc; + /* 0xC */ actionFunc mExecuteFunc; + }; + + /* 80467498 */ ~daDsh_c(); + /* 80467694 */ void setMtx(); + /* 80467708 */ void setAction(daDsh_c::action_c*); + /* 8046772C */ int callInit(); + /* 8046777C */ int callExecute(); + /* 804677D4 */ int initOpenWait(); + /* 804677E4 */ int executeOpenWait(); + /* 80467840 */ int initOpen(); + /* 80467988 */ int executeOpen(); + /* 80467A64 */ int initCloseWait(); + /* 80467A80 */ int executeCloseWait(); + /* 80467ADC */ int initClose(); + /* 80467B04 */ int executeClose(); + + /* 8046751C */ virtual int CreateHeap(); + /* 80467640 */ virtual int Execute(f32 (**)[3][4]); + /* 8046759C */ virtual int Draw(); + + inline int create(); + + u8 getType() { return (fopAcM_GetParam(this) >> 8) & 0xF; } + int getSw() { return fopAcM_GetParam(this) & 0xFF; } + + u8 getOpenTiltTime() { return 0; } + f32 getOpenAccel() { return OPEN_ACCEL; } + f32 getOpenSpeed() { return OPEN_SPEED; } + f32 getOpenBoundSpeed() { return OPEN_BOUND_SPEED; } + f32 getOpenBoundRatio() { return OPEN_BOUND_RATIO; } + + u8 getCloseTiltTime() { return 0; } + f32 getCloseAccel() { return CLOSE_ACCEL; } + f32 getCloseSpeed() { return CLOSE_SPEED; } + f32 getCloseBoundSpeed() { return CLOSE_BOUND_SPEED; } + f32 getCloseBoundRatio() { return CLOSE_BOUND_RATIO; } + + static f32 OPEN_SIZE; + static f32 OPEN_ACCEL; + static f32 OPEN_SPEED; + static f32 OPEN_BOUND_SPEED; + static f32 OPEN_BOUND_RATIO; + static f32 CLOSE_ACCEL; + static f32 CLOSE_SPEED; + static f32 CLOSE_BOUND_SPEED; + static f32 CLOSE_BOUND_RATIO; + + /* 0x5A0 */ dComIfG_resLoader_c mResLoader; + /* 0x5B0 */ J3DModel* mpModel; + /* 0x5B4 */ action_c* mpAction; + /* 0x5B8 */ s16 mTiltTime; + /* 0x5BA */ u8 mSw; + /* 0x5BB */ u8 mType; +}; #endif /* D_A_DSHUTTER_H */ diff --git a/rel/d/a/d_a_dshutter/d_a_dshutter.cpp b/rel/d/a/d_a_dshutter/d_a_dshutter.cpp index 181528d7f11..fced1cab78c 100644 --- a/rel/d/a/d_a_dshutter/d_a_dshutter.cpp +++ b/rel/d/a/d_a_dshutter/d_a_dshutter.cpp @@ -1,130 +1,13 @@ -// -// Generated By: dol2asm -// Translation Unit: d_a_dshutter -// +/** + * d_a_dshutter.cpp + * Gates that shutter open / close + */ #include "rel/d/a/d_a_dshutter/d_a_dshutter.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "SSystem/SComponent/c_math.h" +#include "d/d_procname.h" #include "dol2asm.h" -#include "dolphin/types.h" - -// -// Types: -// - -struct mDoMtx_stack_c { - static u8 now[48]; -}; - -struct fopAc_ac_c { - /* 80018C8C */ ~fopAc_ac_c(); -}; - -struct cXyz {}; - -struct fopAcM_wt_c { - /* 8001DD84 */ void waterCheck(cXyz const*); - - static f32 mWaterY[1 + 1 /* padding */]; -}; - -struct fopAcM_gc_c { - /* 8001DCBC */ void gndCheck(cXyz const*); - - static f32 mGroundY; -}; - -struct daDsh_c { - struct action_c {}; - - /* 80467498 */ ~daDsh_c(); - /* 8046751C */ void CreateHeap(); - /* 8046759C */ void Draw(); - /* 80467640 */ void Execute(f32 (**)[3][4]); - /* 80467694 */ void setMtx(); - /* 80467708 */ void setAction(daDsh_c::action_c*); - /* 8046772C */ void callInit(); - /* 8046777C */ void callExecute(); - /* 804677D4 */ void initOpenWait(); - /* 804677E4 */ void executeOpenWait(); - /* 80467840 */ void initOpen(); - /* 80467988 */ void executeOpen(); - /* 80467A64 */ void initCloseWait(); - /* 80467A80 */ void executeCloseWait(); - /* 80467ADC */ void initClose(); - /* 80467B04 */ void executeClose(); - - static u32 OPEN_SIZE; - static f32 OPEN_ACCEL; - static f32 OPEN_SPEED; - static f32 OPEN_BOUND_SPEED; - static f32 OPEN_BOUND_RATIO; - static f32 CLOSE_ACCEL; - static f32 CLOSE_SPEED; - static f32 CLOSE_BOUND_SPEED; - static f32 CLOSE_BOUND_RATIO; -}; - -struct dSv_info_c { - /* 80035360 */ void isSwitch(int, int) const; -}; - -struct dKy_tevstr_c {}; - -struct J3DModelData {}; - -struct dScnKy_env_light_c { - /* 801A37C4 */ void settingTevStruct(int, cXyz*, dKy_tevstr_c*); - /* 801A4DA0 */ void setLightTevColorType_MAJI(J3DModelData*, dKy_tevstr_c*); -}; - -struct dRes_info_c {}; - -struct dRes_control_c { - /* 8003C2EC */ void getRes(char const*, s32, dRes_info_c*, int); -}; - -struct JKRHeap {}; - -struct dComIfG_resLoader_c { - /* 8002F314 */ dComIfG_resLoader_c(); - /* 8002F328 */ ~dComIfG_resLoader_c(); - /* 8002F3B4 */ void load(char const**, JKRHeap*); -}; - -struct dBgW {}; - -struct cBgS_PolyInfo {}; - -struct csXyz {}; - -struct dBgS_MoveBgActor { - /* 80078624 */ dBgS_MoveBgActor(); - /* 80078690 */ bool Create(); - /* 800786A8 */ bool Delete(); - /* 800786B0 */ bool IsDelete(); - /* 800786B8 */ bool ToFore(); - /* 800786C0 */ bool ToBack(); - /* 800787BC */ void MoveBGCreate(char const*, int, - void (*)(dBgW*, void*, cBgS_PolyInfo const&, bool, cXyz*, - csXyz*, csXyz*), - u32, f32 (*)[3][4]); - /* 800788DC */ void MoveBGDelete(); - /* 80078950 */ void MoveBGExecute(); -}; - -struct JAISoundID {}; - -struct Vec {}; - -struct Z2SeMgr { - /* 802AB984 */ void seStart(JAISoundID, Vec const*, u32, s8, f32, f32, f32, f32, u8); -}; - -struct Z2AudioMgr { - static u8 mAudioMgrPtr[4 + 4 /* padding */]; -}; - -struct J3DModel {}; // // Forward References: @@ -151,7 +34,7 @@ extern "C" static void daDsh_Execute__FP7daDsh_c(); extern "C" static bool daDsh_IsDelete__FP7daDsh_c(); extern "C" static void daDsh_Delete__FP7daDsh_c(); extern "C" static void daDsh_Create__FP10fopAc_ac_c(); -extern "C" void func_80467DF8(void* _this, s16*); +extern "C" s16 func_80467DF8(s16*); extern "C" void __sinit_d_a_dshutter_cpp(); extern "C" extern char const* const d_a_dshutter__stringBase0; @@ -188,19 +71,12 @@ extern "C" void cM_rndFX__Ff(); extern "C" void cLib_chaseF__FPfff(); extern "C" void seStart__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc(); extern "C" void __dl__FPv(); -extern "C" void PSMTXCopy(); -extern "C" void PSMTXTrans(); extern "C" void __ptmf_test(); extern "C" void __ptmf_scall(); extern "C" void _savegpr_29(); extern "C" void _restgpr_29(); -extern "C" extern void* g_fopAc_Method[8]; -extern "C" extern void* g_fpcLf_Method[5 + 1 /* padding */]; extern "C" extern void* __vt__16dBgS_MoveBgActor[10]; extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" extern u8 g_env_light[4880]; -extern "C" extern u8 j3dSys[284]; extern "C" f32 mGroundY__11fopAcM_gc_c; extern "C" f32 mWaterY__11fopAcM_wt_c[1 + 1 /* padding */]; extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; @@ -214,6 +90,8 @@ extern "C" f32 CLOSE_SPEED__7daDsh_c; extern "C" f32 CLOSE_BOUND_SPEED__7daDsh_c; extern "C" f32 CLOSE_BOUND_RATIO__7daDsh_c; +SECTION_DATA extern void* __vt__7daDsh_c[10]; + // // Declarations: // @@ -247,10 +125,10 @@ SECTION_DATA static u32 lit_1787[1 + 4 /* padding */] = { #pragma pop /* 80467F7C-80467F88 -00001 000C+00 2/2 0/0 0/0 .data l_arcName */ -SECTION_DATA static void* l_arcName[3] = { - (void*)&d_a_dshutter__stringBase0, - (void*)(((char*)&d_a_dshutter__stringBase0) + 0x7), - (void*)(((char*)&d_a_dshutter__stringBase0) + 0x11), +SECTION_DATA static char* l_arcName[] = { + "K_tetd", + "S_bsaku00", + "S_lv7saku", }; /* 80467F88-80467F94 -00001 000C+00 0/1 0/0 0/0 .data @3631 */ @@ -333,145 +211,88 @@ SECTION_DATA static void* lit_3644[3] = { }; #pragma pop -/* 80467FE8-80467FF0 -00001 0008+00 1/1 0/0 0/0 .data l_resName$localstatic3$create__7daDsh_cFv */ -SECTION_DATA static void* data_80467FE8[2] = { - (void*)NULL, - (void*)(((char*)&d_a_dshutter__stringBase0) + 0x1B), -}; - -/* 80467FF0-80468010 -00001 0020+00 1/0 0/0 0/0 .data l_daDsh_Method */ -SECTION_DATA static void* l_daDsh_Method[8] = { - (void*)daDsh_Create__FP10fopAc_ac_c, - (void*)daDsh_Delete__FP7daDsh_c, - (void*)daDsh_Execute__FP7daDsh_c, - (void*)daDsh_IsDelete__FP7daDsh_c, - (void*)daDsh_Draw__FP7daDsh_c, - (void*)NULL, - (void*)NULL, - (void*)NULL, -}; - -/* 80468010-80468044 -00001 0034+00 0/0 0/0 1/0 .data g_profile_DSHUTTER */ -SECTION_DATA extern void* g_profile_DSHUTTER[13] = { - (void*)0xFFFFFFFD, (void*)0x0007FFFD, - (void*)0x022C0000, (void*)&g_fpcLf_Method, - (void*)0x000005BC, (void*)NULL, - (void*)NULL, (void*)&g_fopAc_Method, - (void*)0x01280000, (void*)&l_daDsh_Method, - (void*)0x00044000, (void*)NULL, - (void*)NULL, -}; - -/* 80468044-8046806C 0000E8 0028+00 2/2 0/0 0/0 .data __vt__7daDsh_c */ -SECTION_DATA extern void* __vt__7daDsh_c[10] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)CreateHeap__7daDsh_cFv, - (void*)Create__16dBgS_MoveBgActorFv, - (void*)Execute__7daDsh_cFPPA3_A4_f, - (void*)Draw__7daDsh_cFv, - (void*)Delete__16dBgS_MoveBgActorFv, - (void*)IsDelete__16dBgS_MoveBgActorFv, - (void*)ToFore__16dBgS_MoveBgActorFv, - (void*)ToBack__16dBgS_MoveBgActorFv, -}; - /* 80467498-8046751C 000078 0084+00 1/1 0/0 0/0 .text __dt__7daDsh_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm daDsh_c::~daDsh_c() { - nofralloc -#include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/__dt__7daDsh_cFv.s" -} -#pragma pop +daDsh_c::~daDsh_c() {} /* ############################################################################################## */ /* 80467F04-80467F10 000000 000C+00 2/2 0/0 0/0 .rodata l_bmd */ -SECTION_RODATA static u8 const l_bmd[12] = { - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, +SECTION_RODATA static int const l_bmd[] = { + 4, + 4, + 4, }; COMPILER_STRIP_GATE(0x80467F04, &l_bmd); /* 8046751C-8046759C 0000FC 0080+00 1/0 0/0 0/0 .text CreateHeap__7daDsh_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daDsh_c::CreateHeap() { - nofralloc -#include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/CreateHeap__7daDsh_cFv.s" +int daDsh_c::CreateHeap() { + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName[mType], l_bmd[mType]); + + mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + if (mpModel == NULL) { + return 0; + } + + return 1; } -#pragma pop /* 8046759C-80467640 00017C 00A4+00 1/0 0/0 0/0 .text Draw__7daDsh_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daDsh_c::Draw() { - nofralloc -#include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/Draw__7daDsh_cFv.s" +int daDsh_c::Draw() { + g_env_light.settingTevStruct(0x10, ¤t.pos, &mTevStr); + g_env_light.setLightTevColorType_MAJI(mpModel, &mTevStr); + + dComIfGd_setListBG(); + mDoExt_modelUpdateDL(mpModel); + dComIfGd_setList(); + return 1; } -#pragma pop /* 80467640-80467694 000220 0054+00 1/0 0/0 0/0 .text Execute__7daDsh_cFPPA3_A4_f */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daDsh_c::Execute(f32 (**param_0)[3][4]) { - nofralloc -#include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/Execute__7daDsh_cFPPA3_A4_f.s" +int daDsh_c::Execute(f32 (**param_0)[3][4]) { + callExecute(); + setMtx(); + *param_0 = &field_0x56c; + func_80467DF8(&mTiltTime); + return 1; } -#pragma pop /* 80467694-80467708 000274 0074+00 2/2 0/0 0/0 .text setMtx__7daDsh_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daDsh_c::setMtx() { - nofralloc -#include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/setMtx__7daDsh_cFv.s" +void daDsh_c::setMtx() { + mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z); + mDoMtx_stack_c::YrotM(shape_angle.y); + + mpModel->i_setBaseTRMtx(mDoMtx_stack_c::get()); + PSMTXCopy(mDoMtx_stack_c::get(), field_0x56c); } -#pragma pop /* 80467708-8046772C 0002E8 0024+00 5/5 0/0 0/0 .text setAction__7daDsh_cFPQ27daDsh_c8action_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daDsh_c::setAction(daDsh_c::action_c* param_0) { - nofralloc -#include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/setAction__7daDsh_cFPQ27daDsh_c8action_c.s" +void daDsh_c::setAction(daDsh_c::action_c* i_action) { + mpAction = i_action; + callInit(); } -#pragma pop /* 8046772C-8046777C 00030C 0050+00 1/1 0/0 0/0 .text callInit__7daDsh_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daDsh_c::callInit() { - nofralloc -#include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/callInit__7daDsh_cFv.s" +int daDsh_c::callInit() { + if (mpAction->getInit() == NULL) { + return 1; + } + + return (this->*mpAction->getInit())(); } -#pragma pop /* 8046777C-804677D4 00035C 0058+00 1/1 0/0 0/0 .text callExecute__7daDsh_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daDsh_c::callExecute() { - nofralloc -#include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/callExecute__7daDsh_cFv.s" +int daDsh_c::callExecute() { + if (mpAction->getExecute() == NULL) { + return 1; + } + + return (this->*mpAction->getExecute())(); } -#pragma pop /* 804677D4-804677E4 0003B4 0010+00 1/0 0/0 0/0 .text initOpenWait__7daDsh_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daDsh_c::initOpenWait() { - nofralloc -#include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/initOpenWait__7daDsh_cFv.s" +int daDsh_c::initOpenWait() { + current.pos.y = orig.pos.y; + return 1; } -#pragma pop /* ############################################################################################## */ /* 80468070-80468074 000000 0001+03 1/1 0/0 0/0 .bss @1109 */ @@ -568,174 +389,148 @@ static u8 lit_1009[1 + 3 /* padding */]; #pragma pop /* 804680B0-804680C8 000040 0018+00 2/3 0/0 0/0 .bss l_openWaitAction */ -static u8 l_openWaitAction[24]; +static daDsh_c::action_c l_openWaitAction /* (&daDsh_c::initOpenWait, &daDsh_c::executeOpenWait) */; /* 804680C8-804680E0 000058 0018+00 1/2 0/0 0/0 .bss l_openAction */ -static u8 l_openAction[24]; +static daDsh_c::action_c l_openAction /* (&daDsh_c::initOpen, &daDsh_c::executeOpen) */; /* 804677E4-80467840 0003C4 005C+00 1/0 0/0 0/0 .text executeOpenWait__7daDsh_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daDsh_c::executeOpenWait() { - nofralloc -#include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/executeOpenWait__7daDsh_cFv.s" +int daDsh_c::executeOpenWait() { + if (i_fopAcM_isSwitch(this, mSw)) { + setAction(&l_openAction); + } + + return 1; } -#pragma pop /* ############################################################################################## */ /* 80467F10-80467F1C 00000C 000C+00 1/1 0/0 0/0 .rodata l_dzb */ -SECTION_RODATA static u8 const l_dzb[12] = { - 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, -}; +SECTION_RODATA static int const l_dzb[] = {7, 7, 7}; COMPILER_STRIP_GATE(0x80467F10, &l_dzb); /* 80467F1C-80467F28 000018 000C+00 1/1 0/0 0/0 .rodata l_heap_size */ -SECTION_RODATA static u8 const l_heap_size[12] = { - 0x00, 0x00, 0x0C, 0x10, 0x00, 0x00, 0x0C, 0x10, 0x00, 0x00, 0x3D, 0x60, -}; +SECTION_RODATA static u32 const l_heap_size[] = {0xC10, 0xC10, 0x3D60}; COMPILER_STRIP_GATE(0x80467F1C, &l_heap_size); -/* 80467F28-80467F2C 000024 0004+00 1/2 0/0 0/0 .rodata @3781 */ -SECTION_RODATA static u8 const lit_3781[4] = { - 0x00, - 0x00, - 0x00, - 0x00, -}; -COMPILER_STRIP_GATE(0x80467F28, &lit_3781); - -/* 80467F2C-80467F30 000028 0004+00 0/1 0/0 0/0 .rodata @3782 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3782 = 100.0f; -COMPILER_STRIP_GATE(0x80467F2C, &lit_3782); -#pragma pop - -/* 80467F30-80467F34 00002C 0004+00 0/1 0/0 0/0 .rodata @3783 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3783 = 1.0f; -COMPILER_STRIP_GATE(0x80467F30, &lit_3783); -#pragma pop - -/* 80467F34-80467F38 000030 0004+00 0/1 0/0 0/0 .rodata @3784 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3784 = -1.0f; -COMPILER_STRIP_GATE(0x80467F34, &lit_3784); -#pragma pop - /* 80467840-80467988 000420 0148+00 1/0 0/0 0/0 .text initOpen__7daDsh_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daDsh_c::initOpen() { - nofralloc -#include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/initOpen__7daDsh_cFv.s" +int daDsh_c::initOpen() { + mTiltTime = getOpenTiltTime(); + speed.y = 0.0f; + mGravity = getOpenAccel(); + + cXyz check_pos(orig.pos.x, orig.pos.y + 100.0f, orig.pos.z); + bool water_check = fopAcM_wt_c::waterCheck(&check_pos); + bool gnd_check = fopAcM_gc_c::gndCheck(&check_pos); + + if (water_check && fopAcM_wt_c::getWaterY() > fopAcM_gc_c::getGroundY()) { + fopAcM_seStart(this, Z2SE_OBJ_SW_FENCE_DWN_WTR, 0); + } else { + fopAcM_seStart(this, Z2SE_OBJ_SW_FENCE_DOWN, 0); + } + + return 1; } -#pragma pop - -/* ############################################################################################## */ -/* 80467F38-80467F3C 000034 0004+00 2/2 0/0 0/0 .rodata @3802 */ -SECTION_RODATA static f32 const lit_3802 = 2.0f; -COMPILER_STRIP_GATE(0x80467F38, &lit_3802); - -/* 80467F3C-80467F40 000038 0004+00 2/2 0/0 0/0 .rodata @3803 */ -SECTION_RODATA static f32 const lit_3803 = 8.0f; -COMPILER_STRIP_GATE(0x80467F3C, &lit_3803); /* 804680E0-804680F8 000070 0018+00 2/3 0/0 0/0 .bss l_closeWaitAction */ -static u8 l_closeWaitAction[24]; +static daDsh_c::action_c + l_closeWaitAction /* (&daDsh_c::initCloseWait, &daDsh_c::executeCloseWait) */; /* 80467988-80467A64 000568 00DC+00 1/0 0/0 0/0 .text executeOpen__7daDsh_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daDsh_c::executeOpen() { - nofralloc -#include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/executeOpen__7daDsh_cFv.s" +int daDsh_c::executeOpen() { + if (mTiltTime != 0) { + current.pos.y = orig.pos.y + cM_rndFX(2.0f); + } else { + cLib_chaseF(&speed.y, getOpenSpeed(), mGravity); + current.pos.y += speed.y; + + f32 closed_y_pos = orig.pos.y - OPEN_SIZE; + if (current.pos.y < closed_y_pos) { + current.pos.y = closed_y_pos; + + if (speed.y < getOpenBoundSpeed()) { + speed.y *= getOpenBoundRatio(); + mGravity = 8.0f; + } else { + setAction(&l_closeWaitAction); + } + } + } + + return 1; } -#pragma pop /* 80467A64-80467A80 000644 001C+00 1/0 0/0 0/0 .text initCloseWait__7daDsh_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daDsh_c::initCloseWait() { - nofralloc -#include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/initCloseWait__7daDsh_cFv.s" +int daDsh_c::initCloseWait() { + current.pos.y = orig.pos.y - OPEN_SIZE; + return 1; } -#pragma pop /* ############################################################################################## */ /* 804680F8-80468110 000088 0018+00 1/2 0/0 0/0 .bss l_closeAction */ -static u8 l_closeAction[24]; +static daDsh_c::action_c l_closeAction /* (&daDsh_c::initClose, &daDsh_c::executeClose) */; /* 80467A80-80467ADC 000660 005C+00 1/0 0/0 0/0 .text executeCloseWait__7daDsh_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daDsh_c::executeCloseWait() { - nofralloc -#include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/executeCloseWait__7daDsh_cFv.s" +int daDsh_c::executeCloseWait() { + if (!i_fopAcM_isSwitch(this, mSw)) { + setAction(&l_closeAction); + } + + return 1; } -#pragma pop /* 80467ADC-80467B04 0006BC 0028+00 1/0 0/0 0/0 .text initClose__7daDsh_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daDsh_c::initClose() { - nofralloc -#include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/initClose__7daDsh_cFv.s" +int daDsh_c::initClose() { + mTiltTime = getCloseTiltTime(); + speed.y = 0.0f; + mGravity = getCloseAccel(); + + return 1; } -#pragma pop /* 80467B04-80467BE0 0006E4 00DC+00 1/0 0/0 0/0 .text executeClose__7daDsh_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daDsh_c::executeClose() { - nofralloc -#include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/executeClose__7daDsh_cFv.s" +int daDsh_c::executeClose() { + if (mTiltTime != 0) { + current.pos.y = (orig.pos.y - OPEN_SIZE) + cM_rndFX(2.0f); + } else { + cLib_chaseF(&speed.y, getCloseSpeed(), mGravity); + current.pos.y += speed.y; + + if (current.pos.y > orig.pos.y) { + current.pos.y = orig.pos.y; + + if (speed.y > getCloseBoundSpeed()) { + speed.y *= getCloseBoundRatio(); + mGravity = 8.0f; + } else { + setAction(&l_openWaitAction); + } + } + } + + return 1; } -#pragma pop /* 80467BE0-80467C0C 0007C0 002C+00 1/0 0/0 0/0 .text daDsh_Draw__FP7daDsh_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daDsh_Draw(daDsh_c* param_0) { - nofralloc -#include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/daDsh_Draw__FP7daDsh_c.s" +static int daDsh_Draw(daDsh_c* i_this) { + return i_this->MoveBGDraw(); } -#pragma pop /* 80467C0C-80467C2C 0007EC 0020+00 1/0 0/0 0/0 .text daDsh_Execute__FP7daDsh_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daDsh_Execute(daDsh_c* param_0) { - nofralloc -#include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/daDsh_Execute__FP7daDsh_c.s" +static int daDsh_Execute(daDsh_c* i_this) { + return i_this->MoveBGExecute(); } -#pragma pop /* 80467C2C-80467C34 00080C 0008+00 1/0 0/0 0/0 .text daDsh_IsDelete__FP7daDsh_c */ -static bool daDsh_IsDelete(daDsh_c* param_0) { - return true; +static int daDsh_IsDelete(daDsh_c* i_this) { + return 1; } /* 80467C34-80467C7C 000814 0048+00 1/0 0/0 0/0 .text daDsh_Delete__FP7daDsh_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daDsh_Delete(daDsh_c* param_0) { - nofralloc -#include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/daDsh_Delete__FP7daDsh_c.s" +static int daDsh_Delete(daDsh_c* i_this) { + int ret = i_this->MoveBGDelete(); + i_this->~daDsh_c(); + return ret; } -#pragma pop /* ############################################################################################## */ /* 80468110-80468114 0000A0 0004+00 0/0 0/0 0/0 .bss @@ -910,23 +705,63 @@ static u8 data_80468170[4]; #pragma pop /* 80468174-80468178 000104 0004+00 1/1 0/0 0/0 .bss None */ -static u8 data_80468174[4]; +static s8 data_80468174[4]; + +/* 80467FE8-80467FF0 -00001 0008+00 1/1 0/0 0/0 .data l_resName$localstatic3$create__7daDsh_cFv */ +SECTION_DATA static void* data_80467FE8[2] = { + (void*)NULL, + (void*)(((char*)&d_a_dshutter__stringBase0) + 0x1B), +}; /* 80467C7C-80467DF8 00085C 017C+00 1/0 0/0 0/0 .text daDsh_Create__FP10fopAc_ac_c */ +#ifdef NONMATCHING +int daDsh_c::create() { + if (!fopAcM_CheckCondition(this, 8)) { + new (this) daDsh_c(); + fopAcM_OnCondition(this, 8); + } + + mType = getType(); + + static const char* l_resName[] = {l_arcName[mType], ""}; + + int phase = mResLoader.load(l_resName, NULL); + if (phase == cPhs_COMPLEATE_e) { + phase = MoveBGCreate(l_arcName[mType], l_dzb[mType], dBgS_MoveBGProc_Typical, + l_heap_size[mType], NULL); + if (phase == cPhs_ERROR_e) { + phase = cPhs_ERROR_e; + } else { + mSw = getSw(); + + setAction(i_fopAcM_isSwitch(this, mSw) ? &l_openWaitAction : &l_closeWaitAction); + setMtx(); + fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); + } + } + + return phase; +} + +static int daDsh_Create(fopAc_ac_c* i_this) { + return static_cast(i_this)->create(); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void daDsh_Create(fopAc_ac_c* param_0) { +static asm int daDsh_Create(fopAc_ac_c* param_0) { nofralloc #include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/daDsh_Create__FP10fopAc_ac_c.s" } #pragma pop +#endif /* 80467DF8-80467E14 0009D8 001C+00 1/1 0/0 0/0 .text cLib_calcTimer__FPs */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -extern "C" asm void func_80467DF8(void* _this, s16* param_0) { +extern "C" asm s16 func_80467DF8(s16* param_0) { nofralloc #include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/func_80467DF8.s" } @@ -936,8 +771,7 @@ extern "C" asm void func_80467DF8(void* _this, s16* param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void __sinit_d_a_dshutter_cpp() { - nofralloc +asm void __sinit_d_a_dshutter_cpp(){nofralloc #include "asm/rel/d/a/d_a_dshutter/d_a_dshutter/__sinit_d_a_dshutter_cpp.s" } #pragma pop @@ -947,4 +781,20 @@ asm void __sinit_d_a_dshutter_cpp() { REGISTER_CTORS(0x80467E14, __sinit_d_a_dshutter_cpp); #pragma pop -/* 80467F40-80467F40 00003C 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ +/* 80467FF0-80468010 -00001 0020+00 1/0 0/0 0/0 .data l_daDsh_Method */ +static actor_method_class l_daDsh_Method = { + (process_method_func)daDsh_Create, (process_method_func)daDsh_Delete, + (process_method_func)daDsh_Execute, (process_method_func)daDsh_IsDelete, + (process_method_func)daDsh_Draw, +}; + +/* 80468010-80468044 -00001 0034+00 0/0 0/0 1/0 .data g_profile_DSHUTTER */ +SECTION_DATA extern void* g_profile_DSHUTTER[13] = { + (void*)0xFFFFFFFD, (void*)0x0007FFFD, + (void*)0x022C0000, (void*)&g_fpcLf_Method, + (void*)0x000005BC, (void*)NULL, + (void*)NULL, (void*)&g_fopAc_Method, + (void*)0x01280000, (void*)&l_daDsh_Method, + (void*)0x00044000, (void*)NULL, + (void*)NULL, +};