More sky fixes for software:

* Thok barriers with slopes now render fine in software
* The solid "sky walls" between different-height thok barriers adjacent to each other are gone. Forever.
This commit is contained in:
Monster Iestyn 2018-01-28 22:08:58 +00:00
parent 5c70d6e6ca
commit 7d150485c9
2 changed files with 103 additions and 69 deletions

View File

@ -508,21 +508,26 @@ static void R_AddLine(seg_t *line)
SLOPEPARAMS( backsector->f_slope, backf1, backf2, backsector->floorheight) SLOPEPARAMS( backsector->f_slope, backf1, backf2, backsector->floorheight)
SLOPEPARAMS( backsector->c_slope, backc1, backc2, backsector->ceilingheight) SLOPEPARAMS( backsector->c_slope, backc1, backc2, backsector->ceilingheight)
#undef SLOPEPARAMS #undef SLOPEPARAMS
if ((backc1 <= frontf1 && backc2 <= frontf2) // if both ceilings are skies, consider it always "open"
|| (backf1 >= frontc1 && backf2 >= frontc2)) if (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)
{ {
goto clipsolid; if ((backc1 <= frontf1 && backc2 <= frontf2)
|| (backf1 >= frontc1 && backf2 >= frontc2))
{
goto clipsolid;
}
// Check for automap fix. Store in doorclosed for r_segs.c
doorclosed = (backc1 <= backf1 && backc2 <= backf2
&& ((backc1 >= frontc1 && backc2 >= frontc2) || curline->sidedef->toptexture)
&& ((backf1 <= frontf1 && backf2 >= frontf2) || curline->sidedef->bottomtexture)
//&& (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)
);
if (doorclosed)
goto clipsolid;
} }
// Check for automap fix. Store in doorclosed for r_segs.c
doorclosed = (backc1 <= backf1 && backc2 <= backf2
&& ((backc1 >= frontc1 && backc2 >= frontc2) || curline->sidedef->toptexture)
&& ((backf1 <= frontf1 && backf2 >= frontf2) || curline->sidedef->bottomtexture)
&& (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum));
if (doorclosed)
goto clipsolid;
// Window. // Window.
if (backc1 != frontc1 || backc2 != frontc2 if (backc1 != frontc1 || backc2 != frontc2
|| backf1 != frontf1 || backf2 != frontf2) || backf1 != frontf1 || backf2 != frontf2)
@ -533,16 +538,20 @@ static void R_AddLine(seg_t *line)
else else
#endif #endif
{ {
if (backsector->ceilingheight <= frontsector->floorheight // if both ceilings are skies, consider it always "open"
|| backsector->floorheight >= frontsector->ceilingheight) if (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)
{ {
goto clipsolid; if (backsector->ceilingheight <= frontsector->floorheight
} || backsector->floorheight >= frontsector->ceilingheight)
{
goto clipsolid;
}
// Check for automap fix. Store in doorclosed for r_segs.c // Check for automap fix. Store in doorclosed for r_segs.c
doorclosed = R_DoorClosed(); doorclosed = R_DoorClosed();
if (doorclosed) if (doorclosed)
goto clipsolid; goto clipsolid;
}
// Window. // Window.
if (backsector->ceilingheight != frontsector->ceilingheight if (backsector->ceilingheight != frontsector->ceilingheight

View File

@ -2032,6 +2032,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
else else
{ {
// two sided line // two sided line
boolean bothceilingssky = false; // turned on if both back and front ceilings are sky
#ifdef ESLOPE #ifdef ESLOPE
if (backsector->c_slope) { if (backsector->c_slope) {
@ -2063,10 +2064,11 @@ void R_StoreWallRange(INT32 start, INT32 stop)
if (frontsector->ceilingpic == skyflatnum if (frontsector->ceilingpic == skyflatnum
&& backsector->ceilingpic == skyflatnum) && backsector->ceilingpic == skyflatnum)
{ {
bothceilingssky = true;
#ifdef ESLOPE #ifdef ESLOPE
worldtopslope = worldhighslope = //worldtopslope = worldhighslope;
#endif #endif
worldtop = worldhigh; //worldtop = worldhigh;
} }
ds_p->sprtopclip = ds_p->sprbottomclip = NULL; ds_p->sprtopclip = ds_p->sprbottomclip = NULL;
@ -2099,58 +2101,65 @@ void R_StoreWallRange(INT32 start, INT32 stop)
// ds_p->sprbottomclip = negonearray; // ds_p->sprbottomclip = negonearray;
} }
if ( if (!bothceilingssky)
#ifdef ESLOPE
worldtopslope < worldhighslope ||
#endif
worldtop < worldhigh)
{ {
ds_p->silhouette |= SIL_TOP; if (
#ifdef ESLOPE #ifdef ESLOPE
if ((backsector->c_slope ? P_GetZAt(backsector->c_slope, viewx, viewy) : backsector->ceilingheight) < viewz) worldtopslope < worldhighslope ||
#endif
worldtop < worldhigh)
{
ds_p->silhouette |= SIL_TOP;
#ifdef ESLOPE
if ((backsector->c_slope ? P_GetZAt(backsector->c_slope, viewx, viewy) : backsector->ceilingheight) < viewz)
ds_p->tsilheight = INT32_MIN;
else
ds_p->tsilheight = (frontsector->c_slope ? INT32_MIN : frontsector->ceilingheight);
#else
ds_p->tsilheight = frontsector->ceilingheight;
#endif
}
#ifdef ESLOPE
else if ((backsector->c_slope ? P_GetZAt(backsector->c_slope, viewx, viewy) : backsector->ceilingheight) < viewz)
#else
else if (backsector->ceilingheight < viewz)
#endif
{
ds_p->silhouette |= SIL_TOP;
ds_p->tsilheight = INT32_MIN; ds_p->tsilheight = INT32_MIN;
else // ds_p->sprtopclip = screenheightarray;
ds_p->tsilheight = (frontsector->c_slope ? INT32_MIN : frontsector->ceilingheight); }
#else
ds_p->tsilheight = frontsector->ceilingheight;
#endif
}
#ifdef ESLOPE
else if ((backsector->c_slope ? P_GetZAt(backsector->c_slope, viewx, viewy) : backsector->ceilingheight) < viewz)
#else
else if (backsector->ceilingheight < viewz)
#endif
{
ds_p->silhouette |= SIL_TOP;
ds_p->tsilheight = INT32_MIN;
// ds_p->sprtopclip = screenheightarray;
} }
#ifdef ESLOPE if (!bothceilingssky)
if (worldhigh <= worldbottom && worldhighslope <= worldbottomslope)
#else
if (worldhigh <= worldbottom)
#endif
{ {
ds_p->sprbottomclip = negonearray; #ifdef ESLOPE
ds_p->bsilheight = INT32_MAX; if (worldhigh <= worldbottom && worldhighslope <= worldbottomslope)
ds_p->silhouette |= SIL_BOTTOM; #else
} if (worldhigh <= worldbottom)
#endif
{
ds_p->sprbottomclip = negonearray;
ds_p->bsilheight = INT32_MAX;
ds_p->silhouette |= SIL_BOTTOM;
}
#ifdef ESLOPE #ifdef ESLOPE
if (worldlow >= worldtop && worldlowslope >= worldtopslope) if (worldlow >= worldtop && worldlowslope >= worldtopslope)
#else #else
if (worldlow >= worldtop) if (worldlow >= worldtop)
#endif #endif
{ {
ds_p->sprtopclip = screenheightarray; ds_p->sprtopclip = screenheightarray;
ds_p->tsilheight = INT32_MIN; ds_p->tsilheight = INT32_MIN;
ds_p->silhouette |= SIL_TOP; ds_p->silhouette |= SIL_TOP;
}
} }
//SoM: 3/25/2000: This code fixes an automap bug that didn't check //SoM: 3/25/2000: This code fixes an automap bug that didn't check
// frontsector->ceiling and backsector->floor to see if a door was closed. // frontsector->ceiling and backsector->floor to see if a door was closed.
// Without the following code, sprites get displayed behind closed doors. // Without the following code, sprites get displayed behind closed doors.
if (!bothceilingssky)
{ {
#ifdef ESLOPE #ifdef ESLOPE
if (doorclosed || (worldhigh <= worldbottom && worldhighslope <= worldbottomslope)) if (doorclosed || (worldhigh <= worldbottom && worldhighslope <= worldbottomslope))
@ -2200,7 +2209,14 @@ void R_StoreWallRange(INT32 start, INT32 stop)
markfloor = false; markfloor = false;
} }
if (worldhigh != worldtop if (bothceilingssky)
{
// double ceiling skies are special
// we don't want to lower the ceiling clipping, (no new plane is drawn anyway)
// so we can see the floor of thok barriers always regardless of sector properties
markceiling = false;
}
else if (worldhigh != worldtop
#ifdef ESLOPE #ifdef ESLOPE
|| worldhighslope != worldtopslope || worldhighslope != worldtopslope
|| backsector->c_slope != frontsector->c_slope || backsector->c_slope != frontsector->c_slope
@ -2226,19 +2242,28 @@ void R_StoreWallRange(INT32 start, INT32 stop)
markceiling = false; markceiling = false;
} }
if (backsector->ceilingheight <= frontsector->floorheight || if (!bothceilingssky)
backsector->floorheight >= frontsector->ceilingheight)
{ {
// closed door #ifdef ESLOPE
markceiling = markfloor = true; if ((worldhigh <= worldbottom && worldhighslope <= worldbottomslope)
|| (worldlow >= worldtop && worldlowslope >= worldtopslope))
#else
if (backsector->ceilingheight <= frontsector->floorheight
|| backsector->floorheight >= frontsector->ceilingheight)
#endif
{
// closed door
markceiling = markfloor = true;
}
} }
// check TOP TEXTURE // check TOP TEXTURE
if (worldhigh < worldtop if (!bothceilingssky // never draw the top texture if on
&& (worldhigh < worldtop
#ifdef ESLOPE #ifdef ESLOPE
|| worldhighslope < worldtopslope || worldhighslope < worldtopslope
#endif #endif
) ))
{ {
fixed_t texheight; fixed_t texheight;
// top texture // top texture
@ -2687,12 +2712,12 @@ void R_StoreWallRange(INT32 start, INT32 stop)
markfloor = false; markfloor = false;
} }
if (( if (frontsector->ceilingpic != skyflatnum
&& (
#ifdef ESLOPE #ifdef ESLOPE
frontsector->c_slope ? P_GetZAt(frontsector->c_slope, viewx, viewy) : frontsector->c_slope ? P_GetZAt(frontsector->c_slope, viewx, viewy) :
#endif #endif
frontsector->ceilingheight) <= viewz && frontsector->ceilingheight) <= viewz)
frontsector->ceilingpic != skyflatnum)
{ {
// below view plane // below view plane
markceiling = false; markceiling = false;