From 63a07a674dd13400d639b97b6bb114fa9d76010d Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Sun, 3 Dec 2023 15:24:55 -0500 Subject: [PATCH] match d_s_room (some fakematches) --- configure.py | 12 +++++------ include/d/actor/d_a_npc_md.h | 6 +++--- include/d/actor/d_a_salvage.h | 2 ++ include/d/d_com_inf_game.h | 8 ++++++++ include/d/d_stage.h | 6 +++--- src/d/d_s_room.cpp | 38 ++++++++++++++++++----------------- 6 files changed, 42 insertions(+), 30 deletions(-) diff --git a/configure.py b/configure.py index 8d8260777..73840074e 100644 --- a/configure.py +++ b/configure.py @@ -484,7 +484,7 @@ config.libs = [ Object(Matching, "d/d_s_open.cpp"), Object(NonMatching, "d/d_s_open_sub.cpp"), Object(NonMatching, "d/d_s_play.cpp"), - Object(NonMatching, "d/d_s_room.cpp"), + Object(Matching, "d/d_s_room.cpp"), Object(Matching, "d/d_s_title.cpp"), Object(NonMatching, "d/d_scope.cpp"), Object(Matching, "d/d_throwstone.cpp"), @@ -1270,7 +1270,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_obj_leaves"), ActorRel(NonMatching, "d_a_obj_lpalm"), ActorRel(Matching, "d_a_obj_monument"), - ActorRel(NonMatching, "d_a_obj_movebox"), + ActorRel(NonMatching, "d_a_obj_movebox", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_obj_mshokki"), ActorRel(NonMatching, "d_a_obj_ohatch"), ActorRel(NonMatching, "d_a_obj_otble"), @@ -1303,7 +1303,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_stone"), ActorRel(NonMatching, "d_a_stone2"), ActorRel(Matching, "d_a_swc00"), - ActorRel(NonMatching, "d_a_swhit0"), + ActorRel(NonMatching, "d_a_swhit0", extra_cflags=['-pragma "nosyminline on"']), ActorRel(Matching, "d_a_swtdoor"), ActorRel(NonMatching, "d_a_tag_attention"), ActorRel(NonMatching, "d_a_tag_ba1"), @@ -1357,7 +1357,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_nzg"), ActorRel(NonMatching, "d_a_obj_aygr"), ActorRel(NonMatching, "d_a_obj_balancelift"), - ActorRel(NonMatching, "d_a_obj_barrier"), + ActorRel(NonMatching, "d_a_obj_barrier", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_obj_bemos"), ActorRel(NonMatching, "d_a_obj_canon"), ActorRel(NonMatching, "d_a_obj_eff"), @@ -1465,7 +1465,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_npc_hr"), ActorRel(NonMatching, "d_a_npc_jb1"), ActorRel(NonMatching, "d_a_npc_ji1"), - ActorRel(NonMatching, "d_a_npc_kamome"), + ActorRel(NonMatching, "d_a_npc_kamome", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_npc_kf1"), ActorRel(NonMatching, "d_a_npc_kg1"), ActorRel(NonMatching, "d_a_npc_kg2"), @@ -1556,7 +1556,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_obj_msdan2"), ActorRel(NonMatching, "d_a_obj_msdan_sub"), ActorRel(NonMatching, "d_a_obj_msdan_sub2"), - ActorRel(NonMatching, "d_a_obj_mtest"), + ActorRel(NonMatching, "d_a_obj_mtest", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_obj_nest"), ActorRel(NonMatching, "d_a_obj_ojtree"), ActorRel(NonMatching, "d_a_obj_ospbox"), diff --git a/include/d/actor/d_a_npc_md.h b/include/d/actor/d_a_npc_md.h index bc482b65f..59bea9d53 100644 --- a/include/d/actor/d_a_npc_md.h +++ b/include/d/actor/d_a_npc_md.h @@ -276,7 +276,6 @@ public: void isLightHit() {} void isMirror() {} void isNoCarryAction() {} - void isSeaTalk() {} void isShipRide() {} void noCarryAction() {} void offBitCamTagIn() {} @@ -286,7 +285,6 @@ public: void offMirror() {} void offNoCarryAction() {} void offPlayerRoom() {} - void offSeaTalk() {} void offShipRide() {} void onBitCamTagIn() {} void onFlying() {} @@ -294,7 +292,6 @@ public: void onLightHit() {} void onMirror() {} void onPlayerRoom() {} - void onSeaTalk() {} void onShipRide() {} void setBitEffectStatus(u8) {} void setBitHairMode(u8) {} @@ -469,6 +466,9 @@ public: static bool m_playerRoom; static bool isFlying() { return m_flying; } + static bool isSeaTalk() { return m_seaTalk; } + static void onSeaTalk() { m_seaTalk = true; } + static void offSeaTalk() { m_seaTalk = false; } static s16 getMaxFlyingTimer(); static bool isPlayerRoom() { return m_playerRoom; } diff --git a/include/d/actor/d_a_salvage.h b/include/d/actor/d_a_salvage.h index f79d767cb..8a18885b6 100644 --- a/include/d/actor/d_a_salvage.h +++ b/include/d/actor/d_a_salvage.h @@ -64,6 +64,8 @@ public: void isEffectKind(int); void debugDraw(); + static void init_room(signed char); + public: /* Place member variables here */ }; diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 91b5ea154..7b179419b 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -1846,6 +1846,14 @@ inline void dComIfGp_map_mapBufferSendAGB(int param_0) { dMap_c::mapBufferSendAGB(param_0); } +inline void dComIfGp_map_setImage(int param_0, int param_1, f32 param_2) { + dMap_c::setImage(param_0, param_1, param_2); +} + +inline void dComIfGp_map_deleteImage(int param_0) { + dMap_c::deleteImage(param_0); +} + inline dDemo_manager_c* dComIfGp_demo_get() { return g_dComIfG_gameInfo.play.getDemo(); } diff --git a/include/d/d_stage.h b/include/d/d_stage.h index 49efee3ea..19d5de4d5 100644 --- a/include/d/d_stage.h +++ b/include/d/d_stage.h @@ -827,7 +827,7 @@ public: void checkDrawArea() const; dStage_darkStatus_c* getDarkStatus(); u32 getDarkMode(); - static dBgW* getBgW(int i_roomNo); + static dBgW* getBgW(int i_roomNo);// { return mStatus[i_roomNo].mpBgW; } static JKRExpHeap* createMemoryBlock(int, u32); static void destroyMemoryBlock(); @@ -835,8 +835,8 @@ public: static JKRExpHeap* getMemoryBlock(int); static void setStayNo(int); static s32 GetTimePass(); - static void setZoneNo(int i_roomNo, int i_zoneNo) { mStatus[i_roomNo].mZoneNo = i_zoneNo; } - static int getZoneNo(int i_roomNo); + static void setZoneNo(int i_roomNo, int i_zoneNo);// { mStatus[i_roomNo].mZoneNo = i_zoneNo; } + static int getZoneNo(int i_roomNo);// { return mStatus[i_roomNo].mZoneNo; } static void setZoneCount(int i_roomNo, int count) { mStatus[i_roomNo].mZoneCount = count; } static s8 getStayNo() { return mStayNo; } diff --git a/src/d/d_s_room.cpp b/src/d/d_s_room.cpp index 79afb2f1d..a8dc36670 100644 --- a/src/d/d_s_room.cpp +++ b/src/d/d_s_room.cpp @@ -14,6 +14,8 @@ #include "d/d_procname.h" #include "d/d_stage.h" #include "d/actor/d_a_player.h" +#include "d/actor/d_a_salvage.h" +#include "d/actor/d_a_npc_md.h" #include "m_Do/m_Do_dvd_thread.h" #include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JKernel/JKRExpHeap.h" @@ -32,15 +34,19 @@ public: /* 0x1DC */ u16 field_0x1dc; }; +// Fake inline: An inline like this seems necessary for setMapImage to match, but it isn't in the debug maps. +// TODO: Try to find a way to match setMapImage with real inlines. +inline f32 getActorPositionY(fopAc_ac_c* actor) { + return actor->current.pos.y; +} + /* 80236938-80236998 .text setMapImage__FP19room_of_scene_class */ void setMapImage(room_of_scene_class* i_this) { if (i_this->mbSetMap) return; if (dComIfGp_roomControl_getStayNo() >= 0) { - f32 playerY = fopAcM_GetPosition(dComIfGp_getPlayer(0)).y; - s32 roomNo = fopScnM_GetParam(i_this); - dMap_c::setImage(roomNo, dComIfGp_roomControl_getStayNo(), playerY); + dComIfGp_map_setImage(fopScnM_GetParam(i_this), dComIfGp_roomControl_getStayNo(), getActorPositionY(dComIfGp_getPlayer(0))); i_this->mbSetMap = true; } } @@ -50,7 +56,7 @@ void deleteMapImage(room_of_scene_class* i_this) { if (!i_this->mbSetMap) return; - dMap_c::deleteImage(fopScnM_GetParam(i_this)); + dComIfGp_map_deleteImage(fopScnM_GetParam(i_this)); } /* 802369C8-80236A0C .text setArcName__FP19room_of_scene_class */ @@ -117,19 +123,9 @@ BOOL dScnRoom_IsDelete(room_of_scene_class* i_this) { return TRUE; } -class daNpc_Md_c { -public: - static u8 m_seaTalk; -}; - -class daSalvage_control_c { -public: - static void init_room(s8); -}; - /* 80236BB4-80236D24 .text dScnRoom_Delete__FP19room_of_scene_class */ BOOL dScnRoom_Delete(room_of_scene_class* i_this) { - s32 roomNo = fopScnM_GetParam(i_this); + int roomNo = fopScnM_GetParam(i_this); deleteMapImage(i_this); const char * arcName = setArcName(i_this); dComIfG_deleteStageRes(arcName); @@ -151,9 +147,9 @@ BOOL dScnRoom_Delete(room_of_scene_class* i_this) { dComIfGs_onEventBit(0x1c40); if (strcmp(dComIfGp_getStartStageName(), "sea") == 0) - daNpc_Md_c::m_seaTalk = 0; + daNpc_Md_c::offSeaTalk(); - daSalvage_control_c::init_room(roomNo); + daSalvage_c::init_room(roomNo); JKRHeap * pHeap = dStage_roomControl_c::getMemoryBlock(roomNo); if (pHeap != NULL) @@ -200,7 +196,7 @@ s32 phase_2(room_of_scene_class* i_this) { if (rt != 0) return cPhs_INIT_e; - s32 roomNo = fopScnM_GetParam(i_this); + int roomNo = fopScnM_GetParam(i_this); s32 zoneNo = dComIfGp_roomControl_getZoneNo(roomNo); if (zoneNo < 0) { zoneNo = dComIfGs_createZone(roomNo); @@ -239,6 +235,12 @@ s32 phase_2(room_of_scene_class* i_this) { return cPhs_NEXT_e; } +// TODO: Not sure why this weak function doesn't get inlined. +/* 802370A0-802370B8 .text setZoneNo__20dStage_roomControl_cFii */ +void dStage_roomControl_c::setZoneNo(int i_roomNo, int i_zoneNo) { + mStatus[i_roomNo].mZoneNo = i_zoneNo; +} + /* 802370B8-802371D0 .text phase_3__FP19room_of_scene_class */ s32 phase_3(room_of_scene_class* i_this) { if (dStage_roomControl_c::getDemoArcName()[0] != '\0') {