Skip to content

Commit

Permalink
fixed: UseOffsets can only be handled after the patch is has been set…
Browse files Browse the repository at this point in the history
… up.
  • Loading branch information
IgeNiaI committed Nov 29, 2022
1 parent 571a0f9 commit f3f6fd6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/textures/multipatchtexture.cpp
Expand Up @@ -192,6 +192,7 @@ class FMultiPatchTexture : public FTexture
TexInit *Inits;
bool Silent = false;
bool HasLine = false;
bool UseOffsets = false;
FScriptPosition sc;
};

Expand Down Expand Up @@ -1136,11 +1137,7 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part, TexInit &init)
}
else if (sc.Compare("useoffsets"))
{
if (part.Texture != NULL)
{
part.OriginX -= part.Texture->LeftOffset;
part.OriginY -= part.Texture->TopOffset;
}
init.UseOffsets = true;
}
}
}
Expand Down Expand Up @@ -1339,7 +1336,7 @@ void FMultiPatchTexture::ResolvePatches()
else
{
// If it could be resolved, just print a developer warning.
DPrintf("Resolved self-referencing texture by picking an older entry for %s", Inits[i].TexName.GetChars());
DPrintf("Resolved self-referencing texture by picking an older entry for %s\n", Inits[i].TexName.GetChars());
}
}

Expand All @@ -1356,6 +1353,11 @@ void FMultiPatchTexture::ResolvePatches()
Parts[i].Texture = TexMan[texno];
bComplex |= Parts[i].Texture->bComplex;
Parts[i].Texture->bKeepAround = true;
if (Inits[i].UseOffsets)
{
Parts[i].OriginX -= Parts[i].Texture->LeftOffset;
Parts[i].OriginY -= Parts[i].Texture->TopOffset;
}
}
}
for (int i = 0; i < NumParts; i++)
Expand Down

0 comments on commit f3f6fd6

Please sign in to comment.