diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 7c031d243c..ca5e417572 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -6048,7 +6048,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) PalEntry color = args[0]; bool fullbright = argCount > 1 ? !!args[1] : false; int lifetime = argCount > 2 ? args[2] : 35; - int size = argCount > 3 ? args[3] : 1; + double size = argCount > 3 ? args[3] : 1.; int x = argCount > 4 ? args[4] : 0; int y = argCount > 5 ? args[5] : 0; int z = argCount > 6 ? args[6] : 0; @@ -6060,17 +6060,18 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) int accelz = argCount > 12 ? args[12] : 0; int startalpha = argCount > 13 ? args[13] : 0xFF; // Byte trans int fadestep = argCount > 14 ? args[14] : -1; + double endsize = argCount > 15 ? args[15] : -1.; startalpha = clamp(startalpha, 0, 255); // Clamp to byte lifetime = clamp(lifetime, 0, 255); // Clamp to byte fadestep = clamp(fadestep, -1, 255); // Clamp to byte inc. -1 (indicating automatic) - size = clamp(size, 0, 65535); // Clamp to word + size = fabs(size); if (lifetime != 0) P_SpawnParticle(DVector3(ACSToDouble(x), ACSToDouble(y), ACSToDouble(z)), DVector3(ACSToDouble(xvel), ACSToDouble(yvel), ACSToDouble(zvel)), DVector3(ACSToDouble(accelx), ACSToDouble(accely), ACSToDouble(accelz)), - color, fullbright, startalpha/255., lifetime, size, fadestep/255.); + color, startalpha/255., lifetime, size, endsize, fadestep/255., fullbright); } break; diff --git a/src/p_effect.cpp b/src/p_effect.cpp index 25838459d1..c678f8defa 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -252,7 +252,6 @@ void P_InitEffects () blood2 = ParticleColor(RPART(kind)/3, GPART(kind)/3, BPART(kind)/3); } - void P_ThinkParticles () { int i; @@ -262,13 +261,19 @@ void P_ThinkParticles () prev = NULL; while (i != NO_PARTICLE) { - BYTE oldtrans; - particle = Particles + i; i = particle->tnext; + + if (!particle->notimefreeze && ((bglobal.freeze) || (level.flags2 & LEVEL2_FROZEN))) + { + continue; + } + + BYTE oldtrans; oldtrans = particle->trans; particle->trans -= particle->fade; - if (oldtrans < particle->trans || --particle->ttl == 0) + particle->size += particle->sizestep; + if (oldtrans < particle->trans || --particle->ttl <= 0 || (particle->size <= 0)) { // The particle has expired, so free it memset (particle, 0, sizeof(particle_t)); if (prev) @@ -309,8 +314,14 @@ void P_ThinkParticles () } } +enum PSFlag +{ + PS_FULLBRIGHT = 1, + PS_NOTIMEFREEZE = 1 << 5, +}; -void P_SpawnParticle(const DVector3 &pos, const DVector3 &vel, const DVector3 &accel, PalEntry color, bool fullbright, double startalpha, int lifetime, WORD size, double fadestep) +void P_SpawnParticle(const DVector3 &pos, const DVector3 &vel, const DVector3 &accel, PalEntry color, double startalpha, int lifetime, double size, + double fadestep, double endsize, int flags) { particle_t *particle = NewParticle(); @@ -324,8 +335,10 @@ void P_SpawnParticle(const DVector3 &pos, const DVector3 &vel, const DVector3 &a if (fadestep < 0) particle->fade = FADEFROMTTL(lifetime); else particle->fade = int(fadestep * 255); particle->ttl = lifetime; - particle->bright = fullbright; - particle->size = (WORD)size; + particle->bright = !!(flags & PS_FULLBRIGHT); + particle->size = size; + particle->sizestep = (lifetime == 0) ? 0 : ((endsize - size) / lifetime); + particle->notimefreeze = !!(flags & PS_NOTIMEFREEZE); } } diff --git a/src/p_effect.h b/src/p_effect.h index 033bf042c9..2414372c3f 100644 --- a/src/p_effect.h +++ b/src/p_effect.h @@ -59,13 +59,15 @@ struct particle_t DVector3 Acc; BYTE ttl; BYTE trans; - WORD size; + double size; + double sizestep; BYTE bright; BYTE fade; int color; WORD tnext; WORD snext; subsector_t * subsector; + bool notimefreeze; }; extern particle_t *Particles; @@ -83,7 +85,7 @@ particle_t *JitterParticle (int ttl); particle_t *JitterParticle (int ttl, double drift); void P_ThinkParticles (void); -void P_SpawnParticle(const DVector3 &pos, const DVector3 &vel, const DVector3 &accel, PalEntry color, bool fullbright, double startalpha, int lifetime, WORD size, double fadestep); +void P_SpawnParticle(const DVector3 &pos, const DVector3 &vel, const DVector3 &accel, PalEntry color, double startalpha, int lifetime, double size, double fadestep, double endsize, int flags = 0); void P_InitEffects (void); void P_RunEffects (void); diff --git a/src/p_tick.cpp b/src/p_tick.cpp index 032aa8bf55..f0f1e2ea89 100644 --- a/src/p_tick.cpp +++ b/src/p_tick.cpp @@ -117,10 +117,7 @@ void P_Ticker (void) // Since things will be moving, it's okay to interpolate them in the renderer. r_NoInterpolate = false; - if (!bglobal.freeze && !(level.flags2 & LEVEL2_FROZEN)) - { - P_ThinkParticles (); // [RH] make the particles think - } + P_ThinkParticles(); // [RH] make the particles think for (i = 0; i 0) fadestep = clamp(fadestep, 0., 1.); - size = clamp(size, 0, 65535); // Clamp to word - + size = fabs(size); if (lifetime != 0) { if (flags & SPF_RELANG) angle += self->Angles.Yaw; @@ -3199,7 +3200,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnParticle) acc.X = accelx * c + accely * s; acc.Y = accelx * s - accely * c; } - P_SpawnParticle(self->Vec3Offset(pos), vel, acc, color, !!(flags & SPF_FULLBRIGHT), startalpha, lifetime, size, fadestep); + P_SpawnParticle(self->Vec3Offset(pos), vel, acc, color, startalpha, lifetime, size, fadestep, endsize, flags); } return 0; } diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index cc0569fff8..6606f8a49f 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -214,7 +214,7 @@ ACTOR Actor native //: Thinker native void A_SetScale(float scalex, float scaley = 0, int ptr = AAPTR_DEFAULT, bool usezero = false); native void A_SetMass(int mass); native void A_SpawnDebris(class spawntype, bool transfer_translation = false, float mult_h = 1, float mult_v = 1); - native void A_SpawnParticle(color color1, int flags = 0, int lifetime = 35, int size = 1, float angle = 0, float xoff = 0, float yoff = 0, float zoff = 0, float velx = 0, float vely = 0, float velz = 0, float accelx = 0, float accely = 0, float accelz = 0, float startalphaf = 1, float fadestepf = -1); + native void A_SpawnParticle(color color1, int flags = 0, int lifetime = 35, float size = 1, float angle = 0, float xoff = 0, float yoff = 0, float zoff = 0, float velx = 0, float vely = 0, float velz = 0, float accelx = 0, float accely = 0, float accelz = 0, float startalphaf = 1, float fadestepf = -1, float endsize = -1); native state A_CheckSight(state label); native void A_ExtChase(bool usemelee, bool usemissile, bool playactive = true, bool nightmarefast = false); native void A_DropInventory(class itemtype); diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index 911e1036bd..f5072d55eb 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -539,6 +539,7 @@ enum SPF_RELVEL = 1 << 2, SPF_RELACCEL = 1 << 3, SPF_RELANG = 1 << 4, + SPF_NOTIMEFREEZE = 1 << 5, SPF_RELATIVE = SPF_RELPOS|SPF_RELVEL|SPF_RELACCEL|SPF_RELANG };