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(); }
void GAME_GenerateTeam (const char *teamDefID, const equipDef_t *ed, int teamMembers) { int i; if (teamMembers > GAME_GetCharacterArraySize()) Com_Error(ERR_DROP, "More than the allowed amount of team members"); if (ed == NULL) Com_Error(ERR_DROP, "No equipment definition given"); GAME_ResetCharacters(); for (i = 0; i < teamMembers; i++) GAME_AppendTeamMember(i, teamDefID, ed); }
/** * @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); }
static qboolean GAME_Spawn (void) { const size_t size = GAME_GetCharacterArraySize(); int i; /* If there is no active gametype we create a team with default values. * This is e.g. the case when someone starts a map with the map command */ if (GAME_GetCurrentType() == NULL || chrDisplayList.num == 0) { const char *teamDefID = GAME_GetTeamDef(); const equipDef_t *ed = INV_GetEquipmentDefinitionByID("multiplayer_initial"); /* inventory structure switched/initialized */ INV_DestroyInventory(&cls.i); INV_InitInventory("client", &cls.i, &csi, &inventoryImport); GAME_GenerateTeam(teamDefID, ed, size); } for (i = 0; i < size; i++) cl.chrList.chr[i] = chrDisplayList.chr[i]; cl.chrList.num = chrDisplayList.num; return qtrue; }