From 05edf961863d47490a3578069ba25c44569a7813 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 7 May 2024 15:59:46 -0400 Subject: [PATCH] Implement LegoAnimationManager::FUN_10061010 (#888) --- .../legoomni/include/legoanimationmanager.h | 2 +- .../legoomni/include/legoanimmmpresenter.h | 4 + .../legoomni/src/actors/islepathactor.cpp | 2 +- .../src/common/legoanimationmanager.cpp | 73 +++++++++++++++++-- .../src/common/legoanimmmpresenter.cpp | 12 +++ .../legoomni/src/entity/legonavcontroller.cpp | 2 +- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 2 +- .../src/gasstation/gasstationentity.cpp | 2 +- .../legoomni/src/hospital/hospitalentity.cpp | 2 +- .../src/infocenter/infocenterentity.cpp | 2 +- .../legoomni/src/isle/beachhouseentity.cpp | 2 +- .../lego/legoomni/src/police/policeentity.cpp | 2 +- .../legoomni/src/race/racestandsentity.cpp | 2 +- 13 files changed, 93 insertions(+), 16 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 5683b9d2..04263461 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -95,7 +95,7 @@ class LegoAnimationManager : public MxCore { MxBool p_param8, MxBool p_param9 ); - void FUN_10061010(undefined4); + void FUN_10061010(MxBool p_und); void FUN_100617c0(MxS32, MxU16&, MxU16&); LegoTranInfo* GetTranInfo(MxU32 p_index); void FUN_10062770(); diff --git a/LEGO1/lego/legoomni/include/legoanimmmpresenter.h b/LEGO1/lego/legoomni/include/legoanimmmpresenter.h index 0d90473b..4ca63a7b 100644 --- a/LEGO1/lego/legoomni/include/legoanimmmpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimmmpresenter.h @@ -55,7 +55,11 @@ class LegoAnimMMPresenter : public MxCompositePresenter { // SYNTHETIC: LEGO1 0x1004aa40 // LegoAnimMMPresenter::`scalar deleting destructor' + void FUN_1004b840(); MxBool FUN_1004b8b0(); + void FUN_1004b8c0(); + + inline LegoAnimPresenter* GetPresenter() { return m_presenter; } private: MxBool FUN_1004b450(); diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index 60c2fa3d..4f03d994 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -83,7 +83,7 @@ void IslePathActor::VTable0xe0() } } - AnimationManager()->FUN_10061010(0); + AnimationManager()->FUN_10061010(FALSE); if (!m_cameraFlag) { ResetWorldTransform(TRUE); SetUserNavFlag(TRUE); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 7e3aedc0..8bef9e6b 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1,8 +1,11 @@ #include "legoanimationmanager.h" +#include "anim/legoanim.h" #include "animstate.h" #include "define.h" #include "islepathactor.h" +#include "legoanimmmpresenter.h" +#include "legoanimpresenter.h" #include "legocharactermanager.h" #include "legoendanimnotificationparam.h" #include "legoextraactor.h" @@ -130,7 +133,7 @@ LegoAnimationManager::~LegoAnimationManager() { TickleManager()->UnregisterClient(this); - FUN_10061010(0); + FUN_10061010(FALSE); for (MxS32 i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { LegoROI* roi = m_unk0x3c[i].m_roi; @@ -215,7 +218,7 @@ void LegoAnimationManager::Suspend() m_unk0x42a = m_unk0x402; m_unk0x402 = FALSE; - FUN_10061010(0); + FUN_10061010(FALSE); MxS32 i; for (i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { @@ -919,17 +922,75 @@ MxResult LegoAnimationManager::FUN_10060dc0( } } - if (!found && p_param3 != 0) { + if (!found && p_param3 != FALSE) { result = FUN_100609f0(p_objectId, p_matrix, p_param7, p_param8); } return result; } -// STUB: LEGO1 0x10061010 -void LegoAnimationManager::FUN_10061010(undefined4) +// FUNCTION: LEGO1 0x10061010 +// FUNCTION: BETA10 0x100422cc +void LegoAnimationManager::FUN_10061010(MxBool p_und) { - // TODO + MxBool unk0x39 = FALSE; + + FUN_10064b50(-1); + + if (m_tranInfoList != NULL) { + LegoTranInfoListCursor cursor(m_tranInfoList); + LegoTranInfo* tranInfo; + + while (cursor.Next(tranInfo)) { + if (tranInfo->m_presenter != NULL) { + // TODO: Match + MxU32 flags = tranInfo->m_flags; + + if (tranInfo->m_unk0x14 && tranInfo->m_unk0x12 != -1 && p_und) { + LegoAnim* anim; + + if (tranInfo->m_presenter->GetPresenter() != NULL && + (anim = tranInfo->m_presenter->GetPresenter()->GetAnimation()) != NULL && + anim->GetScene() != NULL) { + if (flags & LegoTranInfo::c_bit2) { + BackgroundAudioManager()->RaiseVolume(); + tranInfo->m_flags &= ~LegoTranInfo::c_bit2; + } + + tranInfo->m_presenter->FUN_1004b840(); + tranInfo->m_unk0x14 = FALSE; + } + else { + tranInfo->m_presenter->FUN_1004b8c0(); + tranInfo->m_unk0x14 = FALSE; + unk0x39 = TRUE; + } + } + else { + if (flags & LegoTranInfo::c_bit2) { + BackgroundAudioManager()->RaiseVolume(); + tranInfo->m_flags &= ~LegoTranInfo::c_bit2; + } + + tranInfo->m_presenter->FUN_1004b840(); + } + } + else { + if (m_tranInfoList2 != NULL) { + LegoTranInfoListCursor cursor(m_tranInfoList2); + + if (!cursor.Find(tranInfo)) { + m_tranInfoList2->Append(tranInfo); + } + } + + unk0x39 = TRUE; + } + } + } + + m_unk0x39 = unk0x39; + m_unk0x404 = Timer()->GetTime(); } // STUB: LEGO1 0x10061530 diff --git a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp index 9ebaaa8a..206c145f 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp @@ -465,9 +465,21 @@ MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time) return TRUE; } +// STUB: LEGO1 0x1004b840 +void LegoAnimMMPresenter::FUN_1004b840() +{ + // TODO +} + // FUNCTION: LEGO1 0x1004b8b0 // FUNCTION: BETA10 0x1004d104 MxBool LegoAnimMMPresenter::FUN_1004b8b0() { return m_tranInfo != NULL ? m_tranInfo->m_unk0x28 : TRUE; } + +// STUB: LEGO1 0x1004b8c0 +void LegoAnimMMPresenter::FUN_1004b8c0() +{ + // TODO +} diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index fc18ea5c..f56b1198 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -622,7 +622,7 @@ MxLong LegoNavController::Notify(MxParam& p_param) break; } case VK_SPACE: - AnimationManager()->FUN_10061010(1); + AnimationManager()->FUN_10061010(TRUE); break; case 'Z': // TODO diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index eda48fc6..d109f145 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -618,7 +618,7 @@ void LegoWorld::Enable(MxBool p_enable) if (p_enable && !m_set0xd0.empty()) { if (CurrentWorld() != this) { if (CurrentWorld()) { - AnimationManager()->FUN_10061010(0); + AnimationManager()->FUN_10061010(FALSE); CurrentWorld()->Enable(FALSE); LegoEntityListCursor cursor(m_entityList); diff --git a/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp b/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp index 012d9eb8..cb15b026 100644 --- a/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp +++ b/LEGO1/lego/legoomni/src/gasstation/gasstationentity.cpp @@ -30,7 +30,7 @@ MxLong GasStationEntity::VTable0x50(MxParam& p_param) Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); isle->SetDestLocation(LegoGameState::Area::e_garage); - AnimationManager()->FUN_10061010(0); + AnimationManager()->FUN_10061010(FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); } } diff --git a/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp b/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp index 006d2d05..9b2f4eb0 100644 --- a/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp +++ b/LEGO1/lego/legoomni/src/hospital/hospitalentity.cpp @@ -30,7 +30,7 @@ MxLong HospitalEntity::VTable0x50(MxParam& p_param) Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); isle->SetDestLocation(LegoGameState::Area::e_hospital); - AnimationManager()->FUN_10061010(0); + AnimationManager()->FUN_10061010(FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); } } diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp index 3ebe8e44..4c89044e 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenterentity.cpp @@ -53,7 +53,7 @@ MxLong InfoCenterEntity::VTable0x50(MxParam& p_param) break; } - AnimationManager()->FUN_10061010(0); + AnimationManager()->FUN_10061010(FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); return 1; diff --git a/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp b/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp index 8f9d518c..5e11a4bd 100644 --- a/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp +++ b/LEGO1/lego/legoomni/src/isle/beachhouseentity.cpp @@ -28,7 +28,7 @@ MxLong BeachHouseEntity::VTable0x50(MxParam& p_param) Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); isle->SetDestLocation(LegoGameState::Area::e_jetskibuild); - AnimationManager()->FUN_10061010(0); + AnimationManager()->FUN_10061010(FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); } diff --git a/LEGO1/lego/legoomni/src/police/policeentity.cpp b/LEGO1/lego/legoomni/src/police/policeentity.cpp index d3beb0e4..936d3859 100644 --- a/LEGO1/lego/legoomni/src/police/policeentity.cpp +++ b/LEGO1/lego/legoomni/src/police/policeentity.cpp @@ -30,7 +30,7 @@ MxLong PoliceEntity::VTable0x50(MxParam& p_param) Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); isle->SetDestLocation(LegoGameState::Area::e_police); - AnimationManager()->FUN_10061010(0); + AnimationManager()->FUN_10061010(FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); } } diff --git a/LEGO1/lego/legoomni/src/race/racestandsentity.cpp b/LEGO1/lego/legoomni/src/race/racestandsentity.cpp index f7a572b0..91d9a07f 100644 --- a/LEGO1/lego/legoomni/src/race/racestandsentity.cpp +++ b/LEGO1/lego/legoomni/src/race/racestandsentity.cpp @@ -28,7 +28,7 @@ MxLong RaceStandsEntity::VTable0x50(MxParam& p_param) Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); isle->SetDestLocation(LegoGameState::Area::e_racecarbuild); - AnimationManager()->FUN_10061010(0); + AnimationManager()->FUN_10061010(FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); }