From 9488a37d1b9002fd0639b2ac4a034aa63fb49b40 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 2 Jun 2024 11:00:26 -0400 Subject: [PATCH] Update names --- .../legoomni/include/legocachesoundmanager.h | 6 +-- LEGO1/lego/legoomni/include/legocachsound.h | 2 +- .../src/audio/legocachesoundmanager.cpp | 40 +++++++++---------- LEGO1/lego/legoomni/src/entity/legoactor.cpp | 2 +- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 2 +- .../legoomni/src/paths/legoextraactor.cpp | 4 +- .../lego/legoomni/src/paths/legopathactor.cpp | 2 +- 7 files changed, 27 insertions(+), 31 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legocachesoundmanager.h b/LEGO1/lego/legoomni/include/legocachesoundmanager.h index 8297b416..4c598678 100644 --- a/LEGO1/lego/legoomni/include/legocachesoundmanager.h +++ b/LEGO1/lego/legoomni/include/legocachesoundmanager.h @@ -56,9 +56,9 @@ class LegoCacheSoundManager { LegoCacheSound* FindSoundByKey(const char* p_key); LegoCacheSound* ManageSoundEntry(LegoCacheSound* p_sound); - LegoCacheSound* FUN_1003dae0(const char* p_one, const char* p_two, MxBool p_three); - LegoCacheSound* FUN_1003db10(LegoCacheSound* p_one, const char* p_two, MxBool p_three); - void FUN_1003dc40(LegoCacheSound** p_und); + LegoCacheSound* Play(const char* p_key, const char* p_name, MxBool p_looping); + LegoCacheSound* Play(LegoCacheSound* p_sound, const char* p_name, MxBool p_looping); + void Destroy(LegoCacheSound*& p_sound); private: Set100d6b4c m_set; // 0x04 diff --git a/LEGO1/lego/legoomni/include/legocachsound.h b/LEGO1/lego/legoomni/include/legocachsound.h index 1a4b7aa9..b80ded36 100644 --- a/LEGO1/lego/legoomni/include/legocachsound.h +++ b/LEGO1/lego/legoomni/include/legocachsound.h @@ -37,7 +37,7 @@ class LegoCacheSound : public MxCore { virtual void FUN_10006cd0(undefined4, undefined4); // vtable+0x1c inline const MxString& GetUnknown0x48() const { return m_unk0x48; } - inline const undefined GetUnknown0x58() const { return m_unk0x58; } + inline const MxBool GetUnknown0x58() const { return m_unk0x58; } LegoCacheSound* Clone(); MxResult Play(const char* p_name, MxBool p_looping); diff --git a/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp b/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp index 1f82f8c3..b20a7185 100644 --- a/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp +++ b/LEGO1/lego/legoomni/src/audio/legocachesoundmanager.cpp @@ -104,53 +104,49 @@ LegoCacheSound* LegoCacheSoundManager::ManageSoundEntry(LegoCacheSound* p_sound) } // FUNCTION: LEGO1 0x1003dae0 -LegoCacheSound* LegoCacheSoundManager::FUN_1003dae0(const char* p_one, const char* p_two, MxBool p_three) +LegoCacheSound* LegoCacheSoundManager::Play(const char* p_key, const char* p_name, MxBool p_looping) { // DECOMP: Second parameter is LegoRoi::m_name (0xe4) - return FUN_1003db10(FindSoundByKey(p_one), p_two, p_three); + return Play(FindSoundByKey(p_key), p_name, p_looping); } // FUNCTION: LEGO1 0x1003db10 -LegoCacheSound* LegoCacheSoundManager::FUN_1003db10(LegoCacheSound* p_one, const char* p_two, MxBool p_three) +LegoCacheSound* LegoCacheSoundManager::Play(LegoCacheSound* p_sound, const char* p_name, MxBool p_looping) { - if (!p_one) { + if (!p_sound) { return NULL; } - if (p_one->GetUnknown0x58()) { - LegoCacheSound* result = p_one->Clone(); + if (p_sound->GetUnknown0x58()) { + LegoCacheSound* clone = p_sound->Clone(); - if (result) { - LegoCacheSound* t = ManageSoundEntry(result); - t->Play(p_two, p_three); - return t; + if (clone) { + LegoCacheSound* sound = ManageSoundEntry(clone); + sound->Play(p_name, p_looping); + return sound; } } else { - p_one->Play(p_two, p_three); - return p_one; + p_sound->Play(p_name, p_looping); + return p_sound; } return NULL; } // FUNCTION: LEGO1 0x1003dc40 -void LegoCacheSoundManager::FUN_1003dc40(LegoCacheSound** p_und) +void LegoCacheSoundManager::Destroy(LegoCacheSound*& p_sound) { - // Called during LegoWorld::Destroy like this: - // SoundManager()->GetCacheSoundManager()->FUN_1003dc40(&sound); - // LegoCacheSound*& p_sound? - #ifdef COMPAT_MODE Set100d6b4c::iterator setIter; for (setIter = m_set.begin(); setIter != m_set.end(); setIter++) { #else for (Set100d6b4c::iterator setIter = m_set.begin(); setIter != m_set.end(); setIter++) { #endif - if ((*setIter).GetSound() == *p_und) { - (*p_und)->FUN_10006b80(); + if ((*setIter).GetSound() == p_sound) { + p_sound->FUN_10006b80(); - delete *p_und; + delete p_sound; m_set.erase(setIter); return; } @@ -167,8 +163,8 @@ void LegoCacheSoundManager::FUN_1003dc40(LegoCacheSound** p_und) } LegoCacheSound* sound = (*listIter).GetSound(); - if (sound == *p_und) { - (*p_und)->FUN_10006b80(); + if (sound == p_sound) { + p_sound->FUN_10006b80(); delete sound; m_list.erase(listIter); diff --git a/LEGO1/lego/legoomni/src/entity/legoactor.cpp b/LEGO1/lego/legoomni/src/entity/legoactor.cpp index 6ab78b63..d7d79e1a 100644 --- a/LEGO1/lego/legoomni/src/entity/legoactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoactor.cpp @@ -103,7 +103,7 @@ void LegoActor::ParseAction(char* p_extra) } if (KeyValueStringParse(value, g_strSOUND, p_extra)) { - m_sound = SoundManager()->GetCacheSoundManager()->FUN_1003dae0(value, GetROI()->GetName(), TRUE); + m_sound = SoundManager()->GetCacheSoundManager()->Play(value, GetROI()->GetName(), TRUE); } if (KeyValueStringParse(value, g_strMUTE, p_extra)) { diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index fcec9fdd..fecff1de 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -204,7 +204,7 @@ void LegoWorld::Destroy(MxBool p_fromDestructor) while (cursor.First(sound)) { cursor.Detach(); - SoundManager()->GetCacheSoundManager()->FUN_1003dc40(&sound); + SoundManager()->GetCacheSoundManager()->Destroy(sound); } delete m_cacheSoundList; diff --git a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp index e1eeedbe..f0e2e69b 100644 --- a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp @@ -233,7 +233,7 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) m_roi->FUN_100a58f0(matrix2); m_roi->VTable0x14(); FUN_1002ad8a(); - SoundManager()->GetCacheSoundManager()->FUN_1003dae0("crash5", m_roi->GetName(), FALSE); + SoundManager()->GetCacheSoundManager()->Play("crash5", m_roi->GetName(), FALSE); m_scheduledTime = Timer()->GetTime() + m_disAnim->GetDuration(); m_prevWorldSpeed = m_worldSpeed; VTable0xc4(); @@ -245,7 +245,7 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool) if (b) { LegoROI* roi = m_roi; - SoundManager()->GetCacheSoundManager()->FUN_1003dae0("crash5", m_roi->GetName(), FALSE); + SoundManager()->GetCacheSoundManager()->Play("crash5", m_roi->GetName(), FALSE); VTable0xc4(); m_state = 0x102; Mx3DPointFloat dir = p_actor->GetWorldDirection(); diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 430914b2..454f04fb 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -278,7 +278,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform) const char* var = VariableTable()->GetVariable(g_strHIT_WALL_SOUND); if (var && var[0] != 0) { - SoundManager()->GetCacheSoundManager()->FUN_1003dae0(var, NULL, FALSE); + SoundManager()->GetCacheSoundManager()->Play(var, NULL, FALSE); } }