From 68fbe0649a5891b17b80a994a4879634294d73c9 Mon Sep 17 00:00:00 2001 From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Sat, 4 Feb 2023 00:59:38 +0100 Subject: [PATCH] Add patch from Juhu/strafehud-fixes branch: "strafehud: make gradient segments calculate their appearance using the center of the segment instead of the left edge" --- qcsrc/client/hud/panel/strafehud.qc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qcsrc/client/hud/panel/strafehud.qc b/qcsrc/client/hud/panel/strafehud.qc index 06d34ad97..1beb23bce 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -1222,12 +1222,12 @@ void StrafeHUD_drawGradient(vector color1, vector color2, vector size, float ori float ratio, alpha_ratio, combine_ratio1, combine_ratio2, segment_offset; segment_size.x = min(size.x - i, 1); // each gradient segment is 1 unit wide except if there is less than 1 unit of gradient remaining segment_offset = offset + i; + ratio = (i + segment_size.x/2 + gradientOffset) / original_width * (gradientType == STRAFEHUD_GRADIENT_BOTH ? 2 : 1); if(doProject) { segment_size.x = StrafeHUD_projectWidth(segment_offset, segment_size.x, range); segment_offset = StrafeHUD_projectOffset(segment_offset, range); } - ratio = (i + gradientOffset) / original_width * (gradientType == STRAFEHUD_GRADIENT_BOTH ? 2 : 1); if(ratio > 1) ratio = 2 - ratio; if(gradientType != STRAFEHUD_GRADIENT_RIGHT) ratio = 1 - ratio; alpha_ratio = alpha1 - (alpha1 - alpha2) * ratio; -- 2.39.2