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_H__
24 #define __D_EVENT_H__
25 
26 
27 #include "basictypes.h"
28 
29 
30 //
31 // Event handling.
32 //
33 
34 // Input event types.
35 enum EGenericEvent
36 {
37 	EV_None,
38 	EV_KeyDown,		// data1: scan code, data2: Qwerty ASCII code
39 	EV_KeyUp,		// same
40 	EV_Mouse,		// x, y: mouse movement deltas
41 	EV_GUI_Event,	// subtype specifies actual event
42 	EV_DeviceChange,// a device has been connected or removed
43 };
44 
45 // Event structure.
46 struct event_t
47 {
48 	BYTE		type;
49 	BYTE		subtype;
50 	SWORD 		data1;		// keys / mouse/joystick buttons
51 	SWORD		data2;
52 	SWORD		data3;
53 	int 		x;			// mouse/joystick x move
54 	int 		y;			// mouse/joystick y move
55 };
56 
57 
58 typedef enum
59 {
60 	ga_nothing,
61 	ga_loadlevel,
62 	ga_newgame,
63 	ga_newgame2,
64 	ga_recordgame,
65 	ga_loadgame,
66 	ga_loadgamehidecon,
67 	ga_loadgameplaydemo,
68 	ga_autoloadgame,
69 	ga_savegame,
70 	ga_autosave,
71 	ga_playdemo,
72 	ga_completed,
73 	ga_slideshow,
74 	ga_worlddone,
75 	ga_screenshot,
76 	ga_togglemap,
77 	ga_fullconsole,
78 } gameaction_t;
79 
80 
81 
82 //
83 // Button/action code definitions.
84 // The net code supports up to 29 buttons, so don't make this longer than that.
85 //
86 typedef enum
87 {
88 	BT_ATTACK		= 1<<0,	// Press "Fire".
89 	BT_USE			= 1<<1,	// Use button, to open doors, activate switches.
90     BT_JUMP			= 1<<2,
91     BT_CROUCH		= 1<<3,
92 	BT_TURN180		= 1<<4,
93 	BT_ALTATTACK	= 1<<5,	// Press your other "Fire".
94 	BT_RELOAD		= 1<<6,	// [XA] Reload key. Causes state jump in A_WeaponReady.
95 	BT_ZOOM			= 1<<7,	// [XA] Zoom key. Ditto.
96 
97 	// The rest are all ignored by the play simulation and are for scripts.
98 	BT_SPEED		= 1<<8,
99 	BT_STRAFE		= 1<<9,
100 
101 	BT_MOVERIGHT	= 1<<10,
102 	BT_MOVELEFT		= 1<<11,
103 	BT_BACK			= 1<<12,
104 	BT_FORWARD		= 1<<13,
105 	BT_RIGHT		= 1<<14,
106 	BT_LEFT			= 1<<15,
107 	BT_LOOKUP		= 1<<16,
108 	BT_LOOKDOWN		= 1<<17,
109 	BT_MOVEUP		= 1<<18,
110 	BT_MOVEDOWN		= 1<<19,
111 	BT_SHOWSCORES	= 1<<20,
112 
113 	BT_USER1		= 1<<21,
114 	BT_USER2		= 1<<22,
115 	BT_USER3		= 1<<23,
116 	BT_USER4		= 1<<24,
117 } buttoncode_t;
118 
119 // Called by IO functions when input is detected.
120 void D_PostEvent (const event_t* ev);
121 void D_RemoveNextCharEvent();
122 
123 
124 //
125 // GLOBAL VARIABLES
126 //
127 #define MAXEVENTS		128
128 
129 extern	event_t 		events[MAXEVENTS];
130 extern	int 			eventhead;
131 extern	int 			eventtail;
132 
133 extern	gameaction_t	gameaction;
134 
135 
136 #endif
137