From c77dd44105a3f32917d6459f3339dbbfa84c330a Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 11 May 2024 08:13:27 -0400 Subject: [PATCH] Implement/match LegoCharacterManager::FUN_10083b20 and FUN_10085180 (#902) --- .../legoomni/include/legocharactermanager.h | 2 +- .../src/common/legoanimationmanager.cpp | 5 ++--- .../src/common/legocharactermanager.cpp | 21 ++++++++++++++----- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index 4db8a5ba..878e1f41 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -59,7 +59,7 @@ class LegoCharacterManager { static MxBool Exists(const char* p_key); void FUN_100832a0(); - MxBool FUN_10083b20(const char* p_name); + MxBool FUN_10083b20(const char* p_key); MxU32 GetRefCount(LegoROI* p_roi); void FUN_10083c30(const char* p_name); void FUN_10083db0(LegoROI* p_roi); diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index d0921a21..515e8aec 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1669,7 +1669,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) active = rand() % 100 < 50; } - nextCharacter: + tryNextCharacter: if (g_characters[m_lastExtraCharacterId].m_unk0x09 && g_characters[m_lastExtraCharacterId].m_unk0x08 && !g_characters[m_lastExtraCharacterId].m_unk0x04 && @@ -1708,7 +1708,6 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) boundary->m_dest, boundary->m_destScale ) == SUCCESS) { - MxS32 vehicleId = g_characters[m_lastExtraCharacterId].m_vehicleId; if (vehicleId >= 0) { g_vehicles[vehicleId].m_unk0x04 = @@ -1764,7 +1763,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) return; } - goto nextCharacter; + goto tryNextCharacter; } } } diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index 032b6969..3548529e 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -245,11 +245,17 @@ LegoROI* LegoCharacterManager::GetROI(const char* p_key, MxBool p_createEntity) return NULL; } -// STUB: LEGO1 0x10083b20 +// FUNCTION: LEGO1 0x10083b20 // FUNCTION: BETA10 0x10074608 -MxBool LegoCharacterManager::FUN_10083b20(const char* p_name) +MxBool LegoCharacterManager::FUN_10083b20(const char* p_key) { - // TODO + LegoCharacter* character = NULL; + LegoCharacterMap::iterator it = m_characters->find(const_cast(p_key)); + + if (it != m_characters->end()) { + return TRUE; + } + return FALSE; } @@ -744,11 +750,16 @@ MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und) return 0; } -// STUB: LEGO1 0x10085180 +// FUNCTION: LEGO1 0x10085180 // FUNCTION: BETA10 0x100768c5 MxU8 LegoCharacterManager::FUN_10085180(LegoROI* p_roi) { - // TODO + LegoCharacterInfo* info = GetInfo(p_roi); + + if (info != NULL) { + return info->m_unk0x14; + } + return 0; }