From ae5be622bf434c77dcd8bce8b88e7024355d2be9 Mon Sep 17 00:00:00 2001 From: Sebastian Snoer Date: Mon, 26 May 2025 02:25:07 +0200 Subject: [PATCH] d_a_obj_rail_post Implemented --- .../rels/d_a_obj_rail_postNP/symbols.txt | 18 +++--- .../rels/d_t_gate_to_groundNP/symbols.txt | 2 +- configure.py | 2 +- include/d/a/obj/d_a_obj_rail_post.h | 9 +++ src/REL/d/a/obj/d_a_obj_rail_post.cpp | 56 +++++++++++++++++++ 5 files changed, 76 insertions(+), 11 deletions(-) diff --git a/config/SOUE01/rels/d_a_obj_rail_postNP/symbols.txt b/config/SOUE01/rels/d_a_obj_rail_postNP/symbols.txt index 818a49f1..be245895 100644 --- a/config/SOUE01/rels/d_a_obj_rail_postNP/symbols.txt +++ b/config/SOUE01/rels/d_a_obj_rail_postNP/symbols.txt @@ -4,15 +4,15 @@ _unresolved = .text:0x00000060; // type:function size:0x4 scope:global dAcORailPost_classInit__Fv = .text:0x00000070; // type:function size:0x30 __ct__12dAcORailPostFv = .text:0x000000A0; // type:function size:0x4C __dt__12dAcORailPostFv = .text:0x000000F0; // type:function size:0x74 -AcORailPost__initModels = .text:0x00000170; // type:function size:0x118 -AcORailPost__init = .text:0x00000290; // type:function size:0xA4 -AcORailPost__destroy = .text:0x00000340; // type:function size:0x38 -fn_524_380 = .text:0x00000380; // type:function size:0x8 -AcORailPost__draw = .text:0x00000390; // type:function size:0x34 +createHeap__12dAcORailPostFv = .text:0x00000170; // type:function size:0x118 +create__12dAcORailPostFv = .text:0x00000290; // type:function size:0xA4 +doDelete__12dAcORailPostFv = .text:0x00000340; // type:function size:0x38 +actorExecute__12dAcORailPostFv = .text:0x00000380; // type:function size:0x8 +draw__12dAcORailPostFv = .text:0x00000390; // type:function size:0x34 _ctors = .ctors:0x00000000; // type:label scope:global _dtors = .dtors:0x00000000; // type:label scope:global -lbl_524_rodata_0 = .rodata:0x00000000; // type:object size:0x4 data:float +@15367 = .rodata:0x00000000; // type:object size:0x4 data:float g_profile_OBJ_RAIL_POST = .data:0x00000000; // type:object size:0x10 -lbl_524_data_10 = .data:0x00000010; // type:object size:0xC -lbl_524_data_1C = .data:0x0000001C; // type:object size:0x1C -AcORailPost__vtable = .data:0x00000038; // type:object size:0x80 +@15350 = .data:0x00000010; // type:object size:0xC +@15366 = .data:0x0000001C; // type:object size:0x1C +__vt__12dAcORailPost = .data:0x00000038; // type:object size:0x80 diff --git a/config/SOUE01/rels/d_t_gate_to_groundNP/symbols.txt b/config/SOUE01/rels/d_t_gate_to_groundNP/symbols.txt index 00eb2edf..49256b1d 100644 --- a/config/SOUE01/rels/d_t_gate_to_groundNP/symbols.txt +++ b/config/SOUE01/rels/d_t_gate_to_groundNP/symbols.txt @@ -10,7 +10,7 @@ draw__17dTgGateToGround_cFv = .text:0x000002F0; // type:function size:0x8 __dt__17dTgGateToGround_cFv = .text:0x00000300; // type:function size:0x70 _ctors = .ctors:0x00000000; // type:label scope:global _dtors = .dtors:0x00000000; // type:label scope:global -@20562 = .rodata:0x00000000; // type:object size:0x4 data:float scope:local +@20562 = .rodata:0x00000000; // type:object size:0x4 scope:local data:float g_profile_GATE2GND_TAG = .data:0x00000000; // type:object size:0x10 @20583 = .data:0x00000010; // type:object size:0xC scope:local __vt__17dTgGateToGround_c = .data:0x0000001C; // type:object size:0x74 diff --git a/configure.py b/configure.py index 5f129583..44825420 100644 --- a/configure.py +++ b/configure.py @@ -2182,7 +2182,7 @@ config.libs = [ 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"), - Rel(NonMatching, "d_a_obj_rail_post", "REL/d/a/obj/d_a_obj_rail_post.cpp"), + Rel(Matching, "d_a_obj_rail_post", "REL/d/a/obj/d_a_obj_rail_post.cpp"), Rel(NonMatching, "d_a_obj_ride_rock", "REL/d/a/obj/d_a_obj_ride_rock.cpp"), Rel(Matching, "d_a_obj_ring", "REL/d/a/obj/d_a_obj_ring.cpp"), Rel(NonMatching, "d_a_obj_rock_boat", "REL/d/a/obj/d_a_obj_rock_boat.cpp"), diff --git a/include/d/a/obj/d_a_obj_rail_post.h b/include/d/a/obj/d_a_obj_rail_post.h index 7e9e32e9..ba5af422 100644 --- a/include/d/a/obj/d_a_obj_rail_post.h +++ b/include/d/a/obj/d_a_obj_rail_post.h @@ -2,13 +2,22 @@ #define D_A_OBJ_RAIL_POST_H #include "d/a/obj/d_a_obj_base.h" +#include "d/col/bg/d_bg_w.h" class dAcORailPost : public dAcObjBase_c { public: dAcORailPost(); virtual ~dAcORailPost(); + virtual bool createHeap() override; + virtual int create() override; + virtual int doDelete() override; + virtual int actorExecute() override; + virtual int draw() override; + private: + /* 0x330 */ m3d::smdl_c mMdl; + /* 0x350 */ dBgW mBgW; }; #endif diff --git a/src/REL/d/a/obj/d_a_obj_rail_post.cpp b/src/REL/d/a/obj/d_a_obj_rail_post.cpp index 6498a094..3a052e1b 100644 --- a/src/REL/d/a/obj/d_a_obj_rail_post.cpp +++ b/src/REL/d/a/obj/d_a_obj_rail_post.cpp @@ -1,6 +1,62 @@ #include "d/a/obj/d_a_obj_rail_post.h" +#include "d/a/obj/d_a_obj_base.h" +#include "d/col/bg/d_bg_s.h" +#include "nw4r/g3d/res/g3d_resmdl.h" SPECIAL_ACTOR_PROFILE(OBJ_RAIL_POST, dAcORailPost, fProfile::OBJ_RAIL_POST, 0x280, 0, 3); dAcORailPost::dAcORailPost() {} dAcORailPost::~dAcORailPost() {} + +bool dAcORailPost::createHeap() { + void *resFilePtr = getOarcResFile("RailPost"); + if(resFilePtr == nullptr) + return false; + + nw4r::g3d::ResFile res(resFilePtr); + if(res.IsValid() == false) + return false; + + nw4r::g3d::ResMdl mdl = res.GetResMdl("RailPost"); + if(mdl.IsValid() == false) + return false; + + if(!mMdl.create(mdl, &heap_allocator, 0x20, 1, nullptr)) + return false; + + mMdl.setLocalMtx(mWorldMtx); + void *dzb = getOarcDZB("RailPost", "RailPost"); + void *plc = getOarcPLC("RailPost", "RailPost"); + TRY_CREATE(!mBgW.Set((cBgD_t *)dzb, (PLC *)plc, 0x81, &mWorldMtx, &mScale)); + + dBgS::GetInstance()->Regist(&mBgW, this); + + return true; +} + +int dAcORailPost::create() { + mVec3_c boundsMin; + mVec3_c boundsMax; + updateMatrix(); + CREATE_ALLOCATOR(dAcORailPost); + + mMdl.getBounds(&boundsMin, &boundsMax); + boundingBox.Set(boundsMin, boundsMax); + mCullingDistance = 25000.0f; + + return SUCCEEDED; +} + +int dAcORailPost::doDelete() { + dBgS::GetInstance()->Release(&mBgW); + return SUCCEEDED; +} + +int dAcORailPost::actorExecute() { + return SUCCEEDED; +} + +int dAcORailPost::draw() { + mMdl.entry(); + return SUCCEEDED; +}