Structified A_SpawnParticle/Ex

This commit is contained in:
Ricardo Luís Vaz Silva 2022-11-11 11:02:01 -03:00 committed by Christoph Oelckers
parent 9ad7b8a048
commit cd46f97dcc
4 changed files with 88 additions and 1 deletions

View file

@ -88,7 +88,32 @@ particle_t *JitterParticle (FLevelLocals *Level, int ttl);
particle_t *JitterParticle (FLevelLocals *Level, int ttl, double drift);
void P_ThinkParticles (FLevelLocals *Level);
struct FSpawnParticleParams
{
int color;
FTextureID texture;
int style;
int flags;
int lifetime;
double size;
double sizestep;
DVector3 pos;
DVector3 vel;
DVector3 accel;
double startalpha;
double fadestep;
double startroll;
double rollvel;
double rollacc;
};
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);
@ -104,3 +129,4 @@ void P_DrawRailTrail(AActor *source, TArray<SPortalHit> &portalhits, int color1,
void P_DrawSplash (FLevelLocals *Level, int count, const DVector3 &pos, DAngle angle, int kind);
void P_DrawSplash2 (FLevelLocals *Level, int count, const DVector3 &pos, DAngle angle, int updown, int kind);
void P_DisconnectEffect (AActor *actor);

View file

@ -782,6 +782,10 @@ void InitThingdef()
auto fltd = NewStruct("FLineTraceData", nullptr);
fltd->Size = sizeof(FLineTraceData);
fltd->Align = alignof(FLineTraceData);
auto fspp = NewStruct("FSpawnParticleParams", nullptr);
fspp->Size = sizeof(FSpawnParticleParams);
fspp->Align = alignof(FSpawnParticleParams);
}
void SynthesizeFlagFields()

View file

@ -2090,3 +2090,36 @@ DEFINE_FIELD_X(FLineTraceData, FLineTraceData, LineSide);
DEFINE_FIELD_X(FLineTraceData, FLineTraceData, LinePart);
DEFINE_FIELD_X(FLineTraceData, FLineTraceData, SectorPlane);
DEFINE_FIELD_X(FLineTraceData, FLineTraceData, HitType);
DEFINE_FIELD_NAMED_X(FSpawnParticleParams, FSpawnParticleParams, color, color1);
DEFINE_FIELD_X(FSpawnParticleParams, FSpawnParticleParams, texture);
DEFINE_FIELD_X(FSpawnParticleParams, FSpawnParticleParams, style);
DEFINE_FIELD_X(FSpawnParticleParams, FSpawnParticleParams, flags);
DEFINE_FIELD_X(FSpawnParticleParams, FSpawnParticleParams, lifetime);
DEFINE_FIELD_X(FSpawnParticleParams, FSpawnParticleParams, size);
DEFINE_FIELD_X(FSpawnParticleParams, FSpawnParticleParams, sizestep);
DEFINE_FIELD_X(FSpawnParticleParams, FSpawnParticleParams, pos);
DEFINE_FIELD_X(FSpawnParticleParams, FSpawnParticleParams, vel);
DEFINE_FIELD_X(FSpawnParticleParams, FSpawnParticleParams, accel);
DEFINE_FIELD_X(FSpawnParticleParams, FSpawnParticleParams, startalpha);
DEFINE_FIELD_X(FSpawnParticleParams, FSpawnParticleParams, fadestep);
DEFINE_FIELD_X(FSpawnParticleParams, FSpawnParticleParams, startroll);
DEFINE_FIELD_X(FSpawnParticleParams, FSpawnParticleParams, rollvel);
DEFINE_FIELD_X(FSpawnParticleParams, FSpawnParticleParams, rollacc);
static void SpawnParticle(FLevelLocals *Level, FSpawnParticleParams *params)
{
P_SpawnParticle(Level, params->pos, params->vel, params->accel,
params->color, params->startalpha, params->lifetime,
params->size, params->fadestep, params->sizestep,
params->flags, params->texture, ERenderStyle(params->style),
params->startroll, params->rollvel, params->rollacc);
}
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, SpawnParticle, SpawnParticle)
{
PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
PARAM_POINTER(p, FSpawnParticleParams);
SpawnParticle(self, p);
return 0;
}

View file

@ -369,6 +369,29 @@ struct LevelInfo native
native static String MapChecksum(String mapname);
}
struct FSpawnParticleParams
{
native Color color1;
native TextureID texture;
native int style;
native int flags;
native int lifetime;
native double size;
native double sizestep;
native Vector3 pos;
native Vector3 vel;
native Vector3 accel;
native double startalpha;
native double fadestep;
native double startroll;
native double rollvel;
native double rollacc;
};
struct LevelLocals native
{
enum EUDMF
@ -517,6 +540,8 @@ struct LevelLocals native
native String GetClusterName();
native String GetEpisodeName();
native void SpawnParticle(FSpawnParticleParams p);
}
// a few values of this need to be readable by the play code.
@ -756,4 +781,3 @@ struct FRailParams
native int SpiralOffset;
native int limit;
}; // [RH] Shoot a railgun