diff --git a/src/gl/renderer/gl_lightdata.cpp b/src/gl/renderer/gl_lightdata.cpp index a02762eb8..771c4c65c 100644 --- a/src/gl/renderer/gl_lightdata.cpp +++ b/src/gl/renderer/gl_lightdata.cpp @@ -67,7 +67,12 @@ CUSTOM_CVAR (Int, gl_light_ambient, 20, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) } CVAR(Int, gl_weaponlight, 8, CVAR_ARCHIVE); -CVAR(Bool,gl_enhanced_nightvision,true,CVAR_ARCHIVE) +CUSTOM_CVAR(Bool, gl_enhanced_nightvision, true, CVAR_ARCHIVE|CVAR_NOINITCALL) +{ + // The fixed colormap state needs to be reset because if this happens when + // a shader is set to CM_LITE or CM_TORCH it won't register the change in behavior caused by this CVAR. + GLRenderer->mShaderManager->ResetFixedColormap(); +} CVAR(Bool, gl_brightfog, false, CVAR_ARCHIVE); diff --git a/src/gl/shaders/gl_shader.h b/src/gl/shaders/gl_shader.h index 92ef221af..8b6f7b4a6 100644 --- a/src/gl/shaders/gl_shader.h +++ b/src/gl/shaders/gl_shader.h @@ -269,6 +269,18 @@ public: return mActiveShader; } + void ResetFixedColormap() + { + for (unsigned i = 0; i < mTextureEffects.Size(); i++) + { + mTextureEffects[i]->currentfixedcolormap = -1; + } + for (unsigned i = 0; i < mTextureEffectsNAT.Size(); i++) + { + mTextureEffectsNAT[i]->currentfixedcolormap = -1; + } + } + FShader *Get(unsigned int eff, bool alphateston) { // indices 0-2 match the warping modes, 3 is brightmap, 4 no texture, the following are custom diff --git a/wadsrc/static/shaders/glsl/main.fp b/wadsrc/static/shaders/glsl/main.fp index e7421106b..1bf583b06 100644 --- a/wadsrc/static/shaders/glsl/main.fp +++ b/wadsrc/static/shaders/glsl/main.fp @@ -313,8 +313,7 @@ void main() case 2: { - frag = frag * uFixedColormapStart; - frag.a *= vColor.a; + frag = vColor * frag * uFixedColormapStart; break; }