From 857c15ca119b97f973d4f8838d57b0d92868f721 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sat, 25 May 2024 10:40:10 -0400 Subject: [PATCH] Implement/match LegoAnimationManager::FUN_10063b90 (#953) --- .../legoomni/include/legoanimationmanager.h | 2 +- .../legoomni/include/legocharactermanager.h | 2 +- LEGO1/lego/legoomni/include/legocharacters.h | 2 +- .../src/common/legoanimationmanager.cpp | 78 +++++++++++++++---- .../src/common/legocharactermanager.cpp | 12 +-- 5 files changed, 73 insertions(+), 23 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 88f304e8..087e3f86 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -152,7 +152,7 @@ class LegoAnimationManager : public MxCore { MxBool FUN_10062650(Vector3& p_position, float p_und, LegoROI* p_roi); MxBool FUN_10062710(AnimInfo& p_info); void FUN_10063aa0(); - MxBool FUN_10063b90(LegoWorld* p_world, LegoExtraActor* p_actor, MxU8 p_unk0x14, MxU32 p_characterId); + MxBool FUN_10063b90(LegoWorld* p_world, LegoExtraActor* p_actor, MxU8 p_mood, MxU32 p_characterId); void FUN_10063d10(); MxBool FUN_10063fb0(LegoLocation::Boundary* p_boundary, LegoWorld* p_world); MxBool FUN_10064010(LegoPathBoundary* p_boundary, LegoUnknown100db7f4* p_edge, float p_destScale); diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index aaeb584d..f92bdd76 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -71,7 +71,7 @@ class LegoCharacterManager { LegoCharacterInfo* GetInfo(LegoROI* p_roi); MxBool SwitchHat(LegoROI* p_roi); MxU32 FUN_10085140(LegoROI* p_roi, MxBool p_und); - MxU8 FUN_10085180(LegoROI* p_roi); + MxU8 GetMood(LegoROI* p_roi); LegoROI* FUN_10085210(const char* p_name, const char* p_lodName, MxBool p_createEntity); LegoROI* FUN_10085a80(const char* p_name, const char* p_lodName, MxBool p_createEntity); diff --git a/LEGO1/lego/legoomni/include/legocharacters.h b/LEGO1/lego/legoomni/include/legocharacters.h index 313a49e4..c21d81c7 100644 --- a/LEGO1/lego/legoomni/include/legocharacters.h +++ b/LEGO1/lego/legoomni/include/legocharacters.h @@ -24,7 +24,7 @@ struct LegoCharacterInfo { LegoExtraActor* m_actor; // 0x08 MxS32 m_unk0x0c; // 0x0c MxS32 m_unk0x10; // 0x10 - MxU8 m_unk0x14; // 0x14 + MxU8 m_mood; // 0x14 Part m_parts[10]; // 0x18 }; diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 04c86576..c3a939fe 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -51,7 +51,7 @@ LegoAnimationManager::Vehicle g_vehicles[] = { }; // GLOBAL: LEGO1 0x100f6d58 -const char* g_unk0x100f6d58[11][17] = { +const char* g_cycles[11][17] = { {"CNs001xx", "CNs002xx", "CNs003xx", @@ -1973,7 +1973,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) if (FUN_10063b90( world, actor, - CharacterManager()->FUN_10085180(m_extras[i].m_roi), + CharacterManager()->GetMood(m_extras[i].m_roi), m_lastExtraCharacterId )) { m_extras[i].m_unk0x14 = TRUE; @@ -2064,17 +2064,67 @@ void LegoAnimationManager::FUN_10063aa0() } } -// STUB: LEGO1 0x10063b90 +// FUNCTION: LEGO1 0x10063b90 // FUNCTION: BETA10 0x10044d46 -MxBool LegoAnimationManager::FUN_10063b90( - LegoWorld* p_world, - LegoExtraActor* p_actor, - MxU8 p_unk0x14, - MxU32 p_characterId -) +MxBool LegoAnimationManager::FUN_10063b90(LegoWorld* p_world, LegoExtraActor* p_actor, MxU8 p_mood, MxU32 p_characterId) { - // TODO - return TRUE; + const char** cycles = g_cycles[g_characters[p_characterId].m_unk0x16]; + const char* vehicleWC; + + if (g_characters[p_characterId].m_vehicleId >= 0 && g_vehicles[g_characters[p_characterId].m_vehicleId].m_unk0x04 && + (vehicleWC = cycles[10]) != NULL) { + LegoLocomotionAnimPresenter* presenter = + (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC); + + if (presenter != NULL) { + presenter->FUN_1006d680(p_actor, 1.7f); + } + + g_vehicles[g_characters[p_characterId].m_vehicleId].m_unk0x04 = FALSE; + g_vehicles[g_characters[p_characterId].m_vehicleId].m_unk0x05 = TRUE; + return TRUE; + } + else { + vehicleWC = cycles[p_mood]; + if (vehicleWC != NULL) { + LegoLocomotionAnimPresenter* presenter = + (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC); + + if (presenter != NULL) { + presenter->FUN_1006d680(p_actor, 0.7f); + } + } + + if (p_mood >= 2) { + p_mood--; + } + + vehicleWC = cycles[p_mood + 4]; + if (vehicleWC != NULL) { + LegoLocomotionAnimPresenter* presenter = + (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC); + + if (presenter != NULL) { + presenter->FUN_1006d680(p_actor, 4.0f); + } + } + + if (p_mood >= 1) { + p_mood--; + } + + vehicleWC = cycles[p_mood + 7]; + if (vehicleWC != NULL) { + LegoLocomotionAnimPresenter* presenter = + (LegoLocomotionAnimPresenter*) p_world->Find("LegoAnimPresenter", vehicleWC); + + if (presenter != NULL) { + presenter->FUN_1006d680(p_actor, 0.0f); + } + } + + return FALSE; + } } // FUNCTION: LEGO1 0x10063d10 @@ -2329,15 +2379,15 @@ MxResult LegoAnimationManager::FUN_10064380( } MxS32 characterId = m_extras[i].m_characterId; - const char** unk0x100f6d58 = g_unk0x100f6d58[g_characters[characterId].m_unk0x16]; + const char** cycles = g_cycles[g_characters[characterId].m_unk0x16]; LegoLocomotionAnimPresenter* presenter = - (LegoLocomotionAnimPresenter*) world->Find("LegoAnimPresenter", unk0x100f6d58[p_undIdx1]); + (LegoLocomotionAnimPresenter*) world->Find("LegoAnimPresenter", cycles[p_undIdx1]); if (presenter != NULL) { presenter->FUN_1006d680(actor, 0.0f); } - presenter = (LegoLocomotionAnimPresenter*) world->Find("LegoAnimPresenter", unk0x100f6d58[p_undIdx2]); + presenter = (LegoLocomotionAnimPresenter*) world->Find("LegoAnimPresenter", cycles[p_undIdx2]); if (presenter != NULL) { presenter->FUN_1006d680(actor, 4.0f); } diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index 856ff777..9f409bfb 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -116,7 +116,7 @@ MxResult LegoCharacterManager::Write(LegoStorage* p_storage) if (p_storage->Write(&info->m_unk0x10, sizeof(info->m_unk0x10)) != SUCCESS) { goto done; } - if (p_storage->Write(&info->m_unk0x14, sizeof(info->m_unk0x14)) != SUCCESS) { + if (p_storage->Write(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) { goto done; } if (p_storage->Write(&info->m_parts[c_infohatPart].m_unk0x08, sizeof(info->m_parts[c_infohatPart].m_unk0x08)) != @@ -171,7 +171,7 @@ MxResult LegoCharacterManager::Read(LegoStorage* p_storage) if (p_storage->Read(&info->m_unk0x10, sizeof(info->m_unk0x10)) != SUCCESS) { goto done; } - if (p_storage->Read(&info->m_unk0x14, sizeof(info->m_unk0x14)) != SUCCESS) { + if (p_storage->Read(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) { goto done; } if (p_storage->Read(&info->m_parts[c_infohatPart].m_unk0x08, sizeof(info->m_parts[c_infohatPart].m_unk0x08)) != @@ -449,7 +449,7 @@ LegoROI* LegoCharacterManager::CreateROI(const char* p_key) info->m_unk0x0c = pepper->m_unk0x0c; info->m_unk0x10 = pepper->m_unk0x10; - info->m_unk0x14 = pepper->m_unk0x14; + info->m_mood = pepper->m_mood; for (i = 0; i < sizeOfArray(info->m_parts); i++) { info->m_parts[i] = pepper->m_parts[i]; @@ -760,7 +760,7 @@ MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und) LegoCharacterInfo* info = GetInfo(p_roi); if (p_und) { - return info->m_unk0x14 + g_unk0x100fc4dc; + return info->m_mood + g_unk0x100fc4dc; } if (info != NULL) { @@ -772,12 +772,12 @@ MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und) // FUNCTION: LEGO1 0x10085180 // FUNCTION: BETA10 0x100768c5 -MxU8 LegoCharacterManager::FUN_10085180(LegoROI* p_roi) +MxU8 LegoCharacterManager::GetMood(LegoROI* p_roi) { LegoCharacterInfo* info = GetInfo(p_roi); if (info != NULL) { - return info->m_unk0x14; + return info->m_mood; } return 0;