From aaf5e1ddc7ef70faf5b0c4c8755597c2be760f4b Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 2 Dec 2024 11:44:42 -0700 Subject: [PATCH] Implement/match LegoAct2::ReadyWorld (#1185) --- LEGO1/lego/legoomni/include/legoact2.h | 4 +- .../legoomni/src/common/legogamestate.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/legoact2.cpp | 49 +++++++++++++++++-- 3 files changed, 48 insertions(+), 7 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoact2.h b/LEGO1/lego/legoomni/include/legoact2.h index 8bdccb60..3a61d505 100644 --- a/LEGO1/lego/legoomni/include/legoact2.h +++ b/LEGO1/lego/legoomni/include/legoact2.h @@ -94,14 +94,14 @@ class LegoAct2 : public LegoWorld { Act2Brick m_bricks[10]; // 0x00f8 undefined m_unk0x10c0; // 0x10c0 undefined m_unk0x10c1; // 0x10c1 - undefined m_unk0x10c2; // 0x10c2 + MxBool m_ready; // 0x10c2 undefined4 m_unk0x10c4; // 0x10c4 JukeboxScript::Script m_music; // 0x10c8 LegoAct2State* m_gameState; // 0x10cc MxS32 m_unk0x10d0; // 0x10d0 // variable name verified by BETA10 0x10014633 - char* m_siFile; // 0x10d4 + const char* m_siFile; // 0x10d4 LegoROI* m_pepper; // 0x10d8 MxMatrix m_unk0x10dc; // 0x10dc diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index 6943969b..e8835e82 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -197,7 +197,7 @@ void LegoGameState::SetActor(MxU8 p_actorId) delete oldActor; } - newActor->ClearFlag(0x02); + newActor->ClearFlag(LegoEntity::c_managerOwned); SetUserActor(newActor); } diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index c6699c12..9c1eb733 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -1,5 +1,6 @@ #include "legoact2.h" +#include "3dmanager/lego3dmanager.h" #include "act2actor.h" #include "act2main_actions.h" #include "infomain_actions.h" @@ -14,6 +15,7 @@ #include "legopathstruct.h" #include "legosoundmanager.h" #include "legoutils.h" +#include "legovideomanager.h" #include "misc.h" #include "mxactionnotificationparam.h" #include "mxbackgroundaudiomanager.h" @@ -76,7 +78,7 @@ LegoAct2::LegoAct2() m_gameState = NULL; m_pepper = NULL; m_ambulance = NULL; - m_unk0x10c2 = 0; + m_ready = FALSE; m_unk0x1130 = 0; m_unk0x10c0 = 0; m_unk0x10c1 = 0; @@ -100,7 +102,7 @@ MxBool LegoAct2::VTable0x5c() // FUNCTION: BETA10 0x1003a6f0 LegoAct2::~LegoAct2() { - if (m_unk0x10c2) { + if (m_ready) { TickleManager()->UnregisterClient(this); } @@ -477,10 +479,49 @@ MxLong LegoAct2::HandleTransitionEnd() return 1; } -// STUB: LEGO1 0x10050a80 +// FUNCTION: LEGO1 0x10050a80 void LegoAct2::ReadyWorld() { - // TODO + LegoWorld::ReadyWorld(); + + AnimationManager()->Resume(); + TickleManager()->RegisterClient(this, 20); + + m_ready = TRUE; + m_siFile = VariableTable()->GetVariable("ACT2_ANIMS_FILE"); + + GameState()->SetActor(LegoActor::c_pepper); + m_pepper = FindROI("pepper"); + IslePathActor* pepper = (IslePathActor*) m_pepper->GetEntity(); + pepper->SpawnPlayer( + LegoGameState::e_unk50, + TRUE, + IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 + ); + + LegoROI* roi = FindROI("Block01"); + BoundingSphere sphere = roi->GetBoundingSphere(); + sphere.Radius() *= 1.5; + roi->SetBoundingSphere(sphere); + LegoPathActor* actor = (LegoPathActor*) roi->GetEntity(); + PlaceActor(actor, "EDG01_04", 1, 0.5f, 3, 0.5f); + + MxMatrix local2world = roi->GetLocal2World(); + local2world[3][0] -= 1.5; + roi->FUN_100a58f0(local2world); + roi->VTable0x14(); + + roi = FindROI("Block02"); + sphere = roi->GetBoundingSphere(); + sphere.Radius() *= 1.5; + roi->SetBoundingSphere(sphere); + actor = (LegoPathActor*) roi->GetEntity(); + PlaceActor(actor, "EDG00_149", 0, 0.5f, 2, 0.5f); + + PlayMusic(JukeboxScript::c_Jail_Music); + FUN_10051900(); + VideoManager()->Get3DManager()->SetFrustrum(90.0f, 0.1f, 250.f); + m_gameState->m_enabled = TRUE; } // FUNCTION: LEGO1 0x10050cf0