summary refs log tree commit diff
path: root/src/Skeleton.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Skeleton.cpp')
-rw-r--r--src/Skeleton.cpp24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/Skeleton.cpp b/src/Skeleton.cpp
index 4f2a2a7..7dcdaa1 100644
--- a/src/Skeleton.cpp
+++ b/src/Skeleton.cpp
@@ -1,7 +1,7 @@
 /**> HEADER FILES <**/
 #include "Skeleton.h"
-
 #include "Serialize.h"
+#include "misc.h"
 
 extern float multiplier;
 extern unsigned int gSourceID[37];
@@ -169,25 +169,9 @@ void Skeleton::DoConstraints(Model *collide, XYZ *move, float rotation)
 				if (playing != AL_PLAYING
 				    && (findLengthfast(joints[i].velocity) > 2
 				        || findLengthfast(avgvelocity) > 2)) {
-					ALfloat gain =
-						findLengthfast(avgvelocity
-							+ joints[i].velocity)
-						/ findDistancefast(pos,
-							camera.position)
-						* soundscalefactor * 4;
-					alSourcef(gSourceID[landsound],
-						AL_MIN_GAIN, gain);
-					alSourcef(gSourceID[landsound],
-						AL_MAX_GAIN, gain);
-
-					float gLoc[] {
-						pos.x / soundscalefactor,
-						pos.y / soundscalefactor,
-						pos.z / soundscalefactor,
-					};
-					alSourcefv(gSourceID[landsound],
-						AL_POSITION, gLoc);
-					alSourcePlay(gSourceID[landsound]);
+					auto soundpos = pos - camera.position;
+					playSound(gSourceID[landsound],
+						soundpos.x, soundpos.y, soundpos.z);
 				}
 			}
 		}