mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-29 20:50:58 +00:00
Cleanup of the code I've tweaked for skies, added SLOPEPARAMS macro to R_StoreWallRange for use in getting seg end z positions
This commit is contained in:
parent
ecf2eed37f
commit
0dc867c05e
3 changed files with 42 additions and 118 deletions
|
@ -1555,14 +1555,10 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
|
||||||
|
|
||||||
// hack to allow height changes in outdoor areas
|
// hack to allow height changes in outdoor areas
|
||||||
// This is what gets rid of the upper textures if there should be sky
|
// This is what gets rid of the upper textures if there should be sky
|
||||||
if (gr_frontsector->ceilingpic == skyflatnum &&
|
if (gr_frontsector->ceilingpic == skyflatnum
|
||||||
gr_backsector->ceilingpic == skyflatnum)
|
&& gr_backsector->ceilingpic == skyflatnum)
|
||||||
{
|
{
|
||||||
bothceilingssky = true;
|
bothceilingssky = true;
|
||||||
//worldtop = worldhigh;
|
|
||||||
#ifdef ESLOPE
|
|
||||||
//worldtopslope = worldhighslope;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bothceilingssky)
|
if (!bothceilingssky)
|
||||||
|
@ -2464,21 +2460,10 @@ static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacks
|
||||||
if (abacksector->ceilingpic != skyflatnum || afrontsector->ceilingpic != skyflatnum)
|
if (abacksector->ceilingpic != skyflatnum || afrontsector->ceilingpic != skyflatnum)
|
||||||
{
|
{
|
||||||
// now check for closed sectors!
|
// now check for closed sectors!
|
||||||
if (backc1 <= frontf1 && backc2 <= frontf2)
|
if ((backc1 <= frontf1 && backc2 <= frontf2)
|
||||||
|
|| (backf1 >= frontc1 && backf2 >= frontc2))
|
||||||
{
|
{
|
||||||
checkforemptylines = false;
|
checkforemptylines = false;
|
||||||
//if (!seg->sidedef->toptexture)
|
|
||||||
//return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (backf1 >= frontc1 && backf2 >= frontc2)
|
|
||||||
{
|
|
||||||
checkforemptylines = false;
|
|
||||||
//if (!seg->sidedef->bottomtexture)
|
|
||||||
//return false;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2981,9 +2966,7 @@ static void HWR_AddLine(seg_t * line)
|
||||||
// Check for automap fix.
|
// Check for automap fix.
|
||||||
if (backc1 <= backf1 && backc2 <= backf2
|
if (backc1 <= backf1 && backc2 <= backf2
|
||||||
&& ((backc1 >= frontc1 && backc2 >= frontc2) || gr_curline->sidedef->toptexture)
|
&& ((backc1 >= frontc1 && backc2 >= frontc2) || gr_curline->sidedef->toptexture)
|
||||||
&& ((backf1 <= frontf1 && backf2 >= frontf2) || gr_curline->sidedef->bottomtexture)
|
&& ((backf1 <= frontf1 && backf2 >= frontf2) || gr_curline->sidedef->bottomtexture))
|
||||||
//&& (gr_backsector->ceilingpic != skyflatnum || gr_frontsector->ceilingpic != skyflatnum)
|
|
||||||
)
|
|
||||||
goto clipsolid;
|
goto clipsolid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3008,9 +2991,7 @@ static void HWR_AddLine(seg_t * line)
|
||||||
// Check for automap fix.
|
// Check for automap fix.
|
||||||
if (gr_backsector->ceilingheight <= gr_backsector->floorheight
|
if (gr_backsector->ceilingheight <= gr_backsector->floorheight
|
||||||
&& ((gr_backsector->ceilingheight >= gr_frontsector->ceilingheight) || gr_curline->sidedef->toptexture)
|
&& ((gr_backsector->ceilingheight >= gr_frontsector->ceilingheight) || gr_curline->sidedef->toptexture)
|
||||||
&& ((gr_backsector->floorheight <= gr_backsector->floorheight) || gr_curline->sidedef->bottomtexture)
|
&& ((gr_backsector->floorheight <= gr_backsector->floorheight) || gr_curline->sidedef->bottomtexture))
|
||||||
//&& (gr_backsector->ceilingpic != skyflatnum || gr_frontsector->ceilingpic != skyflatnum)
|
|
||||||
)
|
|
||||||
goto clipsolid;
|
goto clipsolid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,10 +220,7 @@ static INT32 R_DoorClosed(void)
|
||||||
// preserve a kind of transparent door/lift special effect:
|
// preserve a kind of transparent door/lift special effect:
|
||||||
&& (backsector->ceilingheight >= frontsector->ceilingheight || curline->sidedef->toptexture)
|
&& (backsector->ceilingheight >= frontsector->ceilingheight || curline->sidedef->toptexture)
|
||||||
|
|
||||||
&& (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture)
|
&& (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture);
|
||||||
|
|
||||||
// properly render skies (consider door "open" if both ceilings are sky):
|
|
||||||
&& (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -520,9 +517,7 @@ static void R_AddLine(seg_t *line)
|
||||||
// Check for automap fix. Store in doorclosed for r_segs.c
|
// Check for automap fix. Store in doorclosed for r_segs.c
|
||||||
doorclosed = (backc1 <= backf1 && backc2 <= backf2
|
doorclosed = (backc1 <= backf1 && backc2 <= backf2
|
||||||
&& ((backc1 >= frontc1 && backc2 >= frontc2) || curline->sidedef->toptexture)
|
&& ((backc1 >= frontc1 && backc2 >= frontc2) || curline->sidedef->toptexture)
|
||||||
&& ((backf1 <= frontf1 && backf2 >= frontf2) || curline->sidedef->bottomtexture)
|
&& ((backf1 <= frontf1 && backf2 >= frontf2) || curline->sidedef->bottomtexture));
|
||||||
//&& (backsector->ceilingpic != skyflatnum || frontsector->ceilingpic != skyflatnum)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (doorclosed)
|
if (doorclosed)
|
||||||
goto clipsolid;
|
goto clipsolid;
|
||||||
|
|
120
src/r_segs.c
120
src/r_segs.c
|
@ -1894,29 +1894,26 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frontsector->c_slope) {
|
|
||||||
worldtop = P_GetZAt(frontsector->c_slope, segleft.x, segleft.y) - viewz;
|
|
||||||
worldtopslope = P_GetZAt(frontsector->c_slope, segright.x, segright.y) - viewz;
|
|
||||||
} else {
|
|
||||||
worldtopslope =
|
|
||||||
#else
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
worldtop = frontsector->ceilingheight - viewz;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||||
|
if (slope) { \
|
||||||
|
end1 = P_GetZAt(slope, segleft.x, segleft.y); \
|
||||||
|
end2 = P_GetZAt(slope, segright.x, segright.y); \
|
||||||
|
} else \
|
||||||
|
end1 = end2 = normalheight;
|
||||||
|
|
||||||
#ifdef ESLOPE
|
SLOPEPARAMS(frontsector->c_slope, worldtop, worldtopslope, frontsector->ceilingheight)
|
||||||
if (frontsector->f_slope) {
|
SLOPEPARAMS(frontsector->f_slope, worldbottom, worldbottomslope, frontsector->floorheight)
|
||||||
worldbottom = P_GetZAt(frontsector->f_slope, segleft.x, segleft.y) - viewz;
|
// subtract viewz from these to turn them into
|
||||||
worldbottomslope = P_GetZAt(frontsector->f_slope, segright.x, segright.y) - viewz;
|
// positions relative to the camera's z position
|
||||||
} else {
|
worldtop -= viewz;
|
||||||
worldbottomslope =
|
worldtopslope -= viewz;
|
||||||
|
worldbottom -= viewz;
|
||||||
|
worldbottomslope -= viewz;
|
||||||
#else
|
#else
|
||||||
{
|
worldtop = frontsector->ceilingheight - viewz;
|
||||||
|
worldbottom = frontsector->floorheight - viewz;
|
||||||
#endif
|
#endif
|
||||||
worldbottom = frontsector->floorheight - viewz;
|
|
||||||
}
|
|
||||||
|
|
||||||
midtexture = toptexture = bottomtexture = maskedtexture = 0;
|
midtexture = toptexture = bottomtexture = maskedtexture = 0;
|
||||||
ds_p->maskedtexturecol = NULL;
|
ds_p->maskedtexturecol = NULL;
|
||||||
|
@ -2021,40 +2018,23 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
boolean bothceilingssky = false; // turned on if both back and front ceilings are sky
|
boolean bothceilingssky = false; // turned on if both back and front ceilings are sky
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
if (backsector->c_slope) {
|
SLOPEPARAMS(backsector->c_slope, worldhigh, worldhighslope, backsector->ceilingheight)
|
||||||
worldhigh = P_GetZAt(backsector->c_slope, segleft.x, segleft.y) - viewz;
|
SLOPEPARAMS(backsector->f_slope, worldlow, worldlowslope, backsector->floorheight)
|
||||||
worldhighslope = P_GetZAt(backsector->c_slope, segright.x, segright.y) - viewz;
|
worldhigh -= viewz;
|
||||||
} else {
|
worldhighslope -= viewz;
|
||||||
worldhighslope =
|
worldlow -= viewz;
|
||||||
|
worldlowslope -= viewz;
|
||||||
#else
|
#else
|
||||||
{
|
worldhigh = backsector->ceilingheight - viewz;
|
||||||
|
worldlow = backsector->floorheight - viewz;
|
||||||
#endif
|
#endif
|
||||||
worldhigh = backsector->ceilingheight - viewz;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef ESLOPE
|
|
||||||
if (backsector->f_slope) {
|
|
||||||
worldlow = P_GetZAt(backsector->f_slope, segleft.x, segleft.y) - viewz;
|
|
||||||
worldlowslope = P_GetZAt(backsector->f_slope, segright.x, segright.y) - viewz;
|
|
||||||
} else {
|
|
||||||
worldlowslope =
|
|
||||||
#else
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
worldlow = backsector->floorheight - viewz;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// hack to allow height changes in outdoor areas
|
// hack to allow height changes in outdoor areas
|
||||||
|
// This is what gets rid of the upper textures if there should be sky
|
||||||
if (frontsector->ceilingpic == skyflatnum
|
if (frontsector->ceilingpic == skyflatnum
|
||||||
&& backsector->ceilingpic == skyflatnum)
|
&& backsector->ceilingpic == skyflatnum)
|
||||||
{
|
{
|
||||||
bothceilingssky = true;
|
bothceilingssky = true;
|
||||||
#ifdef ESLOPE
|
|
||||||
//worldtopslope = worldhighslope;
|
|
||||||
#endif
|
|
||||||
//worldtop = worldhigh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ds_p->sprtopclip = ds_p->sprbottomclip = NULL;
|
ds_p->sprtopclip = ds_p->sprbottomclip = NULL;
|
||||||
|
@ -2375,16 +2355,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
if (*rover->t_slope) {
|
SLOPEPARAMS(*rover->t_slope, high1, highslope1, *rover->topheight)
|
||||||
high1 = P_GetZAt(*rover->t_slope, segleft.x, segleft.y);
|
SLOPEPARAMS(*rover->b_slope, low1, lowslope1, *rover->bottomheight)
|
||||||
highslope1 = P_GetZAt(*rover->t_slope, segright.x, segright.y);
|
|
||||||
} else
|
|
||||||
high1 = highslope1 = *rover->topheight;
|
|
||||||
if (*rover->b_slope) {
|
|
||||||
low1 = P_GetZAt(*rover->b_slope, segleft.x, segleft.y);
|
|
||||||
lowslope1 = P_GetZAt(*rover->b_slope, segright.x, segright.y);
|
|
||||||
} else
|
|
||||||
low1 = lowslope1 = *rover->bottomheight;
|
|
||||||
|
|
||||||
if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope))
|
if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope))
|
||||||
continue;
|
continue;
|
||||||
|
@ -2416,16 +2388,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
if (*r2->t_slope) {
|
SLOPEPARAMS(*r2->t_slope, high2, highslope2, *r2->topheight)
|
||||||
high2 = P_GetZAt(*r2->t_slope, segleft.x, segleft.y);
|
SLOPEPARAMS(*r2->b_slope, low2, lowslope2, *r2->bottomheight)
|
||||||
highslope2 = P_GetZAt(*r2->t_slope, segright.x, segright.y);
|
|
||||||
} else
|
|
||||||
high2 = highslope2 = *r2->topheight;
|
|
||||||
if (*r2->b_slope) {
|
|
||||||
low2 = P_GetZAt(*r2->b_slope, segleft.x, segleft.y);
|
|
||||||
lowslope2 = P_GetZAt(*r2->b_slope, segright.x, segright.y);
|
|
||||||
} else
|
|
||||||
low2 = lowslope2 = *r2->bottomheight;
|
|
||||||
|
|
||||||
if ((high2 < lowcut || highslope2 < lowcutslope) || (low2 > highcut || lowslope2 > highcutslope))
|
if ((high2 < lowcut || highslope2 < lowcutslope) || (low2 > highcut || lowslope2 > highcutslope))
|
||||||
continue;
|
continue;
|
||||||
|
@ -2458,16 +2422,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
if (*rover->t_slope) {
|
SLOPEPARAMS(*rover->t_slope, high1, highslope1, *rover->topheight)
|
||||||
high1 = P_GetZAt(*rover->t_slope, segleft.x, segleft.y);
|
SLOPEPARAMS(*rover->b_slope, low1, lowslope1, *rover->bottomheight)
|
||||||
highslope1 = P_GetZAt(*rover->t_slope, segright.x, segright.y);
|
|
||||||
} else
|
|
||||||
high1 = highslope1 = *rover->topheight;
|
|
||||||
if (*rover->b_slope) {
|
|
||||||
low1 = P_GetZAt(*rover->b_slope, segleft.x, segleft.y);
|
|
||||||
lowslope1 = P_GetZAt(*rover->b_slope, segright.x, segright.y);
|
|
||||||
} else
|
|
||||||
low1 = lowslope1 = *rover->bottomheight;
|
|
||||||
|
|
||||||
if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope))
|
if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope))
|
||||||
continue;
|
continue;
|
||||||
|
@ -2499,17 +2455,9 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
if (*r2->t_slope) {
|
SLOPEPARAMS(*r2->t_slope, high2, highslope2, *r2->topheight)
|
||||||
high2 = P_GetZAt(*r2->t_slope, segleft.x, segleft.y);
|
SLOPEPARAMS(*r2->b_slope, low2, lowslope2, *r2->bottomheight)
|
||||||
highslope2 = P_GetZAt(*r2->t_slope, segright.x, segright.y);
|
#undef SLOPEPARAMS
|
||||||
} else
|
|
||||||
high2 = highslope2 = *r2->topheight;
|
|
||||||
if (*r2->b_slope) {
|
|
||||||
low2 = P_GetZAt(*r2->b_slope, segleft.x, segleft.y);
|
|
||||||
lowslope2 = P_GetZAt(*r2->b_slope, segright.x, segright.y);
|
|
||||||
} else
|
|
||||||
low2 = lowslope2 = *r2->bottomheight;
|
|
||||||
|
|
||||||
if ((high2 < lowcut || highslope2 < lowcutslope) || (low2 > highcut || lowslope2 > highcutslope))
|
if ((high2 < lowcut || highslope2 < lowcutslope) || (low2 > highcut || lowslope2 > highcutslope))
|
||||||
continue;
|
continue;
|
||||||
if ((high1 > high2 || highslope1 > highslope2) || (low1 < low2 || lowslope1 < lowslope2))
|
if ((high1 > high2 || highslope1 > highslope2) || (low1 < low2 || lowslope1 < lowslope2))
|
||||||
|
|
Loading…
Reference in a new issue