XenevaOS
Loading...
Searching...
No Matches
d_event.h
Go to the documentation of this file.
1//
2// Copyright(C) 1993-1996 Id Software, Inc.
3// Copyright(C) 2005-2014 Simon Howard
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// DESCRIPTION:
16//
17//
18
19
20#ifndef __D_EVENT__
21#define __D_EVENT__
22
23
24#include "doomtype.h"
25
26
27//
28// Event handling.
29//
30
31// Input event types.
40
41// Event structure.
42typedef struct
43{
45
46 // Event-related data that depends on the type of event:
47 //
48 // ev_keydown/ev_keyup:
49 // data1: Key code (from doomkeys.h) of the key that was
50 // pressed or released.
51 // data2: Ascii text of the character that was pressed,
52 // shifted appropriately (eg. '$' if 4 was pressed
53 // while shift was held).
54 //
55 // ev_mouse:
56 // data1: Bitfield of buttons currently held down.
57 // (bit 0 = left; bit 1 = right; bit 2 = middle).
58 // data2: X axis mouse movement (turn).
59 // data3: Y axis mouse movement (forward/backward).
60 //
61 // ev_joystick:
62 // data1: Bitfield of buttons currently pressed.
63 // data2: X axis mouse movement (turn).
64 // data3: Y axis mouse movement (forward/backward).
65 // data4: Third axis mouse movement (strafe).
66
67 int data1, data2, data3, data4;
68} event_t;
69
70
71//
72// Button/action code definitions.
73//
74typedef enum
75{
76 // Press "Fire".
78 // Use button, to open doors, activate switches.
79 BT_USE = 2,
80
81 // Flag: game events, not really buttons.
84
85 // Flag, weapon change pending.
86 // If true, the next 3 bits hold weapon num.
88 // The 3bit weapon mask and shift, convenience.
89 BT_WEAPONMASK = (8+16+32),
91
92 // Pause the game.
94 // Save the game at each console.
96
97 // Savegame slot numbers
98 // occupy the second byte of buttons.
99 BTS_SAVEMASK = (4+8+16),
101
103
104// villsa [STRIFE] Strife specific buttons
105// TODO - not finished
106typedef enum
107{
108 // Player view look up
110 // Player view look down
112 // Center player's view
114 // Use inventory item
116 // Drop inventory item
118 // Jump up and down
120 // Use medkit
122
124
125
126
127
128// Called by IO functions when input is detected.
129void D_PostEvent (event_t *ev);
130
131// Read an event from the event queue
132
133event_t *D_PopEvent(void);
134
135
136#endif
137
evtype_t
Definition d_event.h:33
@ ev_joystick
Definition d_event.h:37
@ ev_mouse
Definition d_event.h:36
@ ev_keyup
Definition d_event.h:35
@ ev_quit
Definition d_event.h:38
@ ev_keydown
Definition d_event.h:34
buttoncode_t
Definition d_event.h:75
@ BT_SPECIAL
Definition d_event.h:82
@ BT_SPECIALMASK
Definition d_event.h:83
@ BTS_SAVEMASK
Definition d_event.h:99
@ BT_ATTACK
Definition d_event.h:77
@ BT_WEAPONSHIFT
Definition d_event.h:90
@ BT_USE
Definition d_event.h:79
@ BTS_SAVEGAME
Definition d_event.h:95
@ BT_CHANGE
Definition d_event.h:87
@ BTS_PAUSE
Definition d_event.h:93
@ BT_WEAPONMASK
Definition d_event.h:89
@ BTS_SAVESHIFT
Definition d_event.h:100
void D_PostEvent(event_t *ev)
Definition d_event.c:35
event_t * D_PopEvent(void)
Definition d_event.c:43
buttoncode2_t
Definition d_event.h:107
@ BT2_LOOKDOWN
Definition d_event.h:111
@ BT2_LOOKUP
Definition d_event.h:109
@ BT2_INVDROP
Definition d_event.h:117
@ BT2_CENTERVIEW
Definition d_event.h:113
@ BT2_INVUSE
Definition d_event.h:115
@ BT2_JUMP
Definition d_event.h:119
@ BT2_HEALTH
Definition d_event.h:121
Definition d_event.h:43
int data1
Definition d_event.h:67
evtype_t type
Definition d_event.h:44