XenevaOS
Loading...
Searching...
No Matches
XenevaOS
Process
Doomgeneric
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.
32
typedef
enum
33
{
34
ev_keydown
,
35
ev_keyup
,
36
ev_mouse
,
37
ev_joystick
,
38
ev_quit
39
}
evtype_t
;
40
41
// Event structure.
42
typedef
struct
43
{
44
evtype_t
type
;
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
//
74
typedef
enum
75
{
76
// Press "Fire".
77
BT_ATTACK
= 1,
78
// Use button, to open doors, activate switches.
79
BT_USE
= 2,
80
81
// Flag: game events, not really buttons.
82
BT_SPECIAL
= 128,
83
BT_SPECIALMASK
= 3,
84
85
// Flag, weapon change pending.
86
// If true, the next 3 bits hold weapon num.
87
BT_CHANGE
= 4,
88
// The 3bit weapon mask and shift, convenience.
89
BT_WEAPONMASK
= (8+16+32),
90
BT_WEAPONSHIFT
= 3,
91
92
// Pause the game.
93
BTS_PAUSE
= 1,
94
// Save the game at each console.
95
BTS_SAVEGAME
= 2,
96
97
// Savegame slot numbers
98
// occupy the second byte of buttons.
99
BTS_SAVEMASK
= (4+8+16),
100
BTS_SAVESHIFT
= 2,
101
102
}
buttoncode_t
;
103
104
// villsa [STRIFE] Strife specific buttons
105
// TODO - not finished
106
typedef
enum
107
{
108
// Player view look up
109
BT2_LOOKUP
= 1,
110
// Player view look down
111
BT2_LOOKDOWN
= 2,
112
// Center player's view
113
BT2_CENTERVIEW
= 4,
114
// Use inventory item
115
BT2_INVUSE
= 8,
116
// Drop inventory item
117
BT2_INVDROP
= 16,
118
// Jump up and down
119
BT2_JUMP
= 32,
120
// Use medkit
121
BT2_HEALTH
= 128,
122
123
}
buttoncode2_t
;
124
125
126
127
128
// Called by IO functions when input is detected.
129
void
D_PostEvent
(
event_t
*ev);
130
131
// Read an event from the event queue
132
133
event_t
*
D_PopEvent
(
void
);
134
135
136
#endif
137
evtype_t
evtype_t
Definition
d_event.h:33
ev_joystick
@ ev_joystick
Definition
d_event.h:37
ev_mouse
@ ev_mouse
Definition
d_event.h:36
ev_keyup
@ ev_keyup
Definition
d_event.h:35
ev_quit
@ ev_quit
Definition
d_event.h:38
ev_keydown
@ ev_keydown
Definition
d_event.h:34
buttoncode_t
buttoncode_t
Definition
d_event.h:75
BT_SPECIAL
@ BT_SPECIAL
Definition
d_event.h:82
BT_SPECIALMASK
@ BT_SPECIALMASK
Definition
d_event.h:83
BTS_SAVEMASK
@ BTS_SAVEMASK
Definition
d_event.h:99
BT_ATTACK
@ BT_ATTACK
Definition
d_event.h:77
BT_WEAPONSHIFT
@ BT_WEAPONSHIFT
Definition
d_event.h:90
BT_USE
@ BT_USE
Definition
d_event.h:79
BTS_SAVEGAME
@ BTS_SAVEGAME
Definition
d_event.h:95
BT_CHANGE
@ BT_CHANGE
Definition
d_event.h:87
BTS_PAUSE
@ BTS_PAUSE
Definition
d_event.h:93
BT_WEAPONMASK
@ BT_WEAPONMASK
Definition
d_event.h:89
BTS_SAVESHIFT
@ BTS_SAVESHIFT
Definition
d_event.h:100
D_PostEvent
void D_PostEvent(event_t *ev)
Definition
d_event.c:35
D_PopEvent
event_t * D_PopEvent(void)
Definition
d_event.c:43
buttoncode2_t
buttoncode2_t
Definition
d_event.h:107
BT2_LOOKDOWN
@ BT2_LOOKDOWN
Definition
d_event.h:111
BT2_LOOKUP
@ BT2_LOOKUP
Definition
d_event.h:109
BT2_INVDROP
@ BT2_INVDROP
Definition
d_event.h:117
BT2_CENTERVIEW
@ BT2_CENTERVIEW
Definition
d_event.h:113
BT2_INVUSE
@ BT2_INVUSE
Definition
d_event.h:115
BT2_JUMP
@ BT2_JUMP
Definition
d_event.h:119
BT2_HEALTH
@ BT2_HEALTH
Definition
d_event.h:121
doomtype.h
event_t
Definition
d_event.h:43
event_t::data1
int data1
Definition
d_event.h:67
event_t::type
evtype_t type
Definition
d_event.h:44
Generated by
1.9.8