From 6da912e932643b28a0f97d12e7c81692bd60d699 Mon Sep 17 00:00:00 2001 From: MattKC <34096995+itsmattkc@users.noreply.github.com> Date: Tue, 3 Oct 2023 23:56:16 -0700 Subject: [PATCH] Implement MxTransitionManager::EndTransition and GetCurrentWorld (#159) * Implement MxTransitionManager::EndTransition and GetCurrentWorld * Match EndTransition --------- Co-authored-by: Christian Semmler --- LEGO1/legoomni.cpp | 6 ++++++ LEGO1/legoomni.h | 7 ++++++- LEGO1/mxtransitionmanager.cpp | 20 +++++++++++++++++--- LEGO1/mxtransitionmanager.h | 6 +++--- 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/LEGO1/legoomni.cpp b/LEGO1/legoomni.cpp index bbc8258b..929ba556 100644 --- a/LEGO1/legoomni.cpp +++ b/LEGO1/legoomni.cpp @@ -312,3 +312,9 @@ MxBool LegoOmni::vtable40() // FIXME: Stub return 0; } + +// OFFSET: LEGO1 0x100157a0 +LegoWorld *GetCurrentWorld() +{ + return LegoOmni::GetInstance()->GetCurrentWorld(); +} diff --git a/LEGO1/legoomni.h b/LEGO1/legoomni.h index 4e772cae..4a5fe6e4 100644 --- a/LEGO1/legoomni.h +++ b/LEGO1/legoomni.h @@ -75,12 +75,16 @@ class LegoOmni : public MxOmni LegoGameState *GetGameState() { return m_gameState; } LegoNavController *GetNavController() { return m_navController; } MxTransitionManager *GetTransitionManager() { return m_transitionManager; } + LegoWorld *GetCurrentWorld() { return m_currentWorld; } private: int m_unk68; int m_unk6c; LegoInputManager *m_inputMgr; // 0x70 - char m_unk74[0x10]; + undefined4 m_unk74; + undefined4 m_unk78; + LegoWorld *m_currentWorld; + undefined4 m_unk80; LegoNavController *m_navController; // 0x84 Isle* m_isle; // 0x88 char m_unk8c[0x4]; @@ -115,5 +119,6 @@ LegoBuildingManager* BuildingManager(); Isle* GetIsle(); LegoPlantManager* PlantManager(); MxBool KeyValueStringParse(char *, const char *, const char *); +LegoWorld *GetCurrentWorld(); #endif // LEGOOMNI_H diff --git a/LEGO1/mxtransitionmanager.cpp b/LEGO1/mxtransitionmanager.cpp index 61283718..4581abe9 100644 --- a/LEGO1/mxtransitionmanager.cpp +++ b/LEGO1/mxtransitionmanager.cpp @@ -41,10 +41,24 @@ MxResult MxTransitionManager::Tickle() return 0; } -// OFFSET: LEGO1 0x1004bc30 STUB -void MxTransitionManager::EndTransition(MxBool) +// OFFSET: LEGO1 0x1004bc30 +void MxTransitionManager::EndTransition(MxBool p_notifyWorld) { - // TODO + if (m_transitionType != NOT_TRANSITIONING) { + m_transitionType = NOT_TRANSITIONING; + + m_unk20.bit0 = FALSE; + + TickleManager()->UnregisterClient(this); + + if (p_notifyWorld) { + LegoWorld *world = GetCurrentWorld(); + + if (world) { + world->Notify(MxParam(0x18, this)); + } + } + } } // OFFSET: LEGO1 0x1004bd10 diff --git a/LEGO1/mxtransitionmanager.h b/LEGO1/mxtransitionmanager.h index 09d3e622..c66e7380 100644 --- a/LEGO1/mxtransitionmanager.h +++ b/LEGO1/mxtransitionmanager.h @@ -89,7 +89,7 @@ class MxTransitionManager : public MxCore MxResult StartTransition(TransitionType p_animationType, MxS32 p_speed, MxBool p_unk, MxBool p_playMusicInAnim); private: - void EndTransition(MxBool); + void EndTransition(MxBool p_notifyWorld); void Transition_Dissolve(); void FUN_1004c4d0(DDSURFACEDESC &); void FUN_1004c580(DDSURFACEDESC &); @@ -109,8 +109,8 @@ class MxTransitionManager : public MxCore MxU16 m_animationTimer; MxU16 m_columnOrder[640]; // 0x36 MxU16 m_randomShift[480]; // 0x536 - MxULong m_systemTime; - MxS32 m_animationSpeed; + MxULong m_systemTime; // 0x8f8 + MxS32 m_animationSpeed; // 0x8fc }; #endif // MXTRANSITIONMANAGER_H