summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
authorChristopher Schwarz <lakitu7@gmail.com>2009-10-03 12:08:15 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:42 +0000
commit82f7c11748f391a183855f78b2afdd59c6ffb4f8 (patch)
treed59b83c03b126e6a8f78c0ccaa76e2b9d60e48af /src/cgame
parentfe258dcdc974ab0a86d88bfb1bf503e0fa63f163 (diff)
* Added improved team join messages (original patch thanks to peoro)
* Uses a proper events-system message interpreted by cgame * Includes notification of leaving teams instead of just joining them * These messages are also now logged to games.log and the server console * Minor cleanups of cmd_team_f * /team human*, /team alien*, and /team spec* now join those teams, since those are specific enough and people seemed to have a difficult time figuring out /team spectate
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_event.c61
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