- moved identical damage checks in P_DamageMobj into an inline function.

SVN r3650 (trunk)
This commit is contained in:
Christoph Oelckers 2012-05-13 08:04:58 +00:00
parent 3a24790056
commit ddf1af455b

View file

@ -879,6 +879,12 @@ void P_AutoUseStrifeHealth (player_t *player)
================== ==================
*/ */
static inline bool MustForcePain(AActor *target, AActor *inflictor)
{
return (!(target->flags5 & MF5_NOPAIN) && inflictor != NULL &&
(inflictor->flags6 & MF6_FORCEPAIN) && !(inflictor->flags5 & MF5_PAINLESS));
}
void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, FName mod, int flags) void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, FName mod, int flags)
{ {
@ -998,8 +1004,7 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
source->Inventory->ModifyDamage(olddam, mod, damage, false); source->Inventory->ModifyDamage(olddam, mod, damage, false);
if (olddam != damage && damage <= 0) if (olddam != damage && damage <= 0)
{ // Still allow FORCEPAIN { // Still allow FORCEPAIN
if (!(target->flags5 & MF5_NOPAIN) && inflictor != NULL && if (MustForcePain(target, inflictor))
(inflictor->flags6 & MF6_FORCEPAIN) && !(inflictor->flags5 & MF5_PAINLESS))
{ {
goto dopain; goto dopain;
} }
@ -1013,8 +1018,7 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
target->Inventory->ModifyDamage(olddam, mod, damage, true); target->Inventory->ModifyDamage(olddam, mod, damage, true);
if (olddam != damage && damage <= 0) if (olddam != damage && damage <= 0)
{ // Still allow FORCEPAIN { // Still allow FORCEPAIN
if (!(target->flags5 & MF5_NOPAIN) && inflictor != NULL && if (MustForcePain(target, inflictor))
(inflictor->flags6 & MF6_FORCEPAIN) && !(inflictor->flags5 & MF5_PAINLESS))
{ {
goto dopain; goto dopain;
} }
@ -1031,8 +1035,7 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
} }
if (damage <= 0) if (damage <= 0)
{ // Still allow FORCEPAIN { // Still allow FORCEPAIN
if (!(target->flags5 & MF5_NOPAIN) && inflictor != NULL && if (MustForcePain(target, inflictor))
(inflictor->flags6 & MF6_FORCEPAIN) && !(inflictor->flags5 & MF5_PAINLESS))
{ {
goto dopain; goto dopain;
} }