diff --git a/polymer/eduke32/build/include/hightile.h b/polymer/eduke32/build/include/hightile.h index 53370f021..b966296be 100644 --- a/polymer/eduke32/build/include/hightile.h +++ b/polymer/eduke32/build/include/hightile.h @@ -98,6 +98,7 @@ enum HICTINT_BLENDMASK = 64|128, HICTINT_PRECOMPUTED = HICTINT_COLORIZE | HICTINT_BLENDMASK, + HICTINT_IN_MEMORY = HICTINT_PRECOMPUTED | HICTINT_GRAYSCALE | HICTINT_INVERT, HICEFFECTMASK = 255, // XXX: Xcalloc() based on this value, why? }; diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 1d2ec32b2..51b621dd5 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -3883,7 +3883,7 @@ static void polymer_drawartsky(int16_t tilenum, char palnum, int8_t shad if (pth && (pth->flags & PTH_HIGHTILE)) { - if (pth->palnum != palnum || (hictinting[palnum].f & HICTINT_APPLYOVERALTPAL)) + if (pth->palnum != palnum || (pth->effects & HICTINT_IN_MEMORY) || (hictinting[palnum].f & HICTINT_APPLYOVERALTPAL)) hictinting_apply(glcolors[i], palnum); if (have_basepal_tint()) @@ -3966,7 +3966,7 @@ static void polymer_drawskybox(int16_t tilenum, char palnum, int8_t shad if (pth && (pth->flags & PTH_HIGHTILE)) { - if (pth->palnum != palnum || (hictinting[palnum].f & HICTINT_APPLYOVERALTPAL)) + if (pth->palnum != palnum || (pth->effects & HICTINT_IN_MEMORY) || (hictinting[palnum].f & HICTINT_APPLYOVERALTPAL)) hictinting_apply(color, palnum); if (have_basepal_tint()) @@ -4661,7 +4661,7 @@ static void polymer_getbuildmaterial(_prmaterial* material, int16_t tile if (pth->flags & PTH_HIGHTILE) { - if (pth->palnum != pal || (hictinting[pal].f & HICTINT_APPLYOVERALTPAL)) + if (pth->palnum != pal || (pth->effects & HICTINT_IN_MEMORY) || (hictinting[pal].f & HICTINT_APPLYOVERALTPAL)) hictinting_apply_ub(material->diffusemodulation, pal); // fullscreen tint on global palette change... this is used for nightvision and underwater tinting diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 3a8d0b7e8..590677ebc 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -1568,7 +1568,7 @@ static void drawpoly(vec2f_t const * const dpxy, int32_t const n, int32_t method { if (pth && (pth->flags & PTH_HIGHTILE)) { - if (pth->palnum != globalpal || (hictinting[globalpal].f & HICTINT_APPLYOVERALTPAL)) + if (pth->palnum != globalpal || (pth->effects & HICTINT_IN_MEMORY) || (hictinting[globalpal].f & HICTINT_APPLYOVERALTPAL)) hictinting_apply(pc, globalpal); if (have_basepal_tint()) diff --git a/polymer/eduke32/build/src/texcache.c b/polymer/eduke32/build/src/texcache.c index 18a54f2fa..69be39054 100644 --- a/polymer/eduke32/build/src/texcache.c +++ b/polymer/eduke32/build/src/texcache.c @@ -129,12 +129,13 @@ pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashade, int3 * effects are applied to the palette 0 texture if it exists */ - const int32_t checktintpal = (hictinting[si->palnum].f & HICTINT_APPLYOVERALTPAL) ? 0 : si->palnum; + const int32_t checktintpal = (hictinting[dapalnum].f & HICTINT_APPLYOVERALTPAL) ? 0 : si->palnum; + const int32_t checkcachepal = (hictinting[dapalnum].f & HICTINT_IN_MEMORY) || ((hictinting[dapalnum].f & HICTINT_APPLYOVERALTPAL) && si->palnum > 0) ? dapalnum : si->palnum; // load a replacement for (pthtyp *pth = texcache.list[j]; pth; pth = pth->next) { - if (pth->picnum == dapicnum && pth->palnum == si->palnum && + if (pth->picnum == dapicnum && pth->palnum == checkcachepal && (checktintpal > 0 ? 1 : (pth->effects == hictinting[dapalnum].f)) && (pth->flags & (PTH_CLAMPED + PTH_HIGHTILE + PTH_SKYBOX)) == (TO_PTH_CLAMPED(dameth) + PTH_HIGHTILE + (drawingskybox > 0) * PTH_SKYBOX) && @@ -171,7 +172,7 @@ pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashade, int3 if (!tilestat) { pth->next = texcache.list[j]; - pth->palnum = si->palnum; + pth->palnum = checkcachepal; texcache.list[j] = pth; return pth; }