]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_particles.c
cleaned up glDrawRangeElements limit checking a bit (now done in gl_backend.c)
[xonotic/darkplaces.git] / cl_particles.c
index 533f6541f25c29cd98611e239e1fadee4890b5a4..813162ab7280092f8929f1babaa777d17c2501b4 100644 (file)
@@ -139,7 +139,7 @@ void CL_Particles_Init (void)
 
        i = COM_CheckParm ("-particles");
 
-       if (i)
+       if (i && i < com_argc - 1)
        {
                cl_maxparticles = (int)(atoi(com_argv[i+1]));
                if (cl_maxparticles < ABSOLUTE_MIN_PARTICLES)
@@ -582,7 +582,6 @@ void CL_ParticleCube (vec3_t mins, vec3_t maxs, vec3_t dir, int count, int color
 void CL_ParticleRain (vec3_t mins, vec3_t maxs, vec3_t dir, int count, int colorbase, int type)
 {
        int k;
-       vec3_t vel;
        float t, z;
        if (!cl_particles.integer) return;
        if (maxs[0] <= mins[0]) {t = mins[0];mins[0] = maxs[0];maxs[0] = t;}
@@ -608,21 +607,15 @@ void CL_ParticleRain (vec3_t mins, vec3_t maxs, vec3_t dir, int count, int color
 
                while(count--)
                {
-                       vel[0] = dir[0] + lhrandom(-16, 16);
-                       vel[1] = dir[1] + lhrandom(-16, 16);
-                       vel[2] = dir[2] + lhrandom(-32, 32);
                        k = particlepalette[colorbase + (rand()&3)];
-                       particle(pt_rain, PARTICLE_UPRIGHT_FACING, k, k, tex_particle, true, true, 1, 64, 64, t, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), z, vel[0], vel[1], vel[2], 0, vel[0], vel[1], vel[2], 0, 0);
+                       particle(pt_rain, PARTICLE_UPRIGHT_FACING, k, k, tex_particle, true, true, 1, 64, 64, t, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), z, dir[0], dir[1], dir[2], 0, dir[0], dir[1], dir[2], 0, 0);
                }
                break;
        case 1:
                while(count--)
                {
-                       vel[0] = dir[0] + lhrandom(-16, 16);
-                       vel[1] = dir[1] + lhrandom(-16, 16);
-                       vel[2] = dir[2] + lhrandom(-32, 32);
                        k = particlepalette[colorbase + (rand()&3)];
-                       particle(pt_snow, PARTICLE_BILLBOARD, k, k, tex_particle, false, true, 1, 1, lhrandom(64, 128), t, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), z, vel[0], vel[1], vel[2], 0, vel[0], vel[1], vel[2], 0, 0);
+                       particle(pt_snow, PARTICLE_BILLBOARD, k, k, tex_particle, false, true, 1, 1, lhrandom(64, 128), t, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), z, dir[0], dir[1], dir[2], 0, dir[0], dir[1], dir[2], 0, 0);
                }
                break;
        default:
@@ -779,8 +772,9 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent)
                        case 0: // rocket trail
                                if (!cl_particles_smoke.integer)
                                        return;
-                               dec = 6;
-                               particle(pt_fade, PARTICLE_BILLBOARD, 0x303030, 0x606060, tex_smoke[rand()&7], true, false, dec, dec, 64, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-5, 5), lhrandom(-5, 5), lhrandom(-5, 5), 64.0f, 0, 0, 0, 0, 0);
+                               dec = 3;
+                               particle(pt_fade, PARTICLE_BILLBOARD, 0x303030, 0x606060, tex_smoke[rand()&7], false, true, dec, dec, 32, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-5, 5), lhrandom(-5, 5), lhrandom(-5, 5), 64.0f, 0, 0, 0, 0, 0);
+                               particle(pt_fade, PARTICLE_BILLBOARD, 0x801010, 0xFFA020, tex_smoke[rand()&7], false, true, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-20, 20), lhrandom(-20, 20), lhrandom(-20, 20), 768.0f, 0, 0, 0, 0, 0);
                                if (bubbles && cl_particles_bubbles.integer)
                                {
                                        particle(pt_bubble, PARTICLE_BILLBOARD, 0x404040, 0x808080, tex_bubble, false, true, 2, 2, 255, 9999, 1.5, pos[0], pos[1], pos[2], lhrandom(-16, 16), lhrandom(-16, 16), lhrandom(-16, 16), 0, 0, 0, 0, 0, 0);
@@ -791,8 +785,8 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent)
                                // FIXME: make it gradually stop smoking
                                if (!cl_particles_smoke.integer)
                                        return;
-                               dec = 6;
-                               particle(pt_fade, PARTICLE_BILLBOARD, 0x202020, 0x404040, tex_smoke[rand()&7], true, false, dec, dec, 64, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-5, 5), lhrandom(-5, 5), lhrandom(-5, 5), 128.0f, 0, 0, 0, 0, 0);
+                               dec = 3;
+                               particle(pt_fade, PARTICLE_BILLBOARD, 0x303030, 0x606060, tex_smoke[rand()&7], false, true, dec, dec, 32, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-5, 5), lhrandom(-5, 5), lhrandom(-5, 5), 96.0f, 0, 0, 0, 0, 0);
                                if (bubbles && cl_particles_bubbles.integer)
                                {
                                        particle(pt_bubble, PARTICLE_BILLBOARD, 0x404040, 0x808080, tex_bubble, false, true, 2, 2, 255, 9999, 1.5, pos[0], pos[1], pos[2], lhrandom(-16, 16), lhrandom(-16, 16), lhrandom(-16, 16), 0, 0, 0, 0, 0, 0);
@@ -804,36 +798,36 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent)
                                if (!cl_particles_blood.integer)
                                        return;
                                dec = lhrandom(cl_particles_blood_size_min.value, cl_particles_blood_size_max.value);
-                               particle(pt_blood, PARTICLE_BILLBOARD, 0x000000, 0x200000, tex_smoke[rand()&7], true, false, dec, dec, cl_particles_blood_alpha.value * 255.0f, 9999, -1, pos[0], pos[1], pos[2], vel[0] * 0.5f + lhrandom(-64, 64), vel[1] * 0.5f + lhrandom(-64, 64), vel[2] * 0.5f + lhrandom(-64, 64), 0, 0, 0, 0, 1, 0);
+                               particle(pt_blood, PARTICLE_BILLBOARD, 0x100000, 0x280000, tex_smoke[rand()&7], true, false, dec, dec, cl_particles_blood_alpha.value * 255.0f, 9999, -1, pos[0], pos[1], pos[2], vel[0] * 0.5f + lhrandom(-64, 64), vel[1] * 0.5f + lhrandom(-64, 64), vel[2] * 0.5f + lhrandom(-64, 64), 0, 0, 0, 0, 1, 0);
                                break;
 
                        case 4: // slight blood
                                if (!cl_particles_blood.integer)
                                        return;
                                dec = lhrandom(cl_particles_blood_size_min.value, cl_particles_blood_size_max.value);
-                               particle(pt_blood, PARTICLE_BILLBOARD, 0x000000, 0x200000, tex_smoke[rand()&7], true, false, dec, dec, cl_particles_blood_alpha.value * 255.0f, 9999, -1, pos[0], pos[1], pos[2], vel[0] * 0.5f + lhrandom(-64, 64), vel[1] * 0.5f + lhrandom(-64, 64), vel[2] * 0.5f + lhrandom(-64, 64), 0, 0, 0, 0, 1, 0);
+                               particle(pt_blood, PARTICLE_BILLBOARD, 0x100000, 0x280000, tex_smoke[rand()&7], true, false, dec, dec, cl_particles_blood_alpha.value * 255.0f, 9999, -1, pos[0], pos[1], pos[2], vel[0] * 0.5f + lhrandom(-64, 64), vel[1] * 0.5f + lhrandom(-64, 64), vel[2] * 0.5f + lhrandom(-64, 64), 0, 0, 0, 0, 1, 0);
                                break;
 
                        case 3: // green tracer
                                dec = 6;
-                               particle(pt_fade, PARTICLE_BILLBOARD, 0x373707, 0x373707, tex_particle, false, false, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 384.0f, 0, 0, 0, 0, 0);
+                               particle(pt_fade, PARTICLE_BILLBOARD, 0x002000, 0x003000, tex_particle, false, true, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 384.0f, 0, 0, 0, 0, 0);
                                break;
 
                        case 5: // flame tracer
                                dec = 6;
-                               particle(pt_fade, PARTICLE_BILLBOARD, 0xCF632B, 0xCF632B, tex_particle, false, false, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 384.0f, 0, 0, 0, 0, 0);
+                               particle(pt_fade, PARTICLE_BILLBOARD, 0x301000, 0x502000, tex_particle, false, true, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 384.0f, 0, 0, 0, 0, 0);
                                break;
 
                        case 6: // voor trail
                                dec = 6;
-                               particle(pt_fade, PARTICLE_BILLBOARD, 0x47232B, 0x47232B, tex_particle, false, false, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 384.0f, 0, 0, 0, 0, 0);
+                               particle(pt_fade, PARTICLE_BILLBOARD, 0x502030, 0x502030, tex_particle, false, true, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 384.0f, 0, 0, 0, 0, 0);
                                break;
 
                        case 7: // Nehahra smoke tracer
                                if (!cl_particles_smoke.integer)
                                        return;
-                               dec = 10;
-                               particle(pt_smoke, PARTICLE_BILLBOARD, 0x202020, 0x404040, tex_smoke[rand()&7], true, false, dec, dec, 64, 9999, 0, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 0, 0, 0, 0);
+                               dec = 7;
+                               particle(pt_smoke, PARTICLE_BILLBOARD, 0x303030, 0x606060, tex_smoke[rand()&7], true, false, dec, dec, 64, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-4, 4), lhrandom(-4, 4), lhrandom(0, 16), 0, 0, 0, 0, 0, 0);
                                break;
                }
 
@@ -962,9 +956,9 @@ void CL_MoveParticles (void)
                        if (cl.time > p->time2)
                        {
                                p->time2 = cl.time + (rand() & 3) * 0.1;
-                               p->vel[0] = (rand()&63)-32 + p->vel2[0];
-                               p->vel[1] = (rand()&63)-32 + p->vel2[1];
-                               p->vel[2] = (rand()&63)-32 + p->vel2[2];
+                               p->vel[0] = lhrandom(-32, 32) + p->vel2[0];
+                               p->vel[1] = lhrandom(-32, 32) + p->vel2[1];
+                               p->vel[2] = /*lhrandom(-32, 32) +*/ p->vel2[2];
                        }
                        if (!content)
                                content = Mod_PointInLeaf(p->org, cl.worldmodel)->contents;