diff --git a/LEGO1/lego/legoomni/include/helicopter.h b/LEGO1/lego/legoomni/include/helicopter.h index ef932f30..3394b51b 100644 --- a/LEGO1/lego/legoomni/include/helicopter.h +++ b/LEGO1/lego/legoomni/include/helicopter.h @@ -37,7 +37,7 @@ class Helicopter : public IslePathActor { return !strcmp(p_name, Helicopter::ClassName()) || IslePathActor::IsA(p_name); } - virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18 + virtual MxResult Create(MxDSAction& p_dsObject) override; // vtable+0x18 void VTable0x70(float p_float) override; // vtable+0x70 void VTable0x74(Matrix4& p_transform) override; // vtable+0x74 virtual MxU32 VTable0xcc() override; // vtable+0xcc diff --git a/LEGO1/lego/legoomni/include/infocenter.h b/LEGO1/lego/legoomni/include/infocenter.h index 634d7b55..c0f9b315 100644 --- a/LEGO1/lego/legoomni/include/infocenter.h +++ b/LEGO1/lego/legoomni/include/infocenter.h @@ -26,7 +26,7 @@ class Infocenter : public LegoWorld { return !strcmp(p_name, Infocenter::ClassName()) || LegoWorld::IsA(p_name); } - virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18 + virtual MxResult Create(MxDSAction& p_dsObject) override; // vtable+0x18 virtual void VTable0x50() override; // vtable+0x50 virtual MxBool VTable0x5c() override; // vtable+0x5c virtual MxBool VTable0x64() override; // vtable+0x64 diff --git a/LEGO1/lego/legoomni/include/isle.h b/LEGO1/lego/legoomni/include/isle.h index a768d357..36e84dfc 100644 --- a/LEGO1/lego/legoomni/include/isle.h +++ b/LEGO1/lego/legoomni/include/isle.h @@ -40,7 +40,7 @@ class Isle : public LegoWorld { return !strcmp(p_name, Isle::ClassName()) || LegoWorld::IsA(p_name); } - virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18 + virtual MxResult Create(MxDSAction& p_dsObject) override; // vtable+0x18 virtual void VTable0x50() override; // vtable+50 virtual void VTable0x58(MxCore* p_object) override; // vtable+58 // FUNCTION: LEGO1 0x10030900 diff --git a/LEGO1/lego/legoomni/include/islepathactor.h b/LEGO1/lego/legoomni/include/islepathactor.h index d7a8ff60..837cbbeb 100644 --- a/LEGO1/lego/legoomni/include/islepathactor.h +++ b/LEGO1/lego/legoomni/include/islepathactor.h @@ -28,7 +28,7 @@ class IslePathActor : public LegoPathActor { return !strcmp(p_name, IslePathActor::ClassName()) || LegoPathActor::IsA(p_name); } - virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18 + virtual MxResult Create(MxDSAction& p_dsObject) override; // vtable+0x18 // FUNCTION: LEGO1 0x10002e70 virtual MxU32 VTable0xcc() { return 0; } // vtable+0xcc // FUNCTION: LEGO1 0x10002df0 diff --git a/LEGO1/lego/legoomni/include/legocontrolmanager.h b/LEGO1/lego/legoomni/include/legocontrolmanager.h index 7bc8dc0f..36bf6d48 100644 --- a/LEGO1/lego/legoomni/include/legocontrolmanager.h +++ b/LEGO1/lego/legoomni/include/legocontrolmanager.h @@ -2,6 +2,7 @@ #define LEGOCONTROLMANAGER_H #include "mxcore.h" +#include "mxpresenterlist.h" // VTABLE: LEGO1 0x100d6a80 class LegoControlManager : public MxCore { @@ -24,6 +25,7 @@ class LegoControlManager : public MxCore { return !strcmp(p_name, LegoControlManager::ClassName()) || MxCore::IsA(p_name); } + void FUN_10028df0(MxPresenterList* p_presenterList); void Register(MxCore* p_listener); void Unregister(MxCore* p_listener); }; diff --git a/LEGO1/lego/legoomni/include/legoentity.h b/LEGO1/lego/legoomni/include/legoentity.h index 8ca966b1..9db95527 100644 --- a/LEGO1/lego/legoomni/include/legoentity.h +++ b/LEGO1/lego/legoomni/include/legoentity.h @@ -32,7 +32,7 @@ class LegoEntity : public MxEntity { return !strcmp(p_name, LegoEntity::ClassName()) || MxEntity::IsA(p_name); } - virtual MxResult Create(MxDSObject& p_dsObject); // vtable+0x18 + virtual MxResult Create(MxDSAction& p_dsObject); // vtable+0x18 virtual void Destroy(MxBool p_fromDestructor); // vtable+0x1c virtual void ParseAction(char*); // vtable+0x20 virtual void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2); // vtable+0x24 diff --git a/LEGO1/lego/legoomni/include/legoomni.h b/LEGO1/lego/legoomni/include/legoomni.h index 21c84801..dbc684cd 100644 --- a/LEGO1/lego/legoomni/include/legoomni.h +++ b/LEGO1/lego/legoomni/include/legoomni.h @@ -116,7 +116,7 @@ class LegoOmni : public MxOmni { MxDSAction& GetCurrentAction() { return m_action; } inline void SetNavController(LegoNavController* p_navController) { m_navController = p_navController; } - + inline void SetWorld(LegoWorld* p_world) { m_currentWorld = p_world; } inline void SetExit(MxBool p_exit) { m_exit = p_exit; }; private: @@ -167,5 +167,6 @@ void SetIsWorldActive(MxBool p_isWorldActive); void DeleteObjects(MxAtomId* p_id, MxS32 p_first, MxS32 p_last); void RegisterScripts(); void UnregisterScripts(); +void SetCurrentWorld(LegoWorld* p_world); #endif // LEGOOMNI_H diff --git a/LEGO1/lego/legoomni/include/legopointofviewcontroller.h b/LEGO1/lego/legoomni/include/legopointofviewcontroller.h index 444a08ad..99c213e2 100644 --- a/LEGO1/lego/legoomni/include/legopointofviewcontroller.h +++ b/LEGO1/lego/legoomni/include/legopointofviewcontroller.h @@ -83,6 +83,7 @@ class LegoPointOfViewController : public LegoMouseController { virtual void SetEntity(LegoEntity* p_entity); // vtable+0x2c MxResult Create(Lego3DView* p_lego3DView); + void OnViewSize(int p_width, int p_height); inline LegoEntity* GetEntity() { return m_entity; } diff --git a/LEGO1/lego/legoomni/include/legorace.h b/LEGO1/lego/legoomni/include/legorace.h index 530c289c..d3a490d9 100644 --- a/LEGO1/lego/legoomni/include/legorace.h +++ b/LEGO1/lego/legoomni/include/legorace.h @@ -28,7 +28,7 @@ class LegoRace : public LegoWorld { return !strcmp(p_name, LegoRace::ClassName()) || LegoWorld::IsA(p_name); } - virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18 + virtual MxResult Create(MxDSAction& p_dsObject) override; // vtable+0x18 virtual MxBool VTable0x5c() override; // vtable+0x5c virtual MxBool VTable0x64() override; // vtable+0x64 virtual void VTable0x68(MxBool p_add) override; // vtable+0x68 diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index 385e0b07..f07a4e98 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -33,20 +33,20 @@ class LegoWorld : public LegoEntity { return !strcmp(p_name, LegoWorld::ClassName()) || LegoEntity::IsA(p_name); } - virtual void VTable0x50(); // vtable+50 - virtual void VTable0x54(); // vtable+54 - virtual void VTable0x58(MxCore* p_object); // vtable+58 - virtual MxBool VTable0x5c(); // vtable+5c + virtual MxResult Create(MxDSAction& p_dsObject); // vtable+0x18 + virtual void VTable0x50(); // vtable+50 + virtual LegoCameraController* VTable0x54(); // vtable+54 + virtual void VTable0x58(MxCore* p_object); // vtable+58 + virtual MxBool VTable0x5c(); // vtable+5c // FUNCTION: LEGO1 0x100010a0 virtual void VTable0x60() {} // vtable+60 virtual MxBool VTable0x64(); // vtable+64 virtual void VTable0x68(MxBool p_add); // vtable+68 - inline LegoCameraController* GetCamera() { return m_camera; } + inline LegoCameraController* GetCamera() { return m_cameraController; } inline undefined4 GetUnknown0xec() { return m_unk0xec; } undefined FUN_100220e0(); - MxResult SetAsCurrentWorld(MxDSObject& p_dsObject); void EndAction(MxCore* p_object); void FUN_1001fc80(IslePathActor* p_actor); MxBool FUN_100727e0(MxU32, Mx3DPointFloat& p_loc, Mx3DPointFloat& p_dir, Mx3DPointFloat& p_up); @@ -56,17 +56,17 @@ class LegoWorld : public LegoEntity { MxS32 GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value); protected: - LegoPathControllerList m_list0x68; // 0x68 - MxPresenterList m_list0x80; // 0x80 - LegoCameraController* m_camera; // 0x98 - undefined m_unk0x9c[0x1c]; // 0x9c - MxPresenterList m_list0xb8; // 0xb8 - undefined m_unk0xd0[0x1c]; // 0xd0 - undefined4 m_unk0xec; // 0xec - undefined4 m_unk0xf0; // 0xf0 - MxS16 m_unk0xf4; // 0xf4 - MxBool m_worldStarted; // 0xf6 - undefined m_unk0xf7; // 0xf7 + LegoPathControllerList m_list0x68; // 0x68 + MxPresenterList m_list0x80; // 0x80 + LegoCameraController* m_cameraController; // 0x98 + undefined m_unk0x9c[0x1c]; // 0x9c + MxPresenterList m_list0xb8; // 0xb8 + undefined m_unk0xd0[0x1c]; // 0xd0 + undefined4 m_unk0xec; // 0xec + undefined4 m_unk0xf0; // 0xf0 + MxS16 m_unk0xf4; // 0xf4 + MxBool m_worldStarted; // 0xf6 + undefined m_unk0xf7; // 0xf7 }; // SYNTHETIC: LEGO1 0x1001eed0 diff --git a/LEGO1/lego/legoomni/include/score.h b/LEGO1/lego/legoomni/include/score.h index f5950aa8..c626465e 100644 --- a/LEGO1/lego/legoomni/include/score.h +++ b/LEGO1/lego/legoomni/include/score.h @@ -31,7 +31,7 @@ class Score : public LegoWorld { // SYNTHETIC: LEGO1 0x100011e0 // Score::`scalar deleting destructor' - virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+18 + virtual MxResult Create(MxDSAction& p_dsObject) override; // vtable+18 virtual void VTable0x50() override; // vtable+50 virtual MxBool VTable0x5c() override; // vtable+5c virtual MxBool VTable0x64() override; // vtable+64 diff --git a/LEGO1/lego/legoomni/src/build/helicopter.cpp b/LEGO1/lego/legoomni/src/build/helicopter.cpp index d661b4d7..f562c063 100644 --- a/LEGO1/lego/legoomni/src/build/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/build/helicopter.cpp @@ -27,7 +27,7 @@ Helicopter::~Helicopter() } // FUNCTION: LEGO1 0x100032c0 -MxResult Helicopter::Create(MxDSObject& p_dsObject) +MxResult Helicopter::Create(MxDSAction& p_dsObject) { MxResult result = IslePathActor::Create(p_dsObject); LegoWorld* world = GetCurrentWorld(); diff --git a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp index f3c70c50..24e3cb1b 100644 --- a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp +++ b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp @@ -12,6 +12,12 @@ LegoControlManager::~LegoControlManager() // TODO } +// STUB: LEGO1 0x10028df0 +void LegoControlManager::FUN_10028df0(MxPresenterList* p_presenterList) +{ + // TODO +} + // STUB: LEGO1 0x10028e10 void LegoControlManager::Register(MxCore* p_listener) { diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index 62058e50..dae6ab0b 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -42,7 +42,7 @@ void LegoEntity::SetWorldTransform(const Vector3& p_loc, const Vector3& p_dir, c } // FUNCTION: LEGO1 0x100107e0 -MxResult LegoEntity::Create(MxDSObject& p_dsObject) +MxResult LegoEntity::Create(MxDSAction& p_dsObject) { m_mxEntityId = p_dsObject.GetObjectId(); m_atom = p_dsObject.GetAtomId(); diff --git a/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp index a2e1bb04..f656022d 100644 --- a/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp @@ -100,6 +100,12 @@ MxResult LegoPointOfViewController::Create(Lego3DView* p_lego3DView) return SUCCESS; } +// FUNCTION: LEGO1 0x100658a0 +void LegoPointOfViewController::OnViewSize(int p_width, int p_height) +{ + m_nav->SetControlMax(p_width, p_height); +} + // FUNCTION: LEGO1 0x100658c0 void LegoPointOfViewController::LeftDown(int p_x, int p_y) { diff --git a/LEGO1/lego/legoomni/src/entity/legorace.cpp b/LEGO1/lego/legoomni/src/entity/legorace.cpp index d5eefbd5..80e288f3 100644 --- a/LEGO1/lego/legoomni/src/entity/legorace.cpp +++ b/LEGO1/lego/legoomni/src/entity/legorace.cpp @@ -62,7 +62,7 @@ MxBool LegoRace::VTable0x64() } // STUB: LEGO1 0x10015ce0 -MxResult LegoRace::Create(MxDSObject& p_dsObject) +MxResult LegoRace::Create(MxDSAction& p_dsObject) { // TODO return SUCCESS; diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index 339360e7..01a0c7f8 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -1,8 +1,10 @@ #include "legoworld.h" +#include "legocontrolmanager.h" #include "legoinputmanager.h" #include "legoomni.h" #include "legoutil.h" +#include "legovideomanager.h" #include "mxactionnotificationparam.h" #include "mxnotificationmanager.h" #include "mxnotificationparam.h" @@ -39,10 +41,28 @@ LegoWorld::~LegoWorld() } // STUB: LEGO1 0x1001e0b0 -MxResult LegoWorld::SetAsCurrentWorld(MxDSObject& p_dsObject) +MxResult LegoWorld::Create(MxDSAction& p_dsObject) { - // TODO - return SUCCESS; + MxEntity::Create(p_dsObject); + + // TODO: Intitialize lists + + if (VTable0x54() == SUCCESS) { + if (p_dsObject.GetFlags() & 0x20) { + if (GetCurrentWorld()) { + GetCurrentWorld()->VTable0x68(0); + } + + SetCurrentWorld(this); + ControlManager()->FUN_10028df0(m_list0xb8); + } + + SetIsWorldActive(TRUE); + m_unk0xec = -1; + + return SUCCESS; + } + return FAILURE; } // FUNCTION: LEGO1 0x1001f5e0 @@ -63,10 +83,35 @@ MxLong LegoWorld::Notify(MxParam& p_param) return ret; } -// STUB: LEGO1 0x1001f630 -void LegoWorld::VTable0x54() +// FUNCTION: LEGO1 0x1001f630 +LegoCameraController* LegoWorld::VTable0x54() { - // TODO + MxBool ok = FALSE; + + if (!VideoManager()) { + goto done; + } + if (!(m_cameraController = new LegoCameraController())) { + goto done; + } + if (m_cameraController->Create() != SUCCESS) { + goto done; + } + + m_cameraController->OnViewSize( + VideoManager()->GetVideoParam().GetRect().GetWidth(), + VideoManager()->GetVideoParam().GetRect().GetHeight() + ); + ok = TRUE; + +done: + if (!ok) { + if (m_cameraController) { + delete m_cameraController; + m_cameraController = NULL; + } + } + return m_cameraController; } // STUB: LEGO1 0x1001fc80 diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp index 47d89ea5..8bcec406 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp @@ -13,7 +13,7 @@ Infocenter::~Infocenter() } // STUB: LEGO1 0x1006ed90 -MxResult Infocenter::Create(MxDSObject& p_dsObject) +MxResult Infocenter::Create(MxDSAction& p_dsObject) { return FAILURE; } diff --git a/LEGO1/lego/legoomni/src/infocenter/score.cpp b/LEGO1/lego/legoomni/src/infocenter/score.cpp index 5e9ca19c..38bd4795 100644 --- a/LEGO1/lego/legoomni/src/infocenter/score.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/score.cpp @@ -39,9 +39,9 @@ Score::~Score() } // FUNCTION: LEGO1 0x100012a0 -MxResult Score::Create(MxDSObject& p_dsObject) +MxResult Score::Create(MxDSAction& p_dsObject) { - MxResult result = SetAsCurrentWorld(p_dsObject); + MxResult result = LegoWorld::Create(p_dsObject); if (result == SUCCESS) { InputManager()->SetWorld(this); diff --git a/LEGO1/lego/legoomni/src/isle/isle.cpp b/LEGO1/lego/legoomni/src/isle/isle.cpp index f11497e6..62b6b858 100644 --- a/LEGO1/lego/legoomni/src/isle/isle.cpp +++ b/LEGO1/lego/legoomni/src/isle/isle.cpp @@ -54,11 +54,11 @@ Isle::~Isle() } // FUNCTION: LEGO1 0x10030b20 -MxResult Isle::Create(MxDSObject& p_dsObject) +MxResult Isle::Create(MxDSAction& p_dsObject) { GameState()->FUN_1003ceb0(); - MxResult result = LegoWorld::SetAsCurrentWorld(p_dsObject); + MxResult result = LegoWorld::Create(p_dsObject); if (result == SUCCESS) { ControlManager()->Register(this); InputManager()->SetWorld(this); diff --git a/LEGO1/lego/legoomni/src/isle/islepathactor.cpp b/LEGO1/lego/legoomni/src/isle/islepathactor.cpp index 528bbde8..1e9900b3 100644 --- a/LEGO1/lego/legoomni/src/isle/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/isle/islepathactor.cpp @@ -12,7 +12,7 @@ IslePathActor::IslePathActor() } // FUNCTION: LEGO1 0x1001a280 -MxResult IslePathActor::Create(MxDSObject& p_dsObject) +MxResult IslePathActor::Create(MxDSAction& p_dsObject) { return MxEntity::Create(p_dsObject); } diff --git a/LEGO1/lego/legoomni/src/main/legoomni.cpp b/LEGO1/lego/legoomni/src/main/legoomni.cpp index cd0bc4a0..ef7cca9b 100644 --- a/LEGO1/lego/legoomni/src/main/legoomni.cpp +++ b/LEGO1/lego/legoomni/src/main/legoomni.cpp @@ -216,6 +216,12 @@ MxDSAction& GetCurrentAction() return LegoOmni::GetInstance()->GetCurrentAction(); } +// FUNCTION: LEGO1 0x100158f0 +void SetCurrentWorld(LegoWorld* p_world) +{ + LegoOmni::GetInstance()->SetWorld(p_world); +} + // FUNCTION: LEGO1 0x10015900 MxTransitionManager* TransitionManager() { diff --git a/LEGO1/omni/include/mxentity.h b/LEGO1/omni/include/mxentity.h index 2dd9ccf1..fe2b79a0 100644 --- a/LEGO1/omni/include/mxentity.h +++ b/LEGO1/omni/include/mxentity.h @@ -4,7 +4,7 @@ #include "decomp.h" #include "mxatomid.h" #include "mxcore.h" -#include "mxdsobject.h" +#include "mxdsaction.h" #include "mxtypes.h" // VTABLE: LEGO1 0x100d5390 @@ -38,7 +38,7 @@ class MxEntity : public MxCore { return SUCCESS; }; // vtable+0x14 - inline MxResult Create(MxDSObject& p_dsObject) + inline MxResult Create(MxDSAction& p_dsObject) { m_mxEntityId = p_dsObject.GetObjectId(); m_atom = p_dsObject.GetAtomId();