Skip to content

Commit

Permalink
- fixed the substitution logic in FTexture::GetRawTexture.
Browse files Browse the repository at this point in the history
This may only perform a substitution if the offset is not 0 and if the size matches.
  • Loading branch information
coelckers committed Mar 23, 2019
1 parent 6ba8067 commit 7606b22
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/gamedata/textures/texture.cpp
Expand Up @@ -226,14 +226,23 @@ 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;
}
// 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;
Expand Down

0 comments on commit 7606b22

Please sign in to comment.