mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-10 18:20:49 +00:00
Merge branch 'lighting_fixes_plane_n_simple' into 'master'
Lighting fixes? Plane and simple! See merge request STJr/SRB2!268
This commit is contained in:
commit
0b8c231989
3 changed files with 26 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
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,9 @@
|
||||||
// Quincunx antialiasing of flats!
|
// Quincunx antialiasing of flats!
|
||||||
//#define QUINCUNX
|
//#define QUINCUNX
|
||||||
|
|
||||||
|
// good night sweet prince
|
||||||
|
#define SHITPLANESPARENCY
|
||||||
|
|
||||||
//SoM: 3/23/2000: Use Boom visplane hashing.
|
//SoM: 3/23/2000: Use Boom visplane hashing.
|
||||||
#define MAXVISPLANES 512
|
#define MAXVISPLANES 512
|
||||||
|
|
||||||
|
@ -768,7 +771,11 @@ 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)
|
#ifdef SHITPLANESPARENCY
|
||||||
|
if (spanfunc == splatfunc || (pl->extra_colormap && pl->extra_colormap->fog))
|
||||||
|
#else
|
||||||
|
if (!pl->extra_colormap || !(pl->extra_colormap->fog & 2))
|
||||||
|
#endif
|
||||||
light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
||||||
else
|
else
|
||||||
light = LIGHTLEVELS-1;
|
light = LIGHTLEVELS-1;
|
||||||
|
@ -822,7 +829,11 @@ 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)
|
#ifdef SHITPLANESPARENCY
|
||||||
|
if (spanfunc == splatfunc || (pl->extra_colormap && pl->extra_colormap->fog))
|
||||||
|
#else
|
||||||
|
if (!pl->extra_colormap || !(pl->extra_colormap->fog & 2))
|
||||||
|
#endif
|
||||||
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