Skip to content
Permalink
Browse files

fix palette changes causing visual glitches with transparency

by comparing the entire PLAYPAL to decide if the
cached translucency map needs to get recalculated

fixes #27
  • Loading branch information...
fabiangreffrath committed Aug 5, 2014
1 parent aedfd2c commit 95922e8c540abb019f6dd42b7ae24ce4280b6b3e
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/doom/r_data.c
@@ -831,7 +831,7 @@ void R_InitTranMap()
char *fname = NULL; extern char *configdir;
struct {
unsigned char pct;
unsigned char playpal[256];
unsigned char playpal[256*3]; // [crispy] PLAYPAL has 768 bytes!
} cache;
FILE *cachefp = fopen(fname = M_StringJoin(configdir,
"tranmap.dat", NULL), "r+b");
@@ -900,14 +900,16 @@ void R_InitTranMap()
if (cachefp) // write out the cached translucency map
{
cache.pct = tran_filter_pct;
memcpy(cache.playpal, playpal, 256);
memcpy(cache.playpal, playpal, sizeof cache.playpal);
fseek(cachefp, 0, SEEK_SET);
fwrite(&cache, 1, sizeof cache, cachefp);
fwrite(tranmap, 256, 256, cachefp);
fclose(cachefp);
}
}

if (cachefp)
fclose(cachefp);

if (fname)
free(fname);

0 comments on commit 95922e8

Please sign in to comment.
You can’t perform that action at this time.