diff --git a/source/build/src/defs.cpp b/source/build/src/defs.cpp index 9dca37f0b..ef8e5c74f 100644 --- a/source/build/src/defs.cpp +++ b/source/build/src/defs.cpp @@ -118,6 +118,7 @@ enum scripttoken_t T_DST_ALPHA, T_ONE_MINUS_DST_ALPHA, T_DST_COLOR, T_ONE_MINUS_DST_COLOR, T_SHADERED, T_SHADEGREEN, T_SHADEBLUE, + T_SHADEFACTOR, }; static int32_t lastmodelid = -1, lastvoxid = -1, modelskin = -1, lastmodelskin = -1, seenframe = 0; @@ -401,6 +402,7 @@ static int32_t defsparser(scriptfile *script) { "undefbasepaletterange", T_UNDEFBASEPALETTERANGE }, { "undefpalookuprange", T_UNDEFPALOOKUPRANGE }, { "undefblendtablerange", T_UNDEFBLENDTABLERANGE }, + { "shadefactor", T_SHADEFACTOR }, }; while (1) @@ -635,6 +637,10 @@ static int32_t defsparser(scriptfile *script) if (scriptfile_getnumber(script,&j)) break; } break; + case T_SHADEFACTOR: + scriptfile_getnumber(script, &realmaxshade); + frealmaxshade = (float)realmaxshade; + break; case T_ARTFILE: { char *blockend, *fn = NULL; diff --git a/source/build/src/palette.cpp b/source/build/src/palette.cpp index 2a24cd16b..6de6fd50b 100644 --- a/source/build/src/palette.cpp +++ b/source/build/src/palette.cpp @@ -314,20 +314,23 @@ 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) + if (realmaxshade == 0) { - for (size_t c = s*256, c_end = c+255; c < c_end; ++c) // skipping transparent color + uint8_t const * const blackcolor = &palette[blackcol*3]; + size_t s; + for (s = numshades < 2 ? 0 : numshades-2; s > 0; --s) { - 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; + 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); } - PostLoad_FoundShade: ; - frealmaxshade = (float)(realmaxshade = s+1); } void E_ReplaceTransparentColorWithBlack(void)