]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Optimize shownames code a tiny bit by doing the vlen call a bit later
authorMario <mario@smbclan.net>
Sat, 27 May 2017 13:10:14 +0000 (23:10 +1000)
committerMario <mario@smbclan.net>
Sat, 27 May 2017 13:10:14 +0000 (23:10 +1000)
qcsrc/client/shownames.qc

index 0500652b9a5c6802a442edf091a43857cdf219c7..6920a98d197b9ce595298a0d454dd20accdb7839 100644 (file)
@@ -63,7 +63,6 @@ void Draw_ShowNames(entity this)
                        overlap = 0;
        }
 
-       float dist = vlen(this.origin - view_origin);
        if (overlap == -1 && autocvar_hud_shownames_antioverlap)
        {
                // fade tag out if another tag that is closer to you overlaps
@@ -76,7 +75,7 @@ void Draw_ShowNames(entity this)
                        if (eo.z < 0 || eo.x < 0 || eo.y < 0 || eo.x > vid_conwidth || eo.y > vid_conheight) continue;
                        eo.z = 0;
                        if (vdist(((eX * o.x + eY * o.y) - eo), <, autocvar_hud_shownames_antioverlap_distance)
-                           && vdist((it.origin - view_origin), <, dist))
+                           && vlen2(it.origin - view_origin) < vlen2(this.origin - view_origin))
                        {
                                overlap = 1;
                                break;
@@ -118,6 +117,7 @@ void Draw_ShowNames(entity this)
        }
        if (a < ALPHA_MIN_VISIBLE && gametype != MAPINFO_TYPE_CTS) return;
        if (vdist(this.origin - view_origin, >=, max_shot_distance)) return;
+       float dist = vlen(this.origin - view_origin);
        if (autocvar_hud_shownames_maxdistance)
        {
                if (dist >= autocvar_hud_shownames_maxdistance) return;