From a330b46d1a294eacb6676ad6d76f3ab755690977 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 8 Jun 2020 23:00:06 +0200 Subject: [PATCH] - fixed: The mutipatch texture builder did not set the source lump. --- src/common/textures/formats/multipatchtexture.h | 2 +- src/common/textures/multipatchtexturebuilder.cpp | 4 +++- src/common/textures/texturemanager.cpp | 10 +++++----- src/common/textures/textures.h | 1 + 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/common/textures/formats/multipatchtexture.h b/src/common/textures/formats/multipatchtexture.h index 5c75fa474..d8f271333 100644 --- a/src/common/textures/formats/multipatchtexture.h +++ b/src/common/textures/formats/multipatchtexture.h @@ -170,6 +170,6 @@ public: } void AddTexturesLumps(int lump1, int lump2, int patcheslump); - void ParseTexture(FScanner &sc, ETextureType usetype); + void ParseTexture(FScanner &sc, ETextureType usetype, int deflump); void ResolveAllPatches(); }; diff --git a/src/common/textures/multipatchtexturebuilder.cpp b/src/common/textures/multipatchtexturebuilder.cpp index 89d4adaf3..d306c3bb2 100644 --- a/src/common/textures/multipatchtexturebuilder.cpp +++ b/src/common/textures/multipatchtexturebuilder.cpp @@ -606,7 +606,7 @@ void FMultipatchTextureBuilder::ParsePatch(FScanner &sc, BuildInfo &info, TexPar // //========================================================================== -void FMultipatchTextureBuilder::ParseTexture(FScanner &sc, ETextureType UseType) +void FMultipatchTextureBuilder::ParseTexture(FScanner &sc, ETextureType UseType, int deflump) { BuildInfo &buildinfo = BuiltTextures[BuiltTextures.Reserve(1)]; @@ -637,6 +637,7 @@ void FMultipatchTextureBuilder::ParseTexture(FScanner &sc, ETextureType UseType) sc.MustGetStringName(","); sc.MustGetNumber(); buildinfo.Height = sc.Number; + buildinfo.DefinitionLump = deflump; bool offset2set = false; if (sc.CheckString("{")) @@ -911,6 +912,7 @@ void FMultipatchTextureBuilder::ResolveAllPatches() { auto img = new FMultiPatchTexture(buildinfo.Width, buildinfo.Height, buildinfo.Parts, buildinfo.bComplex, buildinfo.textual); auto itex = new FImageTexture(img); + itex->SetSourceLump(buildinfo.DefinitionLump); AddImageToTexture(itex, buildinfo); } BuiltTextures.Delete(i); diff --git a/src/common/textures/texturemanager.cpp b/src/common/textures/texturemanager.cpp index f0163ab33..848f18bc2 100644 --- a/src/common/textures/texturemanager.cpp +++ b/src/common/textures/texturemanager.cpp @@ -782,23 +782,23 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build } else if (sc.Compare("texture")) { - build.ParseTexture(sc, ETextureType::Override); + build.ParseTexture(sc, ETextureType::Override, lump); } else if (sc.Compare("sprite")) { - build.ParseTexture(sc, ETextureType::Sprite); + build.ParseTexture(sc, ETextureType::Sprite, lump); } else if (sc.Compare("walltexture")) { - build.ParseTexture(sc, ETextureType::Wall); + build.ParseTexture(sc, ETextureType::Wall, lump); } else if (sc.Compare("flat")) { - build.ParseTexture(sc, ETextureType::Flat); + build.ParseTexture(sc, ETextureType::Flat, lump); } else if (sc.Compare("graphic")) { - build.ParseTexture(sc, ETextureType::MiscPatch); + build.ParseTexture(sc, ETextureType::MiscPatch, lump); } else if (sc.Compare("#include")) { diff --git a/src/common/textures/textures.h b/src/common/textures/textures.h index 9fc99bda9..f8fd763cf 100644 --- a/src/common/textures/textures.h +++ b/src/common/textures/textures.h @@ -253,6 +253,7 @@ public: bool isCanvas() const { return bHasCanvas; } int GetSourceLump() { return SourceLump; } // needed by the scripted GetName method. + void SetSourceLump(int sl) { SourceLump = sl; } bool FindHoles(const unsigned char * buffer, int w, int h); void CopySize(FTexture* BaseTexture)