]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
improve the way the trace is done for shownames
authorRudolf Polzer <divverent@xonotic.org>
Fri, 8 Jul 2011 22:18:43 +0000 (00:18 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Fri, 8 Jul 2011 22:18:43 +0000 (00:18 +0200)
qcsrc/client/View.qc
qcsrc/client/csqc_builtins.qc
qcsrc/client/shownames.qc

index dfefe96ff596d400fdeb70d327ab1eb0cfa7e593..48566db5739ae1d9b43e401a16613d71aa6edc7d 100644 (file)
@@ -1,7 +1,5 @@
 entity porto;
 vector polyline[16];
-float trace_dphitcontents;
-float trace_networkentity;
 float Q3SURFACEFLAG_SLICK = 2; // low friction surface
 float DPCONTENTS_SOLID = 1; // blocks player movement
 float DPCONTENTS_BODY = 32; // blocks player movement
index b9df8f8f5c73a0ca678351aefccc9ca20ee10017..c8b555dc39758791474c5201be8961798a3db508 100644 (file)
@@ -331,3 +331,6 @@ float CVAR_TYPEFLAG_HASDESCRIPTION = 16;
 float CVAR_TYPEFLAG_READONLY = 32;
 
 void (entity e, float chan, string samp, float vol, float atten, float pitchshift, float flags)        sound7 = #8;
+
+float trace_dphitcontents;
+float trace_networkentity;
index de0c0e8c593bf28018f59417b5848dd3a20581b8..e3c6f3d4bda4575b2ee531d8e251c8d3953039fc 100644 (file)
@@ -19,8 +19,19 @@ void Draw_ShowNames(entity ent)
        {
                ent.origin_z += autocvar_hud_shownames_offset;
 
-               if(!ent.sameteam)
-                       traceline(ent.origin, view_origin, 1, ent);
+               float hit;
+               if(ent.sameteam)
+               {
+                       hit = 1;
+               }
+               else
+               {
+                       traceline(view_origin, ent.origin, MOVE_NORMAL, ent);
+                       if(trace_fraction < 1 && trace_networkentity != ent.sv_entnum)
+                               hit = 0;
+                       else
+                               hit = 1;
+               }
 
                vector o, eo;
                o = project_3d_to_2d(ent.origin);
@@ -49,7 +60,7 @@ void Draw_ShowNames(entity ent)
 
                onscreen = (o_z >= 0 && o_x >= 0 && o_y >= 0 && o_x <= vid_conwidth && o_y <= vid_conheight);
 
-               if(!ent.sameteam && (!onscreen || trace_endpos != view_origin)) // out of view, fade out
+               if(!ent.sameteam && (!onscreen || !hit)) // out of view, fade out
                        ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * frametime);
                else if(ent.healthvalue < 1) // dead player, fade out slowly
                        ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * 0.25 * frametime);