Hook highpal to model skins.

git-svn-id: https://svn.eduke32.com/eduke32@1756 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2011-01-12 02:06:51 +00:00
parent 4bc5ed0e83
commit e4d8e53a5a

View file

@ -3656,7 +3656,7 @@ static void polymer_drawmdsprite(spritetype *tspr)
mdskinmap_t* sk; mdskinmap_t* sk;
float *v0, *v1; float *v0, *v1;
md3surf_t *s; md3surf_t *s;
char lpal; char lpal, targetpal, usinghighpal, foundpalskin;
float spos2[3], spos[3], tspos[3], lpos[3], tlpos[3], vec[3], mat[4][4]; float spos2[3], spos[3], tspos[3], lpos[3], tlpos[3], vec[3], mat[4][4];
float ang; float ang;
float scale; float scale;
@ -3820,7 +3820,12 @@ static void polymer_drawmdsprite(spritetype *tspr)
color[0] = color[1] = color[2] = color[0] = color[1] = color[2] =
((float)(numpalookups-min(max((tspr->shade * shadescale)+m->shadeoff,0),numpalookups)))/((float)numpalookups) * 0xFF; ((float)(numpalookups-min(max((tspr->shade * shadescale)+m->shadeoff,0),numpalookups)))/((float)numpalookups) * 0xFF;
if (!(hictinting[tspr->pal].f&4)) usinghighpal = (tspr->pal > 0 && pr_highpalookups &&
prhighpalookups[tspr->pal].map);
// If that palette has a highpalookup, we'll never use tinting. We might use
// alternate skins if they exist later, though.
if (!usinghighpal && !(hictinting[tspr->pal].f&4))
{ {
if (!(m->flags&1) || (!(tspr->owner >= MAXSPRITES) && sector[sprite[tspr->owner].sectnum].floorpal!=0)) if (!(m->flags&1) || (!(tspr->owner >= MAXSPRITES) && sector[sprite[tspr->owner].sectnum].floorpal!=0))
{ {
@ -3953,8 +3958,29 @@ static void polymer_drawmdsprite(spritetype *tspr)
// bglEnable(GL_TEXTURE_2D); // bglEnable(GL_TEXTURE_2D);
targetpal = tspr->pal;
foundpalskin = 0;
for (sk = m->skinmap; sk; sk = sk->next)
if ((int32_t)sk->palette == tspr->pal &&
sk->skinnum == tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum &&
sk->surfnum == surfi)
{
if (sk->specpower != 1.0)
mdspritematerial.specmaterial[0] = sk->specpower;
mdspritematerial.specmaterial[1] = sk->specfactor;
foundpalskin = 1;
}
if (!foundpalskin) {
// We don't have a specific skin defined for this palette
// Use the base skin instead and plug in our highpalookup map
targetpal = 0;
mdspritematerial.highpalookupmap = prhighpalookups[tspr->pal].map;
}
mdspritematerial.diffusemap = mdspritematerial.diffusemap =
mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,tspr->pal,surfi); mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,targetpal,surfi);
if (!mdspritematerial.diffusemap) if (!mdspritematerial.diffusemap)
continue; continue;
@ -3990,16 +4016,6 @@ static void polymer_drawmdsprite(spritetype *tspr)
} }
} }
for (sk = m->skinmap; sk; sk = sk->next)
if ((int32_t)sk->palette == tspr->pal &&
sk->skinnum == tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum &&
sk->surfnum == surfi)
{
if (sk->specpower != 1.0)
mdspritematerial.specmaterial[0] = sk->specpower;
mdspritematerial.specmaterial[1] = sk->specfactor;
}
if (!(tspr->cstat&1024)) if (!(tspr->cstat&1024))
{ {
mdspritematerial.glowmap = mdspritematerial.glowmap =