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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
|
/*
===========================================================================
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 Foobar; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
//
/*
=======================================================================
NETWORK OPTIONS 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_RATE 14
#define ID_BACK 15
static const char *rate_items[] = {
"<= 28.8K",
"33.6K",
"56K",
"ISDN",
"LAN/Cable/xDSL",
0
};
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;
menulist_s rate;
menubitmap_s back;
} networkOptionsInfo_t;
static networkOptionsInfo_t networkOptionsInfo;
/*
=================
UI_NetworkOptionsMenu_Event
=================
*/
static void UI_NetworkOptionsMenu_Event( void* ptr, int event ) {
if( event != QM_ACTIVATED ) {
return;
}
switch( ((menucommon_s*)ptr)->id ) {
case ID_GRAPHICS:
UI_PopMenu();
UI_GraphicsOptionsMenu();
break;
case ID_DISPLAY:
UI_PopMenu();
UI_DisplayOptionsMenu();
break;
case ID_SOUND:
UI_PopMenu();
UI_SoundOptionsMenu();
break;
case ID_NETWORK:
break;
case ID_RATE:
if( networkOptionsInfo.rate.curvalue == 0 ) {
trap_Cvar_SetValue( "rate", 2500 );
}
else if( networkOptionsInfo.rate.curvalue == 1 ) {
trap_Cvar_SetValue( "rate", 3000 );
}
else if( networkOptionsInfo.rate.curvalue == 2 ) {
trap_Cvar_SetValue( "rate", 4000 );
}
else if( networkOptionsInfo.rate.curvalue == 3 ) {
trap_Cvar_SetValue( "rate", 5000 );
}
else if( networkOptionsInfo.rate.curvalue == 4 ) {
trap_Cvar_SetValue( "rate", 25000 );
}
break;
case ID_BACK:
UI_PopMenu();
break;
}
}
/*
===============
UI_NetworkOptionsMenu_Init
===============
*/
static void UI_NetworkOptionsMenu_Init( void ) {
int y;
int rate;
memset( &networkOptionsInfo, 0, sizeof(networkOptionsInfo) );
UI_NetworkOptionsMenu_Cache();
networkOptionsInfo.menu.wrapAround = qtrue;
networkOptionsInfo.menu.fullscreen = qtrue;
networkOptionsInfo.banner.generic.type = MTYPE_BTEXT;
networkOptionsInfo.banner.generic.flags = QMF_CENTER_JUSTIFY;
networkOptionsInfo.banner.generic.x = 320;
networkOptionsInfo.banner.generic.y = 16;
networkOptionsInfo.banner.string = "SYSTEM SETUP";
networkOptionsInfo.banner.color = color_white;
networkOptionsInfo.banner.style = UI_CENTER;
networkOptionsInfo.framel.generic.type = MTYPE_BITMAP;
networkOptionsInfo.framel.generic.name = ART_FRAMEL;
networkOptionsInfo.framel.generic.flags = QMF_INACTIVE;
networkOptionsInfo.framel.generic.x = 0;
networkOptionsInfo.framel.generic.y = 78;
networkOptionsInfo.framel.width = 256;
networkOptionsInfo.framel.height = 329;
networkOptionsInfo.framer.generic.type = MTYPE_BITMAP;
networkOptionsInfo.framer.generic.name = ART_FRAMER;
networkOptionsInfo.framer.generic.flags = QMF_INACTIVE;
networkOptionsInfo.framer.generic.x = 376;
networkOptionsInfo.framer.generic.y = 76;
networkOptionsInfo.framer.width = 256;
networkOptionsInfo.framer.height = 334;
networkOptionsInfo.graphics.generic.type = MTYPE_PTEXT;
networkOptionsInfo.graphics.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
networkOptionsInfo.graphics.generic.id = ID_GRAPHICS;
networkOptionsInfo.graphics.generic.callback = UI_NetworkOptionsMenu_Event;
networkOptionsInfo.graphics.generic.x = 216;
networkOptionsInfo.graphics.generic.y = 240 - 2 * PROP_HEIGHT;
networkOptionsInfo.graphics.string = "GRAPHICS";
networkOptionsInfo.graphics.style = UI_RIGHT;
networkOptionsInfo.graphics.color = color_red;
networkOptionsInfo.display.generic.type = MTYPE_PTEXT;
networkOptionsInfo.display.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
networkOptionsInfo.display.generic.id = ID_DISPLAY;
networkOptionsInfo.display.generic.callback = UI_NetworkOptionsMenu_Event;
networkOptionsInfo.display.generic.x = 216;
networkOptionsInfo.display.generic.y = 240 - PROP_HEIGHT;
networkOptionsInfo.display.string = "DISPLAY";
networkOptionsInfo.display.style = UI_RIGHT;
networkOptionsInfo.display.color = color_red;
networkOptionsInfo.sound.generic.type = MTYPE_PTEXT;
networkOptionsInfo.sound.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
networkOptionsInfo.sound.generic.id = ID_SOUND;
networkOptionsInfo.sound.generic.callback = UI_NetworkOptionsMenu_Event;
networkOptionsInfo.sound.generic.x = 216;
networkOptionsInfo.sound.generic.y = 240;
networkOptionsInfo.sound.string = "SOUND";
networkOptionsInfo.sound.style = UI_RIGHT;
networkOptionsInfo.sound.color = color_red;
networkOptionsInfo.network.generic.type = MTYPE_PTEXT;
networkOptionsInfo.network.generic.flags = QMF_RIGHT_JUSTIFY;
networkOptionsInfo.network.generic.id = ID_NETWORK;
networkOptionsInfo.network.generic.callback = UI_NetworkOptionsMenu_Event;
networkOptionsInfo.network.generic.x = 216;
networkOptionsInfo.network.generic.y = 240 + PROP_HEIGHT;
networkOptionsInfo.network.string = "NETWORK";
networkOptionsInfo.network.style = UI_RIGHT;
networkOptionsInfo.network.color = color_red;
y = 240 - 1 * (BIGCHAR_HEIGHT+2);
networkOptionsInfo.rate.generic.type = MTYPE_SPINCONTROL;
networkOptionsInfo.rate.generic.name = "Data Rate:";
networkOptionsInfo.rate.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
networkOptionsInfo.rate.generic.callback = UI_NetworkOptionsMenu_Event;
networkOptionsInfo.rate.generic.id = ID_RATE;
networkOptionsInfo.rate.generic.x = 400;
networkOptionsInfo.rate.generic.y = y;
networkOptionsInfo.rate.itemnames = rate_items;
networkOptionsInfo.back.generic.type = MTYPE_BITMAP;
networkOptionsInfo.back.generic.name = ART_BACK0;
networkOptionsInfo.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
networkOptionsInfo.back.generic.callback = UI_NetworkOptionsMenu_Event;
networkOptionsInfo.back.generic.id = ID_BACK;
networkOptionsInfo.back.generic.x = 0;
networkOptionsInfo.back.generic.y = 480-64;
networkOptionsInfo.back.width = 128;
networkOptionsInfo.back.height = 64;
networkOptionsInfo.back.focuspic = ART_BACK1;
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.banner );
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.framel );
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.framer );
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.graphics );
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.display );
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.sound );
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.network );
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.rate );
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.back );
rate = trap_Cvar_VariableValue( "rate" );
if( rate <= 2500 ) {
networkOptionsInfo.rate.curvalue = 0;
}
else if( rate <= 3000 ) {
networkOptionsInfo.rate.curvalue = 1;
}
else if( rate <= 4000 ) {
networkOptionsInfo.rate.curvalue = 2;
}
else if( rate <= 5000 ) {
networkOptionsInfo.rate.curvalue = 3;
}
else {
networkOptionsInfo.rate.curvalue = 4;
}
}
/*
===============
UI_NetworkOptionsMenu_Cache
===============
*/
void UI_NetworkOptionsMenu_Cache( void ) {
trap_R_RegisterShaderNoMip( ART_FRAMEL );
trap_R_RegisterShaderNoMip( ART_FRAMER );
trap_R_RegisterShaderNoMip( ART_BACK0 );
trap_R_RegisterShaderNoMip( ART_BACK1 );
}
/*
===============
UI_NetworkOptionsMenu
===============
*/
void UI_NetworkOptionsMenu( void ) {
UI_NetworkOptionsMenu_Init();
UI_PushMenu( &networkOptionsInfo.menu );
Menu_SetCursorToItem( &networkOptionsInfo.menu, &networkOptionsInfo.network );
}
|