Merge branch 'fixfoftferline' into 'next'

Fix FOFs with transferline flag and many linedefs randomly crashing

See merge request STJr/SRB2!2285
This commit is contained in:
Lactozilla 2024-06-02 21:04:48 +00:00
commit 02d18ff44d
4 changed files with 12 additions and 12 deletions

View file

@ -1533,14 +1533,14 @@ static void HWR_ProcessSeg(void)
if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope))
continue;
side_t *side = R_GetFFloorSide(gl_curline, rover);
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)
{
line_t *newline = R_GetFFloorLine(gl_curline, rover);
line_t *newline = R_GetFFloorLine(gl_curline->linedef, rover, gl_backsector);
do_texture_skew = newline->flags & ML_SKEWTD;
dont_peg_bottom = newline->flags & ML_DONTPEGBOTTOM;
}
@ -1689,14 +1689,14 @@ static void HWR_ProcessSeg(void)
if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope))
continue;
side_t *side = R_GetFFloorSide(gl_curline, rover);
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)
{
line_t *newline = R_GetFFloorLine(gl_curline, rover);
line_t *newline = R_GetFFloorLine(gl_curline->linedef, rover, gl_backsector);
do_texture_skew = newline->flags & ML_SKEWTD;
dont_peg_bottom = newline->flags & ML_DONTPEGBOTTOM;
}

View file

@ -390,22 +390,22 @@ fixed_t R_PointToDist(fixed_t x, fixed_t y)
return R_PointToDist2(viewx, viewy, x, y);
}
line_t *R_GetFFloorLine(const seg_t *seg, const ffloor_t *pfloor)
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 = seg->linedef - pfloor->target->lines[0];
size_t linenum = min((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 seg_t *seg, const ffloor_t *pfloor)
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(seg, pfloor);
line_t *newline = R_GetFFloorLine(line, pfloor, sector);
return &sides[newline->sidenum[0]];
}
else

View file

@ -86,8 +86,8 @@ subsector_t *R_PointInSubsectorOrNull(fixed_t x, fixed_t y);
boolean R_DoCulling(line_t *cullheight, line_t *viewcullheight, fixed_t vz, fixed_t bottomh, fixed_t toph);
line_t *R_GetFFloorLine(const seg_t *seg, const ffloor_t *pfloor);
side_t *R_GetFFloorSide(const seg_t *seg, const ffloor_t *pfloor);
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);
// Render stats

View file

@ -574,13 +574,13 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
curline = ds->curline;
backsector = pfloor->target;
frontsector = curline->frontsector == pfloor->target ? curline->backsector : curline->frontsector;
sidedef = R_GetFFloorSide(curline, pfloor);
sidedef = R_GetFFloorSide(curline->linedef, pfloor, pfloor->target);
colfunc = colfuncs[BASEDRAWFUNC];
if (pfloor->master->flags & ML_TFERLINE)
{
line_t *newline = R_GetFFloorLine(curline, pfloor);
line_t *newline = R_GetFFloorLine(curline->linedef, pfloor, pfloor->target);
do_texture_skew = newline->flags & ML_SKEWTD;
dont_peg_bottom = newline->flags & ML_DONTPEGBOTTOM;
}