From 72aa7e330df19a7f39d6cd03aa3b3c09a4e1743b Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 5 Jan 2025 10:40:07 -0700 Subject: [PATCH] Order functions up to the end of `GasStation`, match `GasStation::ReadyWorld` (#1311) * Minor improvements * Match `GasStation::ReadyWorld` * Reorder --- LEGO1/lego/legoomni/include/gasstation.h | 11 +- LEGO1/lego/legoomni/include/legostate.h | 32 ++--- LEGO1/lego/legoomni/src/worlds/gasstation.cpp | 114 ++++++++---------- 3 files changed, 71 insertions(+), 86 deletions(-) diff --git a/LEGO1/lego/legoomni/include/gasstation.h b/LEGO1/lego/legoomni/include/gasstation.h index 76b2d17cff..d3ed67dfae 100644 --- a/LEGO1/lego/legoomni/include/gasstation.h +++ b/LEGO1/lego/legoomni/include/gasstation.h @@ -14,11 +14,6 @@ class MxStillPresenter; // SIZE 0x24 class GasStationState : public LegoState { public: - // SIZE 0x04 - struct Unknown0x14 { - undefined4 m_unk0x00; // 0x00 - }; - GasStationState(); // FUNCTION: LEGO1 0x100061d0 @@ -47,7 +42,7 @@ class GasStationState : public LegoState { // TODO: Most likely getters/setters are not used according to BETA. GarageScript::Script m_actions[3]; // 0x08 - Unknown0x14 m_unk0x14; // 0x14 + undefined4 m_unk0x14; // 0x14 MxS16 m_pepperAction; // 0x18 MxS16 m_mamaAction; // 0x1a MxS16 m_papaAction; // 0x1c @@ -66,6 +61,9 @@ class GasStation : public LegoWorld { MxLong Notify(MxParam& p_param) override; // vtable+0x04 MxResult Tickle() override; // vtable+0x08 + // FUNCTION: LEGO1 0x10004770 + MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c + // FUNCTION: LEGO1 0x10004780 // FUNCTION: BETA10 0x10029d40 const char* ClassName() const override // vtable+0x0c @@ -82,7 +80,6 @@ class GasStation : public LegoWorld { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 void ReadyWorld() override; // vtable+0x50 - MxBool VTable0x5c() override; // vtable+0x5c MxBool Escape() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 virtual MxLong HandleControl(LegoControlManagerNotificationParam& p_param); // vtable+0x6c diff --git a/LEGO1/lego/legoomni/include/legostate.h b/LEGO1/lego/legoomni/include/legostate.h index b8b9c47fe3..09dc1fcf1a 100644 --- a/LEGO1/lego/legoomni/include/legostate.h +++ b/LEGO1/lego/legoomni/include/legostate.h @@ -84,22 +84,6 @@ class LegoState : public MxCore { // FUNCTION: LEGO1 0x10005f40 ~LegoState() override {} - // FUNCTION: LEGO1 0x100060d0 - // FUNCTION: BETA10 0x10017d20 - const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f01b8 - // STRING: BETA10 0x101dcdac - return "LegoState"; - } - - // FUNCTION: LEGO1 0x100060e0 - // FUNCTION: BETA10 0x100a9000 - MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, LegoState::ClassName()) || MxCore::IsA(p_name); - } - // FUNCTION: LEGO1 0x10005f90 virtual MxBool IsSerializable() { return TRUE; } // vtable+0x14 @@ -116,6 +100,22 @@ class LegoState : public MxCore { return SUCCESS; } // vtable+0x1c + // FUNCTION: LEGO1 0x100060d0 + // FUNCTION: BETA10 0x10017d20 + const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f01b8 + // STRING: BETA10 0x101dcdac + return "LegoState"; + } + + // FUNCTION: LEGO1 0x100060e0 + // FUNCTION: BETA10 0x100a9000 + MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, LegoState::ClassName()) || MxCore::IsA(p_name); + } + // SYNTHETIC: LEGO1 0x10006160 // LegoState::`scalar deleting destructor' }; diff --git a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp index 43d03cc7e8..77e7da0677 100644 --- a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp +++ b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp @@ -48,12 +48,6 @@ GasStation::GasStation() NotificationManager()->Register(this); } -// FUNCTION: LEGO1 0x10004770 -MxBool GasStation::VTable0x5c() -{ - return TRUE; -} - // FUNCTION: LEGO1 0x100048c0 GasStation::~GasStation() { @@ -69,6 +63,7 @@ GasStation::~GasStation() } // FUNCTION: LEGO1 0x10004990 +// FUNCTION: BETA10 0x100286c0 MxResult GasStation::Create(MxDSAction& p_dsAction) { MxResult result = LegoWorld::Create(p_dsAction); @@ -82,13 +77,13 @@ MxResult GasStation::Create(MxDSAction& p_dsAction) m_state = (GasStationState*) GameState()->GetState("GasStationState"); if (!m_state) { m_state = (GasStationState*) GameState()->CreateState("GasStationState"); - m_state->m_unk0x14.m_unk0x00 = 1; + m_state->m_unk0x14 = 1; } - else if (m_state->m_unk0x14.m_unk0x00 == 4) { - m_state->m_unk0x14.m_unk0x00 = 4; + else if (m_state->m_unk0x14 == 4) { + m_state->m_unk0x14 = 4; } else { - m_state->m_unk0x14.m_unk0x00 = 3; + m_state->m_unk0x14 = 3; } GameState()->m_currentArea = LegoGameState::e_garage; @@ -122,6 +117,7 @@ MxLong GasStation::Notify(MxParam& p_param) result = HandleControl((LegoControlManagerNotificationParam&) p_param); break; case c_notificationTransitioned: + assert(m_destLocation != LegoGameState::e_undefined); GameState()->SwitchArea(m_destLocation); break; } @@ -131,6 +127,7 @@ MxLong GasStation::Notify(MxParam& p_param) } // FUNCTION: LEGO1 0x10004b30 +// FUNCTION: BETA10 0x10028a5e void GasStation::ReadyWorld() { PlayMusic(JukeboxScript::c_JBMusic2); @@ -142,22 +139,22 @@ void GasStation::ReadyWorld() case LegoActor::c_pepper: switch (m_state->m_pepperAction) { case 0: - m_state->m_unk0x14.m_unk0x00 = 5; + m_state->m_unk0x14 = 5; PlayAction(GarageScript::c_wgs002nu_RunAnim); m_unk0x106 = 1; break; case 1: - m_state->m_unk0x14.m_unk0x00 = 5; + m_state->m_unk0x14 = 5; PlayAction(GarageScript::c_wgs003nu_RunAnim); m_unk0x106 = 1; break; case 2: - m_state->m_unk0x14.m_unk0x00 = 5; + m_state->m_unk0x14 = 5; PlayAction(GarageScript::c_wgs004nu_RunAnim); m_unk0x106 = 1; break; default: - m_state->m_unk0x14.m_unk0x00 = 6; + m_state->m_unk0x14 = 6; PlayAction(GarageScript::c_wgs008nu_RunAnim); m_unk0x106 = 1; m_unk0x104 = 1; @@ -167,23 +164,21 @@ void GasStation::ReadyWorld() if (m_state->m_pepperAction < 5) { m_state->m_pepperAction++; } - - FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; case LegoActor::c_mama: switch (m_state->m_mamaAction) { case 0: - m_state->m_unk0x14.m_unk0x00 = 5; + m_state->m_unk0x14 = 5; PlayAction(GarageScript::c_wgs006nu_RunAnim); m_unk0x106 = 1; break; case 1: - m_state->m_unk0x14.m_unk0x00 = 5; + m_state->m_unk0x14 = 5; PlayAction(GarageScript::c_wgs007nu_RunAnim); m_unk0x106 = 1; break; default: - m_state->m_unk0x14.m_unk0x00 = 6; + m_state->m_unk0x14 = 6; PlayAction(GarageScript::c_wgs008nu_RunAnim); m_unk0x106 = 1; m_unk0x104 = 1; @@ -193,75 +188,69 @@ void GasStation::ReadyWorld() if (m_state->m_mamaAction < 5) { m_state->m_mamaAction++; } - - FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; - case LegoActor::c_papa: - switch (m_state->m_papaAction) { + case LegoActor::c_nick: + switch (m_state->m_nickAction) { case 0: - m_state->m_unk0x14.m_unk0x00 = 5; - PlayAction(GarageScript::c_wgs012nu_RunAnim); + m_state->m_unk0x14 = 5; + PlayAction(GarageScript::c_wgs009nu_RunAnim); m_unk0x106 = 1; break; case 1: - m_state->m_unk0x14.m_unk0x00 = 5; - PlayAction(GarageScript::c_wgs014nu_RunAnim); + m_state->m_unk0x14 = 5; + PlayAction(GarageScript::c_wgs010nu_RunAnim); m_unk0x106 = 1; break; default: - m_state->m_unk0x14.m_unk0x00 = 6; - PlayAction(GarageScript::c_wgs017nu_RunAnim); + m_state->m_unk0x14 = 6; + PlayAction(GarageScript::c_wgs008nu_RunAnim); m_unk0x106 = 1; m_unk0x104 = 1; break; } - if (m_state->m_papaAction < 5) { - m_state->m_papaAction++; + if (m_state->m_nickAction < 5) { + m_state->m_nickAction++; } - - FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; - case LegoActor::c_nick: - switch (m_state->m_nickAction) { + case LegoActor::c_papa: + switch (m_state->m_papaAction) { case 0: - m_state->m_unk0x14.m_unk0x00 = 5; - PlayAction(GarageScript::c_wgs009nu_RunAnim); + m_state->m_unk0x14 = 5; + PlayAction(GarageScript::c_wgs012nu_RunAnim); m_unk0x106 = 1; break; case 1: - m_state->m_unk0x14.m_unk0x00 = 5; - PlayAction(GarageScript::c_wgs010nu_RunAnim); + m_state->m_unk0x14 = 5; + PlayAction(GarageScript::c_wgs014nu_RunAnim); m_unk0x106 = 1; break; default: - m_state->m_unk0x14.m_unk0x00 = 6; - PlayAction(GarageScript::c_wgs008nu_RunAnim); + m_state->m_unk0x14 = 6; + PlayAction(GarageScript::c_wgs017nu_RunAnim); m_unk0x106 = 1; m_unk0x104 = 1; break; } - if (m_state->m_nickAction < 5) { - m_state->m_nickAction++; + if (m_state->m_papaAction < 5) { + m_state->m_papaAction++; } - - FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; case LegoActor::c_laura: switch (m_state->m_lauraAction) { case 0: - m_state->m_unk0x14.m_unk0x00 = 5; + m_state->m_unk0x14 = 5; PlayAction(GarageScript::c_wgs020nu_RunAnim); m_unk0x106 = 1; break; case 1: - m_state->m_unk0x14.m_unk0x00 = 5; + m_state->m_unk0x14 = 5; PlayAction(GarageScript::c_wgs021nu_RunAnim); m_unk0x106 = 1; break; default: - m_state->m_unk0x14.m_unk0x00 = 6; + m_state->m_unk0x14 = 6; PlayAction(GarageScript::c_wgs022nu_RunAnim); m_unk0x106 = 1; m_unk0x104 = 1; @@ -271,13 +260,12 @@ void GasStation::ReadyWorld() if (m_state->m_lauraAction < 5) { m_state->m_lauraAction++; } - - FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; default: - FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; } + + FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); } // FUNCTION: LEGO1 0x10005590 @@ -315,10 +303,10 @@ MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param) m_state->StopAction((GarageScript::Script) action->GetObjectId()); m_unk0x106 = 0; - switch (m_state->m_unk0x14.m_unk0x00) { + switch (m_state->m_unk0x14) { case 5: g_unk0x100f0160 = 0; - m_state->m_unk0x14.m_unk0x00 = 6; + m_state->m_unk0x14 = 6; m_unk0x115 = TRUE; PlayAction(GarageScript::c_wgs023nu_RunAnim); m_unk0x106 = 1; @@ -329,17 +317,17 @@ MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param) m_unk0x115 = TRUE; if (m_unk0x104 == 3) { - m_state->m_unk0x14.m_unk0x00 = 8; + m_state->m_unk0x14 = 8; PlayAction(GarageScript::c_wgs029nu_RunAnim); m_unk0x106 = 1; } else { - m_state->m_unk0x14.m_unk0x00 = 7; + m_state->m_unk0x14 = 7; m_unk0x114 = TRUE; } break; case 8: - m_state->m_unk0x14.m_unk0x00 = 2; + m_state->m_unk0x14 = 2; ((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 = 7; m_destLocation = LegoGameState::e_unk28; m_radio.Stop(); @@ -378,8 +366,8 @@ MxLong GasStation::HandleButtonDown(LegoControlManagerNotificationParam& p_param m_unk0x104 = 3; m_unk0x114 = FALSE; - if (m_state->m_unk0x14.m_unk0x00 == 7) { - m_state->m_unk0x14.m_unk0x00 = 8; + if (m_state->m_unk0x14 == 7) { + m_state->m_unk0x14 = 8; PlayAction(GarageScript::c_wgs029nu_RunAnim); m_unk0x106 = 1; } @@ -405,7 +393,7 @@ MxLong GasStation::HandleControl(LegoControlManagerNotificationParam& p_param) switch (p_param.GetClickedObjectId()) { case GarageScript::c_LeftArrow_Ctl: case GarageScript::c_RightArrow_Ctl: - m_state->m_unk0x14.m_unk0x00 = 0; + m_state->m_unk0x14 = 0; m_destLocation = LegoGameState::Area::e_garadoor; m_state->StopActions(); @@ -414,7 +402,7 @@ MxLong GasStation::HandleControl(LegoControlManagerNotificationParam& p_param) TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; case GarageScript::c_Info_Ctl: - m_state->m_unk0x14.m_unk0x00 = 0; + m_state->m_unk0x14 = 0; m_destLocation = LegoGameState::Area::e_infomain; m_state->StopActions(); @@ -423,7 +411,7 @@ MxLong GasStation::HandleControl(LegoControlManagerNotificationParam& p_param) TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; case GarageScript::c_Buggy_Ctl: - m_state->m_unk0x14.m_unk0x00 = 0; + m_state->m_unk0x14 = 0; m_destLocation = LegoGameState::Area::e_dunecarbuild; m_state->StopActions(); @@ -478,7 +466,7 @@ MxResult GasStation::Tickle() else if (m_unk0x104 != 0) { m_unk0x104 = 0; MxDSAction action; - m_state->m_unk0x14.m_unk0x00 = 9; + m_state->m_unk0x14 = 9; PlayAction(GarageScript::c_wgs031nu_RunAnim); m_unk0x106 = 1; } @@ -501,7 +489,7 @@ MxBool GasStation::Escape() { m_radio.Stop(); m_state->StopActions(); - m_state->m_unk0x14.m_unk0x00 = 0; + m_state->m_unk0x14 = 0; m_destLocation = LegoGameState::Area::e_infomain; return TRUE; }