From 6aa67c623eedbd3c139786ccf41503d773966164 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 9 Mar 2026 16:58:05 +0100 Subject: [PATCH] hw_main: make HWR_SkyWallList_Add realloc check a little safer stuff like that should always be checked per equals/greater than just equals in practice this shouldnt have caused any issues but its just better practice to check for greater --- src/hardware/hw_main.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index 1611cd1b0..b7008a0a7 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -1178,7 +1178,6 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, static FOutVector* skyWallVertexArray = NULL; static int skyWallVertexArraySize = 0; -static int skyWallVertexArrayAllocSize = 65536;// what a mouthful static boolean gl_collect_skywalls = false; @@ -1189,13 +1188,14 @@ static void HWR_SkyWallList_Clear(void) static void HWR_SkyWallList_Add(FOutVector *wallVerts) { + static int skyWallVertexArrayAllocSize = 65536; // what a mouthful + if (!skyWallVertexArray) { // array has not been allocated yet. allocate it now skyWallVertexArray = static_cast(Z_Malloc(sizeof(FOutVector) * 4 * skyWallVertexArrayAllocSize, PU_STATIC, NULL)); } - - if (skyWallVertexArraySize == skyWallVertexArrayAllocSize) + else if (skyWallVertexArraySize >= skyWallVertexArrayAllocSize) { // allocated array got full, allocate more space skyWallVertexArrayAllocSize *= 2; @@ -1242,6 +1242,7 @@ static void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf) HWR_SetCurrentTexture(NULL); HWR_ProjectWall(wallVerts, Surf, PF_Invisible|PF_NoTexture|PF_Skydecal, 255, NULL); } + // PF_Invisible so it's not drawn into the colour buffer // PF_NoTexture for no texture // PF_Occlude is set in HWR_ProjectWall to draw into the depth buffer @@ -1869,6 +1870,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom HWR_DrawSkyWall(wallVerts, &Surf); } + if (gl_frontsector->floorpic == skyflatnum) { wallVerts[3].y = FixedToFloat(worldbottom); @@ -2134,6 +2136,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom break; } + if (r2) continue;