From a0a114135acc8e40046166d435aee4be4f2db76d Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 2 Dec 2024 10:58:08 -0700 Subject: [PATCH] Implement/match `LegoAct2::HandleEndAction` and related (#1184) * Implement/match LegoAct2::HandleEndAction * Reorder --- LEGO1/lego/legoomni/include/act2actor.h | 33 +-- LEGO1/lego/legoomni/include/act2brick.h | 2 + LEGO1/lego/legoomni/include/legoact2.h | 22 +- .../legoomni/include/legoanimationmanager.h | 2 +- LEGO1/lego/legoomni/include/legocachsound.h | 3 +- LEGO1/lego/legoomni/src/actors/act2actor.cpp | 21 +- .../lego/legoomni/src/audio/legocachsound.cpp | 19 +- .../src/common/legoanimationmanager.cpp | 2 +- LEGO1/lego/legoomni/src/entity/act2brick.cpp | 24 ++ LEGO1/lego/legoomni/src/entity/legoactor.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/legoact2.cpp | 238 ++++++++++++++++-- 11 files changed, 314 insertions(+), 54 deletions(-) diff --git a/LEGO1/lego/legoomni/include/act2actor.h b/LEGO1/lego/legoomni/include/act2actor.h index 3e0cb0dd..c45effeb 100644 --- a/LEGO1/lego/legoomni/include/act2actor.h +++ b/LEGO1/lego/legoomni/include/act2actor.h @@ -27,6 +27,7 @@ class Act2Actor : public LegoAnimActor { MxResult VTable0x9c() override; // vtable+0x9c MxS32 VTable0xa0() override; // vtable+0xa0 + void FUN_10018980(); void FUN_10019520(); void FUN_100192a0(undefined4 p_param); @@ -38,22 +39,22 @@ class Act2Actor : public LegoAnimActor { // `vbtable' private: - undefined m_unk0x1c; // 0x1c - MxS8 m_unk0x1d; // 0x1d - undefined m_unk0x1e; // 0x1e - MxBool m_unk0x1f; // 0x1f - undefined4 m_unk0x20; // 0x20 - undefined4 m_unk0x24; // 0x24 - MxS8 m_unk0x28; // 0x28 - undefined4 m_unk0x2c; // 0x2c - undefined4 m_unk0x30; // 0x30 - undefined4 m_unk0x34; // 0x34 - undefined4 m_unk0x38; // 0x38 - undefined4 m_unk0x3c; // 0x3c - undefined m_unk0x40; // 0x40 - undefined4 m_unk0x44; // 0x44 - MxS8 m_unk0x48; // 0x48 - undefined4 m_unk0x4c; // 0x4c + undefined m_unk0x1c; // 0x1c + MxS8 m_unk0x1d; // 0x1d + undefined m_unk0x1e; // 0x1e + MxBool m_unk0x1f; // 0x1f + undefined4 m_unk0x20; // 0x20 + undefined4 m_unk0x24; // 0x24 + MxS8 m_unk0x28; // 0x28 + undefined4 m_unk0x2c; // 0x2c + undefined4 m_unk0x30; // 0x30 + LegoAnimActorStruct* m_shootAnim; // 0x34 + LegoCacheSound* m_unk0x38; // 0x38 + undefined4 m_unk0x3c; // 0x3c + undefined m_unk0x40; // 0x40 + undefined4 m_unk0x44; // 0x44 + MxS8 m_unk0x48; // 0x48 + undefined4 m_unk0x4c; // 0x4c }; // TEMPLATE: LEGO1 0x100194f0 diff --git a/LEGO1/lego/legoomni/include/act2brick.h b/LEGO1/lego/legoomni/include/act2brick.h index a0399730..6035e11d 100644 --- a/LEGO1/lego/legoomni/include/act2brick.h +++ b/LEGO1/lego/legoomni/include/act2brick.h @@ -31,8 +31,10 @@ class Act2Brick : public LegoPathActor { // SYNTHETIC: LEGO1 0x1007a450 // Act2Brick::`scalar deleting destructor' + void Remove(); void PlayWhistleSound(); void StopWhistleSound(); + void Mute(MxBool p_muted); private: static MxLong g_lastHitActorTime; diff --git a/LEGO1/lego/legoomni/include/legoact2.h b/LEGO1/lego/legoomni/include/legoact2.h index 34c694c7..8bdccb60 100644 --- a/LEGO1/lego/legoomni/include/legoact2.h +++ b/LEGO1/lego/legoomni/include/legoact2.h @@ -68,15 +68,6 @@ class LegoAct2 : public LegoWorld { void SetUnknown0x1138(Act2Actor* p_unk0x1138) { m_unk0x1138 = p_unk0x1138; } void SetDestLocation(LegoGameState::Area p_destLocation) { m_destLocation = p_destLocation; } - undefined4 FUN_10052560( - MxS32 p_param1, - MxBool p_param2, - MxBool p_param3, - Mx3DPointFloat* p_location, - Mx3DPointFloat* p_direction, - Mx3DPointFloat* p_param6 - ); - // SYNTHETIC: LEGO1 0x1004fe20 // LegoAct2::`scalar deleting destructor' @@ -86,8 +77,19 @@ class LegoAct2 : public LegoWorld { MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param); void PlayMusic(JukeboxScript::Script p_objectId); void FUN_10051900(); + void FUN_10051960(); void InitBricks(); void UninitBricks(); + void FUN_10051ac0(); + MxResult FUN_10052560( + Act2mainScript::Script p_objectId, + MxBool p_param2, + MxBool p_param3, + Mx3DPointFloat* p_location, + Mx3DPointFloat* p_direction, + Mx3DPointFloat* p_param6 + ); + MxResult FUN_10052800(); Act2Brick m_bricks[10]; // 0x00f8 undefined m_unk0x10c0; // 0x10c0 @@ -110,7 +112,7 @@ class LegoAct2 : public LegoWorld { undefined4 m_unk0x1134; // 0x1134 Act2Actor* m_unk0x1138; // 0x1138 undefined m_unk0x113c; // 0x113c - undefined4 m_unk0x1140; // 0x1140 + Act2mainScript::Script m_unk0x1140; // 0x1140 Act2mainScript::Script m_unk0x1144; // 0x1144 undefined m_unk0x1148[0x08]; // 0x1148 LegoGameState::Area m_destLocation; // 0x1150 diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index b43dcb49..f09c8dae 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -157,7 +157,7 @@ class LegoAnimationManager : public MxCore { MxResult ReadModelInfo(LegoFile* p_file, ModelInfo* p_info); void FUN_10060480(LegoChar* p_characterNames[], MxU32 p_numCharacterNames); void FUN_100604d0(MxBool p_unk0x08); - void FUN_100604f0(MxS32 p_objectIds[], undefined4 p_numObjectIds); + void FUN_100604f0(MxS32 p_objectIds[], MxU32 p_numObjectIds); void FUN_10060540(MxBool p_unk0x29); void FUN_10060570(MxBool p_unk0x1a); MxResult StartEntityAction(MxDSAction& p_dsAction, LegoEntity* p_entity); diff --git a/LEGO1/lego/legoomni/include/legocachsound.h b/LEGO1/lego/legoomni/include/legocachsound.h index 196bfb55..59834811 100644 --- a/LEGO1/lego/legoomni/include/legocachsound.h +++ b/LEGO1/lego/legoomni/include/legocachsound.h @@ -44,7 +44,8 @@ class LegoCacheSound : public MxCore { void Stop(); void FUN_10006be0(); void SetDistance(MxS32 p_min, MxS32 p_max); - void Mute(MxBool p_mute); + void MuteSilence(MxBool p_muted); + void MuteStop(MxBool p_mute); // SYNTHETIC: LEGO1 0x10006610 // LegoCacheSound::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/src/actors/act2actor.cpp b/LEGO1/lego/legoomni/src/actors/act2actor.cpp index 36fe47c6..d38ee3d1 100644 --- a/LEGO1/lego/legoomni/src/actors/act2actor.cpp +++ b/LEGO1/lego/legoomni/src/actors/act2actor.cpp @@ -39,12 +39,12 @@ Act2Actor::Act2Actor() m_unk0x28 = 4; m_unk0x2c = 0; m_unk0x30 = 0; - m_unk0x34 = 0; + m_shootAnim = NULL; m_unk0x44 = 0; m_unk0x40 = 1; m_unk0x48 = 0; m_unk0x4c = 0; - m_unk0x38 = 0; + m_unk0x38 = NULL; m_unk0x3c = 0; // Odd: The code says < 10, but there are 11 entries in the array @@ -61,6 +61,23 @@ void Act2Actor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) m_roi->SetVisibility(FALSE); } +// FUNCTION: LEGO1 0x10018980 +// FUNCTION: BETA10 0x1000c963 +void Act2Actor::FUN_10018980() +{ + for (MxS32 i = 0; i < m_animMaps.size(); i++) { + if (m_animMaps[i]->GetUnknown0x00() == -1.0f) { + m_shootAnim = m_animMaps[i]; + } + } + + assert(m_shootAnim); + + m_unk0x38 = SoundManager()->GetCacheSoundManager()->FindSoundByKey("xarrow"); + m_unk0x38->SetDistance(45, 55); + m_roi->SetVisibility(TRUE); +} + // FUNCTION: LEGO1 0x100189f0 // FUNCTION: BETA10 0x1000ca64 MxResult Act2Actor::VTable0x94(LegoPathActor*, MxBool) diff --git a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp index 47e9b98c..c489fb00 100644 --- a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp +++ b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp @@ -253,9 +253,26 @@ void LegoCacheSound::FUN_10006cd0(undefined4, undefined4) { } +// FUNCTION: LEGO1 0x10006ce0 +void LegoCacheSound::MuteSilence(MxBool p_muted) +{ + if (m_muted != p_muted) { + m_muted = p_muted; + + if (m_muted) { + m_dsBuffer->SetVolume(-3000); + } + else { + MxS32 volume = m_volume * SoundManager()->GetVolume() / 100; + MxS32 attenuation = SoundManager()->GetAttenuation(volume); + m_dsBuffer->SetVolume(attenuation); + } + } +} + // FUNCTION: LEGO1 0x10006d40 // FUNCTION: BETA10 0x10066ec8 -void LegoCacheSound::Mute(MxBool p_muted) +void LegoCacheSound::MuteStop(MxBool p_muted) { if (m_muted != p_muted) { m_muted = p_muted; diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 9f8ede5d..1b885e70 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -903,7 +903,7 @@ void LegoAnimationManager::FUN_100604d0(MxBool p_unk0x08) // FUNCTION: LEGO1 0x100604f0 // FUNCTION: BETA10 0x1004137b -void LegoAnimationManager::FUN_100604f0(MxS32 p_objectIds[], undefined4 p_numObjectIds) +void LegoAnimationManager::FUN_100604f0(MxS32 p_objectIds[], MxU32 p_numObjectIds) { for (MxS32 i = 0; i < p_numObjectIds; i++) { for (MxS32 j = 0; j < m_animCount; j++) { diff --git a/LEGO1/lego/legoomni/src/entity/act2brick.cpp b/LEGO1/lego/legoomni/src/entity/act2brick.cpp index 9724f3b4..78be6cf0 100644 --- a/LEGO1/lego/legoomni/src/entity/act2brick.cpp +++ b/LEGO1/lego/legoomni/src/entity/act2brick.cpp @@ -1,6 +1,7 @@ #include "act2brick.h" #include "legocachesoundmanager.h" +#include "legocharactermanager.h" #include "legosoundmanager.h" #include "legoworld.h" #include "misc.h" @@ -32,6 +33,21 @@ Act2Brick::~Act2Brick() TickleManager()->UnregisterClient(this); } +// FUNCTION: LEGO1 0x1007a620 +// FUNCTION: BETA10 0x10012ba2 +void Act2Brick::Remove() +{ + StopWhistleSound(); + CurrentWorld()->Remove(this); + + if (m_roi != NULL) { + CharacterManager()->ReleaseActor(m_roi->GetName()); + m_roi = NULL; + } + + m_unk0x164 = 0; +} + // FUNCTION: LEGO1 0x1007a750 MxResult Act2Brick::VTable0x94(LegoPathActor* p_actor, MxBool) { @@ -108,3 +124,11 @@ void Act2Brick::StopWhistleSound() m_whistleSound = NULL; } } + +// FUNCTION: LEGO1 0x1007aa00 +void Act2Brick::Mute(MxBool p_muted) +{ + if (m_whistleSound != NULL) { + m_whistleSound->MuteSilence(p_muted); + } +} diff --git a/LEGO1/lego/legoomni/src/entity/legoactor.cpp b/LEGO1/lego/legoomni/src/entity/legoactor.cpp index 93f7c94b..413b5171 100644 --- a/LEGO1/lego/legoomni/src/entity/legoactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoactor.cpp @@ -144,6 +144,6 @@ void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) void LegoActor::Mute(MxBool p_muted) { if (m_sound != NULL) { - m_sound->Mute(p_muted); + m_sound->MuteStop(p_muted); } } diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index 7f5d967c..c6699c12 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -9,6 +9,7 @@ #include "legocachesoundmanager.h" #include "legogamestate.h" #include "legoinputmanager.h" +#include "legolocomotionanimpresenter.h" #include "legomain.h" #include "legopathstruct.h" #include "legosoundmanager.h" @@ -20,6 +21,8 @@ #include "mxmisc.h" #include "mxnotificationmanager.h" #include "mxticklemanager.h" +#include "mxtransitionmanager.h" +#include "mxvariabletable.h" #include "scripts.h" #include @@ -28,7 +31,7 @@ DECOMP_SIZE_ASSERT(LegoAct2, 0x1154) DECOMP_SIZE_ASSERT(LegoAct2State, 0x10) // GLOBAL: LEGO1 0x100f4474 -undefined4 g_unk0x100f4474 = 0; +Act2mainScript::Script g_unk0x100f4474 = (Act2mainScript::Script) 0; // GLOBAL: LEGO1 0x100f43f0 // GLOBAL: BETA10 0x101e14a8 @@ -46,6 +49,25 @@ MxS32 g_unk0x100f43f0[] = { // GLOBAL: LEGO1 0x100f4410 LegoChar* g_unk0x100f4410[] = {"bd", "pg", "rd", "sy", "ro", "cl"}; +// GLOBAL: LEGO1 0x100f4428 +MxS32 g_unk0x100f4428[] = { + Act2mainScript::c_snsx07pa_RunAnim, + Act2mainScript::c_snsx12ni_RunAnim, + Act2mainScript::c_snsx15la_RunAnim, + Act2mainScript::c_snsx47cl_RunAnim, + Act2mainScript::c_snsx65pg_RunAnim, + Act2mainScript::c_snsx68pg_RunAnim, + Act2mainScript::c_snsx69rd_RunAnim, + Act2mainScript::c_snsx72sy_RunAnim, + 0, + 0, + 0, + 0 +}; + +// GLOBAL: LEGO1 0x100f4458 +LegoChar* g_unk0x100f4458[] = {"papa", "nick", "laura", "cl", "pg", "rd", "sy"}; + // FUNCTION: LEGO1 0x1004fce0 // FUNCTION: BETA10 0x1003a5a0 LegoAct2::LegoAct2() @@ -59,8 +81,8 @@ LegoAct2::LegoAct2() m_unk0x10c0 = 0; m_unk0x10c1 = 0; m_unk0x1138 = NULL; - m_unk0x1140 = 0; - m_unk0x1144 = Act2mainScript::c__Act2Main; + m_unk0x1140 = (Act2mainScript::Script) 0; + m_unk0x1144 = (Act2mainScript::Script) 0; m_destLocation = LegoGameState::e_undefined; m_music = JukeboxScript::c_MusicTheme1; m_siFile = ""; @@ -175,7 +197,7 @@ MxResult LegoAct2::Tickle() if (g_unk0x100f4474) { if (AnimationManager()->FUN_10064ee0(g_unk0x100f4474)) { FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); - g_unk0x100f4474 = 0; + g_unk0x100f4474 = (Act2mainScript::Script) 0; } } @@ -204,12 +226,12 @@ MxResult LegoAct2::Tickle() distance = DISTSQRD3(pepperPosition, otherPoint); - if (m_unk0x1144 == Act2mainScript::c__Act2Main && distance > 50.0f && pepperPosition[0] > -57.0f) { + if (m_unk0x1144 == (Act2mainScript::Script) 0 && distance > 50.0f && pepperPosition[0] > -57.0f) { FUN_10052560(Act2mainScript::c_Avo906In_PlayWav, FALSE, FALSE, NULL, NULL, NULL); m_unk0x1144 = Act2mainScript::c_Avo906In_PlayWav; } } - else if (m_unk0x10d0 >= 90000 && m_unk0x10d0 % 90000 == 0 && m_unk0x1144 == Act2mainScript::c__Act2Main) { + else if (m_unk0x10d0 >= 90000 && m_unk0x10d0 % 90000 == 0 && m_unk0x1144 == (Act2mainScript::Script) 0) { FUN_10052560(Act2mainScript::c_Avo908In_PlayWav, FALSE, FALSE, NULL, NULL, NULL); m_unk0x1144 = Act2mainScript::c_Avo908In_PlayWav; } @@ -324,10 +346,123 @@ MxLong LegoAct2::Notify(MxParam& p_param) return result; } -// STUB: LEGO1 0x100506f0 +// FUNCTION: LEGO1 0x100506f0 MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param) { - // TODO + if (m_gameState->m_enabled && p_param.GetAction() != NULL) { + MxU32 objectId = p_param.GetAction()->GetObjectId(); + + if (m_unk0x10c4 == 5 && m_unk0x1144 == objectId) { + m_unk0x1144 = (Act2mainScript::Script) 0; + return 0; + } + + if (m_unk0x1140 != objectId) { + return 0; + } + + m_unk0x1140 = (Act2mainScript::Script) 0; + + switch (m_unk0x10c4) { + case 2: + m_unk0x10c4 = 3; + break; + case 4: + FUN_10051960(); + m_unk0x10c4 = 5; + m_unk0x10d0 = 0; + break; + case 6: { + LegoROI* roi; + + roi = FindROI("nick"); + if (roi != NULL) { + roi->SetVisibility(FALSE); + } + + roi = FindROI("laura"); + if (roi != NULL) { + roi->SetVisibility(FALSE); + } + + roi = FindROI("motoni"); + if (roi != NULL) { + roi->SetVisibility(FALSE); + } + + roi = FindROI("motola"); + if (roi != NULL) { + roi->SetVisibility(FALSE); + } + + roi = FindROI("Block01"); + RemoveActor((LegoPathActor*) roi->GetEntity()); + roi->SetVisibility(FALSE); + + roi = FindROI("Block02"); + RemoveActor((LegoPathActor*) roi->GetEntity()); + roi->SetVisibility(FALSE); + + VariableTable()->SetVariable("ACTOR_01", "brickstr"); + FUN_10052800(); + m_unk0x10c4 = 7; + PlayMusic(JukeboxScript::c_BrickstrChase); + break; + } + case 11: + m_bricks[m_unk0x10c0 - 1].Mute(TRUE); + m_unk0x10c4 = 12; + m_unk0x10d0 = 0; + + FUN_10052560(Act2mainScript::c_tra045la_RunAnim, TRUE, TRUE, NULL, NULL, NULL); + ((LegoPathActor*) m_pepper->GetEntity())->SetState(LegoPathActor::c_bit3); + AnimationManager()->EnableCamAnims(TRUE); + AnimationManager()->FUN_1005f6d0(TRUE); + AnimationManager()->FUN_100604f0(g_unk0x100f4428, sizeOfArray(g_unk0x100f4428)); + AnimationManager()->FUN_10060480(g_unk0x100f4458, sizeOfArray(g_unk0x100f4458)); + break; + case 12: { + LegoROI* roi; + + roi = FindROI("nick"); + if (roi != NULL) { + roi->SetVisibility(FALSE); + } + + roi = FindROI("laura"); + if (roi != NULL) { + roi->SetVisibility(FALSE); + } + + roi = FindROI("motoni"); + if (roi != NULL) { + roi->SetVisibility(FALSE); + } + + roi = FindROI("motola"); + if (roi != NULL) { + roi->SetVisibility(FALSE); + } + + m_bricks[m_unk0x10c0 - 1].Mute(FALSE); + m_unk0x10c4 = 13; + FUN_10051ac0(); + PlayMusic(JukeboxScript::c_BrickHunt); + ((LegoPathActor*) m_pepper->GetEntity())->SetState(0); + break; + } + case 14: + for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_bricks); i++) { + m_bricks[i].Remove(); + } + + FUN_10051900(); + m_destLocation = LegoGameState::e_copterbuild; + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + break; + } + } + return 0; } @@ -391,7 +526,7 @@ void LegoAct2::Enable(MxBool p_enable) MxDSAction action; MxEndActionNotificationParam param(c_notificationEndAction, NULL, &action, FALSE); - m_unk0x1140 = 0; + m_unk0x1140 = (Act2mainScript::Script) 0; action.SetObjectId(0); HandleEndAction(param); } @@ -407,13 +542,13 @@ void LegoAct2::Enable(MxBool p_enable) UninitBricks(); DeleteObjects(&m_atomId, Act2mainScript::c_VOhead0_PlayWav, Act2mainScript::c_VOhide_PlayWav); - if (m_unk0x1144 != Act2mainScript::c__Act2Main) { + if (m_unk0x1144 != (Act2mainScript::Script) 0) { MxDSAction action; action.SetAtomId(m_atomId); action.SetUnknown24(-2); action.SetObjectId(m_unk0x1144); DeleteObject(action); - m_unk0x1144 = Act2mainScript::c__Act2Main; + m_unk0x1144 = (Act2mainScript::Script) 0; } TickleManager()->UnregisterClient(this); @@ -453,6 +588,30 @@ void LegoAct2::FUN_10051900() } } +// FUNCTION: LEGO1 0x10051960 +// FUNCTION: BETA10 0x1003bf2c +void LegoAct2::FUN_10051960() +{ + LegoROI* roi; + + roi = FindROI("mama"); + if (roi != NULL) { + roi->SetVisibility(FALSE); + } + + roi = FindROI("papa"); + if (roi != NULL) { + roi->SetVisibility(FALSE); + } + + roi = FindROI("infoman"); + if (roi != NULL) { + roi->SetVisibility(FALSE); + } + + ((LegoPathActor*) m_pepper->GetEntity())->SetState(0); +} + // FUNCTION: LEGO1 0x100519c0 void LegoAct2::VTable0x60() { @@ -500,10 +659,17 @@ void LegoAct2::UninitBricks() } } +// STUB: LEGO1 0x10051ac0 +// STUB: BETA10 0x100138c0 +void LegoAct2::FUN_10051ac0() +{ + // TODO +} + // FUNCTION: LEGO1 0x10052560 // FUNCTION: BETA10 0x100145c6 -undefined4 LegoAct2::FUN_10052560( - MxS32 p_param1, +MxResult LegoAct2::FUN_10052560( + Act2mainScript::Script p_objectId, MxBool p_param2, MxBool p_param3, Mx3DPointFloat* p_location, @@ -511,14 +677,13 @@ undefined4 LegoAct2::FUN_10052560( Mx3DPointFloat* p_param6 ) { - - if (m_unk0x1140 == 0 || p_param3) { + if (m_unk0x1140 == (Act2mainScript::Script) 0 || p_param3) { assert(strlen(m_siFile)); if (!p_param2) { MxDSAction action; - action.SetObjectId(p_param1); + action.SetObjectId(p_objectId); // World index: see LegoOmni::RegisterWorlds action.SetAtomId(*Lego()->GetWorldAtom(15)); @@ -575,19 +740,50 @@ undefined4 LegoAct2::FUN_10052560( MxResult result; - if (p_param1 == Act2mainScript::c_tja009ni_RunAnim) { - result = AnimationManager()->FUN_10060dc0(p_param1, pmatrix, TRUE, FALSE, NULL, TRUE, TRUE, TRUE, TRUE); + if (p_objectId == Act2mainScript::c_tja009ni_RunAnim) { + result = + AnimationManager()->FUN_10060dc0(p_objectId, pmatrix, TRUE, FALSE, NULL, TRUE, TRUE, TRUE, TRUE); } else { result = - AnimationManager()->FUN_10060dc0(p_param1, pmatrix, TRUE, FALSE, NULL, TRUE, TRUE, TRUE, FALSE); + AnimationManager()->FUN_10060dc0(p_objectId, pmatrix, TRUE, FALSE, NULL, TRUE, TRUE, TRUE, FALSE); } if (result == SUCCESS) { - m_unk0x1140 = p_param1; + m_unk0x1140 = p_objectId; } } } - return 0; + return SUCCESS; +} + +// FUNCTION: LEGO1 0x10052800 +// FUNCTION: BETA10 0x10014aa8 +MxResult LegoAct2::FUN_10052800() +{ + LegoPathActor* actor = m_unk0x1138; + LegoLocomotionAnimPresenter* ap; + + PlaceActor(actor, "EDG01_27", 2, 0.5f, 0, 0.5f); + + ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "Ambul_Anim0"); + assert(ap); + ap->FUN_1006d680(m_unk0x1138, 0.0f); + + ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "Ambul_Anim2"); + assert(ap); + ap->FUN_1006d680(m_unk0x1138, 6.0f); + + ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "Ambul_Anim3"); + assert(ap); + ap->FUN_1006d680(m_unk0x1138, 3.0f); + + ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "BrShoot"); + assert(ap); + ap->FUN_1006d680(m_unk0x1138, -1.0f); + + actor->SetWorldSpeed(0.0f); + m_unk0x1138->FUN_10018980(); + return SUCCESS; }