diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index fb9655544..448d35b2c 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -541,7 +541,6 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool if (!xsub->planepoly) return; - pv = xsub->planepoly->pts; nrPlaneVerts = xsub->planepoly->numpts; if (nrPlaneVerts < 3) //not even a triangle ? @@ -611,6 +610,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool break; } + pv = xsub->planepoly->pts; + // reference point for flat texture coord for each vertex around the polygon flatxref = (float)(((fixed_t)pv->x & (~flatflag)) / fflatsize); flatyref = (float)(((fixed_t)pv->y & (~flatflag)) / fflatsize); @@ -1054,20 +1055,12 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, endbheight = endrealbot; } - if (endbheight > endtop) - endbot = endtop; - - if (bheight >= top) + if (endbheight >= endtop && bheight >= top) continue; // Found a break - // The heights are clamped to ensure the polygon doesn't cross itself. - bot = bheight; - - if (bot < realbot) - bot = realbot; - - endbot = min(max(endbheight, endrealbot), endtop); + bot = max(bheight, realbot); + endbot = max(endbheight, endrealbot); Surf->PolyColor.s.alpha = alpha; @@ -1196,7 +1189,7 @@ static void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf) } // Returns true if the midtexture is visible, and false if... it isn't... -static boolean HWR_BlendMidtextureSurface(FSurfaceInfo *pSurf) +static inline boolean HWR_BlendMidtextureSurface(FSurfaceInfo *pSurf) { FUINT blendmode = PF_Masked; @@ -1234,23 +1227,16 @@ static boolean HWR_BlendMidtextureSurface(FSurfaceInfo *pSurf) case 908: blendmode = HWR_TranstableToAlpha(tr_trans90, pSurf); break; - // Translucent + // Translucent linedef types case 102: - case 121: - case 123: - case 124: - case 125: - case 141: - case 142: - case 144: - case 145: + case 121 ... 125: + case 141 ... 145: case 174: case 175: case 192: case 195: case 221: - case 253: - case 256: + case 253 ... 256: blendmode = PF_Translucent; break; default: @@ -1262,9 +1248,10 @@ static boolean HWR_BlendMidtextureSurface(FSurfaceInfo *pSurf) { // Polyobject translucency is shared between all of its lines if (gl_curline->polyseg->translucency >= NUMTRANSMAPS) // wall not drawn + { + pSurf->PolyColor.s.alpha = 0x00; // This shouldn't draw anything regardless of blendmode return false; - //Surf.PolyColor.s.alpha = 0x00; // This shouldn't draw anything regardless of blendmode - //blendmode = PF_Masked; + } else blendmode = HWR_TranstableToAlpha(gl_curline->polyseg->translucency, pSurf); } @@ -1361,7 +1348,9 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom lightnum = (HWR_ShouldUsePaletteRendering() && colormap) ? lightnum : HWR_CalcWallLight(lightnum, gl_curline); FSurfaceInfo Surf; - Surf.PolyColor.s.alpha = 255; + + if (gl_frontsector) + Surf.PolyColor.s.alpha = 255; INT32 gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture); GLMapTexture_t *glTex = NULL; @@ -1757,6 +1746,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // Single sided line... Deal only with the middletexture (if one exists) if (gl_midtexture && gl_linedef->special != HORIZONSPECIAL) // Ignore horizon line for OGL { + glTex = HWR_GetTexture(gl_midtexture, noencore); + fixed_t texturevpeg; // PEGGING @@ -1767,8 +1758,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom else texturevpeg = gl_sidedef->rowoffset; // top of texture at top - glTex = HWR_GetTexture(gl_midtexture, noencore); - wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY; wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_frontsector->floorheight) * glTex->scaleY; wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;