From 625ee52fe080a36fa442875f959a6701d6050f33 Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Mon, 9 Oct 2023 06:31:36 -0400 Subject: [PATCH] implement a few mxomni/legoomni functions (#193) --- ISLE/isleapp.cpp | 2 +- LEGO1/legoomni.cpp | 29 ++++++++++++++++++++--------- LEGO1/legoomni.h | 11 +++++------ LEGO1/mxomni.cpp | 6 ++++++ LEGO1/mxomni.h | 1 + 5 files changed, 33 insertions(+), 16 deletions(-) diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 803ef45e..a4a73035 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -708,7 +708,7 @@ inline void IsleApp::Tick(BOOL sleepIfNotNextFrame) } if (this->m_frameDelta + g_lastFrameTime < currentTime) { - if (!Lego()->vtable40()) { + if (!Lego()->IsTimerRunning()) { TickleManager()->Tickle(); } g_lastFrameTime = currentTime; diff --git a/LEGO1/legoomni.cpp b/LEGO1/legoomni.cpp index f4480bb8..33f88a58 100644 --- a/LEGO1/legoomni.cpp +++ b/LEGO1/legoomni.cpp @@ -6,7 +6,7 @@ #include "legoutil.h" // 0x100f4588 -char *g_nocdSourceName = NULL; +MxAtomId *g_nocdSourceName = NULL; // 0x101020e8 void (*g_omniUserMessage)(const char *,int); @@ -225,7 +225,7 @@ MxTransitionManager *TransitionManager() // OFFSET: LEGO1 0x10053430 const char *GetNoCD_SourceName() { - return g_nocdSourceName; + return g_nocdSourceName->GetInternal(); } // OFFSET: LEGO1 0x1005b5f0 @@ -252,7 +252,23 @@ LegoEntity *PickEntity(MxLong,MxLong) // OFFSET: LEGO1 0x10058bd0 void LegoOmni::Init() { - // FIXME: Stub + MxOmni::Init(); + m_unk68 = 0; + m_inputMgr = NULL; + m_unk6c = 0; + m_unk74 = 0; + m_unk78 = 0; + m_currentWorld = NULL; + m_unk80 = FALSE; + m_isle = NULL; + m_unk8c = 0; + m_plantManager = NULL; + m_gameState = NULL; + m_animationManager = NULL; + m_buildingManager = NULL; + m_bkgAudioManager = NULL; + m_unk13c = TRUE; + m_transitionManager = NULL; } // OFFSET: LEGO1 0x10058e70 @@ -266,6 +282,7 @@ MxResult LegoOmni::Create(COMPAT_CONST MxOmniCreateParam &p) return SUCCESS; } +// OFFSET: LEGO1 0x10058c30 STUB void LegoOmni::Destroy() { // FIXME: Stub @@ -322,12 +339,6 @@ void LegoOmni::StopTimer() SetAppCursor(0); } -MxBool LegoOmni::vtable40() -{ - // FIXME: Stub - return 0; -} - // OFFSET: LEGO1 0x100157a0 LegoWorld *GetCurrentWorld() { diff --git a/LEGO1/legoomni.h b/LEGO1/legoomni.h index 4de0d1b5..d1c1b9be 100644 --- a/LEGO1/legoomni.h +++ b/LEGO1/legoomni.h @@ -4,6 +4,7 @@ #include "compat.h" #include "mxomni.h" #include "mxdsaction.h" +#include "legoanimationmanager.h" class Isle; class LegoBuildingManager; @@ -62,7 +63,6 @@ class LegoOmni : public MxOmni virtual void NotifyCurrentEntity() override; virtual void StartTimer() override; virtual void StopTimer() override; - virtual MxBool vtable40(); LegoVideoManager *GetVideoManager() { return (LegoVideoManager *) m_videoManager; } LegoSoundManager *GetSoundManager() { return (LegoSoundManager *)m_soundManager;} @@ -83,19 +83,18 @@ class LegoOmni : public MxOmni undefined4 m_unk74; undefined4 m_unk78; LegoWorld *m_currentWorld; - undefined4 m_unk80; + MxBool m_unk80; LegoNavController *m_navController; // 0x84 Isle* m_isle; // 0x88 - char m_unk8c[0x4]; + undefined4 m_unk8c; LegoPlantManager* m_plantManager; // 0x90 - char m_unk94[0x4]; + LegoAnimationManager* m_animationManager; LegoBuildingManager* m_buildingManager; // 0x98 LegoGameState *m_gameState; // 0x9c MxDSAction m_action; MxBackgroundAudioManager *m_bkgAudioManager; // 0x134 MxTransitionManager *m_transitionManager; // 0x138 - int m_unk13c; - + MxBool m_unk13c; }; __declspec(dllexport) MxBackgroundAudioManager * BackgroundAudioManager(); diff --git a/LEGO1/mxomni.cpp b/LEGO1/mxomni.cpp index fb3251da..69473b0d 100644 --- a/LEGO1/mxomni.cpp +++ b/LEGO1/mxomni.cpp @@ -121,6 +121,12 @@ void MxOmni::StopTimer() } } +// OFFSET: LEGO1 0x10058a90 +MxBool MxOmni::IsTimerRunning() +{ + return m_timerRunning; +} + // OFFSET: LEGO1 0x100b0690 void MxOmni::DestroyInstance() { diff --git a/LEGO1/mxomni.h b/LEGO1/mxomni.h index 5290c6ed..9b2c6581 100644 --- a/LEGO1/mxomni.h +++ b/LEGO1/mxomni.h @@ -48,6 +48,7 @@ class MxOmni : public MxCore virtual void NotifyCurrentEntity(); // vtable+34 virtual void StartTimer(); // vtable+38 virtual void StopTimer(); // vtable+3c + virtual MxBool IsTimerRunning(); //vtable+40 static void SetInstance(MxOmni* instance); HWND GetWindowHandle() const { return this->m_windowHandle; } MxObjectFactory* GetObjectFactory() const { return this->m_objectFactory; }