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/FREESPACE2/FreeSpace.h $
15 * FreeSpace, the game, not the project, header information.
18 * Revision 1.3 2003/05/25 02:30:42 taylor
21 * Revision 1.2 2002/06/09 04:41:13 relnev
22 * added copyright header
24 * Revision 1.1.1.1 2002/05/03 03:28:12 root
28 * 24 10/06/99 10:32a Jefff
31 * 23 9/30/99 6:04p Jefff
34 * 22 9/08/99 3:22p Dave
35 * Updated builtin mission list.
37 * 21 9/06/99 6:38p Dave
38 * Improved CD detection code.
40 * 20 9/06/99 1:30a Dave
41 * Intermediate checkin. Started on enforcing CD-in-drive to play the
44 * 19 9/06/99 1:16a Dave
45 * Make sure the user sees the intro movie.
47 * 18 9/05/99 11:19p Dave
48 * Made d3d texture cache much more safe. Fixed training scoring bug where
49 * it would backout scores without ever having applied them in the first
52 * 17 9/03/99 1:32a Dave
53 * CD checking by act. Added support to play 2 cutscenes in a row
54 * seamlessly. Fixed super low level cfile bug related to files in the
55 * root directory of a CD. Added cheat code to set campaign mission # in
58 * 16 8/19/99 10:12a Alanl
59 * preload mission-specific messages on machines greater than 48MB
61 * 15 5/19/99 4:07p Dave
62 * Moved versioning code into a nice isolated common place. Fixed up
63 * updating code on the pxo screen. Fixed several stub problems.
65 * 14 5/09/99 8:57p Dave
66 * Final E3 build preparations.
68 * 13 5/05/99 10:06a Dave
69 * Upped beta version to 0.04
71 * 12 4/29/99 3:02p Dave
74 * 11 4/25/99 3:02p Dave
75 * Build defines for the E3 build.
77 * 10 4/09/99 2:27p Dave
80 * 9 4/09/99 2:21p Dave
81 * Multiplayer beta stuff. CD checking.
83 * 8 4/08/99 2:10a Dave
84 * Numerous bug fixes for the beta. Added builtin mission info for the
87 * 7 3/19/99 9:52a Dave
88 * Checkin to repair massive source safe crash. Also added support for
89 * pof-style nebulae, and some new weapons code.
91 * 6 12/03/98 5:22p Dave
92 * Ported over Freespace 1 multiplayer ships.tbl and weapons.tbl
95 * 5 10/13/98 9:26a Dave
96 * Began neatening up freespace.h.
98 * 4 10/09/98 1:35p Dave
99 * Split off registry stuff into seperate file.
101 * 3 10/07/98 6:27p Dave
102 * Globalized mission and campaign file extensions. Removed Silent Threat
103 * special code. Moved \cache \players and \multidata into the \data
106 * 2 10/07/98 10:54a Dave
109 * 79 9/13/98 10:51p Dave
110 * Put in newfangled icons for mission simulator room. New mdisk.vp
111 * checksum and file length.
113 * 78 9/11/98 6:59p Dave
114 * First beta/rev thingie to interplay.
116 * 77 9/11/98 4:14p Dave
117 * Fixed file checksumming of < file_size. Put in more verbose kicking and
118 * PXO stats store reporting.
120 * 76 9/04/98 3:51p Dave
121 * Put in validated mission updating and application during stats
124 * 75 5/23/98 2:41p Mike
125 * Make Easy the default skill level and prevent old pilot's skill level
126 * from carrying into new pilot.
128 * 74 5/19/98 1:19p Allender
129 * new low level reliable socket reading code. Make all missions/campaign
130 * load/save to data missions folder (i.e. we are rid of the player
133 * 73 5/13/98 11:34p Mike
134 * Model caching system.
136 * 72 5/10/98 10:05p Allender
137 * only show cutscenes which have been seen before. Made Fred able to
138 * write missions anywhere, defaulting to player misison folder, not data
139 * mission folder. Fix FreeSpace code to properly read missions from
142 * 71 5/08/98 7:08p Dave
143 * Lots of UI tweaking.
145 * 70 5/08/98 5:31p Lawrance
146 * extern cd checking routines
153 #ifndef STAMPER_PROGRAM // because of all the dependancies, I have to do this...yuck!!! MWA 7/21/97
156 #include "systemvars.h"
159 // --------------------------------------------------------------------------------------------------------
160 // FREESPACE DEFINES/VARS
163 // filename extensions
165 #define FS_MISSION_FILE_EXT NOX(".fsm")
166 #define FS_CAMPAIGN_FILE_EXT NOX(".fsc")
168 #define FS_MISSION_FILE_EXT NOX(".fs2")
169 #define FS_CAMPAIGN_FILE_EXT NOX(".fc2")
172 // frametime/missiontime variables
173 extern fix Frametime;
174 extern float flFrametime;
175 extern fix Missiontime;
178 extern int Game_skill_level;
180 // see GM_* defines in systemvars.h
181 extern int Game_mode;
183 // if this value is set anywhere within the game_do_state_common() function, the normal do_state() will not be called
184 // for this frame. Useful for getting out of sticky sequencing situations.
185 extern int Game_do_state_should_skip;
188 extern fix Game_time_compression;
190 // Set if subspace is active this level
191 extern int Game_subspace_effect;
193 // The current mission being played.
194 extern char Game_current_mission_filename[MAX_FILENAME_LEN];
196 // if the ships.tbl the player has is valid
197 extern int Game_ships_tbl_valid;
199 // if the weapons.tbl the player has is valid
200 extern int Game_weapons_tbl_valid;
203 // this is a mission actually designed at Volition
205 #define MAX_BUILTIN_MISSIONS 130 // for SilentThreat
207 #define MAX_BUILTIN_MISSIONS 100
209 #define FSB_FROM_VOLITION (1<<0) // we made it in-house
210 #define FSB_MULTI (1<<1) // is a multiplayer mission
211 #define FSB_TRAINING (1<<2) // is a training mission
212 #define FSB_CAMPAIGN (1<<3) // is a campaign mission
213 #define FSB_CAMPAIGN_FILE (1<<4) // is actually a campaign file
215 #define FSB_FROM_MDISK (1<<5) // is from FS1 mdisk (SilentThreat)
218 typedef struct fs_builtin_mission {
219 char filename[MAX_FILENAME_LEN];
220 int flags; // see FSB_* defines above
221 } fs_builtin_mission;
224 // --------------------------------------------------------------------------------------------------------
225 // FREESPACE FUNCTIONS
228 // mission management -------------------------------------------------
230 // loads in the currently selected mission
231 int game_start_mission();
233 // shutdown a mission
234 void game_level_close();
237 // gameplay stuff -----------------------------------------------------
239 // stop the game (mission) timer
240 void game_stop_time();
242 // start the game (mission) timer
243 void game_start_time();
245 // call whenever in a loop or if you need to get a keypress
246 int game_check_key();
248 // poll for keypresses
251 // function to read keyboard stuff
252 void game_process_keys();
254 // call this to set frametime properly (once per frame)
255 void game_set_frametime(int state);
257 // Used to halt all looping game sounds
258 void game_stop_looped_sounds();
260 // do stuff that may need to be done regardless of state
261 void game_do_state_common(int state,int no_networking = 0);
264 // skill level --------------------------------------------------------
266 // increase the skill level (will wrap around to min skill level)
267 void game_increase_skill_level();
269 // get the default game skill level
270 int game_get_default_skill_level();
272 // a keypress. See CPP file for more info.
275 // running with low-memory (less than 48MB)
276 bool game_using_low_mem();
278 // misc ---------------------------------------------------------------
280 // lookup the specified filename. return an fs_builtin_mission* if found, NULL otherwise
281 fs_builtin_mission *game_find_builtin_mission(const char *filename);
285 //================================================================
286 // GAME FLASH STUFF - code in FreeSpace.cpp
289 void game_flash_reset();
291 // Adds a flash effect. These can be positive or negative.
292 // The range will get capped at around -1 to 1, so stick
293 // with a range like that.
294 void game_flash( float r, float g, float b );
296 // Adds a flash for Big Ship explosions
297 // cap range from 0 to 1
298 void big_explosion_flash(float flash);
300 // Call once a frame to diminish the
301 // flash effect to 0.
302 void game_flash_diminish();
304 // Loads the best palette for this level, based
305 // on nebula color and hud color. You could just call palette_load_table with
306 // the appropriate filename, but who wants to do that.
307 void game_load_palette();
309 //================================================================
311 // Call at the beginning of each frame
312 void game_whack_reset();
314 // Call to apply a whack to a the ship. Used for force feedback
315 void game_whack_apply( float x, float y );
317 // call to apply a "shudder"
318 void game_shudder_apply(int time, float intensity);
320 //===================================================================
322 // Used to tell the player that a feature isn't available in the demo version of FreeSpace
323 void game_feature_not_in_demo_popup();
325 // Return version string for demo or full version, depending on build.
326 void get_version_string(char *str, const int str_len);
328 // format the specified time (fixed point) into a nice string
329 void game_format_time(fix m_time, char *time_str, const int time_str_len);
331 // if the game is running using hacked data
332 int game_hacked_data();
334 // show the oem upsell screens (end of campaign, or close of game
335 void oem_upsell_show_screens();
337 #endif // endif of #ifndef STAMPER_PROGRAM