From ddd456d450d676fabad4513dad9ead60bf58bb31 Mon Sep 17 00:00:00 2001 From: Swekka Date: Tue, 27 May 2025 21:27:32 +0200 Subject: [PATCH] d_a_obj_F400_gate_leaf OK --- .../rels/d_a_obj_F400_gate_leafNP/symbols.txt | 8 +-- configure.py | 2 +- include/d/a/obj/d_a_obj_F400_gate_leaf.h | 7 +++ include/d/flag/baseflag_manager.h | 4 ++ src/REL/d/a/obj/d_a_obj_F400_gate_leaf.cpp | 53 +++++++++++++++++++ 5 files changed, 69 insertions(+), 5 deletions(-) diff --git a/config/SOUE01/rels/d_a_obj_F400_gate_leafNP/symbols.txt b/config/SOUE01/rels/d_a_obj_F400_gate_leafNP/symbols.txt index c599de77..442a1519 100644 --- a/config/SOUE01/rels/d_a_obj_F400_gate_leafNP/symbols.txt +++ b/config/SOUE01/rels/d_a_obj_F400_gate_leafNP/symbols.txt @@ -2,10 +2,10 @@ _prolog = .text:0x00000000; // type:function size:0x2C scope:global _epilog = .text:0x00000030; // type:function size:0x2C scope:global _unresolved = .text:0x00000060; // type:function size:0x4 scope:global dAcOF400GateLeaf_c_classInit__Fv = .text:0x00000070; // type:function size:0x54 -fn_628_D0 = .text:0x000000D0; // type:function size:0x98 -AcOF400GateLeaf__init = .text:0x00000170; // type:function size:0xE4 -AcOF400GateLeaf__draw = .text:0x00000260; // type:function size:0x6C -AcOF400GateLeaf__getStoryflag = .text:0x000002D0; // type:function size:0xC +createHeap__18dAcOF400GateLeaf_cFv = .text:0x000000D0; // type:function size:0x98 +create__18dAcOF400GateLeaf_cFv = .text:0x00000170; // type:function size:0xE4 +draw__18dAcOF400GateLeaf_cFv = .text:0x00000260; // type:function size:0x6C +getStoryflag__18dAcOF400GateLeaf_cFv = .text:0x000002D0; // type:function size:0xC __dt__18dAcOF400GateLeaf_cFv = .text:0x000002E0; // type:function size:0x68 _ctors = .ctors:0x00000000; // type:label scope:global _dtors = .dtors:0x00000000; // type:label scope:global diff --git a/configure.py b/configure.py index c0869eb4..913412cf 100644 --- a/configure.py +++ b/configure.py @@ -2044,7 +2044,7 @@ config.libs = [ Rel(NonMatching, "d_a_obj_evil_field", "REL/d/a/obj/d_a_obj_evil_field.cpp"), Rel(NonMatching, "d_a_obj_F302_light", "REL/d/a/obj/d_a_obj_F302_light.cpp"), Rel( - NonMatching, "d_a_obj_F400_gate_leaf", "REL/d/a/obj/d_a_obj_F400_gate_leaf.cpp" + Matching, "d_a_obj_F400_gate_leaf", "REL/d/a/obj/d_a_obj_F400_gate_leaf.cpp" ), Rel( NonMatching, "d_a_obj_F400_gate_seal", "REL/d/a/obj/d_a_obj_F400_gate_seal.cpp" diff --git a/include/d/a/obj/d_a_obj_F400_gate_leaf.h b/include/d/a/obj/d_a_obj_F400_gate_leaf.h index a31e3ba8..24b73c1e 100644 --- a/include/d/a/obj/d_a_obj_F400_gate_leaf.h +++ b/include/d/a/obj/d_a_obj_F400_gate_leaf.h @@ -8,7 +8,14 @@ public: dAcOF400GateLeaf_c() {} virtual ~dAcOF400GateLeaf_c() {} + virtual bool createHeap() override; + virtual int create() override; + virtual int draw() override; + + u16 getStoryflag(); + private: + /* 0x330 */ m3d::smdl_c mMdl; }; #endif diff --git a/include/d/flag/baseflag_manager.h b/include/d/flag/baseflag_manager.h index 932e3b76..db0aa401 100644 --- a/include/d/flag/baseflag_manager.h +++ b/include/d/flag/baseflag_manager.h @@ -35,6 +35,10 @@ public: u16 getUncommittedValue_Priv(u16 flag) const; + u32 checkFlagValid(u16 counterIdx) const { + return mpFlagIndex->checkFlagValid(counterIdx, mFlagCount); + } + protected: void setFlagSizes(u16 flagCount, u16 flagSizeBytes); diff --git a/src/REL/d/a/obj/d_a_obj_F400_gate_leaf.cpp b/src/REL/d/a/obj/d_a_obj_F400_gate_leaf.cpp index e8f0ee98..3596fc3c 100644 --- a/src/REL/d/a/obj/d_a_obj_F400_gate_leaf.cpp +++ b/src/REL/d/a/obj/d_a_obj_F400_gate_leaf.cpp @@ -1,3 +1,56 @@ #include "d/a/obj/d_a_obj_F400_gate_leaf.h" +#include "common.h" +#include "d/a/obj/d_a_obj_base.h" +#include "d/flag/storyflag_manager.h" +#include "f/f_base.h" +#include "nw4r/g3d/res/g3d_resfile.h" SPECIAL_ACTOR_PROFILE(OBJ_F400_GATE_LEAF, dAcOF400GateLeaf_c, fProfile::OBJ_F400_GATE_LEAF, 0x286, 0, 3); + +bool dAcOF400GateLeaf_c::createHeap() { + void *data = dAcObjBase_c::getOarcResFile("F400GateLeaf"); + if (data == nullptr) { + return false; + } + + nw4r::g3d::ResFile resFile(data); + if (!resFile.IsValid()){ + return false; + } + + nw4r::g3d::ResMdl mdl = resFile.GetResMdl("F400GateLeaf"); + if (!mdl.IsValid()){ + return false; + } + + return mMdl.create(mdl, &heap_allocator, 0, 1, nullptr); +} + +int dAcOF400GateLeaf_c::create() { + u32 counterIdx = getStoryflag(); + u32 flagValid = StoryflagManager::sInstance->checkFlagValid(counterIdx); + if (flagValid == 0) { + return FAILED; + } + CREATE_ALLOCATOR(dAcOF400GateLeaf_c); + mMdl.setPriorityDraw(0x1C, 9); + updateMatrix(); + mMdl.setLocalMtx(mWorldMtx); + mVec3_c min, max; + mMdl.getBounds(&min,&max); + boundingBox.Set(min, max); + return SUCCEEDED; +} + +int dAcOF400GateLeaf_c::draw() { + StoryflagManager *storyFlagManager = StoryflagManager::sInstance; + u32 counterIdx = getStoryflag(); + if (!storyFlagManager->getCounterOrFlag(counterIdx)) { + dAcObjBase_c::drawModelType1(&mMdl); + } + return SUCCEEDED; +} + +u16 dAcOF400GateLeaf_c::getStoryflag() { + return params & 0xffff; +}