]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
strafehud: make forward/backward detection work correctly with all kinds of strafing
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Tue, 23 Jun 2020 18:16:25 +0000 (20:16 +0200)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Tue, 23 Jun 2020 18:16:25 +0000 (20:16 +0200)
qcsrc/client/hud/panel/strafehud.qc

index fdf63689171b7a3e9777f07e58c9d066f3736d10..5e2f3ecfae71247466b88ba4a1c0a313a1a263b8 100644 (file)
@@ -349,7 +349,7 @@ void HUD_StrafeHUD()
                 }
                 state_fwd_prev = state_fwd;
 
-                if((time - state_fwd_time) >= autocvar_hud_panel_strafehud_timeout_direction || speed < maxspeed) // timeout when changing between forwards and backwards movement
+                if((time - state_fwd_time) >= autocvar_hud_panel_strafehud_timeout_direction || speed < maxspeed || strafekeys) // timeout when changing between forwards and backwards movement
                 {
                     fwd = state_fwd;
                 }
@@ -568,8 +568,9 @@ void HUD_StrafeHUD()
             if(direction != 0)
             {
                 bool indicator_direction = direction < 0;
-                // invert left/right if strafing backwards
-                if(fwd == false)
+                // invert left/right when strafing backwards or when strafing towards the opposite side indicated by the direction variable
+                // if both conditions are true then it's inverted twice hence not inverted at all
+                if(!fwd != odd_angles)
                 {
                     indicator_direction = !indicator_direction;
                 }