Example #1
0
/*
* G_Shutdown
*/
void G_Shutdown( void )
{
	int i;

	G_Printf( "==== G_Shutdown ====\n" );

	G_asCallShutdownScript();
	G_asShutdownGametypeScript();

	SV_WriteIPList ();

	trap_Cvar_ForceSet( "nextmap", va( "map \"%s\"", G_SelectNextMapName() ) );

	BOT_RemoveBot( "all" );

	G_RemoveCommands();

	G_FreeCallvotes();

	G_LevelFreePool();

	for( i = 0; i < game.numentities; i++ )
	{
		if( game.edicts[i].r.inuse )
			G_FreeEdict( &game.edicts[i] );
	}

	G_Free( game.edicts );
	G_Free( game.clients );
}
Example #2
0
File: g_main.c Project: ZwS/qudos
/*
=============
ExitLevel
=============
*/
void ExitLevel (void)
{
	int		i;
	edict_t	*ent;
	char	command [256];

	level.exitintermission = 0;
	level.intermissiontime = 0;

	if (CTFNextMap())
		return;

	//JABot[start] (Disconnect all bots before changing map)
	BOT_RemoveBot("all");
	//[end]

	Com_sprintf (command, sizeof(command), "gamemap \"%s\"\n", level.changemap);
	gi.AddCommandString (command);
	ClientEndServerFrames ();

	level.changemap = NULL;

	// clear some things before going to next level
	for (i=0 ; i<maxclients->value ; i++)
	{
		ent = g_edicts + 1 + i;
		if (!ent->inuse)
			continue;
		if (ent->health > ent->client->pers.max_health)
			ent->health = ent->client->pers.max_health;
	}
}
Example #3
0
/*
* G_ExitLevel
*/
void G_ExitLevel( void )
{
	int i;
	edict_t	*ent;
	char command[256];
	const char *nextmapname;
	bool loadmap = true;
	unsigned int timeLimit;
	const unsigned int wrappingPoint = 0x70000000;

	level.exitNow = false;

	nextmapname = G_SelectNextMapName();
	timeLimit = g_timelimit->integer > 0 ? max( g_timelimit->integer, 60 ) : 60;
	timeLimit *= 60 * 1000;

	// if it's the same map see if we can restart without loading
	if( !level.hardReset && !Q_stricmp( nextmapname, level.mapname ) )
	{
		if( ( (signed)level.time < (signed)( wrappingPoint-timeLimit ) ) && G_RespawnLevel() )
		{
			loadmap = false;
		}
	}

	if( loadmap )
	{
		BOT_RemoveBot( "all" ); // MbotGame (Disconnect all bots before changing map)
		Q_snprintfz( command, sizeof( command ), "gamemap \"%s\"\n", nextmapname );
		trap_Cmd_ExecuteText( EXEC_APPEND, command );
	}

	G_SnapClients();

	// clear some things before going to next level
	for( i = 0; i < gs.maxclients; i++ )
	{
		ent = game.edicts + 1 + i;
		if( !ent->r.inuse )
			continue;

		ent->r.client->level.showscores = false;

		if( ent->health > ent->max_health )
			ent->health = ent->max_health;

		// some things are only cleared when there's a new map load
		if( loadmap )
		{
			ent->r.client->connecting = true; // set all connected players as "reconnecting"
			ent->s.team = TEAM_SPECTATOR;
		}
	}
}
Example #4
0
//==========================================
// BOT_ServerCommand
// Special server command processor
//==========================================
qboolean BOT_ServerCommand (void)
{
	char	*cmd, *name;

	cmd = gi.argv (1);

	if (!ctf->value)
		name = gi.argv(2);

	if (strlen(name) < 5)
	{
		name = bot_names[GetRandom(0, 7)];
	}

	if( !Q_stricmp (cmd, "addbot") )
	{ 
		if(ctf->value) // name, skin, team
			BOT_SpawnBot ( gi.argv(2), gi.argv(3), gi.argv(4), NULL );
		else // name, skin
			BOT_SpawnBot ( NULL, name, gi.argv(3), NULL );
	}	
	// removebot
    else if( !Q_stricmp (cmd, "removebot") )
    	BOT_RemoveBot(gi.argv(2));

	else if( !Q_stricmp (cmd, "editnodes") )
		AITools_InitEditnodes();

	else if( !Q_stricmp (cmd, "makenodes") )
		AITools_InitMakenodes();

	else if( !Q_stricmp (cmd, "savenodes") )
		AITools_SaveNodes();

	else if( !Q_stricmp (cmd, "addbotroam") )
		AITools_AddBotRoamNode();

	else if( !Q_stricmp (cmd, "addmonster") )
    	M_default_Spawn ();

	else
		return false;

	return true;
}