diff options
Diffstat (limited to 'src/GameLoop.cpp')
-rw-r--r-- | src/GameLoop.cpp | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/src/GameLoop.cpp b/src/GameLoop.cpp index cc383c8..3364bc2 100644 --- a/src/GameLoop.cpp +++ b/src/GameLoop.cpp @@ -158,30 +158,21 @@ void handleKey(Game* game, int key, int action, int mods) if (!game->debug) return; - const auto shift = mods & GLFW_MOD_SHIFT; - XYZ facing; - - switch(key) { - case GLFW_KEY_TAB: + if (key == keymap.switch_view) { thirdperson = (thirdperson == 2) ? 0 : (thirdperson + 1); - break; - case GLFW_KEY_K: + } else if (key == keymap.skip) { game->timeremaining = 0; - break; - case GLFW_KEY_B: + } else if (key == keymap.pause) { alSourcePlay(gSourceID[soulinsound]); - if (shift) { - game->paused = 1 - game->paused; - } else { - auto pitch = (slomo ^= 1) ? 0.5f : 1.0f; - alSourcef(gSourceID[knifesong], AL_PITCH, pitch); - alSourcef(gSourceID[shootsong], AL_PITCH, pitch); - alSourcef(gSourceID[zombiesong], AL_PITCH, pitch); - } - break; - case GLFW_KEY_F: - facing = {0, 0, -1}; - facing = DoRotation(facing, -camera.rotation2, 0, 0); + game->paused = 1 - game->paused; + } else if (key == keymap.slomo) { + alSourcePlay(gSourceID[soulinsound]); + auto pitch = (slomo ^= 1) ? 0.5f : 1.0f; + alSourcef(gSourceID[knifesong], AL_PITCH, pitch); + alSourcef(gSourceID[shootsong], AL_PITCH, pitch); + alSourcef(gSourceID[zombiesong], AL_PITCH, pitch); + } else if (key == keymap.force) { + auto facing = DoRotation({0, 0, -1}, -camera.rotation2, 0, 0); facing = DoRotation(facing, 0, 0 - camera.rotation, 0); alSourcePlay(gSourceID[souloutsound]); @@ -208,17 +199,15 @@ void handleKey(Game* game, int key, int action, int mods) joint.velocity.z += abs(Random() % 20) - 10; } } - break; - case GLFW_KEY_X: + } else if (key == keymap.switch_weapon) { if (player.grenphase) - break; + return; player.grenphase = 0; player.ammo = -1; player.whichgun++; if (player.whichgun > 7) player.whichgun = 0; player.reloads[player.whichgun] = 3; - break; } } |