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 f368bd1d..bf8e294f 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 -lbl_205_rodata_0 = .rodata:0x00000000; // type:object size:0x4 data:float +@20562 = .rodata:0x00000000; // type:object size:0x4 data:float g_profile_GATE2GND_TAG = .data:0x00000000; // type:object size:0x10 -lbl_205_data_10 = .data:0x00000010; // type:object size:0xC +@20583 = .data:0x00000010; // type:object size:0xC __vt__17dTgGateToGround_c = .data:0x0000001C; // type:object size:0x74 diff --git a/include/d/d_camera.h b/include/d/d_camera.h index ad114811..7464f339 100644 --- a/include/d/d_camera.h +++ b/include/d/d_camera.h @@ -6,6 +6,7 @@ extern "C" bool fn_80081FE0(void *, const char *); extern "C" bool fn_800918E0(void *, s32, s16); +extern "C" void fn_80080960(void *, int, int, int, int); class dCamera_c : public dBase_c { public: diff --git a/include/d/t/d_t_gate_to_ground.h b/include/d/t/d_t_gate_to_ground.h index 7bb9eecc..e0fa770c 100644 --- a/include/d/t/d_t_gate_to_ground.h +++ b/include/d/t/d_t_gate_to_ground.h @@ -1,11 +1,15 @@ #ifndef D_T_GATE_TO_GROUND_H #define D_T_GATE_TO_GROUND_H +#include "common.h" #include "d/a/d_a_base.h" +#include "m/m_mtx.h" +#include "toBeSorted/actor_event.h" +#include "toBeSorted/event.h" class dTgGateToGround_c : public dAcBase_c { public: - dTgGateToGround_c() {} + dTgGateToGround_c() : mEventRelated(*this, nullptr) {} virtual ~dTgGateToGround_c() {} virtual int create() override; @@ -15,6 +19,12 @@ public: virtual int draw() override; // fn_205_2F0 private: + ActorEventRelated mEventRelated; + /* 0x14c */ mMtx_c matrix; + int delayFrames; + /* 0x180 */ s16 params_FF_FF_00_00; + /* 0x182 */ u8 params_00_00_FF_00; + /* 0x183 */ u8 params_00_00_00_FF; }; #endif diff --git a/src/REL/d/t/d_t_gate_to_ground.cpp b/src/REL/d/t/d_t_gate_to_ground.cpp index 4dd24d24..d02610a7 100644 --- a/src/REL/d/t/d_t_gate_to_ground.cpp +++ b/src/REL/d/t/d_t_gate_to_ground.cpp @@ -1,19 +1,75 @@ #include "d/t/d_t_gate_to_ground.h" +#include "common.h" +#include "d/a/d_a_player.h" +#include "d/d_camera.h" +#include "d/d_player_act.h" +#include "d/d_sc_game.h" +#include "d/flag/storyflag_manager.h" #include "f/f_base.h" - +#include "toBeSorted/actor_event.h" +#include "toBeSorted/area_math.h" +#include "toBeSorted/event.h" SPECIAL_ACTOR_PROFILE(GATE2GND_TAG, dTgGateToGround_c, fProfile::GATE2GND_TAG, 0x22, 0, 0); -int dTgGateToGround_c::create() {} +int dTgGateToGround_c::create() { + matrixCreateFromPosRotYScale(matrix, position, rotation.y, mScale, nullptr, 0.0f); + + delayFrames = 0; + + union { + u32 val; + struct { + u16 a; + u8 b; + u8 c; + }; + } v; + v.val = params; + params_FF_FF_00_00 = v.a; + params_00_00_FF_00 = v.b; + params_00_00_00_FF = v.c; + + return SUCCEEDED; +} int dTgGateToGround_c::doDelete() { return SUCCEEDED; } -int dTgGateToGround_c::actorExecute() {} +int dTgGateToGround_c::actorExecute() { + dAcPy_c *player; + dCamera_c *camera; -int dTgGateToGround_c::actorExecuteInEvent() {} + if (params_FF_FF_00_00 == -1 || StoryflagManager::sInstance->getCounterOrFlag(params_FF_FF_00_00) != 0) { + player = dAcPy_c::LINK; + if (checkIfVec3fInMatrix(matrix, player->position)) { + if (player->getRidingActorType() == dAcPy_c::RIDING_LOFTWING) { + if (params_00_00_00_FF != -1) { + camera = dScGame_c::getCamera(0); + fn_80080960(camera->getField_0xD98(), params_00_00_00_FF, 0, roomid, 0); + } + delayFrames = 0; + } else if (delayFrames < 16) { + ++delayFrames; + } else { + Event e = Event("CloudHole", 100, 0, 0, 0); + mEventRelated.scheduleEvent(e, 0); + } + } else { + delayFrames = 0; + } + } + return SUCCEEDED; +} + +int dTgGateToGround_c::actorExecuteInEvent() { + if (mEventRelated.isThisActorInEvent() != 0) { + mEventRelated.advanceNext(); + } + return SUCCEEDED; +} int dTgGateToGround_c::draw() { return SUCCEEDED;