r1815 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Aug 11 12:46:33 EDT 2006


Author: div0
Date: 2006-08-11 12:46:32 -0400 (Fri, 11 Aug 2006)
New Revision: 1815

Modified:
   trunk/data/qcsrc/server/cl_impulse.qc
   trunk/data/qcsrc/server/cl_physics.qc
   trunk/data/qcsrc/server/defs.qh
   trunk/data/qcsrc/server/miscfunctions.qc
Log:
and now it shows the LAST player the crosshair pointed to


Modified: trunk/data/qcsrc/server/cl_impulse.qc
===================================================================
--- trunk/data/qcsrc/server/cl_impulse.qc	2006-08-11 16:43:09 UTC (rev 1814)
+++ trunk/data/qcsrc/server/cl_impulse.qc	2006-08-11 16:46:32 UTC (rev 1815)
@@ -115,7 +115,7 @@
 	}
 	else if (imp == 18)
 	{
-		if(self.cursor_trace_ent.classname == "player")
+		if(self.last_trace_player)
 		{
 			string t;
 			string h;
@@ -123,11 +123,11 @@
 			h = "";
 			if(teams_matter)
 			{
-				t = Team_ColorCode(self.cursor_trace_ent.team);
-				if(self.team == self.cursor_trace_ent.team)
-					h = strcat(" (", ftos(self.cursor_trace_ent.health), "% health)");
+				t = Team_ColorCode(self.last_trace_player.team);
+				if(self.team == self.last_trace_player.team)
+					h = strcat(" (", ftos(self.last_trace_player.health), "% health)");
 			}
-			centermsg_set(CENTERMSG_KILL, strcat(t, self.cursor_trace_ent.netname, h));
+			centermsg_set(CENTERMSG_KILL, strcat(t, self.last_trace_player.netname, h));
 		}
 	}
 	else

Modified: trunk/data/qcsrc/server/cl_physics.qc
===================================================================
--- trunk/data/qcsrc/server/cl_physics.qc	2006-08-11 16:43:09 UTC (rev 1814)
+++ trunk/data/qcsrc/server/cl_physics.qc	2006-08-11 16:46:32 UTC (rev 1815)
@@ -20,10 +20,16 @@
 	local vector wishvel, wishdir, v;
 	local float wishspeed, f, maxspd_mod, spd, maxairspd, airaccel, swampspd_mod;
 	string temps;
-
+	
 	if (clienttype(self) == CLIENTTYPE_BOT)
 		bot_think();
 
+	// doing this HERE because this is called for every client input frame, and
+	// client input frames update this
+	if(self.cursor_trace_ent)
+		if(self.cursor_trace_ent.classname == "player")
+			self.last_trace_player = self.cursor_trace_ent;
+
 	if (self.movetype == MOVETYPE_NONE)
 		return;
 

Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2006-08-11 16:43:09 UTC (rev 1814)
+++ trunk/data/qcsrc/server/defs.qh	2006-08-11 16:46:32 UTC (rev 1815)
@@ -284,3 +284,5 @@
 float W_AmmoItemCode(float wpn);
 float W_ItemCode(float wpn);
 string W_Name(float weaponid);
+
+.entity last_trace_player;

Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2006-08-11 16:43:09 UTC (rev 1814)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2006-08-11 16:46:32 UTC (rev 1815)
@@ -475,15 +475,15 @@
 		error(strcat("There were ", ftos(f), " frags left. BAD!"));
 }
 
-string Team_ColorCode(float team)
+string Team_ColorCode(float teamid)
 {
-	if(team == COLOR_TEAM1)
+	if(teamid == COLOR_TEAM1)
 		return "^1";
-	else if(team == COLOR_TEAM2)
+	else if(teamid == COLOR_TEAM2)
 		return "^4";
-	else if(team == COLOR_TEAM3)
+	else if(teamid == COLOR_TEAM3)
 		return "^6";
-	else if(team == COLOR_TEAM4)
+	else if(teamid == COLOR_TEAM4)
 		return "^3";
 	else
 		return "^7";




More information about the nexuiz-commits mailing list