diff --git a/src/common/textures/formats/multipatchtexture.cpp b/src/common/textures/formats/multipatchtexture.cpp index 86c9f8d77..dfd63ea38 100644 --- a/src/common/textures/formats/multipatchtexture.cpp +++ b/src/common/textures/formats/multipatchtexture.cpp @@ -67,6 +67,27 @@ FMultiPatchTexture::FMultiPatchTexture(int w, int h, const TArray &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 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; } diff --git a/src/common/textures/formats/multipatchtexture.h b/src/common/textures/formats/multipatchtexture.h index 190cd49b7..3b8c6db75 100644 --- a/src/common/textures/formats/multipatchtexture.h +++ b/src/common/textures/formats/multipatchtexture.h @@ -40,6 +40,7 @@ class FMultiPatchTexture : public FImageSource friend class FTexture; public: FMultiPatchTexture(int w, int h, const TArray &parts, bool complex, bool textual); + bool SupportRemap0() override; protected: int NumParts; diff --git a/src/common/textures/formats/patchtexture.cpp b/src/common/textures/formats/patchtexture.cpp index 960994b5c..0a93adf50 100644 --- a/src/common/textures/formats/patchtexture.cpp +++ b/src/common/textures/formats/patchtexture.cpp @@ -63,6 +63,7 @@ public: FPatchTexture (int lumpnum, int w, int h, int lo, int to, bool isalphatex); TArray CreatePalettedPixels(int conversion) override; int CopyPixels(FBitmap *bmp, int conversion) override; + bool SupportRemap0() override { return !badflag; } void DetectBadPatches(); }; diff --git a/src/common/textures/image.h b/src/common/textures/image.h index 1f6fcb5fa..a72c82eb3 100644 --- a/src/common/textures/image.h +++ b/src/common/textures/image.h @@ -57,6 +57,7 @@ protected: public: + virtual bool SupportRemap0() { return false; } // Unfortunate hackery that's needed for Hexen's skies. void CopySize(FImageSource &other) {