]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/shownames.qc
Make 2 hud skin cvars into user cvars (hud_panel_timer_increment and hud_panel_physic...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / shownames.qc
index 779898608b816218a21f2350de91fadc384e0235..300521545354cad1a34efbca961a6193b8e8c9a5 100644 (file)
@@ -1,3 +1,13 @@
+#include "shownames.qh"
+
+#include "hud/all.qh"
+
+#include "../common/constants.qh"
+#include "../common/mapinfo.qh"
+#include "../common/teams.qh"
+
+#include "../lib/csqcmodel/cl_model.qh"
+
 // self.isactive = player is in range and coordinates/status (health and armor) are up to date
 // self.origin = player origin TODO: should maybe move this so it's the origin of the shownames tag already in SSQC for culling?
 // self.healthvalue
@@ -37,7 +47,7 @@ void Draw_ShowNames(entity ent)
                }
 
                // handle tag fading
-               float overlap = FALSE, onscreen, crosshairdistance;
+               float overlap = false, onscreen, crosshairdistance;
                vector o, eo;
 
                o = project_3d_to_2d(ent.origin);
@@ -53,10 +63,10 @@ void Draw_ShowNames(entity ent)
                                eo = project_3d_to_2d(e.origin);
                                if (!(eo.z < 0 || eo.x < 0 || eo.y < 0 || eo.x > vid_conwidth || eo.y > vid_conheight))
                                {
-                                       eo_z = 0;
+                                       eo.z = 0;
                                        if(vlen((eX * o.x + eY * o.y) - eo) < autocvar_hud_shownames_antioverlap_distance && vlen(ent.origin - view_origin) > vlen(e.origin - view_origin))
                                        {
-                                               overlap = TRUE;
+                                               overlap = true;
                                                break;
                                        }
                                }
@@ -71,10 +81,10 @@ void Draw_ShowNames(entity ent)
                        if(autocvar_hud_shownames_crosshairdistance > crosshairdistance)
                                ent.pointtime = time;
 
-                       if (!(ent.pointtime + autocvar_hud_shownames_crosshairdistance_time > time))
-                               overlap = TRUE;
+                       if (ent.pointtime + autocvar_hud_shownames_crosshairdistance_time <= time)
+                               overlap = true;
                        else
-                               overlap = (autocvar_hud_shownames_crosshairdistance_antioverlap ? overlap : FALSE); // override what antioverlap says unless allowed by cvar.
+                               overlap = (autocvar_hud_shownames_crosshairdistance_antioverlap ? overlap : false); // override what antioverlap says unless allowed by cvar.
                }
 
                if(!ent.fadedelay)
@@ -125,7 +135,7 @@ void Draw_ShowNames(entity ent)
                // draw the sprite image
                if(o.z >= 0)
                {
-                       o_z = 0;
+                       o.z = 0;
 
                        vector myPos, mySize;
                        mySize = (eX * autocvar_hud_shownames_aspect + eY) * autocvar_hud_shownames_fontsize;
@@ -167,7 +177,7 @@ void Draw_ShowNames(entity ent)
                        s = textShortenToWidth(s, namewidth, '1 1 0' * autocvar_hud_shownames_fontsize, stringwidth_colors);
 
                        float width;
-                       width = stringwidth(s, TRUE, '1 1 0' * autocvar_hud_shownames_fontsize);
+                       width = stringwidth(s, true, '1 1 0' * autocvar_hud_shownames_fontsize);
 
                        if (width != namewidth)
                                namepos.x += (namewidth - width) / 2;
@@ -192,8 +202,7 @@ void Draw_ShowNames_All()
                e = shownames_ent[i];
                if(!e)
                {
-                       e = spawn();
-                       e.classname = "shownames_tag";
+                       e = new(shownames_tag);
                        e.sv_entnum = i+1;
                        shownames_ent[i] = e;
                }