From 649160f8b09471abb1ff709445a146231cc870bb Mon Sep 17 00:00:00 2001 From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Sat, 20 Jun 2020 18:58:44 +0200 Subject: [PATCH] add option to hide strafehud switch indicators --- _hud_common.cfg | 1 + qcsrc/client/autocvars.qh | 1 + qcsrc/client/hud/panel/strafehud.qc | 33 +++++++++++++++++++---------- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/_hud_common.cfg b/_hud_common.cfg index c59fa7d7b..b22a359f9 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -129,6 +129,7 @@ seta _hud_panel_strafehud_center "0" "puts the angle indicator in the center dur seta hud_panel_strafehud_mode "0" "strafehud mode which controls whether the strafehud is centered at: \"0\" = view angle, \"1\" = velocity direction" seta hud_panel_strafehud_bar_alpha "0.3" "opacity of the strafe meter" seta hud_panel_strafehud_bar_color "1 1 1" "color of the strafe meter" +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_angle "0" "the maximum angle displayed on the strafehud, \"0\" = dynamic" diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index a9278854c..65b8413ec 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -327,6 +327,7 @@ bool autocvar__hud_panel_strafehud_center = false; int autocvar_hud_panel_strafehud_mode = 0; float autocvar_hud_panel_strafehud_bar_alpha = 0.3; vector autocvar_hud_panel_strafehud_bar_color = '1 1 1'; +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_angle = 0; diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc index b6d578815..1b4abfea0 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -114,7 +114,6 @@ void HUD_StrafeHUD() float bestangle_offset; float bestangle_width; float switch_bestangle_offset; - float switch_bestangle_width; float accelzone_offset; float accelzone_width; float odd_accelzone_offset; @@ -441,9 +440,15 @@ void HUD_StrafeHUD() // 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; - bestangle_width = panel_size.x * .01; - if(bestangle_width < 1) bestangle_width = 1; - switch_bestangle_width = bestangle_width; + if(autocvar_hud_panel_strafehud_indicators) + { + bestangle_width = panel_size.x * .01; + if(bestangle_width < 1) bestangle_width = 1; + } + else + { + bestangle_width = 0; + } // remove indicator width from offset if(direction < 0) { @@ -451,7 +456,7 @@ void HUD_StrafeHUD() } else { - switch_bestangle_offset -= switch_bestangle_width; + switch_bestangle_offset -= bestangle_width; } // direction indicator direction_size_vertical.x = panel_size.x * .0075; @@ -565,15 +570,21 @@ void HUD_StrafeHUD() // bottom horizontal line drawfill(panel_pos + eX * (direction < 0 ? -direction_size_vertical.x : panel_size.x - direction_size_horizontal.x + direction_size_vertical.x) + eY * panel_size.y, direction_size_horizontal, autocvar_hud_panel_strafehud_direction_color, panel_fg_alpha, DRAWFLAG_NORMAL); - // draw best angles for acceleration - HUD_Panel_DrawStrafeHUD_drawfill(switch_bestangle_offset, switch_bestangle_width, autocvar_hud_panel_strafehud_indicator_switch_color, 1, hidden_size); - HUD_Panel_DrawStrafeHUD_drawfill(bestangle_offset, bestangle_width, autocvar_hud_panel_strafehud_indicator_color, 1, hidden_size); + if(autocvar_hud_panel_strafehud_indicators) + { + // draw best angles for acceleration + HUD_Panel_DrawStrafeHUD_drawfill(switch_bestangle_offset, bestangle_width, autocvar_hud_panel_strafehud_indicator_switch_color, 1, hidden_size); + HUD_Panel_DrawStrafeHUD_drawfill(bestangle_offset, bestangle_width, autocvar_hud_panel_strafehud_indicator_color, 1, hidden_size); + } } else { - // draw best angles for acceleration - HUD_Panel_DrawStrafeHUD_drawfill(switch_bestangle_offset, switch_bestangle_width, autocvar_hud_panel_strafehud_indicator_switch_color, 1, hidden_size); - HUD_Panel_DrawStrafeHUD_drawfill(bestangle_offset, bestangle_width, autocvar_hud_panel_strafehud_indicator_switch_color, 1, hidden_size); + if(autocvar_hud_panel_strafehud_indicators) + { + // draw best angles for acceleration + HUD_Panel_DrawStrafeHUD_drawfill(switch_bestangle_offset, bestangle_width, autocvar_hud_panel_strafehud_indicator_switch_color, 1, hidden_size); + HUD_Panel_DrawStrafeHUD_drawfill(bestangle_offset, bestangle_width, autocvar_hud_panel_strafehud_indicator_switch_color, 1, hidden_size); + } } } else -- 2.39.2