From a61f5e452124d5e7c8187be76132a85eedba3853 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Fri, 23 Dec 2016 23:58:12 +0000 Subject: [PATCH] * CA_BOUNCE can now break downwards. --- src/p_map.c | 6 ++++-- src/p_user.c | 46 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index d31f46ba0..943f20313 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1508,7 +1508,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) else if (thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE)) ; else if (!((rover->flags & FF_BLOCKPLAYER && thing->player) - || (rover->flags & FF_BLOCKOTHERS && !thing->player) + || (rover->flags & FF_BLOCKOTHERS && !thing->player) || rover->flags & FF_QUICKSAND)) continue; @@ -1533,7 +1533,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) + ((topheight - bottomheight)/2)); if (topheight > tmfloorz && abs(delta1) < abs(delta2) - && !(rover->flags & FF_REVERSEPLATFORM)) + && !(rover->flags & FF_REVERSEPLATFORM) + && ((P_MobjFlip(tmthing)*tmthing->momz >= 0) || (!(rover->flags & FF_PLATFORM)))) { tmfloorz = tmdropoffz = topheight; #ifdef ESLOPE @@ -1542,6 +1543,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) } if (bottomheight < tmceilingz && abs(delta1) >= abs(delta2) && !(rover->flags & FF_PLATFORM) + && ((P_MobjFlip(tmthing)*tmthing->momz >= 0) || (!(rover->flags & FF_REVERSEPLATFORM))) && !(thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE))) { tmceilingz = tmdrpoffceilz = bottomheight; diff --git a/src/p_user.c b/src/p_user.c index 666e8d72d..a71491c7d 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1746,10 +1746,13 @@ static void P_CheckBustableBlocks(player_t *player) oldx = player->mo->x; oldy = player->mo->y; - P_UnsetThingPosition(player->mo); - player->mo->x += player->mo->momx; - player->mo->y += player->mo->momy; - P_SetThingPosition(player->mo); + if (!(player->pflags & PF_BOUNCING)) // Bouncers only get to break downwards, not sideways + { + P_UnsetThingPosition(player->mo); + player->mo->x += player->mo->momx; + player->mo->y += player->mo->momy; + P_SetThingPosition(player->mo); + } for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next) { @@ -1769,7 +1772,7 @@ static void P_CheckBustableBlocks(player_t *player) { // If it's an FF_SPINBUST, you have to either be jumping, or coming down // onto the top from a spin. - if (rover->flags & FF_SPINBUST && ((!(player->pflags & PF_JUMPED) && !(player->pflags & PF_SPINNING)) || (player->pflags & PF_STARTDASH))) + if (rover->flags & FF_SPINBUST && ((!(player->pflags & PF_JUMPED) && !(player->pflags & PF_SPINNING) && !(player->pflags & PF_BOUNCING)) || (player->pflags & PF_STARTDASH))) continue; // if it's not an FF_SHATTER, you must be spinning (and not jumping) @@ -1784,6 +1787,7 @@ static void P_CheckBustableBlocks(player_t *player) && !((player->pflags & PF_SPINNING) && !(player->pflags & PF_JUMPED)) && !(player->powers[pw_super]) && !(player->charability == CA_GLIDEANDCLIMB) + && !(player->pflags & PF_BOUNCING) && !((player->charability == CA_DASHMODE) && (player->dashmode >= 3*TICRATE)) && !((player->charability == CA_TWINSPIN) && (player->panim == PA_ABILITY)) && !(player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2) @@ -1794,6 +1798,7 @@ static void P_CheckBustableBlocks(player_t *player) // Only players with CA_GLIDEANDCLIMB, or CA_TWINSPIN/CA2_MELEE users can break this rock... if (!(rover->flags & FF_SHATTER) && (rover->flags & FF_ONLYKNUX) && !(player->charability == CA_GLIDEANDCLIMB + || (player->pflags & PF_BOUNCING) || ((player->charability == CA_TWINSPIN) && (player->panim == PA_ABILITY)) || (player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2))) continue; @@ -1801,6 +1806,24 @@ static void P_CheckBustableBlocks(player_t *player) topheight = P_GetFOFTopZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL); bottomheight = P_GetFOFBottomZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL); + if (player->pflags & PF_BOUNCING) + { + if (player->mo->eflags & MFE_VERTICALFLIP) + { + if (player->mo->momz <= 0) + continue; + topheight += player->mo->momz; + bottomheight += player->mo->momz; + } + else + { + if (player->mo->momz >= 0) + continue; + topheight -= player->mo->momz; + bottomheight -= player->mo->momz; + } + } + // Height checks if (rover->flags & FF_SHATTERBOTTOM) { @@ -1859,10 +1882,13 @@ static void P_CheckBustableBlocks(player_t *player) } } bustupdone: - P_UnsetThingPosition(player->mo); - player->mo->x = oldx; - player->mo->y = oldy; - P_SetThingPosition(player->mo); + if (!(player->pflags & PF_BOUNCING)) + { + P_UnsetThingPosition(player->mo); + player->mo->x = oldx; + player->mo->y = oldy; + P_SetThingPosition(player->mo); + } } static void P_CheckBouncySectors(player_t *player) @@ -6735,7 +6761,7 @@ static void P_MovePlayer(player_t *player) // Bouncing... if (player->pflags & PF_BOUNCING) { - if (!(player->pflags & PF_JUMPDOWN)) // If not holding the jump button + if (!(player->pflags & PF_JUMPDOWN) || onground) // If not holding the jump button { P_ResetPlayer(player); // down, stop bouncing. if (onground)