From 599d8c91c88845bd1700595320b380dd1e655b51 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 30 Apr 2024 04:27:57 -0400 Subject: [PATCH] Implement/match LegoAnimationManager::Resume (#869) * Implement/match LegoAnimationManager::FUN_1005f0b0 * Rename --- .../legoomni/include/legoanimationmanager.h | 6 ++-- .../src/common/legoanimationmanager.cpp | 31 ++++++++++++------- .../legoomni/src/common/legogamestate.cpp | 6 ++-- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 4 +-- 5 files changed, 29 insertions(+), 20 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index ae8bc302..073db18a 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -67,8 +67,8 @@ class LegoAnimationManager : public MxCore { } void Reset(MxBool p_und); - void FUN_1005ef10(); - void FUN_1005f0b0(); + void Suspend(); + void Resume(); void FUN_1005f6d0(MxBool); void FUN_1005f700(MxBool); MxResult LoadScriptInfo(MxS32 p_scriptIndex); @@ -154,7 +154,7 @@ class LegoAnimationManager : public MxCore { undefined m_unk0x428; // 0x428 undefined m_unk0x429; // 0x429 undefined m_unk0x42a; // 0x42a - undefined m_unk0x42b; // 0x42b + MxBool m_suspended; // 0x42b undefined4 m_unk0x42c; // 0x42c undefined m_unk0x430; // 0x430 undefined4 m_unk0x434[2]; // 0x434 diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 2bf7664f..1a708b32 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -158,8 +158,8 @@ void LegoAnimationManager::Reset(MxBool p_und) m_animState->SetFlag(); } - undefined unk0x42b = m_unk0x42b; - FUN_1005ef10(); + MxBool suspended = m_suspended; + Suspend(); if (m_tranInfoList != NULL) { delete m_tranInfoList; @@ -172,22 +172,31 @@ void LegoAnimationManager::Reset(MxBool p_und) DeleteAnimations(); Init(); - m_unk0x42b = unk0x42b; + m_suspended = suspended; m_unk0x428 = m_unk0x3a; m_unk0x429 = m_unk0x400; m_unk0x42a = m_unk0x402; } // STUB: LEGO1 0x1005ef10 -void LegoAnimationManager::FUN_1005ef10() +// FUNCTION: BETA10 0x1003fc7a +void LegoAnimationManager::Suspend() { // TODO } -// STUB: LEGO1 0x1005f0b0 -void LegoAnimationManager::FUN_1005f0b0() +// FUNCTION: LEGO1 0x1005f0b0 +// FUNCTION: BETA10 0x1003fefe +void LegoAnimationManager::Resume() { - // TODO + if (m_suspended) { + m_unk0x408 = m_unk0x40c = m_unk0x404 = Timer()->GetTime(); + m_unk0x410 = 5000; + m_unk0x3a = m_unk0x428; + m_unk0x400 = m_unk0x429; + m_unk0x402 = m_unk0x42a; + m_suspended = FALSE; + } } // FUNCTION: LEGO1 0x1005f130 @@ -227,7 +236,7 @@ void LegoAnimationManager::Init() m_unk0x0e = 0; m_unk0x10 = 0; m_unk0x401 = 0; - m_unk0x42b = 0; + m_suspended = FALSE; m_unk0x430 = 0; m_unk0x42c = 0; m_unk0x408 = m_unk0x40c = m_unk0x404 = Timer()->GetTime(); @@ -402,7 +411,7 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) result = SUCCESS; m_unk0x402 = 1; - if (m_unk0x42b) { + if (m_suspended) { m_unk0x428 = m_unk0x3a; m_unk0x429 = m_unk0x400; m_unk0x42a = 1; @@ -541,7 +550,7 @@ MxResult LegoAnimationManager::ReadModelInfo(LegoFile* p_file, ModelInfo* p_info // FUNCTION: LEGO1 0x100603c0 void LegoAnimationManager::DeleteAnimations() { - undefined unk0x42b = m_unk0x42b; + MxBool suspended = m_suspended; if (m_anims != NULL) { for (MxS32 i = 0; i < m_animCount; i++) { @@ -560,7 +569,7 @@ void LegoAnimationManager::DeleteAnimations() } Init(); - m_unk0x42b = unk0x42b; + m_suspended = suspended; } // STUB: LEGO1 0x10060570 diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index 3fedc6c4..ef1a436e 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -791,7 +791,7 @@ void LegoGameState::SwitchArea(Area p_area) FUN_10015820(TRUE, LegoOmni::c_disableInput | LegoOmni::c_disable3d); BackgroundAudioManager()->Stop(); - AnimationManager()->FUN_1005ef10(); + AnimationManager()->Suspend(); VideoManager()->SetUnk0x554(FALSE); switch (p_area) { @@ -896,7 +896,7 @@ void LegoGameState::SwitchArea(Area p_area) else { SetCameraControllerFromIsle(); CurrentActor()->ResetWorldTransform(TRUE); - AnimationManager()->FUN_1005f0b0(); + AnimationManager()->Resume(); } CurrentActor()->VTable0xe8(p_area, TRUE, 7); @@ -910,7 +910,7 @@ void LegoGameState::SwitchArea(Area p_area) LoadIsle(); SetCameraControllerFromIsle(); CurrentActor()->ResetWorldTransform(TRUE); - AnimationManager()->FUN_1005f0b0(); + AnimationManager()->Resume(); CurrentActor()->VTable0xe8(p_area, TRUE, 7); break; case e_police: diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index 13696cbb..522c9918 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -630,7 +630,7 @@ void LegoWorld::Enable(MxBool p_enable) PlantManager()->FUN_10026360(m_scriptIndex); AnimationManager()->LoadScriptInfo(m_scriptIndex); BuildingManager()->FUN_1002fa00(); - AnimationManager()->FUN_1005f0b0(); + AnimationManager()->Resume(); } GameState()->ResetROI(); diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index f26dca62..d917427a 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -857,7 +857,7 @@ MxLong Isle::HandleTransitionEnd() GameState()->StopArea(LegoGameState::e_previousArea); m_destLocation = LegoGameState::e_undefined; VariableTable()->SetVariable("VISIBILITY", "Show Gas"); - AnimationManager()->FUN_1005f0b0(); + AnimationManager()->Resume(); FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); SetAppCursor(0); SetIsWorldActive(TRUE); @@ -867,7 +867,7 @@ MxLong Isle::HandleTransitionEnd() GameState()->StopArea(LegoGameState::e_previousArea); m_destLocation = LegoGameState::e_undefined; VariableTable()->SetVariable("VISIBILITY", "Show Policsta"); - AnimationManager()->FUN_1005f0b0(); + AnimationManager()->Resume(); FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); SetAppCursor(0); SetIsWorldActive(TRUE);