From dc294e43bd598b9d8923245fcf4041364248a9ab Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 22 Apr 2024 10:05:54 -0400 Subject: [PATCH] WIP Destroy --- .../lego/legoomni/include/legoanimpresenter.h | 5 +- .../legoomni/src/video/legoanimpresenter.cpp | 64 +++++++++++++++++-- 2 files changed, 63 insertions(+), 6 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index aed665ae..2a6656af 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -93,6 +93,7 @@ class LegoAnimPresenter : public MxVideoPresenter { void FUN_10069b10(); void FUN_1006a3c0(LegoAnimPresenterMap& p_map, LegoTreeNode* p_node, LegoROI* p_roi); void FUN_1006a4f0(LegoAnimPresenterMap& p_map, LegoAnimNodeData* p_data, const LegoChar* p_und, LegoROI* p_roi); + void FUN_1006aa60(); void FUN_1006ab70(); LegoBool FUN_1006aba0(); MxBool FUN_1006abb0(LegoTreeNode* p_node, LegoROI* p_roi); @@ -111,14 +112,14 @@ class LegoAnimPresenter : public MxVideoPresenter { MxAtomId m_animAtom; // 0x84 undefined4 m_unk0x88; // 0x88 LegoROI** m_unk0x8c; // 0x8c - const char** m_unk0x90; // 0x90 + char** m_unk0x90; // 0x90 MxU8 m_unk0x94; // 0x94 undefined m_unk0x95; // 0x95 MxBool m_unk0x96; // 0x96 undefined m_unk0x97; // 0x97 undefined4 m_unk0x98; // 0x98 MxS16 m_unk0x9c; // 0x9c - undefined4 m_unk0xa0; // 0xa0 + undefined4* m_unk0xa0; // 0xa0 undefined4 m_unk0xa4; // 0xa4 Mx3DPointFloat m_unk0xa8; // 0xa8 }; diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index 1ace1292..cf86b806 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -5,6 +5,7 @@ #include "legovideomanager.h" #include "legoworld.h" #include "misc.h" +#include "mxautolock.h" #include "mxcompositepresenter.h" #include "mxdsanim.h" #include "mxmisc.h" @@ -51,14 +52,63 @@ void LegoAnimPresenter::Init() m_unk0x90 = NULL; m_unk0x94 = 0; m_unk0x96 = TRUE; - m_unk0xa0 = 0; + m_unk0xa0 = NULL; } -// STUB: LEGO1 0x10068770 +// FUNCTION: LEGO1 0x10068770 +// FUNCTION: BETA10 0x1004e833 void LegoAnimPresenter::Destroy(MxBool p_fromDestructor) { - // TODO - MxVideoPresenter::Destroy(p_fromDestructor); + { + AUTOLOCK(m_criticalSection); + + if (m_anim != NULL) { + delete m_anim; + } + + if (m_roiMap != NULL) { + delete[] m_roiMap; + } + + if (m_unk0x70 != NULL) { + delete m_unk0x70; + } + + if (m_unk0x74 != NULL) { + FUN_1006aa60(); + delete m_unk0x74; + } + + if (m_unk0x78 != NULL) { + delete m_unk0x78; + } + + // m_unk0x98 TODO + + if (m_unk0x90 != NULL) { + for (MxS32 i = 0; i < m_unk0x94; i++) { + if (m_unk0x90[i] != NULL) { + delete[] m_unk0x90[i]; + } + } + + delete[] m_unk0x90; + } + + if (m_unk0x8c != NULL) { + delete[] m_unk0x8c; + } + + if (m_unk0xa0 != NULL) { + delete m_unk0xa0; // TODO + } + + Init(); + } + + if (!p_fromDestructor) { + MxVideoPresenter::Destroy(p_fromDestructor); + } } // FUNCTION: LEGO1 0x10068fb0 @@ -449,6 +499,12 @@ void LegoAnimPresenter::FUN_1006a4f0( } } +// STUB: LEGO1 0x1006aa60 +void LegoAnimPresenter::FUN_1006aa60() +{ + // TODO +} + // STUB: LEGO1 0x1006ab70 void LegoAnimPresenter::FUN_1006ab70() {