From f1a96342607a165963e754b580cab2a405a154a4 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 13 Aug 2016 21:41:18 +0100 Subject: [PATCH 1/3] P_LineOpening now takes a mobj_t argument, instead of relying on tmthing . tmthing can be NULL if called from PTR_SlideTraverse, so we should use slidemo instead This fixes a crash that occurs in yet ANOTHER SUGOI map, involving bouncy walls next to sloped floors/ceilings --- src/p_map.c | 4 ++-- src/p_maputl.c | 42 +++++++++++++++++++++--------------------- src/p_maputl.h | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 1f2d903e..ccf2b100 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1153,7 +1153,7 @@ static boolean PIT_CheckLine(line_t *ld) } // set openrange, opentop, openbottom - P_LineOpening(ld); + P_LineOpening(ld, tmthing); // adjust floor / ceiling heights if (opentop < tmceilingz) @@ -2581,7 +2581,7 @@ static boolean PTR_SlideTraverse(intercept_t *in) } // set openrange, opentop, openbottom - P_LineOpening(li); + P_LineOpening(li, slidemo); if (openrange < slidemo->height) goto isblocking; // doesn't fit diff --git a/src/p_maputl.c b/src/p_maputl.c index c3a6fa84..df2bf8f5 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -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; @@ -520,8 +520,8 @@ void P_LineOpening(line_t *linedef) { // Set open and high/low values here fixed_t frontheight, backheight; - frontheight = P_GetCeilingZ(tmthing, front, tmx, tmy, linedef); - backheight = P_GetCeilingZ(tmthing, back, tmx, tmy, linedef); + frontheight = P_GetCeilingZ(mobj, front, tmx, tmy, linedef); + backheight = P_GetCeilingZ(mobj, back, tmx, tmy, linedef); if (frontheight < backheight) { @@ -540,8 +540,8 @@ void P_LineOpening(line_t *linedef) #endif } - frontheight = P_GetFloorZ(tmthing, front, tmx, tmy, linedef); - backheight = P_GetFloorZ(tmthing, back, tmx, tmy, linedef); + frontheight = P_GetFloorZ(mobj, front, tmx, tmy, linedef); + backheight = P_GetFloorZ(mobj, back, tmx, tmy, linedef); if (frontheight > backheight) { @@ -561,9 +561,9 @@ 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 if (linedef->flags & ML_EFFECT4) { @@ -598,7 +598,7 @@ void P_LineOpening(line_t *linedef) texmid = texbottom+(textop-texbottom)/2; - delta1 = abs(tmthing->z - texmid); + delta1 = abs(mobj->z - texmid); delta2 = abs(thingtop - texmid); if (delta1 > delta2) { // Below @@ -636,16 +636,16 @@ void P_LineOpening(line_t *linedef) if (!(rover->flags & FF_EXISTS)) 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) - || (rover->flags & FF_BLOCKOTHERS && !tmthing->player))) + else if (!((rover->flags & FF_BLOCKPLAYER && mobj->player) + || (rover->flags & FF_BLOCKOTHERS && !mobj->player))) continue; - topheight = P_GetFOFTopZ(tmthing, front, rover, tmx, tmy, linedef); - bottomheight = P_GetFOFBottomZ(tmthing, front, rover, tmx, tmy, linedef); + topheight = P_GetFOFTopZ(mobj, 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))); if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF @@ -680,16 +680,16 @@ void P_LineOpening(line_t *linedef) if (!(rover->flags & FF_EXISTS)) 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) - || (rover->flags & FF_BLOCKOTHERS && !tmthing->player))) + else if (!((rover->flags & FF_BLOCKPLAYER && mobj->player) + || (rover->flags & FF_BLOCKOTHERS && !mobj->player))) continue; - topheight = P_GetFOFTopZ(tmthing, back, rover, tmx, tmy, linedef); - bottomheight = P_GetFOFBottomZ(tmthing, back, rover, tmx, tmy, linedef); + topheight = P_GetFOFTopZ(mobj, 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))); if (delta1 >= delta2 && !(rover->flags & FF_PLATFORM)) // thing is below FOF @@ -723,7 +723,7 @@ void P_LineOpening(line_t *linedef) { 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))); if (polysec->floorheight < lowestceiling && delta1 >= delta2) { lowestceiling = polysec->floorheight; diff --git a/src/p_maputl.h b/src/p_maputl.h index c160bfa2..3d74e927 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -59,7 +59,7 @@ extern fixed_t opentop, openbottom, openrange, lowfloor, highceiling; extern pslope_t *opentopslope, *openbottomslope; #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_BlockThingsIterator(INT32 x, INT32 y, boolean(*func)(mobj_t *)); From 1530183ddf1323748938cd41919aa4816b1f68a7 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 14 Aug 2016 16:56:41 +0100 Subject: [PATCH 2/3] Fix multiple solid midtexture-related issues: * Effect 3 (Peg Midtexture) is now accounted for properly, flipping the collision box position to match the actual rendered position of the midtexture * Fixed incorrect application of y-offsets for non-lower unpegged midtextures collision boxes; +ve always goes up, -ve always goes down! * Effect 4 now doesn't make midtextures solid for polyobjects at all - this "conflicted" with First Line having both Effect 4 (visible planes) and Effect 3 (intangible) simultaneously, where we kind of expect the first line's wall to not be made solid. This may be less of a problem in future SRB2 versions, but for now solid midtextures for polyobjects are disabled. --- src/p_maputl.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index df2bf8f5..37367912 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -566,7 +566,9 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) fixed_t thingtop = mobj->z + mobj->height; // 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]]; fixed_t textop, texbottom, texheight; fixed_t texmid, delta1, delta2; @@ -575,23 +577,25 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) texheight = textures[texturetranslation[side->midtexture]]->height << FRACBITS; // 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->flags & ML_DONTPEGBOTTOM) { + if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) { texbottom = back->floorheight + side->rowoffset; textop = texbottom + texheight*(side->repeatcnt+1); } else { - textop = back->ceilingheight - side->rowoffset; + textop = back->ceilingheight + side->rowoffset; texbottom = textop - texheight*(side->repeatcnt+1); } } else #endif { - if (linedef->flags & ML_DONTPEGBOTTOM) { + if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) { texbottom = openbottom + side->rowoffset; textop = texbottom + texheight*(side->repeatcnt+1); } else { - textop = opentop - side->rowoffset; + textop = opentop + side->rowoffset; texbottom = textop - texheight*(side->repeatcnt+1); } } From 2a6a21a4a28bfcce0c16fa83090386ac4ecbd467 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 27 Aug 2016 17:14:21 +0100 Subject: [PATCH 3/3] Solid midtextures now account for "infinite" repeats --- src/p_maputl.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index 37367912..fea8530a 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -581,7 +581,10 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) // 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->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) { + 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; textop = texbottom + texheight*(side->repeatcnt+1); } else { @@ -591,7 +594,10 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) } else #endif { - if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_EFFECT3)) { + 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; textop = texbottom + texheight*(side->repeatcnt+1); } else {