mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Make all the hictinting_apply blocks consistent. This should fix certain tints types being applied incorrectly in Polymer and the global tints (underwater and nightvision) not being applied to tints and models with certain flags.
git-svn-id: https://svn.eduke32.com/eduke32@5149 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
3a26e5b241
commit
bb4cdeb692
3 changed files with 60 additions and 40 deletions
|
@ -2119,19 +2119,19 @@ static int32_t polymost_md3draw(md3model_t *m, const tspritetype *tspr)
|
|||
|
||||
bglEnable(GL_TEXTURE_2D);
|
||||
|
||||
// tinting
|
||||
pc[0] = pc[1] = pc[2] = ((float)(numshades-min(max((globalshade * shadescale)+m->shadeoff,0),numshades)))/((float)numshades);
|
||||
if (!(hictinting[globalpal].f & HICTINT_PRECOMPUTED))
|
||||
{
|
||||
if (!(m->flags&1))
|
||||
{
|
||||
hictinting_apply(pc, globalpal);
|
||||
|
||||
if (have_basepal_tint())
|
||||
hictinting_apply(pc, MAXPALOOKUPS-1);
|
||||
}
|
||||
else globalnoeffect=1;
|
||||
}
|
||||
|
||||
// global tinting
|
||||
if (have_basepal_tint())
|
||||
hictinting_apply(pc, MAXPALOOKUPS-1);
|
||||
|
||||
if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66f; else pc[3] = 0.33f; }
|
||||
else pc[3] = 1.0f;
|
||||
pc[3] *= 1.0f - sext->alpha;
|
||||
|
|
|
@ -3881,16 +3881,24 @@ static void polymer_drawartsky(int16_t tilenum, char palnum, int8_t shad
|
|||
|
||||
glcolors[i][0] = glcolors[i][1] = glcolors[i][2] = getshadefactor(shade);
|
||||
|
||||
if (pth && (pth->flags & PTH_HIGHTILE))
|
||||
if (pth)
|
||||
{
|
||||
if (pth->palnum != palnum || (pth->effects & HICTINT_IN_MEMORY) || (hictinting[palnum].f & HICTINT_APPLYOVERALTPAL))
|
||||
hictinting_apply(glcolors[i], palnum);
|
||||
// tinting
|
||||
if (!(hictinting[palnum].f & HICTINT_PRECOMPUTED))
|
||||
{
|
||||
if (pth->flags & PTH_HIGHTILE)
|
||||
{
|
||||
if (pth->palnum != palnum || (pth->effects & HICTINT_IN_MEMORY) || (hictinting[palnum].f & HICTINT_APPLYOVERALTPAL))
|
||||
hictinting_apply(glcolors[i], palnum);
|
||||
}
|
||||
else if (hictinting[palnum].f & HICTINT_USEONART)
|
||||
hictinting_apply(glcolors[i], palnum);
|
||||
}
|
||||
|
||||
if (have_basepal_tint())
|
||||
// global tinting
|
||||
if ((pth->flags & PTH_HIGHTILE) && have_basepal_tint())
|
||||
hictinting_apply(glcolors[i], MAXPALOOKUPS-1);
|
||||
}
|
||||
else if (hictinting[palnum].f & HICTINT_USEONART)
|
||||
hictinting_apply(glcolors[i], palnum);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
@ -3964,16 +3972,24 @@ static void polymer_drawskybox(int16_t tilenum, char palnum, int8_t shad
|
|||
|
||||
color[0] = color[1] = color[2] = getshadefactor(shade);
|
||||
|
||||
if (pth && (pth->flags & PTH_HIGHTILE))
|
||||
if (pth)
|
||||
{
|
||||
if (pth->palnum != palnum || (pth->effects & HICTINT_IN_MEMORY) || (hictinting[palnum].f & HICTINT_APPLYOVERALTPAL))
|
||||
hictinting_apply(color, palnum);
|
||||
// tinting
|
||||
if (!(hictinting[palnum].f & HICTINT_PRECOMPUTED))
|
||||
{
|
||||
if (pth->flags & PTH_HIGHTILE)
|
||||
{
|
||||
if (pth->palnum != palnum || (pth->effects & HICTINT_IN_MEMORY) || (hictinting[palnum].f & HICTINT_APPLYOVERALTPAL))
|
||||
hictinting_apply(color, palnum);
|
||||
}
|
||||
else if (hictinting[palnum].f & HICTINT_USEONART)
|
||||
hictinting_apply(color, palnum);
|
||||
}
|
||||
|
||||
if (have_basepal_tint())
|
||||
// global tinting
|
||||
if ((pth->flags & PTH_HIGHTILE) && have_basepal_tint())
|
||||
hictinting_apply(color, MAXPALOOKUPS-1);
|
||||
}
|
||||
else if (hictinting[palnum].f & HICTINT_USEONART)
|
||||
hictinting_apply(color, palnum);
|
||||
|
||||
bglColor4f(color[0], color[1], color[2], 1.0);
|
||||
bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0);
|
||||
|
@ -4186,8 +4202,7 @@ static void polymer_drawmdsprite(tspritetype *tspr)
|
|||
usinghighpal = (pr_highpalookups &&
|
||||
prhighpalookups[curbasepal][tspr->pal].map);
|
||||
|
||||
// If that palette has a highpalookup, we'll never use tinting. We might use
|
||||
// alternate skins if they exist later, though.
|
||||
// tinting
|
||||
if (!usinghighpal && !(hictinting[tspr->pal].f & HICTINT_PRECOMPUTED))
|
||||
{
|
||||
if (!(m->flags&1))
|
||||
|
@ -4195,7 +4210,7 @@ static void polymer_drawmdsprite(tspritetype *tspr)
|
|||
else globalnoeffect=1; //mdloadskin reads this
|
||||
}
|
||||
|
||||
// fullscreen tint on global palette change
|
||||
// global tinting
|
||||
if (!usinghighpal && have_basepal_tint())
|
||||
hictinting_apply_ub(color, MAXPALOOKUPS-1);
|
||||
|
||||
|
@ -4659,17 +4674,21 @@ static void polymer_getbuildmaterial(_prmaterial* material, int16_t tile
|
|||
material->diffusemodulation[2] =
|
||||
(GLubyte)(getshadefactor(shade) * 0xFF);
|
||||
|
||||
if (pth->flags & PTH_HIGHTILE)
|
||||
// tinting
|
||||
if (!(hictinting[pal].f & HICTINT_PRECOMPUTED))
|
||||
{
|
||||
if (pth->palnum != pal || (pth->effects & HICTINT_IN_MEMORY) || (hictinting[pal].f & HICTINT_APPLYOVERALTPAL))
|
||||
if (pth->flags & PTH_HIGHTILE)
|
||||
{
|
||||
if (pth->palnum != pal || (pth->effects & HICTINT_IN_MEMORY) || (hictinting[pal].f & HICTINT_APPLYOVERALTPAL))
|
||||
hictinting_apply_ub(material->diffusemodulation, pal);
|
||||
}
|
||||
else if (hictinting[pal].f & HICTINT_USEONART)
|
||||
hictinting_apply_ub(material->diffusemodulation, pal);
|
||||
|
||||
// fullscreen tint on global palette change... this is used for nightvision and underwater tinting
|
||||
if (!usinghighpal && have_basepal_tint())
|
||||
hictinting_apply_ub(material->diffusemodulation, MAXPALOOKUPS-1);
|
||||
}
|
||||
else if (hictinting[pal].f & HICTINT_USEONART)
|
||||
hictinting_apply_ub(material->diffusemodulation, pal);
|
||||
|
||||
// global tinting
|
||||
if ((pth->flags & PTH_HIGHTILE) && !usinghighpal && have_basepal_tint())
|
||||
hictinting_apply_ub(material->diffusemodulation, MAXPALOOKUPS-1);
|
||||
|
||||
// PR_BIT_GLOW_MAP
|
||||
if (r_fullbrights && pth->flags & PTH_HASFULLBRIGHT)
|
||||
|
|
|
@ -1561,22 +1561,23 @@ static void drawpoly(vec2f_t const * const dpxy, int32_t const n, int32_t method
|
|||
// spriteext full alpha control
|
||||
pc[3] = float_trans[method & 3] * (1.f - drawpoly_alpha);
|
||||
|
||||
// tinting happens only to hightile textures, and only if the texture we're
|
||||
// rendering isn't for the same palette as what we asked for
|
||||
|
||||
if (!(hictinting[globalpal].f & HICTINT_PRECOMPUTED))
|
||||
if (pth)
|
||||
{
|
||||
if (pth && (pth->flags & PTH_HIGHTILE))
|
||||
// tinting
|
||||
if (!(hictinting[globalpal].f & HICTINT_PRECOMPUTED))
|
||||
{
|
||||
if (pth->palnum != globalpal || (pth->effects & HICTINT_IN_MEMORY) || (hictinting[globalpal].f & HICTINT_APPLYOVERALTPAL))
|
||||
if (pth->flags & PTH_HIGHTILE)
|
||||
{
|
||||
if (pth->palnum != globalpal || (pth->effects & HICTINT_IN_MEMORY) || (hictinting[globalpal].f & HICTINT_APPLYOVERALTPAL))
|
||||
hictinting_apply(pc, globalpal);
|
||||
}
|
||||
else if (hictinting[globalpal].f & HICTINT_USEONART)
|
||||
hictinting_apply(pc, globalpal);
|
||||
|
||||
if (have_basepal_tint())
|
||||
hictinting_apply(pc, MAXPALOOKUPS-1);
|
||||
}
|
||||
// hack: this is for drawing the 8-bit crosshair recolored in polymost
|
||||
else if (hictinting[globalpal].f & HICTINT_USEONART)
|
||||
hictinting_apply(pc, globalpal);
|
||||
|
||||
// global tinting
|
||||
if ((pth->flags & PTH_HIGHTILE) && have_basepal_tint())
|
||||
hictinting_apply(pc, MAXPALOOKUPS-1);
|
||||
}
|
||||
|
||||
bglColor4f(pc[0], pc[1], pc[2], pc[3]);
|
||||
|
|
Loading…
Reference in a new issue