Merge branch 'candamagefix' into 'master'

P_PlayerCanDamage fix

See merge request STJr/SRB2Internal!291
This commit is contained in:
Monster Iestyn 2019-08-26 11:32:10 -04:00
commit ab90526541
1 changed files with 19 additions and 4 deletions

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))