diff --git a/CMakeLists.txt b/CMakeLists.txt index 47617b10..720e1609 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -319,7 +319,10 @@ target_link_libraries(omni PRIVATE dsound winmm libsmacker) add_library(lego1 SHARED LEGO1/define.cpp LEGO1/lego/legoomni/src/actors/act2actor.cpp + LEGO1/lego/legoomni/src/actors/act2genactor.cpp LEGO1/lego/legoomni/src/actors/act3actor.cpp + LEGO1/lego/legoomni/src/actors/act3brickster.cpp + LEGO1/lego/legoomni/src/actors/act3cop.cpp LEGO1/lego/legoomni/src/actors/act3shark.cpp LEGO1/lego/legoomni/src/actors/ambulance.cpp LEGO1/lego/legoomni/src/actors/bike.cpp diff --git a/LEGO1/lego/legoomni/include/act2genactor.h b/LEGO1/lego/legoomni/include/act2genactor.h new file mode 100644 index 00000000..93cc05da --- /dev/null +++ b/LEGO1/lego/legoomni/include/act2genactor.h @@ -0,0 +1,15 @@ +#ifndef ACT2GENACTOR_H +#define ACT2GENACTOR_H + +#include "legopathactor.h" + +// VTABLE: LEGO1 0x100d4ed8 +// SIZE 0x154 +class Act2GenActor : public LegoPathActor { + MxResult VTable0x94(LegoPathActor*, MxBool) override; // vtable+0x94 + + // SYNTHETIC: LEGO1 0x1000f5a0 + // Act2GenActor::`scalar deleting destructor' +}; + +#endif // ACT2GENACTOR_H diff --git a/LEGO1/lego/legoomni/include/act3actor.h b/LEGO1/lego/legoomni/include/act3actor.h index 3e6b3150..1944c3b4 100644 --- a/LEGO1/lego/legoomni/include/act3actor.h +++ b/LEGO1/lego/legoomni/include/act3actor.h @@ -23,6 +23,9 @@ class Act3Actor : public LegoAnimActor { // SYNTHETIC: LEGO1 0x10043330 // Act3Actor::`scalar deleting destructor' + // SYNTHETIC: LEGO1 0x10040fa0 + // Act3Actor::~Act3Actor + private: undefined4 m_unk0x1c; // 0x1c }; diff --git a/LEGO1/lego/legoomni/include/act3brickster.h b/LEGO1/lego/legoomni/include/act3brickster.h new file mode 100644 index 00000000..f9066d3c --- /dev/null +++ b/LEGO1/lego/legoomni/include/act3brickster.h @@ -0,0 +1,31 @@ +#ifndef ACT3BRICKSTER_H +#define ACT3BRICKSTER_H + +#include "act3actor.h" + +// VTABLE: LEGO1 0x100d7838 LegoPathActor +// VTABLE: LEGO1 0x100d7908 LegoAnimActor +// SIZE 0x1b4 +class Act3Brickster : public Act3Actor { +public: + Act3Brickster(); + ~Act3Brickster() override; + + void ParseAction(char* p_extra) override; // vtable+0x20 + void VTable0x70(float p_und) override; // vtable+0x70 + MxResult VTable0x94(LegoPathActor*, MxBool) override; // vtable+0x94 + void SwitchBoundary( + LegoPathBoundary*& p_boundary, + LegoUnknown100db7f4*& p_edge, + float& p_unk0xe4 + ) override; // vtable+0x98 + MxResult VTable0x9c() override; // vtable+0x9c + + // SYNTHETIC: LEGO1 0x10043250 + // Act3Brickster::`scalar deleting destructor' + +private: + undefined4 m_unk0x20[15]; // 0x20 +}; + +#endif // ACT3BRICKSTER_H diff --git a/LEGO1/lego/legoomni/include/act3cop.h b/LEGO1/lego/legoomni/include/act3cop.h new file mode 100644 index 00000000..29ac65b6 --- /dev/null +++ b/LEGO1/lego/legoomni/include/act3cop.h @@ -0,0 +1,25 @@ +#ifndef ACT3COP_H +#define ACT3COP_H + +#include "act3actor.h" + +// VTABLE: LEGO1 0x100d7750 LegoPathActor +// VTABLE: LEGO1 0x100d7820 LegoAnimActor +// SIZE 0x188 +class Act3Cop : public Act3Actor { +public: + Act3Cop(); + + void ParseAction(char* p_extra) override; // vtable+0x20 + void VTable0x70(float p_und) override; // vtable+0x70 + MxResult VTable0x94(LegoPathActor*, MxBool) override; // vtable+0x94 + MxResult VTable0x9c() override; // vtable+0x9c + + // SYNTHETIC: LEGO1 0x10043120 + // Act3Cop::`scalar deleting destructor' + +private: + undefined4 m_unk0x20[4]; // 0x20 +}; + +#endif // ACT3COP_H diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index 54e163e8..79091329 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -25,41 +25,78 @@ class AmbulanceMissionState : public LegoState { return !strcmp(p_name, AmbulanceMissionState::ClassName()) || LegoState::IsA(p_name); } - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + MxResult Serialize(LegoFile* p_file) 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 - undefined4 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 + MxLong m_unk0x0c; // 0x0c + 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,19 +122,19 @@ 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_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 - 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(); - void FUN_10037060(); + void ActivateSceneActions(); void StopActions(); void FUN_10037250(); @@ -105,20 +142,24 @@ class Ambulance : public IslePathActor { // Ambulance::`scalar deleting destructor' private: - void StopAction(MxS32 p_entityId); + 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 Leave(); - undefined m_unk0x160[4]; // 0x160 - AmbulanceMissionState* m_state; // 0x164 - MxS16 m_unk0x168; // 0x168 - MxS16 m_unk0x16a; // 0x16a - MxS16 m_unk0x16c; // 0x16c - MxS16 m_unk0x16e; // 0x16e - MxS16 m_unk0x170; // 0x170 - MxS16 m_unk0x172; // 0x172 - MxS32 m_unk0x174; // 0x174 - MxS32 m_unk0x178; // 0x178 - MxFloat m_unk0x17c; // 0x17c - MxFloat m_time; // 0x180 + undefined m_unk0x160[4]; // 0x160 + AmbulanceMissionState* m_state; // 0x164 + MxS16 m_unk0x168; // 0x168 + MxS16 m_actorId; // 0x16a + MxS16 m_unk0x16c; // 0x16c + MxS16 m_unk0x16e; // 0x16e + MxS16 m_unk0x170; // 0x170 + MxS16 m_unk0x172; // 0x172 + IsleScript::Script m_lastAction; // 0x174 + IsleScript::Script m_lastAnimation; // 0x178 + MxFloat m_fuel; // 0x17c + MxFloat m_time; // 0x180 }; #endif // AMBULANCE_H diff --git a/LEGO1/lego/legoomni/include/buildingentity.h b/LEGO1/lego/legoomni/include/buildingentity.h index dd6d4594..4639ee23 100644 --- a/LEGO1/lego/legoomni/include/buildingentity.h +++ b/LEGO1/lego/legoomni/include/buildingentity.h @@ -3,6 +3,8 @@ #include "legoentity.h" +class LegoEventNotificationParam; + // VTABLE: LEGO1 0x100d5c88 // SIZE 0x68 class BuildingEntity : public LegoEntity { @@ -25,7 +27,7 @@ class BuildingEntity : public LegoEntity { return !strcmp(p_name, BuildingEntity::ClassName()) || LegoEntity::IsA(p_name); } - virtual MxLong VTable0x50(MxParam& p_param) = 0; + virtual MxLong HandleClick(LegoEventNotificationParam& p_param) = 0; // SYNTHETIC: LEGO1 0x10015010 // BuildingEntity::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/buildings.h b/LEGO1/lego/legoomni/include/buildings.h index 39394628..da334b72 100644 --- a/LEGO1/lego/legoomni/include/buildings.h +++ b/LEGO1/lego/legoomni/include/buildings.h @@ -3,6 +3,8 @@ #include "buildingentity.h" +class LegoEventNotificationParam; + // VTABLE: LEGO1 0x100d48a8 // SIZE 0x68 class RaceStandsEntity : public BuildingEntity { @@ -19,7 +21,7 @@ class RaceStandsEntity : public BuildingEntity { return !strcmp(p_name, RaceStandsEntity::ClassName()) || BuildingEntity::IsA(p_name); } - MxLong VTable0x50(MxParam& p_param) override; + MxLong HandleClick(LegoEventNotificationParam& p_param) override; // SYNTHETIC: LEGO1 0x1000f9e0 // RaceStandsEntity::`scalar deleting destructor' @@ -42,7 +44,7 @@ class BeachHouseEntity : public BuildingEntity { return !strcmp(p_name, BeachHouseEntity::ClassName()) || BuildingEntity::IsA(p_name); } - MxLong VTable0x50(MxParam& p_param) override; + MxLong HandleClick(LegoEventNotificationParam& p_param) override; // SYNTHETIC: LEGO1 0x1000f970 // BeachHouseEntity::`scalar deleting destructor' @@ -65,7 +67,7 @@ class PoliceEntity : public BuildingEntity { return !strcmp(p_name, PoliceEntity::ClassName()) || BuildingEntity::IsA(p_name); } - MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 + MxLong HandleClick(LegoEventNotificationParam& p_param) override; // vtable+0x50 // SYNTHETIC: LEGO1 0x1000f900 // PoliceEntity::`scalar deleting destructor' @@ -88,7 +90,7 @@ class InfoCenterEntity : public BuildingEntity { return !strcmp(p_name, InfoCenterEntity::ClassName()) || BuildingEntity::IsA(p_name); } - MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 + MxLong HandleClick(LegoEventNotificationParam& p_param) override; // vtable+0x50 // SYNTHETIC: LEGO1 0x1000f7b0 // InfoCenterEntity::`scalar deleting destructor' @@ -111,12 +113,34 @@ class HospitalEntity : public BuildingEntity { return !strcmp(p_name, HospitalEntity::ClassName()) || BuildingEntity::IsA(p_name); } - MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 + MxLong HandleClick(LegoEventNotificationParam& p_param) override; // vtable+0x50 // SYNTHETIC: LEGO1 0x1000f820 // HospitalEntity::`scalar deleting destructor' }; +// VTABLE: LEGO1 0x100d50c0 +// SIZE 0x68 +class CaveEntity : public BuildingEntity { + // FUNCTION: LEGO1 0x1000f1e0 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0300 + return "RaceStandsEntity"; + } + + // FUNCTION: LEGO1 0x1000f1f0 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, CaveEntity::ClassName()) || BuildingEntity::IsA(p_name); + } + + MxLong HandleClick(LegoEventNotificationParam& p_param) override; + + // SYNTHETIC: LEGO1 0x1000fa50 + // CaveEntity::`scalar deleting destructor' +}; + // VTABLE: LEGO1 0x100d5200 // SIZE 0x68 class JailEntity : public BuildingEntity { @@ -133,8 +157,7 @@ class JailEntity : public BuildingEntity { return !strcmp(p_name, JailEntity::ClassName()) || BuildingEntity::IsA(p_name); } - // STUB: LEGO1 0x100154f0 - MxLong VTable0x50(MxParam& p_param) override { return 0; } + MxLong HandleClick(LegoEventNotificationParam& p_param) override; // SYNTHETIC: LEGO1 0x1000fac0 // JailEntity::`scalar deleting destructor' @@ -157,7 +180,7 @@ class GasStationEntity : public BuildingEntity { return !strcmp(p_name, GasStationEntity::ClassName()) || BuildingEntity::IsA(p_name); } - MxLong VTable0x50(MxParam& p_param) override; + MxLong HandleClick(LegoEventNotificationParam& p_param) override; // SYNTHETIC: LEGO1 0x1000f890 // GasStationEntity::`scalar deleting destructor' 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/caveentity.h b/LEGO1/lego/legoomni/include/caveentity.h deleted file mode 100644 index 308f35bc..00000000 --- a/LEGO1/lego/legoomni/include/caveentity.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef CAVEENTITY_H -#define CAVEENTITY_H - -#include "buildings.h" - -// No overrides, uses vtable from RaceStandsEntity -// SIZE 0x68 -class CaveEntity : public RaceStandsEntity {}; - -#endif // CAVEENTITY_H diff --git a/LEGO1/lego/legoomni/include/doors.h b/LEGO1/lego/legoomni/include/doors.h index be61fd15..30bc1448 100644 --- a/LEGO1/lego/legoomni/include/doors.h +++ b/LEGO1/lego/legoomni/include/doors.h @@ -7,6 +7,8 @@ // SIZE 0x1f8 class Doors : public LegoPathActor { public: + Doors() : m_unk0x154(0), m_unk0x15c(0), m_unk0x160(0), m_unk0x1f4(0) {} + // FUNCTION: LEGO1 0x1000e430 inline const char* ClassName() const override // vtable+0x0c { 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/gasstation.h b/LEGO1/lego/legoomni/include/gasstation.h index 6a37db84..75234a25 100644 --- a/LEGO1/lego/legoomni/include/gasstation.h +++ b/LEGO1/lego/legoomni/include/gasstation.h @@ -33,7 +33,7 @@ class GasStationState : public LegoState { return !strcmp(p_name, GasStationState::ClassName()) || LegoState::IsA(p_name); } - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c // SYNTHETIC: LEGO1 0x10006290 // GasStationState::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/helicopter.h b/LEGO1/lego/legoomni/include/helicopter.h index 2676aa52..7e63407d 100644 --- a/LEGO1/lego/legoomni/include/helicopter.h +++ b/LEGO1/lego/legoomni/include/helicopter.h @@ -9,6 +9,8 @@ // SIZE 0x0c class HelicopterState : public LegoState { public: + HelicopterState() : m_unk0x08(0) {} + // FUNCTION: LEGO1 0x1000e0d0 inline const char* ClassName() const override // vtable+0x0c { diff --git a/LEGO1/lego/legoomni/include/hospital.h b/LEGO1/lego/legoomni/include/hospital.h index 32377fe3..4c453240 100644 --- a/LEGO1/lego/legoomni/include/hospital.h +++ b/LEGO1/lego/legoomni/include/hospital.h @@ -36,7 +36,7 @@ class HospitalState : public LegoState { return !strcmp(p_name, HospitalState::ClassName()) || LegoState::IsA(p_name); } - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c // SYNTHETIC: LEGO1 0x100764c0 // HospitalState::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index 8af16007..d1faaa16 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; @@ -88,8 +88,8 @@ class Act1State : public LegoState { return !strcmp(p_name, Act1State::ClassName()) || LegoState::IsA(p_name); } - MxBool SetFlag() override; // vtable+0x18 - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + MxBool SetFlag() override; // vtable+0x18 + MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c void FUN_10034660(); void FUN_100346a0(); @@ -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 48aef88f..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,11 +119,11 @@ 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 - virtual void SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p_flags); // vtable+0xe8 + virtual void SpawnPlayer(LegoGameState::Area p_area, MxBool p_enter, MxU8 p_flags); // vtable+0xe8 virtual void VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundary, MxBool p_reset); // vtable+0xec // SYNTHETIC: LEGO1 0x10002ff0 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/jukebox.h b/LEGO1/lego/legoomni/include/jukebox.h index 8b624191..5ae7ba34 100644 --- a/LEGO1/lego/legoomni/include/jukebox.h +++ b/LEGO1/lego/legoomni/include/jukebox.h @@ -21,6 +21,8 @@ class JukeBoxState : public LegoState { e_torpedos }; + JukeBoxState() : m_music(e_pasquell), m_active(FALSE) {} + // FUNCTION: LEGO1 0x1000f310 inline const char* ClassName() const override // vtable+0x0c { diff --git a/LEGO1/lego/legoomni/include/legoact2.h b/LEGO1/lego/legoomni/include/legoact2.h index 504f0598..93e43a69 100644 --- a/LEGO1/lego/legoomni/include/legoact2.h +++ b/LEGO1/lego/legoomni/include/legoact2.h @@ -5,10 +5,17 @@ #include "legostate.h" #include "legoworld.h" +class Act2Actor; + // VTABLE: LEGO1 0x100d4a70 // SIZE 0x10 class LegoAct2State : public LegoState { public: + LegoAct2State() + { + m_unk0x08 = 0; + m_unk0x0c = 0; + } ~LegoAct2State() override {} // FUNCTION: LEGO1 0x1000df80 @@ -43,6 +50,7 @@ class LegoAct2State : public LegoState { // SIZE 0x1154 class LegoAct2 : public LegoWorld { public: + LegoAct2(); ~LegoAct2() override; MxLong Notify(MxParam& p_param) override; // vtable+0x04 @@ -54,6 +62,7 @@ class LegoAct2 : public LegoWorld { MxBool Escape() override; // vtable+0x64 void Enable(MxBool p_enable) override; // vtable+0x68 + inline void SetUnknown0x1138(Act2Actor* p_unk0x1138) { m_unk0x1138 = p_unk0x1138; } inline void SetUnknown0x1150(undefined4 p_unk0x1150) { m_unk0x1150 = p_unk0x1150; } // SYNTHETIC: LEGO1 0x1004fe20 @@ -78,7 +87,7 @@ class LegoAct2 : public LegoWorld { undefined4 m_unk0x112c; // 0x112c undefined4 m_unk0x1130; // 0x1130 undefined4 m_unk0x1134; // 0x1134 - undefined4 m_unk0x1138; // 0x1138 + Act2Actor* m_unk0x1138; // 0x1138 undefined m_unk0x113c; // 0x113c undefined4 m_unk0x1140; // 0x1140 undefined4 m_unk0x1144; // 0x1144 diff --git a/LEGO1/lego/legoomni/include/legoactioncontrolpresenter.h b/LEGO1/lego/legoomni/include/legoactioncontrolpresenter.h index c46aec5b..f75e00a6 100644 --- a/LEGO1/lego/legoomni/include/legoactioncontrolpresenter.h +++ b/LEGO1/lego/legoomni/include/legoactioncontrolpresenter.h @@ -10,7 +10,7 @@ // SIZE 0x68 class LegoActionControlPresenter : public MxMediaPresenter { public: - LegoActionControlPresenter() { m_unk0x50 = Extra::ActionType::e_none; } + LegoActionControlPresenter() : m_unk0x50(Extra::ActionType::e_none) {} ~LegoActionControlPresenter() override { Destroy(TRUE); } // vtable+0x00 // FUNCTION: BETA10 0x100a7840 diff --git a/LEGO1/lego/legoomni/include/legoanimactor.h b/LEGO1/lego/legoomni/include/legoanimactor.h index 296c48d0..695ce832 100644 --- a/LEGO1/lego/legoomni/include/legoanimactor.h +++ b/LEGO1/lego/legoomni/include/legoanimactor.h @@ -62,6 +62,9 @@ class LegoAnimActor : public virtual LegoPathActor { }; // clang-format off +// GLOBAL: LEGO1 0x100d5438 +// LegoAnimActor::`vbtable' + // TEMPLATE: LEGO1 0x1000da20 // vector >::~vector > diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 8e473077..018a0059 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -68,8 +68,8 @@ class AnimState : public LegoState { return !strcmp(p_name, AnimState::ClassName()) || LegoState::IsA(p_name); } - MxBool SetFlag() override; // vtable+0x18 - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + MxBool SetFlag() override; // vtable+0x18 + MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c void FUN_100651d0(MxU32, AnimInfo*, MxU32&); void FUN_10065240(MxU32, AnimInfo*, MxU32); @@ -79,10 +79,14 @@ class AnimState : public LegoState { private: undefined4 m_unk0x08; // 0x08 + // appears to store the length of m_unk0x10 undefined4 m_unk0x0c; // 0x0c - void* m_unk0x10; // 0x10 + // dynamically sized array of two-byte elements + undefined2* m_unk0x10; // 0x10 + // appears to store the length of m_unk0x18 undefined4 m_unk0x14; // 0x14 - void* m_unk0x18; // 0x18 + // dynamically sized array of one-byte elements + undefined* m_unk0x18; // 0x18 }; // VTABLE: LEGO1 0x100d8c18 diff --git a/LEGO1/lego/legoomni/include/legocarbuild.h b/LEGO1/lego/legoomni/include/legocarbuild.h index ed486c9f..d11056c1 100644 --- a/LEGO1/lego/legoomni/include/legocarbuild.h +++ b/LEGO1/lego/legoomni/include/legocarbuild.h @@ -8,7 +8,7 @@ // SIZE 0x50 class LegoVehicleBuildState : public LegoState { public: - LegoVehicleBuildState(char* p_classType); + LegoVehicleBuildState(const char* p_classType); // FUNCTION: LEGO1 0x10025ff0 inline const char* ClassName() const override // vtable+0x0c @@ -22,7 +22,7 @@ class LegoVehicleBuildState : public LegoState { return !strcmp(p_name, this->m_className.GetData()) || LegoState::IsA(p_name); } - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c // SYNTHETIC: LEGO1 0x100260a0 // LegoVehicleBuildState::`scalar deleting destructor' @@ -49,6 +49,11 @@ class LegoVehicleBuildState : public LegoState { MxU8 m_placedPartCount; // 0x4f }; +typedef LegoVehicleBuildState LegoRaceCarBuildState; +typedef LegoVehicleBuildState LegoCopterBuildState; +typedef LegoVehicleBuildState LegoDuneCarBuildState; +typedef LegoVehicleBuildState LegoJetskiBuildState; + // VTABLE: LEGO1 0x100d6658 // SIZE 0x34c class LegoCarBuild : public LegoWorld { diff --git a/LEGO1/lego/legoomni/include/legocarraceactor.h b/LEGO1/lego/legoomni/include/legocarraceactor.h index 41994ea5..62b560de 100644 --- a/LEGO1/lego/legoomni/include/legocarraceactor.h +++ b/LEGO1/lego/legoomni/include/legocarraceactor.h @@ -3,25 +3,23 @@ #include "legoraceactor.h" -/* - VTABLE: LEGO1 0x100da0c0 LegoRaceActor - VTABLE: LEGO1 0x100da0c8 LegoAnimActor - VTABLE: LEGO1 0x100da0d8 LegoPathActor - VTABLE: LEGO1 0x100da1a8 LegoCarRaceActor -*/ +// VTABLE: LEGO1 0x100da0c0 LegoRaceActor +// VTABLE: LEGO1 0x100da0c8 LegoAnimActor +// VTABLE: LEGO1 0x100da0d8 LegoPathActor +// VTABLE: LEGO1 0x100da1a8 LegoCarRaceActor // SIZE 0x1a0 class LegoCarRaceActor : public virtual LegoRaceActor { public: LegoCarRaceActor(); - // FUNCTION: LEGO1 0x10081650 + // FUNCTION: LEGO1 0x10081660 inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0568 return "LegoCarRaceActor"; } - // FUNCTION: LEGO1 0x10081670 + // FUNCTION: LEGO1 0x10081680 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoCarRaceActor::ClassName()) || LegoRaceActor::IsA(p_name); @@ -34,10 +32,8 @@ class LegoCarRaceActor : public virtual LegoRaceActor { float p_f1, float p_f2, Vector3& p_v3 - ) override; // vtable+0x6c - void VTable0x70(float p_float) override; // vtable+0x70 - MxU32 VTable0x90(float, Matrix4&) override; // vtable+0x90 - MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 + ) override; // vtable+0x6c + void VTable0x70(float p_float) override; // vtable+0x70 void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) override; // vtable+0x98 MxResult VTable0x9c() override; // vtable+0x9c @@ -64,7 +60,7 @@ class LegoCarRaceActor : public virtual LegoRaceActor { virtual void VTable0x1c(); // vtable+0x1c - // SYNTHETIC: LEGO1 0x10081610 + // SYNTHETIC: LEGO1 0x10081620 // LegoCarRaceActor::`scalar deleting destructor' protected: diff --git a/LEGO1/lego/legoomni/include/legojetski.h b/LEGO1/lego/legoomni/include/legojetski.h index 30000b5d..51a4d524 100644 --- a/LEGO1/lego/legoomni/include/legojetski.h +++ b/LEGO1/lego/legoomni/include/legojetski.h @@ -4,28 +4,27 @@ #include "legojetskiraceactor.h" #include "legoracemap.h" -/* - VTABLE: LEGO1 0x100d5a08 LegoJetskiRaceActor - VTABLE: LEGO1 0x100d5a28 LegoRaceActor - VTABLE: LEGO1 0x100d5a30 LegoAnimActor - VTABLE: LEGO1 0x100d5a40 LegoPathActor - VTABLE: LEGO1 0x100d5b10 LegoRaceMap -*/ +// VTABLE: LEGO1 0x100d5a08 LegoJetskiRaceActor +// VTABLE: LEGO1 0x100d5a28 LegoRaceActor +// VTABLE: LEGO1 0x100d5a30 LegoAnimActor +// VTABLE: LEGO1 0x100d5a40 LegoPathActor +// VTABLE: LEGO1 0x100d5b10 LegoRaceMap // SIZE 0x1dc class LegoJetski : public LegoJetskiRaceActor, public LegoRaceMap { public: LegoJetski(); + ~LegoJetski() override; MxLong Notify(MxParam& p_param) override; // vtable+0x04 - // FUNCTION: LEGO1 0x10013e80 + // FUNCTION: LEGO1 0x10013e90 inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f053c return "LegoJetski"; } - // FUNCTION: LEGO1 0x10013ea0 + // FUNCTION: LEGO1 0x10013eb0 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoJetski::ClassName()) || LegoJetskiRaceActor::IsA(p_name); @@ -49,7 +48,7 @@ class LegoJetski : public LegoJetskiRaceActor, public LegoRaceMap { virtual void FUN_100136f0(float p_worldSpeed); - // SYNTHETIC: LEGO1 0x10013e20 + // SYNTHETIC: LEGO1 0x10013e30 // LegoJetski::`scalar deleting destructor' }; diff --git a/LEGO1/lego/legoomni/include/legojetskiraceactor.h b/LEGO1/lego/legoomni/include/legojetskiraceactor.h index 27ba401a..1676f4fe 100644 --- a/LEGO1/lego/legoomni/include/legojetskiraceactor.h +++ b/LEGO1/lego/legoomni/include/legojetskiraceactor.h @@ -3,25 +3,23 @@ #include "legocarraceactor.h" -/* - VTABLE: LEGO1 0x100da208 LegoCarRaceActor - VTABLE: LEGO1 0x100da228 LegoRaceActor - VTABLE: LEGO1 0x100da230 LegoAnimActor - VTABLE: LEGO1 0x100da240 LegoPathActor -*/ +// VTABLE: LEGO1 0x100da208 LegoCarRaceActor +// VTABLE: LEGO1 0x100da228 LegoRaceActor +// VTABLE: LEGO1 0x100da230 LegoAnimActor +// VTABLE: LEGO1 0x100da240 LegoPathActor // SIZE 0x1a8 class LegoJetskiRaceActor : public virtual LegoCarRaceActor { public: LegoJetskiRaceActor(); - // FUNCTION: LEGO1 0x10081d80 + // FUNCTION: LEGO1 0x10081d90 inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0554 return "LegoJetskiRaceActor"; } - // FUNCTION: LEGO1 0x10081da0 + // FUNCTION: LEGO1 0x10081db0 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoJetskiRaceActor::ClassName()) || LegoCarRaceActor::IsA(p_name); @@ -36,12 +34,9 @@ class LegoJetskiRaceActor : public virtual LegoCarRaceActor { Vector3& p_v3 ) override; // vtable+0x6c void VTable0x70(float p_float) override; // vtable+0x70 - void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) - override; // vtable+0x98 - MxResult VTable0x9c() override; // vtable+0x9c - void VTable0x1c() override; // vtable+0x1c + void VTable0x1c() override; // vtable+0x1c - // SYNTHETIC: LEGO1 0x10081d40 + // SYNTHETIC: LEGO1 0x10081d50 // LegoJetskiRaceActor::`scalar deleting destructor' }; diff --git a/LEGO1/lego/legoomni/include/legomain.h b/LEGO1/lego/legoomni/include/legomain.h index 98245c5c..95cf7324 100644 --- a/LEGO1/lego/legoomni/include/legomain.h +++ b/LEGO1/lego/legoomni/include/legomain.h @@ -127,7 +127,7 @@ class LegoOmni : public MxOmni { ViewLODListManager* GetViewLODListManager() { return m_viewLODListManager; } LegoWorld* GetCurrentWorld() { return m_currentWorld; } LegoNavController* GetNavController() { return m_navController; } - LegoPathActor* GetCurrentActor() { return m_currentActor; } + LegoPathActor* GetUserActor() { return m_userActor; } LegoPlantManager* GetPlantManager() { return m_plantManager; } LegoAnimationManager* GetAnimationManager() { return m_animationManager; } LegoBuildingManager* GetBuildingManager() { return m_buildingManager; } @@ -139,7 +139,7 @@ class LegoOmni : public MxOmni { LegoWorldList* GetWorldList() { return m_worldList; } inline void SetNavController(LegoNavController* p_navController) { m_navController = p_navController; } - inline void SetCurrentActor(LegoPathActor* p_currentActor) { m_currentActor = p_currentActor; } + inline void SetUserActor(LegoPathActor* p_userActor) { m_userActor = p_userActor; } inline void SetCurrentWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; } inline void SetExit(MxBool p_exit) { m_exit = p_exit; } inline MxResult StartActionIfUnknown0x13c(MxDSAction& p_dsAction) @@ -162,7 +162,7 @@ class LegoOmni : public MxOmni { LegoWorld* m_currentWorld; // 0x7c MxBool m_exit; // 0x80 LegoNavController* m_navController; // 0x84 - LegoPathActor* m_currentActor; // 0x88 + LegoPathActor* m_userActor; // 0x88 LegoCharacterManager* m_characterManager; // 0x8c LegoPlantManager* m_plantManager; // 0x90 LegoAnimationManager* m_animationManager; // 0x94 diff --git a/LEGO1/lego/legoomni/include/legoobjectfactory.h b/LEGO1/lego/legoomni/include/legoobjectfactory.h index ceb5f56e..e77cb802 100644 --- a/LEGO1/lego/legoomni/include/legoobjectfactory.h +++ b/LEGO1/lego/legoomni/include/legoobjectfactory.h @@ -8,20 +8,20 @@ X(LegoActorPresenter) \ X(LegoWorldPresenter) \ X(LegoWorld) \ - X(LegoAnimPresenter) \ X(LegoModelPresenter) \ X(LegoTexturePresenter) \ X(LegoPhonemePresenter) \ X(LegoFlcTexturePresenter) \ X(LegoPalettePresenter) \ X(LegoPathPresenter) \ + X(LegoAnimPresenter) \ X(LegoLoopingAnimPresenter) \ X(LegoLocomotionAnimPresenter) \ X(LegoHideAnimPresenter) \ X(LegoPartPresenter) \ X(LegoCarBuildAnimPresenter) \ X(LegoActionControlPresenter) \ - X(MxVideoPresenter) \ + X(LegoMeterPresenter) \ X(LegoLoadCacheSoundPresenter) \ X(Lego3DWavePresenter) \ X(LegoActor) \ @@ -49,6 +49,10 @@ X(LegoAct2) \ X(LegoAct2State) \ X(CarRace) \ + X(LegoRaceCarBuildState) \ + X(LegoCopterBuildState) \ + X(LegoDuneCarBuildState) \ + X(LegoJetskiBuildState) \ X(HospitalState) \ X(InfocenterState) \ X(PoliceState) \ @@ -61,7 +65,7 @@ X(PizzaMissionState) \ X(Act2Actor) \ X(Act2Brick) \ - /*X(Act2GenActor)*/ \ + X(Act2GenActor) \ X(Act2PoliceStation) \ X(Act3) \ X(Act3State) \ @@ -75,8 +79,8 @@ X(AmbulanceMissionState) \ X(TowTrack) \ X(TowTrackMissionState) \ - /*X(Act3Cop)*/ \ - /*X(Act3Brickster)*/ \ + X(Act3Cop) \ + X(Act3Brickster) \ X(Act3Shark) \ X(BumpBouy) \ X(Act3Actor) \ 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..84d3689a 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,28 @@ 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; } + + inline MxResult Serialize(LegoFile* p_file) + { + if (p_file->IsReadMode()) { + Read(p_file, &m_id); + Read(p_file, &m_unk0x02); + Read(p_file, &m_score); + } + else if (p_file->IsWriteMode()) { + Write(p_file, m_id); + Write(p_file, m_unk0x02); + Write(p_file, m_score); + } + + return SUCCESS; + } // TODO: Possibly private MxU8 m_id; // 0x00 MxS16 m_unk0x02; // 0x02 - MxU16 m_score; // 0x04 + MxS16 m_score; // 0x04 }; RaceState(); @@ -46,7 +62,7 @@ class RaceState : public LegoState { return !strcmp(p_name, RaceState::ClassName()) || LegoState::IsA(p_name); } - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c Entry* GetState(MxU8 p_id); @@ -98,11 +114,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/legoraceactor.h b/LEGO1/lego/legoomni/include/legoraceactor.h index 92f1e8c7..46423f95 100644 --- a/LEGO1/lego/legoomni/include/legoraceactor.h +++ b/LEGO1/lego/legoomni/include/legoraceactor.h @@ -5,40 +5,35 @@ class Matrix4; -/* - VTABLE: LEGO1 0x100d5b78 LegoAnimActor - VTABLE: LEGO1 0x100d5b88 LegoPathActor - VTABLE: LEGO1 0x100d5c54 LegoRaceActor -*/ +// VTABLE: LEGO1 0x100d5b78 LegoAnimActor +// VTABLE: LEGO1 0x100d5b88 LegoPathActor +// VTABLE: LEGO1 0x100d5c54 LegoRaceActor // SIZE 0x180 class LegoRaceActor : public virtual LegoAnimActor { public: LegoRaceActor(); - // FUNCTION: LEGO1 0x10014af0 + // FUNCTION: LEGO1 0x10014b00 inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0bf4 return "LegoRaceActor"; } - // FUNCTION: LEGO1 0x10014b10 + // FUNCTION: LEGO1 0x10014b20 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { return !strcmp(p_name, LegoRaceActor::ClassName()) || LegoAnimActor::IsA(p_name); } - void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30 MxS32 VTable0x68(Vector3&, Vector3&, Vector3&) override; // vtable+0x68 - void VTable0x70(float p_float) override; // vtable+0x70 - void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 MxU32 VTable0x90(float, Matrix4&) override; // vtable+0x90 MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94 // FUNCTION: LEGO1 0x10014aa0 virtual MxResult FUN_10014aa0() { return SUCCESS; } - // SYNTHETIC: LEGO1 0x10014ab0 + // SYNTHETIC: LEGO1 0x10014ac0 // LegoRaceActor::`scalar deleting destructor' private: diff --git a/LEGO1/lego/legoomni/include/legoracecar.h b/LEGO1/lego/legoomni/include/legoracecar.h index 51c248ca..18504c72 100644 --- a/LEGO1/lego/legoomni/include/legoracecar.h +++ b/LEGO1/lego/legoomni/include/legoracecar.h @@ -4,30 +4,30 @@ #include "legocarraceactor.h" #include "legoracemap.h" -/* - VTABLE: LEGO1 0x100d58a0 LegoRaceActor - VTABLE: LEGO1 0x100d58a8 LegoAnimActor - VTABLE: LEGO1 0x100d58b8 LegoPathActor - VTABLE: LEGO1 0x100d5894 LegoRaceMap - VTABLE: LEGO1 0x100d5898 LegoCarRaceActor -*/ +// VTABLE: LEGO1 0x100d58a0 LegoRaceActor +// VTABLE: LEGO1 0x100d58a8 LegoAnimActor +// VTABLE: LEGO1 0x100d58b8 LegoPathActor +// VTABLE: LEGO1 0x100d5984 LegoRaceMap +// VTABLE: LEGO1 0x100d5988 LegoCarRaceActor // SIZE 0x200 class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap { public: LegoRaceCar(); + ~LegoRaceCar() override; + MxLong Notify(MxParam& p_param) override; // vtable+0x04 - // FUNCTION: LEGO1 0x10014290 + // FUNCTION: LEGO1 0x100142a0 inline const char* ClassName() const override // vtable+0x0c { // STRING: LEGO1 0x100f0548 return "LegoRaceCar"; } - // FUNCTION: LEGO1 0x100142b0 + // FUNCTION: LEGO1 0x100142c0 inline MxBool IsA(const char* p_name) const override // vtable+0x10 { - return !strcmp(p_name, LegoCarRaceActor::ClassName()) || LegoCarRaceActor::IsA(p_name); + return !strcmp(p_name, LegoRaceCar::ClassName()) || LegoCarRaceActor::IsA(p_name); } void ParseAction(char*) override; // vtable+0x20 @@ -50,7 +50,7 @@ class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap { virtual void FUN_10012ff0(float); virtual MxBool FUN_10013130(float); - // SYNTHETIC: LEGO1 0x10014230 + // SYNTHETIC: LEGO1 0x10014240 // LegoRaceCar::`scalar deleting destructor' private: diff --git a/LEGO1/lego/legoomni/include/legoracemap.h b/LEGO1/lego/legoomni/include/legoracemap.h index 11d3d69d..99625dd9 100644 --- a/LEGO1/lego/legoomni/include/legoracemap.h +++ b/LEGO1/lego/legoomni/include/legoracemap.h @@ -3,20 +3,25 @@ #include "legoraceactor.h" -/* - VTABLE: LEGO1 0x100d8858 LegoRaceActor - VTABLE: LEGO1 0x100d8860 LegoAnimActor - VTABLE: LEGO1 0x100d8870 LegoPathActor - VTABLE: LEGO1 0x100d893c LegoRaceMap -*/ +// VTABLE: LEGO1 0x100d8858 LegoRaceActor +// VTABLE: LEGO1 0x100d8860 LegoAnimActor +// VTABLE: LEGO1 0x100d8870 LegoPathActor +// VTABLE: LEGO1 0x100d893c LegoRaceMap // SIZE 0x1b4 class LegoRaceMap : public virtual LegoRaceActor { public: LegoRaceMap(); + ~LegoRaceMap() override; - virtual void FUN_1005d4b0(); + // LegoPathActor vtable + MxLong Notify(MxParam& p_param) override; // vtable+0x04 + void ParseAction(char* p_extra) override; // vtable+0x20 + void VTable0x70(float p_und) override = 0; // vtable+0x70 - // SYNTHETIC: LEGO1 0x1005d5c0 + // LegoRaceMap vtable + virtual void FUN_1005d4b0(); // vtable+0x00 + + // SYNTHETIC: LEGO1 0x1005d5d0 // LegoRaceMap::`scalar deleting destructor' private: diff --git a/LEGO1/lego/legoomni/include/legostate.h b/LEGO1/lego/legoomni/include/legostate.h index 21ddde85..766da110 100644 --- a/LEGO1/lego/legoomni/include/legostate.h +++ b/LEGO1/lego/legoomni/include/legostate.h @@ -9,39 +9,12 @@ // SIZE 0x08 class LegoState : public MxCore { public: - // FUNCTION: LEGO1 0x10005f40 - ~LegoState() override {} - - // FUNCTION: LEGO1 0x100060d0 - inline const char* ClassName() const override // vtable+0x0c - { - // STRING: LEGO1 0x100f01b8 - return "LegoState"; - } - - // FUNCTION: LEGO1 0x100060e0 - inline MxBool IsA(const char* p_name) const override // vtable+0x10 - { - return !strcmp(p_name, LegoState::ClassName()) || MxCore::IsA(p_name); - } - - // FUNCTION: LEGO1 0x10005f90 - virtual MxBool IsSerializable() { return TRUE; } // vtable+0x14 - - // FUNCTION: LEGO1 0x10005fa0 - virtual MxBool SetFlag() { return FALSE; } // vtable+0x18 - - // FUNCTION: LEGO1 0x10005fb0 - virtual MxResult Serialize(LegoFile* p_legoFile) - { - if (p_legoFile->IsWriteMode()) { - p_legoFile->WriteString(ClassName()); - } - return SUCCESS; - } // vtable+0x1c - - // SYNTHETIC: LEGO1 0x10006160 - // LegoState::`scalar deleting destructor' + enum ScoreColor { + e_grey = 0, + e_yellow, + e_blue, + e_red + }; // SIZE 0x0c class Playlist { @@ -85,12 +58,58 @@ class LegoState : public MxCore { inline void SetUnknown0x08(MxS16 p_unk0x08) { m_nextIndex = p_unk0x08; } + inline MxResult ReadFromFile(LegoFile* p_file) + { + Read(p_file, &m_nextIndex); + return SUCCESS; + } + + inline MxResult WriteToFile(LegoFile* p_file) + { + Write(p_file, m_nextIndex); + return SUCCESS; + } + private: MxU32* m_objectIds; // 0x00 MxS16 m_length; // 0x04 MxS16 m_mode; // 0x06 MxS16 m_nextIndex; // 0x08 }; + + // FUNCTION: LEGO1 0x10005f40 + ~LegoState() override {} + + // FUNCTION: LEGO1 0x100060d0 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f01b8 + return "LegoState"; + } + + // FUNCTION: LEGO1 0x100060e0 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, LegoState::ClassName()) || MxCore::IsA(p_name); + } + + // FUNCTION: LEGO1 0x10005f90 + virtual MxBool IsSerializable() { return TRUE; } // vtable+0x14 + + // FUNCTION: LEGO1 0x10005fa0 + virtual MxBool SetFlag() { return FALSE; } // vtable+0x18 + + // FUNCTION: LEGO1 0x10005fb0 + virtual MxResult Serialize(LegoFile* p_file) + { + if (p_file->IsWriteMode()) { + p_file->WriteString(ClassName()); + } + return SUCCESS; + } // vtable+0x1c + + // SYNTHETIC: LEGO1 0x10006160 + // LegoState::`scalar deleting destructor' }; #endif // LEGOSTATE_H diff --git a/LEGO1/lego/legoomni/include/legoutils.h b/LEGO1/lego/legoomni/include/legoutils.h index 74545513..adb09677 100644 --- a/LEGO1/lego/legoomni/include/legoutils.h +++ b/LEGO1/lego/legoomni/include/legoutils.h @@ -1,6 +1,7 @@ #ifndef LEGOUTILS_H #define LEGOUTILS_H +#include "actionsfwd.h" #include "decomp.h" #include "extra.h" #include "mxtypes.h" @@ -33,8 +34,11 @@ class LegoPathActor; class LegoROI; class LegoTreeNode; +extern MxAtomId* g_isleScript; + LegoEntity* PickEntity(MxLong, MxLong); LegoROI* PickROI(MxLong, MxLong); +LegoROI* PickParentROI(MxLong p_a, MxLong p_b); MxS16 CountTotalTreeNodes(LegoTreeNode* p_node); void FUN_1003e050(LegoAnimPresenter* p_presenter); Extra::ActionType MatchActionString(const char*); @@ -54,6 +58,14 @@ LegoNamedTexture* ReadNamedTexture(LegoFile* p_file); void FUN_1003f540(LegoFile* p_file, const char* p_filename); void WriteNamedTexture(LegoFile* p_file, LegoNamedTexture* p_texture); +// FUNCTION: BETA10 0x100260a0 +inline void StartIsleAction(IsleScript::Script p_objectId) +{ + if (p_objectId != (IsleScript::Script) -1) { + InvokeAction(Extra::e_start, *g_isleScript, p_objectId, NULL); + } +} + // SYNTHETIC: LEGO1 0x10034b40 // LegoTexture::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legovariables.h b/LEGO1/lego/legoomni/include/legovariables.h index 9ef1a197..582c5b58 100644 --- a/LEGO1/lego/legoomni/include/legovariables.h +++ b/LEGO1/lego/legoomni/include/legovariables.h @@ -3,6 +3,7 @@ #include "mxvariable.h" +extern const char* g_varAMBULSPEED; extern const char* g_varAMBULFUEL; extern const char* g_varTOWFUEL; extern const char* g_varVISIBILITY; diff --git a/LEGO1/lego/legoomni/include/misc.h b/LEGO1/lego/legoomni/include/misc.h index 34824772..9f476ae9 100644 --- a/LEGO1/lego/legoomni/include/misc.h +++ b/LEGO1/lego/legoomni/include/misc.h @@ -40,7 +40,7 @@ LegoControlManager* ControlManager(); LegoGameState* GameState(); LegoAnimationManager* AnimationManager(); LegoNavController* NavController(); -LegoPathActor* CurrentActor(); +LegoPathActor* UserActor(); LegoWorld* CurrentWorld(); LegoCharacterManager* CharacterManager(); ViewManager* GetViewManager(); @@ -51,7 +51,7 @@ ViewLODListManager* GetViewLODListManager(); void FUN_10015820(MxBool p_disable, MxU16 p_flags); LegoROI* FindROI(const char* p_name); void SetROIVisible(const char* p_name, MxBool p_visible); -void SetCurrentActor(LegoPathActor* p_currentActor); +void SetUserActor(LegoPathActor* p_userActor); MxResult StartActionIfUnknown0x13c(MxDSAction& p_dsAction); void DeleteAction(); LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid); 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 7f1356be..433b6f0f 100644 --- a/LEGO1/lego/legoomni/include/pizza.h +++ b/LEGO1/lego/legoomni/include/pizza.h @@ -9,19 +9,45 @@ class Act1State; class SkateBoard; // VTABLE: LEGO1 0x100d7408 -// SIZE 0xb0 +// SIZE 0xb4 class PizzaMissionState : public LegoState { public: // SIZE 0x20 struct Entry { public: - undefined2 m_unk0x00; // 0x00 - MxU8 m_id; // 0x02 - undefined m_unk0x03[0x15]; // 0x03 - MxU16 m_score; // 0x18 - undefined m_unk0x18[6]; // 0x1a + inline MxResult WriteToFile(LegoFile* p_file) + { + Write(p_file, m_unk0x06); + Write(p_file, m_unk0x14); + Write(p_file, m_unk0x16); + Write(p_file, m_score); + return SUCCESS; + } + + inline MxResult ReadFromFile(LegoFile* p_file) + { + Read(p_file, &m_unk0x06); + Read(p_file, &m_unk0x14); + Read(p_file, &m_unk0x16); + Read(p_file, &m_score); + return SUCCESS; + } + + undefined2 m_unk0x00; // 0x00 + MxU8 m_id; // 0x02 + undefined m_unk0x03[3]; // 0x03 + MxS16 m_unk0x06; // 0x06 + undefined m_unk0x08[8]; // 0x08 + MxS16 m_unk0x10; // 0x10 + MxS16 m_unk0x12; // 0x12 + MxS16 m_unk0x14; // 0x14 + MxS16 m_unk0x16; // 0x16 + MxS16 m_score; // 0x18 + undefined m_unk0x1a[6]; // 0x1a }; + PizzaMissionState(); + // FUNCTION: LEGO1 0x10039290 inline const char* ClassName() const override // vtable+0x0c { @@ -35,9 +61,9 @@ class PizzaMissionState : public LegoState { return !strcmp(p_name, PizzaMissionState::ClassName()) || LegoState::IsA(p_name); } - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + MxResult Serialize(LegoFile* p_file) 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' @@ -47,6 +73,7 @@ class PizzaMissionState : public LegoState { undefined4 m_unk0x08; // 0x08 undefined4 m_unk0x0c; // 0x0c Entry m_state[5]; // 0x10 + undefined4 m_unk0xb0; // 0xb0 }; // VTABLE: LEGO1 0x100d7380 diff --git a/LEGO1/lego/legoomni/include/pizzeria.h b/LEGO1/lego/legoomni/include/pizzeria.h index 46150249..2008f629 100644 --- a/LEGO1/lego/legoomni/include/pizzeria.h +++ b/LEGO1/lego/legoomni/include/pizzeria.h @@ -35,7 +35,7 @@ class PizzeriaState : public LegoState { return !strcmp(p_name, PizzeriaState::ClassName()) || LegoState::IsA(p_name); } - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c // SYNTHETIC: LEGO1 0x10017ce0 // PizzeriaState::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/police.h b/LEGO1/lego/legoomni/include/police.h index 4c8c34eb..83394b1a 100644 --- a/LEGO1/lego/legoomni/include/police.h +++ b/LEGO1/lego/legoomni/include/police.h @@ -31,7 +31,7 @@ class PoliceState : public LegoState { return !strcmp(p_name, PoliceState::ClassName()) || LegoState::IsA(p_name); } - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c // SYNTHETIC: LEGO1 0x1005e920 // PoliceState::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/score.h b/LEGO1/lego/legoomni/include/score.h index 76a4ac8e..a11492a0 100644 --- a/LEGO1/lego/legoomni/include/score.h +++ b/LEGO1/lego/legoomni/include/score.h @@ -12,6 +12,8 @@ class MxEndActionNotificationParam; // SIZE 0x0c class ScoreState : public LegoState { public: + ScoreState() : m_playCubeTutorial(TRUE) {} + // FUNCTION: LEGO1 0x1000de40 inline const char* ClassName() const override // vtable+0x0c { diff --git a/LEGO1/lego/legoomni/include/towtrack.h b/LEGO1/lego/legoomni/include/towtrack.h index e25e8137..3b3faafe 100644 --- a/LEGO1/lego/legoomni/include/towtrack.h +++ b/LEGO1/lego/legoomni/include/towtrack.h @@ -24,9 +24,9 @@ class TowTrackMissionState : public LegoState { return !strcmp(p_name, TowTrackMissionState::ClassName()) || LegoState::IsA(p_name); } - MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c + MxResult Serialize(LegoFile* p_file) 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/act2genactor.cpp b/LEGO1/lego/legoomni/src/actors/act2genactor.cpp new file mode 100644 index 00000000..d7ade7b1 --- /dev/null +++ b/LEGO1/lego/legoomni/src/actors/act2genactor.cpp @@ -0,0 +1,10 @@ +#include "act2genactor.h" + +DECOMP_SIZE_ASSERT(Act2GenActor, 0x154) + +// STUB: LEGO1 0x10018740 +MxResult Act2GenActor::VTable0x94(LegoPathActor*, MxBool) +{ + // TODO + return SUCCESS; +} diff --git a/LEGO1/lego/legoomni/src/actors/act3brickster.cpp b/LEGO1/lego/legoomni/src/actors/act3brickster.cpp new file mode 100644 index 00000000..24340578 --- /dev/null +++ b/LEGO1/lego/legoomni/src/actors/act3brickster.cpp @@ -0,0 +1,47 @@ +#include "act3brickster.h" + +DECOMP_SIZE_ASSERT(Act3Brickster, 0x1b4) + +// STUB: LEGO1 0x10040e10 +Act3Brickster::Act3Brickster() +{ + // TODO +} + +// FUNCTION: LEGO1 0x10040f20 +Act3Brickster::~Act3Brickster() +{ + // TODO +} + +// STUB: LEGO1 0x10040ff0 +void Act3Brickster::ParseAction(char* p_extra) +{ + // TODO +} + +// STUB: LEGO1 0x10041050 +void Act3Brickster::VTable0x70(float p_und) +{ + // TODO +} + +// STUB: LEGO1 0x100416b0 +MxResult Act3Brickster::VTable0x94(LegoPathActor*, MxBool) +{ + // TODO + return SUCCESS; +} + +// STUB: LEGO1 0x10042990 +void Act3Brickster::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) +{ + // TODO +} + +// STUB: LEGO1 0x100429d0 +MxResult Act3Brickster::VTable0x9c() +{ + // TODO + return SUCCESS; +} diff --git a/LEGO1/lego/legoomni/src/actors/act3cop.cpp b/LEGO1/lego/legoomni/src/actors/act3cop.cpp new file mode 100644 index 00000000..557386ce --- /dev/null +++ b/LEGO1/lego/legoomni/src/actors/act3cop.cpp @@ -0,0 +1,35 @@ +#include "act3cop.h" + +DECOMP_SIZE_ASSERT(Act3Cop, 0x188) + +// STUB: LEGO1 0x1003fe30 +Act3Cop::Act3Cop() +{ + // TODO +} + +// STUB: LEGO1 0x1003ff70 +MxResult Act3Cop::VTable0x94(LegoPathActor*, MxBool) +{ + // TODO + return SUCCESS; +} + +// STUB: LEGO1 0x10040060 +void Act3Cop::ParseAction(char* p_extra) +{ + // TODO +} + +// STUB: LEGO1 0x100401f0 +void Act3Cop::VTable0x70(float p_und) +{ + // TODO +} + +// STUB: LEGO1 0x10040d20 +MxResult Act3Cop::VTable0x9c() +{ + // TODO + return SUCCESS; +} diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index 20d12b35..e4ea9b3b 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -1,22 +1,34 @@ #include "ambulance.h" #include "decomp.h" +#include "isle.h" #include "isle_actions.h" +#include "jukebox_actions.h" +#include "legoanimationmanager.h" #include "legocontrolmanager.h" #include "legogamestate.h" +#include "legonavcontroller.h" +#include "legopathstruct.h" #include "legoutils.h" #include "legovariables.h" #include "legoworld.h" #include "misc.h" +#include "mxactionnotificationparam.h" +#include "mxbackgroundaudiomanager.h" #include "mxmisc.h" +#include "mxsoundpresenter.h" #include "mxticklemanager.h" #include "mxtimer.h" +#include "mxtransitionmanager.h" #include "mxvariabletable.h" #include "scripts.h" DECOMP_SIZE_ASSERT(Ambulance, 0x184) DECOMP_SIZE_ASSERT(AmbulanceMissionState, 0x24) +// Flags used in isle.cpp +extern MxU32 g_isleFlags; + // FUNCTION: LEGO1 0x10035ee0 // FUNCTION: BETA10 0x10022820 Ambulance::Ambulance() @@ -24,14 +36,14 @@ 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; - m_unk0x174 = -1; + m_lastAction = IsleScript::c_noneIsle; m_unk0x172 = 0; - m_unk0x178 = -1; - m_unk0x17c = 1.0; + m_lastAnimation = IsleScript::c_noneIsle; + m_fuel = 1.0; } // FUNCTION: LEGO1 0x10035f90 @@ -69,15 +81,34 @@ MxResult Ambulance::Create(MxDSAction& p_dsAction) } VariableTable()->SetVariable(g_varAMBULFUEL, "1.0"); - m_unk0x17c = 1.0; + m_fuel = 1.0; m_time = Timer()->GetTime(); return result; } -// STUB: LEGO1 0x10036300 -void Ambulance::VTable0x70(float p_float) +// FUNCTION: LEGO1 0x10036300 +void Ambulance::VTable0x70(float p_time) { - // TODO + IslePathActor::VTable0x70(p_time); + + if (UserActor() == this) { + char buf[200]; + float speed = abs(m_worldSpeed); + float maxLinearVel = NavController()->GetMaxLinearVel(); + + sprintf(buf, "%g", speed / maxLinearVel); + VariableTable()->SetVariable(g_varAMBULSPEED, buf); + + m_fuel += (p_time - m_time) * -3.333333333e-06f; + if (m_fuel < 0) { + m_fuel = 0; + } + + m_time = p_time; + + sprintf(buf, "%g", m_fuel); + VariableTable()->SetVariable(g_varAMBULFUEL, buf); + } } // FUNCTION: LEGO1 0x100363f0 @@ -100,7 +131,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; @@ -116,72 +147,424 @@ 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; } return result; } -// STUB: LEGO1 0x100364d0 +// FUNCTION: LEGO1 0x100364d0 // FUNCTION: BETA10 0x10022cc2 MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param) { - // TODO - return 0; + if (p_param.GetAction() != NULL) { + IsleScript::Script objectId = (IsleScript::Script) p_param.GetAction()->GetObjectId(); + + if (m_lastAnimation == objectId) { + m_lastAnimation = IsleScript::c_noneIsle; + } + + if (m_lastAction == objectId) { + if (m_lastAnimation == IsleScript::c_noneIsle) { + BackgroundAudioManager()->RaiseVolume(); + } + + m_lastAction = IsleScript::c_noneIsle; + } + else if (objectId == IsleScript::c_hho027en_RunAnim) { + m_state->m_unk0x08 = 1; + CurrentWorld()->PlaceActor(UserActor()); + HandleClick(); + m_unk0x172 = 0; + TickleManager()->RegisterClient(this, 40000); + } + else if (objectId == IsleScript::c_hpz047pe_RunAnim || objectId == IsleScript::c_hpz048pe_RunAnim || objectId == IsleScript::c_hpz049bd_RunAnim || objectId == IsleScript::c_hpz053pa_RunAnim) { + if (m_unk0x170 == 3) { + PlayAnimation(IsleScript::c_hpz055pa_RunAnim); + m_unk0x170 = 0; + } + else { + PlayAnimation(IsleScript::c_hpz053pa_RunAnim); + } + } + else if (objectId == IsleScript::c_hpz050bd_RunAnim || objectId == IsleScript::c_hpz052ma_RunAnim) { + if (m_unk0x170 == 3) { + PlayAnimation(IsleScript::c_hpz057ma_RunAnim); + m_unk0x170 = 0; + } + else { + PlayAnimation(IsleScript::c_hpz052ma_RunAnim); + } + } + else if (objectId == IsleScript::c_hpz055pa_RunAnim || objectId == IsleScript::c_hpz057ma_RunAnim) { + CurrentWorld()->PlaceActor(UserActor()); + HandleClick(); + SpawnPlayer(LegoGameState::e_pizzeriaExterior, TRUE, 0); + m_unk0x172 = 0; + TickleManager()->RegisterClient(this, 40000); + + if (m_unk0x16c != 0) { + StopActions(); + } + } + else if (objectId == IsleScript::c_hps116bd_RunAnim || objectId == IsleScript::c_hps118re_RunAnim) { + if (objectId == IsleScript::c_hps116bd_RunAnim && m_unk0x170 != 3) { + PlayAction(IsleScript::c_Avo923In_PlayWav); + } + + if (m_unk0x170 == 3) { + PlayAnimation(IsleScript::c_hps117bd_RunAnim); + m_unk0x170 = 0; + } + else { + PlayAnimation(IsleScript::c_hps118re_RunAnim); + } + } + else if (objectId == IsleScript::c_hps117bd_RunAnim) { + CurrentWorld()->PlaceActor(UserActor()); + HandleClick(); + SpawnPlayer(LegoGameState::e_unk33, TRUE, 0); + m_unk0x172 = 0; + TickleManager()->RegisterClient(this, 40000); + + if (m_unk0x16e != 0) { + StopActions(); + } + } + else if (objectId == IsleScript::c_hho142cl_RunAnim || objectId == IsleScript::c_hho143cl_RunAnim || objectId == IsleScript::c_hho144cl_RunAnim) { + FUN_10037250(); + } + } + + return 1; } -// STUB: LEGO1 0x100367c0 +// FUNCTION: LEGO1 0x100367c0 +// FUNCTION: BETA10 0x100230bf MxLong Ambulance::HandleButtonDown(LegoControlManagerEvent& p_param) { - // TODO + if (m_unk0x170 == 1) { + LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY()); + + if (roi != NULL && !strcmpi(roi->GetName(), "ps-gate")) { + m_unk0x170 = 3; + return 1; + } + + roi = PickParentROI(p_param.GetX(), p_param.GetY()); + + if (roi != NULL && !strcmpi(roi->GetName(), "gd")) { + m_unk0x170 = 3; + return 1; + } + } + 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); + } + + Leave(); + 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); + } + + Leave(); + + 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); + } + + Leave(); + PlayAnimation(IsleScript::c_hps116bd_RunAnim); + } + return 0; } -// STUB: LEGO1 0x10036ce0 +// FUNCTION: LEGO1 0x10036ce0 +// FUNCTION: BETA10 0x10023506 MxLong Ambulance::HandleClick() { - // TODO - return 0; + if (((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 != 10) { + return 1; + } + + if (m_state->m_unk0x08 == 2) { + return 1; + } + + FUN_10015820(TRUE, 0); + ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_ambulance); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + + if (UserActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) UserActor())->Exit(); + } + + m_time = Timer()->GetTime(); + m_actorId = UserActor()->GetActorId(); + + Enter(); + InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_AmbulanceDashboard, NULL); + ControlManager()->Register(this); + + if (m_state->m_unk0x08 == 1) { + SpawnPlayer(LegoGameState::e_unk31, TRUE, 0); + m_state->m_unk0x0c = Timer()->GetTime(); + InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_pns018rd_RunAnim, NULL); + } + + return 1; } -// STUB: LEGO1 0x10036e60 +// FUNCTION: LEGO1 0x10036e60 +// FUNCTION: BETA10 0x100236bb void Ambulance::FUN_10036e60() { - // TODO + m_state->m_unk0x08 = 2; + PlayAnimation(IsleScript::c_hho027en_RunAnim); + m_lastAction = IsleScript::c_noneIsle; + m_lastAnimation = IsleScript::c_noneIsle; } -// STUB: LEGO1 0x10036e90 +// FUNCTION: LEGO1 0x10036e90 void Ambulance::Exit() { - // TODO + GameState()->m_currentArea = LegoGameState::e_hospitalExterior; + StopActions(); + FUN_10037250(); + Leave(); } -// STUB: LEGO1 0x10036f90 +// FUNCTION: LEGO1 0x10036ec0 +void Ambulance::Leave() +{ + IslePathActor::Exit(); + CurrentWorld()->RemoveActor(this); + m_roi->SetVisibility(FALSE); + RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_AmbulanceDashboard_Bitmap); + RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_AmbulanceArms_Ctl); + RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_AmbulanceHorn_Ctl); + RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_AmbulanceHorn_Sound); + RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_AmbulanceInfo_Ctl); + RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_AmbulanceSpeedMeter); + RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_AmbulanceFuelMeter); + ControlManager()->Unregister(this); + TickleManager()->UnregisterClient(this); +} + +// FUNCTION: LEGO1 0x10036f90 MxLong Ambulance::HandleControl(LegoControlManagerEvent& p_param) { - // TODO - return 0; + MxLong result = 0; + + if (p_param.GetUnknown0x28() == 1) { + switch (p_param.GetClickedObjectId()) { + case IsleScript::c_AmbulanceArms_Ctl: + Exit(); + GameState()->m_currentArea = LegoGameState::e_unk66; + result = 1; + break; + case IsleScript::c_AmbulanceInfo_Ctl: + ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_infomain); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + Exit(); + GameState()->m_currentArea = LegoGameState::e_unk66; + result = 1; + break; + case IsleScript::c_AmbulanceHorn_Ctl: + MxSoundPresenter* presenter = + (MxSoundPresenter*) CurrentWorld()->Find("MxSoundPresenter", "AmbulanceHorn_Sound"); + presenter->Enable(p_param.GetUnknown0x28()); + break; + } + } + + return result; } -// STUB: LEGO1 0x10037060 -void Ambulance::FUN_10037060() +// FUNCTION: LEGO1 0x10037060 +void Ambulance::ActivateSceneActions() { - // TODO + PlayMusic(JukeboxScript::c_Hospital_Music); + + if (m_state->m_unk0x08 == 1) { + m_state->m_unk0x08 = 0; + PlayAction(IsleScript::c_ham033cl_PlayWav); + } + else if (m_unk0x16c != 0 && m_unk0x16e != 0) { + IsleScript::Script objectId; + + switch (rand() % 2) { + case 0: + objectId = IsleScript::c_ham076cl_PlayWav; + break; + case 1: + objectId = IsleScript::c_ham088cl_PlayWav; + break; + } + + if (m_lastAction != IsleScript::c_noneIsle) { + InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL); + } + + PlayAction(objectId); + } + else { + IsleScript::Script objectId; + + switch (rand() % 2) { + case 0: + objectId = IsleScript::c_ham075cl_PlayWav; + break; + case 1: + objectId = IsleScript::c_ham113cl_PlayWav; + break; + } + + if (m_lastAction != IsleScript::c_noneIsle) { + InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL); + } + + PlayAction(objectId); + } } -// STUB: LEGO1 0x10037160 +// FUNCTION: LEGO1 0x10037160 +// FUNCTION: BETA10 0x100237df MxResult Ambulance::Tickle() { - // TODO + if (m_unk0x172 == 0) { + m_unk0x172 = 1; + } + else if (m_lastAction == IsleScript::c_noneIsle) { + IsleScript::Script objectId; + + switch ((rand() % 12) + 1) { + case 1: + objectId = IsleScript::c_ham034ra_PlayWav; + break; + case 2: + objectId = IsleScript::c_ham035ra_PlayWav; + break; + case 3: + objectId = IsleScript::c_ham036ra_PlayWav; + break; + case 4: + objectId = IsleScript::c_hpz037ma_PlayWav; + break; + case 5: + objectId = IsleScript::c_sns078pa_PlayWav; + break; + case 6: + objectId = IsleScript::c_ham039ra_PlayWav; + break; + case 7: + objectId = IsleScript::c_ham040cl_PlayWav; + break; + case 8: + objectId = IsleScript::c_ham041cl_PlayWav; + break; + case 9: + objectId = IsleScript::c_ham042cl_PlayWav; + break; + case 10: + objectId = IsleScript::c_ham043cl_PlayWav; + break; + case 11: + objectId = IsleScript::c_ham044cl_PlayWav; + break; + case 12: + objectId = IsleScript::c_ham045cl_PlayWav; + break; + } + + PlayAction(objectId); + } + return SUCCESS; } @@ -191,40 +574,103 @@ void Ambulance::StopActions() StopAction(IsleScript::c_pns018rd_RunAnim); } -// STUB: LEGO1 0x10037250 +// FUNCTION: LEGO1 0x10037250 void Ambulance::FUN_10037250() { - // TODO + StopAction(m_lastAction); + BackgroundAudioManager()->RaiseVolume(); + ((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 = 0; + m_state->m_unk0x08 = 0; + m_unk0x16e = 0; + m_unk0x16c = 0; + g_isleFlags |= Isle::c_playMusic; + AnimationManager()->EnableCamAnims(TRUE); + AnimationManager()->FUN_1005f6d0(TRUE); + m_state->m_unk0x0c = INT_MIN; + m_state = NULL; +} + +// FUNCTION: LEGO1 0x100372e0 +// FUNCTION: BETA10 0x100241a0 +void Ambulance::PlayAnimation(IsleScript::Script p_objectId) +{ + AnimationManager()->FUN_10060dc0(p_objectId, NULL, TRUE, FALSE, NULL, FALSE, FALSE, FALSE, TRUE); + 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(MxS32 p_entityId) +void Ambulance::StopAction(IsleScript::Script p_objectId) { - if (p_entityId != -1) { - InvokeAction(Extra::e_stop, *g_isleScript, p_entityId, NULL); + if (p_objectId != -1) { + InvokeAction(Extra::e_stop, *g_isleScript, p_objectId, NULL); } } +// FUNCTION: LEGO1 0x10037360 +void Ambulance::PlayAction(IsleScript::Script p_objectId) +{ + if (p_objectId != -1) { + InvokeAction(Extra::e_start, *g_isleScript, p_objectId, NULL); + } + + m_lastAction = p_objectId; + BackgroundAudioManager()->LowerVolume(); +} + // 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 -MxResult AmbulanceMissionState::Serialize(LegoFile* p_legoFile) +// FUNCTION: LEGO1 0x10037440 +MxResult AmbulanceMissionState::Serialize(LegoFile* p_file) { - // TODO - return LegoState::Serialize(p_legoFile); + LegoState::Serialize(p_file); + + if (p_file->IsReadMode()) { + Read(p_file, &m_peScore); + Read(p_file, &m_maScore); + Read(p_file, &m_paScore); + Read(p_file, &m_niScore); + Read(p_file, &m_laScore); + Read(p_file, &m_peHighScore); + Read(p_file, &m_maHighScore); + Read(p_file, &m_paHighScore); + Read(p_file, &m_niHighScore); + Read(p_file, &m_laHighScore); + } + else if (p_file->IsWriteMode()) { + Write(p_file, m_peScore); + Write(p_file, m_maScore); + Write(p_file, m_paScore); + Write(p_file, m_niScore); + Write(p_file, m_laScore); + Write(p_file, m_peHighScore); + Write(p_file, m_maHighScore); + Write(p_file, m_paHighScore); + Write(p_file, m_niHighScore); + Write(p_file, m_laHighScore); + } + + return SUCCESS; } diff --git a/LEGO1/lego/legoomni/src/actors/buildingentity.cpp b/LEGO1/lego/legoomni/src/actors/buildingentity.cpp index 9491c229..6ddd84d8 100644 --- a/LEGO1/lego/legoomni/src/actors/buildingentity.cpp +++ b/LEGO1/lego/legoomni/src/actors/buildingentity.cpp @@ -21,8 +21,8 @@ BuildingEntity::~BuildingEntity() // FUNCTION: LEGO1 0x100150a0 MxLong BuildingEntity::Notify(MxParam& p_param) { - if (((MxNotificationParam&) p_param).GetType() == c_notificationClick) { - return VTable0x50(p_param); + if (((MxNotificationParam&) p_param).GetNotification() == c_notificationClick) { + return HandleClick((LegoEventNotificationParam&) p_param); } return 0; diff --git a/LEGO1/lego/legoomni/src/actors/buildings.cpp b/LEGO1/lego/legoomni/src/actors/buildings.cpp index 2d896957..79e7ef23 100644 --- a/LEGO1/lego/legoomni/src/actors/buildings.cpp +++ b/LEGO1/lego/legoomni/src/actors/buildings.cpp @@ -8,10 +8,12 @@ #include "islepathactor.h" #include "legoact2.h" #include "legoanimationmanager.h" +#include "legoeventnotificationparam.h" #include "legogamestate.h" #include "legoutils.h" #include "legoworld.h" #include "misc.h" +#include "mxbackgroundaudiomanager.h" #include "mxtransitionmanager.h" #include "scripts.h" @@ -23,13 +25,27 @@ DECOMP_SIZE_ASSERT(JailEntity, 0x68) DECOMP_SIZE_ASSERT(PoliceEntity, 0x68) DECOMP_SIZE_ASSERT(RaceStandsEntity, 0x68) +// GLOBAL: LEGO1 0x100f0c2c +// STRING: LEGO1 0x100f0c24 +const char* g_chest = "chest"; + +// GLOBAL: LEGO1 0x100f0c30 +// STRING: LEGO1 0x100f0c18 +const char* g_cavedoor = "cavedoor"; + +// GLOBAL: LEGO1 0x100f0c34 +IsleScript::Script g_nextChestAction = IsleScript::c_nca001ca_RunAnim; + +// GLOBAL: LEGO1 0x100f0c38 +IsleScript::Script g_nextCavedoorAction = IsleScript::c_Avo900Ps_PlayWav; + // FUNCTION: LEGO1 0x100150c0 -MxLong InfoCenterEntity::VTable0x50(MxParam& p_param) +MxLong InfoCenterEntity::HandleClick(LegoEventNotificationParam& p_param) { switch (GameState()->GetCurrentAct()) { case LegoGameState::Act::e_act1: { - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->Exit(); + if (UserActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) UserActor())->Exit(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); @@ -62,7 +78,7 @@ MxLong InfoCenterEntity::VTable0x50(MxParam& p_param) } // FUNCTION: LEGO1 0x100151d0 -MxLong GasStationEntity::VTable0x50(MxParam& p_param) +MxLong GasStationEntity::HandleClick(LegoEventNotificationParam& p_param) { if (FUN_1003ef60()) { Act1State* state = (Act1State*) GameState()->GetState("Act1State"); @@ -70,8 +86,8 @@ MxLong GasStationEntity::VTable0x50(MxParam& p_param) if (state->GetUnknown18() != 8) { state->SetUnknown18(0); - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->Exit(); + if (UserActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) UserActor())->Exit(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); @@ -86,7 +102,7 @@ MxLong GasStationEntity::VTable0x50(MxParam& p_param) } // FUNCTION: LEGO1 0x10015270 -MxLong HospitalEntity::VTable0x50(MxParam& p_param) +MxLong HospitalEntity::HandleClick(LegoEventNotificationParam& p_param) { if (FUN_1003ef60()) { Act1State* act1State = (Act1State*) GameState()->GetState("Act1State"); @@ -94,8 +110,8 @@ MxLong HospitalEntity::VTable0x50(MxParam& p_param) if (act1State->GetUnknown18() != 10) { act1State->SetUnknown18(0); - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->Exit(); + if (UserActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) UserActor())->Exit(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); @@ -110,7 +126,7 @@ MxLong HospitalEntity::VTable0x50(MxParam& p_param) } // FUNCTION: LEGO1 0x10015310 -MxLong PoliceEntity::VTable0x50(MxParam& p_param) +MxLong PoliceEntity::HandleClick(LegoEventNotificationParam& p_param) { if (FUN_1003ef60()) { Act1State* state = (Act1State*) GameState()->GetState("Act1State"); @@ -118,8 +134,8 @@ MxLong PoliceEntity::VTable0x50(MxParam& p_param) if (state->GetUnknown18() != 10) { state->SetUnknown18(0); - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->Exit(); + if (UserActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) UserActor())->Exit(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); @@ -134,14 +150,14 @@ MxLong PoliceEntity::VTable0x50(MxParam& p_param) } // FUNCTION: LEGO1 0x100153b0 -MxLong BeachHouseEntity::VTable0x50(MxParam& p_param) +MxLong BeachHouseEntity::HandleClick(LegoEventNotificationParam& p_param) { if (FUN_1003ef60()) { Act1State* state = (Act1State*) GameState()->GetState("Act1State"); state->SetUnknown18(0); - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->Exit(); + if (UserActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) UserActor())->Exit(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); @@ -155,14 +171,14 @@ MxLong BeachHouseEntity::VTable0x50(MxParam& p_param) } // FUNCTION: LEGO1 0x10015450 -MxLong RaceStandsEntity::VTable0x50(MxParam& p_param) +MxLong RaceStandsEntity::HandleClick(LegoEventNotificationParam& p_param) { if (FUN_1003ef60()) { Act1State* state = (Act1State*) GameState()->GetState("Act1State"); state->SetUnknown18(0); - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->Exit(); + if (UserActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) UserActor())->Exit(); } Isle* isle = (Isle*) FindWorld(*g_isleScript, IsleScript::c__Isle); @@ -174,3 +190,63 @@ MxLong RaceStandsEntity::VTable0x50(MxParam& p_param) return 1; } + +// FUNCTION: LEGO1 0x100154f0 +// FUNCTION: BETA10 0x100256e8 +MxLong JailEntity::HandleClick(LegoEventNotificationParam& p_param) +{ + if (FUN_1003ef60()) { + PlayCamAnim(UserActor(), FALSE, 18, TRUE); + } + + return 1; +} + +// FUNCTION: LEGO1 0x10015520 +// FUNCTION: BETA10 0x10025719 +MxLong CaveEntity::HandleClick(LegoEventNotificationParam& p_param) +{ + LegoROI* roi = p_param.GetROI(); + + if (!strncmp(roi->GetName(), g_chest, strlen(g_chest))) { + DeleteObjects(g_isleScript, IsleScript::c_nca001ca_RunAnim, IsleScript::c_nca003gh_RunAnim); + StartIsleAction(g_nextChestAction); + + switch (g_nextChestAction) { + case IsleScript::c_nca001ca_RunAnim: + g_nextChestAction = IsleScript::c_nca002sk_RunAnim; + break; + case IsleScript::c_nca002sk_RunAnim: + g_nextChestAction = IsleScript::c_nca003gh_RunAnim; + break; + case IsleScript::c_nca003gh_RunAnim: + g_nextChestAction = IsleScript::c_nca001ca_RunAnim; + break; + } + } + else if (!strcmp(roi->GetName(), g_cavedoor)) { + DeleteObjects(g_isleScript, IsleScript::c_Avo900Ps_PlayWav, IsleScript::c_Avo904Ps_PlayWav); + StartIsleAction(g_nextCavedoorAction); + BackgroundAudioManager()->LowerVolume(); + + switch (g_nextCavedoorAction) { + case IsleScript::c_Avo900Ps_PlayWav: + g_nextCavedoorAction = IsleScript::c_Avo901Ps_PlayWav; + break; + case IsleScript::c_Avo901Ps_PlayWav: + g_nextCavedoorAction = IsleScript::c_Avo902Ps_PlayWav; + break; + case IsleScript::c_Avo902Ps_PlayWav: + g_nextCavedoorAction = IsleScript::c_Avo903Ps_PlayWav; + break; + case IsleScript::c_Avo903Ps_PlayWav: + g_nextCavedoorAction = IsleScript::c_Avo904Ps_PlayWav; + break; + case IsleScript::c_Avo904Ps_PlayWav: + g_nextCavedoorAction = IsleScript::c_Avo900Ps_PlayWav; + break; + } + } + + return 1; +} 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/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index 5bd4b364..4b69588a 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -77,8 +77,8 @@ void Helicopter::Exit() if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { GameState()->SetCurrentArea(LegoGameState::e_copter); - if (CurrentActor() && CurrentActor()->IsA("IslePathActor")) { - ((IslePathActor*) CurrentActor()) + if (UserActor() && UserActor()->IsA("IslePathActor")) { + ((IslePathActor*) UserActor()) ->SpawnPlayer( LegoGameState::e_unk55, TRUE, @@ -115,9 +115,9 @@ MxLong Helicopter::HandleClick() AnimationManager()->FUN_1005f6d0(FALSE); - if (CurrentActor()) { - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->Exit(); + if (UserActor()) { + if (UserActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) UserActor())->Exit(); } } 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 e58ff645..43d6c91d 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -48,36 +48,36 @@ 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 void IslePathActor::Enter() { m_roi->SetVisibility(FALSE); - if (CurrentActor() != this) { + if (UserActor() != this) { m_previousVel = NavController()->GetMaxLinearVel(); - m_previousActor = CurrentActor(); + m_previousActor = UserActor(); if (m_previousActor) { m_previousActor->ResetWorldTransform(FALSE); m_previousActor->SetUserNavFlag(FALSE); @@ -91,7 +91,7 @@ void IslePathActor::Enter() NavController()->ResetMaxLinearVel(m_maxLinearVel); - SetCurrentActor(this); + SetUserActor(this); FUN_1001b660(); FUN_10010c30(); } @@ -110,7 +110,7 @@ void IslePathActor::Exit() SetUserNavFlag(FALSE); if (m_previousActor != NULL) { - SetCurrentActor(m_previousActor); + SetUserActor(m_previousActor); NavController()->ResetMaxLinearVel(m_previousVel); m_previousActor->ResetWorldTransform(TRUE); m_previousActor->SetUserNavFlag(TRUE); @@ -510,7 +510,7 @@ void IslePathActor::RegisterSpawnLocations() // FUNCTION: LEGO1 0x1001b2a0 // FUNCTION: BETA10 0x100369c6 -void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p_flags) +void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_enter, MxU8 p_flags) { MxS16 i; @@ -531,7 +531,7 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_und, MxU8 p m_world = world; - if (p_und) { + if (p_enter) { Enter(); } diff --git a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp index 1aefb3d5..6888ebfa 100644 --- a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp +++ b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp @@ -32,13 +32,13 @@ 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; } - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->Exit(); + if (UserActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) UserActor())->Exit(); } ((Isle*) FindWorld(*g_isleScript, 0))->SetDestLocation(LegoGameState::e_jukeboxw); 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/pizza.cpp b/LEGO1/lego/legoomni/src/actors/pizza.cpp index 43ef2ddb..76588406 100644 --- a/LEGO1/lego/legoomni/src/actors/pizza.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizza.cpp @@ -8,7 +8,7 @@ #include "mxticklemanager.h" DECOMP_SIZE_ASSERT(Pizza, 0x9c) -DECOMP_SIZE_ASSERT(PizzaMissionState, 0xb0) +DECOMP_SIZE_ASSERT(PizzaMissionState, 0xb4) DECOMP_SIZE_ASSERT(PizzaMissionState::Entry, 0x20) // FUNCTION: LEGO1 0x10037ef0 @@ -99,11 +99,29 @@ undefined4 Pizza::HandleEndAction(MxEndActionNotificationParam&) return 0; } -// STUB: LEGO1 0x100393c0 -MxResult PizzaMissionState::Serialize(LegoFile* p_legoFile) +// STUB: LEGO1 0x10039030 +PizzaMissionState::PizzaMissionState() { // TODO - return LegoState::Serialize(p_legoFile); +} + +// FUNCTION: LEGO1 0x100393c0 +MxResult PizzaMissionState::Serialize(LegoFile* p_file) +{ + LegoState::Serialize(p_file); + + if (p_file->IsReadMode()) { + for (MxS16 i = 0; i < 5; i++) { + m_state[i].ReadFromFile(p_file); + } + } + else if (p_file->IsWriteMode()) { + for (MxS16 i = 0; i < 5; i++) { + m_state[i].WriteToFile(p_file); + } + } + + return SUCCESS; } // FUNCTION: LEGO1 0x10039510 diff --git a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp index b1c563e3..68484768 100644 --- a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp @@ -49,9 +49,9 @@ void Pizzeria::CreateState() undefined4 Pizzeria::HandleClick() { if (FUN_1003ef60() && m_pizzaMissionState->m_unk0x0c == 0) { - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - if (!CurrentActor()->IsA("SkateBoard")) { - ((IslePathActor*) CurrentActor())->Exit(); + if (UserActor()->GetActorId() != GameState()->GetActorId()) { + if (!UserActor()->IsA("SkateBoard")) { + ((IslePathActor*) UserActor())->Exit(); } } @@ -76,9 +76,22 @@ MxU32 PizzeriaState::FUN_10017d70() return 0; } -// STUB: LEGO1 0x10017da0 -MxResult PizzeriaState::Serialize(LegoFile* p_legoFile) +// FUNCTION: LEGO1 0x10017da0 +// FUNCTION: BETA10 0x100efe33 +MxResult PizzeriaState::Serialize(LegoFile* p_file) { - // TODO - return LegoState::Serialize(p_legoFile); + MxResult res = LegoState::Serialize(p_file); + + if (p_file->IsReadMode()) { + for (MxS16 i = 0; i < 5; i++) { + m_unk0x08[i].ReadFromFile(p_file); + } + } + else { + for (MxS16 i = 0; i < 5; i++) { + m_unk0x08[i].WriteToFile(p_file); + } + } + + return res; } 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/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index 8e88733a..2c2e6c85 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -84,13 +84,13 @@ MxLong SkateBoard::HandleClick() ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::Area::e_skateboard); TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, TRUE); - if (GameState()->GetActorId() != CurrentActor()->GetActorId()) { - if (!CurrentActor()->IsA("SkateBoard")) { - ((IslePathActor*) CurrentActor())->Exit(); + if (GameState()->GetActorId() != UserActor()->GetActorId()) { + if (!UserActor()->IsA("SkateBoard")) { + ((IslePathActor*) UserActor())->Exit(); } } - if (!CurrentActor()->IsA("SkateBoard")) { + if (!UserActor()->IsA("SkateBoard")) { Enter(); InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_SkateDashboard, NULL); GetCurrentAction().SetObjectId(-1); @@ -154,7 +154,7 @@ void SkateBoard::ActivateSceneActions() if (!m_act1state->m_unk0x022) { m_act1state->m_unk0x022 = TRUE; - MxMatrix mat(CurrentActor()->GetROI()->GetLocal2World()); + MxMatrix mat(UserActor()->GetROI()->GetLocal2World()); mat.TranslateBy(mat[2][0] * 2.5, mat[2][1] + 0.2, mat[2][2] * 2.5); AnimationManager() diff --git a/LEGO1/lego/legoomni/src/actors/towtrack.cpp b/LEGO1/lego/legoomni/src/actors/towtrack.cpp index c487def5..ba51a309 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; @@ -158,52 +158,33 @@ TowTrackMissionState::TowTrackMissionState() } // FUNCTION: LEGO1 0x1004dde0 -MxResult TowTrackMissionState::Serialize(LegoFile* p_legoFile) +MxResult TowTrackMissionState::Serialize(LegoFile* p_file) { - LegoState::Serialize(p_legoFile); + LegoState::Serialize(p_file); - if (p_legoFile->IsReadMode()) { - p_legoFile->Read(&m_unk0x12, sizeof(m_unk0x12)); - p_legoFile->Read(&m_unk0x14, sizeof(m_unk0x14)); - p_legoFile->Read(&m_unk0x16, sizeof(m_unk0x16)); - p_legoFile->Read(&m_unk0x18, sizeof(m_unk0x18)); - p_legoFile->Read(&m_unk0x1a, sizeof(m_unk0x1a)); - p_legoFile->Read(&m_score1, sizeof(m_score1)); - p_legoFile->Read(&m_score2, sizeof(m_score2)); - p_legoFile->Read(&m_score3, sizeof(m_score3)); - p_legoFile->Read(&m_score4, sizeof(m_score4)); - p_legoFile->Read(&m_score5, sizeof(m_score5)); + if (p_file->IsReadMode()) { + Read(p_file, &m_unk0x12); + Read(p_file, &m_unk0x14); + Read(p_file, &m_unk0x16); + Read(p_file, &m_unk0x18); + Read(p_file, &m_unk0x1a); + Read(p_file, &m_score1); + Read(p_file, &m_score2); + Read(p_file, &m_score3); + Read(p_file, &m_score4); + Read(p_file, &m_score5); } - else if (p_legoFile->IsWriteMode()) { - MxU16 write = m_unk0x12; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_unk0x14; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_unk0x16; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_unk0x18; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_unk0x1a; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_score1; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_score2; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_score3; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_score4; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - - write = m_score5; - p_legoFile->Write(&write, sizeof(m_unk0x12)); + else if (p_file->IsWriteMode()) { + Write(p_file, m_unk0x12); + Write(p_file, m_unk0x14); + Write(p_file, m_unk0x16); + Write(p_file, m_unk0x18); + Write(p_file, m_unk0x1a); + Write(p_file, m_score1); + Write(p_file, m_score2); + Write(p_file, m_score3); + Write(p_file, m_score4); + Write(p_file, m_score5); } return SUCCESS; diff --git a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp index ed32a3f2..3eae3094 100644 --- a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp @@ -64,7 +64,7 @@ MxBool LegoCarBuild::Escape() } // FUNCTION: LEGO1 0x10025f30 -LegoVehicleBuildState::LegoVehicleBuildState(char* p_classType) +LegoVehicleBuildState::LegoVehicleBuildState(const char* p_classType) { m_className = p_classType; m_unk0x4c = 0; @@ -73,9 +73,23 @@ LegoVehicleBuildState::LegoVehicleBuildState(char* p_classType) m_placedPartCount = 0; } -// STUB: LEGO1 0x10026120 -MxResult LegoVehicleBuildState::Serialize(LegoFile* p_legoFile) +// FUNCTION: LEGO1 0x10026120 +MxResult LegoVehicleBuildState::Serialize(LegoFile* p_file) { - // TODO - return LegoState::Serialize(p_legoFile); + LegoState::Serialize(p_file); + + if (p_file->IsReadMode()) { + Read(p_file, &m_unk0x4c); + Read(p_file, &m_unk0x4d); + Read(p_file, &m_unk0x4e); + Read(p_file, &m_placedPartCount); + } + else { + Write(p_file, m_unk0x4c); + Write(p_file, m_unk0x4d); + Write(p_file, m_unk0x4e); + Write(p_file, m_placedPartCount); + } + + return SUCCESS; } diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 50e1581c..3c4545b5 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -998,7 +998,7 @@ MxResult LegoAnimationManager::FUN_100605e0( FUN_100648f0(tranInfo, m_unk0x404); } else if (p_unk0x0a) { - LegoPathActor* actor = CurrentActor(); + LegoPathActor* actor = UserActor(); if (actor != NULL) { actor->SetState(4); @@ -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; @@ -1435,7 +1435,7 @@ MxResult LegoAnimationManager::Tickle() return SUCCESS; } - LegoPathActor* actor = CurrentActor(); + LegoPathActor* actor = UserActor(); LegoROI* roi; if (actor == NULL || (roi = actor->GetROI()) == NULL) { @@ -1658,7 +1658,7 @@ MxBool LegoAnimationManager::FUN_100623a0(AnimInfo& p_info) LegoEntityListCursor cursor(entityList); LegoEntity* entity; - LegoPathActor* actor = CurrentActor(); + LegoPathActor* actor = UserActor(); while (cursor.Next(entity)) { if (entity != actor && entity->IsA("LegoPathActor")) { @@ -1861,7 +1861,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und) if (world != NULL) { PurgeExtra(FALSE); - LegoPathActor* actor = CurrentActor(); + LegoPathActor* actor = UserActor(); if (actor == NULL || actor->GetWorldSpeed() <= 20.0f) { MxU32 i; for (i = 0; i < m_numAllowedExtras && m_extras[i].m_roi != NULL; i++) { @@ -2478,7 +2478,7 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx { MxU32 local2c = 12; float destScale = ((rand() * 0.5) / 32767.0) + 0.25; - LegoPathActor* actor = CurrentActor(); + LegoPathActor* actor = UserActor(); if (actor == NULL) { return FALSE; @@ -2760,7 +2760,7 @@ void LegoAnimationManager::FUN_100648f0(LegoTranInfo* p_tranInfo, MxLong p_unk0x m_unk0x43c = viewROI->GetLocal2World(); p_tranInfo->m_unk0x2c = m_unk0x43c; - LegoPathActor* actor = CurrentActor(); + LegoPathActor* actor = UserActor(); if (actor != NULL) { actor->SetState(4); actor->SetWorldSpeed(0.0f); @@ -2790,7 +2790,7 @@ void LegoAnimationManager::FUN_10064b50(MxLong p_time) if (m_unk0x430 && m_unk0x42c != NULL) { MxMatrix mat; - if (p_time < 0 || p_time <= m_unk0x438) { + if (p_time < 0 || m_unk0x438 <= p_time) { m_unk0x430 = FALSE; m_unk0x42c->m_flags &= ~LegoTranInfo::c_bit1; m_unk0x42c = NULL; @@ -2807,7 +2807,7 @@ void LegoAnimationManager::FUN_10064b50(MxLong p_time) m_unk0x4cc.Unknown6(mat, (float) (p_time - m_unk0x434) / 1000.0f); VPV3(mat[3], m_unk0x43c[3], sub); - mat[3][4] = 1.0f; + mat[3][3] = 1.0f; } LegoROI* viewROI = VideoManager()->GetViewROI(); @@ -2850,11 +2850,66 @@ void AnimState::FUN_10065240(MxU32, AnimInfo*, MxU32) // TODO } -// STUB: LEGO1 0x100652d0 -MxResult AnimState::Serialize(LegoFile* p_legoFile) +// FUNCTION: LEGO1 0x100652d0 +// FUNCTION: BETA10 0x10046621 +MxResult AnimState::Serialize(LegoFile* p_file) { - // TODO - return LegoState::Serialize(p_legoFile); + // These two are equivalent up to the order of some deallocation. + // Choose as needed to get 100 %. + // Option 1: + // LegoState::Serialize(p_file); + // Option 2: + if (p_file->IsWriteMode()) { + p_file->WriteString(ClassName()); + } + + if (p_file->IsReadMode()) { + Read(p_file, &m_unk0x08); + + // m_unk0x10_len and m_unk0x10 + if (m_unk0x10) { + delete[] m_unk0x10; + } + Read(p_file, &m_unk0x0c); + if (m_unk0x0c != 0) { + m_unk0x10 = new undefined2[m_unk0x0c]; + } + else { + m_unk0x10 = NULL; + } + for (MxS32 i = 0; i < m_unk0x0c; i++) { + Read(p_file, &m_unk0x10[i]); + } + + // m_unk0x18_len and m_unk0x18 + // Note that here we read first and then free memory in contrast to above + Read(p_file, &m_unk0x14); + if (m_unk0x18) { + delete[] m_unk0x18; + } + if (m_unk0x14 != 0) { + m_unk0x18 = new undefined[m_unk0x14]; + } + else { + m_unk0x18 = NULL; + } + for (MxS32 j = 0; j < m_unk0x14; j++) { + Read(p_file, &m_unk0x18[j]); + } + } + else if (p_file->IsWriteMode()) { + Write(p_file, m_unk0x08); + Write(p_file, m_unk0x0c); + for (MxS32 i = 0; i < m_unk0x0c; i++) { + Write(p_file, m_unk0x10[i]); + } + Write(p_file, m_unk0x14); + for (MxS32 j = 0; j < m_unk0x14; j++) { + Write(p_file, m_unk0x18[j]); + } + } + + return SUCCESS; } // STUB: LEGO1 0x100654f0 diff --git a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp index d115e732..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; } @@ -426,7 +426,7 @@ MxBool LegoAnimMMPresenter::FUN_1004b6b0(MxLong p_time) MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time) { LegoROI* viewROI = VideoManager()->GetViewROI(); - LegoPathActor* actor = CurrentActor(); + LegoPathActor* actor = UserActor(); if (m_tranInfo != NULL && m_tranInfo->m_unk0x14 && m_tranInfo->m_location != -1 && actor != NULL) { if (m_unk0x64 != NULL) { diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index 5e1fcdeb..6ac670d7 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -171,8 +171,8 @@ void LegoGameState::SetActor(MxU8 p_actorId) m_actorId = p_actorId; } - LegoPathActor* oldActor = CurrentActor(); - SetCurrentActor(NULL); + LegoPathActor* oldActor = UserActor(); + SetUserActor(NULL); IslePathActor* newActor = new IslePathActor(); const char* actorName = LegoActor::GetActorName(m_actorId); @@ -192,14 +192,14 @@ void LegoGameState::SetActor(MxU8 p_actorId) } newActor->ClearFlag(0x02); - SetCurrentActor(newActor); + SetUserActor(newActor); } // FUNCTION: LEGO1 0x10039910 void LegoGameState::RemoveActor() { - LegoPathActor* actor = CurrentActor(); - SetCurrentActor(NULL); + LegoPathActor* actor = UserActor(); + SetUserActor(NULL); delete actor; m_actorId = 0; } @@ -208,7 +208,7 @@ void LegoGameState::RemoveActor() void LegoGameState::ResetROI() { if (m_actorId) { - LegoPathActor* actor = CurrentActor(); + LegoPathActor* actor = UserActor(); if (actor) { LegoROI* roi = actor->GetROI(); @@ -887,7 +887,7 @@ void LegoGameState::SwitchArea(Area p_area) case e_garadoor: LoadIsle(); VariableTable()->SetVariable("VISIBILITY", "Hide Gas"); - CurrentActor()->ResetWorldTransform(FALSE); + UserActor()->ResetWorldTransform(FALSE); NavController()->UpdateLocation(59); // LCAMZG1 in g_cameraLocations VideoManager()->Get3DManager()->SetFrustrum(90, 0.1f, 250.0f); InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_GaraDoor, NULL); @@ -901,11 +901,11 @@ void LegoGameState::SwitchArea(Area p_area) } else { SetCameraControllerFromIsle(); - CurrentActor()->ResetWorldTransform(TRUE); + UserActor()->ResetWorldTransform(TRUE); AnimationManager()->Resume(); } - ((IslePathActor*) CurrentActor()) + ((IslePathActor*) UserActor()) ->SpawnPlayer( p_area, TRUE, @@ -920,9 +920,9 @@ void LegoGameState::SwitchArea(Area p_area) case e_unk33: LoadIsle(); SetCameraControllerFromIsle(); - CurrentActor()->ResetWorldTransform(TRUE); + UserActor()->ResetWorldTransform(TRUE); AnimationManager()->Resume(); - ((IslePathActor*) CurrentActor()) + ((IslePathActor*) UserActor()) ->SpawnPlayer( p_area, TRUE, diff --git a/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp b/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp index 23b0227e..265a69dc 100644 --- a/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp +++ b/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp @@ -2,8 +2,20 @@ #include "act2actor.h" #include "act2brick.h" +#include "act2genactor.h" +#include "act2policestation.h" +#include "act3.h" +#include "act3actor.h" +#include "act3brickster.h" +#include "act3cop.h" +#include "act3shark.h" +#include "ambulance.h" +#include "bike.h" +#include "buildings.h" +#include "bumpbouy.h" #include "carrace.h" #include "decomp.h" +#include "doors.h" #include "dunebuggy.h" #include "elevatorbottom.h" #include "gasstation.h" @@ -13,13 +25,18 @@ #include "infocenter.h" #include "infocenterdoor.h" #include "isle.h" +#include "jetski.h" #include "jetskirace.h" +#include "jukebox.h" +#include "jukeboxentity.h" #include "lego3dwavepresenter.h" #include "legoact2.h" #include "legoactioncontrolpresenter.h" #include "legoactor.h" #include "legoactorpresenter.h" #include "legoanimactor.h" +#include "legoanimationmanager.h" +#include "legoanimmmpresenter.h" #include "legoanimpresenter.h" #include "legocarbuild.h" #include "legocarbuildpresenter.h" @@ -33,6 +50,7 @@ #include "legoloadcachesoundpresenter.h" #include "legolocomotionanimpresenter.h" #include "legoloopinganimpresenter.h" +#include "legometerpresenter.h" #include "legomodelpresenter.h" #include "legopalettepresenter.h" #include "legopartpresenter.h" @@ -43,66 +61,437 @@ #include "legotexturepresenter.h" #include "legoworld.h" #include "legoworldpresenter.h" +#include "misc.h" +#include "motocycle.h" +#include "mxcompositemediapresenter.h" #include "mxcontrolpresenter.h" -#include "mxvideopresenter.h" #include "pizza.h" +#include "pizzeria.h" #include "police.h" +#include "racecar.h" +#include "raceskel.h" #include "registrationbook.h" #include "score.h" #include "skateboard.h" -// #include "act2genactor.h" -#include "act2policestation.h" -#include "act3.h" -#include "ambulance.h" -#include "bike.h" -#include "doors.h" -#include "jetski.h" -#include "legoanimationmanager.h" -#include "legoanimmmpresenter.h" -#include "motocycle.h" -#include "racecar.h" #include "towtrack.h" -// #include "act3cop.h" -// #include "act3brickster.h" -#include "act3actor.h" -#include "act3shark.h" -#include "buildings.h" -#include "bumpbouy.h" -#include "caveentity.h" -#include "jukebox.h" -#include "jukeboxentity.h" -#include "mxcompositemediapresenter.h" -#include "pizzeria.h" -#include "raceskel.h" -// TODO: Before HospitalState, add all of the different LegoVehicleBuildState's - -// TODO: Uncomment once we have all the relevant types ready -// DECOMP_SIZE_ASSERT(LegoObjectFactory, 0x1c8); +DECOMP_SIZE_ASSERT(LegoObjectFactory, 0x1c8) // FUNCTION: LEGO1 0x10006e40 LegoObjectFactory::LegoObjectFactory() { -#define X(V) this->m_id##V = MxAtomId(#V, e_exact); - FOR_LEGOOBJECTFACTORY_OBJECTS(X) -#undef X + m_idLegoEntityPresenter = MxAtomId("LegoEntityPresenter", e_exact); + m_idLegoActorPresenter = MxAtomId("LegoActorPresenter", e_exact); + m_idLegoWorldPresenter = MxAtomId("LegoWorldPresenter", e_exact); + m_idLegoWorld = MxAtomId("LegoWorld", e_exact); + m_idLegoAnimPresenter = MxAtomId("LegoAnimPresenter", e_exact); // duplicate + m_idLegoModelPresenter = MxAtomId("LegoModelPresenter", e_exact); + m_idLegoTexturePresenter = MxAtomId("LegoTexturePresenter", e_exact); + m_idLegoPhonemePresenter = MxAtomId("LegoPhonemePresenter", e_exact); + m_idLegoFlcTexturePresenter = MxAtomId("LegoFlcTexturePresenter", e_exact); + m_idLegoPalettePresenter = MxAtomId("LegoPalettePresenter", e_exact); + m_idLegoPathPresenter = MxAtomId("LegoPathPresenter", e_exact); + m_idLegoAnimPresenter = MxAtomId("LegoAnimPresenter", e_exact); + m_idLegoLoopingAnimPresenter = MxAtomId("LegoLoopingAnimPresenter", e_exact); + m_idLegoLocomotionAnimPresenter = MxAtomId("LegoLocomotionAnimPresenter", e_exact); + m_idLegoHideAnimPresenter = MxAtomId("LegoHideAnimPresenter", e_exact); + m_idLegoPartPresenter = MxAtomId("LegoPartPresenter", e_exact); + m_idLegoCarBuildAnimPresenter = MxAtomId("LegoCarBuildAnimPresenter", e_exact); + m_idLegoActionControlPresenter = MxAtomId("LegoActionControlPresenter", e_exact); + m_idLegoMeterPresenter = MxAtomId("LegoMeterPresenter", e_exact); + m_idLegoLoadCacheSoundPresenter = MxAtomId("LegoLoadCacheSoundPresenter", e_exact); + m_idLego3DWavePresenter = MxAtomId("Lego3DWavePresenter", e_exact); + m_idLegoActor = MxAtomId("LegoActor", e_exact); + m_idLegoPathActor = MxAtomId("LegoPathActor", e_exact); + m_idLegoRaceCar = MxAtomId("LegoRaceCar", e_exact); + m_idLegoJetski = MxAtomId("LegoJetski", e_exact); + m_idJetskiRace = MxAtomId("JetskiRace", e_exact); + m_idLegoEntity = MxAtomId("LegoEntity", e_exact); + m_idLegoCarRaceActor = MxAtomId("LegoCarRaceActor", e_exact); + m_idLegoJetskiRaceActor = MxAtomId("LegoJetskiRaceActor", e_exact); + m_idLegoCarBuild = MxAtomId("LegoCarBuild", e_exact); + m_idInfocenter = MxAtomId("Infocenter", e_exact); + m_idLegoAnimActor = MxAtomId("LegoAnimActor", e_exact); + m_idMxControlPresenter = MxAtomId("MxControlPresenter", e_exact); + m_idRegistrationBook = MxAtomId("RegistrationBook", e_exact); + m_idHistoryBook = MxAtomId("HistoryBook", e_exact); + m_idElevatorBottom = MxAtomId("ElevatorBottom", e_exact); + m_idInfocenterDoor = MxAtomId("InfocenterDoor", e_exact); + m_idScore = MxAtomId("Score", e_exact); + m_idScoreState = MxAtomId("ScoreState", e_exact); + m_idHospital = MxAtomId("Hospital", e_exact); + m_idIsle = MxAtomId("Isle", e_exact); + m_idPolice = MxAtomId("Police", e_exact); + m_idGasStation = MxAtomId("GasStation", e_exact); + m_idLegoAct2 = MxAtomId("LegoAct2", e_exact); + m_idLegoAct2State = MxAtomId("LegoAct2State", e_exact); + m_idCarRace = MxAtomId("CarRace", e_exact); + m_idLegoRaceCarBuildState = MxAtomId("LegoRaceCarBuildState", e_exact); + m_idLegoCopterBuildState = MxAtomId("LegoCopterBuildState", e_exact); + m_idLegoDuneCarBuildState = MxAtomId("LegoDuneCarBuildState", e_exact); + m_idLegoJetskiBuildState = MxAtomId("LegoJetskiBuildState", e_exact); + m_idHospitalState = MxAtomId("HospitalState", e_exact); + m_idInfocenterState = MxAtomId("InfocenterState", e_exact); + m_idPoliceState = MxAtomId("PoliceState", e_exact); + m_idGasStationState = MxAtomId("GasStationState", e_exact); + m_idSkateBoard = MxAtomId("SkateBoard", e_exact); + m_idHelicopter = MxAtomId("Helicopter", e_exact); + m_idHelicopterState = MxAtomId("HelicopterState", e_exact); + m_idDuneBuggy = MxAtomId("DuneBuggy", e_exact); + m_idPizza = MxAtomId("Pizza", e_exact); + m_idPizzaMissionState = MxAtomId("PizzaMissionState", e_exact); + m_idAct2Actor = MxAtomId("Act2Actor", e_exact); + m_idAct2Brick = MxAtomId("Act2Brick", e_exact); + m_idAct2GenActor = MxAtomId("Act2GenActor", e_exact); + m_idAct2PoliceStation = MxAtomId("Act2PoliceStation", e_exact); + m_idAct3 = MxAtomId("Act3", e_exact); + m_idAct3State = MxAtomId("Act3State", e_exact); + m_idDoors = MxAtomId("Doors", e_exact); + m_idLegoAnimMMPresenter = MxAtomId("LegoAnimMMPresenter", e_exact); + m_idRaceCar = MxAtomId("RaceCar", e_exact); + m_idJetski = MxAtomId("Jetski", e_exact); + m_idBike = MxAtomId("Bike", e_exact); + m_idMotocycle = MxAtomId("Motocycle", e_exact); + m_idAmbulance = MxAtomId("Ambulance", e_exact); + m_idAmbulanceMissionState = MxAtomId("AmbulanceMissionState", e_exact); + m_idTowTrack = MxAtomId("TowTrack", e_exact); + m_idTowTrackMissionState = MxAtomId("TowTrackMissionState", e_exact); + m_idAct3Cop = MxAtomId("Act3Cop", e_exact); + m_idAct3Brickster = MxAtomId("Act3Brickster", e_exact); + m_idAct3Shark = MxAtomId("Act3Shark", e_exact); + m_idBumpBouy = MxAtomId("BumpBouy", e_exact); + m_idAct3Actor = MxAtomId("Act3Actor", e_exact); + m_idJetskiRaceState = MxAtomId("JetskiRaceState", e_exact); + m_idCarRaceState = MxAtomId("CarRaceState", e_exact); + m_idAct1State = MxAtomId("Act1State", e_exact); + m_idPizzeria = MxAtomId("Pizzeria", e_exact); + m_idPizzeriaState = MxAtomId("PizzeriaState", e_exact); + m_idInfoCenterEntity = MxAtomId("InfoCenterEntity", e_exact); + m_idHospitalEntity = MxAtomId("HospitalEntity", e_exact); + m_idGasStationEntity = MxAtomId("GasStationEntity", e_exact); + m_idPoliceEntity = MxAtomId("PoliceEntity", e_exact); + m_idBeachHouseEntity = MxAtomId("BeachHouseEntity", e_exact); + m_idRaceStandsEntity = MxAtomId("RaceStandsEntity", e_exact); + m_idJukeBoxEntity = MxAtomId("JukeBoxEntity", e_exact); + m_idRadioState = MxAtomId("RadioState", e_exact); + m_idCaveEntity = MxAtomId("CaveEntity", e_exact); + m_idJailEntity = MxAtomId("JailEntity", e_exact); + m_idMxCompositeMediaPresenter = MxAtomId("MxCompositeMediaPresenter", e_exact); + m_idJukeBox = MxAtomId("JukeBox", e_exact); + m_idJukeBoxState = MxAtomId("JukeBoxState", e_exact); + m_idRaceSkel = MxAtomId("RaceSkel", e_exact); + m_idAnimState = MxAtomId("AnimState", e_exact); } // FUNCTION: LEGO1 0x10009a90 MxCore* LegoObjectFactory::Create(const char* p_name) { + MxCore* object = NULL; MxAtomId atom(p_name, e_exact); -#define X(V) \ - if (this->m_id##V == atom) { \ - return new V; \ - } \ - else - FOR_LEGOOBJECTFACTORY_OBJECTS(X) -#undef X - { - return MxObjectFactory::Create(p_name); + if (m_idLegoModelPresenter == atom) { + object = new LegoModelPresenter(); } + else if (m_idLegoTexturePresenter == atom) { + object = new LegoTexturePresenter(); + } + else if (m_idLegoPhonemePresenter == atom) { + object = new LegoPhonemePresenter(); + } + else if (m_idLegoFlcTexturePresenter == atom) { + object = new LegoFlcTexturePresenter(); + } + else if (m_idLegoEntityPresenter == atom) { + object = new LegoEntityPresenter(); + } + else if (m_idLegoActorPresenter == atom) { + object = new LegoActorPresenter(); + } + else if (m_idLegoWorldPresenter == atom) { + object = new LegoWorldPresenter(); + } + else if (m_idLegoWorld == atom) { + object = new LegoWorld(); + } + else if (m_idLegoPalettePresenter == atom) { + object = new LegoPalettePresenter(); + } + else if (m_idLegoPathPresenter == atom) { + object = new LegoPathPresenter(); + } + else if (m_idLegoAnimPresenter == atom) { + object = new LegoAnimPresenter(); + } + else if (m_idLegoLoopingAnimPresenter == atom) { + object = new LegoLoopingAnimPresenter(); + } + else if (m_idLegoLocomotionAnimPresenter == atom) { + object = new LegoLocomotionAnimPresenter(); + } + else if (m_idLegoHideAnimPresenter == atom) { + object = new LegoHideAnimPresenter(); + } + else if (m_idLegoPartPresenter == atom) { + object = new LegoPartPresenter(); + } + else if (m_idLegoCarBuildAnimPresenter == atom) { + object = new LegoCarBuildAnimPresenter(); + } + else if (m_idLegoActionControlPresenter == atom) { + object = new LegoActionControlPresenter(); + } + else if (m_idLegoMeterPresenter == atom) { + object = new LegoMeterPresenter(); + } + else if (m_idLegoLoadCacheSoundPresenter == atom) { + object = new LegoLoadCacheSoundPresenter(); + } + else if (m_idLego3DWavePresenter == atom) { + object = new Lego3DWavePresenter(); + } + else if (m_idLegoActor == atom) { + object = new LegoActor(); + } + else if (m_idLegoPathActor == atom) { + object = new LegoPathActor(); + } + else if (m_idJetskiRace == atom) { + object = new JetskiRace(); + } + else if (m_idLegoEntity == atom) { + object = new LegoEntity(); + } + else if (m_idLegoRaceCar == atom) { + object = new LegoRaceCar(); + } + else if (m_idLegoJetski == atom) { + object = new LegoJetski(); + } + else if (m_idLegoCarRaceActor == atom) { + object = new LegoCarRaceActor(); + } + else if (m_idLegoJetskiRaceActor == atom) { + object = new LegoJetskiRaceActor(); + } + else if (m_idLegoCarBuild == atom) { + object = new LegoCarBuild(); + } + else if (m_idInfocenter == atom) { + object = new Infocenter(); + } + else if (m_idLegoAnimActor == atom) { + object = new LegoAnimActor(); + } + else if (m_idMxControlPresenter == atom) { + object = new MxControlPresenter(); + } + else if (m_idRegistrationBook == atom) { + object = new RegistrationBook(); + } + else if (m_idHistoryBook == atom) { + object = new HistoryBook(); + } + else if (m_idElevatorBottom == atom) { + object = new ElevatorBottom(); + } + else if (m_idInfocenterDoor == atom) { + object = new InfocenterDoor(); + } + else if (m_idScore == atom) { + object = new Score(); + } + else if (m_idScoreState == atom) { + object = new ScoreState(); + } + else if (m_idHospital == atom) { + object = new Hospital(); + } + else if (m_idIsle == atom) { + object = new Isle(); + } + else if (m_idPolice == atom) { + object = new Police(); + } + else if (m_idGasStation == atom) { + object = new GasStation(); + } + else if (m_idLegoAct2 == atom) { + object = new LegoAct2(); + } + else if (m_idLegoAct2State == atom) { + object = new LegoAct2State(); + } + else if (m_idCarRace == atom) { + object = new CarRace(); + } + else if (m_idLegoRaceCarBuildState == atom || m_idLegoCopterBuildState == atom || m_idLegoDuneCarBuildState == atom || m_idLegoJetskiBuildState == atom) { + object = new LegoVehicleBuildState(p_name); + } + else if (m_idHospitalState == atom) { + object = new HospitalState(); + } + else if (m_idInfocenterState == atom) { + object = new InfocenterState(); + } + else if (m_idPoliceState == atom) { + object = new PoliceState(); + } + + if (object != NULL) { + return object; + } + + if (m_idGasStationState == atom) { + object = new GasStationState(); + } + else if (m_idSkateBoard == atom) { + object = new SkateBoard(); + } + else if (m_idHelicopter == atom) { + object = new Helicopter(); + } + else if (m_idHelicopterState == atom) { + object = new HelicopterState(); + } + else if (m_idDuneBuggy == atom) { + object = new DuneBuggy(); + } + else if (m_idPizza == atom) { + object = new Pizza(); + } + else if (m_idPizzaMissionState == atom) { + object = new PizzaMissionState(); + } + else if (m_idAct2Actor == atom) { + Act2Actor* actor = new Act2Actor(); + ((LegoAct2*) CurrentWorld())->SetUnknown0x1138(actor); + object = actor; + } + else if (m_idAct2Brick == atom) { + object = new Act2Brick(); + } + else if (m_idAct2GenActor == atom) { + object = new Act2GenActor(); + } + else if (m_idAct2PoliceStation == atom) { + object = new Act2PoliceStation(); + } + else if (m_idAct3 == atom) { + object = new Act3(); + } + else if (m_idAct3State == atom) { + object = new Act3State(); + } + else if (m_idDoors == atom) { + object = new Doors(); + } + else if (m_idLegoAnimMMPresenter == atom) { + object = new LegoAnimMMPresenter(); + } + else if (m_idRaceCar == atom) { + object = new RaceCar(); + } + else if (m_idJetski == atom) { + object = new Jetski(); + } + else if (m_idBike == atom) { + object = new Bike(); + } + else if (m_idMotocycle == atom) { + object = new Motocycle(); + } + else if (m_idAmbulance == atom) { + object = new Ambulance(); + } + else if (m_idAmbulanceMissionState == atom) { + object = new AmbulanceMissionState(); + } + else if (m_idTowTrack == atom) { + object = new TowTrack(); + } + else if (m_idTowTrackMissionState == atom) { + object = new TowTrackMissionState(); + } + else if (m_idAct3Cop == atom) { + object = new Act3Cop(); + } + else if (m_idAct3Brickster == atom) { + object = new Act3Brickster(); + } + else if (m_idAct3Shark == atom) { + object = new Act3Shark(); + } + else if (m_idAct3Actor == atom) { + object = new Act3Actor(); + } + else if (m_idBumpBouy == atom) { + object = new BumpBouy(); + } + else if (m_idJetskiRaceState == atom) { + object = new JetskiRaceState(); + } + else if (m_idCarRaceState == atom) { + object = new CarRaceState(); + } + else if (m_idAct1State == atom) { + object = new Act1State(); + } + else if (m_idPizzeria == atom) { + object = new Pizzeria(); + } + else if (m_idPizzeriaState == atom) { + object = new PizzeriaState(); + } + else if (m_idInfoCenterEntity == atom) { + object = new InfoCenterEntity(); + } + else if (m_idHospitalEntity == atom) { + object = new HospitalEntity(); + } + else if (m_idGasStationEntity == atom) { + object = new GasStationEntity(); + } + else if (m_idPoliceEntity == atom) { + object = new PoliceEntity(); + } + else if (m_idBeachHouseEntity == atom) { + object = new BeachHouseEntity(); + } + else if (m_idJukeBoxEntity == atom) { + object = new JukeBoxEntity(); + } + else if (m_idRaceStandsEntity == atom) { + object = new RaceStandsEntity(); + } + else if (m_idRadioState == atom) { + object = new RadioState(); + } + else if (m_idCaveEntity == atom) { + object = new CaveEntity(); + } + else if (m_idJailEntity == atom) { + object = new JailEntity(); + } + else if (m_idMxCompositeMediaPresenter == atom) { + object = new MxCompositeMediaPresenter(); + } + else if (m_idJukeBox == atom) { + object = new JukeBox(); + } + else if (m_idJukeBoxState == atom) { + object = new JukeBoxState(); + } + else if (m_idRaceSkel == atom) { + object = new RaceSkel(); + } + else if (m_idAnimState == atom) { + object = new AnimState(); + } + else { + object = MxObjectFactory::Create(p_name); + } + + return object; } // FUNCTION: LEGO1 0x1000fb30 diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index 014dddc6..fcc362e4 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" @@ -35,7 +35,24 @@ // FUNCTION: LEGO1 0x1003dd70 LegoROI* PickROI(MxLong p_a, MxLong p_b) { - return (LegoROI*) VideoManager()->Get3DManager()->GetLego3DView()->Pick(p_a, p_b); + LegoVideoManager* videoManager = VideoManager(); + Lego3DView* view = videoManager->Get3DManager()->GetLego3DView(); + return (LegoROI*) view->Pick(p_a, p_b); +} + +// FUNCTION: LEGO1 0x1003dd90 +// FUNCTION: BETA10 0x100d3449 +LegoROI* PickParentROI(MxLong p_a, MxLong p_b) +{ + LegoVideoManager* videoManager = VideoManager(); + Lego3DView* view = videoManager->Get3DManager()->GetLego3DView(); + LegoROI* roi = (LegoROI*) view->Pick(p_a, p_b); + + while (roi != NULL && roi->GetParentROI() != NULL) { + roi = (LegoROI*) roi->GetParentROI(); + } + + return roi; } // STUB: LEGO1 0x1003ddc0 @@ -351,7 +368,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); } @@ -474,8 +491,8 @@ MxBool FUN_1003ef60() GameState()->m_currentArea != LegoGameState::e_elevdown && GameState()->m_currentArea != LegoGameState::e_garadoor && GameState()->m_currentArea != LegoGameState::e_polidoor) { - if (CurrentActor() == NULL || !CurrentActor()->IsA("TowTrack")) { - if (CurrentActor() == NULL || !CurrentActor()->IsA("Ambulance")) { + if (UserActor() == NULL || !UserActor()->IsA("TowTrack")) { + if (UserActor() == NULL || !UserActor()->IsA("Ambulance")) { MxU32 unk0x18 = act1State->GetUnknown18(); if (unk0x18 != 10 && unk0x18 != 8 && unk0x18 != 3) { diff --git a/LEGO1/lego/legoomni/src/common/legovariables.cpp b/LEGO1/lego/legoomni/src/common/legovariables.cpp index 38b5b5e8..52e78930 100644 --- a/LEGO1/lego/legoomni/src/common/legovariables.cpp +++ b/LEGO1/lego/legoomni/src/common/legovariables.cpp @@ -16,6 +16,10 @@ DECOMP_SIZE_ASSERT(CursorVariable, 0x24) DECOMP_SIZE_ASSERT(WhoAmIVariable, 0x24) DECOMP_SIZE_ASSERT(CustomizeAnimFileVariable, 0x24) +// GLOBAL: LEGO1 0x100f39b8 +// STRING: LEGO1 0x100f39ac +const char* g_varAMBULSPEED = "ambulSPEED"; + // GLOBAL: LEGO1 0x100f39bc // STRING: LEGO1 0x100f39a0 const char* g_varAMBULFUEL = "ambulFUEL"; diff --git a/LEGO1/lego/legoomni/src/common/misc.cpp b/LEGO1/lego/legoomni/src/common/misc.cpp index 2427097c..29cc4cd6 100644 --- a/LEGO1/lego/legoomni/src/common/misc.cpp +++ b/LEGO1/lego/legoomni/src/common/misc.cpp @@ -67,9 +67,9 @@ LegoNavController* NavController() } // FUNCTION: LEGO1 0x10015790 -LegoPathActor* CurrentActor() +LegoPathActor* UserActor() { - return LegoOmni::GetInstance()->GetCurrentActor(); + return LegoOmni::GetInstance()->GetUserActor(); } // FUNCTION: LEGO1 0x100157a0 @@ -137,9 +137,9 @@ void SetROIVisible(const char* p_name, MxBool p_visible) } // FUNCTION: LEGO1 0x10015880 -void SetCurrentActor(LegoPathActor* p_currentActor) +void SetUserActor(LegoPathActor* p_userActor) { - LegoOmni::GetInstance()->SetCurrentActor(p_currentActor); + LegoOmni::GetInstance()->SetUserActor(p_userActor); } // FUNCTION: LEGO1 0x10015890 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/control/legometerpresenter.cpp b/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp index f0df5de9..398a29e9 100644 --- a/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp +++ b/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp @@ -46,7 +46,7 @@ void LegoMeterPresenter::ParseExtra() extraCopy[extraLength & USHRT_MAX] = '\0'; char output[256]; - if (KeyValueStringParse(extraCopy, g_strTYPE, output)) { + if (KeyValueStringParse(output, g_strTYPE, extraCopy)) { if (!strcmpi(output, g_strLEFT_TO_RIGHT)) { m_layout = e_leftToRight; } @@ -61,11 +61,11 @@ void LegoMeterPresenter::ParseExtra() } } - if (KeyValueStringParse(extraCopy, g_strFILLER_INDEX, output)) { + if (KeyValueStringParse(output, g_strFILLER_INDEX, extraCopy)) { m_fillColor = atoi(output); } - if (KeyValueStringParse(extraCopy, g_strVARIABLE, output)) { + if (KeyValueStringParse(output, g_strVARIABLE, extraCopy)) { m_variable = output; } else { @@ -83,6 +83,7 @@ void LegoMeterPresenter::ParseExtra() void LegoMeterPresenter::StreamingTickle() { MxStillPresenter::StreamingTickle(); + m_meterPixels = new MxU8[m_frameBitmap->GetDataSize()]; if (m_meterPixels == NULL) { assert(0); @@ -144,7 +145,7 @@ void LegoMeterPresenter::DrawMeter() case e_bottomToTop: bottomTopEnd = m_meterRect.GetBottom() - (MxS16) (m_meterRect.GetHeight() * m_curPercent); - for (row = m_meterRect.GetBottom(); row < bottomTopEnd; row--) { + for (row = m_meterRect.GetBottom(); row > bottomTopEnd; row--) { MxU8* line = m_frameBitmap->GetStart(m_meterRect.GetLeft(), row); for (bottomTopCol = 0; bottomTopCol < m_meterRect.GetWidth(); bottomTopCol++, line++) { 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/legocarraceactor.cpp b/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp index 7414b8bf..c36040b9 100644 --- a/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legocarraceactor.cpp @@ -9,20 +9,6 @@ DECOMP_SIZE_ASSERT(LegoCarRaceActor, 0x1a0) // STRING: LEGO1 0x100f7ae4 const char* g_fuel = "FUEL"; -// STUB: LEGO1 0x100141a0 -MxU32 LegoCarRaceActor::VTable0x90(float, Matrix4&) -{ - // TODO - return 0; -} - -// STUB: LEGO1 0x1005d650 -MxResult LegoCarRaceActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) -{ - // TODO - return 0; -} - // FUNCTION: LEGO1 0x10080350 LegoCarRaceActor::LegoCarRaceActor() { @@ -51,7 +37,26 @@ void LegoCarRaceActor::VTable0x1c() { } -// STUB: LEGO1 0x10081830 +// STUB: LEGO1 0x10080b40 +void LegoCarRaceActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) +{ + // TODO +} + +// STUB: LEGO1 0x10080b70 +void LegoCarRaceActor::VTable0x70(float p_float) +{ + // TODO +} + +// STUB: LEGO1 0x10080be0 +MxResult LegoCarRaceActor::VTable0x9c() +{ + // TODO + return SUCCESS; +} + +// STUB: LEGO1 0x10081840 MxU32 LegoCarRaceActor::VTable0x6c( LegoPathBoundary* p_boundary, Vector3& p_v1, @@ -64,22 +69,3 @@ MxU32 LegoCarRaceActor::VTable0x6c( // TODO return 0; } - -// STUB: LEGO1 0x10081d10 -void LegoCarRaceActor::VTable0x70(float p_float) -{ - // TODO -} - -// STUB: LEGO1 0x10081d20 -void LegoCarRaceActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) -{ - // TODO -} - -// STUB: LEGO1 0x10081d30 -MxResult LegoCarRaceActor::VTable0x9c() -{ - // TODO - return SUCCESS; -} diff --git a/LEGO1/lego/legoomni/src/entity/legojetski.cpp b/LEGO1/lego/legoomni/src/entity/legojetski.cpp index 5160ab25..42a7ed5b 100644 --- a/LEGO1/lego/legoomni/src/entity/legojetski.cpp +++ b/LEGO1/lego/legoomni/src/entity/legojetski.cpp @@ -5,6 +5,12 @@ DECOMP_SIZE_ASSERT(LegoJetski, 0x1dc) +// STUB: LEGO1 0x100136a0 +void LegoJetski::SetWorldSpeed(MxFloat p_worldSpeed) +{ + // TODO +} + // FUNCTION: LEGO1 0x100136f0 void LegoJetski::FUN_100136f0(float p_worldSpeed) { @@ -18,32 +24,45 @@ void LegoJetski::FUN_100136f0(float p_worldSpeed) } } +// STUB: LEGO1 0x10013740 +void LegoJetski::VTable0x70(float p_float) +{ + // TODO +} + // FUNCTION: LEGO1 0x10013820 LegoJetski::LegoJetski() { NotificationManager()->Register(this); } -// STUB: LEGO1 0x10013e70 +// STUB: LEGO1 0x10013aa0 +LegoJetski::~LegoJetski() +{ + // TODO +} + +// STUB: LEGO1 0x10013bb0 +void LegoJetski::ParseAction(char*) +{ + // TODO +} + +// STUB: LEGO1 0x10013c30 MxLong LegoJetski::Notify(MxParam& p_param) { // TODO return 0; } -// STUB: LEGO1 0x10014110 -void LegoJetski::ParseAction(char*) +// STUB: LEGO1 0x10013c40 +MxResult LegoJetski::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) { // TODO + return 0; } -// STUB: LEGO1 0x10014120 -void LegoJetski::SetWorldSpeed(MxFloat p_worldSpeed) -{ - // TODO -} - -// STUB: LEGO1 0x10014140 +// STUB: LEGO1 0x10014150 MxU32 LegoJetski::VTable0x6c( LegoPathBoundary* p_boundary, Vector3& p_v1, @@ -57,26 +76,13 @@ MxU32 LegoJetski::VTable0x6c( return 0; } -// STUB: LEGO1 0x10014180 -void LegoJetski::VTable0x70(float p_float) -{ - // TODO -} - -// STUB: LEGO1 0x100141b0 -MxResult LegoJetski::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) -{ - // TODO - return 0; -} - -// STUB: LEGO1 0x100141c0 +// STUB: LEGO1 0x100141d0 void LegoJetski::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) { // TODO } -// STUB: LEGO1 0x10014200 +// STUB: LEGO1 0x10014210 MxResult LegoJetski::VTable0x9c() { // TODO diff --git a/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp b/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp index 9faead44..18a4f3d9 100644 --- a/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legojetskiraceactor.cpp @@ -2,12 +2,6 @@ DECOMP_SIZE_ASSERT(LegoJetskiRaceActor, 0x1a8) -// STUB: LEGO1 0x10014220 -void LegoJetskiRaceActor::VTable0x1c() -{ - // TODO -} - // FUNCTION: LEGO1 0x10080ef0 LegoJetskiRaceActor::LegoJetskiRaceActor() { @@ -17,7 +11,19 @@ LegoJetskiRaceActor::LegoJetskiRaceActor() m_unk0x150 = 1.5f; } -// STUB: LEGO1 0x10081fc0 +// STUB: LEGO1 0x10081120 +void LegoJetskiRaceActor::VTable0x1c() +{ + // TODO +} + +// STUB: LEGO1 0x10081550 +void LegoJetskiRaceActor::VTable0x70(float p_float) +{ + // TODO +} + +// STUB: LEGO1 0x10081fd0 MxU32 LegoJetskiRaceActor::VTable0x6c( LegoPathBoundary* p_boundary, Vector3& p_v1, @@ -30,22 +36,3 @@ MxU32 LegoJetskiRaceActor::VTable0x6c( // TODO return 0; } - -// STUB: LEGO1 0x100822c0 -void LegoJetskiRaceActor::VTable0x70(float p_float) -{ - // TODO -} - -// STUB: LEGO1 0x100822d0 -void LegoJetskiRaceActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) -{ - // TODO -} - -// STUB: LEGO1 0x100822e0 -MxResult LegoJetskiRaceActor::VTable0x9c() -{ - // TODO - return SUCCESS; -} 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/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index d19a854a..74236576 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -705,7 +705,7 @@ void LegoWorld::Enable(MxBool p_enable) else if (!p_enable && m_set0xd0.empty()) { MxPresenter* presenter; LegoPathController* controller; - LegoPathActor* actor = CurrentActor(); + LegoPathActor* actor = UserActor(); if (actor) { RemoveActor(actor); diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index 1d6d38d6..3e672423 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -284,7 +284,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); } @@ -308,12 +308,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); @@ -339,7 +339,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; @@ -354,7 +354,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; } @@ -363,7 +363,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) { @@ -383,7 +383,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); @@ -396,7 +396,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); @@ -432,13 +432,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; } @@ -470,14 +470,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; } } @@ -491,7 +491,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 e6c2cdc1..a0cc4113 100644 --- a/LEGO1/lego/legoomni/src/main/legomain.cpp +++ b/LEGO1/lego/legoomni/src/main/legomain.cpp @@ -65,7 +65,7 @@ void LegoOmni::Init() m_worldList = NULL; m_currentWorld = NULL; m_exit = FALSE; - m_currentActor = NULL; + m_userActor = NULL; m_characterManager = NULL; m_plantManager = NULL; m_gameState = NULL; @@ -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/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index b2250703..c374ab5e 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -554,7 +554,7 @@ void LegoPathActor::ParseAction(char* p_extra) if (KeyValueStringParse(value, g_strPERMIT_NAVIGATE, p_extra)) { SetUserNavFlag(TRUE); NavController()->ResetMaxLinearVel(m_worldSpeed); - SetCurrentActor(this); + SetUserActor(this); } char* token; 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 7430f922..ccb6ceda 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; } @@ -61,9 +61,9 @@ MxResult LegoRace::Create(MxDSAction& p_dsAction) if (result == SUCCESS) { m_act1State = (Act1State*) GameState()->GetState("Act1State"); ControlManager()->Register(this); - m_pathActor = CurrentActor(); + m_pathActor = UserActor(); m_pathActor->SetWorldSpeed(0); - SetCurrentActor(NULL); + SetUserActor(NULL); } return result; @@ -74,7 +74,7 @@ LegoRace::~LegoRace() { g_unk0x100f119c = FALSE; if (m_pathActor) { - SetCurrentActor(m_pathActor); + SetUserActor(m_pathActor); NavController()->ResetMaxLinearVel(m_pathActor->GetMaxLinearVel()); m_pathActor = NULL; } @@ -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); @@ -118,7 +118,7 @@ MxLong LegoRace::Notify(MxParam& p_param) void LegoRace::Enable(MxBool p_enable) { if (GetUnknown0xd0Empty() != p_enable && !p_enable) { - Remove(CurrentActor()); + Remove(UserActor()); MxU8 oldActorId = GameState()->GetActorId(); GameState()->RemoveActor(); @@ -134,11 +134,16 @@ RaceState::RaceState() // TODO } -// STUB: LEGO1 0x10016140 -MxResult RaceState::Serialize(LegoFile* p_legoFile) +// FUNCTION: LEGO1 0x10016140 +MxResult RaceState::Serialize(LegoFile* p_file) { - // TODO - return LegoState::Serialize(p_legoFile); + LegoState::Serialize(p_file); + + for (MxS16 i = 0; i < 5; i++) { + m_state[i].Serialize(p_file); + } + + return SUCCESS; } // FUNCTION: LEGO1 0x10016280 diff --git a/LEGO1/lego/legoomni/src/race/legoraceactor.cpp b/LEGO1/lego/legoomni/src/race/legoraceactor.cpp index 77f2a785..9bc47709 100644 --- a/LEGO1/lego/legoomni/src/race/legoraceactor.cpp +++ b/LEGO1/lego/legoomni/src/race/legoraceactor.cpp @@ -2,12 +2,6 @@ DECOMP_SIZE_ASSERT(LegoRaceActor, 0x180) -// STUB: LEGO1 0x10014190 -void LegoRaceActor::VTable0x74(Matrix4& p_transform) -{ - // TODO -} - // FUNCTION: LEGO1 0x100145d0 LegoRaceActor::LegoRaceActor() { @@ -15,33 +9,21 @@ LegoRaceActor::LegoRaceActor() m_unk0x08 = 0; } -// STUB: LEGO1 0x10014cb0 -void LegoRaceActor::SetWorldSpeed(MxFloat p_worldSpeed) -{ - // TODO -} - -// STUB: LEGO1 0x10014cc0 +// STUB: LEGO1 0x10014750 MxS32 LegoRaceActor::VTable0x68(Vector3&, Vector3&, Vector3&) { // TODO return 0; } -// STUB: LEGO1 0x10014cd0 -void LegoRaceActor::VTable0x70(float p_float) -{ - // TODO -} - -// STUB: LEGO1 0x10014ce0 +// STUB: LEGO1 0x100147f0 MxU32 LegoRaceActor::VTable0x90(float, Matrix4&) { // TODO return 0; } -// STUB: LEGO1 0x10014cf0 +// STUB: LEGO1 0x10014a00 MxResult LegoRaceActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) { // TODO diff --git a/LEGO1/lego/legoomni/src/race/legoracecar.cpp b/LEGO1/lego/legoomni/src/race/legoracecar.cpp index 0345f9eb..ead26c64 100644 --- a/LEGO1/lego/legoomni/src/race/legoracecar.cpp +++ b/LEGO1/lego/legoomni/src/race/legoracecar.cpp @@ -18,6 +18,25 @@ LegoRaceCar::LegoRaceCar() NotificationManager()->Register(this); } +// STUB: LEGO1 0x10012c80 +LegoRaceCar::~LegoRaceCar() +{ + // TODO +} + +// STUB: LEGO1 0x10012d90 +MxLong LegoRaceCar::Notify(MxParam& p_param) +{ + // TODO + return 0; +} + +// STUB: LEGO1 0x10012e60 +void LegoRaceCar::SetWorldSpeed(MxFloat p_worldSpeed) +{ + // TODO +} + // FUNCTION: LEGO1 0x10012ea0 void LegoRaceCar::FUN_10012ea0(float p_worldSpeed) { @@ -31,6 +50,12 @@ void LegoRaceCar::FUN_10012ea0(float p_worldSpeed) } } +// STUB: LEGO1 0x10012ef0 +void LegoRaceCar::ParseAction(char*) +{ + // TODO +} + // STUB: LEGO1 0x10012ff0 void LegoRaceCar::FUN_10012ff0(float) { @@ -44,26 +69,27 @@ MxBool LegoRaceCar::FUN_10013130(float) return TRUE; } -// STUB: LEGO1 0x10014280 -MxLong LegoRaceCar::Notify(MxParam& p_param) +// STUB: LEGO1 0x100131f0 +void LegoRaceCar::VTable0x70(float p_float) +{ + // TODO +} + +// STUB: LEGO1 0x100133c0 +MxResult LegoRaceCar::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) { // TODO return 0; } -// STUB: LEGO1 0x100144d0 -void LegoRaceCar::ParseAction(char*) +// STUB: LEGO1 0x10013600 +MxResult LegoRaceCar::VTable0x9c() { // TODO + return SUCCESS; } -// STUB: LEGO1 0x100144e0 -void LegoRaceCar::SetWorldSpeed(MxFloat p_worldSpeed) -{ - // TODO -} - -// STUB: LEGO1 0x100144f0 +// STUB: LEGO1 0x10014500 MxU32 LegoRaceCar::VTable0x6c( LegoPathBoundary* p_boundary, Vector3& p_v1, @@ -77,28 +103,8 @@ MxU32 LegoRaceCar::VTable0x6c( return 0; } -// STUB: LEGO1 0x10014530 -void LegoRaceCar::VTable0x70(float p_float) -{ - // TODO -} - -// STUB: LEGO1 0x10014540 -MxResult LegoRaceCar::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) -{ - // TODO - return 0; -} - -// STUB: LEGO1 0x10014550 +// STUB: LEGO1 0x10014560 void LegoRaceCar::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) { // TODO } - -// STUB: LEGO1 0x10014580 -MxResult LegoRaceCar::VTable0x9c() -{ - // TODO - return SUCCESS; -} diff --git a/LEGO1/lego/legoomni/src/race/legoracemap.cpp b/LEGO1/lego/legoomni/src/race/legoracemap.cpp index 9af2bff4..710e9140 100644 --- a/LEGO1/lego/legoomni/src/race/legoracemap.cpp +++ b/LEGO1/lego/legoomni/src/race/legoracemap.cpp @@ -14,8 +14,27 @@ LegoRaceMap::LegoRaceMap() ControlManager()->Register(this); } +// STUB: LEGO1 0x1005d2b0 +LegoRaceMap::~LegoRaceMap() +{ + // TODO +} + +// STUB: LEGO1 0x1005d310 +void LegoRaceMap::ParseAction(char* p_extra) +{ + // TODO +} + // FUNCTION: LEGO1 0x1005d4b0 void LegoRaceMap::FUN_1005d4b0() { // TODO } + +// STUB: LEGO1 0x1005d550 +MxLong LegoRaceMap::Notify(MxParam& p_param) +{ + // TODO + return 0; +} 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/gasstation.cpp b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp index 10debbd7..aadf6b1c 100644 --- a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp +++ b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp @@ -131,7 +131,7 @@ void GasStation::ReadyWorld() PlayMusic(JukeboxScript::c_JBMusic2); m_trackLedBitmap = (MxStillPresenter*) Find("MxStillPresenter", "TrackLed_Bitmap"); - m_currentActorId = CurrentActor()->GetActorId(); + m_currentActorId = UserActor()->GetActorId(); switch (m_currentActorId) { case LegoActor::c_pepper: @@ -435,11 +435,27 @@ GasStationState::GasStationState() unk0x08[2] = -1; } -// STUB: LEGO1 0x10006300 -MxResult GasStationState::Serialize(LegoFile* p_legoFile) +// FUNCTION: LEGO1 0x10006300 +MxResult GasStationState::Serialize(LegoFile* p_file) { - // TODO - return LegoState::Serialize(p_legoFile); + LegoState::Serialize(p_file); + + if (p_file->IsWriteMode()) { + Write(p_file, m_unk0x18); + Write(p_file, m_unk0x1a); + Write(p_file, m_unk0x1c); + Write(p_file, m_unk0x1e); + Write(p_file, m_unk0x20); + } + else if (p_file->IsReadMode()) { + Read(p_file, &m_unk0x18); + Read(p_file, &m_unk0x1a); + Read(p_file, &m_unk0x1c); + Read(p_file, &m_unk0x1e); + Read(p_file, &m_unk0x20); + } + + return SUCCESS; } // STUB: LEGO1 0x10006430 diff --git a/LEGO1/lego/legoomni/src/worlds/hospital.cpp b/LEGO1/lego/legoomni/src/worlds/hospital.cpp index 8cd8ae92..f29fe3df 100644 --- a/LEGO1/lego/legoomni/src/worlds/hospital.cpp +++ b/LEGO1/lego/legoomni/src/worlds/hospital.cpp @@ -144,11 +144,11 @@ void Hospital::ReadyWorld() m_copLedBitmap = (MxStillPresenter*) Find("MxStillPresenter", "CopLed_Bitmap"); m_pizzaLedBitmap = (MxStillPresenter*) Find("MxStillPresenter", "PizzaLed_Bitmap"); - if (CurrentActor() == NULL) { + if (UserActor() == NULL) { m_currentActorId = LegoActor::c_laura; } else { - m_currentActorId = CurrentActor()->GetActorId(); + m_currentActorId = UserActor()->GetActorId(); } switch (m_currentActorId) { @@ -684,35 +684,25 @@ HospitalState::HospitalState() } // FUNCTION: LEGO1 0x10076530 -MxResult HospitalState::Serialize(LegoFile* p_legoFile) +MxResult HospitalState::Serialize(LegoFile* p_file) { - LegoState::Serialize(p_legoFile); + LegoState::Serialize(p_file); - if (p_legoFile->IsWriteMode()) { - // A write variable needs to be used here, otherwise - // the compiler aggresively optimizes the function - MxS16 write; - - write = m_unk0x0c; - p_legoFile->Write(&write, sizeof(m_unk0x0c)); - write = m_unk0x0e; - p_legoFile->Write(&write, sizeof(m_unk0x0e)); - write = m_unk0x10; - p_legoFile->Write(&write, sizeof(m_unk0x10)); - write = m_unk0x12; - p_legoFile->Write(&write, sizeof(m_unk0x12)); - write = m_unk0x14; - p_legoFile->Write(&write, sizeof(m_unk0x14)); - write = m_unk0x16; - p_legoFile->Write(&write, sizeof(m_unk0x16)); + if (p_file->IsWriteMode()) { + Write(p_file, m_unk0x0c); + Write(p_file, m_unk0x0e); + Write(p_file, m_unk0x10); + Write(p_file, m_unk0x12); + Write(p_file, m_unk0x14); + Write(p_file, m_unk0x16); } - else if (p_legoFile->IsReadMode()) { - p_legoFile->Read(&m_unk0x0c, sizeof(m_unk0x0c)); - p_legoFile->Read(&m_unk0x0e, sizeof(m_unk0x0e)); - p_legoFile->Read(&m_unk0x10, sizeof(m_unk0x10)); - p_legoFile->Read(&m_unk0x12, sizeof(m_unk0x12)); - p_legoFile->Read(&m_unk0x14, sizeof(m_unk0x14)); - p_legoFile->Read(&m_unk0x16, sizeof(m_unk0x16)); + else if (p_file->IsReadMode()) { + Read(p_file, &m_unk0x0c); + Read(p_file, &m_unk0x0e); + Read(p_file, &m_unk0x10); + Read(p_file, &m_unk0x12); + Read(p_file, &m_unk0x14); + Read(p_file, &m_unk0x16); } return SUCCESS; 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 b96d5814..b542afac 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" @@ -82,8 +82,8 @@ Isle::~Isle() InputManager()->ClearWorld(); } - if (CurrentActor() != NULL) { - VTable0x6c(CurrentActor()); + if (UserActor() != NULL) { + VTable0x6c(UserActor()); } NotificationManager()->Unregister(this); @@ -157,7 +157,7 @@ MxLong Isle::Notify(MxParam& p_param) case c_notificationEndAnim: switch (m_act1state->m_unk0x018) { case 4: - result = CurrentActor()->Notify(p_param); + result = UserActor()->Notify(p_param); break; case 8: result = m_towtrack->Notify(p_param); @@ -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,15 +469,15 @@ void Isle::UpdateGlobe() } // FUNCTION: LEGO1 0x100315f0 -MxLong Isle::HandleType19Notification(MxType19NotificationParam& p_param) +MxLong Isle::HandlePathStruct(LegoPathStructEvent& p_param) { MxLong result = 0; - if (CurrentActor() != NULL) { - if (CurrentActor() == m_dunebuggy) { + if (UserActor() != NULL) { + if (UserActor() == m_dunebuggy) { result = m_dunebuggy->Notify(p_param); } - else if (CurrentActor() == m_motocycle) { + else if (UserActor() == m_motocycle) { result = m_motocycle->Notify(p_param); } } @@ -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; @@ -544,9 +545,9 @@ void Isle::Enable(MxBool p_enable) VideoManager()->ResetPalette(FALSE); m_act1state->FUN_10034d00(); - if (CurrentActor() != NULL && CurrentActor()->GetActorId() != LegoActor::c_none) { + if (UserActor() != NULL && UserActor()->GetActorId() != LegoActor::c_none) { // TODO: Match, most likely an inline function - MxS32 targetEntityId = (CurrentActor()->GetActorId() == 1) + 250; + MxS32 targetEntityId = (UserActor()->GetActorId() == 1) + 250; if (targetEntityId != -1) { InvokeAction(Extra::e_start, *g_isleScript, targetEntityId, NULL); @@ -575,8 +576,8 @@ void Isle::Enable(MxBool p_enable) } } - if (CurrentActor() != NULL && CurrentActor()->IsA("Jetski")) { - IslePathActor* actor = (IslePathActor*) CurrentActor(); + if (UserActor() != NULL && UserActor()->IsA("Jetski")) { + IslePathActor* actor = (IslePathActor*) UserActor(); actor->SpawnPlayer( LegoGameState::e_unk45, FALSE, @@ -599,7 +600,7 @@ void Isle::Enable(MxBool p_enable) m_act1state->m_unk0x018 = 5; } - PlaceActor(CurrentActor()); + PlaceActor(UserActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE @@ -622,7 +623,7 @@ void Isle::Enable(MxBool p_enable) SetIsWorldActive(FALSE); break; case LegoGameState::e_bike: - PlaceActor(CurrentActor()); + PlaceActor(UserActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE @@ -635,7 +636,7 @@ void Isle::Enable(MxBool p_enable) #endif break; case LegoGameState::e_dunecar: - PlaceActor(CurrentActor()); + PlaceActor(UserActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE @@ -648,7 +649,7 @@ void Isle::Enable(MxBool p_enable) #endif break; case LegoGameState::e_motocycle: - PlaceActor(CurrentActor()); + PlaceActor(UserActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE @@ -661,7 +662,7 @@ void Isle::Enable(MxBool p_enable) #endif break; case LegoGameState::e_copter: - PlaceActor(CurrentActor()); + PlaceActor(UserActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE @@ -674,7 +675,7 @@ void Isle::Enable(MxBool p_enable) #endif break; case LegoGameState::e_skateboard: - PlaceActor(CurrentActor()); + PlaceActor(UserActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE @@ -687,7 +688,7 @@ void Isle::Enable(MxBool p_enable) #endif break; case LegoGameState::e_jetski: - PlaceActor(CurrentActor()); + PlaceActor(UserActor()); SetIsWorldActive(TRUE); #ifdef COMPAT_MODE @@ -714,7 +715,7 @@ void Isle::Enable(MxBool p_enable) AnimationManager()->FUN_10064740(NULL); } else if (GameState()->m_currentArea == LegoGameState::e_unk66) { - Mx3DPointFloat position(CurrentActor()->GetROI()->GetWorldPosition()); + Mx3DPointFloat position(UserActor()->GetROI()->GetWorldPosition()); Mx3DPointFloat sub(-21.375f, 0.0f, -41.75f); ((Vector3&) sub).Sub(position); @@ -730,7 +731,7 @@ void Isle::Enable(MxBool p_enable) } break; case 5: { - ((IslePathActor*) CurrentActor()) + ((IslePathActor*) UserActor()) ->SpawnPlayer( LegoGameState::e_jetrace2, FALSE, @@ -763,7 +764,7 @@ void Isle::Enable(MxBool p_enable) } case 6: { GameState()->m_currentArea = LegoGameState::e_carraceExterior; - ((IslePathActor*) CurrentActor()) + ((IslePathActor*) UserActor()) ->SpawnPlayer( LegoGameState::e_unk21, FALSE, @@ -813,7 +814,7 @@ void Isle::Enable(MxBool p_enable) break; case 11: m_act1state->m_unk0x018 = 0; - ((IslePathActor*) CurrentActor()) + ((IslePathActor*) UserActor()) ->SpawnPlayer( LegoGameState::e_jukeboxExterior, TRUE, @@ -863,9 +864,9 @@ void Isle::FUN_10032620() switch (GameState()->m_currentArea) { case LegoGameState::e_unk66: { - MxMatrix mat(CurrentActor()->GetROI()->GetLocal2World()); - LegoPathBoundary* boundary = CurrentActor()->GetBoundary(); - ((IslePathActor*) CurrentActor())->VTable0xec(mat, boundary, TRUE); + MxMatrix mat(UserActor()->GetROI()->GetLocal2World()); + LegoPathBoundary* boundary = UserActor()->GetBoundary(); + ((IslePathActor*) UserActor())->VTable0xec(mat, boundary, TRUE); break; } case LegoGameState::e_unk4: @@ -878,7 +879,7 @@ void Isle::FUN_10032620() case LegoGameState::e_hospitalExterior: case LegoGameState::e_unk31: case LegoGameState::e_policeExterior: - ((IslePathActor*) CurrentActor()) + ((IslePathActor*) UserActor()) ->SpawnPlayer( GameState()->m_currentArea, TRUE, @@ -1026,7 +1027,7 @@ MxLong Isle::HandleTransitionEnd() FUN_10032d30(IsleScript::c_AmbulanceFuelMeter, JukeboxScript::c_MusicTheme1, NULL, TRUE); if (!m_act1state->m_unk0x01f) { - m_ambulance->FUN_10037060(); + m_ambulance->ActivateSceneActions(); } break; case LegoGameState::e_towtrack: @@ -1188,19 +1189,19 @@ MxBool Isle::Escape() switch (m_act1state->m_unk0x018) { case 3: - if (CurrentActor() != NULL) { + if (UserActor() != NULL) { m_pizza->FUN_10038380(); m_pizza->FUN_100382b0(); } break; case 8: - if (CurrentActor() != NULL && !CurrentActor()->IsA("TowTrack")) { + if (UserActor() != NULL && !UserActor()->IsA("TowTrack")) { m_towtrack->FUN_1004db10(); m_towtrack->FUN_1004dbe0(); } break; case 10: - if (CurrentActor() != NULL && !CurrentActor()->IsA("Ambulance")) { + if (UserActor() != NULL && !UserActor()->IsA("Ambulance")) { m_ambulance->StopActions(); m_ambulance->FUN_10037250(); } @@ -1217,9 +1218,9 @@ MxBool Isle::Escape() AnimationManager()->FUN_10061010(FALSE); DeleteObjects(&m_atom, IsleScript::c_sba001bu_RunAnim, IsleScript::c_FNS018EN_Wav_518); - if (CurrentActor()) { - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->Exit(); + if (UserActor()) { + if (UserActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) UserActor())->Exit(); m_skateboard->SetUnknown0x160(FALSE); } } @@ -1241,21 +1242,21 @@ MxBool Isle::Escape() void Isle::FUN_10033350() { if (m_act1state->m_unk0x018 == 10) { - if (CurrentActor() != NULL && !CurrentActor()->IsA("Ambulance")) { + if (UserActor() != NULL && !UserActor()->IsA("Ambulance")) { m_ambulance->StopActions(); m_ambulance->FUN_10037250(); } } if (m_act1state->m_unk0x018 == 8) { - if (CurrentActor() != NULL && !CurrentActor()->IsA("TowTrack")) { + if (UserActor() != NULL && !UserActor()->IsA("TowTrack")) { m_towtrack->FUN_1004db10(); m_towtrack->FUN_1004dbe0(); } } if (m_act1state->m_unk0x018 == 3) { - if (CurrentActor() != NULL) { + if (UserActor() != NULL) { m_pizza->FUN_10038380(); m_pizza->FUN_100382b0(); } @@ -1263,9 +1264,9 @@ void Isle::FUN_10033350() AnimationManager()->FUN_10061010(FALSE); - if (CurrentActor()) { - if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { - ((IslePathActor*) CurrentActor())->Exit(); + if (UserActor()) { + if (UserActor()->GetActorId() != GameState()->GetActorId()) { + ((IslePathActor*) UserActor())->Exit(); m_skateboard->SetUnknown0x160(FALSE); } } @@ -1313,138 +1314,138 @@ Act1State::Act1State() : m_unk0x00c(0), m_unk0x00e(0), m_unk0x008(NULL), m_unk0x } // FUNCTION: LEGO1 0x10033ac0 -MxResult Act1State::Serialize(LegoFile* p_legoFile) +MxResult Act1State::Serialize(LegoFile* p_file) { - LegoState::Serialize(p_legoFile); + LegoState::Serialize(p_file); - m_unk0x024.Serialize(p_legoFile); - m_unk0x070.Serialize(p_legoFile); - m_unk0x0bc.Serialize(p_legoFile); - m_unk0x108.Serialize(p_legoFile); - m_unk0x164.Serialize(p_legoFile); - m_unk0x1bc.Serialize(p_legoFile); - m_unk0x210.Serialize(p_legoFile); + m_unk0x024.Serialize(p_file); + m_unk0x070.Serialize(p_file); + m_unk0x0bc.Serialize(p_file); + m_unk0x108.Serialize(p_file); + m_unk0x164.Serialize(p_file); + m_unk0x1bc.Serialize(p_file); + m_unk0x210.Serialize(p_file); - if (p_legoFile->IsWriteMode()) { + if (p_file->IsWriteMode()) { if (m_unk0x108.GetName()->Compare("") != 0) { if (m_unk0x154) { - WriteNamedTexture(p_legoFile, m_unk0x154); + WriteNamedTexture(p_file, m_unk0x154); } else { - FUN_1003f540(p_legoFile, "chwind.gif"); + FUN_1003f540(p_file, "chwind.gif"); } if (m_unk0x158) { - WriteNamedTexture(p_legoFile, m_unk0x158); + WriteNamedTexture(p_file, m_unk0x158); } else { - FUN_1003f540(p_legoFile, "chjetl.gif"); + FUN_1003f540(p_file, "chjetl.gif"); } if (m_unk0x15c) { - WriteNamedTexture(p_legoFile, m_unk0x15c); + WriteNamedTexture(p_file, m_unk0x15c); } else { - FUN_1003f540(p_legoFile, "chjetr.gif"); + FUN_1003f540(p_file, "chjetr.gif"); } } if (m_unk0x164.GetName()->Compare("") != 0) { if (m_unk0x1b0) { - WriteNamedTexture(p_legoFile, m_unk0x1b0); + WriteNamedTexture(p_file, m_unk0x1b0); } else { - FUN_1003f540(p_legoFile, "jsfrnt.gif"); + FUN_1003f540(p_file, "jsfrnt.gif"); } if (m_unk0x1b4) { - WriteNamedTexture(p_legoFile, m_unk0x1b4); + WriteNamedTexture(p_file, m_unk0x1b4); } else { - FUN_1003f540(p_legoFile, "jswnsh.gif"); + FUN_1003f540(p_file, "jswnsh.gif"); } } if (m_unk0x1bc.GetName()->Compare("") != 0) { if (m_unk0x208) { - WriteNamedTexture(p_legoFile, m_unk0x208); + WriteNamedTexture(p_file, m_unk0x208); } else { - FUN_1003f540(p_legoFile, "dbfrfn.gif"); + FUN_1003f540(p_file, "dbfrfn.gif"); } } if (m_unk0x210.GetName()->Compare("") != 0) { if (m_unk0x25c) { - WriteNamedTexture(p_legoFile, m_unk0x25c); + WriteNamedTexture(p_file, m_unk0x25c); } else { - FUN_1003f540(p_legoFile, "rcfrnt.gif"); + FUN_1003f540(p_file, "rcfrnt.gif"); } if (m_unk0x260) { - WriteNamedTexture(p_legoFile, m_unk0x260); + WriteNamedTexture(p_file, m_unk0x260); } else { - FUN_1003f540(p_legoFile, "rcback.gif"); + FUN_1003f540(p_file, "rcback.gif"); } if (m_unk0x264) { - WriteNamedTexture(p_legoFile, m_unk0x264); + WriteNamedTexture(p_file, m_unk0x264); } else { - FUN_1003f540(p_legoFile, "rctail.gif"); + FUN_1003f540(p_file, "rctail.gif"); } } - p_legoFile->Write(&m_unk0x010, sizeof(m_unk0x010)); - p_legoFile->Write(&m_unk0x022, sizeof(m_unk0x022)); + Write(p_file, m_unk0x010); + Write(p_file, m_unk0x022); } - else if (p_legoFile->IsReadMode()) { + else if (p_file->IsReadMode()) { if (m_unk0x108.GetName()->Compare("") != 0) { - m_unk0x154 = ReadNamedTexture(p_legoFile); + m_unk0x154 = ReadNamedTexture(p_file); if (m_unk0x154 == NULL) { return FAILURE; } - m_unk0x158 = ReadNamedTexture(p_legoFile); + m_unk0x158 = ReadNamedTexture(p_file); if (m_unk0x158 == NULL) { return FAILURE; } - m_unk0x15c = ReadNamedTexture(p_legoFile); + m_unk0x15c = ReadNamedTexture(p_file); if (m_unk0x15c == NULL) { return FAILURE; } } if (m_unk0x164.GetName()->Compare("") != 0) { - m_unk0x1b0 = ReadNamedTexture(p_legoFile); + m_unk0x1b0 = ReadNamedTexture(p_file); if (m_unk0x1b0 == NULL) { return FAILURE; } - m_unk0x1b4 = ReadNamedTexture(p_legoFile); + m_unk0x1b4 = ReadNamedTexture(p_file); if (m_unk0x1b4 == NULL) { return FAILURE; } } if (m_unk0x1bc.GetName()->Compare("") != 0) { - m_unk0x208 = ReadNamedTexture(p_legoFile); + m_unk0x208 = ReadNamedTexture(p_file); if (m_unk0x208 == NULL) { return FAILURE; } } if (m_unk0x210.GetName()->Compare("") != 0) { - m_unk0x25c = ReadNamedTexture(p_legoFile); + m_unk0x25c = ReadNamedTexture(p_file); if (m_unk0x25c == NULL) { return FAILURE; } - m_unk0x260 = ReadNamedTexture(p_legoFile); + m_unk0x260 = ReadNamedTexture(p_file); if (m_unk0x260 == NULL) { return FAILURE; } - m_unk0x264 = ReadNamedTexture(p_legoFile); + m_unk0x264 = ReadNamedTexture(p_file); if (m_unk0x264 == NULL) { return FAILURE; } } - p_legoFile->Read(&m_unk0x010, sizeof(m_unk0x010)); - p_legoFile->Read(&m_unk0x022, sizeof(m_unk0x022)); + Read(p_file, &m_unk0x010); + Read(p_file, &m_unk0x022); } // TODO diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index e09eb88d..3e3a3149 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -10,6 +10,12 @@ DECOMP_SIZE_ASSERT(LegoAct2, 0x1154) DECOMP_SIZE_ASSERT(LegoAct2State, 0x10) +// STUB: LEGO1 0x1004fce0 +LegoAct2::LegoAct2() +{ + // TODO +} + // FUNCTION: LEGO1 0x1004fe10 MxBool LegoAct2::VTable0x5c() { @@ -26,8 +32,8 @@ LegoAct2::~LegoAct2() FUN_10051900(); InputManager()->UnRegister(this); - if (CurrentActor()) { - Remove(CurrentActor()); + if (UserActor()) { + Remove(UserActor()); } NotificationManager()->Unregister(this); diff --git a/LEGO1/lego/legoomni/src/worlds/police.cpp b/LEGO1/lego/legoomni/src/worlds/police.cpp index 0efbea20..1af480a8 100644 --- a/LEGO1/lego/legoomni/src/worlds/police.cpp +++ b/LEGO1/lego/legoomni/src/worlds/police.cpp @@ -206,16 +206,15 @@ PoliceState::PoliceState() } // FUNCTION: LEGO1 0x1005e990 -MxResult PoliceState::Serialize(LegoFile* p_legoFile) +MxResult PoliceState::Serialize(LegoFile* p_file) { - LegoState::Serialize(p_legoFile); + LegoState::Serialize(p_file); - if (p_legoFile->IsReadMode()) { - p_legoFile->Read(&m_policeScript, sizeof(m_policeScript)); + if (p_file->IsReadMode()) { + Read(p_file, &m_policeScript); } else { - PoliceScript::Script policeScript = m_policeScript; - p_legoFile->Write(&policeScript, sizeof(m_policeScript)); + Write(p_file, m_policeScript); } return SUCCESS; @@ -230,7 +229,7 @@ void PoliceState::FUN_1005ea40() return; } - switch (CurrentActor()->GetActorId()) { + switch (UserActor()->GetActorId()) { case LegoActor::c_nick: policeScript = PoliceScript::c_nps002la_RunAnim; m_policeScript = policeScript; 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/lego/sources/anim/legoanim.cpp b/LEGO1/lego/sources/anim/legoanim.cpp index 4be46ae4..45844ca9 100644 --- a/LEGO1/lego/sources/anim/legoanim.cpp +++ b/LEGO1/lego/sources/anim/legoanim.cpp @@ -18,7 +18,7 @@ DECOMP_SIZE_ASSERT(LegoAnim, 0x18) // FUNCTION: LEGO1 0x1009f000 LegoUnknownKey::LegoUnknownKey() { - m_unk0x08 = 0; + m_z = 0.0f; } // FUNCTION: LEGO1 0x1009f020 @@ -30,7 +30,7 @@ LegoResult LegoUnknownKey::Read(LegoStorage* p_storage) return result; } - result = p_storage->Read(&m_unk0x08, sizeof(m_unk0x08)); + result = p_storage->Read(&m_z, sizeof(m_z)); return result == SUCCESS ? SUCCESS : result; } @@ -136,11 +136,88 @@ LegoResult LegoAnimScene::Read(LegoStorage* p_storage) return result; } -// STUB: LEGO1 0x1009f490 -undefined4 LegoAnimScene::FUN_1009f490(LegoFloat p_time, Matrix4& p_matrix) +// FUNCTION: LEGO1 0x1009f490 +// FUNCTION: BETA10 0x10181a83 +LegoResult LegoAnimScene::FUN_1009f490(LegoFloat p_time, Matrix4& p_matrix) { - // TODO - return 0; + MxMatrix localb0; + MxMatrix local4c; + + Vector3 local5c(localb0[0]); + Vector3 local68(localb0[1]); + Vector3 local54(localb0[2]); + Vector3 localb8(localb0[3]); + + Mx3DPointFloat localcc; + + localb0.SetIdentity(); + + LegoU32 local60; + if (m_unk0x08 != 0) { + local60 = GetUnknown0x18(); + LegoAnimNodeData::GetTranslation(m_unk0x08, m_unk0x0c, p_time, localb0, local60); + SetUnknown0x18(local60); + localcc = localb8; + localb8.Clear(); + } + + if (m_unk0x00 != 0) { + local60 = GetUnknown0x1c(); + LegoAnimNodeData::GetTranslation(m_unk0x00, m_unk0x04, p_time, localb0, local60); + SetUnknown0x1c(local60); + } + + local54 = localcc; + ((Vector3&) local54).Sub(localb8); + + if (local54.Unitize() == 0) { + local5c.EqualsCross(&local68, &local54); + + if (local5c.Unitize() == 0) { + local68.EqualsCross(&local54, &local5c); + + localcc = p_matrix[3]; + ((Vector3&) localcc).Add(localb0[3]); + + p_matrix[3][0] = p_matrix[3][1] = p_matrix[3][2] = localb0[3][0] = localb0[3][1] = localb0[3][2] = 0; + + if (m_unk0x10 != 0) { + LegoU32 locald0 = -1; + LegoU32 locald8; + locald0 = GetUnknown0x20(); + + LegoU32 localdc = + LegoAnimNodeData::FindKeys(p_time, m_unk0x10, m_unk0x14, sizeof(*m_unk0x14), locald8, locald0); + + SetUnknown0x20(locald0); + + switch (localdc) { + case 1: + p_matrix.RotateZ(m_unk0x14[locald8].GetZ()); + break; + case 2: + // Seems to be unused + LegoFloat z = LegoAnimNodeData::Interpolate( + p_time, + m_unk0x14[locald8], + m_unk0x14[locald8].GetZ(), + m_unk0x14[locald8 + 1], + m_unk0x14[locald8 + 1].GetZ() + ); + p_matrix.RotateZ(m_unk0x14[locald8].GetZ()); + break; + } + } + + local4c = p_matrix; + p_matrix.Product(local4c.GetData(), localb0.GetData()); + p_matrix[3][0] = localcc[0]; + p_matrix[3][1] = localcc[1]; + p_matrix[3][2] = localcc[2]; + } + } + + return SUCCESS; } // FUNCTION: LEGO1 0x1009f900 diff --git a/LEGO1/lego/sources/anim/legoanim.h b/LEGO1/lego/sources/anim/legoanim.h index ae6f3bb6..8126c61b 100644 --- a/LEGO1/lego/sources/anim/legoanim.h +++ b/LEGO1/lego/sources/anim/legoanim.h @@ -103,8 +103,10 @@ class LegoUnknownKey : public LegoAnimKey { LegoUnknownKey(); LegoResult Read(LegoStorage* p_storage); + inline LegoFloat GetZ() { return m_z; } + protected: - undefined4 m_unk0x08; // 0x08 + LegoFloat m_z; // 0x08 }; // VTABLE: LEGO1 0x100db8c8 @@ -212,7 +214,15 @@ class LegoAnimScene { LegoAnimScene(); ~LegoAnimScene(); LegoResult Read(LegoStorage* p_storage); - undefined4 FUN_1009f490(LegoFloat p_time, Matrix4& p_matrix); + LegoResult FUN_1009f490(LegoFloat p_time, Matrix4& p_matrix); + + inline LegoU32 GetUnknown0x18() { return m_unk0x18; } + inline LegoU32 GetUnknown0x1c() { return m_unk0x1c; } + inline LegoU32 GetUnknown0x20() { return m_unk0x20; } + + inline void SetUnknown0x18(LegoU32 p_unk0x18) { m_unk0x18 = p_unk0x18; } + inline void SetUnknown0x1c(LegoU32 p_unk0x1c) { m_unk0x1c = p_unk0x1c; } + inline void SetUnknown0x20(LegoU32 p_unk0x20) { m_unk0x20 = p_unk0x20; } private: LegoU16 m_unk0x00; // 0x00 @@ -221,9 +231,9 @@ class LegoAnimScene { LegoTranslationKey* m_unk0x0c; // 0x0c LegoU16 m_unk0x10; // 0x10 LegoUnknownKey* m_unk0x14; // 0x14 - undefined4 m_unk0x18; // 0x18 - undefined4 m_unk0x1c; // 0x1c - undefined4 m_unk0x20; // 0x20 + LegoU32 m_unk0x18; // 0x18 + LegoU32 m_unk0x1c; // 0x1c + LegoU32 m_unk0x20; // 0x20 }; // VTABLE: LEGO1 0x100db8d8 diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index c2f35dae..a11436f3 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -706,12 +706,10 @@ void TimeROI::FUN_100a9b40(Matrix4& p_matrix, LegoTime p_time) m_time = p_time; Mx3DPointFloat targetPosition(p_matrix[3]); + Vector3 vec(m_local2world[3]); - // TODO: Figure out how to get type right for the call - ((Vector3&) targetPosition).Sub(Vector3(m_local2world[3])); - - float division = time * 0.001; - ((Vector3&) targetPosition).Div(division); + ((Vector3&) targetPosition).Sub(vec); + ((Vector3&) targetPosition).Div(time * 0.001); FUN_100a5a30(targetPosition); } diff --git a/LEGO1/mxgeometry/mxgeometry3d.h b/LEGO1/mxgeometry/mxgeometry3d.h index 61fdac1d..3f52b2e2 100644 --- a/LEGO1/mxgeometry/mxgeometry3d.h +++ b/LEGO1/mxgeometry/mxgeometry3d.h @@ -183,9 +183,9 @@ inline int UnknownMx4DPointFloat::FUN_100040a0(Vector4& p_v, float p_f) if (d1 + 1.0 > 0.00001) { if (1.0 - d1 > 0.00001) { double d = acos(d1); - sin(d); - d1 = sin((1.0 - p_f) * d) / sin(d); - d2 = sin(p_f * d) / sin(d); + double s = sin(d); + d1 = sin((1.0 - p_f) * d) / s; + d2 = sin(p_f * d) / s; } else { d1 = 1.0 - p_f; 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/mxobjectfactory.h b/LEGO1/omni/include/mxobjectfactory.h index 882ddc55..b52e5e32 100644 --- a/LEGO1/omni/include/mxobjectfactory.h +++ b/LEGO1/omni/include/mxobjectfactory.h @@ -42,6 +42,9 @@ class MxObjectFactory : public MxCore { // SYNTHETIC: LEGO1 0x100b1160 // MxObjectFactory::`scalar deleting destructor' + // SYNTHETIC: LEGO1 0x10009020 + // MxObjectFactory::~MxObjectFactory + private: #define X(V) MxAtomId m_id##V; FOR_MXOBJECTFACTORY_OBJECTS(X) 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 diff --git a/LEGO1/omni/src/common/mxobjectfactory.cpp b/LEGO1/omni/src/common/mxobjectfactory.cpp index 93f2e0a0..3722bb0e 100644 --- a/LEGO1/omni/src/common/mxobjectfactory.cpp +++ b/LEGO1/omni/src/common/mxobjectfactory.cpp @@ -19,7 +19,7 @@ DECOMP_SIZE_ASSERT(MxObjectFactory, 0x38); // 100af1db // FUNCTION: LEGO1 0x100b0d80 MxObjectFactory::MxObjectFactory() { -#define X(V) this->m_id##V = MxAtomId(#V, e_exact); +#define X(V) m_id##V = MxAtomId(#V, e_exact); FOR_MXOBJECTFACTORY_OBJECTS(X) #undef X } @@ -33,7 +33,7 @@ MxCore* MxObjectFactory::Create(const char* p_name) if (0) { } #define X(V) \ - else if (this->m_id##V == atom) \ + else if (m_id##V == atom) \ { \ object = new V; \ } diff --git a/LEGO1/realtime/vector.h b/LEGO1/realtime/vector.h index 3fd82220..cfccb6f4 100644 --- a/LEGO1/realtime/vector.h +++ b/LEGO1/realtime/vector.h @@ -138,7 +138,7 @@ class Vector2 { virtual void Mul(const float& p_value) { MulScalarImpl((float*) &p_value); } // vtable+0x5c // FUNCTION: LEGO1 0x10002240 - virtual void Div(float& p_value) { DivScalarImpl(&p_value); } // vtable+0x68 + virtual void Div(const float& p_value) { DivScalarImpl((float*) &p_value); } // vtable+0x68 // FUNCTION: LEGO1 0x10002250 virtual void SetVector(float* p_other) { EqualsImpl(p_other); } // vtable+0x70