From 73bb37596e05f353011c38fb57f39350577bad54 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 3 Jun 2024 07:00:38 -0400 Subject: [PATCH 01/12] Refactor JukeBox, add enum for music (#988) * Refactor JukeBox, add enum for music * add BETA annotation * Fix BETA annotation * Fix BETA annotation * Fix --- LEGO1/lego/legoomni/include/act1state.h | 6 +- LEGO1/lego/legoomni/include/jukeboxstate.h | 17 ++-- .../legoomni/include/legocontrolmanager.h | 3 +- LEGO1/lego/legoomni/include/legogamestate.h | 30 +++---- LEGO1/lego/legoomni/include/legoutils.h | 2 +- .../legoomni/src/actors/islepathactor.cpp | 2 +- .../legoomni/src/actors/jukeboxentity.cpp | 44 +++++----- .../legoomni/src/common/legogamestate.cpp | 4 +- LEGO1/lego/legoomni/src/common/legoutils.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/hospital.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 14 ++-- LEGO1/lego/legoomni/src/worlds/jukebox.cpp | 81 ++++++++++--------- 12 files changed, 102 insertions(+), 105 deletions(-) diff --git a/LEGO1/lego/legoomni/include/act1state.h b/LEGO1/lego/legoomni/include/act1state.h index dcc09959..2d428e69 100644 --- a/LEGO1/lego/legoomni/include/act1state.h +++ b/LEGO1/lego/legoomni/include/act1state.h @@ -79,6 +79,8 @@ class Act1State : public LegoState { void FUN_10034b60(); void FUN_10034d00(); + // TODO: Most likely getters/setters are not used according to BETA. + inline MxU32 GetUnknown18() { return m_unk0x018; } inline ElevatorFloor GetElevatorFloor() { return (ElevatorFloor) m_elevFloor; } inline MxU8 GetUnknown21() { return m_unk0x021; } @@ -90,10 +92,6 @@ class Act1State : public LegoState { // SYNTHETIC: LEGO1 0x10033960 // Act1State::`scalar deleting destructor' - friend class Isle; - friend class SkateBoard; - -protected: MxS32* m_unk0x008; // 0x008 FIXME: count for m_unk0x008 MxS16 m_unk0x00c; // 0x00c undefined2 m_unk0x00e; // 0x00e diff --git a/LEGO1/lego/legoomni/include/jukeboxstate.h b/LEGO1/lego/legoomni/include/jukeboxstate.h index 393da756..d9da3b84 100644 --- a/LEGO1/lego/legoomni/include/jukeboxstate.h +++ b/LEGO1/lego/legoomni/include/jukeboxstate.h @@ -7,6 +7,15 @@ // SIZE 0x10 class JukeBoxState : public LegoState { public: + enum Music { + e_pasquell = 0, + e_right, + e_decal, + e_wallis, + e_nelson, + e_torpedos + }; + // FUNCTION: LEGO1 0x1000f310 inline const char* ClassName() const override // vtable+0x0c { @@ -22,16 +31,10 @@ class JukeBoxState : public LegoState { MxBool IsSerializable() override; // vtable+0x14 - inline MxU32 IsActive() { return m_active; } - inline void SetActive(MxU32 p_active) { m_active = p_active; } - inline MxU32 GetState() { return m_state; } - inline void SetState(MxU32 p_state) { m_state = p_state; } - // SYNTHETIC: LEGO1 0x1000f3d0 // JukeBoxState::`scalar deleting destructor' - // protected: - MxU32 m_state; // 0x08 + Music m_music; // 0x08 MxU32 m_active; // 0x0c }; diff --git a/LEGO1/lego/legoomni/include/legocontrolmanager.h b/LEGO1/lego/legoomni/include/legocontrolmanager.h index 09e5a6d5..22cd2c58 100644 --- a/LEGO1/lego/legoomni/include/legocontrolmanager.h +++ b/LEGO1/lego/legoomni/include/legocontrolmanager.h @@ -18,6 +18,8 @@ class LegoControlManagerEvent : public LegoEventNotificationParam { m_clickedAtom = NULL; } + // TODO: Most likely getters/setters are not used according to BETA. + inline MxS32 GetClickedObjectId() const { return m_clickedObjectId; } inline const char* GetClickedAtom() const { return m_clickedAtom; } inline MxS16 GetUnknown0x28() const { return m_unk0x28; } @@ -26,7 +28,6 @@ class LegoControlManagerEvent : public LegoEventNotificationParam { inline void SetClickedAtom(const char* p_clickedAtom) { m_clickedAtom = p_clickedAtom; } inline void SetUnknown0x28(MxS16 p_unk0x28) { m_unk0x28 = p_unk0x28; } -private: MxS32 m_clickedObjectId; // 0x20 const char* m_clickedAtom; // 0x24 MxS16 m_unk0x28; // 0x28 diff --git a/LEGO1/lego/legoomni/include/legogamestate.h b/LEGO1/lego/legoomni/include/legogamestate.h index b1a9051f..db21dd3c 100644 --- a/LEGO1/lego/legoomni/include/legogamestate.h +++ b/LEGO1/lego/legoomni/include/legogamestate.h @@ -90,7 +90,7 @@ class LegoGameState { e_unk51, e_unk52, e_jukeboxw, - e_unk54, + e_jukeboxExterior, e_unk55, e_histbook, e_bike, @@ -174,7 +174,6 @@ class LegoGameState { inline Act GetLoadedAct() { return m_loadedAct; } inline Area GetCurrentArea() { return m_currentArea; } inline Area GetPreviousArea() { return m_previousArea; } - inline JukeboxScript::Script GetUnknown0x41c() { return m_unk0x41c; } inline Area GetUnknown0x42c() { return m_unk0x42c; } inline History* GetHistory() { return &m_history; } @@ -182,7 +181,6 @@ class LegoGameState { inline void SetCurrentArea(Area p_currentArea) { m_currentArea = p_currentArea; } inline void SetPreviousArea(Area p_previousArea) { m_previousArea = p_previousArea; } inline void SetActorId(MxU8 p_actorId) { m_actorId = p_actorId; } - inline void SetUnknown0x41c(JukeboxScript::Script p_unk0x41c) { m_unk0x41c = p_unk0x41c; } inline void SetUnknown0x42c(Area p_unk0x42c) { m_unk0x42c = p_unk0x42c; } inline Username* GetPlayersIndex(MxS32 p_index) { return &m_players[p_index]; } inline MxS16 GetPlayerCount() { return m_playerCount; } @@ -210,24 +208,18 @@ class LegoGameState { LegoFullScreenMovie* m_fullScreenMovie; // 0x20 MxU16 m_unk0x24; // 0x24 - // Member visibility needs to be refactored, since most members are accessed directly. + // TODO: Most likely getters/setters are not used according to BETA for the following members: public: - MxS16 m_playerCount; // 0x26 - Username m_players[9]; // 0x28 - -private: - History m_history; // 0xa6 - undefined2 m_unk0x41a; // 0x41a - JukeboxScript::Script m_unk0x41c; // 0x41c - MxBool m_isDirty; // 0x420 - -public: - Area m_currentArea; // 0x424 - Area m_previousArea; // 0x428 - -private: - Area m_unk0x42c; // 0x42c + MxS16 m_playerCount; // 0x26 + Username m_players[9]; // 0x28 + History m_history; // 0xa6 + undefined2 m_unk0x41a; // 0x41a + JukeboxScript::Script m_jukeboxMusic; // 0x41c + MxBool m_isDirty; // 0x420 + Area m_currentArea; // 0x424 + Area m_previousArea; // 0x428 + Area m_unk0x42c; // 0x42c }; MxBool ROIHandlerFunction(const char* p_input, char* p_output, MxU32 p_copyLen); diff --git a/LEGO1/lego/legoomni/include/legoutils.h b/LEGO1/lego/legoomni/include/legoutils.h index 09e2d72e..74545513 100644 --- a/LEGO1/lego/legoomni/include/legoutils.h +++ b/LEGO1/lego/legoomni/include/legoutils.h @@ -44,7 +44,7 @@ void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bO void PlayCamAnim(LegoPathActor* p_actor, MxBool p_unused, MxU32 p_location, MxBool p_bool); void FUN_1003eda0(); MxBool RemoveFromCurrentWorld(const MxAtomId& p_atomId, MxS32 p_id); -void FUN_1003ef00(MxBool p_enable); +void EnableAnimations(MxBool p_enable); void SetAppCursor(Cursor p_cursor); MxBool FUN_1003ef60(); MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_worldAtom, MxS32 p_worldEntityId); diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index b4f1266a..e526384e 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -430,7 +430,7 @@ void IslePathActor::RegisterSpawnLocations() JukeboxScript::c_noneJukebox ); g_spawnLocations[27] = SpawnLocation( - LegoGameState::e_unk54, + LegoGameState::e_jukeboxExterior, g_isleScript, 0, "int36", diff --git a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp index a4c505a2..f4e2af0a 100644 --- a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp +++ b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp @@ -55,37 +55,37 @@ void JukeBoxEntity::StartAction() MxDSAction action; BackgroundAudioManager()->Stop(); JukeBoxState* state = (JukeBoxState*) GameState()->GetState("JukeBoxState"); - state->SetActive(TRUE); + state->m_active = TRUE; - switch (state->GetState()) { - case 0: + switch (state->m_music) { + case JukeBoxState::e_pasquell: InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz001bd_RunAnim, NULL); - GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic1); + GameState()->m_jukeboxMusic = JukeboxScript::c_JBMusic1; break; - case 1: + case JukeBoxState::e_right: InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz006bd_RunAnim, NULL); - GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic2); + GameState()->m_jukeboxMusic = JukeboxScript::c_JBMusic2; break; - case 2: + case JukeBoxState::e_decal: InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz003bd_RunAnim, NULL); - GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic3); + GameState()->m_jukeboxMusic = JukeboxScript::c_JBMusic3; break; - case 3: + case JukeBoxState::e_wallis: InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz002bd_RunAnim, NULL); - GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic4); + GameState()->m_jukeboxMusic = JukeboxScript::c_JBMusic4; break; - case 4: + case JukeBoxState::e_nelson: InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz007bd_RunAnim, NULL); - GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic5); + GameState()->m_jukeboxMusic = JukeboxScript::c_JBMusic5; break; - case 5: + case JukeBoxState::e_torpedos: InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_npz004bd_RunAnim, NULL); - GameState()->SetUnknown0x41c(JukeboxScript::c_JBMusic6); + GameState()->m_jukeboxMusic = JukeboxScript::c_JBMusic6; break; } action.SetAtomId(*g_jukeboxScript); - action.SetObjectId(GameState()->GetUnknown0x41c()); + action.SetObjectId(GameState()->m_jukeboxMusic); m_audioEnabled = BackgroundAudioManager()->GetEnabled(); if (!m_audioEnabled) { @@ -100,30 +100,30 @@ void JukeBoxEntity::StopAction(JukeboxScript::Script p_script) { JukeBoxState* state = (JukeBoxState*) GameState()->GetState("JukeBoxState"); - if (state && state->IsActive()) { + if (state && state->m_active) { switch (p_script) { case JukeboxScript::c_JBMusic1: - state->SetActive(FALSE); + state->m_active = FALSE; InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz001bd_RunAnim, NULL); break; case JukeboxScript::c_JBMusic2: - state->SetActive(FALSE); + state->m_active = FALSE; InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz006bd_RunAnim, NULL); break; case JukeboxScript::c_JBMusic3: - state->SetActive(FALSE); + state->m_active = FALSE; InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz003bd_RunAnim, NULL); break; case JukeboxScript::c_JBMusic4: - state->SetActive(FALSE); + state->m_active = FALSE; InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz002bd_RunAnim, NULL); break; case JukeboxScript::c_JBMusic5: - state->SetActive(FALSE); + state->m_active = FALSE; InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz007bd_RunAnim, NULL); break; case JukeboxScript::c_JBMusic6: - state->SetActive(FALSE); + state->m_active = FALSE; InvokeAction(Extra::e_stop, *g_isleScript, IsleScript::c_npz004bd_RunAnim, NULL); break; } diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index be09e19b..0f339590 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -124,7 +124,7 @@ LegoGameState::LegoGameState() m_actorId = 0; m_savePath = NULL; m_stateArray = NULL; - m_unk0x41c = JukeboxScript::c_noneJukebox; + m_jukeboxMusic = JukeboxScript::c_noneJukebox; m_currentArea = e_undefined; m_previousArea = e_undefined; m_unk0x42c = e_undefined; @@ -982,7 +982,7 @@ void LegoGameState::SwitchArea(Area p_area) VideoManager()->SetUnk0x554(TRUE); InvokeAction(Extra::ActionType::e_opendisk, *g_jukeboxwScript, JukeboxwScript::c__StartUp, NULL); break; - case e_unk54: + case e_jukeboxExterior: LoadIsle(); break; case e_histbook: diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index 7e431d03..d769404e 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -437,7 +437,7 @@ MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_wor } // FUNCTION: LEGO1 0x1003ef00 -void FUN_1003ef00(MxBool p_enable) +void EnableAnimations(MxBool p_enable) { if (p_enable) { AnimationManager()->Resume(); diff --git a/LEGO1/lego/legoomni/src/worlds/hospital.cpp b/LEGO1/lego/legoomni/src/worlds/hospital.cpp index 5848b4ad..d62baa21 100644 --- a/LEGO1/lego/legoomni/src/worlds/hospital.cpp +++ b/LEGO1/lego/legoomni/src/worlds/hospital.cpp @@ -100,7 +100,7 @@ MxResult Hospital::Create(MxDSAction& p_dsAction) GameState()->StopArea(LegoGameState::e_previousArea); InputManager()->Register(this); - FUN_1003ef00(FALSE); + EnableAnimations(FALSE); return result; } diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 78d05c70..2d5fee23 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -113,7 +113,7 @@ MxResult Isle::Create(MxDSAction& p_dsAction) } m_act1state = act1state; - FUN_1003ef00(TRUE); + EnableAnimations(TRUE); GameState()->SetDirty(TRUE); } @@ -270,7 +270,7 @@ void Isle::ReadyWorld() m_act1state->SetUnknown21(0); } else if (GameState()->GetLoadedAct() != LegoGameState::e_act1) { - FUN_1003ef00(TRUE); + EnableAnimations(TRUE); FUN_10032620(); m_act1state->FUN_10034d00(); FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); @@ -548,7 +548,7 @@ void Isle::Enable(MxBool p_enable) GameState()->StopArea(LegoGameState::e_previousArea); GameState()->m_previousArea = GameState()->m_currentArea; - FUN_1003ef00(TRUE); + EnableAnimations(TRUE); if (m_act1state->m_unk0x018 == 0) { MxS32 locations[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; @@ -748,7 +748,7 @@ void Isle::Enable(MxBool p_enable) } m_act1state->m_unk0x018 = 0; - FUN_1003ef00(FALSE); + EnableAnimations(FALSE); AnimationManager()->FUN_10064670(NULL); break; } @@ -781,7 +781,7 @@ void Isle::Enable(MxBool p_enable) } m_act1state->m_unk0x018 = 0; - FUN_1003ef00(TRUE); + EnableAnimations(TRUE); break; } case 7: @@ -806,12 +806,12 @@ void Isle::Enable(MxBool p_enable) m_act1state->m_unk0x018 = 0; ((IslePathActor*) CurrentActor()) ->SpawnPlayer( - LegoGameState::e_unk54, + LegoGameState::e_jukeboxExterior, TRUE, IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 ); GameState()->m_currentArea = LegoGameState::e_unk66; - FUN_1003ef00(TRUE); + EnableAnimations(TRUE); m_jukebox->StartAction(); break; } diff --git a/LEGO1/lego/legoomni/src/worlds/jukebox.cpp b/LEGO1/lego/legoomni/src/worlds/jukebox.cpp index 421760ab..5cb59794 100644 --- a/LEGO1/lego/legoomni/src/worlds/jukebox.cpp +++ b/LEGO1/lego/legoomni/src/worlds/jukebox.cpp @@ -58,7 +58,7 @@ MxResult JukeBox::Create(MxDSAction& p_dsAction) m_state = (JukeBoxState*) GameState()->GetState("JukeBoxState"); if (!m_state) { m_state = (JukeBoxState*) GameState()->CreateState("JukeBoxState"); - m_state->SetState(0); + m_state->m_music = JukeBoxState::e_pasquell; } GameState()->SetCurrentArea(LegoGameState::e_jukeboxw); @@ -89,24 +89,27 @@ MxLong JukeBox::Notify(MxParam& p_param) } // FUNCTION: LEGO1 0x1005d9f0 +// FUNCTION: BETA10 0x10037e39 void JukeBox::ReadyWorld() { MxStillPresenter* presenter = NULL; - switch (m_state->GetState()) { - case 1: + switch (m_state->m_music) { + case JukeBoxState::e_pasquell: + break; + case JukeBoxState::e_right: presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap"); break; - case 2: + case JukeBoxState::e_decal: presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap"); break; - case 3: + case JukeBoxState::e_wallis: presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap"); break; - case 4: + case JukeBoxState::e_nelson: presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap"); break; - case 5: + case JukeBoxState::e_torpedos: presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap"); break; } @@ -119,47 +122,48 @@ void JukeBox::ReadyWorld() } // FUNCTION: LEGO1 0x1005da70 +// FUNCTION: BETA10 0x10037f6d MxBool JukeBox::HandleControl(LegoControlManagerEvent& p_param) { MxStillPresenter* presenter; - if (p_param.GetUnknown0x28() == 1) { - switch (p_param.GetClickedObjectId()) { + if (p_param.m_unk0x28 == 1) { + switch (p_param.m_clickedObjectId) { case JukeboxwScript::c_Dback_Ctl: - switch (m_state->GetState()) { - case JukeboxScript::c_MusicTheme1: - m_state->SetState(JukeboxScript::c_ResidentalArea_Music); + switch (m_state->m_music) { + case JukeBoxState::e_pasquell: + m_state->m_music = JukeBoxState::e_torpedos; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap"); presenter->Enable(TRUE); break; - case JukeboxScript::c_MusicTheme3: - m_state->SetState(JukeboxScript::c_MusicTheme1); + case JukeBoxState::e_right: + m_state->m_music = JukeBoxState::e_pasquell; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap"); presenter->Enable(FALSE); break; - case JukeboxScript::c_Act2Cave: - m_state->SetState(JukeboxScript::c_MusicTheme3); + case JukeBoxState::e_decal: + m_state->m_music = JukeBoxState::e_right; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap"); presenter->Enable(FALSE); presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap"); presenter->Enable(TRUE); break; - case JukeboxScript::c_BrickstrChase: - m_state->SetState(JukeboxScript::c_Act2Cave); + case JukeBoxState::e_wallis: + m_state->m_music = JukeBoxState::e_decal; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap"); presenter->Enable(FALSE); presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap"); presenter->Enable(TRUE); break; - case JukeboxScript::c_BrickHunt: - m_state->SetState(JukeboxScript::c_BrickstrChase); + case JukeBoxState::e_nelson: + m_state->m_music = JukeBoxState::e_wallis; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap"); presenter->Enable(FALSE); presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap"); presenter->Enable(TRUE); break; - case JukeboxScript::c_ResidentalArea_Music: - m_state->SetState(JukeboxScript::c_BrickHunt); + case JukeBoxState::e_torpedos: + m_state->m_music = JukeBoxState::e_nelson; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap"); presenter->Enable(FALSE); presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap"); @@ -168,52 +172,51 @@ MxBool JukeBox::HandleControl(LegoControlManagerEvent& p_param) } break; case JukeboxwScript::c_Dfwd_Ctl: - switch (m_state->GetState()) { - case JukeboxScript::c_MusicTheme1: - m_state->SetState(JukeboxScript::c_MusicTheme3); + switch (m_state->m_music) { + case JukeBoxState::e_pasquell: + m_state->m_music = JukeBoxState::e_right; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap"); presenter->Enable(TRUE); break; - case JukeboxScript::c_MusicTheme3: - m_state->SetState(JukeboxScript::c_Act2Cave); + case JukeBoxState::e_right: + m_state->m_music = JukeBoxState::e_decal; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap"); presenter->Enable(FALSE); presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap"); presenter->Enable(TRUE); break; - case JukeboxScript::c_Act2Cave: - m_state->SetState(JukeboxScript::c_BrickstrChase); + case JukeBoxState::e_decal: + m_state->m_music = JukeBoxState::e_wallis; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap"); presenter->Enable(FALSE); presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap"); presenter->Enable(TRUE); break; - case JukeboxScript::c_BrickstrChase: - m_state->SetState(JukeboxScript::c_BrickHunt); + case JukeBoxState::e_wallis: + m_state->m_music = JukeBoxState::e_nelson; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap"); presenter->Enable(FALSE); presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap"); presenter->Enable(TRUE); break; - case JukeboxScript::c_BrickHunt: - m_state->SetState(JukeboxScript::c_ResidentalArea_Music); + case JukeBoxState::e_nelson: + m_state->m_music = JukeBoxState::e_torpedos; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap"); presenter->Enable(FALSE); presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap"); presenter->Enable(TRUE); break; - case JukeboxScript::c_ResidentalArea_Music: - m_state->SetState(JukeboxScript::c_MusicTheme1); + case JukeBoxState::e_torpedos: + m_state->m_music = JukeBoxState::e_pasquell; presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap"); presenter->Enable(FALSE); break; } break; case JukeboxwScript::c_Note_Ctl: - LegoGameState* gameState = GameState(); - Act1State* act1State = (Act1State*) gameState->GetState("Act1State"); - act1State->SetUnknown18(11); - m_destLocation = LegoGameState::Area::e_unk54; + Act1State* act1State = (Act1State*) GameState()->GetState("Act1State"); + act1State->m_unk0x018 = 11; + m_destLocation = LegoGameState::Area::e_jukeboxExterior; TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, 0, FALSE); break; } From 133a312aee16be8519dc8a1525ef718aa4b10c98 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 3 Jun 2024 12:53:25 -0400 Subject: [PATCH 02/12] Consolidate state and building entity classes (#989) --- CMakeLists.txt | 29 +- LEGO1/lego/legoomni/include/act1state.h | 134 -------- LEGO1/lego/legoomni/include/act3.h | 33 ++ LEGO1/lego/legoomni/include/act3state.h | 36 --- LEGO1/lego/legoomni/include/ambulance.h | 57 +++- .../legoomni/include/ambulancemissionstate.h | 62 ---- LEGO1/lego/legoomni/include/animstate.h | 71 ----- .../lego/legoomni/include/beachhouseentity.h | 29 -- LEGO1/lego/legoomni/include/buildings.h | 166 ++++++++++ LEGO1/lego/legoomni/include/carrace.h | 21 ++ LEGO1/lego/legoomni/include/carracestate.h | 27 -- LEGO1/lego/legoomni/include/caveentity.h | 2 +- LEGO1/lego/legoomni/include/gasstation.h | 45 ++- .../lego/legoomni/include/gasstationentity.h | 29 -- LEGO1/lego/legoomni/include/gasstationstate.h | 50 --- LEGO1/lego/legoomni/include/helicopter.h | 39 ++- LEGO1/lego/legoomni/include/helicopterstate.h | 44 --- LEGO1/lego/legoomni/include/hospital.h | 43 ++- LEGO1/lego/legoomni/include/hospitalentity.h | 29 -- LEGO1/lego/legoomni/include/hospitalstate.h | 49 --- LEGO1/lego/legoomni/include/infocenter.h | 52 ++- .../lego/legoomni/include/infocenterentity.h | 29 -- LEGO1/lego/legoomni/include/infocenterstate.h | 59 ---- LEGO1/lego/legoomni/include/isle.h | 129 +++++++- LEGO1/lego/legoomni/include/jailentity.h | 29 -- LEGO1/lego/legoomni/include/jetskirace.h | 21 ++ LEGO1/lego/legoomni/include/jetskiracestate.h | 27 -- LEGO1/lego/legoomni/include/jukebox.h | 38 ++- LEGO1/lego/legoomni/include/jukeboxstate.h | 41 --- LEGO1/lego/legoomni/include/legoact2.h | 35 +++ LEGO1/lego/legoomni/include/legoact2state.h | 38 --- .../legoomni/include/legoanimationmanager.h | 68 +++- LEGO1/lego/legoomni/include/legocarbuild.h | 46 +++ ...nimpresenter.h => legocarbuildpresenter.h} | 6 +- LEGO1/lego/legoomni/include/legorace.h | 50 +++ .../legoomni/include/legovehiclebuildstate.h | 52 --- LEGO1/lego/legoomni/include/pizza.h | 43 ++- .../lego/legoomni/include/pizzamissionstate.h | 47 --- LEGO1/lego/legoomni/include/pizzeria.h | 43 ++- LEGO1/lego/legoomni/include/pizzeriastate.h | 46 --- LEGO1/lego/legoomni/include/police.h | 38 ++- LEGO1/lego/legoomni/include/policeentity.h | 29 -- LEGO1/lego/legoomni/include/policestate.h | 43 --- .../lego/legoomni/include/racestandsentity.h | 28 -- LEGO1/lego/legoomni/include/racestate.h | 54 ---- LEGO1/lego/legoomni/include/radio.h | 41 ++- LEGO1/lego/legoomni/include/radiostate.h | 45 --- LEGO1/lego/legoomni/include/score.h | 40 ++- LEGO1/lego/legoomni/include/scorestate.h | 36 --- LEGO1/lego/legoomni/include/towtrack.h | 58 +++- .../legoomni/include/towtrackmissionstate.h | 63 ---- LEGO1/lego/legoomni/src/act1/act1state.cpp | 296 ------------------ .../lego/legoomni/src/act2/legoact2state.cpp | 9 - LEGO1/lego/legoomni/src/act3/act3state.cpp | 9 - .../src/{act3 => actors}/act3shark.cpp | 0 LEGO1/lego/legoomni/src/actors/ambulance.cpp | 26 +- LEGO1/lego/legoomni/src/actors/buildings.cpp | 176 +++++++++++ LEGO1/lego/legoomni/src/actors/helicopter.cpp | 3 +- .../legoomni/src/actors/islepathactor.cpp | 2 +- .../legoomni/src/actors/jukeboxentity.cpp | 2 +- LEGO1/lego/legoomni/src/actors/pizza.cpp | 23 +- LEGO1/lego/legoomni/src/actors/pizzeria.cpp | 23 +- LEGO1/lego/legoomni/src/actors/radio.cpp | 98 +++++- LEGO1/lego/legoomni/src/actors/skateboard.cpp | 1 - LEGO1/lego/legoomni/src/actors/towtrack.cpp | 72 ++++- .../legoomni/src/build/helicopterstate.cpp | 3 - .../lego/legoomni/src/build/legocarbuild.cpp | 18 ++ .../legocarbuildpresenter.cpp} | 2 +- .../src/build/legovehiclebuildstate.cpp | 22 -- LEGO1/lego/legoomni/src/common/animstate.cpp | 46 --- .../src/common/legoanimationmanager.cpp | 45 ++- .../legoomni/src/common/legogamestate.cpp | 3 +- .../legoomni/src/common/legoobjectfactory.cpp | 29 +- LEGO1/lego/legoomni/src/common/legoutils.cpp | 2 +- .../legoomni/src/entity/legonavcontroller.cpp | 2 +- .../src/gasstation/gasstationentity.cpp | 39 --- .../src/gasstation/gasstationstate.cpp | 37 --- .../src/hospital/ambulancemissionstate.cpp | 27 -- .../legoomni/src/hospital/hospitalentity.cpp | 39 --- .../legoomni/src/hospital/hospitalstate.cpp | 49 --- .../src/infocenter/infocenterentity.cpp | 60 ---- .../src/infocenter/infocenterstate.cpp | 133 -------- .../legoomni/src/infocenter/scorestate.cpp | 16 - .../legoomni/src/isle/beachhouseentity.cpp | 36 --- LEGO1/lego/legoomni/src/isle/jukeboxstate.cpp | 9 - LEGO1/lego/legoomni/src/isle/radiostate.cpp | 103 ------ .../legoomni/src/paths/legopathstruct.cpp | 2 +- .../src/pizzeria/pizzamissionstate.cpp | 23 -- .../legoomni/src/pizzeria/pizzeriastate.cpp | 22 -- .../lego/legoomni/src/police/policeentity.cpp | 39 --- .../lego/legoomni/src/police/policestate.cpp | 70 ----- LEGO1/lego/legoomni/src/race/legorace.cpp | 30 ++ .../legoomni/src/race/racestandsentity.cpp | 36 --- LEGO1/lego/legoomni/src/race/racestate.cpp | 33 -- .../src/towtrack/towtrackmissionstate.cpp | 73 ----- LEGO1/lego/legoomni/src/worlds/act3.cpp | 1 + .../legoomni/src/worlds/elevatorbottom.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/gasstation.cpp | 36 ++- LEGO1/lego/legoomni/src/worlds/hospital.cpp | 50 ++- LEGO1/lego/legoomni/src/worlds/infocenter.cpp | 135 +++++++- .../legoomni/src/worlds/infocenterdoor.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 295 ++++++++++++++++- LEGO1/lego/legoomni/src/worlds/jukebox.cpp | 4 +- LEGO1/lego/legoomni/src/worlds/legoact2.cpp | 1 + LEGO1/lego/legoomni/src/worlds/police.cpp | 60 +++- .../legoomni/src/worlds/registrationbook.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/score.cpp | 14 +- 107 files changed, 2190 insertions(+), 2569 deletions(-) delete mode 100644 LEGO1/lego/legoomni/include/act1state.h delete mode 100644 LEGO1/lego/legoomni/include/act3state.h delete mode 100644 LEGO1/lego/legoomni/include/ambulancemissionstate.h delete mode 100644 LEGO1/lego/legoomni/include/animstate.h delete mode 100644 LEGO1/lego/legoomni/include/beachhouseentity.h create mode 100644 LEGO1/lego/legoomni/include/buildings.h delete mode 100644 LEGO1/lego/legoomni/include/carracestate.h delete mode 100644 LEGO1/lego/legoomni/include/gasstationentity.h delete mode 100644 LEGO1/lego/legoomni/include/gasstationstate.h delete mode 100644 LEGO1/lego/legoomni/include/helicopterstate.h delete mode 100644 LEGO1/lego/legoomni/include/hospitalentity.h delete mode 100644 LEGO1/lego/legoomni/include/hospitalstate.h delete mode 100644 LEGO1/lego/legoomni/include/infocenterentity.h delete mode 100644 LEGO1/lego/legoomni/include/infocenterstate.h delete mode 100644 LEGO1/lego/legoomni/include/jailentity.h delete mode 100644 LEGO1/lego/legoomni/include/jetskiracestate.h delete mode 100644 LEGO1/lego/legoomni/include/jukeboxstate.h delete mode 100644 LEGO1/lego/legoomni/include/legoact2state.h rename LEGO1/lego/legoomni/include/{legocarbuildanimpresenter.h => legocarbuildpresenter.h} (93%) delete mode 100644 LEGO1/lego/legoomni/include/legovehiclebuildstate.h delete mode 100644 LEGO1/lego/legoomni/include/pizzamissionstate.h delete mode 100644 LEGO1/lego/legoomni/include/pizzeriastate.h delete mode 100644 LEGO1/lego/legoomni/include/policeentity.h delete mode 100644 LEGO1/lego/legoomni/include/policestate.h delete mode 100644 LEGO1/lego/legoomni/include/racestandsentity.h delete mode 100644 LEGO1/lego/legoomni/include/racestate.h delete mode 100644 LEGO1/lego/legoomni/include/radiostate.h delete mode 100644 LEGO1/lego/legoomni/include/scorestate.h delete mode 100644 LEGO1/lego/legoomni/include/towtrackmissionstate.h delete mode 100644 LEGO1/lego/legoomni/src/act1/act1state.cpp delete mode 100644 LEGO1/lego/legoomni/src/act2/legoact2state.cpp delete mode 100644 LEGO1/lego/legoomni/src/act3/act3state.cpp rename LEGO1/lego/legoomni/src/{act3 => actors}/act3shark.cpp (100%) create mode 100644 LEGO1/lego/legoomni/src/actors/buildings.cpp delete mode 100644 LEGO1/lego/legoomni/src/build/helicopterstate.cpp rename LEGO1/lego/legoomni/src/{video/legocarbuildanimpresenter.cpp => build/legocarbuildpresenter.cpp} (94%) delete mode 100644 LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp delete mode 100644 LEGO1/lego/legoomni/src/common/animstate.cpp delete mode 100644 LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp delete mode 100644 LEGO1/lego/legoomni/src/gasstation/gasstationstate.cpp delete mode 100644 LEGO1/lego/legoomni/src/hospital/ambulancemissionstate.cpp delete mode 100644 LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp delete mode 100644 LEGO1/lego/legoomni/src/hospital/hospitalstate.cpp delete mode 100644 LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp delete mode 100644 LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp delete mode 100644 LEGO1/lego/legoomni/src/infocenter/scorestate.cpp delete mode 100644 LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp delete mode 100644 LEGO1/lego/legoomni/src/isle/jukeboxstate.cpp delete mode 100644 LEGO1/lego/legoomni/src/isle/radiostate.cpp delete mode 100644 LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp delete mode 100644 LEGO1/lego/legoomni/src/pizzeria/pizzeriastate.cpp delete mode 100644 LEGO1/lego/legoomni/src/police/policeentity.cpp delete mode 100644 LEGO1/lego/legoomni/src/police/policestate.cpp delete mode 100644 LEGO1/lego/legoomni/src/race/racestandsentity.cpp delete mode 100644 LEGO1/lego/legoomni/src/race/racestate.cpp delete mode 100644 LEGO1/lego/legoomni/src/towtrack/towtrackmissionstate.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 00b4fdda..06c10670 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -284,14 +284,12 @@ target_link_libraries(omni PRIVATE dsound winmm Smacker::Smacker) add_library(lego1 SHARED LEGO1/define.cpp - LEGO1/lego/legoomni/src/act1/act1state.cpp - LEGO1/lego/legoomni/src/act2/legoact2state.cpp - LEGO1/lego/legoomni/src/act3/act3shark.cpp - LEGO1/lego/legoomni/src/act3/act3state.cpp LEGO1/lego/legoomni/src/actors/act2actor.cpp LEGO1/lego/legoomni/src/actors/act3actor.cpp + LEGO1/lego/legoomni/src/actors/act3shark.cpp LEGO1/lego/legoomni/src/actors/ambulance.cpp LEGO1/lego/legoomni/src/actors/bike.cpp + LEGO1/lego/legoomni/src/actors/buildings.cpp LEGO1/lego/legoomni/src/actors/bumpbouy.cpp LEGO1/lego/legoomni/src/actors/doors.cpp LEGO1/lego/legoomni/src/actors/dunebuggy.cpp @@ -315,11 +313,9 @@ add_library(lego1 SHARED LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp LEGO1/lego/legoomni/src/build/buildingentity.cpp - LEGO1/lego/legoomni/src/build/helicopterstate.cpp LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp LEGO1/lego/legoomni/src/build/legocarbuild.cpp - LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp - LEGO1/lego/legoomni/src/common/animstate.cpp + LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp LEGO1/lego/legoomni/src/common/legoactioncontrolpresenter.cpp LEGO1/lego/legoomni/src/common/legoactors.cpp LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -356,18 +352,7 @@ add_library(lego1 SHARED LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp LEGO1/lego/legoomni/src/entity/legoworld.cpp LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp - LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp - LEGO1/lego/legoomni/src/gasstation/gasstationstate.cpp - LEGO1/lego/legoomni/src/hospital/ambulancemissionstate.cpp - LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp - LEGO1/lego/legoomni/src/hospital/hospitalstate.cpp - LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp - LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp - LEGO1/lego/legoomni/src/infocenter/scorestate.cpp LEGO1/lego/legoomni/src/input/legoinputmanager.cpp - LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp - LEGO1/lego/legoomni/src/isle/jukeboxstate.cpp - LEGO1/lego/legoomni/src/isle/radiostate.cpp LEGO1/lego/legoomni/src/main/legomain.cpp LEGO1/lego/legoomni/src/main/scripts.cpp LEGO1/lego/legoomni/src/notify/legoeventnotificationparam.cpp @@ -378,22 +363,14 @@ add_library(lego1 SHARED LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp LEGO1/lego/legoomni/src/paths/legopathpresenter.cpp LEGO1/lego/legoomni/src/paths/legopathstruct.cpp - LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp - LEGO1/lego/legoomni/src/pizzeria/pizzeriastate.cpp - LEGO1/lego/legoomni/src/police/policeentity.cpp - LEGO1/lego/legoomni/src/police/policestate.cpp LEGO1/lego/legoomni/src/race/carrace.cpp LEGO1/lego/legoomni/src/race/jetskirace.cpp LEGO1/lego/legoomni/src/race/legorace.cpp LEGO1/lego/legoomni/src/race/legoraceactor.cpp LEGO1/lego/legoomni/src/race/legoracecar.cpp LEGO1/lego/legoomni/src/race/legoracemap.cpp - LEGO1/lego/legoomni/src/race/racestandsentity.cpp LEGO1/lego/legoomni/src/race/raceskel.cpp - LEGO1/lego/legoomni/src/race/racestate.cpp - LEGO1/lego/legoomni/src/towtrack/towtrackmissionstate.cpp LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp - LEGO1/lego/legoomni/src/video/legocarbuildanimpresenter.cpp LEGO1/lego/legoomni/src/video/legoflctexturepresenter.cpp LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp diff --git a/LEGO1/lego/legoomni/include/act1state.h b/LEGO1/lego/legoomni/include/act1state.h deleted file mode 100644 index 2d428e69..00000000 --- a/LEGO1/lego/legoomni/include/act1state.h +++ /dev/null @@ -1,134 +0,0 @@ -#ifndef ACT1STATE_H -#define ACT1STATE_H - -#include "legostate.h" - -class LegoNamedTexture; - -// VTABLE: LEGO1 0x100d7028 -// SIZE 0x26c -class Act1State : public LegoState { -public: - enum ElevatorFloor { - c_floor1 = 1, - c_floor2, - c_floor3 - }; - - enum { - e_unk953 = 953, - e_unk954 = 954, - e_unk955 = 955, - }; - - // SIZE 0x4c - class NamedPlane { - public: - // FUNCTION: LEGO1 0x10033800 - NamedPlane() {} - - inline void SetName(const char* p_name) { m_name = p_name; } - inline const MxString* GetName() const { return &m_name; } - - // FUNCTION: LEGO1 0x100344d0 - MxResult Serialize(LegoFile* p_file) - { - if (p_file->IsWriteMode()) { - p_file->WriteString(m_name); - p_file->WriteVector3(m_point1); - p_file->WriteVector3(m_point2); - p_file->WriteVector3(m_point3); - } - else if (p_file->IsReadMode()) { - p_file->ReadString(m_name); - p_file->ReadVector3(m_point1); - p_file->ReadVector3(m_point2); - p_file->ReadVector3(m_point3); - } - - return SUCCESS; - } - - private: - MxString m_name; // 0x00 - Mx3DPointFloat m_point1; // 0x10 - Mx3DPointFloat m_point2; // 0x24 - Mx3DPointFloat m_point3; // 0x38 - }; - - Act1State(); - - // FUNCTION: LEGO1 0x100338a0 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0154 - return "Act1State"; - } - - // FUNCTION: LEGO1 0x100338b0 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, Act1State::ClassName()) || LegoState::IsA(p_name); - } - - MxBool SetFlag() override; // vtable+0x18 - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - void FUN_10034660(); - void FUN_100346a0(); - void FUN_10034b60(); - void FUN_10034d00(); - - // TODO: Most likely getters/setters are not used according to BETA. - - inline MxU32 GetUnknown18() { return m_unk0x018; } - inline ElevatorFloor GetElevatorFloor() { return (ElevatorFloor) m_elevFloor; } - inline MxU8 GetUnknown21() { return m_unk0x021; } - - inline void SetUnknown18(MxU32 p_unk0x18) { m_unk0x018 = p_unk0x18; } - inline void SetElevatorFloor(ElevatorFloor p_elevFloor) { m_elevFloor = p_elevFloor; } - inline void SetUnknown21(MxU8 p_unk0x21) { m_unk0x021 = p_unk0x21; } - - // SYNTHETIC: LEGO1 0x10033960 - // Act1State::`scalar deleting destructor' - - MxS32* m_unk0x008; // 0x008 FIXME: count for m_unk0x008 - MxS16 m_unk0x00c; // 0x00c - undefined2 m_unk0x00e; // 0x00e - undefined2 m_unk0x010; // 0x010 - undefined m_unk0x012; // 0x012 - MxS32 m_unk0x014; // 0x014 - MxU32 m_unk0x018; // 0x018 - MxS16 m_elevFloor; // 0x01c - MxBool m_unk0x01e; // 0x01e - MxBool m_unk0x01f; // 0x01f - MxBool m_planeActive; // 0x020 - undefined m_unk0x021; // 0x021 - MxBool m_unk0x022; // 0x022 - undefined m_unk0x023; // 0x023 - NamedPlane m_unk0x024; // 0x024 - NamedPlane m_unk0x070; // 0x070 - NamedPlane m_unk0x0bc; // 0x0bc - NamedPlane m_unk0x108; // 0x108 - LegoNamedTexture* m_unk0x154; // 0x154 - LegoNamedTexture* m_unk0x158; // 0x158 - LegoNamedTexture* m_unk0x15c; // 0x15c - MxCore* m_unk0x160; // 0x160 - NamedPlane m_unk0x164; // 0x164 - LegoNamedTexture* m_unk0x1b0; // 0x1b0 - LegoNamedTexture* m_unk0x1b4; // 0x1b4 - MxCore* m_unk0x1b8; // 0x1b8 - NamedPlane m_unk0x1bc; // 0x1bc - LegoNamedTexture* m_unk0x208; // 0x208 - MxCore* m_unk0x20c; // 0x20c - NamedPlane m_unk0x210; // 0x210 - LegoNamedTexture* m_unk0x25c; // 0x25c - LegoNamedTexture* m_unk0x260; // 0x260 - LegoNamedTexture* m_unk0x264; // 0x264 - MxCore* m_unk0x268; // 0x268 -}; - -// FUNCTION: LEGO1 0x10033a70 -// Act1State::NamedPlane::~NamedPlane - -#endif // ACT1STATE_H diff --git a/LEGO1/lego/legoomni/include/act3.h b/LEGO1/lego/legoomni/include/act3.h index b476dcc0..ddaccb13 100644 --- a/LEGO1/lego/legoomni/include/act3.h +++ b/LEGO1/lego/legoomni/include/act3.h @@ -1,8 +1,41 @@ #ifndef ACT3_H #define ACT3_H +#include "legostate.h" #include "legoworld.h" +// VTABLE: LEGO1 0x100d4fc8 +// SIZE 0x0c +class Act3State : public LegoState { +public: + inline Act3State() { m_unk0x08 = 0; } + + // FUNCTION: LEGO1 0x1000e300 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f03f0 + return "Act3State"; + } + + // FUNCTION: LEGO1 0x1000e310 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, Act3State::ClassName()) || LegoState::IsA(p_name); + } + + // FUNCTION: LEGO1 0x1000e2f0 + MxBool IsSerializable() override { return FALSE; } + + // SYNTHETIC: LEGO1 0x1000e3c0 + // Act3State::`scalar deleting destructor' + + inline undefined4 GetUnknown0x08() { return m_unk0x08; } + + // TODO: Most likely getters/setters are not used according to BETA. + + undefined4 m_unk0x08; // 0x08 +}; + // VTABLE: LEGO1 0x100d9628 // SIZE 0x4274 class Act3 : public LegoWorld { diff --git a/LEGO1/lego/legoomni/include/act3state.h b/LEGO1/lego/legoomni/include/act3state.h deleted file mode 100644 index 3df4e4f3..00000000 --- a/LEGO1/lego/legoomni/include/act3state.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef ACT3STATE_H -#define ACT3STATE_H - -#include "legostate.h" - -// VTABLE: LEGO1 0x100d4fc8 -// SIZE 0x0c -class Act3State : public LegoState { -public: - inline Act3State() { m_unk0x08 = 0; } - - // FUNCTION: LEGO1 0x1000e300 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f03f0 - return "Act3State"; - } - - // FUNCTION: LEGO1 0x1000e310 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, Act3State::ClassName()) || LegoState::IsA(p_name); - } - - MxBool IsSerializable() override; - - // SYNTHETIC: LEGO1 0x1000e3c0 - // Act3State::`scalar deleting destructor' - - inline undefined4 GetUnknown0x08() { return m_unk0x08; } - -private: - undefined4 m_unk0x08; // 0x08 -}; - -#endif // ACT3STATE_H diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index 0edd9cae..1a92eb78 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -2,8 +2,63 @@ #define AMBULANCE_H #include "islepathactor.h" +#include "legostate.h" -class AmbulanceMissionState; +// VTABLE: LEGO1 0x100d72a0 +// SIZE 0x24 +class AmbulanceMissionState : public LegoState { +public: + AmbulanceMissionState(); + + // FUNCTION: LEGO1 0x10037600 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f00e8 + return "AmbulanceMissionState"; + } + + // FUNCTION: LEGO1 0x10037610 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, AmbulanceMissionState::ClassName()) || LegoState::IsA(p_name); + } + + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + inline MxU16 GetScore(MxU8 p_id) + { + switch (p_id) { + case 1: + return m_score1; + case 2: + return m_score2; + case 3: + return m_score3; + case 4: + return m_score4; + case 5: + return m_score5; + default: + return 0; + } + } + + // SYNTHETIC: LEGO1 0x100376c0 + // AmbulanceMissionState::`scalar deleting destructor' + + undefined4 m_unk0x08; // 0x08 + undefined4 m_unk0x0c; // 0x0c + MxU16 m_unk0x10; // 0x10 + MxU16 m_unk0x12; // 0x12 + MxU16 m_unk0x14; // 0x14 + MxU16 m_unk0x16; // 0x16 + MxU16 m_unk0x18; // 0x18 + MxU16 m_score1; // 0x1a + MxU16 m_score2; // 0x1c + MxU16 m_score3; // 0x1e + MxU16 m_score4; // 0x20 + MxU16 m_score5; // 0x22 +}; // VTABLE: LEGO1 0x100d71a8 // SIZE 0x184 diff --git a/LEGO1/lego/legoomni/include/ambulancemissionstate.h b/LEGO1/lego/legoomni/include/ambulancemissionstate.h deleted file mode 100644 index 002d2803..00000000 --- a/LEGO1/lego/legoomni/include/ambulancemissionstate.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef AMBULANCEMISSIONSTATE_H -#define AMBULANCEMISSIONSTATE_H - -#include "legostate.h" - -// VTABLE: LEGO1 0x100d72a0 -// SIZE 0x24 -class AmbulanceMissionState : public LegoState { -public: - AmbulanceMissionState(); - - // FUNCTION: LEGO1 0x10037600 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f00e8 - return "AmbulanceMissionState"; - } - - // FUNCTION: LEGO1 0x10037610 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, AmbulanceMissionState::ClassName()) || LegoState::IsA(p_name); - } - - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - inline MxU16 GetScore(MxU8 p_id) - { - switch (p_id) { - case 1: - return m_score1; - case 2: - return m_score2; - case 3: - return m_score3; - case 4: - return m_score4; - case 5: - return m_score5; - default: - return 0; - } - } - - // SYNTHETIC: LEGO1 0x100376c0 - // AmbulanceMissionState::`scalar deleting destructor' - - undefined4 m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c - MxU16 m_unk0x10; // 0x10 - MxU16 m_unk0x12; // 0x12 - MxU16 m_unk0x14; // 0x14 - MxU16 m_unk0x16; // 0x16 - MxU16 m_unk0x18; // 0x18 - MxU16 m_score1; // 0x1a - MxU16 m_score2; // 0x1c - MxU16 m_score3; // 0x1e - MxU16 m_score4; // 0x20 - MxU16 m_score5; // 0x22 -}; - -#endif // AMBULANCEMISSIONSTATE_H diff --git a/LEGO1/lego/legoomni/include/animstate.h b/LEGO1/lego/legoomni/include/animstate.h deleted file mode 100644 index 8f3eda25..00000000 --- a/LEGO1/lego/legoomni/include/animstate.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef ANIMSTATE_H -#define ANIMSTATE_H - -#include "legostate.h" - -// SIZE 0x30 -struct ModelInfo { - char* m_name; // 0x00 - MxU8 m_unk0x04; // 0x04 - float m_location[3]; // 0x08 - float m_direction[3]; // 0x14 - float m_up[3]; // 0x20 - MxU8 m_unk0x2c; // 0x2c -}; - -// SIZE 0x30 -struct AnimInfo { - char* m_name; // 0x00 - MxU32 m_objectId; // 0x04 - MxS16 m_location; // 0x08 - MxBool m_unk0x0a; // 0x0a - MxU8 m_unk0x0b; // 0x0b - MxU8 m_unk0x0c; // 0x0c - MxU8 m_unk0x0d; // 0x0d - float m_unk0x10[4]; // 0x10 - MxU8 m_modelCount; // 0x20 - MxU16 m_unk0x22; // 0x22 - ModelInfo* m_models; // 0x24 - MxS8 m_unk0x28; // 0x28 - MxBool m_unk0x29; // 0x29 - MxS8 m_unk0x2a[3]; // 0x2a -}; - -// VTABLE: LEGO1 0x100d8d80 -// SIZE 0x1c -class AnimState : public LegoState { -public: - AnimState(); - ~AnimState() override; // vtable+0x00 - - // FUNCTION: LEGO1 0x10065070 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0460 - return "AnimState"; - } - - // FUNCTION: LEGO1 0x10065080 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, AnimState::ClassName()) || LegoState::IsA(p_name); - } - - MxBool SetFlag() override; // vtable+0x18 - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - void FUN_100651d0(MxU32, AnimInfo*, MxU32&); - void FUN_10065240(MxU32, AnimInfo*, MxU32); - - // SYNTHETIC: LEGO1 0x10065130 - // AnimState::`scalar deleting destructor' - -private: - undefined4 m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c - void* m_unk0x10; // 0x10 - undefined4 m_unk0x14; // 0x14 - void* m_unk0x18; // 0x18 -}; - -#endif // ANIMSTATE_H diff --git a/LEGO1/lego/legoomni/include/beachhouseentity.h b/LEGO1/lego/legoomni/include/beachhouseentity.h deleted file mode 100644 index 34e9db47..00000000 --- a/LEGO1/lego/legoomni/include/beachhouseentity.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef BEACHHOUSEENTITY_H -#define BEACHHOUSEENTITY_H - -#include "buildingentity.h" - -// VTABLE: LEGO1 0x100d4a18 -// SIZE 0x68 -class BeachHouseEntity : public BuildingEntity { -public: - // FUNCTION: LEGO1 0x1000ee80 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0314 - return "BeachHouseEntity"; - } - - // FUNCTION: LEGO1 0x1000ee90 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, BeachHouseEntity::ClassName()) || BuildingEntity::IsA(p_name); - } - - MxLong VTable0x50(MxParam& p_param) override; - - // SYNTHETIC: LEGO1 0x1000f970 - // BeachHouseEntity::`scalar deleting destructor' -}; - -#endif // BEACHHOUSEENTITY_H diff --git a/LEGO1/lego/legoomni/include/buildings.h b/LEGO1/lego/legoomni/include/buildings.h new file mode 100644 index 00000000..39394628 --- /dev/null +++ b/LEGO1/lego/legoomni/include/buildings.h @@ -0,0 +1,166 @@ +#ifndef BUILDINGS_H +#define BUILDINGS_H + +#include "buildingentity.h" + +// VTABLE: LEGO1 0x100d48a8 +// SIZE 0x68 +class RaceStandsEntity : public BuildingEntity { + // FUNCTION: LEGO1 0x1000efa0 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0300 + return "RaceStandsEntity"; + } + + // FUNCTION: LEGO1 0x1000efb0 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, RaceStandsEntity::ClassName()) || BuildingEntity::IsA(p_name); + } + + MxLong VTable0x50(MxParam& p_param) override; + + // SYNTHETIC: LEGO1 0x1000f9e0 + // RaceStandsEntity::`scalar deleting destructor' +}; + +// VTABLE: LEGO1 0x100d4a18 +// SIZE 0x68 +class BeachHouseEntity : public BuildingEntity { +public: + // FUNCTION: LEGO1 0x1000ee80 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0314 + return "BeachHouseEntity"; + } + + // FUNCTION: LEGO1 0x1000ee90 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, BeachHouseEntity::ClassName()) || BuildingEntity::IsA(p_name); + } + + MxLong VTable0x50(MxParam& p_param) override; + + // SYNTHETIC: LEGO1 0x1000f970 + // BeachHouseEntity::`scalar deleting destructor' +}; + +// VTABLE: LEGO1 0x100d4ab0 +// SIZE 0x68 +class PoliceEntity : public BuildingEntity { +public: + // FUNCTION: LEGO1 0x1000ed60 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0328 + return "PoliceEntity"; + } + + // FUNCTION: LEGO1 0x1000ed70 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, PoliceEntity::ClassName()) || BuildingEntity::IsA(p_name); + } + + MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 + + // SYNTHETIC: LEGO1 0x1000f900 + // PoliceEntity::`scalar deleting destructor' +}; + +// VTABLE: LEGO1 0x100d4b90 +// SIZE 0x68 +class InfoCenterEntity : public BuildingEntity { +public: + // FUNCTION: LEGO1 0x1000ea00 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f035c + return "InfoCenterEntity"; + } + + // FUNCTION: LEGO1 0x1000ea10 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, InfoCenterEntity::ClassName()) || BuildingEntity::IsA(p_name); + } + + MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 + + // SYNTHETIC: LEGO1 0x1000f7b0 + // InfoCenterEntity::`scalar deleting destructor' +}; + +// VTABLE: LEGO1 0x100d5068 +// SIZE 0x68 +class HospitalEntity : public BuildingEntity { +public: + // FUNCTION: LEGO1 0x1000ec40 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0338 + return "HospitalEntity"; + } + + // FUNCTION: LEGO1 0x1000ec50 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, HospitalEntity::ClassName()) || BuildingEntity::IsA(p_name); + } + + MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 + + // SYNTHETIC: LEGO1 0x1000f820 + // HospitalEntity::`scalar deleting destructor' +}; + +// VTABLE: LEGO1 0x100d5200 +// SIZE 0x68 +class JailEntity : public BuildingEntity { + // FUNCTION: LEGO1 0x1000f0c0 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0300 + return "RaceStandsEntity"; + } + + // FUNCTION: LEGO1 0x1000f0d0 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, JailEntity::ClassName()) || BuildingEntity::IsA(p_name); + } + + // STUB: LEGO1 0x100154f0 + MxLong VTable0x50(MxParam& p_param) override { return 0; } + + // SYNTHETIC: LEGO1 0x1000fac0 + // JailEntity::`scalar deleting destructor' +}; + +// VTABLE: LEGO1 0x100d5258 +// SIZE 0x68 +class GasStationEntity : public BuildingEntity { +public: + // FUNCTION: LEGO1 0x1000eb20 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0348 + return "GasStationEntity"; + } + + // FUNCTION: LEGO1 0x1000eb30 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, GasStationEntity::ClassName()) || BuildingEntity::IsA(p_name); + } + + MxLong VTable0x50(MxParam& p_param) override; + + // SYNTHETIC: LEGO1 0x1000f890 + // GasStationEntity::`scalar deleting destructor' +}; + +#endif // BUILDINGS_H diff --git a/LEGO1/lego/legoomni/include/carrace.h b/LEGO1/lego/legoomni/include/carrace.h index bb9d6324..67332197 100644 --- a/LEGO1/lego/legoomni/include/carrace.h +++ b/LEGO1/lego/legoomni/include/carrace.h @@ -4,6 +4,27 @@ #include "decomp.h" #include "legorace.h" +// VTABLE: LEGO1 0x100d4b70 +// SIZE 0x2c +class CarRaceState : public RaceState { +public: + // FUNCTION: LEGO1 0x1000dd30 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f009c + return "CarRaceState"; + } + + // FUNCTION: LEGO1 0x1000dd40 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, CarRaceState::ClassName()) || RaceState::IsA(p_name); + } + + // SYNTHETIC: LEGO1 0x1000f740 + // CarRaceState::`scalar deleting destructor' +}; + // VTABLE: LEGO1 0x100d5e50 // SIZE 0x154 class CarRace : public LegoRace { diff --git a/LEGO1/lego/legoomni/include/carracestate.h b/LEGO1/lego/legoomni/include/carracestate.h deleted file mode 100644 index c7a1e376..00000000 --- a/LEGO1/lego/legoomni/include/carracestate.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef CARRACESTATE_H -#define CARRACESTATE_H - -#include "racestate.h" - -// VTABLE: LEGO1 0x100d4b70 -// SIZE 0x2c -class CarRaceState : public RaceState { -public: - // FUNCTION: LEGO1 0x1000dd30 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f009c - return "CarRaceState"; - } - - // FUNCTION: LEGO1 0x1000dd40 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, CarRaceState::ClassName()) || RaceState::IsA(p_name); - } - - // SYNTHETIC: LEGO1 0x1000f740 - // CarRaceState::`scalar deleting destructor' -}; - -#endif // CARRACESTATE_H diff --git a/LEGO1/lego/legoomni/include/caveentity.h b/LEGO1/lego/legoomni/include/caveentity.h index 24b9759f..308f35bc 100644 --- a/LEGO1/lego/legoomni/include/caveentity.h +++ b/LEGO1/lego/legoomni/include/caveentity.h @@ -1,7 +1,7 @@ #ifndef CAVEENTITY_H #define CAVEENTITY_H -#include "racestandsentity.h" +#include "buildings.h" // No overrides, uses vtable from RaceStandsEntity // SIZE 0x68 diff --git a/LEGO1/lego/legoomni/include/gasstation.h b/LEGO1/lego/legoomni/include/gasstation.h index 0709f0ad..6a37db84 100644 --- a/LEGO1/lego/legoomni/include/gasstation.h +++ b/LEGO1/lego/legoomni/include/gasstation.h @@ -3,12 +3,55 @@ #include "decomp.h" #include "legogamestate.h" +#include "legostate.h" #include "legoworld.h" #include "radio.h" -class GasStationState; class MxStillPresenter; +// VTABLE: LEGO1 0x100d46e0 +// SIZE 0x24 +class GasStationState : public LegoState { +public: + // SIZE 0x04 + struct Unknown0x14 { + undefined4 m_unk0x00; // 0x00 + }; + + GasStationState(); + + // FUNCTION: LEGO1 0x100061d0 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0174 + return "GasStationState"; + } + + // FUNCTION: LEGO1 0x100061e0 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, GasStationState::ClassName()) || LegoState::IsA(p_name); + } + + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + // SYNTHETIC: LEGO1 0x10006290 + // GasStationState::`scalar deleting destructor' + + void FUN_10006430(undefined4); + void FUN_10006490(); + + // TODO: Most likely getters/setters are not used according to BETA. + + undefined4 m_unk0x08[3]; // 0x08 + Unknown0x14 m_unk0x14; // 0x14 + MxS16 m_unk0x18; // 0x18 + MxS16 m_unk0x1a; // 0x1a + MxS16 m_unk0x1c; // 0x1c + MxS16 m_unk0x1e; // 0x1e + MxS16 m_unk0x20; // 0x20 +}; + // VTABLE: LEGO1 0x100d4650 // SIZE 0x128 class GasStation : public LegoWorld { diff --git a/LEGO1/lego/legoomni/include/gasstationentity.h b/LEGO1/lego/legoomni/include/gasstationentity.h deleted file mode 100644 index 1b25cfd2..00000000 --- a/LEGO1/lego/legoomni/include/gasstationentity.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef GASSTATIONENTITY_H -#define GASSTATIONENTITY_H - -#include "buildingentity.h" - -// VTABLE: LEGO1 0x100d5258 -// SIZE 0x68 -class GasStationEntity : public BuildingEntity { -public: - // FUNCTION: LEGO1 0x1000eb20 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0348 - return "GasStationEntity"; - } - - // FUNCTION: LEGO1 0x1000eb30 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, GasStationEntity::ClassName()) || BuildingEntity::IsA(p_name); - } - - MxLong VTable0x50(MxParam& p_param) override; - - // SYNTHETIC: LEGO1 0x1000f890 - // GasStationEntity::`scalar deleting destructor' -}; - -#endif // GASSTATIONENTITY_H diff --git a/LEGO1/lego/legoomni/include/gasstationstate.h b/LEGO1/lego/legoomni/include/gasstationstate.h deleted file mode 100644 index bf0327da..00000000 --- a/LEGO1/lego/legoomni/include/gasstationstate.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef GASSTATIONSTATE_H -#define GASSTATIONSTATE_H - -#include "legostate.h" - -// VTABLE: LEGO1 0x100d46e0 -// SIZE 0x24 -class GasStationState : public LegoState { -public: - // SIZE 0x04 - struct Unknown0x14 { - undefined4 m_unk0x00; // 0x00 - }; - - GasStationState(); - - // FUNCTION: LEGO1 0x100061d0 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0174 - return "GasStationState"; - } - - // FUNCTION: LEGO1 0x100061e0 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, GasStationState::ClassName()) || LegoState::IsA(p_name); - } - - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - // SYNTHETIC: LEGO1 0x10006290 - // GasStationState::`scalar deleting destructor' - - void FUN_10006430(undefined4); - void FUN_10006490(); - - friend class GasStation; - -private: - undefined4 m_unk0x08[3]; // 0x08 - Unknown0x14 m_unk0x14; // 0x14 - MxS16 m_unk0x18; // 0x18 - MxS16 m_unk0x1a; // 0x1a - MxS16 m_unk0x1c; // 0x1c - MxS16 m_unk0x1e; // 0x1e - MxS16 m_unk0x20; // 0x20 -}; - -#endif // GASSTATIONSTATE_H diff --git a/LEGO1/lego/legoomni/include/helicopter.h b/LEGO1/lego/legoomni/include/helicopter.h index 638f9287..dd9451c0 100644 --- a/LEGO1/lego/legoomni/include/helicopter.h +++ b/LEGO1/lego/legoomni/include/helicopter.h @@ -2,9 +2,46 @@ #define HELICOPTER_H #include "islepathactor.h" +#include "legostate.h" #include "realtime/matrix.h" -class HelicopterState; +// VTABLE: LEGO1 0x100d5418 +// SIZE 0x0c +class HelicopterState : public LegoState { +public: + // FUNCTION: LEGO1 0x1000e0d0 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0144 + return "HelicopterState"; + } + + // FUNCTION: LEGO1 0x1000e0e0 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, HelicopterState::ClassName()) || LegoState::IsA(p_name); + } + + // FUNCTION: LEGO1 0x1000e0b0 + MxBool IsSerializable() override { return FALSE; } // vtable+0x14 + + // FUNCTION: LEGO1 0x1000e0c0 + MxBool SetFlag() override + { + m_unk0x08 = 0; + return TRUE; + } // vtable+0x18 + + inline void SetUnknown8(MxU32 p_unk0x08) { m_unk0x08 = p_unk0x08; } + inline MxU32 GetUnkown8() { return m_unk0x08; } + + // SYNTHETIC: LEGO1 0x1000e190 + // HelicopterState::`scalar deleting destructor' + + // TODO: Most likely getters/setters are not used according to BETA. + + MxU32 m_unk0x08; // 0x08 +}; // VTABLE: LEGO1 0x100d40f8 // SIZE 0x230 diff --git a/LEGO1/lego/legoomni/include/helicopterstate.h b/LEGO1/lego/legoomni/include/helicopterstate.h deleted file mode 100644 index 7bda248f..00000000 --- a/LEGO1/lego/legoomni/include/helicopterstate.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef HELICOPTERSTATE_H -#define HELICOPTERSTATE_H - -#include "decomp.h" -#include "legostate.h" - -// VTABLE: LEGO1 0x100d5418 -// SIZE 0x0c -class HelicopterState : public LegoState { -public: - // FUNCTION: LEGO1 0x1000e0d0 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0144 - return "HelicopterState"; - } - - // FUNCTION: LEGO1 0x1000e0e0 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, HelicopterState::ClassName()) || LegoState::IsA(p_name); - } - - // FUNCTION: LEGO1 0x1000e0b0 - MxBool IsSerializable() override { return FALSE; } // vtable+0x14 - - // FUNCTION: LEGO1 0x1000e0c0 - MxBool SetFlag() override - { - m_unk0x08 = 0; - return TRUE; - } // vtable+0x18 - - inline void SetUnknown8(MxU32 p_unk0x08) { m_unk0x08 = p_unk0x08; } - inline MxU32 GetUnkown8() { return m_unk0x08; } - - // SYNTHETIC: LEGO1 0x1000e190 - // HelicopterState::`scalar deleting destructor' - -protected: - MxU32 m_unk0x08; // 0x08 -}; - -#endif // HELICOPTERSTATE_H diff --git a/LEGO1/lego/legoomni/include/hospital.h b/LEGO1/lego/legoomni/include/hospital.h index 014e872d..32377fe3 100644 --- a/LEGO1/lego/legoomni/include/hospital.h +++ b/LEGO1/lego/legoomni/include/hospital.h @@ -4,13 +4,54 @@ #include "actionsfwd.h" #include "decomp.h" #include "legogamestate.h" +#include "legostate.h" #include "legoworld.h" -class HospitalState; class LegoControlManagerEvent; class MxEndActionNotificationParam; class MxStillPresenter; +// VTABLE: LEGO1 0x100d97a0 +// SIZE 0x18 +class HospitalState : public LegoState { +public: + // SIZE 0x04 + struct Unknown0x08 { + undefined4 m_unk0x00; // 0x00 + }; + + HospitalState(); + ~HospitalState() override {} + + // FUNCTION: LEGO1 0x10076400 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0480 + return "HospitalState"; + } + + // FUNCTION: LEGO1 0x10076410 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, HospitalState::ClassName()) || LegoState::IsA(p_name); + } + + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + // SYNTHETIC: LEGO1 0x100764c0 + // HospitalState::`scalar deleting destructor' + + // TODO: Most likely getters/setters are not used according to BETA. + + Unknown0x08 m_unk0x08; // 0x08 + MxS16 m_unk0x0c; // 0x0c + MxS16 m_unk0x0e; // 0x0e + MxS16 m_unk0x10; // 0x10 + MxS16 m_unk0x12; // 0x12 + MxS16 m_unk0x14; // 0x14 + MxS16 m_unk0x16; // 0x16 +}; + // VTABLE: LEGO1 0x100d9730 // SIZE 0x12c class Hospital : public LegoWorld { diff --git a/LEGO1/lego/legoomni/include/hospitalentity.h b/LEGO1/lego/legoomni/include/hospitalentity.h deleted file mode 100644 index 3dbe7d54..00000000 --- a/LEGO1/lego/legoomni/include/hospitalentity.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef HOSPITALENTITY_H -#define HOSPITALENTITY_H - -#include "buildingentity.h" - -// VTABLE: LEGO1 0x100d5068 -// SIZE 0x68 -class HospitalEntity : public BuildingEntity { -public: - // FUNCTION: LEGO1 0x1000ec40 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0338 - return "HospitalEntity"; - } - - // FUNCTION: LEGO1 0x1000ec50 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, HospitalEntity::ClassName()) || BuildingEntity::IsA(p_name); - } - - MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 - - // SYNTHETIC: LEGO1 0x1000f820 - // HospitalEntity::`scalar deleting destructor' -}; - -#endif // HOSPITALENTITY_H diff --git a/LEGO1/lego/legoomni/include/hospitalstate.h b/LEGO1/lego/legoomni/include/hospitalstate.h deleted file mode 100644 index 16d80cb6..00000000 --- a/LEGO1/lego/legoomni/include/hospitalstate.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef HOSPITALSTATE_H -#define HOSPITALSTATE_H - -#include "decomp.h" -#include "legostate.h" - -// VTABLE: LEGO1 0x100d97a0 -// SIZE 0x18 -class HospitalState : public LegoState { -public: - // SIZE 0x04 - struct Unknown0x08 { - undefined4 m_unk0x00; // 0x00 - }; - - HospitalState(); - ~HospitalState() override {} - - // FUNCTION: LEGO1 0x10076400 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0480 - return "HospitalState"; - } - - // FUNCTION: LEGO1 0x10076410 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, HospitalState::ClassName()) || LegoState::IsA(p_name); - } - - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - // SYNTHETIC: LEGO1 0x100764c0 - // HospitalState::`scalar deleting destructor' - - friend class Hospital; - -private: - Unknown0x08 m_unk0x08; // 0x08 - MxS16 m_unk0x0c; // 0x0c - MxS16 m_unk0x0e; // 0x0e - MxS16 m_unk0x10; // 0x10 - MxS16 m_unk0x12; // 0x12 - MxS16 m_unk0x14; // 0x14 - MxS16 m_unk0x16; // 0x16 -}; - -#endif // HOSPITALSTATE_H diff --git a/LEGO1/lego/legoomni/include/infocenter.h b/LEGO1/lego/legoomni/include/infocenter.h index 08bb9a2c..7d805246 100644 --- a/LEGO1/lego/legoomni/include/infocenter.h +++ b/LEGO1/lego/legoomni/include/infocenter.h @@ -3,15 +3,65 @@ #include "actionsfwd.h" #include "legogamestate.h" +#include "legostate.h" #include "legoworld.h" #include "mxrect32.h" #include "radio.h" -class InfocenterState; class MxNotificationParam; class MxStillPresenter; class LegoControlManagerEvent; +// VTABLE: LEGO1 0x100d93a8 +// SIZE 0x94 +class InfocenterState : public LegoState { +public: + InfocenterState(); + ~InfocenterState() override; + + // FUNCTION: LEGO1 0x10071840 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f04dc + return "InfocenterState"; + } + + // FUNCTION: LEGO1 0x10071850 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, InfocenterState::ClassName()) || LegoState::IsA(p_name); + } + + // FUNCTION: LEGO1 0x10071830 + MxBool IsSerializable() override { return FALSE; } // vtable+0x14 + + inline MxS16 GetMaxNameLength() { return sizeOfArray(m_letters); } + inline MxStillPresenter* GetNameLetter(MxS32 p_index) { return m_letters[p_index]; } + inline void SetNameLetter(MxS32 p_index, MxStillPresenter* p_letter) { m_letters[p_index] = p_letter; } + inline MxBool HasRegistered() { return m_letters[0] != NULL; } + inline Playlist& GetExitDialogueAct1() { return m_exitDialogueAct1; } + inline Playlist& GetExitDialogueAct23() { return m_exitDialogueAct23; } + inline Playlist& GetReturnDialogue(LegoGameState::Act p_act) { return m_returnDialogue[p_act]; } + inline Playlist& GetLeaveDialogue(LegoGameState::Act p_act) { return m_leaveDialogue[p_act]; } + inline Playlist& GetBricksterDialogue() { return m_bricksterDialogue; } + inline MxU32 GetUnknown0x74() { return m_unk0x74; } + + inline void SetUnknown0x74(MxU32 p_unk0x74) { m_unk0x74 = p_unk0x74; } + + // SYNTHETIC: LEGO1 0x10071900 + // InfocenterState::`scalar deleting destructor' + + // TODO: Most likely getters/setters are not used according to BETA. + + Playlist m_exitDialogueAct1; // 0x08 + Playlist m_exitDialogueAct23; // 0x14 + Playlist m_returnDialogue[3]; // 0x20 + Playlist m_leaveDialogue[3]; // 0x44 + Playlist m_bricksterDialogue; // 0x68 + MxU32 m_unk0x74; // 0x74 + MxStillPresenter* m_letters[7]; // 0x78 +}; + // SIZE 0x18 struct InfocenterMapEntry { // FUNCTION: LEGO1 0x1006ec80 diff --git a/LEGO1/lego/legoomni/include/infocenterentity.h b/LEGO1/lego/legoomni/include/infocenterentity.h deleted file mode 100644 index 82fa3d30..00000000 --- a/LEGO1/lego/legoomni/include/infocenterentity.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef INFOCENTERENTITY_H -#define INFOCENTERENTITY_H - -#include "buildingentity.h" - -// VTABLE: LEGO1 0x100d4b90 -// SIZE 0x68 -class InfoCenterEntity : public BuildingEntity { -public: - // FUNCTION: LEGO1 0x1000ea00 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f035c - return "InfoCenterEntity"; - } - - // FUNCTION: LEGO1 0x1000ea10 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, InfoCenterEntity::ClassName()) || BuildingEntity::IsA(p_name); - } - - MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 - - // SYNTHETIC: LEGO1 0x1000f7b0 - // InfoCenterEntity::`scalar deleting destructor' -}; - -#endif // INFOCENTERENTITY_H diff --git a/LEGO1/lego/legoomni/include/infocenterstate.h b/LEGO1/lego/legoomni/include/infocenterstate.h deleted file mode 100644 index b1c418f1..00000000 --- a/LEGO1/lego/legoomni/include/infocenterstate.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef INFOCENTERSTATE_H -#define INFOCENTERSTATE_H - -#include "decomp.h" -#include "legogamestate.h" -#include "legostate.h" - -class MxStillPresenter; - -// VTABLE: LEGO1 0x100d93a8 -// SIZE 0x94 -class InfocenterState : public LegoState { -public: - InfocenterState(); - ~InfocenterState() override; - - // FUNCTION: LEGO1 0x10071840 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f04dc - return "InfocenterState"; - } - - // FUNCTION: LEGO1 0x10071850 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, InfocenterState::ClassName()) || LegoState::IsA(p_name); - } - - // FUNCTION: LEGO1 0x10071830 - MxBool IsSerializable() override { return FALSE; } // vtable+0x14 - - inline MxS16 GetMaxNameLength() { return sizeOfArray(m_letters); } - inline MxStillPresenter* GetNameLetter(MxS32 p_index) { return m_letters[p_index]; } - inline void SetNameLetter(MxS32 p_index, MxStillPresenter* p_letter) { m_letters[p_index] = p_letter; } - inline MxBool HasRegistered() { return m_letters[0] != NULL; } - inline Playlist& GetExitDialogueAct1() { return m_exitDialogueAct1; } - inline Playlist& GetExitDialogueAct23() { return m_exitDialogueAct23; } - inline Playlist& GetReturnDialogue(LegoGameState::Act p_act) { return m_returnDialogue[p_act]; } - inline Playlist& GetLeaveDialogue(LegoGameState::Act p_act) { return m_leaveDialogue[p_act]; } - inline Playlist& GetBricksterDialogue() { return m_bricksterDialogue; } - inline MxU32 GetUnknown0x74() { return m_unk0x74; } - - inline void SetUnknown0x74(MxU32 p_unk0x74) { m_unk0x74 = p_unk0x74; } - - // SYNTHETIC: LEGO1 0x10071900 - // InfocenterState::`scalar deleting destructor' - -private: - Playlist m_exitDialogueAct1; // 0x08 - Playlist m_exitDialogueAct23; // 0x14 - Playlist m_returnDialogue[3]; // 0x20 - Playlist m_leaveDialogue[3]; // 0x44 - Playlist m_bricksterDialogue; // 0x68 - MxU32 m_unk0x74; // 0x74 - MxStillPresenter* m_letters[7]; // 0x78 -}; - -#endif // INFOCENTERSTATE_H diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index e9d4da42..8af16007 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -3,16 +3,17 @@ #include "actionsfwd.h" #include "legogamestate.h" +#include "legostate.h" #include "legoworld.h" #include "radio.h" -class Act1State; class Ambulance; class Bike; class DuneBuggy; class Helicopter; class Jetski; class JukeBoxEntity; +class LegoNamedTexture; class Motocycle; class MxType19NotificationParam; class Pizza; @@ -21,6 +22,132 @@ class RaceCar; class SkateBoard; class TowTrack; +// VTABLE: LEGO1 0x100d7028 +// SIZE 0x26c +class Act1State : public LegoState { +public: + enum ElevatorFloor { + c_floor1 = 1, + c_floor2, + c_floor3 + }; + + enum { + e_unk953 = 953, + e_unk954 = 954, + e_unk955 = 955, + }; + + // SIZE 0x4c + class NamedPlane { + public: + // FUNCTION: LEGO1 0x10033800 + NamedPlane() {} + + inline void SetName(const char* p_name) { m_name = p_name; } + inline const MxString* GetName() const { return &m_name; } + + // FUNCTION: LEGO1 0x100344d0 + MxResult Serialize(LegoFile* p_file) + { + if (p_file->IsWriteMode()) { + p_file->WriteString(m_name); + p_file->WriteVector3(m_point1); + p_file->WriteVector3(m_point2); + p_file->WriteVector3(m_point3); + } + else if (p_file->IsReadMode()) { + p_file->ReadString(m_name); + p_file->ReadVector3(m_point1); + p_file->ReadVector3(m_point2); + p_file->ReadVector3(m_point3); + } + + return SUCCESS; + } + + private: + MxString m_name; // 0x00 + Mx3DPointFloat m_point1; // 0x10 + Mx3DPointFloat m_point2; // 0x24 + Mx3DPointFloat m_point3; // 0x38 + }; + + Act1State(); + + // FUNCTION: LEGO1 0x100338a0 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0154 + return "Act1State"; + } + + // FUNCTION: LEGO1 0x100338b0 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, Act1State::ClassName()) || LegoState::IsA(p_name); + } + + MxBool SetFlag() override; // vtable+0x18 + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + void FUN_10034660(); + void FUN_100346a0(); + void FUN_10034b60(); + void FUN_10034d00(); + + inline MxU32 GetUnknown18() { return m_unk0x018; } + inline ElevatorFloor GetElevatorFloor() { return (ElevatorFloor) m_elevFloor; } + inline MxU8 GetUnknown21() { return m_unk0x021; } + + inline void SetUnknown18(MxU32 p_unk0x18) { m_unk0x018 = p_unk0x18; } + inline void SetElevatorFloor(ElevatorFloor p_elevFloor) { m_elevFloor = p_elevFloor; } + inline void SetUnknown21(MxU8 p_unk0x21) { m_unk0x021 = p_unk0x21; } + + // SYNTHETIC: LEGO1 0x10033960 + // Act1State::`scalar deleting destructor' + + // TODO: Most likely getters/setters are not used according to BETA. + + MxS32* m_unk0x008; // 0x008 FIXME: count for m_unk0x008 + MxS16 m_unk0x00c; // 0x00c + undefined2 m_unk0x00e; // 0x00e + undefined2 m_unk0x010; // 0x010 + undefined m_unk0x012; // 0x012 + MxS32 m_unk0x014; // 0x014 + MxU32 m_unk0x018; // 0x018 + MxS16 m_elevFloor; // 0x01c + MxBool m_unk0x01e; // 0x01e + MxBool m_unk0x01f; // 0x01f + MxBool m_planeActive; // 0x020 + undefined m_unk0x021; // 0x021 + MxBool m_unk0x022; // 0x022 + undefined m_unk0x023; // 0x023 + NamedPlane m_unk0x024; // 0x024 + NamedPlane m_unk0x070; // 0x070 + NamedPlane m_unk0x0bc; // 0x0bc + NamedPlane m_unk0x108; // 0x108 + LegoNamedTexture* m_unk0x154; // 0x154 + LegoNamedTexture* m_unk0x158; // 0x158 + LegoNamedTexture* m_unk0x15c; // 0x15c + MxCore* m_unk0x160; // 0x160 + NamedPlane m_unk0x164; // 0x164 + LegoNamedTexture* m_unk0x1b0; // 0x1b0 + LegoNamedTexture* m_unk0x1b4; // 0x1b4 + MxCore* m_unk0x1b8; // 0x1b8 + NamedPlane m_unk0x1bc; // 0x1bc + LegoNamedTexture* m_unk0x208; // 0x208 + MxCore* m_unk0x20c; // 0x20c + NamedPlane m_unk0x210; // 0x210 + LegoNamedTexture* m_unk0x25c; // 0x25c + LegoNamedTexture* m_unk0x260; // 0x260 + LegoNamedTexture* m_unk0x264; // 0x264 + MxCore* m_unk0x268; // 0x268 +}; + +// FUNCTION: LEGO1 0x10033a70 +// Act1State::NamedPlane::~NamedPlane + // VTABLE: LEGO1 0x100d6fb8 // SIZE 0x140 class Isle : public LegoWorld { diff --git a/LEGO1/lego/legoomni/include/jailentity.h b/LEGO1/lego/legoomni/include/jailentity.h deleted file mode 100644 index adf7089a..00000000 --- a/LEGO1/lego/legoomni/include/jailentity.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef JAILENTITY_H -#define JAILENTITY_H - -#include "buildingentity.h" - -// VTABLE: LEGO1 0x100d5200 -// SIZE 0x68 -class JailEntity : public BuildingEntity { - // FUNCTION: LEGO1 0x1000f0c0 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0300 - return "RaceStandsEntity"; - } - - // FUNCTION: LEGO1 0x1000f0d0 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, JailEntity::ClassName()) || BuildingEntity::IsA(p_name); - } - - // STUB: LEGO1 0x100154f0 - MxLong VTable0x50(MxParam& p_param) override { return 0; } - - // SYNTHETIC: LEGO1 0x1000fac0 - // JailEntity::`scalar deleting destructor' -}; - -#endif // JAILENTITY_H diff --git a/LEGO1/lego/legoomni/include/jetskirace.h b/LEGO1/lego/legoomni/include/jetskirace.h index 7f17a1fc..b51496c4 100644 --- a/LEGO1/lego/legoomni/include/jetskirace.h +++ b/LEGO1/lego/legoomni/include/jetskirace.h @@ -3,6 +3,27 @@ #include "legorace.h" +// VTABLE: LEGO1 0x100d4fa8 +// SIZE 0x2c +class JetskiRaceState : public RaceState { +public: + // FUNCTION: LEGO1 0x1000dc40 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f00ac + return "JetskiRaceState"; + } + + // FUNCTION: LEGO1 0x1000dc50 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, JetskiRaceState::ClassName()) || RaceState::IsA(p_name); + } + + // SYNTHETIC: LEGO1 0x1000f680 + // JetskiRaceState::`scalar deleting destructor' +}; + // VTABLE: LEGO1 0x100d4fe8 // SIZE 0x144 class JetskiRace : public LegoRace { diff --git a/LEGO1/lego/legoomni/include/jetskiracestate.h b/LEGO1/lego/legoomni/include/jetskiracestate.h deleted file mode 100644 index 812a0a0f..00000000 --- a/LEGO1/lego/legoomni/include/jetskiracestate.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef JETSKIRACESTATE_H -#define JETSKIRACESTATE_H - -#include "racestate.h" - -// VTABLE: LEGO1 0x100d4fa8 -// SIZE 0x2c -class JetskiRaceState : public RaceState { -public: - // FUNCTION: LEGO1 0x1000dc40 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f00ac - return "JetskiRaceState"; - } - - // FUNCTION: LEGO1 0x1000dc50 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, JetskiRaceState::ClassName()) || RaceState::IsA(p_name); - } - - // SYNTHETIC: LEGO1 0x1000f680 - // JetskiRaceState::`scalar deleting destructor' -}; - -#endif // JETSKIRACESTATE_H diff --git a/LEGO1/lego/legoomni/include/jukebox.h b/LEGO1/lego/legoomni/include/jukebox.h index 2ee17f37..8b624191 100644 --- a/LEGO1/lego/legoomni/include/jukebox.h +++ b/LEGO1/lego/legoomni/include/jukebox.h @@ -3,10 +3,46 @@ #include "decomp.h" #include "legogamestate.h" +#include "legostate.h" #include "legoworld.h" class LegoControlManagerEvent; -class JukeBoxState; + +// VTABLE: LEGO1 0x100d4a90 +// SIZE 0x10 +class JukeBoxState : public LegoState { +public: + enum Music { + e_pasquell = 0, + e_right, + e_decal, + e_wallis, + e_nelson, + e_torpedos + }; + + // FUNCTION: LEGO1 0x1000f310 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f02bc + return "JukeBoxState"; + } + + // FUNCTION: LEGO1 0x1000f320 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, JukeBoxState::ClassName()) || LegoState::IsA(p_name); + } + + // FUNCTION: LEGO1 0x1000f300 + MxBool IsSerializable() override { return FALSE; } // vtable+0x14 + + // SYNTHETIC: LEGO1 0x1000f3d0 + // JukeBoxState::`scalar deleting destructor' + + Music m_music; // 0x08 + MxU32 m_active; // 0x0c +}; // VTABLE: LEGO1 0x100d8958 // SIZE 0x104 diff --git a/LEGO1/lego/legoomni/include/jukeboxstate.h b/LEGO1/lego/legoomni/include/jukeboxstate.h deleted file mode 100644 index d9da3b84..00000000 --- a/LEGO1/lego/legoomni/include/jukeboxstate.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef JUKEBOXSTATE_H -#define JUKEBOXSTATE_H - -#include "legostate.h" - -// VTABLE: LEGO1 0x100d4a90 -// SIZE 0x10 -class JukeBoxState : public LegoState { -public: - enum Music { - e_pasquell = 0, - e_right, - e_decal, - e_wallis, - e_nelson, - e_torpedos - }; - - // FUNCTION: LEGO1 0x1000f310 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f02bc - return "JukeBoxState"; - } - - // FUNCTION: LEGO1 0x1000f320 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, JukeBoxState::ClassName()) || LegoState::IsA(p_name); - } - - MxBool IsSerializable() override; // vtable+0x14 - - // SYNTHETIC: LEGO1 0x1000f3d0 - // JukeBoxState::`scalar deleting destructor' - - Music m_music; // 0x08 - MxU32 m_active; // 0x0c -}; - -#endif // JUKEBOXSTATE_H diff --git a/LEGO1/lego/legoomni/include/legoact2.h b/LEGO1/lego/legoomni/include/legoact2.h index b84fada3..735e31c2 100644 --- a/LEGO1/lego/legoomni/include/legoact2.h +++ b/LEGO1/lego/legoomni/include/legoact2.h @@ -2,8 +2,43 @@ #define LEGOACT2_H #include "act2brick.h" +#include "legostate.h" #include "legoworld.h" +// VTABLE: LEGO1 0x100d4a70 +// SIZE 0x10 +class LegoAct2State : public LegoState { +public: + ~LegoAct2State() override {} + + // FUNCTION: LEGO1 0x1000df80 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0428 + return "LegoAct2State"; + } + + // FUNCTION: LEGO1 0x1000df90 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, LegoAct2State::ClassName()) || LegoState::IsA(p_name); + } + + // FUNCTION: LEGO1 0x1000df70 + MxBool IsSerializable() override { return FALSE; } // vtable+0x14 + + // SYNTHETIC: LEGO1 0x1000e040 + // LegoAct2State::`scalar deleting destructor' + + inline undefined4 GetUnknown0x08() { return m_unk0x08; } + inline void SetUnknown0x0c(undefined p_unk0x0c) { m_unk0x0c = p_unk0x0c; } + + // TODO: Most likely getters/setters are not used according to BETA. + + undefined4 m_unk0x08; // 0x08 + undefined m_unk0x0c; // 0x0c +}; + // VTABLE: LEGO1 0x100d82e0 // SIZE 0x1154 class LegoAct2 : public LegoWorld { diff --git a/LEGO1/lego/legoomni/include/legoact2state.h b/LEGO1/lego/legoomni/include/legoact2state.h deleted file mode 100644 index 5f046e74..00000000 --- a/LEGO1/lego/legoomni/include/legoact2state.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef LEGOACT2STATE_H -#define LEGOACT2STATE_H - -#include "legostate.h" - -// VTABLE: LEGO1 0x100d4a70 -// SIZE 0x10 -class LegoAct2State : public LegoState { -public: - ~LegoAct2State() override {} - - // FUNCTION: LEGO1 0x1000df80 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0428 - return "LegoAct2State"; - } - - // FUNCTION: LEGO1 0x1000df90 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, LegoAct2State::ClassName()) || LegoState::IsA(p_name); - } - - MxBool IsSerializable() override; // vtable+0x14 - - // SYNTHETIC: LEGO1 0x1000e040 - // LegoAct2State::`scalar deleting destructor' - - inline undefined4 GetUnknown0x08() { return m_unk0x08; } - inline void SetUnknown0x0c(undefined p_unk0x0c) { m_unk0x0c = p_unk0x0c; } - -private: - undefined4 m_unk0x08; // 0x08 - undefined m_unk0x0c; // 0x0c -}; - -#endif // LEGOACT2STATE_H diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index e118cbf5..8e473077 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -4,11 +4,11 @@ #include "actionsfwd.h" #include "decomp.h" #include "legolocations.h" +#include "legostate.h" #include "legotraninfolist.h" #include "mxcore.h" #include "mxgeometry/mxgeometry3d.h" -class AnimState; class LegoAnimPresenter; class LegoEntity; class LegoExtraActor; @@ -18,9 +18,73 @@ class LegoPathBoundary; class LegoROIList; struct LegoUnknown100db7f4; class LegoWorld; -struct ModelInfo; class MxDSAction; +// SIZE 0x30 +struct ModelInfo { + char* m_name; // 0x00 + MxU8 m_unk0x04; // 0x04 + float m_location[3]; // 0x08 + float m_direction[3]; // 0x14 + float m_up[3]; // 0x20 + MxU8 m_unk0x2c; // 0x2c +}; + +// SIZE 0x30 +struct AnimInfo { + char* m_name; // 0x00 + MxU32 m_objectId; // 0x04 + MxS16 m_location; // 0x08 + MxBool m_unk0x0a; // 0x0a + MxU8 m_unk0x0b; // 0x0b + MxU8 m_unk0x0c; // 0x0c + MxU8 m_unk0x0d; // 0x0d + float m_unk0x10[4]; // 0x10 + MxU8 m_modelCount; // 0x20 + MxU16 m_unk0x22; // 0x22 + ModelInfo* m_models; // 0x24 + MxS8 m_unk0x28; // 0x28 + MxBool m_unk0x29; // 0x29 + MxS8 m_unk0x2a[3]; // 0x2a +}; + +// VTABLE: LEGO1 0x100d8d80 +// SIZE 0x1c +class AnimState : public LegoState { +public: + AnimState(); + ~AnimState() override; // vtable+0x00 + + // FUNCTION: LEGO1 0x10065070 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0460 + return "AnimState"; + } + + // FUNCTION: LEGO1 0x10065080 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, AnimState::ClassName()) || LegoState::IsA(p_name); + } + + MxBool SetFlag() override; // vtable+0x18 + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + void FUN_100651d0(MxU32, AnimInfo*, MxU32&); + void FUN_10065240(MxU32, AnimInfo*, MxU32); + + // SYNTHETIC: LEGO1 0x10065130 + // AnimState::`scalar deleting destructor' + +private: + undefined4 m_unk0x08; // 0x08 + undefined4 m_unk0x0c; // 0x0c + void* m_unk0x10; // 0x10 + undefined4 m_unk0x14; // 0x14 + void* m_unk0x18; // 0x18 +}; + // VTABLE: LEGO1 0x100d8c18 // SIZE 0x500 class LegoAnimationManager : public MxCore { diff --git a/LEGO1/lego/legoomni/include/legocarbuild.h b/LEGO1/lego/legoomni/include/legocarbuild.h index bd86964e..ed486c9f 100644 --- a/LEGO1/lego/legoomni/include/legocarbuild.h +++ b/LEGO1/lego/legoomni/include/legocarbuild.h @@ -1,8 +1,54 @@ #ifndef LEGOCARBUILD_H #define LEGOCARBUILD_H +#include "legostate.h" #include "legoworld.h" +// VTABLE: LEGO1 0x100d66e0 +// SIZE 0x50 +class LegoVehicleBuildState : public LegoState { +public: + LegoVehicleBuildState(char* p_classType); + + // FUNCTION: LEGO1 0x10025ff0 + inline const char* ClassName() const override // vtable+0x0c + { + return this->m_className.GetData(); + } + + // FUNCTION: LEGO1 0x10026000 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, this->m_className.GetData()) || LegoState::IsA(p_name); + } + + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + // SYNTHETIC: LEGO1 0x100260a0 + // LegoVehicleBuildState::`scalar deleting destructor' + + // TODO: Most likely getters/setters are not used according to BETA. + + Playlist m_unk0x08[4]; // 0x08 + + // This can be one of the following: + // * LegoRaceCarBuildState + // * LegoCopterBuildState + // * LegoDuneCarBuildState + // * LegoJetskiBuildState + MxString m_className; // 0x38 + + // Known States: + // * 1 == enter(ing) build screen + // * 3 == cutscene/dialogue + // * 6 == exit(ing) build screen + MxU32 m_animationState; // 0x48 + undefined m_unk0x4c; // 0x4c + MxBool m_unk0x4d; // 0x4d + MxBool m_unk0x4e; // 0x4e + MxU8 m_placedPartCount; // 0x4f +}; + // VTABLE: LEGO1 0x100d6658 // SIZE 0x34c class LegoCarBuild : public LegoWorld { diff --git a/LEGO1/lego/legoomni/include/legocarbuildanimpresenter.h b/LEGO1/lego/legoomni/include/legocarbuildpresenter.h similarity index 93% rename from LEGO1/lego/legoomni/include/legocarbuildanimpresenter.h rename to LEGO1/lego/legoomni/include/legocarbuildpresenter.h index d4c12d76..69afdebf 100644 --- a/LEGO1/lego/legoomni/include/legocarbuildanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legocarbuildpresenter.h @@ -1,5 +1,5 @@ -#ifndef LEGOCARBUILDANIMPRESENTER_H -#define LEGOCARBUILDANIMPRESENTER_H +#ifndef LEGOCARBUILDPRESENTER_H +#define LEGOCARBUILDPRESENTER_H #include "anim/legoanim.h" #include "legoanimpresenter.h" @@ -59,4 +59,4 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter { undefined4 m_unk0x14c; // 0x14c }; -#endif // LEGOCARBUILDANIMPRESENTER_H +#endif // LEGOCARBUILDPRESENTER_H diff --git a/LEGO1/lego/legoomni/include/legorace.h b/LEGO1/lego/legoomni/include/legorace.h index f99f7e28..76282d0b 100644 --- a/LEGO1/lego/legoomni/include/legorace.h +++ b/LEGO1/lego/legoomni/include/legorace.h @@ -2,10 +2,60 @@ #define LEGORACE_H #include "decomp.h" +#include "legostate.h" #include "legoworld.h" #include "mxrect32.h" #include "mxtypes.h" +// VTABLE: LEGO1 0x100d5e30 +// SIZE 0x2c +class RaceState : public LegoState { +public: + // SIZE 0x06 + struct Entry { + public: + inline MxS16 GetUnknown0x02() { return m_unk0x02; } + inline MxU16 GetScore() { return m_score; } + + // TODO: Possibly private + MxU8 m_id; // 0x00 + MxS16 m_unk0x02; // 0x02 + MxU16 m_score; // 0x04 + }; + + RaceState(); + + // FUNCTION: LEGO1 0x10016010 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f07d0 + return "RaceState"; + } + + // FUNCTION: LEGO1 0x10016020 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, RaceState::ClassName()) || LegoState::IsA(p_name); + } + + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + Entry* GetState(MxU8 p_id); + + inline undefined4 GetUnknown0x28() { return m_unk0x28; } + + // SYNTHETIC: LEGO1 0x1000f6f0 + // RaceState::~RaceState + + // SYNTHETIC: LEGO1 0x100160d0 + // RaceState::`scalar deleting destructor' + + // TODO: Most likely getters/setters are not used according to BETA. + + Entry m_state[5]; // 0x08 + undefined4 m_unk0x28; // 0x28 +}; + // VTABLE: LEGO1 0x100d5db0 // SIZE 0x144 class LegoRace : public LegoWorld { diff --git a/LEGO1/lego/legoomni/include/legovehiclebuildstate.h b/LEGO1/lego/legoomni/include/legovehiclebuildstate.h deleted file mode 100644 index 7a70a873..00000000 --- a/LEGO1/lego/legoomni/include/legovehiclebuildstate.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef LEGOVEHICLEBUILDSTATE_H -#define LEGOVEHICLEBUILDSTATE_H - -#include "decomp.h" -#include "legostate.h" -#include "mxstring.h" - -// VTABLE: LEGO1 0x100d66e0 -// SIZE 0x50 -class LegoVehicleBuildState : public LegoState { -public: - LegoVehicleBuildState(char* p_classType); - - // FUNCTION: LEGO1 0x10025ff0 - inline const char* ClassName() const override // vtable+0x0c - { - return this->m_className.GetData(); - } - - // FUNCTION: LEGO1 0x10026000 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, this->m_className.GetData()) || LegoState::IsA(p_name); - } - - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - // SYNTHETIC: LEGO1 0x100260a0 - // LegoVehicleBuildState::`scalar deleting destructor' - - // private: - Playlist m_unk0x08[4]; // 0x08 - - // This can be one of the following: - // * LegoRaceCarBuildState - // * LegoCopterBuildState - // * LegoDuneCarBuildState - // * LegoJetskiBuildState - MxString m_className; // 0x38 - - // Known States: - // * 1 == enter(ing) build screen - // * 3 == cutscene/dialogue - // * 6 == exit(ing) build screen - MxU32 m_animationState; // 0x48 - undefined m_unk0x4c; // 0x4c - MxBool m_unk0x4d; // 0x4d - MxBool m_unk0x4e; // 0x4e - MxU8 m_placedPartCount; // 0x4f -}; - -#endif // LEGOVEHICLEBUILDSTATE_H diff --git a/LEGO1/lego/legoomni/include/pizza.h b/LEGO1/lego/legoomni/include/pizza.h index 01e99d7f..7f1356be 100644 --- a/LEGO1/lego/legoomni/include/pizza.h +++ b/LEGO1/lego/legoomni/include/pizza.h @@ -3,11 +3,52 @@ #include "decomp.h" #include "isleactor.h" +#include "legostate.h" class Act1State; -class PizzaMissionState; class SkateBoard; +// VTABLE: LEGO1 0x100d7408 +// SIZE 0xb0 +class PizzaMissionState : public LegoState { +public: + // SIZE 0x20 + struct Entry { + public: + undefined2 m_unk0x00; // 0x00 + MxU8 m_id; // 0x02 + undefined m_unk0x03[0x15]; // 0x03 + MxU16 m_score; // 0x18 + undefined m_unk0x18[6]; // 0x1a + }; + + // FUNCTION: LEGO1 0x10039290 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f00d4 + return "PizzaMissionState"; + } + + // FUNCTION: LEGO1 0x100392a0 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, PizzaMissionState::ClassName()) || LegoState::IsA(p_name); + } + + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + inline MxU16 GetScore(MxU8 p_id) { return GetState(p_id)->m_score; } + + // SYNTHETIC: LEGO1 0x10039350 + // PizzaMissionState::`scalar deleting destructor' + + Entry* GetState(MxU8 p_id); + + undefined4 m_unk0x08; // 0x08 + undefined4 m_unk0x0c; // 0x0c + Entry m_state[5]; // 0x10 +}; + // VTABLE: LEGO1 0x100d7380 // SIZE 0x9c class Pizza : public IsleActor { diff --git a/LEGO1/lego/legoomni/include/pizzamissionstate.h b/LEGO1/lego/legoomni/include/pizzamissionstate.h deleted file mode 100644 index c74ea4b1..00000000 --- a/LEGO1/lego/legoomni/include/pizzamissionstate.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef PIZZAMISSIONSTATE_H -#define PIZZAMISSIONSTATE_H - -#include "legostate.h" - -// SIZE 0x20 -struct PizzaMissionStateEntry { -public: - undefined2 m_unk0x00; // 0x00 - MxU8 m_id; // 0x02 - undefined m_unk0x03[0x15]; // 0x03 - MxU16 m_score; // 0x18 - undefined m_unk0x18[6]; // 0x1a -}; - -// VTABLE: LEGO1 0x100d7408 -// SIZE 0xb0 -class PizzaMissionState : public LegoState { -public: - // FUNCTION: LEGO1 0x10039290 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f00d4 - return "PizzaMissionState"; - } - - // FUNCTION: LEGO1 0x100392a0 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, PizzaMissionState::ClassName()) || LegoState::IsA(p_name); - } - - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - inline MxU16 GetScore(MxU8 p_id) { return GetState(p_id)->m_score; } - - // SYNTHETIC: LEGO1 0x10039350 - // PizzaMissionState::`scalar deleting destructor' - - PizzaMissionStateEntry* GetState(MxU8 p_id); - - undefined4 m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c - PizzaMissionStateEntry m_state[5]; // 0x10 -}; - -#endif // PIZZAMISSIONSTATE_H diff --git a/LEGO1/lego/legoomni/include/pizzeria.h b/LEGO1/lego/legoomni/include/pizzeria.h index 91f76f46..46150249 100644 --- a/LEGO1/lego/legoomni/include/pizzeria.h +++ b/LEGO1/lego/legoomni/include/pizzeria.h @@ -3,10 +3,51 @@ #include "decomp.h" #include "isleactor.h" +#include "legostate.h" -class PizzeriaState; class PizzaMissionState; +// VTABLE: LEGO1 0x100d5ee8 +// SIZE 0x58 +class PizzeriaState : public LegoState { +public: + // SIZE 0x14 + struct StateStruct { + undefined4 m_unk0x00; // 0x00 + undefined4 m_unk0x04; // 0x04 + undefined4 m_unk0x08; // 0x08 + undefined4 m_unk0x0c; // 0x0c + undefined4 m_unk0x10; // 0x10 + }; + + PizzeriaState(); + + // FUNCTION: LEGO1 0x10017c20 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0370 + return "PizzeriaState"; + } + + // FUNCTION: LEGO1 0x10017c30 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, PizzeriaState::ClassName()) || LegoState::IsA(p_name); + } + + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + // SYNTHETIC: LEGO1 0x10017ce0 + // PizzeriaState::`scalar deleting destructor' + + MxU32 FUN_10017d70(); + + // TODO: Most likely getters/setters are not used according to BETA. + + Playlist m_unk0x08[5]; // 0x08 + StateStruct m_unk0x44; // 0x44 +}; + // VTABLE: LEGO1 0x100d5520 // SIZE 0x84 class Pizzeria : public IsleActor { diff --git a/LEGO1/lego/legoomni/include/pizzeriastate.h b/LEGO1/lego/legoomni/include/pizzeriastate.h deleted file mode 100644 index 6bed2aad..00000000 --- a/LEGO1/lego/legoomni/include/pizzeriastate.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef PIZZERIASTATE_H -#define PIZZERIASTATE_H - -#include "legostate.h" - -// SIZE 0x14 -struct PizzeriaStateStruct { - undefined4 m_unk0x00; // 0x00 - undefined4 m_unk0x04; // 0x04 - undefined4 m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c - undefined4 m_unk0x10; // 0x10 -}; - -// VTABLE: LEGO1 0x100d5ee8 -// SIZE 0x58 -class PizzeriaState : public LegoState { -public: - PizzeriaState(); - - // FUNCTION: LEGO1 0x10017c20 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0370 - return "PizzeriaState"; - } - - // FUNCTION: LEGO1 0x10017c30 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, PizzeriaState::ClassName()) || LegoState::IsA(p_name); - } - - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - // SYNTHETIC: LEGO1 0x10017ce0 - // PizzeriaState::`scalar deleting destructor' - - MxU32 FUN_10017d70(); - -private: - Playlist m_unk0x08[5]; // 0x08 - PizzeriaStateStruct m_unk0x44; // 0x44 -}; - -#endif // PIZZERIASTATE_H diff --git a/LEGO1/lego/legoomni/include/police.h b/LEGO1/lego/legoomni/include/police.h index 67c3586a..4c8c34eb 100644 --- a/LEGO1/lego/legoomni/include/police.h +++ b/LEGO1/lego/legoomni/include/police.h @@ -3,13 +3,49 @@ #include "decomp.h" #include "legogamestate.h" +#include "legostate.h" #include "legoworld.h" #include "radio.h" class LegoControlManagerEvent; class LegoEventNotificationParam; class MxDSAction; -class PoliceState; + +// VTABLE: LEGO1 0x100d8af0 +// SIZE 0x10 +class PoliceState : public LegoState { +public: + PoliceState(); + ~PoliceState() override {} + + // FUNCTION: LEGO1 0x1005e860 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0444 + return "PoliceState"; + } + + // FUNCTION: LEGO1 0x1005e870 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, PoliceState::ClassName()) || LegoState::IsA(p_name); + } + + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + // SYNTHETIC: LEGO1 0x1005e920 + // PoliceState::`scalar deleting destructor' + + inline undefined4 GetUnknown0x0c() { return m_unk0x0c; } + inline void SetUnknown0x0c(undefined4 p_unk0x0c) { m_unk0x0c = p_unk0x0c; } + + void FUN_1005ea40(); + + // TODO: Most likely getters/setters are not used according to BETA. + + PoliceScript::Script m_policeScript; // 0x08 + undefined4 m_unk0x0c; // 0x0c +}; // VTABLE: LEGO1 0x100d8a80 // SIZE 0x110 diff --git a/LEGO1/lego/legoomni/include/policeentity.h b/LEGO1/lego/legoomni/include/policeentity.h deleted file mode 100644 index 48156150..00000000 --- a/LEGO1/lego/legoomni/include/policeentity.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef POLICEENTITY_H -#define POLICEENTITY_H - -#include "buildingentity.h" - -// VTABLE: LEGO1 0x100d4ab0 -// SIZE 0x68 -class PoliceEntity : public BuildingEntity { -public: - // FUNCTION: LEGO1 0x1000ed60 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0328 - return "PoliceEntity"; - } - - // FUNCTION: LEGO1 0x1000ed70 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, PoliceEntity::ClassName()) || BuildingEntity::IsA(p_name); - } - - MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 - - // SYNTHETIC: LEGO1 0x1000f900 - // PoliceEntity::`scalar deleting destructor' -}; - -#endif // POLICEENTITY_H diff --git a/LEGO1/lego/legoomni/include/policestate.h b/LEGO1/lego/legoomni/include/policestate.h deleted file mode 100644 index 75970729..00000000 --- a/LEGO1/lego/legoomni/include/policestate.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef POLICESTATE_H -#define POLICESTATE_H - -#include "actionsfwd.h" -#include "decomp.h" -#include "legostate.h" - -// VTABLE: LEGO1 0x100d8af0 -// SIZE 0x10 -class PoliceState : public LegoState { -public: - PoliceState(); - ~PoliceState() override {} - - // FUNCTION: LEGO1 0x1005e860 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0444 - return "PoliceState"; - } - - // FUNCTION: LEGO1 0x1005e870 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, PoliceState::ClassName()) || LegoState::IsA(p_name); - } - - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - // SYNTHETIC: LEGO1 0x1005e920 - // PoliceState::`scalar deleting destructor' - - inline undefined4 GetUnknown0x0c() { return m_unk0x0c; } - inline void SetUnknown0x0c(undefined4 p_unk0x0c) { m_unk0x0c = p_unk0x0c; } - - void FUN_1005ea40(); - -private: - PoliceScript::Script m_policeScript; // 0x08 - undefined4 m_unk0x0c; // 0x0c -}; - -#endif // POLICESTATE_H diff --git a/LEGO1/lego/legoomni/include/racestandsentity.h b/LEGO1/lego/legoomni/include/racestandsentity.h deleted file mode 100644 index 22bc4dd2..00000000 --- a/LEGO1/lego/legoomni/include/racestandsentity.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef RACESTANDSENTITY_H -#define RACESTANDSENTITY_H - -#include "buildingentity.h" - -// VTABLE: LEGO1 0x100d48a8 -// SIZE 0x68 -class RaceStandsEntity : public BuildingEntity { - // FUNCTION: LEGO1 0x1000efa0 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0300 - return "RaceStandsEntity"; - } - - // FUNCTION: LEGO1 0x1000efb0 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, RaceStandsEntity::ClassName()) || BuildingEntity::IsA(p_name); - } - - MxLong VTable0x50(MxParam& p_param) override; - - // SYNTHETIC: LEGO1 0x1000f9e0 - // RaceStandsEntity::`scalar deleting destructor' -}; - -#endif // RACESTANDSENTITY_H diff --git a/LEGO1/lego/legoomni/include/racestate.h b/LEGO1/lego/legoomni/include/racestate.h deleted file mode 100644 index e2321be1..00000000 --- a/LEGO1/lego/legoomni/include/racestate.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef RACESTATE_H -#define RACESTATE_H - -#include "legostate.h" - -// SIZE 0x06 -struct RaceStateEntry { -public: - inline MxS16 GetUnknown0x02() { return m_unk0x02; } - inline MxU16 GetScore() { return m_score; } - - // TODO: Possibly private - MxU8 m_id; // 0x00 - MxS16 m_unk0x02; // 0x02 - MxU16 m_score; // 0x04 -}; - -// VTABLE: LEGO1 0x100d5e30 -// SIZE 0x2c -class RaceState : public LegoState { -public: - RaceState(); - - // FUNCTION: LEGO1 0x10016010 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f07d0 - return "RaceState"; - } - - // FUNCTION: LEGO1 0x10016020 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, RaceState::ClassName()) || LegoState::IsA(p_name); - } - - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - RaceStateEntry* GetState(MxU8 p_id); - - inline undefined4 GetUnknown0x28() { return m_unk0x28; } - - // SYNTHETIC: LEGO1 0x1000f6f0 - // RaceState::~RaceState - - // SYNTHETIC: LEGO1 0x100160d0 - // RaceState::`scalar deleting destructor' - -protected: - RaceStateEntry m_state[5]; // 0x08 - undefined4 m_unk0x28; // 0x28 -}; - -#endif // RACESTATE_H diff --git a/LEGO1/lego/legoomni/include/radio.h b/LEGO1/lego/legoomni/include/radio.h index 997c6579..cd411036 100644 --- a/LEGO1/lego/legoomni/include/radio.h +++ b/LEGO1/lego/legoomni/include/radio.h @@ -1,11 +1,50 @@ #ifndef RADIO_H #define RADIO_H +#include "legostate.h" #include "mxcore.h" class LegoControlManagerEvent; +class MxAtomId; class MxEndActionNotificationParam; -class RadioState; + +// VTABLE: LEGO1 0x100d6d28 +// SIZE 0x30 +class RadioState : public LegoState { +public: + RadioState(); + + // FUNCTION: LEGO1 0x1002cf60 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f04f8 + return "RadioState"; + } + + // FUNCTION: LEGO1 0x1002cf70 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, RadioState::ClassName()) || LegoState::IsA(p_name); + } + + MxBool IsSerializable() override; // vtable+0x14 + + // SYNTHETIC: LEGO1 0x1002d020 + // RadioState::`scalar deleting destructor' + + inline MxBool IsActive() { return m_active; } + + inline void SetActive(MxBool p_active) { m_active = p_active; } + + undefined4 FUN_1002d090(); + MxBool FUN_1002d0c0(const MxAtomId& p_atom, MxU32 p_objectId); + + // TODO: Most likely getters/setters are not used according to BETA. + + Playlist m_unk0x08[3]; // 0x08 + MxS16 m_unk0x2c; // 0x2c + MxBool m_active; // 0x2e +}; // VTABLE: LEGO1 0x100d6d10 // SIZE 0x10 diff --git a/LEGO1/lego/legoomni/include/radiostate.h b/LEGO1/lego/legoomni/include/radiostate.h deleted file mode 100644 index e0c0066c..00000000 --- a/LEGO1/lego/legoomni/include/radiostate.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef RADIOSTATE_H -#define RADIOSTATE_H - -#include "legostate.h" - -class MxAtomId; - -// VTABLE: LEGO1 0x100d6d28 -// SIZE 0x30 -class RadioState : public LegoState { -public: - RadioState(); - - // FUNCTION: LEGO1 0x1002cf60 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f04f8 - return "RadioState"; - } - - // FUNCTION: LEGO1 0x1002cf70 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, RadioState::ClassName()) || LegoState::IsA(p_name); - } - - MxBool IsSerializable() override; // vtable+0x14 - - // SYNTHETIC: LEGO1 0x1002d020 - // RadioState::`scalar deleting destructor' - - inline MxBool IsActive() { return m_active; } - - inline void SetActive(MxBool p_active) { m_active = p_active; } - - undefined4 FUN_1002d090(); - MxBool FUN_1002d0c0(const MxAtomId& p_atom, MxU32 p_objectId); - -private: - Playlist m_unk0x08[3]; // 0x08 - MxS16 m_unk0x2c; // 0x2c - MxBool m_active; // 0x2e -}; - -#endif // RADIOSTATE_H diff --git a/LEGO1/lego/legoomni/include/score.h b/LEGO1/lego/legoomni/include/score.h index 979fa33d..76a4ac8e 100644 --- a/LEGO1/lego/legoomni/include/score.h +++ b/LEGO1/lego/legoomni/include/score.h @@ -2,11 +2,49 @@ #define SCORE_H #include "legogamestate.h" +#include "legostate.h" #include "legoworld.h" class LegoControlManagerEvent; class MxEndActionNotificationParam; -class ScoreState; + +// VTABLE: LEGO1 0x100d53f8 +// SIZE 0x0c +class ScoreState : public LegoState { +public: + // FUNCTION: LEGO1 0x1000de40 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0084 + return "ScoreState"; + } + + // FUNCTION: LEGO1 0x1000de50 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, ScoreState::ClassName()) || LegoState::IsA(p_name); + } + + // FUNCTION: LEGO1 0x1000de20 + MxBool IsSerializable() override { return FALSE; } // vtable+0x14 + + // FUNCTION: LEGO1 0x1000de30 + MxBool SetFlag() override + { + m_playCubeTutorial = TRUE; + return TRUE; + } // vtable+0x18 + + inline MxBool GetTutorialFlag() { return m_playCubeTutorial; } + inline void SetTutorialFlag(MxBool p_playCubeTutorial) { m_playCubeTutorial = p_playCubeTutorial; } + + // SYNTHETIC: LEGO1 0x1000df00 + // ScoreState::`scalar deleting destructor' + + // TODO: Most likely getters/setters are not used according to BETA. + + MxBool m_playCubeTutorial; // 0x08 +}; // VTABLE: LEGO1 0x100d4018 // SIZE 0x104 diff --git a/LEGO1/lego/legoomni/include/scorestate.h b/LEGO1/lego/legoomni/include/scorestate.h deleted file mode 100644 index ac651a19..00000000 --- a/LEGO1/lego/legoomni/include/scorestate.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef SCORESTATE_H -#define SCORESTATE_H - -#include "legostate.h" - -// VTABLE: LEGO1 0x100d53f8 -// SIZE 0x0c -class ScoreState : public LegoState { -public: - // FUNCTION: LEGO1 0x1000de40 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f0084 - return "ScoreState"; - } - - // FUNCTION: LEGO1 0x1000de50 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, ScoreState::ClassName()) || LegoState::IsA(p_name); - } - - MxBool IsSerializable() override; // vtable+0x14 - MxBool SetFlag() override; // vtable+0x18 - - inline MxBool GetTutorialFlag() { return m_playCubeTutorial; } - inline void SetTutorialFlag(MxBool p_playCubeTutorial) { m_playCubeTutorial = p_playCubeTutorial; } - - // SYNTHETIC: LEGO1 0x1000df00 - // ScoreState::`scalar deleting destructor' - -private: - MxBool m_playCubeTutorial; // 0x08 -}; - -#endif // SCORESTATE_H diff --git a/LEGO1/lego/legoomni/include/towtrack.h b/LEGO1/lego/legoomni/include/towtrack.h index 4f4f1bb5..a8738cbf 100644 --- a/LEGO1/lego/legoomni/include/towtrack.h +++ b/LEGO1/lego/legoomni/include/towtrack.h @@ -3,8 +3,64 @@ #include "decomp.h" #include "islepathactor.h" +#include "legostate.h" -class TowTrackMissionState; +// VTABLE: LEGO1 0x100d7fd8 +// SIZE 0x28 +class TowTrackMissionState : public LegoState { +public: + TowTrackMissionState(); + + // FUNCTION: LEGO1 0x1004dfa0 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f00bc + return "TowTrackMissionState"; + } + + // FUNCTION: LEGO1 0x1004dfb0 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, TowTrackMissionState::ClassName()) || LegoState::IsA(p_name); + } + + MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + + inline MxU16 GetScore(MxU8 p_id) + { + switch (p_id) { + case 1: + return m_score1; + case 2: + return m_score2; + case 3: + return m_score3; + case 4: + return m_score4; + case 5: + return m_score5; + default: + return 0; + } + } + + // SYNTHETIC: LEGO1 0x1004e060 + // TowTrackMissionState::`scalar deleting destructor' + + undefined4 m_unk0x08; // 0x08 + undefined4 m_unk0x0c; // 0x0c + MxU8 m_unk0x10; // 0x10 + MxU16 m_unk0x12; // 0x12 + MxU16 m_unk0x14; // 0x14 + MxU16 m_unk0x16; // 0x16 + MxU16 m_unk0x18; // 0x18 + MxU16 m_unk0x1a; // 0x1a + MxU16 m_score1; // 0x1c + MxU16 m_score2; // 0x1e + MxU16 m_score3; // 0x20 + MxU16 m_score4; // 0x22 + MxU16 m_score5; // 0x24 +}; // VTABLE: LEGO1 0x100d7ee0 // SIZE 0x180 diff --git a/LEGO1/lego/legoomni/include/towtrackmissionstate.h b/LEGO1/lego/legoomni/include/towtrackmissionstate.h deleted file mode 100644 index 5a684011..00000000 --- a/LEGO1/lego/legoomni/include/towtrackmissionstate.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef TOWTRACKMISSIONSTATE_H -#define TOWTRACKMISSIONSTATE_H - -#include "legostate.h" - -// VTABLE: LEGO1 0x100d7fd8 -// SIZE 0x28 -class TowTrackMissionState : public LegoState { -public: - TowTrackMissionState(); - - // FUNCTION: LEGO1 0x1004dfa0 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f00bc - return "TowTrackMissionState"; - } - - // FUNCTION: LEGO1 0x1004dfb0 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, TowTrackMissionState::ClassName()) || LegoState::IsA(p_name); - } - - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - - inline MxU16 GetScore(MxU8 p_id) - { - switch (p_id) { - case 1: - return m_score1; - case 2: - return m_score2; - case 3: - return m_score3; - case 4: - return m_score4; - case 5: - return m_score5; - default: - return 0; - } - } - - // SYNTHETIC: LEGO1 0x1004e060 - // TowTrackMissionState::`scalar deleting destructor' - - undefined4 m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c - MxU8 m_unk0x10; // 0x10 - MxU16 m_unk0x12; // 0x12 - MxU16 m_unk0x14; // 0x14 - MxU16 m_unk0x16; // 0x16 - MxU16 m_unk0x18; // 0x18 - MxU16 m_unk0x1a; // 0x1a - MxU16 m_score1; // 0x1c - MxU16 m_score2; // 0x1e - MxU16 m_score3; // 0x20 - MxU16 m_score4; // 0x22 - MxU16 m_score5; // 0x24 -}; - -#endif // TOWTRACKMISSIONSTATE_H diff --git a/LEGO1/lego/legoomni/src/act1/act1state.cpp b/LEGO1/lego/legoomni/src/act1/act1state.cpp deleted file mode 100644 index 013347d3..00000000 --- a/LEGO1/lego/legoomni/src/act1/act1state.cpp +++ /dev/null @@ -1,296 +0,0 @@ -#include "act1state.h" - -#include "legonamedtexture.h" -#include "legoutils.h" - -DECOMP_SIZE_ASSERT(Act1State, 0x26c) -DECOMP_SIZE_ASSERT(Act1State::NamedPlane, 0x4c) - -// GLOBAL: ISLE 0x100f37f0 -MxS32 g_unk0x100f37f0[] = { - Act1State::e_unk953, - Act1State::e_unk954, - Act1State::e_unk955, -}; - -extern MxAtomId* g_isleScript; - -// STUB: LEGO1 0x100334b0 -Act1State::Act1State() : m_unk0x00c(0), m_unk0x00e(0), m_unk0x008(NULL), m_unk0x010(0) -{ - m_unk0x01e = FALSE; - m_unk0x018 = 1; - m_unk0x010 = 0; - m_planeActive = FALSE; - m_unk0x00e = 0; - m_unk0x01f = FALSE; - m_unk0x008 = g_unk0x100f37f0; - m_unk0x014 = -1; - m_unk0x022 = FALSE; - m_unk0x154 = NULL; - m_unk0x158 = NULL; - m_unk0x15c = NULL; - m_unk0x160 = NULL; - m_unk0x1b0 = NULL; - m_unk0x021 = 1; - m_elevFloor = Act1State::c_floor1; - m_unk0x00c = sizeOfArray(g_unk0x100f37f0); - m_unk0x1b4 = NULL; - m_unk0x1b8 = NULL; - m_unk0x208 = NULL; - m_unk0x20c = NULL; - m_unk0x25c = NULL; - m_unk0x260 = NULL; - m_unk0x264 = NULL; - m_unk0x268 = NULL; - SetFlag(); -} - -// FUNCTION: LEGO1 0x10033ac0 -MxResult Act1State::Serialize(LegoFile* p_legoFile) -{ - LegoState::Serialize(p_legoFile); - - m_unk0x024.Serialize(p_legoFile); - m_unk0x070.Serialize(p_legoFile); - m_unk0x0bc.Serialize(p_legoFile); - m_unk0x108.Serialize(p_legoFile); - m_unk0x164.Serialize(p_legoFile); - m_unk0x1bc.Serialize(p_legoFile); - m_unk0x210.Serialize(p_legoFile); - - if (p_legoFile->IsWriteMode()) { - if (m_unk0x108.GetName()->Compare("") != 0) { - if (m_unk0x154) { - WriteNamedTexture(p_legoFile, m_unk0x154); - } - else { - FUN_1003f540(p_legoFile, "chwind.gif"); - } - if (m_unk0x158) { - WriteNamedTexture(p_legoFile, m_unk0x158); - } - else { - FUN_1003f540(p_legoFile, "chjetl.gif"); - } - if (m_unk0x15c) { - WriteNamedTexture(p_legoFile, m_unk0x15c); - } - else { - FUN_1003f540(p_legoFile, "chjetr.gif"); - } - } - if (m_unk0x164.GetName()->Compare("") != 0) { - if (m_unk0x1b0) { - WriteNamedTexture(p_legoFile, m_unk0x1b0); - } - else { - FUN_1003f540(p_legoFile, "jsfrnt.gif"); - } - if (m_unk0x1b4) { - WriteNamedTexture(p_legoFile, m_unk0x1b4); - } - else { - FUN_1003f540(p_legoFile, "jswnsh.gif"); - } - } - if (m_unk0x1bc.GetName()->Compare("") != 0) { - if (m_unk0x208) { - WriteNamedTexture(p_legoFile, m_unk0x208); - } - else { - FUN_1003f540(p_legoFile, "dbfrfn.gif"); - } - } - if (m_unk0x210.GetName()->Compare("") != 0) { - if (m_unk0x25c) { - WriteNamedTexture(p_legoFile, m_unk0x25c); - } - else { - FUN_1003f540(p_legoFile, "rcfrnt.gif"); - } - if (m_unk0x260) { - WriteNamedTexture(p_legoFile, m_unk0x260); - } - else { - FUN_1003f540(p_legoFile, "rcback.gif"); - } - if (m_unk0x264) { - WriteNamedTexture(p_legoFile, m_unk0x264); - } - else { - FUN_1003f540(p_legoFile, "rctail.gif"); - } - } - - p_legoFile->Write(&m_unk0x010, sizeof(m_unk0x010)); - p_legoFile->Write(&m_unk0x022, sizeof(m_unk0x022)); - } - else if (p_legoFile->IsReadMode()) { - if (m_unk0x108.GetName()->Compare("") != 0) { - m_unk0x154 = ReadNamedTexture(p_legoFile); - if (m_unk0x154 == NULL) { - return FAILURE; - } - - m_unk0x158 = ReadNamedTexture(p_legoFile); - if (m_unk0x158 == NULL) { - return FAILURE; - } - - m_unk0x15c = ReadNamedTexture(p_legoFile); - if (m_unk0x15c == NULL) { - return FAILURE; - } - } - if (m_unk0x164.GetName()->Compare("") != 0) { - m_unk0x1b0 = ReadNamedTexture(p_legoFile); - if (m_unk0x1b0 == NULL) { - return FAILURE; - } - - m_unk0x1b4 = ReadNamedTexture(p_legoFile); - if (m_unk0x1b4 == NULL) { - return FAILURE; - } - } - if (m_unk0x1bc.GetName()->Compare("") != 0) { - m_unk0x208 = ReadNamedTexture(p_legoFile); - if (m_unk0x208 == NULL) { - return FAILURE; - } - } - if (m_unk0x210.GetName()->Compare("") != 0) { - m_unk0x25c = ReadNamedTexture(p_legoFile); - if (m_unk0x25c == NULL) { - return FAILURE; - } - - m_unk0x260 = ReadNamedTexture(p_legoFile); - if (m_unk0x260 == NULL) { - return FAILURE; - } - - m_unk0x264 = ReadNamedTexture(p_legoFile); - if (m_unk0x264 == NULL) { - return FAILURE; - } - } - - p_legoFile->Read(&m_unk0x010, sizeof(m_unk0x010)); - p_legoFile->Read(&m_unk0x022, sizeof(m_unk0x022)); - } - - // TODO - return SUCCESS; -} - -// STUB: LEGO1 0x10034660 -void Act1State::FUN_10034660() -{ - // TODO -} - -// FUNCTION: LEGO1 0x100346a0 -void Act1State::FUN_100346a0() -{ - if (m_unk0x014 != -1) { - InvokeAction(Extra::e_stop, *g_isleScript, m_unk0x014, NULL); - m_unk0x014 = -1; - } -} - -// FUNCTION: LEGO1 0x100346d0 -MxBool Act1State::SetFlag() -{ - m_unk0x024.SetName(""); - m_unk0x070.SetName(""); - m_unk0x0bc.SetName(""); - m_unk0x022 = FALSE; - m_unk0x108.SetName(""); - - if (m_unk0x154) { - delete m_unk0x154; - m_unk0x154 = NULL; - } - - if (m_unk0x158) { - delete m_unk0x158; - m_unk0x158 = NULL; - } - - if (m_unk0x15c) { - delete m_unk0x15c; - m_unk0x15c = NULL; - } - - if (m_unk0x160) { - delete m_unk0x160; - m_unk0x160 = NULL; - } - - m_unk0x164.SetName(""); - - if (m_unk0x1b0) { - delete m_unk0x1b0; - m_unk0x1b0 = NULL; - } - - if (m_unk0x1b4) { - delete m_unk0x1b4; - m_unk0x1b4 = NULL; - } - - if (m_unk0x1b8) { - delete m_unk0x1b8; - m_unk0x1b8 = NULL; - } - - m_unk0x1bc.SetName(""); - - if (m_unk0x208) { - delete m_unk0x208; - m_unk0x208 = NULL; - } - - if (m_unk0x20c) { - delete m_unk0x20c; - m_unk0x20c = NULL; - } - - m_unk0x210.SetName(""); - - if (m_unk0x25c) { - delete m_unk0x25c; - m_unk0x25c = NULL; - } - - if (m_unk0x260) { - delete m_unk0x260; - m_unk0x260 = NULL; - } - - if (m_unk0x264) { - delete m_unk0x264; - m_unk0x264 = NULL; - } - - if (m_unk0x268) { - delete m_unk0x268; - m_unk0x268 = NULL; - } - - return TRUE; -} - -// STUB: LEGO1 0x10034b60 -void Act1State::FUN_10034b60() -{ - // TODO -} - -// STUB: LEGO1 0x10034d00 -void Act1State::FUN_10034d00() -{ - // TODO -} diff --git a/LEGO1/lego/legoomni/src/act2/legoact2state.cpp b/LEGO1/lego/legoomni/src/act2/legoact2state.cpp deleted file mode 100644 index 955de04e..00000000 --- a/LEGO1/lego/legoomni/src/act2/legoact2state.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "legoact2state.h" - -DECOMP_SIZE_ASSERT(LegoAct2State, 0x10) - -// FUNCTION: LEGO1 0x1000df70 -MxBool LegoAct2State::IsSerializable() -{ - return FALSE; -} diff --git a/LEGO1/lego/legoomni/src/act3/act3state.cpp b/LEGO1/lego/legoomni/src/act3/act3state.cpp deleted file mode 100644 index de1bac5f..00000000 --- a/LEGO1/lego/legoomni/src/act3/act3state.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "act3state.h" - -DECOMP_SIZE_ASSERT(Act3State, 0x0c) - -// FUNCTION: LEGO1 0x1000e2f0 -MxBool Act3State::IsSerializable() -{ - return FALSE; -} diff --git a/LEGO1/lego/legoomni/src/act3/act3shark.cpp b/LEGO1/lego/legoomni/src/actors/act3shark.cpp similarity index 100% rename from LEGO1/lego/legoomni/src/act3/act3shark.cpp rename to LEGO1/lego/legoomni/src/actors/act3shark.cpp diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index 2d293972..1a15d7c8 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -1,6 +1,5 @@ #include "ambulance.h" -#include "ambulancemissionstate.h" #include "decomp.h" #include "legocontrolmanager.h" #include "legogamestate.h" @@ -14,6 +13,7 @@ #include "scripts.h" DECOMP_SIZE_ASSERT(Ambulance, 0x184) +DECOMP_SIZE_ASSERT(AmbulanceMissionState, 0x24) // FUNCTION: LEGO1 0x10035ee0 Ambulance::Ambulance() @@ -152,3 +152,27 @@ void Ambulance::FUN_10037250() { // TODO } + +// FUNCTION: LEGO1 0x100373a0 +AmbulanceMissionState::AmbulanceMissionState() +{ + m_unk0x10 = 0; + m_unk0x12 = 0; + m_unk0x14 = 0; + m_unk0x08 = 0; + m_unk0x16 = 0; + m_unk0x0c = 0; + m_unk0x18 = 0; + m_score1 = 0; + m_score2 = 0; + m_score3 = 0; + m_score4 = 0; + m_score5 = 0; +} + +// STUB: LEGO1 0x10037440 +MxResult AmbulanceMissionState::Serialize(LegoFile* p_legoFile) +{ + // TODO + return LegoState::Serialize(p_legoFile); +} diff --git a/LEGO1/lego/legoomni/src/actors/buildings.cpp b/LEGO1/lego/legoomni/src/actors/buildings.cpp new file mode 100644 index 00000000..9c3c174b --- /dev/null +++ b/LEGO1/lego/legoomni/src/actors/buildings.cpp @@ -0,0 +1,176 @@ +#include "buildings.h" + +#include "act2main_actions.h" +#include "act3.h" +#include "act3_actions.h" +#include "isle.h" +#include "isle_actions.h" +#include "islepathactor.h" +#include "legoact2.h" +#include "legoanimationmanager.h" +#include "legogamestate.h" +#include "legoutils.h" +#include "legoworld.h" +#include "misc.h" +#include "mxtransitionmanager.h" +#include "scripts.h" + +DECOMP_SIZE_ASSERT(BeachHouseEntity, 0x68) +DECOMP_SIZE_ASSERT(GasStationEntity, 0x68) +DECOMP_SIZE_ASSERT(HospitalEntity, 0x68) +DECOMP_SIZE_ASSERT(InfoCenterEntity, 0x68) +DECOMP_SIZE_ASSERT(JailEntity, 0x68) +DECOMP_SIZE_ASSERT(PoliceEntity, 0x68) +DECOMP_SIZE_ASSERT(RaceStandsEntity, 0x68) + +// FUNCTION: LEGO1 0x100150c0 +MxLong InfoCenterEntity::VTable0x50(MxParam& p_param) +{ + switch (GameState()->GetCurrentAct()) { + case LegoGameState::Act::e_act1: { + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) CurrentActor())->VTable0xe4(); + } + + Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); + isle->FUN_10033350(); + isle->SetDestLocation(LegoGameState::Area::e_infomain); + + Act1State* act1state = (Act1State*) GameState()->GetState("Act1State"); + act1state->SetUnknown18(0); + break; + } + case LegoGameState::Act::e_act2: { + LegoAct2* act2 = (LegoAct2*) FindWorld(*g_act2mainScript, Act2mainScript::c__Act2Main); + act2->SetUnknown0x1150(2); + + LegoAct2State* act2state = (LegoAct2State*) GameState()->GetState("LegoAct2State"); + if (act2state) { + act2state->SetUnknown0x0c(0); + } + break; + } + case LegoGameState::Act::e_act3: + Act3* act3 = (Act3*) FindWorld(*g_act3Script, Act3Script::c__Act3); + act3->SetUnknown4270(2); + break; + } + + AnimationManager()->FUN_10061010(FALSE); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + return 1; +} + +// FUNCTION: LEGO1 0x100151d0 +MxLong GasStationEntity::VTable0x50(MxParam& p_param) +{ + if (FUN_1003ef60()) { + Act1State* state = (Act1State*) GameState()->GetState("Act1State"); + + if (state->GetUnknown18() != 8) { + state->SetUnknown18(0); + + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) CurrentActor())->VTable0xe4(); + } + + Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); + isle->SetDestLocation(LegoGameState::Area::e_garage); + + AnimationManager()->FUN_10061010(FALSE); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + } + } + + return 1; +} + +// FUNCTION: LEGO1 0x10015270 +MxLong HospitalEntity::VTable0x50(MxParam& p_param) +{ + if (FUN_1003ef60()) { + Act1State* act1State = (Act1State*) GameState()->GetState("Act1State"); + + if (act1State->GetUnknown18() != 10) { + act1State->SetUnknown18(0); + + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) CurrentActor())->VTable0xe4(); + } + + Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); + isle->SetDestLocation(LegoGameState::Area::e_hospital); + + AnimationManager()->FUN_10061010(FALSE); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + } + } + + return 1; +} + +// FUNCTION: LEGO1 0x10015310 +MxLong PoliceEntity::VTable0x50(MxParam& p_param) +{ + if (FUN_1003ef60()) { + Act1State* state = (Act1State*) GameState()->GetState("Act1State"); + + if (state->GetUnknown18() != 10) { + state->SetUnknown18(0); + + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) CurrentActor())->VTable0xe4(); + } + + Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); + isle->SetDestLocation(LegoGameState::Area::e_police); + + AnimationManager()->FUN_10061010(FALSE); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + } + } + + return 1; +} + +// FUNCTION: LEGO1 0x100153b0 +MxLong BeachHouseEntity::VTable0x50(MxParam& p_param) +{ + if (FUN_1003ef60()) { + Act1State* state = (Act1State*) GameState()->GetState("Act1State"); + state->SetUnknown18(0); + + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) CurrentActor())->VTable0xe4(); + } + + Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); + isle->SetDestLocation(LegoGameState::Area::e_jetskibuild); + + AnimationManager()->FUN_10061010(FALSE); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + } + + return 1; +} + +// FUNCTION: LEGO1 0x10015450 +MxLong RaceStandsEntity::VTable0x50(MxParam& p_param) +{ + if (FUN_1003ef60()) { + Act1State* state = (Act1State*) GameState()->GetState("Act1State"); + state->SetUnknown18(0); + + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) CurrentActor())->VTable0xe4(); + } + + Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); + isle->SetDestLocation(LegoGameState::Area::e_racecarbuild); + + AnimationManager()->FUN_10061010(FALSE); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + } + + return 1; +} diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index dee0a47b..1b765b2b 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -1,9 +1,7 @@ #include "helicopter.h" -#include "act1state.h" #include "act3.h" #include "act3_actions.h" -#include "helicopterstate.h" #include "isle.h" #include "isle_actions.h" #include "jukebox.h" @@ -19,6 +17,7 @@ #include "scripts.h" DECOMP_SIZE_ASSERT(Helicopter, 0x230) +DECOMP_SIZE_ASSERT(HelicopterState, 0x0c) DECOMP_SIZE_ASSERT(Mx3DPointFloat, 0x14) DECOMP_SIZE_ASSERT(Mx4DPointFloat, 0x18) DECOMP_SIZE_ASSERT(MxMatrix, 0x48) diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index e526384e..0f8da9e7 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -4,10 +4,10 @@ #include "isle_actions.h" #include "jukebox_actions.h" #include "legoanimationmanager.h" +#include "legocarbuild.h" #include "legonavcontroller.h" #include "legopathboundary.h" #include "legoutils.h" -#include "legovehiclebuildstate.h" #include "legovideomanager.h" #include "legoworld.h" #include "misc.h" diff --git a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp index f4e2af0a..340ea64d 100644 --- a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp +++ b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp @@ -3,8 +3,8 @@ #include "isle.h" #include "isle_actions.h" #include "islepathactor.h" +#include "jukebox.h" #include "jukebox_actions.h" -#include "jukeboxstate.h" #include "legogamestate.h" #include "legoutils.h" #include "misc.h" diff --git a/LEGO1/lego/legoomni/src/actors/pizza.cpp b/LEGO1/lego/legoomni/src/actors/pizza.cpp index 9185de23..43ef2ddb 100644 --- a/LEGO1/lego/legoomni/src/actors/pizza.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizza.cpp @@ -1,15 +1,15 @@ #include "pizza.h" -#include "act1state.h" #include "isle_actions.h" #include "legogamestate.h" #include "legoworld.h" #include "misc.h" #include "mxmisc.h" #include "mxticklemanager.h" -#include "pizzamissionstate.h" DECOMP_SIZE_ASSERT(Pizza, 0x9c) +DECOMP_SIZE_ASSERT(PizzaMissionState, 0xb0) +DECOMP_SIZE_ASSERT(PizzaMissionState::Entry, 0x20) // FUNCTION: LEGO1 0x10037ef0 Pizza::Pizza() @@ -98,3 +98,22 @@ undefined4 Pizza::HandleEndAction(MxEndActionNotificationParam&) // TODO return 0; } + +// STUB: LEGO1 0x100393c0 +MxResult PizzaMissionState::Serialize(LegoFile* p_legoFile) +{ + // TODO + return LegoState::Serialize(p_legoFile); +} + +// FUNCTION: LEGO1 0x10039510 +PizzaMissionState::Entry* PizzaMissionState::GetState(MxU8 p_id) +{ + for (MxS16 i = 0; i < 5; i++) { + if (m_state[i].m_id == p_id) { + return m_state + i; + } + } + + return NULL; +} diff --git a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp index 46139dd7..1ae45305 100644 --- a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp @@ -9,11 +9,11 @@ #include "legoworld.h" #include "misc.h" #include "pizza.h" -#include "pizzamissionstate.h" -#include "pizzeriastate.h" #include "scripts.h" DECOMP_SIZE_ASSERT(Pizzeria, 0x84) +DECOMP_SIZE_ASSERT(PizzeriaState, 0x58) +DECOMP_SIZE_ASSERT(PizzeriaState::StateStruct, 0x14) // FUNCTION: LEGO1 0x100179c0 MxResult Pizzeria::Create(MxDSAction& p_dsAction) @@ -63,3 +63,22 @@ undefined4 Pizzeria::HandleClick() return 1; } + +// STUB: LEGO1 0x10017af0 +PizzeriaState::PizzeriaState() +{ + // TODO +} + +// STUB: LEGO1 0x10017d70 +MxU32 PizzeriaState::FUN_10017d70() +{ + return 0; +} + +// STUB: LEGO1 0x10017da0 +MxResult PizzeriaState::Serialize(LegoFile* p_legoFile) +{ + // TODO + return LegoState::Serialize(p_legoFile); +} diff --git a/LEGO1/lego/legoomni/src/actors/radio.cpp b/LEGO1/lego/legoomni/src/actors/radio.cpp index e78e7ba8..89d39357 100644 --- a/LEGO1/lego/legoomni/src/actors/radio.cpp +++ b/LEGO1/lego/legoomni/src/actors/radio.cpp @@ -1,6 +1,7 @@ #include "radio.h" #include "isle_actions.h" +#include "jukebox_actions.h" #include "legocontrolmanager.h" #include "legogamestate.h" #include "legoworld.h" @@ -10,10 +11,52 @@ #include "mxcontrolpresenter.h" #include "mxmisc.h" #include "mxnotificationmanager.h" -#include "radiostate.h" +#include "mxtimer.h" #include "scripts.h" DECOMP_SIZE_ASSERT(Radio, 0x10) +DECOMP_SIZE_ASSERT(RadioState, 0x30) + +// GLOBAL: LEGO1 0x100f3218 +JukeboxScript::Script g_unk0x100f3218[6] = { + JukeboxScript::c_sns002ra_Audio, + JukeboxScript::c_sns001ja_Audio, + JukeboxScript::c_snsc01js_Audio, + JukeboxScript::c_snsb01js_Audio, + JukeboxScript::c_snsa01js_Audio, + JukeboxScript::c_sns009ra_Audio +}; + +// GLOBAL: LEGO1 0x100f3230 +JukeboxScript::Script g_unk0x100f3230[14] = { + JukeboxScript::c_ham035ra_Audio, + JukeboxScript::c_ham039ra_Audio, + JukeboxScript::c_sns005ra_Audio, + JukeboxScript::c_sns078pa_Audio, + JukeboxScript::c_ham036ra_Audio, + JukeboxScript::c_sns006ra_Audio, + JukeboxScript::c_sns013ra_Audio, + JukeboxScript::c_sns004ra_Audio, + JukeboxScript::c_sns079pa_Audio, + JukeboxScript::c_sns007ra_Audio, + JukeboxScript::c_sns008ra_Audio, + JukeboxScript::c_hpz037ma_Audio, + JukeboxScript::c_sns003ra_Audio, + JukeboxScript::c_sns010ra_Audio, +}; + +// GLOBAL: LEGO1 0x100f3268 +JukeboxScript::Script g_unk0x100f3268[9] = { + JukeboxScript::c_CentralRoads_Music, + JukeboxScript::c_BeachBlvd_Music, + JukeboxScript::c_ResidentalArea_Music, + JukeboxScript::c_Radio1_Music, + JukeboxScript::c_Radio2_Music, + JukeboxScript::c_Radio3_Music, + JukeboxScript::c_Radio4_Music, + JukeboxScript::c_Radio5_Music, + JukeboxScript::c_Radio6_Music, +}; // FUNCTION: LEGO1 0x1002c850 Radio::Radio() @@ -162,3 +205,56 @@ void Radio::CreateState() m_state = state; } + +// FUNCTION: LEGO1 0x1002ce10 +RadioState::RadioState() +{ + srand(Timer()->GetTime()); + + MxS32 random = rand(); + m_unk0x2c = random % 3; + + m_unk0x08[0] = LegoState::Playlist((MxU32*) g_unk0x100f3218, sizeof(g_unk0x100f3218) / sizeof(g_unk0x100f3218[0])); + m_unk0x08[0].SetUnknown0x08(rand() % (sizeof(g_unk0x100f3218) / sizeof(g_unk0x100f3218[0]))); + + m_unk0x08[1] = LegoState::Playlist((MxU32*) g_unk0x100f3230, sizeof(g_unk0x100f3230) / sizeof(g_unk0x100f3230[0])); + m_unk0x08[1].SetUnknown0x08(rand() % (sizeof(g_unk0x100f3230) / sizeof(g_unk0x100f3230[0]))); + + m_unk0x08[2] = LegoState::Playlist((MxU32*) g_unk0x100f3268, sizeof(g_unk0x100f3268) / sizeof(g_unk0x100f3268[0])); + m_unk0x08[2].SetUnknown0x08(rand() % (sizeof(g_unk0x100f3268) / sizeof(g_unk0x100f3268[0]))); + + m_active = FALSE; +} + +// FUNCTION: LEGO1 0x1002cf50 +MxBool RadioState::IsSerializable() +{ + return FALSE; +} + +// FUNCTION: LEGO1 0x1002d090 +MxU32 RadioState::FUN_1002d090() +{ + if (m_unk0x2c == 2) { + m_unk0x2c = 0; + } + else { + m_unk0x2c++; + } + + return m_unk0x08[m_unk0x2c].Next(); +} + +// FUNCTION: LEGO1 0x1002d0c0 +MxBool RadioState::FUN_1002d0c0(const MxAtomId& p_atom, MxU32 p_objectId) +{ + if (*g_jukeboxScript == p_atom) { + for (MxS16 i = 0; i < 3; i++) { + if (m_unk0x08[i].Contains(p_objectId)) { + return TRUE; + } + } + } + + return FALSE; +} diff --git a/LEGO1/lego/legoomni/src/actors/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index ab37d3f1..814e1332 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -1,6 +1,5 @@ #include "skateboard.h" -#include "act1state.h" #include "decomp.h" #include "isle.h" #include "isle_actions.h" diff --git a/LEGO1/lego/legoomni/src/actors/towtrack.cpp b/LEGO1/lego/legoomni/src/actors/towtrack.cpp index cf155775..4f259903 100644 --- a/LEGO1/lego/legoomni/src/actors/towtrack.cpp +++ b/LEGO1/lego/legoomni/src/actors/towtrack.cpp @@ -7,9 +7,9 @@ #include "mxmisc.h" #include "mxtimer.h" #include "mxvariabletable.h" -#include "towtrackmissionstate.h" DECOMP_SIZE_ASSERT(TowTrack, 0x180) +DECOMP_SIZE_ASSERT(TowTrackMissionState, 0x28) // FUNCTION: LEGO1 0x1004c720 TowTrack::TowTrack() @@ -131,3 +131,73 @@ void TowTrack::FUN_1004dbe0() { // TODO } + +// FUNCTION: LEGO1 0x1004dd30 +TowTrackMissionState::TowTrackMissionState() +{ + m_unk0x12 = 0; + m_unk0x14 = 0; + m_unk0x16 = 0; + m_unk0x08 = 0; + m_unk0x18 = 0; + m_unk0x0c = 0; + m_unk0x1a = 0; + m_unk0x10 = 0; + m_score1 = 0; + m_score2 = 0; + m_score3 = 0; + m_score4 = 0; + m_score5 = 0; +} + +// FUNCTION: LEGO1 0x1004dde0 +MxResult TowTrackMissionState::Serialize(LegoFile* p_legoFile) +{ + LegoState::Serialize(p_legoFile); + + if (p_legoFile->IsReadMode()) { + p_legoFile->Read(&m_unk0x12, sizeof(m_unk0x12)); + p_legoFile->Read(&m_unk0x14, sizeof(m_unk0x14)); + p_legoFile->Read(&m_unk0x16, sizeof(m_unk0x16)); + p_legoFile->Read(&m_unk0x18, sizeof(m_unk0x18)); + p_legoFile->Read(&m_unk0x1a, sizeof(m_unk0x1a)); + p_legoFile->Read(&m_score1, sizeof(m_score1)); + p_legoFile->Read(&m_score2, sizeof(m_score2)); + p_legoFile->Read(&m_score3, sizeof(m_score3)); + p_legoFile->Read(&m_score4, sizeof(m_score4)); + p_legoFile->Read(&m_score5, sizeof(m_score5)); + } + else if (p_legoFile->IsWriteMode()) { + MxU16 write = m_unk0x12; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + + write = m_unk0x14; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + + write = m_unk0x16; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + + write = m_unk0x18; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + + write = m_unk0x1a; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + + write = m_score1; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + + write = m_score2; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + + write = m_score3; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + + write = m_score4; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + + write = m_score5; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + } + + return SUCCESS; +} diff --git a/LEGO1/lego/legoomni/src/build/helicopterstate.cpp b/LEGO1/lego/legoomni/src/build/helicopterstate.cpp deleted file mode 100644 index 1a9ca3fa..00000000 --- a/LEGO1/lego/legoomni/src/build/helicopterstate.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "helicopterstate.h" - -DECOMP_SIZE_ASSERT(HelicopterState, 0x0c) diff --git a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp index f844aa08..ed32a3f2 100644 --- a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp @@ -1,6 +1,7 @@ #include "legocarbuild.h" DECOMP_SIZE_ASSERT(LegoCarBuild, 0x34c) +DECOMP_SIZE_ASSERT(LegoVehicleBuildState, 0x50) // STUB: LEGO1 0x100226d0 LegoCarBuild::LegoCarBuild() @@ -61,3 +62,20 @@ MxBool LegoCarBuild::Escape() // TODO return FALSE; } + +// FUNCTION: LEGO1 0x10025f30 +LegoVehicleBuildState::LegoVehicleBuildState(char* p_classType) +{ + m_className = p_classType; + m_unk0x4c = 0; + m_unk0x4d = FALSE; + m_unk0x4e = FALSE; + m_placedPartCount = 0; +} + +// STUB: LEGO1 0x10026120 +MxResult LegoVehicleBuildState::Serialize(LegoFile* p_legoFile) +{ + // TODO + return LegoState::Serialize(p_legoFile); +} diff --git a/LEGO1/lego/legoomni/src/video/legocarbuildanimpresenter.cpp b/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp similarity index 94% rename from LEGO1/lego/legoomni/src/video/legocarbuildanimpresenter.cpp rename to LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp index d759364b..fddac82e 100644 --- a/LEGO1/lego/legoomni/src/video/legocarbuildanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp @@ -1,4 +1,4 @@ -#include "legocarbuildanimpresenter.h" +#include "legocarbuildpresenter.h" DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter, 0x150) diff --git a/LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp b/LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp deleted file mode 100644 index 2e5df9ef..00000000 --- a/LEGO1/lego/legoomni/src/build/legovehiclebuildstate.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "legovehiclebuildstate.h" - -#include "decomp.h" - -DECOMP_SIZE_ASSERT(LegoVehicleBuildState, 0x50) - -// FUNCTION: LEGO1 0x10025f30 -LegoVehicleBuildState::LegoVehicleBuildState(char* p_classType) -{ - this->m_className = p_classType; - this->m_unk0x4c = 0; - this->m_unk0x4d = FALSE; - this->m_unk0x4e = FALSE; - this->m_placedPartCount = 0; -} - -// STUB: LEGO1 0x10026120 -MxResult LegoVehicleBuildState::Serialize(LegoFile* p_legoFile) -{ - // TODO - return LegoState::Serialize(p_legoFile); -} diff --git a/LEGO1/lego/legoomni/src/common/animstate.cpp b/LEGO1/lego/legoomni/src/common/animstate.cpp deleted file mode 100644 index 24a0bf12..00000000 --- a/LEGO1/lego/legoomni/src/common/animstate.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include "animstate.h" - -DECOMP_SIZE_ASSERT(AnimState, 0x1c) -DECOMP_SIZE_ASSERT(ModelInfo, 0x30) -DECOMP_SIZE_ASSERT(AnimInfo, 0x30) - -// FUNCTION: LEGO1 0x10064ff0 -AnimState::AnimState() -{ - m_unk0x0c = 0; - m_unk0x10 = NULL; - m_unk0x14 = 0; - m_unk0x18 = NULL; -} - -// STUB: LEGO1 0x10065150 -AnimState::~AnimState() -{ - // TODO -} - -// STUB: LEGO1 0x100651d0 -void AnimState::FUN_100651d0(MxU32, AnimInfo*, MxU32&) -{ - // TODO -} - -// STUB: LEGO1 0x10065240 -void AnimState::FUN_10065240(MxU32, AnimInfo*, MxU32) -{ - // TODO -} - -// STUB: LEGO1 0x100652d0 -MxResult AnimState::Serialize(LegoFile* p_legoFile) -{ - // TODO - return LegoState::Serialize(p_legoFile); -} - -// STUB: LEGO1 0x100654f0 -MxBool AnimState::SetFlag() -{ - // TODO - return FALSE; -} diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index fde5a979..f1915ef9 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -2,7 +2,6 @@ #include "3dmanager/lego3dmanager.h" #include "anim/legoanim.h" -#include "animstate.h" #include "define.h" #include "islepathactor.h" #include "legoanimmmpresenter.h" @@ -37,6 +36,9 @@ DECOMP_SIZE_ASSERT(LegoAnimationManager::Character, 0x18) DECOMP_SIZE_ASSERT(LegoAnimationManager::Vehicle, 0x08) DECOMP_SIZE_ASSERT(LegoAnimationManager::Extra, 0x18) DECOMP_SIZE_ASSERT(LegoTranInfo, 0x78) +DECOMP_SIZE_ASSERT(AnimState, 0x1c) +DECOMP_SIZE_ASSERT(AnimInfo, 0x30) +DECOMP_SIZE_ASSERT(ModelInfo, 0x30) // GLOBAL: LEGO1 0x100d8b28 MxU8 g_unk0x100d8b28[] = {0, 1, 2, 4, 8, 16}; @@ -2820,3 +2822,44 @@ void LegoAnimationManager::FUN_10064b50(MxLong p_time) ); } } + +// FUNCTION: LEGO1 0x10064ff0 +AnimState::AnimState() +{ + m_unk0x0c = 0; + m_unk0x10 = NULL; + m_unk0x14 = 0; + m_unk0x18 = NULL; +} + +// STUB: LEGO1 0x10065150 +AnimState::~AnimState() +{ + // TODO +} + +// STUB: LEGO1 0x100651d0 +void AnimState::FUN_100651d0(MxU32, AnimInfo*, MxU32&) +{ + // TODO +} + +// STUB: LEGO1 0x10065240 +void AnimState::FUN_10065240(MxU32, AnimInfo*, MxU32) +{ + // TODO +} + +// STUB: LEGO1 0x100652d0 +MxResult AnimState::Serialize(LegoFile* p_legoFile) +{ + // TODO + return LegoState::Serialize(p_legoFile); +} + +// STUB: LEGO1 0x100654f0 +MxBool AnimState::SetFlag() +{ + // TODO + return FALSE; +} diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index 0f339590..b7882a3c 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -1,7 +1,6 @@ #include "legogamestate.h" #include "3dmanager/lego3dmanager.h" -#include "act1state.h" #include "act2main_actions.h" #include "act3_actions.h" #include "carrace_actions.h" @@ -15,7 +14,7 @@ #include "helicopter.h" #include "histbook_actions.h" #include "hospital_actions.h" -#include "infocenterstate.h" +#include "infocenter.h" #include "infodoor_actions.h" #include "infomain_actions.h" #include "infoscor_actions.h" diff --git a/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp b/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp index 46926705..23b0227e 100644 --- a/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp +++ b/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp @@ -7,27 +7,22 @@ #include "dunebuggy.h" #include "elevatorbottom.h" #include "gasstation.h" -#include "gasstationstate.h" #include "helicopter.h" -#include "helicopterstate.h" #include "historybook.h" #include "hospital.h" -#include "hospitalstate.h" #include "infocenter.h" #include "infocenterdoor.h" -#include "infocenterstate.h" #include "isle.h" #include "jetskirace.h" #include "lego3dwavepresenter.h" #include "legoact2.h" -#include "legoact2state.h" #include "legoactioncontrolpresenter.h" #include "legoactor.h" #include "legoactorpresenter.h" #include "legoanimactor.h" #include "legoanimpresenter.h" #include "legocarbuild.h" -#include "legocarbuildanimpresenter.h" +#include "legocarbuildpresenter.h" #include "legocarraceactor.h" #include "legoentity.h" #include "legoentitypresenter.h" @@ -51,52 +46,34 @@ #include "mxcontrolpresenter.h" #include "mxvideopresenter.h" #include "pizza.h" -#include "pizzamissionstate.h" #include "police.h" -#include "policestate.h" #include "registrationbook.h" #include "score.h" -#include "scorestate.h" #include "skateboard.h" // #include "act2genactor.h" #include "act2policestation.h" #include "act3.h" -#include "act3state.h" #include "ambulance.h" -#include "ambulancemissionstate.h" #include "bike.h" #include "doors.h" #include "jetski.h" +#include "legoanimationmanager.h" #include "legoanimmmpresenter.h" #include "motocycle.h" #include "racecar.h" #include "towtrack.h" -#include "towtrackmissionstate.h" // #include "act3cop.h" // #include "act3brickster.h" -#include "act1state.h" #include "act3actor.h" #include "act3shark.h" -#include "animstate.h" -#include "beachhouseentity.h" +#include "buildings.h" #include "bumpbouy.h" -#include "carracestate.h" #include "caveentity.h" -#include "gasstationentity.h" -#include "hospitalentity.h" -#include "infocenterentity.h" -#include "jailentity.h" -#include "jetskiracestate.h" #include "jukebox.h" #include "jukeboxentity.h" -#include "jukeboxstate.h" #include "mxcompositemediapresenter.h" #include "pizzeria.h" -#include "pizzeriastate.h" -#include "policeentity.h" #include "raceskel.h" -#include "racestandsentity.h" -#include "radiostate.h" // TODO: Before HospitalState, add all of the different LegoVehicleBuildState's diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index d769404e..8f9d9b12 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -1,8 +1,8 @@ #include "legoutils.h" #include "3dmanager/lego3dmanager.h" -#include "act1state.h" #include "anim/legoanim.h" +#include "isle.h" #include "islepathactor.h" #include "legoanimationmanager.h" #include "legoanimpresenter.h" diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index 87274d00..70c2bb88 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -1,7 +1,7 @@ #include "legonavcontroller.h" #include "3dmanager/lego3dmanager.h" -#include "infocenterstate.h" +#include "infocenter.h" #include "legoanimationmanager.h" #include "legocameracontroller.h" #include "legogamestate.h" diff --git a/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp b/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp deleted file mode 100644 index aa14a197..00000000 --- a/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "gasstationentity.h" - -#include "act1state.h" -#include "isle.h" -#include "isle_actions.h" -#include "islepathactor.h" -#include "legoanimationmanager.h" -#include "legogamestate.h" -#include "legoutils.h" -#include "legoworld.h" -#include "misc.h" -#include "mxtransitionmanager.h" -#include "scripts.h" - -DECOMP_SIZE_ASSERT(GasStationEntity, 0x68) - -// FUNCTION: LEGO1 0x100151d0 -MxLong GasStationEntity::VTable0x50(MxParam& p_param) -{ - if (FUN_1003ef60()) { - Act1State* state = (Act1State*) GameState()->GetState("Act1State"); - - if (state->GetUnknown18() != 8) { - state->SetUnknown18(0); - - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); - } - - Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); - isle->SetDestLocation(LegoGameState::Area::e_garage); - - AnimationManager()->FUN_10061010(FALSE); - TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - } - } - - return 1; -} diff --git a/LEGO1/lego/legoomni/src/gasstation/gasstationstate.cpp b/LEGO1/lego/legoomni/src/gasstation/gasstationstate.cpp deleted file mode 100644 index 613a74eb..00000000 --- a/LEGO1/lego/legoomni/src/gasstation/gasstationstate.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "gasstationstate.h" - -DECOMP_SIZE_ASSERT(GasStationState, 0x24) - -// FUNCTION: LEGO1 0x10005eb0 -GasStationState::GasStationState() -{ - m_unk0x18 = 0; - m_unk0x1a = 0; - m_unk0x1c = 0; - m_unk0x1e = 0; - m_unk0x20 = 0; - - undefined4* unk0x08 = m_unk0x08; - unk0x08[0] = -1; - unk0x08[1] = -1; - unk0x08[2] = -1; -} - -// STUB: LEGO1 0x10006300 -MxResult GasStationState::Serialize(LegoFile* p_legoFile) -{ - // TODO - return LegoState::Serialize(p_legoFile); -} - -// STUB: LEGO1 0x10006430 -void GasStationState::FUN_10006430(undefined4) -{ - // TODO -} - -// STUB: LEGO1 0x10006490 -void GasStationState::FUN_10006490() -{ - // TODO -} diff --git a/LEGO1/lego/legoomni/src/hospital/ambulancemissionstate.cpp b/LEGO1/lego/legoomni/src/hospital/ambulancemissionstate.cpp deleted file mode 100644 index 860bd0f0..00000000 --- a/LEGO1/lego/legoomni/src/hospital/ambulancemissionstate.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "ambulancemissionstate.h" - -DECOMP_SIZE_ASSERT(AmbulanceMissionState, 0x24) - -// FUNCTION: LEGO1 0x100373a0 -AmbulanceMissionState::AmbulanceMissionState() -{ - m_unk0x10 = 0; - m_unk0x12 = 0; - m_unk0x14 = 0; - m_unk0x08 = 0; - m_unk0x16 = 0; - m_unk0x0c = 0; - m_unk0x18 = 0; - m_score1 = 0; - m_score2 = 0; - m_score3 = 0; - m_score4 = 0; - m_score5 = 0; -} - -// STUB: LEGO1 0x10037440 -MxResult AmbulanceMissionState::Serialize(LegoFile* p_legoFile) -{ - // TODO - return LegoState::Serialize(p_legoFile); -} diff --git a/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp b/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp deleted file mode 100644 index b6c995d9..00000000 --- a/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "hospitalentity.h" - -#include "act1state.h" -#include "isle.h" -#include "isle_actions.h" -#include "islepathactor.h" -#include "legoanimationmanager.h" -#include "legogamestate.h" -#include "legoutils.h" -#include "legoworld.h" -#include "misc.h" -#include "mxtransitionmanager.h" -#include "scripts.h" - -DECOMP_SIZE_ASSERT(HospitalEntity, 0x68) - -// FUNCTION: LEGO1 0x10015270 -MxLong HospitalEntity::VTable0x50(MxParam& p_param) -{ - if (FUN_1003ef60()) { - Act1State* act1State = (Act1State*) GameState()->GetState("Act1State"); - - if (act1State->GetUnknown18() != 10) { - act1State->SetUnknown18(0); - - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); - } - - Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); - isle->SetDestLocation(LegoGameState::Area::e_hospital); - - AnimationManager()->FUN_10061010(FALSE); - TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - } - } - - return 1; -} diff --git a/LEGO1/lego/legoomni/src/hospital/hospitalstate.cpp b/LEGO1/lego/legoomni/src/hospital/hospitalstate.cpp deleted file mode 100644 index da61f0fb..00000000 --- a/LEGO1/lego/legoomni/src/hospital/hospitalstate.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "hospitalstate.h" - -DECOMP_SIZE_ASSERT(HospitalState, 0x18) - -// FUNCTION: LEGO1 0x10076370 -HospitalState::HospitalState() -{ - m_unk0x0c = 0; - m_unk0x0e = 0; - m_unk0x10 = 0; - m_unk0x12 = 0; - m_unk0x14 = 0; - m_unk0x16 = 0; -} - -// FUNCTION: LEGO1 0x10076530 -MxResult HospitalState::Serialize(LegoFile* p_legoFile) -{ - LegoState::Serialize(p_legoFile); - - if (p_legoFile->IsWriteMode()) { - // A write variable needs to be used here, otherwise - // the compiler aggresively optimizes the function - MxS16 write; - - write = m_unk0x0c; - p_legoFile->Write(&write, sizeof(m_unk0x0c)); - write = m_unk0x0e; - p_legoFile->Write(&write, sizeof(m_unk0x0e)); - write = m_unk0x10; - p_legoFile->Write(&write, sizeof(m_unk0x10)); - write = m_unk0x12; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - write = m_unk0x14; - p_legoFile->Write(&write, sizeof(m_unk0x14)); - write = m_unk0x16; - p_legoFile->Write(&write, sizeof(m_unk0x16)); - } - else if (p_legoFile->IsReadMode()) { - p_legoFile->Read(&m_unk0x0c, sizeof(m_unk0x0c)); - p_legoFile->Read(&m_unk0x0e, sizeof(m_unk0x0e)); - p_legoFile->Read(&m_unk0x10, sizeof(m_unk0x10)); - p_legoFile->Read(&m_unk0x12, sizeof(m_unk0x12)); - p_legoFile->Read(&m_unk0x14, sizeof(m_unk0x14)); - p_legoFile->Read(&m_unk0x16, sizeof(m_unk0x16)); - } - - return SUCCESS; -} diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp deleted file mode 100644 index 1928f1c7..00000000 --- a/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "infocenterentity.h" - -#include "act1state.h" -#include "act2main_actions.h" -#include "act3.h" -#include "act3_actions.h" -#include "act3state.h" -#include "isle.h" -#include "isle_actions.h" -#include "islepathactor.h" -#include "legoact2.h" -#include "legoact2state.h" -#include "legoanimationmanager.h" -#include "legogamestate.h" -#include "legoutils.h" -#include "legoworld.h" -#include "misc.h" -#include "mxtransitionmanager.h" -#include "scripts.h" - -DECOMP_SIZE_ASSERT(InfoCenterEntity, 0x68) - -// FUNCTION: LEGO1 0x100150c0 -MxLong InfoCenterEntity::VTable0x50(MxParam& p_param) -{ - switch (GameState()->GetCurrentAct()) { - case LegoGameState::Act::e_act1: { - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); - } - - Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); - isle->FUN_10033350(); - isle->SetDestLocation(LegoGameState::Area::e_infomain); - - Act1State* act1state = (Act1State*) GameState()->GetState("Act1State"); - act1state->SetUnknown18(0); - break; - } - case LegoGameState::Act::e_act2: { - LegoAct2* act2 = (LegoAct2*) FindWorld(*g_act2mainScript, Act2mainScript::c__Act2Main); - act2->SetUnknown0x1150(2); - - LegoAct2State* act2state = (LegoAct2State*) GameState()->GetState("LegoAct2State"); - if (act2state) { - act2state->SetUnknown0x0c(0); - } - break; - } - case LegoGameState::Act::e_act3: - Act3* act3 = (Act3*) FindWorld(*g_act3Script, Act3Script::c__Act3); - act3->SetUnknown4270(2); - break; - } - - AnimationManager()->FUN_10061010(FALSE); - TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - - return 1; -} diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp deleted file mode 100644 index 0fd99839..00000000 --- a/LEGO1/lego/legoomni/src/infocenter/infocenterstate.cpp +++ /dev/null @@ -1,133 +0,0 @@ -#include "infocenterstate.h" - -#include "infocenter.h" -#include "infomain_actions.h" -#include "mxstillpresenter.h" - -DECOMP_SIZE_ASSERT(InfocenterState, 0x94) - -// GLOBAL: LEGO1 0x100f76a8 -InfomainScript::Script g_exitDialogueAct1[14] = { - InfomainScript::c_iic019in_RunAnim, - InfomainScript::c_iic020in_RunAnim, - InfomainScript::c_iic021in_RunAnim, - InfomainScript::c_iic022in_RunAnim, - InfomainScript::c_iic023in_RunAnim, - InfomainScript::c_iic024in_RunAnim, - InfomainScript::c_iic025in_RunAnim, - InfomainScript::c_iic026in_RunAnim, - InfomainScript::c_iic027in_RunAnim, - InfomainScript::c_iica28in_RunAnim, - InfomainScript::c_iicb28in_RunAnim, - InfomainScript::c_iicc28in_RunAnim, - InfomainScript::c_iic029in_RunAnim, - InfomainScript::c_iic032in_RunAnim -}; - -// GLOBAL: LEGO1 0x100f76e0 -InfomainScript::Script g_exitDialogueAct23[6] = { - InfomainScript::c_iic027in_RunAnim, - InfomainScript::c_iic029in_RunAnim, - InfomainScript::c_iic048in_RunAnim, - InfomainScript::c_iic056in_RunAnim, - InfomainScript::c_iicx23in_RunAnim - // Zero-terminated -}; - -// GLOBAL: LEGO1 0x100f76f8 -InfomainScript::Script g_returnDialogueAct1[6] = { - InfomainScript::c_iicx26in_RunAnim, - InfomainScript::c_iic033in_RunAnim, - InfomainScript::c_iic034in_RunAnim, - InfomainScript::c_iic035in_RunAnim, - InfomainScript::c_iic036in_RunAnim - // Zero-terminated -}; - -// GLOBAL: LEGO1 0x100f7710 -InfomainScript::Script g_returnDialogueAct2[4] = { - InfomainScript::c_iic048in_RunAnim, - InfomainScript::c_iic049in_RunAnim, - InfomainScript::c_iic050in_RunAnim, - // Zero-terminated -}; - -// GLOBAL: LEGO1 0x100f7720 -InfomainScript::Script g_returnDialogueAct3[4] = { - InfomainScript::c_iic055in_RunAnim, - InfomainScript::c_iic056in_RunAnim, - InfomainScript::c_iic057in_RunAnim, - InfomainScript::c_iic058in_RunAnim -}; - -// GLOBAL: LEGO1 0x100f7730 -InfomainScript::Script g_leaveDialogueAct1[4] = { - InfomainScript::c_iic039in_PlayWav, - InfomainScript::c_iic040in_PlayWav, - InfomainScript::c_iic041in_PlayWav, - InfomainScript::c_iic042in_PlayWav -}; - -// GLOBAL: LEGO1 0x100f7740 -InfomainScript::Script g_leaveDialogueAct2[4] = { - InfomainScript::c_iic051in_PlayWav, - InfomainScript::c_iic052in_PlayWav, - InfomainScript::c_iic053in_PlayWav, - InfomainScript::c_iic054in_PlayWav -}; - -// GLOBAL: LEGO1 0x100f7750 -InfomainScript::Script g_leaveDialogueAct3[4] = { - InfomainScript::c_iic059in_PlayWav, - InfomainScript::c_iic060in_PlayWav, - InfomainScript::c_iic061in_PlayWav, - // Zero-terminated -}; - -// GLOBAL: LEGO1 0x100f7760 -InfomainScript::Script g_bricksterDialogue[2] = { - InfomainScript::c_sbleh2br_PlayWav, - InfomainScript::c_snshahbr_PlayWav -}; - -// FUNCTION: LEGO1 0x10071600 -InfocenterState::InfocenterState() -{ - m_exitDialogueAct1 = LegoState::Playlist((MxU32*) g_exitDialogueAct1, sizeOfArray(g_exitDialogueAct1)); - m_exitDialogueAct23 = LegoState::Playlist((MxU32*) g_exitDialogueAct23, sizeOfArray(g_exitDialogueAct23) - 1); - - m_returnDialogue[LegoGameState::e_act1] = - LegoState::Playlist((MxU32*) g_returnDialogueAct1, sizeOfArray(g_returnDialogueAct1) - 1); - - m_returnDialogue[LegoGameState::e_act2] = - LegoState::Playlist((MxU32*) g_returnDialogueAct2, sizeOfArray(g_returnDialogueAct2) - 1); - - m_returnDialogue[LegoGameState::e_act3] = - LegoState::Playlist((MxU32*) g_returnDialogueAct3, sizeOfArray(g_returnDialogueAct3)); - - m_leaveDialogue[LegoGameState::e_act1] = - LegoState::Playlist((MxU32*) g_leaveDialogueAct1, sizeOfArray(g_leaveDialogueAct1)); - - m_leaveDialogue[LegoGameState::e_act2] = - LegoState::Playlist((MxU32*) g_leaveDialogueAct2, sizeOfArray(g_leaveDialogueAct2)); - - m_leaveDialogue[LegoGameState::e_act3] = - LegoState::Playlist((MxU32*) g_leaveDialogueAct3, sizeOfArray(g_leaveDialogueAct3) - 1); - - m_bricksterDialogue = LegoState::Playlist((MxU32*) g_bricksterDialogue, sizeOfArray(g_bricksterDialogue)); - - memset(m_letters, 0, sizeof(m_letters)); -} - -// FUNCTION: LEGO1 0x10071920 -InfocenterState::~InfocenterState() -{ - MxS16 i = 0; - do { - if (GetNameLetter(i) != NULL) { - delete GetNameLetter(i)->GetAction(); - delete GetNameLetter(i); - } - i++; - } while (i < GetMaxNameLength()); -} diff --git a/LEGO1/lego/legoomni/src/infocenter/scorestate.cpp b/LEGO1/lego/legoomni/src/infocenter/scorestate.cpp deleted file mode 100644 index e1b3522c..00000000 --- a/LEGO1/lego/legoomni/src/infocenter/scorestate.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "scorestate.h" - -DECOMP_SIZE_ASSERT(ScoreState, 0x0c) - -// FUNCTION: LEGO1 0x1000de20 -MxBool ScoreState::IsSerializable() -{ - return FALSE; -} - -// FUNCTION: LEGO1 0x1000de30 -MxBool ScoreState::SetFlag() -{ - m_playCubeTutorial = TRUE; - return TRUE; -} diff --git a/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp b/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp deleted file mode 100644 index 1e7167dd..00000000 --- a/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "beachhouseentity.h" - -#include "act1state.h" -#include "isle.h" -#include "isle_actions.h" -#include "islepathactor.h" -#include "legoanimationmanager.h" -#include "legogamestate.h" -#include "legoutils.h" -#include "legoworld.h" -#include "misc.h" -#include "mxtransitionmanager.h" -#include "scripts.h" - -DECOMP_SIZE_ASSERT(BeachHouseEntity, 0x68) - -// FUNCTION: LEGO1 0x100153b0 -MxLong BeachHouseEntity::VTable0x50(MxParam& p_param) -{ - if (FUN_1003ef60()) { - Act1State* state = (Act1State*) GameState()->GetState("Act1State"); - state->SetUnknown18(0); - - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); - } - - Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); - isle->SetDestLocation(LegoGameState::Area::e_jetskibuild); - - AnimationManager()->FUN_10061010(FALSE); - TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - } - - return 1; -} diff --git a/LEGO1/lego/legoomni/src/isle/jukeboxstate.cpp b/LEGO1/lego/legoomni/src/isle/jukeboxstate.cpp deleted file mode 100644 index 7efc9695..00000000 --- a/LEGO1/lego/legoomni/src/isle/jukeboxstate.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "jukeboxstate.h" - -DECOMP_SIZE_ASSERT(JukeBoxState, 0x10) - -// FUNCTION: LEGO1 0x1000f300 -MxBool JukeBoxState::IsSerializable() -{ - return FALSE; -} diff --git a/LEGO1/lego/legoomni/src/isle/radiostate.cpp b/LEGO1/lego/legoomni/src/isle/radiostate.cpp deleted file mode 100644 index 5927a94b..00000000 --- a/LEGO1/lego/legoomni/src/isle/radiostate.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include "radiostate.h" - -#include "jukebox.h" -#include "jukebox_actions.h" -#include "mxmisc.h" -#include "mxtimer.h" -#include "scripts.h" - -DECOMP_SIZE_ASSERT(RadioState, 0x30) - -// GLOBAL: LEGO1 0x100f3218 -JukeboxScript::Script g_unk0x100f3218[6] = { - JukeboxScript::c_sns002ra_Audio, - JukeboxScript::c_sns001ja_Audio, - JukeboxScript::c_snsc01js_Audio, - JukeboxScript::c_snsb01js_Audio, - JukeboxScript::c_snsa01js_Audio, - JukeboxScript::c_sns009ra_Audio -}; - -// GLOBAL: LEGO1 0x100f3230 -JukeboxScript::Script g_unk0x100f3230[14] = { - JukeboxScript::c_ham035ra_Audio, - JukeboxScript::c_ham039ra_Audio, - JukeboxScript::c_sns005ra_Audio, - JukeboxScript::c_sns078pa_Audio, - JukeboxScript::c_ham036ra_Audio, - JukeboxScript::c_sns006ra_Audio, - JukeboxScript::c_sns013ra_Audio, - JukeboxScript::c_sns004ra_Audio, - JukeboxScript::c_sns079pa_Audio, - JukeboxScript::c_sns007ra_Audio, - JukeboxScript::c_sns008ra_Audio, - JukeboxScript::c_hpz037ma_Audio, - JukeboxScript::c_sns003ra_Audio, - JukeboxScript::c_sns010ra_Audio, -}; - -// GLOBAL: LEGO1 0x100f3268 -JukeboxScript::Script g_unk0x100f3268[9] = { - JukeboxScript::c_CentralRoads_Music, - JukeboxScript::c_BeachBlvd_Music, - JukeboxScript::c_ResidentalArea_Music, - JukeboxScript::c_Radio1_Music, - JukeboxScript::c_Radio2_Music, - JukeboxScript::c_Radio3_Music, - JukeboxScript::c_Radio4_Music, - JukeboxScript::c_Radio5_Music, - JukeboxScript::c_Radio6_Music, -}; - -// FUNCTION: LEGO1 0x1002ce10 -RadioState::RadioState() -{ - srand(Timer()->GetTime()); - - MxS32 random = rand(); - m_unk0x2c = random % 3; - - m_unk0x08[0] = LegoState::Playlist((MxU32*) g_unk0x100f3218, sizeof(g_unk0x100f3218) / sizeof(g_unk0x100f3218[0])); - m_unk0x08[0].SetUnknown0x08(rand() % (sizeof(g_unk0x100f3218) / sizeof(g_unk0x100f3218[0]))); - - m_unk0x08[1] = LegoState::Playlist((MxU32*) g_unk0x100f3230, sizeof(g_unk0x100f3230) / sizeof(g_unk0x100f3230[0])); - m_unk0x08[1].SetUnknown0x08(rand() % (sizeof(g_unk0x100f3230) / sizeof(g_unk0x100f3230[0]))); - - m_unk0x08[2] = LegoState::Playlist((MxU32*) g_unk0x100f3268, sizeof(g_unk0x100f3268) / sizeof(g_unk0x100f3268[0])); - m_unk0x08[2].SetUnknown0x08(rand() % (sizeof(g_unk0x100f3268) / sizeof(g_unk0x100f3268[0]))); - - m_active = FALSE; -} - -// FUNCTION: LEGO1 0x1002cf50 -MxBool RadioState::IsSerializable() -{ - return FALSE; -} - -// FUNCTION: LEGO1 0x1002d090 -MxU32 RadioState::FUN_1002d090() -{ - if (m_unk0x2c == 2) { - m_unk0x2c = 0; - } - else { - m_unk0x2c++; - } - - return m_unk0x08[m_unk0x2c].Next(); -} - -// FUNCTION: LEGO1 0x1002d0c0 -MxBool RadioState::FUN_1002d0c0(const MxAtomId& p_atom, MxU32 p_objectId) -{ - if (*g_jukeboxScript == p_atom) { - for (MxS16 i = 0; i < 3; i++) { - if (m_unk0x08[i].Contains(p_objectId)) { - return TRUE; - } - } - } - - return FALSE; -} diff --git a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp index db2cc767..d15d083b 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp @@ -1,8 +1,8 @@ #include "legopathstruct.h" #include "isle.h" +#include "jukebox.h" #include "jukebox_actions.h" -#include "jukeboxstate.h" #include "legohideanimpresenter.h" #include "legopathactor.h" #include "legoutils.h" diff --git a/LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp b/LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp deleted file mode 100644 index 543a5152..00000000 --- a/LEGO1/lego/legoomni/src/pizzeria/pizzamissionstate.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "pizzamissionstate.h" - -DECOMP_SIZE_ASSERT(PizzaMissionStateEntry, 0x20) -DECOMP_SIZE_ASSERT(PizzaMissionState, 0xb0) - -// STUB: LEGO1 0x100393c0 -MxResult PizzaMissionState::Serialize(LegoFile* p_legoFile) -{ - // TODO - return LegoState::Serialize(p_legoFile); -} - -// FUNCTION: LEGO1 0x10039510 -PizzaMissionStateEntry* PizzaMissionState::GetState(MxU8 p_id) -{ - for (MxS16 i = 0; i < 5; i++) { - if (m_state[i].m_id == p_id) { - return m_state + i; - } - } - - return NULL; -} diff --git a/LEGO1/lego/legoomni/src/pizzeria/pizzeriastate.cpp b/LEGO1/lego/legoomni/src/pizzeria/pizzeriastate.cpp deleted file mode 100644 index 3271c3d6..00000000 --- a/LEGO1/lego/legoomni/src/pizzeria/pizzeriastate.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "pizzeriastate.h" - -DECOMP_SIZE_ASSERT(PizzeriaState, 0x58) - -// STUB: LEGO1 0x10017af0 -PizzeriaState::PizzeriaState() -{ - // TODO -} - -// STUB: LEGO1 0x10017d70 -MxU32 PizzeriaState::FUN_10017d70() -{ - return 0; -} - -// STUB: LEGO1 0x10017da0 -MxResult PizzeriaState::Serialize(LegoFile* p_legoFile) -{ - // TODO - return LegoState::Serialize(p_legoFile); -} diff --git a/LEGO1/lego/legoomni/src/police/policeentity.cpp b/LEGO1/lego/legoomni/src/police/policeentity.cpp deleted file mode 100644 index a9090b61..00000000 --- a/LEGO1/lego/legoomni/src/police/policeentity.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "policeentity.h" - -#include "act1state.h" -#include "isle.h" -#include "isle_actions.h" -#include "islepathactor.h" -#include "legoanimationmanager.h" -#include "legogamestate.h" -#include "legoutils.h" -#include "legoworld.h" -#include "misc.h" -#include "mxtransitionmanager.h" -#include "scripts.h" - -DECOMP_SIZE_ASSERT(PoliceEntity, 0x68) - -// FUNCTION: LEGO1 0x10015310 -MxLong PoliceEntity::VTable0x50(MxParam& p_param) -{ - if (FUN_1003ef60()) { - Act1State* state = (Act1State*) GameState()->GetState("Act1State"); - - if (state->GetUnknown18() != 10) { - state->SetUnknown18(0); - - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); - } - - Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); - isle->SetDestLocation(LegoGameState::Area::e_police); - - AnimationManager()->FUN_10061010(FALSE); - TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - } - } - - return 1; -} diff --git a/LEGO1/lego/legoomni/src/police/policestate.cpp b/LEGO1/lego/legoomni/src/police/policestate.cpp deleted file mode 100644 index c0a6e716..00000000 --- a/LEGO1/lego/legoomni/src/police/policestate.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "policestate.h" - -#include "islepathactor.h" -#include "misc.h" -#include "mxdsaction.h" -#include "mxmisc.h" -#include "police.h" -#include "police_actions.h" -#include "scripts.h" - -#include - -DECOMP_SIZE_ASSERT(PoliceState, 0x10) - -// FUNCTION: LEGO1 0x1005e7c0 -PoliceState::PoliceState() -{ - m_unk0x0c = 0; - m_policeScript = (rand() % 2 == 0) ? PoliceScript::c_nps002la_RunAnim : PoliceScript::c_nps001ni_RunAnim; -} - -// FUNCTION: LEGO1 0x1005e990 -MxResult PoliceState::Serialize(LegoFile* p_legoFile) -{ - LegoState::Serialize(p_legoFile); - - if (p_legoFile->IsReadMode()) { - p_legoFile->Read(&m_policeScript, sizeof(m_policeScript)); - } - else { - PoliceScript::Script policeScript = m_policeScript; - p_legoFile->Write(&policeScript, sizeof(m_policeScript)); - } - - return SUCCESS; -} - -// FUNCTION: LEGO1 0x1005ea40 -void PoliceState::FUN_1005ea40() -{ - PoliceScript::Script policeScript; - - if (m_unk0x0c == 1) { - return; - } - - switch (CurrentActor()->GetActorId()) { - case 4: - policeScript = PoliceScript::c_nps002la_RunAnim; - m_policeScript = policeScript; - break; - case 5: - policeScript = PoliceScript::c_nps001ni_RunAnim; - m_policeScript = policeScript; - break; - default: - policeScript = m_policeScript; - m_policeScript = policeScript == PoliceScript::c_nps002la_RunAnim ? PoliceScript::c_nps001ni_RunAnim - : PoliceScript::c_nps002la_RunAnim; - } - - { - MxDSAction action; - action.SetObjectId(policeScript); - action.SetAtomId(*g_policeScript); - Start(&action); - } - - m_unk0x0c = 1; -} diff --git a/LEGO1/lego/legoomni/src/race/legorace.cpp b/LEGO1/lego/legoomni/src/race/legorace.cpp index c7959fc7..a2204345 100644 --- a/LEGO1/lego/legoomni/src/race/legorace.cpp +++ b/LEGO1/lego/legoomni/src/race/legorace.cpp @@ -4,6 +4,9 @@ #include "mxnotificationmanager.h" DECOMP_SIZE_ASSERT(LegoRace, 0x144) +DECOMP_SIZE_ASSERT(RaceState::Entry, 0x06) +// TODO: Must be 0x2c but current structure is incorrect +// DECOMP_SIZE_ASSERT(RaceState, 0x2c) // FUNCTION: LEGO1 0x1000dab0 undefined4 LegoRace::VTable0x78(undefined4) @@ -87,3 +90,30 @@ void LegoRace::Enable(MxBool p_enable) { // TODO } + +// STUB: LEGO1 0x10015f30 +RaceState::RaceState() +{ + // TODO +} + +// STUB: LEGO1 0x10016140 +MxResult RaceState::Serialize(LegoFile* p_legoFile) +{ + // TODO + return LegoState::Serialize(p_legoFile); +} + +// FUNCTION: LEGO1 0x10016280 +RaceState::Entry* RaceState::GetState(MxU8 p_id) +{ + for (MxS16 i = 0;; i++) { + if (i >= 5) { + return NULL; + } + + if (m_state[i].m_id == p_id) { + return m_state + i; + } + } +} diff --git a/LEGO1/lego/legoomni/src/race/racestandsentity.cpp b/LEGO1/lego/legoomni/src/race/racestandsentity.cpp deleted file mode 100644 index 8cceb324..00000000 --- a/LEGO1/lego/legoomni/src/race/racestandsentity.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "racestandsentity.h" - -#include "act1state.h" -#include "isle.h" -#include "isle_actions.h" -#include "islepathactor.h" -#include "legoanimationmanager.h" -#include "legogamestate.h" -#include "legoutils.h" -#include "legoworld.h" -#include "misc.h" -#include "mxtransitionmanager.h" -#include "scripts.h" - -DECOMP_SIZE_ASSERT(RaceStandsEntity, 0x68) - -// FUNCTION: LEGO1 0x10015450 -MxLong RaceStandsEntity::VTable0x50(MxParam& p_param) -{ - if (FUN_1003ef60()) { - Act1State* state = (Act1State*) GameState()->GetState("Act1State"); - state->SetUnknown18(0); - - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); - } - - Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); - isle->SetDestLocation(LegoGameState::Area::e_racecarbuild); - - AnimationManager()->FUN_10061010(FALSE); - TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - } - - return 1; -} diff --git a/LEGO1/lego/legoomni/src/race/racestate.cpp b/LEGO1/lego/legoomni/src/race/racestate.cpp deleted file mode 100644 index 897190f7..00000000 --- a/LEGO1/lego/legoomni/src/race/racestate.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "racestate.h" - -DECOMP_SIZE_ASSERT(RaceStateEntry, 0x06) - -// TODO: Must be 0x2c but current structure is incorrect -// DECOMP_SIZE_ASSERT(RaceState, 0x2c) - -// STUB: LEGO1 0x10015f30 -RaceState::RaceState() -{ - // TODO -} - -// STUB: LEGO1 0x10016140 -MxResult RaceState::Serialize(LegoFile* p_legoFile) -{ - // TODO - return LegoState::Serialize(p_legoFile); -} - -// FUNCTION: LEGO1 0x10016280 -RaceStateEntry* RaceState::GetState(MxU8 p_id) -{ - for (MxS16 i = 0;; i++) { - if (i >= 5) { - return NULL; - } - - if (m_state[i].m_id == p_id) { - return m_state + i; - } - } -} diff --git a/LEGO1/lego/legoomni/src/towtrack/towtrackmissionstate.cpp b/LEGO1/lego/legoomni/src/towtrack/towtrackmissionstate.cpp deleted file mode 100644 index bbf080ff..00000000 --- a/LEGO1/lego/legoomni/src/towtrack/towtrackmissionstate.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include "towtrackmissionstate.h" - -DECOMP_SIZE_ASSERT(TowTrackMissionState, 0x28) - -// FUNCTION: LEGO1 0x1004dd30 -TowTrackMissionState::TowTrackMissionState() -{ - m_unk0x12 = 0; - m_unk0x14 = 0; - m_unk0x16 = 0; - m_unk0x08 = 0; - m_unk0x18 = 0; - m_unk0x0c = 0; - m_unk0x1a = 0; - m_unk0x10 = 0; - m_score1 = 0; - m_score2 = 0; - m_score3 = 0; - m_score4 = 0; - m_score5 = 0; -} - -// FUNCTION: LEGO1 0x1004dde0 -MxResult TowTrackMissionState::Serialize(LegoFile* p_legoFile) -{ - LegoState::Serialize(p_legoFile); - - if (p_legoFile->IsReadMode()) { - p_legoFile->Read(&m_unk0x12, sizeof(m_unk0x12)); - p_legoFile->Read(&m_unk0x14, sizeof(m_unk0x14)); - p_legoFile->Read(&m_unk0x16, sizeof(m_unk0x16)); - p_legoFile->Read(&m_unk0x18, sizeof(m_unk0x18)); - p_legoFile->Read(&m_unk0x1a, sizeof(m_unk0x1a)); - p_legoFile->Read(&m_score1, sizeof(m_score1)); - p_legoFile->Read(&m_score2, sizeof(m_score2)); - p_legoFile->Read(&m_score3, sizeof(m_score3)); - p_legoFile->Read(&m_score4, sizeof(m_score4)); - p_legoFile->Read(&m_score5, sizeof(m_score5)); - } - else if (p_legoFile->IsWriteMode()) { - MxU16 write = m_unk0x12; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_unk0x14; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_unk0x16; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_unk0x18; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_unk0x1a; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_score1; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_score2; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_score3; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_score4; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_score5; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - } - - return SUCCESS; -} diff --git a/LEGO1/lego/legoomni/src/worlds/act3.cpp b/LEGO1/lego/legoomni/src/worlds/act3.cpp index 98f789da..c8ec77c3 100644 --- a/LEGO1/lego/legoomni/src/worlds/act3.cpp +++ b/LEGO1/lego/legoomni/src/worlds/act3.cpp @@ -1,6 +1,7 @@ #include "act3.h" DECOMP_SIZE_ASSERT(Act3, 0x4274) +DECOMP_SIZE_ASSERT(Act3State, 0x0c) // STUB: LEGO1 0x10072270 Act3::Act3() diff --git a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp index 219fcf79..3b8381da 100644 --- a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp +++ b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp @@ -1,7 +1,7 @@ #include "elevatorbottom.h" -#include "act1state.h" #include "elevbott_actions.h" +#include "isle.h" #include "jukebox.h" #include "jukebox_actions.h" #include "legocontrolmanager.h" diff --git a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp index 5f48e5f0..82ef467b 100644 --- a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp +++ b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp @@ -1,7 +1,6 @@ #include "gasstation.h" #include "garage_actions.h" -#include "gasstationstate.h" #include "islepathactor.h" #include "jukebox.h" #include "jukebox_actions.h" @@ -21,6 +20,7 @@ #include "scripts.h" DECOMP_SIZE_ASSERT(GasStation, 0x128) +DECOMP_SIZE_ASSERT(GasStationState, 0x24) // GLOBAL: LEGO1 0x100f0160 undefined4 g_unk0x100f0160 = 3; @@ -419,3 +419,37 @@ MxBool GasStation::Escape() m_destLocation = LegoGameState::Area::e_infomain; return TRUE; } + +// FUNCTION: LEGO1 0x10005eb0 +GasStationState::GasStationState() +{ + m_unk0x18 = 0; + m_unk0x1a = 0; + m_unk0x1c = 0; + m_unk0x1e = 0; + m_unk0x20 = 0; + + undefined4* unk0x08 = m_unk0x08; + unk0x08[0] = -1; + unk0x08[1] = -1; + unk0x08[2] = -1; +} + +// STUB: LEGO1 0x10006300 +MxResult GasStationState::Serialize(LegoFile* p_legoFile) +{ + // TODO + return LegoState::Serialize(p_legoFile); +} + +// STUB: LEGO1 0x10006430 +void GasStationState::FUN_10006430(undefined4) +{ + // TODO +} + +// STUB: LEGO1 0x10006490 +void GasStationState::FUN_10006490() +{ + // TODO +} diff --git a/LEGO1/lego/legoomni/src/worlds/hospital.cpp b/LEGO1/lego/legoomni/src/worlds/hospital.cpp index d62baa21..c715bcf6 100644 --- a/LEGO1/lego/legoomni/src/worlds/hospital.cpp +++ b/LEGO1/lego/legoomni/src/worlds/hospital.cpp @@ -1,8 +1,7 @@ #include "hospital.h" -#include "act1state.h" #include "hospital_actions.h" -#include "hospitalstate.h" +#include "isle.h" #include "islepathactor.h" #include "jukebox.h" #include "jukebox_actions.h" @@ -22,6 +21,7 @@ #include "scripts.h" DECOMP_SIZE_ASSERT(Hospital, 0x12c) +DECOMP_SIZE_ASSERT(HospitalState, 0x18) // GLOBAL: LEGO1 0x100f7918 undefined4 g_unk0x100f7918 = 3; @@ -671,3 +671,49 @@ MxBool Hospital::Escape() return TRUE; } + +// FUNCTION: LEGO1 0x10076370 +HospitalState::HospitalState() +{ + m_unk0x0c = 0; + m_unk0x0e = 0; + m_unk0x10 = 0; + m_unk0x12 = 0; + m_unk0x14 = 0; + m_unk0x16 = 0; +} + +// FUNCTION: LEGO1 0x10076530 +MxResult HospitalState::Serialize(LegoFile* p_legoFile) +{ + LegoState::Serialize(p_legoFile); + + if (p_legoFile->IsWriteMode()) { + // A write variable needs to be used here, otherwise + // the compiler aggresively optimizes the function + MxS16 write; + + write = m_unk0x0c; + p_legoFile->Write(&write, sizeof(m_unk0x0c)); + write = m_unk0x0e; + p_legoFile->Write(&write, sizeof(m_unk0x0e)); + write = m_unk0x10; + p_legoFile->Write(&write, sizeof(m_unk0x10)); + write = m_unk0x12; + p_legoFile->Write(&write, sizeof(m_unk0x12)); + write = m_unk0x14; + p_legoFile->Write(&write, sizeof(m_unk0x14)); + write = m_unk0x16; + p_legoFile->Write(&write, sizeof(m_unk0x16)); + } + else if (p_legoFile->IsReadMode()) { + p_legoFile->Read(&m_unk0x0c, sizeof(m_unk0x0c)); + p_legoFile->Read(&m_unk0x0e, sizeof(m_unk0x0e)); + p_legoFile->Read(&m_unk0x10, sizeof(m_unk0x10)); + p_legoFile->Read(&m_unk0x12, sizeof(m_unk0x12)); + p_legoFile->Read(&m_unk0x14, sizeof(m_unk0x14)); + p_legoFile->Read(&m_unk0x16, sizeof(m_unk0x16)); + } + + return SUCCESS; +} diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index af05132d..f8a1426d 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -1,13 +1,12 @@ #include "infocenter.h" -#include "act3state.h" +#include "act3.h" #include "credits_actions.h" -#include "helicopterstate.h" -#include "infocenterstate.h" +#include "helicopter.h" #include "infomain_actions.h" #include "jukebox.h" #include "jukebox_actions.h" -#include "legoact2state.h" +#include "legoact2.h" #include "legoanimationmanager.h" #include "legobuildingmanager.h" #include "legocharactermanager.h" @@ -29,13 +28,13 @@ #include "mxticklemanager.h" #include "mxtransitionmanager.h" #include "mxutilities.h" -#include "radiostate.h" #include "scripts.h" #include "sndanim_actions.h" #include "viewmanager/viewmanager.h" DECOMP_SIZE_ASSERT(Infocenter, 0x1d8) DECOMP_SIZE_ASSERT(InfocenterMapEntry, 0x18) +DECOMP_SIZE_ASSERT(InfocenterState, 0x94) // GLOBAL: LEGO1 0x100f76a0 const char* g_object2x4red = "2x4red"; @@ -43,6 +42,90 @@ const char* g_object2x4red = "2x4red"; // GLOBAL: LEGO1 0x100f76a4 const char* g_object2x4grn = "2x4grn"; +// GLOBAL: LEGO1 0x100f76a8 +InfomainScript::Script g_exitDialogueAct1[14] = { + InfomainScript::c_iic019in_RunAnim, + InfomainScript::c_iic020in_RunAnim, + InfomainScript::c_iic021in_RunAnim, + InfomainScript::c_iic022in_RunAnim, + InfomainScript::c_iic023in_RunAnim, + InfomainScript::c_iic024in_RunAnim, + InfomainScript::c_iic025in_RunAnim, + InfomainScript::c_iic026in_RunAnim, + InfomainScript::c_iic027in_RunAnim, + InfomainScript::c_iica28in_RunAnim, + InfomainScript::c_iicb28in_RunAnim, + InfomainScript::c_iicc28in_RunAnim, + InfomainScript::c_iic029in_RunAnim, + InfomainScript::c_iic032in_RunAnim +}; + +// GLOBAL: LEGO1 0x100f76e0 +InfomainScript::Script g_exitDialogueAct23[6] = { + InfomainScript::c_iic027in_RunAnim, + InfomainScript::c_iic029in_RunAnim, + InfomainScript::c_iic048in_RunAnim, + InfomainScript::c_iic056in_RunAnim, + InfomainScript::c_iicx23in_RunAnim + // Zero-terminated +}; + +// GLOBAL: LEGO1 0x100f76f8 +InfomainScript::Script g_returnDialogueAct1[6] = { + InfomainScript::c_iicx26in_RunAnim, + InfomainScript::c_iic033in_RunAnim, + InfomainScript::c_iic034in_RunAnim, + InfomainScript::c_iic035in_RunAnim, + InfomainScript::c_iic036in_RunAnim + // Zero-terminated +}; + +// GLOBAL: LEGO1 0x100f7710 +InfomainScript::Script g_returnDialogueAct2[4] = { + InfomainScript::c_iic048in_RunAnim, + InfomainScript::c_iic049in_RunAnim, + InfomainScript::c_iic050in_RunAnim, + // Zero-terminated +}; + +// GLOBAL: LEGO1 0x100f7720 +InfomainScript::Script g_returnDialogueAct3[4] = { + InfomainScript::c_iic055in_RunAnim, + InfomainScript::c_iic056in_RunAnim, + InfomainScript::c_iic057in_RunAnim, + InfomainScript::c_iic058in_RunAnim +}; + +// GLOBAL: LEGO1 0x100f7730 +InfomainScript::Script g_leaveDialogueAct1[4] = { + InfomainScript::c_iic039in_PlayWav, + InfomainScript::c_iic040in_PlayWav, + InfomainScript::c_iic041in_PlayWav, + InfomainScript::c_iic042in_PlayWav +}; + +// GLOBAL: LEGO1 0x100f7740 +InfomainScript::Script g_leaveDialogueAct2[4] = { + InfomainScript::c_iic051in_PlayWav, + InfomainScript::c_iic052in_PlayWav, + InfomainScript::c_iic053in_PlayWav, + InfomainScript::c_iic054in_PlayWav +}; + +// GLOBAL: LEGO1 0x100f7750 +InfomainScript::Script g_leaveDialogueAct3[4] = { + InfomainScript::c_iic059in_PlayWav, + InfomainScript::c_iic060in_PlayWav, + InfomainScript::c_iic061in_PlayWav, + // Zero-terminated +}; + +// GLOBAL: LEGO1 0x100f7760 +InfomainScript::Script g_bricksterDialogue[2] = { + InfomainScript::c_sbleh2br_PlayWav, + InfomainScript::c_snshahbr_PlayWav +}; + // FUNCTION: LEGO1 0x1006ea20 Infocenter::Infocenter() { @@ -1462,3 +1545,45 @@ void Infocenter::StopBookAnimation() action.SetUnknown24(-2); DeleteObject(action); } + +// FUNCTION: LEGO1 0x10071600 +InfocenterState::InfocenterState() +{ + m_exitDialogueAct1 = LegoState::Playlist((MxU32*) g_exitDialogueAct1, sizeOfArray(g_exitDialogueAct1)); + m_exitDialogueAct23 = LegoState::Playlist((MxU32*) g_exitDialogueAct23, sizeOfArray(g_exitDialogueAct23) - 1); + + m_returnDialogue[LegoGameState::e_act1] = + LegoState::Playlist((MxU32*) g_returnDialogueAct1, sizeOfArray(g_returnDialogueAct1) - 1); + + m_returnDialogue[LegoGameState::e_act2] = + LegoState::Playlist((MxU32*) g_returnDialogueAct2, sizeOfArray(g_returnDialogueAct2) - 1); + + m_returnDialogue[LegoGameState::e_act3] = + LegoState::Playlist((MxU32*) g_returnDialogueAct3, sizeOfArray(g_returnDialogueAct3)); + + m_leaveDialogue[LegoGameState::e_act1] = + LegoState::Playlist((MxU32*) g_leaveDialogueAct1, sizeOfArray(g_leaveDialogueAct1)); + + m_leaveDialogue[LegoGameState::e_act2] = + LegoState::Playlist((MxU32*) g_leaveDialogueAct2, sizeOfArray(g_leaveDialogueAct2)); + + m_leaveDialogue[LegoGameState::e_act3] = + LegoState::Playlist((MxU32*) g_leaveDialogueAct3, sizeOfArray(g_leaveDialogueAct3) - 1); + + m_bricksterDialogue = LegoState::Playlist((MxU32*) g_bricksterDialogue, sizeOfArray(g_bricksterDialogue)); + + memset(m_letters, 0, sizeof(m_letters)); +} + +// FUNCTION: LEGO1 0x10071920 +InfocenterState::~InfocenterState() +{ + MxS16 i = 0; + do { + if (GetNameLetter(i) != NULL) { + delete GetNameLetter(i)->GetAction(); + delete GetNameLetter(i); + } + i++; + } while (i < GetMaxNameLength()); +} diff --git a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp index d433c337..a4afe604 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp @@ -1,6 +1,6 @@ #include "infocenterdoor.h" -#include "infocenterstate.h" +#include "infocenter.h" #include "infodoor_actions.h" #include "jukebox.h" #include "jukebox_actions.h" diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 2d5fee23..f643cc94 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -1,16 +1,15 @@ #include "isle.h" #include "3dmanager/lego3dmanager.h" -#include "act1state.h" #include "ambulance.h" #include "bike.h" -#include "carracestate.h" +#include "carrace.h" #include "dunebuggy.h" #include "helicopter.h" #include "isle_actions.h" #include "islepathactor.h" #include "jetski.h" -#include "jetskiracestate.h" +#include "jetskirace.h" #include "jukebox_actions.h" #include "jukeboxentity.h" #include "legoanimationmanager.h" @@ -18,6 +17,7 @@ #include "legocontrolmanager.h" #include "legoinputmanager.h" #include "legomain.h" +#include "legonamedtexture.h" #include "legoutils.h" #include "legovariables.h" #include "legovideomanager.h" @@ -37,11 +37,20 @@ #include "skateboard.h" #include "towtrack.h" +DECOMP_SIZE_ASSERT(Act1State, 0x26c) +DECOMP_SIZE_ASSERT(Act1State::NamedPlane, 0x4c) DECOMP_SIZE_ASSERT(Isle, 0x140) // GLOBAL: LEGO1 0x100f1198 MxU32 g_isleFlags = 0x7f; +// GLOBAL: ISLE 0x100f37f0 +MxS32 g_unk0x100f37f0[] = { + Act1State::e_unk953, + Act1State::e_unk954, + Act1State::e_unk955, +}; + // FUNCTION: LEGO1 0x10030820 Isle::Isle() { @@ -1271,3 +1280,283 @@ void Isle::FUN_10033350() m_destLocation = LegoGameState::e_infomain; } + +// STUB: LEGO1 0x100334b0 +Act1State::Act1State() : m_unk0x00c(0), m_unk0x00e(0), m_unk0x008(NULL), m_unk0x010(0) +{ + m_unk0x01e = FALSE; + m_unk0x018 = 1; + m_unk0x010 = 0; + m_planeActive = FALSE; + m_unk0x00e = 0; + m_unk0x01f = FALSE; + m_unk0x008 = g_unk0x100f37f0; + m_unk0x014 = -1; + m_unk0x022 = FALSE; + m_unk0x154 = NULL; + m_unk0x158 = NULL; + m_unk0x15c = NULL; + m_unk0x160 = NULL; + m_unk0x1b0 = NULL; + m_unk0x021 = 1; + m_elevFloor = Act1State::c_floor1; + m_unk0x00c = sizeOfArray(g_unk0x100f37f0); + m_unk0x1b4 = NULL; + m_unk0x1b8 = NULL; + m_unk0x208 = NULL; + m_unk0x20c = NULL; + m_unk0x25c = NULL; + m_unk0x260 = NULL; + m_unk0x264 = NULL; + m_unk0x268 = NULL; + SetFlag(); +} + +// FUNCTION: LEGO1 0x10033ac0 +MxResult Act1State::Serialize(LegoFile* p_legoFile) +{ + LegoState::Serialize(p_legoFile); + + m_unk0x024.Serialize(p_legoFile); + m_unk0x070.Serialize(p_legoFile); + m_unk0x0bc.Serialize(p_legoFile); + m_unk0x108.Serialize(p_legoFile); + m_unk0x164.Serialize(p_legoFile); + m_unk0x1bc.Serialize(p_legoFile); + m_unk0x210.Serialize(p_legoFile); + + if (p_legoFile->IsWriteMode()) { + if (m_unk0x108.GetName()->Compare("") != 0) { + if (m_unk0x154) { + WriteNamedTexture(p_legoFile, m_unk0x154); + } + else { + FUN_1003f540(p_legoFile, "chwind.gif"); + } + if (m_unk0x158) { + WriteNamedTexture(p_legoFile, m_unk0x158); + } + else { + FUN_1003f540(p_legoFile, "chjetl.gif"); + } + if (m_unk0x15c) { + WriteNamedTexture(p_legoFile, m_unk0x15c); + } + else { + FUN_1003f540(p_legoFile, "chjetr.gif"); + } + } + if (m_unk0x164.GetName()->Compare("") != 0) { + if (m_unk0x1b0) { + WriteNamedTexture(p_legoFile, m_unk0x1b0); + } + else { + FUN_1003f540(p_legoFile, "jsfrnt.gif"); + } + if (m_unk0x1b4) { + WriteNamedTexture(p_legoFile, m_unk0x1b4); + } + else { + FUN_1003f540(p_legoFile, "jswnsh.gif"); + } + } + if (m_unk0x1bc.GetName()->Compare("") != 0) { + if (m_unk0x208) { + WriteNamedTexture(p_legoFile, m_unk0x208); + } + else { + FUN_1003f540(p_legoFile, "dbfrfn.gif"); + } + } + if (m_unk0x210.GetName()->Compare("") != 0) { + if (m_unk0x25c) { + WriteNamedTexture(p_legoFile, m_unk0x25c); + } + else { + FUN_1003f540(p_legoFile, "rcfrnt.gif"); + } + if (m_unk0x260) { + WriteNamedTexture(p_legoFile, m_unk0x260); + } + else { + FUN_1003f540(p_legoFile, "rcback.gif"); + } + if (m_unk0x264) { + WriteNamedTexture(p_legoFile, m_unk0x264); + } + else { + FUN_1003f540(p_legoFile, "rctail.gif"); + } + } + + p_legoFile->Write(&m_unk0x010, sizeof(m_unk0x010)); + p_legoFile->Write(&m_unk0x022, sizeof(m_unk0x022)); + } + else if (p_legoFile->IsReadMode()) { + if (m_unk0x108.GetName()->Compare("") != 0) { + m_unk0x154 = ReadNamedTexture(p_legoFile); + if (m_unk0x154 == NULL) { + return FAILURE; + } + + m_unk0x158 = ReadNamedTexture(p_legoFile); + if (m_unk0x158 == NULL) { + return FAILURE; + } + + m_unk0x15c = ReadNamedTexture(p_legoFile); + if (m_unk0x15c == NULL) { + return FAILURE; + } + } + if (m_unk0x164.GetName()->Compare("") != 0) { + m_unk0x1b0 = ReadNamedTexture(p_legoFile); + if (m_unk0x1b0 == NULL) { + return FAILURE; + } + + m_unk0x1b4 = ReadNamedTexture(p_legoFile); + if (m_unk0x1b4 == NULL) { + return FAILURE; + } + } + if (m_unk0x1bc.GetName()->Compare("") != 0) { + m_unk0x208 = ReadNamedTexture(p_legoFile); + if (m_unk0x208 == NULL) { + return FAILURE; + } + } + if (m_unk0x210.GetName()->Compare("") != 0) { + m_unk0x25c = ReadNamedTexture(p_legoFile); + if (m_unk0x25c == NULL) { + return FAILURE; + } + + m_unk0x260 = ReadNamedTexture(p_legoFile); + if (m_unk0x260 == NULL) { + return FAILURE; + } + + m_unk0x264 = ReadNamedTexture(p_legoFile); + if (m_unk0x264 == NULL) { + return FAILURE; + } + } + + p_legoFile->Read(&m_unk0x010, sizeof(m_unk0x010)); + p_legoFile->Read(&m_unk0x022, sizeof(m_unk0x022)); + } + + // TODO + return SUCCESS; +} + +// STUB: LEGO1 0x10034660 +void Act1State::FUN_10034660() +{ + // TODO +} + +// FUNCTION: LEGO1 0x100346a0 +void Act1State::FUN_100346a0() +{ + if (m_unk0x014 != -1) { + InvokeAction(Extra::e_stop, *g_isleScript, m_unk0x014, NULL); + m_unk0x014 = -1; + } +} + +// FUNCTION: LEGO1 0x100346d0 +MxBool Act1State::SetFlag() +{ + m_unk0x024.SetName(""); + m_unk0x070.SetName(""); + m_unk0x0bc.SetName(""); + m_unk0x022 = FALSE; + m_unk0x108.SetName(""); + + if (m_unk0x154) { + delete m_unk0x154; + m_unk0x154 = NULL; + } + + if (m_unk0x158) { + delete m_unk0x158; + m_unk0x158 = NULL; + } + + if (m_unk0x15c) { + delete m_unk0x15c; + m_unk0x15c = NULL; + } + + if (m_unk0x160) { + delete m_unk0x160; + m_unk0x160 = NULL; + } + + m_unk0x164.SetName(""); + + if (m_unk0x1b0) { + delete m_unk0x1b0; + m_unk0x1b0 = NULL; + } + + if (m_unk0x1b4) { + delete m_unk0x1b4; + m_unk0x1b4 = NULL; + } + + if (m_unk0x1b8) { + delete m_unk0x1b8; + m_unk0x1b8 = NULL; + } + + m_unk0x1bc.SetName(""); + + if (m_unk0x208) { + delete m_unk0x208; + m_unk0x208 = NULL; + } + + if (m_unk0x20c) { + delete m_unk0x20c; + m_unk0x20c = NULL; + } + + m_unk0x210.SetName(""); + + if (m_unk0x25c) { + delete m_unk0x25c; + m_unk0x25c = NULL; + } + + if (m_unk0x260) { + delete m_unk0x260; + m_unk0x260 = NULL; + } + + if (m_unk0x264) { + delete m_unk0x264; + m_unk0x264 = NULL; + } + + if (m_unk0x268) { + delete m_unk0x268; + m_unk0x268 = NULL; + } + + return TRUE; +} + +// STUB: LEGO1 0x10034b60 +void Act1State::FUN_10034b60() +{ + // TODO +} + +// STUB: LEGO1 0x10034d00 +void Act1State::FUN_10034d00() +{ + // TODO +} diff --git a/LEGO1/lego/legoomni/src/worlds/jukebox.cpp b/LEGO1/lego/legoomni/src/worlds/jukebox.cpp index 5cb59794..57c30be3 100644 --- a/LEGO1/lego/legoomni/src/worlds/jukebox.cpp +++ b/LEGO1/lego/legoomni/src/worlds/jukebox.cpp @@ -1,8 +1,7 @@ #include "jukebox.h" -#include "act1state.h" +#include "isle.h" #include "jukebox_actions.h" -#include "jukeboxstate.h" #include "jukeboxw_actions.h" #include "legocontrolmanager.h" #include "legogamestate.h" @@ -17,6 +16,7 @@ #include "mxvideopresenter.h" DECOMP_SIZE_ASSERT(JukeBox, 0x104) +DECOMP_SIZE_ASSERT(JukeBoxState, 0x10) // FUNCTION: LEGO1 0x1005d660 JukeBox::JukeBox() diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index cc108d10..eb44f2b0 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -1,6 +1,7 @@ #include "legoact2.h" DECOMP_SIZE_ASSERT(LegoAct2, 0x1154) +DECOMP_SIZE_ASSERT(LegoAct2State, 0x10) // FUNCTION: LEGO1 0x1004fe10 MxBool LegoAct2::VTable0x5c() diff --git a/LEGO1/lego/legoomni/src/worlds/police.cpp b/LEGO1/lego/legoomni/src/worlds/police.cpp index 897fa52c..a20f5163 100644 --- a/LEGO1/lego/legoomni/src/worlds/police.cpp +++ b/LEGO1/lego/legoomni/src/worlds/police.cpp @@ -13,9 +13,10 @@ #include "mxnotificationmanager.h" #include "mxtransitionmanager.h" #include "police_actions.h" -#include "policestate.h" +#include "scripts.h" DECOMP_SIZE_ASSERT(Police, 0x110) +DECOMP_SIZE_ASSERT(PoliceState, 0x10) // FUNCTION: LEGO1 0x1005e130 Police::Police() @@ -196,3 +197,60 @@ MxBool Police::Escape() m_destLocation = LegoGameState::e_infomain; return TRUE; } + +// FUNCTION: LEGO1 0x1005e7c0 +PoliceState::PoliceState() +{ + m_unk0x0c = 0; + m_policeScript = (rand() % 2 == 0) ? PoliceScript::c_nps002la_RunAnim : PoliceScript::c_nps001ni_RunAnim; +} + +// FUNCTION: LEGO1 0x1005e990 +MxResult PoliceState::Serialize(LegoFile* p_legoFile) +{ + LegoState::Serialize(p_legoFile); + + if (p_legoFile->IsReadMode()) { + p_legoFile->Read(&m_policeScript, sizeof(m_policeScript)); + } + else { + PoliceScript::Script policeScript = m_policeScript; + p_legoFile->Write(&policeScript, sizeof(m_policeScript)); + } + + return SUCCESS; +} + +// FUNCTION: LEGO1 0x1005ea40 +void PoliceState::FUN_1005ea40() +{ + PoliceScript::Script policeScript; + + if (m_unk0x0c == 1) { + return; + } + + switch (CurrentActor()->GetActorId()) { + case 4: + policeScript = PoliceScript::c_nps002la_RunAnim; + m_policeScript = policeScript; + break; + case 5: + policeScript = PoliceScript::c_nps001ni_RunAnim; + m_policeScript = policeScript; + break; + default: + policeScript = m_policeScript; + m_policeScript = policeScript == PoliceScript::c_nps002la_RunAnim ? PoliceScript::c_nps001ni_RunAnim + : PoliceScript::c_nps002la_RunAnim; + } + + { + MxDSAction action; + action.SetObjectId(policeScript); + action.SetAtomId(*g_policeScript); + Start(&action); + } + + m_unk0x0c = 1; +} diff --git a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp index 803074d8..414f4faa 100644 --- a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp @@ -1,6 +1,6 @@ #include "registrationbook.h" -#include "infocenterstate.h" +#include "infocenter.h" #include "jukebox_actions.h" #include "legocontrolmanager.h" #include "legogamestate.h" diff --git a/LEGO1/lego/legoomni/src/worlds/score.cpp b/LEGO1/lego/legoomni/src/worlds/score.cpp index a4ff3621..1482e253 100644 --- a/LEGO1/lego/legoomni/src/worlds/score.cpp +++ b/LEGO1/lego/legoomni/src/worlds/score.cpp @@ -1,9 +1,10 @@ #include "score.h" -#include "ambulancemissionstate.h" -#include "carracestate.h" +#include "ambulance.h" +#include "carrace.h" #include "infoscor_actions.h" -#include "jetskiracestate.h" +#include "jetski.h" +#include "jetskirace.h" #include "jukebox.h" #include "jukebox_actions.h" #include "legocontrolmanager.h" @@ -17,13 +18,12 @@ #include "mxnotificationmanager.h" #include "mxnotificationparam.h" #include "mxtransitionmanager.h" -#include "pizzamissionstate.h" -#include "racestate.h" -#include "scorestate.h" +#include "pizza.h" #include "scripts.h" -#include "towtrackmissionstate.h" +#include "towtrack.h" DECOMP_SIZE_ASSERT(Score, 0x104) +DECOMP_SIZE_ASSERT(ScoreState, 0x0c) // FUNCTION: LEGO1 0x10001000 Score::Score() From 4898a55508d5a51c88840271685a6811fca051b8 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 4 Jun 2024 12:05:01 -0400 Subject: [PATCH 03/12] Match LegoCacheSoundManager::FindSoundByKey (#991) * Match LegoCacheSoundManager::FindSoundByKey * Remove space --- .../src/audio/legocachesoundmanager.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp b/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp index 36445ce7..c18d5dcb 100644 --- a/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp +++ b/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp @@ -60,18 +60,15 @@ MxResult LegoCacheSoundManager::Tickle() return SUCCESS; } -// STUB: LEGO1 0x1003d170 +// FUNCTION: LEGO1 0x1003d170 LegoCacheSound* LegoCacheSoundManager::FindSoundByKey(const char* p_key) { - // TODO - char* x = new char[strlen(p_key) + 1]; - strcpy(x, p_key); + char* key = new char[strlen(p_key) + 1]; + strcpy(key, p_key); - Set100d6b4c::iterator setIter; - for (setIter = m_set.begin(); setIter != m_set.end(); setIter++) { - if (!strcmpi((*setIter).GetName(), x)) { - return (*setIter).GetSound(); - } + Set100d6b4c::iterator it = m_set.find(LegoCacheSoundEntry(NULL, key)); + if (it != m_set.end()) { + return (*it).GetSound(); } return NULL; @@ -104,12 +101,14 @@ LegoCacheSound* LegoCacheSoundManager::ManageSoundEntry(LegoCacheSound* p_sound) } // FUNCTION: LEGO1 0x1003dae0 +// FUNCTION: BETA10 0x10065502 LegoCacheSound* LegoCacheSoundManager::Play(const char* p_key, const char* p_name, MxBool p_looping) { return Play(FindSoundByKey(p_key), p_name, p_looping); } // FUNCTION: LEGO1 0x1003db10 +// FUNCTION: BETA10 0x10065537 LegoCacheSound* LegoCacheSoundManager::Play(LegoCacheSound* p_sound, const char* p_name, MxBool p_looping) { if (!p_sound) { From 0c7c77aad37ed2af1ac7c99fbc9ba7cb8c9715f9 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 4 Jun 2024 12:19:59 -0400 Subject: [PATCH 04/12] Implement/match LegoActor::Mute (#992) --- LEGO1/lego/legoomni/include/legoactor.h | 2 +- LEGO1/lego/legoomni/include/legocachsound.h | 3 ++- .../lego/legoomni/src/audio/legocachsound.cpp | 20 +++++++++++++++++-- LEGO1/lego/legoomni/src/entity/legoactor.cpp | 10 ++++++---- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoactor.h b/LEGO1/lego/legoomni/include/legoactor.h index 267de5a0..026f5885 100644 --- a/LEGO1/lego/legoomni/include/legoactor.h +++ b/LEGO1/lego/legoomni/include/legoactor.h @@ -53,7 +53,7 @@ class LegoActor : public LegoEntity { static const char* GetActorName(MxU8 p_id); protected: - void FUN_1002d6e0(MxBool); + void Mute(MxBool p_muted); MxFloat m_frequencyFactor; // 0x68 LegoCacheSound* m_sound; // 0x6c diff --git a/LEGO1/lego/legoomni/include/legocachsound.h b/LEGO1/lego/legoomni/include/legocachsound.h index b80ded36..de312a93 100644 --- a/LEGO1/lego/legoomni/include/legocachsound.h +++ b/LEGO1/lego/legoomni/include/legocachsound.h @@ -44,6 +44,7 @@ class LegoCacheSound : public MxCore { void FUN_10006b80(); void FUN_10006be0(); void SetDistance(MxS32 p_min, MxS32 p_max); + void Mute(MxBool p_mute); // SYNTHETIC: LEGO1 0x10006610 // LegoCacheSound::`scalar deleting destructor' @@ -66,7 +67,7 @@ class LegoCacheSound : public MxCore { MxS32 m_volume; // 0x6c MxBool m_unk0x70; // 0x70 MxString m_unk0x74; // 0x74 - undefined m_unk0x84; // 0x84 + MxBool m_muted; // 0x84 }; #endif // LEGOCACHSOUND_H diff --git a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp index 457e51f4..7665e5d7 100644 --- a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp +++ b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp @@ -29,7 +29,7 @@ void LegoCacheSound::Init() m_unk0x70 = FALSE; m_looping = TRUE; m_volume = 79; - m_unk0x84 = 0; + m_muted = FALSE; } // FUNCTION: LEGO1 0x10006710 @@ -226,7 +226,7 @@ void LegoCacheSound::FUN_10006be0() } } - if (m_unk0x74.GetLength() != 0 && !m_unk0x84) { + if (m_unk0x74.GetLength() != 0 && !m_muted) { if (!m_sound.UpdatePosition(m_dsBuffer)) { if (m_unk0x6a) { return; @@ -253,6 +253,22 @@ void LegoCacheSound::FUN_10006cd0(undefined4, undefined4) { } +// FUNCTION: LEGO1 0x10006d40 +// FUNCTION: BETA10 0x10066ec8 +void LegoCacheSound::Mute(MxBool p_muted) +{ + if (m_muted != p_muted) { + m_muted = p_muted; + + if (m_muted) { + m_dsBuffer->Stop(); + } + else { + m_dsBuffer->Play(0, 0, m_looping); + } + } +} + // FUNCTION: LEGO1 0x10006d80 // FUNCTION: BETA10 0x100670e7 MxString LegoCacheSound::FUN_10006d80(const MxString& p_str) diff --git a/LEGO1/lego/legoomni/src/entity/legoactor.cpp b/LEGO1/lego/legoomni/src/entity/legoactor.cpp index d7d79e1a..2377302e 100644 --- a/LEGO1/lego/legoomni/src/entity/legoactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoactor.cpp @@ -107,7 +107,7 @@ void LegoActor::ParseAction(char* p_extra) } if (KeyValueStringParse(value, g_strMUTE, p_extra)) { - FUN_1002d6e0(TRUE); + Mute(TRUE); } if (KeyValueStringParse(value, g_strVISIBILITY, p_extra)) { @@ -139,8 +139,10 @@ void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) LegoEntity::SetROI(p_roi, p_bool1, p_bool2); } -// STUB: LEGO1 0x1002d6e0 -void LegoActor::FUN_1002d6e0(MxBool) +// FUNCTION: LEGO1 0x1002d6e0 +void LegoActor::Mute(MxBool p_muted) { - // TODO + if (m_sound != NULL) { + m_sound->Mute(p_muted); + } } From 6e7e9a3f20e73e1791ca8488e37368f8d873ff52 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 5 Jun 2024 06:31:23 -0400 Subject: [PATCH 05/12] Add more annotations to ISLE (#990) * Minor improvements in ISLE.EXE * Add more annotations * Fix * Comment out * Fix lint --- ISLE/isleapp.cpp | 20 +- ISLE/library_msvc.h | 288 ++++++++++++++++++++++++ LEGO1/lego/legoomni/src/worlds/isle.cpp | 2 +- 3 files changed, 295 insertions(+), 15 deletions(-) diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index dc087d57..9b2a6512 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -164,16 +164,10 @@ void IsleApp::Close() TransitionManager()->SetWaitIndicator(NULL); Lego()->StopTimer(); - MxLong lVar8; - do { - lVar8 = Streamer()->Close(NULL); - } while (lVar8 == 0); - - while (Lego()) { - if (Lego()->DoesEntityExist(ds)) { - break; - } + while (Streamer()->Close(NULL) == SUCCESS) { + } + while (Lego() && !Lego()->DoesEntityExist(ds)) { Timer()->GetRealTime(); TickleManager()->Tickle(); } @@ -404,9 +398,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return DefWindowProcA(hWnd, uMsg, wParam, lParam); case WM_CLOSE: if (!g_closed && g_isle) { - if (g_isle) { - delete g_isle; - } + delete g_isle; g_isle = NULL; g_closed = TRUE; return 0; @@ -646,8 +638,8 @@ MxResult IsleApp::SetupWindow(HINSTANCE hInstance, LPSTR lpCmdLine) } GameState()->SetSavePath(m_savePath); - GameState()->SerializePlayersInfo(1); - GameState()->SerializeScoreHistory(1); + GameState()->SerializePlayersInfo(LegoStorage::c_read); + GameState()->SerializeScoreHistory(LegoStorage::c_read); int iVar10; switch (m_islandQuality) { diff --git a/ISLE/library_msvc.h b/ISLE/library_msvc.h index a837fd3b..b65591d6 100644 --- a/ISLE/library_msvc.h +++ b/ISLE/library_msvc.h @@ -18,6 +18,18 @@ // LIBRARY: ISLE 0x407ec0 // ___CxxFrameHandler +// LIBRARY: ISLE 0x4080ec +// __global_unwind2 + +// LIBRARY: ISLE 0x40812e +// __local_unwind2 + +// LIBRARY: ISLE 0x4081b9 +// __NLG_Notify1 + +// LIBRARY: ISLE 0x4081c2 +// __NLG_Notify + // LIBRARY: ISLE 0x4081e0 // _srand @@ -30,6 +42,9 @@ // LIBRARY: ISLE 0x4082d0 // _atoi +// LIBRARY: ISLE 0x408490 +// __amsg_exit + // LIBRARY: ISLE 0x4084c0 // ?_query_new_handler@@YAP6AHI@ZXZ @@ -42,22 +57,295 @@ // LIBRARY: ISLE 0x408630 // _abort +// LIBRARY: ISLE 0x408650 +// ___InternalCxxFrameHandler + +// LIBRARY: ISLE 0x408b30 +// ___FrameUnwindToState + +// LIBRARY: ISLE 0x4090c0 +// __CallSettingFrame@12 + // LIBRARY: ISLE 0x409110 // __mtinit +// LIBRARY: ISLE 0x409170 +// __initptd + // LIBRARY: ISLE 0x409190 // __getptd +// LIBRARY: ISLE 0x409200 +// __isctype + +// LIBRARY: ISLE 0x4092e0 +// ?terminate@@YAXXZ + +// LIBRARY: ISLE 0x409360 +// ?_inconsistency@@YAXXZ + +// LIBRARY: ISLE 0x4093e0 +// __cinit + +// LIBRARY: ISLE 0x409410 +// _exit + +// LIBRARY: ISLE 0x409430 +// __exit + +// LIBRARY: ISLE 0x409550 +// __XcptFilter + +// LIBRARY: ISLE 0x4096d0 +// __ismbblead + +// LIBRARY: ISLE 0x409730 +// __setenvp + +// LIBRARY: ISLE 0x409820 +// __setargv + +// LIBRARY: ISLE 0x409a90 +// ___crtGetEnvironmentStringsA + +// LIBRARY: ISLE 0x409c20 +// __setmbcp + +// LIBRARY: ISLE 0x409f30 +// ___initmbctable + +// LIBRARY: ISLE 0x409f40 +// __ioinit + +// LIBRARY: ISLE 0x40a120 +// __heap_init + +// LIBRARY: ISLE 0x40a160 +// __FF_MSGBANNER + +// LIBRARY: ISLE 0x40a1a0 +// __NMSG_WRITE + +// LIBRARY: ISLE 0x40a3a0 +// __mtinitlocks + +// LIBRARY: ISLE 0x40a3d0 +// __lock + +// LIBRARY: ISLE 0x40a440 +// __unlock + +// LIBRARY: ISLE 0x40a540 +// __flsbuf + +// LIBRARY: ISLE 0x40a690 +// __output + +// LIBRARY: ISLE 0x40b090 +// _write_multi_char + +// LIBRARY: ISLE 0x40b0d0 +// _write_string + +// LIBRARY: ISLE 0x40b150 +// _raise + +// LIBRARY: ISLE 0x40b780 +// ___crtGetStringTypeA + +// LIBRARY: ISLE 0x40b8b0 +// ___sbh_new_region + +// LIBRARY: ISLE 0x40ba20 +// ___crtMessageBoxA + +// LIBRARY: ISLE 0x40bac0 +// _strncpy + +// LIBRARY: ISLE 0x40bcb0 +// __write + +// LIBRARY: ISLE 0x40bd30 +// __write_lk + +// LIBRARY: ISLE 0x40bf30 +// __lseek + +// LIBRARY: ISLE 0x40bfb0 +// __lseek_lk + +// LIBRARY: ISLE 0x40c040 +// __getbuf + +// LIBRARY: ISLE 0x40c090 +// __isatty + +// LIBRARY: ISLE 0x40c0c0 +// _wctomb + +// LIBRARY: ISLE 0x40c120 +// __wctomb_lk + +// LIBRARY: ISLE 0x40c1c0 +// __aulldiv + +// LIBRARY: ISLE 0x40c230 +// __aullrem + +// LIBRARY: ISLE 0x40c2b0 +// __dosmaperr + +// LIBRARY: ISLE 0x40c330 +// __errno + +// LIBRARY: ISLE 0x40c340 +// ___doserrno + +// LIBRARY: ISLE 0x40c710 +// __get_osfhandle + +// LIBRARY: ISLE 0x40c760 +// __lock_fhandle + +// LIBRARY: ISLE 0x40c7d0 +// __unlock_fhandle + +// LIBRARY: ISLE 0x40c810 +// __fptrap + +// GLOBAL: ISLE 0x40f448 +// ___lookuptable + +// GLOBAL: ISLE 0x410000 +// ___xc_a + +// GLOBAL: ISLE 0x410008 +// ___xc_z + +// GLOBAL: ISLE 0x41000c +// ___xi_a + +// GLOBAL: ISLE 0x410018 +// ___xi_z + +// GLOBAL: ISLE 0x41068c +// __NLG_Destination + +// GLOBAL: ISLE 0x41069c +// __aenvptr + +// GLOBAL: ISLE 0x4106a8 +// ___error_mode + +// GLOBAL: ISLE 0x4106ac +// ___app_type + +// GLOBAL: ISLE 0x4106c0 +// ___tlsindex + +// GLOBAL: ISLE 0x4106c8 +// __pctype + +// GLOBAL: ISLE 0x4108d4 +// ___mb_cur_max + +// GLOBAL: ISLE 0x4108e0 +// ?__pInconsistency@@3P6AXXZA + // GLOBAL: ISLE 0x4108e8 // __osver +// GLOBAL: ISLE 0x4108ec +// __winver + // GLOBAL: ISLE 0x4108f0 // __winmajor // GLOBAL: ISLE 0x4108f4 // __winminor +// GLOBAL: ISLE 0x4108f8 +// ___argc + +// GLOBAL: ISLE 0x4108fc +// ___argv + +// GLOBAL: ISLE 0x410904 +// __environ + +// GLOBAL: ISLE 0x410914 +// __pgmptr + +// GLOBAL: ISLE 0x410928 +// __XcptActTab + +// GLOBAL: ISLE 0x4109a0 +// __First_FPE_Indx + +// GLOBAL: ISLE 0x4109a4 +// __Num_FPE + +// GLOBAL: ISLE 0x4109b8 +// __mbctype + +// GLOBAL: ISLE 0x410abc +// ___mbcodepage + +// GLOBAL: ISLE 0x410ac0 +// ___mblcid + +// GLOBAL: ISLE 0x410ac8 +// ___mbulinfo + +// GLOBAL: ISLE 0x410bd0 +// ___badioinfo + +// GLOBAL: ISLE 0x410c88 +// __adbgmsg + +// GLOBAL: ISLE 0x410c90 +// __locktable + // GLOBAL: ISLE 0x410d50 // __newmode +// GLOBAL: ISLE 0x410d54 +// ___nullstring + +// GLOBAL: ISLE 0x410d58 +// ___wnullstring + +// GLOBAL: ISLE 0x410d90 +// ___lc_codepage + +// GLOBAL: ISLE 0x410d98 +// ___small_block_heap + +// GLOBAL: ISLE 0x411850 +// __cflush + +// XGLOBAL ISLE 0x4125f8 +// ?_pnhHeap@@3P6AHI@ZA + +// GLOBAL: ISLE 0x412888 +// ___setlc_active + +// GLOBAL: ISLE 0x41288c +// ___unguarded_readlc_active + +// GLOBAL: ISLE 0x4138a4 +// __crtheap + +// GLOBAL: ISLE 0x4138b0 +// ___pioinfo + +// GLOBAL: ISLE 0x4139b0 +// __nhandle + +// GLOBAL: ISLE 0x4139bc +// __FPinit + +// GLOBAL: ISLE 0x4139c0 +// __acmdln + #endif diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index f643cc94..1e8ea520 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -44,7 +44,7 @@ DECOMP_SIZE_ASSERT(Isle, 0x140) // GLOBAL: LEGO1 0x100f1198 MxU32 g_isleFlags = 0x7f; -// GLOBAL: ISLE 0x100f37f0 +// GLOBAL: LEGO1 0x100f37f0 MxS32 g_unk0x100f37f0[] = { Act1State::e_unk953, Act1State::e_unk954, From 6a9f68872b0bc43d4f20298cdfaf1cc6b0aca9b9 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 5 Jun 2024 12:11:46 -0400 Subject: [PATCH 06/12] Add enum for actor IDs (#993) --- LEGO1/lego/legoomni/include/legoactor.h | 10 ++++++ .../src/common/legoanimationmanager.cpp | 8 ++--- LEGO1/lego/legoomni/src/entity/legoentity.cpp | 12 +++---- .../lego/legoomni/src/paths/legopathactor.cpp | 12 +++---- LEGO1/lego/legoomni/src/worlds/gasstation.cpp | 12 +++---- LEGO1/lego/legoomni/src/worlds/hospital.cpp | 34 +++++++++---------- LEGO1/lego/legoomni/src/worlds/infocenter.cpp | 12 +++---- .../legoomni/src/worlds/infocenterdoor.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/police.cpp | 4 +-- 10 files changed, 59 insertions(+), 49 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoactor.h b/LEGO1/lego/legoomni/include/legoactor.h index 026f5885..64f4aae3 100644 --- a/LEGO1/lego/legoomni/include/legoactor.h +++ b/LEGO1/lego/legoomni/include/legoactor.h @@ -10,6 +10,16 @@ class LegoCacheSound; // SIZE 0x78 class LegoActor : public LegoEntity { public: + enum { + c_none = 0, + c_pepper, + c_mama, + c_papa, + c_nick, + c_laura, + c_brickster + }; + LegoActor(); ~LegoActor() override; diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index f1915ef9..8b8b30fa 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1496,7 +1496,7 @@ MxResult LegoAnimationManager::Tickle() MxU8 unk0x0c = 0; MxU8 actorId = GameState()->GetActorId(); - if (actorId <= 5) { + if (actorId <= LegoActor::c_laura) { unk0x0c = g_unk0x100d8b28[actorId]; } @@ -1762,7 +1762,7 @@ MxBool LegoAnimationManager::FUN_10062710(AnimInfo& p_info) MxU8 und = 0; MxU8 actorId = GameState()->GetActorId(); - if (actorId <= 5) { + if (actorId <= LegoActor::c_laura) { und = g_unk0x100d8b28[actorId]; } @@ -2712,11 +2712,11 @@ MxResult LegoAnimationManager::FUN_10064740(Vector3* p_position) } if (success) { - if (GameState()->GetActorId() != 2) { + if (GameState()->GetActorId() != LegoActor::c_mama) { FUN_10064380("mama", "USR00_47", 1, 0.43f, 3, 0.84f, rand() % 3 + 13, -1, rand() % 3, -1, 0.7f); } - if (GameState()->GetActorId() != 3) { + if (GameState()->GetActorId() != LegoActor::c_papa) { FUN_10064380("papa", "USR00_193", 3, 0.55f, 1, 0.4f, rand() % 3 + 13, -1, rand() % 3, -1, 0.9f); } diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index de931cd2..cb426fac 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -346,25 +346,25 @@ MxLong LegoEntity::Notify(MxParam& p_param) } else { switch (GameState()->GetActorId()) { - case 1: + case LegoActor::c_pepper: if (GameState()->GetCurrentAct() != LegoGameState::e_act2 && GameState()->GetCurrentAct() != LegoGameState::e_act3) { VTable0x3c(); } break; - case 2: + case LegoActor::c_mama: VTable0x40(); break; - case 3: + case LegoActor::c_papa: VTable0x44(); break; - case 4: + case LegoActor::c_nick: VTable0x48(param.GetROI()); break; - case 5: + case LegoActor::c_laura: VTable0x4c(); break; - case 6: + case LegoActor::c_brickster: switch (m_type) { case e_actor: case e_unk1: diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 454f04fb..6990f1dd 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -675,24 +675,24 @@ MxResult LegoPathActor::VTable0x9c() void LegoPathActor::VTable0xa4(MxBool& p_und1, MxS32& p_und2) { switch (GetActorId()) { - case 1: + case c_pepper: p_und1 = TRUE; p_und2 = 2; break; - case 2: + case c_mama: p_und1 = FALSE; p_und2 = 1; break; - case 3: + case c_papa: p_und1 = TRUE; p_und2 = 1; break; - case 4: - case 6: + case c_nick: + case c_brickster: p_und1 = TRUE; p_und2 = rand() % p_und2 + 1; break; - case 5: + case c_laura: p_und1 = FALSE; p_und2 = 2; break; diff --git a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp index 82ef467b..10debbd7 100644 --- a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp +++ b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp @@ -31,7 +31,7 @@ MxBool g_trackLedEnabled = FALSE; // FUNCTION: LEGO1 0x100046a0 GasStation::GasStation() { - m_currentActorId = 0; + m_currentActorId = LegoActor::c_none; m_state = NULL; m_destLocation = LegoGameState::e_undefined; m_trackLedBitmap = NULL; @@ -134,7 +134,7 @@ void GasStation::ReadyWorld() m_currentActorId = CurrentActor()->GetActorId(); switch (m_currentActorId) { - case 1: + case LegoActor::c_pepper: switch (m_state->m_unk0x18) { case 0: m_state->m_unk0x14.m_unk0x00 = 5; @@ -165,7 +165,7 @@ void GasStation::ReadyWorld() FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; - case 2: + case LegoActor::c_mama: switch (m_state->m_unk0x1a) { case 0: m_state->m_unk0x14.m_unk0x00 = 5; @@ -191,7 +191,7 @@ void GasStation::ReadyWorld() FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; - case 3: + case LegoActor::c_papa: switch (m_state->m_unk0x1c) { case 0: m_state->m_unk0x14.m_unk0x00 = 5; @@ -217,7 +217,7 @@ void GasStation::ReadyWorld() FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; - case 4: + case LegoActor::c_nick: switch (m_state->m_unk0x1e) { case 0: m_state->m_unk0x14.m_unk0x00 = 5; @@ -243,7 +243,7 @@ void GasStation::ReadyWorld() FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); break; - case 5: + case LegoActor::c_laura: switch (m_state->m_unk0x20) { case 0: m_state->m_unk0x14.m_unk0x00 = 5; diff --git a/LEGO1/lego/legoomni/src/worlds/hospital.cpp b/LEGO1/lego/legoomni/src/worlds/hospital.cpp index c715bcf6..8cd8ae92 100644 --- a/LEGO1/lego/legoomni/src/worlds/hospital.cpp +++ b/LEGO1/lego/legoomni/src/worlds/hospital.cpp @@ -35,7 +35,7 @@ MxBool g_pizzaLedEnabled = FALSE; // FUNCTION: LEGO1 0x100745e0 Hospital::Hospital() { - m_currentActorId = 0; + m_currentActorId = LegoActor::c_none; m_unk0x100 = 0; m_hospitalState = NULL; m_unk0x108 = 0; @@ -145,14 +145,14 @@ void Hospital::ReadyWorld() m_pizzaLedBitmap = (MxStillPresenter*) Find("MxStillPresenter", "PizzaLed_Bitmap"); if (CurrentActor() == NULL) { - m_currentActorId = 5; + m_currentActorId = LegoActor::c_laura; } else { m_currentActorId = CurrentActor()->GetActorId(); } switch (m_currentActorId) { - case 1: + case LegoActor::c_pepper: m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x0e; if (m_hospitalState->m_unk0x0e < 5) { @@ -160,7 +160,7 @@ void Hospital::ReadyWorld() } break; - case 2: + case LegoActor::c_mama: m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x10; if (m_hospitalState->m_unk0x10 < 5) { @@ -168,7 +168,7 @@ void Hospital::ReadyWorld() } break; - case 3: + case LegoActor::c_papa: m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x12; if (m_hospitalState->m_unk0x12 < 5) { @@ -176,7 +176,7 @@ void Hospital::ReadyWorld() } break; - case 4: + case LegoActor::c_nick: m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x14; if (m_hospitalState->m_unk0x14 < 5) { @@ -184,7 +184,7 @@ void Hospital::ReadyWorld() } break; - case 5: + case LegoActor::c_laura: m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x16; if (m_hospitalState->m_unk0x16 < 5) { @@ -269,7 +269,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param) break; case 11: switch (m_currentActorId) { - case 1: + case LegoActor::c_pepper: switch (m_hospitalState->m_unk0x0e) { case 0: case 1: @@ -288,7 +288,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param) break; } break; - case 2: + case LegoActor::c_mama: switch (m_hospitalState->m_unk0x10) { case 0: case 1: @@ -307,7 +307,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param) break; } break; - case 3: + case LegoActor::c_papa: switch (m_hospitalState->m_unk0x12) { case 0: case 1: @@ -326,7 +326,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param) break; } break; - case 4: + case LegoActor::c_nick: switch (m_hospitalState->m_unk0x14) { case 0: case 1: @@ -345,7 +345,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param) break; } break; - case 5: + case LegoActor::c_laura: switch (m_hospitalState->m_unk0x16) { case 0: case 1: @@ -438,7 +438,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param) } else { switch (m_currentActorId) { - case 1: + case LegoActor::c_pepper: switch (m_hospitalState->m_unk0x0e) { case 0: case 1: @@ -457,7 +457,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param) break; } break; - case 2: + case LegoActor::c_mama: switch (m_hospitalState->m_unk0x10) { case 0: case 1: @@ -476,7 +476,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param) break; } break; - case 3: + case LegoActor::c_papa: switch (m_hospitalState->m_unk0x12) { case 0: case 1: @@ -495,7 +495,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param) break; } break; - case 4: + case LegoActor::c_nick: switch (m_hospitalState->m_unk0x14) { case 0: case 1: @@ -514,7 +514,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param) break; } break; - case 5: + case LegoActor::c_laura: switch (m_hospitalState->m_unk0x16) { case 0: case 1: diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index f8a1426d..a2ae514f 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -1047,7 +1047,7 @@ MxU8 Infocenter::HandleControl(LegoControlManagerEvent& p_param) InputManager()->SetUnknown336(TRUE); break; case LegoGameState::e_unk4: - if (state->GetActorId()) { + if (state->GetActorId() != LegoActor::c_none) { if (m_infocenterState->HasRegistered()) { m_infocenterState->SetUnknown0x74(5); m_destLocation = state->GetPreviousArea(); @@ -1336,23 +1336,23 @@ void Infocenter::UpdateFrameHot(MxBool p_display) MxS32 x, y; switch (GameState()->GetActorId()) { - case 1: + case LegoActor::c_pepper: x = 302; y = 81; break; - case 2: + case LegoActor::c_mama: x = 204; y = 81; break; - case 3: + case LegoActor::c_papa: x = 253; y = 81; break; - case 4: + case LegoActor::c_nick: x = 353; y = 81; break; - case 5: + case LegoActor::c_laura: x = 399; y = 81; break; diff --git a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp index a4afe604..dde3e760 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp @@ -114,7 +114,7 @@ MxLong InfocenterDoor::HandleControl(LegoControlManagerEvent& p_param) result = 1; break; case InfodoorScript::c_Door_Ctl: - if (GameState()->GetActorId()) { + if (GameState()->GetActorId() != LegoActor::c_none) { InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState"); if (state->HasRegistered()) { m_destLocation = LegoGameState::e_unk4; diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 1e8ea520..806903af 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -544,7 +544,7 @@ void Isle::Enable(MxBool p_enable) VideoManager()->ResetPalette(FALSE); m_act1state->FUN_10034d00(); - if (CurrentActor() != NULL && CurrentActor()->GetActorId() != 0) { + if (CurrentActor() != NULL && CurrentActor()->GetActorId() != LegoActor::c_none) { // TODO: Match, most likely an inline function MxS32 targetEntityId = (CurrentActor()->GetActorId() == 1) + 250; diff --git a/LEGO1/lego/legoomni/src/worlds/police.cpp b/LEGO1/lego/legoomni/src/worlds/police.cpp index a20f5163..0efbea20 100644 --- a/LEGO1/lego/legoomni/src/worlds/police.cpp +++ b/LEGO1/lego/legoomni/src/worlds/police.cpp @@ -231,11 +231,11 @@ void PoliceState::FUN_1005ea40() } switch (CurrentActor()->GetActorId()) { - case 4: + case LegoActor::c_nick: policeScript = PoliceScript::c_nps002la_RunAnim; m_policeScript = policeScript; break; - case 5: + case LegoActor::c_laura: policeScript = PoliceScript::c_nps001ni_RunAnim; m_policeScript = policeScript; break; From f6c923a84e1862248114c016d521521192a54880 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 5 Jun 2024 13:00:46 -0400 Subject: [PATCH 07/12] Implement/match LegoEntity::ClickAnimation (#994) * Implement/match LegoEntity::VTable0x38 * Update names --- .../legoomni/include/legobuildingmanager.h | 5 +- .../legoomni/include/legocharactermanager.h | 1 + LEGO1/lego/legoomni/include/legoentity.h | 6 +- LEGO1/lego/legoomni/include/legomain.h | 4 +- .../lego/legoomni/include/legoplantmanager.h | 4 +- .../src/build/legobuildingmanager.cpp | 2 +- .../src/common/legocharactermanager.cpp | 16 +++++ .../legoomni/src/common/legoplantmanager.cpp | 9 ++- LEGO1/lego/legoomni/src/common/misc.cpp | 4 +- LEGO1/lego/legoomni/src/entity/legoentity.cpp | 67 ++++++++++++++++--- 10 files changed, 95 insertions(+), 23 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legobuildingmanager.h b/LEGO1/lego/legoomni/include/legobuildingmanager.h index bec82ceb..cf7a4099 100644 --- a/LEGO1/lego/legoomni/include/legobuildingmanager.h +++ b/LEGO1/lego/legoomni/include/legobuildingmanager.h @@ -72,12 +72,12 @@ class LegoBuildingManager : public MxCore { MxResult Write(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage); LegoBuildingInfo* GetInfo(LegoEntity* p_entity); - MxBool IncrementVariant(LegoEntity* p_entity); + MxBool SwitchVariant(LegoEntity* p_entity); MxBool FUN_1002fe40(LegoEntity* p_entity); MxBool FUN_1002fe80(LegoEntity* p_entity); MxBool FUN_1002fed0(LegoEntity* p_entity); MxU32 GetBuildingEntityId(LegoEntity* p_entity); - MxU32 FUN_1002ff40(LegoEntity*, MxBool); + MxU32 FUN_1002ff40(LegoEntity* p_entity, MxBool); MxBool FUN_10030000(LegoEntity* p_entity); MxBool FUN_10030030(MxS32 p_index); MxBool FUN_10030110(LegoBuildingInfo* p_data); @@ -89,6 +89,7 @@ class LegoBuildingManager : public MxCore { void FUN_100307b0(LegoEntity* p_entity, MxS32 p_adjust); static void FUN_10030800(); + static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; } // SYNTHETIC: LEGO1 0x1002f940 // LegoBuildingManager::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index 1032f8b3..e8d5abee 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -70,6 +70,7 @@ class LegoCharacterManager { LegoActorInfo* GetActorInfo(const char* p_name); LegoActorInfo* GetActorInfo(LegoROI* p_roi); MxBool SwitchHat(LegoROI* p_roi); + MxU32 FUN_10085120(LegoROI* p_roi); MxU32 FUN_10085140(LegoROI* p_roi, MxBool p_und); MxU8 GetMood(LegoROI* p_roi); LegoROI* CreateAutoROI(const char* p_name, const char* p_lodName, MxBool p_createEntity); diff --git a/LEGO1/lego/legoomni/include/legoentity.h b/LEGO1/lego/legoomni/include/legoentity.h index 5fcced29..4435ac19 100644 --- a/LEGO1/lego/legoomni/include/legoentity.h +++ b/LEGO1/lego/legoomni/include/legoentity.h @@ -64,9 +64,9 @@ class LegoEntity : public MxEntity { // FUNCTION: LEGO1 0x10001090 virtual void SetWorldSpeed(MxFloat p_worldSpeed) { m_worldSpeed = p_worldSpeed; } // vtable+0x30 - virtual void VTable0x34(MxBool p_und); // vtable+0x34 - virtual void VTable0x38(); // vtable+0x38 - virtual void VTable0x3c(); // vtable+0x3c + virtual void ClickSound(MxBool p_und); // vtable+0x34 + virtual void ClickAnimation(); // vtable+0x38 + virtual void SwitchVariant(); // vtable+0x3c virtual void VTable0x40(); // vtable+0x40 virtual void VTable0x44(); // vtable+0x44 virtual void VTable0x48(LegoROI* p_roi); // vtable+0x48 diff --git a/LEGO1/lego/legoomni/include/legomain.h b/LEGO1/lego/legoomni/include/legomain.h index 4a2fad65..e3264e06 100644 --- a/LEGO1/lego/legoomni/include/legomain.h +++ b/LEGO1/lego/legoomni/include/legomain.h @@ -128,9 +128,9 @@ class LegoOmni : public MxOmni { LegoWorld* GetCurrentWorld() { return m_currentWorld; } LegoNavController* GetNavController() { return m_navController; } LegoPathActor* GetCurrentActor() { return m_currentActor; } - LegoPlantManager* GetLegoPlantManager() { return m_plantManager; } + LegoPlantManager* GetPlantManager() { return m_plantManager; } LegoAnimationManager* GetAnimationManager() { return m_animationManager; } - LegoBuildingManager* GetLegoBuildingManager() { return m_buildingManager; } + LegoBuildingManager* GetBuildingManager() { return m_buildingManager; } LegoGameState* GetGameState() { return m_gameState; } MxBackgroundAudioManager* GetBackgroundAudioManager() { return m_bkgAudioManager; } MxTransitionManager* GetTransitionManager() { return m_transitionManager; } diff --git a/LEGO1/lego/legoomni/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index e2eccd80..0c9e18eb 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -30,11 +30,13 @@ class LegoPlantManager : public MxCore { void Write(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage); MxBool FUN_100269e0(LegoEntity* p_entity); - MxU32 FUN_10026ba0(LegoEntity*, MxBool); + MxU32 FUN_10026b70(LegoEntity* p_entity); + MxU32 FUN_10026ba0(LegoEntity* p_entity, MxBool); void FUN_10026c50(LegoEntity* p_entity); void FUN_10027120(); static void SetCustomizeAnimFile(const char* p_value); + static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; } // SYNTHETIC: LEGO1 0x100262a0 // LegoPlantManager::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp index 863520da..d6cc74d1 100644 --- a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp @@ -441,7 +441,7 @@ LegoBuildingInfo* LegoBuildingManager::GetInfo(LegoEntity* p_entity) // FUNCTION: LEGO1 0x1002fdb0 // FUNCTION: BETA10 0x10064101 -MxBool LegoBuildingManager::IncrementVariant(LegoEntity* p_entity) +MxBool LegoBuildingManager::SwitchVariant(LegoEntity* p_entity) { if (g_buildingManagerConfig <= 1) { return TRUE; diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index dc48d9b5..eca959d9 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -21,6 +21,9 @@ DECOMP_SIZE_ASSERT(LegoCharacter, 0x08) DECOMP_SIZE_ASSERT(LegoCharacterManager, 0x08) +// GLOBAL: LEGO1 0x100fc4e0 +MxU32 g_unk0x100fc4e0 = 10; + // GLOBAL: LEGO1 0x100fc4e4 char* LegoCharacterManager::g_customizeAnimFile = NULL; @@ -753,6 +756,19 @@ MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi) return TRUE; } +// FUNCTION: LEGO1 0x10085120 +// FUNCTION: BETA10 0x1007680c +MxU32 LegoCharacterManager::FUN_10085120(LegoROI* p_roi) +{ + LegoActorInfo* info = GetActorInfo(p_roi); + + if (info != NULL) { + return info->m_unk0x10 + g_unk0x100fc4e0; + } + + return 0; +} + // FUNCTION: LEGO1 0x10085140 MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und) { diff --git a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp index 3e7aeed8..bcda73cd 100644 --- a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp @@ -56,8 +56,15 @@ MxBool LegoPlantManager::FUN_100269e0(LegoEntity* p_entity) return FALSE; } +// STUB: LEGO1 0x10026b70 +MxU32 LegoPlantManager::FUN_10026b70(LegoEntity* p_entity) +{ + // TODO + return 0; +} + // STUB: LEGO1 0x10026ba0 -MxU32 LegoPlantManager::FUN_10026ba0(LegoEntity*, MxBool) +MxU32 LegoPlantManager::FUN_10026ba0(LegoEntity* p_entity, MxBool) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/common/misc.cpp b/LEGO1/lego/legoomni/src/common/misc.cpp index 34060c5f..2427097c 100644 --- a/LEGO1/lego/legoomni/src/common/misc.cpp +++ b/LEGO1/lego/legoomni/src/common/misc.cpp @@ -93,13 +93,13 @@ ViewManager* GetViewManager() // FUNCTION: LEGO1 0x100157e0 LegoPlantManager* PlantManager() { - return LegoOmni::GetInstance()->GetLegoPlantManager(); + return LegoOmni::GetInstance()->GetPlantManager(); } // FUNCTION: LEGO1 0x100157f0 LegoBuildingManager* BuildingManager() { - return LegoOmni::GetInstance()->GetLegoBuildingManager(); + return LegoOmni::GetInstance()->GetBuildingManager(); } // FUNCTION: LEGO1 0x10015800 diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index cb426fac..48ec6d62 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -2,11 +2,13 @@ #include "3dmanager/lego3dmanager.h" #include "define.h" +#include "legoanimationmanager.h" #include "legobuildingmanager.h" #include "legocameracontroller.h" #include "legocharactermanager.h" #include "legoeventnotificationparam.h" #include "legogamestate.h" +#include "legomain.h" #include "legoplantmanager.h" #include "legoutils.h" #include "legovideomanager.h" @@ -245,11 +247,12 @@ void LegoEntity::ParseAction(char* p_extra) } // FUNCTION: LEGO1 0x10010f10 -void LegoEntity::VTable0x34(MxBool p_und) +// FUNCTION: BETA10 0x1007ee87 +void LegoEntity::ClickSound(MxBool p_und) { if (!GetUnknown0x10IsSet(c_altBit1)) { MxU32 objectId = 0; - const LegoChar* roiName = m_roi->GetName(); + const char* name = m_roi->GetName(); switch (m_type) { case e_actor: @@ -269,20 +272,56 @@ void LegoEntity::VTable0x34(MxBool p_und) MxDSAction action; action.SetAtomId(MxAtomId(CharacterManager()->GetCustomizeAnimFile(), e_lowerCase2)); action.SetObjectId(objectId); - action.AppendExtra(strlen(roiName) + 1, roiName); + action.AppendExtra(strlen(name) + 1, name); Start(&action); } } } -// STUB: LEGO1 0x10011070 -void LegoEntity::VTable0x38() +// FUNCTION: LEGO1 0x10011070 +// FUNCTION: BETA10 0x1007f062 +void LegoEntity::ClickAnimation() { - // TODO + if (!GetUnknown0x10IsSet(c_altBit1)) { + MxU32 objectId = 0; + MxDSAction action; + const char* name = m_roi->GetName(); + char extra[1024]; + + switch (m_type) { + case e_actor: + objectId = LegoOmni::GetInstance()->GetCharacterManager()->FUN_10085120(m_roi); + action.SetAtomId(MxAtomId(LegoCharacterManager::GetCustomizeAnimFile(), e_lowerCase2)); + sprintf(extra, "SUBST:actor_01:%s", name); + break; + case e_unk1: + break; + case e_plant: + objectId = LegoOmni::GetInstance()->GetPlantManager()->FUN_10026b70(this); + action.SetAtomId(MxAtomId(LegoPlantManager::GetCustomizeAnimFile(), e_lowerCase2)); + sprintf(extra, "SUBST:bush:%s:tree:%s:flwrred:%s:palm:%s", name, name, name, name); + break; + case e_building: + objectId = LegoOmni::GetInstance()->GetBuildingManager()->GetBuildingEntityId(this); + action.SetAtomId(MxAtomId(BuildingManager()->GetCustomizeAnimFile(), e_lowerCase2)); + sprintf(extra, "SUBST:haus1:%s", name); + break; + case e_autoROI: + break; + } + + if (objectId) { + action.SetObjectId(objectId); + action.AppendExtra(strlen(extra) + 1, extra); + LegoOmni::GetInstance()->GetAnimationManager()->StartEntityAction(action, this); + m_unk0x10 |= c_altBit1; + } + } } // FUNCTION: LEGO1 0x10011300 -void LegoEntity::VTable0x3c() +// FUNCTION: BETA10 0x1007f35a +void LegoEntity::SwitchVariant() { switch (m_type) { case e_actor: @@ -294,45 +333,51 @@ void LegoEntity::VTable0x3c() PlantManager()->FUN_100269e0(this); break; case e_building: - BuildingManager()->IncrementVariant(this); + BuildingManager()->SwitchVariant(this); break; } - VTable0x34(FALSE); - VTable0x38(); + ClickSound(FALSE); + ClickAnimation(); } // STUB: LEGO1 0x10011360 +// FUNCTION: BETA10 0x1007f411 void LegoEntity::VTable0x40() { // TODO } // STUB: LEGO1 0x100113c0 +// FUNCTION: BETA10 0x1007f4c8 void LegoEntity::VTable0x44() { // TODO } // STUB: LEGO1 0x10011420 +// FUNCTION: BETA10 0x1007f57f void LegoEntity::VTable0x48(LegoROI* p_roi) { // TODO } // STUB: LEGO1 0x10011470 +// FUNCTION: BETA10 0x1007f62c void LegoEntity::VTable0x4c() { // TODO } // FUNCTION: LEGO1 0x100114e0 +// FUNCTION: BETA10 0x1007f6f0 void LegoEntity::SetType(MxU8 p_type) { m_type = p_type; } // FUNCTION: LEGO1 0x100114f0 +// FUNCTION: BETA10 0x1007f711 MxLong LegoEntity::Notify(MxParam& p_param) { LegoEventNotificationParam& param = (LegoEventNotificationParam&) p_param; @@ -349,7 +394,7 @@ MxLong LegoEntity::Notify(MxParam& p_param) case LegoActor::c_pepper: if (GameState()->GetCurrentAct() != LegoGameState::e_act2 && GameState()->GetCurrentAct() != LegoGameState::e_act3) { - VTable0x3c(); + SwitchVariant(); } break; case LegoActor::c_mama: From 49c17c9c6afddf1ec9d16f6f8819556cd63c022c Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 5 Jun 2024 13:40:44 -0400 Subject: [PATCH 08/12] Implement/match LegoEntity::SwitchSound / SwitchMove / SwitchColor / SwitchMood (#995) * Implement/match LegoEntity::SwitchSound * Name * Name * Implement/match LegoEntity::SwitchMove * Mood --- LEGO1/lego/legoomni/include/legoactors.h | 4 +- .../legoomni/include/legobuildingmanager.h | 22 ++-- .../legoomni/include/legocharactermanager.h | 8 +- LEGO1/lego/legoomni/include/legoentity.h | 14 +-- .../lego/legoomni/include/legoplantmanager.h | 6 +- .../src/build/legobuildingmanager.cpp | 58 +++++----- .../src/common/legocharactermanager.cpp | 92 +++++++++++++-- .../legoomni/src/common/legoplantmanager.cpp | 30 ++++- LEGO1/lego/legoomni/src/entity/legoentity.cpp | 106 +++++++++++++++--- 9 files changed, 262 insertions(+), 78 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoactors.h b/LEGO1/lego/legoomni/include/legoactors.h index 46f288b5..aa31343d 100644 --- a/LEGO1/lego/legoomni/include/legoactors.h +++ b/LEGO1/lego/legoomni/include/legoactors.h @@ -22,8 +22,8 @@ struct LegoActorInfo { const char* m_name; // 0x00 LegoROI* m_roi; // 0x04 LegoExtraActor* m_actor; // 0x08 - MxS32 m_unk0x0c; // 0x0c - MxS32 m_unk0x10; // 0x10 + MxS32 m_sound; // 0x0c + MxS32 m_move; // 0x10 MxU8 m_mood; // 0x14 Part m_parts[10]; // 0x18 }; diff --git a/LEGO1/lego/legoomni/include/legobuildingmanager.h b/LEGO1/lego/legoomni/include/legobuildingmanager.h index cf7a4099..57544ba7 100644 --- a/LEGO1/lego/legoomni/include/legobuildingmanager.h +++ b/LEGO1/lego/legoomni/include/legobuildingmanager.h @@ -15,17 +15,17 @@ class LegoPathBoundary; // SIZE 0x2c struct LegoBuildingInfo { enum { - c_bit1 = 0x01, - c_bit2 = 0x02, - c_bit3 = 0x04, - c_bit4 = 0x08 + c_hasVariants = 0x01, + c_hasSounds = 0x02, + c_hasMoves = 0x04, + c_hasMoods = 0x08 }; LegoEntity* m_entity; // 0x00 const char* m_hausName; // 0x04 - MxU32 m_cycle1; // 0x08 - MxU32 m_cycle2; // 0x0c - MxU8 m_cycle3; // 0x10 + MxU32 m_sound; // 0x08 + MxU32 m_move; // 0x0c + MxU8 m_mood; // 0x10 MxS8 m_unk0x11; // 0x11 MxS8 m_initialUnk0x11; // 0x12 = initial value loaded to m_unk0x11 MxU8 m_flags; // 0x13 @@ -73,9 +73,9 @@ class LegoBuildingManager : public MxCore { MxResult Read(LegoStorage* p_storage); LegoBuildingInfo* GetInfo(LegoEntity* p_entity); MxBool SwitchVariant(LegoEntity* p_entity); - MxBool FUN_1002fe40(LegoEntity* p_entity); - MxBool FUN_1002fe80(LegoEntity* p_entity); - MxBool FUN_1002fed0(LegoEntity* p_entity); + MxBool SwitchSound(LegoEntity* p_entity); + MxBool SwitchMove(LegoEntity* p_entity); + MxBool SwitchMood(LegoEntity* p_entity); MxU32 GetBuildingEntityId(LegoEntity* p_entity); MxU32 FUN_1002ff40(LegoEntity* p_entity, MxBool); MxBool FUN_10030000(LegoEntity* p_entity); @@ -96,6 +96,8 @@ class LegoBuildingManager : public MxCore { private: static char* g_customizeAnimFile; + static MxS32 g_maxMove[16]; + static MxU32 g_maxSound; MxU8 m_nextVariant; // 0x08 MxU8 m_unk0x09; // 0x09 diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index e8d5abee..2c2238d6 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -69,7 +69,11 @@ class LegoCharacterManager { LegoExtraActor* GetExtraActor(const char* p_name); LegoActorInfo* GetActorInfo(const char* p_name); LegoActorInfo* GetActorInfo(LegoROI* p_roi); - MxBool SwitchHat(LegoROI* p_roi); + MxBool SwitchColor(LegoROI* p_roi, LegoROI* p_targetROI); + MxBool SwitchVariant(LegoROI* p_roi); + MxBool SwitchSound(LegoROI* p_roi); + MxBool SwitchMove(LegoROI* p_roi); + MxBool SwitchMood(LegoROI* p_roi); MxU32 FUN_10085120(LegoROI* p_roi); MxU32 FUN_10085140(LegoROI* p_roi, MxBool p_und); MxU8 GetMood(LegoROI* p_roi); @@ -85,6 +89,8 @@ class LegoCharacterManager { MxResult FUN_10085870(LegoROI* p_roi); static char* g_customizeAnimFile; + static MxU32 g_maxMove; + static MxU32 g_maxSound; LegoCharacterMap* m_characters; // 0x00 CustomizeAnimFileVariable* m_customizeAnimFile; // 0x04 diff --git a/LEGO1/lego/legoomni/include/legoentity.h b/LEGO1/lego/legoomni/include/legoentity.h index 4435ac19..2adc7179 100644 --- a/LEGO1/lego/legoomni/include/legoentity.h +++ b/LEGO1/lego/legoomni/include/legoentity.h @@ -64,13 +64,13 @@ class LegoEntity : public MxEntity { // FUNCTION: LEGO1 0x10001090 virtual void SetWorldSpeed(MxFloat p_worldSpeed) { m_worldSpeed = p_worldSpeed; } // vtable+0x30 - virtual void ClickSound(MxBool p_und); // vtable+0x34 - virtual void ClickAnimation(); // vtable+0x38 - virtual void SwitchVariant(); // vtable+0x3c - virtual void VTable0x40(); // vtable+0x40 - virtual void VTable0x44(); // vtable+0x44 - virtual void VTable0x48(LegoROI* p_roi); // vtable+0x48 - virtual void VTable0x4c(); // vtable+0x4c + virtual void ClickSound(MxBool p_und); // vtable+0x34 + virtual void ClickAnimation(); // vtable+0x38 + virtual void SwitchVariant(); // vtable+0x3c + virtual void SwitchSound(); // vtable+0x40 + virtual void SwitchMove(); // vtable+0x44 + virtual void SwitchColor(LegoROI* p_roi); // vtable+0x48 + virtual void SwitchMood(); // vtable+0x4c void FUN_10010c30(); void SetType(MxU8 p_type); diff --git a/LEGO1/lego/legoomni/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index 0c9e18eb..f32adafa 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -29,7 +29,11 @@ class LegoPlantManager : public MxCore { void FUN_100263a0(undefined4 p_und); void Write(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage); - MxBool FUN_100269e0(LegoEntity* p_entity); + MxBool SwitchColor(LegoEntity* p_entity); + MxBool SwitchVariant(LegoEntity* p_entity); + MxBool SwitchSound(LegoEntity* p_entity); + MxBool SwitchMove(LegoEntity* p_entity); + MxBool SwitchMood(LegoEntity* p_entity); MxU32 FUN_10026b70(LegoEntity* p_entity); MxU32 FUN_10026ba0(LegoEntity* p_entity, MxBool); void FUN_10026c50(LegoEntity* p_entity); diff --git a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp index d6cc74d1..9cd60b54 100644 --- a/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/build/legobuildingmanager.cpp @@ -193,7 +193,7 @@ LegoBuildingInfo g_buildingInfoInit[16] = { // clang-format on // GLOBAL: LEGO1 0x100f3738 -MxU32 g_buildingCycle1Length = 6; +MxU32 LegoBuildingManager::g_maxSound = 6; // GLOBAL: LEGO1 0x100f373c MxU32 g_cycleLengthOffset1 = 0x3c; @@ -221,7 +221,7 @@ MxS32 g_buildingManagerConfig = 1; LegoBuildingInfo g_buildingInfo[16]; // GLOBAL: LEGO1 0x100f3748 -MxS32 g_buildingCycle2Length[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 0}; +MxS32 LegoBuildingManager::g_maxMove[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 0}; // FUNCTION: LEGO1 0x1002f8b0 void LegoBuildingManager::configureLegoBuildingManager(MxS32 p_buildingManagerConfig) @@ -330,13 +330,13 @@ MxResult LegoBuildingManager::Write(LegoStorage* p_storage) for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) { LegoBuildingInfo* info = &g_buildingInfo[i]; - if (p_storage->Write(&info->m_cycle1, sizeof(info->m_cycle1)) != SUCCESS) { + if (p_storage->Write(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) { goto done; } - if (p_storage->Write(&info->m_cycle2, sizeof(info->m_cycle2)) != SUCCESS) { + if (p_storage->Write(&info->m_move, sizeof(info->m_move)) != SUCCESS) { goto done; } - if (p_storage->Write(&info->m_cycle3, sizeof(info->m_cycle3)) != SUCCESS) { + if (p_storage->Write(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) { goto done; } if (p_storage->Write(&info->m_initialUnk0x11, sizeof(info->m_initialUnk0x11)) != SUCCESS) { @@ -363,13 +363,13 @@ MxResult LegoBuildingManager::Read(LegoStorage* p_storage) for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) { LegoBuildingInfo* info = &g_buildingInfo[i]; - if (p_storage->Read(&info->m_cycle1, sizeof(info->m_cycle1)) != SUCCESS) { + if (p_storage->Read(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) { goto done; } - if (p_storage->Read(&info->m_cycle2, sizeof(info->m_cycle2)) != SUCCESS) { + if (p_storage->Read(&info->m_move, sizeof(info->m_move)) != SUCCESS) { goto done; } - if (p_storage->Read(&info->m_cycle3, sizeof(info->m_cycle3)) != SUCCESS) { + if (p_storage->Read(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) { goto done; } if (p_storage->Read(&info->m_unk0x11, sizeof(info->m_unk0x11)) != SUCCESS) { @@ -449,7 +449,7 @@ MxBool LegoBuildingManager::SwitchVariant(LegoEntity* p_entity) LegoBuildingInfo* info = GetInfo(p_entity); - if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit1 && info->m_unk0x11 == -1) { + if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasVariants && info->m_unk0x11 == -1) { LegoROI* roi = p_entity->GetROI(); if (++m_nextVariant >= sizeOfArray(g_buildingInfoHausName)) { m_nextVariant = 0; @@ -471,16 +471,16 @@ MxBool LegoBuildingManager::SwitchVariant(LegoEntity* p_entity) // FUNCTION: LEGO1 0x1002fe40 // FUNCTION: BETA10 0x100641d3 -MxBool LegoBuildingManager::FUN_1002fe40(LegoEntity* p_entity) +MxBool LegoBuildingManager::SwitchSound(LegoEntity* p_entity) { MxBool result = FALSE; LegoBuildingInfo* info = GetInfo(p_entity); - if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit2) { - info->m_cycle1++; + if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasSounds) { + info->m_sound++; - if (info->m_cycle1 >= g_buildingCycle1Length) { - info->m_cycle1 = 0; + if (info->m_sound >= g_maxSound) { + info->m_sound = 0; } result = TRUE; @@ -491,16 +491,16 @@ MxBool LegoBuildingManager::FUN_1002fe40(LegoEntity* p_entity) // FUNCTION: LEGO1 0x1002fe80 // FUNCTION: BETA10 0x10064242 -MxBool LegoBuildingManager::FUN_1002fe80(LegoEntity* p_entity) +MxBool LegoBuildingManager::SwitchMove(LegoEntity* p_entity) { MxBool result = FALSE; LegoBuildingInfo* info = GetInfo(p_entity); - if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit3) { - info->m_cycle2++; + if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasMoves) { + info->m_move++; - if (info->m_cycle2 >= g_buildingCycle2Length[info - g_buildingInfo]) { - info->m_cycle2 = 0; + if (info->m_move >= g_maxMove[info - g_buildingInfo]) { + info->m_move = 0; } result = TRUE; @@ -511,16 +511,16 @@ MxBool LegoBuildingManager::FUN_1002fe80(LegoEntity* p_entity) // FUNCTION: LEGO1 0x1002fed0 // FUNCTION: BETA10 0x100642c2 -MxBool LegoBuildingManager::FUN_1002fed0(LegoEntity* p_entity) +MxBool LegoBuildingManager::SwitchMood(LegoEntity* p_entity) { MxBool result = FALSE; LegoBuildingInfo* info = GetInfo(p_entity); - if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit4) { - info->m_cycle3++; + if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasMoods) { + info->m_mood++; - if (info->m_cycle3 > 3) { - info->m_cycle3 = 0; + if (info->m_mood > 3) { + info->m_mood = 0; } result = TRUE; @@ -535,8 +535,8 @@ MxU32 LegoBuildingManager::GetBuildingEntityId(LegoEntity* p_entity) { LegoBuildingInfo* info = GetInfo(p_entity); - if (info != NULL && info->m_flags & LegoBuildingInfo::c_bit3) { - return g_buildingEntityId[info - g_buildingInfo] + info->m_cycle2; + if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasMoves) { + return g_buildingEntityId[info - g_buildingInfo] + info->m_move; } return 0; @@ -548,16 +548,16 @@ MxU32 LegoBuildingManager::FUN_1002ff40(LegoEntity* p_entity, MxBool p_state) { LegoBuildingInfo* info = GetInfo(p_entity); - if (info == NULL || !(info->m_flags & LegoBuildingInfo::c_bit2)) { + if (info == NULL || !(info->m_flags & LegoBuildingInfo::c_hasSounds)) { return 0; } if (p_state) { - return info->m_cycle3 + g_cycleLengthOffset3; + return info->m_mood + g_cycleLengthOffset3; } if (info != NULL) { - return info->m_cycle1 + g_cycleLengthOffset1; + return info->m_sound + g_cycleLengthOffset1; } return 0; diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index eca959d9..04a3e74f 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -21,6 +21,12 @@ DECOMP_SIZE_ASSERT(LegoCharacter, 0x08) DECOMP_SIZE_ASSERT(LegoCharacterManager, 0x08) +// GLOBAL: LEGO1 0x100fc4d0 +MxU32 LegoCharacterManager::g_maxMove = 4; + +// GLOBAL: LEGO1 0x100fc4d4 +MxU32 LegoCharacterManager::g_maxSound = 9; + // GLOBAL: LEGO1 0x100fc4e0 MxU32 g_unk0x100fc4e0 = 10; @@ -113,10 +119,10 @@ MxResult LegoCharacterManager::Write(LegoStorage* p_storage) for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) { LegoActorInfo* info = &g_actorInfo[i]; - if (p_storage->Write(&info->m_unk0x0c, sizeof(info->m_unk0x0c)) != SUCCESS) { + if (p_storage->Write(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) { goto done; } - if (p_storage->Write(&info->m_unk0x10, sizeof(info->m_unk0x10)) != SUCCESS) { + if (p_storage->Write(&info->m_move, sizeof(info->m_move)) != SUCCESS) { goto done; } if (p_storage->Write(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) { @@ -168,10 +174,10 @@ MxResult LegoCharacterManager::Read(LegoStorage* p_storage) for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) { LegoActorInfo* info = &g_actorInfo[i]; - if (p_storage->Read(&info->m_unk0x0c, sizeof(info->m_unk0x0c)) != SUCCESS) { + if (p_storage->Read(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) { goto done; } - if (p_storage->Read(&info->m_unk0x10, sizeof(info->m_unk0x10)) != SUCCESS) { + if (p_storage->Read(&info->m_move, sizeof(info->m_move)) != SUCCESS) { goto done; } if (p_storage->Read(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) { @@ -450,8 +456,8 @@ LegoROI* LegoCharacterManager::CreateActorROI(const char* p_key) if (!strcmpi(p_key, "pep")) { LegoActorInfo* pepper = GetActorInfo("pepper"); - info->m_unk0x0c = pepper->m_unk0x0c; - info->m_unk0x10 = pepper->m_unk0x10; + info->m_sound = pepper->m_sound; + info->m_move = pepper->m_move; info->m_mood = pepper->m_mood; for (i = 0; i < sizeOfArray(info->m_parts); i++) { @@ -702,8 +708,16 @@ LegoROI* LegoCharacterManager::FindChildROI(LegoROI* p_roi, const char* p_name) return NULL; } +// STUB: LEGO1 0x10084d50 +// FUNCTION: BETA10 0x10076223 +MxBool LegoCharacterManager::SwitchColor(LegoROI* p_roi, LegoROI* p_targetROI) +{ + // TODO + return FALSE; +} + // FUNCTION: LEGO1 0x10084ec0 -MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi) +MxBool LegoCharacterManager::SwitchVariant(LegoROI* p_roi) { LegoActorInfo* info = GetActorInfo(p_roi->GetName()); @@ -756,6 +770,66 @@ MxBool LegoCharacterManager::SwitchHat(LegoROI* p_roi) return TRUE; } +// FUNCTION: LEGO1 0x10085090 +// FUNCTION: BETA10 0x100766f6 +MxBool LegoCharacterManager::SwitchSound(LegoROI* p_roi) +{ + MxBool result = FALSE; + LegoActorInfo* info = GetActorInfo(p_roi); + + if (info != NULL) { + info->m_sound++; + + if (info->m_sound >= g_maxSound) { + info->m_sound = 0; + } + + result = TRUE; + } + + return result; +} + +// FUNCTION: LEGO1 0x100850c0 +// FUNCTION: BETA10 0x10076754 +MxBool LegoCharacterManager::SwitchMove(LegoROI* p_roi) +{ + MxBool result = FALSE; + LegoActorInfo* info = GetActorInfo(p_roi); + + if (info != NULL) { + info->m_move++; + + if (info->m_move >= g_maxMove) { + info->m_move = 0; + } + + result = TRUE; + } + + return result; +} + +// FUNCTION: LEGO1 0x100850f0 +// FUNCTION: BETA10 0x100767b2 +MxBool LegoCharacterManager::SwitchMood(LegoROI* p_roi) +{ + MxBool result = FALSE; + LegoActorInfo* info = GetActorInfo(p_roi); + + if (info != NULL) { + info->m_mood++; + + if (info->m_mood > 3) { + info->m_mood = 0; + } + + result = TRUE; + } + + return result; +} + // FUNCTION: LEGO1 0x10085120 // FUNCTION: BETA10 0x1007680c MxU32 LegoCharacterManager::FUN_10085120(LegoROI* p_roi) @@ -763,7 +837,7 @@ MxU32 LegoCharacterManager::FUN_10085120(LegoROI* p_roi) LegoActorInfo* info = GetActorInfo(p_roi); if (info != NULL) { - return info->m_unk0x10 + g_unk0x100fc4e0; + return info->m_move + g_unk0x100fc4e0; } return 0; @@ -779,7 +853,7 @@ MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und) } if (info != NULL) { - return info->m_unk0x0c + g_unk0x100fc4d8; + return info->m_sound + g_unk0x100fc4d8; } return 0; diff --git a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp index bcda73cd..4cc23472 100644 --- a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp @@ -49,8 +49,36 @@ MxResult LegoPlantManager::Read(LegoStorage* p_storage) return SUCCESS; } +// STUB: LEGO1 0x10026920 +MxBool LegoPlantManager::SwitchColor(LegoEntity* p_entity) +{ + // TODO + return FALSE; +} + // STUB: LEGO1 0x100269e0 -MxBool LegoPlantManager::FUN_100269e0(LegoEntity* p_entity) +MxBool LegoPlantManager::SwitchVariant(LegoEntity* p_entity) +{ + // TODO + return FALSE; +} + +// STUB: LEGO1 0x10026ad0 +MxBool LegoPlantManager::SwitchSound(LegoEntity* p_entity) +{ + // TODO + return FALSE; +} + +// STUB: LEGO1 0x10026b00 +MxBool LegoPlantManager::SwitchMove(LegoEntity* p_entity) +{ + // TODO + return FALSE; +} + +// STUB: LEGO1 0x10026b40 +MxBool LegoPlantManager::SwitchMood(LegoEntity* p_entity) { // TODO return FALSE; diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index 48ec6d62..cca706a7 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -325,48 +325,118 @@ void LegoEntity::SwitchVariant() { switch (m_type) { case e_actor: - CharacterManager()->SwitchHat(m_roi); + CharacterManager()->SwitchVariant(m_roi); break; case e_unk1: break; case e_plant: - PlantManager()->FUN_100269e0(this); + PlantManager()->SwitchVariant(this); break; case e_building: BuildingManager()->SwitchVariant(this); break; + case e_autoROI: + break; } ClickSound(FALSE); ClickAnimation(); } -// STUB: LEGO1 0x10011360 +// FUNCTION: LEGO1 0x10011360 // FUNCTION: BETA10 0x1007f411 -void LegoEntity::VTable0x40() +void LegoEntity::SwitchSound() { - // TODO + switch (m_type) { + case e_actor: + CharacterManager()->SwitchSound(m_roi); + break; + case e_unk1: + break; + case e_plant: + PlantManager()->SwitchSound(this); + break; + case e_building: + BuildingManager()->SwitchSound(this); + break; + case e_autoROI: + break; + } + + ClickSound(FALSE); + ClickAnimation(); } -// STUB: LEGO1 0x100113c0 +// FUNCTION: LEGO1 0x100113c0 // FUNCTION: BETA10 0x1007f4c8 -void LegoEntity::VTable0x44() +void LegoEntity::SwitchMove() { - // TODO + switch (m_type) { + case e_actor: + CharacterManager()->SwitchMove(m_roi); + break; + case e_unk1: + break; + case e_plant: + PlantManager()->SwitchMove(this); + break; + case e_building: + BuildingManager()->SwitchMove(this); + break; + case e_autoROI: + break; + } + + ClickSound(FALSE); + ClickAnimation(); } -// STUB: LEGO1 0x10011420 +// FUNCTION: LEGO1 0x10011420 // FUNCTION: BETA10 0x1007f57f -void LegoEntity::VTable0x48(LegoROI* p_roi) +void LegoEntity::SwitchColor(LegoROI* p_roi) { - // TODO + switch (m_type) { + case e_actor: + CharacterManager()->SwitchColor(m_roi, p_roi); + break; + case e_unk1: + break; + case e_plant: + PlantManager()->SwitchColor(this); + break; + case e_building: + break; + case e_autoROI: + break; + } + + ClickSound(FALSE); + ClickAnimation(); } -// STUB: LEGO1 0x10011470 +// FUNCTION: LEGO1 0x10011470 // FUNCTION: BETA10 0x1007f62c -void LegoEntity::VTable0x4c() +void LegoEntity::SwitchMood() { - // TODO + switch (m_type) { + case e_actor: + CharacterManager()->SwitchMood(m_roi); + break; + case e_unk1: + break; + case e_plant: + PlantManager()->SwitchMood(this); + break; + case e_building: + BuildingManager()->SwitchMood(this); + break; + case e_autoROI: + break; + } + + ClickSound(TRUE); + ClickSound(FALSE); + ClickAnimation(); } // FUNCTION: LEGO1 0x100114e0 @@ -398,16 +468,16 @@ MxLong LegoEntity::Notify(MxParam& p_param) } break; case LegoActor::c_mama: - VTable0x40(); + SwitchSound(); break; case LegoActor::c_papa: - VTable0x44(); + SwitchMove(); break; case LegoActor::c_nick: - VTable0x48(param.GetROI()); + SwitchColor(param.GetROI()); break; case LegoActor::c_laura: - VTable0x4c(); + SwitchMood(); break; case LegoActor::c_brickster: switch (m_type) { From 9b22642f0c4bc639a4fee072cb80e0770d8e3d90 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 6 Jun 2024 08:26:33 -0400 Subject: [PATCH 09/12] Implement/match LegoCharacterManager::SwitchColor (#996) --- .../src/common/legocharactermanager.cpp | 58 ++++++++++++++++++- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index 04a3e74f..826f471b 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -708,12 +708,64 @@ LegoROI* LegoCharacterManager::FindChildROI(LegoROI* p_roi, const char* p_name) return NULL; } -// STUB: LEGO1 0x10084d50 +// FUNCTION: LEGO1 0x10084d50 // FUNCTION: BETA10 0x10076223 MxBool LegoCharacterManager::SwitchColor(LegoROI* p_roi, LegoROI* p_targetROI) { - // TODO - return FALSE; + MxS32 numParts = 10; + const char* targetName = p_targetROI->GetName(); + + MxS32 partIndex; + for (partIndex = 0; partIndex < numParts; partIndex++) { + if (!strcmp(targetName, g_actorLODs[partIndex + 1].m_name)) { + break; + } + } + + assert(partIndex < numParts); + + MxBool findChild = TRUE; + if (partIndex == 6) { + partIndex = 4; + } + else if (partIndex == 7) { + partIndex = 5; + } + else if (partIndex == 3) { + partIndex = 1; + } + else if (partIndex == 0) { + partIndex = 2; + } + else { + findChild = FALSE; + } + + if (!(g_actorLODs[partIndex + 1].m_flags & LegoActorLOD::c_flag2)) { + return FALSE; + } + + LegoActorInfo* info = GetActorInfo(p_roi->GetName()); + + if (info == NULL) { + return FALSE; + } + + if (findChild) { + p_targetROI = FindChildROI(p_roi, g_actorLODs[partIndex + 1].m_name); + } + + LegoActorInfo::Part& part = info->m_parts[partIndex]; + + part.m_unk0x14++; + if (part.m_unk0x0c[part.m_unk0x14] == 0xff) { + part.m_unk0x14 = 0; + } + + LegoFloat red, green, blue, alpha; + LegoROI::FUN_100a9bf0(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]], red, green, blue, alpha); + p_targetROI->FUN_100a9170(red, green, blue, alpha); + return TRUE; } // FUNCTION: LEGO1 0x10084ec0 From 9a9bccda0efa99d154adf26bd05fd16e667a425c Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 6 Jun 2024 11:45:37 -0400 Subject: [PATCH 10/12] Implement/match IslePathActor::Exit (#997) * Implement/match IslePathActor::Exit * Name * Name * Partially fix vector interface * Revert "Partially fix vector interface" This reverts commit 6e7a1e2b08fd82012b28be3054eeff65428eb4d1. * Revert "Revert "Partially fix vector interface"" This reverts commit e3860e3c9fa1f8937b702d6c81d6e3bb4dadecc6. * Fix * Remove some COMPAT_MODE --- LEGO1/lego/legoomni/include/ambulance.h | 2 +- LEGO1/lego/legoomni/include/bike.h | 2 +- LEGO1/lego/legoomni/include/dunebuggy.h | 2 +- LEGO1/lego/legoomni/include/helicopter.h | 2 +- LEGO1/lego/legoomni/include/islepathactor.h | 17 ++-- LEGO1/lego/legoomni/include/jetski.h | 2 +- .../lego/legoomni/include/legonavcontroller.h | 2 +- LEGO1/lego/legoomni/include/legopathactor.h | 6 +- LEGO1/lego/legoomni/include/motocycle.h | 2 +- LEGO1/lego/legoomni/include/skateboard.h | 2 +- LEGO1/lego/legoomni/include/towtrack.h | 2 +- LEGO1/lego/legoomni/src/actors/ambulance.cpp | 4 +- LEGO1/lego/legoomni/src/actors/bike.cpp | 6 +- LEGO1/lego/legoomni/src/actors/buildings.cpp | 12 +-- LEGO1/lego/legoomni/src/actors/dunebuggy.cpp | 4 +- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 20 ++--- .../legoomni/src/actors/islepathactor.cpp | 83 +++++++++++++++---- LEGO1/lego/legoomni/src/actors/jetski.cpp | 4 +- .../legoomni/src/actors/jukeboxentity.cpp | 2 +- LEGO1/lego/legoomni/src/actors/motorcycle.cpp | 4 +- LEGO1/lego/legoomni/src/actors/pizzeria.cpp | 2 +- LEGO1/lego/legoomni/src/actors/racecar.cpp | 4 +- LEGO1/lego/legoomni/src/actors/skateboard.cpp | 12 +-- LEGO1/lego/legoomni/src/actors/towtrack.cpp | 4 +- .../src/common/legoanimationmanager.cpp | 14 ++-- LEGO1/lego/legoomni/src/common/legoutils.cpp | 1 - .../legoomni/src/entity/legocarraceactor.cpp | 2 +- LEGO1/lego/legoomni/src/entity/legojetski.cpp | 4 +- .../legoomni/src/paths/legoextraactor.cpp | 8 +- .../lego/legoomni/src/paths/legopathactor.cpp | 26 +++--- .../legoomni/src/paths/legopathboundary.cpp | 18 ++-- .../legoomni/src/paths/legopathcontroller.cpp | 6 +- LEGO1/lego/legoomni/src/race/legoracecar.cpp | 4 +- .../legoomni/src/video/legoanimpresenter.cpp | 13 +-- .../src/video/legoloopinganimpresenter.cpp | 7 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 8 +- LEGO1/lego/sources/misc/legounknown.cpp | 6 +- LEGO1/lego/sources/roi/legoroi.cpp | 18 ++-- LEGO1/mxgeometry/mxgeometry3d.h | 4 +- LEGO1/realtime/vector.h | 4 +- LEGO1/viewmanager/viewmanager.cpp | 4 +- 41 files changed, 196 insertions(+), 153 deletions(-) diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index 1a92eb78..a22c0515 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -89,7 +89,7 @@ class Ambulance : public IslePathActor { MxU32 HandleClick() override; // vtable+0xcc MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc - void VTable0xe4() override; // vtable+0xe4 + void Exit() override; // vtable+0xe4 void CreateState(); void FUN_10036e60(); diff --git a/LEGO1/lego/legoomni/include/bike.h b/LEGO1/lego/legoomni/include/bike.h index a71747ad..b042bee6 100644 --- a/LEGO1/lego/legoomni/include/bike.h +++ b/LEGO1/lego/legoomni/include/bike.h @@ -26,7 +26,7 @@ class Bike : public IslePathActor { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 MxU32 HandleClick() override; // vtable+0xcc MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - void VTable0xe4() override; // vtable+0xe4 + void Exit() override; // vtable+0xe4 void FUN_10076b60(); diff --git a/LEGO1/lego/legoomni/include/dunebuggy.h b/LEGO1/lego/legoomni/include/dunebuggy.h index 6abe2881..287417d6 100644 --- a/LEGO1/lego/legoomni/include/dunebuggy.h +++ b/LEGO1/lego/legoomni/include/dunebuggy.h @@ -28,7 +28,7 @@ class DuneBuggy : public IslePathActor { MxU32 HandleClick() override; // vtable+0xcc MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc - void VTable0xe4() override; // vtable+0xe4 + void Exit() override; // vtable+0xe4 void FUN_10068350(); diff --git a/LEGO1/lego/legoomni/include/helicopter.h b/LEGO1/lego/legoomni/include/helicopter.h index dd9451c0..1617d6b5 100644 --- a/LEGO1/lego/legoomni/include/helicopter.h +++ b/LEGO1/lego/legoomni/include/helicopter.h @@ -69,7 +69,7 @@ class Helicopter : public IslePathActor { MxU32 HandleClick() override; // vtable+0xcc MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 MxU32 VTable0xd8(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 - void VTable0xe4() override; // vtable+0xe4 + void Exit() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x10003210 // Helicopter::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/islepathactor.h b/LEGO1/lego/legoomni/include/islepathactor.h index 758039ff..4150db87 100644 --- a/LEGO1/lego/legoomni/include/islepathactor.h +++ b/LEGO1/lego/legoomni/include/islepathactor.h @@ -4,6 +4,7 @@ #include "legogamestate.h" #include "legopathactor.h" #include "mxtypes.h" +#include "roi/legoroi.h" class LegoControlManagerEvent; class LegoEndAnimNotificationParam; @@ -120,8 +121,8 @@ class IslePathActor : public LegoPathActor { // FUNCTION: LEGO1 0x10002e00 virtual MxU32 VTable0xdc(MxType19NotificationParam&) { return 0; } // vtable+0xdc - virtual void VTable0xe0(); // vtable+0xe0 - virtual void VTable0xe4(); // vtable+0xe4 + virtual void Enter(); // vtable+0xe0 + virtual void Exit(); // vtable+0xe4 virtual void SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p_flags); // vtable+0xe8 virtual void VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundary, MxBool p_reset); // vtable+0xec @@ -130,12 +131,18 @@ class IslePathActor : public LegoPathActor { void FUN_1001b660(); + void Reset() + { + m_roi->SetVisibility(TRUE); + SetState(0); + } + static void RegisterSpawnLocations(); protected: - LegoWorld* m_world; // 0x154 - LegoPathActor* m_unk0x158; // 0x158 - MxFloat m_unk0x15c; // 0x15c + LegoWorld* m_world; // 0x154 + LegoPathActor* m_previousActor; // 0x158 + MxFloat m_previousVel; // 0x15c }; #endif // ISLEPATHACTOR_H diff --git a/LEGO1/lego/legoomni/include/jetski.h b/LEGO1/lego/legoomni/include/jetski.h index 773513f9..3eb972a6 100644 --- a/LEGO1/lego/legoomni/include/jetski.h +++ b/LEGO1/lego/legoomni/include/jetski.h @@ -29,7 +29,7 @@ class Jetski : public IslePathActor { void VTable0x70(float p_float) override; // vtable+0x70 MxU32 HandleClick() override; // vtable+0xcc MxU32 HandleControl(LegoControlManagerEvent&) override; // vtable+0xd4 - void VTable0xe4() override; // vtable+0xe4 + void Exit() override; // vtable+0xe4 void FUN_1007e990(); diff --git a/LEGO1/lego/legoomni/include/legonavcontroller.h b/LEGO1/lego/legoomni/include/legonavcontroller.h index 8e54bd1e..3e310dde 100644 --- a/LEGO1/lego/legoomni/include/legonavcontroller.h +++ b/LEGO1/lego/legoomni/include/legonavcontroller.h @@ -80,7 +80,7 @@ class LegoNavController : public MxCore { inline MxFloat GetLinearVel() { return m_linearVel; } inline MxFloat GetRotationalVel() { return m_rotationalVel; } inline MxFloat GetMaxLinearVel() { return m_maxLinearVel; } - inline void ResetLinearVel(MxFloat p_maxLinearVel) + inline void ResetMaxLinearVel(MxFloat p_maxLinearVel) { m_maxLinearVel = p_maxLinearVel; m_trackDefault = 0; diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index 71e9f68e..d407a483 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -100,10 +100,10 @@ class LegoPathActor : public LegoActor { virtual void VTable0xa8(); // vtable+0xa8 // FUNCTION: LEGO1 0x10002d70 - virtual void VTable0xac(MxFloat p_unk0x13c) { m_unk0x13c = p_unk0x13c; } // vtable+0xac + virtual void SetMaxLinearVel(MxFloat p_maxLinearVel) { m_maxLinearVel = p_maxLinearVel; } // vtable+0xac // FUNCTION: LEGO1 0x10002d80 - virtual MxFloat VTable0xb0() { return m_unk0x13c; } // vtable+0xb0 + virtual MxFloat GetMaxLinearVel() { return m_maxLinearVel; } // vtable+0xb0 // FUNCTION: LEGO1 0x10002d90 virtual MxFloat VTable0xb4() { return m_unk0x140; } // vtable+0xb4 @@ -162,7 +162,7 @@ class LegoPathActor : public LegoActor { MxMatrix m_unk0xec; // 0xec LegoPathEdgeContainer* m_grec; // 0x134 LegoPathController* m_controller; // 0x138 - MxFloat m_unk0x13c; // 0x13c + MxFloat m_maxLinearVel; // 0x13c MxFloat m_unk0x140; // 0x140 MxFloat m_unk0x144; // 0x144 MxU8 m_unk0x148; // 0x148 diff --git a/LEGO1/lego/legoomni/include/motocycle.h b/LEGO1/lego/legoomni/include/motocycle.h index e23e87ad..1e7599af 100644 --- a/LEGO1/lego/legoomni/include/motocycle.h +++ b/LEGO1/lego/legoomni/include/motocycle.h @@ -28,7 +28,7 @@ class Motocycle : public IslePathActor { MxU32 HandleClick() override; // vtable+0xcc MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc - void VTable0xe4() override; // vtable+0xe4 + void Exit() override; // vtable+0xe4 void FUN_10035e10(); diff --git a/LEGO1/lego/legoomni/include/skateboard.h b/LEGO1/lego/legoomni/include/skateboard.h index 26007aed..4e8d17fd 100644 --- a/LEGO1/lego/legoomni/include/skateboard.h +++ b/LEGO1/lego/legoomni/include/skateboard.h @@ -30,7 +30,7 @@ class SkateBoard : public IslePathActor { MxU32 HandleClick() override; // vtable+0xcc MxU32 VTable0xd0() override; // vtable+0xd0 MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - void VTable0xe4() override; // vtable+0xe4 + void Exit() override; // vtable+0xe4 inline void SetUnknown0x160(MxBool p_unk0x160) { m_unk0x160 = p_unk0x160; } diff --git a/LEGO1/lego/legoomni/include/towtrack.h b/LEGO1/lego/legoomni/include/towtrack.h index a8738cbf..921ccbca 100644 --- a/LEGO1/lego/legoomni/include/towtrack.h +++ b/LEGO1/lego/legoomni/include/towtrack.h @@ -88,7 +88,7 @@ class TowTrack : public IslePathActor { MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 MxU32 VTable0xd8(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc - void VTable0xe4() override; // vtable+0xe4 + void Exit() override; // vtable+0xe4 void CreateState(); void FUN_1004dab0(); diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index 1a15d7c8..e1a52601 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -27,7 +27,7 @@ Ambulance::Ambulance() m_unk0x178 = -1; m_unk0x170 = 0; m_unk0x172 = 0; - m_unk0x13c = 40.0; + m_maxLinearVel = 40.0; m_unk0x17c = 1.0; } @@ -116,7 +116,7 @@ void Ambulance::FUN_10036e60() } // STUB: LEGO1 0x10036e90 -void Ambulance::VTable0xe4() +void Ambulance::Exit() { // TODO } diff --git a/LEGO1/lego/legoomni/src/actors/bike.cpp b/LEGO1/lego/legoomni/src/actors/bike.cpp index 20b6e904..3511971f 100644 --- a/LEGO1/lego/legoomni/src/actors/bike.cpp +++ b/LEGO1/lego/legoomni/src/actors/bike.cpp @@ -13,7 +13,7 @@ DECOMP_SIZE_ASSERT(Bike, 0x164) // FUNCTION: LEGO1 0x10076670 Bike::Bike() { - this->m_unk0x13c = 20.0; + this->m_maxLinearVel = 20.0; this->m_unk0x150 = 3.0; this->m_unk0x148 = 1; } @@ -32,9 +32,9 @@ MxResult Bike::Create(MxDSAction& p_dsAction) } // FUNCTION: LEGO1 0x10076920 -void Bike::VTable0xe4() +void Bike::Exit() { - IslePathActor::VTable0xe4(); + IslePathActor::Exit(); GameState()->SetCurrentArea(LegoGameState::Area::e_bike); RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_BikeDashboard_Bitmap); RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_BikeArms_Ctl); diff --git a/LEGO1/lego/legoomni/src/actors/buildings.cpp b/LEGO1/lego/legoomni/src/actors/buildings.cpp index 9c3c174b..2d896957 100644 --- a/LEGO1/lego/legoomni/src/actors/buildings.cpp +++ b/LEGO1/lego/legoomni/src/actors/buildings.cpp @@ -29,7 +29,7 @@ MxLong InfoCenterEntity::VTable0x50(MxParam& p_param) switch (GameState()->GetCurrentAct()) { case LegoGameState::Act::e_act1: { if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); @@ -71,7 +71,7 @@ MxLong GasStationEntity::VTable0x50(MxParam& p_param) state->SetUnknown18(0); if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); @@ -95,7 +95,7 @@ MxLong HospitalEntity::VTable0x50(MxParam& p_param) act1State->SetUnknown18(0); if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); @@ -119,7 +119,7 @@ MxLong PoliceEntity::VTable0x50(MxParam& p_param) state->SetUnknown18(0); if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); @@ -141,7 +141,7 @@ MxLong BeachHouseEntity::VTable0x50(MxParam& p_param) state->SetUnknown18(0); if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); @@ -162,7 +162,7 @@ MxLong RaceStandsEntity::VTable0x50(MxParam& p_param) state->SetUnknown18(0); if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); diff --git a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp index 30923948..f8d9f2dd 100644 --- a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp +++ b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp @@ -7,7 +7,7 @@ DECOMP_SIZE_ASSERT(DuneBuggy, 0x16c) // FUNCTION: LEGO1 0x10067bb0 DuneBuggy::DuneBuggy() { - this->m_unk0x13c = 25.0; + this->m_maxLinearVel = 25.0; this->m_unk0x164 = 1.0; } @@ -25,7 +25,7 @@ void DuneBuggy::VTable0x70(float p_float) } // STUB: LEGO1 0x10067fa0 -void DuneBuggy::VTable0xe4() +void DuneBuggy::Exit() { // TODO } diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index 1b765b2b..bcdbab6f 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -25,7 +25,7 @@ DECOMP_SIZE_ASSERT(MxMatrix, 0x48) // FUNCTION: LEGO1 0x10001e60 Helicopter::Helicopter() { - m_unk0x13c = 60; + m_maxLinearVel = 60; } // FUNCTION: LEGO1 0x10003230 @@ -63,7 +63,7 @@ void Helicopter::CreateState() } // FUNCTION: LEGO1 0x10003360 -void Helicopter::VTable0xe4() +void Helicopter::Exit() { if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { SpawnPlayer( @@ -73,7 +73,7 @@ void Helicopter::VTable0xe4() ); } - IslePathActor::VTable0xe4(); + IslePathActor::Exit(); if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { GameState()->SetCurrentArea(LegoGameState::e_copter); @@ -117,7 +117,7 @@ MxU32 Helicopter::HandleClick() if (CurrentActor()) { if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } } @@ -144,7 +144,7 @@ MxU32 Helicopter::HandleClick() break; } - VTable0xe0(); + Enter(); InvokeAction(Extra::ActionType::e_start, m_script, IsleScript::c_HelicopterDashboard, NULL); GetCurrentAction().SetObjectId(-1); ControlManager()->Register(this); @@ -179,7 +179,7 @@ MxU32 Helicopter::HandleControl(LegoControlManagerEvent& p_param) else if (m_state->GetUnkown8() != 0) { break; } - VTable0xe4(); + Exit(); GameState()->SetCurrentArea(LegoGameState::e_unk66); ret = 1; break; @@ -227,7 +227,7 @@ MxU32 Helicopter::HandleControl(LegoControlManagerEvent& p_param) lookat = dir; float scale = 3; lookat.Mul(scale); - lookat.Add(&loc); + lookat.Add(loc); Mx3DPointFloat v68, v7c, v90(0, 1, 0), va4; v68 = m_world->GetCamera()->GetWorldUp(); va4.EqualsCross(&v68, &dir); @@ -248,7 +248,7 @@ MxU32 Helicopter::HandleControl(LegoControlManagerEvent& p_param) if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_infomain); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); - VTable0xe4(); + Exit(); } ret = 1; break; @@ -379,9 +379,9 @@ void Helicopter::VTable0x70(float p_float) mat.SetIdentity(); m_unk0x1f4.Unknown6(mat, f2); v2.SetVector(loc); - v2.Sub(&v); + v2.Sub(v); v2.Mul(f2); - v2.Add(&v); + v2.Add(v); m_world->GetCamera()->FUN_100123e0(mat, 0); } else { diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index 0f8da9e7..e920cb2f 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -14,6 +14,7 @@ #include "mxbackgroundaudiomanager.h" #include "mxnotificationparam.h" #include "scripts.h" +#include "viewmanager/viewmanager.h" DECOMP_SIZE_ASSERT(IslePathActor, 0x160) DECOMP_SIZE_ASSERT(IslePathActor::SpawnLocation, 0x38) @@ -25,9 +26,9 @@ IslePathActor::SpawnLocation g_spawnLocations[IslePathActor::c_LOCATIONS_NUM]; IslePathActor::IslePathActor() { m_world = NULL; - m_unk0x13c = 6.0; - m_unk0x15c = 1.0; - m_unk0x158 = NULL; + m_maxLinearVel = 6.0; + m_previousVel = 1.0; + m_previousActor = NULL; } // FUNCTION: LEGO1 0x1001a280 @@ -71,15 +72,15 @@ MxLong IslePathActor::Notify(MxParam& p_param) } // FUNCTION: LEGO1 0x1001a350 -void IslePathActor::VTable0xe0() +void IslePathActor::Enter() { m_roi->SetVisibility(FALSE); if (CurrentActor() != this) { - m_unk0x15c = NavController()->GetMaxLinearVel(); - m_unk0x158 = CurrentActor(); - if (m_unk0x158) { - m_unk0x158->ResetWorldTransform(FALSE); - m_unk0x158->SetUserNavFlag(FALSE); + m_previousVel = NavController()->GetMaxLinearVel(); + m_previousActor = CurrentActor(); + if (m_previousActor) { + m_previousActor->ResetWorldTransform(FALSE); + m_previousActor->SetUserNavFlag(FALSE); } } @@ -88,7 +89,7 @@ void IslePathActor::VTable0xe0() ResetWorldTransform(TRUE); SetUserNavFlag(TRUE); - NavController()->ResetLinearVel(m_unk0x13c); + NavController()->ResetMaxLinearVel(m_maxLinearVel); SetCurrentActor(this); FUN_1001b660(); @@ -96,10 +97,62 @@ void IslePathActor::VTable0xe0() } } -// STUB: LEGO1 0x1001a3f0 -void IslePathActor::VTable0xe4() +// FUNCTION: LEGO1 0x1001a3f0 +// FUNCTION: BETA10 0x1003669f +void IslePathActor::Exit() { - // TODO + Reset(); + + GetViewManager()->Remove(m_roi); + GetViewManager()->Add(m_roi); + + ResetWorldTransform(FALSE); + SetUserNavFlag(FALSE); + + if (m_previousActor != NULL) { + SetCurrentActor(m_previousActor); + NavController()->ResetMaxLinearVel(m_previousVel); + m_previousActor->ResetWorldTransform(TRUE); + m_previousActor->SetUserNavFlag(TRUE); + m_previousActor->SetBoundary(m_boundary); + + MxS32 i; + for (i = 0; i < m_boundary->GetNumEdges(); i++) { + LegoUnknown100db7f4* e = (LegoUnknown100db7f4*) m_boundary->GetEdges()[i]; + assert(e); + + Mx3DPointFloat local20; + e->FUN_1002ddc0(*m_boundary, local20); + + ((Vector3&) local20).Mul(m_roi->GetWorldBoundingSphere().Radius()); + ((Vector3&) local20).Add(GetWorldPosition()); + + MxS32 j; + for (j = 0; j < m_boundary->GetNumEdges(); j++) { + Mx4DPointFloat& normal = *m_boundary->GetEdgeNormal(j); + + if (local20.Dot(&normal, &local20) + normal[3] < -0.001) { + break; + } + } + + if (m_boundary->GetNumEdges() == j) { + m_previousActor->SetLocation(local20, GetWorldDirection(), GetWorldUp(), TRUE); + break; + } + } + + if (m_boundary->GetNumEdges() == i) { + m_previousActor->SetLocation(GetWorldPosition(), GetWorldDirection(), GetWorldUp(), TRUE); + } + + m_previousActor->SetState(0); + GameState()->m_currentArea = LegoGameState::Area::e_unk66; + } + + FUN_1001b660(); + FUN_10010c30(); + FUN_1003eda0(); } // FUNCTION: LEGO1 0x1001a700 @@ -479,7 +532,7 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p m_world = world; if (p_und) { - VTable0xe0(); + Enter(); } m_world->PlaceActor( @@ -563,7 +616,7 @@ void IslePathActor::VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundar m_world = CurrentWorld(); if (p_reset) { - VTable0xe0(); + Enter(); } m_world->PlaceActor(this); diff --git a/LEGO1/lego/legoomni/src/actors/jetski.cpp b/LEGO1/lego/legoomni/src/actors/jetski.cpp index 2b26d842..8b79a9d3 100644 --- a/LEGO1/lego/legoomni/src/actors/jetski.cpp +++ b/LEGO1/lego/legoomni/src/actors/jetski.cpp @@ -5,7 +5,7 @@ DECOMP_SIZE_ASSERT(Jetski, 0x164) // FUNCTION: LEGO1 0x1007e3b0 Jetski::Jetski() { - this->m_unk0x13c = 25.0; + this->m_maxLinearVel = 25.0; this->m_unk0x150 = 2.0; this->m_unk0x148 = 1; } @@ -24,7 +24,7 @@ void Jetski::VTable0x70(float p_float) } // STUB: LEGO1 0x1007e6f0 -void Jetski::VTable0xe4() +void Jetski::Exit() { // TODO } diff --git a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp index 340ea64d..1aefb3d5 100644 --- a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp +++ b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp @@ -38,7 +38,7 @@ MxLong JukeBoxEntity::Notify(MxParam& p_param) } if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } ((Isle*) FindWorld(*g_isleScript, 0))->SetDestLocation(LegoGameState::e_jukeboxw); diff --git a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp index a716d266..101656d0 100644 --- a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp +++ b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp @@ -5,7 +5,7 @@ DECOMP_SIZE_ASSERT(Motocycle, 0x16c) // FUNCTION: LEGO1 0x100357b0 Motocycle::Motocycle() { - this->m_unk0x13c = 40.0; + this->m_maxLinearVel = 40.0; this->m_unk0x150 = 1.75; this->m_unk0x148 = 1; this->m_unk0x164 = 1.0; @@ -25,7 +25,7 @@ void Motocycle::VTable0x70(float p_float) } // STUB: LEGO1 0x10035bc0 -void Motocycle::VTable0xe4() +void Motocycle::Exit() { // TODO } diff --git a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp index 1ae45305..b1c563e3 100644 --- a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp @@ -51,7 +51,7 @@ undefined4 Pizzeria::HandleClick() if (FUN_1003ef60() && m_pizzaMissionState->m_unk0x0c == 0) { if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { if (!CurrentActor()->IsA("SkateBoard")) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } } diff --git a/LEGO1/lego/legoomni/src/actors/racecar.cpp b/LEGO1/lego/legoomni/src/actors/racecar.cpp index e32fab62..c4f57c9d 100644 --- a/LEGO1/lego/legoomni/src/actors/racecar.cpp +++ b/LEGO1/lego/legoomni/src/actors/racecar.cpp @@ -8,14 +8,14 @@ DECOMP_SIZE_ASSERT(RaceCar, 0x164) // FUNCTION: LEGO1 0x10028200 RaceCar::RaceCar() { - m_unk0x13c = 40.0; + m_maxLinearVel = 40.0; } // FUNCTION: LEGO1 0x10028420 RaceCar::~RaceCar() { ControlManager()->Unregister(this); - VTable0xe4(); + Exit(); } // STUB: LEGO1 0x10028490 diff --git a/LEGO1/lego/legoomni/src/actors/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index 814e1332..90480a84 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -21,7 +21,7 @@ DECOMP_SIZE_ASSERT(SkateBoard, 0x168) SkateBoard::SkateBoard() { m_unk0x160 = FALSE; - m_unk0x13c = 15.0; + m_maxLinearVel = 15.0; m_unk0x150 = 3.5; m_unk0x148 = 1; @@ -54,7 +54,7 @@ MxResult SkateBoard::Create(MxDSAction& p_dsAction) } // FUNCTION: LEGO1 0x10010050 -void SkateBoard::VTable0xe4() +void SkateBoard::Exit() { if (m_act1state->m_unk0x018 == 3) { Pizza* pizza = (Pizza*) CurrentWorld()->Find(*g_isleScript, IsleScript::c_Pizza_Actor); @@ -63,7 +63,7 @@ void SkateBoard::VTable0xe4() m_unk0x160 = FALSE; } - IslePathActor::VTable0xe4(); + IslePathActor::Exit(); GameState()->m_currentArea = LegoGameState::Area::e_skateboard; RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_SkateArms_Ctl); RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_SkatePizza_Bitmap); @@ -86,12 +86,12 @@ MxU32 SkateBoard::HandleClick() if (GameState()->GetActorId() != CurrentActor()->GetActorId()) { if (!CurrentActor()->IsA("SkateBoard")) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); } } if (!CurrentActor()->IsA("SkateBoard")) { - VTable0xe0(); + Enter(); InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_SkateDashboard, NULL); GetCurrentAction().SetObjectId(-1); ControlManager()->Register(this); @@ -111,7 +111,7 @@ MxU32 SkateBoard::HandleControl(LegoControlManagerEvent& p_param) MxU32 result = 0; if (p_param.GetUnknown0x28() == 1 && p_param.GetClickedObjectId() == IsleScript::c_SkateArms_Ctl) { - VTable0xe4(); + Exit(); GameState()->m_currentArea = LegoGameState::Area::e_unk66; result = 1; } diff --git a/LEGO1/lego/legoomni/src/actors/towtrack.cpp b/LEGO1/lego/legoomni/src/actors/towtrack.cpp index 4f259903..40958be7 100644 --- a/LEGO1/lego/legoomni/src/actors/towtrack.cpp +++ b/LEGO1/lego/legoomni/src/actors/towtrack.cpp @@ -21,7 +21,7 @@ TowTrack::TowTrack() m_unk0x170 = -1; m_unk0x16e = 0; m_unk0x174 = -1; - m_unk0x13c = 40.0; + m_maxLinearVel = 40.0; m_unk0x178 = 1.0; } @@ -96,7 +96,7 @@ MxU32 TowTrack::HandleClick() } // STUB: LEGO1 0x1004d8f0 -void TowTrack::VTable0xe4() +void TowTrack::Exit() { // TODO } diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 8b8b30fa..50e1581c 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1573,7 +1573,7 @@ MxU16 LegoAnimationManager::FUN_10062110( Mx3DPointFloat position(p_roi->GetWorldPosition()); // TODO: Fix call - ((Vector3&) position).Sub(&p_position); + ((Vector3&) position).Sub(p_position); float len = position.LenSquared(); float min, max; @@ -2458,17 +2458,17 @@ MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnkn Vector3* v2 = p_edge->CCWVertex(*p_boundary); p1 = *v2; - ((Vector3&) p1).Sub(v1); + ((Vector3&) p1).Sub(*v1); ((Vector3&) p1).Mul(p_destScale); - ((Vector3&) p1).Add(v1); + ((Vector3&) p1).Add(*v1); BoundingBox boundingBox; Mx3DPointFloat vec(1.0f, 1.0f, 1.0f); boundingBox.Min() = p1; - boundingBox.Min().Sub(&vec); + boundingBox.Min().Sub(vec); boundingBox.Max() = p1; - boundingBox.Max().Add(&vec); + boundingBox.Max().Add(vec); return GetViewManager()->FUN_100a6150(boundingBox) == FALSE; } @@ -2677,7 +2677,7 @@ MxResult LegoAnimationManager::FUN_10064670(Vector3* p_position) if (p_position != NULL) { Mx3DPointFloat vec(98.875f, 0.0f, -46.1564f); - ((Vector3&) vec).Sub(p_position); + ((Vector3&) vec).Sub(*p_position); if (vec.LenSquared() < 800.0f) { success = TRUE; @@ -2701,7 +2701,7 @@ MxResult LegoAnimationManager::FUN_10064740(Vector3* p_position) if (p_position != NULL) { Mx3DPointFloat vec(-21.375f, 0.0f, -41.75f); - ((Vector3&) vec).Sub(p_position); + ((Vector3&) vec).Sub(*p_position); if (vec.LenSquared() < 1000.0f) { success = TRUE; diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index 8f9d9b12..a0c1095b 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -467,7 +467,6 @@ MxBool FUN_1003ef60() GameState()->m_currentArea != LegoGameState::e_elevdown && GameState()->m_currentArea != LegoGameState::e_garadoor && GameState()->m_currentArea != LegoGameState::e_polidoor) { - if (CurrentActor() == NULL || !CurrentActor()->IsA("TowTrack")) { if (CurrentActor() == NULL || !CurrentActor()->IsA("Ambulance")) { MxU32 unk0x18 = act1State->GetUnknown18(); diff --git a/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp b/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp index af8c95b0..7414b8bf 100644 --- a/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp @@ -29,7 +29,7 @@ LegoCarRaceActor::LegoCarRaceActor() m_unk0x08 = 1.0f; m_unk0x70 = 0.0f; m_unk0x0c = 0; - m_unk0x13c = 0.0f; + m_maxLinearVel = 0.0f; m_frequencyFactor = 1.0f; m_unk0x1c = 0; m_unk0x10 = 0.65f; diff --git a/LEGO1/lego/legoomni/src/entity/legojetski.cpp b/LEGO1/lego/legoomni/src/entity/legojetski.cpp index a0e72803..5160ab25 100644 --- a/LEGO1/lego/legoomni/src/entity/legojetski.cpp +++ b/LEGO1/lego/legoomni/src/entity/legojetski.cpp @@ -10,11 +10,11 @@ void LegoJetski::FUN_100136f0(float p_worldSpeed) { if (p_worldSpeed < 0) { LegoCarRaceActor::m_unk0x0c = 2; - m_unk0x13c = 0; + m_maxLinearVel = 0; SetWorldSpeed(0); } else { - m_unk0x13c = p_worldSpeed; + m_maxLinearVel = p_worldSpeed; } } diff --git a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp index f0e2e69b..0e8aeff8 100644 --- a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp @@ -97,7 +97,7 @@ MxU32 LegoExtraActor::VTable0x90(float p_time, Matrix4& p_transform) else { m_state = 0; m_scheduledTime = 0.0f; - ((Vector3&) positionRef).Sub(&g_unk0x10104c18); // TODO: Fix call + ((Vector3&) positionRef).Sub(g_unk0x10104c18); // TODO: Fix call m_roi->FUN_100a58f0(p_transform); return TRUE; } @@ -218,7 +218,7 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) // TODO: Fix calls ((Mx3DPointFloat&) dir).Mul(2.0f); - ((Vector3&) positionRef).Add(&dir); + ((Vector3&) positionRef).Add(dir); for (MxS32 i = 0; i < m_boundary->GetNumEdges(); i++) { Mx4DPointFloat* normal = m_boundary->GetEdgeNormal(i); @@ -251,7 +251,7 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) Mx3DPointFloat dir = p_actor->GetWorldDirection(); MxMatrix matrix3 = MxMatrix(roi->GetLocal2World()); Vector3 positionRef(matrix3[3]); - ((Vector3&) positionRef).Add(&g_unk0x10104c18); + ((Vector3&) positionRef).Add(g_unk0x10104c18); roi->FUN_100a58f0(matrix3); #ifdef COMPAT_MODE @@ -463,7 +463,7 @@ MxU32 LegoExtraActor::VTable0x6c( Vector3 local60(local2world[3]); Mx3DPointFloat local54(p_v1); - ((Vector3&) local54).Sub(&local60); + ((Vector3&) local54).Sub(local60); float local1c = p_v2.Dot(&p_v2, &p_v2); float local24 = p_v2.Dot(&p_v2, &local54) * 2.0f; float local20 = local54.Dot(&local54, &local54); diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 6990f1dd..b2250703 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -68,7 +68,7 @@ MxResult LegoPathActor::VTable0x80(Vector3& p_point1, Vector3& p_point2, Vector3 Mx3DPointFloat p1, p2, p3; p1 = p_point3; - ((Vector3&) p1).Sub(&p_point1); + ((Vector3&) p1).Sub(p_point1); m_BADuration = p1.LenSquared(); if (m_BADuration > 0.0f) { @@ -102,14 +102,14 @@ MxResult LegoPathActor::VTable0x88( Mx3DPointFloat p1, p2, p3, p4, p5; p1 = *v2; - ((Vector3&) p1).Sub(v1); + ((Vector3&) p1).Sub(*v1); ((Vector3&) p1).Mul(p_srcScale); - ((Vector3&) p1).Add(v1); + ((Vector3&) p1).Add(*v1); p2 = *v4; - ((Vector3&) p2).Sub(v3); + ((Vector3&) p2).Sub(*v3); ((Vector3&) p2).Mul(p_destScale); - ((Vector3&) p2).Add(v3); + ((Vector3&) p2).Add(*v3); m_boundary = p_boundary; m_destEdge = &p_destEdge; @@ -120,7 +120,7 @@ MxResult LegoPathActor::VTable0x88( p_destEdge.FUN_1002ddc0(*p_boundary, p3); p4 = p2; - ((Vector3&) p4).Sub(&p1); + ((Vector3&) p4).Sub(p1); p4.Unitize(); MxMatrix matrix; @@ -177,9 +177,9 @@ MxResult LegoPathActor::VTable0x84( Mx3DPointFloat p2, p3, p5; p2 = *v4; - ((Vector3&) p2).Sub(v3); + ((Vector3&) p2).Sub(*v3); ((Vector3&) p2).Mul(p_destScale); - ((Vector3&) p2).Add(v3); + ((Vector3&) p2).Add(*v3); m_boundary = p_boundary; m_destEdge = &p_destEdge; @@ -285,12 +285,12 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform) m_worldSpeed *= m_unk0x144; nav->SetLinearVel(m_worldSpeed); Mx3DPointFloat p7(p2); - ((Vector3&) p7).Sub(&p6); + ((Vector3&) p7).Sub(p6); if (p7.Unitize() == 0) { float f = sqrt(p1.LenSquared()) * m_unk0x140; ((Vector3&) p7).Mul(f); - ((Vector3&) p1).Add(&p7); + ((Vector3&) p1).Add(p7); } } } @@ -474,7 +474,7 @@ MxU32 LegoPathActor::VTable0x6c( MxS32 LegoPathActor::VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3) { Mx3DPointFloat v2(p_v2); - ((Vector3&) v2).Sub(&p_v1); + ((Vector3&) v2).Sub(p_v1); float len = v2.LenSquared(); @@ -553,7 +553,7 @@ void LegoPathActor::ParseAction(char* p_extra) if (KeyValueStringParse(value, g_strPERMIT_NAVIGATE, p_extra)) { SetUserNavFlag(TRUE); - NavController()->ResetLinearVel(m_worldSpeed); + NavController()->ResetMaxLinearVel(m_worldSpeed); SetCurrentActor(this); } @@ -650,7 +650,7 @@ MxResult LegoPathActor::VTable0x9c() Mx3DPointFloat local84(m_unk0xec[2]); Mx3DPointFloat local70(local34); - ((Vector3&) local70).Sub(&localc0); + ((Vector3&) local70).Sub(localc0); float len = local70.LenSquared(); if (len >= 0.0f) { len = sqrt(len); diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index bcd1875c..297aa223 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -53,11 +53,11 @@ void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPa Mx3DPointFloat v; v = p_point1; - ((Vector3&) v).Sub(ccwV); + ((Vector3&) v).Sub(*ccwV); float dot1 = v.Dot(&v, m_unk0x50); v = p_point2; - ((Vector3&) v).Sub(ccwV); + ((Vector3&) v).Sub(*ccwV); float dot2 = v.Dot(&v, m_unk0x50); if (dot2 > dot1) { @@ -201,7 +201,7 @@ MxU32 LegoPathBoundary::Intersect( if (local10 == 0) { local10 = 1; vec = p_point2; - ((Vector3&) vec).Sub(&p_point1); + ((Vector3&) vec).Sub(p_point1); len = vec.LenSquared(); if (len <= 0.0f) { @@ -235,10 +235,10 @@ MxU32 LegoPathBoundary::Intersect( p_point3 = vec; p_point3.Mul(localc); - p_point3.Add(&p_point1); + p_point3.Add(p_point1); local50 = p_point2; - ((Vector3&) local50).Sub(local5c); + ((Vector3&) local50).Sub(*local5c); e->FUN_1002ddc0(*this, local70); @@ -258,7 +258,7 @@ MxU32 LegoPathBoundary::Intersect( Vector3* local90 = local88->CWVertex(*this); Mx3DPointFloat locala4(p_point3); - ((Vector3&) locala4).Sub(local90); + ((Vector3&) locala4).Sub(*local90); float local8c = locala4.Dot(&locala4, &local84); @@ -285,7 +285,7 @@ MxU32 LegoPathBoundary::Intersect( Vector3* localc4 = locala8->CWVertex(*this); Mx3DPointFloat locald8(p_point3); - ((Vector3&) locald8).Sub(localc4); + ((Vector3&) locald8).Sub(*localc4); float localc0 = locald8.Dot(&locald8, &localbc); @@ -317,7 +317,7 @@ MxU32 LegoPathBoundary::Intersect( else if (local58 > 0.0f && e->m_unk0x3c > local58) { p_point3 = local70; p_point3.Mul(local58); - p_point3.Add(local5c); + p_point3.Add(*local5c); p_edge = e; return 1; } @@ -345,7 +345,7 @@ MxU32 LegoPathBoundary::FUN_10057fe0(LegoAnimPresenter* p_presenter) Mx3DPointFloat unk0x30; unk0x30 = m_unk0x30; - ((Vector3&) unk0x30).Sub(&p_presenter->m_unk0xa8); + ((Vector3&) unk0x30).Sub(p_presenter->m_unk0xa8); float len = unk0x30.LenSquared(); float local20 = p_presenter->m_unk0xa4 + m_unk0x44; diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index 19fc04fd..ddfe66ec 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -94,7 +94,7 @@ MxResult LegoPathController::Create(MxU8* p_data, const Vector3& p_location, con for (i = 0; i < m_numN; i++) { // TODO: Fix call - ((Vector3&) m_unk0x10[i]).Add(&p_location); + ((Vector3&) m_unk0x10[i]).Add(p_location); } for (i = 0; i < m_numL; i++) { @@ -756,9 +756,9 @@ MxS32 LegoPathController::FUN_1004a240( Mx3DPointFloat vec; p_v1 = *p_edge->CCWVertex(*p_boundary); - p_v1.Sub(p_edge->CWVertex(*p_boundary)); + p_v1.Sub(*p_edge->CWVertex(*p_boundary)); p_v1.Mul(p_f1); - p_v1.Add(p_edge->CWVertex(*p_boundary)); + p_v1.Add(*p_edge->CWVertex(*p_boundary)); p_edge->FUN_1002ddc0(*p_boundary, vec); p_v2.EqualsCross(p_boundary->GetUnknown0x14(), &vec); return 0; diff --git a/LEGO1/lego/legoomni/src/race/legoracecar.cpp b/LEGO1/lego/legoomni/src/race/legoracecar.cpp index 949ae142..0345f9eb 100644 --- a/LEGO1/lego/legoomni/src/race/legoracecar.cpp +++ b/LEGO1/lego/legoomni/src/race/legoracecar.cpp @@ -23,11 +23,11 @@ void LegoRaceCar::FUN_10012ea0(float p_worldSpeed) { if (p_worldSpeed < 0) { LegoCarRaceActor::m_unk0x0c = 2; - m_unk0x13c = 0; + m_maxLinearVel = 0; SetWorldSpeed(0); } else { - m_unk0x13c = p_worldSpeed; + m_maxLinearVel = p_worldSpeed; } } diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index ffdb2b63..723a1a30 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -648,12 +648,7 @@ void LegoAnimPresenter::PutFrame() up = und; -#ifdef COMPAT_MODE - Mx3DPointFloat location = m_currentWorld->GetCamera()->GetWorldLocation(); - ((Vector3&) up).Sub(&location); -#else - ((Vector3&) up).Sub(&m_currentWorld->GetCamera()->GetWorldLocation()); -#endif + ((Vector3&) up).Sub(m_currentWorld->GetCamera()->GetWorldLocation()); ((Vector3&) dir).Div(dirsqr); pos.EqualsCross(&dir, &up); pos.Unitize(); @@ -1119,7 +1114,7 @@ void LegoAnimPresenter::VTable0x8c() m_unk0xa8.Add((*m_unk0x78)[3]); } else { - m_unk0xa8.Add(&m_action->GetLocation()); + m_unk0xa8.Add(m_action->GetLocation()); } if (m_currentWorld == NULL) { @@ -1176,10 +1171,10 @@ MxU32 LegoAnimPresenter::VTable0x94(Vector3& p_v1, Vector3& p_v2, float p_f1, fl b = p_v2; ((Vector3&) b).Mul(p_f1); - ((Vector3&) b).Add(&p_v1); + ((Vector3&) b).Add(p_v1); a = b; - ((Vector3&) a).Sub(&m_unk0xa8); + ((Vector3&) a).Sub(m_unk0xa8); float len = a.LenSquared(); if (len <= 0.0f) { diff --git a/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp index eaba5d98..56386538 100644 --- a/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp @@ -66,12 +66,7 @@ void LegoLoopingAnimPresenter::PutFrame() up = und; -#ifdef COMPAT_MODE - Mx3DPointFloat location = m_currentWorld->GetCamera()->GetWorldLocation(); - ((Vector3&) up).Sub(&location); -#else - ((Vector3&) up).Sub(&m_currentWorld->GetCamera()->GetWorldLocation()); -#endif + ((Vector3&) up).Sub(m_currentWorld->GetCamera()->GetWorldLocation()); ((Vector3&) dir).Div(dirsqr); pos.EqualsCross(&dir, &up); pos.Unitize(); diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 806903af..de524cb2 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -717,13 +717,13 @@ void Isle::Enable(MxBool p_enable) Mx3DPointFloat position(CurrentActor()->GetROI()->GetWorldPosition()); Mx3DPointFloat sub(-21.375f, 0.0f, -41.75f); - ((Vector3&) sub).Sub(&position); + ((Vector3&) sub).Sub(position); if (sub.LenSquared() < 1024.0f) { AnimationManager()->FUN_10064740(NULL); } Mx3DPointFloat sub2(98.874992f, 0.0f, -46.156292f); - ((Vector3&) sub2).Sub(&position); + ((Vector3&) sub2).Sub(position); if (sub2.LenSquared() < 1024.0f) { AnimationManager()->FUN_10064670(NULL); } @@ -1219,7 +1219,7 @@ MxBool Isle::Escape() if (CurrentActor()) { if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); m_skateboard->SetUnknown0x160(FALSE); } } @@ -1265,7 +1265,7 @@ void Isle::FUN_10033350() if (CurrentActor()) { if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->VTable0xe4(); + ((IslePathActor*) CurrentActor())->Exit(); m_skateboard->SetUnknown0x160(FALSE); } } diff --git a/LEGO1/lego/sources/misc/legounknown.cpp b/LEGO1/lego/sources/misc/legounknown.cpp index 117a50af..b3976b51 100644 --- a/LEGO1/lego/sources/misc/legounknown.cpp +++ b/LEGO1/lego/sources/misc/legounknown.cpp @@ -42,9 +42,9 @@ LegoResult LegoUnknown::FUN_1009a1e0(float p_f1, Matrix4& p_mat, Vector3& p_v, L } else if (p_f1 >= 0.999) { v1 = m_unk0x00[0]; - ((Vector3&) v1).Add(&m_unk0x00[1]); - ((Vector3&) v1).Add(&m_unk0x00[2]); - ((Vector3&) v1).Add(&m_unk0x00[3]); + ((Vector3&) v1).Add(m_unk0x00[1]); + ((Vector3&) v1).Add(m_unk0x00[2]); + ((Vector3&) v1).Add(m_unk0x00[3]); for (LegoS32 i = 0; i < 3; i++) { v4[i] = m_unk0x00[1][i] + m_unk0x00[2][i] * 2.0f + m_unk0x00[3][i] * 3.0f; diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index c978b6ce..c2f35dae 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -565,7 +565,7 @@ LegoU32 LegoROI::FUN_100a9410( if (p_collideBox) { Mx3DPointFloat v2(p_v2); ((Vector3&) v2).Mul(p_f1); - ((Vector3&) v2).Add(&p_v1); + ((Vector3&) v2).Add(p_v1); Mx4DPointFloat localc0; Mx4DPointFloat local9c; @@ -585,7 +585,7 @@ LegoU32 LegoROI::FUN_100a9410( localc0[3] = local9c[3] = local168[3] = 1.0f; local38 = local58; - ((Vector3&) local38).Add(&locala8); + ((Vector3&) local38).Add(locala8); ((Vector3&) local38).Mul(0.5f); local70 = localc0; @@ -624,7 +624,7 @@ LegoU32 LegoROI::FUN_100a9410( if (local50 >= 0.0f && local50 <= p_f1) { Mx3DPointFloat local17c(p_v2); ((Vector3&) local17c).Mul(local50); - ((Vector3&) local17c).Add(&local4c); + ((Vector3&) local17c).Add(local4c); LegoS32 j; for (j = 0; j < 6; j++) { @@ -644,7 +644,7 @@ LegoU32 LegoROI::FUN_100a9410( } else { Mx3DPointFloat v1(p_v1); - ((Vector3&) v1).Sub(&GetWorldBoundingSphere().Center()); + ((Vector3&) v1).Sub(GetWorldBoundingSphere().Center()); float local10 = GetWorldBoundingSphere().Radius(); float local8 = p_v2.Dot(&p_v2, &p_v2); @@ -681,7 +681,7 @@ LegoU32 LegoROI::FUN_100a9410( if (local1c >= 0.0f && p_f1 >= local1c) { p_v3 = p_v2; p_v3.Mul(local1c); - p_v3.Add(&p_v1); + p_v3.Add(p_v1); return 1; } } @@ -708,13 +708,7 @@ void TimeROI::FUN_100a9b40(Matrix4& p_matrix, LegoTime p_time) Mx3DPointFloat targetPosition(p_matrix[3]); // TODO: Figure out how to get type right for the call - // TODO: Fix constness of vector/matrix functions -#ifdef COMPAT_MODE - Vector3 worldPosition(m_local2world[3]); - ((Vector3&) targetPosition).Sub(&worldPosition); -#else - ((Vector3&) targetPosition).Sub(&Vector3(m_local2world[3])); -#endif + ((Vector3&) targetPosition).Sub(Vector3(m_local2world[3])); float division = time * 0.001; ((Vector3&) targetPosition).Div(division); diff --git a/LEGO1/mxgeometry/mxgeometry3d.h b/LEGO1/mxgeometry/mxgeometry3d.h index 970695bb..61fdac1d 100644 --- a/LEGO1/mxgeometry/mxgeometry3d.h +++ b/LEGO1/mxgeometry/mxgeometry3d.h @@ -149,10 +149,10 @@ inline void UnknownMx4DPointFloat::Unknown7() Mx4DPointFloat v2; v1 = m_unk0x00; - ((Vector4&) v1).Add(&m_unk0x18); + ((Vector4&) v1).Add(m_unk0x18); v2 = m_unk0x00; - ((Vector4&) v2).Sub(&m_unk0x18); + ((Vector4&) v2).Sub(m_unk0x18); if (v1.Dot(&v1, &v1) < v2.Dot(&v2, &v2)) { ((Vector4&) m_unk0x18).Mul(-1.0f); diff --git a/LEGO1/realtime/vector.h b/LEGO1/realtime/vector.h index 01a15d49..3fd82220 100644 --- a/LEGO1/realtime/vector.h +++ b/LEGO1/realtime/vector.h @@ -120,13 +120,13 @@ class Vector2 { virtual void Add(float* p_other) { AddImpl(p_other); } // vtable+0x4c // FUNCTION: LEGO1 0x100021e0 - virtual void Add(const Vector2* p_other) { AddImpl((float*) p_other->m_data); } // vtable+0x48 + virtual void Add(const Vector2& p_other) { AddImpl((float*) p_other.m_data); } // vtable+0x48 // FUNCTION: LEGO1 0x100021f0 virtual void Sub(const float* p_other) { SubImpl((float*) p_other); } // vtable+0x58 // FUNCTION: LEGO1 0x10002200 - virtual void Sub(const Vector2* p_other) { SubImpl((float*) p_other->m_data); } // vtable+0x54 + virtual void Sub(const Vector2& p_other) { SubImpl((float*) p_other.m_data); } // vtable+0x54 // FUNCTION: LEGO1 0x10002210 virtual void Mul(float* p_other) { MulVectorImpl(p_other); } // vtable+0x64 diff --git a/LEGO1/viewmanager/viewmanager.cpp b/LEGO1/viewmanager/viewmanager.cpp index fe6c00a6..3531381c 100644 --- a/LEGO1/viewmanager/viewmanager.cpp +++ b/LEGO1/viewmanager/viewmanager.cpp @@ -428,10 +428,10 @@ void ViewManager::UpdateViewTransformations() Vector3 u(unk0x150[i]); x = c; - ((Vector3&) x).Sub(&b); // TODO: Fix call + ((Vector3&) x).Sub(b); // TODO: Fix call y = a; - ((Vector3&) y).Sub(&b); // TODO: Fix call + ((Vector3&) y).Sub(b); // TODO: Fix call u.EqualsCross(&x, &y); u.Unitize(); From ca17928fc60e6ef25b10d3f4a6a5ff565ba96801 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 6 Jun 2024 12:19:43 -0400 Subject: [PATCH 11/12] Implement/match Ambulance::Notify (#998) --- LEGO1/lego/legoomni/include/ambulance.h | 18 +++--- LEGO1/lego/legoomni/include/bike.h | 8 +-- LEGO1/lego/legoomni/include/dunebuggy.h | 12 ++-- LEGO1/lego/legoomni/include/helicopter.h | 14 ++--- LEGO1/lego/legoomni/include/islepathactor.h | 10 ++-- LEGO1/lego/legoomni/include/jetski.h | 10 ++-- LEGO1/lego/legoomni/include/motocycle.h | 12 ++-- LEGO1/lego/legoomni/include/racecar.h | 2 +- LEGO1/lego/legoomni/include/skateboard.h | 10 ++-- LEGO1/lego/legoomni/include/towtrack.h | 16 +++--- LEGO1/lego/legoomni/src/actors/ambulance.cpp | 57 ++++++++++++++++--- LEGO1/lego/legoomni/src/actors/bike.cpp | 4 +- LEGO1/lego/legoomni/src/actors/dunebuggy.cpp | 6 +- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 6 +- .../legoomni/src/actors/islepathactor.cpp | 6 +- LEGO1/lego/legoomni/src/actors/jetski.cpp | 4 +- LEGO1/lego/legoomni/src/actors/motorcycle.cpp | 6 +- LEGO1/lego/legoomni/src/actors/racecar.cpp | 2 +- LEGO1/lego/legoomni/src/actors/skateboard.cpp | 6 +- LEGO1/lego/legoomni/src/actors/towtrack.cpp | 8 +-- 20 files changed, 131 insertions(+), 86 deletions(-) diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index a22c0515..aa357385 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -4,6 +4,8 @@ #include "islepathactor.h" #include "legostate.h" +class MxEndActionNotificationParam; + // VTABLE: LEGO1 0x100d72a0 // SIZE 0x24 class AmbulanceMissionState : public LegoState { @@ -83,13 +85,15 @@ class Ambulance : public IslePathActor { return !strcmp(p_name, Ambulance::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c - void VTable0x70(float p_float) override; // vtable+0x70 - MxU32 HandleClick() override; // vtable+0xcc - MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c + void VTable0x70(float p_float) override; // vtable+0x70 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxLong HandleNotification19(MxType19NotificationParam& p_param) override; // vtable+0xdc + void Exit() override; // vtable+0xe4 + virtual MxLong HandleButtonDown(LegoControlManagerEvent& p_param); // vtable+0xf0 + virtual MxLong HandleEndAction(MxEndActionNotificationParam& p_param); // vtable+0xf4 void CreateState(); void FUN_10036e60(); diff --git a/LEGO1/lego/legoomni/include/bike.h b/LEGO1/lego/legoomni/include/bike.h index b042bee6..a77156b5 100644 --- a/LEGO1/lego/legoomni/include/bike.h +++ b/LEGO1/lego/legoomni/include/bike.h @@ -23,10 +23,10 @@ class Bike : public IslePathActor { return !strcmp(p_name, Bike::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - MxU32 HandleClick() override; // vtable+0xcc - MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + void Exit() override; // vtable+0xe4 void FUN_10076b60(); diff --git a/LEGO1/lego/legoomni/include/dunebuggy.h b/LEGO1/lego/legoomni/include/dunebuggy.h index 287417d6..662d90ef 100644 --- a/LEGO1/lego/legoomni/include/dunebuggy.h +++ b/LEGO1/lego/legoomni/include/dunebuggy.h @@ -23,12 +23,12 @@ class DuneBuggy : public IslePathActor { return !strcmp(p_name, DuneBuggy::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void VTable0x70(float p_float) override; // vtable+0x70 - MxU32 HandleClick() override; // vtable+0xcc - MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxLong HandleNotification19(MxType19NotificationParam& p_param) override; // vtable+0xdc + void Exit() override; // vtable+0xe4 void FUN_10068350(); diff --git a/LEGO1/lego/legoomni/include/helicopter.h b/LEGO1/lego/legoomni/include/helicopter.h index 1617d6b5..2676aa52 100644 --- a/LEGO1/lego/legoomni/include/helicopter.h +++ b/LEGO1/lego/legoomni/include/helicopter.h @@ -63,13 +63,13 @@ class Helicopter : public IslePathActor { return !strcmp(p_name, Helicopter::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void VTable0x70(float p_float) override; // vtable+0x70 - void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 - MxU32 HandleClick() override; // vtable+0xcc - MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - MxU32 VTable0xd8(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxLong HandleEndAnim(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 + void Exit() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x10003210 // Helicopter::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/islepathactor.h b/LEGO1/lego/legoomni/include/islepathactor.h index 4150db87..48aef88f 100644 --- a/LEGO1/lego/legoomni/include/islepathactor.h +++ b/LEGO1/lego/legoomni/include/islepathactor.h @@ -107,19 +107,19 @@ class IslePathActor : public LegoPathActor { void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c // FUNCTION: LEGO1 0x10002e70 - virtual MxU32 HandleClick() { return 0; } // vtable+0xcc + virtual MxLong HandleClick() { return 0; } // vtable+0xcc // FUNCTION: LEGO1 0x10002df0 - virtual MxU32 VTable0xd0() { return 0; } // vtable+0xd0 + virtual MxLong HandleNotification0() { return 0; } // vtable+0xd0 // FUNCTION: LEGO1 0x10002e80 - virtual MxU32 HandleControl(LegoControlManagerEvent&) { return 0; } // vtable+0xd4 + virtual MxLong HandleControl(LegoControlManagerEvent&) { return 0; } // vtable+0xd4 // FUNCTION: LEGO1 0x10002e90 - virtual MxU32 VTable0xd8(LegoEndAnimNotificationParam&) { return 0; } // vtable+0xd8 + virtual MxLong HandleEndAnim(LegoEndAnimNotificationParam&) { return 0; } // vtable+0xd8 // FUNCTION: LEGO1 0x10002e00 - virtual MxU32 VTable0xdc(MxType19NotificationParam&) { return 0; } // vtable+0xdc + virtual MxLong HandleNotification19(MxType19NotificationParam&) { return 0; } // vtable+0xdc virtual void Enter(); // vtable+0xe0 virtual void Exit(); // vtable+0xe4 diff --git a/LEGO1/lego/legoomni/include/jetski.h b/LEGO1/lego/legoomni/include/jetski.h index 3eb972a6..b49b11fe 100644 --- a/LEGO1/lego/legoomni/include/jetski.h +++ b/LEGO1/lego/legoomni/include/jetski.h @@ -25,11 +25,11 @@ class Jetski : public IslePathActor { return !strcmp(p_name, Jetski::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void VTable0x70(float p_float) override; // vtable+0x70 - MxU32 HandleClick() override; // vtable+0xcc - MxU32 HandleControl(LegoControlManagerEvent&) override; // vtable+0xd4 - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerEvent&) override; // vtable+0xd4 + void Exit() override; // vtable+0xe4 void FUN_1007e990(); diff --git a/LEGO1/lego/legoomni/include/motocycle.h b/LEGO1/lego/legoomni/include/motocycle.h index 1e7599af..8a15967f 100644 --- a/LEGO1/lego/legoomni/include/motocycle.h +++ b/LEGO1/lego/legoomni/include/motocycle.h @@ -23,12 +23,12 @@ class Motocycle : public IslePathActor { return !strcmp(p_name, Motocycle::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void VTable0x70(float p_float) override; // vtable+0x70 - MxU32 HandleClick() override; // vtable+0xcc - MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - MxU32 VTable0xdc(MxType19NotificationParam&) override; // vtable+0xdc - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxLong HandleNotification19(MxType19NotificationParam&) override; // vtable+0xdc + void Exit() override; // vtable+0xe4 void FUN_10035e10(); diff --git a/LEGO1/lego/legoomni/include/racecar.h b/LEGO1/lego/legoomni/include/racecar.h index 72174c8f..b0afd960 100644 --- a/LEGO1/lego/legoomni/include/racecar.h +++ b/LEGO1/lego/legoomni/include/racecar.h @@ -25,7 +25,7 @@ class RaceCar : public IslePathActor { } MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - MxU32 HandleClick() override; // vtable+0xcc + MxLong HandleClick() override; // vtable+0xcc // SYNTHETIC: LEGO1 0x10028400 // RaceCar::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/skateboard.h b/LEGO1/lego/legoomni/include/skateboard.h index 4e8d17fd..fa78c2e8 100644 --- a/LEGO1/lego/legoomni/include/skateboard.h +++ b/LEGO1/lego/legoomni/include/skateboard.h @@ -26,11 +26,11 @@ class SkateBoard : public IslePathActor { return !strcmp(p_name, SkateBoard::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - MxU32 HandleClick() override; // vtable+0xcc - MxU32 VTable0xd0() override; // vtable+0xd0 - MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleNotification0() override; // vtable+0xd0 + MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + void Exit() override; // vtable+0xe4 inline void SetUnknown0x160(MxBool p_unk0x160) { m_unk0x160 = p_unk0x160; } diff --git a/LEGO1/lego/legoomni/include/towtrack.h b/LEGO1/lego/legoomni/include/towtrack.h index 921ccbca..ee91b5a5 100644 --- a/LEGO1/lego/legoomni/include/towtrack.h +++ b/LEGO1/lego/legoomni/include/towtrack.h @@ -81,14 +81,14 @@ class TowTrack : public IslePathActor { return !strcmp(p_name, TowTrack::ClassName()) || IslePathActor::IsA(p_name); } - MxLong Notify(MxParam& p_param) override; // vtable+0x04 - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void VTable0x70(float p_float) override; // vtable+0x70 - MxU32 HandleClick() override; // vtable+0xcc - MxU32 HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - MxU32 VTable0xd8(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 - MxU32 VTable0xdc(MxType19NotificationParam& p_param) override; // vtable+0xdc - void Exit() override; // vtable+0xe4 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxLong HandleEndAnim(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 + MxLong HandleNotification19(MxType19NotificationParam& p_param) override; // vtable+0xdc + void Exit() override; // vtable+0xe4 void CreateState(); void FUN_1004dab0(); diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index e1a52601..2474c7b9 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -16,18 +16,19 @@ DECOMP_SIZE_ASSERT(Ambulance, 0x184) DECOMP_SIZE_ASSERT(AmbulanceMissionState, 0x24) // FUNCTION: LEGO1 0x10035ee0 +// FUNCTION: BETA10 0x10022820 Ambulance::Ambulance() { + m_maxLinearVel = 40.0; + m_state = NULL; m_unk0x168 = 0; m_unk0x16a = -1; - m_state = NULL; m_unk0x16c = 0; - m_unk0x174 = -1; m_unk0x16e = 0; - m_unk0x178 = -1; m_unk0x170 = 0; + m_unk0x174 = -1; m_unk0x172 = 0; - m_maxLinearVel = 40.0; + m_unk0x178 = -1; m_unk0x17c = 1.0; } @@ -37,6 +38,7 @@ void Ambulance::Destroy(MxBool p_fromDestructor) } // FUNCTION: LEGO1 0x10036150 +// FUNCTION: BETA10 0x100228fe Ambulance::~Ambulance() { ControlManager()->Unregister(this); @@ -44,6 +46,7 @@ Ambulance::~Ambulance() } // FUNCTION: LEGO1 0x100361d0 +// FUNCTION: BETA10 0x10022993 MxResult Ambulance::Create(MxDSAction& p_dsAction) { MxResult result = IslePathActor::Create(p_dsAction); @@ -76,6 +79,7 @@ void Ambulance::VTable0x70(float p_float) } // FUNCTION: LEGO1 0x100363f0 +// FUNCTION: BETA10 0x10022b2a void Ambulance::CreateState() { LegoGameState* gameState = GameState(); @@ -88,22 +92,59 @@ void Ambulance::CreateState() m_state = state; } -// STUB: LEGO1 0x10036420 +// FUNCTION: LEGO1 0x10036420 +// FUNCTION: BETA10 0x10022b84 MxLong Ambulance::Notify(MxParam& p_param) +{ + MxLong result = 0; + + switch (((MxNotificationParam&) p_param).GetType()) { + case c_notificationType0: + result = HandleNotification0(); + break; + case c_notificationEndAction: + result = HandleEndAction((MxEndActionNotificationParam&) p_param); + break; + case c_notificationButtonDown: + result = HandleButtonDown((LegoControlManagerEvent&) p_param); + break; + case c_notificationClick: + result = HandleClick(); + break; + case c_notificationControl: + result = HandleControl((LegoControlManagerEvent&) p_param); + break; + case c_notificationType19: + result = HandleNotification19((MxType19NotificationParam&) p_param); + break; + } + + return result; +} + +// STUB: LEGO1 0x100364d0 +MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param) +{ + // TODO + return 0; +} + +// STUB: LEGO1 0x100367c0 +MxLong Ambulance::HandleButtonDown(LegoControlManagerEvent& p_param) { // TODO return 0; } // STUB: LEGO1 0x10036860 -MxU32 Ambulance::VTable0xdc(MxType19NotificationParam& p_param) +MxLong Ambulance::HandleNotification19(MxType19NotificationParam& p_param) { // TODO return 0; } // STUB: LEGO1 0x10036ce0 -MxU32 Ambulance::HandleClick() +MxLong Ambulance::HandleClick() { // TODO return 0; @@ -122,7 +163,7 @@ void Ambulance::Exit() } // STUB: LEGO1 0x10036f90 -MxU32 Ambulance::HandleControl(LegoControlManagerEvent& p_param) +MxLong Ambulance::HandleControl(LegoControlManagerEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/bike.cpp b/LEGO1/lego/legoomni/src/actors/bike.cpp index 3511971f..52401e28 100644 --- a/LEGO1/lego/legoomni/src/actors/bike.cpp +++ b/LEGO1/lego/legoomni/src/actors/bike.cpp @@ -45,14 +45,14 @@ void Bike::Exit() } // STUB: LEGO1 0x100769a0 -MxU32 Bike::HandleClick() +MxLong Bike::HandleClick() { // TODO return 0; } // STUB: LEGO1 0x10076aa0 -MxU32 Bike::HandleControl(LegoControlManagerEvent& p_param) +MxLong Bike::HandleControl(LegoControlManagerEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp index f8d9f2dd..5f51d088 100644 --- a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp +++ b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp @@ -31,21 +31,21 @@ void DuneBuggy::Exit() } // STUB: LEGO1 0x10068060 -MxU32 DuneBuggy::HandleClick() +MxLong DuneBuggy::HandleClick() { // TODO return 0; } // STUB: LEGO1 0x100681b0 -MxU32 DuneBuggy::HandleControl(LegoControlManagerEvent& p_param) +MxLong DuneBuggy::HandleControl(LegoControlManagerEvent& p_param) { // TODO return 0; } // STUB: LEGO1 0x10068270 -MxU32 DuneBuggy::VTable0xdc(MxType19NotificationParam& p_param) +MxLong DuneBuggy::HandleNotification19(MxType19NotificationParam& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index bcdbab6f..5bd4b364 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -103,7 +103,7 @@ void Helicopter::Exit() } // FUNCTION: LEGO1 0x10003480 -MxU32 Helicopter::HandleClick() +MxLong Helicopter::HandleClick() { if (!FUN_1003ef60()) { return 1; @@ -152,7 +152,7 @@ MxU32 Helicopter::HandleClick() } // FUNCTION: LEGO1 0x100035e0 -MxU32 Helicopter::HandleControl(LegoControlManagerEvent& p_param) +MxLong Helicopter::HandleControl(LegoControlManagerEvent& p_param) { MxU32 ret = 0; MxAtomId script; @@ -261,7 +261,7 @@ MxU32 Helicopter::HandleControl(LegoControlManagerEvent& p_param) } // FUNCTION: LEGO1 0x10003c20 -MxU32 Helicopter::VTable0xd8(LegoEndAnimNotificationParam& p_param) +MxLong Helicopter::HandleEndAnim(LegoEndAnimNotificationParam& p_param) { MxU32 ret = 0; diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index e920cb2f..e58ff645 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -52,7 +52,7 @@ MxLong IslePathActor::Notify(MxParam& p_param) switch (((MxNotificationParam&) p_param).GetType()) { case c_notificationType0: - ret = VTable0xd0(); + ret = HandleNotification0(); break; case c_notificationClick: ret = HandleClick(); @@ -61,10 +61,10 @@ MxLong IslePathActor::Notify(MxParam& p_param) ret = HandleControl((LegoControlManagerEvent&) p_param); break; case c_notificationEndAnim: - ret = VTable0xd8((LegoEndAnimNotificationParam&) p_param); + ret = HandleEndAnim((LegoEndAnimNotificationParam&) p_param); break; case c_notificationType19: - ret = VTable0xdc((MxType19NotificationParam&) p_param); + ret = HandleNotification19((MxType19NotificationParam&) p_param); break; } diff --git a/LEGO1/lego/legoomni/src/actors/jetski.cpp b/LEGO1/lego/legoomni/src/actors/jetski.cpp index 8b79a9d3..fa6ad80b 100644 --- a/LEGO1/lego/legoomni/src/actors/jetski.cpp +++ b/LEGO1/lego/legoomni/src/actors/jetski.cpp @@ -30,14 +30,14 @@ void Jetski::Exit() } // STUB: LEGO1 0x1007e750 -MxU32 Jetski::HandleClick() +MxLong Jetski::HandleClick() { // TODO return 0; } // STUB: LEGO1 0x1007e8e0 -MxU32 Jetski::HandleControl(LegoControlManagerEvent& p_param) +MxLong Jetski::HandleControl(LegoControlManagerEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp index 101656d0..01ae480e 100644 --- a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp +++ b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp @@ -31,21 +31,21 @@ void Motocycle::Exit() } // STUB: LEGO1 0x10035c50 -MxU32 Motocycle::HandleClick() +MxLong Motocycle::HandleClick() { // TODO return 0; } // STUB: LEGO1 0x10035d70 -MxU32 Motocycle::HandleControl(LegoControlManagerEvent& p_param) +MxLong Motocycle::HandleControl(LegoControlManagerEvent& p_param) { // TODO return 0; } // STUB: LEGO1 0x10035df0 -MxU32 Motocycle::VTable0xdc(MxType19NotificationParam& p_param) +MxLong Motocycle::HandleNotification19(MxType19NotificationParam& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/racecar.cpp b/LEGO1/lego/legoomni/src/actors/racecar.cpp index c4f57c9d..c38d3537 100644 --- a/LEGO1/lego/legoomni/src/actors/racecar.cpp +++ b/LEGO1/lego/legoomni/src/actors/racecar.cpp @@ -26,7 +26,7 @@ MxResult RaceCar::Create(MxDSAction& p_dsAction) } // STUB: LEGO1 0x100284d0 -MxU32 RaceCar::HandleClick() +MxLong RaceCar::HandleClick() { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index 90480a84..8e88733a 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -71,7 +71,7 @@ void SkateBoard::Exit() } // FUNCTION: LEGO1 0x100100e0 -MxU32 SkateBoard::HandleClick() +MxLong SkateBoard::HandleClick() { Act1State* state = (Act1State*) GameState()->GetState("Act1State"); @@ -106,7 +106,7 @@ MxU32 SkateBoard::HandleClick() } // FUNCTION: LEGO1 0x10010230 -MxU32 SkateBoard::HandleControl(LegoControlManagerEvent& p_param) +MxLong SkateBoard::HandleControl(LegoControlManagerEvent& p_param) { MxU32 result = 0; @@ -139,7 +139,7 @@ void SkateBoard::EnableScenePresentation(MxBool p_enable) // FUNCTION: LEGO1 0x100104f0 // FUNCTION: BETA10 0x100f5472 -MxU32 SkateBoard::VTable0xd0() +MxLong SkateBoard::HandleNotification0() { EnableScenePresentation(m_unk0x160); return 1; diff --git a/LEGO1/lego/legoomni/src/actors/towtrack.cpp b/LEGO1/lego/legoomni/src/actors/towtrack.cpp index 40958be7..461777cf 100644 --- a/LEGO1/lego/legoomni/src/actors/towtrack.cpp +++ b/LEGO1/lego/legoomni/src/actors/towtrack.cpp @@ -75,21 +75,21 @@ MxLong TowTrack::Notify(MxParam& p_param) } // STUB: LEGO1 0x1004cd30 -MxU32 TowTrack::VTable0xd8(LegoEndAnimNotificationParam& p_param) +MxLong TowTrack::HandleEndAnim(LegoEndAnimNotificationParam& p_param) { // TODO return 0; } // STUB: LEGO1 0x1004d330 -MxU32 TowTrack::VTable0xdc(MxType19NotificationParam& p_param) +MxLong TowTrack::HandleNotification19(MxType19NotificationParam& p_param) { // TODO return 0; } // STUB: LEGO1 0x1004d690 -MxU32 TowTrack::HandleClick() +MxLong TowTrack::HandleClick() { // TODO return 0; @@ -102,7 +102,7 @@ void TowTrack::Exit() } // STUB: LEGO1 0x1004d9e0 -MxU32 TowTrack::HandleControl(LegoControlManagerEvent& p_param) +MxLong TowTrack::HandleControl(LegoControlManagerEvent& p_param) { // TODO return 0; From ba378eb22442d71fe4f23a5c818cdfad16d3b16d Mon Sep 17 00:00:00 2001 From: MS Date: Thu, 6 Jun 2024 17:15:57 -0400 Subject: [PATCH 12/12] Streamline MxVideoParamFlags (#999) * Streamline MxVideoParamFlags * Remove this-> from MxOmniCreateFlags --- LEGO1/omni/include/mxomnicreateflags.h | 28 ++++---- LEGO1/omni/include/mxvideoparam.h | 27 +++++--- LEGO1/omni/include/mxvideoparamflags.h | 81 +++++++++++++--------- LEGO1/omni/src/main/mxomnicreateflags.cpp | 20 +++--- LEGO1/omni/src/video/mxvideoparam.cpp | 71 ++++++++++--------- LEGO1/omni/src/video/mxvideoparamflags.cpp | 24 ++++--- 6 files changed, 144 insertions(+), 107 deletions(-) diff --git a/LEGO1/omni/include/mxomnicreateflags.h b/LEGO1/omni/include/mxomnicreateflags.h index 561af2a1..c3b25957 100644 --- a/LEGO1/omni/include/mxomnicreateflags.h +++ b/LEGO1/omni/include/mxomnicreateflags.h @@ -9,46 +9,46 @@ class MxOmniCreateFlags { MxOmniCreateFlags(); // FUNCTION: BETA10 0x10092b50 - inline void CreateObjectFactory(MxBool p_enable) { this->m_flags1.m_bit0 = p_enable; } + inline void CreateObjectFactory(MxBool p_enable) { m_flags1.m_bit0 = p_enable; } // FUNCTION: BETA10 0x10092b90 - inline void CreateTickleManager(MxBool p_enable) { this->m_flags1.m_bit2 = p_enable; } + inline void CreateTickleManager(MxBool p_enable) { m_flags1.m_bit2 = p_enable; } // FUNCTION: BETA10 0x10092bd0 - inline void CreateVideoManager(MxBool p_enable) { this->m_flags1.m_bit4 = p_enable; } + inline void CreateVideoManager(MxBool p_enable) { m_flags1.m_bit4 = p_enable; } // FUNCTION: BETA10 0x10092c10 - inline void CreateSoundManager(MxBool p_enable) { this->m_flags1.m_bit5 = p_enable; } + inline void CreateSoundManager(MxBool p_enable) { m_flags1.m_bit5 = p_enable; } // FUNCTION: BETA10 0x10130cd0 - inline const MxBool CreateObjectFactory() const { return this->m_flags1.m_bit0; } + inline const MxBool CreateObjectFactory() const { return m_flags1.m_bit0; } // FUNCTION: BETA10 0x10130cf0 - inline const MxBool CreateVariableTable() const { return this->m_flags1.m_bit1; } + inline const MxBool CreateVariableTable() const { return m_flags1.m_bit1; } // FUNCTION: BETA10 0x10130d10 - inline const MxBool CreateTickleManager() const { return this->m_flags1.m_bit2; } + inline const MxBool CreateTickleManager() const { return m_flags1.m_bit2; } // FUNCTION: BETA10 0x10130d30 - inline const MxBool CreateNotificationManager() const { return this->m_flags1.m_bit3; } + inline const MxBool CreateNotificationManager() const { return m_flags1.m_bit3; } // FUNCTION: BETA10 0x10130d50 - inline const MxBool CreateVideoManager() const { return this->m_flags1.m_bit4; } + inline const MxBool CreateVideoManager() const { return m_flags1.m_bit4; } // FUNCTION: BETA10 0x10130d70 - inline const MxBool CreateSoundManager() const { return this->m_flags1.m_bit5; } + inline const MxBool CreateSoundManager() const { return m_flags1.m_bit5; } // FUNCTION: BETA10 0x10130d90 - inline const MxBool CreateMusicManager() const { return this->m_flags1.m_bit6; } + inline const MxBool CreateMusicManager() const { return m_flags1.m_bit6; } // FUNCTION: BETA10 0x10130db0 - inline const MxBool CreateEventManager() const { return this->m_flags1.m_bit7; } + inline const MxBool CreateEventManager() const { return m_flags1.m_bit7; } // FUNCTION: BETA10 0x10130dd0 - inline const MxBool CreateTimer() const { return this->m_flags2.m_bit1; } + inline const MxBool CreateTimer() const { return m_flags2.m_bit1; } // FUNCTION: BETA10 0x10130e00 - inline const MxBool CreateStreamer() const { return this->m_flags2.m_bit2; } + inline const MxBool CreateStreamer() const { return m_flags2.m_bit2; } private: FlagBitfield m_flags1; diff --git a/LEGO1/omni/include/mxvideoparam.h b/LEGO1/omni/include/mxvideoparam.h index f9766b97..c3185738 100644 --- a/LEGO1/omni/include/mxvideoparam.h +++ b/LEGO1/omni/include/mxvideoparam.h @@ -14,22 +14,33 @@ class MxPalette; class MxVideoParam { public: MxVideoParam(); - MxVideoParam(MxVideoParam& p_videoParam); __declspec(dllexport) MxVideoParam(MxRect32& p_rect, MxPalette* p_palette, MxULong p_backBuffers, MxVideoParamFlags& p_flags); - MxVideoParam& operator=(const MxVideoParam& p_videoParam); + MxVideoParam(MxVideoParam& p_videoParam); ~MxVideoParam(); void SetDeviceName(char* p_deviceId); + MxVideoParam& operator=(const MxVideoParam& p_videoParam); + // FUNCTION: BETA10 0x100886e0 inline MxVideoParamFlags& Flags() { return m_flags; } - inline void SetPalette(MxPalette* p_palette) { this->m_palette = p_palette; } - inline void SetBackBuffers(MxU32 p_backBuffers) { this->m_backBuffers = p_backBuffers; } + // FUNCTION: BETA10 0x100d81f0 + inline MxRect32& GetRect() { return m_rect; } - inline MxRect32& GetRect() { return this->m_rect; } - inline MxPalette* GetPalette() { return this->m_palette; } - inline MxU32 GetBackBuffers() { return this->m_backBuffers; } - inline char* GetDeviceName() { return this->m_deviceId; } + // FUNCTION: BETA10 0x100d8210 + inline MxPalette* GetPalette() { return m_palette; } + + // FUNCTION: BETA10 0x100d8240 + inline void SetPalette(MxPalette* p_palette) { m_palette = p_palette; } + + // FUNCTION: BETA10 0x100d8270 + inline char* GetDeviceName() { return m_deviceId; } + + // FUNCTION: BETA10 0x10141f60 + inline MxU32 GetBackBuffers() { return m_backBuffers; } + + // FUNCTION: BETA10 0x10141fe0 + inline void SetBackBuffers(MxU32 p_backBuffers) { m_backBuffers = p_backBuffers; } private: MxRect32 m_rect; // 0x00 diff --git a/LEGO1/omni/include/mxvideoparamflags.h b/LEGO1/omni/include/mxvideoparamflags.h index 8b937d38..25f9bb50 100644 --- a/LEGO1/omni/include/mxvideoparamflags.h +++ b/LEGO1/omni/include/mxvideoparamflags.h @@ -9,39 +9,56 @@ class MxVideoParamFlags { public: MxVideoParamFlags(); - inline void SetFullScreen(BOOL p_e) { m_flags1.m_bit0 = p_e; } - inline void SetFlipSurfaces(BOOL p_e) { m_flags1.m_bit1 = p_e; } - inline void SetBackBuffers(BOOL p_e) { m_flags1.m_bit2 = p_e; } - inline void SetF1bit3(BOOL p_e) { m_flags1.m_bit3 = p_e; } - inline void SetF1bit4(BOOL p_e) { m_flags1.m_bit4 = p_e; } - inline void Set16Bit(BYTE p_e) { m_flags1.m_bit5 = p_e; } - inline void SetWideViewAngle(BOOL p_e) { m_flags1.m_bit6 = p_e; } - inline void SetF1bit7(BOOL p_e) { m_flags1.m_bit7 = p_e; } - inline void SetF2bit0(BOOL p_e) { m_flags2.m_bit0 = p_e; } - inline void SetF2bit1(BOOL p_e) { m_flags2.m_bit1 = p_e; } - inline void SetF2bit2(BOOL p_e) { m_flags2.m_bit2 = p_e; } - inline void SetF2bit3(BOOL p_e) { m_flags2.m_bit3 = p_e; } - inline void SetF2bit4(BOOL p_e) { m_flags2.m_bit4 = p_e; } - inline void SetF2bit5(BOOL p_e) { m_flags2.m_bit5 = p_e; } - inline void SetF2bit6(BOOL p_e) { m_flags2.m_bit6 = p_e; } - inline void SetF2bit7(BOOL p_e) { m_flags2.m_bit7 = p_e; } + // inlined in ISLE + inline void SetFullScreen(MxBool p_e) { m_flags1.m_bit0 = p_e; } - inline BYTE GetFullScreen() { return m_flags1.m_bit0; } - inline BYTE GetFlipSurfaces() { return m_flags1.m_bit1; } - inline BYTE GetBackBuffers() { return m_flags1.m_bit2; } - inline BYTE GetF1bit3() { return m_flags1.m_bit3; } - inline BYTE GetF1bit4() { return m_flags1.m_bit4; } - inline BYTE Get16Bit() { return m_flags1.m_bit5; } - inline BYTE GetWideViewAngle() { return m_flags1.m_bit6; } - inline BYTE GetF1bit7() { return m_flags1.m_bit7; } - inline BYTE GetF2bit0() { return m_flags2.m_bit0; } - inline BYTE GetF2bit1() { return m_flags2.m_bit1; } - inline BYTE GetF2bit2() { return m_flags2.m_bit2; } - inline BYTE GetF2bit3() { return m_flags2.m_bit3; } - inline BYTE GetF2bit4() { return m_flags2.m_bit4; } - inline BYTE GetF2bit5() { return m_flags2.m_bit5; } - inline BYTE GetF2bit6() { return m_flags2.m_bit6; } - inline BYTE GetF2bit7() { return m_flags2.m_bit7; } + // FUNCTION: BETA10 0x10141f80 + inline void SetFlipSurfaces(MxBool p_e) { m_flags1.m_bit1 = p_e; } + + // FUNCTION: BETA10 0x10141fb0 + inline void SetBackBuffers(MxBool p_e) { m_flags1.m_bit2 = p_e; } + + // FUNCTION: BETA10 0x100d9250 + inline void SetF1bit3(MxBool p_e) { m_flags1.m_bit3 = p_e; } + + // inlined in ISLE + inline void Set16Bit(MxBool p_e) { m_flags1.m_bit5 = p_e; } + + // inlined in ISLE + inline void SetWideViewAngle(MxBool p_e) { m_flags1.m_bit6 = p_e; } + + // inlined in ISLE + inline void SetF1bit7(MxBool p_e) { m_flags1.m_bit7 = p_e; } + + // FUNCTION: BETA10 0x100d81b0 + inline void SetF2bit0(MxBool p_e) { m_flags2.m_bit0 = p_e; } + + // inlined in ISLE + inline void SetF2bit1(MxBool p_e) { m_flags2.m_bit1 = p_e; } + + // FUNCTION: BETA10 0x1009e770 + inline MxBool GetFullScreen() { return m_flags1.m_bit0; } + + // FUNCTION: BETA10 0x100d80f0 + inline MxBool GetFlipSurfaces() { return m_flags1.m_bit1; } + + // FUNCTION: BETA10 0x100d8120 + inline MxBool GetBackBuffers() { return m_flags1.m_bit2; } + + // FUNCTION: BETA10 0x10142010 + inline MxBool GetF1bit3() { return m_flags1.m_bit3; } + + // FUNCTION: BETA10 0x100d8150 + inline MxBool Get16Bit() { return m_flags1.m_bit5; } + + // FUNCTION: BETA10 0x100d8180 + inline MxBool GetWideViewAngle() { return m_flags1.m_bit6; } + + // FUNCTION: BETA10 0x100886b0 + inline MxBool GetF2bit0() { return m_flags2.m_bit0; } + + // FUNCTION: BETA10 0x10142050 + inline MxBool GetF2bit1() { return m_flags2.m_bit1; } private: FlagBitfield m_flags1; diff --git a/LEGO1/omni/src/main/mxomnicreateflags.cpp b/LEGO1/omni/src/main/mxomnicreateflags.cpp index 916c7bcd..2edaaf17 100644 --- a/LEGO1/omni/src/main/mxomnicreateflags.cpp +++ b/LEGO1/omni/src/main/mxomnicreateflags.cpp @@ -8,15 +8,15 @@ DECOMP_SIZE_ASSERT(MxOmniCreateFlags, 0x02) // FUNCTION: BETA10 0x10130a1c MxOmniCreateFlags::MxOmniCreateFlags() { - this->m_flags1.m_bit0 = TRUE; // CreateObjectFactory - this->m_flags1.m_bit1 = TRUE; // CreateVariableTable - this->m_flags1.m_bit2 = TRUE; // CreateTickleManager - this->m_flags1.m_bit3 = TRUE; // CreateNotificationManager - this->m_flags1.m_bit4 = TRUE; // CreateVideoManager - this->m_flags1.m_bit5 = TRUE; // CreateSoundManager - this->m_flags1.m_bit6 = TRUE; // CreateMusicManager - this->m_flags1.m_bit7 = TRUE; // CreateEventManager + m_flags1.m_bit0 = TRUE; // CreateObjectFactory + m_flags1.m_bit1 = TRUE; // CreateVariableTable + m_flags1.m_bit2 = TRUE; // CreateTickleManager + m_flags1.m_bit3 = TRUE; // CreateNotificationManager + m_flags1.m_bit4 = TRUE; // CreateVideoManager + m_flags1.m_bit5 = TRUE; // CreateSoundManager + m_flags1.m_bit6 = TRUE; // CreateMusicManager + m_flags1.m_bit7 = TRUE; // CreateEventManager - this->m_flags2.m_bit1 = TRUE; // CreateTimer - this->m_flags2.m_bit2 = TRUE; // CreateStreamer + m_flags2.m_bit1 = TRUE; // CreateTimer + m_flags2.m_bit2 = TRUE; // CreateStreamer } diff --git a/LEGO1/omni/src/video/mxvideoparam.cpp b/LEGO1/omni/src/video/mxvideoparam.cpp index 8e48773f..9a095c4e 100644 --- a/LEGO1/omni/src/video/mxvideoparam.cpp +++ b/LEGO1/omni/src/video/mxvideoparam.cpp @@ -5,79 +5,82 @@ #include #include -DECOMP_SIZE_ASSERT(MxVideoParam, 0x24); +DECOMP_SIZE_ASSERT(MxVideoParam, 0x24) // FUNCTION: LEGO1 0x100bec70 +// FUNCTION: BETA10 0x1012db3e MxVideoParam::MxVideoParam() { - this->m_rect.SetRight(640); - this->m_rect.SetBottom(480); - this->m_rect.SetLeft(0); - this->m_rect.SetTop(0); - this->m_palette = NULL; - this->m_backBuffers = 0; - this->m_unk0x1c = 0; - this->m_deviceId = NULL; + m_rect = MxRect32(0, 0, 640, 480); + m_palette = NULL; + m_backBuffers = 0; + m_unk0x1c = 0; + m_deviceId = NULL; } // FUNCTION: LEGO1 0x100beca0 +// FUNCTION: BETA10 0x1012dbb1 MxVideoParam::MxVideoParam(MxRect32& p_rect, MxPalette* p_palette, MxULong p_backBuffers, MxVideoParamFlags& p_flags) { - this->m_rect = p_rect; - this->m_palette = p_palette; - this->m_backBuffers = p_backBuffers; - this->m_flags = p_flags; - this->m_unk0x1c = 0; - this->m_deviceId = NULL; + m_rect = p_rect; + m_palette = p_palette; + m_backBuffers = p_backBuffers; + m_flags = p_flags; + m_unk0x1c = 0; + m_deviceId = NULL; } // FUNCTION: LEGO1 0x100becf0 +// FUNCTION: BETA10 0x1012dc1e MxVideoParam::MxVideoParam(MxVideoParam& p_videoParam) { - this->m_rect = p_videoParam.m_rect; - this->m_palette = p_videoParam.m_palette; - this->m_backBuffers = p_videoParam.m_backBuffers; - this->m_flags = p_videoParam.m_flags; - this->m_unk0x1c = p_videoParam.m_unk0x1c; - this->m_deviceId = NULL; + m_rect = p_videoParam.m_rect; + m_palette = p_videoParam.m_palette; + m_backBuffers = p_videoParam.m_backBuffers; + m_flags = p_videoParam.m_flags; + m_unk0x1c = p_videoParam.m_unk0x1c; + m_deviceId = NULL; SetDeviceName(p_videoParam.m_deviceId); } // FUNCTION: LEGO1 0x100bed50 +// FUNCTION: BETA10 0x1012dca3 MxVideoParam::~MxVideoParam() { - if (this->m_deviceId != NULL) { - delete[] this->m_deviceId; + if (m_deviceId != NULL) { + delete[] m_deviceId; } } // FUNCTION: LEGO1 0x100bed70 +// FUNCTION: BETA10 0x1012dce1 void MxVideoParam::SetDeviceName(char* p_deviceId) { - if (this->m_deviceId != NULL) { - delete[] this->m_deviceId; + if (m_deviceId != NULL) { + delete[] m_deviceId; } if (p_deviceId != NULL) { - this->m_deviceId = new char[strlen(p_deviceId) + 1]; + m_deviceId = new char[strlen(p_deviceId) + 1]; - if (this->m_deviceId != NULL) { - strcpy(this->m_deviceId, p_deviceId); + if (m_deviceId != NULL) { + strcpy(m_deviceId, p_deviceId); } } else { - this->m_deviceId = NULL; + m_deviceId = NULL; } } // FUNCTION: LEGO1 0x100bede0 +// FUNCTION: BETA10 0x1012dd76 MxVideoParam& MxVideoParam::operator=(const MxVideoParam& p_videoParam) { - this->m_rect = p_videoParam.m_rect; - this->m_palette = p_videoParam.m_palette; - this->m_backBuffers = p_videoParam.m_backBuffers; - this->m_flags = p_videoParam.m_flags; - this->m_unk0x1c = p_videoParam.m_unk0x1c; + m_rect = p_videoParam.m_rect; + m_palette = p_videoParam.m_palette; + m_backBuffers = p_videoParam.m_backBuffers; + m_flags = p_videoParam.m_flags; + m_unk0x1c = p_videoParam.m_unk0x1c; SetDeviceName(p_videoParam.m_deviceId); return *this; diff --git a/LEGO1/omni/src/video/mxvideoparamflags.cpp b/LEGO1/omni/src/video/mxvideoparamflags.cpp index 967ec824..1a70dc83 100644 --- a/LEGO1/omni/src/video/mxvideoparamflags.cpp +++ b/LEGO1/omni/src/video/mxvideoparamflags.cpp @@ -1,15 +1,21 @@ #include "mxvideoparamflags.h" +#include "decomp.h" + +DECOMP_SIZE_ASSERT(MxVideoParamFlags, 0x02) + // FUNCTION: LEGO1 0x100bec40 +// FUNCTION: BETA10 0x1012dadb MxVideoParamFlags::MxVideoParamFlags() { - this->SetFullScreen(0); - this->SetFlipSurfaces(0); - this->SetBackBuffers(0); - this->SetF1bit3(0); - this->SetF1bit4(0); - this->Set16Bit(0); - this->SetWideViewAngle(1); - this->SetF1bit7(1); - this->SetF2bit1(1); + m_flags1.m_bit0 = FALSE; // FullScreen + m_flags1.m_bit1 = FALSE; // FlipSurfaces + m_flags1.m_bit2 = FALSE; // BackBuffers + m_flags1.m_bit3 = FALSE; + m_flags1.m_bit4 = FALSE; + m_flags1.m_bit5 = FALSE; // 16Bit + m_flags1.m_bit6 = TRUE; // WideViewAngle + m_flags1.m_bit7 = TRUE; + + m_flags2.m_bit1 = TRUE; }