part->vel[0] = pvx + velocityjitter * v[0];
part->vel[1] = pvy + velocityjitter * v[1];
part->vel[2] = pvz + velocityjitter * v[2];
- part->time2 = 0;
part->airfriction = pairfriction;
part->liquidfriction = pliquidfriction;
part->die = cl.time + lifetime;
}
}
}
+ else if (part->typeindex == pt_explode || part->typeindex == pt_explode2)
+ part->time2 = rand()&3; // time2 is used to progress the colour ramp index
+
#if 0
else if (part->bounce != 0 && part->gravity == 0 && part->typeindex != pt_snow)
{
*/
particle_t *CL_NewQuakeParticle(
const vec3_t origin,
+ const unsigned short ptypeindex,
const int color_1,
const int color_2,
const float gravity,
return CL_NewParticle(
origin,
- pt_alphastatic, // type
+ ptypeindex, // type
color_1,
color_2,
texture,
int k = particlepalette[(palettecolor & ~7) + (rand()&7)];
CL_NewQuakeParticle(
center, // origin
+ pt_alphastatic, // type
k, // color 1
k, // color 2
0.15, // gravity
if (cl_particles_quake.integer)
{
color = particlepalette[67 + (rand()&3)];
- CL_NewQuakeParticle(center, color, color, 0.25, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 3, 0, 2);
+ CL_NewQuakeParticle(center, pt_alphastatic, color, color, 0.25, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 3, 0, 2);
}
else
{
{
dec = 6;
color = particlepalette[67 + (rand()&3)];
- CL_NewQuakeParticle(center, color, color, 0.25, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 3, 0, 2);
+ CL_NewQuakeParticle(center, pt_alphastatic, color, color, 0.25, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 3, 0, 2);
}
else
{
{
r = rand()&3;
color = particlepalette[ramp3[r]];
- CL_NewQuakeParticle(center, color, color, -0.10, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 3, 0, 0.1372549 * (6 - r));
+ CL_NewQuakeParticle(center, pt_alphastatic, color, color, -0.10, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 3, 0, 0.1372549 * (6 - r));
}
else
{
{
r = 2 + (rand()%4);
color = particlepalette[ramp3[r]];
- CL_NewQuakeParticle(center, color, color, -0.15, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 3, 0, 0.1372549 * (6 - r));
+ CL_NewQuakeParticle(center, pt_alphastatic, color, color, -0.15, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 3, 0, 0.1372549 * (6 - r));
}
else
{
{
dec = 6;
color = particlepalette[52 + (rand()&7)];
- CL_NewQuakeParticle(center, color, color, 0, pos[0], pos[1], pos[2], 30*dir[1], 30*-dir[0], 0, 0, 0, 0, 0, 0.5);
- CL_NewQuakeParticle(center, color, color, 0, pos[0], pos[1], pos[2], 30*-dir[1], 30*dir[0], 0, 0, 0, 0, 0, 0.5);
+ CL_NewQuakeParticle(center, pt_alphastatic, color, color, 0, pos[0], pos[1], pos[2], 30*dir[1], 30*-dir[0], 0, 0, 0, 0, 0, 0.5);
+ CL_NewQuakeParticle(center, pt_alphastatic, color, color, 0, pos[0], pos[1], pos[2], 30*-dir[1], 30*dir[0], 0, 0, 0, 0, 0, 0.5);
}
else if (gamemode == GAME_GOODVSBAD2)
{
{
dec = 6;
color = particlepalette[230 + (rand()&7)];
- CL_NewQuakeParticle(center, color, color, 0, pos[0], pos[1], pos[2], 30 * dir[1], 30 * -dir[0], 0, 0, 0, 0, 0, 0.5);
- CL_NewQuakeParticle(center, color, color, 0, pos[0], pos[1], pos[2], 30 * -dir[1], 30 * dir[0], 0, 0, 0, 0, 0, 0.5);
+ CL_NewQuakeParticle(center, pt_alphastatic, color, color, 0, pos[0], pos[1], pos[2], 30 * dir[1], 30 * -dir[0], 0, 0, 0, 0, 0, 0.5);
+ CL_NewQuakeParticle(center, pt_alphastatic, color, color, 0, pos[0], pos[1], pos[2], 30 * -dir[1], 30 * dir[0], 0, 0, 0, 0, 0, 0.5);
}
else
{
if (cl_particles_quake.integer)
{
color = particlepalette[152 + (rand()&3)];
- CL_NewQuakeParticle(center, color, color, 0, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 8, 0, 0.3);
+ CL_NewQuakeParticle(center, pt_alphastatic, color, color, 0, pos[0], pos[1], pos[2], 0, 0, 0, 0, 0, 8, 0, 0.3);
}
else if (gamemode == GAME_GOODVSBAD2)
{
{
int i;
trace_t trace;
- particle_t *particle;
R_Stain(org, 96, 40, 40, 40, 64, 88, 88, 88, 64);
CL_SpawnDecalParticleForPoint(org, 40, 48, 255, tex_bulletdecal[rand()&7], 0xFFFFFF, 0xFFFFFF);
{
color = particlepalette[ramp1[r]];
- particle = CL_NewQuakeParticle(
+ CL_NewQuakeParticle(
org,
+ pt_explode,
color, color,
0.05, // gravity
org[0], org[1], org[2], // offset
256, // velocity jitter
5 // lifetime
);
- particle->typeindex = pt_explode;
}
else
{
color = particlepalette[ramp2[r]];
- particle = CL_NewQuakeParticle(
+ CL_NewQuakeParticle(
org,
+ pt_explode2,
color, color,
0.05, // gravity
org[0], org[1], org[2], // offset
256, // velocity jitter
5 // lifetime
);
-
- particle->typeindex = pt_explode2;
}
-
- particle->time2 = r; // time2 is used to progress the colour ramp index
}
}
else
{
k = particlepalette[colorStart + (i % colorLength)];
if (cl_particles_quake.integer)
- CL_NewQuakeParticle(org, k, k, 0, org[0], org[1], org[2], 0, 0, 0, -4, -4, 16, 256, 0.3);
+ CL_NewQuakeParticle(org, pt_alphastatic, k, k, 0, org[0], org[1], org[2], 0, 0, 0, -4, -4, 16, 256, 0.3);
else
CL_NewParticle(org, pt_alphastatic, k, k, tex_particle, lhrandom(0.5, 1.5), 0, 255, 512, 0, 0, org[0], org[1], org[2], 0, 0, 0, lhrandom(1.5, 3), lhrandom(1.5, 3), 8, 192, true, 0, 1, PBLEND_ALPHA, PARTICLE_BILLBOARD, -1, -1, -1, 1, 1, 0, 0, NULL);
}
frametime = bound(0, cl.time - cl.particles_updatetime, 1);
cl.particles_updatetime = bound(cl.time - 1, cl.particles_updatetime + frametime, cl.time + 1);
- // Handling of the colour ramp for pt_explode and pt_explode2
- pt_explode_frame_interval = frametime * 10;
- pt_explode2_frame_interval = frametime * 15;
-
// LadyHavoc: early out conditions
if (!cl.num_particles)
return;
+ // Handling of the colour ramp for pt_explode and pt_explode2
+ pt_explode_frame_interval = frametime * 10;
+ pt_explode2_frame_interval = frametime * 15;
+
minparticledist_start = DotProduct(r_refdef.view.origin, r_refdef.view.forward) + r_drawparticles_nearclip_min.value;
gravity = frametime * cl.movevars_gravity;
update = frametime > 0;
a = CL_PointSuperContents(p->org);
if (a & (SUPERCONTENTS_SOLID | SUPERCONTENTS_LIQUIDSMASK))
goto killparticle;
- case pt_explode:
- // Progress the particle colour up the ramp
- p->time2 += pt_explode_frame_interval;
- if (p->time2 >= 8)
- {
- p->die = -1;
- }
- else {
- color = particlepalette[ramp1[(int)p->time2]];
- p->color[0] = color >> 16;
- p->color[1] = color >> 8;
- p->color[2] = color >> 0;
- }
- break;
-
- case pt_explode2:
- // Progress the particle colour up the ramp
- p->time2 += pt_explode2_frame_interval;
- if (p->time2 >= 8)
- {
- p->die = -1;
- }
- else {
- color = particlepalette[ramp2[(int)p->time2]];
- p->color[0] = color >> 16;
- p->color[1] = color >> 8;
- p->color[2] = color >> 0;
- }
- break;
+ break;
+ case pt_explode:
+ // Progress the particle colour up the ramp
+ p->time2 += pt_explode_frame_interval;
+ if (p->time2 >= 8)
+ p->die = -1;
+ else
+ {
+ color = particlepalette[ramp1[(int)p->time2]];
+ p->color[0] = color >> 16;
+ p->color[1] = color >> 8;
+ p->color[2] = color >> 0;
+ }
+ break;
+ case pt_explode2:
+ // Progress the particle colour up the ramp
+ p->time2 += pt_explode2_frame_interval;
+ if (p->time2 >= 8)
+ p->die = -1;
+ else
+ {
+ color = particlepalette[ramp2[(int)p->time2]];
+ p->color[0] = color >> 16;
+ p->color[1] = color >> 8;
+ p->color[2] = color >> 0;
+ }
+ break;
default:
break;
}
// for faster batch rendering, particles are rendered in groups by effect (resulting in less perfect sorting but far less state changes)
// fields used by rendering: (48 bytes)
- vec3_t sortorigin; // sort by this group origin, not particle org
+ vec3_t sortorigin; ///< sort by this group origin, not particle org
vec3_t org;
- vec3_t vel; // velocity of particle, or orientation of decal, or end point of beam
+ vec3_t vel; ///< velocity of particle, or orientation of decal, or end point of beam
float size;
- float alpha; // 0-255
- float stretch; // only for sparks
+ float alpha; ///< 0-255
+ float stretch; ///< only for sparks
// fields not used by rendering: (44 bytes)
float stainsize;
float stainalpha;
- float sizeincrease; // rate of size change per second
- float alphafade; // how much alpha reduces per second
- float time2; // used for snow fluttering and decal fade
- float bounce; // how much bounce-back from a surface the particle hits (0 = no physics, 1 = stop and slide, 2 = keep bouncing forever, 1.5 is typical)
- float gravity; // how much gravity affects this particle (1.0 = normal gravity, 0.0 = none)
- float airfriction; // how much air friction affects this object (objects with a low mass/size ratio tend to get more air friction)
- float liquidfriction; // how much liquid friction affects this object (objects with a low mass/size ratio tend to get more liquid friction)
-// float delayedcollisions; // time that p->bounce becomes active
- float delayedspawn; // time that particle appears and begins moving
- float die; // time when this particle should be removed, regardless of alpha
+ float sizeincrease; ///< rate of size change per second
+ float alphafade; ///< how much alpha reduces per second
+ float time2; ///< used for snow fluttering, decal fade, explosion colour ramp
+ float bounce; ///< how much bounce-back from a surface the particle hits (0 = no physics, 1 = stop and slide, 2 = keep bouncing forever, 1.5 is typical)
+ float gravity; ///< how much gravity affects this particle (1.0 = normal gravity, 0.0 = none)
+ float airfriction; ///< how much air friction affects this object (objects with a low mass/size ratio tend to get more air friction)
+ float liquidfriction; ///< how much liquid friction affects this object (objects with a low mass/size ratio tend to get more liquid friction)
+// float delayedcollisions; ///< time that p->bounce becomes active
+ float delayedspawn; ///< time that particle appears and begins moving
+ float die; ///< time when this particle should be removed, regardless of alpha
// short variables grouped to save memory (4 bytes)
- short angle; // base rotation of particle
- short spin; // geometry rotation speed around the particle center normal
+ short angle; ///< base rotation of particle
+ short spin; ///< geometry rotation speed around the particle center normal
// byte variables grouped to save memory (12 bytes)
unsigned char color[3];
- unsigned char qualityreduction; // enables skipping of this particle according to r_refdef.view.qualityreduction
+ unsigned char qualityreduction; ///< enables skipping of this particle according to r_refdef.view.qualityreduction
unsigned char typeindex;
unsigned char blendmode;
unsigned char orientation;
void CL_Particles_Init(void);
void CL_Particles_Shutdown(void);
particle_t *CL_NewParticle(const vec3_t sortorigin, unsigned short ptypeindex, int pcolor1, int pcolor2, int ptex, float psize, float psizeincrease, float palpha, float palphafade, float pgravity, float pbounce, float px, float py, float pz, float pvx, float pvy, float pvz, float pairfriction, float pliquidfriction, float originjitter, float velocityjitter, qbool pqualityreduction, float lifetime, float stretch, pblend_t blendmode, porientation_t orientation, int staincolor1, int staincolor2, int staintex, float stainalpha, float stainsize, float angle, float spin, float tint[4]);
-particle_t *CL_NewQuakeParticle(const vec3_t origin, const int color_1, const int color_2, const float gravity, const float offset_x, const float offset_y, const float offset_z, const float velocity_offset_x, const float velocity_offset_y, const float velocity_offset_z, const float air_friction, const float liquid_friction, const float origin_jitter, const float velocity_jitter, const float lifetime);
+particle_t *CL_NewQuakeParticle(const vec3_t origin, const unsigned short ptypeindex, const int color_1, const int color_2, const float gravity, const float offset_x, const float offset_y, const float offset_z, const float velocity_offset_x, const float velocity_offset_y, const float velocity_offset_z, const float air_friction, const float liquid_friction, const float origin_jitter, const float velocity_jitter, const float lifetime);
typedef enum effectnameindex_s
{
void CL_ParticleExplosion (const vec3_t org);
void CL_ParticleExplosion2 (const vec3_t org, int colorStart, int colorLength);
-#endif
\ No newline at end of file
+#endif