summary refs log tree commit diff
path: root/src/Person.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Person.cpp')
-rw-r--r--src/Person.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/Person.cpp b/src/Person.cpp
index bd1e5cb..f5eb314 100644
--- a/src/Person.cpp
+++ b/src/Person.cpp
@@ -213,12 +213,9 @@ void Person::DoAnimations(int who)
 		    && (targetanimation == joganim
 			|| targetanimation == walkanim)
 		    && (targetframe == 0 || targetframe == 8) && who == 0) {
-			auto soundsrc = (playercoords - camera.position)
-				/ soundscalefactor;
-			ALfloat gLoc[] {soundsrc.x, soundsrc.y, soundsrc.z};
-			int whichsound = footstepsound + abs(Random()) % 5;
-			alSourcefv(gSourceID[whichsound], AL_POSITION, gLoc);
-			alSourcePlay(gSourceID[whichsound]);
+			auto soundsrc = playercoords - camera.position;
+			playSound(gSourceID[footstepsound + abs(Random()) % 5],
+				soundsrc.x, soundsrc.y, soundsrc.z);
 		}
 
 		if (targetanimation == zombieeatanim && targetframe == 3) {
@@ -531,10 +528,9 @@ void Person::DoAnimations(int who)
 				ALint tempint;
 				alGetSourcei(gSourceID[reloadsound], AL_SOURCE_STATE, &tempint);
 				if (whichgun != grenade && tempint != AL_PLAYING) {
-					auto soundsrc = (playercoords - camera.position) / soundscalefactor;
-					ALfloat gLoc[] {soundsrc.x, soundsrc.y, soundsrc.z};
-					alSourcefv(gSourceID[reloadsound], AL_POSITION, gLoc);
-					alSourcePlay(gSourceID[reloadsound]);
+					auto soundsrc = playercoords - camera.position;
+					playSound(gSourceID[reloadsound],
+						soundsrc.x, soundsrc.y, soundsrc.z);
 				}
 				reloading = 3;
 				aiming = 0;
@@ -581,12 +577,9 @@ void Person::DoAnimationslite(int who)
 		    && (targetanimation == joganim
 		        || targetanimation == walkanim)
 		    && (targetframe == 0 || targetframe == 8)) {
-			auto soundsrc = (playercoords - camera.position)
-				/ soundscalefactor;
-			ALfloat gLoc[] {soundsrc.x, soundsrc.y, soundsrc.z};
-			int whichsound = footstepsound + abs(Random()) % 5;
-			alSourcefv(gSourceID[whichsound], AL_POSITION, gLoc);
-			alSourcePlay(gSourceID[whichsound]);
+			auto soundsrc = playercoords - camera.position;
+			playSound(gSourceID[footstepsound + abs(Random()) % 5],
+				soundsrc.x, soundsrc.y, soundsrc.z);
 		}
 
 		if (targetanimation == zombieeatanim && targetframe == 3) {