summaryrefslogtreecommitdiffstats
path: root/src/audio/AudioManager.cpp
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-08-23 10:16:53 +0200
committerSergeanur <s.anureev@yandex.ua>2021-08-23 10:16:53 +0200
commitef0ba763b913f997d48657f9d5a9fa1a9881453d (patch)
tree1b536254f76c8c8210be11ae46d50d7eda0dd202 /src/audio/AudioManager.cpp
parentCam: Fix can't look to right on BEHINDCAR (diff)
downloadre3-ef0ba763b913f997d48657f9d5a9fa1a9881453d.tar
re3-ef0ba763b913f997d48657f9d5a9fa1a9881453d.tar.gz
re3-ef0ba763b913f997d48657f9d5a9fa1a9881453d.tar.bz2
re3-ef0ba763b913f997d48657f9d5a9fa1a9881453d.tar.lz
re3-ef0ba763b913f997d48657f9d5a9fa1a9881453d.tar.xz
re3-ef0ba763b913f997d48657f9d5a9fa1a9881453d.tar.zst
re3-ef0ba763b913f997d48657f9d5a9fa1a9881453d.zip
Diffstat (limited to '')
-rw-r--r--src/audio/AudioManager.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index e42712dc..f92e15fc 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -1013,7 +1013,7 @@ cAudioManager::ProcessActiveQueues()
for (int32 j = 0; j < m_nActiveSamples; j++) {
if (sample.m_nEntityIndex == m_asActiveSamples[j].m_nEntityIndex && sample.m_nCounter == m_asActiveSamples[j].m_nCounter &&
sample.m_nSampleIndex == m_asActiveSamples[j].m_nSampleIndex) {
- if (sample.m_nLoopCount) {
+ if (sample.m_nLoopCount > 0) {
if (m_FrameCounter & 1)
flag = !!(j & 1);
else
@@ -1047,6 +1047,24 @@ cAudioManager::ProcessActiveQueues()
SampleManager.SetChannelVolume(j, emittingVol);
#endif
} else {
+#ifdef ATTACH_PED_COMMENTS_TO_ENTITIES
+ if (sample.m_nCounter <= 255 && sample.m_nSampleIndex >= SAMPLEBANK_PED_START && sample.m_nSampleIndex <= SAMPLEBANK_PED_END) {
+ CEntity* entity = (CEntity*)GetEntityPointer(sample.m_nEntityIndex);
+ if (entity && m_asAudioEntities[sample.m_nEntityIndex].m_nType == AUDIOTYPE_PHYSICAL) {
+ sample.m_vecPos = entity->GetPosition();
+ sample.m_fDistance = Sqrt(GetDistanceSquared(sample.m_vecPos));
+ uint8 vol;
+ if (CWorld::GetIsLineOfSightClear(TheCamera.GetPosition(), sample.m_vecPos, true, false, false, false, false, false))
+ vol = MAX_VOLUME;
+ else
+ vol = 31;
+#ifdef EXTERNAL_3D_SOUND
+ sample.m_nEmittingVolume = vol;
+#endif
+ sample.m_nVolume = ComputeVolume(vol, sample.m_MaxDistance, sample.m_fDistance);
+ }
+ }
+#endif
position2 = sample.m_fDistance;
position1 = m_asActiveSamples[j].m_fDistance;
m_asActiveSamples[j].m_fDistance = sample.m_fDistance;