]> icculus.org git repositories - taylor/freespace2.git/blob - include/gamesequence.h
169544ed1bf5f40823cc9f8c7c590f8839f4dcb9
[taylor/freespace2.git] / include / gamesequence.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/GameSequence/GameSequence.h $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * Header file for Game Sequencing items
16  *
17  * $Log$
18  * Revision 1.2  2002/06/09 04:41:13  relnev
19  * added copyright header
20  *
21  * Revision 1.1.1.1  2002/05/03 03:28:12  root
22  * Initial import.
23  *
24  * 
25  * 8     9/03/99 1:31a Dave
26  * CD checking by act. Added support to play 2 cutscenes in a row
27  * seamlessly. Fixed super low level cfile bug related to files in the
28  * root directory of a CD. Added cheat code to set campaign mission # in
29  * main hall.
30  * 
31  * 7     8/27/99 12:04a Dave
32  * Campaign loop screen.
33  * 
34  * 6     8/04/99 5:36p Andsager
35  * Show upsell screens at end of demo campaign before returning to main
36  * hall.
37  * 
38  * 5     2/23/99 2:29p Dave
39  * First run of oldschool dogfight mode. 
40  * 
41  * 4     11/05/98 5:55p Dave
42  * Big pass at reducing #includes
43  * 
44  * 3     11/05/98 4:18p Dave
45  * First run nebula support. Beefed up localization a bit. Removed all
46  * conditional compiles for foreign versions. Modified mission file
47  * format.
48  * 
49  * 2     10/07/98 10:52a Dave
50  * Initial checkin.
51  * 
52  * 1     10/07/98 10:48a Dave
53  * 
54  * 83    5/15/98 12:09a Dave
55  * New tracker api code. New game tracker code. Finished up first run of
56  * the PXO screen. Fixed a few game server list exceptions.
57  * 
58  * 82    5/12/98 2:46a Dave
59  * Rudimentary communication between Parallax Online and freespace. Can
60  * get and store channel lists.
61  * 
62  * 81    4/25/98 7:39p Allender
63  * fixd some small hotkey stuff.  Worked on turret orientation being
64  * correct for multiplayer.  new sexpression called end-campaign will will
65  * end the main campaign
66  * 
67  * 80    4/23/98 7:08p John
68  * Removed some obsoleted states.
69  * 
70  * 79    4/16/98 4:31p Hoffoss
71  * Changed demo screen referenced to view cutscenes screen, which is now
72  * what it's called.
73  * 
74  * 78    4/02/98 5:40p Hoffoss
75  * Added the Load Mission screen to FreeSpace.
76  * 
77  * 77    3/11/98 5:32p Lawrance
78  * Fix up text arrays for events/states
79  * 
80  * 76    3/09/98 12:13a Lawrance
81  * Add support for Red Alert missions
82  * 
83  * 75    3/07/98 5:44p Dave
84  * Finished player info popup. Ironed out a few todo bugs.
85  * 
86  * 74    3/05/98 4:12p John
87  * Made Debug+F4 switch Glide and windowed.
88  * 
89  * 73    3/03/98 1:00p Hoffoss
90  * Added new command briefing event and state.
91  * 
92  * 72    3/02/98 3:44p Hoffoss
93  * Added new Campaign Room state and event.
94  * 
95  * 71    2/19/98 6:26p Dave
96  * Fixed a few file xfer bugs. Tweaked mp team select screen. Put in
97  * initial support for player data uploading.
98  * 
99  * 70    2/18/98 10:21p Dave
100  * Ripped out old file xfer system. Put in brand new xfer system.
101  * 
102  * 69    2/08/98 5:07p Dave
103  * Put in support for multiplayer furball mode.
104  * 
105  * 68    1/28/98 6:22p Dave
106  * Made standalone use ~8 megs less memory. Fixed multiplayer submenu
107  * sequencing bug.
108  * 
109  * 67    1/23/98 5:43p Dave
110  * Finished bringing standalone up to speed. Coded in new host options
111  * screen.
112  * 
113  * 66    1/22/98 5:25p Dave
114  * Modified some pregame sequencing packets. Starting to repair broken
115  * standalone stuff.
116  * 
117  * 65    1/20/98 5:42p Dave
118  * Moved ingame join to its own module. Improved it a bit.
119  * 
120  * 64    1/15/98 6:12p Dave
121  * Fixed weapons loadout bugs with multiplayer respawning. Added
122  * multiplayer start screen. Fixed a few chatbox bugs.
123  * 
124  * 63    1/15/98 6:00p Hoffoss
125  * Added option to quit menu (in game) to restart the mission.  Doesn't
126  * seem to quite work, though.  Checking code in so someone else can look
127  * into it.
128  * 
129  * 62    1/05/98 10:05a Dave
130  * Big re-sequencing of server transfer. Centralized _all_ server transfer
131  * code to one module.
132  * 
133  * 61    12/30/97 4:28p Lawrance
134  * Give text descriptions for events, change debug output to give text
135  * desciption of event/state
136  * 
137  * 60    12/24/97 8:56p Lawrance
138  * took out obsolete state used for non-existant sound config screen
139  * 
140  * 59    12/17/97 8:44p John
141  * added code to warp the player out of mission no matter what; no
142  * cancelling, no max speed check.
143  * 
144  * 58    11/15/97 2:37p Dave
145  * More multiplayer campaign support.
146  * 
147  * 57    11/13/97 7:01p Hoffoss
148  * Fixed GS_state_text[], which didn't match the current states we have
149  * available.
150  * 
151  * 56    11/11/97 4:57p Dave
152  * Put in support for single vs. multiplayer pilots. Began work on
153  * multiplayer campaign saving. Put in initial player select screen
154  * 
155  * 55    11/10/97 6:02p Hoffoss
156  * Added new debug paused state.
157  * 
158  * 54    11/03/97 10:12p Hoffoss
159  * Finished up work on the hud message/mission log scrollback screen.
160  * 
161  * 53    10/27/97 6:11p Dave
162  * Changed host/server transfer around. Added some multiplayer data to
163  * state save/restore. Made multiplayer quitting more intelligent.
164  * 
165  * 52    10/27/97 8:33a John
166  * added code for new player warpout sequence
167  * 
168  * 51    10/24/97 6:19p Dave
169  * More standalone testing/fixing. Added reliable endgame sequencing.
170  * Added reliable ingame joining. Added reliable stats transfer (endgame).
171  * Added support for dropping players in debriefing. Removed a lot of old
172  * unused code.
173  * 
174  * 50    10/18/97 7:47p Hoffoss
175  * Changed state workings for controls config screen.
176  * 
177  * 49    10/02/97 9:53p Hoffoss
178  * Added event evaluation analysis debug screen so we can determine the
179  * state of events and their sexp trees to track down logic problems and
180  * such.
181  * 
182  * 48    10/02/97 4:52p Dave
183  * Added event to move to the multi wait state with a post_event
184  * 
185  * 47    10/01/97 4:52p Dave
186  * Got ingame join and observer mode to correctly work under the new
187  * player_obj system.
188  * 
189  * 46    9/30/97 5:08p Dave
190  * Began work on ingame join ship selection screen/state.
191  * 
192  * 45    9/23/97 11:53p Lawrance
193  * add state do perform multiplayer on-line help
194  * 
195  * 44    9/22/97 4:55p Hoffoss
196  * Added a training message window display thingy.
197  * 
198  * 43    9/19/97 4:24p Allender
199  * added team selection state -- initialze player* variable in
200  * player_level_init
201  * 
202  * 42    9/18/97 10:17p Lawrance
203  * add help state for briefing
204  * 
205  * 41    9/18/97 9:21a Dave
206  * Added view medals state. Changed pilot scoring struct to reflect.
207  * 
208  * 40    8/29/97 4:51p Dave
209  * Added a state and even for multiplayer pausing.
210  * 
211  * 39    8/15/97 5:15p Dave
212  * Added a file xfer state.
213  * 
214  * 38    8/15/97 9:29a Dave
215  * Removed standalone server briefing wait state.
216  * 
217  * 37    8/04/97 4:39p Dave
218  * Added first 3 standalone state handlers
219  * 
220  * 36    7/30/97 5:24p Dave
221  * Added in demo system state.
222  * 
223  * 35    7/24/97 2:17p Dave
224  * Added show statistics state.
225  * 
226  * 34    7/23/97 4:51p Dave
227  * Added join tracker state
228  * 
229  * 33    7/14/97 12:03a Lawrance
230  * added navmap state
231  * 
232  * 32    6/13/97 2:30p Lawrance
233  * Added debriefings
234  * 
235  * 31    6/12/97 9:13a Allender
236  * added sequencing state to the end of ship selection.  Changed some
237  * packet names and host sequencing
238  * 
239  * 30    6/10/97 9:56p Allender
240  * get multiplayer mission selection working.  Host can select mission and
241  * have himself and clients load the mission -- no sequencing past this
242  * point however
243  * 
244  * 29    6/06/97 10:40a Allender
245  * added 'type' to mission (single/multi/etc).  Added a couple of new game
246  * states for allowing to choose mission for multiplayer game
247  * 
248  * 28    5/20/97 10:02a Lawrance
249  * added view medals screen
250  * 
251  * 27    4/28/97 2:17p Lawrance
252  * added help state for hotkey assignment screen
253  * 
254  * 26    4/25/97 3:41p Lawrance
255  * added support for hotkey assignment screen
256  * 
257  * 25    4/23/97 9:54a Lawrance
258  * made show goals screen a separate state
259  * 
260  * 24    4/22/97 11:06a Lawrance
261  * added credits state
262  * 
263  * 23    4/17/97 9:01p Allender
264  * start of campaign stuff.  Campaigns now stored in external file (no
265  * filenames in code).  Continuing campaign won't work at this point
266  * 
267  * 22    4/03/97 8:40p Lawrance
268  * give GS_STATE's for player death correct numbering
269  * 
270  * 21    4/02/97 6:03p Mike
271  * Make dying work through event driven code.
272  * 
273  * 20    3/05/97 5:04p Lawrance
274  * added new states for different context help
275  * 
276  * 19    3/03/97 1:21p Allender
277  * mission log stuff -- display the log during/after game.  Enhanced
278  * structure
279  * 
280  * 18    3/02/97 4:43p Lawrance
281  * Added in state for sound/music sound config
282  * 
283  * 17    2/25/97 11:07a Lawrance
284  * Added support for weapon loadout state
285  * 
286  * 16    1/09/97 12:57p Lawrance
287  * supporting a new state where the player picks to either save or restore
288  * 
289  * 15    1/09/97 12:41a Lawrance
290  * added function to pop a state without restoring that state
291  * 
292  * 14    1/06/97 10:44p Lawrance
293  * Changes to make save/restore functional
294  * 
295  * 13    1/01/97 6:44p Lawrance
296  * added new state for protocol choice in a net game
297  * 
298  * 12    12/03/96 3:45p Lawrance
299  * supporting control configuration
300  * 
301  * 11    12/01/96 3:49a Lawrance
302  * adding support for various multiplayer states
303  * 
304  * 10    11/29/96 6:09p Lawrance
305  * added a state for HUD configuration
306  * 
307  * 9     11/27/96 3:21p Lawrance
308  * added state for when player is examining message scroll-back
309  * 
310  * 8     11/19/96 1:22p Lawrance
311  * added event to start a briefing
312  * 
313  * 7     11/18/96 8:12p John
314  * Changed some briefing and sequencing stuff around.
315  * 
316  * 6     11/18/96 5:07p John
317  * Changed sequencing code to call entry,leave functions for each state
318  * change.   Added Shift+Pause debug pause thing.
319  * 
320  * 5     11/13/96 4:02p Lawrance
321  * complete over-haul of the menu system and the states associated with
322  * them
323  * 
324  * 4     10/23/96 9:08a Allender
325  * Removed primary and secondary goal complete states -- to be implemented
326  * later.
327  *
328 */
329
330
331 // defines for game sequencing
332
333 #ifndef __GAMESEQUENCE_H__
334 #define __GAMESEQUENCE_H__
335
336 #include "pstypes.h"
337
338 // defines for game sequencing events
339 //
340
341 #define GS_EVENT_MAIN_MENU                                                      0               // first event to move to first state
342 #define GS_EVENT_START_GAME                                             1               // start a new game (Loads a mission then goes to briefing state)
343 #define GS_EVENT_ENTER_GAME                                             2               // switches into game state, probably after mission briefing or ship selection.
344 #define GS_EVENT_START_GAME_QUICK                               3               // start a new game (Loads a mission then goes to directly to game state)
345 #define GS_EVENT_END_GAME                                                       4               // end the current game (i.e. back to main menu)
346 #define GS_EVENT_QUIT_GAME                                                      5               // quit the entire game
347 #define GS_EVENT_PAUSE_GAME                                             6               // pause the current game
348 #define GS_EVENT_PREVIOUS_STATE                                 7               // return to the previous state
349 #define GS_EVENT_OPTIONS_MENU                                           8               // go to the options menu
350 #define GS_EVENT_BARRACKS_MENU                                  9               // go to the barracks menu
351 #define GS_EVENT_TRAINING_MENU                                  10              // go to the training menu
352 #define GS_EVENT_TECH_MENU                                                      11              // go to the tech room menu
353 #define GS_EVENT_LOAD_MISSION_MENU                              12              // go to the load mission menu
354 #define GS_EVENT_SHIP_SELECTION                                 13              // Show ship selection menu
355 #define GS_EVENT_TOGGLE_FULLSCREEN                              14              //      toggle fullscreen mode
356 #define GS_EVENT_START_BRIEFING                                 15              // go to the briefing for the current mission
357 #define GS_EVENT_DEBUG_PAUSE_GAME                               16
358 #define GS_EVENT_HUD_CONFIG                                             17              // start the HUD configuration screen
359 #define GS_EVENT_MULTI_JOIN_GAME                                        18              // start multiplayer join game screen
360 #define GS_EVENT_CONTROL_CONFIG                                 19              // get user to choose what type of controller to config
361 #define GS_EVENT_EVENT_DEBUG                                            20               // an event debug trace scroll list display screen
362 #define GS_EVENT_WEAPON_SELECTION                               21              // Do weapon loadout 
363 #define GS_EVENT_MISSION_LOG_SCROLLBACK         22              // scrollback screen for message log entries
364 #define GS_EVENT_GAMEPLAY_HELP                                  23              // show help for the gameplay
365 #define GS_EVENT_DEATH_DIED                                             24              //      Player just died
366 #define GS_EVENT_DEATH_BLEW_UP                                  25              //      Saw ship explode.
367 #define GS_EVENT_NEW_CAMPAIGN                                           26
368 #define GS_EVENT_CREDITS                                                        27              // Got to the credits
369 #define GS_EVENT_SHOW_GOALS                                             28              // Show the goal status screen
370 #define GS_EVENT_HOTKEY_SCREEN                                  29              // Show the hotkey assignment screen
371 #define GS_EVENT_VIEW_MEDALS                                            30              // Go to the View Medals screen
372 #define GS_EVENT_MULTI_HOST_SETUP                               31              // host setup for multiplayer
373 #define GS_EVENT_MULTI_CLIENT_SETUP                             32              // client setup for multiplayer
374 #define GS_EVENT_DEBRIEF                                                        33              // go to debriefing
375 #define GS_EVENT_GOTO_VIEW_CUTSCENES_SCREEN  34    // go to the demo management screen
376 #define GS_EVENT_MULTI_STD_WAIT                                 35    // standalone wait state
377 #define GS_EVENT_STANDALONE_MAIN                                   36    // the main do-nothing state of the standalone
378 #define GS_EVENT_MULTI_PAUSE                                  37    // pause your multiplayer game
379 #define GS_EVENT_TEAM_SELECT                                            38              // team selection for multiplayer
380 #define GS_EVENT_TRAINING_PAUSE                                 39              // pause game while training message is displayed
381 #define GS_EVENT_INGAME_PRE_JOIN                                   40    // go to ship selection screen for ingame join
382 #define GS_EVENT_PLAYER_WARPOUT_START                   41              // player hit 'j' to warp out
383 #define GS_EVENT_PLAYER_WARPOUT_START_FORCED 42         // player is being forced out of mission no matter what
384 #define GS_EVENT_PLAYER_WARPOUT_STOP                    43              // player hit 'esc' or something to cancel warp out
385 #define GS_EVENT_PLAYER_WARPOUT_DONE_STAGE1     44              // player ship got up to speed
386 #define GS_EVENT_PLAYER_WARPOUT_DONE_STAGE2     45              // player ship got through the warp effect
387 #define GS_EVENT_PLAYER_WARPOUT_DONE                    46              // warp effect went away
388 #define GS_EVENT_STANDALONE_POSTGAME                    47         // debriefing, etc
389 #define GS_EVENT_INITIAL_PLAYER_SELECT                  48              // initial screen where player selects from multi/single player pilots
390 #define GS_EVENT_GAME_INIT                   49
391 #define GS_EVENT_MULTI_MISSION_SYNC          50    // sychronize/transfer/load any mission specific data in multiplayer
392 #define GS_EVENT_MULTI_START_GAME                               51              // immediately before the create game screen for the host to set the game variables
393 #define GS_EVENT_MULTI_HOST_OPTIONS                             52              // options the host can set while in the create game scree
394 #define GS_EVENT_MULTI_DOGFIGHT_DEBRIEF         53              // multiplayer furball debriefing screen (replaces normal debriefing)
395 #define GS_EVENT_CAMPAIGN_ROOM                                  54
396 #define GS_EVENT_CMD_BRIEF                                                      55              // switch to command briefing screen
397 #define GS_EVENT_TOGGLE_GLIDE                                           56              //      GS_EVENT_TOGGLE_GLIDE
398 #define GS_EVENT_RED_ALERT                                                      57              // go to red alert screen
399 #define GS_EVENT_SIMULATOR_ROOM                                 58
400 #define GS_EVENT_END_CAMPAIGN                                           59              // end of the whole thang.
401 #define GS_EVENT_END_DEMO                                                       60              // end of demo campaign
402 #define GS_EVENT_LOOP_BRIEF                                             61              // campaign loop brief
403 #define GS_EVENT_CAMPAIGN_CHEAT                                 62              // skip to a mission in a campaign
404 #define GS_EVENT_PXO                                                    63
405 #define GS_EVENT_PXO_HELP                                               64
406 #define GS_EVENT_DEMO_UPSELL                                    65
407
408 // IMPORTANT:  When you add a new event, update the initialization for GS_event_text[]
409 //             which is done in GameSequence.cpp
410 //
411 extern const char *GS_event_text[];             // text description for the GS_EVENT_* #defines above
412
413
414 // defines for game sequencing states
415 //
416 // IMPORTANT:  When you add a new state, update the initialization for GS_state_text[]
417 //             which is done in GameSequence.cpp
418 #define GS_STATE_MAIN_MENU                                              1
419 #define GS_STATE_GAME_PLAY                                              2
420 #define GS_STATE_GAME_PAUSED                                    3
421 #define GS_STATE_QUIT_GAME                                              4
422 #define GS_STATE_OPTIONS_MENU                                   5
423 #define GS_STATE_BARRACKS_MENU                                  6
424 #define GS_STATE_TECH_MENU                                              7
425 #define GS_STATE_TRAINING_MENU                                  8
426 #define GS_STATE_LOAD_MISSION_MENU                              9
427 #define GS_STATE_BRIEFING                                               10
428 #define GS_STATE_SHIP_SELECT                                    11
429 #define GS_STATE_DEBUG_PAUSED                                   12
430 #define GS_STATE_HUD_CONFIG                                             13
431 #define GS_STATE_MULTI_JOIN_GAME                                14
432 #define GS_STATE_CONTROL_CONFIG                                 15
433 #define GS_STATE_WEAPON_SELECT                                  16
434 #define GS_STATE_MISSION_LOG_SCROLLBACK                 17
435 #define GS_STATE_DEATH_DIED                                             18              //      Player just died
436 #define GS_STATE_DEATH_BLEW_UP                                  19              //      Saw ship explode.
437 #define GS_STATE_SIMULATOR_ROOM                                 20
438 #define GS_STATE_CREDITS                                                21
439 #define GS_STATE_SHOW_GOALS                                             22
440 #define GS_STATE_HOTKEY_SCREEN                                  23
441 #define GS_STATE_VIEW_MEDALS                                    24              // Go to the View Medals screen
442 #define GS_STATE_MULTI_HOST_SETUP                               25              // state where host sets up multiplayer game
443 #define GS_STATE_MULTI_CLIENT_SETUP                             26              // client setup for multiplayer game
444 #define GS_STATE_DEBRIEF                                                27
445 #define GS_STATE_VIEW_CUTSCENES                                 28
446 #define GS_STATE_MULTI_STD_WAIT                                 29
447 #define GS_STATE_STANDALONE_MAIN                                30
448 #define GS_STATE_MULTI_PAUSED                                   31
449 #define GS_STATE_TEAM_SELECT                                    32
450 #define GS_STATE_TRAINING_PAUSED                                33               // game is paused while training msg is being read.
451 #define GS_STATE_INGAME_PRE_JOIN                                34               // go to ship selection screen for ingame join
452 #define GS_STATE_EVENT_DEBUG                                    35               // an event debug trace scroll list display screen
453 #define GS_STATE_STANDALONE_POSTGAME                    36               // debriefing, etc.
454 #define GS_STATE_INITIAL_PLAYER_SELECT                  37
455 #define GS_STATE_MULTI_MISSION_SYNC                             38
456 #define GS_STATE_MULTI_START_GAME                               39
457 #define GS_STATE_MULTI_HOST_OPTIONS                             40
458 #define GS_STATE_MULTI_DOGFIGHT_DEBRIEF                 41
459 #define GS_STATE_CAMPAIGN_ROOM                                  42
460 #define GS_STATE_CMD_BRIEF                                              43              // command briefing screen
461 #define GS_STATE_RED_ALERT                                              44              // red alert screen
462 #define GS_STATE_END_OF_CAMPAIGN                                45              // end of main campaign -- only applicable in single player
463 #define GS_STATE_GAMEPLAY_HELP                                  46
464 #define GS_STATE_END_DEMO                                               47              // end of demo campaign (upsell then main menu)
465 #define GS_STATE_LOOP_BRIEF                                             48
466 #define GS_STATE_PXO                                                    49
467 #define GS_STATE_PXO_HELP                                               50
468 #define GS_STATE_DEMO_UPSELL                                    51
469
470
471 // IMPORTANT:  When you add a new state, update the initialization for GS_state_text[]
472 //             which is done in GameSequence.cpp
473 //
474 extern const char *GS_state_text[];             // text description for the GS_STATE_* #defines above
475
476
477 // function prototypes
478 //
479 void gameseq_init();
480 int gameseq_process_events( void );             // returns current game state
481 int gameseq_get_state( int depth = 0 );
482 void gameseq_post_event( int event );
483 int gameseq_get_event( void );
484
485 void gameseq_set_state(int new_state, int override = 0);
486 void gameseq_push_state( int new_state );
487 void gameseq_pop_state( void );
488 int gameseq_get_pushed_state();
489 int gameseq_get_depth();
490 void gameseq_pop_and_discard_state(void);
491
492
493 // Called by the sequencing code when things happen.
494 void game_process_event(int current_state, int event);
495 void game_leave_state(int old_state,int new_state);
496 void game_enter_state(int old_state,int new_state);
497 void game_do_state(int current_state);
498
499 #endif /* __GAMESEQUENCE_H__ */
500