treat gl_lightmode as an int_val, epsilon checks on brightness/contrast

This commit is contained in:
Forest Hale 2000-10-06 23:50:12 +00:00
parent 4e1ea06a0d
commit 903fc1583e

View file

@ -1076,14 +1076,13 @@ void SCR_UpdateScreen (void)
// //
// LordHavoc: set lighthalf based on gl_lightmode cvar // LordHavoc: set lighthalf based on gl_lightmode cvar
if (lighthalf != (gl_lightmode->value != 0)) if (lighthalf != gl_lightmode->int_val)
{ {
lighthalf = gl_lightmode->value != 0; lighthalf = gl_lightmode->int_val;
if (lighthalf) { if (lighthalf)
lighthalf_v[0] = lighthalf_v[1] = lighthalf_v[2] = 128; lighthalf_v[0] = lighthalf_v[1] = lighthalf_v[2] = 128;
} else { else
lighthalf_v[0] = lighthalf_v[1] = lighthalf_v[2] = 255; lighthalf_v[0] = lighthalf_v[1] = lighthalf_v[2] = 255;
}
R_ForceLightUpdate(); R_ForceLightUpdate();
} }
@ -1128,11 +1127,11 @@ void SCR_UpdateScreen (void)
f = brightness->value * 2; f = brightness->value * 2;
else else
f = brightness->value; f = brightness->value;
if (f > 1) if (f >= 1.005) // epsilon
{ {
glBlendFunc (GL_DST_COLOR, GL_ONE); glBlendFunc (GL_DST_COLOR, GL_ONE);
glBegin (GL_QUADS); glBegin (GL_QUADS);
while (f > 1) while (f >= 1.005) // epsilon
{ {
if (f >= 2) if (f >= 2)
glColor3f (1, 1, 1); glColor3f (1, 1, 1);
@ -1149,10 +1148,11 @@ void SCR_UpdateScreen (void)
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
} }
Cvar_SetValue (contrast, bound (0.1, contrast->value, 1)); Cvar_SetValue (contrast, bound (0.1, contrast->value, 1));
if ((gl_polyblend->value && v_blend[3]) || contrast->value < 1) if ((gl_polyblend->value && v_blend[3]) || contrast->value < 0.999) // epsilon
{ {
glBegin (GL_QUADS); glBegin (GL_QUADS);
if (contrast->value < 1) { if (contrast->value < 0.999) // epsilon
{
glColor4f (1, 1, 1, (1 - contrast->value)); glColor4f (1, 1, 1, (1 - contrast->value));
glVertex2f (0,0); glVertex2f (0,0);
glVertex2f (vid.width, 0); glVertex2f (vid.width, 0);
@ -1160,7 +1160,8 @@ void SCR_UpdateScreen (void)
glVertex2f (0, vid.height); glVertex2f (0, vid.height);
} }
if (gl_polyblend->value && v_blend[3]) { if (gl_polyblend->value && v_blend[3])
{
glColor4fv (v_blend); glColor4fv (v_blend);
glVertex2f (0,0); glVertex2f (0,0);
glVertex2f (vid.width, 0); glVertex2f (vid.width, 0);