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)"
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;
{
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
{
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)
{
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;