]> icculus.org git repositories - taylor/freespace2.git/blob - include/freespace.h
added copyright header
[taylor/freespace2.git] / include / freespace.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/FREESPACE2/FreeSpace.h $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * FreeSpace, the game, not the project, header information.
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  * 24    10/06/99 10:32a Jefff
26  * oem updates
27  * 
28  * 23    9/30/99 6:04p Jefff
29  * OEM changes
30  * 
31  * 22    9/08/99 3:22p Dave
32  * Updated builtin mission list.
33  * 
34  * 21    9/06/99 6:38p Dave
35  * Improved CD detection code.
36  * 
37  * 20    9/06/99 1:30a Dave
38  * Intermediate checkin. Started on enforcing CD-in-drive to play the
39  * game.
40  * 
41  * 19    9/06/99 1:16a Dave
42  * Make sure the user sees the intro movie.
43  * 
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
47  * place.
48  * 
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
53  * main hall.
54  * 
55  * 16    8/19/99 10:12a Alanl
56  * preload mission-specific messages on machines greater than 48MB
57  * 
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.
61  * 
62  * 14    5/09/99 8:57p Dave
63  * Final E3 build preparations.
64  * 
65  * 13    5/05/99 10:06a Dave
66  * Upped beta version to 0.04
67  * 
68  * 12    4/29/99 3:02p Dave
69  * New beta version.
70  * 
71  * 11    4/25/99 3:02p Dave
72  * Build defines for the E3 build.
73  * 
74  * 10    4/09/99 2:27p Dave
75  * Upped version #
76  * 
77  * 9     4/09/99 2:21p Dave
78  * Multiplayer beta stuff. CD checking.
79  * 
80  * 8     4/08/99 2:10a Dave
81  * Numerous bug fixes for the beta. Added builtin mission info for the
82  * beta.
83  * 
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.
87  * 
88  * 6     12/03/98 5:22p Dave
89  * Ported over Freespace 1 multiplayer ships.tbl and weapons.tbl
90  * checksumming.
91  * 
92  * 5     10/13/98 9:26a Dave
93  * Began neatening up freespace.h.
94  * 
95  * 4     10/09/98 1:35p Dave
96  * Split off registry stuff into seperate file.
97  * 
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
101  * directory.
102  * 
103  * 2     10/07/98 10:54a Dave
104  * Initial checkin. 
105  * 
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.
109  * 
110  * 78    9/11/98 6:59p Dave
111  * First beta/rev thingie to interplay.
112  * 
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.
116  * 
117  * 76    9/04/98 3:51p Dave
118  * Put in validated mission updating and application during stats
119  * updating.
120  * 
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.
124  * 
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
128  * missions folder)
129  * 
130  * 73    5/13/98 11:34p Mike
131  * Model caching system.
132  * 
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
137  * correct locations
138  * 
139  * 71    5/08/98 7:08p Dave
140  * Lots of UI tweaking.
141  * 
142  * 70    5/08/98 5:31p Lawrance
143  * extern cd checking routines 
144  *
145  * $NoKeywords: $
146  */
147
148 #ifndef _FREESPACE_H
149 #define _FREESPACE_H
150 #ifndef STAMPER_PROGRAM                                                 // because of all the dependancies, I have to do this...yuck!!!  MWA 7/21/97
151
152 #include "pstypes.h"
153 #include "systemvars.h"
154 #include "2d.h"
155
156 // --------------------------------------------------------------------------------------------------------
157 // FREESPACE DEFINES/VARS
158 //
159                                                                                                                 
160 // filename extensions
161 #define FS_MISSION_FILE_EXT                             NOX(".fs2")
162 #define FS_CAMPAIGN_FILE_EXT                            NOX(".fc2")
163
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")
175 #else
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")
179
180         // old volume names
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")
184 #endif
185
186 // frametime/missiontime variables
187 extern fix Frametime;
188 extern float flFrametime;
189 extern fix Missiontime;
190
191 // 0 - 4
192 extern int Game_skill_level;
193
194 // see GM_* defines in systemvars.h
195 extern int Game_mode;
196
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;
200
201 // time compression
202 extern fix Game_time_compression;
203
204 // Set if subspace is active this level
205 extern int Game_subspace_effect;                
206
207 // The current mission being played.
208 extern char Game_current_mission_filename[MAX_FILENAME_LEN];
209
210 // game's CDROM directory
211 extern char Game_CDROM_dir[MAX_PATH_LEN];
212
213 // if the ships.tbl the player has is valid
214 extern int Game_ships_tbl_valid;
215
216 // if the weapons.tbl the player has is valid
217 extern int Game_weapons_tbl_valid;
218
219
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
227
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;
233
234
235 // --------------------------------------------------------------------------------------------------------
236 // FREESPACE FUNCTIONS
237 //
238
239 // mission management -------------------------------------------------
240
241 // loads in the currently selected mission
242 int game_start_mission();               
243
244 // shutdown a mission
245 void game_level_close();
246
247
248 // gameplay stuff -----------------------------------------------------
249
250 // stop the game (mission) timer
251 void game_stop_time();
252
253 // start the game (mission) timer
254 void game_start_time();
255
256 // call whenever in a loop or if you need to get a keypress
257 int game_check_key();
258
259 // poll for keypresses
260 int game_poll();
261
262 // function to read keyboard stuff
263 void game_process_keys();
264
265 // call this to set frametime properly (once per frame)
266 void game_set_frametime(int state);
267
268 // Used to halt all looping game sounds
269 void game_stop_looped_sounds();
270
271 // do stuff that may need to be done regardless of state
272 void game_do_state_common(int state,int no_networking = 0);
273
274
275 // skill level --------------------------------------------------------
276
277 // increase the skill level (will wrap around to min skill level)
278 void game_increase_skill_level();
279
280 // get the default game skill level
281 int game_get_default_skill_level();
282
283 // a keypress.  See CPP file for more info.
284 void game_flush();
285
286 // running with low-memory (less than 48MB)
287 bool game_using_low_mem();
288
289 // misc ---------------------------------------------------------------
290
291 // lookup the specified filename. return an fs_builtin_mission* if found, NULL otherwise
292 fs_builtin_mission *game_find_builtin_mission(char *filename);
293
294
295
296 //================================================================
297 // GAME FLASH STUFF  - code in FreeSpace.cpp
298
299 // Resets the flash
300 void game_flash_reset();
301
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 );
306
307 // Adds a flash for Big Ship explosions
308 // cap range from 0 to 1
309 void big_explosion_flash(float flash);
310
311 // Call once a frame to diminish the
312 // flash effect to 0.
313 void game_flash_diminish();
314
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();
319
320 //================================================================
321
322 // Call at the beginning of each frame
323 void game_whack_reset();
324
325 // Call to apply a whack to a the ship. Used for force feedback
326 void game_whack_apply( float x, float y );
327
328 // call to apply a "shudder"
329 void game_shudder_apply(int time, float intensity);
330
331 //===================================================================
332
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);
339
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();
342
343 //      Return version string for demo or full version, depending on build.
344 void get_version_string(char *str);
345
346 // format the specified time (fixed point) into a nice string
347 void game_format_time(fix m_time,char *time_str);
348
349 // if the game is running using hacked data
350 int game_hacked_data();
351
352 // show the oem upsell screens (end of campaign, or close of game
353 void oem_upsell_show_screens();
354
355 #endif                  // endif of #ifndef STAMPER_PROGRAM
356 #endif 
357