mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-06-01 09:32:36 +00:00
Backport Cvar callbacks to newtree. Software gamma still doesn't work in
GL, and I still don't know exactly why.
This commit is contained in:
parent
75089e506e
commit
272abade38
57 changed files with 420 additions and 447 deletions
|
@ -134,7 +134,6 @@ cvar_t *brighten;
|
|||
|
||||
extern cvar_t *scr_fov;
|
||||
|
||||
extern byte gammatable[256];
|
||||
extern qboolean lighthalf;
|
||||
|
||||
// LordHavoc: place for gl_rmain setup code
|
||||
|
@ -143,50 +142,6 @@ glrmain_init (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,
|
||||
"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]];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
R_CullBox
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue