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