void SV_ChangeLevel2_f( void ) { char *spawn_entity, *mapname; int flags, c = Cmd_Argc(); if( c < 2 ) { Msg( "Usage: changelevel2 <map> [landmark]\n" ); return; } mapname = Cmd_Argv( 1 ); // determine spawn entity classname if( sv_maxclients->integer == 1 ) spawn_entity = GI->sp_entity; else spawn_entity = GI->mp_entity; flags = SV_MapIsValid( mapname, spawn_entity, Cmd_Argv( 2 )); if( flags & MAP_INVALID_VERSION ) { Msg( "SV_ChangeLevel: Map %s is invalid or not supported.\n", mapname ); return; } if(!( flags & MAP_IS_EXIST )) { Msg( "SV_ChangeLevel: Map %s doesn't exist.\n", mapname ); return; } if( c >= 3 && !Q_stricmp( sv.name, Cmd_Argv( 1 ))) { MsgDev( D_INFO, "SV_ChangeLevel: Can't changelevel with same map. Ignored.\n" ); return; } // bad changelevel position invoke enables in one-way transtion if( sv.net_framenum < 30 ) { if( sv_validate_changelevel->integer ) { MsgDev( D_INFO, "SV_ChangeLevel: An infinite changelevel detected.\n" ); MsgDev( D_INFO, "Changelevel will be disabled until the next save\\restore.\n" ); return; // lock with svs.spawncount here } } /*if( sv.state != ss_active ) { MsgDev( D_INFO, "Only the server may changelevel\n" ); return; }*/ SCR_BeginLoadingPlaque( false ); SV_ChangeLevel( true, Cmd_Argv( 1 ), Cmd_Argv( 2 )); }
/* ================== SV_ChangeLevel_f Saves the state of the map just being exited and goes to a new map. ================== */ void SV_ChangeLevel_f( void ) { char *spawn_entity, *mapname; int flags, c = Cmd_Argc(); if( c < 2 ) { Msg( "Usage: changelevel <map> [landmark]\n" ); return; } if( host_xashds_hacks->value ) { Cbuf_InsertText(va("rcon changelevel %s %s\n",Cmd_Argv( 1 ), Cmd_Argv( 2 ))); return; } mapname = Cmd_Argv( 1 ); // determine spawn entity classname if( sv_maxclients->integer == 1 ) spawn_entity = GI->sp_entity; else spawn_entity = GI->mp_entity; flags = SV_MapIsValid( mapname, spawn_entity, Cmd_Argv( 2 )); if( flags & MAP_INVALID_VERSION ) { Msg( "SV_ChangeLevel: Map %s is invalid or not supported\n", mapname ); return; } if(!( flags & MAP_IS_EXIST )) { Msg( "SV_ChangeLevel: Map %s doesn't exist\n", mapname ); return; } if( c >= 3 && !( flags & MAP_HAS_LANDMARK )) { if( sv_validate_changelevel->integer ) { // NOTE: we find valid map but specified landmark it's doesn't exist // run simple changelevel like in q1, throw warning MsgDev( D_INFO, "SV_ChangeLevel: map %s exists but doesn't contain\n", mapname ); MsgDev( D_INFO, "landmark with name %s. Run classic Quake changelevel.\n", Cmd_Argv( 2 )); c = 2; // reduce args } } if( c >= 3 && !Q_stricmp( sv.name, Cmd_Argv( 1 ))) { MsgDev( D_INFO, "SV_ChangeLevel: Can't changelevel with same map. Ignored.\n" ); return; } if( c == 2 && !( flags & MAP_HAS_SPAWNPOINT )) { if( sv_validate_changelevel->integer ) { MsgDev( D_INFO, "SV_ChangeLevel: Map %s doesn't have a valid spawnpoint. Ignored.\n", mapname ); return; } } // bad changelevel position invoke enables in one-way transtion if( sv.net_framenum < 30 ) { if( sv_validate_changelevel->integer && host.type != HOST_DEDICATED ) { MsgDev( D_INFO, "SV_ChangeLevel: An infinite changelevel detected.\n" ); MsgDev( D_INFO, "Changelevel will be disabled until the next save\\restore.\n" ); return; // lock with svs.spawncount here } } if( sv.state != ss_active ) { MsgDev( D_INFO, "Only the server may changelevel\n" ); return; } SCR_BeginLoadingPlaque( false ); if( sv.background ) { // just load map Cbuf_AddText( va( "map %s\n", mapname )); return; } if( c == 2 ) SV_ChangeLevel( false, Cmd_Argv( 1 ), NULL ); else SV_ChangeLevel( true, Cmd_Argv( 1 ), Cmd_Argv( 2 )); }