From 0b347f77452ec684d7d73247e221f6c368e3319e Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Thu, 29 Aug 2024 17:15:22 +0100 Subject: [PATCH] Fix bugged lightmaps --- project/code/LGS/Database/Chunks/WorldRep.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/project/code/LGS/Database/Chunks/WorldRep.cs b/project/code/LGS/Database/Chunks/WorldRep.cs index cc61d6f..ef442e4 100644 --- a/project/code/LGS/Database/Chunks/WorldRep.cs +++ b/project/code/LGS/Database/Chunks/WorldRep.cs @@ -154,10 +154,10 @@ public class WorldRep : IChunk ArgumentOutOfRangeException.ThrowIfLessThan(layer, 0, nameof(layer)); ArgumentOutOfRangeException.ThrowIfGreaterThan(layer, Layers, nameof(layer)); - var pixelCount = Width * Height; - var pIdx = layer * Bpp * pixelCount; - var bytes = new byte[pixelCount * 4]; - for (var i = 0; i < pixelCount; i += 4, pIdx += Bpp) + var pIdx = layer * Bpp * Width * Height; + var length = 4 * Width * Height; + var bytes = new byte[length]; + for (var i = 0; i < length; i += 4, pIdx += Bpp) { switch (Bpp) {