From: Rudolf Polzer Date: Sat, 14 May 2011 18:06:49 +0000 (+0200) Subject: add a getplayerorigin() function that finds any player's origin if the system knows it X-Git-Tag: xonotic-v0.5.0~257^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=75a398ea3ccd09e70c582b508b39aa52415def96;p=xonotic%2Fxonotic-data.pk3dir.git add a getplayerorigin() function that finds any player's origin if the system knows it --- diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index 03cbd528a..f03c2b33d 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -665,6 +665,7 @@ void Ent_ReadEntCS() self.origin_z = ReadShort(); self.angles_y = ReadByte() * 360.0 / 256; self.origin_z = self.angles_x = self.angles_z = 0; + entcs_receiver[self.sv_entnum] = self; InterpolateOrigin_Note(); } diff --git a/qcsrc/client/main.qh b/qcsrc/client/main.qh index aacd41589..af849e18c 100644 --- a/qcsrc/client/main.qh +++ b/qcsrc/client/main.qh @@ -162,3 +162,5 @@ float g_balance_grenadelauncher_bouncestop; float g_balance_electro_secondary_bouncefactor; float g_balance_electro_secondary_bouncestop; float g_trueaim_minrange; + +entity entcs_receiver[255]; // 255 is the engine limit on maxclients diff --git a/qcsrc/client/miscfunctions.qc b/qcsrc/client/miscfunctions.qc index 247dc4b35..fdaaf7da6 100644 --- a/qcsrc/client/miscfunctions.qc +++ b/qcsrc/client/miscfunctions.qc @@ -754,3 +754,15 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect R_EndPolygon(); } } + +const vector GETPLAYERORIGIN_ERROR = '1123581321 2357111317 3141592653'; // way out of bounds for anything on the map +vector getplayerorigin(float pl) +{ + string s; + s = getplayerkey(pl, "TEMPHACK_origin"); + if(s != "") + return stov(s); + if(entcs_receiver[pl].classname == "entcs_receiver") + return entcs_receiver[pl].origin; + return GETPLAYERORIGIN_ERROR; +}