mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-29 20:20:43 +00:00
Small particle trail speedup/legibility/flexibility improvement, at price of redundant code in sw/sw32. Tradeoffs. *sigh*
This commit is contained in:
parent
e9cf5b4eba
commit
0d0e570676
6 changed files with 528 additions and 182 deletions
|
@ -44,7 +44,13 @@ typedef enum {
|
|||
|
||||
void R_ParseParticleEffect (void);
|
||||
struct entity_s;
|
||||
void R_RocketTrail (int type, struct entity_s *ent);
|
||||
void R_RocketTrail (struct entity_s *ent);
|
||||
void R_GrenadeTrail (struct entity_s *ent);
|
||||
void R_BloodTrail (struct entity_s *ent);
|
||||
void R_SlightBloodTrail (struct entity_s *ent);
|
||||
void R_GreenTrail (struct entity_s *ent);
|
||||
void R_FlameTrail (struct entity_s *ent);
|
||||
void R_VoorTrail (struct entity_s *ent);
|
||||
void R_RunParticleEffect (vec3_t org, int color, int count);
|
||||
void R_RunPuffEffect (vec3_t org, particle_effect_t type, byte count);
|
||||
void R_RunSpikeEffect (vec3_t org, particle_effect_t type);
|
||||
|
|
|
@ -263,7 +263,7 @@ static void
|
|||
R_RunSparkEffect (vec3_t org, int count, int ofuzz)
|
||||
{
|
||||
particle_new (pt_smokecloud, part_tex_smoke[rand () & 7], org,
|
||||
(ofuzz / 8) * .75, vec3_origin, r_realtime + 99,
|
||||
ofuzz * 0.08, vec3_origin, r_realtime + 99,
|
||||
12 + (rand () & 3), 96);
|
||||
while (count--)
|
||||
particle_new_random (pt_fallfadespark, part_tex_spark, org,
|
||||
|
@ -424,11 +424,14 @@ R_TeleportSplash (vec3_t org)
|
|||
}
|
||||
|
||||
void
|
||||
R_RocketParticles (entity_t *ent)
|
||||
R_RocketTrail (entity_t *ent)
|
||||
{
|
||||
float dist, len, pscale, pscalenext;
|
||||
vec3_t subtract, vec;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
R_AddFire (ent->old_origin, ent->origin, ent);
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
|
@ -437,7 +440,7 @@ R_RocketParticles (entity_t *ent)
|
|||
|
||||
while (len > 0) {
|
||||
pscalenext = 1.5 + qfrandom (1.5);
|
||||
dist = (pscale + pscalenext) * 1.3;
|
||||
dist = (pscale + pscalenext) * 1.3;
|
||||
|
||||
VectorScale (vec, min(dist, len), subtract);
|
||||
VectorAdd (ent->old_origin, subtract, ent->old_origin);
|
||||
|
@ -452,18 +455,21 @@ R_RocketParticles (entity_t *ent)
|
|||
}
|
||||
|
||||
void
|
||||
R_GrenadeParticles (entity_t *ent)
|
||||
R_GrenadeTrail (entity_t *ent)
|
||||
{
|
||||
float dist, len, pscale, pscalenext;
|
||||
vec3_t subtract, vec;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
pscale = 6.0 + qfrandom (7.0);
|
||||
|
||||
while (len > 0) {
|
||||
pscalenext = 6.0 + qfrandom (7.0);
|
||||
dist = (pscale + pscalenext) * 2.0;
|
||||
dist = (pscale + pscalenext) * 2.0;
|
||||
|
||||
VectorScale (vec, min(dist, len), subtract);
|
||||
VectorAdd (ent->old_origin, subtract, ent->old_origin);
|
||||
|
@ -478,12 +484,15 @@ R_GrenadeParticles (entity_t *ent)
|
|||
}
|
||||
|
||||
void
|
||||
R_BloodParticles (entity_t *ent)
|
||||
R_BloodTrail (entity_t *ent)
|
||||
{
|
||||
float dist, len, pscale, pscalenext;
|
||||
int j;
|
||||
vec3_t subtract, vec, porg, pvel;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
pscale = 5.0 + qfrandom (10.0);
|
||||
|
@ -493,10 +502,10 @@ R_BloodParticles (entity_t *ent)
|
|||
VectorCopy (ent->old_origin, porg);
|
||||
|
||||
pscalenext = 5.0 + qfrandom (10.0);
|
||||
dist = (pscale + pscalenext) * 1.5;
|
||||
dist = (pscale + pscalenext) * 1.5;
|
||||
|
||||
for (j = 0; j < 3; j++) {
|
||||
pvel[j] = (qfrandom (6.0) - 3.0) * 4.0;
|
||||
pvel[j] = (qfrandom (24.0) - 12.0);
|
||||
porg[j] = ent->old_origin[j] + qfrandom (3.0) - 1.5;
|
||||
}
|
||||
|
||||
|
@ -511,12 +520,15 @@ R_BloodParticles (entity_t *ent)
|
|||
}
|
||||
|
||||
void
|
||||
R_SlightBloodParticles (entity_t *ent)
|
||||
R_SlightBloodTrail (entity_t *ent)
|
||||
{
|
||||
float dist, len, pscale, pscalenext;
|
||||
int j;
|
||||
vec3_t subtract, vec, porg, pvel;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
pscale = 1.5 + qfrandom (7.5);
|
||||
|
@ -529,7 +541,7 @@ R_SlightBloodParticles (entity_t *ent)
|
|||
dist = (pscale + pscalenext) * 1.5;
|
||||
|
||||
for (j = 0; j < 3; j++) {
|
||||
pvel[j] = (qfrandom (6.0) - 3.0) * 2.0;
|
||||
pvel[j] = (qfrandom (12.0) - 6.0);
|
||||
porg[j] = ent->old_origin[j] + qfrandom (3.0) - 1.5;
|
||||
}
|
||||
|
||||
|
@ -544,12 +556,15 @@ R_SlightBloodParticles (entity_t *ent)
|
|||
}
|
||||
|
||||
void
|
||||
R_GreenParticles (entity_t *ent)
|
||||
R_GreenTrail (entity_t *ent)
|
||||
{
|
||||
float dist, len;
|
||||
static int tracercount;
|
||||
vec3_t subtract, vec, pvel;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
dist = 3.0;
|
||||
|
@ -576,12 +591,15 @@ R_GreenParticles (entity_t *ent)
|
|||
}
|
||||
|
||||
void
|
||||
R_FlameParticles (entity_t *ent)
|
||||
R_FlameTrail (entity_t *ent)
|
||||
{
|
||||
float dist, len;
|
||||
static int tracercount;
|
||||
vec3_t subtract, vec, pvel;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
dist = 3.0;
|
||||
|
@ -607,12 +625,15 @@ R_FlameParticles (entity_t *ent)
|
|||
}
|
||||
|
||||
void
|
||||
R_VoorParticles (entity_t *ent)
|
||||
R_VoorTrail (entity_t *ent)
|
||||
{
|
||||
float dist, len;
|
||||
int j;
|
||||
vec3_t subtract, vec, porg;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
dist = 3.0;
|
||||
|
@ -631,37 +652,6 @@ R_VoorParticles (entity_t *ent)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_RocketTrail (int type, entity_t *ent)
|
||||
{
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
switch (type) {
|
||||
case 0: // rocket trail
|
||||
R_RocketParticles (ent);
|
||||
break;
|
||||
case 1: // grenade trail
|
||||
R_GrenadeParticles (ent);
|
||||
break;
|
||||
case 2: // blood
|
||||
R_BloodParticles (ent);
|
||||
break;
|
||||
case 4: // slight blood
|
||||
R_SlightBloodParticles (ent);
|
||||
break;
|
||||
case 3: // green tracer
|
||||
R_GreenParticles (ent);
|
||||
break;
|
||||
case 5: // flame tracer
|
||||
R_FlameParticles (ent);
|
||||
break;
|
||||
case 6: // voor trail
|
||||
R_VoorParticles (ent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_DrawParticles (void)
|
||||
{
|
||||
|
@ -755,22 +745,22 @@ R_DrawParticles (void)
|
|||
part->vel[2] -= grav;
|
||||
break;
|
||||
case pt_smoke:
|
||||
if ((part->alpha -= r_frametime * 96) < 1)
|
||||
if ((part->alpha -= r_frametime * 100) < 1)
|
||||
part->die = -1;
|
||||
part->scale += r_frametime * 4;
|
||||
// part->org[2] += r_frametime * 30 - grav;
|
||||
break;
|
||||
case pt_smokecloud:
|
||||
if ((part->alpha -= r_frametime * 128) < 1)
|
||||
if ((part->alpha -= r_frametime * 140) < 1)
|
||||
{
|
||||
part->die = -1;
|
||||
break;
|
||||
}
|
||||
part->scale += r_frametime * 60;
|
||||
part->scale += r_frametime * 50;
|
||||
part->org[2] += r_frametime * 30;
|
||||
break;
|
||||
case pt_bloodcloud:
|
||||
if ((part->alpha -= r_frametime * 64) < 1)
|
||||
if ((part->alpha -= r_frametime * 65) < 1)
|
||||
{
|
||||
part->die = -1;
|
||||
break;
|
||||
|
|
|
@ -407,18 +407,19 @@ R_TeleportSplash (vec3_t org)
|
|||
}
|
||||
|
||||
void
|
||||
R_RocketTrail (int type, entity_t *ent)
|
||||
R_RocketTrail (entity_t *ent)
|
||||
{
|
||||
vec3_t vec;
|
||||
float len;
|
||||
int j;
|
||||
float len;
|
||||
int j;
|
||||
particle_t *p;
|
||||
vec3_t vec;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
|
||||
while (len > 0) {
|
||||
len -= 3;
|
||||
|
||||
|
@ -430,74 +431,246 @@ R_RocketTrail (int type, entity_t *ent)
|
|||
active_particles = p;
|
||||
|
||||
VectorCopy (vec3_origin, p->vel);
|
||||
|
||||
p->die = r_realtime + 2;
|
||||
p->ramp = (rand () & 3);
|
||||
p->color = ramp3[(int) p->ramp];
|
||||
p->type = pt_fire;
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
|
||||
|
||||
// originally an if/else, ordered 4, 2, 6, 1, 0, 3|5
|
||||
switch (type) {
|
||||
case 0: // rocket trail
|
||||
p->ramp = (rand () & 3);
|
||||
p->color = ramp3[(int) p->ramp];
|
||||
p->type = pt_fire;
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
|
||||
break;
|
||||
case 1: // smoke smoke
|
||||
p->ramp = (rand () & 3) + 2;
|
||||
p->color = ramp3[(int) p->ramp];
|
||||
p->type = pt_fire;
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
|
||||
break;
|
||||
case 4: // slight blood
|
||||
p->type = pt_slowgrav;
|
||||
p->color = 67 + (rand () & 3);
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
|
||||
len -= 3;
|
||||
break;
|
||||
case 2: // blood
|
||||
p->type = pt_slowgrav;
|
||||
p->color = 67 + (rand () & 3);
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
|
||||
break;
|
||||
case 3: // green tracer
|
||||
case 5: // flame tracer
|
||||
{
|
||||
static int tracercount;
|
||||
VectorAdd (ent->old_origin, vec, ent->old_origin);
|
||||
}
|
||||
}
|
||||
|
||||
p->die = r_realtime + 0.5;
|
||||
p->type = pt_static;
|
||||
if (type == 3)
|
||||
p->color = 52 + ((tracercount & 4) << 1);
|
||||
else
|
||||
p->color = 230 + ((tracercount & 4) << 1);
|
||||
void
|
||||
R_GrenadeTrail (entity_t *ent)
|
||||
{
|
||||
float len;
|
||||
int j;
|
||||
particle_t *p;
|
||||
vec3_t vec;
|
||||
|
||||
tracercount++;
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorCopy (ent->old_origin, p->org);
|
||||
if (tracercount & 1) {
|
||||
p->vel[0] = 30 * vec[1];
|
||||
p->vel[1] = 30 * -vec[0];
|
||||
} else {
|
||||
p->vel[0] = 30 * -vec[1];
|
||||
p->vel[1] = 30 * vec[0];
|
||||
}
|
||||
}
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
|
||||
while (len > 0) {
|
||||
len -= 3;
|
||||
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
VectorCopy (vec3_origin, p->vel);
|
||||
|
||||
p->die = r_realtime + 2;
|
||||
p->ramp = (rand () & 3) + 2;
|
||||
p->color = ramp3[(int) p->ramp];
|
||||
p->type = pt_fire;
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
|
||||
|
||||
VectorAdd (ent->old_origin, vec, ent->old_origin);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_BloodTrail (entity_t *ent)
|
||||
{
|
||||
float len;
|
||||
int j;
|
||||
particle_t *p;
|
||||
vec3_t vec;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
|
||||
while (len > 0) {
|
||||
len -= 3;
|
||||
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
VectorCopy (vec3_origin, p->vel);
|
||||
|
||||
p->die = r_realtime + 2;
|
||||
p->type = pt_slowgrav;
|
||||
p->color = 67 + (rand () & 3);
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
|
||||
break;
|
||||
case 6: // voor trail
|
||||
p->color = 9 * 16 + 8 + (rand () & 3);
|
||||
p->type = pt_static;
|
||||
p->die = r_realtime + 0.3;
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () & 15) - 8);
|
||||
break;
|
||||
|
||||
VectorAdd (ent->old_origin, vec, ent->old_origin);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_SlightBloodTrail (entity_t *ent)
|
||||
{
|
||||
float len;
|
||||
int j;
|
||||
particle_t *p;
|
||||
vec3_t vec;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
|
||||
while (len > 0) {
|
||||
len -= 6;
|
||||
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
VectorCopy (vec3_origin, p->vel);
|
||||
|
||||
p->die = r_realtime + 2;
|
||||
p->type = pt_slowgrav;
|
||||
p->color = 67 + (rand () & 3);
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
|
||||
|
||||
VectorAdd (ent->old_origin, vec, ent->old_origin);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_GreenTrail (entity_t *ent)
|
||||
{
|
||||
float len;
|
||||
particle_t *p;
|
||||
vec3_t vec;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
|
||||
while (len > 0) {
|
||||
static int tracercount;
|
||||
|
||||
len -= 3;
|
||||
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
VectorCopy (vec3_origin, p->vel);
|
||||
|
||||
p->die = r_realtime + 0.5;
|
||||
p->type = pt_static;
|
||||
p->color = 52 + ((tracercount & 4) << 1);
|
||||
|
||||
tracercount++;
|
||||
|
||||
VectorAdd (ent->old_origin, vec, ent->old_origin);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_FlameTrail (entity_t *ent)
|
||||
{
|
||||
float len;
|
||||
particle_t *p;
|
||||
vec3_t vec;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
|
||||
while (len > 0) {
|
||||
static int tracercount;
|
||||
|
||||
len -= 3;
|
||||
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
VectorCopy (vec3_origin, p->vel);
|
||||
|
||||
p->die = r_realtime + 0.5;
|
||||
p->type = pt_static;
|
||||
p->color = 230 + ((tracercount & 4) << 1);
|
||||
|
||||
tracercount++;
|
||||
|
||||
VectorCopy (ent->old_origin, p->org);
|
||||
if (tracercount & 1) {
|
||||
p->vel[0] = 30 * vec[1];
|
||||
p->vel[1] = 30 * -vec[0];
|
||||
} else {
|
||||
p->vel[0] = 30 * -vec[1];
|
||||
p->vel[1] = 30 * vec[0];
|
||||
}
|
||||
|
||||
VectorAdd (ent->old_origin, vec, ent->old_origin);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_VoorTrail (entity_t *ent)
|
||||
{
|
||||
float len;
|
||||
int j;
|
||||
particle_t *p;
|
||||
vec3_t vec;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
|
||||
while (len > 0) {
|
||||
len -= 3;
|
||||
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
VectorCopy (vec3_origin, p->vel);
|
||||
|
||||
p->die = r_realtime + 0.3;
|
||||
p->type = pt_static;
|
||||
p->color = 9 * 16 + 8 + (rand () & 3);
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () & 15) - 8);
|
||||
|
||||
VectorAdd (ent->old_origin, vec, ent->old_origin);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_DrawParticles (void)
|
||||
|
|
|
@ -378,14 +378,13 @@ R_LavaSplash (vec3_t org)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
R_TeleportSplash (vec3_t org)
|
||||
{
|
||||
int i, j, k;
|
||||
float vel;
|
||||
int i, j, k;
|
||||
particle_t *p;
|
||||
float vel;
|
||||
vec3_t dir;
|
||||
vec3_t dir;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
@ -418,20 +417,20 @@ R_TeleportSplash (vec3_t org)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
R_RocketTrail (int type, entity_t *ent)
|
||||
R_RocketTrail (entity_t *ent)
|
||||
{
|
||||
vec3_t vec;
|
||||
float len;
|
||||
int j;
|
||||
float len;
|
||||
int j;
|
||||
particle_t *p;
|
||||
vec3_t vec;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
|
||||
while (len > 0) {
|
||||
len -= 3;
|
||||
|
||||
|
@ -443,64 +442,246 @@ R_RocketTrail (int type, entity_t *ent)
|
|||
active_particles = p;
|
||||
|
||||
VectorCopy (vec3_origin, p->vel);
|
||||
|
||||
p->die = r_realtime + 2;
|
||||
p->ramp = (rand () & 3);
|
||||
p->color = ramp3[(int) p->ramp];
|
||||
p->type = pt_fire;
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
|
||||
|
||||
if (type == 4) { // slight blood
|
||||
p->type = pt_slowgrav;
|
||||
p->color = 67 + (rand () & 3);
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
|
||||
len -= 3;
|
||||
} else if (type == 2) { // blood
|
||||
p->type = pt_slowgrav;
|
||||
p->color = 67 + (rand () & 3);
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
|
||||
} else if (type == 6) { // voor trail
|
||||
p->color = 9 * 16 + 8 + (rand () & 3);
|
||||
p->type = pt_static;
|
||||
p->die = r_realtime + 0.3;
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () & 15) - 8);
|
||||
} else if (type == 1) { // smoke smoke
|
||||
p->ramp = (rand () & 3) + 2;
|
||||
p->color = ramp3[(int) p->ramp];
|
||||
p->type = pt_fire;
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
|
||||
} else if (type == 0) { // rocket trail
|
||||
p->ramp = (rand () & 3);
|
||||
p->color = ramp3[(int) p->ramp];
|
||||
p->type = pt_fire;
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
|
||||
} else if (type == 3 || type == 5) { // tracer
|
||||
static int tracercount;
|
||||
VectorAdd (ent->old_origin, vec, ent->old_origin);
|
||||
}
|
||||
}
|
||||
|
||||
p->die = r_realtime + 0.5;
|
||||
p->type = pt_static;
|
||||
if (type == 3)
|
||||
p->color = 52 + ((tracercount & 4) << 1);
|
||||
else
|
||||
p->color = 230 + ((tracercount & 4) << 1);
|
||||
void
|
||||
R_GrenadeTrail (entity_t *ent)
|
||||
{
|
||||
float len;
|
||||
int j;
|
||||
particle_t *p;
|
||||
vec3_t vec;
|
||||
|
||||
tracercount++;
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorCopy (ent->old_origin, p->org);
|
||||
if (tracercount & 1) {
|
||||
p->vel[0] = 30 * vec[1];
|
||||
p->vel[1] = 30 * -vec[0];
|
||||
} else {
|
||||
p->vel[0] = 30 * -vec[1];
|
||||
p->vel[1] = 30 * vec[0];
|
||||
}
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
|
||||
while (len > 0) {
|
||||
len -= 3;
|
||||
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
VectorCopy (vec3_origin, p->vel);
|
||||
|
||||
p->die = r_realtime + 2;
|
||||
p->ramp = (rand () & 3) + 2;
|
||||
p->color = ramp3[(int) p->ramp];
|
||||
p->type = pt_fire;
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
|
||||
|
||||
VectorAdd (ent->old_origin, vec, ent->old_origin);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_BloodTrail (entity_t *ent)
|
||||
{
|
||||
float len;
|
||||
int j;
|
||||
particle_t *p;
|
||||
vec3_t vec;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
|
||||
while (len > 0) {
|
||||
len -= 3;
|
||||
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
VectorCopy (vec3_origin, p->vel);
|
||||
|
||||
p->die = r_realtime + 2;
|
||||
p->type = pt_slowgrav;
|
||||
p->color = 67 + (rand () & 3);
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
|
||||
break;
|
||||
|
||||
VectorAdd (ent->old_origin, vec, ent->old_origin);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_SlightBloodTrail (entity_t *ent)
|
||||
{
|
||||
float len;
|
||||
int j;
|
||||
particle_t *p;
|
||||
vec3_t vec;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
|
||||
while (len > 0) {
|
||||
len -= 6;
|
||||
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
VectorCopy (vec3_origin, p->vel);
|
||||
|
||||
p->die = r_realtime + 2;
|
||||
p->type = pt_slowgrav;
|
||||
p->color = 67 + (rand () & 3);
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () % 6) - 3);
|
||||
|
||||
VectorAdd (ent->old_origin, vec, ent->old_origin);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_GreenTrail (entity_t *ent)
|
||||
{
|
||||
float len;
|
||||
particle_t *p;
|
||||
vec3_t vec;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
|
||||
while (len > 0) {
|
||||
static int tracercount;
|
||||
|
||||
len -= 3;
|
||||
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
VectorCopy (vec3_origin, p->vel);
|
||||
|
||||
p->die = r_realtime + 0.5;
|
||||
p->type = pt_static;
|
||||
p->color = 52 + ((tracercount & 4) << 1);
|
||||
|
||||
tracercount++;
|
||||
|
||||
VectorAdd (ent->old_origin, vec, ent->old_origin);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_FlameTrail (entity_t *ent)
|
||||
{
|
||||
float len;
|
||||
particle_t *p;
|
||||
vec3_t vec;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
|
||||
while (len > 0) {
|
||||
static int tracercount;
|
||||
|
||||
len -= 3;
|
||||
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
VectorCopy (vec3_origin, p->vel);
|
||||
|
||||
p->die = r_realtime + 0.5;
|
||||
p->type = pt_static;
|
||||
p->color = 230 + ((tracercount & 4) << 1);
|
||||
|
||||
tracercount++;
|
||||
|
||||
VectorCopy (ent->old_origin, p->org);
|
||||
if (tracercount & 1) {
|
||||
p->vel[0] = 30 * vec[1];
|
||||
p->vel[1] = 30 * -vec[0];
|
||||
} else {
|
||||
p->vel[0] = 30 * -vec[1];
|
||||
p->vel[1] = 30 * vec[0];
|
||||
}
|
||||
|
||||
VectorAdd (ent->old_origin, vec, ent->old_origin);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_VoorTrail (entity_t *ent)
|
||||
{
|
||||
float len;
|
||||
int j;
|
||||
particle_t *p;
|
||||
vec3_t vec;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (ent->origin, ent->old_origin, vec);
|
||||
len = VectorNormalize (vec);
|
||||
|
||||
while (len > 0) {
|
||||
len -= 3;
|
||||
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
VectorCopy (vec3_origin, p->vel);
|
||||
|
||||
p->die = r_realtime + 0.3;
|
||||
p->type = pt_static;
|
||||
p->color = 9 * 16 + 8 + (rand () & 3);
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->old_origin[j] + ((rand () & 15) - 8);
|
||||
|
||||
VectorAdd (ent->old_origin, vec, ent->old_origin);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_DrawParticles (void)
|
||||
|
@ -553,7 +734,6 @@ R_DrawParticles (void)
|
|||
p->color = ramp3[(int) p->ramp];
|
||||
p->vel[2] += grav;
|
||||
break;
|
||||
|
||||
case pt_explode:
|
||||
p->ramp += time2;
|
||||
if (p->ramp >= 8)
|
||||
|
@ -564,7 +744,6 @@ R_DrawParticles (void)
|
|||
p->vel[i] += p->vel[i] * dvel;
|
||||
p->vel[2] -= grav;
|
||||
break;
|
||||
|
||||
case pt_explode2:
|
||||
p->ramp += time3;
|
||||
if (p->ramp >= 8)
|
||||
|
@ -575,7 +754,6 @@ R_DrawParticles (void)
|
|||
p->vel[i] -= p->vel[i] * frametime;
|
||||
p->vel[2] -= grav;
|
||||
break;
|
||||
|
||||
case pt_blob:
|
||||
for (i = 0; i < 3; i++)
|
||||
p->vel[i] += p->vel[i] * dvel;
|
||||
|
@ -587,7 +765,6 @@ R_DrawParticles (void)
|
|||
p->vel[i] -= p->vel[i] * dvel;
|
||||
p->vel[2] -= grav;
|
||||
break;
|
||||
|
||||
case pt_slowgrav:
|
||||
case pt_grav:
|
||||
p->vel[2] -= grav;
|
||||
|
|
|
@ -607,19 +607,19 @@ CL_RelinkEntities (void)
|
|||
VectorCopy (r_firecolor->vec, dl->color);
|
||||
dl->radius = 200;
|
||||
dl->die = cl.time + 0.1;
|
||||
R_RocketTrail (0, ent);
|
||||
R_RocketTrail (ent);
|
||||
} else if (ent->model->flags & EF_GRENADE)
|
||||
R_RocketTrail (1, ent);
|
||||
R_GrenadeTrail (ent);
|
||||
else if (ent->model->flags & EF_GIB)
|
||||
R_RocketTrail (2, ent);
|
||||
R_BloodTrail (ent);
|
||||
else if (ent->model->flags & EF_ZOMGIB)
|
||||
R_RocketTrail (4, ent);
|
||||
R_SlightBloodTrail (ent);
|
||||
else if (ent->model->flags & EF_TRACER)
|
||||
R_RocketTrail (3, ent);
|
||||
R_GreenTrail (ent);
|
||||
else if (ent->model->flags & EF_TRACER2)
|
||||
R_RocketTrail (5, ent);
|
||||
R_FlameTrail (ent);
|
||||
else if (ent->model->flags & EF_TRACER3)
|
||||
R_RocketTrail (6, ent);
|
||||
R_VoorTrail (ent);
|
||||
|
||||
ent->forcelink = false;
|
||||
|
||||
|
|
|
@ -525,19 +525,19 @@ CL_LinkPacketEntities (void)
|
|||
}
|
||||
|
||||
if (model->flags & EF_ROCKET)
|
||||
R_RocketTrail (0, (*ent));
|
||||
R_RocketTrail (*ent);
|
||||
else if (model->flags & EF_GRENADE)
|
||||
R_RocketTrail (1, (*ent));
|
||||
R_GrenadeTrail (*ent);
|
||||
else if (model->flags & EF_GIB)
|
||||
R_RocketTrail (2, (*ent));
|
||||
R_BloodTrail (*ent);
|
||||
else if (model->flags & EF_ZOMGIB)
|
||||
R_RocketTrail (4, (*ent));
|
||||
R_SlightBloodTrail (*ent);
|
||||
else if (model->flags & EF_TRACER)
|
||||
R_RocketTrail (3, (*ent));
|
||||
R_GreenTrail (*ent);
|
||||
else if (model->flags & EF_TRACER2)
|
||||
R_RocketTrail (5, (*ent));
|
||||
R_FlameTrail (*ent);
|
||||
else if (model->flags & EF_TRACER3)
|
||||
R_RocketTrail (6, (*ent));
|
||||
R_VoorTrail (*ent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue