Esempio n. 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));
}
Esempio n. 2
0
/*
 * @brief Add a bit of randomness to flying object velocity.
 */
static void G_AddFlying(g_edict_t *ent) {
	vec3_t right, up;

	if (ent->solid != SOLID_MISSILE)
		return;

	AngleVectors(ent->s.angles, NULL, right, up);

	VectorMA(ent->locals.velocity, Randomc() * 5.0, right, ent->locals.velocity);
	VectorMA(ent->locals.velocity, Randomc() * 5.0, up, ent->locals.velocity);
}
Esempio n. 3
0
/*
 * @brief
 */
static void Cg_TeleporterEffect(const vec3_t org) {

	vec3_t color;
	cgi.ColorFromPalette(110, color);

	for (int32_t i = 0; i < 64; i++) {
		cg_particle_t *p;

		if (!(p = Cg_AllocParticle(PARTICLE_NORMAL, NULL )))
			break;

		VectorCopy(color, p->part.color);
		Vector4Set(p->color_vel, 1.0, 1.0, 1.0, -1.5 + Randomf() * 0.5);

		p->part.scale = 1.0;
		p->scale_vel = 3.0;

		p->part.org[0] = org[0] + Randomc() * 16.0;
		p->part.org[1] = org[1] + Randomc() * 16.0;
		p->part.org[2] = org[2] + 8.0 + Randomf() * 24.0;

		p->vel[0] = Randomc() * 24.0;
		p->vel[1] = Randomc() * 24.0;
		p->vel[2] = Randomf() * 64.0;

		p->accel[0] = p->accel[1] = 0;
		p->accel[2] = -PARTICLE_GRAVITY * 0.1;
	}

	r_sustained_light_t s;
	VectorCopy(org, s.light.origin);
	s.light.radius = 120.0;
	VectorSet(s.light.color, 0.9, 0.9, 0.9);
	s.sustain = 1000;

	cgi.AddSustainedLight(&s);

	cgi.PlaySample(org, 0, cg_sample_respawn, ATTEN_IDLE);

}
Esempio n. 4
0
/*
 * @brief
 */
static void Cg_ItemPickupEffect(const vec3_t org) {

	vec3_t color;
	cgi.ColorFromPalette(110, color);

	for (int32_t i = 0; i < 32; i++) {
		cg_particle_t *p;

		if (!(p = Cg_AllocParticle(PARTICLE_NORMAL, NULL )))
			break;

		VectorCopy(color, p->part.color);
		Vector4Set(p->color_vel, 1.0, 1.0, 1.0, -1.5 + Randomf() * 0.5);

		p->part.scale = 1.0;
		p->scale_vel = 3.0;

		p->part.org[0] = org[0] + Randomc() * 8.0;
		p->part.org[1] = org[1] + Randomc() * 8.0;
		p->part.org[2] = org[2] + 8 + Randomc() * 16.0;

		p->vel[0] = Randomc() * 16.0;
		p->vel[1] = Randomc() * 16.0;
		p->vel[2] = Randomf() * 128.0;

		p->accel[0] = p->accel[1] = 0;
		p->accel[2] = PARTICLE_GRAVITY * 0.2;
	}

	r_sustained_light_t s;
	VectorCopy(org, s.light.origin);
	s.light.radius = 80.0;
	VectorSet(s.light.color, 0.9, 1.0, 1.0);
	s.sustain = 1000;

	cgi.AddSustainedLight(&s);
}
Esempio n. 5
0
/*
 * @brief
 */
static void Cg_SmokeFlash(const entity_state_t *ent) {
	cg_particle_t *p;
	r_sustained_light_t s;
	vec3_t forward, right, org, org2;
	cm_trace_t tr;
	vec_t dist;
	int32_t j;

	// project the puff just in front of the entity
	AngleVectors(ent->angles, forward, right, NULL );
	VectorMA(ent->origin, 30.0, forward, org);
	VectorMA(org, 6.0, right, org);

	tr = cgi.Trace(ent->origin, org, NULL, NULL, 0, MASK_CLIP_PROJECTILE);

	if (tr.fraction < 1.0) { // firing near a wall, back it up
		VectorSubtract(ent->origin, tr.end, org);
		VectorScale(org, 0.75, org);

		VectorAdd(ent->origin, org, org);
	}

	// and adjust for ducking (this is a hack)
	dist = ent->solid == 8290 ? -2.0 : 20.0;
	org[2] += dist;

	VectorCopy(org, s.light.origin);
	s.light.radius = 80.0;
	VectorSet(s.light.color, 0.8, 0.7, 0.5);
	s.sustain = 300;

	cgi.AddSustainedLight(&s);

	if (cgi.PointContents(ent->origin) & MASK_LIQUID) {
		VectorMA(ent->origin, 40.0, forward, org2);
		Cg_BubbleTrail(org, org2, 10.0);
		return;
	}

	if (!(p = Cg_AllocParticle(PARTICLE_ROLL, cg_particles_smoke)))
		return;

	p->part.blend = GL_ONE;
	cgi.ColorFromPalette(Random() & 7, p->part.color);
	p->part.color[3] = 0.8;

	Vector4Set(p->color_vel, 0.0, 0.0, 0.0, -1.0);

	p->part.scale = 4.0;
	p->scale_vel = 24.0;

	p->part.roll = Randomc() * 100.0;

	VectorCopy(org, p->part.org);

	for (j = 0; j < 2; j++) {
		p->vel[j] = Randomc();
	}
	p->vel[2] = 10.0;

	p->accel[2] = 5.0;
}