From 9953dae353e6166946e21430f63854927d1db2d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Fri, 29 Oct 2021 11:56:11 +0700 Subject: Make the rest keys configurable --- src/Person.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/Person.cpp') diff --git a/src/Person.cpp b/src/Person.cpp index d096b1d..fb05907 100644 --- a/src/Person.cpp +++ b/src/Person.cpp @@ -631,14 +631,13 @@ void Person::control() else speed = (targetanimation == joganim) ? 2.2 : 2.5; - if (keyPress(GLFW_KEY_LEFT_CONTROL) - && currentanimation == idleanim + auto crouch = keyPress(keymap.crouch); + if (crouch && currentanimation == idleanim && targetanimation == idleanim) { targetanimation = crouchanim; target = 0; } - if (!keyPress(GLFW_KEY_LEFT_CONTROL) - && currentanimation == crouchanim + if (!crouch && currentanimation == crouchanim && targetanimation == crouchanim) { targetanimation = idleanim; target = 0; @@ -649,7 +648,7 @@ void Person::control() if ((onground || visions) && currentanimation != crouchanim) { playerlowrotation -= right * (forwards ? forwards * 45 : 90); backwardsanim = forwards < 0; - auto moveanim = (keyPress(GLFW_KEY_LEFT_SHIFT) || visions) + auto moveanim = (keyPress(keymap.accelerate) || visions) ? joganim : walkanim; // Should jog be the default? if (forwards || right) { if (targetanimation != moveanim) { -- cgit v1.2.3