2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
4 * All source code herein is the property of Volition, Inc. You may not sell
5 * or otherwise commercially exploit the source or things you created based on
10 * $Logfile: /Freespace2/code/Io/Key.h $
15 * Include file for keyboard reading routines
18 * Revision 1.8 2002/06/09 04:41:13 relnev
19 * added copyright header
21 * Revision 1.7 2002/05/31 03:34:02 theoddone33
25 * Revision 1.6 2002/05/30 23:46:29 theoddone33
26 * some minor key changes (not necessarily fixes)
28 * Revision 1.5 2002/05/30 22:02:30 theoddone33
31 * Revision 1.4 2002/05/30 16:50:24 theoddone33
32 * Keyboard partially fixed
34 * Revision 1.3 2002/05/29 23:17:49 theoddone33
35 * Non working text code and fixed keys
37 * Revision 1.2 2002/05/29 06:25:12 theoddone33
38 * Keyboard input, mouse tracking now work
40 * Revision 1.1.1.1 2002/05/03 03:28:12 root
44 * 2 10/07/98 10:53a Dave
47 * 1 10/07/98 10:49a Dave
49 * 26 5/19/98 12:28a Mike
52 * 25 5/18/98 11:01p Mike
53 * Adding support for cheat system.
55 * 24 5/01/98 4:23p Lawrance
56 * Remap the scancode for the UK "\" key
58 * 23 1/07/98 6:41p Lawrance
59 * Pass message latency to the keyboard lib.
61 * 22 11/14/97 4:33p Mike
62 * Change Debug key to backquote (from F11).
63 * Balance a ton of subsystems in ships.tbl.
64 * Change "Heavy Laser" to "Disruptor".
66 * 21 10/21/97 7:18p Hoffoss
67 * Overhauled the key/joystick control structure and usage throughout the
68 * entire FreeSpace code. The whole system is very different now.
70 * 20 9/13/97 9:30a Lawrance
71 * added ability to block certain keys from the keyboard
73 * 19 9/10/97 6:02p Hoffoss
74 * Added code to check for key-pressed sexp operator in FreeSpace as part
75 * of training mission stuff.
77 * 18 4/15/97 3:47p Allender
78 * moved type selection of list box items into actual UI code. Made it
79 * behave more like windows listboxes do
81 * 17 2/17/97 5:18p John
82 * Added a bunch of RCS headers to a bunch of old files that don't have
101 extern int shifted_ascii_table[];
102 extern int ascii_table[];
104 extern ubyte keyd_pressed[NUM_KEYS];
106 // O/S level hooks...
108 void key_level_init();
109 void key_lost_focus();
110 void key_got_focus();
111 void key_mark( uint code, int state, uint latency );
115 // Routines/data you can access:
116 //NOT USED! extern fix key_down_time( uint code );
117 float key_down_timef( uint code );
119 int key_to_ascii(int keycode );
122 // global flag that will enable/disable the backspace key from stopping execution
123 //extern int Backspace_debug;
125 uint key_get_shift_status();
126 int key_down_count(int scancode);
127 int key_up_count(int scancode);
129 int key_check(int key);
131 // Put "key" back in the input buffer.
132 void key_outkey(int key);
134 // used to restrict keys that are read into keyboard buffer
135 void key_set_filter(int *filter_array, int num);
136 void key_clear_filter();
138 extern int Cheats_enabled;
139 extern int Key_normal_game;
141 #define KEY_SHIFTED 0x1000
142 #define KEY_ALTED 0x2000
143 #define KEY_CTRLED 0x4000
144 #define KEY_DEBUGGED 0x8000
145 #define KEY_DEBUGGED1 0x0800 // Cheat bit in release version of game.
146 #define KEY_MASK 0x00FF
148 #define KEY_DEBUG_KEY 0x29 // KEY_LAPOSTRO (shifted = tilde, near upper-left of keyboard)
188 #define KEY_MINUS 0x0C
189 #define KEY_EQUAL 0x0D
190 #define KEY_DIVIDE 0x35
191 #define KEY_SLASH 0x2B
192 #define KEY_SLASH_UK 0x56
193 #define KEY_COMMA 0x33
194 #define KEY_PERIOD 0x34
195 #define KEY_SEMICOL 0x27
197 #define KEY_LBRACKET 0x1A
198 #define KEY_RBRACKET 0x1B
200 #define KEY_RAPOSTRO 0x28
201 #define KEY_LAPOSTRO 0x29
204 #define KEY_ENTER 0x1C
205 #define KEY_BACKSP 0x0E
207 #define KEY_SPACEBAR 0x39
209 #define KEY_NUMLOCK 0x45
210 #define KEY_SCROLLOCK 0x46
211 #define KEY_CAPSLOCK 0x3A
213 #define KEY_LSHIFT 0x2A
214 #define KEY_RSHIFT 0x36
216 #define KEY_LALT 0x38
217 #define KEY_RALT 0xB8
219 #define KEY_LCTRL 0x1D
220 #define KEY_RCTRL 0x9D
235 #define KEY_PAD0 0x52
236 #define KEY_PAD1 0x4F
237 #define KEY_PAD2 0x50
238 #define KEY_PAD3 0x51
239 #define KEY_PAD4 0x4B
240 #define KEY_PAD5 0x4C
241 #define KEY_PAD6 0x4D
242 #define KEY_PAD7 0x47
243 #define KEY_PAD8 0x48
244 #define KEY_PAD9 0x49
245 #define KEY_PADMINUS 0x4A
246 #define KEY_PADPLUS 0x4E
247 #define KEY_PADPERIOD 0x53
248 #define KEY_PADDIVIDE 0xB5
249 #define KEY_PADMULTIPLY 0x37
250 #define KEY_PADENTER 0x9C
252 #define KEY_INSERT 0xD2
253 #define KEY_HOME 0xC7
254 #define KEY_PAGEUP 0xC9
255 #define KEY_DELETE 0xd3
257 #define KEY_PAGEDOWN 0xD1
259 #define KEY_DOWN 0xD0
260 #define KEY_LEFT 0xCB
261 #define KEY_RIGHT 0xCD
263 #define KEY_PRINT_SCRN 0xB7
264 #define KEY_PAUSE 0x45 //DOS: 0x61
265 #define KEY_BREAK 0xc6