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