diff --git a/Quake/gl_vidsdl.c b/Quake/gl_vidsdl.c index 3898e6848..6731e6155 100644 --- a/Quake/gl_vidsdl.c +++ b/Quake/gl_vidsdl.c @@ -221,8 +221,24 @@ void VID_SetMouseCursor (mousecursor_t cursor) // //========================================================================== +#define MIN_GAMMA 0.1f + static int fsaa; +/* +================ +VID_Gamma_f -- called when gamma changes +================ +*/ +static void VID_Gamma_f (cvar_t *var) +{ + if (var->value < MIN_GAMMA) + { + Con_SafePrintf ("%s %g is too low, clamping to %g\n", var->name, var->value, MIN_GAMMA); + Cvar_SetValueQuick (var, MIN_GAMMA); + } +} + /* ================ VID_Gamma_Init -- call on init @@ -231,6 +247,7 @@ VID_Gamma_Init -- call on init static void VID_Gamma_Init (void) { Cvar_RegisterVariable (&vid_gamma); + Cvar_SetCallback (&vid_gamma, VID_Gamma_f); Cvar_RegisterVariable (&vid_contrast); }