diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 2851ee5c..33ab9b20 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -26,7 +26,7 @@ struct Character { MxBool m_unk0x08; // 0x08 MxBool m_unk0x09; // 0x09 MxU32 m_unk0x0c; // 0x0c - MxU32 m_unk0x10; // 0x10 + MxS32 m_unk0x10; // 0x10 MxBool m_active; // 0x14 MxU8 m_unk0x15; // 0x15 MxU8 m_unk0x16; // 0x16 @@ -41,13 +41,13 @@ struct Vehicle { // SIZE 0x18 struct Unknown0x3c { - LegoROI* m_roi; // 0x00 - MxS32 m_characterId; // 0x04 - undefined4 m_unk0x08; // 0x08 - undefined m_unk0x0c; // 0x0c - MxBool m_unk0x0d; // 0x0d - float m_unk0x10; // 0x10 - MxBool m_unk0x14; // 0x14 + LegoROI* m_roi; // 0x00 + MxS32 m_characterId; // 0x04 + MxLong m_unk0x08; // 0x08 + undefined m_unk0x0c; // 0x0c + MxBool m_unk0x0d; // 0x0d + float m_unk0x10; // 0x10 + MxBool m_unk0x14; // 0x14 }; // VTABLE: LEGO1 0x100d8c18 @@ -98,7 +98,7 @@ class LegoAnimationManager : public MxCore { void FUN_10061010(MxBool p_und); LegoTranInfo* GetTranInfo(MxU32 p_index); void FUN_10062770(); - void FUN_100627d0(MxBool); + void FUN_100627d0(MxBool p_und); void FUN_100629b0(MxU32, MxBool); void FUN_10063270(LegoROIList*, LegoAnimPresenter*); void FUN_10063780(LegoROIList* p_list); @@ -171,7 +171,7 @@ class LegoAnimationManager : public MxCore { MxLong m_unk0x408; // 0x408 MxLong m_unk0x40c; // 0x40c MxLong m_unk0x410; // 0x410 - undefined4 m_unk0x414; // 0x414 + MxLong m_unk0x414; // 0x414 MxU32 m_numAllowedExtras; // 0x418 undefined4 m_unk0x41c; // 0x41c AnimState* m_animState; // 0x420 diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index d6f5760f..722ae378 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1531,10 +1531,59 @@ void LegoAnimationManager::FUN_10062770() } } -// STUB: LEGO1 0x100627d0 -void LegoAnimationManager::FUN_100627d0(MxBool) +// FUNCTION: LEGO1 0x100627d0 +// FUNCTION: BETA10 0x1004389d +void LegoAnimationManager::FUN_100627d0(MxBool p_und) { - // TODO + ViewManager* viewManager = GetViewManager(); + + if (p_und || viewManager != NULL) { + MxLong time = Timer()->GetTime(); + + for (MxS32 i = 0; i < (MxS32) _countof(m_unk0x3c); i++) { + LegoROI* roi = m_unk0x3c[i].m_roi; + + if (roi != NULL) { + MxU16 prefix = *(MxU16*) roi->GetName(); + MxLong und = ((m_numAllowedExtras - 2) * 280000 / 18) + 20000; + MxBool maOrPa = prefix == TWOCC('m', 'a') || prefix == TWOCC('p', 'a'); + + if ((p_und && !maOrPa) || + (g_characters[m_unk0x3c[i].m_characterId].m_unk0x10 >= 0 && time - m_unk0x3c[i].m_unk0x08 > und && + CharacterManager()->GetRefCount(roi) == 1 && + !viewManager->FUN_100a6150(roi->GetWorldBoundingBox()))) { + m_unk0x414--; + + LegoPathActor* actor = CharacterManager()->GetActor(roi->GetName()); + if (actor != NULL && actor->GetController() != NULL) { + actor->GetController()->FUN_10046770(actor); + actor->ClearController(); + } + + CharacterManager()->FUN_10083db0(roi); + + if (m_unk0x3c[i].m_unk0x14) { + m_unk0x3c[i].m_unk0x14 = FALSE; + + MxS32 vehicleId = g_characters[m_unk0x3c[i].m_characterId].m_vehicleId; + if (vehicleId >= 0) { + g_vehicles[vehicleId].m_unk0x05 = FALSE; + + LegoROI* roi = Lego()->FindROI(g_vehicles[vehicleId].m_name); + if (roi != NULL) { + roi->SetVisibility(FALSE); + } + } + } + + m_unk0x3c[i].m_roi = NULL; + g_characters[m_unk0x3c[i].m_characterId].m_unk0x04 = FALSE; + g_characters[m_unk0x3c[i].m_characterId].m_unk0x07 = FALSE; + m_unk0x3c[i].m_characterId = -1; + } + } + } + } } // STUB: LEGO1 0x100629b0