- made 'supportRemap0' an image property so that later the handling for this can be taken out of the actual texture class by just providing a replacement texture for the skies.

This commit is contained in:
Christoph Oelckers 2020-04-14 00:43:27 +02:00
parent 9593cb56ae
commit 5d8adb90c4
4 changed files with 24 additions and 5 deletions

View file

@ -67,6 +67,27 @@ FMultiPatchTexture::FMultiPatchTexture(int w, int h, const TArray<TexPart> &part
}
}
//==========================================================================
//
// sky remapping will only happen if
// - the texture was defined through a TEXTUREx lump (this implies only trivial copies)
// - all patches use the base palette.
// - all patches are in a format that allows the remap.
// All other cases would not be able to properly deal with this special case.
// For textual definitions this hack isn't necessary.
//
//==========================================================================
bool FMultiPatchTexture::SupportRemap0()
{
if (bTextual || UseGamePalette()) return false;
for (int i = 0; i < NumParts; i++)
{
if (!Parts[i].Image->SupportRemap0()) return false;
}
return true;
}
//==========================================================================
//
// GetBlendMap
@ -203,11 +224,6 @@ TArray<uint8_t> FMultiPatchTexture::CreatePalettedPixels(int conversion)
}
if (conversion == noremap0)
{
// sky remapping will only happen if
// - the texture was defined through a TEXTUREx lump (this implies only trivial copies)
// - all patches use the base palette.
// All other cases would not be able to properly deal with this special case.
// For textual definitions this hack isn't necessary.
if (bTextual || !UseGamePalette()) conversion = normal;
}

View file

@ -40,6 +40,7 @@ class FMultiPatchTexture : public FImageSource
friend class FTexture;
public:
FMultiPatchTexture(int w, int h, const TArray<TexPart> &parts, bool complex, bool textual);
bool SupportRemap0() override;
protected:
int NumParts;

View file

@ -63,6 +63,7 @@ public:
FPatchTexture (int lumpnum, int w, int h, int lo, int to, bool isalphatex);
TArray<uint8_t> CreatePalettedPixels(int conversion) override;
int CopyPixels(FBitmap *bmp, int conversion) override;
bool SupportRemap0() override { return !badflag; }
void DetectBadPatches();
};

View file

@ -57,6 +57,7 @@ protected:
public:
virtual bool SupportRemap0() { return false; } // Unfortunate hackery that's needed for Hexen's skies.
void CopySize(FImageSource &other)
{