From f6ffeabed7d35a5dd7319b82d7d336c90e7691b3 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 27 Apr 2024 09:59:00 -0400 Subject: [PATCH] Implement/match LegoAnimationManager::GetCharacterIndex (#861) --- .../legoomni/include/legoanimationmanager.h | 2 +- .../src/common/legoanimationmanager.cpp | 20 +++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 16e6a6d2..0441668e 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -91,7 +91,6 @@ class LegoAnimationManager : public MxCore { void FUN_10061010(undefined4); void FUN_100617c0(MxS32, MxU16&, MxU16&); LegoTranInfo* GetTranInfo(MxU32 p_index); - MxS8 FUN_10062360(char*); void FUN_10062770(); void FUN_100627d0(MxBool); void FUN_100629b0(MxU32, MxBool); @@ -120,6 +119,7 @@ class LegoAnimationManager : public MxCore { ); MxResult FUN_100609f0(MxU32 p_objectId, MxMatrix* p_matrix, MxBool p_und1, MxBool p_und2); void DeleteAnimations(); + MxS8 GetCharacterIndex(const char* p_name); void FUN_10063aa0(); MxU32 m_scriptIndex; // 0x08 diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 5e067ad4..0d5d8891 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -339,7 +339,7 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) goto done; } - m_anims[j].m_unk0x28 = FUN_10062360(m_anims[j].m_animName + strlen(m_anims[j].m_animName) - 2); + m_anims[j].m_unk0x28 = GetCharacterIndex(m_anims[j].m_animName + strlen(m_anims[j].m_animName) - 2); m_anims[j].m_unk0x29 = 0; for (k = 0; k < 3; k++) { @@ -348,7 +348,7 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) if (m_anims[j].m_unk0x08 == -1) { for (MxS32 l = 0; l < m_anims[j].m_modelCount; l++) { - MxS32 index = FUN_10062360(m_anims[j].m_models[l].m_modelName); + MxS32 index = GetCharacterIndex(m_anims[j].m_models[l].m_modelName); if (index >= 0) { g_characters[index].m_active = TRUE; @@ -748,11 +748,19 @@ MxResult LegoAnimationManager::Tickle() return SUCCESS; } -// STUB: LEGO1 0x10062360 -MxS8 LegoAnimationManager::FUN_10062360(char*) +// FUNCTION: LEGO1 0x10062360 +// FUNCTION: BETA10 0x100432dd +MxS8 LegoAnimationManager::GetCharacterIndex(const char* p_name) { - // TODO - return 0; + MxS8 i; + + for (i = 0; i < _countof(g_characters); i++) { + if (!strnicmp(p_name, g_characters[i].m_name, 2)) { + return i; + } + } + + return -1; } // FUNCTION: LEGO1 0x10062770