2
===========================================================================
3
Copyright (C) 1999-2005 Id Software, Inc.
5
This file is part of Quake III Arena source code.
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.
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.
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
===========================================================================
24
=======================================================================
28
=======================================================================
34
#define ART_FRAMEL "menu/art/frame2_l"
35
#define ART_FRAMER "menu/art/frame1_r"
36
#define ART_BACK0 "menu/art/back_0"
37
#define ART_BACK1 "menu/art/back_1"
39
#define ID_GRAPHICS 10
47
static const char *rate_items[] = {
71
} networkOptionsInfo_t;
73
static networkOptionsInfo_t networkOptionsInfo;
78
UI_NetworkOptionsMenu_Event
81
static void UI_NetworkOptionsMenu_Event( void* ptr, int event ) {
82
if( event != QM_ACTIVATED ) {
86
switch( ((menucommon_s*)ptr)->id ) {
89
UI_GraphicsOptionsMenu();
94
UI_DisplayOptionsMenu();
99
UI_SoundOptionsMenu();
106
if( networkOptionsInfo.rate.curvalue == 0 ) {
107
trap_Cvar_SetValue( "rate", 2500 );
109
else if( networkOptionsInfo.rate.curvalue == 1 ) {
110
trap_Cvar_SetValue( "rate", 3000 );
112
else if( networkOptionsInfo.rate.curvalue == 2 ) {
113
trap_Cvar_SetValue( "rate", 4000 );
115
else if( networkOptionsInfo.rate.curvalue == 3 ) {
116
trap_Cvar_SetValue( "rate", 5000 );
118
else if( networkOptionsInfo.rate.curvalue == 4 ) {
119
trap_Cvar_SetValue( "rate", 25000 );
132
UI_NetworkOptionsMenu_Init
135
static void UI_NetworkOptionsMenu_Init( void ) {
139
memset( &networkOptionsInfo, 0, sizeof(networkOptionsInfo) );
141
UI_NetworkOptionsMenu_Cache();
142
networkOptionsInfo.menu.wrapAround = qtrue;
143
networkOptionsInfo.menu.fullscreen = qtrue;
145
networkOptionsInfo.banner.generic.type = MTYPE_BTEXT;
146
networkOptionsInfo.banner.generic.flags = QMF_CENTER_JUSTIFY;
147
networkOptionsInfo.banner.generic.x = 320;
148
networkOptionsInfo.banner.generic.y = 16;
149
networkOptionsInfo.banner.string = "SYSTEM SETUP";
150
networkOptionsInfo.banner.color = color_white;
151
networkOptionsInfo.banner.style = UI_CENTER;
153
networkOptionsInfo.framel.generic.type = MTYPE_BITMAP;
154
networkOptionsInfo.framel.generic.name = ART_FRAMEL;
155
networkOptionsInfo.framel.generic.flags = QMF_INACTIVE;
156
networkOptionsInfo.framel.generic.x = 0;
157
networkOptionsInfo.framel.generic.y = 78;
158
networkOptionsInfo.framel.width = 256;
159
networkOptionsInfo.framel.height = 329;
161
networkOptionsInfo.framer.generic.type = MTYPE_BITMAP;
162
networkOptionsInfo.framer.generic.name = ART_FRAMER;
163
networkOptionsInfo.framer.generic.flags = QMF_INACTIVE;
164
networkOptionsInfo.framer.generic.x = 376;
165
networkOptionsInfo.framer.generic.y = 76;
166
networkOptionsInfo.framer.width = 256;
167
networkOptionsInfo.framer.height = 334;
169
networkOptionsInfo.graphics.generic.type = MTYPE_PTEXT;
170
networkOptionsInfo.graphics.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
171
networkOptionsInfo.graphics.generic.id = ID_GRAPHICS;
172
networkOptionsInfo.graphics.generic.callback = UI_NetworkOptionsMenu_Event;
173
networkOptionsInfo.graphics.generic.x = 216;
174
networkOptionsInfo.graphics.generic.y = 240 - 2 * PROP_HEIGHT;
175
networkOptionsInfo.graphics.string = "GRAPHICS";
176
networkOptionsInfo.graphics.style = UI_RIGHT;
177
networkOptionsInfo.graphics.color = color_red;
179
networkOptionsInfo.display.generic.type = MTYPE_PTEXT;
180
networkOptionsInfo.display.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
181
networkOptionsInfo.display.generic.id = ID_DISPLAY;
182
networkOptionsInfo.display.generic.callback = UI_NetworkOptionsMenu_Event;
183
networkOptionsInfo.display.generic.x = 216;
184
networkOptionsInfo.display.generic.y = 240 - PROP_HEIGHT;
185
networkOptionsInfo.display.string = "DISPLAY";
186
networkOptionsInfo.display.style = UI_RIGHT;
187
networkOptionsInfo.display.color = color_red;
189
networkOptionsInfo.sound.generic.type = MTYPE_PTEXT;
190
networkOptionsInfo.sound.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
191
networkOptionsInfo.sound.generic.id = ID_SOUND;
192
networkOptionsInfo.sound.generic.callback = UI_NetworkOptionsMenu_Event;
193
networkOptionsInfo.sound.generic.x = 216;
194
networkOptionsInfo.sound.generic.y = 240;
195
networkOptionsInfo.sound.string = "SOUND";
196
networkOptionsInfo.sound.style = UI_RIGHT;
197
networkOptionsInfo.sound.color = color_red;
199
networkOptionsInfo.network.generic.type = MTYPE_PTEXT;
200
networkOptionsInfo.network.generic.flags = QMF_RIGHT_JUSTIFY;
201
networkOptionsInfo.network.generic.id = ID_NETWORK;
202
networkOptionsInfo.network.generic.callback = UI_NetworkOptionsMenu_Event;
203
networkOptionsInfo.network.generic.x = 216;
204
networkOptionsInfo.network.generic.y = 240 + PROP_HEIGHT;
205
networkOptionsInfo.network.string = "NETWORK";
206
networkOptionsInfo.network.style = UI_RIGHT;
207
networkOptionsInfo.network.color = color_red;
209
y = 240 - 1 * (BIGCHAR_HEIGHT+2);
210
networkOptionsInfo.rate.generic.type = MTYPE_SPINCONTROL;
211
networkOptionsInfo.rate.generic.name = "Data Rate:";
212
networkOptionsInfo.rate.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
213
networkOptionsInfo.rate.generic.callback = UI_NetworkOptionsMenu_Event;
214
networkOptionsInfo.rate.generic.id = ID_RATE;
215
networkOptionsInfo.rate.generic.x = 400;
216
networkOptionsInfo.rate.generic.y = y;
217
networkOptionsInfo.rate.itemnames = rate_items;
219
networkOptionsInfo.back.generic.type = MTYPE_BITMAP;
220
networkOptionsInfo.back.generic.name = ART_BACK0;
221
networkOptionsInfo.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
222
networkOptionsInfo.back.generic.callback = UI_NetworkOptionsMenu_Event;
223
networkOptionsInfo.back.generic.id = ID_BACK;
224
networkOptionsInfo.back.generic.x = 0;
225
networkOptionsInfo.back.generic.y = 480-64;
226
networkOptionsInfo.back.width = 128;
227
networkOptionsInfo.back.height = 64;
228
networkOptionsInfo.back.focuspic = ART_BACK1;
230
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.banner );
231
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.framel );
232
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.framer );
233
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.graphics );
234
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.display );
235
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.sound );
236
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.network );
237
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.rate );
238
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.back );
240
rate = trap_Cvar_VariableValue( "rate" );
242
networkOptionsInfo.rate.curvalue = 0;
244
else if( rate <= 3000 ) {
245
networkOptionsInfo.rate.curvalue = 1;
247
else if( rate <= 4000 ) {
248
networkOptionsInfo.rate.curvalue = 2;
250
else if( rate <= 5000 ) {
251
networkOptionsInfo.rate.curvalue = 3;
254
networkOptionsInfo.rate.curvalue = 4;
261
UI_NetworkOptionsMenu_Cache
264
void UI_NetworkOptionsMenu_Cache( void ) {
265
trap_R_RegisterShaderNoMip( ART_FRAMEL );
266
trap_R_RegisterShaderNoMip( ART_FRAMER );
267
trap_R_RegisterShaderNoMip( ART_BACK0 );
268
trap_R_RegisterShaderNoMip( ART_BACK1 );
274
UI_NetworkOptionsMenu
277
void UI_NetworkOptionsMenu( void ) {
278
UI_NetworkOptionsMenu_Init();
279
UI_PushMenu( &networkOptionsInfo.menu );
280
Menu_SetCursorToItem( &networkOptionsInfo.menu, &networkOptionsInfo.network );