From d1b5bbb6a4d543a2e70685607e27e0047c9bffa7 Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Sun, 21 Jan 2024 07:47:10 -0500 Subject: [PATCH] LegoLocomotionAnimPresenter --- .../lego/legoomni/include/legoanimpresenter.h | 2 +- .../include/legolocomotionanimpresenter.h | 9 +++ .../src/video/legolocomotionanimpresenter.cpp | 76 ++++++++++++++----- 3 files changed, 69 insertions(+), 18 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index a5aa2df3..3eeea936 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -42,7 +42,7 @@ class LegoAnimPresenter : public MxVideoPresenter { // 6 more virtual functions here -private: +protected: void Init(); void Destroy(MxBool p_fromDestructor); diff --git a/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h b/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h index d6785fa2..04fc7d7a 100644 --- a/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h @@ -4,6 +4,7 @@ #include "legoloopinganimpresenter.h" // VTABLE: LEGO1 0x100d9170 +// SIZE 0xD8 class LegoLocomotionAnimPresenter : public LegoLoopingAnimPresenter { public: LegoLocomotionAnimPresenter(); @@ -35,6 +36,14 @@ class LegoLocomotionAnimPresenter : public LegoLoopingAnimPresenter { private: void Init(); + void Destroy(MxBool p_fromDestructor); + + undefined4 m_unk0xc0; // 0xc0 + undefined4* m_unk0xc4; // 0xc4 + MxCore* m_unk0xc8; // 0xc8 + MxS32 m_unk0xcc; // 0xcc + MxS32 m_unk0xd0; // 0xd0 + undefined2 m_unk0xd4; // 0xd4 }; #endif // LEGOLOCOMOTIONANIMPRESENTER_H diff --git a/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp index debe6659..6432a485 100644 --- a/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp @@ -1,63 +1,105 @@ #include "legolocomotionanimpresenter.h" +#include "legoomni.h" +#include "legoworld.h" + // FUNCTION: LEGO1 0x1006cdd0 LegoLocomotionAnimPresenter::LegoLocomotionAnimPresenter() { Init(); } -// STUB: LEGO1 0x1006d0b0 +// FUNCTION: LEGO1 0x1006d0b0 void LegoLocomotionAnimPresenter::Init() { - // TODO + m_unk0xc0 = 0; + m_unk0xc4 = 0; + m_unk0xd4 = 0; + m_unk0xcc = -1; + m_unk0xd0 = -1; + m_unk0xc8 = 0; } -// STUB: LEGO1 0x1006d140 +// FUNCTION: LEGO1 0x1006d0e0 +void LegoLocomotionAnimPresenter::Destroy(MxBool p_fromDestructor) +{ + m_criticalSection.Enter(); + + if (m_unk0xc4) { + delete[] m_unk0xc4; + } + + if (m_unk0xc8) { + delete m_unk0xc8; + } + m_unk0x68 = 0; + Init(); + m_criticalSection.Leave(); + + if (!p_fromDestructor) { + LegoAnimPresenter::Destroy(); + } +} + +// FUNCTION: LEGO1 0x1006d140 MxResult LegoLocomotionAnimPresenter::VTable0x88(MxStreamChunk* p_chunk) { - // TODO - return SUCCESS; + MxResult result = LegoAnimPresenter::VTable0x88(p_chunk); + return result == SUCCESS ? SUCCESS : result; } // STUB: LEGO1 0x1006d160 MxResult LegoLocomotionAnimPresenter::AddToManager() { - // TODO - return SUCCESS; + return MxVideoPresenter::AddToManager(); } -// STUB: LEGO1 0x1006d5b0 +// FUNCTION: LEGO1 0x1006d5b0 void LegoLocomotionAnimPresenter::Destroy() { - // TODO + Destroy(FALSE); } -// STUB: LEGO1 0x1006d5c0 +// FUNCTION: LEGO1 0x1006d5c0 void LegoLocomotionAnimPresenter::PutFrame() { - // TODO + // Empty } -// STUB: LEGO1 0x1006d5d0 +// FUNCTION: LEGO1 0x1006d5d0 void LegoLocomotionAnimPresenter::ReadyTickle() { - // TODO + LegoAnimPresenter::ReadyTickle(); + + if (m_currentWorld != NULL && m_currentTickleState == e_starting) { + m_currentWorld->VTable0x58(this); + if (m_compositePresenter != NULL) { + SendToCompositePresenter(Lego()); + } + + m_unk0xd4++; + } } // STUB: LEGO1 0x1006d610 void LegoLocomotionAnimPresenter::StartingTickle() { // TODO + EndAction(); } -// STUB: LEGO1 0x1006d660 +// FUNCTION: LEGO1 0x1006d660 void LegoLocomotionAnimPresenter::StreamingTickle() { - // TODO + if (m_unk0xd4 == 0) { + EndAction(); + } } -// STUB: LEGO1 0x1006d670 +// FUNCTION: LEGO1 0x1006d670 void LegoLocomotionAnimPresenter::EndAction() { - // TODO + if (m_action) { + MxVideoPresenter::EndAction(); + } }