From cae9019471abc16f9789d1ba8972dc9d43d1ee9e Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 30 Jan 2024 12:10:59 -0500 Subject: [PATCH] WIP RadioState --- LEGO1/lego/legoomni/include/jukebox.h | 12 +-- LEGO1/lego/legoomni/include/legostate.h | 10 +++ .../legoomni/include/legovehiclebuildstate.h | 12 +-- LEGO1/lego/legoomni/include/radio.h | 1 + LEGO1/lego/legoomni/include/radiostate.h | 5 ++ .../src/build/legovehiclebuildstate.cpp | 12 +-- LEGO1/lego/legoomni/src/common/legostate.cpp | 10 +++ LEGO1/lego/legoomni/src/isle/radio.cpp | 1 - LEGO1/lego/legoomni/src/isle/radiostate.cpp | 79 ++++++++++++++++++- 9 files changed, 106 insertions(+), 36 deletions(-) diff --git a/LEGO1/lego/legoomni/include/jukebox.h b/LEGO1/lego/legoomni/include/jukebox.h index f760641d..9879a446 100644 --- a/LEGO1/lego/legoomni/include/jukebox.h +++ b/LEGO1/lego/legoomni/include/jukebox.h @@ -34,6 +34,7 @@ class JukeBox : public LegoWorld { // SYNTHETIC: LEGO1 0x1005d810 // JukeBox::`scalar deleting destructor' + enum JukeBoxScript { e_mamaPapaBrickolini, e_jailUnused, @@ -65,29 +66,18 @@ class JukeBox : public LegoWorld { e_legoRadioReminder2, e_legoRadioRacingAd, - e_legoRadioNews1, e_legoRadioNews2, - e_legoRadioPizzaAd1, - e_legoRadioBricksterPSA, - e_legoRadioSports1, - e_legoRadioIntermission1, e_legoRadioIntermission2, - e_legoRadioPizzaAd2, - e_legoRadioWeatherReport, - e_legoRadioSports2, - e_legoRadioPizzaAd3, - e_legoRadioIntermission3, - e_legoRadioSuperStoreAd, e_legoRadioLuckyYou, diff --git a/LEGO1/lego/legoomni/include/legostate.h b/LEGO1/lego/legoomni/include/legostate.h index 41942312..54154634 100644 --- a/LEGO1/lego/legoomni/include/legostate.h +++ b/LEGO1/lego/legoomni/include/legostate.h @@ -43,6 +43,16 @@ class LegoState : public MxCore { // SYNTHETIC: LEGO1 0x10006160 // LegoState::`scalar deleting destructor' + + // SIZE 0x0c + struct StateStruct { + void* m_unk0x00; // 0x00 + undefined2 m_unk0x04; // 0x04 + undefined2 m_unk0x06; // 0x06 + MxS16 m_unk0x08; // 0x08 + + StateStruct(); + }; }; #endif // LEGOSTATE_H diff --git a/LEGO1/lego/legoomni/include/legovehiclebuildstate.h b/LEGO1/lego/legoomni/include/legovehiclebuildstate.h index b0463448..7a78b4ed 100644 --- a/LEGO1/lego/legoomni/include/legovehiclebuildstate.h +++ b/LEGO1/lego/legoomni/include/legovehiclebuildstate.h @@ -28,18 +28,8 @@ class LegoVehicleBuildState : public LegoState { // SYNTHETIC: LEGO1 0x100260a0 // LegoVehicleBuildState::`scalar deleting destructor' -public: - struct UnkStruct { - undefined4 m_unk0x00; // 0x00 - undefined2 m_unk0x04; // 0x04 - undefined2 m_unk0x06; // 0x06 - undefined2 m_unk0x08; // 0x08 - - UnkStruct(); - }; - private: - UnkStruct m_unk0x08[4]; // 0x08 + StateStruct m_unk0x08[4]; // 0x08 // This can be one of the following: // * LegoRaceCarBuildState diff --git a/LEGO1/lego/legoomni/include/radio.h b/LEGO1/lego/legoomni/include/radio.h index 4edf734f..1adde033 100644 --- a/LEGO1/lego/legoomni/include/radio.h +++ b/LEGO1/lego/legoomni/include/radio.h @@ -5,6 +5,7 @@ #include "radiostate.h" // VTABLE: LEGO1 0x100d6d10 +// SIZE 0x10 class Radio : public MxCore { public: Radio(); diff --git a/LEGO1/lego/legoomni/include/radiostate.h b/LEGO1/lego/legoomni/include/radiostate.h index 68dc154a..8784c00a 100644 --- a/LEGO1/lego/legoomni/include/radiostate.h +++ b/LEGO1/lego/legoomni/include/radiostate.h @@ -26,6 +26,11 @@ class RadioState : public LegoState { // SYNTHETIC: LEGO1 0x1002d020 // RadioState::`scalar deleting destructor' + +private: + StateStruct m_unk0x08[3]; // 0x08 + MxU16 m_unk0x2c; // 0x2c + undefined m_unk0x2e; // 0x2e }; #endif // RADIOSTATE_H diff --git a/LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp b/LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp index f950c429..8cf60edd 100644 --- a/LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp +++ b/LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp @@ -2,17 +2,7 @@ #include "decomp.h" -DECOMP_SIZE_ASSERT(LegoVehicleBuildState, 0x50); // 1000acd7 -DECOMP_SIZE_ASSERT(LegoVehicleBuildState::UnkStruct, 0x0c); - -// FUNCTION: LEGO1 0x10017c00 -LegoVehicleBuildState::UnkStruct::UnkStruct() -{ - m_unk0x04 = 0; - m_unk0x00 = 0; - m_unk0x06 = 0; - m_unk0x08 = 0; -} +DECOMP_SIZE_ASSERT(LegoVehicleBuildState, 0x50) // FUNCTION: LEGO1 0x10025f30 LegoVehicleBuildState::LegoVehicleBuildState(char* p_classType) diff --git a/LEGO1/lego/legoomni/src/common/legostate.cpp b/LEGO1/lego/legoomni/src/common/legostate.cpp index c9946492..33248b5c 100644 --- a/LEGO1/lego/legoomni/src/common/legostate.cpp +++ b/LEGO1/lego/legoomni/src/common/legostate.cpp @@ -1,3 +1,13 @@ #include "legostate.h" DECOMP_SIZE_ASSERT(LegoState, 0x08) +DECOMP_SIZE_ASSERT(LegoState::StateStruct, 0x0c) + +// FUNCTION: LEGO1 0x10017c00 +LegoState::StateStruct::StateStruct() +{ + m_unk0x04 = 0; + m_unk0x00 = 0; + m_unk0x06 = 0; + m_unk0x08 = 0; +} diff --git a/LEGO1/lego/legoomni/src/isle/radio.cpp b/LEGO1/lego/legoomni/src/isle/radio.cpp index c0182a1c..995d4ae0 100644 --- a/LEGO1/lego/legoomni/src/isle/radio.cpp +++ b/LEGO1/lego/legoomni/src/isle/radio.cpp @@ -20,7 +20,6 @@ Radio::Radio() // STUB: LEGO1 0x1002c990 Radio::~Radio() { - // TODO } // STUB: LEGO1 0x1002ca30 diff --git a/LEGO1/lego/legoomni/src/isle/radiostate.cpp b/LEGO1/lego/legoomni/src/isle/radiostate.cpp index 08aa91fa..d579471b 100644 --- a/LEGO1/lego/legoomni/src/isle/radiostate.cpp +++ b/LEGO1/lego/legoomni/src/isle/radiostate.cpp @@ -1,9 +1,84 @@ #include "radiostate.h" -// STUB: LEGO1 0x1002ce10 +#include "jukebox.h" +#include "legoomni.h" +#include "mxtimer.h" + +// GLOBAL: LEGO1 0x100f3218 +JukeBox::JukeBoxScript m_unk0x100f3218[6] = { + JukeBox::e_legoRadioReminder1, + JukeBox::e_legoRadioJingle1, + JukeBox::e_legoRadioJingle2, + JukeBox::e_legoRadioJingle3, + JukeBox::e_legoRadioJingle4, + JukeBox::e_legoRadioReminder2 +}; + +// GLOBAL: LEGO1 0x100f3230 +JukeBox::JukeBoxScript m_unk0x100f3230[14] = { + JukeBox::e_legoRadioRacingAd, + JukeBox::e_legoRadioNews1, + JukeBox::e_legoRadioNews2, + JukeBox::e_legoRadioPizzaAd1, + JukeBox::e_legoRadioBricksterPSA, + JukeBox::e_legoRadioSports1, + JukeBox::e_legoRadioIntermission1, + JukeBox::e_legoRadioIntermission2, + JukeBox::e_legoRadioPizzaAd2, + JukeBox::e_legoRadioWeatherReport, + JukeBox::e_legoRadioSports2, + JukeBox::e_legoRadioPizzaAd3, + JukeBox::e_legoRadioIntermission3, + JukeBox::e_legoRadioSuperStoreAd, +}; + +// GLOBAL: LEGO1 0x100f3268 +JukeBox::JukeBoxScript m_unk0x100f3268[9] = { + JukeBox::e_centralRoads, + JukeBox::e_beachBlvd, + JukeBox::e_residentialArea, + JukeBox::e_legoRadioLuckyYou, + JukeBox::e_legoRadioJazzInterlude, + JukeBox::e_legoRadioPianoInterlude1, + JukeBox::e_legoRadioPoliceStation, + JukeBox::e_legoRadioPianoInterlude2, + JukeBox::e_legoRadioCredits, +}; + +// FUNCTION: LEGO1 0x1002ce10 RadioState::RadioState() { - // TODO + srand(Timer()->GetTime()); + + MxU32 random = rand(); + m_unk0x2c = (MxS32) random % 3; + + m_unk0x08[0].m_unk0x00 = m_unk0x100f3218; + m_unk0x08[0].m_unk0x04 = 6; + m_unk0x08[0].m_unk0x06 = 0; + m_unk0x08[0].m_unk0x08 = 0; + + random = rand(); + + m_unk0x08[1].m_unk0x00 = m_unk0x100f3230; + m_unk0x08[1].m_unk0x04 = 14; + m_unk0x08[1].m_unk0x06 = 0; + m_unk0x08[1].m_unk0x08 = 0; + m_unk0x08[0].m_unk0x08 = random % 6; + + random = rand(); + + m_unk0x08[2].m_unk0x00 = m_unk0x100f3268; + m_unk0x08[2].m_unk0x04 = 9; + m_unk0x08[2].m_unk0x06 = 0; + m_unk0x08[2].m_unk0x08 = 0; + m_unk0x08[1].m_unk0x08 = random % 14; + + random = rand(); + + m_unk0x08[2].m_unk0x08 = random % 9; + + m_unk0x2e = 0; } // STUB: LEGO1 0x1002cf50