00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "ui_local.h"
00024
00025 void GraphicsOptions_MenuInit( void );
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #define DRIVERINFO_FRAMEL "menu/art/frame2_l"
00037 #define DRIVERINFO_FRAMER "menu/art/frame1_r"
00038 #define DRIVERINFO_BACK0 "menu/art/back_0"
00039 #define DRIVERINFO_BACK1 "menu/art/back_1"
00040
00041 static char* driverinfo_artlist[] =
00042 {
00043 DRIVERINFO_FRAMEL,
00044 DRIVERINFO_FRAMER,
00045 DRIVERINFO_BACK0,
00046 DRIVERINFO_BACK1,
00047 NULL,
00048 };
00049
00050 #define ID_DRIVERINFOBACK 100
00051
00052 typedef struct
00053 {
00054 menuframework_s menu;
00055 menutext_s banner;
00056 menubitmap_s back;
00057 menubitmap_s framel;
00058 menubitmap_s framer;
00059 char stringbuff[1024];
00060 char* strings[64];
00061 int numstrings;
00062 } driverinfo_t;
00063
00064 static driverinfo_t s_driverinfo;
00065
00066
00067
00068
00069
00070
00071 static void DriverInfo_Event( void* ptr, int event )
00072 {
00073 if (event != QM_ACTIVATED)
00074 return;
00075
00076 switch (((menucommon_s*)ptr)->id)
00077 {
00078 case ID_DRIVERINFOBACK:
00079 UI_PopMenu();
00080 break;
00081 }
00082 }
00083
00084
00085
00086
00087
00088
00089 static void DriverInfo_MenuDraw( void )
00090 {
00091 int i;
00092 int y;
00093
00094 Menu_Draw( &s_driverinfo.menu );
00095
00096 UI_DrawString( 320, 80, "VENDOR", UI_CENTER|UI_SMALLFONT, color_red );
00097 UI_DrawString( 320, 152, "PIXELFORMAT", UI_CENTER|UI_SMALLFONT, color_red );
00098 UI_DrawString( 320, 192, "EXTENSIONS", UI_CENTER|UI_SMALLFONT, color_red );
00099
00100 UI_DrawString( 320, 80+16, uis.glconfig.vendor_string, UI_CENTER|UI_SMALLFONT, text_color_normal );
00101 UI_DrawString( 320, 96+16, uis.glconfig.version_string, UI_CENTER|UI_SMALLFONT, text_color_normal );
00102 UI_DrawString( 320, 112+16, uis.glconfig.renderer_string, UI_CENTER|UI_SMALLFONT, text_color_normal );
00103 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 );
00104
00105
00106 y = 192+16;
00107 for (i=0; i<s_driverinfo.numstrings/2; i++) {
00108 UI_DrawString( 320-4, y, s_driverinfo.strings[i*2], UI_RIGHT|UI_SMALLFONT, text_color_normal );
00109 UI_DrawString( 320+4, y, s_driverinfo.strings[i*2+1], UI_LEFT|UI_SMALLFONT, text_color_normal );
00110 y += SMALLCHAR_HEIGHT;
00111 }
00112
00113 if (s_driverinfo.numstrings & 1)
00114 UI_DrawString( 320, y, s_driverinfo.strings[s_driverinfo.numstrings-1], UI_CENTER|UI_SMALLFONT, text_color_normal );
00115 }
00116
00117
00118
00119
00120
00121
00122 void DriverInfo_Cache( void )
00123 {
00124 int i;
00125
00126
00127 for (i=0; ;i++)
00128 {
00129 if (!driverinfo_artlist[i])
00130 break;
00131 trap_R_RegisterShaderNoMip(driverinfo_artlist[i]);
00132 }
00133 }
00134
00135
00136
00137
00138
00139
00140 static void UI_DriverInfo_Menu( void )
00141 {
00142 char* eptr;
00143 int i;
00144 int len;
00145
00146
00147 memset( &s_driverinfo, 0 ,sizeof(driverinfo_t) );
00148
00149 DriverInfo_Cache();
00150
00151 s_driverinfo.menu.fullscreen = qtrue;
00152 s_driverinfo.menu.draw = DriverInfo_MenuDraw;
00153
00154 s_driverinfo.banner.generic.type = MTYPE_BTEXT;
00155 s_driverinfo.banner.generic.x = 320;
00156 s_driverinfo.banner.generic.y = 16;
00157 s_driverinfo.banner.string = "DRIVER INFO";
00158 s_driverinfo.banner.color = color_white;
00159 s_driverinfo.banner.style = UI_CENTER;
00160
00161 s_driverinfo.framel.generic.type = MTYPE_BITMAP;
00162 s_driverinfo.framel.generic.name = DRIVERINFO_FRAMEL;
00163 s_driverinfo.framel.generic.flags = QMF_INACTIVE;
00164 s_driverinfo.framel.generic.x = 0;
00165 s_driverinfo.framel.generic.y = 78;
00166 s_driverinfo.framel.width = 256;
00167 s_driverinfo.framel.height = 329;
00168
00169 s_driverinfo.framer.generic.type = MTYPE_BITMAP;
00170 s_driverinfo.framer.generic.name = DRIVERINFO_FRAMER;
00171 s_driverinfo.framer.generic.flags = QMF_INACTIVE;
00172 s_driverinfo.framer.generic.x = 376;
00173 s_driverinfo.framer.generic.y = 76;
00174 s_driverinfo.framer.width = 256;
00175 s_driverinfo.framer.height = 334;
00176
00177 s_driverinfo.back.generic.type = MTYPE_BITMAP;
00178 s_driverinfo.back.generic.name = DRIVERINFO_BACK0;
00179 s_driverinfo.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
00180 s_driverinfo.back.generic.callback = DriverInfo_Event;
00181 s_driverinfo.back.generic.id = ID_DRIVERINFOBACK;
00182 s_driverinfo.back.generic.x = 0;
00183 s_driverinfo.back.generic.y = 480-64;
00184 s_driverinfo.back.width = 128;
00185 s_driverinfo.back.height = 64;
00186 s_driverinfo.back.focuspic = DRIVERINFO_BACK1;
00187
00188
00189
00190
00191
00192 Q_strncpyz(s_driverinfo.stringbuff, uis.glconfig.extensions_string, 1024);
00193
00194
00195 eptr = s_driverinfo.stringbuff;
00196 while ( s_driverinfo.numstrings<40 && *eptr )
00197 {
00198 while ( *eptr && *eptr == ' ' )
00199 *eptr++ = '\0';
00200
00201
00202 if (*eptr && *eptr != ' ')
00203 s_driverinfo.strings[s_driverinfo.numstrings++] = eptr;
00204
00205 while ( *eptr && *eptr != ' ' )
00206 eptr++;
00207 }
00208
00209
00210 for (i=0; i<s_driverinfo.numstrings; i++) {
00211 len = strlen(s_driverinfo.strings[i]);
00212 if (len > 32) {
00213 s_driverinfo.strings[i][len-1] = '>';
00214 s_driverinfo.strings[i][len] = '\0';
00215 }
00216 }
00217
00218 Menu_AddItem( &s_driverinfo.menu, &s_driverinfo.banner );
00219 Menu_AddItem( &s_driverinfo.menu, &s_driverinfo.framel );
00220 Menu_AddItem( &s_driverinfo.menu, &s_driverinfo.framer );
00221 Menu_AddItem( &s_driverinfo.menu, &s_driverinfo.back );
00222
00223 UI_PushMenu( &s_driverinfo.menu );
00224 }
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234 #define GRAPHICSOPTIONS_FRAMEL "menu/art/frame2_l"
00235 #define GRAPHICSOPTIONS_FRAMER "menu/art/frame1_r"
00236 #define GRAPHICSOPTIONS_BACK0 "menu/art/back_0"
00237 #define GRAPHICSOPTIONS_BACK1 "menu/art/back_1"
00238 #define GRAPHICSOPTIONS_ACCEPT0 "menu/art/accept_0"
00239 #define GRAPHICSOPTIONS_ACCEPT1 "menu/art/accept_1"
00240
00241 static const char *s_drivers[] =
00242 {
00243 OPENGL_DRIVER_NAME,
00244 _3DFX_DRIVER_NAME,
00245 0
00246 };
00247
00248 #define ID_BACK2 101
00249 #define ID_FULLSCREEN 102
00250 #define ID_LIST 103
00251 #define ID_MODE 104
00252 #define ID_DRIVERINFO 105
00253 #define ID_GRAPHICS 106
00254 #define ID_DISPLAY 107
00255 #define ID_SOUND 108
00256 #define ID_NETWORK 109
00257
00258 typedef struct {
00259 menuframework_s menu;
00260
00261 menutext_s banner;
00262 menubitmap_s framel;
00263 menubitmap_s framer;
00264
00265 menutext_s graphics;
00266 menutext_s display;
00267 menutext_s sound;
00268 menutext_s network;
00269
00270 menulist_s list;
00271 menulist_s mode;
00272 menulist_s driver;
00273 menuslider_s tq;
00274 menulist_s fs;
00275 menulist_s lighting;
00276 menulist_s allow_extensions;
00277 menulist_s texturebits;
00278 menulist_s colordepth;
00279 menulist_s geometry;
00280 menulist_s filter;
00281 menutext_s driverinfo;
00282
00283 menubitmap_s apply;
00284 menubitmap_s back;
00285 } graphicsoptions_t;
00286
00287 typedef struct
00288 {
00289 int mode;
00290 qboolean fullscreen;
00291 int tq;
00292 int lighting;
00293 int colordepth;
00294 int texturebits;
00295 int geometry;
00296 int filter;
00297 int driver;
00298 qboolean extensions;
00299 } InitialVideoOptions_s;
00300
00301 static InitialVideoOptions_s s_ivo;
00302 static graphicsoptions_t s_graphicsoptions;
00303
00304 static InitialVideoOptions_s s_ivo_templates[] =
00305 {
00306 {
00307 4, qtrue, 2, 0, 2, 2, 1, 1, 0, qtrue
00308 },
00309 {
00310 3, qtrue, 2, 0, 0, 0, 1, 0, 0, qtrue
00311 },
00312 {
00313 2, qtrue, 1, 0, 1, 0, 0, 0, 0, qtrue
00314 },
00315 {
00316 2, qtrue, 1, 1, 1, 0, 0, 0, 0, qtrue
00317 },
00318 {
00319 3, qtrue, 1, 0, 0, 0, 1, 0, 0, qtrue
00320 }
00321 };
00322
00323 #define NUM_IVO_TEMPLATES ( sizeof( s_ivo_templates ) / sizeof( s_ivo_templates[0] ) )
00324
00325
00326
00327
00328
00329
00330 static void GraphicsOptions_GetInitialVideo( void )
00331 {
00332 s_ivo.colordepth = s_graphicsoptions.colordepth.curvalue;
00333 s_ivo.driver = s_graphicsoptions.driver.curvalue;
00334 s_ivo.mode = s_graphicsoptions.mode.curvalue;
00335 s_ivo.fullscreen = s_graphicsoptions.fs.curvalue;
00336 s_ivo.extensions = s_graphicsoptions.allow_extensions.curvalue;
00337 s_ivo.tq = s_graphicsoptions.tq.curvalue;
00338 s_ivo.lighting = s_graphicsoptions.lighting.curvalue;
00339 s_ivo.geometry = s_graphicsoptions.geometry.curvalue;
00340 s_ivo.filter = s_graphicsoptions.filter.curvalue;
00341 s_ivo.texturebits = s_graphicsoptions.texturebits.curvalue;
00342 }
00343
00344
00345
00346
00347
00348
00349 static void GraphicsOptions_CheckConfig( void )
00350 {
00351 int i;
00352
00353 for ( i = 0; i < NUM_IVO_TEMPLATES; i++ )
00354 {
00355 if ( s_ivo_templates[i].colordepth != s_graphicsoptions.colordepth.curvalue )
00356 continue;
00357 if ( s_ivo_templates[i].driver != s_graphicsoptions.driver.curvalue )
00358 continue;
00359 if ( s_ivo_templates[i].mode != s_graphicsoptions.mode.curvalue )
00360 continue;
00361 if ( s_ivo_templates[i].fullscreen != s_graphicsoptions.fs.curvalue )
00362 continue;
00363 if ( s_ivo_templates[i].tq != s_graphicsoptions.tq.curvalue )
00364 continue;
00365 if ( s_ivo_templates[i].lighting != s_graphicsoptions.lighting.curvalue )
00366 continue;
00367 if ( s_ivo_templates[i].geometry != s_graphicsoptions.geometry.curvalue )
00368 continue;
00369 if ( s_ivo_templates[i].filter != s_graphicsoptions.filter.curvalue )
00370 continue;
00371
00372
00373 s_graphicsoptions.list.curvalue = i;
00374 return;
00375 }
00376 s_graphicsoptions.list.curvalue = 4;
00377 }
00378
00379
00380
00381
00382
00383
00384 static void GraphicsOptions_UpdateMenuItems( void )
00385 {
00386 if ( s_graphicsoptions.driver.curvalue == 1 )
00387 {
00388 s_graphicsoptions.fs.curvalue = 1;
00389 s_graphicsoptions.fs.generic.flags |= QMF_GRAYED;
00390 s_graphicsoptions.colordepth.curvalue = 1;
00391 }
00392 else
00393 {
00394 s_graphicsoptions.fs.generic.flags &= ~QMF_GRAYED;
00395 }
00396
00397 if ( s_graphicsoptions.fs.curvalue == 0 || s_graphicsoptions.driver.curvalue == 1 )
00398 {
00399 s_graphicsoptions.colordepth.curvalue = 0;
00400 s_graphicsoptions.colordepth.generic.flags |= QMF_GRAYED;
00401 }
00402 else
00403 {
00404 s_graphicsoptions.colordepth.generic.flags &= ~QMF_GRAYED;
00405 }
00406
00407 if ( s_graphicsoptions.allow_extensions.curvalue == 0 )
00408 {
00409 if ( s_graphicsoptions.texturebits.curvalue == 0 )
00410 {
00411 s_graphicsoptions.texturebits.curvalue = 1;
00412 }
00413 }
00414
00415 s_graphicsoptions.apply.generic.flags |= QMF_HIDDEN|QMF_INACTIVE;
00416
00417 if ( s_ivo.mode != s_graphicsoptions.mode.curvalue )
00418 {
00419 s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
00420 }
00421 if ( s_ivo.fullscreen != s_graphicsoptions.fs.curvalue )
00422 {
00423 s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
00424 }
00425 if ( s_ivo.extensions != s_graphicsoptions.allow_extensions.curvalue )
00426 {
00427 s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
00428 }
00429 if ( s_ivo.tq != s_graphicsoptions.tq.curvalue )
00430 {
00431 s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
00432 }
00433 if ( s_ivo.lighting != s_graphicsoptions.lighting.curvalue )
00434 {
00435 s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
00436 }
00437 if ( s_ivo.colordepth != s_graphicsoptions.colordepth.curvalue )
00438 {
00439 s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
00440 }
00441 if ( s_ivo.driver != s_graphicsoptions.driver.curvalue )
00442 {
00443 s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
00444 }
00445 if ( s_ivo.texturebits != s_graphicsoptions.texturebits.curvalue )
00446 {
00447 s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
00448 }
00449 if ( s_ivo.geometry != s_graphicsoptions.geometry.curvalue )
00450 {
00451 s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
00452 }
00453 if ( s_ivo.filter != s_graphicsoptions.filter.curvalue )
00454 {
00455 s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
00456 }
00457
00458 GraphicsOptions_CheckConfig();
00459 }
00460
00461
00462
00463
00464
00465
00466 static void GraphicsOptions_ApplyChanges( void *unused, int notification )
00467 {
00468 if (notification != QM_ACTIVATED)
00469 return;
00470
00471 switch ( s_graphicsoptions.texturebits.curvalue )
00472 {
00473 case 0:
00474 trap_Cvar_SetValue( "r_texturebits", 0 );
00475 break;
00476 case 1:
00477 trap_Cvar_SetValue( "r_texturebits", 16 );
00478 break;
00479 case 2:
00480 trap_Cvar_SetValue( "r_texturebits", 32 );
00481 break;
00482 }
00483 trap_Cvar_SetValue( "r_picmip", 3 - s_graphicsoptions.tq.curvalue );
00484 trap_Cvar_SetValue( "r_allowExtensions", s_graphicsoptions.allow_extensions.curvalue );
00485 trap_Cvar_SetValue( "r_mode", s_graphicsoptions.mode.curvalue );
00486 trap_Cvar_SetValue( "r_fullscreen", s_graphicsoptions.fs.curvalue );
00487 trap_Cvar_Set( "r_glDriver", ( char * ) s_drivers[s_graphicsoptions.driver.curvalue] );
00488 switch ( s_graphicsoptions.colordepth.curvalue )
00489 {
00490 case 0:
00491 trap_Cvar_SetValue( "r_colorbits", 0 );
00492 trap_Cvar_SetValue( "r_depthbits", 0 );
00493 trap_Cvar_SetValue( "r_stencilbits", 0 );
00494 break;
00495 case 1:
00496 trap_Cvar_SetValue( "r_colorbits", 16 );
00497 trap_Cvar_SetValue( "r_depthbits", 16 );
00498 trap_Cvar_SetValue( "r_stencilbits", 0 );
00499 break;
00500 case 2:
00501 trap_Cvar_SetValue( "r_colorbits", 32 );
00502 trap_Cvar_SetValue( "r_depthbits", 24 );
00503 break;
00504 }
00505 trap_Cvar_SetValue( "r_vertexLight", s_graphicsoptions.lighting.curvalue );
00506
00507 if ( s_graphicsoptions.geometry.curvalue == 2 )
00508 {
00509 trap_Cvar_SetValue( "r_lodBias", 0 );
00510 trap_Cvar_SetValue( "r_subdivisions", 4 );
00511 }
00512 else if ( s_graphicsoptions.geometry.curvalue == 1 )
00513 {
00514 trap_Cvar_SetValue( "r_lodBias", 1 );
00515 trap_Cvar_SetValue( "r_subdivisions", 12 );
00516 }
00517 else
00518 {
00519 trap_Cvar_SetValue( "r_lodBias", 1 );
00520 trap_Cvar_SetValue( "r_subdivisions", 20 );
00521 }
00522
00523 if ( s_graphicsoptions.filter.curvalue )
00524 {
00525 trap_Cvar_Set( "r_textureMode", "GL_LINEAR_MIPMAP_LINEAR" );
00526 }
00527 else
00528 {
00529 trap_Cvar_Set( "r_textureMode", "GL_LINEAR_MIPMAP_NEAREST" );
00530 }
00531
00532 trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart\n" );
00533 }
00534
00535
00536
00537
00538
00539
00540 static void GraphicsOptions_Event( void* ptr, int event ) {
00541 InitialVideoOptions_s *ivo;
00542
00543 if( event != QM_ACTIVATED ) {
00544 return;
00545 }
00546
00547 switch( ((menucommon_s*)ptr)->id ) {
00548 case ID_MODE:
00549
00550 if ( s_graphicsoptions.driver.curvalue == 1 )
00551 {
00552 if ( s_graphicsoptions.mode.curvalue < 2 )
00553 s_graphicsoptions.mode.curvalue = 2;
00554 else if ( s_graphicsoptions.mode.curvalue > 6 )
00555 s_graphicsoptions.mode.curvalue = 6;
00556 }
00557 break;
00558
00559 case ID_LIST:
00560 ivo = &s_ivo_templates[s_graphicsoptions.list.curvalue];
00561
00562 s_graphicsoptions.mode.curvalue = ivo->mode;
00563 s_graphicsoptions.tq.curvalue = ivo->tq;
00564 s_graphicsoptions.lighting.curvalue = ivo->lighting;
00565 s_graphicsoptions.colordepth.curvalue = ivo->colordepth;
00566 s_graphicsoptions.texturebits.curvalue = ivo->texturebits;
00567 s_graphicsoptions.geometry.curvalue = ivo->geometry;
00568 s_graphicsoptions.filter.curvalue = ivo->filter;
00569 s_graphicsoptions.fs.curvalue = ivo->fullscreen;
00570 break;
00571
00572 case ID_DRIVERINFO:
00573 UI_DriverInfo_Menu();
00574 break;
00575
00576 case ID_BACK2:
00577 UI_PopMenu();
00578 break;
00579
00580 case ID_GRAPHICS:
00581 break;
00582
00583 case ID_DISPLAY:
00584 UI_PopMenu();
00585 UI_DisplayOptionsMenu();
00586 break;
00587
00588 case ID_SOUND:
00589 UI_PopMenu();
00590 UI_SoundOptionsMenu();
00591 break;
00592
00593 case ID_NETWORK:
00594 UI_PopMenu();
00595 UI_NetworkOptionsMenu();
00596 break;
00597 }
00598 }
00599
00600
00601
00602
00603
00604
00605
00606 static void GraphicsOptions_TQEvent( void *ptr, int event ) {
00607 if( event != QM_ACTIVATED ) {
00608 return;
00609 }
00610 s_graphicsoptions.tq.curvalue = (int)(s_graphicsoptions.tq.curvalue + 0.5);
00611 }
00612
00613
00614
00615
00616
00617
00618
00619 void GraphicsOptions_MenuDraw (void)
00620 {
00621
00622 GraphicsOptions_UpdateMenuItems();
00623
00624 Menu_Draw( &s_graphicsoptions.menu );
00625 }
00626
00627
00628
00629
00630
00631
00632 static void GraphicsOptions_SetMenuItems( void )
00633 {
00634 s_graphicsoptions.mode.curvalue = trap_Cvar_VariableValue( "r_mode" );
00635 if ( s_graphicsoptions.mode.curvalue < 0 )
00636 {
00637 s_graphicsoptions.mode.curvalue = 3;
00638 }
00639 s_graphicsoptions.fs.curvalue = trap_Cvar_VariableValue("r_fullscreen");
00640 s_graphicsoptions.allow_extensions.curvalue = trap_Cvar_VariableValue("r_allowExtensions");
00641 s_graphicsoptions.tq.curvalue = 3-trap_Cvar_VariableValue( "r_picmip");
00642 if ( s_graphicsoptions.tq.curvalue < 0 )
00643 {
00644 s_graphicsoptions.tq.curvalue = 0;
00645 }
00646 else if ( s_graphicsoptions.tq.curvalue > 3 )
00647 {
00648 s_graphicsoptions.tq.curvalue = 3;
00649 }
00650
00651 s_graphicsoptions.lighting.curvalue = trap_Cvar_VariableValue( "r_vertexLight" ) != 0;
00652 switch ( ( int ) trap_Cvar_VariableValue( "r_texturebits" ) )
00653 {
00654 default:
00655 case 0:
00656 s_graphicsoptions.texturebits.curvalue = 0;
00657 break;
00658 case 16:
00659 s_graphicsoptions.texturebits.curvalue = 1;
00660 break;
00661 case 32:
00662 s_graphicsoptions.texturebits.curvalue = 2;
00663 break;
00664 }
00665
00666 if ( !Q_stricmp( UI_Cvar_VariableString( "r_textureMode" ), "GL_LINEAR_MIPMAP_NEAREST" ) )
00667 {
00668 s_graphicsoptions.filter.curvalue = 0;
00669 }
00670 else
00671 {
00672 s_graphicsoptions.filter.curvalue = 1;
00673 }
00674
00675 if ( trap_Cvar_VariableValue( "r_lodBias" ) > 0 )
00676 {
00677 if ( trap_Cvar_VariableValue( "r_subdivisions" ) >= 20 )
00678 {
00679 s_graphicsoptions.geometry.curvalue = 0;
00680 }
00681 else
00682 {
00683 s_graphicsoptions.geometry.curvalue = 1;
00684 }
00685 }
00686 else
00687 {
00688 s_graphicsoptions.geometry.curvalue = 2;
00689 }
00690
00691 switch ( ( int ) trap_Cvar_VariableValue( "r_colorbits" ) )
00692 {
00693 default:
00694 case 0:
00695 s_graphicsoptions.colordepth.curvalue = 0;
00696 break;
00697 case 16:
00698 s_graphicsoptions.colordepth.curvalue = 1;
00699 break;
00700 case 32:
00701 s_graphicsoptions.colordepth.curvalue = 2;
00702 break;
00703 }
00704
00705 if ( s_graphicsoptions.fs.curvalue == 0 )
00706 {
00707 s_graphicsoptions.colordepth.curvalue = 0;
00708 }
00709 if ( s_graphicsoptions.driver.curvalue == 1 )
00710 {
00711 s_graphicsoptions.colordepth.curvalue = 1;
00712 }
00713 }
00714
00715
00716
00717
00718
00719
00720 void GraphicsOptions_MenuInit( void )
00721 {
00722 static const char *s_driver_names[] =
00723 {
00724 "Default",
00725 "Voodoo",
00726 0
00727 };
00728
00729 static const char *tq_names[] =
00730 {
00731 "Default",
00732 "16 bit",
00733 "32 bit",
00734 0
00735 };
00736
00737 static const char *s_graphics_options_names[] =
00738 {
00739 "High Quality",
00740 "Normal",
00741 "Fast",
00742 "Fastest",
00743 "Custom",
00744 0
00745 };
00746
00747 static const char *lighting_names[] =
00748 {
00749 "Lightmap",
00750 "Vertex",
00751 0
00752 };
00753
00754 static const char *colordepth_names[] =
00755 {
00756 "Default",
00757 "16 bit",
00758 "32 bit",
00759 0
00760 };
00761
00762 static const char *resolutions[] =
00763 {
00764 "320x240",
00765 "400x300",
00766 "512x384",
00767 "640x480",
00768 "800x600",
00769 "960x720",
00770 "1024x768",
00771 "1152x864",
00772 "1280x1024",
00773 "1600x1200",
00774 "2048x1536",
00775 "856x480 wide screen",
00776 0
00777 };
00778 static const char *filter_names[] =
00779 {
00780 "Bilinear",
00781 "Trilinear",
00782 0
00783 };
00784 static const char *quality_names[] =
00785 {
00786 "Low",
00787 "Medium",
00788 "High",
00789 0
00790 };
00791 static const char *enabled_names[] =
00792 {
00793 "Off",
00794 "On",
00795 0
00796 };
00797
00798 int y;
00799
00800
00801 memset( &s_graphicsoptions, 0 ,sizeof(graphicsoptions_t) );
00802
00803 GraphicsOptions_Cache();
00804
00805 s_graphicsoptions.menu.wrapAround = qtrue;
00806 s_graphicsoptions.menu.fullscreen = qtrue;
00807 s_graphicsoptions.menu.draw = GraphicsOptions_MenuDraw;
00808
00809 s_graphicsoptions.banner.generic.type = MTYPE_BTEXT;
00810 s_graphicsoptions.banner.generic.x = 320;
00811 s_graphicsoptions.banner.generic.y = 16;
00812 s_graphicsoptions.banner.string = "SYSTEM SETUP";
00813 s_graphicsoptions.banner.color = color_white;
00814 s_graphicsoptions.banner.style = UI_CENTER;
00815
00816 s_graphicsoptions.framel.generic.type = MTYPE_BITMAP;
00817 s_graphicsoptions.framel.generic.name = GRAPHICSOPTIONS_FRAMEL;
00818 s_graphicsoptions.framel.generic.flags = QMF_INACTIVE;
00819 s_graphicsoptions.framel.generic.x = 0;
00820 s_graphicsoptions.framel.generic.y = 78;
00821 s_graphicsoptions.framel.width = 256;
00822 s_graphicsoptions.framel.height = 329;
00823
00824 s_graphicsoptions.framer.generic.type = MTYPE_BITMAP;
00825 s_graphicsoptions.framer.generic.name = GRAPHICSOPTIONS_FRAMER;
00826 s_graphicsoptions.framer.generic.flags = QMF_INACTIVE;
00827 s_graphicsoptions.framer.generic.x = 376;
00828 s_graphicsoptions.framer.generic.y = 76;
00829 s_graphicsoptions.framer.width = 256;
00830 s_graphicsoptions.framer.height = 334;
00831
00832 s_graphicsoptions.graphics.generic.type = MTYPE_PTEXT;
00833 s_graphicsoptions.graphics.generic.flags = QMF_RIGHT_JUSTIFY;
00834 s_graphicsoptions.graphics.generic.id = ID_GRAPHICS;
00835 s_graphicsoptions.graphics.generic.callback = GraphicsOptions_Event;
00836 s_graphicsoptions.graphics.generic.x = 216;
00837 s_graphicsoptions.graphics.generic.y = 240 - 2 * PROP_HEIGHT;
00838 s_graphicsoptions.graphics.string = "GRAPHICS";
00839 s_graphicsoptions.graphics.style = UI_RIGHT;
00840 s_graphicsoptions.graphics.color = color_red;
00841
00842 s_graphicsoptions.display.generic.type = MTYPE_PTEXT;
00843 s_graphicsoptions.display.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
00844 s_graphicsoptions.display.generic.id = ID_DISPLAY;
00845 s_graphicsoptions.display.generic.callback = GraphicsOptions_Event;
00846 s_graphicsoptions.display.generic.x = 216;
00847 s_graphicsoptions.display.generic.y = 240 - PROP_HEIGHT;
00848 s_graphicsoptions.display.string = "DISPLAY";
00849 s_graphicsoptions.display.style = UI_RIGHT;
00850 s_graphicsoptions.display.color = color_red;
00851
00852 s_graphicsoptions.sound.generic.type = MTYPE_PTEXT;
00853 s_graphicsoptions.sound.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
00854 s_graphicsoptions.sound.generic.id = ID_SOUND;
00855 s_graphicsoptions.sound.generic.callback = GraphicsOptions_Event;
00856 s_graphicsoptions.sound.generic.x = 216;
00857 s_graphicsoptions.sound.generic.y = 240;
00858 s_graphicsoptions.sound.string = "SOUND";
00859 s_graphicsoptions.sound.style = UI_RIGHT;
00860 s_graphicsoptions.sound.color = color_red;
00861
00862 s_graphicsoptions.network.generic.type = MTYPE_PTEXT;
00863 s_graphicsoptions.network.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
00864 s_graphicsoptions.network.generic.id = ID_NETWORK;
00865 s_graphicsoptions.network.generic.callback = GraphicsOptions_Event;
00866 s_graphicsoptions.network.generic.x = 216;
00867 s_graphicsoptions.network.generic.y = 240 + PROP_HEIGHT;
00868 s_graphicsoptions.network.string = "NETWORK";
00869 s_graphicsoptions.network.style = UI_RIGHT;
00870 s_graphicsoptions.network.color = color_red;
00871
00872 y = 240 - 6 * (BIGCHAR_HEIGHT + 2);
00873 s_graphicsoptions.list.generic.type = MTYPE_SPINCONTROL;
00874 s_graphicsoptions.list.generic.name = "Graphics Settings:";
00875 s_graphicsoptions.list.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
00876 s_graphicsoptions.list.generic.x = 400;
00877 s_graphicsoptions.list.generic.y = y;
00878 s_graphicsoptions.list.generic.callback = GraphicsOptions_Event;
00879 s_graphicsoptions.list.generic.id = ID_LIST;
00880 s_graphicsoptions.list.itemnames = s_graphics_options_names;
00881 y += 2 * ( BIGCHAR_HEIGHT + 2 );
00882
00883 s_graphicsoptions.driver.generic.type = MTYPE_SPINCONTROL;
00884 s_graphicsoptions.driver.generic.name = "GL Driver:";
00885 s_graphicsoptions.driver.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
00886 s_graphicsoptions.driver.generic.x = 400;
00887 s_graphicsoptions.driver.generic.y = y;
00888 s_graphicsoptions.driver.itemnames = s_driver_names;
00889 s_graphicsoptions.driver.curvalue = (uis.glconfig.driverType == GLDRV_VOODOO);
00890 y += BIGCHAR_HEIGHT+2;
00891
00892
00893 s_graphicsoptions.allow_extensions.generic.type = MTYPE_SPINCONTROL;
00894 s_graphicsoptions.allow_extensions.generic.name = "GL Extensions:";
00895 s_graphicsoptions.allow_extensions.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
00896 s_graphicsoptions.allow_extensions.generic.x = 400;
00897 s_graphicsoptions.allow_extensions.generic.y = y;
00898 s_graphicsoptions.allow_extensions.itemnames = enabled_names;
00899 y += BIGCHAR_HEIGHT+2;
00900
00901
00902 s_graphicsoptions.mode.generic.type = MTYPE_SPINCONTROL;
00903 s_graphicsoptions.mode.generic.name = "Video Mode:";
00904 s_graphicsoptions.mode.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
00905 s_graphicsoptions.mode.generic.x = 400;
00906 s_graphicsoptions.mode.generic.y = y;
00907 s_graphicsoptions.mode.itemnames = resolutions;
00908 s_graphicsoptions.mode.generic.callback = GraphicsOptions_Event;
00909 s_graphicsoptions.mode.generic.id = ID_MODE;
00910 y += BIGCHAR_HEIGHT+2;
00911
00912
00913 s_graphicsoptions.colordepth.generic.type = MTYPE_SPINCONTROL;
00914 s_graphicsoptions.colordepth.generic.name = "Color Depth:";
00915 s_graphicsoptions.colordepth.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
00916 s_graphicsoptions.colordepth.generic.x = 400;
00917 s_graphicsoptions.colordepth.generic.y = y;
00918 s_graphicsoptions.colordepth.