From 69861688dcb2223525265abf6983033dc9fe1ff5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 12 May 2010 06:52:03 +0000 Subject: [PATCH] - expanded r_smoothlighting into a r_fakecontrast CVAR that allows to set all 3 options: off, standard and smooth. SVN r2314 (trunk) --- src/m_options.cpp | 8 ++++++++ src/r_defs.h | 2 +- src/r_segs.cpp | 32 +++++++++++++++++++++++++------- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/m_options.cpp b/src/m_options.cpp index e87fa87a2..2ca052521 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -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 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} }, diff --git a/src/r_defs.h b/src/r_defs.h index f19656afa..64d9b7614 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -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) { diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 06b793af4..88c918db2 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -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))