diff --git a/LEGO1/lego/legoomni/include/pizza.h b/LEGO1/lego/legoomni/include/pizza.h index 0f9a9503..ac1091f9 100644 --- a/LEGO1/lego/legoomni/include/pizza.h +++ b/LEGO1/lego/legoomni/include/pizza.h @@ -16,7 +16,49 @@ class PizzaMissionState : public LegoState { public: // SIZE 0x20 struct Mission { - public: + // FUNCTION: LEGO1 0x10039220 + // FUNCTION: BETA10 0x100ef880 + Mission() {} + + // FUNCTION: BETA10 0x100ef8a0 + Mission( + MxU8 p_actorId, + undefined2 p_unk0x04, + MxLong* p_finishTimes, + IsleScript::Script* p_actions, + MxS16 p_numActions + ) + { + m_numActions = p_numActions; + m_actorId = p_actorId; + m_unk0x04 = p_unk0x04; + m_unk0x06 = 1; + m_unk0x08 = 1; + m_finishTimes = p_finishTimes; + m_startTime = INT_MIN; + m_unk0x14 = 1; + m_unk0x16 = 0; + m_score = 0; + m_actions = p_actions; + } + + // FUNCTION: LEGO1 0x10039230 + Mission& operator=(const Mission& p_mission) + { + m_actorId = p_mission.m_actorId; + m_unk0x04 = p_mission.m_unk0x04; + m_unk0x06 = p_mission.m_unk0x06; + m_unk0x08 = p_mission.m_unk0x08; + m_finishTimes = p_mission.m_finishTimes; + m_startTime = p_mission.m_startTime; + m_unk0x14 = p_mission.m_unk0x14; + m_unk0x16 = p_mission.m_unk0x16; + m_score = p_mission.m_score; + m_actions = p_mission.m_actions; + m_numActions = p_mission.m_numActions; + return *this; + } + MxResult WriteToFile(LegoFile* p_file) { Write(p_file, m_unk0x06); @@ -36,10 +78,11 @@ class PizzaMissionState : public LegoState { } MxS16 m_numActions; // 0x00 - MxU8 m_id; // 0x02 - undefined m_unk0x03[3]; // 0x03 + MxU8 m_actorId; // 0x02 + undefined2 m_unk0x04; // 0x04 MxS16 m_unk0x06; // 0x06 - undefined m_unk0x08[8]; // 0x08 + undefined m_unk0x08; // 0x08 + MxLong* m_finishTimes; // 0x0c MxLong m_startTime; // 0x10 MxS16 m_unk0x14; // 0x14 MxS16 m_unk0x16; // 0x16 @@ -64,17 +107,20 @@ class PizzaMissionState : public LegoState { MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c - MxS16 GetHighScore(MxU8 p_id) { return GetState(p_id)->m_score; } + // FUNCTION: BETA10 0x100ef470 + void SetUnknown0xb0(undefined4 p_unk0xb0) { m_unk0xb0 = p_unk0xb0; } + + MxS16 GetHighScore(MxU8 p_actorId) { return GetMission(p_actorId)->m_score; } // SYNTHETIC: LEGO1 0x10039350 // PizzaMissionState::`scalar deleting destructor' - Mission* GetState(MxU8 p_id); + Mission* GetMission(MxU8 p_actorId); MxS16 FUN_10039540(); PizzeriaState* m_pizzeriaState; // 0x08 undefined4 m_unk0x0c; // 0x0c - Mission m_state[5]; // 0x10 + Mission m_missions[5]; // 0x10 undefined4 m_unk0xb0; // 0xb0 }; @@ -100,10 +146,10 @@ class Pizza : public IsleActor { return !strcmp(p_name, Pizza::ClassName()) || IsleActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - MxLong HandleClick() override; // vtable+0x68 - MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74 - MxLong HandlePathStruct(LegoPathStructNotificationParam&) override; // vtable+0x80 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + MxLong HandleClick() override; // vtable+0x68 + MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74 + MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param) override; // vtable+0x80 void CreateState(); void FUN_10038220(MxU32 p_objectId); @@ -124,7 +170,7 @@ class Pizza : public IsleActor { undefined4 m_unk0x8c; // 0x8c undefined4 m_unk0x90; // 0x90 undefined4 m_unk0x94; // 0x94 - undefined m_unk0x98; // 0x98 + MxBool m_unk0x98; // 0x98 }; #endif // PIZZA_H diff --git a/LEGO1/lego/legoomni/src/actors/pizza.cpp b/LEGO1/lego/legoomni/src/actors/pizza.cpp index fa538f5a..111fccc8 100644 --- a/LEGO1/lego/legoomni/src/actors/pizza.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizza.cpp @@ -5,6 +5,7 @@ #include "jukebox_actions.h" #include "legoanimationmanager.h" #include "legogamestate.h" +#include "legopathstruct.h" #include "legoutils.h" #include "legoworld.h" #include "misc.h" @@ -22,6 +23,61 @@ DECOMP_SIZE_ASSERT(PizzaMissionState::Mission, 0x20) // Flags used in isle.cpp extern MxU32 g_isleFlags; +// GLOBAL: LEGO1 0x100f3a80 +IsleScript::Script g_pepperActions[] = { + IsleScript::c_pnsx48pr_RunAnim, + IsleScript::c_pnsx69pr_RunAnim, + IsleScript::c_pns125ni_RunAnim, + IsleScript::c_pns122pr_RunAnim +}; + +// GLOBAL: LEGO1 0x100f3ab8 +MxLong g_pepperFinishTimes[] = {100000, 200000, 300000, 350000}; + +// GLOBAL: LEGO1 0x100f3ac8 +IsleScript::Script g_lauraActions[] = { + IsleScript::c_pns096pr_RunAnim, + IsleScript::c_pns097pr_RunAnim, + IsleScript::c_pns098pr_RunAnim, + IsleScript::c_pns099pr_RunAnim +}; + +// GLOBAL: LEGO1 0x100f3b00 +MxLong g_lauraFinishTimes[] = {100000, 200000, 300000, 350000}; + +// GLOBAL: LEGO1 0x100f3b10 +IsleScript::Script g_nickActions[] = { + IsleScript::c_pns042bm_RunAnim, + IsleScript::c_pns043en_RunAnim, + IsleScript::c_pns045p1_RunAnim, + IsleScript::c_pns048pr_RunAnim +}; + +// GLOBAL: LEGO1 0x100f3b48 +MxLong g_nickFinishTimes[] = {100000, 200000, 300000, 350000}; + +// GLOBAL: LEGO1 0x100f3b58 +IsleScript::Script g_mamaActions[] = { + IsleScript::c_pns022pr_RunAnim, + IsleScript::c_pns021dl_RunAnim, + IsleScript::c_pns018rd_RunAnim, + IsleScript::c_pns019pr_RunAnim +}; + +// GLOBAL: LEGO1 0x100f3b90 +MxLong g_mamaFinishTimes[] = {100000, 200000, 300000, 350000}; + +// GLOBAL: LEGO1 0x100f3ba0 +IsleScript::Script g_papaActions[] = { + IsleScript::c_pns065rd_RunAnim, + IsleScript::c_pns066db_RunAnim, + IsleScript::c_pns067gd_RunAnim, + IsleScript::c_pns069pr_RunAnim +}; + +// GLOBAL: LEGO1 0x100f3bd8 +MxLong g_papaFinishTimes[] = {100000, 200000, 300000, 350000}; + // FUNCTION: LEGO1 0x10037ef0 Pizza::Pizza() { @@ -30,7 +86,7 @@ Pizza::Pizza() m_skateBoard = NULL; m_act1state = NULL; m_unk0x8c = -1; - m_unk0x98 = 0; + m_unk0x98 = FALSE; m_unk0x90 = INT_MIN; } @@ -73,7 +129,7 @@ void Pizza::CreateState() void Pizza::FUN_10038220(MxU32 p_objectId) { AnimationManager()->FUN_10064740(NULL); - m_mission = m_state->GetState(GameState()->GetActorId()); + m_mission = m_state->GetMission(GameState()->GetActorId()); m_state->m_unk0x0c = 1; m_act1state->m_unk0x018 = 3; m_mission->m_startTime = INT_MIN; @@ -100,7 +156,7 @@ void Pizza::FUN_100382b0() AnimationManager()->FUN_1005f6d0(TRUE); m_mission->m_startTime = INT_MIN; m_mission = NULL; - m_unk0x98 = 0; + m_unk0x98 = FALSE; m_unk0x8c = -1; BackgroundAudioManager()->RaiseVolume(); TickleManager()->UnregisterClient(this); @@ -125,6 +181,7 @@ void Pizza::StopActions() } // FUNCTION: LEGO1 0x100383f0 +// FUNCTION: BETA10 0x100edd10 MxLong Pizza::HandleClick() { if (m_state->m_unk0x0c == 1) { @@ -164,7 +221,8 @@ MxLong Pizza::HandleClick() } // STUB: LEGO1 0x100384f0 -MxLong Pizza::HandlePathStruct(LegoPathStructNotificationParam&) +// FUNCTION: BETA10 0x100ede53 +MxLong Pizza::HandlePathStruct(LegoPathStructNotificationParam& p_param) { // TODO return 0; @@ -190,10 +248,18 @@ void Pizza::FUN_10038fe0(MxU32 p_objectId, MxBool) // TODO } -// STUB: LEGO1 0x10039030 +// FUNCTION: LEGO1 0x10039030 +// FUNCTION: BETA10 0x100eea25 PizzaMissionState::PizzaMissionState() { - // TODO + m_unk0x0c = 0; + m_missions[0] = Mission(LegoActor::c_pepper, 2, g_pepperFinishTimes, g_pepperActions, sizeOfArray(g_pepperActions)); + m_missions[1] = Mission(LegoActor::c_mama, 2, g_mamaFinishTimes, g_mamaActions, sizeOfArray(g_mamaActions)); + m_missions[2] = Mission(LegoActor::c_papa, 2, g_papaFinishTimes, g_papaActions, sizeOfArray(g_papaActions)); + m_missions[3] = Mission(LegoActor::c_nick, 2, g_nickFinishTimes, g_nickActions, sizeOfArray(g_nickActions)); + m_missions[4] = Mission(LegoActor::c_laura, 2, g_lauraFinishTimes, g_lauraActions, sizeOfArray(g_lauraActions)); + m_pizzeriaState = (PizzeriaState*) GameState()->GetState("PizzeriaState"); + m_unk0xb0 = -1; } // FUNCTION: LEGO1 0x100393c0 @@ -203,12 +269,12 @@ MxResult PizzaMissionState::Serialize(LegoFile* p_file) if (p_file->IsReadMode()) { for (MxS16 i = 0; i < 5; i++) { - m_state[i].ReadFromFile(p_file); + m_missions[i].ReadFromFile(p_file); } } else if (p_file->IsWriteMode()) { for (MxS16 i = 0; i < 5; i++) { - m_state[i].WriteToFile(p_file); + m_missions[i].WriteToFile(p_file); } } @@ -216,11 +282,11 @@ MxResult PizzaMissionState::Serialize(LegoFile* p_file) } // FUNCTION: LEGO1 0x10039510 -PizzaMissionState::Mission* PizzaMissionState::GetState(MxU8 p_id) +PizzaMissionState::Mission* PizzaMissionState::GetMission(MxU8 p_actorId) { for (MxS16 i = 0; i < 5; i++) { - if (m_state[i].m_id == p_id) { - return m_state + i; + if (m_missions[i].m_actorId == p_actorId) { + return m_missions + i; } }