- expanded r_smoothlighting into a r_fakecontrast CVAR that allows to set all 3 options: off, standard and smooth.

SVN r2314 (trunk)
This commit is contained in:
Christoph Oelckers 2010-05-12 06:52:03 +00:00
parent 24aa1abf14
commit 69861688dc
3 changed files with 34 additions and 8 deletions

View file

@ -437,6 +437,7 @@ EXTERN_CVAR (Int, wipetype)
EXTERN_CVAR (Bool, vid_palettehack)
EXTERN_CVAR (Bool, vid_attachedsurfaces)
EXTERN_CVAR (Int, screenblocks)
EXTERN_CVAR (Int, r_fakecontrast)
static TArray<valuestring_t> Crosshairs;
@ -476,6 +477,12 @@ static value_t Endoom[] = {
{ 2.0, "Only modified" }
};
static value_t Contrast[] = {
{ 0.0, "Off" },
{ 1.0, "On" },
{ 2.0, "Smooth" }
};
static menuitem_t VideoItems[] = {
{ more, "Message Options", {NULL}, {0.0}, {0.0}, {0.0}, {(value_t *)StartMessagesMenu} },
{ more, "Automap Options", {NULL}, {0.0}, {0.0}, {0.0}, {(value_t *)StartAutomapMenu} },
@ -497,6 +504,7 @@ static menuitem_t VideoItems[] = {
#endif
{ redtext, " ", {NULL}, {0.0}, {0.0}, {0.0}, {NULL} },
{ discrete, "Use fuzz effect", {&r_drawfuzz}, {2.0}, {0.0}, {0.0}, {YesNo} },
{ discrete, "Use fake contrast", {&r_fakecontrast}, {3.0}, {0.0}, {0.0}, {YesNo} },
{ discrete, "Rocket Trails", {&cl_rockettrails}, {4.0}, {0.0}, {0.0}, {RocketTrailTypes} },
{ discrete, "Blood Type", {&cl_bloodtype}, {3.0}, {0.0}, {0.0}, {BloodTypes} },
{ discrete, "Bullet Puff Type", {&cl_pufftype}, {2.0}, {0.0}, {0.0}, {PuffTypes} },

View file

@ -763,7 +763,7 @@ struct side_t
BYTE Flags;
int Index; // needed to access custom UDMF fields which are stored in loading order.
int GetLightLevel (bool foggy, int baselight) const;
int GetLightLevel (bool foggy, int baselight, int *fake = NULL) const;
void SetLight(SWORD l)
{

View file

@ -53,6 +53,7 @@
#define WALLYREPEAT 8
//CVAR (Int, ty, 8, 0)
//CVAR (Int, tx, 8, 0)
@ -1453,24 +1454,33 @@ void R_NewWall (bool needlights)
}
}
CVAR(Bool, r_smoothlighting, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CUSTOM_CVAR(Int, r_fakecontrast, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
{
if (self < 0) self = 1;
else if (self > 2) self = 2;
}
int side_t::GetLightLevel (bool foggy, int baselight) const
int side_t::GetLightLevel (bool foggy, int baselight, int *pfakecontrast) const
{
if (Flags & WALLF_ABSLIGHTING)
{
baselight = (BYTE)Light;
}
if (pfakecontrast != NULL)
{
*pfakecontrast = 0;
}
if (!foggy) // Don't do relative lighting in foggy sectors
{
if (!(Flags & WALLF_NOFAKECONTRAST))
if (!(Flags & WALLF_NOFAKECONTRAST) && r_fakecontrast != 0)
{
if (((level.flags2 & LEVEL2_SMOOTHLIGHTING) || (Flags & WALLF_SMOOTHLIGHTING) || r_smoothlighting) &&
int rel;
if (((level.flags2 & LEVEL2_SMOOTHLIGHTING) || (Flags & WALLF_SMOOTHLIGHTING) || r_fakecontrast == 2) &&
linedef->dx != 0)
{
baselight += int // OMG LEE KILLOUGH LIVES! :/
rel = int // OMG LEE KILLOUGH LIVES! :/
(
(float(level.WallHorizLight)
+abs(atan(float(linedef->dy)/float(linedef->dx))/float(1.57079))
@ -1479,8 +1489,16 @@ int side_t::GetLightLevel (bool foggy, int baselight) const
}
else
{
baselight += linedef->dx==0? level.WallVertLight :
linedef->dy==0? level.WallHorizLight : 0;
rel = linedef->dx==0? level.WallVertLight :
linedef->dy==0? level.WallHorizLight : 0;
}
if (pfakecontrast != NULL)
{
*pfakecontrast = rel;
}
else
{
baselight += rel;
}
}
if (!(Flags & WALLF_ABSLIGHTING))