mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 07:12:36 +00:00
Support negative fadestep for particles
This commit is contained in:
parent
47be9c1e54
commit
205d4b5ff3
2 changed files with 4 additions and 4 deletions
|
@ -1691,7 +1691,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnParticleEx)
|
||||||
PARAM_FLOAT (rollacc)
|
PARAM_FLOAT (rollacc)
|
||||||
|
|
||||||
startalpha = clamp(startalpha, 0., 1.);
|
startalpha = clamp(startalpha, 0., 1.);
|
||||||
if (fadestep > 0) fadestep = clamp(fadestep, 0., 1.);
|
fadestep = clamp(fadestep, -1.0, 1.0);
|
||||||
|
|
||||||
size = fabs(size);
|
size = fabs(size);
|
||||||
if (lifetime != 0)
|
if (lifetime != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -306,10 +306,9 @@ void P_ThinkParticles (FLevelLocals *Level)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto oldtrans = particle->alpha;
|
|
||||||
particle->alpha -= particle->fadestep;
|
particle->alpha -= particle->fadestep;
|
||||||
particle->size += particle->sizestep;
|
particle->size += particle->sizestep;
|
||||||
if (particle->alpha <= 0 || oldtrans < particle->alpha || --particle->ttl <= 0 || (particle->size <= 0))
|
if (particle->alpha <= 0 || --particle->ttl <= 0 || (particle->size <= 0))
|
||||||
{ // The particle has expired, so free it
|
{ // The particle has expired, so free it
|
||||||
*particle = {};
|
*particle = {};
|
||||||
if (prev)
|
if (prev)
|
||||||
|
@ -375,7 +374,7 @@ void P_SpawnParticle(FLevelLocals *Level, const DVector3 &pos, const DVector3 &v
|
||||||
particle->Acc = FVector3(accel);
|
particle->Acc = FVector3(accel);
|
||||||
particle->color = ParticleColor(color);
|
particle->color = ParticleColor(color);
|
||||||
particle->alpha = float(startalpha);
|
particle->alpha = float(startalpha);
|
||||||
if (fadestep < 0) particle->fadestep = FADEFROMTTL(lifetime);
|
if (fadestep <= -1.0) particle->fadestep = FADEFROMTTL(lifetime);
|
||||||
else particle->fadestep = float(fadestep);
|
else particle->fadestep = float(fadestep);
|
||||||
particle->ttl = lifetime;
|
particle->ttl = lifetime;
|
||||||
particle->size = size;
|
particle->size = size;
|
||||||
|
|
Loading…
Reference in a new issue