]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/shownames.qc
Merge remote-tracking branch 'origin/samual/serverlist'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / shownames.qc
index c2bff62c89172c3a0a203a801694182235b1da0a..c581fba428fe42ff44f203da50c94f7f612e8eb1 100644 (file)
@@ -13,13 +13,13 @@ void Draw_ShowNames(entity ent)
 {
        if(!autocvar_hud_shownames)
                return;
-       
+
 #ifdef COMPAT_XON050_ENGINE
        if((ent.sv_entnum == player_localentnum) || (ent.sv_entnum == spectatee_status)) // ent is me or person i'm spectating
 #else
        if(ent.sv_entnum == player_localentnum) // ent is me or person i'm spectating
 #endif
-               if not (autocvar_hud_shownames_self && autocvar_chase_active) 
+               if(!(autocvar_hud_shownames_self && autocvar_chase_active))
                        return;
 
        makevectors(view_angles);
@@ -27,7 +27,7 @@ void Draw_ShowNames(entity ent)
        if(ent.sameteam || (!ent.sameteam && autocvar_hud_shownames_enemies))
        {
                ent.origin_z += autocvar_hud_shownames_offset;
-       
+
                float hit;
                if(ent.sameteam && !autocvar_hud_shownames_crosshairdistance)
                {
@@ -36,18 +36,18 @@ void Draw_ShowNames(entity ent)
                else
                {
                        traceline(view_origin, ent.origin, MOVE_NORMAL, ent);
-                       if(trace_fraction < 1 && trace_networkentity != ent.sv_entnum)
+                       if(trace_fraction < 1 && (trace_networkentity != ent.sv_entnum && trace_ent.entnum != ent.sv_entnum))
                                hit = 0;
                        else
                                hit = 1;
                }
 
                // handle tag fading
-               float overlap, onscreen, crosshairdistance;
+               float overlap = FALSE, onscreen, crosshairdistance;
                vector o, eo;
-               
+
                o = project_3d_to_2d(ent.origin);
-               
+
                if(autocvar_hud_shownames_antioverlap)
                {
                        // fade tag out if another tag that is closer to you overlaps
@@ -57,7 +57,7 @@ void Draw_ShowNames(entity ent)
                                if(e == ent)
                                        continue;
                                eo = project_3d_to_2d(e.origin);
-                               if not(eo_z < 0 || eo_x < 0 || eo_y < 0 || eo_x > vid_conwidth || eo_y > vid_conheight)
+                               if (!(eo_z < 0 || eo_x < 0 || eo_y < 0 || eo_x > vid_conwidth || eo_y > vid_conheight))
                                {
                                        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))
@@ -71,30 +71,30 @@ void Draw_ShowNames(entity ent)
 
                onscreen = (o_z >= 0 && o_x >= 0 && o_y >= 0 && o_x <= vid_conwidth && o_y <= vid_conheight);
                crosshairdistance = sqrt( pow(o_x - vid_conwidth/2, 2) + pow(o_y - vid_conheight/2, 2) );
-               
+
                if(autocvar_hud_shownames_crosshairdistance)
                {
                        if(autocvar_hud_shownames_crosshairdistance > crosshairdistance)
                                ent.pointtime = time;
-                               
-                       if not(ent.pointtime + autocvar_hud_shownames_crosshairdistance_time > time)
+
+                       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.
                }
-               
+
                if(!ent.fadedelay)
                        ent.fadedelay = time + SHOWNAMES_FADEDELAY;
 
                if(!ent.sameteam && (!onscreen || !hit)) // out of view, fade out
-               { 
-                       ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * frametime); 
+               {
+                       ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * frametime);
                        ent.fadedelay = 0; // reset fade in delay, enemy has left the view
                }
                else if(ent.csqcmodel_isdead) // dead player, fade out slowly
-                       ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * 0.25 * frametime); 
+                       ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * 0.25 * frametime);
                else if(overlap) // tag overlap detected, fade out
-                       ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * frametime); 
+                       ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * frametime);
                else if(ent.sameteam) // fade in for team mates
                        ent.alpha = min(1, ent.alpha + SHOWNAMES_FADESPEED * frametime);
                else if(time > ent.fadedelay) // fade in for enemies
@@ -102,7 +102,7 @@ void Draw_ShowNames(entity ent)
 
                if(!ent.alpha)
                        return;
-               
+
                float dist;
                dist = vlen(ent.origin - view_origin);
 
@@ -187,7 +187,7 @@ void Draw_ShowNames_All()
        {
                float t;
                t = GetPlayerColor(i);
-               if(t == COLOR_SPECTATOR)
+               if(t == NUM_SPECTATOR)
                        continue;
 
                entity e;
@@ -215,10 +215,10 @@ void Draw_ShowNames_All()
                        e.sameteam = 0;
                }
 
-               e.origin = getplayerorigin(i);
+               setorigin(e, getplayerorigin(i));
                if(e.origin == GETPLAYERORIGIN_ERROR)
                        continue;
-                       
+
                e.csqcmodel_isdead = getplayerisdead(i);
 
                Draw_ShowNames(e);