From 724cdeb86f9c45ecca35ae640b592a1e6315a019 Mon Sep 17 00:00:00 2001 From: Joshua Peisach Date: Sat, 3 Feb 2024 16:30:00 -0500 Subject: [PATCH] Implement Police::Notify (#524) * Implement Police::Notify * Fix HandleKeyPress --------- Co-authored-by: Christian Semmler --- LEGO1/lego/legoomni/include/police.h | 10 +++-- LEGO1/lego/legoomni/src/police/police.cpp | 52 ++++++++++++++++++++--- 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/LEGO1/lego/legoomni/include/police.h b/LEGO1/lego/legoomni/include/police.h index 595f5ede..798fc0a2 100644 --- a/LEGO1/lego/legoomni/include/police.h +++ b/LEGO1/lego/legoomni/include/police.h @@ -40,9 +40,13 @@ public: // Police::`scalar deleting destructor' private: - Radio m_radio; // 0xf8 - PoliceState* m_policeState; // 0x108 - undefined4 m_unk0x10c; // 0x10c + MxLong HandleNotification11(MxNotificationParam& p_param); + MxLong HandleEndAction(MxEndActionNotificationParam& p_param); + MxLong HandleKeyPress(LegoEventNotificationParam& p_param); + + Radio m_radio; // 0xf8 + PoliceState* m_policeState; // 0x108 + undefined4 m_transitionDestination; // 0x10c }; #endif // POLICE_H diff --git a/LEGO1/lego/legoomni/src/police/police.cpp b/LEGO1/lego/legoomni/src/police/police.cpp index c14c482b..059d4473 100644 --- a/LEGO1/lego/legoomni/src/police/police.cpp +++ b/LEGO1/lego/legoomni/src/police/police.cpp @@ -13,15 +13,14 @@ DECOMP_SIZE_ASSERT(Police, 0x110) Police::Police() { m_policeState = NULL; - m_unk0x10c = 0; + m_transitionDestination = 0; NotificationManager()->Register(this); } -// STUB: LEGO1 0x1005e1d0 +// FUNCTION: LEGO1 0x1005e1d0 MxBool Police::VTable0x5c() { - // TODO - return FALSE; + return TRUE; } // FUNCTION: LEGO1 0x1005e320 @@ -60,12 +59,30 @@ MxResult Police::Create(MxDSAction& p_dsAction) return ret; } -// STUB: LEGO1 0x1005e480 +// FUNCTION: LEGO1 0x1005e480 MxLong Police::Notify(MxParam& p_param) { - // TODO + MxLong result = 0; + LegoWorld::Notify(p_param); - return 0; + if (m_worldStarted) { + switch (((MxNotificationParam&) p_param).GetNotification()) { + case c_notificationEndAction: + result = HandleEndAction((MxEndActionNotificationParam&) p_param); + break; + case c_notificationKeyPress: + result = HandleKeyPress(((LegoEventNotificationParam&) p_param)); + break; + case c_notificationType11: + result = HandleNotification11((MxNotificationParam&) p_param); + break; + case c_notificationTransitioned: + GameState()->SwitchArea(m_transitionDestination); + break; + } + } + + return result; } // FUNCTION: LEGO1 0x1005e530 @@ -76,6 +93,27 @@ void Police::ReadyWorld() FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); } +// STUB: LEGO1 0x1005e550 +MxLong Police::HandleNotification11(MxNotificationParam& p_param) +{ + // TODO + return 0; +} + +// STUB: LEGO1 0x1005e6a0 +MxLong Police::HandleEndAction(MxEndActionNotificationParam& p_param) +{ + // TODO + return 0; +} + +// STUB: LEGO1 0x1005e6f0 +MxLong Police::HandleKeyPress(LegoEventNotificationParam& p_param) +{ + // TODO + return 0; +} + // STUB: LEGO1 0x1005e740 void Police::Enable(MxBool p_enable) {