diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index bcba7253..82369de1 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -725,6 +725,9 @@ d/tg/d_t_force_get_flag.cpp: d/a/obj/d_a_obj_water_spout.cpp: .text start:0x802D5C00 end:0x802D67F8 .ctors start:0x804DB8AC end:0x804DB8B0 + .data start:0x80540FE0 end:0x805411A8 + .sdata2 start:0x8057CB40 end:0x8057CB58 + .bss start:0x805B8190 end:0x805B81D0 d/tg/d_t_siren_tag.cpp: .text start:0x802D6800 end:0x802D84F8 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index cbfbb8ff..82bbe0ad 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -16998,40 +16998,40 @@ fn_802D5B40 = .text:0x802D5B40; // type:function size:0x10 fn_802D5B50 = .text:0x802D5B50; // type:function size:0xC TgForceGetFlag__dtor = .text:0x802D5B60; // type:function size:0x7C TgForceGetFlag__initList = .text:0x802D5BE0; // type:function size:0x14 -AcOwaterSpout__ctor = .text:0x802D5C00; // type:function size:0x14C -fn_802D5D50 = .text:0x802D5D50; // type:function size:0x58 -fn_802D5DB0 = .text:0x802D5DB0; // type:function size:0x6C -fn_802D5E20 = .text:0x802D5E20; // type:function size:0xA0 -fn_802D5EC0 = .text:0x802D5EC0; // type:function size:0xA4 -fn_802D5F70 = .text:0x802D5F70; // type:function size:0x114 -AcOwaterSpout__init = .text:0x802D6090; // type:function size:0x138 -fn_802D61D0 = .text:0x802D61D0; // type:function size:0x10 -fn_802D61E0 = .text:0x802D61E0; // type:function size:0x8 -fn_802D61F0 = .text:0x802D61F0; // type:function size:0x7C -fn_802D6270 = .text:0x802D6270; // type:function size:0x10 -AcOwaterSpout__draw = .text:0x802D6280; // type:function size:0x28 -AcOwaterSpout__stateWaitEnter = .text:0x802D62B0; // type:function size:0x38 -AcOwaterSpout__stateWaitUpdate = .text:0x802D62F0; // type:function size:0x40 -AcOwaterSpout__stateWaitLeave = .text:0x802D6330; // type:function size:0x4 -fn_802D6340 = .text:0x802D6340; // type:function size:0xE4 -fn_802D6430 = .text:0x802D6430; // type:function size:0x10 -fn_802D6440 = .text:0x802D6440; // type:function size:0x60 -fn_802D64A0 = .text:0x802D64A0; // type:function size:0xC -fn_802D64B0 = .text:0x802D64B0; // type:function size:0x1C -fn_802D64D0 = .text:0x802D64D0; // type:function size:0x1C -fn_802D64F0 = .text:0x802D64F0; // type:function size:0x1C -fn_802D6510 = .text:0x802D6510; // type:function size:0x10 -fn_802D6520 = .text:0x802D6520; // type:function size:0x10 -fn_802D6530 = .text:0x802D6530; // type:function size:0x10 -fn_802D6540 = .text:0x802D6540; // type:function size:0x10 -fn_802D6550 = .text:0x802D6550; // type:function size:0x10 -fn_802D6560 = .text:0x802D6560; // type:function size:0x10 -fn_802D6570 = .text:0x802D6570; // type:function size:0x30 -fn_802D65A0 = .text:0x802D65A0; // type:function size:0x30 -fn_802D65D0 = .text:0x802D65D0; // type:function size:0x30 -AcOwaterSpout__initState = .text:0x802D6600; // type:function size:0x10C -AcOwaterSpout__dtor = .text:0x802D6710; // type:function size:0x58 -fn_802D6770 = .text:0x802D6770; // type:function size:0x88 +dAcOwaterSpout_c_classInit__Fv = .text:0x802D5C00; // type:function size:0x14C +__dt__29sFState_c<16dAcOwaterSpout_c>Fv = .text:0x802D5D50; // type:function size:0x58 +__dt__32sFStateFct_c<16dAcOwaterSpout_c>Fv = .text:0x802D5DB0; // type:function size:0x6C +__dt__85sStateMgr_c<16dAcOwaterSpout_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x802D5E20; // type:function size:0xA0 +__dt__55sFStateMgr_c<16dAcOwaterSpout_c,20sStateMethodUsr_FI_c>Fv = .text:0x802D5EC0; // type:function size:0xA4 +createHeap__16dAcOwaterSpout_cFv = .text:0x802D5F70; // type:function size:0x114 +create__16dAcOwaterSpout_cFv = .text:0x802D6090; // type:function size:0x138 +changeState__85sStateMgr_c<16dAcOwaterSpout_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x802D61D0; // type:function size:0x10 +doDelete__16dAcOwaterSpout_cFv = .text:0x802D61E0; // type:function size:0x8 +actorExecute__16dAcOwaterSpout_cFv = .text:0x802D61F0; // type:function size:0x7C +executeState__85sStateMgr_c<16dAcOwaterSpout_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x802D6270; // type:function size:0x10 +draw__16dAcOwaterSpout_cFv = .text:0x802D6280; // type:function size:0x28 +initializeState_Wait__16dAcOwaterSpout_cFv = .text:0x802D62B0; // type:function size:0x38 +executeState_Wait__16dAcOwaterSpout_cFv = .text:0x802D62F0; // type:function size:0x40 +finalizeState_Wait__16dAcOwaterSpout_cFv = .text:0x802D6330; // type:function size:0x4 +__dt__16dAcOwaterSpout_cFv = .text:0x802D6340; // type:function size:0xE4 +getStateID__85sStateMgr_c<16dAcOwaterSpout_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x802D6430; // type:function size:0x10 +build__32sFStateFct_c<16dAcOwaterSpout_c>FRC12sStateIDIf_c = .text:0x802D6440; // type:function size:0x60 +dispose__32sFStateFct_c<16dAcOwaterSpout_c>FRP10sStateIf_c = .text:0x802D64A0; // type:function size:0xC +initialize__29sFState_c<16dAcOwaterSpout_c>Fv = .text:0x802D64B0; // type:function size:0x1C +execute__29sFState_c<16dAcOwaterSpout_c>Fv = .text:0x802D64D0; // type:function size:0x1C +finalize__29sFState_c<16dAcOwaterSpout_c>Fv = .text:0x802D64F0; // type:function size:0x1C +initializeState__85sStateMgr_c<16dAcOwaterSpout_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x802D6510; // type:function size:0x10 +finalizeState__85sStateMgr_c<16dAcOwaterSpout_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x802D6520; // type:function size:0x10 +refreshState__85sStateMgr_c<16dAcOwaterSpout_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x802D6530; // type:function size:0x10 +getState__85sStateMgr_c<16dAcOwaterSpout_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x802D6540; // type:function size:0x10 +getNewStateID__85sStateMgr_c<16dAcOwaterSpout_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x802D6550; // type:function size:0x10 +getOldStateID__85sStateMgr_c<16dAcOwaterSpout_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x802D6560; // type:function size:0x10 +finalizeState__31sFStateID_c<16dAcOwaterSpout_c>CFR16dAcOwaterSpout_c = .text:0x802D6570; // type:function size:0x30 +executeState__31sFStateID_c<16dAcOwaterSpout_c>CFR16dAcOwaterSpout_c = .text:0x802D65A0; // type:function size:0x30 +initializeState__31sFStateID_c<16dAcOwaterSpout_c>CFR16dAcOwaterSpout_c = .text:0x802D65D0; // type:function size:0x30 +__sinit_\d_a_obj_water_spout_cpp = .text:0x802D6600; // type:function size:0x10C scope:local +__dt__31sFStateID_c<16dAcOwaterSpout_c>Fv = .text:0x802D6710; // type:function size:0x58 +isSameName__31sFStateID_c<16dAcOwaterSpout_c>CFPCc = .text:0x802D6770; // type:function size:0x88 TgSirenTag__ctor = .text:0x802D6800; // type:function size:0x1D4 fn_802D69E0 = .text:0x802D69E0; // type:function size:0x58 fn_802D6A40 = .text:0x802D6A40; // type:function size:0x6C @@ -35661,14 +35661,14 @@ lbl_80540F44 = .data:0x80540F44; // type:object size:0x14 data:string g_profile_TAG_FORCE_GET_FLAG = .data:0x80540F58; // type:object size:0x10 TgForceGetFlag__vtable = .data:0x80540F68; // type:object size:0x78 g_profile_OBJ_WATER_SPOUT = .data:0x80540FE0; // type:object size:0x10 -lbl_80540FF0 = .data:0x80540FF0; // type:object size:0x10 -lbl_80541000 = .data:0x80541000; // type:object size:0x20 -AcOwaterSpout__vtable = .data:0x80541020; // type:object size:0x80 -lbl_805410A0 = .data:0x805410A0; // type:object size:0x30 -lbl_805410D0 = .data:0x805410D0; // type:object size:0x30 -lbl_80541100 = .data:0x80541100; // type:object size:0x18 -lbl_80541118 = .data:0x80541118; // type:object size:0x5C -lbl_80541174 = .data:0x80541174; // type:object size:0x34 +lbl_80540FF0 = .data:0x80540FF0; // type:object size:0xF data:string +lbl_80541000 = .data:0x80541000; // type:object size:0x1E data:string +__vt__16dAcOwaterSpout_c = .data:0x80541020; // type:object size:0x80 +__vt__55sFStateMgr_c<16dAcOwaterSpout_c,20sStateMethodUsr_FI_c> = .data:0x805410A0; // type:object size:0x30 +__vt__85sStateMgr_c<16dAcOwaterSpout_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c> = .data:0x805410D0; // type:object size:0x30 +__vt__32sFStateFct_c<16dAcOwaterSpout_c> = .data:0x80541100; // type:object size:0x14 +__vt__29sFState_c<16dAcOwaterSpout_c> = .data:0x80541118; // type:object size:0x18 +__vt__31sFStateID_c<16dAcOwaterSpout_c> = .data:0x80541174; // type:object size:0x34 g_profile_SIREN_TAG = .data:0x805411A8; // type:object size:0x2C lbl_805411D4 = .data:0x805411D4; // type:object size:0x10 lbl_805411E4 = .data:0x805411E4; // type:object size:0xC data:string @@ -45810,7 +45810,7 @@ lbl_8057CB40 = .sdata2:0x8057CB40; // type:object size:0x4 data:float lbl_8057CB44 = .sdata2:0x8057CB44; // type:object size:0x4 data:float lbl_8057CB48 = .sdata2:0x8057CB48; // type:object size:0x4 data:float lbl_8057CB4C = .sdata2:0x8057CB4C; // type:object size:0x4 data:float -lbl_8057CB50 = .sdata2:0x8057CB50; // type:object size:0x8 data:float +lbl_8057CB50 = .sdata2:0x8057CB50; // type:object size:0x4 data:float lbl_8057CB58 = .sdata2:0x8057CB58; // type:object size:0x4 data:float lbl_8057CB5C = .sdata2:0x8057CB5C; // type:object size:0x4 data:float lbl_8057CB60 = .sdata2:0x8057CB60; // type:object size:0x4 data:float @@ -49147,8 +49147,8 @@ LytControlGame__StateID_DelRes2 = .bss:0x805B8000; // type:object size:0x40 data lbl_805B8040 = .bss:0x805B8040; // type:object size:0xE0 data:float lbl_805B8120 = .bss:0x805B8120; // type:object size:0x10 lbl_805B8130 = .bss:0x805B8130; // type:object size:0x60 data:4byte -lbl_805B8190 = .bss:0x805B8190; // type:object size:0x10 -AcOwaterSpout__STATE_WAIT = .bss:0x805B81A0; // type:object size:0x30 data:4byte +lbl_805B8190 = .bss:0x805B8190; // type:object size:0xC +StateID_Wait__16dAcOwaterSpout_c = .bss:0x805B81A0; // type:object size:0x30 data:4byte lbl_805B81D0 = .bss:0x805B81D0; // type:object size:0x10 TgSirenTag__StateID_Wait = .bss:0x805B81E0; // type:object size:0x40 data:4byte TgSirenTag__StateID_Demo = .bss:0x805B8220; // type:object size:0x40 data:4byte diff --git a/configure.py b/configure.py index 27ae613c..bb2bc29b 100644 --- a/configure.py +++ b/configure.py @@ -345,6 +345,7 @@ def nw4rLib(lib_name, objects, extra_cflags=[]): Object(NonMatching, "d/a/obj/d_a_obj_tbox.cpp"), Object(NonMatching, "d/a/obj/d_a_obj_time_area.cpp"), Object(Matching, "d/a/obj/d_a_obj_switch.cpp"), + Object(Matching, "d/a/obj/d_a_obj_water_spout.cpp"), Object(Matching, "d/tg/d_t_switch.cpp"), Object(Matching, "toBeSorted/arc_managers/current_stage_arc_manager.cpp"), Object(Matching, "toBeSorted/arc_managers/oarc_manager.cpp"), diff --git a/include/d/a/obj/d_a_obj_water_spout.h b/include/d/a/obj/d_a_obj_water_spout.h new file mode 100644 index 00000000..c0faf6e8 --- /dev/null +++ b/include/d/a/obj/d_a_obj_water_spout.h @@ -0,0 +1,33 @@ +#ifndef D_A_OBJ_WATER_SPOUT_H +#define D_A_OBJ_WATER_SPOUT_H + +#include "d/a/obj/d_a_obj_base.h" +#include "m/m3d/m_anmmatclr.h" +#include "m/m3d/m_anmmdl.h" +#include "m/m3d/m_anmtexsrt.h" +#include "nw4r/g3d/g3d_resfile.h" +#include "s/s_State.hpp" +#include "s/s_StateMgr.hpp" + +class dAcOwaterSpout_c : public dAcObjBase_c { +public: + dAcOwaterSpout_c() : mStateMgr(*this, sStateID::null) {} + virtual ~dAcOwaterSpout_c() {} + + virtual bool createHeap() override; + virtual int create() override; + virtual int doDelete() override; + virtual int actorExecute() override; + virtual int draw() override; + + STATE_FUNC_DECLARE(dAcOwaterSpout_c, Wait); + +private: + /* 0x330 */ nw4r::g3d::ResFile mResFile; + /* 0x334 */ m3d::mdlAnmChr mMdl; + /* 0x39C */ m3d::anmTexSrt_c mAnmSrt; + /* 0x3C8 */ m3d::anmMatClr_c mAnmClr; + /* 0x3F4 */ STATE_MGR_DECLARE(dAcOwaterSpout_c); +}; + +#endif diff --git a/include/m/m3d/m_anmmdl.h b/include/m/m3d/m_anmmdl.h index 71ac733f..39d53064 100644 --- a/include/m/m3d/m_anmmdl.h +++ b/include/m/m3d/m_anmmdl.h @@ -45,6 +45,10 @@ class mdlAnmChr { return mMdl; } + inline anmChr_c &getAnm() { + return mAnm; + } + private: nw4r::g3d::ResFile mMdlFile; nw4r::g3d::ResFile mAnmFile; diff --git a/src/d/a/obj/d_a_obj_water_spout.cpp b/src/d/a/obj/d_a_obj_water_spout.cpp new file mode 100644 index 00000000..981d3a86 --- /dev/null +++ b/src/d/a/obj/d_a_obj_water_spout.cpp @@ -0,0 +1,76 @@ +#include "d/a/obj/d_a_obj_water_spout.h" + +#include "common.h" +#include "d/a/obj/d_a_obj_base.h" +#include "m/m3d/m_fanm.h" +#include "m/m_vec.h" +#include "nw4r/g3d/g3d_resanmclr.h" +#include "nw4r/g3d/g3d_resanmtexsrt.h" +#include "nw4r/g3d/g3d_resmdl.h" +#include "s/s_State.hpp" + + +SPECIAL_ACTOR_PROFILE(OBJ_WATER_SPOUT, dAcOwaterSpout_c, fProfile::OBJ_WATER_SPOUT, 0x1DA, 0, 6); + +STATE_DEFINE(dAcOwaterSpout_c, Wait); + +bool dAcOwaterSpout_c::createHeap() { + void *data = getOarcResFile("FX_WaterColumn"); + mResFile = data; + nw4r::g3d::ResMdl mdl = mResFile.GetResMdl("FX_WaterColumn"); + TRY_CREATE(mMdl.create(data, "FX_WaterColumn", "FX_WaterColumn", &heap_allocator, 0x32C)); + nw4r::g3d::ResAnmTexSrt anmSrt = mResFile.GetResAnmTexSrt("FX_WaterColumn"); + TRY_CREATE(mAnmSrt.create(mdl, anmSrt, &heap_allocator, nullptr, 1)); + nw4r::g3d::ResAnmClr anmClr = mResFile.GetResAnmClr("FX_WaterColumn"); + TRY_CREATE(mAnmClr.create(mdl, anmClr, &heap_allocator, nullptr, 1)); + return true; +} + +int dAcOwaterSpout_c::create() { + CREATE_ALLOCATOR(dAcOwaterSpout_c); + mMdl.setAnm("FX_WaterColumn", m3d::PLAY_MODE_4); + mMdl.getModel().setAnm(mAnmSrt); + mMdl.getModel().setAnm(mAnmClr); + updateMatrix(); + mMdl.getModel().setLocalMtx(mWorldMtx); + mStateMgr.changeState(StateID_Wait); + if (params == 1) { + mScale.y *= 4.0f; + } + mMdl.getModel().setScale(mScale); + boundingBox.Set(mVec3_c(-400.0f, -250.0f, -400.0f), mVec3_c(400.0f, 250.0f, 400.0f)); + return SUCCEEDED; +} + +int dAcOwaterSpout_c::doDelete() { + return SUCCEEDED; +} + +int dAcOwaterSpout_c::actorExecute() { + mStateMgr.executeState(); + mMdl.play(); + mAnmSrt.play(); + mAnmClr.play(); + return SUCCEEDED; +} + +int dAcOwaterSpout_c::draw() { + drawModelType1(&mMdl.getModel()); + return SUCCEEDED; +} + +extern "C" void fn_800298B0(u16, mVec3_c *, mVec3_c *, mVec3_c *, u32, u32, u32, u32); +extern "C" u16 PARTICLE_RESOURCE_ID_MAPPING_213_; + +void dAcOwaterSpout_c::initializeState_Wait() { + if (params == 1) { + return; + } + fn_800298B0(PARTICLE_RESOURCE_ID_MAPPING_213_, &position, nullptr, &mScale, 0, 0, 0, 0); +} +void dAcOwaterSpout_c::executeState_Wait() { + if (mMdl.getAnm().isStop()) { + deleteRequest(); + } +} +void dAcOwaterSpout_c::finalizeState_Wait() {}