Implement/match Lego3DSound::SetDistance and Reset (#984)

This commit is contained in:
Christian Semmler
2024-06-01 13:45:22 -04:00
committed by GitHub
parent 919a3f5c49
commit ac4e8da662
8 changed files with 42 additions and 19 deletions

View File

@@ -184,15 +184,35 @@ MxU32 Lego3DSound::UpdatePosition(LPDIRECTSOUNDBUFFER p_directSoundBuffer)
return updated;
}
// STUB: LEGO1 0x10011ca0
void Lego3DSound::FUN_10011ca0()
// FUNCTION: LEGO1 0x10011ca0
void Lego3DSound::Reset()
{
// TODO
if (m_enabled && m_roi && CharacterManager()) {
if (m_isActor) {
CharacterManager()->ReleaseActor(m_roi);
}
else {
CharacterManager()->ReleaseAutoROI(m_roi);
}
}
m_roi = NULL;
m_positionROI = NULL;
m_actor = NULL;
}
// STUB: LEGO1 0x10011cf0
MxS32 Lego3DSound::FUN_10011cf0(undefined4, undefined4)
// FUNCTION: LEGO1 0x10011cf0
MxS32 Lego3DSound::SetDistance(MxS32 p_min, MxS32 p_max)
{
// TODO
return 0;
if (MxOmni::IsSound3D()) {
if (m_ds3dBuffer == NULL) {
return -1;
}
m_ds3dBuffer->SetMinDistance(p_min, 0);
m_ds3dBuffer->SetMaxDistance(p_max, 0);
return 0;
}
return 1;
}

View File

@@ -100,7 +100,7 @@ void LegoCacheSound::FUN_10006b80()
m_unk0x58 = 0;
m_unk0x6a = FALSE;
m_unk0x10.FUN_10011ca0();
m_sound.Reset();
if (m_string0x74.GetLength() != 0) {
m_string0x74 = "";
}
@@ -123,7 +123,7 @@ void LegoCacheSound::FUN_10006be0()
if (dwStatus == 0) {
m_dsBuffer->Stop();
m_unk0x10.FUN_10011ca0();
m_sound.Reset();
if (m_string0x74.GetLength() != 0) {
m_string0x74 = "";
}
@@ -134,7 +134,7 @@ void LegoCacheSound::FUN_10006be0()
}
if (m_string0x74.GetLength() != 0 && !m_unk0x84) {
if (!m_unk0x10.UpdatePosition(m_dsBuffer)) {
if (!m_sound.UpdatePosition(m_dsBuffer)) {
if (m_unk0x6a) {
return;
}
@@ -150,9 +150,9 @@ void LegoCacheSound::FUN_10006be0()
}
// FUNCTION: LEGO1 0x10006cb0
void LegoCacheSound::FUN_10006cb0(undefined4 p_und1, undefined4 p_und2)
void LegoCacheSound::SetDistance(MxS32 p_min, MxS32 p_max)
{
m_unk0x10.FUN_10011cf0(p_und1, p_und2);
m_sound.SetDistance(p_min, p_max);
}
// FUNCTION: LEGO1 0x10006cd0

View File

@@ -619,7 +619,7 @@ void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxU32 p_length
if (p_haveSound) {
m_sound = SoundManager()->GetCacheSoundManager()->FindSoundByKey("bcrash");
m_sound->FUN_10006cb0(35, 60);
m_sound->SetDistance(35, 60);
}
if (m_numEntries == 0) {

View File

@@ -9,6 +9,7 @@
#include "legoanimpresenter.h"
#include "legocharactermanager.h"
#include "legoendanimnotificationparam.h"
#include "legoentitylist.h"
#include "legoextraactor.h"
#include "legogamestate.h"
#include "legolocomotionanimpresenter.h"

View File

@@ -4,9 +4,11 @@
#include "legoanimationmanager.h"
#include "legoanimpresenter.h"
#include "legobuildingmanager.h"
#include "legocachesoundlist.h"
#include "legocachesoundmanager.h"
#include "legocameracontroller.h"
#include "legocontrolmanager.h"
#include "legoentitylist.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legolocomotionanimpresenter.h"