diff --git a/LEGO1/lego/legoomni/include/act2actor.h b/LEGO1/lego/legoomni/include/act2actor.h index c45effeb..897d0615 100644 --- a/LEGO1/lego/legoomni/include/act2actor.h +++ b/LEGO1/lego/legoomni/include/act2actor.h @@ -29,6 +29,7 @@ class Act2Actor : public LegoAnimActor { void FUN_10018980(); void FUN_10019520(); + void FUN_10019560(); void FUN_100192a0(undefined4 p_param); // SYNTHETIC: LEGO1 0x1001a0a0 diff --git a/LEGO1/lego/legoomni/include/act2brick.h b/LEGO1/lego/legoomni/include/act2brick.h index 6035e11d..1ad730f2 100644 --- a/LEGO1/lego/legoomni/include/act2brick.h +++ b/LEGO1/lego/legoomni/include/act2brick.h @@ -31,12 +31,15 @@ class Act2Brick : public LegoPathActor { // SYNTHETIC: LEGO1 0x1007a450 // Act2Brick::`scalar deleting destructor' + MxResult Create(MxS32 p_index); void Remove(); + void FUN_1007a670(MxMatrix& p_param1, MxMatrix& p_param2, LegoPathBoundary* p_boundary); void PlayWhistleSound(); void StopWhistleSound(); void Mute(MxBool p_muted); private: + static LegoChar* g_lodNames[]; static MxLong g_lastHitActorTime; LegoCacheSound* m_whistleSound; // 0x154 diff --git a/LEGO1/lego/legoomni/include/legoact2.h b/LEGO1/lego/legoomni/include/legoact2.h index 3a61d505..588a53b2 100644 --- a/LEGO1/lego/legoomni/include/legoact2.h +++ b/LEGO1/lego/legoomni/include/legoact2.h @@ -81,6 +81,8 @@ class LegoAct2 : public LegoWorld { void InitBricks(); void UninitBricks(); void FUN_10051ac0(); + void FUN_10051fa0(MxS32 p_param1); + void FUN_100521f0(MxS32 p_param1); MxResult FUN_10052560( Act2mainScript::Script p_objectId, MxBool p_param2, @@ -92,7 +94,7 @@ class LegoAct2 : public LegoWorld { MxResult FUN_10052800(); Act2Brick m_bricks[10]; // 0x00f8 - undefined m_unk0x10c0; // 0x10c0 + undefined m_nextBrick; // 0x10c0 undefined m_unk0x10c1; // 0x10c1 MxBool m_ready; // 0x10c2 undefined4 m_unk0x10c4; // 0x10c4 diff --git a/LEGO1/lego/legoomni/src/actors/act2actor.cpp b/LEGO1/lego/legoomni/src/actors/act2actor.cpp index 1ddb4b3d..1bb3e335 100644 --- a/LEGO1/lego/legoomni/src/actors/act2actor.cpp +++ b/LEGO1/lego/legoomni/src/actors/act2actor.cpp @@ -177,6 +177,14 @@ void Act2Actor::FUN_10019520() FUN_100192a0(10); } +// FUNCTION: LEGO1 0x10019560 +void Act2Actor::FUN_10019560() +{ + m_unk0x1e = 5; + SetWorldSpeed(m_unk0x28 + 5); + FUN_100192a0(9); +} + // FUNCTION: LEGO1 0x100195a0 // FUNCTION: BETA10 0x1000d7d3 MxS32 Act2Actor::VTable0xa0() diff --git a/LEGO1/lego/legoomni/src/entity/act2brick.cpp b/LEGO1/lego/legoomni/src/entity/act2brick.cpp index 78be6cf0..a3049c1b 100644 --- a/LEGO1/lego/legoomni/src/entity/act2brick.cpp +++ b/LEGO1/lego/legoomni/src/entity/act2brick.cpp @@ -12,10 +12,15 @@ #include "mxtimer.h" #include "roi/legoroi.h" +#include #include DECOMP_SIZE_ASSERT(Act2Brick, 0x194) +// GLOBAL: LEGO1 0x100f7a38 +LegoChar* Act2Brick::g_lodNames[] = + {"xchbase1", "xchblad1", "xchseat1", "xchtail1", "xhback1", "xhljet1", "xhmidl1", "xhmotr1", "xhsidl1", "xhsidr1"}; + // GLOBAL: LEGO1 0x100f7a60 MxLong Act2Brick::g_lastHitActorTime = 0; @@ -33,6 +38,36 @@ Act2Brick::~Act2Brick() TickleManager()->UnregisterClient(this); } +// FUNCTION: LEGO1 0x1007a4e0 +// FUNCTION: BETA10 0x10012ad5 +MxResult Act2Brick::Create(MxS32 p_index) +{ + if (m_roi != NULL) { + return FAILURE; + } + + char name[12]; + sprintf(name, "chbrick%d", p_index); + + m_roi = CharacterManager()->CreateAutoROI(name, g_lodNames[p_index], FALSE); + + BoundingSphere sphere = m_roi->GetBoundingSphere(); + sphere.Center()[1] -= 0.3; + + if (p_index < 6) { + sphere.Radius() = m_roi->GetBoundingSphere().Radius() * 0.5f; + } + else { + sphere.Radius() = m_roi->GetBoundingSphere().Radius() * 2.0f; + } + + m_roi->SetBoundingSphere(sphere); + m_roi->SetEntity(this); + CurrentWorld()->Add(this); + m_unk0x164 = 1; + return SUCCESS; +} + // FUNCTION: LEGO1 0x1007a620 // FUNCTION: BETA10 0x10012ba2 void Act2Brick::Remove() @@ -48,6 +83,28 @@ void Act2Brick::Remove() m_unk0x164 = 0; } +// FUNCTION: LEGO1 0x1007a670 +// FUNCTION: BETA10 0x10012c04 +void Act2Brick::FUN_1007a670(MxMatrix& p_param1, MxMatrix& p_param2, LegoPathBoundary* p_boundary) +{ + m_unk0x17c = p_param2[3]; + m_unk0x168 = p_param2[3]; + ((Vector3&) m_unk0x168).Sub(p_param1[3]); + ((Vector3&) m_unk0x168).Div(8.0f); + + m_unk0x190 = 0; + TickleManager()->RegisterClient(this, 20); + + m_unk0x164 = 2; + CurrentWorld()->PlaceActor(this); + p_boundary->AddActor(this); + + SetState(LegoPathActor::c_bit3); + m_roi->FUN_100a58f0(p_param1); + m_roi->VTable0x14(); + m_roi->SetVisibility(TRUE); +} + // FUNCTION: LEGO1 0x1007a750 MxResult Act2Brick::VTable0x94(LegoPathActor* p_actor, MxBool) { diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index 9c1eb733..5afe4a83 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -80,7 +80,7 @@ LegoAct2::LegoAct2() m_ambulance = NULL; m_ready = FALSE; m_unk0x1130 = 0; - m_unk0x10c0 = 0; + m_nextBrick = 0; m_unk0x10c1 = 0; m_unk0x1138 = NULL; m_unk0x1140 = (Act2mainScript::Script) 0; @@ -246,7 +246,7 @@ MxResult LegoAct2::Tickle() m_unk0x10d0 += 50; if (m_unk0x10d0 >= 200) { - if (m_unk0x10c0 < 5) { + if (m_nextBrick < 5) { m_unk0x10c4 = 7; } else { @@ -412,7 +412,7 @@ MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param) break; } case 11: - m_bricks[m_unk0x10c0 - 1].Mute(TRUE); + m_bricks[m_nextBrick - 1].Mute(TRUE); m_unk0x10c4 = 12; m_unk0x10d0 = 0; @@ -446,7 +446,7 @@ MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param) roi->SetVisibility(FALSE); } - m_bricks[m_unk0x10c0 - 1].Mute(FALSE); + m_bricks[m_nextBrick - 1].Mute(FALSE); m_unk0x10c4 = 13; FUN_10051ac0(); PlayMusic(JukeboxScript::c_BrickHunt); @@ -552,7 +552,7 @@ void LegoAct2::Enable(MxBool p_enable) PlayMusic(m_music); } - if (m_unk0x10c4 == 10 && m_unk0x10c0 == 6 && m_bricks[5].GetROI() != NULL) { + if (m_unk0x10c4 == 10 && m_nextBrick == 6 && m_bricks[5].GetROI() != NULL) { m_bricks[5].PlayWhistleSound(); } else if (m_unk0x10c4 == 13) { @@ -596,11 +596,66 @@ void LegoAct2::Enable(MxBool p_enable) } } -// STUB: LEGO1 0x10051460 -// STUB: BETA10 0x1003bb72 +// FUNCTION: LEGO1 0x10051460 +// FUNCTION: BETA10 0x1003bb72 MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param) { - // TODO + if (m_unk0x10c4 == 5 && p_param.GetData() == 0x32) { + LegoPathActor* actor = (LegoPathActor*) m_pepper->GetEntity(); + actor->SetState(LegoPathActor::c_bit3); + actor->SetWorldSpeed(0.0f); + FUN_10051900(); + + if (m_unk0x10d0 < 90000) { + FUN_10052560(Act2mainScript::c_tra031ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL); + } + else { + FUN_10052560(Act2mainScript::c_tra032ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL); + } + + m_unk0x112c = 50; + m_unk0x10c4 = 6; + m_unk0x10d0 = 0; + } + else if (m_unk0x10c4 == 5 && p_param.GetData() == 0x2a) { + if (m_unk0x1144 == (Act2mainScript::Script) 0) { + FUN_10052560(Act2mainScript::c_Avo907In_PlayWav, FALSE, FALSE, NULL, NULL, NULL); + m_unk0x1144 = Act2mainScript::c_Avo907In_PlayWav; + } + } + else if (m_unk0x10c4 == 5) { + FUN_100521f0(p_param.GetData()); + } + else if (m_unk0x10c4 == 7) { + FUN_10051fa0(p_param.GetData()); + } + else if (m_unk0x10c4 == 10 && p_param.GetData() == 0x165) { + ((LegoPathActor*) m_pepper->GetEntity())->SetState(LegoPathActor::c_bit3); + + if (FUN_10052560(Act2mainScript::c_VOhide_PlayWav, FALSE, TRUE, NULL, NULL, NULL) == SUCCESS) { + m_unk0x1140 = Act2mainScript::c_VOhide_PlayWav; + } + + m_unk0x1138->FUN_10019560(); + + m_unk0x10c4 = 11; + m_unk0x10d0 = 0; + + if (m_nextBrick < 6) { + m_bricks[m_nextBrick].Create(m_nextBrick); + m_nextBrick++; + } + + MxMatrix local2world = m_ambulance->GetLocal2World(); + MxMatrix local2world2 = local2world; + + LegoPathBoundary* boundary = m_unk0x1138->GetBoundary(); + local2world[3][1] += 1.5; + local2world2[3][1] -= 0.1; + + m_bricks[m_nextBrick - 1].FUN_1007a670(local2world, local2world2, boundary); + } + return 0; } @@ -707,6 +762,20 @@ void LegoAct2::FUN_10051ac0() // TODO } +// STUB: LEGO1 0x10051fa0 +// STUB: BETA10 0x10013fd3 +void LegoAct2::FUN_10051fa0(MxS32 p_param1) +{ + // TODO +} + +// STUB: LEGO1 0x100521f0 +// STUB: BETA10 0x100142f1 +void LegoAct2::FUN_100521f0(MxS32 p_param1) +{ + // TODO +} + // FUNCTION: LEGO1 0x10052560 // FUNCTION: BETA10 0x100145c6 MxResult LegoAct2::FUN_10052560(