From f637dcaa299c76f353dfdde6db0d823a3434d7c6 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 20 Apr 2024 11:40:23 -0400 Subject: [PATCH] Implement/match LegoAnimMMPresenter::FUN_1004b530 (#828) --- .../legoomni/include/legoanimmmpresenter.h | 23 ++++----- .../lego/legoomni/include/legoanimpresenter.h | 11 +++-- .../src/common/legoanimmmpresenter.cpp | 43 +++++++++-------- .../legoomni/src/paths/legoextraactor.cpp | 8 ++-- .../legoomni/src/video/legoanimpresenter.cpp | 48 +++++++++++-------- .../src/video/legolocomotionanimpresenter.cpp | 2 +- 6 files changed, 75 insertions(+), 60 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimmmpresenter.h b/LEGO1/lego/legoomni/include/legoanimmmpresenter.h index fdeae9e6..f5c40ac0 100644 --- a/LEGO1/lego/legoomni/include/legoanimmmpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimmmpresenter.h @@ -5,6 +5,7 @@ class LegoAnimPresenter; class LegoWorld; +class LegoROI; struct LegoTranInfo; // VTABLE: LEGO1 0x100d7de8 @@ -65,17 +66,17 @@ class LegoAnimMMPresenter : public MxCompositePresenter { MxBool FUN_1004b6b0(MxLong p_time); MxBool FUN_1004b6d0(MxLong p_time); - LegoAnimPresenter* m_unk0x4c; // 0x4c - MxLong m_unk0x50; // 0x50 - undefined4 m_unk0x54; // 0x54 - MxU8 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 + LegoAnimPresenter* m_presenter; // 0x4c + MxLong m_unk0x50; // 0x50 + undefined4 m_unk0x54; // 0x54 + MxU8 m_unk0x58; // 0x58 + MxBool m_unk0x59; // 0x59 + MxU32 m_animmanId; // 0x5c + LegoTranInfo* m_tranInfo; // 0x60 + LegoWorld* m_unk0x64; // 0x64 + Matrix4* m_unk0x68; // 0x68 + LegoROI** m_roiMap; // 0x6c + MxU32 m_roiMapSize; // 0x70 }; #endif // LEGOANIMMMPRESENTER_H diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index 31832560..17d741d1 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -63,14 +63,15 @@ class LegoAnimPresenter : public MxVideoPresenter { virtual void VTable0x98(); // vtable+0x98 // FUNCTION: LEGO1 0x1000c990 - virtual LegoROI** VTable0x9c(MxU32& p_unk0x6c) + virtual LegoROI** GetROIMap(MxU32& p_roiMapSize) { - p_unk0x6c = m_unk0x6c; - return m_unk0x68; + p_roiMapSize = m_roiMapSize; + return m_roiMap; } // vtable+0x9c virtual void VTable0xa0(Matrix4*); // vtable+0xa0 + MxResult FUN_1006afc0(Matrix4*&, undefined4); MxResult FUN_1006b140(LegoROI* p_roi); void FUN_1006d680(LegoAnimActor* p_actor, MxFloat p_value); @@ -97,8 +98,8 @@ class LegoAnimPresenter : public MxVideoPresenter { void FUN_1006c8a0(MxBool p_bool); LegoAnim* m_anim; // 0x64 - LegoROI** m_unk0x68; // 0x68 - MxU32 m_unk0x6c; // 0x6c + LegoROI** m_roiMap; // 0x68 + MxU32 m_roiMapSize; // 0x6c LegoROIList* m_unk0x70; // 0x70 LegoROIList* m_unk0x74; // 0x74 MxMatrix* m_unk0x78; // 0x78 diff --git a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp index eabd0212..241900ec 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp @@ -21,15 +21,15 @@ DECOMP_SIZE_ASSERT(LegoAnimMMPresenter, 0x74) // FUNCTION: LEGO1 0x1004a8d0 LegoAnimMMPresenter::LegoAnimMMPresenter() { - m_unk0x4c = NULL; + m_presenter = NULL; m_animmanId = 0; m_unk0x59 = FALSE; m_tranInfo = NULL; m_unk0x54 = 0; m_unk0x64 = NULL; m_unk0x68 = 0; - m_unk0x6c = 0; - m_unk0x70 = 0; + m_roiMap = NULL; + m_roiMapSize = 0; m_unk0x58 = e_unk0; } @@ -70,7 +70,7 @@ MxResult LegoAnimMMPresenter::StartAction(MxStreamController* p_controller, MxDS presenter->SetTickleState(MxPresenter::e_idle); if (presenter->IsA("LegoAnimPresenter") || presenter->IsA("LegoLoopingAnimPresenter")) { - m_unk0x4c = (LegoAnimPresenter*) presenter; + m_presenter = (LegoAnimPresenter*) presenter; } success = TRUE; } @@ -136,11 +136,11 @@ void LegoAnimMMPresenter::ReadyTickle() } if (m_tranInfo != NULL && m_tranInfo->m_unk0x0c != NULL) { - m_unk0x4c->VTable0xa0(m_tranInfo->m_unk0x0c); + m_presenter->VTable0xa0(m_tranInfo->m_unk0x0c); } - if (m_unk0x4c != NULL) { - m_unk0x4c->SetTickleState(e_ready); + if (m_presenter != NULL) { + m_presenter->SetTickleState(e_ready); } ProgressTickleState(e_starting); @@ -150,9 +150,9 @@ void LegoAnimMMPresenter::ReadyTickle() // FUNCTION: BETA10 0x1004c2cc void LegoAnimMMPresenter::StartingTickle() { - if (m_unk0x4c == NULL || m_unk0x4c->GetCurrentTickleState() == e_idle) { + if (m_presenter == NULL || m_presenter->GetCurrentTickleState() == e_idle) { if (m_tranInfo != NULL && m_tranInfo->m_unk0x08 != NULL) { - m_unk0x4c->FUN_1006b140(m_tranInfo->m_unk0x08); + m_presenter->FUN_1006b140(m_tranInfo->m_unk0x08); } m_unk0x50 = Timer()->GetTime(); @@ -173,12 +173,12 @@ void LegoAnimMMPresenter::StreamingTickle() // FUNCTION: BETA10 0x1004c3a4 void LegoAnimMMPresenter::RepeatingTickle() { - if (m_unk0x4c == NULL) { + if (m_presenter == NULL) { ProgressTickleState(e_freezing); } else if (m_list.size() <= 1) { - if (m_list.front() == m_unk0x4c) { - m_unk0x4c->SetTickleState(e_done); + if (m_list.front() == m_presenter) { + m_presenter->SetTickleState(e_done); ProgressTickleState(e_freezing); } else { @@ -201,8 +201,8 @@ MxLong LegoAnimMMPresenter::Notify(MxParam& p_param) AUTOLOCK(m_criticalSection); if (((MxNotificationParam&) p_param).GetType() == c_notificationEndAction && - ((MxNotificationParam&) p_param).GetSender() == m_unk0x4c) { - m_unk0x4c = NULL; + ((MxNotificationParam&) p_param).GetSender() == m_presenter) { + m_presenter = NULL; } return MxCompositePresenter::Notify(p_param); @@ -211,8 +211,8 @@ MxLong LegoAnimMMPresenter::Notify(MxParam& p_param) // FUNCTION: LEGO1 0x1004b360 void LegoAnimMMPresenter::VTable0x60(MxPresenter* p_presenter) { - if (m_unk0x4c == p_presenter && ((MxU8) p_presenter->GetCurrentTickleState() == MxPresenter::e_streaming || - (MxU8) p_presenter->GetCurrentTickleState() == MxPresenter::e_done)) { + if (m_presenter == p_presenter && ((MxU8) p_presenter->GetCurrentTickleState() == MxPresenter::e_streaming || + (MxU8) p_presenter->GetCurrentTickleState() == MxPresenter::e_done)) { p_presenter->SetTickleState(MxPresenter::e_idle); } } @@ -295,12 +295,17 @@ MxBool LegoAnimMMPresenter::FUN_1004b450() return result; } -// STUB: LEGO1 0x1004b530 +// FUNCTION: LEGO1 0x1004b530 // FUNCTION: BETA10 0x1004c8c4 MxBool LegoAnimMMPresenter::FUN_1004b530(MxLong p_time) { - // TODO - return FALSE; + if (m_presenter != NULL) { + m_presenter->FUN_1006afc0(m_unk0x68, 0); + m_roiMap = m_presenter->GetROIMap(m_roiMapSize); + m_roiMapSize++; + } + + return TRUE; } // STUB: LEGO1 0x1004b570 diff --git a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp index 9fd85363..0ba019ce 100644 --- a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp @@ -285,8 +285,8 @@ MxResult LegoExtraActor::WaitForAnimation() LegoAnimPresenterSet* set = m_boundary->GetPresenters(); for (LegoAnimPresenterSet::iterator it = set->begin(); it != set->end(); it++) { - undefined4 tmp; - if ((*it)->VTable0x9c(tmp)) { + MxU32 roiMapSize; + if ((*it)->GetROIMap(roiMapSize)) { b = TRUE; break; } @@ -310,8 +310,8 @@ void LegoExtraActor::Restart() LegoAnimPresenterSet* set = m_boundary->GetPresenters(); for (LegoAnimPresenterSet::iterator it = set->begin(); it != set->end(); it++) { - undefined4 tmp; - if ((*it)->VTable0x9c(tmp)) { + MxU32 roiMapSize; + if ((*it)->GetROIMap(roiMapSize)) { b = TRUE; break; } diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index 196acac1..2c545dda 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -31,8 +31,8 @@ LegoAnimPresenter::~LegoAnimPresenter() void LegoAnimPresenter::Init() { m_anim = NULL; - m_unk0x68 = NULL; - m_unk0x6c = 0; + m_roiMap = NULL; + m_roiMapSize = 0; m_unk0x74 = NULL; m_unk0x70 = NULL; m_unk0x78 = NULL; @@ -337,24 +337,24 @@ void LegoAnimPresenter::FUN_10069b10() FUN_1006a3c0(map, m_anim->GetRoot(), NULL); - if (m_unk0x68 != NULL) { - delete[] m_unk0x68; - m_unk0x6c = 0; + if (m_roiMap != NULL) { + delete[] m_roiMap; + m_roiMapSize = 0; } - m_unk0x6c = 0; - m_unk0x68 = new LegoROI*[map.size() + 1]; - memset(m_unk0x68, 0, (map.size() + 1) * sizeof(*m_unk0x68)); + m_roiMapSize = 0; + m_roiMap = new LegoROI*[map.size() + 1]; + memset(m_roiMap, 0, (map.size() + 1) * sizeof(*m_roiMap)); for (LegoAnimPresenterMap::iterator it = map.begin(); it != map.end();) { MxU32 index = (*it).second.m_index; - m_unk0x68[index] = (*it).second.m_roi; + m_roiMap[index] = (*it).second.m_roi; - if (m_unk0x68[index]->GetName() != NULL) { + if (m_roiMap[index]->GetName() != NULL) { for (MxS32 i = 0; i < m_unk0x94; i++) { if (m_unk0x8c[i] == NULL && m_unk0x90[i] != NULL) { - if (!strcmpi(m_unk0x90[i], m_unk0x68[index]->GetName())) { - m_unk0x8c[i] = m_unk0x68[index]; + if (!strcmpi(m_unk0x90[i], m_roiMap[index]->GetName())) { + m_unk0x8c[i] = m_roiMap[index]; break; } } @@ -363,7 +363,7 @@ void LegoAnimPresenter::FUN_10069b10() delete[] const_cast((*it).first); it++; - m_unk0x6c++; + m_roiMapSize++; } } @@ -563,6 +563,14 @@ void LegoAnimPresenter::PutFrame() } } +// STUB: LEGO1 0x1006afc0 +// FUNCTION: BETA10 0x1005059a +MxResult LegoAnimPresenter::FUN_1006afc0(Matrix4*&, undefined4) +{ + // TODO + return SUCCESS; +} + // STUB: LEGO1 0x1006b140 // FUNCTION: BETA10 0x100507e0 MxResult LegoAnimPresenter::FUN_1006b140(LegoROI* p_roi) @@ -616,8 +624,8 @@ void LegoAnimPresenter::StartingTickle() m_unk0x78 = new MxMatrix(); CalcLocalTransform(m_action->GetLocation(), m_action->GetDirection(), m_action->GetUp(), *m_unk0x78); } - else if (m_unk0x68 != NULL) { - LegoROI* roi = m_unk0x68[1]; + else if (m_roiMap != NULL) { + LegoROI* roi = m_roiMap[1]; if (roi != NULL) { MxMatrix mat; @@ -709,7 +717,7 @@ void LegoAnimPresenter::FUN_1006b9a0(LegoAnim* p_anim, MxLong p_time, Matrix4* p mat = *p_matrix; } else { - LegoROI* roi = m_unk0x68[data->GetUnknown0x20()]; + LegoROI* roi = m_roiMap[data->GetUnknown0x20()]; if (roi != NULL) { mat = roi->GetLocal2World(); @@ -728,7 +736,7 @@ void LegoAnimPresenter::FUN_1006b9a0(LegoAnim* p_anim, MxLong p_time, Matrix4* p } } - LegoROI::FUN_100a8e80(root, mat, p_time, m_unk0x68); + LegoROI::FUN_100a8e80(root, mat, p_time, m_roiMap); } // STUB: LEGO1 0x1006bac0 @@ -796,9 +804,9 @@ void LegoAnimPresenter::VTable0x90() // FUNCTION: LEGO1 0x1006c8a0 void LegoAnimPresenter::FUN_1006c8a0(MxBool p_bool) { - if (m_unk0x6c != 0 && m_unk0x68 != NULL) { - for (MxU32 i = 1; i <= m_unk0x6c; i++) { - LegoEntity* entity = m_unk0x68[i]->GetEntity(); + if (m_roiMapSize != 0 && m_roiMap != NULL) { + for (MxU32 i = 1; i <= m_roiMapSize; i++) { + LegoEntity* entity = m_roiMap[i]->GetEntity(); if (entity != NULL) { if (p_bool) { diff --git a/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp index 2bdda879..9801c2bc 100644 --- a/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp @@ -42,7 +42,7 @@ void LegoLocomotionAnimPresenter::Destroy(MxBool p_fromDestructor) delete m_unk0xc8; } - m_unk0x68 = NULL; + m_roiMap = NULL; Init(); m_criticalSection.Leave();