Not tested and probably still not working correctly, the entire feature was a nearly impenetrable mess of convoluted code. This definitely needs verification with multiple mods using it.
Not only is this a deprecated feature - it also does not work right when complex lighting is at play, it must be done in the shader to get proper results.
For Duke Nukem and its direct offspring (Nam, WW2GI and Redneck Rampage) the ramp is not a linear fade from 0 to 1, it needs to be a little darker than that.
Unfortunately the proper factor needed here must be set manually, this cannot really be calculated from the lookup tables.
The only compatibility mode feature left is the main drawer function using glBegin/glEnd but changing that is not as urgent as the rest.
This also cleans up the fog application and adds the exponential fog mode again that somehow got lost over time.
The builtin matrices are no longer available in modern GLSL, preventing an upgrade of the shader.
Also perform better reporting of shader compilation errors.