diff --git a/CMakeLists.txt b/CMakeLists.txt index e1fa4db2..9efb9c99 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/legoworld.cpp b/LEGO1/legoworld.cpp index 938abe3a..5129cca6 100644 --- a/LEGO1/legoworld.cpp +++ b/LEGO1/legoworld.cpp @@ -67,6 +67,24 @@ MxResult LegoWorld::SetAsCurrentWorld(MxDSObject& p_dsObject) return SUCCESS; } +// SYNTHETIC: LEGO1 0x1001eed0 +// MxPresenterListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x1001ef40 +// MxPtrListCursor::~MxPtrListCursor + +// SYNTHETIC: LEGO1 0x1001ef90 +// MxListCursor::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x1001f000 +// MxPtrListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x1001f070 +// MxListCursor::~MxListCursor + +// FUNCTION: LEGO1 0x1001f0c0 +// MxPresenterListCursor::~MxPresenterListCursor + // FUNCTION: LEGO1 0x1001f5e0 MxLong LegoWorld::Notify(MxParam& p_param) { 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 diff --git a/LEGO1/mxdsactionlist.h b/LEGO1/mxdsactionlist.h index 19929d20..a467bf52 100644 --- a/LEGO1/mxdsactionlist.h +++ b/LEGO1/mxdsactionlist.h @@ -26,6 +26,13 @@ class MxDSActionList : public MxList { undefined m_unk18; }; -typedef MxListCursorChild MxDSActionListCursor; +// VTABLE: LEGO1 0x100d7e68 +// class MxListCursor + +// VTABLE: LEGO1 0x100d7e50 +class MxDSActionListCursor : public MxListCursor { +public: + MxDSActionListCursor(MxDSActionList* p_list) : MxListCursor(p_list){}; +}; #endif // MXDSACTIONLIST_H diff --git a/LEGO1/mxdsmultiaction.cpp b/LEGO1/mxdsmultiaction.cpp index 27cd806e..b2b31abe 100644 --- a/LEGO1/mxdsmultiaction.cpp +++ b/LEGO1/mxdsmultiaction.cpp @@ -2,6 +2,19 @@ DECOMP_SIZE_ASSERT(MxDSMultiAction, 0x9c) +// TODO: Should be moved later +// SYNTHETIC: LEGO1 0x1004ad10 +// MxDSActionListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x1004ad80 +// MxListCursor::~MxListCursor + +// SYNTHETIC: LEGO1 0x1004add0 +// MxListCursor::`scalar deleting destructor' + +// FUNCTION: LEGO1 0x1004ae40 +// MxDSActionListCursor::~MxDSActionListCursor + // FUNCTION: LEGO1 0x100c9b90 MxDSMultiAction::MxDSMultiAction() { diff --git a/LEGO1/mxdsselectaction.cpp b/LEGO1/mxdsselectaction.cpp index 4bdfbd60..ed9b78ba 100644 --- a/LEGO1/mxdsselectaction.cpp +++ b/LEGO1/mxdsselectaction.cpp @@ -33,6 +33,18 @@ void MxDSSelectAction::CopyFrom(MxDSSelectAction& p_dsSelectAction) this->m_unk0xac->Append(string); } +// SYNTHETIC: LEGO1 0x100cbbd0 +// MxStringListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x100cbc40 +// MxListCursor::~MxListCursor + +// SYNTHETIC: LEGO1 0x100cbc90 +// MxListCursor::`scalar deleting destructor' + +// FUNCTION: LEGO1 0x100cbd00 +// MxStringListCursor::~MxStringListCursor + // FUNCTION: LEGO1 0x100cbd50 MxDSSelectAction& MxDSSelectAction::operator=(MxDSSelectAction& p_dsSelectAction) { @@ -130,3 +142,6 @@ void MxDSSelectAction::Deserialize(char** p_source, MxS16 p_unk24) *p_source += extraFlag; } + +// TEMPLATE: LEGO1 0x100cc450 +// MxListEntry::GetValue diff --git a/LEGO1/mxlist.h b/LEGO1/mxlist.h index d44d6c8f..8ca3d199 100644 --- a/LEGO1/mxlist.h +++ b/LEGO1/mxlist.h @@ -100,18 +100,10 @@ class MxListCursor : public MxCore { MxListEntry* m_match; }; -// Unclear purpose template -class MxListCursorChild : public MxListCursor { +class MxPtrListCursor : public MxListCursor { public: - MxListCursorChild(MxList* p_list) : MxListCursor(p_list) {} -}; - -// Unclear purpose -template -class MxListCursorChildChild : public MxListCursorChild { -public: - MxListCursorChildChild(MxList* p_list) : MxListCursorChild(p_list) {} + MxPtrListCursor(MxPtrList* p_list) : MxListCursor(p_list){}; }; template diff --git a/LEGO1/mxmediapresenter.cpp b/LEGO1/mxmediapresenter.cpp index 314f89c7..2d18a839 100644 --- a/LEGO1/mxmediapresenter.cpp +++ b/LEGO1/mxmediapresenter.cpp @@ -21,6 +21,19 @@ void MxMediaPresenter::Destroy() Destroy(FALSE); } +// TODO: These probably belong in another class +// SYNTHETIC: LEGO1 0x100b46e0 +// MxStreamChunkListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x100b4750 +// MxListCursor::~MxListCursor + +// SYNTHETIC: LEGO1 0x100b47a0 +// MxListCursor::`scalar deleting destructor' + +// FUNCTION: LEGO1 0x100b4810 +// MxStreamChunkListCursor::~MxStreamChunkListCursor + // FUNCTION: LEGO1 0x100b54e0 void MxMediaPresenter::Init() { diff --git a/LEGO1/mxpresenterlist.h b/LEGO1/mxpresenterlist.h index d96374b9..23e7f6c2 100644 --- a/LEGO1/mxpresenterlist.h +++ b/LEGO1/mxpresenterlist.h @@ -15,7 +15,17 @@ class MxPresenterList : public MxPtrList { virtual MxS8 Compare(MxPresenter*, MxPresenter*) override; // vtable+0x14 }; -typedef MxListCursorChildChild MxPresenterListCursor; +// VTABLE: LEGO1 0x100d6488 +// class MxListCursor + +// VTABLE: LEGO1 0x100d6530 +// class MxPtrListCursor + +// VTABLE: LEGO1 0x100d6470 +class MxPresenterListCursor : public MxPtrListCursor { +public: + MxPresenterListCursor(MxPresenterList* p_list) : MxPtrListCursor(p_list){}; +}; // VTABLE: LEGO1 0x100d6350 // class MxCollection diff --git a/LEGO1/mxregion.cpp b/LEGO1/mxregion.cpp index afd546d6..0ac28be1 100644 --- a/LEGO1/mxregion.cpp +++ b/LEGO1/mxregion.cpp @@ -86,6 +86,24 @@ void MxRegion::vtable18(MxRect32& p_rect) m_rect.UpdateBounds(p_rect); } +// SYNTHETIC: LEGO1 0x100c3be0 +// MxRegionListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x100c3c50 +// MxPtrListCursor::~MxPtrListCursor + +// SYNTHETIC: LEGO1 0x100c3ca0 +// MxListCursor::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x100c3d10 +// MxPtrListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x100c3d80 +// MxListCursor::~MxListCursor + +// FUNCTION: LEGO1 0x100c3dd0 +// MxRegionListCursor::~MxRegionListCursor + // FUNCTION: LEGO1 0x100c3e20 MxBool MxRegion::vtable1c(MxRect32& p_rect) { @@ -105,6 +123,21 @@ MxBool MxRegion::vtable1c(MxRect32& p_rect) return FALSE; } +// SYNTHETIC: LEGO1 0x100c4790 +// MxRegionLeftRightListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x100c4800 +// MxPtrListCursor::~MxPtrListCursor + +// SYNTHETIC: LEGO1 0x100c4850 +// MxListCursor::`scalar deleting destructor' + +// SYNTHETIC: LEGO1 0x100c48c0 +// MxPtrListCursor::`scalar deleting destructor' + +// TEMPLATE: LEGO1 0x100c4930 +// MxListCursor::~MxListCursor + // FUNCTION: LEGO1 0x100c4c90 MxRegionTopBottom::MxRegionTopBottom(MxS32 p_top, MxS32 p_bottom) { @@ -167,6 +200,15 @@ void MxRegionTopBottom::FUN_100c5280(MxS32 p_left, MxS32 p_right) } } +// TEMPLATE: LEGO1 0x100c54f0 +// MxListCursor::MxListCursor + +// FUNCTION: LEGO1 0x100c5560 +// MxRegionLeftRightListCursor::~MxRegionLeftRightListCursor + +// TEMPLATE: LEGO1 0x100c55b0 +// MxListCursor::operator= + // FUNCTION: LEGO1 0x100c55d0 MxRegionTopBottom* MxRegionTopBottom::Clone() { diff --git a/LEGO1/mxregionlist.h b/LEGO1/mxregionlist.h index 3aa0487b..2938e38b 100644 --- a/LEGO1/mxregionlist.h +++ b/LEGO1/mxregionlist.h @@ -23,13 +23,21 @@ class MxRegionList : public MxPtrList { static void Destroy(MxRegionTopBottom*); }; -// VTABLE: LEGO1 0x100dcb88 -// class MxListCursorChildChild -typedef MxListCursorChildChild MxRegionListCursor; +// VTABLE: LEGO1 0x100dcb70 +// class MxPtrListCursor -// VTABLE: LEGO1 0x100dcc10 -// class MxListCursorChildChild -typedef MxListCursorChildChild MxRegionLeftRightListCursor; +// VTABLE: LEGO1 0x100dcba0 +// class MxListCursor + +// TODO: The initialize list param type should be MxRegionList, but doing that +// drastically reduced the match percentage for MxRegion::vtable18. +// It also works with MxPtrList, so we'll do that until we figure this out. + +// VTABLE: LEGO1 0x100dcb88 +class MxRegionListCursor : public MxPtrListCursor { +public: + MxRegionListCursor(MxPtrList* p_list) : MxPtrListCursor(p_list){}; +}; // VTABLE: LEGO1 0x100dcc40 // class MxCollection @@ -48,4 +56,16 @@ class MxRegionLeftRightList : public MxPtrList { static void Destroy(MxRegionLeftRight*); }; +// VTABLE: LEGO1 0x100dcbf8 +// class MxPtrListCursor + +// VTABLE: LEGO1 0x100dcc28 +// class MxListCursor + +// VTABLE: LEGO1 0x100dcc10 +class MxRegionLeftRightListCursor : public MxPtrListCursor { +public: + MxRegionLeftRightListCursor(MxRegionLeftRightList* p_list) : MxPtrListCursor(p_list){}; +}; + #endif // MXREGIONLIST_H diff --git a/LEGO1/mxstreamchunklist.h b/LEGO1/mxstreamchunklist.h index 4924b6ff..9661229c 100644 --- a/LEGO1/mxstreamchunklist.h +++ b/LEGO1/mxstreamchunklist.h @@ -23,6 +23,13 @@ class MxStreamChunkList : public MxList { static void Destroy(MxStreamChunk* p_chunk); }; -typedef MxListCursorChild MxStreamChunkListCursor; +// VTABLE: LEGO1 0x100dc510 +class MxStreamChunkListCursor : public MxListCursor { +public: + MxStreamChunkListCursor(MxStreamChunkList* p_list) : MxListCursor(p_list){}; +}; + +// VTABLE: LEGO1 0x100dc528 +// class MxListCursor #endif // MXSTREAMCHUNKLIST_H diff --git a/LEGO1/mxstreamcontroller.cpp b/LEGO1/mxstreamcontroller.cpp index 2ecf0b43..cdc8eff3 100644 --- a/LEGO1/mxstreamcontroller.cpp +++ b/LEGO1/mxstreamcontroller.cpp @@ -51,13 +51,13 @@ MxStreamController::MxStreamController() // TEMPLATE: LEGO1 0x100c0ee0 // list >::_Buynode -// TEMPLATE: LEGO1 0x100c0fc0 +// FUNCTION: LEGO1 0x100c0fc0 // MxStreamListMxDSSubscriber::~MxStreamListMxDSSubscriber -// TEMPLATE: LEGO1 0x100c1010 +// FUNCTION: LEGO1 0x100c1010 // MxStreamListMxDSAction::~MxStreamListMxDSAction -// TEMPLATE: LEGO1 0x100c1060 +// FUNCTION: LEGO1 0x100c1060 // MxStreamListMxNextActionDataStart::~MxStreamListMxNextActionDataStart // TEMPLATE: LEGO1 0x100c10b0 diff --git a/LEGO1/mxstringlist.h b/LEGO1/mxstringlist.h index 08754405..cacb0be5 100644 --- a/LEGO1/mxstringlist.h +++ b/LEGO1/mxstringlist.h @@ -9,6 +9,12 @@ class MxStringList : public MxList {}; // VTABLE: LEGO1 0x100dd058 -typedef MxListCursorChild MxStringListCursor; +class MxStringListCursor : public MxListCursor { +public: + MxStringListCursor(MxStringList* p_list) : MxListCursor(p_list){}; +}; + +// VTABLE: LEGO1 0x100dd070 +// class MxListCursor #endif // MXSTRINGLIST_H