From 88805f9fcb8d15639c98b8e64caf7c3018b983be Mon Sep 17 00:00:00 2001 From: MS Date: Sat, 8 Jun 2024 19:17:33 -0400 Subject: [PATCH] TowTrack and LegoAct2 destructors (#1005) * Add some missing dtors * Add missing 'override' --- LEGO1/lego/legoomni/include/legoact2.h | 4 +++ LEGO1/lego/legoomni/include/towtrack.h | 1 + LEGO1/lego/legoomni/src/actors/towtrack.cpp | 7 ++++ LEGO1/lego/legoomni/src/entity/legoworld.cpp | 1 + LEGO1/lego/legoomni/src/worlds/legoact2.cpp | 38 ++++++++++++++++++++ 5 files changed, 51 insertions(+) diff --git a/LEGO1/lego/legoomni/include/legoact2.h b/LEGO1/lego/legoomni/include/legoact2.h index 735e31c2..504f0598 100644 --- a/LEGO1/lego/legoomni/include/legoact2.h +++ b/LEGO1/lego/legoomni/include/legoact2.h @@ -43,6 +43,8 @@ public: // SIZE 0x1154 class LegoAct2 : public LegoWorld { public: + ~LegoAct2() override; + MxLong Notify(MxParam& p_param) override; // vtable+0x04 MxResult Tickle() override; // vtable+0x08 MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 @@ -58,6 +60,8 @@ public: // LegoAct2::`scalar deleting destructor' private: + void FUN_10051900(); + Act2Brick m_bricks[10]; // 0x00f8 undefined m_unk0x10c0; // 0x10c0 undefined m_unk0x10c1; // 0x10c1 diff --git a/LEGO1/lego/legoomni/include/towtrack.h b/LEGO1/lego/legoomni/include/towtrack.h index ee91b5a5..e25e8137 100644 --- a/LEGO1/lego/legoomni/include/towtrack.h +++ b/LEGO1/lego/legoomni/include/towtrack.h @@ -67,6 +67,7 @@ public: class TowTrack : public IslePathActor { public: TowTrack(); + ~TowTrack() override; // FUNCTION: LEGO1 0x1004c7c0 inline const char* ClassName() const override // vtable+0x0c diff --git a/LEGO1/lego/legoomni/src/actors/towtrack.cpp b/LEGO1/lego/legoomni/src/actors/towtrack.cpp index 461777cf..c487def5 100644 --- a/LEGO1/lego/legoomni/src/actors/towtrack.cpp +++ b/LEGO1/lego/legoomni/src/actors/towtrack.cpp @@ -1,5 +1,6 @@ #include "towtrack.h" +#include "legocontrolmanager.h" #include "legogamestate.h" #include "legovariables.h" #include "legoworld.h" @@ -25,6 +26,12 @@ TowTrack::TowTrack() m_unk0x178 = 1.0; } +// FUNCTION: LEGO1 0x1004c970 +TowTrack::~TowTrack() +{ + ControlManager()->Unregister(this); +} + // FUNCTION: LEGO1 0x1004c9e0 // FUNCTION: BETA10 0x100f6bf1 MxResult TowTrack::Create(MxDSAction& p_dsAction) diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index fecff1de..e2d54b72 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -477,6 +477,7 @@ void LegoWorld::Add(MxCore* p_object) } // FUNCTION: LEGO1 0x10020f10 +// FUNCTION: BETA10 0x100dad2a void LegoWorld::Remove(MxCore* p_object) { if (p_object) { diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index eb44f2b0..e09eb88d 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -1,5 +1,12 @@ #include "legoact2.h" +#include "legoanimationmanager.h" +#include "legoinputmanager.h" +#include "misc.h" +#include "mxmisc.h" +#include "mxnotificationmanager.h" +#include "mxticklemanager.h" + DECOMP_SIZE_ASSERT(LegoAct2, 0x1154) DECOMP_SIZE_ASSERT(LegoAct2State, 0x10) @@ -9,6 +16,23 @@ MxBool LegoAct2::VTable0x5c() return TRUE; } +// FUNCTION: LEGO1 0x1004fe40 +// FUNCTION: BETA10 0x1003a6f0 +LegoAct2::~LegoAct2() +{ + if (m_unk0x10c2) { + TickleManager()->UnregisterClient(this); + } + + FUN_10051900(); + InputManager()->UnRegister(this); + if (CurrentActor()) { + Remove(CurrentActor()); + } + + NotificationManager()->Unregister(this); +} + // STUB: LEGO1 0x1004ff20 MxResult LegoAct2::Create(MxDSAction& p_dsAction) { @@ -42,6 +66,20 @@ void LegoAct2::Enable(MxBool p_enable) // TODO } +// FUNCTION: LEGO1 0x10051900 +// FUNCTION: BETA10 0x1003bed1 +void LegoAct2::FUN_10051900() +{ + if (AnimationManager()) { + AnimationManager()->Suspend(); + AnimationManager()->Resume(); + AnimationManager()->FUN_10060540(FALSE); + AnimationManager()->FUN_100604d0(FALSE); + AnimationManager()->EnableCamAnims(FALSE); + AnimationManager()->FUN_1005f6d0(FALSE); + } +} + // STUB: LEGO1 0x100519c0 void LegoAct2::VTable0x60() {