From: Rudolf Polzer Date: Sat, 18 Feb 2012 16:48:21 +0000 (+0100) Subject: support csqcplayers in crosshair hit test X-Git-Tag: xonotic-v0.6.0~71 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c56b4575becb1befd09b89d8de6a7b02ec1a53e1;p=xonotic%2Fxonotic-data.pk3dir.git support csqcplayers in crosshair hit test --- diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index f1112b33a..2cdc9f17e 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -220,14 +220,18 @@ void TrueAim_Init() float EnemyHitCheck() { - float t; + float t, n; wcross_origin = project_3d_to_2d(trace_endpos); wcross_origin_z = 0; - if(trace_networkentity < 1) + if(trace_ent) + n = trace_ent.entnum; + else + n = trace_networkentity; + if(n < 1) return SHOTTYPE_HITWORLD; - if(trace_networkentity > maxclients) + if(n > maxclients) return SHOTTYPE_HITWORLD; - t = GetPlayerColor(trace_networkentity - 1); + t = GetPlayerColor(n - 1); if(teamplay) if(t == myteam) return SHOTTYPE_HITTEAM; diff --git a/qcsrc/client/shownames.qc b/qcsrc/client/shownames.qc index c2bff62c8..5309c555e 100644 --- a/qcsrc/client/shownames.qc +++ b/qcsrc/client/shownames.qc @@ -36,7 +36,7 @@ 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;