mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2025-01-18 21:21:36 +00:00
- Added NOTRAIL flag for PowerSpeed.
SVN r4146 (trunk)
This commit is contained in:
parent
ae6b0c6215
commit
bd601a1bc8
4 changed files with 48 additions and 6 deletions
|
@ -1156,6 +1156,24 @@ void APlayerSpeedTrail::Tick ()
|
|||
|
||||
IMPLEMENT_CLASS (APowerSpeed)
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APowerSpeed :: Serialize
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void APowerSpeed::Serialize(FArchive &arc)
|
||||
{
|
||||
if (SaveVersion < 4146)
|
||||
{
|
||||
SpeedFlags = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
arc << SpeedFlags;
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APowerSpeed :: GetSpeedFactor
|
||||
|
@ -1164,8 +1182,10 @@ IMPLEMENT_CLASS (APowerSpeed)
|
|||
|
||||
fixed_t APowerSpeed ::GetSpeedFactor ()
|
||||
{
|
||||
if (Inventory != NULL) return FixedMul(Speed, Inventory->GetSpeedFactor());
|
||||
else return Speed;
|
||||
if (Inventory != NULL)
|
||||
return FixedMul(Speed, Inventory->GetSpeedFactor());
|
||||
else
|
||||
return Speed;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -1184,12 +1204,22 @@ void APowerSpeed::DoEffect ()
|
|||
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.
|
||||
if (Inventory != NULL && Inventory->GetSpeedFactor() > FRACUNIT)
|
||||
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<APowerSpeed *>(item)->SpeedFlags & PSF_NOTRAIL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (P_AproxDistance (Owner->velx, Owner->vely) <= 12*FRACUNIT)
|
||||
return;
|
||||
|
|
|
@ -143,9 +143,14 @@ class APowerSpeed : public APowerup
|
|||
DECLARE_CLASS (APowerSpeed, APowerup)
|
||||
protected:
|
||||
void DoEffect ();
|
||||
void Serialize(FArchive &arc);
|
||||
fixed_t GetSpeedFactor();
|
||||
public:
|
||||
int SpeedFlags;
|
||||
};
|
||||
|
||||
#define PSF_NOTRAIL 1
|
||||
|
||||
class APowerMinotaur : public APowerup
|
||||
{
|
||||
DECLARE_CLASS (APowerMinotaur, APowerup)
|
||||
|
|
|
@ -338,12 +338,19 @@ static FFlagDef PlayerPawnFlags[] =
|
|||
DEFINE_FLAG(PPF, CANSUPERMORPH, APlayerPawn, PlayerFlags),
|
||||
};
|
||||
|
||||
static FFlagDef PowerSpeedFlags[] =
|
||||
{
|
||||
// PowerSpeed flags
|
||||
DEFINE_FLAG(PSF, NOTRAIL, APowerSpeed, SpeedFlags),
|
||||
};
|
||||
|
||||
static const struct FFlagList { const PClass *Type; FFlagDef *Defs; int NumDefs; } FlagLists[] =
|
||||
{
|
||||
{ RUNTIME_CLASS(AActor), ActorFlags, countof(ActorFlags) },
|
||||
{ RUNTIME_CLASS(AInventory), InventoryFlags, countof(InventoryFlags) },
|
||||
{ RUNTIME_CLASS(AWeapon), WeaponFlags, countof(WeaponFlags) },
|
||||
{ RUNTIME_CLASS(APlayerPawn), PlayerPawnFlags,countof(PlayerPawnFlags) },
|
||||
{ RUNTIME_CLASS(APowerSpeed), PowerSpeedFlags,countof(PowerSpeedFlags) },
|
||||
};
|
||||
#define NUM_FLAG_LISTS (countof(FlagLists))
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ ACTOR PowerWeaponLevel2 : Powerup native
|
|||
Inventory.Icon "SPINBK0"
|
||||
}
|
||||
|
||||
ACTOR PowerSpeed: Powerup native
|
||||
ACTOR PowerSpeed : Powerup native
|
||||
{
|
||||
Powerup.Duration -45
|
||||
Speed 1.5
|
||||
|
|
Loading…
Reference in a new issue