From: Juhu <5894800-Juhu_@users.noreply.gitlab.com>
Date: Tue, 23 Jun 2020 18:16:25 +0000 (+0200)
Subject: strafehud: make forward/backward detection work correctly with all kinds of strafing
X-Git-Tag: xonotic-v0.8.5~738^2~36
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e54ecda027c2176d9b8040a2784311d64984d547;p=xonotic%2Fxonotic-data.pk3dir.git

strafehud: make forward/backward detection work correctly with all kinds of strafing
---

diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc
index fdf636891..5e2f3ecfa 100644
--- a/qcsrc/client/hud/panel/strafehud.qc
+++ b/qcsrc/client/hud/panel/strafehud.qc
@@ -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;
                 }