diff --git a/config/SOUE01/rels/d_a_obj_uta_demo_pedestNP/splits.txt b/config/SOUE01/rels/d_a_obj_uta_demo_pedestNP/splits.txt index 0f41cbe5..3e8d7e96 100644 --- a/config/SOUE01/rels/d_a_obj_uta_demo_pedestNP/splits.txt +++ b/config/SOUE01/rels/d_a_obj_uta_demo_pedestNP/splits.txt @@ -11,3 +11,5 @@ REL/executor.c: REL/d/a/obj/d_a_obj_uta_demo_pedest.cpp: .text start:0x00000070 end:0x00000318 + .rodata start:0x00000000 end:0x00000008 + .data start:0x00000000 end:0x000000F0 diff --git a/config/SOUE01/rels/d_a_obj_uta_demo_pedestNP/symbols.txt b/config/SOUE01/rels/d_a_obj_uta_demo_pedestNP/symbols.txt index 433e2ca3..fad7c65d 100644 --- a/config/SOUE01/rels/d_a_obj_uta_demo_pedestNP/symbols.txt +++ b/config/SOUE01/rels/d_a_obj_uta_demo_pedestNP/symbols.txt @@ -2,18 +2,18 @@ _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 dAcOutaDemoPedest_c_classInit__Fv = .text:0x00000070; // type:function size:0x5C -fn_427_D0 = .text:0x000000D0; // type:function size:0xCC -fn_427_1A0 = .text:0x000001A0; // type:function size:0xB4 -fn_427_260 = .text:0x00000260; // type:function size:0x8 -fn_427_270 = .text:0x00000270; // type:function size:0x8 -fn_427_280 = .text:0x00000280; // type:function size:0x28 +createHeap__19dAcOutaDemoPedest_cFv = .text:0x000000D0; // type:function size:0xCC +create__19dAcOutaDemoPedest_cFv = .text:0x000001A0; // type:function size:0xB4 +doDelete__19dAcOutaDemoPedest_cFv = .text:0x00000260; // type:function size:0x8 +actorExecute__19dAcOutaDemoPedest_cFv = .text:0x00000270; // type:function size:0x8 +draw__19dAcOutaDemoPedest_cFv = .text:0x00000280; // type:function size:0x28 __dt__19dAcOutaDemoPedest_cFv = .text:0x000002B0; // type:function size:0x68 _ctors = .ctors:0x00000000; // type:label scope:global _dtors = .dtors:0x00000000; // type:label scope:global -lbl_427_rodata_0 = .rodata:0x00000000; // type:object size:0x8 -lbl_427_data_0 = .data:0x00000000; // type:object size:0x14 -lbl_427_data_14 = .data:0x00000014; // type:object size:0x14 +lbl_427_rodata_0 = .rodata:0x00000000; // type:object size:0x8 scope:local +lbl_427_data_0 = .data:0x00000000; // type:object size:0x14 scope:local +lbl_427_data_14 = .data:0x00000014; // type:object size:0x14 scope:local g_profile_OBJ_UTA_DEMO_PEDEST = .data:0x00000028; // type:object size:0x10 -lbl_427_data_38 = .data:0x00000038; // type:object size:0x10 data:string -lbl_427_data_48 = .data:0x00000048; // type:object size:0x28 -lbl_427_data_70 = .data:0x00000070; // type:object size:0x80 +lbl_427_data_38 = .data:0x00000038; // type:object size:0x10 scope:local data:string +lbl_427_data_48 = .data:0x00000048; // type:object size:0x28 scope:local +__vt__19dAcOutaDemoPedest_c = .data:0x00000070; // type:object size:0x80 diff --git a/config/SOUE01/rels/d_a_obj_utajima_lv2NP/splits.txt b/config/SOUE01/rels/d_a_obj_utajima_lv2NP/splits.txt index 0e0ad2d1..7c75ab4a 100644 --- a/config/SOUE01/rels/d_a_obj_utajima_lv2NP/splits.txt +++ b/config/SOUE01/rels/d_a_obj_utajima_lv2NP/splits.txt @@ -11,3 +11,5 @@ REL/executor.c: REL/d/a/obj/d_a_obj_utajima_lv2.cpp: .text start:0x00000070 end:0x000003D4 + .rodata start:0x00000000 end:0x00000020 + .data start:0x00000000 end:0x000000D8 diff --git a/config/SOUE01/rels/d_a_obj_utajima_lv2NP/symbols.txt b/config/SOUE01/rels/d_a_obj_utajima_lv2NP/symbols.txt index 80ba3ebf..2f855177 100644 --- a/config/SOUE01/rels/d_a_obj_utajima_lv2NP/symbols.txt +++ b/config/SOUE01/rels/d_a_obj_utajima_lv2NP/symbols.txt @@ -2,15 +2,15 @@ _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 dAcOutajimaLv2_c_classInit__Fv = .text:0x00000070; // type:function size:0x64 -AcOutajimaLv2__initModels = .text:0x000000E0; // type:function size:0x114 -AcOutajimaLv2__init = .text:0x00000200; // type:function size:0xE0 -AcOutajimaLv2__destory = .text:0x000002E0; // type:function size:0x38 -fn_403_320 = .text:0x00000320; // type:function size:0x8 -AcOutajimaLv2__draw = .text:0x00000330; // type:function size:0x28 +createHeap__16dAcOutajimaLv2_cFv = .text:0x000000E0; // type:function size:0x114 +create__16dAcOutajimaLv2_cFv = .text:0x00000200; // type:function size:0xE0 +doDelete__16dAcOutajimaLv2_cFv = .text:0x000002E0; // type:function size:0x38 +actorExecute__16dAcOutajimaLv2_cFv = .text:0x00000320; // type:function size:0x8 +draw__16dAcOutajimaLv2_cFv = .text:0x00000330; // type:function size:0x28 __dt__16dAcOutajimaLv2_cFv = .text:0x00000360; // type:function size:0x74 _ctors = .ctors:0x00000000; // type:label scope:global _dtors = .dtors:0x00000000; // type:label scope:global -lbl_403_rodata_0 = .rodata:0x00000000; // type:object size:0x20 data:float -g_profile_OBJ_UTAJIMA_LV2 = .data:0x00000000; // type:object size:0x38 -lbl_403_data_38 = .data:0x00000038; // type:object size:0x20 -lbl_403_data_58 = .data:0x00000058; // type:object size:0x80 +lbl_403_rodata_0 = .rodata:0x00000000; // type:object size:0x20 scope:local data:float +g_profile_OBJ_UTAJIMA_LV2 = .data:0x00000000; // type:object size:0x10 +lbl_403_data_38 = .data:0x00000038; // type:object size:0x20 scope:local +__vt__16dAcOutajimaLv2_c = .data:0x00000058; // type:object size:0x80 diff --git a/configure.py b/configure.py index 448abeb7..bb08ab7f 100644 --- a/configure.py +++ b/configure.py @@ -1709,7 +1709,7 @@ def nw4rLib(lib_name, objects, extra_cflags=[]): Rel( NonMatching, "d_a_obj_utajima_island", "REL/d/a/obj/d_a_obj_utajima_island.cpp" ), - Rel(NonMatching, "d_a_obj_utajima_lv2", "REL/d/a/obj/d_a_obj_utajima_lv2.cpp"), + Rel(Matching, "d_a_obj_utajima_lv2", "REL/d/a/obj/d_a_obj_utajima_lv2.cpp"), Rel( NonMatching, "d_a_obj_utajima_main_mecha", @@ -1726,7 +1726,7 @@ def nw4rLib(lib_name, objects, extra_cflags=[]): "REL/d/a/obj/d_a_obj_utajima_stopper.cpp", ), Rel( - NonMatching, + Matching, "d_a_obj_uta_demo_pedest", "REL/d/a/obj/d_a_obj_uta_demo_pedest.cpp", ), diff --git a/include/d/a/obj/d_a_obj_uta_demo_pedest.h b/include/d/a/obj/d_a_obj_uta_demo_pedest.h index ddff7a79..596b2bad 100644 --- a/include/d/a/obj/d_a_obj_uta_demo_pedest.h +++ b/include/d/a/obj/d_a_obj_uta_demo_pedest.h @@ -2,13 +2,28 @@ #define D_A_OBJ_UTA_DEMO_PEDEST_H #include "d/a/obj/d_a_obj_base.h" +#include "m/m3d/m_smdl.h" +#include "nw4r/g3d/g3d_resfile.h" class dAcOutaDemoPedest_c : public dAcObjBase_c { public: dAcOutaDemoPedest_c() {} virtual ~dAcOutaDemoPedest_c() {} + virtual bool createHeap() override; + virtual int create() override; + virtual int doDelete() override; + virtual int actorExecute() override; + virtual int draw() override; + private: + u8 getModelType() { + return params & 0xF; + } + + /* 0x330 */ nw4r::g3d::ResFile mRes; + /* 0x334 */ m3d::smdl_c mMdl; + /* 0x350 */ u8 mModelType; }; #endif diff --git a/include/d/a/obj/d_a_obj_utajima_lv2.h b/include/d/a/obj/d_a_obj_utajima_lv2.h index b7f2c044..3bfc8ee4 100644 --- a/include/d/a/obj/d_a_obj_utajima_lv2.h +++ b/include/d/a/obj/d_a_obj_utajima_lv2.h @@ -2,13 +2,27 @@ #define D_A_OBJ_UTAJIMA_LV2_H #include "d/a/obj/d_a_obj_base.h" +#include "d/col/bg/d_bg_w.h" +#include "m/m3d/m_smdl.h" +#include "nw4r/g3d/g3d_resfile.h" class dAcOutajimaLv2_c : public dAcObjBase_c { public: dAcOutajimaLv2_c() {} virtual ~dAcOutajimaLv2_c() {} + virtual bool createHeap() override; + virtual int create() override; + virtual int doDelete() override; + virtual int actorExecute() override; + virtual int draw() override; + private: + static const f32 someFloat; + + /* 0x330 */ m3d::smdl_c mMdl; + /* 0x34C */ nw4r::g3d::ResFile mRes; + /* 0x350 */ dBgW mBgW; }; #endif diff --git a/src/REL/d/a/obj/d_a_obj_uta_demo_pedest.cpp b/src/REL/d/a/obj/d_a_obj_uta_demo_pedest.cpp index 39a49738..4d52eb79 100644 --- a/src/REL/d/a/obj/d_a_obj_uta_demo_pedest.cpp +++ b/src/REL/d/a/obj/d_a_obj_uta_demo_pedest.cpp @@ -1,3 +1,59 @@ #include "d/a/obj/d_a_obj_uta_demo_pedest.h" +#include "d/a/obj/d_a_obj_base.h" +#include "f/f_base.h" +#include "m/m_vec.h" +#include "nw4r/g3d/g3d_resmdl.h" +#include "toBeSorted/arc_managers/current_stage_arc_manager.h" +#include "toBeSorted/room_manager.h" + +static const char *const sMdlNames[] = { + "StageF010rPedest", + "StageWindF001r", +}; + SPECIAL_ACTOR_PROFILE(OBJ_UTA_DEMO_PEDEST, dAcOutaDemoPedest_c, fProfile::OBJ_UTA_DEMO_PEDEST, 0x212, 0, 6); + +bool dAcOutaDemoPedest_c::createHeap() { + mModelType = getModelType(); + if (mModelType == 0xF) { + mModelType = 0; + } + if (mModelType > 1) { + mModelType = 0; + } + + mRes = CurrentStageArcManager::sInstance->getData("g3d/stage.brres"); + RoomManager::bindStageResToFile(&mRes); + RoomManager::bindSkyCmnToResFile(&mRes); + nw4r::g3d::ResMdl mdl = mRes.GetResMdl(sMdlNames[mModelType]); + TRY_CREATE(mMdl.create(mdl, &heap_allocator, 0x120)); + + return true; +} + +int dAcOutaDemoPedest_c::create() { + CREATE_ALLOCATOR(dAcOutaDemoPedest_c); + + updateMatrix(); + mMdl.setLocalMtx(mWorldMtx); + mMdl.setPriorityDraw(0x1C, 9); + mVec3_c l, u; + mMdl.getBounds(&l, &u); + boundingBox.Set(l, u); + + return SUCCEEDED; +} + +int dAcOutaDemoPedest_c::doDelete() { + return SUCCEEDED; +} + +int dAcOutaDemoPedest_c::actorExecute() { + return SUCCEEDED; +} + +int dAcOutaDemoPedest_c::draw() { + drawModelType1(&mMdl); + return SUCCEEDED; +} diff --git a/src/REL/d/a/obj/d_a_obj_utajima_lv2.cpp b/src/REL/d/a/obj/d_a_obj_utajima_lv2.cpp index 97ff0a35..6f99a94a 100644 --- a/src/REL/d/a/obj/d_a_obj_utajima_lv2.cpp +++ b/src/REL/d/a/obj/d_a_obj_utajima_lv2.cpp @@ -1,3 +1,53 @@ #include "d/a/obj/d_a_obj_utajima_lv2.h" +#include "common.h" +#include "d/col/bg/d_bg_s.h" +#include "m/m_vec.h" +#include "toBeSorted/room_manager.h" + SPECIAL_ACTOR_PROFILE(OBJ_UTAJIMA_LV2, dAcOutajimaLv2_c, fProfile::OBJ_UTAJIMA_LV2, 0x1D5, 0, 3); + +const f32 dAcOutajimaLv2_c::someFloat = 100000.0f; + +bool dAcOutajimaLv2_c::createHeap() { + mRes = getOarcResFile("IslCave"); + RoomManager::bindStageResToFile(&mRes); + RoomManager::bindSkyCmnToResFile(&mRes); + nw4r::g3d::ResMdl mdl = mRes.GetResMdl("IslCave"); + TRY_CREATE(mMdl.create(mdl, &heap_allocator, 0x120)); + + void *dzb = getOarcFile("IslCave", "dzb/IslCave.dzb"); + void *plc = getOarcFile("IslCave", "dat/IslCave.plc"); + updateMatrix(); + mMdl.setLocalMtx(mWorldMtx); + TRY_CREATE(!mBgW.Set((cBgD_t *)dzb, (PLC *)plc, cBgW::MOVE_BG_e, &mWorldMtx, &mScale)); + mBgW.Lock(); + // TODO InitMapStuff says it already returns a bool + BOOL ok = mBgW.InitMapStuff(&heap_allocator); + return ok; +} + +int dAcOutajimaLv2_c::create() { + CREATE_ALLOCATOR(dAcOutajimaLv2_c); + + dBgS::GetInstance()->Regist(&mBgW, this); + dBgS::GetInstance()->RegistBg(&mBgW, this); + mMdl.setPriorityDraw(0x1C, 9); + boundingBox.Set(mVec3_c(-2800.0f, -4000.0f, -2600.0f), mVec3_c(2600.0f, 1900.0f, 2700.0f)); + mCullingDistance = 500000.0f; + return SUCCEEDED; +} + +int dAcOutajimaLv2_c::doDelete() { + dBgS::GetInstance()->UnRegist(&mBgW); + return SUCCEEDED; +} + +int dAcOutajimaLv2_c::actorExecute() { + return SUCCEEDED; +} + +int dAcOutajimaLv2_c::draw() { + drawModelType1(&mMdl); + return SUCCEEDED; +}