From ed782980ec1b06f65d735b5e3cce112f30348566 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Fri, 17 May 2024 10:20:04 -0400 Subject: [PATCH] Implement/match LegoAnimationManager::FUN_10063d10 (#927) --- .../legoomni/include/legoanimationmanager.h | 4 +- .../src/common/legoanimationmanager.cpp | 40 ++++++++++++++++++- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index ac85dd89..78dfa737 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -32,7 +32,7 @@ class LegoAnimationManager : public MxCore { MxBool m_unk0x07; // 0x07 MxBool m_unk0x08; // 0x08 MxBool m_unk0x09; // 0x09 - MxU32 m_unk0x0c; // 0x0c + MxS32 m_unk0x0c; // 0x0c MxS32 m_unk0x10; // 0x10 MxBool m_active; // 0x14 MxU8 m_unk0x15; // 0x15 @@ -51,7 +51,7 @@ class LegoAnimationManager : public MxCore { LegoROI* m_roi; // 0x00 MxS32 m_characterId; // 0x04 MxLong m_unk0x08; // 0x08 - undefined m_unk0x0c; // 0x0c + MxBool m_unk0x0c; // 0x0c MxBool m_unk0x0d; // 0x0d float m_unk0x10; // 0x10 MxBool m_unk0x14; // 0x14 diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index c82a12e5..95b8963c 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1824,11 +1824,47 @@ MxBool LegoAnimationManager::FUN_10063b90( return TRUE; } -// STUB: LEGO1 0x10063d10 +// FUNCTION: LEGO1 0x10063d10 // FUNCTION: BETA10 0x10045034 void LegoAnimationManager::FUN_10063d10() { - // TODO + if (CurrentWorld() != NULL) { + MxLong time = Timer()->GetTime(); + + for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_extras); i++) { + LegoROI* roi = m_extras[i].m_roi; + + if (roi != NULL) { + if (m_extras[i].m_unk0x0c && g_characters[m_extras[i].m_characterId].m_unk0x0c >= 0 && + g_characters[m_extras[i].m_characterId].m_unk0x0c < time - m_extras[i].m_unk0x08) { + + m_extras[i].m_unk0x0c = FALSE; + + LegoExtraActor* actor = CharacterManager()->GetActor(roi->GetName()); + if (actor != NULL) { + float speed = m_extras[i].m_unk0x10; + + if (speed < 0.0f) { + if (m_extras[i].m_unk0x14) { + speed = ((float) (rand() * 1.5) / 32767.0f) + 0.9; + } + else { + speed = ((float) (rand() * 1.4) / 32767.0f) + 0.6; + } + } + + actor->SetWorldSpeed(speed); + } + } + else { + LegoExtraActor* actor = CharacterManager()->GetActor(roi->GetName()); + if (actor != NULL) { + actor->Restart(); + } + } + } + } + } } // STUB: LEGO1 0x10063fb0