- hooked up the high color texture colorization code.

Not tested and probably still not working correctly, the entire feature was a nearly impenetrable mess of convoluted code. This definitely needs verification with multiple mods using it.
This commit is contained in:
Christoph Oelckers 2020-01-11 22:18:06 +01:00
parent 17eddda36c
commit 55dab6d3d3
15 changed files with 131 additions and 128 deletions

View file

@ -164,24 +164,37 @@ bool GLInstance::SetTextureInternal(int picnum, FTexture* tex, int palette, int
int lookuppal = 0;
VSMatrix texmat;
auto rep = hw_hightile? tex->FindReplacement(palette) : nullptr;
auto& h = hictinting[palette];
bool applytint = false;
auto rep = (hw_hightile && !(h.f & HICTINT_ALWAYSUSEART)) ? tex->FindReplacement(palette) : nullptr;
if (rep)
{
// Hightile replacements have only one texture representation and it is always the base.
tex = rep->faces[0];
TextureType = TT_HICREPLACE;
if (rep->palnum != palette || (h.f & HICTINT_APPLYOVERALTPAL)) applytint = true;
}
else
{
// Only look up the palette if we really want to use it (i.e. when creating a true color texture of an ART tile.)
if (TextureType == TT_TRUECOLOR)
{
/*lookuppal = palmanager.LookupPalette(usepalette, usepalswap, true);
if (lookuppal< 0)*/ lookuppal = palmanager.LookupPalette(usepalette, usepalswap, false, g_nontransparent255);
// Tinting is not used on indexed textures
if (h.f & (HICTINT_ALWAYSUSEART | HICTINT_USEONART))
{
applytint = true;
if (!(h.f & HICTINT_APPLYOVERPALSWAP)) usepalswap = 0;
}
lookuppal = palmanager.LookupPalette(usepalette, usepalswap, false, g_nontransparent255);
}
}
// This is intentionally the same value for both parameters. The shader does not use the same uniform for modulation and overlay colors.
if (applytint) GLInterface.SetTinting(h.f, h.tint, h.tint);
else GLInterface.SetTinting(-1, 0xffffff, 0xffffff);
// Load the main texture
auto mtex = LoadTexture(tex, TextureType, lookuppal);
if (mtex)