]> git.lizzy.rs Git - plan9front.git/blob - sys/src/games/doom/d_event.h
bring games/swar from 1ed sources.
[plan9front.git] / sys / src / games / doom / d_event.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 //
19 //    
20 //-----------------------------------------------------------------------------
21
22
23 #ifndef __D_EVENT__
24 #define __D_EVENT__
25
26
27 #include "doomtype.h"
28
29
30 //
31 // Event handling.
32 //
33
34 // Input event types.
35 typedef enum
36 {
37     ev_keydown,
38     ev_keyup,
39     ev_mouse,
40     ev_joystick,
41     ev_char,
42 } evtype_t;
43
44 // Event structure.
45 typedef struct
46 {
47     evtype_t    type;
48     int         data1;          // char / key / mouse/joystick buttons
49     int         data2;          // mouse/joystick x move
50     int         data3;          // mouse/joystick y move
51 } event_t;
52
53  
54 typedef enum
55 {
56     ga_nothing,
57     ga_loadlevel,
58     ga_newgame,
59     ga_loadgame,
60     ga_savegame,
61     ga_playdemo,
62     ga_completed,
63     ga_victory,
64     ga_worlddone,
65     ga_screenshot
66 } gameaction_t;
67
68
69
70 //
71 // Button/action code definitions.
72 //
73 typedef enum
74 {
75     // Press "Fire".
76     BT_ATTACK           = 1,
77     // Use button, to open doors, activate switches.
78     BT_USE              = 2,
79
80     // Flag: game events, not really buttons.
81     BT_SPECIAL          = 128,
82     BT_SPECIALMASK      = 3,
83     
84     // Flag, weapon change pending.
85     // If true, the next 3 bits hold weapon num.
86     BT_CHANGE           = 4,
87     // The 3bit weapon mask and shift, convenience.
88     BT_WEAPONMASK       = (8+16+32),
89     BT_WEAPONSHIFT      = 3,
90
91     // Pause the game.
92     BTS_PAUSE           = 1,
93     // Save the game at each console.
94     BTS_SAVEGAME        = 2,
95
96     // Savegame slot numbers
97     //  occupy the second byte of buttons.    
98     BTS_SAVEMASK        = (4+8+16),
99     BTS_SAVESHIFT       = 2,
100   
101 } buttoncode_t;
102
103
104
105
106 //
107 // GLOBAL VARIABLES
108 //
109 #define MAXEVENTS               64
110
111 extern  event_t         events[MAXEVENTS];
112 extern  int             eventhead;
113 extern  int             eventtail;
114
115 extern  gameaction_t    gameaction;
116
117
118 #endif
119 //-----------------------------------------------------------------------------
120 //
121 // $Log:$
122 //
123 //-----------------------------------------------------------------------------