2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
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
10 * $Logfile: /Freespace2/code/GameSequence/GameSequence.h $
15 * Header file for Game Sequencing items
18 * Revision 1.2 2002/06/09 04:41:13 relnev
19 * added copyright header
21 * Revision 1.1.1.1 2002/05/03 03:28:12 root
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
31 * 7 8/27/99 12:04a Dave
32 * Campaign loop screen.
34 * 6 8/04/99 5:36p Andsager
35 * Show upsell screens at end of demo campaign before returning to main
38 * 5 2/23/99 2:29p Dave
39 * First run of oldschool dogfight mode.
41 * 4 11/05/98 5:55p Dave
42 * Big pass at reducing #includes
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
49 * 2 10/07/98 10:52a Dave
52 * 1 10/07/98 10:48a Dave
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.
58 * 82 5/12/98 2:46a Dave
59 * Rudimentary communication between Parallax Online and freespace. Can
60 * get and store channel lists.
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
67 * 80 4/23/98 7:08p John
68 * Removed some obsoleted states.
70 * 79 4/16/98 4:31p Hoffoss
71 * Changed demo screen referenced to view cutscenes screen, which is now
74 * 78 4/02/98 5:40p Hoffoss
75 * Added the Load Mission screen to FreeSpace.
77 * 77 3/11/98 5:32p Lawrance
78 * Fix up text arrays for events/states
80 * 76 3/09/98 12:13a Lawrance
81 * Add support for Red Alert missions
83 * 75 3/07/98 5:44p Dave
84 * Finished player info popup. Ironed out a few todo bugs.
86 * 74 3/05/98 4:12p John
87 * Made Debug+F4 switch Glide and windowed.
89 * 73 3/03/98 1:00p Hoffoss
90 * Added new command briefing event and state.
92 * 72 3/02/98 3:44p Hoffoss
93 * Added new Campaign Room state and event.
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.
99 * 70 2/18/98 10:21p Dave
100 * Ripped out old file xfer system. Put in brand new xfer system.
102 * 69 2/08/98 5:07p Dave
103 * Put in support for multiplayer furball mode.
105 * 68 1/28/98 6:22p Dave
106 * Made standalone use ~8 megs less memory. Fixed multiplayer submenu
109 * 67 1/23/98 5:43p Dave
110 * Finished bringing standalone up to speed. Coded in new host options
113 * 66 1/22/98 5:25p Dave
114 * Modified some pregame sequencing packets. Starting to repair broken
117 * 65 1/20/98 5:42p Dave
118 * Moved ingame join to its own module. Improved it a bit.
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.
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
129 * 62 1/05/98 10:05a Dave
130 * Big re-sequencing of server transfer. Centralized _all_ server transfer
131 * code to one module.
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
137 * 60 12/24/97 8:56p Lawrance
138 * took out obsolete state used for non-existant sound config screen
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.
144 * 58 11/15/97 2:37p Dave
145 * More multiplayer campaign support.
147 * 57 11/13/97 7:01p Hoffoss
148 * Fixed GS_state_text[], which didn't match the current states we have
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
155 * 55 11/10/97 6:02p Hoffoss
156 * Added new debug paused state.
158 * 54 11/03/97 10:12p Hoffoss
159 * Finished up work on the hud message/mission log scrollback screen.
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.
165 * 52 10/27/97 8:33a John
166 * added code for new player warpout sequence
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
174 * 50 10/18/97 7:47p Hoffoss
175 * Changed state workings for controls config screen.
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
182 * 48 10/02/97 4:52p Dave
183 * Added event to move to the multi wait state with a post_event
185 * 47 10/01/97 4:52p Dave
186 * Got ingame join and observer mode to correctly work under the new
189 * 46 9/30/97 5:08p Dave
190 * Began work on ingame join ship selection screen/state.
192 * 45 9/23/97 11:53p Lawrance
193 * add state do perform multiplayer on-line help
195 * 44 9/22/97 4:55p Hoffoss
196 * Added a training message window display thingy.
198 * 43 9/19/97 4:24p Allender
199 * added team selection state -- initialze player* variable in
202 * 42 9/18/97 10:17p Lawrance
203 * add help state for briefing
205 * 41 9/18/97 9:21a Dave
206 * Added view medals state. Changed pilot scoring struct to reflect.
208 * 40 8/29/97 4:51p Dave
209 * Added a state and even for multiplayer pausing.
211 * 39 8/15/97 5:15p Dave
212 * Added a file xfer state.
214 * 38 8/15/97 9:29a Dave
215 * Removed standalone server briefing wait state.
217 * 37 8/04/97 4:39p Dave
218 * Added first 3 standalone state handlers
220 * 36 7/30/97 5:24p Dave
221 * Added in demo system state.
223 * 35 7/24/97 2:17p Dave
224 * Added show statistics state.
226 * 34 7/23/97 4:51p Dave
227 * Added join tracker state
229 * 33 7/14/97 12:03a Lawrance
232 * 32 6/13/97 2:30p Lawrance
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
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
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
248 * 28 5/20/97 10:02a Lawrance
249 * added view medals screen
251 * 27 4/28/97 2:17p Lawrance
252 * added help state for hotkey assignment screen
254 * 26 4/25/97 3:41p Lawrance
255 * added support for hotkey assignment screen
257 * 25 4/23/97 9:54a Lawrance
258 * made show goals screen a separate state
260 * 24 4/22/97 11:06a Lawrance
261 * added credits state
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
267 * 22 4/03/97 8:40p Lawrance
268 * give GS_STATE's for player death correct numbering
270 * 21 4/02/97 6:03p Mike
271 * Make dying work through event driven code.
273 * 20 3/05/97 5:04p Lawrance
274 * added new states for different context help
276 * 19 3/03/97 1:21p Allender
277 * mission log stuff -- display the log during/after game. Enhanced
280 * 18 3/02/97 4:43p Lawrance
281 * Added in state for sound/music sound config
283 * 17 2/25/97 11:07a Lawrance
284 * Added support for weapon loadout state
286 * 16 1/09/97 12:57p Lawrance
287 * supporting a new state where the player picks to either save or restore
289 * 15 1/09/97 12:41a Lawrance
290 * added function to pop a state without restoring that state
292 * 14 1/06/97 10:44p Lawrance
293 * Changes to make save/restore functional
295 * 13 1/01/97 6:44p Lawrance
296 * added new state for protocol choice in a net game
298 * 12 12/03/96 3:45p Lawrance
299 * supporting control configuration
301 * 11 12/01/96 3:49a Lawrance
302 * adding support for various multiplayer states
304 * 10 11/29/96 6:09p Lawrance
305 * added a state for HUD configuration
307 * 9 11/27/96 3:21p Lawrance
308 * added state for when player is examining message scroll-back
310 * 8 11/19/96 1:22p Lawrance
311 * added event to start a briefing
313 * 7 11/18/96 8:12p John
314 * Changed some briefing and sequencing stuff around.
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.
320 * 5 11/13/96 4:02p Lawrance
321 * complete over-haul of the menu system and the states associated with
324 * 4 10/23/96 9:08a Allender
325 * Removed primary and secondary goal complete states -- to be implemented
331 // defines for game sequencing
333 #ifndef __GAMESEQUENCE_H__
334 #define __GAMESEQUENCE_H__
338 // defines for game sequencing events
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
405 // IMPORTANT: When you add a new event, update the initialization for GS_event_text[]
406 // which is done in GameSequence.cpp
408 extern char *GS_event_text[]; // text description for the GS_EVENT_* #defines above
411 // defines for game sequencing states
413 // IMPORTANT: When you add a new state, update the initialization for GS_state_text[]
414 // which is done in GameSequence.cpp
415 #define GS_STATE_MAIN_MENU 1
416 #define GS_STATE_GAME_PLAY 2
417 #define GS_STATE_GAME_PAUSED 3
418 #define GS_STATE_QUIT_GAME 4
419 #define GS_STATE_OPTIONS_MENU 5
420 #define GS_STATE_BARRACKS_MENU 7
421 #define GS_STATE_TECH_MENU 8
422 #define GS_STATE_TRAINING_MENU 9
423 #define GS_STATE_LOAD_MISSION_MENU 10
424 #define GS_STATE_BRIEFING 11
425 #define GS_STATE_SHIP_SELECT 12
426 #define GS_STATE_DEBUG_PAUSED 13
427 #define GS_STATE_HUD_CONFIG 14
428 #define GS_STATE_MULTI_JOIN_GAME 15
429 #define GS_STATE_CONTROL_CONFIG 16
430 #define GS_STATE_WEAPON_SELECT 17
431 #define GS_STATE_MISSION_LOG_SCROLLBACK 18
432 #define GS_STATE_DEATH_DIED 19 // Player just died
433 #define GS_STATE_DEATH_BLEW_UP 20 // Saw ship explode.
434 #define GS_STATE_SIMULATOR_ROOM 21
435 #define GS_STATE_CREDITS 22
436 #define GS_STATE_SHOW_GOALS 23
437 #define GS_STATE_HOTKEY_SCREEN 24
438 #define GS_STATE_VIEW_MEDALS 25 // Go to the View Medals screen
439 #define GS_STATE_MULTI_HOST_SETUP 26 // state where host sets up multiplayer game
440 #define GS_STATE_MULTI_CLIENT_SETUP 27 // client setup for multiplayer game
441 #define GS_STATE_DEBRIEF 28
442 #define GS_STATE_VIEW_CUTSCENES 29
443 #define GS_STATE_MULTI_STD_WAIT 30
444 #define GS_STATE_STANDALONE_MAIN 31
445 #define GS_STATE_MULTI_PAUSED 32
446 #define GS_STATE_TEAM_SELECT 33
447 #define GS_STATE_TRAINING_PAUSED 34 // game is paused while training msg is being read.
448 #define GS_STATE_INGAME_PRE_JOIN 35 // go to ship selection screen for ingame join
449 #define GS_STATE_EVENT_DEBUG 36 // an event debug trace scroll list display screen
450 #define GS_STATE_STANDALONE_POSTGAME 37 // debriefing, etc.
451 #define GS_STATE_INITIAL_PLAYER_SELECT 38
452 #define GS_STATE_MULTI_MISSION_SYNC 39
453 #define GS_STATE_MULTI_START_GAME 40
454 #define GS_STATE_MULTI_HOST_OPTIONS 41
455 #define GS_STATE_MULTI_DOGFIGHT_DEBRIEF 42
456 #define GS_STATE_CAMPAIGN_ROOM 43
457 #define GS_STATE_CMD_BRIEF 44 // command briefing screen
458 #define GS_STATE_RED_ALERT 45 // red alert screen
459 #define GS_STATE_END_OF_CAMPAIGN 46 // end of main campaign -- only applicable in single player
460 #define GS_STATE_GAMEPLAY_HELP 47
461 #define GS_STATE_END_DEMO 48 // end of demo campaign (upsell then main menu)
462 #define GS_STATE_LOOP_BRIEF 49
465 // IMPORTANT: When you add a new state, update the initialization for GS_state_text[]
466 // which is done in GameSequence.cpp
468 extern char *GS_state_text[]; // text description for the GS_STATE_* #defines above
471 // function prototypes
474 int gameseq_process_events( void ); // returns current game state
475 int gameseq_get_state( int depth = 0 );
476 void gameseq_post_event( int event );
477 int gameseq_get_event( void );
479 void gameseq_set_state(int new_state, int override = 0);
480 void gameseq_push_state( int new_state );
481 void gameseq_pop_state( void );
482 int gameseq_get_pushed_state();
483 int gameseq_get_depth();
484 void gameseq_pop_and_discard_state(void);
487 // Called by the sequencing code when things happen.
488 void game_process_event(int current_state, int event);
489 void game_leave_state(int old_state,int new_state);
490 void game_enter_state(int old_state,int new_state);
491 void game_do_state(int current_state);
493 #endif /* __GAMESEQUENCE_H__ */