Esempio n. 1
0
/*
===============
CL_RocketTrail
===============
*/
void CL_RocketTrail (vec3_t start, vec3_t end, centity_t *old)
{
	vec3_t		move;
	vec3_t		vec;
	float		len;
	int			j;
	cparticle_t	*p;
	float		dec;

	// smoke
	CL_DiminishingTrail (start, end, old, EF_ROCKET);

	// fire
	VectorCopy (start, move);
	VectorSubtract (end, start, vec);
	len = VectorNormalize (vec);

	dec = 1;
	VectorScale (vec, dec, vec);

	while (len > 0)
	{
		len -= dec;

		if (!free_particles)
			return;

		if ((rand () & 7) == 0)
		{
			p = free_particles;
			free_particles = p->next;
			p->next = active_particles;
			active_particles = p;

			VectorClear (p->accel);
			p->time = cl.time;

			p->alpha = 1.0;
			p->alphavel = -1.0 / (1 + frand () * 0.2);
			p->color = 0xdc + (rand () & 3);

			for (j = 0; j < 3; j++)
			{
				p->org[j] = move[j] + crand () * 5;
				p->vel[j] = crand () * 20;
			}

			p->accel[2] = -PARTICLE_GRAVITY;

			p->bounceFactor = 0.25f;

			p->ignoreGrav = false;
		}

		VectorAdd (move, vec, move);
	}
}
Esempio n. 2
0
/*
===============
CL_RocketTrail

===============
*/
void CL_RocketTrail (const vec3_t start, const vec3_t end, centity_t *old)
{
	vec3_t		move, vec;
	float		len;
	cparticle_t	*p;
	float		dec = 1;

	// smoke
	CL_DiminishingTrail (start, end, old, EF_ROCKET);

	// fire
	VectorCopy (start, move);
	VectorSubtract (end, start, vec);
	len = VectorNormalize (vec);

	//VectorScale (vec, dec, vec);

	while (len > 0)
	{
		len -= dec;

		if (!free_particles)
			return;

		if ( (rand()&7) == 0)
		{
			p = free_particles;
			free_particles = p->next;
			p->next = active_particles;
			active_particles = p;
			
			VectorClear (p->accel);
			p->time = cl.time;

			p->alpha = 1.0f;
			p->alphavel = -1.0f / (1.0f+frand()*0.2f);
			p->color = 227 + (rand()&3);

			p->org[0] = move[0] + crand()*5;
			p->org[1] = move[1] + crand()*5;
			p->org[2] = move[2] + crand()*5;
			p->vel[0] = crand()*20;
			p->vel[1] = crand()*20;
			p->vel[2] = crand()*20;

			p->accel[2] = -PARTICLE_GRAVITY;
		}
		VectorAdd (move, vec, move);
	}
}