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