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