[quake3-commits] r2315 - trunk/code/game

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Sep 8 19:19:07 EDT 2012


Author: ztm
Date: 2012-09-08 19:19:06 -0400 (Sat, 08 Sep 2012)
New Revision: 2315

Modified:
   trunk/code/game/g_team.c
Log:
Send team info for team overlay to spectators for the team of the client they're following (bug #5740).

Modified: trunk/code/game/g_team.c
===================================================================
--- trunk/code/game/g_team.c	2012-09-08 22:32:41 UTC (rev 2314)
+++ trunk/code/game/g_team.c	2012-09-08 23:19:06 UTC (rev 2315)
@@ -1066,17 +1066,32 @@
 	int			cnt;
 	int			h, a;
 	int			clients[TEAM_MAXOVERLAY];
+	int			team;
 
 	if ( ! ent->client->pers.teamInfo )
 		return;
 
+	// send team info to spectator for team of followed client
+	if (ent->client->sess.sessionTeam == TEAM_SPECTATOR) {
+		if ( ent->client->sess.spectatorState != SPECTATOR_FOLLOW
+			|| ent->client->sess.spectatorClient < 0 ) {
+			return;
+		}
+		team = g_entities[ ent->client->sess.spectatorClient ].client->sess.sessionTeam;
+	} else {
+		team = ent->client->sess.sessionTeam;
+	}
+
+	if (team != TEAM_RED && team != TEAM_BLUE) {
+		return;
+	}
+
 	// figure out what client should be on the display
 	// we are limited to 8, but we want to use the top eight players
 	// but in client order (so they don't keep changing position on the overlay)
 	for (i = 0, cnt = 0; i < g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i++) {
 		player = g_entities + level.sortedClients[i];
-		if (player->inuse && player->client->sess.sessionTeam == 
-			ent->client->sess.sessionTeam ) {
+		if (player->inuse && player->client->sess.sessionTeam == team ) {
 			clients[cnt++] = level.sortedClients[i];
 		}
 	}
@@ -1090,8 +1105,7 @@
 
 	for (i = 0, cnt = 0; i < g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i++) {
 		player = g_entities + i;
-		if (player->inuse && player->client->sess.sessionTeam == 
-			ent->client->sess.sessionTeam ) {
+		if (player->inuse && player->client->sess.sessionTeam == team ) {
 
 			h = player->client->ps.stats[STAT_HEALTH];
 			a = player->client->ps.stats[STAT_ARMOR];
@@ -1146,7 +1160,7 @@
 				continue;
 			}
 
-			if (ent->inuse && (ent->client->sess.sessionTeam == TEAM_RED ||	ent->client->sess.sessionTeam == TEAM_BLUE)) {
+			if (ent->inuse) {
 				TeamplayInfoMessage( ent );
 			}
 		}



More information about the quake3-commits mailing list