2
===========================================================================
3
Copyright (C) 1999-2005 Id Software, Inc.
5
This file is part of Quake III Arena source code.
7
Quake III Arena source code is free software; you can redistribute it
8
and/or modify it under the terms of the GNU General Public License as
9
published by the Free Software Foundation; either version 2 of the License,
10
or (at your option) any later version.
12
Quake III Arena source code is distributed in the hope that it will be
13
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with Quake III Arena source code; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
===========================================================================
25
void GraphicsOptions_MenuInit( void );
28
=======================================================================
30
DRIVER INFORMATION MENU
32
=======================================================================
36
#define DRIVERINFO_FRAMEL "menu/art/frame2_l"
37
#define DRIVERINFO_FRAMER "menu/art/frame1_r"
38
#define DRIVERINFO_BACK0 "menu/art/back_0"
39
#define DRIVERINFO_BACK1 "menu/art/back_1"
41
static char* driverinfo_artlist[] =
50
#define ID_DRIVERINFOBACK 100
59
char stringbuff[1024];
64
static driverinfo_t s_driverinfo;
71
static void DriverInfo_Event( void* ptr, int event )
73
if (event != QM_ACTIVATED)
76
switch (((menucommon_s*)ptr)->id)
78
case ID_DRIVERINFOBACK:
89
static void DriverInfo_MenuDraw( void )
94
Menu_Draw( &s_driverinfo.menu );
96
UI_DrawString( 320, 80, "VENDOR", UI_CENTER|UI_SMALLFONT, color_red );
97
UI_DrawString( 320, 152, "PIXELFORMAT", UI_CENTER|UI_SMALLFONT, color_red );
98
UI_DrawString( 320, 192, "EXTENSIONS", UI_CENTER|UI_SMALLFONT, color_red );
100
UI_DrawString( 320, 80+16, uis.glconfig.vendor_string, UI_CENTER|UI_SMALLFONT, text_color_normal );
101
UI_DrawString( 320, 96+16, uis.glconfig.version_string, UI_CENTER|UI_SMALLFONT, text_color_normal );
102
UI_DrawString( 320, 112+16, uis.glconfig.renderer_string, UI_CENTER|UI_SMALLFONT, text_color_normal );
103
UI_DrawString( 320, 152+16, va ("color(%d-bits) Z(%d-bits) stencil(%d-bits)", uis.glconfig.colorBits, uis.glconfig.depthBits, uis.glconfig.stencilBits), UI_CENTER|UI_SMALLFONT, text_color_normal );
107
for (i=0; i<s_driverinfo.numstrings/2; i++) {
108
UI_DrawString( 320-4, y, s_driverinfo.strings[i*2], UI_RIGHT|UI_SMALLFONT, text_color_normal );
109
UI_DrawString( 320+4, y, s_driverinfo.strings[i*2+1], UI_LEFT|UI_SMALLFONT, text_color_normal );
110
y += SMALLCHAR_HEIGHT;
113
if (s_driverinfo.numstrings & 1)
114
UI_DrawString( 320, y, s_driverinfo.strings[s_driverinfo.numstrings-1], UI_CENTER|UI_SMALLFONT, text_color_normal );
122
void DriverInfo_Cache( void )
126
// touch all our pics
129
if (!driverinfo_artlist[i])
131
trap_R_RegisterShaderNoMip(driverinfo_artlist[i]);
140
static void UI_DriverInfo_Menu( void )
146
// zero set all our globals
147
memset( &s_driverinfo, 0 ,sizeof(driverinfo_t) );
151
s_driverinfo.menu.fullscreen = qtrue;
152
s_driverinfo.menu.draw = DriverInfo_MenuDraw;
154
s_driverinfo.banner.generic.type = MTYPE_BTEXT;
155
s_driverinfo.banner.generic.x = 320;
156
s_driverinfo.banner.generic.y = 16;
157
s_driverinfo.banner.string = "DRIVER INFO";
158
s_driverinfo.banner.color = color_white;
159
s_driverinfo.banner.style = UI_CENTER;
161
s_driverinfo.framel.generic.type = MTYPE_BITMAP;
162
s_driverinfo.framel.generic.name = DRIVERINFO_FRAMEL;
163
s_driverinfo.framel.generic.flags = QMF_INACTIVE;
164
s_driverinfo.framel.generic.x = 0;
165
s_driverinfo.framel.generic.y = 78;
166
s_driverinfo.framel.width = 256;
167
s_driverinfo.framel.height = 329;
169
s_driverinfo.framer.generic.type = MTYPE_BITMAP;
170
s_driverinfo.framer.generic.name = DRIVERINFO_FRAMER;
171
s_driverinfo.framer.generic.flags = QMF_INACTIVE;
172
s_driverinfo.framer.generic.x = 376;
173
s_driverinfo.framer.generic.y = 76;
174
s_driverinfo.framer.width = 256;
175
s_driverinfo.framer.height = 334;
177
s_driverinfo.back.generic.type = MTYPE_BITMAP;
178
s_driverinfo.back.generic.name = DRIVERINFO_BACK0;
179
s_driverinfo.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
180
s_driverinfo.back.generic.callback = DriverInfo_Event;
181
s_driverinfo.back.generic.id = ID_DRIVERINFOBACK;
182
s_driverinfo.back.generic.x = 0;
183
s_driverinfo.back.generic.y = 480-64;
184
s_driverinfo.back.width = 128;
185
s_driverinfo.back.height = 64;
186
s_driverinfo.back.focuspic = DRIVERINFO_BACK1;
188
// TTimo: overflow with particularly long GL extensions (such as the gf3)
189
// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=399
190
// NOTE: could have pushed the size of stringbuff, but the list is already out of the screen
191
// (no matter what your resolution)
192
Q_strncpyz(s_driverinfo.stringbuff, uis.glconfig.extensions_string, 1024);
194
// build null terminated extension strings
195
eptr = s_driverinfo.stringbuff;
196
while ( s_driverinfo.numstrings<40 && *eptr )
198
while ( *eptr && *eptr == ' ' )
201
// track start of valid string
202
if (*eptr && *eptr != ' ')
203
s_driverinfo.strings[s_driverinfo.numstrings++] = eptr;
205
while ( *eptr && *eptr != ' ' )
209
// safety length strings for display
210
for (i=0; i<s_driverinfo.numstrings; i++) {
211
len = strlen(s_driverinfo.strings[i]);
213
s_driverinfo.strings[i][len-1] = '>';
214
s_driverinfo.strings[i][len] = '\0';
218
Menu_AddItem( &s_driverinfo.menu, &s_driverinfo.banner );
219
Menu_AddItem( &s_driverinfo.menu, &s_driverinfo.framel );
220
Menu_AddItem( &s_driverinfo.menu, &s_driverinfo.framer );
221
Menu_AddItem( &s_driverinfo.menu, &s_driverinfo.back );
223
UI_PushMenu( &s_driverinfo.menu );
227
=======================================================================
229
GRAPHICS OPTIONS MENU
231
=======================================================================
234
#define GRAPHICSOPTIONS_FRAMEL "menu/art/frame2_l"
235
#define GRAPHICSOPTIONS_FRAMER "menu/art/frame1_r"
236
#define GRAPHICSOPTIONS_BACK0 "menu/art/back_0"
237
#define GRAPHICSOPTIONS_BACK1 "menu/art/back_1"
238
#define GRAPHICSOPTIONS_ACCEPT0 "menu/art/accept_0"
239
#define GRAPHICSOPTIONS_ACCEPT1 "menu/art/accept_1"
241
static const char *s_drivers[] =
249
#define ID_FULLSCREEN 102
252
#define ID_DRIVERINFO 105
253
#define ID_GRAPHICS 106
254
#define ID_DISPLAY 107
256
#define ID_NETWORK 109
259
menuframework_s menu;
276
menulist_s allow_extensions;
277
menulist_s texturebits;
278
menulist_s colordepth;
281
menutext_s driverinfo;
299
} InitialVideoOptions_s;
301
static InitialVideoOptions_s s_ivo;
302
static graphicsoptions_t s_graphicsoptions;
304
static InitialVideoOptions_s s_ivo_templates[] =
307
6, qtrue, 3, 0, 2, 2, 2, 1, 0, qtrue
310
4, qtrue, 2, 0, 2, 2, 1, 1, 0, qtrue // JDC: this was tq 3
313
3, qtrue, 2, 0, 0, 0, 1, 0, 0, qtrue
316
2, qtrue, 1, 0, 1, 0, 0, 0, 0, qtrue
319
2, qtrue, 1, 1, 1, 0, 0, 0, 0, qtrue
322
3, qtrue, 1, 0, 0, 0, 1, 0, 0, qtrue
326
#define NUM_IVO_TEMPLATES ( sizeof( s_ivo_templates ) / sizeof( s_ivo_templates[0] ) )
330
GraphicsOptions_GetInitialVideo
333
static void GraphicsOptions_GetInitialVideo( void )
335
s_ivo.colordepth = s_graphicsoptions.colordepth.curvalue;
336
s_ivo.driver = s_graphicsoptions.driver.curvalue;
337
s_ivo.mode = s_graphicsoptions.mode.curvalue;
338
s_ivo.fullscreen = s_graphicsoptions.fs.curvalue;
339
s_ivo.extensions = s_graphicsoptions.allow_extensions.curvalue;
340
s_ivo.tq = s_graphicsoptions.tq.curvalue;
341
s_ivo.lighting = s_graphicsoptions.lighting.curvalue;
342
s_ivo.geometry = s_graphicsoptions.geometry.curvalue;
343
s_ivo.filter = s_graphicsoptions.filter.curvalue;
344
s_ivo.texturebits = s_graphicsoptions.texturebits.curvalue;
349
GraphicsOptions_CheckConfig
352
static void GraphicsOptions_CheckConfig( void )
356
for ( i = 0; i < NUM_IVO_TEMPLATES-1; i++ )
358
if ( s_ivo_templates[i].colordepth != s_graphicsoptions.colordepth.curvalue )
360
if ( s_ivo_templates[i].driver != s_graphicsoptions.driver.curvalue )
362
if ( s_ivo_templates[i].mode != s_graphicsoptions.mode.curvalue )
364
if ( s_ivo_templates[i].fullscreen != s_graphicsoptions.fs.curvalue )
366
if ( s_ivo_templates[i].tq != s_graphicsoptions.tq.curvalue )
368
if ( s_ivo_templates[i].lighting != s_graphicsoptions.lighting.curvalue )
370
if ( s_ivo_templates[i].geometry != s_graphicsoptions.geometry.curvalue )
372
if ( s_ivo_templates[i].filter != s_graphicsoptions.filter.curvalue )
374
// if ( s_ivo_templates[i].texturebits != s_graphicsoptions.texturebits.curvalue )
376
s_graphicsoptions.list.curvalue = i;
380
// return 'Custom' ivo template
381
s_graphicsoptions.list.curvalue = NUM_IVO_TEMPLATES - 1;
386
GraphicsOptions_UpdateMenuItems
389
static void GraphicsOptions_UpdateMenuItems( void )
391
if ( s_graphicsoptions.driver.curvalue == 1 )
393
s_graphicsoptions.fs.curvalue = 1;
394
s_graphicsoptions.fs.generic.flags |= QMF_GRAYED;
395
s_graphicsoptions.colordepth.curvalue = 1;
399
s_graphicsoptions.fs.generic.flags &= ~QMF_GRAYED;
402
if ( s_graphicsoptions.fs.curvalue == 0 || s_graphicsoptions.driver.curvalue == 1 )
404
s_graphicsoptions.colordepth.curvalue = 0;
405
s_graphicsoptions.colordepth.generic.flags |= QMF_GRAYED;
409
s_graphicsoptions.colordepth.generic.flags &= ~QMF_GRAYED;
412
if ( s_graphicsoptions.allow_extensions.curvalue == 0 )
414
if ( s_graphicsoptions.texturebits.curvalue == 0 )
416
s_graphicsoptions.texturebits.curvalue = 1;
420
s_graphicsoptions.apply.generic.flags |= QMF_HIDDEN|QMF_INACTIVE;
422
if ( s_ivo.mode != s_graphicsoptions.mode.curvalue )
424
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
426
if ( s_ivo.fullscreen != s_graphicsoptions.fs.curvalue )
428
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
430
if ( s_ivo.extensions != s_graphicsoptions.allow_extensions.curvalue )
432
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
434
if ( s_ivo.tq != s_graphicsoptions.tq.curvalue )
436
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
438
if ( s_ivo.lighting != s_graphicsoptions.lighting.curvalue )
440
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
442
if ( s_ivo.colordepth != s_graphicsoptions.colordepth.curvalue )
444
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
446
if ( s_ivo.driver != s_graphicsoptions.driver.curvalue )
448
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
450
if ( s_ivo.texturebits != s_graphicsoptions.texturebits.curvalue )
452
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
454
if ( s_ivo.geometry != s_graphicsoptions.geometry.curvalue )
456
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
458
if ( s_ivo.filter != s_graphicsoptions.filter.curvalue )
460
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
463
GraphicsOptions_CheckConfig();
468
GraphicsOptions_ApplyChanges
471
static void GraphicsOptions_ApplyChanges( void *unused, int notification )
473
if (notification != QM_ACTIVATED)
476
switch ( s_graphicsoptions.texturebits.curvalue )
479
trap_Cvar_SetValue( "r_texturebits", 0 );
482
trap_Cvar_SetValue( "r_texturebits", 16 );
485
trap_Cvar_SetValue( "r_texturebits", 32 );
488
trap_Cvar_SetValue( "r_picmip", 3 - s_graphicsoptions.tq.curvalue );
489
trap_Cvar_SetValue( "r_allowExtensions", s_graphicsoptions.allow_extensions.curvalue );
490
trap_Cvar_SetValue( "r_mode", s_graphicsoptions.mode.curvalue );
491
trap_Cvar_SetValue( "r_fullscreen", s_graphicsoptions.fs.curvalue );
492
trap_Cvar_Set( "r_glDriver", ( char * ) s_drivers[s_graphicsoptions.driver.curvalue] );
493
switch ( s_graphicsoptions.colordepth.curvalue )
496
trap_Cvar_SetValue( "r_colorbits", 0 );
497
trap_Cvar_SetValue( "r_depthbits", 0 );
498
trap_Cvar_SetValue( "r_stencilbits", 0 );
501
trap_Cvar_SetValue( "r_colorbits", 16 );
502
trap_Cvar_SetValue( "r_depthbits", 16 );
503
trap_Cvar_SetValue( "r_stencilbits", 0 );
506
trap_Cvar_SetValue( "r_colorbits", 32 );
507
trap_Cvar_SetValue( "r_depthbits", 24 );
510
trap_Cvar_SetValue( "r_vertexLight", s_graphicsoptions.lighting.curvalue );
512
if ( s_graphicsoptions.geometry.curvalue == 2 )
514
trap_Cvar_SetValue( "r_lodBias", 0 );
515
trap_Cvar_SetValue( "r_subdivisions", 4 );
517
else if ( s_graphicsoptions.geometry.curvalue == 1 )
519
trap_Cvar_SetValue( "r_lodBias", 1 );
520
trap_Cvar_SetValue( "r_subdivisions", 12 );
524
trap_Cvar_SetValue( "r_lodBias", 1 );
525
trap_Cvar_SetValue( "r_subdivisions", 20 );
528
if ( s_graphicsoptions.filter.curvalue )
530
trap_Cvar_Set( "r_textureMode", "GL_LINEAR_MIPMAP_LINEAR" );
534
trap_Cvar_Set( "r_textureMode", "GL_LINEAR_MIPMAP_NEAREST" );
537
trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart\n" );
542
GraphicsOptions_Event
545
static void GraphicsOptions_Event( void* ptr, int event ) {
546
InitialVideoOptions_s *ivo;
548
if( event != QM_ACTIVATED ) {
552
switch( ((menucommon_s*)ptr)->id ) {
554
// clamp 3dfx video modes
555
if ( s_graphicsoptions.driver.curvalue == 1 )
557
if ( s_graphicsoptions.mode.curvalue < 2 )
558
s_graphicsoptions.mode.curvalue = 2;
559
else if ( s_graphicsoptions.mode.curvalue > 6 )
560
s_graphicsoptions.mode.curvalue = 6;
565
ivo = &s_ivo_templates[s_graphicsoptions.list.curvalue];
567
s_graphicsoptions.mode.curvalue = ivo->mode;
568
s_graphicsoptions.tq.curvalue = ivo->tq;
569
s_graphicsoptions.lighting.curvalue = ivo->lighting;
570
s_graphicsoptions.colordepth.curvalue = ivo->colordepth;
571
s_graphicsoptions.texturebits.curvalue = ivo->texturebits;
572
s_graphicsoptions.geometry.curvalue = ivo->geometry;
573
s_graphicsoptions.filter.curvalue = ivo->filter;
574
s_graphicsoptions.fs.curvalue = ivo->fullscreen;
578
UI_DriverInfo_Menu();
590
UI_DisplayOptionsMenu();
595
UI_SoundOptionsMenu();
600
UI_NetworkOptionsMenu();
608
GraphicsOptions_TQEvent
611
static void GraphicsOptions_TQEvent( void *ptr, int event ) {
612
if( event != QM_ACTIVATED ) {
615
s_graphicsoptions.tq.curvalue = (int)(s_graphicsoptions.tq.curvalue + 0.5);
621
GraphicsOptions_MenuDraw
624
void GraphicsOptions_MenuDraw (void)
626
//APSFIX - rework this
627
GraphicsOptions_UpdateMenuItems();
629
Menu_Draw( &s_graphicsoptions.menu );
634
GraphicsOptions_SetMenuItems
637
static void GraphicsOptions_SetMenuItems( void )
639
s_graphicsoptions.mode.curvalue = trap_Cvar_VariableValue( "r_mode" );
640
if ( s_graphicsoptions.mode.curvalue < 0 )
642
s_graphicsoptions.mode.curvalue = 3;
644
s_graphicsoptions.fs.curvalue = trap_Cvar_VariableValue("r_fullscreen");
645
s_graphicsoptions.allow_extensions.curvalue = trap_Cvar_VariableValue("r_allowExtensions");
646
s_graphicsoptions.tq.curvalue = 3-trap_Cvar_VariableValue( "r_picmip");
647
if ( s_graphicsoptions.tq.curvalue < 0 )
649
s_graphicsoptions.tq.curvalue = 0;
651
else if ( s_graphicsoptions.tq.curvalue > 3 )
653
s_graphicsoptions.tq.curvalue = 3;
656
s_graphicsoptions.lighting.curvalue = trap_Cvar_VariableValue( "r_vertexLight" ) != 0;
657
switch ( ( int ) trap_Cvar_VariableValue( "r_texturebits" ) )
661
s_graphicsoptions.texturebits.curvalue = 0;
664
s_graphicsoptions.texturebits.curvalue = 1;
667
s_graphicsoptions.texturebits.curvalue = 2;
671
if ( !Q_stricmp( UI_Cvar_VariableString( "r_textureMode" ), "GL_LINEAR_MIPMAP_NEAREST" ) )
673
s_graphicsoptions.filter.curvalue = 0;
677
s_graphicsoptions.filter.curvalue = 1;
680
if ( trap_Cvar_VariableValue( "r_lodBias" ) > 0 )
682
if ( trap_Cvar_VariableValue( "r_subdivisions" ) >= 20 )
684
s_graphicsoptions.geometry.curvalue = 0;
688
s_graphicsoptions.geometry.curvalue = 1;
693
s_graphicsoptions.geometry.curvalue = 2;
696
switch ( ( int ) trap_Cvar_VariableValue( "r_colorbits" ) )
700
s_graphicsoptions.colordepth.curvalue = 0;
703
s_graphicsoptions.colordepth.curvalue = 1;
706
s_graphicsoptions.colordepth.curvalue = 2;
710
if ( s_graphicsoptions.fs.curvalue == 0 )
712
s_graphicsoptions.colordepth.curvalue = 0;
714
if ( s_graphicsoptions.driver.curvalue == 1 )
716
s_graphicsoptions.colordepth.curvalue = 1;
722
GraphicsOptions_MenuInit
725
void GraphicsOptions_MenuInit( void )
727
static const char *s_driver_names[] =
734
static const char *tq_names[] =
742
static const char *s_graphics_options_names[] =
753
static const char *lighting_names[] =
760
static const char *colordepth_names[] =
768
static const char *resolutions[] =
781
"856x480 wide screen",
784
static const char *filter_names[] =
790
static const char *quality_names[] =
797
static const char *enabled_names[] =
806
// zero set all our globals
807
memset( &s_graphicsoptions, 0 ,sizeof(graphicsoptions_t) );
809
GraphicsOptions_Cache();
811
s_graphicsoptions.menu.wrapAround = qtrue;
812
s_graphicsoptions.menu.fullscreen = qtrue;
813
s_graphicsoptions.menu.draw = GraphicsOptions_MenuDraw;
815
s_graphicsoptions.banner.generic.type = MTYPE_BTEXT;
816
s_graphicsoptions.banner.generic.x = 320;
817
s_graphicsoptions.banner.generic.y = 16;
818
s_graphicsoptions.banner.string = "SYSTEM SETUP";
819
s_graphicsoptions.banner.color = color_white;
820
s_graphicsoptions.banner.style = UI_CENTER;
822
s_graphicsoptions.framel.generic.type = MTYPE_BITMAP;
823
s_graphicsoptions.framel.generic.name = GRAPHICSOPTIONS_FRAMEL;
824
s_graphicsoptions.framel.generic.flags = QMF_INACTIVE;
825
s_graphicsoptions.framel.generic.x = 0;
826
s_graphicsoptions.framel.generic.y = 78;
827
s_graphicsoptions.framel.width = 256;
828
s_graphicsoptions.framel.height = 329;
830
s_graphicsoptions.framer.generic.type = MTYPE_BITMAP;
831
s_graphicsoptions.framer.generic.name = GRAPHICSOPTIONS_FRAMER;
832
s_graphicsoptions.framer.generic.flags = QMF_INACTIVE;
833
s_graphicsoptions.framer.generic.x = 376;
834
s_graphicsoptions.framer.generic.y = 76;
835
s_graphicsoptions.framer.width = 256;
836
s_graphicsoptions.framer.height = 334;
838
s_graphicsoptions.graphics.generic.type = MTYPE_PTEXT;
839
s_graphicsoptions.graphics.generic.flags = QMF_RIGHT_JUSTIFY;
840
s_graphicsoptions.graphics.generic.id = ID_GRAPHICS;
841
s_graphicsoptions.graphics.generic.callback = GraphicsOptions_Event;
842
s_graphicsoptions.graphics.generic.x = 216;
843
s_graphicsoptions.graphics.generic.y = 240 - 2 * PROP_HEIGHT;
844
s_graphicsoptions.graphics.string = "GRAPHICS";
845
s_graphicsoptions.graphics.style = UI_RIGHT;
846
s_graphicsoptions.graphics.color = color_red;
848
s_graphicsoptions.display.generic.type = MTYPE_PTEXT;
849
s_graphicsoptions.display.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
850
s_graphicsoptions.display.generic.id = ID_DISPLAY;
851
s_graphicsoptions.display.generic.callback = GraphicsOptions_Event;
852
s_graphicsoptions.display.generic.x = 216;
853
s_graphicsoptions.display.generic.y = 240 - PROP_HEIGHT;
854
s_graphicsoptions.display.string = "DISPLAY";
855
s_graphicsoptions.display.style = UI_RIGHT;
856
s_graphicsoptions.display.color = color_red;
858
s_graphicsoptions.sound.generic.type = MTYPE_PTEXT;
859
s_graphicsoptions.sound.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
860
s_graphicsoptions.sound.generic.id = ID_SOUND;
861
s_graphicsoptions.sound.generic.callback = GraphicsOptions_Event;
862
s_graphicsoptions.sound.generic.x = 216;
863
s_graphicsoptions.sound.generic.y = 240;
864
s_graphicsoptions.sound.string = "SOUND";
865
s_graphicsoptions.sound.style = UI_RIGHT;
866
s_graphicsoptions.sound.color = color_red;
868
s_graphicsoptions.network.generic.type = MTYPE_PTEXT;
869
s_graphicsoptions.network.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
870
s_graphicsoptions.network.generic.id = ID_NETWORK;
871
s_graphicsoptions.network.generic.callback = GraphicsOptions_Event;
872
s_graphicsoptions.network.generic.x = 216;
873
s_graphicsoptions.network.generic.y = 240 + PROP_HEIGHT;
874
s_graphicsoptions.network.string = "NETWORK";
875
s_graphicsoptions.network.style = UI_RIGHT;
876
s_graphicsoptions.network.color = color_red;
878
y = 240 - 6 * (BIGCHAR_HEIGHT + 2);
879
s_graphicsoptions.list.generic.type = MTYPE_SPINCONTROL;
880
s_graphicsoptions.list.generic.name = "Graphics Settings:";
881
s_graphicsoptions.list.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
882
s_graphicsoptions.list.generic.x = 400;
883
s_graphicsoptions.list.generic.y = y;
884
s_graphicsoptions.list.generic.callback = GraphicsOptions_Event;
885
s_graphicsoptions.list.generic.id = ID_LIST;
886
s_graphicsoptions.list.itemnames = s_graphics_options_names;
887
y += 2 * ( BIGCHAR_HEIGHT + 2 );
889
s_graphicsoptions.driver.generic.type = MTYPE_SPINCONTROL;
890
s_graphicsoptions.driver.generic.name = "GL Driver:";
891
s_graphicsoptions.driver.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
892
s_graphicsoptions.driver.generic.x = 400;
893
s_graphicsoptions.driver.generic.y = y;
894
s_graphicsoptions.driver.itemnames = s_driver_names;
895
s_graphicsoptions.driver.curvalue = (uis.glconfig.driverType == GLDRV_VOODOO);
896
y += BIGCHAR_HEIGHT+2;
898
// references/modifies "r_allowExtensions"
899
s_graphicsoptions.allow_extensions.generic.type = MTYPE_SPINCONTROL;
900
s_graphicsoptions.allow_extensions.generic.name = "GL Extensions:";
901
s_graphicsoptions.allow_extensions.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
902
s_graphicsoptions.allow_extensions.generic.x = 400;
903
s_graphicsoptions.allow_extensions.generic.y = y;
904
s_graphicsoptions.allow_extensions.itemnames = enabled_names;
905
y += BIGCHAR_HEIGHT+2;
907
// references/modifies "r_mode"
908
s_graphicsoptions.mode.generic.type = MTYPE_SPINCONTROL;
909
s_graphicsoptions.mode.generic.name = "Video Mode:";
910
s_graphicsoptions.mode.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
911
s_graphicsoptions.mode.generic.x = 400;
912
s_graphicsoptions.mode.generic.y = y;
913
s_graphicsoptions.mode.itemnames = resolutions;
914
s_graphicsoptions.mode.generic.callback = GraphicsOptions_Event;
915
s_graphicsoptions.mode.generic.id = ID_MODE;
916
y += BIGCHAR_HEIGHT+2;
918
// references "r_colorbits"
919
s_graphicsoptions.colordepth.generic.type = MTYPE_SPINCONTROL;
920
s_graphicsoptions.colordepth.generic.name = "Color Depth:";
921
s_graphicsoptions.colordepth.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
922
s_graphicsoptions.colordepth.generic.x = 400;
923
s_graphicsoptions.colordepth.generic.y = y;
924
s_graphicsoptions.colordepth.itemnames = colordepth_names;
925
y += BIGCHAR_HEIGHT+2;
927
// references/modifies "r_fullscreen"
928
s_graphicsoptions.fs.generic.type = MTYPE_SPINCONTROL;
929
s_graphicsoptions.fs.generic.name = "Fullscreen:";
930
s_graphicsoptions.fs.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
931
s_graphicsoptions.fs.generic.x = 400;
932
s_graphicsoptions.fs.generic.y = y;
933
s_graphicsoptions.fs.itemnames = enabled_names;
934
y += BIGCHAR_HEIGHT+2;
936
// references/modifies "r_vertexLight"
937
s_graphicsoptions.lighting.generic.type = MTYPE_SPINCONTROL;
938
s_graphicsoptions.lighting.generic.name = "Lighting:";
939
s_graphicsoptions.lighting.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
940
s_graphicsoptions.lighting.generic.x = 400;
941
s_graphicsoptions.lighting.generic.y = y;
942
s_graphicsoptions.lighting.itemnames = lighting_names;
943
y += BIGCHAR_HEIGHT+2;
945
// references/modifies "r_lodBias" & "subdivisions"
946
s_graphicsoptions.geometry.generic.type = MTYPE_SPINCONTROL;
947
s_graphicsoptions.geometry.generic.name = "Geometric Detail:";
948
s_graphicsoptions.geometry.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
949
s_graphicsoptions.geometry.generic.x = 400;
950
s_graphicsoptions.geometry.generic.y = y;
951
s_graphicsoptions.geometry.itemnames = quality_names;
952
y += BIGCHAR_HEIGHT+2;
954
// references/modifies "r_picmip"
955
s_graphicsoptions.tq.generic.type = MTYPE_SLIDER;
956
s_graphicsoptions.tq.generic.name = "Texture Detail:";
957
s_graphicsoptions.tq.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
958
s_graphicsoptions.tq.generic.x = 400;
959
s_graphicsoptions.tq.generic.y = y;
960
s_graphicsoptions.tq.minvalue = 0;
961
s_graphicsoptions.tq.maxvalue = 3;
962
s_graphicsoptions.tq.generic.callback = GraphicsOptions_TQEvent;
963
y += BIGCHAR_HEIGHT+2;
965
// references/modifies "r_textureBits"
966
s_graphicsoptions.texturebits.generic.type = MTYPE_SPINCONTROL;
967
s_graphicsoptions.texturebits.generic.name = "Texture Quality:";
968
s_graphicsoptions.texturebits.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
969
s_graphicsoptions.texturebits.generic.x = 400;
970
s_graphicsoptions.texturebits.generic.y = y;
971
s_graphicsoptions.texturebits.itemnames = tq_names;
972
y += BIGCHAR_HEIGHT+2;
974
// references/modifies "r_textureMode"
975
s_graphicsoptions.filter.generic.type = MTYPE_SPINCONTROL;
976
s_graphicsoptions.filter.generic.name = "Texture Filter:";
977
s_graphicsoptions.filter.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
978
s_graphicsoptions.filter.generic.x = 400;
979
s_graphicsoptions.filter.generic.y = y;
980
s_graphicsoptions.filter.itemnames = filter_names;
981
y += 2*BIGCHAR_HEIGHT;
983
s_graphicsoptions.driverinfo.generic.type = MTYPE_PTEXT;
984
s_graphicsoptions.driverinfo.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
985
s_graphicsoptions.driverinfo.generic.callback = GraphicsOptions_Event;
986
s_graphicsoptions.driverinfo.generic.id = ID_DRIVERINFO;
987
s_graphicsoptions.driverinfo.generic.x = 320;
988
s_graphicsoptions.driverinfo.generic.y = y;
989
s_graphicsoptions.driverinfo.string = "Driver Info";
990
s_graphicsoptions.driverinfo.style = UI_CENTER|UI_SMALLFONT;
991
s_graphicsoptions.driverinfo.color = color_red;
992
y += BIGCHAR_HEIGHT+2;
994
s_graphicsoptions.back.generic.type = MTYPE_BITMAP;
995
s_graphicsoptions.back.generic.name = GRAPHICSOPTIONS_BACK0;
996
s_graphicsoptions.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
997
s_graphicsoptions.back.generic.callback = GraphicsOptions_Event;
998
s_graphicsoptions.back.generic.id = ID_BACK2;
999
s_graphicsoptions.back.generic.x = 0;
1000
s_graphicsoptions.back.generic.y = 480-64;
1001
s_graphicsoptions.back.width = 128;
1002
s_graphicsoptions.back.height = 64;
1003
s_graphicsoptions.back.focuspic = GRAPHICSOPTIONS_BACK1;
1005
s_graphicsoptions.apply.generic.type = MTYPE_BITMAP;
1006
s_graphicsoptions.apply.generic.name = GRAPHICSOPTIONS_ACCEPT0;
1007
s_graphicsoptions.apply.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_HIDDEN|QMF_INACTIVE;
1008
s_graphicsoptions.apply.generic.callback = GraphicsOptions_ApplyChanges;
1009
s_graphicsoptions.apply.generic.x = 640;
1010
s_graphicsoptions.apply.generic.y = 480-64;
1011
s_graphicsoptions.apply.width = 128;
1012
s_graphicsoptions.apply.height = 64;
1013
s_graphicsoptions.apply.focuspic = GRAPHICSOPTIONS_ACCEPT1;
1015
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.banner );
1016
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.framel );
1017
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.framer );
1019
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.graphics );
1020
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.display );
1021
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.sound );
1022
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.network );
1024
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.list );
1025
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.driver );
1026
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.allow_extensions );
1027
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.mode );
1028
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.colordepth );
1029
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.fs );
1030
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.lighting );
1031
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.geometry );
1032
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.tq );
1033
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.texturebits );
1034
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.filter );
1035
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.driverinfo );
1037
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.back );
1038
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.apply );
1040
GraphicsOptions_SetMenuItems();
1041
GraphicsOptions_GetInitialVideo();
1043
if ( uis.glconfig.driverType == GLDRV_ICD &&
1044
uis.glconfig.hardwareType == GLHW_3DFX_2D3D )
1046
s_graphicsoptions.driver.generic.flags |= QMF_HIDDEN|QMF_INACTIVE;
1053
GraphicsOptions_Cache
1056
void GraphicsOptions_Cache( void ) {
1057
trap_R_RegisterShaderNoMip( GRAPHICSOPTIONS_FRAMEL );
1058
trap_R_RegisterShaderNoMip( GRAPHICSOPTIONS_FRAMER );
1059
trap_R_RegisterShaderNoMip( GRAPHICSOPTIONS_BACK0 );
1060
trap_R_RegisterShaderNoMip( GRAPHICSOPTIONS_BACK1 );
1061
trap_R_RegisterShaderNoMip( GRAPHICSOPTIONS_ACCEPT0 );
1062
trap_R_RegisterShaderNoMip( GRAPHICSOPTIONS_ACCEPT1 );
1068
UI_GraphicsOptionsMenu
1071
void UI_GraphicsOptionsMenu( void ) {
1072
GraphicsOptions_MenuInit();
1073
UI_PushMenu( &s_graphicsoptions.menu );
1074
Menu_SetCursorToItem( &s_graphicsoptions.menu, &s_graphicsoptions.graphics );