Complete the necessary infrastructure so that more than one precomputed tint on a hightile texture will display.

git-svn-id: https://svn.eduke32.com/eduke32@5147 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-04-14 21:17:36 +00:00
parent 40d6aef7fc
commit be29f098ab
4 changed files with 9 additions and 7 deletions

View file

@ -98,6 +98,7 @@ enum
HICTINT_BLENDMASK = 64|128, HICTINT_BLENDMASK = 64|128,
HICTINT_PRECOMPUTED = HICTINT_COLORIZE | HICTINT_BLENDMASK, HICTINT_PRECOMPUTED = HICTINT_COLORIZE | HICTINT_BLENDMASK,
HICTINT_IN_MEMORY = HICTINT_PRECOMPUTED | HICTINT_GRAYSCALE | HICTINT_INVERT,
HICEFFECTMASK = 255, // XXX: Xcalloc() based on this value, why? HICEFFECTMASK = 255, // XXX: Xcalloc() based on this value, why?
}; };

View file

@ -3883,7 +3883,7 @@ static void polymer_drawartsky(int16_t tilenum, char palnum, int8_t shad
if (pth && (pth->flags & PTH_HIGHTILE)) 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); hictinting_apply(glcolors[i], palnum);
if (have_basepal_tint()) 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 && (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); hictinting_apply(color, palnum);
if (have_basepal_tint()) if (have_basepal_tint())
@ -4661,7 +4661,7 @@ static void polymer_getbuildmaterial(_prmaterial* material, int16_t tile
if (pth->flags & PTH_HIGHTILE) 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); hictinting_apply_ub(material->diffusemodulation, pal);
// fullscreen tint on global palette change... this is used for nightvision and underwater tinting // fullscreen tint on global palette change... this is used for nightvision and underwater tinting

View file

@ -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 && (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); hictinting_apply(pc, globalpal);
if (have_basepal_tint()) if (have_basepal_tint())

View file

@ -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 * 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 // load a replacement
for (pthtyp *pth = texcache.list[j]; pth; pth = pth->next) 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)) && (checktintpal > 0 ? 1 : (pth->effects == hictinting[dapalnum].f)) &&
(pth->flags & (PTH_CLAMPED + PTH_HIGHTILE + PTH_SKYBOX)) == (pth->flags & (PTH_CLAMPED + PTH_HIGHTILE + PTH_SKYBOX)) ==
(TO_PTH_CLAMPED(dameth) + PTH_HIGHTILE + (drawingskybox > 0) * 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) if (!tilestat)
{ {
pth->next = texcache.list[j]; pth->next = texcache.list[j];
pth->palnum = si->palnum; pth->palnum = checkcachepal;
texcache.list[j] = pth; texcache.list[j] = pth;
return pth; return pth;
} }