From 788cec256060f8b4a9c8aec95d4b9352bd1047e4 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 1 Jul 2024 17:37:51 -0700 Subject: [PATCH] Implement GasStation::HandleEndAction (#1053) --- LEGO1/lego/legoomni/src/worlds/gasstation.cpp | 53 +++++++++++++++++-- .../omni/include/mxactionnotificationparam.h | 27 ++++------ 2 files changed, 61 insertions(+), 19 deletions(-) diff --git a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp index fb809668..c71db07c 100644 --- a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp +++ b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp @@ -1,6 +1,7 @@ #include "gasstation.h" #include "garage_actions.h" +#include "isle.h" #include "islepathactor.h" #include "jukebox.h" #include "jukebox_actions.h" @@ -10,6 +11,7 @@ #include "legomain.h" #include "legoutils.h" #include "misc.h" +#include "mxactionnotificationparam.h" #include "mxbackgroundaudiomanager.h" #include "mxmisc.h" #include "mxnotificationmanager.h" @@ -299,11 +301,56 @@ inline void GasStation::StopAction(GarageScript::Script p_objectId) } } -// STUB: LEGO1 0x10005660 +// FUNCTION: LEGO1 0x10005660 MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param) { - // TODO - return 0; + MxLong result = m_radio.Notify(p_param); + + if (result == 0) { + MxDSAction* action = p_param.GetAction(); + + if (action->GetAtomId() == m_atom && action->GetObjectId()) { + m_state->FUN_10006460((GarageScript::Script) action->GetObjectId()); + m_unk0x106 = 0; + + switch (m_state->m_unk0x14.m_unk0x00) { + case 5: + g_unk0x100f0160 = 0; + m_state->m_unk0x14.m_unk0x00 = 6; + m_unk0x115 = TRUE; + PlayAction(GarageScript::c_wgs023nu_RunAnim); + m_unk0x106 = 1; + m_unk0x104 = 1; + break; + case 6: + g_unk0x100f0160 = 0; + m_unk0x115 = TRUE; + + if (m_unk0x104 == 3) { + m_state->m_unk0x14.m_unk0x00 = 8; + PlayAction(GarageScript::c_wgs029nu_RunAnim); + m_unk0x106 = 1; + } + else { + m_state->m_unk0x14.m_unk0x00 = 7; + m_unk0x114 = TRUE; + } + break; + case 8: + m_state->m_unk0x14.m_unk0x00 = 2; + ((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 = 7; + m_destLocation = LegoGameState::e_unk28; + m_radio.Stop(); + BackgroundAudioManager()->Stop(); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + break; + } + + result = 1; + } + } + + return result; } // FUNCTION: LEGO1 0x10005920 diff --git a/LEGO1/omni/include/mxactionnotificationparam.h b/LEGO1/omni/include/mxactionnotificationparam.h index 3b4d83c2..a9863e2d 100644 --- a/LEGO1/omni/include/mxactionnotificationparam.h +++ b/LEGO1/omni/include/mxactionnotificationparam.h @@ -19,37 +19,37 @@ class MxActionNotificationParam : public MxNotificationParam { : MxNotificationParam(p_type, p_sender) { MxDSAction* oldAction = p_action; - this->m_realloc = p_reallocAction; + m_realloc = p_reallocAction; if (p_reallocAction) { - this->m_action = new MxDSAction(); + m_action = new MxDSAction(); } else { - this->m_action = oldAction; + m_action = oldAction; return; } - this->m_action->SetAtomId(oldAction->GetAtomId()); - this->m_action->SetObjectId(oldAction->GetObjectId()); - this->m_action->SetUnknown24(oldAction->GetUnknown24()); + m_action->SetAtomId(oldAction->GetAtomId()); + m_action->SetObjectId(oldAction->GetObjectId()); + m_action->SetUnknown24(oldAction->GetUnknown24()); } // FUNCTION: LEGO1 0x10051050 inline ~MxActionNotificationParam() override { - if (!this->m_realloc) { + if (!m_realloc) { return; } - if (this->m_action) { - delete this->m_action; + if (m_action) { + delete m_action; } } // FUNCTION: LEGO1 0x100510c0 MxNotificationParam* Clone() const override { - return new MxActionNotificationParam(this->m_type, this->m_sender, this->m_action, this->m_realloc); + return new MxActionNotificationParam(m_type, m_sender, m_action, m_realloc); } // vtable+0x04 inline MxDSAction* GetAction() { return m_action; } @@ -93,12 +93,7 @@ class MxEndActionNotificationParam : public MxActionNotificationParam { // FUNCTION: LEGO1 0x10051270 MxNotificationParam* Clone() const override { - return new MxEndActionNotificationParam( - c_notificationEndAction, - this->m_sender, - this->m_action, - this->m_realloc - ); + return new MxEndActionNotificationParam(c_notificationEndAction, m_sender, m_action, m_realloc); } // vtable+0x04 };