示例#1
0
/*
===============
CL_SparkShower

Creates 8 random tracers
===============
*/
void CL_SparkShower( const vec3_t org )
{
	vec3_t	pos, dir;
	model_t	*pmodel;
	float	vel;
	int	i;

	// randomize position
	pos[0] = org[0] + Com_RandomFloat( -2.0f, 2.0f );
	pos[1] = org[1] + Com_RandomFloat( -2.0f, 2.0f );
	pos[2] = org[2] + Com_RandomFloat( -2.0f, 2.0f );

	pmodel = Mod_Handle( CL_FindModelIndex( "sprites/richo1.spr" ));
	CL_RicochetSprite( pos, pmodel, 0.0f, Com_RandomFloat( 0.4, 0.6f ));

	// create a 8 random spakle tracers
	for( i = 0; i < 8; i++ )
	{
		dir[0] = Com_RandomFloat( -1.0f, 1.0f );
		dir[1] = Com_RandomFloat( -1.0f, 1.0f );
		dir[2] = Com_RandomFloat( -1.0f, 1.0f );
		vel = Com_RandomFloat( SPARK_ELECTRIC_MINSPEED, SPARK_ELECTRIC_MAXSPEED );

		CL_SparkleTracer( pos, dir, vel );
	}
}
示例#2
0
/*
===============
CL_BulletImpactParticles

===============
*/
void CL_BulletImpactParticles( const vec3_t org )
{
	particle_t	*p;
	vec3_t		pos, dir;
	float		vel;
	int		i, j;

	// do sparks
	// randomize position
	pos[0] = org[0] + Com_RandomFloat( -2.0f, 2.0f );
	pos[1] = org[1] + Com_RandomFloat( -2.0f, 2.0f );
	pos[2] = org[2] + Com_RandomFloat( -2.0f, 2.0f );

	// create a 8 random spakle tracers
	for( i = 0; i < 8; i++ )
	{
		dir[0] = Com_RandomFloat( -1.0f, 1.0f );
		dir[1] = Com_RandomFloat( -1.0f, 1.0f );
		dir[2] = Com_RandomFloat( -1.0f, 1.0f );
		vel = Com_RandomFloat( SPARK_ELECTRIC_MINSPEED, SPARK_ELECTRIC_MAXSPEED );

		CL_SparkleTracer( pos, dir, vel );
	}

	for( i = 0; i < 12; i++ )
	{
		p = CL_AllocParticle( NULL );
		if( !p ) return;
            
		p->die += 1.0f;
		p->color = 0; // black

		p->type = pt_grav;
		for( j = 0; j < 3; j++ )
		{
			p->org[j] = org[j] + Com_RandomFloat( -2.0f, 3.0f );
			p->vel[j] = Com_RandomFloat( -70.0f, 70.0f );
		}
	}
}
示例#3
0
文件: gl_rpart.c 项目: Reedych/xash3d
/*
===============
CL_BulletImpactParticles

===============
*/
void CL_BulletImpactParticles( const vec3_t org )
{
	particle_t	*p;
	vec3_t		pos, dir;
	float		vel;
	int		i, j;

	// do sparks
	// randomize position
	pos[0] = org[0] + Com_RandomFloat( -2.0f, 2.0f );
	pos[1] = org[1] + Com_RandomFloat( -2.0f, 2.0f );
	pos[2] = org[2] + Com_RandomFloat( -2.0f, 2.0f );

	// create a 8 random spakle tracers
	for( i = 0; i < 8; i++ )
	{
		dir[0] = Com_RandomFloat( -1.0f, 1.0f );
		dir[1] = Com_RandomFloat( -1.0f, 1.0f );
		dir[2] = Com_RandomFloat( -1.0f, 1.0f );
		vel = Com_RandomFloat( SPARK_ELECTRIC_MINSPEED, SPARK_ELECTRIC_MAXSPEED );

		CL_SparkleTracer( pos, dir, vel );
	}

	if (r_oldparticles->integer == 1)
	{ 
		for (i = 0; i < 12; i++)
		{
			int greyColors;
			p = CL_AllocParticle(NULL);
			if (!p) return;

			p->die += 1.0f;
			// Randomly make each particle one of three colors: dark grey, medium grey or light grey.
			greyColors = (rand() % 3 + 1) * 32;
			p->color = CL_LookupColor(greyColors, greyColors, greyColors);

			p->type = pt_grav;
			for (j = 0; j < 3; j++)
			{
				p->org[j] = org[j] + Com_RandomFloat(-2.0f, 3.0f);
				p->vel[j] = Com_RandomFloat(-70.0f, 70.0f);
			}
		}
	}
	else
	{
		for (i = 0; i < 12; i++)
		{
			p = CL_AllocParticle(NULL);
			if (!p) return;

			p->die += 1.0f;
			p->color = 0; // black

			p->type = pt_grav;
			for (j = 0; j < 3; j++)
			{
				p->org[j] = org[j] + Com_RandomFloat(-2.0f, 3.0f);
				p->vel[j] = Com_RandomFloat(-70.0f, 70.0f);
			}
		}
	}
}