diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_event.c | 17 | ||||
-rw-r--r-- | src/game/g_local.h | 1 | ||||
-rw-r--r-- | src/game/g_main.c | 40 | ||||
-rw-r--r-- | src/game/g_maprotation.c | 3 |
4 files changed, 48 insertions, 13 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index 7050f14d..bddc3a61 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -44,6 +44,7 @@ static void CG_Obituary( entityState_t *ent ) char className[ 64 ]; gender_t gender; clientInfo_t *ci; + qboolean teamKill = qfalse; target = ent->otherEntityNum; attacker = ent->otherEntityNum2; @@ -60,7 +61,11 @@ static void CG_Obituary( entityState_t *ent ) attackerInfo = NULL; } else + { attackerInfo = CG_ConfigString( CS_PLAYERS + attacker ); + if( ci && cgs.clientinfo[ attacker ].team == ci->team ) + teamKill = qtrue; + } targetInfo = CG_ConfigString( CS_PLAYERS + target ); @@ -324,8 +329,16 @@ static void CG_Obituary( entityState_t *ent ) if( message ) { - CG_Printf( "%s %s %s%s\n", - targetName, message, attackerName, message2 ); + CG_Printf( "%s %s %s%s%s\n", + targetName, message, + ( teamKill ) ? S_COLOR_RED "TEAMMATE " S_COLOR_WHITE : "", + attackerName, message2 ); + if( teamKill && attacker == cg.clientNum ) + { + CG_CenterPrint( va ( "You killed " S_COLOR_RED "TEAMMATE " + S_COLOR_WHITE "%s", targetName ), + SCREEN_HEIGHT * 0.30, BIGCHAR_WIDTH ); + } return; } } diff --git a/src/game/g_local.h b/src/game/g_local.h index 85e26268..fa88d773 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -865,6 +865,7 @@ void FireWeapon3( gentity_t *ent ); // void ScoreboardMessage( gentity_t *client ); void MoveClientToIntermission( gentity_t *client ); +void G_MapConfigs( void ); void CalculateRanks( void ); void FindIntermissionPoint( void ); void G_RunThink( gentity_t *ent ); diff --git a/src/game/g_main.c b/src/game/g_main.c index 6eec109f..e6a64f9c 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -207,6 +207,7 @@ static cvarTable_t gameCvarTable[ ] = { &g_currentMap, "g_currentMap", "0", 0, 0, qfalse }, { &g_initialMapRotation, "g_initialMapRotation", "", CVAR_ARCHIVE, 0, qfalse }, { &g_mapConfigs, "g_mapConfigs", "", CVAR_ARCHIVE, 0, qfalse }, + { NULL, "g_mapConfigsLoaded", "0", CVAR_ROM, 0, qfalse }, { &g_rankings, "g_rankings", "0", 0, 0, qfalse} }; @@ -441,6 +442,31 @@ void G_UpdateCvars( void ) } /* +================= +G_MapConfigs +================= +*/ +void G_MapConfigs( ) +{ + char map[MAX_QPATH] = {""}; + + if( !g_mapConfigs.string[0] ) + return; + + if( trap_Cvar_VariableIntegerValue( "g_mapConfigsLoaded" ) ) + return; + + trap_SendConsoleCommand( EXEC_APPEND, + va( "exec \"%s/default.cfg\"\n", g_mapConfigs.string ) ); + + trap_Cvar_VariableStringBuffer( "mapname", map, sizeof( map ) ); + trap_SendConsoleCommand( EXEC_APPEND, + va( "exec \"%s/%s.cfg\"\n", g_mapConfigs.string, map ) ); + + trap_Cvar_Set( "g_mapConfigsLoaded", "1" ); +} + +/* ============ G_InitGame @@ -493,17 +519,9 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) else G_Printf( "Not logging to disk\n" ); - if( g_mapConfigs.string[0] ) - { - char map[MAX_QPATH] = {""}; - - trap_SendConsoleCommand( EXEC_APPEND, - va( "exec \"%s/default.cfg\"\n", g_mapConfigs.string ) ); - - trap_Cvar_VariableStringBuffer( "mapname", map, sizeof( map ) ); - trap_SendConsoleCommand( EXEC_APPEND, - va( "exec \"%s/%s.cfg\"\n", g_mapConfigs.string, map ) ); - } + G_MapConfigs( ); + // we're done with g_mapConfigs, so reset this for the next map + trap_Cvar_Set( "g_mapConfigsLoaded", "0" ); // initialize all entities for this game memset( g_entities, 0, MAX_GENTITIES * sizeof( g_entities[ 0 ] ) ); diff --git a/src/game/g_maprotation.c b/src/game/g_maprotation.c index 81c1a410..be4d5068 100644 --- a/src/game/g_maprotation.c +++ b/src/game/g_maprotation.c @@ -479,6 +479,9 @@ static void G_IssueMapChange( int rotation ) trap_SendConsoleCommand( EXEC_APPEND, va( "map %s\n", mapRotations.rotations[ rotation ].maps[ map ].name ) ); + // load up map defaults if g_mapConfigs is set + G_MapConfigs( ); + for( i = 0; i < mapRotations.rotations[ rotation ].maps[ map ].numCmds; i++ ) { Q_strncpyz( cmd, mapRotations.rotations[ rotation ].maps[ map ].postCmds[ i ], |