X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=cl_particles.c;h=4bc57357f5c9af27c4f06501f206d88f6c889d7a;hb=0568f69cc9e2f474cdbd653ddeebe5d81ae5e7af;hp=c33c4b1b728a591bfabee25f26c428aacaea3123;hpb=178ba9610d23da1274d07235fe73299f6060ed8f;p=xonotic%2Fdarkplaces.git diff --git a/cl_particles.c b/cl_particles.c index c33c4b1b..4bc57357 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef enum { - pt_static, pt_grav, pt_blob, pt_blob2, pt_bulletsmoke, pt_smoke, pt_snow, pt_rain, pt_spark, pt_bubble, pt_fade, pt_steam, pt_splash, pt_splashpuff, pt_flame, pt_blood, pt_oneframe, pt_lavasplash, pt_raindropsplash, pt_underwaterspark, pt_explosionsplash + pt_static, pt_grav, pt_blob, pt_blob2, pt_bulletsmoke, pt_smoke, pt_snow, pt_rain, pt_spark, pt_bubble, pt_fade, pt_steam, pt_splash, pt_splashpuff, pt_flame, pt_blood, pt_oneframe, pt_lavasplash, pt_raindropsplash, pt_underwaterspark, pt_explosionsplash, pt_stardust } ptype_t; @@ -40,12 +40,9 @@ ptype_t; typedef struct particle_s { ptype_t type; - unsigned int flags; - //int orientation; // typically PARTICLE_BILLBOARD + unsigned int flags; // dynamically lit, orientation, additive blending, texnum vec3_t org; vec3_t vel; - //int additive; - //int tex; float die; float scalex; float scaley; @@ -56,7 +53,6 @@ typedef struct particle_s vec3_t vel2; // used for snow fluttering (base velocity, wind for instance) float friction; // how much air friction affects this object (objects with a low mass/size ratio tend to get more air friction) float pressure; // if non-zero, apply pressure to other particles - //int dynlight; // if set the particle will be dynamically lit (if cl_dynamicparticles is on), used for smoke and blood qbyte color[4]; } particle_t; @@ -673,6 +669,36 @@ void CL_ParticleRain (vec3_t mins, vec3_t maxs, vec3_t dir, int count, int color } } +void CL_Stardust (vec3_t mins, vec3_t maxs, int count) +{ + int k; + float t; + vec3_t o, v, center; + //Con_Printf("CL_Stardust ('%f %f %f', '%f %f %f', %d);\n", mins[0], mins[1], mins[2], maxs[0], maxs[1], maxs[2], count); + if (!cl_particles.integer) return; + + if (maxs[0] <= mins[0]) {t = mins[0];mins[0] = maxs[0];maxs[0] = t;} + if (maxs[1] <= mins[1]) {t = mins[1];mins[1] = maxs[1];maxs[1] = t;} + if (maxs[2] <= mins[2]) {t = mins[2];mins[2] = maxs[2];maxs[2] = t;} + + center[0] = (mins[0] + maxs[0]) * 0.5f; + center[1] = (mins[1] + maxs[1]) * 0.5f; + center[2] = (mins[2] + maxs[2]) * 0.5f; + + while (count--) + { + k = particlepalette[224 + (rand()&15)]; + o[0] = lhrandom(mins[0], maxs[0]); + o[1] = lhrandom(mins[1], maxs[1]); + o[2] = lhrandom(mins[2], maxs[2]); + VectorSubtract(o, center, v); + VectorNormalizeFast(v); + VectorScale(v, 100, v); + v[2] += sv_gravity.value * 0.15f; + particle(pt_stardust, PARTICLE_BILLBOARD, 0x903010, 0xFFD030, tex_particle, false, true, 1.5, 1.5, lhrandom(64, 128), 9999, 0, o[0], o[1], o[2], v[0], v[1], v[2], 0, 0, 0, 0, 0, 0); + } +} + void CL_FlameCube (vec3_t mins, vec3_t maxs, int count) { int k; @@ -685,7 +711,7 @@ void CL_FlameCube (vec3_t mins, vec3_t maxs, int count) while (count--) { k = particlepalette[224 + (rand()&15)]; - particle(pt_flame, PARTICLE_BILLBOARD, k, k, tex_particle, false, true, 8, 8, 255, 9999, 1.1, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), lhrandom(mins[2], maxs[2]), lhrandom(-32, 32), lhrandom(-32, 32), lhrandom(-32, 64), 0, 0, 0, 0, 1, 0); + particle(pt_flame, PARTICLE_BILLBOARD, k, k, tex_particle, false, true, 4, 4, lhrandom(64, 128), 9999, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), lhrandom(mins[2], maxs[2]), lhrandom(-32, 32), lhrandom(-32, 32), lhrandom(0, 64), 0, 0, 0, 0, 1, 0); } } @@ -697,7 +723,7 @@ void CL_Flames (vec3_t org, vec3_t vel, int count) while (count--) { k = particlepalette[224 + (rand()&15)]; - particle(pt_flame, PARTICLE_BILLBOARD, k, k, tex_particle, false, true, 8, 8, 255, 9999, 1.1, org[0], org[1], org[2], vel[0] + lhrandom(-128, 128), vel[1] + lhrandom(-128, 128), vel[2] + lhrandom(-128, 128), 0, 0, 0, 0, 1, 0); + particle(pt_flame, PARTICLE_BILLBOARD, k, k, tex_particle, false, true, 4, 4, lhrandom(64, 128), 9999, 1.1, org[0], org[1], org[2], vel[0] + lhrandom(-128, 128), vel[1] + lhrandom(-128, 128), vel[2] + lhrandom(-128, 128), 0, 0, 0, 0, 1, 0); } } @@ -798,7 +824,7 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent) //dec = 5; //particle(pt_fade, PARTICLE_BILLBOARD, 0x202020, 0x404040, tex_particle, true, false, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 256.0f, 0, 0, 0, 0, 0); dec = 6; - particle(pt_fade, PARTICLE_BILLBOARD, 0x202020, 0x404040, tex_smoke[rand()&7], true, true, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-5, 5), lhrandom(-5, 5), lhrandom(-5, 5), 256.0f, 0, 0, 0, 0, 0); + 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); //particle(pt_fade, PARTICLE_BILLBOARD, 0x202020, 0x404040, tex_smoke[rand()&7], false, true, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-10, 10), lhrandom(-10, 10), lhrandom(-10, 10), 128.0f, 0, 0, 0, 0, 0); //dec = 10; //particle(pt_smoke, PARTICLE_BILLBOARD, 0x202020, 0x404040, tex_smoke[rand()&7], false, true, 2, 2, 160, 9999, 0, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 0, 0, 0, 0); @@ -825,7 +851,7 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent) //dec = 5; //particle(pt_fade, PARTICLE_BILLBOARD, 0x202020, 0x404040, tex_particle, true, false, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-8, 8), lhrandom(-8, 8), lhrandom(-8, 8), 256.0f, 0, 0, 0, 0, 0); dec = 6; - particle(pt_fade, PARTICLE_BILLBOARD, 0x202020, 0x404040, tex_smoke[rand()&7], true, true, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], lhrandom(-5, 5), lhrandom(-5, 5), lhrandom(-5, 5), 256.0f, 0, 0, 0, 0, 0); + 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); //particle(pt_smoke, PARTICLE_BILLBOARD, 0x202020, 0x404040, tex_smoke[rand()&7], false, true, 2, 2, 160, 9999, 0, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 0, 0, 0, 0); if (bubbles && cl_particles_bubbles.integer) { @@ -856,19 +882,19 @@ void CL_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent) case 3: // green tracer dec = 6; //particle(pt_fade, PARTICLE_BILLBOARD, 0x373707, 0x373707, tex_particle, false, true, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], 0, 0, 0, 384.0f, 0, 0, 0, 0, 0); - particle(pt_fade, PARTICLE_BILLBOARD, 0x373707, 0x373707, 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); + 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); break; case 5: // flame tracer dec = 6; //particle(pt_fade, PARTICLE_BILLBOARD, 0xCF632B, 0xCF632B, tex_particle, false, true, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], 0, 0, 0, 384.0f, 0, 0, 0, 0, 0); - particle(pt_fade, PARTICLE_BILLBOARD, 0xCF632B, 0xCF632B, 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); + 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); break; case 6: // voor trail dec = 6; //particle(pt_fade, PARTICLE_BILLBOARD, 0x47232B, 0x47232B, tex_particle, false, true, dec, dec, 128, 9999, 0, pos[0], pos[1], pos[2], 0, 0, 0, 384.0f, 0, 0, 0, 0, 0); - particle(pt_fade, PARTICLE_BILLBOARD, 0x47232B, 0x47232B, 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); + 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); break; case 7: // Nehahra smoke tracer @@ -954,7 +980,7 @@ void CL_MoveParticles (void) if (p->bounce < 0) { // assume it's blood (lame, but...) - R_Stain(v, 64, 32, 16, 16, p->alpha * p->scalex * (1.0f / 100.0f), 128, 48, 48, p->alpha * p->scalex * (1.0f / 100.0f)); + R_Stain(v, 64, 32, 16, 16, p->alpha * p->scalex * (1.0f / 100.0f), 192, 48, 48, p->alpha * p->scalex * (1.0f / 100.0f)); p->die = -1; freeparticles[j++] = p; continue; @@ -1235,7 +1261,7 @@ void CL_MoveParticles (void) break; */ case pt_flame: - p->alpha -= frametime * 512; + p->alpha -= frametime * 384; p->vel[2] += gravity; if (p->alpha < 16) p->die = -1; @@ -1245,6 +1271,12 @@ void CL_MoveParticles (void) p->die = -1; p->time2 = 1; break; + case pt_stardust: + p->alpha -= frametime * 128; + p->vel[2] -= gravity; + if (p->alpha < 16) + p->die = -1; + break; default: printf("unknown particle type %i\n", p->type); p->die = -1;