From 7c9fdd255effb8f8de6c1ff79cf9eb8409594da1 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 24 May 2024 21:23:41 -0400 Subject: [PATCH] Implement/match Isle::HandleType19Notification (#952) * Implement/match Isle::HandleType19Notification * Fix --- LEGO1/lego/legoomni/include/isle.h | 21 ++++--- .../legoomni/include/legoanimationmanager.h | 1 + .../src/common/legoanimationmanager.cpp | 19 ++++++ LEGO1/lego/legoomni/src/worlds/isle.cpp | 63 +++++++++++++++++-- .../omni/include/mxtype19notificationparam.h | 6 +- 5 files changed, 94 insertions(+), 16 deletions(-) diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index 372c20ab..878cef90 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -6,19 +6,20 @@ #include "legoworld.h" #include "radio.h" -class Pizza; -class Pizzeria; -class TowTrack; +class Act1State; class Ambulance; -class JukeBoxEntity; -class Helicopter; class Bike; class DuneBuggy; -class Motocycle; -class SkateBoard; -class RaceCar; +class Helicopter; class Jetski; -class Act1State; +class JukeBoxEntity; +class Motocycle; +class MxType19NotificationParam; +class Pizza; +class Pizzeria; +class RaceCar; +class SkateBoard; +class TowTrack; // VTABLE: LEGO1 0x100d6fb8 // SIZE 0x140 @@ -71,7 +72,7 @@ class Isle : public LegoWorld { protected: MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleClick(LegoControlManagerEvent& p_param); - MxLong HandleType19Notification(MxParam& p_param); + MxLong HandleType19Notification(MxType19NotificationParam& p_param); MxLong HandleTransitionEnd(); void HandleElevatorEndAction(); void UpdateGlobe(); diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 52aeb7c6..88f304e8 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -112,6 +112,7 @@ class LegoAnimationManager : public MxCore { void FUN_10063780(LegoROIList* p_list); MxResult FUN_10064670(Vector3* p_position); MxResult FUN_10064740(Vector3* p_position); + MxResult FUN_10064880(const char* p_name, MxS32 p_unk0x0c, MxS32 p_unk0x10); static void configureLegoAnimationManager(MxS32 p_legoAnimationManagerConfig); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 95df6202..04c86576 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -2411,6 +2411,25 @@ MxResult LegoAnimationManager::FUN_10064740(Vector3* p_position) return FAILURE; } +// FUNCTION: LEGO1 0x10064880 +// FUNCTION: BETA10 0x10045d02 +MxResult LegoAnimationManager::FUN_10064880(const char* p_name, MxS32 p_unk0x0c, MxS32 p_unk0x10) +{ + for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { + LegoROI* roi = m_extras[i].m_roi; + + if (roi != NULL) { + if (!strcmpi(roi->GetName(), p_name)) { + g_characters[m_extras[i].m_characterId].m_unk0x0c = p_unk0x0c; + g_characters[m_extras[i].m_characterId].m_unk0x10 = p_unk0x10; + return SUCCESS; + } + } + } + + return FAILURE; +} + // STUB: LEGO1 0x100648f0 // FUNCTION: BETA10 0x10045daf void LegoAnimationManager::FUN_100648f0(LegoTranInfo*, MxLong) diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 8c2bc113..9e692616 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -29,6 +29,7 @@ #include "mxnotificationmanager.h" #include "mxstillpresenter.h" #include "mxtransitionmanager.h" +#include "mxtype19notificationparam.h" #include "mxvariabletable.h" #include "pizza.h" #include "pizzeria.h" @@ -158,7 +159,7 @@ MxLong Isle::Notify(MxParam& p_param) } break; case c_notificationType19: - result = HandleType19Notification(p_param); + result = HandleType19Notification((MxType19NotificationParam&) p_param); break; case c_notificationType20: Enable(TRUE); @@ -458,10 +459,64 @@ void Isle::UpdateGlobe() } } -// STUB: LEGO1 0x100315f0 -MxLong Isle::HandleType19Notification(MxParam& p_param) +// FUNCTION: LEGO1 0x100315f0 +MxLong Isle::HandleType19Notification(MxType19NotificationParam& p_param) { - return 0; + MxLong result = 0; + + if (CurrentActor() != NULL) { + if (CurrentActor() == m_dunebuggy) { + result = m_dunebuggy->Notify(p_param); + } + else if (CurrentActor() == m_motocycle) { + result = m_motocycle->Notify(p_param); + } + } + + switch (m_act1state->m_unk0x018) { + case 3: + result = m_pizza->Notify(p_param); + break; + case 8: + result = m_towtrack->Notify(p_param); + break; + case 10: + result = m_ambulance->Notify(p_param); + break; + } + + if (result == 0) { + switch (p_param.GetUnknown0x0c()) { + case 0x12c: + AnimationManager()->FUN_10064670(NULL); + result = 1; + break; + case 0x12d: + AnimationManager()->FUN_10064880("brickstr", 0, 20000); + result = 1; + break; + case 0x131: + if (m_act1state->m_unk0x018 != 10) { + AnimationManager()->FUN_10064740(FALSE); + } + result = 1; + break; + case 0x132: + AnimationManager()->FUN_10064880("mama", 0, 20000); + AnimationManager()->FUN_10064880("papa", 0, 20000); + result = 1; + break; + case 0x136: + LegoEntity* bouy = (LegoEntity*) Find("MxEntity", "bouybump"); + if (bouy != NULL) { + NotificationManager()->Send(bouy, LegoEventNotificationParam(c_notificationType11, NULL, 0, 0, 0, 0)); + } + result = 1; + break; + } + } + + return result; } // FUNCTION: LEGO1 0x10031820 diff --git a/LEGO1/omni/include/mxtype19notificationparam.h b/LEGO1/omni/include/mxtype19notificationparam.h index 0833f299..2a44e2ac 100644 --- a/LEGO1/omni/include/mxtype19notificationparam.h +++ b/LEGO1/omni/include/mxtype19notificationparam.h @@ -8,7 +8,7 @@ // SIZE 0x10 class MxType19NotificationParam : public MxNotificationParam { public: - MxType19NotificationParam(NotificationId p_type, MxCore* p_sender, MxU8 p_unk0x0e, MxU16 p_unk0x0c) + MxType19NotificationParam(NotificationId p_type, MxCore* p_sender, MxU8 p_unk0x0e, MxS16 p_unk0x0c) : MxNotificationParam() { m_type = p_type; @@ -23,8 +23,10 @@ class MxType19NotificationParam : public MxNotificationParam { return new MxType19NotificationParam(m_type, m_sender, m_unk0x0e, m_unk0x0c); } // vtable+0x04 + inline MxS16 GetUnknown0x0c() { return m_unk0x0c; } + protected: - MxU16 m_unk0x0c; // 0x0c + MxS16 m_unk0x0c; // 0x0c MxU8 m_unk0x0e; // 0x0e };