]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add patch from Juhu/strafehud-fixes branch: "strafehud: make gradient segments calcul...
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Fri, 3 Feb 2023 23:59:38 +0000 (00:59 +0100)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Fri, 3 Feb 2023 23:59:38 +0000 (00:59 +0100)
qcsrc/client/hud/panel/strafehud.qc

index 06d34ad974150127b72314cd488296174766957f..1beb23bce90cf717f26a3ab85982dbc7cb5b6a71 100644 (file)
@@ -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;