Do clipsolid for doorclosed only while your camera is outside of the sector

This commit is contained in:
TehRealSalt 2018-10-06 16:22:36 -04:00
parent ea6bdca949
commit 3d7a1d44d5
2 changed files with 66 additions and 54 deletions

View file

@ -374,6 +374,7 @@ static void R_AddLine(seg_t *line)
INT32 x1, x2;
angle_t angle1, angle2, span, tspan;
static sector_t tempsec; // ceiling/water hack
sector_t *thissec = R_PointInSubsector(viewx, viewy)->sector;
if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES))
return;
@ -478,21 +479,24 @@ static void R_AddLine(seg_t *line)
SLOPEPARAMS( backsector->f_slope, backf1, backf2, backsector->floorheight)
SLOPEPARAMS( backsector->c_slope, backc1, backc2, backsector->ceilingheight)
#undef SLOPEPARAMS
if ((backc1 <= frontf1 && backc2 <= frontf2)
|| (backf1 >= frontc1 && backf2 >= frontc2))
if (thissec != backsector && thissec != frontsector)
{
goto clipsolid;
if ((backc1 <= frontf1 && backc2 <= frontf2)
|| (backf1 >= frontc1 && backf2 >= frontc2))
{
goto clipsolid;
}
// Check for automap fix. Store in doorclosed for r_segs.c
doorclosed = (backc1 <= backf1 && backc2 <= backf2
&& ((backc1 >= frontc1 && backc2 >= frontc2) || curline->sidedef->toptexture)
&& ((backf1 <= frontf1 && backf2 >= frontf2) || curline->sidedef->bottomtexture)
&& (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum));
if (doorclosed)
goto clipsolid;
}
// Check for automap fix. Store in doorclosed for r_segs.c
doorclosed = (backc1 <= backf1 && backc2 <= backf2
&& ((backc1 >= frontc1 && backc2 >= frontc2) || curline->sidedef->toptexture)
&& ((backf1 <= frontf1 && backf2 >= frontf2) || curline->sidedef->bottomtexture)
&& (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum));
if (doorclosed)
goto clipsolid;
// Window.
if (backc1 != frontc1 || backc2 != frontc2
|| backf1 != frontf1 || backf2 != frontf2)
@ -503,21 +507,24 @@ static void R_AddLine(seg_t *line)
else
#endif
{
if (backsector->ceilingheight <= frontsector->floorheight
|| backsector->floorheight >= frontsector->ceilingheight)
if (thissec != backsector && thissec != frontsector)
{
goto clipsolid;
if (backsector->ceilingheight <= frontsector->floorheight
|| backsector->floorheight >= frontsector->ceilingheight)
{
goto clipsolid;
}
// Check for automap fix. Store in doorclosed for r_segs.c
doorclosed = (backsector->ceilingheight <= backsector->floorheight
&& (backsector->ceilingheight >= frontsector->ceilingheight || curline->sidedef->toptexture)
&& (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture)
&& (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum));
if (doorclosed)
goto clipsolid;
}
// Check for automap fix. Store in doorclosed for r_segs.c
doorclosed = (backsector->ceilingheight <= backsector->floorheight
&& (backsector->ceilingheight >= frontsector->ceilingheight || curline->sidedef->toptexture)
&& (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture)
&& (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum));
if (doorclosed)
goto clipsolid;
// Window.
if (backsector->ceilingheight != frontsector->ceilingheight
|| backsector->floorheight != frontsector->floorheight)

View file

@ -2020,6 +2020,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
{
// two sided line
sector_t *thissec = R_PointInSubsector(viewx, viewy)->sector;
#ifdef ESLOPE
if (backsector->c_slope) {
worldhigh = P_GetZAt(backsector->c_slope, segleft.x, segleft.y) - viewz;
@ -2113,52 +2115,55 @@ void R_StoreWallRange(INT32 start, INT32 stop)
// ds_p->sprtopclip = screenheightarray;
}
#ifdef ESLOPE
if (worldhigh <= worldbottom && worldhighslope <= worldbottomslope)
#else
if (worldhigh <= worldbottom)
#endif
{
ds_p->sprbottomclip = negonearray;
ds_p->bsilheight = INT32_MAX;
ds_p->silhouette |= SIL_BOTTOM;
}
#ifdef ESLOPE
if (worldlow >= worldtop && worldlowslope >= worldtopslope)
#else
if (worldlow >= worldtop)
#endif
{
ds_p->sprtopclip = screenheightarray;
ds_p->tsilheight = INT32_MIN;
ds_p->silhouette |= SIL_TOP;
}
//SoM: 3/25/2000: This code fixes an automap bug that didn't check
// frontsector->ceiling and backsector->floor to see if a door was closed.
// Without the following code, sprites get displayed behind closed doors.
if (thissec != frontsector && thissec != backsector)
{
#ifdef ESLOPE
if (doorclosed || (worldhigh <= worldbottom && worldhighslope <= worldbottomslope))
if (worldhigh <= worldbottom && worldhighslope <= worldbottomslope)
#else
if (doorclosed || backsector->ceilingheight <= frontsector->floorheight)
if (worldhigh <= worldbottom)
#endif
{
ds_p->sprbottomclip = negonearray;
ds_p->bsilheight = INT32_MAX;
ds_p->silhouette |= SIL_BOTTOM;
}
#ifdef ESLOPE
if (doorclosed || (worldlow >= worldtop && worldlowslope >= worldtopslope))
if (worldlow >= worldtop && worldlowslope >= worldtopslope)
#else
if (doorclosed || backsector->floorheight >= frontsector->ceilingheight)
if (worldlow >= worldtop)
#endif
{ // killough 1/17/98, 2/8/98
{
ds_p->sprtopclip = screenheightarray;
ds_p->tsilheight = INT32_MIN;
ds_p->silhouette |= SIL_TOP;
}
//SoM: 3/25/2000: This code fixes an automap bug that didn't check
// frontsector->ceiling and backsector->floor to see if a door was closed.
// Without the following code, sprites get displayed behind closed doors.
{
#ifdef ESLOPE
if (doorclosed || (worldhigh <= worldbottom && worldhighslope <= worldbottomslope))
#else
if (doorclosed || backsector->ceilingheight <= frontsector->floorheight)
#endif
{
ds_p->sprbottomclip = negonearray;
ds_p->bsilheight = INT32_MAX;
ds_p->silhouette |= SIL_BOTTOM;
}
#ifdef ESLOPE
if (doorclosed || (worldlow >= worldtop && worldlowslope >= worldtopslope))
#else
if (doorclosed || backsector->floorheight >= frontsector->ceilingheight)
#endif
{ // killough 1/17/98, 2/8/98
ds_p->sprtopclip = screenheightarray;
ds_p->tsilheight = INT32_MIN;
ds_p->silhouette |= SIL_TOP;
}
}
}
if (worldlow != worldbottom