Revert "Removed "Color Depth" from q3_ui system settings, it didn't control 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 8e689739f4
from August 11 2011.
This commit is contained in:
Zack Middleton 2018-04-09 15:39:36 -05:00
parent 3ad427c68d
commit 43602a7eb8
1 changed files with 68 additions and 6 deletions

View File

@ -270,6 +270,7 @@ typedef struct {
menulist_s lighting; menulist_s lighting;
menulist_s allow_extensions; menulist_s allow_extensions;
menulist_s texturebits; menulist_s texturebits;
menulist_s colordepth;
menulist_s geometry; menulist_s geometry;
menulist_s filter; menulist_s filter;
menutext_s driverinfo; menutext_s driverinfo;
@ -284,6 +285,7 @@ typedef struct
qboolean fullscreen; qboolean fullscreen;
int tq; int tq;
int lighting; int lighting;
int colordepth;
int texturebits; int texturebits;
int geometry; int geometry;
int filter; int filter;
@ -297,22 +299,22 @@ static graphicsoptions_t s_graphicsoptions;
static InitialVideoOptions_s s_ivo_templates[] = 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
} }
}; };
@ -466,6 +468,7 @@ GraphicsOptions_GetInitialVideo
*/ */
static void GraphicsOptions_GetInitialVideo( void ) static void GraphicsOptions_GetInitialVideo( void )
{ {
s_ivo.colordepth = s_graphicsoptions.colordepth.curvalue;
s_ivo.driver = s_graphicsoptions.driver.curvalue; s_ivo.driver = s_graphicsoptions.driver.curvalue;
s_ivo.mode = s_graphicsoptions.mode.curvalue; s_ivo.mode = s_graphicsoptions.mode.curvalue;
s_ivo.fullscreen = s_graphicsoptions.fs.curvalue; s_ivo.fullscreen = s_graphicsoptions.fs.curvalue;
@ -517,6 +520,8 @@ static void GraphicsOptions_CheckConfig( void )
for ( i = 0; i < NUM_IVO_TEMPLATES-1; i++ ) 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 ) if ( s_ivo_templates[i].driver != s_graphicsoptions.driver.curvalue )
continue; continue;
if ( GraphicsOptions_FindDetectedResolution(s_ivo_templates[i].mode) != s_graphicsoptions.mode.curvalue ) if ( GraphicsOptions_FindDetectedResolution(s_ivo_templates[i].mode) != s_graphicsoptions.mode.curvalue )
@ -552,12 +557,23 @@ static void GraphicsOptions_UpdateMenuItems( void )
{ {
s_graphicsoptions.fs.curvalue = 1; s_graphicsoptions.fs.curvalue = 1;
s_graphicsoptions.fs.generic.flags |= QMF_GRAYED; s_graphicsoptions.fs.generic.flags |= QMF_GRAYED;
s_graphicsoptions.colordepth.curvalue = 1;
} }
else else
{ {
s_graphicsoptions.fs.generic.flags &= ~QMF_GRAYED; 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.allow_extensions.curvalue == 0 )
{ {
if ( s_graphicsoptions.texturebits.curvalue == 0 ) if ( s_graphicsoptions.texturebits.curvalue == 0 )
@ -588,6 +604,10 @@ static void GraphicsOptions_UpdateMenuItems( void )
{ {
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE); 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 ) if ( s_ivo.driver != s_graphicsoptions.driver.curvalue )
{ {
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE); s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
@ -733,6 +753,7 @@ static void GraphicsOptions_Event( void* ptr, int event ) {
resToRatio[ s_graphicsoptions.mode.curvalue ]; resToRatio[ s_graphicsoptions.mode.curvalue ];
s_graphicsoptions.tq.curvalue = ivo->tq; s_graphicsoptions.tq.curvalue = ivo->tq;
s_graphicsoptions.lighting.curvalue = ivo->lighting; s_graphicsoptions.lighting.curvalue = ivo->lighting;
s_graphicsoptions.colordepth.curvalue = ivo->colordepth;
s_graphicsoptions.texturebits.curvalue = ivo->texturebits; s_graphicsoptions.texturebits.curvalue = ivo->texturebits;
s_graphicsoptions.geometry.curvalue = ivo->geometry; s_graphicsoptions.geometry.curvalue = ivo->geometry;
s_graphicsoptions.filter.curvalue = ivo->filter; s_graphicsoptions.filter.curvalue = ivo->filter;
@ -884,6 +905,29 @@ static void GraphicsOptions_SetMenuItems( void )
{ {
s_graphicsoptions.geometry.curvalue = 2; 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;
}
} }
/* /*
@ -926,6 +970,14 @@ void GraphicsOptions_MenuInit( void )
NULL NULL
}; };
static const char *colordepth_names[] =
{
"Default",
"16 bit",
"32 bit",
NULL
};
static const char *filter_names[] = static const char *filter_names[] =
{ {
"Bilinear", "Bilinear",
@ -1073,6 +1125,15 @@ void GraphicsOptions_MenuInit( void )
s_graphicsoptions.mode.generic.id = ID_MODE; s_graphicsoptions.mode.generic.id = ID_MODE;
y += BIGCHAR_HEIGHT+2; 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" // references/modifies "r_fullscreen"
s_graphicsoptions.fs.generic.type = MTYPE_SPINCONTROL; s_graphicsoptions.fs.generic.type = MTYPE_SPINCONTROL;
s_graphicsoptions.fs.generic.name = "Fullscreen:"; s_graphicsoptions.fs.generic.name = "Fullscreen:";
@ -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.allow_extensions );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.ratio ); 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.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.fs );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.lighting ); Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.lighting );
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.geometry ); Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.geometry );