Added proper support for upside-down thok barriers, in both renderers

Thankfully it was really just a copy+paste of the code I already tinkered with for the normal ceiling sky based thok barriers, but tweaked for floors instead
This commit is contained in:
Monster Iestyn 2018-02-03 19:48:18 +00:00
parent 0dc867c05e
commit 33a538383f
3 changed files with 78 additions and 39 deletions

View File

@ -1543,6 +1543,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
INT32 gr_toptexture = 0, gr_bottomtexture = 0; INT32 gr_toptexture = 0, gr_bottomtexture = 0;
// two sided line // two sided line
boolean bothceilingssky = false; // turned on if both back and front ceilings are sky boolean bothceilingssky = false; // turned on if both back and front ceilings are sky
boolean bothfloorssky = false; // likewise, but for floors
#ifdef ESLOPE #ifdef ESLOPE
SLOPEPARAMS(gr_backsector->c_slope, worldhigh, worldhighslope, gr_backsector->ceilingheight) SLOPEPARAMS(gr_backsector->c_slope, worldhigh, worldhighslope, gr_backsector->ceilingheight)
@ -1561,9 +1562,17 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
bothceilingssky = true; bothceilingssky = true;
} }
// likewise, but for floors and upper textures
if (gr_frontsector->floorpic == skyflatnum
&& gr_backsector->floorpic == skyflatnum)
{
bothfloorssky = true;
}
if (!bothceilingssky) if (!bothceilingssky)
gr_toptexture = R_GetTextureNum(gr_sidedef->toptexture); gr_toptexture = R_GetTextureNum(gr_sidedef->toptexture);
gr_bottomtexture = R_GetTextureNum(gr_sidedef->bottomtexture); if (!bothfloorssky)
gr_bottomtexture = R_GetTextureNum(gr_sidedef->bottomtexture);
// check TOP TEXTURE // check TOP TEXTURE
if (( if ((
@ -2457,7 +2466,9 @@ static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacks
backc1 = backc2 = abacksector->ceilingheight; backc1 = backc2 = abacksector->ceilingheight;
} }
// properly render skies (consider door "open" if both ceilings are sky) // properly render skies (consider door "open" if both ceilings are sky)
if (abacksector->ceilingpic != skyflatnum || afrontsector->ceilingpic != skyflatnum) // same for floors
if ((abacksector->ceilingpic != skyflatnum || afrontsector->ceilingpic != skyflatnum)
&& (abacksector->floorpic != skyflatnum || afrontsector->floorpic != skyflatnum))
{ {
// now check for closed sectors! // now check for closed sectors!
if ((backc1 <= frontf1 && backc2 <= frontf2) if ((backc1 <= frontf1 && backc2 <= frontf2)
@ -2953,8 +2964,10 @@ static void HWR_AddLine(seg_t * line)
SLOPEPARAMS( gr_backsector->f_slope, backf1, backf2, gr_backsector->floorheight) SLOPEPARAMS( gr_backsector->f_slope, backf1, backf2, gr_backsector->floorheight)
SLOPEPARAMS( gr_backsector->c_slope, backc1, backc2, gr_backsector->ceilingheight) SLOPEPARAMS( gr_backsector->c_slope, backc1, backc2, gr_backsector->ceilingheight)
#undef SLOPEPARAMS #undef SLOPEPARAMS
// if both ceilings are skies, consider it always "open"
if (gr_backsector->ceilingpic != skyflatnum || gr_frontsector->ceilingpic != skyflatnum) // same for floors
if ((gr_backsector->ceilingpic != skyflatnum || gr_frontsector->ceilingpic != skyflatnum)
&& (gr_backsector->floorpic != skyflatnum || gr_frontsector->floorpic != skyflatnum))
{ {
// Closed door. // Closed door.
if ((backc1 <= frontf1 && backc2 <= frontf2) if ((backc1 <= frontf1 && backc2 <= frontf2)
@ -2980,8 +2993,10 @@ static void HWR_AddLine(seg_t * line)
else else
#endif #endif
{ {
// if both ceilings are skies, consider it always "open"
if (gr_backsector->ceilingpic != skyflatnum || gr_frontsector->ceilingpic != skyflatnum) // same for floors
if ((gr_backsector->ceilingpic != skyflatnum || gr_frontsector->ceilingpic != skyflatnum)
&& (gr_backsector->floorpic != skyflatnum || gr_frontsector->floorpic != skyflatnum))
{ {
// Closed door. // Closed door.
if (gr_backsector->ceilingheight <= gr_frontsector->floorheight || if (gr_backsector->ceilingheight <= gr_frontsector->floorheight ||

View File

@ -506,7 +506,9 @@ static void R_AddLine(seg_t *line)
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 both ceilings are skies, consider it always "open"
if (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum) // same for floors
if ((backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)
&& (backsector->floorpic != skyflatnum || frontsector->floorpic != skyflatnum))
{ {
if ((backc1 <= frontf1 && backc2 <= frontf2) if ((backc1 <= frontf1 && backc2 <= frontf2)
|| (backf1 >= frontc1 && backf2 >= frontc2)) || (backf1 >= frontc1 && backf2 >= frontc2))
@ -534,7 +536,9 @@ static void R_AddLine(seg_t *line)
#endif #endif
{ {
// if both ceilings are skies, consider it always "open" // if both ceilings are skies, consider it always "open"
if (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum) // same for floors
if ((backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)
&& (backsector->floorpic != skyflatnum || frontsector->floorpic != skyflatnum))
{ {
if (backsector->ceilingheight <= frontsector->floorheight if (backsector->ceilingheight <= frontsector->floorheight
|| backsector->floorheight >= frontsector->ceilingheight) || backsector->floorheight >= frontsector->ceilingheight)
@ -926,7 +930,8 @@ static void R_Subsector(size_t num)
#ifdef ESLOPE #ifdef ESLOPE
frontsector->f_slope ? P_GetZAt(frontsector->f_slope, viewx, viewy) : frontsector->f_slope ? P_GetZAt(frontsector->f_slope, viewx, viewy) :
#endif #endif
frontsector->floorheight) < viewz || (frontsector->heightsec != -1 frontsector->floorheight) < viewz || frontsector->floorpic == skyflatnum
|| (frontsector->heightsec != -1
&& sectors[frontsector->heightsec].ceilingpic == skyflatnum))) && sectors[frontsector->heightsec].ceilingpic == skyflatnum)))
{ {
floorplane = R_FindPlane(frontsector->floorheight, frontsector->floorpic, floorlightlevel, floorplane = R_FindPlane(frontsector->floorheight, frontsector->floorpic, floorlightlevel,

View File

@ -2016,6 +2016,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
{ {
// two sided line // two sided line
boolean bothceilingssky = false; // turned on if both back and front ceilings are sky boolean bothceilingssky = false; // turned on if both back and front ceilings are sky
boolean bothfloorssky = false; // likewise, but for floors
#ifdef ESLOPE #ifdef ESLOPE
SLOPEPARAMS(backsector->c_slope, worldhigh, worldhighslope, backsector->ceilingheight) SLOPEPARAMS(backsector->c_slope, worldhigh, worldhighslope, backsector->ceilingheight)
@ -2037,34 +2038,44 @@ void R_StoreWallRange(INT32 start, INT32 stop)
bothceilingssky = true; bothceilingssky = true;
} }
// likewise, but for floors and upper textures
if (frontsector->floorpic == skyflatnum
&& backsector->floorpic == skyflatnum)
{
bothfloorssky = true;
}
ds_p->sprtopclip = ds_p->sprbottomclip = NULL; ds_p->sprtopclip = ds_p->sprbottomclip = NULL;
ds_p->silhouette = 0; ds_p->silhouette = 0;
if ( if (!bothfloorssky)
#ifdef ESLOPE
worldbottomslope > worldlowslope ||
#endif
worldbottom > worldlow)
{ {
ds_p->silhouette = SIL_BOTTOM; if (
#ifdef ESLOPE #ifdef ESLOPE
if ((backsector->f_slope ? P_GetZAt(backsector->f_slope, viewx, viewy) : backsector->floorheight) > viewz) worldbottomslope > worldlowslope ||
#endif
worldbottom > worldlow)
{
ds_p->silhouette = SIL_BOTTOM;
#ifdef ESLOPE
if ((backsector->f_slope ? P_GetZAt(backsector->f_slope, viewx, viewy) : backsector->floorheight) > viewz)
ds_p->bsilheight = INT32_MAX;
else
ds_p->bsilheight = (frontsector->f_slope ? INT32_MAX : frontsector->floorheight);
#else
ds_p->bsilheight = frontsector->floorheight;
#endif
}
#ifdef ESLOPE
else if ((backsector->f_slope ? P_GetZAt(backsector->f_slope, viewx, viewy) : backsector->floorheight) > viewz)
#else
else if (backsector->floorheight > viewz)
#endif
{
ds_p->silhouette = SIL_BOTTOM;
ds_p->bsilheight = INT32_MAX; ds_p->bsilheight = INT32_MAX;
else // ds_p->sprbottomclip = negonearray;
ds_p->bsilheight = (frontsector->f_slope ? INT32_MAX : frontsector->floorheight); }
#else
ds_p->bsilheight = frontsector->floorheight;
#endif
}
#ifdef ESLOPE
else if ((backsector->f_slope ? P_GetZAt(backsector->f_slope, viewx, viewy) : backsector->floorheight) > viewz)
#else
else if (backsector->floorheight > viewz)
#endif
{
ds_p->silhouette = SIL_BOTTOM;
ds_p->bsilheight = INT32_MAX;
// ds_p->sprbottomclip = negonearray;
} }
if (!bothceilingssky) if (!bothceilingssky)
@ -2097,7 +2108,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
} }
} }
if (!bothceilingssky) if (!bothceilingssky && !bothfloorssky)
{ {
#ifdef ESLOPE #ifdef ESLOPE
if (worldhigh <= worldbottom && worldhighslope <= worldbottomslope) if (worldhigh <= worldbottom && worldhighslope <= worldbottomslope)
@ -2125,7 +2136,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
//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) if (!bothceilingssky && !bothfloorssky)
{ {
#ifdef ESLOPE #ifdef ESLOPE
if (doorclosed || (worldhigh <= worldbottom && worldhighslope <= worldbottomslope)) if (doorclosed || (worldhigh <= worldbottom && worldhighslope <= worldbottomslope))
@ -2149,7 +2160,13 @@ void R_StoreWallRange(INT32 start, INT32 stop)
} }
} }
if (worldlow != worldbottom if (bothfloorssky)
{
// see double ceiling skies comment
// this is the same but for upside down thok barriers where the floor is sky and the ceiling is normal
markfloor = false;
}
else if (worldlow != worldbottom
#ifdef ESLOPE #ifdef ESLOPE
|| worldlowslope != worldbottomslope || worldlowslope != worldbottomslope
|| backsector->f_slope != frontsector->f_slope || backsector->f_slope != frontsector->f_slope
@ -2161,7 +2178,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|| backsector->floor_yoffs != frontsector->floor_yoffs || backsector->floor_yoffs != frontsector->floor_yoffs
|| backsector->floorpic_angle != frontsector->floorpic_angle || backsector->floorpic_angle != frontsector->floorpic_angle
//SoM: 3/22/2000: Prevents bleeding. //SoM: 3/22/2000: Prevents bleeding.
|| frontsector->heightsec != -1 || (frontsector->heightsec != -1 && frontsector->floorpic != skyflatnum)
|| backsector->floorlightsec != frontsector->floorlightsec || backsector->floorlightsec != frontsector->floorlightsec
//SoM: 4/3/2000: Check for colormaps //SoM: 4/3/2000: Check for colormaps
|| frontsector->extra_colormap != backsector->extra_colormap || frontsector->extra_colormap != backsector->extra_colormap
@ -2208,7 +2225,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
markceiling = false; markceiling = false;
} }
if (!bothceilingssky) if (!bothceilingssky && !bothfloorssky)
{ {
#ifdef ESLOPE #ifdef ESLOPE
if ((worldhigh <= worldbottom && worldhighslope <= worldbottomslope) if ((worldhigh <= worldbottom && worldhighslope <= worldbottomslope)
@ -2278,11 +2295,12 @@ void R_StoreWallRange(INT32 start, INT32 stop)
} }
} }
// check BOTTOM TEXTURE // check BOTTOM TEXTURE
if (worldlow > worldbottom if (!bothfloorssky // never draw the bottom texture if on
&& (worldlow > worldbottom
#ifdef ESLOPE #ifdef ESLOPE
|| worldlowslope > worldbottomslope || worldlowslope > worldbottomslope
#endif #endif
) //seulement si VISIBLE!!! )) //seulement si VISIBLE!!!
{ {
// bottom texture // bottom texture
bottomtexture = R_GetTextureNum(sidedef->bottomtexture); bottomtexture = R_GetTextureNum(sidedef->bottomtexture);
@ -2636,7 +2654,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
// and doesn't need to be marked. // and doesn't need to be marked.
if (frontsector->heightsec == -1) if (frontsector->heightsec == -1)
{ {
if (( if (frontsector->floorpic != skyflatnum
&& (
#ifdef ESLOPE #ifdef ESLOPE
frontsector->f_slope ? P_GetZAt(frontsector->f_slope, viewx, viewy) : frontsector->f_slope ? P_GetZAt(frontsector->f_slope, viewx, viewy) :
#endif #endif