FS2_Open
Open source remastering of the Freespace 2 engine
optionsmenumulti.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on the
6  * source.
7  *
8 */
9 
10 
11 
12 
13 #include "cfile/cfile.h"
14 #include "gamesnd/gamesnd.h"
15 #include "globalincs/alphacolors.h"
16 #include "graphics/font.h"
17 #include "io/key.h"
18 #include "io/timer.h"
19 #include "menuui/optionsmenu.h"
21 #include "network/multi.h"
22 #include "network/multi_voice.h"
23 #include "osapi/osregistry.h"
24 #include "parse/parselo.h"
25 #include "playerman/player.h"
26 #include "popup/popup.h"
27 #include "sound/ds.h"
28 #include "sound/rtvoice.h"
29 
30 
31 
32 // general data section ------------------------------------------------
34 
35 static char* Om_background_0_fname[GR_NUM_RESOLUTIONS] = {
36  "OptionsMultiGen", // GR_640
37  "2_OptionsMultiGen" // GR_1024
38 };
39 
40 static char* Om_background_0_mask_fname[GR_NUM_RESOLUTIONS] = {
41  "OptionsMultiGen-M", // GR_640
42  "2_OptionsMultiGen-M" // GR_1024
43 };
44 
45 static char* Om_background_1_fname[GR_NUM_RESOLUTIONS] = {
46  "OptionsMultiVox", // GR_640
47  "2_OptionsMultiVox" // GR_1024
48 };
49 
50 static char* Om_background_1_mask_fname[GR_NUM_RESOLUTIONS] = {
51  "OptionsMultiVox-M", // GR_640
52  "2_OptionsMultiVox-M" // GR_1024
53 };
54 
55 int Om_background_0 = -1;
56 int Om_mask_0 = -1;
57 
58 int Om_background_1 = -1;
59 int Om_mask_1 = -1;
60 
61 // screen modes
62 #define OM_MODE_NONE -1 // no mode (unintialized)
63 #define OM_MODE_GENERAL 0 // general tab
64 #define OM_MODE_VOX 1 // voice tab
66 
67 // notification stuff
68 #define OM_NOTIFY_TIME 8000
69 #define OM_NOTIFY_Y 430
70 #define OM_NOTIFY_Y2 440
71 int Om_notify_stamp = -1;
72 char Om_notify_string[255];
73 
74 // load all background bitmaps
76 
77 // unload all the background bitmaps
79 
80 // add a notification message
81 void options_multi_add_notify(const char *str);
82 
83 // process and blit any notification messages
85 
86 
87 // protocol options section -------------------------------------------
88 #define OM_PRO_NUM_BUTTONS 10
89 
90 #define OM_PRO_TCP 0
91 #define OM_PRO_IPX 1
92 #define OM_PRO_SCROLL_IP_UP 2
93 #define OM_PRO_SCROLL_IP_DOWN 3
94 #define OM_PRO_ADD_IP 4
95 #define OM_PRO_DELETE_IP 5
96 #define OM_PRO_LOCAL_BROADCAST 6
97 #define OM_PRO_VMT 7
98 #define OM_PRO_VOX_TAB 8
99 #define OM_PRO_GEN_TAB 9
100 
102  { // GR_640
103  ui_button_info("OMuB_07", 7, 66, -1, -1, 7),
104  ui_button_info("OMuB_08", 7, 84, -1, -1, 8),
105  ui_button_info("OMuB_09", 1, 124, -1, -1, 9),
106  ui_button_info("OMuB_10", 1, 157, -1, -1, 10),
107  ui_button_info("OMuB_11", 20, 207, -1, -1, 11),
108  ui_button_info("OMuB_12", 64, 207, -1, -1, 12),
109  ui_button_info("OMuB_13", 9, 251, -1, -1, 13),
110  ui_button_info("OMuB_14", 9, 282, -1, -1, 14),
111  ui_button_info("OMuB_15", 610, 53, -1, -1, 15),
112  ui_button_info("OMuB_16", 610, 72, -1, -1, 16),
113  },
114  { // GR_1024
115  ui_button_info("2_OMuB_07", 12, 105, -1, -1, 7),
116  ui_button_info("2_OMuB_08", 12, 134, -1, -1, 8),
117  ui_button_info("2_OMuB_09", 2, 198, -1, -1, 9),
118  ui_button_info("2_OMuB_10", 2, 252, -1, -1, 10),
119  ui_button_info("2_OMuB_11", 32, 332, -1, -1, 11),
120  ui_button_info("2_OMuB_12", 103, 332, -1, -1, 12),
121  ui_button_info("2_OMuB_13", 14, 402, -1, -1, 13),
122  ui_button_info("2_OMuB_14", 14, 452, -1, -1, 14),
123  ui_button_info("2_OMuB_15", 976, 85, -1, -1, 15),
124  ui_button_info("2_OMuB_16", 976, 114, -1, -1, 16),
125  }
126 };
127 
129 
130 // test
131 #define OM_PRO_NUM_TEXT 12
133  { // GR_640
134  { "TCP", 1378, 38, 70, UI_XSTR_COLOR_GREEN, -1, &Om_pro_buttons[0][OM_PRO_TCP].button },
135  { "IPX", 1379, 38, 88, UI_XSTR_COLOR_GREEN, -1, &Om_pro_buttons[0][OM_PRO_IPX].button },
136  { "IP Address", 1380, 30, 128, UI_XSTR_COLOR_GREEN, -1, &Om_pro_bogus },
137  { "add", 1381, 22, 235, UI_XSTR_COLOR_GREEN, -1, &Om_pro_buttons[0][OM_PRO_ADD_IP].button },
138  { "rem.", 1382, 68, 235, UI_XSTR_COLOR_GREEN, -1, &Om_pro_buttons[0][OM_PRO_DELETE_IP].button },
139  { "Broadcast Locally", 1387, 42, 260, UI_XSTR_COLOR_GREEN, -1, &Om_pro_buttons[0][OM_PRO_LOCAL_BROADCAST].button },
140  { "PXO", 1383, 42, 291, UI_XSTR_COLOR_GREEN, -1, &Om_pro_buttons[0][OM_PRO_VMT].button },
141  { "Login", 1384, 14, 309, UI_XSTR_COLOR_GREEN, -1, &Om_pro_bogus },
142  { "Password", 1385, 14, 336, UI_XSTR_COLOR_GREEN, -1, &Om_pro_bogus },
143  { "Squadron", 1386, 14, 363, UI_XSTR_COLOR_GREEN, -1, &Om_pro_bogus },
144  { "Voice", 1528, 557, 60, UI_XSTR_COLOR_GREEN, -1, &Om_pro_buttons[0][OM_PRO_VOX_TAB].button },
145  { "General", 1388, 542, 77, UI_XSTR_COLOR_GREEN, -1, &Om_pro_buttons[0][OM_PRO_GEN_TAB].button },
146  },
147  { // GR_1024
148  { "TCP", 1378, 61, 113, UI_XSTR_COLOR_GREEN, -1, &Om_pro_buttons[1][OM_PRO_TCP].button },
149  { "IPX", 1379, 61, 141, UI_XSTR_COLOR_GREEN, -1, &Om_pro_buttons[1][OM_PRO_IPX].button },
150  { "IP Address", 1380, 47, 206, UI_XSTR_COLOR_GREEN, -1, &Om_pro_bogus },
151  { "add", 1381, 36, 375, UI_XSTR_COLOR_GREEN, -1, &Om_pro_buttons[1][OM_PRO_ADD_IP].button },
152  { "rem.", 1382, 109, 375, UI_XSTR_COLOR_GREEN, -1, &Om_pro_buttons[1][OM_PRO_DELETE_IP].button },
153  { "Broadcast Locally", 1387, 68, 417, UI_XSTR_COLOR_GREEN, -1, &Om_pro_buttons[1][OM_PRO_LOCAL_BROADCAST].button },
154  { "PXO", 1383, 68, 467, UI_XSTR_COLOR_GREEN, -1, &Om_pro_buttons[1][OM_PRO_VMT].button },
155  { "Login", 1384, 23, 495, UI_XSTR_COLOR_GREEN, -1, &Om_pro_bogus },
156  { "Password", 1385, 23, 538, UI_XSTR_COLOR_GREEN, -1, &Om_pro_bogus },
157  { "Squadron", 1386, 23, 582, UI_XSTR_COLOR_GREEN, -1, &Om_pro_bogus },
158  { "Voice", 1528, 921, 96, UI_XSTR_COLOR_GREEN, -1, &Om_pro_buttons[1][OM_PRO_VOX_TAB].button },
159  { "General", 1388, 902, 123, UI_XSTR_COLOR_GREEN, -1, &Om_pro_buttons[1][OM_PRO_GEN_TAB].button },
160  }
161 };
162 
163 // defines for the tracker input boxes
165  {
166  19, 322, 226, -1 // GR_640
167  },
168  {
169  31, 518, 361, -1 // GR_1024
170  }
171 };
173  {
174  19, 350, 226, -1 // GR_640
175  },
176  {
177  31, 562, 361, -1 // GR_1024
178  }
179 };
181  {
182  19, 378, 226, -1 // GR_640
183  },
184  {
185  31, 607, 361, -1 // GR_1024
186  }
187 };
188 
189 // protocol section tracker login input box
191 
192 // protocol section tracker passwd input box
194 
195 // pxo squad name/password
197 
198 #define TRACKER_FOCUS_NONE 0
199 #define TRACKER_FOCUS_LOGIN 1
200 #define TRACKER_FOCUS_PASSWORD 2
201 #define TRACKER_FOCUS_SQUADRON 3
202 static int Om_tracker_focus = 0;
203 
204 // ip address list vars
205 #define IP_STRING_LEN 255
206 #define MAX_IP_ADDRS 100
207 
208 #define IP_CONFIG_FNAME NOX("Tcp.cfg")
209 
210 #define IP_EMPTY_STRING ""
211 
213  {
214  29, 137, 227, 67 // GR_640
215  },
216  {
217  46, 220, 364, 106 // GR_1024
218  }
219 };
220 
221 
223  5,
224  5
225 };
226 
227 static int Ip_input_coords[GR_NUM_RESOLUTIONS][4] = {
228  {
229  109, 128, 140, -1 // GR_640
230  },
231  {
232  132, 206, 261, -1 // GR_640
233  }
234 };
235 
237 int Om_ip_start; // index of the first element to be displayed in the list box
238 int Om_ip_selected; // the selected default IP address
239 int Om_ip_disp_count; // how many items are currently being displayed
240 int Om_num_ips; // # of ip addresses we have
241 char Om_ip_addrs[MAX_IP_ADDRS][IP_STRING_LEN]; // the ip addresses themselves
242 UI_BUTTON Om_ip_button; // button for detecting clicks on the ip address list
243 UI_INPUTBOX Om_ip_input; // input box for adding new ip addresses
244 
245 // setting vars
246 int Om_local_broadcast; // whether the player has local broadcast selected or not
247 int Om_tracker_flag; // if the guy has the tracker selected
248 int Om_protocol; // protocol in use
249 
250 // load all the controls for the protocol section
252 
253 // disable/hide all the controls for the protocol section
255 
256 // enable/unhide all the controls for the protocol section
258 
259 // intialize the protocol section vars
261 
262 // do frame for the protocol section
264 
265 // if the accept button was hit
267 
268 // check for button presses
270 
271 // if a button was pressed
273 
274 // load the ip address file
276 
277 // save the ip address file
279 
280 // draw the list of ip addresses
282 
283 // scroll the list of ip addresses down
285 
286 // scroll the list of ip addresses up
288 
289 // check the ip list to see if the user has selected a new item
291 
292 // delete the currently selected ip if any
294 
295 // attempt to add the currently entered ip address
297 
298 
299 // general options tab section -------------------------------------------
300 #define OM_GEN_NUM_BUTTONS 10
301 
302 #define OM_GEN_OBJ_LOW 0
303 #define OM_GEN_OBJ_MED 1
304 #define OM_GEN_OBJ_HIGH 2
305 #define OM_GEN_OBJ_LAN 3
306 #define OM_GEN_PIX_YES 4
307 #define OM_GEN_PIX_NO 5
308 #define OM_GEN_XFER_MULTIDATA_YES 6
309 #define OM_GEN_XFER_MULTIDATA_NO 7
310 #define OM_GEN_FLUSH_NO 8
311 #define OM_GEN_FLUSH_YES 9
312 
314  { // GR_640
315  ui_button_info("OGB_17", 598, 117, -1, -1, 17),
316  ui_button_info("OGB_18", 598, 139, -1, -1, 18),
317  ui_button_info("OGB_19", 598, 161, -1, -1, 19),
318  ui_button_info("OGB_20", 598, 183, -1, -1, 20),
319  ui_button_info("OGB_21", 549, 229, -1, -1, 21),
320  ui_button_info("OGB_22", 598, 229, -1, -1, 22),
321  ui_button_info("OGB_23", 598, 286, -1, -1, 23),
322  ui_button_info("OGB_24", 598, 307, -1, -1, 24),
323  ui_button_info("OGB_25", 598, 347, -1, -1, 25),
324  ui_button_info("OGB_26", 598, 368, -1, -1, 26),
325  },
326  { // GR_1024
327  ui_button_info("2_OGB_17", 957, 188, -1, -1, 17),
328  ui_button_info("2_OGB_18", 957, 223, -1, -1, 18),
329  ui_button_info("2_OGB_19", 957, 258, -1, -1, 19),
330  ui_button_info("2_OGB_20", 957, 293, -1, -1, 20),
331  ui_button_info("2_OGB_21", 879, 366, -1, -1, 21),
332  ui_button_info("2_OGB_22", 957, 366, -1, -1, 22),
333  ui_button_info("2_OGB_23", 957, 457, -1, -1, 23),
334  ui_button_info("2_OGB_24", 957, 491, -1, -1, 24),
335  ui_button_info("2_OGB_25", 957, 555, -1, -1, 25),
336  ui_button_info("2_OGB_26", 957, 589, -1, -1, 26),
337  }
338 };
339 
341 
342 // text
343 #define OM_GEN_NUM_TEXT 14
345  { // GR_640
346  { "Object Update", 1391, 511, 104, UI_XSTR_COLOR_GREEN, -1, &Om_gen_bogus },
347  { "Low", 1160, 558, 127, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[0][OM_GEN_OBJ_LOW].button },
348  { "Medium", 1161, 538, 149, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[0][OM_GEN_OBJ_MED].button },
349  { "High", 1162, 556, 171, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[0][OM_GEN_OBJ_HIGH].button },
350  { "Lan", 1392, 561, 193, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[0][OM_GEN_OBJ_LAN].button },
351  { "Pilot / Squad Images", 1393, 463, 214, UI_XSTR_COLOR_GREEN, -1, &Om_gen_bogus },
352  { "Yes", 1394, 555, 257, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[0][OM_GEN_PIX_YES].button },
353  { "No", 1395, 604, 257, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[0][OM_GEN_PIX_NO].button },
354  { "Transfer Missions", 1396, 478, 271, UI_XSTR_COLOR_GREEN, -1, &Om_gen_bogus },
355  { "/multidata", 1397, 519, 292, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[0][OM_GEN_XFER_MULTIDATA_YES].button },
356  { "/missions", 1398, 527, 314, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[0][OM_GEN_XFER_MULTIDATA_NO].button },
357  { "Flush Cache", 1399, 529, 334, UI_XSTR_COLOR_GREEN, -1, &Om_gen_bogus },
358  { "Never", 1400, 548, 355, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[0][OM_GEN_FLUSH_NO].button },
359  { "Before Game", 1401, 502, 377, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[0][OM_GEN_FLUSH_YES].button },
360  },
361  { // GR_1024
362  { "Object Update", 1391, 818, 166, UI_XSTR_COLOR_GREEN, -1, &Om_gen_bogus },
363  { "Low", 1160, 913, 204, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[1][OM_GEN_OBJ_LOW].button },
364  { "Medium", 1161, 892, 239, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[1][OM_GEN_OBJ_MED].button },
365  { "High", 1162, 909, 274, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[1][OM_GEN_OBJ_HIGH].button },
366  { "Lan", 1392, 916, 310, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[1][OM_GEN_OBJ_LAN].button },
367  { "Pilot / Squad Images", 1393, 821, 345, UI_XSTR_COLOR_GREEN, -1, &Om_gen_bogus },
368  { "Yes", 1394, 887, 411, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[1][OM_GEN_PIX_YES].button },
369  { "No", 1395, 966, 411, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[1][OM_GEN_PIX_NO].button },
370  { "Transfer Missions", 1396, 844, 435, UI_XSTR_COLOR_GREEN, -1, &Om_gen_bogus },
371  { "/multidata", 1397, 858, 468, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[1][OM_GEN_XFER_MULTIDATA_YES].button },
372  { "/missions", 1398, 870, 503, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[1][OM_GEN_XFER_MULTIDATA_NO].button },
373  { "Flush Cache", 1399, 886, 533, UI_XSTR_COLOR_GREEN, -1, &Om_gen_bogus },
374  { "Never", 1400, 897, 568, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[1][OM_GEN_FLUSH_NO].button },
375  { "Before Game", 1401, 849, 603, UI_XSTR_COLOR_GREEN, -1, &Om_gen_buttons[1][OM_GEN_FLUSH_YES].button },
376  }
377 };
378 
379 // setting vars
380 int Om_gen_obj_update; // object update level
381 int Om_gen_pix; // accept pilot pix or not
382 int Om_gen_xfer_multidata; // xfer missions to multidata or not
383 int Om_gen_flush_cache; // flush multidata directory before every game
384 
385 // load all the general tab controls
387 
388 // disable/hide all the general tab controls
390 
391 // enable/unhide all the general tab controls
393 
394 // initialize the general tab vars
396 
397 // accept function for the general tab
399 
400 // do frame for the general tab
401 void options_multi_gen_do();
402 
403 // check for button presses
405 
406 // a button was pressed
408 
409 
410 // voice options tab section -------------------------------------------
411 #define OM_VOX_NUM_BUTTONS 6
412 
413 #define OM_VOX_VOICE_TEST 0
414 #define OM_VOX_VOICE_YES 1
415 #define OM_VOX_VOICE_NO 2
416 #define OM_VOX_PLIST_UP 3
417 #define OM_VOX_PLIST_DOWN 4
418 #define OM_VOX_VOICE_MUTE 5
419 
421 
423  { // GR_640
424  ui_button_info("OVB_17", 562, 118, -1, -1, 17),
425  ui_button_info("OVB_19", 551, 208, -1, -1, 19),
426  ui_button_info("OVB_20", 599, 208, -1, -1, 20),
427  ui_button_info("OVB_21", 614, 256, -1, -1, 21),
428  ui_button_info("OVB_22", 614, 290, -1, -1, 22),
429  ui_button_info("OVB_23", 599, 354, -1, -1, 23),
430  },
431  { // GR_640
432  ui_button_info("2_OVB_17", 900, 189, -1, -1, 17),
433  ui_button_info("2_OVB_19", 882, 333, -1, -1, 19),
434  ui_button_info("2_OVB_20", 959, 333, -1, -1, 20),
435  ui_button_info("2_OVB_21", 983, 410, -1, -1, 21),
436  ui_button_info("2_OVB_22", 983, 464, -1, -1, 22),
437  ui_button_info("2_OVB_23", 959, 566, -1, -1, 23),
438  }
439 };
440 
441 // text
442 #define OM_VOX_NUM_TEXT 6
444  { // GR_640
445  { "Mic test", 1389, 567, 104, UI_XSTR_COLOR_GREEN, -1, &Om_vox_buttons[0][OM_VOX_VOICE_TEST].button },
446  { "Voice Quality", 1531, 439, 149, UI_XSTR_COLOR_GREEN, -1, &Om_vox_bogus },
447  { "Voice Transmission", 1530, 439, 193, UI_XSTR_COLOR_GREEN, -1, &Om_vox_bogus },
448  { "On", 1285, 556, 233, UI_XSTR_COLOR_GREEN, -1, &Om_vox_buttons[0][OM_VOX_VOICE_YES].button },
449  { "Off", 1286, 604, 233, UI_XSTR_COLOR_GREEN, -1, &Om_vox_buttons[0][OM_VOX_VOICE_NO].button },
450  { "Mute", 1390, 594, 381, UI_XSTR_COLOR_GREEN, -1, &Om_vox_buttons[0][OM_VOX_VOICE_MUTE].button },
451  },
452  { // GR_1024
453  { "mic test", 1389, 908, 166, UI_XSTR_COLOR_GREEN, -1, &Om_vox_buttons[1][OM_VOX_VOICE_TEST].button },
454  { "Voice Quality", 1531, 703, 239, UI_XSTR_COLOR_GREEN, -1, &Om_vox_bogus },
455  { "Voice Transmission", 1530, 783, 310, UI_XSTR_COLOR_GREEN, -1, &Om_vox_bogus },
456  { "On", 1285, 890, 373, UI_XSTR_COLOR_GREEN, -1, &Om_vox_buttons[1][OM_VOX_VOICE_YES].button },
457  { "Off", 1286, 967, 373, UI_XSTR_COLOR_GREEN, -1, &Om_vox_buttons[1][OM_VOX_VOICE_NO].button },
458  { "Mute", 1390, 950, 609, UI_XSTR_COLOR_GREEN, -1, &Om_vox_buttons[1][OM_VOX_VOICE_MUTE].button },
459  }
460 };
461 
462 #define NUM_OM_VOX_SLIDERS 1
463 #define OM_VOX_QOS_SLIDER 0
464 
466  { // GR_640
467  op_sliders("OVB_18", 429, 162, -1, -1, 18, 20, 10, NULL, -1, -1, -1, NULL, -1, -1, -1), // voice QOS
468  },
469  { // GR_1024
470  op_sliders("2_OVB_18", 686, 259, -1, -1, 18, 31, 10, NULL, -1, -1, -1, NULL, -1, -1, -1), // voice QOS
471  }
472 };
473 
474 // player list area
476  { // GR_640
477  377, 270, 232, 79
478  },
479  { // GR_1024
480  604, 432, 371, 127
481  }
482 };
484  6,
485  6
486 };
487 
490 
491 // voice test buffer
492 #define OM_VOX_BUF_SIZE (1<<12)
493 #define OM_VOX_COMP_SIZE ((1<<15) + (1<<14))
494 
495 #define OM_VOX_WAVE_Y 240
496 #define OM_VOX_WAVE_WIDTH 300
497 
498 #define OM_VOX_DROP_ICON_X 100
499 #define OM_VOX_DROP_ICON_Y 100
500 
501 #define OM_VOX_RECORD_INT 175
502 
505 
508 
510 
511 // status of any test voice recording
512 #define OM_VOX_TEST_NONE -1
513 #define OM_VOX_TEST_RECORDING 0
514 #define OM_VOX_TEST_PLAYBACK 1
516 
517 // setting vars
519 
520 // simple list of players we are looking through
522 
523 // selected player
525 
526 // mute or don't mute for each player
528 
529 // the # of players
531 
532 // load all the voice tab controls
534 
535 // disable/hide all the voice tab controls
537 
538 // enable/unhide all the voice tab controls
540 
541 // initialize the voice tab vars
543 
544 // accept function for the voice tab
546 
547 // do frame for the voice tab
548 void options_multi_vox_do();
549 
550 // check for button presses
552 
553 // a button was pressed
555 
556 // process/display the player list
558 
559 // scroll the player list down
561 
562 // scroll the player list up
564 
565 // get the index into the player list of the passed netplayer
567 
568 
569 // general data section ------------------------------------------------
570 
571 // load all background bitmaps
573 {
574  // load both background bitmaps
575  Om_background_0 = bm_load(Om_background_0_fname[gr_screen.res]);
576  if(Om_background_0 == -1){
577  nprintf(("Network","Error loading options background %s\n",Om_background_0_fname[gr_screen.res]));
578  }
579 
580  Om_background_1 = bm_load(Om_background_1_fname[gr_screen.res]);
581  if(Om_background_1 == -1){
582  nprintf(("Network","Error loading options background %s\n",Om_background_1_fname[gr_screen.res]));
583  }
584 
585  // load in both mask bitmaps
586  Om_mask_0 = bm_load(Om_background_0_mask_fname[gr_screen.res]);
587  if(Om_mask_0 == -1){
588  nprintf(("Network","Error loading options background mask %s\n",Om_background_0_mask_fname[gr_screen.res]));
589  }
590 
591  Om_mask_1 = bm_load(Om_background_1_mask_fname[gr_screen.res]);
592  if(Om_mask_1 == -1){
593  nprintf(("Network","Error loading options background mask %s\n",Om_background_1_mask_fname[gr_screen.res]));
594  }
595 }
596 
597 // unload all the background bitmaps
599 {
600  // unload all background bitmaps
601  if(Om_background_0 != -1){
603  Om_background_0 = -1;
604  }
605  if(Om_background_1 != -1){
607  Om_background_1 = -1;
608  }
609 
610  // unload all mask bitmaps
611  if(Om_mask_0 != -1){
613  Om_mask_0 = -1;
614  }
615  if(Om_mask_1 != -1){
617  Om_mask_1 = -1;
618  }
619 }
620 
621 // add a notification message
622 void options_multi_add_notify(const char *str)
623 {
624  // copy the string
625  memset(Om_notify_string,0,255);
626  if(str != NULL){
628  }
629 
630  // set the timestamp
632 }
633 
634 // process and blit any notification messages
636 {
637  int w;
638  const char *p_str[3];
639  int n_chars[3];
640  char line[255];
641  int line_count;
642  int y_start;
643  int idx;
644  int line_height;
645 
646  // if there is no timestamp, do nothing
647  if(Om_notify_stamp == -1){
648  return;
649  }
650 
651  // otherwise, if it has elapsed, unset it
653  Om_notify_stamp = -1;
654  return;
655  }
656 
657  // otherwise display the string
658  line_height = gr_get_font_height() + 1;
659  line_count = split_str(Om_notify_string, 600, n_chars, p_str, 3);
660  y_start = OM_NOTIFY_Y;
662  for(idx=0;idx<line_count;idx++){
663  memset(line, 0, 255);
664  strncpy(line, p_str[idx], n_chars[idx]);
665 
666  gr_get_string_size(&w,NULL,line);
667  gr_string((600 - w)/2,y_start,line,GR_RESIZE_MENU);
668 
669  y_start += line_height;
670  }
671 }
672 
673 
674 // protocol section --------------------------------------------------------
675 
676 // load all the controls for the protocol section
678 {
679  int idx;
680 
681  Assert(Om_window != NULL);
682 
683  // instantiate all the buttons
684  for(idx=0; idx<OM_PRO_NUM_BUTTONS; idx++){
685  // create the object
686  Om_pro_buttons[gr_screen.res][idx].button.create(Om_window, "", Om_pro_buttons[gr_screen.res][idx].x, Om_pro_buttons[gr_screen.res][idx].y, 1, 1, 0, 1);
687 
688  // set the sound to play when highlighted
690 
691  // set the ani for the button
692  Om_pro_buttons[gr_screen.res][idx].button.set_bmaps(Om_pro_buttons[gr_screen.res][idx].filename);
693 
694  // set the hotspot
695  Om_pro_buttons[gr_screen.res][idx].button.link_hotspot(Om_pro_buttons[gr_screen.res][idx].hotspot);
696  }
697 
698  // text
699  for(idx=0; idx<OM_PRO_NUM_TEXT; idx++){
700  Om_window->add_XSTR(&Om_pro_text[gr_screen.res][idx]);
701  }
702 
703  // create the tracker input boxes
707 
708  // create the invisible button for checking for clicks on the ip address list
709  Om_ip_button.create(Om_window, "", Ip_list_coords[gr_screen.res][0], Ip_list_coords[gr_screen.res][1], Ip_list_coords[gr_screen.res][2], Ip_list_coords[gr_screen.res][3], 0, 1);
710  Om_ip_button.hide();
711 
712  // create the new ip address input box
713  Om_ip_input.create(Om_window, Ip_input_coords[gr_screen.res][0], Ip_input_coords[gr_screen.res][1], Ip_input_coords[gr_screen.res][2], IP_STRING_LEN, IP_EMPTY_STRING, UI_INPUTBOX_FLAG_INVIS | UI_INPUTBOX_FLAG_ESC_CLR | UI_INPUTBOX_FLAG_KEYTHRU);
714  Om_ip_input.hide();
715  Om_ip_input.disable();
716 
717  // bogus control
718  Om_pro_bogus.base_create(Om_window, UI_KIND_ICON, 0, 0, 0, 0);
719 }
720 
721 // disable/hide all the controls for the protocol section
723 {
724  int idx;
725 
726  // hide and disable all the protocol buttons
727  for(idx=0;idx<OM_PRO_NUM_BUTTONS;idx++){
728  // hide the button
729  Om_pro_buttons[gr_screen.res][idx].button.hide();
730 
731  // disable the button
732  Om_pro_buttons[gr_screen.res][idx].button.disable();
733  }
734 
735  // hide and disable the tracker input boxes
736  Om_tracker_login.hide();
737  Om_tracker_login.disable();
738  Om_tracker_passwd.hide();
739  Om_tracker_passwd.disable();
740  Om_tracker_squad_name.hide();
741  Om_tracker_squad_name.disable();
742 
743  // disable the click detection button
744  Om_ip_button.disable();
745 
746  // disable and hide the ip address inputbox
747  Om_ip_input.hide();
748  Om_ip_input.disable();
749 
750  // undo input mode if necessary
751  Om_input_mode = 0;
752 
753  // bogus control
754  Om_pro_bogus.hide();
755  Om_pro_bogus.disable();
756 }
757 
758 // enable/unhide all the controls for the protocol section
760 {
761  int idx;
762 
763  // unhide and enable all the protocol buttons
764  for(idx=0;idx<OM_PRO_NUM_BUTTONS;idx++){
765  // enable the button
766  Om_pro_buttons[gr_screen.res][idx].button.enable();
767 
768  // unhide the button
769  Om_pro_buttons[gr_screen.res][idx].button.unhide();
770  }
771 
772  // unhide and enable the tracker input boxes
773  if(Om_tracker_flag){
774  Om_tracker_login.enable();
775  Om_tracker_passwd.enable();
776  Om_tracker_squad_name.enable();
777  }
778  Om_tracker_login.unhide();
779  Om_tracker_passwd.unhide();
780  Om_tracker_squad_name.unhide();
781 
782  // enable the click detection button
783  Om_ip_button.enable();
784 
785  // bogus control
786  Om_pro_bogus.enable();
787  Om_pro_bogus.unhide();
788 }
789 
790 // intialize the protocol section vars
792 {
793  // current protocol
795 
796  // whether or not the user has the local broadcast button selected
798 
799  // whether or not we're playing on the tracker
800  // ------------------- made to read the registry by Kazan -------------------
801  Om_tracker_flag = os_config_read_uint( "PXO", "FS2OpenPXO" , 0 );
802  // (Multi_options_g.protocol == NET_TCP) && Multi_options_g.pxo ? 1 : 0;
803 
804  // load the ip address list
805  Om_ip_disp_count = 0;
807  Om_ip_selected = Om_num_ips - 1;
808  Om_ip_start = Om_num_ips - 1;
809 }
810 
811 // do frame for the protocol section
813 {
814  // check for button presses
816 
817  // force draw the correct "local broadcast" button
818  if(Om_local_broadcast){
820  }
821 
822  // draw the "vmt" button if it is selected
823  if(Om_tracker_flag){
824  Om_pro_buttons[gr_screen.res][OM_PRO_VMT].button.draw_forced(2);
825  }
826 
827  // see if he hit any interesting key presses
828  switch(key){
829  case KEY_ENTER:
830  // add a new ip string if we're in "input" mode
831  if(Om_input_mode){
833 
834  // clear the text control and input mode
835  Om_ip_input.set_text("");
836  Om_ip_input.clear_focus();
837  Om_ip_input.disable();
838  Om_input_mode = 0;
839  }
840 
841  // if the tracker login inputbox has focus, lose it
842  if(Om_tracker_login.has_focus()){
843  Om_tracker_login.clear_focus();
845  }
846  // if the tracker password inputbox has focus, lose it
847  if(Om_tracker_passwd.has_focus()){
848  Om_tracker_passwd.clear_focus();
850  }
851  // if the tracker squad name inputbox has focus, lose it
852  if(Om_tracker_squad_name.has_focus()){
853  Om_tracker_squad_name.clear_focus();
855  }
856  break;
857 
858  case KEY_ESC:
859  // if we're in input mode, cancel out
860  if(Om_input_mode){
861  // clear the text control and input mode
862  Om_ip_input.set_text("");
863  Om_ip_input.clear_focus();
864  Om_ip_input.disable();
865  Om_input_mode = 0;
866  }
867  // otherwise quit the options screen altogether
868  else {
870  }
871  break;
872 
873  case KEY_TAB:
874  // tab through the tracker input controls
875  if(Om_tracker_login.has_focus()){
876  Om_tracker_passwd.set_focus();
877  } else if(Om_tracker_passwd.has_focus()){
878  Om_tracker_squad_name.set_focus();
879  } else if(Om_tracker_squad_name.has_focus()){
880  Om_tracker_login.set_focus();
881  }
882  break;
883  }
884 
885  // force draw the proper protocol
886  Om_pro_buttons[gr_screen.res][OM_PRO_TCP].button.draw_forced(2);
887 
888  // force draw the proper tab button
889  switch (Om_mode) {
890  case OM_MODE_GENERAL:
891  Om_pro_buttons[gr_screen.res][OM_PRO_GEN_TAB].button.draw_forced(2);
892  break;
893 
894  case OM_MODE_VOX:
895  Om_pro_buttons[gr_screen.res][OM_PRO_VOX_TAB].button.draw_forced(2);
896  break;
897  }
898 
899  // check to see if the user has clicked on the ip list and selected a new item
901 
902  // draw the list of ip addresses
904 
905  // hack to play sound when input boxes gain focus
906  if (Om_tracker_login.has_focus()) {
907  if (Om_tracker_focus != TRACKER_FOCUS_LOGIN) {
908  Om_tracker_focus = TRACKER_FOCUS_LOGIN;
910  }
911  } else if (Om_tracker_passwd.has_focus()) {
912  if (Om_tracker_focus != TRACKER_FOCUS_PASSWORD) {
913  Om_tracker_focus = TRACKER_FOCUS_PASSWORD;
915  }
916  } else if (Om_tracker_squad_name.has_focus()) {
917  if (Om_tracker_focus != TRACKER_FOCUS_SQUADRON) {
918  Om_tracker_focus = TRACKER_FOCUS_SQUADRON;
920  }
921  } else {
922  Om_tracker_focus = TRACKER_FOCUS_NONE;
923  }
924 }
925 
926 // if the accept button was hit
928 {
929  // if the user has selected local broadcast write it into his options struct
931  if(Om_local_broadcast){
933  }
934 
935  // active protocol
937 
938  // copy the VMT login and password data
939  Om_tracker_login.get_text(Multi_tracker_login);
940  Om_tracker_passwd.get_text(Multi_tracker_passwd);
941  Om_tracker_squad_name.get_text(Multi_tracker_squad_name);
942 
943  // #KAZAN# --- Save FS2OpenPXO flag
944  os_config_write_uint( "PXO", "FS2OpenPXO" , Om_tracker_flag );
945 
946  // write out the tracker login and passwd values to the registry
947  os_config_write_string( "PXO", "Login", Multi_tracker_login );
948  os_config_write_string( "PXO", "Password", Multi_tracker_passwd );
949 
950  // write out the PXO squad name and passwd values to the registry
951  os_config_write_string( "PXO", "SquadName", Multi_tracker_squad_name );
952 
953  // save the ip address list
955 }
956 
957 // check for button presses
959 {
960  int idx;
961 
962  // go through each button
963  for(idx=0;idx<OM_PRO_NUM_BUTTONS;idx++){
964  if(Om_pro_buttons[gr_screen.res][idx].button.pressed()){
966  break;
967  }
968  }
969 }
970 
971 // if a button was pressed
973 {
974  switch(n){
975  // add an ip address
976  case OM_PRO_ADD_IP:
977  // don't process if we're in input mode
978  if(Om_input_mode){
979  break;
980  }
981 
982  // setup the input mode
983  Om_input_mode = 1;
984  Om_ip_input.enable();
985  Om_ip_input.unhide();
986  Om_ip_input.set_text(IP_EMPTY_STRING);
987  Om_ip_input.set_focus();
989  break;
990 
991  // delete the currently selected ip
992  case OM_PRO_DELETE_IP:
993  // don't process if we're in input mode
994  if(Om_input_mode){
995  break;
996  }
997 
1000  break;
1001 
1002  // the "local" broadcast button - toggle
1004  // don't process if we're in input mode
1005  if(Om_input_mode){
1006  break;
1007  }
1008 
1009  if(!Om_local_broadcast){
1010  Om_local_broadcast = 1;
1011  } else {
1012  Om_local_broadcast = 0;
1013  }
1014 
1016  break;
1017 
1018  // scroll ips down
1019  case OM_PRO_SCROLL_IP_DOWN:
1020  // don't process if we're in input mode
1021  if(Om_input_mode){
1022  break;
1023  }
1024 
1026  break;
1027 
1028  // scroll ips up
1029  case OM_PRO_SCROLL_IP_UP:
1030  // don't process if we're in input mode
1031  if(Om_input_mode){
1032  break;
1033  }
1034 
1036  break;
1037 
1038  // the vmt button
1039  case OM_PRO_VMT:
1040  // for the multiplayer beta, always force tracker mode
1041  // don't process if we're in input mode
1042  if(Om_input_mode){
1043  break;
1044  }
1045 
1046  // toggle the stupid thing
1048 
1049  // if the thing is toggled on - enable the inputbox controls, else diable them
1050  if(Om_tracker_flag){
1051  Om_tracker_login.enable();
1052  Om_tracker_passwd.enable();
1053  Om_tracker_squad_name.enable();
1054  } else {
1055  Om_tracker_login.disable();
1056  Om_tracker_passwd.disable();
1057  Om_tracker_squad_name.disable();
1058  }
1059 
1060  // play a sound
1062  break;
1063 
1064  // general tab button
1065  case OM_PRO_GEN_TAB:
1066  if(Om_mode != OM_MODE_GENERAL){
1067  // set the general tab
1069 
1070  // disable the voice controls
1072 
1073  // enable the general controls
1075 
1076  // set the general screen mask
1077  Assert(Om_mask_0 >= 0);
1078  Om_window->set_mask_bmap(Om_mask_0, Om_background_0_mask_fname[gr_screen.res]);
1079  }
1080 
1081  // play a sound
1083 
1084  break;
1085 
1086  // voice tab button
1087  case OM_PRO_VOX_TAB:
1088  if(Om_mode != OM_MODE_VOX){
1089  // set the voice tab
1090  Om_mode = OM_MODE_VOX;
1091 
1092  // disable the general controls
1094 
1095  // enable the voice controls
1097 
1098  // set the voice screen mask
1099  Assert(Om_mask_1 >= 0);
1100  Om_window->set_mask_bmap(Om_mask_1, Om_background_1_mask_fname[gr_screen.res]);
1101  }
1102  // play a sound
1104 
1105  break;
1106 
1107  // tcp mode
1108  case OM_PRO_TCP:
1109  Om_protocol = NET_TCP;
1111  break;
1112 
1113  // ipx mode, no longer supported
1114  case OM_PRO_IPX:
1116  popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, "The old IPX protocol is no longer supported.");
1117  break;
1118  }
1119 }
1120 
1121 // load the ip address file
1123 {
1124  char line[IP_STRING_LEN];
1125  CFILE *file = NULL;
1126 
1127  // reset the ip address count
1128  Om_num_ips = 0;
1129 
1130  // attempt to open the ip list file
1132  if(file == NULL){
1133  nprintf(("Network","Error loading tcp.cfg file!\n"));
1134  return;
1135  }
1136 
1137  // read in all the strings in the file
1138  while(!cfeof(file)){
1139  line[0] = '\0';
1140  cfgets(line,IP_STRING_LEN,file);
1141 
1142  // strip off any newline character
1143  if(line[strlen(line) - 1] == '\n'){
1144  line[strlen(line) - 1] = '\0';
1145  }
1146 
1147  // 0 length lines don't get processed
1148  if((line[0] == '\0') || (line[0] == '\n') )
1149  continue;
1150 
1151  if ( !psnet_is_valid_ip_string(line) ) {
1152  nprintf(("Network","Invalid ip string (%s)\n",line));
1153  } else {
1154  if(Om_num_ips < MAX_IP_ADDRS-1){
1155  strcpy_s(Om_ip_addrs[Om_num_ips++],line);
1156  }
1157  }
1158  }
1159 
1160  cfclose(file);
1161 }
1162 
1163 // save the ip address file
1165 {
1166  int idx;
1167  CFILE *file = NULL;
1168 
1169  // attempt to open the ip list file for writing
1171  if(file == NULL){
1172  nprintf(("Network","Error loading tcp.cfg file\n"));
1173  return;
1174  }
1175 
1176  // write out all the string we have
1177  for(idx=0;idx<Om_num_ips;idx++){
1178  // make _absolutely_ sure its a valid address
1179  // MWA -- commented out next line because name resolution might fail when
1180  // it was added. We'll only grab games that we can actually get to.
1181  //Assert(psnet_is_valid_ip_string(Multi_ip_addrs[idx]));
1182 
1183  cfputs(Om_ip_addrs[idx],file);
1184 
1185  // make sure to tack on a newline if necessary
1186  if(Om_ip_addrs[idx][strlen(&Om_ip_addrs[idx][0]) - 1] != '\n'){
1187  cfputs(NOX("\n"),file);
1188  }
1189  }
1190 
1191  cfclose(file);
1192 }
1193 
1194 // draw the list of ip addresses
1196 {
1197  int idx;
1198  int y_start = Ip_list_coords[gr_screen.res][1];
1199  int line_height = gr_get_font_height() + 1;
1200 
1201  // get the # of items we should be displaying based upon the # of addresses and the starting display point
1204  } else {
1206  }
1207 
1208  // display the addresses
1209  for(idx=Om_ip_start; idx >= Om_ip_start - Om_ip_disp_count + 1 ; idx--){
1210  if(idx == Om_ip_selected){
1212  } else {
1214  }
1215 
1217  y_start += line_height;
1218  }
1219 }
1220 
1221 // scroll the list of ip addresses down
1223 {
1226  Om_ip_start--;
1227  } else {
1229  }
1230 }
1231 
1232 // scroll the list of ip addresses up
1234 {
1235  if(Om_ip_start < Om_num_ips-1){
1237  Om_ip_start++;
1238  } else {
1240  }
1241 }
1242 
1243 // check the ip list to see if the user has selected a new item
1245 {
1246  int click_y;
1247  int item;
1248 
1249  if(Om_ip_button.pressed()){
1250  // determine which item he clicked on
1251  Om_ip_button.get_mouse_pos(NULL, &click_y);
1252  item = click_y / (gr_get_font_height() + 1);
1253 
1254  // determine if there is an item in this location, and select it if so
1255  if(item < Om_ip_disp_count){
1256  Om_ip_selected = Om_ip_start - item;
1257  }
1258  }
1259 }
1260 
1261 // delete the currently selected ip if any
1263 {
1264  int idx;
1265 
1266  // attempt to delete the currently highlighted item
1267  if(Om_ip_selected != -1){
1268 
1269  // move down all the other items
1270  for(idx=Om_ip_selected; idx < Om_num_ips; idx++){
1271  strcpy_s(Om_ip_addrs[idx],Om_ip_addrs[idx+1]);
1272  }
1273 
1274  // make sure to decrement the starting index
1275  Om_ip_start--;
1276 
1277  // check to make sure that the selected item is valid
1278  Om_num_ips--;
1279  if(Om_num_ips <= 0){
1280  Om_ip_selected = -1;
1281  } else {
1282  if(Om_ip_selected > 0){
1283  Om_ip_selected--;
1284  }
1285  }
1286  }
1287 }
1288 
1289 // return 10, if successflu
1293 {
1294  int result;
1295 
1296  if(!Ip_validated_already){
1297  // see if its a valid ip address
1298  result = psnet_is_valid_ip_string(Ip_str);
1299 
1300  // if the result is a valid ip string, return immediately
1301  if(result){
1302  return 10;
1303  }
1304 
1305  // otherwise, change the popup text to indicate that it is invalid and wait for the user to click ok
1306  popup_change_text(XSTR( "Ip string is invalid!", 386));
1307  }
1308 
1310 
1311  // always wait for the user to hit the "cancel" button
1312  return 0;
1313 }
1314 
1315 // attempt to add the currently entered ip address
1317 {
1318  // get the entered string
1319  Om_ip_input.get_text(Ip_str);
1320 
1321  // this popup wil do several things.
1322  // 1.) It will display a popup so the user isn't left scratching his head
1323  // 2.) If the address
1325  if(popup_till_condition(options_multi_verify_ip, XSTR( "Cancel", 387), XSTR( "Verifying ip address", 388)) == 10){
1326  if(Om_num_ips < MAX_IP_ADDRS){
1329  Om_num_ips++;
1330 
1331  // if this is the first item on the list, select it
1332  if(Om_num_ips == 1){
1333  Om_ip_selected = 0;
1334  }
1335  } else {
1336  options_multi_add_notify(XSTR( "Max # of IP addresses reached!", 389));
1337  }
1338  }
1339 }
1340 
1341 // general options tab section -------------------------------------------
1342 
1343 // load all the general tab controls
1345 {
1346  int idx;
1347 
1348  Assert(Om_window != NULL);
1349 
1350  // instantiate all the buttons
1351  for(idx=0; idx<OM_GEN_NUM_BUTTONS; idx++){
1352  // create the object
1353  Om_gen_buttons[gr_screen.res][idx].button.create(Om_window, "", Om_gen_buttons[gr_screen.res][idx].x, Om_gen_buttons[gr_screen.res][idx].y, 1, 1, 0, 1);
1354 
1355  // set the sound to play when highlighted
1357 
1358  // set the ani for the button
1359  Om_gen_buttons[gr_screen.res][idx].button.set_bmaps(Om_gen_buttons[gr_screen.res][idx].filename);
1360 
1361  // set the hotspot
1362  Om_gen_buttons[gr_screen.res][idx].button.link_hotspot(Om_gen_buttons[gr_screen.res][idx].hotspot);
1363  }
1364 
1365  // text
1366  for(idx=0; idx<OM_GEN_NUM_TEXT; idx++){
1367  Om_window->add_XSTR(&Om_gen_text[gr_screen.res][idx]);
1368  }
1369 
1370  // bogus control
1371  Om_gen_bogus.base_create(Om_window, UI_KIND_ICON, 0, 0, 0, 0);
1372 }
1373 
1374 // disable/hide all the general tab controls
1376 {
1377  int idx;
1378 
1379  // go through all the controls
1380  for(idx=0;idx<OM_GEN_NUM_BUTTONS;idx++){
1381  Om_gen_buttons[gr_screen.res][idx].button.hide();
1382  Om_gen_buttons[gr_screen.res][idx].button.disable();
1383  }
1384 
1385  // bogus control
1386  Om_gen_bogus.hide();
1387  Om_gen_bogus.disable();
1388 }
1389 
1390 // enable/unhide all the general tab controls
1392 {
1393  int idx;
1394 
1395  // go through all the controls
1396  for(idx=0;idx<OM_GEN_NUM_BUTTONS;idx++){
1397  Om_gen_buttons[gr_screen.res][idx].button.enable();
1398  Om_gen_buttons[gr_screen.res][idx].button.unhide();
1399  }
1400 
1401  // bogus control
1402  Om_gen_bogus.enable();
1403  Om_gen_bogus.unhide();
1404 }
1405 
1406 // initialize the general tab vars
1408 {
1409  // initialize the object update
1411 
1412  // initialize the accept pix var
1414  Om_gen_pix = 1;
1415  } else {
1416  Om_gen_pix = 0;
1417  }
1418 
1419  // initialize the xfer_multidata var
1422  } else {
1424  }
1425 
1426  // initialize the flush cache var
1428  Om_gen_flush_cache = 1;
1429  } else {
1430  Om_gen_flush_cache = 0;
1431  }
1432 }
1433 
1434 // accept function for the general tab
1436 {
1437  // apply the object update level
1439 
1440  // apply the accept pix var
1442  if(Om_gen_pix){
1444  }
1445 
1446  // apply the xfer multidata var
1450  }
1451 
1452  // apply the flush cache var
1454  if(Om_gen_flush_cache){
1456  }
1457 }
1458 
1459 // do frame for the general tab
1461 {
1462  // check for button presses
1464 
1465  // draw the proper object update button
1466  switch(Om_gen_obj_update){
1467  case OBJ_UPDATE_LOW:
1468  Om_gen_buttons[gr_screen.res][OM_GEN_OBJ_LOW].button.draw_forced(2);
1469  break;
1470  case OBJ_UPDATE_MEDIUM:
1471  Om_gen_buttons[gr_screen.res][OM_GEN_OBJ_MED].button.draw_forced(2);
1472  break;
1473  case OBJ_UPDATE_HIGH:
1474  Om_gen_buttons[gr_screen.res][OM_GEN_OBJ_HIGH].button.draw_forced(2);
1475  break;
1476  case OBJ_UPDATE_LAN:
1477  Om_gen_buttons[gr_screen.res][OM_GEN_OBJ_LAN].button.draw_forced(2);
1478  break;
1479  default :
1480  Int3();
1481  }
1482 
1483  // draw the proper pix button
1484  if(Om_gen_pix){
1485  Om_gen_buttons[gr_screen.res][OM_GEN_PIX_YES].button.draw_forced(2);
1486  } else {
1487  Om_gen_buttons[gr_screen.res][OM_GEN_PIX_NO].button.draw_forced(2);
1488  }
1489 
1490  // draw the proper xfer multidata button
1493  } else {
1495  }
1496 
1497  // draw the proper flush cache button
1498  if(Om_gen_flush_cache){
1499  Om_gen_buttons[gr_screen.res][OM_GEN_FLUSH_YES].button.draw_forced(2);
1500  } else {
1501  Om_gen_buttons[gr_screen.res][OM_GEN_FLUSH_NO].button.draw_forced(2);
1502  }
1503 }
1504 
1505 // check for button presses
1507 {
1508  int idx;
1509 
1510  // go through all the buttons
1511  for(idx=0;idx<OM_GEN_NUM_BUTTONS;idx++){
1512  if(Om_gen_buttons[gr_screen.res][idx].button.pressed()){
1514  break;
1515  }
1516  }
1517 }
1518 
1519 // a button was pressed
1521 {
1522  switch(n){
1523  // low object update level
1524  case OM_GEN_OBJ_LOW:
1528  } else {
1530  }
1531  break;
1532 
1533  // medium object update level
1534  case OM_GEN_OBJ_MED:
1538  } else {
1540  }
1541  break;
1542 
1543  // high object update level
1544  case OM_GEN_OBJ_HIGH:
1548  } else {
1550  }
1551  break;
1552 
1553  // lan object update level
1554  case OM_GEN_OBJ_LAN:
1558  } else {
1560  }
1561  break;
1562 
1563  // accept pix
1564  case OM_GEN_PIX_YES:
1565  if(!Om_gen_pix){
1567  Om_gen_pix = 1;
1568  } else {
1570  }
1571  break;
1572 
1573  // don't accept pix
1574  case OM_GEN_PIX_NO:
1575  if(Om_gen_pix){
1577  Om_gen_pix = 0;
1578  } else {
1580  }
1581  break;
1582 
1583  // put missions in the multidate directory
1585  if(!Om_gen_xfer_multidata){
1588  } else {
1590  }
1591  break;
1592 
1593  // don't put missions in the multidata directory
1598  } else {
1600  }
1601  break;
1602 
1603  // flush the cache before each mission
1604  case OM_GEN_FLUSH_YES:
1605  if(!Om_gen_flush_cache){
1607  Om_gen_flush_cache = 1;
1608  } else {
1610  }
1611  break;
1612 
1613  // don't flush the cache before each mission
1614  case OM_GEN_FLUSH_NO:
1615  if(Om_gen_flush_cache){
1617  Om_gen_flush_cache = 0;
1618  } else {
1620  }
1621  break;
1622  }
1623 }
1624 
1625 // voice options tab section -------------------------------------------
1626 
1627 // load all the voice tab controls
1629 {
1630  int idx;
1631 
1632  Assert(Om_window != NULL);
1633 
1634  // instantiate all the buttons
1635  for(idx=0; idx<OM_VOX_NUM_BUTTONS; idx++){
1636  // create the object
1637  Om_vox_buttons[gr_screen.res][idx].button.create(Om_window, "", Om_vox_buttons[gr_screen.res][idx].x, Om_vox_buttons[gr_screen.res][idx].y, 1, 1, 0, 1);
1638 
1639  // set the sound to play when highlighted
1641 
1642  // set the ani for the button
1643  Om_vox_buttons[gr_screen.res][idx].button.set_bmaps(Om_vox_buttons[gr_screen.res][idx].filename);
1644 
1645  // set the hotspot
1646  Om_vox_buttons[gr_screen.res][idx].button.link_hotspot(Om_vox_buttons[gr_screen.res][idx].hotspot);
1647  }
1648 
1649  // text
1650  for(idx=0; idx<OM_VOX_NUM_TEXT; idx++){
1651  Om_window->add_XSTR(&Om_vox_text[gr_screen.res][idx]);
1652  }
1653 
1654  // sliders
1655  for ( idx = 0; idx < NUM_OM_VOX_SLIDERS; idx++ ) {
1656  Om_vox_sliders[gr_screen.res][idx].slider.create(Om_window, Om_vox_sliders[gr_screen.res][idx].x, Om_vox_sliders[gr_screen.res][idx].y,
1657  Om_vox_sliders[gr_screen.res][idx].dots, Om_vox_sliders[gr_screen.res][idx].filename,
1658  Om_vox_sliders[gr_screen.res][idx].hotspot, Om_vox_sliders[gr_screen.res][idx].right_filename, Om_vox_sliders[gr_screen.res][idx].right_mask, Om_vox_sliders[gr_screen.res][idx].right_x, Om_vox_sliders[gr_screen.res][idx].right_y,
1659  Om_vox_sliders[gr_screen.res][idx].left_filename, Om_vox_sliders[gr_screen.res][idx].left_mask, Om_vox_sliders[gr_screen.res][idx].left_x, Om_vox_sliders[gr_screen.res][idx].left_y,
1660  Om_vox_sliders[gr_screen.res][idx].dot_w);
1661  }
1662 
1663  // create the player list select button
1665  Om_vox_plist_button.hide();
1666 
1667  // build a list of net players
1668  Om_vox_num_players = 0;
1669  for(idx=0;idx<MAX_PLAYERS;idx++){
1670  Om_vox_players[idx] = NULL;
1671 
1672  // if i'm not connected, do nothing
1673  if((Net_player == NULL) || !(Net_player->flags & NETINFO_FLAG_CONNECTED)){
1674  continue;
1675  }
1676 
1677  // add all players I know about
1679  // set the netplayer pointer
1680  Om_vox_players[Om_vox_num_players] = &Net_players[idx];
1681 
1682  // set his mute flag
1684 
1685  // increment the count
1687  }
1688  }
1689 
1690  // bogus control
1691  Om_vox_bogus.base_create(Om_window, UI_KIND_ICON, 0, 0, 0, 0);
1692 }
1693 
1694 // disable/hide all the voice tab controls
1696 {
1697  int idx;
1698 
1699  // go through all the controls
1700  for(idx=0; idx<OM_VOX_NUM_BUTTONS; idx++){
1701  Om_vox_buttons[gr_screen.res][idx].button.hide();
1702  Om_vox_buttons[gr_screen.res][idx].button.disable();
1703  }
1704 
1705  // hide the qos control
1706  Om_vox_sliders[gr_screen.res][OM_VOX_QOS_SLIDER].slider.hide();
1707  Om_vox_sliders[gr_screen.res][OM_VOX_QOS_SLIDER].slider.disable();
1708 
1709  // unset the sound buffer size so we don't display any waveforms
1714 
1715  // disable the player list select button
1716  Om_vox_plist_button.disable();
1717 
1718  // bogus controls
1719  Om_vox_bogus.hide();
1720  Om_vox_bogus.disable();
1721 }
1722 
1723 // enable/unhide all the voice tab controls
1725 {
1726  int idx;
1727 
1728  // go through all the controls
1729  for(idx=0; idx<OM_VOX_NUM_BUTTONS; idx++){
1730  Om_vox_buttons[gr_screen.res][idx].button.enable();
1731  Om_vox_buttons[gr_screen.res][idx].button.unhide();
1732  }
1733 
1734  // unhide the qos control
1735  Om_vox_sliders[gr_screen.res][OM_VOX_QOS_SLIDER].slider.enable();
1736  Om_vox_sliders[gr_screen.res][OM_VOX_QOS_SLIDER].slider.unhide();
1737 
1738  // unset the sound buffer size so we don't display any waveforms
1743 
1744  // select the first player on the list
1745  Om_vox_player_select = Om_vox_players[0];
1746  Om_vox_plist_start = 0;
1747 
1748  // enable the player list select button
1749  Om_vox_plist_button.enable();
1750 
1751  // bogus controls
1752  Om_vox_bogus.enable();
1753  Om_vox_bogus.unhide();
1754 }
1755 
1756 // initialize the voice tab vars
1758 {
1759  // intialize the accept voice var
1761  Om_vox_accept_voice = 0;
1762  } else {
1763  Om_vox_accept_voice = 1;
1764  }
1765 }
1766 
1767 // accept function for the voice tab
1769 {
1770  int idx;
1771  int voice_pref_flags;
1772 
1773  // set the accept voice flag
1775  if(!Om_vox_accept_voice){
1777  }
1778 
1779  // build the voice preferences stuff
1780  voice_pref_flags = 0xffffffff;
1781  for(idx=0;idx<Om_vox_num_players;idx++){
1782  // if this guy is muted
1783  if(!Om_vox_player_flags[idx]){
1784  voice_pref_flags &= ~(1 << NET_PLAYER_INDEX(Om_vox_players[idx]));
1785  }
1786  }
1787  multi_voice_set_prefs(voice_pref_flags);
1788 }
1789 
1790 // do frame for the voice tab
1792 {
1793  int handle;
1794 
1795  // check for button presses
1797 
1798  // draw the proper accept voice button
1799  if(Om_vox_accept_voice){
1800  Om_vox_buttons[gr_screen.res][OM_VOX_VOICE_YES].button.draw_forced(2);
1801  } else {
1802  Om_vox_buttons[gr_screen.res][OM_VOX_VOICE_NO].button.draw_forced(2);
1803  }
1804 
1805  // if the currently selected player is muted
1806  if((Om_vox_player_select != NULL) && !Om_vox_player_flags[options_multi_vox_plist_get(Om_vox_player_select)]){
1807  Om_vox_buttons[gr_screen.res][OM_VOX_VOICE_MUTE].button.draw_forced(2);
1808  }
1809 
1810  // process and display the player list
1812 
1813  // if we're currently doing a voice test recording, process some stuff
1814  switch(Om_vox_test_status){
1815  case OM_VOX_TEST_RECORDING:
1817 
1818  // force draw the mic test button
1819  Om_vox_buttons[gr_screen.res][OM_VOX_VOICE_TEST].button.draw_forced(2);
1820 
1821  // if we are no longer recording, switch to playback if possible
1824 
1825  if(Om_vox_voice_comp_size != -1){
1826  // stop any playing back sounds
1828 
1829  // attempt to get a playback handle
1831  if(handle != -1){
1833 
1834  // mark us as playing back
1836  }
1837  // on error, notify the user something is wrong
1838  else {
1839  options_multi_add_notify(XSTR( "Error trying to playback recorded voice! Check your hardware", 390));
1840 
1841  // mark us as doing nothing
1843  }
1844  } else {
1845  // mark us as doing nothing
1847  }
1848  }
1849  break;
1850 
1851  case OM_VOX_TEST_PLAYBACK:
1852  // if we were playing a sound back, but now the sound is done
1854  // flush all playing sounds safely
1856 
1857  // null the sound handle
1859 
1860  // set this so we know not to display any more waveforms
1862  Om_vox_voice_comp_size = -1;
1863 
1864  // free the status up
1866  }
1867  break;
1868  }
1869 }
1870 
1871 // check for button presses
1873 {
1874  int idx;
1875 
1876  // go through all the buttons
1877  for(idx=0; idx<OM_VOX_NUM_BUTTONS; idx++){
1878  if(Om_vox_buttons[gr_screen.res][idx].button.pressed()){
1880  break;
1881  }
1882  }
1883 }
1884 
1885 // a button was pressed
1887 {
1888  switch(n){
1889  // accept voice button
1890  case OM_VOX_VOICE_YES:
1891  if(!Om_vox_accept_voice){
1893  Om_vox_accept_voice = 1;
1894  } else {
1896  }
1897  break;
1898 
1899  // don't accept voice button
1900  case OM_VOX_VOICE_NO:
1901  if(Om_vox_accept_voice){
1903  Om_vox_accept_voice = 0;
1904  } else {
1906  }
1907  break;
1908 
1909  // mute/unmute button
1910  case OM_VOX_VOICE_MUTE:
1911  if(Om_vox_player_select != NULL){
1914  } else {
1916  }
1917  break;
1918 
1919  // scroll the player list up
1920  case OM_VOX_PLIST_UP:
1922  break;
1923 
1924  // scroll the player list down
1925  case OM_VOX_PLIST_DOWN:
1927  break;
1928 
1929  // mic test button
1930  case OM_VOX_VOICE_TEST:
1931  // if in a multiplayer game, don't allow testing
1932  if((Net_player != NULL) && (Net_player->flags & NETINFO_FLAG_CONNECTED)){
1933  options_multi_add_notify(XSTR( "Cannot test mic while in a multiplayer game!", 391));
1934  break;
1935  }
1936 
1937  // if this machine is not capable of playing
1939  options_multi_add_notify(XSTR( "DirectSoundCapture could not be initialized. To initialize DirectSoundCapture your sound card must be full duplex and your sound card drivers must support DirectSoundCapture", 392));
1940  } else {
1941  // if we're not already doing a record test
1943  // set the quality of sound
1944  rtvoice_set_qos(Om_vox_sliders[gr_screen.res][OM_VOX_QOS_SLIDER].slider.pos + 1);
1945 
1946  // clear the comp buffer
1948 
1951  }
1952  }
1953  break;
1954  }
1955 }
1956 
1957 // screen shader
1958 extern shader Grey_shader;
1959 
1960 // process and blit any voice waveform if necessary
1962 {
1963  int c_width = OM_VOX_WAVE_WIDTH;
1964  int avg_len;
1965  int buf_offset;
1966  int idx,a_idx,running_avg;
1967 
1968  // if we're not in recording or playback mode
1970  return;
1971  }
1972 
1973  // grey the screen
1974  gr_set_shader(&Grey_shader);
1976 
1977  switch(Om_vox_test_status){
1978  case OM_VOX_TEST_RECORDING:
1979  // if we have no sound buffer size, do nothing
1980  if(Om_vox_voice_buffer_size <= 0){
1981  return;
1982  }
1983 
1984  // if we are not recording, do nothing
1986  return;
1987  }
1988 
1989  // get the # of samples we'll average for one line
1990  avg_len = Om_vox_voice_buffer_size / c_width;
1991 
1992  // blit the waveform
1994  buf_offset = 0;
1995  for(idx=0; idx < c_width; idx++){
1996  // reset the running average
1997  running_avg = 0;
1998  for(a_idx = 0; a_idx < avg_len; a_idx++){
1999  running_avg += (int)Om_vox_voice_buffer[buf_offset] - 128;
2000 
2001  // increment the buffer offset
2002  buf_offset++;
2003  }
2004 
2005  running_avg /= avg_len;
2007  }
2008 
2009  // if this packet would have been dropped, notify the user
2013  }
2014  break;
2015 
2016  case OM_VOX_TEST_PLAYBACK:
2017  // get the offset into the playing direct sound buffer
2019 
2020  // get the # of samples we'll average for one line
2021  avg_len = (int)((float)OM_VOX_RECORD_INT * ((1024.0f * 11.0f) / 1000.0f)) / c_width;
2022 
2023  // blit the waveform
2025  for(idx=0; idx < c_width; idx++){
2026  // reset the running average
2027  running_avg = 0;
2028  for(a_idx = 0; a_idx < avg_len; a_idx++){
2029  if(buf_offset < (OM_VOX_COMP_SIZE - 2)){
2030  running_avg += (int)Om_vox_comp_buffer[buf_offset] - 128;
2031 
2032  // increment the buffer offset
2033  buf_offset++;
2034  }
2035  }
2036 
2037  running_avg /= avg_len;
2039  }
2040  break;
2041  }
2042 }
2043 
2044 // process/display the player list
2046 {
2047  int idx;
2048  int y_start,p_count;
2049  int selected_index,click_y;
2050  char str[CALLSIGN_LEN+2];
2051 
2052  int line_height = gr_get_font_height() + 1;
2053 
2054  // check for mouse clicks
2055  if(Om_vox_plist_button.pressed()){
2056  Om_vox_plist_button.get_mouse_pos(NULL,&click_y);
2057  selected_index = (click_y / line_height) + Om_vox_plist_start;
2058 
2059  // if he clicked on a valid player, select him
2060  if(Om_vox_players[selected_index] != NULL){
2061  Om_vox_player_select = Om_vox_players[selected_index];
2062 
2063  nprintf(("Network","Selecting player %s\n",Om_vox_player_select->m_player->callsign));
2064  }
2065  }
2066 
2067  // draw the list of players
2068  p_count = 0;
2069  y_start = Om_vox_plist_coords[gr_screen.res][1];
2070  for(idx = Om_vox_plist_start; idx < Om_vox_num_players; idx++){
2071  if(Om_vox_players[idx] != NULL){
2072  // if he's the selected player, highlight him
2073  if(Om_vox_players[idx] == Om_vox_player_select){
2075  } else {
2077  }
2078 
2079  // force fit his callsign
2080  strcpy_s(str,Om_vox_players[idx]->m_player->callsign);
2082 
2083  // blit the callsign
2085 
2086  // increment the y index
2087  y_start += line_height;
2088 
2089  // increment the player count
2090  p_count++;
2091  }
2092 
2093  // if we've reached max display, break out
2094  if(p_count >= Om_vox_plist_max_display[gr_screen.res]){
2095  break;
2096  }
2097  }
2098 }
2099 
2100 // get the index into the player list of the passed netplayer
2102 {
2103  int idx;
2104 
2105  for(idx=0;idx<Om_vox_num_players;idx++){
2106  if(pl == Om_vox_players[idx]){
2107  return idx;
2108  }
2109  }
2110 
2111  // should neve get here. hmmm.
2112  Int3();
2113  return -1;
2114 }
2115 
2116 // scroll the player list down
2118 {
2121  return;
2122  }
2123 
2127  } else {
2129  }
2130 }
2131 
2132 // scroll the player list up
2134 {
2135  if(Om_vox_plist_start > 0){
2138  } else {
2140  }
2141 }
2142 
2143 
2144 // extern functions -----------------------------------------------------
2145 
2146 // called when the options screen is initialized, pass in the UI window
2147 void options_multi_init(UI_WINDOW *options_window)
2148 {
2149  // assign the options window
2150  Om_window = options_window;
2151 
2152  // load the background bitmaps
2154 
2155  // load the controls for the protocol area
2157 
2158  // load the controls for the general tab
2160 
2161  // load the controls for the voice tab
2163 
2164  // disable all the protocol controls
2166 
2167  // disable all the general tab controls
2169 
2170  // disable all the voice tab controls
2172 
2173  // intialize the protocol section vars
2175 
2176  // initialize the general tab vars
2178 
2179  // initialize the voice tab vars
2181 
2182  // intialize the multiplayer voice recording system
2183  if( !((Net_player != NULL) && (Net_player->flags & NETINFO_FLAG_CONNECTED)) ){
2184  multi_voice_init();
2185  }
2186 
2187  // set the default screen mode
2189 }
2190 
2191 // do frame for the multi options screen
2193 {
2194  // do frame for the protocol section
2196 
2197  // process and blit any notification messages
2199 
2200  // process the proper tab control
2201  switch(Om_mode){
2202  case OM_MODE_GENERAL:
2204  break;
2205  case OM_MODE_VOX:
2207  break;
2208  default :
2209  Int3();
2210  }
2211 }
2212 
2213 // called when the entire options screen is closed
2215 {
2216  // null out the window handle
2217  Om_window = NULL;
2218 
2219  // unload all background bitmaps
2221 
2222  // stop any playing voice
2224 
2225  // unset the screen mode
2227 }
2228 
2233 {
2234  // if PXO is turned on, do we have a username and password?
2235  if (Om_tracker_flag) {
2236  if (strlen(Multi_tracker_login) == 0) {
2237  return false;
2238  }
2239  else if (strlen(Multi_tracker_passwd) == 0) {
2240  return false;
2241  }
2242  }
2243 
2244  return true;
2245 }
2246 
2252 {
2253  // accept function for the protocol section
2255 
2256  // is it legal to leave this screen?
2257  if (!options_multi_ok_to_accept()) {
2258  return false;
2259  }
2260 
2261  // accept function for the general tab
2263 
2264  // accept function for the voice tab
2266 
2267  // if Net_player is not null, copy these new settings to him
2268  if(Net_player != NULL){
2270  }
2272 
2273  // if we're connected to a game server, update our options on the server now
2276  }
2277 
2278  return true;
2279 }
2280 
2281 // called when the multiplayer tab is hit - initializes/switches all necessary data.
2282 // NOTE : this is different from the initialization function, which is called only when the options menu is started
2284 {
2285  // set the windows mask bitmap
2286  Assert(Om_mask_0 >= 0);
2287  Om_window->set_mask_bmap(Om_mask_0, Om_background_0_mask_fname[gr_screen.res]);
2288 
2289  // set the default screen mode
2291 
2292  // clear any notification messages
2293  Om_notify_stamp = -1;
2294 
2295  // enable all the protocol controls
2297 
2298  // enable the general tab controls
2300 }
2301 
2302 // return the bitmap handle of the current background bitmap, or -1 if the multiplayer tab is not active
2304 {
2305  // return the background bitmap mode based upon the current mode
2306  switch(Om_mode){
2307  case OM_MODE_GENERAL:
2308  return Om_background_0;
2309 
2310  case OM_MODE_VOX:
2311  return Om_background_1;
2312  }
2313 
2314  // unknown mode of some kind
2315  return -1;
2316 }
2317 
2318 // called when the multiplayer tab has been switched from
2320 {
2321  // unset the mode
2323 
2324  // disable all the protocol controls
2326 
2327  // disable all the general tab controls
2329 
2330  // disable all the vox tab controls
2332 
2333  // stop any test voice recording
2335 }
2336 
2337 // set voice sound buffer for display
2338 void options_multi_set_voice_data(unsigned char *sound_buf, int buf_size, double gain)
2339 {
2340  if ( (sound_buf == NULL) || (buf_size <= 0) ) {
2341  return;
2342  }
2343 
2344  // copy the buffer to the vox tab data
2346  memcpy(Om_vox_voice_buffer, sound_buf, Om_vox_voice_buffer_size);
2347 
2348  // copy and uncompress the compressed buffer
2349  if(Om_vox_voice_comp_size == -1){
2351  }
2352 
2353  if ( (Om_vox_voice_comp_size + buf_size) < OM_VOX_COMP_SIZE ) {
2354  memcpy(Om_vox_comp_buffer + Om_vox_voice_comp_size, sound_buf, buf_size);
2355  Om_vox_voice_comp_size += buf_size;
2356  }
2357 }
2358 
2359 // return whether we want to eat a tabbed keypress
2361 {
2362  // do we want to eat the tab key or not
2363  if(Om_tracker_passwd.has_focus() || Om_tracker_login.has_focus() || Om_tracker_squad_name.has_focus()){
2364  return 1;
2365  }
2366 
2367  return 0;
2368 }
#define IP_STRING_LEN
void options_multi_protocol_scroll_ip_up()
void create(UI_WINDOW *wnd, int _x, int _y, int _num_pos, char *bm_slider, int slider_mask, char *bm_left=NULL, int left_mask=-1, int left_x=-1, int left_y=-1, char *bm_right=NULL, int right_mask=-1, int right_x=-1, int right_y=-1, int _dot_width=19)
DOT_SLIDER class down here.
Definition: slider.cpp:24
GLuint64EXT * result
Definition: Glext.h:10775
void set_text(const char *in)
Definition: inputbox.cpp:490
void set_highlight_action(void(*_user_function)(void))
Definition: button.cpp:375
void options_multi_gen_button_pressed(int n)
void multi_voice_test_record_stop()
int timestamp(int delta_ms)
Definition: timer.cpp:226
#define CFILE_NORMAL
Definition: cfile.h:89
#define MY_NET_PLAYER_NUM
Definition: multi.h:127
unsigned char Om_vox_comp_buffer[OM_VOX_COMP_SIZE]
#define NET_TCP
Definition: psnet2.h:29
void options_multi_protocol_save_ip_file()
void options_multi_enable_protocol_controls()
uint os_config_read_uint(const char *section, const char *name, uint default_value)
Definition: osregistry.cpp:372
void add_XSTR(char *string, int _xstr_id, int _x, int _y, UI_GADGET *_assoc, int _color_type, int _font_id=-1)
Definition: window.cpp:476
#define OM_PRO_NUM_BUTTONS
#define OM_VOX_NUM_BUTTONS
char Multi_tracker_squad_name[MULTI_TRACKER_STRING_LEN+1]
Definition: multi.cpp:145
#define MIN(a, b)
Definition: pstypes.h:296
int Om_vox_voice_buffer_size
#define OM_VOX_RECORD_INT
int Om_num_ips
void multi_voice_test_record_start()
UI_WINDOW * Om_window
commit pressed
Definition: gamesnd.h:294
unsigned int ds_get_play_position(int channel_id)
Definition: ds.cpp:2127
void options_multi_init(UI_WINDOW *options_window)
int x
Definition: ui.h:658
void options_multi_notify_process()
#define OM_GEN_NUM_TEXT
#define OM_VOX_QOS_SLIDER
void options_multi_load_vox_controls()
int Om_mask_1
net_player * Net_player
Definition: multi.cpp:94
#define GR_RESIZE_MENU
Definition: 2d.h:684
#define OM_VOX_TEST_NONE
int Om_background_1
color Color_red
Definition: alphacolors.cpp:34
void options_multi_vox_process_waveform()
int y
Definition: ui.h:658
player * m_player
Definition: multi.h:459
void options_multi_protocol_add_current_ip()
int Om_vox_accept_voice
UI_XSTR Om_pro_text[GR_NUM_RESOLUTIONS][OM_PRO_NUM_TEXT]
void multi_options_update_local()
#define OM_NOTIFY_TIME
void options_multi_protocol_accept()
#define MULTI_STANDALONE(np)
Definition: multi.h:139
virtual void unhide()
Definition: gadget.cpp:217
Assert(pm!=NULL)
int Om_protocol
int Multi_voice_local_prefs
#define GR_NUM_RESOLUTIONS
Definition: 2d.h:651
int Ip_list_max_display[GR_NUM_RESOLUTIONS]
__inline void gr_string(int x, int y, const char *string, int resize_mode=GR_RESIZE_FULL)
Definition: 2d.h:769
#define UI_INPUTBOX_FLAG_NO_BACK
Definition: ui.h:45
general failure sound for any event
Definition: gamesnd.h:297
int multi_voice_test_recording()
Definition: ui.h:61
int res
Definition: 2d.h:370
unsigned char Om_vox_voice_buffer[OM_VOX_BUF_SIZE]
#define LOGIN_LEN
Definition: multi.h:85
void clear_focus()
Definition: gadget.cpp:328
void set_focus()
Definition: gadget.cpp:321
net_player * Om_vox_player_select
GLclampf f
Definition: Glext.h:7097
void base_create(UI_WINDOW *wnd, int _kind, int _x, int _y, int _w, int _h)
Definition: gadget.cpp:244
#define OM_VOX_DROP_ICON_Y
void options_multi_load_gen_controls()
void options_multi_vox_plist_scroll_down()
Definition: cfile.h:28
void options_multi_enable_gen_controls()
void options_multi_protocol_do(int key)
Definition: 2d.h:82
void options_multi_do(int key)
UI_BUTTON Om_vox_plist_button
int Om_tracker_login_coords[GR_NUM_RESOLUTIONS][4]
virtual void hide(int n)
Definition: gadget.cpp:207
void gr_set_color_fast(color *dst)
Definition: 2d.cpp:1197
void options_multi_init_protocol_vars()
int Om_ip_selected
#define TRACKER_FOCUS_NONE
Definition: ui.h:195
int flags
Definition: multi.h:463
int key
int Om_input_mode
int max_w_unscaled
Definition: 2d.h:361
#define Int3()
Definition: pstypes.h:292
#define OBJ_UPDATE_LAN
Definition: multi_options.h:20
void rtvoice_set_qos(int qos)
Definition: rtvoice.cpp:140
int Om_background_0
#define OM_VOX_WAVE_WIDTH
char * right_filename
Definition: optionsmenu.h:28
void os_config_write_uint(const char *section, const char *name, uint value)
Definition: osregistry.cpp:269
#define OM_VOX_PLIST_DOWN
UI_INPUTBOX Om_tracker_passwd
void options_multi_load_protocol_controls()
#define GR_RESIZE_NONE
Definition: 2d.h:681
int bm_release(int handle, int clear_render_targets)
Frees both a bitmap's data and it's associated slot.
Definition: bmpman.cpp:2603
#define TRACKER_FOCUS_PASSWORD
char callsign[CALLSIGN_LEN+1]
Definition: player.h:91
char * filename
Definition: optionsmenu.h:19
#define OM_NOTIFY_Y
int clip_height
Definition: 2d.h:378
ui_button_info Om_gen_buttons[GR_NUM_RESOLUTIONS][OM_GEN_NUM_BUTTONS]
#define OM_VOX_VOICE_NO
#define OM_PRO_SCROLL_IP_DOWN
void options_multi_protocol_button_pressed(int n)
#define OM_GEN_OBJ_LAN
#define OM_GEN_PIX_YES
void options_multi_gen_do()
#define OM_PRO_NUM_TEXT
void draw_forced(int frame_num)
Definition: button.cpp:104
int options_multi_eat_tab()
void os_config_write_string(const char *section, const char *name, const char *value)
Definition: osregistry.cpp:221
#define OM_PRO_ADD_IP
void options_multi_select()
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
UI_INPUTBOX Om_ip_input
void set_mask_bmap(char *fname)
Definition: window.cpp:75
int set_bmaps(char *ani_filename, int nframes=3, int start_frame=1)
Definition: gadget.cpp:71
void options_multi_enable_vox_controls()
#define NET_PLAYER_INDEX(np)
Definition: multi.h:125
int Om_vox_playback_handle
net_player_info p_info
Definition: multi.h:473
int Om_mode
void options_multi_protocol_scroll_ip_down()
op_sliders Om_vox_sliders[GR_NUM_RESOLUTIONS][NUM_OM_VOX_SLIDERS]
char Multi_tracker_passwd[MULTI_TRACKER_STRING_LEN+1]
Definition: multi.cpp:144
#define OM_PRO_LOCAL_BROADCAST
void options_multi_set_voice_data(unsigned char *sound_buf, int buf_size, double gain)
int ds_get_channel(int sig)
Definition: ds.cpp:1870
#define NETINFO_FLAG_AM_MASTER
Definition: multi.h:599
color Color_bright
Definition: alphacolors.cpp:28
#define OM_VOX_VOICE_YES
#define cfopen(...)
Definition: cfile.h:134
int psnet_is_valid_ip_string(char *ip_string, int allow_port)
Definition: psnet2.cpp:938
#define nprintf(args)
Definition: pstypes.h:239
#define UI_INPUTBOX_FLAG_PASSWD
Definition: ui.h:39
int Multi_voice_can_record
Definition: multi_voice.cpp:41
UI_DOT_SLIDER_NEW slider
Definition: optionsmenu.h:32
int Om_tracker_squad_name_coords[GR_NUM_RESOLUTIONS][4]
#define OM_VOX_PLIST_UP
char * cfgets(char *buf, int n, CFILE *cfile)
Definition: cfile.cpp:1571
#define OM_GEN_OBJ_MED
#define OM_GEN_OBJ_LOW
#define OM_MODE_GENERAL
int hotspot
Definition: ui.h:659
#define OM_GEN_FLUSH_NO
int Ip_list_coords[GR_NUM_RESOLUTIONS][4]
int pressed()
Definition: button.cpp:325
#define MAX_IP_ADDRS
void options_multi_gen_check_buttons()
#define OM_PRO_DELETE_IP
#define NUM_OM_VOX_SLIDERS
#define OM_GEN_PIX_NO
#define w(p)
Definition: modelsinc.h:68
int Om_ip_start
void gr_shade(int x, int y, int w, int h, int resize_mode)
Definition: 2d.cpp:2085
net_player * Om_vox_players[MAX_PLAYERS]
#define OM_MODE_VOX
#define OM_VOX_BUF_SIZE
#define KEY_ENTER
Definition: key.h:125
#define OM_GEN_XFER_MULTIDATA_YES
bool options_multi_ok_to_accept()
#define OM_GEN_FLUSH_YES
void options_multi_disable_gen_controls()
multi_local_options m_local_options
Definition: player.h:192
int rtvoice_play(int index, unsigned char *data, int size)
Definition: rtvoice.cpp:437
int right_mask
Definition: optionsmenu.h:29
#define OM_VOX_TEST_RECORDING
void options_multi_gen_accept()
#define TRACKER_FOCUS_SQUADRON
void options_multi_protocol_load_ip_file()
int split_str(const char *src, int max_pixel_w, int *n_chars, const char **p_str, int max_lines, char ignore_char)
Definition: parselo.cpp:3412
#define MAX_PLAYERS
Definition: pstypes.h:32
int options_multi_background_bitmap()
UI_BUTTON button
Definition: ui.h:660
#define UI_KIND_ICON
Definition: ui.h:26
void options_multi_disable_protocol_controls()
#define OM_PRO_SCROLL_IP_UP
int Om_vox_plist_max_display[GR_NUM_RESOLUTIONS]
shader Grey_shader
Definition: contexthelp.cpp:84
int left_mask
Definition: optionsmenu.h:27
int idx
Definition: multiui.cpp:761
int Om_gen_xfer_multidata
char Om_notify_string[255]
int Om_tracker_flag
GLclampd n
Definition: Glext.h:7286
#define MLO_FLAG_NO_VOICE
int Om_vox_num_players
const char * XSTR(const char *str, int index)
Definition: localize.cpp:851
#define IP_CONFIG_FNAME
user_click (mouse selects a control)
Definition: gamesnd.h:305
void options_multi_vox_button_pressed(int n)
void options_multi_vox_check_buttons()
int cfeof(CFILE *cfile)
#define OM_VOX_TEST_PLAYBACK
#define NOX(s)
Definition: pstypes.h:473
#define TRACKER_FOCUS_LOGIN
#define OM_PRO_VOX_TAB
void options_multi_vox_process_player_list()
void options_multi_init_gen_vars()
void options_multi_unselect()
#define NETINFO_FLAG_CONNECTED
Definition: multi.h:598
__inline void gr_line(int x1, int y1, int x2, int y2, int resize_mode=GR_RESIZE_FULL)
Definition: 2d.h:791
#define OM_GEN_NUM_BUTTONS
void multi_options_local_load(multi_local_options *options, net_player *pxo_pl)
void options_multi_add_notify(const char *str)
int Om_vox_voice_comp_size
#define OM_VOX_NUM_TEXT
#define OM_VOX_COMP_SIZE
int bm_load(const char *real_filename)
Loads a bitmap so we can draw with it later.
Definition: bmpman.cpp:1119
#define CF_TYPE_DATA
Definition: cfile.h:46
void multi_voice_set_prefs(int pref_flags)
void options_multi_load_bmaps()
#define OM_GEN_OBJ_HIGH
color Color_green
Definition: alphacolors.cpp:31
scroll pressed (and scroll)
Definition: gamesnd.h:296
color Color_white
Definition: alphacolors.cpp:32
#define CALLSIGN_LEN
Definition: globals.h:31
#define IP_EMPTY_STRING
void link_hotspot(int num)
Definition: gadget.cpp:50
void options_cancel_exit()
int cfputs(const char *str, CFILE *cfile)
Definition: cfile.cpp:1504
void create(UI_WINDOW *wnd, char *_text, int _x, int _y, int _w, int _h, int do_repeat=0, int ignore_focus=0)
Definition: button.cpp:26
#define KEY_ESC
Definition: key.h:124
int Om_local_broadcast
void options_multi_protocol_display_ips()
#define OM_GEN_XFER_MULTIDATA_NO
int Om_vox_plist_coords[GR_NUM_RESOLUTIONS][4]
void options_multi_disable_vox_controls()
#define MULTI_CONNECTED(np)
Definition: multi.h:136
char Om_ip_addrs[MAX_IP_ADDRS][IP_STRING_LEN]
#define OBJ_UPDATE_MEDIUM
Definition: multi_options.h:18
void options_multi_init_vox_vars()
char * left_filename
Definition: optionsmenu.h:26
player * Player
int gr_force_fit_string(char *str, int max_str, int max_width)
Definition: font.cpp:48
void options_multi_close()
Definition: ui.h:584
int clip_width
Definition: 2d.h:378
screen gr_screen
Definition: 2d.cpp:46
void gr_get_string_size(int *w, int *h, const char *text, int len=9999)
Definition: font.cpp:196
Definition: ui.h:162
UI_BUTTON Om_ip_button
int options_multi_verify_ip()
UI_INPUTBOX Om_tracker_login
void enable(int n=1)
Definition: gadget.cpp:440
int gr_get_font_height()
Definition: font.cpp:187
int Om_mask_0
void common_play_highlight_sound()
Definition: gamesnd.cpp:1151
#define OBJ_UPDATE_HIGH
Definition: multi_options.h:19
void options_multi_vox_do()
void create(UI_WINDOW *wnd, int _x, int _y, int _w, int _textlen, char *_text, int _flags=0, int pixel_lim=-1, color *clr=NULL)
Definition: inputbox.cpp:101
void options_multi_unload_bmaps()
#define MLO_FLAG_LOCAL_BROADCAST
#define timestamp_elapsed(stamp)
Definition: timer.h:102
int has_focus()
Definition: gadget.cpp:334
UI_XSTR Om_vox_text[GR_NUM_RESOLUTIONS][OM_VOX_NUM_TEXT]
void get_mouse_pos(int *xx, int *yy)
Definition: gadget.cpp:341
#define UI_INPUTBOX_FLAG_INVIS
Definition: ui.h:35
UI_GADGET Om_pro_bogus
void options_multi_vox_accept()
#define MLO_FLAG_ACCEPT_PIX
Definition: multi_options.h:99
color Color_normal
Definition: alphacolors.cpp:28
#define KEY_TAB
Definition: key.h:127
char * filename
Definition: ui.h:657
#define OBJ_UPDATE_LOW
Definition: multi_options.h:17
void get_text(char *out)
Definition: inputbox.cpp:484
int Om_notify_stamp
#define UI_XSTR_COLOR_GREEN
Definition: ui.h:160
#define OM_MODE_NONE
bool options_multi_accept()
void options_multi_protocol_check_ip_list()
int multi_voice_test_packet_tossed()
UI_GADGET Om_gen_bogus
int Om_gen_obj_update
int options_multi_vox_plist_get(net_player *pl)
void options_multi_vox_plist_scroll_up()
void options_multi_protocol_check_buttons()
#define MLO_FLAG_XFER_MULTIDATA
char Ip_str[IP_STRING_LEN+1]
#define OM_PRO_IPX
#define OM_PRO_GEN_TAB
void rtvoice_stop_playback_all()
Definition: rtvoice.cpp:410
#define OM_PRO_TCP
void multi_voice_init()
void gamesnd_play_iface(int n)
Definition: gamesnd.cpp:260
#define OM_VOX_DROP_ICON_X
int cfclose(CFILE *cfile)
Definition: cfile.cpp:895
void disable()
Definition: gadget.cpp:432
struct ui_button_info ui_button_info
int Om_vox_test_status
#define OM_VOX_VOICE_TEST
ui_button_info Om_vox_buttons[GR_NUM_RESOLUTIONS][OM_VOX_NUM_BUTTONS]
int Ip_validated_already
UI_GADGET Om_vox_bogus
ui_button_info Om_pro_buttons[GR_NUM_RESOLUTIONS][OM_PRO_NUM_BUTTONS]
void gr_set_shader(shader *shade)
Definition: 2d.cpp:1220
#define OM_PRO_VMT
#define OM_VOX_VOICE_MUTE
net_player Net_players[MAX_PLAYERS]
Definition: multi.cpp:93
void _cdecl gr_printf_menu(int x, int y, const char *format,...)
Definition: font.cpp:314
#define MLO_FLAG_FLUSH_CACHE
int Om_vox_plist_start
#define UI_INPUTBOX_FLAG_KEYTHRU
Definition: ui.h:36
char Multi_tracker_login[MULTI_TRACKER_STRING_LEN+1]
Definition: multi.cpp:143
UI_INPUTBOX Om_tracker_squad_name
multi_global_options Multi_options_g
UI_XSTR Om_gen_text[GR_NUM_RESOLUTIONS][OM_GEN_NUM_TEXT]
int Om_tracker_passwd_coords[GR_NUM_RESOLUTIONS][4]
int ds_is_channel_playing(int channel_id)
Definition: ds.cpp:1888
int Om_gen_flush_cache
void multi_voice_test_process()
#define UI_INPUTBOX_FLAG_ESC_CLR
Definition: ui.h:37
int Om_vox_player_flags[MAX_PLAYERS]
#define OM_VOX_WAVE_Y
multi_local_options options
Definition: multi.h:452
int Om_gen_pix
void options_multi_protocol_delete_ip()
#define strcpy_s(...)
Definition: safe_strings.h:67
int Om_ip_disp_count
int multi_voice_test_get_playback_buffer()