From 6439f46eea7cb6d6196d1db92a860d198a0b6f65 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 11 Jun 2024 13:52:10 -0400 Subject: [PATCH] Implement/match Ambulance::HandleClick --- LEGO1/lego/legoomni/include/ambulance.h | 2 +- LEGO1/lego/legoomni/src/actors/ambulance.cpp | 41 ++++++++++++++++++-- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index 8f0d4c91..c4b8a24e 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -49,7 +49,7 @@ class AmbulanceMissionState : public LegoState { // AmbulanceMissionState::`scalar deleting destructor' undefined4 m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c + MxLong m_unk0x0c; // 0x0c MxU16 m_unk0x10; // 0x10 MxU16 m_unk0x12; // 0x12 MxU16 m_unk0x14; // 0x14 diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index 35514290..6b715b3d 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -1,6 +1,7 @@ #include "ambulance.h" #include "decomp.h" +#include "isle.h" #include "isle_actions.h" #include "legoanimationmanager.h" #include "legocontrolmanager.h" @@ -14,6 +15,7 @@ #include "mxmisc.h" #include "mxticklemanager.h" #include "mxtimer.h" +#include "mxtransitionmanager.h" #include "mxvariabletable.h" #include "scripts.h" @@ -103,6 +105,10 @@ MxLong Ambulance::Notify(MxParam& p_param) { MxLong result = 0; + char asd[123]; + sprintf(asd, "%d\n", ((MxNotificationParam&) p_param).GetType()); + OutputDebugString(asd); + switch (((MxNotificationParam&) p_param).GetType()) { case c_notificationType0: result = HandleNotification0(); @@ -227,11 +233,40 @@ MxLong Ambulance::HandleNotification19(MxType19NotificationParam& p_param) return 0; } -// STUB: LEGO1 0x10036ce0 +// FUNCTION: LEGO1 0x10036ce0 +// FUNCTION: BETA10 0x10023506 MxLong Ambulance::HandleClick() { - // TODO - return 0; + if (((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 != 10) { + return 1; + } + + if (m_state->m_unk0x08 == 2) { + return 1; + } + + FUN_10015820(TRUE, 0); + ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_ambulance); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) CurrentActor())->Exit(); + } + + m_time = Timer()->GetTime(); + m_unk0x16a = CurrentActor()->GetActorId(); + + Enter(); + InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_AmbulanceDashboard, NULL); + ControlManager()->Register(this); + + if (m_state->m_unk0x08 == 1) { + SpawnPlayer(LegoGameState::e_unk31, TRUE, 0); + m_state->m_unk0x0c = Timer()->GetTime(); + InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_pns018rd_RunAnim, NULL); + } + + return 1; } // STUB: LEGO1 0x10036e60