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 // What hacked exe are we emulating?
85 typedef enum {
86   EXE_NONE,
87   EXE_CHEX      // Chex Quest executable (based on Final Doom)
88 } GameExe_t;
89 
90 // Identify language to use, software localization.
91 typedef enum {
92   english,
93   french,
94   german,
95   unknown
96 } Language_t;
97 
98 //
99 // For resize of screen, at start of game.
100 //
101 
102 #define BASE_WIDTH 320
103 
104 // It is educational but futile to change this
105 //  scaling e.g. to 2. Drawing of status bar,
106 //  menues etc. is tied to the scale implied
107 //  by the graphics.
108 
109 #define INV_ASPECT_RATIO   0.625 /* 0.75, ideally */
110 
111 // killough 2/8/98: MAX versions for maximum screen sizes
112 // allows us to avoid the overhead of dynamic allocation
113 // when multiple screen sizes are supported
114 
115 // SCREENWIDTH and SCREENHEIGHT define the visible size
116 extern int SCREENWIDTH;
117 extern int SCREENHEIGHT;
118 // SCREENPITCH is the size of one line in the buffer and
119 // can be bigger than the SCREENWIDTH depending on the size
120 // of one pixel (8, 16 or 32 bit) and the padding at the
121 // end of the line caused by hardware considerations
122 extern int SCREENPITCH;
123 
124 extern int REAL_SCREENWIDTH;
125 extern int REAL_SCREENHEIGHT;
126 extern int REAL_SCREENPITCH;
127 
128 // e6y: wide-res
129 extern int WIDE_SCREENWIDTH;
130 extern int WIDE_SCREENHEIGHT;
131 extern int SCREEN_320x200;
132 
133 // The maximum number of players, multiplayer/networking.
134 #define MAXPLAYERS       4
135 
136 // phares 5/14/98:
137 // DOOM Editor Numbers (aka doomednum in mobj_t)
138 
139 #define DEN_PLAYER5 4001
140 #define DEN_PLAYER6 4002
141 #define DEN_PLAYER7 4003
142 #define DEN_PLAYER8 4004
143 
144 // State updates, number of tics / second.
145 #define TICRATE          35
146 
147 // The current state of the game: whether we are playing, gazing
148 // at the intermission screen, the game final animation, or a demo.
149 
150 typedef enum {
151   GS_LEVEL,
152   GS_INTERMISSION,
153   GS_FINALE,
154   GS_DEMOSCREEN
155 } gamestate_t;
156 
157 //
158 // Difficulty/skill settings/filters.
159 //
160 // These are Thing flags
161 
162 // Skill flags.
163 #define MTF_EASY                1
164 #define MTF_NORMAL              2
165 #define MTF_HARD                4
166 // Deaf monsters/do not react to sound.
167 #define MTF_AMBUSH              8
168 
169 /* killough 11/98 */
170 #define MTF_NOTSINGLE          16
171 #define MTF_NOTDM              32
172 #define MTF_NOTCOOP            64
173 #define MTF_FRIEND            128
174 #define MTF_RESERVED          256
175 
176 typedef enum {
177   sk_none=-1, //jff 3/24/98 create unpicked skill setting
178   sk_baby=0,
179   sk_easy,
180   sk_medium,
181   sk_hard,
182   sk_nightmare
183 } skill_t;
184 
185 //
186 // Key cards.
187 //
188 
189 typedef enum {
190   it_bluecard,
191   it_yellowcard,
192   it_redcard,
193   it_blueskull,
194   it_yellowskull,
195   it_redskull,
196   NUMCARDS
197 } card_t;
198 
199 // The defined weapons, including a marker
200 // indicating user has not changed weapon.
201 typedef enum {
202   wp_fist,
203   wp_pistol,
204   wp_shotgun,
205   wp_chaingun,
206   wp_missile,
207   wp_plasma,
208   wp_bfg,
209   wp_chainsaw,
210   wp_supershotgun,
211 
212   NUMWEAPONS,
213   wp_nochange              // No pending weapon change.
214 } weapontype_t;
215 
216 // Ammunition types defined.
217 typedef enum {
218   am_clip,    // Pistol / chaingun ammo.
219   am_shell,   // Shotgun / double barreled shotgun.
220   am_cell,    // Plasma rifle, BFG.
221   am_misl,    // Missile launcher.
222   NUMAMMO,
223   am_noammo   // Unlimited for chainsaw / fist.
224 } ammotype_t;
225 
226 // Power up artifacts.
227 typedef enum {
228   pw_invulnerability,
229   pw_strength,
230   pw_invisibility,
231   pw_ironfeet,
232   pw_allmap,
233   pw_infrared,
234   NUMPOWERS
235 } powertype_t;
236 
237 // Power up durations (how many seconds till expiration).
238 typedef enum {
239   INVULNTICS  = (30*TICRATE),
240   INVISTICS   = (60*TICRATE),
241   INFRATICS   = (120*TICRATE),
242   IRONTICS    = (60*TICRATE)
243 } powerduration_t;
244 
245 // DOOM keyboard definition.
246 // This is the stuff configured by Setup.Exe.
247 // Most key data are simple ascii (uppercased).
248 
249 #define KEYD_RIGHTARROW 0xae
250 #define KEYD_LEFTARROW  0xac
251 #define KEYD_UPARROW    0xad
252 #define KEYD_DOWNARROW  0xaf
253 #define KEYD_ESCAPE     27
254 #define KEYD_ENTER      13
255 #define KEYD_TAB        9
256 #define KEYD_F1         (0x80+0x3b)
257 #define KEYD_F2         (0x80+0x3c)
258 #define KEYD_F3         (0x80+0x3d)
259 #define KEYD_F4         (0x80+0x3e)
260 #define KEYD_F5         (0x80+0x3f)
261 #define KEYD_F6         (0x80+0x40)
262 #define KEYD_F7         (0x80+0x41)
263 #define KEYD_F8         (0x80+0x42)
264 #define KEYD_F9         (0x80+0x43)
265 #define KEYD_F10        (0x80+0x44)
266 #define KEYD_F11        (0x80+0x57)
267 #define KEYD_F12        (0x80+0x58)
268 #define KEYD_BACKSPACE  127
269 #define KEYD_PAUSE      0xff
270 #define KEYD_EQUALS     0x3d
271 #define KEYD_MINUS      0x2d
272 #define KEYD_RSHIFT     (0x80+0x36)
273 #define KEYD_RCTRL      (0x80+0x1d)
274 #define KEYD_RALT       (0x80+0x38)
275 #define KEYD_LALT       KEYD_RALT
276 #define KEYD_CAPSLOCK   0xba                                        // phares
277 
278 // phares 3/2/98:
279 #define KEYD_INSERT     0xd2
280 #define KEYD_HOME       0xc7
281 #define KEYD_PAGEUP     0xc9
282 #define KEYD_PAGEDOWN   0xd1
283 #define KEYD_DEL        0xc8
284 #define KEYD_END        0xcf
285 #define KEYD_SCROLLLOCK 0xc6
286 #define KEYD_SPACEBAR   0x20
287 // phares 3/2/98
288 
289 #define KEYD_NUMLOCK    0xC5                 // killough 3/6/98
290 
291 // cph - Add the numeric keypad keys, as suggested by krose 4/22/99:
292 // The way numbers are assigned to keys is a mess, but it's too late to
293 // change that easily. At least these additions are don neatly.
294 // Codes 0x100-0x200 are reserved for number pad
295 
296 #define KEYD_KEYPAD0      (0x100 + '0')
297 #define KEYD_KEYPAD1      (0x100 + '1')
298 #define KEYD_KEYPAD2      (0x100 + '2')
299 #define KEYD_KEYPAD3      (0x100 + '3')
300 #define KEYD_KEYPAD4      (0x100 + '4')
301 #define KEYD_KEYPAD5      (0x100 + '5')
302 #define KEYD_KEYPAD6      (0x100 + '6')
303 #define KEYD_KEYPAD7      (0x100 + '7')
304 #define KEYD_KEYPAD8      (0x100 + '8')
305 #define KEYD_KEYPAD9      (0x100 + '9')
306 #define KEYD_KEYPADENTER  (0x100 + KEYD_ENTER)
307 #define KEYD_KEYPADDIVIDE (0x100 + '/')
308 #define KEYD_KEYPADMULTIPLY (0x100 + '*')
309 #define KEYD_KEYPADMINUS  (0x100 + '-')
310 #define KEYD_KEYPADPLUS   (0x100 + '+')
311 #define KEYD_KEYPADPERIOD (0x100 + '.')
312 
313 // haleyjd: virtual keys
314 #define KEYD_MOUSE1     (0x80 + 0x60)
315 #define KEYD_MOUSE2     (0x80 + 0x61)
316 #define KEYD_MOUSE3     (0x80 + 0x62)
317 #define KEYD_MWHEELUP   (0x80 + 0x6b)
318 #define KEYD_MWHEELDOWN (0x80 + 0x6c)
319 
320 // phares 4/19/98:
321 // Defines Setup Screen groups that config variables appear in.
322 // Used when resetting the defaults for every item in a Setup group.
323 
324 typedef enum {
325   ss_none,
326   ss_keys,
327   ss_weap,
328   ss_stat,
329   ss_auto,
330   ss_enem,
331   ss_mess,
332   ss_chat,
333   ss_gen,       /* killough 10/98 */
334   ss_comp,      /* killough 10/98 */
335   ss_max
336 } ss_types;
337 
338 // phares 3/20/98:
339 //
340 // Player friction is variable, based on controlling
341 // linedefs. More friction can create mud, sludge,
342 // magnetized floors, etc. Less friction can create ice.
343 
344 #define MORE_FRICTION_MOMENTUM 15000       // mud factor based on momentum
345 #define ORIG_FRICTION          0xE800      // original value
346 #define ORIG_FRICTION_FACTOR   2048        // original value
347 
348 #endif          // __DOOMDEF__
349