diff options
-rw-r--r-- | Data/sounds/Nearbullet.ogg | bin | 6408 -> 0 bytes | |||
-rw-r--r-- | Data/sounds/footstep/0.ogg (renamed from Data/sounds/footstep5.ogg) | bin | 5547 -> 5547 bytes | |||
-rw-r--r-- | Data/sounds/footstep/1.ogg (renamed from Data/sounds/footstep1.ogg) | bin | 5861 -> 5861 bytes | |||
-rw-r--r-- | Data/sounds/footstep/2.ogg (renamed from Data/sounds/footstep2.ogg) | bin | 6096 -> 6096 bytes | |||
-rw-r--r-- | Data/sounds/footstep/3.ogg (renamed from Data/sounds/footstep3.ogg) | bin | 6667 -> 6667 bytes | |||
-rw-r--r-- | Data/sounds/footstep/4.ogg (renamed from Data/sounds/footstep4.ogg) | bin | 5831 -> 5831 bytes | |||
-rw-r--r-- | Data/sounds/grenade/pin-pull.flac | bin | 0 -> 15476 bytes | |||
-rw-r--r-- | Data/sounds/grenade/pin-replace.flac | bin | 0 -> 12498 bytes | |||
-rw-r--r-- | Data/sounds/gun/near-bullet.wav | bin | 0 -> 35848 bytes | |||
-rw-r--r-- | Data/sounds/gun/reload.wav | bin | 0 -> 301206 bytes | |||
-rw-r--r-- | Data/sounds/pinpull.ogg | bin | 4311 -> 0 bytes | |||
-rw-r--r-- | Data/sounds/pinreplace.ogg | bin | 4471 -> 0 bytes | |||
-rw-r--r-- | Data/sounds/reload.ogg | bin | 16577 -> 0 bytes | |||
-rw-r--r-- | src/GameInitDispose.cpp | 18 | ||||
-rw-r--r-- | src/GameTick.cpp | 24 | ||||
-rw-r--r-- | src/Person.cpp | 25 |
16 files changed, 27 insertions, 40 deletions
diff --git a/Data/sounds/Nearbullet.ogg b/Data/sounds/Nearbullet.ogg deleted file mode 100644 index cfff9a7..0000000 --- a/Data/sounds/Nearbullet.ogg +++ /dev/null Binary files differdiff --git a/Data/sounds/footstep5.ogg b/Data/sounds/footstep/0.ogg index 77ed23b..77ed23b 100644 --- a/Data/sounds/footstep5.ogg +++ b/Data/sounds/footstep/0.ogg Binary files differdiff --git a/Data/sounds/footstep1.ogg b/Data/sounds/footstep/1.ogg index 15f0396..15f0396 100644 --- a/Data/sounds/footstep1.ogg +++ b/Data/sounds/footstep/1.ogg Binary files differdiff --git a/Data/sounds/footstep2.ogg b/Data/sounds/footstep/2.ogg index d0b9634..d0b9634 100644 --- a/Data/sounds/footstep2.ogg +++ b/Data/sounds/footstep/2.ogg Binary files differdiff --git a/Data/sounds/footstep3.ogg b/Data/sounds/footstep/3.ogg index 05bc694..05bc694 100644 --- a/Data/sounds/footstep3.ogg +++ b/Data/sounds/footstep/3.ogg Binary files differdiff --git a/Data/sounds/footstep4.ogg b/Data/sounds/footstep/4.ogg index 4545d44..4545d44 100644 --- a/Data/sounds/footstep4.ogg +++ b/Data/sounds/footstep/4.ogg Binary files differdiff --git a/Data/sounds/grenade/pin-pull.flac b/Data/sounds/grenade/pin-pull.flac new file mode 100644 index 0000000..51f5708 --- /dev/null +++ b/Data/sounds/grenade/pin-pull.flac Binary files differdiff --git a/Data/sounds/grenade/pin-replace.flac b/Data/sounds/grenade/pin-replace.flac new file mode 100644 index 0000000..fd0b91b --- /dev/null +++ b/Data/sounds/grenade/pin-replace.flac Binary files differdiff --git a/Data/sounds/gun/near-bullet.wav b/Data/sounds/gun/near-bullet.wav new file mode 100644 index 0000000..6e7091c --- /dev/null +++ b/Data/sounds/gun/near-bullet.wav Binary files differdiff --git a/Data/sounds/gun/reload.wav b/Data/sounds/gun/reload.wav new file mode 100644 index 0000000..402a7e7 --- /dev/null +++ b/Data/sounds/gun/reload.wav Binary files differdiff --git a/Data/sounds/pinpull.ogg b/Data/sounds/pinpull.ogg deleted file mode 100644 index 08e7ef9..0000000 --- a/Data/sounds/pinpull.ogg +++ /dev/null Binary files differdiff --git a/Data/sounds/pinreplace.ogg b/Data/sounds/pinreplace.ogg deleted file mode 100644 index 7f4508a..0000000 --- a/Data/sounds/pinreplace.ogg +++ /dev/null Binary files differdiff --git a/Data/sounds/reload.ogg b/Data/sounds/reload.ogg deleted file mode 100644 index 4147992..0000000 --- a/Data/sounds/reload.ogg +++ /dev/null Binary files differdiff --git a/src/GameInitDispose.cpp b/src/GameInitDispose.cpp index 600a6a4..0022a07 100644 --- a/src/GameInitDispose.cpp +++ b/src/GameInitDispose.cpp @@ -109,12 +109,21 @@ Game* makeGame(Config config) void LoadSounds(bool musictoggle) { + gSampleSet[footstepsound + 0] = loadSound("footstep/0.ogg"); + gSampleSet[footstepsound + 1] = loadSound("footstep/1.ogg"); + gSampleSet[footstepsound + 2] = loadSound("footstep/2.ogg"); + gSampleSet[footstepsound + 3] = loadSound("footstep/3.ogg"); + gSampleSet[footstepsound + 4] = loadSound("footstep/4.ogg"); gSampleSet[clicksound] = loadSound("gun/empty-clip.wav"); gSampleSet[shotgunsound] = loadSound("gun/fire/20-gauge-shotgun.wav"); gSampleSet[pistol2sound] = loadSound("gun/fire/22-magnum-pistol.wav"); gSampleSet[pistol1sound] = loadSound("gun/fire/9-mm-pistol.wav"); gSampleSet[machinegunsound] = loadSound("gun/fire/ar-15-pistol.wav"); gSampleSet[riflesound] = loadSound("gun/fire/ar-15-rifle.wav"); + gSampleSet[nearbulletsound] = loadSound("gun/near-bullet.wav"); + gSampleSet[reloadsound] = loadSound("gun/reload.wav"); + gSampleSet[pinpullsound] = loadSound("grenade/pin-pull.flac"); + gSampleSet[pinreplacesound] = loadSound("grenade/pin-replace.flac"); gSampleSet[bodylandsound] = loadSound("impact/body-fall.wav"); gSampleSet[bodyhitsound] = loadSound("impact/body-hit.wav"); gSampleSet[knifeslashsound] = loadSound("impact/knife-stab.wav"); @@ -123,18 +132,9 @@ void LoadSounds(bool musictoggle) gSampleSet[visionsound] = loadSound("underwater.ogg"); gSampleSet[soulinsound] = loadSound("soul-in.ogg"); gSampleSet[souloutsound] = loadSound("soul-out.ogg"); - gSampleSet[footstepsound + 0] = loadSound("footstep1.ogg"); - gSampleSet[footstepsound + 1] = loadSound("footstep2.ogg"); - gSampleSet[footstepsound + 2] = loadSound("footstep3.ogg"); - gSampleSet[footstepsound + 3] = loadSound("footstep4.ogg"); - gSampleSet[footstepsound + 4] = loadSound("footstep5.ogg"); gSampleSet[headlandsound] = loadSound("headland.ogg"); - gSampleSet[nearbulletsound] = loadSound("Nearbullet.ogg"); gSampleSet[headwhacksound] = loadSound("riflewhack.ogg"); gSampleSet[headshotsound] = loadSound("headshot.ogg"); - gSampleSet[reloadsound] = loadSound("reload.ogg"); - gSampleSet[pinpullsound] = loadSound("pinpull.ogg"); - gSampleSet[pinreplacesound] = loadSound("pinreplace.ogg"); gSampleSet[grenadethrowsound] = loadSound("handlerelease.ogg"); gSampleSet[bouncesound] = loadSound("bounce.ogg"); gSampleSet[bounce2sound] = loadSound("bounce2.ogg"); diff --git a/src/GameTick.cpp b/src/GameTick.cpp index 3b9cf5a..4e75895 100644 --- a/src/GameTick.cpp +++ b/src/GameTick.cpp @@ -198,7 +198,7 @@ void click(Game* game, int button, int action, int mods) if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_PRESS && player.attackframe < 0 && (!player.aiming || player.ammo <= 0 - || weapon == nogun || weapon == knife || weapon == grenade + || weapon == nogun || weapon == knife || player.targetanimation == joganim) && player.targetanimation != diveanim && player.targetanimation != throwanim) { @@ -288,9 +288,8 @@ void click(Game* game, int button, int action, int mods) && player.reloading <= 0 && player.attackframe < 0) { auto& skeleton = player.skeleton; auto& hand = skeleton.joints[skeleton.jointlabels[righthand]]; - auto soundsrc = (DoRotation(hand.position, 0, player.playerrotation, 0) - + player.playercoords - camera.position) / soundscalefactor; - float gLoc[] {soundsrc.x, soundsrc.y, soundsrc.z}; + auto soundsrc = DoRotation(hand.position, 0, player.playerrotation, 0) + + player.playercoords - camera.position; if (player.grenphase) { if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_RELEASE) { // throw @@ -301,15 +300,15 @@ void click(Game* game, int button, int action, int mods) } else if (button == GLFW_MOUSE_BUTTON_RIGHT && action == GLFW_PRESS) { // put pin back player.grenphase = false; - alSourcefv(gSourceID[pinreplacesound], AL_POSITION, gLoc); - alSourcePlay(gSourceID[pinreplacesound]); + playSound(gSourceID[pinreplacesound], + soundsrc.x, soundsrc.y, soundsrc.z); } } else { if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_PRESS) { // pull pin player.grenphase = true; - alSourcefv(gSourceID[pinpullsound], AL_POSITION, gLoc); - alSourcePlay(gSourceID[pinpullsound]); + playSound(gSourceID[pinpullsound], + soundsrc.x, soundsrc.y, soundsrc.z); } } } @@ -2460,13 +2459,8 @@ void Game::Tick() && findDistancefast(nearest, camera.position) < 10 && (thirdperson == 2 || j != 0)) { auto nearsound = nearest - camera.position; - ALfloat gLoc[] { - nearsound.x / soundscalefactor, - nearsound.y / soundscalefactor, - nearsound.z / soundscalefactor, - }; - alSourcefv(gSourceID[nearbulletsound], AL_POSITION, gLoc); - alSourcePlay(gSourceID[nearbulletsound]); + playSound(gSourceID[nearbulletsound], + nearsound.x, nearsound.y, nearsound.z); } } } 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) { |