diff --git a/src/p_3dmidtex.cpp b/src/p_3dmidtex.cpp index b1f14e0b2..e52926b2e 100644 --- a/src/p_3dmidtex.cpp +++ b/src/p_3dmidtex.cpp @@ -256,23 +256,28 @@ bool P_GetMidTexturePosition(const line_t *line, int sideno, fixed_t *ptextop, f // //============================================================================ -bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, fixed_t &opentop, fixed_t &openbottom, bool *above) +bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening &open) { fixed_t tt, tb; - *above = false; + open.abovemidtex = false; if (P_GetMidTexturePosition(linedef, 0, &tt, &tb)) { if (thing->z + (thing->height/2) < (tt + tb)/2) { - if(tb < opentop) opentop = tb; + if (tb < open.top) + { + open.top = tb; + open.ceilingpic = linedef->sidedef[0]->GetTexture(side_t::mid); + } } else { - if(tt > openbottom) + if (tt > open.bottom) { - openbottom = tt; - *above = true; + open.bottom = tt; + open.abovemidtex = true; + open.floorpic = linedef->sidedef[0]->GetTexture(side_t::mid); } // returns true if it touches the midtexture return (abs(thing->z - tt) <= thing->MaxStepHeight); diff --git a/src/p_3dmidtex.h b/src/p_3dmidtex.h index c06c51601..79abc137b 100644 --- a/src/p_3dmidtex.h +++ b/src/p_3dmidtex.h @@ -14,7 +14,7 @@ void P_Start3dMidtexInterpolations(TArray &list, sector_t *sec void P_Attach3dMidtexLinesToSector(sector_t *dest, int lineid, int tag, bool ceiling); bool P_GetMidTexturePosition(const line_t *line, int sideno, fixed_t *ptextop, fixed_t *ptexbot); bool P_Check3dMidSwitch(AActor *actor, line_t *line, int side); -bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, fixed_t &opentop, fixed_t &openbottom, bool *above); +bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, struct FLineOpening &open); bool P_MoveLinkedSectors(sector_t *sector, int crush, fixed_t move, bool ceiling); void P_StartLinkedSectorInterpolations(TArray &list, sector_t *sector, bool ceiling); diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 6887425e3..05c248695 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -212,9 +212,12 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef, if (actor != NULL && linedef->frontsector != NULL && linedef->backsector != NULL && linedef->flags & ML_3DMIDTEX) { - open.touchmidtex = P_LineOpening_3dMidtex(actor, linedef, open.top, open.bottom, &open.abovemidtex); + open.touchmidtex = P_LineOpening_3dMidtex(actor, linedef, open); + } + else + { + open.abovemidtex = open.touchmidtex = false; } - else open.abovemidtex = open.touchmidtex = false; open.range = open.top - open.bottom; } diff --git a/src/po_man.cpp b/src/po_man.cpp index 8ad0ba009..780f426a1 100644 --- a/src/po_man.cpp +++ b/src/po_man.cpp @@ -1195,8 +1195,9 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd) checker.Push (mobj); if ((mobj->flags&MF_SOLID) && !(mobj->flags&MF_NOCLIP)) { - fixed_t top = -INT_MAX, bottom = INT_MAX; - bool above; + FLineOpening open; + open.top = -INT_MAX; + open.bottom = INT_MAX; // [TN] Check wether this actor gets blocked by the line. if (ld->backsector != NULL && !(ld->flags & (ML_BLOCKING|ML_BLOCKEVERYTHING)) @@ -1204,9 +1205,9 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd) && !(ld->flags & ML_BLOCKMONSTERS && mobj->flags3 & MF3_ISMONSTER) && !((mobj->flags & MF_FLOAT) && (ld->flags & ML_BLOCK_FLOATERS)) && (!(ld->flags & ML_3DMIDTEX) || - (!P_LineOpening_3dMidtex(mobj, ld, bottom, top, &above) && - (mobj->z + mobj->height < bottom) - ) || (above && mobj->z > mobj->floorz)) + (!P_LineOpening_3dMidtex(mobj, ld, open) && + (mobj->z + mobj->height < open.bottom) + ) || (open.abovemidtex && mobj->z > mobj->floorz)) ) { continue;