"die 0" case for particles/beams fix
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@361 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
11dc6c828c
commit
fc20b7cb95
3 changed files with 82 additions and 17 deletions
|
@ -1743,10 +1743,8 @@ void CL_UpdateBeams (void)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
// if (part_type[rt_lightning1].loaded)
|
// if (part_type[rt_lightning1].loaded)
|
||||||
{
|
if (!R_RocketTrail(b->start, b->end, rt_lightning1, NULL))
|
||||||
R_RocketTrail(b->start, b->end, rt_lightning1, NULL);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
// add new entities for the lightning
|
// add new entities for the lightning
|
||||||
VectorCopy (b->start, org);
|
VectorCopy (b->start, org);
|
||||||
|
|
|
@ -1513,7 +1513,10 @@ int R_RunParticleEffectType (vec3_t org, vec3_t dir, float count, int typenum)
|
||||||
|
|
||||||
p->die = ptype->randdie*frandom();
|
p->die = ptype->randdie*frandom();
|
||||||
p->scale = ptype->scale+ptype->randscale*frandom();
|
p->scale = ptype->scale+ptype->randscale*frandom();
|
||||||
p->alpha = ptype->alpha-p->die*(ptype->alpha/ptype->die)*ptype->alphachange;
|
if (ptype->die)
|
||||||
|
p->alpha = ptype->alpha-p->die*(ptype->alpha/ptype->die)*ptype->alphachange;
|
||||||
|
else
|
||||||
|
p->alpha = ptype->alpha;
|
||||||
p->color = 0;
|
p->color = 0;
|
||||||
p->nextemit = particletime + ptype->emitstart - p->die;
|
p->nextemit = particletime + ptype->emitstart - p->die;
|
||||||
|
|
||||||
|
@ -1587,7 +1590,10 @@ int R_RunParticleEffectType (vec3_t org, vec3_t dir, float count, int typenum)
|
||||||
|
|
||||||
p->die = ptype->randdie*frandom();
|
p->die = ptype->randdie*frandom();
|
||||||
p->scale = ptype->scale+ptype->randscale*frandom();
|
p->scale = ptype->scale+ptype->randscale*frandom();
|
||||||
p->alpha = ptype->alpha-p->die*(ptype->alpha/ptype->die)*ptype->alphachange;
|
if (ptype->die)
|
||||||
|
p->alpha = ptype->alpha-p->die*(ptype->alpha/ptype->die)*ptype->alphachange;
|
||||||
|
else
|
||||||
|
p->alpha = ptype->alpha;
|
||||||
p->color = 0;
|
p->color = 0;
|
||||||
p->nextemit = particletime + ptype->emitstart - p->die;
|
p->nextemit = particletime + ptype->emitstart - p->die;
|
||||||
|
|
||||||
|
@ -1680,7 +1686,10 @@ int R_RunParticleEffectType (vec3_t org, vec3_t dir, float count, int typenum)
|
||||||
|
|
||||||
p->die = ptype->randdie*frandom();
|
p->die = ptype->randdie*frandom();
|
||||||
p->scale = ptype->scale+ptype->randscale*frandom();
|
p->scale = ptype->scale+ptype->randscale*frandom();
|
||||||
p->alpha = ptype->alpha-p->die*(ptype->alpha/ptype->die)*ptype->alphachange;
|
if (ptype->die)
|
||||||
|
p->alpha = ptype->alpha-p->die*(ptype->alpha/ptype->die)*ptype->alphachange;
|
||||||
|
else
|
||||||
|
p->alpha = ptype->alpha;
|
||||||
p->color = 0;
|
p->color = 0;
|
||||||
p->nextemit = particletime + ptype->emitstart - p->die;
|
p->nextemit = particletime + ptype->emitstart - p->die;
|
||||||
|
|
||||||
|
@ -1772,7 +1781,10 @@ int R_RunParticleEffectType (vec3_t org, vec3_t dir, float count, int typenum)
|
||||||
|
|
||||||
p->die = ptype->randdie*frandom();
|
p->die = ptype->randdie*frandom();
|
||||||
p->scale = ptype->scale+ptype->randscale*frandom();
|
p->scale = ptype->scale+ptype->randscale*frandom();
|
||||||
p->alpha = ptype->alpha-p->die*(ptype->alpha/ptype->die)*ptype->alphachange;
|
if (ptype->die)
|
||||||
|
p->alpha = ptype->alpha-p->die*(ptype->alpha/ptype->die)*ptype->alphachange;
|
||||||
|
else
|
||||||
|
p->alpha = ptype->alpha;
|
||||||
p->color = 0;
|
p->color = 0;
|
||||||
p->nextemit = particletime + ptype->emitstart - p->die;
|
p->nextemit = particletime + ptype->emitstart - p->die;
|
||||||
|
|
||||||
|
@ -2043,12 +2055,10 @@ void MakeNormalVectors (vec3_t forward, vec3_t right, vec3_t up)
|
||||||
|
|
||||||
void CLQ2_RailTrail (vec3_t start, vec3_t end)
|
void CLQ2_RailTrail (vec3_t start, vec3_t end)
|
||||||
{
|
{
|
||||||
trailstate_t ts;
|
R_RocketTrail(start, end, rt_railtrail, NULL);
|
||||||
memset(&ts, 0, sizeof(ts));
|
|
||||||
R_RocketTrail(start, end, rt_railtrail, &ts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts)
|
int R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts)
|
||||||
{
|
{
|
||||||
vec3_t vec, right, up;
|
vec3_t vec, right, up;
|
||||||
float len;
|
float len;
|
||||||
|
@ -2064,7 +2074,7 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts)
|
||||||
float stop;
|
float stop;
|
||||||
|
|
||||||
if (!ptype->loaded)
|
if (!ptype->loaded)
|
||||||
return;
|
return 1;
|
||||||
|
|
||||||
if (ptype->assoc>=0)
|
if (ptype->assoc>=0)
|
||||||
{
|
{
|
||||||
|
@ -2077,7 +2087,10 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
R_RocketTrail(vec, end, ptype->assoc, NULL);
|
R_RocketTrail(vec, end, ptype->assoc, NULL);
|
||||||
}
|
}
|
||||||
|
else if (!ptype->die)
|
||||||
|
ts = NULL;
|
||||||
|
|
||||||
step = 1/ptype->count;
|
step = 1/ptype->count;
|
||||||
|
|
||||||
if (step < 0.01)
|
if (step < 0.01)
|
||||||
|
@ -2113,7 +2126,6 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts)
|
||||||
// len = (len - (int)len)*step;
|
// len = (len - (int)len)*step;
|
||||||
// VectorMA (start, -len, vec, start);
|
// VectorMA (start, -len, vec, start);
|
||||||
|
|
||||||
|
|
||||||
b = bfirst = NULL;
|
b = bfirst = NULL;
|
||||||
|
|
||||||
while (len < stop)
|
while (len < stop)
|
||||||
|
@ -2157,7 +2169,10 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts)
|
||||||
|
|
||||||
p->die = ptype->randdie*frandom();
|
p->die = ptype->randdie*frandom();
|
||||||
p->scale = ptype->scale+ptype->randscale*frandom();
|
p->scale = ptype->scale+ptype->randscale*frandom();
|
||||||
p->alpha = ptype->alpha-p->die*(ptype->alpha/ptype->die)*ptype->alphachange;
|
if (ptype->die)
|
||||||
|
p->alpha = ptype->alpha-p->die*(ptype->alpha/ptype->die)*ptype->alphachange;
|
||||||
|
else
|
||||||
|
p->alpha = ptype->alpha;
|
||||||
p->color = 0;
|
p->color = 0;
|
||||||
|
|
||||||
if (ptype->spawnmode == SM_TRACER)
|
if (ptype->spawnmode == SM_TRACER)
|
||||||
|
@ -2313,7 +2328,8 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return; //distance the trail actually moved.
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_TorchEffect (vec3_t pos, int type)
|
void R_TorchEffect (vec3_t pos, int type)
|
||||||
|
@ -2884,6 +2900,57 @@ void DrawParticleTypes (void texturedparticles(particle_t *,part_type_t*), void
|
||||||
if (!kill_first) // branch here is probably faster than list traversal later
|
if (!kill_first) // branch here is probably faster than list traversal later
|
||||||
kill_first = p;
|
kill_first = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type->beams)
|
||||||
|
{
|
||||||
|
b = type->beams;
|
||||||
|
}
|
||||||
|
|
||||||
|
while ((b=type->beams) && (b->flags & BS_DEAD))
|
||||||
|
{
|
||||||
|
type->beams = b->next;
|
||||||
|
b->next = free_beams;
|
||||||
|
free_beams = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (b)
|
||||||
|
{
|
||||||
|
if (!(b->flags & BS_NODRAW))
|
||||||
|
{
|
||||||
|
// no BS_NODRAW implies b->next != NULL
|
||||||
|
// BS_NODRAW should imply b->next == NULL or b->next->flags & BS_DEAD
|
||||||
|
VectorCopy(b->next->p->org, stop);
|
||||||
|
VectorCopy(b->p->org, oldorg);
|
||||||
|
VectorSubtract(stop, oldorg, b->next->dir);
|
||||||
|
VectorNormalize(b->next->dir);
|
||||||
|
VectorAdd(stop, oldorg, stop);
|
||||||
|
VectorScale(stop, 0.5, stop);
|
||||||
|
|
||||||
|
if (*type->texname)
|
||||||
|
RQ_AddDistReorder((void*)beamparticlest, b, type, stop);
|
||||||
|
else
|
||||||
|
RQ_AddDistReorder((void*)beamparticlesut, b, type, stop);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// clean up dead entries ahead of current
|
||||||
|
for ( ;; )
|
||||||
|
{
|
||||||
|
bkill = b->next;
|
||||||
|
if (bkill && (bkill->flags & BS_DEAD))
|
||||||
|
{
|
||||||
|
b->next = bkill->next;
|
||||||
|
bkill->next = free_beams;
|
||||||
|
free_beams = bkill;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
b->flags |= BS_DEAD;
|
||||||
|
b = b->next;
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,7 @@ typedef struct {
|
||||||
float lastdist;
|
float lastdist;
|
||||||
struct beamseg_s *lastbeam; // last beam point
|
struct beamseg_s *lastbeam; // last beam point
|
||||||
} trailstate_t;
|
} trailstate_t;
|
||||||
void R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *oldpoint);
|
int R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *oldpoint);
|
||||||
int R_RunParticleEffectType(vec3_t org, vec3_t dir, float count, int type);
|
int R_RunParticleEffectType(vec3_t org, vec3_t dir, float count, int type);
|
||||||
void R_RunParticleEffect2 (vec3_t org, vec3_t dmin, vec3_t dmax, int color, int effect, int count);
|
void R_RunParticleEffect2 (vec3_t org, vec3_t dmin, vec3_t dmax, int color, int effect, int count);
|
||||||
void R_RunParticleEffect3 (vec3_t org, vec3_t box, int color, int effect, int count);
|
void R_RunParticleEffect3 (vec3_t org, vec3_t box, int color, int effect, int count);
|
||||||
|
|
Loading…
Reference in a new issue