From b3ce98a2ec9215d7f2cd2e6681afa0d889a9b726 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 26 Oct 2024 10:34:16 -0700 Subject: [PATCH] Implement/match Pizza::HandleClick (#1119) --- LEGO1/lego/legoomni/include/pizza.h | 10 +++-- LEGO1/lego/legoomni/include/pizzeria.h | 1 + LEGO1/lego/legoomni/src/actors/pizza.cpp | 45 ++++++++++++++++++++- LEGO1/lego/legoomni/src/actors/pizzeria.cpp | 6 +++ 4 files changed, 56 insertions(+), 6 deletions(-) diff --git a/LEGO1/lego/legoomni/include/pizza.h b/LEGO1/lego/legoomni/include/pizza.h index 45cfe968..0f9a9503 100644 --- a/LEGO1/lego/legoomni/include/pizza.h +++ b/LEGO1/lego/legoomni/include/pizza.h @@ -7,6 +7,7 @@ #include "legostate.h" class Act1State; +class PizzeriaState; class SkateBoard; // VTABLE: LEGO1 0x100d7408 @@ -69,11 +70,12 @@ class PizzaMissionState : public LegoState { // PizzaMissionState::`scalar deleting destructor' Mission* GetState(MxU8 p_id); + MxS16 FUN_10039540(); - undefined4 m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c - Mission m_state[5]; // 0x10 - undefined4 m_unk0xb0; // 0xb0 + PizzeriaState* m_pizzeriaState; // 0x08 + undefined4 m_unk0x0c; // 0x0c + Mission m_state[5]; // 0x10 + undefined4 m_unk0xb0; // 0xb0 }; // VTABLE: LEGO1 0x100d7380 diff --git a/LEGO1/lego/legoomni/include/pizzeria.h b/LEGO1/lego/legoomni/include/pizzeria.h index 028b2993..9544a071 100644 --- a/LEGO1/lego/legoomni/include/pizzeria.h +++ b/LEGO1/lego/legoomni/include/pizzeria.h @@ -40,6 +40,7 @@ class PizzeriaState : public LegoState { // SYNTHETIC: LEGO1 0x10017ce0 // PizzeriaState::`scalar deleting destructor' + MxS16 FUN_10017d50(); MxU32 FUN_10017d70(); // TODO: Most likely getters/setters are not used according to BETA. diff --git a/LEGO1/lego/legoomni/src/actors/pizza.cpp b/LEGO1/lego/legoomni/src/actors/pizza.cpp index ac47ea53..fa538f5a 100644 --- a/LEGO1/lego/legoomni/src/actors/pizza.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizza.cpp @@ -2,6 +2,7 @@ #include "isle.h" #include "isle_actions.h" +#include "jukebox_actions.h" #include "legoanimationmanager.h" #include "legogamestate.h" #include "legoutils.h" @@ -10,6 +11,8 @@ #include "mxbackgroundaudiomanager.h" #include "mxmisc.h" #include "mxticklemanager.h" +#include "mxtimer.h" +#include "pizzeria.h" #include "skateboard.h" DECOMP_SIZE_ASSERT(Pizza, 0x9c) @@ -121,10 +124,42 @@ void Pizza::StopActions() } } -// STUB: LEGO1 0x100383f0 +// FUNCTION: LEGO1 0x100383f0 MxLong Pizza::HandleClick() { - // TODO + if (m_state->m_unk0x0c == 1) { + m_state->m_unk0x0c = 2; + m_mission->m_startTime = Timer()->GetTime(); + TickleManager()->RegisterClient(this, 200); + AnimationManager()->FUN_10061010(FALSE); + } + + if (m_state->m_unk0x0c == 2) { + m_act1state->m_unk0x018 = 3; + + if (m_skateBoard == NULL) { + m_skateBoard = (SkateBoard*) m_world->Find(m_atomId, IsleScript::c_SkateBoard_Actor); + } + + IsleScript::Script action; + + switch (m_state->FUN_10039540()) { + case 0: + action = m_mission->m_actions[m_mission->m_numActions + 3]; + break; + case 1: + action = m_mission->m_actions[m_mission->m_numActions + 4]; + break; + default: + action = m_mission->m_actions[m_mission->m_numActions + 5]; + } + + FUN_10038fe0(action, TRUE); + m_state->m_unk0x0c = 3; + PlayMusic(JukeboxScript::c_PizzaMission_Music); + return 1; + } + return 0; } @@ -191,3 +226,9 @@ PizzaMissionState::Mission* PizzaMissionState::GetState(MxU8 p_id) return NULL; } + +// FUNCTION: LEGO1 0x10039540 +MxS16 PizzaMissionState::FUN_10039540() +{ + return m_pizzeriaState->FUN_10017d50(); +} diff --git a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp index 3b61ddb7..c706fb90 100644 --- a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp @@ -70,6 +70,12 @@ PizzeriaState::PizzeriaState() // TODO } +// STUB: LEGO1 0x10017d50 +MxS16 PizzeriaState::FUN_10017d50() +{ + return 0; +} + // STUB: LEGO1 0x10017d70 MxU32 PizzeriaState::FUN_10017d70() {