Merge branch 'ogl-fof-wall-slope-fix2' into 'next'

Take slopes into account in FOF wall cutoff in HWR_ProcessSeg

Closes #192

See merge request STJr/SRB2!1361
This commit is contained in:
sphere 2021-05-30 11:32:30 -04:00
commit fb4b3b8130

View file

@ -1117,7 +1117,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->f_slope, worldlow, worldlowslope, gl_backsector->floorheight)
#undef SLOPEPARAMS
// hack to allow height changes in outdoor areas
// This is what gets rid of the upper textures if there should be sky
@ -1606,14 +1605,18 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
{
ffloor_t * rover;
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;
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
/// to allow fun plane intersecting in OGL? But then people would abuse that and make software look bad. :C
highcut = gl_frontsector->ceilingheight < gl_backsector->ceilingheight ? gl_frontsector->ceilingheight : gl_backsector->ceilingheight;
lowcut = gl_frontsector->floorheight > gl_backsector->floorheight ? gl_frontsector->floorheight : gl_backsector->floorheight;
lowcut = max(worldbottom, worldlow);
highcut = min(worldtop, worldhigh);
lowcutslope = max(worldbottomslope, worldlowslope);
highcutslope = min(worldtopslope, worldhighslope);
if (gl_backsector->ffloors)
{
@ -1635,7 +1638,11 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
continue;
if (!(rover->flags & FF_ALLSIDES) && rover->flags & FF_INVERTSIDES)
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;
texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture);
@ -1651,10 +1658,17 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
hS = P_GetFFloorTopZAt (rover, v2x, v2y);
l = P_GetFFloorBottomZAt(rover, v1x, v1y);
lS = P_GetFFloorBottomZAt(rover, v2x, v2y);
if (!(*rover->t_slope) && !gl_frontsector->c_slope && !gl_backsector->c_slope && h > highcut)
h = hS = highcut;
if (!(*rover->b_slope) && !gl_frontsector->f_slope && !gl_backsector->f_slope && l < lowcut)
l = lS = lowcut;
// Adjust the heights so the FOF does not overlap with top and bottom textures.
if (h >= highcut && hS >= highcutslope)
{
h = highcut;
hS = highcutslope;
}
if (l <= lowcut && lS <= lowcutslope)
{
l = lowcut;
lS = lowcutslope;
}
//Hurdler: HW code starts here
//FIXME: check if peging is correct
// set top/bottom coords
@ -1781,7 +1795,11 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
continue;
if (!(rover->flags & FF_ALLSIDES || rover->flags & FF_INVERTSIDES))
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;
texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture);
@ -1796,10 +1814,17 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
hS = P_GetFFloorTopZAt (rover, v2x, v2y);
l = P_GetFFloorBottomZAt(rover, v1x, v1y);
lS = P_GetFFloorBottomZAt(rover, v2x, v2y);
if (!(*rover->t_slope) && !gl_frontsector->c_slope && !gl_backsector->c_slope && h > highcut)
h = hS = highcut;
if (!(*rover->b_slope) && !gl_frontsector->f_slope && !gl_backsector->f_slope && l < lowcut)
l = lS = lowcut;
// Adjust the heights so the FOF does not overlap with top and bottom textures.
if (h >= highcut && hS >= highcutslope)
{
h = highcut;
hS = highcutslope;
}
if (l <= lowcut && lS <= lowcutslope)
{
l = lowcut;
lS = lowcutslope;
}
//Hurdler: HW code starts here
//FIXME: check if peging is correct
// set top/bottom coords
@ -1873,6 +1898,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
}
}
}
#undef SLOPEPARAMS
//Hurdler: end of 3d-floors test
}