diff --git a/LEGO1/lego/legoomni/include/act2actor.h b/LEGO1/lego/legoomni/include/act2actor.h index 05ddf182..1b03ce4f 100644 --- a/LEGO1/lego/legoomni/include/act2actor.h +++ b/LEGO1/lego/legoomni/include/act2actor.h @@ -34,6 +34,7 @@ class Act2Actor : public LegoAnimActor { undefined4 FUN_10019700(MxFloat p_param); void FUN_100199f0(MxS8 p_param); void FUN_100192a0(undefined4 p_param); + LegoEntity* FUN_10019b90(undefined* p_param); // SYNTHETIC: LEGO1 0x1001a0a0 // Act2Actor::`scalar deleting destructor' @@ -58,7 +59,7 @@ class Act2Actor : public LegoAnimActor { undefined m_unk0x40; // 0x40 MxFloat m_unk0x44; // 0x44 MxS8 m_unk0x48; // 0x48 - undefined4 m_unk0x4c; // 0x4c + LegoEntity* m_unk0x4c; // 0x4c }; // TEMPLATE: LEGO1 0x100194f0 diff --git a/LEGO1/lego/legoomni/include/legoact2.h b/LEGO1/lego/legoomni/include/legoact2.h index e43c3a7a..30da0c57 100644 --- a/LEGO1/lego/legoomni/include/legoact2.h +++ b/LEGO1/lego/legoomni/include/legoact2.h @@ -70,6 +70,7 @@ class LegoAct2 : public LegoWorld { MxResult FUN_100516b0(); void FUN_100517b0(); + undefined4 FUN_10051f20(); MxResult FUN_10052560( Act2mainScript::Script p_objectId, MxBool p_param2, diff --git a/LEGO1/lego/legoomni/include/legoanimactor.h b/LEGO1/lego/legoomni/include/legoanimactor.h index 9a983120..cb27fd77 100644 --- a/LEGO1/lego/legoomni/include/legoanimactor.h +++ b/LEGO1/lego/legoomni/include/legoanimactor.h @@ -18,6 +18,9 @@ struct LegoAnimActorStruct { // FUNCTION: BETA10 0x10012210 LegoAnim* GetAnimTreePtr() { return m_AnimTreePtr; } + // FUNCTION: BETA10 0x10012240 + LegoROI** GetROIMap() { return m_roiMap; } + // TODO: Possibly private float m_unk0x00; // 0x00 LegoAnim* m_AnimTreePtr; // 0x04 diff --git a/LEGO1/lego/legoomni/include/legomain.h b/LEGO1/lego/legoomni/include/legomain.h index 4ac4f309..f0443bd6 100644 --- a/LEGO1/lego/legoomni/include/legomain.h +++ b/LEGO1/lego/legoomni/include/legomain.h @@ -131,8 +131,13 @@ class LegoOmni : public MxOmni { LegoWorld* GetCurrentWorld() { return m_currentWorld; } LegoNavController* GetNavController() { return m_navController; } LegoPathActor* GetUserActor() { return m_userActor; } + + // FUNCTION: BETA10 0x100e53a0 LegoPlantManager* GetPlantManager() { return m_plantManager; } + LegoAnimationManager* GetAnimationManager() { return m_animationManager; } + + // FUNCTION: BETA10 0x100e53d0 LegoBuildingManager* GetBuildingManager() { return m_buildingManager; } // FUNCTION: BETA10 0x100e52b0 diff --git a/LEGO1/lego/legoomni/include/legosoundmanager.h b/LEGO1/lego/legoomni/include/legosoundmanager.h index bc59ad35..696eaf1c 100644 --- a/LEGO1/lego/legoomni/include/legosoundmanager.h +++ b/LEGO1/lego/legoomni/include/legosoundmanager.h @@ -21,6 +21,7 @@ class LegoSoundManager : public MxSoundManager { void UpdateListener(const float* p_position, const float* p_direction, const float* p_up, const float* p_velocity); + // FUNCTION: BETA10 0x1000f350 LegoCacheSoundManager* GetCacheSoundManager() { return m_cacheSoundManager; } private: diff --git a/LEGO1/lego/legoomni/src/actors/act2actor.cpp b/LEGO1/lego/legoomni/src/actors/act2actor.cpp index af4bca85..160cfb30 100644 --- a/LEGO1/lego/legoomni/src/actors/act2actor.cpp +++ b/LEGO1/lego/legoomni/src/actors/act2actor.cpp @@ -2,14 +2,18 @@ #include "3dmanager/lego3dmanager.h" #include "act2main_actions.h" +#include "anim/legoanim.h" #include "legoact2.h" +#include "legobuildingmanager.h" #include "legocachesoundmanager.h" #include "legopathcontroller.h" #include "legopathedgecontainer.h" +#include "legoplantmanager.h" #include "legosoundmanager.h" #include "legovideomanager.h" #include "legoworld.h" #include "misc.h" +#include "mxdebug.h" #include "roi/legoroi.h" #include "viewmanager/viewmanager.h" @@ -37,6 +41,17 @@ Act2Actor::UnknownListStructure g_unk0x100f0db8[] = { // GLOBAL: LEGO1 0x100f0f1c MxFloat g_unk0x100f0f1c = 0.0f; +// GLOBAL: LEGO1 0x100f0f20 +// GLOBAL: BETA10 0x101dbe40 +MxBool g_unk0x100f0f20 = FALSE; + +// GLOBAL: LEGO1 0x100f0f24 +MxBool g_unk0x100f0f24 = FALSE; + +// GLOBAL: LEGO1 0x100f0f28 +// GLOBAL: BETA10 0x101dbe44 +MxBool g_unk0x100f0f28 = FALSE; + // GLOBAL: LEGO1 0x10102b1c // GLOBAL: BETA10 0x10209f60 undefined4 g_nextHeadWavIndex = 0; @@ -66,7 +81,7 @@ Act2Actor::Act2Actor() m_unk0x44 = 0; m_unk0x40 = 1; m_unk0x48 = 0; - m_unk0x4c = 0; + m_unk0x4c = NULL; m_unk0x38 = NULL; m_unk0x3c = 0; @@ -194,7 +209,7 @@ void Act2Actor::VTable0x70(float p_time) FindROI("pwrbrik")->SetVisibility(FALSE); FindROI("debrick")->SetVisibility(FALSE); FindROI("ray")->SetVisibility(FALSE); - m_unk0x4c = 0; + m_unk0x4c = NULL; m_unk0x1e = 2; VTable0xa0(); FUN_10019250(m_unk0x28 + 3, p_time + 3000.0f); @@ -496,11 +511,80 @@ MxS32 Act2Actor::VTable0xa0() } } -// STUB: LEGO1 0x10019700 -// STUB: BETA10 0x1000dd27 +// FUNCTION: LEGO1 0x10019700 +// FUNCTION: BETA10 0x1000dd27 undefined4 Act2Actor::FUN_10019700(MxFloat p_param) { - // TODO + if (!m_unk0x4c) { + g_unk0x100f0f20 = FALSE; + m_unk0x4c = FUN_10019b90(&g_unk0x100f0f20); + g_unk0x100f0f24 = FALSE; + g_unk0x100f0f28 = FALSE; + } + + if (!m_unk0x4c) { + MxTrace("nothing left to destroy at location %d\n", m_unk0x1d); + m_unk0x1e = 1; + + if (m_unk0x1d == 8) { + ((LegoAct2*) CurrentWorld())->FUN_10051f20(); + } + + return 1; + } + + if ((!g_unk0x100f0f28) && (m_unk0x30 < p_param)) { + g_unk0x100f0f28 = TRUE; + assert(SoundManager()->GetCacheSoundManager()); + SoundManager()->GetCacheSoundManager()->Play(m_unk0x38, "brickstr", FALSE); + + if (g_unk0x100f0f20) { + BuildingManager()->ScheduleAnimation(m_unk0x4c, 800, TRUE, FALSE); + } + else { + PlantManager()->ScheduleAnimation(m_unk0x4c, 800); + } + } + + if (m_unk0x2c < p_param) { + g_unk0x100f0f20 = FALSE; + m_unk0x4c = FUN_10019b90(&g_unk0x100f0f20); + m_unk0x2c = m_shootAnim->GetDuration() + p_param; + m_unk0x30 = m_unk0x2c - 1300.0f; + g_unk0x100f0f24 = FALSE; + g_unk0x100f0f28 = FALSE; + return 0; + } + + m_lastTime = p_param; + LegoROI* brickstrROI = FindROI("brickstr"); + + MxMatrix matrix = m_roi->GetLocal2World(); + matrix[3][1] += 1.0f; + brickstrROI->FUN_100a58f0(matrix); + brickstrROI->VTable0x14(); + + Vector3 col0(matrix[0]); + Vector3 col1(matrix[1]); + Vector3 col2(matrix[2]); + Vector3 col3(matrix[3]); + + col2 = col3; + col2 -= m_unk0x4c->GetROI()->GetWorldPosition(); + col2.Unitize(); + col0.EqualsCross(&col1, &col2); + col0.Unitize(); + col1.EqualsCross(&col2, &col3); + + assert(!m_cameraFlag); + + LegoTreeNode* root = m_shootAnim->GetAnimTreePtr()->GetRoot(); + MxFloat time = p_param - (m_unk0x2c - m_shootAnim->GetDuration()); + + for (MxS32 i = 0; i < root->GetNumChildren(); i++) { + LegoROI::FUN_100a8e80(root->GetChild(i), matrix, time, m_shootAnim->GetROIMap()); + } + return 0; } @@ -574,6 +658,14 @@ void Act2Actor::FUN_100199f0(MxS8 p_param) } } +// STUB: LEGO1 0x10019b90 +// STUB: BETA10 0x1000e374 +LegoEntity* Act2Actor::FUN_10019b90(undefined* p_param) +{ + // TODO + return 0; +} + // FUNCTION: LEGO1 0x1001a180 MxS32 Act2Actor::VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3) { diff --git a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp index 35a5d63a..d39ef601 100644 --- a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp @@ -660,6 +660,7 @@ MxBool LegoBuildingManager::FUN_10030110(LegoBuildingInfo* p_data) } // FUNCTION: LEGO1 0x10030150 +// FUNCTION: BETA10 0x100644ff void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxLong p_length, MxBool p_haveSound, MxBool p_unk0x28) { m_world = CurrentWorld(); diff --git a/LEGO1/lego/legoomni/src/common/misc.cpp b/LEGO1/lego/legoomni/src/common/misc.cpp index 5913ff74..28f6c039 100644 --- a/LEGO1/lego/legoomni/src/common/misc.cpp +++ b/LEGO1/lego/legoomni/src/common/misc.cpp @@ -111,14 +111,18 @@ ViewManager* GetViewManager() } // FUNCTION: LEGO1 0x100157e0 +// FUNCTION: BETA10 0x100e4b29 LegoPlantManager* PlantManager() { + assert(LegoOmni::GetInstance()); return LegoOmni::GetInstance()->GetPlantManager(); } // FUNCTION: LEGO1 0x100157f0 +// FUNCTION: BETA10 0x100e4b70 LegoBuildingManager* BuildingManager() { + assert(LegoOmni::GetInstance()); return LegoOmni::GetInstance()->GetBuildingManager(); } diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index 7e2e8d62..5d953d5d 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -928,6 +928,14 @@ void LegoAct2::SpawnBricks() m_nextBrick++; } +// STUB: LEGO1 0x10051f20 +// STUB: BETA10 0x10013f48 +undefined4 LegoAct2::FUN_10051f20() +{ + // TODO + return 0; +} + // FUNCTION: LEGO1 0x10051fa0 // FUNCTION: BETA10 0x10013fd3 void LegoAct2::FUN_10051fa0(MxS32 p_param1) diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index ec853d19..f9a8549b 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -409,6 +409,7 @@ LegoResult LegoROI::FUN_100a8da0(LegoTreeNode* p_node, const Matrix4& p_matrix, } // FUNCTION: LEGO1 0x100a8e80 +// FUNCTION: BETA10 0x1018ab3a void LegoROI::FUN_100a8e80(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_roiMap) { MxMatrix mat; diff --git a/reccmp-project.yml b/reccmp-project.yml index eb3415bd..d2aaf9ba 100644 --- a/reccmp-project.yml +++ b/reccmp-project.yml @@ -22,6 +22,7 @@ targets: ghidra: ignore-types: # these classes have been changed by hand to account for changes between LEGO1 and BETA10 + - Act2Actor - Act2Brick - LegoAct2 - LegoCarBuild