Fix P_PlayerCanDamage for CA_FLY and CA_BOUNCE to be less lenient in causing damage, by making them based off the top and bottom of the player object respectively rather than its vertical center.

This commit is contained in:
toaster 2019-08-13 20:11:44 +01:00
parent 37dd048f12
commit 598e9017b1

View file

@ -1051,6 +1051,8 @@ void P_ResetPlayer(player_t *player)
//
boolean P_PlayerCanDamage(player_t *player, mobj_t *thing)
{
fixed_t bottomheight, topheight;
if (!player->mo || player->spectator || !thing || P_MobjWasRemoved(thing))
return false;
@ -1090,13 +1092,26 @@ boolean P_PlayerCanDamage(player_t *player, mobj_t *thing)
return true;
// From the top/bottom.
if (P_MobjFlip(player->mo)*(player->mo->z - (thing->z + thing->height/2)) > 0)
bottomheight = player->mo->z;
topheight = player->mo->z + player->mo->height;
if (player->mo->eflags & MFE_VERTICALFLIP)
{
if ((player->charflags & SF_STOMPDAMAGE || player->pflags & PF_BOUNCING) && (P_MobjFlip(player->mo)*player->mo->momz < 0))
fixed_t swap = bottomheight;
bottomheight = topheight;
topheight = swap;
}
if (P_MobjFlip(player->mo)*(bottomheight - (thing->z + thing->height/2)) > 0)
{
if ((player->charflags & SF_STOMPDAMAGE || player->pflags & PF_BOUNCING) && (P_MobjFlip(player->mo)*(player->mo->momz - thing->momz) < 0))
return true;
}
else if (P_MobjFlip(player->mo)*(topheight - (thing->z + thing->height/2)) < 0)
{
if (player->charability == CA_FLY && player->panim == PA_ABILITY && (P_MobjFlip(player->mo)*(player->mo->momz - thing->momz) > 0))
return true;
}
else if (player->charability == CA_FLY && player->panim == PA_ABILITY)
return true;
// Shield stomp.
if (((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (player->pflags & PF_SHIELDABILITY))