From 75dc04f40aee4c787ebab9a6f21cfd519d4dc473 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 6 Apr 2024 08:08:38 -0400 Subject: [PATCH] Implement/match LegoCharacterManager::FUN_10084cf0 (#773) * Implement/match LegoCharacterManager::FUN_10084cf0 * Compat mode for iterator --- .../legoomni/include/legocharactermanager.h | 2 +- .../src/common/legocharactermanager.cpp | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index d32d57a1..53ef5d55 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -56,7 +56,6 @@ class LegoCharacterManager { LegoExtraActor* GetActor(const char* p_key); LegoCharacterData* GetData(const char* p_key); LegoCharacterData* GetData(LegoROI* p_roi); - LegoROI* FUN_10084cf0(LegoROI* p_roi, const char*); MxBool FUN_10084ec0(LegoROI* p_roi); MxU32 FUN_10085140(LegoROI* p_roi, MxBool p_und); LegoROI* FUN_10085210(const char* p_name, const char* p_lodName, MxBool p_createEntity); @@ -66,6 +65,7 @@ class LegoCharacterManager { private: LegoROI* CreateROI(const char* p_key); + LegoROI* FUN_10084cf0(LegoROI* p_roi, const char* p_name); MxResult FUN_10085870(LegoROI* p_roi); static char* g_customizeAnimFile; diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index 95e5c2fc..5928c5c1 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -455,10 +455,23 @@ LegoCharacterData* LegoCharacterManager::GetData(LegoROI* p_roi) return NULL; } -// STUB: LEGO1 0x10084cf0 -LegoROI* LegoCharacterManager::FUN_10084cf0(LegoROI* p_roi, const char*) +// FUNCTION: LEGO1 0x10084cf0 +LegoROI* LegoCharacterManager::FUN_10084cf0(LegoROI* p_roi, const char* p_name) { - // TODO + const CompoundObject* comp = p_roi->GetComp(); + +#ifdef COMPAT_MODE + for (CompoundObject::const_iterator it = comp->begin(); !(it == comp->end()); it++) { +#else + for (CompoundObject::iterator it = comp->begin(); !(it == comp->end()); it++) { +#endif + LegoROI* roi = (LegoROI*) *it; + + if (!strcmpi(p_name, roi->GetName())) { + return roi; + } + } + return NULL; }