From 3a45e6536a1deec0cd5a4c108dfeb4c374ca34d9 Mon Sep 17 00:00:00 2001 From: robojumper Date: Sun, 10 Nov 2024 21:20:43 +0100 Subject: [PATCH 1/9] Try to figure out how this virtual state thing works --- config/SOUE01/splits.txt | 8 ++++ configure.py | 2 + include/d/a/npc/d_a_npc.h | 65 +++++++++++++++++++++++++++++- include/d/a/npc/d_a_ordinary_npc.h | 11 +++++ src/d/a/npc/d_a_npc.cpp | 26 ++++++++++++ src/d/a/npc/d_a_ordinary_npc.cpp | 5 +++ 6 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 include/d/a/npc/d_a_ordinary_npc.h create mode 100644 src/d/a/npc/d_a_npc.cpp create mode 100644 src/d/a/npc/d_a_ordinary_npc.cpp diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 0a66776a8..d06d4ab2c 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -45,6 +45,14 @@ d/a/e/d_a_e_base.cpp: .text start:0x8002F300 end:0x80030CB0 .ctors start:0x804DB664 end:0x804DB668 +d/a/npc/d_a_npc.cpp: + .text start:0x80030CB0 end:0x8003F718 + .ctors start:0x804DB668 end:0x804DB66C + +d/a/npc/d_a_ordinary_npc.cpp: + .text start:0x800462D0 end:0x8004D810 + .ctors start:0x804DB66C end:0x804DB670 + d/d_ac_npc_kyui.cpp: .text start:0x8004D810 end:0x80050800 .ctors start:0x804DB670 end:0x804DB674 diff --git a/configure.py b/configure.py index 519a6d244..12e194298 100644 --- a/configure.py +++ b/configure.py @@ -338,6 +338,8 @@ def nw4rLib(lib_name, objects, extra_cflags=[]): Object(NonMatching, "d/a/d_a_base.cpp"), Object(NonMatching, "d/a/d_a_item.cpp"), Object(NonMatching, "d/a/obj/d_a_obj_base.cpp"), + Object(NonMatching, "d/a/npc/d_a_npc.cpp"), + Object(NonMatching, "d/a/npc/d_a_ordinary_npc.cpp"), Object(NonMatching, "d/a/obj/d_a_obj_bomb.cpp"), Object(NonMatching, "d/a/obj/d_a_obj_arrow.cpp"), Object(NonMatching, "d/a/obj/d_a_obj_boomerang.cpp"), diff --git a/include/d/a/npc/d_a_npc.h b/include/d/a/npc/d_a_npc.h index 0e360ad5f..ad95da038 100644 --- a/include/d/a/npc/d_a_npc.h +++ b/include/d/a/npc/d_a_npc.h @@ -2,12 +2,75 @@ #define D_A_NPC_H #include "d/a/obj/d_a_obj_base.h" +#include "s/s_FStateID.hpp" +#include "s/s_FStateMgr.hpp" +#include "s/s_StateID.hpp" +#include "s/s_StateMethodUsr_FI.hpp" + +// Virtual states! +template +class sVFStateID_c : public sFStateID_c { +public: + typedef void (T::*stateFunc)(); + sVFStateID_c(sStateID_c *superState, const char *name, stateFunc initialize, stateFunc execute, stateFunc finalize) + : sFStateID_c(name, initialize, execute, finalize), mpSuperState(superState) {} + + virtual unsigned int number() const { + return getRootState()->numberBase(); + } + + const sVFStateID_c *getRootState() const { + if (!mpSuperState->isNull()) { + return static_cast *>(mpSuperState)->getRootState(); + } + return this; + } + + unsigned int numberBase() const { + return sStateID_c::number(); + } + + +private: + sStateID_c *mpSuperState; +}; + +#define STATE_VIRTUAL_FUNC_DECLARE(class, name) \ + virtual void initializeState_##name(); \ + virtual void executeState_##name(); \ + virtual void finalizeState_##name(); \ + static sVFStateID_c StateID_##name + +#define STATE_VIRTUAL_OVERRIDE_FUNC_DECLARE(class, super_class, name) \ + virtual void initializeState_##name() override; \ + virtual void executeState_##name() override; \ + virtual void finalizeState_##name() override; \ + static sVFStateID_c StateID_##name; \ + +#define STATE_VIRTUAL_DEFINE(class, name) \ + sStateID_c *getDefaultSuperState_##class##name() { \ + return &sStateID::null; \ + } \ + sVFStateID_c class ::StateID_##name( \ + getDefaultSuperState_##class##name(), #class "::StateID_" #name, &class ::initializeState_##name, \ + &class ::executeState_##name, &class ::finalizeState_##name \ + ) + +#define STATE_VIRTUAL_MGR_DECLARE(class_name) sFStateMgr_c mStateMgr; // This is the NPC base. Most npcs actually use dAcOrdinaryNpc, but this just is a simpler one? // Ghidra: ActorNpcBase // size: 0x6e4 // official name -class dAcNpc_c : public dAcObjBase_c {}; +class dAcNpc_c : public dAcObjBase_c { +public: + dAcNpc_c(); + + STATE_VIRTUAL_FUNC_DECLARE(dAcNpc_c, Wait); + STATE_VIRTUAL_FUNC_DECLARE(dAcNpc_c, Demo); + + STATE_VIRTUAL_MGR_DECLARE(dAcNpc_c); +}; #endif diff --git a/include/d/a/npc/d_a_ordinary_npc.h b/include/d/a/npc/d_a_ordinary_npc.h new file mode 100644 index 000000000..c826f4781 --- /dev/null +++ b/include/d/a/npc/d_a_ordinary_npc.h @@ -0,0 +1,11 @@ +#ifndef D_A_ORDINARY_NPC_H +#define D_A_ORDINARY_NPC_H + +#include "d/a/npc/d_a_npc.h" + +class dAcOrdinaryNpc_c : public dAcNpc_c { +public: + STATE_VIRTUAL_FUNC_DECLARE(dAcOrdinaryNpc_c, Pain); +}; + +#endif diff --git a/src/d/a/npc/d_a_npc.cpp b/src/d/a/npc/d_a_npc.cpp new file mode 100644 index 000000000..33bab9645 --- /dev/null +++ b/src/d/a/npc/d_a_npc.cpp @@ -0,0 +1,26 @@ +#include "d/a/npc/d_a_npc.h" +#include "s/s_StateID.hpp" + +fLiMgBa_c NPC_ACTOR_LIST; + +STATE_VIRTUAL_DEFINE(dAcNpc_c, Wait); +STATE_VIRTUAL_DEFINE(dAcNpc_c, Demo); + +extern nw4r::ut::Color sColors[] = { + nw4r::ut::Color(0xEF, 0x30, 0x27, 0xFF), + nw4r::ut::Color(0, 0, 0, 0xFF), + nw4r::ut::Color(0xEF, 0x30, 0x27, 0), + nw4r::ut::Color(0xFF, 0xFF, 0xFF, 0), + nw4r::ut::Color(0xFE, 0xF8, 0x9D, 0xFF), + nw4r::ut::Color(0x88, 0x63, 0x36, 0x80), + nw4r::ut::Color(0x4F, 0x46, 0x33, 0xFF), + nw4r::ut::Color(0xD8, 0xC5, 0x8D, 0xFF), + nw4r::ut::Color(0x95, 0x69, 0x3B, 0xFF), + nw4r::ut::Color(0x50, 0x46, 0x32, 0), + nw4r::ut::Color(0xD8, 0xC5, 0x8D, 0), + nw4r::ut::Color(0x96, 0x69, 0x3C, 0), + nw4r::ut::Color(0, 0, 0, 0), +}; + + +dAcNpc_c::dAcNpc_c() : mStateMgr(*this, sStateID::null) {} diff --git a/src/d/a/npc/d_a_ordinary_npc.cpp b/src/d/a/npc/d_a_ordinary_npc.cpp new file mode 100644 index 000000000..767a9c7e7 --- /dev/null +++ b/src/d/a/npc/d_a_ordinary_npc.cpp @@ -0,0 +1,5 @@ +#include "d/a/npc/d_a_ordinary_npc.h" +#include "d/a/npc/d_a_npc.h" +#include "s/s_StateID.hpp" + +STATE_VIRTUAL_DEFINE(dAcOrdinaryNpc_c, Pain); From 31ddec9bd4d3b399412fd87bd53c41feb43e1c80 Mon Sep 17 00:00:00 2001 From: robojumper Date: Tue, 12 Nov 2024 19:37:21 +0100 Subject: [PATCH 2/9] Implement a solution that seemingly works --- config/SOUE01/symbols.txt | 68 +++++++++++++++--------------- include/d/a/npc/d_a_npc.h | 58 +------------------------ include/d/a/npc/d_a_ordinary_npc.h | 9 ++++ include/s/README.txt | 4 ++ include/s/s_FStateVirtualID.hpp | 35 +++++++++++++++ include/s/s_State.hpp | 34 +++++++++++++++ include/s/s_StateID.hpp | 2 +- src/d/a/npc/d_a_ordinary_npc.cpp | 8 ++++ src/s/s_StateID.cpp | 2 +- 9 files changed, 128 insertions(+), 92 deletions(-) create mode 100644 include/s/s_FStateVirtualID.hpp diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 981f37547..ba841b6c2 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -1219,8 +1219,8 @@ fn_80032130 = .text:0x80032130; // type:function size:0x48 fn_80032180 = .text:0x80032180; // type:function size:0x2C fn_800321B0 = .text:0x800321B0; // type:function size:0x1CC fn_80032380 = .text:0x80032380; // type:function size:0xC0 -fn_80032440 = .text:0x80032440; // type:function size:0xC -fn_80032450 = .text:0x80032450; // type:function size:0xC +baseID_Wait<10sStateID_c>__Fv_RC10sStateID_c = .text:0x80032440; // type:function size:0xC +baseID_Demo<10sStateID_c>__Fv_RC10sStateID_c = .text:0x80032450; // type:function size:0xC fn_80032460 = .text:0x80032460; // type:function size:0x4 fn_80032470 = .text:0x80032470; // type:function size:0x4 fn_80032480 = .text:0x80032480; // type:function size:0x390 @@ -1636,12 +1636,12 @@ ActorState__callEnter = .text:0x8003EFF0; // type:function size:0x30 fn_8003F020 = .text:0x8003F020; // type:function size:0x40 fn_8003F060 = .text:0x8003F060; // type:function size:0x40 fn_8003F0A0 = .text:0x8003F0A0; // type:function size:0x40 -AcNpc__initStates = .text:0x8003F0E0; // type:function size:0x330 -fn_8003F410 = .text:0x8003F410; // type:function size:0x58 -AcNpc__state_dtor = .text:0x8003F470; // type:function size:0x5C -fn_8003F4D0 = .text:0x8003F4D0; // type:function size:0xDC -fn_8003F5B0 = .text:0x8003F5B0; // type:function size:0xE0 -fn_8003F690 = .text:0x8003F690; // type:function size:0x88 +__sinit_\d_a_npc_cpp = .text:0x8003F0E0; // type:function size:0x330 +__dt__22sFStateID_c<8dAcNpc_c>Fv = .text:0x8003F410; // type:function size:0x58 +__dt__29sFStateVirtualID_c<8dAcNpc_c>Fv = .text:0x8003F470; // type:function size:0x5C +number__29sFStateVirtualID_c<8dAcNpc_c>CFv = .text:0x8003F4D0; // type:function size:0xDC +superID__29sFStateVirtualID_c<8dAcNpc_c>CFv = .text:0x8003F5B0; // type:function size:0xE0 +isSameName__22sFStateID_c<8dAcNpc_c>CFPCc = .text:0x8003F690; // type:function size:0x88 fn_8003F720 = .text:0x8003F720; // type:function size:0x404 fn_8003FB30 = .text:0x8003FB30; // type:function size:0xA0 fn_8003FBD0 = .text:0x8003FBD0; // type:function size:0x4 @@ -1820,13 +1820,13 @@ fn_80045D00 = .text:0x80045D00; // type:function size:0x490 fn_80046190 = .text:0x80046190; // type:function size:0x44 fn_800461E0 = .text:0x800461E0; // type:function size:0xAC fn_80046290 = .text:0x80046290; // type:function size:0x40 -fn_800462D0 = .text:0x800462D0; // type:function size:0xC -fn_800462E0 = .text:0x800462E0; // type:function size:0xC -fn_800462F0 = .text:0x800462F0; // type:function size:0xC -fn_80046300 = .text:0x80046300; // type:function size:0xC -fn_80046310 = .text:0x80046310; // type:function size:0xC -fn_80046320 = .text:0x80046320; // type:function size:0xC -fn_80046330 = .text:0x80046330; // type:function size:0xC +baseID_Pain<10sStateID_c>__Fv_RC10sStateID_c = .text:0x800462D0; // type:function size:0xC +baseID_Surprised<10sStateID_c>__Fv_RC10sStateID_c = .text:0x800462E0; // type:function size:0xC +baseID_Withstand<10sStateID_c>__Fv_RC10sStateID_c = .text:0x800462F0; // type:function size:0xC +baseID_Walk<10sStateID_c>__Fv_RC10sStateID_c = .text:0x80046300; // type:function size:0xC +baseID_LookAwaySt<10sStateID_c>__Fv_RC10sStateID_c = .text:0x80046310; // type:function size:0xC +baseID_LookAway<10sStateID_c>__Fv_RC10sStateID_c = .text:0x80046320; // type:function size:0xC +baseID_Turn<10sStateID_c>__Fv_RC10sStateID_c = .text:0x80046330; // type:function size:0xC AcOrdinaryNpc__PreInit = .text:0x80046340; // type:function size:0x10C fn_80046450 = .text:0x80046450; // type:function size:0x9C fn_800464F0 = .text:0x800464F0; // type:function size:0x13C @@ -1985,16 +1985,16 @@ fn_8004CC60 = .text:0x8004CC60; // type:function size:0x4 fn_8004CC70 = .text:0x8004CC70; // type:function size:0x8 fn_8004CC80 = .text:0x8004CC80; // type:function size:0x8 fn_8004CC90 = .text:0x8004CC90; // type:function size:0x40 -AcOrdinaryNpc__initStates = .text:0x8004CCD0; // type:function size:0x784 -fn_8004D460 = .text:0x8004D460; // type:function size:0x58 -AcOrdinaryNpc__dtor = .text:0x8004D4C0; // type:function size:0x5C -fn_8004D520 = .text:0x8004D520; // type:function size:0xC -fn_8004D530 = .text:0x8004D530; // type:function size:0xDC -fn_8004D610 = .text:0x8004D610; // type:function size:0xE0 -fn_8004D6F0 = .text:0x8004D6F0; // type:function size:0x88 -fn_8004D780 = .text:0x8004D780; // type:function size:0x30 -fn_8004D7B0 = .text:0x8004D7B0; // type:function size:0x30 -fn_8004D7E0 = .text:0x8004D7E0; // type:function size:0x30 +__sinit_\d_a_ordinary_npc_cpp = .text:0x8004CCD0; // type:function size:0x784 +__dt__31sFStateID_c<16dAcOrdinaryNpc_c>Fv = .text:0x8004D460; // type:function size:0x58 +__dt__38sFStateVirtualID_c<16dAcOrdinaryNpc_c>Fv = .text:0x8004D4C0; // type:function size:0x5C +baseID_Wait<8dAcNpc_c>__Fv_RC10sStateID_c = .text:0x8004D520; // type:function size:0xC +number__38sFStateVirtualID_c<16dAcOrdinaryNpc_c>CFv = .text:0x8004D530; // type:function size:0xDC +superID__38sFStateVirtualID_c<16dAcOrdinaryNpc_c>CFv = .text:0x8004D610; // type:function size:0xE0 +isSameName__31sFStateID_c<16dAcOrdinaryNpc_c>CFPCc = .text:0x8004D6F0; // type:function size:0x88 +initializeState__31sFStateID_c<16dAcOrdinaryNpc_c>CFR16dAcOrdinaryNpc_c = .text:0x8004D780; // type:function size:0x30 +executeState__31sFStateID_c<16dAcOrdinaryNpc_c>CFR16dAcOrdinaryNpc_c = .text:0x8004D7B0; // type:function size:0x30 +finalizeState__31sFStateID_c<16dAcOrdinaryNpc_c>CFR16dAcOrdinaryNpc_c = .text:0x8004D7E0; // type:function size:0x30 fn_8004D810 = .text:0x8004D810; // type:function size:0x14 fn_8004D830 = .text:0x8004D830; // type:function size:0x14 fn_8004D850 = .text:0x8004D850; // type:function size:0x14 @@ -29940,11 +29940,11 @@ lbl_80501998 = .data:0x80501998; // type:object size:0xC lbl_805019A4 = .data:0x805019A4; // type:object size:0xC lbl_805019B0 = .data:0x805019B0; // type:object size:0x54 lbl_80501A04 = .data:0x80501A04; // type:object size:0xC -ActorNpcBase__vtable = .data:0x80501A10; // type:object size:0x208 -lbl_80501C18 = .data:0x80501C18; // type:object size:0x30 -lbl_80501C48 = .data:0x80501C48; // type:object size:0x30 -lbl_80501C78 = .data:0x80501C78; // type:object size:0x18 -lbl_80501C90 = .data:0x80501C90; // type:object size:0x18 +__vt__8dAcNpc_c = .data:0x80501A10; // type:object size:0x208 +__vt__46sFStateMgr_c<8dAcNpc_c,20sStateMethodUsr_FI_c> = .data:0x80501C18; // type:object size:0x30 +__vt__76sStateMgr_c<8dAcNpc_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x80501C48; // type:object size:0x30 +__vt__23sFStateFct_c<8dAcNpc_c> = .data:0x80501C78; // type:object size:0x18 +__vt__20sFState_c<8dAcNpc_c> = .data:0x80501C90; // type:object size:0x18 ActorNpcEventFlowManager__vtable = .data:0x80501CA8; // type:object size:0x44 lbl_80501CEC = .data:0x80501CEC; // type:object size:0xC lbl_80501CF8 = .data:0x80501CF8; // type:object size:0x10 @@ -30020,8 +30020,8 @@ AcOrdinaryNpc__vtable = .data:0x80502538; // type:object size:0x360 lbl_80502898 = .data:0x80502898; // type:object size:0x6C lbl_80502904 = .data:0x80502904; // type:object size:0xC lbl_80502910 = .data:0x80502910; // type:object size:0x28C -lbl_80502B9C = .data:0x80502B9C; // type:object size:0x34 -lbl_80502BD0 = .data:0x80502BD0; // type:object size:0x38 +__vt__38sFStateVirtualID_c<16dAcOrdinaryNpc_c> = .data:0x80502B9C; // type:object size:0x34 +__vt__31sFStateID_c<16dAcOrdinaryNpc_c> = .data:0x80502BD0; // type:object size:0x38 lbl_80502C08 = .data:0x80502C08; // type:object size:0xC lbl_80502C14 = .data:0x80502C14; // type:object size:0x10 lbl_80502C24 = .data:0x80502C24; // type:object size:0x10 @@ -48218,8 +48218,8 @@ lbl_80596FF8 = .bss:0x80596FF8; // type:object size:0x18 data:2byte lbl_80597010 = .bss:0x80597010; // type:object size:0x10 data:2byte lbl_80597020 = .bss:0x80597020; // type:object size:0x10 data:float lbl_80597030 = .bss:0x80597030; // type:object size:0xC -AcNpc__STATE_WAIT = .bss:0x8059703C; // type:object size:0x40 data:4byte -AcNpc__STATE_DEMO = .bss:0x8059707C; // type:object size:0x64 data:4byte +StateID_Wait__8dAcNpc_c = .bss:0x8059703C; // type:object size:0x40 data:4byte +StateID_Demo__8dAcNpc_c = .bss:0x8059707C; // type:object size:0x64 data:4byte lbl_805970E0 = .bss:0x805970E0; // type:object size:0x80 data:byte lbl_80597160 = .bss:0x80597160; // type:object size:0x80 data:byte lbl_805971E0 = .bss:0x805971E0; // type:object size:0x100 data:byte diff --git a/include/d/a/npc/d_a_npc.h b/include/d/a/npc/d_a_npc.h index ad95da038..86e05ddc1 100644 --- a/include/d/a/npc/d_a_npc.h +++ b/include/d/a/npc/d_a_npc.h @@ -2,61 +2,7 @@ #define D_A_NPC_H #include "d/a/obj/d_a_obj_base.h" -#include "s/s_FStateID.hpp" -#include "s/s_FStateMgr.hpp" -#include "s/s_StateID.hpp" -#include "s/s_StateMethodUsr_FI.hpp" - -// Virtual states! -template -class sVFStateID_c : public sFStateID_c { -public: - typedef void (T::*stateFunc)(); - sVFStateID_c(sStateID_c *superState, const char *name, stateFunc initialize, stateFunc execute, stateFunc finalize) - : sFStateID_c(name, initialize, execute, finalize), mpSuperState(superState) {} - - virtual unsigned int number() const { - return getRootState()->numberBase(); - } - - const sVFStateID_c *getRootState() const { - if (!mpSuperState->isNull()) { - return static_cast *>(mpSuperState)->getRootState(); - } - return this; - } - - unsigned int numberBase() const { - return sStateID_c::number(); - } - - -private: - sStateID_c *mpSuperState; -}; - -#define STATE_VIRTUAL_FUNC_DECLARE(class, name) \ - virtual void initializeState_##name(); \ - virtual void executeState_##name(); \ - virtual void finalizeState_##name(); \ - static sVFStateID_c StateID_##name - -#define STATE_VIRTUAL_OVERRIDE_FUNC_DECLARE(class, super_class, name) \ - virtual void initializeState_##name() override; \ - virtual void executeState_##name() override; \ - virtual void finalizeState_##name() override; \ - static sVFStateID_c StateID_##name; \ - -#define STATE_VIRTUAL_DEFINE(class, name) \ - sStateID_c *getDefaultSuperState_##class##name() { \ - return &sStateID::null; \ - } \ - sVFStateID_c class ::StateID_##name( \ - getDefaultSuperState_##class##name(), #class "::StateID_" #name, &class ::initializeState_##name, \ - &class ::executeState_##name, &class ::finalizeState_##name \ - ) - -#define STATE_VIRTUAL_MGR_DECLARE(class_name) sFStateMgr_c mStateMgr; +#include "s/s_State.hpp" // This is the NPC base. Most npcs actually use dAcOrdinaryNpc, but this just is a simpler one? @@ -70,7 +16,7 @@ class dAcNpc_c : public dAcObjBase_c { STATE_VIRTUAL_FUNC_DECLARE(dAcNpc_c, Wait); STATE_VIRTUAL_FUNC_DECLARE(dAcNpc_c, Demo); - STATE_VIRTUAL_MGR_DECLARE(dAcNpc_c); + STATE_MGR_DECLARE(dAcNpc_c); }; #endif diff --git a/include/d/a/npc/d_a_ordinary_npc.h b/include/d/a/npc/d_a_ordinary_npc.h index c826f4781..738854213 100644 --- a/include/d/a/npc/d_a_ordinary_npc.h +++ b/include/d/a/npc/d_a_ordinary_npc.h @@ -2,10 +2,19 @@ #define D_A_ORDINARY_NPC_H #include "d/a/npc/d_a_npc.h" +#include "s/s_State.hpp" class dAcOrdinaryNpc_c : public dAcNpc_c { public: + STATE_VIRTUAL_OVERRIDE_FUNC_DECLARE(dAcOrdinaryNpc_c, dAcNpc_c, Wait); STATE_VIRTUAL_FUNC_DECLARE(dAcOrdinaryNpc_c, Pain); + STATE_VIRTUAL_FUNC_DECLARE(dAcOrdinaryNpc_c, Surprised); + STATE_VIRTUAL_FUNC_DECLARE(dAcOrdinaryNpc_c, Withstand); + STATE_VIRTUAL_FUNC_DECLARE(dAcOrdinaryNpc_c, Walk); + STATE_VIRTUAL_FUNC_DECLARE(dAcOrdinaryNpc_c, LookAwaySt); + STATE_VIRTUAL_FUNC_DECLARE(dAcOrdinaryNpc_c, LookAway); + STATE_VIRTUAL_FUNC_DECLARE(dAcOrdinaryNpc_c, Turn); + STATE_FUNC_DECLARE(dAcOrdinaryNpc_c, PreWalkTurn); }; #endif diff --git a/include/s/README.txt b/include/s/README.txt index 53c6cb636..228815976 100644 --- a/include/s/README.txt +++ b/include/s/README.txt @@ -22,3 +22,7 @@ the other abstract interface classes and provides this dtor. We're observing a lot of word-to-bool casts in code after these operators are invoked, and while there are ways to force the conversion, this seems the most reasonable. + +## s_FStateVirtualID + +Implemented by SS based on NSMBW symbols. Probably missing some parts, sync with NSMBW if they get around to it. diff --git a/include/s/s_FStateVirtualID.hpp b/include/s/s_FStateVirtualID.hpp new file mode 100644 index 000000000..e48600a26 --- /dev/null +++ b/include/s/s_FStateVirtualID.hpp @@ -0,0 +1,35 @@ +#ifndef S_FSTATE_VIRTUAL_ID_H +#define S_FSTATE_VIRTUAL_ID_H + +#include "s/s_FStateID.hpp" +#include "s/s_StateID.hpp" + +template +class sFStateVirtualID_c : public sFStateID_c { +public: + typedef void (T::*stateFunc)(); + sFStateVirtualID_c( + const sStateID_c *superState, const char *name, stateFunc initialize, stateFunc execute, stateFunc finalize + ) + : sFStateID_c(name, initialize, execute, finalize), mpSuperState(superState) {} + + virtual unsigned int number() const { + return superID()->numberBase(); + } + + const sFStateVirtualID_c *superID() const { + if (!mpSuperState->isNull()) { + return static_cast *>(mpSuperState)->superID(); + } + return this; + } + + unsigned int numberBase() const { + return sStateID_c::number(); + } + +private: + const sStateID_c *mpSuperState; +}; + +#endif diff --git a/include/s/s_State.hpp b/include/s/s_State.hpp index 76339e3a3..3a8c4ec54 100644 --- a/include/s/s_State.hpp +++ b/include/s/s_State.hpp @@ -3,6 +3,7 @@ #include "s/s_FStateMgr.hpp" #include "s/s_StateMethodUsr_FI.hpp" +#include "s/s_FStateVirtualID.hpp" // Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib // See include/s/README.txt for changes made @@ -29,4 +30,37 @@ #define STATE_MGR(class_name) sFStateMgr_c +// TODO this is probably not the whole solution. +// The problems with this approach are: +// * You can't define the same state name for multiple files in the same TU due to baseID_ symbol clash. +// * The use of the templated baseID_ function isn't quite justified (could just use normal functions). + +#define STATE_VIRTUAL_FUNC_DECLARE(class, name) \ + virtual void initializeState_##name(); \ + virtual void executeState_##name(); \ + virtual void finalizeState_##name(); \ + static const sFStateVirtualID_c StateID_##name; \ + typedef sStateID_c StateID_##name##_BaseIDClass + +#define STATE_VIRTUAL_OVERRIDE_FUNC_DECLARE(class, super_class, name) \ + virtual void initializeState_##name() override; \ + virtual void executeState_##name() override; \ + virtual void finalizeState_##name() override; \ + static const sFStateVirtualID_c StateID_##name; \ + typedef super_class StateID_##name##_BaseIDClass + +#define STATE_VIRTUAL_DEFINE(class, name) \ + template \ + static const sStateID_c &baseID_##name() { \ + return T::StateID_##name; \ + } \ + template <> \ + const sStateID_c &baseID_##name() { \ + return sStateID::null; \ + } \ + const sFStateVirtualID_c class ::StateID_##name( \ + &baseID_##name(), #class "::StateID_" #name, \ + &class ::initializeState_##name, &class ::executeState_##name, &class ::finalizeState_##name \ + ) + #endif diff --git a/include/s/s_StateID.hpp b/include/s/s_StateID.hpp index cff3ed9fd..d385f354a 100644 --- a/include/s/s_StateID.hpp +++ b/include/s/s_StateID.hpp @@ -44,7 +44,7 @@ class sStateID_c : public sStateIDIf_c { namespace sStateID { /// @ingroup state -extern sStateID_c null; ///< A null state instance. +extern const sStateID_c null; ///< A null state instance. } // namespace sStateID #endif diff --git a/src/d/a/npc/d_a_ordinary_npc.cpp b/src/d/a/npc/d_a_ordinary_npc.cpp index 767a9c7e7..6e6bb2fdc 100644 --- a/src/d/a/npc/d_a_ordinary_npc.cpp +++ b/src/d/a/npc/d_a_ordinary_npc.cpp @@ -2,4 +2,12 @@ #include "d/a/npc/d_a_npc.h" #include "s/s_StateID.hpp" +STATE_VIRTUAL_DEFINE(dAcOrdinaryNpc_c, Wait); STATE_VIRTUAL_DEFINE(dAcOrdinaryNpc_c, Pain); +STATE_VIRTUAL_DEFINE(dAcOrdinaryNpc_c, Surprised); +STATE_VIRTUAL_DEFINE(dAcOrdinaryNpc_c, Withstand); +STATE_VIRTUAL_DEFINE(dAcOrdinaryNpc_c, Walk); +STATE_VIRTUAL_DEFINE(dAcOrdinaryNpc_c, LookAwaySt); +STATE_VIRTUAL_DEFINE(dAcOrdinaryNpc_c, LookAway); +STATE_VIRTUAL_DEFINE(dAcOrdinaryNpc_c, Turn); +STATE_DEFINE(dAcOrdinaryNpc_c, PreWalkTurn); diff --git a/src/s/s_StateID.cpp b/src/s/s_StateID.cpp index be1e89888..bc2bdcafe 100644 --- a/src/s/s_StateID.cpp +++ b/src/s/s_StateID.cpp @@ -11,7 +11,7 @@ // See include/s/README.txt for changes made sStateID_c::NumberMemo_c sStateID_c::sm_numberMemo; -sStateID_c sStateID::null(nullptr); +const sStateID_c sStateID::null(nullptr); sStateID_c::sStateID_c(const char *name) { mpName = name; From 0f1efc94507ccd489fa172f91825dc4033503774 Mon Sep 17 00:00:00 2001 From: robojumper Date: Wed, 13 Nov 2024 21:42:23 +0100 Subject: [PATCH 3/9] The Groose is loose (but far away) --- .../rels/d_a_npc_rival_lodNP/splits.txt | 3 + .../rels/d_a_npc_rival_lodNP/symbols.txt | 122 +++++------ .../SOUE01/rels/d_a_npc_saltalkNP/splits.txt | 3 + .../SOUE01/rels/d_a_npc_saltalkNP/symbols.txt | 140 ++++++------- .../d_a_npc_volcano_f2_salboNP/symbols.txt | 6 +- config/SOUE01/symbols.txt | 130 ++++++------ configure.py | 2 +- include/d/a/d_a_base.h | 2 +- include/d/a/npc/d_a_npc.h | 182 ++++++++++++++++- include/d/a/npc/d_a_npc_rival_lod.h | 31 ++- include/d/a/npc/d_a_npc_saltalk.h | 46 ++++- include/d/a/npc/d_a_npc_volcano_f2_salbo.h | 9 +- include/d/a/npc/d_a_ordinary_npc.h | 2 + include/m/m_vec.h | 3 + include/toBeSorted/area_utils.h | 15 +- src/REL/d/a/npc/d_a_npc_rival_lod.cpp | 47 +++++ src/REL/d/a/npc/d_a_npc_saltalk.cpp | 191 ++++++++++++++++++ src/d/a/d_a_base.cpp | 2 +- src/d/a/npc/d_a_npc.cpp | 4 +- 19 files changed, 724 insertions(+), 216 deletions(-) diff --git a/config/SOUE01/rels/d_a_npc_rival_lodNP/splits.txt b/config/SOUE01/rels/d_a_npc_rival_lodNP/splits.txt index 044b0651c..b2d0f8bea 100644 --- a/config/SOUE01/rels/d_a_npc_rival_lodNP/splits.txt +++ b/config/SOUE01/rels/d_a_npc_rival_lodNP/splits.txt @@ -17,3 +17,6 @@ REL/global_destructor_chain.c: REL/d/a/npc/d_a_npc_rival_lod.cpp: .text start:0x000000F0 end:0x00000EA8 .ctors start:0x00000000 end:0x00000004 + .rodata start:0x00000000 end:0x00000028 + .data start:0x00000000 end:0x0000037C + .bss start:0x00000008 end:0x00000048 diff --git a/config/SOUE01/rels/d_a_npc_rival_lodNP/symbols.txt b/config/SOUE01/rels/d_a_npc_rival_lodNP/symbols.txt index 27ca6f67c..97c92c1e6 100644 --- a/config/SOUE01/rels/d_a_npc_rival_lodNP/symbols.txt +++ b/config/SOUE01/rels/d_a_npc_rival_lodNP/symbols.txt @@ -4,59 +4,59 @@ _unresolved = .text:0x00000060; // type:function size:0x4 scope:global __register_global_object = .text:0x00000070; // type:function size:0x1C scope:global __destroy_global_chain = .text:0x00000090; // type:function size:0x54 scope:global dAcNpcRivalLOD_c_classInit__Fv = .text:0x000000F0; // type:function size:0x100 -fn_22_1F0 = .text:0x000001F0; // type:function size:0x58 +__dt__15dShadowCircle_cFv = .text:0x000001F0; // type:function size:0x58 __dt__29sFState_c<16dAcNpcRivalLOD_c>Fv = .text:0x00000250; // type:function size:0x58 __dt__32sFStateFct_c<16dAcNpcRivalLOD_c>Fv = .text:0x000002B0; // type:function size:0x6C __dt__85sStateMgr_c<16dAcNpcRivalLOD_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000320; // type:function size:0xA0 __dt__55sFStateMgr_c<16dAcNpcRivalLOD_c,20sStateMethodUsr_FI_c>Fv = .text:0x000003C0; // type:function size:0xA4 -fn_22_470 = .text:0x00000470; // type:function size:0x7C -fn_22_4F0 = .text:0x000004F0; // type:function size:0xD4 -fn_22_5D0 = .text:0x000005D0; // type:function size:0x10 +createHeap__16dAcNpcRivalLOD_cFv = .text:0x00000470; // type:function size:0x7C +create__16dAcNpcRivalLOD_cFv = .text:0x000004F0; // type:function size:0xD4 +setState__16dAcNpcRivalLOD_cFRC12sStateIDIf_c = .text:0x000005D0; // type:function size:0x10 changeState__85sStateMgr_c<16dAcNpcRivalLOD_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x000005E0; // type:function size:0x10 -fn_22_5F0 = .text:0x000005F0; // type:function size:0x8 -fn_22_600 = .text:0x00000600; // type:function size:0x50 -fn_22_650 = .text:0x00000650; // type:function size:0x10 +doDelete__16dAcNpcRivalLOD_cFv = .text:0x000005F0; // type:function size:0x8 +actorExecute__16dAcNpcRivalLOD_cFv = .text:0x00000600; // type:function size:0x50 +executeState__16dAcNpcRivalLOD_cFv = .text:0x00000650; // type:function size:0x10 executeState__85sStateMgr_c<16dAcNpcRivalLOD_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000660; // type:function size:0x10 -fn_22_670 = .text:0x00000670; // type:function size:0x28 -fn_22_6A0 = .text:0x000006A0; // type:function size:0x24 -fn_22_6D0 = .text:0x000006D0; // type:function size:0x10 -fn_22_6E0 = .text:0x000006E0; // type:function size:0x4 -fn_22_6F0 = .text:0x000006F0; // type:function size:0x8 -fn_22_700 = .text:0x00000700; // type:function size:0x34 -fn_22_740 = .text:0x00000740; // type:function size:0x14 -fn_22_760 = .text:0x00000760; // type:function size:0x34 -fn_22_7A0 = .text:0x000007A0; // type:function size:0x8 -fn_22_7B0 = .text:0x000007B0; // type:function size:0x8 -fn_22_7C0 = .text:0x000007C0; // type:function size:0x8 -fn_22_7D0 = .text:0x000007D0; // type:function size:0x8 -fn_22_7E0 = .text:0x000007E0; // type:function size:0x8 -fn_22_7F0 = .text:0x000007F0; // type:function size:0x4 -fn_22_800 = .text:0x00000800; // type:function size:0x4 -fn_22_810 = .text:0x00000810; // type:function size:0x4 -fn_22_820 = .text:0x00000820; // type:function size:0x4 -fn_22_830 = .text:0x00000830; // type:function size:0x8 -fn_22_840 = .text:0x00000840; // type:function size:0x8 -fn_22_850 = .text:0x00000850; // type:function size:0x8 -fn_22_860 = .text:0x00000860; // type:function size:0x8 -fn_22_870 = .text:0x00000870; // type:function size:0x4 -fn_22_880 = .text:0x00000880; // type:function size:0x4 -fn_22_890 = .text:0x00000890; // type:function size:0x8 -fn_22_8A0 = .text:0x000008A0; // type:function size:0x8 -fn_22_8B0 = .text:0x000008B0; // type:function size:0x8 -fn_22_8C0 = .text:0x000008C0; // type:function size:0x8 -fn_22_8D0 = .text:0x000008D0; // type:function size:0x8 -fn_22_8E0 = .text:0x000008E0; // type:function size:0x8 -fn_22_8F0 = .text:0x000008F0; // type:function size:0x8 -fn_22_900 = .text:0x00000900; // type:function size:0x8 -fn_22_910 = .text:0x00000910; // type:function size:0x8 -fn_22_920 = .text:0x00000920; // type:function size:0x8 -fn_22_930 = .text:0x00000930; // type:function size:0x8 -fn_22_940 = .text:0x00000940; // type:function size:0x8 -fn_22_950 = .text:0x00000950; // type:function size:0x8 -fn_22_960 = .text:0x00000960; // type:function size:0x4 -fn_22_970 = .text:0x00000970; // type:function size:0x4 -fn_22_980 = .text:0x00000980; // type:function size:0x1C -fn_22_9A0 = .text:0x000009A0; // type:function size:0x58 +draw__16dAcNpcRivalLOD_cFv = .text:0x00000670; // type:function size:0x28 +initializeState_Wait__16dAcNpcRivalLOD_cFv = .text:0x000006A0; // type:function size:0x24 +executeState_Wait__16dAcNpcRivalLOD_cFv = .text:0x000006D0; // type:function size:0x10 +finalizeState_Wait__16dAcNpcRivalLOD_cFv = .text:0x000006E0; // type:function size:0x4 +acNpc_vt_0x204__8dAcNpc_cFv = .text:0x000006F0; // type:function size:0x8 +acNpc_vt_0x200__8dAcNpc_cFv = .text:0x00000700; // type:function size:0x34 +acNpc_vt_0x1FC__8dAcNpc_cFv = .text:0x00000740; // type:function size:0x14 +acNpc_vt_0x1F8__8dAcNpc_cFv = .text:0x00000760; // type:function size:0x34 +acNpc_vt_0x1F4__8dAcNpc_cFv = .text:0x000007A0; // type:function size:0x8 +acNpc_vt_0x1F0__8dAcNpc_cFv = .text:0x000007B0; // type:function size:0x8 +acNpc_vt_0x1EC__8dAcNpc_cFv = .text:0x000007C0; // type:function size:0x8 +acNpc_vt_0x1E8__8dAcNpc_cFv = .text:0x000007D0; // type:function size:0x8 +acNpc_vt_0x168__8dAcNpc_cFv = .text:0x000007E0; // type:function size:0x8 +acNpc_vt_0x160__8dAcNpc_cFv = .text:0x000007F0; // type:function size:0x4 +acNpc_vt_0x15C__8dAcNpc_cFv = .text:0x00000800; // type:function size:0x4 +acNpc_vt_0x158__8dAcNpc_cFv = .text:0x00000810; // type:function size:0x4 +acNpc_vt_0x154__8dAcNpc_cFv = .text:0x00000820; // type:function size:0x4 +acNpc_vt_0x150__8dAcNpc_cFv = .text:0x00000830; // type:function size:0x8 +acNpc_vt_0x14C__8dAcNpc_cFv = .text:0x00000840; // type:function size:0x8 +acNpc_vt_0x12C__8dAcNpc_cFv = .text:0x00000850; // type:function size:0x8 +acNpc_vt_0x128__8dAcNpc_cFv = .text:0x00000860; // type:function size:0x8 +acNpc_vt_0x124__8dAcNpc_cFv = .text:0x00000870; // type:function size:0x4 +acNpc_vt_0x120__8dAcNpc_cFv = .text:0x00000880; // type:function size:0x4 +acNpc_vt_0x118__8dAcNpc_cFv = .text:0x00000890; // type:function size:0x8 +acNpc_vt_0x114__8dAcNpc_cFv = .text:0x000008A0; // type:function size:0x8 +acNpc_vt_0xEC__8dAcNpc_cFv = .text:0x000008B0; // type:function size:0x8 +getObjectListEntry__8dAcNpc_cFv = .text:0x000008C0; // type:function size:0x8 +acNpc_vt_0xE4__8dAcNpc_cFv = .text:0x000008D0; // type:function size:0x8 +acNpc_vt_0xE0__8dAcNpc_cFv = .text:0x000008E0; // type:function size:0x8 +acNpc_vt_0xDC__8dAcNpc_cFv = .text:0x000008F0; // type:function size:0x8 +eventFlowSwitch4__8dAcNpc_cFv = .text:0x00000900; // type:function size:0x8 +eventFlowSwitch3__8dAcNpc_cFv = .text:0x00000910; // type:function size:0x8 +eventFlowSwitch2__8dAcNpc_cFv = .text:0x00000920; // type:function size:0x8 +acNpc_vt_0x98__8dAcNpc_cFv = .text:0x00000930; // type:function size:0x8 +acNpc_vt_0x94__8dAcNpc_cFv = .text:0x00000940; // type:function size:0x8 +acNpc_vt_0x90__8dAcNpc_cFv = .text:0x00000950; // type:function size:0x8 +acNpc_vt_0x8C__8dAcNpc_cFv = .text:0x00000960; // type:function size:0x4 +acNpc_vt_0x88__8dAcNpc_cFv = .text:0x00000970; // type:function size:0x4 +getPosCopy3__8dAcNpc_cFR7mVec3_c = .text:0x00000980; // type:function size:0x1C +isInState__16dAcNpcRivalLOD_cCFRC12sStateIDIf_c = .text:0x000009A0; // type:function size:0x58 getStateID__85sStateMgr_c<16dAcNpcRivalLOD_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000A00; // type:function size:0x10 __dt__16dAcNpcRivalLOD_cFv = .text:0x00000A10; // type:function size:0xDC build__32sFStateFct_c<16dAcNpcRivalLOD_c>FRC12sStateIDIf_c = .text:0x00000AF0; // type:function size:0x60 @@ -79,18 +79,18 @@ isSameName__31sFStateID_c<16dAcNpcRivalLOD_c>CFPCc = .text:0x00000E20; // type:f _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_22_rodata_0 = .rodata:0x00000000; // type:object size:0x24 data:float -lbl_22_rodata_24 = .rodata:0x00000024; // type:object size:0x4 data:float -g_profile_NPC_RIVAL_LOD = .data:0x00000000; // type:object size:0x30 data:4byte -lbl_22_data_30 = .data:0x00000030; // type:object size:0x10 -lbl_22_data_40 = .data:0x00000040; // type:object size:0x20 -lbl_22_data_60 = .data:0x00000060; // type:object size:0x208 -lbl_22_data_268 = .data:0x00000268; // type:object size:0x30 -lbl_22_data_298 = .data:0x00000298; // type:object size:0x30 -lbl_22_data_2C8 = .data:0x000002C8; // type:object size:0x18 -lbl_22_data_2E0 = .data:0x000002E0; // type:object size:0x18 -lbl_22_data_2F8 = .data:0x000002F8; // type:object size:0x50 -lbl_22_data_348 = .data:0x00000348; // type:object size:0x34 +lbl_22_rodata_0 = .rodata:0x00000000; // type:object size:0x24 scope:local data:float +lbl_22_rodata_24 = .rodata:0x00000024; // type:object size:0x4 scope:local data:float +g_profile_NPC_RIVAL_LOD = .data:0x00000000; // type:object size:0x10 data:4byte +lbl_22_data_30 = .data:0x00000030; // type:object size:0x10 scope:local +lbl_22_data_40 = .data:0x00000040; // type:object size:0x20 scope:local +__vt__16dAcNpcRivalLOD_c = .data:0x00000060; // type:object size:0x208 +__vt__55sFStateMgr_c<16dAcNpcRivalLOD_c,20sStateMethodUsr_FI_c> = .data:0x00000268; // type:object size:0x30 +__vt__85sStateMgr_c<16dAcNpcRivalLOD_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x00000298; // type:object size:0x30 +__vt__32sFStateFct_c<16dAcNpcRivalLOD_c> = .data:0x000002C8; // type:object size:0x14 +__vt__29sFState_c<16dAcNpcRivalLOD_c> = .data:0x000002E0; // type:object size:0x18 +__vt__15dShadowCircle_c = .data:0x000002F8; // type:object size:0xC +__vt__31sFStateID_c<16dAcNpcRivalLOD_c> = .data:0x00000348; // type:object size:0x34 __global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:global -lbl_22_bss_8 = .bss:0x00000008; // type:object size:0x10 -lbl_22_bss_18 = .bss:0x00000018; // type:object size:0x30 data:4byte +lbl_22_bss_8 = .bss:0x00000008; // type:object size:0x10 scope:local +StateID_Wait__16dAcNpcRivalLOD_c = .bss:0x00000018; // type:object size:0x30 data:4byte diff --git a/config/SOUE01/rels/d_a_npc_saltalkNP/splits.txt b/config/SOUE01/rels/d_a_npc_saltalkNP/splits.txt index 1360a81a8..09d5df0dc 100644 --- a/config/SOUE01/rels/d_a_npc_saltalkNP/splits.txt +++ b/config/SOUE01/rels/d_a_npc_saltalkNP/splits.txt @@ -17,3 +17,6 @@ REL/global_destructor_chain.c: REL/d/a/npc/d_a_npc_saltalk.cpp: .text start:0x000000F0 end:0x000011A0 .ctors start:0x00000000 end:0x00000004 + .rodata start:0x00000000 end:0x00000018 + .data start:0x00000000 end:0x000002D0 + .bss start:0x00000008 end:0x00000048 diff --git a/config/SOUE01/rels/d_a_npc_saltalkNP/symbols.txt b/config/SOUE01/rels/d_a_npc_saltalkNP/symbols.txt index 91eac65b5..7b657e016 100644 --- a/config/SOUE01/rels/d_a_npc_saltalkNP/symbols.txt +++ b/config/SOUE01/rels/d_a_npc_saltalkNP/symbols.txt @@ -4,69 +4,69 @@ _unresolved = .text:0x00000060; // type:function size:0x4 scope:global __register_global_object = .text:0x00000070; // type:function size:0x1C scope:global __destroy_global_chain = .text:0x00000090; // type:function size:0x54 scope:global dAcNpcSltk_c_classInit__Fv = .text:0x000000F0; // type:function size:0x70 -fn_60_160 = .text:0x00000160; // type:function size:0x4 -fn_60_170 = .text:0x00000170; // type:function size:0x1C4 -fn_60_340 = .text:0x00000340; // type:function size:0x64 -fn_60_3B0 = .text:0x000003B0; // type:function size:0x58 -fn_60_410 = .text:0x00000410; // type:function size:0x128 -fn_60_540 = .text:0x00000540; // type:function size:0x24 -fn_60_570 = .text:0x00000570; // type:function size:0x8 -fn_60_580 = .text:0x00000580; // type:function size:0x8 -fn_60_590 = .text:0x00000590; // type:function size:0xC -fn_60_5A0 = .text:0x000005A0; // type:function size:0xC -fn_60_5B0 = .text:0x000005B0; // type:function size:0xC -fn_60_5C0 = .text:0x000005C0; // type:function size:0xC -fn_60_5D0 = .text:0x000005D0; // type:function size:0xC -fn_60_5E0 = .text:0x000005E0; // type:function size:0x24 -fn_60_610 = .text:0x00000610; // type:function size:0x8 -fn_60_620 = .text:0x00000620; // type:function size:0x28 -fn_60_650 = .text:0x00000650; // type:function size:0x2C -fn_60_680 = .text:0x00000680; // type:function size:0xF0 -fn_60_770 = .text:0x00000770; // type:function size:0x4 -fn_60_780 = .text:0x00000780; // type:function size:0x1FC -fn_60_980 = .text:0x00000980; // type:function size:0x4 -fn_60_990 = .text:0x00000990; // type:function size:0x8 -fn_60_9A0 = .text:0x000009A0; // type:function size:0x34 -fn_60_9E0 = .text:0x000009E0; // type:function size:0x14 -fn_60_A00 = .text:0x00000A00; // type:function size:0x34 -fn_60_A40 = .text:0x00000A40; // type:function size:0x8 -fn_60_A50 = .text:0x00000A50; // type:function size:0x8 -fn_60_A60 = .text:0x00000A60; // type:function size:0x8 -fn_60_A70 = .text:0x00000A70; // type:function size:0x8 -fn_60_A80 = .text:0x00000A80; // type:function size:0x8 -fn_60_A90 = .text:0x00000A90; // type:function size:0x4 -fn_60_AA0 = .text:0x00000AA0; // type:function size:0x4 -fn_60_AB0 = .text:0x00000AB0; // type:function size:0x4 -fn_60_AC0 = .text:0x00000AC0; // type:function size:0x4 -fn_60_AD0 = .text:0x00000AD0; // type:function size:0x8 -fn_60_AE0 = .text:0x00000AE0; // type:function size:0x8 -fn_60_AF0 = .text:0x00000AF0; // type:function size:0x8 -fn_60_B00 = .text:0x00000B00; // type:function size:0x8 -fn_60_B10 = .text:0x00000B10; // type:function size:0x4 -fn_60_B20 = .text:0x00000B20; // type:function size:0x4 -fn_60_B30 = .text:0x00000B30; // type:function size:0x8 -fn_60_B40 = .text:0x00000B40; // type:function size:0x8 -fn_60_B50 = .text:0x00000B50; // type:function size:0x10 -fn_60_B60 = .text:0x00000B60; // type:function size:0x8 -fn_60_B70 = .text:0x00000B70; // type:function size:0x8 -fn_60_B80 = .text:0x00000B80; // type:function size:0x8 -fn_60_B90 = .text:0x00000B90; // type:function size:0x8 -fn_60_BA0 = .text:0x00000BA0; // type:function size:0x8 -fn_60_BB0 = .text:0x00000BB0; // type:function size:0x8 -fn_60_BC0 = .text:0x00000BC0; // type:function size:0x8 -fn_60_BD0 = .text:0x00000BD0; // type:function size:0x8 -fn_60_BE0 = .text:0x00000BE0; // type:function size:0x8 -fn_60_BF0 = .text:0x00000BF0; // type:function size:0x8 -fn_60_C00 = .text:0x00000C00; // type:function size:0x4 -fn_60_C10 = .text:0x00000C10; // type:function size:0x4 -fn_60_C20 = .text:0x00000C20; // type:function size:0x1C +create__12dAcNpcSltk_cFv = .text:0x00000160; // type:function size:0x4 +actorCreate__12dAcNpcSltk_cFv = .text:0x00000170; // type:function size:0x1C4 +setState__8dAcNpc_cFRC12sStateIDIf_c = .text:0x00000340; // type:function size:0x64 +isInState__8dAcNpc_cCFRC12sStateIDIf_c = .text:0x000003B0; // type:function size:0x58 +actorPostCreate__12dAcNpcSltk_cFv = .text:0x00000410; // type:function size:0x128 +actorExecute__12dAcNpcSltk_cFv = .text:0x00000540; // type:function size:0x24 +acNpc_vt_0xDC__12dAcNpcSltk_cFv = .text:0x00000570; // type:function size:0x8 +draw__12dAcNpcSltk_cFv = .text:0x00000580; // type:function size:0x8 +getParam0_0__12dAcNpcSltk_cCFv = .text:0x00000590; // type:function size:0xC +getParam0_1__12dAcNpcSltk_cCFv = .text:0x000005A0; // type:function size:0xC +getParam1__12dAcNpcSltk_cCFv = .text:0x000005B0; // type:function size:0xC +getParam2__12dAcNpcSltk_cCFv = .text:0x000005C0; // type:function size:0xC +getParam3__12dAcNpcSltk_cCFv = .text:0x000005D0; // type:function size:0xC +getParam4__12dAcNpcSltk_cCFv = .text:0x000005E0; // type:function size:0x24 +getSomething__12dAcNpcSltk_cCFv = .text:0x00000610; // type:function size:0x8 +isSomething0__12dAcNpcSltk_cCFv = .text:0x00000620; // type:function size:0x28 +isSomething1__12dAcNpcSltk_cCFv = .text:0x00000650; // type:function size:0x2C +checkSomething__12dAcNpcSltk_cF7mVec3_c = .text:0x00000680; // type:function size:0xF0 +initializeState_Wait__12dAcNpcSltk_cFv = .text:0x00000770; // type:function size:0x4 +executeState_Wait__12dAcNpcSltk_cFv = .text:0x00000780; // type:function size:0x1FC +finalizeState_Wait__12dAcNpcSltk_cFv = .text:0x00000980; // type:function size:0x4 +acNpc_vt_0x204__8dAcNpc_cFv = .text:0x00000990; // type:function size:0x8 +acNpc_vt_0x200__8dAcNpc_cFv = .text:0x000009A0; // type:function size:0x34 +acNpc_vt_0x1FC__8dAcNpc_cFv = .text:0x000009E0; // type:function size:0x14 +acNpc_vt_0x1F8__8dAcNpc_cFv = .text:0x00000A00; // type:function size:0x34 +acNpc_vt_0x1F4__8dAcNpc_cFv = .text:0x00000A40; // type:function size:0x8 +acNpc_vt_0x1F0__8dAcNpc_cFv = .text:0x00000A50; // type:function size:0x8 +acNpc_vt_0x1EC__8dAcNpc_cFv = .text:0x00000A60; // type:function size:0x8 +acNpc_vt_0x1E8__8dAcNpc_cFv = .text:0x00000A70; // type:function size:0x8 +acNpc_vt_0x168__8dAcNpc_cFv = .text:0x00000A80; // type:function size:0x8 +acNpc_vt_0x160__8dAcNpc_cFv = .text:0x00000A90; // type:function size:0x4 +acNpc_vt_0x15C__8dAcNpc_cFv = .text:0x00000AA0; // type:function size:0x4 +acNpc_vt_0x158__8dAcNpc_cFv = .text:0x00000AB0; // type:function size:0x4 +acNpc_vt_0x154__8dAcNpc_cFv = .text:0x00000AC0; // type:function size:0x4 +acNpc_vt_0x150__8dAcNpc_cFv = .text:0x00000AD0; // type:function size:0x8 +acNpc_vt_0x14C__8dAcNpc_cFv = .text:0x00000AE0; // type:function size:0x8 +acNpc_vt_0x12C__8dAcNpc_cFv = .text:0x00000AF0; // type:function size:0x8 +acNpc_vt_0x128__8dAcNpc_cFv = .text:0x00000B00; // type:function size:0x8 +acNpc_vt_0x124__8dAcNpc_cFv = .text:0x00000B10; // type:function size:0x4 +acNpc_vt_0x120__8dAcNpc_cFv = .text:0x00000B20; // type:function size:0x4 +acNpc_vt_0x118__8dAcNpc_cFv = .text:0x00000B30; // type:function size:0x8 +acNpc_vt_0x114__8dAcNpc_cFv = .text:0x00000B40; // type:function size:0x8 +executeState__8dAcNpc_cFv = .text:0x00000B50; // type:function size:0x10 +acNpc_vt_0xEC__8dAcNpc_cFv = .text:0x00000B60; // type:function size:0x8 +getObjectListEntry__8dAcNpc_cFv = .text:0x00000B70; // type:function size:0x8 +acNpc_vt_0xE4__8dAcNpc_cFv = .text:0x00000B80; // type:function size:0x8 +acNpc_vt_0xE0__8dAcNpc_cFv = .text:0x00000B90; // type:function size:0x8 +eventFlowSwitch4__8dAcNpc_cFv = .text:0x00000BA0; // type:function size:0x8 +eventFlowSwitch3__8dAcNpc_cFv = .text:0x00000BB0; // type:function size:0x8 +eventFlowSwitch2__8dAcNpc_cFv = .text:0x00000BC0; // type:function size:0x8 +acNpc_vt_0x98__8dAcNpc_cFv = .text:0x00000BD0; // type:function size:0x8 +acNpc_vt_0x94__8dAcNpc_cFv = .text:0x00000BE0; // type:function size:0x8 +acNpc_vt_0x90__8dAcNpc_cFv = .text:0x00000BF0; // type:function size:0x8 +acNpc_vt_0x8C__8dAcNpc_cFv = .text:0x00000C00; // type:function size:0x4 +acNpc_vt_0x88__8dAcNpc_cFv = .text:0x00000C10; // type:function size:0x4 +getPosCopy3__8dAcNpc_cFR7mVec3_c = .text:0x00000C20; // type:function size:0x1C __dt__12dAcNpcSltk_cFv = .text:0x00000C40; // type:function size:0x78 __sinit_\d_a_npc_saltalk_cpp = .text:0x00000CC0; // type:function size:0x124 scope:local __dt__27sFStateID_c<12dAcNpcSltk_c>Fv = .text:0x00000DF0; // type:function size:0x58 -fn_60_E50 = .text:0x00000E50; // type:function size:0x5C -fn_60_EB0 = .text:0x00000EB0; // type:function size:0xC -fn_60_EC0 = .text:0x00000EC0; // type:function size:0xDC -fn_60_FA0 = .text:0x00000FA0; // type:function size:0xE0 +__dt__34sFStateVirtualID_c<12dAcNpcSltk_c>Fv = .text:0x00000E50; // type:function size:0x5C +baseID_Wait<8dAcNpc_c>__Fv_RC10sStateID_c = .text:0x00000EB0; // type:function size:0xC +number__34sFStateVirtualID_c<12dAcNpcSltk_c>CFv = .text:0x00000EC0; // type:function size:0xDC +superID__34sFStateVirtualID_c<12dAcNpcSltk_c>CFv = .text:0x00000FA0; // type:function size:0xE0 isSameName__27sFStateID_c<12dAcNpcSltk_c>CFPCc = .text:0x00001080; // type:function size:0x88 initializeState__27sFStateID_c<12dAcNpcSltk_c>CFR12dAcNpcSltk_c = .text:0x00001110; // type:function size:0x30 executeState__27sFStateID_c<12dAcNpcSltk_c>CFR12dAcNpcSltk_c = .text:0x00001140; // type:function size:0x30 @@ -74,14 +74,14 @@ finalizeState__27sFStateID_c<12dAcNpcSltk_c>CFR12dAcNpcSltk_c = .text:0x00001170 _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_60_rodata_0 = .rodata:0x00000000; // type:object size:0x4 data:float -lbl_60_rodata_4 = .rodata:0x00000004; // type:object size:0x4 data:float -lbl_60_rodata_8 = .rodata:0x00000008; // type:object size:0x8 data:double -lbl_60_rodata_10 = .rodata:0x00000010; // type:object size:0x4 data:float -lbl_60_rodata_14 = .rodata:0x00000014; // type:object size:0x4 data:float -g_profile_NPC_SLTK = .data:0x00000000; // type:object size:0x20 data:4byte -lbl_60_data_20 = .data:0x00000020; // type:object size:0x248 -lbl_60_data_268 = .data:0x00000268; // type:object size:0x68 +lbl_60_rodata_0 = .rodata:0x00000000; // type:object size:0x4 scope:local data:float +lbl_60_rodata_4 = .rodata:0x00000004; // type:object size:0x4 scope:local data:float +lbl_60_rodata_8 = .rodata:0x00000008; // type:object size:0x8 scope:local data:double +lbl_60_rodata_10 = .rodata:0x00000010; // type:object size:0x4 scope:local data:float +lbl_60_rodata_14 = .rodata:0x00000014; // type:object size:0x4 scope:local data:float +g_profile_NPC_SLTK = .data:0x00000000; // type:object size:0x10 data:4byte +__vt__12dAcNpcSltk_c = .data:0x00000020; // type:object size:0x208 +__vt__34sFStateVirtualID_c<12dAcNpcSltk_c> = .data:0x00000268; // type:object size:0x34 __global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:global -lbl_60_bss_8 = .bss:0x00000008; // type:object size:0xC -lbl_60_bss_14 = .bss:0x00000014; // type:object size:0x34 data:4byte +lbl_60_bss_8 = .bss:0x00000008; // type:object size:0xC scope:local +StateID_Wait__12dAcNpcSltk_c = .bss:0x00000014; // type:object size:0x34 data:4byte diff --git a/config/SOUE01/rels/d_a_npc_volcano_f2_salboNP/symbols.txt b/config/SOUE01/rels/d_a_npc_volcano_f2_salboNP/symbols.txt index 1b16ed44d..a26bd1af0 100644 --- a/config/SOUE01/rels/d_a_npc_volcano_f2_salboNP/symbols.txt +++ b/config/SOUE01/rels/d_a_npc_volcano_f2_salboNP/symbols.txt @@ -102,7 +102,7 @@ fn_61_5710 = .text:0x00005710; // type:function size:0x48 fn_61_5760 = .text:0x00005760; // type:function size:0x48 fn_61_57B0 = .text:0x000057B0; // type:function size:0x48 fn_61_5800 = .text:0x00005800; // type:function size:0xBC -fn_61_58C0 = .text:0x000058C0; // type:function size:0x84 +fn_61_58C0__12dAcNpcSlb2_cFii = .text:0x000058C0; // type:function size:0x84 fn_61_5950 = .text:0x00005950; // type:function size:0x1EC fn_61_5B40 = .text:0x00005B40; // type:function size:0x130 fn_61_5C70 = .text:0x00005C70; // type:function size:0x478 @@ -117,7 +117,7 @@ fn_61_6870 = .text:0x00006870; // type:function size:0x14 fn_61_6890 = .text:0x00006890; // type:function size:0xC fn_61_68A0 = .text:0x000068A0; // type:function size:0xC fn_61_68B0 = .text:0x000068B0; // type:function size:0x14 -fn_61_68D0 = .text:0x000068D0; // type:function size:0x58 +fn_61_68D0__12dAcNpcSlb2_cFi = .text:0x000068D0; // type:function size:0x58 fn_61_6930 = .text:0x00006930; // type:function size:0xC fn_61_6940 = .text:0x00006940; // type:function size:0xC fn_61_6950 = .text:0x00006950; // type:function size:0x14 @@ -129,7 +129,7 @@ fn_61_69C0 = .text:0x000069C0; // type:function size:0xC fn_61_69D0 = .text:0x000069D0; // type:function size:0x14 fn_61_69F0 = .text:0x000069F0; // type:function size:0xC fn_61_6A00 = .text:0x00006A00; // type:function size:0xC -fn_61_6A10 = .text:0x00006A10; // type:function size:0x14 +fn_61_6A10__12dAcNpcSlb2_cFv = .text:0x00006A10; // type:function size:0x14 fn_61_6A30 = .text:0x00006A30; // type:function size:0xC fn_61_6A40 = .text:0x00006A40; // type:function size:0xC fn_61_6A50 = .text:0x00006A50; // type:function size:0x14 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index ba841b6c2..a7786a0e1 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -1056,7 +1056,7 @@ setParams2Upper_ignoreLower__9dAcBase_cFUl = .text:0x8002CFB0; // type:function getParams2UpperByte__9dAcBase_cFv = .text:0x8002CFC0; // type:function size:0xC setParams2UpperByte__9dAcBase_cFUl = .text:0x8002CFD0; // type:function size:0x14 buildParams2__9dAcBase_cFUlUl = .text:0x8002CFF0; // type:function size:0x1C -getParams2Lower__9dAcBase_cFv = .text:0x8002D010; // type:function size:0xC +getParams2Lower__9dAcBase_cCFv = .text:0x8002D010; // type:function size:0xC findActor__9dAcBase_cFPcP9dAcBase_c = .text:0x8002D020; // type:function size:0x74 searchActor__9dAcBase_cFP9dAcBase_c = .text:0x8002D0A0; // type:function size:0x88 forEveryActor__9dAcBase_cFPFP9dAcBase_cP9dAcBase_c_PvP9dAcBase_c = .text:0x8002D130; // type:function size:0x5C @@ -1223,7 +1223,7 @@ baseID_Wait<10sStateID_c>__Fv_RC10sStateID_c = .text:0x80032440; // type:functio baseID_Demo<10sStateID_c>__Fv_RC10sStateID_c = .text:0x80032450; // type:function size:0xC fn_80032460 = .text:0x80032460; // type:function size:0x4 fn_80032470 = .text:0x80032470; // type:function size:0x4 -fn_80032480 = .text:0x80032480; // type:function size:0x390 +npcExecute__8dAcNpc_cFv = .text:0x80032480; // type:function size:0x390 fn_80032810 = .text:0x80032810; // type:function size:0x8 fn_80032820 = .text:0x80032820; // type:function size:0x8 fn_80032830 = .text:0x80032830; // type:function size:0x10 @@ -1249,7 +1249,7 @@ fn_80033220 = .text:0x80033220; // type:function size:0x4 fn_80033230 = .text:0x80033230; // type:function size:0x4 fn_80033240 = .text:0x80033240; // type:function size:0xD4 fn_80033320 = .text:0x80033320; // type:function size:0xD0 -fn_800333F0 = .text:0x800333F0; // type:function size:0x290 +acNpc_vt_0xE8__8dAcNpc_cFv = .text:0x800333F0; // type:function size:0x290 fn_80033680 = .text:0x80033680; // type:function size:0x60 fn_800336E0 = .text:0x800336E0; // type:function size:0x30 fn_80033710 = .text:0x80033710; // type:function size:0xBC @@ -1270,19 +1270,19 @@ ActorNpcBase__ctor2 = .text:0x80034010; // type:function size:0x27C ActorNpcBase__addToNpcList = .text:0x80034290; // type:function size:0x50 fn_800342E0 = .text:0x800342E0; // type:function size:0x34 fn_80034320 = .text:0x80034320; // type:function size:0x88 -fn_800343B0 = .text:0x800343B0; // type:function size:0x4 -fn_800343C0 = .text:0x800343C0; // type:function size:0x4 -fn_800343D0 = .text:0x800343D0; // type:function size:0x4 -fn_800343E0 = .text:0x800343E0; // type:function size:0x4 -fn_800343F0 = .text:0x800343F0; // type:function size:0x4 -fn_80034400 = .text:0x80034400; // type:function size:0x4 -fn_80034410 = .text:0x80034410; // type:function size:0x4 -fn_80034420 = .text:0x80034420; // type:function size:0x4 -fn_80034430 = .text:0x80034430; // type:function size:0x164 +acNpc_vt_0xAC__8dAcNpc_cFv = .text:0x800343B0; // type:function size:0x4 +acNpc_vt_0x130__8dAcNpc_cFv = .text:0x800343C0; // type:function size:0x4 +acNpc_vt_0x134__8dAcNpc_cFv = .text:0x800343D0; // type:function size:0x4 +acNpc_vt_0x138__8dAcNpc_cFv = .text:0x800343E0; // type:function size:0x4 +acNpc_vt_0x13C__8dAcNpc_cFv = .text:0x800343F0; // type:function size:0x4 +acNpc_vt_0x140__8dAcNpc_cFv = .text:0x80034400; // type:function size:0x4 +acNpc_vt_0x144__8dAcNpc_cFv = .text:0x80034410; // type:function size:0x4 +acNpc_vt_0x148__8dAcNpc_cFv = .text:0x80034420; // type:function size:0x4 +__dt__8dAcNpc_cFv = .text:0x80034430; // type:function size:0x164 getDistanceVecToLink = .text:0x800345A0; // type:function size:0x6C fn_80034610 = .text:0x80034610; // type:function size:0x10 fn_80034620 = .text:0x80034620; // type:function size:0x30 -getLinkPos = .text:0x80034650; // type:function size:0x20 +getLinkPos__8dAcNpc_cFv = .text:0x80034650; // type:function size:0x20 getLinkPosPtr = .text:0x80034670; // type:function size:0xC getLinkPosCopy2 = .text:0x80034680; // type:function size:0xC getLinkRotation = .text:0x80034690; // type:function size:0x20 @@ -1304,7 +1304,7 @@ fn_80034C10 = .text:0x80034C10; // type:function size:0x64 fn_80034C80 = .text:0x80034C80; // type:function size:0x104 fn_80034D90 = .text:0x80034D90; // type:function size:0x8 fn_80034DA0 = .text:0x80034DA0; // type:function size:0x8 -fn_80034DB0 = .text:0x80034DB0; // type:function size:0x10 +acNpc_vt_0x11C__8dAcNpc_cFv = .text:0x80034DB0; // type:function size:0x10 fn_80034DC0 = .text:0x80034DC0; // type:function size:0x50 ActorNpcBase2__rotateToGoal = .text:0x80034E10; // type:function size:0x5C fn_80034E70 = .text:0x80034E70; // type:function size:0x17C @@ -1333,67 +1333,67 @@ fn_80035330 = .text:0x80035330; // type:function size:0x10 fn_80035340 = .text:0x80035340; // type:function size:0x104 fn_80035450 = .text:0x80035450; // type:function size:0x108 fn_80035560 = .text:0x80035560; // type:function size:0x24 -fn_80035590 = .text:0x80035590; // type:function size:0x44 +giveItem__8dAcNpc_cFPv7ITEM_ID = .text:0x80035590; // type:function size:0x44 fn_800355E0 = .text:0x800355E0; // type:function size:0x200 NpcBase_GetPosCopy3 = .text:0x800357E0; // type:function size:0x1C fn_80035800 = .text:0x80035800; // type:function size:0x294 fn_80035AA0 = .text:0x80035AA0; // type:function size:0x100 -fn_80035BA0 = .text:0x80035BA0; // type:function size:0x1D0 -fn_80035D70 = .text:0x80035D70; // type:function size:0x19C -fn_80035F10 = .text:0x80035F10; // type:function size:0x20C -fn_80036120 = .text:0x80036120; // type:function size:0x84 +acNpc_vt_0xB0__8dAcNpc_cFv = .text:0x80035BA0; // type:function size:0x1D0 +acNpc_vt_0xB4__8dAcNpc_cFv = .text:0x80035D70; // type:function size:0x19C +acNpc_vt_0xB8__8dAcNpc_cFv = .text:0x80035F10; // type:function size:0x20C +acNpc_vt_0xBC__8dAcNpc_cFv = .text:0x80036120; // type:function size:0x84 ActorNpcBase__contextRelatedEventSwitch2 = .text:0x800361B0; // type:function size:0x10 fn_800361C0 = .text:0x800361C0; // type:function size:0x8 ActorNpcBase__contextRelatedEventSwitch3 = .text:0x800361D0; // type:function size:0x10 fn_800361E0 = .text:0x800361E0; // type:function size:0x8 ActorNpcBase__contextRelatedEventSwitch4 = .text:0x800361F0; // type:function size:0x10 fn_80036200 = .text:0x80036200; // type:function size:0x8 -fn_80036210 = .text:0x80036210; // type:function size:0x1FC -fn_80036410 = .text:0x80036410; // type:function size:0x8 -fn_80036420 = .text:0x80036420; // type:function size:0x8 -fn_80036430 = .text:0x80036430; // type:function size:0x8 -fn_80036440 = .text:0x80036440; // type:function size:0x8 -fn_80036450 = .text:0x80036450; // type:function size:0x8 -fn_80036460 = .text:0x80036460; // type:function size:0x88 -fn_800364F0 = .text:0x800364F0; // type:function size:0x78 -fn_80036570 = .text:0x80036570; // type:function size:0x78 -fn_800365F0 = .text:0x800365F0; // type:function size:0x78 -fn_80036670 = .text:0x80036670; // type:function size:0x8 -fn_80036680 = .text:0x80036680; // type:function size:0x8 -fn_80036690 = .text:0x80036690; // type:function size:0x8 -fn_800366A0 = .text:0x800366A0; // type:function size:0x8 -fn_800366B0 = .text:0x800366B0; // type:function size:0x14 -fn_800366D0 = .text:0x800366D0; // type:function size:0x14 -fn_800366F0 = .text:0x800366F0; // type:function size:0x14 -fn_80036710 = .text:0x80036710; // type:function size:0x14 -fn_80036730 = .text:0x80036730; // type:function size:0x14 -fn_80036750 = .text:0x80036750; // type:function size:0x14 -fn_80036770 = .text:0x80036770; // type:function size:0x10 -fn_80036780 = .text:0x80036780; // type:function size:0xC -fn_80036790 = .text:0x80036790; // type:function size:0x10 -fn_800367A0 = .text:0x800367A0; // type:function size:0x10 -fn_800367B0 = .text:0x800367B0; // type:function size:0x14 -fn_800367D0 = .text:0x800367D0; // type:function size:0x14 -fn_800367F0 = .text:0x800367F0; // type:function size:0x10 -fn_80036800 = .text:0x80036800; // type:function size:0x10 -fn_80036810 = .text:0x80036810; // type:function size:0x10 -fn_80036820 = .text:0x80036820; // type:function size:0xC -fn_80036830 = .text:0x80036830; // type:function size:0x8 -fn_80036840 = .text:0x80036840; // type:function size:0xC +acNpc_vt_0x164__8dAcNpc_cFv = .text:0x80036210; // type:function size:0x1FC +acNpc_vt_0x16C__8dAcNpc_cFv = .text:0x80036410; // type:function size:0x8 +acNpc_vt_0x170__8dAcNpc_cFv = .text:0x80036420; // type:function size:0x8 +acNpc_vt_0x174__8dAcNpc_cFv = .text:0x80036430; // type:function size:0x8 +acNpc_vt_0x178__8dAcNpc_cFv = .text:0x80036440; // type:function size:0x8 +acNpc_vt_0x17C__8dAcNpc_cFv = .text:0x80036450; // type:function size:0x8 +acNpc_vt_0x180__8dAcNpc_cFv = .text:0x80036460; // type:function size:0x88 +acNpc_vt_0x184__8dAcNpc_cFv = .text:0x800364F0; // type:function size:0x78 +acNpc_vt_0x188__8dAcNpc_cFv = .text:0x80036570; // type:function size:0x78 +acNpc_vt_0x18C__8dAcNpc_cFv = .text:0x800365F0; // type:function size:0x78 +acNpc_vt_0x190__8dAcNpc_cFv = .text:0x80036670; // type:function size:0x8 +acNpc_vt_0x194__8dAcNpc_cFv = .text:0x80036680; // type:function size:0x8 +acNpc_vt_0x198__8dAcNpc_cFv = .text:0x80036690; // type:function size:0x8 +acNpc_vt_0x19C__8dAcNpc_cFv = .text:0x800366A0; // type:function size:0x8 +acNpc_vt_0x1A0__8dAcNpc_cFv = .text:0x800366B0; // type:function size:0x14 +acNpc_vt_0x1A4__8dAcNpc_cFv = .text:0x800366D0; // type:function size:0x14 +acNpc_vt_0x1A8__8dAcNpc_cFv = .text:0x800366F0; // type:function size:0x14 +acNpc_vt_0x1AC__8dAcNpc_cFv = .text:0x80036710; // type:function size:0x14 +acNpc_vt_0x1B0__8dAcNpc_cFv = .text:0x80036730; // type:function size:0x14 +acNpc_vt_0x1B4__8dAcNpc_cFv = .text:0x80036750; // type:function size:0x14 +acNpc_vt_0x1B8__8dAcNpc_cFv = .text:0x80036770; // type:function size:0x10 +acNpc_vt_0x1BC__8dAcNpc_cFv = .text:0x80036780; // type:function size:0xC +acNpc_vt_0x1C0__8dAcNpc_cFv = .text:0x80036790; // type:function size:0x10 +acNpc_vt_0x1C4__8dAcNpc_cFv = .text:0x800367A0; // type:function size:0x10 +acNpc_vt_0x1C8__8dAcNpc_cFv = .text:0x800367B0; // type:function size:0x14 +acNpc_vt_0x1CC__8dAcNpc_cFv = .text:0x800367D0; // type:function size:0x14 +acNpc_vt_0x1D0__8dAcNpc_cFv = .text:0x800367F0; // type:function size:0x10 +acNpc_vt_0x1D4__8dAcNpc_cFv = .text:0x80036800; // type:function size:0x10 +acNpc_vt_0x1D8__8dAcNpc_cFv = .text:0x80036810; // type:function size:0x10 +acNpc_vt_0x1DC__8dAcNpc_cFv = .text:0x80036820; // type:function size:0xC +acNpc_vt_0x1E0__8dAcNpc_cFv = .text:0x80036830; // type:function size:0x8 +acNpc_vt_0x1E4__8dAcNpc_cFv = .text:0x80036840; // type:function size:0xC fn_80036850 = .text:0x80036850; // type:function size:0xC8 fn_80036920 = .text:0x80036920; // type:function size:0x148 fn_80036A70 = .text:0x80036A70; // type:function size:0x128 fn_80036BA0 = .text:0x80036BA0; // type:function size:0x6C fn_80036C10 = .text:0x80036C10; // type:function size:0x84 -fn_80036CA0 = .text:0x80036CA0; // type:function size:0xFC -fn_80036DA0 = .text:0x80036DA0; // type:function size:0xBC -fn_80036E60 = .text:0x80036E60; // type:function size:0xC8 -fn_80036F30 = .text:0x80036F30; // type:function size:0xF4 +acNpc_vt_0x9C__8dAcNpc_cFv = .text:0x80036CA0; // type:function size:0xFC +acNpc_vt_0xA0__8dAcNpc_cFv = .text:0x80036DA0; // type:function size:0xBC +acNpc_vt_0xA4__8dAcNpc_cFv = .text:0x80036E60; // type:function size:0xC8 +acNpc_vt_0xA8__8dAcNpc_cFv = .text:0x80036F30; // type:function size:0xF4 fn_80037030 = .text:0x80037030; // type:function size:0x1C -fn_80037050 = .text:0x80037050; // type:function size:0x4 -fn_80037060 = .text:0x80037060; // type:function size:0x8 -fn_80037070 = .text:0x80037070; // type:function size:0x4 -fn_80037080 = .text:0x80037080; // type:function size:0x8 +acNpc_vt_0xCC__8dAcNpc_cFv = .text:0x80037050; // type:function size:0x4 +acNpc_vt_0xD0__8dAcNpc_cFv = .text:0x80037060; // type:function size:0x8 +acNpc_vt_0xD4__8dAcNpc_cFv = .text:0x80037070; // type:function size:0x4 +acNpc_vt_0xD8__8dAcNpc_cFv = .text:0x80037080; // type:function size:0x8 fn_80037090 = .text:0x80037090; // type:function size:0x200 fn_80037290 = .text:0x80037290; // type:function size:0x8 fn_800372A0 = .text:0x800372A0; // type:function size:0x8 @@ -1405,9 +1405,9 @@ fn_80037650 = .text:0x80037650; // type:function size:0xF8 fn_80037750 = .text:0x80037750; // type:function size:0x4 fn_80037760 = .text:0x80037760; // type:function size:0x4 fn_80037770 = .text:0x80037770; // type:function size:0x4 -fn_80037780 = .text:0x80037780; // type:function size:0x4 -fn_80037790 = .text:0x80037790; // type:function size:0x4 -fn_800377A0 = .text:0x800377A0; // type:function size:0x4 +initializeState_Demo__8dAcNpc_cFv = .text:0x80037780; // type:function size:0x4 +executeState_Demo__8dAcNpc_cFv = .text:0x80037790; // type:function size:0x4 +finalizeState_Demo__8dAcNpc_cFv = .text:0x800377A0; // type:function size:0x4 fn_800377B0 = .text:0x800377B0; // type:function size:0x24 fn_800377E0 = .text:0x800377E0; // type:function size:0x84 fn_80037870 = .text:0x80037870; // type:function size:0xD4 @@ -3722,8 +3722,8 @@ fn_800A9970 = .text:0x800A9970; // type:function size:0x58 fn_800A99D0 = .text:0x800A99D0; // type:function size:0xE0 ActorOnRail2__setSegment = .text:0x800A9AB0; // type:function size:0x50 checkPosInAREA = .text:0x800A9B00; // type:function size:0xC4 -getAREAForIndexInRoom = .text:0x800A9BD0; // type:function size:0x78 -checkPosInArea__FllRC7mVec3_cPPv = .text:0x800A9C50; // type:function size:0xD4 +getAreaForIndexInRoom__Fll = .text:0x800A9BD0; // type:function size:0x78 +checkPosInArea__FllRC7mVec3_cPP4AREA = .text:0x800A9C50; // type:function size:0xD4 detach__Q23d2d10ResAccIf_cFv = .text:0x800A9D30; // type:function size:0x60 attach__Q23d2d10ResAccIf_cFPvPCc = .text:0x800A9D90; // type:function size:0x90 BuildPaneObj__Q23d2d8Layout_cFlPCvRCQ34nw4r3lyt11ResBlockSet = .text:0x800A9E20; // type:function size:0x12C @@ -17868,7 +17868,7 @@ fn_802F2450__7mQuat_cFRC7mVec3_cRC7mVec3_cf = .text:0x802F2450; // type:function fn_802F25E0 = .text:0x802F25E0; // type:function size:0x19C fn_802F2780__7mQuat_cFRC7mQuat_c = .text:0x802F2780; // type:function size:0x198 fn_802F2920 = .text:0x802F2920; // type:function size:0x48 -mVec__createProjectionXZ = .text:0x802F2970; // type:function size:0x110 +createProjectionXZ__7mVec3_cFRC7mAng3_cf = .text:0x802F2970; // type:function size:0x110 mVec__fromXY = .text:0x802F2A80; // type:function size:0xF0 normalize__7mVec3_cFv = .text:0x802F2B70; // type:function size:0x78 mVec__normalizeRS = .text:0x802F2BF0; // type:function size:0x84 diff --git a/configure.py b/configure.py index 12e194298..0d0a90696 100644 --- a/configure.py +++ b/configure.py @@ -1157,7 +1157,7 @@ def nw4rLib(lib_name, objects, extra_cflags=[]): Rel(NonMatching, "d_a_npc_regret_rival", "REL/d/a/npc/d_a_npc_regret_rival.cpp"), Rel(NonMatching, "d_a_npc_rescue", "REL/d/a/npc/d_a_npc_rescue.cpp"), Rel(NonMatching, "d_a_npc_rival", "REL/d/a/npc/d_a_npc_rival.cpp"), - Rel(NonMatching, "d_a_npc_rival_lod", "REL/d/a/npc/d_a_npc_rival_lod.cpp"), + Rel(Matching, "d_a_npc_rival_lod", "REL/d/a/npc/d_a_npc_rival_lod.cpp"), Rel(NonMatching, "d_a_npc_salbage_morry", "REL/d/a/npc/d_a_npc_salbage_morry.cpp"), Rel(NonMatching, "d_a_npc_salbage_robot", "REL/d/a/npc/d_a_npc_salbage_robot.cpp"), Rel( diff --git a/include/d/a/d_a_base.h b/include/d/a/d_a_base.h index b2798eda6..946d0ca49 100644 --- a/include/d/a/d_a_base.h +++ b/include/d/a/d_a_base.h @@ -191,7 +191,7 @@ class dAcBase_c : public dBase_c { /* 8002cfc0 */ int getParams2UpperByte(); /* 8002cfd0 */ void setParams2UpperByte(u32 val); /* 8002cff0 */ static u32 buildParams2(u32 lower, u32 upper); - /* 8002d010 */ u32 getParams2Lower(); + /* 8002d010 */ u32 getParams2Lower() const; /* 8002d020 */ static dAcBase_c *findActor(char *objName, dAcBase_c *parent); /* 8002d0a0 */ static dAcBase_c *searchActor(dAcBase_c *parent); // Kinda performs the code of the first param on every actor (second param is optional parent) diff --git a/include/d/a/npc/d_a_npc.h b/include/d/a/npc/d_a_npc.h index 86e05ddc1..6fc590a85 100644 --- a/include/d/a/npc/d_a_npc.h +++ b/include/d/a/npc/d_a_npc.h @@ -1,8 +1,12 @@ #ifndef D_A_NPC_H #define D_A_NPC_H +#include "common.h" +#include "d/a/d_a_itembase.h" #include "d/a/obj/d_a_obj_base.h" +#include "m/m_vec.h" #include "s/s_State.hpp" +#include "s/s_StateInterfaces.hpp" // This is the NPC base. Most npcs actually use dAcOrdinaryNpc, but this just is a simpler one? @@ -12,11 +16,187 @@ class dAcNpc_c : public dAcObjBase_c { public: dAcNpc_c(); + virtual ~dAcNpc_c(); + + /* vt 0x080 */ virtual bool giveItem(void *unknown, ITEM_ID item_id); + /* vt 0x084 */ virtual void getPosCopy3(mVec3_c &outResult) { + outResult.copyFrom(poscopy3); + } + /* vt 0x088 */ virtual void acNpc_vt_0x88() {} + /* vt 0x08C */ virtual void acNpc_vt_0x8C() {} + /* vt 0x090 */ virtual int acNpc_vt_0x90() { + return 1; + } + /* vt 0x094 */ virtual int acNpc_vt_0x94() { + return 1; + } + /* vt 0x098 */ virtual int acNpc_vt_0x98() { + return 1; + } + /* vt 0x09C */ virtual void acNpc_vt_0x9C(); + /* vt 0x0A0 */ virtual void acNpc_vt_0xA0(); + /* vt 0x0A4 */ virtual void acNpc_vt_0xA4(); + /* vt 0x0A8 */ virtual void acNpc_vt_0xA8(); + /* vt 0x0AC */ virtual void acNpc_vt_0xAC(); + /* vt 0x0B0 */ virtual void acNpc_vt_0xB0(); + /* vt 0x0B4 */ virtual void acNpc_vt_0xB4(); + /* vt 0x0B8 */ virtual void acNpc_vt_0xB8(); + /* vt 0x0BC */ virtual void acNpc_vt_0xBC(); + /* vt 0x0C0 */ virtual int eventFlowSwitch2() { + return 0; + } + /* vt 0x0C4 */ virtual int eventFlowSwitch3() { + return 0; + } + /* vt 0x0C8 */ virtual int eventFlowSwitch4() { + return 0; + } + /* vt 0x0CC */ virtual void acNpc_vt_0xCC(); + /* vt 0x0D0 */ virtual int acNpc_vt_0xD0(); + /* vt 0x0D4 */ virtual void acNpc_vt_0xD4(); + /* vt 0x0D8 */ virtual int acNpc_vt_0xD8(); + /* vt 0x0DC */ virtual int acNpc_vt_0xDC() { + return 0; + } + /* vt 0x0E0 */ virtual int acNpc_vt_0xE0() { + return 0; + } + /* vt 0x0E4 */ virtual int acNpc_vt_0xE4() { + return 1; + } + /* vt 0x0E8 */ virtual void acNpc_vt_0xE8(); + + /* vt 0x074 */ virtual void *getObjectListEntry() override { + return &mActorListEntry; + } + + /* vt 0x0EC */ virtual int acNpc_vt_0xEC() { + return 0; + } + + /* vt 0x0F0 */ virtual bool isInState(const sStateIDIf_c &otherState) const { + return *mStateMgr.getStateID() == otherState; + } + + /* vt 0x0F4 */ virtual void setState(const sStateIDIf_c &otherState) { + // Result is discarded, but I guess in demo builds this is used + // to prevent actors from leaving the Demo state. + (void)isInState(StateID_Demo); + mStateMgr.changeState(otherState); + } + + /* vt 0xF8 */ virtual void executeState() { + mStateMgr.executeState(); + } STATE_VIRTUAL_FUNC_DECLARE(dAcNpc_c, Wait); STATE_VIRTUAL_FUNC_DECLARE(dAcNpc_c, Demo); - STATE_MGR_DECLARE(dAcNpc_c); + /* vt 0x114 */ virtual int acNpc_vt_0x114() { + return 0; + } + + /* vt 0x118 */ virtual int acNpc_vt_0x118() { + return 0; + } + /* vt 0x11C */ virtual void acNpc_vt_0x11C(); + /* vt 0x120 */ virtual void acNpc_vt_0x120() {} + /* vt 0x124 */ virtual void acNpc_vt_0x124() {} + /* vt 0x128 */ virtual int acNpc_vt_0x128() { + return 0; + } + /* vt 0x12C */ virtual int acNpc_vt_0x12C() { + return 0; + } + /* vt 0x130 */ virtual void acNpc_vt_0x130(); + /* vt 0x134 */ virtual void acNpc_vt_0x134(); + /* vt 0x138 */ virtual void acNpc_vt_0x138(); + /* vt 0x13C */ virtual void acNpc_vt_0x13C(); + /* vt 0x140 */ virtual void acNpc_vt_0x140(); + /* vt 0x144 */ virtual void acNpc_vt_0x144(); + /* vt 0x148 */ virtual void acNpc_vt_0x148(); + /* vt 0x14C */ virtual int acNpc_vt_0x14C() { + return 0; + } + /* vt 0x150 */ virtual int acNpc_vt_0x150() { + return 1; + } + /* vt 0x154 */ virtual void acNpc_vt_0x154() {} + /* vt 0x158 */ virtual void acNpc_vt_0x158() {} + /* vt 0x15C */ virtual void acNpc_vt_0x15C() {} + /* vt 0x160 */ virtual void acNpc_vt_0x160() {} + /* vt 0x164 */ virtual void acNpc_vt_0x164(); + /* vt 0x168 */ virtual int acNpc_vt_0x168() { + return 0; + } + /* vt 0x16C */ virtual void acNpc_vt_0x16C(); + /* vt 0x170 */ virtual void acNpc_vt_0x170(); + /* vt 0x174 */ virtual void acNpc_vt_0x174(); + /* vt 0x178 */ virtual void acNpc_vt_0x178(); + /* vt 0x17C */ virtual void acNpc_vt_0x17C(); + /* vt 0x180 */ virtual void acNpc_vt_0x180(); + /* vt 0x184 */ virtual void acNpc_vt_0x184(); + /* vt 0x188 */ virtual void acNpc_vt_0x188(); + /* vt 0x18C */ virtual void acNpc_vt_0x18C(); + /* vt 0x190 */ virtual void acNpc_vt_0x190(); + /* vt 0x194 */ virtual void acNpc_vt_0x194(); + /* vt 0x198 */ virtual void acNpc_vt_0x198(); + /* vt 0x19C */ virtual void acNpc_vt_0x19C(); + /* vt 0x1A0 */ virtual void acNpc_vt_0x1A0(); + /* vt 0x1A4 */ virtual void acNpc_vt_0x1A4(); + /* vt 0x1A8 */ virtual void acNpc_vt_0x1A8(); + /* vt 0x1AC */ virtual void acNpc_vt_0x1AC(); + /* vt 0x1B0 */ virtual void acNpc_vt_0x1B0(); + /* vt 0x1B4 */ virtual void acNpc_vt_0x1B4(); + /* vt 0x1B8 */ virtual void acNpc_vt_0x1B8(); + /* vt 0x1BC */ virtual void acNpc_vt_0x1BC(); + /* vt 0x1C0 */ virtual void acNpc_vt_0x1C0(); + /* vt 0x1C4 */ virtual void acNpc_vt_0x1C4(); + /* vt 0x1C8 */ virtual void acNpc_vt_0x1C8(); + /* vt 0x1CC */ virtual void acNpc_vt_0x1CC(); + /* vt 0x1D0 */ virtual void acNpc_vt_0x1D0(); + /* vt 0x1D4 */ virtual void acNpc_vt_0x1D4(); + /* vt 0x1D8 */ virtual void acNpc_vt_0x1D8(); + /* vt 0x1DC */ virtual void acNpc_vt_0x1DC(); + /* vt 0x1E0 */ virtual void acNpc_vt_0x1E0(); + /* vt 0x1E4 */ virtual void acNpc_vt_0x1E4(); + /* vt 0x1E8 */ virtual int acNpc_vt_0x1E8() { + return 1; + } + /* vt 0x1EC */ virtual int acNpc_vt_0x1EC() { + return 1; + } + /* vt 0x1F0 */ virtual void *acNpc_vt_0x1F0() { + return field_0x364; + } + /* vt 0x1F4 */ virtual int acNpc_vt_0x1F4() { + return 1; + } + /* vt 0x1F8 */ virtual bool acNpc_vt_0x1F8() { + return !acNpc_vt_0x1F4(); + } + /* vt 0x1FC */ virtual bool acNpc_vt_0x1FC() { + return field_0x684 == 1; + } + /* vt 0x200 */ virtual bool acNpc_vt_0x200() { + return !acNpc_vt_0x1FC(); + } + /* vt 0x204 */ virtual int acNpc_vt_0x204() { + return 0; + } + +protected: + void npcExecute(); + static mVec3_c getLinkPos(); + +private: + /* 0x330 */ u8 field_0x330[0x358 - 0x330]; + /* 0x358 */ fLiNdBa_c mActorListEntry; + /* 0x364 */ u8 field_0x364[0x4C0 - 0x364]; + /* 0x4C0 */ STATE_MGR_DECLARE(dAcNpc_c); + /* 0x4FC */ u8 field_0x4FC[0x684 - 0x4FC]; + /* 0x684 */ u8 field_0x684; + /* 0x685 */ u8 field_0x685[0x6E4 - 0x685]; }; #endif diff --git a/include/d/a/npc/d_a_npc_rival_lod.h b/include/d/a/npc/d_a_npc_rival_lod.h index 0a5d54e5d..93b5b92dd 100644 --- a/include/d/a/npc/d_a_npc_rival_lod.h +++ b/include/d/a/npc/d_a_npc_rival_lod.h @@ -2,16 +2,43 @@ #define D_A_NPC_RIVAL_LOD_H #include "d/a/npc/d_a_npc.h" +#include "d/d_shadow.h" +#include "m/m3d/m_anmmdl.h" #include "s/s_State.hpp" -#include "s/s_StateMgr.hpp" +#include "s/s_StateInterfaces.hpp" class dAcNpcRivalLOD_c : public dAcNpc_c { public: dAcNpcRivalLOD_c() : mStateMgr(*this, sStateID::null) {} virtual ~dAcNpcRivalLOD_c() {} + virtual bool createHeap() override; + virtual int create() override; + virtual int doDelete() override; + virtual int actorExecute() override; + virtual int draw() override; + + // weird actor - uses its own state manager, still + // overrides the virtual base state + + virtual void setState(const sStateIDIf_c &state) override { + mStateMgr.changeState(state); + } + + virtual void executeState() override { + mStateMgr.executeState(); + } + + virtual bool isInState(const sStateIDIf_c &state) const override { + return mStateMgr.isState(state); + } + + STATE_FUNC_DECLARE(dAcNpcRivalLOD_c, Wait); + private: - /* 0x??? */ STATE_MGR_DECLARE(dAcNpcRivalLOD_c); + /* 0x6E4 */ m3d::mdlAnmChr mMdl; + /* 0x74C */ dShadowCircle_c mShadow; + /* 0x754 */ STATE_MGR_DECLARE(dAcNpcRivalLOD_c); }; #endif diff --git a/include/d/a/npc/d_a_npc_saltalk.h b/include/d/a/npc/d_a_npc_saltalk.h index 86060934d..88a844b3a 100644 --- a/include/d/a/npc/d_a_npc_saltalk.h +++ b/include/d/a/npc/d_a_npc_saltalk.h @@ -1,17 +1,57 @@ #ifndef D_A_NPC_SALTALK_H #define D_A_NPC_SALTALK_H +#include "common.h" +#include "d/a/d_a_base.h" #include "d/a/npc/d_a_npc.h" +#include "d/a/npc/d_a_npc_volcano_f2_salbo.h" +#include "m/m_vec.h" #include "s/s_State.hpp" -#include "s/s_StateMgr.hpp" +#include "toBeSorted/actor_event.h" +#include "toBeSorted/area_utils.h" class dAcNpcSltk_c : public dAcNpc_c { public: - dAcNpcSltk_c() : mStateMgr(*this, sStateID::null) {} + dAcNpcSltk_c() : mEvent(*this, nullptr), mpArea(nullptr) {} virtual ~dAcNpcSltk_c() {} + virtual int create() override; + virtual int actorCreate() override; + virtual int actorPostCreate() override; + virtual int actorExecute() override; + + virtual int acNpc_vt_0xDC() override; + virtual int draw() override; + + STATE_VIRTUAL_OVERRIDE_FUNC_DECLARE(dAcNpcSltk_c, dAcNpc_c, Wait); + private: - /* 0x??? */ STATE_MGR_DECLARE(dAcNpcSltk_c); + int getParam0_0() const; + int getParam0_1() const; + + int getParam1() const; + int getParam2() const; + int getParam3() const; + int getParam4() const; + + int getSomething() const; + bool isSomething0() const; + bool isSomething1() const; + + bool checkSomething(mVec3_c pos); + + /* 0x6E4 */ dAcRef_c mRef; + /* 0x6F0 */ int mAreaIndex; + /* 0x6F4 */ AREA *mpArea; + /* 0x6F8 */ ActorEventRelated mEvent; + /* 0x748 */ int field_0x748; + /* 0x74C */ int field_0x74C; + /* 0x750 */ int field_0x750; + /* 0x754 */ int field_0x754; + /* 0x758 */ f32 field_0x758; + /* 0x75C */ f32 field_0x75C; + /* 0x760 */ mVec3_c mLinkPos; + /* 0x76C */ u8 field_0x76C; }; #endif diff --git a/include/d/a/npc/d_a_npc_volcano_f2_salbo.h b/include/d/a/npc/d_a_npc_volcano_f2_salbo.h index 4c96ac240..f01df7d9f 100644 --- a/include/d/a/npc/d_a_npc_volcano_f2_salbo.h +++ b/include/d/a/npc/d_a_npc_volcano_f2_salbo.h @@ -1,15 +1,18 @@ #ifndef D_A_NPC_VOLCANO_F2_SALBO_H #define D_A_NPC_VOLCANO_F2_SALBO_H -#include "d/a/npc/d_a_npc.h" +#include "d/a/npc/d_a_ordinary_npc.h" #include "s/s_State.hpp" -#include "s/s_StateMgr.hpp" -class dAcNpcSlb2_c : public dAcNpc_c { +class dAcNpcSlb2_c : public dAcOrdinaryNpc_c { public: dAcNpcSlb2_c() : mStateMgr(*this, sStateID::null) {} virtual ~dAcNpcSlb2_c() {} + void fn_61_58C0(int, int); + bool fn_61_6A10(); + void fn_61_68D0(int); + private: /* 0x??? */ STATE_MGR_DECLARE(dAcNpcSlb2_c); }; diff --git a/include/d/a/npc/d_a_ordinary_npc.h b/include/d/a/npc/d_a_ordinary_npc.h index 738854213..e3b7fc4c4 100644 --- a/include/d/a/npc/d_a_ordinary_npc.h +++ b/include/d/a/npc/d_a_ordinary_npc.h @@ -6,6 +6,8 @@ class dAcOrdinaryNpc_c : public dAcNpc_c { public: + /* vt 0x1F4 */ virtual int acNpc_vt_0x1F4() override; + STATE_VIRTUAL_OVERRIDE_FUNC_DECLARE(dAcOrdinaryNpc_c, dAcNpc_c, Wait); STATE_VIRTUAL_FUNC_DECLARE(dAcOrdinaryNpc_c, Pain); STATE_VIRTUAL_FUNC_DECLARE(dAcOrdinaryNpc_c, Surprised); diff --git a/include/m/m_vec.h b/include/m/m_vec.h index 2eb48793f..011679b0c 100644 --- a/include/m/m_vec.h +++ b/include/m/m_vec.h @@ -10,6 +10,7 @@ #include "rvl/MTX/vec.h" class mAng; +class mAng3_c; class mVec3_c : public EGG::Vector3f { public: @@ -213,6 +214,8 @@ class mVec3_c : public EGG::Vector3f { void normalize(); bool normalizeRS(); + static mVec3_c createProjectionXZ(const mAng3_c &ang, f32 scalar); + inline f32 mag() const { return PSVECMag(*this); } diff --git a/include/toBeSorted/area_utils.h b/include/toBeSorted/area_utils.h index d2483b9aa..a63fc6478 100644 --- a/include/toBeSorted/area_utils.h +++ b/include/toBeSorted/area_utils.h @@ -1,10 +1,19 @@ #ifndef AREA_UTILS_H #define AREA_UTILS_H +#include "m/m_angle.h" #include "m/m_vec.h" -/* 800a9b00 */ bool checkPosInArea(void **AREA, const mVec3_c &pos); -/* 800a9bd0 */ void *getAreaForIndexInRoom(s32 areaIndex, s32 roomId); -/* 800a9c50 */ bool *checkPosInArea(s32 areaIndex, s32 roomId, const mVec3_c &pos, void **AREA); +struct AREA { + /* 0x00 */ mVec3_c mPos; + /* 0x0C */ mVec3_c mScale; + /* 0x18 */ mAng mAngleY; + /* 0x1A */ mAng mAngleLink; + /* 0x1C */ u8 field_0x1C; +}; + +/* 800a9b00 */ bool checkPosInArea(AREA **area, const mVec3_c &pos); +/* 800a9bd0 */ AREA *getAreaForIndexInRoom(s32 areaIndex, s32 roomId); +/* 800a9c50 */ bool checkPosInArea(s32 areaIndex, s32 roomId, const mVec3_c &pos, AREA **area); #endif diff --git a/src/REL/d/a/npc/d_a_npc_rival_lod.cpp b/src/REL/d/a/npc/d_a_npc_rival_lod.cpp index 2fe0b142a..234683914 100644 --- a/src/REL/d/a/npc/d_a_npc_rival_lod.cpp +++ b/src/REL/d/a/npc/d_a_npc_rival_lod.cpp @@ -1,3 +1,50 @@ #include "d/a/npc/d_a_npc_rival_lod.h" +#include "d/a/obj/d_a_obj_base.h" +#include "m/m3d/m_fanm.h" +#include "s/s_State.hpp" + SPECIAL_ACTOR_PROFILE(NPC_RIVAL_LOD, dAcNpcRivalLOD_c, fProfile::NPC_RIVAL_LOD, 0x32, 0, 3); + +STATE_DEFINE(dAcNpcRivalLOD_c, Wait); + +bool dAcNpcRivalLOD_c::createHeap() { + void *oarc = getOarcFile("RivalLOD", "g3d/model.brres"); + TRY_CREATE(mMdl.create(oarc, "RivalLOD", "RivalLOD_wait", &heap_allocator, 0x120)); + return true; +} +int dAcNpcRivalLOD_c::create() { + if (!initAllocatorWork1Heap(-1, "dAcNpcRivalLOD_c::m_allocator", 0x20)) { + return FAILED; + } + 0.0f; // float order, cool + forwardAccel = -1.0f; + forwardMaxSpeed = -40.0f; + setState(StateID_Wait); + boundingBox.Set(mVec3_c(-110.0f, -30.0f, -130.0f), mVec3_c(130.0f, 190.0f, 110.0f)); + return SUCCEEDED; +} + +int dAcNpcRivalLOD_c::doDelete() { + return SUCCEEDED; +} + +int dAcNpcRivalLOD_c::actorExecute() { + executeState(); + updateMatrix(); + mMdl.getModel().setLocalMtx(mWorldMtx); + return SUCCEEDED; +} + +int dAcNpcRivalLOD_c::draw() { + drawModelType1(&mMdl.getModel()); + return SUCCEEDED; +} + +void dAcNpcRivalLOD_c::initializeState_Wait() { + mMdl.setAnm("RivalLOD_wait", m3d::PLAY_MODE_4, 4.0f); +} +void dAcNpcRivalLOD_c::executeState_Wait() { + mMdl.play(); +} +void dAcNpcRivalLOD_c::finalizeState_Wait() {} diff --git a/src/REL/d/a/npc/d_a_npc_saltalk.cpp b/src/REL/d/a/npc/d_a_npc_saltalk.cpp index f7180b30c..933993757 100644 --- a/src/REL/d/a/npc/d_a_npc_saltalk.cpp +++ b/src/REL/d/a/npc/d_a_npc_saltalk.cpp @@ -1,3 +1,194 @@ #include "d/a/npc/d_a_npc_saltalk.h" +#include "common.h" +#include "d/a/d_a_base.h" +#include "d/a/d_a_player.h" +#include "f/f_base.h" +#include "f/f_manager.h" +#include "f/f_profile_name.h" +#include "m/m_angle.h" +#include "m/m_vec.h" +#include "s/s_State.hpp" +#include "toBeSorted/area_utils.h" +#include "toBeSorted/event_manager.h" + SPECIAL_ACTOR_PROFILE(NPC_SLTK, dAcNpcSltk_c, fProfile::NPC_SLTK, 0x63, 0, 0); + +STATE_VIRTUAL_DEFINE(dAcNpcSltk_c, Wait); + +#pragma explicit_zero_data on +int rot0 = 0; +int rot1 = 0; +int rot2 = 0; +#pragma explicit_zero_data off + +int dAcNpcSltk_c::create() { + return dAcBase_c::create(); +} + +int dAcNpcSltk_c::actorCreate() { + field_0x748 = getParam4(); + if (isSomething0()) { + field_0x754 = getParam0_0(); + field_0x74C = 0xFF; + field_0x750 = 0xFF; + } else if (isSomething1()) { + field_0x754 = 0xFF; + field_0x74C = getParam0_1(); + field_0x750 = getParam1(); + } else { + field_0x754 = 0xFF; + field_0x74C = 0xFF; + field_0x750 = 0xFF; + } + + mAreaIndex = rotation.z & 0xFF; + if (mAreaIndex < 0xFF) { + mpArea = getAreaForIndexInRoom(mAreaIndex, roomid); + if (mpArea == nullptr) { + return FAILED; + } + } + + rotation.x = rot0; + rotation.y = rot1; + rotation.z = rot2; + + field_0x758 = getParam2() * 100; + field_0x75C = getParam3() * 100; + + setState(StateID_Wait); + + field_0x76C = 0; + + boundingBox.Set(mVec3_c(-0.0f, -0.0f, -0.0f), mVec3_c(0.0f, 0.0f, 0.0f)); + + return SUCCEEDED; +} + +int dAcNpcSltk_c::actorPostCreate() { + mLinkPos = getLinkPos(); + mRef.unlink(); + + f32 closestDistance = FLOAT_MAX; + + dAcNpcSlb2_c *cursor = nullptr; + dAcNpcSlb2_c *closest = nullptr; + do { + cursor = static_cast(fManager_c::searchBaseByProfName(fProfile::NPC_SLB2, cursor)); + if (cursor != nullptr) { + if (cursor->acNpc_vt_0x1F4()) { + f32 thisDist = cursor->getSquareDistanceTo(position); + if (thisDist < closestDistance) { + closest = cursor; + closestDistance = cursor->getSquareDistanceTo(position); + } + } + } + } while (cursor != nullptr); + + if (closest != nullptr) { + mRef.link(closest); + } + return SUCCEEDED; +} + +int dAcNpcSltk_c::actorExecute() { + npcExecute(); + return SUCCEEDED; +} + +int dAcNpcSltk_c::acNpc_vt_0xDC() { + return 0; +} + +int dAcNpcSltk_c::draw() { + return SUCCEEDED; +} + +int dAcNpcSltk_c::getParam0_0() const { + return params & 0xFF; +} +int dAcNpcSltk_c::getParam0_1() const { + return params & 0xFF; +} + +int dAcNpcSltk_c::getParam1() const { + return (params >> 8) & 0xFF; +} +int dAcNpcSltk_c::getParam2() const { + return (params >> 16) & 0xFF; +} +int dAcNpcSltk_c::getParam3() const { + return (params >> 24) & 0xFF; +} +int dAcNpcSltk_c::getParam4() const { + return getParams2Lower() & 0xF; +} + +int dAcNpcSltk_c::getSomething() const { + return field_0x748; +} +bool dAcNpcSltk_c::isSomething0() const { + return getSomething() == 0; +} +bool dAcNpcSltk_c::isSomething1() const { + return getSomething() == 1; +} + +bool dAcNpcSltk_c::checkSomething(mVec3_c pos) { + if (mAreaIndex != 0xFF) { + return checkPosInArea(mAreaIndex, roomid, pos, &mpArea) == 1; + } else { + mVec3_c dist = pos - position; + if (dist.squareMagXZ() <= field_0x758 * field_0x758) { + // TODO reload from position.y here + f32 fDist = field_0x75C + position.y; + f32 fDist2 = position.y; + if (fDist <= position.y) { + fDist2 = fDist; + fDist = position.y; + } + return pos.y <= fDist && pos.y >= fDist2; + } else { + return false; + } + } +} + +void dAcNpcSltk_c::initializeState_Wait() {} +void dAcNpcSltk_c::executeState_Wait() { + bool checkResult = false; + // Regswap this, link + dAcPy_c *link = dAcPy_c::LINK; + dAcNpcSlb2_c *slb = mRef.get(); + if (slb != nullptr) { + if (isSomething0()) { + checkResult = checkSomething(position); + if (field_0x76C != 0) { + field_0x76C = checkResult; + } else if (!EventManager::isInEvent() && !slb->fn_61_6A10() && checkResult) { + mAng3_c ang = mAng3_c(0, mpArea->mAngleY, 0); + mVec3_c proj = mVec3_c::createProjectionXZ(ang, 1.0f); + mVec3_c dist = mLinkPos - mpArea->mPos; + dist.y = 0.0f; + dist.normalize(); + slb->fn_61_68D0(field_0x754); + field_0x76C = 1; + } + + if (!checkResult) { + if (!link->checkActionFlags(0xC70852) || link->checkActionFlags(0x40000)) { + mLinkPos = link->position; + } + } + } else if (isSomething1()) { + checkResult = checkSomething(slb->position); + if (field_0x76C == 0 && checkResult) { + slb->fn_61_58C0(field_0x74C, field_0x750); + } + } + field_0x76C = checkResult; + } +} +void dAcNpcSltk_c::finalizeState_Wait() {} diff --git a/src/d/a/d_a_base.cpp b/src/d/a/d_a_base.cpp index a5b0492f0..b60fbedb7 100644 --- a/src/d/a/d_a_base.cpp +++ b/src/d/a/d_a_base.cpp @@ -277,7 +277,7 @@ u32 dAcBase_c::buildParams2(u32 lower, u32 upper) { } // 8002d010 -u32 dAcBase_c::getParams2Lower() { +u32 dAcBase_c::getParams2Lower() const { return params2 & 0xFFFF; } diff --git a/src/d/a/npc/d_a_npc.cpp b/src/d/a/npc/d_a_npc.cpp index 33bab9645..03b506ac9 100644 --- a/src/d/a/npc/d_a_npc.cpp +++ b/src/d/a/npc/d_a_npc.cpp @@ -1,4 +1,5 @@ #include "d/a/npc/d_a_npc.h" + #include "s/s_StateID.hpp" fLiMgBa_c NPC_ACTOR_LIST; @@ -22,5 +23,4 @@ extern nw4r::ut::Color sColors[] = { nw4r::ut::Color(0, 0, 0, 0), }; - -dAcNpc_c::dAcNpc_c() : mStateMgr(*this, sStateID::null) {} +dAcNpc_c::dAcNpc_c() : mStateMgr(*this, sStateID::null), mActorListEntry(this) {} From 4a75c5cbe6468a824fa8d0a9d0b2f9e12150377a Mon Sep 17 00:00:00 2001 From: robojumper Date: Wed, 13 Nov 2024 21:58:52 +0100 Subject: [PATCH 4/9] Some symbols --- config/SOUE01/symbols.txt | 42 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index a7786a0e1..0bdd28446 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -1227,12 +1227,12 @@ npcExecute__8dAcNpc_cFv = .text:0x80032480; // type:function size:0x390 fn_80032810 = .text:0x80032810; // type:function size:0x8 fn_80032820 = .text:0x80032820; // type:function size:0x8 fn_80032830 = .text:0x80032830; // type:function size:0x10 -fn_80032840 = .text:0x80032840; // type:function size:0x10 +executeState__76sStateMgr_c<8dAcNpc_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x80032840; // type:function size:0x10 fn_80032850 = .text:0x80032850; // type:function size:0x64 fn_800328C0 = .text:0x800328C0; // type:function size:0x58 -fn_80032920 = .text:0x80032920; // type:function size:0x10 +getStateID__76sStateMgr_c<8dAcNpc_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x80032920; // type:function size:0x10 getStateID__14sStateMethod_cCFv = .text:0x80032930; // type:function size:0x8 -fn_80032940 = .text:0x80032940; // type:function size:0x10 +changeState__76sStateMgr_c<8dAcNpc_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x80032940; // type:function size:0x10 fn_80032950 = .text:0x80032950; // type:function size:0x8 fn_80032960 = .text:0x80032960; // type:function size:0x94 fn_80032A00 = .text:0x80032A00; // type:function size:0x44 @@ -1262,10 +1262,10 @@ __dt__24dAcRef_c<12dAcObjBase_c>Fv = .text:0x80033C10; // type:function size:0x5 ActorNpcEventFlowManager__dtor = .text:0x80033C70; // type:function size:0x74 fn_80033CF0 = .text:0x80033CF0; // type:function size:0x5C fn_80033D50 = .text:0x80033D50; // type:function size:0x9C -fn_80033DF0 = .text:0x80033DF0; // type:function size:0x58 -fn_80033E50 = .text:0x80033E50; // type:function size:0x6C -fn_80033EC0 = .text:0x80033EC0; // type:function size:0xA0 -fn_80033F60 = .text:0x80033F60; // type:function size:0xA4 +__dt__20sFState_c<8dAcNpc_c>Fv = .text:0x80033DF0; // type:function size:0x58 +__dt__23sFStateFct_c<8dAcNpc_c>Fv = .text:0x80033E50; // type:function size:0x6C +__dt__76sStateMgr_c<8dAcNpc_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x80033EC0; // type:function size:0xA0 +__dt__46sFStateMgr_c<8dAcNpc_c,20sStateMethodUsr_FI_c>Fv = .text:0x80033F60; // type:function size:0xA4 ActorNpcBase__ctor2 = .text:0x80034010; // type:function size:0x27C ActorNpcBase__addToNpcList = .text:0x80034290; // type:function size:0x50 fn_800342E0 = .text:0x800342E0; // type:function size:0x34 @@ -1615,24 +1615,24 @@ fn_8003ECD0 = .text:0x8003ECD0; // type:function size:0x40 fn_8003ED10 = .text:0x8003ED10; // type:function size:0x40 fn_8003ED50 = .text:0x8003ED50; // type:function size:0x40 fn_8003ED90 = .text:0x8003ED90; // type:function size:0x84 -setAsCurrentState = .text:0x8003EE20; // type:function size:0x60 -fn_8003EE80 = .text:0x8003EE80; // type:function size:0xC -fn_8003EE90 = .text:0x8003EE90; // type:function size:0x1C -callsInStateFunc = .text:0x8003EEB0; // type:function size:0x1C -fn_8003EED0 = .text:0x8003EED0; // type:function size:0x1C +build__23sFStateFct_c<8dAcNpc_c>FRC12sStateIDIf_c = .text:0x8003EE20; // type:function size:0x60 +dispose__23sFStateFct_c<8dAcNpc_c>FRP10sStateIf_c = .text:0x8003EE80; // type:function size:0xC +initialize__20sFState_c<8dAcNpc_c>Fv = .text:0x8003EE90; // type:function size:0x1C +execute__20sFState_c<8dAcNpc_c>Fv = .text:0x8003EEB0; // type:function size:0x1C +finalize__20sFState_c<8dAcNpc_c>Fv = .text:0x8003EED0; // type:function size:0x1C refreshStateMethod__14sStateMethod_cFv = .text:0x8003EEF0; // type:function size:0xC getState__14sStateMethod_cCFv = .text:0x8003EF00; // type:function size:0x8 getNewStateID__14sStateMethod_cCFv = .text:0x8003EF10; // type:function size:0x8 getOldStateID__14sStateMethod_cCFv = .text:0x8003EF20; // type:function size:0x8 -fn_8003EF30 = .text:0x8003EF30; // type:function size:0x10 -fn_8003EF40 = .text:0x8003EF40; // type:function size:0x10 -fn_8003EF50 = .text:0x8003EF50; // type:function size:0x10 -fn_8003EF60 = .text:0x8003EF60; // type:function size:0x10 -fn_8003EF70 = .text:0x8003EF70; // type:function size:0x10 -fn_8003EF80 = .text:0x8003EF80; // type:function size:0x10 -ActorState__callLeave = .text:0x8003EF90; // type:function size:0x30 -ActorState__callUpdate = .text:0x8003EFC0; // type:function size:0x30 -ActorState__callEnter = .text:0x8003EFF0; // type:function size:0x30 +initializeState__76sStateMgr_c<8dAcNpc_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x8003EF30; // type:function size:0x10 +finalizeState__76sStateMgr_c<8dAcNpc_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x8003EF40; // type:function size:0x10 +refreshState__76sStateMgr_c<8dAcNpc_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x8003EF50; // type:function size:0x10 +getState__76sStateMgr_c<8dAcNpc_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x8003EF60; // type:function size:0x10 +getNewStateID__76sStateMgr_c<8dAcNpc_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x8003EF70; // type:function size:0x10 +getOldStateID__76sStateMgr_c<8dAcNpc_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x8003EF80; // type:function size:0x10 +finalizeState__22sFStateID_c<8dAcNpc_c>CFR8dAcNpc_c = .text:0x8003EF90; // type:function size:0x30 +executeState__22sFStateID_c<8dAcNpc_c>CFR8dAcNpc_c = .text:0x8003EFC0; // type:function size:0x30 +initializeState__22sFStateID_c<8dAcNpc_c>CFR8dAcNpc_c = .text:0x8003EFF0; // type:function size:0x30 fn_8003F020 = .text:0x8003F020; // type:function size:0x40 fn_8003F060 = .text:0x8003F060; // type:function size:0x40 fn_8003F0A0 = .text:0x8003F0A0; // type:function size:0x40 From 3a180399d04ba39f006122a60bb5f1a1ae100e74 Mon Sep 17 00:00:00 2001 From: robojumper Date: Wed, 13 Nov 2024 22:35:05 +0100 Subject: [PATCH 5/9] Equivalence fix --- src/REL/d/a/npc/d_a_npc_saltalk.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/REL/d/a/npc/d_a_npc_saltalk.cpp b/src/REL/d/a/npc/d_a_npc_saltalk.cpp index 933993757..11d55d47c 100644 --- a/src/REL/d/a/npc/d_a_npc_saltalk.cpp +++ b/src/REL/d/a/npc/d_a_npc_saltalk.cpp @@ -164,7 +164,7 @@ void dAcNpcSltk_c::executeState_Wait() { dAcNpcSlb2_c *slb = mRef.get(); if (slb != nullptr) { if (isSomething0()) { - checkResult = checkSomething(position); + checkResult = checkSomething(link->position); if (field_0x76C != 0) { field_0x76C = checkResult; } else if (!EventManager::isInEvent() && !slb->fn_61_6A10() && checkResult) { From b32d1e2ba159e216ca286c6d3ecc09bedab10c65 Mon Sep 17 00:00:00 2001 From: robojumper Date: Thu, 14 Nov 2024 10:29:44 +0100 Subject: [PATCH 6/9] More splits --- config/SOUE01/splits.txt | 9 +++++++++ config/SOUE01/symbols.txt | 26 +++++++++++++++----------- src/d/a/npc/d_a_npc.cpp | 7 ++++++- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index d06d4ab2c..1f4b5e834 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -48,10 +48,15 @@ d/a/e/d_a_e_base.cpp: d/a/npc/d_a_npc.cpp: .text start:0x80030CB0 end:0x8003F718 .ctors start:0x804DB668 end:0x804DB66C + .data start:0x805016E0 end:0x80502050 + .sbss start:0x805750A0 end:0x805750A8 + .bss start:0x80597030 end:0x805972E0 d/a/npc/d_a_ordinary_npc.cpp: .text start:0x800462D0 end:0x8004D810 .ctors start:0x804DB66C end:0x804DB670 + .data start:0x80502528 end:0x80502C08 + .bss start:0x805972E0 end:0x80597520 d/d_ac_npc_kyui.cpp: .text start:0x8004D810 end:0x80050800 @@ -581,6 +586,10 @@ d/a/d_a_insect.cpp: .data start:0x8052ABD8 end:0x8052ACC0 .sdata2 start:0x8057ADD8 end:0x8057AE30 +d/tg/d_t_weather.cpp: + .text start:0x801A65D0 end:0x801AF7D8 + .ctors start:0x804DB804 end:0x804DB808 + d/d_cs_base.cpp: .text start:0x801BC6C0 end:0x801BD250 .data start:0x8052E860 end:0x8052E968 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 0bdd28446..edf9279e6 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -29943,7 +29943,7 @@ lbl_80501A04 = .data:0x80501A04; // type:object size:0xC __vt__8dAcNpc_c = .data:0x80501A10; // type:object size:0x208 __vt__46sFStateMgr_c<8dAcNpc_c,20sStateMethodUsr_FI_c> = .data:0x80501C18; // type:object size:0x30 __vt__76sStateMgr_c<8dAcNpc_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x80501C48; // type:object size:0x30 -__vt__23sFStateFct_c<8dAcNpc_c> = .data:0x80501C78; // type:object size:0x18 +__vt__23sFStateFct_c<8dAcNpc_c> = .data:0x80501C78; // type:object size:0x14 __vt__20sFState_c<8dAcNpc_c> = .data:0x80501C90; // type:object size:0x18 ActorNpcEventFlowManager__vtable = .data:0x80501CA8; // type:object size:0x44 lbl_80501CEC = .data:0x80501CEC; // type:object size:0xC @@ -29962,7 +29962,8 @@ lbl_80501E48 = .data:0x80501E48; // type:object size:0xA4 lbl_80501EEC = .data:0x80501EEC; // type:object size:0x24 lbl_80501F10 = .data:0x80501F10; // type:object size:0x40 lbl_80501F50 = .data:0x80501F50; // type:object size:0x98 -lbl_80501FE8 = .data:0x80501FE8; // type:object size:0x68 +__vt__29sFStateVirtualID_c<8dAcNpc_c> = .data:0x80501FE8; // type:object size:0x34 +__vt__22sFStateID_c<8dAcNpc_c> = .data:0x8050201C; // type:object size:0x34 lbl_80502050 = .data:0x80502050; // type:object size:0x24 lbl_80502074 = .data:0x80502074; // type:object size:0x24 lbl_80502098 = .data:0x80502098; // type:object size:0x28 @@ -48218,18 +48219,21 @@ lbl_80596FF8 = .bss:0x80596FF8; // type:object size:0x18 data:2byte lbl_80597010 = .bss:0x80597010; // type:object size:0x10 data:2byte lbl_80597020 = .bss:0x80597020; // type:object size:0x10 data:float lbl_80597030 = .bss:0x80597030; // type:object size:0xC -StateID_Wait__8dAcNpc_c = .bss:0x8059703C; // type:object size:0x40 data:4byte -StateID_Demo__8dAcNpc_c = .bss:0x8059707C; // type:object size:0x64 data:4byte +StateID_Wait__8dAcNpc_c = .bss:0x8059703C; // type:object size:0x34 data:4byte +StateID_Demo__8dAcNpc_c = .bss:0x8059707C; // type:object size:0x34 data:4byte lbl_805970E0 = .bss:0x805970E0; // type:object size:0x80 data:byte lbl_80597160 = .bss:0x80597160; // type:object size:0x80 data:byte lbl_805971E0 = .bss:0x805971E0; // type:object size:0x100 data:byte -lbl_805972E0 = .bss:0x805972E0; // type:object size:0xC -AcOrdinaryNpc__STATE_WAIT = .bss:0x805972EC; // type:object size:0xC0 data:4byte -AcOrdinaryNpc__STATE_WITHSTAND = .bss:0x805973AC; // type:object size:0x40 data:4byte -AcOrdinaryNpc__STATE_WALK = .bss:0x805973EC; // type:object size:0x40 data:4byte -AcOrdinaryNpc__STATE_LOOK_AWAY_ST = .bss:0x8059742C; // type:object size:0x40 data:4byte -AcOrdinaryNpc__STATE_LOOK_AWAY = .bss:0x8059746C; // type:object size:0x84 data:4byte -AcOrdinaryNpc__STATE_PRE_WALK = .bss:0x805974F0; // type:object size:0x30 data:4byte +lbl_805972E0 = .bss:0x805972E0; // type:object size:0xC scope:local +StateID_Wait__16dAcOrdinaryNpc_c = .bss:0x805972EC; // type:object size:0x34 data:4byte +StateID_Pain__16dAcOrdinaryNpc_c = .bss:0x8059732C; // type:object size:0x34 +StateID_Surprised__16dAcOrdinaryNpc_c = .bss:0x8059736C; // type:object size:0x34 +StateID_Withstand__16dAcOrdinaryNpc_c = .bss:0x805973AC; // type:object size:0x34 data:4byte +StateID_Walk__16dAcOrdinaryNpc_c = .bss:0x805973EC; // type:object size:0x34 data:4byte +StateID_LookAwaySt__16dAcOrdinaryNpc_c = .bss:0x8059742C; // type:object size:0x34 data:4byte +StateID_LookAway__16dAcOrdinaryNpc_c = .bss:0x8059746C; // type:object size:0x34 data:4byte +StateID_Turn__16dAcOrdinaryNpc_c = .bss:0x805974AC; // type:object size:0x34 data:4byte +StateID_PreWalkTurn__16dAcOrdinaryNpc_c = .bss:0x805974F0; // type:object size:0x30 data:4byte lbl_80597520 = .bss:0x80597520; // type:object size:0xC AcNpcKyuiBase__STATE_WAIT = .bss:0x8059752C; // type:object size:0x74 data:4byte lbl_805975A0 = .bss:0x805975A0; // type:object size:0x10 data:float diff --git a/src/d/a/npc/d_a_npc.cpp b/src/d/a/npc/d_a_npc.cpp index 03b506ac9..aea7745b2 100644 --- a/src/d/a/npc/d_a_npc.cpp +++ b/src/d/a/npc/d_a_npc.cpp @@ -1,6 +1,7 @@ #include "d/a/npc/d_a_npc.h" #include "s/s_StateID.hpp" +#include "sized_string.h" fLiMgBa_c NPC_ACTOR_LIST; @@ -20,7 +21,11 @@ extern nw4r::ut::Color sColors[] = { nw4r::ut::Color(0x50, 0x46, 0x32, 0), nw4r::ut::Color(0xD8, 0xC5, 0x8D, 0), nw4r::ut::Color(0x96, 0x69, 0x3C, 0), - nw4r::ut::Color(0, 0, 0, 0), }; +SizedString<128> sNpcStr1; +SizedString<128> sNpcStr2; +SizedString<128> sNpcStr3; +SizedString<128> sNpcStr4; + dAcNpc_c::dAcNpc_c() : mStateMgr(*this, sStateID::null), mActorListEntry(this) {} From 0f17d7c40ec92db19190de3c61fead7c6338dc83 Mon Sep 17 00:00:00 2001 From: elijah-thomas774 Date: Thu, 14 Nov 2024 22:38:56 -0500 Subject: [PATCH 7/9] d_a_npc sinit :) --- include/d/a/npc/d_a_npc.h | 2 ++ src/d/a/npc/d_a_npc.cpp | 28 ++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/include/d/a/npc/d_a_npc.h b/include/d/a/npc/d_a_npc.h index 6fc590a85..b0785692e 100644 --- a/include/d/a/npc/d_a_npc.h +++ b/include/d/a/npc/d_a_npc.h @@ -197,6 +197,8 @@ class dAcNpc_c : public dAcObjBase_c { /* 0x4FC */ u8 field_0x4FC[0x684 - 0x4FC]; /* 0x684 */ u8 field_0x684; /* 0x685 */ u8 field_0x685[0x6E4 - 0x685]; + + static fLiMgBa_c NPC_ACTOR_LIST; }; #endif diff --git a/src/d/a/npc/d_a_npc.cpp b/src/d/a/npc/d_a_npc.cpp index aea7745b2..fa18bc458 100644 --- a/src/d/a/npc/d_a_npc.cpp +++ b/src/d/a/npc/d_a_npc.cpp @@ -1,26 +1,34 @@ #include "d/a/npc/d_a_npc.h" +#include "f/f_list_mg.h" +#include "nw4r/ut/ut_Color.h" #include "s/s_StateID.hpp" #include "sized_string.h" -fLiMgBa_c NPC_ACTOR_LIST; +fLiMgBa_c dAcNpc_c::NPC_ACTOR_LIST; STATE_VIRTUAL_DEFINE(dAcNpc_c, Wait); STATE_VIRTUAL_DEFINE(dAcNpc_c, Demo); -extern nw4r::ut::Color sColors[] = { +static const nw4r::ut::Color sColors0[] = { nw4r::ut::Color(0xEF, 0x30, 0x27, 0xFF), - nw4r::ut::Color(0, 0, 0, 0xFF), - nw4r::ut::Color(0xEF, 0x30, 0x27, 0), - nw4r::ut::Color(0xFF, 0xFF, 0xFF, 0), + nw4r::ut::Color(0x00, 0x00, 0x00, 0xFF), + nw4r::ut::Color(0xEF, 0x30, 0x27, 0x00), +}; +static const nw4r::ut::Color sColors1[] = { + nw4r::ut::Color(0xFF, 0xFF, 0xFF, 0x00), nw4r::ut::Color(0xFE, 0xF8, 0x9D, 0xFF), nw4r::ut::Color(0x88, 0x63, 0x36, 0x80), +}; +static const nw4r::ut::Color sColors2[] = { nw4r::ut::Color(0x4F, 0x46, 0x33, 0xFF), nw4r::ut::Color(0xD8, 0xC5, 0x8D, 0xFF), nw4r::ut::Color(0x95, 0x69, 0x3B, 0xFF), - nw4r::ut::Color(0x50, 0x46, 0x32, 0), - nw4r::ut::Color(0xD8, 0xC5, 0x8D, 0), - nw4r::ut::Color(0x96, 0x69, 0x3C, 0), +}; +static const nw4r::ut::Color sColors3[] = { + nw4r::ut::Color(0x50, 0x46, 0x32, 0x00), + nw4r::ut::Color(0xD8, 0xC5, 0x8D, 0x00), + nw4r::ut::Color(0x96, 0x69, 0x3C, 0x00), }; SizedString<128> sNpcStr1; @@ -29,3 +37,7 @@ SizedString<128> sNpcStr3; SizedString<128> sNpcStr4; dAcNpc_c::dAcNpc_c() : mStateMgr(*this, sStateID::null), mActorListEntry(this) {} + +dAcNpc_c::~dAcNpc_c() { + // TODO +} From fea7ebb5c8ef576bd7bee495f7f3aa61f0d10a82 Mon Sep 17 00:00:00 2001 From: elijah-thomas774 Date: Thu, 14 Nov 2024 22:41:18 -0500 Subject: [PATCH 8/9] fix dAcNpcSltk_c::executeState_Wait regswap --- include/d/a/d_a_player.h | 3 +++ src/REL/d/a/npc/d_a_npc_saltalk.cpp | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/d/a/d_a_player.h b/include/d/a/d_a_player.h index 22036a63b..a82fb862b 100644 --- a/include/d/a/d_a_player.h +++ b/include/d/a/d_a_player.h @@ -253,5 +253,8 @@ class dAcPy_c : public dAcObjBase_c { return (mActionFlagsCont & mask) != 0; } + static const dAcPy_c *GetLink() { + return LINK; + } static dAcPy_c *LINK; }; diff --git a/src/REL/d/a/npc/d_a_npc_saltalk.cpp b/src/REL/d/a/npc/d_a_npc_saltalk.cpp index 11d55d47c..9fe2be03a 100644 --- a/src/REL/d/a/npc/d_a_npc_saltalk.cpp +++ b/src/REL/d/a/npc/d_a_npc_saltalk.cpp @@ -159,8 +159,9 @@ bool dAcNpcSltk_c::checkSomething(mVec3_c pos) { void dAcNpcSltk_c::initializeState_Wait() {} void dAcNpcSltk_c::executeState_Wait() { bool checkResult = false; - // Regswap this, link - dAcPy_c *link = dAcPy_c::LINK; + + const dAcPy_c *link = dAcPy_c::GetLink(); + dAcNpcSlb2_c *slb = mRef.get(); if (slb != nullptr) { if (isSomething0()) { From 5c4755eac2aa5a5ea49559b459292557732f7b7d Mon Sep 17 00:00:00 2001 From: elijah-thomas774 Date: Thu, 14 Nov 2024 22:49:24 -0500 Subject: [PATCH 9/9] d_a_npc_saltalk OK --- config/SOUE01/rels/d_a_npc_saltalkNP/symbols.txt | 2 +- config/SOUE01/symbols.txt | 2 +- configure.py | 2 +- include/d/a/npc/d_a_npc_saltalk.h | 2 +- include/toBeSorted/area_utils.h | 2 +- src/REL/d/a/npc/d_a_npc_saltalk.cpp | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config/SOUE01/rels/d_a_npc_saltalkNP/symbols.txt b/config/SOUE01/rels/d_a_npc_saltalkNP/symbols.txt index 7b657e016..db82b7248 100644 --- a/config/SOUE01/rels/d_a_npc_saltalkNP/symbols.txt +++ b/config/SOUE01/rels/d_a_npc_saltalkNP/symbols.txt @@ -21,7 +21,7 @@ getParam4__12dAcNpcSltk_cCFv = .text:0x000005E0; // type:function size:0x24 getSomething__12dAcNpcSltk_cCFv = .text:0x00000610; // type:function size:0x8 isSomething0__12dAcNpcSltk_cCFv = .text:0x00000620; // type:function size:0x28 isSomething1__12dAcNpcSltk_cCFv = .text:0x00000650; // type:function size:0x2C -checkSomething__12dAcNpcSltk_cF7mVec3_c = .text:0x00000680; // type:function size:0xF0 +checkSomething__12dAcNpcSltk_cCF7mVec3_c = .text:0x00000680; // type:function size:0xF0 initializeState_Wait__12dAcNpcSltk_cFv = .text:0x00000770; // type:function size:0x4 executeState_Wait__12dAcNpcSltk_cFv = .text:0x00000780; // type:function size:0x1FC finalizeState_Wait__12dAcNpcSltk_cFv = .text:0x00000980; // type:function size:0x4 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index edf9279e6..4937a1bde 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -3723,7 +3723,7 @@ fn_800A99D0 = .text:0x800A99D0; // type:function size:0xE0 ActorOnRail2__setSegment = .text:0x800A9AB0; // type:function size:0x50 checkPosInAREA = .text:0x800A9B00; // type:function size:0xC4 getAreaForIndexInRoom__Fll = .text:0x800A9BD0; // type:function size:0x78 -checkPosInArea__FllRC7mVec3_cPP4AREA = .text:0x800A9C50; // type:function size:0xD4 +checkPosInArea__FllRC7mVec3_cPCP4AREA = .text:0x800A9C50; // type:function size:0xD4 detach__Q23d2d10ResAccIf_cFv = .text:0x800A9D30; // type:function size:0x60 attach__Q23d2d10ResAccIf_cFPvPCc = .text:0x800A9D90; // type:function size:0x90 BuildPaneObj__Q23d2d8Layout_cFlPCvRCQ34nw4r3lyt11ResBlockSet = .text:0x800A9E20; // type:function size:0x12C diff --git a/configure.py b/configure.py index 0d0a90696..44854e5d9 100644 --- a/configure.py +++ b/configure.py @@ -1176,7 +1176,7 @@ def nw4rLib(lib_name, objects, extra_cflags=[]): "REL/d/a/npc/d_a_npc_salbage_robot_repair.cpp", ), Rel(NonMatching, "d_a_npc_salesman_s", "REL/d/a/npc/d_a_npc_salesman_s.cpp"), - Rel(NonMatching, "d_a_npc_saltalk", "REL/d/a/npc/d_a_npc_saltalk.cpp"), + Rel(Matching, "d_a_npc_saltalk", "REL/d/a/npc/d_a_npc_saltalk.cpp"), Rel( NonMatching, "d_a_npc_senpaia_mother", "REL/d/a/npc/d_a_npc_senpaia_mother.cpp" ), diff --git a/include/d/a/npc/d_a_npc_saltalk.h b/include/d/a/npc/d_a_npc_saltalk.h index 88a844b3a..7bda6e0fb 100644 --- a/include/d/a/npc/d_a_npc_saltalk.h +++ b/include/d/a/npc/d_a_npc_saltalk.h @@ -38,7 +38,7 @@ class dAcNpcSltk_c : public dAcNpc_c { bool isSomething0() const; bool isSomething1() const; - bool checkSomething(mVec3_c pos); + bool checkSomething(mVec3_c pos) const; /* 0x6E4 */ dAcRef_c mRef; /* 0x6F0 */ int mAreaIndex; diff --git a/include/toBeSorted/area_utils.h b/include/toBeSorted/area_utils.h index a63fc6478..d73cb218b 100644 --- a/include/toBeSorted/area_utils.h +++ b/include/toBeSorted/area_utils.h @@ -14,6 +14,6 @@ struct AREA { /* 800a9b00 */ bool checkPosInArea(AREA **area, const mVec3_c &pos); /* 800a9bd0 */ AREA *getAreaForIndexInRoom(s32 areaIndex, s32 roomId); -/* 800a9c50 */ bool checkPosInArea(s32 areaIndex, s32 roomId, const mVec3_c &pos, AREA **area); +/* 800a9c50 */ bool checkPosInArea(s32 areaIndex, s32 roomId, const mVec3_c &pos, AREA *const *area); #endif diff --git a/src/REL/d/a/npc/d_a_npc_saltalk.cpp b/src/REL/d/a/npc/d_a_npc_saltalk.cpp index 9fe2be03a..1c15362a6 100644 --- a/src/REL/d/a/npc/d_a_npc_saltalk.cpp +++ b/src/REL/d/a/npc/d_a_npc_saltalk.cpp @@ -136,7 +136,7 @@ bool dAcNpcSltk_c::isSomething1() const { return getSomething() == 1; } -bool dAcNpcSltk_c::checkSomething(mVec3_c pos) { +bool dAcNpcSltk_c::checkSomething(mVec3_c pos) const { if (mAreaIndex != 0xFF) { return checkPosInArea(mAreaIndex, roomid, pos, &mpArea) == 1; } else { @@ -145,7 +145,7 @@ bool dAcNpcSltk_c::checkSomething(mVec3_c pos) { // TODO reload from position.y here f32 fDist = field_0x75C + position.y; f32 fDist2 = position.y; - if (fDist <= position.y) { + if (fDist <= fDist2) { fDist2 = fDist; fDist = position.y; }