From 33c4d1fdcb882239ff4d16a8bda5ac113be2b8c0 Mon Sep 17 00:00:00 2001 From: Fabian Neundorf Date: Fri, 8 Aug 2025 21:32:37 +0200 Subject: [PATCH] Clear unknowns in `LegoGameState` (#1670) --- LEGO1/lego/legoomni/include/legogamestate.h | 4 ++-- .../lego/legoomni/src/common/legogamestate.cpp | 18 +++++++++--------- LEGO1/lego/legoomni/src/worlds/infocenter.cpp | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legogamestate.h b/LEGO1/lego/legoomni/include/legogamestate.h index 4a797672..aa10e76b 100644 --- a/LEGO1/lego/legoomni/include/legogamestate.h +++ b/LEGO1/lego/legoomni/include/legogamestate.h @@ -172,7 +172,7 @@ public: History(); void WriteScoreHistory(); MxResult Serialize(LegoStorage* p_storage); - ScoreItem* FindPlayerInScoreHistory(Username* p_player, MxS16 p_unk0x24, MxS32& p_unk0x2c); + ScoreItem* FindPlayerInScoreHistory(Username* p_player, MxS16 p_playerId, MxS32& p_playerScoreHistoryIndex); // FUNCTION: BETA10 0x1002c2b0 MxS16 GetCount() { return m_count; } @@ -260,7 +260,7 @@ public: MxBool m_isDirty; // 0x420 Area m_currentArea; // 0x424 Area m_previousArea; // 0x428 - Area m_unk0x42c; // 0x42c + Area m_savedPreviousArea; // 0x42c }; MxBool ROIColorOverride(const char* p_input, char* p_output, MxU32 p_copyLen); diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index cf227def..2ec50d7e 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -154,7 +154,7 @@ LegoGameState::LegoGameState() m_jukeboxMusic = JukeboxScript::c_noneJukebox; m_currentArea = e_undefined; m_previousArea = e_undefined; - m_unk0x42c = e_undefined; + m_savedPreviousArea = e_undefined; m_playerCount = 0; m_isDirty = FALSE; m_loadedAct = e_actNotFound; @@ -313,7 +313,7 @@ MxResult LegoGameState::Save(MxULong p_slot) } } - area = m_unk0x42c; + area = m_savedPreviousArea; storage.WriteU16(area); SerializeScoreHistory(LegoFile::c_write); m_isDirty = FALSE; @@ -431,10 +431,10 @@ MxResult LegoGameState::Load(MxULong p_slot) storage.ReadS16(actArea); if (m_currentAct == e_act1) { - m_unk0x42c = e_undefined; + m_savedPreviousArea = e_undefined; } else { - m_unk0x42c = (Area) actArea; + m_savedPreviousArea = (Area) actArea; } result = SUCCESS; @@ -1190,7 +1190,7 @@ void LegoGameState::Init() } } - m_unk0x42c = e_undefined; + m_savedPreviousArea = e_undefined; } // FUNCTION: BETA10 0x10086510 @@ -1569,18 +1569,18 @@ void LegoGameState::History::WriteScoreHistory() // FUNCTION: BETA10 0x1008732a LegoGameState::ScoreItem* LegoGameState::History::FindPlayerInScoreHistory( LegoGameState::Username* p_player, - MxS16 p_unk0x24, - MxS32& p_unk0x2c + MxS16 p_playerId, + MxS32& p_playerScoreHistoryIndex ) { MxS32 i = 0; for (; i < m_count; i++) { - if (!memcmp(p_player, &m_scores[i].m_name, sizeof(*p_player)) && m_scores[i].m_playerId == p_unk0x24) { + if (!memcmp(p_player, &m_scores[i].m_name, sizeof(*p_player)) && m_scores[i].m_playerId == p_playerId) { break; } } - p_unk0x2c = i; + p_playerScoreHistoryIndex = i; if (i >= m_count) { return NULL; diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index ad49877c..dbf85086 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -220,7 +220,7 @@ MxResult Infocenter::Create(MxDSAction& p_dsAction) if (m_infocenterState->m_state == InfocenterState::e_selectedSave) { LegoGameState* state = GameState(); - state->m_previousArea = GameState()->m_unk0x42c; + state->m_previousArea = GameState()->m_savedPreviousArea; } InputManager()->Register(this); @@ -1082,7 +1082,7 @@ MxU8 Infocenter::HandleControl(LegoControlManagerNotificationParam& p_param) actionToPlay = GameState()->GetCurrentAct() != LegoGameState::e_act1 ? InfomainScript::c_GoTo_RegBook_Red : InfomainScript::c_GoTo_RegBook; m_radio.Stop(); - GameState()->m_unk0x42c = GameState()->m_previousArea; + GameState()->m_savedPreviousArea = GameState()->m_previousArea; InputManager()->DisableInputProcessing(); break; case InfomainScript::c_Mama_Ctl: @@ -1392,7 +1392,7 @@ void Infocenter::Reset() CharacterManager()->ReleaseAllActors(); GameState()->SetCurrentAct(LegoGameState::e_act1); GameState()->m_previousArea = LegoGameState::e_undefined; - GameState()->m_unk0x42c = LegoGameState::e_undefined; + GameState()->m_savedPreviousArea = LegoGameState::e_undefined; InitializeBitmaps(); m_selectedCharacter = e_pepper;