mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
total nukage of brighten, brightness and contrast.
This commit is contained in:
parent
a3518d44ed
commit
f21ad90ba4
14 changed files with 4 additions and 107 deletions
|
@ -33,9 +33,6 @@
|
||||||
#include "QF/mathlib.h"
|
#include "QF/mathlib.h"
|
||||||
#include "QF/cvar.h"
|
#include "QF/cvar.h"
|
||||||
|
|
||||||
extern cvar_t *brightness;
|
|
||||||
extern cvar_t *contrast;
|
|
||||||
|
|
||||||
#define INFO_CSHIFT_BONUS (1 << 0)
|
#define INFO_CSHIFT_BONUS (1 << 0)
|
||||||
#define INFO_CSHIFT_CONTENTS (1 << 1)
|
#define INFO_CSHIFT_CONTENTS (1 << 1)
|
||||||
#define INFO_CSHIFT_DAMAGE (1 << 2)
|
#define INFO_CSHIFT_DAMAGE (1 << 2)
|
||||||
|
|
|
@ -276,7 +276,6 @@ VID_Init (unsigned char *palette)
|
||||||
|
|
||||||
GL_Init ();
|
GL_Init ();
|
||||||
|
|
||||||
GL_CheckBrightness (palette);
|
|
||||||
VID_InitGamma (palette);
|
VID_InitGamma (palette);
|
||||||
VID_SetPalette (palette);
|
VID_SetPalette (palette);
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,6 @@ unsigned int d_8to24table[256];
|
||||||
unsigned char d_15to8table[65536];
|
unsigned char d_15to8table[65536];
|
||||||
|
|
||||||
cvar_t *vid_mode;
|
cvar_t *vid_mode;
|
||||||
cvar_t *brighten;
|
|
||||||
cvar_t *gl_multitexture;
|
cvar_t *gl_multitexture;
|
||||||
extern byte gammatable[256];
|
extern byte gammatable[256];
|
||||||
|
|
||||||
|
@ -87,8 +86,6 @@ QF_glColorTableEXT qglColorTableEXT = NULL;
|
||||||
qboolean is8bit = false;
|
qboolean is8bit = false;
|
||||||
|
|
||||||
cvar_t *vid_use8bit;
|
cvar_t *vid_use8bit;
|
||||||
cvar_t *brightness;
|
|
||||||
cvar_t *contrast;
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -96,8 +93,6 @@ void
|
||||||
GL_Common_Init_Cvars (void)
|
GL_Common_Init_Cvars (void)
|
||||||
{
|
{
|
||||||
vid_use8bit = Cvar_Get ("vid_use8bit", "0", CVAR_ROM, NULL, "Use 8-bit shared palettes.");
|
vid_use8bit = Cvar_Get ("vid_use8bit", "0", CVAR_ROM, NULL, "Use 8-bit shared palettes.");
|
||||||
brightness = Cvar_Get ("brightness", "1", CVAR_ARCHIVE, NULL, "Brightness level");
|
|
||||||
contrast = Cvar_Get ("contrast", "1", CVAR_ARCHIVE, NULL, "Contrast level");
|
|
||||||
gl_multitexture = Cvar_Get ("gl_multitexture", "0", CVAR_ARCHIVE, NULL, "Use multitexture when available");
|
gl_multitexture = Cvar_Get ("gl_multitexture", "0", CVAR_ARCHIVE, NULL, "Use multitexture when available");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,50 +374,6 @@ VID_Init8bitPalette (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
GL_CheckBrightness
|
|
||||||
|
|
||||||
This is something like the brightness cvar, except it hacks the palette
|
|
||||||
directly instead of brightening the screen afterward.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
GL_CheckBrightness (unsigned char *pal)
|
|
||||||
{
|
|
||||||
int i, inf;
|
|
||||||
float brightness;
|
|
||||||
|
|
||||||
brighten = Cvar_Get ("brighten", "1", CVAR_NONE, NULL,
|
|
||||||
"Palette hack equivalent to brightness");
|
|
||||||
|
|
||||||
if ((i = COM_CheckParm ("-brighten"))) {
|
|
||||||
brightness = atof (com_argv[i + 1]);
|
|
||||||
} else {
|
|
||||||
brightness = brighten->value;
|
|
||||||
}
|
|
||||||
brightness = bound (1, brightness, 5);
|
|
||||||
|
|
||||||
Cvar_SetValue (brighten, brightness);
|
|
||||||
Cvar_SetFlags (brighten, brighten->flags | CVAR_ROM);
|
|
||||||
|
|
||||||
// Build gamma table
|
|
||||||
if (brightness == 1.0) { // screw the math
|
|
||||||
for (i = 0; i < 256; i++) {
|
|
||||||
gammatable[i] = i;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (i = 0; i < 256; i++) { // brighten up the palette
|
|
||||||
inf = (i * brightness);
|
|
||||||
inf = bound (0, inf, 255);
|
|
||||||
gammatable[i] = inf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// correct the palette
|
|
||||||
for (i = 0; i < 768; i++) {
|
|
||||||
pal[i] = gammatable[pal[i]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
VID_LockBuffer (void)
|
VID_LockBuffer (void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -230,7 +230,6 @@ VID_Init (unsigned char *palette)
|
||||||
|
|
||||||
VID_SDL_GammaCheck ();
|
VID_SDL_GammaCheck ();
|
||||||
|
|
||||||
GL_CheckBrightness (palette);
|
|
||||||
VID_InitGamma (palette);
|
VID_InitGamma (palette);
|
||||||
VID_SetPalette (palette);
|
VID_SetPalette (palette);
|
||||||
|
|
||||||
|
|
|
@ -1383,7 +1383,6 @@ VID_Init (unsigned char *palette)
|
||||||
DestroyWindow (hwnd_dialog);
|
DestroyWindow (hwnd_dialog);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GL_CheckBrightness (palette);
|
|
||||||
VID_InitGamma (palette);
|
VID_InitGamma (palette);
|
||||||
VID_SetPalette (palette);
|
VID_SetPalette (palette);
|
||||||
|
|
||||||
|
|
|
@ -807,7 +807,6 @@ int oldviewsize = 0;
|
||||||
unsigned char lighthalf_v[3];
|
unsigned char lighthalf_v[3];
|
||||||
qboolean lighthalf;
|
qboolean lighthalf;
|
||||||
extern cvar_t *gl_lightmode;
|
extern cvar_t *gl_lightmode;
|
||||||
extern cvar_t *brightness;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SCR_UpdateScreen
|
SCR_UpdateScreen
|
||||||
|
@ -890,16 +889,13 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// LordHavoc: adjustable brightness and contrast,
|
|
||||||
// also makes polyblend apply to whole screen
|
// also makes polyblend apply to whole screen
|
||||||
glDisable (GL_TEXTURE_2D);
|
glDisable (GL_TEXTURE_2D);
|
||||||
|
|
||||||
Cvar_SetValue (brightness, bound (1, brightness->value, 5));
|
|
||||||
if (lighthalf) { // LordHavoc: render was done at half brightness
|
if (lighthalf) { // LordHavoc: render was done at half brightness
|
||||||
f = brightness->value * 2;
|
f = 2;
|
||||||
} else {
|
} else {
|
||||||
Cvar_SetValue (brightness, bound (1, brightness->value, 5));
|
f = 1;
|
||||||
f = brightness->value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f >= 1.002) { // Make sure we don't get bit by roundoff errors
|
if (f >= 1.002) { // Make sure we don't get bit by roundoff errors
|
||||||
|
|
|
@ -264,16 +264,10 @@ R_DrawSkyDome (void)
|
||||||
void
|
void
|
||||||
R_DrawSky (void)
|
R_DrawSky (void)
|
||||||
{
|
{
|
||||||
float l = 1 / (256 * brightness->value);
|
|
||||||
|
|
||||||
glColor3f (lighthalf_v[0] * l, lighthalf_v[1] * l, lighthalf_v[2] * l);
|
|
||||||
|
|
||||||
if (skyloaded)
|
if (skyloaded)
|
||||||
R_DrawSkyBox ();
|
R_DrawSkyBox ();
|
||||||
else
|
else
|
||||||
R_DrawSkyDome ();
|
R_DrawSkyDome ();
|
||||||
|
|
||||||
glColor3ubv (lighthalf_v);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -673,9 +673,7 @@ void
|
||||||
R_DrawSkyChain (msurface_t *sky_chain)
|
R_DrawSkyChain (msurface_t *sky_chain)
|
||||||
{
|
{
|
||||||
msurface_t *sc = sky_chain;
|
msurface_t *sc = sky_chain;
|
||||||
float l = 1 / (256 * brightness->value);
|
|
||||||
|
|
||||||
glColor3f (lighthalf_v[0] * l, lighthalf_v[1] * l, lighthalf_v[2] * l);
|
|
||||||
if (skyloaded) {
|
if (skyloaded) {
|
||||||
glDepthRange (gldepthmax, gldepthmax);
|
glDepthRange (gldepthmax, gldepthmax);
|
||||||
while (sc) {
|
while (sc) {
|
||||||
|
|
|
@ -83,15 +83,6 @@ V_CalcBlend (void)
|
||||||
a = 1.0 - a3;
|
a = 1.0 - a3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((a2 = 1 - bound (0.0, contrast->value, 1.0)) < 0.999) { // add contrast
|
|
||||||
r += (128 - r) * a2;
|
|
||||||
g += (128 - g) * a2;
|
|
||||||
b += (128 - b) * a2;
|
|
||||||
|
|
||||||
a3 = (1.0 - a) * (1.0 - a2);
|
|
||||||
a = 1.0 - a3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// LordHavoc: saturate color
|
// LordHavoc: saturate color
|
||||||
if (a) {
|
if (a) {
|
||||||
a2 = 1.0 / a;
|
a2 = 1.0 / a;
|
||||||
|
|
|
@ -83,9 +83,6 @@ cvar_t *v_kicktime;
|
||||||
cvar_t *v_kickroll;
|
cvar_t *v_kickroll;
|
||||||
cvar_t *v_kickpitch;
|
cvar_t *v_kickpitch;
|
||||||
|
|
||||||
cvar_t *brightness;
|
|
||||||
cvar_t *contrast;
|
|
||||||
|
|
||||||
float v_dmg_time, v_dmg_roll, v_dmg_pitch;
|
float v_dmg_time, v_dmg_roll, v_dmg_pitch;
|
||||||
|
|
||||||
extern cvar_t *vid_gamma;
|
extern cvar_t *vid_gamma;
|
||||||
|
@ -757,7 +754,4 @@ V_Init_Cvars (void)
|
||||||
"How much you lean when hit");
|
"How much you lean when hit");
|
||||||
v_kickpitch = Cvar_Get ("v_kickpitch", "0.6", CVAR_NONE, NULL,
|
v_kickpitch = Cvar_Get ("v_kickpitch", "0.6", CVAR_NONE, NULL,
|
||||||
"How much you look up when hit");
|
"How much you look up when hit");
|
||||||
|
|
||||||
brightness = Cvar_Get ("brightness", "1", CVAR_ARCHIVE, NULL, "None");
|
|
||||||
contrast = Cvar_Get ("contrast", "1", CVAR_ARCHIVE, NULL, "None");
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -807,7 +807,6 @@ int oldviewsize = 0;
|
||||||
unsigned char lighthalf_v[3];
|
unsigned char lighthalf_v[3];
|
||||||
qboolean lighthalf;
|
qboolean lighthalf;
|
||||||
extern cvar_t *gl_lightmode;
|
extern cvar_t *gl_lightmode;
|
||||||
extern cvar_t *brightness;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SCR_UpdateScreen
|
SCR_UpdateScreen
|
||||||
|
@ -890,16 +889,13 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// LordHavoc: adjustable brightness and contrast,
|
|
||||||
// also makes polyblend apply to whole screen
|
// also makes polyblend apply to whole screen
|
||||||
glDisable (GL_TEXTURE_2D);
|
glDisable (GL_TEXTURE_2D);
|
||||||
|
|
||||||
Cvar_SetValue (brightness, bound (1, brightness->value, 5));
|
|
||||||
if (lighthalf) { // LordHavoc: render was done at half brightness
|
if (lighthalf) { // LordHavoc: render was done at half brightness
|
||||||
f = brightness->value * 2;
|
f = 2;
|
||||||
} else {
|
} else {
|
||||||
Cvar_SetValue (brightness, bound (1, brightness->value, 5));
|
f = 1;
|
||||||
f = brightness->value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f >= 1.002) { // Make sure we don't get bit by roundoff errors
|
if (f >= 1.002) { // Make sure we don't get bit by roundoff errors
|
||||||
|
|
|
@ -264,16 +264,10 @@ R_DrawSkyDome (void)
|
||||||
void
|
void
|
||||||
R_DrawSky (void)
|
R_DrawSky (void)
|
||||||
{
|
{
|
||||||
float l = 1 / (256 * brightness->value);
|
|
||||||
|
|
||||||
glColor3f (lighthalf_v[0] * l, lighthalf_v[1] * l, lighthalf_v[2] * l);
|
|
||||||
|
|
||||||
if (skyloaded)
|
if (skyloaded)
|
||||||
R_DrawSkyBox ();
|
R_DrawSkyBox ();
|
||||||
else
|
else
|
||||||
R_DrawSkyDome ();
|
R_DrawSkyDome ();
|
||||||
|
|
||||||
glColor3ubv (lighthalf_v);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -673,9 +673,7 @@ void
|
||||||
R_DrawSkyChain (msurface_t *sky_chain)
|
R_DrawSkyChain (msurface_t *sky_chain)
|
||||||
{
|
{
|
||||||
msurface_t *sc = sky_chain;
|
msurface_t *sc = sky_chain;
|
||||||
float l = 1 / (256 * brightness->value);
|
|
||||||
|
|
||||||
glColor3f (lighthalf_v[0] * l, lighthalf_v[1] * l, lighthalf_v[2] * l);
|
|
||||||
if (skyloaded) {
|
if (skyloaded) {
|
||||||
glDepthRange (gldepthmax, gldepthmax);
|
glDepthRange (gldepthmax, gldepthmax);
|
||||||
while (sc) {
|
while (sc) {
|
||||||
|
|
|
@ -84,15 +84,6 @@ V_CalcBlend (void)
|
||||||
a = 1.0 - a3;
|
a = 1.0 - a3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((a2 = 1 - bound (0.0, contrast->value, 1.0)) < 0.999) { // add contrast
|
|
||||||
r += (128 - r) * a2;
|
|
||||||
g += (128 - g) * a2;
|
|
||||||
b += (128 - b) * a2;
|
|
||||||
|
|
||||||
a3 = (1.0 - a) * (1.0 - a2);
|
|
||||||
a = 1.0 - a3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// LordHavoc: saturate color
|
// LordHavoc: saturate color
|
||||||
if (a) {
|
if (a) {
|
||||||
a2 = 1.0 / a;
|
a2 = 1.0 / a;
|
||||||
|
|
Loading…
Reference in a new issue