1 // Emacs style mode select	 -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // $Id:$
5 //
6 // Copyright (C) 1993-1996 by id Software, Inc.
7 //
8 // This source is available for distribution and/or modification
9 // only under the terms of the DOOM Source Code License as
10 // published by id Software. All rights reserved.
11 //
12 // The source is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
15 // for more details.
16 //
17 // DESCRIPTION:
18 //	Internally used data structures for virtually everything,
19 //	 key definitions, lots of other stuff.
20 //
21 //-----------------------------------------------------------------------------
22 
23 #ifndef __DOOMDEF_H__
24 #define __DOOMDEF_H__
25 
26 #include <stdio.h>
27 #include <string.h>
28 
29 //
30 // Global parameters/defines.
31 //
32 
33 // Game mode handling - identify IWAD version
34 //	to handle IWAD dependend animations etc.
35 typedef enum
36 {
37 	shareware,		// DOOM 1 shareware, E1, M9
38 	registered,		// DOOM 1 registered, E3, M27
39 	commercial,		// DOOM 2 retail, E1 M34
40 	// DOOM 2 german edition not handled
41 	retail,			// DOOM 1 retail, E4, M36
42 	undetermined	// Well, no IWAD found.
43 
44 } GameMode_t;
45 
46 
47 // If rangecheck is undefined, most parameter validation debugging code
48 // will not be compiled
49 #ifndef NORANGECHECKING
50 #ifndef RANGECHECK
51 #define RANGECHECK
52 #endif
53 #endif
54 
55 // The maximum number of players, multiplayer/networking.
56 #define MAXPLAYERS		8
57 
58 // State updates, number of tics / second.
59 #define TICRATE 		35
60 
61 // Amount of damage done by a telefrag.
62 #define TELEFRAG_DAMAGE	1000000
63 
64 // The current state of the game: whether we are
65 // playing, gazing at the intermission screen,
66 // the game final animation, or a demo.
67 typedef enum
68 {
69 	GS_LEVEL,
70 	GS_INTERMISSION,
71 	GS_FINALE,
72 	GS_DEMOSCREEN,
73 	GS_FULLCONSOLE,		// [RH]	Fullscreen console
74 	GS_HIDECONSOLE,		// [RH] The menu just did something that should hide fs console
75 	GS_STARTUP,			// [RH] Console is fullscreen, and game is just starting
76 	GS_TITLELEVEL,		// [RH] A combination of GS_LEVEL and GS_DEMOSCREEN
77 
78 	GS_FORCEWIPE = -1,
79 	GS_FORCEWIPEFADE = -2,
80 	GS_FORCEWIPEBURN = -3,
81 	GS_FORCEWIPEMELT = -4
82 } gamestate_t;
83 
84 extern	gamestate_t 	gamestate;
85 
86 // wipegamestate can be set to -1
87 //	to force a wipe on the next draw
88 extern gamestate_t wipegamestate;
89 
90 
91 typedef float skill_t;
92 
93 /*
94 enum ESkillLevels
95 {
96 	sk_baby,
97 	sk_easy,
98 	sk_medium,
99 	sk_hard,
100 	sk_nightmare
101 };
102 */
103 
104 
105 
106 #define TELEFOGHEIGHT			(gameinfo.telefogheight)
107 
108 //
109 // DOOM keyboard definition. Everything below 0x100 matches
110 // a mode 1 keyboard scan code.
111 //
112 #define KEY_PAUSE				0xc5	// DIK_PAUSE
113 #define KEY_RIGHTARROW			0xcd	// DIK_RIGHT
114 #define KEY_LEFTARROW			0xcb	// DIK_LEFT
115 #define KEY_UPARROW 			0xc8	// DIK_UP
116 #define KEY_DOWNARROW			0xd0	// DIK_DOWN
117 #define KEY_ESCAPE				0x01	// DIK_ESCAPE
118 #define KEY_ENTER				0x1c	// DIK_RETURN
119 #define KEY_SPACE				0x39	// DIK_SPACE
120 #define KEY_TAB 				0x0f	// DIK_TAB
121 #define KEY_F1					0x3b	// DIK_F1
122 #define KEY_F2					0x3c	// DIK_F2
123 #define KEY_F3					0x3d	// DIK_F3
124 #define KEY_F4					0x3e	// DIK_F4
125 #define KEY_F5					0x3f	// DIK_F5
126 #define KEY_F6					0x40	// DIK_F6
127 #define KEY_F7					0x41	// DIK_F7
128 #define KEY_F8					0x42	// DIK_F8
129 #define KEY_F9					0x43	// DIK_F9
130 #define KEY_F10 				0x44	// DIK_F10
131 #define KEY_F11 				0x57	// DIK_F11
132 #define KEY_F12 				0x58	// DIK_F12
133 #define KEY_GRAVE				0x29	// DIK_GRAVE
134 
135 #define KEY_BACKSPACE			0x0e	// DIK_BACK
136 
137 #define KEY_EQUALS				0x0d	// DIK_EQUALS
138 #define KEY_MINUS				0x0c	// DIK_MINUS
139 
140 #define KEY_LSHIFT				0x2A	// DIK_LSHIFT
141 #define KEY_LCTRL				0x1d	// DIK_LCONTROL
142 #define KEY_LALT				0x38	// DIK_LMENU
143 
144 #define	KEY_RSHIFT				KEY_LSHIFT
145 #define KEY_RCTRL				KEY_LCTRL
146 #define KEY_RALT				KEY_LALT
147 
148 #define KEY_INS 				0xd2	// DIK_INSERT
149 #define KEY_DEL 				0xd3	// DIK_DELETE
150 #define KEY_END 				0xcf	// DIK_END
151 #define KEY_HOME				0xc7	// DIK_HOME
152 #define KEY_PGUP				0xc9	// DIK_PRIOR
153 #define KEY_PGDN				0xd1	// DIK_NEXT
154 
155 #define KEY_MOUSE1				0x100
156 #define KEY_MOUSE2				0x101
157 #define KEY_MOUSE3				0x102
158 #define KEY_MOUSE4				0x103
159 #define KEY_MOUSE5				0x104
160 #define KEY_MOUSE6				0x105
161 #define KEY_MOUSE7				0x106
162 #define KEY_MOUSE8				0x107
163 
164 #define KEY_FIRSTJOYBUTTON		0x108
165 #define KEY_JOY1				(KEY_FIRSTJOYBUTTON+0)
166 #define KEY_JOY2				(KEY_FIRSTJOYBUTTON+1)
167 #define KEY_JOY3				(KEY_FIRSTJOYBUTTON+2)
168 #define KEY_JOY4				(KEY_FIRSTJOYBUTTON+3)
169 #define KEY_JOY5				(KEY_FIRSTJOYBUTTON+4)
170 #define KEY_JOY6				(KEY_FIRSTJOYBUTTON+5)
171 #define KEY_JOY7				(KEY_FIRSTJOYBUTTON+6)
172 #define KEY_JOY8				(KEY_FIRSTJOYBUTTON+7)
173 #define KEY_LASTJOYBUTTON		0x187
174 #define KEY_JOYPOV1_UP			0x188
175 #define KEY_JOYPOV1_RIGHT		0x189
176 #define KEY_JOYPOV1_DOWN		0x18a
177 #define KEY_JOYPOV1_LEFT		0x18b
178 #define KEY_JOYPOV2_UP			0x18c
179 #define KEY_JOYPOV3_UP			0x190
180 #define KEY_JOYPOV4_UP			0x194
181 
182 #define KEY_MWHEELUP			0x198
183 #define KEY_MWHEELDOWN			0x199
184 #define KEY_MWHEELRIGHT			0x19A
185 #define KEY_MWHEELLEFT			0x19B
186 
187 #define KEY_JOYAXIS1PLUS		0x19C
188 #define KEY_JOYAXIS1MINUS		0x19D
189 #define KEY_JOYAXIS2PLUS		0x19E
190 #define KEY_JOYAXIS2MINUS		0x19F
191 #define KEY_JOYAXIS3PLUS		0x1A0
192 #define KEY_JOYAXIS3MINUS		0x1A1
193 #define KEY_JOYAXIS4PLUS		0x1A2
194 #define KEY_JOYAXIS4MINUS		0x1A3
195 #define KEY_JOYAXIS5PLUS		0x1A4
196 #define KEY_JOYAXIS5MINUS		0x1A5
197 #define KEY_JOYAXIS6PLUS		0x1A6
198 #define KEY_JOYAXIS6MINUS		0x1A7
199 #define KEY_JOYAXIS7PLUS		0x1A8
200 #define KEY_JOYAXIS7MINUS		0x1A9
201 #define KEY_JOYAXIS8PLUS		0x1AA
202 #define KEY_JOYAXIS8MINUS		0x1AB
203 #define NUM_JOYAXISBUTTONS		8
204 
205 #define KEY_PAD_LTHUMB_RIGHT	0x1AC
206 #define KEY_PAD_LTHUMB_LEFT		0x1AD
207 #define KEY_PAD_LTHUMB_DOWN		0x1AE
208 #define KEY_PAD_LTHUMB_UP		0x1AF
209 
210 #define KEY_PAD_RTHUMB_RIGHT	0x1B0
211 #define KEY_PAD_RTHUMB_LEFT		0x1B1
212 #define KEY_PAD_RTHUMB_DOWN		0x1B2
213 #define KEY_PAD_RTHUMB_UP		0x1B3
214 
215 #define KEY_PAD_DPAD_UP			0x1B4
216 #define KEY_PAD_DPAD_DOWN		0x1B5
217 #define KEY_PAD_DPAD_LEFT		0x1B6
218 #define KEY_PAD_DPAD_RIGHT		0x1B7
219 #define KEY_PAD_START			0x1B8
220 #define KEY_PAD_BACK			0x1B9
221 #define KEY_PAD_LTHUMB			0x1BA
222 #define KEY_PAD_RTHUMB			0x1BB
223 #define KEY_PAD_LSHOULDER		0x1BC
224 #define KEY_PAD_RSHOULDER		0x1BD
225 #define KEY_PAD_LTRIGGER		0x1BE
226 #define KEY_PAD_RTRIGGER		0x1BF
227 #define KEY_PAD_A				0x1C0
228 #define KEY_PAD_B				0x1C1
229 #define KEY_PAD_X				0x1C2
230 #define KEY_PAD_Y				0x1C3
231 
232 #define NUM_KEYS				0x1C4
233 
234 // [RH] dmflags bits (based on Q2's)
235 enum
236 {
237 	DF_NO_HEALTH			= 1 << 0,	// Do not spawn health items (DM)
238 	DF_NO_ITEMS				= 1 << 1,	// Do not spawn powerups (DM)
239 	DF_WEAPONS_STAY			= 1 << 2,	// Leave weapons around after pickup (DM)
240 	DF_FORCE_FALLINGZD		= 1 << 3,	// Falling too far hurts (old ZDoom style)
241 	DF_FORCE_FALLINGHX		= 2 << 3,	// Falling too far hurts (Hexen style)
242 	DF_FORCE_FALLINGST		= 3 << 3,	// Falling too far hurts (Strife style)
243 //							  1 << 5	-- this space left blank --
244 	DF_SAME_LEVEL			= 1 << 6,	// Stay on the same map when someone exits (DM)
245 	DF_SPAWN_FARTHEST		= 1 << 7,	// Spawn players as far as possible from other players (DM)
246 	DF_FORCE_RESPAWN		= 1 << 8,	// Automatically respawn dead players after respawn_time is up (DM)
247 	DF_NO_ARMOR				= 1 << 9,	// Do not spawn armor (DM)
248 	DF_NO_EXIT				= 1 << 10,	// Kill anyone who tries to exit the level (DM)
249 	DF_INFINITE_AMMO		= 1 << 11,	// Don't use up ammo when firing
250 	DF_NO_MONSTERS			= 1 << 12,	// Don't spawn monsters (replaces -nomonsters parm)
251 	DF_MONSTERS_RESPAWN		= 1 << 13,	// Monsters respawn sometime after their death (replaces -respawn parm)
252 	DF_ITEMS_RESPAWN		= 1 << 14,	// Items other than invuln. and invis. respawn
253 	DF_FAST_MONSTERS		= 1 << 15,	// Monsters are fast (replaces -fast parm)
254 	DF_NO_JUMP				= 1 << 16,	// Don't allow jumping
255 	DF_YES_JUMP				= 2 << 16,
256 	DF_NO_FREELOOK			= 1 << 18,	// Don't allow freelook
257 	DF_YES_FREELOOK			= 2 << 18,
258 	DF_NO_FOV				= 1 << 20,	// Only let the arbitrator set FOV (for all players)
259 	DF_NO_COOP_WEAPON_SPAWN	= 1 << 21,	// Don't spawn multiplayer weapons in coop games
260 	DF_NO_CROUCH			= 1 << 22,	// Don't allow crouching
261 	DF_YES_CROUCH			= 2 << 22,	//
262 	DF_COOP_LOSE_INVENTORY	= 1 << 24,	// Lose all your old inventory when respawning in coop
263 	DF_COOP_LOSE_KEYS		= 1 << 25,	// Lose keys when respawning in coop
264 	DF_COOP_LOSE_WEAPONS	= 1 << 26,	// Lose weapons when respawning in coop
265 	DF_COOP_LOSE_ARMOR		= 1 << 27,	// Lose armor when respawning in coop
266 	DF_COOP_LOSE_POWERUPS	= 1 << 28,	// Lose powerups when respawning in coop
267 	DF_COOP_LOSE_AMMO		= 1 << 29,	// Lose ammo when respawning in coop
268 	DF_COOP_HALVE_AMMO		= 1 << 30,	// Lose half your ammo when respawning in coop (but not less than the normal starting amount)
269 };
270 
271 // [BC] More dmflags. w00p!
272 enum
273 {
274 //	DF2_YES_IMPALING		= 1 << 0,	// Player gets implaed on MF2_IMPALE items
275 	DF2_YES_WEAPONDROP		= 1 << 1,	// Drop current weapon upon death
276 //	DF2_NO_RUNES			= 1 << 2,	// Don't spawn runes
277 //	DF2_INSTANT_RETURN		= 1 << 3,	// Instantly return flags and skulls when player carrying it dies (ST/CTF)
278 	DF2_NO_TEAM_SWITCH		= 1 << 4,	// Do not allow players to switch teams in teamgames
279 //	DF2_NO_TEAM_SELECT		= 1 << 5,	// Player is automatically placed on a team.
280 	DF2_YES_DOUBLEAMMO		= 1 << 6,	// Double amount of ammo that items give you like skill 1 and 5 do
281 	DF2_YES_DEGENERATION	= 1 << 7,	// Player slowly loses health when over 100% (Quake-style)
282 	DF2_NO_FREEAIMBFG		= 1 << 8,	// Disallow BFG freeaiming. Prevents cheap BFG frags by aiming at floor or ceiling
283 	DF2_BARRELS_RESPAWN		= 1 << 9,	// Barrels respawn (duh)
284 	DF2_YES_RESPAWN_INVUL	= 1 << 10,	// Player is temporarily invulnerable when respawned
285 //	DF2_COOP_SHOTGUNSTART	= 1 << 11,	// All playres start with a shotgun when they respawn
286 	DF2_SAME_SPAWN_SPOT		= 1 << 12,	// Players respawn in the same place they died (co-op)
287 	DF2_YES_KEEPFRAGS		= 1 << 13,	// Don't clear frags after each level
288 	DF2_NO_RESPAWN			= 1 << 14,	// Player cannot respawn
289 	DF2_YES_LOSEFRAG		= 1 << 15,	// Lose a frag when killed. More incentive to try to not get yerself killed
290 	DF2_INFINITE_INVENTORY	= 1 << 16,	// Infinite inventory.
291 	DF2_KILL_MONSTERS		= 1 << 17,	// All monsters must be killed before the level exits.
292 	DF2_NO_AUTOMAP			= 1 << 18,	// Players are allowed to see the automap.
293 	DF2_NO_AUTOMAP_ALLIES	= 1 << 19,	// Allies can been seen on the automap.
294 	DF2_DISALLOW_SPYING		= 1 << 20,	// You can spy on your allies.
295 	DF2_CHASECAM			= 1 << 21,	// Players can use the chasecam cheat.
296 	DF2_NOSUICIDE			= 1 << 22,	// Players are not allowed to suicide.
297 	DF2_NOAUTOAIM			= 1 << 23,	// Players cannot use autoaim.
298 	DF2_DONTCHECKAMMO		= 1 << 24,	// Don't Check ammo when switching weapons.
299 	DF2_KILLBOSSMONST		= 1 << 25,	// Kills all monsters spawned by a boss cube when the boss dies
300 	DF2_NOCOUNTENDMONST		= 1 << 26,	// Do not count monsters in 'end level when dying' sectors towards kill count
301 	DF2_RESPAWN_SUPER		= 1 << 27,	// Respawn invulnerability and invisibility
302 };
303 
304 // [RH] Compatibility flags.
305 enum
306 {
307 	COMPATF_SHORTTEX		= 1 << 0,	// Use Doom's shortest texture around behavior?
308 	COMPATF_STAIRINDEX		= 1 << 1,	// Don't fix loop index for stair building?
309 	COMPATF_LIMITPAIN		= 1 << 2,	// Pain elemental is limited to 20 lost souls?
310 	COMPATF_SILENTPICKUP	= 1 << 3,	// Pickups are only heard locally?
311 	COMPATF_NO_PASSMOBJ		= 1 << 4,	// Pretend every actor is infinitely tall?
312 	COMPATF_MAGICSILENCE	= 1 << 5,	// Limit actors to one sound at a time?
313 	COMPATF_WALLRUN			= 1 << 6,	// Enable buggier wall clipping so players can wallrun?
314 	COMPATF_NOTOSSDROPS		= 1 << 7,	// Spawn dropped items directly on the floor?
315 	COMPATF_USEBLOCKING		= 1 << 8,	// Any special line can block a use line
316 	COMPATF_NODOORLIGHT		= 1 << 9,	// Don't do the BOOM local door light effect
317 	COMPATF_RAVENSCROLL		= 1 << 10,	// Raven's scrollers use their original carrying speed
318 	COMPATF_SOUNDTARGET		= 1 << 11,	// Use sector based sound target code.
319 	COMPATF_DEHHEALTH		= 1 << 12,	// Limit deh.MaxHealth to the health bonus (as in Doom2.exe)
320 	COMPATF_TRACE			= 1 << 13,	// Trace ignores lines with the same sector on both sides
321 	COMPATF_DROPOFF			= 1 << 14,	// Monsters cannot move when hanging over a dropoff
322 	COMPATF_BOOMSCROLL		= 1 << 15,	// Scrolling sectors are additive like in Boom
323 	COMPATF_INVISIBILITY	= 1 << 16,	// Monsters can see semi-invisible players
324 	COMPATF_SILENT_INSTANT_FLOORS = 1<<17,	// Instantly moving floors are not silent
325 	COMPATF_SECTORSOUNDS	= 1 << 18,	// Sector sounds use original method for sound origin.
326 	COMPATF_MISSILECLIP		= 1 << 19,	// Use original Doom heights for clipping against projectiles
327 	COMPATF_CROSSDROPOFF	= 1 << 20,	// monsters can't be pushed over dropoffs
328 	COMPATF_ANYBOSSDEATH	= 1 << 21,	// [GZ] Any monster which calls BOSSDEATH counts for level specials
329 	COMPATF_MINOTAUR		= 1 << 22,	// Minotaur's floor flame is exploded immediately when feet are clipped
330 	COMPATF_MUSHROOM		= 1 << 23,	// Force original velocity calculations for A_Mushroom in Dehacked mods.
331 	COMPATF_MBFMONSTERMOVE	= 1 << 24,	// Monsters are affected by friction and pushers/pullers.
332 	COMPATF_CORPSEGIBS		= 1 << 25,	// Crushed monsters are turned into gibs, rather than replaced by gibs.
333 	COMPATF_NOBLOCKFRIENDS	= 1 << 26,	// Friendly monsters aren't blocked by monster-blocking lines.
334 	COMPATF_SPRITESORT		= 1 << 27,	// Invert sprite sorting order for sprites of equal distance
335 	COMPATF_HITSCAN			= 1 << 28,	// Hitscans use original blockmap anf hit check code.
336 	COMPATF_LIGHT			= 1 << 29,	// Find neighboring light level like Doom
337 	COMPATF_POLYOBJ			= 1 << 30,	// Draw polyobjects the old fashioned way
338 	COMPATF_MASKEDMIDTEX	= 1u << 31,	// Ignore compositing when drawing masked midtextures
339 
340 	COMPATF2_BADANGLES		= 1 << 0,	// It is impossible to face directly NSEW.
341 	COMPATF2_FLOORMOVE		= 1 << 1,	// Use the same floor motion behavior as Doom.
342 	COMPATF2_SOUNDCUTOFF	= 1 << 2,	// Cut off sounds when an actor vanishes instead of making it owner-less
343 	COMPATF2_POINTONLINE	= 1 << 3,	// Use original but buggy P_PointOnLineSide() and P_PointOnDivlineSide()
344 };
345 
346 // Emulate old bugs for select maps. These are not exposed by a cvar
347 // or mapinfo because we do not want new maps to use these bugs.
348 enum
349 {
350 	BCOMPATF_SETSLOPEOVERFLOW	= 1 << 0,	// SetSlope things can overflow
351 	BCOMPATF_RESETPLAYERSPEED	= 1 << 1,	// Set player speed to 1.0 when changing maps
352 	BCOMPATF_VILEGHOSTS			= 1 << 2,	// Monsters' radius and height aren't restored properly when resurrected.
353 	BCOMPATF_BADTELEPORTERS		= 1 << 3,	// Ignore tags on Teleport specials
354 	BCOMPATF_BADPORTALS			= 1 << 4,	// Restores the old unstable portal behavior
355 	BCOMPATF_REBUILDNODES		= 1 << 5,	// Force node rebuild
356 	BCOMPATF_LINKFROZENPROPS	= 1 << 6,	// Clearing PROP_TOTALLYFROZEN or PROP_FROZEN also clears the other
357 	BCOMPATF_NOWINDOWCHECK		= 1 << 7,	// Disable the window check in CheckForPushSpecial()
358 	BCOMPATF_FLOATBOB			= 1 << 8,	// Use Hexen's original method of preventing floatbobbing items from falling down
359 };
360 
361 // phares 3/20/98:
362 //
363 // Player friction is variable, based on controlling
364 // linedefs. More friction can create mud, sludge,
365 // magnetized floors, etc. Less friction can create ice.
366 
367 #define MORE_FRICTION_VELOCITY	15000	// mud factor based on velocity
368 #define ORIG_FRICTION			0xE800	// original value
369 #define ORIG_FRICTION_FACTOR	2048	// original value
370 #define FRICTION_LOW			0xf900
371 #define FRICTION_FLY			0xeb00
372 
373 
374 #define BLINKTHRESHOLD (4*32)
375 
376 #ifndef __BIG_ENDIAN__
377 #define MAKE_ID(a,b,c,d)	((DWORD)((a)|((b)<<8)|((c)<<16)|((d)<<24)))
378 #else
379 #define MAKE_ID(a,b,c,d)	((DWORD)((d)|((c)<<8)|((b)<<16)|((a)<<24)))
380 #endif
381 
382 #endif	// __DOOMDEF_H__
383