diff options
Diffstat (limited to 'src/GameTick.cpp')
-rw-r--r-- | src/GameTick.cpp | 24 |
1 files changed, 9 insertions, 15 deletions
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); } } } |