diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index 343b875e3..011247800 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -385,7 +385,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition) } } // Redo floor/ceiling check, in case of 3D floors - P_FindFloorCeiling(self, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DMIDTEXRESTRICT); + P_FindFloorCeiling(self, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT); if (self->z < self->floorz) { // Do not reappear under the floor, even if that's where we were for the // initial spawn. diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index 31681171f..02c2702ff 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -691,7 +691,7 @@ lightlist_t * P_GetPlaneLight(sector_t * sector, secplane_t * plane, bool unders //========================================================================== void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *linedef, - fixed_t x, fixed_t y, fixed_t refx, fixed_t refy) + fixed_t x, fixed_t y, fixed_t refx, fixed_t refy, bool restrict) { if(thing) { @@ -737,7 +737,7 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li lowestceilingpic = *rover->bottom.texture; } - if(ff_top > highestfloor && delta1 < delta2) + if(ff_top > highestfloor && delta1 < delta2 && (!restrict || thing->z >= ff_top)) { highestfloor = ff_top; highestfloorpic = *rover->top.texture; diff --git a/src/p_3dfloors.h b/src/p_3dfloors.h index 61721136a..f9915348e 100644 --- a/src/p_3dfloors.h +++ b/src/p_3dfloors.h @@ -137,7 +137,7 @@ void P_Spawn3DFloors( void ); struct FLineOpening; void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *linedef, - fixed_t x, fixed_t y, fixed_t refx, fixed_t refy); + fixed_t x, fixed_t y, fixed_t refx, fixed_t refy, bool restrict); secplane_t P_FindFloorPlane(sector_t * sector, fixed_t x, fixed_t y, fixed_t z); int P_Find3DFloor(sector_t * sec, fixed_t x, fixed_t y, fixed_t z, bool above, bool floor, fixed_t &cmpz); @@ -170,7 +170,7 @@ inline void P_Spawn3DFloors( void ) {} struct FLineOpening; inline void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *linedef, - fixed_t x, fixed_t y, fixed_t refx, fixed_t refy) {} + fixed_t x, fixed_t y, fixed_t refx, fixed_t refy, bool restrict) {} //secplane_t P_FindFloorPlane(sector_t * sector, fixed_t x, fixed_t y, fixed_t z){return sector->floorplane;} diff --git a/src/p_local.h b/src/p_local.h index bbe6f6632..a943b2460 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -438,7 +438,7 @@ enum FFCF_ONLYSPAWNPOS = 1, FFCF_SAMESECTOR = 2, FFCF_ONLY3DFLOORS = 4, // includes 3D midtexes - FFCF_3DMIDTEXRESTRICT = 8, // ignore 3D midtex's whose floorz are above thing's z + FFCF_3DRESTRICT = 8, // ignore 3D midtexes and floors whose floorz are above thing's z }; void P_FindFloorCeiling (AActor *actor, int flags=0); diff --git a/src/p_map.cpp b/src/p_map.cpp index 973daf24d..5fcc6cd3c 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -203,13 +203,13 @@ void P_GetFloorCeilingZ(FCheckPosition &tmf, int flags) if (ff_top > tmf.floorz) { - if (ff_top < tmf.z || (tmf.thing != NULL && ff_bottom < tmf.z && ff_top < tmf.z + tmf.thing->MaxStepHeight)) + if (ff_top <= tmf.z || (!(flags && FFCF_3DRESTRICT) && (tmf.thing != NULL && ff_bottom < tmf.z && ff_top < tmf.z + tmf.thing->MaxStepHeight))) { tmf.dropoffz = tmf.floorz = ff_top; tmf.floorpic = *rover->top.texture; } } - if (ff_bottom < tmf.ceilingz && ff_bottom > tmf.z + tmf.thing->height) + if (ff_bottom <= tmf.ceilingz && ff_bottom > tmf.z + tmf.thing->height) { tmf.ceilingz = ff_bottom; tmf.ceilingpic = *rover->bottom.texture; @@ -235,7 +235,7 @@ void P_FindFloorCeiling (AActor *actor, int flags) if (flags & FFCF_ONLYSPAWNPOS) { - flags |= FFCF_3DMIDTEXRESTRICT; + flags |= FFCF_3DRESTRICT; } if (!(flags & FFCF_ONLYSPAWNPOS)) { diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 32825ee31..b9a3d76ca 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -218,13 +218,13 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef, // Check 3D floors if (actor != NULL) { - P_LineOpening_XFloors(open, actor, linedef, x, y, refx, refy); + P_LineOpening_XFloors(open, actor, linedef, x, y, refx, refy, !!(flags & FFCF_3DRESTRICT)); } if (actor != NULL && linedef->frontsector != NULL && linedef->backsector != NULL && linedef->flags & ML_3DMIDTEX) { - open.touchmidtex = P_LineOpening_3dMidtex(actor, linedef, open, !!(flags & FFCF_3DMIDTEXRESTRICT)); + open.touchmidtex = P_LineOpening_3dMidtex(actor, linedef, open, !!(flags & FFCF_3DRESTRICT)); } else { diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 81883c397..fff6daa2a 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -2487,7 +2487,7 @@ void P_NightmareRespawn (AActor *mobj) } // If there are 3D floors, we need to find floor/ceiling again. - P_FindFloorCeiling(mo, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DMIDTEXRESTRICT); + P_FindFloorCeiling(mo, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT); if (z == ONFLOORZ) { @@ -4519,7 +4519,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position) mobj->SpawnPoint[2] = mthing->z; mobj->SpawnAngle = mthing->angle; mobj->SpawnFlags = mthing->flags; - P_FindFloorCeiling(mobj, FFCF_ONLYSPAWNPOS); + P_FindFloorCeiling(mobj, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT); if (!(mobj->flags2 & MF2_ARGSDEFINED)) {