diff --git a/src/p_map.c b/src/p_map.c index d8c48fa4f..c4616db48 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1271,7 +1271,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) topheight = P_GetFOFTopZ(thing, newsubsec->sector, rover, x, y, NULL); bottomheight = P_GetFOFBottomZ(thing, newsubsec->sector, rover, x, y, NULL); - if (rover->flags & FF_GOOWATER && !(thing->flags & MF_NOGRAVITY)) + if ((rover->flags & (FF_SWIMMABLE|FF_GOOWATER)) == (FF_SWIMMABLE|FF_GOOWATER) && !(thing->flags & MF_NOGRAVITY)) { // If you're inside goowater and slowing down fixed_t sinklevel = FixedMul(thing->info->height/6, thing->scale); diff --git a/src/p_mobj.c b/src/p_mobj.c index 0094b473f..343c735c8 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1553,6 +1553,7 @@ static void P_PushableCheckBustables(mobj_t *mo) if (node->m_sector->ffloors) { ffloor_t *rover; + fixed_t topheight, bottomheight; for (rover = node->m_sector->ffloors; rover; rover = rover->next) { @@ -1565,37 +1566,39 @@ static void P_PushableCheckBustables(mobj_t *mo) if (!rover->master->frontsector->crumblestate) { + topheight = P_GetFOFTopZ(mo, node->m_sector, rover, mo->x, mo->y, NULL); + bottomheight = P_GetFOFBottomZ(mo, node->m_sector, rover, mo->x, mo->y, NULL); // Height checks if (rover->flags & FF_SHATTERBOTTOM) { - if (mo->z+mo->momz + mo->height < *rover->bottomheight) + if (mo->z+mo->momz + mo->height < bottomheight) continue; - if (mo->z+mo->height > *rover->bottomheight) + if (mo->z+mo->height > bottomheight) continue; } else if (rover->flags & FF_SPINBUST) { - if (mo->z+mo->momz > *rover->topheight) + if (mo->z+mo->momz > topheight) continue; - if (mo->z+mo->height < *rover->bottomheight) + if (mo->z+mo->height < bottomheight) continue; } else if (rover->flags & FF_SHATTER) { - if (mo->z+mo->momz > *rover->topheight) + if (mo->z+mo->momz > topheight) continue; - if (mo->z+mo->momz + mo->height < *rover->bottomheight) + if (mo->z+mo->momz + mo->height < bottomheight) continue; } else { - if (mo->z >= *rover->topheight) + if (mo->z >= topheight) continue; - if (mo->z+mo->height < *rover->bottomheight) + if (mo->z+mo->height < bottomheight) continue; } diff --git a/src/p_user.c b/src/p_user.c index f390650f4..3867137ad 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1692,6 +1692,7 @@ static void P_CheckBustableBlocks(player_t *player) if (node->m_sector->ffloors) { ffloor_t *rover; + fixed_t topheight, bottomheight; for (rover = node->m_sector->ffloors; rover; rover = rover->next) { @@ -1717,42 +1718,45 @@ static void P_CheckBustableBlocks(player_t *player) if (!(rover->flags & FF_SHATTER) && (rover->flags & FF_ONLYKNUX) && !(player->charability == CA_GLIDEANDCLIMB)) continue; + 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); + // Height checks if (rover->flags & FF_SHATTERBOTTOM) { - if (player->mo->z+player->mo->momz + player->mo->height < *rover->bottomheight) + if (player->mo->z+player->mo->momz + player->mo->height < bottomheight) continue; - if (player->mo->z+player->mo->height > *rover->bottomheight) + if (player->mo->z+player->mo->height > bottomheight) continue; } else if (rover->flags & FF_SPINBUST) { - if (player->mo->z+player->mo->momz > *rover->topheight) + if (player->mo->z+player->mo->momz > topheight) continue; - if (player->mo->z + player->mo->height < *rover->bottomheight) + if (player->mo->z + player->mo->height < bottomheight) continue; } else if (rover->flags & FF_SHATTER) { - if (player->mo->z + player->mo->momz > *rover->topheight) + if (player->mo->z + player->mo->momz > topheight) continue; - if (player->mo->z+player->mo->momz + player->mo->height < *rover->bottomheight) + if (player->mo->z+player->mo->momz + player->mo->height < bottomheight) continue; } else { - if (player->mo->z >= *rover->topheight) + if (player->mo->z >= topheight) continue; - if (player->mo->z + player->mo->height < *rover->bottomheight) + if (player->mo->z + player->mo->height < bottomheight) continue; } // Impede the player's fall a bit - if (((rover->flags & FF_SPINBUST) || (rover->flags & FF_SHATTER)) && player->mo->z >= *rover->topheight) + if (((rover->flags & FF_SPINBUST) || (rover->flags & FF_SHATTER)) && player->mo->z >= topheight) player->mo->momz >>= 1; else if (rover->flags & FF_SHATTER) { @@ -6976,6 +6980,7 @@ static void P_MovePlayer(player_t *player) msecnode_t *node; // only place it's being used in P_MovePlayer now fixed_t oldx; fixed_t oldy; + fixed_t floorz, ceilingz; oldx = player->mo->x; oldy = player->mo->y; @@ -6993,31 +6998,34 @@ static void P_MovePlayer(player_t *player) if (node->m_sector->ffloors) { ffloor_t *rover; + fixed_t topheight, bottomheight; for (rover = node->m_sector->ffloors; rover; rover = rover->next) { - if (!(rover->flags & FF_EXISTS)) continue; + if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER)) + continue; - if ((rover->flags & FF_BLOCKPLAYER)) + 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 (topheight > player->mo->z && bottomheight < player->mo->z) { - if (*rover->topheight > player->mo->z && *rover->bottomheight < player->mo->z) - { - P_ResetPlayer(player); - S_StartSound(player->mo, sfx_s3k4a); - player->climbing = 5; - player->mo->momx = player->mo->momy = player->mo->momz = 0; - break; - } + P_ResetPlayer(player); + S_StartSound(player->mo, sfx_s3k4a); + player->climbing = 5; + player->mo->momx = player->mo->momy = player->mo->momz = 0; + break; } } } - if (player->mo->z+player->mo->height > node->m_sector->ceilingheight + floorz = P_GetFloorZ(player->mo, node->m_sector, player->mo->x, player->mo->y, NULL); + ceilingz = P_GetCeilingZ(player->mo, node->m_sector, player->mo->x, player->mo->y, NULL); + + if (player->mo->z+player->mo->height > ceilingz && node->m_sector->ceilingpic == skyflatnum) continue; - if (node->m_sector->floorheight > player->mo->z - || node->m_sector->ceilingheight < player->mo->z) + if (floorz > player->mo->z || ceilingz < player->mo->z) { P_ResetPlayer(player); S_StartSound(player->mo, sfx_s3k4a);