Implement/match Lego3DSound::SetDistance and Reset ()

This commit is contained in:
Christian Semmler 2024-06-01 13:45:22 -04:00 committed by GitHub
parent 919a3f5c49
commit ac4e8da662
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 42 additions and 19 deletions

View file

@ -20,8 +20,8 @@ public:
MxResult Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char* p_name, MxS32 p_volume);
void Destroy();
MxU32 UpdatePosition(LPDIRECTSOUNDBUFFER p_directSoundBuffer);
void FUN_10011ca0();
MxS32 FUN_10011cf0(undefined4, undefined4);
void Reset();
MxS32 SetDistance(MxS32 p_min, MxS32 p_max);
// SYNTHETIC: LEGO1 0x10011650
// Lego3DSound::`scalar deleting destructor'

View file

@ -37,7 +37,7 @@ public:
MxResult FUN_10006a30(const char* p_str, MxBool);
void FUN_10006b80();
void FUN_10006be0();
void FUN_10006cb0(undefined4 p_und1, undefined4 p_und2);
void SetDistance(MxS32 p_min, MxS32 p_max);
// SYNTHETIC: LEGO1 0x10006610
// LegoCacheSound::`scalar deleting destructor'
@ -47,7 +47,7 @@ private:
LPDIRECTSOUNDBUFFER m_dsBuffer; // 0x08
undefined m_unk0xc[4]; // 0x0c
Lego3DSound m_unk0x10; // 0x10
Lego3DSound m_sound; // 0x10
undefined* m_unk0x40; // 0x40
undefined4 m_unk0x44; // 0x44
MxString m_string0x48; // 0x48

View file

@ -1,14 +1,14 @@
#ifndef LEGOWORLD_H
#define LEGOWORLD_H
#include "legocachesoundlist.h"
#include "legoentity.h"
#include "legoentitylist.h"
#include "legopathcontrollerlist.h"
#include "mxpresenterlist.h"
#include "roi/legoroi.h"
class LegoCacheSoundList;
class LegoCameraController;
class LegoEntityList;
class LegoPathBoundary;
class LegoHideAnimPresenter;

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"