Revamp the software particle rendering loop. Seems to work well.

This commit is contained in:
Bill Currie 2000-06-28 23:20:57 +00:00
parent 66e9bfd98c
commit d5ea4bc9bf

View file

@ -462,7 +462,7 @@ R_DrawParticles
*/ */
void R_DrawParticles (void) void R_DrawParticles (void)
{ {
particle_t *p, *kill; particle_t *p, **particle;
float grav; float grav;
int i; int i;
float time2, time3; float time2, time3;
@ -482,31 +482,15 @@ void R_DrawParticles (void)
grav = frametime * 800 * 0.05; grav = frametime * 800 * 0.05;
dvel = 4*frametime; dvel = 4*frametime;
while (1) { for (particle = &active_particles; *particle; ) {
kill = active_particles; if ((*particle)->die < cl.time) {
if (kill != NULL && kill->die < cl.time) { p = (*particle)->next;
active_particles = kill->next; (*particle)->next = free_particles;
kill->next = free_particles; free_particles = (*particle);
free_particles = kill; (*particle) = p;
continue; } else {
} p = *particle;
break; particle = &(*particle)->next;
}
for (p=active_particles ; p ; p=p->next)
{
for ( ;; )
{
kill = p->next;
if (kill && kill->die < cl.time)
{
p->next = kill->next;
kill->next = free_particles;
free_particles = kill;
continue;
}
break;
}
D_DrawParticle (p); D_DrawParticle (p);
@ -514,8 +498,7 @@ void R_DrawParticles (void)
p->org[1] += p->vel[1]*frametime; p->org[1] += p->vel[1]*frametime;
p->org[2] += p->vel[2]*frametime; p->org[2] += p->vel[2]*frametime;
switch (p->type) switch (p->type) {
{
case pt_static: case pt_static:
break; break;
case pt_fire: case pt_fire:
@ -567,6 +550,7 @@ void R_DrawParticles (void)
break; break;
} }
} }
}
D_EndParticles (); D_EndParticles ();
} }