From 1aa949bc5b5ee3e4f0b96ef647cbd2e8c3975d6c Mon Sep 17 00:00:00 2001 From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Sat, 20 Jun 2020 18:32:00 +0200 Subject: [PATCH] add drawfill-only option to the strafehud to prevent weird progressbar styles --- _hud_common.cfg | 1 + qcsrc/client/autocvars.qh | 1 + qcsrc/client/hud/panel/strafehud.qc | 43 ++++++++++++++++++++++------- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/_hud_common.cfg b/_hud_common.cfg index bdde38f84..c59fa7d7b 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -142,6 +142,7 @@ seta hud_panel_strafehud_timeout_ground "0.03333333" "time after landing before 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_direction "0.5" "time it takes until direction changes (forward or backward strafe) are detected" seta hud_panel_strafehud_indicator_minspeed "-1" "speed at which strafehud indicators will be shown, uses maxspeed if negative" +seta hud_panel_strafehud_unstyled "0" "don't apply any progressbar styles to the strafehud" // hud panel aliases alias quickmenu "cl_cmd hud quickmenu ${* ?}" diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 789030b03..a9278854c 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -340,6 +340,7 @@ float autocvar_hud_panel_strafehud_timeout_ground = 0.03333333; float autocvar_hud_panel_strafehud_timeout_strafe = 0.1; float autocvar_hud_panel_strafehud_timeout_direction = 0.5; float autocvar_hud_panel_strafehud_indicator_minspeed = -1; +bool autocvar_hud_panel_strafehud_unstyled = false; bool autocvar_hud_panel_timer; bool autocvar_hud_panel_timer_increment; float autocvar_hud_panel_update_interval; diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc index 39e97bdc7..e1e2c23c5 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -1,4 +1,3 @@ -// Name: StrafeHUD // Author: Juhu #include "strafehud.qh" @@ -470,7 +469,14 @@ void HUD_StrafeHUD() // add a background to the strafe-o-meter if(panel_size.x > 0 && panel_size.y > 0) { - HUD_Panel_DrawProgressBar(panel_pos, panel_size, "progressbar", 1, 0, 0, autocvar_hud_panel_strafehud_bar_color, autocvar_hud_panel_strafehud_bar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); + if(!autocvar_hud_panel_strafehud_unstyled) + { + HUD_Panel_DrawProgressBar(panel_pos, panel_size, "progressbar", 1, 0, 0, autocvar_hud_panel_strafehud_bar_color, autocvar_hud_panel_strafehud_bar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); + } + else + { + drawfill(panel_pos, panel_size, autocvar_hud_panel_strafehud_bar_color, autocvar_hud_panel_strafehud_bar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); + } } } @@ -522,17 +528,34 @@ void HUD_StrafeHUD() switch_bestangle_offset -= currentangle_offset; } - // draw acceleration zone - HUD_Panel_DrawStrafeHUD_ProgressBar(accelzone_offset, accelzone_width, autocvar_hud_panel_strafehud_indicator_color, autocvar_hud_panel_strafehud_bar_alpha, hidden_size); + if(!autocvar_hud_panel_strafehud_unstyled) + { + // draw acceleration zone + HUD_Panel_DrawStrafeHUD_ProgressBar(accelzone_offset, accelzone_width, autocvar_hud_panel_strafehud_indicator_color, autocvar_hud_panel_strafehud_bar_alpha, hidden_size); - // draw odd acceleration zone - HUD_Panel_DrawStrafeHUD_ProgressBar(odd_accelzone_offset, odd_accelzone_width, autocvar_hud_panel_strafehud_indicator_color, autocvar_hud_panel_strafehud_bar_alpha, hidden_size); + // draw odd acceleration zone + HUD_Panel_DrawStrafeHUD_ProgressBar(odd_accelzone_offset, odd_accelzone_width, autocvar_hud_panel_strafehud_indicator_color, autocvar_hud_panel_strafehud_bar_alpha, hidden_size); - // draw overturn area - HUD_Panel_DrawStrafeHUD_ProgressBar(overturn_offset, overturn_width, autocvar_hud_panel_strafehud_alert_color, autocvar_hud_panel_strafehud_bar_alpha, hidden_size); + // draw overturn area + HUD_Panel_DrawStrafeHUD_ProgressBar(overturn_offset, overturn_width, autocvar_hud_panel_strafehud_alert_color, autocvar_hud_panel_strafehud_bar_alpha, hidden_size); - // draw the strafe bar background - HUD_Panel_DrawStrafeHUD_ProgressBar(bar_offset, bar_width, autocvar_hud_panel_strafehud_bar_color, autocvar_hud_panel_strafehud_bar_alpha, hidden_size); + // draw the strafe bar background + HUD_Panel_DrawStrafeHUD_ProgressBar(bar_offset, bar_width, autocvar_hud_panel_strafehud_bar_color, autocvar_hud_panel_strafehud_bar_alpha, hidden_size); + } + else + { + // draw acceleration zone + HUD_Panel_DrawStrafeHUD_drawfill(accelzone_offset, accelzone_width, autocvar_hud_panel_strafehud_indicator_color, autocvar_hud_panel_strafehud_bar_alpha, hidden_size); + + // draw odd acceleration zone + HUD_Panel_DrawStrafeHUD_drawfill(odd_accelzone_offset, odd_accelzone_width, autocvar_hud_panel_strafehud_indicator_color, autocvar_hud_panel_strafehud_bar_alpha, hidden_size); + + // draw overturn area + HUD_Panel_DrawStrafeHUD_drawfill(overturn_offset, overturn_width, autocvar_hud_panel_strafehud_alert_color, autocvar_hud_panel_strafehud_bar_alpha, hidden_size); + + // draw the strafe bar background + HUD_Panel_DrawStrafeHUD_drawfill(bar_offset, bar_width, autocvar_hud_panel_strafehud_bar_color, autocvar_hud_panel_strafehud_bar_alpha, hidden_size); + } // draw the direction indicator caps at the sides of the hud // vertical line -- 2.39.2