Generate editorcolors[] from vgapal16[] at a better point in the startup process

git-svn-id: https://svn.eduke32.com/eduke32@8490 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/build/src/build.cpp
#	source/build/src/palette.cpp
This commit is contained in:
hendricks266 2019-12-23 07:03:51 +00:00 committed by Christoph Oelckers
parent 221e7a6b85
commit 34ef03185d
3 changed files with 13 additions and 6 deletions

View file

@ -618,6 +618,7 @@ EXTERN uint8_t gotpic[(MAXTILES+7)>>3];
EXTERN char gotsector[(MAXSECTORS+7)>>3];
EXTERN char editorcolors[256];
EXTERN char editorcolorsdef[256];
EXTERN char editwall[(MAXWALLS+7)>>3];

View file

@ -467,7 +467,10 @@ static int32_t defsparser(scriptfile *script)
if (scriptfile_getnumber(script,&idxend)) break;
while ((unsigned)col < 256 && idx <= idxend)
{
editorcolorsdef[col] = 1;
editorcolors[col++] = idx++;
}
}
break;
case T_FOGPAL:

View file

@ -358,12 +358,6 @@ void palettePostLoadTables(void)
whitecol = paletteGetClosestColor(255, 255, 255);
redcol = paletteGetClosestColor(255, 0, 0);
for (size_t i = 0; i<16; i++)
{
palette_t *edcol = (palette_t *) &vgapal16[4*i];
editorcolors[i] = paletteGetClosestColorUpToIndex(edcol->b, edcol->g, edcol->r, playing_blood ? 254 : 239);
}
// Bmemset(PaletteIndexFullbrights, 0, sizeof(PaletteIndexFullbrights));
for (bssize_t c = 0; c < 255; ++c) // skipping transparent color
{
@ -400,6 +394,15 @@ void palettePostLoadTables(void)
PostLoad_FoundShade: ;
frealmaxshade = (float)(realmaxshade = s+1);
}
for (size_t i = 0; i<256; i++)
{
if (editorcolorsdef[i])
continue;
palette_t *edcol = (palette_t *) &vgapal16[4*i];
editorcolors[i] = paletteGetClosestColorUpToIndex(edcol->b, edcol->g, edcol->r, 239);
}
}
void paletteFixTranslucencyMask(void)