X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fhud%2Fhud.qc;h=cfb819efab9c30b5899d022412719d222fcadfcd;hb=d126fd4da497fb8c7cbd5939ed9c6ee07cd2df9c;hp=7cb9919b8eca18d3976dfcd5f44a9757f253bfc6;hpb=d24e46b65c1fe73fae4cf8034f4e7f318a17053a;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/hud/hud.qc b/qcsrc/client/hud/hud.qc index 7cb9919b8..cfb819efa 100644 --- a/qcsrc/client/hud/hud.qc +++ b/qcsrc/client/hud/hud.qc @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -292,11 +293,11 @@ void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, flo pic = "gfx/hud/default/progressbar_vertical"; } - if (baralign == 1) // bottom align + if (baralign == 1) // bottom align theOrigin.y += (1 - length_ratio) * theSize.y; - else if (baralign == 2) // center align - theOrigin.y += 0.5 * (1 - length_ratio) * theSize.y; - else if (baralign == 3) // center align, positive values down, negative up + else if (baralign == 2) // center align + theOrigin.y += 0.5 * (1 - length_ratio) * theSize.y; + else if (baralign == 3) // center align, positive values down, negative up { theSize.y *= 0.5; if (length_ratio > 0) @@ -336,9 +337,9 @@ void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, flo if (baralign == 1) // right align theOrigin.x += (1 - length_ratio) * theSize.x; - else if (baralign == 2) // center align - theOrigin.x += 0.5 * (1 - length_ratio) * theSize.x; - else if (baralign == 3) // center align, positive values on the right, negative on the left + else if (baralign == 2) // center align + theOrigin.x += 0.5 * (1 - length_ratio) * theSize.x; + else if (baralign == 3) // center align, positive values on the right, negative on the left { theSize.x *= 0.5; if (length_ratio > 0) @@ -394,11 +395,12 @@ void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theA drawsubpic(pos + eX * mySize.x - eX * min(mySize.x * 0.5, mySize.y), eX * min(mySize.x * 0.5, mySize.y) + eY * mySize.y, pic, '0.75 0 0', '0.25 1 0', color, theAlpha, drawflag); } -void DrawNumIcon_expanding(vector myPos, vector mySize, float theTime, string icon, bool vertical, int icon_right_align, vector color, float theAlpha, float fadelerp) +void DrawNumIcon_expanding(vector myPos, vector mySize, float theTime, string icon, bool vertical, bool isInfinite, int icon_right_align, vector color, float theAlpha, float fadelerp) { TC(bool, vertical); TC(int, icon_right_align); vector newPos = '0 0 0', newSize = '0 0 0'; vector picpos, numpos; + string text = isInfinite ? "\xE2\x88\x9E" : ftos(theTime); // Use infinity symbol (U+221E) if (vertical) { @@ -436,7 +438,7 @@ void DrawNumIcon_expanding(vector myPos, vector mySize, float theTime, string ic // reduce only y to draw numbers with different number of digits with the same y size numpos.y += newSize.y * ((1 - 0.7) / 2); newSize.y *= 0.7; - drawstring_aspect(numpos, ftos(theTime), newSize, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL); + drawstring_aspect(numpos, text, newSize, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL); return; } @@ -470,14 +472,14 @@ void DrawNumIcon_expanding(vector myPos, vector mySize, float theTime, string ic // NOTE: newSize_x is always equal to 3 * mySize_y so we can use // '2 1 0' * newSize_y instead of eX * (2/3) * newSize_x + eY * newSize_y - drawstring_aspect_expanding(numpos, ftos(theTime), '2 1 0' * newSize.y, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp); + drawstring_aspect_expanding(numpos, text, '2 1 0' * newSize.y, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp); drawpic_aspect_skin_expanding(picpos, icon, '1 1 0' * newSize.y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp); } -void DrawNumIcon(vector myPos, vector mySize, float theTime, string icon, bool vertical, int icon_right_align, vector color, float theAlpha) +void DrawNumIcon(vector myPos, vector mySize, float theTime, string icon, bool vertical, bool isInfinite, int icon_right_align, vector color, float theAlpha) { TC(bool, vertical); TC(int, icon_right_align); - DrawNumIcon_expanding(myPos, mySize, theTime, icon, vertical, icon_right_align, color, theAlpha, 0); + DrawNumIcon_expanding(myPos, mySize, theTime, icon, vertical, isInfinite, icon_right_align, color, theAlpha, 0); } /*