- Fixed: Armor absorption did not take ALLOW/CAUSEPAIN flags into account.

This commit is contained in:
MajorCooke 2016-03-14 16:57:26 -05:00 committed by Christoph Oelckers
parent 0726a88ab9
commit 9ab620814d

View file

@ -942,7 +942,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
bool forcedPain = false; bool forcedPain = false;
int fakeDamage = 0; int fakeDamage = 0;
int holdDamage = 0; int holdDamage = 0;
int rawdamage = damage; const int rawdamage = damage;
if (damage < 0) damage = 0; if (damage < 0) damage = 0;
@ -1267,7 +1267,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
else else
return -1; return -1;
} }
// Armor for players.
if (!(flags & DMG_NO_ARMOR) && player->mo->Inventory != NULL) if (!(flags & DMG_NO_ARMOR) && player->mo->Inventory != NULL)
{ {
int newdam = damage; int newdam = damage;
@ -1283,12 +1283,18 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage,
if (damage <= 0) if (damage <= 0)
{ {
// [MC] Godmode doesn't need checking here, it's already being handled above.
if ((target->flags5 & MF5_NOPAIN) || (inflictor && (inflictor->flags5 & MF5_PAINLESS)))
return damage;
// If MF6_FORCEPAIN is set, make the player enter the pain state. // If MF6_FORCEPAIN is set, make the player enter the pain state.
if (!(target->flags5 & MF5_NOPAIN) && inflictor != NULL && if ((inflictor && (inflictor->flags6 & MF6_FORCEPAIN)))
(inflictor->flags6 & MF6_FORCEPAIN) && !(inflictor->flags5 & MF5_PAINLESS)
&& (!(player->mo->flags2 & MF2_INVULNERABLE)) && (!(player->cheats & CF_GODMODE)) && (!(player->cheats & CF_GODMODE2)))
{
goto dopain; goto dopain;
else if (((player->mo->flags7 & MF7_ALLOWPAIN) && (rawdamage > 0)) ||
(inflictor && (inflictor->flags7 & MF7_CAUSEPAIN)))
{
invulpain = true;
goto fakepain;
} }
return damage; return damage;
} }