Renderer: port some texture skewing fixes from SRB2
- ffloors on the frontsector in opengl now support texture skewing like software - alot of cleanups, simplifycation and optimizations
This commit is contained in:
1 parent
105267612b
commit
2344c391d2
5 files changed
+158
-109
No files matched your search
+99
-65
@@ -1461,18 +1461,21 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
// check TOP TEXTURE
|
||||
if (gl_toptexture && (worldhighslope < worldtopslope || worldhigh < worldtop))
|
||||
{
|
||||
fixed_t texheight = textureheight[gl_toptexture];
|
||||
|
||||
// PEGGING
|
||||
// FIXME: This is probably not correct?
|
||||
if (gl_linedef->flags & ML_DONTPEGTOP)
|
||||
texturevpeg = 0;
|
||||
else if (gl_linedef->flags & ML_EFFECT1)
|
||||
texturevpeg = worldhigh + textureheight[gl_toptexture] - worldtop;
|
||||
texturevpeg = worldhigh + texheight - worldtop;
|
||||
else
|
||||
texturevpeg = gl_backsector->ceilingheight + textureheight[gl_toptexture] - gl_frontsector->ceilingheight;
|
||||
texturevpeg = gl_backsector->ceilingheight + texheight - gl_frontsector->ceilingheight;
|
||||
|
||||
texturevpeg += gl_sidedef->rowoffset;
|
||||
|
||||
// This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway
|
||||
texturevpeg %= textureheight[gl_toptexture];
|
||||
texturevpeg %= texheight;
|
||||
|
||||
glTex = HWR_GetTexture(gl_toptexture, noencore);
|
||||
|
||||
@@ -1493,13 +1496,13 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
else if (gl_linedef->flags & ML_DONTPEGTOP)
|
||||
{
|
||||
// Skewed by top
|
||||
wallVerts[0].t = (texturevpeg + worldtop - worldhigh) * glTex->scaleY;
|
||||
wallVerts[1].t = (texturevpeg + worldtopslope - worldhighslope) * glTex->scaleY;
|
||||
wallVerts[0].t = (texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
|
||||
wallVerts[1].t = (texturevpeg + (worldtopslope - worldhighslope)) * glTex->scaleY;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Skewed by bottom
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + worldtop - worldhigh) * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
|
||||
wallVerts[3].t = wallVerts[0].t - (worldtop - worldhigh) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t - (worldtopslope - worldhighslope) * glTex->scaleY;
|
||||
}
|
||||
@@ -1539,7 +1542,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
glTex = HWR_GetTexture(gl_bottomtexture, noencore);
|
||||
|
||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_backsector->floorheight - gl_frontsector->floorheight) * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (gl_backsector->floorheight - gl_frontsector->floorheight)) * glTex->scaleY;
|
||||
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
|
||||
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
|
||||
|
||||
@@ -1555,14 +1558,14 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
else if (gl_linedef->flags & ML_DONTPEGBOTTOM)
|
||||
{
|
||||
// Skewed by bottom
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + worldlow - worldbottom) * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t - (worldlowslope - worldbottomslope) * glTex->scaleY;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Skewed by top
|
||||
wallVerts[0].t = (texturevpeg + worldlow - worldbottom) * glTex->scaleY;
|
||||
wallVerts[1].t = (texturevpeg + worldlowslope - worldbottomslope) * glTex->scaleY;
|
||||
wallVerts[0].t = (texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
|
||||
wallVerts[1].t = (texturevpeg + (worldlowslope - worldbottomslope)) * glTex->scaleY;
|
||||
}
|
||||
|
||||
// set top/bottom coords
|
||||
@@ -1594,6 +1597,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
else
|
||||
back = gl_linedef->backsector;
|
||||
|
||||
fixed_t texheight = textureheight[gl_midtexture];
|
||||
|
||||
if (gl_sidedef->repeatcnt)
|
||||
repeats = 1 + gl_sidedef->repeatcnt;
|
||||
else if (gl_linedef->flags & ML_EFFECT5 || gl_portal_state == GLPORTAL_STENCIL || gl_portal_state == GLPORTAL_DEPTH)
|
||||
@@ -1610,8 +1615,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
else
|
||||
low = back->floorheight;
|
||||
|
||||
repeats = (high - low) / textureheight[gl_midtexture];
|
||||
if ((high - low) % textureheight[gl_midtexture])
|
||||
repeats = (high - low) / texheight;
|
||||
if ((high - low) % texheight)
|
||||
repeats++; // tile an extra time to fill the gap -- Monster Iestyn
|
||||
}
|
||||
else
|
||||
@@ -1643,18 +1648,22 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
}
|
||||
|
||||
// Find the wall's coordinates
|
||||
const fixed_t midtexheight = textureheight[gl_midtexture] * repeats;
|
||||
const fixed_t midtexheight = texheight * repeats;
|
||||
|
||||
fixed_t rowoffset = gl_sidedef->rowoffset;
|
||||
|
||||
// Texture is not skewed
|
||||
if (gl_linedef->flags & ML_EFFECT2)
|
||||
{
|
||||
if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) // Peg it to the floor
|
||||
{
|
||||
polybottom = std::max(front->floorheight, back->floorheight) + gl_sidedef->rowoffset;
|
||||
polytop = polybottom + midtexheight;
|
||||
polybottom = std::max(gl_frontsector->floorheight, gl_backsector->floorheight) + rowoffset;
|
||||
polytop = polybottom + midtexheight;
|
||||
}
|
||||
else // Peg it to the ceiling
|
||||
// Peg it to the ceiling
|
||||
else
|
||||
{
|
||||
polytop = std::min(front->ceilingheight, back->ceilingheight) + gl_sidedef->rowoffset;
|
||||
polytop = std::min(gl_frontsector->ceilingheight, gl_backsector->ceilingheight) + rowoffset;
|
||||
polybottom = polytop - midtexheight;
|
||||
}
|
||||
|
||||
@@ -1664,16 +1673,16 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
}
|
||||
else if (!!(gl_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gl_linedef->flags & ML_EFFECT3)) // Skew the texture, but peg it to the floor
|
||||
{
|
||||
polybottom = popenbottom + gl_sidedef->rowoffset;
|
||||
polybottom = popenbottom + rowoffset;
|
||||
polytop = polybottom + midtexheight;
|
||||
polybottomslope = popenbottomslope + gl_sidedef->rowoffset;
|
||||
polybottomslope = popenbottomslope + rowoffset;
|
||||
polytopslope = polybottomslope + midtexheight;
|
||||
}
|
||||
else // Skew it according to the ceiling's slope
|
||||
{
|
||||
polytop = popentop + gl_sidedef->rowoffset;
|
||||
polytop = popentop + rowoffset;
|
||||
polybottom = polytop - midtexheight;
|
||||
polytopslope = popentopslope + gl_sidedef->rowoffset;
|
||||
polytopslope = popentopslope + rowoffset;
|
||||
polybottomslope = polytopslope - midtexheight;
|
||||
}
|
||||
|
||||
@@ -1782,13 +1791,13 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
}
|
||||
else if (gl_linedef->flags & ML_DONTPEGBOTTOM)
|
||||
{
|
||||
wallVerts[3].t = wallVerts[0].t + (worldbottom-worldtop) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t + (worldbottomslope-worldtopslope) * glTex->scaleY;
|
||||
wallVerts[3].t = wallVerts[0].t + (worldbottom - worldtop) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t + ((worldbottomslope - worldtopslope)) * glTex->scaleY;
|
||||
}
|
||||
else
|
||||
{
|
||||
wallVerts[0].t = wallVerts[3].t - (worldbottom-worldtop) * glTex->scaleY;
|
||||
wallVerts[1].t = wallVerts[2].t - (worldbottomslope-worldtopslope) * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[3].t - (worldbottom - worldtop) * glTex->scaleY;
|
||||
wallVerts[1].t = wallVerts[2].t - (worldbottomslope - worldtopslope) * glTex->scaleY;
|
||||
}
|
||||
|
||||
//Set textures properly on single sided walls that are sloped
|
||||
@@ -1853,7 +1862,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
fixed_t high1, highslope1, low1, lowslope1;
|
||||
|
||||
INT32 texnum;
|
||||
line_t * newline = NULL; // Multi-Property FOF
|
||||
|
||||
lowcut = std::max(worldbottom, worldlow);
|
||||
highcut = std::min(worldtop, worldhigh);
|
||||
@@ -1888,14 +1896,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope))
|
||||
continue;
|
||||
|
||||
texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture);
|
||||
side_t *side = R_GetFFloorSide(gl_curline->linedef, rover, gl_backsector);
|
||||
|
||||
boolean do_texture_skew;
|
||||
boolean dont_peg_bottom;
|
||||
|
||||
if (rover->master->flags & ML_TFERLINE)
|
||||
{
|
||||
size_t linenum = std::min<size_t>(gl_curline->linedef-gl_backsector->lines[0], rover->master->frontsector->linecount);
|
||||
newline = rover->master->frontsector->lines[0] + linenum;
|
||||
texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture);
|
||||
line_t *newline = R_GetFFloorLine(gl_curline->linedef, rover, gl_backsector);
|
||||
do_texture_skew = newline->flags & ML_DONTPEGTOP;
|
||||
dont_peg_bottom = newline->flags & ML_DONTPEGBOTTOM;
|
||||
}
|
||||
else
|
||||
{
|
||||
do_texture_skew = rover->master->flags & ML_DONTPEGTOP;
|
||||
dont_peg_bottom = gl_curline->linedef->flags & ML_DONTPEGBOTTOM;
|
||||
}
|
||||
|
||||
texnum = R_GetTextureNum(side->midtexture);
|
||||
|
||||
h = P_GetFFloorTopZAt (rover, v1x, v1y);
|
||||
hS = P_GetFFloorTopZAt (rover, v2x, v2y);
|
||||
@@ -1932,44 +1950,30 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
}
|
||||
else
|
||||
{
|
||||
fixed_t texturevpeg;
|
||||
boolean attachtobottom = false;
|
||||
boolean slopeskew = false; // skew FOF walls with slopes?
|
||||
|
||||
// Wow, how was this missing from OpenGL for so long?
|
||||
// ...Oh well, anyway, Lower Unpegged now changes pegging of FOFs like in software
|
||||
// -- Monster Iestyn 26/06/18
|
||||
if (newline)
|
||||
{
|
||||
texturevpeg = sides[newline->sidenum[0]].rowoffset;
|
||||
attachtobottom = !!(newline->flags & ML_DONTPEGBOTTOM);
|
||||
slopeskew = !!(newline->flags & ML_DONTPEGTOP);
|
||||
}
|
||||
else
|
||||
{
|
||||
texturevpeg = sides[rover->master->sidenum[0]].rowoffset;
|
||||
attachtobottom = !!(gl_linedef->flags & ML_DONTPEGBOTTOM);
|
||||
slopeskew = !!(rover->master->flags & ML_DONTPEGTOP);
|
||||
}
|
||||
fixed_t texturevpeg = side->rowoffset;
|
||||
|
||||
glTex = HWR_GetTexture(texnum, noencore);
|
||||
|
||||
if (!slopeskew) // no skewing
|
||||
if (!do_texture_skew) // no skewing
|
||||
{
|
||||
if (attachtobottom)
|
||||
texturevpeg -= *rover->topheight - *rover->bottomheight;
|
||||
wallVerts[3].t = (*rover->topheight - h + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[2].t = (*rover->topheight - hS + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[0].t = (*rover->topheight - l + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = (*rover->topheight - lS + texturevpeg) * glTex->scaleY;
|
||||
if (dont_peg_bottom)
|
||||
texturevpeg -= (*rover->topheight - *rover->bottomheight);
|
||||
|
||||
wallVerts[3].t = ((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[2].t = ((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[0].t = ((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = ((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!attachtobottom) // skew by top
|
||||
if (!dont_peg_bottom) // skew by top
|
||||
{
|
||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
|
||||
wallVerts[0].t = (h - l + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = (hS - lS + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[0].t = ((h - l) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = ((hS - lS) + texturevpeg) * glTex->scaleY;
|
||||
}
|
||||
else // skew by bottom
|
||||
{
|
||||
@@ -2052,14 +2056,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope))
|
||||
continue;
|
||||
|
||||
texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture);
|
||||
side_t *side = R_GetFFloorSide(gl_curline->linedef, rover, gl_backsector);
|
||||
|
||||
boolean do_texture_skew;
|
||||
boolean dont_peg_bottom;
|
||||
|
||||
if (rover->master->flags & ML_TFERLINE)
|
||||
{
|
||||
size_t linenum = std::min<size_t>(gl_curline->linedef-gl_backsector->lines[0], rover->master->frontsector->linecount);
|
||||
newline = rover->master->frontsector->lines[0] + linenum;
|
||||
texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture);
|
||||
line_t *newline = R_GetFFloorLine(gl_curline->linedef, rover, gl_backsector);
|
||||
do_texture_skew = newline->flags & ML_DONTPEGTOP;
|
||||
dont_peg_bottom = newline->flags & ML_DONTPEGBOTTOM;
|
||||
}
|
||||
else
|
||||
{
|
||||
do_texture_skew = rover->master->flags & ML_DONTPEGTOP;
|
||||
dont_peg_bottom = gl_curline->linedef->flags & ML_DONTPEGBOTTOM;
|
||||
}
|
||||
|
||||
texnum = R_GetTextureNum(side->midtexture);
|
||||
|
||||
h = P_GetFFloorTopZAt (rover, v1x, v1y);
|
||||
hS = P_GetFFloorTopZAt (rover, v2x, v2y);
|
||||
@@ -2096,17 +2110,37 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
}
|
||||
else
|
||||
{
|
||||
// Wow, how was this missing from OpenGL for so long?
|
||||
// ...Oh well, anyway, Lower Unpegged now changes pegging of FOFs like in software
|
||||
// -- Monster Iestyn 26/06/18
|
||||
fixed_t texturevpeg = side->rowoffset;
|
||||
|
||||
glTex = HWR_GetTexture(texnum, noencore);
|
||||
|
||||
if (newline)
|
||||
if (!do_texture_skew) // no skewing
|
||||
{
|
||||
wallVerts[3].t = wallVerts[2].t = (*rover->topheight - h + sides[newline->sidenum[0]].rowoffset) * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (h - l + (*rover->topheight - h + sides[newline->sidenum[0]].rowoffset)) * glTex->scaleY;
|
||||
if (dont_peg_bottom)
|
||||
texturevpeg -= (*rover->topheight - *rover->bottomheight);
|
||||
|
||||
wallVerts[3].t = ((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[2].t = ((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[0].t = ((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = ((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
|
||||
}
|
||||
else
|
||||
{
|
||||
wallVerts[3].t = wallVerts[2].t = (*rover->topheight - h + sides[rover->master->sidenum[0]].rowoffset) * glTex->scaleY;
|
||||
wallVerts[0].t = wallVerts[1].t = (h - l + (*rover->topheight - h + sides[rover->master->sidenum[0]].rowoffset)) * glTex->scaleY;
|
||||
if (!dont_peg_bottom) // skew by top
|
||||
{
|
||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
|
||||
wallVerts[0].t = ((h - l) + texturevpeg) * glTex->scaleY;
|
||||
wallVerts[1].t = ((hS - lS) + texturevpeg) * glTex->scaleY;
|
||||
}
|
||||
else // skew by bottom
|
||||
{
|
||||
wallVerts[0].t = wallVerts[1].t = texturevpeg * glTex->scaleY;
|
||||
wallVerts[3].t = wallVerts[0].t - (h - l) * glTex->scaleY;
|
||||
wallVerts[2].t = wallVerts[1].t - (hS - lS) * glTex->scaleY;
|
||||
}
|
||||
}
|
||||
|
||||
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
|
||||
|
||||
@@ -4798,7 +4798,6 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
||||
ffloor->master = master;
|
||||
ffloor->norender = INFTICS;
|
||||
|
||||
|
||||
// Scan the thinkers to check for special conditions applying to this FOF.
|
||||
// If we have thinkers sorted by sector, just check the relevant ones;
|
||||
// otherwise, check them all. Apologies for the ugly loop...
|
||||
|
||||
@@ -442,6 +442,28 @@ fixed_t R_ScaleFromGlobalAngle(angle_t visangle)
|
||||
return 64*FRACUNIT;
|
||||
}
|
||||
|
||||
line_t *R_GetFFloorLine(const line_t *line, const ffloor_t *pfloor, const sector_t *sector)
|
||||
{
|
||||
if (pfloor->master->flags & ML_TFERLINE)
|
||||
{
|
||||
size_t linenum = std::min<size_t>((size_t)(line - sector->lines[0]), pfloor->master->frontsector->linecount);
|
||||
return pfloor->master->frontsector->lines[0] + linenum;
|
||||
}
|
||||
else
|
||||
return pfloor->master;
|
||||
}
|
||||
|
||||
side_t *R_GetFFloorSide(const line_t *line, const ffloor_t *pfloor, const sector_t *sector)
|
||||
{
|
||||
if (pfloor->master->flags & ML_TFERLINE)
|
||||
{
|
||||
line_t *newline = R_GetFFloorLine(line, pfloor, sector);
|
||||
return &sides[newline->sidenum[0]];
|
||||
}
|
||||
else
|
||||
return &sides[pfloor->master->sidenum[0]];
|
||||
}
|
||||
|
||||
//
|
||||
// R_DoCulling
|
||||
// Checks viewz and top/bottom heights of an item against culling planes
|
||||
|
||||
@@ -150,6 +150,9 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y);
|
||||
#define R_PointToDist(x, y) R_PointToDist2(viewx, viewy, x, y)
|
||||
#define R_PointToDist2(px2, py2, px1, py1) FixedHypot((px1) - (px2), (py1) - (py2))
|
||||
|
||||
line_t *R_GetFFloorLine(const line_t *line, const ffloor_t *pfloor, const sector_t *sector);
|
||||
side_t *R_GetFFloorSide(const line_t *line, const ffloor_t *pfloor, const sector_t *sector);
|
||||
|
||||
boolean R_DoCulling(line_t *cullheight, line_t *viewcullheight, fixed_t vz, fixed_t bottomh, fixed_t toph);
|
||||
void R_GetRenderBlockMapDimensions(fixed_t drawdist, INT32 *xl, INT32 *xh, INT32 *yl, INT32 *yh);
|
||||
|
||||
|
||||
+34
-43
@@ -617,6 +617,11 @@ static boolean R_IsFFloorTranslucent(visffloor_t *pfloor)
|
||||
return false;
|
||||
}
|
||||
|
||||
static fixed_t R_GetSlopeTextureSlide(pslope_t *slope, angle_t lineangle)
|
||||
{
|
||||
return FixedMul(slope->zdelta, FINECOSINE((lineangle-slope->xydirection)>>ANGLETOFINESHIFT));
|
||||
}
|
||||
|
||||
//
|
||||
// R_RenderThickSideRange
|
||||
// Renders all the thick sides in the given range.
|
||||
@@ -633,16 +638,15 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
lightlist_t *light;
|
||||
r_lightlist_t *rlight;
|
||||
INT32 range;
|
||||
line_t *newline = NULL;
|
||||
// Render FOF sides kinda like normal sides, with the frac and step and everything
|
||||
// NOTE: INT64 instead of fixed_t because overflow concerns
|
||||
INT64 top_frac, top_step, bottom_frac, bottom_step;
|
||||
// skew FOF walls with slopes?
|
||||
boolean slopeskew = false;
|
||||
fixed_t ffloortextureslide = 0;
|
||||
INT32 oldx = -1;
|
||||
fixed_t oldtexturecolumn = -1;
|
||||
fixed_t left_top, left_bottom; // needed here for slope skewing
|
||||
pslope_t *skewslope = NULL;
|
||||
boolean do_texture_skew;
|
||||
boolean dont_peg_bottom;
|
||||
boolean fog = false;
|
||||
boolean fuzzy = false;
|
||||
|
||||
@@ -650,7 +654,6 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
|
||||
void (*colfunc_2s) (drawcolumndata_t* dc, column_t *);
|
||||
|
||||
|
||||
// Calculate light table.
|
||||
// Use different light tables
|
||||
// for horizontal / vertical / diagonal. Diagonal?
|
||||
@@ -659,16 +662,23 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
curline = drawseg->curline;
|
||||
backsector = pfloor->target;
|
||||
frontsector = curline->frontsector == pfloor->target ? curline->backsector : curline->frontsector;
|
||||
texnum = R_GetTextureNum(sides[pfloor->master->sidenum[0]].midtexture);
|
||||
sidedef = R_GetFFloorSide(curline->linedef, pfloor, pfloor->target);
|
||||
|
||||
R_SetColumnFunc(BASEDRAWFUNC);
|
||||
|
||||
if (pfloor->master->flags & ML_TFERLINE)
|
||||
{
|
||||
size_t linenum = std::min((size_t)(curline->linedef-backsector->lines[0]), pfloor->master->frontsector->linecount);
|
||||
newline = pfloor->master->frontsector->lines[0] + linenum;
|
||||
texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture);
|
||||
line_t *newline = R_GetFFloorLine(curline->linedef, pfloor, pfloor->target);
|
||||
do_texture_skew = newline->flags & ML_DONTPEGTOP;
|
||||
dont_peg_bottom = newline->flags & ML_DONTPEGBOTTOM;
|
||||
}
|
||||
else
|
||||
{
|
||||
do_texture_skew = pfloor->master->flags & ML_DONTPEGTOP;
|
||||
dont_peg_bottom = curline->linedef->flags & ML_DONTPEGBOTTOM;
|
||||
}
|
||||
|
||||
texnum = R_GetTextureNum(sidedef->midtexture);
|
||||
|
||||
if (pfloor->flags & FF_TRANSLUCENT)
|
||||
{
|
||||
@@ -828,54 +838,35 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
mceilingclip = drawseg->sprtopclip;
|
||||
dc->texheight = textureheight[texnum]>>FRACBITS;
|
||||
|
||||
// calculate both left endrawseg
|
||||
// calculate both left ends
|
||||
left_top = P_GetFFloorTopZAt (pfloor, drawseg->leftpos.x, drawseg->leftpos.y) - viewz;
|
||||
left_bottom = P_GetFFloorBottomZAt(pfloor, drawseg->leftpos.x, drawseg->leftpos.y) - viewz;
|
||||
|
||||
skewslope = *pfloor->t_slope; // skew using top slope by default
|
||||
|
||||
if (newline)
|
||||
if (do_texture_skew)
|
||||
{
|
||||
if (newline->flags & ML_DONTPEGTOP)
|
||||
slopeskew = true;
|
||||
}
|
||||
else if (pfloor->master->flags & ML_DONTPEGTOP)
|
||||
slopeskew = true;
|
||||
|
||||
if (slopeskew)
|
||||
skewslope = *pfloor->t_slope; // skew using top slope by default
|
||||
dc->texturemid = left_top;
|
||||
}
|
||||
else
|
||||
dc->texturemid = *pfloor->topheight - viewz;
|
||||
|
||||
if (newline)
|
||||
offsetvalue = sidedef->rowoffset;
|
||||
|
||||
if (dont_peg_bottom)
|
||||
{
|
||||
offsetvalue = sides[newline->sidenum[0]].rowoffset;
|
||||
if (newline->flags & ML_DONTPEGBOTTOM)
|
||||
if (do_texture_skew)
|
||||
{
|
||||
skewslope = *pfloor->b_slope; // skew using bottom slope
|
||||
if (slopeskew)
|
||||
dc->texturemid = left_bottom;
|
||||
else
|
||||
offsetvalue -= *pfloor->topheight - *pfloor->bottomheight;
|
||||
dc->texturemid = left_bottom;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
offsetvalue = sides[pfloor->master->sidenum[0]].rowoffset;
|
||||
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
|
||||
{
|
||||
skewslope = *pfloor->b_slope; // skew using bottom slope
|
||||
if (slopeskew)
|
||||
dc->texturemid = left_bottom;
|
||||
else
|
||||
else
|
||||
offsetvalue -= *pfloor->topheight - *pfloor->bottomheight;
|
||||
}
|
||||
}
|
||||
|
||||
if (slopeskew && skewslope)
|
||||
if (skewslope)
|
||||
{
|
||||
angle_t lineangle = R_PointToAngle2(curline->v1->x, curline->v1->y, curline->v2->x, curline->v2->y);
|
||||
ffloortextureslide = FixedMul(skewslope->zdelta, FINECOSINE((lineangle-skewslope->xydirection)>>ANGLETOFINESHIFT));
|
||||
ffloortextureslide = R_GetSlopeTextureSlide(skewslope, lineangle);
|
||||
}
|
||||
|
||||
dc->texturemid += offsetvalue;
|
||||
@@ -921,9 +912,9 @@ void R_RenderThickSideRange(drawseg_t *drawseg, INT32 x1, INT32 x2, ffloor_t *pf
|
||||
// skew FOF walls
|
||||
if (ffloortextureslide)
|
||||
{
|
||||
if (oldx != -1)
|
||||
dc->texturemid += FixedMul(ffloortextureslide, (maskedtexturecol[oldx]-maskedtexturecol[dc->x]));
|
||||
oldx = dc->x;
|
||||
if (oldtexturecolumn != -1)
|
||||
dc->texturemid += FixedMul(ffloortextureslide, (oldtexturecolumn-maskedtexturecol[dc->x]));
|
||||
oldtexturecolumn = drawseg->thicksidecol[dc->x];
|
||||
}
|
||||
|
||||
// Calculate bounds
|
||||
|
||||
Reference in new issue
Block a user