diff --git a/src/g_inventory/a_artifacts.cpp b/src/g_inventory/a_artifacts.cpp index 832d8e62c..5105ddf83 100644 --- a/src/g_inventory/a_artifacts.cpp +++ b/src/g_inventory/a_artifacts.cpp @@ -1250,63 +1250,6 @@ void APowerSpeed::Serialize(FSerializer &arc) arc("speedflags", SpeedFlags); } -//=========================================================================== -// -// APowerSpeed :: DoEffect -// -//=========================================================================== - -void APowerSpeed::DoEffect () -{ - Super::DoEffect (); - - if (Owner == NULL || Owner->player == NULL) - return; - - if (Owner->player->cheats & CF_PREDICTING) - return; - - if (SpeedFlags & PSF_NOTRAIL) - return; - - if (level.time & 1) - return; - - // Check if another speed item is present to avoid multiple drawing of the speed trail. - // Only the last PowerSpeed without PSF_NOTRAIL set will actually draw the trail. - for (AInventory *item = Inventory; item != NULL; item = item->Inventory) - { - if (item->IsKindOf(RUNTIME_CLASS(APowerSpeed)) && - !(static_cast(item)->SpeedFlags & PSF_NOTRAIL)) - { - return; - } - } - - if (Owner->Vel.LengthSquared() <= 12*12) - return; - - AActor *speedMo = Spawn("PlayerSpeedTrail", Owner->Pos(), NO_REPLACE); - if (speedMo) - { - speedMo->Angles.Yaw = Owner->Angles.Yaw; - speedMo->Translation = Owner->Translation; - speedMo->target = Owner; - speedMo->sprite = Owner->sprite; - speedMo->frame = Owner->frame; - speedMo->Floorclip = Owner->Floorclip; - - // [BC] Also get the scale from the owner. - speedMo->Scale = Owner->Scale; - - if (Owner == players[consoleplayer].camera && - !(Owner->player->cheats & CF_CHASECAM)) - { - speedMo->renderflags |= RF_INVISIBLE; - } - } -} - // Morph powerup ------------------------------------------------------ IMPLEMENT_CLASS(APowerMorph, false, true) diff --git a/src/g_inventory/a_artifacts.h b/src/g_inventory/a_artifacts.h index 6045b5c42..b3143cfaa 100644 --- a/src/g_inventory/a_artifacts.h +++ b/src/g_inventory/a_artifacts.h @@ -152,8 +152,6 @@ class APowerSpeed : public APowerup { DECLARE_CLASS (APowerSpeed, APowerup) protected: - virtual void DoEffect () override; - virtual void Serialize(FSerializer &arc) override; public: int SpeedFlags; diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index 9a533f020..a3f5c144c 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -472,7 +472,7 @@ static const struct FFlagList { const PClass * const *Type; FFlagDef *Defs; int { &RUNTIME_CLASS_CASTLESS(AInventory), InventoryFlagDefs, countof(InventoryFlagDefs), 3 }, { &RUNTIME_CLASS_CASTLESS(AWeapon), WeaponFlagDefs, countof(WeaponFlagDefs), 3 }, { &RUNTIME_CLASS_CASTLESS(APlayerPawn), PlayerPawnFlagDefs, countof(PlayerPawnFlagDefs), 3 }, - { &RUNTIME_CLASS_CASTLESS(APowerSpeed), PowerSpeedFlagDefs, countof(PowerSpeedFlagDefs), 3 }, + { &RUNTIME_CLASS_CASTLESS(APowerSpeed), PowerSpeedFlagDefs, countof(PowerSpeedFlagDefs), 1 }, }; #define NUM_FLAG_LISTS (countof(FlagLists)) diff --git a/wadsrc/static/zscript/inventory/powerups.txt b/wadsrc/static/zscript/inventory/powerups.txt index 305b0d638..12a1cc408 100644 --- a/wadsrc/static/zscript/inventory/powerups.txt +++ b/wadsrc/static/zscript/inventory/powerups.txt @@ -133,9 +133,18 @@ class PowerWeaponLevel2 : Powerup native } } +//=========================================================================== +// +// Speed +// +//=========================================================================== + class PowerSpeed : Powerup native { native int SpeedFlags; + + const PSF_NOTRAIL = 1; + Default { @@ -145,7 +154,67 @@ class PowerSpeed : Powerup native +INVENTORY.NOTELEPORTFREEZE } - override double GetSpeedFactor() { return Speed; } + override double GetSpeedFactor() + { + return Speed; + } + + //=========================================================================== + // + // APowerSpeed :: DoEffect + // + //=========================================================================== + + override void DoEffect () + { + Super.DoEffect (); + + if (Owner == NULL || Owner.player == NULL) + return; + + if (Owner.player.cheats & CF_PREDICTING) + return; + + if (SpeedFlags & PSF_NOTRAIL) + return; + + if (level.time & 1) + return; + + // Check if another speed item is present to avoid multiple drawing of the speed trail. + // Only the last PowerSpeed without PSF_NOTRAIL set will actually draw the trail. + for (Inventory item = Inv; item != NULL; item = item.Inv) + { + let sitem = PowerSpeed(item); + if (sitem != null && !(sitem.SpeedFlags & PSF_NOTRAIL)) + { + return; + } + } + + if (Owner.Vel.Length() <= 12) + return; + + Actor speedMo = Spawn("PlayerSpeedTrail", Owner.Pos, NO_REPLACE); + if (speedMo) + { + speedMo.Angle = Owner.Angle; + speedMo.Translation = Owner.Translation; + speedMo.target = Owner; + speedMo.sprite = Owner.sprite; + speedMo.frame = Owner.frame; + speedMo.Floorclip = Owner.Floorclip; + + // [BC] Also get the scale from the owner. + speedMo.Scale = Owner.Scale; + + if (Owner == players[consoleplayer].camera && + !(Owner.player.cheats & CF_CHASECAM)) + { + speedMo.bInvisible = true; + } + } + } } // Player Speed Trail (used by the Speed Powerup) ---------------------------- @@ -170,6 +239,12 @@ class PlayerSpeedTrail : Actor } } +//=========================================================================== +// +// Minotaur +// +//=========================================================================== + class PowerMinotaur : Powerup { Default @@ -179,6 +254,12 @@ class PowerMinotaur : Powerup } } +//=========================================================================== +// +// Targeter +// +//=========================================================================== + class PowerTargeter : Powerup { Default