From 9525f8e9e5c20dccd8a9848fb6a3625f88c3e803 Mon Sep 17 00:00:00 2001 From: Elijah Thomas <42302100+elijah-thomas774@users.noreply.github.com> Date: Mon, 11 Nov 2024 18:21:56 -0500 Subject: [PATCH] d_t_telop OK (#100) --- config/SOUE01/rels/d_t_telopNP/splits.txt | 1 + config/SOUE01/rels/d_t_telopNP/symbols.txt | 10 +++--- configure.py | 2 +- include/d/t/d_t_telop.h | 23 ++++++++++-- src/REL/d/t/d_t_telop.cpp | 41 ++++++++++++++++++++++ 5 files changed, 69 insertions(+), 8 deletions(-) diff --git a/config/SOUE01/rels/d_t_telopNP/splits.txt b/config/SOUE01/rels/d_t_telopNP/splits.txt index d55383883..6e099d1b6 100644 --- a/config/SOUE01/rels/d_t_telopNP/splits.txt +++ b/config/SOUE01/rels/d_t_telopNP/splits.txt @@ -10,3 +10,4 @@ REL/executor.c: REL/d/t/d_t_telop.cpp: .text start:0x00000070 end:0x000002AC + .data start:0x00000000 end:0x00000084 diff --git a/config/SOUE01/rels/d_t_telopNP/symbols.txt b/config/SOUE01/rels/d_t_telopNP/symbols.txt index 10db84519..2d8af22fb 100644 --- a/config/SOUE01/rels/d_t_telopNP/symbols.txt +++ b/config/SOUE01/rels/d_t_telopNP/symbols.txt @@ -2,12 +2,12 @@ _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 dTgTelop_c_classInit__Fv = .text:0x00000070; // type:function size:0x4C -TgTelop__init = .text:0x000000C0; // type:function size:0x48 -fn_563_110 = .text:0x00000110; // type:function size:0x8 -TgTelop__update = .text:0x00000120; // type:function size:0x114 -fn_563_240 = .text:0x00000240; // type:function size:0x8 +create__10dTgTelop_cFv = .text:0x000000C0; // type:function size:0x48 +doDelete__10dTgTelop_cFv = .text:0x00000110; // type:function size:0x8 +actorExecute__10dTgTelop_cFv = .text:0x00000120; // type:function size:0x114 +draw__10dTgTelop_cFv = .text:0x00000240; // type:function size:0x8 __dt__10dTgTelop_cFv = .text:0x00000250; // type:function size:0x5C _ctors = .ctors:0x00000000; // type:label scope:global _dtors = .dtors:0x00000000; // type:label scope:global g_profile_TLP_TAG = .data:0x00000000; // type:object size:0x10 -lbl_563_section4_10 = .data:0x00000010; // type:object size:0x74 +__vt__10dTgTelop_c = .data:0x00000010; // type:object size:0x74 diff --git a/configure.py b/configure.py index c2a21ea94..70f0edd6a 100644 --- a/configure.py +++ b/configure.py @@ -1869,7 +1869,7 @@ def nw4rLib(lib_name, objects, extra_cflags=[]): Rel(NonMatching, "d_t_sword_battle_game", "REL/d/t/d_t_sword_battle_game.cpp"), Rel(Matching, "d_t_sw_area", "REL/d/t/d_t_sw_area.cpp"), Rel(Matching, "d_t_tackle", "REL/d/t/d_t_tackle.cpp"), - Rel(NonMatching, "d_t_telop", "REL/d/t/d_t_telop.cpp"), + Rel(Matching, "d_t_telop", "REL/d/t/d_t_telop.cpp"), Rel(Matching, "d_t_timer", "REL/d/t/d_t_timer.cpp"), Rel(Matching, "d_t_time_area_check", "REL/d/t/d_t_time_area_check.cpp"), Rel(Matching, "d_t_time_door_beam", "REL/d/t/d_t_time_door_beam.cpp"), diff --git a/include/d/t/d_t_telop.h b/include/d/t/d_t_telop.h index b08525277..5580b4e6f 100644 --- a/include/d/t/d_t_telop.h +++ b/include/d/t/d_t_telop.h @@ -1,14 +1,33 @@ #ifndef D_T_TELOP_H #define D_T_TELOP_H -#include "d/a/d_a_base.h" +#include "d/flag/sceneflag_manager.h" +#include "d/t/d_tg.h" -class dTgTelop_c : public dAcBase_c { +class dTgTelop_c : public dTg_c { public: dTgTelop_c() {} virtual ~dTgTelop_c() {} + virtual int create() override; + virtual int doDelete() override; + virtual int draw() override; + virtual int actorExecute() override; + + u16 getArea() const { + return params >> 8 & 0xFF; + } + u8 getSceneflag() const { + return params >> 16 & 0xFF; + } + u8 getTempflag() const { + return params >> 24 & 0xFF; + } + private: + /* 0xFC */ u16 mArea; + /* 0xFD */ u8 mSceneflag; + /* 0xFF */ u8 mTempflag; }; #endif diff --git a/src/REL/d/t/d_t_telop.cpp b/src/REL/d/t/d_t_telop.cpp index ab4f8ce05..eb2ee61cc 100644 --- a/src/REL/d/t/d_t_telop.cpp +++ b/src/REL/d/t/d_t_telop.cpp @@ -1,3 +1,44 @@ #include "d/t/d_t_telop.h" +#include "d/lyt/d_lyt_area_caption.h" +#include "toBeSorted/event_manager.h" + SPECIAL_ACTOR_PROFILE(TLP_TAG, dTgTelop_c, fProfile::TLP_TAG, 0x28C, 0, 0); + +int dTgTelop_c::create() { + mArea = getArea(); + mSceneflag = getSceneflag() != 0xFF ? getSceneflag() : 0xFF; + mTempflag = getTempflag() != 0xFF ? getTempflag() : 0xFF; + + return SUCCEEDED; +} + +int dTgTelop_c::doDelete() { + return SUCCEEDED; +} + +int dTgTelop_c::actorExecute() { + if (EventManager::isInEvent()) { + return SUCCEEDED; + } + + if (mTempflag != 0xFF && SceneflagManager::sInstance->checkBoolFlag(roomid, mTempflag)) { + return SUCCEEDED; + } + + if (mSceneflag != 0xFF && !SceneflagManager::sInstance->checkBoolFlag(roomid, mSceneflag)) { + return SUCCEEDED; + } + + if (mTempflag != 0xFF) { + SceneflagManager::sInstance->setFlag(roomid, mTempflag); + } + + dLytAreaCaption_c::setArea(mArea); + deleteRequest(); + return SUCCEEDED; +} + +int dTgTelop_c::draw() { + return SUCCEEDED; +}