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"
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;
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;
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;
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;
}
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;
}
// 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