Allow Fang to bounce on solid rising floors without taking damage/losing all scorechain

This commit is contained in:
lachwright 2020-06-17 01:46:36 +08:00
parent 38e2c999c5
commit 29738fcdd0
2 changed files with 10 additions and 3 deletions

View file

@ -2932,6 +2932,8 @@ static boolean P_ThingHeightClip(mobj_t *thing)
ffloor_t *oldceilingrover = thing->ceilingrover;
boolean onfloor = P_IsObjectOnGround(thing);//(thing->z <= thing->floorz);
ffloor_t *rover = NULL;
boolean bouncing;
boolean hitfloor;
if (thing->flags & MF_NOCLIPHEIGHT)
return true;
@ -2954,7 +2956,9 @@ static boolean P_ThingHeightClip(mobj_t *thing)
if (tmfloorz > oldfloorz+thing->height)
return true;
if (onfloor && !(thing->flags & MF_NOGRAVITY) && floormoved)
bouncing = thing->player && thing->state-states == S_PLAY_BOUNCE_LANDING && P_IsObjectOnGround(thing);
if ((onfloor || bouncing) && !(thing->flags & MF_NOGRAVITY) && floormoved)
{
rover = (thing->eflags & MFE_VERTICALFLIP) ? oldceilingrover : oldfloorrover;
@ -2962,6 +2966,7 @@ static boolean P_ThingHeightClip(mobj_t *thing)
// If ~FF_EXISTS, don't set mobj Z.
if (!rover || ((rover->flags & FF_EXISTS) && (rover->flags & FF_SOLID)))
{
hitfloor = bouncing;
if (thing->eflags & MFE_VERTICALFLIP)
thing->pmomz = thing->ceilingz - (thing->z + thing->height);
else
@ -2986,7 +2991,7 @@ static boolean P_ThingHeightClip(mobj_t *thing)
thing->z = thing->ceilingz - thing->height;
}
if (P_MobjFlip(thing)*(thing->z - oldz) > 0 && thing->player)
if ((P_MobjFlip(thing)*(thing->z - oldz) > 0 || hitfloor) && thing->player)
P_PlayerHitFloor(thing->player, !onfloor);
// debug: be sure it falls to the floor

View file

@ -2319,6 +2319,8 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff)
if (player->scoreadd)
player->scoreadd--;
}
else
player->mo->z += P_MobjFlip(player->mo);
clipmomz = false;
}
else
@ -8414,7 +8416,7 @@ static void P_MovePlayer(player_t *player)
// Also keep in mind the PF_JUMPED check.
// If we lacked this, stepping up while jumping up would reset score.
// (for instance, when climbing up off a wall.)
if ((onground || player->climbing) && !(player->pflags & (PF_JUMPED|PF_BOUNCING)) && player->powers[pw_invulnerability] <= 1)
if ((onground || player->climbing) && !(player->pflags & PF_JUMPED) && player->powers[pw_invulnerability] <= 1)
P_ResetScore(player);
// Show the "THOK!" graphic when spinning quickly across the ground. (even applies to non-spinners, in the case of zoom tubes)