1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
This file is part of Quake III Arena source code.
Quake III Arena source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
Quake III Arena source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Quake III Arena source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
/*
=======================================================================
SYSTEM CONFIGURATION MENU
=======================================================================
*/
#include "ui_local.h"
#define ART_FRAMEL "menu/art/frame2_l"
#define ART_FRAMER "menu/art/frame1_r"
#define ART_BACK0 "menu/art/back_0"
#define ART_BACK1 "menu/art/back_1"
#define ID_GRAPHICS 10
#define ID_DISPLAY 11
#define ID_SOUND 12
#define ID_NETWORK 13
#define ID_BACK 14
#define VERTICAL_SPACING 34
typedef struct {
menuframework_s menu;
menutext_s banner;
menubitmap_s framel;
menubitmap_s framer;
menutext_s graphics;
menutext_s display;
menutext_s sound;
menutext_s network;
menubitmap_s back;
} optionsmenu_t;
static optionsmenu_t s_options;
/*
=================
Options_Event
=================
*/
static void Options_Event( void* ptr, int event ) {
if( event != QM_ACTIVATED ) {
return;
}
switch( ((menucommon_s*)ptr)->id ) {
case ID_GRAPHICS:
UI_GraphicsOptionsMenu();
break;
case ID_DISPLAY:
UI_DisplayOptionsMenu();
break;
case ID_SOUND:
UI_SoundOptionsMenu();
break;
case ID_NETWORK:
UI_NetworkOptionsMenu();
break;
case ID_BACK:
UI_PopMenu();
break;
}
}
/*
===============
SystemConfig_Cache
===============
*/
void SystemConfig_Cache( void ) {
trap_R_RegisterShaderNoMip( ART_FRAMEL );
trap_R_RegisterShaderNoMip( ART_FRAMER );
trap_R_RegisterShaderNoMip( ART_BACK0 );
trap_R_RegisterShaderNoMip( ART_BACK1 );
}
/*
===============
Options_MenuInit
===============
*/
void Options_MenuInit( void ) {
int y;
uiClientState_t cstate;
memset( &s_options, 0, sizeof(optionsmenu_t) );
SystemConfig_Cache();
s_options.menu.wrapAround = qtrue;
trap_GetClientState( &cstate );
if ( cstate.connState >= CA_CONNECTED ) {
s_options.menu.fullscreen = qfalse;
}
else {
s_options.menu.fullscreen = qtrue;
}
s_options.banner.generic.type = MTYPE_BTEXT;
s_options.banner.generic.flags = QMF_CENTER_JUSTIFY;
s_options.banner.generic.x = 320;
s_options.banner.generic.y = 16;
s_options.banner.string = "SYSTEM SETUP";
s_options.banner.color = color_white;
s_options.banner.style = UI_CENTER;
s_options.framel.generic.type = MTYPE_BITMAP;
s_options.framel.generic.name = ART_FRAMEL;
s_options.framel.generic.flags = QMF_INACTIVE;
s_options.framel.generic.x = 8;
s_options.framel.generic.y = 76;
s_options.framel.width = 256;
s_options.framel.height = 334;
s_options.framer.generic.type = MTYPE_BITMAP;
s_options.framer.generic.name = ART_FRAMER;
s_options.framer.generic.flags = QMF_INACTIVE;
s_options.framer.generic.x = 376;
s_options.framer.generic.y = 76;
s_options.framer.width = 256;
s_options.framer.height = 334;
y = 168;
s_options.graphics.generic.type = MTYPE_PTEXT;
s_options.graphics.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
s_options.graphics.generic.callback = Options_Event;
s_options.graphics.generic.id = ID_GRAPHICS;
s_options.graphics.generic.x = 320;
s_options.graphics.generic.y = y;
s_options.graphics.string = "GRAPHICS";
s_options.graphics.color = color_red;
s_options.graphics.style = UI_CENTER;
y += VERTICAL_SPACING;
s_options.display.generic.type = MTYPE_PTEXT;
s_options.display.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
s_options.display.generic.callback = Options_Event;
s_options.display.generic.id = ID_DISPLAY;
s_options.display.generic.x = 320;
s_options.display.generic.y = y;
s_options.display.string = "DISPLAY";
s_options.display.color = color_red;
s_options.display.style = UI_CENTER;
y += VERTICAL_SPACING;
s_options.sound.generic.type = MTYPE_PTEXT;
s_options.sound.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
s_options.sound.generic.callback = Options_Event;
s_options.sound.generic.id = ID_SOUND;
s_options.sound.generic.x = 320;
s_options.sound.generic.y = y;
s_options.sound.string = "SOUND";
s_options.sound.color = color_red;
s_options.sound.style = UI_CENTER;
y += VERTICAL_SPACING;
s_options.network.generic.type = MTYPE_PTEXT;
s_options.network.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
s_options.network.generic.callback = Options_Event;
s_options.network.generic.id = ID_NETWORK;
s_options.network.generic.x = 320;
s_options.network.generic.y = y;
s_options.network.string = "NETWORK";
s_options.network.color = color_red;
s_options.network.style = UI_CENTER;
s_options.back.generic.type = MTYPE_BITMAP;
s_options.back.generic.name = ART_BACK0;
s_options.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
s_options.back.generic.callback = Options_Event;
s_options.back.generic.id = ID_BACK;
s_options.back.generic.x = 0;
s_options.back.generic.y = 480-64;
s_options.back.width = 128;
s_options.back.height = 64;
s_options.back.focuspic = ART_BACK1;
Menu_AddItem( &s_options.menu, ( void * ) &s_options.banner );
Menu_AddItem( &s_options.menu, ( void * ) &s_options.framel );
Menu_AddItem( &s_options.menu, ( void * ) &s_options.framer );
Menu_AddItem( &s_options.menu, ( void * ) &s_options.graphics );
Menu_AddItem( &s_options.menu, ( void * ) &s_options.display );
Menu_AddItem( &s_options.menu, ( void * ) &s_options.sound );
Menu_AddItem( &s_options.menu, ( void * ) &s_options.network );
Menu_AddItem( &s_options.menu, ( void * ) &s_options.back );
}
/*
===============
UI_SystemConfigMenu
===============
*/
void UI_SystemConfigMenu( void ) {
Options_MenuInit();
UI_PushMenu ( &s_options.menu );
}
|