From ad353b7f3edee52cf71bc2a1754469188b5fffe9 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 28 Oct 2024 09:25:54 -0700 Subject: [PATCH] Implement/match Pizza::PlayAction (#1123) * Implement/match Pizza::PlayAction * Remove unused header --- .../legoomni/include/legoanimationmanager.h | 3 +- LEGO1/lego/legoomni/include/pizza.h | 10 +++---- LEGO1/lego/legoomni/src/actors/pizza.cpp | 28 ++++++++++++------- LEGO1/lego/legoomni/src/actors/pizzeria.cpp | 2 +- .../src/common/legoanimationmanager.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 1 + 6 files changed, 27 insertions(+), 19 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 3d181985..c568663e 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -1,7 +1,6 @@ #ifndef LEGOANIMATIONMANAGER_H #define LEGOANIMATIONMANAGER_H -#include "actionsfwd.h" #include "decomp.h" #include "legolocations.h" #include "legostate.h" @@ -161,7 +160,7 @@ class LegoAnimationManager : public MxCore { void FUN_10060570(MxBool p_unk0x1a); MxResult StartEntityAction(MxDSAction& p_dsAction, LegoEntity* p_entity); MxResult FUN_10060dc0( - IsleScript::Script p_objectId, + MxU32 p_objectId, MxMatrix* p_matrix, MxBool p_param3, MxBool p_param4, diff --git a/LEGO1/lego/legoomni/include/pizza.h b/LEGO1/lego/legoomni/include/pizza.h index addbc5e3..961d5923 100644 --- a/LEGO1/lego/legoomni/include/pizza.h +++ b/LEGO1/lego/legoomni/include/pizza.h @@ -132,7 +132,7 @@ class PizzaMissionState : public LegoState { MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c // FUNCTION: BETA10 0x100ef470 - void SetUnknown0xb0(undefined4 p_unk0xb0) { m_unk0xb0 = p_unk0xb0; } + void SetUnknown0xb0(MxU32 p_unk0xb0) { m_unk0xb0 = p_unk0xb0; } MxS16 GetHighScore(MxU8 p_actorId) { return GetMission(p_actorId)->m_hiScore; } @@ -145,7 +145,7 @@ class PizzaMissionState : public LegoState { PizzeriaState* m_pizzeriaState; // 0x08 undefined4 m_unk0x0c; // 0x0c Mission m_missions[5]; // 0x10 - undefined4 m_unk0xb0; // 0xb0 + MxU32 m_unk0xb0; // 0xb0 }; // VTABLE: LEGO1 0x100d7380 @@ -176,10 +176,10 @@ class Pizza : public IsleActor { MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param) override; // vtable+0x80 void CreateState(); - void FUN_10038220(MxU32 p_objectId); + void FUN_10038220(IsleScript::Script p_objectId); void FUN_100382b0(); void StopActions(); - void PlayAction(MxU32 p_objectId, MxBool); + void PlayAction(MxU32 p_objectId, MxBool p_param7); void SetSkateboard(SkateBoard* p_skateBoard) { m_skateBoard = p_skateBoard; } @@ -191,7 +191,7 @@ class Pizza : public IsleActor { PizzaMissionState::Mission* m_mission; // 0x80 SkateBoard* m_skateBoard; // 0x84 Act1State* m_act1state; // 0x88 - undefined4 m_unk0x8c; // 0x8c + IsleScript::Script m_unk0x8c; // 0x8c MxLong m_unk0x90; // 0x90 undefined4 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 9ef8792c..490068d3 100644 --- a/LEGO1/lego/legoomni/src/actors/pizza.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizza.cpp @@ -15,6 +15,7 @@ #include "mxtimer.h" #include "pizzeria.h" #include "skateboard.h" +#include "sndanim_actions.h" DECOMP_SIZE_ASSERT(Pizza, 0x9c) DECOMP_SIZE_ASSERT(PizzaMissionState, 0xb4) @@ -130,7 +131,7 @@ Pizza::Pizza() m_mission = NULL; m_skateBoard = NULL; m_act1state = NULL; - m_unk0x8c = -1; + m_unk0x8c = IsleScript::c_noneIsle; m_unk0x98 = FALSE; m_unk0x90 = INT_MIN; } @@ -171,7 +172,7 @@ void Pizza::CreateState() // FUNCTION: LEGO1 0x10038220 // FUNCTION: BETA10 0x100edb81 -void Pizza::FUN_10038220(MxU32 p_objectId) +void Pizza::FUN_10038220(IsleScript::Script p_objectId) { AnimationManager()->FUN_10064740(NULL); m_mission = m_state->GetMission(GameState()->GetActorId()); @@ -182,14 +183,14 @@ void Pizza::FUN_10038220(MxU32 p_objectId) AnimationManager()->EnableCamAnims(FALSE); AnimationManager()->FUN_1005f6d0(FALSE); PlayAction(p_objectId, FALSE); - m_unk0x8c = -1; + m_unk0x8c = IsleScript::c_noneIsle; } // FUNCTION: LEGO1 0x100382b0 void Pizza::FUN_100382b0() { if (m_state->m_unk0x0c != 8) { - if (m_unk0x8c != -1) { + if (m_unk0x8c != IsleScript::c_noneIsle) { InvokeAction(Extra::e_stop, *g_isleScript, m_unk0x8c, NULL); } @@ -202,7 +203,7 @@ void Pizza::FUN_100382b0() m_mission->m_startTime = INT_MIN; m_mission = NULL; m_unk0x98 = FALSE; - m_unk0x8c = -1; + m_unk0x8c = IsleScript::c_noneIsle; BackgroundAudioManager()->RaiseVolume(); TickleManager()->UnregisterClient(this); m_unk0x90 = INT_MIN; @@ -275,7 +276,7 @@ MxLong Pizza::HandlePathStruct(LegoPathStructNotificationParam& p_param) if (p_param.GetTrigger() == LegoPathStruct::c_s && p_param.GetData() == 0x12e && GameState()->GetActorId() == LegoActor::c_pepper) { m_state->m_unk0x0c = 5; - m_state->SetUnknown0xb0(0x12e); + m_state->SetUnknown0xb0(SndanimScript::c_TRS302_OpenJailDoor); if (time < m_mission->GetRedFinishTime()) { m_mission->UpdateScore(LegoState::e_red); @@ -371,10 +372,17 @@ MxLong Pizza::HandleEndAction(MxEndActionNotificationParam&) return 0; } -// STUB: LEGO1 0x10038fe0 -void Pizza::PlayAction(MxU32 p_objectId, MxBool) +// FUNCTION: LEGO1 0x10038fe0 +// FUNCTION: BETA10 0x100ef520 +void Pizza::PlayAction(MxU32 p_objectId, MxBool p_param7) { - // TODO + m_state->SetUnknown0xb0(p_objectId); + + if (m_unk0x8c != IsleScript::c_noneIsle) { + InvokeAction(Extra::e_stop, *g_isleScript, m_unk0x8c, NULL); + } + + AnimationManager()->FUN_10060dc0(p_objectId, NULL, TRUE, FALSE, NULL, FALSE, p_param7, TRUE, TRUE); } // FUNCTION: LEGO1 0x10039030 @@ -388,7 +396,7 @@ PizzaMissionState::PizzaMissionState() m_missions[3] = Mission(LegoActor::c_nick, 2, g_nickFinishTimes, g_nickActions, 4); m_missions[4] = Mission(LegoActor::c_laura, 2, g_lauraFinishTimes, g_lauraActions, 4); m_pizzeriaState = (PizzeriaState*) GameState()->GetState("PizzeriaState"); - m_unk0xb0 = -1; + m_unk0xb0 = IsleScript::c_noneIsle; } // FUNCTION: LEGO1 0x100393c0 diff --git a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp index c706fb90..c9135eb1 100644 --- a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp @@ -58,7 +58,7 @@ MxLong Pizzeria::HandleClick() AnimationManager()->FUN_10061010(FALSE); Pizza* pizza = (Pizza*) CurrentWorld()->Find(*g_isleScript, IsleScript::c_Pizza_Actor); - pizza->FUN_10038220(m_pizzeriaState->FUN_10017d70()); + pizza->FUN_10038220((IsleScript::Script) m_pizzeriaState->FUN_10017d70()); } return 1; diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index fa42d032..fc7431f8 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1108,7 +1108,7 @@ MxResult LegoAnimationManager::StartEntityAction(MxDSAction& p_dsAction, LegoEnt // FUNCTION: LEGO1 0x10060dc0 // FUNCTION: BETA10 0x10041f2c MxResult LegoAnimationManager::FUN_10060dc0( - IsleScript::Script p_objectId, + MxU32 p_objectId, MxMatrix* p_matrix, MxBool p_param3, MxBool p_param4, diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index fd739d87..66e7a559 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -33,6 +33,7 @@ #include "mxvariabletable.h" #include "pizza.h" #include "pizzeria.h" +#include "racecar.h" #include "scripts.h" #include "skateboard.h" #include "towtrack.h"