diff --git a/LEGO1/lego/legoomni/include/act3.h b/LEGO1/lego/legoomni/include/act3.h index dca00a41..4b6e86ac 100644 --- a/LEGO1/lego/legoomni/include/act3.h +++ b/LEGO1/lego/legoomni/include/act3.h @@ -125,8 +125,7 @@ class Act3 : public LegoWorld { void SetBrickster(Act3Brickster* p_brickster); void FUN_10073400(); void FUN_10073430(); - void GoodEnding(const Matrix4& p_matrix); - static void DebugPrintf(const char* p_format, ...); + void GoodEnding(const Matrix4& p_destination); // BETA indicates that the actors access certain members directly. friend class Act3Brickster; @@ -136,6 +135,15 @@ class Act3 : public LegoWorld { protected: MxLong HandleTransitionEnd(); + static void DebugPrintf(const char* p_format, ...); + static void DebugCopter( + const Matrix4& p_copter, + const Matrix4& p_destination, + const Matrix4& p_startPosition, + const Matrix4& p_endPosition, + const UnknownMx4DPointFloat& p_unk0x1f4 + ); + Act3State* m_state; // 0xf8 Act3Ammo m_pizzas[MAX_PIZZAS]; // 0xfc Act3Ammo m_donuts[MAX_DONUTS]; // 0x217c diff --git a/LEGO1/lego/legoomni/include/helicopter.h b/LEGO1/lego/legoomni/include/helicopter.h index 1044dae2..dddf3935 100644 --- a/LEGO1/lego/legoomni/include/helicopter.h +++ b/LEGO1/lego/legoomni/include/helicopter.h @@ -76,6 +76,7 @@ class Helicopter : public IslePathActor { void Exit() override; // vtable+0xe4 void CreateState(); + void FUN_10004640(const Matrix4& p_matrix); // SYNTHETIC: LEGO1 0x10003210 // Helicopter::`scalar deleting destructor' @@ -84,6 +85,8 @@ class Helicopter : public IslePathActor { friend class Act3; protected: + void FUN_100042a0(const Matrix4& p_matrix); + MxMatrix m_unk0x160; // 0x160 MxMatrix m_unk0x1a8; // 0x1a8 float m_unk0x1f0; // 0x1f0 diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index c7ddfbeb..fa648723 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -24,7 +24,7 @@ class LegoPathActor : public LegoActor { public: enum { c_bit2 = 0x02, - c_bit3 = 0x04, + c_disable = 0x04, c_bit9 = 0x100 }; diff --git a/LEGO1/lego/legoomni/src/actors/act3actors.cpp b/LEGO1/lego/legoomni/src/actors/act3actors.cpp index c6a8d885..7c6ea6db 100644 --- a/LEGO1/lego/legoomni/src/actors/act3actors.cpp +++ b/LEGO1/lego/legoomni/src/actors/act3actors.cpp @@ -108,7 +108,7 @@ Act3Cop::Act3Cop() { m_unk0x20 = -1.0f; m_world = NULL; - SetState(c_bit3); + SetState(c_disable); } // FUNCTION: LEGO1 0x1003ff70 @@ -194,7 +194,7 @@ Act3Brickster::Act3Brickster() m_unk0x24 = 0.0f; m_unk0x54 = 0; - SetState(c_bit3); + SetState(c_disable); m_unk0x58 = 0; m_unk0x3c.Clear(); diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index b7942dad..a12aa259 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -134,7 +134,7 @@ MxLong Helicopter::HandleClick() ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_copter); FUN_10015820(TRUE, 0); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, TRUE); - SetState(LegoPathActor::c_bit3); + SetState(LegoPathActor::c_disable); PlayMusic(JukeboxScript::c_Jail_Music); break; case LegoGameState::e_act2: @@ -214,7 +214,7 @@ MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param) m_state->m_unk0x08 = 3; m_world->RemoveActor(this); InvokeAction(Extra::ActionType::e_start, script, IsleScript::c_HelicopterLand_Anim, NULL); - SetState(LegoPathActor::c_bit3); + SetState(LegoPathActor::c_disable); } result = 1; @@ -423,3 +423,18 @@ void Helicopter::VTable0x70(float p_time) } } } + +// STUB: LEGO1 0x100042a0 +void Helicopter::FUN_100042a0(const Matrix4& p_matrix) +{ + // TODO +} + +// FUNCTION: LEGO1 0x10004640 +void Helicopter::FUN_10004640(const Matrix4& p_matrix) +{ + if (m_state->m_unk0x08 != 4 && m_state->m_unk0x08 != 5) { + m_state->m_unk0x08 = 4; + FUN_100042a0(p_matrix); + } +} diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 6b5d2d78..e3fffb79 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1028,7 +1028,7 @@ MxResult LegoAnimationManager::FUN_100605e0( LegoPathActor* actor = UserActor(); if (actor != NULL) { - actor->SetState(LegoPathActor::c_bit3); + actor->SetState(LegoPathActor::c_disable); actor->SetWorldSpeed(0.0f); } } @@ -2786,7 +2786,7 @@ void LegoAnimationManager::FUN_100648f0(LegoTranInfo* p_tranInfo, MxLong p_unk0x LegoPathActor* actor = UserActor(); if (actor != NULL) { - actor->SetState(LegoPathActor::c_bit3); + actor->SetState(LegoPathActor::c_disable); actor->SetWorldSpeed(0.0f); } diff --git a/LEGO1/lego/legoomni/src/entity/act2brick.cpp b/LEGO1/lego/legoomni/src/entity/act2brick.cpp index 4ffac19c..f54747e0 100644 --- a/LEGO1/lego/legoomni/src/entity/act2brick.cpp +++ b/LEGO1/lego/legoomni/src/entity/act2brick.cpp @@ -100,7 +100,7 @@ void Act2Brick::FUN_1007a670(MxMatrix& p_param1, MxMatrix& p_param2, LegoPathBou CurrentWorld()->PlaceActor(this); p_boundary->AddActor(this); - SetState(LegoPathActor::c_bit3); + SetState(LegoPathActor::c_disable); m_roi->FUN_100a58f0(p_param1); m_roi->VTable0x14(); m_roi->SetVisibility(TRUE); diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index eede5de5..f51958b7 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -366,7 +366,7 @@ void LegoPathController::FUN_10046970() LegoPathActor* actor = *itpa; if (m_actors.find(actor) != m_actors.end()) { - if (!((MxU8) actor->GetState() & LegoPathActor::c_bit3)) { + if (!((MxU8) actor->GetState() & LegoPathActor::c_disable)) { actor->VTable0x70(time); } } diff --git a/LEGO1/lego/legoomni/src/worlds/act3.cpp b/LEGO1/lego/legoomni/src/worlds/act3.cpp index 3cfa4cf7..d862d2aa 100644 --- a/LEGO1/lego/legoomni/src/worlds/act3.cpp +++ b/LEGO1/lego/legoomni/src/worlds/act3.cpp @@ -23,6 +23,8 @@ #include "mxtransitionmanager.h" #include "scripts.h" +#include + DECOMP_SIZE_ASSERT(Act3, 0x4274) DECOMP_SIZE_ASSERT(Act3State, 0x0c) DECOMP_SIZE_ASSERT(Act3ListElement, 0x0c) @@ -584,12 +586,27 @@ void Act3::FUN_10073430() TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); } -// STUB: LEGO1 0x10073460 -// STUB: BETA10 0x10016bc6 -void Act3::GoodEnding(const Matrix4& p_matrix) +// FUNCTION: LEGO1 0x10073460 +// FUNCTION: BETA10 0x10016bc6 +void Act3::GoodEnding(const Matrix4& p_destination) { - // TODO + assert(m_cop1 && m_cop2 && m_brickster && m_state); + + m_cop1->SetState(LegoPathActor::c_disable); + m_cop2->SetState(LegoPathActor::c_disable); + m_brickster->SetState(LegoPathActor::c_disable); + + m_unk0x4220.Clear(); + m_copter->FUN_10004640(p_destination); + DebugPrintf("In Good Ending..."); + DebugCopter( + m_copter->GetROI()->GetLocal2World(), + p_destination, + m_copter->m_unk0x160, + m_copter->m_unk0x1a8, + m_copter->m_unk0x1f4 + ); } // FUNCTION: LEGO1 0x10073500 @@ -598,6 +615,58 @@ void Act3::DebugPrintf(const char* p_format, ...) // empty } +// FUNCTION: LEGO1 0x10073510 +void Act3::DebugCopter( + const Matrix4& p_copter, + const Matrix4& p_destination, + const Matrix4& p_startPosition, + const Matrix4& p_endPosition, + const UnknownMx4DPointFloat& p_unk0x1f4 +) +{ + DebugPrintf("Copter matrix...\n\n"); + + // STRING: LEGO1 0x100f78e0 + DebugPrintf("\t%g, %g, %g, %g", EXPAND4(p_copter[0])); + DebugPrintf("\t%g, %g, %g, %g", EXPAND4(p_copter[1])); + DebugPrintf("\t%g, %g, %g, %g", EXPAND4(p_copter[2])); + // STRING: LEGO1 0x100f78cc + DebugPrintf("\t%g, %g, %g, %g\n\n", EXPAND4(p_copter[3])); + + DebugPrintf("Destination matrix..."); + DebugPrintf("\t%g, %g, %g, %g", EXPAND4(p_destination[0])); + DebugPrintf("\t%g, %g, %g, %g", EXPAND4(p_destination[1])); + DebugPrintf("\t%g, %g, %g, %g", EXPAND4(p_destination[2])); + DebugPrintf("\t%g, %g, %g, %g\n\n", EXPAND4(p_destination[3])); + + DebugPrintf("Start position..."); + DebugPrintf("\t%g, %g, %g, %g", EXPAND4(p_startPosition[0])); + DebugPrintf("\t%g, %g, %g, %g", EXPAND4(p_startPosition[1])); + DebugPrintf("\t%g, %g, %g, %g", EXPAND4(p_startPosition[2])); + DebugPrintf("\t%g, %g, %g, %g\n\n", EXPAND4(p_startPosition[3])); + + DebugPrintf("End position..."); + DebugPrintf("\t%g, %g, %g, %g", EXPAND4(p_endPosition[0])); + DebugPrintf("\t%g, %g, %g, %g", EXPAND4(p_endPosition[1])); + DebugPrintf("\t%g, %g, %g, %g", EXPAND4(p_endPosition[2])); + DebugPrintf("\t%g, %g, %g, %g\n\n", EXPAND4(p_endPosition[3])); + + Mx4DPointFloat unk0x00, unk0x18; + + if (p_unk0x1f4.GetUnknown0x30() != 0) { + // TODO: Match + unk0x00 = p_unk0x1f4.GetUnknown0x00(); + unk0x18 = p_unk0x1f4.GetUnknown0x18(); + + DebugPrintf("Source quaternion..."); + // STRING: LEGO1 0x100f7864 + DebugPrintf("\t%g, %g, %g, %g\n", EXPAND4(unk0x00)); + + DebugPrintf("Destination quaternion..."); + DebugPrintf("\t%g, %g, %g, %g\n", EXPAND4(unk0x18)); + } +} + // FUNCTION: LEGO1 0x10073a90 void Act3::Enable(MxBool p_enable) { diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index ac8bd647..1620d280 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -177,7 +177,7 @@ MxResult LegoAct2::Tickle() m_unk0x10c4 = 1; break; case 1: - ((LegoPathActor*) m_pepper->GetEntity())->SetState(LegoPathActor::c_bit3); + ((LegoPathActor*) m_pepper->GetEntity())->SetState(LegoPathActor::c_disable); switch (rand() % 3) { case 0: @@ -336,7 +336,7 @@ MxLong LegoAct2::Notify(MxParam& p_param) m_unk0x10c4 = 14; m_unk0x10d0 = 0; - ((LegoPathActor*) m_pepper->GetEntity())->SetState(LegoPathActor::c_bit3); + ((LegoPathActor*) m_pepper->GetEntity())->SetState(LegoPathActor::c_disable); } break; case c_notificationTransitioned: @@ -417,7 +417,7 @@ MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param) m_unk0x10d0 = 0; FUN_10052560(Act2mainScript::c_tra045la_RunAnim, TRUE, TRUE, NULL, NULL, NULL); - ((LegoPathActor*) m_pepper->GetEntity())->SetState(LegoPathActor::c_bit3); + ((LegoPathActor*) m_pepper->GetEntity())->SetState(LegoPathActor::c_disable); AnimationManager()->EnableCamAnims(TRUE); AnimationManager()->FUN_1005f6d0(TRUE); AnimationManager()->FUN_100604f0(g_unk0x100f4428, sizeOfArray(g_unk0x100f4428)); @@ -602,7 +602,7 @@ MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param) { if (m_unk0x10c4 == 5 && p_param.GetData() == 0x32) { LegoPathActor* actor = (LegoPathActor*) m_pepper->GetEntity(); - actor->SetState(LegoPathActor::c_bit3); + actor->SetState(LegoPathActor::c_disable); actor->SetWorldSpeed(0.0f); FUN_10051900(); @@ -630,7 +630,7 @@ MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param) FUN_10051fa0(p_param.GetData()); } else if (m_unk0x10c4 == 10 && p_param.GetData() == 0x165) { - ((LegoPathActor*) m_pepper->GetEntity())->SetState(LegoPathActor::c_bit3); + ((LegoPathActor*) m_pepper->GetEntity())->SetState(LegoPathActor::c_disable); if (FUN_10052560(Act2mainScript::c_VOhide_PlayWav, FALSE, TRUE, NULL, NULL, NULL) == SUCCESS) { m_unk0x1140 = Act2mainScript::c_VOhide_PlayWav; @@ -937,7 +937,7 @@ MxResult LegoAct2::BadEnding() } LegoPathActor* actor = m_unk0x1138; - actor->SetState(LegoPathActor::c_bit3); + actor->SetState(LegoPathActor::c_disable); m_gameState->SetUnknown0x08(104); m_destLocation = LegoGameState::e_infomain; diff --git a/LEGO1/mxgeometry/mxgeometry3d.h b/LEGO1/mxgeometry/mxgeometry3d.h index d3deb523..d7a87447 100644 --- a/LEGO1/mxgeometry/mxgeometry3d.h +++ b/LEGO1/mxgeometry/mxgeometry3d.h @@ -131,6 +131,10 @@ class UnknownMx4DPointFloat { m_unk0x30 |= c_bit2; } + const Vector4& GetUnknown0x00() const { return m_unk0x00; } + const Vector4& GetUnknown0x18() const { return m_unk0x18; } + undefined4 GetUnknown0x30() const { return m_unk0x30; } + inline int Unknown6(Matrix4& p_matrix, float p_f); inline void Unknown7();