Merge branch 'wall-collision-fix' into 'next'

Wall collision fixes

Fixes included in this branch:
* A fix for a specific crash encountered in a SUGOI map (sound familiar?) caused by bouncing off a wall adjacent to a slope
* A fix for solid midtextures not accounting for Effect 3/Peg Midtexture properly (https://mb.srb2.org/showthread.php?t=41462)
* A fix for solid midtextures not accounting for texture y offsets properly for non-Lower Unpegged/Peg Midtextured midtextures
* A fix for solid midtextures not accounting for "infinite" repeats (Repeat Midtexture + no repeat count set)
* ~~A fix for Effect 4 on Polyobject First Line making that particular linedef's midtexture solid in addition to making planes visible - this is not wanted if you want a polyobject with both visible planes and full intangibility.~~ Apparently they never did this anyway, don't mind me \o/

See merge request !104
This commit is contained in:
Monster Iestyn 2016-08-28 13:33:14 -04:00
commit 454b705d32
3 changed files with 40 additions and 30 deletions

View File

@ -1153,7 +1153,7 @@ static boolean PIT_CheckLine(line_t *ld)
} }
// set openrange, opentop, openbottom // set openrange, opentop, openbottom
P_LineOpening(ld); P_LineOpening(ld, tmthing);
// adjust floor / ceiling heights // adjust floor / ceiling heights
if (opentop < tmceilingz) if (opentop < tmceilingz)
@ -2585,7 +2585,7 @@ static boolean PTR_SlideTraverse(intercept_t *in)
} }
// set openrange, opentop, openbottom // set openrange, opentop, openbottom
P_LineOpening(li); P_LineOpening(li, slidemo);
if (openrange < slidemo->height) if (openrange < slidemo->height)
goto isblocking; // doesn't fit goto isblocking; // doesn't fit

View File

@ -489,7 +489,7 @@ void P_CameraLineOpening(line_t *linedef)
} }
} }
void P_LineOpening(line_t *linedef) void P_LineOpening(line_t *linedef, mobj_t *mobj)
{ {
sector_t *front, *back; sector_t *front, *back;
@ -520,8 +520,8 @@ void P_LineOpening(line_t *linedef)
{ // Set open and high/low values here { // Set open and high/low values here
fixed_t frontheight, backheight; fixed_t frontheight, backheight;
frontheight = P_GetCeilingZ(tmthing, front, tmx, tmy, linedef); frontheight = P_GetCeilingZ(mobj, front, tmx, tmy, linedef);
backheight = P_GetCeilingZ(tmthing, back, tmx, tmy, linedef); backheight = P_GetCeilingZ(mobj, back, tmx, tmy, linedef);
if (frontheight < backheight) if (frontheight < backheight)
{ {
@ -540,8 +540,8 @@ void P_LineOpening(line_t *linedef)
#endif #endif
} }
frontheight = P_GetFloorZ(tmthing, front, tmx, tmy, linedef); frontheight = P_GetFloorZ(mobj, front, tmx, tmy, linedef);
backheight = P_GetFloorZ(tmthing, back, tmx, tmy, linedef); backheight = P_GetFloorZ(mobj, back, tmx, tmy, linedef);
if (frontheight > backheight) if (frontheight > backheight)
{ {
@ -561,12 +561,14 @@ void P_LineOpening(line_t *linedef)
} }
} }
if (tmthing) if (mobj)
{ {
fixed_t thingtop = tmthing->z + tmthing->height; fixed_t thingtop = mobj->z + mobj->height;
// Check for collision with front side's midtexture if Effect 4 is set // Check for collision with front side's midtexture if Effect 4 is set
if (linedef->flags & ML_EFFECT4) { if (linedef->flags & ML_EFFECT4
&& !linedef->polyobj // don't do anything for polyobjects! ...for now
) {
side_t *side = &sides[linedef->sidenum[0]]; side_t *side = &sides[linedef->sidenum[0]];
fixed_t textop, texbottom, texheight; fixed_t textop, texbottom, texheight;
fixed_t texmid, delta1, delta2; fixed_t texmid, delta1, delta2;
@ -575,30 +577,38 @@ void P_LineOpening(line_t *linedef)
texheight = textures[texturetranslation[side->midtexture]]->height << FRACBITS; texheight = textures[texturetranslation[side->midtexture]]->height << FRACBITS;
// Set texbottom and textop to the Z coordinates of the texture's boundaries // Set texbottom and textop to the Z coordinates of the texture's boundaries
#ifdef POLYOBJECTS #if 0 // #ifdef POLYOBJECTS
// don't remove this code unless solid midtextures
// on non-solid polyobjects should NEVER happen in the future
if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) { if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) {
if (linedef->flags & ML_DONTPEGBOTTOM) { if (linedef->flags & ML_EFFECT5 && !side->repeatcnt) { // "infinite" repeat
texbottom = back->floorheight + side->rowoffset;
textop = back->ceilingheight + side->rowoffset;
} else if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) {
texbottom = back->floorheight + side->rowoffset; texbottom = back->floorheight + side->rowoffset;
textop = texbottom + texheight*(side->repeatcnt+1); textop = texbottom + texheight*(side->repeatcnt+1);
} else { } else {
textop = back->ceilingheight - side->rowoffset; textop = back->ceilingheight + side->rowoffset;
texbottom = textop - texheight*(side->repeatcnt+1); texbottom = textop - texheight*(side->repeatcnt+1);
} }
} else } else
#endif #endif
{ {
if (linedef->flags & ML_DONTPEGBOTTOM) { if (linedef->flags & ML_EFFECT5 && !side->repeatcnt) { // "infinite" repeat
texbottom = openbottom + side->rowoffset;
textop = opentop + side->rowoffset;
} else if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) {
texbottom = openbottom + side->rowoffset; texbottom = openbottom + side->rowoffset;
textop = texbottom + texheight*(side->repeatcnt+1); textop = texbottom + texheight*(side->repeatcnt+1);
} else { } else {
textop = opentop - side->rowoffset; textop = opentop + side->rowoffset;
texbottom = textop - texheight*(side->repeatcnt+1); texbottom = textop - texheight*(side->repeatcnt+1);
} }
} }
texmid = texbottom+(textop-texbottom)/2; texmid = texbottom+(textop-texbottom)/2;
delta1 = abs(tmthing->z - texmid); delta1 = abs(mobj->z - texmid);
delta2 = abs(thingtop - texmid); delta2 = abs(thingtop - texmid);
if (delta1 > delta2) { // Below if (delta1 > delta2) { // Below
@ -636,16 +646,16 @@ void P_LineOpening(line_t *linedef)
if (!(rover->flags & FF_EXISTS)) if (!(rover->flags & FF_EXISTS))
continue; continue;
if (tmthing->player && (P_CheckSolidLava(tmthing, rover) || P_CanRunOnWater(tmthing->player, rover))) if (mobj->player && (P_CheckSolidLava(mobj, rover) || P_CanRunOnWater(mobj->player, rover)))
; ;
else if (!((rover->flags & FF_BLOCKPLAYER && tmthing->player) else if (!((rover->flags & FF_BLOCKPLAYER && mobj->player)
|| (rover->flags & FF_BLOCKOTHERS && !tmthing->player))) || (rover->flags & FF_BLOCKOTHERS && !mobj->player)))
continue; continue;
topheight = P_GetFOFTopZ(tmthing, front, rover, tmx, tmy, linedef); topheight = P_GetFOFTopZ(mobj, front, rover, tmx, tmy, linedef);
bottomheight = P_GetFOFBottomZ(tmthing, front, rover, tmx, tmy, linedef); bottomheight = P_GetFOFBottomZ(mobj, front, rover, tmx, tmy, linedef);
delta1 = abs(tmthing->z - (bottomheight + ((topheight - bottomheight)/2))); delta1 = abs(mobj->z - (bottomheight + ((topheight - bottomheight)/2)));
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF
@ -680,16 +690,16 @@ void P_LineOpening(line_t *linedef)
if (!(rover->flags & FF_EXISTS)) if (!(rover->flags & FF_EXISTS))
continue; continue;
if (tmthing->player && (P_CheckSolidLava(tmthing, rover) || P_CanRunOnWater(tmthing->player, rover))) if (mobj->player && (P_CheckSolidLava(mobj, rover) || P_CanRunOnWater(mobj->player, rover)))
; ;
else if (!((rover->flags & FF_BLOCKPLAYER && tmthing->player) else if (!((rover->flags & FF_BLOCKPLAYER && mobj->player)
|| (rover->flags & FF_BLOCKOTHERS && !tmthing->player))) || (rover->flags & FF_BLOCKOTHERS && !mobj->player)))
continue; continue;
topheight = P_GetFOFTopZ(tmthing, back, rover, tmx, tmy, linedef); topheight = P_GetFOFTopZ(mobj, back, rover, tmx, tmy, linedef);
bottomheight = P_GetFOFBottomZ(tmthing, back, rover, tmx, tmy, linedef); bottomheight = P_GetFOFBottomZ(mobj, back, rover, tmx, tmy, linedef);
delta1 = abs(tmthing->z - (bottomheight + ((topheight - bottomheight)/2))); delta1 = abs(mobj->z - (bottomheight + ((topheight - bottomheight)/2)));
delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2))); delta2 = abs(thingtop - (bottomheight + ((topheight - bottomheight)/2)));
if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF
@ -723,7 +733,7 @@ void P_LineOpening(line_t *linedef)
{ {
const sector_t *polysec = linedef->backsector; const sector_t *polysec = linedef->backsector;
delta1 = abs(tmthing->z - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2))); delta1 = abs(mobj->z - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2)));
delta2 = abs(thingtop - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2))); delta2 = abs(thingtop - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2)));
if (polysec->floorheight < lowestceiling && delta1 >= delta2) { if (polysec->floorheight < lowestceiling && delta1 >= delta2) {
lowestceiling = polysec->floorheight; lowestceiling = polysec->floorheight;

View File

@ -59,7 +59,7 @@ extern fixed_t opentop, openbottom, openrange, lowfloor, highceiling;
extern pslope_t *opentopslope, *openbottomslope; extern pslope_t *opentopslope, *openbottomslope;
#endif #endif
void P_LineOpening(line_t *plinedef); void P_LineOpening(line_t *plinedef, mobj_t *mobj);
boolean P_BlockLinesIterator(INT32 x, INT32 y, boolean(*func)(line_t *)); boolean P_BlockLinesIterator(INT32 x, INT32 y, boolean(*func)(line_t *));
boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean(*func)(mobj_t *)); boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean(*func)(mobj_t *));