mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-26 12:21:19 +00:00
Continuing my recent streak of making random lighting/colormap-related fixes to long-standing bugs:
* Fix that thing where ALL transparent FOF planes were continuously fullbright unless encased in a fog which disables sprite fullbrightness, which was long-hated by many people in the community! * For backwards compatibility, setting flag 1 in that fog field (which is probably the most common "in-the-wild" usage of this feature) will continue to make objects un-fullbright. * For situations where you desperately want the behaviour to be enabled, you can apply fog flag 2. * Change the fadestart and fadeend range in which colormaps are generated. * The problem HERE was that the darkest light level reached by generated colormaps was actually slightly brighter than the darkest level reached by normal colormaps. * The typo I fixed does have SOME basis in fact - standard colormap lumps are 34 (33 in 0-indexing) long rather than 32 (31), but whoever wrote this didn't realise that the code for generating them didn't do it DooM style, just bright-to-dark with no extras on the end...
This commit is contained in:
parent
9d3aad9036
commit
973b3c3f5e
3 changed files with 15 additions and 15 deletions
22
src/r_data.c
22
src/r_data.c
|
@ -1087,7 +1087,7 @@ INT32 R_ColormapNumForName(char *name)
|
||||||
extra_colormaps[num_extra_colormaps].fadecolor = 0x0;
|
extra_colormaps[num_extra_colormaps].fadecolor = 0x0;
|
||||||
extra_colormaps[num_extra_colormaps].maskamt = 0x0;
|
extra_colormaps[num_extra_colormaps].maskamt = 0x0;
|
||||||
extra_colormaps[num_extra_colormaps].fadestart = 0;
|
extra_colormaps[num_extra_colormaps].fadestart = 0;
|
||||||
extra_colormaps[num_extra_colormaps].fadeend = 33;
|
extra_colormaps[num_extra_colormaps].fadeend = 31;
|
||||||
extra_colormaps[num_extra_colormaps].fog = 0;
|
extra_colormaps[num_extra_colormaps].fog = 0;
|
||||||
|
|
||||||
num_extra_colormaps++;
|
num_extra_colormaps++;
|
||||||
|
@ -1115,7 +1115,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
size_t mapnum = num_extra_colormaps;
|
size_t mapnum = num_extra_colormaps;
|
||||||
size_t i;
|
size_t i;
|
||||||
UINT32 cr, cg, cb, maskcolor, fadecolor;
|
UINT32 cr, cg, cb, maskcolor, fadecolor;
|
||||||
UINT32 fadestart = 0, fadeend = 33, fadedist = 33;
|
UINT32 fadestart = 0, fadeend = 31, fadedist = 31;
|
||||||
|
|
||||||
#define HEX2INT(x) (UINT32)(x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0)
|
#define HEX2INT(x) (UINT32)(x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0)
|
||||||
if (p1[0] == '#')
|
if (p1[0] == '#')
|
||||||
|
@ -1156,12 +1156,12 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
// Get parameters like fadestart, fadeend, and the fogflag
|
// Get parameters like fadestart, fadeend, and the fogflag
|
||||||
fadestart = NUMFROMCHAR(p2[3]) + (NUMFROMCHAR(p2[2]) * 10);
|
fadestart = NUMFROMCHAR(p2[3]) + (NUMFROMCHAR(p2[2]) * 10);
|
||||||
fadeend = NUMFROMCHAR(p2[5]) + (NUMFROMCHAR(p2[4]) * 10);
|
fadeend = NUMFROMCHAR(p2[5]) + (NUMFROMCHAR(p2[4]) * 10);
|
||||||
if (fadestart > 32)
|
if (fadestart > 30)
|
||||||
fadestart = 0;
|
fadestart = 0;
|
||||||
if (fadeend > 33 || fadeend < 1)
|
if (fadeend > 31 || fadeend < 1)
|
||||||
fadeend = 33;
|
fadeend = 31;
|
||||||
fadedist = fadeend - fadestart;
|
fadedist = fadeend - fadestart;
|
||||||
fog = NUMFROMCHAR(p2[1]) ? 1 : 0;
|
fog = NUMFROMCHAR(p2[1]);
|
||||||
}
|
}
|
||||||
#undef getnum
|
#undef getnum
|
||||||
|
|
||||||
|
@ -1262,7 +1262,7 @@ void R_CreateColormap2(char *p1, char *p2, char *p3)
|
||||||
size_t i;
|
size_t i;
|
||||||
char *colormap_p;
|
char *colormap_p;
|
||||||
UINT32 cr, cg, cb, maskcolor, fadecolor;
|
UINT32 cr, cg, cb, maskcolor, fadecolor;
|
||||||
UINT32 fadestart = 0, fadeend = 33, fadedist = 33;
|
UINT32 fadestart = 0, fadeend = 31, fadedist = 31;
|
||||||
|
|
||||||
#define HEX2INT(x) (UINT32)(x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0)
|
#define HEX2INT(x) (UINT32)(x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0)
|
||||||
if (p1[0] == '#')
|
if (p1[0] == '#')
|
||||||
|
@ -1303,12 +1303,12 @@ void R_CreateColormap2(char *p1, char *p2, char *p3)
|
||||||
// Get parameters like fadestart, fadeend, and the fogflag
|
// Get parameters like fadestart, fadeend, and the fogflag
|
||||||
fadestart = NUMFROMCHAR(p2[3]) + (NUMFROMCHAR(p2[2]) * 10);
|
fadestart = NUMFROMCHAR(p2[3]) + (NUMFROMCHAR(p2[2]) * 10);
|
||||||
fadeend = NUMFROMCHAR(p2[5]) + (NUMFROMCHAR(p2[4]) * 10);
|
fadeend = NUMFROMCHAR(p2[5]) + (NUMFROMCHAR(p2[4]) * 10);
|
||||||
if (fadestart > 32)
|
if (fadestart > 30)
|
||||||
fadestart = 0;
|
fadestart = 0;
|
||||||
if (fadeend > 33 || fadeend < 1)
|
if (fadeend > 31 || fadeend < 1)
|
||||||
fadeend = 33;
|
fadeend = 31;
|
||||||
fadedist = fadeend - fadestart;
|
fadedist = fadeend - fadestart;
|
||||||
fog = NUMFROMCHAR(p2[1]) ? 1 : 0;
|
fog = NUMFROMCHAR(p2[1]);
|
||||||
}
|
}
|
||||||
#undef getnum
|
#undef getnum
|
||||||
|
|
||||||
|
|
|
@ -768,7 +768,7 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
else // Opaque, but allow transparent flat pixels
|
else // Opaque, but allow transparent flat pixels
|
||||||
spanfunc = splatfunc;
|
spanfunc = splatfunc;
|
||||||
|
|
||||||
if (pl->extra_colormap && pl->extra_colormap->fog)
|
if (!pl->extra_colormap || !(pl->extra_colormap->fog & 2))
|
||||||
light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
||||||
else
|
else
|
||||||
light = LIGHTLEVELS-1;
|
light = LIGHTLEVELS-1;
|
||||||
|
@ -822,7 +822,7 @@ void R_DrawSinglePlane(visplane_t *pl)
|
||||||
else // Opaque, but allow transparent flat pixels
|
else // Opaque, but allow transparent flat pixels
|
||||||
spanfunc = splatfunc;
|
spanfunc = splatfunc;
|
||||||
|
|
||||||
if (pl->extra_colormap && pl->extra_colormap->fog)
|
if (!pl->extra_colormap || !(pl->extra_colormap->fog & 2))
|
||||||
light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
||||||
else
|
else
|
||||||
light = LIGHTLEVELS-1;
|
light = LIGHTLEVELS-1;
|
||||||
|
|
|
@ -1023,7 +1023,7 @@ static void R_SplitSprite(vissprite_t *sprite, mobj_t *thing)
|
||||||
else
|
else
|
||||||
*/
|
*/
|
||||||
if (!((thing->frame & (FF_FULLBRIGHT|FF_TRANSMASK) || thing->flags2 & MF2_SHADOW)
|
if (!((thing->frame & (FF_FULLBRIGHT|FF_TRANSMASK) || thing->flags2 & MF2_SHADOW)
|
||||||
&& (!newsprite->extra_colormap || !newsprite->extra_colormap->fog)))
|
&& (!newsprite->extra_colormap || !(newsprite->extra_colormap->fog & 1))))
|
||||||
{
|
{
|
||||||
lindex = FixedMul(sprite->xscale, FixedDiv(640, vid.width))>>(LIGHTSCALESHIFT);
|
lindex = FixedMul(sprite->xscale, FixedDiv(640, vid.width))>>(LIGHTSCALESHIFT);
|
||||||
|
|
||||||
|
@ -1324,7 +1324,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
vis->transmap = transtables + (thing->frame & FF_TRANSMASK) - 0x10000;
|
vis->transmap = transtables + (thing->frame & FF_TRANSMASK) - 0x10000;
|
||||||
|
|
||||||
if (((thing->frame & FF_FULLBRIGHT) || (thing->flags2 & MF2_SHADOW))
|
if (((thing->frame & FF_FULLBRIGHT) || (thing->flags2 & MF2_SHADOW))
|
||||||
&& (!vis->extra_colormap || !vis->extra_colormap->fog))
|
&& (!vis->extra_colormap || !(vis->extra_colormap->fog & 1)))
|
||||||
{
|
{
|
||||||
// full bright: goggles
|
// full bright: goggles
|
||||||
vis->colormap = colormaps;
|
vis->colormap = colormaps;
|
||||||
|
|
Loading…
Reference in a new issue