From b83c0d5fd2e5edfba64f02786451c6bbbe2b2d8a Mon Sep 17 00:00:00 2001 From: robojumper Date: Sun, 6 Oct 2024 21:39:55 +0200 Subject: [PATCH] d_a_obj_pumpkin_leaf OK (#58) --- .../rels/d_a_obj_pumpkin_leafNP/splits.txt | 3 + .../rels/d_a_obj_pumpkin_leafNP/symbols.txt | 96 +++++++++---------- configure.py | 2 +- include/d/a/d_a_base.h | 4 + include/d/a/obj/d_a_obj_pumpkin_leaf.h | 31 ++++++ src/REL/d/a/obj/d_a_obj_pumpkin_leaf.cpp | 47 +++++++++ 6 files changed, 134 insertions(+), 49 deletions(-) create mode 100644 include/d/a/obj/d_a_obj_pumpkin_leaf.h diff --git a/config/SOUE01/rels/d_a_obj_pumpkin_leafNP/splits.txt b/config/SOUE01/rels/d_a_obj_pumpkin_leafNP/splits.txt index c8272b1b..38ce8a8f 100644 --- a/config/SOUE01/rels/d_a_obj_pumpkin_leafNP/splits.txt +++ b/config/SOUE01/rels/d_a_obj_pumpkin_leafNP/splits.txt @@ -17,3 +17,6 @@ REL/global_destructor_chain.c: REL/d/a/obj/d_a_obj_pumpkin_leaf.cpp: .text start:0x000000F0 end:0x00000AC8 .ctors start:0x00000000 end:0x00000004 + .rodata start:0x00000000 end:0x00000014 + .data start:0x00000000 end:0x000001D4 + .bss start:0x00000008 end:0x00000048 diff --git a/config/SOUE01/rels/d_a_obj_pumpkin_leafNP/symbols.txt b/config/SOUE01/rels/d_a_obj_pumpkin_leafNP/symbols.txt index bcfdbe72..f9b400b8 100644 --- a/config/SOUE01/rels/d_a_obj_pumpkin_leafNP/symbols.txt +++ b/config/SOUE01/rels/d_a_obj_pumpkin_leafNP/symbols.txt @@ -3,55 +3,55 @@ _epilog = .text:0x00000030; // type:function size:0x2C scope:global _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 -fn_465_F0 = .text:0x000000F0; // type:function size:0xC0 -fn_465_1B0 = .text:0x000001B0; // type:function size:0x58 -fn_465_210 = .text:0x00000210; // type:function size:0x6C -fn_465_280 = .text:0x00000280; // type:function size:0xA0 -fn_465_320 = .text:0x00000320; // type:function size:0xA4 -fn_465_3D0 = .text:0x000003D0; // type:function size:0x7C -fn_465_450 = .text:0x00000450; // type:function size:0x11C -fn_465_570 = .text:0x00000570; // type:function size:0x10 -fn_465_580 = .text:0x00000580; // type:function size:0x8 -fn_465_590 = .text:0x00000590; // type:function size:0x30 -fn_465_5C0 = .text:0x000005C0; // type:function size:0x28 -fn_465_5F0 = .text:0x000005F0; // type:function size:0x4 -fn_465_600 = .text:0x00000600; // type:function size:0x4 -fn_465_610 = .text:0x00000610; // type:function size:0x4 -fn_465_620 = .text:0x00000620; // type:function size:0xCC -fn_465_6F0 = .text:0x000006F0; // type:function size:0x10 -fn_465_700 = .text:0x00000700; // type:function size:0x10 -fn_465_710 = .text:0x00000710; // type:function size:0x60 -fn_465_770 = .text:0x00000770; // type:function size:0xC -fn_465_780 = .text:0x00000780; // type:function size:0x1C -fn_465_7A0 = .text:0x000007A0; // type:function size:0x1C -fn_465_7C0 = .text:0x000007C0; // type:function size:0x1C -fn_465_7E0 = .text:0x000007E0; // type:function size:0x10 -fn_465_7F0 = .text:0x000007F0; // type:function size:0x10 -fn_465_800 = .text:0x00000800; // type:function size:0x10 -fn_465_810 = .text:0x00000810; // type:function size:0x10 -fn_465_820 = .text:0x00000820; // type:function size:0x10 -fn_465_830 = .text:0x00000830; // type:function size:0x10 -fn_465_840 = .text:0x00000840; // type:function size:0x30 -fn_465_870 = .text:0x00000870; // type:function size:0x30 -fn_465_8A0 = .text:0x000008A0; // type:function size:0x30 -fn_465_8D0 = .text:0x000008D0; // type:function size:0x10C -fn_465_9E0 = .text:0x000009E0; // type:function size:0x58 -fn_465_A40 = .text:0x00000A40; // type:function size:0x88 +dAcOPumpkinLeaf_c_classInit__Fv = .text:0x000000F0; // type:function size:0xC0 +__dt__30sFState_c<17dAcOPumpkinLeaf_c>Fv = .text:0x000001B0; // type:function size:0x58 +__dt__33sFStateFct_c<17dAcOPumpkinLeaf_c>Fv = .text:0x00000210; // type:function size:0x6C +__dt__86sStateMgr_c<17dAcOPumpkinLeaf_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000280; // type:function size:0xA0 +__dt__56sFStateMgr_c<17dAcOPumpkinLeaf_c,20sStateMethodUsr_FI_c>Fv = .text:0x00000320; // type:function size:0xA4 +createHeap__17dAcOPumpkinLeaf_cFv = .text:0x000003D0; // type:function size:0x7C +create__17dAcOPumpkinLeaf_cFv = .text:0x00000450; // type:function size:0x11C +changeState__86sStateMgr_c<17dAcOPumpkinLeaf_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x00000570; // type:function size:0x10 +doDelete__17dAcOPumpkinLeaf_cFv = .text:0x00000580; // type:function size:0x8 +actorExecute__17dAcOPumpkinLeaf_cFv = .text:0x00000590; // type:function size:0x30 +draw__17dAcOPumpkinLeaf_cFv = .text:0x000005C0; // type:function size:0x28 +initializeState_Wait__17dAcOPumpkinLeaf_cFv = .text:0x000005F0; // type:function size:0x4 +executeState_Wait__17dAcOPumpkinLeaf_cFv = .text:0x00000600; // type:function size:0x4 +finalizeState_Wait__17dAcOPumpkinLeaf_cFv = .text:0x00000610; // type:function size:0x4 +__dt__17dAcOPumpkinLeaf_cFv = .text:0x00000620; // type:function size:0xCC +executeState__86sStateMgr_c<17dAcOPumpkinLeaf_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x000006F0; // type:function size:0x10 +getStateID__86sStateMgr_c<17dAcOPumpkinLeaf_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000700; // type:function size:0x10 +build__33sFStateFct_c<17dAcOPumpkinLeaf_c>FRC12sStateIDIf_c = .text:0x00000710; // type:function size:0x60 +dispose__33sFStateFct_c<17dAcOPumpkinLeaf_c>FRP10sStateIf_c = .text:0x00000770; // type:function size:0xC +initialize__30sFState_c<17dAcOPumpkinLeaf_c>Fv = .text:0x00000780; // type:function size:0x1C +execute__30sFState_c<17dAcOPumpkinLeaf_c>Fv = .text:0x000007A0; // type:function size:0x1C +finalize__30sFState_c<17dAcOPumpkinLeaf_c>Fv = .text:0x000007C0; // type:function size:0x1C +initializeState__86sStateMgr_c<17dAcOPumpkinLeaf_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x000007E0; // type:function size:0x10 +finalizeState__86sStateMgr_c<17dAcOPumpkinLeaf_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x000007F0; // type:function size:0x10 +refreshState__86sStateMgr_c<17dAcOPumpkinLeaf_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x00000800; // type:function size:0x10 +getState__86sStateMgr_c<17dAcOPumpkinLeaf_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000810; // type:function size:0x10 +getNewStateID__86sStateMgr_c<17dAcOPumpkinLeaf_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000820; // type:function size:0x10 +getOldStateID__86sStateMgr_c<17dAcOPumpkinLeaf_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x00000830; // type:function size:0x10 +finalizeState__32sFStateID_c<17dAcOPumpkinLeaf_c>CFR17dAcOPumpkinLeaf_c = .text:0x00000840; // type:function size:0x30 +executeState__32sFStateID_c<17dAcOPumpkinLeaf_c>CFR17dAcOPumpkinLeaf_c = .text:0x00000870; // type:function size:0x30 +initializeState__32sFStateID_c<17dAcOPumpkinLeaf_c>CFR17dAcOPumpkinLeaf_c = .text:0x000008A0; // type:function size:0x30 +__sinit_\d_a_obj_pumpkin_leaf_cpp = .text:0x000008D0; // type:function size:0x10C scope:local +__dt__32sFStateID_c<17dAcOPumpkinLeaf_c>Fv = .text:0x000009E0; // type:function size:0x58 +isSameName__32sFStateID_c<17dAcOPumpkinLeaf_c>CFPCc = .text:0x00000A40; // type:function size:0x88 _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_465_rodata_0 = .rodata:0x00000000; // type:object size:0x14 data:float -lbl_465_data_0 = .data:0x00000000; // type:object size:0x10 data:4byte -lbl_465_data_10 = .data:0x00000010; // type:object size:0x8 data:string -lbl_465_data_18 = .data:0x00000018; // type:object size:0x8 -lbl_465_data_20 = .data:0x00000020; // type:object size:0x20 -lbl_465_data_40 = .data:0x00000040; // type:object size:0x8 data:string -lbl_465_data_48 = .data:0x00000048; // type:object size:0x80 -lbl_465_data_C8 = .data:0x000000C8; // type:object size:0x30 -lbl_465_data_F8 = .data:0x000000F8; // type:object size:0x30 -lbl_465_data_128 = .data:0x00000128; // type:object size:0x18 -lbl_465_data_140 = .data:0x00000140; // type:object size:0x60 -lbl_465_data_1A0 = .data:0x000001A0; // type:object size:0x34 +lbl_465_rodata_0 = .rodata:0x00000000; // type:object size:0x14 scope:local data:float +g_profile_OBJ_PUMPKIN_LEAF = .data:0x00000000; // type:object size:0x10 data:4byte +lbl_465_data_10 = .data:0x00000010; // type:object size:0x8 scope:local data:string +lbl_465_data_18 = .data:0x00000018; // type:object size:0x8 scope:local +lbl_465_data_20 = .data:0x00000020; // type:object size:0x20 scope:local +lbl_465_data_40 = .data:0x00000040; // type:object size:0x8 scope:local data:string +__vt__17dAcOPumpkinLeaf_c = .data:0x00000048; // type:object size:0x80 +__vt__56sFStateMgr_c<17dAcOPumpkinLeaf_c,20sStateMethodUsr_FI_c> = .data:0x000000C8; // type:object size:0x30 +__vt__86sStateMgr_c<17dAcOPumpkinLeaf_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x000000F8; // type:object size:0x30 +__vt__33sFStateFct_c<17dAcOPumpkinLeaf_c> = .data:0x00000128; // type:object size:0x14 +__vt__30sFState_c<17dAcOPumpkinLeaf_c> = .data:0x00000140; // type:object size:0x18 +__vt__32sFStateID_c<17dAcOPumpkinLeaf_c> = .data:0x000001A0; // type:object size:0x34 __global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:global -lbl_465_bss_8 = .bss:0x00000008; // type:object size:0x10 -lbl_465_bss_18 = .bss:0x00000018; // type:object size:0x30 data:4byte +lbl_465_bss_8 = .bss:0x00000008; // type:object size:0x10 scope:local +StateID_Wait__17dAcOPumpkinLeaf_c = .bss:0x00000018; // type:object size:0x30 data:4byte diff --git a/configure.py b/configure.py index 2363904d..e6e21110 100644 --- a/configure.py +++ b/configure.py @@ -1219,7 +1219,7 @@ def nw4rLib(lib_name, objects, extra_cflags=[]): Rel(NonMatching, "d_a_obj_propeller_lift", "REL/d/a/obj/d_a_obj_propeller_lift.cpp"), Rel(NonMatching, "d_a_obj_propera", "REL/d/a/obj/d_a_obj_propera.cpp"), Rel(NonMatching, "d_a_obj_pumpkin_bar", "REL/d/a/obj/d_a_obj_pumpkin_bar.cpp"), - Rel(NonMatching, "d_a_obj_pumpkin_leaf", "REL/d/a/obj/d_a_obj_pumpkin_leaf.cpp"), + Rel(Matching, "d_a_obj_pumpkin_leaf", "REL/d/a/obj/d_a_obj_pumpkin_leaf.cpp"), Rel(NonMatching, "d_a_obj_push_block", "REL/d/a/obj/d_a_obj_push_block.cpp"), Rel(NonMatching, "d_a_obj_puzzle_island", "REL/d/a/obj/d_a_obj_puzzle_island.cpp"), Rel(NonMatching, "d_a_obj_rail_end", "REL/d/a/obj/d_a_obj_rail_end.cpp"), diff --git a/include/d/a/d_a_base.h b/include/d/a/d_a_base.h index 179e8f7f..52a15a81 100644 --- a/include/d/a/d_a_base.h +++ b/include/d/a/d_a_base.h @@ -147,6 +147,10 @@ class dAcBase_c : public dBase_c { return getSquareDistanceTo(point) > radius; } + u32 getRoomId() { + return roomid; + } + public: // funcs found in TU /* 8002c650 */ static void setTempCreateParams(mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, s32 roomId, u32 params2, diff --git a/include/d/a/obj/d_a_obj_pumpkin_leaf.h b/include/d/a/obj/d_a_obj_pumpkin_leaf.h new file mode 100644 index 00000000..cfbc91a0 --- /dev/null +++ b/include/d/a/obj/d_a_obj_pumpkin_leaf.h @@ -0,0 +1,31 @@ +#ifndef D_A_OBJ_PUMPKIN_LEAF_H +#define D_A_OBJ_PUMPKIN_LEAF_H + +#include +#include +#include +#include + +class dAcOPumpkinLeaf_c : public dAcObjBase_c { +public: + dAcOPumpkinLeaf_c() : mStateMgr(*this, sStateID::null) {} + virtual ~dAcOPumpkinLeaf_c() {} + virtual bool createHeap() override; + virtual int create() override; + virtual int actorExecute() override; + virtual int draw() override; + virtual int doDelete() override; + + STATE_FUNC_DECLARE(dAcOPumpkinLeaf_c, Wait); + +private: + nw4r::g3d::ResFile mBrres; + m3d::smdl_c mModel; + STATE_MGR_DECLARE(dAcOPumpkinLeaf_c); + void dummy_executeState() { + // Not called from the class but needed for weak function ordering + mStateMgr.executeState(); + } +}; + +#endif diff --git a/src/REL/d/a/obj/d_a_obj_pumpkin_leaf.cpp b/src/REL/d/a/obj/d_a_obj_pumpkin_leaf.cpp index e69de29b..121136aa 100644 --- a/src/REL/d/a/obj/d_a_obj_pumpkin_leaf.cpp +++ b/src/REL/d/a/obj/d_a_obj_pumpkin_leaf.cpp @@ -0,0 +1,47 @@ +#include +#include + +SPECIAL_ACTOR_PROFILE(OBJ_PUMPKIN_LEAF, dAcOPumpkinLeaf_c, fProfile::OBJ_PUMPKIN_LEAF, 0x0135, 0, 3); + +STATE_DEFINE(dAcOPumpkinLeaf_c, Wait); + +bool dAcOPumpkinLeaf_c::createHeap() { + mBrres = getOarcResFile("Pumpkin"); + nw4r::g3d::ResMdl mdl = mBrres.GetResMdl("Leaf"); + TRY_CREATE(mModel.create(mdl, &heap_allocator, 0x120, 1, nullptr)); + return true; +} + +int dAcOPumpkinLeaf_c::create() { + if (!initAllocatorWork1Heap(0x1000, "dAcOPumpkinLeaf_c::m_allocator", 0x20)) { + return FAILED; + } + + forwardAccel = -1.0f; + forwardMaxSpeed = -40.0f; + updateMatrix(); + mStateMgr.changeState(StateID_Wait); + setBoundingBox(mVec3_c(-50.0f, -10.0f, -50.0f), mVec3_c(50.0f, 50.0f, 50.0f)); + dAcObjBase_c::create( + "PmpknBd", getRoomId(), 0, &position, &rotation, &scale, getParams2_ignoreLower(), -1, viewclip_index + ); + return SUCCEEDED; +} + +int dAcOPumpkinLeaf_c::doDelete() { + return SUCCEEDED; +} + +int dAcOPumpkinLeaf_c::actorExecute() { + mModel.setLocalMtx(worldMatrix); + return SUCCEEDED; +} + +int dAcOPumpkinLeaf_c::draw() { + drawModelType1(&mModel); + return SUCCEEDED; +} + +void dAcOPumpkinLeaf_c::initializeState_Wait() {} +void dAcOPumpkinLeaf_c::executeState_Wait() {} +void dAcOPumpkinLeaf_c::finalizeState_Wait() {}