seta hud_panel_strafehud_indicators "1" "show the strafe indicators"
seta hud_panel_strafehud_indicator_color "0 1 0" "color of the strafe angle indicator"
seta hud_panel_strafehud_indicator_switch_color "1 1 0" "color of the strafe angle indicator on the opposite side"
-seta hud_panel_strafehud_indicator_minspeed "-1" "minimum speed at which strafe angle indicators will be shown, uses physics maxspeed if negative"
+seta hud_panel_strafehud_indicator_minspeed "-1" "minimum speed in qu/s at which strafe angle indicators will be shown, uses physics maxspeed if negative"
seta hud_panel_strafehud_angle "0" "the maximum angle displayed on the strafehud, \"0\" = dynamic"
seta hud_panel_strafehud_good_color "0 1 1" "indicator color of the actual strafe angle if the angle matches the ideal angle"
seta hud_panel_strafehud_warning_color "1 1 0" "indicator color of the actual strafe angle if the angle doesn't match the ideal angle"
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_direction "0.5" "time it takes until direction changes (forward or backward strafe) 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"
// hud panel aliases
alias quickmenu "cl_cmd hud quickmenu ${* ?}"
float autocvar_hud_panel_strafehud_timeout_strafe = 0.1;
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;
bool autocvar_hud_panel_timer;
bool autocvar_hud_panel_timer_increment;
float autocvar_hud_panel_update_interval;
// HUD
int mode = autocvar_hud_panel_strafehud_mode >= 0 && autocvar_hud_panel_strafehud_mode <= 1 ? autocvar_hud_panel_strafehud_mode : 0;
+ float antiflicker_angle = bound(0, autocvar_hud_panel_strafehud_antiflicker_angle, 180);
+ float antiflicker_speed = max(0, autocvar_hud_panel_strafehud_antiflicker_speed);
float minspeed;
bool straight_overturn = false;
float hudangle;
}
if(turn)
{
- maxspeed = PHYS_MAXAIRSTRAFESPEED(strafeplayer); // no crouching here because it doesn't affect air strafing
+ maxspeed = PHYS_MAXAIRSTRAFESPEED(strafeplayer); // no modifiers here because they don't affect air strafing
wishangle = turnangle;
}
- minspeed = autocvar_hud_panel_strafehud_indicator_minspeed < 0 ? maxspeed + .1 : autocvar_hud_panel_strafehud_indicator_minspeed;
+ minspeed = autocvar_hud_panel_strafehud_indicator_minspeed < 0 ? maxspeed + antiflicker_speed : autocvar_hud_panel_strafehud_indicator_minspeed;
show_indicators = (autocvar_hud_panel_strafehud_indicators && (speed >= minspeed));
// get current strafing angle ranging from -180° to +180°
else angle -= 180;
}
- // making the hud less flickery in case of rounding errors
- if(angle > 179.9 || angle < -179.9)
+ // don't make the angle indicator switch side too much at ±180° if anti flicker is turned on
+ if(angle > (180 - antiflicker_angle) || angle < (-180 + antiflicker_angle))
{
straight_overturn = true;
}
}
else
{
- direction = (angle > .1 && angle < 179.9) ? 1 : angle < -.1 && angle > -179.9 ? -1 : 0; // little margin to prevent the direction caps from flickering between left and right
+ direction = (angle > antiflicker_angle && angle < (180 - antiflicker_angle)) ? 1 : (angle < -antiflicker_angle && angle > (-180 + antiflicker_angle)) ? -1 : 0;
}
// decelerating at this angle
}
}
- if(speed < (maxspeed + .1) && speed > 0)
+ if(speed < (maxspeed + antiflicker_speed) && speed > 0)
{
bestangle_anywhere = true; // moving forward should suffice to gain speed
}