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,6 +508,9 @@ 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 both ceilings are skies, consider it always "open"
if (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)
{
if ((backc1 <= frontf1 && backc2 <= frontf2) if ((backc1 <= frontf1 && backc2 <= frontf2)
|| (backf1 >= frontc1 && backf2 >= frontc2)) || (backf1 >= frontc1 && backf2 >= frontc2))
{ {
@ -518,10 +521,12 @@ static void R_AddLine(seg_t *line)
doorclosed = (backc1 <= backf1 && backc2 <= backf2 doorclosed = (backc1 <= backf1 && backc2 <= backf2
&& ((backc1 >= frontc1 && backc2 >= frontc2) || curline->sidedef->toptexture) && ((backc1 >= frontc1 && backc2 >= frontc2) || curline->sidedef->toptexture)
&& ((backf1 <= frontf1 && backf2 >= frontf2) || curline->sidedef->bottomtexture) && ((backf1 <= frontf1 && backf2 >= frontf2) || curline->sidedef->bottomtexture)
&& (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)); //&& (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)
);
if (doorclosed) if (doorclosed)
goto clipsolid; goto clipsolid;
}
// Window. // Window.
if (backc1 != frontc1 || backc2 != frontc2 if (backc1 != frontc1 || backc2 != frontc2
@ -532,6 +537,9 @@ static void R_AddLine(seg_t *line)
} }
else else
#endif #endif
{
// if both ceilings are skies, consider it always "open"
if (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)
{ {
if (backsector->ceilingheight <= frontsector->floorheight if (backsector->ceilingheight <= frontsector->floorheight
|| backsector->floorheight >= frontsector->ceilingheight) || backsector->floorheight >= frontsector->ceilingheight)
@ -543,6 +551,7 @@ static void R_AddLine(seg_t *line)
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,6 +2101,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
// ds_p->sprbottomclip = negonearray; // ds_p->sprbottomclip = negonearray;
} }
if (!bothceilingssky)
{
if ( if (
#ifdef ESLOPE #ifdef ESLOPE
worldtopslope < worldhighslope || worldtopslope < worldhighslope ||
@ -2125,7 +2129,10 @@ void R_StoreWallRange(INT32 start, INT32 stop)
ds_p->tsilheight = INT32_MIN; ds_p->tsilheight = INT32_MIN;
// ds_p->sprtopclip = screenheightarray; // ds_p->sprtopclip = screenheightarray;
} }
}
if (!bothceilingssky)
{
#ifdef ESLOPE #ifdef ESLOPE
if (worldhigh <= worldbottom && worldhighslope <= worldbottomslope) if (worldhigh <= worldbottom && worldhighslope <= worldbottomslope)
#else #else
@ -2147,10 +2154,12 @@ void R_StoreWallRange(INT32 start, INT32 stop)
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) {
#ifdef ESLOPE
if ((worldhigh <= worldbottom && worldhighslope <= worldbottomslope)
|| (worldlow >= worldtop && worldlowslope >= worldtopslope))
#else
if (backsector->ceilingheight <= frontsector->floorheight
|| backsector->floorheight >= frontsector->ceilingheight)
#endif
{ {
// closed door // closed door
markceiling = markfloor = true; 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;