Merge branch 'gl-slope-doors' into 'master'

OpenGL slope fixes again

This branch just adds the relevant code for OpenGL to properly check slopes regarding "closed door" segs (those between two sectors that cannot be crossed normally) and "window" segs (those between two sectors of differing plane heights that you CAN cross, which would probably display top or bottom textures), so you don't get HOMs when the the slopes create a closed door even though the normal sector heights wouldn't or something.

(if you couldn't understand that, my slopes test map shows what I mean to the right of the player start: https://dl.dropboxusercontent.com/u/25409000/2.1/mi-slopetest.wad)

See merge request !81
This commit is contained in:
Nipples the Enchilada 2016-06-04 14:28:07 -04:00
commit 6bf40b8f40

View file

@ -2892,6 +2892,47 @@ static void HWR_AddLine(seg_t * line)
gr_backsector = R_FakeFlat(gr_backsector, &tempsec, NULL, NULL, true); gr_backsector = R_FakeFlat(gr_backsector, &tempsec, NULL, NULL, true);
#ifdef ESLOPE
if (gr_frontsector->f_slope || gr_frontsector->c_slope || gr_backsector->f_slope || gr_backsector->c_slope)
{
fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends
v1x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v1)->x);
v1y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v1)->y);
v2x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v2)->x);
v2y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v2)->y);
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
if (slope) { \
end1 = P_GetZAt(slope, v1x, v1y); \
end2 = P_GetZAt(slope, v2x, v2y); \
} else \
end1 = end2 = normalheight;
SLOPEPARAMS(gr_frontsector->f_slope, frontf1, frontf2, gr_frontsector->floorheight)
SLOPEPARAMS(gr_frontsector->c_slope, frontc1, frontc2, gr_frontsector->ceilingheight)
SLOPEPARAMS( gr_backsector->f_slope, backf1, backf2, gr_backsector->floorheight)
SLOPEPARAMS( gr_backsector->c_slope, backc1, backc2, gr_backsector->ceilingheight)
#undef SLOPEPARAMS
// Closed door.
if ((backc1 <= frontf1 && backc2 <= frontf2)
|| (backf1 >= frontc1 && backf2 >= frontc2))
{
goto clipsolid;
}
// Window.
if (backc1 != frontc1 || backc2 != frontc2
|| backf1 != frontf1 || backf2 != frontf2)
{
goto clippass;
}
}
else
#endif
{
// Closed door. // Closed door.
if (gr_backsector->ceilingheight <= gr_frontsector->floorheight || if (gr_backsector->ceilingheight <= gr_frontsector->floorheight ||
gr_backsector->floorheight >= gr_frontsector->ceilingheight) gr_backsector->floorheight >= gr_frontsector->ceilingheight)
@ -2901,6 +2942,7 @@ static void HWR_AddLine(seg_t * line)
if (gr_backsector->ceilingheight != gr_frontsector->ceilingheight || if (gr_backsector->ceilingheight != gr_frontsector->ceilingheight ||
gr_backsector->floorheight != gr_frontsector->floorheight) gr_backsector->floorheight != gr_frontsector->floorheight)
goto clippass; goto clippass;
}
// Reject empty lines used for triggers and special events. // Reject empty lines used for triggers and special events.
// Identical floor and ceiling on both sides, // Identical floor and ceiling on both sides,