1 // Emacs style mode select   -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // $Id: doomstat.h 1496 2020-01-05 22:11:50Z wesleyjohnson $
5 //
6 // Copyright (C) 1993-1996 by id Software, Inc.
7 // Portions Copyright (C) 1998-2010 by DooM Legacy Team.
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License
11 // as published by the Free Software Foundation; either version 2
12 // of the License, or (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 // GNU General Public License for more details.
18 //
19 //
20 // $Log: doomstat.h,v $
21 // Revision 1.14  2003/07/23 17:20:37  darkwolf95
22 // Initial Chex Quest 1 Support
23 //
24 // Revision 1.13  2002/12/13 22:34:27  ssntails
25 // MP3/OGG support!
26 //
27 // Revision 1.12  2001/07/16 22:35:40  bpereira
28 // - fixed crash of e3m8 in heretic
29 // - fixed crosshair not drawed bug
30 //
31 // Revision 1.11  2001/04/17 22:26:07  calumr
32 // Initial Mac add
33 //
34 // Revision 1.10  2001/04/01 17:35:06  bpereira
35 // Revision 1.9  2001/02/24 13:35:19  bpereira
36 //
37 // Revision 1.8  2001/01/25 22:15:41  bpereira
38 // added heretic support
39 //
40 // Revision 1.7  2000/11/02 17:50:06  stroggonmeth
41 // Big 3Dfloors & FraggleScript commit!!
42 //
43 // Revision 1.6  2000/10/21 08:43:28  bpereira
44 // Revision 1.5  2000/08/31 14:30:55  bpereira
45 // Revision 1.4  2000/08/10 19:58:04  bpereira
46 //
47 // Revision 1.3  2000/08/10 14:53:10  ydario
48 // OS/2 port
49 //
50 // Revision 1.2  2000/02/27 00:42:10  hurdler
51 // Revision 1.1.1.1  2000/02/22 20:32:32  hurdler
52 // Initial import into CVS (v1.29 pr3)
53 //
54 //
55 // DESCRIPTION:
56 //   All the global variables that store the internal state.
57 //   Theoretically speaking, the internal state of the engine
58 //    should be found by looking at the variables collected
59 //    here, and every relevant module will have to include this header file.
60 //   In practice, things are a bit messy.
61 //
62 //-----------------------------------------------------------------------------
63 
64 #ifndef D_STATE_H
65 #define D_STATE_H
66 
67 #include "doomdef.h"
68   // CLIENTPREDICTION, LOGMESSAGES, DEBUGFILE
69 
70 // We need globally shared data structures,
71 //  for defining the global state variables.
72 #include "doomdata.h"
73 
74 // We need the player data structure as well.
75 #include "d_player.h"
76 #include "d_clisrv.h"
77 
78 
79 // Game mode handling - identify IWAD version,
80 //  handle IWAD dependend animations etc.
81 // [WDJ] modifed names to be self readable
82 typedef enum
83 {
84     doom_shareware,    // DOOM 1 shareware, E1, M9
85     doom_registered,   // DOOM 1 registered, E3, M27
86     doom2_commercial,  // DOOM 2 retail, E1 M34
87     // FreeDoom is DOOM 2, can play as commercial or indetermined
88     // DOOM 2 german edition not handled
89     ultdoom_retail,    // DOOM 1 retail, E4, M36
90     heretic,
91     hexen,
92     strife,
93     indetermined, // Well, no IWAD found.
94     chexquest1	  // DarkWolf95:July 14, 2003: Chex Quest Support
95 
96 } gamemode_e;
97 
98 // Set from gamemode.
99 extern byte  EN_heretic_hexen;  // common features
100 extern byte  EN_heretic;
101 extern byte  EN_hexen;
102 extern byte  EN_strife;
103 extern byte  EN_doom_etc;  // doom, boom, mbf, common behavior  (not heretic, hexen, strife)
104 // Set by gamemode, but may be enabled by demos too.
105 extern byte  EN_boom;  // Boom features (boom demo compatibility=0)
106 extern byte  EN_mbf;   // MBF (Marines Best Friend) enable (similar prboom mbf_features)
107 extern byte  EV_legacy; // DoomLegacy version, 0 when some other demo.
108 
109 
110 #if 0
111 // [WDJ] 8/26/2011 Replaced by gamedesc_id, GDESC_
112 // Mission packs - might be useful for TC stuff?
113 typedef enum
114 {
115     doom,         // DOOM 1
116     doom2,        // DOOM 2
117     pack_tnt,     // TNT mission pack
118     pack_plut,    // Plutonia pack
119     mission_none
120 
121 } gamemission_t;
122 
123 extern gamemission_t   gamemission;
124 #endif
125 
126 
127 
128 // [WDJ] Structure some of the scattered game differences.
129 
130 enum gameflags_e {
131    GD_idwad       = 0x01, // one of the commercial/shareware wads by id or Raven
132    GD_iwad_pref   = 0x02, // load the iwad after legacy.wad to give it preference
133    GD_unsupported = 0x08, // unsupported game type
134 };
135 
136 // Id of specific iwad, no longer tied to table index
137 typedef enum {
138     GDESC_freedoom,
139     GDESC_freedm,
140     GDESC_doom2,
141     GDESC_freedoom_ultimate,
142     GDESC_ultimate,
143     GDESC_doom,
144     GDESC_doom_shareware,
145     GDESC_plutonia,
146     GDESC_tnt,
147     GDESC_blasphemer,
148     GDESC_heretic,
149     GDESC_heretic_shareware,
150     GDESC_hexen,
151     GDESC_hexen_demo,
152     GDESC_strife,
153     GDESC_strife_shareware,
154     GDESC_chex1,
155     GDESC_ultimate_mode,
156     GDESC_doom_mode,
157     GDESC_heretic_mode,
158     GDESC_hexen_mode,
159     GDESC_other, // other iwad entry, and table search limit
160 } game_desc_e;
161 
162 
163 typedef struct
164 {
165     const char * gname;	       // game name, used in savegame
166     const char * startup_title; // startup page
167     const char * idstr;	       // used for directory and command line
168     const char * iwad_filename[3]; // possible filenames
169                                // doom, doom2, heretic, heretic1, hexen, etc.
170     const char * support_wad;   // another wad to support the game
171     const char * keylump[2];   // required lump names
172     byte	require_lump;  // lumps that must appear (bit set)
173     byte	reject_lump;   // lumps that must not appear (bit set)
174     uint16_t	gameflags;     // assorted flags from gameflags_e
175     game_desc_e gamedesc_id;   // independent of table index, safer
176     gamemode_e	gamemode;
177 } game_desc_t;
178 
179 #ifdef LAUNCHER
180 // game desc for Launcher
181 game_desc_t *  D_GameDesc( int i );
182 #endif
183 
184 
185 // ===================================================
186 // Game Mode - identify IWAD as shareware, retail etc.
187 // ===================================================
188 //
189 extern game_desc_e     gamedesc_id; // unique game id
190 extern game_desc_t     gamedesc;    // active desc used by most of legacy
191 extern gamemode_e      gamemode;
192 extern boolean         have_inventory;   // true with heretic and hexen
193 extern boolean         raven_heretic_hexen;  // true with heretic and hexen
194 
195 // Set if homebrew PWAD stuff has been added.
196 extern  boolean	       modifiedgame;
197 
198 
199 // =========
200 // Language.
201 // =========
202 //
203 
204 // Identify language to use, software localization.
205 typedef enum
206 {
207     english,
208     french,
209     german,
210     lang_unknown
211 
212 } language_t;
213 
214 extern  language_t   language;
215 
216 
217 
218 // =============================
219 // Selected skill type, map etc.
220 // =============================
221 
222 // skill levels
223 typedef enum
224 {
225     sk_baby,
226     sk_easy,
227     sk_medium,
228     sk_hard,
229     sk_nightmare
230 } skill_e;
231 
232 // Selected by user.
233 extern  skill_e         gameskill;	// easy, medium, hard
234 extern  byte            gameepisode;	// Doom episode, 1..4
235 extern  byte            gamemap;	// level 1..32
236 
237 // Nightmare mode flag, single player.
238 // extern  boolean         respawnmonsters;
239 
240 // Netgame? only true in a netgame
241 extern  boolean         netgame;
242 // Only true if >1 player. netgame => multiplayer but not (multiplayer=>netgame)
243 extern  boolean         multiplayer;
244 
245 // Now an enum to handle altdeath/cooperative better.
246 extern  consvar_t       cv_deathmatch;  // deathmatch and coop
247 extern  byte            deathmatch;  // deathmatch only
248 extern  byte            weapon_persist; // deathmatch weapon pickup multiple times
249 
250 
251 
252 // ========================================
253 // Internal parameters for sound rendering.
254 // ========================================
255 
256 extern boolean         nomusic; // defined in d_main.c
257 extern boolean         nosoundfx; // had clash with WATCOM i86.h nosound() function
258 
259 // =========================
260 // Status flags for refresh.
261 // =========================
262 //
263 
264 extern  byte    paused;         // Game Pause, multiple bits
265 
266 // Depending on view size - no status bar?
267 // Note that there is no way to disable the
268 //  status bar explicitely.
269 extern  boolean statusbaractive;
270 extern  boolean menuactive;     // Menu overlayed?
271 
272 extern  boolean nodrawers;
273 extern  boolean noblit;
274 
275 extern  int     viewwindowx;
276 extern  int     viewwindowy;
277 extern  int     rdraw_viewheight;		// was viewheight
278 extern  int     rdraw_viewwidth;		// was viewwidth
279 extern  int     rdraw_scaledviewwidth;		// was scaledrviewwidth
280 
281 
282 
283 // This one is related to the 3-screen display mode.
284 // ANG90 = left side, ANG270 = right
285 extern  int     viewangleoffset;
286 
287 // Player taking events, and displaying.
288 extern  int     consoleplayer;
289 extern  int     displayplayer;
290 extern  int     displayplayer2; // for splitscreen
291 
292 // [WDJ] Simplify every test against a player ptr, and splitscreen
293 extern  player_t * consoleplayer_ptr;
294 extern  player_t * displayplayer_ptr;
295 extern  player_t * displayplayer2_ptr;  // NULL when not in use
296 
297 //added:16-01-98: player from which the statusbar displays the infos.
298 extern  int     statusbarplayer;
299 
300 
301 // ============================================
302 // Statistics on a given map, for intermission.
303 // ============================================
304 //
305 extern  int     totalkills;
306 extern  int     totalitems;
307 extern  int     totalsecret;
308 
309 
310 // ===========================
311 // Internal parameters, fixed.
312 // ===========================
313 // These are set by the engine, and not changed
314 //  according to user inputs. Partly load from
315 //  WAD, partly set at startup time.
316 
317 extern  tic_t           gametic;
318 extern  tic_t           game_comp_tic;
319 extern  tic_t           leveltime;
320 
321 #ifdef CLIENTPREDICTION2
322 extern  tic_t           localgametic;
323 extern  boolean         spirit_update;
324 #else
325 #define localgametic  leveltime
326 #endif
327 
328 // Player spawn spots.
329 extern  mapthing_t      *playerstarts[MAXPLAYERS];
330 
331 // Intermission stats.
332 // Parameters for world map / intermission.
333 extern  wb_start_t      wminfo;
334 
335 
336 // LUT of ammunition limits for each kind.
337 // This doubles with BackPack powerup item.
338 extern  int             maxammo[NUMAMMO];
339 
340 
341 // =====================================
342 // Internal parameters, used for engine.
343 // =====================================
344 //
345 
346 // The current state of the game
347 typedef enum
348 {
349     GS_NULL = 0,                // at begin
350     GS_LEVEL,                   // we are playing
351     GS_INTERMISSION,            // gazing at the intermission screen
352     GS_FINALE,                  // game final animation
353     GS_DEMOSCREEN,              // looking at a demo
354     //legacy
355     GS_DEDICATEDSERVER,         // added 27-4-98 : new state for dedicated server
356     GS_WAITINGPLAYERS,          // added 3-9-98 : waiting player in net game
357     // Non-state, out-of-band flags
358     GS_FORCEWIPE                // wipegamestate only
359 } gamestate_e;
360 
361 extern  gamestate_e     gamestate;
362 
363 // gamestate_e is unsigned
364 
365 // wipegamestate can be set to GS_FORCEWIPE
366 //  to force a wipe on the next draw
367 extern  gamestate_e     wipegamestate;
368 
369 // if true, load all graphics at level load
370 extern  boolean         precache;
371 
372 //?
373 // debug flag to cancel adaptiveness
374 extern  boolean         singletics;
375 
376 
377 
378 #define   BODYQUESIZE     32
379 
380 extern mobj_t*   bodyque[BODYQUESIZE];
381 extern  int             bodyqueslot;
382 
383 
384 // =============
385 // Netgame stuff
386 // =============
387 
388 
389 //extern  ticcmd_t        localcmds[BACKUPTICS];
390 
391 extern  ticcmd_t        netcmds[BACKUPTICS][MAXPLAYERS];
392 // Collect stats for netstat.
393 extern int   stat_tic_moved, stat_tic_miss;
394 
395 #endif //__D_STATE__
396