Debian Codegraph @

prboom2/src/doomdef.h

raw
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 #if !defined(__GNUC__) && !defined(__clang__)
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 #include "m_swap.h"
58 #include "doomtype.h"
59
60 extern dboolean bfgedition;
61
62 // Game mode handling - identify IWAD version
63 // to handle IWAD dependend animations etc.
64 typedef enum {
65 shareware, // DOOM 1 shareware, E1, M9
66 registered, // DOOM 1 registered, E3, M27
67 commercial, // DOOM 2 retail, E1 M34 (DOOM 2 german edition not handled)
68 retail, // DOOM 1 retail, E4, M36
69 indetermined // Well, no IWAD found.
70 } GameMode_t;
71
72 // Mission packs - might be useful for TC stuff?
73 typedef enum {
74 doom, // DOOM 1
75 doom2, // DOOM 2
76 pack_tnt, // TNT mission pack
77 pack_plut, // Plutonia pack
78 pack_nerve, // No Rest For The Living
79 tc_hacx, // HACX - Twitch 'n Kill
80 tc_chex, // Chex Quest
81 tc_chex3v, // Chex Quest 3: Vanilla/Modding Edition
82 tc_rekkr, // REKKR
83 tc_freedoom, // Freedoom
84 none
85 } GameMission_t;
86
87 extern dboolean tc_game;
88
89 // Identify language to use, software localization.
90 typedef enum {
91 english,
92 french,
93 german,
94 unknown
95 } Language_t;
96
97 //
98 // For resize of screen, at start of game.
99 //
100
101 #define BASE_WIDTH 320
102
103 // It is educational but futile to change this
104 // scaling e.g. to 2. Drawing of status bar,
105 // menues etc. is tied to the scale implied
106 // by the graphics.
107
108 #define INV_ASPECT_RATIO 0.625 /* 0.75, ideally */
109
110 // killough 2/8/98: MAX versions for maximum screen sizes
111 // allows us to avoid the overhead of dynamic allocation
112 // when multiple screen sizes are supported
113
114 // SCREENWIDTH and SCREENHEIGHT define the visible size
115 extern int SCREENWIDTH;
116 extern int SCREENHEIGHT;
117 // ACTUALHEIGHT is the actual height of the resolution
118 // If the resolution is 200p or 400p, aspect ratio correction
119 // should be applied, making this value 240 or 480
120 extern int ACTUALHEIGHT;
121 // SCREENPITCH is the size of one line in the buffer and
122 // can be bigger than the SCREENWIDTH depending on the size
123 // of one pixel (8, 16 or 32 bit) and the padding at the
124 // end of the line caused by hardware considerations
125 extern int SCREENPITCH;
126
127 // e6y: wide-res
128 extern int WIDE_SCREENWIDTH;
129 extern int WIDE_SCREENHEIGHT;
130 extern int SCREEN_320x200;
131
132 // The maximum number of players, multiplayer/networking.
133 #define MAX_MAXPLAYERS 8
134
135 // killough 2/28/98: A ridiculously large number
136 // of players, the most you'll ever need in a demo
137 // or savegame. This is used to prevent problems, in
138 // case more players in a game are supported later.
139 #define FUTURE_MAXPLAYERS 32
140
141 // phares 5/14/98:
142 // DOOM Editor Numbers (aka doomednum in mobj_t)
143
144 #define DEN_PLAYER5 4001
145 #define DEN_PLAYER6 4002
146 #define DEN_PLAYER7 4003
147 #define DEN_PLAYER8 4004
148
149 // State updates, number of tics / second.
150 #define TICRATE 35
151
152 // The current state of the game: whether we are playing, gazing
153 // at the intermission screen, the game final animation, or a demo.
154
155 typedef enum {
156 GS_DEFAULT = -1,
157 GS_LEVEL,
158 GS_INTERMISSION,
159 GS_FINALE,
160 GS_DEMOSCREEN
161 } gamestate_t;
162
163 //
164 // Difficulty/skill settings/filters.
165 //
166 // These are Thing flags
167
168 // Skill flags.
169 #define MTF_EASY 0x0001
170 #define MTF_NORMAL 0x0002
171 #define MTF_HARD 0x0004
172 // Deaf monsters/do not react to sound.
173 #define MTF_AMBUSH 0x0008
174
175 /* killough 11/98 */
176 #define MTF_NOTSINGLE 0x0010
177 #define MTF_NOTDM 0x0020
178 #define MTF_NOTCOOP 0x0040
179 #define MTF_FRIEND 0x0080
180 #define MTF_RESERVED 0x0100
181
182 // hexen
183 #define MTF_DORMANT 0x0010
184 #define MTF_FIGHTER 0x0020
185 #define MTF_CLERIC 0x0040
186 #define MTF_MAGE 0x0080
187 #define MTF_GSINGLE 0x0100
188 #define MTF_GCOOP 0x0200
189 #define MTF_GDEATHMATCH 0x0400
190
191 // zdoom
192 #define MTF_TRANSLUCENT 0x0800
193 #define MTF_INVISIBLE 0x1000
194 #define MTF_FRIENDLY 0x2000
195 #define MTF_STANDSTILL 0x4000
196 #define MTF_COUNTSECRET 0x8000
197 #define MTF_SKILL1 0x00010000
198 #define MTF_SKILL2 0x00020000
199 #define MTF_SKILL3 0x00040000
200 #define MTF_SKILL4 0x00080000
201 #define MTF_SKILL5 0x00100000
202
203 //
204 // Key cards.
205 //
206
207 typedef enum {
208 it_bluecard,
209 it_yellowcard,
210 it_redcard,
211 it_blueskull,
212 it_yellowskull,
213 it_redskull,
214 DOOM_NUMCARDS,
215
216 // heretic
217 key_blue = 0,
218 key_yellow,
219 key_green,
220
221 // hexen
222 key_1 = 0,
223 key_2,
224 key_3,
225 key_4,
226 key_5,
227 key_6,
228 key_7,
229 key_8,
230 key_9,
231 key_a,
232 key_b,
233 NUMCARDS
234 } card_t;
235
236 // The defined weapons, including a marker
237 // indicating user has not changed weapon.
238 typedef enum {
239 wp_fist,
240 wp_pistol,
241 wp_shotgun,
242 wp_chaingun,
243 wp_missile,
244 wp_plasma,
245 wp_bfg,
246 wp_chainsaw,
247 wp_supershotgun,
248
249 // heretic
250 wp_staff = 0,
251 wp_goldwand,
252 wp_crossbow,
253 wp_blaster,
254 wp_skullrod,
255 wp_phoenixrod,
256 wp_mace,
257 wp_gauntlets,
258 wp_beak,
259
260 NUMWEAPONS,
261 wp_nochange, // No pending weapon change.
262
263 // hexen
264 wp_first = 0,
265 wp_second,
266 wp_third,
267 wp_fourth,
268 HEXEN_NUMWEAPONS
269 } weapontype_t;
270
271 // Ammunition types defined.
272 typedef enum {
273 am_clip, // Pistol / chaingun ammo.
274 am_shell, // Shotgun / double barreled shotgun.
275 am_cell, // Plasma rifle, BFG.
276 am_misl, // Missile launcher.
277 DOOM_NUMAMMO,
278
279 // heretic
280 am_goldwand = 0,
281 am_crossbow,
282 am_blaster,
283 am_skullrod,
284 am_phoenixrod,
285 am_mace,
286 HERETIC_NUMAMMO,
287
288 NUMAMMO = HERETIC_NUMAMMO,
289 am_noammo, // fist, chainsaw, staff, gauntlets
290
291 // hexen
292 MANA_1 = 0,
293 MANA_2,
294 NUMMANA,
295 MANA_BOTH,
296 MANA_NONE = am_noammo
297 } ammotype_t;
298
299 // Power up artifacts.
300 typedef enum {
301 pw_invulnerability,
302 pw_strength,
303 pw_invisibility,
304 pw_ironfeet,
305 pw_allmap,
306 pw_infrared,
307
308 // heretic
309 pw_weaponlevel2,
310 pw_flight,
311 pw_shield,
312 pw_health2,
313
314 // hexen
315 pw_speed,
316 pw_minotaur,
317
318 NUMPOWERS
319 } powertype_t;
320
321 // Power up durations (how many seconds till expiration).
322 typedef enum {
323 INVULNTICS = (30*TICRATE),
324 INVISTICS = (60*TICRATE),
325 INFRATICS = (120*TICRATE),
326 IRONTICS = (60*TICRATE),
327 WPNLEV2TICS = (40*TICRATE),
328 FLIGHTTICS = (60*TICRATE),
329 SPEEDTICS = (45*TICRATE),
330 MORPHTICS = (40*TICRATE),
331 MAULATORTICS = (25*TICRATE)
332 } powerduration_t;
333
334 // DOOM keyboard definition.
335 // This is the stuff configured by Setup.Exe.
336 // Most key data are simple ascii (uppercased).
337
338 #define KEYD_RIGHTARROW 0xae
339 #define KEYD_LEFTARROW 0xac
340 #define KEYD_UPARROW 0xad
341 #define KEYD_DOWNARROW 0xaf
342 #define KEYD_ESCAPE 27
343 #define KEYD_ENTER 13
344 #define KEYD_TAB 9
345 #define KEYD_F1 (0x80+0x3b)
346 #define KEYD_F2 (0x80+0x3c)
347 #define KEYD_F3 (0x80+0x3d)
348 #define KEYD_F4 (0x80+0x3e)
349 #define KEYD_F5 (0x80+0x3f)
350 #define KEYD_F6 (0x80+0x40)
351 #define KEYD_F7 (0x80+0x41)
352 #define KEYD_F8 (0x80+0x42)
353 #define KEYD_F9 (0x80+0x43)
354 #define KEYD_F10 (0x80+0x44)
355 #define KEYD_F11 (0x80+0x57)
356 #define KEYD_F12 (0x80+0x58)
357 #define KEYD_BACKSPACE 127
358 #define KEYD_PAUSE 0xff
359 #define KEYD_EQUALS 0x3d
360 #define KEYD_MINUS 0x2d
361 #define KEYD_RSHIFT (0x80+0x36)
362 #define KEYD_RCTRL (0x80+0x1d)
363 #define KEYD_RALT (0x80+0x38)
364 #define KEYD_LALT KEYD_RALT
365 #define KEYD_CAPSLOCK 0xba // phares
366 #define KEYD_PRINTSC 0xfe
367
368 // phares 3/2/98:
369 #define KEYD_INSERT 0xd2
370 #define KEYD_HOME 0xc7
371 #define KEYD_PAGEUP 0xc9
372 #define KEYD_PAGEDOWN 0xd1
373 #define KEYD_DEL 0xc8
374 #define KEYD_END 0xcf
375 #define KEYD_SCROLLLOCK 0xc6
376 #define KEYD_SPACEBAR 0x20
377 // phares 3/2/98
378
379 #define KEYD_NUMLOCK 0xC5 // killough 3/6/98
380
381 // cph - Add the numeric keypad keys, as suggested by krose 4/22/99:
382 // The way numbers are assigned to keys is a mess, but it's too late to
383 // change that easily. At least these additions are don neatly.
384 // Codes 0x100-0x200 are reserved for number pad
385
386 #define KEYD_KEYPAD0 (0x100 + '0')
387 #define KEYD_KEYPAD1 (0x100 + '1')
388 #define KEYD_KEYPAD2 (0x100 + '2')
389 #define KEYD_KEYPAD3 (0x100 + '3')
390 #define KEYD_KEYPAD4 (0x100 + '4')
391 #define KEYD_KEYPAD5 (0x100 + '5')
392 #define KEYD_KEYPAD6 (0x100 + '6')
393 #define KEYD_KEYPAD7 (0x100 + '7')
394 #define KEYD_KEYPAD8 (0x100 + '8')
395 #define KEYD_KEYPAD9 (0x100 + '9')
396 #define KEYD_KEYPADENTER (0x100 + KEYD_ENTER)
397 #define KEYD_KEYPADDIVIDE (0x100 + '/')
398 #define KEYD_KEYPADMULTIPLY (0x100 + '*')
399 #define KEYD_KEYPADMINUS (0x100 + '-')
400 #define KEYD_KEYPADPLUS (0x100 + '+')
401 #define KEYD_KEYPADPERIOD (0x100 + '.')
402
403 // haleyjd: virtual keys
404 #define KEYD_MOUSE1 (0x80 + 0x60)
405 #define KEYD_MOUSE2 (0x80 + 0x61)
406 #define KEYD_MOUSE3 (0x80 + 0x62)
407 #define KEYD_MWHEELUP (0x80 + 0x6b)
408 #define KEYD_MWHEELDOWN (0x80 + 0x6c)
409 #define KEYD_MWHEELLEFT (0X80 + 0X6d)
410 #define KEYD_MWHEELRIGHT (0X80 + 0X6e)
411
412 // phares 3/20/98:
413 //
414 // Player friction is variable, based on controlling
415 // linedefs. More friction can create mud, sludge,
416 // magnetized floors, etc. Less friction can create ice.
417
418 #define MORE_FRICTION_MOMENTUM 15000 // mud factor based on momentum
419 #define ORIG_FRICTION 0xE800 // original value
420 #define ORIG_FRICTION_FACTOR 2048 // original value
421 #define FRICTION_FLY 0xeb00
422
423 extern dboolean raven;
424
425 // heretic
426
427 #define FRICTION_LOW 0xf900
428 #define TELEFOGHEIGHT (32*FRACUNIT)
429 #define ANG1_X 0x01000000
430
431 #define FOOTCLIPSIZE 10*FRACUNIT
432
433 // Any floor type >= FLOOR_LIQUID will floorclip sprites (hexen)
434 typedef enum {
435 FLOOR_SOLID,
436 FLOOR_ICE,
437 FLOOR_LIQUID,
438 FLOOR_WATER,
439 FLOOR_LAVA,
440 FLOOR_SLUDGE
441 } floortype_t;
442
443 #define USE_GWND_AMMO_1 1
444 #define USE_GWND_AMMO_2 1
445 #define USE_CBOW_AMMO_1 1
446 #define USE_CBOW_AMMO_2 1
447 #define USE_BLSR_AMMO_1 1
448 #define USE_BLSR_AMMO_2 5
449 #define USE_SKRD_AMMO_1 1
450 #define USE_SKRD_AMMO_2 5
451 #define USE_PHRD_AMMO_1 1
452 #define USE_PHRD_AMMO_2 1
453 #define USE_MACE_AMMO_1 1
454 #define USE_MACE_AMMO_2 5
455
456 #define TOCENTER -8
457
458 #define BLINKTHRESHOLD (4*32)
459
460 // TODO_HEXEN: BLINKTHRESHOLD is (4*35)
461
462 extern dboolean heretic;
463
464 //hexen
465
466 // The top 3 bits of the artifact field in the ticcmd_t struct are used
467 // as additional flags
468 #define AFLAG_MASK 0x3F
469 #define AFLAG_SUICIDE 0x40
470 #define AFLAG_JUMP 0x80
471
472 typedef enum
473 {
474 ARMOR_ARMOR,
475 ARMOR_SHIELD,
476 ARMOR_HELMET,
477 ARMOR_AMULET,
478 NUMARMOR
479 } armortype_t;
480
481 typedef enum
482 {
483 PCLASS_NULL,
484 PCLASS_FIGHTER,
485 PCLASS_CLERIC,
486 PCLASS_MAGE,
487 PCLASS_PIG,
488 NUMCLASSES
489 } pclass_t;
490
491 typedef ammotype_t manatype_t;
492
493 #define MAX_MANA 200
494
495 #define WPIECE1 1
496 #define WPIECE2 2
497 #define WPIECE3 4
498
499 enum
500 {
501 SEQ_PLATFORM,
502 SEQ_PLATFORM_HEAVY, // same script as a normal platform
503 SEQ_PLATFORM_METAL,
504 SEQ_PLATFORM_CREAK, // same script as a normal platform
505 SEQ_PLATFORM_SILENCE,
506 SEQ_PLATFORM_LAVA,
507 SEQ_PLATFORM_WATER,
508 SEQ_PLATFORM_ICE,
509 SEQ_PLATFORM_EARTH,
510 SEQ_PLATFORM_METAL2,
511 SEQ_DOOR_STONE,
512 SEQ_DOOR_HEAVY,
513 SEQ_DOOR_METAL,
514 SEQ_DOOR_CREAK,
515 SEQ_DOOR_SILENCE,
516 SEQ_DOOR_LAVA,
517 SEQ_DOOR_WATER,
518 SEQ_DOOR_ICE,
519 SEQ_DOOR_EARTH,
520 SEQ_DOOR_METAL2,
521 SEQ_ESOUND_WIND,
522 SEQ_NUMSEQ
523 };
524
525 typedef enum
526 {
527 SEQTYPE_STONE,
528 SEQTYPE_HEAVY,
529 SEQTYPE_METAL,
530 SEQTYPE_CREAK,
531 SEQTYPE_SILENCE,
532 SEQTYPE_LAVA,
533 SEQTYPE_WATER,
534 SEQTYPE_ICE,
535 SEQTYPE_EARTH,
536 SEQTYPE_METAL2,
537 SEQTYPE_NUMSEQ
538 } seqtype_t;
539
540 #define MAX_INTRMSN_MESSAGE_SIZE 1024
541
542 // Puzzle artifacts
543
544 #define TXT_ARTIPUZZSKULL "YORICK'S SKULL"
545 #define TXT_ARTIPUZZGEMBIG "HEART OF D'SPARIL"
546 #define TXT_ARTIPUZZGEMRED "RUBY PLANET"
547 #define TXT_ARTIPUZZGEMGREEN1 "EMERALD PLANET"
548 #define TXT_ARTIPUZZGEMGREEN2 "EMERALD PLANET"
549 #define TXT_ARTIPUZZGEMBLUE1 "SAPPHIRE PLANET"
550 #define TXT_ARTIPUZZGEMBLUE2 "SAPPHIRE PLANET"
551 #define TXT_ARTIPUZZBOOK1 "DAEMON CODEX"
552 #define TXT_ARTIPUZZBOOK2 "LIBER OSCURA"
553 #define TXT_ARTIPUZZSKULL2 "FLAME MASK"
554 #define TXT_ARTIPUZZFWEAPON "GLAIVE SEAL"
555 #define TXT_ARTIPUZZCWEAPON "HOLY RELIC"
556 #define TXT_ARTIPUZZMWEAPON "SIGIL OF THE MAGUS"
557 #define TXT_ARTIPUZZGEAR "CLOCK GEAR"
558 #define TXT_USEPUZZLEFAILED "YOU CANNOT USE THIS HERE"
559
560 extern dboolean hexen;
561
562 #endif // __DOOMDEF__