From cb758f6daba05af7e625bf1ecd4565f5f83711de Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 13 Feb 2017 22:17:15 +0100 Subject: [PATCH] - added a 'nolightfade' MAPINFO option which disables light diminishing in OpenGL. Note that this only works for light modes 0-3. Modes 4 and 8 use special light math that would not work if such a setting was forced. --- src/gl/data/gl_data.cpp | 19 +++++++++++++++++++ src/gl/data/gl_data.h | 1 + src/gl/renderer/gl_lightdata.cpp | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/gl/data/gl_data.cpp b/src/gl/data/gl_data.cpp index bb73ad3ae..bd185f76f 100644 --- a/src/gl/data/gl_data.cpp +++ b/src/gl/data/gl_data.cpp @@ -212,6 +212,7 @@ struct FGLROptions : public FOptionalMapinfoData lightmode = -1; attenuate = -1; nocoloredspritelighting = -1; + nolightfade = false; notexturefill = -1; skyrotatevector = FVector3(0,0,1); skyrotatevector2 = FVector3(0,0,1); @@ -228,6 +229,7 @@ struct FGLROptions : public FOptionalMapinfoData newopt->lightmode = lightmode; newopt->attenuate = attenuate; newopt->nocoloredspritelighting = nocoloredspritelighting; + newopt->nolightfade = nolightfade; newopt->notexturefill = notexturefill; newopt->skyrotatevector = skyrotatevector; newopt->skyrotatevector2 = skyrotatevector2; @@ -244,6 +246,7 @@ struct FGLROptions : public FOptionalMapinfoData int8_t lightadditivesurfaces; int8_t nocoloredspritelighting; int8_t notexturefill; + bool nolightfade; FVector3 skyrotatevector; FVector3 skyrotatevector2; float pixelstretch; @@ -303,6 +306,20 @@ DEFINE_MAP_OPTION(nocoloredspritelighting, false) } } +DEFINE_MAP_OPTION(nolightfade, false) +{ + FGLROptions *opt = info->GetOptData("gl_renderer"); + if (parse.CheckAssign()) + { + parse.sc.MustGetNumber(); + opt->nolightfade = !!parse.sc.Number; + } + else + { + opt->nolightfade = true; + } +} + DEFINE_MAP_OPTION(notexturefill, false) { FGLROptions *opt = info->GetOptData("gl_renderer"); @@ -423,6 +440,7 @@ void InitGLRMapinfoData() glset.skyrotatevector = opt->skyrotatevector; glset.skyrotatevector2 = opt->skyrotatevector2; glset.pixelstretch = opt->pixelstretch; + glset.nolightfade = opt->nolightfade; } else { @@ -436,6 +454,7 @@ void InitGLRMapinfoData() glset.skyrotatevector = FVector3(0, 0, 1); glset.skyrotatevector2 = FVector3(0, 0, 1); glset.pixelstretch = 1.2f; + glset.nolightfade = false; } ResetOpts(); } diff --git a/src/gl/data/gl_data.h b/src/gl/data/gl_data.h index d5bdeb46a..cf79fe138 100644 --- a/src/gl/data/gl_data.h +++ b/src/gl/data/gl_data.h @@ -10,6 +10,7 @@ struct GLRenderSettings SBYTE lightmode; bool nocoloredspritelighting; + bool nolightfade; bool notexturefill; bool brightfog; bool lightadditivesurfaces; diff --git a/src/gl/renderer/gl_lightdata.cpp b/src/gl/renderer/gl_lightdata.cpp index b4912f825..c017453bd 100644 --- a/src/gl/renderer/gl_lightdata.cpp +++ b/src/gl/renderer/gl_lightdata.cpp @@ -312,7 +312,7 @@ float gl_GetFogDensity(int lightlevel, PalEntry fogcolor, int sectorfogdensity) else if ((fogcolor.d & 0xffffff) == 0) { // case 2: black fog - if (glset.lightmode != 8) + if (glset.lightmode != 8 && !glset.nolightfade) { density = distfogtable[glset.lightmode != 0][gl_ClampLight(lightlevel)]; }