]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/itemstime_checkmark2' into 'master'
authorMario <zacjardine@y7mail.com>
Sat, 3 Oct 2015 07:20:03 +0000 (07:20 +0000)
committerMario <zacjardine@y7mail.com>
Sat, 3 Oct 2015 07:20:03 +0000 (07:20 +0000)
Itemstime: draw a checkmark for available items

Itemstime: draw a checkmark instead of centering the item icon when an item is a vailable again (only when the client has the checkmark image)

See merge request !213

gfx/hud/default/checkmark.tga [new file with mode: 0644]
qcsrc/common/mutators/mutator/itemstime.qc

diff --git a/gfx/hud/default/checkmark.tga b/gfx/hud/default/checkmark.tga
new file mode 100644 (file)
index 0000000..71cbd68
Binary files /dev/null and b/gfx/hud/default/checkmark.tga differ
index d7ca5a3351585f82148d90d6457d184ff13f3b8c..4d859b1fcab1438db82826be497093395af67a11 100644 (file)
@@ -232,10 +232,15 @@ void DrawItemsTimeItem(vector myPos, vector mySize, float ar, entity item, float
         HUD_Panel_DrawProgressBar(p_pos, p_size, autocvar_hud_panel_itemstime_progressbar_name, t/autocvar_hud_panel_itemstime_progressbar_maxtime, 0, autocvar_hud_panel_itemstime_iconalign, color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
     }
 
-    if (t > 0 && autocvar_hud_panel_itemstime_text)
-        drawstring_aspect(numpos, ftos(t), eX * ((ar - 1)/ar) * mySize_x + eY * mySize_y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
-    else
-        picpos.x = myPos.x + mySize.x / 2 - mySize.y / 2;
+    if(autocvar_hud_panel_itemstime_text)
+    {
+        if(t > 0)
+            drawstring_aspect(numpos, ftos(t), eX * ((ar - 1)/ar) * mySize_x + eY * mySize_y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
+        else if(precache_pic("gfx/hud/default/checkmark")) // COMPAT: check if this image exists, as 0.8.1 clients lack it
+            drawpic_aspect_skin(numpos, "checkmark", eX * (ar - 1) * mySize_y + eY * mySize_y, '1 1 1', panel_fg_alpha * picalpha, DRAWFLAG_NORMAL);
+        else // legacy code, if the image is missing just center the icon
+            picpos.x = myPos.x + mySize.x / 2 - mySize.y / 2;
+    }
     if (item_availableTime)
         drawpic_aspect_skin_expanding(picpos, item.m_icon, '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha * picalpha, DRAWFLAG_NORMAL, item_availableTime);
     drawpic_aspect_skin(picpos, item.m_icon, '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha * picalpha, DRAWFLAG_NORMAL);