Clear unknowns in LegoGameState (#1670)

This commit is contained in:
Fabian Neundorf
2025-08-08 21:32:37 +02:00
committed by GitHub
parent 3d6ab8ff9d
commit 33c4d1fdcb
3 changed files with 14 additions and 14 deletions

View File

@@ -172,7 +172,7 @@ public:
History(); History();
void WriteScoreHistory(); void WriteScoreHistory();
MxResult Serialize(LegoStorage* p_storage); 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 // FUNCTION: BETA10 0x1002c2b0
MxS16 GetCount() { return m_count; } MxS16 GetCount() { return m_count; }
@@ -260,7 +260,7 @@ public:
MxBool m_isDirty; // 0x420 MxBool m_isDirty; // 0x420
Area m_currentArea; // 0x424 Area m_currentArea; // 0x424
Area m_previousArea; // 0x428 Area m_previousArea; // 0x428
Area m_unk0x42c; // 0x42c Area m_savedPreviousArea; // 0x42c
}; };
MxBool ROIColorOverride(const char* p_input, char* p_output, MxU32 p_copyLen); MxBool ROIColorOverride(const char* p_input, char* p_output, MxU32 p_copyLen);

View File

@@ -154,7 +154,7 @@ LegoGameState::LegoGameState()
m_jukeboxMusic = JukeboxScript::c_noneJukebox; m_jukeboxMusic = JukeboxScript::c_noneJukebox;
m_currentArea = e_undefined; m_currentArea = e_undefined;
m_previousArea = e_undefined; m_previousArea = e_undefined;
m_unk0x42c = e_undefined; m_savedPreviousArea = e_undefined;
m_playerCount = 0; m_playerCount = 0;
m_isDirty = FALSE; m_isDirty = FALSE;
m_loadedAct = e_actNotFound; m_loadedAct = e_actNotFound;
@@ -313,7 +313,7 @@ MxResult LegoGameState::Save(MxULong p_slot)
} }
} }
area = m_unk0x42c; area = m_savedPreviousArea;
storage.WriteU16(area); storage.WriteU16(area);
SerializeScoreHistory(LegoFile::c_write); SerializeScoreHistory(LegoFile::c_write);
m_isDirty = FALSE; m_isDirty = FALSE;
@@ -431,10 +431,10 @@ MxResult LegoGameState::Load(MxULong p_slot)
storage.ReadS16(actArea); storage.ReadS16(actArea);
if (m_currentAct == e_act1) { if (m_currentAct == e_act1) {
m_unk0x42c = e_undefined; m_savedPreviousArea = e_undefined;
} }
else { else {
m_unk0x42c = (Area) actArea; m_savedPreviousArea = (Area) actArea;
} }
result = SUCCESS; result = SUCCESS;
@@ -1190,7 +1190,7 @@ void LegoGameState::Init()
} }
} }
m_unk0x42c = e_undefined; m_savedPreviousArea = e_undefined;
} }
// FUNCTION: BETA10 0x10086510 // FUNCTION: BETA10 0x10086510
@@ -1569,18 +1569,18 @@ void LegoGameState::History::WriteScoreHistory()
// FUNCTION: BETA10 0x1008732a // FUNCTION: BETA10 0x1008732a
LegoGameState::ScoreItem* LegoGameState::History::FindPlayerInScoreHistory( LegoGameState::ScoreItem* LegoGameState::History::FindPlayerInScoreHistory(
LegoGameState::Username* p_player, LegoGameState::Username* p_player,
MxS16 p_unk0x24, MxS16 p_playerId,
MxS32& p_unk0x2c MxS32& p_playerScoreHistoryIndex
) )
{ {
MxS32 i = 0; MxS32 i = 0;
for (; i < m_count; i++) { 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; break;
} }
} }
p_unk0x2c = i; p_playerScoreHistoryIndex = i;
if (i >= m_count) { if (i >= m_count) {
return NULL; return NULL;

View File

@@ -220,7 +220,7 @@ MxResult Infocenter::Create(MxDSAction& p_dsAction)
if (m_infocenterState->m_state == InfocenterState::e_selectedSave) { if (m_infocenterState->m_state == InfocenterState::e_selectedSave) {
LegoGameState* state = GameState(); LegoGameState* state = GameState();
state->m_previousArea = GameState()->m_unk0x42c; state->m_previousArea = GameState()->m_savedPreviousArea;
} }
InputManager()->Register(this); InputManager()->Register(this);
@@ -1082,7 +1082,7 @@ MxU8 Infocenter::HandleControl(LegoControlManagerNotificationParam& p_param)
actionToPlay = GameState()->GetCurrentAct() != LegoGameState::e_act1 ? InfomainScript::c_GoTo_RegBook_Red actionToPlay = GameState()->GetCurrentAct() != LegoGameState::e_act1 ? InfomainScript::c_GoTo_RegBook_Red
: InfomainScript::c_GoTo_RegBook; : InfomainScript::c_GoTo_RegBook;
m_radio.Stop(); m_radio.Stop();
GameState()->m_unk0x42c = GameState()->m_previousArea; GameState()->m_savedPreviousArea = GameState()->m_previousArea;
InputManager()->DisableInputProcessing(); InputManager()->DisableInputProcessing();
break; break;
case InfomainScript::c_Mama_Ctl: case InfomainScript::c_Mama_Ctl:
@@ -1392,7 +1392,7 @@ void Infocenter::Reset()
CharacterManager()->ReleaseAllActors(); CharacterManager()->ReleaseAllActors();
GameState()->SetCurrentAct(LegoGameState::e_act1); GameState()->SetCurrentAct(LegoGameState::e_act1);
GameState()->m_previousArea = LegoGameState::e_undefined; GameState()->m_previousArea = LegoGameState::e_undefined;
GameState()->m_unk0x42c = LegoGameState::e_undefined; GameState()->m_savedPreviousArea = LegoGameState::e_undefined;
InitializeBitmaps(); InitializeBitmaps();
m_selectedCharacter = e_pepper; m_selectedCharacter = e_pepper;