From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Mon, 22 Mar 2021 15:57:41 +0000 (+0100) Subject: Add patch from Juhu/strafehud-fixes branch: "strafehud: remove direction (fwd/bkwd... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9e78a50638b0e032b316365fe4029e060b6a6ddf;p=xonotic%2Fxonotic-data.pk3dir.git Add patch from Juhu/strafehud-fixes branch: "strafehud: remove direction (fwd/bkwd) timeout, it's not useful" --- 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 d47427281..09bbd6899 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -42,9 +42,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; @@ -371,15 +368,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 @@ -387,25 +384,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 db53711b8..0406bbce7 100644 --- a/qcsrc/client/hud/panel/strafehud.qh +++ b/qcsrc/client/hud/panel/strafehud.qh @@ -49,7 +49,6 @@ AUTOCVAR_SAVE(hud_panel_strafehud_jumpheight_size, float, 1.5, "size of the jump AUTOCVAR_SAVE(hud_panel_strafehud_timeout_air, float, 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)"); AUTOCVAR_SAVE(hud_panel_strafehud_timeout_ground, float, 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)"); AUTOCVAR_SAVE(hud_panel_strafehud_timeout_turn, float, 0.1, "time (in seconds) after releasing the strafe keys before changing mode (visually more consistent hud while switching between left/right strafe turning)"); -AUTOCVAR_SAVE(hud_panel_strafehud_timeout_direction, float, 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)"); AUTOCVAR_SAVE(hud_panel_strafehud_antiflicker_angle, float, 0.01, "how many degrees from 0° to 180° the hud ignores if it could cause visual disturbances otherwise (and to counter rounding errors)"); AUTOCVAR_SAVE(hud_panel_strafehud_antiflicker_speed, float, 0.0001, "how many qu/s the hud ignores if it could cause visual disturbances otherwise (and to counter rounding errors)");