diff --git a/source/build/src/palette.cpp b/source/build/src/palette.cpp index e0ea263ca..442ccbca0 100644 --- a/source/build/src/palette.cpp +++ b/source/build/src/palette.cpp @@ -270,7 +270,7 @@ void palettePostLoadLookups(void) } } } -#ifdef SWAP_255 +#if 1 //def SWAP_255 // Swap colors 0 and 255 in all tables so that all paletted images have their transparent color at index 0. // This means: // - Swap palette and remap entries in all stored remap tables diff --git a/source/common/textures/hw_texcontainer.h b/source/common/textures/hw_texcontainer.h index 7b6589407..247279fb0 100644 --- a/source/common/textures/hw_texcontainer.h +++ b/source/common/textures/hw_texcontainer.h @@ -45,10 +45,8 @@ private: TranslatedTexture * GetTexID(int translation, bool expanded) { -#if 0 auto remap = GPalette.TranslationToTable(translation); translation = remap == nullptr ? 0 : remap->Index; -#endif if (translation == 0) { diff --git a/source/common/textures/texture.cpp b/source/common/textures/texture.cpp index 26494fdb1..37dd68da7 100644 --- a/source/common/textures/texture.cpp +++ b/source/common/textures/texture.cpp @@ -865,58 +865,3 @@ FWrapperTexture::FWrapperTexture(int w, int h, int bits) SystemTextures.AddHardwareTexture(0, false, hwtex); } -//=========================================================================== -// -// Initializes the buffer for the texture data -// -//=========================================================================== - -FTextureBuffer FTexture::CreateTexBuffer(const PalEntry* remap, int flags) -{ - FTextureBuffer result; - - unsigned char* buffer = nullptr; - int W, H; - int isTransparent = -1; - bool checkonly = !!(flags & CTF_CheckOnly); - - W = GetTexelWidth(); - H = GetTexelHeight(); - - if (!checkonly) - { - buffer = new unsigned char[W * (H + 1) * 4]; - memset(buffer, 0, W * (H + 1) * 4); - - FBitmap bmp(buffer, W * 4, W, H); - - int trans = -1; - auto Pixels = GetBgraBitmap(remap, &trans); - bmp.Blit(0, 0, Pixels); - - if (remap == nullptr) - { - CheckTrans(buffer, W * H, trans); - isTransparent = bTranslucent; - } - else - { - isTransparent = 0; - // A translated image is not conclusive for setting the texture's transparency info. - } - } - - result.mBuffer = buffer; - result.mWidth = W; - result.mHeight = H; - - // Only do postprocessing for image-backed textures. (i.e. not for the burn texture which can also pass through here.) - if (flags & CTF_ProcessData) - { - if (!checkonly) ProcessData(result.mBuffer, result.mWidth, result.mHeight, false); - } - - return result; -} - - diff --git a/source/common/textures/textures.h b/source/common/textures/textures.h index a4cb09e82..0c1747d65 100644 --- a/source/common/textures/textures.h +++ b/source/common/textures/textures.h @@ -436,7 +436,6 @@ protected: public: FTextureBuffer CreateTexBuffer(int translation, int flags = 0); - FTextureBuffer CreateTexBuffer(const PalEntry* translation, int flags = 0); virtual bool DetermineTranslucency(); bool GetTranslucency() diff --git a/source/core/textures/buildtiles.cpp b/source/core/textures/buildtiles.cpp index df7682552..abe642586 100644 --- a/source/core/textures/buildtiles.cpp +++ b/source/core/textures/buildtiles.cpp @@ -113,7 +113,7 @@ static FTexture* GetTileTexture(const char* name, const TArray& backing auto tex = new FArtTile(backingstore, offset, width, height); auto p = &backingstore[offset]; auto siz = width * height; -#ifdef SWAP_255 +#if 1 //def SWAP_255 for (int i = 0; i < siz; i++, p++) { // move transparent color to index 0 to get in line with the rest of the texture management. @@ -509,7 +509,7 @@ int32_t tileGetCRC32(int tileNum) auto size = tile->GetWidth() * tile->GetHeight(); if (size == 0) return 0; -#ifdef SWAP_255 +#if 1 //def SWAP_255 // Temporarily revert the data to its original form with 255 being transparent. Otherwise the CRC won't match. auto p = pixels; for (int i = 0; i < size; i++, p++) @@ -522,7 +522,7 @@ int32_t tileGetCRC32(int tileNum) auto crc = crc32(0, (const Bytef*)pixels, size); -#if 0 +#if 1 //def SWAP_255 // ... and back again. p = pixels; for (int i = 0; i < size; i++, p++) diff --git a/source/glbackend/gl_texture.cpp b/source/glbackend/gl_texture.cpp index e16d1c4fd..57195df1c 100644 --- a/source/glbackend/gl_texture.cpp +++ b/source/glbackend/gl_texture.cpp @@ -90,9 +90,7 @@ FHardwareTexture* GLInstance::CreateIndexedTexture(FTexture* tex) FHardwareTexture* GLInstance::CreateTrueColorTexture(FTexture* tex, int palid, bool checkfulltransparency, bool rgb8bit) { - auto palette = palid < 0? nullptr : palmanager.GetPaletteData(palid); - if (palid >= 0 && palette == nullptr) return nullptr; - auto texbuffer = tex->CreateTexBuffer(palette, checkfulltransparency? 0: CTF_ProcessData); + auto texbuffer = tex->CreateTexBuffer(palid, checkfulltransparency? 0: CTF_ProcessData); // Check if the texture is fully transparent. When creating a brightmap such textures can be discarded. if (checkfulltransparency) {