From 6789b8936c4ccd02457a74a4912d6fe1d2b105f2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 16 Sep 2010 20:15:44 +0000 Subject: [PATCH] - fixed: When moving a sector plane P_CheckPosition must do the same anti-overlap checks for monsters like P_Move to avoid monster pile-ups. SVN r2801 (trunk) --- src/p_map.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index f578ec7feb..424591be5c 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -844,16 +844,23 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm) if (tm.FromPMove) { - fixed_t newdist = P_AproxDistance(thing->x - tm.x, thing->y - tm.y); - fixed_t olddist = P_AproxDistance(thing->x - tm.thing->x, thing->y - tm.thing->y); - // Both actors already overlap. To prevent them from remaining stuck allow the move if it - // takes them further apart. - if (newdist > olddist) + // takes them further apart or the move does not change the position (when called from P_ChangeSector.) + if (tm.x == tm.thing->x && tm.y == tm.thing->y) { - // ... but not if they did not overlap in z-direction before but would after the move. - unblocking = !((tm.thing->x >= thing->x + thing->height && tm.x < thing->x + thing->height) || - (tm.thing->x + tm.thing->height <= thing->x && tm.x + tm.thing->height > thing->x)); + unblocking = true; + } + else + { + fixed_t newdist = P_AproxDistance(thing->x - tm.x, thing->y - tm.y); + fixed_t olddist = P_AproxDistance(thing->x - tm.thing->x, thing->y - tm.thing->y); + + if (newdist > olddist) + { + // ... but not if they did not overlap in z-direction before but would after the move. + unblocking = !((tm.thing->z >= thing->z + thing->height && tm.z < thing->z + thing->height) || + (tm.thing->z + tm.thing->height <= thing->z && tm.z + tm.thing->height > thing->z)); + } } } @@ -4512,6 +4519,11 @@ bool P_AdjustFloorCeil (AActor *thing, FChangePosition *cpos) int flags2 = thing->flags2 & MF2_PASSMOBJ; FCheckPosition tm; + if ((thing->flags2 & MF2_PASSMOBJ) && (thing->flags3 & MF3_ISMONSTER)) + { + tm.FromPMove = true; + } + if (cpos->movemidtex) { // From Eternity: