Implement LegoCarBuild::FUN_10024890() and others, refactor (#1126)

* Commit finished code changes

* Add enum data type

* Refactor away GetCurrentArea, SetCurrentArea

* Clean up and add FUN_10024890

* Add `SetPartObjectIdByName()`

* Fix naming error

* Address review comments, part 1

* Address review comments, part 2

---------

Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
jonschz
2024-11-01 17:21:15 +01:00
committed by GitHub
parent 115343f6e5
commit 4c0aae720b
32 changed files with 445 additions and 93 deletions

View File

@@ -45,7 +45,7 @@ MxResult ElevatorBottom::Create(MxDSAction& p_dsAction)
SetIsWorldActive(FALSE);
GameState()->SetCurrentArea(LegoGameState::e_elevbott);
GameState()->m_currentArea = LegoGameState::e_elevbott;
GameState()->StopArea(LegoGameState::e_previousArea);
return result;

View File

@@ -91,7 +91,7 @@ MxResult GasStation::Create(MxDSAction& p_dsAction)
m_state->m_unk0x14.m_unk0x00 = 3;
}
GameState()->SetCurrentArea(LegoGameState::e_garage);
GameState()->m_currentArea = LegoGameState::e_garage;
GameState()->StopArea(LegoGameState::e_previousArea);
InputManager()->Register(this);

View File

@@ -39,7 +39,7 @@ MxResult HistoryBook::Create(MxDSAction& p_dsAction)
InputManager()->SetCamera(NULL);
InputManager()->Register(this);
GameState()->SetCurrentArea(LegoGameState::Area::e_histbook);
GameState()->m_currentArea = LegoGameState::Area::e_histbook;
GameState()->StopArea(LegoGameState::Area::e_previousArea);
return result;
}

View File

@@ -96,7 +96,7 @@ MxResult Hospital::Create(MxDSAction& p_dsAction)
m_hospitalState->m_unk0x08.m_unk0x00 = 3;
}
GameState()->SetCurrentArea(LegoGameState::e_hospital);
GameState()->m_currentArea = LegoGameState::e_hospital;
GameState()->StopArea(LegoGameState::e_previousArea);
InputManager()->Register(this);

View File

@@ -210,7 +210,7 @@ MxResult Infocenter::Create(MxDSAction& p_dsAction)
}
}
GameState()->SetCurrentArea(LegoGameState::e_infomain);
GameState()->m_currentArea = LegoGameState::e_infomain;
GameState()->StopArea(LegoGameState::e_previousArea);
if (m_infocenterState->GetUnknown0x74() == 4) {
@@ -523,9 +523,9 @@ void Infocenter::ReadyWorld()
bgRed->Enable(TRUE);
if (GameState()->GetCurrentAct() == GameState()->GetLoadedAct()) {
GameState()->SetCurrentArea(LegoGameState::e_act2main);
GameState()->m_currentArea = LegoGameState::e_act2main;
GameState()->StopArea(LegoGameState::e_act2main);
GameState()->SetCurrentArea(LegoGameState::e_infomain);
GameState()->m_currentArea = LegoGameState::e_infomain;
}
m_infocenterState->SetUnknown0x74(5);
@@ -579,9 +579,9 @@ void Infocenter::ReadyWorld()
bgRed->Enable(TRUE);
if (GameState()->GetCurrentAct() == GameState()->GetLoadedAct()) {
GameState()->SetCurrentArea(LegoGameState::e_act3script);
GameState()->m_currentArea = LegoGameState::e_act3script;
GameState()->StopArea(LegoGameState::e_act3script);
GameState()->SetCurrentArea(LegoGameState::e_infomain);
GameState()->m_currentArea = LegoGameState::e_infomain;
}
m_infocenterState->SetUnknown0x74(5);

View File

@@ -48,7 +48,7 @@ MxResult InfocenterDoor::Create(MxDSAction& p_dsAction)
SetIsWorldActive(FALSE);
GameState()->SetCurrentArea(LegoGameState::e_infodoor);
GameState()->m_currentArea = LegoGameState::e_infodoor;
GameState()->StopArea(LegoGameState::e_previousArea);
return result;

View File

@@ -112,8 +112,8 @@ MxResult Isle::Create(MxDSAction& p_dsAction)
m_destLocation = LegoGameState::e_infomain;
}
if (GameState()->GetCurrentArea() == LegoGameState::e_isle) {
GameState()->SetCurrentArea(LegoGameState::e_undefined);
if (GameState()->m_currentArea == LegoGameState::e_isle) {
GameState()->m_currentArea = LegoGameState::e_undefined;
}
LegoGameState* gameState = GameState();

View File

@@ -61,7 +61,7 @@ MxResult JukeBox::Create(MxDSAction& p_dsAction)
m_state->m_music = JukeBoxState::e_pasquell;
}
GameState()->SetCurrentArea(LegoGameState::e_jukeboxw);
GameState()->m_currentArea = LegoGameState::e_jukeboxw;
GameState()->StopArea(LegoGameState::e_previousArea);
TickleManager()->RegisterClient(this, 2000);
return ret;

View File

@@ -63,7 +63,7 @@ MxResult Police::Create(MxDSAction& p_dsAction)
}
m_policeState = policeState;
GameState()->SetCurrentArea(LegoGameState::e_police);
GameState()->m_currentArea = LegoGameState::e_police;
GameState()->StopArea(LegoGameState::e_previousArea);
return ret;
}

View File

@@ -97,7 +97,7 @@ MxResult RegistrationBook::Create(MxDSAction& p_dsAction)
SetIsWorldActive(FALSE);
InputManager()->Register(this);
GameState()->SetCurrentArea(LegoGameState::e_regbook);
GameState()->m_currentArea = LegoGameState::e_regbook;
GameState()->StopArea(LegoGameState::e_previousArea);
m_infocenterState = (InfocenterState*) GameState()->GetState("InfocenterState");

View File

@@ -63,7 +63,7 @@ MxResult Score::Create(MxDSAction& p_dsAction)
LegoGameState* gameState = GameState();
ScoreState* state = (ScoreState*) gameState->GetState("ScoreState");
m_state = state ? state : (ScoreState*) gameState->CreateState("ScoreState");
GameState()->SetCurrentArea(LegoGameState::e_infoscor);
GameState()->m_currentArea = LegoGameState::e_infoscor;
GameState()->StopArea(LegoGameState::e_previousArea);
}