diff --git a/LEGO1/define.cpp b/LEGO1/define.cpp index 8eb1f466..ea57cbb7 100644 --- a/LEGO1/define.cpp +++ b/LEGO1/define.cpp @@ -1,5 +1,15 @@ #include "define.h" +// 0x1010141c +MxU32 g_mxcoreCount[101] = {0, -6643, -5643, -5058, -4643, -4321, -4058, -3836, -3643, -3473, -3321, -3184, -3058, + -2943, -2836, -2736, -2643, -2556, -2473, -2395, -2321, -2251, -2184, -2120, -2058, -2000, + -1943, -1888, -1836, -1785, -1736, -1689, -1643, -1599, -1556, -1514, -1473, -1434, -1395, + -1358, -1321, -1286, -1251, -1217, -1184, -1152, -1120, -1089, -1058, -1029, -1000, -971, + -943, -915, -888, -862, -836, -810, -785, -761, -736, -713, -689, -666, -643, + -621, -599, -577, -556, -535, -514, -494, -473, -454, -434, -415, -395, -377, + -358, -340, -321, -304, -286, -268, -251, -234, -217, -200, -184, -168, -152, + -136, -120, -104, -89, -74, -58, -43, -29, -14, 0}; + // 0x10101eac const char* g_parseExtraTokens = ":;"; diff --git a/LEGO1/define.h b/LEGO1/define.h index fe3f2e9d..2089032d 100644 --- a/LEGO1/define.h +++ b/LEGO1/define.h @@ -1,6 +1,9 @@ #ifndef DEFINE_H #define DEFINE_H +#include "mxtypes.h" + +extern MxU32 g_mxcoreCount[101]; extern const char* g_parseExtraTokens; extern const char* g_strWORLD; extern const char* g_strACTION; diff --git a/LEGO1/mxcore.cpp b/LEGO1/mxcore.cpp index 0443f7bf..8e2ac5a1 100644 --- a/LEGO1/mxcore.cpp +++ b/LEGO1/mxcore.cpp @@ -1,13 +1,12 @@ #include "mxcore.h" -// 0x1010141c -unsigned int g_mxcoreCount = 0; +#include "define.h" // OFFSET: LEGO1 0x100ae1a0 MxCore::MxCore() { - m_id = g_mxcoreCount; - g_mxcoreCount++; + m_id = g_mxcoreCount[0]; + g_mxcoreCount[0]++; } // OFFSET: LEGO1 0x100ae1e0 diff --git a/LEGO1/mxsoundmanager.cpp b/LEGO1/mxsoundmanager.cpp index 937cad63..a57672d3 100644 --- a/LEGO1/mxsoundmanager.cpp +++ b/LEGO1/mxsoundmanager.cpp @@ -1,5 +1,6 @@ #include "mxsoundmanager.h" +#include "define.h" #include "mxautolocker.h" #include "mxomni.h" #include "mxpresenter.h" @@ -127,6 +128,53 @@ MxResult MxSoundManager::Create(MxU32 p_frequencyMS, MxBool p_createThread) return status; } +// OFFSET: LEGO1 0x100aeab0 +void MxSoundManager::Destroy() +{ + Destroy(FALSE); +} + +// OFFSET: LEGO1 0x100aeac0 +void MxSoundManager::SetVolume(MxS32 p_volume) +{ + MxAudioManager::SetVolume(p_volume); + + m_criticalSection.Enter(); + + MxPresenter* presenter; + MxPresenterListCursor cursor(m_presenters); + + while (cursor.Next(presenter)) + ((MxAudioPresenter*) presenter)->vtable60(((MxAudioPresenter*) presenter)->vtable5c()); + + m_criticalSection.Leave(); +} + +// OFFSET: LEGO1 0x100aebd0 +MxPresenter* MxSoundManager::FUN_100aebd0(const MxAtomId& p_atomId, MxU32 p_objectId) +{ + MxAutoLocker lock(&m_criticalSection); + + MxPresenter* presenter; + MxPresenterListCursor cursor(m_presenters); + + while (cursor.Next(presenter)) { + if (presenter->GetAction()->GetAtomId().GetInternal() == p_atomId.GetInternal() && + presenter->GetAction()->GetObjectId() == p_objectId) + return presenter; + } + + return NULL; +} + +// OFFSET: LEGO1 0x100aecf0 +MxS32 MxSoundManager::FUN_100aecf0(MxU32 p_unk) +{ + if (!p_unk) + return -10000; + return g_mxcoreCount[p_unk]; +} + // OFFSET: LEGO1 0x100aed10 void MxSoundManager::vtable0x34() { @@ -152,25 +200,3 @@ void MxSoundManager::vtable0x38() if (presenter->IsA("MxWavePresenter")) ((MxWavePresenter*) presenter)->VTable0x68(); } - -// OFFSET: LEGO1 0x100aeab0 -void MxSoundManager::Destroy() -{ - Destroy(FALSE); -} - -// OFFSET: LEGO1 0x100aeac0 -void MxSoundManager::SetVolume(MxS32 p_volume) -{ - MxAudioManager::SetVolume(p_volume); - - m_criticalSection.Enter(); - - MxPresenter* presenter; - MxPresenterListCursor cursor(m_presenters); - - while (cursor.Next(presenter)) - ((MxAudioPresenter*) presenter)->vtable60(((MxAudioPresenter*) presenter)->vtable5c()); - - m_criticalSection.Leave(); -} diff --git a/LEGO1/mxsoundmanager.h b/LEGO1/mxsoundmanager.h index ef42e8df..5fc5dfb3 100644 --- a/LEGO1/mxsoundmanager.h +++ b/LEGO1/mxsoundmanager.h @@ -2,6 +2,7 @@ #define MXSOUNDMANAGER_H #include "decomp.h" +#include "mxatomid.h" #include "mxaudiomanager.h" #include @@ -11,6 +12,9 @@ class MxSoundManager : public MxAudioManager { public: MxSoundManager(); + + // OFFSET: LEGO1 0x100ae7b0 TEMPLATE + // MxSoundManager::`scalar deleting destructor' virtual ~MxSoundManager() override; // vtable+0x0 virtual void Destroy() override; // vtable+18 @@ -22,6 +26,8 @@ class MxSoundManager : public MxAudioManager { private: void Init(); void Destroy(MxBool p_fromDestructor); + MxPresenter* FUN_100aebd0(const MxAtomId& p_atomId, MxU32 p_objectId); + MxS32 FUN_100aecf0(MxU32 p_unk); LPDIRECTSOUND m_directSound; // 0x30 LPDIRECTSOUNDBUFFER m_dsBuffer; // 0x34