Skip to content

Commit

Permalink
Revert "Removed "Color Depth" from q3_ui system settings, it didn't c…
Browse files Browse the repository at this point in the history
…ontrol anything."

The r_colorbits cvar still exists and gfxinfo reports it works on
Debian Jessie in both git master and building the commit where I
removed r_colorbits from q3_ui. So it does indeed control something.
Maybe I expected 16-bit color to look different? I don't know.

This reverts my commit 8e68973
from August 11 2011.
  • Loading branch information
zturtleman committed Apr 9, 2018
1 parent 3ad427c commit 43602a7
Showing 1 changed file with 68 additions and 6 deletions.
74 changes: 68 additions & 6 deletions code/q3_ui/ui_video.c
Expand Up @@ -270,6 +270,7 @@ typedef struct {
menulist_s lighting;
menulist_s allow_extensions;
menulist_s texturebits;
menulist_s colordepth;
menulist_s geometry;
menulist_s filter;
menutext_s driverinfo;
Expand All @@ -284,6 +285,7 @@ typedef struct
qboolean fullscreen;
int tq;
int lighting;
int colordepth;
int texturebits;
int geometry;
int filter;
Expand All @@ -297,22 +299,22 @@ static graphicsoptions_t s_graphicsoptions;
static InitialVideoOptions_s s_ivo_templates[] =
{
{
6, qtrue, 3, 0, 2, 2, 1, 0, qtrue
6, qtrue, 3, 0, 2, 2, 2, 1, 0, qtrue
},
{
4, qtrue, 2, 0, 2, 1, 1, 0, qtrue // JDC: this was tq 3
4, qtrue, 2, 0, 2, 2, 1, 1, 0, qtrue // JDC: this was tq 3
},
{
3, qtrue, 2, 0, 0, 1, 0, 0, qtrue
3, qtrue, 2, 0, 0, 0, 1, 0, 0, qtrue
},
{
2, qtrue, 1, 0, 0, 0, 0, 0, qtrue
2, qtrue, 1, 0, 1, 0, 0, 0, 0, qtrue
},
{
2, qtrue, 1, 1, 0, 0, 0, 0, qtrue
2, qtrue, 1, 1, 1, 0, 0, 0, 0, qtrue
},
{
3, qtrue, 1, 0, 0, 1, 0, 0, qtrue
3, qtrue, 1, 0, 0, 0, 1, 0, 0, qtrue
}
};

Expand Down Expand Up @@ -466,6 +468,7 @@ GraphicsOptions_GetInitialVideo
*/
static void GraphicsOptions_GetInitialVideo( void )
{
s_ivo.colordepth = s_graphicsoptions.colordepth.curvalue;
s_ivo.driver = s_graphicsoptions.driver.curvalue;
s_ivo.mode = s_graphicsoptions.mode.curvalue;
s_ivo.fullscreen = s_graphicsoptions.fs.curvalue;
Expand Down Expand Up @@ -517,6 +520,8 @@ static void GraphicsOptions_CheckConfig( void )

for ( i = 0; i < NUM_IVO_TEMPLATES-1; i++ )
{
if ( s_ivo_templates[i].colordepth != s_graphicsoptions.colordepth.curvalue )
continue;
if ( s_ivo_templates[i].driver != s_graphicsoptions.driver.curvalue )
continue;
if ( GraphicsOptions_FindDetectedResolution(s_ivo_templates[i].mode) != s_graphicsoptions.mode.curvalue )
Expand Down Expand Up @@ -552,12 +557,23 @@ static void GraphicsOptions_UpdateMenuItems( void )
{
s_graphicsoptions.fs.curvalue = 1;
s_graphicsoptions.fs.generic.flags |= QMF_GRAYED;
s_graphicsoptions.colordepth.curvalue = 1;
}
else
{
s_graphicsoptions.fs.generic.flags &= ~QMF_GRAYED;
}

if ( s_graphicsoptions.fs.curvalue == 0 || s_graphicsoptions.driver.curvalue == 1 )
{
s_graphicsoptions.colordepth.curvalue = 0;
s_graphicsoptions.colordepth.generic.flags |= QMF_GRAYED;
}
else
{
s_graphicsoptions.colordepth.generic.flags &= ~QMF_GRAYED;
}

if ( s_graphicsoptions.allow_extensions.curvalue == 0 )
{
if ( s_graphicsoptions.texturebits.curvalue == 0 )
Expand Down Expand Up @@ -588,6 +604,10 @@ static void GraphicsOptions_UpdateMenuItems( void )
{
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
}
if ( s_ivo.colordepth != s_graphicsoptions.colordepth.curvalue )
{
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
}
if ( s_ivo.driver != s_graphicsoptions.driver.curvalue )
{
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
Expand Down Expand Up @@ -733,6 +753,7 @@ static void GraphicsOptions_Event( void* ptr, int event ) {
resToRatio[ s_graphicsoptions.mode.curvalue ];
s_graphicsoptions.tq.curvalue = ivo->tq;
s_graphicsoptions.lighting.curvalue = ivo->lighting;
s_graphicsoptions.colordepth.curvalue = ivo->colordepth;
s_graphicsoptions.texturebits.curvalue = ivo->texturebits;
s_graphicsoptions.geometry.curvalue = ivo->geometry;
s_graphicsoptions.filter.curvalue = ivo->filter;
Expand Down Expand Up @@ -884,6 +905,29 @@ static void GraphicsOptions_SetMenuItems( void )
{
s_graphicsoptions.geometry.curvalue = 2;
}

switch ( ( int ) trap_Cvar_VariableValue( "r_colorbits" ) )
{
default:
case 0:
s_graphicsoptions.colordepth.curvalue = 0;
break;
case 16:
s_graphicsoptions.colordepth.curvalue = 1;
break;
case 32:
s_graphicsoptions.colordepth.curvalue = 2;
break;
}

if ( s_graphicsoptions.fs.curvalue == 0 )
{
s_graphicsoptions.colordepth.curvalue = 0;
}
if ( s_graphicsoptions.driver.curvalue == 1 )
{
s_graphicsoptions.colordepth.curvalue = 1;
}
}

/*
Expand Down Expand Up @@ -926,6 +970,14 @@ void GraphicsOptions_MenuInit( void )
NULL
};

static const char *colordepth_names[] =
{
"Default",
"16 bit",
"32 bit",
NULL
};

static const char *filter_names[] =
{
"Bilinear",
Expand Down Expand Up @@ -1073,6 +1125,15 @@ void GraphicsOptions_MenuInit( void )
s_graphicsoptions.mode.generic.id = ID_MODE;
y += BIGCHAR_HEIGHT+2;

// references "r_colorbits"
s_graphicsoptions.colordepth.generic.type = MTYPE_SPINCONTROL;
s_graphicsoptions.colordepth.generic.name = "Color Depth:";
s_graphicsoptions.colordepth.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
s_graphicsoptions.colordepth.generic.x = 400;
s_graphicsoptions.colordepth.generic.y = y;
s_graphicsoptions.colordepth.itemnames = colordepth_names;
y += BIGCHAR_HEIGHT+2;

// references/modifies "r_fullscreen"
s_graphicsoptions.fs.generic.type = MTYPE_SPINCONTROL;
s_graphicsoptions.fs.generic.name = "Fullscreen:";
Expand Down Expand Up @@ -1174,6 +1235,7 @@ void GraphicsOptions_MenuInit( void )
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.allow_extensions );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.ratio );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.mode );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.colordepth );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.fs );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.lighting );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.geometry );
Expand Down

0 comments on commit 43602a7

Please sign in to comment.