From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Fri, 3 Feb 2023 23:59:38 +0000 (+0100) Subject: Add patch from Juhu/strafehud-fixes branch: "strafehud: make gradient segments calcul... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=68fbe0649a5891b17b80a994a4879634294d73c9;p=xonotic%2Fxonotic-data.pk3dir.git 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" --- 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;