diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 4394339573..998f49231c 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 eab98d1440..22b1aeb7ef 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 cf65de0dcd..c75f927cfd 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; } //=============================================================================