diff --git a/CMakeLists.txt b/CMakeLists.txt index f6ff00b0..f2271ec8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,7 @@ add_library(lego1 SHARED LEGO1/legovehiclebuildstate.cpp LEGO1/legovideomanager.cpp LEGO1/legoworld.cpp + LEGO1/legoworldlist.cpp LEGO1/legoworldpresenter.cpp LEGO1/motorcycle.cpp LEGO1/mxactionnotificationparam.cpp diff --git a/LEGO1/legoomni.cpp b/LEGO1/legoomni.cpp index 887b8cad..51bb0c0a 100644 --- a/LEGO1/legoomni.cpp +++ b/LEGO1/legoomni.cpp @@ -11,6 +11,7 @@ #include "legoutil.h" #include "legovideomanager.h" #include "legoworld.h" +#include "legoworldlist.h" #include "mxautolocker.h" #include "mxbackgroundaudiomanager.h" #include "mxdsfile.h" @@ -358,7 +359,7 @@ void LegoOmni::Init() m_inputMgr = NULL; m_unk6c = 0; m_gifManager = NULL; - m_unk78 = 0; + m_worldList = NULL; m_currentWorld = NULL; m_unk80 = FALSE; m_currentVehicle = NULL; @@ -427,9 +428,9 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p) m_animationManager = new LegoAnimationManager(); m_buildingManager = new LegoBuildingManager(); m_gameState = new LegoGameState(); - // TODO: initialize list at m_unk78 + m_worldList = new LegoWorldList(); - if (m_unk6c && m_gifManager && m_unk78 && m_plantManager && m_animationManager && m_buildingManager) { + if (m_unk6c && m_gifManager && m_worldList && m_plantManager && m_animationManager && m_buildingManager) { // TODO: initialize a bunch of MxVariables RegisterScripts(); FUN_1001a700(); diff --git a/LEGO1/legoomni.h b/LEGO1/legoomni.h index d5063235..644f2536 100644 --- a/LEGO1/legoomni.h +++ b/LEGO1/legoomni.h @@ -21,6 +21,7 @@ class LegoSoundManager; class LegoUnkSaveDataWriter; class LegoVideoManager; class LegoWorld; +class LegoWorldList; class MxAtomId; class MxBackgroundAudioManager; class MxDSFile; @@ -117,7 +118,7 @@ class LegoOmni : public MxOmni { undefined4 m_unk6c; LegoInputManager* m_inputMgr; // 0x70 GifManager* m_gifManager; - undefined4 m_unk78; + LegoWorldList* m_worldList; // 0x78 LegoWorld* m_currentWorld; MxBool m_unk80; LegoNavController* m_navController; // 0x84 diff --git a/LEGO1/legoworldlist.cpp b/LEGO1/legoworldlist.cpp new file mode 100644 index 00000000..a62173b0 --- /dev/null +++ b/LEGO1/legoworldlist.cpp @@ -0,0 +1,36 @@ +#include "legoworldlist.h" + +#include "legoworld.h" + +// FUNCTION: LEGO1 0x100598d0 +MxS8 LegoWorldList::Compare(LegoWorld* p_a, LegoWorld* p_b) +{ + return p_a == p_b ? 0 : p_a < p_b ? -1 : 1; +} + +// TEMPLATE: LEGO1 0x100598f0 +// MxCollection::Compare + +// TEMPLATE: LEGO1 0x10059900 +// MxCollection::~MxCollection + +// TEMPLATE: LEGO1 0x10059950 +// MxCollection::Destroy + +// TEMPLATE: LEGO1 0x10059960 +// MxList::~MxList + +// FUNCTION: LEGO1 0x100599f0 +void LegoWorldList::Destroy(LegoWorld* p_world) +{ + delete p_world; +} + +// SYNTHETIC: LEGO1 0x10059ac0 +// MxCollection::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x10059b30 +// MxList::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x10059be0 +// MxPtrList::`scalar deleting destructor' diff --git a/LEGO1/legoworldlist.h b/LEGO1/legoworldlist.h new file mode 100644 index 00000000..5e9a7c37 --- /dev/null +++ b/LEGO1/legoworldlist.h @@ -0,0 +1,27 @@ +#ifndef LEGOWORLDLIST_H +#define LEGOWORLDLIST_H + +#include "mxlist.h" +#include "mxtypes.h" + +class LegoWorld; + +// VTABLE: LEGO1 0x100d8700 +// class MxCollection + +// VTABLE: LEGO1 0x100d8718 +// class MxList + +// VTABLE: LEGO1 0x100d8730 +// class MxPtrList + +// VTABLE: LEGO1 0x100d8680 +// SIZE 0x18 +class LegoWorldList : public MxPtrList { +public: + LegoWorldList() : MxPtrList(Destroy) {} + virtual MxS8 Compare(LegoWorld*, LegoWorld*) override; // vtable+0x14 + static void Destroy(LegoWorld*); +}; + +#endif // LEGOWORLDLIST_H