Index: src/game/g_local.h =================================================================== --- src/game/g_local.h (revision 800) +++ src/game/g_local.h (working copy) @@ -865,6 +865,7 @@ // 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 ); Index: src/game/g_main.c =================================================================== --- src/game/g_main.c (revision 800) +++ src/game/g_main.c (working copy) @@ -207,6 +207,7 @@ { &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 @@ } /* +================= +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,18 +519,10 @@ else G_Printf( "Not logging to disk\n" ); - if( g_mapConfigs.string[0] ) - { - char map[MAX_QPATH] = {""}; + G_MapConfigs( ); + // we're done with g_mapConfigs, so reset this for the next map + trap_Cvar_Set( "g_mapConfigsLoaded", "0" ); - 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 ) ); - } - // initialize all entities for this game memset( g_entities, 0, MAX_GENTITIES * sizeof( g_entities[ 0 ] ) ); level.gentities = g_entities; Index: src/game/g_maprotation.c =================================================================== --- src/game/g_maprotation.c (revision 800) +++ src/game/g_maprotation.c (working copy) @@ -479,6 +479,9 @@ 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 ],