]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_particles.c
New feature: disableclientprediction == -1.
[xonotic/darkplaces.git] / cl_particles.c
index 7b8ef5bfef405448425fa15953a5f3c03483d09c..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)
@@ -1785,6 +1787,11 @@ void CL_ReadPointFile_f (void)
        VectorCopy(leakorg, vecorg);
        Con_Printf("%i points read (%i particles spawned)\nLeak at %f %f %f\n", c, s, leakorg[0], leakorg[1], leakorg[2]);
 
+       if (c == 0)
+       {
+               return;
+       }
+
        CL_NewParticle(vecorg, pt_beam, 0xFF0000, 0xFF0000, tex_beam, 64, 0, 255, 0, 0, 0, org[0] - 4096, org[1], org[2], org[0] + 4096, org[1], org[2], 0, 0, 0, 0, false, 1<<30, 1, PBLEND_ADD, PARTICLE_HBEAM, -1, -1, -1, 1, 1, 0, 0, NULL);
        CL_NewParticle(vecorg, pt_beam, 0x00FF00, 0x00FF00, tex_beam, 64, 0, 255, 0, 0, 0, org[0], org[1] - 4096, org[2], org[0], org[1] + 4096, org[2], 0, 0, 0, 0, false, 1<<30, 1, PBLEND_ADD, PARTICLE_HBEAM, -1, -1, -1, 1, 1, 0, 0, NULL);
        CL_NewParticle(vecorg, pt_beam, 0x0000FF, 0x0000FF, tex_beam, 64, 0, 255, 0, 0, 0, org[0], org[1], org[2] - 4096, org[0], org[1], org[2] + 4096, 0, 0, 0, 0, false, 1<<30, 1, PBLEND_ADD, PARTICLE_HBEAM, -1, -1, -1, 1, 1, 0, 0, NULL);