]> git.lizzy.rs Git - plan9front.git/blob - sys/src/games/doom/doomdef.h
rio: disable cons if /dev/kbd is open, add games/doom
[plan9front.git] / sys / src / games / doom / doomdef.h
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__
24 #define __DOOMDEF__
25
26 #include <u.h>
27 #include <libc.h>
28 #include <stdio.h>
29 #include <thread.h>
30
31 //
32 // Global parameters/defines.
33 //
34 // DOOM version
35 enum { VERSION =  110 };
36
37
38 // Game mode handling - identify IWAD version
39 //  to handle IWAD dependend animations etc.
40 typedef enum
41 {
42   shareware,    // DOOM 1 shareware, E1, M9
43   registered,   // DOOM 1 registered, E3, M27
44   commercial,   // DOOM 2 retail, E1 M34
45   // DOOM 2 german edition not handled
46   retail,       // DOOM 1 retail, E4, M36
47   indetermined  // Well, no IWAD found.
48   
49 } GameMode_t;
50
51
52 // Mission packs - might be useful for TC stuff?
53 typedef enum
54 {
55   doom,         // DOOM 1
56   doom2,        // DOOM 2
57   pack_tnt,     // TNT mission pack
58   pack_plut,    // Plutonia pack
59   none
60
61 } GameMission_t;
62
63
64 // Identify language to use, software localization.
65 typedef enum
66 {
67   english,
68   french,
69   german,
70   unknown
71
72 } Language_t;
73
74
75 // If rangecheck is undefined,
76 // most parameter validation debugging code will not be compiled
77 #define RANGECHECK
78
79 // Do or do not use external soundserver.
80 // The sndserver binary to be run separately
81 //  has been introduced by Dave Taylor.
82 // The integrated sound support is experimental,
83 //  and unfinished. Default is synchronous.
84 // Experimental asynchronous timer based is
85 //  handled by SNDINTR. 
86 //#define SNDSERV  1
87 //#define SNDINTR  1
88
89
90 // This one switches between MIT SHM (no proper mouse)
91 // and XFree86 DGA (mickey sampling). The original
92 // linuxdoom used SHM, which is default.
93 //#define X11_DGA               1
94
95
96 //
97 // For resize of screen, at start of game.
98 // It will not work dynamically, see visplanes.
99 //
100 #define BASE_WIDTH              320
101
102 // It is educational but futile to change this
103 //  scaling e.g. to 2. Drawing of status bar,
104 //  menues etc. is tied to the scale implied
105 //  by the graphics.
106 #define SCREEN_MUL              1
107 #define INV_ASPECT_RATIO        0.625 // 0.75, ideally
108
109 // Defines suck. C sucks.
110 // C++ might sucks for OOP, but it sure is a better C.
111 // So there.
112 #define SCREENWIDTH  320
113 //SCREEN_MUL*BASE_WIDTH //320
114 #define SCREENHEIGHT 200
115 //(int)(SCREEN_MUL*BASE_WIDTH*INV_ASPECT_RATIO) //200
116
117
118
119
120 // The maximum number of players, multiplayer/networking.
121 #define MAXPLAYERS              4
122
123 // State updates, number of tics / second.
124 #define TICRATE         35
125
126 // The current state of the game: whether we are
127 // playing, gazing at the intermission screen,
128 // the game final animation, or a demo. 
129 typedef enum
130 {
131     GS_LEVEL,
132     GS_INTERMISSION,
133     GS_FINALE,
134     GS_DEMOSCREEN
135 } gamestate_t;
136
137 //
138 // Difficulty/skill settings/filters.
139 //
140
141 // Skill flags.
142 #define MTF_EASY                1
143 #define MTF_NORMAL              2
144 #define MTF_HARD                4
145
146 // Deaf monsters/do not react to sound.
147 #define MTF_AMBUSH              8
148
149 typedef enum
150 {
151     sk_baby,
152     sk_easy,
153     sk_medium,
154     sk_hard,
155     sk_nightmare
156 } skill_t;
157
158
159
160
161 //
162 // Key cards.
163 //
164 typedef enum
165 {
166     it_bluecard,
167     it_yellowcard,
168     it_redcard,
169     it_blueskull,
170     it_yellowskull,
171     it_redskull,
172     
173     NUMCARDS
174     
175 } card_t;
176
177
178
179 // The defined weapons,
180 //  including a marker indicating
181 //  user has not changed weapon.
182 typedef enum
183 {
184     wp_fist,
185     wp_pistol,
186     wp_shotgun,
187     wp_chaingun,
188     wp_missile,
189     wp_plasma,
190     wp_bfg,
191     wp_chainsaw,
192     wp_supershotgun,
193
194     NUMWEAPONS,
195     
196     // No pending weapon change.
197     wp_nochange
198
199 } weapontype_t;
200
201
202 // Ammunition types defined.
203 typedef enum
204 {
205     am_clip,    // Pistol / chaingun ammo.
206     am_shell,   // Shotgun / double barreled shotgun.
207     am_cell,    // Plasma rifle, BFG.
208     am_misl,    // Missile launcher.
209     NUMAMMO,
210     am_noammo   // Unlimited for chainsaw / fist.       
211
212 } ammotype_t;
213
214
215 // Power up artifacts.
216 typedef enum
217 {
218     pw_invulnerability,
219     pw_strength,
220     pw_invisibility,
221     pw_ironfeet,
222     pw_allmap,
223     pw_infrared,
224     NUMPOWERS
225     
226 } powertype_t;
227
228
229
230 //
231 // Power up durations,
232 //  how many seconds till expiration,
233 //  assuming TICRATE is 35 ticks/second.
234 //
235 typedef enum
236 {
237     INVULNTICS  = (30*TICRATE),
238     INVISTICS   = (60*TICRATE),
239     INFRATICS   = (120*TICRATE),
240     IRONTICS    = (60*TICRATE)
241     
242 } powerduration_t;
243
244
245
246
247 //
248 // DOOM keyboard definition.
249 // This is the stuff configured by Setup.Exe.
250 // Most key data are simple ascii (uppercased).
251 //
252 #define KEY_RIGHTARROW  0xae
253 #define KEY_LEFTARROW   0xac
254 #define KEY_UPARROW     0xad
255 #define KEY_DOWNARROW   0xaf
256 #define KEY_ESCAPE      27
257 #define KEY_ENTER       13
258 #define KEY_TAB         9
259 #define KEY_F1          (0x80+0x3b)
260 #define KEY_F2          (0x80+0x3c)
261 #define KEY_F3          (0x80+0x3d)
262 #define KEY_F4          (0x80+0x3e)
263 #define KEY_F5          (0x80+0x3f)
264 #define KEY_F6          (0x80+0x40)
265 #define KEY_F7          (0x80+0x41)
266 #define KEY_F8          (0x80+0x42)
267 #define KEY_F9          (0x80+0x43)
268 #define KEY_F10         (0x80+0x44)
269 #define KEY_F11         (0x80+0x57)
270 #define KEY_F12         (0x80+0x58)
271
272 #define KEY_BACKSPACE   127
273 #define KEY_PAUSE       0xff
274
275 #define KEY_EQUALS      0x3d
276 #define KEY_MINUS       0x2d
277
278 #define KEY_RSHIFT      (0x80+0x36)
279 #define KEY_RCTRL       (0x80+0x1d)
280 #define KEY_RALT        (0x80+0x38)
281
282 #define KEY_LALT        KEY_RALT
283
284
285
286 // DOOM basic types (boolean),
287 //  and max/min values.
288 //#include "doomtype.h"
289
290 // Fixed point.
291 //#include "m_fixed.h"
292
293 // Endianess handling.
294 //#include "m_swap.h"
295
296
297 // Binary Angles, sine/cosine/atan lookups.
298 //#include "tables.h"
299
300 // Event type.
301 //#include "d_event.h"
302
303 // Game function, skills.
304 //#include "g_game.h"
305
306 // All external data is defined here.
307 //#include "doomdata.h"
308
309 // All important printed strings.
310 // Language selection (message strings).
311 //#include "dstrings.h"
312
313 // Player is a special actor.
314 //struct player_s;
315
316
317 //#include "d_items.h"
318 //#include "d_player.h"
319 //#include "p_mobj.h"
320 //#include "d_net.h"
321
322 // PLAY
323 //#include "p_tick.h"
324
325
326
327
328 // Header, generated by sound utility.
329 // The utility was written by Dave Taylor.
330 //#include "sounds.h"
331
332
333
334
335 #endif          // __DOOMDEF__
336 //-----------------------------------------------------------------------------
337 //
338 // $Log:$
339 //
340 //-----------------------------------------------------------------------------