mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-03-07 20:01:21 +00:00
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:
parent
fac04cf853
commit
6f63c2c499
1 changed files with 19 additions and 4 deletions
23
src/p_user.c
23
src/p_user.c
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue