From 36d681fde4e9deea4baebc867b1ef5501a9fd871 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 9 May 2024 10:30:34 -0400 Subject: [PATCH] Implement/match LegoAnimationManager::FUN_100617c0 (#891) --- .../legoomni/include/legoanimationmanager.h | 2 +- .../src/common/legoanimationmanager.cpp | 53 +++++++++++++++++-- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 75317d89..bc3200f3 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -96,7 +96,6 @@ class LegoAnimationManager : public MxCore { MxBool p_param9 ); void FUN_10061010(MxBool p_und); - void FUN_100617c0(MxS32, MxU16&, MxU16&); LegoTranInfo* GetTranInfo(MxU32 p_index); void FUN_10062770(); void FUN_100627d0(MxBool); @@ -127,6 +126,7 @@ class LegoAnimationManager : public MxCore { MxResult FUN_100609f0(MxU32 p_objectId, MxMatrix* p_matrix, MxBool p_und1, MxBool p_und2); void DeleteAnimations(); void FUN_10061530(); + MxResult FUN_100617c0(MxS32 p_unk0x08, MxU16& p_unk0x0e, MxU16& p_unk0x10); MxU16 FUN_10062110( LegoROI* p_roi, Vector3& p_direction, diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index fa499d4c..ae486e93 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1021,10 +1021,57 @@ void LegoAnimationManager::FUN_10061530() } } -// STUB: LEGO1 0x100617c0 -void LegoAnimationManager::FUN_100617c0(MxS32, MxU16&, MxU16&) +// FUNCTION: LEGO1 0x100617c0 +// FUNCTION: BETA10 0x1004240b +MxResult LegoAnimationManager::FUN_100617c0(MxS32 p_unk0x08, MxU16& p_unk0x0e, MxU16& p_unk0x10) { - // TODO + MxResult result = FAILURE; + MxU16 unk0x0e = 0; + MxU16 unk0x10 = 0; + MxBool success = FALSE; + + if (p_unk0x08 == -1) { + MxS32 i; + + for (i = 0; i < m_animCount; i++) { + if (m_anims[i].m_unk0x08 == p_unk0x08) { + unk0x0e = i; + success = TRUE; + break; + } + } + + if (success) { + for (; i < m_animCount && m_anims[i].m_unk0x08 == p_unk0x08; i++) { + unk0x10 = i; + } + } + } + else { + MxS32 i; + + for (i = 0; m_animCount > i && m_anims[i].m_unk0x08 != -1; i++) { + if (m_anims[i].m_unk0x08 == p_unk0x08) { + unk0x0e = i; + success = TRUE; + break; + } + } + + if (success) { + for (; i < m_animCount && m_anims[i].m_unk0x08 == p_unk0x08; i++) { + unk0x10 = i; + } + } + } + + if (success) { + p_unk0x0e = unk0x0e; + p_unk0x10 = unk0x10; + result = SUCCESS; + } + + return result; } // FUNCTION: LEGO1 0x100618f0