From 3095106b0eef08a78c03702b4e9706b9ab17a63f Mon Sep 17 00:00:00 2001 From: Broxzier Date: Tue, 21 Feb 2017 15:11:54 +0100 Subject: [PATCH] Use average pixel value instead of only the red channel --- src/openrct2/world/mapgen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/openrct2/world/mapgen.c b/src/openrct2/world/mapgen.c index 3fb8a8682e..be63b132a1 100644 --- a/src/openrct2/world/mapgen.c +++ b/src/openrct2/world/mapgen.c @@ -800,7 +800,10 @@ void mapgen_smooth_heightmap(SDL_Surface *surface, sint32 strength) // This assumes the height map is not tiled, and increases the weight of the edges const sint32 readX = clamp(x + offsetX, 0, width - 1); const sint32 readY = clamp(y + offsetY, 0, height - 1); - heightSum += src[readX * numChannels + readY * pitch]; + const uint8 red = src[readX * numChannels + readY * pitch]; + const uint8 green = src[readX * numChannels + readY * pitch + 1]; + const uint8 blue = src[readX * numChannels + readY * pitch + 2]; + heightSum += (red + green + blue) / 3; } }