mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-26 19:50:45 +00:00
Clean up E_PostLoadPalette.
git-svn-id: https://svn.eduke32.com/eduke32@6513 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
c9981e76af
commit
23b1b650bb
2 changed files with 16 additions and 23 deletions
|
@ -32,6 +32,9 @@ extern uint32_t PaletteIndexFullbrights[8];
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char r, g, b, f;
|
char r, g, b, f;
|
||||||
} palette_t;
|
} palette_t;
|
||||||
|
typedef struct {
|
||||||
|
uint8_t r, g, b;
|
||||||
|
} rgb24_t;
|
||||||
extern palette_t curpalette[256], curpalettefaded[256], palfadergb;
|
extern palette_t curpalette[256], curpalettefaded[256], palfadergb;
|
||||||
extern char palfadedelta;
|
extern char palfadedelta;
|
||||||
|
|
||||||
|
|
|
@ -274,24 +274,16 @@ void E_PostLoadPalette(void)
|
||||||
|
|
||||||
fixtransluscence(FP_OFF(blendtable[0]));
|
fixtransluscence(FP_OFF(blendtable[0]));
|
||||||
|
|
||||||
|
char const * const palookup0 = palookup[0];
|
||||||
|
|
||||||
#ifdef DEBUG_TILESIZY_512
|
#ifdef DEBUG_TILESIZY_512
|
||||||
// Bump shade 1 by 16.
|
// Bump shade 1 by 16.
|
||||||
for (bssize_t i=256; i<512; i++)
|
for (bssize_t i=256; i<512; i++)
|
||||||
palookup[0][i] = palookup[0][i+(16<<8)];
|
palookup0[i] = palookup0[i+(16<<8)];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// find white and black colors
|
blackcol = getclosestcol(0, 0, 0);
|
||||||
for (bssize_t i=0, j, k=0; i<256; i++)
|
whitecol = getclosestcol(255, 255, 255);
|
||||||
{
|
|
||||||
j = palette[i*3] + palette[i*3+1] + palette[i*3+2];
|
|
||||||
if (j > k) { k = j; whitecol = i; }
|
|
||||||
}
|
|
||||||
for (bssize_t i=0, j, k=768; i<256; i++)
|
|
||||||
{
|
|
||||||
j = palette[i*3] + palette[i*3+1] + palette[i*3+2];
|
|
||||||
if (j < k) { k = j; blackcol = i; }
|
|
||||||
}
|
|
||||||
|
|
||||||
redcol = getclosestcol(255, 0, 0);
|
redcol = getclosestcol(255, 0, 0);
|
||||||
|
|
||||||
for (size_t i = 0; i<16; i++)
|
for (size_t i = 0; i<16; i++)
|
||||||
|
@ -303,22 +295,20 @@ void E_PostLoadPalette(void)
|
||||||
// Bmemset(PaletteIndexFullbrights, 0, sizeof(PaletteIndexFullbrights));
|
// Bmemset(PaletteIndexFullbrights, 0, sizeof(PaletteIndexFullbrights));
|
||||||
for (bssize_t c = 0; c < 255; ++c) // skipping transparent color
|
for (bssize_t c = 0; c < 255; ++c) // skipping transparent color
|
||||||
{
|
{
|
||||||
char const * const thispalookup = palookup[0];
|
uint8_t const index = palookup0[c];
|
||||||
char const color = thispalookup[c];
|
rgb24_t const & color = *(rgb24_t *)&palette[index*3];
|
||||||
|
|
||||||
if (EDUKE32_PREDICT_FALSE(palette[color*3] == 0 &&
|
// don't consider #000000 fullbright
|
||||||
palette[color*3+1] == 0 &&
|
if (EDUKE32_PREDICT_FALSE(color.r == 0 && color.g == 0 && color.b == 0))
|
||||||
palette[color*3+2] == 0))
|
continue;
|
||||||
continue; // don't consider #000000 fullbright
|
|
||||||
|
|
||||||
for (bssize_t s = c + 256; s < 256*32; s += 256)
|
for (size_t s = c + 256, s_end = 256*numshades; s < s_end; s += 256)
|
||||||
if (EDUKE32_PREDICT_FALSE(thispalookup[s] != color))
|
if (EDUKE32_PREDICT_FALSE(palookup0[s] != index))
|
||||||
goto PostLoad_NotFullbright;
|
goto PostLoad_NotFullbright;
|
||||||
|
|
||||||
SetPaletteIndexFullbright(c);
|
SetPaletteIndexFullbright(c);
|
||||||
|
|
||||||
PostLoad_NotFullbright:
|
PostLoad_NotFullbright: ;
|
||||||
continue; // should be optimized out
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue