Remove pointless drawtextured variable and redundant fake planes checks (R_FakeFlat would already have made gr_frontsector/backsector something else if they were)

This commit is contained in:
Monster Iestyn 2017-01-12 21:43:37 +00:00
parent e87324b814
commit df534887e9
1 changed files with 19 additions and 79 deletions

View File

@ -328,9 +328,6 @@ static angle_t gr_xtoviewangle[MAXVIDWIDTH+1];
// test change fov when looking up/down but bsp projection messup :( // test change fov when looking up/down but bsp projection messup :(
//#define NOCRAPPYMLOOK //#define NOCRAPPYMLOOK
/// \note crappy
#define drawtextured true
// base values set at SetViewSize // base values set at SetViewSize
static float gr_basecentery; static float gr_basecentery;
@ -1492,44 +1489,21 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
v2x = FLOAT_TO_FIXED(ve.x); v2x = FLOAT_TO_FIXED(ve.x);
v2y = FLOAT_TO_FIXED(ve.y); v2y = FLOAT_TO_FIXED(ve.y);
#endif #endif
if (gr_frontsector->heightsec != -1)
{
#ifdef ESLOPE #ifdef ESLOPE
worldtop = worldtopslope = sectors[gr_frontsector->heightsec].ceilingheight;
worldbottom = worldbottomslope = sectors[gr_frontsector->heightsec].floorheight;
#else
worldtop = sectors[gr_frontsector->heightsec].ceilingheight;
worldbottom = sectors[gr_frontsector->heightsec].floorheight;
#endif
}
else
{
#ifdef ESLOPE
if (gr_frontsector->c_slope)
{
worldtop = P_GetZAt(gr_frontsector->c_slope, v1x, v1y);
worldtopslope = P_GetZAt(gr_frontsector->c_slope, v2x, v2y);
}
else
{
worldtop = worldtopslope = gr_frontsector->ceilingheight;
}
if (gr_frontsector->f_slope) #define SLOPEPARAMS(slope, end1, end2, normalheight) \
{ if (slope) { \
worldbottom = P_GetZAt(gr_frontsector->f_slope, v1x, v1y); end1 = P_GetZAt(slope, v1x, v1y); \
worldbottomslope = P_GetZAt(gr_frontsector->f_slope, v2x, v2y); end2 = P_GetZAt(slope, v2x, v2y); \
} } else \
else end1 = end2 = normalheight;
{
worldbottom = worldbottomslope = gr_frontsector->floorheight; SLOPEPARAMS(gr_frontsector->c_slope, worldtop, worldtopslope, gr_frontsector->ceilingheight)
} SLOPEPARAMS(gr_frontsector->f_slope, worldbottom, worldbottomslope, gr_frontsector->floorheight)
#else #else
worldtop = gr_frontsector->ceilingheight; worldtop = gr_frontsector->ceilingheight;
worldbottom = gr_frontsector->floorheight; worldbottom = gr_frontsector->floorheight;
#endif #endif
}
// remember vertices ordering // remember vertices ordering
// 3--2 // 3--2
@ -1544,7 +1518,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
wallVerts[2].z = wallVerts[1].z = ve.y; wallVerts[2].z = wallVerts[1].z = ve.y;
wallVerts[0].w = wallVerts[1].w = wallVerts[2].w = wallVerts[3].w = 1.0f; wallVerts[0].w = wallVerts[1].w = wallVerts[2].w = wallVerts[3].w = 1.0f;
if (drawtextured)
{ {
// x offset the texture // x offset the texture
fixed_t texturehpeg = gr_sidedef->textureoffset + gr_curline->offset; fixed_t texturehpeg = gr_sidedef->textureoffset + gr_curline->offset;
@ -1577,43 +1550,15 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
{ {
INT32 gr_toptexture, gr_bottomtexture; INT32 gr_toptexture, gr_bottomtexture;
// two sided line // two sided line
if (gr_backsector->heightsec != -1)
{
#ifdef ESLOPE
worldhigh = worldhighslope = sectors[gr_backsector->heightsec].ceilingheight;
worldlow = worldlowslope = sectors[gr_backsector->heightsec].floorheight;
#else
worldhigh = sectors[gr_backsector->heightsec].ceilingheight;
worldlow = sectors[gr_backsector->heightsec].floorheight;
#endif
}
else
{
#ifdef ESLOPE
if (gr_backsector->c_slope)
{
worldhigh = P_GetZAt(gr_backsector->c_slope, v1x, v1y);
worldhighslope = P_GetZAt(gr_backsector->c_slope, v2x, v2y);
}
else
{
worldhigh = worldhighslope = gr_backsector->ceilingheight;
}
if (gr_backsector->f_slope) #ifdef ESLOPE
{ SLOPEPARAMS(gr_backsector->c_slope, worldhigh, worldhighslope, gr_backsector->ceilingheight)
worldlow = P_GetZAt(gr_backsector->f_slope, v1x, v1y); SLOPEPARAMS(gr_backsector->f_slope, worldlow, worldlowslope, gr_backsector->floorheight)
worldlowslope = P_GetZAt(gr_backsector->f_slope, v2x, v2y); #undef SLOPEPARAMS
}
else
{
worldlow = worldlowslope = gr_backsector->floorheight;
}
#else #else
worldhigh = gr_backsector->ceilingheight; worldhigh = gr_backsector->ceilingheight;
worldlow = gr_backsector->floorheight; worldlow = gr_backsector->floorheight;
#endif #endif
}
// 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
@ -1637,7 +1582,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
worldhigh < worldtop worldhigh < worldtop
) && gr_toptexture) ) && gr_toptexture)
{ {
if (drawtextured)
{ {
fixed_t texturevpegtop; // top fixed_t texturevpegtop; // top
@ -1718,7 +1662,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
#endif #endif
worldlow > worldbottom) && gr_bottomtexture) //only if VISIBLE!!! worldlow > worldbottom) && gr_bottomtexture) //only if VISIBLE!!!
{ {
if (drawtextured)
{ {
fixed_t texturevpegbottom = 0; // bottom fixed_t texturevpegbottom = 0; // bottom
@ -1910,7 +1853,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
h = min(highcut, polytop); h = min(highcut, polytop);
l = max(polybottom, lowcut); l = max(polybottom, lowcut);
if (drawtextured)
{ {
// PEGGING // PEGGING
#ifdef ESLOPE #ifdef ESLOPE
@ -1966,7 +1908,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
h = min(highcut, polytop); h = min(highcut, polytop);
l = max(polybottom, lowcut); l = max(polybottom, lowcut);
if (drawtextured)
{ {
// PEGGING // PEGGING
if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3)) if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3))
@ -2158,7 +2099,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
gr_midtexture = R_GetTextureNum(gr_sidedef->midtexture); gr_midtexture = R_GetTextureNum(gr_sidedef->midtexture);
if (gr_midtexture) if (gr_midtexture)
{ {
if (drawtextured)
{ {
fixed_t texturevpeg; fixed_t texturevpeg;
// PEGGING // PEGGING
@ -2299,7 +2239,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
wallVerts[0].s = wallVerts[3].s = 0; wallVerts[0].s = wallVerts[3].s = 0;
wallVerts[2].s = wallVerts[1].s = 0; wallVerts[2].s = wallVerts[1].s = 0;
} }
else if (drawtextured) else
{ {
#ifdef ESLOPE // P.S. this is better-organized than the old version #ifdef ESLOPE // P.S. this is better-organized than the old version
fixed_t offs = sides[(newline ? newline : rover->master)->sidenum[0]].rowoffset; fixed_t offs = sides[(newline ? newline : rover->master)->sidenum[0]].rowoffset;
@ -2432,7 +2372,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
wallVerts[0].s = wallVerts[3].s = 0; wallVerts[0].s = wallVerts[3].s = 0;
wallVerts[2].s = wallVerts[1].s = 0; wallVerts[2].s = wallVerts[1].s = 0;
} }
else if (drawtextured) else
{ {
grTex = HWR_GetTexture(texnum); grTex = HWR_GetTexture(texnum);