Rename stuff, add default arg

This commit is contained in:
Christian Semmler 2024-01-31 07:29:03 -05:00
parent 62fd080e7e
commit 5da883f0f0
9 changed files with 30 additions and 26 deletions

View File

@ -32,15 +32,15 @@ class LegoGameState {
LegoState* CreateState(const char* p_stateName); LegoState* CreateState(const char* p_stateName);
void GetFileSavePath(MxString* p_outPath, MxULong p_slotn); void GetFileSavePath(MxString* p_outPath, MxULong p_slotn);
void StopPreviousAction(MxU32); void StopArea(MxU32 p_area = 0);
void HandleAction(MxU32); void SwitchArea(MxU32 p_area);
inline MxU8 GetUnknownC() { return m_unk0x0c; } inline MxU8 GetUnknownC() { return m_unk0x0c; }
inline MxU32 GetUnknown10() { return m_unk0x10; } inline MxU32 GetUnknown10() { return m_unk0x10; }
inline MxS32 GetCurrentAct() { return m_currentAct; } inline MxS32 GetCurrentAct() { return m_currentAct; }
inline undefined4 GetUnknown424() { return m_unk0x424; } inline undefined4 GetUnknown424() { return m_currentArea; }
inline void SetDirty(MxBool p_dirty) { m_isDirty = p_dirty; } inline void SetDirty(MxBool p_dirty) { m_isDirty = p_dirty; }
inline void SetUnknown424(undefined4 p_unk0x424) { m_unk0x424 = p_unk0x424; } inline void SetUnknown424(undefined4 p_unk0x424) { m_currentArea = p_unk0x424; }
void SetSomeEnumState(undefined4 p_state); void SetSomeEnumState(undefined4 p_state);
void FUN_1003ceb0(); void FUN_1003ceb0();
@ -75,8 +75,8 @@ class LegoGameState {
ScoreStruct m_unk0xa6; // 0xa6 ScoreStruct m_unk0xa6; // 0xa6
undefined m_unk0x41a[8]; // 0x41a - might be part of the structure at 0xa6 undefined m_unk0x41a[8]; // 0x41a - might be part of the structure at 0xa6
MxBool m_isDirty; // 0x420 MxBool m_isDirty; // 0x420
undefined4 m_unk0x424; // 0x424 undefined4 m_currentArea; // 0x424
undefined4 m_prevArea; // 0x428 undefined4 m_previousArea; // 0x428
undefined4 m_unk0x42c; // 0x42c undefined4 m_unk0x42c; // 0x42c
}; };

View File

@ -69,8 +69,8 @@ LegoGameState::LegoGameState()
this->m_stateCount = 0; this->m_stateCount = 0;
this->m_unk0x0c = 0; this->m_unk0x0c = 0;
this->m_savePath = NULL; this->m_savePath = NULL;
this->m_unk0x424 = 0; this->m_currentArea = 0;
this->m_prevArea = 0; this->m_previousArea = 0;
this->m_unk0x42c = 0; this->m_unk0x42c = 0;
this->m_isDirty = FALSE; this->m_isDirty = FALSE;
this->m_currentAct = -1; this->m_currentAct = -1;
@ -257,10 +257,10 @@ void LegoGameState::SerializePlayersInfo(MxS16)
} }
// FUNCTION: LEGO1 0x1003a720 // FUNCTION: LEGO1 0x1003a720
void LegoGameState::StopPreviousAction(MxU32 p_area) void LegoGameState::StopArea(MxU32 p_area)
{ {
if (p_area == 0) { if (p_area == 0) {
p_area = m_prevArea; p_area = m_previousArea;
} }
switch (p_area) { switch (p_area) {
@ -397,13 +397,13 @@ void LegoGameState::StopPreviousAction(MxU32 p_area)
InvokeAction(Extra::e_close, *g_racecarScript, 0, NULL); InvokeAction(Extra::e_close, *g_racecarScript, 0, NULL);
break; break;
case 0x2e: case 0x2e:
if (m_unk0x424 != 2) { if (m_currentArea != 2) {
InvokeAction(Extra::e_stop, *g_act2mainScript, 0, NULL); InvokeAction(Extra::e_stop, *g_act2mainScript, 0, NULL);
InvokeAction(Extra::e_close, *g_act2mainScript, 0, NULL); InvokeAction(Extra::e_close, *g_act2mainScript, 0, NULL);
} }
break; break;
case 0x2f: case 0x2f:
if (m_unk0x424 != 2) { if (m_currentArea != 2) {
InvokeAction(Extra::e_stop, *g_act3Script, 0, NULL); InvokeAction(Extra::e_stop, *g_act3Script, 0, NULL);
InvokeAction(Extra::e_close, *g_act3Script, 0, NULL); InvokeAction(Extra::e_close, *g_act3Script, 0, NULL);
} }
@ -421,10 +421,11 @@ void LegoGameState::StopPreviousAction(MxU32 p_area)
} }
// STUB: LEGO1 0x1003b060 // STUB: LEGO1 0x1003b060
void LegoGameState::HandleAction(MxU32 p_area) void LegoGameState::SwitchArea(MxU32 p_area)
{ {
m_prevArea = m_unk0x424; m_previousArea = m_currentArea;
m_unk0x424 = p_area; m_currentArea = p_area;
BackgroundAudioManager()->Stop(); BackgroundAudioManager()->Stop();
AnimationManager()->FUN_1005ef10(); AnimationManager()->FUN_1005ef10();
VideoManager()->SetUnk0x554(0); VideoManager()->SetUnk0x554(0);

View File

@ -199,8 +199,10 @@ MxBool FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id)
MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_worldAtom, MxS32 p_worldEntityId) MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_worldAtom, MxS32 p_worldEntityId)
{ {
LegoWorld* world = FindWorld(p_worldAtom, p_worldEntityId); LegoWorld* world = FindWorld(p_worldAtom, p_worldEntityId);
if (world) { if (world) {
MxCore* object = world->Find(p_entityAtom, p_entityId); MxCore* object = world->Find(p_entityAtom, p_entityId);
if (object) { if (object) {
world->Remove(object); world->Remove(object);
@ -218,6 +220,7 @@ MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_wor
return TRUE; return TRUE;
} }
} }
return FALSE; return FALSE;
} }

View File

@ -39,7 +39,7 @@ MxResult ElevatorBottom::Create(MxDSAction& p_dsAction)
SetIsWorldActive(FALSE); SetIsWorldActive(FALSE);
GameState()->SetUnknown424(5); GameState()->SetUnknown424(5);
GameState()->StopPreviousAction(0); GameState()->StopArea();
return result; return result;
} }
@ -56,7 +56,7 @@ MxLong ElevatorBottom::Notify(MxParam& p_param)
ret = HandleNotification17(p_param); ret = HandleNotification17(p_param);
break; break;
case c_notificationTransitioned: case c_notificationTransitioned:
GameState()->HandleAction(m_unk0xf8); GameState()->SwitchArea(m_unk0xf8);
break; break;
} }
} }

View File

@ -139,7 +139,7 @@ MxLong Infocenter::Notify(MxParam& p_param)
} }
else if (m_unk0x104 != 0) { else if (m_unk0x104 != 0) {
BackgroundAudioManager()->RaiseVolume(); BackgroundAudioManager()->RaiseVolume();
GameState()->HandleAction(m_unk0x104); GameState()->SwitchArea(m_unk0x104);
m_unk0x104 = 0; m_unk0x104 = 0;
} }
break; break;

View File

@ -40,7 +40,7 @@ MxResult InfocenterDoor::Create(MxDSAction& p_dsAction)
SetIsWorldActive(FALSE); SetIsWorldActive(FALSE);
GameState()->SetUnknown424(3); GameState()->SetUnknown424(3);
GameState()->StopPreviousAction(0); GameState()->StopArea();
return result; return result;
} }

View File

@ -53,7 +53,7 @@ MxResult Score::Create(MxDSAction& p_dsAction)
ScoreState* state = (ScoreState*) gs->GetState("ScoreState"); ScoreState* state = (ScoreState*) gs->GetState("ScoreState");
m_state = state ? state : (ScoreState*) gs->CreateState("ScoreState"); m_state = state ? state : (ScoreState*) gs->CreateState("ScoreState");
GameState()->SetUnknown424(0xd); GameState()->SetUnknown424(0xd);
GameState()->StopPreviousAction(0); GameState()->StopArea();
} }
return result; return result;
@ -97,7 +97,7 @@ MxLong Score::Notify(MxParam& p_param)
case c_notificationTransitioned: case c_notificationTransitioned:
DeleteObjects(g_infoscorScript, 7, 9); DeleteObjects(g_infoscorScript, 7, 9);
if (m_unk0xf8) if (m_unk0xf8)
GameState()->HandleAction(m_unk0xf8); GameState()->SwitchArea(m_unk0xf8);
ret = 1; ret = 1;
break; break;
default: default:

View File

@ -62,14 +62,14 @@ MxResult Isle::Create(MxDSAction& p_dsAction)
if (result == SUCCESS) { if (result == SUCCESS) {
ControlManager()->Register(this); ControlManager()->Register(this);
InputManager()->SetWorld(this); InputManager()->SetWorld(this);
GameState()->StopPreviousAction(0); GameState()->StopArea();
switch (GameState()->GetCurrentAct()) { switch (GameState()->GetCurrentAct()) {
case 1: case 1:
GameState()->StopPreviousAction(0x2e); GameState()->StopArea(0x2e);
break; break;
case 2: case 2:
GameState()->StopPreviousAction(0x2e); GameState()->StopArea(0x2e);
break; break;
case -1: case -1:
m_unk0x13c = 2; m_unk0x13c = 2;
@ -158,7 +158,7 @@ void Isle::ReadyWorld()
LegoWorld::ReadyWorld(); LegoWorld::ReadyWorld();
if (m_act1state->GetUnknown21()) { if (m_act1state->GetUnknown21()) {
GameState()->HandleAction(2); GameState()->SwitchArea(2);
m_act1state->SetUnknown18(0); m_act1state->SetUnknown18(0);
m_act1state->SetUnknown21(0); m_act1state->SetUnknown21(0);
} }

View File

@ -56,7 +56,7 @@ MxResult Police::Create(MxDSAction& p_dsAction)
m_policeState = policeState; m_policeState = policeState;
GameState()->SetUnknown424(0x22); GameState()->SetUnknown424(0x22);
GameState()->StopPreviousAction(0); GameState()->StopArea();
return ret; return ret;
} }