- added DavidPH's A_RailAttack extension submission.

SVN r2454 (trunk)
This commit is contained in:
Christoph Oelckers 2010-07-24 06:27:13 +00:00
parent a6499a6efb
commit 37f55c6539
6 changed files with 52 additions and 17 deletions

View file

@ -425,7 +425,7 @@ 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, angle_t angle, int pitch);
void P_TraceBleed (int damage, AActor *target, AActor *missile); // missile version void P_TraceBleed (int damage, AActor *target, AActor *missile); // missile version
void P_TraceBleed (int damage, AActor *target); // random direction 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); // [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); // [RH] Shoot a railgun
bool P_HitFloor (AActor *thing); 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); 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); void P_CheckSplash(AActor *self, fixed_t distance);

View file

@ -3769,7 +3769,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) 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 vx, vy, vz; fixed_t vx, vy, vz;
angle_t angle, pitch; angle_t angle, pitch;
@ -3780,8 +3780,8 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
if (puffclass == NULL) puffclass = PClass::FindClass(NAME_BulletPuff); if (puffclass == NULL) puffclass = PClass::FindClass(NAME_BulletPuff);
pitch = (angle_t)(-source->pitch) >> ANGLETOFINESHIFT; pitch = ((angle_t)(-source->pitch) + pitchoffset) >> ANGLETOFINESHIFT;
angle = source->angle >> ANGLETOFINESHIFT; angle = (source->angle + angleoffset) >> ANGLETOFINESHIFT;
vx = FixedMul (finecosine[pitch], finecosine[angle]); vx = FixedMul (finecosine[pitch], finecosine[angle]);
vy = FixedMul (finecosine[pitch], finesine[angle]); vy = FixedMul (finecosine[pitch], finesine[angle]);
@ -3801,7 +3801,7 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
shootz += 8*FRACUNIT; shootz += 8*FRACUNIT;
} }
angle = (source->angle - ANG90) >> ANGLETOFINESHIFT; angle = ((source->angle + angleoffset) - ANG90) >> ANGLETOFINESHIFT;
x1 += offset*finecosine[angle]; x1 += offset*finecosine[angle];
y1 += offset*finesine[angle]; y1 += offset*finesine[angle];
@ -3857,10 +3857,10 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
else else
{ {
spawnpuff = (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF); spawnpuff = (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF);
P_SpawnBlood (x, y, z, source->angle - ANG180, damage, RailHits[i].HitActor); P_SpawnBlood (x, y, z, (source->angle + angleoffset) - ANG180, damage, RailHits[i].HitActor);
P_TraceBleed (damage, x, y, z, RailHits[i].HitActor, source->angle, pitch); P_TraceBleed (damage, x, y, z, RailHits[i].HitActor, source->angle, pitch);
} }
if (spawnpuff) P_SpawnPuff (source, puffclass, x, y, z, source->angle - ANG90, 1, PF_HITTHING); if (spawnpuff) P_SpawnPuff (source, puffclass, x, y, z, (source->angle + angleoffset) - ANG90, 1, PF_HITTHING);
if (puffDefaults && puffDefaults->PoisonDuration != INT_MIN) if (puffDefaults && puffDefaults->PoisonDuration != INT_MIN)
P_PoisonMobj(RailHits[i].HitActor, thepuff ? thepuff : source, source, puffDefaults->PoisonDamage, puffDefaults->PoisonDuration, puffDefaults->PoisonPeriod); P_PoisonMobj(RailHits[i].HitActor, thepuff ? thepuff : source, source, puffDefaults->PoisonDamage, puffDefaults->PoisonDuration, puffDefaults->PoisonPeriod);
@ -3874,7 +3874,7 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
SpawnShootDecal (source, trace); SpawnShootDecal (source, trace);
if (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF) if (puffclass != NULL && puffDefaults->flags3 & MF3_ALWAYSPUFF)
{ {
P_SpawnPuff (source, puffclass, trace.X, trace.Y, trace.Z, source->angle - ANG90, 1, 0); P_SpawnPuff (source, puffclass, trace.X, trace.Y, trace.Z, (source->angle + angleoffset) - ANG90, 1, 0);
} }
} }

View file

@ -1207,7 +1207,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch)
enum enum
{ {
RAF_SILENT = 1, RAF_SILENT = 1,
RAF_NOPIERCE = 2 RAF_NOPIERCE = 2,
RAF_EXPLICITANGLE = 4,
}; };
//========================================================================== //==========================================================================
@ -1217,7 +1218,7 @@ enum
//========================================================================== //==========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RailAttack) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RailAttack)
{ {
ACTION_PARAM_START(8); ACTION_PARAM_START(10);
ACTION_PARAM_INT(Damage, 0); ACTION_PARAM_INT(Damage, 0);
ACTION_PARAM_INT(Spawnofs_XY, 1); ACTION_PARAM_INT(Spawnofs_XY, 1);
ACTION_PARAM_BOOL(UseAmmo, 2); ACTION_PARAM_BOOL(UseAmmo, 2);
@ -1226,6 +1227,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RailAttack)
ACTION_PARAM_INT(Flags, 5); ACTION_PARAM_INT(Flags, 5);
ACTION_PARAM_FLOAT(MaxDiff, 6); ACTION_PARAM_FLOAT(MaxDiff, 6);
ACTION_PARAM_CLASS(PuffType, 7); ACTION_PARAM_CLASS(PuffType, 7);
ACTION_PARAM_ANGLE(Spread_XY, 8);
ACTION_PARAM_ANGLE(Spread_Z, 9);
if (!self->player) return; if (!self->player) return;
@ -1237,7 +1240,21 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RailAttack)
if (!weapon->DepleteAmmo(weapon->bAltFire, true)) return; // out of ammo if (!weapon->DepleteAmmo(weapon->bAltFire, true)) return; // out of ammo
} }
P_RailAttack (self, Damage, Spawnofs_XY, Color1, Color2, MaxDiff, (Flags & RAF_SILENT), PuffType, (!(Flags & RAF_NOPIERCE))); angle_t angle;
angle_t slope;
if (Flags & RAF_EXPLICITANGLE)
{
angle = Spread_XY;
slope = Spread_Z;
}
else
{
angle = pr_crailgun.Random2() * (Spread_XY / 255);
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);
} }
//========================================================================== //==========================================================================
@ -1249,12 +1266,13 @@ enum
{ {
CRF_DONTAIM = 0, CRF_DONTAIM = 0,
CRF_AIMPARALLEL = 1, CRF_AIMPARALLEL = 1,
CRF_AIMDIRECT = 2 CRF_AIMDIRECT = 2,
CRF_EXPLICITANGLE = 4,
}; };
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
{ {
ACTION_PARAM_START(8); ACTION_PARAM_START(10);
ACTION_PARAM_INT(Damage, 0); ACTION_PARAM_INT(Damage, 0);
ACTION_PARAM_INT(Spawnofs_XY, 1); ACTION_PARAM_INT(Spawnofs_XY, 1);
ACTION_PARAM_COLOR(Color1, 2); ACTION_PARAM_COLOR(Color1, 2);
@ -1263,6 +1281,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
ACTION_PARAM_INT(aim, 5); ACTION_PARAM_INT(aim, 5);
ACTION_PARAM_FLOAT(MaxDiff, 6); ACTION_PARAM_FLOAT(MaxDiff, 6);
ACTION_PARAM_CLASS(PuffType, 7); ACTION_PARAM_CLASS(PuffType, 7);
ACTION_PARAM_ANGLE(Spread_XY, 8);
ACTION_PARAM_ANGLE(Spread_Z, 9);
AActor *linetarget; AActor *linetarget;
@ -1329,7 +1349,21 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
angle_t angle = (self->angle - ANG90) >> ANGLETOFINESHIFT; angle_t angle = (self->angle - ANG90) >> ANGLETOFINESHIFT;
P_RailAttack (self, Damage, Spawnofs_XY, Color1, Color2, MaxDiff, (Flags & RAF_SILENT), PuffType, (!(Flags & RAF_NOPIERCE))); angle_t angleoffset;
angle_t slopeoffset;
if (Flags & CRF_EXPLICITANGLE)
{
angleoffset = Spread_XY;
slopeoffset = Spread_Z;
}
else
{
angleoffset = pr_crailgun.Random2() * (Spread_XY / 255);
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);
self->x = saved_x; self->x = saved_x;
self->y = saved_y; self->y = saved_y;

View file

@ -185,7 +185,7 @@ ACTOR Actor native //: Thinker
action native A_Jump(int chance = 256, state label, ...); 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_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_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"); 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_JumpIfHealthLower(int health, state label); action native A_JumpIfHealthLower(int health, state label);
action native A_JumpIfCloser(float distance, state label); action native A_JumpIfCloser(float distance, state label);
action native A_JumpIfTracerCloser(float distance, state label); action native A_JumpIfTracerCloser(float distance, state label);

View file

@ -84,6 +84,7 @@ const int MRF_UNDOBYDEATHSAVES = 2048;
// Flags for A_RailAttack and A_CustomRailgun // Flags for A_RailAttack and A_CustomRailgun
const int RGF_SILENT = 1; const int RGF_SILENT = 1;
const int RGF_NOPIERCING = 2; const int RGF_NOPIERCING = 2;
const int RGF_EXPLICITANGLE = 4;
// Flags for A_Mushroom // Flags for A_Mushroom
const int MSF_Standard = 0; const int MSF_Standard = 0;

View file

@ -10,7 +10,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_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_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_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"); 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_Light(int extralight); action native A_Light(int extralight);
action native A_Light0(); action native A_Light0();
action native A_Light1(); action native A_Light1();