From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Fri, 3 Feb 2023 23:53:02 +0000 (+0100) Subject: strafehud: make gradient segments calculate their appearance using the center of... X-Git-Tag: xonotic-v0.8.6~136^2~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0ef6a83f0809ee5c68b9ac790b4ffc0d02e4d18f;p=xonotic%2Fxonotic-data.pk3dir.git 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 620a22ff0..32c175c35 100644 --- a/qcsrc/client/hud/panel/strafehud.qc +++ b/qcsrc/client/hud/panel/strafehud.qc @@ -1082,7 +1082,7 @@ void StrafeHUD_drawGradient(vector color1, vector color2, vector size, float ori { float ratio, alpha_ratio, combine_ratio1, combine_ratio2; 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 - ratio = (i + gradientOffset) / original_width * (gradientType == STRAFEHUD_GRADIENT_BOTH ? 2 : 1); + ratio = (i + segment_size.x/2 + 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;