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.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 * 24 10/06/99 10:32a Jefff
28 * 23 9/30/99 6:04p Jefff
31 * 22 9/08/99 3:22p Dave
32 * Updated builtin mission list.
34 * 21 9/06/99 6:38p Dave
35 * Improved CD detection code.
37 * 20 9/06/99 1:30a Dave
38 * Intermediate checkin. Started on enforcing CD-in-drive to play the
41 * 19 9/06/99 1:16a Dave
42 * Make sure the user sees the intro movie.
44 * 18 9/05/99 11:19p Dave
45 * Made d3d texture cache much more safe. Fixed training scoring bug where
46 * it would backout scores without ever having applied them in the first
49 * 17 9/03/99 1:32a Dave
50 * CD checking by act. Added support to play 2 cutscenes in a row
51 * seamlessly. Fixed super low level cfile bug related to files in the
52 * root directory of a CD. Added cheat code to set campaign mission # in
55 * 16 8/19/99 10:12a Alanl
56 * preload mission-specific messages on machines greater than 48MB
58 * 15 5/19/99 4:07p Dave
59 * Moved versioning code into a nice isolated common place. Fixed up
60 * updating code on the pxo screen. Fixed several stub problems.
62 * 14 5/09/99 8:57p Dave
63 * Final E3 build preparations.
65 * 13 5/05/99 10:06a Dave
66 * Upped beta version to 0.04
68 * 12 4/29/99 3:02p Dave
71 * 11 4/25/99 3:02p Dave
72 * Build defines for the E3 build.
74 * 10 4/09/99 2:27p Dave
77 * 9 4/09/99 2:21p Dave
78 * Multiplayer beta stuff. CD checking.
80 * 8 4/08/99 2:10a Dave
81 * Numerous bug fixes for the beta. Added builtin mission info for the
84 * 7 3/19/99 9:52a Dave
85 * Checkin to repair massive source safe crash. Also added support for
86 * pof-style nebulae, and some new weapons code.
88 * 6 12/03/98 5:22p Dave
89 * Ported over Freespace 1 multiplayer ships.tbl and weapons.tbl
92 * 5 10/13/98 9:26a Dave
93 * Began neatening up freespace.h.
95 * 4 10/09/98 1:35p Dave
96 * Split off registry stuff into seperate file.
98 * 3 10/07/98 6:27p Dave
99 * Globalized mission and campaign file extensions. Removed Silent Threat
100 * special code. Moved \cache \players and \multidata into the \data
103 * 2 10/07/98 10:54a Dave
106 * 79 9/13/98 10:51p Dave
107 * Put in newfangled icons for mission simulator room. New mdisk.vp
108 * checksum and file length.
110 * 78 9/11/98 6:59p Dave
111 * First beta/rev thingie to interplay.
113 * 77 9/11/98 4:14p Dave
114 * Fixed file checksumming of < file_size. Put in more verbose kicking and
115 * PXO stats store reporting.
117 * 76 9/04/98 3:51p Dave
118 * Put in validated mission updating and application during stats
121 * 75 5/23/98 2:41p Mike
122 * Make Easy the default skill level and prevent old pilot's skill level
123 * from carrying into new pilot.
125 * 74 5/19/98 1:19p Allender
126 * new low level reliable socket reading code. Make all missions/campaign
127 * load/save to data missions folder (i.e. we are rid of the player
130 * 73 5/13/98 11:34p Mike
131 * Model caching system.
133 * 72 5/10/98 10:05p Allender
134 * only show cutscenes which have been seen before. Made Fred able to
135 * write missions anywhere, defaulting to player misison folder, not data
136 * mission folder. Fix FreeSpace code to properly read missions from
139 * 71 5/08/98 7:08p Dave
140 * Lots of UI tweaking.
142 * 70 5/08/98 5:31p Lawrance
143 * extern cd checking routines
150 #ifndef STAMPER_PROGRAM // because of all the dependancies, I have to do this...yuck!!! MWA 7/21/97
153 #include "systemvars.h"
156 // --------------------------------------------------------------------------------------------------------
157 // FREESPACE DEFINES/VARS
160 // filename extensions
161 #define FS_MISSION_FILE_EXT NOX(".fs2")
162 #define FS_CAMPAIGN_FILE_EXT NOX(".fc2")
164 // CDROM volume names
165 #ifdef MULTIPLAYER_BETA_BUILD
166 #define FS_CDROM_VOLUME_1 NOX("FS2_BETA")
167 #define FS_CDROM_VOLUME_2 NOX("FS2_BETA")
168 #elif defined(E3_BUILD)
169 #define FS_CDROM_VOLUME_1 NOX("FS2_E3DEMO")
170 #define FS_CDROM_VOLUME_2 NOX("FS2_E3DEMO")
171 #elif defined(OEM_BUILD)
172 #define FS_CDROM_VOLUME_1 NOX("FS2_OEM")
173 #define FS_CDROM_VOLUME_2 NOX("FS2_OEM")
174 #define FS_CDROM_VOLUME_3 NOX("FS2_OEM")
176 #define FS_CDROM_VOLUME_1 NOX("FREESPACE2_1")
177 #define FS_CDROM_VOLUME_2 NOX("FREESPACE2_2")
178 #define FS_CDROM_VOLUME_3 NOX("FREESPACE2_3")
181 // #define FS_CDROM_VOLUME_1 NOX("FREESPACE_1")
182 // #define FS_CDROM_VOLUME_2 NOX("FREESPACE_2")
183 // #define FS_CDROM_VOLUME_3 NOX("FREESPACE_3")
186 // frametime/missiontime variables
187 extern fix Frametime;
188 extern float flFrametime;
189 extern fix Missiontime;
192 extern int Game_skill_level;
194 // see GM_* defines in systemvars.h
195 extern int Game_mode;
197 // if this value is set anywhere within the game_do_state_common() function, the normal do_state() will not be called
198 // for this frame. Useful for getting out of sticky sequencing situations.
199 extern int Game_do_state_should_skip;
202 extern fix Game_time_compression;
204 // Set if subspace is active this level
205 extern int Game_subspace_effect;
207 // The current mission being played.
208 extern char Game_current_mission_filename[MAX_FILENAME_LEN];
210 // game's CDROM directory
211 extern char Game_CDROM_dir[MAX_PATH_LEN];
213 // if the ships.tbl the player has is valid
214 extern int Game_ships_tbl_valid;
216 // if the weapons.tbl the player has is valid
217 extern int Game_weapons_tbl_valid;
220 // this is a mission actually designed at Volition
221 #define MAX_BUILTIN_MISSIONS 100
222 #define FSB_FROM_VOLITION (1<<0) // we made it in-house
223 #define FSB_MULTI (1<<1) // is a multiplayer mission
224 #define FSB_TRAINING (1<<2) // is a training mission
225 #define FSB_CAMPAIGN (1<<3) // is a campaign mission
226 #define FSB_CAMPAIGN_FILE (1<<4) // is actually a campaign file
228 typedef struct fs_builtin_mission {
229 char filename[MAX_FILENAME_LEN];
230 int flags; // see FSB_* defines above
231 char cd_volume[MAX_FILENAME_LEN]; // cd volume which this needs
232 } fs_builtin_mission;
235 // --------------------------------------------------------------------------------------------------------
236 // FREESPACE FUNCTIONS
239 // mission management -------------------------------------------------
241 // loads in the currently selected mission
242 int game_start_mission();
244 // shutdown a mission
245 void game_level_close();
248 // gameplay stuff -----------------------------------------------------
250 // stop the game (mission) timer
251 void game_stop_time();
253 // start the game (mission) timer
254 void game_start_time();
256 // call whenever in a loop or if you need to get a keypress
257 int game_check_key();
259 // poll for keypresses
262 // function to read keyboard stuff
263 void game_process_keys();
265 // call this to set frametime properly (once per frame)
266 void game_set_frametime(int state);
268 // Used to halt all looping game sounds
269 void game_stop_looped_sounds();
271 // do stuff that may need to be done regardless of state
272 void game_do_state_common(int state,int no_networking = 0);
275 // skill level --------------------------------------------------------
277 // increase the skill level (will wrap around to min skill level)
278 void game_increase_skill_level();
280 // get the default game skill level
281 int game_get_default_skill_level();
283 // a keypress. See CPP file for more info.
286 // running with low-memory (less than 48MB)
287 bool game_using_low_mem();
289 // misc ---------------------------------------------------------------
291 // lookup the specified filename. return an fs_builtin_mission* if found, NULL otherwise
292 fs_builtin_mission *game_find_builtin_mission(char *filename);
296 //================================================================
297 // GAME FLASH STUFF - code in FreeSpace.cpp
300 void game_flash_reset();
302 // Adds a flash effect. These can be positive or negative.
303 // The range will get capped at around -1 to 1, so stick
304 // with a range like that.
305 void game_flash( float r, float g, float b );
307 // Adds a flash for Big Ship explosions
308 // cap range from 0 to 1
309 void big_explosion_flash(float flash);
311 // Call once a frame to diminish the
312 // flash effect to 0.
313 void game_flash_diminish();
315 // Loads the best palette for this level, based
316 // on nebula color and hud color. You could just call palette_load_table with
317 // the appropriate filename, but who wants to do that.
318 void game_load_palette();
320 //================================================================
322 // Call at the beginning of each frame
323 void game_whack_reset();
325 // Call to apply a whack to a the ship. Used for force feedback
326 void game_whack_apply( float x, float y );
328 // call to apply a "shudder"
329 void game_shudder_apply(int time, float intensity);
331 //===================================================================
333 // make sure a CD is in the drive before continuing (returns 1 to continue, otherwise 0).
334 int game_do_cd_check(char *volume_name=NULL);
335 int game_do_cd_check_specific(char *volume_name, int cdnum);
336 int find_freespace_cd(char *volume_name=NULL);
337 int set_cdrom_path(int drive_num);
338 int game_do_cd_mission_check(char *filename);
340 // Used to tell the player that a feature isn't available in the demo version of FreeSpace
341 void game_feature_not_in_demo_popup();
343 // Return version string for demo or full version, depending on build.
344 void get_version_string(char *str);
346 // format the specified time (fixed point) into a nice string
347 void game_format_time(fix m_time,char *time_str);
349 // if the game is running using hacked data
350 int game_hacked_data();
352 // show the oem upsell screens (end of campaign, or close of game
353 void oem_upsell_show_screens();
355 #endif // endif of #ifndef STAMPER_PROGRAM