mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
Particle Rolling
This commit is contained in:
parent
b6202ffc4c
commit
7d81417829
6 changed files with 35 additions and 6 deletions
|
@ -1619,6 +1619,7 @@ enum SPFflag
|
|||
SPF_RELACCEL = 1 << 3,
|
||||
SPF_RELANG = 1 << 4,
|
||||
SPF_NOTIMEFREEZE = 1 << 5,
|
||||
SPF_ROLL = 1 << 6,
|
||||
};
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_SpawnParticle)
|
||||
|
@ -1698,6 +1699,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnParticleEx)
|
|||
PARAM_FLOAT (startalpha)
|
||||
PARAM_FLOAT (fadestep)
|
||||
PARAM_FLOAT (sizestep)
|
||||
PARAM_FLOAT (startroll)
|
||||
PARAM_FLOAT (rollvel)
|
||||
PARAM_FLOAT (rollacc)
|
||||
|
||||
startalpha = clamp(startalpha, 0., 1.);
|
||||
if (fadestep > 0) fadestep = clamp(fadestep, 0., 1.);
|
||||
|
@ -1737,7 +1741,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnParticleEx)
|
|||
style = STYLE_None;
|
||||
}
|
||||
|
||||
P_SpawnParticle(self->Level, self->Vec3Offset(pos), vel, acc, color, startalpha, lifetime, size, fadestep, sizestep, flags, texid, ERenderStyle(style));
|
||||
P_SpawnParticle(self->Level, self->Vec3Offset(pos), vel, acc, color, startalpha, lifetime, size, fadestep, sizestep, flags, texid, ERenderStyle(style), startroll, rollvel, rollacc);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -248,6 +248,13 @@ void P_ThinkParticles (FLevelLocals *Level)
|
|||
particle->Pos.Y = newxy.Y;
|
||||
particle->Pos.Z += particle->Vel.Z;
|
||||
particle->Vel += particle->Acc;
|
||||
|
||||
if(particle->doRoll)
|
||||
{
|
||||
particle->Roll += particle->RollVel;
|
||||
particle->RollVel += particle->RollAcc;
|
||||
}
|
||||
|
||||
particle->subsector = Level->PointInRenderSubsector(particle->Pos);
|
||||
sector_t *s = particle->subsector->sector;
|
||||
// Handle crossing a sector portal.
|
||||
|
@ -275,10 +282,11 @@ enum PSFlag
|
|||
{
|
||||
PS_FULLBRIGHT = 1,
|
||||
PS_NOTIMEFREEZE = 1 << 5,
|
||||
PS_ROLL = 1 << 6,
|
||||
};
|
||||
|
||||
void P_SpawnParticle(FLevelLocals *Level, const DVector3 &pos, const DVector3 &vel, const DVector3 &accel, PalEntry color, double startalpha, int lifetime, double size,
|
||||
double fadestep, double sizestep, int flags, FTextureID texture, ERenderStyle style)
|
||||
double fadestep, double sizestep, int flags, FTextureID texture, ERenderStyle style, double startroll, double rollvel, double rollacc)
|
||||
{
|
||||
particle_t *particle = NewParticle(Level);
|
||||
|
||||
|
@ -298,6 +306,10 @@ void P_SpawnParticle(FLevelLocals *Level, const DVector3 &pos, const DVector3 &v
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,10 @@ struct particle_t
|
|||
uint16_t snext;
|
||||
FTextureID texture;
|
||||
ERenderStyle style;
|
||||
double Roll;
|
||||
double RollVel;
|
||||
double RollAcc;
|
||||
bool doRoll;
|
||||
};
|
||||
|
||||
const uint16_t NO_PARTICLE = 0xffff;
|
||||
|
@ -83,7 +87,7 @@ particle_t *JitterParticle (FLevelLocals *Level, int ttl);
|
|||
particle_t *JitterParticle (FLevelLocals *Level, int ttl, double drift);
|
||||
|
||||
void P_ThinkParticles (FLevelLocals *Level);
|
||||
void P_SpawnParticle(FLevelLocals *Level, const DVector3 &pos, const DVector3 &vel, const DVector3 &accel, PalEntry color, double startalpha, int lifetime, double size, double fadestep, double sizestep, int flags = 0, FTextureID texture = FNullTextureID(), ERenderStyle style = STYLE_None);
|
||||
void P_SpawnParticle(FLevelLocals *Level, const DVector3 &pos, const DVector3 &vel, const DVector3 &accel, PalEntry color, double startalpha, int lifetime, double size, double fadestep, double sizestep, int flags = 0, FTextureID texture = FNullTextureID(), ERenderStyle style = STYLE_None, double startroll = 0, double rollvel = 0, double rollacc = 0);
|
||||
void P_InitEffects (void);
|
||||
|
||||
void P_RunEffect (AActor *actor, int effects);
|
||||
|
|
|
@ -390,6 +390,8 @@ 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);
|
||||
|
||||
|
||||
// [fgsfds] check sprite type mask
|
||||
uint32_t spritetype = (uint32_t)-1;
|
||||
|
@ -430,7 +432,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp)
|
|||
// [fgsfds] calculate yaw vectors
|
||||
float yawvecX = 0, yawvecY = 0, rollDegrees = 0;
|
||||
float angleRad = (FAngle::fromDeg(270.) - HWAngles.Yaw).Radians();
|
||||
if (actor) rollDegrees = Angles.Roll.Degrees();
|
||||
if (actor || drawRollParticle) rollDegrees = Angles.Roll.Degrees();
|
||||
if (isFlatSprite)
|
||||
{
|
||||
yawvecX = Angles.Yaw.Cos();
|
||||
|
@ -448,7 +450,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp)
|
|||
if (useOffsets) mat.Translate(-xx, -zz, -yy);
|
||||
}
|
||||
}
|
||||
else if (drawRollSpriteActor)
|
||||
else if (drawRollSpriteActor || drawRollParticle)
|
||||
{
|
||||
if (useOffsets) mat.Translate(xx, zz, yy);
|
||||
if (drawWithXYBillboard)
|
||||
|
@ -1340,6 +1342,12 @@ void HWSprite::ProcessParticle (HWDrawInfo *di, particle_t *particle, sector_t *
|
|||
x = float(particle->Pos.X) + xvf;
|
||||
y = float(particle->Pos.Y) + yvf;
|
||||
z = float(particle->Pos.Z) + zvf;
|
||||
|
||||
if(particle->doRoll)
|
||||
{
|
||||
float rvf = (particle->RollVel) * timefrac;
|
||||
Angles.Roll = TAngle<double>::fromDeg(particle->Roll + rvf);
|
||||
}
|
||||
|
||||
float factor;
|
||||
if (particle_style == 1) factor = 1.3f / 7.f;
|
||||
|
|
|
@ -1128,7 +1128,7 @@ class Actor : Thinker native
|
|||
native void A_FadeTo(double target, double amount = 0.1, int flags = 0);
|
||||
native void A_SpawnDebris(class<Actor> spawntype, bool transfer_translation = false, double mult_h = 1, double mult_v = 1);
|
||||
native void A_SpawnParticle(color color1, int flags = 0, int lifetime = TICRATE, double size = 1, double angle = 0, double xoff = 0, double yoff = 0, double zoff = 0, double velx = 0, double vely = 0, double velz = 0, double accelx = 0, double accely = 0, double accelz = 0, double startalphaf = 1, double fadestepf = -1, double sizestep = 0);
|
||||
native void A_SpawnParticleEx(color color1, TextureID texture, int style = STYLE_None, int flags = 0, int lifetime = TICRATE, double size = 1, double angle = 0, double xoff = 0, double yoff = 0, double zoff = 0, double velx = 0, double vely = 0, double velz = 0, double accelx = 0, double accely = 0, double accelz = 0, double startalphaf = 1, double fadestepf = -1, double sizestep = 0);
|
||||
native void A_SpawnParticleEx(color color1, TextureID texture, int style = STYLE_None, int flags = 0, int lifetime = TICRATE, double size = 1, double angle = 0, double xoff = 0, double yoff = 0, double zoff = 0, double velx = 0, double vely = 0, double velz = 0, double accelx = 0, double accely = 0, double accelz = 0, double startalphaf = 1, double fadestepf = -1, double sizestep = 0, double startroll = 0, double rollvel = 0, double rollacc = 0);
|
||||
native void A_ExtChase(bool usemelee, bool usemissile, bool playactive = true, bool nightmarefast = false);
|
||||
native void A_DropInventory(class<Inventory> itemtype, int amount = -1);
|
||||
native void A_SetBlend(color color1, double alpha, int tics, color color2 = 0, double alpha2 = 0.);
|
||||
|
|
|
@ -689,6 +689,7 @@ enum EParticleFlags
|
|||
SPF_RELACCEL = 1 << 3,
|
||||
SPF_RELANG = 1 << 4,
|
||||
SPF_NOTIMEFREEZE = 1 << 5,
|
||||
SPF_ROLL = 1 << 6,
|
||||
|
||||
SPF_RELATIVE = SPF_RELPOS|SPF_RELVEL|SPF_RELACCEL|SPF_RELANG
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue