From 9bbb551cc63da548ff1236859593fd8864394160 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 5 Nov 2026 15:31:25 +0100 Subject: [PATCH] "fix" skywalls on hadal trench and candy lake this whole sky handling is just incredibly stupid and wouldve been such an easy fix, but here we go this is just more stupid hacks but i really dont feel bad here since the code already hacked around a bunch of shit just hoping this wont cause any issues on some maps and needs testing sigh --- src/hardware/hw_main.cpp | 44 ++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index bac439e24..b09bc3f2a 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -1671,7 +1671,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // two sided line if (gl_backsector) { - INT32 gl_toptexture = 0, gl_bottomtexture = 0; + const INT32 gl_toptexture = R_GetTextureNum(gl_sidedef->toptexture); + const INT32 gl_bottomtexture = R_GetTextureNum(gl_sidedef->bottomtexture); fixed_t texturevpeg; @@ -1682,7 +1683,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (!gl_curline->polyseg) // Don't do it for polyobjects { // Sky Ceilings - wallVerts[3].y = wallVerts[2].y = FLOATMAX; + wallVerts[2].y = wallVerts[3].y = FLOATMAX; // draw to top of map space auto draw_sky_walls = [] (int vert1, int vert2, fixed_t world, fixed_t worldslope, auto& wwallVerts, auto& sSurf) FUNCINLINE @@ -1693,6 +1694,9 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom //HWR_DrawSkyWallForSec(wwallVerts, &sSurf, gl_frontsector->sky, gl_backsector->sky); }; + // worldtop = front ceiling + // worldhigh = back ceiling + if (gl_frontsector->ceilingpic == skyflatnum) { if (gl_backsector->ceilingpic == skyflatnum) @@ -1711,6 +1715,17 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom worldtop = worldhigh; worldtopslope = worldhighslope; } + else if (!gl_toptexture && + (worldhigh <= worldtop && worldhighslope <= worldtopslope) && // Assuming ESLOPE is always on with my changes + (worldhigh != worldtop || worldhighslope != worldtopslope)) + { + // Only the frontsector is sky. + // If there's no upper texture, extend the sky wall + // down to the lower of the two ceilings. + fixed_t top = std::min(worldtop, worldhigh); + fixed_t topslope = std::min(worldtopslope, worldhighslope); + draw_sky_walls(0, 1, top, topslope, wallVerts, Surf); + } else { // Only the frontsector is sky, just draw a skywall from the front ceiling @@ -1723,8 +1738,11 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom draw_sky_walls(0, 1, worldtop, worldtopslope, wallVerts, Surf); } + // worldbottom = front floor + // worldlow = back floor + // Sky Floors - wallVerts[0].y = wallVerts[1].y = FLOATMIN; + wallVerts[0].y = wallVerts[1].y = FLOATMIN; // draw to bottom of map space if (gl_frontsector->floorpic == skyflatnum) { @@ -1736,7 +1754,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if ((worldlow >= worldbottom && worldlowslope >= worldbottomslope) && (worldlow != worldbottom || worldlowslope != worldbottomslope) // Removing the second line above will render more rarely visible skywalls. Example: Cave garden ceiling in Dark race - && !(gl_sidedef->bottomtexture)) + && !(gl_bottomtexture)) { draw_sky_walls(3, 2, worldlow, worldlowslope, wallVerts, Surf); } @@ -1747,15 +1765,25 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom draw_sky_walls(3, 2, worldbottom, worldbottomslope, wallVerts, Surf); } } - else if ((gl_backsector->floorpic == skyflatnum) && !(gl_sidedef->bottomtexture)) + else if ((gl_backsector->floorpic == skyflatnum) && !(gl_bottomtexture)) { // Only the backsector has sky, just draw a skywall from the back floor if there's no bottomtexture draw_sky_walls(3, 2, worldlow, worldlowslope, wallVerts, Surf); } + else if (gl_frontsector->ceilingpic == skyflatnum && + gl_backsector->ceilingpic == skyflatnum && + (worldlow >= worldbottom && worldlowslope >= worldbottomslope) + && (worldlow != worldbottom || worldlowslope != worldbottomslope) + // Removing the second line above will render more rarely visible skywalls. Example: Cave garden ceiling in Dark race + && !(gl_bottomtexture)) + { + // Both ceilings are sky, but neither floor is sky. + // If there's a lower wall gap without a bottom texture, + // draw a skywall from the backsector's higher floor. + draw_sky_walls(3, 2, worldlow, worldlowslope, wallVerts, Surf); + } } - gl_toptexture = R_GetTextureNum(gl_sidedef->toptexture); - // check TOP TEXTURE if (gl_toptexture && (worldhighslope < worldtopslope || worldhigh < worldtop)) { @@ -1819,8 +1847,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom HWR_ProjectWall(wallVerts, &Surf, PF_Masked, lightnum, colormap); } - gl_bottomtexture = R_GetTextureNum(gl_sidedef->bottomtexture); - // check BOTTOM TEXTURE if (gl_bottomtexture && (worldlowslope > worldbottomslope || worldlow > worldbottom)) {