From 38e2c999c56f1bdcd0d8926db3127b6758ef6787 Mon Sep 17 00:00:00 2001 From: lachwright Date: Sun, 14 Jun 2020 12:17:30 +0800 Subject: [PATCH 1/3] Platform fixes --- src/p_map.c | 8 ++++++++ src/p_user.c | 13 ++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 00b8761c8..6cc3b5ac0 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 diff --git a/src/p_user.c b/src/p_user.c index e07ddaec5..98542ad17 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2291,6 +2291,7 @@ boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) { boolean clipmomz; + CONS_Printf("Hit floor! %u\n", dorollstuff); I_Assert(player->mo != NULL); @@ -2301,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; @@ -2402,7 +2404,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); @@ -5146,6 +5148,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; @@ -5519,7 +5522,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; @@ -5531,7 +5534,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) { @@ -8411,7 +8414,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) && player->powers[pw_invulnerability] <= 1) + if ((onground || player->climbing) && !(player->pflags & (PF_JUMPED|PF_BOUNCING)) && 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) From 29738fcdd007590bec7e19c2fd160081f96ea973 Mon Sep 17 00:00:00 2001 From: lachwright Date: Wed, 17 Jun 2020 01:46:36 +0800 Subject: [PATCH 2/3] Allow Fang to bounce on solid rising floors without taking damage/losing all scorechain --- src/p_map.c | 9 +++++++-- src/p_user.c | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 6cc3b5ac0..c9342a74f 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -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 diff --git a/src/p_user.c b/src/p_user.c index 98542ad17..20292dd08 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -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) From cdb247d08f16bd1667e2c2e7838bbb061bcad409 Mon Sep 17 00:00:00 2001 From: Lachlan Date: Sat, 4 Jul 2020 05:25:34 +0800 Subject: [PATCH 3/3] Fix compiler warning --- src/p_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index c9342a74f..ad044c978 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2933,7 +2933,7 @@ static boolean P_ThingHeightClip(mobj_t *thing) boolean onfloor = P_IsObjectOnGround(thing);//(thing->z <= thing->floorz); ffloor_t *rover = NULL; boolean bouncing; - boolean hitfloor; + boolean hitfloor = false; if (thing->flags & MF_NOCLIPHEIGHT) return true;