diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index 13a347ef2..885bb050c 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -1454,10 +1454,11 @@ enum CM_Flags CMF_OFFSETPITCH = 32, CMF_SAVEPITCH = 64, - CMF_ABSOLUTEANGLE = 128 + CMF_ABSOLUTEANGLE = 128, + CMF_BADPITCH = 256 }; -DEFINE_ACTION_FUNCTION(AActor, A_CustomMissile) +DEFINE_ACTION_FUNCTION(AActor, A_SpawnProjectile) { PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (ti, AActor); @@ -1525,6 +1526,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CustomMissile) } missilespeed = fabs(Pitch.Cos() * missile->Speed); missile->Vel.Z = Pitch.Sin() * missile->Speed; + if (!(flags & CMF_BADPITCH)) missile->Vel.Z *= -1; } else { @@ -1831,7 +1833,7 @@ static void AimBulletMissile(AActor *proj, AActor *puff, int flags, bool temp, b // Aim for the base of the puff as that's where blood puffs will spawn... roughly. A_Face(proj, puff, 0., 0., 0., 0., 1); - proj->Vel3DFromAngle(-proj->Angles.Pitch, proj->Speed); + proj->Vel3DFromAngle(proj->Angles.Pitch, proj->Speed); if (!temp) { diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index b527bf681..72ddd9395 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -6321,7 +6321,7 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist) // [RH] Don't explode ripping missiles that spawn inside something if (th->BlockingMobj == NULL || !(th->flags2 & MF2_RIP) || (th->BlockingMobj->flags5 & MF5_DONTRIP)) { - // If this is a monster spawned by A_CustomMissile subtract it from the counter. + // If this is a monster spawned by A_SpawnProjectile subtract it from the counter. th->ClearCounters(); // [RH] Don't explode missiles that spawn on top of horizon lines if (th->BlockingLine != NULL && th->BlockingLine->special == Line_Horizon) diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index 341fdc9fb..3cad69783 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -2,6 +2,7 @@ #include "zscript/constants.txt" #include "zscript/actor.txt" #include "zscript/actor_checks.txt" +#include "zscript/compatibility.txt" #include "zscript/shared/inventory.txt" #include "zscript/shared/inv_misc.txt" diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 0d264580a..4324f162a 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -691,7 +691,7 @@ class Actor : Thinker native deprecated native void A_StopSoundEx(name slot); native void A_SeekerMissile(int threshold, int turnmax, int flags = 0, int chance = 50, int distance = 10); native action state A_Jump(int chance, statelabel label, ...); - native void A_CustomMissile(class missiletype, double spawnheight = 32, double spawnofs_xy = 0, double angle = 0, int flags = 0, double pitch = 0, int ptr = AAPTR_TARGET); + native void A_SpawnProjectile(class missiletype, double spawnheight = 32, double spawnofs_xy = 0, double angle = 0, int flags = 0, double pitch = 0, int ptr = AAPTR_TARGET); native void A_CustomBulletAttack(double spread_xy, double spread_z, int numbullets, int damageperbullet, class pufftype = "BulletPuff", double range = 0, int flags = 0, int ptr = AAPTR_TARGET, class missile = null, double Spawnheight = 32, double Spawnofs_xy = 0); native void A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = 0, color color2 = 0, int flags = 0, int aim = 0, double maxdiff = 0, class pufftype = "BulletPuff", double spread_xy = 0, double spread_z = 0, double range = 0, int duration = 0, double sparsity = 1.0, double driftspeed = 1.0, class spawnclass = null, double spawnofs_z = 0, int spiraloffset = 270, int limit = 0); native bool A_SetInventory(class itemtype, int amount, int ptr = AAPTR_DEFAULT, bool beyondMax = false); diff --git a/wadsrc/static/zscript/compatibility.txt b/wadsrc/static/zscript/compatibility.txt new file mode 100644 index 000000000..771e3b44b --- /dev/null +++ b/wadsrc/static/zscript/compatibility.txt @@ -0,0 +1,9 @@ +// This file contains compatibility wrappers for DECORATE functions with bad parameters. + +extend class Actor +{ + deprecated void A_CustomMissile(class missiletype, double spawnheight = 32, double spawnofs_xy = 0, double angle = 0, int flags = 0, double pitch = 0, int ptr = AAPTR_TARGET) + { + A_SpawnProjectile(missiletype, spawnheight, spawnofs_xy, angle, flags|CMF_BADPITCH, pitch, ptr); + } +} \ No newline at end of file diff --git a/wadsrc/static/zscript/constants.txt b/wadsrc/static/zscript/constants.txt index 6f57b4222..1d2064aa1 100644 --- a/wadsrc/static/zscript/constants.txt +++ b/wadsrc/static/zscript/constants.txt @@ -45,7 +45,7 @@ enum EBFGSprayFlags BFGF_MISSILEORIGIN = 2, }; -// Flags for A_CustomMissile +// Flags for A_SpawnProjectile enum ECustomMissileFlags { CMF_AIMOFFSET = 1, @@ -56,6 +56,7 @@ enum ECustomMissileFlags CMF_OFFSETPITCH = 32, CMF_SAVEPITCH = 64, CMF_ABSOLUTEANGLE = 128, + CMF_BADPITCH = 256, // for compatibility handling only - avoid! }; // Flags for A_CustomBulletAttack diff --git a/wadsrc/static/zscript/heretic/snake.txt b/wadsrc/static/zscript/heretic/snake.txt index 613559a86..15ae342aa 100644 --- a/wadsrc/static/zscript/heretic/snake.txt +++ b/wadsrc/static/zscript/heretic/snake.txt @@ -28,9 +28,9 @@ class Snake : Actor Loop; Missile: SNKE FF 5 A_FaceTarget; - SNKE FFF 4 A_CustomMissile("SnakeProjA", 32, 0, 0, CMF_CHECKTARGETDEAD); + SNKE FFF 4 A_SpawnProjectile("SnakeProjA", 32, 0, 0, CMF_CHECKTARGETDEAD); SNKE FFF 5 A_FaceTarget; - SNKE F 4 A_CustomMissile("SnakeProjB", 32, 0, 0, CMF_CHECKTARGETDEAD); + SNKE F 4 A_SpawnProjectile("SnakeProjB", 32, 0, 0, CMF_CHECKTARGETDEAD); Goto See; Pain: SNKE E 3; diff --git a/wadsrc/static/zscript/hexen/centaur.txt b/wadsrc/static/zscript/hexen/centaur.txt index f8c8e2c3d..abf2f19d2 100644 --- a/wadsrc/static/zscript/hexen/centaur.txt +++ b/wadsrc/static/zscript/hexen/centaur.txt @@ -112,9 +112,9 @@ class CentaurLeader : Centaur { Missile: CENT E 10 A_FaceTarget; - CENT F 8 Bright A_CustomMissile("CentaurFX", 45, 0, 0, CMF_AIMOFFSET); + CENT F 8 Bright A_SpawnProjectile("CentaurFX", 45, 0, 0, CMF_AIMOFFSET); CENT E 10 A_FaceTarget; - CENT F 8 Bright A_CustomMissile("CentaurFX", 45, 0, 0, CMF_AIMOFFSET); + CENT F 8 Bright A_SpawnProjectile("CentaurFX", 45, 0, 0, CMF_AIMOFFSET); Goto See; } } diff --git a/wadsrc/static/zscript/hexen/demons.txt b/wadsrc/static/zscript/hexen/demons.txt index 25e078509..ef4c96d8d 100644 --- a/wadsrc/static/zscript/hexen/demons.txt +++ b/wadsrc/static/zscript/hexen/demons.txt @@ -44,7 +44,7 @@ class Demon1 : Actor Missile: DEMN E 5 A_FaceTarget; DEMN F 6 A_FaceTarget; - DEMN G 5 A_CustomMissile("Demon1FX1", 62, 0); + DEMN G 5 A_SpawnProjectile("Demon1FX1", 62, 0); Goto See; Death: DEMN HI 6; @@ -250,7 +250,7 @@ class Demon2 : Demon1 Missile: DEM2 E 5 A_FaceTarget; DEM2 F 6 A_FaceTarget; - DEM2 G 5 A_CustomMissile("Demon2FX1", 62, 0); + DEM2 G 5 A_SpawnProjectile("Demon2FX1", 62, 0); Goto See; Death: DEM2 HI 6; diff --git a/wadsrc/static/zscript/hexen/serpent.txt b/wadsrc/static/zscript/hexen/serpent.txt index 6eaafcfd1..eb26c8c7b 100644 --- a/wadsrc/static/zscript/hexen/serpent.txt +++ b/wadsrc/static/zscript/hexen/serpent.txt @@ -300,7 +300,7 @@ class SerpentLeader : Serpent States { Missile: - SSPT N 5 A_CustomMissile("SerpentFX", 32, 0); + SSPT N 5 A_SpawnProjectile("SerpentFX", 32, 0); Goto Dive; } } diff --git a/wadsrc/static/zscript/hexen/wraith.txt b/wadsrc/static/zscript/hexen/wraith.txt index 42a81ae6c..4b90dc4f6 100644 --- a/wadsrc/static/zscript/hexen/wraith.txt +++ b/wadsrc/static/zscript/hexen/wraith.txt @@ -47,7 +47,7 @@ class Wraith : Actor Missile: WRTH E 6 A_FaceTarget; WRTH F 6; - WRTH G 6 A_CustomMissile("WraithFX1"); + WRTH G 6 A_SpawnProjectile("WraithFX1"); Goto See; Death: WRTH I 4; diff --git a/wadsrc/static/zscript/strife/alienspectres.txt b/wadsrc/static/zscript/strife/alienspectres.txt index 39cbc8331..791266cc0 100644 --- a/wadsrc/static/zscript/strife/alienspectres.txt +++ b/wadsrc/static/zscript/strife/alienspectres.txt @@ -202,7 +202,7 @@ class AlienSpectre2 : AlienSpectre1 { Missile: ALN1 F 4 A_FaceTarget; - ALN1 I 4 A_CustomMissile("SpectralLightningH3", 32, 0); + ALN1 I 4 A_SpawnProjectile("SpectralLightningH3", 32, 0); ALN1 E 4; Goto See+10; } @@ -267,7 +267,7 @@ class AlienSpectre4 : AlienSpectre1 { Missile: ALN1 F 4 A_FaceTarget; - ALN1 I 4 A_CustomMissile("SpectralLightningBigV2", 32, 0); + ALN1 I 4 A_SpawnProjectile("SpectralLightningBigV2", 32, 0); ALN1 E 4; Goto See+10; } @@ -289,7 +289,7 @@ class AlienSpectre5 : AlienSpectre1 { Missile: ALN1 F 4 A_FaceTarget; - ALN1 I 4 A_CustomMissile("SpectralLightningBigBall2", 32, 0); + ALN1 I 4 A_SpawnProjectile("SpectralLightningBigBall2", 32, 0); ALN1 E 4; Goto See+10; } diff --git a/wadsrc/static/zscript/strife/entityboss.txt b/wadsrc/static/zscript/strife/entityboss.txt index daf1a78ee..a9ec94bb2 100644 --- a/wadsrc/static/zscript/strife/entityboss.txt +++ b/wadsrc/static/zscript/strife/entityboss.txt @@ -265,7 +265,7 @@ class EntitySecond : SpectralMonster Goto See+1; Missile: MNAL W 4 Bright A_FaceTarget; - MNAL U 4 Bright A_CustomMissile("SpectralLightningH3",32,0); + MNAL U 4 Bright A_SpawnProjectile("SpectralLightningH3",32,0); MNAL V 4 Bright A_SentinelBob; Goto See+4; Pain: diff --git a/wadsrc/static/zscript/strife/loremaster.txt b/wadsrc/static/zscript/strife/loremaster.txt index 14571f91c..cda305d18 100644 --- a/wadsrc/static/zscript/strife/loremaster.txt +++ b/wadsrc/static/zscript/strife/loremaster.txt @@ -55,7 +55,7 @@ class Loremaster : Actor Goto See; Missile: PRST E 4 A_FaceTarget; - PRST F 4 A_CustomMissile("LoreShot", 32, 0); + PRST F 4 A_SpawnProjectile("LoreShot", 32, 0); PRST E 4 A_SentinelBob; Goto See; Death: diff --git a/wadsrc/static/zscript/strife/strifebishop.txt b/wadsrc/static/zscript/strife/strifebishop.txt index b7de186a2..32aacd03a 100644 --- a/wadsrc/static/zscript/strife/strifebishop.txt +++ b/wadsrc/static/zscript/strife/strifebishop.txt @@ -38,7 +38,7 @@ class StrifeBishop : Actor Loop; Missile: MLDR E 3 A_FaceTarget; - MLDR F 2 Bright A_CustomMissile("BishopMissile", 64, 0, 0, CMF_AIMOFFSET); + MLDR F 2 Bright A_SpawnProjectile("BishopMissile", 64, 0, 0, CMF_AIMOFFSET); Goto See; Pain: MLDR D 1 A_Pain;