This commit is contained in:
Rachael Alexanderson 2016-12-24 18:22:14 -05:00
commit 6a550c89a9
27 changed files with 69 additions and 46 deletions

View file

@ -2677,13 +2677,13 @@ void FParser::SF_PlayerWeapon()
if (playernum==-1) return;
if (weaponnum<0 || weaponnum>9)
{
script_error("weaponnum out of range! %s\n", weaponnum);
script_error("weaponnum out of range! %d\n", weaponnum);
return;
}
PClassWeapon * ti = static_cast<PClassWeapon *>(PClass::FindActor(WeaponNames[weaponnum]));
if (!ti)
{
script_error("incompatibility in playerweapon\n", weaponnum);
script_error("incompatibility in playerweapon %d\n", weaponnum);
return;
}
@ -2758,13 +2758,13 @@ void FParser::SF_PlayerSelectedWeapon()
if (weaponnum<0 || weaponnum>=9)
{
script_error("weaponnum out of range! %s\n", weaponnum);
script_error("weaponnum out of range! %d\n", weaponnum);
return;
}
PClassWeapon * ti = static_cast<PClassWeapon *>(PClass::FindActor(WeaponNames[weaponnum]));
if (!ti)
{
script_error("incompatibility in playerweapon\n", weaponnum);
script_error("incompatibility in playerweapon %d\n", weaponnum);
return;
}

View file

@ -246,7 +246,7 @@ void FMapInfoParser::ParseDoomEdNums()
}
if (error > 0)
{
sc.ScriptError("%d errors encountered in DoomEdNum definition");
sc.ScriptError("%d errors encountered in DoomEdNum definition", error);
}
}

View file

@ -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)
{
@ -1986,7 +1988,7 @@ enum FP_Flags
FPF_TRANSFERTRANSLATION = 2,
FPF_NOAUTOAIM = 4,
};
DEFINE_ACTION_FUNCTION(AStateProvider, A_FireCustomMissile)
DEFINE_ACTION_FUNCTION(AStateProvider, A_FireProjectile)
{
PARAM_ACTION_PROLOGUE(AStateProvider);
PARAM_CLASS (ti, AActor);
@ -2300,7 +2302,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CustomRailgun)
// We probably won't hit the target, but aim at it anyway so we don't look stupid.
DVector2 xydiff = self->Vec2To(self->target);
double zdiff = self->target->Center() - self->Center() - self->Floorclip;
self->Angles.Pitch = VecToAngle(xydiff.Length(), zdiff);
self->Angles.Pitch = -VecToAngle(xydiff.Length(), zdiff);
}
// Let the aim trail behind the player
if (aim)
@ -6688,10 +6690,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FaceMovementDirection)
{
DAngle current = mobj->Angles.Pitch;
const DVector2 velocity = mobj->Vel.XY();
DAngle pitch = VecToAngle(velocity.Length(), mobj->Vel.Z);
DAngle pitch = -VecToAngle(velocity.Length(), mobj->Vel.Z);
if (pitchlimit > 0)
{
DAngle pdelta = deltaangle(-current, pitch);
DAngle pdelta = deltaangle(current, pitch);
if (fabs(pdelta) > pitchlimit)
{

View file

@ -4920,10 +4920,10 @@ void P_RailAttack(FRailParams *p)
}
AActor *source = p->source;
DAngle pitch = -source->Angles.Pitch + p->pitchoffset;
DAngle pitch = source->Angles.Pitch + p->pitchoffset;
DAngle angle = source->Angles.Yaw + p->angleoffset;
DVector3 vec(DRotator(pitch, angle, angle));
DVector3 vec(DRotator(-pitch, angle, angle));
double shootz = source->Center() - source->FloatSpeed + p->offset_z;
if (!(p->flags & RAF_CENTERZ))

View file

@ -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)

View file

@ -7493,7 +7493,7 @@ isresolved:
else
{
// Todo: If this is a qualified call to a parent class function, let it through (but this needs to disable virtual calls later.)
ScriptPosition.Message(MSG_ERROR, "Qualified member call to parent class not yet implemented\n", cls->TypeName.GetChars(), MethodName.GetChars());
ScriptPosition.Message(MSG_ERROR, "Qualified member call to parent class %s::%s is not yet implemented\n", cls->TypeName.GetChars(), MethodName.GetChars());
delete this;
return nullptr;
}
@ -7897,7 +7897,7 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx)
// For a reference argument the types must match 100%.
if (type != ArgList[i]->ValueType)
{
ScriptPosition.Message(MSG_ERROR, "Type mismatch in reference argument", Function->SymbolName.GetChars());
ScriptPosition.Message(MSG_ERROR, "Type mismatch in reference argument %s", Function->SymbolName.GetChars());
x = nullptr;
}
else
@ -8346,7 +8346,7 @@ FxExpression *FxGetDefaultByType::Resolve(FCompileContext &ctx)
{
// this is the ugly case. We do not know what we have and cannot do proper type casting.
// For now error out and let this case require explicit handling on the user side.
ScriptPosition.Message(MSG_ERROR, "GetDefaultByType() requires an actor class type", static_cast<FxConstant *>(Self)->GetValue().GetString().GetChars());
ScriptPosition.Message(MSG_ERROR, "GetDefaultByType() requires an actor class type, but got %s", static_cast<FxConstant *>(Self)->GetValue().GetString().GetChars());
delete this;
return nullptr;
}
@ -9511,7 +9511,7 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx)
/* lax */
// Since this happens in released WADs it must pass without a terminal error... :(
ScriptPosition.Message(MSG_OPTERROR,
"Unknown class name '%s'",
"Unknown class name '%s' of type '%s'",
clsname.GetChars(), desttype->TypeName.GetChars());
}
else

View file

@ -272,7 +272,7 @@ static void CheckForUnsafeStates(PClassActor *obj)
// If an unsafe function (i.e. one that accesses user variables) is being detected, print a warning once and remove the bogus function. We may not call it because that would inevitably crash.
auto owner = FState::StaticFindStateOwner(state);
GetStateSource(state).Message(MSG_ERROR, TEXTCOLOR_RED "Unsafe state call in state %s.%d which accesses user variables, reached by %s.%s.\n",
owner->TypeName.GetChars(), state - owner->OwnedStates, obj->TypeName.GetChars(), FName(*test).GetChars());
owner->TypeName.GetChars(), int(state - owner->OwnedStates), obj->TypeName.GetChars(), FName(*test).GetChars());
}
state = state->NextState;
}

View file

@ -525,7 +525,7 @@ DEFINE_PROPERTY(skip_super, 0, Actor)
if (info->Size != actorclass->Size)
{
bag.ScriptPosition.Message(MSG_OPTERROR,
"'skip_super' is only allowed in subclasses of AActor with no additional fields and will be ignored.", info->TypeName.GetChars());
"'skip_super' is only allowed in subclasses of AActor with no additional fields and will be ignored in type %s.", info->TypeName.GetChars());
return;
}
if (bag.StateSet)

View file

@ -1323,7 +1323,7 @@ bool ZCCCompiler::CompileFields(PStruct *type, TArray<ZCC_VarDeclarator *> &Fiel
}
else if (hasnativechildren)
{
Error(field, "Cannot add field %s to %s. %s has native children which means it size may not change.", type->TypeName.GetChars(), fd->FieldSize, FName(name->Name).GetChars());
Error(field, "Cannot add field %s to %s. %s has native children which means it size may not change.", FName(name->Name).GetChars(), type->TypeName.GetChars(), type->TypeName.GetChars());
}
else
{

View file

@ -38,6 +38,8 @@
#include "zscript/shared/fastprojectile.txt"
#include "zscript/shared/dynlights.txt"
#include "zscript/compatibility.txt"
#include "zscript/doom/doomplayer.txt"
#include "zscript/doom/possessed.txt"
#include "zscript/doom/doomimp.txt"

View file

@ -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);

View file

@ -77,7 +77,7 @@ class ZorchPropulsor : RocketLauncher
{
Fire:
MISG B 8 A_GunFlash;
MISG B 12 A_FireCustomMissile("PropulsorMissile");
MISG B 12 A_FireProjectile("PropulsorMissile");
MISG B 0 A_ReFire;
Goto Ready;
}
@ -107,7 +107,7 @@ class PhasingZorcher : PlasmaRifle
{
Fire:
PLSG A 0 A_GunFlash;
PLSG A 3 A_FireCustomMissile("PhaseZorchMissile");
PLSG A 3 A_FireProjectile("PhaseZorchMissile");
PLSG B 20 A_ReFire;
Goto Ready;
Flash:
@ -143,7 +143,7 @@ class LAZDevice : BFG9000
Fire:
BFGG A 20 A_BFGsound;
BFGG B 10 A_GunFlash;
BFGG B 10 A_FireCustomMissile("LAZBall");
BFGG B 10 A_FireProjectile("LAZBall");
BFGG B 20 A_ReFire;
Goto Ready;
}

View file

@ -0,0 +1,18 @@
// 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);
}
}
extend class StateProvider
{
deprecated action void A_FireCustomMissile(class<Actor> missiletype, double angle = 0, bool useammo = true, double spawnofs_xy = 0, double spawnheight = 0, int flags = 0, double pitch = 0)
{
A_FireProjectile(missiletype, angle, useammo, spawnofs_xy, spawnheight, flags, -pitch);
}
}

View file

@ -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

View file

@ -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;

View file

@ -87,7 +87,7 @@ class BlasterPowered : Blaster
Fire:
BLSR BC 0;
Hold:
BLSR D 3 A_FireCustomMissile("BlasterFX1");
BLSR D 3 A_FireProjectile("BlasterFX1");
BLSR CB 4;
BLSR A 0 A_ReFire;
Goto Ready;

View file

@ -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;
}
}

View file

@ -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;

View file

@ -23,7 +23,7 @@ class MWeapWand : MageWeapon
Loop;
Fire:
MWND A 6;
MWND B 6 Bright Offset (0, 48) A_FireCustomMissile ("MageWandMissile");
MWND B 6 Bright Offset (0, 48) A_FireProjectile ("MageWandMissile");
MWND A 3 Offset (0, 40);
MWND A 3 Offset (0, 36) A_ReFire;
Goto Ready;

View file

@ -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;
}
}

View file

@ -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;

View file

@ -49,7 +49,7 @@ class ArtiEgg : CustomInventory
Use:
TNT1 A 0
{
for (double i = -15; i <= 15; i += 7.5) A_FireCustomMissile("EggFX", i, 0, 0, 0, 1);
for (double i = -15; i <= 15; i += 7.5) A_FireProjectile("EggFX", i, false, 0, 0, FPF_AIMATANGLE);
}
Stop;
}
@ -104,7 +104,7 @@ class ArtiPork : CustomInventory
Use:
TNT1 A 0
{
for (double i = -15; i <= 15; i += 7.5) A_FireCustomMissile("PorkFX", i, 0, 0, 0, 1);
for (double i = -15; i <= 15; i += 7.5) A_FireProjectile("PorkFX", i, false, 0, 0, FPF_AIMATANGLE);
}
Stop;
}

View file

@ -84,7 +84,7 @@ class StateProvider : Inventory native
action native state A_JumpIfNoAmmo(statelabel label);
action native void A_CustomPunch(int damage, bool norandom = false, int flags = CPF_USEAMMO, class<Actor> pufftype = "BulletPuff", double range = 0, double lifesteal = 0, int lifestealmax = 0, class<BasicArmorBonus> armorbonustype = "ArmorBonus", sound MeleeSound = 0, sound MissSound = "");
action native void A_FireBullets(double spread_xy, double spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", int flags = 1, double range = 0, class<Actor> missile = null, double Spawnheight = 32, double Spawnofs_xy = 0);
action native void A_FireCustomMissile(class<Actor> missiletype, double angle = 0, bool useammo = true, double spawnofs_xy = 0, double spawnheight = 0, int flags = 0, double pitch = 0);
action native void A_FireProjectile(class<Actor> missiletype, double angle = 0, bool useammo = true, double spawnofs_xy = 0, double spawnheight = 0, int flags = 0, double pitch = 0);
action native void A_RailAttack(int damage, int spawnofs_xy = 0, bool useammo = true, color color1 = 0, color color2 = 0, int flags = 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 = "none", double spawnofs_z = 0, int spiraloffset = 270, int limit = 0);
action native void A_WeaponReady(int flags = 0);
action native void A_Lower();

View file

@ -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;
}

View file

@ -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:

View file

@ -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:

View file

@ -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;