Exemple #1
0
void GAME_AutoTeam_f (void)
{
	if (Cmd_Argc() != 2) {
		Com_Printf("Usage: %s <equipment-definition>\n", Cmd_Argv(0));
		return;
	}

	GAME_AutoTeam(Cmd_Argv(1), GAME_GetCharacterArraySize());
	GAME_UpdateActiveTeamList();
}
Exemple #2
0
/**
 * @brief Starts a new skirmish game
 */
static void GAME_SK_Start_f (void)
{
	char map[MAX_VAR];
	mapDef_t *md;

	if (!chrDisplayList.num) {
		unsigned int i;
		/** @todo make the teamdef configurable */
		const char *ugvTeamDefID = "phalanx_ugv_phoenix";
		const char *name = Cvar_GetString("cl_equip");
		const equipDef_t *ed = INV_GetEquipmentDefinitionByID(name);
		const size_t size = GAME_GetCharacterArraySize();
		uint32_t maxSoldiers = Cvar_GetInteger("sv_maxsoldiersperplayer");
		uint32_t ugvs = Cvar_GetInteger("cl_ugvs");

		if (maxSoldiers <= 0)
			maxSoldiers = size;

		ugvs = min(ugvs, size - maxSoldiers);
		Com_Printf("Starting skirmish with %i soldiers and %i ugvs\n", maxSoldiers, ugvs);
		GAME_AutoTeam(name, maxSoldiers);
		for (i = 0; i < ugvs; i++)
			GAME_AppendTeamMember(i + maxSoldiers, ugvTeamDefID, ed);
	} else {
		Com_Printf("Using already loaded team with %i members\n", chrDisplayList.num);
	}

	assert(cls.currentSelectedMap >= 0);
	assert(cls.currentSelectedMap < MAX_MAPDEFS);

	md = Com_GetMapDefByIDX(cls.currentSelectedMap);
	if (!md)
		return;

	GAME_SK_SetMissionParameters(md);

	assert(md->map);
	Com_sprintf(map, sizeof(map), "map %s %s %s;", Cvar_GetInteger("mn_serverday") ? "day" : "night", md->map, md->param ? md->param : "");

	/* prepare */
	UI_InitStack(NULL, "singleplayermission", qtrue, qfalse);

	Cbuf_AddText(map);
}