- 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 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 - A_ZoomFactor now scales turning with the FOV by default. ZOOM_NOSCALETURNING
will leave it unaltered. will leave it unaltered.
- Added Gez's PowerInvisibility changes. - Added Gez's PowerInvisibility changes.

View file

@ -118,6 +118,7 @@ public:
int crouchsprite; int crouchsprite;
int MaxHealth; int MaxHealth;
int RunHealth; int RunHealth;
int PlayerFlags;
TObjPtr<AInventory> InvFirst; // first inventory item displayed on inventory bar TObjPtr<AInventory> InvFirst; // first inventory item displayed on inventory bar
TObjPtr<AInventory> InvSel; // selected inventory item TObjPtr<AInventory> InvSel; // selected inventory item
@ -145,6 +146,14 @@ class APlayerChunk : public APlayerPawn
DECLARE_CLASS (APlayerChunk, APlayerPawn) DECLARE_CLASS (APlayerChunk, APlayerPawn)
}; };
//
// PlayerPawn flags
//
enum
{
PPF_NOTHRUSTWHENINVUL = 1, // Attacks do not thrust the player if they are invulnerable.
};
// //
// Player states. // 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)) if ((target->flags2 & MF2_INVULNERABLE) && damage < 1000000 && !(flags & DMG_FORCED))
{ // actor is invulnerable { // actor is invulnerable
if (!target->player) if (target->player == NULL)
{ {
if (!inflictor || !(inflictor->flags3 & MF3_FOILINVUL)) if (inflictor == NULL || !(inflictor->flags3 & MF3_FOILINVUL))
{ {
return; return;
} }
} }
else else
{ {
// Only in Hexen invulnerable players are excluded from getting // Players are optionally excluded from getting thrust by damage.
// thrust by damage. if (static_cast<APlayerPawn *>(target)->PlayerFlags & PPF_NOTHRUSTWHENINVUL)
if (gameinfo.gametype == GAME_Hexen) return; {
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 if (inflictor && inflictor != target // [RH] Not if hurting own self
&& !(target->flags & MF_NOCLIP) && !(target->flags & MF_NOCLIP)
&& !(inflictor->flags2 & MF2_NODMGTHRUST) && !(inflictor->flags2 & MF2_NODMGTHRUST)
&& !(flags & DMG_THRUSTLESS)) && !(flags & DMG_THRUSTLESS)
&& (source == NULL || source->player == NULL || !(source->flags2 & MF2_NODMGTHRUST)))
{ {
int kickback; int kickback;

View file

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

View file

@ -264,7 +264,6 @@ static FFlagDef InventoryFlags[] =
DEFINE_FLAG(IF, PERSISTENTPOWER, AInventory, ItemFlags), DEFINE_FLAG(IF, PERSISTENTPOWER, AInventory, ItemFlags),
DEFINE_DEPRECATED_FLAG(PICKUPFLASH), DEFINE_DEPRECATED_FLAG(PICKUPFLASH),
}; };
static FFlagDef WeaponFlags[] = static FFlagDef WeaponFlags[] =
@ -292,13 +291,20 @@ static FFlagDef WeaponFlags[] =
DEFINE_DUMMY_FLAG(NOLMS), 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[] = static const struct { const PClass *Type; FFlagDef *Defs; int NumDefs; } FlagLists[] =
{ {
{ RUNTIME_CLASS(AActor), ActorFlags, sizeof(ActorFlags)/sizeof(FFlagDef) }, { RUNTIME_CLASS(AActor), ActorFlags, countof(ActorFlags) },
{ RUNTIME_CLASS(AInventory), InventoryFlags, sizeof(InventoryFlags)/sizeof(FFlagDef) }, { RUNTIME_CLASS(AInventory), InventoryFlags, countof(InventoryFlags) },
{ RUNTIME_CLASS(AWeapon), WeaponFlags, sizeof(WeaponFlags)/sizeof(FFlagDef) } { 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 Height 64
Speed 1 Speed 1
+NOSKIN +NOSKIN
+NODAMAGETHRUST
+NOTHRUSTWHENINVUL
PainSound "PlayerClericPain" PainSound "PlayerClericPain"
RadiusDamageFactor 0.25 RadiusDamageFactor 0.25
Player.JumpZ 9.75 Player.JumpZ 9.75

View file

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

View file

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