From 76e6ddd90bec03a66f28e4950a884eae3dc66805 Mon Sep 17 00:00:00 2001 From: Allanis Date: Sat, 15 Nov 2014 19:00:14 +0000 Subject: [PATCH] [Fix] Fixed bug with sound volumes. --- src/sound.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sound.c b/src/sound.c index d0d7f90..3cadaa6 100644 --- a/src/sound.c +++ b/src/sound.c @@ -311,6 +311,7 @@ int sound_playPos(int sound, double x, double y) { */ int sound_updatePos(int voice, double x, double y) { alVoice* v; + int idist; double angle, dist; double px, py; @@ -329,7 +330,10 @@ int sound_updatePos(int voice, double x, double y) { angle = sound_pos[2] - ANGLE(px, py)/M_PI*180.; dist = MOD(px, py); - if(Mix_SetPosition(v->channel, (int)angle, (int)dist/10) < 0) { + idist = (int)dist / 13.; + if(idist > 255) idist = 255; + + if(Mix_SetPosition(v->channel, (Sint16)angle, (Uint8)idist) < 0) { WARN("Unable to set sound position: %s", Mix_GetError()); return -1; }