Merge branch 'more-platform-fixes' into 'next'

More platform fixes

See merge request STJr/SRB2!999
This commit is contained in:
LJ Sonic 2020-07-04 07:07:17 -04:00
commit 804ba6da9e
2 changed files with 23 additions and 6 deletions

View file

@ -2823,14 +2823,22 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
P_HandleSlopeLanding(thing, tmfloorslope); P_HandleSlopeLanding(thing, tmfloorslope);
if (thing->momz <= 0) if (thing->momz <= 0)
{
thing->standingslope = tmfloorslope; thing->standingslope = tmfloorslope;
if (thing->momz == 0 && thing->player && !startingonground)
P_PlayerHitFloor(thing->player, true);
}
} }
else if (thing->z+thing->height >= tmceilingz && (thing->eflags & MFE_VERTICALFLIP)) { else if (thing->z+thing->height >= tmceilingz && (thing->eflags & MFE_VERTICALFLIP)) {
if (!startingonground && tmceilingslope) if (!startingonground && tmceilingslope)
P_HandleSlopeLanding(thing, tmceilingslope); P_HandleSlopeLanding(thing, tmceilingslope);
if (thing->momz >= 0) if (thing->momz >= 0)
{
thing->standingslope = tmceilingslope; thing->standingslope = tmceilingslope;
if (thing->momz == 0 && thing->player && !startingonground)
P_PlayerHitFloor(thing->player, true);
}
} }
} }
else // don't set standingslope if you're not going to clip against it else // don't set standingslope if you're not going to clip against it
@ -2924,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 = false;
if (thing->flags & MF_NOCLIPHEIGHT) if (thing->flags & MF_NOCLIPHEIGHT)
return true; return true;
@ -2946,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;
@ -2954,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
@ -2978,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

@ -2302,7 +2302,8 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff)
{ {
if (dorollstuff) if (dorollstuff)
{ {
if ((player->charability2 == CA2_SPINDASH) && !((player->pflags & (PF_SPINNING|PF_THOKKED)) == PF_THOKKED) && (player->cmd.buttons & BT_USE) && (FixedHypot(player->mo->momx, player->mo->momy) > (5*player->mo->scale))) if ((player->charability2 == CA2_SPINDASH) && !((player->pflags & (PF_SPINNING|PF_THOKKED)) == PF_THOKKED) && !(player->charability == CA_THOK && player->secondjump)
&& (player->cmd.buttons & BT_USE) && (FixedHypot(player->mo->momx, player->mo->momy) > (5*player->mo->scale)))
player->pflags = (player->pflags|PF_SPINNING) & ~PF_THOKKED; player->pflags = (player->pflags|PF_SPINNING) & ~PF_THOKKED;
else if (!(player->pflags & PF_STARTDASH)) else if (!(player->pflags & PF_STARTDASH))
player->pflags &= ~PF_SPINNING; player->pflags &= ~PF_SPINNING;
@ -2318,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
@ -2403,7 +2406,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff)
; ;
else if (player->charability2 == CA2_GUNSLINGER && player->panim == PA_ABILITY2) else if (player->charability2 == CA2_GUNSLINGER && player->panim == PA_ABILITY2)
; ;
else if (player->panim != PA_IDLE && player->panim != PA_WALK && player->panim != PA_RUN && player->panim != PA_DASH) else if (dorollstuff && player->panim != PA_IDLE && player->panim != PA_WALK && player->panim != PA_RUN && player->panim != PA_DASH)
{ {
fixed_t runspd = FixedMul(player->runspeed, player->mo->scale); fixed_t runspd = FixedMul(player->runspeed, player->mo->scale);
@ -5147,6 +5150,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
player->mo->momz = 0; player->mo->momz = 0;
player->pflags &= ~(PF_STARTJUMP|PF_SPINNING); player->pflags &= ~(PF_STARTJUMP|PF_SPINNING);
player->secondjump = 1;
} }
} }
break; break;
@ -5520,7 +5524,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
else else
potentialmomz = ((player->speed < 10*player->mo->scale) potentialmomz = ((player->speed < 10*player->mo->scale)
? (player->speed - 10*player->mo->scale)/5 ? (player->speed - 10*player->mo->scale)/5
: -1); // Should be 0, but made negative to ensure P_PlayerHitFloor runs upon touching ground : 0);
if (P_MobjFlip(player->mo)*player->mo->momz < potentialmomz) if (P_MobjFlip(player->mo)*player->mo->momz < potentialmomz)
player->mo->momz = P_MobjFlip(player->mo)*potentialmomz; player->mo->momz = P_MobjFlip(player->mo)*potentialmomz;
player->pflags &= ~PF_SPINNING; player->pflags &= ~PF_SPINNING;
@ -5532,7 +5536,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
player->pflags &= ~PF_JUMPDOWN; player->pflags &= ~PF_JUMPDOWN;
// Repeat abilities, but not double jump! // Repeat abilities, but not double jump!
if (player->secondjump == 1 && player->charability != CA_DOUBLEJUMP && player->charability != CA_AIRDRILL) if (player->secondjump == 1 && player->charability != CA_DOUBLEJUMP && player->charability != CA_AIRDRILL && player->charability != CA_THOK)
{ {
if (player->charflags & SF_MULTIABILITY) if (player->charflags & SF_MULTIABILITY)
{ {