From d42ea8e2229e2d25f82dceca638f8f9b1938c6e9 Mon Sep 17 00:00:00 2001 From: havoc Date: Wed, 26 Apr 2006 13:12:43 +0000 Subject: [PATCH] a simple optimization to particle allocation, increased bigass1.dem performance from 184fps to 185fps git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6333 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_particles.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cl_particles.c b/cl_particles.c index d7ba1661..92ee63f0 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -1428,7 +1428,11 @@ void CL_MoveParticles (void) for (i = 0, p = cl.particles;i < cl.num_particles;i++, p++) { if (!p->type) + { + if (cl.free_particle > i) + cl.free_particle = i; continue; + } maxparticle = i; content = 0; @@ -1437,6 +1441,8 @@ void CL_MoveParticles (void) if (p->alpha <= 0) { p->type = NULL; + if (cl.free_particle > i) + cl.free_particle = i; continue; } @@ -1609,7 +1615,6 @@ void CL_MoveParticles (void) } } cl.num_particles = maxparticle + 1; - cl.free_particle = 0; } #define MAX_PARTICLETEXTURES 64 -- 2.39.2