From 56fddac19974781608e6fadd5048312fa786f2f7 Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Mon, 19 Sep 2016 19:00:26 +0100 Subject: [PATCH] Fix broken zoomed textures and palettes Zoomed textures were failing to pass the image flags to the zoomed version of the texture. This would cause corrupted data to be passed as a tertiary colour to the palette function. Also due to not recording the image flags in the palette hash map a tertiary colour of zero would be ignored and unremaped pink colour would be shown --- src/drawing/engines/opengl/OpenGLDrawingEngine.cpp | 2 +- src/drawing/engines/opengl/TextureCache.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drawing/engines/opengl/OpenGLDrawingEngine.cpp b/src/drawing/engines/opengl/OpenGLDrawingEngine.cpp index 10b6e69f34..a20ad0b956 100644 --- a/src/drawing/engines/opengl/OpenGLDrawingEngine.cpp +++ b/src/drawing/engines/opengl/OpenGLDrawingEngine.cpp @@ -662,7 +662,7 @@ void OpenGLDrawingContext::DrawSprite(uint32 image, sint32 x, sint32 y, uint32 t zoomedDPI.pitch = _dpi->pitch; zoomedDPI.zoom_level = _dpi->zoom_level - 1; SetDPI(&zoomedDPI); - DrawSprite((image << 28) | (g1Id - g1Element->zoomed_offset), x >> 1, y >> 1, tertiaryColour); + DrawSprite((image & 0xE0000000) | (g1Id - g1Element->zoomed_offset), x >> 1, y >> 1, tertiaryColour); return; } if (g1Element->flags & (1 << 5)) diff --git a/src/drawing/engines/opengl/TextureCache.cpp b/src/drawing/engines/opengl/TextureCache.cpp index 3b424fc213..3b37cabe0b 100644 --- a/src/drawing/engines/opengl/TextureCache.cpp +++ b/src/drawing/engines/opengl/TextureCache.cpp @@ -70,7 +70,7 @@ CachedTextureInfo TextureCache::GetOrLoadPaletteTexture(uint32 image, uint32 ter if ((image & (IMAGE_TYPE_REMAP | IMAGE_TYPE_REMAP_2_PLUS | IMAGE_TYPE_TRANSPARENT)) == 0) return CachedTextureInfo{ 0 }; - uint32 uniquePaletteId = 0; + uint32 uniquePaletteId = image & (IMAGE_TYPE_REMAP | IMAGE_TYPE_REMAP_2_PLUS | IMAGE_TYPE_TRANSPARENT); if (!(image & IMAGE_TYPE_REMAP_2_PLUS)) { uniquePaletteId = (image >> 19) & 0xFF; if (!(image & IMAGE_TYPE_TRANSPARENT)) {