From bbc304ce46458a00b2f63f4180fceabde12ace10 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Thu, 13 Jun 2024 14:10:19 -0400 Subject: [PATCH] Implement/match Ambulance::HandlePathStruct (#1029) * Implement/match Ambulance::HandlePathStruct * Add annotation --- LEGO1/lego/legoomni/include/ambulance.h | 103 +++++++++---- LEGO1/lego/legoomni/include/carrace.h | 14 +- LEGO1/lego/legoomni/include/dunebuggy.h | 12 +- LEGO1/lego/legoomni/include/isle.h | 4 +- LEGO1/lego/legoomni/include/islepathactor.h | 4 +- LEGO1/lego/legoomni/include/jetskirace.h | 12 +- LEGO1/lego/legoomni/include/legopathstruct.h | 33 ++++ LEGO1/lego/legoomni/include/legorace.h | 16 +- LEGO1/lego/legoomni/include/legostate.h | 7 + LEGO1/lego/legoomni/include/motocycle.h | 12 +- LEGO1/lego/legoomni/include/pizza.h | 4 +- LEGO1/lego/legoomni/include/towtrack.h | 38 ++--- LEGO1/lego/legoomni/src/actors/ambulance.cpp | 144 +++++++++++++++--- .../legoomni/src/actors/buildingentity.cpp | 2 +- LEGO1/lego/legoomni/src/actors/dunebuggy.cpp | 2 +- LEGO1/lego/legoomni/src/actors/isleactor.cpp | 2 +- .../legoomni/src/actors/islepathactor.cpp | 18 +-- .../legoomni/src/actors/jukeboxentity.cpp | 2 +- LEGO1/lego/legoomni/src/actors/motorcycle.cpp | 2 +- LEGO1/lego/legoomni/src/actors/radio.cpp | 2 +- LEGO1/lego/legoomni/src/actors/towtrack.cpp | 2 +- .../src/common/legoanimationmanager.cpp | 4 +- .../src/common/legoanimmmpresenter.cpp | 2 +- LEGO1/lego/legoomni/src/common/legoutils.cpp | 4 +- .../src/common/mxcontrolpresenter.cpp | 6 +- .../src/control/legocontrolmanager.cpp | 11 +- .../legoomni/src/entity/act2policestation.cpp | 2 +- .../legoomni/src/entity/legonavcontroller.cpp | 2 +- .../legoomni/src/input/legoinputmanager.cpp | 26 ++-- LEGO1/lego/legoomni/src/main/legomain.cpp | 2 +- .../legoomni/src/paths/legopathstruct.cpp | 8 +- LEGO1/lego/legoomni/src/race/carrace.cpp | 2 +- LEGO1/lego/legoomni/src/race/jetskirace.cpp | 2 +- LEGO1/lego/legoomni/src/race/legorace.cpp | 6 +- .../legoomni/src/worlds/elevatorbottom.cpp | 2 +- .../legoomni/src/worlds/infocenterdoor.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 11 +- .../legoomni/src/worlds/registrationbook.cpp | 4 +- LEGO1/lego/legoomni/src/worlds/score.cpp | 18 +-- LEGO1/omni/include/mxnotificationparam.h | 7 +- .../omni/include/mxtype19notificationparam.h | 39 ----- 41 files changed, 371 insertions(+), 224 deletions(-) delete mode 100644 LEGO1/omni/include/mxtype19notificationparam.h diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index f8213c90..70577f3a 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -27,39 +27,76 @@ class AmbulanceMissionState : public LegoState { MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - inline MxU16 GetScore(MxU8 p_id) + inline MxS16 GetHighScore(MxU8 p_actorId) { - switch (p_id) { - case 1: - return m_score1; - case 2: - return m_score2; - case 3: - return m_score3; - case 4: - return m_score4; - case 5: - return m_score5; + switch (p_actorId) { + case LegoActor::c_pepper: + return m_peHighScore; + case LegoActor::c_mama: + return m_maHighScore; + case LegoActor::c_papa: + return m_paHighScore; + case LegoActor::c_nick: + return m_niHighScore; + case LegoActor::c_laura: + return m_laHighScore; default: return 0; } } + // FUNCTION: BETA10 0x100242d0 + inline void UpdateScore(ScoreColor p_score, MxS16 p_actorId) + { + switch (p_actorId) { + case LegoActor::c_pepper: + m_peScore = p_score; + if (m_peHighScore < p_score) { + m_peHighScore = p_score; + } + break; + case LegoActor::c_mama: + m_maScore = p_score; + if (m_maHighScore < p_score) { + m_maHighScore = p_score; + } + break; + case LegoActor::c_papa: + m_paScore = p_score; + if (m_paHighScore < p_score) { + m_paHighScore = p_score; + } + break; + case LegoActor::c_nick: + m_niScore = p_score; + if (m_niHighScore < p_score) { + m_niHighScore = p_score; + } + break; + case LegoActor::c_laura: + m_laScore = p_score; + if (m_laHighScore < p_score) { + m_laHighScore = p_score; + } + break; + } + } + // SYNTHETIC: LEGO1 0x100376c0 // AmbulanceMissionState::`scalar deleting destructor' undefined4 m_unk0x08; // 0x08 MxLong m_unk0x0c; // 0x0c - MxU16 m_unk0x10; // 0x10 - MxU16 m_unk0x12; // 0x12 - MxU16 m_unk0x14; // 0x14 - MxU16 m_unk0x16; // 0x16 - MxU16 m_unk0x18; // 0x18 - MxU16 m_score1; // 0x1a - MxU16 m_score2; // 0x1c - MxU16 m_score3; // 0x1e - MxU16 m_score4; // 0x20 - MxU16 m_score5; // 0x22 + MxS16 m_peScore; // 0x10 + MxS16 m_maScore; // 0x12 + MxS16 m_paScore; // 0x14 + MxS16 m_niScore; // 0x16 + MxS16 m_laScore; // 0x18 + MxS16 m_peHighScore; // 0x1a + MxS16 m_maHighScore; // 0x1c + MxS16 m_paHighScore; // 0x1e + MxS16 m_niHighScore; // 0x20 + MxS16 m_laHighScore; // 0x22 }; // VTABLE: LEGO1 0x100d71a8 @@ -85,15 +122,15 @@ class Ambulance : public IslePathActor { return !strcmp(p_name, Ambulance::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c - void VTable0x70(float p_time) override; // vtable+0x70 - MxLong HandleClick() override; // vtable+0xcc - MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - MxLong HandleNotification19(MxType19NotificationParam& p_param) override; // vtable+0xdc - void Exit() override; // vtable+0xe4 - virtual MxLong HandleButtonDown(LegoControlManagerEvent& p_param); // vtable+0xf0 - virtual MxLong HandleEndAction(MxEndActionNotificationParam& p_param); // vtable+0xf4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c + void VTable0x70(float p_time) override; // vtable+0x70 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxLong HandlePathStruct(LegoPathStructEvent& p_param) override; // vtable+0xdc + void Exit() override; // vtable+0xe4 + virtual MxLong HandleButtonDown(LegoControlManagerEvent& p_param); // vtable+0xf0 + virtual MxLong HandleEndAction(MxEndActionNotificationParam& p_param); // vtable+0xf4 void CreateState(); void FUN_10036e60(); @@ -106,13 +143,15 @@ class Ambulance : public IslePathActor { private: void PlayAnimation(IsleScript::Script p_objectId); + void PlayFinalAnimation(IsleScript::Script p_objectId); void StopAction(IsleScript::Script p_objectId); void PlayAction(IsleScript::Script p_objectId); + void FUN_10036ec0(); undefined m_unk0x160[4]; // 0x160 AmbulanceMissionState* m_state; // 0x164 MxS16 m_unk0x168; // 0x168 - MxS16 m_unk0x16a; // 0x16a + MxS16 m_actorId; // 0x16a MxS16 m_unk0x16c; // 0x16c MxS16 m_unk0x16e; // 0x16e MxS16 m_unk0x170; // 0x170 diff --git a/LEGO1/lego/legoomni/include/carrace.h b/LEGO1/lego/legoomni/include/carrace.h index 30b2cf76..2c67e11a 100644 --- a/LEGO1/lego/legoomni/include/carrace.h +++ b/LEGO1/lego/legoomni/include/carrace.h @@ -44,13 +44,13 @@ class CarRace : public LegoRace { return !strcmp(p_name, CarRace::ClassName()) || LegoRace::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void ReadyWorld() override; // vtable+0x50 - MxBool Escape() override; // vtable+0x64 - MxLong HandleClick(LegoEventNotificationParam&) override; // vtable+0x6c - MxLong HandleType19Notification(MxType19NotificationParam&) override; // vtable+0x70 - MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74 - MxLong HandleType0Notification(MxNotificationParam&) override; // vtable+0x78 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void ReadyWorld() override; // vtable+0x50 + MxBool Escape() override; // vtable+0x64 + MxLong HandleClick(LegoEventNotificationParam&) override; // vtable+0x6c + MxLong HandlePathStruct(LegoPathStructEvent&) override; // vtable+0x70 + MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74 + MxLong HandleType0Notification(MxNotificationParam&) override; // vtable+0x78 // SYNTHETIC: LEGO1 0x10016c70 // CarRace::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/dunebuggy.h b/LEGO1/lego/legoomni/include/dunebuggy.h index 662d90ef..1fe1d00e 100644 --- a/LEGO1/lego/legoomni/include/dunebuggy.h +++ b/LEGO1/lego/legoomni/include/dunebuggy.h @@ -23,12 +23,12 @@ class DuneBuggy : public IslePathActor { return !strcmp(p_name, DuneBuggy::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void VTable0x70(float p_float) override; // vtable+0x70 - MxLong HandleClick() override; // vtable+0xcc - MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - MxLong HandleNotification19(MxType19NotificationParam& p_param) override; // vtable+0xdc - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxLong HandlePathStruct(LegoPathStructEvent& p_param) override; // vtable+0xdc + void Exit() override; // vtable+0xe4 void FUN_10068350(); diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index 8af16007..ee7a6363 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -15,7 +15,7 @@ class Jetski; class JukeBoxEntity; class LegoNamedTexture; class Motocycle; -class MxType19NotificationParam; +class LegoPathStructEvent; class Pizza; class Pizzeria; class RaceCar; @@ -199,7 +199,7 @@ class Isle : public LegoWorld { protected: MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleControl(LegoControlManagerEvent& p_param); - MxLong HandleType19Notification(MxType19NotificationParam& p_param); + MxLong HandlePathStruct(LegoPathStructEvent& p_param); MxLong HandleTransitionEnd(); void HandleElevatorEndAction(); void UpdateGlobe(); diff --git a/LEGO1/lego/legoomni/include/islepathactor.h b/LEGO1/lego/legoomni/include/islepathactor.h index b5836ec9..37b750d3 100644 --- a/LEGO1/lego/legoomni/include/islepathactor.h +++ b/LEGO1/lego/legoomni/include/islepathactor.h @@ -9,7 +9,7 @@ class LegoControlManagerEvent; class LegoEndAnimNotificationParam; class LegoWorld; -class MxType19NotificationParam; +class LegoPathStructEvent; // VTABLE: LEGO1 0x100d4398 // SIZE 0x160 @@ -119,7 +119,7 @@ class IslePathActor : public LegoPathActor { virtual MxLong HandleEndAnim(LegoEndAnimNotificationParam&) { return 0; } // vtable+0xd8 // FUNCTION: LEGO1 0x10002e00 - virtual MxLong HandleNotification19(MxType19NotificationParam&) { return 0; } // vtable+0xdc + virtual MxLong HandlePathStruct(LegoPathStructEvent&) { return 0; } // vtable+0xdc virtual void Enter(); // vtable+0xe0 virtual void Exit(); // vtable+0xe4 diff --git a/LEGO1/lego/legoomni/include/jetskirace.h b/LEGO1/lego/legoomni/include/jetskirace.h index 1fe28293..0d45fc4f 100644 --- a/LEGO1/lego/legoomni/include/jetskirace.h +++ b/LEGO1/lego/legoomni/include/jetskirace.h @@ -48,12 +48,12 @@ class JetskiRace : public LegoRace { return !strcmp(p_name, JetskiRace::ClassName()) || LegoRace::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void ReadyWorld() override; // vtable+0x50 - MxBool Escape() override; // vtable+0x64 - MxLong HandleClick(LegoEventNotificationParam&) override; // vtable+0x6c - MxLong HandleType19Notification(MxType19NotificationParam&) override; // vtable+0x70 - MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void ReadyWorld() override; // vtable+0x50 + MxBool Escape() override; // vtable+0x64 + MxLong HandleClick(LegoEventNotificationParam&) override; // vtable+0x6c + MxLong HandlePathStruct(LegoPathStructEvent&) override; // vtable+0x70 + MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74 }; // SYNTHETIC: LEGO1 0x1000f530 diff --git a/LEGO1/lego/legoomni/include/legopathstruct.h b/LEGO1/lego/legoomni/include/legopathstruct.h index 062da938..35307529 100644 --- a/LEGO1/lego/legoomni/include/legopathstruct.h +++ b/LEGO1/lego/legoomni/include/legopathstruct.h @@ -3,11 +3,38 @@ #include "decomp.h" #include "mxatom.h" +#include "mxnotificationparam.h" #include "mxtypes.h" class LegoPathActor; class LegoWorld; +// VTABLE: LEGO1 0x100d6230 +// SIZE 0x10 +class LegoPathStructEvent : public MxNotificationParam { +public: + LegoPathStructEvent(NotificationId p_type, MxCore* p_sender, MxU8 p_trigger, MxS16 p_data) : MxNotificationParam() + { + m_type = p_type; + m_sender = p_sender; + m_data = p_data; + m_trigger = p_trigger; + } + + // FUNCTION: LEGO1 0x1001bac0 + MxNotificationParam* Clone() const override + { + return new LegoPathStructEvent(m_type, m_sender, m_trigger, m_data); + } // vtable+0x04 + + inline MxU8 GetTrigger() { return m_trigger; } + inline MxS16 GetData() { return m_data; } + +protected: + MxS16 m_data; // 0x0c + MxU8 m_trigger; // 0x0e +}; + // VTABLE: LEGO1 0x100d7d9c // SIZE 0x0c struct LegoPathStructBase { @@ -71,6 +98,12 @@ class LegoPathStruct : public LegoPathStructBase { MxAtomId m_atomId; // 0x10 }; +// SYNTHETIC: LEGO1 0x1001bb80 +// LegoPathStructEvent::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x1001bbf0 +// LegoPathStructEvent::~LegoPathStructEvent + // SYNTHETIC: LEGO1 0x10047440 // LegoPathStructBase::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legorace.h b/LEGO1/lego/legoomni/include/legorace.h index 3d41633d..101c3ec3 100644 --- a/LEGO1/lego/legoomni/include/legorace.h +++ b/LEGO1/lego/legoomni/include/legorace.h @@ -13,7 +13,7 @@ class LegoEventNotificationParam; class LegoPathActor; class MxEndActionNotificationParam; class MxNotificationParam; -class MxType19NotificationParam; +class LegoPathStructEvent; // VTABLE: LEGO1 0x100d5e30 // SIZE 0x2c @@ -23,12 +23,12 @@ class RaceState : public LegoState { struct Entry { public: inline MxS16 GetUnknown0x02() { return m_unk0x02; } - inline MxU16 GetScore() { return m_score; } + inline MxS16 GetHighScore() { return m_score; } // TODO: Possibly private MxU8 m_id; // 0x00 MxS16 m_unk0x02; // 0x02 - MxU16 m_score; // 0x04 + MxS16 m_score; // 0x04 }; RaceState(); @@ -98,11 +98,11 @@ class LegoRace : public LegoWorld { // FUNCTION: LEGO1 0x1000dae0 MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c - MxBool Escape() override; // vtable+0x64 - void Enable(MxBool p_enable) override; // vtable+0x68 - virtual MxLong HandleClick(LegoEventNotificationParam&) = 0; // vtable+0x6c - virtual MxLong HandleType19Notification(MxType19NotificationParam&); // vtable+0x70 - virtual MxLong HandleEndAction(MxEndActionNotificationParam&); // vtable+0x74 + MxBool Escape() override; // vtable+0x64 + void Enable(MxBool p_enable) override; // vtable+0x68 + virtual MxLong HandleClick(LegoEventNotificationParam&) = 0; // vtable+0x6c + virtual MxLong HandlePathStruct(LegoPathStructEvent&); // vtable+0x70 + virtual MxLong HandleEndAction(MxEndActionNotificationParam&); // vtable+0x74 // FUNCTION: LEGO1 0x1000dab0 virtual MxLong HandleType0Notification(MxNotificationParam&) { return 0; } // vtable+0x78 diff --git a/LEGO1/lego/legoomni/include/legostate.h b/LEGO1/lego/legoomni/include/legostate.h index 21ddde85..b181133f 100644 --- a/LEGO1/lego/legoomni/include/legostate.h +++ b/LEGO1/lego/legoomni/include/legostate.h @@ -9,6 +9,13 @@ // SIZE 0x08 class LegoState : public MxCore { public: + enum ScoreColor { + e_grey = 0, + e_yellow, + e_blue, + e_red + }; + // FUNCTION: LEGO1 0x10005f40 ~LegoState() override {} diff --git a/LEGO1/lego/legoomni/include/motocycle.h b/LEGO1/lego/legoomni/include/motocycle.h index 8a15967f..3e94fce0 100644 --- a/LEGO1/lego/legoomni/include/motocycle.h +++ b/LEGO1/lego/legoomni/include/motocycle.h @@ -23,12 +23,12 @@ class Motocycle : public IslePathActor { return !strcmp(p_name, Motocycle::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void VTable0x70(float p_float) override; // vtable+0x70 - MxLong HandleClick() override; // vtable+0xcc - MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - MxLong HandleNotification19(MxType19NotificationParam&) override; // vtable+0xdc - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxLong HandlePathStruct(LegoPathStructEvent&) override; // vtable+0xdc + void Exit() override; // vtable+0xe4 void FUN_10035e10(); diff --git a/LEGO1/lego/legoomni/include/pizza.h b/LEGO1/lego/legoomni/include/pizza.h index 51680712..ac6ad7bb 100644 --- a/LEGO1/lego/legoomni/include/pizza.h +++ b/LEGO1/lego/legoomni/include/pizza.h @@ -18,7 +18,7 @@ class PizzaMissionState : public LegoState { undefined2 m_unk0x00; // 0x00 MxU8 m_id; // 0x02 undefined m_unk0x03[0x15]; // 0x03 - MxU16 m_score; // 0x18 + MxS16 m_score; // 0x18 undefined m_unk0x18[6]; // 0x1a }; @@ -39,7 +39,7 @@ class PizzaMissionState : public LegoState { MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - inline MxU16 GetScore(MxU8 p_id) { return GetState(p_id)->m_score; } + inline MxS16 GetHighScore(MxU8 p_id) { return GetState(p_id)->m_score; } // SYNTHETIC: LEGO1 0x10039350 // PizzaMissionState::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/towtrack.h b/LEGO1/lego/legoomni/include/towtrack.h index e25e8137..31c1dc4b 100644 --- a/LEGO1/lego/legoomni/include/towtrack.h +++ b/LEGO1/lego/legoomni/include/towtrack.h @@ -26,7 +26,7 @@ class TowTrackMissionState : public LegoState { MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c - inline MxU16 GetScore(MxU8 p_id) + inline MxS16 GetHighScore(MxU8 p_id) { switch (p_id) { case 1: @@ -50,16 +50,16 @@ class TowTrackMissionState : public LegoState { undefined4 m_unk0x08; // 0x08 undefined4 m_unk0x0c; // 0x0c MxU8 m_unk0x10; // 0x10 - MxU16 m_unk0x12; // 0x12 - MxU16 m_unk0x14; // 0x14 - MxU16 m_unk0x16; // 0x16 - MxU16 m_unk0x18; // 0x18 - MxU16 m_unk0x1a; // 0x1a - MxU16 m_score1; // 0x1c - MxU16 m_score2; // 0x1e - MxU16 m_score3; // 0x20 - MxU16 m_score4; // 0x22 - MxU16 m_score5; // 0x24 + MxS16 m_unk0x12; // 0x12 + MxS16 m_unk0x14; // 0x14 + MxS16 m_unk0x16; // 0x16 + MxS16 m_unk0x18; // 0x18 + MxS16 m_unk0x1a; // 0x1a + MxS16 m_score1; // 0x1c + MxS16 m_score2; // 0x1e + MxS16 m_score3; // 0x20 + MxS16 m_score4; // 0x22 + MxS16 m_score5; // 0x24 }; // VTABLE: LEGO1 0x100d7ee0 @@ -82,14 +82,14 @@ class TowTrack : public IslePathActor { return !strcmp(p_name, TowTrack::ClassName()) || IslePathActor::IsA(p_name); } - MxLong Notify(MxParam& p_param) override; // vtable+0x04 - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void VTable0x70(float p_float) override; // vtable+0x70 - MxLong HandleClick() override; // vtable+0xcc - MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - MxLong HandleEndAnim(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 - MxLong HandleNotification19(MxType19NotificationParam& p_param) override; // vtable+0xdc - void Exit() override; // vtable+0xe4 + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 + MxLong HandleEndAnim(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 + MxLong HandlePathStruct(LegoPathStructEvent& p_param) override; // vtable+0xdc + void Exit() override; // vtable+0xe4 void CreateState(); void FUN_1004dab0(); diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index ce878893..542c9fb1 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -8,6 +8,7 @@ #include "legocontrolmanager.h" #include "legogamestate.h" #include "legonavcontroller.h" +#include "legopathstruct.h" #include "legoutils.h" #include "legovariables.h" #include "legoworld.h" @@ -31,7 +32,7 @@ Ambulance::Ambulance() m_maxLinearVel = 40.0; m_state = NULL; m_unk0x168 = 0; - m_unk0x16a = -1; + m_actorId = -1; m_unk0x16c = 0; m_unk0x16e = 0; m_unk0x170 = 0; @@ -126,7 +127,7 @@ MxLong Ambulance::Notify(MxParam& p_param) { MxLong result = 0; - switch (((MxNotificationParam&) p_param).GetType()) { + switch (((MxNotificationParam&) p_param).GetNotification()) { case c_notificationType0: result = HandleNotification0(); break; @@ -142,8 +143,8 @@ MxLong Ambulance::Notify(MxParam& p_param) case c_notificationControl: result = HandleControl((LegoControlManagerEvent&) p_param); break; - case c_notificationType19: - result = HandleNotification19((MxType19NotificationParam&) p_param); + case c_notificationPathStruct: + result = HandlePathStruct((LegoPathStructEvent&) p_param); break; } @@ -259,10 +260,103 @@ MxLong Ambulance::HandleButtonDown(LegoControlManagerEvent& p_param) return 0; } -// STUB: LEGO1 0x10036860 -MxLong Ambulance::HandleNotification19(MxType19NotificationParam& p_param) +// FUNCTION: LEGO1 0x10036860 +// FUNCTION: BETA10 0x100231bf +MxLong Ambulance::HandlePathStruct(LegoPathStructEvent& p_param) { - // TODO + // 0x168 corresponds to the path at the gas station + if (p_param.GetData() == 0x168) { + m_fuel = 1.0f; + } + + if (p_param.GetTrigger() == LegoPathStruct::c_camAnim && p_param.GetData() == 0x0b) { + if (m_unk0x16e != 0) { + if (m_unk0x16c != 0) { + m_state->m_unk0x08 = 2; + + if (m_lastAction != IsleScript::c_noneIsle) { + InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL); + } + + FUN_10036ec0(); + MxLong time = Timer()->GetTime() - m_state->m_unk0x0c; + + if (time < 300000) { + m_state->UpdateScore(LegoState::e_red, m_actorId); + PlayFinalAnimation(IsleScript::c_hho142cl_RunAnim); + } + else if (time < 400000) { + m_state->UpdateScore(LegoState::e_blue, m_actorId); + PlayFinalAnimation(IsleScript::c_hho143cl_RunAnim); + } + else { + m_state->UpdateScore(LegoState::e_yellow, m_actorId); + PlayFinalAnimation(IsleScript::c_hho144cl_RunAnim); + } + + return 0; + } + + if (m_unk0x16e != 0) { + if (m_lastAction != IsleScript::c_noneIsle) { + InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL); + } + + PlayAction(IsleScript::c_Avo915In_PlayWav); + return 0; + } + } + + if (m_unk0x16c != 0) { + if (m_lastAction != IsleScript::c_noneIsle) { + InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL); + } + + PlayAction(IsleScript::c_Avo915In_PlayWav); + } + } + else if (p_param.GetTrigger() == LegoPathStruct::c_s && p_param.GetData() == 0x131 && m_unk0x16e == 0) { + m_unk0x16e = 1; + m_unk0x170 = 1; + + if (m_lastAction != IsleScript::c_noneIsle) { + InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL); + } + + FUN_10036ec0(); + + if (m_actorId < LegoActor::c_pepper || m_actorId > LegoActor::c_laura) { + m_actorId = LegoActor::c_laura; + } + + switch (m_actorId) { + case c_pepper: + PlayAnimation(IsleScript::c_hpz049bd_RunAnim); + break; + case c_mama: + PlayAnimation(IsleScript::c_hpz047pe_RunAnim); + break; + case c_papa: + PlayAnimation(IsleScript::c_hpz050bd_RunAnim); + break; + case c_nick: + case c_laura: + PlayAnimation(IsleScript::c_hpz048pe_RunAnim); + break; + } + } + else if (p_param.GetTrigger() == LegoPathStruct::c_camAnim && (p_param.GetData() == 0x22 || p_param.GetData() == 0x23 || p_param.GetData() == 0x24) && m_unk0x16c == 0) { + m_unk0x16c = 1; + m_unk0x170 = 1; + + if (m_lastAction != IsleScript::c_noneIsle) { + InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL); + } + + FUN_10036ec0(); + PlayAnimation(IsleScript::c_hps116bd_RunAnim); + } + return 0; } @@ -287,7 +381,7 @@ MxLong Ambulance::HandleClick() } m_time = Timer()->GetTime(); - m_unk0x16a = UserActor()->GetActorId(); + m_actorId = UserActor()->GetActorId(); Enter(); InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_AmbulanceDashboard, NULL); @@ -318,6 +412,12 @@ void Ambulance::Exit() // TODO } +// STUB: LEGO1 0x10036ec0 +void Ambulance::FUN_10036ec0() +{ + // TODO +} + // STUB: LEGO1 0x10036f90 MxLong Ambulance::HandleControl(LegoControlManagerEvent& p_param) { @@ -447,6 +547,14 @@ void Ambulance::PlayAnimation(IsleScript::Script p_objectId) m_lastAnimation = p_objectId; } +// FUNCTION: LEGO1 0x10037310 +// FUNCTION: BETA10 0x10024440 +void Ambulance::PlayFinalAnimation(IsleScript::Script p_objectId) +{ + AnimationManager()->FUN_10060dc0(p_objectId, NULL, TRUE, TRUE, NULL, FALSE, FALSE, TRUE, TRUE); + m_lastAnimation = p_objectId; +} + // FUNCTION: LEGO1 0x10037340 void Ambulance::StopAction(IsleScript::Script p_objectId) { @@ -469,18 +577,18 @@ void Ambulance::PlayAction(IsleScript::Script p_objectId) // FUNCTION: LEGO1 0x100373a0 AmbulanceMissionState::AmbulanceMissionState() { - m_unk0x10 = 0; - m_unk0x12 = 0; - m_unk0x14 = 0; m_unk0x08 = 0; - m_unk0x16 = 0; m_unk0x0c = 0; - m_unk0x18 = 0; - m_score1 = 0; - m_score2 = 0; - m_score3 = 0; - m_score4 = 0; - m_score5 = 0; + m_peScore = 0; + m_maScore = 0; + m_paScore = 0; + m_niScore = 0; + m_laScore = 0; + m_peHighScore = 0; + m_maHighScore = 0; + m_paHighScore = 0; + m_niHighScore = 0; + m_laHighScore = 0; } // STUB: LEGO1 0x10037440 diff --git a/LEGO1/lego/legoomni/src/actors/buildingentity.cpp b/LEGO1/lego/legoomni/src/actors/buildingentity.cpp index 84dd87ec..6ddd84d8 100644 --- a/LEGO1/lego/legoomni/src/actors/buildingentity.cpp +++ b/LEGO1/lego/legoomni/src/actors/buildingentity.cpp @@ -21,7 +21,7 @@ BuildingEntity::~BuildingEntity() // FUNCTION: LEGO1 0x100150a0 MxLong BuildingEntity::Notify(MxParam& p_param) { - if (((MxNotificationParam&) p_param).GetType() == c_notificationClick) { + if (((MxNotificationParam&) p_param).GetNotification() == c_notificationClick) { return HandleClick((LegoEventNotificationParam&) p_param); } diff --git a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp index 5f51d088..290c3690 100644 --- a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp +++ b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp @@ -45,7 +45,7 @@ MxLong DuneBuggy::HandleControl(LegoControlManagerEvent& p_param) } // STUB: LEGO1 0x10068270 -MxLong DuneBuggy::HandleNotification19(MxType19NotificationParam& p_param) +MxLong DuneBuggy::HandlePathStruct(LegoPathStructEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/isleactor.cpp b/LEGO1/lego/legoomni/src/actors/isleactor.cpp index 66d8bf02..7c8681ff 100644 --- a/LEGO1/lego/legoomni/src/actors/isleactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/isleactor.cpp @@ -48,7 +48,7 @@ MxLong IsleActor::Notify(MxParam& p_param) case c_notificationEndAnim: result = VTable0x70(); break; - case c_notificationType19: + case c_notificationPathStruct: result = VTable0x80(p_param); break; } diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index bcd863cb..43d6c91d 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -48,27 +48,27 @@ void IslePathActor::Destroy(MxBool p_fromDestructor) // FUNCTION: LEGO1 0x1001a2c0 MxLong IslePathActor::Notify(MxParam& p_param) { - MxLong ret = 0; + MxLong result = 0; - switch (((MxNotificationParam&) p_param).GetType()) { + switch (((MxNotificationParam&) p_param).GetNotification()) { case c_notificationType0: - ret = HandleNotification0(); + result = HandleNotification0(); break; case c_notificationClick: - ret = HandleClick(); + result = HandleClick(); break; case c_notificationControl: - ret = HandleControl((LegoControlManagerEvent&) p_param); + result = HandleControl((LegoControlManagerEvent&) p_param); break; case c_notificationEndAnim: - ret = HandleEndAnim((LegoEndAnimNotificationParam&) p_param); + result = HandleEndAnim((LegoEndAnimNotificationParam&) p_param); break; - case c_notificationType19: - ret = HandleNotification19((MxType19NotificationParam&) p_param); + case c_notificationPathStruct: + result = HandlePathStruct((LegoPathStructEvent&) p_param); break; } - return ret; + return result; } // FUNCTION: LEGO1 0x1001a350 diff --git a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp index e327a6c6..6888ebfa 100644 --- a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp +++ b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp @@ -32,7 +32,7 @@ JukeBoxEntity::~JukeBoxEntity() // FUNCTION: LEGO1 0x10085e40 MxLong JukeBoxEntity::Notify(MxParam& p_param) { - if (((MxNotificationParam&) p_param).GetType() == c_notificationClick) { + if (((MxNotificationParam&) p_param).GetNotification() == c_notificationClick) { if (!FUN_1003ef60()) { return 1; } diff --git a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp index 01ae480e..3209f15e 100644 --- a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp +++ b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp @@ -45,7 +45,7 @@ MxLong Motocycle::HandleControl(LegoControlManagerEvent& p_param) } // STUB: LEGO1 0x10035df0 -MxLong Motocycle::HandleNotification19(MxType19NotificationParam& p_param) +MxLong Motocycle::HandlePathStruct(LegoPathStructEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/radio.cpp b/LEGO1/lego/legoomni/src/actors/radio.cpp index 89d39357..bc7adc69 100644 --- a/LEGO1/lego/legoomni/src/actors/radio.cpp +++ b/LEGO1/lego/legoomni/src/actors/radio.cpp @@ -86,7 +86,7 @@ MxLong Radio::Notify(MxParam& p_param) MxLong result = 0; if (m_unk0x0c) { - switch (((MxNotificationParam&) p_param).GetType()) { + switch (((MxNotificationParam&) p_param).GetNotification()) { case c_notificationEndAction: result = HandleEndAction((MxEndActionNotificationParam&) p_param); break; diff --git a/LEGO1/lego/legoomni/src/actors/towtrack.cpp b/LEGO1/lego/legoomni/src/actors/towtrack.cpp index c487def5..1643230a 100644 --- a/LEGO1/lego/legoomni/src/actors/towtrack.cpp +++ b/LEGO1/lego/legoomni/src/actors/towtrack.cpp @@ -89,7 +89,7 @@ MxLong TowTrack::HandleEndAnim(LegoEndAnimNotificationParam& p_param) } // STUB: LEGO1 0x1004d330 -MxLong TowTrack::HandleNotification19(MxType19NotificationParam& p_param) +MxLong TowTrack::HandlePathStruct(LegoPathStructEvent& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index c49ddb73..6037712e 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -1366,11 +1366,11 @@ LegoTranInfo* LegoAnimationManager::GetTranInfo(MxU32 p_index) MxLong LegoAnimationManager::Notify(MxParam& p_param) { if (((MxNotificationParam&) p_param).GetSender() == this) { - if (((MxNotificationParam&) p_param).GetType() == c_notificationEndAnim) { + if (((MxNotificationParam&) p_param).GetNotification() == c_notificationEndAnim) { FUN_100605e0(m_unk0x18, TRUE, NULL, TRUE, NULL, FALSE, TRUE, TRUE, TRUE); } } - else if (((MxNotificationParam&) p_param).GetType() == c_notificationEndAnim && m_tranInfoList != NULL) { + else if (((MxNotificationParam&) p_param).GetNotification() == c_notificationEndAnim && m_tranInfoList != NULL) { LegoTranInfoListCursor cursor(m_tranInfoList); LegoTranInfo* tranInfo; diff --git a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp index 62ba85a2..1708460a 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp @@ -216,7 +216,7 @@ MxLong LegoAnimMMPresenter::Notify(MxParam& p_param) { AUTOLOCK(m_criticalSection); - if (((MxNotificationParam&) p_param).GetType() == c_notificationEndAction && + if (((MxNotificationParam&) p_param).GetNotification() == c_notificationEndAction && ((MxNotificationParam&) p_param).GetSender() == m_presenter) { m_presenter = NULL; } diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index 3b6b1267..c2f5077f 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -10,6 +10,7 @@ #include "legoinputmanager.h" #include "legomain.h" #include "legonamedtexture.h" +#include "legopathstruct.h" #include "legosoundmanager.h" #include "legovideomanager.h" #include "legoworld.h" @@ -20,7 +21,6 @@ #include "mxmisc.h" #include "mxnotificationmanager.h" #include "mxstreamer.h" -#include "mxtype19notificationparam.h" #include "mxtypes.h" #include "mxutilities.h" #include "mxvariabletable.h" @@ -367,7 +367,7 @@ void PlayCamAnim(LegoPathActor* p_actor, MxBool p_unused, MxU32 p_location, MxBo MxLong result = 0; if (world != NULL) { - MxType19NotificationParam param(c_notificationType19, p_actor, 0x43, p_location); + LegoPathStructEvent param(c_notificationPathStruct, p_actor, LegoPathStruct::c_camAnim, p_location); result = world->Notify(param); } diff --git a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp index b1edc1e9..340836f0 100644 --- a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp @@ -178,13 +178,13 @@ MxBool MxControlPresenter::FUN_10044270(MxS32 p_x, MxS32 p_y, MxVideoPresenter* MxBool MxControlPresenter::FUN_10044480(LegoControlManagerEvent* p_event, MxPresenter* p_presenter) { if (IsEnabled()) { - switch (p_event->GetType()) { + switch (p_event->GetNotification()) { case c_notificationButtonUp: if (m_unk0x4c == 0 || m_unk0x4c == 2 || m_unk0x4c == 3) { p_event->SetClickedObjectId(m_action->GetObjectId()); p_event->SetClickedAtom(m_action->GetAtomId().GetInternal()); VTable0x6c(0); - p_event->SetType(c_notificationControl); + p_event->SetNotification(c_notificationControl); p_event->SetUnknown0x28(m_unk0x4e); return TRUE; } @@ -194,7 +194,7 @@ MxBool MxControlPresenter::FUN_10044480(LegoControlManagerEvent* p_event, MxPres p_event->SetClickedObjectId(m_action->GetObjectId()); p_event->SetClickedAtom(m_action->GetAtomId().GetInternal()); VTable0x6c(m_unk0x56); - p_event->SetType(c_notificationControl); + p_event->SetNotification(c_notificationControl); p_event->SetUnknown0x28(m_unk0x4e); return TRUE; } diff --git a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp index b0864024..6e433a15 100644 --- a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp +++ b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp @@ -58,15 +58,16 @@ MxBool LegoControlManager::FUN_10029210(LegoEventNotificationParam& p_param, MxP if (m_presenterList != NULL && m_presenterList->GetCount() != 0) { m_unk0x14 = p_presenter; - if (p_param.GetType() == c_notificationButtonUp || p_param.GetType() == c_notificationButtonDown) { - m_event.SetType(p_param.GetType()); + if (p_param.GetNotification() == c_notificationButtonUp || + p_param.GetNotification() == c_notificationButtonDown) { + m_event.SetNotification(p_param.GetNotification()); m_event.SetSender(p_param.GetSender()); m_event.SetModifier(p_param.GetModifier()); m_event.SetX(p_param.GetX()); m_event.SetY(p_param.GetY()); m_event.SetKey(p_param.GetKey()); - if (p_param.GetType() == c_notificationButtonUp) { + if (p_param.GetNotification() == c_notificationButtonUp) { if (m_unk0x10 == TRUE) { m_unk0x10 = FALSE; return TRUE; @@ -82,7 +83,7 @@ MxBool LegoControlManager::FUN_10029210(LegoEventNotificationParam& p_param, MxP } } } - else if (p_param.GetType() == c_notificationButtonDown) { + else if (p_param.GetNotification() == c_notificationButtonDown) { if (m_unk0x0c == 1) { m_unk0x10 = TRUE; return TRUE; @@ -163,7 +164,7 @@ MxControlPresenter* LegoControlManager::FUN_100294e0(MxS32 p_x, MxS32 p_y) MxResult LegoControlManager::Tickle() { if (m_unk0x08 == 2 && m_unk0x0c == 1) { - m_event.SetType(c_notificationButtonUp); + m_event.SetNotification(c_notificationButtonUp); FUN_10029750(); return 0; } diff --git a/LEGO1/lego/legoomni/src/entity/act2policestation.cpp b/LEGO1/lego/legoomni/src/entity/act2policestation.cpp index 728b0441..0d95454f 100644 --- a/LEGO1/lego/legoomni/src/entity/act2policestation.cpp +++ b/LEGO1/lego/legoomni/src/entity/act2policestation.cpp @@ -11,7 +11,7 @@ DECOMP_SIZE_ASSERT(Act2PoliceStation, 0x68) // FUNCTION: LEGO1 0x1004e0e0 MxLong Act2PoliceStation::Notify(MxParam& p_param) { - if (((MxNotificationParam&) p_param).GetType() == c_notificationClick) { + if (((MxNotificationParam&) p_param).GetNotification() == c_notificationClick) { MxNotificationParam param(c_notificationType23, NULL); NotificationManager()->Send(CurrentWorld(), param); return 1; diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index 24ac051b..69b9133d 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -602,7 +602,7 @@ MxResult LegoNavController::ProcessKeyboardInput() // STUB: LEGO1 0x10055a60 MxLong LegoNavController::Notify(MxParam& p_param) { - if (((MxNotificationParam&) p_param).GetType() == c_notificationKeyPress) { + if (((MxNotificationParam&) p_param).GetNotification() == c_notificationKeyPress) { m_unk0x5d = TRUE; switch (((LegoEventNotificationParam&) p_param).GetKey()) { diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index 8f1e196b..7a3ca5dc 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -345,7 +345,7 @@ void LegoInputManager::QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p { LegoEventNotificationParam param = LegoEventNotificationParam(p_id, NULL, p_modifier, p_x, p_y, p_key); - if (((!m_unk0x88) || ((m_unk0x335 && (param.GetType() == c_notificationButtonDown)))) || + if (((!m_unk0x88) || ((m_unk0x335 && (param.GetNotification() == c_notificationButtonDown)))) || ((m_unk0x336 && (p_key == VK_SPACE)))) { ProcessOneEvent(param); } @@ -369,12 +369,12 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param) { MxBool processRoi; - if (p_param.GetType() == c_notificationKeyPress) { + if (p_param.GetNotification() == c_notificationKeyPress) { if (!Lego()->IsPaused() || p_param.GetKey() == VK_PAUSE) { if (p_param.GetKey() == VK_SHIFT) { if (m_unk0x195) { m_unk0x80 = FALSE; - p_param.SetType(c_notificationDrag); + p_param.SetNotification(c_notificationDrag); if (m_camera) { m_camera->Notify(p_param); @@ -400,7 +400,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param) processRoi = TRUE; if (m_unk0x335 != 0) { - if (p_param.GetType() == c_notificationButtonDown) { + if (p_param.GetNotification() == c_notificationButtonDown) { LegoEventNotificationParam notification(c_notificationKeyPress, NULL, 0, 0, 0, VK_SPACE); LegoNotifyListCursor cursor(m_keyboardNotifyList); MxCore* target; @@ -415,7 +415,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param) return TRUE; } - if (m_unk0x195 && p_param.GetType() == c_notificationButtonDown) { + if (m_unk0x195 && p_param.GetNotification() == c_notificationButtonDown) { m_unk0x195 = 0; return TRUE; } @@ -424,7 +424,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param) return TRUE; } - if (p_param.GetType() == c_notificationButtonDown) { + if (p_param.GetNotification() == c_notificationButtonDown) { MxPresenter* presenter = VideoManager()->GetPresenterAt(p_param.GetX(), p_param.GetY()); if (presenter) { @@ -444,7 +444,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param) } } } - else if (p_param.GetType() == c_notificationButtonUp) { + else if (p_param.GetNotification() == c_notificationButtonUp) { if (g_unk0x100f31b0 != -1 || m_controlManager->GetUnknown0x10() || m_controlManager->GetUnknown0x0c() == 1) { MxBool result = m_controlManager->FUN_10029210(p_param, NULL); @@ -457,7 +457,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param) } if (FUN_1005cdf0(p_param)) { - if (processRoi && p_param.GetType() == c_notificationClick) { + if (processRoi && p_param.GetNotification() == c_notificationClick) { LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY()); p_param.SetROI(roi); @@ -493,13 +493,13 @@ MxBool LegoInputManager::FUN_1005cdf0(LegoEventNotificationParam& p_param) StopAutoDragTimer(); if (m_unk0x80) { - p_param.SetType(c_notificationDrag); + p_param.SetNotification(c_notificationDrag); result = TRUE; } else if (m_unk0x81) { p_param.SetX(m_x); p_param.SetY(m_y); - p_param.SetType(c_notificationClick); + p_param.SetNotification(c_notificationClick); result = TRUE; } @@ -531,14 +531,14 @@ MxBool LegoInputManager::FUN_1005cdf0(LegoEventNotificationParam& p_param) if (m_unk0x195 || (diffX * diffX) + (diffY * diffY) > m_unk0x74) { StopAutoDragTimer(); m_unk0x80 = TRUE; - p_param.SetType(c_notificationDragEnd); + p_param.SetNotification(c_notificationDragEnd); result = TRUE; p_param.SetX(m_x); p_param.SetY(m_y); } } else { - p_param.SetType(c_notificationDragStart); + p_param.SetNotification(c_notificationDragStart); result = TRUE; } } @@ -552,7 +552,7 @@ MxBool LegoInputManager::FUN_1005cdf0(LegoEventNotificationParam& p_param) p_param.SetX(m_x); p_param.SetY(m_y); p_param.SetModifier(LegoEventNotificationParam::c_lButtonState); - p_param.SetType(c_notificationDragEnd); + p_param.SetNotification(c_notificationDragEnd); result = TRUE; } else { diff --git a/LEGO1/lego/legoomni/src/main/legomain.cpp b/LEGO1/lego/legoomni/src/main/legomain.cpp index 1cdf1561..a0cc4113 100644 --- a/LEGO1/lego/legoomni/src/main/legomain.cpp +++ b/LEGO1/lego/legoomni/src/main/legomain.cpp @@ -564,7 +564,7 @@ MxLong LegoOmni::Notify(MxParam& p_param) { MxBool isCD = FALSE; - if (((MxNotificationParam&) p_param).GetType() == c_notificationEndAction && + if (((MxNotificationParam&) p_param).GetNotification() == c_notificationEndAction && ((MxActionNotificationParam&) p_param).GetAction()->GetAtomId() == *g_nocdSourceName) { isCD = TRUE; } diff --git a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp index d15d083b..93a17e38 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp @@ -10,7 +10,6 @@ #include "mxbackgroundaudiomanager.h" #include "mxmisc.h" #include "mxnotificationmanager.h" -#include "mxtype19notificationparam.h" #include "scripts.h" DECOMP_SIZE_ASSERT(LegoPathStructBase, 0x0c) @@ -52,7 +51,7 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, case c_d: { p_actor->VTable0x58(p_data); - MxType19NotificationParam param(c_notificationType19, p_actor, m_name[2], p_data); + LegoPathStructEvent param(c_notificationPathStruct, p_actor, m_name[2], p_data); p_actor->Notify(param); LegoWorld* world = CurrentWorld(); @@ -68,7 +67,6 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, break; case c_h: { LegoHideAnimPresenter* presenter = m_world->GetHideAnimPresenter(); - if (presenter != NULL) { presenter->FUN_1006db40(p_data * 100); } @@ -82,7 +80,7 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, case c_s: { LegoWorld* world = CurrentWorld(); if (world != NULL) { - MxType19NotificationParam param(c_notificationType19, p_actor, m_name[2], p_data); + LegoPathStructEvent param(c_notificationPathStruct, p_actor, m_name[2], p_data); if (world->Notify(param) != 0) { break; @@ -95,7 +93,7 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, case c_w: { LegoWorld* world = CurrentWorld(); if (world != NULL) { - MxType19NotificationParam param(c_notificationType19, p_actor, m_name[2], p_data); + LegoPathStructEvent param(c_notificationPathStruct, p_actor, m_name[2], p_data); NotificationManager()->Send(world, param); } break; diff --git a/LEGO1/lego/legoomni/src/race/carrace.cpp b/LEGO1/lego/legoomni/src/race/carrace.cpp index 5140250e..53db021e 100644 --- a/LEGO1/lego/legoomni/src/race/carrace.cpp +++ b/LEGO1/lego/legoomni/src/race/carrace.cpp @@ -32,7 +32,7 @@ MxLong CarRace::HandleEndAction(MxEndActionNotificationParam&) } // STUB: LEGO1 0x100170e0 -MxLong CarRace::HandleType19Notification(MxType19NotificationParam&) +MxLong CarRace::HandlePathStruct(LegoPathStructEvent&) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/race/jetskirace.cpp b/LEGO1/lego/legoomni/src/race/jetskirace.cpp index eeaed23a..120ba4d8 100644 --- a/LEGO1/lego/legoomni/src/race/jetskirace.cpp +++ b/LEGO1/lego/legoomni/src/race/jetskirace.cpp @@ -26,7 +26,7 @@ MxLong JetskiRace::HandleClick(LegoEventNotificationParam&) } // STUB: LEGO1 0x100166a0 -MxLong JetskiRace::HandleType19Notification(MxType19NotificationParam&) +MxLong JetskiRace::HandlePathStruct(LegoPathStructEvent&) { return 0; } diff --git a/LEGO1/lego/legoomni/src/race/legorace.cpp b/LEGO1/lego/legoomni/src/race/legorace.cpp index ce0bb8d3..e1e39afc 100644 --- a/LEGO1/lego/legoomni/src/race/legorace.cpp +++ b/LEGO1/lego/legoomni/src/race/legorace.cpp @@ -36,7 +36,7 @@ LegoRace::LegoRace() } // FUNCTION: LEGO1 0x10015b70 -MxLong LegoRace::HandleType19Notification(MxType19NotificationParam&) +MxLong LegoRace::HandlePathStruct(LegoPathStructEvent&) { return 0; } @@ -101,8 +101,8 @@ MxLong LegoRace::Notify(MxParam& p_param) case c_notificationClick: result = HandleClick((LegoEventNotificationParam&) p_param); break; - case c_notificationType19: - result = HandleType19Notification((MxType19NotificationParam&) p_param); + case c_notificationPathStruct: + result = HandlePathStruct((LegoPathStructEvent&) p_param); break; case c_notificationTransitioned: GameState()->SwitchArea(m_destLocation); diff --git a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp index 3b8381da..20ab4309 100644 --- a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp +++ b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp @@ -58,7 +58,7 @@ MxLong ElevatorBottom::Notify(MxParam& p_param) LegoWorld::Notify(p_param); if (m_worldStarted) { - switch (((MxNotificationParam&) p_param).GetType()) { + switch (((MxNotificationParam&) p_param).GetNotification()) { case c_notificationControl: ret = HandleControl((LegoControlManagerEvent&) p_param); break; diff --git a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp index dde3e760..4bf5d796 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp @@ -61,7 +61,7 @@ MxLong InfocenterDoor::Notify(MxParam& p_param) LegoWorld::Notify(p_param); if (m_worldStarted) { - switch (((MxNotificationParam&) p_param).GetType()) { + switch (((MxNotificationParam&) p_param).GetNotification()) { case c_notificationEndAction: if (((MxEndActionNotificationParam&) p_param).GetAction()->GetAtomId() == m_atom) { BackgroundAudioManager()->RaiseVolume(); diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 2f02be8a..d6a066fc 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -18,6 +18,7 @@ #include "legoinputmanager.h" #include "legomain.h" #include "legonamedtexture.h" +#include "legopathstruct.h" #include "legoutils.h" #include "legovariables.h" #include "legovideomanager.h" @@ -29,7 +30,6 @@ #include "mxnotificationmanager.h" #include "mxstillpresenter.h" #include "mxtransitionmanager.h" -#include "mxtype19notificationparam.h" #include "mxvariabletable.h" #include "pizza.h" #include "pizzeria.h" @@ -167,8 +167,8 @@ MxLong Isle::Notify(MxParam& p_param) break; } break; - case c_notificationType19: - result = HandleType19Notification((MxType19NotificationParam&) p_param); + case c_notificationPathStruct: + result = HandlePathStruct((LegoPathStructEvent&) p_param); break; case c_notificationType20: Enable(TRUE); @@ -469,7 +469,7 @@ void Isle::UpdateGlobe() } // FUNCTION: LEGO1 0x100315f0 -MxLong Isle::HandleType19Notification(MxType19NotificationParam& p_param) +MxLong Isle::HandlePathStruct(LegoPathStructEvent& p_param) { MxLong result = 0; @@ -495,7 +495,8 @@ MxLong Isle::HandleType19Notification(MxType19NotificationParam& p_param) } if (result == 0) { - switch (p_param.GetUnknown0x0c()) { + // These values correspond to certain paths on the island + switch (p_param.GetData()) { case 0x12c: AnimationManager()->FUN_10064670(NULL); result = 1; diff --git a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp index 414f4faa..eb2e916c 100644 --- a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp @@ -103,7 +103,7 @@ MxLong RegistrationBook::Notify(MxParam& p_param) LegoWorld::Notify(p_param); if (m_worldStarted) { - switch (((MxNotificationParam&) p_param).GetType()) { + switch (((MxNotificationParam&) p_param).GetNotification()) { case c_notificationEndAction: result = HandleEndAction((MxEndActionNotificationParam&) p_param); break; @@ -117,7 +117,7 @@ MxLong RegistrationBook::Notify(MxParam& p_param) case c_notificationControl: result = HandleControl((LegoControlManagerEvent&) p_param); break; - case c_notificationType19: + case c_notificationPathStruct: result = HandleNotification19(p_param); break; case c_notificationTransitioned: diff --git a/LEGO1/lego/legoomni/src/worlds/score.cpp b/LEGO1/lego/legoomni/src/worlds/score.cpp index 1482e253..95c19bcc 100644 --- a/LEGO1/lego/legoomni/src/worlds/score.cpp +++ b/LEGO1/lego/legoomni/src/worlds/score.cpp @@ -266,21 +266,21 @@ void Score::Paint() m_surface = (MxU8*) desc.lpSurface; for (MxU8 actor = 1; actor <= 5; actor++) { - MxU16 score; + MxS16 score; - score = carRaceState ? carRaceState->GetState(actor)->GetScore() : 0; + score = carRaceState ? carRaceState->GetState(actor)->GetHighScore() : 0; FillArea(0, actor - 1, score); - score = jetskiRaceState ? jetskiRaceState->GetState(actor)->GetScore() : 0; + score = jetskiRaceState ? jetskiRaceState->GetState(actor)->GetHighScore() : 0; FillArea(1, actor - 1, score); - score = pizzaMissionState ? pizzaMissionState->GetScore(actor) : 0; + score = pizzaMissionState ? pizzaMissionState->GetHighScore(actor) : 0; FillArea(2, actor - 1, score); - score = towTrackMissionState ? towTrackMissionState->GetScore(actor) : 0; + score = towTrackMissionState ? towTrackMissionState->GetHighScore(actor) : 0; FillArea(3, actor - 1, score); - score = ambulanceMissionState ? ambulanceMissionState->GetScore(actor) : 0; + score = ambulanceMissionState ? ambulanceMissionState->GetHighScore(actor) : 0; FillArea(4, actor - 1, score); } @@ -299,14 +299,14 @@ void Score::FillArea(MxU32 i_activity, MxU32 i_actor, MxS16 score) MxS32 local14[] = {0x2a, 0x27, 0x29, 0x29, 0x2a}; MxS32 local50[] = {0x2f, 0x56, 0x81, 0xaa, 0xd4}; MxS32 local28[] = {0x25, 0x29, 0x27, 0x28, 0x28}; - MxS32 local60[] = {0x11, 0x0f, 0x08, 0x05}; + MxS32 colors[] = {0x11, 0x0f, 0x08, 0x05}; MxU8* ptr = m_surface + local3c[i_actor] + local50[i_activity]; - MxS32 val = local60[score]; + MxS32 color = colors[score]; MxS32 size = local28[i_activity]; for (MxS32 i = 0; i < local14[i_actor]; i++) { - memset(ptr, val, size); + memset(ptr, color, size); ptr += 0x100; } } diff --git a/LEGO1/omni/include/mxnotificationparam.h b/LEGO1/omni/include/mxnotificationparam.h index 1c1e691d..e2b34988 100644 --- a/LEGO1/omni/include/mxnotificationparam.h +++ b/LEGO1/omni/include/mxnotificationparam.h @@ -25,8 +25,8 @@ enum NotificationId { c_notificationDrag = 14, c_notificationTimer = 15, // 100d6aa0 c_notificationControl = 17, - c_notificationEndAnim = 18, // 100d7e80 - c_notificationType19 = 19, // 100d6230 + c_notificationEndAnim = 18, // 100d7e80 + c_notificationPathStruct = 19, // 100d6230 c_notificationType20 = 20, c_notificationNewPresenter = 21, c_notificationType22 = 22, @@ -48,9 +48,8 @@ class MxNotificationParam : public MxParam { inline NotificationId GetNotification() const { return m_type; } inline MxCore* GetSender() const { return m_sender; } - inline NotificationId GetType() const { return m_type; } - inline void SetType(NotificationId p_type) { m_type = p_type; } + inline void SetNotification(NotificationId p_type) { m_type = p_type; } inline void SetSender(MxCore* p_sender) { m_sender = p_sender; } protected: diff --git a/LEGO1/omni/include/mxtype19notificationparam.h b/LEGO1/omni/include/mxtype19notificationparam.h deleted file mode 100644 index 2a44e2ac..00000000 --- a/LEGO1/omni/include/mxtype19notificationparam.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef MXTYPE19NOTIFICATIONPARAM_H -#define MXTYPE19NOTIFICATIONPARAM_H - -#include "decomp.h" -#include "mxnotificationparam.h" - -// VTABLE: LEGO1 0x100d6230 -// SIZE 0x10 -class MxType19NotificationParam : public MxNotificationParam { -public: - MxType19NotificationParam(NotificationId p_type, MxCore* p_sender, MxU8 p_unk0x0e, MxS16 p_unk0x0c) - : MxNotificationParam() - { - m_type = p_type; - m_sender = p_sender; - m_unk0x0c = p_unk0x0c; - m_unk0x0e = p_unk0x0e; - } - - // FUNCTION: LEGO1 0x1001bac0 - MxNotificationParam* Clone() const override - { - return new MxType19NotificationParam(m_type, m_sender, m_unk0x0e, m_unk0x0c); - } // vtable+0x04 - - inline MxS16 GetUnknown0x0c() { return m_unk0x0c; } - -protected: - MxS16 m_unk0x0c; // 0x0c - MxU8 m_unk0x0e; // 0x0e -}; - -// SYNTHETIC: LEGO1 0x1001bb80 -// MxType19NotificationParam::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x1001bbf0 -// MxType19NotificationParam::~MxType19NotificationParam - -#endif // MXTYPE19NOTIFICATIONPARAM_H