~ubuntu-branches/ubuntu/precise/openarena/precise

« back to all changes in this revision

Viewing changes to code/q3_ui/ui_video.c

  • Committer: Bazaar Package Importer
  • Author(s): Bruno "Fuddl" Kleinert
  • Date: 2007-01-20 12:28:09 UTC
  • Revision ID: james.westby@ubuntu.com-20070120122809-2yza5ojt7nqiyiam
Tags: upstream-0.6.0
ImportĀ upstreamĀ versionĀ 0.6.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
===========================================================================
 
3
Copyright (C) 1999-2005 Id Software, Inc.
 
4
 
 
5
This file is part of Quake III Arena source code.
 
6
 
 
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.
 
11
 
 
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.
 
16
 
 
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
===========================================================================
 
21
*/
 
22
//
 
23
#include "ui_local.h"
 
24
 
 
25
void GraphicsOptions_MenuInit( void );
 
26
 
 
27
/*
 
28
=======================================================================
 
29
 
 
30
DRIVER INFORMATION MENU
 
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
DriverInfo_Event
 
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
DriverInfo_MenuDraw
 
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
        // double column
 
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
DriverInfo_Cache
 
120
=================
 
121
*/
 
122
void DriverInfo_Cache( void )
 
123
{
 
124
        int     i;
 
125
 
 
126
        // touch all our pics
 
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
UI_DriverInfo_Menu
 
138
=================
 
139
*/
 
140
static void UI_DriverInfo_Menu( void )
 
141
{
 
142
        char*   eptr;
 
143
        int             i;
 
144
        int             len;
 
145
 
 
146
        // zero set all our globals
 
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
  // 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);
 
193
 
 
194
        // build null terminated extension strings
 
195
        eptr = s_driverinfo.stringbuff;
 
196
        while ( s_driverinfo.numstrings<40 && *eptr )
 
197
        {
 
198
                while ( *eptr && *eptr == ' ' )
 
199
                        *eptr++ = '\0';
 
200
 
 
201
                // track start of valid string
 
202
                if (*eptr && *eptr != ' ')
 
203
                        s_driverinfo.strings[s_driverinfo.numstrings++] = eptr;
 
204
 
 
205
                while ( *eptr && *eptr != ' ' )
 
206
                        eptr++;
 
207
        }
 
208
 
 
209
        // safety length strings for display
 
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
GRAPHICS OPTIONS MENU
 
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
static const char *s_drivers[] =
 
242
{
 
243
        OPENGL_DRIVER_NAME,
 
244
        _3DFX_DRIVER_NAME,
 
245
        NULL
 
246
};
 
247
 
 
248
#define ID_BACK2                101
 
249
#define ID_FULLSCREEN   102
 
250
#define ID_LIST                 103
 
251
#define ID_MODE                 104
 
252
#define ID_DRIVERINFO   105
 
253
#define ID_GRAPHICS             106
 
254
#define ID_DISPLAY              107
 
255
#define ID_SOUND                108
 
256
#define ID_NETWORK              109
 
257
 
 
258
typedef struct {
 
259
        menuframework_s menu;
 
260
 
 
261
        menutext_s              banner;
 
262
        menubitmap_s    framel;
 
263
        menubitmap_s    framer;
 
264
 
 
265
        menutext_s              graphics;
 
266
        menutext_s              display;
 
267
        menutext_s              sound;
 
268
        menutext_s              network;
 
269
 
 
270
        menulist_s              list;
 
271
        menulist_s              mode;
 
272
        menulist_s              driver;
 
273
        menuslider_s    tq;
 
274
        menulist_s      fs;
 
275
        menulist_s      lighting;
 
276
        menulist_s      allow_extensions;
 
277
        menulist_s      texturebits;
 
278
        menulist_s      colordepth;
 
279
        menulist_s      geometry;
 
280
        menulist_s      filter;
 
281
        menutext_s              driverinfo;
 
282
 
 
283
        menubitmap_s    apply;
 
284
        menubitmap_s    back;
 
285
} graphicsoptions_t;
 
286
 
 
287
typedef struct
 
288
{
 
289
        int mode;
 
290
        qboolean fullscreen;
 
291
        int tq;
 
292
        int lighting;
 
293
        int colordepth;
 
294
        int texturebits;
 
295
        int geometry;
 
296
        int filter;
 
297
        int driver;
 
298
        qboolean extensions;
 
299
} InitialVideoOptions_s;
 
300
 
 
301
static InitialVideoOptions_s    s_ivo;
 
302
static graphicsoptions_t                s_graphicsoptions;      
 
303
 
 
304
static InitialVideoOptions_s s_ivo_templates[] =
 
305
{
 
306
        {
 
307
                6, qtrue, 3, 0, 2, 2, 2, 1, 0, qtrue
 
308
        },
 
309
        {
 
310
                4, qtrue, 2, 0, 2, 2, 1, 1, 0, qtrue    // JDC: this was tq 3
 
311
        },
 
312
        {
 
313
                3, qtrue, 2, 0, 0, 0, 1, 0, 0, qtrue
 
314
        },
 
315
        {
 
316
                2, qtrue, 1, 0, 1, 0, 0, 0, 0, qtrue
 
317
        },
 
318
        {
 
319
                2, qtrue, 1, 1, 1, 0, 0, 0, 0, qtrue
 
320
        },
 
321
        {
 
322
                3, qtrue, 1, 0, 0, 0, 1, 0, 0, qtrue
 
323
        }
 
324
};
 
325
 
 
326
#define NUM_IVO_TEMPLATES ( sizeof( s_ivo_templates ) / sizeof( s_ivo_templates[0] ) )
 
327
 
 
328
/*
 
329
=================
 
330
GraphicsOptions_GetInitialVideo
 
331
=================
 
332
*/
 
333
static void GraphicsOptions_GetInitialVideo( void )
 
334
{
 
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;
 
345
}
 
346
 
 
347
/*
 
348
=================
 
349
GraphicsOptions_CheckConfig
 
350
=================
 
351
*/
 
352
static void GraphicsOptions_CheckConfig( void )
 
353
{
 
354
        int i;
 
355
 
 
356
        for ( i = 0; i < NUM_IVO_TEMPLATES-1; i++ )
 
357
        {
 
358
                if ( s_ivo_templates[i].colordepth != s_graphicsoptions.colordepth.curvalue )
 
359
                        continue;
 
360
                if ( s_ivo_templates[i].driver != s_graphicsoptions.driver.curvalue )
 
361
                        continue;
 
362
                if ( s_ivo_templates[i].mode != s_graphicsoptions.mode.curvalue )
 
363
                        continue;
 
364
                if ( s_ivo_templates[i].fullscreen != s_graphicsoptions.fs.curvalue )
 
365
                        continue;
 
366
                if ( s_ivo_templates[i].tq != s_graphicsoptions.tq.curvalue )
 
367
                        continue;
 
368
                if ( s_ivo_templates[i].lighting != s_graphicsoptions.lighting.curvalue )
 
369
                        continue;
 
370
                if ( s_ivo_templates[i].geometry != s_graphicsoptions.geometry.curvalue )
 
371
                        continue;
 
372
                if ( s_ivo_templates[i].filter != s_graphicsoptions.filter.curvalue )
 
373
                        continue;
 
374
//              if ( s_ivo_templates[i].texturebits != s_graphicsoptions.texturebits.curvalue )
 
375
//                      continue;
 
376
                s_graphicsoptions.list.curvalue = i;
 
377
                return;
 
378
        }
 
379
 
 
380
        // return 'Custom' ivo template
 
381
        s_graphicsoptions.list.curvalue = NUM_IVO_TEMPLATES - 1;
 
382
}
 
383
 
 
384
/*
 
385
=================
 
386
GraphicsOptions_UpdateMenuItems
 
387
=================
 
388
*/
 
389
static void GraphicsOptions_UpdateMenuItems( void )
 
390
{
 
391
        if ( s_graphicsoptions.driver.curvalue == 1 )
 
392
        {
 
393
                s_graphicsoptions.fs.curvalue = 1;
 
394
                s_graphicsoptions.fs.generic.flags |= QMF_GRAYED;
 
395
                s_graphicsoptions.colordepth.curvalue = 1;
 
396
        }
 
397
        else
 
398
        {
 
399
                s_graphicsoptions.fs.generic.flags &= ~QMF_GRAYED;
 
400
        }
 
401
 
 
402
        if ( s_graphicsoptions.fs.curvalue == 0 || s_graphicsoptions.driver.curvalue == 1 )
 
403
        {
 
404
                s_graphicsoptions.colordepth.curvalue = 0;
 
405
                s_graphicsoptions.colordepth.generic.flags |= QMF_GRAYED;
 
406
        }
 
407
        else
 
408
        {
 
409
                s_graphicsoptions.colordepth.generic.flags &= ~QMF_GRAYED;
 
410
        }
 
411
 
 
412
        if ( s_graphicsoptions.allow_extensions.curvalue == 0 )
 
413
        {
 
414
                if ( s_graphicsoptions.texturebits.curvalue == 0 )
 
415
                {
 
416
                        s_graphicsoptions.texturebits.curvalue = 1;
 
417
                }
 
418
        }
 
419
 
 
420
        s_graphicsoptions.apply.generic.flags |= QMF_HIDDEN|QMF_INACTIVE;
 
421
 
 
422
        if ( s_ivo.mode != s_graphicsoptions.mode.curvalue )
 
423
        {
 
424
                s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
 
425
        }
 
426
        if ( s_ivo.fullscreen != s_graphicsoptions.fs.curvalue )
 
427
        {
 
428
                s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
 
429
        }
 
430
        if ( s_ivo.extensions != s_graphicsoptions.allow_extensions.curvalue )
 
431
        {
 
432
                s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
 
433
        }
 
434
        if ( s_ivo.tq != s_graphicsoptions.tq.curvalue )
 
435
        {
 
436
                s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
 
437
        }
 
438
        if ( s_ivo.lighting != s_graphicsoptions.lighting.curvalue )
 
439
        {
 
440
                s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
 
441
        }
 
442
        if ( s_ivo.colordepth != s_graphicsoptions.colordepth.curvalue )
 
443
        {
 
444
                s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
 
445
        }
 
446
        if ( s_ivo.driver != s_graphicsoptions.driver.curvalue )
 
447
        {
 
448
                s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
 
449
        }
 
450
        if ( s_ivo.texturebits != s_graphicsoptions.texturebits.curvalue )
 
451
        {
 
452
                s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
 
453
        }
 
454
        if ( s_ivo.geometry != s_graphicsoptions.geometry.curvalue )
 
455
        {
 
456
                s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
 
457
        }
 
458
        if ( s_ivo.filter != s_graphicsoptions.filter.curvalue )
 
459
        {
 
460
                s_graphicsoptions.apply.generic.flags &= ~(QMF_HIDDEN|QMF_INACTIVE);
 
461
        }
 
462
 
 
463
        GraphicsOptions_CheckConfig();
 
464
}       
 
465
 
 
466
/*
 
467
=================
 
468
GraphicsOptions_ApplyChanges
 
469
=================
 
470
*/
 
471
static void GraphicsOptions_ApplyChanges( void *unused, int notification )
 
472
{
 
473
        if (notification != QM_ACTIVATED)
 
474
                return;
 
475
 
 
476
        switch ( s_graphicsoptions.texturebits.curvalue  )
 
477
        {
 
478
        case 0:
 
479
                trap_Cvar_SetValue( "r_texturebits", 0 );
 
480
                break;
 
481
        case 1:
 
482
                trap_Cvar_SetValue( "r_texturebits", 16 );
 
483
                break;
 
484
        case 2:
 
485
                trap_Cvar_SetValue( "r_texturebits", 32 );
 
486
                break;
 
487
        }
 
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 )
 
494
        {
 
495
        case 0:
 
496
                trap_Cvar_SetValue( "r_colorbits", 0 );
 
497
                trap_Cvar_SetValue( "r_depthbits", 0 );
 
498
                trap_Cvar_SetValue( "r_stencilbits", 0 );
 
499
                break;
 
500
        case 1:
 
501
                trap_Cvar_SetValue( "r_colorbits", 16 );
 
502
                trap_Cvar_SetValue( "r_depthbits", 16 );
 
503
                trap_Cvar_SetValue( "r_stencilbits", 0 );
 
504
                break;
 
505
        case 2:
 
506
                trap_Cvar_SetValue( "r_colorbits", 32 );
 
507
                trap_Cvar_SetValue( "r_depthbits", 24 );
 
508
                break;
 
509
        }
 
510
        trap_Cvar_SetValue( "r_vertexLight", s_graphicsoptions.lighting.curvalue );
 
511
 
 
512
        if ( s_graphicsoptions.geometry.curvalue == 2 )
 
513
        {
 
514
                trap_Cvar_SetValue( "r_lodBias", 0 );
 
515
                trap_Cvar_SetValue( "r_subdivisions", 4 );
 
516
        }
 
517
        else if ( s_graphicsoptions.geometry.curvalue == 1 )
 
518
        {
 
519
                trap_Cvar_SetValue( "r_lodBias", 1 );
 
520
                trap_Cvar_SetValue( "r_subdivisions", 12 );
 
521
        }
 
522
        else
 
523
        {
 
524
                trap_Cvar_SetValue( "r_lodBias", 1 );
 
525
                trap_Cvar_SetValue( "r_subdivisions", 20 );
 
526
        }
 
527
 
 
528
        if ( s_graphicsoptions.filter.curvalue )
 
529
        {
 
530
                trap_Cvar_Set( "r_textureMode", "GL_LINEAR_MIPMAP_LINEAR" );
 
531
        }
 
532
        else
 
533
        {
 
534
                trap_Cvar_Set( "r_textureMode", "GL_LINEAR_MIPMAP_NEAREST" );
 
535
        }
 
536
 
 
537
        trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart\n" );
 
538
}
 
539
 
 
540
/*
 
541
=================
 
542
GraphicsOptions_Event
 
543
=================
 
544
*/
 
545
static void GraphicsOptions_Event( void* ptr, int event ) {
 
546
        InitialVideoOptions_s *ivo;
 
547
 
 
548
        if( event != QM_ACTIVATED ) {
 
549
                return;
 
550
        }
 
551
 
 
552
        switch( ((menucommon_s*)ptr)->id ) {
 
553
        case ID_MODE:
 
554
                // clamp 3dfx video modes
 
555
                if ( s_graphicsoptions.driver.curvalue == 1 )
 
556
                {
 
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;
 
561
                }
 
562
                break;
 
563
 
 
564
        case ID_LIST:
 
565
                ivo = &s_ivo_templates[s_graphicsoptions.list.curvalue];
 
566
 
 
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;
 
575
                break;
 
576
 
 
577
        case ID_DRIVERINFO:
 
578
                UI_DriverInfo_Menu();
 
579
                break;
 
580
 
 
581
        case ID_BACK2:
 
582
                UI_PopMenu();
 
583
                break;
 
584
 
 
585
        case ID_GRAPHICS:
 
586
                break;
 
587
 
 
588
        case ID_DISPLAY:
 
589
                UI_PopMenu();
 
590
                UI_DisplayOptionsMenu();
 
591
                break;
 
592
 
 
593
        case ID_SOUND:
 
594
                UI_PopMenu();
 
595
                UI_SoundOptionsMenu();
 
596
                break;
 
597
 
 
598
        case ID_NETWORK:
 
599
                UI_PopMenu();
 
600
                UI_NetworkOptionsMenu();
 
601
                break;
 
602
        }
 
603
}
 
604
 
 
605
 
 
606
/*
 
607
================
 
608
GraphicsOptions_TQEvent
 
609
================
 
610
*/
 
611
static void GraphicsOptions_TQEvent( void *ptr, int event ) {
 
612
        if( event != QM_ACTIVATED ) {
 
613
                return;
 
614
        }
 
615
        s_graphicsoptions.tq.curvalue = (int)(s_graphicsoptions.tq.curvalue + 0.5);
 
616
}
 
617
 
 
618
 
 
619
/*
 
620
================
 
621
GraphicsOptions_MenuDraw
 
622
================
 
623
*/
 
624
void GraphicsOptions_MenuDraw (void)
 
625
{
 
626
//APSFIX - rework this
 
627
        GraphicsOptions_UpdateMenuItems();
 
628
 
 
629
        Menu_Draw( &s_graphicsoptions.menu );
 
630
}
 
631
 
 
632
/*
 
633
=================
 
634
GraphicsOptions_SetMenuItems
 
635
=================
 
636
*/
 
637
static void GraphicsOptions_SetMenuItems( void )
 
638
{
 
639
        s_graphicsoptions.mode.curvalue = trap_Cvar_VariableValue( "r_mode" );
 
640
        if ( s_graphicsoptions.mode.curvalue < 0 )
 
641
        {
 
642
                s_graphicsoptions.mode.curvalue = 3;
 
643
        }
 
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 )
 
648
        {
 
649
                s_graphicsoptions.tq.curvalue = 0;
 
650
        }
 
651
        else if ( s_graphicsoptions.tq.curvalue > 3 )
 
652
        {
 
653
                s_graphicsoptions.tq.curvalue = 3;
 
654
        }
 
655
 
 
656
        s_graphicsoptions.lighting.curvalue = trap_Cvar_VariableValue( "r_vertexLight" ) != 0;
 
657
        switch ( ( int ) trap_Cvar_VariableValue( "r_texturebits" ) )
 
658
        {
 
659
        default:
 
660
        case 0:
 
661
                s_graphicsoptions.texturebits.curvalue = 0;
 
662
                break;
 
663
        case 16:
 
664
                s_graphicsoptions.texturebits.curvalue = 1;
 
665
                break;
 
666
        case 32:
 
667
                s_graphicsoptions.texturebits.curvalue = 2;
 
668
                break;
 
669
        }
 
670
 
 
671
        if ( !Q_stricmp( UI_Cvar_VariableString( "r_textureMode" ), "GL_LINEAR_MIPMAP_NEAREST" ) )
 
672
        {
 
673
                s_graphicsoptions.filter.curvalue = 0;
 
674
        }
 
675
        else
 
676
        {
 
677
                s_graphicsoptions.filter.curvalue = 1;
 
678
        }
 
679
 
 
680
        if ( trap_Cvar_VariableValue( "r_lodBias" ) > 0 )
 
681
        {
 
682
                if ( trap_Cvar_VariableValue( "r_subdivisions" ) >= 20 )
 
683
                {
 
684
                        s_graphicsoptions.geometry.curvalue = 0;
 
685
                }
 
686
                else
 
687
                {
 
688
                        s_graphicsoptions.geometry.curvalue = 1;
 
689
                }
 
690
        }
 
691
        else
 
692
        {
 
693
                s_graphicsoptions.geometry.curvalue = 2;
 
694
        }
 
695
 
 
696
        switch ( ( int ) trap_Cvar_VariableValue( "r_colorbits" ) )
 
697
        {
 
698
        default:
 
699
        case 0:
 
700
                s_graphicsoptions.colordepth.curvalue = 0;
 
701
                break;
 
702
        case 16:
 
703
                s_graphicsoptions.colordepth.curvalue = 1;
 
704
                break;
 
705
        case 32:
 
706
                s_graphicsoptions.colordepth.curvalue = 2;
 
707
                break;
 
708
        }
 
709
 
 
710
        if ( s_graphicsoptions.fs.curvalue == 0 )
 
711
        {
 
712
                s_graphicsoptions.colordepth.curvalue = 0;
 
713
        }
 
714
        if ( s_graphicsoptions.driver.curvalue == 1 )
 
715
        {
 
716
                s_graphicsoptions.colordepth.curvalue = 1;
 
717
        }
 
718
}
 
719
 
 
720
/*
 
721
================
 
722
GraphicsOptions_MenuInit
 
723
================
 
724
*/
 
725
void GraphicsOptions_MenuInit( void )
 
726
{
 
727
        static const char *s_driver_names[] =
 
728
        {
 
729
                "Default",
 
730
                "Voodoo",
 
731
                NULL
 
732
        };
 
733
 
 
734
        static const char *tq_names[] =
 
735
        {
 
736
                "Default",
 
737
                "16 bit",
 
738
                "32 bit",
 
739
                NULL
 
740
        };
 
741
 
 
742
        static const char *s_graphics_options_names[] =
 
743
        {
 
744
                "Very High Quality",
 
745
                "High Quality",
 
746
                "Normal",
 
747
                "Fast",
 
748
                "Fastest",
 
749
                "Custom",
 
750
                NULL
 
751
        };
 
752
 
 
753
        static const char *lighting_names[] =
 
754
        {
 
755
                "Lightmap",
 
756
                "Vertex",
 
757
                NULL
 
758
        };
 
759
 
 
760
        static const char *colordepth_names[] =
 
761
        {
 
762
                "Default",
 
763
                "16 bit",
 
764
                "32 bit",
 
765
                NULL
 
766
        };
 
767
 
 
768
        static const char *resolutions[] = 
 
769
        {
 
770
                "320x240",
 
771
                "400x300",
 
772
                "512x384",
 
773
                "640x480",
 
774
                "800x600",
 
775
                "960x720",
 
776
                "1024x768",
 
777
                "1152x864",
 
778
                "1280x1024",
 
779
                "1600x1200",
 
780
                "2048x1536",
 
781
                "856x480 wide screen",
 
782
                NULL
 
783
        };
 
784
        static const char *filter_names[] =
 
785
        {
 
786
                "Bilinear",
 
787
                "Trilinear",
 
788
                NULL
 
789
        };
 
790
        static const char *quality_names[] =
 
791
        {
 
792
                "Low",
 
793
                "Medium",
 
794
                "High",
 
795
                NULL
 
796
        };
 
797
        static const char *enabled_names[] =
 
798
        {
 
799
                "Off",
 
800
                "On",
 
801
                NULL
 
802
        };
 
803
 
 
804
        int y;
 
805
 
 
806
        // zero set all our globals
 
807
        memset( &s_graphicsoptions, 0 ,sizeof(graphicsoptions_t) );
 
808
 
 
809
        GraphicsOptions_Cache();
 
810
 
 
811
        s_graphicsoptions.menu.wrapAround = qtrue;
 
812
        s_graphicsoptions.menu.fullscreen = qtrue;
 
813
        s_graphicsoptions.menu.draw       = GraphicsOptions_MenuDraw;
 
814
 
 
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;
 
821
 
 
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;
 
829
 
 
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;
 
837
 
 
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;
 
847
 
 
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;
 
857
 
 
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;
 
867
 
 
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;
 
877
 
 
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 );
 
888
 
 
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;
 
897
 
 
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;
 
906
 
 
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;
 
917
 
 
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;
 
926
 
 
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;
 
935
 
 
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;
 
944
 
 
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;
 
953
 
 
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;
 
964
 
 
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;
 
973
 
 
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;
 
982
 
 
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;
 
993
 
 
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;
 
1004
 
 
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;
 
1014
 
 
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 );
 
1018
 
 
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 );
 
1023
 
 
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 );
 
1036
 
 
1037
        Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.back );
 
1038
        Menu_AddItem( &s_graphicsoptions.menu, ( void * ) &s_graphicsoptions.apply );
 
1039
 
 
1040
        GraphicsOptions_SetMenuItems();
 
1041
        GraphicsOptions_GetInitialVideo();
 
1042
 
 
1043
        if ( uis.glconfig.driverType == GLDRV_ICD &&
 
1044
                 uis.glconfig.hardwareType == GLHW_3DFX_2D3D )
 
1045
        {
 
1046
                s_graphicsoptions.driver.generic.flags |= QMF_HIDDEN|QMF_INACTIVE;
 
1047
        }
 
1048
}
 
1049
 
 
1050
 
 
1051
/*
 
1052
=================
 
1053
GraphicsOptions_Cache
 
1054
=================
 
1055
*/
 
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 );
 
1063
}
 
1064
 
 
1065
 
 
1066
/*
 
1067
=================
 
1068
UI_GraphicsOptionsMenu
 
1069
=================
 
1070
*/
 
1071
void UI_GraphicsOptionsMenu( void ) {
 
1072
        GraphicsOptions_MenuInit();
 
1073
        UI_PushMenu( &s_graphicsoptions.menu );
 
1074
        Menu_SetCursorToItem( &s_graphicsoptions.menu, &s_graphicsoptions.graphics );
 
1075
}
 
1076