From 410824bd0f42a6d32e12da1abf65db892121c369 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 24 Apr 2024 09:51:28 -0400 Subject: [PATCH] Implement/match various small LegoAnimPresenter functions (#846) * Implement/match various small LegoAnimPresenter functions * Fix location of anim function * fix --- .../lego/legoomni/include/legoanimpresenter.h | 9 ++-- LEGO1/lego/legoomni/include/legoextraactor.h | 1 - .../include/legolocomotionanimpresenter.h | 2 + .../legoomni/include/legopathcontroller.h | 1 + LEGO1/lego/legoomni/include/legoworld.h | 1 + .../src/common/legoanimmmpresenter.cpp | 2 +- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 12 ++++++ .../lego/legoomni/src/paths/legoanimactor.cpp | 5 ++- .../legoomni/src/paths/legoextraactor.cpp | 9 ++-- .../legoomni/src/paths/legopathcontroller.cpp | 6 +++ .../legoomni/src/video/legoanimpresenter.cpp | 43 +++++++++++++------ .../src/video/legolocomotionanimpresenter.cpp | 6 +++ 12 files changed, 71 insertions(+), 26 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index 02a81b37..af6d58be 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -10,6 +10,7 @@ class LegoWorld; class LegoAnimClass; class LegoAnimActor; +class LegoPathBoundary; struct LegoAnimStructComparator { MxBool operator()(const char* const& p_a, const char* const& p_b) const { return strcmp(p_a, p_b) < 0; } @@ -62,7 +63,7 @@ class LegoAnimPresenter : public MxVideoPresenter { virtual void VTable0x8c(); // vtable+0x8c virtual void VTable0x90(); // vtable+0x90 virtual MxResult VTable0x94(Vector3&, Vector3&, float, float, Vector3&); // vtable+0x94 - virtual void VTable0x98(); // vtable+0x98 + virtual MxResult VTable0x98(LegoPathBoundary* p_boundary); // vtable+0x98 // FUNCTION: LEGO1 0x1000c990 virtual LegoROI** GetROIMap(MxU32& p_roiMapSize) @@ -71,16 +72,14 @@ class LegoAnimPresenter : public MxVideoPresenter { return m_roiMap; } // vtable+0x9c - virtual void VTable0xa0(Matrix4*); // vtable+0xa0 + virtual void VTable0xa0(Matrix4& p_matrix); // vtable+0xa0 MxResult FUN_1006afc0(MxMatrix*& p_matrix, float p_und); MxResult FUN_1006b140(LegoROI* p_roi); - void FUN_1006d680(LegoAnimActor* p_actor, MxFloat p_value); + const char* GetActionObjectName(); inline LegoAnim* GetAnimation() { return m_anim; } - const char* GetActionObjectName(); - protected: void Init(); void Destroy(MxBool p_fromDestructor); diff --git a/LEGO1/lego/legoomni/include/legoextraactor.h b/LEGO1/lego/legoomni/include/legoextraactor.h index c6ee0e61..696a3a50 100644 --- a/LEGO1/lego/legoomni/include/legoextraactor.h +++ b/LEGO1/lego/legoomni/include/legoextraactor.h @@ -2,7 +2,6 @@ #define LEGOEXTRAACTOR_H #include "legoanimactor.h" -#include "legoanimpresenter.h" // VTABLE: LEGO1 0x100d6c00 LegoAnimActor // VTABLE: LEGO1 0x100d6c10 LegoPathActor diff --git a/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h b/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h index 55eda20b..b70841ea 100644 --- a/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legolocomotionanimpresenter.h @@ -35,6 +35,8 @@ class LegoLocomotionAnimPresenter : public LegoLoopingAnimPresenter { // SYNTHETIC: LEGO1 0x1006cfe0 // LegoLocomotionAnimPresenter::`scalar deleting destructor' + void FUN_1006d680(LegoAnimActor* p_actor, MxFloat p_value); + inline void DecrementUnknown0xd4() { if (m_unk0xd4) { diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index c9037091..5a55fa0e 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -43,6 +43,7 @@ class LegoPathController : public MxCore { undefined4 FUN_10046770(LegoPathActor* p_actor); void FUN_100468f0(LegoAnimPresenter* p_presenter); + void FUN_10046930(LegoAnimPresenter* p_presenter); MxResult FUN_10046b30(LegoPathBoundary** p_path, MxS32& p_value); void Enable(MxBool p_enable); void FUN_10046bb0(LegoWorld* p_world); diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index d1841669..f882b685 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -75,6 +75,7 @@ class LegoWorld : public LegoEntity { ); void FUN_1001fc80(IslePathActor* p_actor); void FUN_1001fda0(LegoAnimPresenter* p_presenter); + void FUN_1001fe90(LegoAnimPresenter* p_presenter); void AddPath(LegoPathController* p_controller); MxResult GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value); MxCore* Find(const char* p_class, const char* p_name); diff --git a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp index 219502fe..17b47b46 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp @@ -149,7 +149,7 @@ void LegoAnimMMPresenter::ReadyTickle() } if (m_tranInfo != NULL && m_tranInfo->m_unk0x0c != NULL) { - m_presenter->VTable0xa0(m_tranInfo->m_unk0x0c); + m_presenter->VTable0xa0(*m_tranInfo->m_unk0x0c); } if (m_presenter != NULL) { diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index cf42b0e3..cfae9c2e 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -311,6 +311,18 @@ void LegoWorld::FUN_1001fda0(LegoAnimPresenter* p_presenter) } } +// FUNCTION: LEGO1 0x1001fe90 +// FUNCTION: BETA10 0x100da6b5 +void LegoWorld::FUN_1001fe90(LegoAnimPresenter* p_presenter) +{ + LegoPathControllerListCursor cursor(&m_list0x68); + LegoPathController* controller; + + while (cursor.Next(controller)) { + controller->FUN_10046930(p_presenter); + } +} + // FUNCTION: LEGO1 0x1001ff80 void LegoWorld::AddPath(LegoPathController* p_controller) { diff --git a/LEGO1/lego/legoomni/src/paths/legoanimactor.cpp b/LEGO1/lego/legoomni/src/paths/legoanimactor.cpp index 1bac6592..832d05f9 100644 --- a/LEGO1/lego/legoomni/src/paths/legoanimactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoanimactor.cpp @@ -1,7 +1,7 @@ #include "legoanimactor.h" #include "define.h" -#include "legoanimpresenter.h" +#include "legolocomotionanimpresenter.h" #include "legoworld.h" #include "misc.h" #include "mxutilities.h" @@ -200,7 +200,8 @@ void LegoAnimActor::ParseAction(char* p_extra) char* token = strtok(value, g_parseExtraTokens); while (token) { - LegoAnimPresenter* presenter = (LegoAnimPresenter*) world->Find("LegoAnimPresenter", token); + LegoLocomotionAnimPresenter* presenter = + (LegoLocomotionAnimPresenter*) world->Find("LegoAnimPresenter", token); if (presenter != NULL) { token = strtok(NULL, g_parseExtraTokens); diff --git a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp index 0ba019ce..066615ed 100644 --- a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp @@ -1,5 +1,6 @@ #include "legoextraactor.h" +#include "legolocomotionanimpresenter.h" #include "legosoundmanager.h" #include "misc.h" #include "mxmisc.h" @@ -11,10 +12,10 @@ DECOMP_SIZE_ASSERT(LegoExtraActor, 0x1dc) LegoWorld* g_unk0x100f31d0 = NULL; // GLOBAL: LEGO1 0x100f31d4 -LegoAnimPresenter* m_assAnimP = NULL; +LegoLocomotionAnimPresenter* m_assAnimP = NULL; // GLOBAL: LEGO1 0x100f31d8 -LegoAnimPresenter* m_disAnimP = NULL; +LegoLocomotionAnimPresenter* m_disAnimP = NULL; // GLOBAL: LEGO1 0x100f31dc MxS32 g_unk0x100f31dc = 0; @@ -156,8 +157,8 @@ inline void LegoExtraActor::FUN_1002ad8a() if (g_unk0x100f31d0 != w) { g_unk0x100f31d0 = w; - m_assAnimP = (LegoAnimPresenter*) w->Find("LegoAnimPresenter", "BNsAss01"); - m_disAnimP = (LegoAnimPresenter*) w->Find("LegoAnimPresenter", "BNsDis01"); + m_assAnimP = (LegoLocomotionAnimPresenter*) w->Find("LegoAnimPresenter", "BNsAss01"); + m_disAnimP = (LegoLocomotionAnimPresenter*) w->Find("LegoAnimPresenter", "BNsDis01"); } if (!m_assAnim) { diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index 51c6e723..422b972f 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -39,6 +39,12 @@ void LegoPathController::FUN_100468f0(LegoAnimPresenter* p_presenter) { } +// STUB: LEGO1 0x10046930 +// FUNCTION: BETA10 0x100b737b +void LegoPathController::FUN_10046930(LegoAnimPresenter* p_presenter) +{ +} + // STUB: LEGO1 0x10046b30 MxResult LegoPathController::FUN_10046b30(LegoPathBoundary** p_path, MxS32& p_value) { diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index 892bc06f..2d0c2297 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -805,10 +805,15 @@ void LegoAnimPresenter::ParseExtra() // TODO } -// STUB: LEGO1 0x1006c570 -void LegoAnimPresenter::VTable0xa0(Matrix4*) +// FUNCTION: LEGO1 0x1006c570 +// FUNCTION: BETA10 0x10051ab3 +void LegoAnimPresenter::VTable0xa0(Matrix4& p_matrix) { - // TODO + if (m_unk0x78 != NULL) { + delete m_unk0x78; + } + + m_unk0x78 = new MxMatrix(p_matrix); } // FUNCTION: LEGO1 0x1006c620 @@ -882,10 +887,19 @@ void LegoAnimPresenter::VTable0x8c() } } -// STUB: LEGO1 0x1006c860 +// FUNCTION: LEGO1 0x1006c860 +// FUNCTION: BETA10 0x10051f45 void LegoAnimPresenter::VTable0x90() { - // TODO + if (m_currentWorld != NULL) { + m_currentWorld->FUN_1001fe90(this); + + if (m_compositePresenter != NULL && m_compositePresenter->IsA("LegoAnimMMPresenter")) { + return; + } + + m_currentWorld->Remove(this); + } } // FUNCTION: LEGO1 0x1006c8a0 @@ -914,14 +928,17 @@ MxResult LegoAnimPresenter::VTable0x94(Vector3&, Vector3&, float, float, Vector3 return SUCCESS; } -// STUB: LEGO1 0x1006ca50 -void LegoAnimPresenter::VTable0x98() +// FUNCTION: LEGO1 0x1006ca50 +// FUNCTION: BETA10 0x100521d0 +MxResult LegoAnimPresenter::VTable0x98(LegoPathBoundary* p_boundary) { - // TODO -} + for (MxU32 i = 1; i <= m_roiMapSize; i++) { + LegoEntity* entity = m_roiMap[i]->GetEntity(); -// STUB: LEGO1 0x1006d680 -void LegoAnimPresenter::FUN_1006d680(LegoAnimActor* p_actor, MxFloat p_value) -{ - // TODO + if (entity != NULL) { + p_boundary->AddActor((LegoPathActor*) entity); + } + } + + return SUCCESS; } diff --git a/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp index 9801c2bc..81a9b921 100644 --- a/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp @@ -113,3 +113,9 @@ void LegoLocomotionAnimPresenter::EndAction() MxVideoPresenter::EndAction(); } } + +// STUB: LEGO1 0x1006d680 +void LegoLocomotionAnimPresenter::FUN_1006d680(LegoAnimActor* p_actor, MxFloat p_value) +{ + // TODO +}