diff --git a/include/SSystem/SComponent/c_math.h b/include/SSystem/SComponent/c_math.h index ae0d798509..767f1ddfc0 100644 --- a/include/SSystem/SComponent/c_math.h +++ b/include/SSystem/SComponent/c_math.h @@ -4,10 +4,10 @@ #include "JSystem/JMath/JMATrigonometric.h" #include "dolphin/types.h" -s16 cM_rad2s(float); +s16 cM_rad2s(float rad); u16 U_GetAtanTable(float, float); -s16 cM_atan2s(float, float); -float cM_atan2f(float, float); +s16 cM_atan2s(float y, float x); +float cM_atan2f(float y, float x); void cM_initRnd(int, int, int); float cM_rnd(void); float cM_rndF(float); @@ -17,24 +17,24 @@ float cM_rnd2(void); float cM_rndF2(float); float cM_rndFX2(float); -inline f32 cM_scos(s16 s) { - return JMASCos(s); +inline f32 cM_scos(s16 x) { + return JMASCos(x); } -inline f32 cM_ssin(s16 s) { - return JMASSin(s); +inline f32 cM_ssin(s16 x) { + return JMASSin(x); } -inline s16 cM_deg2s(f32 val) { - return val * 182.04445f; +inline s16 cM_deg2s(f32 deg) { + return deg * 182.04445f; } -inline s16 i_cM_deg2s(f32 val) { - return val; +inline s16 i_cM_deg2s(f32 deg) { + return deg; } -inline f32 cM_fsin(f32 v) { - return JMASSin(cM_rad2s(v)); +inline f32 cM_fsin(f32 x) { + return JMASSin(cM_rad2s(x)); } inline f32 cM_sht2d(f32 v) { diff --git a/include/d/d_stage.h b/include/d/d_stage.h index 77a8dd91c8..491a769ec5 100644 --- a/include/d/d_stage.h +++ b/include/d/d_stage.h @@ -223,7 +223,10 @@ public: /* 0x1C */ s16 field_0x1c; }; // Size: 0x20 -struct dStage_MemoryMap_c {}; +struct dStage_MemoryMap_c { + /* 0x0 */ int m_num; + /* 0x4 */ u32* field_0x4; +}; struct dPath; struct dStage_dPath_c { @@ -300,7 +303,15 @@ struct dStage_Elst_c { /* 0x4 */ unkData* field_0x4; }; -struct dStage_MemoryConfig_c {}; +struct dStage_MemoryConfig_data { + /* 0x0 */ u8 m_roomNo; + /* 0x1 */ u8 m_blockID; +}; // Size: 0x2 + +struct dStage_MemoryConfig_c { + /* 0x0 */ int m_num; + /* 0x4 */ dStage_MemoryConfig_data* field_0x4; +}; struct dStage_DMap_c { // DMAP @@ -791,6 +802,11 @@ public: static u32 getProcID() { return mProcID; } static void setStatusProcID(int i_roomNo, unsigned int i_id) { mStatus[i_roomNo].mProcID = i_id; } static int getStatusProcID(int i_roomNo) { return mStatus[i_roomNo].mProcID; } + + static void setMemoryBlockID(int i_roomNo, int i_blockID) { + mStatus[i_roomNo].mMemBlockID = i_blockID; + } + static void setFileList2(int i_roomNo, dStage_FileList2_dt_c* list) { mStatus[i_roomNo].mRoomDt.mFileList2Info = list; } diff --git a/include/d/map/d_map_path.h b/include/d/map/d_map_path.h index 2d0fef74e1..30dd6eb822 100644 --- a/include/d/map/d_map_path.h +++ b/include/d/map/d_map_path.h @@ -8,40 +8,40 @@ class dDrawPath_c : public dDlst_base_c { public: struct line_class { - /* 0x00 */ u8 unk0; - /* 0x01 */ u8 unk1; - /* 0x02 */ u8 unk2; - /* 0x03 */ u8 unk3; - /* 0x04 */ u16* unk4; + /* 0x00 */ u8 field_0x0; + /* 0x01 */ u8 field_0x1; + /* 0x02 */ u8 mDataNum; + /* 0x03 */ u8 field_0x3; + /* 0x04 */ u16* mpData; }; // Size: 0x8 struct poly_class { /* 0x00 */ u8 field_0x0; - /* 0x01 */ u8 field_0x1; - /* 0x04 */ u16* field_0x4; + /* 0x01 */ u8 mDataNum; + /* 0x04 */ u16* mpData; }; // Size: 0x8 struct group_class { /* 0x00 */ u8 field_0x0; /* 0x01 */ u8 field_0x1; - /* 0x02 */ u8 field_0x2; + /* 0x02 */ u8 mLineNum; /* 0x03 */ u8 field_0x3; - /* 0x04 */ u8 field_0x4; + /* 0x04 */ u8 mPolyNum; /* 0x08 */ dDrawPath_c::line_class* mpLine; /* 0x0C */ u8 field_0xc[4]; /* 0x10 */ dDrawPath_c::poly_class* mpPoly; }; // Size: 0x14 struct floor_class { - /* 0x0 */ s8 field_0x0; - /* 0x1 */ u8 field_0x1; + /* 0x0 */ s8 mFloorNo; + /* 0x1 */ u8 mGroupNum; /* 0x4 */ dDrawPath_c::group_class* mpGroup; }; // Size: 0x8 struct room_class { - /* 0x0 */ u8 field_0x0; + /* 0x0 */ u8 mFloorNum; /* 0x4 */ dDrawPath_c::floor_class* mpFloor; - /* 0x8 */ void* field_0x8; + /* 0x8 */ f32* mpFloatData; // might be Vec or cXyz instead }; /* 8003CB00 */ void rendering(dDrawPath_c::group_class const*); diff --git a/include/d/map/d_map_path_fmap.h b/include/d/map/d_map_path_fmap.h index a6528f5bca..4aa8f432bf 100644 --- a/include/d/map/d_map_path_fmap.h +++ b/include/d/map/d_map_path_fmap.h @@ -1,6 +1,161 @@ #ifndef D_MAP_D_MAP_PATH_FMAP_H #define D_MAP_D_MAP_PATH_FMAP_H -#include "dolphin/types.h" +#include "d/map/d_map_path.h" +#include "d/d_tresure.h" +#include "d/d_stage.h" + +class fmpTresTypeGroupData_c { +public: + fmpTresTypeGroupData_c() { + mpTresData = NULL; + mpNext = NULL; + } + + /* 8003EB70 */ ~fmpTresTypeGroupData_c(); + + void setTypeGroupNo(u8 i_no) { mTypeGroupNo = i_no; } + void setNextData(fmpTresTypeGroupData_c* i_next) { mpNext = i_next; } + void setTresData(const dTres_c::data_s* i_data) { mpTresData = i_data; } + const dTres_c::data_s* getTresData() { return mpTresData; } + fmpTresTypeGroupData_c* getNextData() { return mpNext; } + + /* 0x0 */ const dTres_c::data_s* mpTresData; + /* 0x0 */ fmpTresTypeGroupData_c* mpNext; + /* 0x8 */ u8 mTypeGroupNo; +}; // Size: 0xC + +class fmpTresTypeGroupDataList_c { +public: + /* 8003D790 */ void addTypeGroupData(u8, dTres_c::data_s const*); + /* 8003EB10 */ ~fmpTresTypeGroupDataList_c(); + /* 8003EC90 */ fmpTresTypeGroupDataList_c(); + + /* 0x0 */ fmpTresTypeGroupData_c* mpTypeGroupDataHead; + /* 0x4 */ fmpTresTypeGroupData_c* mpNextData; +}; + +class fmpTresTypeGroupDataListAll_c { +public: + void addTypeGroupData(u8 i_typeGroupNo, const dTres_c::data_s* i_data) { + mpTypeGroupData[i_typeGroupNo].addTypeGroupData(i_typeGroupNo, i_data); + } + + /* 0x0 */ fmpTresTypeGroupDataList_c mpTypeGroupData[17]; +}; + +class dMenu_Fmap_data_c { +public: + dTres_c::list_class* getTresure() { return mp_tresure; } + f32 getFilelist2MinX() { return m_fileList2->mLeftRmX; } + f32 getFilelist2MinZ() { return m_fileList2->mInnerRmZ; } + f32 getFilelist2MaxX() { return m_fileList2->mRightRmX; } + f32 getFilelist2MaxZ() { return m_fileList2->mFrontRmZ; } + + void setFileList2(dStage_FileList2_dt_c* i_fileList) { m_fileList2 = i_fileList; } + void setTresure(dTres_c::list_class* i_list) { mp_tresure = i_list; } + void setMapPath(dDrawPath_c::room_class* i_path) { mp_mapPath = i_path; } + + /* 0x0 */ dTres_c::list_class* mp_tresure; + /* 0x4 */ dStage_FileList2_dt_c* m_fileList2; + /* 0x8 */ dDrawPath_c::room_class* mp_mapPath; + /* 0xC */ void* mp_dzsData; +}; + +class dMenu_Fmap_stage_data_c; +class dMenu_Fmap_room_data_c { +public: + /* 8003D818 */ bool isArrival(); + /* 8003D868 */ void buildTresTypeGroup(int, int, int); + /* 8003D92C */ void buildFmapRoomData(int, int, f32, f32, f32, f32); + + f32 getFileList2MinX() { return mp_fmapData->getFilelist2MinX(); } + f32 getFileList2MinZ() { return mp_fmapData->getFilelist2MinZ(); } + f32 getFileList2MaxX() { return mp_fmapData->getFilelist2MaxX(); } + f32 getFileList2MaxZ() { return mp_fmapData->getFilelist2MaxZ(); } + dMenu_Fmap_room_data_c* getNextData() { return mp_nextData; } + int getRoomNo() { return m_roomNo; } + + /* 0x00 */ dMenu_Fmap_data_c* mp_fmapData; + /* 0x04 */ fmpTresTypeGroupDataListAll_c* mp_fmpTresTypeGroupDataListAll; + /* 0x08 */ dMenu_Fmap_room_data_c* mp_nextData; + /* 0x0C */ dMenu_Fmap_stage_data_c* mp_parentStage; + /* 0x10 */ u8 m_roomNo; +}; + +class dMenu_Fmap_stage_arc_data_c { +public: + u8 getVisitedRoomSaveTableNo() { return mVisitedRoomSaveTableNo; } + + /* 0x0 */ u8 field_0x0; + /* 0x1 */ u8 mSaveTableNo; + /* 0x2 */ u8 mVisitedRoomSaveTableNo; +}; + +class dMenu_Fmap_stage_data_c { +public: + /* 8003D95C */ bool isArrival(); + /* 8003D9D8 */ int buildFmapStageData(int, f32, f32); + + dMenu_Fmap_stage_arc_data_c* getStageArc() { return mpStageArc; } + dMenu_Fmap_stage_data_c* getNextData() { return mpNextData; } + + /* 0x00 */ char name[8]; + /* 0x08 */ dMenu_Fmap_stage_arc_data_c* mpStageArc; + /* 0x0C */ dMenu_Fmap_room_data_c* mp_roomTop; + /* 0x10 */ dMenu_Fmap_stage_data_c* mpNextData; + /* 0x14 */ f32 m_offsetX; + /* 0x18 */ f32 m_offsetZ; + /* 0x1C */ f32 m_stageMinX; + /* 0x20 */ f32 m_stageMinZ; + /* 0x24 */ f32 m_stageMaxX; + /* 0x28 */ f32 m_stageMaxZ; + /* 0x2C */ int m_stageCntNo; +}; + +class dMenu_Fmap_region_data_c { +public: + /* 8003DB48 */ dMenu_Fmap_stage_data_c* getMenuFmapStageData(int); + /* 8003DB70 */ void getPointStagePathInnerNo(f32, f32, int, int*, int*); + /* 8003DEE0 */ void buildFmapRegionData(int); + + /* 0x00 */ dMenu_Fmap_stage_data_c* mpMenuFmapStageDataTop; + /* 0x04 */ dMenu_Fmap_region_data_c* mpNextData; + /* 0x08 */ f32 mRegionOffsetX; + /* 0x0C */ f32 mRegionOffsetZ; + /* 0x10 */ f32 mRegionMinX; + /* 0x14 */ f32 mRegionMaxX; + /* 0x18 */ f32 mRegionMinZ; + /* 0x1C */ f32 mRegionMaxZ; + /* 0x20 */ int mRegionNo; +}; + +struct dMenu_Fmap_world_data_c { + /* 8003E028 */ void create(dMenu_Fmap_region_data_c*); + /* 8003E04C */ void buildFmapWorldData(); + + /* 0x00 */ dMenu_Fmap_region_data_c* mp_fmapRegionData; + /* 0x04 */ f32 m_worldMinX; + /* 0x08 */ f32 m_worldMinZ; + /* 0x0C */ f32 m_worldMaxX; + /* 0x10 */ f32 m_worldMaxZ; +}; + +struct dMenuFmapIconPointer_c { + /* 8003E114 */ void init(dMenu_Fmap_region_data_c*, dMenu_Fmap_stage_data_c*, u8, int, int); + /* 8003E1C0 */ void getFirstData(); + /* 8003E2BC */ void getData(); + /* 8003E350 */ void getFirstRoomData(); + /* 8003E37C */ void getNextRoomData(); + /* 8003E3A4 */ void getNextStageData(); + /* 8003E3D8 */ void getNextData(); + /* 8003E490 */ void nextData(); + /* 8003E510 */ void getValidData(); +}; + +struct dMenuFmapIconDisp_c { + /* 8003E578 */ void getPosition(int*, int*, f32*, f32*, dTres_c::data_s const**); + /* 8003E6E8 */ void isDrawDisp(); +}; #endif /* D_MAP_D_MAP_PATH_FMAP_H */ diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index 97a4eaf976..51b0b19cd5 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/b/d_a_b_ob/d_a_b_ob.h b/include/rel/d/a/b/d_a_b_ob/d_a_b_ob.h index fde7bd6916..3a7d9cc13b 100644 --- a/include/rel/d/a/b/d_a_b_ob/d_a_b_ob.h +++ b/include/rel/d/a/b/d_a_b_ob/d_a_b_ob.h @@ -70,7 +70,7 @@ public: /* 0x4738 */ int field_0x4738; /* 0x4738 */ u8 field_0x473c; /* 0x4740 */ f32 field_0x4740; - /* 0x4744 */ u8 field_0x4744; + /* 0x4744 */ s8 field_0x4744; /* 0x4745 */ u8 field_0x4745; /* 0x4748 */ u32 field_0x4748; /* 0x474C */ u8 field_0x474c; @@ -158,7 +158,8 @@ public: /* 0x5D08 */ s16 field_0x5d08; /* 0x5D0A */ s16 field_0x5d0a; /* 0x5D0C */ s16 field_0x5d0c; - /* 0x5D0E */ u8 field_0x5d0e[0x5d11 - 0x5d0e]; + /* 0x5D0E */ u8 field_0x5d0e[0x5d10 - 0x5d0e]; + /* 0x5D10 */ u8 field_0x5d10; /* 0x5D11 */ s8 field_0x5d11; /* 0x5D12 */ s8 field_0x5d12; /* 0x5D14 */ f32 field_0x5d14; diff --git a/include/rel/d/a/b/d_a_b_oh/d_a_b_oh.h b/include/rel/d/a/b/d_a_b_oh/d_a_b_oh.h index 23d6c7400a..889275d695 100644 --- a/include/rel/d/a/b/d_a_b_oh/d_a_b_oh.h +++ b/include/rel/d/a/b/d_a_b_oh/d_a_b_oh.h @@ -1,6 +1,80 @@ #ifndef D_A_B_OH_H #define D_A_B_OH_H -#include "dolphin/types.h" +#include "f_op/f_op_actor_mng.h" +#include "d/cc/d_cc_d.h" +#include "d/cc/d_cc_uty.h" + +class daB_OH_HIO_c { +public: + /* 8061B72C */ daB_OH_HIO_c(); + /* 8061D93C */ virtual ~daB_OH_HIO_c(); + + /* 0x4 */ s8 field_0x4; + /* 0x8 */ f32 mModelSize; + /* 0xC */ f32 mLength; +}; + +class b_oh_class : public fopEn_enemy_c { +public: + /* 0x05AC */ request_of_phase_process_class mPhase; + /* 0x05B4 */ mDoExt_McaMorf* mpMorf; + /* 0x05B8 */ mDoExt_invisibleModel mInvisModel; + /* 0x05C0 */ mDoExt_btkAnm* mpBtk; + /* 0x05C4 */ mDoExt_brkAnm* mpBrk; + /* 0x05C8 */ int field_0x5c8; + /* 0x05CC */ s16 field_0x5cc; + /* 0x05CE */ s16 mAction; + /* 0x05D0 */ s16 mActionPhase; + /* 0x05D2 */ u8 field_0x5D2[0x05E2 - 0x05D2]; + /* 0x05E2 */ s16 mAngleToPlayer; + /* 0x05E4 */ f32 mDistToPlayer; + /* 0x05E8 */ u8 field_0x5E8[0x05EC - 0x05E8]; + /* 0x05EC */ s16 mTimers[4]; + /* 0x05F4 */ s16 field_0x5f4; + /* 0x05F6 */ s16 field_0x5f6; + /* 0x05F8 */ s16 field_0x5f8; + /* 0x05FA */ s16 field_0x5fa; + /* 0x05FC */ f32 field_0x5fc; + /* 0x0600 */ f32 field_0x600; + /* 0x0604 */ f32 field_0x604; + /* 0x0608 */ f32 field_0x608; + /* 0x060C */ f32 field_0x60c; + /* 0x0610 */ f32 field_0x610; + /* 0x0614 */ f32 field_0x614; + /* 0x0618 */ f32 mTentacleLength; + /* 0x061C */ csXyz field_0x61c[30]; + /* 0x06D0 */ csXyz field_0x6d0[30]; + /* 0x0784 */ csXyz field_0x784[30]; + /* 0x0838 */ csXyz field_0x838[30]; + /* 0x08EC */ f32 field_0x8ec[30]; + /* 0x0964 */ f32 field_0x964[30]; + /* 0x09DC */ f32 field_0x9dc[30]; + /* 0x0A54 */ u8 field_0xa54[0xA58 - 0xA54]; + /* 0x0A58 */ cXyz field_0xa58[31]; + /* 0x0BCC */ csXyz field_0xbcc[31]; + /* 0x0C86 */ u8 field_0xC86[0x0C88 - 0x0C86]; + /* 0x0C88 */ int field_0xc88; + /* 0x0C8C */ f32 field_0xc8c; + /* 0x0C90 */ f32 field_0xc90; + /* 0x0C94 */ s16 field_0xc94; + /* 0x0C96 */ s16 field_0xc96; + /* 0x0C98 */ s16 field_0xc98; + /* 0x0C9A */ u8 field_0xC9A[0x0C9C - 0x0C9A]; + /* 0x0C9C */ f32 field_0xc9c; + /* 0x0CA0 */ s16 field_0xca0; + /* 0x0CA2 */ s16 field_0xca2; + /* 0x0CA4 */ s16 field_0xca4; + /* 0x0CA6 */ u8 field_0xCA6[0x0CA8 - 0x0CA6]; + /* 0x0CA8 */ int field_0xca8; + /* 0x0CAC */ f32 field_0xcac; + /* 0x0CB0 */ dCcD_Stts mCcStts; + /* 0x0CEC */ dCcD_Sph mColliders[15]; + /* 0x1F34 */ dCcU_AtInfo mAtInfo; + /* 0x1F58 */ u8 field_0x1F58[0x1F80 - 0x1F58]; + /* 0x1F80 */ u32 field_0x1f80; + /* 0x1F84 */ u8 field_0x1F84[0x1F86 - 0x1F84]; + /* 0x1F86 */ u8 field_0x1f86; +}; #endif /* D_A_B_OH_H */ 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 392a5ac7fc..445f69a430 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/include/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor.h b/include/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor.h index 305fcf3988..dedfcb41c0 100644 --- a/include/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor.h +++ b/include/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor.h @@ -1,6 +1,39 @@ #ifndef D_A_OBJ_LV4FLOOR_H #define D_A_OBJ_LV4FLOOR_H -#include "dolphin/types.h" +#include "d/bg/d_bg_s_movebg_actor.h" +#include "f_op/f_op_actor_mng.h" + +class daObjLv4Floor_c : public dBgS_MoveBgActor { +public: + enum Action_e { + MODE_WAIT_e, + MODE_MOVE_e, + MODE_DEAD_e, + }; + + /* 80C677F8 */ void initBaseMtx(); + /* 80C67834 */ void setBaseMtx(); + /* 80C67944 */ int create1st(); + /* 80C67A30 */ void action(); + /* 80C67AD4 */ void mode_wait(); + /* 80C67B28 */ void mode_init_move(); + /* 80C67B40 */ void mode_move(); + /* 80C67BA8 */ void mode_init_dead(); + /* 80C67BB4 */ void mode_dead(); + + /* 80C678D4 */ virtual int CreateHeap(); + /* 80C678B0 */ virtual int Create(); + /* 80C679E4 */ virtual int Execute(f32 (**)[3][4]); + /* 80C67BD4 */ virtual int Draw(); + /* 80C67C78 */ virtual int Delete(); + + u8 getSwbit() { return fopAcM_GetParamBit(this, 0, 8) & 0xFF; } + + /* 0x5A0 */ request_of_phase_process_class mPhase; + /* 0x5A8 */ J3DModel* mpModel; + /* 0x5AC */ f32 mMoveYPos; + /* 0x5B0 */ u8 mAction; +}; #endif /* D_A_OBJ_LV4FLOOR_H */ diff --git a/rel/d/a/b/d_a_b_oh/d_a_b_oh.cpp b/rel/d/a/b/d_a_b_oh/d_a_b_oh.cpp index bef7468b46..471c075e77 100644 --- a/rel/d/a/b/d_a_b_oh/d_a_b_oh.cpp +++ b/rel/d/a/b/d_a_b_oh/d_a_b_oh.cpp @@ -1,192 +1,24 @@ -// -// Generated By: dol2asm -// Translation Unit: d_a_b_oh -// +/** + * d_a_b_oh.cpp + * Morpheel Tentacle + */ #include "rel/d/a/b/d_a_b_oh/d_a_b_oh.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "SSystem/SComponent/c_math.h" +#include "c/c_damagereaction.h" +#include "d/a/d_a_player.h" +#include "d/com/d_com_inf_game.h" +#include "d/d_procname.h" #include "dol2asm.h" -#include "dolphin/types.h" +#include "rel/d/a/b/d_a_b_ob/d_a_b_ob.h" -// -// Types: -// - -struct request_of_phase_process_class {}; - -struct mDoMtx_stack_c { - /* 8000CE38 */ void scaleM(f32, f32, f32); - - static u8 now[48]; -}; - -struct J3DModel {}; - -struct cXyz { - /* 8061BB18 */ ~cXyz(); - /* 8061D8F8 */ cXyz(); -}; - -struct mDoExt_invisibleModel { - /* 8000E53C */ void create(J3DModel*, u8); - /* 8000E7C0 */ void entryDL(cXyz*); -}; - -struct J3DMaterialTable {}; - -struct J3DAnmTextureSRTKey {}; - -struct mDoExt_btkAnm { - /* 8000D63C */ void init(J3DMaterialTable*, J3DAnmTextureSRTKey*, int, int, f32, s16, s16); - /* 8000D6D8 */ void entry(J3DMaterialTable*, f32); -}; - -struct J3DAnmTevRegKey {}; - -struct mDoExt_brkAnm { - /* 8000D70C */ void init(J3DMaterialTable*, J3DAnmTevRegKey*, int, int, f32, s16, s16); - /* 8000D7A8 */ void entry(J3DMaterialTable*, f32); -}; - -struct mDoExt_baseAnm { - /* 8000D428 */ void play(); -}; - -struct mDoExt_McaMorfCallBack2_c {}; - -struct mDoExt_McaMorfCallBack1_c {}; - -struct Vec {}; - -struct J3DAnmTransform {}; - -struct J3DModelData {}; - -struct mDoExt_McaMorf { - /* 8000FC4C */ mDoExt_McaMorf(J3DModelData*, mDoExt_McaMorfCallBack1_c*, - mDoExt_McaMorfCallBack2_c*, J3DAnmTransform*, int, f32, int, int, - int, void*, u32, u32); - /* 800105C8 */ void play(Vec*, u32, s8); - /* 800106AC */ void modelCalc(); -}; - -struct fopAc_ac_c { - /* 80018B64 */ fopAc_ac_c(); -}; - -struct daB_OH_HIO_c { - /* 8061B72C */ daB_OH_HIO_c(); - /* 8061D93C */ ~daB_OH_HIO_c(); -}; - -struct dVibration_c { - /* 8006FA24 */ void StartShock(int, int, cXyz); -}; - -struct dKy_tevstr_c {}; - -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 dPa_levelEcallBack {}; - -struct csXyz { - /* 8061D8FC */ ~csXyz(); - /* 8061D938 */ csXyz(); -}; - -struct _GXColor {}; - -struct dPa_control_c { - /* 8004C218 */ void setHitMark(u16, fopAc_ac_c*, cXyz const*, csXyz const*, cXyz const*, u32); - /* 8004D4CC */ void set(u32, u8, u16, cXyz const*, dKy_tevstr_c const*, csXyz const*, - cXyz const*, u8, dPa_levelEcallBack*, s8, _GXColor const*, - _GXColor const*, cXyz const*, f32); -}; - -struct dCcU_AtInfo {}; - -struct dCcD_Stts { - /* 80083860 */ void Init(int, int, fopAc_ac_c*); -}; - -struct dCcD_SrcSph {}; - -struct dCcD_Sph { - /* 80084A34 */ void Set(dCcD_SrcSph const&); - /* 8061D718 */ ~dCcD_Sph(); - /* 8061D7E4 */ dCcD_Sph(); -}; - -struct dCcD_GStts { - /* 80083760 */ dCcD_GStts(); - /* 80083830 */ void Move(); -}; - -struct dCcD_GObjInf { - /* 80083A28 */ dCcD_GObjInf(); - /* 800840E4 */ ~dCcD_GObjInf(); - /* 80084460 */ void ChkTgHit(); - /* 800844F8 */ void GetTgHitObj(); - /* 80084658 */ void ChkCoHit(); - /* 800846F0 */ void GetCoHitObj(); -}; - -struct cM3dGSph { - /* 8026F648 */ void SetC(cXyz const&); - /* 8026F708 */ void SetR(f32); - /* 8061D868 */ ~cM3dGSph(); -}; - -struct cM3dGAab { - /* 8061D8B0 */ ~cM3dGAab(); -}; - -struct cCcD_Obj { - /* 80263A48 */ void GetAc(); -}; - -struct cCcS { - /* 80264BA8 */ void Set(cCcD_Obj*); -}; - -struct b_oh_class {}; - -struct JAISoundID {}; - -struct Z2SeMgr { - /* 802AB984 */ void seStart(JAISoundID, Vec const*, u32, s8, f32, f32, f32, f32, u8); -}; - -struct Z2CreatureOI { - /* 802C2C84 */ void startTentacleSound(JAISoundID, u8, u32, s8); -}; - -struct Z2AudioMgr { - static u8 mAudioMgrPtr[4 + 4 /* padding */]; -}; - -struct JMath { - static u8 sincosTable_[65536]; -}; - -struct J3DSys { - static u8 mCurrentMtx[48]; -}; - -struct J3DJoint {}; - -struct J3DFrameCtrl { - /* 803283FC */ void init(s16); - /* 8061D39C */ ~J3DFrameCtrl(); -}; +#define ACTION_START 0 +#define ACTION_WAIT 1 +#define ACTION_ATTACK 2 +#define ACTION_CAUGHT 3 +#define ACTION_END 10 +#define ACTION_NON 11 // // Forward References: @@ -285,8 +117,6 @@ extern "C" void startTentacleSound__12Z2CreatureOIF10JAISoundIDUcUlSc(); extern "C" void* __nw__FUl(); extern "C" void __dl__FPv(); extern "C" void init__12J3DFrameCtrlFs(); -extern "C" void PSMTXCopy(); -extern "C" void PSMTXTrans(); extern "C" void __construct_array(); extern "C" void _savegpr_20(); extern "C" void _savegpr_23(); @@ -304,20 +134,14 @@ extern "C" void _restgpr_26(); extern "C" void _restgpr_27(); extern "C" void _restgpr_28(); 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__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" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" extern u8 g_env_light[4880]; -extern "C" extern u8 j3dSys[284]; extern "C" u8 mCurrentMtx__6J3DSys[48]; extern "C" u8 sincosTable___5JMath[65536]; -extern "C" extern void* calc_mtx[1 + 1 /* padding */]; extern "C" extern u8 struct_80450C98[4]; extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; extern "C" void __register_global_object(); @@ -352,11 +176,19 @@ SECTION_DATA static void* lit_4166[12] = { }; /* 8061DAAC-8061DAEC 000030 0040+00 1/1 0/0 0/0 .data cc_sph_src$4457 */ -SECTION_DATA static u8 cc_sph_src[64] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, - 0xD8, 0xFB, 0xFD, 0xFF, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x70, 0x00, 0x00, +static dCcD_SrcSph cc_sph_src = { + { + {0, {{0, 0, 12}, {0xD8FBFDFF, 3}, 0x15}}, + {dCcD_SE_NONE, 0, 0, 0, {0}}, + {dCcD_SE_NONE, 0, 0, 0, {0x80}}, + {0}, + }, + { + { + {0.0f, 0.0f, 0.0f}, + 60.0f, + }, + }, }; /* 8061DAEC-8061DB0C -00001 0020+00 1/0 0/0 0/0 .data l_daB_OH_Method */ @@ -425,24 +257,55 @@ SECTION_RODATA static f32 const lit_3692 = -100.0f; COMPILER_STRIP_GATE(0x8061D9DC, &lit_3692); /* 8061B75C-8061B8B0 00011C 0154+00 1/1 0/0 0/0 .text nodeCallBack__FP8J3DJointi */ +// matches with literals +#ifdef NONMATCHING +static int nodeCallBack(J3DJoint* param_0, int param_1) { + if (param_1 == 0) { + int jnt_no = param_0->getJntNo(); + J3DModel* model_p = j3dSys.getModel(); + b_oh_class* this_ = (b_oh_class*)model_p->getUserArea(); + + if (this_ != NULL && jnt_no >= this_->field_0xca8 && jnt_no <= 29) { + PSMTXCopy(model_p->i_getAnmMtx(jnt_no), *calc_mtx); + mDoMtx_YrotM(*calc_mtx, this_->field_0x61c[jnt_no].y + this_->field_0x784[jnt_no].y); + mDoMtx_ZrotM(*calc_mtx, this_->field_0x61c[jnt_no].x + this_->field_0x784[jnt_no].x); + MtxTrans(this_->mTentacleLength + -100.0f, 1.0f, 1.0f, 1); + PSMTXCopy(*calc_mtx, J3DSys::mCurrentMtx); + MtxScale(1.0f, this_->field_0x8ec[jnt_no] + this_->field_0x9dc[jnt_no], + this_->field_0x8ec[jnt_no] + this_->field_0x9dc[jnt_no], 1); + model_p->i_setAnmMtx(jnt_no, *calc_mtx); + } + } + + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void nodeCallBack(J3DJoint* param_0, int param_1) { +static asm int nodeCallBack(J3DJoint* param_0, int param_1) { nofralloc #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/nodeCallBack__FP8J3DJointi.s" } #pragma pop +#endif /* 8061B8B0-8061B960 000270 00B0+00 1/0 0/0 0/0 .text daB_OH_Draw__FP10b_oh_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daB_OH_Draw(b_oh_class* param_0) { - nofralloc -#include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/daB_OH_Draw__FP10b_oh_class.s" +static int daB_OH_Draw(b_oh_class* i_this) { + if (i_this->mAction == ACTION_NON) { + return 1; + } + + J3DModel* model_p = i_this->mpMorf->getModel(); + + g_env_light.settingTevStruct(0, &i_this->current.pos, &i_this->mTevStr); + g_env_light.setLightTevColorType_MAJI(model_p, &i_this->mTevStr); + + i_this->mpBtk->entry(model_p->getModelData()); + i_this->mpBrk->entry(model_p->getModelData()); + i_this->mInvisModel.entryDL(NULL); + return 1; } -#pragma pop /* ############################################################################################## */ /* 8061D9E0-8061D9E4 00000C 0004+00 0/1 0/0 0/0 .rodata @3781 */ @@ -577,18 +440,64 @@ static u8 lit_1010[1 + 3 /* padding */]; /* 8061DBB4-8061DBB8 -00001 0004+00 1/2 0/0 0/0 .bss None */ /* 8061DBB4 0001+00 data_8061DBB4 @1009 */ /* 8061DBB5 0003+00 data_8061DBB5 None */ -static u8 struct_8061DBB4[4]; +#pragma push +#pragma force_active on +static u8 struct_8061DBB4; +#pragma pop -/* 8061DBB8-8061DBC4 000048 000C+00 1/1 0/0 0/0 .bss @3645 */ -static u8 lit_3645[12]; +static u8 data_8061DBB5; /* 8061DBC4-8061DBD4 000054 0010+00 2/3 0/0 0/0 .bss l_HIO */ -static u8 l_HIO[16]; +static daB_OH_HIO_c l_HIO; /* 8061DBD4-8061DBD8 000064 0004+00 6/7 0/0 0/0 .bss boss */ -static u8 boss[4]; +static b_ob_class* boss; + +/* 8061DBD8-8061DBDC 000068 0004+00 0/1 0/0 0/0 .bss Cinit */ +#pragma push +#pragma force_active on +static int Cinit; +#pragma pop /* 8061B960-8061BB18 000320 01B8+00 1/1 0/0 0/0 .text start__FP10b_oh_class */ +// matches with literals +#ifdef NONMATCHING +static void start(b_oh_class* i_this) { + cXyz sp28; + + switch (i_this->mActionPhase) { + case 0: + if (boss->field_0x4788 != i_this->field_0x5c8) { + i_this->field_0xcac = -1500.0f; + } else { + i_this->field_0x608 = 0.3f; + i_this->mActionPhase = 1; + } + break; + case 1: + if (i_this->field_0xcac < -100.0f) { + for (int i = 0; i < 28; i++) { + PSMTXCopy(i_this->mpMorf->getModel()->i_getAnmMtx(i), mDoMtx_stack_c::get()); + mDoMtx_stack_c::multVecZero(&sp28); + + if (sp28.y > boss->field_0x47a0) { + sp28.y = boss->field_0x47a0; + i_this->field_0x1f80 = + dComIfGp_particle_set(i_this->field_0x1f80, 0x8808, &sp28, NULL, NULL); + break; + } + } + } + + cLib_addCalc0(&i_this->field_0xcac, 0.1f, 30.0f); + cLib_addCalc2(&i_this->field_0x608, 0.3f, 0.1f, 0.005f); + break; + case 2: + cLib_addCalc2(&i_this->field_0x608, 1.0f, 0.1f, 0.05f); + break; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -597,12 +506,14 @@ static asm void start(b_oh_class* param_0) { #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/start__FP10b_oh_class.s" } #pragma pop +#endif /* 8061BB18-8061BB54 0004D8 003C+00 1/1 0/0 0/0 .text __dt__4cXyzFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm cXyz::~cXyz() { +// asm cXyz::~cXyz() { +extern "C" asm void __dt__4cXyzFv() { nofralloc #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/__dt__4cXyzFv.s" } @@ -631,6 +542,32 @@ COMPILER_STRIP_GATE(0x8061DA00, &lit_3807); #pragma pop /* 8061BB54-8061BC6C 000514 0118+00 1/1 0/0 0/0 .text wait__FP10b_oh_class */ +// matches with literals +#ifdef NONMATCHING +static void wait(b_oh_class* i_this) { + daPy_py_c* player_p = (daPy_py_c*)dComIfGp_getPlayer(0); + + switch (i_this->mActionPhase) { + case 0: + i_this->mActionPhase = 1; + i_this->mTimers[0] = (s16)(cM_rndF(30.0f) + 60.0f); + break; + case 1: + cLib_addCalc2(&i_this->field_0x608, 1.0f, 0.1f, 0.005f); + + if (i_this->field_0xca8 == 0 && player_p->current.pos.y < -23000.0f && + i_this->mDistToPlayer < 1300.0f && i_this->mTimers[0] == 0 && + boss->field_0x4744 == 0 && boss->field_0x4794 == 0) + { + i_this->mAction = ACTION_ATTACK; + i_this->mActionPhase = 0; + i_this->field_0xc98 = 0; + boss->field_0x4794 = 3; + } + break; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -639,6 +576,7 @@ static asm void wait(b_oh_class* param_0) { #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/wait__FP10b_oh_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8061DA04-8061DA08 000030 0004+00 0/2 0/0 0/0 .rodata @3870 */ @@ -745,6 +683,125 @@ COMPILER_STRIP_GATE(0x8061DA38, &lit_3883); #pragma pop /* 8061BC6C-8061C070 00062C 0404+00 1/1 0/0 0/0 .text attack__FP10b_oh_class */ +// matches with literals +#ifdef NONMATCHING +static void attack(b_oh_class* i_this) { + daPy_py_c* player_p = (daPy_py_c*)dComIfGp_getPlayer(0); + i_this->field_0xca0++; + + switch (i_this->mActionPhase) { + case 0: + i_this->mActionPhase = 1; + i_this->field_0xc9c = 0.0f; + i_this->field_0xca2 = 0; + i_this->field_0xca4 = 0; + + if ((s16)(i_this->mAngleToPlayer - i_this->current.angle.y) > 0) { + i_this->field_0xc88 = 1; + } else { + i_this->field_0xc88 = -1; + } + + i_this->mActionPhase = 2; + i_this->mTimers[0] = 100; + i_this->field_0xca0 = 0; + i_this->field_0xc98 = 0; + case 1: + case 2: + if (i_this->mTimers[0] == 0) { + i_this->mAction = ACTION_WAIT; + i_this->mActionPhase = 0; + i_this->field_0xc98 = 0; + i_this->field_0xca2 = 0; + return; + } + case 3: + cLib_addCalcAngleS2(&i_this->field_0xc98, 0x200, 1, 32); + + if (i_this->field_0xca0 > 8) { + cLib_addCalc2(&i_this->field_0xc90, -0.12f, 0.8f, 0.02f); + } + + if (i_this->field_0xca0 < 70) { + cLib_addCalcAngleS2(&i_this->field_0xca4, 0, 1, 500); + cLib_addCalcAngleS2(&i_this->current.angle.y, + i_this->mAngleToPlayer + i_this->field_0xc88 * -0x600, 2, 0x400); + cLib_addCalc2(&i_this->field_0xc9c, 200.0f, 0.5f, 50.0f); + + if (i_this->field_0xca0 < 30) { + f32 fvar = player_p->current.pos.y - -24000.0f; + if (fvar > 1000.0f) { + fvar = 1000.0f; + } + + i_this->field_0xc96 = fvar + 3700.0f; + + cLib_addCalcAngleS2(&i_this->current.angle.x, + (s16)(-fvar * 2.0f + 11700.0f) - 0x4000, 1, 1000); + } + } else { + s16 var7; + s16 var3; + + if (i_this->mTimers[1] != 0) { + var7 = 6; + var3 = i_this->field_0xc88 * 9000; + } else { + var7 = 10; + var3 = i_this->field_0xc88 * 5000; + } + + cLib_addCalcAngleS2(&i_this->field_0xca2, var7, 1, 1); + cLib_addCalcAngleS2(&i_this->field_0xca4, var3, 1, 500); + + if (i_this->mTimers[1] == 0 || i_this->mTimers[1] > 10) { + i_this->current.angle.y += (s16)(i_this->field_0xc88 * 300); + } + + if (i_this->mActionPhase == 2) { + for (int i = 7; i < 15; i++) { + if (i_this->mColliders[i].ChkCoHit()) { + cCcD_Obj* obj_p = i_this->mColliders[i].GetCoHitObj(); + if (fopAcM_GetName(obj_p->GetAc()) == PROC_ALINK && + !i_dComIfGp_event_runCheck()) + { + if (!player_p->checkHookshotShootReturnMode() && + boss->field_0x4744 == 0) + { + i_this->mActionPhase = 3; + boss->mDemoAction = 1; + boss->field_0x5ce8 = i_this->field_0x5c8; + i_this->mTimers[1] = 20; + + if (boss->field_0x4752 != 1) { + boss->field_0x4752 = 1; + boss->field_0x4754 = 0; + boss->field_0x4738 = 30; + boss->field_0x473c = 2; + } + + boss->field_0x59e0.startTentacleSound( + Z2SE_EN_OI_TENT_SWING, i_this->field_0x5c8, 0, + dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + break; + } + } + } + } + } + } + + cLib_addCalcAngleS2(&i_this->field_0xc94, 22500, 1, 2000); + cLib_addCalc2(&i_this->field_0xc8c, 4000.0f, 1.0f, 400.0f); + if (i_this->mTimers[1] == 1) { + i_this->mAction = ACTION_CAUGHT; + i_this->mActionPhase = 0; + i_this->field_0xc98 = 0; + } + break; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -753,6 +810,7 @@ static asm void attack(b_oh_class* param_0) { #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/attack__FP10b_oh_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8061DA3C-8061DA40 000068 0004+00 0/1 0/0 0/0 .rodata @3911 */ @@ -763,6 +821,45 @@ COMPILER_STRIP_GATE(0x8061DA3C, &lit_3911); #pragma pop /* 8061C070-8061C1F8 000A30 0188+00 1/1 0/0 0/0 .text caught__FP10b_oh_class */ +// matches with literals +#ifdef NONMATCHING +static void caught(b_oh_class* i_this) { + i_this->field_0x5f4 = 6; + + switch (i_this->mActionPhase) { + case 0: + i_this->mActionPhase = 1; + i_this->mTimers[0] = 10; + i_this->mTimers[1] = 50; + case 1: + i_this->field_0x60c = 500.0f; + cLib_addCalcAngleS2(&i_this->field_0xca2, 6, 1, 1); + cLib_addCalcAngleS2(&i_this->field_0xca4, i_this->field_0xc88 * 9000, 1, 500); + + if (i_this->mTimers[0] == 1) { + boss->field_0x4738 = 21; + boss->field_0x473c = 0; + boss->field_0x59e0.startCreatureVoice(Z2SE_EN_OI_V_EAT, -1); + } + + if (!(i_this->field_0x5cc & 0xF)) { + dComIfGp_getVibration().StartShock(3, 31, cXyz(0.0f, 1.0f, 0.0f)); + } + + if (i_this->mTimers[1] == 0) { + if (boss->mDemoAction != 0) { + boss->mDemoAction = 3; + boss->field_0x5c82 = 0; + } + + i_this->mAction = ACTION_WAIT; + i_this->mActionPhase = 0; + i_this->field_0xc98 = 0; + } + break; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -771,6 +868,7 @@ static asm void caught(b_oh_class* param_0) { #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/caught__FP10b_oh_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8061DA40-8061DA44 00006C 0004+00 0/2 0/0 0/0 .rodata @3921 */ @@ -781,6 +879,26 @@ COMPILER_STRIP_GATE(0x8061DA40, &lit_3921); #pragma pop /* 8061C1F8-8061C298 000BB8 00A0+00 1/1 0/0 0/0 .text end__FP10b_oh_class */ +// matches with literals +#ifdef NONMATCHING +static void end(b_oh_class* i_this) { + i_this->field_0x5f4 = 6; + + switch (i_this->mActionPhase) { + case 0: + i_this->mActionPhase = 1; + i_this->mTimers[0] = 70; + break; + case 1: + cLib_addCalc2(&i_this->field_0x60c, 1000.0f, 1.0f, 150.0f); + + if (i_this->mTimers[0] == 0) { + cLib_addCalc0(&i_this->mTentacleLength, 1.0f, 1.0f); + } + break; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -789,18 +907,214 @@ static asm void end(b_oh_class* param_0) { #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/end__FP10b_oh_class.s" } #pragma pop +#endif /* 8061C298-8061C2C4 000C58 002C+00 1/1 0/0 0/0 .text non__FP10b_oh_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void non(b_oh_class* param_0) { - nofralloc -#include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/non__FP10b_oh_class.s" +static void non(b_oh_class* i_this) { + i_this->field_0x5f4 = 6; + + switch (i_this->mActionPhase) { + case 0: + i_this->mActionPhase = 1; + break; + case 1: + break; + } } -#pragma pop /* 8061C2C4-8061CB4C 000C84 0888+00 2/1 0/0 0/0 .text action__FP10b_oh_class */ +// close-ish +#ifdef NONMATCHING +static void action(b_oh_class* i_this) { + BOOL bvar; + int uvar; + + cXyz local_90; + cXyz cstack_9c; + + i_this->mAngleToPlayer = fopAcM_searchPlayerAngleY(i_this); + i_this->mDistToPlayer = fopAcM_searchPlayerDistance(i_this); + + fopAcM_OffStatus(i_this, 0); + i_this->mAttentionInfo.mFlags = 0; + + uvar = 0; + bvar = true; + + cLib_addCalcAngleS2(&i_this->field_0xc98, 0x800, 1, 0x10); + + switch (i_this->mAction) { + case ACTION_START: + start(i_this); + uvar = 1; + break; + case ACTION_WAIT: + wait(i_this); + uvar = 1; + break; + case ACTION_ATTACK: + attack(i_this); + uvar = 2; + boss->field_0x4794 = 180; + break; + case ACTION_CAUGHT: + caught(i_this); + bvar = false; + uvar = 3; + boss->field_0x4794 = 180; + break; + case ACTION_END: + end(i_this); + uvar = 1; + break; + case ACTION_NON: + non(i_this); + return; + } + + if (boss->field_0x4752 == 2) { + cLib_addCalc2(&i_this->field_0x60c, 500.0f, 1.0f, 80.0f); + } + + if (uvar == 1) { + f32 fvar15 = i_this->field_0x608 * 500.0f; + f32 fvar14 = i_this->field_0x608 * 1500.0f; + s16 tmp = 2000; + + for (int i = i_this->field_0xca8; i < 30; i++) { + f32 fvar = 1.0f; + if (i < 5) { + fvar = i * 0.2f; + } else if (i >= 20) { + fvar = (i - 20) * 0.3f + 1.0f; + } + + i_this->field_0x6d0[i].x = fvar * (fvar15 * cM_ssin(i_this->field_0x5f8 + (i * 1800))); + i_this->field_0x6d0[i].y = fvar * (fvar14 * cM_ssin(i_this->field_0x5fa + (i * 1800))); + + i_this->field_0x838[i].x = + tmp + fvar * (fvar15 * cM_ssin(i_this->field_0x5fa + (i * 7000)) * 0.5f); + i_this->field_0x838[i].y = + fvar * (fvar14 * cM_ssin(i_this->field_0x5f8 + (i * 7000)) * 0.5f); + + tmp -= 200; + if (tmp < 0) { + tmp = 0; + } + + i_this->field_0x964[i] = + i_this->field_0x610 + 1.0f + + i_this->field_0x610 * cM_ssin(i_this->field_0x5f6 + i * -10000); + } + + cLib_addCalcAngleS2(&i_this->current.angle.x, -0xF2C, 4, 100); + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->orig.angle.y, 4, 0x100); + } else if (uvar == 2) { + f32 fvar = i_this->field_0xc8c; + for (int i = i_this->field_0xca8; i < 30; i++) { + if (i >= 30 - i_this->field_0xca2) { + i_this->field_0x6d0[i].y = i_this->field_0xca4; + } else { + i_this->field_0x6d0[i].y = 0; + } + + if (i >= 13) { + fvar *= i_this->field_0xc90 + 1.0f; + } + + i_this->field_0x6d0[i].x = + fvar * cM_ssin(i_this->field_0xc94 + i * i_this->field_0xc96); + + if (i >= 18) { + i_this->field_0x838[i].x = + i_this->field_0xc9c * cM_ssin(i_this->field_0x5cc * 1000 + i * -4000); + } else { + i_this->field_0x838[i].x = 0; + } + + i_this->field_0x838[i].y = 0; + i_this->field_0x964[i] = + i_this->field_0x610 + 1.0f + + i_this->field_0x610 * cM_ssin(i_this->field_0x5f6 + i * -10000); + } + } else if (uvar == 3) { + for (int i = i_this->field_0xca8; i < 30; i++) { + i_this->field_0x838[i].y = 0; + i_this->field_0x838[i].x = 0; + + if (i >= 30 - i_this->field_0xca2) { + i_this->field_0x6d0[i].y = i_this->field_0xca4; + i_this->field_0x6d0[i].x = 0; + i_this->field_0x964[i] = 1.0f; + } else { + i_this->field_0x6d0[i].y = 0; + i_this->field_0x6d0[i].x = 2250; + i_this->field_0x964[i] = + i_this->field_0x610 + 1.0f + + i_this->field_0x610 * cM_ssin(i_this->field_0x5f6 + i * -10000); + } + } + + cLib_addCalcAngleS2(&i_this->current.angle.x, 0xA92, 4, 0x200); + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->orig.angle.y, 4, 0x800); + } + + i_this->field_0x600 = + (-i_this->field_0x614 - i_this->field_0x60c) + cM_ssin(i_this->field_0x5cc * 200) * 100.0f; + i_this->field_0x604 = ((100.0f - i_this->field_0x614) - i_this->field_0x60c) + + cM_ssin(i_this->field_0x5cc * 200) * 100.0f; + i_this->field_0x5f8 += (s16)i_this->field_0x600; + i_this->field_0x5fa += (s16)i_this->field_0x604; + i_this->field_0x5fc = i_this->field_0x60c + 2000.0f; + i_this->field_0x5f6 += (s16)i_this->field_0x5fc; + + cLib_addCalc0(&i_this->field_0x60c, 0.1f, 50.0f); + cLib_addCalc2(&i_this->field_0x610, 0.2f, 0.1f, 0.01f); + + if (uvar <= 3) { + cLib_addCalc2(&i_this->mTentacleLength, l_HIO.mLength, 0.1f, 0.5f); + } + + PSMTXCopy(i_this->mpMorf->getModel()->i_getAnmMtx(i_this->field_0x5c8 + 8), + mDoMtx_stack_c::get()); + mDoMtx_stack_c::multVecZero(&i_this->current.pos); + + local_90.x = i_this->current.pos.x - boss->orig.pos.x; + local_90.z = i_this->current.pos.z - boss->orig.pos.z; + i_this->orig.angle.y = cM_atan2s(local_90.x, local_90.z); + cLib_addCalcAngleS2(&i_this->shape_angle.y, i_this->current.angle.y, 2, 0x2000); + cLib_addCalcAngleS2(&i_this->shape_angle.x, i_this->current.angle.x, 2, 0x2000); + + for (int i = i_this->field_0xca8; i < 30; i++) { + if (Cinit) { + i_this->field_0x61c[i] = i_this->field_0x6d0[i]; + i_this->field_0x784[i] = i_this->field_0x838[i]; + i_this->field_0x8ec[i] = i_this->field_0x964[i]; + } else { + cLib_addCalcAngleS2(&i_this->field_0x61c[i].x, i_this->field_0x6d0[i].x, 2, + i_this->field_0xc98); + cLib_addCalcAngleS2(&i_this->field_0x61c[i].y, i_this->field_0x6d0[i].y, 2, + i_this->field_0xc98); + cLib_addCalcAngleS2(&i_this->field_0x784[i].x, i_this->field_0x838[i].x, 2, + i_this->field_0xc98); + cLib_addCalcAngleS2(&i_this->field_0x784[i].y, i_this->field_0x838[i].y, 2, + i_this->field_0xc98); + cLib_addCalc2(&i_this->field_0x8ec[i], i_this->field_0x964[i], 0.5f, 0.2f); + cLib_addCalc0(&i_this->field_0x9dc[i], 0.1f, 0.2f); + } + } + + for (int i = 0; i < 15; i++) { + if (bvar && boss->mDemoAction == 0) { + i_this->mColliders[i].OnCoSetBit(); + } else { + i_this->mColliders[i].OffCoSetBit(); + } + } + + Cinit = 0; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -809,6 +1123,7 @@ static asm void action(b_oh_class* param_0) { #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/action__FP10b_oh_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8061DA44-8061DA48 000070 0004+00 0/0 0/0 0/0 .rodata @4160 */ @@ -870,6 +1185,60 @@ COMPILER_STRIP_GATE(0x8061DA64, &lit_4216); #pragma pop /* 8061CB4C-8061CD98 00150C 024C+00 1/1 0/0 0/0 .text damage_check__FP10b_oh_class */ +// matches with literals +#ifdef NONMATCHING +static void damage_check(b_oh_class* i_this) { + i_this->mCcStts.Move(); + + if (i_this->field_0x5f4 == 0) { + BOOL bvar = false; + for (int i = 7; i < 15; i++) { + if (i_this->mColliders[i].ChkTgHit()) { + i_this->mAtInfo.mpCollider = i_this->mColliders[i].GetTgHitObj(); + i_this->mHealth = 1000; + cc_at_check(i_this, &i_this->mAtInfo); + + PSMTXCopy(i_this->mpMorf->getModel()->i_getAnmMtx(i * 2 + 1), + mDoMtx_stack_c::get()); + mDoMtx_stack_c::multVecZero(&i_this->mEyePos); + i_dComIfGp_setHitMark(1, i_this, &i_this->mEyePos, NULL, NULL, 0); + mDoAud_seStart(Z2SE_EN_OI_HIT_TENTACLE, &i_this->mEyePos, 0, 0); + + bvar = true; + i_this->field_0x5f4 = 20; + break; + } + } + + if (i_this->mAction == ACTION_ATTACK && boss->field_0x5d10) { + boss->field_0x5d10 = 0; + bvar = true; + } + + if (bvar) { + i_this->field_0x60c = 2000.0f; + i_this->field_0x610 = 0.5f; + + if (i_this->mAction != ACTION_WAIT) { + i_this->mAction = ACTION_WAIT; + i_this->mActionPhase = 0; + i_this->field_0xc98 = 0; + i_this->field_0xca2 = 0; + } + + if (boss->mDemoAction != 0) { + boss->mDemoAction = 100; + boss->field_0x4738 = 30; + boss->field_0x473c = 2; + boss->field_0x4794 = 180; + } + + i_this->field_0x5f4 = 6; + boss->field_0x59e0.startCreatureVoice(Z2SE_EN_OI_V_TENT_DAMAGE, -1); + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -878,6 +1247,7 @@ static asm void damage_check(b_oh_class* param_0) { #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/damage_check__FP10b_oh_class.s" } #pragma pop +#endif /* ############################################################################################## */ /* 8061DA68-8061DA6C 000094 0004+00 0/1 0/0 0/0 .rodata @4297 */ @@ -888,6 +1258,83 @@ COMPILER_STRIP_GATE(0x8061DA68, &lit_4297); #pragma pop /* 8061CD98-8061D05C 001758 02C4+00 2/1 0/0 0/0 .text daB_OH_Execute__FP10b_oh_class */ +// matches with literals +#ifdef NONMATCHING +static int daB_OH_Execute(b_oh_class* i_this) { + if (cDmrNowMidnaTalk()) { + return 1; + } + + if (i_this->field_0x5c8 == 0) { + boss = (b_ob_class*)fopAcM_SearchByID(i_this->mParentPcId); + } + + if (boss == NULL) { + return 1; + } + + if (boss->field_0x4752 == 5 && i_this->mAction != ACTION_END) { + i_this->mAction = ACTION_END; + i_this->mActionPhase = 0; + } + + cXyz collider_center; + + i_this->field_0x5cc++; + + for (int i = 0; i < 4; i++) { + if (i_this->mTimers[i] != 0) { + i_this->mTimers[i]--; + } + } + + if (i_this->field_0x5f4 != 0) { + i_this->field_0x5f4--; + } + + damage_check(i_this); + action(i_this); + + mDoMtx_stack_c::transS(i_this->current.pos.x, i_this->current.pos.y + i_this->field_0xcac, + i_this->current.pos.z); + mDoMtx_stack_c::YrotM(i_this->shape_angle.y); + mDoMtx_stack_c::XrotM(i_this->shape_angle.x); + mDoMtx_stack_c::scaleM(l_HIO.mModelSize, l_HIO.mModelSize, l_HIO.mModelSize); + + J3DModel* model_p = i_this->mpMorf->getModel(); + model_p->i_setBaseTRMtx(mDoMtx_stack_c::get()); + i_this->mpMorf->play(NULL, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this)), 0); + i_this->mpBtk->play(); + i_this->mpBrk->play(); + i_this->mpMorf->modelCalc(); + + int tmp = 1; + if (i_this->mDistToPlayer > 150.0f && i_this->mAction == ACTION_WAIT) { + tmp = i_this->field_0x5cc & 1; + } + + for (int i = 0; i < 15; i++) { + PSMTXCopy(model_p->i_getAnmMtx(tmp + i * 2), mDoMtx_stack_c::get()); + mDoMtx_stack_c::multVecZero(&collider_center); + + if (i_this->mAction >= ACTION_END) { + collider_center.z -= 20000.0f; + } + + i_this->mColliders[i].SetC(collider_center); + + if (i_this->mAction == ACTION_ATTACK) { + i_this->mColliders[i].SetR(l_HIO.mModelSize * 70.0f); + } else { + i_this->mColliders[i].SetR(l_HIO.mModelSize * 50.0f); + } + + dComIfG_Ccsp()->Set(&i_this->mColliders[i]); + } + + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -896,10 +1343,11 @@ static asm void daB_OH_Execute(b_oh_class* param_0) { #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/daB_OH_Execute__FP10b_oh_class.s" } #pragma pop +#endif /* 8061D05C-8061D064 001A1C 0008+00 1/0 0/0 0/0 .text daB_OH_IsDelete__FP10b_oh_class */ -static bool daB_OH_IsDelete(b_oh_class* param_0) { - return true; +static int daB_OH_IsDelete(b_oh_class* i_this) { + return 1; } /* ############################################################################################## */ @@ -910,14 +1358,14 @@ SECTION_DEAD static char const* const stringBase_8061DA74 = "B_oh"; #pragma pop /* 8061D064-8061D0B8 001A24 0054+00 1/0 0/0 0/0 .text daB_OH_Delete__FP10b_oh_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daB_OH_Delete(b_oh_class* param_0) { - nofralloc -#include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/daB_OH_Delete__FP10b_oh_class.s" +static int daB_OH_Delete(b_oh_class* i_this) { + dComIfG_resDelete(&i_this->mPhase, "B_oh"); + if (i_this->field_0x1f86) { + data_8061DBB5 = 0; + } + + return 1; } -#pragma pop /* ############################################################################################## */ /* 8061DA6C-8061DA70 000098 0004+00 0/1 0/0 0/0 .rodata @4438 */ @@ -928,20 +1376,73 @@ COMPILER_STRIP_GATE(0x8061DA6C, &lit_4438); #pragma pop /* 8061D0B8-8061D39C 001A78 02E4+00 1/1 0/0 0/0 .text useHeapInit__FP10fopAc_ac_c */ +// matches with literals +#ifdef NONMATCHING +static int useHeapInit(fopAc_ac_c* i_this) { + b_oh_class* this_ = (b_oh_class*)i_this; + + this_->mpMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("B_oh", 0x29), NULL, + NULL, NULL, 2, 1.0f, 0, -1, 1, NULL, 0, 0x11000284); + if (this_->mpMorf == NULL || this_->mpMorf->getModel() == NULL) { + return 0; + } + + if (!this_->mInvisModel.create(this_->mpMorf->getModel(), 1)) { + return 0; + } + + this_->mpMorf->getModel()->setUserArea((u32)this_); + + for (u16 i = 0; i < this_->mpMorf->getModel()->getModelData()->getJointNum(); i++) { + this_->mpMorf->getModel()->getModelData()->getJointNodePointer(i)->setCallBack( + nodeCallBack); + } + + this_->mpBtk = new mDoExt_btkAnm(); + if (this_->mpBtk == NULL) { + return 0; + } + + J3DAnmTextureSRTKey* btk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("B_oh", 0x36); + if (!this_->mpBtk->init(this_->mpMorf->getModel()->getModelData(), btk, TRUE, 2, 1.0f, 0, -1)) { + return 0; + } + + this_->mpBtk->setFrame(cM_rndF(39.0f)); + this_->mpBtk->setPlaySpeed(cM_rndFX(0.1f) + 1.0f); + + this_->mpBrk = new mDoExt_brkAnm(); + if (this_->mpBrk == NULL) { + return 0; + } + + J3DAnmTevRegKey* brk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("B_oh", 0x2F); + if (!this_->mpBrk->init(this_->mpMorf->getModel()->getModelData(), brk, TRUE, 2, 1.0f, 0, -1)) { + return 0; + } + + this_->mpBrk->setFrame(cM_rndF(39.0f)); + this_->mpBrk->setPlaySpeed(cM_rndFX(0.1f) + 1.0f); + + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void useHeapInit(fopAc_ac_c* param_0) { +static asm int useHeapInit(fopAc_ac_c* param_0) { nofralloc #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/useHeapInit__FP10fopAc_ac_c.s" } #pragma pop +#endif /* 8061D39C-8061D3E4 001D5C 0048+00 1/0 0/0 0/0 .text __dt__12J3DFrameCtrlFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm J3DFrameCtrl::~J3DFrameCtrl() { +// asm J3DFrameCtrl::~J3DFrameCtrl() { +extern "C" asm void __dt__12J3DFrameCtrlFv() { nofralloc #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/__dt__12J3DFrameCtrlFv.s" } @@ -955,13 +1456,66 @@ SECTION_RODATA static f32 const lit_4519 = 65536.0f; COMPILER_STRIP_GATE(0x8061DA70, &lit_4519); #pragma pop -/* 8061DBD8-8061DBDC 000068 0004+00 0/1 0/0 0/0 .bss Cinit */ -#pragma push -#pragma force_active on -static u8 Cinit[4]; -#pragma pop - /* 8061D3E4-8061D718 001DA4 0334+00 1/0 0/0 0/0 .text daB_OH_Create__FP10fopAc_ac_c */ +// matches with literals +#ifdef NONMATCHING +static int daB_OH_Create(fopAc_ac_c* i_this) { + if (!fopAcM_CheckCondition(i_this, 8)) { + new (i_this) b_oh_class(); + fopAcM_OnCondition(i_this, 8); + } + b_oh_class* this_ = (b_oh_class*)i_this; + + int phase = dComIfG_resLoad(&this_->mPhase, "B_oh"); + if (phase == cPhs_COMPLEATE_e) { + this_->field_0x5c8 = fopAcM_GetParam(this_) & 0xFF; + + if (!fopAcM_entrySolidHeap(this_, useHeapInit, 0x23E0)) { + return cPhs_ERROR_e; + } + + if (!data_8061DBB5) { + this_->field_0x1f86 = 1; + data_8061DBB5 = 1; + l_HIO.field_0x4 = -1; + } + + this_->mHealth = 1000; + this_->field_0x560 = 1000; + + this_->field_0x5cc = cM_rndF(65536.0f); + this_->field_0x5f6 = cM_rndF(65536.0f); + this_->field_0x5f8 = cM_rndF(65536.0f); + this_->field_0x5fa = cM_rndF(65536.0f); + this_->field_0x614 = cM_rndF(100.0f) + 400.0f; + + this_->mCcStts.Init(0xFF, 0, this_); + for (int i = 0; i < 15; i++) { + this_->mColliders[i].Set(cc_sph_src); + this_->mColliders[i].SetStts(&this_->mCcStts); + this_->mColliders[i].OnTgNoHitMark(); + } + + this_->current.angle.x = -0x3448; + + if (cDmr_SkipInfo) { + this_->mAction = ACTION_WAIT; + this_->mActionPhase = 1; + this_->mTimers[0] = cM_rndF(100.0f) + 200.0f; + this_->mTentacleLength = l_HIO.mLength; + this_->field_0x608 = 1.0f; + Cinit = 1; + } else { + this_->mAction = ACTION_START; + Cinit = 0; + } + + daB_OH_Execute(this_); + } + + return phase; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -970,12 +1524,14 @@ static asm void daB_OH_Create(fopAc_ac_c* param_0) { #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/daB_OH_Create__FP10fopAc_ac_c.s" } #pragma pop +#endif /* 8061D718-8061D7E4 0020D8 00CC+00 1/1 0/0 0/0 .text __dt__8dCcD_SphFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm dCcD_Sph::~dCcD_Sph() { +// asm dCcD_Sph::~dCcD_Sph() { +extern "C" asm void __dt__8dCcD_SphFv() { nofralloc #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/__dt__8dCcD_SphFv.s" } @@ -985,7 +1541,8 @@ asm dCcD_Sph::~dCcD_Sph() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm dCcD_Sph::dCcD_Sph() { +// asm dCcD_Sph::dCcD_Sph() { +extern "C" asm void __ct__8dCcD_SphFv() { nofralloc #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/__ct__8dCcD_SphFv.s" } @@ -995,7 +1552,8 @@ asm dCcD_Sph::dCcD_Sph() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm cM3dGSph::~cM3dGSph() { +// asm cM3dGSph::~cM3dGSph() { +extern "C" asm void __dt__8cM3dGSphFv() { nofralloc #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/__dt__8cM3dGSphFv.s" } @@ -1005,14 +1563,16 @@ asm cM3dGSph::~cM3dGSph() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm cM3dGAab::~cM3dGAab() { +// asm cM3dGAab::~cM3dGAab() { +extern "C" asm void __dt__8cM3dGAabFv() { nofralloc #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/__dt__8cM3dGAabFv.s" } #pragma pop /* 8061D8F8-8061D8FC 0022B8 0004+00 1/1 0/0 0/0 .text __ct__4cXyzFv */ -cXyz::cXyz() { +// cXyz::cXyz() { +extern "C" void __ct__4cXyzFv() { /* empty function */ } @@ -1020,14 +1580,16 @@ cXyz::cXyz() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm csXyz::~csXyz() { +// asm csXyz::~csXyz() { +extern "C" asm void __dt__5csXyzFv() { nofralloc #include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/__dt__5csXyzFv.s" } #pragma pop /* 8061D938-8061D93C 0022F8 0004+00 1/1 0/0 0/0 .text __ct__5csXyzFv */ -csXyz::csXyz() { +// csXyz::csXyz() { +extern "C" void __ct__5csXyzFv() { /* empty function */ } @@ -1041,21 +1603,6 @@ asm daB_OH_HIO_c::~daB_OH_HIO_c() { } #pragma pop -/* 8061D984-8061D9C0 002344 003C+00 0/0 1/0 0/0 .text __sinit_d_a_b_oh_cpp */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void __sinit_d_a_b_oh_cpp() { - nofralloc -#include "asm/rel/d/a/b/d_a_b_oh/d_a_b_oh/__sinit_d_a_b_oh_cpp.s" -} -#pragma pop - -#pragma push -#pragma force_active on -REGISTER_CTORS(0x8061D984, __sinit_d_a_b_oh_cpp); -#pragma pop - /* ############################################################################################## */ /* 8061DBDC-8061DBE0 00006C 0004+00 0/0 0/0 0/0 .bss * sInstance__40JASGlobalInstance<19JASDefaultBankTable> */ 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 181528d7f1..fced1cab78 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, +}; diff --git a/rel/d/a/obj/d_a_obj_lv4floor/Makefile b/rel/d/a/obj/d_a_obj_lv4floor/Makefile index 1001d4137e..8116aaedd1 100644 --- a/rel/d/a/obj/d_a_obj_lv4floor/Makefile +++ b/rel/d/a/obj/d_a_obj_lv4floor/Makefile @@ -8,12 +8,10 @@ M534_MAP := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_lv4floor.map M534_CPP_FILES := \ rel/executor.cpp \ - rel/d/a/obj/d_a_obj_lv4floor/unknown_translation_unit_bss.cpp \ rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor.cpp \ M534_O_FILES := \ $(BUILD_DIR)/rel/executor.o \ - $(BUILD_DIR)/rel/d/a/obj/d_a_obj_lv4floor/unknown_translation_unit_bss.o \ $(BUILD_DIR)/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor.o \ M534_LIBS := \ diff --git a/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor.cpp b/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor.cpp index 17cb69d4ce..72f24b3ccb 100644 --- a/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor.cpp +++ b/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor.cpp @@ -1,192 +1,44 @@ -// -// Generated By: dol2asm -// Translation Unit: d_a_obj_lv4floor -// +/** + * d_a_obj_lv4floor.cpp + * Moving sand-floor in Stallord Arena + */ #include "rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor.h" -#include "dol2asm.h" -#include "dolphin/types.h" - -// -// Types: -// - -struct request_of_phase_process_class {}; - -struct mDoMtx_stack_c { - static u8 now[48]; -}; - -struct fopAc_ac_c {}; - -struct daObjLv4Floor_c { - /* 80C677F8 */ void initBaseMtx(); - /* 80C67834 */ void setBaseMtx(); - /* 80C678B0 */ void Create(); - /* 80C678D4 */ void CreateHeap(); - /* 80C67944 */ void create1st(); - /* 80C679E4 */ void Execute(f32 (**)[3][4]); - /* 80C67A30 */ void action(); - /* 80C67AD4 */ void mode_wait(); - /* 80C67B28 */ void mode_init_move(); - /* 80C67B40 */ void mode_move(); - /* 80C67BA8 */ void mode_init_dead(); - /* 80C67BB4 */ void mode_dead(); - /* 80C67BD4 */ void Draw(); - /* 80C67C78 */ void Delete(); -}; - -struct dSv_info_c { - /* 80035360 */ void isSwitch(int, int) const; -}; - -struct dKy_tevstr_c {}; - -struct J3DModelData {}; - -struct cXyz {}; - -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 dBgW {}; - -struct cBgS_PolyInfo {}; - -struct csXyz {}; - -struct dBgS_MoveBgActor { - /* 80078624 */ dBgS_MoveBgActor(); - /* 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 J3DModel {}; - -// -// Forward References: -// - -extern "C" void initBaseMtx__15daObjLv4Floor_cFv(); -extern "C" void setBaseMtx__15daObjLv4Floor_cFv(); -extern "C" void Create__15daObjLv4Floor_cFv(); -extern "C" void CreateHeap__15daObjLv4Floor_cFv(); -extern "C" void create1st__15daObjLv4Floor_cFv(); -extern "C" void Execute__15daObjLv4Floor_cFPPA3_A4_f(); -extern "C" void action__15daObjLv4Floor_cFv(); -extern "C" void mode_wait__15daObjLv4Floor_cFv(); -extern "C" void mode_init_move__15daObjLv4Floor_cFv(); -extern "C" void mode_move__15daObjLv4Floor_cFv(); -extern "C" void mode_init_dead__15daObjLv4Floor_cFv(); -extern "C" void mode_dead__15daObjLv4Floor_cFv(); -extern "C" void Draw__15daObjLv4Floor_cFv(); -extern "C" void Delete__15daObjLv4Floor_cFv(); -extern "C" static void daObjLv4Floor_create1st__FP15daObjLv4Floor_c(); -extern "C" static void daObjLv4Floor_MoveBGDelete__FP15daObjLv4Floor_c(); -extern "C" static void daObjLv4Floor_MoveBGExecute__FP15daObjLv4Floor_c(); -extern "C" static void daObjLv4Floor_MoveBGDraw__FP15daObjLv4Floor_c(); -extern "C" extern char const* const d_a_obj_lv4floor__stringBase0; - -// -// External References: -// - -extern "C" void mDoMtx_YrotM__FPA4_fs(); -extern "C" void mDoExt_modelUpdateDL__FP8J3DModel(); -extern "C" void mDoExt_J3DModel__create__FP12J3DModelDataUlUl(); -extern "C" void fopAcM_delete__FP10fopAc_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 isSwitch__10dSv_info_cCFii(); -extern "C" void getRes__14dRes_control_cFPCclP11dRes_info_ci(); -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 settingTevStruct__18dScnKy_env_light_cFiP4cXyzP12dKy_tevstr_c(); -extern "C" void setLightTevColorType_MAJI__18dScnKy_env_light_cFP12J3DModelDataP12dKy_tevstr_c(); -extern "C" void cLib_chaseF__FPfff(); -extern "C" void PSMTXCopy(); -extern "C" void PSMTXTrans(); -extern "C" void __ptmf_scall(); -extern "C" extern void* g_fopAc_Method[8]; -extern "C" extern void* g_fpcLf_Method[5 + 1 /* padding */]; -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" extern u8 data_80C67E80[4]; - -// -// Declarations: -// +#include "JSystem/JKernel/JKRHeap.h" +#include "d/com/d_com_inf_game.h" +#include "d/d_procname.h" /* 80C677F8-80C67834 000078 003C+00 1/1 0/0 0/0 .text initBaseMtx__15daObjLv4Floor_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daObjLv4Floor_c::initBaseMtx() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor/initBaseMtx__15daObjLv4Floor_cFv.s" +void daObjLv4Floor_c::initBaseMtx() { + mpModel->setBaseScale(mScale); + setBaseMtx(); } -#pragma pop /* 80C67834-80C678B0 0000B4 007C+00 2/2 0/0 0/0 .text setBaseMtx__15daObjLv4Floor_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daObjLv4Floor_c::setBaseMtx() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor/setBaseMtx__15daObjLv4Floor_cFv.s" +void daObjLv4Floor_c::setBaseMtx() { + mDoMtx_stack_c::transS(current.pos.x, current.pos.y + mMoveYPos, 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 /* 80C678B0-80C678D4 000130 0024+00 1/0 0/0 0/0 .text Create__15daObjLv4Floor_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daObjLv4Floor_c::Create() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor/Create__15daObjLv4Floor_cFv.s" +int daObjLv4Floor_c::Create() { + initBaseMtx(); + return 1; } -#pragma pop - -/* ############################################################################################## */ -/* 80C67D90-80C67D90 000010 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80C67D90 = "P_L4Floor"; -#pragma pop /* 80C67D9C-80C67DA8 000000 000C+00 1/1 0/0 0/0 .data cNullVec__6Z2Calc */ -SECTION_DATA static u8 cNullVec__6Z2Calc[12] = { +static u8 cNullVec__6Z2Calc[12] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; /* 80C67DA8-80C67DBC 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 */] = { +// unused data? +static u32 lit_1787[1 + 4 /* padding */] = { 0x02000201, /* padding */ 0x40080000, @@ -197,272 +49,160 @@ SECTION_DATA static u32 lit_1787[1 + 4 /* padding */] = { #pragma pop /* 80C67DBC-80C67DC0 -00001 0004+00 3/3 0/0 0/0 .data l_arcName */ -SECTION_DATA static void* l_arcName = (void*)&d_a_obj_lv4floor__stringBase0; +static char* l_arcName = "P_L4Floor"; /* 80C678D4-80C67944 000154 0070+00 1/0 0/0 0/0 .text CreateHeap__15daObjLv4Floor_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daObjLv4Floor_c::CreateHeap() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor/CreateHeap__15daObjLv4Floor_cFv.s" +int daObjLv4Floor_c::CreateHeap() { + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 4); + mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + if (mpModel == NULL) { + return 0; + } + + return 1; } -#pragma pop /* 80C67944-80C679E4 0001C4 00A0+00 1/1 0/0 0/0 .text create1st__15daObjLv4Floor_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daObjLv4Floor_c::create1st() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor/create1st__15daObjLv4Floor_cFv.s" +int daObjLv4Floor_c::create1st() { + int phase = dComIfG_resLoad(&mPhase, l_arcName); + if (phase != cPhs_COMPLEATE_e) { + return phase; + } + + if (i_fopAcM_isSwitch(this, getSwbit())) { + return cPhs_ERROR_e; + } + + phase = MoveBGCreate(l_arcName, 7, dBgS_MoveBGProc_TypicalRotY, 0x4000, NULL); + if (phase == cPhs_ERROR_e) { + return phase; + } + + return phase; } -#pragma pop /* 80C679E4-80C67A30 000264 004C+00 1/0 0/0 0/0 .text Execute__15daObjLv4Floor_cFPPA3_A4_f */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daObjLv4Floor_c::Execute(f32 (**param_0)[3][4]) { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor/Execute__15daObjLv4Floor_cFPPA3_A4_f.s" +int daObjLv4Floor_c::Execute(Mtx** param_0) { + action(); + *param_0 = &field_0x56c; + setBaseMtx(); + + return 1; } -#pragma pop - -/* ############################################################################################## */ -/* 80C67DC0-80C67DCC -00001 000C+00 0/1 0/0 0/0 .data @3678 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_3678[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)mode_wait__15daObjLv4Floor_cFv, -}; -#pragma pop - -/* 80C67DCC-80C67DD8 -00001 000C+00 0/1 0/0 0/0 .data @3679 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_3679[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)mode_move__15daObjLv4Floor_cFv, -}; -#pragma pop - -/* 80C67DD8-80C67DE4 -00001 000C+00 0/1 0/0 0/0 .data @3680 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_3680[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)mode_dead__15daObjLv4Floor_cFv, -}; -#pragma pop - -/* 80C67DE4-80C67E08 000048 0024+00 0/1 0/0 0/0 .data l_func$3677 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_func[36] = { - 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 /* 80C67A30-80C67AD4 0002B0 00A4+00 1/1 0/0 0/0 .text action__15daObjLv4Floor_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daObjLv4Floor_c::action() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor/action__15daObjLv4Floor_cFv.s" +void daObjLv4Floor_c::action() { + typedef void (daObjLv4Floor_c::*actionFunc)(); + static actionFunc l_func[] = {&daObjLv4Floor_c::mode_wait, &daObjLv4Floor_c::mode_move, + &daObjLv4Floor_c::mode_dead}; + + (this->*l_func[mAction])(); } -#pragma pop /* 80C67AD4-80C67B28 000354 0054+00 1/0 0/0 0/0 .text mode_wait__15daObjLv4Floor_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daObjLv4Floor_c::mode_wait() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor/mode_wait__15daObjLv4Floor_cFv.s" +void daObjLv4Floor_c::mode_wait() { + if (i_fopAcM_isSwitch(this, getSwbit())) { + mode_init_move(); + } } -#pragma pop - -/* ############################################################################################## */ -/* 80C67D80-80C67D84 000000 0004+00 2/2 0/0 0/0 .rodata @3704 */ -SECTION_RODATA static u8 const lit_3704[4] = { - 0x00, - 0x00, - 0x00, - 0x00, -}; -COMPILER_STRIP_GATE(0x80C67D80, &lit_3704); /* 80C67B28-80C67B40 0003A8 0018+00 1/1 0/0 0/0 .text mode_init_move__15daObjLv4Floor_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daObjLv4Floor_c::mode_init_move() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor/mode_init_move__15daObjLv4Floor_cFv.s" +void daObjLv4Floor_c::mode_init_move() { + speed.y = 0.0f; + mAction = MODE_MOVE_e; } -#pragma pop - -/* ############################################################################################## */ -/* 80C67D84-80C67D88 000004 0004+00 0/1 0/0 0/0 .rodata @3711 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3711 = 19.0f / 5.0f; -COMPILER_STRIP_GATE(0x80C67D84, &lit_3711); -#pragma pop - -/* 80C67D88-80C67D8C 000008 0004+00 0/1 0/0 0/0 .rodata @3712 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3712 = 2.0f / 25.0f; -COMPILER_STRIP_GATE(0x80C67D88, &lit_3712); -#pragma pop - -/* 80C67D8C-80C67D90 00000C 0004+00 0/1 0/0 0/0 .rodata @3713 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3713 = -1500.0f; -COMPILER_STRIP_GATE(0x80C67D8C, &lit_3713); -#pragma pop /* 80C67B40-80C67BA8 0003C0 0068+00 1/0 0/0 0/0 .text mode_move__15daObjLv4Floor_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daObjLv4Floor_c::mode_move() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor/mode_move__15daObjLv4Floor_cFv.s" +void daObjLv4Floor_c::mode_move() { + cLib_chaseF(&speed.y, 3.8f, 0.08f); + + if (cLib_chaseF(&mMoveYPos, -1500.0f, speed.y)) { + mode_init_dead(); + } } -#pragma pop /* 80C67BA8-80C67BB4 000428 000C+00 1/1 0/0 0/0 .text mode_init_dead__15daObjLv4Floor_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daObjLv4Floor_c::mode_init_dead() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor/mode_init_dead__15daObjLv4Floor_cFv.s" +void daObjLv4Floor_c::mode_init_dead() { + mAction = MODE_DEAD_e; } -#pragma pop /* 80C67BB4-80C67BD4 000434 0020+00 1/0 0/0 0/0 .text mode_dead__15daObjLv4Floor_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daObjLv4Floor_c::mode_dead() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor/mode_dead__15daObjLv4Floor_cFv.s" +void daObjLv4Floor_c::mode_dead() { + fopAcM_delete(this); } -#pragma pop /* 80C67BD4-80C67C78 000454 00A4+00 1/0 0/0 0/0 .text Draw__15daObjLv4Floor_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daObjLv4Floor_c::Draw() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor/Draw__15daObjLv4Floor_cFv.s" +int daObjLv4Floor_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 /* 80C67C78-80C67CAC 0004F8 0034+00 1/0 0/0 0/0 .text Delete__15daObjLv4Floor_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daObjLv4Floor_c::Delete() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor/Delete__15daObjLv4Floor_cFv.s" +int daObjLv4Floor_c::Delete() { + dComIfG_resDelete(&mPhase, l_arcName); + return 1; } -#pragma pop - -/* ############################################################################################## */ -/* 80C67E08-80C67E28 -00001 0020+00 1/0 0/0 0/0 .data daObjLv4Floor_METHODS */ -SECTION_DATA static void* daObjLv4Floor_METHODS[8] = { - (void*)daObjLv4Floor_create1st__FP15daObjLv4Floor_c, - (void*)daObjLv4Floor_MoveBGDelete__FP15daObjLv4Floor_c, - (void*)daObjLv4Floor_MoveBGExecute__FP15daObjLv4Floor_c, - (void*)NULL, - (void*)daObjLv4Floor_MoveBGDraw__FP15daObjLv4Floor_c, - (void*)NULL, - (void*)NULL, - (void*)NULL, -}; - -/* 80C67E28-80C67E58 -00001 0030+00 0/0 0/0 1/0 .data g_profile_Obj_Lv4Floor */ -SECTION_DATA extern void* g_profile_Obj_Lv4Floor[12] = { - (void*)0xFFFFFFFD, (void*)0x0003FFFD, - (void*)0x00C20000, (void*)&g_fpcLf_Method, - (void*)0x000005B4, (void*)NULL, - (void*)NULL, (void*)&g_fopAc_Method, - (void*)0x02480000, (void*)&daObjLv4Floor_METHODS, - (void*)0x00044000, (void*)0x000E0000, -}; - -/* 80C67E58-80C67E80 0000BC 0028+00 1/1 0/0 0/0 .data __vt__15daObjLv4Floor_c */ -SECTION_DATA extern void* __vt__15daObjLv4Floor_c[10] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)CreateHeap__15daObjLv4Floor_cFv, - (void*)Create__15daObjLv4Floor_cFv, - (void*)Execute__15daObjLv4Floor_cFPPA3_A4_f, - (void*)Draw__15daObjLv4Floor_cFv, - (void*)Delete__15daObjLv4Floor_cFv, - (void*)IsDelete__16dBgS_MoveBgActorFv, - (void*)ToFore__16dBgS_MoveBgActorFv, - (void*)ToBack__16dBgS_MoveBgActorFv, -}; /* 80C67CAC-80C67D0C 00052C 0060+00 1/0 0/0 0/0 .text daObjLv4Floor_create1st__FP15daObjLv4Floor_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daObjLv4Floor_create1st(daObjLv4Floor_c* param_0) { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor/daObjLv4Floor_create1st__FP15daObjLv4Floor_c.s" +static int daObjLv4Floor_create1st(daObjLv4Floor_c* i_this) { + if (!fopAcM_CheckCondition(i_this, 8)) { + new (i_this) daObjLv4Floor_c(); + fopAcM_OnCondition(i_this, 8); + } + + return i_this->create1st(); } -#pragma pop /* 80C67D0C-80C67D2C 00058C 0020+00 1/0 0/0 0/0 .text * daObjLv4Floor_MoveBGDelete__FP15daObjLv4Floor_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daObjLv4Floor_MoveBGDelete(daObjLv4Floor_c* param_0) { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor/daObjLv4Floor_MoveBGDelete__FP15daObjLv4Floor_c.s" +static int daObjLv4Floor_MoveBGDelete(daObjLv4Floor_c* i_this) { + return i_this->MoveBGDelete(); } -#pragma pop /* 80C67D2C-80C67D4C 0005AC 0020+00 1/0 0/0 0/0 .text * daObjLv4Floor_MoveBGExecute__FP15daObjLv4Floor_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daObjLv4Floor_MoveBGExecute(daObjLv4Floor_c* param_0) { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor/daObjLv4Floor_MoveBGExecute__FP15daObjLv4Floor_c.s" +static int daObjLv4Floor_MoveBGExecute(daObjLv4Floor_c* i_this) { + return i_this->MoveBGExecute(); } -#pragma pop /* 80C67D4C-80C67D78 0005CC 002C+00 1/0 0/0 0/0 .text * daObjLv4Floor_MoveBGDraw__FP15daObjLv4Floor_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daObjLv4Floor_MoveBGDraw(daObjLv4Floor_c* param_0) { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_lv4floor/d_a_obj_lv4floor/daObjLv4Floor_MoveBGDraw__FP15daObjLv4Floor_c.s" +static int daObjLv4Floor_MoveBGDraw(daObjLv4Floor_c* i_this) { + return i_this->MoveBGDraw(); } -#pragma pop -/* 80C67D90-80C67D90 000010 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ +/* ############################################################################################## */ +/* 80C67E08-80C67E28 -00001 0020+00 1/0 0/0 0/0 .data daObjLv4Floor_METHODS */ +static actor_method_class daObjLv4Floor_METHODS = { + (process_method_func)daObjLv4Floor_create1st, + (process_method_func)daObjLv4Floor_MoveBGDelete, + (process_method_func)daObjLv4Floor_MoveBGExecute, + (process_method_func)NULL, + (process_method_func)daObjLv4Floor_MoveBGDraw, +}; + +/* 80C67E28-80C67E58 -00001 0030+00 0/0 0/0 1/0 .data g_profile_Obj_Lv4Floor */ +extern actor_process_profile_definition g_profile_Obj_Lv4Floor = { + -3, + 3, + -3, + PROC_Obj_Lv4Floor, + &g_fpcLf_Method.mBase, + sizeof(daObjLv4Floor_c), + 0, + 0, + &g_fopAc_Method.base, + 584, + &daObjLv4Floor_METHODS, + 0x44000, + 0, + 14, +}; diff --git a/rel/d/a/obj/d_a_obj_lv4floor/unknown_translation_unit_bss.cpp b/rel/d/a/obj/d_a_obj_lv4floor/unknown_translation_unit_bss.cpp deleted file mode 100644 index d7a32a5812..0000000000 --- a/rel/d/a/obj/d_a_obj_lv4floor/unknown_translation_unit_bss.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// -// Generated By: dol2asm -// Translation Unit: unknown_translation_unit_bss -// - -#include "rel/d/a/obj/d_a_obj_lv4floor/unknown_translation_unit_bss.h" -#include "dol2asm.h" -#include "dolphin/types.h" - -// -// Forward References: -// - -extern "C" extern u8 data_80C67E80[4]; - -// -// External References: -// - -// -// Declarations: -// - -/* ############################################################################################## */ -/* 80C67E80-80C67E84 000000 0004+00 0/0 1/1 0/0 .bss None */ -extern u8 data_80C67E80[4]; -u8 data_80C67E80[4]; diff --git a/src/d/d_resorce.cpp b/src/d/d_resorce.cpp index da00dcdf0a..0ed13bc23d 100644 --- a/src/d/d_resorce.cpp +++ b/src/d/d_resorce.cpp @@ -13,7 +13,6 @@ #include "JSystem/J3DGraphLoader/J3DModelLoader.h" #include "JSystem/JKernel/JKRMemArchive.h" #include "JSystem/JKernel/JKRSolidHeap.h" -#include "m_Do/m_Do_graphic.h" #include "MSL_C/stdio.h" #include "MSL_C/string.h" #include "d/com/d_com_inf_game.h" @@ -22,6 +21,7 @@ #include "dolphin/os/OS.h" #include "dolphin/types.h" #include "global.h" +#include "m_Do/m_Do_graphic.h" // // Types: @@ -257,15 +257,15 @@ static void setAlpha(J3DModelData* pModelData) { /* ############################################################################################## */ /* 80379840-803798A4 005EA0 0064+00 2/2 0/0 0/0 .rodata l_texMtxInfo */ SECTION_RODATA static const J3DTexMtxInfo l_texMtxInfo = { - 0x00, - 0x08, + 0x00, + 0x08, {0.5f, 0.5f, 0.0f}, - { 0.1f, 0.1f, 0, 0.0f, 0.0f}, + {0.1f, 0.1f, 0, 0.0f, 0.0f}, { - { 0.5f, 0.0f, 0.0f, 0.5f }, - { 0.0f, 0.5f, 0.0f, 0.5f }, - { 0.0f, 0.0f, 0.0f, 1.0f }, - { 0.0f, 0.0f, 0.0f, 1.0f }, + {0.5f, 0.0f, 0.0f, 0.5f}, + {0.0f, 0.5f, 0.0f, 0.5f}, + {0.0f, 0.0f, 0.0f, 1.0f}, + {0.0f, 0.0f, 0.0f, 1.0f}, }, }; @@ -384,7 +384,8 @@ void dRes_info_c::offWarpMaterial(J3DModelData* modelData) { /* 8003AD08-8003AE14 035648 010C+00 0/0 1/1 0/0 .text * setWarpSRT__11dRes_info_cFP12J3DModelDataRC4cXyzff */ -void dRes_info_c::setWarpSRT(J3DModelData* modelData, cXyz const& param_1, f32 translationX, f32 translationY) { +void dRes_info_c::setWarpSRT(J3DModelData* modelData, cXyz const& param_1, f32 translationX, + f32 translationY) { J3DMaterial* pMaterial = modelData->getMaterialNodePointer(0); J3DTexGenBlock* texGenBlock = pMaterial->getTexGenBlock(); u32 texGenNum = texGenBlock->getTexGenNum(); @@ -416,72 +417,80 @@ SECTION_DATA static void* lit_4017[8] = { */ // regalloc #ifdef NONMATCHING -J3DModelData* dRes_info_c::loaderBasicBmd(u32 param_1, void* param_2) { - u32 pvVar5 = 0x59020010; +J3DModelData* dRes_info_c::loaderBasicBmd(u32 i_type, void* i_data) { + u32 flags = 0x59020010; J3DMaterial* pMaterial; - J3DModelData* modelData; + J3DModelData* modelData; u8 lightMask; - if (param_1 == 'BMDE' || param_1 == 'BMDV') { - pvVar5 |= 0x20; - } else if (param_1 == 'BMWR' || param_1 == 'BMWE') { - pvVar5 ^= 0x60020; + + if (i_type == 'BMDE' || i_type == 'BMDV') { + flags |= 0x20; + } else if (i_type == 'BMWR' || i_type == 'BMWE') { + flags ^= 0x60020; } - modelData = (J3DModelData*)J3DModelLoaderDataBase::load(param_2, pvVar5); + + modelData = (J3DModelData*)J3DModelLoaderDataBase::load(i_data, flags); if (modelData == NULL) { return NULL; } - if ((param_1 == 'BMDE' || param_1 == 'BMDV') || param_1 == 'BMWE') { + if (i_type == 'BMDE' || i_type == 'BMDV' || i_type == 'BMWE') { for (u16 i = 0; i < modelData->getShapeNum(); i++) { modelData->getShapeNodePointer(i)->setTexMtxLoadType(0x2000); } } + for (u16 i = 0; i < modelData->getMaterialNum(); i++) { pMaterial = modelData->getMaterialNodePointer(i); lightMask = pMaterial->getColorBlock()->getColorChan(0)->getLightMask(); switch (g_env_light.field_0x1308) { case 1: - lightMask &= 4; + lightMask &= 0x4; break; case 2: - lightMask &= 0xc; + lightMask &= 0xC; break; case 3: - lightMask &= 0xd; + lightMask &= 0xD; break; case 4: - lightMask &= 0xf; + lightMask &= 0xF; break; case 5: - lightMask &= 0x1f; + lightMask &= 0x1F; break; case 6: - lightMask &= 0x3f; + lightMask &= 0x3F; break; case 7: - lightMask &= 0x7f; + lightMask &= 0x7F; } + pMaterial->getColorBlock()->getColorChan(0)->setLightMask(lightMask); pMaterial->change(); - J3DMaterialAnm* local_38 = new J3DMaterialAnm(); - if (local_38 == NULL) { + + J3DMaterialAnm* material_anm = new J3DMaterialAnm(); + if (material_anm == NULL) { return NULL; } - pMaterial->setMaterialAnm(local_38); + + pMaterial->setMaterialAnm(material_anm); } + setIndirectTex(modelData); - if ((param_1 == 'BMWR') || (param_1 == 'BMWE')) { + if (i_type == 'BMWR' || i_type == 'BMWE') { addWarpMaterial(modelData); } - if ((param_1 == 'BMDR') || (param_1 == 'BMWR')) { + + if (i_type == 'BMDR' || i_type == 'BMWR') { if (modelData->newSharedDisplayList(0x40000) == 0) { - modelData->simpleCalcMaterial(0, (float (*)[4])j3dDefaultMtx); + modelData->simpleCalcMaterial(0, (MtxP)j3dDefaultMtx); modelData->makeSharedDL(); } else { modelData = NULL; } } - + return modelData; } #else @@ -661,14 +670,14 @@ SECTION_DEAD static char const* const stringBase_80379912 = "<%s> res == NULL !! // J3DXXX ctor/dtor inlines #ifdef NONMATCHING int dRes_info_c::loadResource() { - s32 pJVar4 = mArchive->countFile(); - mRes = new void*[pJVar4]; + s32 file_num = mArchive->countFile(); + mRes = new void*[file_num]; if (mRes == NULL) { - OSReport_Error("<%s.arc> setRes: res pointer buffer nothing !!\n", this); + OSReport_Error("<%s.arc> setRes: res pointer buffer nothing !!\n", mArchiveName); return -1; } - for (int i = 0; i < pJVar4; i++) { + for (int i = 0; i < file_num; i++) { mRes[i] = NULL; } JKRArchive::SDIDirEntry* node = mArchive->mNodes; @@ -678,52 +687,60 @@ int dRes_info_c::loadResource() { u32 firstFileIndex = node->first_file_index; J3DModelData* modelData; void* result; + for (int j = 0; j < node->num_entries; j++) { if (mArchive->isFileEntry(firstFileIndex)) { result = mArchive->getIdxResource(firstFileIndex); + if (result == NULL) { - OSReport_Error("<%s> res == NULL !!\n", mArchive->mStringTable + (mArchive->findIdxResource(firstFileIndex)->type_flags_and_name_offset & 0xFFFFFF)); - } - else if (nodeType == 'ARC ') { - JKRArchive::SDIFileEntry* fileEntry = mArchive->findIdxResource(firstFileIndex); - const char* __s = mArchive->mStringTable + fileEntry->getNameOffset(); - size_t len = strlen(__s) - 4; - char aJStack_24[9]; - strncpy(aJStack_24, __s, len); - aJStack_24[len] = '\0'; - JKRHeap* local_58 = JKRHeap::findFromRoot(JKRHeap::getCurrentHeap()); - JKRHeap* pJVar3 = local_58; - - if (local_58 == (JKRHeap*)mDoExt_getGameHeap()) { - local_58 = NULL; + OSReport_Error( + "<%s> res == NULL !!\n", + mArchive->mStringTable + + (mArchive->findIdxResource(firstFileIndex)->type_flags_and_name_offset & + 0xFFFFFF)); + } else if (nodeType == 'ARC ') { + JKRArchive::SDIFileEntry* entry = mArchive->findIdxResource(firstFileIndex); + + const char* name_p = mArchive->mStringTable + entry->getNameOffset(); + size_t resNameLen = strlen(name_p) - 4; + char arc_name[9]; + strncpy(arc_name, name_p, resNameLen); + arc_name[resNameLen] = '\0'; + + JKRHeap* parentHeap = JKRHeap::findFromRoot(JKRHeap::getCurrentHeap()); + if (parentHeap == (JKRHeap*)mDoExt_getGameHeap()) { + parentHeap = NULL; } - dComIfG_setObjectRes(aJStack_24, result, fileEntry->data_size); + + dComIfG_setObjectRes(arc_name, result, entry->data_size); } else if (nodeType == 'BMDP') { - result = (J3DModelData*) J3DModelLoaderDataBase::load(result, 0x59020030); + result = (J3DModelData*)J3DModelLoaderDataBase::load(result, 0x59020030); if (result == NULL) { return -1; } + modelData = (J3DModelData*)result; for (u16 k = 0; k < modelData->getMaterialNum(); k++) { - J3DMaterial* pMaterial = modelData->getMaterialNodePointer(k); - pMaterial->change(); - J3DMaterialAnm* materialAnm = new J3DMaterialAnm(); - if (materialAnm == (J3DMaterialAnm*)0x0) { + J3DMaterial* material_p = modelData->getMaterialNodePointer(k); + material_p->change(); + + J3DMaterialAnm* material_anm = new J3DMaterialAnm(); + if (material_anm == NULL) { return -1; } - pMaterial->setMaterialAnm(materialAnm); + + material_p->setMaterialAnm(material_anm); } + setAlpha(modelData); if (modelData->newSharedDisplayList(0x40000) != 0) { return -1; } - modelData->simpleCalcMaterial(0, (float (*)[4])j3dDefaultMtx); + + modelData->simpleCalcMaterial(0, (MtxP)j3dDefaultMtx); modelData->makeSharedDL(); - } else if ((((nodeType == 'BMDR') || - (nodeType == 'BMDV')) || - (nodeType == 'BMDE')) || - ((nodeType == 'BMWR' || - (nodeType == 'BMWE')))) + } else if (nodeType == 'BMDR' || nodeType == 'BMDV' || nodeType == 'BMDE' || + nodeType == 'BMWR' || nodeType == 'BMWE') { result = loaderBasicBmd(nodeType, result); if (result == NULL) { @@ -734,60 +751,63 @@ int dRes_info_c::loadResource() { if (result == NULL) { return -1; } + modelData = (J3DModelData*)result; if (modelData->newSharedDisplayList(0x40000) != 0) { return -1; } - modelData->simpleCalcMaterial(0, (float (*)[4])j3dDefaultMtx); + + modelData->simpleCalcMaterial(0, (MtxP)j3dDefaultMtx); modelData->makeSharedDL(); } else if (nodeType == 'BMDA') { result = (J3DModelData*)J3DModelLoaderDataBase::load(result, 0x59020010); if (result == NULL) { return -1; } + modelData = (J3DModelData*)result; if (modelData->newSharedDisplayList(0x40000) != 0) { return -1; } - modelData->simpleCalcMaterial(0, (float (*)[4])j3dDefaultMtx); + + modelData->simpleCalcMaterial(0, (MtxP)j3dDefaultMtx); modelData->makeSharedDL(); } else if (nodeType == 'BLS ') { result = J3DClusterLoaderDataBase::load(result); if (result == NULL) { return -1; } - } else if ((nodeType == 'BCKS') || - (nodeType == 'BCK ')) - { + } else if (nodeType == 'BCKS' || nodeType == 'BCK ') { int sVar1 = *(int*)((int)result + 0x1c); void* local_9c = sVar1 != 0xffffffff ? (void*)(sVar1 + (u32)result) : NULL; + mDoExt_transAnmBas* transAnmBas = new mDoExt_transAnmBas(local_9c); if (transAnmBas == NULL) { return -1; } + J3DAnmLoaderDataBase::setResource(transAnmBas, result); result = transAnmBas; - } else if ((((nodeType == 'BTP ') || - (nodeType == 'BTK ')) || - (nodeType == 'BPK ')) || - (((nodeType == 'BRK ' || - (nodeType == 'BLK ')) || - ((nodeType == 'BVA ' || - (nodeType == 'BXA ')))))) + } else if (nodeType == 'BTP ' || nodeType == 'BTK ' || nodeType == 'BPK ' || + nodeType == 'BRK ' || nodeType == 'BLK ' || nodeType == 'BVA ' || + nodeType == 'BXA ') { result = J3DAnmLoaderDataBase::load(result, J3DLOADER_UNK_FLAG0); if (result == NULL) { return -1; } } else if (nodeType == 'DZB ') { - result = ((cBgS*)result)->ConvDzb(result); + result = cBgS::ConvDzb(result); } else if (nodeType == 'KCL ') { result = dBgWKCol::initKCollision(result); } + mRes[firstFileIndex] = result; } + firstFileIndex++; } + node++; } @@ -853,9 +873,9 @@ void dRes_info_c::deleteArchiveRes() { /* 8003BA9C-8003BAC4 0363DC 0028+00 2/2 0/0 0/0 .text getArcHeader__FP10JKRArchive */ static SArcHeader* getArcHeader(JKRArchive* param_0) { if (param_0 != NULL) { - switch(param_0->getMountMode()) { - case JKRArchive::MOUNT_MEM: - return ((JKRMemArchive*)param_0)->getArcHeader(); + switch (param_0->getMountMode()) { + case JKRArchive::MOUNT_MEM: + return ((JKRMemArchive*)param_0)->getArcHeader(); } } @@ -983,8 +1003,8 @@ void dRes_info_c::dump_long(dRes_info_c* param_0, int param_1) { } JUTReportConsole_f("%2d %08x %08x %08x(%6x) %08x(%5x) %08x %3d %s\n", i, - param_0->getDMCommand(), archive, header, blockSize1, - dataHeap, blockSize2, param_0->mRes, param_0->getCount(), + param_0->getDMCommand(), archive, header, blockSize1, dataHeap, + blockSize2, param_0->mRes, param_0->getCount(), param_0->getArchiveName()); } param_0++; @@ -1034,14 +1054,17 @@ void dRes_info_c::dump(dRes_info_c* param_0, int param_1) { arcHeaderSize = JKRGetMemBlockSize(NULL, getArcHeader(param_0->getArchive())); heapSize = JKRGetMemBlockSize(NULL, param_0->mDataHeap); archiveName = param_0->getArchiveName(); - JUTReportConsole_f("%2d %6.1f %6x %6.1f %6x %3d %s\n", i, arcHeaderSize / 1024.0f, arcHeaderSize, heapSize / 1024.0f, heapSize, param_0->getCount(), archiveName); + JUTReportConsole_f("%2d %6.1f %6x %6.1f %6x %3d %s\n", i, arcHeaderSize / 1024.0f, + arcHeaderSize, heapSize / 1024.0f, heapSize, param_0->getCount(), + archiveName); totalArcHeaderSize += arcHeaderSize; totalHeapSize += heapSize; } param_0++; } JUTReportConsole_f( - "----------------------------------------------\n %6.1f %6x %6.1f %6x Total\n\n", totalArcHeaderSize / 1024.0f, totalArcHeaderSize, totalHeapSize / 1024.0f, totalHeapSize); + "----------------------------------------------\n %6.1f %6x %6.1f %6x Total\n\n", + totalArcHeaderSize / 1024.0f, totalArcHeaderSize, totalHeapSize / 1024.0f, totalHeapSize); } #else #pragma push @@ -1184,8 +1207,8 @@ void* dRes_control_c::getRes(char const* arcName, s32 resIdx, dRes_info_c* pInfo u32 fileCount = archive->countFile(); if (resIdx >= (int)fileCount) { - OSReport_Error("<%s.arc> getRes: res index over !! index=%d count=%d\n", arcName, - resIdx, fileCount); + OSReport_Error("<%s.arc> getRes: res index over !! index=%d count=%d\n", arcName, resIdx, + fileCount); return NULL; } return resInfo->getRes(resIdx); diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp index 5cec7f27fe..399e4d859a 100644 --- a/src/d/d_stage.cpp +++ b/src/d/d_stage.cpp @@ -11,8 +11,11 @@ #include "d/com/d_com_inf_game.h" #include "d/com/d_com_static.h" #include "d/d_lib.h" +#include "d/d_path.h" #include "d/d_procname.h" #include "d/d_tresure.h" +#include "d/map/d_map_path_dmap.h" +#include "d/map/d_map_path_fmap.h" #include "d/save/d_save_HIO.h" #include "dol2asm.h" #include "dolphin/os/OS.h" @@ -567,6 +570,7 @@ dStage_roomStatus_c* dStage_roomControl_c::getStatusRoomDt(int i_statusIdx) { return &mStatus[i_statusIdx]; } +// clang-format off #define OBJNAME(name, proc, sub) \ { name, proc, sub } @@ -1485,95 +1489,7 @@ static dStage_objectNameInf l_objectName[0x38F] = { OBJNAME("DemoItm", PROC_Demo_Item, 0xFF), OBJNAME("EndCode", PROC_PLAY_SCENE, 0xFF), }; - -/* 803A65CC-803A65FC -00001 0030+00 1/1 0/0 0/0 .data l_roomFuncTable$5052 */ -static FuncTable l_roomFuncTable[4] = { - {"TRES", dStage_stageKeepTresureInit}, - {"FILI", dStage_filiInfo2Init}, - {"MPAT", dStage_mapPathInitCommonLayer}, - {"Door", dStage_RoomKeepDoorInit}, -}; - -/* 803A65FC-803A6620 -00001 0024+00 1/1 0/0 0/0 .data l_layerFuncTable$5053 */ -SECTION_DATA static FuncTable l_layerFuncTable_5053[3] = { - {"TRE0", dStage_stageKeepTresureInit}, - {"MPA0", dStage_mapPathInit}, - {"Doo0", dStage_RoomKeepDoorInit}, -}; - -/* 803A6620-803A6638 -00001 0018+00 1/1 0/0 0/0 .data l_layerFuncTable$5131 */ -SECTION_DATA static FuncTable l_layerFuncTable_5131[2] = { - {"MEM0", dStage_memaInfoInit}, - {"MEC0", dStage_mecoInfoInit}, -}; - -/* 803A6638-803A6644 -00001 000C+00 1/1 0/0 0/0 .data l_funcTable$5136 */ -SECTION_DATA static FuncTable l_funcTable_5136[1] = {"STAG", dStage_stagInfoInit}; - -/* 803A6644-803A6650 -00001 000C+00 1/1 0/0 0/0 .data l_layerFuncTableA$5141 */ -SECTION_DATA static FuncTable l_layerFuncTableA[1] = {"SON0", dStage_soundInfoInit}; - -/* 803A6650-803A668C -00001 003C+00 1/1 0/0 0/0 .data l_envLayerFuncTable$5142 */ -SECTION_DATA static FuncTable l_envLayerFuncTable[5] = { - {"LGT0", dStage_lgtvInfoInit}, {"Env0", dStage_envrInfoInit}, - {"Col0", dStage_pselectInfoInit}, {"PAL0", dStage_paletteInfoInit}, - {"VRB0", dStage_vrboxcolInfoInit}, -}; - -/* 803A668C-803A66BC -00001 0030+00 1/1 0/0 0/0 .data l_layerFuncTable$5158 */ -SECTION_DATA static FuncTable l_layerFuncTable_5158[4] = { - {"Doo0", dStage_roomDrtgInfoInit}, - {"SCO0", dStage_tgscInfoInit}, - {"ACT0", dStage_actorInit}, - {"TRE0", dStage_layerTresureInit}, -}; - -/* 803A66BC-803A67F4 -00001 0138+00 1/1 0/0 0/0 .data l_funcTable$5163 */ -SECTION_DATA static FuncTable l_funcTable_5163[26] = { - {"EVLY", dStage_elstInfoInit}, {"RPPN", dStage_rppnInfoInit}, - {"RPAT", dStage_rpatInfoInit}, {"MULT", dStage_multInfoInit}, - {"PLYR", dStage_playerInit}, {"CAMR", dStage_cameraInit}, - {"RCAM", dStage_cameraInit}, {"ACTR", dStage_actorInit_always}, - {"TGOB", dStage_actorInit_always}, {"RTBL", dStage_roomReadInit}, - {"AROB", dStage_arrowInit}, {"RARO", dStage_arrowInit}, - {"Virt", dStage_vrboxInfoInit}, {"SCLS", dStage_sclsInfoInit}, - {"TGSC", dStage_tgscInfoInit}, {"LGHT", dStage_plightInfoInit}, - {"PPNT", dStage_ppntInfoInit}, {"PATH", dStage_pathInfoInit}, - {"SCOB", dStage_tgscInfoInit}, {"FILI", dStage_filiInfoInit}, - {"Door", dStage_stageDrtgInfoInit}, {"FLOR", dStage_floorInfoInit}, - {"TGDR", dStage_tgscInfoInit}, {"DMAP", dStage_dmapInfoInit}, - {"REVT", dStage_stEventInfoInit}, {"SOND", dStage_soundInfoInitCL}, -}; - -/* 803A67F4-803A689C -00001 00A8+00 1/1 0/0 0/0 .data l_funcTable$5168 */ -SECTION_DATA static FuncTable l_funcTable_5168[14] = { - {"PLYR", dStage_playerInit}, {"RCAM", dStage_RoomCameraInit}, {"RARO", dStage_arrowInit}, - {"RTBL", dStage_roomReadInit}, {"AROB", dStage_arrowInit}, {"Virt", dStage_vrboxInfoInit}, - {"SCLS", dStage_sclsInfoInit}, {"LGHT", dStage_plightInfoInit}, {"RPPN", dStage_rppnInfoInit}, - {"RPAT", dStage_rpatInfoInit}, {"FILI", dStage_filiInfoInit}, {"FLOR", dStage_floorInfoInit}, - {"LBNK", dStage_lbnkInfoInit}, {"SOND", dStage_soundInfoInitCL}, -}; - -/* 803A689C-803A68FC -00001 0060+00 1/1 0/0 0/0 .data l_funcTable$5173 */ -SECTION_DATA static FuncTable l_funcTable_5173[8] = { - {"Door", dStage_roomDrtgInfoInit}, {"ACTR", dStage_actorCommonLayerInit}, - {"TGOB", dStage_actorCommonLayerInit}, {"TRES", dStage_roomTresureInit}, - {"TGSC", dStage_tgscCommonLayerInit}, {"SCOB", dStage_tgscCommonLayerInit}, - {"TGDR", dStage_tgscInfoInit}, {"REVT", dStage_mapEventInfoInit}, -}; - -/* 803A68FC-803A6920 -00001 0024+00 1/1 0/0 0/0 .data l_funcTable$5178 */ -SECTION_DATA static FuncTable l_funcTable_5178[3] = { - {"TRES", dStage_fieldMapTresureInit}, - {"FILI", dStage_fieldMapFiliInfo2Init}, - {"MPAT", dStage_fieldMapMapPathInit}, -}; - -/* 803A6920-803A696C 003A40 004C+00 3/3 0/0 0/0 .data mMemoryBlock__20dStage_roomControl_c */ -SECTION_DATA JKRExpHeap* dStage_roomControl_c::mMemoryBlock[19] = { - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -}; +// clang-format on /* 800243B0-800243E8 01ECF0 0038+00 0/0 3/3 1/1 .text getMemoryBlock__20dStage_roomControl_cFi */ JKRExpHeap* dStage_roomControl_c::getMemoryBlock(int i_roomNo) { @@ -1587,9 +1503,9 @@ JKRExpHeap* dStage_roomControl_c::getMemoryBlock(int i_roomNo) { /* 800243E8-80024424 01ED28 003C+00 2/2 0/0 0/0 .text setStayNo__20dStage_roomControl_cFi */ -void dStage_roomControl_c::setStayNo(int stayNo) { +void dStage_roomControl_c::setStayNo(int i_roomNo) { mOldStayNo = mStayNo; - mStayNo = stayNo; + mStayNo = i_roomNo; mNextStayNo = mStayNo; if (mStayNo < 0) { @@ -1636,6 +1552,7 @@ bool dStage_roomControl_c::checkRoomDisp(int i_roomNo) const { if (checkStatusFlag(i_roomNo, 8)) { return false; } + return checkStatusFlag(i_roomNo, 16) ? true : false; } @@ -1650,7 +1567,7 @@ asm int dStage_roomControl_c::loadRoom(int param_0, u8* param_1, bool param_2) { #pragma pop /* 8002471C-8002483C 01F05C 0120+00 1/1 0/0 0/3 .text zoneCountCheck__20dStage_roomControl_cCFi */ -void dStage_roomControl_c::zoneCountCheck(int stayNo) const { +void dStage_roomControl_c::zoneCountCheck(int i_roomNo) const { dStage_roomStatus_c* status = mStatus; for (int i = 0; i < 0x40; i++) { if (status->mZoneNo >= 0 && status->mZoneCount > 0) { @@ -1658,7 +1575,8 @@ void dStage_roomControl_c::zoneCountCheck(int stayNo) const { dComIfGs_clearRoomItem(status->mZoneNo); if (dStage_stagInfo_GetSTType(i_dComIfGp_getStage()->getStagInfo()) != ST_FIELD && - stayNo != mOldStayNo) { + i_roomNo != mOldStayNo) + { if (--status->mZoneCount == 0) { dComIfGs_removeZone(status->mZoneNo); status->mZoneNo = -1; @@ -1667,18 +1585,20 @@ void dStage_roomControl_c::zoneCountCheck(int stayNo) const { } status++; } - setStayNo(stayNo); + + setStayNo(i_roomNo); } stage_stag_info_class* dStage_stageDt_c::getStagInfo() const { return mStagInfo; } -JKRExpHeap* dStage_roomControl_c::createMemoryBlock(int index, u32 param_1) { - if (mMemoryBlock[index] == NULL) { - mMemoryBlock[index] = JKRExpHeap::create(param_1, mDoExt_getArchiveHeap(), false); +JKRExpHeap* dStage_roomControl_c::createMemoryBlock(int i_blockIdx, u32 i_heapSize) { + if (mMemoryBlock[i_blockIdx] == NULL) { + mMemoryBlock[i_blockIdx] = JKRExpHeap::create(i_heapSize, mDoExt_getArchiveHeap(), false); } - return mMemoryBlock[index]; + + return mMemoryBlock[i_blockIdx]; } void dStage_roomControl_c::destroyMemoryBlock() { @@ -1690,31 +1610,6 @@ void dStage_roomControl_c::destroyMemoryBlock() { } } -/* ############################################################################################## */ -/* 803A696C-803A6AAC 003A8C 0140+00 2/2 0/0 0/0 .data mArcBank__20dStage_roomControl_c */ -SECTION_DATA char dStage_roomControl_c::mArcBank[32][10] = { - 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, - 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, - 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, - 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, - 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, - 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, - 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, -}; - /* 8002490C-80024940 01F24C 0034+00 1/1 1/1 0/2 .text setArcBank__20dStage_roomControl_cFiPCc */ void dStage_roomControl_c::setArcBank(int i_bank, char const* bankName) { strncpy(&mArcBank[i_bank][0], bankName, 9); @@ -1889,24 +1784,24 @@ void dStage_roomDt_c::init() { } /* 80024D10-80024DB0 01F650 00A0+00 1/1 0/0 0/0 .text dStage_roomInit__Fi */ -static int dStage_roomInit(int stayNo) { - dComIfGp_roomControl_setStayNo(stayNo); +static int dStage_roomInit(int i_roomNo) { + dComIfGp_roomControl_setStayNo(i_roomNo); roomRead_class* room = dComIfGp_getStageRoom(); - if (room != NULL && room->field_0x0 > stayNo) { - int time_pass = dStage_roomRead_dt_c_GetTimePass(*room->field_0x4[stayNo]); + if (room != NULL && room->field_0x0 > i_roomNo) { + int time_pass = dStage_roomRead_dt_c_GetTimePass(*room->field_0x4[i_roomNo]); dComIfGp_roomControl_setTimePass(time_pass); - return dComIfGp_roomControl_loadRoom(room->field_0x4[stayNo]->field_0x0, - room->field_0x4[stayNo]->field_0x4, true); + return dComIfGp_roomControl_loadRoom(room->field_0x4[i_roomNo]->field_0x0, + room->field_0x4[i_roomNo]->field_0x4, true); } return 1; } /* 80024DB0-80024DB8 01F6F0 0008+00 2/2 0/0 0/0 .text SetTimePass__20dStage_roomControl_cFi */ -void dStage_roomControl_c::SetTimePass(int isPassing) { - m_time_pass = isPassing; +void dStage_roomControl_c::SetTimePass(int i_timepass) { + m_time_pass = i_timepass; } roomRead_class* dStage_stageDt_c::getRoom() const { @@ -1914,7 +1809,7 @@ roomRead_class* dStage_stageDt_c::getRoom() const { } dStage_objectNameInf* dStage_searchName(char const* objName) { - dStage_objectNameInf* obj = &l_objectName[0]; + dStage_objectNameInf* obj = l_objectName; for (u32 i = 0; i < ARRAY_SIZE(l_objectName); i++) { if (!strcmp(obj->mName, objName)) { @@ -1922,13 +1817,14 @@ dStage_objectNameInf* dStage_searchName(char const* objName) { } obj++; } + return NULL; } static const char* dStage_getName(s16 procName, s8 subtype) { static char tmp_name[8]; - dStage_objectNameInf* obj = &l_objectName[0]; + dStage_objectNameInf* obj = l_objectName; char* tmp = NULL; for (int i = 0; i < ARRAY_SIZE(l_objectName); i++) { @@ -1981,41 +1877,43 @@ char* dStage_roomControl_c::mArcBankData; /* 80024EFC-80024F98 01F83C 009C+00 7/7 0/0 0/0 .text * dStage_actorCreate__FP22stage_actor_data_classP16fopAcM_prm_class */ -static void dStage_actorCreate(stage_actor_data_class* param_0, fopAcM_prm_class* param_1) { - dStage_objectNameInf* actorInf = dStage_searchName((char*)param_0); +static void dStage_actorCreate(stage_actor_data_class* i_actorData, fopAcM_prm_class* i_actorPrm) { + dStage_objectNameInf* actorInf = dStage_searchName(i_actorData->mName); fopAc_ac_c* actor; if (actorInf == NULL) { - JKRHeap::free(param_1, NULL); + JKRHeap::free(i_actorPrm, NULL); } else { - param_1->mSubtype = actorInf->mSubtype; - s16 objName = actorInf->mProcName; + i_actorPrm->mSubtype = actorInf->mSubtype; + s16 actor_name = actorInf->mProcName; - if (objName == PROC_SUSPEND) { - actor = (fopAc_ac_c*)fopAcM_FastCreate(objName, 0, NULL, param_1); + if (actor_name == PROC_SUSPEND) { + actor = (fopAc_ac_c*)fopAcM_FastCreate(actor_name, NULL, NULL, i_actorPrm); if (actor != NULL) { fopAcM_delete(actor); } } else { layer_class* curLayer = fpcLy_CurrentLayer(); - fpcSCtRq_Request(curLayer, objName, 0, NULL, param_1); + fpcSCtRq_Request(curLayer, actor_name, NULL, NULL, i_actorPrm); } } } /* 80024F98-80025004 01F8D8 006C+00 1/1 0/0 0/0 .text * dStage_cameraCreate__FP24stage_camera2_data_classii */ -static int dStage_cameraCreate(stage_camera2_data_class* camera, int i_cameraIdx, int param_2) { - camera = static_cast(cMl::memalignB(-4, 0x18)); +static int dStage_cameraCreate(stage_camera2_data_class* i_cameraData, int i_cameraIdx, + int param_2) { + i_cameraData = static_cast(cMl::memalignB(-4, 0x18)); - if (camera != NULL) { - camera->field_0x4 = 0.0f; - camera->field_0x8 = 0.0f; - camera->field_0x4 = 0.0f; - camera->field_0x0 = param_2; - fopCamM_Create(i_cameraIdx, PROC_CAMERA, camera); + if (i_cameraData != NULL) { + i_cameraData->field_0x4 = 0.0f; + i_cameraData->field_0x8 = 0.0f; + i_cameraData->field_0x4 = 0.0f; + i_cameraData->field_0x0 = param_2; + fopCamM_Create(i_cameraIdx, PROC_CAMERA, i_cameraData); } + return 1; } @@ -2122,14 +2020,25 @@ static int dStage_arrowInit(dStage_dt_c* i_stage, void* i_data, int param_2, voi /* 80025370-800253FC 01FCB0 008C+00 1/0 0/0 0/0 .text getMapInfo2__15dStage_roomDt_cCFi */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm stage_map_info_class* dStage_roomDt_c::getMapInfo2(int param_0) const { - nofralloc -#include "asm/d/d_stage/getMapInfo2__15dStage_roomDt_cCFi.s" +stage_map_info_class* dStage_roomDt_c::getMapInfo2(int param_0) const { + stage_map_info_dummy_class* map_info_p = getMapInfoBase(); + + if (map_info_p == NULL || map_info_p->field_0x0 == 0 || map_info_p->mData == NULL) { + return NULL; + } + + stage_map_info_class* data_p = map_info_p->mData; + + for (int i = 0; i < map_info_p->field_0x0; i++) { + if (param_0 == data_p->field_0x35) { + return data_p; + } + + data_p++; + } + + return NULL; } -#pragma pop /* 800253FC-80025404 01FD3C 0008+00 1/0 0/0 0/0 .text getMapInfoBase__15dStage_roomDt_cCFv */ stage_map_info_dummy_class* dStage_roomDt_c::getMapInfoBase() const { @@ -2138,14 +2047,25 @@ stage_map_info_dummy_class* dStage_roomDt_c::getMapInfoBase() const { /* 80025404-80025490 01FD44 008C+00 1/0 0/0 0/0 .text getMapInfo2__16dStage_stageDt_cCFi */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm stage_map_info_class* dStage_stageDt_c::getMapInfo2(int param_0) const { - nofralloc -#include "asm/d/d_stage/getMapInfo2__16dStage_stageDt_cCFi.s" +stage_map_info_class* dStage_stageDt_c::getMapInfo2(int param_0) const { + stage_map_info_dummy_class* map_info_p = getMapInfoBase(); + + if (map_info_p == NULL || map_info_p->field_0x0 == 0 || map_info_p->mData == NULL) { + return NULL; + } + + stage_map_info_class* data_p = map_info_p->mData; + + for (int i = 0; i < map_info_p->field_0x0; i++) { + if (param_0 == data_p->field_0x35) { + return data_p; + } + + data_p++; + } + + return NULL; } -#pragma pop /* 80025490-80025498 01FDD0 0008+00 1/0 0/0 0/0 .text getMapInfoBase__16dStage_stageDt_cCFv */ stage_map_info_dummy_class* dStage_stageDt_c::getMapInfoBase() const { @@ -2190,15 +2110,16 @@ static int dStage_filiInfo2Init(dStage_dt_c* stageDt, void* i_data, int entryNum /* 8002556C-8002558C 01FEAC 0020+00 1/0 0/0 0/0 .text * dStage_fieldMapFiliInfo2Init__FP11dStage_dt_cPviPv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm int dStage_fieldMapFiliInfo2Init(dStage_dt_c* param_0, void* param_1, int param_2, - void* param_3) { - nofralloc -#include "asm/d/d_stage/dStage_fieldMapFiliInfo2Init__FP11dStage_dt_cPviPv.s" +static int dStage_fieldMapFiliInfo2Init(dStage_dt_c* param_0, void* i_data, int i_entryNum, + void* param_3) { + if (i_entryNum == 0) { + return 1; + } + + dStage_nodeHeader* fili_info = (dStage_nodeHeader*)(i_data); + ((dMenu_Fmap_data_c*)param_0)->setFileList2((dStage_FileList2_dt_c*)fili_info->m_offset); + return 1; } -#pragma pop /* 8002558C-800255E0 01FECC 0054+00 2/0 0/0 0/0 .text dStage_filiInfoInit__FP11dStage_dt_cPviPv */ static int dStage_filiInfoInit(dStage_dt_c* stageDt, void* i_data, int entryNum, void* param_3) { @@ -2450,6 +2371,24 @@ static int dStage_doorInfoInit(dStage_dt_c* stageDt, void* i_data, int entryNum, } /* 80025DA8-80025E40 0206E8 0098+00 2/0 0/0 0/0 .text dStage_roomReadInit__FP11dStage_dt_cPviPv */ +// close +#ifdef NONMATCHING +static int dStage_roomReadInit(dStage_dt_c* param_0, void* i_data, int param_2, void* param_3) { + roomRead_class* p_node = (roomRead_class*)((int*)i_data + 1); + roomRead_data_class** rtbl = p_node->field_0x4; + + param_0->setRoom(p_node); + + for (int i = 0; i < p_node->field_0x0; i++) { + if ((int)rtbl[i] < 0x80000000) { + rtbl[i] += (int)param_3; + rtbl[i]->field_0x4 += (int)param_3; + } + } + + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -2459,6 +2398,7 @@ static asm int dStage_roomReadInit(dStage_dt_c* param_0, void* param_1, int para #include "asm/d/d_stage/dStage_roomReadInit__FP11dStage_dt_cPviPv.s" } #pragma pop +#endif /* 80025E40-80025E70 020780 0030+00 0/0 1/1 0/0 .text * dStage_roomRead_dt_c_GetReverbStage__FR14roomRead_classi */ @@ -2477,6 +2417,24 @@ static int dStage_ppntInfoInit(dStage_dt_c* stageDt, void* i_data, int entryNum, } /* 80025EA4-80025F44 0207E4 00A0+00 1/0 0/0 0/0 .text dStage_pathInfoInit__FP11dStage_dt_cPviPv */ +// close +#ifdef NONMATCHING +static int dStage_pathInfoInit(dStage_dt_c* stageDt, void* i_data, int entryNum, void* param_3) { + dStage_dPath_c* path_c = (dStage_dPath_c*)((char*)i_data + 4); + dPath* path = path_c->m_path; + + stageDt->setPathInfo(path_c); + + for (int i = 0; i < path_c->m_num; i++) { + if ((u32)path->m_points < 0x80000000) { + path->m_points += (int)stageDt->getPntInf(); + } + path++; + } + + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -2486,20 +2444,7 @@ static asm int dStage_pathInfoInit(dStage_dt_c* param_0, void* param_1, int para #include "asm/d/d_stage/dStage_pathInfoInit__FP11dStage_dt_cPviPv.s" } #pragma pop - -/* static int dStage_pathInfoInit(dStage_dt_c* stageDt, void* i_data, int entryNum, void* param_3) { - dStage_dPath_c* path_c = ((char*)i_data + 4); - dPath* path = path_c->m_path; - - stageDt->setPathInfo(path_c); - - for (int i = 0; i < path_c->m_num; i++) { - if ((u32)path->m_points < 0x80000000) { - path->m_points += path_c->m_num - } - path++; - } -} */ +#endif /* 80025F44-80025F78 020884 0034+00 2/0 0/0 0/0 .text dStage_rppnInfoInit__FP11dStage_dt_cPviPv */ static int dStage_rppnInfoInit(dStage_dt_c* stageDt, void* i_data, int entryNum, void* param_3) { @@ -2597,26 +2542,38 @@ static int dStage_floorInfoInit(dStage_dt_c* stageDt, void* i_data, int entryNum } /* 80026218-80026298 020B58 0080+00 1/0 0/0 0/9 .text dStage_memaInfoInit__FP11dStage_dt_cPviPv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm int dStage_memaInfoInit(dStage_dt_c* param_0, void* param_1, int param_2, - void* param_3) { - nofralloc -#include "asm/d/d_stage/dStage_memaInfoInit__FP11dStage_dt_cPviPv.s" +static int dStage_memaInfoInit(dStage_dt_c* param_0, void* param_1, int param_2, void* param_3) { + dStage_MemoryMap_c* pd = (dStage_MemoryMap_c*)((char*)param_1 + 4); + param_0->setMemoryMap(pd); + + if (pd != NULL) { + u32* entry_p = pd->field_0x4; + + for (int i = 0; i < pd->m_num; i++) { + dStage_roomControl_c::createMemoryBlock(i, *entry_p + 0x380); + entry_p++; + } + } + + return 1; } -#pragma pop /* 80026298-8002631C 020BD8 0084+00 1/0 0/0 0/0 .text dStage_mecoInfoInit__FP11dStage_dt_cPviPv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm int dStage_mecoInfoInit(dStage_dt_c* param_0, void* param_1, int param_2, - void* param_3) { - nofralloc -#include "asm/d/d_stage/dStage_mecoInfoInit__FP11dStage_dt_cPviPv.s" +static int dStage_mecoInfoInit(dStage_dt_c* param_0, void* param_1, int param_2, void* param_3) { + dStage_MemoryConfig_c* pd = (dStage_MemoryConfig_c*)((char*)param_1 + 4); + param_0->setMemoryConfig(pd); + + if (pd != NULL) { + dStage_MemoryConfig_data* entry_p = pd->field_0x4; + + for (int i = 0; i < pd->m_num; i++) { + dStage_roomControl_c::setMemoryBlockID(entry_p->m_roomNo, entry_p->m_blockID); + entry_p++; + } + } + + return 1; } -#pragma pop /* 8002631C-8002634C 020C5C 0030+00 2/0 0/0 0/0 .text * dStage_stageKeepTresureInit__FP11dStage_dt_cPviPv */ @@ -2628,61 +2585,52 @@ static int dStage_stageKeepTresureInit(dStage_dt_c* stageDt, void* i_data, int e /* 8002634C-8002635C 020C8C 0010+00 1/0 0/0 0/0 .text * dStage_fieldMapTresureInit__FP11dStage_dt_cPviPv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm int dStage_fieldMapTresureInit(dStage_dt_c* param_0, void* param_1, int param_2, - void* param_3) { - nofralloc -#include "asm/d/d_stage/dStage_fieldMapTresureInit__FP11dStage_dt_cPviPv.s" +static int dStage_fieldMapTresureInit(dStage_dt_c* i_stageDt, void* i_data, int i_entryNum, + void* param_3) { + ((dMenu_Fmap_data_c*)i_stageDt)->setTresure((dTres_c::list_class*)((char*)i_data + 4)); + return 1; } -#pragma pop /* 8002635C-800263A0 020C9C 0044+00 4/4 0/0 0/0 .text dStage_dt_c_offsetToPtr__FPv */ static void dStage_dt_c_offsetToPtr(void* i_data) { - dStage_nodeHeader* p_node = (dStage_nodeHeader*)((int*)i_data + 1); + dStage_nodeHeader* p_tno = (dStage_nodeHeader*)((int*)i_data + 1); for (int i = 0; i < ((dStage_fileHeader*)i_data)->chunkCount; i++) { - if (p_node->m_offset != 0 && p_node->m_offset < 0x80000000) { - p_node->m_offset += (u32)i_data; + if (p_tno->m_offset != 0 && p_tno->m_offset < 0x80000000) { + p_tno->m_offset += (u32)i_data; } - p_node++; + p_tno++; } } /* 800263A0-800263D0 020CE0 0030+00 1/0 0/0 0/0 .text dStage_mapPathInit__FP11dStage_dt_cPviPv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm int dStage_mapPathInit(dStage_dt_c* param_0, void* param_1, int param_2, void* param_3) { - nofralloc -#include "asm/d/d_stage/dStage_mapPathInit__FP11dStage_dt_cPviPv.s" +static int dStage_mapPathInit(dStage_dt_c* param_0, void* param_1, int param_2, void* param_3) { + dMpath_c::setPointer(param_0->getRoomNo(), (char*)param_1 + 4, 0); + return 1; } -#pragma pop /* 800263D0-80026400 020D10 0030+00 1/0 0/0 0/0 .text * dStage_mapPathInitCommonLayer__FP11dStage_dt_cPviPv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm int dStage_mapPathInitCommonLayer(dStage_dt_c* param_0, void* param_1, int param_2, - void* param_3) { - nofralloc -#include "asm/d/d_stage/dStage_mapPathInitCommonLayer__FP11dStage_dt_cPviPv.s" +static int dStage_mapPathInitCommonLayer(dStage_dt_c* param_0, void* param_1, int param_2, + void* param_3) { + dMpath_c::setPointer(param_0->getRoomNo(), (char*)param_1 + 4, 1); + return 1; } -#pragma pop /* 80026400-8002645C 020D40 005C+00 1/0 0/0 0/0 .text * dStage_fieldMapMapPathInit__FP11dStage_dt_cPviPv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm int dStage_fieldMapMapPathInit(dStage_dt_c* param_0, void* param_1, int param_2, - void* param_3) { - nofralloc -#include "asm/d/d_stage/dStage_fieldMapMapPathInit__FP11dStage_dt_cPviPv.s" +static int dStage_fieldMapMapPathInit(dStage_dt_c* i_stageDt, void* param_1, int param_2, + void* param_3) { + dDrawPath_c::room_class* room_p = (dDrawPath_c::room_class*)((dStage_nodeHeader*)param_1)->m_offset; + if (room_p == NULL) { + return 1; + } + + s8 sp8, sp9; + dMpath_c::setPointer(room_p, &sp8, &sp9); + ((dMenu_Fmap_data_c*)i_stageDt)->setMapPath(room_p); + return 1; } -#pragma pop /* 80450D74-80450D7C 000274 0008+00 3/3 0/0 0/0 .sbss m_roomDzs__20dStage_roomControl_c */ @@ -2691,11 +2639,25 @@ dStage_roomControl_c::roomDzs_c dStage_roomControl_c::m_roomDzs; /* 8002645C-800265DC 020D9C 0180+00 1/1 0/0 0/0 .text readMult__FP11dStage_dt_cP14dStage_Multi_cb */ static void readMult(dStage_dt_c* stageDt, dStage_Multi_c* multi, bool useOldRes) { + static FuncTable l_roomFuncTable[] = { + {"TRES", dStage_stageKeepTresureInit}, + {"FILI", dStage_filiInfo2Init}, + {"MPAT", dStage_mapPathInitCommonLayer}, + {"Door", dStage_RoomKeepDoorInit}, + }; + + static FuncTable l_layerFuncTable[] = { + {"TRE0", dStage_stageKeepTresureInit}, + {"MPA0", dStage_mapPathInit}, + {"Doo0", dStage_RoomKeepDoorInit}, + }; + if (multi != NULL) { dStage_Mult_info* info = multi->mInfo; if (dStage_stagInfo_GetUpButton(i_dComIfGp_getStage()->getStagInfo()) == 0 || - dStage_stagInfo_GetUpButton(i_dComIfGp_getStage()->getStagInfo()) == 6) { + dStage_stagInfo_GetUpButton(i_dComIfGp_getStage()->getStagInfo()) == 6) + { dStage_roomControl_c::m_roomDzs.create(multi->field_0x0); } @@ -2716,9 +2678,10 @@ static void readMult(dStage_dt_c* stageDt, dStage_Multi_c* multi, bool useOldRes if (dzs != NULL) { dStage_dt_c_offsetToPtr(dzs); stageDt->setRoomNo(info->mRoomNo); - dStage_dt_c_decode(dzs, stageDt, l_roomFuncTable, 4); - dStage_setLayerTagName(l_layerFuncTable_5053, 3, dComIfG_play_c::getLayerNo(0)); - dStage_dt_c_decode(dzs, stageDt, l_layerFuncTable_5053, 3); + dStage_dt_c_decode(dzs, stageDt, l_roomFuncTable, ARRAY_SIZE(l_roomFuncTable)); + dStage_setLayerTagName(l_layerFuncTable, ARRAY_SIZE(l_layerFuncTable), + dComIfG_play_c::getLayerNo(0)); + dStage_dt_c_decode(dzs, stageDt, l_layerFuncTable, ARRAY_SIZE(l_layerFuncTable)); } info++; @@ -2808,20 +2771,35 @@ static void dKankyo_create() { /* 80026914-80026940 021254 002C+00 1/1 0/0 0/0 .text layerMemoryInfoLoader__FPvP11dStage_dt_ci */ static void layerMemoryInfoLoader(void* i_data, dStage_dt_c* i_stage, int param_2) { - dStage_dt_c_decode(i_data, i_stage, l_layerFuncTable_5131, 2); + static FuncTable l_layerFuncTable[] = { + {"MEM0", dStage_memaInfoInit}, + {"MEC0", dStage_mecoInfoInit}, + }; + + dStage_dt_c_decode(i_data, i_stage, l_layerFuncTable, ARRAY_SIZE(l_layerFuncTable)); } /* 80026940-800269B4 021280 0074+00 1/1 0/0 0/0 .text * dStage_dt_c_stageInitLoader__FPvP11dStage_dt_c */ static void dStage_dt_c_stageInitLoader(void* i_data, dStage_dt_c* i_stage) { + static FuncTable l_funcTable[] = {"STAG", dStage_stagInfoInit}; + dStage_dt_c_offsetToPtr(i_data); i_stage->init(); - dStage_dt_c_decode(i_data, i_stage, l_funcTable_5136, 1); + dStage_dt_c_decode(i_data, i_stage, l_funcTable, ARRAY_SIZE(l_funcTable)); layerMemoryInfoLoader(i_data, i_stage, -1); } /* 800269B4-80026AE8 0212F4 0134+00 2/2 0/0 0/0 .text layerTableLoader__FPvP11dStage_dt_ci */ static void layerTableLoader(void* i_data, dStage_dt_c* stageDt, int roomNo) { + static FuncTable l_layerFuncTableA[] = {"SON0", dStage_soundInfoInit}; + + static FuncTable l_envLayerFuncTable[] = { + {"LGT0", dStage_lgtvInfoInit}, {"Env0", dStage_envrInfoInit}, + {"Col0", dStage_pselectInfoInit}, {"PAL0", dStage_paletteInfoInit}, + {"VRB0", dStage_vrboxcolInfoInit}, + }; + int newRoomNo; if (roomNo != -1) { newRoomNo = roomNo; @@ -2853,14 +2831,37 @@ dStage_Elst_c* dStage_stageDt_c::getElst() { /* 80026AF0-80026B58 021430 0068+00 2/2 0/0 0/0 .text layerActorLoader__FPvP11dStage_dt_ci */ static void layerActorLoader(void* i_data, dStage_dt_c* stageDt, int param_2) { - dStage_setLayerTagName(l_layerFuncTable_5158, 4, dComIfG_play_c::getLayerNo(0)); - dStage_dt_c_decode(i_data, stageDt, l_layerFuncTable_5158, 4); + static FuncTable l_layerFuncTable[] = { + {"Doo0", dStage_roomDrtgInfoInit}, + {"SCO0", dStage_tgscInfoInit}, + {"ACT0", dStage_actorInit}, + {"TRE0", dStage_layerTresureInit}, + }; + + dStage_setLayerTagName(l_layerFuncTable, 4, dComIfG_play_c::getLayerNo(0)); + dStage_dt_c_decode(i_data, stageDt, l_layerFuncTable, ARRAY_SIZE(l_layerFuncTable)); } /* 80026B58-80026BBC 021498 0064+00 1/1 0/0 0/0 .text dStage_dt_c_stageLoader__FPvP11dStage_dt_c */ static void dStage_dt_c_stageLoader(void* i_data, dStage_dt_c* stageDt) { - dStage_dt_c_decode(i_data, stageDt, l_funcTable_5163, 26); + static FuncTable l_funcTable[] = { + {"EVLY", dStage_elstInfoInit}, {"RPPN", dStage_rppnInfoInit}, + {"RPAT", dStage_rpatInfoInit}, {"MULT", dStage_multInfoInit}, + {"PLYR", dStage_playerInit}, {"CAMR", dStage_cameraInit}, + {"RCAM", dStage_cameraInit}, {"ACTR", dStage_actorInit_always}, + {"TGOB", dStage_actorInit_always}, {"RTBL", dStage_roomReadInit}, + {"AROB", dStage_arrowInit}, {"RARO", dStage_arrowInit}, + {"Virt", dStage_vrboxInfoInit}, {"SCLS", dStage_sclsInfoInit}, + {"TGSC", dStage_tgscInfoInit}, {"LGHT", dStage_plightInfoInit}, + {"PPNT", dStage_ppntInfoInit}, {"PATH", dStage_pathInfoInit}, + {"SCOB", dStage_tgscInfoInit}, {"FILI", dStage_filiInfoInit}, + {"Door", dStage_stageDrtgInfoInit}, {"FLOR", dStage_floorInfoInit}, + {"TGDR", dStage_tgscInfoInit}, {"DMAP", dStage_dmapInfoInit}, + {"REVT", dStage_stEventInfoInit}, {"SOND", dStage_soundInfoInitCL}, + }; + + dStage_dt_c_decode(i_data, stageDt, l_funcTable, ARRAY_SIZE(l_funcTable)); layerTableLoader(i_data, stageDt, -1); layerActorLoader(i_data, stageDt, -1); } @@ -2868,26 +2869,59 @@ static void dStage_dt_c_stageLoader(void* i_data, dStage_dt_c* stageDt) { /* 80026BBC-80026C34 0214FC 0078+00 0/0 1/1 0/0 .text dStage_dt_c_roomLoader__FPvP11dStage_dt_ci */ void dStage_dt_c_roomLoader(void* i_data, dStage_dt_c* stageDt, int param_2) { + static FuncTable l_funcTable[] = { + {"PLYR", dStage_playerInit}, {"RCAM", dStage_RoomCameraInit}, + {"RARO", dStage_arrowInit}, {"RTBL", dStage_roomReadInit}, + {"AROB", dStage_arrowInit}, {"Virt", dStage_vrboxInfoInit}, + {"SCLS", dStage_sclsInfoInit}, {"LGHT", dStage_plightInfoInit}, + {"RPPN", dStage_rppnInfoInit}, {"RPAT", dStage_rpatInfoInit}, + {"FILI", dStage_filiInfoInit}, {"FLOR", dStage_floorInfoInit}, + {"LBNK", dStage_lbnkInfoInit}, {"SOND", dStage_soundInfoInitCL}, + }; + dStage_dt_c_offsetToPtr(i_data); stageDt->init(); - dStage_dt_c_decode(i_data, stageDt, l_funcTable_5168, 14); + dStage_dt_c_decode(i_data, stageDt, l_funcTable, ARRAY_SIZE(l_funcTable)); layerTableLoader(i_data, stageDt, param_2); } /* 80026C34-80026C8C 021574 0058+00 0/0 1/1 0/0 .text dStage_dt_c_roomReLoader__FPvP11dStage_dt_ci */ void dStage_dt_c_roomReLoader(void* i_data, dStage_dt_c* stageDt, int param_2) { - dStage_dt_c_decode(i_data, stageDt, l_funcTable_5173, 8); + static FuncTable l_funcTable[] = { + {"Door", dStage_roomDrtgInfoInit}, {"ACTR", dStage_actorCommonLayerInit}, + {"TGOB", dStage_actorCommonLayerInit}, {"TRES", dStage_roomTresureInit}, + {"TGSC", dStage_tgscCommonLayerInit}, {"SCOB", dStage_tgscCommonLayerInit}, + {"TGDR", dStage_tgscInfoInit}, {"REVT", dStage_mapEventInfoInit}, + }; + + dStage_dt_c_decode(i_data, stageDt, l_funcTable, ARRAY_SIZE(l_funcTable)); layerActorLoader(i_data, stageDt, param_2); } /* 80026C8C-80026CDC 0215CC 0050+00 0/0 1/1 0/0 .text * dStage_dt_c_fieldMapLoader__FPvP11dStage_dt_c */ void dStage_dt_c_fieldMapLoader(void* i_data, dStage_dt_c* i_stage) { + static FuncTable l_funcTable[] = { + {"TRES", dStage_fieldMapTresureInit}, + {"FILI", dStage_fieldMapFiliInfo2Init}, + {"MPAT", dStage_fieldMapMapPathInit}, + }; + dStage_dt_c_offsetToPtr(i_data); - dStage_dt_c_decode(i_data, i_stage, l_funcTable_5178, 3); + dStage_dt_c_decode(i_data, i_stage, l_funcTable, ARRAY_SIZE(l_funcTable)); } +/* ############################################################################################## */ +/* 803A6920-803A696C 003A40 004C+00 3/3 0/0 0/0 .data mMemoryBlock__20dStage_roomControl_c */ +JKRExpHeap* dStage_roomControl_c::mMemoryBlock[19] = { + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +}; + +/* 803A696C-803A6AAC 003A8C 0140+00 2/2 0/0 0/0 .data mArcBank__20dStage_roomControl_c */ +char dStage_roomControl_c::mArcBank[32][10] = {0}; + /* 80026CDC-80026D38 02161C 005C+00 0/0 1/1 0/0 .text dStage_infoCreate__Fv */ void dStage_infoCreate() { void* stageRsrc = dComIfG_getStageRes("stage.dzs"); @@ -2931,7 +2965,8 @@ void dStage_Delete() { dStage_roomControl_c::removeRoomDzs(); if (mDoRst::isReset() || !dComIfGp_isEnableNextStage() || - strcmp(dComIfGp_getNextStageName(), dComIfGp_getStartStageName())) { + strcmp(dComIfGp_getNextStageName(), dComIfGp_getStartStageName())) + { dStage_roomControl_c::destroyMemoryBlock(); if (dStage_stagInfo_GetSTType(dComIfGp_getStageStagInfo()) == ST_DUNGEON) { @@ -2997,7 +3032,7 @@ int dStage_RoomCheck(cBgS_GndChk* gndChk) { /* 800270FC-80027170 021A3C 0074+00 0/0 1/1 0/0 .text * dStage_changeSceneExitId__FR13cBgS_PolyInfofUlScs */ int dStage_changeSceneExitId(cBgS_PolyInfo& param_0, f32 speed, u32 mode, s8 roomNo, s16 angle) { - return dStage_changeScene(dComIfG_Bgsp().GetExitId(param_0), speed, mode, roomNo, angle, -1); + return dStage_changeScene(dComIfG_Bgsp().GetExitId(param_0), speed, mode, roomNo, angle, -1); } /* ############################################################################################## */ @@ -3042,8 +3077,8 @@ int dStage_changeScene(int i_exitId, f32 speed, u32 mode, s8 room_no, s16 angle, dKy_set_nexttime(15.0f * timeH); } - dComIfGp_setNextStage(scls_info->mStage, scls_info->mStart, (s8)scls_info->mRoom, (s8)layer, speed, - mode, 1, wipe == 15 ? 0 : wipe, angle, 1, wipe_time); + dComIfGp_setNextStage(scls_info->mStage, scls_info->mStart, (s8)scls_info->mRoom, (s8)layer, + speed, mode, 1, wipe == 15 ? 0 : wipe, angle, 1, wipe_time); return 1; } #else @@ -3080,7 +3115,7 @@ SECTION_DEAD static char const* const stringBase_80378BB3 = "d_stage.cpp"; /* 800272F0-800274B0 021C30 01C0+00 0/0 1/1 0/0 .text dStage_changeScene4Event__FiScibfUlsi */ #ifdef NONMATCHING int dStage_changeScene4Event(int i_exitId, s8 room_no, int i_wipe, bool param_3, f32 speed, - u32 mode, s16 angle, int param_7) { + u32 mode, s16 angle, int param_7) { stage_scls_info_dummy_class* scls; if (room_no == -1) { @@ -3110,7 +3145,7 @@ int dStage_changeScene4Event(int i_exitId, s8 room_no, int i_wipe, bool param_3, } else { wipe_time = 0; } - + s32 layer = dStage_sclsInfo_getSceneLayer(scls_info); int timeH = dStage_sclsInfo_getTimeH(scls_info); @@ -3126,8 +3161,9 @@ int dStage_changeScene4Event(int i_exitId, s8 room_no, int i_wipe, bool param_3, dKy_set_nexttime(15.0f * timeH); } - dComIfGp_setNextStage(scls_info->mStage, scls_info->mStart, (s8)scls_info->mRoom, (s8)layer, speed, - mode, 1, wipe == 15 ? 0 : wipe, angle, param_3 != false, wipe_time); + dComIfGp_setNextStage(scls_info->mStage, scls_info->mStart, (s8)scls_info->mRoom, (s8)layer, + speed, mode, 1, wipe == 15 ? 0 : wipe, angle, param_3 != false, + wipe_time); return 1; } #else @@ -3135,7 +3171,7 @@ int dStage_changeScene4Event(int i_exitId, s8 room_no, int i_wipe, bool param_3, #pragma optimization_level 0 #pragma optimizewithasm off asm int dStage_changeScene4Event(int param_0, s8 param_1, int param_2, bool param_3, f32 param_4, - u32 param_5, s16 param_6, int param_7) { + u32 param_5, s16 param_6, int param_7) { nofralloc #include "asm/d/d_stage/dStage_changeScene4Event__FiScibfUlsi.s" } diff --git a/src/d/map/d_map_path.cpp b/src/d/map/d_map_path.cpp index 2bb54c3d94..0f847db221 100644 --- a/src/d/map/d_map_path.cpp +++ b/src/d/map/d_map_path.cpp @@ -78,16 +78,16 @@ void dMpath_n::dTexObjAggregate_c::remove() { /* 8003C94C-8003CA40 03728C 00F4+00 2/0 9/2 0/0 .text * rendering__11dDrawPath_cFPCQ211dDrawPath_c10line_class */ void dDrawPath_c::rendering(dDrawPath_c::line_class const* p_line) { - if (isDrawType(p_line->unk0)) { - int width = getLineWidth(p_line->unk1); + if (isDrawType(p_line->field_0x0)) { + int width = getLineWidth(p_line->field_0x1); - if (width > 0 && p_line->unk2 >= 2) { + if (width > 0 && p_line->mDataNum >= 2) { GXSetLineWidth(width, GX_TO_ZERO); - GXSetTevColor(GX_TEVREG0, *getLineColor(p_line->unk0 & 0x3F, p_line->unk1)); - GXBegin(GX_LINESTRIP, GX_VTXFMT0, p_line->unk2); + GXSetTevColor(GX_TEVREG0, *getLineColor(p_line->field_0x0 & 0x3F, p_line->field_0x1)); + GXBegin(GX_LINESTRIP, GX_VTXFMT0, p_line->mDataNum); - u16* tmp = p_line->unk4; - for (int i = 0; i < p_line->unk2; i++) { + u16* tmp = p_line->mpData; + for (int i = 0; i < p_line->mDataNum; i++) { GXPosition1x16(*tmp); tmp++; } @@ -102,11 +102,11 @@ void dDrawPath_c::rendering(dDrawPath_c::poly_class const* p_poly) { if (isDrawType(p_poly->field_0x0)) { GXSetTevColor(GX_TEVREG0, *getColor(p_poly->field_0x0 & 0x3F)); - if (p_poly->field_0x1 >= 3) { - GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT0, p_poly->field_0x1); + if (p_poly->mDataNum >= 3) { + GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT0, p_poly->mDataNum); - u16* tmp = p_poly->field_0x4; - for (int i = 0; i < p_poly->field_0x1; i++) { + u16* tmp = p_poly->mpData; + for (int i = 0; i < p_poly->mDataNum; i++) { GXPosition1x16(*tmp); tmp++; } @@ -120,13 +120,13 @@ void dDrawPath_c::rendering(dDrawPath_c::poly_class const* p_poly) { void dDrawPath_c::rendering(dDrawPath_c::group_class const* p_group) { if (isSwitch(p_group)) { poly_class* poly = p_group->mpPoly; - for (int i = 0; i < p_group->field_0x4; i++) { + for (int i = 0; i < p_group->mPolyNum; i++) { rendering(poly); poly++; } line_class* line = p_group->mpLine; - for (int i = 0; i < p_group->field_0x2; i++) { + for (int i = 0; i < p_group->mLineNum; i++) { rendering(line); line++; } @@ -139,7 +139,7 @@ void dDrawPath_c::rendering(dDrawPath_c::floor_class const* p_floor) { if (p_floor->mpGroup != NULL) { group_class* group = p_floor->mpGroup; - for (int i = 0; i < p_floor->field_0x1; i++) { + for (int i = 0; i < p_floor->mGroupNum; i++) { rendering(group); group++; } @@ -150,12 +150,12 @@ void dDrawPath_c::rendering(dDrawPath_c::floor_class const* p_floor) { * rendering__11dDrawPath_cFPCQ211dDrawPath_c10room_class */ void dDrawPath_c::rendering(dDrawPath_c::room_class const* p_room) { if (p_room != NULL) { - GXSetArray(GX_VA_POS, p_room->field_0x8, 8); + GXSetArray(GX_VA_POS, p_room->mpFloatData, 8); floor_class* floor = p_room->mpFloor; if (floor != NULL) { - for (int i = 0; i < p_room->field_0x0; i++) { - if (isRenderingFloor(floor->field_0x0)) { + for (int i = 0; i < p_room->mFloorNum; i++) { + if (isRenderingFloor(floor->mFloorNo)) { rendering(floor); } floor++; @@ -317,7 +317,7 @@ dMpath_n::dTexObjAggregate_c dMpath_n::m_texObjAgg; /* 8003D3C0-8003D68C 037D00 02CC+00 0/0 2/2 0/0 .text * renderingDecoration__18dRenderingFDAmap_cFPCQ211dDrawPath_c10line_class */ void dRenderingFDAmap_c::renderingDecoration(dDrawPath_c::line_class const* p_line) { - s32 width = getDecorationLineWidth(p_line->unk1); + s32 width = getDecorationLineWidth(p_line->field_0x1); if (width <= 0) { return; } @@ -331,18 +331,18 @@ void dRenderingFDAmap_c::renderingDecoration(dDrawPath_c::line_class const* p_li GXSetNumTevStages(1); GXLoadTexObj(dMpath_n::m_texObjAgg.mp_texObj[6], GX_TEXMAP0); - u16* unk = p_line->unk4; - s32 unk2 = p_line->unk2; + u16* data_p = p_line->mpData; + s32 data_num = p_line->mDataNum; GXSetLineWidth(width, GX_TO_ONE); GXSetPointSize(width, GX_TO_ONE); - GXColor lineColor = *getDecoLineColor(p_line->unk0 & 0x3f, p_line->unk1); + GXColor lineColor = *getDecoLineColor(p_line->field_0x0 & 0x3f, p_line->field_0x1); GXSetTevColor(GX_TEVREG0, lineColor); lineColor.r = lineColor.r - 4; GXSetTevColor(GX_TEVREG1, lineColor); - for (int i = 0; i < unk2; unk++, i++) { + for (int i = 0; i < data_num; data_p++, i++) { #ifndef HYRULE_FIELD_SPEEDHACK - if (i < unk2 - 1) { + if (i < data_num - 1) { GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_C0); GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); @@ -350,9 +350,9 @@ void dRenderingFDAmap_c::renderingDecoration(dDrawPath_c::line_class const* p_li GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); GXBegin(GX_LINESTRIP, GX_VTXFMT0, 2); - GXPosition1x16(unk[0]); + GXPosition1x16(data_p[0]); GXTexCoord2f32(0, 0); - GXPosition1x16(unk[1]); + GXPosition1x16(data_p[1]); GXTexCoord2f32(0, 0); } GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_KONST, GX_CC_TEXC, GX_CC_C1); @@ -361,7 +361,7 @@ void dRenderingFDAmap_c::renderingDecoration(dDrawPath_c::line_class const* p_li GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); #endif GXBegin(GX_POINTS, GX_VTXFMT0, 1); - GXPosition1x16(unk[0]); + GXPosition1x16(data_p[0]); GXTexCoord2f32(0, 0); i_GXEnd(); } diff --git a/src/d/map/d_map_path_dmap.cpp b/src/d/map/d_map_path_dmap.cpp index 170d86a3e2..7c6c0ec169 100644 --- a/src/d/map/d_map_path_dmap.cpp +++ b/src/d/map/d_map_path_dmap.cpp @@ -597,6 +597,82 @@ asm void dMpath_c::createWork() { /* 8003F810-8003FA40 03A150 0230+00 1/1 1/1 0/0 .text * setPointer__8dMpath_cFPQ211dDrawPath_c10room_classPScPSc */ +// close +#ifdef NONMATCHING +int dMpath_c::setPointer(dDrawPath_c::room_class* i_room, s8* param_1, s8* param_2) { + int var_r6 = 0; + if ((u32)i_room->mpFloor >= 0x80000000) { + dDrawPath_c::floor_class* floor_p = i_room->mpFloor; + for (int i = 0; i < i_room->field_0x0; i++) { + if (floor_p->field_0x0 < *param_1) { + *param_1 = floor_p->field_0x0; + } + + if (floor_p->field_0x0 > *param_2) { + *param_2 = floor_p->field_0x0; + } + + floor_p++; + } + + dDrawPath_c::floor_class* floor_e = &i_room->mpFloor[i_room->field_0x0 - 1]; + dDrawPath_c::group_class* group_e = &floor_e->mpGroup[floor_e->field_0x1 - 1]; + + if (group_e->field_0x4 != 0) { + dDrawPath_c::poly_class* poly_e = &group_e->mpPoly[group_e->field_0x4 - 1]; + return (u32)(poly_e->field_0x4 + poly_e->field_0x1) - (u32)i_room; + } + + dDrawPath_c::line_class* line_e = &group_e->mpLine[group_e->field_0x2 - 1]; + return (u32)(line_e->unk4 + line_e->unk2) - (u32)i_room; + } + + i_room->mpFloor = (dDrawPath_c::floor_class*)((u32)i_room + (u32)i_room->mpFloor); + i_room->field_0x8 = (f32*)((u32)i_room + (u32)i_room->field_0x8); + + dDrawPath_c::floor_class* floor_p = i_room->mpFloor; + for (int i = 0; i < i_room->field_0x0; i++) { + int room = (int)i_room; + floor_p->mpGroup = (dDrawPath_c::group_class*)(room + (u32)floor_p->mpGroup); + + dDrawPath_c::group_class* group_p = floor_p->mpGroup; + for (int j = 0; j < floor_p->field_0x1; j++) { + var_r6 = (u32)group_p->mpPoly; + group_p->mpLine = (dDrawPath_c::line_class*)(room + (u32)group_p->mpLine); + + dDrawPath_c::line_class* line_p = group_p->mpLine; + for (int k = 0; k < group_p->field_0x2; k++) { + var_r6 = (u32)(line_p->unk4 + line_p->unk2); + line_p->unk4 += room; + line_p++; + } + + group_p->mpPoly = (dDrawPath_c::poly_class*)(room + (u32)group_p->mpPoly); + + dDrawPath_c::poly_class* poly_p = group_p->mpPoly; + for (int l = 0; l < group_p->field_0x4; l++) { + var_r6 = (u32)(poly_p->field_0x4 + poly_p->field_0x1); + poly_p->field_0x4 += room; + poly_p++; + } + + group_p++; + } + + if (floor_p->field_0x0 < *param_1) { + *param_1 = floor_p->field_0x0; + } + + if (floor_p->field_0x0 > *param_2) { + *param_2 = floor_p->field_0x0; + } + + floor_p++; + } + + return var_r6; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -605,6 +681,7 @@ asm void dMpath_c::setPointer(dDrawPath_c::room_class* param_0, s8* param_1, s8* #include "asm/d/map/d_map_path_dmap/setPointer__8dMpath_cFPQ211dDrawPath_c10room_classPScPSc.s" } #pragma pop +#endif struct map_path_class { int field_0x0; diff --git a/src/d/map/d_map_path_fmap.cpp b/src/d/map/d_map_path_fmap.cpp index 81515cebf8..3df3b3b622 100644 --- a/src/d/map/d_map_path_fmap.cpp +++ b/src/d/map/d_map_path_fmap.cpp @@ -6,163 +6,8 @@ #include "d/map/d_map_path_fmap.h" #include "MSL_C/float.h" #include "d/com/d_com_inf_game.h" -#include "d/map/d_map_path.h" -#include "d/d_tresure.h" #include "dol2asm.h" -// -// Types: -// - -class fmpTresTypeGroupData_c { -public: - fmpTresTypeGroupData_c() { - mpTresData = NULL; - mpNext = NULL; - } - - /* 8003EB70 */ ~fmpTresTypeGroupData_c(); - - void setTypeGroupNo(u8 i_no) { mTypeGroupNo = i_no; } - void setNextData(fmpTresTypeGroupData_c* i_next) { mpNext = i_next; } - void setTresData(const dTres_c::data_s* i_data) { mpTresData = i_data; } - const dTres_c::data_s* getTresData() { return mpTresData; } - fmpTresTypeGroupData_c* getNextData() { return mpNext; } - - /* 0x0 */ const dTres_c::data_s* mpTresData; - /* 0x0 */ fmpTresTypeGroupData_c* mpNext; - /* 0x8 */ u8 mTypeGroupNo; -}; // Size: 0xC - -class fmpTresTypeGroupDataList_c { -public: - /* 8003D790 */ void addTypeGroupData(u8, dTres_c::data_s const*); - /* 8003EB10 */ ~fmpTresTypeGroupDataList_c(); - /* 8003EC90 */ fmpTresTypeGroupDataList_c(); - - /* 0x0 */ fmpTresTypeGroupData_c* mpTypeGroupDataHead; - /* 0x4 */ fmpTresTypeGroupData_c* mpNextData; -}; - -class fmpTresTypeGroupDataListAll_c { -public: - void addTypeGroupData(u8 i_typeGroupNo, const dTres_c::data_s* i_data) { - mpTypeGroupData[i_typeGroupNo].addTypeGroupData(i_typeGroupNo, i_data); - } - - /* 0x0 */ fmpTresTypeGroupDataList_c mpTypeGroupData[17]; -}; - -class dMenu_Fmap_data_c { -public: - dTres_c::list_class* getTresure() { return mp_tresure; } - f32 getFilelist2MinX() { return m_fileList2->mLeftRmX; } - f32 getFilelist2MinZ() { return m_fileList2->mInnerRmZ; } - f32 getFilelist2MaxX() { return m_fileList2->mRightRmX; } - f32 getFilelist2MaxZ() { return m_fileList2->mFrontRmZ; } - - /* 0x0 */ dTres_c::list_class* mp_tresure; - /* 0x4 */ dStage_FileList2_dt_c* m_fileList2; - /* 0x8 */ dDrawPath_c::room_class* mp_mapPath; - /* 0xC */ void* mp_dzsData; -}; - -class dMenu_Fmap_stage_data_c; -class dMenu_Fmap_room_data_c { -public: - /* 8003D818 */ bool isArrival(); - /* 8003D868 */ void buildTresTypeGroup(int, int, int); - /* 8003D92C */ void buildFmapRoomData(int, int, f32, f32, f32, f32); - - f32 getFileList2MinX() { return mp_fmapData->getFilelist2MinX(); } - f32 getFileList2MinZ() { return mp_fmapData->getFilelist2MinZ(); } - f32 getFileList2MaxX() { return mp_fmapData->getFilelist2MaxX(); } - f32 getFileList2MaxZ() { return mp_fmapData->getFilelist2MaxZ(); } - dMenu_Fmap_room_data_c* getNextData() { return mp_nextData; } - int getRoomNo() { return m_roomNo; } - - /* 0x00 */ dMenu_Fmap_data_c* mp_fmapData; - /* 0x04 */ fmpTresTypeGroupDataListAll_c* mp_fmpTresTypeGroupDataListAll; - /* 0x08 */ dMenu_Fmap_room_data_c* mp_nextData; - /* 0x0C */ dMenu_Fmap_stage_data_c* mp_parentStage; - /* 0x10 */ u8 m_roomNo; -}; - -class dMenu_Fmap_stage_arc_data_c { -public: - u8 getVisitedRoomSaveTableNo() { return mVisitedRoomSaveTableNo; } - - /* 0x0 */ u8 field_0x0; - /* 0x1 */ u8 mSaveTableNo; - /* 0x2 */ u8 mVisitedRoomSaveTableNo; -}; - -class dMenu_Fmap_stage_data_c { -public: - /* 8003D95C */ bool isArrival(); - /* 8003D9D8 */ int buildFmapStageData(int, f32, f32); - - dMenu_Fmap_stage_arc_data_c* getStageArc() { return mpStageArc; } - dMenu_Fmap_stage_data_c* getNextData() { return mpNextData; } - - /* 0x00 */ char name[8]; - /* 0x08 */ dMenu_Fmap_stage_arc_data_c* mpStageArc; - /* 0x0C */ dMenu_Fmap_room_data_c* mp_roomTop; - /* 0x10 */ dMenu_Fmap_stage_data_c* mpNextData; - /* 0x14 */ f32 m_offsetX; - /* 0x18 */ f32 m_offsetZ; - /* 0x1C */ f32 m_stageMinX; - /* 0x20 */ f32 m_stageMinZ; - /* 0x24 */ f32 m_stageMaxX; - /* 0x28 */ f32 m_stageMaxZ; - /* 0x2C */ int m_stageCntNo; -}; - -class dMenu_Fmap_region_data_c { -public: - /* 8003DB48 */ dMenu_Fmap_stage_data_c* getMenuFmapStageData(int); - /* 8003DB70 */ void getPointStagePathInnerNo(f32, f32, int, int*, int*); - /* 8003DEE0 */ void buildFmapRegionData(int); - - /* 0x00 */ dMenu_Fmap_stage_data_c* mpMenuFmapStageDataTop; - /* 0x04 */ dMenu_Fmap_region_data_c* mpNextData; - /* 0x08 */ f32 mRegionOffsetX; - /* 0x0C */ f32 mRegionOffsetZ; - /* 0x10 */ f32 mRegionMinX; - /* 0x14 */ f32 mRegionMaxX; - /* 0x18 */ f32 mRegionMinZ; - /* 0x1C */ f32 mRegionMaxZ; - /* 0x20 */ int mRegionNo; -}; - -struct dMenu_Fmap_world_data_c { - /* 8003E028 */ void create(dMenu_Fmap_region_data_c*); - /* 8003E04C */ void buildFmapWorldData(); - - /* 0x00 */ dMenu_Fmap_region_data_c* mp_fmapRegionData; - /* 0x04 */ f32 m_worldMinX; - /* 0x08 */ f32 m_worldMinZ; - /* 0x0C */ f32 m_worldMaxX; - /* 0x10 */ f32 m_worldMaxZ; -}; - -struct dMenuFmapIconPointer_c { - /* 8003E114 */ void init(dMenu_Fmap_region_data_c*, dMenu_Fmap_stage_data_c*, u8, int, int); - /* 8003E1C0 */ void getFirstData(); - /* 8003E2BC */ void getData(); - /* 8003E350 */ void getFirstRoomData(); - /* 8003E37C */ void getNextRoomData(); - /* 8003E3A4 */ void getNextStageData(); - /* 8003E3D8 */ void getNextData(); - /* 8003E490 */ void nextData(); - /* 8003E510 */ void getValidData(); -}; - -struct dMenuFmapIconDisp_c { - /* 8003E578 */ void getPosition(int*, int*, f32*, f32*, dTres_c::data_s const**); - /* 8003E6E8 */ void isDrawDisp(); -}; - // // Forward References: //