From 6fcf1e0149c2fef082a8d9636c169cc6774e83e8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 22 Mar 2018 22:49:42 +0100 Subject: [PATCH] - fixed incorrect translation table that was used to process grayscale patch and IMGZ textures. - fixed: The MD5 check for patches deleted the buffer too early. --- src/textures/imgztexture.cpp | 2 +- src/textures/patchtexture.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/textures/imgztexture.cpp b/src/textures/imgztexture.cpp index 3f3d4c674..5b5237d0d 100644 --- a/src/textures/imgztexture.cpp +++ b/src/textures/imgztexture.cpp @@ -217,6 +217,6 @@ uint8_t *FIMGZTexture::MakeTexture (FRenderStyle style) int FIMGZTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf) { if (!isalpha) return FTexture::CopyTrueColorPixels(bmp, x, y, rotate, inf); - else return CopyTrueColorTranslated(bmp, x, y, rotate, translationtables[TRANSLATION_Standard][isalpha ? STD_Gray : STD_Grayscale]->Palette, inf); + else return CopyTrueColorTranslated(bmp, x, y, rotate, translationtables[TRANSLATION_Standard][STD_Grayscale]->Palette, inf); } diff --git a/src/textures/patchtexture.cpp b/src/textures/patchtexture.cpp index 153d7c6f1..eeb900266 100644 --- a/src/textures/patchtexture.cpp +++ b/src/textures/patchtexture.cpp @@ -114,13 +114,13 @@ static bool CheckIfPatch(FileReader & file, bool &isalpha) return false; } } - delete [] data; if (!gapAtStart) { // only check this if the texture passed validation. // Here is a good point because we already have a valid buffer of the lump's data. isalpha = checkPatchForAlpha(data, (uint32_t)file.GetLength()); } + delete[] data; return !gapAtStart; } delete [] data; @@ -273,7 +273,7 @@ uint8_t *FPatchTexture::MakeTexture (FRenderStyle style) int FPatchTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf) { if (!isalpha) return FTexture::CopyTrueColorPixels(bmp, x, y, rotate, inf); - else return CopyTrueColorTranslated(bmp, x, y, rotate, translationtables[TRANSLATION_Standard][isalpha ? STD_Gray : STD_Grayscale]->Palette, inf); + else return CopyTrueColorTranslated(bmp, x, y, rotate, translationtables[TRANSLATION_Standard][STD_Grayscale]->Palette, inf); } //==========================================================================