summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/g_cmds.c26
-rw-r--r--src/game/g_local.h2
-rw-r--r--src/game/g_main.c8
-rw-r--r--src/game/g_maprotation.c2
4 files changed, 34 insertions, 4 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 8dede827..c077a3b6 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -1215,7 +1215,7 @@ void Cmd_CallVote_f( gentity_t *ent )
}
else if( !Q_stricmp( arg1, "map" ) )
{
- if( !trap_FS_FOpenFile( va( "maps/%s.bsp", arg2 ), NULL, FS_READ ) )
+ if( !G_MapExists( arg2 ) )
{
trap_SendServerCommand( ent - g_entities, va( "print \"callvote: "
"'maps/%s.bsp' could not be found on the server\n\"", arg2 ) );
@@ -1226,6 +1226,28 @@ void Cmd_CallVote_f( gentity_t *ent )
Com_sprintf( level.voteDisplayString,
sizeof( level.voteDisplayString ), "Change to map '%s'", arg2 );
}
+ else if( !Q_stricmp( arg1, "nextmap" ) )
+ {
+ if( G_MapExists( g_nextMap.string ) )
+ {
+ trap_SendServerCommand( ent - g_entities, va( "print \"callvote: "
+ "the next map is already set to '%s^7'\n\"", g_nextMap.string ) );
+ return;
+ }
+
+ if( !G_MapExists( arg2 ) )
+ {
+ trap_SendServerCommand( ent - g_entities, va( "print \"callvote: "
+ "'maps/%s^7.bsp' could not be found on the server\n\"", arg2 ) );
+ return;
+ }
+
+ Com_sprintf( level.voteString, sizeof( level.voteString ),
+ "set g_nextMap %s", arg2 );
+
+ Com_sprintf( level.voteDisplayString,
+ sizeof( level.voteDisplayString ), "Set the next map to '%s^7'", arg2 );
+ }
else if( !Q_stricmp( arg1, "draw" ) )
{
Com_sprintf( level.voteString, sizeof( level.voteString ), "evacuation" );
@@ -1270,7 +1292,7 @@ void Cmd_CallVote_f( gentity_t *ent )
{
trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string\n\"" );
trap_SendServerCommand( ent-g_entities, "print \"Valid vote commands are: "
- "map, map_restart, sudden_death, draw, kick, mute and unmute\n" );
+ "map, nextmap, map_restart, sudden_death, draw, kick, mute and unmute\n" );
return;
}
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 5084fe8c..8894ade2 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -1065,6 +1065,7 @@ qboolean G_StartMapRotation( char *name, qboolean changeMap );
void G_StopMapRotation( void );
qboolean G_MapRotationActive( void );
void G_InitMapRotations( void );
+qboolean G_MapExists( char *name );
//
// g_ptr.c
@@ -1156,6 +1157,7 @@ extern vmCvar_t g_markDeconstruct;
extern vmCvar_t g_debugMapRotation;
extern vmCvar_t g_currentMapRotation;
extern vmCvar_t g_currentMap;
+extern vmCvar_t g_nextMap;
extern vmCvar_t g_initialMapRotation;
extern vmCvar_t g_chatTeamPrefix;
extern vmCvar_t g_sayAreaRange;
diff --git a/src/game/g_main.c b/src/game/g_main.c
index 0bda0a97..abeb2631 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -114,6 +114,7 @@ vmCvar_t g_markDeconstruct;
vmCvar_t g_debugMapRotation;
vmCvar_t g_currentMapRotation;
vmCvar_t g_currentMap;
+vmCvar_t g_nextMap;
vmCvar_t g_initialMapRotation;
vmCvar_t g_debugVoices;
@@ -253,6 +254,7 @@ static cvarTable_t gameCvarTable[ ] =
{ &g_debugMapRotation, "g_debugMapRotation", "0", 0, 0, qfalse },
{ &g_currentMapRotation, "g_currentMapRotation", "-1", 0, 0, qfalse }, // -1 = NOT_ROTATING
{ &g_currentMap, "g_currentMap", "0", 0, 0, qfalse },
+ { &g_nextMap, "g_nextMap", "", 0 , 0, qtrue },
{ &g_initialMapRotation, "g_initialMapRotation", "", CVAR_ARCHIVE, 0, qfalse },
{ &g_debugVoices, "g_debugVoices", "0", 0, 0, qfalse },
{ &g_voiceChats, "g_voiceChats", "1", CVAR_ARCHIVE, 0, qfalse },
@@ -1615,11 +1617,15 @@ void ExitLevel( void )
int i;
gclient_t *cl;
- if( G_MapRotationActive( ) )
+ if ( G_MapExists( g_nextMap.string ) )
+ trap_SendConsoleCommand( EXEC_APPEND, va("map %s\n", g_nextMap.string ) );
+ else if( G_MapRotationActive( ) )
G_AdvanceMapRotation( );
else
trap_SendConsoleCommand( EXEC_APPEND, "map_restart\n" );
+ trap_Cvar_Set( "g_nextMap", "" );
+
level.restarted = qtrue;
level.changemap = NULL;
level.intermissiontime = 0;
diff --git a/src/game/g_maprotation.c b/src/game/g_maprotation.c
index 7da400b8..074b986a 100644
--- a/src/game/g_maprotation.c
+++ b/src/game/g_maprotation.c
@@ -34,7 +34,7 @@ G_MapExists
Check if a map exists
===============
*/
-static qboolean G_MapExists( char *name )
+qboolean G_MapExists( char *name )
{
return trap_FS_FOpenFile( va( "maps/%s.bsp", name ), NULL, FS_READ );
}