-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathG_INPUT.H
114 lines (94 loc) · 3 KB
/
G_INPUT.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//-----------------------------------------------------------------------------
//
// g_input.h
//
//-----------------------------------------------------------------------------
#ifndef __G_INPUT__
#define __G_INPUT__
#include "d_event.h"
#include "keys.h"
#include "command.h"
#define MAXMOUSESENSITIVITY 40 // sensitivity steps
// number of total 'button' inputs, include keyboard keys, plus virtual
// keys (mousebuttons and joybuttons becomes keys)
#define NUMKEYS 256
#define MOUSEBUTTONS 3
#define MOUSE2BUTTONS 2
#define JOYBUTTONS 14 // 10 bases + 4 hat
//
// mouse and joystick buttons are handled as 'virtual' keys
//
#define KEY_MOUSE1 (NUMKEYS) // 256
#define KEY_JOY1 (KEY_MOUSE1 +MOUSEBUTTONS) // 259
#define KEY_DBLMOUSE1 (KEY_JOY1 +JOYBUTTONS) // 263 // double clicks
#define KEY_DBLJOY1 (KEY_DBLMOUSE1+MOUSEBUTTONS) // 266
#define KEY_2MOUSE1 (KEY_DBLJOY1 +JOYBUTTONS)
#define NUMINPUTS (KEY_2MOUSE1 +MOUSE2BUTTONS) // 270
enum
{
gc_null = 0, //a key/button mapped to gc_null has no effect
gc_forward,
gc_backward,
gc_strafe,
gc_straferight,
gc_strafeleft,
gc_speed,
gc_turnleft,
gc_turnright,
gc_fire,
gc_use,
gc_lookup,
gc_lookdown,
gc_centerview,
gc_mouseaiming, // mouse aiming is momentary (toggleable in the menu)
gc_weapon1,
gc_weapon2,
gc_weapon3,
gc_weapon4,
gc_weapon5,
gc_weapon6,
gc_weapon7,
gc_weapon8,
gc_talkkey,
gc_scores,
gc_jump,
gc_console,
gc_nextweapon,
gc_prevweapon,
num_gamecontrols
} gamecontrols_e;
// mouse values are used once
extern consvar_t cv_mousesens;
extern consvar_t cv_mlooksens;
extern consvar_t cv_allowjump;
extern consvar_t cv_allowautoaim;
extern int mousex;
extern int mousey;
extern int mlooky; //mousey with mlookSensitivity
extern int dclicktime;
extern int dclickstate;
extern int dclicks;
extern int dclicktime2;
extern int dclickstate2;
extern int dclicks2;
extern int joyxmove;
extern int joyymove;
// current state of the keys : true if pushed
extern byte gamekeydown[NUMINPUTS];
// two key codes (or virtual key) per game control
extern int gamecontrol[num_gamecontrols][2];
extern int gamecontrolbis[num_gamecontrols][2]; // secondary splitscreen player
// peace to my little coder fingers!
// check a gamecontrol being active or not
// remaps the input event to a game control.
void G_MapEventsToControls (event_t *ev);
// returns the name of a key
char* G_KeynumToString (int keynum);
int G_KeyStringtoNum(char *keystr);
// detach any keys associated to the given game control
void G_ClearControlKeys (int (*setupcontrols)[2], int control);
void Command_Setcontrol_f(void);
void Command_Setcontrol2_f(void);
void G_Controldefault(void);
void G_SaveKeySetting(FILE *f);
#endif