diff options
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_event.c | 36 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 1 | ||||
-rw-r--r-- | src/cgame/cg_players.c | 1 |
3 files changed, 12 insertions, 26 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index a8632cb4..8acbbeaf 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -375,23 +375,18 @@ CG_TeamJoinMessage Prints messages when players change teams ============= */ -static void CG_TeamJoinMessage( entityState_t *ent ) +void CG_TeamJoinMessage( clientInfo_t *newInfo, clientInfo_t *ci ) { - int player; int team; int oldteam; char *playerName; // Collect info - player = ent->eventParm; - team = ent->otherEntityNum; - oldteam = ent->otherEntityNum2; + team = newInfo->team; + oldteam = ci->team; - if( player < 0 || player >= MAX_CLIENTS ) - CG_Error( "CG_TeamJoinMessage: target out of range" ); - - playerName = cgs.clientinfo[player].name; + playerName = newInfo->name; // If no change occurred, print nothing if( team == oldteam ) @@ -400,24 +395,18 @@ static void CG_TeamJoinMessage( entityState_t *ent ) // Print the appropriate message if( team == TEAM_NONE ) { - if( oldteam == TEAM_HUMANS ) - CG_Printf( "%s" S_COLOR_WHITE " left the humans\n", playerName ); - else if( oldteam == TEAM_ALIENS ) - CG_Printf( "%s" S_COLOR_WHITE " left the aliens\n", playerName ); + CG_Printf( "%s" S_COLOR_WHITE " left the %ss\n", + playerName, BG_TeamName( oldteam ) ); } else if( oldteam == TEAM_NONE ) { - if( team == TEAM_ALIENS ) - CG_Printf( "%s" S_COLOR_WHITE " joined the aliens\n", playerName ); - else if( team == TEAM_HUMANS ) - CG_Printf( "%s" S_COLOR_WHITE " joined the humans\n", playerName ); + CG_Printf( "%s" S_COLOR_WHITE " joined the %ss\n", + playerName, BG_TeamName( team ) ); } else { - if( oldteam == TEAM_HUMANS && team == TEAM_ALIENS ) - CG_Printf( "%s" S_COLOR_WHITE " abandoned the humans and joined the aliens\n", playerName ); - else if( oldteam == TEAM_ALIENS && team == TEAM_HUMANS ) - CG_Printf( "%s" S_COLOR_WHITE " abandoned the aliens and joined the humans\n", playerName ); + CG_Printf( "%s" S_COLOR_WHITE " left the %ss and joined the %ss\n", + playerName, BG_TeamName( oldteam ), BG_TeamName( team ) ); } } @@ -973,11 +962,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) CG_Obituary( es ); break; - case EV_TEAMJOIN: - DEBUGNAME( "EV_TEAMJOIN" ); - CG_TeamJoinMessage( es ); - break; - case EV_GIB_PLAYER: DEBUGNAME( "EV_GIB_PLAYER" ); // no gibbing diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index e4a19844..73933525 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1702,6 +1702,7 @@ void CG_PredictPlayerState( void ); void CG_CheckEvents( centity_t *cent ); void CG_EntityEvent( centity_t *cent, vec3_t position ); void CG_PainEvent( centity_t *cent, int health ); +void CG_TeamJoinMessage( clientInfo_t *newInfo, clientInfo_t *ci ); // diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index 28d19ba9..8bd0457c 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -772,6 +772,7 @@ void CG_NewClientInfo( int clientNum ) // team v = Info_ValueForKey( configstring, "t" ); newInfo.team = atoi( v ); + CG_TeamJoinMessage( &newInfo, ci ); // model v = Info_ValueForKey( configstring, "model" ); |