diff --git a/src/textures/multipatchtexturebuilder.cpp b/src/textures/multipatchtexturebuilder.cpp index ac2b069172..aa727bef10 100644 --- a/src/textures/multipatchtexturebuilder.cpp +++ b/src/textures/multipatchtexturebuilder.cpp @@ -364,7 +364,7 @@ void FMultipatchTextureBuilder::AddTexturesLump(const void *lumpdata, int lumpsi // It still needs to be created in case someone uses it by name. offset = LittleLong(directory[1]); const maptexture_t *tex = (const maptexture_t *)((const uint8_t *)maptex + offset); - FDummyTexture *tex0 = static_cast(TexMan.ByIndex(0)); + FTexture *tex0 = TexMan.ByIndex(0); tex0->SetSize(SAFESHORT(tex->width), SAFESHORT(tex->height)); } diff --git a/src/textures/texture.cpp b/src/textures/texture.cpp index 4f6257f247..0b22866ef5 100644 --- a/src/textures/texture.cpp +++ b/src/textures/texture.cpp @@ -761,26 +761,6 @@ TArray FTexture::Get8BitPixels(bool alphatex) return Pixels; } -//=========================================================================== -// -// Dummy texture for the 0-entry. -// -//=========================================================================== - -FDummyTexture::FDummyTexture () -{ - Width = 64; - Height = 64; - UseType = ETextureType::Null; -} - -void FDummyTexture::SetSize (int width, int height) -{ - Width = width; - Height = height; -} - - //========================================================================== // // diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index 66c43ac62d..558a6243c6 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -1003,7 +1003,9 @@ void FTextureManager::Init() FTexture::InitGrayMap(); // Texture 0 is a dummy texture used to indicate "no texture" - AddTexture (new FDummyTexture); + auto nulltex = new FImageTexture(nullptr); + nulltex->SetUseType(ETextureType::Null); + AddTexture (nulltex); // some special textures used in the game. AddTexture(CreateShaderTexture(false, false)); AddTexture(CreateShaderTexture(false, true)); diff --git a/src/textures/textures.h b/src/textures/textures.h index 54c10aab14..56a90608bf 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -382,7 +382,15 @@ protected: float shaderspeed = 1.f; int shaderindex = 0; - + // This is only legal for the null texture! + void SetSize(int w, int h) + { + if (UseType == ETextureType::Null) + { + Width = w; + Height = h; + } + } // Returns true if GetPixelsBgra includes mipmaps virtual bool Mipmapped() { return true; } @@ -657,14 +665,6 @@ public: }; -// A texture that doesn't really exist -class FDummyTexture : public FTexture -{ -public: - FDummyTexture (); - void SetSize (int width, int height); -}; - // A texture that can be drawn to. class DCanvas;