diff --git a/LEGO1/legoomni.cpp b/LEGO1/legoomni.cpp index 2ac07431..8786145e 100644 --- a/LEGO1/legoomni.cpp +++ b/LEGO1/legoomni.cpp @@ -32,10 +32,8 @@ LegoOmni::~LegoOmni() // OFFSET: LEGO1 0x1005b560 void LegoOmni::CreateBackgroundAudio() { - if (m_bkgAudioManager != NULL) - { + if (m_bkgAudioManager) m_bkgAudioManager->Create(*g_jukeboxScript, 100); - } } // OFFSET: LEGO1 0x1005af10 STUB diff --git a/LEGO1/mxbackgroundaudiomanager.cpp b/LEGO1/mxbackgroundaudiomanager.cpp index b4c993c7..cbf480fc 100644 --- a/LEGO1/mxbackgroundaudiomanager.cpp +++ b/LEGO1/mxbackgroundaudiomanager.cpp @@ -31,17 +31,15 @@ MxBackgroundAudioManager::~MxBackgroundAudioManager() void MxBackgroundAudioManager::Stop() { if (m_action2.GetObjectId() != -1) - { DeleteObject(m_action2); - } + m_unk138 = 0; m_action2.SetAtomId(MxAtomId()); m_action2.SetObjectId(-1); if (m_action1.GetObjectId() != -1) - { DeleteObject(m_action1); - } + m_unka0 = 0; m_action1.SetAtomId(MxAtomId()); m_unk148 = 0; @@ -68,30 +66,29 @@ void MxBackgroundAudioManager::Init() } // OFFSET: LEGO1 0x1007ece0 -MxResult MxBackgroundAudioManager::Create(MxAtomId& script, MxU32 p_interval) +MxResult MxBackgroundAudioManager::Create(MxAtomId &p_script, MxU32 p_frequencyMS) { - MxResult result = OpenMusic(script); - if (result == SUCCESS) - { - TickleManager()->RegisterClient(this, p_interval); + MxResult result = OpenMusic(p_script); + + if (result == SUCCESS) { + TickleManager()->RegisterClient(this, p_frequencyMS); m_musicEnabled = TRUE; } + return result; } // OFFSET: LEGO1 0x1007ed20 -MxResult MxBackgroundAudioManager::OpenMusic(MxAtomId& script) +MxResult MxBackgroundAudioManager::OpenMusic(MxAtomId &p_script) { - MxResult result = FAILURE; - if (m_unk14c.GetInternal() != NULL) - { + if (m_script.GetInternal()) DestroyMusic(); - } - if (Streamer()->Open(script.GetInternal(), 0) != NULL) - { + MxResult result = FAILURE; + + if (Streamer()->Open(p_script.GetInternal(), 0)) { + m_script = p_script; result = SUCCESS; - m_unk14c = script; } return result; @@ -100,13 +97,12 @@ MxResult MxBackgroundAudioManager::OpenMusic(MxAtomId& script) // OFFSET: LEGO1 0x1007ed70 void MxBackgroundAudioManager::DestroyMusic() { - if (m_unk14c.GetInternal() != NULL) - { + if (m_script.GetInternal()) { MxDSAction ds; - ds.SetAtomId(m_unk14c); + ds.SetAtomId(m_script); ds.SetUnknown24(-2); DeleteObject(ds); - Streamer()->Close(m_unk14c.GetInternal()); + Streamer()->Close(m_script.GetInternal()); m_musicEnabled = FALSE; } -} +} \ No newline at end of file diff --git a/LEGO1/mxbackgroundaudiomanager.h b/LEGO1/mxbackgroundaudiomanager.h index b2207aa9..f81fe854 100644 --- a/LEGO1/mxbackgroundaudiomanager.h +++ b/LEGO1/mxbackgroundaudiomanager.h @@ -28,12 +28,12 @@ class MxBackgroundAudioManager : public MxCore } __declspec(dllexport) void Enable(unsigned char p); - virtual MxResult Create(MxAtomId& script, MxU32 p_interval); + virtual MxResult Create(MxAtomId &p_script, MxU32 p_frequencyMS); void Stop(); private: void Init(); - MxResult OpenMusic(MxAtomId& script); + MxResult OpenMusic(MxAtomId &p_script); void DestroyMusic(); MxBool m_musicEnabled; // 0x8 @@ -45,7 +45,7 @@ class MxBackgroundAudioManager : public MxCore MxS32 m_unk140; MxS32 m_unk144; MxS16 m_unk148; - MxAtomId m_unk14c; + MxAtomId m_script; }; #endif // MXBACKGROUNDAUDIOMANAGER_H diff --git a/LEGO1/mxomni.cpp b/LEGO1/mxomni.cpp index 924d3154..0265cc74 100644 --- a/LEGO1/mxomni.cpp +++ b/LEGO1/mxomni.cpp @@ -74,12 +74,6 @@ MxResult MxOmni::DeleteObject(MxDSAction &p_dsAction) return FAILURE; } -// OFFSET: LEGO1 0x100acf70 -MxResult DeleteObject(MxDSAction &ds) -{ - return MxOmni::GetInstance()->DeleteObject(ds); -} - // OFFSET: LEGO1 0x100b09a0 MxBool MxOmni::DoesEntityExist(MxDSAction &p_dsAction) { @@ -409,3 +403,9 @@ MxEventManager* EventManager() { return MxOmni::GetInstance()->GetEventManager(); } + +// OFFSET: LEGO1 0x100acf70 +MxResult DeleteObject(MxDSAction &p_dsAction) +{ + return MxOmni::GetInstance()->DeleteObject(p_dsAction); +} \ No newline at end of file diff --git a/LEGO1/mxomni.h b/LEGO1/mxomni.h index 72c47d22..430c0fe6 100644 --- a/LEGO1/mxomni.h +++ b/LEGO1/mxomni.h @@ -94,8 +94,8 @@ __declspec(dllexport) MxVariableTable * VariableTable(); __declspec(dllexport) MxMusicManager * MusicManager(); __declspec(dllexport) MxEventManager * EventManager(); __declspec(dllexport) MxNotificationManager * NotificationManager(); -MxResult DeleteObject(MxDSAction &ds); +MxResult DeleteObject(MxDSAction &p_dsAction); MxVideoManager *MVideoManager(); MxAtomIdCounterSet *AtomIdCounterSet(); MxObjectFactory *ObjectFactory();