From 8bfbca0b2329605b92e0242ebd40bfad7372ba28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Fri, 1 Oct 2021 17:22:11 +0700 Subject: Change a few more sounds --- src/Person.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'src/Person.cpp') 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) { -- cgit v1.2.3