From e1135d9c1da81b74d71594e689d80200898c90cf Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 18 Mar 2024 11:05:05 -0400 Subject: [PATCH] Use script values from enum for clicked objects (#688) --- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 15 +++++++++------ LEGO1/lego/legoomni/src/actors/radio.cpp | 3 ++- LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp | 7 ++++--- LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp | 9 +++++---- LEGO1/lego/legoomni/src/worlds/score.cpp | 9 +++++---- 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index 147d9468..0b3a0878 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -2,7 +2,9 @@ #include "act1state.h" #include "act3.h" +#include "act3_actions.h" #include "isle.h" +#include "isle_actions.h" #include "jukebox.h" #include "jukebox_actions.h" #include "legoanimationmanager.h" @@ -156,7 +158,7 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param) if (p_param.GetUnknown0x28() == 1) { switch (p_param.GetClickedObjectId()) { - case 0x17: + case IsleScript::c_HelicopterArms_Ctl: if (*g_act3Script == script) { ((Act3*) CurrentWorld())->SetUnkown4270(2); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); @@ -168,7 +170,7 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param) GameState()->SetCurrentArea(LegoGameState::e_unk66); ret = 1; break; - case 0x18: { + case IsleScript::c_Helicopter_TakeOff_Ctl: { if (*g_act3Script == script) { break; } @@ -183,7 +185,7 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param) ret = 1; break; } - case 0x19: + case IsleScript::c_Helicopter_Land_Ctl: if (*g_act3Script == script) { break; } @@ -195,13 +197,13 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param) } ret = 1; break; - case 0x1a: + case Act3Script::c_Helicopter_Pizza_Ctl: if (*g_act3Script != script) { break; } ret = 1; /* fall through */ - case 0x1b: + case Act3Script::c_Helicopter_Donut_Ctl: if (*g_act3Script != script) { break; } @@ -228,7 +230,8 @@ MxU32 Helicopter::VTable0xd4(LegoControlManagerEvent& p_param) } ret = 1; break; - case 0x1c: + /* case Act3Script::c_Helicopter_Info_Ctl: */ + case IsleScript::c_Helicopter_Info_Ctl: if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_infomain); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); diff --git a/LEGO1/lego/legoomni/src/actors/radio.cpp b/LEGO1/lego/legoomni/src/actors/radio.cpp index 96d91b33..13c973ed 100644 --- a/LEGO1/lego/legoomni/src/actors/radio.cpp +++ b/LEGO1/lego/legoomni/src/actors/radio.cpp @@ -1,5 +1,6 @@ #include "radio.h" +#include "isle_actions.h" #include "legocontrolmanager.h" #include "legogamestate.h" #include "legoomni.h" @@ -97,7 +98,7 @@ MxLong Radio::HandleClick(LegoControlManagerEvent& p_param) MxDSAction action; // Unused MxS32 objectId = p_param.GetClickedObjectId(); - if (objectId == 18) { + if (objectId == IsleScript::c_Radio_Ctl) { if (m_state->IsActive()) { Stop(); } diff --git a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp index 2f04a784..96a2279a 100644 --- a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp +++ b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp @@ -1,6 +1,7 @@ #include "elevatorbottom.h" #include "act1state.h" +#include "elevbott_actions.h" #include "jukebox.h" #include "jukebox_actions.h" #include "legocontrolmanager.h" @@ -84,17 +85,17 @@ MxLong ElevatorBottom::HandleClick(LegoControlManagerEvent& p_param) if (p_param.GetUnknown0x28() == 1) { switch (p_param.GetClickedObjectId()) { - case 1: + case ElevbottScript::c_LeftArrow_Ctl: m_destLocation = LegoGameState::e_infodoor; TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); result = 1; break; - case 2: + case ElevbottScript::c_RightArrow_Ctl: m_destLocation = LegoGameState::e_infomain; TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); result = 1; break; - case 3: + case ElevbottScript::c_ElevBott_Elevator_Ctl: LegoGameState* gs = GameState(); Act1State* state = (Act1State*) gs->GetState("Act1State"); diff --git a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp index 049da564..a94d5f27 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp @@ -1,6 +1,7 @@ #include "infocenterdoor.h" #include "infocenterstate.h" +#include "infodoor_actions.h" #include "jukebox.h" #include "jukebox_actions.h" #include "legocontrolmanager.h" @@ -96,22 +97,22 @@ MxLong InfocenterDoor::HandleClick(LegoControlManagerEvent& p_param) DeleteObjects(&m_atom, 500, 510); switch (p_param.GetClickedObjectId()) { - case 1: + case InfodoorScript::c_LeftArrow_Ctl: m_destLocation = LegoGameState::e_infoscor; TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); result = 1; break; - case 2: + case InfodoorScript::c_RightArrow_Ctl: m_destLocation = LegoGameState::e_elevbott; TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); result = 1; break; - case 3: + case InfodoorScript::c_Info_Ctl: m_destLocation = LegoGameState::e_infomain; TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); result = 1; break; - case 4: + case InfodoorScript::c_Door_Ctl: if (GameState()->GetActorId()) { InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState"); if (state->HasRegistered()) { diff --git a/LEGO1/lego/legoomni/src/worlds/score.cpp b/LEGO1/lego/legoomni/src/worlds/score.cpp index 354079b7..c4716660 100644 --- a/LEGO1/lego/legoomni/src/worlds/score.cpp +++ b/LEGO1/lego/legoomni/src/worlds/score.cpp @@ -1,6 +1,7 @@ #include "score.h" #include "ambulancemissionstate.h" +#include "infoscor_actions.h" #include "jukebox.h" #include "jukebox_actions.h" #include "legocontrolmanager.h" @@ -165,17 +166,17 @@ MxLong Score::FUN_100016d0(LegoControlManagerEvent& p_param) if (l == 1 || p_param.GetClickedObjectId() == 4) { switch (p_param.GetClickedObjectId()) { - case 1: + case InfoscorScript::c_LeftArrow_Ctl: m_destLocation = LegoGameState::e_infomain; DeleteScript(); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 0x32, 0, 0); break; - case 2: + case InfoscorScript::c_RightArrow_Ctl: m_destLocation = LegoGameState::e_infodoor; DeleteScript(); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 0x32, 0, 0); break; - case 3: { + case InfoscorScript::c_Book_Ctl: { LegoInputManager* im = InputManager(); im->SetUnknown88(TRUE); im->SetUnknown336(FALSE); @@ -187,7 +188,7 @@ MxLong Score::FUN_100016d0(LegoControlManagerEvent& p_param) Start(&action); break; } - case 4: { + case InfoscorScript::c_LegoBox_Ctl: { switch (l) { case 1: { MxDSAction action;