Merge branch 'next' of http://git.magicalgirl.moe/STJr/SRB2.git into toast_slopes

This commit is contained in:
toasterbabe 2016-06-18 22:58:24 +01:00
commit 9c277bfb22
3 changed files with 116 additions and 48 deletions

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,

View file

@ -1324,6 +1324,7 @@ void R_RenderPlayerView(player_t *player)
#endif #endif
R_RenderBSPNode((INT32)numnodes - 1); R_RenderBSPNode((INT32)numnodes - 1);
R_ClipSprites();
R_DrawPlanes(); R_DrawPlanes();
#ifdef FLOORSPLATS #ifdef FLOORSPLATS
R_DrawVisibleFloorSplats(); R_DrawVisibleFloorSplats();

View file

@ -1453,9 +1453,11 @@ static void R_RenderSegLoop (void)
frontscale[rw_x] = rw_scale; frontscale[rw_x] = rw_scale;
// draw the wall tiers // draw the wall tiers
if (midtexture && yl <= yh && yh < vid.height && yh > 0) if (midtexture)
{ {
// single sided line // single sided line
if (yl <= yh && yh >= 0 && yl < viewheight)
{
dc_yl = yl; dc_yl = yl;
dc_yh = yh; dc_yh = yh;
dc_texturemid = rw_midtexturemid; dc_texturemid = rw_midtexturemid;
@ -1483,6 +1485,15 @@ static void R_RenderSegLoop (void)
floorclip[rw_x] = -1; floorclip[rw_x] = -1;
} }
else else
{
// note: don't use min/max macros, since casting from INT32 to INT16 is involved here
if (markceiling)
ceilingclip[rw_x] = (yh >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1;
if (markfloor)
floorclip[rw_x] = (yh < viewheight) ? ((yh < -1) ? -1 : (INT16)((INT16)yh + 1)) : (INT16)viewheight;
}
}
else
{ {
// two sided line // two sided line
if (toptexture) if (toptexture)
@ -1494,7 +1505,11 @@ static void R_RenderSegLoop (void)
if (mid >= floorclip[rw_x]) if (mid >= floorclip[rw_x])
mid = floorclip[rw_x]-1; mid = floorclip[rw_x]-1;
if (mid >= yl && yh < vid.height && yh > 0) if (mid >= yl) // back ceiling lower than front ceiling ?
{
if (yl >= viewheight) // entirely off bottom of screen
ceilingclip[rw_x] = (INT16)viewheight;
else if (mid >= 0) // safe to draw top texture
{ {
dc_yl = yl; dc_yl = yl;
dc_yh = mid; dc_yh = mid;
@ -1504,11 +1519,14 @@ static void R_RenderSegLoop (void)
colfunc(); colfunc();
ceilingclip[rw_x] = (INT16)mid; ceilingclip[rw_x] = (INT16)mid;
} }
else // entirely off top of screen
ceilingclip[rw_x] = -1;
}
else else
ceilingclip[rw_x] = (INT16)((INT16)yl - 1); ceilingclip[rw_x] = (yh >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1;
} }
else if (markceiling) // no top wall else if (markceiling) // no top wall
ceilingclip[rw_x] = (INT16)((INT16)yl - 1); ceilingclip[rw_x] = (yh >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1;
if (bottomtexture) if (bottomtexture)
{ {
@ -1520,7 +1538,11 @@ static void R_RenderSegLoop (void)
if (mid <= ceilingclip[rw_x]) if (mid <= ceilingclip[rw_x])
mid = ceilingclip[rw_x]+1; mid = ceilingclip[rw_x]+1;
if (mid <= yh && yh < vid.height && yh > 0) if (mid <= yh) // back floor higher than front floor ?
{
if (yh < 0) // entirely off top of screen
floorclip[rw_x] = -1;
else if (mid < viewheight) // safe to draw bottom texture
{ {
dc_yl = mid; dc_yl = mid;
dc_yh = yh; dc_yh = yh;
@ -1531,11 +1553,14 @@ static void R_RenderSegLoop (void)
colfunc(); colfunc();
floorclip[rw_x] = (INT16)mid; floorclip[rw_x] = (INT16)mid;
} }
else // entirely off bottom of screen
floorclip[rw_x] = (INT16)viewheight;
}
else else
floorclip[rw_x] = (INT16)((INT16)yh + 1); floorclip[rw_x] = (yh < viewheight) ? ((yh < -1) ? -1 : (INT16)((INT16)yh + 1)) : (INT16)viewheight;
} }
else if (markfloor) // no bottom wall else if (markfloor) // no bottom wall
floorclip[rw_x] = (INT16)((INT16)yh + 1); floorclip[rw_x] = (yh < viewheight) ? ((yh < -1) ? -1 : (INT16)((INT16)yh + 1)) : (INT16)viewheight;
} }
if (maskedtexture || numthicksides) if (maskedtexture || numthicksides)