diff options
-rw-r--r-- | src/cgame/cg_event.c | 43 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 2 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 3 | ||||
-rw-r--r-- | src/cgame/cg_players.c | 61 | ||||
-rw-r--r-- | src/game/bg_lib.h | 9 |
5 files changed, 65 insertions, 53 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index 7bc50929..2ec45f39 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -368,49 +368,6 @@ static void CG_Obituary( entityState_t *ent ) } -/* -============= -CG_TeamJoinMessage - -Prints messages when players change teams -============= -*/ -void CG_TeamJoinMessage( clientInfo_t *newInfo, clientInfo_t *ci ) -{ - int team; - int oldteam; - char *playerName; - - - // Collect info - team = newInfo->team; - oldteam = ci->team; - - playerName = newInfo->name; - - // If no change occurred, print nothing - if( team == oldteam ) - return; - - // Print the appropriate message - if( team == TEAM_NONE ) - { - CG_Printf( "%s" S_COLOR_WHITE " left the %ss\n", - playerName, BG_TeamName( oldteam ) ); - } - else if( oldteam == TEAM_NONE ) - { - CG_Printf( "%s" S_COLOR_WHITE " joined the %ss\n", - playerName, BG_TeamName( team ) ); - } - else - { - CG_Printf( "%s" S_COLOR_WHITE " left the %ss and joined the %ss\n", - playerName, BG_TeamName( oldteam ), BG_TeamName( team ) ); - } -} - - //========================================================================== diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index cb638702..4a1f8a7e 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1660,6 +1660,7 @@ void CG_Corpse( centity_t *cent ); void CG_ResetPlayerEntity( centity_t *cent ); void CG_NewClientInfo( int clientNum ); void CG_PrecacheClientInfo( class_t class, char *model, char *skin ); +void CG_TeamJoinMessage( clientInfo_t *newInfo, clientInfo_t *ci ); sfxHandle_t CG_CustomSound( int clientNum, const char *soundName ); void CG_PlayerDisconnect( vec3_t org ); void CG_Bleed( vec3_t origin, vec3_t normal, int entityNum ); @@ -1710,7 +1711,6 @@ 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_main.c b/src/cgame/cg_main.c index 999a582e..1844cdf0 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -305,6 +305,9 @@ static cvarTable_t cvarTable[ ] = { &cg_tutorial, "cg_tutorial", "1", CVAR_ARCHIVE }, { &cg_hudFiles, "cg_hudFiles", "ui/hud.txt", CVAR_ARCHIVE}, { &cg_hudFilesEnable, "cg_hudFilesEnable", "0", CVAR_ARCHIVE}, + { NULL, "cg_alienConfig", "", CVAR_ARCHIVE }, + { NULL, "cg_humanConfig", "", CVAR_ARCHIVE }, + { NULL, "cg_spectatorConfig", "", CVAR_ARCHIVE }, { &cg_painBlendUpRate, "cg_painBlendUpRate", "10.0", 0 }, { &cg_painBlendDownRate, "cg_painBlendDownRate", "0.5", 0 }, diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index bd53eb20..2cef1539 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -723,6 +723,51 @@ void CG_PrecacheClientInfo( class_t class, char *model, char *skin ) /* +============= +CG_TeamJoinMessage + +Prints messages when players change teams +============= +*/ +void CG_TeamJoinMessage( clientInfo_t *newInfo, clientInfo_t *ci ) +{ + int team; + int oldteam; + char *playerName; + + if( !ci->infoValid ) + return; + + // Collect info + team = newInfo->team; + oldteam = ci->team; + + // If no change occurred, print nothing + if( team == oldteam ) + return; + + playerName = newInfo->name; + + // Print the appropriate message + if( team == TEAM_NONE ) + { + CG_Printf( "%s" S_COLOR_WHITE " left the %ss\n", + playerName, BG_TeamName( oldteam ) ); + } + else if( oldteam == TEAM_NONE ) + { + CG_Printf( "%s" S_COLOR_WHITE " joined the %ss\n", + playerName, BG_TeamName( team ) ); + } + else + { + CG_Printf( "%s" S_COLOR_WHITE " left the %ss and joined the %ss\n", + playerName, BG_TeamName( oldteam ), BG_TeamName( team ) ); + } +} + + +/* ====================== CG_NewClientInfo ====================== @@ -774,6 +819,22 @@ void CG_NewClientInfo( int clientNum ) newInfo.team = atoi( v ); CG_TeamJoinMessage( &newInfo, ci ); + // if this is us, execute team-specific config files + // unfortunately, these get re-executed after a vid_restart, because the + // cgame can't tell the difference between that and joining a new server + if( clientNum == cg.clientNum && + ( !ci->infoValid || ci->team != newInfo.team ) ) + { + char config[ MAX_STRING_CHARS ]; + + trap_Cvar_VariableStringBuffer( + va( "cg_%sConfig", BG_TeamName( newInfo.team ) ), + config, sizeof( config ) ); + + if( config[ 0 ] ) + trap_SendConsoleCommand( va( "exec %s\n", config ) ); + } + // model v = Info_ValueForKey( configstring, "model" ); Q_strncpyz( newInfo.modelName, v, sizeof( newInfo.modelName ) ); diff --git a/src/game/bg_lib.h b/src/game/bg_lib.h index 63f0b537..5b5bacaf 100644 --- a/src/game/bg_lib.h +++ b/src/game/bg_lib.h @@ -87,15 +87,6 @@ typedef int cmp_t( const void *, const void * ); void qsort( void *a, size_t n, size_t es, cmp_t *cmp ); void srand( unsigned seed ); int rand( void ); -// FIXME: NDEBUG isn't defined for compiling the QVMs -#ifndef NDEBUG -#define str2(x) #x -#define str(x) str2(x) -#define assert(x) if(!(x)) Com_Error( ERR_DROP, \ - __FILE__ ":" str(__LINE__) ": assertion `" #x "' failed" ); -#else -#define assert(x) -#endif // String functions size_t strlen( const char *string ); |