]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/shownames.qc
remove unnecessary main.qh includes (also one server/player.qh include)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / shownames.qc
index 87633056de69b7dbb52e5916b6447352fb3acda7..fcca84189f697a9ac0e1d18368abc5384ae17a85 100644 (file)
@@ -1,14 +1,14 @@
 #include "shownames.qh"
 
 #include "autocvars.qh"
-#include "miscfunctions.qh"
+#include <client/draw.qh>
 #include "resources.qh"
+#include <client/view.qh>
 #include "hud/_mod.qh"
 
 #include <common/ent_cs.qh>
 #include <common/constants.qh>
 #include <common/net_linked.qh>
-#include <common/mapinfo.qh>
 #include <common/teams.qh>
 
 #include <lib/csqcmodel/cl_model.qh>
@@ -126,7 +126,8 @@ void Draw_ShowNames(entity this)
                if (f < 0) f = 0;
                a *= f;
        }
-       if (a < ALPHA_MIN_VISIBLE && ISGAMETYPE(CTS)) return;
+       if (MUTATOR_CALLHOOK(ShowNames_Draw, this, a)) return;
+       a = M_ARGV(1, float);
        if (vdist(this.origin - view_origin, >=, max_shot_distance)) return;
        float dist = vlen(this.origin - view_origin);
        if (autocvar_hud_shownames_maxdistance)
@@ -155,7 +156,7 @@ void Draw_ShowNames(entity this)
                myPos.y += (mySize.y / resize - mySize.y);
                // this is where the origin of the string
                float namewidth = mySize.x;
-               if (autocvar_hud_shownames_status && this.sameteam)
+               if (autocvar_hud_shownames_status && this.sameteam && !this.csqcmodel_isdead)
                {
                        vector pos = myPos + eY * autocvar_hud_shownames_fontsize * resize;
                        vector sz = vec2(0.5 * mySize.x, resize * autocvar_hud_shownames_statusbar_height);
@@ -176,7 +177,7 @@ void Draw_ShowNames(entity this)
                }
                string s = entcs_GetName(this.sv_entnum - 1);
                if ((autocvar_hud_shownames_decolorize == 1 && teamplay) || autocvar_hud_shownames_decolorize == 2)
-                       s = playername(s, entcs_GetTeam(this.sv_entnum - 1));
+                       s = playername(s, entcs_GetTeam(this.sv_entnum - 1), true);
                drawfontscale = '1 1 0' * resize;
                s = textShortenToWidth(s, namewidth, '1 1 0' * autocvar_hud_shownames_fontsize, stringwidth_colors);
                float width = stringwidth(s, true, '1 1 0' * autocvar_hud_shownames_fontsize);
@@ -213,7 +214,7 @@ void Draw_ShowNames_All()
                        it.sameteam = false;
                }
                bool dead = entcs_IsDead(i) || entcs_IsSpectating(i);
-               if (!it.csqcmodel_isdead || it.alpha > 0)
+               if ((!it.csqcmodel_isdead || it.alpha > 0) && entcs.origin != it.origin)
                        setorigin(it, entcs.origin);
                it.csqcmodel_isdead = dead;
                Draw_ShowNames(it);