]> icculus.org git repositories - taylor/freespace2.git/blob - include/systemvars.h
fix issue with looping audio streams
[taylor/freespace2.git] / include / systemvars.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/GlobalIncs/SystemVars.h $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * Variables and constants common to FreeSpace and Fred.
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:15  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  * 11    6/22/99 7:03p Dave
29  * New detail options screen.
30  * 
31  * 10    6/16/99 4:06p Dave
32  * New pilot info popup. Added new draw-bitmap-as-poly function.
33  * 
34  * 9     6/14/99 10:45a Dave
35  * Made beam weapons specify accuracy by skill level in the weapons.tbl
36  * 
37  * 8     5/24/99 5:45p Dave
38  * Added detail levels to the nebula, with a decent speedup. Split nebula
39  * lightning into its own section.
40  * 
41  * 7     3/29/99 6:17p Dave
42  * More work on demo system. Got just about everything in except for
43  * blowing ships up, secondary weapons and player death/warpout.
44  * 
45  * 6     3/28/99 5:58p Dave
46  * Added early demo code. Make objects move. Nice and framerate
47  * independant, but not much else. Don't use yet unless you're me :)
48  * 
49  * 5     3/28/99 12:37p Dave
50  * Tentative beginnings to warpin effect.
51  * 
52  * 4     11/30/98 1:07p Dave
53  * 16 bit conversion, first run.
54  * 
55  * 3     10/07/98 6:27p Dave
56  * Globalized mission and campaign file extensions. Removed Silent Threat
57  * special code. Moved \cache \players and \multidata into the \data
58  * directory.
59  * 
60  * 2     10/07/98 10:52a Dave
61  * Initial checkin.
62  * 
63  * 1     10/07/98 10:48a Dave
64  * 
65  * 37    9/21/98 8:46p Dave
66  * Put in special check in fred for identifying unknown ships.
67  * 
68  * 36    8/17/98 5:07p Dave
69  * First rev of corkscrewing missiles.
70  * 
71  * 35    5/13/98 11:34p Mike
72  * Model caching system.
73  * 
74  * 34    5/09/98 4:52p Lawrance
75  * Implement padlock view (up/rear/left/right)
76  * 
77  * 33    4/01/98 5:34p John
78  * Made only the used POFs page in for a level.   Reduced some interp
79  * arrays.    Made custom detail level work differently.
80  * 
81  * 32    3/31/98 5:18p John
82  * Removed demo/save/restore.  Made NDEBUG defined compile.  Removed a
83  * bunch of debug stuff out of player file.  Made model code be able to
84  * unload models and malloc out only however many models are needed.
85  *  
86  * 
87  * 31    3/30/98 2:38p Mike
88  * Add asteroid_density to detail level support.
89  * No force explosion damage in training missions.
90  * Make cargo deathrolls shorter.
91  * 
92  * 30    3/23/98 5:19p John
93  * Upped number of default detail levels to 4
94  * 
95  * 29    3/22/98 2:41p John
96  * Added lighting into the detail structure.
97  * 
98  * 28    3/22/98 11:06a John
99  * Changed default detail levels
100  * 
101  * 27    3/22/98 11:02a John
102  * Made a bunch of the detail levels actually do something
103  * 
104  * 26    3/22/98 9:53a John
105  * Added in first stage of new detail level stuff
106  * 
107  * 25    3/17/98 3:53p Lawrance
108  * Fix warpout in chase view
109  * 
110  * 24    2/28/98 7:03p Lawrance
111  * get slew working in any view
112  * 
113  * 23    2/26/98 12:33a Lawrance
114  * Added back slew mode,  lots of changes to external and chase views.
115  * 
116  * 22    2/10/98 9:06a John
117  * Added variables for restoring
118  * 
119  * 21    2/03/98 9:25p John
120  * Upgraded Direct3D code to new version 5.0 code.  Separated the D3D code
121  * more.  Added a global variable D3D_enabled flag.
122  * 
123  * 20    1/13/98 2:20p John
124  * Added code to load palette based on hud color.  Added code to turn off
125  * nebulas using detail.  Added code in WinMain to time out after waiting
126  * too long for window creation.    
127  * 
128  * 19    12/19/97 12:03p Allender
129  * Added GM_CAMPAIGN_MODE to indicate when player is in a campaign or not.
130  * Started adding FreeSpace support for carrying of ship/weapon types
131  * across missions in a campaign.
132  * 
133  * 18    12/16/97 6:20p Hoffoss
134  * Added more debugging code for demos, and fixed a bug in demo
135  * recording/playback.
136  * 
137  * 17    12/05/97 3:46p John
138  * made ship thruster glow scale instead of being an animation.
139  * 
140  * 16    9/22/97 5:12p Dave
141  * Added stats transfer game _mode_. Started work on multiplayer chat
142  * screens for weapon and ship select
143  * 
144  * 15    8/04/97 5:28p Dave
145  * Moved Game bit GM_GAME_HOST to a netinfo flag NETINFO_FLAG_GAME_HOST
146  * 
147  * 14    8/04/97 4:37p Dave
148  * Added GM_STANDALONE_SERVER and GM_GAME_HOST game mode bits
149  * 
150  * 13    8/04/97 10:21a Dave
151  * Added Is_standalone global var
152  * 
153  * 12    7/29/97 10:59a Dave
154  * Added demo recording and demo playback bit flags
155  * 
156  * 11    6/24/97 6:21p John
157  * added detail flags.
158  * sped up motion debris system a bit.
159  * 
160  * 10    6/09/97 10:38a Allender
161  * added GAME_MODE_IN_GAME flag.  Probably to be used only for multiplayer
162  * 
163  * 9     5/07/97 1:44p Mike
164  * Add viewing from other ships.
165  * 
166  * 8     4/16/97 3:24p Mike
167  * New Camera system.
168  * 
169  * 7     4/15/97 11:28p Mike
170  * External view system
171  * 
172  * 6     4/15/97 4:00p Mike
173  * Intermediate checkin caused by getting other files.  Working on camera
174  * slewing system.
175  * 
176  * 5     4/11/97 5:02p Mike
177  * Improve death sequence, clean up sequencing.
178  * 
179  * 4     4/08/97 8:47a John
180  * Added a global varible for detail level
181  * 
182  * 3     4/02/97 6:03p Mike
183  * Make dying work through event driven code.
184  * 
185  * 2     4/01/97 11:07p Mike
186  * Clean up game sequencing functions.  Get rid of Multiplayer and add
187  * Game_mode.  Add SystemVars.cpp
188  * 
189  * 1     4/01/97 10:59p Mike
190  *
191  * $NoKeywords: $
192  */
193
194 #ifndef _SYSTEMVARS_H
195 #define _SYSTEMVARS_H
196
197 #include "math.h"
198 #include "pstypes.h"
199
200 #define GM_MULTIPLAYER                                  (1 << 0)
201 #define GM_NORMAL                                               (1 << 1)
202 #define GM_DEAD_DIED                                    (1 << 2)                                //      Died, waiting to blow up.
203 #define GM_DEAD_BLEW_UP                         (1 << 3)                                //      Blew up.
204 #define GM_DEAD_ABORTED                         (1 << 4)                                //      Player pressed a key, aborting death sequence.
205 #define GM_IN_MISSION                                   (1 << 5)                                // Player is actually in the mission -- not at a pre-mission menu
206
207 #define GM_DEAD                                                 (GM_DEAD_DIED | GM_DEAD_BLEW_UP | GM_DEAD_ABORTED)
208
209 #define  GM_STANDALONE_SERVER                   (1 << 8)
210 #define GM_STATS_TRANSFER                               (1 << 9)                                // in the process of stats transfer
211 #define GM_CAMPAIGN_MODE                                (1 << 10)                       // are we currently in a campaign.
212
213 #define GM_DEMO_RECORD                                  (1 << 11)                       // recording a demo
214 #define GM_DEMO_PLAYBACK                                (1 << 12)                       // playing a demo back
215 #define GM_DEMO                                                 (GM_DEMO_RECORD | GM_DEMO_PLAYBACK)                     // true whenever a demo is being recorded or played back
216
217 #define VM_EXTERNAL                                             (1 << 0)                                //      Set if not viewing from player position.
218 #define VM_SLEWED                                               (1 << 1)                                //      Set if viewer orientation is slewed.
219 #define VM_DEAD_VIEW                                    (1 << 2)                                //      Set if viewer is watching from dead view.
220 #define VM_CHASE                                                        (1 << 3)                                //      Chase view.
221 #define VM_OTHER_SHIP                                   (1 << 4)                                //      View from another ship.
222 #define VM_EXTERNAL_CAMERA_LOCKED       (1 << 5)                                // External camera is locked in place (ie controls move ship not camera)
223 #define VM_WARP_CHASE                                   (1      << 6)                           // View while warping out (form normal view mode)
224 #define VM_PADLOCK_UP                                   (1 << 7)
225 #define VM_PADLOCK_REAR                         (1 << 8)
226 #define VM_PADLOCK_LEFT                         (1 << 9)
227 #define VM_PADLOCK_RIGHT                                (1 << 10)
228 #define VM_WARPIN_ANCHOR                                (1 << 11)                       // special warpin camera mode
229
230 #define VM_PADLOCK_ANY (VM_PADLOCK_UP|VM_PADLOCK_REAR|VM_PADLOCK_LEFT|VM_PADLOCK_RIGHT)
231
232
233 typedef struct vei {
234         angles_t        angles;                 //      Angles defining viewer location.
235         float           distance;               //      Distance from which to view, plus 2x radius.
236 } vei;
237
238 typedef struct vci {    
239         angles_t        angles;                 
240         float           distance;               // Distance from which to view, plus 3x radius
241 } vci;
242
243 extern fix Missiontime;
244 extern fix Frametime;
245 extern int Framecount;
246
247 extern int Game_mode;
248
249 extern int Viewer_mode;
250 extern int Rand_count;
251
252 extern int Game_restoring;              // If set, this means we are restoring data from disk
253
254 // The detail level.  Anything below zero draws simple models earlier than it
255 // should.   Anything above zero draws higher detail models longer than it should.
256 // -2=lowest
257 // -1=low
258 // 0=normal (medium)    
259 // 1=high
260 // 2=extra high
261 extern int Game_detail_level;
262
263 #define DETAIL_DEFAULT (0xFFFFFFFF)
264
265 #define DETAIL_FLAG_STARS                       (1<<0)  // draw the stars
266 #define DETAIL_FLAG_NEBULAS             (1<<1)  // draw the motion debris
267 #define DETAIL_FLAG_MOTION                      (1<<2)  // draw the motion debris
268 #define DETAIL_FLAG_PLANETS             (1<<3)  // draw planets
269 #define DETAIL_FLAG_MODELS                      (1<<4)  // draw models not as blobs
270 #define DETAIL_FLAG_LASERS                      (1<<5)  // draw lasers not as pixels
271 #define DETAIL_FLAG_CLEAR                       (1<<6)  // clear screen background after each frame
272 #define DETAIL_FLAG_HUD                         (1<<7)  // draw hud stuff
273 #define DETAIL_FLAG_FIREBALLS           (1<<8)  // draw fireballs
274 #define DETAIL_FLAG_COLLISION           (1<<9)  // use good collision detection
275 #ifdef MAKE_FS1
276 #define DETAIL_FLAG_ENGINE_GLOWS        (1<<10) // engine glows
277 #endif
278
279
280 extern uint Game_detail_flags;
281
282 extern angles_t Viewer_slew_angles;
283 extern vei              Viewer_external_info;
284 extern vci              Viewer_chase_info;
285
286 extern int Is_standalone;
287 extern int Interface_framerate;                         // show interface framerate during flips
288 extern int Interface_last_tick;                         // last timer tick on flip
289
290 // for notifying players of unknown ship types
291 extern int Fred_found_unknown_ship_during_parsing;
292
293 #define NOISE_NUM_FRAMES 15
294
295 // Noise numbers go from 0 to 1.0
296 extern float Noise[NOISE_NUM_FRAMES];
297
298 // game skill levels 
299 #define NUM_SKILL_LEVELS        5
300
301 //====================================================================================
302 // DETAIL LEVEL STUFF
303 // If you change any of this, be sure to increment the player file version 
304 // in Freespace\ManagePilot.cpp and change Detail_defaults in SystemVars.cpp 
305 // or bad things will happen, I promise.
306 //====================================================================================
307
308 #define MAX_DETAIL_LEVEL 4                      // The highest valid value for the "analog" detail level settings
309
310 // If you change this, update player file in ManagePilot.cpp 
311 typedef struct detail_levels {
312
313         int             setting;                                                // Which default setting this was created from.   0=lowest... NUM_DEFAULT_DETAIL_LEVELS-1, -1=Custom
314
315         // "Analogs"
316         int             nebula_detail;                          // 0=lowest detail, MAX_DETAIL_LEVEL=highest detail
317         int             detail_distance;                        // 0=lowest MAX_DETAIL_LEVEL=highest    
318 #ifdef MAKE_FS1
319         int             weapon_detail;                          // 0=min, MAX_DETAIL_LEVEL=max
320 #endif
321         int             hardware_textures;              // 0=max culling, MAX_DETAIL_LEVEL=no culling
322         int             num_small_debris;                       // 0=min number, MAX_DETAIL_LEVEL=max number
323         int             num_particles;                          // 0=min number, MAX_DETAIL_LEVEL=max number
324         int             num_stars;                                      // 0=min number, MAX_DETAIL_LEVEL=max number
325         int             shield_effects;                 // 0=min, MAX_DETAIL_LEVEL=max
326         int             lighting;                                       // 0=min, MAX_DETAIL_LEVEL=max  
327 #ifdef MAKE_FS1
328         int             unknown_slider;                         // unknown, not in interface
329 #endif
330
331         // Booleans
332         int             targetview_model;                       // 0=off, 1=on  
333         int             planets_suns;                           // 0=off, 1=on
334 #ifdef MAKE_FS1
335         int             unknown_boolean1;                       // unknown, not in interface
336         int             unknown_boolean2;                       // unknown, not in interface
337         int             engine_glows;                           // 0=off, 1=on
338         int             alpha_effects;                          // 0=off, 1=on
339 #else
340         int             weapon_extras;                          // extra weapon details. trails, glows
341 #endif
342 } detail_levels;
343
344 // Global values used to access detail levels in game and libs
345 extern detail_levels Detail;
346
347 #define NUM_DEFAULT_DETAIL_LEVELS       4       // How many "predefined" detail levels there are
348
349 // Call this with:
350 // 0 - lowest
351 // NUM_DEFAULT_DETAIL_LEVELS - highest
352 // To set the parameters in Detail to some set of defaults
353 void detail_level_set(int level);
354
355 // Returns the current detail level or -1 if custom.
356 int current_detail_level();
357
358 //====================================================================================
359 // Memory stuff from WinDebug.cpp
360 extern int TotalRam;
361 void windebug_memwatch_init();
362
363 #endif
364