Exemplo n.º 1
0
void GAME_AutoTeam (const char* equipmentDefinitionID, int teamMembers)
{
	const equipDef_t* ed = INV_GetEquipmentDefinitionByID(equipmentDefinitionID);
	const char* teamDefID = GAME_GetTeamDef();
	cls.teamSaveSlotIndex = NO_TEAM_SLOT_LOADED;

	GAME_GenerateTeam(teamDefID, ed, teamMembers);
}
Exemplo n.º 2
0
/**
 * @brief Creates an entry of a new employee in the global list and assignes it to no building/base.
 * @param[in] type What type of employee to create.
 * @param[in] nation What nation the employee (mainly used for soldiers in singleplayer) comes from.
 * @param[in] ugvType What type of ugv this employee is.
 * @return Pointer to the newly created employee in the global list. NULL if something goes wrong.
 * @sa E_DeleteEmployee
 */
employee_t* E_CreateEmployee (employeeType_t type, const nation_t *nation, const ugv_t *ugvType)
{
	employee_t employee;
	const char *teamID;
	char teamDefName[MAX_VAR];
	const char* rank;

	if (type >= MAX_EMPL)
		return NULL;

	OBJZERO(employee);

	employee.baseHired = NULL;
	employee.assigned = qfalse;
	employee.type = type;
	employee.nation = nation;
	employee.ugv = ugvType;

	teamID = GAME_GetTeamDef();

	/* Generate character stats, models & names. */
	switch (type) {
	case EMPL_SOLDIER:
		rank = "rifleman";
		Q_strncpyz(teamDefName, teamID, sizeof(teamDefName));
		break;
	case EMPL_SCIENTIST:
		rank = "scientist";
		Com_sprintf(teamDefName, sizeof(teamDefName), "%s_scientist", teamID);
		break;
	case EMPL_PILOT:
		rank = "pilot";
		Com_sprintf(teamDefName, sizeof(teamDefName), "%s_pilot", teamID);
		break;
	case EMPL_WORKER:
		rank = "worker";
		Com_sprintf(teamDefName, sizeof(teamDefName), "%s_worker", teamID);
		break;
	case EMPL_ROBOT:
		if (!ugvType)
			Com_Error(ERR_DROP, "CL_GenerateCharacter: no type given for generation of EMPL_ROBOT employee.");

		rank = "ugv";

		Com_sprintf(teamDefName, sizeof(teamDefName), "%s%s", teamID, ugvType->actors);
		break;
	default:
		Com_Error(ERR_DROP, "Unknown employee type\n");
	}

	CL_GenerateCharacter(&employee.chr, teamDefName);
	employee.chr.score.rank = CL_GetRankIdx(rank);

	Com_DPrintf(DEBUG_CLIENT, "Generate character for type: %i\n", type);

	return (employee_t*) LIST_Add(&ccs.employees[type], (void*) &employee, sizeof(employee))->data;
}
Exemplo n.º 3
0
qboolean GAME_ItemIsUseable (const objDef_t *od)
{
	const cgame_export_t *list = GAME_GetCurrentType();

	if (INV_IsArmour(od)) {
		const char *teamDefID = GAME_GetTeamDef();
		const teamDef_t *teamDef = Com_GetTeamDefinitionByID((teamDefID));

		/* Don't allow armour for other teams */
		if (!GAME_IsArmourUseableForTeam(od, teamDef))
			return qfalse;
	}

	if (list && list->IsItemUseable)
		return list->IsItemUseable(od);

	return qtrue;
}
Exemplo n.º 4
0
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;
}