From 5ff0c09868c3c4a62d4396bc013a1fdf12dec5b1 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 23 Oct 2024 21:28:08 +0200 Subject: [PATCH] just check for noencore bool in hwr_processseg instead of checked line flags everytime --- src/hardware/hw_main.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 088b34d2c..9acc0342a 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1425,11 +1425,11 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom fixed_t h, l; // 3D sides and 2s middle textures fixed_t hS, lS; - boolean noencore = false; - gr_sidedef = gr_curline->sidedef; gr_linedef = gr_curline->linedef; + const boolean noencore = (gr_linedef->flags & ML_TFERLINE); + if (gr_curline->pv1) { vs.x = ((polyvertex_t *)gr_curline->pv1)->x; @@ -1490,9 +1490,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom FSurfaceInfo Surf; Surf.PolyColor.s.alpha = 255; - if (gr_linedef->flags & ML_TFERLINE) - noencore = true; - INT32 gr_midtexture = R_GetTextureNum(gr_sidedef->midtexture); GLMapTexture_t *grTex = NULL; @@ -1608,7 +1605,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway texturevpeg %= textureheight[gr_toptexture]; - grTex = HWR_GetTexture(gr_toptexture, gr_linedef->flags & ML_TFERLINE); + grTex = HWR_GetTexture(gr_toptexture, noencore); wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY; wallVerts[0].t = wallVerts[1].t = (texturevpeg + gr_frontsector->ceilingheight - gr_backsector->ceilingheight) * grTex->scaleY; @@ -1645,9 +1642,9 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[1].y = FIXED_TO_FLOAT(worldhighslope); if (!gl_drawing_stencil && gr_frontsector->numlights) - HWR_SplitWall(gr_frontsector, wallVerts, gr_toptexture, gr_linedef->flags & ML_TFERLINE, &Surf, FF_CUTLEVEL, NULL, 0); + HWR_SplitWall(gr_frontsector, wallVerts, gr_toptexture, noencore, &Surf, FF_CUTLEVEL, NULL, 0); else if (!gl_drawing_stencil && grTex->mipmap.flags & TF_TRANSPARENT) - HWR_AddTransparentWall(wallVerts, &Surf, gr_toptexture, gr_linedef->flags & ML_TFERLINE, PF_Environment, false, lightnum, colormap); + HWR_AddTransparentWall(wallVerts, &Surf, gr_toptexture, noencore, PF_Environment, false, lightnum, colormap); else HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap); } @@ -1668,7 +1665,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway texturevpeg %= textureheight[gr_bottomtexture]; - grTex = HWR_GetTexture(gr_bottomtexture, gr_linedef->flags & ML_TFERLINE); + grTex = HWR_GetTexture(gr_bottomtexture, noencore); wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY; wallVerts[0].t = wallVerts[1].t = (texturevpeg + gr_backsector->floorheight - gr_frontsector->floorheight) * grTex->scaleY; @@ -1704,9 +1701,9 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope); if (!gl_drawing_stencil && gr_frontsector->numlights) - HWR_SplitWall(gr_frontsector, wallVerts, gr_bottomtexture, gr_linedef->flags & ML_TFERLINE, &Surf, FF_CUTLEVEL, NULL, 0); + HWR_SplitWall(gr_frontsector, wallVerts, gr_bottomtexture, noencore, &Surf, FF_CUTLEVEL, NULL, 0); else if (!gl_drawing_stencil && grTex->mipmap.flags & TF_TRANSPARENT) - HWR_AddTransparentWall(wallVerts, &Surf, gr_bottomtexture, gr_linedef->flags & ML_TFERLINE, PF_Environment, false, lightnum, colormap); + HWR_AddTransparentWall(wallVerts, &Surf, gr_bottomtexture, noencore, PF_Environment, false, lightnum, colormap); else HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap); } @@ -1847,7 +1844,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom texturevpegslope = polytopslope - hS; } - grTex = HWR_GetTexture(gr_midtexture, gr_linedef->flags & ML_TFERLINE); + grTex = HWR_GetTexture(gr_midtexture, noencore); // Left side wallVerts[3].t = texturevpeg * grTex->scaleY; @@ -1875,9 +1872,9 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom blendmode |= PF_Decal; if (!gl_drawing_stencil && gr_frontsector->numlights) - HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, gr_linedef->flags & ML_TFERLINE, &Surf, (!(blendmode & PF_Masked)) ? FF_TRANSLUCENT : FF_CUTLEVEL, NULL, PF_Decal); + HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, noencore, &Surf, (!(blendmode & PF_Masked)) ? FF_TRANSLUCENT : FF_CUTLEVEL, NULL, PF_Decal); else if (!gl_drawing_stencil && !(blendmode & PF_Masked)) - HWR_AddTransparentWall(wallVerts, &Surf, gr_midtexture, gr_linedef->flags & ML_TFERLINE, blendmode, false, lightnum, colormap); + HWR_AddTransparentWall(wallVerts, &Surf, gr_midtexture, noencore, blendmode, false, lightnum, colormap); else HWR_ProjectWall(wallVerts, &Surf, blendmode, lightnum, colormap); } @@ -1897,7 +1894,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom else texturevpeg = gr_sidedef->rowoffset; // top of texture at top - grTex = HWR_GetTexture(gr_midtexture, gr_linedef->flags & ML_TFERLINE); + grTex = HWR_GetTexture(gr_midtexture, noencore); wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY; wallVerts[0].t = wallVerts[1].t = (texturevpeg + gr_frontsector->ceilingheight - gr_frontsector->floorheight) * grTex->scaleY; @@ -1930,11 +1927,11 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom wallVerts[1].y = FIXED_TO_FLOAT(worldbottomslope); if (gr_frontsector->numlights) - HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, gr_linedef->flags & ML_TFERLINE, &Surf, FF_CUTLEVEL, NULL, 0); + HWR_SplitWall(gr_frontsector, wallVerts, gr_midtexture, noencore, &Surf, FF_CUTLEVEL, NULL, 0); else // I don't think that solid walls can use translucent linedef types... { if (grTex->mipmap.flags & TF_TRANSPARENT) - HWR_AddTransparentWall(wallVerts, &Surf, gr_midtexture, gr_linedef->flags & ML_TFERLINE, PF_Environment, false, lightnum, colormap); + HWR_AddTransparentWall(wallVerts, &Surf, gr_midtexture, noencore, PF_Environment, false, lightnum, colormap); else HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap); } @@ -2130,7 +2127,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom else { if (blendmode != PF_Masked) - HWR_AddTransparentWall(wallVerts, &Surf, texnum, gr_linedef->flags & ML_TFERLINE, blendmode, false, lightnum, colormap); + HWR_AddTransparentWall(wallVerts, &Surf, texnum, noencore, blendmode, false, lightnum, colormap); else HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap); }