diff options
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_event.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index aa0f37cd..a8632cb4 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -367,6 +367,62 @@ static void CG_Obituary( entityState_t *ent ) CG_Printf( "%s died\n", targetName ); } + +/* +============= +CG_TeamJoinMessage + +Prints messages when players change teams +============= +*/ +static void CG_TeamJoinMessage( entityState_t *ent ) +{ + int player; + int team; + int oldteam; + char *playerName; + + + // Collect info + player = ent->eventParm; + team = ent->otherEntityNum; + oldteam = ent->otherEntityNum2; + + if( player < 0 || player >= MAX_CLIENTS ) + CG_Error( "CG_TeamJoinMessage: target out of range" ); + + playerName = cgs.clientinfo[player].name; + + // If no change occurred, print nothing + if( team == oldteam ) + return; + + // 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 ); + } + 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 ); + } + 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 ); + } +} + + + //========================================================================== /* @@ -917,6 +973,11 @@ 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 |