From 33fe94cbb2ef4a100eca5f73a65cd1139d9845b8 Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Sun, 11 Feb 2024 16:08:53 -0500 Subject: [PATCH] implement RegistrationBook::Notify --- .../lego/legoomni/include/registrationbook.h | 23 +++++++ .../src/infocenter/registrationbook.cpp | 65 +++++++++++++++++-- 2 files changed, 83 insertions(+), 5 deletions(-) diff --git a/LEGO1/lego/legoomni/include/registrationbook.h b/LEGO1/lego/legoomni/include/registrationbook.h index cc4f8fd4..f941521b 100644 --- a/LEGO1/lego/legoomni/include/registrationbook.h +++ b/LEGO1/lego/legoomni/include/registrationbook.h @@ -4,11 +4,29 @@ #include "legoworld.h" class InfocenterState; +class MxEndActionNotificationParam; +class LegoControlManagerEvent; // VTABLE: LEGO1 0x100d9928 // SIZE 0x2d0 class RegistrationBook : public LegoWorld { public: + enum RegistrationBookScript { + c_alphabetCtl = 5, + c_aBitmap = 6, + c_backgroundBitmap = 36, + c_checkHiLiteBitmap = 37, + c_check0ctl = 68, + c_check1ctl = 71, + c_check2ctl = 74, + c_check3ctl = 77, + c_check4ctl = 80, + c_check5ctl = 83, + c_check6ctl = 86, + c_check7ctl = 89, + c_check8ctl = 92, + c_check9ctl = 95, + }; RegistrationBook(); ~RegistrationBook() override; // vtable+0x00 @@ -56,6 +74,11 @@ class RegistrationBook : public LegoWorld { undefined4 m_unk0x2c4; // 0x2c4 undefined4 m_unk0x2c8; // 0x2c8 undefined4 m_unk0x2cc; // 0x2cc + + MxLong HandleEndAction(MxEndActionNotificationParam& p_param); + MxLong HandleKeyPress(char p_key); + MxLong HandleClick(LegoControlManagerEvent& p_param); + MxLong HandleNotification19(MxParam& p_param); }; #endif // REGISTRATIONBOOK_H diff --git a/LEGO1/lego/legoomni/src/infocenter/registrationbook.cpp b/LEGO1/lego/legoomni/src/infocenter/registrationbook.cpp index 0e0125ce..f8494bfe 100644 --- a/LEGO1/lego/legoomni/src/infocenter/registrationbook.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/registrationbook.cpp @@ -5,7 +5,9 @@ #include "legogamestate.h" #include "legoinputmanager.h" #include "legoomni.h" +#include "mxactionnotificationparam.h" #include "mxnotificationmanager.h" +#include "mxtimer.h" DECOMP_SIZE_ASSERT(RegistrationBook, 0x2d0) @@ -56,12 +58,60 @@ MxResult RegistrationBook::Create(MxDSAction& p_dsAction) return result; } -// STUB: LEGO1 0x100770e0 +// STUB: LEGO1 0x10077210 +MxLong RegistrationBook::HandleEndAction(MxEndActionNotificationParam& p_param) +{ + return 0; +} + +// STUB: LEGO1 0x100772d0 +MxLong RegistrationBook::HandleKeyPress(char p_key) +{ + return 0; +} + +// STUB: LEGO1 0x100774a0 +MxLong RegistrationBook::HandleClick(LegoControlManagerEvent& p_param) +{ + return 0; +} + +// STUB: LEGO1 0x100781d0 +MxLong RegistrationBook::HandleNotification19(MxParam& p_param) +{ + return 0; +} + +// FUNCTION: LEGO1 0x100770e0 MxLong RegistrationBook::Notify(MxParam& p_param) { - // TODO - - return 0; + MxLong result = 0; + LegoWorld::Notify(p_param); + if (m_worldStarted) { + switch (((MxNotificationParam&) p_param).GetType()) { + case c_notificationEndAction: + result = HandleEndAction((MxEndActionNotificationParam&) p_param); + break; + case c_notificationKeyPress: + m_unk0xf8 = Timer()->GetTime(); + result = HandleKeyPress(((LegoEventNotificationParam&) p_param).GetKey()); + break; + case c_notificationButtonDown: + m_unk0xf8 = Timer()->GetTime(); + result = 0; + break; + case c_notificationClick: + result = HandleClick((LegoControlManagerEvent&) p_param); + break; + case c_notificationType19: + result = HandleNotification19(p_param); + break; + case c_notificationTransitioned: + GameState()->SwitchArea(LegoGameState::e_infomain); + break; + } + } + return result; } // STUB: LEGO1 0x10077cc0 @@ -73,7 +123,12 @@ void RegistrationBook::ReadyWorld() // STUB: LEGO1 0x10077fd0 MxResult RegistrationBook::Tickle() { - // TODO + if (!m_worldStarted) { + LegoWorld::Tickle(); + } + else { + // TODO + } return SUCCESS; }