mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-08 17:22:18 +00:00
Fix 3D floor texture skewing
This commit is contained in:
parent
36e64cb683
commit
61701c3c53
2 changed files with 20 additions and 15 deletions
|
@ -1626,17 +1626,22 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
|
|
||||||
side_t *side = &sides[rover->master->sidenum[0]];
|
side_t *side = &sides[rover->master->sidenum[0]];
|
||||||
|
|
||||||
INT16 lineflags;
|
boolean do_texture_skew;
|
||||||
|
boolean dont_peg_bottom;
|
||||||
|
|
||||||
if (rover->master->flags & ML_TFERLINE)
|
if (rover->master->flags & ML_TFERLINE)
|
||||||
{
|
{
|
||||||
size_t linenum = gl_curline->linedef-gl_backsector->lines[0];
|
size_t linenum = gl_curline->linedef-gl_backsector->lines[0];
|
||||||
newline = rover->master->frontsector->lines[0] + linenum;
|
newline = rover->master->frontsector->lines[0] + linenum;
|
||||||
side = &sides[newline->sidenum[0]];
|
side = &sides[newline->sidenum[0]];
|
||||||
lineflags = newline->flags;
|
do_texture_skew = newline->flags & ML_SKEWTD;
|
||||||
|
dont_peg_bottom = newline->flags & ML_DONTPEGBOTTOM;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
lineflags = gl_curline->linedef->flags;
|
{
|
||||||
|
do_texture_skew = rover->master->flags & ML_SKEWTD;
|
||||||
|
dont_peg_bottom = gl_curline->linedef->flags & ML_DONTPEGBOTTOM;
|
||||||
|
}
|
||||||
|
|
||||||
texnum = R_GetTextureNum(side->midtexture);
|
texnum = R_GetTextureNum(side->midtexture);
|
||||||
|
|
||||||
|
@ -1675,15 +1680,14 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
// ...Oh well, anyway, Lower Unpegged now changes pegging of FOFs like in software
|
// ...Oh well, anyway, Lower Unpegged now changes pegging of FOFs like in software
|
||||||
// -- Monster Iestyn 26/06/18
|
// -- Monster Iestyn 26/06/18
|
||||||
fixed_t texturevpeg = side->rowoffset + side->offsety_mid;
|
fixed_t texturevpeg = side->rowoffset + side->offsety_mid;
|
||||||
boolean attachtobottom = !!(lineflags & ML_DONTPEGBOTTOM);
|
|
||||||
|
|
||||||
grTex = HWR_GetTexture(texnum);
|
grTex = HWR_GetTexture(texnum);
|
||||||
xscale = FixedToFloat(side->scalex_mid);
|
xscale = FixedToFloat(side->scalex_mid);
|
||||||
yscale = FixedToFloat(side->scaley_mid);
|
yscale = FixedToFloat(side->scaley_mid);
|
||||||
|
|
||||||
if (!(lineflags & ML_SKEWTD)) // no skewing
|
if (!do_texture_skew) // no skewing
|
||||||
{
|
{
|
||||||
if (attachtobottom)
|
if (dont_peg_bottom)
|
||||||
texturevpeg -= (*rover->topheight - *rover->bottomheight) * yscale;
|
texturevpeg -= (*rover->topheight - *rover->bottomheight) * yscale;
|
||||||
|
|
||||||
wallVerts[3].t = (((*rover->topheight - h) * yscale) + texturevpeg) * grTex->scaleY;
|
wallVerts[3].t = (((*rover->topheight - h) * yscale) + texturevpeg) * grTex->scaleY;
|
||||||
|
@ -1693,7 +1697,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!attachtobottom) // skew by top
|
if (!dont_peg_bottom) // skew by top
|
||||||
{
|
{
|
||||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
|
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
|
||||||
wallVerts[0].t = (((h - l) * yscale) + texturevpeg) * grTex->scaleY;
|
wallVerts[0].t = (((h - l) * yscale) + texturevpeg) * grTex->scaleY;
|
||||||
|
|
17
src/r_segs.c
17
src/r_segs.c
|
@ -543,7 +543,6 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||||
lightlist_t *light;
|
lightlist_t *light;
|
||||||
r_lightlist_t *rlight;
|
r_lightlist_t *rlight;
|
||||||
INT32 range;
|
INT32 range;
|
||||||
line_t *newline = NULL;
|
|
||||||
// Render FOF sides kinda like normal sides, with the frac and step and everything
|
// Render FOF sides kinda like normal sides, with the frac and step and everything
|
||||||
// NOTE: INT64 instead of fixed_t because overflow concerns
|
// NOTE: INT64 instead of fixed_t because overflow concerns
|
||||||
INT64 top_frac, top_step, bottom_frac, bottom_step;
|
INT64 top_frac, top_step, bottom_frac, bottom_step;
|
||||||
|
@ -553,7 +552,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||||
fixed_t left_top, left_bottom; // needed here for slope skewing
|
fixed_t left_top, left_bottom; // needed here for slope skewing
|
||||||
pslope_t *skewslope = NULL;
|
pslope_t *skewslope = NULL;
|
||||||
boolean do_texture_skew;
|
boolean do_texture_skew;
|
||||||
INT16 lineflags;
|
boolean dont_peg_bottom;
|
||||||
fixed_t wall_scalex, wall_scaley;
|
fixed_t wall_scalex, wall_scaley;
|
||||||
|
|
||||||
void (*colfunc_2s) (column_t *);
|
void (*colfunc_2s) (column_t *);
|
||||||
|
@ -573,12 +572,16 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||||
if (pfloor->master->flags & ML_TFERLINE)
|
if (pfloor->master->flags & ML_TFERLINE)
|
||||||
{
|
{
|
||||||
size_t linenum = curline->linedef-backsector->lines[0];
|
size_t linenum = curline->linedef-backsector->lines[0];
|
||||||
newline = pfloor->master->frontsector->lines[0] + linenum;
|
line_t *newline = pfloor->master->frontsector->lines[0] + linenum;
|
||||||
sidedef = &sides[newline->sidenum[0]];
|
sidedef = &sides[newline->sidenum[0]];
|
||||||
lineflags = newline->flags;
|
do_texture_skew = newline->flags & ML_SKEWTD;
|
||||||
|
dont_peg_bottom = newline->flags & ML_DONTPEGBOTTOM;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
lineflags = curline->linedef->flags;
|
{
|
||||||
|
do_texture_skew = pfloor->master->flags & ML_SKEWTD;
|
||||||
|
dont_peg_bottom = curline->linedef->flags & ML_DONTPEGBOTTOM;
|
||||||
|
}
|
||||||
|
|
||||||
texnum = R_GetTextureNum(sidedef->midtexture);
|
texnum = R_GetTextureNum(sidedef->midtexture);
|
||||||
|
|
||||||
|
@ -756,8 +759,6 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||||
left_top = P_GetFFloorTopZAt (pfloor, ds->leftpos.x, ds->leftpos.y) - viewz;
|
left_top = P_GetFFloorTopZAt (pfloor, ds->leftpos.x, ds->leftpos.y) - viewz;
|
||||||
left_bottom = P_GetFFloorBottomZAt(pfloor, ds->leftpos.x, ds->leftpos.y) - viewz;
|
left_bottom = P_GetFFloorBottomZAt(pfloor, ds->leftpos.x, ds->leftpos.y) - viewz;
|
||||||
|
|
||||||
do_texture_skew = lineflags & ML_SKEWTD;
|
|
||||||
|
|
||||||
if (do_texture_skew)
|
if (do_texture_skew)
|
||||||
{
|
{
|
||||||
skewslope = *pfloor->t_slope; // skew using top slope by default
|
skewslope = *pfloor->t_slope; // skew using top slope by default
|
||||||
|
@ -768,7 +769,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||||
|
|
||||||
offsetvalue = sidedef->rowoffset + sidedef->offsety_mid;
|
offsetvalue = sidedef->rowoffset + sidedef->offsety_mid;
|
||||||
|
|
||||||
if (lineflags & ML_DONTPEGBOTTOM)
|
if (dont_peg_bottom)
|
||||||
{
|
{
|
||||||
if (do_texture_skew)
|
if (do_texture_skew)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue