1 /* Emacs style mode select   -*- C++ -*-
2  *-----------------------------------------------------------------------------
3  *
4  *
5  *  PrBoom: a Doom port merged with LxDoom and LSDLDoom
6  *  based on BOOM, a modified and improved DOOM engine
7  *  Copyright (C) 1999 by
8  *  id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
9  *  Copyright (C) 1999-2006 by
10  *  Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
11  *  Copyright 2005, 2006 by
12  *  Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
13  *
14  *  This program is free software; you can redistribute it and/or
15  *  modify it under the terms of the GNU General Public License
16  *  as published by the Free Software Foundation; either version 2
17  *  of the License, or (at your option) any later version.
18  *
19  *  This program is distributed in the hope that it will be useful,
20  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  *  GNU General Public License for more details.
23  *
24  *  You should have received a copy of the GNU General Public License
25  *  along with this program; if not, write to the Free Software
26  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27  *  02111-1307, USA.
28  *
29  * DESCRIPTION:
30  *   All the global variables that store the internal state.
31  *   Theoretically speaking, the internal state of the engine
32  *    should be found by looking at the variables collected
33  *    here, and every relevant module will have to include
34  *    this header file.
35  *   In practice, things are a bit messy.
36  *
37  *-----------------------------------------------------------------------------*/
38 
39 #ifndef __D_STATE__
40 #define __D_STATE__
41 
42 // We need the playr data structure as well.
43 #include "d_player.h"
44 
45 #ifdef __GNUG__
46 #pragma interface
47 #endif
48 
49 // ------------------------
50 // Command line parameters.
51 //
52 
53 extern  boolean nomonsters; // checkparm of -nomonsters
54 extern  boolean respawnparm;  // checkparm of -respawn
55 extern  boolean fastparm; // checkparm of -fast
56 extern  boolean devparm;  // DEBUG: launched with -devparm
57 
58 // -----------------------------------------------------
59 // Game Mode - identify IWAD as shareware, retail etc.
60 //
61 
62 extern GameMode_t gamemode;
63 extern GameMission_t  gamemission;
64 
65 // Set if homebrew PWAD stuff has been added.
66 extern  boolean modifiedgame;
67 
68 // CPhipps - new compatibility handling
69 extern complevel_t compatibility_level, default_compatibility_level;
70 
71 // CPhipps - old compatibility testing flags aliased to new handling
72 #define compatibility (compatibility_level<=boom_compatibility_compatibility)
73 #define demo_compatibility (compatibility_level < boom_compatibility_compatibility)
74 #define mbf_features (compatibility_level>=mbf_compatibility)
75 
76 // v1.1-like pitched sounds
77 extern int pitched_sounds;        // killough
78 
79 extern int     default_translucency; // config file says           // phares
80 extern boolean general_translucency; // true if translucency is ok // phares
81 
82 extern int demo_insurance, default_demo_insurance;      // killough 4/5/98
83 
84 // -------------------------------------------
85 // killough 10/98: compatibility vector
86 
87 enum {
88   comp_telefrag,
89   comp_dropoff,
90   comp_vile,
91   comp_pain,
92   comp_skull,
93   comp_blazing,
94   comp_doorlight,
95   comp_model,
96   comp_god,
97   comp_falloff,
98   comp_floors,
99   comp_skymap,
100   comp_pursuit,
101   comp_doorstuck,
102   comp_staylift,
103   comp_zombie,
104   comp_stairs,
105   comp_infcheat,
106   comp_zerotags,
107   comp_moveblock,
108   comp_respawn,  /* cph - this is the inverse of comp_respawnfix from eternity */
109   comp_sound,
110   comp_666,
111   comp_soul,
112   comp_maskedanim,
113   COMP_NUM,      /* cph - should be last in sequence */
114   COMP_TOTAL=32  // Some extra room for additional variables
115 };
116 
117 extern int comp[COMP_TOTAL], default_comp[COMP_TOTAL];
118 
119 // -------------------------------------------
120 // Language.
121 extern  Language_t   language;
122 
123 // -------------------------------------------
124 // Selected skill type, map etc.
125 //
126 
127 // Defaults for menu, methinks.
128 extern  skill_t   startskill;
129 extern  int             startepisode;
130 extern  int   startmap;
131 
132 extern  boolean   autostart;
133 
134 // Selected by user.
135 extern  skill_t         gameskill;
136 extern  int   gameepisode;
137 extern  int   gamemap;
138 
139 // Nightmare mode flag, single player.
140 extern  boolean         respawnmonsters;
141 
142 // Netgame? Only true if >1 player.
143 extern  boolean netgame;
144 
145 // Flag: true only if started as net deathmatch.
146 // An enum might handle altdeath/cooperative better.
147 extern  boolean deathmatch;
148 
149 // ------------------------------------------
150 // Internal parameters for sound rendering.
151 // These have been taken from the DOS version,
152 //  but are not (yet) supported with Linux
153 //  (e.g. no sound volume adjustment with menu.
154 
155 // These are not used, but should be (menu).
156 // From m_menu.c:
157 //  Sound FX volume has default, 0 - 15
158 //  Music volume has default, 0 - 15
159 // These are multiplied by 8.
160 extern int snd_SfxVolume;      // maximum volume for sound
161 extern int snd_MusicVolume;    // maximum volume for music
162 
163 // CPhipps - screen parameters
164 extern unsigned int desired_screenwidth, desired_screenheight;
165 
166 // -------------------------
167 // Status flags for refresh.
168 //
169 
170 enum automapmode_e {
171   am_active = 1,  // currently shown
172   am_overlay= 2,  // covers the screen, i.e. not overlay mode
173   am_rotate = 4,  // rotates to the player facing direction
174   am_follow = 8,  // keep the player centred
175   am_grid   =16,  // show grid
176 };
177 extern enum automapmode_e automapmode; // Mode that the automap is in
178 
179 extern  boolean menuactive;    // Menu overlayed?
180 extern  boolean paused;        // Game Pause?
181 extern  boolean nodrawers;
182 extern  boolean noblit;
183 
184 // This one is related to the 3-screen display mode.
185 // ANG90 = left side, ANG270 = right
186 extern  int viewangleoffset;
187 
188 // Player taking events, and displaying.
189 extern  int consoleplayer;
190 extern  int displayplayer;
191 
192 // -------------------------------------
193 // Scores, rating.
194 // Statistics on a given map, for intermission.
195 //
196 extern  int totalkills, totallive;
197 extern  int totalitems;
198 extern  int totalsecret;
199 
200 // Timer, for scores.
201 extern  int basetic;    /* killough 9/29/98: levelstarttic, adjusted */
202 extern  int leveltime;  // tics in game play for par
203 
204 // --------------------------------------
205 // DEMO playback/recording related stuff.
206 
207 extern  boolean usergame;
208 extern  boolean demoplayback;
209 extern  boolean demorecording;
210 extern  int demover;
211 
212 // Quit after playing a demo from cmdline.
213 extern  boolean   singledemo;
214 // Print timing information after quitting.  killough
215 extern  boolean   timingdemo;
216 // Run tick clock at fastest speed possible while playing demo.  killough
217 extern  boolean   fastdemo;
218 
219 extern  gamestate_t  gamestate;
220 
221 //-----------------------------
222 // Internal parameters, fixed.
223 // These are set by the engine, and not changed
224 //  according to user inputs. Partly load from
225 //  WAD, partly set at startup time.
226 
227 extern  int   gametic;
228 
229 
230 // Bookkeeping on players - state.
231 extern  player_t  players[MAXPLAYERS];
232 
233 // Alive? Disconnected?
234 extern  boolean   playeringame[MAXPLAYERS];
235 extern  boolean   realplayeringame[MAXPLAYERS];
236 
237 extern  mapthing_t *deathmatchstarts;     // killough
238 extern  size_t     num_deathmatchstarts; // killough
239 
240 extern  mapthing_t *deathmatch_p;
241 
242 // Player spawn spots.
243 extern  mapthing_t playerstarts[];
244 
245 // Intermission stats.
246 // Parameters for world map / intermission.
247 extern wbstartstruct_t wminfo;
248 
249 //-----------------------------------------
250 // Internal parameters, used for engine.
251 //
252 
253 // File handling stuff.
254 extern  FILE   *debugfile;
255 
256 // if true, load all graphics at level load
257 extern  boolean precache;
258 
259 // wipegamestate can be set to -1
260 //  to force a wipe on the next draw
261 extern  gamestate_t     wipegamestate;
262 
263 extern  int             mouseSensitivity_horiz; // killough
264 extern  int             mouseSensitivity_vert;
265 
266 // debug flag to cancel adaptiveness
267 extern  boolean         singletics;
268 
269 extern  int             bodyqueslot;
270 
271 // Needed to store the number of the dummy sky flat.
272 // Used for rendering, as well as tracking projectiles etc.
273 
274 extern int    skyflatnum;
275 
276 extern  int        maketic;
277 
278 // Networking and tick handling related.
279 #define BACKUPTICS              12
280 
281 extern  ticcmd_t   netcmds[][BACKUPTICS];
282 extern  int        ticdup;
283 
284 //-----------------------------------------------------------------------------
285 
286 extern int allow_pushers;         // MT_PUSH Things    // phares 3/10/98
287 extern int default_allow_pushers;
288 
289 extern int variable_friction;  // ice & mud            // phares 3/10/98
290 extern int default_variable_friction;
291 
292 extern int monsters_remember;                          // killough 3/1/98
293 extern int default_monsters_remember;
294 
295 extern int weapon_recoil;          // weapon recoil    // phares
296 extern int default_weapon_recoil;
297 
298 extern int player_bobbing;  // whether player bobs or not   // phares 2/25/98
299 extern int default_player_bobbing;  // killough 3/1/98: make local to each game
300 
301 #ifdef DOGS
302 extern int dogs, default_dogs;     // killough 7/19/98: Marine's best friend :)
303 extern int dog_jumping, default_dog_jumping;   // killough 10/98
304 #endif
305 
306 /* killough 8/8/98: distance friendly monsters tend to stay from player */
307 extern int distfriend, default_distfriend;
308 
309 /* killough 9/8/98: whether monsters are allowed to strafe or retreat */
310 extern int monster_backing, default_monster_backing;
311 
312 /* killough 9/9/98: whether monsters intelligently avoid hazards */
313 extern int monster_avoid_hazards, default_monster_avoid_hazards;
314 
315 /* killough 10/98: whether monsters are affected by friction */
316 extern int monster_friction, default_monster_friction;
317 
318 /* killough 9/9/98: whether monsters help friends */
319 extern int help_friends, default_help_friends;
320 
321 extern int flashing_hom; // killough 10/98
322 
323 extern int doom_weapon_toggles;   // killough 10/98
324 
325 /* killough 7/19/98: whether monsters should fight against each other */
326 extern int monster_infighting, default_monster_infighting;
327 
328 extern int monkeys, default_monkeys;
329 
330 extern int HelperThing;          // type of thing to use for helper
331 
332 #endif
333