From bd3b41cffbde30392dae32851857b02a8f844cd9 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Thu, 12 Dec 2024 21:19:17 +0100 Subject: [PATCH] Don't save dynamic lightmap textures --- src/rendering/hwrenderer/doom_levelmesh.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rendering/hwrenderer/doom_levelmesh.cpp b/src/rendering/hwrenderer/doom_levelmesh.cpp index c4f26eacd..aea9ec1ab 100644 --- a/src/rendering/hwrenderer/doom_levelmesh.cpp +++ b/src/rendering/hwrenderer/doom_levelmesh.cpp @@ -2065,7 +2065,7 @@ void DoomLevelMesh::SaveLightmapLump(FLevelLocals& doomMap) { LightmapTile* tile = &Lightmap.Tiles[i]; - if (tile->AtlasLocation.ArrayIndex == -1) + if (tile->AtlasLocation.ArrayIndex == -1 || tile->AtlasLocation.ArrayIndex >= Lightmap.TextureCount) continue; lumpFile.Write32(tile->Binding.Type); @@ -2097,7 +2097,7 @@ void DoomLevelMesh::SaveLightmapLump(FLevelLocals& doomMap) { LightmapTile* tile = &Lightmap.Tiles[i]; - if (tile->AtlasLocation.ArrayIndex == -1) + if (tile->AtlasLocation.ArrayIndex == -1 || tile->AtlasLocation.ArrayIndex >= Lightmap.TextureCount) continue; const uint16_t* pixels = Lightmap.TextureData.Data() + tile->AtlasLocation.ArrayIndex * Lightmap.TextureSize * Lightmap.TextureSize * 4;