]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_particles.c
XPM support for X11; WM_CLASS and WM_COMMAND are now set too
[xonotic/darkplaces.git] / cl_particles.c
index a5fd75ede17bc2bc89aff7f3bffe2251e516b35f..52509ad2a6242776400f76739066f86a0d7ea9b0 100644 (file)
@@ -169,7 +169,8 @@ static const int tex_raindrop = 61;
 static const int tex_beam = 60;
 
 cvar_t cl_particles = {CVAR_SAVE, "cl_particles", "1", "enables particle effects"};
-cvar_t cl_particles_quality = {CVAR_SAVE, "cl_particles_quality", "1", "multiplies number of particles and reduces their alpha"};
+cvar_t cl_particles_quality = {CVAR_SAVE, "cl_particles_quality", "1", "multiplies number of particles"};
+cvar_t cl_particles_alpha = {CVAR_SAVE, "cl_particles_alpha", "1", "multiplies opacity of particles"};
 cvar_t cl_particles_size = {CVAR_SAVE, "cl_particles_size", "1", "multiplies particle size"};
 cvar_t cl_particles_quake = {CVAR_SAVE, "cl_particles_quake", "0", "makes particle effects look mostly like the ones in Quake"};
 cvar_t cl_particles_blood = {CVAR_SAVE, "cl_particles_blood", "1", "enables blood effects"};
@@ -208,7 +209,7 @@ void CL_Particles_ParseEffectInfo(const char *textstart, const char *textend)
                        argv[arrayindex][0] = 0;
                for (;;)
                {
-                       if (!COM_ParseToken(&text, true))
+                       if (!COM_ParseToken_Simple(&text, true, false))
                                return;
                        if (!strcmp(com_token, "\n"))
                                break;
@@ -417,6 +418,7 @@ void CL_Particles_Init (void)
 
        Cvar_RegisterVariable (&cl_particles);
        Cvar_RegisterVariable (&cl_particles_quality);
+       Cvar_RegisterVariable (&cl_particles_alpha);
        Cvar_RegisterVariable (&cl_particles_size);
        Cvar_RegisterVariable (&cl_particles_quake);
        Cvar_RegisterVariable (&cl_particles_blood);
@@ -491,6 +493,49 @@ static particle_t *particle(particletype_t *ptype, int pcolor1, int pcolor2, int
        part->time2 = 0;
        part->airfriction = pairfriction;
        part->liquidfriction = pliquidfriction;
+       part->die = cl.time + part->alpha / (part->alphafade ? part->alphafade : 1);
+       part->delayedcollisions = 0;
+       if (part->type == particletype + pt_blood)
+               part->gravity += 1; // FIXME: this is a legacy hack, effectinfo.txt doesn't have gravity on blood (nor do the particle calls in the engine)
+       // if it is rain or snow, trace ahead and shut off collisions until an actual collision event needs to occur to improve performance
+       if (part->type == particletype + pt_rain)
+       {
+               int i;
+               particle_t *part2;
+               float lifetime = part->die - cl.time;
+               vec3_t endvec;
+               trace_t trace;
+               // turn raindrop into simple spark and create delayedspawn splash effect
+               part->type = particletype + pt_spark;
+               part->bounce = 0;
+               VectorMA(part->org, lifetime, part->vel, endvec);
+               trace = CL_Move(part->org, vec3_origin, vec3_origin, endvec, MOVE_NOMONSTERS, NULL, SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY | ((part->type == particletype + pt_rain || part->type == particletype + pt_snow) ? SUPERCONTENTS_LIQUIDSMASK : 0), true, false, NULL, false);
+               part->die = cl.time + lifetime * trace.fraction;
+               part2 = particle(particletype + pt_raindecal, pcolor1, pcolor2, tex_rainsplash, part->size, part->size * 20, part->alpha, part->alpha / 0.4, 0, 0, trace.endpos[0] + trace.plane.normal[0], trace.endpos[1] + trace.plane.normal[1], trace.endpos[2] + trace.plane.normal[2], trace.plane.normal[0], trace.plane.normal[1], trace.plane.normal[2], 0, 0, 0, 0);
+               if (part2)
+               {
+                       part2->delayedspawn = part->die;
+                       part2->die += part->die - cl.time;
+                       for (i = rand() & 7;i < 10;i++)
+                       {
+                               part2 = particle(particletype + pt_spark, pcolor1, pcolor2, tex_particle, 0.25f, 0, part->alpha * 2, part->alpha * 4, 1, 0, trace.endpos[0] + trace.plane.normal[0], trace.endpos[1] + trace.plane.normal[1], trace.endpos[2] + trace.plane.normal[2], trace.plane.normal[0] * 16, trace.plane.normal[1] * 16, trace.plane.normal[2] * 16 + cl.movevars_gravity * 0.04, 0, 0, 0, 32);
+                               if (part2)
+                               {
+                                       part2->delayedspawn = part->die;
+                                       part2->die += part->die - cl.time;
+                               }
+                       }
+               }
+       }
+       else if (part->bounce != 0 && part->gravity == 0)
+       {
+               float lifetime = part->alpha / (part->alphafade ? part->alphafade : 1);
+               vec3_t endvec;
+               trace_t trace;
+               VectorMA(part->org, lifetime, part->vel, endvec);
+               trace = CL_Move(part->org, vec3_origin, vec3_origin, endvec, MOVE_NOMONSTERS, NULL, SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY | ((part->type == particletype + pt_rain || part->type == particletype + pt_snow) ? SUPERCONTENTS_LIQUIDSMASK : 0), true, false, NULL, false);
+               part->delayedcollisions = cl.time + lifetime * trace.fraction - 0.1;
+       }
        return part;
 }
 
@@ -587,7 +632,10 @@ void CL_ParticleEffect_Fallback(int effectnameindex, float count, const vec3_t o
                                        CL_ParticleEffect(EFFECT_SVC_PARTICLE, 10*count, originmins, originmaxs, velocitymins, velocitymaxs, NULL, 0);
                        }
                        else
+                       {
                                CL_Smoke(originmins, originmaxs, velocitymins, velocitymaxs, 4*count);
+                               CL_Sparks(originmins, originmaxs, velocitymins, velocitymaxs, 15*count);
+                       }
                }
                // bullet hole
                if (cl_stainmaps.integer) R_Stain(center, 32, 96, 96, 96, 24, 128, 128, 128, 24);
@@ -603,7 +651,10 @@ void CL_ParticleEffect_Fallback(int effectnameindex, float count, const vec3_t o
                                        CL_ParticleEffect(EFFECT_SVC_PARTICLE, 10*count, originmins, originmaxs, velocitymins, velocitymaxs, NULL, 0);
                        }
                        else
+                       {
                                CL_Smoke(originmins, originmaxs, velocitymins, velocitymaxs, 4*count);
+                               CL_Sparks(originmins, originmaxs, velocitymins, velocitymaxs, 15*count);
+                       }
                }
                // bullet hole
                if (cl_stainmaps.integer) R_Stain(center, 32, 96, 96, 96, 24, 128, 128, 128, 24);
@@ -620,7 +671,10 @@ void CL_ParticleEffect_Fallback(int effectnameindex, float count, const vec3_t o
                                        CL_ParticleEffect(EFFECT_SVC_PARTICLE, 20*count, originmins, originmaxs, velocitymins, velocitymaxs, NULL, 0);
                        }
                        else
+                       {
                                CL_Smoke(originmins, originmaxs, velocitymins, velocitymaxs, 8*count);
+                               CL_Sparks(originmins, originmaxs, velocitymins, velocitymaxs, 30*count);
+                       }
                }
                // bullet hole
                if (cl_stainmaps.integer) R_Stain(center, 32, 96, 96, 96, 24, 128, 128, 128, 24);
@@ -636,7 +690,10 @@ void CL_ParticleEffect_Fallback(int effectnameindex, float count, const vec3_t o
                                        CL_ParticleEffect(EFFECT_SVC_PARTICLE, 20*count, originmins, originmaxs, velocitymins, velocitymaxs, NULL, 0);
                        }
                        else
+                       {
                                CL_Smoke(originmins, originmaxs, velocitymins, velocitymaxs, 8*count);
+                               CL_Sparks(originmins, originmaxs, velocitymins, velocitymaxs, 30*count);
+                       }
                }
                // bullet hole
                if (cl_stainmaps.integer) R_Stain(center, 32, 96, 96, 96, 24, 128, 128, 128, 24);
@@ -673,7 +730,10 @@ void CL_ParticleEffect_Fallback(int effectnameindex, float count, const vec3_t o
                        if (cl_particles_quake.integer)
                                CL_ParticleEffect(EFFECT_SVC_PARTICLE, 20*count, originmins, originmaxs, velocitymins, velocitymaxs, NULL, 0);
                        else
+                       {
                                CL_Smoke(originmins, originmaxs, velocitymins, velocitymaxs, 4*count);
+                               CL_Sparks(originmins, originmaxs, velocitymins, velocitymaxs, 20*count);
+                       }
                }
                // bullet hole
                if (cl_stainmaps.integer) R_Stain(center, 32, 96, 96, 96, 24, 128, 128, 128, 24);
@@ -686,7 +746,10 @@ void CL_ParticleEffect_Fallback(int effectnameindex, float count, const vec3_t o
                        if (cl_particles_quake.integer)
                                CL_ParticleEffect(EFFECT_SVC_PARTICLE, 20*count, originmins, originmaxs, velocitymins, velocitymaxs, NULL, 0);
                        else
+                       {
                                CL_Smoke(originmins, originmaxs, velocitymins, velocitymaxs, 4*count);
+                               CL_Sparks(originmins, originmaxs, velocitymins, velocitymaxs, 20*count);
+                       }
                }
                // bullet hole
                if (cl_stainmaps.integer) R_Stain(center, 32, 96, 96, 96, 24, 128, 128, 128, 24);
@@ -935,7 +998,7 @@ void CL_ParticleEffect_Fallback(int effectnameindex, float count, const vec3_t o
                                        }
                                        else
                                        {
-                                               particle(particletype + pt_smoke, 0x303030, 0x606060, tex_smoke[rand()&7], 3, 0, cl_particles_smoke_alpha.value*50, cl_particles_smoke_alphafade.value*50, 0, 0, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 0, 0);
+                                               particle(particletype + pt_smoke, 0x303030, 0x606060, tex_smoke[rand()&7], 3, 0, cl_particles_smoke_alpha.value*50, cl_particles_smoke_alphafade.value*75, 0, 0, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 0, 0);
                                        }
                                }
                                else if (effectnameindex == EFFECT_TR_WIZSPIKE)
@@ -1400,7 +1463,7 @@ static void CL_Sparks(const vec3_t originmins, const vec3_t originmaxs, const ve
        {
                sparkcount *= cl_particles_quality.value;
                while(sparkcount-- > 0)
-                       particle(particletype + pt_spark, particlepalette[0x68], particlepalette[0x6f], tex_particle, 0.4f, 0, lhrandom(64, 255), 512, 1, 0, lhrandom(originmins[0], originmaxs[0]), lhrandom(originmins[1], originmaxs[1]), lhrandom(originmins[2], originmaxs[2]), lhrandom(velocitymins[0], velocitymaxs[0]), lhrandom(velocitymins[1], velocitymaxs[1]), lhrandom(velocitymins[2], velocitymaxs[2]) + sv_gravity.value * 0.1, 0, 0, 0, 64);
+                       particle(particletype + pt_spark, particlepalette[0x68], particlepalette[0x6f], tex_particle, 0.5f, 0, lhrandom(64, 255), 512, 1, 0, lhrandom(originmins[0], originmaxs[0]), lhrandom(originmins[1], originmaxs[1]), lhrandom(originmins[2], originmaxs[2]), lhrandom(velocitymins[0], velocitymaxs[0]), lhrandom(velocitymins[1], velocitymaxs[1]), lhrandom(velocitymins[2], velocitymaxs[2]) + cl.movevars_gravity * 0.1f, 0, 0, 0, 64);
        }
 }
 
@@ -1410,7 +1473,7 @@ static void CL_Smoke(const vec3_t originmins, const vec3_t originmaxs, const vec
        {
                smokecount *= cl_particles_quality.value;
                while(smokecount-- > 0)
-                       particle(particletype + pt_smoke, 0x101010, 0x101010, tex_smoke[rand()&7], 4, 0, 255, 512, 0, 0, lhrandom(originmins[0], originmaxs[0]), lhrandom(originmins[1], originmaxs[1]), lhrandom(originmins[2], originmaxs[2]), lhrandom(velocitymins[0], velocitymaxs[0]), lhrandom(velocitymins[1], velocitymaxs[1]), lhrandom(velocitymins[2], velocitymaxs[2]), 0, 0, 0, 16);
+                       particle(particletype + pt_smoke, 0x101010, 0x101010, tex_smoke[rand()&7], 2, 2, 255, 256, 0, 0, lhrandom(originmins[0], originmaxs[0]), lhrandom(originmins[1], originmaxs[1]), lhrandom(originmins[2], originmaxs[2]), lhrandom(velocitymins[0], velocitymaxs[0]), lhrandom(velocitymins[1], velocitymaxs[1]), lhrandom(velocitymins[2], velocitymaxs[2]), 0, 0, 0, smokecount > 0 ? 16 : 0);
        }
 }
 
@@ -1487,7 +1550,7 @@ void CL_MoveParticles (void)
 {
        particle_t *p;
        int i, maxparticle, j, a, content;
-       float gravity, dvel, decalfade, frametime, f, dist, org[3], oldorg[3];
+       float gravity, dvel, decalfade, frametime, f, dist, oldorg[3];
        particletype_t *decaltype, *bloodtype;
        int hitent;
        trace_t trace;
@@ -1500,7 +1563,7 @@ void CL_MoveParticles (void)
        }
 
        frametime = bound(0, cl.time - cl.oldtime, 0.1);
-       gravity = frametime * sv_gravity.value;
+       gravity = frametime * cl.movevars_gravity;
        dvel = 1+4*frametime;
        decalfade = frametime * 255 / cl_decals_fadetime.value;
        decaltype = particletype + pt_decal;
@@ -1550,11 +1613,19 @@ void CL_MoveParticles (void)
                        continue;
                }
 
+               if (p->delayedspawn)
+               {
+                       if (p->delayedspawn > cl.time)
+                               continue;
+                       p->delayedspawn = 0;
+               }
+
                content = 0;
 
+               p->size += p->sizeincrease * frametime;
                p->alpha -= p->alphafade * frametime;
 
-               if (p->alpha <= 0)
+               if (p->alpha <= 0 || p->die <= cl.time)
                {
                        p->type = NULL;
                        if (cl.free_particle > i)
@@ -1562,22 +1633,41 @@ void CL_MoveParticles (void)
                        continue;
                }
 
-               if (p->type->orientation != PARTICLE_BEAM)
+               if (p->type->orientation != PARTICLE_BEAM && frametime > 0)
                {
+                       if (p->liquidfriction && (CL_PointSuperContents(p->org) & SUPERCONTENTS_LIQUIDSMASK))
+                       {
+                               if (p->type == bloodtype)
+                                       p->size += frametime * 8;
+                               else
+                                       p->vel[2] -= p->gravity * gravity;
+                               f = 1.0f - min(p->liquidfriction * frametime, 1);
+                               VectorScale(p->vel, f, p->vel);
+                       }
+                       else
+                       {
+                               p->vel[2] -= p->gravity * gravity;
+                               if (p->airfriction)
+                               {
+                                       f = 1.0f - min(p->airfriction * frametime, 1);
+                                       VectorScale(p->vel, f, p->vel);
+                               }
+                       }
+
                        VectorCopy(p->org, oldorg);
                        VectorMA(p->org, frametime, p->vel, p->org);
-                       VectorCopy(p->org, org);
-                       if (p->bounce)
+                       if (p->bounce && cl.time >= p->delayedcollisions)
                        {
                                trace = CL_Move(oldorg, vec3_origin, vec3_origin, p->org, MOVE_NOMONSTERS, NULL, SUPERCONTENTS_SOLID | SUPERCONTENTS_BODY | (p->type == particletype + pt_rain ? SUPERCONTENTS_LIQUIDSMASK : 0), true, false, &hitent, false);
                                // if the trace started in or hit something of SUPERCONTENTS_NODROP
                                // or if the trace hit something flagged as NOIMPACT
                                // then remove the particle
-                               if (trace.hitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT || ((trace.startsupercontents | trace.hitsupercontents) & SUPERCONTENTS_NODROP))
+                               if (trace.hitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT || ((trace.startsupercontents | trace.hitsupercontents) & SUPERCONTENTS_NODROP) || (trace.startsupercontents & SUPERCONTENTS_SOLID))
                                {
                                        p->type = NULL;
                                        continue;
                                }
+                               VectorCopy(trace.endpos, p->org);
                                // react if the particle hit something
                                if (trace.fraction < 1)
                                {
@@ -1598,10 +1688,11 @@ void CL_MoveParticles (void)
                                                p->liquidfriction = 0;
                                                p->gravity = 0;
                                                p->size *= 1.0f;
-                                               p->sizeincrease = p->size * 16;
-                                               count = rand() & 3;
+                                               p->sizeincrease = p->size * 20;
+                                               count = (int)lhrandom(1, 10);
                                                while(count--)
-                                                       particle(particletype + pt_spark, 0x000000, 0x707070, tex_particle, 0.25f, 0, lhrandom(64, 255), 512, 1, 0, p->org[0], p->org[1], p->org[2], p->vel[0]*16, p->vel[1]*16, sv_gravity.value * 0.04 + p->vel[2]*16, 0, 0, 0, 32);
+                                                       particle(particletype + pt_spark, 0x000000, 0x707070, tex_particle, 0.25f, 0, lhrandom(64, 255), 512, 1, 0, p->org[0], p->org[1], p->org[2], p->vel[0]*16, p->vel[1]*16, cl.movevars_gravity * 0.04 + p->vel[2]*16, 0, 0, 0, 32);
+                                               continue;
                                        }
                                        else if (p->type == bloodtype)
                                        {
@@ -1636,6 +1727,7 @@ void CL_MoveParticles (void)
                                                p->liquidfriction = 0;
                                                p->gravity = 0;
                                                p->size *= 2.0f;
+                                               continue;
                                        }
                                        else if (p->bounce < 0)
                                        {
@@ -1653,18 +1745,6 @@ void CL_MoveParticles (void)
                                        }
                                }
                        }
-                       p->vel[2] -= p->gravity * gravity;
-
-                       if (p->liquidfriction && CL_PointSuperContents(p->org) & SUPERCONTENTS_LIQUIDSMASK)
-                       {
-                               f = 1.0f - min(p->liquidfriction * frametime, 1);
-                               VectorScale(p->vel, f, p->vel);
-                       }
-                       else if (p->airfriction)
-                       {
-                               f = 1.0f - min(p->airfriction * frametime, 1);
-                               VectorScale(p->vel, f, p->vel);
-                       }
                }
 
                if (p->type != particletype + pt_static)
@@ -1680,23 +1760,13 @@ void CL_MoveParticles (void)
                                break;
                        case pt_blood:
                                a = CL_PointSuperContents(p->org);
-                               if (a & (SUPERCONTENTS_WATER | SUPERCONTENTS_SLIME))
-                               {
-                                       p->size += frametime * 8;
-                                       //p->alpha -= bloodwaterfade;
-                               }
-                               else
-                                       p->vel[2] -= gravity;
                                if (a & (SUPERCONTENTS_SOLID | SUPERCONTENTS_LAVA | SUPERCONTENTS_NODROP))
                                        p->type = NULL;
                                break;
                        case pt_bubble:
                                a = CL_PointSuperContents(p->org);
                                if (!(a & (SUPERCONTENTS_WATER | SUPERCONTENTS_SLIME)))
-                               {
                                        p->type = NULL;
-                                       break;
-                               }
                                break;
                        case pt_rain:
                                a = CL_PointSuperContents(p->org);
@@ -2106,19 +2176,21 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh
 
        R_Mesh_Matrix(&identitymatrix);
        R_Mesh_ResetTextureState();
-       R_Mesh_VertexPointer(particle_vertex3f);
-       R_Mesh_TexCoordPointer(0, 2, particle_texcoord2f);
-       R_Mesh_ColorPointer(particle_color4f);
+       R_Mesh_VertexPointer(particle_vertex3f, 0, 0);
+       R_Mesh_TexCoordPointer(0, 2, particle_texcoord2f, 0, 0);
+       R_Mesh_ColorPointer(particle_color4f, 0, 0);
        GL_DepthMask(false);
+       GL_DepthRange(0, 1);
+       GL_PolygonOffset(0, 0);
        GL_DepthTest(true);
-       GL_CullFace(GL_FRONT); // quake is backwards, this culls back faces
+       GL_CullFace(GL_NONE);
 
        // first generate all the vertices at once
        for (surfacelistindex = 0, v3f = particle_vertex3f, t2f = particle_texcoord2f, c4f = particle_color4f;surfacelistindex < numsurfaces;surfacelistindex++, v3f += 3*4, t2f += 2*4, c4f += 4*4)
        {
                particletexture_t *tex;
                const float *org;
-               float up2[3], v[3], right[3], up[3], fog, ifog, cr, cg, cb, ca, size;
+               float up2[3], v[3], right[3], up[3], fog, cr, cg, cb, ca, size;
 
                p = cl.particles + surfacelist[surfacelistindex];
 
@@ -2138,7 +2210,7 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh
                        cb = min(cb, 1);
                        ca = 1;
                }
-               ca /= cl_particles_quality.value;
+               ca *= cl_particles_alpha.value;
                if (p->type->lighting)
                {
                        float ambient[3], diffuse[3], diffusenormal[3];
@@ -2149,13 +2221,13 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh
                }
                if (r_refdef.fogenabled)
                {
-                       fog = VERTEXFOGTABLE(VectorDistance(p->org, r_view.origin));
-                       ifog = 1 - fog;
-                       cr = cr * ifog;
-                       cg = cg * ifog;
-                       cb = cb * ifog;
+                       fog = FogPoint_World(p->org);
+                       cr = cr * fog;
+                       cg = cg * fog;
+                       cb = cb * fog;
                        if (blendmode == PBLEND_ALPHA)
                        {
+                               fog = 1 - fog;
                                cr += r_refdef.fogcolor[0] * fog * r_view.colorscale;
                                cg += r_refdef.fogcolor[1] * fog * r_view.colorscale;
                                cb += r_refdef.fogcolor[2] * fog * r_view.colorscale;
@@ -2192,14 +2264,7 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh
                }
                else if (p->type->orientation == PARTICLE_ORIENTED_DOUBLESIDED)
                {
-                       // double-sided
-                       if (DotProduct(p->vel, r_view.origin) > DotProduct(p->vel, org))
-                       {
-                               VectorNegate(p->vel, v);
-                               VectorVectors(v, right, up);
-                       }
-                       else
-                               VectorVectors(p->vel, right, up);
+                       VectorVectors(p->vel, right, up);
                        VectorScale(right, size, right);
                        VectorScale(up, size, up);
                        v3f[ 0] = org[0] - right[0] - up[0];
@@ -2263,7 +2328,7 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh
                if (blendmode != p->type->blendmode)
                {
                        if (batchcount > 0)
-                               R_Mesh_Draw(batchstart * 4, batchcount * 4, batchcount * 2, particle_element3i + batchstart * 6);
+                               R_Mesh_Draw(batchstart * 4, batchcount * 4, batchcount * 2, particle_element3i + batchstart * 6, 0, 0);
                        batchcount = 0;
                        batchstart = surfacelistindex;
                        blendmode = p->type->blendmode;
@@ -2277,7 +2342,7 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh
                if (texture != particletexture[p->texnum].texture)
                {
                        if (batchcount > 0)
-                               R_Mesh_Draw(batchstart * 4, batchcount * 4, batchcount * 2, particle_element3i + batchstart * 6);
+                               R_Mesh_Draw(batchstart * 4, batchcount * 4, batchcount * 2, particle_element3i + batchstart * 6, 0, 0);
                        batchcount = 0;
                        batchstart = surfacelistindex;
                        texture = particletexture[p->texnum].texture;
@@ -2287,7 +2352,7 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh
                batchcount++;
        }
        if (batchcount > 0)
-               R_Mesh_Draw(batchstart * 4, batchcount * 4, batchcount * 2, particle_element3i + batchstart * 6);
+               R_Mesh_Draw(batchstart * 4, batchcount * 4, batchcount * 2, particle_element3i + batchstart * 6, 0, 0);
        GL_LockArrays(0, 0);
 }
 
@@ -2306,7 +2371,7 @@ void R_DrawParticles (void)
        // LordHavoc: only render if not too close
        for (i = 0, p = cl.particles;i < cl.num_particles;i++, p++)
        {
-               if (p->type)
+               if (p->type && !p->delayedspawn)
                {
                        r_refdef.stats.particles++;
                        if (DotProduct(p->org, r_view.forward) >= minparticledist || p->type->orientation == PARTICLE_BEAM)