- MF2_NODMGTHRUST now works with players, too. (Previously, it was only for

missiles.) Also added PPF_NOTHRUSTWHILEINVUL to prevent invulnerable players
  from being thrusted while taking damage. (Non-players were already
  unthrusted.)


SVN r1695 (trunk)
This commit is contained in:
Randy Heit 2009-06-30 23:23:12 +00:00
parent 37b6e547cd
commit f2b7417020
8 changed files with 43 additions and 11 deletions

View file

@ -1,4 +1,8 @@
June 30, 2009
- MF2_NODMGTHRUST now works with players, too. (Previously, it was only for
missiles.) Also added PPF_NOTHRUSTWHILEINVUL to prevent invulnerable players
from being thrusted while taking damage. (Non-players were already
unthrusted.)
- A_ZoomFactor now scales turning with the FOV by default. ZOOM_NOSCALETURNING
will leave it unaltered.
- Added Gez's PowerInvisibility changes.

View file

@ -118,6 +118,7 @@ public:
int crouchsprite;
int MaxHealth;
int RunHealth;
int PlayerFlags;
TObjPtr<AInventory> InvFirst; // first inventory item displayed on inventory bar
TObjPtr<AInventory> InvSel; // selected inventory item
@ -145,6 +146,14 @@ class APlayerChunk : public APlayerPawn
DECLARE_CLASS (APlayerChunk, APlayerPawn)
};
//
// PlayerPawn flags
//
enum
{
PPF_NOTHRUSTWHENINVUL = 1, // Attacks do not thrust the player if they are invulnerable.
};
//
// Player states.
//

View file

@ -916,18 +916,20 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
}
if ((target->flags2 & MF2_INVULNERABLE) && damage < 1000000 && !(flags & DMG_FORCED))
{ // actor is invulnerable
if (!target->player)
if (target->player == NULL)
{
if (!inflictor || !(inflictor->flags3 & MF3_FOILINVUL))
if (inflictor == NULL || !(inflictor->flags3 & MF3_FOILINVUL))
{
return;
}
}
else
{
// Only in Hexen invulnerable players are excluded from getting
// thrust by damage.
if (gameinfo.gametype == GAME_Hexen) return;
// Players are optionally excluded from getting thrust by damage.
if (static_cast<APlayerPawn *>(target)->PlayerFlags & PPF_NOTHRUSTWHENINVUL)
{
return;
}
}
}
@ -1024,7 +1026,8 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
if (inflictor && inflictor != target // [RH] Not if hurting own self
&& !(target->flags & MF_NOCLIP)
&& !(inflictor->flags2 & MF2_NODMGTHRUST)
&& !(flags & DMG_THRUSTLESS))
&& !(flags & DMG_THRUSTLESS)
&& (source == NULL || source->player == NULL || !(source->flags2 & MF2_NODMGTHRUST)))
{
int kickback;

View file

@ -425,6 +425,10 @@ void APlayerPawn::Serialize (FArchive &arc)
<< InvSel
<< MorphWeapon
<< DamageFade;
if (SaveVersion >= 1695)
{
arc << PlayerFlags;
}
}
//===========================================================================

View file

@ -264,7 +264,6 @@ static FFlagDef InventoryFlags[] =
DEFINE_FLAG(IF, PERSISTENTPOWER, AInventory, ItemFlags),
DEFINE_DEPRECATED_FLAG(PICKUPFLASH),
};
static FFlagDef WeaponFlags[] =
@ -292,13 +291,20 @@ static FFlagDef WeaponFlags[] =
DEFINE_DUMMY_FLAG(NOLMS),
};
static FFlagDef PlayerPawnFlags[] =
{
// PlayerPawn flags
DEFINE_FLAG(PPF, NOTHRUSTWHENINVUL, APlayerPawn, PlayerFlags),
};
static const struct { const PClass *Type; FFlagDef *Defs; int NumDefs; } FlagLists[] =
{
{ RUNTIME_CLASS(AActor), ActorFlags, sizeof(ActorFlags)/sizeof(FFlagDef) },
{ RUNTIME_CLASS(AInventory), InventoryFlags, sizeof(InventoryFlags)/sizeof(FFlagDef) },
{ RUNTIME_CLASS(AWeapon), WeaponFlags, sizeof(WeaponFlags)/sizeof(FFlagDef) }
{ RUNTIME_CLASS(AActor), ActorFlags, countof(ActorFlags) },
{ RUNTIME_CLASS(AInventory), InventoryFlags, countof(InventoryFlags) },
{ RUNTIME_CLASS(AWeapon), WeaponFlags, countof(WeaponFlags) },
{ RUNTIME_CLASS(APlayerPawn), PlayerPawnFlags,countof(PlayerPawnFlags) },
};
#define NUM_FLAG_LISTS 3
#define NUM_FLAG_LISTS (countof(FlagLists))
//==========================================================================
//

View file

@ -9,6 +9,8 @@ ACTOR ClericPlayer : PlayerPawn
Height 64
Speed 1
+NOSKIN
+NODAMAGETHRUST
+NOTHRUSTWHENINVUL
PainSound "PlayerClericPain"
RadiusDamageFactor 0.25
Player.JumpZ 9.75

View file

@ -8,6 +8,8 @@ ACTOR FighterPlayer : PlayerPawn
Height 64
Speed 1
+NOSKIN
+NODAMAGETHRUST
+NOTHRUSTWHENINVUL
PainSound "PlayerFighterPain"
RadiusDamageFactor 0.25
Player.JumpZ 9.75

View file

@ -9,6 +9,8 @@ ACTOR MagePlayer : PlayerPawn
Height 64
Speed 1
+NOSKIN
+NODAMAGETHRUST
+NOTHRUSTWHENINVUL
PainSound "PlayerMagePain"
RadiusDamageFactor 0.25
Player.JumpZ 9.75