| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#include "ui_local.h" |
| 24 |
|
| 25 |
void GraphicsOptions_MenuInit( void ); |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 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" |
| 40 |
|
| 41 |
static char* driverinfo_artlist[] = |
| 42 |
{ |
| 43 |
DRIVERINFO_FRAMEL, |
| 44 |
DRIVERINFO_FRAMER, |
| 45 |
DRIVERINFO_BACK0, |
| 46 |
DRIVERINFO_BACK1, |
| 47 |
NULL, |
| 48 |
}; |
| 49 |
|
| 50 |
#define ID_DRIVERINFOBACK 100 |
| 51 |
|
| 52 |
typedef struct |
| 53 |
{ |
| 54 |
menuframework_s menu; |
| 55 |
menutext_s banner; |
| 56 |
menubitmap_s back; |
| 57 |
menubitmap_s framel; |
| 58 |
menubitmap_s framer; |
| 59 |
char stringbuff[1024]; |
| 60 |
char* strings[64]; |
| 61 |
int numstrings; |
| 62 |
} driverinfo_t; |
| 63 |
|
| 64 |
static driverinfo_t s_driverinfo; |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
static void DriverInfo_Event( void* ptr, int event ) |
| 72 |
{ |
| 73 |
if (event != QM_ACTIVATED) |
| 74 |
return; |
| 75 |
|
| 76 |
switch (((menucommon_s*)ptr)->id) |
| 77 |
{ |
| 78 |
case ID_DRIVERINFOBACK: |
| 79 |
UI_PopMenu(); |
| 80 |
break; |
| 81 |
} |
| 82 |
} |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
static void DriverInfo_MenuDraw( void ) |
| 90 |
{ |
| 91 |
int i; |
| 92 |
int y; |
| 93 |
|
| 94 |
Menu_Draw( &s_driverinfo.menu ); |
| 95 |
|
| 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 ); |
| 99 |
|
| 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 ); |
| 104 |
|
| 105 |
|
| 106 |
y = 192+16; |
| 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; |
| 111 |
} |
| 112 |
|
| 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 ); |
| 115 |
} |
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
void DriverInfo_Cache( void ) |
| 123 |
{ |
| 124 |
int i; |
| 125 |
|
| 126 |
|
| 127 |
for (i=0; ;i++) |
| 128 |
{ |
| 129 |
if (!driverinfo_artlist[i]) |
| 130 |
break; |
| 131 |
trap_R_RegisterShaderNoMip(driverinfo_artlist[i]); |
| 132 |
} |
| 133 |
} |
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
static void UI_DriverInfo_Menu( void ) |
| 141 |
{ |
| 142 |
char* eptr; |
| 143 |
int i; |
| 144 |
int len; |
| 145 |
|
| 146 |
|
| 147 |
memset( &s_driverinfo, 0 ,sizeof(driverinfo_t) ); |
| 148 |
|
| 149 |
DriverInfo_Cache(); |
| 150 |
|
| 151 |
s_driverinfo.menu.fullscreen = qtrue; |
| 152 |
s_driverinfo.menu.draw = DriverInfo_MenuDraw; |
| 153 |
|
| 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; |
| 160 |
|
| 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; |
| 168 |
|
| 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; |
| 176 |
|
| 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; |
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
Q_strncpyz(s_driverinfo.stringbuff, uis.glconfig.extensions_string, 1024); |
| 193 |
|
| 194 |
|
| 195 |
eptr = s_driverinfo.stringbuff; |
| 196 |
while ( s_driverinfo.numstrings<40 && *eptr ) |
| 197 |
{ |
| 198 |
while ( *eptr && *eptr == ' ' ) |
| 199 |
*eptr++ = '\0'; |
| 200 |
|
| 201 |
|
| 202 |
if (*eptr && *eptr != ' ') |
| 203 |
s_driverinfo.strings[s_driverinfo.numstrings++] = eptr; |
| 204 |
|
| 205 |
while ( *eptr && *eptr != ' ' ) |
| 206 |
eptr++; |
| 207 |
} |
| 208 |
|
| 209 |
|
| 210 |
for (i=0; i<s_driverinfo.numstrings; i++) { |
| 211 |
len = strlen(s_driverinfo.strings[i]); |
| 212 |
if (len > 32) { |
| 213 |
s_driverinfo.strings[i][len-1] = '>'; |
| 214 |
s_driverinfo.strings[i][len] = '\0'; |
| 215 |
} |
| 216 |
} |
| 217 |
|
| 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 ); |
| 222 |
|
| 223 |
UI_PushMenu( &s_driverinfo.menu ); |
| 224 |
} |
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 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" |
| 240 |
|
| 241 |
#define ID_BACK2 101 |
| 242 |
#define ID_FULLSCREEN 102 |
| 243 |
#define ID_LIST 103 |
| 244 |
#define ID_MODE 104 |
| 245 |
#define ID_DRIVERINFO 105 |
| 246 |
#define ID_GRAPHICS 106 |
| 247 |
#define ID_DISPLAY 107 |
| 248 |
#define ID_SOUND 108 |
| 249 |
#define ID_NETWORK 109 |
| 250 |
#define ID_RATIO 110 |
| 251 |
|
| 252 |
typedef struct { |
| 253 |
menuframework_s menu; |
| 254 |
|
| 255 |
menutext_s banner; |
| 256 |
menubitmap_s framel; |
| 257 |
menubitmap_s framer; |
| 258 |
|
| 259 |
menutext_s graphics; |
| 260 |
menutext_s display; |
| 261 |
menutext_s sound; |
| 262 |
menutext_s network; |
| 263 |
|
| 264 |
menulist_s list; |
| 265 |
menulist_s ratio; |
| 266 |
menulist_s mode; |
| 267 |
menulist_s driver; |
| 268 |
menuslider_s tq; |
| 269 |
menulist_s fs; |
| 270 |
menulist_s lighting; |
| 271 |
menulist_s allow_extensions; |
| 272 |
menulist_s texturebits; |
| 273 |
menulist_s colordepth; |
| 274 |
menulist_s geometry; |
| 275 |
menulist_s filter; |
| 276 |
menutext_s driverinfo; |
| 277 |
|
| 278 |
menubitmap_s apply; |
| 279 |
menubitmap_s back; |
| 280 |
} graphicsoptions_t; |
| 281 |
|
| 282 |
typedef struct |
| 283 |
{ |
| 284 |
int mode; |
| 285 |
qboolean fullscreen; |
| 286 |
int tq; |
| 287 |
int lighting; |
| 288 |
int colordepth; |
| 289 |
int texturebits; |
| 290 |
int geometry; |
| 291 |
int filter; |
| 292 |
int driver; |
| 293 |
qboolean extensions; |
| 294 |
} InitialVideoOptions_s; |
| 295 |
|
| 296 |
static InitialVideoOptions_s s_ivo; |
| 297 |
static graphicsoptions_t s_graphicsoptions; |
| 298 |
|
| 299 |
static InitialVideoOptions_s s_ivo_templates[] = |
| 300 |
{ |
| 301 |
{ |
| 302 |
6, qtrue, 3, 0, 2, 2, 2, 1, 0, qtrue |
| 303 |
}, |
| 304 |
{ |
| 305 |
4, qtrue, 2, 0, 2, 2, 1, 1, 0, qtrue |
| 306 |
}, |
| 307 |
{ |
| 308 |
3, qtrue, 2, 0, 0, 0, 1, 0, 0, qtrue |
| 309 |
}, |
| 310 |
{ |
| 311 |
2, qtrue, 1, 0, 1, 0, 0, 0, 0, qtrue |
| 312 |
}, |
| 313 |
{ |
| 314 |
2, qtrue, 1, 1, 1, 0, 0, 0, 0, qtrue |
| 315 |
}, |
| 316 |
{ |
| 317 |
3, qtrue, 1, 0, 0, 0, 1, 0, 0, qtrue |
| 318 |
} |
| 319 |
}; |
| 320 |
|
| 321 |
#define NUM_IVO_TEMPLATES ( ARRAY_LEN( s_ivo_templates ) ) |
| 322 |
|
| 323 |
static const char *builtinResolutions[ ] = |
| 324 |
{ |
| 325 |
"320x240", |
| 326 |
"400x300", |
| 327 |
"512x384", |
| 328 |
"640x480", |
| 329 |
"800x600", |
| 330 |
"960x720", |
| 331 |
"1024x768", |
| 332 |
"1152x864", |
| 333 |
"1280x1024", |
| 334 |
"1600x1200", |
| 335 |
"2048x1536", |
| 336 |
"856x480", |
| 337 |
NULL |
| 338 |
}; |
| 339 |
|
| 340 |
static const char *knownRatios[ ][2] = |
| 341 |
{ |
| 342 |
{ "1.25:1", "5:4" }, |
| 343 |
{ "1.33:1", "4:3" }, |
| 344 |
{ "1.50:1", "3:2" }, |
| 345 |
{ "1.56:1", "14:9" }, |
| 346 |
{ "1.60:1", "16:10" }, |
| 347 |
{ "1.67:1", "5:3" }, |
| 348 |
{ "1.78:1", "16:9" }, |
| 349 |
{ NULL , NULL } |
| 350 |
}; |
| 351 |
|
| 352 |
#define MAX_RESOLUTIONS 32 |
| 353 |
|
| 354 |
static const char* ratios[ MAX_RESOLUTIONS ]; |
| 355 |
static char ratioBuf[ MAX_RESOLUTIONS ][ 8 ]; |
| 356 |
static int ratioToRes[ MAX_RESOLUTIONS ]; |
| 357 |
static int resToRatio[ MAX_RESOLUTIONS ]; |
| 358 |
|
| 359 |
static char resbuf[ MAX_STRING_CHARS ]; |
| 360 |
static const char* detectedResolutions[ MAX_RESOLUTIONS ]; |
| 361 |
static char currentResolution[ 20 ]; |
| 362 |
|
| 363 |
static const char** resolutions = builtinResolutions; |
| 364 |
static qboolean resolutionsDetected = qfalse; |
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
static int GraphicsOptions_FindBuiltinResolution( int mode ) |
| 372 |
{ |
| 373 |
int i; |
| 374 |
|
| 375 |
if( !resolutionsDetected ) |
| 376 |
return mode; |
| 377 |
|
| 378 |
if( mode < 0 ) |
| 379 |
return -1; |
| 380 |
|
| 381 |
for( i = 0; builtinResolutions[ i ]; i++ ) |
| 382 |
{ |
| 383 |
if( !Q_stricmp( builtinResolutions[ i ], detectedResolutions[ mode ] ) ) |
| 384 |
return i; |
| 385 |
} |
| 386 |
|
| 387 |
return -1; |
| 388 |
} |
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
static int GraphicsOptions_FindDetectedResolution( int mode ) |
| 396 |
{ |
| 397 |
int i; |
| 398 |
|
| 399 |
if( !resolutionsDetected ) |
| 400 |
return mode; |
| 401 |
|
| 402 |
if( mode < 0 ) |
| 403 |
return -1; |
| 404 |
|
| 405 |
for( i = 0; detectedResolutions[ i ]; i++ ) |
| 406 |
{ |
| 407 |
if( !Q_stricmp( builtinResolutions[ mode ], detectedResolutions[ i ] ) ) |
| 408 |
return i; |
| 409 |
} |
| 410 |
|
| 411 |
return -1; |
| 412 |
} |
| 413 |
|
| 414 |
|
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
static void GraphicsOptions_GetAspectRatios( void ) |
| 420 |
{ |
| 421 |
int i, r; |
| 422 |
|
| 423 |
|
| 424 |
for( r = 0; resolutions[r]; r++ ) |
| 425 |
{ |
| 426 |
int w, h; |
| 427 |
char *x; |
| 428 |
char str[ sizeof(ratioBuf[0]) ]; |
| 429 |
|
| 430 |
|
| 431 |
x = strchr( resolutions[r], 'x' ) + 1; |
| 432 |
Q_strncpyz( str, resolutions[r], x-resolutions[r] ); |
| 433 |
w = atoi( str ); |
| 434 |
h = atoi( x ); |
| 435 |
Com_sprintf( str, sizeof(str), "%.2f:1", (float)w / (float)h ); |
| 436 |
|
| 437 |
|
| 438 |
for( i = 0; knownRatios[i][0]; i++ ) { |
| 439 |
if( !Q_stricmp( str, knownRatios[i][0] ) ) { |
| 440 |
Q_strncpyz( str, knownRatios[i][1], sizeof( str ) ); |
| 441 |
break; |
| 442 |
} |
| 443 |
} |
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
for( i = 0; ratioBuf[i][0]; i++ ) |
| 448 |
{ |
| 449 |
if( !Q_stricmp( str, ratioBuf[i] ) ) |
| 450 |
break; |
| 451 |
} |
| 452 |
if( !ratioBuf[i][0] ) |
| 453 |
{ |
| 454 |
Q_strncpyz( ratioBuf[i], str, sizeof(ratioBuf[i]) ); |
| 455 |
ratioToRes[i] = r; |
| 456 |
} |
| 457 |
|
| 458 |
ratios[r] = ratioBuf[r]; |
| 459 |
resToRatio[r] = i; |
| 460 |
} |
| 461 |
|
| 462 |
ratios[r] = NULL; |
| 463 |
} |
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
static void GraphicsOptions_GetInitialVideo( void ) |
| 471 |
{ |
| 472 |
s_ivo.colordepth = s_graphicsoptions.colordepth.curvalue; |
| 473 |
s_ivo.driver = s_graphicsoptions.driver.curvalue; |
| 474 |
s_ivo.mode = s_graphicsoptions.mode.curvalue; |
| 475 |
s_ivo.fullscreen = s_graphicsoptions.fs.curvalue; |
| 476 |
s_ivo.extensions = s_graphicsoptions.allow_extensions.curvalue; |
| 477 |
s_ivo.tq = s_graphicsoptions.tq.curvalue; |
| 478 |
s_ivo.lighting = s_graphicsoptions.lighting.curvalue; |
| 479 |
s_ivo.geometry = s_graphicsoptions.geometry.curvalue; |
| 480 |
s_ivo.filter = s_graphicsoptions.filter.curvalue; |
| 481 |
s_ivo.texturebits = s_graphicsoptions.texturebits.curvalue; |
| 482 |
} |
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
|
| 489 |
static void GraphicsOptions_GetResolutions( void ) |
| 490 |
{ |
| 491 |
trap_Cvar_VariableStringBuffer("r_availableModes", resbuf, sizeof(resbuf)); |
| 492 |
if(*resbuf) |
| 493 |
{ |
| 494 |
char* s = resbuf; |
| 495 |
unsigned int i = 0; |
| 496 |
while( s && i < ARRAY_LEN(detectedResolutions)-1 ) |
| 497 |
{ |
| 498 |
detectedResolutions[i++] = s; |
| 499 |
s = strchr(s, ' '); |
| 500 |
if( s ) |
| 501 |
*s++ = '\0'; |
| 502 |
} |
| 503 |
detectedResolutions[ i ] = NULL; |
| 504 |
|
| 505 |
|
| 506 |
if ( i < ARRAY_LEN(detectedResolutions)-1 ) |
| 507 |
{ |
| 508 |
Com_sprintf( currentResolution, sizeof ( currentResolution ), "%dx%d", uis.glconfig.vidWidth, uis.glconfig.vidHeight ); |
| 509 |
|
| 510 |
for( i = 0; detectedResolutions[ i ]; i++ ) |
| 511 |
{ |
| 512 |
if ( strcmp( detectedResolutions[ i ], currentResolution ) == 0 ) |
| 513 |
break; |
| 514 |
} |
| 515 |
|
| 516 |
if ( detectedResolutions[ i ] == NULL ) |
| 517 |
{ |
| 518 |
detectedResolutions[ i++ ] = currentResolution; |
| 519 |
detectedResolutions[ i ] = NULL; |
| 520 |
} |
| 521 |
} |
| 522 |
|
| 523 |
resolutions = detectedResolutions; |
| 524 |
resolutionsDetected = qtrue; |
| 525 |
} |
| 526 |
} |
| 527 |
|
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
|
| 532 |
|
| 533 |
static void GraphicsOptions_CheckConfig( void ) |
| 534 |
{ |
| 535 |
int i; |
| 536 |
|
| 537 |
for ( i = 0; i < NUM_IVO_TEMPLATES-1; i++ ) |
| 538 |
{ |
| 539 |
if ( s_ivo_templates[i].colordepth != s_graphicsoptions.colordepth.curvalue ) |
| 540 |
continue; |
| 541 |
if ( s_ivo_templates[i].driver != s_graphicsoptions.driver.curvalue ) |
| 542 |
continue; |
| 543 |
if ( GraphicsOptions_FindDetectedResolution(s_ivo_templates[i].mode) != s_graphicsoptions.mode.curvalue ) |
| 544 |
continue; |
| 545 |
if ( s_ivo_templates[i].fullscreen != s_graphicsoptions.fs.curvalue ) |
| 546 |
continue; |
| 547 |
if ( s_ivo_templates[i].tq != s_graphicsoptions.tq.curvalue ) |
| 548 |
continue; |
| 549 |
if ( s_ivo_templates[i].lighting != s_graphicsoptions.lighting.curvalue ) |
| 550 |
continue; |
| 551 |
if ( s_ivo_templates[i].geometry != s_graphicsoptions.geometry.curvalue ) |
| 552 |
continue; |
| 553 |
if ( s_ivo_templates[i].filter != s_graphicsoptions.filter.curvalue ) |
| 554 |
continue; |
| 555 |
|
| 556 |
|
| 557 |
s_graphicsoptions.list.curvalue = i; |
| 558 |
return; |
| 559 |
} |
| 560 |
|
| 561 |
|
| 562 |
s_graphicsoptions.list.curvalue = NUM_IVO_TEMPLATES - 1; |
| 563 |
} |
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
|
| 569 |
|
| 570 |
static void GraphicsOptions_UpdateMenuItems( void ) |
| 571 |
{ |
| 572 |
if ( s_graphicsoptions.driver.curvalue == 1 ) |
| 573 |
{ |
| 574 |
s_graphicsoptions.fs.curvalue = 1; |
| 575 |
s_graphicsoptions.fs.generic.flags |= QMF_GRAYED; |
| 576 |
s_graphicsoptions.colordepth.curvalue = 1; |
| 577 |
} |
| 578 |
else |
| 579 |
{ |
| 580 |
s_graphicsoptions.fs.generic.flags &= ~QMF_GRAYED; |
| 581 |
} |
| 582 |
|
| 583 |
if ( s_graphicsoptions.fs.curvalue == 0 || s_graphicsoptions.driver.curvalue == 1 ) |
| 584 |
{ |
| 585 |
s_graphicsoptions.colordepth.curvalue = 0; |
| 586 |
s_graphicsoptions.colordepth.generic.flags |= QMF_GRAYED; |
| 587 |
} |
| 588 |
else |
| 589 |
{ |
| 590 |
s_graphicsoptions.colordepth.generic.flags &= ~QMF_GRAYED; |
| 591 |
} |
| 592 |
|
| 593 |
if ( s_graphicsoptions.allow_extensions.curvalue == 0 ) |
| 594 |
{ |
| 595 |
if ( s_graphicsoptions.texturebits.curvalue == 0 ) |
| 596 |
{ |
| 597 |
s_graphicsoptions.texturebits.curvalue = 1; |
| 598 |
} |
| 599 |
} |
| 600 |
|
| 601 |
s_graphicsoptions.apply.generic.flags |= QMF_HIDDEN|QMF_INACTIVE; |
| 602 |
|
| 603 |
if ( s_ivo.mode != s_graphicsoptions.mode.curvalue ) |
| 604 |
{ |
| 605 |
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE); |
| 606 |
} |
| 607 |
if ( s_ivo.fullscreen != s_graphicsoptions.fs.curvalue ) |
| 608 |
{ |
| 609 |
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE); |
| 610 |
} |
| 611 |
if ( s_ivo.extensions != s_graphicsoptions.allow_extensions.curvalue ) |
| 612 |
{ |
| 613 |
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE); |
| 614 |
} |
| 615 |
if ( s_ivo.tq != s_graphicsoptions.tq.curvalue ) |
| 616 |
{ |
| 617 |
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE); |
| 618 |
} |
| 619 |
if ( s_ivo.lighting != s_graphicsoptions.lighting.curvalue ) |
| 620 |
{ |
| 621 |
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE); |
| 622 |
} |
| 623 |
if ( s_ivo.colordepth != s_graphicsoptions.colordepth.curvalue ) |
| 624 |
{ |
| 625 |
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE); |
| 626 |
} |
| 627 |
if ( s_ivo.driver != s_graphicsoptions.driver.curvalue ) |
| 628 |
{ |
| 629 |
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE); |
| 630 |
} |
| 631 |
if ( s_ivo.texturebits != s_graphicsoptions.texturebits.curvalue ) |
| 632 |
{ |
| 633 |
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE); |
| 634 |
} |
| 635 |
if ( s_ivo.geometry != s_graphicsoptions.geometry.curvalue ) |
| 636 |
{ |
| 637 |
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE); |
| 638 |
} |
| 639 |
if ( s_ivo.filter != s_graphicsoptions.filter.curvalue ) |
| 640 |
{ |
| 641 |
s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE); |
| 642 |
} |
| 643 |
|
| 644 |
GraphicsOptions_CheckConfig(); |
| 645 |
} |
| 646 |
|
| 647 |
|
| 648 |
|
| 649 |
|
| 650 |
|
| 651 |
|
| 652 |
static void GraphicsOptions_ApplyChanges( void *unused, int notification ) |
| 653 |
{ |
| 654 |
if (notification != QM_ACTIVATED) |
| 655 |
return; |
| 656 |
|
| 657 |
switch ( s_graphicsoptions.texturebits.curvalue ) |
| 658 |
{ |
| 659 |
case 0: |
| 660 |
trap_Cvar_SetValue( "r_texturebits", 0 ); |
| 661 |
break; |
| 662 |
case 1: |
| 663 |
trap_Cvar_SetValue( "r_texturebits", 16 ); |
| 664 |
break; |
| 665 |
case 2: |
| 666 |
trap_Cvar_SetValue( "r_texturebits", 32 ); |
| 667 |
break; |
| 668 |
} |
| 669 |
trap_Cvar_SetValue( "r_picmip", 3 - s_graphicsoptions.tq.curvalue ); |
| 670 |
trap_Cvar_SetValue( "r_allowExtensions", s_graphicsoptions.allow_extensions.curvalue ); |
| 671 |
|
| 672 |
if( resolutionsDetected ) |
| 673 |
{ |
| 674 |
|
| 675 |
int mode; |
| 676 |
if ( s_graphicsoptions.mode.curvalue == -1 |
| 677 |
|| s_graphicsoptions.mode.curvalue >= ARRAY_LEN( detectedResolutions ) ) |
| 678 |
s_graphicsoptions.mode.curvalue = 0; |
| 679 |
|
| 680 |
mode = GraphicsOptions_FindBuiltinResolution( s_graphicsoptions.mode.curvalue ); |
| 681 |
if( mode == -1 ) |
| 682 |
{ |
| 683 |
char w[ 16 ], h[ 16 ]; |
| 684 |
Q_strncpyz( w, detectedResolutions[ s_graphicsoptions.mode.curvalue ], sizeof( w ) ); |
| 685 |
*strchr( w, 'x' ) = 0; |
| 686 |
Q_strncpyz( h, |
| 687 |
strchr( detectedResolutions[ s_graphicsoptions.mode.curvalue ], 'x' ) + 1, sizeof( h ) ); |
| 688 |
trap_Cvar_Set( "r_customwidth", w ); |
| 689 |
trap_Cvar_Set( "r_customheight", h ); |
| 690 |
} |
| 691 |
|
| 692 |
trap_Cvar_SetValue( "r_mode", mode ); |
| 693 |
} |
| 694 |
else |
| 695 |
trap_Cvar_SetValue( "r_mode", s_graphicsoptions.mode.curvalue ); |
| 696 |
|
| 697 |
trap_Cvar_SetValue( "r_fullscreen", s_graphicsoptions.fs.curvalue ); |
| 698 |
switch ( s_graphicsoptions.colordepth.curvalue ) |
| 699 |
{ |
| 700 |
case 0: |
| 701 |
trap_Cvar_SetValue( "r_colorbits", 0 ); |
| 702 |
trap_Cvar_SetValue( "r_depthbits", 0 ); |
| 703 |
trap_Cvar_Reset( "r_stencilbits" ); |
| 704 |
break; |
| 705 |
case 1: |
| 706 |
trap_Cvar_SetValue( "r_colorbits", 16 ); |
| 707 |
trap_Cvar_SetValue( "r_depthbits", 16 ); |
| 708 |
trap_Cvar_SetValue( "r_stencilbits", 0 ); |
| 709 |
break; |
| 710 |
case 2: |
| 711 |
trap_Cvar_SetValue( "r_colorbits", 32 ); |
| 712 |
trap_Cvar_SetValue( "r_depthbits", 24 ); |
| 713 |
trap_Cvar_SetValue( "r_stencilbits", 8 ); |
| 714 |
break; |
| 715 |
} |
| 716 |
trap_Cvar_SetValue( "r_vertexLight", s_graphicsoptions.lighting.curvalue ); |
| 717 |
|
| 718 |
if ( s_graphicsoptions.geometry.curvalue == 2 ) |
| 719 |
{ |
| 720 |
trap_Cvar_SetValue( "r_lodBias", 0 ); |
| 721 |
trap_Cvar_SetValue( "r_subdivisions", 4 ); |
| 722 |
} |
| 723 |
else if ( s_graphicsoptions.geometry.curvalue == 1 ) |
| 724 |
{ |
| 725 |
trap_Cvar_SetValue( "r_lodBias", 1 ); |
| 726 |
trap_Cvar_SetValue( "r_subdivisions", 12 ); |
| 727 |
} |
| 728 |
else |
| 729 |
{ |
| 730 |
trap_Cvar_SetValue( "r_lodBias", 1 ); |
| 731 |
trap_Cvar_SetValue( "r_subdivisions", 20 ); |
| 732 |
} |
| 733 |
|
| 734 |
if ( s_graphicsoptions.filter.curvalue ) |
| 735 |
{ |
| 736 |
trap_Cvar_Set( "r_textureMode", "GL_LINEAR_MIPMAP_LINEAR" ); |
| 737 |
} |
| 738 |
else |
| 739 |
{ |
| 740 |
trap_Cvar_Set( "r_textureMode", "GL_LINEAR_MIPMAP_NEAREST" ); |
| 741 |
} |
| 742 |
|
| 743 |
trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart\n" ); |
| 744 |
} |
| 745 |
|
| 746 |
|
| 747 |
|
| 748 |
|
| 749 |
|
| 750 |
|
| 751 |
static void GraphicsOptions_Event( void* ptr, int event ) { |
| 752 |
InitialVideoOptions_s *ivo; |
| 753 |
|
| 754 |
if( event != QM_ACTIVATED ) { |
| 755 |
return; |
| 756 |
} |
| 757 |
|
| 758 |
switch( ((menucommon_s*)ptr)->id ) { |
| 759 |
case ID_RATIO: |
| 760 |
s_graphicsoptions.mode.curvalue = |
| 761 |
ratioToRes[ s_graphicsoptions.ratio.curvalue ]; |
| 762 |
|
| 763 |
|
| 764 |
case ID_MODE: |
| 765 |
|
| 766 |
if ( s_graphicsoptions.driver.curvalue == 1 ) |
| 767 |
{ |
| 768 |
if ( s_graphicsoptions.mode.curvalue < 2 ) |
| 769 |
s_graphicsoptions.mode.curvalue = 2; |
| 770 |
else if ( s_graphicsoptions.mode.curvalue > 6 ) |
| 771 |
s_graphicsoptions.mode.curvalue = 6; |
| 772 |
} |
| 773 |
s_graphicsoptions.ratio.curvalue = |
| 774 |
resToRatio[ s_graphicsoptions.mode.curvalue ]; |
| 775 |
break; |
| 776 |
|
| 777 |
case ID_LIST: |
| 778 |
ivo = &s_ivo_templates[s_graphicsoptions.list.curvalue]; |
| 779 |
|
| 780 |
s_graphicsoptions.mode.curvalue = GraphicsOptions_FindDetectedResolution(ivo->mode); |
| 781 |
s_graphicsoptions.ratio.curvalue = |
| 782 |
resToRatio[ s_graphicsoptions.mode.curvalue ]; |
| 783 |
s_graphicsoptions.tq.curvalue = ivo->tq; |
| 784 |
s_graphicsoptions.lighting.curvalue = ivo->lighting; |
| 785 |
s_graphicsoptions.colordepth.curvalue = ivo->colordepth; |
| 786 |
s_graphicsoptions.texturebits.curvalue = ivo->texturebits; |
| 787 |
s_graphicsoptions.geometry.curvalue = ivo->geometry; |
| 788 |
s_graphicsoptions.filter.curvalue = ivo->filter; |
| 789 |
s_graphicsoptions.fs.curvalue = ivo->fullscreen; |
| 790 |
break; |
| 791 |
|
| 792 |
case ID_DRIVERINFO: |
| 793 |
UI_DriverInfo_Menu(); |
| 794 |
break; |
| 795 |
|
| 796 |
case ID_BACK2: |
| 797 |
UI_PopMenu(); |
| 798 |
break; |
| 799 |
|
| 800 |
case ID_GRAPHICS: |
| 801 |
break; |
| 802 |
|
| 803 |
case ID_DISPLAY: |
| 804 |
UI_PopMenu(); |
| 805 |
UI_DisplayOptionsMenu(); |
| 806 |
break; |
| 807 |
|
| 808 |
case ID_SOUND: |
| 809 |
UI_PopMenu(); |
| 810 |
UI_SoundOptionsMenu(); |
| 811 |
break; |
| 812 |
|
| 813 |
case ID_NETWORK: |
| 814 |
UI_PopMenu(); |
| 815 |
UI_NetworkOptionsMenu(); |
| 816 |
break; |
| 817 |
} |
| 818 |
} |
| 819 |
|
| 820 |
|
| 821 |
|
| 822 |
|
| 823 |
|
| 824 |
|
| 825 |
|
| 826 |
static void GraphicsOptions_TQEvent( void *ptr, int event ) { |
| 827 |
if( event != QM_ACTIVATED ) { |
| 828 |
return; |
| 829 |
} |
| 830 |
s_graphicsoptions.tq.curvalue = (int)(s_graphicsoptions.tq.curvalue + 0.5); |
| 831 |
} |
| 832 |
|
| 833 |
|
| 834 |
|
| 835 |
|
| 836 |
|
| 837 |
|
| 838 |
|
| 839 |
void GraphicsOptions_MenuDraw (void) |
| 840 |
{ |
| 841 |
|
| 842 |
GraphicsOptions_UpdateMenuItems(); |
| 843 |
|
| 844 |
Menu_Draw( &s_graphicsoptions.menu ); |
| 845 |
} |
| 846 |
|
| 847 |
|
| 848 |
|
| 849 |
|
| 850 |
|
| 851 |
|
| 852 |
static void GraphicsOptions_SetMenuItems( void ) |
| 853 |
{ |
| 854 |
s_graphicsoptions.mode.curvalue = |
| 855 |
GraphicsOptions_FindDetectedResolution( trap_Cvar_VariableValue( "r_mode" ) ); |
| 856 |
|
| 857 |
if ( s_graphicsoptions.mode.curvalue < 0 ) |
| 858 |
{ |
| 859 |
if( resolutionsDetected ) |
| 860 |
{ |
| 861 |
int i; |
| 862 |
char buf[MAX_STRING_CHARS]; |
| 863 |
trap_Cvar_VariableStringBuffer("r_customwidth", buf, sizeof(buf)-2); |
| 864 |
buf[strlen(buf)+1] = 0; |
| 865 |
buf[strlen(buf)] = 'x'; |
| 866 |
trap_Cvar_VariableStringBuffer("r_customheight", buf+strlen(buf), sizeof(buf)-strlen(buf)); |
| 867 |
|
| 868 |
for(i = 0; detectedResolutions[i]; ++i) |
| 869 |
{ |
| 870 |
if(!Q_stricmp(buf, detectedResolutions[i])) |
| 871 |
{ |
| 872 |
s_graphicsoptions.mode.curvalue = i; |
| 873 |
break; |
| 874 |
} |
| 875 |
} |
| 876 |
if ( s_graphicsoptions.mode.curvalue < 0 ) |
| 877 |
s_graphicsoptions.mode.curvalue = 0; |
| 878 |
} |
| 879 |
else |
| 880 |
{ |
| 881 |
s_graphicsoptions.mode.curvalue = 3; |
| 882 |
} |
| 883 |
} |
| 884 |
s_graphicsoptions.ratio.curvalue = |
| 885 |
resToRatio[ s_graphicsoptions.mode.curvalue ]; |
| 886 |
s_graphicsoptions.fs.curvalue = trap_Cvar_VariableValue("r_fullscreen"); |
| 887 |
s_graphicsoptions.allow_extensions.curvalue = trap_Cvar_VariableValue("r_allowExtensions"); |
| 888 |
s_graphicsoptions.tq.curvalue = 3-trap_Cvar_VariableValue( "r_picmip"); |
| 889 |
if ( s_graphicsoptions.tq.curvalue < 0 ) |
| 890 |
{ |
| 891 |
s_graphicsoptions.tq.curvalue = 0; |
| 892 |
} |
| 893 |
else if ( s_graphicsoptions.tq.curvalue > 3 ) |
| 894 |
{ |
| 895 |
s_graphicsoptions.tq.curvalue = 3; |
| 896 |
} |
| 897 |
|
| 898 |
s_graphicsoptions.lighting.curvalue = trap_Cvar_VariableValue( "r_vertexLight" ) != 0; |
| 899 |
switch ( ( int ) trap_Cvar_VariableValue( "r_texturebits" ) ) |
| 900 |
{ |
| 901 |
default: |
| 902 |
case 0: |
| 903 |
s_graphicsoptions.texturebits.curvalue = 0; |
| 904 |
break; |
| 905 |
case 16: |
| 906 |
s_graphicsoptions.texturebits.curvalue = 1; |
| 907 |
break; |
| 908 |
case 32: |
| 909 |
s_graphicsoptions.texturebits.curvalue = 2; |
| 910 |
break; |
| 911 |
} |
| 912 |
|
| 913 |
if ( !Q_stricmp( UI_Cvar_VariableString( "r_textureMode" ), "GL_LINEAR_MIPMAP_NEAREST" ) ) |
| 914 |
{ |
| 915 |
s_graphicsoptions.filter.curvalue = 0; |
| 916 |
} |
| 917 |
else |
| 918 |
{ |
| 919 |
s_graphicsoptions.filter.curvalue = 1; |
| 920 |
} |
| 921 |
|
| 922 |
if ( trap_Cvar_VariableValue( "r_lodBias" ) > 0 ) |
| 923 |
{ |
| 924 |
if ( trap_Cvar_VariableValue( "r_subdivisions" ) >= 20 ) |
| 925 |
{ |
| 926 |
s_graphicsoptions.geometry.curvalue = 0; |
| 927 |
} |
| 928 |
else |
| 929 |
{ |
| 930 |
s_graphicsoptions.geometry.curvalue = 1; |
| 931 |
} |
| 932 |
} |
| 933 |
else |
| 934 |
{ |
| 935 |
s_graphicsoptions.geometry.curvalue = 2; |
| 936 |
} |
| 937 |
|
| 938 |
switch ( ( int ) trap_Cvar_VariableValue( "r_colorbits" ) ) |
| 939 |
{ |
| 940 |
default: |
| 941 |
case 0: |
| 942 |
s_graphicsoptions.colordepth.curvalue = 0; |
| 943 |
break; |
| 944 |
case 16: |
| 945 |
s_graphicsoptions.colordepth.curvalue = 1; |
| 946 |
break; |
| 947 |
case 32: |
| 948 |
s_graphicsoptions.colordepth.curvalue = 2; |
| 949 |
break; |
| 950 |
} |
| 951 |
|
| 952 |
if ( s_graphicsoptions.fs.curvalue == 0 ) |
| 953 |
{ |
| 954 |
s_graphicsoptions.colordepth.curvalue = 0; |
| 955 |
} |
| 956 |
if ( s_graphicsoptions.driver.curvalue == 1 ) |
| 957 |
{ |
| 958 |
s_graphicsoptions.colordepth.curvalue = 1; |
| 959 |
} |
| 960 |
} |
| 961 |
|
| 962 |
|
| 963 |
|
| 964 |
|
| 965 |
|
| 966 |
|
| 967 |
void GraphicsOptions_MenuInit( void ) |
| 968 |
{ |
| 969 |
static const char *s_driver_names[] = |
| 970 |
{ |
| 971 |
"Default", |
| 972 |
"Voodoo", |
| 973 |
NULL |
| 974 |
}; |
| 975 |
|
| 976 |
static const char *tq_names[] = |
| 977 |
{ |
| 978 |
"Default", |
| 979 |
"16 bit", |
| 980 |
"32 bit", |
| 981 |
NULL |
| 982 |
}; |
| 983 |
|
| 984 |
static const char *s_graphics_options_names[] = |
| 985 |
{ |
| 986 |
"Very High Quality", |
| 987 |
"High Quality", |
| 988 |
"Normal", |
| 989 |
"Fast", |
| 990 |
"Fastest", |
| 991 |
"Custom", |
| 992 |
NULL |
| 993 |
}; |
| 994 |
|
| 995 |
static const char *lighting_names[] = |
| 996 |
{ |
| 997 |
"Lightmap", |
| 998 |
"Vertex", |
| 999 |
NULL |
| 1000 |
}; |
| 1001 |
|
| 1002 |
static const char *colordepth_names[] = |
| 1003 |
{ |
| 1004 |
"Default", |
| 1005 |
"16 bit", |
| 1006 |
"32 bit", |
| 1007 |
NULL |
| 1008 |
}; |
| 1009 |
|
| 1010 |
static const char *filter_names[] = |
| 1011 |
{ |
| 1012 |
"Bilinear", |
| 1013 |
"Trilinear", |
| 1014 |
NULL |
| 1015 |
}; |
| 1016 |
static const char *quality_names[] = |
| 1017 |
{ |
| 1018 |
"Low", |
| 1019 |
"Medium", |
| 1020 |
"High", |
| 1021 |
NULL |
| 1022 |
}; |
| 1023 |
static const char *enabled_names[] = |
| 1024 |
{ |
| 1025 |
"Off", |
| 1026 |
"On", |
| 1027 |
NULL |
| 1028 |
}; |
| 1029 |
|
| 1030 |
int y; |
| 1031 |
|
| 1032 |
|
| 1033 |
memset( &s_graphicsoptions, 0 ,sizeof(graphicsoptions_t) ); |
| 1034 |
|
| 1035 |
GraphicsOptions_GetResolutions(); |
| 1036 |
GraphicsOptions_GetAspectRatios(); |
| 1037 |
|
| 1038 |
GraphicsOptions_Cache(); |
| 1039 |
|
| 1040 |
s_graphicsoptions.menu.wrapAround = qtrue; |
| 1041 |
s_graphicsoptions.menu.fullscreen = qtrue; |
| 1042 |
s_graphicsoptions.menu.draw = GraphicsOptions_MenuDraw; |
| 1043 |
|
| 1044 |
s_graphicsoptions.banner.generic.type = MTYPE_BTEXT; |
| 1045 |
s_graphicsoptions.banner.generic.x = 320; |
| 1046 |
s_graphicsoptions.banner.generic.y = 16; |
| 1047 |
s_graphicsoptions.banner.string = "SYSTEM SETUP"; |
| 1048 |
s_graphicsoptions.banner.color = color_white; |
| 1049 |
s_graphicsoptions.banner.style = UI_CENTER; |
| 1050 |
|
| 1051 |
s_graphicsoptions.framel.generic.type = MTYPE_BITMAP; |
| 1052 |
s_graphicsoptions.framel.generic.name = GRAPHICSOPTIONS_FRAMEL; |
| 1053 |
s_graphicsoptions.framel.generic.flags = QMF_INACTIVE; |
| 1054 |
s_graphicsoptions.framel.generic.x = 0; |
| 1055 |
s_graphicsoptions.framel.generic.y = 78; |
| 1056 |
s_graphicsoptions.framel.width = 256; |
| 1057 |
s_graphicsoptions.framel.height = 329; |
| 1058 |
|
| 1059 |
s_graphicsoptions.framer.generic.type = MTYPE_BITMAP; |
| 1060 |
s_graphicsoptions.framer.generic.name = GRAPHICSOPTIONS_FRAMER; |
| 1061 |
s_graphicsoptions.framer.generic.flags = QMF_INACTIVE; |
| 1062 |
s_graphicsoptions.framer.generic.x = 376; |
| 1063 |
s_graphicsoptions.framer.generic.y = 76; |
| 1064 |
s_graphicsoptions.framer.width = 256; |
| 1065 |
s_graphicsoptions.framer.height = 334; |
| 1066 |
|
| 1067 |
s_graphicsoptions.graphics.generic.type = MTYPE_PTEXT; |
| 1068 |
s_graphicsoptions.graphics.generic.flags = QMF_RIGHT_JUSTIFY; |
| 1069 |
s_graphicsoptions.graphics.generic.id = ID_GRAPHICS; |
| 1070 |
s_graphicsoptions.graphics.generic.callback = GraphicsOptions_Event; |
| 1071 |
s_graphicsoptions.graphics.generic.x = 216; |
| 1072 |
s_graphicsoptions.graphics.generic.y = 240 - 2 * PROP_HEIGHT; |
| 1073 |
s_graphicsoptions.graphics.string = "GRAPHICS"; |
| 1074 |
s_graphicsoptions.graphics.style = UI_RIGHT; |
| 1075 |
s_graphicsoptions.graphics.color = color_red; |
| 1076 |
|
| 1077 |
s_graphicsoptions.display.generic.type = MTYPE_PTEXT; |
| 1078 |
s_graphicsoptions.display.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS; |
| 1079 |
s_graphicsoptions.display.generic.id = ID_DISPLAY; |
| 1080 |
s_graphicsoptions.display.generic.callback = GraphicsOptions_Event; |
| 1081 |
s_graphicsoptions.display.generic.x = 216; |
| 1082 |
s_graphicsoptions.display.generic.y = 240 - PROP_HEIGHT; |
| 1083 |
s_graphicsoptions.display.string = "DISPLAY"; |
| 1084 |
s_graphicsoptions.display.style = UI_RIGHT; |
| 1085 |
s_graphicsoptions.display.color = color_red; |
| 1086 |
|
| 1087 |
s_graphicsoptions.sound.generic.type = MTYPE_PTEXT; |
| 1088 |
s_graphicsoptions.sound.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS; |
| 1089 |
s_graphicsoptions.sound.generic.id = ID_SOUND; |
| 1090 |
s_graphicsoptions.sound.generic.callback = GraphicsOptions_Event; |
| 1091 |
s_graphicsoptions.sound.generic.x = 216; |
| 1092 |
s_graphicsoptions.sound.generic.y = 240; |
| 1093 |
s_graphicsoptions.sound.string = "SOUND"; |
| 1094 |
s_graphicsoptions.sound.style = UI_RIGHT; |
| 1095 |
s_graphicsoptions.sound.color = color_red; |
| 1096 |
|
| 1097 |
s_graphicsoptions.network.generic.type = MTYPE_PTEXT; |
| 1098 |
s_graphicsoptions.network.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS; |
| 1099 |
s_graphicsoptions.network.generic.id = ID_NETWORK; |
| 1100 |
s_graphicsoptions.network.generic.callback = GraphicsOptions_Event; |
| 1101 |
s_graphicsoptions.network.generic.x = 216; |
| 1102 |
s_graphicsoptions.network.generic.y = 240 + PROP_HEIGHT; |
| 1103 |
s_graphicsoptions.network.string = "NETWORK"; |
| 1104 |
s_graphicsoptions.network.style = UI_RIGHT; |
| 1105 |
s_graphicsoptions.network.color = color_red; |
| 1106 |
|
| 1107 |
y = 240 - 7 * (BIGCHAR_HEIGHT + 2); |
| 1108 |
s_graphicsoptions.list.generic.type = MTYPE_SPINCONTROL; |
| 1109 |
s_graphicsoptions.list.generic.name = "Graphics Settings:"; |
| 1110 |
s_graphicsoptions.list.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 1111 |
s_graphicsoptions.list.generic.x = 400; |
| 1112 |
s_graphicsoptions.list.generic.y = y; |
| 1113 |
s_graphicsoptions.list.generic.callback = GraphicsOptions_Event; |
| 1114 |
s_graphicsoptions.list.generic.id = ID_LIST; |
| 1115 |
s_graphicsoptions.list.itemnames = s_graphics_options_names; |
| 1116 |
y += 2 * ( BIGCHAR_HEIGHT + 2 ); |
| 1117 |
|
| 1118 |
s_graphicsoptions.driver.generic.type = MTYPE_SPINCONTROL; |
| 1119 |
s_graphicsoptions.driver.generic.name = "GL Driver:"; |
| 1120 |
s_graphicsoptions.driver.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 1121 |
s_graphicsoptions.driver.generic.x = 400; |
| 1122 |
s_graphicsoptions.driver.generic.y = y; |
| 1123 |
s_graphicsoptions.driver.itemnames = s_driver_names; |
| 1124 |
s_graphicsoptions.driver.curvalue = (uis.glconfig.driverType == GLDRV_VOODOO); |
| 1125 |
y += BIGCHAR_HEIGHT+2; |
| 1126 |
|
| 1127 |
|
| 1128 |
s_graphicsoptions.allow_extensions.generic.type = MTYPE_SPINCONTROL; |
| 1129 |
s_graphicsoptions.allow_extensions.generic.name = "GL Extensions:"; |
| 1130 |
s_graphicsoptions.allow_extensions.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 1131 |
s_graphicsoptions.allow_extensions.generic.x = 400; |
| 1132 |
s_graphicsoptions.allow_extensions.generic.y = y; |
| 1133 |
s_graphicsoptions.allow_extensions.itemnames = enabled_names; |
| 1134 |
y += BIGCHAR_HEIGHT+2; |
| 1135 |
|
| 1136 |
s_graphicsoptions.ratio.generic.type = MTYPE_SPINCONTROL; |
| 1137 |
s_graphicsoptions.ratio.generic.name = "Aspect Ratio:"; |
| 1138 |
s_graphicsoptions.ratio.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 1139 |
s_graphicsoptions.ratio.generic.x = 400; |
| 1140 |
s_graphicsoptions.ratio.generic.y = y; |
| 1141 |
s_graphicsoptions.ratio.itemnames = ratios; |
| 1142 |
s_graphicsoptions.ratio.generic.callback = GraphicsOptions_Event; |
| 1143 |
s_graphicsoptions.ratio.generic.id = ID_RATIO; |
| 1144 |
y += BIGCHAR_HEIGHT+2; |
| 1145 |
|
| 1146 |
|
| 1147 |
s_graphicsoptions.mode.generic.type = MTYPE_SPINCONTROL; |
| 1148 |
s_graphicsoptions.mode.generic.name = "Resolution:"; |
| 1149 |
s_graphicsoptions.mode.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 1150 |
s_graphicsoptions.mode.generic.x = 400; |
| 1151 |
s_graphicsoptions.mode.generic.y = y; |
| 1152 |
s_graphicsoptions.mode.itemnames = resolutions; |
| 1153 |
s_graphicsoptions.mode.generic.callback = GraphicsOptions_Event; |
| 1154 |
s_graphicsoptions.mode.generic.id = ID_MODE; |
| 1155 |
y += BIGCHAR_HEIGHT+2; |
| 1156 |
|
| 1157 |
|
| 1158 |
s_graphicsoptions.colordepth.generic.type = MTYPE_SPINCONTROL; |
| 1159 |
s_graphicsoptions.colordepth.generic.name = "Color Depth:"; |
| 1160 |
s_graphicsoptions.colordepth.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 1161 |
s_graphicsoptions.colordepth.generic.x = 400; |
| 1162 |
s_graphicsoptions.colordepth.generic.y = y; |
| 1163 |
s_graphicsoptions.colordepth.itemnames = colordepth_names; |
| 1164 |
y += BIGCHAR_HEIGHT+2; |
| 1165 |
|
| 1166 |
|
| 1167 |
s_graphicsoptions.fs.generic.type = MTYPE_SPINCONTROL; |
| 1168 |
s_graphicsoptions.fs.generic.name = "Fullscreen:"; |
| 1169 |
s_graphicsoptions.fs.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 1170 |
s_graphicsoptions.fs.generic.x = 400; |
| 1171 |
s_graphicsoptions.fs.generic.y = y; |
| 1172 |
s_graphicsoptions.fs.itemnames = enabled_names; |
| 1173 |
y += BIGCHAR_HEIGHT+2; |
| 1174 |
|
| 1175 |
|
| 1176 |
s_graphicsoptions.lighting.generic.type = MTYPE_SPINCONTROL; |
| 1177 |
s_graphicsoptions.lighting.generic.name = "Lighting:"; |
| 1178 |
s_graphicsoptions.lighting.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 1179 |
s_graphicsoptions.lighting.generic.x = 400; |
| 1180 |
s_graphicsoptions.lighting.generic.y = y; |
| 1181 |
s_graphicsoptions.lighting.itemnames = lighting_names; |
| 1182 |
y += BIGCHAR_HEIGHT+2; |
| 1183 |
|
| 1184 |
|
| 1185 |
s_graphicsoptions.geometry.generic.type = MTYPE_SPINCONTROL; |
| 1186 |
s_graphicsoptions.geometry.generic.name = "Geometric Detail:"; |
| 1187 |
s_graphicsoptions.geometry.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 1188 |
s_graphicsoptions.geometry.generic.x = 400; |
| 1189 |
s_graphicsoptions.geometry.generic.y = y; |
| 1190 |
s_graphicsoptions.geometry.itemnames = quality_names; |
| 1191 |
y += BIGCHAR_HEIGHT+2; |
| 1192 |
|
| 1193 |
|
| 1194 |
s_graphicsoptions.tq.generic.type = MTYPE_SLIDER; |
| 1195 |
s_graphicsoptions.tq.generic.name = "Texture Detail:"; |
| 1196 |
s_graphicsoptions.tq.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 1197 |
s_graphicsoptions.tq.generic.x = 400; |
| 1198 |
s_graphicsoptions.tq.generic.y = y; |
| 1199 |
s_graphicsoptions.tq.minvalue = 0; |
| 1200 |
s_graphicsoptions.tq.maxvalue = 3; |
| 1201 |
s_graphicsoptions.tq.generic.callback = GraphicsOptions_TQEvent; |
| 1202 |
y += BIGCHAR_HEIGHT+2; |
| 1203 |
|
| 1204 |
|
| 1205 |
s_graphicsoptions.texturebits.generic.type = MTYPE_SPINCONTROL; |
| 1206 |
s_graphicsoptions.texturebits.generic.name = "Texture Quality:"; |
| 1207 |
s_graphicsoptions.texturebits.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 1208 |
s_graphicsoptions.texturebits.generic.x = 400; |
| 1209 |
s_graphicsoptions.texturebits.generic.y = y; |
| 1210 |
s_graphicsoptions.texturebits.itemnames = tq_names; |
| 1211 |
y += BIGCHAR_HEIGHT+2; |
| 1212 |
|
| 1213 |
|
| 1214 |
s_graphicsoptions.filter.generic.type = MTYPE_SPINCONTROL; |
| 1215 |
s_graphicsoptions.filter.generic.name = "Texture Filter:"; |
| 1216 |
s_graphicsoptions.filter.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 1217 |
s_graphicsoptions.filter.generic.x = 400; |
| 1218 |
s_graphicsoptions.filter.generic.y = y; |
| 1219 |
s_graphicsoptions.filter.itemnames = filter_names; |
| 1220 |
y += 2*BIGCHAR_HEIGHT; |
| 1221 |
|
| 1222 |
s_graphicsoptions.driverinfo.generic.type = MTYPE_PTEXT; |
| 1223 |
s_graphicsoptions.driverinfo.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS; |
| 1224 |
s_graphicsoptions.driverinfo.generic.callback = GraphicsOptions_Event; |
| 1225 |
s_graphicsoptions.driverinfo.generic.id = ID_DRIVERINFO; |
| 1226 |
s_graphicsoptions.driverinfo.generic.x = 320; |
| 1227 |
s_graphicsoptions.driverinfo.generic.y = y; |
| 1228 |
s_graphicsoptions.driverinfo.string = "Driver Info"; |
| 1229 |
s_graphicsoptions.driverinfo.style = UI_CENTER|UI_SMALLFONT; |
| 1230 |
s_graphicsoptions.driverinfo.color = color_red; |
| 1231 |
|
| 1232 |
s_graphicsoptions.back.generic.type = MTYPE_BITMAP; |
| 1233 |
s_graphicsoptions.back.generic.name = GRAPHICSOPTIONS_BACK0; |
| 1234 |
s_graphicsoptions.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; |
| 1235 |
s_graphicsoptions.back.generic.callback = GraphicsOptions_Event; |
| 1236 |
s_graphicsoptions.back.generic.id = ID_BACK2; |
| 1237 |
s_graphicsoptions.back.generic.x = 0; |
| 1238 |
s_graphicsoptions.back.generic.y = 480-64; |
| 1239 |
s_graphicsoptions.back.width = 128; |
| 1240 |
s_graphicsoptions.back.height = 64; |
| 1241 |
s_graphicsoptions.back.focuspic = GRAPHICSOPTIONS_BACK1; |
| 1242 |
|
| 1243 |
s_graphicsoptions.apply.generic.type = MTYPE_BITMAP; |
| 1244 |
s_graphicsoptions.apply.generic.name = GRAPHICSOPTIONS_ACCEPT0; |
| 1245 |
s_graphicsoptions.apply.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_HIDDEN|QMF_INACTIVE; |
| 1246 |
s_graphicsoptions.apply.generic.callback = GraphicsOptions_ApplyChanges; |
| 1247 |
s_graphicsoptions.apply.generic.x = 640; |
| 1248 |
s_graphicsoptions.apply.generic.y = 480-64; |
| 1249 |
s_graphicsoptions.apply.width = 128; |
| 1250 |
s_graphicsoptions.apply.height = 64; |
| 1251 |
s_graphicsoptions.apply.focuspic = GRAPHICSOPTIONS_ACCEPT1; |
| 1252 |
|
| 1253 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.banner ); |
| 1254 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.framel ); |
| 1255 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.framer ); |
| 1256 |
|
| 1257 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.graphics ); |
| 1258 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.display ); |
| 1259 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.sound ); |
| 1260 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.network ); |
| 1261 |
|
| 1262 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.list ); |
| 1263 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.driver ); |
| 1264 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.allow_extensions ); |
| 1265 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.ratio ); |
| 1266 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.mode ); |
| 1267 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.colordepth ); |
| 1268 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.fs ); |
| 1269 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.lighting ); |
| 1270 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.geometry ); |
| 1271 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.tq ); |
| 1272 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.texturebits ); |
| 1273 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.filter ); |
| 1274 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.driverinfo ); |
| 1275 |
|
| 1276 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.back ); |
| 1277 |
Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.apply ); |
| 1278 |
|
| 1279 |
GraphicsOptions_SetMenuItems(); |
| 1280 |
GraphicsOptions_GetInitialVideo(); |
| 1281 |
|
| 1282 |
if ( uis.glconfig.driverType == GLDRV_ICD && |
| 1283 |
uis.glconfig.hardwareType == GLHW_3DFX_2D3D ) |
| 1284 |
{ |
| 1285 |
s_graphicsoptions.driver.generic.flags |= QMF_HIDDEN|QMF_INACTIVE; |
| 1286 |
} |
| 1287 |
} |
| 1288 |
|
| 1289 |
|
| 1290 |
|
| 1291 |
|
| 1292 |
|
| 1293 |
|
| 1294 |
|
| 1295 |
void GraphicsOptions_Cache( void ) { |
| 1296 |
trap_R_RegisterShaderNoMip( GRAPHICSOPTIONS_FRAMEL ); |
| 1297 |
trap_R_RegisterShaderNoMip( GRAPHICSOPTIONS_FRAMER ); |
| 1298 |
trap_R_RegisterShaderNoMip( GRAPHICSOPTIONS_BACK0 ); |
| 1299 |
trap_R_RegisterShaderNoMip( GRAPHICSOPTIONS_BACK1 ); |
| 1300 |
trap_R_RegisterShaderNoMip( GRAPHICSOPTIONS_ACCEPT0 ); |
| 1301 |
trap_R_RegisterShaderNoMip( GRAPHICSOPTIONS_ACCEPT1 ); |
| 1302 |
} |
| 1303 |
|
| 1304 |
|
| 1305 |
|
| 1306 |
|
| 1307 |
|
| 1308 |
|
| 1309 |
|
| 1310 |
void UI_GraphicsOptionsMenu( void ) { |
| 1311 |
GraphicsOptions_MenuInit(); |
| 1312 |
UI_PushMenu( &s_graphicsoptions.menu ); |
| 1313 |
Menu_SetCursorToItem( &s_graphicsoptions.menu, &s_graphicsoptions.graphics ); |
| 1314 |
} |
| 1315 |
|