Add LegoGameState::Area enum (#552)

* Add area enum

* Fix

* Fix

* Fix

* empty
This commit is contained in:
Christian Semmler
2024-02-10 13:17:07 -05:00
committed by GitHub
parent 0463d48540
commit c8930815c5
15 changed files with 236 additions and 172 deletions

View File

@@ -20,7 +20,7 @@ const char* g_cameraLoc = "CAMERA_LOCATION";
ElevatorBottom::ElevatorBottom()
{
NotificationManager()->Register(this);
this->m_unk0xf8 = 0;
this->m_unk0xf8 = LegoGameState::e_noArea;
}
// FUNCTION: LEGO1 0x10018060
@@ -44,8 +44,8 @@ MxResult ElevatorBottom::Create(MxDSAction& p_dsAction)
SetIsWorldActive(FALSE);
GameState()->SetCurrentArea(5);
GameState()->StopArea();
GameState()->SetCurrentArea(LegoGameState::e_elevbott);
GameState()->StopArea(LegoGameState::e_previousArea);
return result;
}
@@ -86,12 +86,12 @@ MxLong ElevatorBottom::HandleClick(LegoControlManagerEvent& p_param)
if (p_param.GetUnknown0x28() == 1) {
switch (p_param.GetClickedObjectId()) {
case 1:
m_unk0xf8 = 3;
m_unk0xf8 = LegoGameState::e_infodoor;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
result = 1;
break;
case 2:
m_unk0xf8 = 2;
m_unk0xf8 = LegoGameState::e_infomain;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
result = 1;
break;
@@ -104,7 +104,7 @@ MxLong ElevatorBottom::HandleClick(LegoControlManagerEvent& p_param)
}
state->SetUnknown1c(1);
m_unk0xf8 = 6;
m_unk0xf8 = LegoGameState::e_unk6;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
VariableTable()->SetVariable(g_cameraLoc, "LCAMZI1,90");
result = 1;
@@ -135,6 +135,6 @@ void ElevatorBottom::Enable(MxBool p_enable)
MxBool ElevatorBottom::VTable0x64()
{
DeleteObjects(&m_atom, 500, 999);
m_unk0xf8 = 2;
m_unk0xf8 = LegoGameState::e_infomain;
return TRUE;
}

View File

@@ -39,7 +39,7 @@ Infocenter::Infocenter()
m_unk0x11c = NULL;
m_infocenterState = NULL;
m_frameHotBitmap = NULL;
m_transitionDestination = 0;
m_transitionDestination = LegoGameState::e_noArea;
m_currentInfomainScript = c_noInfomain;
m_currentCutscene = e_noIntro;
@@ -116,8 +116,8 @@ MxResult Infocenter::Create(MxDSAction& p_dsAction)
}
}
GameState()->SetCurrentArea(2);
GameState()->StopArea(0);
GameState()->SetCurrentArea(LegoGameState::e_infomain);
GameState()->StopArea(LegoGameState::e_previousArea);
if (m_infocenterState->GetUnknown0x74() == 4) {
LegoGameState* state = GameState();
@@ -173,7 +173,7 @@ MxLong Infocenter::Notify(MxParam& p_param)
else if (m_transitionDestination != 0) {
BackgroundAudioManager()->RaiseVolume();
GameState()->SwitchArea(m_transitionDestination);
m_transitionDestination = 0;
m_transitionDestination = LegoGameState::e_noArea;
}
break;
}
@@ -425,13 +425,13 @@ void Infocenter::ReadyWorld()
bgRed->Enable(TRUE);
if (GameState()->GetCurrentAct() == GameState()->GetLoadedAct()) {
GameState()->SetCurrentArea(0x2e);
GameState()->StopArea(0x2e);
GameState()->SetCurrentArea(0x02);
GameState()->SetCurrentArea(LegoGameState::e_act2main);
GameState()->StopArea(LegoGameState::e_act2main);
GameState()->SetCurrentArea(LegoGameState::e_infomain);
}
m_infocenterState->SetUnknown0x74(5);
m_transitionDestination = 0x2e;
m_transitionDestination = LegoGameState::e_act2main;
InfomainScript script =
(InfomainScript) m_infocenterState->GetReturnDialogue(GameState()->GetCurrentAct()).Next();
@@ -481,13 +481,13 @@ void Infocenter::ReadyWorld()
bgRed->Enable(TRUE);
if (GameState()->GetCurrentAct() == GameState()->GetLoadedAct()) {
GameState()->SetCurrentArea(0x2f);
GameState()->StopArea(0x2f);
GameState()->SetCurrentArea(0x02);
GameState()->SetCurrentArea(LegoGameState::e_act3script);
GameState()->StopArea(LegoGameState::e_act3script);
GameState()->SetCurrentArea(LegoGameState::e_infomain);
}
m_infocenterState->SetUnknown0x74(5);
m_transitionDestination = 0x2f;
m_transitionDestination = LegoGameState::e_act3script;
InfomainScript script =
(InfomainScript) m_infocenterState->GetReturnDialogue(GameState()->GetCurrentAct()).Next();
@@ -756,37 +756,37 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y)
break;
case 10:
if (m_selectedCharacter) {
m_transitionDestination = 16;
m_transitionDestination = LegoGameState::e_unk16;
m_infocenterState->SetUnknown0x74(5);
}
break;
case 11:
if (m_selectedCharacter) {
m_transitionDestination = 19;
m_transitionDestination = LegoGameState::e_unk19;
m_infocenterState->SetUnknown0x74(5);
}
break;
case 12:
if (m_selectedCharacter) {
m_transitionDestination = 22;
m_transitionDestination = LegoGameState::e_unk22;
m_infocenterState->SetUnknown0x74(5);
}
break;
case 13:
if (m_selectedCharacter) {
m_transitionDestination = 25;
m_transitionDestination = LegoGameState::e_unk25;
m_infocenterState->SetUnknown0x74(5);
}
break;
case 14:
if (m_selectedCharacter) {
m_transitionDestination = 29;
m_transitionDestination = LegoGameState::e_unk29;
m_infocenterState->SetUnknown0x74(5);
}
break;
case 15:
if (m_selectedCharacter) {
m_transitionDestination = 32;
m_transitionDestination = LegoGameState::e_unk32;
m_infocenterState->SetUnknown0x74(5);
}
break;
@@ -803,7 +803,7 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y)
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
if (m_infocenterState->GetInfocenterBufferElement(0) == NULL) {
m_infocenterState->SetUnknown0x74(2);
m_transitionDestination = 0;
m_transitionDestination = LegoGameState::e_noArea;
dialogueToPlay = c_registerToContinueDialogue;
}
else {
@@ -873,7 +873,7 @@ MxU8 Infocenter::HandleClick(LegoControlManagerEvent& p_param)
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
m_radio.Stop();
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
m_transitionDestination = 5;
m_transitionDestination = LegoGameState::e_elevbott;
}
else {
MxU32 objectId = m_infocenterState->GetBricksterDialogue().Next();
@@ -888,7 +888,7 @@ MxU8 Infocenter::HandleClick(LegoControlManagerEvent& p_param)
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
m_radio.Stop();
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
m_transitionDestination = 13;
m_transitionDestination = LegoGameState::e_infoscor;
}
else {
MxU32 objectId = m_infocenterState->GetBricksterDialogue().Next();
@@ -936,9 +936,9 @@ MxU8 Infocenter::HandleClick(LegoControlManagerEvent& p_param)
switch (state->GetCurrentAct()) {
case LegoGameState::e_act1:
switch (state->GetPreviousArea()) {
case 3:
case 12:
case 13:
case LegoGameState::e_infodoor:
case LegoGameState::e_regbook:
case LegoGameState::e_infoscor:
m_infocenterState->SetUnknown0x74(5);
m_transitionDestination = state->GetPreviousArea();
actionToPlay =
@@ -947,7 +947,7 @@ MxU8 Infocenter::HandleClick(LegoControlManagerEvent& p_param)
InputManager()->DisableInputProcessing();
InputManager()->SetUnknown336(TRUE);
break;
case 4:
case LegoGameState::e_unk4:
if (state->GetUnknownC()) {
if (m_infocenterState->GetInfocenterBufferElement(0)) {
m_infocenterState->SetUnknown0x74(5);
@@ -969,7 +969,7 @@ MxU8 Infocenter::HandleClick(LegoControlManagerEvent& p_param)
break;
case LegoGameState::e_act2:
m_infocenterState->SetUnknown0x74(5);
m_transitionDestination = 0x2e;
m_transitionDestination = LegoGameState::e_act2main;
actionToPlay =
(InfomainScript) m_infocenterState->GetLeaveDialogue(GameState()->GetCurrentAct()).Next();
InputManager()->DisableInputProcessing();
@@ -977,7 +977,7 @@ MxU8 Infocenter::HandleClick(LegoControlManagerEvent& p_param)
break;
case LegoGameState::e_act3:
m_infocenterState->SetUnknown0x74(5);
m_transitionDestination = 0x2f;
m_transitionDestination = LegoGameState::e_act3script;
actionToPlay =
(InfomainScript) m_infocenterState->GetLeaveDialogue(GameState()->GetCurrentAct()).Next();
InputManager()->DisableInputProcessing();
@@ -986,7 +986,7 @@ MxU8 Infocenter::HandleClick(LegoControlManagerEvent& p_param)
}
break;
case c_bookCtl:
m_transitionDestination = 12;
m_transitionDestination = LegoGameState::e_regbook;
m_infocenterState->SetUnknown0x74(4);
actionToPlay = GameState()->GetCurrentAct() != LegoGameState::e_act1 ? c_goToRegBookRed : c_goToRegBook;
m_radio.Stop();
@@ -1286,8 +1286,8 @@ void Infocenter::Reset()
AnimationManager()->FUN_1005ee80(FALSE);
UnkSaveDataWriter()->FUN_100832a0();
GameState()->SetCurrentAct(LegoGameState::e_act1);
GameState()->SetPreviousArea(0);
GameState()->SetUnknown0x42c(0);
GameState()->SetPreviousArea(LegoGameState::e_noArea);
GameState()->SetUnknown0x42c(LegoGameState::e_noArea);
InitializeBitmaps();
m_selectedCharacter = e_pepper;

View File

@@ -16,7 +16,7 @@ DECOMP_SIZE_ASSERT(InfocenterDoor, 0xfc)
// FUNCTION: LEGO1 0x10037730
InfocenterDoor::InfocenterDoor()
{
m_unk0xf8 = 0;
m_unk0xf8 = LegoGameState::e_noArea;
NotificationManager()->Register(this);
}
@@ -43,8 +43,8 @@ MxResult InfocenterDoor::Create(MxDSAction& p_dsAction)
SetIsWorldActive(FALSE);
GameState()->SetCurrentArea(3);
GameState()->StopArea();
GameState()->SetCurrentArea(LegoGameState::e_infodoor);
GameState()->StopArea(LegoGameState::e_previousArea);
return result;
}
@@ -94,17 +94,17 @@ MxLong InfocenterDoor::HandleClick(LegoControlManagerEvent& p_param)
switch (p_param.GetClickedObjectId()) {
case 1:
m_unk0xf8 = 13;
m_unk0xf8 = LegoGameState::e_infoscor;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
result = 1;
break;
case 2:
m_unk0xf8 = 5;
m_unk0xf8 = LegoGameState::e_elevbott;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
result = 1;
break;
case 3:
m_unk0xf8 = 2;
m_unk0xf8 = LegoGameState::e_infomain;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
result = 1;
break;
@@ -112,7 +112,7 @@ MxLong InfocenterDoor::HandleClick(LegoControlManagerEvent& p_param)
if (GameState()->GetUnknownC()) {
InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState");
if (state->GetInfocenterBufferElement(0) != NULL) {
m_unk0xf8 = 4;
m_unk0xf8 = LegoGameState::e_unk4;
}
else {
MxDSAction action;
@@ -163,6 +163,6 @@ void InfocenterDoor::Enable(MxBool p_enable)
MxBool InfocenterDoor::VTable0x64()
{
DeleteObjects(&m_atom, 500, 510);
m_unk0xf8 = 2;
m_unk0xf8 = LegoGameState::e_infomain;
return TRUE;
}

View File

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

View File

@@ -19,7 +19,7 @@ DECOMP_SIZE_ASSERT(Score, 0x104)
// FUNCTION: LEGO1 0x10001000
Score::Score()
{
m_unk0xf8 = 0;
m_unk0xf8 = LegoGameState::e_noArea;
NotificationManager()->Register(this);
}
@@ -53,8 +53,8 @@ MxResult Score::Create(MxDSAction& p_dsAction)
LegoGameState* gs = GameState();
ScoreState* state = (ScoreState*) gs->GetState("ScoreState");
m_state = state ? state : (ScoreState*) gs->CreateState("ScoreState");
GameState()->SetCurrentArea(0xd);
GameState()->StopArea();
GameState()->SetCurrentArea(LegoGameState::e_infoscor);
GameState()->StopArea(LegoGameState::e_previousArea);
}
return result;
@@ -119,7 +119,7 @@ MxLong Score::FUN_10001510(MxEndActionNotificationParam& p_param)
MxU32 id = action->GetObjectId();
switch (action->GetObjectId()) {
case 10:
m_unk0xf8 = 0x38;
m_unk0xf8 = LegoGameState::e_histbook;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 0x32, 0, 0);
break;
case 0x1f5:
@@ -163,12 +163,12 @@ MxLong Score::FUN_100016d0(LegoControlManagerEvent& p_param)
if (l == 1 || p_param.GetClickedObjectId() == 4) {
switch (p_param.GetClickedObjectId()) {
case 1:
m_unk0xf8 = 2;
m_unk0xf8 = LegoGameState::e_infomain;
DeleteScript();
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 0x32, 0, 0);
break;
case 2:
m_unk0xf8 = 3;
m_unk0xf8 = LegoGameState::e_infodoor;
DeleteScript();
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 0x32, 0, 0);
break;
@@ -330,6 +330,6 @@ void Score::FillArea(MxU32 p_x, MxU32 p_y, MxS16 p_color)
MxBool Score::VTable0x64()
{
DeleteScript();
m_unk0xf8 = 2;
m_unk0xf8 = LegoGameState::e_infomain;
return TRUE;
}