From f1ac1421b9052c676844b63b8732ef44dd1ad8a0 Mon Sep 17 00:00:00 2001 From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Tue, 23 Jun 2020 02:15:05 +0200 Subject: [PATCH] strafehud: make more width/height values configurable via cvars --- _hud_common.cfg | 4 ++++ qcsrc/client/autocvars.qh | 4 ++++ qcsrc/client/hud/panel/strafehud.qc | 9 +++++---- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/_hud_common.cfg b/_hud_common.cfg index db979ab84..6e57f5b7e 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -133,12 +133,16 @@ 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 in qu/s at which strafe angle indicators will be shown, uses physics maxspeed + antiflicker if negative" +seta hud_panel_strafehud_indicator_width "0.01" "width of the strafe angle indicators" 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_alert_color "1 0 1" "indicator color of the actual strafe angle if the angle has a critical value" seta hud_panel_strafehud_angle_alpha "0.8" "indicator transparency of the actual strafe angle" +seta hud_panel_strafehud_angle_height "1.5" "indicator height of the actual strafe angle" +seta hud_panel_strafehud_angle_width "0.005" "indicator width of the actual strafe angle" seta hud_panel_strafehud_direction_color "0 0.5 1" "direction indicator color" +seta hud_panel_strafehud_direction_width "0.0075" "direction indicator width" 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)" diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index ff7058e4c..9361f2bd7 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -331,12 +331,16 @@ bool autocvar_hud_panel_strafehud_indicators = true; vector autocvar_hud_panel_strafehud_indicator_color = '0 1 0'; vector autocvar_hud_panel_strafehud_indicator_switch_color = '1 1 0'; float autocvar_hud_panel_strafehud_indicator_minspeed = -1; +float autocvar_hud_panel_strafehud_indicator_width = 0.01; float autocvar_hud_panel_strafehud_angle = 0; vector autocvar_hud_panel_strafehud_good_color = '0 1 1'; vector autocvar_hud_panel_strafehud_warning_color = '1 1 0'; vector autocvar_hud_panel_strafehud_alert_color = '1 0 1'; float autocvar_hud_panel_strafehud_angle_alpha = 0.8; +float autocvar_hud_panel_strafehud_angle_height = 1.5; +float autocvar_hud_panel_strafehud_angle_width = 0.005; vector autocvar_hud_panel_strafehud_direction_color = '0 0.5 1'; +float autocvar_hud_panel_strafehud_direction_width = 0.0075; 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; diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc index 164209f12..1a66c8327 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -428,7 +428,7 @@ void HUD_StrafeHUD() hidden_angle = 360 - hudangle; hidden_size = hidden_angle / hudangle * panel_size.x; // current angle - currentangle_size.x = panel_size.x * .005; + currentangle_size.x = panel_size.x * autocvar_hud_panel_strafehud_angle_width; if(currentangle_size.x < 1) currentangle_size.x = 1; if(mode == 0) { @@ -438,13 +438,14 @@ void HUD_StrafeHUD() { currentangle_offset = bound(-hudangle/2, angle, hudangle/2)/hudangle * panel_size.x + panel_size.x/2; } - currentangle_size.y = panel_size.y * 1.5; + currentangle_size.y = panel_size.y * autocvar_hud_panel_strafehud_angle_height; + if(currentangle_size.y < 1) currentangle_size.y = 1; // best strafe acceleration angle bestangle_offset = bestangle/hudangle * panel_size.x + panel_size.x/2; switch_bestangle_offset = -bestangle/hudangle * panel_size.x + panel_size.x/2; if(show_indicators) { - bestangle_width = panel_size.x * .01; + bestangle_width = panel_size.x * autocvar_hud_panel_strafehud_indicator_width; if(bestangle_width < 1) bestangle_width = 1; } else @@ -461,7 +462,7 @@ void HUD_StrafeHUD() switch_bestangle_offset -= bestangle_width; } // direction indicator - direction_size_vertical.x = panel_size.x * .0075; + direction_size_vertical.x = panel_size.x * autocvar_hud_panel_strafehud_direction_width; if(direction_size_vertical.x < 1) direction_size_vertical.x = 1; direction_size_vertical.y = panel_size.y; direction_size_horizontal.x = direction_size_vertical.x * 3; -- 2.39.2