From 356c64ce0ee510a1580049f83a64ac9e3c26146c Mon Sep 17 00:00:00 2001 From: Fabian Neundorf Date: Sun, 13 Jul 2025 21:01:06 +0200 Subject: [PATCH] Name state field, getter and setter in Act1State (#1621) --- LEGO1/lego/legoomni/include/isle.h | 21 ++- LEGO1/lego/legoomni/src/actors/ambulance.cpp | 4 +- LEGO1/lego/legoomni/src/actors/buildings.cpp | 18 +-- LEGO1/lego/legoomni/src/actors/bumpbouy.cpp | 2 +- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 6 +- LEGO1/lego/legoomni/src/actors/jetski.cpp | 2 +- LEGO1/lego/legoomni/src/actors/pizza.cpp | 8 +- LEGO1/lego/legoomni/src/actors/skateboard.cpp | 6 +- LEGO1/lego/legoomni/src/actors/towtrack.cpp | 6 +- .../legoomni/src/common/legogamestate.cpp | 2 +- LEGO1/lego/legoomni/src/common/legoutils.cpp | 5 +- LEGO1/lego/legoomni/src/race/carrace.cpp | 8 +- LEGO1/lego/legoomni/src/race/jetskirace.cpp | 6 +- LEGO1/lego/legoomni/src/worlds/gasstation.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/hospital.cpp | 4 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 126 +++++++++--------- LEGO1/lego/legoomni/src/worlds/jukebox.cpp | 2 +- 17 files changed, 122 insertions(+), 106 deletions(-) diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index 2c6c8091..53edd931 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -34,6 +34,21 @@ public: c_floor3 }; + enum { + e_none = 0, + e_initial = 1, + e_elevator = 2, + e_pizza = 3, + e_helicopter = 4, + e_transitionToJetski = 5, + e_transitionToRacecar = 6, + e_transitionToTowtrack = 7, + e_towtrack = 8, + e_transitionToAmbulance = 9, + e_ambulance = 10, + e_jukebox = 11, + }; + Act1State(); // FUNCTION: LEGO1 0x100338a0 @@ -58,11 +73,11 @@ public: void RemoveActors(); void PlaceActors(); - MxU32 GetUnknown18() { return m_unk0x018; } + MxU32 GetState() { return m_state; } ElevatorFloor GetElevatorFloor() { return (ElevatorFloor) m_elevFloor; } MxU8 GetUnknown21() { return m_unk0x021; } - void SetUnknown18(MxU32 p_unk0x18) { m_unk0x018 = p_unk0x18; } + void SetState(MxU32 p_state) { m_state = p_state; } void SetElevatorFloor(ElevatorFloor p_elevFloor) { m_elevFloor = p_elevFloor; } void SetUnknown21(MxU8 p_unk0x21) { m_unk0x021 = p_unk0x21; } @@ -73,7 +88,7 @@ public: Playlist m_cptClickDialogue; // 0x008 IsleScript::Script m_currentCptClickDialogue; // 0x014 - MxU32 m_unk0x018; // 0x018 + MxU32 m_state; // 0x018 MxS16 m_elevFloor; // 0x01c MxBool m_unk0x01e; // 0x01e MxBool m_unk0x01f; // 0x01f diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index b439db66..fa98fc65 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -364,7 +364,7 @@ MxLong Ambulance::HandlePathStruct(LegoPathStructNotificationParam& p_param) // FUNCTION: BETA10 0x10023506 MxLong Ambulance::HandleClick() { - if (((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 != 10) { + if (((Act1State*) GameState()->GetState("Act1State"))->m_state != Act1State::e_ambulance) { return 1; } @@ -575,7 +575,7 @@ void Ambulance::Reset() { StopAction(m_lastAction); BackgroundAudioManager()->RaiseVolume(); - ((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 = 0; + ((Act1State*) GameState()->GetState("Act1State"))->m_state = Act1State::e_none; m_state->m_state = AmbulanceMissionState::e_ready; m_atBeachTask = 0; m_atPoliceTask = 0; diff --git a/LEGO1/lego/legoomni/src/actors/buildings.cpp b/LEGO1/lego/legoomni/src/actors/buildings.cpp index 833287bc..b9e736c4 100644 --- a/LEGO1/lego/legoomni/src/actors/buildings.cpp +++ b/LEGO1/lego/legoomni/src/actors/buildings.cpp @@ -53,7 +53,7 @@ MxLong InfoCenterEntity::HandleClick(LegoEventNotificationParam& p_param) isle->SetDestLocation(LegoGameState::Area::e_infomain); Act1State* act1state = (Act1State*) GameState()->GetState("Act1State"); - act1state->SetUnknown18(0); + act1state->SetState(Act1State::e_none); break; } case LegoGameState::Act::e_act2: { @@ -83,8 +83,8 @@ MxLong GasStationEntity::HandleClick(LegoEventNotificationParam& p_param) if (CanExit()) { Act1State* state = (Act1State*) GameState()->GetState("Act1State"); - if (state->GetUnknown18() != 8) { - state->SetUnknown18(0); + if (state->GetState() != Act1State::e_towtrack) { + state->SetState(Act1State::e_none); if (UserActor()->GetActorId() != GameState()->GetActorId()) { ((IslePathActor*) UserActor())->Exit(); @@ -107,8 +107,8 @@ MxLong HospitalEntity::HandleClick(LegoEventNotificationParam& p_param) if (CanExit()) { Act1State* act1State = (Act1State*) GameState()->GetState("Act1State"); - if (act1State->GetUnknown18() != 10) { - act1State->SetUnknown18(0); + if (act1State->GetState() != Act1State::e_ambulance) { + act1State->SetState(Act1State::e_none); if (UserActor()->GetActorId() != GameState()->GetActorId()) { ((IslePathActor*) UserActor())->Exit(); @@ -131,8 +131,8 @@ MxLong PoliceEntity::HandleClick(LegoEventNotificationParam& p_param) if (CanExit()) { Act1State* state = (Act1State*) GameState()->GetState("Act1State"); - if (state->GetUnknown18() != 10) { - state->SetUnknown18(0); + if (state->GetState() != Act1State::e_ambulance) { + state->SetState(Act1State::e_none); if (UserActor()->GetActorId() != GameState()->GetActorId()) { ((IslePathActor*) UserActor())->Exit(); @@ -154,7 +154,7 @@ MxLong BeachHouseEntity::HandleClick(LegoEventNotificationParam& p_param) { if (CanExit()) { Act1State* state = (Act1State*) GameState()->GetState("Act1State"); - state->SetUnknown18(0); + state->SetState(Act1State::e_none); if (UserActor()->GetActorId() != GameState()->GetActorId()) { ((IslePathActor*) UserActor())->Exit(); @@ -175,7 +175,7 @@ MxLong RaceStandsEntity::HandleClick(LegoEventNotificationParam& p_param) { if (CanExit()) { Act1State* state = (Act1State*) GameState()->GetState("Act1State"); - state->SetUnknown18(0); + state->SetState(Act1State::e_none); if (UserActor()->GetActorId() != GameState()->GetActorId()) { ((IslePathActor*) UserActor())->Exit(); diff --git a/LEGO1/lego/legoomni/src/actors/bumpbouy.cpp b/LEGO1/lego/legoomni/src/actors/bumpbouy.cpp index 371e4257..03c93f7b 100644 --- a/LEGO1/lego/legoomni/src/actors/bumpbouy.cpp +++ b/LEGO1/lego/legoomni/src/actors/bumpbouy.cpp @@ -45,7 +45,7 @@ MxLong BumpBouy::Notify(MxParam& p_param) Act1State* isleState = (Act1State*) GameState()->GetState("Act1State"); assert(isleState); - isleState->m_unk0x018 = 5; + isleState->m_state = Act1State::e_transitionToJetski; Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); assert(isle); diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index 622fe71e..46353585 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -214,7 +214,7 @@ MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param) Act1State* act1State = (Act1State*) GameState()->GetState("Act1State"); assert(act1State); if (m_state->m_unk0x08 == 0) { - act1State->m_unk0x018 = 4; + act1State->m_state = Act1State::e_helicopter; m_state->m_unk0x08 = 1; m_world->RemoveActor(this); InvokeAction(Extra::ActionType::e_start, script, IsleScript::c_HelicopterTakeOff_Anim, NULL); @@ -318,7 +318,7 @@ MxLong Helicopter::HandleEndAnim(LegoEndAnimNotificationParam& p_param) if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { Act1State* act1State = (Act1State*) GameState()->GetState("Act1State"); assert(act1State); - act1State->m_unk0x018 = 4; + act1State->m_state = Act1State::e_helicopter; SpawnPlayer( LegoGameState::e_unk42, TRUE, @@ -359,7 +359,7 @@ MxLong Helicopter::HandleEndAnim(LegoEndAnimNotificationParam& p_param) if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { Act1State* act1State = (Act1State*) GameState()->GetState("Act1State"); assert(act1State); - act1State->m_unk0x018 = 0; + act1State->m_state = Act1State::e_none; SpawnPlayer( LegoGameState::e_unk41, TRUE, diff --git a/LEGO1/lego/legoomni/src/actors/jetski.cpp b/LEGO1/lego/legoomni/src/actors/jetski.cpp index caf3d1f8..2abc3862 100644 --- a/LEGO1/lego/legoomni/src/actors/jetski.cpp +++ b/LEGO1/lego/legoomni/src/actors/jetski.cpp @@ -162,7 +162,7 @@ void Jetski::ActivateSceneActions() PlayMusic(JukeboxScript::c_JetskiRace_Music); Act1State* act1state = (Act1State*) GameState()->GetState("Act1State"); - if (!act1state->m_unk0x018) { + if (!act1state->m_state) { if (act1state->m_unk0x022) { PlayCamAnim(this, FALSE, 68, TRUE); } diff --git a/LEGO1/lego/legoomni/src/actors/pizza.cpp b/LEGO1/lego/legoomni/src/actors/pizza.cpp index 18da7fca..422cf87f 100644 --- a/LEGO1/lego/legoomni/src/actors/pizza.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizza.cpp @@ -182,7 +182,7 @@ void Pizza::FUN_10038220(IsleScript::Script p_objectId) AnimationManager()->FUN_10064740(NULL); m_mission = m_state->GetMission(GameState()->GetActorId()); m_state->m_unk0x0c = 1; - m_act1state->m_unk0x018 = 3; + m_act1state->m_state = Act1State::e_pizza; m_mission->m_startTime = INT_MIN; g_isleFlags &= ~Isle::c_playMusic; AnimationManager()->EnableCamAnims(FALSE); @@ -200,7 +200,7 @@ void Pizza::FUN_100382b0() InvokeAction(Extra::e_stop, *g_isleScript, m_speechAction, NULL); } - m_act1state->m_unk0x018 = 0; + m_act1state->m_state = Act1State::e_none; m_state->m_unk0x0c = 0; UserActor()->SetActorState(LegoPathActor::c_initial); g_isleFlags |= Isle::c_playMusic; @@ -245,7 +245,7 @@ MxLong Pizza::HandleClick() } if (m_state->m_unk0x0c == 2) { - m_act1state->m_unk0x018 = 3; + m_act1state->m_state = Act1State::e_pizza; if (m_skateBoard == NULL) { m_skateBoard = (SkateBoard*) m_world->Find(m_atomId, IsleScript::c_SkateBoard_Actor); @@ -558,7 +558,7 @@ MxLong Pizza::HandleEndAction(MxEndActionNotificationParam& p_param) break; case 8: if (m_state->GetPlayedAction() == objectId) { - m_act1state->m_unk0x018 = 0; + m_act1state->m_state = Act1State::e_none; m_state->m_unk0x0c = 0; GameState()->m_currentArea = LegoGameState::e_isle; TickleManager()->UnregisterClient(this); diff --git a/LEGO1/lego/legoomni/src/actors/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index 12524111..d47b2178 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -56,7 +56,7 @@ MxResult SkateBoard::Create(MxDSAction& p_dsAction) // FUNCTION: LEGO1 0x10010050 void SkateBoard::Exit() { - if (m_act1state->m_unk0x018 == 3) { + if (m_act1state->m_state == Act1State::e_pizza) { Pizza* pizza = (Pizza*) CurrentWorld()->Find(*g_isleScript, IsleScript::c_Pizza_Actor); pizza->StopActions(); pizza->FUN_100382b0(); @@ -75,7 +75,7 @@ MxLong SkateBoard::HandleClick() { Act1State* state = (Act1State*) GameState()->GetState("Act1State"); - if (!CanExit() && state->m_unk0x018 != 3) { + if (!CanExit() && state->m_state != Act1State::e_pizza) { return 1; } @@ -148,7 +148,7 @@ MxLong SkateBoard::HandleNotification0() // FUNCTION: LEGO1 0x10010510 void SkateBoard::ActivateSceneActions() { - if (m_act1state->m_unk0x018 != 3) { + if (m_act1state->m_state != Act1State::e_pizza) { PlayMusic(JukeboxScript::c_BeachBlvd_Music); if (!m_act1state->m_unk0x022) { diff --git a/LEGO1/lego/legoomni/src/actors/towtrack.cpp b/LEGO1/lego/legoomni/src/actors/towtrack.cpp index bb117e5f..5d62fedc 100644 --- a/LEGO1/lego/legoomni/src/actors/towtrack.cpp +++ b/LEGO1/lego/legoomni/src/actors/towtrack.cpp @@ -272,7 +272,7 @@ MxLong TowTrack::HandleEndAction(MxEndActionNotificationParam& p_param) m_state->UpdateScore(LegoState::e_yellow, m_actorId); } else if (objectId == IsleScript::c_wgs098nu_RunAnim || objectId == IsleScript::c_wgs099nu_RunAnim || objectId == IsleScript::c_wgs100nu_RunAnim || objectId == IsleScript::c_wgs101nu_RunAnim || objectId == IsleScript::c_wgs102nu_RunAnim || objectId == IsleScript::c_wgs085nu_RunAnim || objectId == IsleScript::c_wgs086nu_RunAnim || objectId == IsleScript::c_wgs087nu_RunAnim || objectId == IsleScript::c_wgs088nu_RunAnim || objectId == IsleScript::c_wgs089nu_RunAnim || objectId == IsleScript::c_wgs091nu_RunAnim || objectId == IsleScript::c_wgs092nu_RunAnim || objectId == IsleScript::c_wgs093nu_RunAnim || objectId == IsleScript::c_wgs094nu_RunAnim || objectId == IsleScript::c_wgs095nu_RunAnim) { - ((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 = 0; + ((Act1State*) GameState()->GetState("Act1State"))->m_state = Act1State::e_none; AnimationManager()->FUN_1005f6d0(TRUE); g_isleFlags |= Isle::c_playMusic; AnimationManager()->EnableCamAnims(TRUE); @@ -403,7 +403,7 @@ MxLong TowTrack::HandlePathStruct(LegoPathStructNotificationParam& p_param) // FUNCTION: LEGO1 0x1004d690 MxLong TowTrack::HandleClick() { - if (((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 != 8) { + if (((Act1State*) GameState()->GetState("Act1State"))->m_state != Act1State::e_towtrack) { return 1; } @@ -549,7 +549,7 @@ void TowTrack::FUN_1004dbe0() InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL); } - ((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 = 0; + ((Act1State*) GameState()->GetState("Act1State"))->m_state = Act1State::e_none; m_state->m_unk0x08 = 0; g_isleFlags |= Isle::c_playMusic; AnimationManager()->EnableCamAnims(TRUE); diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index 3dbe88bc..eae457ed 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -952,7 +952,7 @@ void LegoGameState::SwitchArea(Area p_area) Act1State* state = (Act1State*) GameState()->GetState("Act1State"); LoadIsle(); - if (state->GetUnknown18() == 7) { + if (state->GetState() == Act1State::e_transitionToTowtrack) { VideoManager()->Get3DManager()->SetFrustrum(90, 0.1f, 250.0f); } else { diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index d5ecb1ad..2f9b1daf 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -583,9 +583,10 @@ MxBool CanExit() GameState()->m_currentArea != LegoGameState::e_polidoor) { if (UserActor() == NULL || !UserActor()->IsA("TowTrack")) { if (UserActor() == NULL || !UserActor()->IsA("Ambulance")) { - MxU32 unk0x18 = act1State->GetUnknown18(); + MxU32 mission = act1State->GetState(); - if (unk0x18 != 10 && unk0x18 != 8 && unk0x18 != 3) { + if (mission != Act1State::e_ambulance && mission != Act1State::e_towtrack && + mission != Act1State::e_pizza) { return TRUE; } } diff --git a/LEGO1/lego/legoomni/src/race/carrace.cpp b/LEGO1/lego/legoomni/src/race/carrace.cpp index fb4cc192..7a9cfef2 100644 --- a/LEGO1/lego/legoomni/src/race/carrace.cpp +++ b/LEGO1/lego/legoomni/src/race/carrace.cpp @@ -95,7 +95,7 @@ MxResult CarRace::Create(MxDSAction& p_dsAction) m_raceState = raceState; - m_act1State->m_unk0x018 = 6; + m_act1State->m_state = Act1State::e_transitionToRacecar; m_unk0x144 = -1; m_unk0x148 = -1; m_unk0x14c = -1; @@ -339,7 +339,7 @@ MxLong CarRace::HandleControl(LegoControlManagerNotificationParam& p_param) switch (p_param.m_clickedObjectId) { case 3: InvokeAction(Extra::e_stop, *g_carraceScript, CarraceScript::c_irtx08ra_PlayWav, NULL); - m_act1State->m_unk0x018 = 0; + m_act1State->m_state = Act1State::e_none; VariableTable()->SetVariable(g_raceState, ""); VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); NavController()->SetDeadZone(NavController()->GetDefaultDeadZone()); @@ -351,7 +351,7 @@ MxLong CarRace::HandleControl(LegoControlManagerNotificationParam& p_param) break; case 98: InvokeAction(Extra::e_stop, *g_carraceScript, CarraceScript::c_irtx08ra_PlayWav, NULL); - m_act1State->m_unk0x018 = 0; + m_act1State->m_state = Act1State::e_none; VariableTable()->SetVariable(g_raceState, ""); VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); NavController()->SetDeadZone(NavController()->GetDefaultDeadZone()); @@ -413,7 +413,7 @@ MxBool CarRace::Escape() AnimationManager()->FUN_10061010(FALSE); DeleteObjects(&m_atomId, 500, 999); - m_act1State->m_unk0x018 = 0; + m_act1State->m_state = Act1State::e_none; VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); VariableTable()->SetVariable(g_raceState, ""); diff --git a/LEGO1/lego/legoomni/src/race/jetskirace.cpp b/LEGO1/lego/legoomni/src/race/jetskirace.cpp index eddb7266..71746cd0 100644 --- a/LEGO1/lego/legoomni/src/race/jetskirace.cpp +++ b/LEGO1/lego/legoomni/src/race/jetskirace.cpp @@ -127,7 +127,7 @@ MxLong JetskiRace::HandleControl(LegoControlManagerNotificationParam& p_param) if (p_param.m_unk0x28 == 1) { switch (p_param.m_clickedObjectId) { case JetraceScript::c_JetskiArms_Ctl: - m_act1State->m_unk0x018 = 0; + m_act1State->m_state = Act1State::e_none; VariableTable()->SetVariable(g_raceState, ""); VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); LegoRaceCar::InitYouCantStopSound(); @@ -135,7 +135,7 @@ MxLong JetskiRace::HandleControl(LegoControlManagerNotificationParam& p_param) TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; case JetraceScript::c_JetskiInfo_Ctl: - m_act1State->m_unk0x018 = 0; + m_act1State->m_state = Act1State::e_none; VariableTable()->SetVariable(g_raceState, ""); VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); LegoRaceCar::InitYouCantStopSound(); @@ -288,7 +288,7 @@ MxBool JetskiRace::Escape() { AnimationManager()->FUN_10061010(FALSE); DeleteObjects(&m_atomId, 500, 999); - m_act1State->m_unk0x018 = 0; + m_act1State->m_state = Act1State::e_none; VariableTable()->SetVariable(g_raceState, ""); VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); m_destLocation = LegoGameState::e_infomain; diff --git a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp index 40e757c7..4a449ba2 100644 --- a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp +++ b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp @@ -328,7 +328,7 @@ MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param) break; case GasStationState::e_afterAcceptingQuest: m_state->m_state = GasStationState::e_beforeExitingForQuest; - ((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 = 7; + ((Act1State*) GameState()->GetState("Act1State"))->m_state = Act1State::e_transitionToTowtrack; m_destLocation = LegoGameState::e_garageExited; m_radio.Stop(); BackgroundAudioManager()->Stop(); diff --git a/LEGO1/lego/legoomni/src/worlds/hospital.cpp b/LEGO1/lego/legoomni/src/worlds/hospital.cpp index 74d15678..6ab9c218 100644 --- a/LEGO1/lego/legoomni/src/worlds/hospital.cpp +++ b/LEGO1/lego/legoomni/src/worlds/hospital.cpp @@ -365,7 +365,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param) case HospitalState::e_afterAcceptingQuest: m_hospitalState->m_state = HospitalState::e_beforeEnteringAmbulance; act1State = (Act1State*) GameState()->GetState("Act1State"); - act1State->SetUnknown18(9); + act1State->SetState(Act1State::e_transitionToAmbulance); case HospitalState::e_exitToFront: if (m_exited == FALSE) { m_exited = TRUE; @@ -419,7 +419,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerNotificationParam& p_param) Act1State* act1State = (Act1State*) GameState()->GetState("Act1State"); assert(act1State); - act1State->m_unk0x018 = 9; + act1State->m_state = Act1State::e_transitionToAmbulance; m_destLocation = LegoGameState::e_hospitalExited; DeleteObjects( diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 2b630be4..aeedd601 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -142,11 +142,11 @@ MxLong Isle::Notify(MxParam& p_param) break; case c_notificationButtonUp: case c_notificationButtonDown: - switch (m_act1state->m_unk0x018) { - case 3: + switch (m_act1state->m_state) { + case Act1State::e_pizza: result = m_pizza->Notify(p_param); break; - case 10: + case Act1State::e_ambulance: result = m_ambulance->Notify(p_param); break; } @@ -155,14 +155,14 @@ MxLong Isle::Notify(MxParam& p_param) result = HandleControl((LegoControlManagerNotificationParam&) p_param); break; case c_notificationEndAnim: - switch (m_act1state->m_unk0x018) { - case 4: + switch (m_act1state->m_state) { + case Act1State::e_helicopter: result = UserActor()->Notify(p_param); break; - case 8: + case Act1State::e_towtrack: result = m_towtrack->Notify(p_param); break; - case 10: + case Act1State::e_ambulance: result = m_ambulance->Notify(p_param); break; } @@ -187,18 +187,18 @@ MxLong Isle::HandleEndAction(MxEndActionNotificationParam& p_param) { MxLong result; - switch (m_act1state->m_unk0x018) { - case 2: + switch (m_act1state->m_state) { + case Act1State::e_elevator: HandleElevatorEndAction(); result = 1; break; - case 3: + case Act1State::e_pizza: result = m_pizza->Notify(p_param); break; - case 8: + case Act1State::e_towtrack: result = m_towtrack->Notify(p_param); break; - case 10: + case Act1State::e_ambulance: result = m_ambulance->Notify(p_param); break; default: @@ -241,12 +241,12 @@ void Isle::HandleElevatorEndAction() case Act1State::c_floor1: m_destLocation = LegoGameState::e_infomain; TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - m_act1state->m_unk0x018 = 0; + m_act1state->m_state = Act1State::e_none; break; case Act1State::c_floor2: if (m_act1state->m_unk0x01e) { m_act1state->m_unk0x01e = FALSE; - m_act1state->m_unk0x018 = 0; + m_act1state->m_state = Act1State::e_none; InputManager()->EnableInputProcessing(); } else { @@ -258,7 +258,7 @@ void Isle::HandleElevatorEndAction() case Act1State::c_floor3: m_destLocation = LegoGameState::e_elevopen; TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - m_act1state->m_unk0x018 = 0; + m_act1state->m_state = Act1State::e_none; break; } } @@ -270,7 +270,7 @@ void Isle::ReadyWorld() if (m_act1state->GetUnknown21()) { GameState()->SwitchArea(LegoGameState::e_infomain); - m_act1state->SetUnknown18(0); + m_act1state->SetState(Act1State::e_none); m_act1state->SetUnknown21(0); } else if (GameState()->GetLoadedAct() != LegoGameState::e_act1) { @@ -289,7 +289,7 @@ MxLong Isle::HandleControl(LegoControlManagerNotificationParam& p_param) switch (p_param.m_clickedObjectId) { case IsleScript::c_ElevRide_Info_Ctl: - m_act1state->m_unk0x018 = 2; + m_act1state->m_state = Act1State::e_elevator; switch (m_act1state->m_elevFloor) { case Act1State::c_floor1: @@ -309,7 +309,7 @@ MxLong Isle::HandleControl(LegoControlManagerNotificationParam& p_param) m_act1state->m_elevFloor = Act1State::c_floor1; break; case IsleScript::c_ElevRide_Two_Ctl: - m_act1state->m_unk0x018 = 2; + m_act1state->m_state = Act1State::e_elevator; switch (m_act1state->m_elevFloor) { case Act1State::c_floor1: @@ -329,7 +329,7 @@ MxLong Isle::HandleControl(LegoControlManagerNotificationParam& p_param) m_act1state->m_elevFloor = Act1State::c_floor2; break; case IsleScript::c_ElevRide_Three_Ctl: - m_act1state->m_unk0x018 = 2; + m_act1state->m_state = Act1State::e_elevator; switch (m_act1state->m_elevFloor) { case Act1State::c_floor1: @@ -478,14 +478,14 @@ MxLong Isle::HandlePathStruct(LegoPathStructNotificationParam& p_param) } } - switch (m_act1state->m_unk0x018) { - case 3: + switch (m_act1state->m_state) { + case Act1State::e_pizza: result = m_pizza->Notify(p_param); break; - case 8: + case Act1State::e_towtrack: result = m_towtrack->Notify(p_param); break; - case 10: + case Act1State::e_ambulance: result = m_ambulance->Notify(p_param); break; } @@ -502,7 +502,7 @@ MxLong Isle::HandlePathStruct(LegoPathStructNotificationParam& p_param) result = 1; break; case 0x131: - if (m_act1state->m_unk0x018 != 10) { + if (m_act1state->m_state != Act1State::e_ambulance) { AnimationManager()->FUN_10064740(NULL); } result = 1; @@ -558,7 +558,7 @@ void Isle::Enable(MxBool p_enable) EnableAnimations(TRUE); - if (m_act1state->m_unk0x018 == 0) { + if (m_act1state->m_state == Act1State::e_none) { MxS32 locations[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; for (MxU32 i = 0; i < 5; i++) { @@ -595,7 +595,7 @@ void Isle::Enable(MxBool p_enable) break; case LegoGameState::e_jetrace2: if (((JetskiRaceState*) GameState()->GetState("JetskiRaceState"))->m_unk0x28 == 2) { - m_act1state->m_unk0x018 = 5; + m_act1state->m_state = Act1State::e_transitionToJetski; } PlaceActor(UserActor()); @@ -704,10 +704,10 @@ void Isle::Enable(MxBool p_enable) break; } - switch (m_act1state->m_unk0x018) { - case 0: - case 1: - m_act1state->m_unk0x018 = 0; + switch (m_act1state->m_state) { + case Act1State::e_none: + case Act1State::e_initial: + m_act1state->m_state = Act1State::e_none; if (GameState()->m_currentArea == LegoGameState::e_pizzeriaExterior) { AnimationManager()->FUN_10064740(NULL); @@ -728,7 +728,7 @@ void Isle::Enable(MxBool p_enable) } } break; - case 5: { + case Act1State::e_transitionToJetski: { ((IslePathActor*) UserActor()) ->SpawnPlayer( LegoGameState::e_jetrace2, @@ -756,12 +756,12 @@ void Isle::Enable(MxBool p_enable) ->FUN_10060dc0(script, NULL, TRUE, LegoAnimationManager::e_unk1, NULL, FALSE, FALSE, TRUE, FALSE); } - m_act1state->m_unk0x018 = 0; + m_act1state->m_state = Act1State::e_none; EnableAnimations(FALSE); AnimationManager()->FUN_10064670(NULL); break; } - case 6: { + case Act1State::e_transitionToRacecar: { GameState()->m_currentArea = LegoGameState::e_carraceExterior; ((IslePathActor*) UserActor()) ->SpawnPlayer( @@ -790,12 +790,12 @@ void Isle::Enable(MxBool p_enable) ->FUN_10060dc0(script, NULL, TRUE, LegoAnimationManager::e_unk1, NULL, FALSE, FALSE, TRUE, FALSE); } - m_act1state->m_unk0x018 = 0; + m_act1state->m_state = Act1State::e_none; EnableAnimations(TRUE); break; } - case 7: - m_act1state->m_unk0x018 = 8; + case Act1State::e_transitionToTowtrack: + m_act1state->m_state = Act1State::e_towtrack; AnimationManager()->FUN_1005f6d0(FALSE); AnimationManager()->EnableCamAnims(FALSE); @@ -803,8 +803,8 @@ void Isle::Enable(MxBool p_enable) g_isleFlags &= ~c_playMusic; m_towtrack->FUN_1004dab0(); break; - case 9: - m_act1state->m_unk0x018 = 10; + case Act1State::e_transitionToAmbulance: + m_act1state->m_state = Act1State::e_ambulance; AnimationManager()->FUN_1005f6d0(FALSE); AnimationManager()->EnableCamAnims(FALSE); @@ -813,7 +813,7 @@ void Isle::Enable(MxBool p_enable) m_ambulance->Init(); break; case 11: - m_act1state->m_unk0x018 = 0; + m_act1state->m_state = Act1State::e_none; ((IslePathActor*) UserActor()) ->SpawnPlayer( LegoGameState::e_jukeboxExterior, @@ -828,17 +828,17 @@ void Isle::Enable(MxBool p_enable) SetAppCursor(e_cursorArrow); - if (m_act1state->m_unk0x018 != 8 && - (m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_elevride) && - (m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_polidoor) && - (m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_garadoor) && - (m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_bike) && - (m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_dunecar) && - (m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_motocycle) && - (m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_copter) && - (m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_jetski) && - (m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_skateboard) && - (m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_jetrace2)) { + if (m_act1state->m_state != Act1State::e_towtrack && + (m_act1state->m_state != Act1State::e_none || GameState()->m_currentArea != LegoGameState::e_elevride) && + (m_act1state->m_state != Act1State::e_none || GameState()->m_currentArea != LegoGameState::e_polidoor) && + (m_act1state->m_state != Act1State::e_none || GameState()->m_currentArea != LegoGameState::e_garadoor) && + (m_act1state->m_state != Act1State::e_none || GameState()->m_currentArea != LegoGameState::e_bike) && + (m_act1state->m_state != Act1State::e_none || GameState()->m_currentArea != LegoGameState::e_dunecar) && + (m_act1state->m_state != Act1State::e_none || GameState()->m_currentArea != LegoGameState::e_motocycle) && + (m_act1state->m_state != Act1State::e_none || GameState()->m_currentArea != LegoGameState::e_copter) && + (m_act1state->m_state != Act1State::e_none || GameState()->m_currentArea != LegoGameState::e_jetski) && + (m_act1state->m_state != Act1State::e_none || GameState()->m_currentArea != LegoGameState::e_skateboard) && + (m_act1state->m_state != Act1State::e_none || GameState()->m_currentArea != LegoGameState::e_jetrace2)) { Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); } @@ -897,7 +897,7 @@ MxLong Isle::HandleTransitionEnd() DeleteObjects(&m_atomId, IsleScript::c_Avo900Ps_PlayWav, IsleScript::c_Avo907Ps_PlayWav); if (m_destLocation != LegoGameState::e_skateboard) { - m_act1state->m_unk0x018 = 0; + m_act1state->m_state = Act1State::e_none; } switch (m_destLocation) { @@ -1023,7 +1023,7 @@ MxLong Isle::HandleTransitionEnd() break; case LegoGameState::e_ambulance: m_act1state->m_unk0x01f = TRUE; - m_act1state->m_unk0x018 = 10; + m_act1state->m_state = Act1State::e_ambulance; FUN_10032d30(IsleScript::c_AmbulanceFuelMeter, JukeboxScript::c_MusicTheme1, NULL, TRUE); if (!m_act1state->m_unk0x01f) { @@ -1032,7 +1032,7 @@ MxLong Isle::HandleTransitionEnd() break; case LegoGameState::e_towtrack: m_act1state->m_unk0x01f = TRUE; - m_act1state->m_unk0x018 = 8; + m_act1state->m_state = Act1State::e_towtrack; FUN_10032d30(IsleScript::c_TowFuelMeter, JukeboxScript::c_MusicTheme1, NULL, TRUE); if (!m_act1state->m_unk0x01f) { @@ -1167,7 +1167,7 @@ void Isle::CreateState() m_act1state = (Act1State*) GameState()->GetState("Act1State"); if (!m_act1state) { m_act1state = (Act1State*) GameState()->CreateState("Act1State"); - m_act1state->m_unk0x018 = 0; + m_act1state->m_state = Act1State::e_none; } m_radio.CreateState(); @@ -1193,20 +1193,20 @@ MxBool Isle::Escape() m_radio.Stop(); BackgroundAudioManager()->Stop(); - switch (m_act1state->m_unk0x018) { - case 3: + switch (m_act1state->m_state) { + case Act1State::e_pizza: if (UserActor() != NULL) { m_pizza->StopActions(); m_pizza->FUN_100382b0(); } break; - case 8: + case Act1State::e_towtrack: if (UserActor() != NULL && !UserActor()->IsA("TowTrack")) { m_towtrack->StopActions(); m_towtrack->FUN_1004dbe0(); } break; - case 10: + case Act1State::e_ambulance: if (UserActor() != NULL && !UserActor()->IsA("Ambulance")) { m_ambulance->StopActions(); m_ambulance->Reset(); @@ -1239,7 +1239,7 @@ MxBool Isle::Escape() VariableTable()->SetVariable("VISIBILITY", "Show Gas"); } - m_act1state->m_unk0x018 = 0; + m_act1state->m_state = Act1State::e_none; m_destLocation = LegoGameState::e_infomain; return TRUE; } @@ -1247,21 +1247,21 @@ MxBool Isle::Escape() // FUNCTION: LEGO1 0x10033350 void Isle::FUN_10033350() { - if (m_act1state->m_unk0x018 == 10) { + if (m_act1state->m_state == Act1State::e_ambulance) { if (UserActor() != NULL && !UserActor()->IsA("Ambulance")) { m_ambulance->StopActions(); m_ambulance->Reset(); } } - if (m_act1state->m_unk0x018 == 8) { + if (m_act1state->m_state == Act1State::e_towtrack) { if (UserActor() != NULL && !UserActor()->IsA("TowTrack")) { m_towtrack->StopActions(); m_towtrack->FUN_1004dbe0(); } } - if (m_act1state->m_unk0x018 == 3) { + if (m_act1state->m_state == Act1State::e_pizza) { if (UserActor() != NULL) { m_pizza->StopActions(); m_pizza->FUN_100382b0(); @@ -1293,7 +1293,7 @@ void Isle::FUN_10033350() Act1State::Act1State() { m_elevFloor = Act1State::c_floor1; - m_unk0x018 = 1; + m_state = Act1State::e_initial; m_unk0x01e = FALSE; m_cptClickDialogue = Playlist((MxU32*) g_cptClickDialogue, sizeOfArray(g_cptClickDialogue), Playlist::e_loop); m_unk0x01f = FALSE; diff --git a/LEGO1/lego/legoomni/src/worlds/jukebox.cpp b/LEGO1/lego/legoomni/src/worlds/jukebox.cpp index d09b7e62..db244e00 100644 --- a/LEGO1/lego/legoomni/src/worlds/jukebox.cpp +++ b/LEGO1/lego/legoomni/src/worlds/jukebox.cpp @@ -211,7 +211,7 @@ MxBool JukeBox::HandleControl(LegoControlManagerNotificationParam& p_param) break; case JukeboxwScript::c_Note_Ctl: Act1State* act1State = (Act1State*) GameState()->GetState("Act1State"); - act1State->m_unk0x018 = 11; + act1State->m_state = Act1State::e_jukebox; m_destLocation = LegoGameState::Area::e_jukeboxExterior; TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, 0, FALSE); break;