示例#1
0
/*
=================
ShutdownGame
=================
*/
void ShutdownGame( void ) {
	gi.Printf ("==== ShutdownGame ====\n");

	gi.Printf ("... ICARUS_Shutdown\n");
	ICARUS_Shutdown ();	//Shut ICARUS down

	gi.Printf ("... Reference Tags Cleared\n");
	TAG_Init();	//Clear the reference tags

	gi.Printf ("... Navigation Data Cleared\n");
	NAV_Shutdown();

	// write all the client session data so we can get it back
	G_WriteSessionData();

/*
Ghoul2 Insert Start
*/
	gi.Printf ("... Ghoul2 Models Shutdown\n");
	for (int i=0; i<MAX_GENTITIES; i++)
	{
		gi.G2API_CleanGhoul2Models(g_entities[i].ghoul2);
	}
/*
Ghoul2 Insert End
*/
}
/*
=============
ExitLevel

When the intermission has been exited, the server is either killed
or moved to a new level based on the "nextmap" cvar 

=============
*/
void ExitLevel (void) {
	int		i;
	gclient_t *cl;
	char nextmap[MAX_STRING_CHARS];
	char d1[MAX_STRING_CHARS];

	//bot interbreeding
	BotInterbreedEndMatch();

	// if we are running a tournement map, kick the loser to spectator status,
	// which will automatically grab the next spectator and restart
	if ( g_gametype.integer == GT_TOURNAMENT  ) {
		if ( !level.restarted ) {
			RemoveTournamentLoser();
			trap_SendConsoleCommand( EXEC_APPEND, "map_restart 0\n" );
			level.restarted = qtrue;
			level.changemap = NULL;
			level.intermissiontime = 0;
		}
		return;	
	}

	trap_Cvar_VariableStringBuffer( "nextmap", nextmap, sizeof(nextmap) );
	trap_Cvar_VariableStringBuffer( "d1", d1, sizeof(d1) );

	if( !Q_stricmp( nextmap, "map_restart 0" ) && Q_stricmp( d1, "" ) ) {
		trap_Cvar_Set( "nextmap", "vstr d2" );
		trap_SendConsoleCommand( EXEC_APPEND, "vstr d1\n" );
	} else {
		trap_SendConsoleCommand( EXEC_APPEND, "vstr nextmap\n" );
	}

	level.changemap = NULL;
	level.intermissiontime = 0;

	// reset all the scores so we don't enter the intermission again
	level.teamScores[TEAM_RED] = 0;
	level.teamScores[TEAM_BLUE] = 0;
	for ( i=0 ; i< g_maxclients.integer ; i++ ) {
		cl = level.clients + i;
		if ( cl->pers.connected != CON_CONNECTED ) {
			continue;
		}
		cl->ps.persistant[PERS_SCORE] = 0;
	}

	// we need to do this here before changing to CON_CONNECTING
	G_WriteSessionData();

	// change all client states to connecting, so the early players into the
	// next level will know the others aren't done reconnecting
	for (i=0 ; i< g_maxclients.integer ; i++) {
		if ( level.clients[i].pers.connected == CON_CONNECTED ) {
			level.clients[i].pers.connected = CON_CONNECTING;
		}
	}

}
示例#3
0
文件: g_main.c 项目: osfpsproject/MF2
/*
=================
G_ShutdownGame
=================
*/
void G_ShutdownGame() 
{
	Com_Printf ("==== ShutdownGame ====\n");

	if ( theLevel.logFile_ ) 
	{
		G_LogPrintf("ShutdownGame:\n" );
		G_LogPrintf("------------------------------------------------------------\n" );
		FS_FCloseFile( theLevel.logFile_ );
	}

	// write all the client session data so we can get it back
	G_WriteSessionData();
}
示例#4
0
文件: g_main.c 项目: osfpsproject/MF2
/*
=============
ExitLevel

When the intermission has been exited, the server is either killed
or moved to a New level based on the "nextmap" cvar 

=============
*/
void ExitLevel() 
{
	//bot interbreeding
//	BotInterbreedEndMatch();

	// if we are running a tournement map, kick the loser to spectator status,
	// which will automatically grab the next spectator and restart
	if ( g_gametype.integer == GT_TOURNAMENT  ) 
	{
		if ( !theLevel.restarted_ ) 
		{
			RemoveTournamentLoser();
			Cbuf_ExecuteText( EXEC_APPEND, "map_restart 0\n" );
			theLevel.restarted_ = true;
			theLevel.changemap_ = 0;
			theLevel.intermissiontime_ = 0;
		}
		return;	
	}

	Cbuf_ExecuteText( EXEC_APPEND, "vstr nextmap\n" );
	theLevel.changemap_ = 0;
	theLevel.intermissiontime_ = 0;

	// reset all the scores so we don't enter the intermission again
	theLevel.teamScores_[ClientBase::TEAM_RED] = 0;
	theLevel.teamScores_[ClientBase::TEAM_BLUE] = 0;
	for( int i=1 ; i<= g_maxclients.integer ; i++ )
	{
		GameClient *cl = theLevel.getClient(i);
		if ( !cl || cl->pers_.connected_ != GameClient::ClientPersistant::CON_CONNECTED ) 
			continue;
		cl->ps_.persistant[PERS_SCORE] = 0;
	}

	// we need to do this here before chaning to CON_CONNECTING
	G_WriteSessionData();

	// change all client states to connecting, so the early players into the
	// next level will know the others aren't done reconnecting
	for( int i=1 ; i<= g_maxclients.integer ; i++ ) 
	{
		GameClient *cl = theLevel.getClient(i);
		if( cl->pers_.connected_ == GameClient::ClientPersistant::CON_CONNECTED ) 
			cl->pers_.connected_ = GameClient::ClientPersistant::CON_CONNECTING;
	}

}
示例#5
0
/*
=================
G_ShutdownGame
=================
*/
void G_ShutdownGame( int restart ) {
	G_Printf ("==== ShutdownGame ====\n");

	if ( level.logFile ) {
		G_LogPrintf("ShutdownGame:\n" );
		G_LogPrintf("------------------------------------------------------------\n" );
		trap_FS_FCloseFile( level.logFile );
	}

	// write all the client session data so we can get it back
	G_WriteSessionData();

	if ( trap_Cvar_VariableIntegerValue( "bot_enable" ) ) {
		BotAIShutdown( restart );
	}
}