mirror of
https://github.com/UberGames/ioef.git
synced 2024-11-24 05:01:40 +00:00
Send team info for team overlay to spectators for the team of the client they're following (bug #5740).
This commit is contained in:
parent
56ebe14239
commit
e3fc1826b1
1 changed files with 19 additions and 5 deletions
|
@ -1066,17 +1066,32 @@ void TeamplayInfoMessage( gentity_t *ent ) {
|
|||
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 @@ void TeamplayInfoMessage( gentity_t *ent ) {
|
|||
|
||||
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 @@ void CheckTeamStatus(void) {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (ent->inuse && (ent->client->sess.sessionTeam == TEAM_RED || ent->client->sess.sessionTeam == TEAM_BLUE)) {
|
||||
if (ent->inuse) {
|
||||
TeamplayInfoMessage( ent );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue