mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-15 08:41:59 +00:00
- address bad use of pitch in A_CustomMissile.
This function calculated everything correctly but ultimately set the vertical velocity wrong. Most importantly this meant that the actual velocity vector and actor pitch - if CMF_SAVEPITCH was used - did not match. Since this bug has been present since the pitch parameter was added, this deprecates A_CustomMissile and replaces it with a properly implemented A_SpawnProjectile function and handling the compatibility case with a new flag and a scripted wrapper function. All internal uses of A_CustomMissile have been replaced as well.
This commit is contained in:
parent
4fcf9933f0
commit
d4c0ee9e43
15 changed files with 32 additions and 19 deletions
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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<Actor> 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<Actor> 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<Actor> pufftype = "BulletPuff", double range = 0, int flags = 0, int ptr = AAPTR_TARGET, class<Actor> 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<Actor> 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<Actor> spawnclass = null, double spawnofs_z = 0, int spiraloffset = 270, int limit = 0);
|
||||
native bool A_SetInventory(class<Inventory> itemtype, int amount, int ptr = AAPTR_DEFAULT, bool beyondMax = false);
|
||||
|
|
9
wadsrc/static/zscript/compatibility.txt
Normal file
9
wadsrc/static/zscript/compatibility.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
// This file contains compatibility wrappers for DECORATE functions with bad parameters.
|
||||
|
||||
extend class Actor
|
||||
{
|
||||
deprecated void A_CustomMissile(class<Actor> 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);
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue