From 7fbd99ca0f84b9b342d22530b89714ae59c47c13 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 16 Sep 2023 12:06:07 +0200 Subject: [PATCH] - fixed flags for gl_lightmode. With how this is being handled now, the CVAR needs to have the CVAR_GLOBALCONFIG flag and CVAR_NOINITCALL unset or it simply won't work right. Since its meaning has completely changed now (i.e. it's mainly a performance switch to a less demanding implementation instead of being able to select vastly different lighting methods) making it global is more sensible. --- src/g_level.cpp | 4 ++-- src/gameconfigfile.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index d161059e6..c21031706 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -151,9 +151,9 @@ CUSTOM_CVAR(Int, gl_maplightmode, -1, CVAR_NOINITCALL) // this is just for testi if (self > 5 || self < -1) self = -1; } -CUSTOM_CVAR(Int, gl_lightmode, 1, CVAR_ARCHIVE | CVAR_NOINITCALL) +CUSTOM_CVAR(Int, gl_lightmode, 1, CVAR_ARCHIVE) { - if (self < 0 || self > 2) self = 2; + if (self < 0 || self > 2) self = 1; } ELightMode getRealLightmode(FLevelLocals* Level, bool for3d) diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp index 5a801bff3..0b3931e88 100644 --- a/src/gameconfigfile.cpp +++ b/src/gameconfigfile.cpp @@ -612,7 +612,7 @@ void FGameConfigFile::DoGlobalSetup () if (const auto var = FindCVar("gl_lightmode", NULL)) { UCVarValue v = var->GetGenericRep(CVAR_Int); - v.Int /= 8; // all legacy modes map to 0, ZDoom software to 1 and Vanilla software to 2. + v.Int = v.Int == 16 ? 2 : v.Int == 8 ? 1 : 0; var->SetGenericRep(v, CVAR_Int); } }