From 53caf30ab0fc11ccd8bf9f8be523217d54f49273 Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Thu, 14 Dec 2023 18:24:21 -0500 Subject: [PATCH] Isle & Radio constructors (#330) --- LEGO1/isle.cpp | 24 ++++++++++++++++++++++-- LEGO1/isle.h | 18 ++++++++++++++++-- LEGO1/radio.cpp | 29 +++++++++++++++++++++++++++++ LEGO1/radio.h | 8 ++++++++ 4 files changed, 75 insertions(+), 4 deletions(-) diff --git a/LEGO1/isle.cpp b/LEGO1/isle.cpp index dc81f0be..ec71d083 100644 --- a/LEGO1/isle.cpp +++ b/LEGO1/isle.cpp @@ -1,7 +1,27 @@ #include "isle.h" -// STUB: LEGO1 0x10030820 +#include "legoomni.h" +#include "mxnotificationmanager.h" + +DECOMP_SIZE_ASSERT(Isle, 0x140); + +// FUNCTION: LEGO1 0x10030820 Isle::Isle() { - // TODO + m_unk0xfc = 0; + m_unk0x100 = 0; + m_unk0x104 = 0; + m_unk0x108 = 0; + m_unk0x10c = 0; + m_unk0x110 = 0; + m_unk0x114 = 0; + m_unk0x118 = 0; + m_unk0x11c = 0; + m_unk0x120 = 0; + m_unk0x124 = 0; + m_unk0x128 = 0; + m_unk0xf8 = 0; + m_unk0x13c = 0; + + NotificationManager()->Register(this); } diff --git a/LEGO1/isle.h b/LEGO1/isle.h index 16989416..b714ea19 100644 --- a/LEGO1/isle.h +++ b/LEGO1/isle.h @@ -2,6 +2,7 @@ #define ISLE_H #include "legoworld.h" +#include "radio.h" // VTABLE: LEGO1 0x100d6fb8 // SIZE 0x140 @@ -25,8 +26,21 @@ class Isle : public LegoWorld { inline void SetUnknown13c(MxU32 p_unk0x13c) { m_unk0x13c = p_unk0x13c; } protected: - undefined m_unk0xf8[0x44]; // 0xf8 - MxU32 m_unk0x13c; // 0x13c + undefined4 m_unk0xf8; // 0xf8 + undefined4 m_unk0xfc; // 0xfc + undefined4 m_unk0x100; // 0x100 + undefined4 m_unk0x104; // 0x104 + undefined4 m_unk0x108; // 0x108 + undefined4 m_unk0x10c; // 0x10c + undefined4 m_unk0x110; // 0x110 + undefined4 m_unk0x114; // 0x114 + undefined4 m_unk0x118; // 0x118 + undefined4 m_unk0x11c; // 0x11c + undefined4 m_unk0x120; // 0x120 + undefined4 m_unk0x124; // 0x124 + undefined4 m_unk0x128; // 0x128 + Radio m_radio; // 0x12c + MxU32 m_unk0x13c; // 0x13c }; #endif // ISLE_H diff --git a/LEGO1/radio.cpp b/LEGO1/radio.cpp index e2c8e82d..f1befefd 100644 --- a/LEGO1/radio.cpp +++ b/LEGO1/radio.cpp @@ -1,7 +1,36 @@ #include "radio.h" +#include "legocontrolmanager.h" +#include "legogamestate.h" +#include "legoomni.h" +#include "mxnotificationmanager.h" + +DECOMP_SIZE_ASSERT(Radio, 0x10); + +// FUNCTION: LEGO1 0x1002c850 +Radio::Radio() +{ + NotificationManager()->Register(this); + ControlManager()->Register(this); + + m_unk0xc = TRUE; + CreateRadioState(); +} + // STUB: LEGO1 0x1002c990 Radio::~Radio() { // TODO } + +// FUNCTION: LEGO1 0x1002cde0 +void Radio::CreateRadioState() +{ + LegoGameState* gameState = GameState(); + RadioState* state = (RadioState*) gameState->GetState("RadioState"); + if (state == NULL) { + state = (RadioState*) gameState->CreateState("RadioState"); + } + + m_state = state; +} diff --git a/LEGO1/radio.h b/LEGO1/radio.h index 3476d89b..8d454483 100644 --- a/LEGO1/radio.h +++ b/LEGO1/radio.h @@ -2,10 +2,12 @@ #define RADIO_H #include "mxcore.h" +#include "radiostate.h" // VTABLE: LEGO1 0x100d6d10 class Radio : public MxCore { public: + Radio(); virtual ~Radio() override; // FUNCTION: LEGO1 0x1002c8e0 @@ -20,6 +22,12 @@ class Radio : public MxCore { { return !strcmp(p_name, Radio::ClassName()) || MxCore::IsA(p_name); } + +private: + RadioState* m_state; // 0x08 + MxBool m_unk0xc; // 0x0c + + void CreateRadioState(); }; #endif // RADIO_H