]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
strafehud: remove timeout value for left/right strafe again as it is buggy and unnece...
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Tue, 23 Jun 2020 14:39:03 +0000 (16:39 +0200)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Tue, 23 Jun 2020 14:39:03 +0000 (16:39 +0200)
_hud_common.cfg
qcsrc/client/autocvars.qh
qcsrc/client/hud/panel/strafehud.qc

index 37be5ca364f39df28a6c658f1cf022b11e730721..94bba1ba4f105acdf8b3833164c02507ca299da0 100644 (file)
@@ -146,8 +146,7 @@ seta hud_panel_strafehud_direction_length "0.0225" "direction indicator length r
 seta hud_panel_strafehud_timeout_air "0" "time after take off before changing strafehud mode (prevents flickering on slick ramps)"
 seta hud_panel_strafehud_timeout_ground "0.03333333" "time after landing before changing strafehud mode (prevents flickering on regular strafe turns)"
 seta hud_panel_strafehud_timeout_strafe "0.1" "time after releasing the strafe keys before changing mode (prevents flickering when switching between left/right strafe turning)"
-seta hud_panel_strafehud_timeout_fwd_bkwd "0.5" "time it takes until direction changes (forward or backward movement) are detected"
-seta hud_panel_strafehud_timeout_left_right "0" "time it takes until direction changes (left or right movement) are detected"
+seta hud_panel_strafehud_timeout_direction "0.5" "time it takes until direction changes (forward or backward movement) are detected"
 seta hud_panel_strafehud_unstyled "0" "don't apply any progressbar styles to the strafehud"
 seta hud_panel_strafehud_antiflicker_angle "0.01" "how many degrees from 0° to 180° the hud ignores if it could cause visual disturbances otherwise"
 seta hud_panel_strafehud_antiflicker_speed "0.0001" "how many qu/s the hud ignores if it could cause visual disturbances otherwise"
index cf97f8b42eac0006c9f452b75cc340d3da30f52f..018672f44e9f53501519660a5f4b0210213d6e45 100644 (file)
@@ -344,8 +344,7 @@ float autocvar_hud_panel_strafehud_direction_length = 0.0225;
 float autocvar_hud_panel_strafehud_timeout_air = 0;
 float autocvar_hud_panel_strafehud_timeout_ground = 0.03333333;
 float autocvar_hud_panel_strafehud_timeout_strafe = 0.1;
-float autocvar_hud_panel_strafehud_timeout_fwd_bkwd = 0.5;
-float autocvar_hud_panel_strafehud_timeout_left_right = 0;
+float autocvar_hud_panel_strafehud_timeout_direction = 0.5;
 bool autocvar_hud_panel_strafehud_unstyled = false;
 float autocvar_hud_panel_strafehud_antiflicker_angle = 0.01;
 float autocvar_hud_panel_strafehud_antiflicker_speed = 0.0001;
index 890cc265135593cb09fdfce6d6db8d8a1ce76c9c..479cb2b182092fbe7249e5859f25dda6cc2cba35 100644 (file)
@@ -21,9 +21,6 @@ void HUD_StrafeHUD_Export(int fh)
 bool fwd = true;
 bool state_fwd = true;
 bool state_fwd_prev = true;
-int direction = 0;
-bool state_direction = true;
-bool state_direction_prev = true;
 float hidden_width;
 float demo_angle = -37;
 float demo_direction = 1;
@@ -31,7 +28,6 @@ float demo_time = 0;
 float state_onground_time = 0;
 float state_strafekeys_time = 0;
 float state_fwd_time = 0;
-float state_direction_time = 0;
 bool state_onground = false;
 bool state_strafekeys = false;
 bool turn = false;
@@ -99,6 +95,7 @@ void HUD_StrafeHUD()
         float  vel_angle                     = vectoangles(strafeplayer.velocity).y;
         float  view_angle                    = view_angles.y + 180;
         float  angle;
+        int    direction;
         vector movement                      = PHYS_INPUT_MOVEVALUES(strafeplayer);
         int    keys                          = STAT(PRESSED_KEYS);
         int    keys_fwd;
@@ -349,7 +346,7 @@ void HUD_StrafeHUD()
                 }
                 state_fwd_prev = state_fwd;
 
-                if((time - state_fwd_time) >= autocvar_hud_panel_strafehud_timeout_fwd_bkwd || speed < maxspeed) // timeout when changing between forwards and backwards movement
+                if((time - state_fwd_time) >= autocvar_hud_panel_strafehud_timeout_direction || speed < maxspeed) // timeout when changing between forwards and backwards movement
                 {
                     fwd = state_fwd;
                 }
@@ -405,26 +402,11 @@ void HUD_StrafeHUD()
         // determine whether the player is strafing left or right
         if(wishangle != 0)
         {
-            state_direction = wishangle > 0 ? 1 : -1;
+            direction = wishangle > 0 ? 1 : -1;
         }
         else
         {
-            state_direction = (angle > antiflicker_angle && angle < (180 - antiflicker_angle)) ? 1 : (angle < -antiflicker_angle && angle > (-180 + antiflicker_angle)) ? -1 : 0;
-        }
-
-        if(state_direction_prev != state_direction)
-        {
-            state_direction_time = time;
-        }
-        state_direction_prev = state_direction;
-
-        if((time - state_direction_time) >= autocvar_hud_panel_strafehud_timeout_left_right || speed < maxspeed || direction == 0) // timeout when changing between left and right movement
-        {
-            direction = state_direction;
-        }
-        if(direction != 0)
-        {
-            wishangle = direction * fabs(wishangle);
+            direction = (angle > antiflicker_angle && angle < (180 - antiflicker_angle)) ? 1 : (angle < -antiflicker_angle && angle > (-180 + antiflicker_angle)) ? -1 : 0;
         }
 
         // decelerating at this angle