]> icculus.org git repositories - taylor/freespace2.git/blob - include/multiui.h
Initial revision
[taylor/freespace2.git] / include / multiui.h
1 /*
2  * $Logfile: /Freespace2/code/Network/MultiUI.h $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * Header file for the UI of the various multiplayer screens
8  *
9  * $Log$
10  * Revision 1.1  2002/05/03 03:28:12  root
11  * Initial revision
12  *
13  * 
14  * 8     7/15/99 9:20a Andsager
15  * FS2_DEMO initial checkin
16  * 
17  * 7     5/04/99 5:20p Dave
18  * Fixed up multiplayer join screen and host options screen. Should both
19  * be at 100% now.
20  * 
21  * 6     2/23/99 2:29p Dave
22  * First run of oldschool dogfight mode. 
23  * 
24  * 5     2/11/99 3:08p Dave
25  * PXO refresh button. Very preliminary squad war support.
26  * 
27  * 4     11/19/98 4:19p Dave
28  * Put IPX sockets back in psnet. Consolidated all multiplayer config
29  * files into one.
30  * 
31  * 3     11/05/98 5:55p Dave
32  * Big pass at reducing #includes
33  * 
34  * 2     10/07/98 10:53a Dave
35  * Initial checkin.
36  * 
37  * 1     10/07/98 10:50a Dave
38  * 
39  * 68    9/17/98 3:08p Dave
40  * PXO to non-pxo game warning popup. Player icon stuff in create and join
41  * game screens. Upped server count refresh time in PXO to 35 secs (from
42  * 20).
43  * 
44  * 67    9/10/98 1:17p Dave
45  * Put in code to flag missions and campaigns as being MD or not in Fred
46  * and Freespace. Put in multiplayer support for filtering out MD
47  * missions. Put in multiplayer popups for warning of non-valid missions.
48  * 
49  * 66    9/04/98 3:51p Dave
50  * Put in validated mission updating and application during stats
51  * updating.
52  * 
53  * 65    8/12/98 4:53p Dave
54  * Put in 32 bit checksumming for PXO missions. No validation on the
55  * actual tracker yet, though.
56  * 
57  * 64    6/05/98 9:54a Lawrance
58  * OEM changes
59  * 
60  * 63    5/23/98 3:31p Dave
61  * Tweaked pxo code. Fixed observer HUD stuff.
62  * 
63  * 62    5/20/98 2:25a Dave
64  * Fixed server side voice muting. Tweaked multi debrief/endgame
65  * sequencing a bit. Much friendlier for stats tossing/accepting now.
66  * 
67  * 61    5/15/98 12:09a Dave
68  * New tracker api code. New game tracker code. Finished up first run of
69  * the PXO screen. Fixed a few game server list exceptions.
70  * 
71  * 60    5/11/98 11:40p Dave
72  * Stuff.
73  * 
74  * 59    5/09/98 7:16p Dave
75  * Put in CD checking. Put in standalone host password. Made pilot into
76  * popup scrollable.
77  * 
78  * 58    5/08/98 5:05p Dave
79  * Go to the join game screen when quitting multiplayer. Fixed mission
80  * text chat bugs. Put mission type symbols on the create game list.
81  * Started updating standalone gui controls.
82  * 
83  * 57    5/04/98 10:39p Dave
84  * Put in endgame sequencing.  Need to check campaign situations.
85  * Realigned ship info on team select screen.
86  * 
87  * 56    5/04/98 1:44p Dave
88  * Fixed up a standalone resetting problem. Fixed multiplayer stats
89  * collection for clients. Make sure all multiplayer ui screens have the
90  * correct palette at all times.
91  * 
92  * 55    4/30/98 12:57a Dave
93  * Put in new mode for ship/weapon selection. Rearranged how game querying
94  * is done a bit.
95  * 
96  * 54    4/23/98 6:19p Dave
97  * Store ETS values between respawns. Put kick feature in the text
98  * messaging system. Fixed text messaging system so that it doesn't
99  * process or trigger ship controls. Other UI fixes.
100  * 
101  * 53    4/23/98 1:28a Dave
102  * Seemingly nailed the current_primary_bank and current_secondary_bank -1
103  * problem. Made sure non-critical button presses are _never_ sent to the
104  * server.
105  * 
106  * 52    4/21/98 11:56p Dave
107  * Put in player deaths statskeeping. Use arrow keys in the ingame join
108  * ship select screen. Don't quit the game if in the debriefing and server
109  * leaves.
110  * 
111  * 51    4/15/98 5:03p Dave
112  * Put in a rough countdown to mission start on final sync screen. Fixed
113  * several team vs. team bugs on the ship/team select screen.
114  * 
115  * 50    4/14/98 12:19p Dave
116  * Revised the pause system yet again. Seperated into its own module.
117  * 
118  * 49    4/13/98 4:50p Dave
119  * Maintain status of weapon bank/links through respawns. Put # players on
120  * create game mission list. Make observer not have engine sounds. Make
121  * oberver pivot point correct. Fixed respawn value getting reset every
122  * time host options screen started.
123  * 
124  * 48    4/07/98 5:42p Dave
125  * Put in support for ui display of voice system status (recording,
126  * playing back, etc). Make sure main hall music is stopped before
127  * entering a multiplayer game via ingame join.
128  * 
129  * 47    4/06/98 10:25p Dave
130  * Fixed up Netgame.respawn for the standalone case.
131  * 
132  * 46    4/02/98 6:29p Lawrance
133  * compile out multilag code for demo
134  * 
135  * 45    4/01/98 11:19p Dave
136  * Put in auto-loading of xferred pilot pic files. Grey out background
137  * behind pinfo popup. Put a chatbox message in when players are kicked.
138  * Moved mission title down in briefing. Other ui fixes.
139  * 
140  * 44    3/28/98 3:20p Dave
141  * Made pilot select popup handle large #'s of pilots correctly. Made
142  * create game screen display/select missions correctly. Made temp
143  * observers get stats after a mission. Numerous small ui fixes.
144  * 
145  * 43    3/26/98 5:24p Allender
146  * put in respawn edit box into mission notes dialog.  Made loading of
147  * missions/campaign happen when first entering the game setup screen.
148  * 
149  * 42    3/18/98 5:52p Dave
150  * Put in netgame password popup. Numerous ui changes. Laid groundwork for
151  * streamed multi_voice data.
152  * 
153  * 41    2/23/98 11:09p Dave
154  * Finished up multiplayer campaign support. Seems bug-free.
155  * 
156  * 40    2/20/98 4:47p Allender
157  * beefed up the multiplayer host interface when selection missions.
158  * Don't reload all the missions everytime a new filter is set
159  * 
160  * 39    2/15/98 4:28p Dave
161  * Made multiplayer mission lists display mission titles and descriptions
162  * as well as filename. Removed some unneeded code in main hall.
163  * 
164  * 38    2/11/98 5:35p Dave
165  * Standalone debugging. Changed how support ships warping in are handled.
166  * Some UI code tidying up.
167  * 
168  * 37    2/10/98 8:39p Dave
169  * Fixed bugs. Made endgame sequencing more clear.
170  * 
171  * 36    1/31/98 4:32p Dave
172  * Put in new support for VMT player validation, game logging in, and game
173  * logging out. Need to finish stats transfer.
174  * 
175  * 35    1/23/98 5:43p Dave
176  * Finished bringing standalone up to speed. Coded in new host options
177  * screen.
178  * 
179  * 34    1/22/98 5:26p Dave
180  * Modified some pregame sequencing packets. Starting to repair broken
181  * standalone stuff.
182  * 
183  * 33    1/21/98 5:58p Dave
184  * Finished ingame join. Coded in multiplayer interface artwork changes.
185  * 
186  * 32    1/20/98 5:42p Dave
187  * Moved ingame join to its own module. Improved it a bit.
188  * 
189  * 31    1/16/98 2:34p Dave
190  * Made pause screen work properly (multiplayer). Changed how chat packets
191  * work.
192  * 
193  * 30    1/15/98 6:12p Dave
194  * Fixed weapons loadout bugs with multiplayer respawning. Added
195  * multiplayer start screen. Fixed a few chatbox bugs.
196  * 
197  * 29    12/18/97 8:59p Dave
198  * Finished putting in basic support for weapon select and ship select in
199  * multiplayer.
200  * 
201  * 28    12/13/97 8:01p Dave
202  * Installed multiplayer create game screen.
203  * 
204  * 27    12/13/97 3:01p Dave
205  * Finished polishing up multiplayer join screen.
206  * 
207  * 26    12/13/97 1:59a Dave
208  * Installed multiplayer join screen
209  * 
210  * 25    12/03/97 5:04p Sandeep
211  * Fixed TCP/IP connections and you can play games off master tracker now
212  * 
213  * 24    11/15/97 2:37p Dave
214  * More multiplayer campaign support.
215  * 
216  * 23    11/12/97 4:43p Hoffoss
217  * Implemented new pause screens, moved old pause to debug pause.
218  * 
219  * 22    11/04/97 3:37p Dave
220  * More sequencing overhauls. Respawning, and server transfer. 
221  * 
222  * 21    10/30/97 5:47p Dave
223  * Smoothed transition between multiple multiplayer missions. Nailed a few
224  * timestamp problems.
225  * 
226  * 20    10/29/97 5:18p Dave
227  * More debugging of server transfer. Put in debrief/brief 
228  * transition for multiplayer (w/standalone)
229  * 
230  * 19    10/22/97 6:26p Dave
231  * Cleanup up yet more pregame sequencing. Got standalone up to working
232  * condition.
233  * 
234  * 18    10/21/97 5:21p Dave
235  * Fixed pregame mission load/file verify debacle. Added single vs.
236  * multiplayer stats system.
237  * 
238  * 17    10/20/97 5:00p Dave
239  * Installed new de-luxe ack system. Fixed a few potential chat/stats
240  * bugs. Cleaned out some old code.
241  * 
242  * 16    10/09/97 5:24p Allender
243  * fix misison time display.  Pass frametime into UI menus
244  * 
245  * 15    10/02/97 4:53p Dave
246  * Finished all leave/join problems. Fixed file xfer with new ingame and
247  * non-ingame situations. Fixed oddball timestamp problem.
248  * 
249  * 14    9/30/97 5:07p Dave
250  * Finished up client-server remote commands. Finished up client-server
251  * squadmate messaging. Added periodic auto-subsystem updates. Began work
252  * on adapting ingame join to new player start system
253  * 
254  * 13    9/30/97 4:58p Allender
255  * object updates on client side now happen according to different levels.
256  * prediction code needs to be put in still
257  * 
258  * 12    9/15/97 4:43p Dave
259  * Got basic observer mode working. Seems bug free so far.
260  * 
261  * 11    8/29/97 5:01p Dave
262  * Put in multiplayer pause screen/feartures.
263  * 
264  * 10    8/20/97 4:21p Dave
265  * Spliced out busy ACCEPT wait loop to work within the existing state
266  * loop. Fixed display of mission description.
267  * 
268  * 9     7/24/97 10:06a Dave
269  * Added scrollable game server list into multi_join_tracker_*
270  * 
271  * 8     7/23/97 4:54p Dave
272  * Added multi_join_tracker_* functions for dealing with the tracker.
273  * 
274  * 7     7/02/97 12:59p Allender
275  * chat hooks -- fixed a couple of chat bugs and reformetted the screen
276  * slightly
277  * 
278  * 6     6/12/97 9:13a Allender
279  * added sequencing state to the end of ship selection.  Changed some
280  * packet names and host sequencing
281  * 
282  * 5     6/10/97 9:56p Allender
283  * get multiplayer mission selection working.  Host can select mission and
284  * have himself and clients load the mission -- no sequencing past this
285  * point however
286  * 
287  * 4     6/06/97 10:40a Allender
288  * added 'type' to mission (single/multi/etc).  Added a couple of new game
289  * states for allowing to choose mission for multiplayer game
290  * 
291  * 3     1/01/97 6:45p Lawrance
292  * added more multiplayer messages, improved code
293  * 
294  * 2     12/30/96 10:18a Lawrance
295  * split up multiplayer code into manageable files
296  *
297  * $NoKeywords: $
298  */
299
300
301 #ifndef MULTI_UI_H
302 #define MULTI_UI_H
303
304 #include "ui.h"
305 #include "missionparse.h"
306
307 struct net_player;
308
309 void multi_common_add_text(char *txt,int auto_scroll = 0);
310 void multi_common_set_text(char *str,int auto_scroll = 0);
311
312 // time between sending refresh packets to known servers
313 #define MULTI_JOIN_REFRESH_TIME                 45000                   
314 #define MULTI_JOIN_REFRESH_TIME_LOCAL   5000
315 // this time must be longer than the MULTI_JOIN_REFRESH_TIME but shorter than twice the MULTI_JOIN_REFRESH_TIME
316 // so that it does not time out between refresh times, but cannot last more than 2 complete refreshed without
317 // timing out. Just trust me - DB
318 #define MULTI_JOIN_SERVER_TIMEOUT                       (MULTI_JOIN_REFRESH_TIME + (MULTI_JOIN_REFRESH_TIME /2))
319 #define MULTI_JOIN_SERVER_TIMEOUT_LOCAL (MULTI_JOIN_REFRESH_TIME_LOCAL + (MULTI_JOIN_REFRESH_TIME_LOCAL / 2))
320
321 // maximum number of items which can be on the list
322 #if defined(DEMO) || defined(OEM_BUILD) // not for FS2_DEMO
323         #define MULTI_CREATE_MAX_LIST_ITEMS                     1
324 #else
325         #define MULTI_CREATE_MAX_LIST_ITEMS                     200
326 #endif
327
328 typedef struct {
329         char            filename[MAX_FILENAME_LEN];     // filename of the mission
330         char            name[NAME_LENGTH];                              // name of the mission
331         int             flags;                                                          // flags to tell what type of multiplayer game (coop, team v. team)
332         uint     respawn;                                                               //      mission specified respawn count
333         ubyte           max_players;                                            // max players allowed for this file    
334         char            valid_status;                                           // see MVALID_* defines above
335 } multi_create_info;
336
337 // load all common icons
338 #define MULTI_NUM_COMMON_ICONS          12
339 #define MICON_VOICE_DENIED                              0
340 #define MICON_VOICE_RECORDING                   1
341 #define MICON_TEAM0                                             2
342 #define MICON_TEAM0_SELECT                              3
343 #define MICON_TEAM1                                             4
344 #define MICON_TEAM1_SELECT                              5
345 #define MICON_COOP                                              6
346 #define MICON_TVT                                                       7
347 #define MICON_DOGFIGHT                                  8
348 #define MICON_VOLITION                                  9
349 #define MICON_VALID                                             10
350 #define MICON_CD                                                        11
351
352 // common icon stuff
353 extern int Multi_common_icons[MULTI_NUM_COMMON_ICONS];
354 extern int Multi_common_icon_dims[MULTI_NUM_COMMON_ICONS][2];
355 void multi_load_common_icons();
356 void multi_unload_common_icons();
357
358 // initialize/display all bitmaps, etc related to displaying the voice system status
359 void multi_common_voice_display_status();
360
361 // multiplayer screen common palettes
362 void multi_common_load_palette();
363 void multi_common_set_palette();
364 void multi_common_unload_palette();
365
366 // call this to verify if we have a CD in the drive or not
367 void multi_common_verify_cd();
368
369 // variables to hold the mission and campaign lists
370 extern int Multi_create_mission_count;                                                                          // how many we have
371 extern int Multi_create_campaign_count;
372 extern multi_create_info Multi_create_mission_list[MULTI_CREATE_MAX_LIST_ITEMS];
373 extern multi_create_info Multi_create_campaign_list[MULTI_CREATE_MAX_LIST_ITEMS];
374
375 extern char Multi_create_files_array[MULTI_CREATE_MAX_LIST_ITEMS][MAX_FILENAME_LEN];
376 extern int Multi_create_files_array_count;
377
378 void multi_create_list_load_missions();
379 void multi_create_list_load_campaigns();
380
381 // returns an index into Multi_create_mission_list
382 int multi_create_lookup_mission(char *fname);
383
384 // returns an index into Multi_create_campaign_list
385 int multi_create_lookup_campaign(char *fname);
386
387 void multi_sg_rank_build_name(char *in,char *out);
388
389 void multi_join_game_init();
390 void multi_join_game_close();
391 void multi_join_game_do_frame();
392 void multi_join_eval_pong(net_addr *addr, fix pong_time);
393 void multi_join_reset_join_stamp();
394 void multi_join_clear_game_list();
395 void multi_join_notify_new_game();
396
397 void multi_start_game_init();
398 void multi_start_game_do();
399 void multi_start_game_close();
400
401 void multi_create_game_init();
402 void multi_create_game_do();
403 void multi_create_game_close();
404 void multi_create_game_add_mission(char *fname,char *name, int flags);
405
406 #define MULTI_CREATE_SHOW_MISSIONS                      0
407 #define MULTI_CREATE_SHOW_CAMPAIGNS                     1
408 void multi_create_setup_list_data(int mode);
409
410 void multi_create_handle_join(net_player *pl);
411
412 void multi_jw_handle_join(net_player *pl);
413
414 void multi_host_options_init();
415 void multi_host_options_do();
416 void multi_host_options_close();
417
418 void multi_game_client_setup_init();
419 void multi_game_client_setup_do_frame();
420 void multi_game_client_setup_close();
421
422 #define MULTI_SYNC_PRE_BRIEFING         0               // moving from the join to the briefing stage
423 #define MULTI_SYNC_POST_BRIEFING                1               // moving from the briefing to the gameplay stage
424 #define MULTI_SYNC_INGAME                               2               // ingame joiners data sync
425 extern int Multi_sync_mode;                                     // should always set this var before calling GS_EVENT_MULTI_MISSION_SYNC
426 extern int Multi_sync_countdown;                                // time in seconds until the mission is going to be launched
427 void multi_sync_init();
428 void multi_sync_do();
429 void multi_sync_close();
430 void multi_sync_start_countdown();                      // start the countdown to launch when the launch button is pressed
431
432 // note : these functions are called from within missiondebrief.cpp - NOT from freespace.cpp
433 void multi_debrief_init();
434 void multi_debrief_do_frame();
435 void multi_debrief_close();
436 void multi_debrief_accept_hit();                                                // handle the accept button being hit
437 void multi_debrief_esc_hit();                                                   // handle the ESC button being hit
438 void multi_debrief_replay_hit();                                                // handle the replay button being hit
439 void multi_debrief_server_left();                                       // call this when the server has left and we would otherwise be saying "contact lost with server"
440 void multi_debrief_stats_accept();                                      // call this to insure that stats are not undone when we leave the debriefing
441 void multi_debrief_stats_toss();                                                // call this to "toss" the stats packet
442 int multi_debrief_stats_accept_code();                          // call this to determine the status of multiplayer stats acceptance
443 void multi_debrief_server_process();                            // process all details regarding moving the netgame to its next state
444
445 // add a notification string, drawing appropriately depending on the state/screen we're in
446 void multi_common_add_notify(char *str);
447
448 // bring up the password string popup, fill in passwd (return 1 if accept was pressed, 0 if cancel was pressed)
449 int multi_passwd_popup(char *passwd);
450
451 #endif
452