summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorRoman Tetelman <kevlarman@gmail.com>2009-10-03 12:01:59 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:37 +0000
commit49068a11006c30cb814104f2a9c5ea5629fc8487 (patch)
tree1f70fd30b9d4b85f3d3c30b96d8ccebc92b847f7 /src/game
parent1816219a5742bf0f986aedb176c531c297b8ea51 (diff)
* workaround to make the hud location work for spectators and players not in the top 8 score of their team
Diffstat (limited to 'src/game')
-rw-r--r--src/game/g_team.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/src/game/g_team.c b/src/game/g_team.c
index b0088ff5..845ea65e 100644
--- a/src/game/g_team.c
+++ b/src/game/g_team.c
@@ -77,7 +77,7 @@ gentity_t *Team_GetLocation( gentity_t *ent )
best = NULL;
bestlen = 3.0f * 8192.0f * 8192.0f;
- VectorCopy( ent->r.currentOrigin, origin );
+ VectorCopy( ent->client->ps.origin, origin );
for( eloc = level.locationHead; eloc; eloc = eloc->nextTrain )
{
@@ -160,9 +160,28 @@ void TeamplayInfoMessage( gentity_t *ent )
int h, a = 0;
int clients[ TEAM_MAXOVERLAY ];
+ //hack: always send each client's teaminfo to it for CG_PLAYER_LOCATION
+ h = ent->client->ps.stats[ STAT_HEALTH ];
+ if( h < 0 )
+ h = 0;
+
+ trap_SendServerCommand( ent - g_entities,
+ va("tinfo %i %i %i %i %i %i",
+ 1,
+ ent - g_entities,
+ ent->client->pers.location,
+ h,
+ a,
+ ent->client->ps.weapon ) );
+
if( ! ent->client->pers.teamInfo )
return;
+ if( !ent->inuse ||
+ ( !( ent->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) &&
+ !( ent->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) ) )
+ 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)
@@ -228,17 +247,12 @@ void CheckTeamStatus( void )
if( ent->client->pers.connected != CON_CONNECTED )
continue;
- if( ent->inuse && ( ent->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ||
- ent->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) )
- {
-
- loc = Team_GetLocation( ent );
-
- if( loc )
- ent->client->pers.location = loc->health;
- else
- ent->client->pers.location = 0;
- }
+ loc = Team_GetLocation( ent );
+ if( loc )
+ ent->client->pers.location = loc->health;
+ else
+ ent->client->pers.location = 0;
+
}
for( i = 0; i < g_maxclients.integer; i++ )
@@ -247,9 +261,7 @@ void CheckTeamStatus( void )
if( ent->client->pers.connected != CON_CONNECTED )
continue;
- if( ent->inuse && ( ent->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ||
- ent->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) )
- TeamplayInfoMessage( ent );
+ TeamplayInfoMessage( ent );
}
}
}