From 34ef03185dc7db0fddecd96d8358e4ec7e3689b2 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 23 Dec 2019 07:03:51 +0000 Subject: [PATCH] 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 --- source/build/include/build.h | 1 + source/build/src/defs.cpp | 3 +++ source/build/src/palette.cpp | 15 +++++++++------ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index 9439f5e21..d745a7c98 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -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]; diff --git a/source/build/src/defs.cpp b/source/build/src/defs.cpp index 7f02ee18d..3eff02ce5 100644 --- a/source/build/src/defs.cpp +++ b/source/build/src/defs.cpp @@ -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: diff --git a/source/build/src/palette.cpp b/source/build/src/palette.cpp index 7da23fa12..ce571eb46 100644 --- a/source/build/src/palette.cpp +++ b/source/build/src/palette.cpp @@ -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)