From 3878f798476fa29b561753d8cb3f824ba8c515eb Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 29 Mar 2024 14:34:50 -0400 Subject: [PATCH] Implement/match LegoCharacterData::GetData and FUN_10085140 (#755) --- .../legoomni/include/legocharactermanager.h | 3 +- .../src/common/legocharactermanager.cpp | 39 +++++++++++++++++-- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index 79fde62e..faf31337 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -55,8 +55,9 @@ class LegoCharacterManager { void FUN_10083f10(LegoROI* p_roi); LegoExtraActor* GetActor(const char* p_key); LegoCharacterData* GetData(const char* p_key); + LegoCharacterData* GetData(LegoROI* p_roi); MxBool FUN_10084ec0(LegoROI* p_roi); - MxU32 FUN_10085140(LegoROI*, MxBool); + MxU32 FUN_10085140(LegoROI* p_roi, MxBool p_und); LegoROI* FUN_10085210(const char*, char*, undefined); LegoROI* FUN_10085a80(char* p_und1, char* p_und2, undefined p_und3); diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index f3734716..848d695f 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -17,6 +17,12 @@ DECOMP_SIZE_ASSERT(LegoCharacterManager, 0x08) // GLOBAL: LEGO1 0x100fc4e4 char* LegoCharacterManager::g_customizeAnimFile = NULL; +// GLOBAL: LEGO1 0x100fc4d8 +MxU32 g_unk0x100fc4d8 = 50; + +// GLOBAL: LEGO1 0x100fc4dc +MxU32 g_unk0x100fc4dc = 66; + // GLOBAL: LEGO1 0x10104f20 LegoCharacterData g_characterData[66]; @@ -425,6 +431,24 @@ LegoCharacterData* LegoCharacterManager::GetData(const char* p_key) return NULL; } +// FUNCTION: LEGO1 0x10084cb0 +LegoCharacterData* LegoCharacterManager::GetData(LegoROI* p_roi) +{ + MxU32 i; + + for (i = 0; i < _countof(g_characterData); i++) { + if (g_characterData[i].m_roi == p_roi) { + break; + } + } + + if (i < _countof(g_characterData)) { + return &g_characterData[i]; + } + + return NULL; +} + // STUB: LEGO1 0x10084ec0 MxBool LegoCharacterManager::FUN_10084ec0(LegoROI* p_roi) { @@ -432,10 +456,19 @@ MxBool LegoCharacterManager::FUN_10084ec0(LegoROI* p_roi) return FALSE; } -// STUB: LEGO1 0x10085140 -MxU32 LegoCharacterManager::FUN_10085140(LegoROI*, MxBool) +// FUNCTION: LEGO1 0x10085140 +MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und) { - // TODO + LegoCharacterData* data = GetData(p_roi); + + if (p_und) { + return data->m_unk0x14 + g_unk0x100fc4dc; + } + + if (data != NULL) { + return data->m_unk0x0c + g_unk0x100fc4d8; + } + return 0; }