Engine: Add one-bit alpha detection for hightile and model skins.

git-svn-id: https://svn.eduke32.com/eduke32@5649 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2016-03-07 11:22:02 +00:00
parent e9d3b4cc43
commit dd0f16875f
2 changed files with 8 additions and 4 deletions

View file

@ -824,6 +824,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
int32_t b = (glinfo.bgra) ? hictinting[pal].b : hictinting[pal].r;
char al = 255;
char onebitalpha = 1;
for (int32_t y = 0, j = 0; y < tsiz.y; ++y, j += siz.x)
{
@ -834,8 +835,8 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
tcol.b = cptr[rpptr[x].b];
tcol.g = cptr[rpptr[x].g];
tcol.r = cptr[rpptr[x].r];
tcol.a = rpptr[x].a;
al &= rpptr[x].a;
al &= tcol.a = rpptr[x].a;
onebitalpha &= tcol.a == 0 || tcol.a == 255;
if (effect & HICTINT_GRAYSCALE)
{
@ -907,6 +908,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
TO_DAMETH_NODOWNSIZE(sk->flags) |
TO_DAMETH_NOTEXCOMPRESS(sk->flags) |
TO_DAMETH_ARTIMMUNITY(sk->flags) |
(onebitalpha ? DAMETH_ONEBITALPHA : 0) |
(hasalpha ? DAMETH_HASALPHA : 0));
Bfree(pic);

View file

@ -1189,6 +1189,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
int32_t b = (glinfo.bgra) ? hictinting[dapalnum].b : hictinting[dapalnum].r;
char al = 255;
char onebitalpha = 1;
for (int32_t y = 0, j = 0; y < tsiz.y; ++y, j += siz.x)
{
@ -1199,8 +1200,8 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
tcol.b = cptr[rpptr[x].b];
tcol.g = cptr[rpptr[x].g];
tcol.r = cptr[rpptr[x].r];
tcol.a = rpptr[x].a;
al &= rpptr[x].a;
al &= tcol.a = rpptr[x].a;
onebitalpha &= tcol.a == 0 || tcol.a == 255;
if (effect & HICTINT_GRAYSCALE)
{
@ -1284,6 +1285,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
TO_DAMETH_NODOWNSIZE(hicr->flags) |
TO_DAMETH_NOTEXCOMPRESS(hicr->flags) |
TO_DAMETH_ARTIMMUNITY(hicr->flags) |
(onebitalpha ? DAMETH_ONEBITALPHA : 0) |
(hasalpha ? DAMETH_HASALPHA : 0));
Bfree(pic);