Implement/match LegoSoundManager::UpdateListener (#985)

This commit is contained in:
Christian Semmler
2024-06-01 17:13:57 -04:00
committed by GitHub
parent ac4e8da662
commit 1423eb56fc
9 changed files with 50 additions and 19 deletions

View File

@@ -19,7 +19,7 @@ public:
// SYNTHETIC: LEGO1 0x10029920 // SYNTHETIC: LEGO1 0x10029920
// LegoSoundManager::`scalar deleting destructor' // 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; } inline LegoCacheSoundManager* GetCacheSoundManager() { return m_cacheSoundManager; }

View File

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

View File

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

View File

@@ -97,8 +97,38 @@ MxResult LegoSoundManager::Tickle()
return m_cacheSoundManager->Tickle(); return m_cacheSoundManager->Tickle();
} }
// STUB: LEGO1 0x1002a410 // FUNCTION: LEGO1 0x1002a410
void LegoSoundManager::FUN_1002a410(const float* p_pos, const float* p_dir, const float* p_up, const float* p_vel) // 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); viewROI->WrappedSetLocalTransform(mat);
VideoManager()->Get3DManager()->Moved(*viewROI); VideoManager()->Get3DManager()->Moved(*viewROI);
SoundManager()->FUN_1002a410( SoundManager()->UpdateListener(
viewROI->GetWorldPosition(), viewROI->GetWorldPosition(),
viewROI->GetWorldDirection(), viewROI->GetWorldDirection(),
viewROI->GetWorldUp(), viewROI->GetWorldUp(),

View File

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

View File

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

View File

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

View File

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