]> icculus.org git repositories - taylor/freespace2.git/blob - include/freespace.h
proper padding of PXO stats struct for FS2 demo
[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.3  2003/05/25 02:30:42  taylor
19  * Freespace 1 support
20  *
21  * Revision 1.2  2002/06/09 04:41:13  relnev
22  * added copyright header
23  *
24  * Revision 1.1.1.1  2002/05/03 03:28:12  root
25  * Initial import.
26  *
27  * 
28  * 24    10/06/99 10:32a Jefff
29  * oem updates
30  * 
31  * 23    9/30/99 6:04p Jefff
32  * OEM changes
33  * 
34  * 22    9/08/99 3:22p Dave
35  * Updated builtin mission list.
36  * 
37  * 21    9/06/99 6:38p Dave
38  * Improved CD detection code.
39  * 
40  * 20    9/06/99 1:30a Dave
41  * Intermediate checkin. Started on enforcing CD-in-drive to play the
42  * game.
43  * 
44  * 19    9/06/99 1:16a Dave
45  * Make sure the user sees the intro movie.
46  * 
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
50  * place.
51  * 
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
56  * main hall.
57  * 
58  * 16    8/19/99 10:12a Alanl
59  * preload mission-specific messages on machines greater than 48MB
60  * 
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.
64  * 
65  * 14    5/09/99 8:57p Dave
66  * Final E3 build preparations.
67  * 
68  * 13    5/05/99 10:06a Dave
69  * Upped beta version to 0.04
70  * 
71  * 12    4/29/99 3:02p Dave
72  * New beta version.
73  * 
74  * 11    4/25/99 3:02p Dave
75  * Build defines for the E3 build.
76  * 
77  * 10    4/09/99 2:27p Dave
78  * Upped version #
79  * 
80  * 9     4/09/99 2:21p Dave
81  * Multiplayer beta stuff. CD checking.
82  * 
83  * 8     4/08/99 2:10a Dave
84  * Numerous bug fixes for the beta. Added builtin mission info for the
85  * beta.
86  * 
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.
90  * 
91  * 6     12/03/98 5:22p Dave
92  * Ported over Freespace 1 multiplayer ships.tbl and weapons.tbl
93  * checksumming.
94  * 
95  * 5     10/13/98 9:26a Dave
96  * Began neatening up freespace.h.
97  * 
98  * 4     10/09/98 1:35p Dave
99  * Split off registry stuff into seperate file.
100  * 
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
104  * directory.
105  * 
106  * 2     10/07/98 10:54a Dave
107  * Initial checkin. 
108  * 
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.
112  * 
113  * 78    9/11/98 6:59p Dave
114  * First beta/rev thingie to interplay.
115  * 
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.
119  * 
120  * 76    9/04/98 3:51p Dave
121  * Put in validated mission updating and application during stats
122  * updating.
123  * 
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.
127  * 
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
131  * missions folder)
132  * 
133  * 73    5/13/98 11:34p Mike
134  * Model caching system.
135  * 
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
140  * correct locations
141  * 
142  * 71    5/08/98 7:08p Dave
143  * Lots of UI tweaking.
144  * 
145  * 70    5/08/98 5:31p Lawrance
146  * extern cd checking routines 
147  *
148  * $NoKeywords: $
149  */
150
151 #ifndef _FREESPACE_H
152 #define _FREESPACE_H
153 #ifndef STAMPER_PROGRAM                                                 // because of all the dependancies, I have to do this...yuck!!!  MWA 7/21/97
154
155 #include "pstypes.h"
156 #include "systemvars.h"
157 #include "2d.h"
158
159 // --------------------------------------------------------------------------------------------------------
160 // FREESPACE DEFINES/VARS
161 //
162                                                                                                                 
163 // filename extensions
164 #ifdef MAKE_FS1
165         #define FS_MISSION_FILE_EXT                             NOX(".fsm")
166         #define FS_CAMPAIGN_FILE_EXT                            NOX(".fsc")
167 #else
168         #define FS_MISSION_FILE_EXT                             NOX(".fs2")
169         #define FS_CAMPAIGN_FILE_EXT                            NOX(".fc2")
170 #endif
171
172 // frametime/missiontime variables
173 extern fix Frametime;
174 extern float flFrametime;
175 extern fix Missiontime;
176
177 // 0 - 4
178 extern int Game_skill_level;
179
180 // see GM_* defines in systemvars.h
181 extern int Game_mode;
182
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;
186
187 // time compression
188 extern fix Game_time_compression;
189
190 // Set if subspace is active this level
191 extern int Game_subspace_effect;                
192
193 // The current mission being played.
194 extern char Game_current_mission_filename[MAX_FILENAME_LEN];
195
196 // if the ships.tbl the player has is valid
197 extern int Game_ships_tbl_valid;
198
199 // if the weapons.tbl the player has is valid
200 extern int Game_weapons_tbl_valid;
201
202
203 // this is a mission actually designed at Volition
204 #ifdef MAKE_FS1
205 #define MAX_BUILTIN_MISSIONS                                    130                     // for SilentThreat
206 #else
207 #define MAX_BUILTIN_MISSIONS                                    100
208 #endif
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
214 #ifdef MAKE_FS1
215 #define FSB_FROM_MDISK                                                  (1<<5)          // is from FS1 mdisk (SilentThreat)
216 #endif
217
218 typedef struct fs_builtin_mission {
219         char filename[MAX_FILENAME_LEN];
220         int flags;                                                                                                                      // see FSB_* defines above
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(const 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 // 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();
324
325 //      Return version string for demo or full version, depending on build.
326 void get_version_string(char *str, const int str_len);
327
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);
330
331 // if the game is running using hacked data
332 int game_hacked_data();
333
334 // show the oem upsell screens (end of campaign, or close of game
335 void oem_upsell_show_screens();
336
337 #endif                  // endif of #ifndef STAMPER_PROGRAM
338 #endif 
339