]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Waypoint icons: Better drawing algorithm.
authorLyberta <lyberta@lyberta.net>
Fri, 15 Jun 2018 15:40:26 +0000 (18:40 +0300)
committerLyberta <lyberta@lyberta.net>
Fri, 15 Jun 2018 15:40:26 +0000 (18:40 +0300)
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc

index 326a26219b34e8008fe275f5b6d22076c958454a..1eebd8ed83488fa4dca7b86a03c1749233061b7d 100644 (file)
@@ -426,10 +426,17 @@ vector drawsprite_TextOrIcon(bool is_text, vector o, float ang, float minwidth,
 
     o.x += 0.5 * (w - sw);
 
-    if (is_text)
-        drawstring(o, str, sz, rgb, a, DRAWFLAG_NORMAL);
-    else
-        drawpic(o, str, sz, rgb, a, DRAWFLAG_NORMAL);
+       if (is_text)
+       {
+               drawstring(o, str, sz, rgb, a, DRAWFLAG_NORMAL);
+       }
+       else
+       {
+               drawpic(o, str, sz, rgb, a, DRAWFLAG_NORMAL);
+               // https://docs.gimp.org/en/gimp-tool-desaturate.html
+               float gray = rgb.x * 0.21 + rgb.y * 0.72 + rgb.z * 0.07;
+               drawpic(o, str, sz, '1 1 1', gray * a, DRAWFLAG_ADDITIVE);
+       }
 
     o.x += 0.5 * sw;
     o.y += 0.5 * h;