From f562310e44fcb4b1dfee0bb5b6e4bb3e2abf52f0 Mon Sep 17 00:00:00 2001 From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Mon, 22 Mar 2021 16:57:35 +0100 Subject: [PATCH] strafehud: remove direction (fwd/bkwd) timeout, it's not useful --- _hud_common.cfg | 1 - qcsrc/client/hud/panel/strafehud.qc | 24 +++++------------------- qcsrc/client/hud/panel/strafehud.qh | 1 - 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/_hud_common.cfg b/_hud_common.cfg index a144d1546..009cd5c85 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -179,7 +179,6 @@ seta hud_panel_strafehud_jumpheight_size "1.5" "size of the jump height text (re seta hud_panel_strafehud_timeout_air "0.1" "time (in seconds) after take off before changing to air strafe physics when not jumping (visually more consistent hud while on slick downwards ramps)" seta hud_panel_strafehud_timeout_ground "0.03333333" "time (in seconds) after landing before changing to non-air strafe physics (visually more consistent hud while strafe turning when touching the floor after every hop)" seta hud_panel_strafehud_timeout_turn "0.1" "time (in seconds) after releasing the strafe keys before changing mode (visually more consistent hud while switching between left/right strafe turning)" -seta hud_panel_strafehud_timeout_direction "0.5" "time (in seconds) it takes until direction changes (forward or backward movement) are applied (set to zero if you intend to sideways strafe)" 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 (and to counter rounding errors)" seta hud_panel_strafehud_antiflicker_speed "0.0001" "how many qu/s the hud ignores if it could cause visual disturbances otherwise (and to counter rounding errors)" diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc index 61383a4e8..6441ffff9 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -33,9 +33,6 @@ bool turn = false; float turnangle; float turnspeed; bool fwd = true; -bool state_fwd = true; -bool state_fwd_prev = true; -float state_fwd_time = 0; float starttime = 0; float startspeed = -1; float jumptime = 0; @@ -361,15 +358,15 @@ void HUD_StrafeHUD() { if(keys_fwd > 0) { - state_fwd = true; + fwd = true; } else if(keys_fwd < 0) { - state_fwd = false; + fwd = false; } else { - state_fwd = fabs(angle) <= 90; + fwd = fabs(angle) <= 90; } } // otherwise determine by examining the strafe angle @@ -377,25 +374,14 @@ void HUD_StrafeHUD() { if(wishangle < 0) // detect direction using wishangle since the direction is not yet set { - state_fwd = angle <= -wishangle; + fwd = angle <= -wishangle; } else { - state_fwd = angle >= -wishangle; + fwd = angle >= -wishangle; } } - if(state_fwd_prev != state_fwd) - { - state_fwd_time = time; - } - state_fwd_prev = state_fwd; - - if((time - state_fwd_time) >= autocvar_hud_panel_strafehud_timeout_direction || speed < movespeed || ((fabs(wishangle) == 90) && mode == 0)) // timeout when changing between forwards and backwards movement - { - fwd = state_fwd; - } - // shift the strafe angle by 180° when strafing backwards if(!fwd) { diff --git a/qcsrc/client/hud/panel/strafehud.qh b/qcsrc/client/hud/panel/strafehud.qh index dcde312d7..07424da57 100644 --- a/qcsrc/client/hud/panel/strafehud.qh +++ b/qcsrc/client/hud/panel/strafehud.qh @@ -49,7 +49,6 @@ float autocvar_hud_panel_strafehud_jumpheight_size = 1.5; float autocvar_hud_panel_strafehud_timeout_air = 0.1; float autocvar_hud_panel_strafehud_timeout_ground = 0.03333333; float autocvar_hud_panel_strafehud_timeout_turn = 0.1; -float autocvar_hud_panel_strafehud_timeout_direction = 0.5; float autocvar_hud_panel_strafehud_antiflicker_angle = 0.01; float autocvar_hud_panel_strafehud_antiflicker_speed = 0.0001; -- 2.39.2