diff --git a/src/p_map.c b/src/p_map.c index 18d6a1853..9fff1f693 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2823,14 +2823,22 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) P_HandleSlopeLanding(thing, tmfloorslope); if (thing->momz <= 0) + { 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)) { if (!startingonground && tmceilingslope) P_HandleSlopeLanding(thing, tmceilingslope); if (thing->momz >= 0) + { 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 @@ -2924,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 = false; if (thing->flags & MF_NOCLIPHEIGHT) return true; @@ -2946,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; @@ -2954,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 @@ -2978,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 diff --git a/src/p_user.c b/src/p_user.c index aa5141472..bc382a452 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2302,7 +2302,8 @@ boolean P_PlayerHitFloor(player_t *player, boolean 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; else if (!(player->pflags & PF_STARTDASH)) player->pflags &= ~PF_SPINNING; @@ -2318,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 @@ -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->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); @@ -5147,6 +5150,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) player->mo->momz = 0; player->pflags &= ~(PF_STARTJUMP|PF_SPINNING); + player->secondjump = 1; } } break; @@ -5520,7 +5524,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) else potentialmomz = ((player->speed < 10*player->mo->scale) ? (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) player->mo->momz = P_MobjFlip(player->mo)*potentialmomz; player->pflags &= ~PF_SPINNING; @@ -5532,7 +5536,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) player->pflags &= ~PF_JUMPDOWN; // 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) {