- 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.
This commit is contained in:
Christoph Oelckers 2018-03-22 22:49:42 +01:00
parent c869df9bf7
commit 6fcf1e0149
2 changed files with 3 additions and 3 deletions

View file

@ -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);
}

View file

@ -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);
}
//==========================================================================