diff --git a/LEGO1/lego/legoomni/include/legoact2.h b/LEGO1/lego/legoomni/include/legoact2.h index 42f333e1..1b809287 100644 --- a/LEGO1/lego/legoomni/include/legoact2.h +++ b/LEGO1/lego/legoomni/include/legoact2.h @@ -6,6 +6,8 @@ #include "legoworld.h" class Act2Actor; +class LegoPathStructNotificationParam; +class MxEndActionNotificationParam; // VTABLE: LEGO1 0x100d4a70 // SIZE 0x10 @@ -79,6 +81,9 @@ class LegoAct2 : public LegoWorld { // LegoAct2::`scalar deleting destructor' private: + MxLong HandleEndAction(MxEndActionNotificationParam& p_param); + MxLong HandleTransitionEnd(); + MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param); void FUN_10051900(); Act2Brick m_bricks[10]; // 0x00f8 @@ -96,7 +101,7 @@ class LegoAct2 : public LegoWorld { LegoROI* m_unk0x10d8; // 0x10d8 MxMatrix m_unk0x10dc; // 0x10dc undefined4 m_unk0x1124; // 0x1124 - undefined4 m_unk0x1128; // 0x1128 + LegoROI* m_ambulance; // 0x1128 undefined4 m_unk0x112c; // 0x112c undefined4 m_unk0x1130; // 0x1130 undefined4 m_unk0x1134; // 0x1134 diff --git a/LEGO1/lego/legoomni/src/race/carrace.cpp b/LEGO1/lego/legoomni/src/race/carrace.cpp index 8600fc3e..a3f32780 100644 --- a/LEGO1/lego/legoomni/src/race/carrace.cpp +++ b/LEGO1/lego/legoomni/src/race/carrace.cpp @@ -1,9 +1,9 @@ #include "carrace.h" -#include "actions/carrace_actions.h" -#include "actions/jukebox_actions.h" +#include "carrace_actions.h" #include "dunebuggy.h" #include "isle.h" +#include "jukebox_actions.h" #include "legoanimationmanager.h" #include "legobackgroundcolor.h" #include "legocontrolmanager.h" diff --git a/LEGO1/lego/legoomni/src/race/jetskirace.cpp b/LEGO1/lego/legoomni/src/race/jetskirace.cpp index 65696e5b..e2564e92 100644 --- a/LEGO1/lego/legoomni/src/race/jetskirace.cpp +++ b/LEGO1/lego/legoomni/src/race/jetskirace.cpp @@ -1,10 +1,10 @@ #include "jetskirace.h" -#include "actions/jetrace_actions.h" -#include "actions/jetski_actions.h" -#include "actions/jukebox_actions.h" #include "dunebuggy.h" #include "isle.h" +#include "jetrace_actions.h" +#include "jetski_actions.h" +#include "jukebox_actions.h" #include "legoanimationmanager.h" #include "legocontrolmanager.h" #include "legohideanimpresenter.h" diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index 0038928c..39a4a9a9 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -2,15 +2,19 @@ #include "act2actor.h" #include "act2main_actions.h" -#include "actions/act2main_actions.h" -#include "actions/infomain_actions.h" +#include "infomain_actions.h" #include "islepathactor.h" #include "legoanimationmanager.h" +#include "legocachesoundmanager.h" #include "legogamestate.h" #include "legoinputmanager.h" #include "legomain.h" +#include "legopathstruct.h" +#include "legosoundmanager.h" #include "misc.h" +#include "mxactionnotificationparam.h" #include "mxbackgroundaudiomanager.h" +#include "mxdebug.h" #include "mxmisc.h" #include "mxnotificationmanager.h" #include "mxticklemanager.h" @@ -46,7 +50,7 @@ LegoAct2::LegoAct2() m_unk0x10c4 = 0; m_gameState = NULL; m_unk0x10d8 = NULL; - m_unk0x1128 = 0; + m_ambulance = NULL; m_unk0x10c2 = 0; m_unk0x1130 = 0; m_unk0x10c0 = 0; @@ -238,9 +242,94 @@ MxResult LegoAct2::Tickle() return SUCCESS; } -// STUB: LEGO1 0x10050380 -// STUB: BETA10 0x1003b049 +// FUNCTION: LEGO1 0x10050380 +// FUNCTION: BETA10 0x1003b049 MxLong LegoAct2::Notify(MxParam& p_param) +{ + MxNotificationParam& param = (MxNotificationParam&) p_param; + MxLong result = 0; + + LegoWorld::Notify(p_param); + + if (m_worldStarted) { + switch (param.GetNotification()) { + case c_notificationEndAction: + result = HandleEndAction((MxEndActionNotificationParam&) p_param); + break; + case c_notificationPathStruct: { + MxTrace("trigger %d\n", ((LegoPathStructNotificationParam&) p_param).GetData()); + + LegoPathStructNotificationParam& param = (LegoPathStructNotificationParam&) p_param; + LegoEntity* entity = (LegoEntity*) param.GetSender(); + + if (m_ambulance == NULL) { + m_ambulance = FindROI("ambul"); + } + + if (entity->GetROI() == m_unk0x10d8) { + HandlePathStruct(param); + } + + result = 1; + break; + } + case c_notificationType22: + SoundManager()->GetCacheSoundManager()->Play("28bng", NULL, FALSE); + + m_unk0x10c1++; + if (m_unk0x10c1 == 10 && m_unk0x10c4 == 13) { + m_unk0x10c4 = 14; + + LegoEntity* entity = (LegoEntity*) param.GetSender(); + + Mx3DPointFloat entityPosition(entity->GetROI()->GetWorldPosition()); + Mx3DPointFloat unk0x10d8(m_unk0x10d8->GetWorldPosition()); + Mx3DPointFloat locala4(unk0x10d8); + + ((Vector3&) entityPosition).Sub(unk0x10d8); + + MxMatrix local2world(m_unk0x10d8->GetLocal2World()); + Vector3 local30(local2world[0]); + Vector3 localac(local2world[1]); + Vector3 local28(local2world[2]); + + local28 = entityPosition; + local28.Unitize(); + + Mx3DPointFloat local90(local28); + ((Vector3&) local90).Mul(1.25f); + ((Vector3&) locala4).Add(local90); + locala4[1] += 0.25; + local30.EqualsCross(&localac, &local28); + local30.Unitize(); + + Mx3DPointFloat direction(local2world[2]); + Mx3DPointFloat location(local2world[1]); + FUN_10052560(Act2mainScript::c_tns051in_RunAnim, TRUE, TRUE, &location, &direction, NULL); + + m_unk0x10c4 = 14; + m_unk0x10d0 = 0; + ((LegoPathActor*) m_unk0x10d8->GetEntity())->SetState(LegoPathActor::c_bit3); + } + break; + case c_notificationTransitioned: + result = HandleTransitionEnd(); + break; + } + } + + return result; +} + +// STUB: LEGO1 0x100506f0 +MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param) +{ + // TODO + return 0; +} + +// STUB: LEGO1 0x10050a50 +MxLong LegoAct2::HandleTransitionEnd() { // TODO return 0; @@ -259,6 +348,14 @@ void LegoAct2::Enable(MxBool p_enable) // TODO } +// STUB: LEGO1 0x10051460 +// STUB: BETA10 0x1003bb72 +MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param) +{ + // TODO + return 0; +} + // FUNCTION: LEGO1 0x10051900 // FUNCTION: BETA10 0x1003bed1 void LegoAct2::FUN_10051900() diff --git a/LEGO1/mxgeometry/mxmatrix.h b/LEGO1/mxgeometry/mxmatrix.h index a9249225..55a17da1 100644 --- a/LEGO1/mxgeometry/mxmatrix.h +++ b/LEGO1/mxgeometry/mxmatrix.h @@ -15,6 +15,7 @@ class MxMatrix : public Matrix4 { // FUNCTION: LEGO1 0x10032770 MxMatrix(const MxMatrix& p_matrix) : Matrix4(m_elements) { Equals(p_matrix); } + // FUNCTION: BETA10 0x1000fc20 MxMatrix(const Matrix4& p_matrix) : Matrix4(m_elements) { Equals(p_matrix); } // FUNCTION: BETA10 0x10010860