From e260a407baae59b808d934f9772073eeaf5bfcc2 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 29 Mar 2024 13:30:31 -0400 Subject: [PATCH] Implement/match LegoCharacterManager::GetRefCount (#749) --- .../legoomni/include/legocharactermanager.h | 2 +- .../src/common/legocharactermanager.cpp | 22 ++++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index 6067c326..0b74f99b 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -50,7 +50,7 @@ class LegoCharacterManager { static MxBool FUN_10084c00(const LegoChar*); void FUN_100832a0(); - undefined4 FUN_10083bc0(LegoROI* p_roi); + MxU32 GetRefCount(LegoROI* p_roi); void FUN_10083db0(LegoROI* p_roi); void FUN_10083f10(LegoROI* p_roi); LegoExtraActor* FUN_10084c40(const LegoChar*); diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index 024c547d..35451e73 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -49,11 +49,11 @@ void LegoCharacterManager::FUN_100832a0() if (actor != NULL && actor->IsA("LegoExtraActor")) { LegoROI* roi = g_characterData[i].m_roi; - undefined4 und = FUN_10083bc0(roi); + MxU32 refCount = GetRefCount(roi); - while (und) { + while (refCount != 0) { FUN_10083db0(roi); - und = FUN_10083bc0(roi); + refCount = GetRefCount(roi); } } } @@ -205,10 +205,20 @@ LegoROI* LegoCharacterManager::GetROI(const char* p_key, MxBool p_createEntity) return NULL; } -// STUB: LEGO1 0x10083bc0 -undefined4 LegoCharacterManager::FUN_10083bc0(LegoROI* p_roi) +// FUNCTION: LEGO1 0x10083bc0 +MxU32 LegoCharacterManager::GetRefCount(LegoROI* p_roi) { - // TODO + LegoCharacterMap::iterator it; + + for (it = m_characters->begin(); it != m_characters->end(); it++) { + LegoCharacter* character = (*it).second; + LegoROI* roi = character->m_roi; + + if (roi == p_roi) { + return character->m_refCount; + } + } + return 0; }