Update names

This commit is contained in:
Christian Semmler 2024-06-02 11:00:26 -04:00
parent fb8e7c6269
commit 9488a37d1b
7 changed files with 27 additions and 31 deletions

View File

@ -56,9 +56,9 @@ class LegoCacheSoundManager {
LegoCacheSound* FindSoundByKey(const char* p_key); LegoCacheSound* FindSoundByKey(const char* p_key);
LegoCacheSound* ManageSoundEntry(LegoCacheSound* p_sound); LegoCacheSound* ManageSoundEntry(LegoCacheSound* p_sound);
LegoCacheSound* FUN_1003dae0(const char* p_one, const char* p_two, MxBool p_three); LegoCacheSound* Play(const char* p_key, const char* p_name, MxBool p_looping);
LegoCacheSound* FUN_1003db10(LegoCacheSound* p_one, const char* p_two, MxBool p_three); LegoCacheSound* Play(LegoCacheSound* p_sound, const char* p_name, MxBool p_looping);
void FUN_1003dc40(LegoCacheSound** p_und); void Destroy(LegoCacheSound*& p_sound);
private: private:
Set100d6b4c m_set; // 0x04 Set100d6b4c m_set; // 0x04

View File

@ -37,7 +37,7 @@ class LegoCacheSound : public MxCore {
virtual void FUN_10006cd0(undefined4, undefined4); // vtable+0x1c virtual void FUN_10006cd0(undefined4, undefined4); // vtable+0x1c
inline const MxString& GetUnknown0x48() const { return m_unk0x48; } 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(); LegoCacheSound* Clone();
MxResult Play(const char* p_name, MxBool p_looping); MxResult Play(const char* p_name, MxBool p_looping);

View File

@ -104,53 +104,49 @@ LegoCacheSound* LegoCacheSoundManager::ManageSoundEntry(LegoCacheSound* p_sound)
} }
// FUNCTION: LEGO1 0x1003dae0 // 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) // 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 // 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; return NULL;
} }
if (p_one->GetUnknown0x58()) { if (p_sound->GetUnknown0x58()) {
LegoCacheSound* result = p_one->Clone(); LegoCacheSound* clone = p_sound->Clone();
if (result) { if (clone) {
LegoCacheSound* t = ManageSoundEntry(result); LegoCacheSound* sound = ManageSoundEntry(clone);
t->Play(p_two, p_three); sound->Play(p_name, p_looping);
return t; return sound;
} }
} }
else { else {
p_one->Play(p_two, p_three); p_sound->Play(p_name, p_looping);
return p_one; return p_sound;
} }
return NULL; return NULL;
} }
// FUNCTION: LEGO1 0x1003dc40 // 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 #ifdef COMPAT_MODE
Set100d6b4c::iterator setIter; Set100d6b4c::iterator setIter;
for (setIter = m_set.begin(); setIter != m_set.end(); setIter++) { for (setIter = m_set.begin(); setIter != m_set.end(); setIter++) {
#else #else
for (Set100d6b4c::iterator setIter = m_set.begin(); setIter != m_set.end(); setIter++) { for (Set100d6b4c::iterator setIter = m_set.begin(); setIter != m_set.end(); setIter++) {
#endif #endif
if ((*setIter).GetSound() == *p_und) { if ((*setIter).GetSound() == p_sound) {
(*p_und)->FUN_10006b80(); p_sound->FUN_10006b80();
delete *p_und; delete p_sound;
m_set.erase(setIter); m_set.erase(setIter);
return; return;
} }
@ -167,8 +163,8 @@ void LegoCacheSoundManager::FUN_1003dc40(LegoCacheSound** p_und)
} }
LegoCacheSound* sound = (*listIter).GetSound(); LegoCacheSound* sound = (*listIter).GetSound();
if (sound == *p_und) { if (sound == p_sound) {
(*p_und)->FUN_10006b80(); p_sound->FUN_10006b80();
delete sound; delete sound;
m_list.erase(listIter); m_list.erase(listIter);

View File

@ -103,7 +103,7 @@ void LegoActor::ParseAction(char* p_extra)
} }
if (KeyValueStringParse(value, g_strSOUND, 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)) { if (KeyValueStringParse(value, g_strMUTE, p_extra)) {

View File

@ -204,7 +204,7 @@ void LegoWorld::Destroy(MxBool p_fromDestructor)
while (cursor.First(sound)) { while (cursor.First(sound)) {
cursor.Detach(); cursor.Detach();
SoundManager()->GetCacheSoundManager()->FUN_1003dc40(&sound); SoundManager()->GetCacheSoundManager()->Destroy(sound);
} }
delete m_cacheSoundList; delete m_cacheSoundList;

View File

@ -233,7 +233,7 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
m_roi->FUN_100a58f0(matrix2); m_roi->FUN_100a58f0(matrix2);
m_roi->VTable0x14(); m_roi->VTable0x14();
FUN_1002ad8a(); 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_scheduledTime = Timer()->GetTime() + m_disAnim->GetDuration();
m_prevWorldSpeed = m_worldSpeed; m_prevWorldSpeed = m_worldSpeed;
VTable0xc4(); VTable0xc4();
@ -245,7 +245,7 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
if (b) { if (b) {
LegoROI* roi = m_roi; LegoROI* roi = m_roi;
SoundManager()->GetCacheSoundManager()->FUN_1003dae0("crash5", m_roi->GetName(), FALSE); SoundManager()->GetCacheSoundManager()->Play("crash5", m_roi->GetName(), FALSE);
VTable0xc4(); VTable0xc4();
m_state = 0x102; m_state = 0x102;
Mx3DPointFloat dir = p_actor->GetWorldDirection(); Mx3DPointFloat dir = p_actor->GetWorldDirection();

View File

@ -278,7 +278,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
const char* var = VariableTable()->GetVariable(g_strHIT_WALL_SOUND); const char* var = VariableTable()->GetVariable(g_strHIT_WALL_SOUND);
if (var && var[0] != 0) { if (var && var[0] != 0) {
SoundManager()->GetCacheSoundManager()->FUN_1003dae0(var, NULL, FALSE); SoundManager()->GetCacheSoundManager()->Play(var, NULL, FALSE);
} }
} }