diff --git a/LEGO1/legogamestate.cpp b/LEGO1/legogamestate.cpp index 3ac770da..e95a7470 100644 --- a/LEGO1/legogamestate.cpp +++ b/LEGO1/legogamestate.cpp @@ -164,6 +164,12 @@ void LegoGameState::SerializeScoreHistory(MxS16 p) // TODO } +// OFFSET: LEGO1 0x1003cea0 +void LegoGameState::SetSomeEnumState(undefined4 p_state) +{ + m_unk10 = p_state; +} + // OFFSET: LEGO1 0x10039f00 void LegoGameState::SetSavePath(char* p_savePath) { diff --git a/LEGO1/legogamestate.h b/LEGO1/legogamestate.h index ac268a8b..97fa92c7 100644 --- a/LEGO1/legogamestate.h +++ b/LEGO1/legogamestate.h @@ -37,6 +37,8 @@ class LegoGameState { inline MxU32 GetUnknown10() { return m_unk10; } inline void SetUnknown424(undefined4 p_unk424) { m_unk424 = p_unk424; } + void SetSomeEnumState(undefined4 state); + private: void RegisterState(LegoState* p_state); MxResult WriteEndOfVariables(LegoStream* p_stream); diff --git a/LEGO1/legoomni.cpp b/LEGO1/legoomni.cpp index eebdd654..7307d074 100644 --- a/LEGO1/legoomni.cpp +++ b/LEGO1/legoomni.cpp @@ -1,8 +1,11 @@ #include "legoomni.h" +#include "legoanimationmanager.h" +#include "legobuildingmanager.h" #include "legogamestate.h" #include "legoinputmanager.h" #include "legoobjectfactory.h" +#include "legoplantmanager.h" #include "legosoundmanager.h" #include "legoutil.h" #include "legovideomanager.h" @@ -13,6 +16,7 @@ #include "mxomnicreateflags.h" #include "mxomnicreateparam.h" #include "mxticklemanager.h" +#include "mxtransitionmanager.h" const char* g_current = "current"; @@ -412,6 +416,11 @@ void LegoOmni::Init() m_transitionManager = NULL; } +// OFFSET: LEGO1 0x1001a700 STUB +void FUN_1001a700() +{ +} + // OFFSET: LEGO1 0x10058e70 MxResult LegoOmni::Create(MxOmniCreateParam& p) { @@ -455,12 +464,34 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p) } } + // TODO: there are a few more classes here + m_plantManager = new LegoPlantManager(); + m_animationManager = new LegoAnimationManager(); + m_buildingManager = new LegoBuildingManager(); m_gameState = new LegoGameState(); - m_bkgAudioManager = new MxBackgroundAudioManager(); + // TODO: initialize list at m_unk78 - SetAppCursor(1); - RegisterScripts(); - return SUCCESS; + if (m_unk6c && m_gifManager && m_unkLegoSaveDataWriter && m_plantManager && m_animationManager && + m_buildingManager) { + // TODO: initialize a bunch of MxVariables + RegisterScripts(); + FUN_1001a700(); + // todo: another function call. in legoomni maybe? + m_bkgAudioManager = new MxBackgroundAudioManager(); + if (m_bkgAudioManager != NULL) { + m_transitionManager = new MxTransitionManager(); + if (m_transitionManager != NULL) { + if (m_transitionManager->GetDDrawSurfaceFromVideoManager() == SUCCESS) { + m_notificationManager->Register(this); + SetAppCursor(1); + m_gameState->SetSomeEnumState(0); + return SUCCESS; + } + } + } + } + + return FAILURE; } // OFFSET: LEGO1 0x10058c30 STUB diff --git a/LEGO1/legoomni.h b/LEGO1/legoomni.h index b3803978..40439df7 100644 --- a/LEGO1/legoomni.h +++ b/LEGO1/legoomni.h @@ -83,16 +83,16 @@ class LegoOmni : public MxOmni { return !strcmp(name, LegoOmni::ClassName()) || MxOmni::IsA(name); } - virtual void Init() override; // vtable+14 - virtual MxResult Create(MxOmniCreateParam& p) override; // vtable+18 - virtual void Destroy() override; // vtable+1c - virtual MxResult Start(MxDSAction* action) override; // vtable+20 - virtual MxResult DeleteObject(MxDSAction& ds) override; // vtable+24 - virtual MxBool DoesEntityExist(MxDSAction& ds) override; // vtable+28 - virtual LegoWorld* Vtable0x30(const char* p_id, int p_entityId, MxCore* p_presenter) override; // vtable+30 - virtual void NotifyCurrentEntity(MxNotificationParam* p_param) override; // vtable+34 - virtual void StartTimer() override; // vtable+38 - virtual void StopTimer() override; // vtable+3c + virtual void Init() override; // vtable+14 + virtual MxResult Create(MxOmniCreateParam& p) override; // vtable+18 + virtual void Destroy() override; // vtable+1c + virtual MxResult Start(MxDSAction* action) override; // vtable+20 + virtual MxResult DeleteObject(MxDSAction& ds) override; // vtable+24 + virtual MxBool DoesEntityExist(MxDSAction& ds) override; // vtable+28 + virtual LegoWorld* Vtable0x30(const char* p_id, int p_entityId, MxCore* p_presenter) override; // vtable+30 + virtual void NotifyCurrentEntity(MxNotificationParam* p_param) override; // vtable+34 + virtual void StartTimer() override; // vtable+38 + virtual void StopTimer() override; // vtable+3c LegoEntity* FindByEntityIdOrAtomId(MxAtomId& p_atom, int p_entityid);