From 578e48ce52f5e54c9d8d81c0e20fd119b9fe98db Mon Sep 17 00:00:00 2001 From: Ramen2X <64166386+Ramen2X@users.noreply.github.com> Date: Thu, 18 Jan 2024 21:00:55 -0500 Subject: [PATCH] implement/match InfoCenter::~InfoCenter() (#457) --- LEGO1/lego/legoomni/include/infocenterstate.h | 8 ++++--- .../legoomni/src/common/legogamestate.cpp | 2 +- .../legoomni/src/infocenter/infocenter.cpp | 24 +++++++++++++++++-- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/LEGO1/lego/legoomni/include/infocenterstate.h b/LEGO1/lego/legoomni/include/infocenterstate.h index aaa45f56..4f92b508 100644 --- a/LEGO1/lego/legoomni/include/infocenterstate.h +++ b/LEGO1/lego/legoomni/include/infocenterstate.h @@ -3,6 +3,7 @@ #include "decomp.h" #include "legostate.h" +#include "mxstillpresenter.h"; // VTABLE: LEGO1 0x100d93a8 // SIZE 0x94 @@ -27,7 +28,8 @@ class InfocenterState : public LegoState { // FUNCTION: LEGO1 0x10071830 virtual MxBool VTable0x14() override { return FALSE; } // vtable+0x14 - inline MxU32 GetInfocenterBufferElement(MxS32 p_index) { return m_buffer[p_index]; } + inline MxS16 GetInfocenterBufferSize() { return sizeof(m_buffer) / sizeof(m_buffer[0]); } + inline MxStillPresenter* GetInfocenterBufferElement(MxS32 p_index) { return m_buffer[p_index]; } inline MxU32 GetUnknown0x74() { return m_unk0x74; } inline void SetUnknown0x74(MxU32 p_unk0x74) { m_unk0x74 = p_unk0x74; } @@ -65,8 +67,8 @@ class InfocenterState : public LegoState { */ undefined m_pad[0x6c]; - MxU32 m_unk0x74; // 0x74 - MxU32 m_buffer[7]; // 0x78 + MxU32 m_unk0x74; // 0x74 + MxStillPresenter* m_buffer[7]; // 0x78 }; #endif // INFOCENTERSTATE_H diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index 22ad48d0..0bb0b066 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -112,7 +112,7 @@ MxResult LegoGameState::Save(MxULong p_slot) MxResult result; InfocenterState* infocenterState = (InfocenterState*) GameState()->GetState("InfocenterState"); - if (!infocenterState || infocenterState->GetInfocenterBufferElement(0) == 0) + if (!infocenterState || infocenterState->GetInfocenterBufferElement(0) == NULL) result = SUCCESS; else { result = FAILURE; diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp index 16d1e507..68090a69 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp @@ -11,6 +11,7 @@ #include "mxbackgroundaudiomanager.h" #include "mxnotificationmanager.h" #include "mxstillpresenter.h" +#include "mxticklemanager.h" #include "mxtransitionmanager.h" DECOMP_SIZE_ASSERT(Infocenter, 0x1d8) @@ -46,10 +47,29 @@ Infocenter::Infocenter() m_unk0x1d6 = 0; } -// STUB: LEGO1 0x1006ec90 +// FUNCTION: LEGO1 0x1006ec90 Infocenter::~Infocenter() { - // TODO + BackgroundAudioManager()->Stop(); + + MxS16 i = 0; + do { + if (m_infocenterState->GetInfocenterBufferElement(i) != NULL) { + m_infocenterState->GetInfocenterBufferElement(i)->Enable(FALSE); + } + i++; + } while (i < m_infocenterState->GetInfocenterBufferSize()); + + ControlManager()->Unregister(this); + + InputManager()->UnRegister(this); + if (InputManager()->GetWorld() == this) { + InputManager()->ClearWorld(); + } + + NotificationManager()->Unregister(this); + + TickleManager()->UnregisterClient(this); } // STUB: LEGO1 0x1006ed90