From b54708addc45145c64e6c99cdf3d5f14da34da52 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Thu, 2 Jan 2025 11:35:28 +0200 Subject: [PATCH] d_a_obj_rstair OK --- config/GZ2E01/rels/d_a_obj_rstair/symbols.txt | 26 +- configure.py | 2 +- include/d/actor/d_a_obj_rstair.h | 62 +- src/d/actor/d_a_obj_rstair.cpp | 649 ++++++++---------- 4 files changed, 365 insertions(+), 374 deletions(-) diff --git a/config/GZ2E01/rels/d_a_obj_rstair/symbols.txt b/config/GZ2E01/rels/d_a_obj_rstair/symbols.txt index c8d4935923c..03c9191b6cd 100644 --- a/config/GZ2E01/rels/d_a_obj_rstair/symbols.txt +++ b/config/GZ2E01/rels/d_a_obj_rstair/symbols.txt @@ -24,26 +24,26 @@ onWaterModel__15daObjRotStair_cFv = .text:0x00000E30; // type:function size:0x54 offWaterModel__15daObjRotStair_cFv = .text:0x00000E84; // type:function size:0x60 scope:global Draw__15daObjRotStair_cFv = .text:0x00000EE4; // type:function size:0x1FC scope:global Delete__15daObjRotStair_cFv = .text:0x000010E0; // type:function size:0x6C scope:global -daObjRotStair_create1st__FP15daObjRotStair_c = .text:0x0000114C; // type:function size:0x60 scope:global -daObjRotStair_MoveBGDelete__FP15daObjRotStair_c = .text:0x000011AC; // type:function size:0x20 scope:global -daObjRotStair_MoveBGExecute__FP15daObjRotStair_c = .text:0x000011CC; // type:function size:0x20 scope:global -daObjRotStair_MoveBGDraw__FP15daObjRotStair_c = .text:0x000011EC; // type:function size:0x2C scope:global +daObjRotStair_create1st__FP15daObjRotStair_c = .text:0x0000114C; // type:function size:0x60 scope:local +daObjRotStair_MoveBGDelete__FP15daObjRotStair_c = .text:0x000011AC; // type:function size:0x20 scope:local +daObjRotStair_MoveBGExecute__FP15daObjRotStair_c = .text:0x000011CC; // type:function size:0x20 scope:local +daObjRotStair_MoveBGDraw__FP15daObjRotStair_c = .text:0x000011EC; // type:function size:0x2C scope:local _ctors = .ctors:0x00000000; // type:label scope:global _dtors = .dtors:0x00000000; // type:label scope:global ...rodata.0 = .rodata:0x00000000; // type:label scope:local -l_wtr_bmd = .rodata:0x00000000; // type:object size:0x8 scope:global -l_wtr_btk = .rodata:0x00000008; // type:object size:0x8 scope:global -l_target_angleY = .rodata:0x00000010; // type:object size:0x10 scope:global +l_wtr_bmd = .rodata:0x00000000; // type:object size:0x8 scope:local +l_wtr_btk = .rodata:0x00000008; // type:object size:0x8 scope:local +l_target_angleY = .rodata:0x00000010; // type:object size:0x10 scope:local @3770 = .rodata:0x00000020; // type:object size:0x4 scope:local @3911 = .rodata:0x00000024; // type:object size:0x4 scope:local @3912 = .rodata:0x00000028; // type:object size:0x4 scope:local @4107 = .rodata:0x0000002C; // type:object size:0x4 scope:local @stringBase0 = .rodata:0x00000030; // type:object size:0xA scope:local data:string_table ...data.0 = .data:0x00000000; // type:label scope:local -cNullVec__6Z2Calc = .data:0x00000000; // type:object size:0xC scope:global +cNullVec__6Z2Calc = .data:0x00000000; // type:object size:0xC scope:local @1787 = .data:0x0000000C; // type:object size:0x4 scope:local -l_arcName = .data:0x00000020; // type:object size:0x4 scope:global data:4byte -l_water_check_offset = .data:0x00000024; // type:object size:0xC scope:global +l_arcName = .data:0x00000020; // type:object size:0x4 scope:local data:4byte +l_water_check_offset = .data:0x00000024; // type:object size:0xC scope:local @3811 = .data:0x00000030; // type:object size:0xC scope:local @3812 = .data:0x0000003C; // type:object size:0xC scope:local l_func$3810 = .data:0x00000048; // type:object size:0x18 scope:local @@ -52,9 +52,9 @@ l_func$3810 = .data:0x00000048; // type:object size:0x18 scope:local @3921 = .data:0x00000078; // type:object size:0xC scope:local @3922 = .data:0x00000084; // type:object size:0xC scope:local l_func$3918 = .data:0x00000090; // type:object size:0x30 scope:local -daObjRotStair_METHODS = .data:0x000000C0; // type:object size:0x20 scope:global +daObjRotStair_METHODS = .data:0x000000C0; // type:object size:0x20 scope:local g_profile_Obj_RotStair = .data:0x000000E0; // type:object size:0x30 scope:global __vt__12J3DFrameCtrl = .data:0x00000110; // type:object size:0xC scope:global __vt__15daObjRotStair_c = .data:0x0000011C; // type:object size:0x28 scope:global -lbl_608_bss_0 = .bss:0x00000000; // type:object size:0x1 data:byte -lbl_608_bss_1 = .bss:0x00000001; // type:object size:0x1 data:byte +lbl_608_bss_0 = .bss:0x00000000; // type:object size:0x1 scope:local data:byte +lbl_608_bss_1 = .bss:0x00000001; // type:object size:0x1 scope:local data:byte diff --git a/configure.py b/configure.py index acc6c78a7e5..5489fb48c24 100644 --- a/configure.py +++ b/configure.py @@ -1973,7 +1973,7 @@ def MatchingFor(*versions): ActorRel(NonMatching, "d_a_obj_rotBridge"), ActorRel(NonMatching, "d_a_obj_rotTrap"), ActorRel(NonMatching, "d_a_obj_roten"), - ActorRel(NonMatching, "d_a_obj_rstair"), + ActorRel(Matching, "d_a_obj_rstair"), ActorRel(NonMatching, "d_a_obj_rw"), ActorRel(Matching, "d_a_obj_saidan"), ActorRel(NonMatching, "d_a_obj_sakuita"), diff --git a/include/d/actor/d_a_obj_rstair.h b/include/d/actor/d_a_obj_rstair.h index 50dc9ac0a32..899f46ede7d 100644 --- a/include/d/actor/d_a_obj_rstair.h +++ b/include/d/actor/d_a_obj_rstair.h @@ -1,6 +1,7 @@ #ifndef D_A_OBJ_RSTAIR_H #define D_A_OBJ_RSTAIR_H +#include "d/d_bg_s_movebg_actor.h" #include "f_op/f_op_actor_mng.h" /** @@ -11,14 +12,29 @@ * @details * */ -class daObjRotStair_c : public fopAc_ac_c { +class daObjRotStair_c : public dBgS_MoveBgActor { public: + typedef void (daObjRotStair_c::*actionFunc)(); + typedef void (daObjRotStair_c::*modeFunc)(); + + enum Mode { + MODE_WAIT, + MODE_ROTATE, + }; + + enum Action { + ACTION_WAIT, + ACTION_ORDER_EVENT, + ACTION_EVENT, + ACTION_DEAD, + }; + /* 80CC1558 */ void initBaseMtx(); /* 80CC1614 */ void setBaseMtx(); - /* 80CC16B0 */ void Create(); - /* 80CC17F0 */ void CreateHeap(); - /* 80CC1A28 */ void create1st(); - /* 80CC1AF0 */ void Execute(f32 (**)[3][4]); + /* 80CC16B0 */ int Create(); + /* 80CC17F0 */ int CreateHeap(); + /* 80CC1A28 */ int create1st(); + /* 80CC1AF0 */ int Execute(Mtx**); /* 80CC1BA4 */ void move_proc_call(); /* 80CC1C30 */ void init_modeWait(); /* 80CC1CF0 */ void modeWait(); @@ -29,15 +45,43 @@ class daObjRotStair_c : public fopAc_ac_c { /* 80CC2158 */ void actionOrderEvent(); /* 80CC21C0 */ void actionEvent(); /* 80CC221C */ void actionDead(); - /* 80CC2220 */ void checkChangeSw(); + /* 80CC2220 */ int checkChangeSw(); /* 80CC22A0 */ void offSwitch(int); /* 80CC2310 */ void onWaterModel(); /* 80CC2364 */ void offWaterModel(); - /* 80CC23C4 */ void Draw(); - /* 80CC25C0 */ void Delete(); + /* 80CC23C4 */ int Draw(); + /* 80CC25C0 */ int Delete(); + + u8 getSwNo() { return mSwNo; } + u8 getSwNo2() { return (mSwNo >> 8) & 0xff; } + u8 getSwNo3() { return fopAcM_GetParamBit(this, 8, 8); } + u8 getEventID() { return fopAcM_GetParamBit(this, 0, 8); } + void setAction(u8 action) { mAction = action; } private: - /* 0x568 */ u8 field_0x568[0x5e4 - 0x568]; + /* 0x5A0 */ request_of_phase_process_class mPhase; + /* 0x5A8 */ J3DModel* mModel; + /* 0x5AC */ J3DModel* mWaterModels[2]; + /* 0x5B4 */ mDoExt_btkAnm* mBtks[2]; + /* 0x5BC */ bool mWaterModelOn; + /* 0x5C0 */ dBgW* mWaterBgw; + /* 0x5C4 */ int field_0x5c4; + /* 0x5C8 */ s16 field_0x5c8; + /* 0x5CA */ u16 mSwNo; + /* 0x5CC */ u8 mInit; + /* 0x5CD */ u8 mMode; + /* 0x5CE */ s16 mAdditionalRotY; + /* 0x5D0 */ s16 mAngleStep; + /* 0x5D2 */ s16 mStepTarget; + /* 0x5D4 */ s16 mTargetAngle; + /* 0x5D6 */ u8 mIsSw[4]; + /* 0x5DA */ s16 field_0x5da; + /* 0x5DC */ s16 field_0x5dc; + /* 0x5DE */ s16 mEventId; + /* 0x5E0 */ u8 mMapToolId; + /* 0x5E1 */ u8 mAction; + /* 0x5E2 */ bool field_0x5e2; + /* 0x5E3 */ s8 field_0x5e3; }; STATIC_ASSERT(sizeof(daObjRotStair_c) == 0x5e4); diff --git a/src/d/actor/d_a_obj_rstair.cpp b/src/d/actor/d_a_obj_rstair.cpp index 668cc5d16b0..05fe205bd1e 100644 --- a/src/d/actor/d_a_obj_rstair.cpp +++ b/src/d/actor/d_a_obj_rstair.cpp @@ -4,472 +4,419 @@ */ #include "d/actor/d_a_obj_rstair.h" -#include "dol2asm.h" - - -// -// Forward References: -// - -extern "C" void initBaseMtx__15daObjRotStair_cFv(); -extern "C" void setBaseMtx__15daObjRotStair_cFv(); -extern "C" void Create__15daObjRotStair_cFv(); -extern "C" void CreateHeap__15daObjRotStair_cFv(); -extern "C" void __dt__12J3DFrameCtrlFv(); -extern "C" void create1st__15daObjRotStair_cFv(); -extern "C" void Execute__15daObjRotStair_cFPPA3_A4_f(); -extern "C" void move_proc_call__15daObjRotStair_cFv(); -extern "C" void init_modeWait__15daObjRotStair_cFv(); -extern "C" void modeWait__15daObjRotStair_cFv(); -extern "C" void init_modeRotate__15daObjRotStair_cFv(); -extern "C" void modeRotate__15daObjRotStair_cFv(); -extern "C" void event_proc_call__15daObjRotStair_cFv(); -extern "C" void actionWait__15daObjRotStair_cFv(); -extern "C" void actionOrderEvent__15daObjRotStair_cFv(); -extern "C" void actionEvent__15daObjRotStair_cFv(); -extern "C" void actionDead__15daObjRotStair_cFv(); -extern "C" void checkChangeSw__15daObjRotStair_cFv(); -extern "C" void offSwitch__15daObjRotStair_cFi(); -extern "C" void onWaterModel__15daObjRotStair_cFv(); -extern "C" void offWaterModel__15daObjRotStair_cFv(); -extern "C" void Draw__15daObjRotStair_cFv(); -extern "C" void Delete__15daObjRotStair_cFv(); -extern "C" static void daObjRotStair_create1st__FP15daObjRotStair_c(); -extern "C" static void daObjRotStair_MoveBGDelete__FP15daObjRotStair_c(); -extern "C" static void daObjRotStair_MoveBGExecute__FP15daObjRotStair_c(); -extern "C" static void daObjRotStair_MoveBGDraw__FP15daObjRotStair_c(); -extern "C" extern char const* const d_a_obj_rstair__stringBase0; - -// -// External References: -// - -extern "C" void mDoMtx_YrotM__FPA4_fs(); -extern "C" void transS__14mDoMtx_stack_cFRC4cXyz(); -extern "C" void play__14mDoExt_baseAnmFv(); -extern "C" void init__13mDoExt_btkAnmFP16J3DMaterialTableP19J3DAnmTextureSRTKeyiifss(); -extern "C" void entry__13mDoExt_btkAnmFP16J3DMaterialTablef(); -extern "C" void mDoExt_modelUpdateDL__FP8J3DModel(); -extern "C" void mDoExt_J3DModel__create__FP12J3DModelDataUlUl(); -extern "C" void fopAcM_setCullSizeBox2__FP10fopAc_ac_cP12J3DModelData(); -extern "C" void fopAcM_orderOtherEventId__FP10fopAc_ac_csUcUsUsUs(); -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 offSwitch__10dSv_info_cFii(); -extern "C" void isSwitch__10dSv_info_cCFii(); -extern "C" void getRes__14dRes_control_cFPCclP11dRes_info_ci(); -extern "C" void reset__14dEvt_control_cFv(); -extern "C" void getEventIdx__16dEvent_manager_cFP10fopAc_ac_cUc(); -extern "C" void endCheck__16dEvent_manager_cFs(); -extern "C" void StartShock__12dVibration_cFii4cXyz(); -extern "C" void Release__4cBgSFP9dBgW_Base(); -extern "C" void Regist__4dBgSFP9dBgW_BaseP10fopAc_ac_c(); -extern "C" void dBgS_MoveBGProc_TypicalRotY__FP4dBgWPvRC13cBgS_PolyInfobP4cXyzP5csXyzP5csXyz(); -extern "C" void __ct__16dBgS_MoveBgActorFv(); -extern "C" bool IsDelete__16dBgS_MoveBgActorFv(); -extern "C" bool ToFore__16dBgS_MoveBgActorFv(); -extern "C" bool ToBack__16dBgS_MoveBgActorFv(); -extern "C" void -MoveBGCreate__16dBgS_MoveBgActorFPCciPFP4dBgWPvRC13cBgS_PolyInfobP4cXyzP5csXyzP5csXyz_vUlPA3_A4_f(); -extern "C" void MoveBGDelete__16dBgS_MoveBgActorFv(); -extern "C" void MoveBGExecute__16dBgS_MoveBgActorFv(); -extern "C" void Set__4cBgWFP6cBgD_tUlPA3_A4_f(); -extern "C" void __ct__4dBgWFv(); -extern "C" void Move__4dBgWFv(); -extern "C" void settingTevStruct__18dScnKy_env_light_cFiP4cXyzP12dKy_tevstr_c(); -extern "C" void setLightTevColorType_MAJI__18dScnKy_env_light_cFP12J3DModelDataP12dKy_tevstr_c(); -extern "C" void ChkUsed__9cBgW_BgIdCFv(); -extern "C" void cLib_addCalcAngleS__FPsssss(); -extern "C" void seStart__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc(); -extern "C" void seStartLevel__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc(); -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 __ptmf_scall(); -extern "C" void _savegpr_19(); -extern "C" void _savegpr_27(); -extern "C" void _savegpr_28(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_19(); -extern "C" void _restgpr_27(); -extern "C" void _restgpr_28(); -extern "C" void _restgpr_29(); -extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; -extern "C" extern u8 struct_80CC2880[4]; - -// -// Declarations: -// +#include "d/d_bg_w.h" +#include "d/d_com_inf_game.h" +#include "m_Do/m_Do_graphic.h" /* 80CC1558-80CC1614 000078 00BC+00 1/1 0/0 0/0 .text initBaseMtx__15daObjRotStair_cFv */ void daObjRotStair_c::initBaseMtx() { - // NONMATCHING + mWaterModels[0]->setBaseScale(scale); + mWaterModels[1]->setBaseScale(scale); + mModel->setBaseScale(scale); + setBaseMtx(); + mModel->setBaseTRMtx(mDoMtx_stack_c::get()); + mWaterModels[0]->setBaseTRMtx(mDoMtx_stack_c::get()); + mWaterModels[1]->setBaseTRMtx(mDoMtx_stack_c::get()); } /* 80CC1614-80CC16B0 000134 009C+00 2/2 0/0 0/0 .text setBaseMtx__15daObjRotStair_cFv */ void daObjRotStair_c::setBaseMtx() { - // NONMATCHING + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::YrotM(shape_angle.y); + mDoMtx_stack_c::YrotM(mAdditionalRotY); + MTXCopy(mDoMtx_stack_c::get(), mBgMtx); + mModel->setBaseTRMtx(mDoMtx_stack_c::get()); + mWaterModels[0]->setBaseTRMtx(mDoMtx_stack_c::get()); + mWaterModels[1]->setBaseTRMtx(mDoMtx_stack_c::get()); } -/* ############################################################################################## */ /* 80CC2700-80CC2708 000000 0008+00 3/3 0/0 0/0 .rodata l_wtr_bmd */ -SECTION_RODATA static u8 const l_wtr_bmd[8] = { - 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, +static u32 const l_wtr_bmd[2] = { + 6, 7, }; -COMPILER_STRIP_GATE(0x80CC2700, &l_wtr_bmd); /* 80CC2708-80CC2710 000008 0008+00 0/1 0/0 0/0 .rodata l_wtr_btk */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const l_wtr_btk[8] = { - 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x0B, +static u32 const l_wtr_btk[2] = { + 10, 11 }; -COMPILER_STRIP_GATE(0x80CC2708, &l_wtr_btk); -#pragma pop /* 80CC2710-80CC2720 000010 0010+00 2/2 0/0 0/0 .rodata l_target_angleY */ -SECTION_RODATA static u8 const l_target_angleY[16] = { - 0x7F, 0xFF, 0x40, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x7F, 0xFF, 0x40, 0x00, +static s16 const l_target_angleY[8] = { + 0x7FFF, 0x4000, 0x0000, -0x4000, 0x0000, -0x4000, 0x7FFF, 0x4000, }; -COMPILER_STRIP_GATE(0x80CC2710, &l_target_angleY); /* 80CC16B0-80CC17F0 0001D0 0140+00 1/0 0/0 0/0 .text Create__15daObjRotStair_cFv */ -void daObjRotStair_c::Create() { - // NONMATCHING +int daObjRotStair_c::Create() { + for (int i = 0; i < 4; i = i + 1) { + mIsSw[i] = fopAcM_isSwitch(this, i + getSwNo()); + } + field_0x5e3 = -1; + int angleIndex = -1; + for (int i = 0; i < 4; i++) { + if (fopAcM_isSwitch(this, i + getSwNo())) { + OS_REPORT("回転階段:方向<%d>\n", i); + angleIndex = i; + field_0x5e3 = i; + break; + } + } + if (angleIndex >= 0) { + shape_angle.y = l_target_angleY[angleIndex]; + } + init_modeWait(); + initBaseMtx(); + fopAcM_SetMtx(this, mModel->getBaseTRMtx()); + fopAcM_setCullSizeBox2(this, mModel->getModelData()); + mMapToolId = getEventID(); + mEventId = dComIfGp_getEventManager().getEventIdx(this, mMapToolId); + mWaterBgw->Move(); + setAction(ACTION_WAIT); + return 1; } -/* ############################################################################################## */ -/* 80CC2720-80CC2724 000020 0004+00 0/3 0/0 0/0 .rodata @3770 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3770 = 1.0f; -COMPILER_STRIP_GATE(0x80CC2720, &lit_3770); -#pragma pop - -/* 80CC2730-80CC2730 000030 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80CC2730 = "K_spkai00"; -#pragma pop - -/* 80CC273C-80CC2748 000000 000C+00 2/2 0/0 0/0 .data cNullVec__6Z2Calc */ -SECTION_DATA static u8 cNullVec__6Z2Calc[12] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -/* 80CC2748-80CC275C 00000C 0004+10 0/0 0/0 0/0 .data @1787 */ -#pragma push -#pragma force_active on -SECTION_DATA static u32 lit_1787[1 + 4 /* padding */] = { - 0x02000201, - /* padding */ - 0x40080000, - 0x00000000, - 0x3FE00000, - 0x00000000, -}; -#pragma pop +UNK_REL_DATA /* 80CC275C-80CC2760 -00001 0004+00 3/3 0/0 0/0 .data l_arcName */ -SECTION_DATA static void* l_arcName = (void*)&d_a_obj_rstair__stringBase0; +static char* l_arcName = "K_spkai00"; /* 80CC2760-80CC276C 000024 000C+00 0/0 0/0 0/0 .data l_water_check_offset */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_water_check_offset[12] = { - 0x00, 0x00, 0x00, 0x00, 0x44, 0xFA, 0x00, 0x00, 0xC4, 0xFA, 0x00, 0x00, -}; -#pragma pop - -/* 80CC276C-80CC2778 -00001 000C+00 0/1 0/0 0/0 .data @3811 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_3811[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)modeWait__15daObjRotStair_cFv, -}; -#pragma pop - -/* 80CC2778-80CC2784 -00001 000C+00 0/1 0/0 0/0 .data @3812 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_3812[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)modeRotate__15daObjRotStair_cFv, -}; -#pragma pop - -/* 80CC2784-80CC279C 000048 0018+00 0/1 0/0 0/0 .data l_func$3810 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_func_3810[24] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -#pragma pop - -/* 80CC279C-80CC27A8 -00001 000C+00 0/1 0/0 0/0 .data @3919 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_3919[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)actionWait__15daObjRotStair_cFv, -}; -#pragma pop - -/* 80CC27A8-80CC27B4 -00001 000C+00 0/1 0/0 0/0 .data @3920 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_3920[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)actionOrderEvent__15daObjRotStair_cFv, -}; -#pragma pop - -/* 80CC27B4-80CC27C0 -00001 000C+00 0/1 0/0 0/0 .data @3921 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_3921[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)actionEvent__15daObjRotStair_cFv, -}; -#pragma pop - -/* 80CC27C0-80CC27CC -00001 000C+00 0/1 0/0 0/0 .data @3922 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_3922[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)actionDead__15daObjRotStair_cFv, -}; -#pragma pop - -/* 80CC27CC-80CC27FC 000090 0030+00 0/1 0/0 0/0 .data l_func$3918 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_func_3918[48] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -#pragma pop - -/* 80CC27FC-80CC281C -00001 0020+00 1/0 0/0 0/0 .data daObjRotStair_METHODS */ -static actor_method_class daObjRotStair_METHODS = { - (process_method_func)daObjRotStair_create1st__FP15daObjRotStair_c, - (process_method_func)daObjRotStair_MoveBGDelete__FP15daObjRotStair_c, - (process_method_func)daObjRotStair_MoveBGExecute__FP15daObjRotStair_c, - 0, - (process_method_func)daObjRotStair_MoveBGDraw__FP15daObjRotStair_c, -}; - -/* 80CC281C-80CC284C -00001 0030+00 0/0 0/0 1/0 .data g_profile_Obj_RotStair */ -extern actor_process_profile_definition g_profile_Obj_RotStair = { - fpcLy_CURRENT_e, // mLayerID - 3, // mListID - fpcPi_CURRENT_e, // mListPrio - PROC_Obj_RotStair, // mProcName - &g_fpcLf_Method.base, // sub_method - sizeof(daObjRotStair_c), // mSize - 0, // mSizeOther - 0, // mParameters - &g_fopAc_Method.base, // sub_method - 613, // mPriority - &daObjRotStair_METHODS, // sub_method - 0x00040100, // mStatus - fopAc_ACTOR_e, // mActorType - fopAc_CULLBOX_CUSTOM_e, // cullType -}; - -/* 80CC284C-80CC2858 000110 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, +static Vec l_water_check_offset = { + 0.0f, 2000.0f, -2000.0f, }; /* 80CC17F0-80CC19E0 000310 01F0+00 1/0 0/0 0/0 .text CreateHeap__15daObjRotStair_cFv */ -void daObjRotStair_c::CreateHeap() { - // NONMATCHING -} - -/* 80CC19E0-80CC1A28 000500 0048+00 1/0 0/0 0/0 .text __dt__12J3DFrameCtrlFv */ -// J3DFrameCtrl::~J3DFrameCtrl() { -extern "C" void __dt__12J3DFrameCtrlFv() { - // NONMATCHING +int daObjRotStair_c::CreateHeap() { + J3DModelData* modelData = (J3DModelData*) dComIfG_getObjectRes(l_arcName, 5); + JUT_ASSERT(215, modelData != 0); + mModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + if (mModel == NULL) { + return 0; + } + for (int i = 0; i < 2; i++) { + modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, l_wtr_bmd[i]); + JUT_ASSERT(232, modelData != 0); + mWaterModels[i] = mDoExt_J3DModel__create(modelData, 0x80000, 0x19000284); + if (mWaterModels[i] == NULL) { + return 0; + } + J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, l_wtr_btk[i]); + JUT_ASSERT(245, pbtk != 0); + mBtks[i] = new mDoExt_btkAnm(); + if (mBtks[i] == NULL || mBtks[i]->init(modelData, pbtk, 1, 2, 1.0f, 0, -1) == 0) { + return 0; + } + } + mWaterBgw = new dBgW(); + if (mWaterBgw == NULL || mWaterBgw->Set((cBgD_t*)dComIfG_getObjectRes(l_arcName, 0xf), 1, &mBgMtx) != 0) { + mWaterBgw = NULL; + return 0; + } + return 1; } /* 80CC1A28-80CC1AF0 000548 00C8+00 1/1 0/0 0/0 .text create1st__15daObjRotStair_cFv */ -void daObjRotStair_c::create1st() { - // NONMATCHING +int daObjRotStair_c::create1st() { + if (mInit == 0) { + field_0x5c8 = home.angle.x; + mSwNo = home.angle.z; + shape_angle.x = 0; + current.angle.x = 0; + home.angle.x = 0; + shape_angle.z = 0; + current.angle.z = 0; + home.angle.z = 0; + mInit = 1; + } + int rv = dComIfG_resLoad(&mPhase, l_arcName); + if (rv == cPhs_COMPLEATE_e) { + rv = MoveBGCreate(l_arcName, 0xe, + dBgS_MoveBGProc_TypicalRotY, 0xd1c0, NULL); + if (rv == cPhs_ERROR_e) { + return rv; + } + OS_REPORT("RSTAIR PARAM : %x \n", fopAcM_GetParam(this)); + } + return rv; } /* 80CC1AF0-80CC1BA4 000610 00B4+00 1/0 0/0 0/0 .text Execute__15daObjRotStair_cFPPA3_A4_f */ -void daObjRotStair_c::Execute(f32 (**param_0)[3][4]) { - // NONMATCHING +int daObjRotStair_c::Execute(Mtx** ppMtx) { + move_proc_call(); + event_proc_call(); + *ppMtx = &mBgMtx; + setBaseMtx(); + if (mWaterModelOn) { + mWaterBgw->Move(); + } + for (int i = 0; i < 4; i = i + 1) { + mIsSw[i] = fopAcM_isSwitch(this, i + getSwNo()); + } + mBtks[0]->play(); + mBtks[1]->play(); + return 1; } /* 80CC1BA4-80CC1C30 0006C4 008C+00 1/1 0/0 0/0 .text move_proc_call__15daObjRotStair_cFv */ void daObjRotStair_c::move_proc_call() { - // NONMATCHING + static daObjRotStair_c::modeFunc l_func[2] = { + &daObjRotStair_c::modeWait, + &daObjRotStair_c::modeRotate, + }; + (this->*(l_func[mMode]))(); } /* 80CC1C30-80CC1CF0 000750 00C0+00 2/2 0/0 0/0 .text init_modeWait__15daObjRotStair_cFv */ void daObjRotStair_c::init_modeWait() { - // NONMATCHING + s8 dVar3 = field_0x5e3; + if (dVar3 >= 4) { + dVar3 -= 4; + } + if ((dVar3 == 3 && fopAcM_isSwitch(this, getSwNo3())) || (dVar3 == 1 && fopAcM_isSwitch(this, getSwNo2()))) + { + onWaterModel(); + } else { + offWaterModel(); + } + mMode = MODE_WAIT; } /* 80CC1CF0-80CC1DF8 000810 0108+00 1/0 0/0 0/0 .text modeWait__15daObjRotStair_cFv */ void daObjRotStair_c::modeWait() { - // NONMATCHING + s8 dVar3 = field_0x5e3; + if (dVar3 >= 4) { + dVar3 -= 4; + } + if ((dVar3 == 3 && fopAcM_isSwitch(this, getSwNo3())) || (dVar3 == 1 && fopAcM_isSwitch(this, getSwNo2()))) + { + onWaterModel(); + } else { + offWaterModel(); + } + + int changeSw = checkChangeSw(); + if (changeSw >= 0) { + field_0x5e2 = true; + field_0x5e3 = changeSw; + mTargetAngle = l_target_angleY[field_0x5e3]; + offSwitch(field_0x5e3); + init_modeRotate(); + } } /* 80CC1DF8-80CC1EC8 000918 00D0+00 1/1 0/0 0/0 .text init_modeRotate__15daObjRotStair_cFv */ void daObjRotStair_c::init_modeRotate() { - // NONMATCHING + s8 dVar3 = field_0x5e3; + if (dVar3 >= 4) { + dVar3 -= 4; + } + if ((dVar3 == 3 && fopAcM_isSwitch(this, getSwNo3())) || (dVar3 == 1 && fopAcM_isSwitch(this, getSwNo2()))) + { + onWaterModel(); + } else { + offWaterModel(); + } + + mAngleStep = 0; + mStepTarget = 300; + mMode = MODE_ROTATE; } -/* ############################################################################################## */ -/* 80CC2724-80CC2728 000024 0004+00 0/2 0/0 0/0 .rodata @3911 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3911[4] = { - 0x00, - 0x00, - 0x00, - 0x00, -}; -COMPILER_STRIP_GATE(0x80CC2724, &lit_3911); -#pragma pop - -/* 80CC2728-80CC272C 000028 0004+00 0/1 0/0 0/0 .rodata @3912 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3912 = -1.0f; -COMPILER_STRIP_GATE(0x80CC2728, &lit_3912); -#pragma pop - /* 80CC1EC8-80CC2024 0009E8 015C+00 1/0 0/0 0/0 .text modeRotate__15daObjRotStair_cFv */ void daObjRotStair_c::modeRotate() { - // NONMATCHING + if (abs(mTargetAngle - shape_angle.y) < mAngleStep) { + dComIfGp_getVibration().StartShock(8, 0x1f, cXyz(0.0f, 1.0f, 0.0f)); + fopAcM_seStart(this, Z2SE_OBJ_ROLLSTAIR_STOP, 0); + shape_angle.y = mTargetAngle; + mAngleStep = 0; + init_modeWait(); + } else { + shape_angle.y += mAngleStep; + } + cLib_addCalcAngleS(&mAngleStep, mStepTarget, 0x14, 0x32, 10); + fopAcM_seStartLevel(this, Z2SE_OBJ_ROLLSTAIR_ROLL, 0); } /* 80CC2024-80CC20E0 000B44 00BC+00 1/1 0/0 0/0 .text event_proc_call__15daObjRotStair_cFv */ void daObjRotStair_c::event_proc_call() { - // NONMATCHING + static daObjRotStair_c::actionFunc l_func[4] = { + &daObjRotStair_c::actionWait, + &daObjRotStair_c::actionOrderEvent, + &daObjRotStair_c::actionEvent, + &daObjRotStair_c::actionDead, + }; + + (this->*(l_func[mAction]))(); } /* 80CC20E0-80CC2158 000C00 0078+00 1/0 0/0 0/0 .text actionWait__15daObjRotStair_cFv */ void daObjRotStair_c::actionWait() { - // NONMATCHING + if (mMapToolId != 0xff && field_0x5e2) { + field_0x5e2 = false; + setAction(ACTION_ORDER_EVENT); + fopAcM_orderOtherEventId(this, mEventId, mMapToolId, 0xffff, 0, 1); + eventInfo.i_onCondition(dEvtCnd_CANDEMO_e); + } } /* 80CC2158-80CC21C0 000C78 0068+00 1/0 0/0 0/0 .text actionOrderEvent__15daObjRotStair_cFv */ void daObjRotStair_c::actionOrderEvent() { - // NONMATCHING + if (eventInfo.checkCommandDemoAccrpt()) { + setAction(ACTION_EVENT); + } else { + fopAcM_orderOtherEventId(this, mEventId, mMapToolId, 0xffff, 0, 1); + eventInfo.i_onCondition(dEvtCnd_CANDEMO_e); + } } /* 80CC21C0-80CC221C 000CE0 005C+00 1/0 0/0 0/0 .text actionEvent__15daObjRotStair_cFv */ void daObjRotStair_c::actionEvent() { - // NONMATCHING + if (dComIfGp_evmng_endCheck(mEventId)) { + setAction(ACTION_DEAD); + dComIfGp_event_reset(); + } } /* 80CC221C-80CC2220 000D3C 0004+00 1/0 0/0 0/0 .text actionDead__15daObjRotStair_cFv */ void daObjRotStair_c::actionDead() { - /* empty function */ } /* 80CC2220-80CC22A0 000D40 0080+00 1/1 0/0 0/0 .text checkChangeSw__15daObjRotStair_cFv */ -void daObjRotStair_c::checkChangeSw() { - // NONMATCHING +int daObjRotStair_c::checkChangeSw() { + for (int i = 0; i < 4; i++) { + if (mIsSw[i] != fopAcM_isSwitch(this, i + getSwNo())) { + return i; + } + } + return -1; } /* 80CC22A0-80CC2310 000DC0 0070+00 1/1 0/0 0/0 .text offSwitch__15daObjRotStair_cFi */ -void daObjRotStair_c::offSwitch(int param_0) { - // NONMATCHING +void daObjRotStair_c::offSwitch(int idx) { + for (int i = 0; i < 4; i++) { + int swNo = getSwNo() + i; + if (idx != i) { + fopAcM_offSwitch(this, swNo); + } + } } /* 80CC2310-80CC2364 000E30 0054+00 3/3 0/0 0/0 .text onWaterModel__15daObjRotStair_cFv */ void daObjRotStair_c::onWaterModel() { - // NONMATCHING + if (!mWaterModelOn) { + dComIfG_Bgsp().Regist(mWaterBgw, this); + mWaterModelOn = true; + } } /* 80CC2364-80CC23C4 000E84 0060+00 3/3 0/0 0/0 .text offWaterModel__15daObjRotStair_cFv */ void daObjRotStair_c::offWaterModel() { - // NONMATCHING + if (mWaterModelOn) { + if (mWaterBgw->ChkUsed()) { + dComIfG_Bgsp().Release(mWaterBgw); + } + mWaterModelOn = false; + } } -/* ############################################################################################## */ -/* 80CC272C-80CC2730 00002C 0004+00 0/1 0/0 0/0 .rodata @4107 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4107 = -1.0f / 100.0f; -COMPILER_STRIP_GATE(0x80CC272C, &lit_4107); -#pragma pop - /* 80CC23C4-80CC25C0 000EE4 01FC+00 1/0 0/0 0/0 .text Draw__15daObjRotStair_cFv */ -void daObjRotStair_c::Draw() { - // NONMATCHING +int daObjRotStair_c::Draw() { + g_env_light.settingTevStruct(0x10, ¤t.pos, &tevStr); + g_env_light.setLightTevColorType_MAJI(mModel, &tevStr); + dComIfGd_setListBG(); + mDoExt_modelUpdateDL(mModel); + if (mWaterModelOn) { + g_env_light.setLightTevColorType_MAJI(mWaterModels[0], &tevStr); + g_env_light.setLightTevColorType_MAJI(mWaterModels[1], &tevStr); + mBtks[0]->entry(mWaterModels[0]->getModelData()); + mBtks[1]->entry(mWaterModels[1]->getModelData()); + dComIfGd_setXluListDarkBG(); + mDoExt_modelUpdateDL(mWaterModels[0]); + dComIfGd_setList(); + J3DModelData* modelData = mWaterModels[1]->getModelData(); + J3DMaterial* material = modelData->getMaterialNodePointer(0); + dComIfGd_setListInvisisble(); + if (material->getTexGenBlock()->getTexMtx(0) != 0) { + J3DTexMtxInfo* texMtxInfo = &material->getTexGenBlock()->getTexMtx(0)->getTexMtxInfo(); + if (texMtxInfo != NULL) { + Mtx lightMtx; + C_MTXLightPerspective(lightMtx, dComIfGd_getView()->fovy, + dComIfGd_getView()->aspect, 1.0f, 1.0f, -0.01f, 0); + mDoGph_gInf_c::setWideZoomLightProjection(lightMtx); + texMtxInfo->setEffectMtx(lightMtx); + modelData->simpleCalcMaterial(0, (MtxP)j3dDefaultMtx); + } + } + mDoExt_modelUpdateDL(mWaterModels[1]); + } + dComIfGd_setList(); + return 1; } /* 80CC25C0-80CC262C 0010E0 006C+00 1/0 0/0 0/0 .text Delete__15daObjRotStair_cFv */ -void daObjRotStair_c::Delete() { - // NONMATCHING +int daObjRotStair_c::Delete() { + if (mWaterBgw != NULL && mWaterBgw->ChkUsed()) { + dComIfG_Bgsp().Release(mWaterBgw); + } + dComIfG_resDelete(&mPhase, l_arcName); + return 1; } -/* ############################################################################################## */ -/* 80CC2858-80CC2880 00011C 0028+00 1/1 0/0 0/0 .data __vt__15daObjRotStair_c */ -SECTION_DATA extern void* __vt__15daObjRotStair_c[10] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)CreateHeap__15daObjRotStair_cFv, - (void*)Create__15daObjRotStair_cFv, - (void*)Execute__15daObjRotStair_cFPPA3_A4_f, - (void*)Draw__15daObjRotStair_cFv, - (void*)Delete__15daObjRotStair_cFv, - (void*)IsDelete__16dBgS_MoveBgActorFv, - (void*)ToFore__16dBgS_MoveBgActorFv, - (void*)ToBack__16dBgS_MoveBgActorFv, -}; - /* 80CC262C-80CC268C 00114C 0060+00 1/0 0/0 0/0 .text daObjRotStair_create1st__FP15daObjRotStair_c */ -static void daObjRotStair_create1st(daObjRotStair_c* param_0) { - // NONMATCHING +static int daObjRotStair_create1st(daObjRotStair_c* i_this) { + fopAcM_SetupActor(i_this, daObjRotStair_c); + return i_this->create1st(); } /* 80CC268C-80CC26AC 0011AC 0020+00 1/0 0/0 0/0 .text * daObjRotStair_MoveBGDelete__FP15daObjRotStair_c */ -static void daObjRotStair_MoveBGDelete(daObjRotStair_c* param_0) { - // NONMATCHING +static int daObjRotStair_MoveBGDelete(daObjRotStair_c* i_this) { + return i_this->MoveBGDelete(); } /* 80CC26AC-80CC26CC 0011CC 0020+00 1/0 0/0 0/0 .text * daObjRotStair_MoveBGExecute__FP15daObjRotStair_c */ -static void daObjRotStair_MoveBGExecute(daObjRotStair_c* param_0) { - // NONMATCHING +static int daObjRotStair_MoveBGExecute(daObjRotStair_c* i_this) { + return i_this->MoveBGExecute(); } /* 80CC26CC-80CC26F8 0011EC 002C+00 1/0 0/0 0/0 .text * daObjRotStair_MoveBGDraw__FP15daObjRotStair_c */ -static void daObjRotStair_MoveBGDraw(daObjRotStair_c* param_0) { - // NONMATCHING +static int daObjRotStair_MoveBGDraw(daObjRotStair_c* i_this) { + return i_this->Draw(); } + +/* 80CC27FC-80CC281C -00001 0020+00 1/0 0/0 0/0 .data daObjRotStair_METHODS */ +static actor_method_class daObjRotStair_METHODS = { + (process_method_func)daObjRotStair_create1st, + (process_method_func)daObjRotStair_MoveBGDelete, + (process_method_func)daObjRotStair_MoveBGExecute, + NULL, + (process_method_func)daObjRotStair_MoveBGDraw, +}; + +/* 80CC281C-80CC284C -00001 0030+00 0/0 0/0 1/0 .data g_profile_Obj_RotStair */ +extern actor_process_profile_definition g_profile_Obj_RotStair = { + fpcLy_CURRENT_e, // mLayerID + 3, // mListID + fpcPi_CURRENT_e, // mListPrio + PROC_Obj_RotStair, // mProcName + &g_fpcLf_Method.base, // sub_method + sizeof(daObjRotStair_c), // mSize + 0, // mSizeOther + 0, // mParameters + &g_fopAc_Method.base, // sub_method + 613, // mPriority + &daObjRotStair_METHODS, // sub_method + 0x00040100, // mStatus + fopAc_ACTOR_e, // mActorType + fopAc_CULLBOX_CUSTOM_e, // cullType +}; + /* 80CC2730-80CC2730 000030 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */