mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- added Xaser's modified version of kgsws's railgun enhancements patch.
SVN r3529 (trunk)
This commit is contained in:
parent
3aa759714a
commit
34820aacd2
9 changed files with 74 additions and 28 deletions
|
@ -310,11 +310,16 @@ void P_RunEffects ()
|
|||
}
|
||||
|
||||
//
|
||||
// AddParticle
|
||||
// JitterParticle
|
||||
//
|
||||
// Creates a particle with "jitter"
|
||||
//
|
||||
particle_t *JitterParticle (int ttl)
|
||||
{
|
||||
return JitterParticle (ttl, 1.0);
|
||||
}
|
||||
// [XA] Added "drift speed" multiplier setting for enhanced railgun stuffs.
|
||||
particle_t *JitterParticle (int ttl, float drift)
|
||||
{
|
||||
particle_t *particle = NewParticle ();
|
||||
|
||||
|
@ -324,10 +329,10 @@ particle_t *JitterParticle (int ttl)
|
|||
|
||||
// Set initial velocities
|
||||
for (i = 3; i; i--, val++)
|
||||
*val = (FRACUNIT/4096) * (M_Random () - 128);
|
||||
*val = (int)((FRACUNIT/4096) * (M_Random () - 128) * drift);
|
||||
// Set initial accelerations
|
||||
for (i = 3; i; i--, val++)
|
||||
*val = (FRACUNIT/16384) * (M_Random () - 128);
|
||||
*val = (int)((FRACUNIT/16384) * (M_Random () - 128) * drift);
|
||||
|
||||
particle->trans = 255; // fully opaque
|
||||
particle->ttl = ttl;
|
||||
|
@ -580,7 +585,7 @@ void P_DrawSplash2 (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, i
|
|||
}
|
||||
}
|
||||
|
||||
void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end, int color1, int color2, float maxdiff, bool silent)
|
||||
void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end, int color1, int color2, float maxdiff, bool silent, const PClass *spawnclass, angle_t angle, bool fullbright, int duration, float sparsity, float drift)
|
||||
{
|
||||
double length, lengthsquared;
|
||||
int steps, i;
|
||||
|
@ -663,10 +668,10 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end
|
|||
step = dir * 3;
|
||||
|
||||
// Create the outer spiral.
|
||||
if (color1 != -1 && (!r_rail_smartspiral || color2 == -1) && r_rail_spiralsparsity > 0)
|
||||
if (color1 != -1 && (!r_rail_smartspiral || color2 == -1) && r_rail_spiralsparsity > 0 && (spawnclass == NULL))
|
||||
{
|
||||
FVector3 spiral_step = step * r_rail_spiralsparsity;
|
||||
int spiral_steps = steps * r_rail_spiralsparsity;
|
||||
FVector3 spiral_step = step * r_rail_spiralsparsity * sparsity;
|
||||
int spiral_steps = (int)(steps * r_rail_spiralsparsity / sparsity);
|
||||
|
||||
color1 = color1 == 0 ? -1 : ParticleColor(color1);
|
||||
pos = start;
|
||||
|
@ -680,14 +685,16 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end
|
|||
return;
|
||||
|
||||
p->trans = 255;
|
||||
p->ttl = 35;
|
||||
p->fade = FADEFROMTTL(35);
|
||||
p->ttl = duration;
|
||||
p->fade = FADEFROMTTL(duration);
|
||||
p->size = 3;
|
||||
if(fullbright)
|
||||
p->bright = true;
|
||||
|
||||
tempvec = FMatrix3x3(dir, deg) * extend;
|
||||
p->velx = FLOAT2FIXED(tempvec.X)>>4;
|
||||
p->vely = FLOAT2FIXED(tempvec.Y)>>4;
|
||||
p->velz = FLOAT2FIXED(tempvec.Z)>>4;
|
||||
p->velx = FLOAT2FIXED(tempvec.X * drift)>>4;
|
||||
p->vely = FLOAT2FIXED(tempvec.Y * drift)>>4;
|
||||
p->velz = FLOAT2FIXED(tempvec.Z * drift)>>4;
|
||||
tempvec += pos;
|
||||
p->x = FLOAT2FIXED(tempvec.X);
|
||||
p->y = FLOAT2FIXED(tempvec.Y);
|
||||
|
@ -770,6 +777,21 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end
|
|||
}
|
||||
}
|
||||
}
|
||||
// create actors
|
||||
if(spawnclass != NULL) {
|
||||
if(sparsity < 1) sparsity = 32;
|
||||
|
||||
FVector3 trail_step = (step / 3) * sparsity;
|
||||
int trail_steps = (int)((steps * 3) / sparsity);
|
||||
|
||||
pos = start;
|
||||
for (i = trail_steps; i; i--)
|
||||
{
|
||||
AActor *thing = Spawn (spawnclass, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), FLOAT2FIXED(pos.Z), ALLOW_REPLACE);
|
||||
if(thing) thing->angle = angle;
|
||||
pos += trail_step;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void P_DisconnectEffect (AActor *actor)
|
||||
|
|
|
@ -65,6 +65,7 @@ struct particle_t
|
|||
WORD tnext;
|
||||
WORD snext;
|
||||
subsector_t * subsector;
|
||||
bool bright;
|
||||
};
|
||||
|
||||
extern particle_t *Particles;
|
||||
|
@ -79,6 +80,7 @@ void P_FindParticleSubsectors ();
|
|||
class AActor;
|
||||
|
||||
particle_t *JitterParticle (int ttl);
|
||||
particle_t *JitterParticle (int ttl, float drift);
|
||||
|
||||
void P_ThinkParticles (void);
|
||||
void P_InitEffects (void);
|
||||
|
@ -86,7 +88,7 @@ void P_RunEffects (void);
|
|||
|
||||
void P_RunEffect (AActor *actor, int effects);
|
||||
|
||||
void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end, int color1, int color2, float maxdiff = 0, bool silent = false);
|
||||
void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end, int color1, int color2, float maxdiff = 0, bool silent = false, const PClass *spawnclass = NULL, angle_t angle = 0, bool fullbright = false, int duration = 35, float sparsity = 1.0, float drift = 1.0);
|
||||
void P_DrawSplash (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, int kind);
|
||||
void P_DrawSplash2 (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, int updown, int kind);
|
||||
void P_DisconnectEffect (AActor *actor);
|
||||
|
|
|
@ -453,10 +453,11 @@ void P_TraceBleed (int damage, fixed_t x, fixed_t y, fixed_t z, AActor *target,
|
|||
void P_TraceBleed (int damage, AActor *target, angle_t angle, int pitch);
|
||||
void P_TraceBleed (int damage, AActor *target, AActor *missile); // missile version
|
||||
void P_TraceBleed (int damage, AActor *target); // random direction version
|
||||
void P_RailAttack (AActor *source, int damage, int offset, int color1 = 0, int color2 = 0, float maxdiff = 0, bool silent = false, const PClass *puff = NULL, bool pierce = true, angle_t angleoffset = 0, angle_t pitchoffset = 0); // [RH] Shoot a railgun
|
||||
void P_RailAttack (AActor *source, int damage, int offset, int color1 = 0, int color2 = 0, float maxdiff = 0, bool silent = false, const PClass *puff = NULL, bool pierce = true, angle_t angleoffset = 0, angle_t pitchoffset = 0, fixed_t distance = 0, bool fullbright = false, int duration = 35, float sparsity = 1.0, float drift = 1.0, const PClass *spawnclass = NULL); // [RH] Shoot a railgun
|
||||
bool P_HitFloor (AActor *thing);
|
||||
bool P_HitWater (AActor *thing, sector_t *sec, fixed_t splashx = FIXED_MIN, fixed_t splashy = FIXED_MIN, fixed_t splashz=FIXED_MIN, bool checkabove = false, bool alert = true);
|
||||
void P_CheckSplash(AActor *self, fixed_t distance);
|
||||
|
||||
bool P_CheckMissileSpawn (AActor *missile);
|
||||
void P_PlaySpawnSound(AActor *missile, AActor *spawner);
|
||||
|
||||
|
|
|
@ -3844,8 +3844,7 @@ static bool ProcessNoPierceRailHit (FTraceResults &res)
|
|||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void P_RailAttack (AActor *source, int damage, int offset, int color1, int color2, float maxdiff, bool silent, const PClass *puffclass, bool pierce, angle_t angleoffset, angle_t pitchoffset)
|
||||
void P_RailAttack (AActor *source, int damage, int offset, int color1, int color2, float maxdiff, bool silent, const PClass *puffclass, bool pierce, angle_t angleoffset, angle_t pitchoffset, fixed_t distance, bool fullbright, int duration, float sparsity, float drift, const PClass *spawnclass)
|
||||
{
|
||||
fixed_t vx, vy, vz;
|
||||
angle_t angle, pitch;
|
||||
|
@ -3888,8 +3887,7 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
|
|||
|
||||
int flags;
|
||||
|
||||
AActor *puffDefaults = puffclass == NULL?
|
||||
NULL : GetDefaultByType (puffclass->GetReplacement());
|
||||
AActor *puffDefaults = puffclass == NULL ? NULL : GetDefaultByType (puffclass->GetReplacement());
|
||||
|
||||
if (puffDefaults != NULL && puffDefaults->flags6 & MF6_NOTRIGGER) flags = 0;
|
||||
else flags = TRACE_PCross|TRACE_Impact;
|
||||
|
@ -3897,13 +3895,13 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
|
|||
if (pierce)
|
||||
{
|
||||
Trace (x1, y1, shootz, source->Sector, vx, vy, vz,
|
||||
8192*FRACUNIT, MF_SHOOTABLE, ML_BLOCKEVERYTHING, source, trace,
|
||||
distance, MF_SHOOTABLE, ML_BLOCKEVERYTHING, source, trace,
|
||||
flags, ProcessRailHit);
|
||||
}
|
||||
else
|
||||
{
|
||||
Trace (x1, y1, shootz, source->Sector, vx, vy, vz,
|
||||
8192*FRACUNIT, MF_SHOOTABLE, ML_BLOCKEVERYTHING, source, trace,
|
||||
distance, MF_SHOOTABLE, ML_BLOCKEVERYTHING, source, trace,
|
||||
flags, ProcessNoPierceRailHit);
|
||||
}
|
||||
|
||||
|
@ -3928,7 +3926,7 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
|
|||
if ((RailHits[i].HitActor->flags & MF_NOBLOOD) ||
|
||||
(RailHits[i].HitActor->flags2 & (MF2_DORMANT|MF2_INVULNERABLE)))
|
||||
{
|
||||
spawnpuff = puffclass != NULL;
|
||||
spawnpuff = (puffclass != NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3977,7 +3975,7 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
|
|||
end.X = FIXED2FLOAT(trace.X);
|
||||
end.Y = FIXED2FLOAT(trace.Y);
|
||||
end.Z = FIXED2FLOAT(trace.Z);
|
||||
P_DrawRailTrail (source, start, end, color1, color2, maxdiff, silent);
|
||||
P_DrawRailTrail (source, start, end, color1, color2, maxdiff, silent, spawnclass, source->angle + angleoffset, fullbright, duration, sparsity, drift);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -2138,6 +2138,9 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade,
|
|||
{
|
||||
vis->Style.colormap = fixedcolormap;
|
||||
}
|
||||
else if(particle->bright) {
|
||||
vis->Style.colormap = map;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Using MulScale15 instead of 16 makes particles slightly more visible
|
||||
|
|
|
@ -1372,6 +1372,7 @@ enum
|
|||
RAF_SILENT = 1,
|
||||
RAF_NOPIERCE = 2,
|
||||
RAF_EXPLICITANGLE = 4,
|
||||
RAF_FULLBRIGHT = 8
|
||||
};
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1381,7 +1382,7 @@ enum
|
|||
//==========================================================================
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RailAttack)
|
||||
{
|
||||
ACTION_PARAM_START(10);
|
||||
ACTION_PARAM_START(15);
|
||||
ACTION_PARAM_INT(Damage, 0);
|
||||
ACTION_PARAM_INT(Spawnofs_XY, 1);
|
||||
ACTION_PARAM_BOOL(UseAmmo, 2);
|
||||
|
@ -1392,6 +1393,15 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RailAttack)
|
|||
ACTION_PARAM_CLASS(PuffType, 7);
|
||||
ACTION_PARAM_ANGLE(Spread_XY, 8);
|
||||
ACTION_PARAM_ANGLE(Spread_Z, 9);
|
||||
ACTION_PARAM_FIXED(Range, 10);
|
||||
ACTION_PARAM_INT(Duration, 11);
|
||||
ACTION_PARAM_FLOAT(Sparsity, 12);
|
||||
ACTION_PARAM_FLOAT(DriftSpeed, 13);
|
||||
ACTION_PARAM_CLASS(SpawnClass, 14);
|
||||
|
||||
if(Range==0) Range=8192*FRACUNIT;
|
||||
if(Duration==0) Duration=35;
|
||||
if(Sparsity==0) Sparsity=1.0;
|
||||
|
||||
if (!self->player) return;
|
||||
|
||||
|
@ -1417,7 +1427,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RailAttack)
|
|||
slope = pr_crailgun.Random2() * (Spread_Z / 255);
|
||||
}
|
||||
|
||||
P_RailAttack (self, Damage, Spawnofs_XY, Color1, Color2, MaxDiff, (Flags & RAF_SILENT), PuffType, (!(Flags & RAF_NOPIERCE)), angle, slope);
|
||||
P_RailAttack (self, Damage, Spawnofs_XY, Color1, Color2, MaxDiff, (Flags & RAF_SILENT), PuffType, (!(Flags & RAF_NOPIERCE)), angle, slope, Range, (Flags & RAF_FULLBRIGHT), Duration, Sparsity, DriftSpeed, SpawnClass);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1435,7 +1445,7 @@ enum
|
|||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
|
||||
{
|
||||
ACTION_PARAM_START(10);
|
||||
ACTION_PARAM_START(15);
|
||||
ACTION_PARAM_INT(Damage, 0);
|
||||
ACTION_PARAM_INT(Spawnofs_XY, 1);
|
||||
ACTION_PARAM_COLOR(Color1, 2);
|
||||
|
@ -1446,6 +1456,15 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
|
|||
ACTION_PARAM_CLASS(PuffType, 7);
|
||||
ACTION_PARAM_ANGLE(Spread_XY, 8);
|
||||
ACTION_PARAM_ANGLE(Spread_Z, 9);
|
||||
ACTION_PARAM_FIXED(Range, 10);
|
||||
ACTION_PARAM_INT(Duration, 11);
|
||||
ACTION_PARAM_FLOAT(Sparsity, 12);
|
||||
ACTION_PARAM_FLOAT(DriftSpeed, 13);
|
||||
ACTION_PARAM_CLASS(SpawnClass, 14);
|
||||
|
||||
if(Range==0) Range=8192*FRACUNIT;
|
||||
if(Duration==0) Duration=35;
|
||||
if(Sparsity==0) Sparsity=1.0;
|
||||
|
||||
AActor *linetarget;
|
||||
|
||||
|
@ -1526,7 +1545,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
|
|||
slopeoffset = pr_crailgun.Random2() * (Spread_Z / 255);
|
||||
}
|
||||
|
||||
P_RailAttack (self, Damage, Spawnofs_XY, Color1, Color2, MaxDiff, (Flags & RAF_SILENT), PuffType, (!(Flags & RAF_NOPIERCE)), angleoffset, slopeoffset);
|
||||
P_RailAttack (self, Damage, Spawnofs_XY, Color1, Color2, MaxDiff, (Flags & RAF_SILENT), PuffType, (!(Flags & RAF_NOPIERCE)), angleoffset, slopeoffset, Range, (Flags & RAF_FULLBRIGHT), Duration, Sparsity, DriftSpeed, SpawnClass);
|
||||
|
||||
self->x = saved_x;
|
||||
self->y = saved_y;
|
||||
|
|
|
@ -196,7 +196,7 @@ ACTOR Actor native //: Thinker
|
|||
action native A_Jump(int chance = 256, state label, ...);
|
||||
action native A_CustomMissile(class<Actor> missiletype, float spawnheight = 32, int spawnofs_xy = 0, float angle = 0, int flags = 0, float pitch = 0);
|
||||
action native A_CustomBulletAttack(float spread_xy, float spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", float range = 0, int flags = 0);
|
||||
action native A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = "", color color2 = "", int flags = 0, bool aim = false, float maxdiff = 0, class<Actor> pufftype = "BulletPuff", float spread_xy = 0, float spread_z = 0);
|
||||
action native A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = "", color color2 = "", int flags = 0, bool aim = false, float maxdiff = 0, class<Actor> pufftype = "BulletPuff", float spread_xy = 0, float spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class<Actor> spawnclass = "none");
|
||||
action native A_JumpIfHealthLower(int health, state label);
|
||||
action native A_JumpIfCloser(float distance, state label);
|
||||
action native A_JumpIfTracerCloser(float distance, state label);
|
||||
|
|
|
@ -114,6 +114,7 @@ const int MRF_UNDOBYDEATHSAVES = 2048;
|
|||
const int RGF_SILENT = 1;
|
||||
const int RGF_NOPIERCING = 2;
|
||||
const int RGF_EXPLICITANGLE = 4;
|
||||
const int RGF_FULLBRIGHT = 8;
|
||||
|
||||
// Flags for A_Mushroom
|
||||
const int MSF_Standard = 0;
|
||||
|
|
|
@ -11,7 +11,7 @@ ACTOR Inventory native
|
|||
action native A_CustomPunch(int damage, bool norandom = false, int flags = CPF_USEAMMO, class<Actor> pufftype = "BulletPuff", float range = 0, float lifesteal = 0);
|
||||
action native A_FireBullets(float spread_xy, float spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", int flags = 1, float range = 0);
|
||||
action native A_FireCustomMissile(class<Actor> missiletype, float angle = 0, bool useammo = true, int spawnofs_xy = 0, float spawnheight = 0, bool aimatangle = false, float pitch = 0);
|
||||
action native A_RailAttack(int damage, int spawnofs_xy = 0, int useammo = true, color color1 = "", color color2 = "", int flags = 0, float maxdiff = 0, class<Actor> pufftype = "BulletPuff", float spread_xy = 0, float spread_z = 0);
|
||||
action native A_RailAttack(int damage, int spawnofs_xy = 0, int useammo = true, color color1 = "", color color2 = "", int flags = 0, float maxdiff = 0, class<Actor> pufftype = "BulletPuff", float spread_xy = 0, float spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class<Actor> spawnclass = "none");
|
||||
action native A_Light(int extralight);
|
||||
action native A_Light0();
|
||||
action native A_Light1();
|
||||
|
|
Loading…
Reference in a new issue