diff --git a/src/playsim/p_actionfunctions.cpp b/src/playsim/p_actionfunctions.cpp index ed8905b30..ed3e85b0d 100644 --- a/src/playsim/p_actionfunctions.cpp +++ b/src/playsim/p_actionfunctions.cpp @@ -1620,6 +1620,8 @@ enum SPFflag SPF_RELANG = 1 << 4, SPF_NOTIMEFREEZE = 1 << 5, SPF_ROLL = 1 << 6, + SPF_REPLACE = 1 << 7, + SPF_NO_XY_BILLBOARD = 1 << 8, }; DEFINE_ACTION_FUNCTION(AActor, A_SpawnParticle) diff --git a/src/playsim/p_effect.cpp b/src/playsim/p_effect.cpp index 72c6b56a9..a7588d1ba 100644 --- a/src/playsim/p_effect.cpp +++ b/src/playsim/p_effect.cpp @@ -271,7 +271,7 @@ void P_ThinkParticles (FLevelLocals *Level) { particle = &Level->Particles[i]; i = particle->tnext; - if (Level->isFrozen() && !particle->notimefreeze) + if (Level->isFrozen() && !(particle->flags &PT_NOTIMEFREEZE)) { prev = particle; continue; @@ -305,7 +305,7 @@ void P_ThinkParticles (FLevelLocals *Level) particle->Pos.Z += particle->Vel.Z; particle->Vel += particle->Acc; - if(particle->doRoll) + if(particle->flags & PT_DOROLL) { particle->Roll += particle->RollVel; particle->RollVel += particle->RollAcc; @@ -336,10 +336,11 @@ void P_ThinkParticles (FLevelLocals *Level) enum PSFlag { - PS_FULLBRIGHT = 1, - PS_NOTIMEFREEZE = 1 << 5, - PS_ROLL = 1 << 6, - PS_REPLACE = 1 << 7, + PS_FULLBRIGHT = 1, + PS_NOTIMEFREEZE = 1 << 5, + PS_ROLL = 1 << 6, + PS_REPLACE = 1 << 7, + PS_NO_XY_BILLBOARD = 1 << 8, }; void P_SpawnParticle(FLevelLocals *Level, const DVector3 &pos, const DVector3 &vel, const DVector3 &accel, PalEntry color, double startalpha, int lifetime, double size, @@ -360,13 +361,23 @@ void P_SpawnParticle(FLevelLocals *Level, const DVector3 &pos, const DVector3 &v particle->bright = !!(flags & PS_FULLBRIGHT); particle->size = size; particle->sizestep = sizestep; - particle->notimefreeze = !!(flags & PS_NOTIMEFREEZE); particle->texture = texture; particle->style = style; particle->Roll = startroll; particle->RollVel = rollvel; particle->RollAcc = rollacc; - particle->doRoll = !!(flags & PS_ROLL); + if(flags & PS_NOTIMEFREEZE) + { + particle->flags |= PT_NOTIMEFREEZE; + } + if(flags & PS_ROLL) + { + particle->flags |= PT_DOROLL; + } + if(flags & PS_NO_XY_BILLBOARD) + { + particle->flags |= PT_NOXYBILLBOARD; + } } } diff --git a/src/playsim/p_effect.h b/src/playsim/p_effect.h index 11e25f42e..889ffce8e 100644 --- a/src/playsim/p_effect.h +++ b/src/playsim/p_effect.h @@ -50,6 +50,13 @@ struct FLevelLocals; // [RH] Particle details +enum EParticleFlags +{ + PT_NOTIMEFREEZE = 1, + PT_DOROLL = 1 << 1, + PT_NOXYBILLBOARD = 1 << 2, +}; + struct particle_t { DVector3 Pos; @@ -65,7 +72,7 @@ struct particle_t double Roll, RollVel, RollAcc; uint16_t tnext, snext, tprev; uint8_t bright; - bool notimefreeze, doRoll; + uint8_t flags; }; const uint16_t NO_PARTICLE = 0xffff; diff --git a/src/rendering/hwrenderer/scene/hw_sprites.cpp b/src/rendering/hwrenderer/scene/hw_sprites.cpp index 358d9d950..c11878c11 100644 --- a/src/rendering/hwrenderer/scene/hw_sprites.cpp +++ b/src/rendering/hwrenderer/scene/hw_sprites.cpp @@ -382,7 +382,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp) } // [BB] Billboard stuff - const bool drawWithXYBillboard = ((particle && gl_billboard_particles) || (!(actor && actor->renderflags & RF_FORCEYBILLBOARD) + const bool drawWithXYBillboard = ((particle && gl_billboard_particles && !(particle->flags & PT_NOXYBILLBOARD)) || (!(actor && actor->renderflags & RF_FORCEYBILLBOARD) //&& di->mViewActor != nullptr && (gl_billboard_mode == 1 || (actor && actor->renderflags & RF_FORCEXYBILLBOARD)))); @@ -390,7 +390,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp) // [Nash] has +ROLLSPRITE const bool drawRollSpriteActor = (actor != nullptr && actor->renderflags & RF_ROLLSPRITE); - const bool drawRollParticle = (particle != nullptr && particle->doRoll); + const bool drawRollParticle = (particle != nullptr && particle->flags & PT_DOROLL); // [fgsfds] check sprite type mask @@ -402,7 +402,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp) const bool useOffsets = (actor != nullptr) && !(actor->renderflags & RF_ROLLCENTER); // [Nash] check for special sprite drawing modes - if (drawWithXYBillboard || drawBillboardFacingCamera || drawRollSpriteActor || isFlatSprite) + if (drawWithXYBillboard || drawBillboardFacingCamera || drawRollSpriteActor || drawRollParticle || isFlatSprite) { // Compute center of sprite float xcenter = (x1 + x2)*0.5; @@ -1343,7 +1343,7 @@ void HWSprite::ProcessParticle (HWDrawInfo *di, particle_t *particle, sector_t * y = float(particle->Pos.Y) + yvf; z = float(particle->Pos.Z) + zvf; - if(particle->doRoll) + if(particle->flags & PT_DOROLL) { float rvf = (particle->RollVel) * timefrac; Angles.Roll = TAngle::fromDeg(particle->Roll + rvf); diff --git a/wadsrc/static/zscript/constants.zs b/wadsrc/static/zscript/constants.zs index efdfd5d61..9d5bb19aa 100644 --- a/wadsrc/static/zscript/constants.zs +++ b/wadsrc/static/zscript/constants.zs @@ -683,14 +683,15 @@ enum ECheckBlockFlags enum EParticleFlags { - SPF_FULLBRIGHT = 1, - SPF_RELPOS = 1 << 1, - SPF_RELVEL = 1 << 2, - SPF_RELACCEL = 1 << 3, - SPF_RELANG = 1 << 4, - SPF_NOTIMEFREEZE = 1 << 5, - SPF_ROLL = 1 << 6, - SPF_REPLACE = 1 << 7, + SPF_FULLBRIGHT = 1, + SPF_RELPOS = 1 << 1, + SPF_RELVEL = 1 << 2, + SPF_RELACCEL = 1 << 3, + SPF_RELANG = 1 << 4, + SPF_NOTIMEFREEZE = 1 << 5, + SPF_ROLL = 1 << 6, + SPF_REPLACE = 1 << 7, + SPF_NO_XY_BILLBOARD = 1 << 8, SPF_RELATIVE = SPF_RELPOS|SPF_RELVEL|SPF_RELACCEL|SPF_RELANG };