From: Rudolf Polzer Date: Fri, 8 Jul 2011 22:18:43 +0000 (+0200) Subject: improve the way the trace is done for shownames X-Git-Tag: xonotic-v0.5.0~148^2~54 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4e8bc60b3a6c2934a43fe09cd175fa964904a729;p=xonotic%2Fxonotic-data.pk3dir.git improve the way the trace is done for shownames --- diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index dfefe96ff..48566db57 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -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 diff --git a/qcsrc/client/csqc_builtins.qc b/qcsrc/client/csqc_builtins.qc index b9df8f8f5..c8b555dc3 100644 --- a/qcsrc/client/csqc_builtins.qc +++ b/qcsrc/client/csqc_builtins.qc @@ -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; diff --git a/qcsrc/client/shownames.qc b/qcsrc/client/shownames.qc index de0c0e8c5..e3c6f3d4b 100644 --- a/qcsrc/client/shownames.qc +++ b/qcsrc/client/shownames.qc @@ -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);