2 * $Logfile: /Freespace2/code/Io/Key.h $
7 * Include file for keyboard reading routines
10 * Revision 1.4 2002/05/30 16:50:24 theoddone33
11 * Keyboard partially fixed
13 * Revision 1.3 2002/05/29 23:17:49 theoddone33
14 * Non working text code and fixed keys
16 * Revision 1.2 2002/05/29 06:25:12 theoddone33
17 * Keyboard input, mouse tracking now work
19 * Revision 1.1.1.1 2002/05/03 03:28:12 root
23 * 2 10/07/98 10:53a Dave
26 * 1 10/07/98 10:49a Dave
28 * 26 5/19/98 12:28a Mike
31 * 25 5/18/98 11:01p Mike
32 * Adding support for cheat system.
34 * 24 5/01/98 4:23p Lawrance
35 * Remap the scancode for the UK "\" key
37 * 23 1/07/98 6:41p Lawrance
38 * Pass message latency to the keyboard lib.
40 * 22 11/14/97 4:33p Mike
41 * Change Debug key to backquote (from F11).
42 * Balance a ton of subsystems in ships.tbl.
43 * Change "Heavy Laser" to "Disruptor".
45 * 21 10/21/97 7:18p Hoffoss
46 * Overhauled the key/joystick control structure and usage throughout the
47 * entire FreeSpace code. The whole system is very different now.
49 * 20 9/13/97 9:30a Lawrance
50 * added ability to block certain keys from the keyboard
52 * 19 9/10/97 6:02p Hoffoss
53 * Added code to check for key-pressed sexp operator in FreeSpace as part
54 * of training mission stuff.
56 * 18 4/15/97 3:47p Allender
57 * moved type selection of list box items into actual UI code. Made it
58 * behave more like windows listboxes do
60 * 17 2/17/97 5:18p John
61 * Added a bunch of RCS headers to a bunch of old files that don't have
81 #define NUM_KEYS SDLK_LAST
84 extern int shifted_ascii_table[];
85 extern int ascii_table[];
87 extern ubyte keyd_pressed[NUM_KEYS];
91 void key_level_init();
92 void key_lost_focus();
94 void key_mark( uint code, int state, uint latency );
98 // Routines/data you can access:
99 //NOT USED! extern fix key_down_time( uint code );
100 float key_down_timef( uint code );
102 int key_to_ascii(int keycode );
105 // global flag that will enable/disable the backspace key from stopping execution
106 //extern int Backspace_debug;
108 uint key_get_shift_status();
109 int key_down_count(int scancode);
110 int key_up_count(int scancode);
112 int key_check(int key);
114 // Put "key" back in the input buffer.
115 void key_outkey(int key);
117 // used to restrict keys that are read into keyboard buffer
118 void key_set_filter(int *filter_array, int num);
119 void key_clear_filter();
121 extern int Cheats_enabled;
122 extern int Key_normal_game;
125 #define KEY_SHIFTED 0x30000 //(KMOD_SHIFT)<<16;
126 #define KEY_ALTED 0x3000000 //(KMOD_ALT)<<16;
127 #define KEY_CTRLED 0xc00000 //(KMOD_CTRL)<<16;
128 #define KEY_DEBUGGED 0x010000 // Dummy
129 #define KEY_DEBUGGED1 0x2000000 // Dummy
130 #define KEY_MASK 0xffff
132 #define KEY_DEBUG_KEY 0x29 // KEY_LAPOSTRO (shifted = tilde, near upper-left of keyboard)
172 #define KEY_MINUS SDLK_MINUS
173 #define KEY_EQUAL SDLK_EQUALS
174 #define KEY_DIVIDE SDLK_SLASH
175 #define KEY_SLASH SDLK_SLASH
176 #define KEY_SLASH_UK SDLK_SLASH
177 #define KEY_COMMA SDLK_COMMA
178 #define KEY_PERIOD SDLK_PERIOD
179 #define KEY_SEMICOL SDLK_SEMICOLON
181 #define KEY_LBRACKET SDLK_LEFTBRACKET
182 #define KEY_RBRACKET SDLK_RIGHTBRACKET
184 #define KEY_RAPOSTRO SDLK_BACKQUOTE
185 #define KEY_LAPOSTRO SDLK_QUOTE
187 #define KEY_ESC SDLK_ESCAPE
188 #define KEY_ENTER SDLK_RETURN
189 #define KEY_BACKSP SDLK_BACKSPACE
190 #define KEY_TAB SDLK_TAB
191 #define KEY_SPACEBAR SDLK_SPACE
193 #define KEY_NUMLOCK SDLK_NUMLOCK
194 #define KEY_SCROLLOCK SDLK_SCROLLOCK
195 #define KEY_CAPSLOCK SDLK_CAPSLOCK
197 #define KEY_LSHIFT SDLK_LSHIFT
198 #define KEY_RSHIFT SDLK_RSHIFT
200 #define KEY_LALT SDLK_LALT
201 #define KEY_RALT SDLK_RALT
203 #define KEY_LCTRL SDLK_LCTRL
204 #define KEY_RCTRL SDLK_RCTRL
206 #define KEY_F1 SDLK_F1
207 #define KEY_F2 SDLK_F2
208 #define KEY_F3 SDLK_F3
209 #define KEY_F4 SDLK_F4
210 #define KEY_F5 SDLK_F5
211 #define KEY_F6 SDLK_F6
212 #define KEY_F7 SDLK_F7
213 #define KEY_F8 SDLK_F8
214 #define KEY_F9 SDLK_F9
215 #define KEY_F10 SDLK_F10
216 #define KEY_F11 SDLK_F11
217 #define KEY_F12 SDLK_F12
219 #define KEY_PAD0 SDLK_KP0
220 #define KEY_PAD1 SDLK_KP1
221 #define KEY_PAD2 SDLK_KP2
222 #define KEY_PAD3 SDLK_KP3
223 #define KEY_PAD4 SDLK_KP4
224 #define KEY_PAD5 SDLK_KP5
225 #define KEY_PAD6 SDLK_KP6
226 #define KEY_PAD7 SDLK_KP7
227 #define KEY_PAD8 SDLK_KP8
228 #define KEY_PAD9 SDLK_KP9
229 #define KEY_PADMINUS SDLK_KP_MINUS
230 #define KEY_PADPLUS SDLK_KP_PLUS
231 #define KEY_PADPERIOD SDLK_KP_PERIOD
232 #define KEY_PADDIVIDE SDLK_KP_DIVIDE
233 #define KEY_PADMULTIPLY SDLK_KP_MULTIPLY
234 #define KEY_PADENTER SDLK_KP_ENTER
236 #define KEY_INSERT SDLK_INSERT
237 #define KEY_HOME SDLK_HOME
238 #define KEY_PAGEUP SDLK_PAGEUP
239 #define KEY_DELETE SDLK_DELETE
240 #define KEY_END SDLK_END
241 #define KEY_PAGEDOWN SDLK_PAGEDOWN
242 #define KEY_UP SDLK_UP
243 #define KEY_DOWN SDLK_DOWN
244 #define KEY_LEFT SDLK_LEFT
245 #define KEY_RIGHT SDLK_RIGHT
247 #define KEY_PRINT_SCRN SDLK_PRINT
248 #define KEY_PAUSE SDLK_PAUSE
249 #define KEY_BREAK SDLK_BREAK
251 #define KEY_SHIFTED 0x1000
252 #define KEY_ALTED 0x2000
253 #define KEY_CTRLED 0x4000
254 #define KEY_DEBUGGED 0x8000
255 #define KEY_DEBUGGED1 0x0800 // Cheat bit in release version of game.
256 #define KEY_MASK 0x00FF
258 #define KEY_DEBUG_KEY 0x29 // KEY_LAPOSTRO (shifted = tilde, near upper-left of keyboard)
298 #define KEY_MINUS 0x0C
299 #define KEY_EQUAL 0x0D
300 #define KEY_DIVIDE 0x35
301 #define KEY_SLASH 0x2B
302 #define KEY_SLASH_UK 0x56
303 #define KEY_COMMA 0x33
304 #define KEY_PERIOD 0x34
305 #define KEY_SEMICOL 0x27
307 #define KEY_LBRACKET 0x1A
308 #define KEY_RBRACKET 0x1B
310 #define KEY_RAPOSTRO 0x28
311 #define KEY_LAPOSTRO 0x29
314 #define KEY_ENTER 0x1C
315 #define KEY_BACKSP 0x0E
317 #define KEY_SPACEBAR 0x39
319 #define KEY_NUMLOCK 0x45
320 #define KEY_SCROLLOCK 0x46
321 #define KEY_CAPSLOCK 0x3A
323 #define KEY_LSHIFT 0x2A
324 #define KEY_RSHIFT 0x36
326 #define KEY_LALT 0x38
327 #define KEY_RALT 0xB8
329 #define KEY_LCTRL 0x1D
330 #define KEY_RCTRL 0x9D
345 #define KEY_PAD0 0x52
346 #define KEY_PAD1 0x4F
347 #define KEY_PAD2 0x50
348 #define KEY_PAD3 0x51
349 #define KEY_PAD4 0x4B
350 #define KEY_PAD5 0x4C
351 #define KEY_PAD6 0x4D
352 #define KEY_PAD7 0x47
353 #define KEY_PAD8 0x48
354 #define KEY_PAD9 0x49
355 #define KEY_PADMINUS 0x4A
356 #define KEY_PADPLUS 0x4E
357 #define KEY_PADPERIOD 0x53
358 #define KEY_PADDIVIDE 0xB5
359 #define KEY_PADMULTIPLY 0x37
360 #define KEY_PADENTER 0x9C
362 #define KEY_INSERT 0xD2
363 #define KEY_HOME 0xC7
364 #define KEY_PAGEUP 0xC9
365 #define KEY_DELETE 0xd3
367 #define KEY_PAGEDOWN 0xD1
369 #define KEY_DOWN 0xD0
370 #define KEY_LEFT 0xCB
371 #define KEY_RIGHT 0xCD
373 #define KEY_PRINT_SCRN 0xB7
374 #define KEY_PAUSE 0x45 //DOS: 0x61
375 #define KEY_BREAK 0xc6