]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Limit number of particles created at once.
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 10 Mar 2015 10:45:32 +0000 (10:45 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 10 Mar 2015 10:45:32 +0000 (10:45 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12206 d7cf8633-e32d-0410-b094-e92efae38249

cl_particles.c

index fb81172c99cf9894a45ce9590d1f7406cc83254f..54f73efbfa433b54503afb5f646aedc20a3c2db2 100644 (file)
@@ -1248,7 +1248,7 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v
        {
                vec3_t dir, pos;
                float len, dec, qd;
-               int smoke, blood, bubbles, r, color;
+               int smoke, blood, bubbles, r, color, count;
 
                if (spawndlight && r_refdef.scene.numlights < MAX_DLIGHTS)
                {
@@ -1284,6 +1284,7 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v
 
                VectorSubtract(originmaxs, originmins, dir);
                len = VectorNormalizeLength(dir);
+
                if (ent)
                {
                        dec = -ent->persistent.trail_time;
@@ -1305,8 +1306,9 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v
                blood = cl_particles.integer && cl_particles_blood.integer;
                bubbles = cl_particles.integer && cl_particles_bubbles.integer && !cl_particles_quake.integer && (CL_PointSuperContents(pos) & (SUPERCONTENTS_WATER | SUPERCONTENTS_SLIME));
                qd = 1.0f / cl_particles_quality.value;
+               count = 0;
 
-               while (len >= 0)
+               while (len >= 0 && ++count <= 16384)
                {
                        dec = 3;
                        if (blood)