From 204e3495c52901db31982d75558bf21bc4403b0f Mon Sep 17 00:00:00 2001 From: Swekka Date: Tue, 27 May 2025 00:40:29 +0200 Subject: [PATCH] d_a_obj_island_LOD --- .../rels/d_a_obj_island_LODNP/symbols.txt | 10 ++-- config/SOUE01/symbols.txt | 4 +- include/d/a/obj/d_a_obj_island_LOD.h | 12 ++++ include/toBeSorted/blur_and_palette_manager.h | 2 + src/REL/d/a/obj/d_a_obj_island_LOD.cpp | 59 +++++++++++++++++++ 5 files changed, 80 insertions(+), 7 deletions(-) diff --git a/config/SOUE01/rels/d_a_obj_island_LODNP/symbols.txt b/config/SOUE01/rels/d_a_obj_island_LODNP/symbols.txt index f3922533..031f6615 100644 --- a/config/SOUE01/rels/d_a_obj_island_LODNP/symbols.txt +++ b/config/SOUE01/rels/d_a_obj_island_LODNP/symbols.txt @@ -2,11 +2,11 @@ _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 dAcOislandLOD_c_classInit__Fv = .text:0x00000070; // type:function size:0x5C -fn_426_D0 = .text:0x000000D0; // type:function size:0xAC -fn_426_180 = .text:0x00000180; // type:function size:0xB0 -fn_426_230 = .text:0x00000230; // type:function size:0x8 -fn_426_240 = .text:0x00000240; // type:function size:0x8 -fn_426_250 = .text:0x00000250; // type:function size:0x78 +createHeap__15dAcOislandLOD_cFv = .text:0x000000D0; // type:function size:0xAC +create__15dAcOislandLOD_cFv = .text:0x00000180; // type:function size:0xB0 +doDelete__15dAcOislandLOD_cFv = .text:0x00000230; // type:function size:0x8 +actorExecute__15dAcOislandLOD_cFv = .text:0x00000240; // type:function size:0x8 +draw__15dAcOislandLOD_cFv = .text:0x00000250; // type:function size:0x78 __dt__15dAcOislandLOD_cFv = .text:0x000002D0; // type:function size:0x68 _ctors = .ctors:0x00000000; // type:label scope:global _dtors = .dtors:0x00000000; // type:label scope:global diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 68878fa5..03921e55 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -852,8 +852,8 @@ fn_80024590 = .text:0x80024590; // type:function size:0xE4 __ct__3SffFv = .text:0x80024680; // type:function size:0x48 __dt__3SffFv = .text:0x800246D0; // type:function size:0x64 fn_80024740 = .text:0x80024740; // type:function size:0x24 -fn_80024770 = .text:0x80024770; // type:function size:0x24 -fn_800247A0 = .text:0x800247A0; // type:function size:0x30 +fn_80024770__21BlurAndPaletteManagerFi = .text:0x80024770; // type:function size:0x24 +fn_800247A0__21BlurAndPaletteManagerFi = .text:0x800247A0; // type:function size:0x30 fn_800247D0__21BlurAndPaletteManagerF7mVec3_cf = .text:0x800247D0; // type:function size:0x20 __ct__21BlurAndPaletteManagerFv = .text:0x800247F0; // type:function size:0xBB0 __ct__7mVec3_cFfff = .text:0x800253A0; // type:function size:0x10 diff --git a/include/d/a/obj/d_a_obj_island_LOD.h b/include/d/a/obj/d_a_obj_island_LOD.h index c6fb5449..3b2d7eb2 100644 --- a/include/d/a/obj/d_a_obj_island_LOD.h +++ b/include/d/a/obj/d_a_obj_island_LOD.h @@ -8,7 +8,19 @@ public: dAcOislandLOD_c() {} virtual ~dAcOislandLOD_c() {} + virtual bool createHeap() override; + virtual int create() override; + virtual int doDelete() override; + virtual int actorExecute() override; + virtual int draw() override; + private: + static const char* const resFilenames[5]; + static const char* const resMdlNames[5]; + + /* 0x330 */ nw4r::g3d::ResFile resFile; + /* 0x334 */ m3d::smdl_c mMdl; + /* 0x350 */ u8 lodModelIndex; }; #endif diff --git a/include/toBeSorted/blur_and_palette_manager.h b/include/toBeSorted/blur_and_palette_manager.h index 6f985709..1891a7e0 100644 --- a/include/toBeSorted/blur_and_palette_manager.h +++ b/include/toBeSorted/blur_and_palette_manager.h @@ -268,6 +268,8 @@ public: void fn_800226E0(LightParams *); // light pillar related void fn_80024240(s16, s16, s16); + bool fn_80024770(int); + bool fn_800247A0(int); u8 get0x2DE8() const { return field_0x2DE0[8]; diff --git a/src/REL/d/a/obj/d_a_obj_island_LOD.cpp b/src/REL/d/a/obj/d_a_obj_island_LOD.cpp index 56fe0d7b..31db1ce1 100644 --- a/src/REL/d/a/obj/d_a_obj_island_LOD.cpp +++ b/src/REL/d/a/obj/d_a_obj_island_LOD.cpp @@ -1,3 +1,62 @@ #include "d/a/obj/d_a_obj_island_LOD.h" +#include "common.h" +#include "d/a/obj/d_a_obj_base.h" +#include "d/d_stage.h" +#include "f/f_base.h" +#include "toBeSorted/blur_and_palette_manager.h" + +const char* const dAcOislandLOD_c::resFilenames[5] = { + "IslLODA", + "IslLODB", + "IslLODC", + "IslLODD", + "IslLODE", +}; + +const char* const dAcOislandLOD_c::resMdlNames[5] = { + "IslLODA", + "IslLODB", + "IslLODC", + "IslLODD", + "IslLODE", +}; SPECIAL_ACTOR_PROFILE(OBJ_ISLAND_LOD, dAcOislandLOD_c, fProfile::OBJ_ISLAND_LOD, 0x211, 0, 3); + +bool dAcOislandLOD_c::createHeap() { + lodModelIndex = params & 0xf; + void* data = getOarcResFile(dAcOislandLOD_c::resFilenames[lodModelIndex]); + resFile = nw4r::g3d::ResFile(data); + dStage_c::bindStageResToFile(&resFile); + dStage_c::bindSkyCmnToResFile(&resFile); + nw4r::g3d::ResMdl mdl = resFile.GetResMdl(dAcOislandLOD_c::resMdlNames[lodModelIndex]); + TRY_CREATE(mMdl.create(mdl, &heap_allocator, 0x120, 1, nullptr)); + return true; +} + +int dAcOislandLOD_c::create() { + CREATE_ALLOCATOR(dAcOislandLOD_c); + updateMatrix(); + mMdl.setLocalMtx(mWorldMtx); + mVec3_c min, max; + mMdl.getBounds(&min, &max); + boundingBox.Set(min, max); + mCullingDistance = 500000.0; + return SUCCEEDED; +} + +int dAcOislandLOD_c::doDelete() { + return SUCCEEDED; +} +int dAcOislandLOD_c::actorExecute() { + return SUCCEEDED; +} + +int dAcOislandLOD_c::draw() { + BlurAndPaletteManager& blurAndPaletteManager = BlurAndPaletteManager::GetInstance(); + if (blurAndPaletteManager.fn_80024770(7) && !blurAndPaletteManager.fn_800247A0(7)) { + return SUCCEEDED; + } + drawModelType1(&mMdl); + return SUCCEEDED; +}