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