From b38a2a49804a9ca28f6e45d0aea5a71161df8402 Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Sun, 17 Mar 2024 14:58:27 -0400 Subject: [PATCH] implement RegistrationBook::HandleClick (#685) * implement RegistrationBook::HandleClick * fix build * Style --------- Co-authored-by: Christian Semmler --- .../lego/legoomni/include/registrationbook.h | 1 + .../legoomni/src/worlds/registrationbook.cpp | 49 ++++++++++++++++++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/LEGO1/lego/legoomni/include/registrationbook.h b/LEGO1/lego/legoomni/include/registrationbook.h index c941ce5c..c7210320 100644 --- a/LEGO1/lego/legoomni/include/registrationbook.h +++ b/LEGO1/lego/legoomni/include/registrationbook.h @@ -68,6 +68,7 @@ private: MxLong HandleKeyPress(MxS8 p_key); MxLong HandleClick(LegoControlManagerEvent& p_param); MxLong HandleNotification19(MxParam& p_param); + void FUN_100775c0(MxS16 p_playerIndex); }; #endif // REGISTRATIONBOOK_H diff --git a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp index 3775b1bc..31d720da 100644 --- a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp @@ -12,6 +12,7 @@ #include "mxmisc.h" #include "mxnotificationmanager.h" #include "mxtimer.h" +#include "mxtransitionmanager.h" #include "regbook_actions.h" DECOMP_SIZE_ASSERT(RegistrationBook, 0x2d0) @@ -113,10 +114,54 @@ MxLong RegistrationBook::HandleKeyPress(MxS8 p_key) return 0; } -// STUB: LEGO1 0x100774a0 +// FUNCTION: LEGO1 0x100774a0 MxLong RegistrationBook::HandleClick(LegoControlManagerEvent& p_param) { - return 0; + MxS16 unk0x28 = p_param.GetUnknown0x28(); + + if (unk0x28 >= 1 && unk0x28 <= 28) { + if (p_param.GetClickedObjectId() == RegbookScript::c_Alphabet_Ctl) { + if (unk0x28 == 28) { + DeleteObjects(&m_atom, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav); + + if (GameState()->GetCurrentAct() == 0) { + m_infocenterState->SetUnknown0x74(15); + } + else { + m_infocenterState->SetUnknown0x74(2); + } + + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + } + else { + if (unk0x28 > 28) { + return 1; + } + + HandleKeyPress(unk0x28 < 27 ? unk0x28 + 64 : 8); + } + } + else { + InputManager()->DisableInputProcessing(); + DeleteObjects(&m_atom, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav); + + MxS16 i; + for (i = 0; i < 10; i++) { + if (m_checkmark[i]->GetAction()->GetObjectId() == p_param.GetClickedObjectId()) { + break; + } + } + + FUN_100775c0(i); + } + } + + return 1; +} + +// STUB: LEGO1 0x100775c0 +void RegistrationBook::FUN_100775c0(MxS16 p_playerIndex) +{ } // FUNCTION: LEGO1 0x10077cc0