seta hud_panel_strafehud_angle_neutral_color "1 1 0" "color of the indicator showing the player's current angle if it is within the neutral zone"
seta hud_panel_strafehud_angle_accel_color "0 1 1" "color of the indicator showing the player's current angle if it is within the acceleration zone"
seta hud_panel_strafehud_angle_overturn_color "1 0 1" "color of the indicator showing the player's current angle if it is within the overturn zone"
-seta hud_panel_strafehud_angle_line "0" "defines the number of dashes of the angle indicator's line: set to 0 to disable or 1 for a solid line"
-seta hud_panel_strafehud_angle_line_width "0.001" "width of the indicator's line showing the player's current angle (relative to the panel width)"
-seta hud_panel_strafehud_angle_line_height "1" "height of the indicator's line showing the player's current angle (relative to the panel height)"
-seta hud_panel_strafehud_angle_arrow "1" "set the angle indicator's arrow style: 0 = none, 1 = top, 2 = bottom, 3 = both"
-seta hud_panel_strafehud_angle_arrow_size "0.5" "size of the arrow (relative to the panel height)"
+seta hud_panel_strafehud_angle_line "0" "defines the number of dashes of the indicator line showing the player's current angle (set to 0 to disable or 1 for a solid line)"
+seta hud_panel_strafehud_angle_line_width "0.001" "width of the indicator line showing the player's current angle (relative to the panel width)"
+seta hud_panel_strafehud_angle_line_height "1" "height of the indicator line showing the player's current angle (relative to the panel height)"
+seta hud_panel_strafehud_angle_arrow "1" "arrow style of the angle indicator showing the player's current angle (0 = none, 1 = top, 2 = bottom, 3 = both)"
+seta hud_panel_strafehud_angle_arrow_size "0.5" "arrow size of the indicator showing the player's current angle (relative to the panel height)"
seta hud_panel_strafehud_bestangle "1" "set to 1 to enable a ghost angle indicator showing the best angle to gain maximum acceleration, 2 = only when side strafing"
seta hud_panel_strafehud_bestangle_color "1 1 1" "color of the indicator showing the best angle to gain maximum acceleration"
seta hud_panel_strafehud_bestangle_alpha "0.5" "opacity of the indicator showing the best angle to gain maximum acceleration"
+seta hud_panel_strafehud_bestangle_line "0" "defines the number of dashes of the best angle indicator line (set to 0 to disable or 1 for a solid line)"
+seta hud_panel_strafehud_bestangle_line_width "0.001" "width of the best angle indicator line (relative to the panel width)"
+seta hud_panel_strafehud_bestangle_line_height "1" "height of the best angle indicator line (relative to the panel height)"
+seta hud_panel_strafehud_bestangle_arrow "1" "arrow style of the best angle indicator (0 = none, 1 = top, 2 = bottom, 3 = both)"
+seta hud_panel_strafehud_bestangle_arrow_size "0.5" "arrow size of the best angle indicator (relative to the panel height)"
seta hud_panel_strafehud_switch "1" "set to 1 to enable the strafe angle indicator showing the angle to move to when changing side, 2 = show the normal switch indicators when W-turning, 3 = also while side strafing"
seta hud_panel_strafehud_switch_minspeed "-1" "minimum speed in qu/s at which angle indicator(s) which are used to aid changing strafe direction will be shown (set to -1 for dynamic minspeed)"
seta hud_panel_strafehud_switch_color "1 1 0" "color of the strafe angle indicators for changing strafe direction"
seta hud_panel_strafehud_switch_alpha "0.5" "opacity of the strafe angle indicators for changing strafe direction"
+seta hud_panel_strafehud_switch_line "0" "defines the number of dashes of the change angle indicator line (set to 0 to disable or 1 for a solid line)"
+seta hud_panel_strafehud_switch_line_width "0.001" "width of the change angle indicator line (relative to the panel width)"
+seta hud_panel_strafehud_switch_line_height "1" "height of the change angle indicator line (relative to the panel height)"
+seta hud_panel_strafehud_switch_arrow "1" "arrow style of the change angle indicator (0 = none, 1 = top, 2 = bottom, 3 = both)"
+seta hud_panel_strafehud_switch_arrow_size "0.5" "arrow size of the change angle indicator (relative to the panel height)"
seta hud_panel_strafehud_wturn "1" "enable the W-turn indicators showing the angle to rotate your velocity as fast as possible, 1 = only if W-turning, 2 = also while strafing normally, 3 = also while side strafing"
seta hud_panel_strafehud_wturn_color "0 0 1" "color of the W-turn indicators"
seta hud_panel_strafehud_wturn_alpha "0.5" "opacity of the W-turn indicators"
seta hud_panel_strafehud_wturn_proper "0" "use the proper formula to calculate W-turn indicators (warning: loses accuracy at high speeds)"
seta hud_panel_strafehud_wturn_unrestricted "0" "set to 1 to enable the W-turn indicators even when W-turning gives acceleration (warning: not completely accurate)"
+seta hud_panel_strafehud_wturn_line "0" "defines the number of dashes of the W-turn angle indicator line (set to 0 to disable or 1 for a solid line)"
+seta hud_panel_strafehud_wturn_line_width "0.001" "width of the W-turn angle indicator line (relative to the panel width)"
+seta hud_panel_strafehud_wturn_line_height "1" "height of the W-turn angle indicator line (relative to the panel height)"
+seta hud_panel_strafehud_wturn_arrow "1" "arrow style of the W-turn angle indicator (0 = none, 1 = top, 2 = bottom, 3 = both)"
+seta hud_panel_strafehud_wturn_arrow_size "0.5" "arrow size of the W-turn angle indicator (relative to the panel height)"
seta hud_panel_strafehud_direction "0" "set to 1 to enable the direction caps to see in which direction you are currently strafing"
seta hud_panel_strafehud_direction_color "0 0.5 1" "color of the direction caps which indicate the direction the player is currently strafing towards"
seta hud_panel_strafehud_direction_alpha "1" "opacity of the direction caps which indicate the direction the player is currently strafing towards"
currentangle = angle;
}
- // current angle size calculation
- vector currentangle_size;
- currentangle_size.x = max(panel_size.x * min(autocvar_hud_panel_strafehud_angle_line_width, 10), 1);
- currentangle_size.y = max(panel_size.y * min(autocvar_hud_panel_strafehud_angle_line_height, 10), 1);
- currentangle_size.z = 0;
+ float max_line_height = 0;
+ float max_top_arrow_size = 0;
+ float max_bottom_arrow_size = 0;
- float num_dashes = nearbyint(autocvar_hud_panel_strafehud_angle_line);
- bool has_top_arrow = autocvar_hud_panel_strafehud_angle_arrow == 1 || autocvar_hud_panel_strafehud_angle_arrow >= 3;
- bool has_bottom_arrow = autocvar_hud_panel_strafehud_angle_arrow >= 2;
-
- // there's only one size cvar for the arrows, they will always have a 45° angle to ensure proper rendering without antialiasing
- float arrow_size = max(panel_size.y * min(autocvar_hud_panel_strafehud_angle_arrow_size, 10), 1);
-
- if(num_dashes > 0 || has_top_arrow || has_bottom_arrow)
+ // only draw switch indicators if minspeed is reached
+ if(autocvar_hud_panel_strafehud_switch && autocvar_hud_panel_strafehud_switch_alpha > 0 && speed >= minspeed)
{
- bool angle_indicator_visible = false;
+ // change angle indicator style
+ vector indicator_size;
+ indicator_size.x = max(panel_size.x * min(autocvar_hud_panel_strafehud_switch_line_width, 10), 1);
+ indicator_size.y = max(panel_size.y * min(autocvar_hud_panel_strafehud_switch_line_height, 10), 1);
+ indicator_size.z = 0;
+
+ float num_dashes = nearbyint(autocvar_hud_panel_strafehud_switch_line);
+ bool has_top_arrow = autocvar_hud_panel_strafehud_switch_arrow == 1 || autocvar_hud_panel_strafehud_switch_arrow >= 3;
+ bool has_bottom_arrow = autocvar_hud_panel_strafehud_switch_arrow >= 2;
+
+ // there's only one size cvar for the arrows, they will always have a 45° angle to ensure proper rendering without antialiasing
+ float arrow_size = max(panel_size.y * min(autocvar_hud_panel_strafehud_switch_arrow_size, 10), 1);
+
+ if(num_dashes > 0)
+ max_line_height = max(max_line_height, indicator_size.y);
+ if(has_top_arrow)
+ max_top_arrow_size = max(max_top_arrow_size, arrow_size);
+ if(has_bottom_arrow)
+ max_bottom_arrow_size = max(max_bottom_arrow_size, arrow_size);
+
+ // draw the change indicator(s)
+ float current_changeangle = draw_normal
+ ? (opposite_direction ? n_opposite_changeangle : n_changeangle)
+ : (opposite_direction ? opposite_changeangle : changeangle);
+ float opposite_changeangle = draw_normal
+ ? (opposite_direction ? n_opposite_bestangle : n_bestangle)
+ : (opposite_direction ? opposite_bestangle : bestangle);
- // only draw switch indicators if minspeed is reached
- if(autocvar_hud_panel_strafehud_switch && autocvar_hud_panel_strafehud_switch_alpha > 0 && speed >= minspeed)
- {
- // draw the change indicator(s)
- float current_changeangle = draw_normal
- ? (opposite_direction ? n_opposite_changeangle : n_changeangle)
- : (opposite_direction ? opposite_changeangle : changeangle);
- float opposite_changeangle = draw_normal
- ? (opposite_direction ? n_opposite_bestangle : n_bestangle)
- : (opposite_direction ? opposite_bestangle : bestangle);
+ StrafeHUD_DrawAngleIndicator(
+ current_changeangle, indicator_size, arrow_size, num_dashes,
+ has_top_arrow, has_bottom_arrow, autocvar_hud_panel_strafehud_switch_color,
+ autocvar_hud_panel_strafehud_switch_alpha, hudangle);
+ if(direction == STRAFEHUD_DIRECTION_NONE || draw_normal)
+ {
StrafeHUD_DrawAngleIndicator(
- current_changeangle, currentangle_size, arrow_size, num_dashes,
+ opposite_changeangle, indicator_size, arrow_size, num_dashes,
has_top_arrow, has_bottom_arrow, autocvar_hud_panel_strafehud_switch_color,
autocvar_hud_panel_strafehud_switch_alpha, hudangle);
+ }
+ }
- if(direction == STRAFEHUD_DIRECTION_NONE || draw_normal)
- {
- StrafeHUD_DrawAngleIndicator(
- opposite_changeangle, currentangle_size, arrow_size, num_dashes,
- has_top_arrow, has_bottom_arrow, autocvar_hud_panel_strafehud_switch_color,
- autocvar_hud_panel_strafehud_switch_alpha, hudangle);
- }
+ if(autocvar_hud_panel_strafehud_bestangle && autocvar_hud_panel_strafehud_bestangle_alpha > 0 &&
+ (autocvar_hud_panel_strafehud_bestangle == 1 || turn) && direction != STRAFEHUD_DIRECTION_NONE)
+ {
+ // best angle indicator style
+ vector indicator_size;
+ indicator_size.x = max(panel_size.x * min(autocvar_hud_panel_strafehud_bestangle_line_width, 10), 1);
+ indicator_size.y = max(panel_size.y * min(autocvar_hud_panel_strafehud_bestangle_line_height, 10), 1);
+ indicator_size.z = 0;
- if(autocvar_hud_panel_strafehud_switch_alpha > 0)
- angle_indicator_visible = true;
- }
+ float num_dashes = nearbyint(autocvar_hud_panel_strafehud_bestangle_line);
+ bool has_top_arrow = autocvar_hud_panel_strafehud_bestangle_arrow == 1 || autocvar_hud_panel_strafehud_bestangle_arrow >= 3;
+ bool has_bottom_arrow = autocvar_hud_panel_strafehud_bestangle_arrow >= 2;
- if(autocvar_hud_panel_strafehud_bestangle && (autocvar_hud_panel_strafehud_bestangle == 1 || turn) && direction != STRAFEHUD_DIRECTION_NONE)
- {
- float ghostangle = opposite_direction ? opposite_bestangle : bestangle;
+ // there's only one size cvar for the arrows, they will always have a 45° angle to ensure proper rendering without antialiasing
+ float arrow_size = max(panel_size.y * min(autocvar_hud_panel_strafehud_bestangle_arrow_size, 10), 1);
- StrafeHUD_DrawAngleIndicator(
- ghostangle, currentangle_size, arrow_size, num_dashes,
- has_top_arrow, has_bottom_arrow, autocvar_hud_panel_strafehud_bestangle_color,
- autocvar_hud_panel_strafehud_bestangle_alpha, hudangle);
+ if(num_dashes > 0)
+ max_line_height = max(max_line_height, indicator_size.y);
+ if(has_top_arrow)
+ max_top_arrow_size = max(max_top_arrow_size, arrow_size);
+ if(has_bottom_arrow)
+ max_bottom_arrow_size = max(max_bottom_arrow_size, arrow_size);
- if(autocvar_hud_panel_strafehud_bestangle_alpha > 0)
- angle_indicator_visible = true;
- }
+ float ghostangle = opposite_direction ? opposite_bestangle : bestangle;
- // only draw wturn indicators if conditions were met
- if(wturn_valid && !onground && is_aircontrol_direction &&
- autocvar_hud_panel_strafehud_wturn_alpha > 0 &&
- absolute_wturn_bestangle < absolute_n_prebestangle &&
- ((autocvar_hud_panel_strafehud_wturn && wturning) ||
- (autocvar_hud_panel_strafehud_wturn == STRAFEHUD_WTURN_NORMAL && !turn) ||
- (autocvar_hud_panel_strafehud_wturn == STRAFEHUD_WTURN_SIDESTRAFE)))
- {
- // draw the wturn indicators
- StrafeHUD_DrawAngleIndicator(
- wturn_left_bestangle, currentangle_size, arrow_size, num_dashes,
- has_top_arrow, has_bottom_arrow, autocvar_hud_panel_strafehud_wturn_color,
- autocvar_hud_panel_strafehud_wturn_alpha, hudangle);
- StrafeHUD_DrawAngleIndicator(
- wturn_right_bestangle, currentangle_size, arrow_size, num_dashes,
- has_top_arrow, has_bottom_arrow, autocvar_hud_panel_strafehud_wturn_color,
- autocvar_hud_panel_strafehud_wturn_alpha, hudangle);
- }
+ StrafeHUD_DrawAngleIndicator(
+ ghostangle, indicator_size, arrow_size, num_dashes,
+ has_top_arrow, has_bottom_arrow, autocvar_hud_panel_strafehud_bestangle_color,
+ autocvar_hud_panel_strafehud_bestangle_alpha, hudangle);
+ }
+
+ // only draw wturn indicators if conditions were met
+ if(wturn_valid && !onground && is_aircontrol_direction &&
+ autocvar_hud_panel_strafehud_wturn_alpha > 0 &&
+ absolute_wturn_bestangle < absolute_n_prebestangle &&
+ ((autocvar_hud_panel_strafehud_wturn && wturning) ||
+ (autocvar_hud_panel_strafehud_wturn == STRAFEHUD_WTURN_NORMAL && !turn) ||
+ (autocvar_hud_panel_strafehud_wturn == STRAFEHUD_WTURN_SIDESTRAFE)))
+ {
+ // wturn angle indicator style
+ vector indicator_size;
+ indicator_size.x = max(panel_size.x * min(autocvar_hud_panel_strafehud_wturn_line_width, 10), 1);
+ indicator_size.y = max(panel_size.y * min(autocvar_hud_panel_strafehud_wturn_line_height, 10), 1);
+ indicator_size.z = 0;
+
+ float num_dashes = nearbyint(autocvar_hud_panel_strafehud_wturn_line);
+ bool has_top_arrow = autocvar_hud_panel_strafehud_wturn_arrow == 1 || autocvar_hud_panel_strafehud_wturn_arrow >= 3;
+ bool has_bottom_arrow = autocvar_hud_panel_strafehud_wturn_arrow >= 2;
+
+ // there's only one size cvar for the arrows, they will always have a 45° angle to ensure proper rendering without antialiasing
+ float arrow_size = max(panel_size.y * min(autocvar_hud_panel_strafehud_wturn_arrow_size, 10), 1);
+
+ if(num_dashes > 0)
+ max_line_height = max(max_line_height, indicator_size.y);
+ if(has_top_arrow)
+ max_top_arrow_size = max(max_top_arrow_size, arrow_size);
+ if(has_bottom_arrow)
+ max_bottom_arrow_size = max(max_bottom_arrow_size, arrow_size);
+
+ // draw the wturn indicators
+ StrafeHUD_DrawAngleIndicator(
+ wturn_left_bestangle, indicator_size, arrow_size, num_dashes,
+ has_top_arrow, has_bottom_arrow, autocvar_hud_panel_strafehud_wturn_color,
+ autocvar_hud_panel_strafehud_wturn_alpha, hudangle);
+ StrafeHUD_DrawAngleIndicator(
+ wturn_right_bestangle, indicator_size, arrow_size, num_dashes,
+ has_top_arrow, has_bottom_arrow, autocvar_hud_panel_strafehud_wturn_color,
+ autocvar_hud_panel_strafehud_wturn_alpha, hudangle);
+ }
+
+ if(autocvar_hud_panel_strafehud_angle_alpha > 0)
+ {
+ // current angle indicator style
+ vector indicator_size;
+ indicator_size.x = max(panel_size.x * min(autocvar_hud_panel_strafehud_angle_line_width, 10), 1);
+ indicator_size.y = max(panel_size.y * min(autocvar_hud_panel_strafehud_angle_line_height, 10), 1);
+ indicator_size.z = 0;
+
+ float num_dashes = nearbyint(autocvar_hud_panel_strafehud_angle_line);
+ bool has_top_arrow = autocvar_hud_panel_strafehud_angle_arrow == 1 || autocvar_hud_panel_strafehud_angle_arrow >= 3;
+ bool has_bottom_arrow = autocvar_hud_panel_strafehud_angle_arrow >= 2;
+
+ // there's only one size cvar for the arrows, they will always have a 45° angle to ensure proper rendering without antialiasing
+ float arrow_size = max(panel_size.y * min(autocvar_hud_panel_strafehud_angle_arrow_size, 10), 1);
+
+ if(num_dashes > 0)
+ max_line_height = max(max_line_height, indicator_size.y);
+ if(has_top_arrow)
+ max_top_arrow_size = max(max_top_arrow_size, arrow_size);
+ if(has_bottom_arrow)
+ max_bottom_arrow_size = max(max_bottom_arrow_size, arrow_size);
StrafeHUD_DrawAngleIndicator(
- currentangle, currentangle_size, arrow_size, num_dashes,
+ currentangle, indicator_size, arrow_size, num_dashes,
has_top_arrow, has_bottom_arrow, currentangle_color,
autocvar_hud_panel_strafehud_angle_alpha, hudangle);
+ }
- if(autocvar_hud_panel_strafehud_angle_alpha > 0)
- angle_indicator_visible = true;
+ // offset text by amount the angle indicator extrudes from the strafehud bar
+ {
+ float line_height_offset = max_line_height;
- // offset text by amount the angle indicator extrudes from the strafehud bar
- if(angle_indicator_visible)
- {
- float line_height_offset = currentangle_size.y;
+ // amount line extrudes from the strafehud bar
+ line_height_offset = (line_height_offset - panel_size.y) / 2;
- // amount line extrudes from the strafehud bar
- line_height_offset = (line_height_offset - panel_size.y) / 2;
+ // further offset the top text offset if the top arrow is drawn
+ float angle_offset_top;
+ angle_offset_top = line_height_offset + max_top_arrow_size;
- // further offset the top text offset if the top arrow is drawn
- float angle_offset_top;
- if(has_top_arrow)
- angle_offset_top = line_height_offset + arrow_size;
- else if(num_dashes > 0)
- angle_offset_top = line_height_offset;
- else
- angle_offset_top = 0;
-
- // further offset the bottom text offset if the bottom arrow is drawn
- float angle_offset_bottom;
- if(has_bottom_arrow)
- angle_offset_bottom = line_height_offset + arrow_size;
- else if(num_dashes > 0)
- angle_offset_bottom = line_height_offset;
- else
- angle_offset_bottom = 0;
+ // further offset the bottom text offset if the bottom arrow is drawn
+ float angle_offset_bottom;
+ angle_offset_bottom = line_height_offset + max_bottom_arrow_size;
- // make sure text does not draw inside the strafehud bar
- text_offset_top = max(angle_offset_top, text_offset_top);
- text_offset_bottom = max(angle_offset_bottom, text_offset_bottom);
- }
+ // make sure text does not draw inside the strafehud bar
+ text_offset_top = max(angle_offset_top, text_offset_top);
+ text_offset_bottom = max(angle_offset_bottom, text_offset_bottom);
}
StrafeHUD_DrawVerticalAngle(strafeplayer, text_offset_top, text_offset_bottom);