From 5021f66de2eb58e410d7346d77064113c0dc3670 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 20 Apr 2024 09:32:10 -0400 Subject: [PATCH] Imlpement/match LegoAnimMMPresenter::ParseExtra and related (#822) * Imlpement/match LegoAnimMMPresenter::ParseExtra and related * sort --- .../legoomni/include/legoanimationmanager.h | 1 + .../legoomni/include/legoanimmmpresenter.h | 23 ++++++----- LEGO1/lego/legoomni/include/legotraninfo.h | 36 ++++++++-------- .../lego/legoomni/include/legotraninfolist.h | 31 ++++++++++++++ .../src/common/legoanimationmanager.cpp | 18 ++++++++ .../src/common/legoanimmmpresenter.cpp | 41 +++++++++++++++---- 6 files changed, 114 insertions(+), 36 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 7cb0a479..e2783630 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -87,6 +87,7 @@ class LegoAnimationManager : public MxCore { ); void FUN_10061010(undefined4); void FUN_100617c0(MxS32, MxU16&, MxU32&); + LegoTranInfo* GetTranInfo(MxU32 p_index); MxS8 FUN_10062360(char*); void FUN_10062770(); void FUN_100627d0(MxBool); diff --git a/LEGO1/lego/legoomni/include/legoanimmmpresenter.h b/LEGO1/lego/legoomni/include/legoanimmmpresenter.h index 929db5cb..a319ab79 100644 --- a/LEGO1/lego/legoomni/include/legoanimmmpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimmmpresenter.h @@ -4,6 +4,7 @@ #include "mxcompositepresenter.h" class LegoWorld; +struct LegoTranInfo; // VTABLE: LEGO1 0x100d7de8 // SIZE 0x74 @@ -42,17 +43,17 @@ class LegoAnimMMPresenter : public MxCompositePresenter { MxBool FUN_1004b8b0(); private: - MxPresenter* m_unk0x4c; // 0x4c - undefined4 m_unk0x50; // 0x50 - undefined4 m_unk0x54; // 0x54 - undefined m_unk0x58; // 0x58 - undefined m_unk0x59; // 0x59 - undefined4 m_unk0x5c; // 0x5c - undefined4 m_unk0x60; // 0x60 - LegoWorld* m_unk0x64; // 0x64 - undefined4 m_unk0x68; // 0x68 - undefined4 m_unk0x6c; // 0x6c - undefined4 m_unk0x70; // 0x70 + MxPresenter* m_unk0x4c; // 0x4c + undefined4 m_unk0x50; // 0x50 + undefined4 m_unk0x54; // 0x54 + undefined m_unk0x58; // 0x58 + MxBool m_unk0x59; // 0x59 + MxU32 m_animmanId; // 0x5c + LegoTranInfo* m_tranInfo; // 0x60 + LegoWorld* m_unk0x64; // 0x64 + undefined4 m_unk0x68; // 0x68 + undefined4 m_unk0x6c; // 0x6c + undefined4 m_unk0x70; // 0x70 }; #endif // LEGOANIMMMPRESENTER_H diff --git a/LEGO1/lego/legoomni/include/legotraninfo.h b/LEGO1/lego/legoomni/include/legotraninfo.h index 8d880889..aa7ba70c 100644 --- a/LEGO1/lego/legoomni/include/legotraninfo.h +++ b/LEGO1/lego/legoomni/include/legotraninfo.h @@ -4,6 +4,8 @@ #include "decomp.h" #include "mxgeometry/mxmatrix.h" +class LegoAnimMMPresenter; + // SIZE 0x78 struct LegoTranInfo { enum { @@ -20,7 +22,7 @@ struct LegoTranInfo { m_unk0x14 = FALSE; m_unk0x1c = NULL; m_unk0x20 = NULL; - m_unk0x24 = 0; + m_presenter = NULL; m_unk0x15 = TRUE; m_unk0x28 = TRUE; m_unk0x29 = TRUE; @@ -28,22 +30,22 @@ struct LegoTranInfo { m_unk0x2c.SetIdentity(); } - undefined4 m_unk0x00; // 0x00 - MxU32 m_index; // 0x04 - undefined4 m_unk0x08; // 0x08 - MxMatrix* m_unk0x0c; // 0x0c - MxBool m_unk0x10; // 0x10 - MxS16 m_unk0x12; // 0x12 - MxBool m_unk0x14; // 0x14 - MxBool m_unk0x15; // 0x15 - MxU32 m_objectId; // 0x18 - undefined4* m_unk0x1c; // 0x1c - undefined4* m_unk0x20; // 0x20 - undefined4 m_unk0x24; // 0x24 - MxBool m_unk0x28; // 0x28 - MxBool m_unk0x29; // 0x29 - MxMatrix m_unk0x2c; // 0x2c - MxU32 m_flags; // 0x74 + undefined4 m_unk0x00; // 0x00 + MxU32 m_index; // 0x04 + undefined4 m_unk0x08; // 0x08 + MxMatrix* m_unk0x0c; // 0x0c + MxBool m_unk0x10; // 0x10 + MxS16 m_unk0x12; // 0x12 + MxBool m_unk0x14; // 0x14 + MxBool m_unk0x15; // 0x15 + MxU32 m_objectId; // 0x18 + undefined4* m_unk0x1c; // 0x1c + undefined4* m_unk0x20; // 0x20 + LegoAnimMMPresenter* m_presenter; // 0x24 + MxBool m_unk0x28; // 0x28 + MxBool m_unk0x29; // 0x29 + MxMatrix m_unk0x2c; // 0x2c + MxU32 m_flags; // 0x74 }; #endif // LEGOTRANINFO_H diff --git a/LEGO1/lego/legoomni/include/legotraninfolist.h b/LEGO1/lego/legoomni/include/legotraninfolist.h index 96c46535..06cd2558 100644 --- a/LEGO1/lego/legoomni/include/legotraninfolist.h +++ b/LEGO1/lego/legoomni/include/legotraninfolist.h @@ -21,6 +21,19 @@ class LegoTranInfoList : public MxPtrList { LegoTranInfoList() : MxPtrList(FALSE) {} }; +// VTABLE: LEGO1 0x100d8cf0 +// class MxListCursor + +// VTABLE: LEGO1 0x100d8d08 +// class MxPtrListCursor + +// VTABLE: LEGO1 0x100d8d20 +// SIZE 0x10 +class LegoTranInfoListCursor : public MxPtrListCursor { +public: + LegoTranInfoListCursor(LegoTranInfoList* p_list) : MxPtrListCursor(p_list) {} +}; + // TEMPLATE: LEGO1 0x1005fdf0 // MxCollection::Compare @@ -48,4 +61,22 @@ class LegoTranInfoList : public MxPtrList { // SYNTHETIC: LEGO1 0x100600d0 // MxPtrList::`scalar deleting destructor' +// SYNTHETIC: LEGO1 0x100612f0 +// LegoTranInfoListCursor::`scalar deleting destructor' + +// FUNCTION: LEGO1 0x10061360 +// MxPtrListCursor::~MxPtrListCursor + +// SYNTHETIC: LEGO1 0x100613b0 +// MxListCursor::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x10061420 +// MxPtrListCursor::`scalar deleting destructor' + +// FUNCTION: LEGO1 0x10061490 +// MxListCursor::~MxListCursor + +// FUNCTION: LEGO1 0x100614e0 +// LegoTranInfoListCursor::~LegoTranInfoListCursor + #endif // LEGOTRANINFOLIST_H diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 2a730c6a..afb0d984 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -564,6 +564,24 @@ void LegoAnimationManager::FUN_100617c0(MxS32, MxU16&, MxU32&) // TODO } +// FUNCTION: LEGO1 0x100618f0 +// FUNCTION: BETA10 0x100425f0 +LegoTranInfo* LegoAnimationManager::GetTranInfo(MxU32 p_index) +{ + if (m_tranInfoList != NULL) { + LegoTranInfoListCursor cursor(m_tranInfoList); + LegoTranInfo* tranInfo; + + while (cursor.Next(tranInfo)) { + if (tranInfo->m_index == p_index) { + return tranInfo; + } + } + } + + return NULL; +} + // STUB: LEGO1 0x100619f0 MxLong LegoAnimationManager::Notify(MxParam& p_param) { diff --git a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp index 59cfbc2b..05c78e09 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp @@ -1,6 +1,9 @@ #include "legoanimmmpresenter.h" #include "decomp.h" +#include "define.h" +#include "legoanimationmanager.h" +#include "legotraninfo.h" #include "legovideomanager.h" #include "legoworld.h" #include "misc.h" @@ -9,6 +12,7 @@ #include "mxmisc.h" #include "mxnotificationmanager.h" #include "mxobjectfactory.h" +#include "mxutilities.h" DECOMP_SIZE_ASSERT(LegoAnimMMPresenter, 0x74) @@ -16,9 +20,9 @@ DECOMP_SIZE_ASSERT(LegoAnimMMPresenter, 0x74) LegoAnimMMPresenter::LegoAnimMMPresenter() { m_unk0x4c = NULL; - m_unk0x5c = 0; - m_unk0x59 = 0; - m_unk0x60 = 0; + m_animmanId = 0; + m_unk0x59 = FALSE; + m_tranInfo = NULL; m_unk0x54 = 0; m_unk0x64 = NULL; m_unk0x68 = 0; @@ -143,15 +147,36 @@ void LegoAnimMMPresenter::VTable0x60(MxPresenter* p_presenter) } } -// STUB: LEGO1 0x1004b390 +// FUNCTION: LEGO1 0x1004b390 +// FUNCTION: BETA10 0x1004c5be void LegoAnimMMPresenter::ParseExtra() { - // TODO + MxU16 extraLength; + char* extraData; + m_action->GetExtra(extraLength, extraData); + + if (extraLength & MAXWORD) { + char extraCopy[1024]; + memcpy(extraCopy, extraData, extraLength & MAXWORD); + extraCopy[extraLength & MAXWORD] = '\0'; + + char output[1024]; + if (KeyValueStringParse(output, g_strANIMMAN_ID, extraCopy)) { + char* token = strtok(output, g_parseExtraTokens); + m_animmanId = atoi(token); + m_tranInfo = AnimationManager()->GetTranInfo(m_animmanId); + + if (m_tranInfo != NULL) { + m_unk0x59 = m_tranInfo->m_unk0x10; + m_tranInfo->m_presenter = this; + } + } + } } -// STUB: LEGO1 0x1004b8b0 +// FUNCTION: LEGO1 0x1004b8b0 +// FUNCTION: BETA10 0x1004d104 MxBool LegoAnimMMPresenter::FUN_1004b8b0() { - // TODO - return FALSE; + return m_tranInfo != NULL ? m_tranInfo->m_unk0x28 : TRUE; }