From 7b0d4dd502e527d07f807b10ed4b33feb8ea6cc7 Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Sun, 21 Jan 2024 12:38:22 -0500 Subject: [PATCH] Implement Infocenter::InitializeBitmaps (#478) --- LEGO1/lego/legoomni/include/infocenter.h | 32 ++++++-- LEGO1/lego/legoomni/include/legoworld.h | 1 + LEGO1/lego/legoomni/include/radio.h | 2 + LEGO1/lego/legoomni/src/entity/legoworld.cpp | 6 ++ .../legoomni/src/infocenter/infocenter.cpp | 82 +++++++++++++++++-- LEGO1/lego/legoomni/src/isle/radio.cpp | 9 ++ 6 files changed, 121 insertions(+), 11 deletions(-) diff --git a/LEGO1/lego/legoomni/include/infocenter.h b/LEGO1/lego/legoomni/include/infocenter.h index 7de6ec45..5de2f745 100644 --- a/LEGO1/lego/legoomni/include/infocenter.h +++ b/LEGO1/lego/legoomni/include/infocenter.h @@ -5,13 +5,19 @@ #include "radio.h" class InfocenterState; +class MxStillPresenter; // SIZE 0x18 -struct InfocenterUnkDataEntry { +struct InfocenterMapEntry { // FUNCTION: LEGO1 0x1006ec80 - InfocenterUnkDataEntry() {} + InfocenterMapEntry() {} - undefined m_pad[0x18]; + MxStillPresenter* m_presenter; // 0x00 + undefined4 m_unk0x04; // 0x04 + undefined4 m_unk0x08; // 0x08 + undefined4 m_unk0x0c; // 0x0c + undefined4 m_unk0x10; // 0x10 + undefined4 m_unk0x14; // 0x14 }; // VTABLE: LEGO1 0x100d9338 @@ -31,6 +37,22 @@ public: enum InfomainScript { c_noInfomain = -1, + c_leftArrowCtl = 1, + c_rightArrowCtl = 2, + c_infoCtl = 3, + c_boatCtl = 10, + c_raceCtl = 11, + c_pizzaCtl = 12, + c_gasCtl = 13, + c_medCtl = 14, + c_copCtl = 15, + c_radioCtl = 18, + c_mamaCtl = 21, + c_papaCtl = 22, + c_pepperCtl = 23, + c_nickCtl = 24, + c_lauraCtl = 25, + c_welcomeDialogue = 500, c_goodJobDialogue = 501, @@ -167,9 +189,9 @@ private: Cutscene m_currentCutscene; // 0x108 Radio m_radio; // 0x10c undefined4 m_unk0x11c; // 0x11c - InfocenterUnkDataEntry m_entries[7]; // 0x120 + InfocenterMapEntry m_mapAreas[7]; // 0x120 MxS16 m_unk0x1c8; // 0x1c8 - undefined4 m_unk0x1cc; // 0x1cc + MxStillPresenter* m_frameHotBitmap; // 0x1cc MxS16 m_infoManDialogueTimer; // 0x1d0 MxS16 m_bookAnimationTimer; // 0x1d2 MxU16 m_unk0x1d4; // 0x1d4 diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index 31b60f84..382edd9a 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -60,6 +60,7 @@ public: void FUN_10073430(); MxS32 GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value); MxPresenter* FindPresenter(const char* p_presenter, const char* p_name); + MxPresenter* FUN_10021790(MxAtomId& p_atom, MxS32 p_entityId); // SYNTHETIC: LEGO1 0x1001dee0 // LegoWorld::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/radio.h b/LEGO1/lego/legoomni/include/radio.h index 3afb44cb..536b9a7b 100644 --- a/LEGO1/lego/legoomni/include/radio.h +++ b/LEGO1/lego/legoomni/include/radio.h @@ -25,6 +25,8 @@ public: return !strcmp(p_name, Radio::ClassName()) || MxCore::IsA(p_name); } + void Initialize(MxBool p_und); + // SYNTHETIC: LEGO1 0x1002c970 // Radio::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index 8e5c7465..3fc3e277 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -163,6 +163,12 @@ MxPresenter* LegoWorld::FindPresenter(const char* p_presenter, const char* p_nam return NULL; } +// STUB: LEGO1 0x10021790 +MxPresenter* LegoWorld::FUN_10021790(MxAtomId& p_atom, MxS32 p_entityId) +{ + return NULL; +} + // STUB: LEGO1 0x10021a70 void LegoWorld::VTable0x68(MxBool p_add) { diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp index 170147d0..5d3722c1 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp @@ -16,7 +16,7 @@ #include "mxtransitionmanager.h" DECOMP_SIZE_ASSERT(Infocenter, 0x1d8) -DECOMP_SIZE_ASSERT(InfocenterUnkDataEntry, 0x18) +DECOMP_SIZE_ASSERT(InfocenterMapEntry, 0x18) // GLOBAL: LEGO1 0x100f76a0 const char* g_object2x4red = "2x4red"; @@ -30,13 +30,13 @@ Infocenter::Infocenter() m_unk0xfc = 0; m_unk0x11c = 0; m_infocenterState = NULL; - m_unk0x1cc = 0; + m_frameHotBitmap = 0; m_unk0x11c = 0; m_unk0x104 = 0; m_currentInfomainScript = c_noInfomain; m_currentCutscene = e_noIntro; - memset(&m_entries, 0, sizeof(m_entries)); + memset(&m_mapAreas, 0, sizeof(m_mapAreas)); m_unk0x1c8 = -1; SetAppCursor(1); @@ -310,7 +310,7 @@ void Infocenter::VTable0x50() switch (GameState()->GetUnknown10()) { case 0: - // bg->Enable(1); // TODO: Uncomment once LegoWorld::FindPresenter and LegoWorld::VTable0x58 are implemented. + bg->Enable(1); InitializeBitmaps(); switch (m_infocenterState->GetUnknown0x74()) { case 3: @@ -360,10 +360,80 @@ void Infocenter::VTable0x50() } } -// STUB: LEGO1 0x1006f9a0 +// FUNCTION: LEGO1 0x1006f9a0 void Infocenter::InitializeBitmaps() { - // TODO: Infocenter class size is wrong + m_radio.Initialize(TRUE); + + FUN_10021790(m_atom, c_leftArrowCtl)->Enable(TRUE); + FUN_10021790(m_atom, c_rightArrowCtl)->Enable(TRUE); + FUN_10021790(m_atom, c_infoCtl)->Enable(TRUE); + FUN_10021790(m_atom, c_boatCtl)->Enable(TRUE); + FUN_10021790(m_atom, c_raceCtl)->Enable(TRUE); + FUN_10021790(m_atom, c_pizzaCtl)->Enable(TRUE); + FUN_10021790(m_atom, c_gasCtl)->Enable(TRUE); + FUN_10021790(m_atom, c_medCtl)->Enable(TRUE); + FUN_10021790(m_atom, c_copCtl)->Enable(TRUE); + + FUN_10021790(m_atom, c_mamaCtl)->Enable(TRUE); + FUN_10021790(m_atom, c_papaCtl)->Enable(TRUE); + FUN_10021790(m_atom, c_pepperCtl)->Enable(TRUE); + FUN_10021790(m_atom, c_nickCtl)->Enable(TRUE); + FUN_10021790(m_atom, c_lauraCtl)->Enable(TRUE); + FUN_10021790(m_atom, c_radioCtl)->Enable(TRUE); + + m_mapAreas[0].m_presenter = (MxStillPresenter*) FindPresenter("MxStillPresenter", "Info_A_Bitmap"); + m_mapAreas[0].m_unk0x08 = 391; + m_mapAreas[0].m_unk0x0c = 182; + m_mapAreas[0].m_unk0x10 = 427; + m_mapAreas[0].m_unk0x14 = 230; + m_mapAreas[0].m_unk0x04 = 3; + + m_mapAreas[1].m_presenter = (MxStillPresenter*) FindPresenter("MxStillPresenter", "Boat_A_Bitmap"); + m_mapAreas[1].m_unk0x08 = 304; + m_mapAreas[1].m_unk0x0c = 225; + m_mapAreas[1].m_unk0x10 = 350; + m_mapAreas[1].m_unk0x14 = 268; + m_mapAreas[1].m_unk0x04 = 10; + + m_mapAreas[2].m_presenter = (MxStillPresenter*) FindPresenter("MxStillPresenter", "Race_A_Bitmap"); + m_mapAreas[2].m_unk0x08 = 301; + m_mapAreas[2].m_unk0x0c = 133; + m_mapAreas[2].m_unk0x10 = 347; + m_mapAreas[2].m_unk0x14 = 181; + m_mapAreas[2].m_unk0x04 = 11; + + m_mapAreas[3].m_presenter = (MxStillPresenter*) FindPresenter("MxStillPresenter", "Pizza_A_Bitmap"); + m_mapAreas[3].m_unk0x08 = 289; + m_mapAreas[3].m_unk0x0c = 182; + m_mapAreas[3].m_unk0x10 = 335; + m_mapAreas[3].m_unk0x14 = 225; + m_mapAreas[3].m_unk0x04 = 12; + + m_mapAreas[4].m_presenter = (MxStillPresenter*) FindPresenter("MxStillPresenter", "Gas_A_Bitmap"); + m_mapAreas[4].m_unk0x10 = 391; + m_mapAreas[4].m_unk0x08 = 350; + m_mapAreas[4].m_unk0x0c = 161; + m_mapAreas[4].m_unk0x14 = 209; + m_mapAreas[4].m_unk0x04 = 13; + + m_mapAreas[5].m_presenter = (MxStillPresenter*) FindPresenter("MxStillPresenter", "Med_A_Bitmap"); + m_mapAreas[5].m_unk0x08 = 392; + m_mapAreas[5].m_unk0x0c = 130; + m_mapAreas[5].m_unk0x10 = 438; + m_mapAreas[5].m_unk0x14 = 176; + m_mapAreas[5].m_unk0x04 = 14; + + m_mapAreas[6].m_presenter = (MxStillPresenter*) FindPresenter("MxStillPresenter", "Cop_A_Bitmap"); + m_mapAreas[6].m_unk0x08 = 396; + m_mapAreas[6].m_unk0x0c = 229; + m_mapAreas[6].m_unk0x10 = 442; + m_mapAreas[6].m_unk0x14 = 272; + m_mapAreas[6].m_unk0x04 = 15; + + m_frameHotBitmap = (MxStillPresenter*) FindPresenter("MxStillPresenter", "FrameHot_Bitmap"); + + FUN_10070dc0(TRUE); } // STUB: LEGO1 0x1006fd00 diff --git a/LEGO1/lego/legoomni/src/isle/radio.cpp b/LEGO1/lego/legoomni/src/isle/radio.cpp index c87ac04e..993a12f0 100644 --- a/LEGO1/lego/legoomni/src/isle/radio.cpp +++ b/LEGO1/lego/legoomni/src/isle/radio.cpp @@ -30,6 +30,15 @@ MxLong Radio::Notify(MxParam& p_param) return 0; } +// FUNCTION: LEGO1 0x1002cdc0 +void Radio::Initialize(MxBool p_und) +{ + if (m_unk0xc != p_und) { + m_unk0xc = p_und; + CreateRadioState(); + } +} + // FUNCTION: LEGO1 0x1002cde0 void Radio::CreateRadioState() {