Compare commits

...

2 Commits

Author SHA1 Message Date
Fabian Neundorf
33c4d1fdcb Clear unknowns in LegoGameState (#1670) 2025-08-08 12:32:37 -07:00
Fabian Neundorf
3d6ab8ff9d Name g_plantInfo indices in act2actor.cpp (#1669) 2025-08-08 12:31:39 -07:00
4 changed files with 50 additions and 50 deletions

View File

@@ -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);

View File

@@ -57,39 +57,39 @@ MxBool g_unk0x100f0f28 = FALSE;
// GLOBAL: LEGO1 0x100f0f30
// GLOBAL: BETA10 0x101dbe48
MxS32 g_unk0x100f0f30[] = {2, 23, 32, 66, 71, 72, 73, -1};
MxS32 g_stage0Plants[] = {2, 23, 32, 66, 71, 72, 73, -1};
// GLOBAL: LEGO1 0x100f0f50
// GLOBAL: BETA10 0x101dbe68
MxS32 g_unk0x100f0f50[] = {0, 7, 16, 18, 20, 21, 34, 49, 58, 59, 63, 65, 69, 74, -1};
MxS32 g_stage1Plants[] = {0, 7, 16, 18, 20, 21, 34, 49, 58, 59, 63, 65, 69, 74, -1};
// GLOBAL: LEGO1 0x100f0f90
// GLOBAL: BETA10 0x101dbea8
MxS32 g_unk0x100f0f90[] = {12, 19, 24, 48, 60, -1};
MxS32 g_stage2Plants[] = {12, 19, 24, 48, 60, -1};
// GLOBAL: LEGO1 0x100f0fa8
// GLOBAL: BETA10 0x101dbec0
MxS32 g_unk0x100f0fa8[] = {8, 15, 46, -1};
MxS32 g_stage3Plants[] = {8, 15, 46, -1};
// GLOBAL: LEGO1 0x100f0fb8
// GLOBAL: BETA10 0x101dbed0
MxS32 g_unk0x100f0fb8[] = {25, 26, 28, 29, 38, 39, 42, 50, 51, 56, -1};
MxS32 g_stage4Plants[] = {25, 26, 28, 29, 38, 39, 42, 50, 51, 56, -1};
// GLOBAL: LEGO1 0x100f0fe8
// GLOBAL: BETA10 0x101dbf00
MxS32 g_unk0x100f0fe8[] = {3, 40, 53, 55, -1};
MxS32 g_stage5Plants[] = {3, 40, 53, 55, -1};
// GLOBAL: LEGO1 0x100f1000
// GLOBAL: BETA10 0x101dbf18
MxS32 g_unk0x100f1000[] = {22, 33, 41, 45, 67, -1};
MxS32 g_stage6Plants[] = {22, 33, 41, 45, 67, -1};
// GLOBAL: LEGO1 0x100f1018
// GLOBAL: BETA10 0x101dbf30
MxS32 g_unk0x100f1018[] = {13, 30, 31, 62, -1};
MxS32 g_stage7Plants[] = {13, 30, 31, 62, -1};
// GLOBAL: LEGO1 0x100f1030
// GLOBAL: BETA10 0x101dbf48
MxS32 g_unk0x100f1030[] = {1, 27, 37, 44, 47, 54, 61, 64, -1};
MxS32 g_stage8Plants[] = {1, 27, 37, 44, 47, 54, 61, 64, -1};
// --- End of indices into g_plantInfo ---
@@ -727,9 +727,9 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
*p_param = TRUE;
}
else {
for (i = 0; g_unk0x100f0f30[i] != -1; i++) {
if (plantInfo[g_unk0x100f0f30[i]].m_counter) {
result = plantInfo[g_unk0x100f0f30[i]].m_entity;
for (i = 0; g_stage0Plants[i] != -1; i++) {
if (plantInfo[g_stage0Plants[i]].m_counter) {
result = plantInfo[g_stage0Plants[i]].m_entity;
break;
}
}
@@ -741,9 +741,9 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
*p_param = TRUE;
}
else {
for (i = 0; g_unk0x100f0f50[i] != -1; i++) {
if (plantInfo[g_unk0x100f0f50[i]].m_counter) {
result = plantInfo[g_unk0x100f0f50[i]].m_entity;
for (i = 0; g_stage1Plants[i] != -1; i++) {
if (plantInfo[g_stage1Plants[i]].m_counter) {
result = plantInfo[g_stage1Plants[i]].m_entity;
break;
}
}
@@ -759,9 +759,9 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
*p_param = TRUE;
}
else {
for (i = 0; g_unk0x100f0f90[i] != -1; i++) {
if (plantInfo[g_unk0x100f0f90[i]].m_counter) {
result = plantInfo[g_unk0x100f0f90[i]].m_entity;
for (i = 0; g_stage2Plants[i] != -1; i++) {
if (plantInfo[g_stage2Plants[i]].m_counter) {
result = plantInfo[g_stage2Plants[i]].m_entity;
break;
}
}
@@ -781,9 +781,9 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
*p_param = TRUE;
}
else {
for (i = 0; g_unk0x100f0fa8[i] != -1; i++) {
if (plantInfo[g_unk0x100f0fa8[i]].m_counter) {
result = plantInfo[g_unk0x100f0fa8[i]].m_entity;
for (i = 0; g_stage3Plants[i] != -1; i++) {
if (plantInfo[g_stage3Plants[i]].m_counter) {
result = plantInfo[g_stage3Plants[i]].m_entity;
break;
}
}
@@ -799,9 +799,9 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
*p_param = TRUE;
}
else {
for (i = 0; g_unk0x100f0fb8[i] != -1; i++) {
if (plantInfo[g_unk0x100f0fb8[i]].m_counter) {
result = plantInfo[g_unk0x100f0fb8[i]].m_entity;
for (i = 0; g_stage4Plants[i] != -1; i++) {
if (plantInfo[g_stage4Plants[i]].m_counter) {
result = plantInfo[g_stage4Plants[i]].m_entity;
break;
}
}
@@ -813,9 +813,9 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
*p_param = TRUE;
}
else {
for (i = 0; g_unk0x100f0fe8[i] != -1; i++) {
if (plantInfo[g_unk0x100f0fe8[i]].m_counter) {
result = plantInfo[g_unk0x100f0fe8[i]].m_entity;
for (i = 0; g_stage5Plants[i] != -1; i++) {
if (plantInfo[g_stage5Plants[i]].m_counter) {
result = plantInfo[g_stage5Plants[i]].m_entity;
break;
}
}
@@ -827,9 +827,9 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
*p_param = TRUE;
}
else {
for (i = 0; g_unk0x100f1000[i] != -1; i++) {
if (plantInfo[g_unk0x100f1000[i]].m_counter) {
result = plantInfo[g_unk0x100f1000[i]].m_entity;
for (i = 0; g_stage6Plants[i] != -1; i++) {
if (plantInfo[g_stage6Plants[i]].m_counter) {
result = plantInfo[g_stage6Plants[i]].m_entity;
break;
}
}
@@ -841,18 +841,18 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
*p_param = TRUE;
}
else {
for (i = 0; g_unk0x100f1018[i] != -1; i++) {
if (plantInfo[g_unk0x100f1018[i]].m_counter) {
result = plantInfo[g_unk0x100f1018[i]].m_entity;
for (i = 0; g_stage7Plants[i] != -1; i++) {
if (plantInfo[g_stage7Plants[i]].m_counter) {
result = plantInfo[g_stage7Plants[i]].m_entity;
break;
}
}
}
break;
case 8:
for (i = 0; g_unk0x100f1030[i] != -1; i++) {
if (plantInfo[g_unk0x100f1030[i]].m_counter) {
result = plantInfo[g_unk0x100f1030[i]].m_entity;
for (i = 0; g_stage8Plants[i] != -1; i++) {
if (plantInfo[g_stage8Plants[i]].m_counter) {
result = plantInfo[g_stage8Plants[i]].m_entity;
break;
}
}

View File

@@ -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;

View File

@@ -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;