- fixed the substitution logic in FTexture::GetRawTexture.

This may only perform a substitution if the offset is not 0 and if the size matches.
This commit is contained in:
Christoph Oelckers 2019-03-23 12:48:57 +01:00
parent 6ba8067499
commit 7606b22d0b

View file

@ -226,7 +226,7 @@ FTexture *FTexture::GetRawTexture()
if (OffsetLess) return OffsetLess;
// Reject anything that cannot have been a single-patch multipatch texture in vanilla.
auto image = static_cast<FMultiPatchTexture *>(GetImage());
if (bMultiPatch != 1 || UseType != ETextureType::Wall || Scale.X != 1 || Scale.Y != 1 || bWorldPanning || image == nullptr || image->NumParts != 1)
if (bMultiPatch != 1 || UseType != ETextureType::Wall || Scale.X != 1 || Scale.Y != 1 || bWorldPanning || image == nullptr || image->NumParts != 1 || _TopOffset[0] == 0)
{
OffsetLess = this;
return this;
@ -234,6 +234,15 @@ FTexture *FTexture::GetRawTexture()
// Set up a new texture that directly references the underlying patch.
// From here we cannot retrieve the original texture made for it, so just create a new one.
FImageSource *source = image->Parts[0].Image;
// Size must match for this to work as intended
if (source->GetWidth() != Width || source->GetHeight() != Height)
{
OffsetLess = this;
return this;
}
OffsetLess = new FImageTexture(source, "");
TexMan.AddTexture(OffsetLess);
return OffsetLess;