Implement/match LegoSoundManager::UpdateListener ()

This commit is contained in:
Christian Semmler 2024-06-01 17:13:57 -04:00 committed by GitHub
parent ac4e8da662
commit 1423eb56fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 50 additions and 19 deletions

View file

@ -19,7 +19,7 @@ public:
// SYNTHETIC: LEGO1 0x10029920
// LegoSoundManager::`scalar deleting destructor'
void FUN_1002a410(const float* p_pos, const float* p_dir, const float* p_up, const float* p_vel);
void UpdateListener(const float* p_position, const float* p_direction, const float* p_up, const float* p_velocity);
inline LegoCacheSoundManager* GetCacheSoundManager() { return m_cacheSoundManager; }

View file

@ -47,10 +47,10 @@ MxResult Lego3DSound::Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char
return FAILURE;
}
m_ds3dBuffer->SetMinDistance(15.0f, 0);
m_ds3dBuffer->SetMaxDistance(100.0f, 0);
m_ds3dBuffer->SetPosition(0.0f, 0.0f, -40.0f, 0);
m_ds3dBuffer->SetConeOutsideVolume(-10000, 0);
m_ds3dBuffer->SetMinDistance(15.0f, DS3D_IMMEDIATE);
m_ds3dBuffer->SetMaxDistance(100.0f, DS3D_IMMEDIATE);
m_ds3dBuffer->SetPosition(0.0f, 0.0f, -40.0f, DS3D_IMMEDIATE);
m_ds3dBuffer->SetConeOutsideVolume(-10000, DS3D_IMMEDIATE);
}
if (m_ds3dBuffer == NULL || p_name == NULL) {
@ -86,7 +86,7 @@ MxResult Lego3DSound::Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char
if (MxOmni::IsSound3D()) {
const float* position = m_positionROI->GetWorldPosition();
m_ds3dBuffer->SetPosition(position[0], position[1], position[2], 0);
m_ds3dBuffer->SetPosition(position[0], position[1], position[2], DS3D_IMMEDIATE);
}
LegoEntity* entity = m_roi->GetEntity();
@ -147,7 +147,7 @@ MxU32 Lego3DSound::UpdatePosition(LPDIRECTSOUNDBUFFER p_directSoundBuffer)
}
if (m_ds3dBuffer != NULL) {
m_ds3dBuffer->SetPosition(position[0], position[1], position[2], 0);
m_ds3dBuffer->SetPosition(position[0], position[1], position[2], DS3D_IMMEDIATE);
}
else {
MxS32 newVolume = m_volume;
@ -209,8 +209,8 @@ MxS32 Lego3DSound::SetDistance(MxS32 p_min, MxS32 p_max)
return -1;
}
m_ds3dBuffer->SetMinDistance(p_min, 0);
m_ds3dBuffer->SetMaxDistance(p_max, 0);
m_ds3dBuffer->SetMinDistance(p_min, DS3D_IMMEDIATE);
m_ds3dBuffer->SetMaxDistance(p_max, DS3D_IMMEDIATE);
return 0;
}

View file

@ -34,6 +34,7 @@ void LegoCacheSound::Init()
}
// STUB: LEGO1 0x10006710
// FUNCTION: BETA10 0x10066505
MxResult LegoCacheSound::FUN_10006710()
{
// TODO

View file

@ -97,8 +97,38 @@ MxResult LegoSoundManager::Tickle()
return m_cacheSoundManager->Tickle();
}
// STUB: LEGO1 0x1002a410
void LegoSoundManager::FUN_1002a410(const float* p_pos, const float* p_dir, const float* p_up, const float* p_vel)
// FUNCTION: LEGO1 0x1002a410
// FUNCTION: BETA10 0x100d03a5
void LegoSoundManager::UpdateListener(
const float* p_position,
const float* p_direction,
const float* p_up,
const float* p_velocity
)
{
// TODO
if (m_listener != NULL) {
if (p_position != NULL) {
m_listener->SetPosition(p_position[0], p_position[1], p_position[2], DS3D_DEFERRED);
}
if (p_direction != NULL && p_up != NULL) {
m_listener->SetOrientation(
p_direction[0],
p_direction[1],
p_direction[2],
p_up[0],
p_up[1],
p_up[2],
DS3D_DEFERRED
);
}
if (p_velocity != NULL) {
m_listener->SetVelocity(p_velocity[0], p_velocity[1], p_velocity[2], DS3D_DEFERRED);
}
if (p_position != NULL || (p_direction != NULL && p_up != NULL) || p_velocity != NULL) {
m_listener->CommitDeferredSettings();
}
}
}

View file

@ -2812,7 +2812,7 @@ void LegoAnimationManager::FUN_10064b50(MxLong p_time)
viewROI->WrappedSetLocalTransform(mat);
VideoManager()->Get3DManager()->Moved(*viewROI);
SoundManager()->FUN_1002a410(
SoundManager()->UpdateListener(
viewROI->GetWorldPosition(),
viewROI->GetWorldDirection(),
viewROI->GetWorldUp(),

View file

@ -369,7 +369,7 @@ void FUN_1003eda0()
LegoROI* viewROI = VideoManager()->GetViewROI();
if (viewROI) {
viewROI->FUN_100a5a30(vec);
SoundManager()->FUN_1002a410(
SoundManager()->UpdateListener(
viewROI->GetWorldPosition(),
viewROI->GetWorldDirection(),
viewROI->GetWorldUp(),

View file

@ -159,7 +159,7 @@ void LegoCameraController::FUN_100123e0(const Matrix4& p_transform, MxU32 p_und)
pov->WrappedSetLocalTransform(mat);
m_lego3DView->Moved(*pov);
SoundManager()->FUN_1002a410(
SoundManager()->UpdateListener(
pov->GetWorldPosition(),
pov->GetWorldDirection(),
pov->GetWorldUp(),

View file

@ -421,7 +421,7 @@ MxResult LegoNavController::UpdateLocation(const char* p_location)
viewROI->WrappedSetLocalTransform(mat);
VideoManager()->Get3DManager()->Moved(*viewROI);
SoundManager()->FUN_1002a410(
SoundManager()->UpdateListener(
viewROI->GetWorldPosition(),
viewROI->GetWorldDirection(),
viewROI->GetWorldUp(),
@ -458,7 +458,7 @@ MxResult LegoNavController::UpdateLocation(MxU32 p_location)
viewROI->WrappedSetLocalTransform(mat);
VideoManager()->Get3DManager()->Moved(*viewROI);
SoundManager()->FUN_1002a410(
SoundManager()->UpdateListener(
viewROI->GetWorldPosition(),
viewROI->GetWorldDirection(),
viewROI->GetWorldUp(),

View file

@ -156,7 +156,7 @@ MxResult LegoPointOfViewController::Tickle()
pov->WrappedSetLocalTransform(mat);
m_lego3DView->Moved(*pov);
SoundManager()->FUN_1002a410(
SoundManager()->UpdateListener(
pov->GetWorldPosition(),
pov->GetWorldDirection(),
pov->GetWorldUp(),
@ -172,7 +172,7 @@ MxResult LegoPointOfViewController::Tickle()
vel.Clear();
pov->FUN_100a5a30(vel);
SoundManager()->FUN_1002a410(
SoundManager()->UpdateListener(
pov->GetWorldPosition(),
pov->GetWorldDirection(),
pov->GetWorldUp(),