diff --git a/source/build/include/build.h b/source/build/include/build.h
index aff8b8e0b..e66077be9 100644
--- a/source/build/include/build.h
+++ b/source/build/include/build.h
@@ -840,8 +840,6 @@ int32_t wallvisible(int32_t const x, int32_t const y, int16_t const wallnum);
 #define STATUS2DSIZ 144
 #define STATUS2DSIZ2 26
 
-int32_t   videoSetRenderMode(int32_t renderer);
-
 #ifdef USE_OPENGL
 void    renderSetRollAngle(float rolla);
 #endif
diff --git a/wadsrc/static/shaders/glsl/func_paletted.fp b/wadsrc/static/shaders/glsl/func_paletted.fp
index 53b97b7b3..e39760fd4 100644
--- a/wadsrc/static/shaders/glsl/func_paletted.fp
+++ b/wadsrc/static/shaders/glsl/func_paletted.fp
@@ -40,7 +40,8 @@ vec4 ProcessTexel()
 
 	float visibility = max(uGlobVis * uLightFactor * z - ((u_flags & RF_ShadeInterpolate) != 0.0? 0.5 : 0.0), 0.0);
 	float numShades = float(uPalLightLevels & 255);
-	float shade = clamp((uLightLevel + visibility), 0.0, numShades - 1.0);
+	float shade = (1.0 - uLightLevel) * (numShades);
+	shade = clamp((shade + visibility), 0.0, numShades - 1.0);
 	
 	int palindex = int(color.r * 255.0 + 0.1); // The 0.1 is for roundoff error compensation.
 	int shadeindex = int(floor(shade));