From a1c80770c33192e8d8a8aa36f688ac52b9920de0 Mon Sep 17 00:00:00 2001 From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Sun, 12 Jan 2025 15:49:05 +0100 Subject: [PATCH] strafehud: misc cosmetic code changes --- qcsrc/client/hud/panel/strafehud/draw.qc | 3 ++- qcsrc/client/hud/panel/strafehud/extra.qc | 2 +- qcsrc/client/hud/panel/strafehud/util.qc | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/qcsrc/client/hud/panel/strafehud/draw.qc b/qcsrc/client/hud/panel/strafehud/draw.qc index 9218b1167..51f92f8c9 100644 --- a/qcsrc/client/hud/panel/strafehud/draw.qc +++ b/qcsrc/client/hud/panel/strafehud/draw.qc @@ -244,7 +244,7 @@ void StrafeHUD_DrawSoftGradient( { float alpha1 = bound(0, alpha, 1); float alpha2 = bound(0, autocvar_hud_panel_strafehud_bar_neutral_alpha * panel_fg_alpha, 1); - if((alpha1 + alpha2) == 0) return; + if(alpha1 + alpha2 == 0) return; float color_ratio = alpha1 / (alpha1 + alpha2); vector segment_size = size; @@ -329,6 +329,7 @@ void StrafeHUD_DrawTextIndicator( drawstring_aspect(panel_pos + pos, text, size, color, alpha * panel_fg_alpha, DRAWFLAG_NORMAL); } +// checks whether the current style is a gradient style bool StrafeHUD_IsGradient(int style) { return style == STRAFEHUD_STYLE_GRADIENT || style == STRAFEHUD_STYLE_SOFT_GRADIENT; diff --git a/qcsrc/client/hud/panel/strafehud/extra.qc b/qcsrc/client/hud/panel/strafehud/extra.qc index 0d12a035f..e58039554 100644 --- a/qcsrc/client/hud/panel/strafehud/extra.qc +++ b/qcsrc/client/hud/panel/strafehud/extra.qc @@ -14,7 +14,7 @@ // epsilon value for the slick detector steps to avoid // an infinite loop due to floating point rounding errors -// (works with current limits as long as uncapped mode is not used) +// (works with current limits) #define SLICKDETECT_STEPS_EPSILON 0.00001 // slick detector diff --git a/qcsrc/client/hud/panel/strafehud/util.qc b/qcsrc/client/hud/panel/strafehud/util.qc index 7c18c0182..c3786e1a5 100644 --- a/qcsrc/client/hud/panel/strafehud/util.qc +++ b/qcsrc/client/hud/panel/strafehud/util.qc @@ -318,6 +318,7 @@ bool StrafeHUD_DetermineJumpHeld(entity e, int keys, bool is_local) } // mix two colors based on a ratio +// TODO: move mixing colors out of the HUD, this could be useful for other code vector StrafeHUD_MixColors(vector color1, vector color2, float ratio) { if(ratio <= 0) return color1; -- 2.39.5