From 31f5143741df5c351f4ea0bab235dedc009c1cec Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 25 Apr 2024 11:27:55 -0400 Subject: [PATCH] Implement/match LegoAnimPresenter::VTable0x94 (#852) --- .../lego/legoomni/include/legoanimpresenter.h | 32 +++++++++---------- .../legoomni/src/video/legoanimpresenter.cpp | 31 +++++++++++++++--- 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index 22d4535c..30e5201c 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -54,21 +54,21 @@ class LegoAnimPresenter : public MxVideoPresenter { return !strcmp(p_name, LegoAnimPresenter::ClassName()) || MxVideoPresenter::IsA(p_name); } - void ReadyTickle() override; // vtable+0x18 - void StartingTickle() override; // vtable+0x1c - void StreamingTickle() override; // vtable+0x20 - void DoneTickle() override; // vtable+0x2c - void ParseExtra() override; // vtable+0x30 - MxResult AddToManager() override; // vtable+0x34 - void Destroy() override; // vtable+0x38 - MxResult StartAction(MxStreamController* p_controller, MxDSAction* p_action) override; // vtable+0x3c - void EndAction() override; // vtable+0x40 - void PutFrame() override; // vtable+0x6c - virtual MxResult CreateAnim(MxStreamChunk* p_chunk); // vtable+0x88 - virtual void VTable0x8c(); // vtable+0x8c - virtual void VTable0x90(); // vtable+0x90 - virtual MxResult VTable0x94(Vector3&, Vector3&, float, float, Vector3&); // vtable+0x94 - virtual MxResult VTable0x98(LegoPathBoundary* p_boundary); // vtable+0x98 + void ReadyTickle() override; // vtable+0x18 + void StartingTickle() override; // vtable+0x1c + void StreamingTickle() override; // vtable+0x20 + void DoneTickle() override; // vtable+0x2c + void ParseExtra() override; // vtable+0x30 + MxResult AddToManager() override; // vtable+0x34 + void Destroy() override; // vtable+0x38 + MxResult StartAction(MxStreamController* p_controller, MxDSAction* p_action) override; // vtable+0x3c + void EndAction() override; // vtable+0x40 + void PutFrame() override; // vtable+0x6c + virtual MxResult CreateAnim(MxStreamChunk* p_chunk); // vtable+0x88 + virtual void VTable0x8c(); // vtable+0x8c + virtual void VTable0x90(); // vtable+0x90 + virtual MxU32 VTable0x94(Vector3& p_vec1, Vector3& p_vec2, float p_f1, float p_f2, Vector3& p_vec3); // vtable+0x94 + virtual MxResult VTable0x98(LegoPathBoundary* p_boundary); // vtable+0x98 // FUNCTION: LEGO1 0x1000c990 virtual LegoROI** GetROIMap(MxU32& p_roiMapSize) @@ -125,7 +125,7 @@ class LegoAnimPresenter : public MxVideoPresenter { LegoAnimSubstMap* m_substMap; // 0x98 MxS16 m_unk0x9c; // 0x9c undefined4* m_unk0xa0; // 0xa0 - undefined4 m_unk0xa4; // 0xa4 + float 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 5a0604fa..c5aa1e1c 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -1105,11 +1105,34 @@ void LegoAnimPresenter::FUN_1006c8a0(MxBool p_bool) } } -// STUB: LEGO1 0x1006c8f0 -MxResult LegoAnimPresenter::VTable0x94(Vector3&, Vector3&, float, float, Vector3&) +// FUNCTION: LEGO1 0x1006c8f0 +// FUNCTION: BETA10 0x1005206c +MxU32 LegoAnimPresenter::VTable0x94(Vector3& p_vec1, Vector3& p_vec2, float p_f1, float p_f2, Vector3& p_vec3) { - // TODO - return SUCCESS; + Mx3DPointFloat a, b; + + b = p_vec2; + ((Vector3&) b).Mul(p_f1); + ((Vector3&) b).Add(&p_vec1); + + a = b; + ((Vector3&) a).Sub(&m_unk0xa8); + + float len = a.LenSquared(); + if (len <= 0.0f) { + return TRUE; + } + + if (m_unk0xa4 + p_f2 >= sqrt(len) && m_roiMapSize != 0 && m_roiMap != NULL) { + for (MxU32 i = 1; i <= m_roiMapSize; i++) { + if (m_roiMap[i]->GetLODCount() != 0 && + m_roiMap[i]->FUN_100a9410(p_vec1, p_vec2, p_f1, p_f2, p_vec3, FALSE)) { + return TRUE; + } + } + } + + return FALSE; } // FUNCTION: LEGO1 0x1006ca50