Exemple #1
0
void CL_DrawParticles( void )
{
	particle_t	*p, *kill;
	float		frametime;
	static int	framecount = -1;

	if( !cl_draw_particles->integer )
		return;

	// HACKHACK: don't evaluate particles when executes many times at same frame
	// e.g. mirror rendering
	if( framecount != tr.realframecount )
	{
		frametime = cl.time - cl.oldtime;
		framecount = tr.realframecount;
	}
	else frametime = 0.0f;

	if( tracerred->modified || tracergreen->modified || tracerblue->modified )
	{
		gTracerColors[4][0] = (byte)(tracerred->value * 255);
		gTracerColors[4][1] = (byte)(tracergreen->value * 255);
		gTracerColors[4][2] = (byte)(tracerblue->value * 255);
		tracerred->modified = tracergreen->modified = tracerblue->modified = false;
	}

	while( 1 ) 
	{
		// free time-expired particles
		kill = cl_active_particles;
		if( kill && kill->die < cl.time )
		{
			cl_active_particles = kill->next;
			CL_FreeParticle( kill );
			continue;
		}
		break;
	}

	for( p = cl_active_particles; p; p = p->next )
	{
		while( 1 )
		{
			kill = p->next;
			if( kill && kill->die < cl.time )
			{
				p->next = kill->next;
				CL_FreeParticle( kill );
				continue;
			}
			break;
		}

		CL_UpdateParticle( p, frametime );
	}
}
Exemple #2
0
void CL_UpdateParticles( float gravityBase ) {
	float frametime = cls.frametime * 0.001;
	float time1 = frametime * 5;
	float time2 = frametime * 10;
	float time3 = frametime * 15;
	float time4 = frametime * 20;
	float dvel = 4 * frametime;
	int killTime = cl.serverTime - 1;
	float grav = frametime * gravityBase * 0.05;
	float grav2 = frametime * gravityBase * 0.025;
	float percent = frametime / HX_FRAME_TIME;

	for ( cparticle_t* p = active_particles; p; p = p->next ) {
		CL_UpdateParticle( p, frametime, time1, time2, time3, time4, killTime, grav, dvel, percent, grav2 );
	}
}