do not generate vertexposition/vertexmesh arrays in
[divverent/darkplaces.git] / keys.h
1 /*
2         $RCSfile$
3
4         Copyright (C) 1996-1997  Id Software, Inc.
5
6         This program is free software; you can redistribute it and/or
7         modify it under the terms of the GNU General Public License
8         as published by the Free Software Foundation; either version 2
9         of the License, or (at your option) any later version.
10
11         This program is distributed in the hope that it will be useful,
12         but WITHOUT ANY WARRANTY; without even the implied warranty of
13         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
15         See the GNU General Public License for more details.
16
17         You should have received a copy of the GNU General Public License
18         along with this program; if not, write to:
19
20                 Free Software Foundation, Inc.
21                 59 Temple Place - Suite 330
22                 Boston, MA  02111-1307, USA
23
24         $Id$
25 */
26
27 #ifndef __KEYS_H
28 #define __KEYS_H
29
30 #include "qtypes.h"
31
32 //
33 // these are the key numbers that should be passed to Key_Event
34 //
35 typedef enum keynum_e
36 {
37         K_TAB                   = 9,
38         K_ENTER                 = 13,
39         K_ESCAPE                = 27,
40         K_SPACE                 = 32,
41
42         // normal keys should be passed as lowercased ascii
43
44         K_BACKSPACE             = 127,
45         K_UPARROW,
46         K_DOWNARROW,
47         K_LEFTARROW,
48         K_RIGHTARROW,
49
50         K_ALT,
51         K_CTRL,
52         K_SHIFT,
53
54         K_F1,
55         K_F2,
56         K_F3,
57         K_F4,
58         K_F5,
59         K_F6,
60         K_F7,
61         K_F8,
62         K_F9,
63         K_F10,
64         K_F11,
65         K_F12,
66
67         K_INS,
68         K_DEL,
69         K_PGDN,
70         K_PGUP,
71         K_HOME,
72         K_END,
73
74         K_PAUSE,
75
76         K_NUMLOCK,
77         K_CAPSLOCK,
78         K_SCROLLOCK,
79
80         K_KP_0,
81         K_KP_INS = K_KP_0,
82         K_KP_1,
83         K_KP_END = K_KP_1,
84         K_KP_2,
85         K_KP_DOWNARROW = K_KP_2,
86         K_KP_3,
87         K_KP_PGDN = K_KP_3,
88         K_KP_4,
89         K_KP_LEFTARROW = K_KP_4,
90         K_KP_5,
91         K_KP_6,
92         K_KP_RIGHTARROW = K_KP_6,
93         K_KP_7,
94         K_KP_HOME = K_KP_7,
95         K_KP_8,
96         K_KP_UPARROW = K_KP_8,
97         K_KP_9,
98         K_KP_PGUP = K_KP_9,
99         K_KP_PERIOD,
100         K_KP_DEL = K_KP_PERIOD,
101         K_KP_DIVIDE,
102         K_KP_SLASH = K_KP_DIVIDE,
103         K_KP_MULTIPLY,
104         K_KP_MINUS,
105         K_KP_PLUS,
106         K_KP_ENTER,
107         K_KP_EQUALS,
108
109         K_PRINTSCREEN,
110
111         // mouse buttons generate virtual keys
112
113         K_MOUSE1 = 512,
114         K_OTHERDEVICESBEGIN = K_MOUSE1,
115         K_MOUSE2,
116         K_MOUSE3,
117         K_MWHEELUP,
118         K_MWHEELDOWN,
119         K_MOUSE4,
120         K_MOUSE5,
121         K_MOUSE6,
122         K_MOUSE7,
123         K_MOUSE8,
124         K_MOUSE9,
125         K_MOUSE10,
126         K_MOUSE11,
127         K_MOUSE12,
128         K_MOUSE13,
129         K_MOUSE14,
130         K_MOUSE15,
131         K_MOUSE16,
132
133 //
134 // joystick buttons
135 //
136         K_JOY1 = 768,
137         K_JOY2,
138         K_JOY3,
139         K_JOY4,
140         K_JOY5,
141         K_JOY6,
142         K_JOY7,
143         K_JOY8,
144         K_JOY9,
145         K_JOY10,
146         K_JOY11,
147         K_JOY12,
148         K_JOY13,
149         K_JOY14,
150         K_JOY15,
151         K_JOY16,
152
153 //
154 // aux keys are for multi-buttoned joysticks to generate so they can use
155 // the normal binding process
156 //
157         K_AUX1,
158         K_AUX2,
159         K_AUX3,
160         K_AUX4,
161         K_AUX5,
162         K_AUX6,
163         K_AUX7,
164         K_AUX8,
165         K_AUX9,
166         K_AUX10,
167         K_AUX11,
168         K_AUX12,
169         K_AUX13,
170         K_AUX14,
171         K_AUX15,
172         K_AUX16,
173         K_AUX17,
174         K_AUX18,
175         K_AUX19,
176         K_AUX20,
177         K_AUX21,
178         K_AUX22,
179         K_AUX23,
180         K_AUX24,
181         K_AUX25,
182         K_AUX26,
183         K_AUX27,
184         K_AUX28,
185         K_AUX29,
186         K_AUX30,
187         K_AUX31,
188         K_AUX32,
189
190         K_MIDINOTE0 = 896, // to this, the note number is added
191         K_MIDINOTE1,
192         K_MIDINOTE2,
193         K_MIDINOTE3,
194         K_MIDINOTE4,
195         K_MIDINOTE5,
196         K_MIDINOTE6,
197         K_MIDINOTE7,
198         K_MIDINOTE8,
199         K_MIDINOTE9,
200         K_MIDINOTE10,
201         K_MIDINOTE11,
202         K_MIDINOTE12,
203         K_MIDINOTE13,
204         K_MIDINOTE14,
205         K_MIDINOTE15,
206         K_MIDINOTE16,
207         K_MIDINOTE17,
208         K_MIDINOTE18,
209         K_MIDINOTE19,
210         K_MIDINOTE20,
211         K_MIDINOTE21,
212         K_MIDINOTE22,
213         K_MIDINOTE23,
214         K_MIDINOTE24,
215         K_MIDINOTE25,
216         K_MIDINOTE26,
217         K_MIDINOTE27,
218         K_MIDINOTE28,
219         K_MIDINOTE29,
220         K_MIDINOTE30,
221         K_MIDINOTE31,
222         K_MIDINOTE32,
223         K_MIDINOTE33,
224         K_MIDINOTE34,
225         K_MIDINOTE35,
226         K_MIDINOTE36,
227         K_MIDINOTE37,
228         K_MIDINOTE38,
229         K_MIDINOTE39,
230         K_MIDINOTE40,
231         K_MIDINOTE41,
232         K_MIDINOTE42,
233         K_MIDINOTE43,
234         K_MIDINOTE44,
235         K_MIDINOTE45,
236         K_MIDINOTE46,
237         K_MIDINOTE47,
238         K_MIDINOTE48,
239         K_MIDINOTE49,
240         K_MIDINOTE50,
241         K_MIDINOTE51,
242         K_MIDINOTE52,
243         K_MIDINOTE53,
244         K_MIDINOTE54,
245         K_MIDINOTE55,
246         K_MIDINOTE56,
247         K_MIDINOTE57,
248         K_MIDINOTE58,
249         K_MIDINOTE59,
250         K_MIDINOTE60,
251         K_MIDINOTE61,
252         K_MIDINOTE62,
253         K_MIDINOTE63,
254         K_MIDINOTE64,
255         K_MIDINOTE65,
256         K_MIDINOTE66,
257         K_MIDINOTE67,
258         K_MIDINOTE68,
259         K_MIDINOTE69,
260         K_MIDINOTE70,
261         K_MIDINOTE71,
262         K_MIDINOTE72,
263         K_MIDINOTE73,
264         K_MIDINOTE74,
265         K_MIDINOTE75,
266         K_MIDINOTE76,
267         K_MIDINOTE77,
268         K_MIDINOTE78,
269         K_MIDINOTE79,
270         K_MIDINOTE80,
271         K_MIDINOTE81,
272         K_MIDINOTE82,
273         K_MIDINOTE83,
274         K_MIDINOTE84,
275         K_MIDINOTE85,
276         K_MIDINOTE86,
277         K_MIDINOTE87,
278         K_MIDINOTE88,
279         K_MIDINOTE89,
280         K_MIDINOTE90,
281         K_MIDINOTE91,
282         K_MIDINOTE92,
283         K_MIDINOTE93,
284         K_MIDINOTE94,
285         K_MIDINOTE95,
286         K_MIDINOTE96,
287         K_MIDINOTE97,
288         K_MIDINOTE98,
289         K_MIDINOTE99,
290         K_MIDINOTE100,
291         K_MIDINOTE101,
292         K_MIDINOTE102,
293         K_MIDINOTE103,
294         K_MIDINOTE104,
295         K_MIDINOTE105,
296         K_MIDINOTE106,
297         K_MIDINOTE107,
298         K_MIDINOTE108,
299         K_MIDINOTE109,
300         K_MIDINOTE110,
301         K_MIDINOTE111,
302         K_MIDINOTE112,
303         K_MIDINOTE113,
304         K_MIDINOTE114,
305         K_MIDINOTE115,
306         K_MIDINOTE116,
307         K_MIDINOTE117,
308         K_MIDINOTE118,
309         K_MIDINOTE119,
310         K_MIDINOTE120,
311         K_MIDINOTE121,
312         K_MIDINOTE122,
313         K_MIDINOTE123,
314         K_MIDINOTE124,
315         K_MIDINOTE125,
316         K_MIDINOTE126,
317         K_MIDINOTE127,
318
319         MAX_KEYS
320 }
321 keynum_t;
322
323 typedef enum keydest_e { key_game, key_message, key_menu, key_menu_grabbed, key_console, key_void } keydest_t;
324
325 extern  char            key_line[MAX_INPUTLINE];
326 extern  int                     key_linepos;
327 extern  qboolean        key_insert;     // insert key toggle (for editing)
328 extern  keydest_t       key_dest;
329 // key_consoleactive bits
330 // user wants console (halfscreen)
331 #define KEY_CONSOLEACTIVE_USER 1
332 // console forced because there's nothing else active (fullscreen)
333 #define KEY_CONSOLEACTIVE_FORCED 4
334 extern  int                     key_consoleactive;
335 extern  char            *keybindings[MAX_BINDMAPS][MAX_KEYS];
336
337 extern void Key_ClearEditLine(int edit_line);
338 extern int chat_mode; // 0 for say, 1 for say_team, -1 for command
339 extern char chat_buffer[MAX_INPUTLINE];
340 extern unsigned int chat_bufferlen;
341
342 void Key_WriteBindings(qfile_t *f);
343 void Key_Init(void);
344 void Key_Shutdown(void);
345 void Key_Init_Cvars(void);
346 void Key_Event(int key, int ascii, qboolean down);
347 void Key_ClearStates (void);
348 void Key_EventQueue_Block(void);
349 void Key_EventQueue_Unblock(void);
350
351 qboolean Key_SetBinding (int keynum, int bindmap, const char *binding);
352 const char *Key_GetBind (int key, int bindmap);
353 void Key_FindKeysForCommand (const char *command, int *keys, int numkeys, int bindmap);
354 qboolean Key_SetBindMap(int fg, int bg);
355 void Key_GetBindMap(int *fg, int *bg);
356
357 #endif // __KEYS_H
358