From 6c1e1991e5b2b65c834f7e578364e165626f7683 Mon Sep 17 00:00:00 2001 From: Swekka Date: Thu, 19 Jun 2025 19:50:13 +0200 Subject: [PATCH] address review --- .../SOUE01/rels/d_a_obj_chestNP/symbols.txt | 14 +++--- config/SOUE01/symbols.txt | 2 +- include/d/a/d_a_item.h | 2 +- include/d/a/obj/d_a_obj_chest.h | 4 +- src/REL/d/a/obj/d_a_obj_chest.cpp | 43 +++++++++---------- 5 files changed, 32 insertions(+), 33 deletions(-) diff --git a/config/SOUE01/rels/d_a_obj_chestNP/symbols.txt b/config/SOUE01/rels/d_a_obj_chestNP/symbols.txt index c58b0f9b..71df3b09 100644 --- a/config/SOUE01/rels/d_a_obj_chestNP/symbols.txt +++ b/config/SOUE01/rels/d_a_obj_chestNP/symbols.txt @@ -72,14 +72,14 @@ isSameName__26sFStateID_c<11dAcOChest_c>CFPCc = .text:0x00001B40; // type:functi _ctors = .ctors:0x00000000; // type:label scope:global _dtors = .dtors:0x00000000; // type:label scope:global __destroy_global_chain_reference = .dtors:0x00000000; // type:object size:0x4 scope:global -lbl_326_rodata_0 = .rodata:0x00000000; // type:object size:0x3C data:float scope:local -lbl_326_rodata_3C = .rodata:0x0000003C; // type:object size:0x18 align:4 data:float scope:local -lbl_326_data_0 = .data:0x00000000; // type:object size:0xC data:4byte scope:local -lbl_326_data_C = .data:0x0000000C; // type:object size:0x4 data:4byte scope:local +lbl_326_rodata_0 = .rodata:0x00000000; // type:object size:0x3C scope:local data:float +lbl_326_rodata_3C = .rodata:0x0000003C; // type:object size:0x18 scope:local align:4 data:float +lbl_326_data_0 = .data:0x00000000; // type:object size:0xC scope:local data:4byte +lbl_326_data_C = .data:0x0000000C; // type:object size:0x4 scope:local data:4byte lbl_326_data_10 = .data:0x00000010; // type:object size:0x10 scope:local -lbl_326_data_20 = .data:0x00000020; // type:object size:0x4 data:4byte scope:local +lbl_326_data_20 = .data:0x00000020; // type:object size:0x4 scope:local data:4byte lbl_326_data_24 = .data:0x00000024; // type:object size:0xC scope:local -lbl_326_data_30 = .data:0x00000030; // type:object size:0x8 data:4byte scope:local +lbl_326_data_30 = .data:0x00000030; // type:object size:0x8 scope:local data:4byte OPEN_WARDROBE_INTERACTION__11dAcOChest_c = .data:0x00000038; // type:object size:0x30 align:4 data:float g_profile_OBJ_CHEST = .data:0x00000068; // type:object size:0x10 lbl_326_data_78 = .data:0x00000078; // type:object size:0x10 scope:local @@ -87,7 +87,7 @@ lbl_326_data_88 = .data:0x00000088; // type:object size:0x10 scope:local lbl_326_data_98 = .data:0x00000098; // type:object size:0x10 scope:local lbl_326_data_A8 = .data:0x000000A8; // type:object size:0x10 scope:local INSIDE_MODEL_NAMES__11dAcOChest_c = .data:0x000000B8; // type:object size:0x10 -lbl_326_data_C8 = .data:0x000000C8; // type:object size:0xC data:string scope:local +lbl_326_data_C8 = .data:0x000000C8; // type:object size:0xC scope:local data:string lbl_326_data_D4 = .data:0x000000D4; // type:object size:0x1C scope:local lbl_326_data_F0 = .data:0x000000F0; // type:object size:0x8 scope:local lbl_326_data_F8 = .data:0x000000F8; // type:object size:0x28 scope:local diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 9da56ed6..b998cf47 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -13369,7 +13369,7 @@ giveItem22 = .text:0x802490F0; // type:function size:0x4 fn_80249100 = .text:0x80249100; // type:function size:0x44 giveItem3 = .text:0x80249150; // type:function size:0x60 fn_802491B0 = .text:0x802491B0; // type:function size:0x54 -giveItem__9dAcItem_cF7ITEM_IDii = .text:0x80249210; // type:function size:0x84 +giveItem__9dAcItem_cF7ITEM_IDll = .text:0x80249210; // type:function size:0x84 fn_802492A0 = .text:0x802492A0; // type:function size:0x78 fn_80249320 = .text:0x80249320; // type:function size:0x78 fn_802493A0 = .text:0x802493A0; // type:function size:0x3C8 diff --git a/include/d/a/d_a_item.h b/include/d/a/d_a_item.h index f1653c64..00349711 100644 --- a/include/d/a/d_a_item.h +++ b/include/d/a/d_a_item.h @@ -46,7 +46,7 @@ public: static void spawnItem(u16 item, u32 room, const mVec3_c &pos, const mAng3_c &rot, u32 params, u32 arg); static void spawnDrop(u16 item, u32 room, const mVec3_c &pos, const mAng3_c &rot); - static void giveItem(ITEM_ID, int, int); + static void giveItem(ITEM_ID, s32, s32); static u32 checkFlag(u32 flag); static bool hasItem(u32 flag) { return checkFlag(flag); diff --git a/include/d/a/obj/d_a_obj_chest.h b/include/d/a/obj/d_a_obj_chest.h index bf169d5b..c4ca6be6 100644 --- a/include/d/a/obj/d_a_obj_chest.h +++ b/include/d/a/obj/d_a_obj_chest.h @@ -58,7 +58,7 @@ public: private: /* 0x330 */ nw4r::g3d::ResFile mResFile; /* 0x334 */ d3d::AnmMdlWrapper mAnmMdl; - /* 0x3A4 */ m3d::smdl_c mMdl; + /* 0x3A4 */ m3d::smdl_c mInsideMdl; /* 0x3C0 */ dBgW mBgW; /* 0x5D0 */ STATE_MGR_DECLARE(dAcOChest_c); /* 0x60C */ ActorEventRelated mEvent; @@ -68,7 +68,7 @@ private: /* 0x65F */ bool mIsLinksCloset; /* 0x660 */ DowsingTarget mDowsingTarget; - static const float OPEN_WARDROBE_INTERACTION_FIELD_0x24; + static const f32 OPEN_WARDROBE_INTERACTION_FIELD_0x24; static const char *CHEST_OPEN; static const char *CHEST_OPEN_AFTER; static const char *CHEST_FAIL; diff --git a/src/REL/d/a/obj/d_a_obj_chest.cpp b/src/REL/d/a/obj/d_a_obj_chest.cpp index 5bc9d6c1..33a242dd 100644 --- a/src/REL/d/a/obj/d_a_obj_chest.cpp +++ b/src/REL/d/a/obj/d_a_obj_chest.cpp @@ -18,7 +18,6 @@ #include "m/m_vec.h" #include "nw4r/g3d/res/g3d_resfile.h" #include "nw4r/g3d/res/g3d_resmdl.h" -#include "rvl/MTX/mtx.h" #include "s/s_Math.h" #include "toBeSorted/attention.h" #include "toBeSorted/dowsing_target.h" @@ -29,7 +28,7 @@ const char *dAcOChest_c::CHEST_OPEN = "ChestOpen"; const char *dAcOChest_c::CHEST_OPEN_AFTER = "ChestOpenAfter"; const char *dAcOChest_c::CHEST_FAIL = "ChestFail"; -const float dAcOChest_c::OPEN_WARDROBE_INTERACTION_FIELD_0x24 = 10.0f; +const f32 dAcOChest_c::OPEN_WARDROBE_INTERACTION_FIELD_0x24 = 10.0f; InteractionTargetDef dAcOChest_c::OPEN_WARDROBE_INTERACTION = {0, 3, 1, OPEN, 0, 140.0f, 40.0f, 40.0f, -100.0f, 100.0f, 50.0f, 1.0f}; @@ -93,7 +92,7 @@ bool dAcOChest_c::createHeap() { void *insideMdlData = getOarcResFile("TansuInside"); mResFile = nw4r::g3d::ResFile(insideMdlData); nw4r::g3d::ResMdl mdl = mResFile.GetResMdl(INSIDE_MODEL_NAMES[getFromParams(0x10, 0xFF)]); - if (!mMdl.create(mdl, &heap_allocator, 0x120, 1, nullptr)) { + if (!mInsideMdl.create(mdl, &heap_allocator, 0x120, 1, nullptr)) { return NOT_READY; } } @@ -130,7 +129,7 @@ int dAcOChest_c::create() { poscopy2.y = position.y + 150.0f; poscopy3 = poscopy2; if ((s32)getFromParams(0x10, 0xFF) != 0xFF) { - mMdl.setLocalMtx(mWorldMtx); + mInsideMdl.setLocalMtx(mWorldMtx); } if (dScGame_c::isCurrentStage("F001r") && roomid == 1 && 900.0f < position.x && position.x < 1000.0f && -50.0f < position.y && position.y < 50.0f && -2730.0f < position.z && position.z < -2630.0f) { @@ -166,7 +165,7 @@ int dAcOChest_c::actorExecute() { int dAcOChest_c::draw() { drawModelType1(&mAnmMdl.getModel()); if (hasInsideModel()) { - drawModelType1(&mMdl); + drawModelType1(&mInsideMdl); } return SUCCEEDED; } @@ -175,7 +174,7 @@ void dAcOChest_c::initializeState_Wait() {} void dAcOChest_c::executeState_Wait() { OPEN_WARDROBE_INTERACTION.field_0x24 = OPEN_WARDROBE_INTERACTION_FIELD_0x24; - AttentionManager::GetInstance()->addTarget(*this, OPEN_WARDROBE_INTERACTION, 0, (mVec3_c *)0); + AttentionManager::GetInstance()->addTarget(*this, OPEN_WARDROBE_INTERACTION, 0, nullptr); } void dAcOChest_c::finalizeState_Wait() {} @@ -195,7 +194,7 @@ void dAcOChest_c::initializeState_OrderOpenEventAfter() {} void dAcOChest_c::executeState_OrderOpenEventAfter() { if (mGaveItem && EventManager::sInstance->isInEvent0Or7()) { char *name = getName(); - void *data = dAcObjBase_c::getOarcZev(name); + void *data = getOarcZev(name); Event event(CHEST_OPEN_AFTER, data, 400, 0x100001, nullptr, (void *)changeStateWaitCallback); mEvent.scheduleEvent(event, 0); } else if (EventManager::sInstance->isInEvent(this, CHEST_OPEN_AFTER)) { @@ -222,7 +221,7 @@ void dAcOChest_c::finalizeState_FailEvent() {} void dAcOChest_c::doInteraction(s32 _unused) { char *name = getName(); - void *data = dAcObjBase_c::getOarcZev(name); + void *data = getOarcZev(name); if (hasBeenOpened()) { Event event(CHEST_FAIL, data, 100, 0x100001, (void *)changeStateFailCallback, (void *)changeStateWait2Callback); @@ -234,7 +233,7 @@ void dAcOChest_c::doInteraction(s32 _unused) { } void dAcOChest_c::fn_326_C90() { - PSMTXTrans(mWorldMtx.m, position.x, position.y, position.z); + mWorldMtx.transS(position); mWorldMtx.ZXYrotM(rotation); mAnmMdl.getModel().setLocalMtx(mWorldMtx); mAnmMdl.getModel().calc(false); @@ -278,12 +277,12 @@ char *dAcOChest_c::getName() { char *dAcOChest_c::getSubtypeName() { switch (getSubtype()) { - case 0: return "TansuA"; - case 1: return "TansuB"; - case 2: return "TansuC"; - case 3: return "TansuD"; + case 0: return "TansuA"; + case 1: return "TansuB"; + case 2: return "TansuC"; + case 3: return "TansuD"; + default: return "TansuA"; } - return "TansuA"; } char *dAcOChest_c::getModelName() { @@ -292,20 +291,20 @@ char *dAcOChest_c::getModelName() { char *dAcOChest_c::getOpenOrClose(u8 openOrClose) { switch (openOrClose) { - case 0: return "TansuOpen"; - case 1: return "TansuClose"; + case 0: return "TansuOpen"; + case 1: return "TansuClose"; + default: return nullptr; } - return nullptr; } char *dAcOChest_c::getDzbPlcName() { switch (getSubtype()) { - case 0: return "TansuA"; - case 1: return "TansuB"; - case 2: return "TansuC"; - case 3: return "TansuD"; + case 0: return "TansuA"; + case 1: return "TansuB"; + case 2: return "TansuC"; + case 3: return "TansuD"; + default: return "TansuA"; } - return "TansuA"; } s32 dAcOChest_c::getSubtype() {