Take slopes into account in FOF wall cutoff in HWR_ProcessSeg

This commit is contained in:
Hannu Hanhi 2020-12-29 23:29:00 +02:00 committed by toaster
parent 6a6c8a2baf
commit 8f22ccccdb

View file

@ -1140,7 +1140,6 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
SLOPEPARAMS(gl_backsector->c_slope, worldhigh, worldhighslope, gl_backsector->ceilingheight) SLOPEPARAMS(gl_backsector->c_slope, worldhigh, worldhighslope, gl_backsector->ceilingheight)
SLOPEPARAMS(gl_backsector->f_slope, worldlow, worldlowslope, gl_backsector->floorheight) SLOPEPARAMS(gl_backsector->f_slope, worldlow, worldlowslope, gl_backsector->floorheight)
#undef SLOPEPARAMS
// hack to allow height changes in outdoor areas // hack to allow height changes in outdoor areas
// This is what gets rid of the upper textures if there should be sky // This is what gets rid of the upper textures if there should be sky
@ -1664,14 +1663,18 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
{ {
ffloor_t * rover; ffloor_t * rover;
fixed_t highcut = 0, lowcut = 0; fixed_t highcut = 0, lowcut = 0;
fixed_t lowcutslope, highcutslope;
// Used for height comparisons and etc across FOFs and slopes
fixed_t high1, highslope1, low1, lowslope1;
INT32 texnum; INT32 texnum;
line_t * newline = NULL; // Multi-Property FOF line_t * newline = NULL; // Multi-Property FOF
///TODO add slope support (fixing cutoffs, proper wall clipping) - maybe just disable highcut/lowcut if either sector or FOF has a slope lowcut = max(worldbottom, worldlow);
/// to allow fun plane intersecting in OGL? But then people would abuse that and make software look bad. :C highcut = min(worldtop, worldhigh);
highcut = gl_frontsector->ceilingheight < gl_backsector->ceilingheight ? gl_frontsector->ceilingheight : gl_backsector->ceilingheight; lowcutslope = max(worldbottomslope, worldlowslope);
lowcut = gl_frontsector->floorheight > gl_backsector->floorheight ? gl_frontsector->floorheight : gl_backsector->floorheight; highcutslope = min(worldtopslope, worldhighslope);
if (gl_backsector->ffloors) if (gl_backsector->ffloors)
{ {
@ -1693,7 +1696,11 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
continue; continue;
if (!(rover->flags & FF_ALLSIDES) && rover->flags & FF_INVERTSIDES) if (!(rover->flags & FF_ALLSIDES) && rover->flags & FF_INVERTSIDES)
continue; continue;
if (*rover->topheight < lowcut || *rover->bottomheight > highcut)
SLOPEPARAMS(*rover->t_slope, high1, highslope1, *rover->topheight)
SLOPEPARAMS(*rover->b_slope, low1, lowslope1, *rover->bottomheight)
if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope))
continue; continue;
texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture); texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture);
@ -1842,7 +1849,11 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
continue; continue;
if (!(rover->flags & FF_ALLSIDES || rover->flags & FF_INVERTSIDES)) if (!(rover->flags & FF_ALLSIDES || rover->flags & FF_INVERTSIDES))
continue; continue;
if (*rover->topheight < lowcut || *rover->bottomheight > highcut)
SLOPEPARAMS(*rover->t_slope, high1, highslope1, *rover->topheight)
SLOPEPARAMS(*rover->b_slope, low1, lowslope1, *rover->bottomheight)
if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope))
continue; continue;
texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture); texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture);
@ -1937,6 +1948,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
} }
} }
} }
#undef SLOPEPARAMS
//Hurdler: end of 3d-floors test //Hurdler: end of 3d-floors test
} }