summaryrefslogtreecommitdiff
path: root/src/audio/AudioManager.cpp
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-08-23 11:15:03 +0300
committerSergeanur <s.anureev@yandex.ua>2021-08-23 11:15:03 +0300
commitceb65eafa5374bbde2e39efed27bb2f87fb31901 (patch)
treed2a455baab94c83ad633616ebc455e102a904810 /src/audio/AudioManager.cpp
parent6110f74ad66fea524b0983695f6f6f2b5dd2002f (diff)
Make ped comments update position and volume
Diffstat (limited to 'src/audio/AudioManager.cpp')
-rw-r--r--src/audio/AudioManager.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index 425a897d..eeebcebb 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -10,6 +10,7 @@
#include "sampman.h"
#include "Camera.h"
#include "World.h"
+#include "Entity.h"
cAudioManager AudioManager;
@@ -903,6 +904,24 @@ cAudioManager::ProcessActiveQueues()
SampleManager.SetChannelVolume(j, sample.m_nVolume);
#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;