From a14795c0c846d9ab501eb60707d0a8aa2a3d7c8f Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 1 Nov 2024 10:30:11 -0700 Subject: [PATCH] Implement/match Pizza::Tickle (#1127) --- LEGO1/lego/legoomni/include/pizza.h | 8 +++- LEGO1/lego/legoomni/src/actors/pizza.cpp | 61 +++++++++++++++++++++++- 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/LEGO1/lego/legoomni/include/pizza.h b/LEGO1/lego/legoomni/include/pizza.h index 629020cf..43fe2bfd 100644 --- a/LEGO1/lego/legoomni/include/pizza.h +++ b/LEGO1/lego/legoomni/include/pizza.h @@ -83,6 +83,12 @@ class PizzaMissionState : public LegoState { } } + // FUNCTION: BETA10 0x100ef7b0 + IsleScript::Script GetUnknownFinishAction() { return m_actions[m_numActions + 2]; } + + // FUNCTION: BETA10 0x100ef7e0 + MxLong GetTimeoutTime() { return m_finishTimes[3]; } + MxResult WriteToFile(LegoFile* p_file) { Write(p_file, m_unk0x06); @@ -205,7 +211,7 @@ class Pizza : public IsleActor { Act1State* m_act1state; // 0x88 IsleScript::Script m_unk0x8c; // 0x8c MxLong m_unk0x90; // 0x90 - undefined4 m_unk0x94; // 0x94 + MxLong m_unk0x94; // 0x94 MxBool m_unk0x98; // 0x98 }; diff --git a/LEGO1/lego/legoomni/src/actors/pizza.cpp b/LEGO1/lego/legoomni/src/actors/pizza.cpp index 82589946..a8337cd7 100644 --- a/LEGO1/lego/legoomni/src/actors/pizza.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizza.cpp @@ -358,10 +358,67 @@ MxLong Pizza::HandlePathStruct(LegoPathStructNotificationParam& p_param) return 0; } -// STUB: LEGO1 0x100388a0 +// FUNCTION: LEGO1 0x100388a0 +// FUNCTION: BETA10 0x100ee2d9 MxResult Pizza::Tickle() { - // TODO + MxLong time = Timer()->GetTime(); + + if (m_unk0x90 != INT_MIN && m_unk0x94 + m_unk0x90 <= time) { + m_unk0x90 = INT_MIN; + m_skateBoard->EnableScenePresentation(FALSE); + m_skateBoard->SetUnknown0x160(FALSE); + TickleManager()->UnregisterClient(this); + } + + if (m_mission != NULL && m_mission->m_startTime != INT_MIN) { + if (m_state->m_unk0x0c == 4) { + if (time > m_mission->m_startTime + m_mission->GetTimeoutTime()) { + StopActions(); + m_mission->UpdateScore(LegoState::e_grey); + FUN_100382b0(); + BackgroundAudioManager()->LowerVolume(); + InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_Avo917In_PlayWav, NULL); + } + else if (time >= m_mission->m_startTime + 35000 && m_unk0x8c == IsleScript::c_noneIsle) { + switch (GameState()->GetActorId()) { + case LegoActor::c_pepper: + m_unk0x8c = IsleScript::c_Avo914In_PlayWav; + break; + case LegoActor::c_mama: + m_unk0x8c = IsleScript::c_Avo910In_PlayWav; + break; + case LegoActor::c_papa: + m_unk0x8c = IsleScript::c_Avo912In_PlayWav; + break; + case LegoActor::c_nick: + m_unk0x8c = IsleScript::c_Avo911In_PlayWav; + break; + case LegoActor::c_laura: + m_unk0x8c = IsleScript::c_Avo913In_PlayWav; + break; + } + + BackgroundAudioManager()->LowerVolume(); + + if (m_unk0x8c != IsleScript::c_noneIsle) { + InvokeAction(Extra::e_start, *g_isleScript, m_unk0x8c, NULL); + } + } + } + else if (m_state->m_unk0x0c == 2) { + if (Timer()->GetTime() > m_mission->m_startTime + 5000) { + m_skateBoard->SetUnknown0x160(FALSE); + m_skateBoard->EnableScenePresentation(FALSE); + TickleManager()->UnregisterClient(this); + m_mission->UpdateScore(LegoState::e_grey); + m_state->m_unk0x0c = 9; + AnimationManager()->FUN_1005f6d0(TRUE); + PlayAction(m_mission->GetUnknownFinishAction(), TRUE); + } + } + } + return SUCCESS; }