diff --git a/asm/rel/d/a/d_a_bg/d_a_bg/createHeap__6daBg_cFv.s b/asm/rel/d/a/d_a_bg/d_a_bg/createHeap__6daBg_cFv.s index 5753102006c..087a800c0b8 100644 --- a/asm/rel/d/a/d_a_bg/d_a_bg/createHeap__6daBg_cFv.s +++ b/asm/rel/d/a/d_a_bg/d_a_bg/createHeap__6daBg_cFv.s @@ -15,8 +15,8 @@ lbl_804582B8: /* 804582EC 38 63 61 C0 */ addi r3, r3, g_dComIfG_gameInfo@l /* 0x804061C0@l */ /* 804582F0 3C 63 00 02 */ addis r3, r3, 2 /* 804582F4 3B A3 D4 F8 */ addi r29, r3, -11016 -/* 804582F8 3C 60 80 46 */ lis r3, data_80459424@ha /* 0x80459424@ha */ -/* 804582FC 3A C3 94 24 */ addi r22, r3, data_80459424@l /* 0x80459424@l */ +/* 804582F8 3C 60 80 46 */ lis r3, l_modelName@ha /* 0x80459424@ha */ +/* 804582FC 3A C3 94 24 */ addi r22, r3, l_modelName@l /* 0x80459424@l */ lbl_80458300: /* 80458300 7F 83 E3 78 */ mr r3, r28 /* 80458304 7C 96 DA 14 */ add r4, r22, r27 @@ -26,8 +26,8 @@ lbl_80458300: /* 80458314 7C 78 1B 79 */ or. r24, r3, r3 /* 80458318 40 82 00 24 */ bne lbl_8045833C /* 8045831C 7F 83 E3 78 */ mr r3, r28 -/* 80458320 3C 80 80 46 */ lis r4, data_80459468@ha /* 0x80459468@ha */ -/* 80458324 38 04 94 68 */ addi r0, r4, data_80459468@l /* 0x80459468@l */ +/* 80458320 3C 80 80 46 */ lis r4, l_modelName2@ha /* 0x80459468@ha */ +/* 80458324 38 04 94 68 */ addi r0, r4, l_modelName2@l /* 0x80459468@l */ /* 80458328 7C 80 DA 14 */ add r4, r0, r27 /* 8045832C 7F A5 EB 78 */ mr r5, r29 /* 80458330 38 C0 00 40 */ li r6, 0x40 @@ -55,8 +55,8 @@ lbl_80458374: /* 8045837C 7C 03 00 40 */ cmplw r3, r0 /* 80458380 41 80 FF E0 */ blt lbl_80458360 /* 80458384 7F 83 E3 78 */ mr r3, r28 -/* 80458388 3C 80 80 46 */ lis r4, data_804594AC@ha /* 0x804594AC@ha */ -/* 8045838C 38 04 94 AC */ addi r0, r4, data_804594AC@l /* 0x804594AC@l */ +/* 80458388 3C 80 80 46 */ lis r4, l_btkName@ha /* 0x804594AC@ha */ +/* 8045838C 38 04 94 AC */ addi r0, r4, l_btkName@l /* 0x804594AC@l */ /* 80458390 7C 80 DA 14 */ add r4, r0, r27 /* 80458394 7F A5 EB 78 */ mr r5, r29 /* 80458398 38 C0 00 40 */ li r6, 0x40 @@ -91,8 +91,8 @@ lbl_804583F8: /* 804583FC C0 03 93 88 */ lfs f0, lit_4125@l(r3) /* 0x80459388@l */ /* 80458400 D0 1E 00 10 */ stfs f0, 0x10(r30) /* 80458404 7F 83 E3 78 */ mr r3, r28 -/* 80458408 3C 80 80 46 */ lis r4, data_804594F0@ha /* 0x804594F0@ha */ -/* 8045840C 38 04 94 F0 */ addi r0, r4, data_804594F0@l /* 0x804594F0@l */ +/* 80458408 3C 80 80 46 */ lis r4, l_brkName@ha /* 0x804594F0@ha */ +/* 8045840C 38 04 94 F0 */ addi r0, r4, l_brkName@l /* 0x804594F0@l */ /* 80458410 7C 80 DA 14 */ add r4, r0, r27 /* 80458414 7F A5 EB 78 */ mr r5, r29 /* 80458418 38 C0 00 40 */ li r6, 0x40 diff --git a/asm/rel/d/a/d_a_bg/d_a_bg/draw__6daBg_cFv.s b/asm/rel/d/a/d_a_bg/d_a_bg/draw__6daBg_cFv.s index 39af3072ff2..915133a6843 100644 --- a/asm/rel/d/a/d_a_bg/d_a_bg/draw__6daBg_cFv.s +++ b/asm/rel/d/a/d_a_bg/d_a_bg/draw__6daBg_cFv.s @@ -106,8 +106,8 @@ lbl_80458A38: /* 80458A44 41 80 FF AC */ blt lbl_804589F0 /* 80458A48 3C 60 80 43 */ lis r3, g_env_light@ha /* 0x8042CA54@ha */ /* 80458A4C 38 63 CA 54 */ addi r3, r3, g_env_light@l /* 0x8042CA54@l */ -/* 80458A50 3C 80 80 46 */ lis r4, data_80459534@ha /* 0x80459534@ha */ -/* 80458A54 38 84 95 34 */ addi r4, r4, data_80459534@l /* 0x80459534@l */ +/* 80458A50 3C 80 80 46 */ lis r4, l_tevStrType@ha /* 0x80459534@ha */ +/* 80458A54 38 84 95 34 */ addi r4, r4, l_tevStrType@l /* 0x80459534@l */ /* 80458A58 7C 84 F0 2E */ lwzx r4, r4, r30 /* 80458A5C 38 A0 00 00 */ li r5, 0 /* 80458A60 80 D6 00 0C */ lwz r6, 0xc(r22) diff --git a/include/JSystem/J3DGraphAnimator/J3DAnimation.h b/include/JSystem/J3DGraphAnimator/J3DAnimation.h index a3c6b90415e..9034496b2cb 100644 --- a/include/JSystem/J3DGraphAnimator/J3DAnimation.h +++ b/include/JSystem/J3DGraphAnimator/J3DAnimation.h @@ -368,6 +368,9 @@ public: calcTransform(getFrame(), param_0, pSRTInfo); } + u16 getUpdateMaterialID(u16 idx) const { return mUpdateMaterialID[idx]; } + u16 getUpdateMaterialNum() const { return field_0x14 / 3; } + private: /* 0x0C */ int field_0xc; /* 0x10 */ int field_0x10; @@ -379,7 +382,7 @@ private: /* 0x20 */ int field_0x20; /* 0x24 */ int field_0x24; /* 0x28 */ u8 mUpdateTexMtxID[4]; - /* 0x2C */ u16 mUpdateMaterialID[2]; + /* 0x2C */ u16* mUpdateMaterialID; /* 0x30 */ JUTNameTab field_0x30; /* 0x40 */ int field_0x40; /* 0x44 */ u16 field_0x44; @@ -427,6 +430,12 @@ public: /* 8032BD9C */ virtual ~J3DAnmTevRegKey(); /* 8032BE24 */ virtual s32 getKind() const; + u16 getCRegUpdateMaterialNum() const { return mCRegUpdateMaterialNum; } + u16 getKRegUpdateMaterialNum() const { return mKRegUpdateMaterialNum; } + + u16 getCRegUpdateMaterialID(u16 idx) const { return mCRegUpdateMaterialID[idx]; } + u16 getKRegUpdateMaterialID(u16 idx) const { return mKRegUpdateMaterialID[idx]; } + private: /* 0x0C */ u16 mCRegUpdateMaterialNum; /* 0x0E */ u16 mKRegUpdateMaterialNum; @@ -438,8 +447,10 @@ private: /* 0x1A */ u16 field_0x1a; /* 0x1C */ u16 field_0x1c; /* 0x1E */ u16 field_0x1e; - /* 0x20 */ u16 mCRegUpdateMaterialID[20]; - /* 0x34 */ u16 mKRegUpdateMaterialID[20]; + /* 0x20 */ u16* mCRegUpdateMaterialID; + /* 0x24 */ u8 field_0x24[0x34 - 0x24]; + /* 0x34 */ u16* mKRegUpdateMaterialID; + /* 0x38 */ u8 field_0x38[0x48 - 0x38]; /* 0x48 */ void* field_0x48; /* 0x4C */ void* field_0x4c; /* 0x50 */ int field_0x50; diff --git a/include/JSystem/J3DGraphAnimator/J3DMaterialAttach.h b/include/JSystem/J3DGraphAnimator/J3DMaterialAttach.h index 2cbe551312a..79ed0e592d0 100644 --- a/include/JSystem/J3DGraphAnimator/J3DMaterialAttach.h +++ b/include/JSystem/J3DGraphAnimator/J3DMaterialAttach.h @@ -32,6 +32,8 @@ public: J3DTexture* getTexture() const { return mTexture; } JUTNameTab* getTextureName() const { return mTextureName; } + JUTNameTab* getMaterialName() const { return mMaterialName; } + u16 getMaterialNum() const { return mMaterialNum; } bool isLocked() const { return field_0x1c == 1; } diff --git a/include/JSystem/J3DGraphAnimator/J3DModelData.h b/include/JSystem/J3DGraphAnimator/J3DModelData.h index 1bc947fab48..766ae76a76f 100644 --- a/include/JSystem/J3DGraphAnimator/J3DModelData.h +++ b/include/JSystem/J3DGraphAnimator/J3DModelData.h @@ -22,6 +22,7 @@ public: /* 8032617C */ virtual ~J3DModelData(); J3DMaterialTable& getMaterialTable() { return mMaterialTable; } + JUTNameTab* getMaterialName() const { return mMaterialTable.getMaterialName(); } J3DVertexData& getVertexData() { return mVertexData; } u16 getShapeNum() const { return mShapeTable.getShapeNum(); } u16 getMaterialNum() const { return mMaterialTable.getMaterialNum(); } diff --git a/include/JSystem/J3DGraphBase/J3DMaterial.h b/include/JSystem/J3DGraphBase/J3DMaterial.h index 3dae56cd03b..0ab504da98e 100644 --- a/include/JSystem/J3DGraphBase/J3DMaterial.h +++ b/include/JSystem/J3DGraphBase/J3DMaterial.h @@ -63,6 +63,8 @@ public: u32 getTexNo(u32 idx) const { return mTevBlock->getTexNo(idx); } void setTevColor(u32 i, const J3DGXColorS10* i_color) { mTevBlock->setTevColor(i, i_color); } + void setTevKColor(u32 i, const J3DGXColor* i_color) { mTevBlock->setTevKColor(i, i_color); } + void setMaterialAnm(J3DMaterialAnm* i_anm) { mMaterialAnm = i_anm; } public: /* 0x04 */ J3DMaterial* mNext; diff --git a/include/JSystem/J3DGraphBase/J3DShape.h b/include/JSystem/J3DGraphBase/J3DShape.h index 3d26ef2d6be..ab571a668fe 100644 --- a/include/JSystem/J3DGraphBase/J3DShape.h +++ b/include/JSystem/J3DGraphBase/J3DShape.h @@ -97,16 +97,19 @@ public: void setScaleFlagArray(u8* pScaleFlagArray) { mScaleFlagArray = pScaleFlagArray; } void setDrawMtx(Mtx** pDrawMtx) { mDrawMtx = pDrawMtx; } void setNrmMtx(Mtx33** pNrmMtx) { mNrmMtx = pNrmMtx; } + void setTexMtxLoadType(u32 type) { mFlags = (mFlags & 0xFFFF0FFF) | type; } bool getNBTFlag() const { return mHasNBT; } u32 getBumpMtxOffset() const { return mBumpMtxOffset; } - inline J3DMaterial* getMaterial() const { return mMaterial; } - inline u32 getIndex() const { return mIndex; } - inline u32 getPipeline() const { return (mFlags >> 2) & 0x07; } - inline u32 getTexMtxLoadType() const { return mFlags & 0xF000; } - inline u32 getMtxGroupNum() const { return mMtxGroupNum; } - inline J3DShapeDraw* getShapeDraw(u32 idx) const { return mShapeDraw[idx]; } - inline J3DShapeMtx* getShapeMtx(u32 idx) const { return mShapeMtx[idx]; } + J3DMaterial* getMaterial() const { return mMaterial; } + u32 getIndex() const { return mIndex; } + u32 getPipeline() const { return (mFlags >> 2) & 0x07; } + u32 getTexMtxLoadType() const { return mFlags & 0xF000; } + u32 getMtxGroupNum() const { return mMtxGroupNum; } + J3DShapeDraw* getShapeDraw(u32 idx) const { return mShapeDraw[idx]; } + J3DShapeMtx* getShapeMtx(u32 idx) const { return mShapeMtx[idx]; } + Vec* getMin() { return &mMin; } + Vec* getMax() { return &mMax; } static void resetVcdVatCache() { sOldVcdVatCmd = NULL; } diff --git a/include/d/bg/d_bg_w_base.h b/include/d/bg/d_bg_w_base.h index 0564f0f4a76..d18386aeea5 100644 --- a/include/d/bg/d_bg_w_base.h +++ b/include/d/bg/d_bg_w_base.h @@ -17,6 +17,10 @@ class dBgW_Base : public cBgW_BgId { public: enum PushPullLabel {}; + enum PRIORITY { + PRIORITY_0, + }; + typedef s32 (*PushPull_CallBack)(cBgS_PolyInfo const&, fopAc_ac_c*, s16, dBgW_Base::PushPullLabel); @@ -91,6 +95,7 @@ public: bool ChkPushPullOk() const { return m_pushPull_Ok; } void SetRoomId(int id) { m_roomId = id; } bool ChkPriority(int prio) { return m_priority == prio; } + void SetPriority(PRIORITY priority) { m_priority = priority; } private: /* 0x08 */ u8 m_priority; diff --git a/include/d/com/d_com_inf_game.h b/include/d/com/d_com_inf_game.h index cdb09b53fc3..b6187c81c02 100644 --- a/include/d/com/d_com_inf_game.h +++ b/include/d/com/d_com_inf_game.h @@ -825,6 +825,7 @@ BOOL dComIfGs_isEventBit(u16 i_flag); int dComIfGs_isItemFirstBit(u8 i_no); u16 dComIfGs_getRupee(); static u16 dComIfGs_getLife(); +s8 dComIfGs_BossLife_public_Get(); inline void dComIfGs_init() { g_dComIfG_gameInfo.info.init(); @@ -1523,6 +1524,10 @@ inline void dComIfGs_setMemoryToCard(u8* i_saveData, int i_dataNum) { g_dComIfG_gameInfo.info.memory_to_card((char*)i_saveData, i_dataNum); } +inline int dComIfGs_createZone(int roomNo) { + return g_dComIfG_gameInfo.info.createZone(roomNo); +} + void dComIfGp_setSelectItem(int index); s32 dComIfGp_offHeapLockFlag(int flag); @@ -1544,6 +1549,7 @@ int dComIfGp_getSelectItemMaxNum(int index); void dComIfGp_mapShow(); void dComIfGp_mapHide(); bool dComIfGp_checkMapShow(); +void dComIfGp_ret_wp_set(s8); s32 dComIfGp_setHeapLockFlag(u8 flag); u8 dComIfGp_world_dark_get(); JKRExpHeap* dComIfGp_getSubHeap2D(int flag); @@ -1567,6 +1573,7 @@ static u8 dComIfGp_getDoStatus(); static u8 dComIfGp_getRStatus(); static dAttCatch_c* dComIfGp_att_getCatghTarget(); static void dComIfGp_setBottleStatus(u8 param_0, u8 param_1); +bool dComIfGp_getMapTrans(int i_roomNo, f32* o_transX, f32* o_transY, s16* o_angle); inline bool i_dComIfGp_checkPlayerStatus0(int param_0, u32 flag) { return g_dComIfG_gameInfo.play.checkPlayerStatus(param_0, 0, flag); @@ -2347,6 +2354,10 @@ inline s32 dComIfGp_roomControl_getStayNo() { return dStage_roomControl_c::getStayNo(); } +inline s32 dComIfGp_roomControl_getZoneNo(int i_roomNo) { + return dStage_roomControl_c::getZoneNo(i_roomNo); +} + inline void dComIfGp_roomControl_initZone() { g_dComIfG_gameInfo.play.getRoomControl()->initZone(); } @@ -2375,12 +2386,28 @@ inline void dComIfGp_roomControl_setStayNo(int stayNo) { g_dComIfG_gameInfo.play.getRoomControl()->setStayNo(stayNo); } +inline void dComIfGp_roomControl_setZoneNo(int roomNo, int zoneNo) { + g_dComIfG_gameInfo.play.getRoomControl()->setZoneNo(roomNo, zoneNo); +} + inline dKy_tevstr_c* dComIfGp_roomControl_getTevStr(int i_roomNo) { return g_dComIfG_gameInfo.play.getRoomControl()->getTevStr(i_roomNo); } -inline bool dComIfGp_roomControl_checkStatusFlag(int i_roomNo, u8 flag) { - return g_dComIfG_gameInfo.play.mRoomControl.checkStatusFlag(i_roomNo, flag); +inline BOOL dComIfGp_roomControl_checkStatusFlag(int i_roomNo, u8 flag) { + return g_dComIfG_gameInfo.play.getRoomControl()->checkStatusFlag(i_roomNo, flag); +} + +inline void dComIfGp_roomControl_offStatusFlag(int i_roomNo, u8 flag) { + return g_dComIfG_gameInfo.play.getRoomControl()->offStatusFlag(i_roomNo, flag); +} + +inline void dComIfGp_roomControl_onStatusFlag(int i_roomNo, u8 flag) { + return g_dComIfG_gameInfo.play.getRoomControl()->onStatusFlag(i_roomNo, flag); +} + +inline void dComIfGp_roomControl_setStatusFlag(int i_roomNo, u8 flag) { + return g_dComIfG_gameInfo.play.getRoomControl()->setStatusFlag(i_roomNo, flag); } inline void dComIfGp_roomControl_zoneCountCheck(int i_roomNo) { diff --git a/include/d/com/d_com_static.h b/include/d/com/d_com_static.h index ba51a8f5055..540fed86e53 100644 --- a/include/d/com/d_com_static.h +++ b/include/d/com/d_com_static.h @@ -48,6 +48,11 @@ public: /* 80031434 */ static bool check(s8 i_roomNo, cXyz const& i_pos); /* 800315A4 */ static void execute(); + static void reset(int roomNo) { + room_c* room = (room_c*)mRoom; // tmp + room[roomNo].reset(); + } + static u8 mData[1152]; static u8 mRoom[256]; static s16 mSetTop; diff --git a/include/d/d_demo.h b/include/d/d_demo.h index 9238020210d..82d79c0b636 100644 --- a/include/d/d_demo.h +++ b/include/d/d_demo.h @@ -273,6 +273,7 @@ public: static dDemo_actor_c* getActor(u8 param_0) { return m_object->getActor(param_0); } static u32 getFrameNoMsg() { return m_frameNoMsg; } static s32 getMode() { return m_mode; } + static int getFrame() { return m_frame; } static JStudio::stb::TControl* getControl() { return m_control; } static bool isStatus(u32 status) { return m_status & status; } static void onStatus(u32 status) { m_status |= status; } diff --git a/include/d/d_stage.h b/include/d/d_stage.h index be7e187b07a..e74c7acbb3d 100644 --- a/include/d/d_stage.h +++ b/include/d/d_stage.h @@ -684,6 +684,7 @@ public: /* 0x68 */ int mVrboxcolNumInfo; }; // Size: 0x6C +class dBgW_base; class dStage_roomStatus_c { public: /* 0x000 */ dStage_roomDt_c mRoomDt; @@ -695,7 +696,7 @@ public: /* 0x3F8 */ s8 mMemBlockID; /* 0x3F9 */ u8 mRegionNo; /* 0x3FC */ int mProcID; - /* 0x400 */ int field_0x400; + /* 0x400 */ dBgW_base* mpBgW; int getZoneNo() const { return mZoneNo; } ~dStage_roomStatus_c() {} @@ -723,6 +724,11 @@ public: /* 0x04 */ void** m_dzs; }; + struct nameData { + /* 0x0 */ s8 m_num; + /* 0x1 */ char m_names[32][10]; // ? + }; + static void createRoomDzs(u8 i_num) { m_roomDzs.create(i_num); } static void* addRoomDzs(u8 i_num, u8 roomNo) { return m_roomDzs.add(i_num, roomNo); } static void removeRoomDzs() { m_roomDzs.remove(); } @@ -744,7 +750,7 @@ public: /* 80024940 */ static char* getArcBank(int); /* 80024954 */ static bool resetArchiveBank(int); /* 80024DB0 */ static void SetTimePass(int); - /* 8025BAAC */ void setZoneNo(int, int); + /* 8025BAAC */ static void setZoneNo(int, int); static s32 GetTimePass(); static s8 getStayNo() { return mStayNo; } @@ -763,14 +769,28 @@ public: static void offNoChangeRoom() { mNoChangeRoom = false; } static void setProcID(u32 id) { mProcID = id; } 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 setFileList2(int i_roomNo, dStage_FileList2_dt_c* list) { mStatus[i_roomNo].mRoomDt.mFileList2Info = list; } - bool checkStatusFlag(int i_roomNo, u8 flag) const { + + static void setBgW(int param_0, dBgW_base* i_bgw) { + mStatus[param_0].mpBgW = i_bgw; + } + + BOOL checkStatusFlag(int i_roomNo, u8 flag) const { return cLib_checkBit(mStatus[i_roomNo].mFlag, flag); } + void offStatusFlag(int i_roomNo, u8 flag) { + return cLib_offBit(mStatus[i_roomNo].mFlag, flag); + } + + void onStatusFlag(int i_roomNo, u8 flag) { + return cLib_onBit(mStatus[i_roomNo].mFlag, flag); + } + static JKRExpHeap* mMemoryBlock[19]; static char mArcBank[32][10]; static dStage_roomStatus_c mStatus[0x40]; @@ -917,6 +937,12 @@ static s32 dStage_stagInfo_GetSaveTbl(stage_stag_info_class* param_0); void dStage_restartRoom(u32 roomParam, u32 mode, int param_2); struct cBgS_GndChk; int dStage_RoomCheck(cBgS_GndChk* gndChk); +void dStage_dt_c_roomReLoader(void* i_data, dStage_dt_c* stageDt, int param_2); +void dStage_dt_c_roomLoader(void* i_data, dStage_dt_c* stageDt, int param_2); + +inline bool dStage_roomRead_dt_c_ChkBg(u8 param_0) { + return param_0 & 0x80; +} inline s32 dStage_roomRead_dt_c_GetVrboxswitch(roomRead_data_class& data) { return data.field_0x2 & 8; @@ -970,6 +996,10 @@ inline s8 dStage_stagInfo_GetTimeH(stage_stag_info_class* p_info) { return p_info->field_0x0c >> 8; } +inline BOOL dStage_staginfo_GetArchiveHeap(stage_stag_info_class* p_info) { + return p_info->field_0x0a & 0x1000; +} + inline u32 dStage_sclsInfo_getSceneLayer(stage_scls_info_class* p_info) { return p_info->field_0xb & 0xF; } diff --git a/include/d/kankyo/d_kankyo.h b/include/d/kankyo/d_kankyo.h index 331228746f1..9e0c1dbcf66 100644 --- a/include/d/kankyo/d_kankyo.h +++ b/include/d/kankyo/d_kankyo.h @@ -37,7 +37,7 @@ static void GxFog_set(); static void GxXFog_set(); u8 dKy_pol_argument_get(cBgS_PolyInfo const* i_poly); void dKy_Sound_set(cXyz param_0, int param_1, unsigned int param_2, int param_3); - +void dKy_bg_MAxx_proc(void* param_0); struct LIGHT_INFLUENCE { /* 800CFC7C */ ~LIGHT_INFLUENCE() {} diff --git a/include/d/particle/d_particle.h b/include/d/particle/d_particle.h index b2c122b1305..2224e4a00fe 100644 --- a/include/d/particle/d_particle.h +++ b/include/d/particle/d_particle.h @@ -344,6 +344,8 @@ public: JKRExpHeap* getResHeap() { return m_resHeap; } + void levelAllForceOnEventMove() { field_0x210.allForceOnEventMove(); } + static void onStatus(u8 status) { mStatus |= status; } static void offStatus(u8 status) { mStatus &= ~status; } static bool isStatus(u8 status) { return mStatus & status; } diff --git a/include/f_op/f_op_scene_mng.h b/include/f_op/f_op_scene_mng.h index b3ecb7503bc..1e645f11df2 100644 --- a/include/f_op/f_op_scene_mng.h +++ b/include/f_op/f_op_scene_mng.h @@ -26,4 +26,8 @@ inline int fopScnM_LayerID(void* proc) { return fpcM_LayerID(proc); } +inline u32 fopScnM_GetParam(void* proc) { + return fpcM_GetParam(proc); +} + #endif diff --git a/include/f_pc/f_pc_manager.h b/include/f_pc/f_pc_manager.h index 7df7c5bc913..add8006b122 100644 --- a/include/f_pc/f_pc_manager.h +++ b/include/f_pc/f_pc_manager.h @@ -10,6 +10,7 @@ #include "f_pc/f_pc_stdcreate_req.h" #include "f_pc/f_pc_executor.h" #include "f_pc/f_pc_leaf.h" +#include "f_pc/f_pc_layer_iter.h" typedef int (*FastCreateReqFunc)(void*); typedef void (*fpcM_ManagementFunc)(void); @@ -66,6 +67,10 @@ inline BOOL fpcM_IsExecuting(unsigned int id) { return fpcEx_IsExist(id); } +inline void* fpcM_LyJudge(process_node_class* i_node, fpcLyIt_JudgeFunc i_func, void* i_data) { + return fpcLyIt_Judge(&i_node->mLayer, i_func, i_data); +} + void fpcM_Draw(void* pProc); s32 fpcM_DrawIterater(fpcM_DrawIteraterFunc pFunc); s32 fpcM_Execute(void* pProc); diff --git a/include/m_Do/m_Do_ext.h b/include/m_Do/m_Do_ext.h index 5e65b581204..3f9d17c7565 100644 --- a/include/m_Do/m_Do_ext.h +++ b/include/m_Do/m_Do_ext.h @@ -61,6 +61,10 @@ public: } int remove(J3DModelData* i_modelData) { return i_modelData->removeTexMtxAnimator(mpAnm); } + void entryFrame() { entryFrame(getFrame()); } + void entryFrame(f32 frame) { setFrame(frame); } + + J3DAnmTextureSRTKey* getBtkAnm() const { return mpAnm; } private: /* 0x14 */ J3DAnmTextureSRTKey* mpAnm; @@ -87,6 +91,10 @@ public: } int remove(J3DModelData* i_modelData) { return i_modelData->removeTevRegAnimator(mpAnm); } + void entryFrame() { entryFrame(getFrame()); } + void entryFrame(f32 frame) { setFrame(frame); } + + J3DAnmTevRegKey* getBrkAnm() const { return mpAnm; } private: /* 0x14 */ J3DAnmTevRegKey* mpAnm; @@ -508,6 +516,7 @@ J3DModel* mDoExt_J3DModel__create(J3DModelData* i_modelData, u32 param_1, u32 pa void mDoExt_setAraCacheSize(u32 size); int mDoExt_resIDToIndex(JKRArchive* p_archive, u16 id); void mDoExt_modelEntryDL(J3DModel* i_model); +void mDoExt_setupStageTexture(J3DModelData* i_modelData); struct JUTFont; JUTFont* mDoExt_getMesgFont(); diff --git a/include/m_Do/m_Do_lib.h b/include/m_Do/m_Do_lib.h index 7c51c8b22db..568000f1b4e 100644 --- a/include/m_Do/m_Do_lib.h +++ b/include/m_Do/m_Do_lib.h @@ -8,6 +8,15 @@ struct mDoLib_clipper { /* 8001528C */ void setup(f32, f32, f32, f32); + static void changeFar(f32 far) { + mClipper.setFar(far); + mClipper.calcViewFrustum(); + } + + static u32 clip(const Mtx m, const Vec* param_1, const Vec* param_2) { + return mClipper.clip(m, (Vec*)param_1, (Vec*)param_2); + } + static J3DUClipper mClipper; static f32 mSystemFar; static f32 mFovyRate; diff --git a/rel/d/a/d_a_bg/Makefile b/rel/d/a/d_a_bg/Makefile index 4790e032956..e655d9c8ffc 100644 --- a/rel/d/a/d_a_bg/Makefile +++ b/rel/d/a/d_a_bg/Makefile @@ -17,6 +17,7 @@ M3_O_FILES := \ M3_LIBS := \ M3_CFLAGS := \ + -pool off \ -sdata 0 \ -sdata2 0 \ diff --git a/rel/d/a/d_a_bg/d_a_bg.cpp b/rel/d/a/d_a_bg/d_a_bg.cpp index 13e34c48744..2b0ba111959 100644 --- a/rel/d/a/d_a_bg/d_a_bg.cpp +++ b/rel/d/a/d_a_bg/d_a_bg.cpp @@ -4,201 +4,76 @@ // #include "rel/d/a/d_a_bg/d_a_bg.h" +#include "MSL_C/MSL_Common/Src/mem.h" +#include "d/bg/d_bg_w_kcol.h" +#include "d/com/d_com_inf_game.h" +#include "d/com/d_com_static.h" +#include "d/d_demo.h" #include "dol2asm.h" -#include "dolphin/types.h" +#include "m_Do/m_Do_lib.h" // // Types: // -struct mDoMtx_stack_c { - static u8 now[48]; -}; - -struct mDoLib_clipper { - static u8 mClipper[92]; -}; - -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 fopAc_ac_c { - /* 80018B64 */ fopAc_ac_c(); - /* 80018C8C */ ~fopAc_ac_c(); -}; - -struct daSus_c { - struct room_c { - /* 800311FC */ void reset(); - }; - - static u8 mRoom[256]; -}; - struct daGrass_c { - /* 800319C8 */ void deleteRoomGrass(int); - /* 80031A20 */ void deleteRoomFlower(int); + /* 800319C8 */ static void deleteRoomGrass(int); + /* 80031A20 */ static void deleteRoomFlower(int); }; -struct daBg_c { - /* 80457BF8 */ void setArcName(); - /* 804582B8 */ void createHeap(); - /* 80458788 */ ~daBg_c(); - /* 804588C4 */ void draw(); - /* 8045906C */ void create(); -}; - -struct J3DModelData {}; - -struct daBg_btkAnm_c { - /* 80457F34 */ void create(J3DModelData*, J3DAnmTextureSRTKey*, int); +class daBg_btkAnm_c { +public: + /* 80457F34 */ int create(J3DModelData*, J3DAnmTextureSRTKey*, int); /* 80458088 */ void entry(J3DModelData*); /* 804580CC */ void play(); + + void entryFrame() { mpBtk->entryFrame(); } + void playspeed(f32 speed) { mpBtk->setPlaySpeed(speed); } + + /* 0x0 */ mDoExt_btkAnm* mpBtk; + /* 0x4 */ u8 field_0x4; }; -struct daBg_brkAnm_c { - /* 804580F0 */ void create(J3DModelData*, J3DAnmTevRegKey*, int); +class daBg_brkAnm_c { +public: + /* 804580F0 */ int create(J3DModelData*, J3DAnmTevRegKey*, int); /* 80458230 */ void entry(J3DModelData*); /* 80458274 */ void play(); + + void entryFrame() { mpBrk->entryFrame(); } + void entryFrame(f32 frame) { mpBrk->entryFrame(frame); } + f32 getEndFrame() { return mpBrk->getEndFrame(); } + + /* 0x0 */ mDoExt_brkAnm* mpBrk; + /* 0x4 */ u8 field_0x4; }; -struct dSv_event_c { - /* 800349BC */ void isEventBit(u16) const; -}; +struct daBg_unkData { + /* 0x00 */ J3DModel* mpBgModel; + /* 0x04 */ daBg_btkAnm_c* mpBgBtk; + /* 0x08 */ daBg_brkAnm_c* mpBgBrk; + /* 0x0C */ dKy_tevstr_c* mpTevStr; + /* 0x10 */ f32 mBtkAnmSpeed; +}; // Size: 0x14 -struct dStage_roomControl_c { - /* 800243B0 */ void getMemoryBlock(int); +class daBg_c : public fopAc_ac_c { +public: + /* 80457BF8 */ const char* setArcName(); + /* 804582B8 */ int createHeap(); + /* 80458788 */ ~daBg_c(); + /* 804588C4 */ int draw(); + /* 8045906C */ int create(); - static u8 mStatus[65792]; -}; + inline int execute(); -struct dKy_tevstr_c {}; - -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 { - /* 8003C37C */ void getRes(char const*, char const*, dRes_info_c*, int); -}; - -struct dDemo_c { - static u8 m_frame[4]; -}; - -struct dBgW_Base {}; - -struct dBgWKCol { - /* 8007E6F4 */ dBgWKCol(); - /* 8007E804 */ void create(void*, void*); -}; - -struct dBgW { - /* 8007B970 */ dBgW(); -}; - -struct dBgS { - /* 80074A08 */ void Regist(dBgW_Base*, fopAc_ac_c*); -}; - -struct cBgD_t {}; - -struct cBgW { - /* 80079F38 */ void Set(cBgD_t*, u32, f32 (*)[3][4]); -}; - -struct cBgS { - /* 80074250 */ void Release(dBgW_Base*); -}; - -struct Vec {}; - -struct JUTNameTab { - /* 802DEAF8 */ void getName(u16) const; -}; - -struct JKRHeap {}; - -struct JKRSolidHeap { - /* 802D0A24 */ void create(u32, JKRHeap*, bool); - /* 802D0BF4 */ void adjustSize(); -}; - -struct J3DUClipper { - /* 8027378C */ void calcViewFrustum(); - /* 80273A44 */ void clip(f32 const (*)[4], Vec*, Vec*) const; -}; - -struct J3DTexNoAnm { - /* 80457E20 */ ~J3DTexNoAnm(); - /* 80457E68 */ J3DTexNoAnm(); - /* 8045933C */ void calc(u16*) const; -}; - -struct J3DTexMtxAnm { - /* 80457E8C */ ~J3DTexMtxAnm(); - /* 80457EC8 */ J3DTexMtxAnm(); -}; - -struct J3DTevKColorAnm { - /* 80457D78 */ ~J3DTevKColorAnm(); - /* 80457DB4 */ J3DTevKColorAnm(); -}; - -struct J3DTevColorAnm { - /* 80457DCC */ ~J3DTevColorAnm(); - /* 80457E08 */ J3DTevColorAnm(); -}; - -struct J3DModel {}; - -struct J3DMaterialAnm { - /* 8032C320 */ void initialize(); -}; - -struct J3DMatColorAnm { - /* 80457EE0 */ ~J3DMatColorAnm(); - /* 80457F1C */ J3DMatColorAnm(); -}; - -struct J3DLightObj { - /* 80458750 */ J3DLightObj(); -}; - -struct J3DLightInfo { - /* 803256C4 */ void operator=(J3DLightInfo const&); -}; - -struct J3DFrameCtrl { - /* 803283FC */ void init(s16); - /* 80458040 */ ~J3DFrameCtrl(); -}; - -struct J3DAnmTexPattern { - /* 8032AF50 */ void getTexNo(u16, u16*) const; -}; +private: + /* 0x568 */ u8 field_0x568[0x570 - 0x568]; + /* 0x570 */ daBg_unkData mBgData[6]; + /* 0x5E8 */ dBgW* mpBgW; + /* 0x5EC */ dBgWKCol* mpKCol; + /* 0x5F0 */ u8 field_0x5f0; + /* 0x5F0 */ u8 field_0x5f1; +}; // Size: 0x5F4 // // Forward References: @@ -285,8 +160,6 @@ extern "C" void __as__12J3DLightInfoFRC12J3DLightInfo(); extern "C" void init__12J3DFrameCtrlFs(); extern "C" void getTexNo__16J3DAnmTexPatternCFUsPUs(); extern "C" void initialize__14J3DMaterialAnmFv(); -extern "C" void PSMTXCopy(); -extern "C" void PSMTXTrans(); extern "C" void __construct_array(); extern "C" void _savegpr_15(); extern "C" void _savegpr_20(); @@ -298,45 +171,31 @@ extern "C" void _restgpr_20(); extern "C" void _restgpr_26(); extern "C" void _restgpr_27(); extern "C" void _restgpr_29(); -extern "C" void memcmp(); -extern "C" void strcmp(); -extern "C" void strncpy(); -extern "C" extern u8 const j3dDefaultLightInfo[52]; extern "C" extern void* g_fopAc_Method[8]; -extern "C" extern void* g_fpcLf_Method[5 + 1 /* padding */]; extern "C" extern void* __vt__14J3DMaterialAnm[4]; extern "C" u8 now__14mDoMtx_stack_c[48]; extern "C" u8 mClipper__14mDoLib_clipper[92]; extern "C" u8 mStatus__20dStage_roomControl_c[65792]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; extern "C" u8 mRoom__7daSus_c[256]; -extern "C" extern u8 g_env_light[4880]; -extern "C" extern u8 j3dSys[284]; extern "C" u8 m_frame__7dDemo_c[4]; // // Declarations: // -/* ############################################################################################## */ -/* 804595B8-804595D8 000000 0020+00 1/1 0/0 0/0 .bss arcName$3823 */ -static u8 arcName[32]; - /* 80457BF8-80457C38 000078 0040+00 1/1 0/0 0/0 .text setArcName__6daBg_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daBg_c::setArcName() { - nofralloc -#include "asm/rel/d/a/d_a_bg/d_a_bg/setArcName__6daBg_cFv.s" +const char* daBg_c::setArcName() { + static char arcName[32]; + + strncpy(arcName, dComIfG_getRoomArcName(fopAcM_GetParam(this)), sizeof(arcName)); + return arcName; } -#pragma pop /* 80457C38-80457D78 0000B8 0140+00 2/2 0/0 0/0 .text createMatAnm__FP12J3DModelDataUs */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void createMatAnm(J3DModelData* param_0, u16 param_1) { +static asm int createMatAnm(J3DModelData* param_0, u16 param_1) { nofralloc #include "asm/rel/d/a/d_a_bg/d_a_bg/createMatAnm__FP12J3DModelDataUs.s" } @@ -385,304 +244,31 @@ asm J3DTevColorAnm::J3DTevColorAnm() { /* ############################################################################################## */ /* 80459424-80459468 000000 0042+02 1/1 0/0 0/0 .data * l_modelName$localstatic3$createHeap__6daBg_cFv */ -SECTION_DATA static u8 data_80459424[66 + 2 /* padding */] = { - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x2E, - 0x62, - 0x6D, - 0x64, - 0x00, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x31, - 0x2E, - 0x62, - 0x6D, - 0x64, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x32, - 0x2E, - 0x62, - 0x6D, - 0x64, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x33, - 0x2E, - 0x62, - 0x6D, - 0x64, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x34, - 0x2E, - 0x62, - 0x6D, - 0x64, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x35, - 0x2E, - 0x62, - 0x6D, - 0x64, - 0x00, - /* padding */ - 0x00, - 0x00, +SECTION_DATA static char l_modelName[6][11] = { + "model.bmd", "model1.bmd", "model2.bmd", "model3.bmd", "model4.bmd", "model5.bmd", }; /* 80459468-804594AC 000044 0042+02 1/1 0/0 0/0 .data * l_modelName2$localstatic4$createHeap__6daBg_cFv */ -SECTION_DATA static u8 data_80459468[66 + 2 /* padding */] = { - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x2E, - 0x62, - 0x64, - 0x6C, - 0x00, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x31, - 0x2E, - 0x62, - 0x64, - 0x6C, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x32, - 0x2E, - 0x62, - 0x64, - 0x6C, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x33, - 0x2E, - 0x62, - 0x64, - 0x6C, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x34, - 0x2E, - 0x62, - 0x64, - 0x6C, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x35, - 0x2E, - 0x62, - 0x64, - 0x6C, - 0x00, - /* padding */ - 0x00, - 0x00, +SECTION_DATA static char l_modelName2[6][11] = { + "model.bdl", "model1.bdl", "model2.bdl", "model3.bdl", "model4.bdl", "model5.bdl", }; /* 804594AC-804594F0 000088 0042+02 1/1 0/0 0/0 .data l_btkName$localstatic5$createHeap__6daBg_cFv */ -SECTION_DATA static u8 data_804594AC[66 + 2 /* padding */] = { - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x2E, - 0x62, - 0x74, - 0x6B, - 0x00, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x31, - 0x2E, - 0x62, - 0x74, - 0x6B, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x32, - 0x2E, - 0x62, - 0x74, - 0x6B, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x33, - 0x2E, - 0x62, - 0x74, - 0x6B, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x34, - 0x2E, - 0x62, - 0x74, - 0x6B, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x35, - 0x2E, - 0x62, - 0x74, - 0x6B, - 0x00, - /* padding */ - 0x00, - 0x00, +SECTION_DATA static char l_btkName[6][11] = { + "model.btk", "model1.btk", "model2.btk", "model3.btk", "model4.btk", "model5.btk", }; /* 804594F0-80459534 0000CC 0042+02 1/1 0/0 0/0 .data l_brkName$localstatic6$createHeap__6daBg_cFv */ -SECTION_DATA static u8 data_804594F0[66 + 2 /* padding */] = { - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x2E, - 0x62, - 0x72, - 0x6B, - 0x00, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x31, - 0x2E, - 0x62, - 0x72, - 0x6B, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x32, - 0x2E, - 0x62, - 0x72, - 0x6B, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x33, - 0x2E, - 0x62, - 0x72, - 0x6B, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x34, - 0x2E, - 0x62, - 0x72, - 0x6B, - 0x00, - 0x6D, - 0x6F, - 0x64, - 0x65, - 0x6C, - 0x35, - 0x2E, - 0x62, - 0x72, - 0x6B, - 0x00, - /* padding */ - 0x00, - 0x00, +SECTION_DATA static char l_brkName[6][11] = { + "model.brk", "model1.brk", "model2.brk", "model3.brk", "model4.brk", "model5.brk", }; /* 80459534-8045954C 000110 0018+00 1/1 0/0 0/0 .data l_tevStrType$localstatic3$draw__6daBg_cFv */ -SECTION_DATA static u8 data_80459534[24] = { - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, - 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, +SECTION_DATA static int l_tevStrType[6] = { + 32, 33, 34, 35, 35, 32, }; /* 8045954C-8045956C -00001 0020+00 1/0 0/0 0/0 .data l_daBg_Method */ @@ -792,20 +378,47 @@ COMPILER_STRIP_GATE(0x80459380, &lit_3900); /* 80457F34-80458040 0003B4 010C+00 1/1 0/0 0/0 .text * create__13daBg_btkAnm_cFP12J3DModelDataP19J3DAnmTextureSRTKeyi */ +// matches with literals +#ifdef NONMATCHING +int daBg_btkAnm_c::create(J3DModelData* i_modelData, J3DAnmTextureSRTKey* i_btk, int i_anmPlay) { + mpBtk = new mDoExt_btkAnm(); + + if (mpBtk == NULL) { + return 0; + } + + if (!mpBtk->init(i_modelData, i_btk, i_anmPlay, -1, 1.0f, 0, -1)) { + return 0; + } + + J3DAnmTextureSRTKey* btk = mpBtk->getBtkAnm(); + for (u16 i = 0; i < btk->getUpdateMaterialNum(); i++) { + u16 matID = btk->getUpdateMaterialID(i); + + if (!createMatAnm(i_modelData, matID)) { + return 0; + } + } + + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void daBg_btkAnm_c::create(J3DModelData* param_0, J3DAnmTextureSRTKey* param_1, int param_2) { +asm int daBg_btkAnm_c::create(J3DModelData* param_0, J3DAnmTextureSRTKey* param_1, int param_2) { nofralloc #include "asm/rel/d/a/d_a_bg/d_a_bg/create__13daBg_btkAnm_cFP12J3DModelDataP19J3DAnmTextureSRTKeyi.s" } #pragma pop +#endif /* 80458040-80458088 0004C0 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/d_a_bg/d_a_bg/__dt__12J3DFrameCtrlFv.s" } @@ -822,6 +435,13 @@ SECTION_RODATA static u8 const lit_3914[4] = { COMPILER_STRIP_GATE(0x80459384, &lit_3914); /* 80458088-804580CC 000508 0044+00 1/1 0/0 0/0 .text entry__13daBg_btkAnm_cFP12J3DModelData */ +// matches with literals +#ifdef NONMATCHING +void daBg_btkAnm_c::entry(J3DModelData* i_modelData) { + mpBtk->entry(i_modelData, 0.0f); + field_0x4 = 0; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -830,29 +450,66 @@ asm void daBg_btkAnm_c::entry(J3DModelData* param_0) { #include "asm/rel/d/a/d_a_bg/d_a_bg/entry__13daBg_btkAnm_cFP12J3DModelData.s" } #pragma pop +#endif /* 804580CC-804580F0 00054C 0024+00 1/1 0/0 0/0 .text play__13daBg_btkAnm_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daBg_btkAnm_c::play() { - nofralloc -#include "asm/rel/d/a/d_a_bg/d_a_bg/play__13daBg_btkAnm_cFv.s" +void daBg_btkAnm_c::play() { + mpBtk->play(); } -#pragma pop /* 804580F0-80458230 000570 0140+00 1/1 0/0 0/0 .text * create__13daBg_brkAnm_cFP12J3DModelDataP15J3DAnmTevRegKeyi */ +// matches with literals +#ifdef NONMATCHING +int daBg_brkAnm_c::create(J3DModelData* i_modelData, J3DAnmTevRegKey* i_brk, int i_anmPlay) { + mpBrk = new mDoExt_brkAnm(); + + if (mpBrk == NULL) { + return 0; + } + + if (!mpBrk->init(i_modelData, i_brk, i_anmPlay, -1, 1.0f, 0, -1)) { + return 0; + } + + J3DAnmTevRegKey* brk = mpBrk->getBrkAnm(); + for (u16 i = 0; i < brk->getCRegUpdateMaterialNum(); i++) { + u16 matID = brk->getCRegUpdateMaterialID(i); + + if (!createMatAnm(i_modelData, matID)) { + return 0; + } + } + + for (u16 i = 0; i < brk->getKRegUpdateMaterialNum(); i++) { + u16 matID = brk->getKRegUpdateMaterialID(i); + + if (!createMatAnm(i_modelData, matID)) { + return 0; + } + } + + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void daBg_brkAnm_c::create(J3DModelData* param_0, J3DAnmTevRegKey* param_1, int param_2) { +asm int daBg_brkAnm_c::create(J3DModelData* param_0, J3DAnmTevRegKey* param_1, int param_2) { nofralloc #include "asm/rel/d/a/d_a_bg/d_a_bg/create__13daBg_brkAnm_cFP12J3DModelDataP15J3DAnmTevRegKeyi.s" } #pragma pop +#endif /* 80458230-80458274 0006B0 0044+00 1/1 0/0 0/0 .text entry__13daBg_brkAnm_cFP12J3DModelData */ +// matches with literals +#ifdef NONMATCHING +void daBg_brkAnm_c::entry(J3DModelData* i_modelData) { + mpBrk->entry(i_modelData, 0.0f); + field_0x4 = 0; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -861,26 +518,17 @@ asm void daBg_brkAnm_c::entry(J3DModelData* param_0) { #include "asm/rel/d/a/d_a_bg/d_a_bg/entry__13daBg_brkAnm_cFP12J3DModelData.s" } #pragma pop +#endif /* 80458274-80458298 0006F4 0024+00 1/1 0/0 0/0 .text play__13daBg_brkAnm_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daBg_brkAnm_c::play() { - nofralloc -#include "asm/rel/d/a/d_a_bg/d_a_bg/play__13daBg_brkAnm_cFv.s" +void daBg_brkAnm_c::play() { + mpBrk->play(); } -#pragma pop /* 80458298-804582B8 000718 0020+00 1/1 0/0 0/0 .text checkCreateHeap__FP10fopAc_ac_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void checkCreateHeap(fopAc_ac_c* param_0) { - nofralloc -#include "asm/rel/d/a/d_a_bg/d_a_bg/checkCreateHeap__FP10fopAc_ac_c.s" +static int checkCreateHeap(fopAc_ac_c* i_this) { + return static_cast(i_this)->createHeap(); } -#pragma pop /* ############################################################################################## */ /* 80459388-8045938C 000014 0004+00 1/1 0/0 0/0 .rodata @4125 */ @@ -900,44 +548,168 @@ SECTION_DEAD static char const* const stringBase_804593C6 = "room.plc"; #pragma pop /* 804582B8-80458750 000738 0498+00 2/2 0/0 1/1 .text createHeap__6daBg_cFv */ +// regalloc +#ifdef NONMATCHING +int daBg_c::createHeap() { + const char* arcName = setArcName(); + s32 prm = fopAcM_GetParam(this); + daBg_unkData* bgData = mBgData; + + for (int i = 0; i < 6; bgData++, i++) { + J3DModelData* modelData = (J3DModelData*)dComIfG_getStageRes(arcName, l_modelName[i]); + if (modelData == NULL) { + modelData = (J3DModelData*)dComIfG_getStageRes(arcName, l_modelName2[i]); + } + + if (modelData != NULL) { + mDoExt_setupStageTexture(modelData); + u32 modelFlags = 0x11000084; + + for (u16 j = 0; j < modelData->getMaterialNum(); j++) { + modelData->getMaterialNodePointer(j)->setMaterialAnm(NULL); + } + + J3DAnmTextureSRTKey* btk = + (J3DAnmTextureSRTKey*)dComIfG_getStageRes(arcName, l_btkName[i]); + if (btk != NULL) { + bgData->mpBgBtk = new daBg_btkAnm_c(); + if (bgData->mpBgBtk == NULL) { + return 0; + } + + if (!bgData->mpBgBtk->create(modelData, btk, TRUE)) { + return 0; + } + + modelFlags |= 0x1200; + } else { + bgData->mpBgBtk = NULL; + } + bgData->mBtkAnmSpeed = -1.0f; + + J3DAnmTevRegKey* brk = (J3DAnmTevRegKey*)dComIfG_getStageRes(arcName, l_brkName[i]); + if (brk != NULL) { + bgData->mpBgBrk = new daBg_brkAnm_c(); + if (bgData->mpBgBrk == NULL) { + return 0; + } + + if (!bgData->mpBgBrk->create(modelData, brk, TRUE)) { + return 0; + } + } else { + bgData->mpBgBrk = NULL; + } + + for (u16 j = 0; j < modelData->getMaterialNum(); j++) { + const char* name = modelData->getMaterialName()->getName(j); + + if (name[3] == 'M' && name[4] == 'A') { + if (!memcmp(&name[5], &"00", 2)) { + modelFlags |= 0x1200; + } else if (!memcmp(&name[5], &"01", 2)) { + modelFlags |= 0x20000000; + } else if (!memcmp(&name[5], &"12", 2) || !memcmp(&name[5], &"18", 2)) { + field_0x5f0 = 1; + } + } + } + + bgData->mpBgModel = mDoExt_J3DModel__create(modelData, 0, modelFlags); + if (bgData->mpBgModel == NULL) { + return 0; + } + + bgData->mpTevStr = new dKy_tevstr_c(); + if (bgData->mpTevStr == NULL) { + return 0; + } + + dKy_tevstr_init(bgData->mpTevStr, prm, 0xFF); + } + } + + cBgD_t* dzb = (cBgD_t*)dComIfG_getStageRes(arcName, "room.dzb"); + if (dzb != NULL) { + mpKCol = NULL; + mpBgW = new dBgW(); + if (mpBgW == NULL) { + return 0; + } + + if (mpBgW->Set(dzb, 0x20, NULL)) { + return 0; + } + + dStage_roomControl_c::setBgW(prm, (dBgW_base*)mpBgW); + mpBgW->SetPriority(dBgW_Base::PRIORITY_0); + } else { + void* kcl = dComIfG_getStageRes(arcName, "room.kcl"); + void* plc = dComIfG_getStageRes(arcName, "room.plc"); + + if (kcl != NULL && plc != NULL) { + mpBgW = NULL; + mpKCol = new dBgWKCol(); + if (mpKCol == NULL) { + return 0; + } + + mpKCol->create(kcl, plc); + mpKCol->SetPriority(dBgW_Base::PRIORITY_0); + } else { + mpBgW = NULL; + mpKCol = NULL; + } + } + + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void daBg_c::createHeap() { +asm int daBg_c::createHeap() { nofralloc #include "asm/rel/d/a/d_a_bg/d_a_bg/createHeap__6daBg_cFv.s" } #pragma pop +#endif /* 80458750-80458788 000BD0 0038+00 1/1 0/0 0/0 .text __ct__11J3DLightObjFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm J3DLightObj::J3DLightObj() { +// asm J3DLightObj::J3DLightObj() { +extern "C" asm void __ct__11J3DLightObjFv() { nofralloc #include "asm/rel/d/a/d_a_bg/d_a_bg/__ct__11J3DLightObjFv.s" } #pragma pop /* 80458788-804588A4 000C08 011C+00 1/1 0/0 0/0 .text __dt__6daBg_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm daBg_c::~daBg_c() { - nofralloc -#include "asm/rel/d/a/d_a_bg/d_a_bg/__dt__6daBg_cFv.s" +daBg_c::~daBg_c() { + int roomNo = fopAcM_GetParam(this); + + if (mHeap != NULL && mpBgW != NULL) { + dComIfG_Bgsp().Release(mpBgW); + dStage_roomControl_c::setBgW(roomNo, NULL); + } + + if (mHeap != NULL && mpKCol != NULL) { + dComIfG_Bgsp().Release(mpKCol); + dStage_roomControl_c::setBgW(roomNo, NULL); + } + + daGrass_c::deleteRoomGrass(roomNo); + daGrass_c::deleteRoomFlower(roomNo); + daSus_c::reset(roomNo); + dComIfGp_roomControl_offStatusFlag(roomNo, 0x10); } -#pragma pop /* 804588A4-804588C4 000D24 0020+00 1/0 0/0 0/0 .text daBg_Draw__FP6daBg_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daBg_Draw(daBg_c* param_0) { - nofralloc -#include "asm/rel/d/a/d_a_bg/d_a_bg/daBg_Draw__FP6daBg_c.s" +static int daBg_Draw(daBg_c* i_this) { + return i_this->draw(); } -#pragma pop /* ############################################################################################## */ /* 8045938C-80459390 000018 0004+00 0/1 0/0 0/0 .rodata @4479 */ @@ -987,64 +759,329 @@ SECTION_DEAD static char const* const stringBase_80459418 = "MA00_Kusa"; #pragma pop /* 804588C4-80458F38 000D44 0674+00 1/1 0/0 0/0 .text draw__6daBg_cFv */ +#ifdef NONMATCHING +int daBg_c::draw() { + int roomNo = fopAcM_GetParam(this); + daBg_unkData* bgData = mBgData; + + dComIfGd_setListBG(); + mDoLib_clipper::changeFar(1000000.0f); + + for (int i = 0; i < 6; bgData++, i++) { + if (bgData->mpBgModel != NULL) { + J3DModelData* modelData = bgData->mpBgModel->getModelData(); + + if (bgData->mpBgBtk != NULL) { + bgData->mpBgBtk->entryFrame(); + } + + if (bgData->mpBgBrk != NULL) { + if (field_0x5f0 == 9) { + bgData->mpBgBrk->entryFrame(bgData->mpBgBrk->getEndFrame()); + } else { + bgData->mpBgBrk->entryFrame(); + } + } + + bgData->mpBgModel->calc(); + + for (u16 j = 0; j < modelData->getShapeNum(); j++) { + J3DShape* shape = modelData->getShapeNodePointer(j); + + if (mDoLib_clipper::clip(j3dSys.getViewMtx(), shape->getMin(), shape->getMax())) { + shape->hide(); + } else { + shape->show(); + } + } + + g_env_light.settingTevStruct(l_tevStrType[i], NULL, bgData->mpTevStr); + g_env_light.setLightTevColorType_MAJI(bgData->mpBgModel, bgData->mpTevStr); + dKy_bg_MAxx_proc(bgData->mpBgModel); + + if (bgData->mpBgModel != NULL) { + modelData = bgData->mpBgModel->getModelData(); + + for (u16 j = 0; j < modelData->getMaterialNum(); j++) { + J3DMaterial* mat = modelData->getMaterialNodePointer(j); + const char* name = modelData->getMaterialName()->getName(j); + + if (!memcmp(&name[3], &"MA12", 4)) { + if (g_env_light.mColPatCurr == 6) { + field_0x5f0 = 0; + } + } else if (!memcmp(&name[3], &"MA18", 4)) { + if (dDemo_c::getFrame() > 1117) { + field_0x5f0 = 0; + } + + if (i_dComIfGs_isEventBit(0x0D04)) { + field_0x5f0 = 9; + } + } else if (!memcmp(&name[3], &"MA15", 4)) { + if (dComIfGs_BossLife_public_Get() == -1) { + field_0x5f0 = 0; + } else { + field_0x5f0 = dComIfGs_BossLife_public_Get() + 1; + } + } else if (!memcmp(&name[3], &"MA09", 4)) { + bgData->mBtkAnmSpeed = 1.0f - (1.0f - g_env_light.mWaterSurfaceShineRate); + } else if (!memcmp(&name[3], &"MA05", 4)) { + bgData->mpTevStr->field_0x378 |= j; + } + + if (!strcmp(dComIfGp_getStartStageName(), "F_SP127") || + !strcmp(dComIfGp_getStartStageName(), "R_SP127")) { + if (!memcmp(&name[3], &"MA00_Enkei_Tree_Color", 21) || + !memcmp(&name[3], &"MA00_Gake", 9) || + !memcmp(&name[3], &"MA00_Kusa", 9)) { + J3DGXColorS10 colorS10; + J3DGXColor color; + + s16 var_r0; + s16 var_r3; + s16 var_r5; + switch (g_env_light.field_0x12fe) { + case 2: + var_r5 = -3; + var_r0 = 0; + var_r3 = -4; + break; + case 3: + var_r5 = 0; + var_r0 = -10; + var_r3 = -13; + break; + case 4: + var_r5 = 18; + var_r0 = 17; + var_r3 = 25; + break; + default: + var_r5 = 0; + var_r0 = 0; + var_r3 = 0; + break; + } + + f32 temp_f2 = bgData->mpTevStr->mColorC0.r / 10.0f; + f32 var_f2 = temp_f2 * temp_f2; + if (var_f2 > 1.0f) { + var_f2 = 1.0f; + } + colorS10.mColor.r = var_r5 * var_f2; + + f32 temp_f2_2 = bgData->mpTevStr->mColorC0.g / 10.0f; + f32 var_f2_2 = temp_f2_2 * temp_f2_2; + if (var_f2_2 > 1.0f) { + var_f2_2 = 1.0f; + } + colorS10.mColor.g = var_r0 * var_f2_2; + + f32 temp_f2_3 = bgData->mpTevStr->mColorC0.b / 10.0f; + f32 var_f2_3 = temp_f2_3 * temp_f2_3; + if (var_f2_3 > 1.0f) { + var_f2_3 = 1.0f; + } + colorS10.mColor.b = var_r3 * var_f2_3; + colorS10.mColor.a = 255; + mat->setTevColor(0, &colorS10); + + color.r = 0; + color.g = 0; + color.b = 0; + color.a = 255; + mat->setTevKColor(0, &color); + } + } + } + + mDoExt_modelEntryDL(bgData->mpBgModel); + dComIfGd_setListBG(); + } + } + } + + dComIfGd_setList(); + g_env_light.settingTevStruct(0x10, NULL, dComIfGp_roomControl_getTevStr(roomNo)); + + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void daBg_c::draw() { +asm int daBg_c::draw() { nofralloc #include "asm/rel/d/a/d_a_bg/d_a_bg/draw__6daBg_cFv.s" } #pragma pop +#endif /* ############################################################################################## */ /* 804593A4-804593A8 000030 0004+00 1/1 0/0 0/0 .rodata @4524 */ SECTION_RODATA static f32 const lit_4524 = 100.0f; COMPILER_STRIP_GATE(0x804593A4, &lit_4524); +int daBg_c::execute() { + daBg_unkData* bgData = mBgData; + + for (int i = 0; i < 6; i++) { + if (bgData->mpBgBtk != NULL) { + if (field_0x5f1 != 0) { + bgData->mpBgBtk->playspeed((field_0x5f1 - 1) / 100.0f); + } + + if (bgData->mBtkAnmSpeed >= 0.0f) { + bgData->mpBgBtk->playspeed(bgData->mBtkAnmSpeed); + } + bgData->mpBgBtk->play(); + } + + if (bgData->mpBgBrk != NULL && field_0x5f0 == 0) { + bgData->mpBgBrk->play(); + } + + bgData++; + } + + return 1; +} + /* 80458F38-8045901C 0013B8 00E4+00 1/0 0/0 0/0 .text daBg_Execute__FP6daBg_c */ +// matches with literals +#ifdef NONMATCHING +static int daBg_Execute(daBg_c* i_this) { + return i_this->execute(); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void daBg_Execute(daBg_c* param_0) { +static asm int daBg_Execute(daBg_c* i_this) { nofralloc #include "asm/rel/d/a/d_a_bg/d_a_bg/daBg_Execute__FP6daBg_c.s" } #pragma pop +#endif /* 8045901C-80459024 00149C 0008+00 1/0 0/0 0/0 .text daBg_IsDelete__FP6daBg_c */ -static bool daBg_IsDelete(daBg_c* param_0) { - return true; +static int daBg_IsDelete(daBg_c* i_this) { + return 1; } /* 80459024-8045904C 0014A4 0028+00 1/0 0/0 0/0 .text daBg_Delete__FP6daBg_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daBg_Delete(daBg_c* param_0) { - nofralloc -#include "asm/rel/d/a/d_a_bg/d_a_bg/daBg_Delete__FP6daBg_c.s" +static int daBg_Delete(daBg_c* i_this) { + i_this->~daBg_c(); + return 1; } -#pragma pop /* 8045904C-8045906C 0014CC 0020+00 1/0 0/0 0/0 .text daBg_Create__FP10fopAc_ac_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daBg_Create(fopAc_ac_c* param_0) { - nofralloc -#include "asm/rel/d/a/d_a_bg/d_a_bg/daBg_Create__FP10fopAc_ac_c.s" +static int daBg_Create(fopAc_ac_c* i_this) { + return static_cast(i_this)->create(); } -#pragma pop /* 8045906C-8045933C 0014EC 02D0+00 1/1 0/0 0/0 .text create__6daBg_cFv */ +// regalloc +#ifdef NONMATCHING +int daBg_c::create() { + int roomNo = fopAcM_GetParam(this); + field_0x5f0 = 0; + field_0x5f1 = 0; + + if (mHeap == NULL) { + if (!fopAcM_CheckCondition(this, 8)) { + new (this) daBg_c(); + fopAcM_OnCondition(this, 8); + } + + orig.mRoomNo = roomNo; + current.mRoomNo = roomNo; + + JKRExpHeap* heap = dStage_roomControl_c::getMemoryBlock(roomNo); + if (heap != NULL) { + mHeap = JKRSolidHeap::create(-1, heap, false); + + JKRHeap* old = mDoExt_setCurrentHeap(mHeap); + createHeap(); + + mDoExt_setCurrentHeap(old); + mHeap->adjustSize(); + } else if (!fopAcM_entrySolidHeap(this, checkCreateHeap, 0x80020040)) { + return cPhs_ERROR_e; + } + + daBg_unkData* bgData = mBgData; + for (int i = 0; i < 6; i++) { + if (bgData->mpBgModel != NULL) { + J3DModelData* modelData = bgData->mpBgModel->getModelData(); + + if (bgData->mpBgBtk != NULL) { + bgData->mpBgBtk->entry(modelData); + } + + if (bgData->mpBgBrk != NULL) { + bgData->mpBgBrk->entry(modelData); + } + } + bgData++; + } + + f32 transX; + f32 transY; + s16 angle; + if (dComIfGp_getMapTrans(roomNo, &transX, &transY, &angle)) { + daBg_unkData* bgData_ = mBgData; + for (int i = 0; i < 6; i++) { + J3DModel* model = bgData_->mpBgModel; + + if (model != NULL) { + mDoMtx_stack_c::transS(transX, 0.0f, transY); + mDoMtx_stack_c::YrotM(angle); + model->i_setBaseTRMtx(mDoMtx_stack_c::get()); + + J3DModelData* modelData = model->getModelData(); + for (u16 j = 0; j < modelData->getMaterialNum(); j++) { + const char* name = modelData->getMaterialName()->getName(j); + + if (name[3] == 'M' && name[4] == 'A' && name[5] == '0' && name[6] == '8') { + modelData->getMaterialNodePointer(j)->getShape()->setTexMtxLoadType( + 0x2000); + } + } + } + bgData_++; + } + } + + if (mpBgW != NULL) { + if (dComIfG_Bgsp().Regist(mpBgW, this)) { + return cPhs_ERROR_e; + } + } + + if (mpKCol != NULL) { + if (dComIfG_Bgsp().Regist(mpKCol, this)) { + return cPhs_ERROR_e; + } + } + + dKy_tevstr_init(dComIfGp_roomControl_getTevStr(roomNo), roomNo, 0xFF); + } + + dComIfGp_roomControl_onStatusFlag(roomNo, 0x10); + return cPhs_COMPLEATE_e; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void daBg_c::create() { +asm int daBg_c::create() { nofralloc #include "asm/rel/d/a/d_a_bg/d_a_bg/create__6daBg_cFv.s" } #pragma pop +#endif /* 8045933C-8045936C 0017BC 0030+00 1/0 0/0 0/0 .text calc__11J3DTexNoAnmCFPUs */ #pragma push diff --git a/src/d/com/d_com_inf_game.cpp b/src/d/com/d_com_inf_game.cpp index 1c6dfc1dcb3..ccf5326297d 100644 --- a/src/d/com/d_com_inf_game.cpp +++ b/src/d/com/d_com_inf_game.cpp @@ -1365,10 +1365,10 @@ int dComIfGd_setSimpleShadow(cXyz* i_pos, f32 param_1, f32 param_2, cBgS_PolyInf } /* 8002D1AC-8002D25C 027AEC 00B0+00 0/0 0/0 1/1 .text dComIfGp_getMapTrans__FiPfPfPs */ -int dComIfGp_getMapTrans(int i_roomNo, f32* o_transX, f32* o_transY, s16* o_angle) { +bool dComIfGp_getMapTrans(int i_roomNo, f32* o_transX, f32* o_transY, s16* o_angle) { dStage_Multi_c* multi = dComIfGp_getMulti(); if (multi == NULL) { - return 0; + return false; } dStage_Mult_info* info = multi->mInfo; @@ -1377,12 +1377,12 @@ int dComIfGp_getMapTrans(int i_roomNo, f32* o_transX, f32* o_transY, s16* o_angl *o_transX = info->mTransX; *o_transY = info->mTransY; *o_angle = info->mAngle; - return 1; + return true; } info++; } - return 0; + return false; } /* 8002D25C-8002D2AC 027B9C 0050+00 0/0 3/3 3/3 .text dComIfGp_getRoomCamera__Fi */ diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp index dc582d2f9be..a502a41ddcb 100644 --- a/src/d/d_stage.cpp +++ b/src/d/d_stage.cpp @@ -528,7 +528,7 @@ void dStage_roomControl_c::init() { } status->mMemBlockID = -1; - status->field_0x400 = 0; + status->mpBgW = NULL; status++; } diff --git a/src/d/s/d_s_room.cpp b/src/d/s/d_s_room.cpp index 533ade06b04..dee514aed77 100644 --- a/src/d/s/d_s_room.cpp +++ b/src/d/s/d_s_room.cpp @@ -5,24 +5,25 @@ #include "d/s/d_s_room.h" #include "d/com/d_com_inf_game.h" +#include "d/d_procname.h" +#include "d/s/d_s_play.h" #include "dol2asm.h" -#include "dolphin/types.h" #include "f_op/f_op_scene.h" +static bool resetArchiveBank(int param_0); +static bool setArchiveBank(int param_0); + // // Types: // -class room_of_scene_class : public process_node_class { +class room_of_scene_class : public scene_class { public: - /* 0x1AC */ process_method_class* mpProcessMtd; - /* 0x1B0 */ scene_tag_class* field_0x1b0; - /* 0x1B4 */ u8 field_0x1b4[0x10]; /* 0x1C4 */ request_of_phase_process_class field_0x1c4; - /* 0x1CC */ void* field_0x1cc; - /* 0x1D0 */ dStage_roomDt_c* field_0x1d0; + /* 0x1CC */ void* mpDzrRes; + /* 0x1D0 */ dStage_roomDt_c* mpRoomDt; /* 0x1D4 */ s8 field_0x1d4; - /* 0x1D5 */ s8 field_0x1d5; + /* 0x1D5 */ u8 field_0x1d5; /* 0x1D6 */ u8 field_0x1d6[2]; /* 0x1D8 */ u8 field_0x1d8; }; @@ -110,15 +111,14 @@ extern "C" u8 mDemoArcName__20dStage_roomControl_c[10 + 2 /* padding */]; extern "C" u8 mResetData__6mDoRst[4 + 4 /* padding */]; extern "C" u8 mArcBankName__20dStage_roomControl_c[4]; extern "C" u8 mArcBankData__20dStage_roomControl_c[4]; -extern "C" extern u8 pauseTimer__9dScnPly_c[4]; // // Declarations: // /* 8025AE1C-8025AE24 25575C 0008+00 1/0 0/0 0/0 .text dScnRoom_Draw__FP19room_of_scene_class */ -static bool dScnRoom_Draw(room_of_scene_class* param_0) { - return true; +static int dScnRoom_Draw(room_of_scene_class* i_this) { + return 1; } /* ############################################################################################## */ @@ -132,21 +132,17 @@ SECTION_DEAD static char const* const stringBase_8039A388 = ""; #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void getResetArchiveBank(int param_0, u8 const** param_1) { +static asm int getResetArchiveBank(int param_0, u8 const** param_1) { nofralloc #include "asm/d/s/d_s_room/getResetArchiveBank__FiPPCUc.s" } #pragma pop /* 8025AF24-8025AF4C 255864 0028+00 1/1 0/0 0/0 .text resetArchiveBank__Fi */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void resetArchiveBank(int param_0) { - nofralloc -#include "asm/d/s/d_s_room/resetArchiveBank__Fi.s" +static bool resetArchiveBank(int param_0) { + const u8* tmp; + return dStage_roomControl_c::resetArchiveBank(getResetArchiveBank(param_0, &tmp)); } -#pragma pop /* ############################################################################################## */ /* 8039A388-8039A388 0269E8 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ @@ -161,51 +157,44 @@ SECTION_DEAD static char const* const stringBase_8039A39B = "Bank[%d] : %s.arc R #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void setArchiveBank(int param_0) { +static asm bool setArchiveBank(int param_0) { nofralloc #include "asm/d/s/d_s_room/setArchiveBank__Fi.s" } #pragma pop /* 8025B0F0-8025B150 255A30 0060+00 1/1 0/0 0/0 .text objectDeleteJugge__FPvPv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void objectDeleteJugge(void* param_0, void* param_1) { - nofralloc -#include "asm/d/s/d_s_room/objectDeleteJugge__FPvPv.s" +static int objectDeleteJugge(void* i_obj, void*) { + if (fpcM_GetProfName(i_obj) != PROC_BG) { + if (fopAcM_IsActor(i_obj) && !fopAcM_CheckCondition((fopAc_ac_c*)i_obj, 4)) { + return 0; + } + fpcM_Delete(i_obj); + } + + return 0; } -#pragma pop /* 8025B150-8025B174 255A90 0024+00 1/1 0/0 0/0 .text deleteJugge__FPvPv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void deleteJugge(void* param_0, void* param_1) { - nofralloc -#include "asm/d/s/d_s_room/deleteJugge__FPvPv.s" +static int deleteJugge(void* i_obj, void*) { + fpcM_Delete(i_obj); + return 0; } -#pragma pop /* 8025B174-8025B194 255AB4 0020+00 1/1 0/0 0/0 .text isCreatingCallback__FP10create_tagPUi */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void isCreatingCallback(create_tag* param_0, unsigned int* param_1) { +static asm void* isCreatingCallback(create_tag* param_0, unsigned int* param_1) { nofralloc #include "asm/d/s/d_s_room/isCreatingCallback__FP10create_tagPUi.s" } #pragma pop /* 8025B194-8025B1D0 255AD4 003C+00 2/2 0/0 0/0 .text isCreating__FUi */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void isCreating(unsigned int param_0) { - nofralloc -#include "asm/d/s/d_s_room/isCreating__FUi.s" +static bool isCreating(unsigned int param_0) { + return fpcCtIt_Judge((fpcCtIt_JudgeFunc)isCreatingCallback, ¶m_0); } -#pragma pop /* ############################################################################################## */ /* 8039A388-8039A388 0269E8 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ @@ -225,146 +214,269 @@ static asm void loadDemoArchive(int param_0) { #pragma pop /* 8025B2EC-8025B564 255C2C 0278+00 3/3 0/0 0/0 .text objectSetCheck__FP19room_of_scene_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void objectSetCheck(room_of_scene_class* param_0) { - nofralloc -#include "asm/d/s/d_s_room/objectSetCheck__FP19room_of_scene_class.s" +static bool objectSetCheck(room_of_scene_class* i_this) { + int roomNo = fopScnM_GetParam(i_this); + BOOL status_flag_8 = dComIfGp_roomControl_checkStatusFlag(roomNo, 8); + BOOL status_flag_20 = dComIfGp_roomControl_checkStatusFlag(roomNo, 0x20); + + if (i_this->field_0x1d4 == 0 || (i_this->field_0x1d4 > 0 && !status_flag_8)) { + if (!status_flag_8) { + switch (i_this->field_0x1d4) { + case 0: + if (!resetArchiveBank(roomNo)) { + return 0; + } + i_this->field_0x1d4++; + case 1: + if (!setArchiveBank(roomNo)) { + return 0; + } + + if (i_this->mpDzrRes != NULL) { + loadDemoArchive(roomNo); + } + default: + if (*dStage_roomControl_c::getDemoArcName() != '\0') { + int phase = dComIfG_syncObjectRes(dStage_roomControl_c::getDemoArcName()); + + if (phase >= 0 && phase > 0) { + return 0; + } + } + + fopAcM_create(PROC_BG, roomNo, NULL, -1, NULL, NULL, -1); + dComIfGp_getPEvtManager()->demoInit(); + dComIfGp_getPEvtManager()->roomInit(roomNo); + dStage_dt_c_roomReLoader(i_this->mpDzrRes, i_this->mpRoomDt, roomNo); + dComIfGp_ret_wp_set(roomNo); + i_this->field_0x1d4 = -1; + i_this->field_0x1d5 = 1; + } + } + } else if (status_flag_8) { + if (isCreating(fpcM_LayerID(i_this))) { + return 0; + } + + fpcM_LyJudge(&i_this->mBase, (fpcLyIt_JudgeFunc)deleteJugge, NULL); + g_dComIfG_gameInfo.play.getParticle()->levelAllForceOnEventMove(); + dComIfGs_clearRoomSwitch(dComIfGp_roomControl_getZoneNo(roomNo)); + dComIfGs_clearRoomItem(dComIfGp_roomControl_getZoneNo(roomNo)); + dComIfGp_roomControl_offStatusFlag(roomNo, 0x20); + i_this->field_0x1d4 = 0; + } else if (status_flag_20) { + fpcM_LyJudge(&i_this->mBase, (fpcLyIt_JudgeFunc)objectDeleteJugge, NULL); + g_dComIfG_gameInfo.play.getParticle()->levelAllForceOnEventMove(); + } + + return 1; } -#pragma pop /* 8025B564-8025B674 255EA4 0110+00 1/0 0/0 0/0 .text dScnRoom_Execute__FP19room_of_scene_class */ +#ifdef NONMATCHING +static int dScnRoom_Execute(room_of_scene_class* i_this) { + int roomNo = fopScnM_GetParam(i_this); + + if (dComIfGp_roomControl_checkStatusFlag(roomNo, 2)) { + dComIfGp_roomControl_offStatusFlag(roomNo, 2); + dComIfGp_roomControl_onStatusFlag(roomNo, 1); + } else if (objectSetCheck(i_this)) { + if (dComIfGp_roomControl_checkStatusFlag(roomNo, 4)) { + fopScnM_DeleteReq(i_this); + } else if (i_this->field_0x1d4 < 0 && i_this->field_0x1d5 != 0 && + !i_dComIfGp_event_runCheck() && + (int)fopScnM_GetParam(i_this) == dComIfGp_roomControl_getStayNo()) { + if (isCreating(fpcM_LayerID(i_this))) { + dScnPly_c::setPauseTimer(2); + } else { + i_this->field_0x1d5 = 0; + } + } + } + + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void dScnRoom_Execute(room_of_scene_class* param_0) { +static asm int dScnRoom_Execute(room_of_scene_class* param_0) { nofralloc #include "asm/d/s/d_s_room/dScnRoom_Execute__FP19room_of_scene_class.s" } #pragma pop +#endif /* 8025B674-8025B67C 255FB4 0008+00 1/0 0/0 0/0 .text dScnRoom_IsDelete__FP19room_of_scene_class */ -static bool dScnRoom_IsDelete(room_of_scene_class* param_0) { - return true; +static int dScnRoom_IsDelete(room_of_scene_class*) { + return 1; } /* 8025B67C-8025B73C 255FBC 00C0+00 1/1 0/0 0/0 .text isReadRoom__Fi */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void isReadRoom(int param_0) { - nofralloc -#include "asm/d/s/d_s_room/isReadRoom__Fi.s" +static bool isReadRoom(int param_0) { + roomRead_class* room = dComIfGp_getStageRoom(); + + if (room == NULL) { + return false; + } + + if (room->field_0x0 <= param_0) { + return false; + } + + roomRead_data_class* roomData = room->field_0x4[dComIfGp_getNextStageRoomNo()]; + u8* tmp = roomData->field_0x4; + + for (int i = 0; i < roomData->field_0x0; i++) { + if (dStage_roomRead_dt_c_ChkBg(*tmp) && + param_0 == dStage_roomRead_dt_c_GetLoadRoomIndex(*tmp)) { + return true; + } + tmp++; + } + + return false; +} + +inline const char* setArcName(room_of_scene_class* i_room) { + return dComIfG_getRoomArcName(fopAcM_GetParam(i_room)); } -#pragma pop /* 8025B73C-8025B870 25607C 0134+00 1/0 0/0 0/0 .text dScnRoom_Delete__FP19room_of_scene_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void dScnRoom_Delete(room_of_scene_class* param_0) { - nofralloc -#include "asm/d/s/d_s_room/dScnRoom_Delete__FP19room_of_scene_class.s" +static int dScnRoom_Delete(room_of_scene_class* i_this) { + int roomNo = fopScnM_GetParam(i_this); + dComIfGp_roomControl_setStatusFlag(roomNo, 0); + dComIfGp_roomControl_getStatusRoomDt(roomNo)->mRoomDt.init(); + + if (mDoRst::isReset() || !dComIfGp_isEnableNextStage() || + strcmp(dComIfGp_getNextStageName(), dComIfGp_getStartStageName()) || + (roomNo != dComIfGp_getNextStageRoomNo() && !isReadRoom(roomNo))) { + dComIfG_deleteStageRes(setArcName(i_this)); + + JKRExpHeap* heap = dStage_roomControl_c::getMemoryBlock(roomNo); + if (heap != NULL) { + heap->freeAll(); + } + } + + dComIfGp_roomControl_getStatusRoomDt(roomNo)->mRoomDt.init(); + dComIfGp_getPEvtManager()->roomFinish(roomNo); + return 1; } -#pragma pop /* 8025B870-8025B8A4 2561B0 0034+00 1/0 0/0 0/0 .text phase_0__FP19room_of_scene_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void phase_0(room_of_scene_class* param_0) { - nofralloc -#include "asm/d/s/d_s_room/phase_0__FP19room_of_scene_class.s" +static int phase_0(room_of_scene_class* i_this) { + int roomNo = fopScnM_GetParam(i_this); + dStage_roomControl_c::setStatusProcID(roomNo, fopScnM_GetID(i_this)); + return 2; } -#pragma pop /* 8025B8A4-8025B980 2561E4 00DC+00 1/0 0/0 0/0 .text phase_1__FP19room_of_scene_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void phase_1(room_of_scene_class* param_0) { - nofralloc -#include "asm/d/s/d_s_room/phase_1__FP19room_of_scene_class.s" -} -#pragma pop +static int phase_1(room_of_scene_class* i_this) { + i_this->field_0x1d8 = 1; -/* ############################################################################################## */ -/* 8039A388-8039A388 0269E8 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_8039A3CA = "room.dzr"; -/* @stringBase0 padding */ -SECTION_DEAD static char const* const pad_8039A3D3 = "\0\0\0\0"; -#pragma pop + int roomNo = fopScnM_GetParam(i_this); + const char* arcName = setArcName(i_this); + + if (dComIfG_syncStageRes(arcName) < 0) { + JKRExpHeap* heap = dStage_roomControl_c::getMemoryBlock(roomNo); + + if (heap != NULL) { + if (heap->getTotalUsedSize() != 0) { + return 0; + } + } else { + stage_stag_info_class* stagInfo = i_dComIfGp_getStage()->getStagInfo(); + + if (dStage_staginfo_GetArchiveHeap(stagInfo) != NULL) { + heap = mDoExt_getArchiveHeap(); + } + } + + if (!dComIfG_setStageRes(arcName, heap)) { + return cPhs_ERROR_e; + } + } + + return 2; +} /* 8025B980-8025BAAC 2562C0 012C+00 1/0 0/0 0/0 .text phase_2__FP19room_of_scene_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void phase_2(room_of_scene_class* param_0) { - nofralloc -#include "asm/d/s/d_s_room/phase_2__FP19room_of_scene_class.s" +static int phase_2(room_of_scene_class* i_this) { + const char* arcName = setArcName(i_this); + int phase = dComIfG_syncStageRes(arcName); + + if (phase < 0) { + return cPhs_ERROR_e; + } + + if (phase != 0) { + return 0; + } + + int roomNo = fopScnM_GetParam(i_this); + if (dComIfGp_roomControl_getZoneNo(roomNo) < 0) { + dComIfGp_roomControl_setZoneNo(roomNo, dComIfGs_createZone(roomNo)); + } + + i_this->mpRoomDt = &dComIfGp_roomControl_getStatusRoomDt(roomNo)->mRoomDt; + i_this->mpRoomDt->setRoomNo(roomNo); + i_this->mpDzrRes = dComIfG_getStageRes(arcName, "room.dzr"); + + if (i_this->mpDzrRes != NULL) { + dStage_dt_c_roomLoader(i_this->mpDzrRes, i_this->mpRoomDt, roomNo); + } + + JKRHeap* old_heap = NULL; + JKRExpHeap* heap = dStage_roomControl_c::getMemoryBlock(roomNo); + + if (heap != NULL) { + old_heap = mDoExt_setCurrentHeap(heap); + } + + if (old_heap != NULL) { + mDoExt_setCurrentHeap(old_heap); + } + + return 2; } -#pragma pop /* 8025BAAC-8025BAC4 2563EC 0018+00 1/1 0/0 0/0 .text setZoneNo__20dStage_roomControl_cFii */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dStage_roomControl_c::setZoneNo(int param_0, int param_1) { - nofralloc -#include "asm/d/s/d_s_room/setZoneNo__20dStage_roomControl_cFii.s" +void dStage_roomControl_c::setZoneNo(int i_roomNo, int i_zoneNo) { + mStatus[i_roomNo].mZoneNo = i_zoneNo; } -#pragma pop /* 8025BAC4-8025BAF8 256404 0034+00 1/0 0/0 0/0 .text phase_3__FP19room_of_scene_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void phase_3(room_of_scene_class* param_0) { - nofralloc -#include "asm/d/s/d_s_room/phase_3__FP19room_of_scene_class.s" +static int phase_3(room_of_scene_class* i_this) { + return objectSetCheck(i_this) ? 2 : 0; } -#pragma pop /* 8025BAF8-8025BB48 256438 0050+00 1/0 0/0 0/0 .text phase_4__FP19room_of_scene_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void phase_4(room_of_scene_class* param_0) { - nofralloc -#include "asm/d/s/d_s_room/phase_4__FP19room_of_scene_class.s" -} -#pragma pop +static int phase_4(room_of_scene_class* i_this) { + if (dComIfGp_getPlayer(0) == NULL) { + return 0; + } -/* ############################################################################################## */ -/* 803C3260-803C3274 -00001 0014+00 1/1 0/0 0/0 .data l_method$4056 */ -SECTION_DATA static void* l_method[5] = { - (void*)phase_0__FP19room_of_scene_class, (void*)phase_1__FP19room_of_scene_class, - (void*)phase_2__FP19room_of_scene_class, (void*)phase_3__FP19room_of_scene_class, - (void*)phase_4__FP19room_of_scene_class, -}; + return objectSetCheck(i_this) ? cPhs_COMPLEATE_e : 0; +} /* 8025BB48-8025BB78 256488 0030+00 1/0 0/0 0/0 .text dScnRoom_Create__FP11scene_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void dScnRoom_Create(scene_class* param_0) { - nofralloc -#include "asm/d/s/d_s_room/dScnRoom_Create__FP11scene_class.s" +static int dScnRoom_Create(scene_class* i_this) { + static int (*l_method[5])(void*) = { + (int (*)(void*))phase_0, (int (*)(void*))phase_1, (int (*)(void*))phase_2, + (int (*)(void*))phase_3, (int (*)(void*))phase_4, + }; + + room_of_scene_class* room = static_cast(i_this); + return dComLbG_PhaseHandler(&room->field_0x1c4, l_method, i_this); } -#pragma pop /* ############################################################################################## */ /* 803C3274-803C3288 -00001 0014+00 1/0 0/0 0/0 .data l_dScnRoom_Method */ SECTION_DATA static void* l_dScnRoom_Method[5] = { - (void*)dScnRoom_Create__FP11scene_class, - (void*)dScnRoom_Delete__FP19room_of_scene_class, - (void*)dScnRoom_Execute__FP19room_of_scene_class, - (void*)dScnRoom_IsDelete__FP19room_of_scene_class, - (void*)dScnRoom_Draw__FP19room_of_scene_class, + (void*)dScnRoom_Create, (void*)dScnRoom_Delete, (void*)dScnRoom_Execute, + (void*)dScnRoom_IsDelete, (void*)dScnRoom_Draw, }; /* 803C3288-803C32B0 -00001 0028+00 0/0 0/0 1/0 .data g_profile_ROOM_SCENE */