From 475d21f8c81531be65982549ae119c3af7c66cba Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 12 Jun 2024 10:08:55 -0400 Subject: [PATCH] Implement/match Ambulance::ActivateSceneActions (#1023) --- LEGO1/lego/legoomni/include/ambulance.h | 2 +- LEGO1/lego/legoomni/src/actors/ambulance.cpp | 48 ++++++++++++++++++-- LEGO1/lego/legoomni/src/worlds/isle.cpp | 2 +- 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index c4b8a24e..f4105678 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -97,7 +97,7 @@ class Ambulance : public IslePathActor { void CreateState(); void FUN_10036e60(); - void FUN_10037060(); + void ActivateSceneActions(); void StopActions(); void FUN_10037250(); diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index 5df3963d..708764ec 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -3,6 +3,7 @@ #include "decomp.h" #include "isle.h" #include "isle_actions.h" +#include "jukebox_actions.h" #include "legoanimationmanager.h" #include "legocontrolmanager.h" #include "legogamestate.h" @@ -289,10 +290,51 @@ MxLong Ambulance::HandleControl(LegoControlManagerEvent& p_param) return 0; } -// STUB: LEGO1 0x10037060 -void Ambulance::FUN_10037060() +// FUNCTION: LEGO1 0x10037060 +void Ambulance::ActivateSceneActions() { - // TODO + PlayMusic(JukeboxScript::c_Hospital_Music); + + if (m_state->m_unk0x08 == 1) { + m_state->m_unk0x08 = 0; + PlayAction(IsleScript::c_ham033cl_PlayWav); + } + else if (m_unk0x16c != 0 && m_unk0x16e != 0) { + IsleScript::Script objectId; + + switch (rand() % 2) { + case 0: + objectId = IsleScript::c_ham076cl_PlayWav; + break; + case 1: + objectId = IsleScript::c_ham088cl_PlayWav; + break; + } + + if (m_lastAction != IsleScript::c_noneIsle) { + InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL); + } + + PlayAction(objectId); + } + else { + IsleScript::Script objectId; + + switch (rand() % 2) { + case 0: + objectId = IsleScript::c_ham075cl_PlayWav; + break; + case 1: + objectId = IsleScript::c_ham113cl_PlayWav; + break; + } + + if (m_lastAction != IsleScript::c_noneIsle) { + InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL); + } + + PlayAction(objectId); + } } // FUNCTION: LEGO1 0x10037160 diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 55b5006b..2f02be8a 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -1026,7 +1026,7 @@ MxLong Isle::HandleTransitionEnd() FUN_10032d30(IsleScript::c_AmbulanceFuelMeter, JukeboxScript::c_MusicTheme1, NULL, TRUE); if (!m_act1state->m_unk0x01f) { - m_ambulance->FUN_10037060(); + m_ambulance->ActivateSceneActions(); } break; case LegoGameState::e_towtrack: