From 91d043a9aeaa1a1b277ecdfbda33e0c6a7881104 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 20 Apr 2024 11:18:19 -0400 Subject: [PATCH] Implement/match LegoAnimMMPresenter::FUN_1004b450 (#827) --- .../legoomni/include/legoanimmmpresenter.h | 23 +++- .../src/common/legoanimmmpresenter.cpp | 119 +++++++++++++++++- .../src/common/mxcompositemediapresenter.cpp | 2 +- LEGO1/omni/include/mxpresenter.h | 6 +- LEGO1/omni/include/mxvideopresenter.h | 2 +- LEGO1/omni/src/common/mxmediapresenter.cpp | 4 +- LEGO1/omni/src/common/mxpresenter.cpp | 6 +- .../omni/src/video/mxloopingflcpresenter.cpp | 2 +- .../omni/src/video/mxloopingsmkpresenter.cpp | 2 +- LEGO1/omni/src/video/mxstillpresenter.cpp | 2 +- LEGO1/omni/src/video/mxvideopresenter.cpp | 4 +- 11 files changed, 149 insertions(+), 23 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimmmpresenter.h b/LEGO1/lego/legoomni/include/legoanimmmpresenter.h index 33ad2e52..fdeae9e6 100644 --- a/LEGO1/lego/legoomni/include/legoanimmmpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimmmpresenter.h @@ -11,6 +11,17 @@ struct LegoTranInfo; // SIZE 0x74 class LegoAnimMMPresenter : public MxCompositePresenter { public: + enum { + e_unk0, + e_unk1, + e_unk2, + e_unk3, + e_unk4, + e_unk5, + e_unk6, + e_unk7 + }; + LegoAnimMMPresenter(); MxLong Notify(MxParam& p_param) override; // vtable+0x04 @@ -45,11 +56,19 @@ class LegoAnimMMPresenter : public MxCompositePresenter { private: MxBool FUN_1004b450(); + MxBool FUN_1004b530(MxLong p_time); + MxBool FUN_1004b570(MxLong p_time); + MxBool FUN_1004b580(MxLong p_time); + MxBool FUN_1004b5b0(MxLong p_time); + MxBool FUN_1004b600(MxLong p_time); + MxBool FUN_1004b610(MxLong p_time); + MxBool FUN_1004b6b0(MxLong p_time); + MxBool FUN_1004b6d0(MxLong p_time); LegoAnimPresenter* m_unk0x4c; // 0x4c - undefined4 m_unk0x50; // 0x50 + MxLong m_unk0x50; // 0x50 undefined4 m_unk0x54; // 0x54 - undefined m_unk0x58; // 0x58 + MxU8 m_unk0x58; // 0x58 MxBool m_unk0x59; // 0x59 MxU32 m_animmanId; // 0x5c LegoTranInfo* m_tranInfo; // 0x60 diff --git a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp index ec4113f1..eabd0212 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp @@ -30,7 +30,7 @@ LegoAnimMMPresenter::LegoAnimMMPresenter() m_unk0x68 = 0; m_unk0x6c = 0; m_unk0x70 = 0; - m_unk0x58 = 0; + m_unk0x58 = e_unk0; } // FUNCTION: LEGO1 0x1004aaf0 @@ -174,15 +174,15 @@ void LegoAnimMMPresenter::StreamingTickle() void LegoAnimMMPresenter::RepeatingTickle() { if (m_unk0x4c == NULL) { - ProgressTickleState(e_unk5); + ProgressTickleState(e_freezing); } else if (m_list.size() <= 1) { if (m_list.front() == m_unk0x4c) { m_unk0x4c->SetTickleState(e_done); - ProgressTickleState(e_unk5); + ProgressTickleState(e_freezing); } else { - ProgressTickleState(e_unk5); + ProgressTickleState(e_freezing); } } } @@ -244,12 +244,119 @@ void LegoAnimMMPresenter::ParseExtra() } } -// STUB: LEGO1 0x1004b450 +// FUNCTION: LEGO1 0x1004b450 // FUNCTION: BETA10 0x1004c71d MxBool LegoAnimMMPresenter::FUN_1004b450() +{ + MxBool result = FALSE; + MxLong time = Timer()->GetTime() - m_unk0x50; + + switch (m_unk0x58) { + case e_unk0: + if (!FUN_1004b530(time)) { + break; + } + m_unk0x58 = e_unk1; + case e_unk1: + if (!FUN_1004b570(time)) { + break; + } + m_unk0x58 = e_unk2; + case e_unk2: + if (!FUN_1004b580(time)) { + break; + } + m_unk0x58 = e_unk3; + case e_unk3: + if (!FUN_1004b5b0(time)) { + break; + } + m_unk0x58 = e_unk4; + case e_unk4: + if (!FUN_1004b600(time)) { + break; + } + m_unk0x58 = e_unk5; + case e_unk5: + if (!FUN_1004b610(time)) { + break; + } + m_unk0x58 = e_unk6; + case e_unk6: + if (!FUN_1004b6b0(time)) { + break; + } + m_unk0x58 = e_unk7; + case e_unk7: + FUN_1004b6d0(time); + result = TRUE; + } + + return result; +} + +// STUB: LEGO1 0x1004b530 +// FUNCTION: BETA10 0x1004c8c4 +MxBool LegoAnimMMPresenter::FUN_1004b530(MxLong p_time) { // TODO - return TRUE; + return FALSE; +} + +// STUB: LEGO1 0x1004b570 +// FUNCTION: BETA10 0x1004c9cc +MxBool LegoAnimMMPresenter::FUN_1004b570(MxLong p_time) +{ + // TODO + return FALSE; +} + +// STUB: LEGO1 0x1004b580 +// FUNCTION: BETA10 0x1004ca3f +MxBool LegoAnimMMPresenter::FUN_1004b580(MxLong p_time) +{ + // TODO + return FALSE; +} + +// STUB: LEGO1 0x1004b5b0 +// FUNCTION: BETA10 0x1004cb09 +MxBool LegoAnimMMPresenter::FUN_1004b5b0(MxLong p_time) +{ + // TODO + return FALSE; +} + +// STUB: LEGO1 0x1004b600 +// FUNCTION: BETA10 0x1004cbfb +MxBool LegoAnimMMPresenter::FUN_1004b600(MxLong p_time) +{ + // TODO + return FALSE; +} + +// STUB: LEGO1 0x1004b610 +// FUNCTION: BETA10 0x1004cc6e +MxBool LegoAnimMMPresenter::FUN_1004b610(MxLong p_time) +{ + // TODO + return FALSE; +} + +// STUB: LEGO1 0x1004b6b0 +// FUNCTION: BETA10 0x1004cdc5 +MxBool LegoAnimMMPresenter::FUN_1004b6b0(MxLong p_time) +{ + // TODO + return FALSE; +} + +// STUB: LEGO1 0x1004b6d0 +// FUNCTION: BETA10 0x1004ce18 +MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time) +{ + // TODO + return FALSE; } // FUNCTION: LEGO1 0x1004b8b0 diff --git a/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp b/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp index 8f074ffa..36027f8e 100644 --- a/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp @@ -152,7 +152,7 @@ MxResult MxCompositeMediaPresenter::Tickle() break; case e_streaming: case e_repeating: - case e_unk5: + case e_freezing: case e_done: { for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) { (*it)->Tickle(); diff --git a/LEGO1/omni/include/mxpresenter.h b/LEGO1/omni/include/mxpresenter.h index 2448d952..dae4e0ad 100644 --- a/LEGO1/omni/include/mxpresenter.h +++ b/LEGO1/omni/include/mxpresenter.h @@ -21,7 +21,7 @@ class MxPresenter : public MxCore { e_starting, e_streaming, e_repeating, - e_unk5, + e_freezing, e_done, }; @@ -62,10 +62,10 @@ class MxPresenter : public MxCore { virtual void StreamingTickle() { ProgressTickleState(e_repeating); } // vtable+0x20 // FUNCTION: LEGO1 0x1000bea0 - virtual void RepeatingTickle() { ProgressTickleState(e_unk5); } // vtable+0x24 + virtual void RepeatingTickle() { ProgressTickleState(e_freezing); } // vtable+0x24 // FUNCTION: LEGO1 0x1000bec0 - virtual void Unk5Tickle() { ProgressTickleState(e_done); } // vtable+0x28 + virtual void FreezingTickle() { ProgressTickleState(e_done); } // vtable+0x28 protected: // FUNCTION: LEGO1 0x1000bee0 diff --git a/LEGO1/omni/include/mxvideopresenter.h b/LEGO1/omni/include/mxvideopresenter.h index 4f9f38aa..5beac120 100644 --- a/LEGO1/omni/include/mxvideopresenter.h +++ b/LEGO1/omni/include/mxvideopresenter.h @@ -32,7 +32,7 @@ class MxVideoPresenter : public MxMediaPresenter { void StartingTickle() override; // vtable+0x1c void StreamingTickle() override; // vtable+0x20 void RepeatingTickle() override; // vtable+0x24 - void Unk5Tickle() override; // vtable+0x28 + void FreezingTickle() override; // vtable+0x28 MxResult AddToManager() override; // vtable+0x34 // FUNCTION: LEGO1 0x1000c7a0 diff --git a/LEGO1/omni/src/common/mxmediapresenter.cpp b/LEGO1/omni/src/common/mxmediapresenter.cpp index fe43cca7..b8e714ee 100644 --- a/LEGO1/omni/src/common/mxmediapresenter.cpp +++ b/LEGO1/omni/src/common/mxmediapresenter.cpp @@ -216,12 +216,12 @@ void MxMediaPresenter::RepeatingTickle() if (m_currentChunk) { MxLong time = m_currentChunk->GetTime(); if (time <= m_action->GetElapsedTime() % m_action->GetLoopCount()) { - ProgressTickleState(e_unk5); + ProgressTickleState(e_freezing); } } else { if (m_action->GetElapsedTime() >= m_action->GetStartTime() + m_action->GetDuration()) { - ProgressTickleState(e_unk5); + ProgressTickleState(e_freezing); } } } diff --git a/LEGO1/omni/src/common/mxpresenter.cpp b/LEGO1/omni/src/common/mxpresenter.cpp index 76cbd880..eb0b11be 100644 --- a/LEGO1/omni/src/common/mxpresenter.cpp +++ b/LEGO1/omni/src/common/mxpresenter.cpp @@ -156,11 +156,11 @@ MxResult MxPresenter::Tickle() case e_repeating: this->RepeatingTickle(); - if (m_currentTickleState != e_unk5) { + if (m_currentTickleState != e_freezing) { break; } - case e_unk5: - this->Unk5Tickle(); + case e_freezing: + this->FreezingTickle(); if (m_currentTickleState != e_done) { break; diff --git a/LEGO1/omni/src/video/mxloopingflcpresenter.cpp b/LEGO1/omni/src/video/mxloopingflcpresenter.cpp index 257e5a81..31279ca3 100644 --- a/LEGO1/omni/src/video/mxloopingflcpresenter.cpp +++ b/LEGO1/omni/src/video/mxloopingflcpresenter.cpp @@ -57,7 +57,7 @@ void MxLoopingFlcPresenter::NextFrame() void MxLoopingFlcPresenter::VTable0x88() { if (m_action->GetDuration() < m_elapsedDuration) { - ProgressTickleState(e_unk5); + ProgressTickleState(e_freezing); } else { MxStreamChunk* chunk; diff --git a/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp b/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp index af73b59a..384e645b 100644 --- a/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp +++ b/LEGO1/omni/src/video/mxloopingsmkpresenter.cpp @@ -68,7 +68,7 @@ void MxLoopingSmkPresenter::NextFrame() void MxLoopingSmkPresenter::VTable0x8c() { if (m_action->GetDuration() < m_elapsedDuration) { - ProgressTickleState(e_unk5); + ProgressTickleState(e_freezing); } else { MxStreamChunk* chunk; diff --git a/LEGO1/omni/src/video/mxstillpresenter.cpp b/LEGO1/omni/src/video/mxstillpresenter.cpp index 8c0c7772..b64f7490 100644 --- a/LEGO1/omni/src/video/mxstillpresenter.cpp +++ b/LEGO1/omni/src/video/mxstillpresenter.cpp @@ -143,7 +143,7 @@ void MxStillPresenter::RepeatingTickle() { if (m_action->GetDuration() != -1) { if (m_action->GetElapsedTime() >= m_action->GetStartTime() + m_action->GetDuration()) { - ProgressTickleState(e_unk5); + ProgressTickleState(e_freezing); } } } diff --git a/LEGO1/omni/src/video/mxvideopresenter.cpp b/LEGO1/omni/src/video/mxvideopresenter.cpp index 06fa085e..71d115d4 100644 --- a/LEGO1/omni/src/video/mxvideopresenter.cpp +++ b/LEGO1/omni/src/video/mxvideopresenter.cpp @@ -506,7 +506,7 @@ void MxVideoPresenter::RepeatingTickle() } // FUNCTION: LEGO1 0x100b3130 -void MxVideoPresenter::Unk5Tickle() +void MxVideoPresenter::FreezingTickle() { MxLong sustainTime = ((MxDSMediaAction*) m_action)->GetSustainTime(); @@ -564,7 +564,7 @@ MxResult MxVideoPresenter::PutData() { AUTOLOCK(m_criticalSection); - if (IsEnabled() && m_currentTickleState >= e_streaming && m_currentTickleState <= e_unk5) { + if (IsEnabled() && m_currentTickleState >= e_streaming && m_currentTickleState <= e_freezing) { PutFrame(); }