From 8ecfe6a8ac86e8691f22b39059d99c74d07ab2cb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 12 Aug 2006 21:02:46 +0000 Subject: [PATCH] - Fixed: P_CheckOnMobjZ returned the first thing an actor could stand on, not the highest possible. SVN r290 (trunk) --- docs/rh-log.txt | 2 ++ src/p_local.h | 2 +- src/p_map.cpp | 14 ++++++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 439433957..998f49231 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ August 11, 2006 (Changes by Graf Zahl) +- Fixed: P_CheckOnMobjZ returned the first thing an actor could stand on, + not the highest possible. - Added disintegration damage to SectorDamage. - Bumped savegame version, min. savegame version, netgame version and demo version because the inventory and damage changes are incompatible diff --git a/src/p_local.h b/src/p_local.h index eab98d144..22b1aeb7e 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -277,7 +277,7 @@ extern bool DoRipping; extern AActor *LastRipped; BOOL P_TestMobjLocation (AActor *mobj); -bool P_TestMobjZ (AActor *mobj); +bool P_TestMobjZ (AActor *mobj, bool quick=true); BOOL P_CheckPosition (AActor *thing, fixed_t x, fixed_t y); AActor *P_CheckOnmobj (AActor *thing); void P_FakeZMovement (AActor *mo); diff --git a/src/p_map.cpp b/src/p_map.cpp index cf65de0dc..c75f927cf 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -1171,13 +1171,17 @@ BOOL PIT_CheckOnmobjZ (AActor *thing) { // under thing return true; } + else if (!tmflags && onmobj != NULL && thing->z + thing->height < onmobj->z + onmobj->height) + { // something higher is in the way + return true; + } fixed_t blockdist = thing->radius+tmthing->radius; if (abs(thing->x-tmx) >= blockdist || abs(thing->y-tmy) >= blockdist) { // Didn't hit thing return true; } onmobj = thing; - return false; + return !tmflags; } /* @@ -1421,7 +1425,7 @@ AActor *P_CheckOnmobj (AActor *thing) oldz = thing->z; P_FakeZMovement (thing); - good = P_TestMobjZ (thing); + good = P_TestMobjZ (thing, false); thing->z = oldz; return good ? NULL : onmobj; @@ -1433,19 +1437,21 @@ AActor *P_CheckOnmobj (AActor *thing) // //============================================================================= -bool P_TestMobjZ (AActor *actor) +bool P_TestMobjZ (AActor *actor, bool quick) { static TArray mobjzbt; int xl,xh,yl,yh,bx,by; fixed_t x, y; + onmobj = NULL; if (actor->flags & MF_NOCLIP) return true; tmx = x = actor->x; tmy = y = actor->y; tmthing = actor; + tmflags = quick; tmbbox[BOXTOP] = y + actor->radius; tmbbox[BOXBOTTOM] = y - actor->radius; @@ -1468,7 +1474,7 @@ bool P_TestMobjZ (AActor *actor) if (!P_BlockThingsIterator (bx, by, PIT_CheckOnmobjZ, mobjzbt)) return false; - return true; + return onmobj == NULL; } //=============================================================================