mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
Calculate the perceptual (i.e. "real") max shade in the given tables.
git-svn-id: https://svn.eduke32.com/eduke32@6514 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
23b1b650bb
commit
5adb8364b6
2 changed files with 21 additions and 0 deletions
|
@ -38,6 +38,9 @@ typedef struct {
|
|||
extern palette_t curpalette[256], curpalettefaded[256], palfadergb;
|
||||
extern char palfadedelta;
|
||||
|
||||
extern int32_t realmaxshade;
|
||||
extern float frealmaxshade;
|
||||
|
||||
extern int32_t globalblend;
|
||||
extern uint32_t g_lastpalettesum;
|
||||
extern palette_t getpal(int32_t col);
|
||||
|
|
|
@ -20,6 +20,9 @@ palette_t palfadergb = { 0, 0, 0, 0 };
|
|||
char palfadedelta = 0;
|
||||
uint8_t blackcol;
|
||||
|
||||
int32_t realmaxshade;
|
||||
float frealmaxshade;
|
||||
|
||||
#if defined(USE_OPENGL)
|
||||
palette_t palookupfog[MAXPALOOKUPS];
|
||||
#endif
|
||||
|
@ -310,6 +313,21 @@ void E_PostLoadPalette(void)
|
|||
|
||||
PostLoad_NotFullbright: ;
|
||||
}
|
||||
|
||||
uint8_t const * const blackcolor = &palette[blackcol*3];
|
||||
size_t s;
|
||||
for (s = numshades < 2 ? 0 : numshades-2; s > 0; --s)
|
||||
{
|
||||
for (size_t c = s*256, c_end = c+255; c < c_end; ++c) // skipping transparent color
|
||||
{
|
||||
uint8_t const index = palookup0[c];
|
||||
uint8_t const * const color = &palette[index*3];
|
||||
if (!IsPaletteIndexFullbright(index) && memcmp(blackcolor, color, sizeof(rgb24_t)))
|
||||
goto PostLoad_FoundShade;
|
||||
}
|
||||
}
|
||||
PostLoad_FoundShade: ;
|
||||
frealmaxshade = (float)(realmaxshade = s+1);
|
||||
}
|
||||
|
||||
void E_ReplaceTransparentColorWithBlack(void)
|
||||
|
|
Loading…
Reference in a new issue