mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-25 05:21:58 +00:00
vid_gamma now seems to work :)
This commit is contained in:
parent
bd06625c55
commit
6a75c4e00d
12 changed files with 19 additions and 37 deletions
|
@ -114,4 +114,6 @@ double VID_GetGamma (void);
|
||||||
qboolean VID_SetGamma (double);
|
qboolean VID_SetGamma (double);
|
||||||
void VID_UpdateGamma (struct cvar_s *);
|
void VID_UpdateGamma (struct cvar_s *);
|
||||||
|
|
||||||
|
extern struct cvar_s *vid_gamma;
|
||||||
|
|
||||||
#endif // __vid_h_
|
#endif // __vid_h_
|
||||||
|
|
|
@ -273,7 +273,10 @@ V_CheckGamma (void)
|
||||||
{
|
{
|
||||||
static float oldbrightness;
|
static float oldbrightness;
|
||||||
static float oldcontrast;
|
static float oldcontrast;
|
||||||
|
static float oldgamma;
|
||||||
|
|
||||||
|
if (oldgamma != vid_gamma->value)
|
||||||
|
VID_UpdateGamma (vid_gamma);
|
||||||
if ((brightness->value == oldbrightness) && contrast->value == oldcontrast)
|
if ((brightness->value == oldbrightness) && contrast->value == oldcontrast)
|
||||||
return false;
|
return false;
|
||||||
oldbrightness = brightness->value;
|
oldbrightness = brightness->value;
|
||||||
|
|
|
@ -275,6 +275,7 @@ VID_Init (unsigned char *palette)
|
||||||
GL_Init ();
|
GL_Init ();
|
||||||
|
|
||||||
GL_CheckBrightness (palette);
|
GL_CheckBrightness (palette);
|
||||||
|
VID_InitGamma (palette);
|
||||||
VID_SetPalette (palette);
|
VID_SetPalette (palette);
|
||||||
|
|
||||||
// Check for 3DFX Extensions and initialize them.
|
// Check for 3DFX Extensions and initialize them.
|
||||||
|
|
|
@ -617,6 +617,7 @@ VID_Init (unsigned char *palette)
|
||||||
VID_SetMode (current_mode.name, palette);
|
VID_SetMode (current_mode.name, palette);
|
||||||
Con_CheckResize (); // Now that we have a window size, fix console
|
Con_CheckResize (); // Now that we have a window size, fix console
|
||||||
|
|
||||||
|
VID_InitGamma (palette);
|
||||||
VID_SetPalette (palette);
|
VID_SetPalette (palette);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,6 +354,7 @@ VID_Init (unsigned char *pal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VID_InitGamma (palette);
|
||||||
VID_SetPalette (pal);
|
VID_SetPalette (pal);
|
||||||
|
|
||||||
usedbuf = havedbuf = 0;
|
usedbuf = havedbuf = 0;
|
||||||
|
|
|
@ -204,6 +204,7 @@ VID_Init (unsigned char *palette)
|
||||||
GL_Init ();
|
GL_Init ();
|
||||||
|
|
||||||
GL_CheckBrightness (palette);
|
GL_CheckBrightness (palette);
|
||||||
|
VID_InitGamma (palette);
|
||||||
VID_SetPalette (palette);
|
VID_SetPalette (palette);
|
||||||
|
|
||||||
// Check for 8-bit extension and initialize if present
|
// Check for 8-bit extension and initialize if present
|
||||||
|
|
|
@ -2062,6 +2062,7 @@ VID_Init (unsigned char *palette)
|
||||||
|
|
||||||
vid_realmode = vid_modenum;
|
vid_realmode = vid_modenum;
|
||||||
|
|
||||||
|
VID_InitGamma (palette);
|
||||||
VID_SetPalette (palette);
|
VID_SetPalette (palette);
|
||||||
|
|
||||||
vid_menudrawfn = VID_MenuDraw;
|
vid_menudrawfn = VID_MenuDraw;
|
||||||
|
|
|
@ -157,6 +157,7 @@ VID_Init (unsigned char *palette)
|
||||||
// Initialize display
|
// Initialize display
|
||||||
if (!(screen = SDL_SetVideoMode (vid.width, vid.height, 8, flags)))
|
if (!(screen = SDL_SetVideoMode (vid.width, vid.height, 8, flags)))
|
||||||
Sys_Error ("VID: Couldn't set video mode: %s\n", SDL_GetError ());
|
Sys_Error ("VID: Couldn't set video mode: %s\n", SDL_GetError ());
|
||||||
|
VID_InitGamma (palette);
|
||||||
VID_SetPalette (palette);
|
VID_SetPalette (palette);
|
||||||
VID_SetCaption ("");
|
VID_SetCaption ("");
|
||||||
|
|
||||||
|
|
|
@ -201,6 +201,7 @@ VID_Init (unsigned char *palette)
|
||||||
GL_Init ();
|
GL_Init ();
|
||||||
|
|
||||||
GL_CheckBrightness (palette);
|
GL_CheckBrightness (palette);
|
||||||
|
VID_InitGamma (palette);
|
||||||
VID_SetPalette (palette);
|
VID_SetPalette (palette);
|
||||||
|
|
||||||
// Check for 3DFX Extensions and initialize them.
|
// Check for 3DFX Extensions and initialize them.
|
||||||
|
|
|
@ -602,6 +602,7 @@ VID_Init (unsigned char *palette)
|
||||||
VID_SetMode (current_mode, palette);
|
VID_SetMode (current_mode, palette);
|
||||||
Con_CheckResize (); // Now that we have a window size, fix console
|
Con_CheckResize (); // Now that we have a window size, fix console
|
||||||
|
|
||||||
|
VID_InitGamma (palette);
|
||||||
VID_SetPalette (palette);
|
VID_SetPalette (palette);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1613,6 +1613,7 @@ VID_Init (unsigned char *palette)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GL_CheckBrightness (palette);
|
GL_CheckBrightness (palette);
|
||||||
|
VID_InitGamma (palette);
|
||||||
VID_SetPalette (palette);
|
VID_SetPalette (palette);
|
||||||
|
|
||||||
VID_SetMode (vid_default, palette);
|
VID_SetMode (vid_default, palette);
|
||||||
|
|
|
@ -302,38 +302,6 @@ D_EndDirectRect (int x, int y, int width, int height)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
VID_Gamma_f
|
|
||||||
|
|
||||||
Keybinding command
|
|
||||||
*/
|
|
||||||
|
|
||||||
byte vid_gamma[256];
|
|
||||||
|
|
||||||
void
|
|
||||||
VID_Gamma_f (void)
|
|
||||||
{
|
|
||||||
|
|
||||||
float g, f, inf;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (Cmd_Argc () == 2) {
|
|
||||||
g = atof (Cmd_Argv (1));
|
|
||||||
|
|
||||||
for (i = 0; i < 255; i++) {
|
|
||||||
f = pow ((i + 1) / 256.0, g);
|
|
||||||
inf = f * 255 + 0.5;
|
|
||||||
inf = bound (0, inf, 255);
|
|
||||||
vid_gamma[i] = inf;
|
|
||||||
}
|
|
||||||
|
|
||||||
VID_SetPalette (current_palette);
|
|
||||||
|
|
||||||
vid.recalc_refdef = 1; // force a surface cache flush
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ResetFrameBuffer (void)
|
ResetFrameBuffer (void)
|
||||||
{
|
{
|
||||||
|
@ -501,8 +469,6 @@ VID_Init (unsigned char *palette)
|
||||||
|
|
||||||
// plugin_load ("in_x11.so");
|
// plugin_load ("in_x11.so");
|
||||||
// Cmd_AddCommand ("gamma", VID_Gamma_f, "Change brightness level");
|
// Cmd_AddCommand ("gamma", VID_Gamma_f, "Change brightness level");
|
||||||
for (i = 0; i < 256; i++)
|
|
||||||
vid_gamma[i] = i;
|
|
||||||
|
|
||||||
vid.width = vid_width->int_val;
|
vid.width = vid_width->int_val;
|
||||||
vid.height = vid_height->int_val;
|
vid.height = vid_height->int_val;
|
||||||
|
@ -575,6 +541,8 @@ VID_Init (unsigned char *palette)
|
||||||
/* Invisible cursor */
|
/* Invisible cursor */
|
||||||
X11_CreateNullCursor ();
|
X11_CreateNullCursor ();
|
||||||
|
|
||||||
|
VID_InitGamma (palette);
|
||||||
|
VID_SetPalette (palette);
|
||||||
if (x_visinfo->depth == 8) {
|
if (x_visinfo->depth == 8) {
|
||||||
/* Create and upload the palette */
|
/* Create and upload the palette */
|
||||||
if (x_visinfo->class == PseudoColor) {
|
if (x_visinfo->class == PseudoColor) {
|
||||||
|
@ -677,9 +645,9 @@ VID_SetPalette (unsigned char *palette)
|
||||||
for (i = 0; i < 256; i++) {
|
for (i = 0; i < 256; i++) {
|
||||||
colors[i].pixel = i;
|
colors[i].pixel = i;
|
||||||
colors[i].flags = DoRed | DoGreen | DoBlue;
|
colors[i].flags = DoRed | DoGreen | DoBlue;
|
||||||
colors[i].red = vid_gamma[palette[i * 3]] * 256;
|
colors[i].red = gammatable[palette[i * 3]] * 256;
|
||||||
colors[i].green = vid_gamma[palette[i * 3 + 1]] * 256;
|
colors[i].green = gammatable[palette[i * 3 + 1]] * 256;
|
||||||
colors[i].blue = vid_gamma[palette[i * 3 + 2]] * 256;
|
colors[i].blue = gammatable[palette[i * 3 + 2]] * 256;
|
||||||
}
|
}
|
||||||
XStoreColors (x_disp, x_cmap, colors, 256);
|
XStoreColors (x_disp, x_cmap, colors, 256);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue