mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
New def token "shadefactor"
shadefactor <value> Controls the level of shading in GL modes. Normally it is set to the shade at which all colors are pitch black. The default value calculated from Duke 3D's palette is 30, but most other Build games with a different palette are calculate to 31. This token is for GL mods without a palette. Patch from Fox. git-svn-id: https://svn.eduke32.com/eduke32@6592 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
67438d0cd2
commit
6a77175ac5
2 changed files with 19 additions and 10 deletions
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue