Skip to content

Commit

Permalink
- fixed: The mutipatch texture builder did not set the source lump.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Jun 8, 2020
1 parent 58bc12e commit a330b46
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/common/textures/formats/multipatchtexture.h
Expand Up @@ -170,6 +170,6 @@ class FMultipatchTextureBuilder
}

void AddTexturesLumps(int lump1, int lump2, int patcheslump);
void ParseTexture(FScanner &sc, ETextureType usetype);
void ParseTexture(FScanner &sc, ETextureType usetype, int deflump);
void ResolveAllPatches();
};
4 changes: 3 additions & 1 deletion src/common/textures/multipatchtexturebuilder.cpp
Expand Up @@ -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)];

Expand Down Expand Up @@ -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("{"))
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions src/common/textures/texturemanager.cpp
Expand Up @@ -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"))
{
Expand Down
1 change: 1 addition & 0 deletions src/common/textures/textures.h
Expand Up @@ -253,6 +253,7 @@ class FTexture : public RefCountedBase
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)
Expand Down

0 comments on commit a330b46

Please sign in to comment.