New cvar, vid_preservegamma. Set it to 0 to obliterate your old gamma settings when you leave FTE. This mimics the use of quake3 to reset your gamma settings should FTE crash on you. The default is to restore gamma settings to how they were when you first loaded FTE, the same as before. You can now use FTE to reset your gamma if FTE crashed and broke it. Only applies to the windows version so far.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2850 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2008-01-09 00:37:17 +00:00
parent e00f927c48
commit aeef86dc62
2 changed files with 21 additions and 0 deletions

View File

@ -344,6 +344,7 @@ cvar_t r_shadows = SCVARF ("r_shadows", "0",
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
cvar_t r_vertexdlights = SCVAR ("r_vertexdlights", "1");
cvar_t vid_preservegamma = SCVAR ("vid_preservegamma", "1");
cvar_t vid_hardwaregamma = SCVARF ("vid_hardwaregamma", "1",
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
cvar_t vid_desktopgamma = SCVARF ("vid_desktopgamma", "0",
@ -370,6 +371,7 @@ void GLRenderer_Init(void)
//screen
Cvar_Register (&gl_triplebuffer, GLRENDEREROPTIONS);
Cvar_Register (&vid_preservegamma, GLRENDEREROPTIONS);
Cvar_Register (&vid_hardwaregamma, GLRENDEREROPTIONS);
Cvar_Register (&vid_desktopgamma, GLRENDEREROPTIONS);

View File

@ -145,6 +145,7 @@ extern cvar_t _windowed_mouse;
extern cvar_t vid_hardwaregamma;
extern cvar_t vid_desktopgamma;
extern cvar_t gl_lateswap;
extern cvar_t vid_preservegamma;
int window_center_x, window_center_y, window_x, window_y, window_width, window_height;
RECT window_rect;
@ -932,6 +933,20 @@ void GL_EndRendering (void)
GL_DoSwap();
}
void OblitterateOldGamma(void)
{
int i;
if (vid_preservegamma.value)
return;
for (i = 0; i < 256; i++)
{
originalgammaramps[0][i] = (i<<8) + i;
originalgammaramps[1][i] = (i<<8) + i;
originalgammaramps[2][i] = (i<<8) + i;
}
}
void GLVID_SetPalette (unsigned char *palette)
{
qbyte *pal;
@ -1020,6 +1035,8 @@ void GLVID_Shutdown (void)
{
if (qSetDeviceGammaRamp)
{
OblitterateOldGamma();
if (vid_desktopgamma.value)
{
HDC hDC = GetDC(GetDesktopWindow());
@ -1333,6 +1350,8 @@ qboolean GLAppActivate(BOOL fActive, BOOL minimize)
if (qSetDeviceGammaRamp)
{
OblitterateOldGamma();
if (vid_desktopgamma.value)
{
HDC hDC = GetDC(GetDesktopWindow());