Use script values from enum for clicked objects (#688)

This commit is contained in:
Christian Semmler 2024-03-18 11:05:05 -04:00 committed by GitHub
parent ba5bc46c0c
commit e1135d9c1d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 25 additions and 18 deletions

View file

@ -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);

View file

@ -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();
}

View file

@ -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");

View file

@ -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()) {

View file

@ -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;