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