Beispiel #1
0
/**
 * @brief
 */
void G_SpawnTech(const g_item_t *item) {

	g_entity_t *spawn = G_SelectTechSpawnPoint();
	g_entity_t *ent = G_DropItem(spawn, item);

	VectorSet(ent->locals.velocity, Randomc() * 250, Randomc() * 250, 200 + (Randomf() * 200));
}
Beispiel #2
0
/*
 * @brief
 */
g_entity_t *G_TossFlag(g_entity_t *ent) {
	g_team_t *ot;
	g_entity_t *of;

	if (!(ot = G_OtherTeam(ent->client->locals.persistent.team)))
		return NULL;

	if (!(of = G_FlagForTeam(ot)))
		return NULL;

	const int32_t index = ITEM_INDEX(of->locals.item);

	if (!ent->client->locals.inventory[index])
		return NULL;

	ent->client->locals.inventory[index] = 0;

	ent->s.model3 = 0;
	ent->s.effects &= ~(EF_CTF_RED | EF_CTF_BLUE);

	gi.BroadcastPrint(PRINT_HIGH, "%s dropped the %s flag\n",
			ent->client->locals.persistent.net_name, ot->name);

	return G_DropItem(ent, of->locals.item);
}
Beispiel #3
0
/*
 * @brief
 */
g_entity_t *G_TossQuadDamage(g_entity_t *ent) {
	g_entity_t *quad;

	if (!ent->client->locals.inventory[g_media.items.quad_damage])
		return NULL;

	quad = G_DropItem(ent, G_FindItemByClassName("item_quad"));

	if (quad)
		quad->locals.timestamp = ent->client->locals.quad_damage_time;

	ent->client->locals.quad_damage_time = 0.0;
	ent->client->locals.inventory[g_media.items.quad_damage] = 0;

	return quad;
}
Beispiel #4
0
/*
=================
G_DropGametypeItems

Drops all of the gametype items held by the player
=================
*/
void G_DropGametypeItems(gentity_t* self, int delayPickup)
{
	// drop all custom gametype items
	for (int i = 0; i < MAX_GAMETYPE_ITEMS; i++)
	{
		// skip this gametype item if the client doenst have it
		if (!(self->client->ps.stats[STAT_GAMETYPE_ITEMS] & (1 << i)))
		{
			continue;
		}

		gitem_t *item = BG_FindGametypeItem(i);
		if (!item)
		{
			continue;
		}
		float angle = 0;
		gentity_t *drop = G_DropItem(self, item, angle);
		drop->count = 1;
		angle += 45;

		if (delayPickup)
		{
			drop->nextthink = level.time + delayPickup;
			drop->s.eFlags |= EF_NOPICKUP;
			drop->think = G_EnableGametypeItemPickup;
		}

		// TAke it away from the client just in case
		self->client->ps.stats[STAT_GAMETYPE_ITEMS] &= ~(1 << i);

		if (self->enemy && self->enemy->client && !OnSameTeam(self->enemy, self))
		{
			gtCore->onItemDefend(self);
		}
	}

	self->client->ps.stats[STAT_GAMETYPE_ITEMS] = 0;
}