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; ffloor_t *oldceilingrover = thing->ceilingrover;
boolean onfloor = P_IsObjectOnGround(thing);//(thing->z <= thing->floorz); boolean onfloor = P_IsObjectOnGround(thing);//(thing->z <= thing->floorz);
ffloor_t *rover = NULL; ffloor_t *rover = NULL;
boolean bouncing;
boolean hitfloor;
if (thing->flags & MF_NOCLIPHEIGHT) if (thing->flags & MF_NOCLIPHEIGHT)
return true; return true;
@ -2954,7 +2956,9 @@ static boolean P_ThingHeightClip(mobj_t *thing)
if (tmfloorz > oldfloorz+thing->height) if (tmfloorz > oldfloorz+thing->height)
return true; 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; 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 ~FF_EXISTS, don't set mobj Z.
if (!rover || ((rover->flags & FF_EXISTS) && (rover->flags & FF_SOLID))) if (!rover || ((rover->flags & FF_EXISTS) && (rover->flags & FF_SOLID)))
{ {
hitfloor = bouncing;
if (thing->eflags & MFE_VERTICALFLIP) if (thing->eflags & MFE_VERTICALFLIP)
thing->pmomz = thing->ceilingz - (thing->z + thing->height); thing->pmomz = thing->ceilingz - (thing->z + thing->height);
else else
@ -2986,7 +2991,7 @@ static boolean P_ThingHeightClip(mobj_t *thing)
thing->z = thing->ceilingz - thing->height; 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); P_PlayerHitFloor(thing->player, !onfloor);
// debug: be sure it falls to the floor // 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) if (player->scoreadd)
player->scoreadd--; player->scoreadd--;
} }
else
player->mo->z += P_MobjFlip(player->mo);
clipmomz = false; clipmomz = false;
} }
else else
@ -8414,7 +8416,7 @@ static void P_MovePlayer(player_t *player)
// Also keep in mind the PF_JUMPED check. // Also keep in mind the PF_JUMPED check.
// If we lacked this, stepping up while jumping up would reset score. // If we lacked this, stepping up while jumping up would reset score.
// (for instance, when climbing up off a wall.) // (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); P_ResetScore(player);
// Show the "THOK!" graphic when spinning quickly across the ground. (even applies to non-spinners, in the case of zoom tubes) // Show the "THOK!" graphic when spinning quickly across the ground. (even applies to non-spinners, in the case of zoom tubes)