From 68023379d83c0efe4356ab72c641a4106d4e252f Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 16 Jun 2024 09:54:40 -0400 Subject: [PATCH 1/9] Implement/match Bike (#1036) --- LEGO1/lego/legoomni/include/bike.h | 2 +- LEGO1/lego/legoomni/src/actors/bike.cpp | 82 +++++++++++++++++++++---- LEGO1/lego/legoomni/src/worlds/isle.cpp | 2 +- 3 files changed, 72 insertions(+), 14 deletions(-) diff --git a/LEGO1/lego/legoomni/include/bike.h b/LEGO1/lego/legoomni/include/bike.h index a77156b5..ea12ff1d 100644 --- a/LEGO1/lego/legoomni/include/bike.h +++ b/LEGO1/lego/legoomni/include/bike.h @@ -28,7 +28,7 @@ class Bike : public IslePathActor { MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 void Exit() override; // vtable+0xe4 - void FUN_10076b60(); + void ActivateSceneActions(); // SYNTHETIC: LEGO1 0x10076880 // Bike::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/src/actors/bike.cpp b/LEGO1/lego/legoomni/src/actors/bike.cpp index 52401e28..11096d0c 100644 --- a/LEGO1/lego/legoomni/src/actors/bike.cpp +++ b/LEGO1/lego/legoomni/src/actors/bike.cpp @@ -1,11 +1,16 @@ #include "bike.h" +#include "isle.h" #include "isle_actions.h" +#include "jukebox_actions.h" +#include "legoanimationmanager.h" #include "legocontrolmanager.h" #include "legogamestate.h" #include "legoutils.h" #include "legoworld.h" #include "misc.h" +#include "mxsoundpresenter.h" +#include "mxtransitionmanager.h" #include "scripts.h" DECOMP_SIZE_ASSERT(Bike, 0x164) @@ -13,9 +18,9 @@ DECOMP_SIZE_ASSERT(Bike, 0x164) // FUNCTION: LEGO1 0x10076670 Bike::Bike() { - this->m_maxLinearVel = 20.0; - this->m_unk0x150 = 3.0; - this->m_unk0x148 = 1; + m_maxLinearVel = 20.0; + m_unk0x150 = 3.0; + m_unk0x148 = 1; } // FUNCTION: LEGO1 0x100768f0 @@ -44,22 +49,75 @@ void Bike::Exit() ControlManager()->Unregister(this); } -// STUB: LEGO1 0x100769a0 +// FUNCTION: LEGO1 0x100769a0 MxLong Bike::HandleClick() { - // TODO - return 0; + if (FUN_1003ef60()) { + Act1State* state = (Act1State*) GameState()->GetState("Act1State"); + FUN_10015820(TRUE, 0); + + ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::Area::e_bike); + TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, TRUE); + + if (GameState()->GetActorId() != UserActor()->GetActorId()) { + ((IslePathActor*) UserActor())->Exit(); + } + + Enter(); + InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_BikeDashboard, NULL); + GetCurrentAction().SetObjectId(-1); + + Vector3 position = m_roi->GetWorldPosition(); + AnimationManager()->FUN_10064670(&position); + AnimationManager()->FUN_10064740(&position); + ControlManager()->Register(this); + } + + return 1; } -// STUB: LEGO1 0x10076aa0 +// FUNCTION: LEGO1 0x10076aa0 MxLong Bike::HandleControl(LegoControlManagerEvent& p_param) { - // TODO - return 0; + MxLong result = 0; + + if (p_param.GetUnknown0x28() == 1) { + switch (p_param.GetClickedObjectId()) { + case IsleScript::c_BikeArms_Ctl: + Exit(); + GameState()->m_currentArea = LegoGameState::e_unk66; + result = 1; + break; + case IsleScript::c_BikeInfo_Ctl: + ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_infomain); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + Exit(); + result = 1; + break; + case IsleScript::c_BikeHorn_Ctl: + MxSoundPresenter* presenter = + (MxSoundPresenter*) CurrentWorld()->Find("MxSoundPresenter", "BikeHorn_Sound"); + presenter->Enable(p_param.GetUnknown0x28()); + break; + } + } + + return result; } -// STUB: LEGO1 0x10076b60 -void Bike::FUN_10076b60() +// FUNCTION: LEGO1 0x10076b60 +void Bike::ActivateSceneActions() { - // TODO + PlayMusic(JukeboxScript::c_InformationCenter_Music); + + Act1State* act1state = (Act1State*) GameState()->GetState("Act1State"); + if (!act1state->m_unk0x022) { + act1state->m_unk0x022 = TRUE; + + MxMatrix mat(UserActor()->GetROI()->GetLocal2World()); + mat.TranslateBy(mat[2][0] * 2.5, mat[2][1] + 0.7, mat[2][2] * 2.5); + + AnimationManager() + ->FUN_10060dc0(IsleScript::c_sns006in_RunAnim, &mat, TRUE, FALSE, NULL, FALSE, TRUE, TRUE, TRUE); + } } diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index b542afac..b15cfc70 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -990,7 +990,7 @@ MxLong Isle::HandleTransitionEnd() FUN_10032d30(IsleScript::c_BikeDashboard_Bitmap, JukeboxScript::c_MusicTheme1, NULL, TRUE); if (!m_act1state->m_unk0x01f) { - m_bike->FUN_10076b60(); + m_bike->ActivateSceneActions(); } break; case LegoGameState::e_dunecar: From e4e0f4e4d3c3858300370bb5e3e4422d62ac57c1 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 16 Jun 2024 10:47:53 -0400 Subject: [PATCH 2/9] Implement/match Motocycle, consistent notification names (#1037) * Implement/match Motocycle, consistent notification names * Format * Fix * Fix return types * Fix return type * Fix annotations * Rename function --- LEGO1/lego/legoomni/include/ambulance.h | 18 +- LEGO1/lego/legoomni/include/bike.h | 8 +- LEGO1/lego/legoomni/include/carrace.h | 14 +- LEGO1/lego/legoomni/include/dunebuggy.h | 12 +- LEGO1/lego/legoomni/include/elevatorbottom.h | 4 +- LEGO1/lego/legoomni/include/gasstation.h | 14 +- LEGO1/lego/legoomni/include/helicopter.h | 14 +- LEGO1/lego/legoomni/include/hospital.h | 6 +- LEGO1/lego/legoomni/include/infocenter.h | 4 +- LEGO1/lego/legoomni/include/infocenterdoor.h | 4 +- LEGO1/lego/legoomni/include/isle.h | 6 +- LEGO1/lego/legoomni/include/isleactor.h | 16 +- LEGO1/lego/legoomni/include/islepathactor.h | 8 +- LEGO1/lego/legoomni/include/jetski.h | 12 +- LEGO1/lego/legoomni/include/jetskirace.h | 12 +- LEGO1/lego/legoomni/include/jukebox.h | 4 +- .../legoomni/include/legocontrolmanager.h | 22 +-- LEGO1/lego/legoomni/include/legopathstruct.h | 11 +- LEGO1/lego/legoomni/include/legorace.h | 12 +- LEGO1/lego/legoomni/include/legovariables.h | 2 + .../include/{motocycle.h => motorcycle.h} | 26 +-- .../legoomni/include/mxcontrolpresenter.h | 4 +- LEGO1/lego/legoomni/include/pizza.h | 6 +- LEGO1/lego/legoomni/include/pizzeria.h | 2 +- LEGO1/lego/legoomni/include/police.h | 4 +- LEGO1/lego/legoomni/include/radio.h | 4 +- .../lego/legoomni/include/registrationbook.h | 4 +- LEGO1/lego/legoomni/include/score.h | 4 +- LEGO1/lego/legoomni/include/skateboard.h | 10 +- LEGO1/lego/legoomni/include/towtrack.h | 16 +- LEGO1/lego/legoomni/src/actors/ambulance.cpp | 12 +- LEGO1/lego/legoomni/src/actors/bike.cpp | 2 +- LEGO1/lego/legoomni/src/actors/dunebuggy.cpp | 4 +- LEGO1/lego/legoomni/src/actors/helicopter.cpp | 2 +- LEGO1/lego/legoomni/src/actors/isleactor.cpp | 8 +- .../legoomni/src/actors/islepathactor.cpp | 4 +- LEGO1/lego/legoomni/src/actors/jetski.cpp | 2 +- LEGO1/lego/legoomni/src/actors/motorcycle.cpp | 165 ++++++++++++++---- LEGO1/lego/legoomni/src/actors/pizza.cpp | 6 +- LEGO1/lego/legoomni/src/actors/pizzeria.cpp | 2 +- LEGO1/lego/legoomni/src/actors/radio.cpp | 4 +- LEGO1/lego/legoomni/src/actors/skateboard.cpp | 2 +- LEGO1/lego/legoomni/src/actors/towtrack.cpp | 4 +- .../legoomni/src/common/legoobjectfactory.cpp | 2 +- LEGO1/lego/legoomni/src/common/legoutils.cpp | 2 +- .../legoomni/src/common/legovariables.cpp | 8 + .../src/common/mxcontrolpresenter.cpp | 22 +-- .../src/control/legocontrolmanager.cpp | 2 +- .../legoomni/src/paths/legopathstruct.cpp | 6 +- LEGO1/lego/legoomni/src/race/carrace.cpp | 2 +- LEGO1/lego/legoomni/src/race/jetskirace.cpp | 2 +- LEGO1/lego/legoomni/src/race/legorace.cpp | 4 +- .../legoomni/src/worlds/elevatorbottom.cpp | 4 +- LEGO1/lego/legoomni/src/worlds/gasstation.cpp | 8 +- LEGO1/lego/legoomni/src/worlds/hospital.cpp | 8 +- LEGO1/lego/legoomni/src/worlds/infocenter.cpp | 4 +- .../legoomni/src/worlds/infocenterdoor.cpp | 4 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 12 +- LEGO1/lego/legoomni/src/worlds/jukebox.cpp | 4 +- LEGO1/lego/legoomni/src/worlds/police.cpp | 4 +- .../legoomni/src/worlds/registrationbook.cpp | 4 +- LEGO1/lego/legoomni/src/worlds/score.cpp | 4 +- 62 files changed, 362 insertions(+), 244 deletions(-) rename LEGO1/lego/legoomni/include/{motocycle.h => motorcycle.h} (57%) diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index 79091329..e2b1ecf4 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -122,15 +122,15 @@ class Ambulance : public IslePathActor { return !strcmp(p_name, Ambulance::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c - void VTable0x70(float p_time) override; // vtable+0x70 - MxLong HandleClick() override; // vtable+0xcc - MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - MxLong 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 + 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(LegoControlManagerNotificationParam& p_param) override; // vtable+0xd4 + MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param) override; // vtable+0xdc + void Exit() override; // vtable+0xe4 + virtual MxLong HandleButtonDown(LegoControlManagerNotificationParam& p_param); // vtable+0xf0 + virtual MxLong HandleEndAction(MxEndActionNotificationParam& p_param); // vtable+0xf4 void CreateState(); void FUN_10036e60(); diff --git a/LEGO1/lego/legoomni/include/bike.h b/LEGO1/lego/legoomni/include/bike.h index ea12ff1d..266e34f4 100644 --- a/LEGO1/lego/legoomni/include/bike.h +++ b/LEGO1/lego/legoomni/include/bike.h @@ -23,10 +23,10 @@ class Bike : public IslePathActor { return !strcmp(p_name, Bike::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - MxLong HandleClick() override; // vtable+0xcc - MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerNotificationParam& p_param) override; // vtable+0xd4 + void Exit() override; // vtable+0xe4 void ActivateSceneActions(); diff --git a/LEGO1/lego/legoomni/include/carrace.h b/LEGO1/lego/legoomni/include/carrace.h index 2c67e11a..652bf3b0 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 HandlePathStruct(LegoPathStructEvent&) 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(LegoPathStructNotificationParam&) override; // vtable+0x70 + MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74 + MxLong HandleType0Notification(MxNotificationParam&) override; // vtable+0x78 // SYNTHETIC: LEGO1 0x10016c70 // CarRace::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/dunebuggy.h b/LEGO1/lego/legoomni/include/dunebuggy.h index 1fe1d00e..b103869b 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 HandlePathStruct(LegoPathStructEvent& 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(LegoControlManagerNotificationParam& p_param) override; // vtable+0xd4 + MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param) override; // vtable+0xdc + void Exit() override; // vtable+0xe4 void FUN_10068350(); diff --git a/LEGO1/lego/legoomni/include/elevatorbottom.h b/LEGO1/lego/legoomni/include/elevatorbottom.h index 7c94aff2..3e7c831e 100644 --- a/LEGO1/lego/legoomni/include/elevatorbottom.h +++ b/LEGO1/lego/legoomni/include/elevatorbottom.h @@ -5,7 +5,7 @@ #include "legogamestate.h" #include "legoworld.h" -class LegoControlManagerEvent; +class LegoControlManagerNotificationParam; // VTABLE: LEGO1 0x100d5f20 // SIZE 0xfc @@ -44,7 +44,7 @@ class ElevatorBottom : public LegoWorld { private: LegoGameState::Area m_destLocation; // 0xf8 - MxLong HandleControl(LegoControlManagerEvent& p_param); + MxLong HandleControl(LegoControlManagerNotificationParam& p_param); }; #endif // ELEVATORBOTTOM_H diff --git a/LEGO1/lego/legoomni/include/gasstation.h b/LEGO1/lego/legoomni/include/gasstation.h index 75234a25..af224e79 100644 --- a/LEGO1/lego/legoomni/include/gasstation.h +++ b/LEGO1/lego/legoomni/include/gasstation.h @@ -75,12 +75,12 @@ class GasStation : public LegoWorld { return !strcmp(p_name, GasStation::ClassName()) || LegoWorld::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void ReadyWorld() override; // vtable+0x50 - MxBool VTable0x5c() override; // vtable+0x5c - MxBool Escape() override; // vtable+0x64 - void Enable(MxBool p_enable) override; // vtable+0x68 - virtual MxLong HandleControl(LegoControlManagerEvent& p_param); // vtable+0x6c + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void ReadyWorld() override; // vtable+0x50 + MxBool VTable0x5c() override; // vtable+0x5c + MxBool Escape() override; // vtable+0x64 + void Enable(MxBool p_enable) override; // vtable+0x68 + virtual MxLong HandleControl(LegoControlManagerNotificationParam& p_param); // vtable+0x6c inline void PlayAction(MxU32 p_objectId); @@ -90,7 +90,7 @@ class GasStation : public LegoWorld { private: MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleKeyPress(MxS8 p_key); - MxLong HandleButtonDown(LegoControlManagerEvent& p_param); + MxLong HandleButtonDown(LegoControlManagerNotificationParam& p_param); MxS16 m_currentActorId; // 0xf8 undefined2 m_unk0xfa; // 0xfa diff --git a/LEGO1/lego/legoomni/include/helicopter.h b/LEGO1/lego/legoomni/include/helicopter.h index 7e63407d..2c6cf17e 100644 --- a/LEGO1/lego/legoomni/include/helicopter.h +++ b/LEGO1/lego/legoomni/include/helicopter.h @@ -65,13 +65,13 @@ class Helicopter : public IslePathActor { return !strcmp(p_name, Helicopter::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - void VTable0x70(float p_float) override; // vtable+0x70 - void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 - MxLong HandleClick() override; // vtable+0xcc - MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - MxLong HandleEndAnim(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_float) override; // vtable+0x70 + void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerNotificationParam& p_param) override; // vtable+0xd4 + MxLong HandleEndAnim(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 + void Exit() override; // vtable+0xe4 // SYNTHETIC: LEGO1 0x10003210 // Helicopter::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/hospital.h b/LEGO1/lego/legoomni/include/hospital.h index 4c453240..c378ba3e 100644 --- a/LEGO1/lego/legoomni/include/hospital.h +++ b/LEGO1/lego/legoomni/include/hospital.h @@ -7,7 +7,7 @@ #include "legostate.h" #include "legoworld.h" -class LegoControlManagerEvent; +class LegoControlManagerNotificationParam; class MxEndActionNotificationParam; class MxStillPresenter; @@ -89,8 +89,8 @@ class Hospital : public LegoWorld { private: MxLong HandleKeyPress(MxS8 p_key); MxLong HandleEndAction(MxEndActionNotificationParam& p_param); - MxLong HandleButtonDown(LegoControlManagerEvent& p_param); - MxBool HandleControl(LegoControlManagerEvent& p_param); + MxLong HandleButtonDown(LegoControlManagerNotificationParam& p_param); + MxBool HandleControl(LegoControlManagerNotificationParam& p_param); MxS16 m_currentActorId; // 0xf8 LegoGameState::Area m_destLocation; // 0xfc diff --git a/LEGO1/lego/legoomni/include/infocenter.h b/LEGO1/lego/legoomni/include/infocenter.h index 7d805246..5838b50c 100644 --- a/LEGO1/lego/legoomni/include/infocenter.h +++ b/LEGO1/lego/legoomni/include/infocenter.h @@ -10,7 +10,7 @@ class MxNotificationParam; class MxStillPresenter; -class LegoControlManagerEvent; +class LegoControlManagerNotificationParam; // VTABLE: LEGO1 0x100d93a8 // SIZE 0x94 @@ -129,7 +129,7 @@ class Infocenter : public LegoWorld { MxLong HandleKeyPress(MxS8 p_key); MxU8 HandleMouseMove(MxS32 p_x, MxS32 p_y); MxU8 HandleButtonUp(MxS32 p_x, MxS32 p_y); - MxU8 HandleControl(LegoControlManagerEvent& p_param); + MxU8 HandleControl(LegoControlManagerNotificationParam& p_param); MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleNotification0(MxNotificationParam& p_param); diff --git a/LEGO1/lego/legoomni/include/infocenterdoor.h b/LEGO1/lego/legoomni/include/infocenterdoor.h index 6d012b4c..0962d5eb 100644 --- a/LEGO1/lego/legoomni/include/infocenterdoor.h +++ b/LEGO1/lego/legoomni/include/infocenterdoor.h @@ -4,7 +4,7 @@ #include "legogamestate.h" #include "legoworld.h" -class LegoControlManagerEvent; +class LegoControlManagerNotificationParam; // VTABLE: LEGO1 0x100d72d8 // SIZE 0xfc @@ -43,7 +43,7 @@ class InfocenterDoor : public LegoWorld { private: LegoGameState::Area m_destLocation; // 0xf8 - MxLong HandleControl(LegoControlManagerEvent& p_param); + MxLong HandleControl(LegoControlManagerNotificationParam& p_param); }; #endif // INFOCENTERDOOR_H diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index d1faaa16..34a28a85 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 LegoPathStructEvent; +class LegoPathStructNotificationParam; class Pizza; class Pizzeria; class RaceCar; @@ -198,8 +198,8 @@ class Isle : public LegoWorld { protected: MxLong HandleEndAction(MxEndActionNotificationParam& p_param); - MxLong HandleControl(LegoControlManagerEvent& p_param); - MxLong HandlePathStruct(LegoPathStructEvent& p_param); + MxLong HandleControl(LegoControlManagerNotificationParam& p_param); + MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param); MxLong HandleTransitionEnd(); void HandleElevatorEndAction(); void UpdateGlobe(); diff --git a/LEGO1/lego/legoomni/include/isleactor.h b/LEGO1/lego/legoomni/include/isleactor.h index 388db2c2..17c95c25 100644 --- a/LEGO1/lego/legoomni/include/isleactor.h +++ b/LEGO1/lego/legoomni/include/isleactor.h @@ -3,6 +3,8 @@ #include "legoactor.h" +class LegoControlManagerNotificationParam; +class LegoPathStructNotificationParam; class LegoWorld; class MxEndActionNotificationParam; class MxNotificationParam; @@ -29,25 +31,25 @@ class IsleActor : public LegoActor { MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 // FUNCTION: LEGO1 0x1000e5f0 - virtual undefined4 HandleClick() { return 0; } // vtable+0x68 + virtual MxLong HandleClick() { return 0; } // vtable+0x68 // FUNCTION: LEGO1 0x1000e600 - virtual undefined4 VTable0x6c() { return 0; } // vtable+0x6c + virtual MxLong VTable0x6c() { return 0; } // vtable+0x6c // FUNCTION: LEGO1 0x1000e610 - virtual undefined4 VTable0x70() { return 0; } // vtable+0x70 + virtual MxLong HandleEndAnim() { return 0; } // vtable+0x70 // FUNCTION: LEGO1 0x1000e620 - virtual undefined4 HandleEndAction(MxEndActionNotificationParam&) { return 0; } // vtable+0x74 + virtual MxLong HandleEndAction(MxEndActionNotificationParam&) { return 0; } // vtable+0x74 // FUNCTION: LEGO1 0x1000e630 - virtual undefined4 HandleButtonDown(MxNotificationParam&) { return 0; } // vtable+0x78 + virtual MxLong HandleButtonDown(LegoControlManagerNotificationParam&) { return 0; } // vtable+0x78 // FUNCTION: LEGO1 0x1000e640 - virtual undefined4 HandleButtonUp(MxNotificationParam&) { return 0; } // vtable+0x7c + virtual MxLong HandleButtonUp(LegoControlManagerNotificationParam&) { return 0; } // vtable+0x7c // FUNCTION: LEGO1 0x1000e650 - virtual undefined4 VTable0x80(MxParam&) { return 0; } // vtable+0x80 + virtual MxLong HandlePathStruct(LegoPathStructNotificationParam&) { return 0; } // vtable+0x80 protected: LegoWorld* m_world; // 0x78 diff --git a/LEGO1/lego/legoomni/include/islepathactor.h b/LEGO1/lego/legoomni/include/islepathactor.h index 37b750d3..48948738 100644 --- a/LEGO1/lego/legoomni/include/islepathactor.h +++ b/LEGO1/lego/legoomni/include/islepathactor.h @@ -6,10 +6,10 @@ #include "mxtypes.h" #include "roi/legoroi.h" -class LegoControlManagerEvent; +class LegoControlManagerNotificationParam; class LegoEndAnimNotificationParam; class LegoWorld; -class LegoPathStructEvent; +class LegoPathStructNotificationParam; // VTABLE: LEGO1 0x100d4398 // SIZE 0x160 @@ -113,13 +113,13 @@ class IslePathActor : public LegoPathActor { virtual MxLong HandleNotification0() { return 0; } // vtable+0xd0 // FUNCTION: LEGO1 0x10002e80 - virtual MxLong HandleControl(LegoControlManagerEvent&) { return 0; } // vtable+0xd4 + virtual MxLong HandleControl(LegoControlManagerNotificationParam&) { return 0; } // vtable+0xd4 // FUNCTION: LEGO1 0x10002e90 virtual MxLong HandleEndAnim(LegoEndAnimNotificationParam&) { return 0; } // vtable+0xd8 // FUNCTION: LEGO1 0x10002e00 - virtual MxLong HandlePathStruct(LegoPathStructEvent&) { return 0; } // vtable+0xdc + virtual MxLong HandlePathStruct(LegoPathStructNotificationParam&) { return 0; } // vtable+0xdc virtual void Enter(); // vtable+0xe0 virtual void Exit(); // vtable+0xe4 diff --git a/LEGO1/lego/legoomni/include/jetski.h b/LEGO1/lego/legoomni/include/jetski.h index b49b11fe..4eb46096 100644 --- a/LEGO1/lego/legoomni/include/jetski.h +++ b/LEGO1/lego/legoomni/include/jetski.h @@ -4,7 +4,7 @@ #include "decomp.h" #include "islepathactor.h" -class LegoControlManagerEvent; +class LegoControlManagerNotificationParam; // VTABLE: LEGO1 0x100d9ec8 // SIZE 0x164 @@ -25,11 +25,11 @@ class Jetski : public IslePathActor { return !strcmp(p_name, Jetski::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&) override; // vtable+0xd4 - 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(LegoControlManagerNotificationParam&) override; // vtable+0xd4 + void Exit() override; // vtable+0xe4 void FUN_1007e990(); diff --git a/LEGO1/lego/legoomni/include/jetskirace.h b/LEGO1/lego/legoomni/include/jetskirace.h index 0d45fc4f..5a895faf 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 HandlePathStruct(LegoPathStructEvent&) 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(LegoPathStructNotificationParam&) 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 5ae7ba34..8f01a120 100644 --- a/LEGO1/lego/legoomni/include/jukebox.h +++ b/LEGO1/lego/legoomni/include/jukebox.h @@ -6,7 +6,7 @@ #include "legostate.h" #include "legoworld.h" -class LegoControlManagerEvent; +class LegoControlManagerNotificationParam; // VTABLE: LEGO1 0x100d4a90 // SIZE 0x10 @@ -79,7 +79,7 @@ class JukeBox : public LegoWorld { // JukeBox::`scalar deleting destructor' private: - MxBool HandleControl(LegoControlManagerEvent& p_param); + MxBool HandleControl(LegoControlManagerNotificationParam& p_param); LegoGameState::Area m_destLocation; // 0xf8 JukeBoxState* m_state; // 0xfc diff --git a/LEGO1/lego/legoomni/include/legocontrolmanager.h b/LEGO1/lego/legoomni/include/legocontrolmanager.h index 22cd2c58..8cbb8342 100644 --- a/LEGO1/lego/legoomni/include/legocontrolmanager.h +++ b/LEGO1/lego/legoomni/include/legocontrolmanager.h @@ -10,9 +10,9 @@ class MxControlPresenter; // VTABLE: LEGO1 0x100d6a98 // SIZE 0x2c -class LegoControlManagerEvent : public LegoEventNotificationParam { +class LegoControlManagerNotificationParam : public LegoEventNotificationParam { public: - inline LegoControlManagerEvent() : LegoEventNotificationParam() + inline LegoControlManagerNotificationParam() : LegoEventNotificationParam() { m_clickedObjectId = -1; m_clickedAtom = NULL; @@ -34,10 +34,10 @@ class LegoControlManagerEvent : public LegoEventNotificationParam { }; // SYNTHETIC: LEGO1 0x10028bf0 -// LegoControlManagerEvent::`scalar deleting destructor' +// LegoControlManagerNotificationParam::`scalar deleting destructor' // SYNTHETIC: LEGO1 0x10028c60 -// LegoControlManagerEvent::~LegoControlManagerEvent +// LegoControlManagerNotificationParam::~LegoControlManagerNotificationParam // VTABLE: LEGO1 0x100d6a80 class LegoControlManager : public MxCore { @@ -84,13 +84,13 @@ class LegoControlManager : public MxCore { // LegoControlManager::`scalar deleting destructor' private: - undefined4 m_unk0x08; // 0x08 - undefined4 m_unk0x0c; // 0x0c - MxBool m_unk0x10; // 0x10 - MxPresenter* m_unk0x14; // 0x14 - LegoControlManagerEvent m_event; // 0x18 - MxPresenterList* m_presenterList; // 0x44 - LegoNotifyList m_notifyList; // 0x48 + undefined4 m_unk0x08; // 0x08 + undefined4 m_unk0x0c; // 0x0c + MxBool m_unk0x10; // 0x10 + MxPresenter* m_unk0x14; // 0x14 + LegoControlManagerNotificationParam m_event; // 0x18 + MxPresenterList* m_presenterList; // 0x44 + LegoNotifyList m_notifyList; // 0x48 }; #endif // LEGOCONTROLMANAGER_H diff --git a/LEGO1/lego/legoomni/include/legopathstruct.h b/LEGO1/lego/legoomni/include/legopathstruct.h index 35307529..a53bc4af 100644 --- a/LEGO1/lego/legoomni/include/legopathstruct.h +++ b/LEGO1/lego/legoomni/include/legopathstruct.h @@ -11,9 +11,10 @@ class LegoWorld; // VTABLE: LEGO1 0x100d6230 // SIZE 0x10 -class LegoPathStructEvent : public MxNotificationParam { +class LegoPathStructNotificationParam : public MxNotificationParam { public: - LegoPathStructEvent(NotificationId p_type, MxCore* p_sender, MxU8 p_trigger, MxS16 p_data) : MxNotificationParam() + LegoPathStructNotificationParam(NotificationId p_type, MxCore* p_sender, MxU8 p_trigger, MxS16 p_data) + : MxNotificationParam() { m_type = p_type; m_sender = p_sender; @@ -24,7 +25,7 @@ class LegoPathStructEvent : public MxNotificationParam { // FUNCTION: LEGO1 0x1001bac0 MxNotificationParam* Clone() const override { - return new LegoPathStructEvent(m_type, m_sender, m_trigger, m_data); + return new LegoPathStructNotificationParam(m_type, m_sender, m_trigger, m_data); } // vtable+0x04 inline MxU8 GetTrigger() { return m_trigger; } @@ -99,10 +100,10 @@ class LegoPathStruct : public LegoPathStructBase { }; // SYNTHETIC: LEGO1 0x1001bb80 -// LegoPathStructEvent::`scalar deleting destructor' +// LegoPathStructNotificationParam::`scalar deleting destructor' // SYNTHETIC: LEGO1 0x1001bbf0 -// LegoPathStructEvent::~LegoPathStructEvent +// LegoPathStructNotificationParam::~LegoPathStructNotificationParam // SYNTHETIC: LEGO1 0x10047440 // LegoPathStructBase::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/legorace.h b/LEGO1/lego/legoomni/include/legorace.h index 84d3689a..388fa26a 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 LegoPathStructEvent; +class LegoPathStructNotificationParam; // VTABLE: LEGO1 0x100d5e30 // SIZE 0x2c @@ -114,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 HandlePathStruct(LegoPathStructEvent&); // 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(LegoPathStructNotificationParam&); // 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/legovariables.h b/LEGO1/lego/legoomni/include/legovariables.h index 582c5b58..a40289a0 100644 --- a/LEGO1/lego/legoomni/include/legovariables.h +++ b/LEGO1/lego/legoomni/include/legovariables.h @@ -3,6 +3,8 @@ #include "mxvariable.h" +extern const char* g_varMOTOSPEED; +extern const char* g_varMOTOFUEL; extern const char* g_varAMBULSPEED; extern const char* g_varAMBULFUEL; extern const char* g_varTOWFUEL; diff --git a/LEGO1/lego/legoomni/include/motocycle.h b/LEGO1/lego/legoomni/include/motorcycle.h similarity index 57% rename from LEGO1/lego/legoomni/include/motocycle.h rename to LEGO1/lego/legoomni/include/motorcycle.h index 3e94fce0..3fcb51fe 100644 --- a/LEGO1/lego/legoomni/include/motocycle.h +++ b/LEGO1/lego/legoomni/include/motorcycle.h @@ -1,5 +1,5 @@ -#ifndef MOTOCYCLE_H -#define MOTOCYCLE_H +#ifndef MOTORCYCLE_H +#define MOTORCYCLE_H #include "decomp.h" #include "islepathactor.h" @@ -23,22 +23,22 @@ 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 HandlePathStruct(LegoPathStructEvent&) override; // vtable+0xdc - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + void VTable0x70(float p_time) override; // vtable+0x70 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleControl(LegoControlManagerNotificationParam& p_param) override; // vtable+0xd4 + MxLong HandlePathStruct(LegoPathStructNotificationParam&) override; // vtable+0xdc + void Exit() override; // vtable+0xe4 - void FUN_10035e10(); + void ActivateSceneActions(); // SYNTHETIC: LEGO1 0x100359d0 // Motocycle::`scalar deleting destructor' private: - undefined m_unk0x160[4]; - MxFloat m_unk0x164; - undefined m_unk0x168[4]; + undefined m_unk0x160[4]; // 0x160 + MxFloat m_fuel; // 0x164 + MxFloat m_time; // 0x168 }; -#endif // MOTOCYCLE_H +#endif // MOTORCYCLE_H diff --git a/LEGO1/lego/legoomni/include/mxcontrolpresenter.h b/LEGO1/lego/legoomni/include/mxcontrolpresenter.h index 49f9e975..1c251184 100644 --- a/LEGO1/lego/legoomni/include/mxcontrolpresenter.h +++ b/LEGO1/lego/legoomni/include/mxcontrolpresenter.h @@ -4,7 +4,7 @@ #include "decomp.h" #include "mxcompositepresenter.h" -class LegoControlManagerEvent; +class LegoControlManagerNotificationParam; class MxVideoPresenter; // VTABLE: LEGO1 0x100d7b88 @@ -39,7 +39,7 @@ class MxControlPresenter : public MxCompositePresenter { virtual void VTable0x68(MxBool p_unk0x50); // vtable+0x68 virtual void VTable0x6c(MxS16 p_unk0x4e); // vtable+0x6c - MxBool FUN_10044480(LegoControlManagerEvent* p_event, MxPresenter* p_presenter); + MxBool FUN_10044480(LegoControlManagerNotificationParam* p_param, MxPresenter* p_presenter); MxBool FUN_10044270(MxS32 p_x, MxS32 p_y, MxVideoPresenter* p_presenter); inline MxS16 GetUnknown0x4e() { return m_unk0x4e; } diff --git a/LEGO1/lego/legoomni/include/pizza.h b/LEGO1/lego/legoomni/include/pizza.h index 433b6f0f..664252b7 100644 --- a/LEGO1/lego/legoomni/include/pizza.h +++ b/LEGO1/lego/legoomni/include/pizza.h @@ -99,9 +99,9 @@ class Pizza : public IsleActor { } MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - undefined4 HandleClick() override; // vtable+0x68 - undefined4 HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74 - undefined4 VTable0x80(MxParam&) override; // vtable+0x80 + MxLong HandleClick() override; // vtable+0x68 + MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74 + MxLong HandlePathStruct(LegoPathStructNotificationParam&) override; // vtable+0x80 void CreateState(); void FUN_10038220(MxU32 p_objectId); diff --git a/LEGO1/lego/legoomni/include/pizzeria.h b/LEGO1/lego/legoomni/include/pizzeria.h index 2008f629..2a94abf6 100644 --- a/LEGO1/lego/legoomni/include/pizzeria.h +++ b/LEGO1/lego/legoomni/include/pizzeria.h @@ -68,7 +68,7 @@ class Pizzeria : public IsleActor { } MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - undefined4 HandleClick() override; // vtable+0x68 + MxLong HandleClick() override; // vtable+0x68 void CreateState(); diff --git a/LEGO1/lego/legoomni/include/police.h b/LEGO1/lego/legoomni/include/police.h index 83394b1a..88de1d6e 100644 --- a/LEGO1/lego/legoomni/include/police.h +++ b/LEGO1/lego/legoomni/include/police.h @@ -7,7 +7,7 @@ #include "legoworld.h" #include "radio.h" -class LegoControlManagerEvent; +class LegoControlManagerNotificationParam; class LegoEventNotificationParam; class MxDSAction; @@ -79,7 +79,7 @@ class Police : public LegoWorld { // Police::`scalar deleting destructor' private: - MxLong HandleControl(LegoControlManagerEvent& p_param); + MxLong HandleControl(LegoControlManagerNotificationParam& p_param); MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleKeyPress(LegoEventNotificationParam& p_param); diff --git a/LEGO1/lego/legoomni/include/radio.h b/LEGO1/lego/legoomni/include/radio.h index cd411036..0de03d1e 100644 --- a/LEGO1/lego/legoomni/include/radio.h +++ b/LEGO1/lego/legoomni/include/radio.h @@ -4,7 +4,7 @@ #include "legostate.h" #include "mxcore.h" -class LegoControlManagerEvent; +class LegoControlManagerNotificationParam; class MxAtomId; class MxEndActionNotificationParam; @@ -84,7 +84,7 @@ class Radio : public MxCore { MxBool m_audioEnabled; // 0x0d MxLong HandleEndAction(MxEndActionNotificationParam& p_param); - MxLong HandleControl(LegoControlManagerEvent& p_param); + MxLong HandleControl(LegoControlManagerNotificationParam& p_param); }; #endif // RADIO_H diff --git a/LEGO1/lego/legoomni/include/registrationbook.h b/LEGO1/lego/legoomni/include/registrationbook.h index fb561453..956dda06 100644 --- a/LEGO1/lego/legoomni/include/registrationbook.h +++ b/LEGO1/lego/legoomni/include/registrationbook.h @@ -7,7 +7,7 @@ class InfocenterState; class MxControlPresenter; class MxEndActionNotificationParam; class MxStillPresenter; -class LegoControlManagerEvent; +class LegoControlManagerNotificationParam; // VTABLE: LEGO1 0x100d9928 // SIZE 0x2d0 @@ -64,7 +64,7 @@ class RegistrationBook : public LegoWorld { MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleKeyPress(MxU8 p_key); - MxLong HandleControl(LegoControlManagerEvent& p_param); + MxLong HandleControl(LegoControlManagerNotificationParam& p_param); MxLong HandleNotification19(MxParam& p_param); void FUN_100775c0(MxS16 p_playerIndex); void WriteInfocenterLetters(MxS16); diff --git a/LEGO1/lego/legoomni/include/score.h b/LEGO1/lego/legoomni/include/score.h index a11492a0..b38f5359 100644 --- a/LEGO1/lego/legoomni/include/score.h +++ b/LEGO1/lego/legoomni/include/score.h @@ -5,7 +5,7 @@ #include "legostate.h" #include "legoworld.h" -class LegoControlManagerEvent; +class LegoControlManagerNotificationParam; class MxEndActionNotificationParam; // VTABLE: LEGO1 0x100d53f8 @@ -80,7 +80,7 @@ class Score : public LegoWorld { void Paint(); MxLong FUN_10001510(MxEndActionNotificationParam& p_param); - MxLong FUN_100016d0(LegoControlManagerEvent& p_param); + MxLong FUN_100016d0(LegoControlManagerNotificationParam& p_param); void FillArea(MxU32 i_activity, MxU32 i_actor, MxS16 score); protected: diff --git a/LEGO1/lego/legoomni/include/skateboard.h b/LEGO1/lego/legoomni/include/skateboard.h index fa78c2e8..9b5a04a8 100644 --- a/LEGO1/lego/legoomni/include/skateboard.h +++ b/LEGO1/lego/legoomni/include/skateboard.h @@ -26,11 +26,11 @@ class SkateBoard : public IslePathActor { return !strcmp(p_name, SkateBoard::ClassName()) || IslePathActor::IsA(p_name); } - MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 - MxLong HandleClick() override; // vtable+0xcc - MxLong HandleNotification0() override; // vtable+0xd0 - MxLong HandleControl(LegoControlManagerEvent& p_param) override; // vtable+0xd4 - void Exit() override; // vtable+0xe4 + MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 + MxLong HandleClick() override; // vtable+0xcc + MxLong HandleNotification0() override; // vtable+0xd0 + MxLong HandleControl(LegoControlManagerNotificationParam& p_param) override; // vtable+0xd4 + void Exit() override; // vtable+0xe4 inline void SetUnknown0x160(MxBool p_unk0x160) { m_unk0x160 = p_unk0x160; } diff --git a/LEGO1/lego/legoomni/include/towtrack.h b/LEGO1/lego/legoomni/include/towtrack.h index 3b3faafe..fc908883 100644 --- a/LEGO1/lego/legoomni/include/towtrack.h +++ b/LEGO1/lego/legoomni/include/towtrack.h @@ -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 HandlePathStruct(LegoPathStructEvent& 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(LegoControlManagerNotificationParam& p_param) override; // vtable+0xd4 + MxLong HandleEndAnim(LegoEndAnimNotificationParam& p_param) override; // vtable+0xd8 + MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param) override; // vtable+0xdc + void Exit() override; // vtable+0xe4 void CreateState(); void FUN_1004dab0(); diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index e4ea9b3b..a044e431 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -139,16 +139,16 @@ MxLong Ambulance::Notify(MxParam& p_param) result = HandleEndAction((MxEndActionNotificationParam&) p_param); break; case c_notificationButtonDown: - result = HandleButtonDown((LegoControlManagerEvent&) p_param); + result = HandleButtonDown((LegoControlManagerNotificationParam&) p_param); break; case c_notificationClick: result = HandleClick(); break; case c_notificationControl: - result = HandleControl((LegoControlManagerEvent&) p_param); + result = HandleControl((LegoControlManagerNotificationParam&) p_param); break; case c_notificationPathStruct: - result = HandlePathStruct((LegoPathStructEvent&) p_param); + result = HandlePathStruct((LegoPathStructNotificationParam&) p_param); break; } @@ -243,7 +243,7 @@ MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param) // FUNCTION: LEGO1 0x100367c0 // FUNCTION: BETA10 0x100230bf -MxLong Ambulance::HandleButtonDown(LegoControlManagerEvent& p_param) +MxLong Ambulance::HandleButtonDown(LegoControlManagerNotificationParam& p_param) { if (m_unk0x170 == 1) { LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY()); @@ -266,7 +266,7 @@ MxLong Ambulance::HandleButtonDown(LegoControlManagerEvent& p_param) // FUNCTION: LEGO1 0x10036860 // FUNCTION: BETA10 0x100231bf -MxLong Ambulance::HandlePathStruct(LegoPathStructEvent& p_param) +MxLong Ambulance::HandlePathStruct(LegoPathStructNotificationParam& p_param) { // 0x168 corresponds to the path at the gas station if (p_param.GetData() == 0x168) { @@ -437,7 +437,7 @@ void Ambulance::Leave() } // FUNCTION: LEGO1 0x10036f90 -MxLong Ambulance::HandleControl(LegoControlManagerEvent& p_param) +MxLong Ambulance::HandleControl(LegoControlManagerNotificationParam& p_param) { MxLong result = 0; diff --git a/LEGO1/lego/legoomni/src/actors/bike.cpp b/LEGO1/lego/legoomni/src/actors/bike.cpp index 11096d0c..5fe2452e 100644 --- a/LEGO1/lego/legoomni/src/actors/bike.cpp +++ b/LEGO1/lego/legoomni/src/actors/bike.cpp @@ -77,7 +77,7 @@ MxLong Bike::HandleClick() } // FUNCTION: LEGO1 0x10076aa0 -MxLong Bike::HandleControl(LegoControlManagerEvent& p_param) +MxLong Bike::HandleControl(LegoControlManagerNotificationParam& p_param) { MxLong result = 0; diff --git a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp index 290c3690..9c5fca9f 100644 --- a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp +++ b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp @@ -38,14 +38,14 @@ MxLong DuneBuggy::HandleClick() } // STUB: LEGO1 0x100681b0 -MxLong DuneBuggy::HandleControl(LegoControlManagerEvent& p_param) +MxLong DuneBuggy::HandleControl(LegoControlManagerNotificationParam& p_param) { // TODO return 0; } // STUB: LEGO1 0x10068270 -MxLong DuneBuggy::HandlePathStruct(LegoPathStructEvent& p_param) +MxLong DuneBuggy::HandlePathStruct(LegoPathStructNotificationParam& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index 4b69588a..1626f7be 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -152,7 +152,7 @@ MxLong Helicopter::HandleClick() } // FUNCTION: LEGO1 0x100035e0 -MxLong Helicopter::HandleControl(LegoControlManagerEvent& p_param) +MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param) { MxU32 ret = 0; MxAtomId script; diff --git a/LEGO1/lego/legoomni/src/actors/isleactor.cpp b/LEGO1/lego/legoomni/src/actors/isleactor.cpp index 7c8681ff..5bd1f503 100644 --- a/LEGO1/lego/legoomni/src/actors/isleactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/isleactor.cpp @@ -37,19 +37,19 @@ MxLong IsleActor::Notify(MxParam& p_param) result = HandleEndAction((MxEndActionNotificationParam&) p_param); break; case c_notificationButtonUp: - result = HandleButtonUp((MxNotificationParam&) p_param); + result = HandleButtonUp((LegoControlManagerNotificationParam&) p_param); break; case c_notificationButtonDown: - result = HandleButtonDown((MxNotificationParam&) p_param); + result = HandleButtonDown((LegoControlManagerNotificationParam&) p_param); break; case c_notificationClick: result = HandleClick(); break; case c_notificationEndAnim: - result = VTable0x70(); + result = HandleEndAnim(); break; case c_notificationPathStruct: - result = VTable0x80(p_param); + result = HandlePathStruct((LegoPathStructNotificationParam&) p_param); break; } diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index 43d6c91d..2ab12451 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -58,13 +58,13 @@ MxLong IslePathActor::Notify(MxParam& p_param) result = HandleClick(); break; case c_notificationControl: - result = HandleControl((LegoControlManagerEvent&) p_param); + result = HandleControl((LegoControlManagerNotificationParam&) p_param); break; case c_notificationEndAnim: result = HandleEndAnim((LegoEndAnimNotificationParam&) p_param); break; case c_notificationPathStruct: - result = HandlePathStruct((LegoPathStructEvent&) p_param); + result = HandlePathStruct((LegoPathStructNotificationParam&) p_param); break; } diff --git a/LEGO1/lego/legoomni/src/actors/jetski.cpp b/LEGO1/lego/legoomni/src/actors/jetski.cpp index fa6ad80b..a65268ac 100644 --- a/LEGO1/lego/legoomni/src/actors/jetski.cpp +++ b/LEGO1/lego/legoomni/src/actors/jetski.cpp @@ -37,7 +37,7 @@ MxLong Jetski::HandleClick() } // STUB: LEGO1 0x1007e8e0 -MxLong Jetski::HandleControl(LegoControlManagerEvent& p_param) +MxLong Jetski::HandleControl(LegoControlManagerNotificationParam& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp index 3209f15e..31100203 100644 --- a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp +++ b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp @@ -1,58 +1,163 @@ -#include "motocycle.h" +#include "motorcycle.h" + +#include "isle.h" +#include "isle_actions.h" +#include "jukebox_actions.h" +#include "legoanimationmanager.h" +#include "legocontrolmanager.h" +#include "legonavcontroller.h" +#include "legopathstruct.h" +#include "legoutils.h" +#include "legovariables.h" +#include "legoworld.h" +#include "misc.h" +#include "mxmisc.h" +#include "mxtimer.h" +#include "mxtransitionmanager.h" +#include "mxvariabletable.h" DECOMP_SIZE_ASSERT(Motocycle, 0x16c) // FUNCTION: LEGO1 0x100357b0 Motocycle::Motocycle() { - this->m_maxLinearVel = 40.0; - this->m_unk0x150 = 1.75; - this->m_unk0x148 = 1; - this->m_unk0x164 = 1.0; + m_maxLinearVel = 40.0; + m_unk0x150 = 1.75; + m_unk0x148 = 1; + m_fuel = 1.0; } -// STUB: LEGO1 0x10035a40 +// FUNCTION: LEGO1 0x10035a40 MxResult Motocycle::Create(MxDSAction& p_dsAction) { - // TODO - return SUCCESS; + MxResult result = IslePathActor::Create(p_dsAction); + m_world = CurrentWorld(); + + if (m_world) { + m_world->Add(this); + } + + VariableTable()->SetVariable(g_varMOTOFUEL, "1.0"); + m_fuel = 1.0; + m_time = Timer()->GetTime(); + return result; } -// STUB: LEGO1 0x10035ad0 -void Motocycle::VTable0x70(float p_float) +// FUNCTION: LEGO1 0x10035ad0 +void Motocycle::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_varMOTOSPEED, 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_varMOTOFUEL, buf); + } } -// STUB: LEGO1 0x10035bc0 +// FUNCTION: LEGO1 0x10035bc0 void Motocycle::Exit() { - // TODO + IslePathActor::Exit(); + GameState()->m_currentArea = LegoGameState::e_motocycle; + RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_MotoBikeDashboard_Bitmap); + RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_MotoBikeArms_Ctl); + RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_MotoBikeInfo_Ctl); + RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_MotoBikeSpeedMeter); + RemoveFromCurrentWorld(*g_isleScript, IsleScript::c_MotoBikeFuelMeter); + ControlManager()->Unregister(this); } -// STUB: LEGO1 0x10035c50 +// FUNCTION: LEGO1 0x10035c50 MxLong Motocycle::HandleClick() { - // TODO + if (!FUN_1003ef60()) { + return 1; + } + + FUN_10015820(TRUE, 0); + + ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::Area::e_motocycle); + TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, TRUE); + + if (GameState()->GetActorId() != UserActor()->GetActorId()) { + ((IslePathActor*) UserActor())->Exit(); + } + + m_time = Timer()->GetTime(); + + Enter(); + InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_MotoBikeDashboard, NULL); + GetCurrentAction().SetObjectId(-1); + + Vector3 position = m_roi->GetWorldPosition(); + AnimationManager()->FUN_10064670(&position); + AnimationManager()->FUN_10064740(&position); + ControlManager()->Register(this); + return 1; +} + +// FUNCTION: LEGO1 0x10035d70 +MxLong Motocycle::HandleControl(LegoControlManagerNotificationParam& p_param) +{ + MxLong result = 0; + + if (p_param.GetUnknown0x28() == 1) { + switch (p_param.GetClickedObjectId()) { + case IsleScript::c_MotoBikeArms_Ctl: + Exit(); + GameState()->m_currentArea = LegoGameState::e_unk66; + result = 1; + break; + case IsleScript::c_MotoBikeInfo_Ctl: + ((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_infomain); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + Exit(); + result = 1; + break; + } + } + + return result; +} + +// FUNCTION: LEGO1 0x10035df0 +MxLong Motocycle::HandlePathStruct(LegoPathStructNotificationParam& p_param) +{ + // 0x168 corresponds to the path at the gas station + if (p_param.GetData() == 0x168) { + m_fuel = 1.0f; + } + return 0; } -// STUB: LEGO1 0x10035d70 -MxLong Motocycle::HandleControl(LegoControlManagerEvent& p_param) +// FUNCTION: LEGO1 0x10035e10 +void Motocycle::ActivateSceneActions() { - // TODO - return 0; -} + PlayMusic(JukeboxScript::c_PoliceStation_Music); -// STUB: LEGO1 0x10035df0 -MxLong Motocycle::HandlePathStruct(LegoPathStructEvent& p_param) -{ - // TODO - return 0; -} + Act1State* act1state = (Act1State*) GameState()->GetState("Act1State"); + if (!act1state->m_unk0x022) { + act1state->m_unk0x022 = TRUE; -// STUB: LEGO1 0x10035e10 -void Motocycle::FUN_10035e10() -{ - // TODO + MxMatrix mat(UserActor()->GetROI()->GetLocal2World()); + mat.TranslateBy(mat[2][0] * 2.5, mat[2][1] + 0.7, mat[2][2] * 2.5); + + AnimationManager() + ->FUN_10060dc0(IsleScript::c_sns006in_RunAnim, &mat, TRUE, FALSE, NULL, FALSE, TRUE, TRUE, TRUE); + } } diff --git a/LEGO1/lego/legoomni/src/actors/pizza.cpp b/LEGO1/lego/legoomni/src/actors/pizza.cpp index 76588406..1ff18396 100644 --- a/LEGO1/lego/legoomni/src/actors/pizza.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizza.cpp @@ -72,14 +72,14 @@ void Pizza::FUN_10038380() } // STUB: LEGO1 0x100383f0 -undefined4 Pizza::HandleClick() +MxLong Pizza::HandleClick() { // TODO return 0; } // STUB: LEGO1 0x100384f0 -undefined4 Pizza::VTable0x80(MxParam&) +MxLong Pizza::HandlePathStruct(LegoPathStructNotificationParam&) { // TODO return 0; @@ -93,7 +93,7 @@ MxResult Pizza::Tickle() } // STUB: LEGO1 0x10038b10 -undefined4 Pizza::HandleEndAction(MxEndActionNotificationParam&) +MxLong Pizza::HandleEndAction(MxEndActionNotificationParam&) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp index 68484768..3b61ddb7 100644 --- a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp @@ -46,7 +46,7 @@ void Pizzeria::CreateState() } // FUNCTION: LEGO1 0x10017a50 -undefined4 Pizzeria::HandleClick() +MxLong Pizzeria::HandleClick() { if (FUN_1003ef60() && m_pizzaMissionState->m_unk0x0c == 0) { if (UserActor()->GetActorId() != GameState()->GetActorId()) { diff --git a/LEGO1/lego/legoomni/src/actors/radio.cpp b/LEGO1/lego/legoomni/src/actors/radio.cpp index bc7adc69..6c3ff702 100644 --- a/LEGO1/lego/legoomni/src/actors/radio.cpp +++ b/LEGO1/lego/legoomni/src/actors/radio.cpp @@ -91,7 +91,7 @@ MxLong Radio::Notify(MxParam& p_param) result = HandleEndAction((MxEndActionNotificationParam&) p_param); break; case c_notificationControl: - result = HandleControl((LegoControlManagerEvent&) p_param); + result = HandleControl((LegoControlManagerNotificationParam&) p_param); break; } } @@ -139,7 +139,7 @@ void Radio::Stop() } // FUNCTION: LEGO1 0x1002cbc0 -MxLong Radio::HandleControl(LegoControlManagerEvent& p_param) +MxLong Radio::HandleControl(LegoControlManagerNotificationParam& p_param) { MxDSAction action; // Unused MxS32 objectId = p_param.GetClickedObjectId(); diff --git a/LEGO1/lego/legoomni/src/actors/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index 2c2e6c85..3ca0bfc2 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -106,7 +106,7 @@ MxLong SkateBoard::HandleClick() } // FUNCTION: LEGO1 0x10010230 -MxLong SkateBoard::HandleControl(LegoControlManagerEvent& p_param) +MxLong SkateBoard::HandleControl(LegoControlManagerNotificationParam& p_param) { MxU32 result = 0; diff --git a/LEGO1/lego/legoomni/src/actors/towtrack.cpp b/LEGO1/lego/legoomni/src/actors/towtrack.cpp index ba51a309..05cf5fcb 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::HandlePathStruct(LegoPathStructEvent& p_param) +MxLong TowTrack::HandlePathStruct(LegoPathStructNotificationParam& p_param) { // TODO return 0; @@ -109,7 +109,7 @@ void TowTrack::Exit() } // STUB: LEGO1 0x1004d9e0 -MxLong TowTrack::HandleControl(LegoControlManagerEvent& p_param) +MxLong TowTrack::HandleControl(LegoControlManagerNotificationParam& p_param) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp b/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp index 265a69dc..fca0c0cb 100644 --- a/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp +++ b/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp @@ -62,7 +62,7 @@ #include "legoworld.h" #include "legoworldpresenter.h" #include "misc.h" -#include "motocycle.h" +#include "motorcycle.h" #include "mxcompositemediapresenter.h" #include "mxcontrolpresenter.h" #include "pizza.h" diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index c2f5077f..8699ffc1 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -367,7 +367,7 @@ void PlayCamAnim(LegoPathActor* p_actor, MxBool p_unused, MxU32 p_location, MxBo MxLong result = 0; if (world != NULL) { - LegoPathStructEvent param(c_notificationPathStruct, p_actor, LegoPathStruct::c_camAnim, p_location); + LegoPathStructNotificationParam param(c_notificationPathStruct, p_actor, LegoPathStruct::c_camAnim, p_location); result = world->Notify(param); } diff --git a/LEGO1/lego/legoomni/src/common/legovariables.cpp b/LEGO1/lego/legoomni/src/common/legovariables.cpp index 52e78930..6815285d 100644 --- a/LEGO1/lego/legoomni/src/common/legovariables.cpp +++ b/LEGO1/lego/legoomni/src/common/legovariables.cpp @@ -16,6 +16,14 @@ DECOMP_SIZE_ASSERT(CursorVariable, 0x24) DECOMP_SIZE_ASSERT(WhoAmIVariable, 0x24) DECOMP_SIZE_ASSERT(CustomizeAnimFileVariable, 0x24) +// GLOBAL: LEGO1 0x100f3994 +// STRING: LEGO1 0x100f3988 +const char* g_varMOTOSPEED = "motoSPEED"; + +// GLOBAL: LEGO1 0x100f3998 +// STRING: LEGO1 0x100f397c +const char* g_varMOTOFUEL = "motoFUEL"; + // GLOBAL: LEGO1 0x100f39b8 // STRING: LEGO1 0x100f39ac const char* g_varAMBULSPEED = "ambulSPEED"; diff --git a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp index 340836f0..70a7aece 100644 --- a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp @@ -175,27 +175,27 @@ MxBool MxControlPresenter::FUN_10044270(MxS32 p_x, MxS32 p_y, MxVideoPresenter* } // FUNCTION: LEGO1 0x10044480 -MxBool MxControlPresenter::FUN_10044480(LegoControlManagerEvent* p_event, MxPresenter* p_presenter) +MxBool MxControlPresenter::FUN_10044480(LegoControlManagerNotificationParam* p_param, MxPresenter* p_presenter) { if (IsEnabled()) { - switch (p_event->GetNotification()) { + switch (p_param->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()); + p_param->SetClickedObjectId(m_action->GetObjectId()); + p_param->SetClickedAtom(m_action->GetAtomId().GetInternal()); VTable0x6c(0); - p_event->SetNotification(c_notificationControl); - p_event->SetUnknown0x28(m_unk0x4e); + p_param->SetNotification(c_notificationControl); + p_param->SetUnknown0x28(m_unk0x4e); return TRUE; } break; case c_notificationButtonDown: - if (FUN_10044270(p_event->GetX(), p_event->GetY(), (MxVideoPresenter*) p_presenter)) { - p_event->SetClickedObjectId(m_action->GetObjectId()); - p_event->SetClickedAtom(m_action->GetAtomId().GetInternal()); + if (FUN_10044270(p_param->GetX(), p_param->GetY(), (MxVideoPresenter*) p_presenter)) { + p_param->SetClickedObjectId(m_action->GetObjectId()); + p_param->SetClickedAtom(m_action->GetAtomId().GetInternal()); VTable0x6c(m_unk0x56); - p_event->SetNotification(c_notificationControl); - p_event->SetUnknown0x28(m_unk0x4e); + p_param->SetNotification(c_notificationControl); + p_param->SetUnknown0x28(m_unk0x4e); return TRUE; } break; diff --git a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp index 6e433a15..4a16d930 100644 --- a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp +++ b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp @@ -10,7 +10,7 @@ #include "mxticklemanager.h" DECOMP_SIZE_ASSERT(LegoControlManager, 0x60) -DECOMP_SIZE_ASSERT(LegoControlManagerEvent, 0x2c) +DECOMP_SIZE_ASSERT(LegoControlManagerNotificationParam, 0x2c) // FUNCTION: LEGO1 0x10028520 LegoControlManager::LegoControlManager() diff --git a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp index 93a17e38..1a39478e 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathstruct.cpp @@ -51,7 +51,7 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, case c_d: { p_actor->VTable0x58(p_data); - LegoPathStructEvent param(c_notificationPathStruct, p_actor, m_name[2], p_data); + LegoPathStructNotificationParam param(c_notificationPathStruct, p_actor, m_name[2], p_data); p_actor->Notify(param); LegoWorld* world = CurrentWorld(); @@ -80,7 +80,7 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, case c_s: { LegoWorld* world = CurrentWorld(); if (world != NULL) { - LegoPathStructEvent param(c_notificationPathStruct, p_actor, m_name[2], p_data); + LegoPathStructNotificationParam param(c_notificationPathStruct, p_actor, m_name[2], p_data); if (world->Notify(param) != 0) { break; @@ -93,7 +93,7 @@ MxBool LegoPathStruct::HandleTrigger(LegoPathActor* p_actor, MxBool p_direction, case c_w: { LegoWorld* world = CurrentWorld(); if (world != NULL) { - LegoPathStructEvent param(c_notificationPathStruct, p_actor, m_name[2], p_data); + LegoPathStructNotificationParam 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 53db021e..5552df4d 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::HandlePathStruct(LegoPathStructEvent&) +MxLong CarRace::HandlePathStruct(LegoPathStructNotificationParam&) { // TODO return 0; diff --git a/LEGO1/lego/legoomni/src/race/jetskirace.cpp b/LEGO1/lego/legoomni/src/race/jetskirace.cpp index 120ba4d8..3b39e584 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::HandlePathStruct(LegoPathStructEvent&) +MxLong JetskiRace::HandlePathStruct(LegoPathStructNotificationParam&) { return 0; } diff --git a/LEGO1/lego/legoomni/src/race/legorace.cpp b/LEGO1/lego/legoomni/src/race/legorace.cpp index ccb6ceda..2113be16 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::HandlePathStruct(LegoPathStructEvent&) +MxLong LegoRace::HandlePathStruct(LegoPathStructNotificationParam&) { return 0; } @@ -102,7 +102,7 @@ MxLong LegoRace::Notify(MxParam& p_param) result = HandleClick((LegoEventNotificationParam&) p_param); break; case c_notificationPathStruct: - result = HandlePathStruct((LegoPathStructEvent&) p_param); + result = HandlePathStruct((LegoPathStructNotificationParam&) p_param); break; case c_notificationTransitioned: GameState()->SwitchArea(m_destLocation); diff --git a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp index 20ab4309..768f5333 100644 --- a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp +++ b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp @@ -60,7 +60,7 @@ MxLong ElevatorBottom::Notify(MxParam& p_param) if (m_worldStarted) { switch (((MxNotificationParam&) p_param).GetNotification()) { case c_notificationControl: - ret = HandleControl((LegoControlManagerEvent&) p_param); + ret = HandleControl((LegoControlManagerNotificationParam&) p_param); break; case c_notificationTransitioned: GameState()->SwitchArea(m_destLocation); @@ -80,7 +80,7 @@ void ElevatorBottom::ReadyWorld() } // FUNCTION: LEGO1 0x100181d0 -MxLong ElevatorBottom::HandleControl(LegoControlManagerEvent& p_param) +MxLong ElevatorBottom::HandleControl(LegoControlManagerNotificationParam& p_param) { MxLong result = 0; diff --git a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp index aadf6b1c..a2bcb82c 100644 --- a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp +++ b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp @@ -111,10 +111,10 @@ MxLong GasStation::Notify(MxParam& p_param) result = HandleKeyPress((((LegoEventNotificationParam&) p_param)).GetKey()); break; case c_notificationButtonDown: - result = HandleButtonDown(((LegoControlManagerEvent&) p_param)); + result = HandleButtonDown(((LegoControlManagerNotificationParam&) p_param)); break; case c_notificationControl: - result = HandleControl((LegoControlManagerEvent&) p_param); + result = HandleControl((LegoControlManagerNotificationParam&) p_param); break; case c_notificationTransitioned: GameState()->SwitchArea(m_destLocation); @@ -306,14 +306,14 @@ MxLong GasStation::HandleKeyPress(MxS8 p_key) } // STUB: LEGO1 0x10005960 -MxLong GasStation::HandleButtonDown(LegoControlManagerEvent& p_param) +MxLong GasStation::HandleButtonDown(LegoControlManagerNotificationParam& p_param) { // TODO return 0; } // FUNCTION: LEGO1 0x10005b20 -MxLong GasStation::HandleControl(LegoControlManagerEvent& p_param) +MxLong GasStation::HandleControl(LegoControlManagerNotificationParam& p_param) { if (p_param.GetUnknown0x28() == 1) { MxDSAction action; diff --git a/LEGO1/lego/legoomni/src/worlds/hospital.cpp b/LEGO1/lego/legoomni/src/worlds/hospital.cpp index f29fe3df..550818f3 100644 --- a/LEGO1/lego/legoomni/src/worlds/hospital.cpp +++ b/LEGO1/lego/legoomni/src/worlds/hospital.cpp @@ -120,10 +120,10 @@ MxLong Hospital::Notify(MxParam& p_param) result = HandleKeyPress((((LegoEventNotificationParam&) p_param)).GetKey()); break; case c_notificationButtonDown: - result = HandleButtonDown(((LegoControlManagerEvent&) p_param)); + result = HandleButtonDown(((LegoControlManagerNotificationParam&) p_param)); break; case c_notificationControl: - result = HandleControl((LegoControlManagerEvent&) p_param); + result = HandleControl((LegoControlManagerNotificationParam&) p_param); break; case c_notificationTransitioned: if (m_destLocation != LegoGameState::e_undefined) { @@ -396,7 +396,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param) } // FUNCTION: LEGO1 0x10075710 -MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param) +MxLong Hospital::HandleButtonDown(LegoControlManagerNotificationParam& p_param) { if (m_unk0x100 == 1) { LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY()); @@ -552,7 +552,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerEvent& p_param) } // FUNCTION: LEGO1 0x10075f90 -MxBool Hospital::HandleControl(LegoControlManagerEvent& p_param) +MxBool Hospital::HandleControl(LegoControlManagerNotificationParam& p_param) { if (p_param.GetUnknown0x28() == 1) { switch (p_param.GetClickedObjectId()) { diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index a2ae514f..d88fe79b 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -254,7 +254,7 @@ MxLong Infocenter::Notify(MxParam& p_param) ); break; case c_notificationControl: - result = HandleControl((LegoControlManagerEvent&) p_param); + result = HandleControl((LegoControlManagerNotificationParam&) p_param); break; case c_notificationTransitioned: StopBookAnimation(); @@ -952,7 +952,7 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y) } // FUNCTION: LEGO1 0x10070370 -MxU8 Infocenter::HandleControl(LegoControlManagerEvent& p_param) +MxU8 Infocenter::HandleControl(LegoControlManagerNotificationParam& p_param) { if (p_param.GetUnknown0x28() == 1) { m_infoManDialogueTimer = 0; diff --git a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp index 4bf5d796..0673de11 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp @@ -69,7 +69,7 @@ MxLong InfocenterDoor::Notify(MxParam& p_param) } break; case c_notificationControl: - result = HandleControl((LegoControlManagerEvent&) p_param); + result = HandleControl((LegoControlManagerNotificationParam&) p_param); break; case c_notificationTransitioned: GameState()->SwitchArea(m_destLocation); @@ -90,7 +90,7 @@ void InfocenterDoor::ReadyWorld() } // FUNCTION: LEGO1 0x10037a90 -MxLong InfocenterDoor::HandleControl(LegoControlManagerEvent& p_param) +MxLong InfocenterDoor::HandleControl(LegoControlManagerNotificationParam& p_param) { MxLong result = 0; diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index b15cfc70..2f60a19a 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -23,7 +23,7 @@ #include "legovariables.h" #include "legovideomanager.h" #include "misc.h" -#include "motocycle.h" +#include "motorcycle.h" #include "mxactionnotificationparam.h" #include "mxbackgroundaudiomanager.h" #include "mxmisc.h" @@ -152,7 +152,7 @@ MxLong Isle::Notify(MxParam& p_param) } break; case c_notificationControl: - result = HandleControl((LegoControlManagerEvent&) p_param); + result = HandleControl((LegoControlManagerNotificationParam&) p_param); break; case c_notificationEndAnim: switch (m_act1state->m_unk0x018) { @@ -168,7 +168,7 @@ MxLong Isle::Notify(MxParam& p_param) } break; case c_notificationPathStruct: - result = HandlePathStruct((LegoPathStructEvent&) p_param); + result = HandlePathStruct((LegoPathStructNotificationParam&) p_param); break; case c_notificationType20: Enable(TRUE); @@ -287,7 +287,7 @@ void Isle::ReadyWorld() } // FUNCTION: LEGO1 0x10031030 -MxLong Isle::HandleControl(LegoControlManagerEvent& p_param) +MxLong Isle::HandleControl(LegoControlManagerNotificationParam& p_param) { if (p_param.GetUnknown0x28() == 1) { MxDSAction action; @@ -469,7 +469,7 @@ void Isle::UpdateGlobe() } // FUNCTION: LEGO1 0x100315f0 -MxLong Isle::HandlePathStruct(LegoPathStructEvent& p_param) +MxLong Isle::HandlePathStruct(LegoPathStructNotificationParam& p_param) { MxLong result = 0; @@ -1006,7 +1006,7 @@ MxLong Isle::HandleTransitionEnd() FUN_10032d30(IsleScript::c_MotoBikeDashboard_Bitmap, JukeboxScript::c_MusicTheme1, NULL, TRUE); if (!m_act1state->m_unk0x01f) { - m_motocycle->FUN_10035e10(); + m_motocycle->ActivateSceneActions(); } break; case LegoGameState::e_copter: diff --git a/LEGO1/lego/legoomni/src/worlds/jukebox.cpp b/LEGO1/lego/legoomni/src/worlds/jukebox.cpp index 57c30be3..ca27142d 100644 --- a/LEGO1/lego/legoomni/src/worlds/jukebox.cpp +++ b/LEGO1/lego/legoomni/src/worlds/jukebox.cpp @@ -76,7 +76,7 @@ MxLong JukeBox::Notify(MxParam& p_param) if (m_worldStarted) { switch (((MxNotificationParam&) p_param).GetNotification()) { case c_notificationControl: - result = HandleControl((LegoControlManagerEvent&) p_param); + result = HandleControl((LegoControlManagerNotificationParam&) p_param); break; case c_notificationTransitioned: GameState()->SwitchArea(m_destLocation); @@ -123,7 +123,7 @@ void JukeBox::ReadyWorld() // FUNCTION: LEGO1 0x1005da70 // FUNCTION: BETA10 0x10037f6d -MxBool JukeBox::HandleControl(LegoControlManagerEvent& p_param) +MxBool JukeBox::HandleControl(LegoControlManagerNotificationParam& p_param) { MxStillPresenter* presenter; diff --git a/LEGO1/lego/legoomni/src/worlds/police.cpp b/LEGO1/lego/legoomni/src/worlds/police.cpp index 1af480a8..e5e09a1c 100644 --- a/LEGO1/lego/legoomni/src/worlds/police.cpp +++ b/LEGO1/lego/legoomni/src/worlds/police.cpp @@ -83,7 +83,7 @@ MxLong Police::Notify(MxParam& p_param) result = HandleKeyPress(((LegoEventNotificationParam&) p_param)); break; case c_notificationControl: - result = HandleControl((LegoControlManagerEvent&) p_param); + result = HandleControl((LegoControlManagerNotificationParam&) p_param); break; case c_notificationTransitioned: GameState()->SwitchArea(m_destLocation); @@ -103,7 +103,7 @@ void Police::ReadyWorld() } // FUNCTION: LEGO1 0x1005e550 -MxLong Police::HandleControl(LegoControlManagerEvent& p_param) +MxLong Police::HandleControl(LegoControlManagerNotificationParam& p_param) { if (p_param.GetUnknown0x28() == 1) { switch (p_param.GetClickedObjectId()) { diff --git a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp index eb2e916c..430abcc7 100644 --- a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp @@ -115,7 +115,7 @@ MxLong RegistrationBook::Notify(MxParam& p_param) m_registerDialogueTimer = Timer()->GetTime(); break; case c_notificationControl: - result = HandleControl((LegoControlManagerEvent&) p_param); + result = HandleControl((LegoControlManagerNotificationParam&) p_param); break; case c_notificationPathStruct: result = HandleNotification19(p_param); @@ -210,7 +210,7 @@ MxLong RegistrationBook::HandleKeyPress(MxU8 p_key) } // FUNCTION: LEGO1 0x100774a0 -MxLong RegistrationBook::HandleControl(LegoControlManagerEvent& p_param) +MxLong RegistrationBook::HandleControl(LegoControlManagerNotificationParam& p_param) { MxS16 unk0x28 = p_param.GetUnknown0x28(); diff --git a/LEGO1/lego/legoomni/src/worlds/score.cpp b/LEGO1/lego/legoomni/src/worlds/score.cpp index 95c19bcc..aba65f4a 100644 --- a/LEGO1/lego/legoomni/src/worlds/score.cpp +++ b/LEGO1/lego/legoomni/src/worlds/score.cpp @@ -105,7 +105,7 @@ MxLong Score::Notify(MxParam& p_param) ret = 1; break; case c_notificationControl: - ret = FUN_100016d0((LegoControlManagerEvent&) p_param); + ret = FUN_100016d0((LegoControlManagerNotificationParam&) p_param); break; case c_notificationTransitioned: DeleteObjects(g_infoscorScript, InfoscorScript::c_LegoBox1_Flc, InfoscorScript::c_LegoBox3_Flc); @@ -166,7 +166,7 @@ void Score::ReadyWorld() } // FUNCTION: LEGO1 0x100016d0 -MxLong Score::FUN_100016d0(LegoControlManagerEvent& p_param) +MxLong Score::FUN_100016d0(LegoControlManagerNotificationParam& p_param) { MxS16 unk0x28 = p_param.GetUnknown0x28(); From 1a46d370ec7e7e025cc6d2b95c1c8fba023ff562 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 17 Jun 2024 14:11:27 -0400 Subject: [PATCH 3/9] Bootstrap LegoPlantManager, add plants data (#1038) * Bootstrap LegoPlantManager, add plants data * Naming * Move * Fix --- CMakeLists.txt | 1 + .../legoomni/include/legobuildingmanager.h | 4 +- .../lego/legoomni/include/legoplantmanager.h | 9 +- LEGO1/lego/legoomni/include/legoplants.h | 58 + .../src/common/legobuildingmanager.cpp | 16 +- .../legoomni/src/common/legoplantmanager.cpp | 27 +- LEGO1/lego/legoomni/src/common/legoplants.cpp | 1951 +++++++++++++++++ 7 files changed, 2048 insertions(+), 18 deletions(-) create mode 100644 LEGO1/lego/legoomni/include/legoplants.h create mode 100644 LEGO1/lego/legoomni/src/common/legoplants.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index ceba04d7..ba7af5ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -330,6 +330,7 @@ add_library(lego1 SHARED LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp LEGO1/lego/legoomni/src/common/legophoneme.cpp LEGO1/lego/legoomni/src/common/legoplantmanager.cpp + LEGO1/lego/legoomni/src/common/legoplants.cpp LEGO1/lego/legoomni/src/common/legostate.cpp LEGO1/lego/legoomni/src/common/legotextureinfo.cpp LEGO1/lego/legoomni/src/common/legoutils.cpp diff --git a/LEGO1/lego/legoomni/include/legobuildingmanager.h b/LEGO1/lego/legoomni/include/legobuildingmanager.h index 57544ba7..45cb8caf 100644 --- a/LEGO1/lego/legoomni/include/legobuildingmanager.h +++ b/LEGO1/lego/legoomni/include/legobuildingmanager.h @@ -22,12 +22,12 @@ struct LegoBuildingInfo { }; LegoEntity* m_entity; // 0x00 - const char* m_hausName; // 0x04 + const char* m_variant; // 0x04 MxU32 m_sound; // 0x08 MxU32 m_move; // 0x0c MxU8 m_mood; // 0x10 MxS8 m_unk0x11; // 0x11 - MxS8 m_initialUnk0x11; // 0x12 = initial value loaded to m_unk0x11 + MxS8 m_initialUnk0x11; // 0x12 - initial value loaded to m_unk0x11 MxU8 m_flags; // 0x13 float m_unk0x014; // 0x14 const char* m_unk0x18; // 0x18 diff --git a/LEGO1/lego/legoomni/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index f32adafa..765e5e7e 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -5,6 +5,7 @@ #include "mxcore.h" class LegoEntity; +class LegoPathBoundary; class LegoROI; class LegoStorage; @@ -27,7 +28,7 @@ class LegoPlantManager : public MxCore { void Init(); void FUN_10026360(MxS32 p_scriptIndex); void FUN_100263a0(undefined4 p_und); - void Write(LegoStorage* p_storage); + MxResult Write(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage); MxBool SwitchColor(LegoEntity* p_entity); MxBool SwitchVariant(LegoEntity* p_entity); @@ -48,7 +49,11 @@ class LegoPlantManager : public MxCore { private: static char* g_customizeAnimFile; - undefined m_unk0x08[0x24]; // 0x08 + undefined4 m_unk0x08; // 0x08 + undefined m_unk0x0c; // 0x0c + undefined m_unk0x10[0x17]; // 0x10 + undefined m_unk0x24; // 0x24 + undefined4 m_unk0x28; // 0x28 }; #endif // LEGOPLANTMANAGER_H diff --git a/LEGO1/lego/legoomni/include/legoplants.h b/LEGO1/lego/legoomni/include/legoplants.h new file mode 100644 index 00000000..638baea4 --- /dev/null +++ b/LEGO1/lego/legoomni/include/legoplants.h @@ -0,0 +1,58 @@ +#ifndef LEGOPLANTS_H +#define LEGOPLANTS_H + +#include "decomp.h" +#include "mxtypes.h" + +class LegoEntity; +class LegoPathBoundary; + +// SIZE 0x54 +struct LegoPlantInfo { + enum { + c_flag1 = 0x01, + c_flag2 = 0x02, + c_flag5 = 0x10, + c_flag6 = 0x20, + c_flag16 = 0x8000, + c_flag17 = 0x10000 + }; + + enum Variant { + e_flower = 0, + e_tree, + e_bush, + e_palm + }; + + enum Color { + e_white = 0, + e_black, + e_yellow, + e_red, + e_green + }; + + LegoEntity* m_entity; // 0x00 + MxU32 m_flags; // 0x04 + Variant m_variant; // 0x08 + MxU32 m_sound; // 0x0c + MxU32 m_move; // 0x10 + MxU8 m_mood; // 0x14 + MxU8 m_color; // 0x15 - see enum for possible values + MxS8 m_unk0x16; // 0x16 + MxS8 m_initialUnk0x16; // 0x17 - initial value loaded to m_unk0x16 + const char* m_name; // 0x18 + undefined4 m_unk0x1c; // 0x1c + float m_x; // 0x20 + float m_y; // 0x24 + float m_z; // 0x28 + LegoPathBoundary* m_boundary; // 0x2c + float m_position[3]; // 0x30 + float m_direction[3]; // 0x3c + float m_up[3]; // 0x48 +}; + +extern LegoPlantInfo g_plantInfoInit[81]; + +#endif // LEGOPLANTS_H diff --git a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp index 9cd60b54..be886496 100644 --- a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp @@ -18,7 +18,7 @@ DECOMP_SIZE_ASSERT(LegoBuildingInfo, 0x2c) DECOMP_SIZE_ASSERT(LegoBuildingManager::AnimEntry, 0x14) // GLOBAL: LEGO1 0x100f3410 -const char* g_buildingInfoHausName[5] = { +const char* g_buildingInfoVariants[5] = { "haus1", "haus4", "haus5", @@ -238,7 +238,7 @@ LegoBuildingManager::LegoBuildingManager() // FUNCTION: LEGO1 0x1002f960 LegoBuildingManager::~LegoBuildingManager() { - delete g_customizeAnimFile; + delete[] g_customizeAnimFile; } // FUNCTION: LEGO1 0x1002f9d0 @@ -267,15 +267,15 @@ void LegoBuildingManager::FUN_1002fa00() } if (g_buildingManagerConfig <= 1) { - LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingInfoHausName[0]); + LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingInfoVariants[0]); if (entity) { entity->GetROI()->SetVisibility(TRUE); m_unk0x09 = 0; } } else { - for (i = 0; i < sizeOfArray(g_buildingInfoHausName); i++) { - LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingInfoHausName[i]); + for (i = 0; i < sizeOfArray(g_buildingInfoVariants); i++) { + LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingInfoVariants[i]); if (entity) { entity->GetROI()->SetVisibility(m_nextVariant == i); } @@ -289,7 +289,7 @@ void LegoBuildingManager::FUN_1002fa00() // FUNCTION: BETA10 0x10063b88 void LegoBuildingManager::UpdatePosition(MxS32 p_index, LegoWorld* p_world) { - LegoEntity* entity = (LegoEntity*) p_world->Find("MxEntity", g_buildingInfo[p_index].m_hausName); + LegoEntity* entity = (LegoEntity*) p_world->Find("MxEntity", g_buildingInfo[p_index].m_variant); if (entity) { entity->SetType(LegoEntity::e_building); @@ -451,12 +451,12 @@ MxBool LegoBuildingManager::SwitchVariant(LegoEntity* p_entity) if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasVariants && info->m_unk0x11 == -1) { LegoROI* roi = p_entity->GetROI(); - if (++m_nextVariant >= sizeOfArray(g_buildingInfoHausName)) { + if (++m_nextVariant >= sizeOfArray(g_buildingInfoVariants)) { m_nextVariant = 0; } roi->SetVisibility(FALSE); - info->m_hausName = g_buildingInfoHausName[m_nextVariant]; + info->m_variant = g_buildingInfoVariants[m_nextVariant]; UpdatePosition(12, CurrentWorld()); if (info->m_entity != NULL) { diff --git a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp index 4cc23472..6be98452 100644 --- a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp @@ -1,31 +1,43 @@ #include "legoplantmanager.h" #include "legoentity.h" +#include "legoplants.h" DECOMP_SIZE_ASSERT(LegoPlantManager, 0x2c) // GLOBAL: LEGO1 0x100f3188 char* LegoPlantManager::g_customizeAnimFile = NULL; +// GLOBAL: LEGO1 0x10103180 +LegoPlantInfo g_plantInfo[81]; + // FUNCTION: LEGO1 0x10026220 LegoPlantManager::LegoPlantManager() { Init(); } -// STUB: LEGO1 0x100262c0 +// FUNCTION: LEGO1 0x100262c0 LegoPlantManager::~LegoPlantManager() { - // TODO + delete[] g_customizeAnimFile; } -// STUB: LEGO1 0x10026330 +// FUNCTION: LEGO1 0x10026330 +// FUNCTION: BETA10 0x100c4f90 void LegoPlantManager::Init() { - // TODO + for (MxS32 i = 0; i < sizeOfArray(g_plantInfo); i++) { + g_plantInfo[i] = g_plantInfoInit[i]; + } + + m_unk0x08 = -1; + m_unk0x0c = 0; + m_unk0x24 = 0; } // STUB: LEGO1 0x10026360 +// FUNCTION: BETA10 0x100c5032 void LegoPlantManager::FUN_10026360(MxS32 p_scriptIndex) { // TODO @@ -38,14 +50,18 @@ void LegoPlantManager::FUN_100263a0(undefined4 p_und) } // STUB: LEGO1 0x10026720 -void LegoPlantManager::Write(LegoStorage* p_storage) +// FUNCTION: BETA10 0x100c5918 +MxResult LegoPlantManager::Write(LegoStorage* p_storage) { // TODO + return SUCCESS; } // STUB: LEGO1 0x100267b0 +// FUNCTION: BETA10 0x100c5a76 MxResult LegoPlantManager::Read(LegoStorage* p_storage) { + // TODO return SUCCESS; } @@ -127,7 +143,6 @@ void LegoPlantManager::FUN_10026c50(LegoEntity* p_entity) MxResult LegoPlantManager::Tickle() { // TODO - return 0; } diff --git a/LEGO1/lego/legoomni/src/common/legoplants.cpp b/LEGO1/lego/legoomni/src/common/legoplants.cpp new file mode 100644 index 00000000..8979614a --- /dev/null +++ b/LEGO1/lego/legoomni/src/common/legoplants.cpp @@ -0,0 +1,1951 @@ +#include "legoplants.h" + +DECOMP_SIZE_ASSERT(LegoPlantInfo, 0x54) + +// GLOBAL: LEGO1 0x100f16c8 +LegoPlantInfo g_plantInfoInit[81] = { + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "edg01_20", + 1, + -7e1, + 8, + -8.40763, + NULL, + -73.75, + 8, + -8.4375, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "edg00_20", + 3, + -15.45, + 0, + -41.32, + NULL, + -16.8125, + 0, + -41.2, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "edg01_24", + 1, + -69.7176, + 7, + -25.25, + NULL, + -71, + 7, + -25, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "edg02_27", + 1, + 82.75, + 4, + 29.24163, + NULL, + 82.6125, + 4, + 27.625, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "int18", + 3, + 28.15, + 2, + 29.27804, + NULL, + 29.8125, + 2, + 27.6875, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "int48", + 0, + 85.16238, + 9, + -0.83761, + NULL, + 86.125, + 8.80447, + 0.3125, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "int18", + 3, + 24.31819, + 2, + 29.04404, + NULL, + 22.8125, + 2, + 27.6875, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "int56", + 4, + -64.125, + 14, + 27.5, + NULL, + -61.6875, + 14, + 28, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "int67", + 3, + -23.3197, + 1, + 29.00803, + NULL, + -21.9375, + 1, + 27.6875, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "edg02_79", + 3, + 9.15, + 0, + -18.1854, + NULL, + 9.15, + 0, + -19.9375, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "edg02_79", + 1, + 9.15, + 0, + -14.5695, + NULL, + 9.15, + 0, + -12.9375, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "edg00_151", + 1, + -75.7186, + 4, + 44.60529, + NULL, + -74.9375, + 4, + 44.3875, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "int53", + 6, + -22.375, + 0, + -81.875, + NULL, + -21.625, + 0, + -83, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg01_47", + 1, + 42.8125, + 0, + -48.125, + NULL, + 47.75, + -0.299, + -58.125, + 0.6751, + -0.1071, + 0.7299, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg00_155", + 1, + -39, + 0, + 40.8125, + NULL, + -41, + 0, + 39.5, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg03_05", + 3, + -35.125, + 0, + 3.875, + NULL, + -35, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_bush, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg00_128", + 3, + -59.3624, + 14, + 22.86249, + NULL, + -58.375, + 14, + 21.98749, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_bush, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "int48", + 4, + 87.9875, + 9, + -1.125, + NULL, + 87.3, + 8.609336, + 1.125, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_bush, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg01_18", + 1, + -69.6875, + 8, + -3.5, + NULL, + -73.8, + 8, + -5.3, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_bush, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg02_85", + 1, + -26.45, + 0, + -48.5, + NULL, + -25.45, + 0, + -46.5, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_tree, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg00_123", + 3, + -60.625, + 14, + 22.9375, + NULL, + -6e1, + 14, + 24, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_tree, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg00_131", + 1, + -63.7755, + 14, + 26.70394, + NULL, + -65, + 14, + 26, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_tree, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg02_61", + 3, + 70.1875, + 1, + -78.3125, + NULL, + 72.6875, + 1, + -80.3125, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_tree, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg01_33", + 1, + -64.1875, + 7, + -45.25, + NULL, + -64.1875, + 7, + -43.4375, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg02_59", + 1, + -47.8124, + 1.8634, + -58.2624, + NULL, + -47.8124, + 1.875, + -60.2624, + 0.174, + 0, + 0.985, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "edg02_32", + 1, + 25.5, + 0, + 9, + NULL, + 22.8125, + 0, + 9, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "int25", + 0, + 27.1875, + 0, + -16.3125, + NULL, + 29.8125, + 0, + -14.3125, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "edg02_01", + 1, + -19.625, + 0, + -17.9375, + NULL, + -19.625, + 0, + -2e1, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "edg00_95", + 3, + 34.125, + 0, + 3.5125, + NULL, + 32.9375, + 0, + 2.95, + -1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "int25", + 1, + 25.6875, + 0, + -16.4375, + NULL, + 22.8125, + 0, + -12.9375, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "int26", + 1, + 24.25, + 0, + -44.5, + NULL, + 22.8125, + 0, + -43.0625, + 0.707, + 0, + 0.707, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "int26", + 6, + 28.25, + 0, + -47.3125, + NULL, + 29.8125, + 0, + -45.875, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "int10", + 1, + -69.125, + 7, + -29.125, + NULL, + -70.5625, + 7, + -29.875, + 0.707, + 0, + 0.707, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "edg02_61", + 3, + 70.75, + 1, + -76.5625, + NULL, + 73.5, + 1, + -78.25, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "int04", + 5, + -94.4, + 4, + -15.3125, + NULL, + -94.875, + 4, + -13.3125, + 0.707, + 0, + 0.707, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "edg02_79", + 1, + 9.15, + 0, + -14.5695, + NULL, + 9.15, + 0, + -11.5625, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "edg01_58", + 3, + 66.2125, + 0, + -17.5625, + NULL, + 65.33261, + 0.11868, + -19.8125, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "int34", + 4, + 0.375, + 0, + -44.8875, + NULL, + -1.3125, + 0, + -43.075, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "edg02_32", + 1, + 25.5, + 0, + 9.8, + NULL, + 22.8125, + 0, + 10.4875, + 0.707, + 0, + 0.707, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "int22", + 6, + 28.92499, + 0, + 6.45, + NULL, + 29.8, + 0, + 8.0125, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "edg02_28", + 1, + 85.5, + 4, + 22.25, + NULL, + 82.5625, + 4, + 26.25, + 0.707, + 0, + 0.707, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "edg00_176", + 0, + 73.875, + 1, + -82.9375, + NULL, + 74.75, + 1, + -81.25, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "edg02_35", + 3, + 26.25, + 0, + -12.45, + NULL, + 22.8125, + 0, + -11.575, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "edg02_79", + 3, + 9.15, + 0, + -18.1854, + NULL, + 9.0875, + 0, + -21.3125, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "edg02_01", + 3, + -19.75, + 0, + -15.3125, + NULL, + -19.75, + 0, + -12.875, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "edg01_56", + 3, + 72.8125, + 0, + -25.9375, + NULL, + 70.6875, + 0, + -26.5625, + -0.9848, + 0, + 1.1736, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "int67", + 0, + -26.9375, + 1, + 29.075, + NULL, + -28.9375, + 1, + 27.7, + 1, + 0, + 0, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "int51", + 3, + -2.125, + 0, + -17.6875, + NULL, + -3.25, + 0, + -19.75, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "edg02_57", + 1, + -23.875, + 0, + -54.9375, + NULL, + -25.1875, + 0, + -52.625, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "int04", + 5, + -94, + 4, + -15.3125, + NULL, + -95.9375, + 4, + -14.25, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg02_36", + 3, + 18.6875, + 0, + -14.6375, + NULL, + 18.75, + 0, + -10.95, + 0.707, + 0, + 0.707, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg02_30", + 1, + 25.1375, + 2, + 25.5, + NULL, + 21.8875, + 1.84509, + 25.5, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg02_30", + 3, + 27.45, + 2, + 25.5, + NULL, + 30.95, + 2, + 25.5, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg00_78", + 1, + 64.35749, + 0, + 10.95579, + NULL, + 66.67, + 0.256506, + 10.95579, + 0, + 0, + -1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg02_38", + 1, + 9.625, + 0, + -45.375, + NULL, + 9.625, + 0, + -4e1, + 0.5, + 0, + 0.866, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg00_76", + 3, + 65, + 0, + 7.0125, + NULL, + 62, + 0, + 2.825, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg02_35", + 1, + 27.4375, + 0, + -8.125, + NULL, + 33.375, + 0, + -8.125, + 0.342, + 0, + 0.94, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg02_23", + 3, + 18.825, + 1.7575, + 30.125, + NULL, + 18.825, + 1, + 25.5, + 0.707, + 0, + 0.707, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg00_130", + 1, + -67.5, + 14, + 23.25, + NULL, + -63.6875, + 14, + 21.4375, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg01_13", + 3, + -92.75, + 4, + 2.5, + NULL, + -95.625, + 4, + 2.5, + 0.707, + 0, + 0.707, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg01_09", + 1, + -8e1, + 4, + -52.6875, + NULL, + -8e1, + 4, + -55.875, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg02_53", + 1, + -8.75, + 0, + -45.5, + NULL, + -8.75, + 0, + -40.75, + 0.707, + 0, + 0.707, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg02_37", + 3, + 27.5, + 0, + -32, + NULL, + 35.625, + 0, + -32, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg00_127", + 1, + -62.25, + 14, + 26.6875, + NULL, + -61, + 14, + 26.8125, + 0.707, + 0, + 0.707, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg02_01", + 1, + -16, + 0, + -18.575, + NULL, + -16, + 0, + -22.45, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg01_17", + 1, + -76.4325, + 8, + 5.875, + NULL, + -78, + 8, + 2.375, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg01_38", + 1, + -77.1875, + 7, + -36.9375, + NULL, + -72, + 7, + -36.5, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg02_82", + 1, + 97, + 0, + -42.125, + NULL, + 98.1875, + 0, + -41.3125, + 0.707, + 0, + 0.707, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_palm, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg00_15", + 3, + 96.5, + 4, + 18.75, + NULL, + 97.5, + 4, + 18.25, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_tree, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "", + 1, + 0, + 0, + 0, + NULL, + -67.5, + 14, + 23.25, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_tree, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "int48", + 4, + 87.9875, + 9, + -1.125, + NULL, + 88.75, + 8.75, + 0.875, + 0.259, + 0, + 0.966, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_tree, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg01_01", + 3, + -48.625, + 7, + -23.1875, + NULL, + -50.4375, + 7, + -25, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_tree, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg01_01", + 0, + -48.625, + 7, + -23.1875, + NULL, + -49.125, + 7, + -25.8, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_tree, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg01_01", + 3, + -48.625, + 7, + -23.1875, + NULL, + -51.25, + 7, + -23.75, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::e_tree, + 3, + 0, + 1, + LegoPlantInfo::e_green, + -1, + -1, + "edg00_129", + 1, + -56.75, + 14, + 26.625, + NULL, + -58, + 14, + 26.75, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag2, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "", + 1, + 0, + 0, + 0, + NULL, + -4.33403, + -2.18029, + -1.53595, + 0, + 0, + 1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag2, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "", + 1, + 0, + 0, + 0, + NULL, + 1.280536, + -2.18024, + -1.57823, + 0, + 0, + -1, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag5, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "", + 1, + 0, + 0, + 0, + NULL, + -1.52465, + -0.52473, + -11.1617, + -0.0175, + 0, + -0.9998, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag5, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "", + 1, + 0, + 0, + 0, + NULL, + 1.439563, + -0.52554, + -11.1846, + 0.866, + 0, + -0.5, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag6, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_yellow, + -1, + -1, + "", + 1, + 0, + 0, + 0, + NULL, + -1.82829, + -0.52554, + -11.7741, + 0.866, + 0, + -0.5, + 0, + 1, + 0}, + {NULL, + LegoPlantInfo::c_flag6, + LegoPlantInfo::e_flower, + 3, + 0, + 1, + LegoPlantInfo::e_red, + -1, + -1, + "", + 1, + 0, + 0, + 0, + NULL, + 1.801479, + -0.52473, + -11.75, + -0.0175, + 0, + -0.9998, + 0, + 1, + 0} +}; From e507f42717a83406a7b3128c6ebd20d5e6c0e9ae Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 18 Jun 2024 13:35:03 -0400 Subject: [PATCH 4/9] Implement/match LegoPlantManager::CreatePlant (#1039) * Implement/match LegoPlantManager::CreatePlant * Update names * Fix name * Fix * Fix --- .../legoomni/include/legoanimationmanager.h | 4 +- .../legoomni/include/legobuildingmanager.h | 2 +- LEGO1/lego/legoomni/include/legomain.h | 28 +-- .../lego/legoomni/include/legoplantmanager.h | 7 +- LEGO1/lego/legoomni/include/legoplants.h | 19 +- LEGO1/lego/legoomni/include/legoworld.h | 6 +- .../src/common/legoanimationmanager.cpp | 24 +-- .../src/common/legobuildingmanager.cpp | 6 +- .../legoomni/src/common/legoplantmanager.cpp | 67 +++++++- LEGO1/lego/legoomni/src/common/legoplants.cpp | 162 +++++++++--------- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 16 +- .../src/entity/legoworldpresenter.cpp | 8 +- LEGO1/lego/legoomni/src/main/legomain.cpp | 72 ++++---- 13 files changed, 242 insertions(+), 179 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 018a0059..5038ac47 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -151,7 +151,7 @@ class LegoAnimationManager : public MxCore { void Resume(); void FUN_1005f6d0(MxBool p_unk0x400); void EnableCamAnims(MxBool p_enableCamAnims); - MxResult LoadScriptInfo(MxS32 p_scriptIndex); + MxResult LoadWorldInfo(MxS32 p_worldId); MxBool FindVehicle(const char* p_name, MxU32& p_index); MxResult ReadAnimInfo(LegoFile* p_file, AnimInfo* p_info); MxResult ReadModelInfo(LegoFile* p_file, ModelInfo* p_info); @@ -244,7 +244,7 @@ class LegoAnimationManager : public MxCore { void FUN_100648f0(LegoTranInfo* p_tranInfo, MxLong p_unk0x404); void FUN_10064b50(MxLong p_time); - MxS32 m_scriptIndex; // 0x08 + MxS32 m_worldId; // 0x08 MxU16 m_animCount; // 0x0c MxU16 m_unk0x0e; // 0x0e MxU16 m_unk0x10; // 0x10 diff --git a/LEGO1/lego/legoomni/include/legobuildingmanager.h b/LEGO1/lego/legoomni/include/legobuildingmanager.h index 45cb8caf..5ca8a06f 100644 --- a/LEGO1/lego/legoomni/include/legobuildingmanager.h +++ b/LEGO1/lego/legoomni/include/legobuildingmanager.h @@ -67,7 +67,7 @@ class LegoBuildingManager : public MxCore { void Init(); void FUN_1002fa00(); - void UpdatePosition(MxS32 p_index, LegoWorld* p_world); + void CreateBuilding(MxS32 p_index, LegoWorld* p_world); void FUN_1002fb30(); MxResult Write(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage); diff --git a/LEGO1/lego/legoomni/include/legomain.h b/LEGO1/lego/legoomni/include/legomain.h index 95cf7324..eee96fb5 100644 --- a/LEGO1/lego/legoomni/include/legomain.h +++ b/LEGO1/lego/legoomni/include/legomain.h @@ -38,17 +38,17 @@ class LegoOmni : public MxOmni { }; // SIZE 0x1c - struct ScriptContainer { + struct WorldContainer { // FUNCTION: LEGO1 0x1005ac40 - ScriptContainer() + WorldContainer() { - m_index = -1; + m_id = -1; m_atomId = NULL; } - ScriptContainer(MxS32 p_index, const char* p_key, MxAtomId* p_atomId) + WorldContainer(MxS32 p_id, const char* p_key, MxAtomId* p_atomId) { - m_index = p_index; + m_id = p_id; if (p_key) { strcpy(m_key, p_key); @@ -58,18 +58,18 @@ class LegoOmni : public MxOmni { } // FUNCTION: LEGO1 0x1005ac50 - ScriptContainer& operator=(const ScriptContainer& p_container) + WorldContainer& operator=(const WorldContainer& p_container) { - m_index = p_container.m_index; + m_id = p_container.m_id; strcpy(m_key, p_container.m_key); m_atomId = p_container.m_atomId; return *this; } - inline MxS32 GetIndex() { return m_index; } + inline MxS32 GetId() { return m_id; } inline const char* GetKey() { return m_key; } - MxS32 m_index; // 0x00 + MxS32 m_id; // 0x00 char m_key[20]; // 0x04 MxAtomId* m_atomId; // 0x18 }; @@ -110,10 +110,10 @@ class LegoOmni : public MxOmni { void FUN_1005b4f0(MxBool p_disable, MxU16 p_flags); void CreateBackgroundAudio(); void RemoveWorld(const MxAtomId& p_atom, MxLong p_objectId); - MxResult RegisterScripts(); - const char* GetScriptName(MxU32 p_index); - MxAtomId* GetScriptAtom(MxU32 p_index); - MxS32 GetScriptIndex(const char* p_key); + MxResult RegisterWorlds(); + const char* GetWorldName(MxU32 p_id); + MxAtomId* GetWorldAtom(MxU32 p_id); + MxS32 GetWorldId(const char* p_key); void DeleteAction(); static MxS32 GetCurrPathInfo(LegoPathBoundary**, MxS32&); @@ -154,7 +154,7 @@ class LegoOmni : public MxOmni { // LegoOmni::`scalar deleting destructor' private: - ScriptContainer* m_scripts; // 0x68 + WorldContainer* m_worlds; // 0x68 ViewLODListManager* m_viewLODListManager; // 0x6c LegoInputManager* m_inputManager; // 0x70 LegoTextureContainer* m_textureContainer; // 0x74 diff --git a/LEGO1/lego/legoomni/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index 765e5e7e..2db3dc6e 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -8,6 +8,7 @@ class LegoEntity; class LegoPathBoundary; class LegoROI; class LegoStorage; +class LegoWorld; // VTABLE: LEGO1 0x100d6758 // SIZE 0x2c @@ -26,7 +27,7 @@ class LegoPlantManager : public MxCore { } void Init(); - void FUN_10026360(MxS32 p_scriptIndex); + void LoadWorldInfo(MxS32 p_worldId); void FUN_100263a0(undefined4 p_und); MxResult Write(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage); @@ -47,9 +48,11 @@ class LegoPlantManager : public MxCore { // LegoPlantManager::`scalar deleting destructor' private: + LegoEntity* CreatePlant(MxS32 p_index, LegoWorld* p_world, MxS32 p_worldId); + static char* g_customizeAnimFile; - undefined4 m_unk0x08; // 0x08 + MxS32 m_worldId; // 0x08 undefined m_unk0x0c; // 0x0c undefined m_unk0x10[0x17]; // 0x10 undefined m_unk0x24; // 0x24 diff --git a/LEGO1/lego/legoomni/include/legoplants.h b/LEGO1/lego/legoomni/include/legoplants.h index 638baea4..ee1ea49b 100644 --- a/LEGO1/lego/legoomni/include/legoplants.h +++ b/LEGO1/lego/legoomni/include/legoplants.h @@ -9,13 +9,14 @@ class LegoPathBoundary; // SIZE 0x54 struct LegoPlantInfo { - enum { - c_flag1 = 0x01, - c_flag2 = 0x02, - c_flag5 = 0x10, - c_flag6 = 0x20, - c_flag16 = 0x8000, - c_flag17 = 0x10000 + // See LegoOmni::RegisterWorlds for IDs + enum Worlds { + c_act1 = 1 << 0, + c_imain = 1 << 1, + c_ielev = 1 << 4, + c_iisle = 1 << 5, + c_act2 = 1 << 15, + c_act3 = 1 << 16 }; enum Variant { @@ -34,8 +35,8 @@ struct LegoPlantInfo { }; LegoEntity* m_entity; // 0x00 - MxU32 m_flags; // 0x04 - Variant m_variant; // 0x08 + MxU32 m_worlds; // 0x04 - see enum for possible bit flags + MxU8 m_variant; // 0x08 - see enum for possible values MxU32 m_sound; // 0x0c MxU32 m_move; // 0x10 MxU8 m_mood; // 0x14 diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index f1de12c9..0ae00795 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -90,12 +90,12 @@ class LegoWorld : public LegoEntity { inline LegoCameraController* GetCamera() { return m_cameraController; } inline LegoEntityList* GetEntityList() { return m_entityList; } - inline MxS32 GetScriptIndex() { return m_scriptIndex; } + inline MxS32 GetWorldId() { return m_worldId; } inline MxBool GetUnknown0xd0Empty() { return m_set0xd0.empty(); } inline list& GetROIList() { return m_roiList; } inline LegoHideAnimPresenter* GetHideAnimPresenter() { return m_hideAnimPresenter; } - inline void SetScriptIndex(MxS32 p_scriptIndex) { m_scriptIndex = p_scriptIndex; } + inline void SetWorldId(MxS32 p_worldId) { m_worldId = p_worldId; } // SYNTHETIC: LEGO1 0x1001dee0 // LegoWorld::`scalar deleting destructor' @@ -111,7 +111,7 @@ class LegoWorld : public LegoEntity { MxPresenterList m_controlPresenters; // 0xb8 MxCoreSet m_set0xd0; // 0xd0 list m_roiList; // 0xe0 - MxS32 m_scriptIndex; // 0xec + MxS32 m_worldId; // 0xec LegoHideAnimPresenter* m_hideAnimPresenter; // 0xf0 MxS16 m_startupTicks; // 0xf4 MxBool m_worldStarted; // 0xf6 diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 3c4545b5..ab48daef 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -415,7 +415,7 @@ void LegoAnimationManager::Suspend() m_animState = (AnimState*) GameState()->CreateState("AnimState"); } - if (m_scriptIndex == 0) { + if (m_worldId == 0) { m_animState->FUN_10065240(m_animCount, m_anims, m_lastExtraCharacterId); } @@ -494,7 +494,7 @@ void LegoAnimationManager::Resume() void LegoAnimationManager::Init() { m_unk0x402 = FALSE; - m_scriptIndex = -1; + m_worldId = -1; m_animCount = 0; m_anims = NULL; m_unk0x18 = 0; @@ -579,12 +579,12 @@ void LegoAnimationManager::EnableCamAnims(MxBool p_enableCamAnims) } // FUNCTION: LEGO1 0x1005f720 -MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) +MxResult LegoAnimationManager::LoadWorldInfo(MxS32 p_worldId) { MxResult result = FAILURE; MxS32 i, j, k; - if (m_scriptIndex != p_scriptIndex) { + if (m_worldId != p_worldId) { if (m_tranInfoList != NULL) { delete m_tranInfoList; m_tranInfoList = NULL; @@ -614,7 +614,7 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) m_animState = (AnimState*) GameState()->CreateState("AnimState"); } - if (m_scriptIndex == 0) { + if (m_worldId == 0) { m_animState->FUN_10065240(m_animCount, m_anims, m_lastExtraCharacterId); } @@ -622,14 +622,14 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) LegoFile file; - if (p_scriptIndex == -1) { + if (p_worldId == -1) { result = SUCCESS; goto done; } char filename[128]; char path[1024]; - sprintf(filename, "lego\\data\\%sinf.dta", Lego()->GetScriptName(p_scriptIndex)); + sprintf(filename, "lego\\data\\%sinf.dta", Lego()->GetWorldName(p_worldId)); sprintf(path, "%s", MxOmni::GetHD()); if (path[strlen(path) - 1] != '\\') { @@ -708,7 +708,7 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) } } - m_scriptIndex = p_scriptIndex; + m_worldId = p_worldId; m_tranInfoList = new LegoTranInfoList(); m_tranInfoList2 = new LegoTranInfoList(); @@ -726,7 +726,7 @@ MxResult LegoAnimationManager::LoadScriptInfo(MxS32 p_scriptIndex) m_unk0x402 = FALSE; } - if (p_scriptIndex == 0) { + if (p_worldId == 0) { m_animState->FUN_100651d0(m_animCount, m_anims, m_lastExtraCharacterId); } } @@ -934,7 +934,7 @@ MxResult LegoAnimationManager::FUN_100605e0( { MxResult result = FAILURE; - if (m_scriptIndex != -1 && p_index < m_animCount && m_tranInfoList != NULL) { + if (m_worldId != -1 && p_index < m_animCount && m_tranInfoList != NULL) { PurgeExtra(FALSE); FUN_10062770(); @@ -983,7 +983,7 @@ MxResult LegoAnimationManager::FUN_100605e0( char buf[256]; sprintf(buf, "%s:%d", g_strANIMMAN_ID, tranInfo->m_index); - action.SetAtomId(*Lego()->GetScriptAtom(m_scriptIndex)); + action.SetAtomId(*Lego()->GetWorldAtom(m_worldId)); action.SetObjectId(animInfo.m_objectId); action.SetUnknown24(-1); action.AppendExtra(strlen(buf) + 1, buf); @@ -1050,7 +1050,7 @@ MxResult LegoAnimationManager::FUN_100609f0(MxU32 p_objectId, MxMatrix* p_matrix char buf[256]; sprintf(buf, "%s:%d", g_strANIMMAN_ID, info->m_index); - action.SetAtomId(*Lego()->GetScriptAtom(m_scriptIndex)); + action.SetAtomId(*Lego()->GetWorldAtom(m_worldId)); action.SetObjectId(p_objectId); action.SetUnknown24(-1); action.AppendExtra(strlen(buf) + 1, buf); diff --git a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp index be886496..ad4551c8 100644 --- a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp @@ -263,7 +263,7 @@ void LegoBuildingManager::FUN_1002fa00() LegoWorld* world = CurrentWorld(); for (i = 0; i < sizeOfArray(g_buildingInfo); i++) { - UpdatePosition(i, world); + CreateBuilding(i, world); } if (g_buildingManagerConfig <= 1) { @@ -287,7 +287,7 @@ void LegoBuildingManager::FUN_1002fa00() // FUNCTION: LEGO1 0x1002fa90 // FUNCTION: BETA10 0x10063b88 -void LegoBuildingManager::UpdatePosition(MxS32 p_index, LegoWorld* p_world) +void LegoBuildingManager::CreateBuilding(MxS32 p_index, LegoWorld* p_world) { LegoEntity* entity = (LegoEntity*) p_world->Find("MxEntity", g_buildingInfo[p_index].m_variant); @@ -457,7 +457,7 @@ MxBool LegoBuildingManager::SwitchVariant(LegoEntity* p_entity) roi->SetVisibility(FALSE); info->m_variant = g_buildingInfoVariants[m_nextVariant]; - UpdatePosition(12, CurrentWorld()); + CreateBuilding(12, CurrentWorld()); if (info->m_entity != NULL) { info->m_entity->GetROI()->SetVisibility(TRUE); diff --git a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp index 6be98452..793de4f5 100644 --- a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp @@ -1,10 +1,23 @@ #include "legoplantmanager.h" +#include "legocharactermanager.h" #include "legoentity.h" #include "legoplants.h" +#include "legoworld.h" +#include "misc.h" + +#include DECOMP_SIZE_ASSERT(LegoPlantManager, 0x2c) +// GLOBAL: LEGO1 0x100f1660 +const char* g_plantLodNames[4][5] = { + {"flwrwht", "flwrblk", "flwryel", "flwrred", "flwrgrn"}, + {"treewht", "treeblk", "treeyel", "treered", "tree"}, + {"bushwht", "bushblk", "bushyel", "bushred", "bush"}, + {"palmwht", "palmblk", "palmyel", "palmred", "palm"} +}; + // GLOBAL: LEGO1 0x100f3188 char* LegoPlantManager::g_customizeAnimFile = NULL; @@ -31,16 +44,23 @@ void LegoPlantManager::Init() g_plantInfo[i] = g_plantInfoInit[i]; } - m_unk0x08 = -1; + m_worldId = -1; m_unk0x0c = 0; m_unk0x24 = 0; } -// STUB: LEGO1 0x10026360 +// FUNCTION: LEGO1 0x10026360 // FUNCTION: BETA10 0x100c5032 -void LegoPlantManager::FUN_10026360(MxS32 p_scriptIndex) +void LegoPlantManager::LoadWorldInfo(MxS32 p_worldId) { - // TODO + m_worldId = p_worldId; + LegoWorld* world = CurrentWorld(); + + for (MxS32 i = 0; i < sizeOfArray(g_plantInfo); i++) { + CreatePlant(i, world, p_worldId); + } + + m_unk0x0c = 0; } // STUB: LEGO1 0x100263a0 @@ -49,6 +69,45 @@ void LegoPlantManager::FUN_100263a0(undefined4 p_und) // TODO } +// FUNCTION: LEGO1 0x10026590 +// FUNCTION: BETA10 0x100c561e +LegoEntity* LegoPlantManager::CreatePlant(MxS32 p_index, LegoWorld* p_world, MxS32 p_worldId) +{ + LegoEntity* entity = NULL; + + if (p_index < sizeOfArray(g_plantInfo)) { + MxU32 world = 1 << (MxU8) p_worldId; + + if (g_plantInfo[p_index].m_worlds & world && g_plantInfo[p_index].m_unk0x16 != 0) { + if (g_plantInfo[p_index].m_entity == NULL) { + char name[256]; + char lodName[256]; + + sprintf(name, "plant%d", p_index); + sprintf(lodName, "%s", g_plantLodNames[g_plantInfo[p_index].m_variant][g_plantInfo[p_index].m_color]); + + LegoROI* roi = CharacterManager()->CreateAutoROI(name, lodName, TRUE); + roi->SetVisibility(TRUE); + + entity = roi->GetEntity(); + entity->SetLocation( + g_plantInfo[p_index].m_position, + g_plantInfo[p_index].m_direction, + g_plantInfo[p_index].m_up, + FALSE + ); + entity->SetType(LegoEntity::e_plant); + g_plantInfo[p_index].m_entity = entity; + } + else { + entity = g_plantInfo[p_index].m_entity; + } + } + } + + return entity; +} + // STUB: LEGO1 0x10026720 // FUNCTION: BETA10 0x100c5918 MxResult LegoPlantManager::Write(LegoStorage* p_storage) diff --git a/LEGO1/lego/legoomni/src/common/legoplants.cpp b/LEGO1/lego/legoomni/src/common/legoplants.cpp index 8979614a..daa892ec 100644 --- a/LEGO1/lego/legoomni/src/common/legoplants.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplants.cpp @@ -5,7 +5,7 @@ DECOMP_SIZE_ASSERT(LegoPlantInfo, 0x54) // GLOBAL: LEGO1 0x100f16c8 LegoPlantInfo g_plantInfoInit[81] = { {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -29,7 +29,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -53,7 +53,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -77,7 +77,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -101,7 +101,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -125,7 +125,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -149,7 +149,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -173,7 +173,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -197,7 +197,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -221,7 +221,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -245,7 +245,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -269,7 +269,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -293,7 +293,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -317,7 +317,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -341,7 +341,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -365,7 +365,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -389,7 +389,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_bush, 3, 0, @@ -413,7 +413,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_bush, 3, 0, @@ -437,7 +437,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_bush, 3, 0, @@ -461,7 +461,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_bush, 3, 0, @@ -485,7 +485,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, 3, 0, @@ -509,7 +509,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, 3, 0, @@ -533,7 +533,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, 3, 0, @@ -557,7 +557,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, 3, 0, @@ -581,7 +581,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -605,7 +605,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -629,7 +629,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -653,7 +653,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -677,7 +677,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -701,7 +701,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -725,7 +725,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -749,7 +749,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -773,7 +773,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -797,7 +797,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -821,7 +821,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -845,7 +845,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -869,7 +869,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -893,7 +893,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -917,7 +917,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -941,7 +941,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -965,7 +965,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -989,7 +989,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -1013,7 +1013,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -1037,7 +1037,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -1061,7 +1061,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -1085,7 +1085,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -1109,7 +1109,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -1133,7 +1133,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -1157,7 +1157,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -1181,7 +1181,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_flower, 3, 0, @@ -1205,7 +1205,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -1229,7 +1229,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -1253,7 +1253,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -1277,7 +1277,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -1301,7 +1301,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -1325,7 +1325,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -1349,7 +1349,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -1373,7 +1373,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -1397,7 +1397,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -1421,7 +1421,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -1445,7 +1445,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -1469,7 +1469,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -1493,7 +1493,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -1517,7 +1517,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -1541,7 +1541,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -1565,7 +1565,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -1589,7 +1589,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -1613,7 +1613,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -1637,7 +1637,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_palm, 3, 0, @@ -1661,7 +1661,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, 3, 0, @@ -1685,7 +1685,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, 3, 0, @@ -1709,7 +1709,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, 3, 0, @@ -1733,7 +1733,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, 3, 0, @@ -1757,7 +1757,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, 3, 0, @@ -1781,7 +1781,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag1 | LegoPlantInfo::c_flag16 | LegoPlantInfo::c_flag17, + LegoPlantInfo::c_act1 | LegoPlantInfo::c_act2 | LegoPlantInfo::c_act3, LegoPlantInfo::e_tree, 3, 0, @@ -1805,7 +1805,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag2, + LegoPlantInfo::c_imain, LegoPlantInfo::e_flower, 3, 0, @@ -1829,7 +1829,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag2, + LegoPlantInfo::c_imain, LegoPlantInfo::e_flower, 3, 0, @@ -1853,7 +1853,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag5, + LegoPlantInfo::c_ielev, LegoPlantInfo::e_flower, 3, 0, @@ -1877,7 +1877,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag5, + LegoPlantInfo::c_ielev, LegoPlantInfo::e_flower, 3, 0, @@ -1901,7 +1901,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag6, + LegoPlantInfo::c_iisle, LegoPlantInfo::e_flower, 3, 0, @@ -1925,7 +1925,7 @@ LegoPlantInfo g_plantInfoInit[81] = { 1, 0}, {NULL, - LegoPlantInfo::c_flag6, + LegoPlantInfo::c_iisle, LegoPlantInfo::e_flower, 3, 0, diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index 74236576..608ec193 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -100,7 +100,7 @@ MxResult LegoWorld::Create(MxDSAction& p_dsAction) } SetIsWorldActive(TRUE); - m_scriptIndex = -1; + m_worldId = -1; return SUCCESS; } @@ -177,8 +177,8 @@ void LegoWorld::Destroy(MxBool p_fromDestructor) } } - if (m_scriptIndex != -1 && m_set0xd0.empty()) { - PlantManager()->FUN_100263a0(m_scriptIndex); + if (m_worldId != -1 && m_set0xd0.empty()) { + PlantManager()->FUN_100263a0(m_worldId); BuildingManager()->FUN_1002fb30(); } @@ -691,9 +691,9 @@ void LegoWorld::Enable(MxBool p_enable) Lego()->SetNavController(m_cameraController->GetNavController()); } - if (m_scriptIndex != -1) { - PlantManager()->FUN_10026360(m_scriptIndex); - AnimationManager()->LoadScriptInfo(m_scriptIndex); + if (m_worldId != -1) { + PlantManager()->LoadWorldInfo(m_worldId); + AnimationManager()->LoadWorldInfo(m_worldId); BuildingManager()->FUN_1002fa00(); AnimationManager()->Resume(); } @@ -714,8 +714,8 @@ void LegoWorld::Enable(MxBool p_enable) AnimationManager()->Reset(FALSE); m_set0xd0.insert(this); - if (m_scriptIndex != -1) { - PlantManager()->FUN_100263a0(m_scriptIndex); + if (m_worldId != -1) { + PlantManager()->FUN_100263a0(m_worldId); BuildingManager()->FUN_1002fb30(); } diff --git a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp index cc64360f..37488092 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp @@ -54,9 +54,9 @@ LegoWorldPresenter::~LegoWorldPresenter() { MxBool result = FALSE; if (m_entity) { - MxS32 scriptIndex = ((LegoWorld*) m_entity)->GetScriptIndex(); - PlantManager()->FUN_10026360(scriptIndex); - AnimationManager()->LoadScriptInfo(scriptIndex); + MxS32 worldId = ((LegoWorld*) m_entity)->GetWorldId(); + PlantManager()->LoadWorldInfo(worldId); + AnimationManager()->LoadWorldInfo(worldId); BuildingManager()->FUN_1002fa00(); result = ((LegoWorld*) m_entity)->VTable0x5c(); } @@ -438,7 +438,7 @@ void LegoWorldPresenter::ParseExtra() if (KeyValueStringParse(output, g_strWORLD, extraCopy)) { char* worldKey = strtok(output, g_parseExtraTokens); LoadWorld(worldKey, (LegoWorld*) m_entity); - ((LegoWorld*) m_entity)->SetScriptIndex(Lego()->GetScriptIndex(worldKey)); + ((LegoWorld*) m_entity)->SetWorldId(Lego()->GetWorldId(worldKey)); } } } diff --git a/LEGO1/lego/legoomni/src/main/legomain.cpp b/LEGO1/lego/legoomni/src/main/legomain.cpp index a0cc4113..62a927ff 100644 --- a/LEGO1/lego/legoomni/src/main/legomain.cpp +++ b/LEGO1/lego/legoomni/src/main/legomain.cpp @@ -34,7 +34,7 @@ #include "viewmanager/viewmanager.h" DECOMP_SIZE_ASSERT(LegoOmni, 0x140) -DECOMP_SIZE_ASSERT(LegoOmni::ScriptContainer, 0x1c) +DECOMP_SIZE_ASSERT(LegoOmni::WorldContainer, 0x1c) DECOMP_SIZE_ASSERT(LegoWorldList, 0x18) DECOMP_SIZE_ASSERT(LegoWorldListCursor, 0x10) @@ -58,7 +58,7 @@ LegoOmni::~LegoOmni() void LegoOmni::Init() { MxOmni::Init(); - m_scripts = NULL; + m_worlds = NULL; m_inputManager = NULL; m_viewLODListManager = NULL; m_textureContainer = NULL; @@ -145,8 +145,8 @@ void LegoOmni::Destroy() m_action.ClearAtom(); DestroyScripts(); - if (m_scripts) { - delete[] m_scripts; + if (m_worlds) { + delete[] m_worlds; } MxOmni::Destroy(); @@ -235,7 +235,7 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param) CreateScripts(); IslePathActor::RegisterSpawnLocations(); - result = RegisterScripts(); + result = RegisterWorlds(); if (result != SUCCESS) { goto done; @@ -264,33 +264,33 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param) } // FUNCTION: LEGO1 0x1005a5f0 -MxResult LegoOmni::RegisterScripts() +MxResult LegoOmni::RegisterWorlds() { - m_scripts = new ScriptContainer[19]; + m_worlds = new WorldContainer[19]; - if (!m_scripts) { + if (!m_worlds) { return FAILURE; } - m_scripts[0] = ScriptContainer(); - m_scripts[1] = ScriptContainer(0, "ACT1", g_isleScript); - m_scripts[2] = ScriptContainer(1, "IMAIN", g_infomainScript); - m_scripts[3] = ScriptContainer(2, "ICUBE", g_infoscorScript); - m_scripts[4] = ScriptContainer(3, "IREG", g_regbookScript); - m_scripts[5] = ScriptContainer(4, "IELEV", g_elevbottScript); - m_scripts[6] = ScriptContainer(5, "IISLE", g_infodoorScript); - m_scripts[7] = ScriptContainer(6, "HOSP", g_hospitalScript); - m_scripts[8] = ScriptContainer(7, "POLICE", g_policeScript); - m_scripts[9] = ScriptContainer(8, "GMAIN", g_garageScript); - m_scripts[10] = ScriptContainer(9, "BLDH", g_copterScript); - m_scripts[11] = ScriptContainer(10, "BLDD", g_dunecarScript); - m_scripts[12] = ScriptContainer(11, "BLDJ", g_jetskiScript); - m_scripts[13] = ScriptContainer(12, "BLDR", g_racecarScript); - m_scripts[14] = ScriptContainer(13, "RACC", g_carraceScript); - m_scripts[15] = ScriptContainer(14, "RACJ", g_jetraceScript); - m_scripts[16] = ScriptContainer(15, "ACT2", g_act2mainScript); - m_scripts[17] = ScriptContainer(16, "ACT3", g_act3Script); - m_scripts[18] = ScriptContainer(17, "TEST", g_testScript); + m_worlds[0] = WorldContainer(); + m_worlds[1] = WorldContainer(0, "ACT1", g_isleScript); + m_worlds[2] = WorldContainer(1, "IMAIN", g_infomainScript); + m_worlds[3] = WorldContainer(2, "ICUBE", g_infoscorScript); + m_worlds[4] = WorldContainer(3, "IREG", g_regbookScript); + m_worlds[5] = WorldContainer(4, "IELEV", g_elevbottScript); + m_worlds[6] = WorldContainer(5, "IISLE", g_infodoorScript); + m_worlds[7] = WorldContainer(6, "HOSP", g_hospitalScript); + m_worlds[8] = WorldContainer(7, "POLICE", g_policeScript); + m_worlds[9] = WorldContainer(8, "GMAIN", g_garageScript); + m_worlds[10] = WorldContainer(9, "BLDH", g_copterScript); + m_worlds[11] = WorldContainer(10, "BLDD", g_dunecarScript); + m_worlds[12] = WorldContainer(11, "BLDJ", g_jetskiScript); + m_worlds[13] = WorldContainer(12, "BLDR", g_racecarScript); + m_worlds[14] = WorldContainer(13, "RACC", g_carraceScript); + m_worlds[15] = WorldContainer(14, "RACJ", g_jetraceScript); + m_worlds[16] = WorldContainer(15, "ACT2", g_act2mainScript); + m_worlds[17] = WorldContainer(16, "ACT3", g_act3Script); + m_worlds[18] = WorldContainer(17, "TEST", g_testScript); return SUCCESS; } @@ -474,11 +474,11 @@ MxS32 LegoOmni::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value) } // FUNCTION: LEGO1 0x1005b430 -const char* LegoOmni::GetScriptName(MxU32 p_index) +const char* LegoOmni::GetWorldName(MxU32 p_id) { for (MxS32 i = 0; i < 19; i++) { - if (m_scripts[i].m_index == p_index) { - return m_scripts[i].m_key; + if (m_worlds[i].m_id == p_id) { + return m_worlds[i].m_key; } } @@ -486,11 +486,11 @@ const char* LegoOmni::GetScriptName(MxU32 p_index) } // FUNCTION: LEGO1 0x1005b460 -MxAtomId* LegoOmni::GetScriptAtom(MxU32 p_index) +MxAtomId* LegoOmni::GetWorldAtom(MxU32 p_id) { for (MxS32 i = 0; i < 19; i++) { - if (m_scripts[i].m_index == p_index) { - return m_scripts[i].m_atomId; + if (m_worlds[i].m_id == p_id) { + return m_worlds[i].m_atomId; } } @@ -498,11 +498,11 @@ MxAtomId* LegoOmni::GetScriptAtom(MxU32 p_index) } // FUNCTION: LEGO1 0x1005b490 -MxS32 LegoOmni::GetScriptIndex(const char* p_key) +MxS32 LegoOmni::GetWorldId(const char* p_key) { for (MxS32 i = 0; i < 19; i++) { - if ((MxS32) &m_scripts[i] != -4 && !strcmpi(m_scripts[i].GetKey(), p_key)) { - return m_scripts[i].GetIndex(); + if ((MxS32) &m_worlds[i] != -4 && !strcmpi(m_worlds[i].GetKey(), p_key)) { + return m_worlds[i].GetId(); } } From 656e7fc674e1d61d549eb8ae49d042727b18749a Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 19 Jun 2024 12:02:54 -0400 Subject: [PATCH 5/9] Implement/match more LegoPlantManager functions (#1040) --- .../legoomni/include/legobuildingmanager.h | 2 +- .../lego/legoomni/include/legoplantmanager.h | 14 +- .../src/common/legobuildingmanager.cpp | 2 +- .../legoomni/src/common/legoplantmanager.cpp | 127 ++++++++++++++++-- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 8 +- 5 files changed, 132 insertions(+), 21 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legobuildingmanager.h b/LEGO1/lego/legoomni/include/legobuildingmanager.h index 5ca8a06f..8514985f 100644 --- a/LEGO1/lego/legoomni/include/legobuildingmanager.h +++ b/LEGO1/lego/legoomni/include/legobuildingmanager.h @@ -68,7 +68,7 @@ class LegoBuildingManager : public MxCore { void Init(); void FUN_1002fa00(); void CreateBuilding(MxS32 p_index, LegoWorld* p_world); - void FUN_1002fb30(); + void Reset(); MxResult Write(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage); LegoBuildingInfo* GetInfo(LegoEntity* p_entity); diff --git a/LEGO1/lego/legoomni/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index 2db3dc6e..f1eb0544 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -28,7 +28,7 @@ class LegoPlantManager : public MxCore { void Init(); void LoadWorldInfo(MxS32 p_worldId); - void FUN_100263a0(undefined4 p_und); + void Reset(MxS32 p_worldId); MxResult Write(LegoStorage* p_storage); MxResult Read(LegoStorage* p_storage); MxBool SwitchColor(LegoEntity* p_entity); @@ -49,14 +49,16 @@ class LegoPlantManager : public MxCore { private: LegoEntity* CreatePlant(MxS32 p_index, LegoWorld* p_world, MxS32 p_worldId); + void RemovePlant(MxS32 p_index, MxS32 p_worldId); + void FUN_10026860(MxS32 p_index); static char* g_customizeAnimFile; - MxS32 m_worldId; // 0x08 - undefined m_unk0x0c; // 0x0c - undefined m_unk0x10[0x17]; // 0x10 - undefined m_unk0x24; // 0x24 - undefined4 m_unk0x28; // 0x28 + MxS32 m_worldId; // 0x08 + undefined m_unk0x0c; // 0x0c + undefined* m_unk0x10[5]; // 0x10 + MxS8 m_unk0x24; // 0x24 + undefined4 m_unk0x28; // 0x28 }; #endif // LEGOPLANTMANAGER_H diff --git a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp index ad4551c8..88b443b5 100644 --- a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp @@ -304,7 +304,7 @@ void LegoBuildingManager::CreateBuilding(MxS32 p_index, LegoWorld* p_world) } // FUNCTION: LEGO1 0x1002fb30 -void LegoBuildingManager::FUN_1002fb30() +void LegoBuildingManager::Reset() { MxU32 i; diff --git a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp index 793de4f5..09739ae6 100644 --- a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp @@ -5,6 +5,9 @@ #include "legoplants.h" #include "legoworld.h" #include "misc.h" +#include "misc/legostorage.h" +#include "scripts.h" +#include "sndanim_actions.h" #include @@ -18,6 +21,12 @@ const char* g_plantLodNames[4][5] = { {"palmwht", "palmblk", "palmyel", "palmred", "palm"} }; +// GLOBAL: LEGO1 0x100f16b0 +float g_unk0x100f16b0[] = {0.1f, 0.7f, 0.5f, 0.9f}; + +// GLOBAL: LEGO1 0x100f16c0 +MxU8 g_unk0x100f16c0[] = {1, 2, 2, 3}; + // GLOBAL: LEGO1 0x100f3188 char* LegoPlantManager::g_customizeAnimFile = NULL; @@ -63,10 +72,24 @@ void LegoPlantManager::LoadWorldInfo(MxS32 p_worldId) m_unk0x0c = 0; } -// STUB: LEGO1 0x100263a0 -void LegoPlantManager::FUN_100263a0(undefined4 p_und) +// FUNCTION: LEGO1 0x100263a0 +void LegoPlantManager::Reset(MxS32 p_worldId) { - // TODO + MxU32 i; + DeleteObjects(g_sndAnimScript, SndanimScript::c_AnimC1, SndanimScript::c_AnimBld18); + + for (i = 0; i < m_unk0x24; i++) { + delete m_unk0x10[i]; + } + + m_unk0x24 = 0; + + for (i = 0; i < sizeOfArray(g_plantInfo); i++) { + RemovePlant(i, p_worldId); + } + + m_worldId = -1; + m_unk0x0c = 0; } // FUNCTION: LEGO1 0x10026590 @@ -108,20 +131,106 @@ LegoEntity* LegoPlantManager::CreatePlant(MxS32 p_index, LegoWorld* p_world, MxS return entity; } -// STUB: LEGO1 0x10026720 +// FUNCTION: LEGO1 0x100266c0 +// FUNCTION: BETA10 0x100c5859 +void LegoPlantManager::RemovePlant(MxS32 p_index, MxS32 p_worldId) +{ + if (p_index < sizeOfArray(g_plantInfo)) { + MxU32 world = 1 << (MxU8) p_worldId; + + if (g_plantInfo[p_index].m_worlds & world && g_plantInfo[p_index].m_entity != NULL) { + CharacterManager()->ReleaseAutoROI(g_plantInfo[p_index].m_entity->GetROI()); + g_plantInfo[p_index].m_entity = NULL; + } + } +} + +// FUNCTION: LEGO1 0x10026720 // FUNCTION: BETA10 0x100c5918 MxResult LegoPlantManager::Write(LegoStorage* p_storage) { - // TODO - return SUCCESS; + MxResult result = FAILURE; + + for (MxS32 i = 0; i < sizeOfArray(g_plantInfo); i++) { + LegoPlantInfo* info = &g_plantInfo[i]; + + if (p_storage->Write(&info->m_variant, sizeof(info->m_variant)) != SUCCESS) { + goto done; + } + if (p_storage->Write(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) { + goto done; + } + if (p_storage->Write(&info->m_move, sizeof(info->m_move)) != SUCCESS) { + goto done; + } + if (p_storage->Write(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) { + goto done; + } + if (p_storage->Write(&info->m_color, sizeof(info->m_color)) != SUCCESS) { + goto done; + } + if (p_storage->Write(&info->m_initialUnk0x16, sizeof(info->m_initialUnk0x16)) != SUCCESS) { + goto done; + } + } + + result = SUCCESS; + +done: + return result; } -// STUB: LEGO1 0x100267b0 +// FUNCTION: LEGO1 0x100267b0 // FUNCTION: BETA10 0x100c5a76 MxResult LegoPlantManager::Read(LegoStorage* p_storage) { - // TODO - return SUCCESS; + MxResult result = FAILURE; + + for (MxS32 i = 0; i < sizeOfArray(g_plantInfo); i++) { + LegoPlantInfo* info = &g_plantInfo[i]; + + if (p_storage->Read(&info->m_variant, sizeof(info->m_variant)) != SUCCESS) { + goto done; + } + if (p_storage->Read(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) { + goto done; + } + if (p_storage->Read(&info->m_move, sizeof(info->m_move)) != SUCCESS) { + goto done; + } + if (p_storage->Read(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) { + goto done; + } + if (p_storage->Read(&info->m_color, sizeof(info->m_color)) != SUCCESS) { + goto done; + } + if (p_storage->Read(&info->m_unk0x16, sizeof(info->m_unk0x16)) != SUCCESS) { + goto done; + } + + info->m_initialUnk0x16 = info->m_unk0x16; + FUN_10026860(i); + } + + result = SUCCESS; + +done: + return result; +} + +// FUNCTION: LEGO1 0x10026860 +// FUNCTION: BETA10 0x100c5be0 +void LegoPlantManager::FUN_10026860(MxS32 p_index) +{ + MxU8 variant = g_plantInfo[p_index].m_variant; + + if (g_plantInfo[p_index].m_unk0x16 >= 0) { + float value = g_unk0x100f16c0[variant] - g_plantInfo[p_index].m_unk0x16; + g_plantInfo[p_index].m_position[1] = g_plantInfoInit[p_index].m_position[1] - value * g_unk0x100f16b0[variant]; + } + else { + g_plantInfo[p_index].m_position[1] = g_plantInfoInit[p_index].m_position[1]; + } } // STUB: LEGO1 0x10026920 diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index 608ec193..de9c3c63 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -178,8 +178,8 @@ void LegoWorld::Destroy(MxBool p_fromDestructor) } if (m_worldId != -1 && m_set0xd0.empty()) { - PlantManager()->FUN_100263a0(m_worldId); - BuildingManager()->FUN_1002fb30(); + PlantManager()->Reset(m_worldId); + BuildingManager()->Reset(); } if (m_entityList) { @@ -715,8 +715,8 @@ void LegoWorld::Enable(MxBool p_enable) m_set0xd0.insert(this); if (m_worldId != -1) { - PlantManager()->FUN_100263a0(m_worldId); - BuildingManager()->FUN_1002fb30(); + PlantManager()->Reset(m_worldId); + BuildingManager()->Reset(); } MxPresenterListCursor controlPresenterCursor(&m_controlPresenters); From 1d666f62e5c3f0e431ab7b7d69c5815cec4eeec1 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 19 Jun 2024 12:57:05 -0400 Subject: [PATCH 6/9] Implement/match LegoPlantManager interaction functions (#1041) --- .../legoomni/include/legobuildingmanager.h | 4 +- .../legoomni/include/legocharactermanager.h | 6 +- .../lego/legoomni/include/legoplantmanager.h | 8 +- .../src/common/legobuildingmanager.cpp | 16 +- .../src/common/legocharactermanager.cpp | 8 +- .../legoomni/src/common/legoplantmanager.cpp | 183 ++++++++++++++++-- LEGO1/lego/legoomni/src/entity/legoentity.cpp | 12 +- 7 files changed, 191 insertions(+), 46 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legobuildingmanager.h b/LEGO1/lego/legoomni/include/legobuildingmanager.h index 8514985f..782dccb9 100644 --- a/LEGO1/lego/legoomni/include/legobuildingmanager.h +++ b/LEGO1/lego/legoomni/include/legobuildingmanager.h @@ -76,8 +76,8 @@ class LegoBuildingManager : public MxCore { MxBool SwitchSound(LegoEntity* p_entity); MxBool SwitchMove(LegoEntity* p_entity); MxBool SwitchMood(LegoEntity* p_entity); - MxU32 GetBuildingEntityId(LegoEntity* p_entity); - MxU32 FUN_1002ff40(LegoEntity* p_entity, MxBool); + MxU32 GetAnimationId(LegoEntity* p_entity); + MxU32 GetSoundId(LegoEntity* p_entity, MxBool); MxBool FUN_10030000(LegoEntity* p_entity); MxBool FUN_10030030(MxS32 p_index); MxBool FUN_10030110(LegoBuildingInfo* p_data); diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index 2c2238d6..57208ec7 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -74,10 +74,11 @@ class LegoCharacterManager { MxBool SwitchSound(LegoROI* p_roi); MxBool SwitchMove(LegoROI* p_roi); MxBool SwitchMood(LegoROI* p_roi); - MxU32 FUN_10085120(LegoROI* p_roi); - MxU32 FUN_10085140(LegoROI* p_roi, MxBool p_und); + MxU32 GetAnimationId(LegoROI* p_roi); + MxU32 GetSoundId(LegoROI* p_roi, MxBool p_und); MxU8 GetMood(LegoROI* p_roi); LegoROI* CreateAutoROI(const char* p_name, const char* p_lodName, MxBool p_createEntity); + MxResult FUN_10085870(LegoROI* p_roi); LegoROI* FUN_10085a80(const char* p_name, const char* p_lodName, MxBool p_createEntity); static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; } @@ -86,7 +87,6 @@ class LegoCharacterManager { LegoROI* CreateActorROI(const char* p_key); void RemoveROI(LegoROI* p_roi); LegoROI* FindChildROI(LegoROI* p_roi, const char* p_name); - MxResult FUN_10085870(LegoROI* p_roi); static char* g_customizeAnimFile; static MxU32 g_maxMove; diff --git a/LEGO1/lego/legoomni/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index f1eb0544..6f02774b 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -6,6 +6,7 @@ class LegoEntity; class LegoPathBoundary; +struct LegoPlantInfo; class LegoROI; class LegoStorage; class LegoWorld; @@ -36,8 +37,8 @@ class LegoPlantManager : public MxCore { MxBool SwitchSound(LegoEntity* p_entity); MxBool SwitchMove(LegoEntity* p_entity); MxBool SwitchMood(LegoEntity* p_entity); - MxU32 FUN_10026b70(LegoEntity* p_entity); - MxU32 FUN_10026ba0(LegoEntity* p_entity, MxBool); + MxU32 GetAnimationId(LegoEntity* p_entity); + MxU32 GetSoundId(LegoEntity* p_entity, MxBool p_state); void FUN_10026c50(LegoEntity* p_entity); void FUN_10027120(); @@ -51,8 +52,11 @@ class LegoPlantManager : public MxCore { LegoEntity* CreatePlant(MxS32 p_index, LegoWorld* p_world, MxS32 p_worldId); void RemovePlant(MxS32 p_index, MxS32 p_worldId); void FUN_10026860(MxS32 p_index); + LegoPlantInfo* GetInfo(LegoEntity* p_entity); static char* g_customizeAnimFile; + static MxS32 g_maxMove[4]; + static MxU32 g_maxSound; MxS32 m_worldId; // 0x08 undefined m_unk0x0c; // 0x0c diff --git a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp index 88b443b5..00cfa8dc 100644 --- a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp @@ -196,14 +196,14 @@ LegoBuildingInfo g_buildingInfoInit[16] = { MxU32 LegoBuildingManager::g_maxSound = 6; // GLOBAL: LEGO1 0x100f373c -MxU32 g_cycleLengthOffset1 = 0x3c; +MxU32 g_unk0x100f373c = 0x3c; // GLOBAL: LEGO1 0x100f3740 -MxU32 g_cycleLengthOffset3 = 0x42; +MxU32 g_unk0x100f3740 = 0x42; // clang-format off // GLOBAL: LEGO1 0x100f3788 -MxU32 g_buildingEntityId[16] = { +MxU32 g_buildingAnimationId[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x49, 0x4c, @@ -531,12 +531,12 @@ MxBool LegoBuildingManager::SwitchMood(LegoEntity* p_entity) // FUNCTION: LEGO1 0x1002ff00 // FUNCTION: BETA10 0x1006432d -MxU32 LegoBuildingManager::GetBuildingEntityId(LegoEntity* p_entity) +MxU32 LegoBuildingManager::GetAnimationId(LegoEntity* p_entity) { LegoBuildingInfo* info = GetInfo(p_entity); if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasMoves) { - return g_buildingEntityId[info - g_buildingInfo] + info->m_move; + return g_buildingAnimationId[info - g_buildingInfo] + info->m_move; } return 0; @@ -544,7 +544,7 @@ MxU32 LegoBuildingManager::GetBuildingEntityId(LegoEntity* p_entity) // FUNCTION: LEGO1 0x1002ff40 // FUNCTION: BETA10 0x10064398 -MxU32 LegoBuildingManager::FUN_1002ff40(LegoEntity* p_entity, MxBool p_state) +MxU32 LegoBuildingManager::GetSoundId(LegoEntity* p_entity, MxBool p_state) { LegoBuildingInfo* info = GetInfo(p_entity); @@ -553,11 +553,11 @@ MxU32 LegoBuildingManager::FUN_1002ff40(LegoEntity* p_entity, MxBool p_state) } if (p_state) { - return info->m_mood + g_cycleLengthOffset3; + return info->m_mood + g_unk0x100f3740; } if (info != NULL) { - return info->m_sound + g_cycleLengthOffset1; + return info->m_sound + g_unk0x100f373c; } return 0; diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index 826f471b..1ddf49e1 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -28,7 +28,7 @@ MxU32 LegoCharacterManager::g_maxMove = 4; MxU32 LegoCharacterManager::g_maxSound = 9; // GLOBAL: LEGO1 0x100fc4e0 -MxU32 g_unk0x100fc4e0 = 10; +MxU32 g_characterAnimationId = 10; // GLOBAL: LEGO1 0x100fc4e4 char* LegoCharacterManager::g_customizeAnimFile = NULL; @@ -884,19 +884,19 @@ MxBool LegoCharacterManager::SwitchMood(LegoROI* p_roi) // FUNCTION: LEGO1 0x10085120 // FUNCTION: BETA10 0x1007680c -MxU32 LegoCharacterManager::FUN_10085120(LegoROI* p_roi) +MxU32 LegoCharacterManager::GetAnimationId(LegoROI* p_roi) { LegoActorInfo* info = GetActorInfo(p_roi); if (info != NULL) { - return info->m_move + g_unk0x100fc4e0; + return info->m_move + g_characterAnimationId; } return 0; } // FUNCTION: LEGO1 0x10085140 -MxU32 LegoCharacterManager::FUN_10085140(LegoROI* p_roi, MxBool p_und) +MxU32 LegoCharacterManager::GetSoundId(LegoROI* p_roi, MxBool p_und) { LegoActorInfo* info = GetActorInfo(p_roi); diff --git a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp index 09739ae6..723a3981 100644 --- a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp @@ -1,13 +1,16 @@ #include "legoplantmanager.h" +#include "3dmanager/lego3dmanager.h" #include "legocharactermanager.h" #include "legoentity.h" #include "legoplants.h" +#include "legovideomanager.h" #include "legoworld.h" #include "misc.h" #include "misc/legostorage.h" #include "scripts.h" #include "sndanim_actions.h" +#include "viewmanager/viewmanager.h" #include @@ -27,6 +30,21 @@ float g_unk0x100f16b0[] = {0.1f, 0.7f, 0.5f, 0.9f}; // GLOBAL: LEGO1 0x100f16c0 MxU8 g_unk0x100f16c0[] = {1, 2, 2, 3}; +// GLOBAL: LEGO1 0x100f315c +MxU32 LegoPlantManager::g_maxSound = 8; + +// GLOBAL: LEGO1 0x100f3160 +MxU32 g_unk0x100f3160 = 56; + +// GLOBAL: LEGO1 0x100f3164 +MxU32 g_unk0x100f3164 = 66; + +// GLOBAL: LEGO1 0x100f3168 +MxS32 LegoPlantManager::g_maxMove[4] = {3, 3, 3, 3}; + +// GLOBAL: LEGO1 0x100f3178 +MxU32 g_plantAnimationId[4] = {30, 33, 36, 39}; + // GLOBAL: LEGO1 0x100f3188 char* LegoPlantManager::g_customizeAnimFile = NULL; @@ -233,52 +251,175 @@ void LegoPlantManager::FUN_10026860(MxS32 p_index) } } -// STUB: LEGO1 0x10026920 +// FUNCTION: LEGO1 0x100268e0 +// FUNCTION: BETA10 0x100c5c95 +LegoPlantInfo* LegoPlantManager::GetInfo(LegoEntity* p_entity) +{ + MxS32 i; + + for (i = 0; i < sizeOfArray(g_plantInfo); i++) { + if (g_plantInfo[i].m_entity == p_entity) { + break; + } + } + + if (i < sizeOfArray(g_plantInfo)) { + return &g_plantInfo[i]; + } + + return NULL; +} + +// FUNCTION: LEGO1 0x10026920 +// FUNCTION: BETA10 0x100c5dc9 MxBool LegoPlantManager::SwitchColor(LegoEntity* p_entity) { - // TODO - return FALSE; + LegoPlantInfo* info = GetInfo(p_entity); + + if (info == NULL) { + return FALSE; + } + + LegoROI* roi = p_entity->GetROI(); + info->m_color++; + + if (info->m_color > LegoPlantInfo::e_green) { + info->m_color = LegoPlantInfo::e_white; + } + + ViewLODList* lodList = GetViewLODListManager()->Lookup(g_plantLodNames[info->m_variant][info->m_color]); + + if (roi->GetUnknown0xe0() >= 0) { + VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->RemoveROIDetailFromScene(roi); + } + + roi->SetLODList(lodList); + lodList->Release(); + CharacterManager()->FUN_10085870(roi); + return TRUE; } -// STUB: LEGO1 0x100269e0 +// FUNCTION: LEGO1 0x100269e0 +// FUNCTION: BETA10 0x100c5ee2 MxBool LegoPlantManager::SwitchVariant(LegoEntity* p_entity) { - // TODO - return FALSE; + LegoPlantInfo* info = GetInfo(p_entity); + + if (info == NULL || info->m_unk0x16 != -1) { + return FALSE; + } + + LegoROI* roi = p_entity->GetROI(); + info->m_variant++; + + if (info->m_variant > LegoPlantInfo::e_palm) { + info->m_variant = LegoPlantInfo::e_flower; + } + + ViewLODList* lodList = GetViewLODListManager()->Lookup(g_plantLodNames[info->m_variant][info->m_color]); + + if (roi->GetUnknown0xe0() >= 0) { + VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->RemoveROIDetailFromScene(roi); + } + + roi->SetLODList(lodList); + lodList->Release(); + CharacterManager()->FUN_10085870(roi); + + if (info->m_move != 0 && info->m_move >= g_maxMove[info->m_variant]) { + info->m_move = g_maxMove[info->m_variant] - 1; + } + + return TRUE; } -// STUB: LEGO1 0x10026ad0 +// FUNCTION: LEGO1 0x10026ad0 +// FUNCTION: BETA10 0x100c6049 MxBool LegoPlantManager::SwitchSound(LegoEntity* p_entity) { - // TODO - return FALSE; + MxBool result = FALSE; + LegoPlantInfo* info = GetInfo(p_entity); + + if (info != NULL) { + info->m_sound++; + + if (info->m_sound >= g_maxSound) { + info->m_sound = 0; + } + + result = TRUE; + } + + return result; } -// STUB: LEGO1 0x10026b00 +// FUNCTION: LEGO1 0x10026b00 +// FUNCTION: BETA10 0x100c60a7 MxBool LegoPlantManager::SwitchMove(LegoEntity* p_entity) { - // TODO - return FALSE; + MxBool result = FALSE; + LegoPlantInfo* info = GetInfo(p_entity); + + if (info != NULL) { + info->m_move++; + + if (info->m_move >= g_maxMove[info->m_variant]) { + info->m_move = 0; + } + + result = TRUE; + } + + return result; } -// STUB: LEGO1 0x10026b40 +// FUNCTION: LEGO1 0x10026b40 +// FUNCTION: BETA10 0x100c610e MxBool LegoPlantManager::SwitchMood(LegoEntity* p_entity) { - // TODO - return FALSE; + MxBool result = FALSE; + LegoPlantInfo* info = GetInfo(p_entity); + + if (info != NULL) { + info->m_mood++; + + if (info->m_mood > 3) { + info->m_mood = 0; + } + + result = TRUE; + } + + return result; } -// STUB: LEGO1 0x10026b70 -MxU32 LegoPlantManager::FUN_10026b70(LegoEntity* p_entity) +// FUNCTION: LEGO1 0x10026b70 +// FUNCTION: BETA10 0x100c6168 +MxU32 LegoPlantManager::GetAnimationId(LegoEntity* p_entity) { - // TODO + LegoPlantInfo* info = GetInfo(p_entity); + + if (info != NULL) { + return g_plantAnimationId[info->m_variant] + info->m_move; + } + return 0; } -// STUB: LEGO1 0x10026ba0 -MxU32 LegoPlantManager::FUN_10026ba0(LegoEntity* p_entity, MxBool) +// FUNCTION: LEGO1 0x10026ba0 +// FUNCTION: BETA10 0x100c61ba +MxU32 LegoPlantManager::GetSoundId(LegoEntity* p_entity, MxBool p_state) { - // TODO + LegoPlantInfo* info = GetInfo(p_entity); + + if (p_state) { + return (info->m_mood & 1) + g_unk0x100f3164; + } + + if (info != NULL) { + return info->m_sound + g_unk0x100f3160; + } + return 0; } diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index cca706a7..f18c689e 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -256,15 +256,15 @@ void LegoEntity::ClickSound(MxBool p_und) switch (m_type) { case e_actor: - objectId = CharacterManager()->FUN_10085140(m_roi, p_und); + objectId = CharacterManager()->GetSoundId(m_roi, p_und); break; case e_unk1: break; case e_plant: - objectId = PlantManager()->FUN_10026ba0(this, p_und); + objectId = PlantManager()->GetSoundId(this, p_und); break; case e_building: - objectId = BuildingManager()->FUN_1002ff40(this, p_und); + objectId = BuildingManager()->GetSoundId(this, p_und); break; } @@ -290,19 +290,19 @@ void LegoEntity::ClickAnimation() switch (m_type) { case e_actor: - objectId = LegoOmni::GetInstance()->GetCharacterManager()->FUN_10085120(m_roi); + objectId = LegoOmni::GetInstance()->GetCharacterManager()->GetAnimationId(m_roi); action.SetAtomId(MxAtomId(LegoCharacterManager::GetCustomizeAnimFile(), e_lowerCase2)); sprintf(extra, "SUBST:actor_01:%s", name); break; case e_unk1: break; case e_plant: - objectId = LegoOmni::GetInstance()->GetPlantManager()->FUN_10026b70(this); + objectId = LegoOmni::GetInstance()->GetPlantManager()->GetAnimationId(this); action.SetAtomId(MxAtomId(LegoPlantManager::GetCustomizeAnimFile(), e_lowerCase2)); sprintf(extra, "SUBST:bush:%s:tree:%s:flwrred:%s:palm:%s", name, name, name, name); break; case e_building: - objectId = LegoOmni::GetInstance()->GetBuildingManager()->GetBuildingEntityId(this); + objectId = LegoOmni::GetInstance()->GetBuildingManager()->GetAnimationId(this); action.SetAtomId(MxAtomId(BuildingManager()->GetCustomizeAnimFile(), e_lowerCase2)); sprintf(extra, "SUBST:haus1:%s", name); break; From c9c130eb872580b153c9d20f5c3135f62c9b68a8 Mon Sep 17 00:00:00 2001 From: jonschz <17198703+jonschz@users.noreply.github.com> Date: Fri, 21 Jun 2024 20:41:01 +0200 Subject: [PATCH 7/9] Implement AnimState (#1042) * Implement LegoAnim * fix: minor issues * fix ncc complaints * refactor: address review comments --------- Co-authored-by: jonschz --- .../legoomni/include/legoanimationmanager.h | 21 ++-- .../lego/legoomni/include/legonavcontroller.h | 1 + .../src/common/legoanimationmanager.cpp | 115 +++++++++++++----- .../legoomni/src/entity/legonavcontroller.cpp | 6 + 4 files changed, 102 insertions(+), 41 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 5038ac47..0a658254 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -71,22 +71,23 @@ class AnimState : public LegoState { 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); + void CopyToAnims(MxU32, AnimInfo* p_anims, MxU32& p_outExtraCharacterId); + void InitFromAnims(MxU32 p_animsLength, AnimInfo* p_anims, MxU32 p_extraCharacterId); // SYNTHETIC: LEGO1 0x10065130 // AnimState::`scalar deleting destructor' private: - undefined4 m_unk0x08; // 0x08 + MxU32 m_extraCharacterId; // 0x08 + // appears to store the length of m_unk0x10 - undefined4 m_unk0x0c; // 0x0c - // dynamically sized array of two-byte elements - undefined2* m_unk0x10; // 0x10 - // appears to store the length of m_unk0x18 - undefined4 m_unk0x14; // 0x14 - // dynamically sized array of one-byte elements - undefined* m_unk0x18; // 0x18 + MxU32 m_unk0x0c; // 0x0c + // dynamically sized array of MxU16, corresponding to AnimInfo::m_unk0x22 + MxU16* m_unk0x10; // 0x10 + + MxU32 m_locationsFlagsLength; // 0x14 + // dynamically sized array of bools, corresponding to LegoLocation.m_unk0x5c + MxBool* m_locationsFlags; // 0x18 }; // VTABLE: LEGO1 0x100d8c18 diff --git a/LEGO1/lego/legoomni/include/legonavcontroller.h b/LEGO1/lego/legoomni/include/legonavcontroller.h index 3e310dde..fb95762b 100644 --- a/LEGO1/lego/legoomni/include/legonavcontroller.h +++ b/LEGO1/lego/legoomni/include/legonavcontroller.h @@ -74,6 +74,7 @@ class LegoNavController : public MxCore { ); static MxResult UpdateLocation(MxU32 p_location); static MxResult UpdateLocation(const char* p_location); + static MxS32 GetNumLocations(); static LegoLocation* GetLocation(MxU32 p_location); inline void SetLinearVel(MxFloat p_linearVel) { m_linearVel = p_linearVel; } diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index ab48daef..f5abb3c8 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -416,7 +416,7 @@ void LegoAnimationManager::Suspend() } if (m_worldId == 0) { - m_animState->FUN_10065240(m_animCount, m_anims, m_lastExtraCharacterId); + m_animState->InitFromAnims(m_animCount, m_anims, m_lastExtraCharacterId); } if (!m_suspended) { @@ -615,7 +615,7 @@ MxResult LegoAnimationManager::LoadWorldInfo(MxS32 p_worldId) } if (m_worldId == 0) { - m_animState->FUN_10065240(m_animCount, m_anims, m_lastExtraCharacterId); + m_animState->InitFromAnims(m_animCount, m_anims, m_lastExtraCharacterId); } DeleteAnimations(); @@ -727,7 +727,7 @@ MxResult LegoAnimationManager::LoadWorldInfo(MxS32 p_worldId) } if (p_worldId == 0) { - m_animState->FUN_100651d0(m_animCount, m_anims, m_lastExtraCharacterId); + m_animState->CopyToAnims(m_animCount, m_anims, m_lastExtraCharacterId); } } @@ -2828,26 +2828,59 @@ AnimState::AnimState() { m_unk0x0c = 0; m_unk0x10 = NULL; - m_unk0x14 = 0; - m_unk0x18 = NULL; + m_locationsFlagsLength = 0; + m_locationsFlags = NULL; } -// STUB: LEGO1 0x10065150 +// FUNCTION: LEGO1 0x10065150 AnimState::~AnimState() { - // TODO + delete[] m_unk0x10; + delete[] m_locationsFlags; } -// STUB: LEGO1 0x100651d0 -void AnimState::FUN_100651d0(MxU32, AnimInfo*, MxU32&) +// FUNCTION: LEGO1 0x100651d0 +void AnimState::CopyToAnims(MxU32, AnimInfo* p_anims, MxU32& p_outExtraCharacterId) { - // TODO + if (m_unk0x10 != NULL) { + for (MxS32 i = 0; i < m_unk0x0c; i++) { + p_anims[i].m_unk0x22 = m_unk0x10[i]; + } + + p_outExtraCharacterId = m_extraCharacterId; + + for (MxS32 j = 0; j < m_locationsFlagsLength; j++) { + LegoLocation* location = LegoNavController::GetLocation(j); + if (location != NULL) { + location->m_unk0x5c = m_locationsFlags[j]; + } + } + } } -// STUB: LEGO1 0x10065240 -void AnimState::FUN_10065240(MxU32, AnimInfo*, MxU32) +// FUNCTION: LEGO1 0x10065240 +void AnimState::InitFromAnims(MxU32 p_animsLength, AnimInfo* p_anims, MxU32 p_extraCharacterId) { - // TODO + if (m_unk0x10 == NULL) { + m_unk0x0c = p_animsLength; + m_unk0x10 = new MxU16[p_animsLength]; + MxS32 numLocations = LegoNavController::GetNumLocations(); + m_locationsFlagsLength = numLocations; + m_locationsFlags = new MxBool[numLocations]; + } + + m_extraCharacterId = p_extraCharacterId; + + for (MxS32 i = 0; i < m_unk0x0c; i++) { + m_unk0x10[i] = p_anims[i].m_unk0x22; + } + + for (MxS32 j = 0; j < m_locationsFlagsLength; j++) { + LegoLocation* location = LegoNavController::GetLocation(j); + if (location != NULL) { + m_locationsFlags[j] = location->m_unk0x5c; + } + } } // FUNCTION: LEGO1 0x100652d0 @@ -2864,57 +2897,77 @@ MxResult AnimState::Serialize(LegoFile* p_file) } if (p_file->IsReadMode()) { - Read(p_file, &m_unk0x08); + Read(p_file, &m_extraCharacterId); - // 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]; + m_unk0x10 = new MxU16[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; + Read(p_file, &m_locationsFlagsLength); + + if (m_locationsFlags) { + delete[] m_locationsFlags; } - if (m_unk0x14 != 0) { - m_unk0x18 = new undefined[m_unk0x14]; + + if (m_locationsFlagsLength != 0) { + m_locationsFlags = new MxBool[m_locationsFlagsLength]; } else { - m_unk0x18 = NULL; + m_locationsFlags = NULL; } - for (MxS32 j = 0; j < m_unk0x14; j++) { - Read(p_file, &m_unk0x18[j]); + + for (MxS32 j = 0; j < m_locationsFlagsLength; j++) { + Read(p_file, &m_locationsFlags[j]); } } else if (p_file->IsWriteMode()) { - Write(p_file, m_unk0x08); + Write(p_file, m_extraCharacterId); + 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]); + + Write(p_file, m_locationsFlagsLength); + for (MxS32 j = 0; j < m_locationsFlagsLength; j++) { + Write(p_file, m_locationsFlags[j]); } } return SUCCESS; } -// STUB: LEGO1 0x100654f0 +// FUNCTION: LEGO1 0x100654f0 MxBool AnimState::SetFlag() { - // TODO + if (m_unk0x10 != NULL) { + m_extraCharacterId = NULL; + + for (MxS32 i = 0; i < m_unk0x0c; i++) { + m_unk0x10[i] = 0; + } + + for (MxS32 j = 0; j < m_locationsFlagsLength; j++) { + if (LegoNavController::GetLocation(j) != NULL) { + m_locationsFlags[j] = 0; + } + } + + return TRUE; + } + return FALSE; } diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index 69b9133d..01facf17 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -482,6 +482,12 @@ LegoLocation* LegoNavController::GetLocation(MxU32 p_location) return NULL; } +// FUNCTION: LEGO1 0x10055740 +MxS32 LegoNavController::GetNumLocations() +{ + return sizeOfArray(g_locations); +} + // FUNCTION: LEGO1 0x10055750 MxResult LegoNavController::ProcessJoystickInput(MxBool& p_und) { From 62307e1819ce885cabbbefbab29c3b25d1b50cac Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 25 Jun 2024 08:28:10 -0700 Subject: [PATCH 8/9] Implement/match LegoPlantManager::FUN_10026c50 (#1043) * Minor fixes * Implement/match LegoPlantManager::FUN_10026c50 --- .../legoomni/include/legobuildingmanager.h | 4 +- .../lego/legoomni/include/legoplantmanager.h | 3 +- LEGO1/lego/legoomni/include/legoplants.h | 2 +- .../src/common/legobuildingmanager.cpp | 2 +- .../legoomni/src/common/legoplantmanager.cpp | 57 ++++++++++++++++++- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 2 +- .../src/entity/legoworldpresenter.cpp | 2 +- .../legoomni/src/worlds/elevatorbottom.cpp | 2 +- .../legoomni/src/worlds/infocenterdoor.cpp | 4 +- 9 files changed, 65 insertions(+), 13 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legobuildingmanager.h b/LEGO1/lego/legoomni/include/legobuildingmanager.h index 782dccb9..8c9c8cec 100644 --- a/LEGO1/lego/legoomni/include/legobuildingmanager.h +++ b/LEGO1/lego/legoomni/include/legobuildingmanager.h @@ -66,7 +66,7 @@ class LegoBuildingManager : public MxCore { static void SetCustomizeAnimFile(const char* p_value); void Init(); - void FUN_1002fa00(); + void LoadWorldInfo(); void CreateBuilding(MxS32 p_index, LegoWorld* p_world); void Reset(); MxResult Write(LegoStorage* p_storage); @@ -77,7 +77,7 @@ class LegoBuildingManager : public MxCore { MxBool SwitchMove(LegoEntity* p_entity); MxBool SwitchMood(LegoEntity* p_entity); MxU32 GetAnimationId(LegoEntity* p_entity); - MxU32 GetSoundId(LegoEntity* p_entity, MxBool); + MxU32 GetSoundId(LegoEntity* p_entity, MxBool p_state); MxBool FUN_10030000(LegoEntity* p_entity); MxBool FUN_10030030(MxS32 p_index); MxBool FUN_10030110(LegoBuildingInfo* p_data); diff --git a/LEGO1/lego/legoomni/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index 6f02774b..48f69521 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -39,7 +39,7 @@ class LegoPlantManager : public MxCore { MxBool SwitchMood(LegoEntity* p_entity); MxU32 GetAnimationId(LegoEntity* p_entity); MxU32 GetSoundId(LegoEntity* p_entity, MxBool p_state); - void FUN_10026c50(LegoEntity* p_entity); + MxBool FUN_10026c50(LegoEntity* p_entity); void FUN_10027120(); static void SetCustomizeAnimFile(const char* p_value); @@ -53,6 +53,7 @@ class LegoPlantManager : public MxCore { void RemovePlant(MxS32 p_index, MxS32 p_worldId); void FUN_10026860(MxS32 p_index); LegoPlantInfo* GetInfo(LegoEntity* p_entity); + MxBool FUN_10026c80(MxS32 p_index); static char* g_customizeAnimFile; static MxS32 g_maxMove[4]; diff --git a/LEGO1/lego/legoomni/include/legoplants.h b/LEGO1/lego/legoomni/include/legoplants.h index ee1ea49b..1b26b0e8 100644 --- a/LEGO1/lego/legoomni/include/legoplants.h +++ b/LEGO1/lego/legoomni/include/legoplants.h @@ -10,7 +10,7 @@ class LegoPathBoundary; // SIZE 0x54 struct LegoPlantInfo { // See LegoOmni::RegisterWorlds for IDs - enum Worlds { + enum World { c_act1 = 1 << 0, c_imain = 1 << 1, c_ielev = 1 << 4, diff --git a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp index 00cfa8dc..b69a3f52 100644 --- a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp @@ -257,7 +257,7 @@ void LegoBuildingManager::Init() // FUNCTION: LEGO1 0x1002fa00 // FUNCTION: BETA10 0x10063ad1 -void LegoBuildingManager::FUN_1002fa00() +void LegoBuildingManager::LoadWorldInfo() { MxS32 i; LegoWorld* world = CurrentWorld(); diff --git a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp index 723a3981..18d26315 100644 --- a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp @@ -424,6 +424,7 @@ MxU32 LegoPlantManager::GetSoundId(LegoEntity* p_entity, MxBool p_state) } // FUNCTION: LEGO1 0x10026be0 +// FUNCTION: BETA10 0x100c62bc void LegoPlantManager::SetCustomizeAnimFile(const char* p_value) { if (g_customizeAnimFile != NULL) { @@ -442,10 +443,60 @@ void LegoPlantManager::SetCustomizeAnimFile(const char* p_value) } } -// STUB: LEGO1 0x10026c50 -void LegoPlantManager::FUN_10026c50(LegoEntity* p_entity) +// FUNCTION: LEGO1 0x10026c50 +// FUNCTION: BETA10 0x100c6349 +MxBool LegoPlantManager::FUN_10026c50(LegoEntity* p_entity) { - // TODO + LegoPlantInfo* info = GetInfo(p_entity); + + if (info == NULL) { + return FALSE; + } + + return FUN_10026c80(info - g_plantInfo); +} + +// FUNCTION: LEGO1 0x10026c80 +// FUNCTION: BETA10 0x100c63eb +MxBool LegoPlantManager::FUN_10026c80(MxS32 p_index) +{ + if (p_index >= sizeOfArray(g_plantInfo)) { + return FALSE; + } + + LegoPlantInfo* info = &g_plantInfo[p_index]; + + if (info == NULL) { + return FALSE; + } + + MxBool result = TRUE; + + if (info->m_unk0x16 < 0) { + info->m_unk0x16 = g_unk0x100f16c0[info->m_variant]; + } + + if (info->m_unk0x16 > 0) { + LegoROI* roi = info->m_entity->GetROI(); + info->m_unk0x16--; + + if (info->m_unk0x16 == 1) { + info->m_unk0x16 = 0; + } + + if (info->m_unk0x16 == 0) { + roi->SetVisibility(FALSE); + } + else { + FUN_10026860(info - g_plantInfo); + info->m_entity->SetLocation(info->m_position, info->m_direction, info->m_up, FALSE); + } + } + else { + result = FALSE; + } + + return result; } // STUB: LEGO1 0x10026e00 diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index de9c3c63..b7fd9aab 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -694,7 +694,7 @@ void LegoWorld::Enable(MxBool p_enable) if (m_worldId != -1) { PlantManager()->LoadWorldInfo(m_worldId); AnimationManager()->LoadWorldInfo(m_worldId); - BuildingManager()->FUN_1002fa00(); + BuildingManager()->LoadWorldInfo(); AnimationManager()->Resume(); } diff --git a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp index 37488092..070f05e6 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp @@ -57,7 +57,7 @@ LegoWorldPresenter::~LegoWorldPresenter() MxS32 worldId = ((LegoWorld*) m_entity)->GetWorldId(); PlantManager()->LoadWorldInfo(worldId); AnimationManager()->LoadWorldInfo(worldId); - BuildingManager()->FUN_1002fa00(); + BuildingManager()->LoadWorldInfo(); result = ((LegoWorld*) m_entity)->VTable0x5c(); } diff --git a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp index 768f5333..30a33b03 100644 --- a/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp +++ b/LEGO1/lego/legoomni/src/worlds/elevatorbottom.cpp @@ -135,7 +135,7 @@ void ElevatorBottom::Enable(MxBool p_enable) // FUNCTION: LEGO1 0x10018310 MxBool ElevatorBottom::Escape() { - DeleteObjects(&m_atom, 500, 999); + DeleteObjects(&m_atom, ElevbottScript::c_iica31in_PlayWav, 999); m_destLocation = LegoGameState::e_infomain; return TRUE; } diff --git a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp index 0673de11..f2812ecf 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp @@ -95,7 +95,7 @@ MxLong InfocenterDoor::HandleControl(LegoControlManagerNotificationParam& p_para MxLong result = 0; if (p_param.GetUnknown0x28() == 1) { - DeleteObjects(&m_atom, 500, 510); + DeleteObjects(&m_atom, InfodoorScript::c_iic037in_PlayWav, 510); switch (p_param.GetClickedObjectId()) { case InfodoorScript::c_LeftArrow_Ctl: @@ -167,7 +167,7 @@ void InfocenterDoor::Enable(MxBool p_enable) // FUNCTION: LEGO1 0x10037cd0 MxBool InfocenterDoor::Escape() { - DeleteObjects(&m_atom, 500, 510); + DeleteObjects(&m_atom, InfodoorScript::c_iic037in_PlayWav, 510); m_destLocation = LegoGameState::e_infomain; return TRUE; } From 8113a17167e92133f5a0793967bf1e485dafd07a Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Tue, 25 Jun 2024 17:56:30 +0200 Subject: [PATCH 9/9] Backports of isle-portable x64 fixes (#1044) * Introduce LPD3DRM_APPDATA typedef for setting d3drm appdata * Fix warning about assigning const string literals to variable char pointers * Don't cast pointers to integers on non-32-bit architectures * memset 2nd argument is int * Assume cpuid is available on x86_64, needs testing on i386 and unavailable on anything else * Store HFILE in its own member variable --- CMakeLists.txt | 1 + .../legoomni/include/legoanimationmanager.h | 8 +- .../lego/legoomni/include/legopathboundary.h | 10 ++- .../legoomni/include/legopathcontroller.h | 8 +- LEGO1/lego/legoomni/include/legoworld.h | 11 ++- .../lego/legoomni/src/worlds/historybook.cpp | 6 +- LEGO1/mxdirectx/mxdirect3d.cpp | 12 +++ LEGO1/omni/include/mxio.h | 7 ++ LEGO1/omni/src/stream/mxio.cpp | 87 +++++++++++-------- LEGO1/tgl/d3drm/impl.h | 6 ++ LEGO1/tgl/d3drm/texture.cpp | 6 +- LEGO1/tgl/d3drm/view.cpp | 2 +- LEGO1/viewmanager/viewmanager.cpp | 8 +- 13 files changed, 115 insertions(+), 57 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ba7af5ee..8661dabf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -430,6 +430,7 @@ if (ISLE_USE_SMARTHEAP) endif() foreach(tgt IN LISTS lego1_targets) target_link_libraries(${tgt} PRIVATE $<$:DirectX5::DirectX5>) + target_compile_definitions(${tgt} PRIVATE $<$:DIRECTX5_SDK>) endforeach() # Make sure filenames are ALL CAPS diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index 0a658254..c2c8dda8 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -96,7 +96,7 @@ class LegoAnimationManager : public MxCore { public: // SIZE 0x18 struct Character { - char* m_name; // 0x00 + const char* m_name; // 0x00 MxBool m_inExtras; // 0x04 MxS8 m_vehicleId; // 0x05 undefined m_unk0x06; // 0x06 (unused?) @@ -112,9 +112,9 @@ class LegoAnimationManager : public MxCore { // SIZE 0x08 struct Vehicle { - char* m_name; // 0x00 - MxBool m_unk0x04; // 0x04 - MxBool m_unk0x05; // 0x05 + const char* m_name; // 0x00 + MxBool m_unk0x04; // 0x04 + MxBool m_unk0x05; // 0x05 }; // SIZE 0x18 diff --git a/LEGO1/lego/legoomni/include/legopathboundary.h b/LEGO1/lego/legoomni/include/legopathboundary.h index 570b2ea2..4f8d2e24 100644 --- a/LEGO1/lego/legoomni/include/legopathboundary.h +++ b/LEGO1/lego/legoomni/include/legopathboundary.h @@ -7,17 +7,23 @@ #include "mxstl/stlcompat.h" #include "mxtypes.h" +#if defined(_M_IX86) || defined(__i386__) +#define COMPARE_POINTER_TYPE MxS32 +#else +#define COMPARE_POINTER_TYPE MxS32* +#endif + struct LegoPathActorSetCompare { MxU32 operator()(const LegoPathActor* p_lhs, const LegoPathActor* p_rhs) const { - return (MxS32) p_lhs < (MxS32) p_rhs; + return (COMPARE_POINTER_TYPE) p_lhs < (COMPARE_POINTER_TYPE) p_rhs; } }; struct LegoAnimPresenterSetCompare { MxBool operator()(const LegoAnimPresenter* p_lhs, const LegoAnimPresenter* p_rhs) const { - return (MxS32) p_lhs < (MxS32) p_rhs; + return (COMPARE_POINTER_TYPE) p_lhs < (COMPARE_POINTER_TYPE) p_rhs; } }; diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 7bb38b61..7ee0228e 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -14,6 +14,12 @@ class LegoWorld; class MxAtomId; class Vector3; +#if defined(_M_IX86) || defined(__i386__) +#define COMPARE_POINTER_TYPE MxS32 +#else +#define COMPARE_POINTER_TYPE MxS32* +#endif + // VTABLE: LEGO1 0x100d7da8 // SIZE 0x40 struct LegoPathCtrlEdge : public LegoUnknown100db7f4 {}; @@ -21,7 +27,7 @@ struct LegoPathCtrlEdge : public LegoUnknown100db7f4 {}; struct LegoPathCtrlEdgeCompare { MxU32 operator()(const LegoPathCtrlEdge* p_lhs, const LegoPathCtrlEdge* p_rhs) const { - return (MxS32) p_lhs < (MxS32) p_rhs; + return (COMPARE_POINTER_TYPE) p_lhs < (COMPARE_POINTER_TYPE) p_rhs; } }; diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index 0ae00795..4faedb90 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -12,8 +12,17 @@ class LegoEntityList; class LegoPathBoundary; class LegoHideAnimPresenter; +#if defined(_M_IX86) || defined(__i386__) +#define COMPARE_POINTER_TYPE MxS32 +#else +#define COMPARE_POINTER_TYPE MxS32* +#endif + struct CoreSetCompare { - MxS32 operator()(MxCore* const& p_a, MxCore* const& p_b) const { return (MxS32) p_a < (MxS32) p_b; } + MxS32 operator()(MxCore* const& p_a, MxCore* const& p_b) const + { + return (COMPARE_POINTER_TYPE) p_a < (COMPARE_POINTER_TYPE) p_b; + } }; typedef set MxCoreSet; diff --git a/LEGO1/lego/legoomni/src/worlds/historybook.cpp b/LEGO1/lego/legoomni/src/worlds/historybook.cpp index bf01d00a..f2f8068c 100644 --- a/LEGO1/lego/legoomni/src/worlds/historybook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/historybook.cpp @@ -15,9 +15,9 @@ DECOMP_SIZE_ASSERT(HistoryBook, 0x3e4) // FUNCTION: LEGO1 0x100822f0 HistoryBook::HistoryBook() { - memset(m_alphabet, NULL, sizeof(m_alphabet)); - memset(m_names, NULL, sizeof(m_names)); - memset(m_scores, NULL, sizeof(m_scores)); + memset(m_alphabet, 0, sizeof(m_alphabet)); + memset(m_names, 0, sizeof(m_names)); + memset(m_scores, 0, sizeof(m_scores)); NotificationManager()->Register(this); } diff --git a/LEGO1/mxdirectx/mxdirect3d.cpp b/LEGO1/mxdirectx/mxdirect3d.cpp index ccfd6405..8e4a94e8 100644 --- a/LEGO1/mxdirectx/mxdirect3d.cpp +++ b/LEGO1/mxdirectx/mxdirect3d.cpp @@ -1054,6 +1054,7 @@ int MxDeviceEnumerate::SupportsCPUID() { int has_cpuid; #ifdef _MSC_VER +#if defined(_M_IX86) __asm { xor eax, eax ; Zero EAX register pushfd ; Push EFLAGS register value on the stack @@ -1065,7 +1066,13 @@ int MxDeviceEnumerate::SupportsCPUID() popfd ; Push EFLAGS register value on the stack (again, and makes sure the stack remains the same) mov has_cpuid, eax ; Save eax into C variable } +#elif defined(_M_X64) + has_cpuid = 1; #else + has_cpuid = 0; +#endif +#else +#if defined(__i386__) __asm__("xorl %%eax, %%eax\n\t" // Zero EAX register "pushfl\n\t" // Push EFLAGS register value on the stack "orl $0x200000, (%%esp)\n\t" // Set bit 0x200000: Able to use CPUID instruction (Pentium+) @@ -1076,6 +1083,11 @@ int MxDeviceEnumerate::SupportsCPUID() "popfl" // Push EFLAGS register value on the stack (again, and makes sure the stack remains the same) : "=a"(has_cpuid) // has_cpuid == EAX ); +#elif defined(__x86_64__) || defined(__amd64__) + has_cpuid = 1; +#else + has_cpuid = 0; +#endif #endif return has_cpuid; } diff --git a/LEGO1/omni/include/mxio.h b/LEGO1/omni/include/mxio.h index 86ef5581..64461d6a 100644 --- a/LEGO1/omni/include/mxio.h +++ b/LEGO1/omni/include/mxio.h @@ -9,6 +9,10 @@ #include // clang-format on +#if defined(_M_IX86) || defined(__i386__) +#define MXIO_MINFO_MFILE +#endif + // SIZE 0x48 class MXIOINFO { public: @@ -29,6 +33,9 @@ class MXIOINFO { // NOTE: In MXIOINFO, the `hmmio` member of MMIOINFO is used like // an HFILE (int) instead of an HMMIO (WORD). MMIOINFO m_info; +#ifndef MXIO_MINFO_MFILE + HFILE m_file; +#endif }; #endif // MXIO_H diff --git a/LEGO1/omni/src/stream/mxio.cpp b/LEGO1/omni/src/stream/mxio.cpp index 518b60f9..3b7c9b6d 100644 --- a/LEGO1/omni/src/stream/mxio.cpp +++ b/LEGO1/omni/src/stream/mxio.cpp @@ -9,6 +9,16 @@ // but this assert will enforce the size if we decide to change that. DECOMP_SIZE_ASSERT(MXIOINFO, sizeof(MMIOINFO)); +#ifdef MXIO_MINFO_MFILE +#define ASSIGN_M_FILE(X) m_info.hmmio = (HMMIO) (X) +#define M_FILE (HFILE)(m_info.hmmio) +#define RAW_M_FILE m_info.hmmio +#else +#define ASSIGN_M_FILE(X) m_file = (X) +#define M_FILE (m_file) +#define RAW_M_FILE m_file +#endif + // FUNCTION: LEGO1 0x100cc800 // FUNCTION: BETA10 0x1015e140 MXIOINFO::MXIOINFO() @@ -33,9 +43,10 @@ MxU16 MXIOINFO::Open(const char* p_filename, MxULong p_flags) m_info.lDiskOffset = m_info.lBufOffset = 0; // DECOMP: Cast of p_flags to u16 forces the `movzx` instruction - m_info.hmmio = (HMMIO) OpenFile(p_filename, &unused, (MxU16) p_flags); + // original: m_info.hmmio = OpenFile(p_filename, &unused, (MxU16) p_flags); + ASSIGN_M_FILE(OpenFile(p_filename, &unused, (MxU16) p_flags)); - if ((HFILE) m_info.hmmio != HFILE_ERROR) { + if (M_FILE != HFILE_ERROR) { m_info.dwFlags = p_flags; if (m_info.dwFlags & MMIO_ALLOCBUF) { @@ -75,10 +86,10 @@ MxU16 MXIOINFO::Close(MxLong p_unused) { MxU16 result = 0; - if (m_info.hmmio) { + if (RAW_M_FILE) { result = Flush(0); - _lclose((HFILE) m_info.hmmio); - m_info.hmmio = 0; + _lclose(M_FILE); + ASSIGN_M_FILE(0); if (m_info.dwFlags & MMIO_ALLOCBUF) { delete[] m_info.pchBuffer; @@ -127,12 +138,12 @@ MxLong MXIOINFO::Read(void* p_buf, MxLong p_len) } } } - else if (m_info.hmmio && p_len > 0) { - bytesRead = _hread((HFILE) m_info.hmmio, p_buf, p_len); + else if (RAW_M_FILE && p_len > 0) { + bytesRead = _hread(M_FILE, p_buf, p_len); if (bytesRead == -1) { bytesRead = 0; - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); + m_info.lDiskOffset = _llseek(M_FILE, 0, SEEK_CUR); } else { m_info.lDiskOffset += bytesRead; @@ -180,12 +191,12 @@ MxLong MXIOINFO::Write(void* p_buf, MxLong p_len) } } } - else if (m_info.hmmio && p_len > 0) { - bytesWritten = _hwrite((HFILE) m_info.hmmio, (const char*) p_buf, p_len); + else if (RAW_M_FILE && p_len > 0) { + bytesWritten = _hwrite(M_FILE, (const char*) p_buf, p_len); if (bytesWritten == -1) { bytesWritten = 0; - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); + m_info.lDiskOffset = _llseek(M_FILE, 0, SEEK_CUR); } else { m_info.lDiskOffset += bytesWritten; @@ -234,11 +245,11 @@ MxLong MXIOINFO::Seek(MxLong p_offset, MxLong p_origin) } else { // we have to read another chunk from disk. - if (m_info.hmmio && !Flush(0)) { - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, p_offset, p_origin); + if (RAW_M_FILE && !Flush(0)) { + m_info.lDiskOffset = _llseek(M_FILE, p_offset, p_origin); if (m_info.lDiskOffset == -1) { - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); + m_info.lDiskOffset = _llseek(M_FILE, 0, SEEK_CUR); } else { @@ -248,10 +259,10 @@ MxLong MXIOINFO::Seek(MxLong p_offset, MxLong p_origin) // do we need to seek again? // (i.e. are we already aligned to buffer size?) if (p_offset != m_info.lBufOffset) { - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, m_info.lBufOffset, SEEK_SET); + m_info.lDiskOffset = _llseek(M_FILE, m_info.lBufOffset, SEEK_SET); if (m_info.lDiskOffset == -1) { - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); + m_info.lDiskOffset = _llseek(M_FILE, 0, SEEK_CUR); } } @@ -259,10 +270,10 @@ MxLong MXIOINFO::Seek(MxLong p_offset, MxLong p_origin) // is the file open for writing only? if ((m_info.dwFlags & MMIO_RWMODE) == 0 || (m_info.dwFlags & MMIO_RWMODE) == MMIO_READWRITE) { // We can read from the file. Fill the buffer. - bytesRead = _hread((HFILE) m_info.hmmio, m_info.pchBuffer, m_info.cchBuffer); + bytesRead = _hread(M_FILE, m_info.pchBuffer, m_info.cchBuffer); if (bytesRead == -1) { - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); + m_info.lDiskOffset = _llseek(M_FILE, 0, SEEK_CUR); } else { m_info.lDiskOffset += bytesRead; @@ -283,19 +294,19 @@ MxLong MXIOINFO::Seek(MxLong p_offset, MxLong p_origin) } } } - else if (m_info.hmmio) { + else if (RAW_M_FILE) { // No buffer so just seek the file directly (if we have a valid handle) // i.e. if we just want to get the current file position if (p_origin == SEEK_CUR && p_offset == 0) { return m_info.lDiskOffset; } - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, p_offset, p_origin); + m_info.lDiskOffset = _llseek(M_FILE, p_offset, p_origin); result = m_info.lDiskOffset; if (result == -1) { - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); + m_info.lDiskOffset = _llseek(M_FILE, 0, SEEK_CUR); } } @@ -334,25 +345,25 @@ MxU16 MXIOINFO::Flush(MxU16 p_unused) // if we have allocated an IO buffer if (m_info.pchBuffer) { // if we have a file open for writing - if (m_info.hmmio && (m_info.dwFlags & MMIO_RWMODE)) { + if (RAW_M_FILE && (m_info.dwFlags & MMIO_RWMODE)) { // DECOMP: pulling this value out into a variable forces it into EBX MxLong cchBuffer = m_info.cchBuffer; if (cchBuffer > 0) { if (m_info.lBufOffset != m_info.lDiskOffset) { - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, m_info.lBufOffset, SEEK_SET); + m_info.lDiskOffset = _llseek(M_FILE, m_info.lBufOffset, SEEK_SET); } // Was the previous seek (if required) successful? if (m_info.lBufOffset != m_info.lDiskOffset) { result = MMIOERR_CANNOTSEEK; - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); + m_info.lDiskOffset = _llseek(M_FILE, 0, SEEK_CUR); } else { - bytesWritten = _hwrite((HFILE) m_info.hmmio, m_info.pchBuffer, cchBuffer); + bytesWritten = _hwrite(M_FILE, m_info.pchBuffer, cchBuffer); if (bytesWritten == -1 || bytesWritten != cchBuffer) { result = MMIOERR_CANNOTWRITE; - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); + m_info.lDiskOffset = _llseek(M_FILE, 0, SEEK_CUR); } else { m_info.lDiskOffset += bytesWritten; @@ -392,19 +403,19 @@ MxU16 MXIOINFO::Advance(MxU16 p_option) ((p_option & MMIO_WRITE) || (rwmode == MMIO_READWRITE)) && cch > 0) { if (m_info.lBufOffset != m_info.lDiskOffset) { - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, m_info.lBufOffset, SEEK_SET); + m_info.lDiskOffset = _llseek(M_FILE, m_info.lBufOffset, SEEK_SET); } if (m_info.lBufOffset != m_info.lDiskOffset) { result = MMIOERR_CANNOTSEEK; - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); + m_info.lDiskOffset = _llseek(M_FILE, 0, SEEK_CUR); } else { - bytesCounter = _hwrite((HFILE) m_info.hmmio, m_info.pchBuffer, cch); + bytesCounter = _hwrite(M_FILE, m_info.pchBuffer, cch); if (bytesCounter == -1 || bytesCounter != cch) { result = MMIOERR_CANNOTWRITE; - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); + m_info.lDiskOffset = _llseek(M_FILE, 0, SEEK_CUR); } else { m_info.lDiskOffset += bytesCounter; @@ -418,20 +429,20 @@ MxU16 MXIOINFO::Advance(MxU16 p_option) m_info.lBufOffset += cch; if ((!rwmode || rwmode == MMIO_READWRITE) && cch > 0) { if (m_info.lBufOffset != m_info.lDiskOffset) { - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, m_info.lBufOffset, SEEK_SET); + m_info.lDiskOffset = _llseek(M_FILE, m_info.lBufOffset, SEEK_SET); } // if previous seek failed if (m_info.lBufOffset != m_info.lDiskOffset) { result = MMIOERR_CANNOTSEEK; - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); + m_info.lDiskOffset = _llseek(M_FILE, 0, SEEK_CUR); } else { - bytesCounter = _hread((HFILE) m_info.hmmio, m_info.pchBuffer, cch); + bytesCounter = _hread(M_FILE, m_info.pchBuffer, cch); if (bytesCounter == -1) { result = MMIOERR_CANNOTREAD; - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); + m_info.lDiskOffset = _llseek(M_FILE, 0, SEEK_CUR); } else { m_info.lDiskOffset += bytesCounter; @@ -574,11 +585,11 @@ MxU16 MXIOINFO::Ascend(MMCKINFO* p_chunkInfo, MxU16 p_ascend) m_info.dwFlags |= MMIO_DIRTY; } else { - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, ofs, SEEK_SET); + m_info.lDiskOffset = _llseek(M_FILE, ofs, SEEK_SET); if (m_info.lDiskOffset == ofs) { - if (_lwrite((HFILE) m_info.hmmio, (char*) &size, 4) != 4) { - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); + if (_lwrite(M_FILE, (char*) &size, 4) != 4) { + m_info.lDiskOffset = _llseek(M_FILE, 0, SEEK_CUR); result = MMIOERR_CANNOTWRITE; } else { @@ -586,7 +597,7 @@ MxU16 MXIOINFO::Ascend(MMCKINFO* p_chunkInfo, MxU16 p_ascend) } } else { - m_info.lDiskOffset = _llseek((HFILE) m_info.hmmio, 0, SEEK_CUR); + m_info.lDiskOffset = _llseek(M_FILE, 0, SEEK_CUR); result = MMIOERR_CANNOTSEEK; } } diff --git a/LEGO1/tgl/d3drm/impl.h b/LEGO1/tgl/d3drm/impl.h index c49ffd1a..413f7110 100644 --- a/LEGO1/tgl/d3drm/impl.h +++ b/LEGO1/tgl/d3drm/impl.h @@ -5,6 +5,12 @@ #include +#ifdef DIRECTX5_SDK +typedef DWORD LPD3DRM_APPDATA; +#else +typedef LPVOID LPD3DRM_APPDATA; +#endif + // Forward declare D3D types struct IDirect3DRM2; struct IDirect3DRMDevice2; diff --git a/LEGO1/tgl/d3drm/texture.cpp b/LEGO1/tgl/d3drm/texture.cpp index b0ee3813..a51a5c0b 100644 --- a/LEGO1/tgl/d3drm/texture.cpp +++ b/LEGO1/tgl/d3drm/texture.cpp @@ -15,16 +15,16 @@ void TextureDestroyCallback(IDirect3DRMObject* pObject, void* pArg); // FUNCTION: LEGO1 0x100a12a0 Result TextureImpl::SetImage(IDirect3DRMTexture* pSelf, TglD3DRMIMAGE* pImage) { - unsigned long appData; + void* appData; Result result; - appData = reinterpret_cast(pImage); + appData = pImage; // This is here because in the original code they asserted // on the return value being NULL. TextureGetImage(pSelf); - result = ResultVal(pSelf->SetAppData(appData)); + result = ResultVal(pSelf->SetAppData((LPD3DRM_APPDATA) appData)); if (Succeeded(result) && pImage) { result = ResultVal(pSelf->AddDestroyCallback(TextureDestroyCallback, NULL)); if (!Succeeded(result)) { diff --git a/LEGO1/tgl/d3drm/view.cpp b/LEGO1/tgl/d3drm/view.cpp index 457c54d2..b9fca8e9 100644 --- a/LEGO1/tgl/d3drm/view.cpp +++ b/LEGO1/tgl/d3drm/view.cpp @@ -50,7 +50,7 @@ Result ViewImpl::ViewportCreateAppData(IDirect3DRM2* pDevice, IDirect3DRMViewpor { ViewportAppData* data = new ViewportAppData(pDevice); data->m_pCamera = pCamera; - Result result = ResultVal(pView->SetAppData(reinterpret_cast(data))); + Result result = ResultVal(pView->SetAppData(reinterpret_cast(data))); if (Succeeded(result)) { result = ResultVal(pView->AddDestroyCallback(ViewportDestroyCallback, data)); } diff --git a/LEGO1/viewmanager/viewmanager.cpp b/LEGO1/viewmanager/viewmanager.cpp index 3531381c..c0691587 100644 --- a/LEGO1/viewmanager/viewmanager.cpp +++ b/LEGO1/viewmanager/viewmanager.cpp @@ -29,7 +29,7 @@ float g_unk0x1010105c = 0.000125F; // GLOBAL: LEGO1 0x10101060 float g_elapsedSeconds = 0; -inline void SetAppData(ViewROI* p_roi, DWORD data); +inline void SetAppData(ViewROI* p_roi, LPD3DRM_APPDATA data); inline undefined4 GetD3DRM(IDirect3DRM2*& d3drm, Tgl::Renderer* pRenderer); inline undefined4 GetFrame(IDirect3DRMFrame2*& frame, Tgl::Group* scene); @@ -165,7 +165,7 @@ void ViewManager::UpdateROIDetailBasedOnLOD(ViewROI* p_roi, int p_und) if (lod->GetUnknown0x08() & ViewLOD::c_bit4) { scene->Add((Tgl::MeshBuilder*) group); - SetAppData(p_roi, (DWORD) p_roi); + SetAppData(p_roi, reinterpret_cast(p_roi)); } } else { @@ -187,7 +187,7 @@ void ViewManager::UpdateROIDetailBasedOnLOD(ViewROI* p_roi, int p_und) if (meshBuilder != NULL) { group->Add(meshBuilder); - SetAppData(p_roi, (DWORD) p_roi); + SetAppData(p_roi, reinterpret_cast(p_roi)); p_roi->SetUnknown0xe0(p_und); return; } @@ -533,7 +533,7 @@ ViewROI* ViewManager::Pick(Tgl::View* p_view, unsigned long x, unsigned long y) return result; } -inline void SetAppData(ViewROI* p_roi, DWORD data) +inline void SetAppData(ViewROI* p_roi, LPD3DRM_APPDATA data) { IDirect3DRMFrame2* frame = NULL;