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-2000 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  *  Internally used data structures for virtually everything,
31  *   key definitions, lots of other stuff.
32  *
33  *-----------------------------------------------------------------------------*/
34 
35 #ifndef __DOOMDEF__
36 #define __DOOMDEF__
37 
38 /* use config.h if autoconf made one -- josh */
39 #ifdef HAVE_CONFIG_H
40 #include "config.h"
41 #endif
42 
43 // killough 4/25/98: Make gcc extensions mean nothing on other compilers
44 #ifndef __GNUC__
45 #define __attribute__(x)
46 #endif
47 
48 // This must come first, since it redefines malloc(), free(), etc. -- killough:
49 #include "z_zone.h"
50 
51 #include <stdio.h>
52 #include <stdlib.h>
53 #include <string.h>
54 #include <ctype.h>
55 #include <limits.h>
56 
57 // this should go here, not in makefile/configure.ac -- josh
58 #ifndef O_BINARY
59 #define O_BINARY 0
60 #endif
61 
62 #include "m_swap.h"
63 #include "version.h"
64 
65 // Game mode handling - identify IWAD version
66 //  to handle IWAD dependend animations etc.
67 typedef enum {
68   shareware,    // DOOM 1 shareware, E1, M9
69   registered,   // DOOM 1 registered, E3, M27
70   commercial,   // DOOM 2 retail, E1 M34  (DOOM 2 german edition not handled)
71   retail,       // DOOM 1 retail, E4, M36
72   indetermined  // Well, no IWAD found.
73 } GameMode_t;
74 
75 // Mission packs - might be useful for TC stuff?
76 typedef enum {
77   doom,         // DOOM 1
78   doom2,        // DOOM 2
79   pack_tnt,     // TNT mission pack
80   pack_plut,    // Plutonia pack
81   none
82 } GameMission_t;
83 
84 // Identify language to use, software localization.
85 typedef enum {
86   english,
87   french,
88   german,
89   unknown
90 } Language_t;
91 
92 //
93 // For resize of screen, at start of game.
94 //
95 
96 #define BASE_WIDTH 320
97 
98 // It is educational but futile to change this
99 //  scaling e.g. to 2. Drawing of status bar,
100 //  menues etc. is tied to the scale implied
101 //  by the graphics.
102 
103 #define INV_ASPECT_RATIO   0.625 /* 0.75, ideally */
104 
105 // killough 2/8/98: MAX versions for maximum screen sizes
106 // allows us to avoid the overhead of dynamic allocation
107 // when multiple screen sizes are supported
108 
109 // proff 08/17/98: Changed for high-res
110 #define MAX_SCREENWIDTH  2048
111 #define MAX_SCREENHEIGHT 1536
112 
113 // SCREENWIDTH and SCREENHEIGHT define the visible size
114 extern int SCREENWIDTH;
115 extern int SCREENHEIGHT;
116 // SCREENPITCH is the size of one line in the buffer and
117 // can be bigger than the SCREENWIDTH depending on the size
118 // of one pixel (8, 16 or 32 bit) and the padding at the
119 // end of the line caused by hardware considerations
120 extern int SCREENPITCH;
121 
122 // The maximum number of players, multiplayer/networking.
123 #define MAXPLAYERS       4
124 
125 // phares 5/14/98:
126 // DOOM Editor Numbers (aka doomednum in mobj_t)
127 
128 #define DEN_PLAYER5 4001
129 #define DEN_PLAYER6 4002
130 #define DEN_PLAYER7 4003
131 #define DEN_PLAYER8 4004
132 
133 // State updates, number of tics / second.
134 #define TICRATE          35
135 
136 // The current state of the game: whether we are playing, gazing
137 // at the intermission screen, the game final animation, or a demo.
138 
139 typedef enum {
140   GS_LEVEL,
141   GS_INTERMISSION,
142   GS_FINALE,
143   GS_DEMOSCREEN
144 } gamestate_t;
145 
146 //
147 // Difficulty/skill settings/filters.
148 //
149 // These are Thing flags
150 
151 // Skill flags.
152 #define MTF_EASY                1
153 #define MTF_NORMAL              2
154 #define MTF_HARD                4
155 // Deaf monsters/do not react to sound.
156 #define MTF_AMBUSH              8
157 
158 /* killough 11/98 */
159 #define MTF_NOTSINGLE          16
160 #define MTF_NOTDM              32
161 #define MTF_NOTCOOP            64
162 #define MTF_FRIEND            128
163 #define MTF_RESERVED          256
164 
165 typedef enum {
166   sk_none=-1, //jff 3/24/98 create unpicked skill setting
167   sk_baby=0,
168   sk_easy,
169   sk_medium,
170   sk_hard,
171   sk_nightmare
172 } skill_t;
173 
174 //
175 // Key cards.
176 //
177 
178 typedef enum {
179   it_bluecard,
180   it_yellowcard,
181   it_redcard,
182   it_blueskull,
183   it_yellowskull,
184   it_redskull,
185   NUMCARDS
186 } card_t;
187 
188 // The defined weapons, including a marker
189 // indicating user has not changed weapon.
190 typedef enum {
191   wp_fist,
192   wp_pistol,
193   wp_shotgun,
194   wp_chaingun,
195   wp_missile,
196   wp_plasma,
197   wp_bfg,
198   wp_chainsaw,
199   wp_supershotgun,
200 
201   NUMWEAPONS,
202   wp_nochange              // No pending weapon change.
203 } weapontype_t;
204 
205 // Ammunition types defined.
206 typedef enum {
207   am_clip,    // Pistol / chaingun ammo.
208   am_shell,   // Shotgun / double barreled shotgun.
209   am_cell,    // Plasma rifle, BFG.
210   am_misl,    // Missile launcher.
211   NUMAMMO,
212   am_noammo   // Unlimited for chainsaw / fist.
213 } ammotype_t;
214 
215 // Power up artifacts.
216 typedef enum {
217   pw_invulnerability,
218   pw_strength,
219   pw_invisibility,
220   pw_ironfeet,
221   pw_allmap,
222   pw_infrared,
223   NUMPOWERS
224 } powertype_t;
225 
226 // Power up durations (how many seconds till expiration).
227 typedef enum {
228   INVULNTICS  = (30*TICRATE),
229   INVISTICS   = (60*TICRATE),
230   INFRATICS   = (120*TICRATE),
231   IRONTICS    = (60*TICRATE)
232 } powerduration_t;
233 
234 // DOOM keyboard definition.
235 // This is the stuff configured by Setup.Exe.
236 // Most key data are simple ascii (uppercased).
237 
238 #define KEYD_RIGHTARROW 0xae
239 #define KEYD_LEFTARROW  0xac
240 #define KEYD_UPARROW    0xad
241 #define KEYD_DOWNARROW  0xaf
242 #define KEYD_ESCAPE     27
243 #define KEYD_ENTER      13
244 #define KEYD_TAB        9
245 #define KEYD_F1         (0x80+0x3b)
246 #define KEYD_F2         (0x80+0x3c)
247 #define KEYD_F3         (0x80+0x3d)
248 #define KEYD_F4         (0x80+0x3e)
249 #define KEYD_F5         (0x80+0x3f)
250 #define KEYD_F6         (0x80+0x40)
251 #define KEYD_F7         (0x80+0x41)
252 #define KEYD_F8         (0x80+0x42)
253 #define KEYD_F9         (0x80+0x43)
254 #define KEYD_F10        (0x80+0x44)
255 #define KEYD_F11        (0x80+0x57)
256 #define KEYD_F12        (0x80+0x58)
257 #define KEYD_BACKSPACE  127
258 #define KEYD_PAUSE      0xff
259 #define KEYD_EQUALS     0x3d
260 #define KEYD_MINUS      0x2d
261 #define KEYD_RSHIFT     (0x80+0x36)
262 #define KEYD_RCTRL      (0x80+0x1d)
263 #define KEYD_RALT       (0x80+0x38)
264 #define KEYD_LALT       KEYD_RALT
265 #define KEYD_CAPSLOCK   0xba                                        // phares
266 
267 // phares 3/2/98:
268 #define KEYD_INSERT     0xd2
269 #define KEYD_HOME       0xc7
270 #define KEYD_PAGEUP     0xc9
271 #define KEYD_PAGEDOWN   0xd1
272 #define KEYD_DEL        0xc8
273 #define KEYD_END        0xcf
274 #define KEYD_SCROLLLOCK 0xc6
275 #define KEYD_SPACEBAR   0x20
276 // phares 3/2/98
277 
278 #define KEYD_NUMLOCK    0xC5                 // killough 3/6/98
279 
280 // cph - Add the numeric keypad keys, as suggested by krose 4/22/99:
281 // The way numbers are assigned to keys is a mess, but it's too late to
282 // change that easily. At least these additions are don neatly.
283 // Codes 0x100-0x200 are reserved for number pad
284 
285 #define KEYD_KEYPAD0      (0x100 + '0')
286 #define KEYD_KEYPAD1      (0x100 + '1')
287 #define KEYD_KEYPAD2      (0x100 + '2')
288 #define KEYD_KEYPAD3      (0x100 + '3')
289 #define KEYD_KEYPAD4      (0x100 + '4')
290 #define KEYD_KEYPAD5      (0x100 + '5')
291 #define KEYD_KEYPAD6      (0x100 + '6')
292 #define KEYD_KEYPAD7      (0x100 + '7')
293 #define KEYD_KEYPAD8      (0x100 + '8')
294 #define KEYD_KEYPAD9      (0x100 + '9')
295 #define KEYD_KEYPADENTER  (0x100 + KEYD_ENTER)
296 #define KEYD_KEYPADDIVIDE (0x100 + '/')
297 #define KEYD_KEYPADMULTIPLY (0x100 + '*')
298 #define KEYD_KEYPADMINUS  (0x100 + '-')
299 #define KEYD_KEYPADPLUS   (0x100 + '+')
300 #define KEYD_KEYPADPERIOD (0x100 + '.')
301 
302 // phares 4/19/98:
303 // Defines Setup Screen groups that config variables appear in.
304 // Used when resetting the defaults for every item in a Setup group.
305 
306 typedef enum {
307   ss_none,
308   ss_keys,
309   ss_weap,
310   ss_stat,
311   ss_auto,
312   ss_enem,
313   ss_mess,
314   ss_chat,
315   ss_gen,       /* killough 10/98 */
316   ss_comp,      /* killough 10/98 */
317   ss_max
318 } ss_types;
319 
320 // phares 3/20/98:
321 //
322 // Player friction is variable, based on controlling
323 // linedefs. More friction can create mud, sludge,
324 // magnetized floors, etc. Less friction can create ice.
325 
326 #define MORE_FRICTION_MOMENTUM 15000       // mud factor based on momentum
327 #define ORIG_FRICTION          0xE800      // original value
328 #define ORIG_FRICTION_FACTOR   2048        // original value
329 
330 #endif          // __DOOMDEF__
331