]> icculus.org git repositories - taylor/freespace2.git/blob - src/controlconfig/controlsconfigcommon.cpp
fix memory leak and properly initialize some structs
[taylor/freespace2.git] / src / controlconfig / controlsconfigcommon.cpp
1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
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
6  * the source.
7  */
8
9 /*
10  * $Logfile: /Freespace2/code/ControlConfig/ControlsConfigCommon.cpp $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * C module for keyboard, joystick and mouse configuration common stuff (between Fred and FreeSpace)
16  *
17  * $Log$
18  * Revision 1.5  2003/06/03 04:00:39  taylor
19  * Polish language support (Janusz Dziemidowicz)
20  *
21  * Revision 1.4  2003/05/25 02:30:42  taylor
22  * Freespace 1 support
23  *
24  * Revision 1.3  2002/06/09 04:41:15  relnev
25  * added copyright header
26  *
27  * Revision 1.2  2002/05/07 03:16:43  theoddone33
28  * The Great Newline Fix
29  *
30  * Revision 1.1.1.1  2002/05/03 03:28:08  root
31  * Initial import.
32  *
33  * 
34  * 14    11/01/99 3:36p Jefff
35  * had scan code texts for y and z in german swapped
36  * 
37  * 13    11/01/99 2:16p Jefff
38  * minor key name change in german
39  * 
40  * 12    10/29/99 6:10p Jefff
41  * squashed the damned y/z german issues once and for all
42  * 
43  * 11    10/28/99 11:16p Jefff
44  * Changed some german key names.  Made key translations always use the
45  * english table.
46  * 
47  * 10    10/28/99 2:05a Jefff
48  * revised some german key names.  changed some y/z switch stuff.
49  * 
50  * 9     10/25/99 5:39p Jefff
51  * swap init binding for y and z keys in German builds
52  * 
53  * 8     9/01/99 2:56p Jefff
54  * a few control key description changes
55  * 
56  * 7     8/22/99 5:53p Dave
57  * Scoring fixes. Added self destruct key. Put callsigns in the logfile
58  * instead of ship designations for multiplayer players.
59  * 
60  * 6     8/19/99 10:59a Dave
61  * Packet loss detection.
62  * 
63  * 5     8/01/99 12:39p Dave
64  * Added HUD contrast control key (for nebula).
65  * 
66  * 4     7/23/99 2:57p Andsager
67  * fix translate_key_to_index to work with localization
68  * 
69  * 3     11/05/98 4:18p Dave
70  * First run nebula support. Beefed up localization a bit. Removed all
71  * conditional compiles for foreign versions. Modified mission file
72  * format.
73  * 
74  * 2     10/07/98 10:52a Dave
75  * Initial checkin.
76  * 
77  * 1     10/07/98 10:48a Dave
78  * 
79  * 41    6/19/98 3:51p Lawrance
80  * localize control text
81  * 
82  * 40    6/17/98 11:05a Lawrance
83  * localize the control config strings
84  * 
85  * 39    5/24/98 2:28p Hoffoss
86  * Because we never really care about if the left or the right shift or
87  * alt key was used, but rather than either shift or alt was used, made
88  * both map to the left one.  Solves some problems, causes none.
89  * 
90  * 38    5/22/98 11:21a Hoffoss
91  * Added bank when pressed back in.
92  * 
93  * 37    5/15/98 8:37p Lawrance
94  * Add 'equalize recharge rates' and 'target ship that sent last
95  * transmission' key bindings
96  * 
97  * 36    5/13/98 7:15p Hoffoss
98  * Fixed remaining bugs with axis binding.
99  * 
100  * 35    5/13/98 1:17a Hoffoss
101  * Added joystick axes configurability.
102  * 
103  * 34    5/12/98 11:25a Hoffoss
104  * Disabled bank when pressed action.
105  * 
106  * 33    5/09/98 10:48p Lawrance
107  * change text for view bindings
108  * 
109  * 32    5/09/98 4:52p Lawrance
110  * Implement padlock view (up/rear/left/right)
111  * 
112  * 31    4/30/98 9:43p Hoffoss
113  * Added new actions for free look movement which are default bounded to
114  * the hat.
115  * 
116  * 30    4/25/98 1:25p Lawrance
117  * Add time compression keys to key config
118  * 
119  * 29    4/25/98 12:43p Allender
120  * added new shortcut key for attack my subsystem
121  * 
122  * 28    4/18/98 5:00p Dave
123  * Put in observer zoom key. Made mission sync screen more informative.
124  * 
125  * 27    4/17/98 1:24a Lawrance
126  * fix spelling error
127  * 
128  * 26    4/15/98 11:06a Lawrance
129  * fix bug with a multi key showing up in demo, remove obsolete bindings
130  * from demo and full version
131  * 
132  * 25    4/10/98 12:47p Allender
133  * changed working on replay popup.  Don't reference repair in comm menu.
134  * Added Shift-R for repair me
135  * 
136  * 24    4/08/98 11:11a Hoffoss
137  * Fixed some bugs that showed up due to fixing other bugs the other day
138  * with controls.
139  * 
140  * 23    4/07/98 4:06p Lawrance
141  * Change binding next for bomb targeting
142  * 
143  * 22    4/07/98 1:52p Lawrance
144  * fix error in binding text for energy keys 
145  * 
146  * 21    4/06/98 11:17a Hoffoss
147  * Fixed num lock/pause interplay bug.
148  * 
149  * 20    4/01/98 6:46p Lawrance
150  * change text for Alt+J
151  * 
152  * 19    3/31/98 4:15p Hoffoss
153  * Disabled the show objectives action.
154  * 
155  * 18    3/25/98 2:16p Dave
156  * Select random default image for newly created pilots. Fixed several
157  * multi-pause messaging bugs. Begin work on online help for multiplayer
158  * keys.
159  * 
160  * 17    3/19/98 5:04p Dave
161  * Put in support for targeted multiplayer text and voice messaging (all,
162  * friendly, hostile, individual).
163  * 
164  * 16    3/17/98 11:25a Hoffoss
165  * Fixed some of the action's names.
166  * 
167  * 15    3/17/98 10:48a Hoffoss
168  * Allowed a special hack for "bank while pressed" action to use alt and
169  * shift keys standalone.
170  * 
171  * 14    2/28/98 9:47p Lawrance
172  * change some binding text
173  * 
174  * 13    2/28/98 7:02p Lawrance
175  * overhaul on-line help
176  * 
177  * 12    2/26/98 12:33a Lawrance
178  * Added back slew mode,  lots of changes to external and chase views.
179  * 
180  * 11    2/23/98 11:25a Sandeep
181  * added default keys
182  * 
183  * 10    2/22/98 6:27p Lawrance
184  * External mode takes precedence over chase mode.  Fix bug with repair
185  * ships docking in chase mode.
186  * 
187  * 9     2/22/98 12:19p John
188  * Externalized some strings
189  * 
190  * 8     2/02/98 6:59p Lawrance
191  * Adding new targeting keys (bomb, uninspected cargo, new ship, live
192  * turrets).
193  * 
194  * 7     1/27/98 4:24p Allender
195  * moved hotkey selection to F3 instead of X.  Made palette flash
196  * disappear in multiplayer pause menu
197  * 
198  * 6     1/22/98 4:53p Hoffoss
199  * Made training messages/directives display a joystick button in place of
200  * a keypress if there is no keypress bound to the action.
201  * 
202  * 5     1/22/98 4:15p Hoffoss
203  * Added code to allow popup to tell player he needs to bind a key for the
204  * training mission.
205  * 
206  * 4     1/02/98 4:42p Allender
207  * removed unused key bindings from control config list
208  * 
209  * 3     12/30/97 4:47p Allender
210  * work with ignore my target command.  Added new keyboard hotkey.  Made
211  * it work globally
212  * 
213  * 2     12/24/97 3:37p Hoffoss
214  * Moved control config stuff to seperate library to Fred can access it as
215  * well.
216  * 
217  * 1     12/24/97 3:27p Hoffoss
218  * 
219  * 1     12/24/97 11:58a Hoffoss
220  * 
221  * 98    12/22/97 2:15p Hoffoss
222  * Fixed bug where joystick axis lines weren't being displayed.
223  * 
224  * 97    12/16/97 2:44p Hoffoss
225  * Added clear button to control config screen.
226  * 
227  * 96    12/12/97 3:07p Hoffoss
228  * Changed how deleting bindings work.  Each control of an action can be
229  * deleted independently or both at once.
230  * 
231  * 95    12/07/97 2:36p John
232  * Made warp out be Alt+J instead of J
233  * 
234  * 94    12/03/97 4:59p Hoffoss
235  * Added reset sound and change control config sounds around.
236  * 
237  * 93    12/03/97 4:16p Hoffoss
238  * Changed sound stuff used in interface screens for interface purposes.
239  * 
240  * 92    12/01/97 5:25p Hoffoss
241  * Routed interface sound playing through a special function that will
242  * only allow one instance of the sound to play at a time, avoiding
243  * over-mixing problems.
244  * 
245  * 91    12/01/97 3:38p Hoffoss
246  * Changed placement of 'More' indicator.
247  * 
248  * 90    11/25/97 3:49p Hoffoss
249  * Changed subhilighting to happen when mouse is over line, rather than
250  * mouse button down but not up again yet.
251  * 
252  * 89    11/24/97 10:20p Lawrance
253  * Add key 'SDLK_n' to target next ship on monitoring view
254  * 
255  * 88    11/24/97 6:15p Lawrance
256  * fix button scroll problem
257  * 
258  * 87    11/23/97 6:15p Hoffoss
259  * Make exiting the controls config screen save the pilot, so changes keep
260  * even if programs crashes or something.
261  * 
262  * 86    11/21/97 5:57p Hoffoss
263  * Fixed bug where timef type controls weren't checking joystick buttons.
264  * 
265  * 85    11/21/97 4:06p Hoffoss
266  * Fixed bug with enabling of axis are reversed.
267  * 
268  * 84    11/20/97 4:47p Hoffoss
269  * Swapped throttle and rudder, which apparently were backwards.
270  * 
271  * 83    11/20/97 4:00p Lawrance
272  * set z to a valid value
273  * 
274  * 82    11/20/97 3:52p Hoffoss
275  * Made "None" appear if no control is bound to function.
276  * 
277  * 81    11/20/97 2:10p Hoffoss
278  * Added defaults for  joystick buttons 2 and 3.
279  * 
280  * 80    11/20/97 1:08a Lawrance
281  * add support for 'R' key - target closest friendly repair ship
282  * 
283  * 79    11/19/97 8:33p Hoffoss
284  * New controls config screen baby!
285  * 
286  * 78    11/17/97 7:09p Hoffoss
287  * Made chase view control a trigger type.
288  * 
289  * 77    11/17/97 6:40p Lawrance
290  * Changed 'I' key to toggle of extended target info, moved target closest
291  * locked missile to 'L'
292  * 
293  * 76    11/17/97 3:26p Jasen
294  * Adjusted coordinates for the help button .ani location
295  * 
296  * 75    11/16/97 3:51p Hoffoss
297  * Added more button to config screen when scrolling allowed.
298  * 
299  * 74    11/16/97 3:20p Hoffoss
300  * Added various suggestions from the Todolist.
301  * 
302  * 73    11/14/97 4:33p Mike
303  * Change Debug key to backquote (from F11).
304  * Balance a ton of subsystems in ships.tbl.
305  * Change "Heavy Laser" to "Disruptor".
306  * 
307  * 72    11/12/97 2:54p Hoffoss
308  * Made modifiers non-stand alone, added support for red tabs on
309  * conflicts.
310  * 
311  * 71    10/30/97 6:01p Hoffoss
312  * Changed screen to utilize the new text color standards.
313  * 
314  * 70    10/29/97 7:25p Hoffoss
315  * Added crude support for UI button double click checking.
316  * 
317  * 69    10/29/97 6:32p Hoffoss
318  * Changed some interface apperances.
319  * 
320  * 68    10/29/97 4:54p Hoffoss
321  * Changed scan_code_text element for Enter to 'Enter' instead of 'a' with
322  * a caret over it (what's that all about?)
323  * 
324  * 67    10/28/97 10:42a Hoffoss
325  * Fixed handling of continuous controls that have modifiers to the key.
326  * 
327  * 66    10/28/97 10:03a Hoffoss
328  * Fixed bug with continuous type controls not registering if pressed and
329  * released too quickly.  Also some other little changes.
330  * 
331  * 65    10/28/97 12:12a Lawrance
332  * remove unused keys (Alt-H and Alt-F)
333  * 
334  * 64    10/27/97 12:23p Hoffoss
335  * Improved warning system and fixed coloring bug.
336  * 
337  * 63    10/27/97 11:39a Hoffoss
338  * Added control conflicts checking.
339  * 
340  * 62    10/26/97 3:20p Hoffoss
341  * Added many missing features to control config screen.
342  * 
343  * 61    10/25/97 5:41p Hoffoss
344  * More functionality added to the controls config screen.
345  * 
346  * 60    10/24/97 11:00p Hoffoss
347  * Controls config screen much improved.
348  * 
349  * 59    10/22/97 4:50p Hoffoss
350  * Disabled throttle by default.
351  * 
352  * 58    10/22/97 11:00a Hoffoss
353  * Changed VIEW_SLEW and VIEW_EXTERNAL to be continuous rather than
354  * trigger actions.
355  * 
356  * 57    10/21/97 7:05p Hoffoss
357  * Overhauled the key/joystick control structure and usage throughout the
358  * entire FreeSpace code.  The whole system is very different now.
359  * 
360  * 56    10/18/97 7:19p Hoffoss
361  * Added timestamp recording when a key is pressed.
362  * 
363  * 55    10/13/97 4:33p Hoffoss
364  * Made training messages go away after time.
365  * 
366  * 54    10/13/97 3:24p Hoffoss
367  * Made it so training message text can be arbitrarily bolded.
368  * 
369  * 53    9/24/97 4:52p Hoffoss
370  * Changed training message key token handling, and implemented a new
371  * training message system method to test out for a while.
372  * 
373  * 52    9/14/97 10:24p Lawrance
374  * add damage screen popup window
375  * 
376  * 51    9/10/97 6:02p Hoffoss
377  * Added code to check for key-pressed sexp operator in FreeSpace as part
378  * of training mission stuff.
379  * 
380  * 50    9/09/97 3:39p Sandeep
381  * warning level 4 bugs
382  * $NoKeywords: $
383  *
384 */
385
386 #include "controlsconfig.h"
387 #include "key.h"
388 #include "joy.h"
389 #include "localize.h"
390
391 #define TARGET_TAB                      0
392 #define SHIP_TAB                                1
393 #define WEAPON_TAB                      2
394 #define COMPUTER_TAB                    3
395
396 int Failed_key_index;
397
398 // assume control keys are used as modifiers until we find out 
399 int Shift_is_modifier;
400 int Ctrl_is_modifier;
401 int Alt_is_modifier;
402
403 int Axis_enabled[JOY_NUM_AXES] = { 1, 1, 1, 0, 0, 0 };
404 int Axis_enabled_defaults[JOY_NUM_AXES] = { 1, 1, 1, 0, 0, 0 };
405 int Invert_axis[JOY_NUM_AXES] = { 0, 0, 0, 0, 0, 0 };
406 int Invert_axis_defaults[JOY_NUM_AXES] = { 0, 0, 0, 0, 0, 0 };
407
408 // arrays which hold the key mappings.  The array index represents a key-independent action.
409 //
410 //XSTR:OFF
411 config_item Control_config[CCFG_MAX + 1] = {
412         // targeting a ship
413         {                           SDLK_t,                             -1, TARGET_TAB, "Target Next Ship", CC_TYPE_TRIGGER, -1, -1, 0 },
414         {             KEY_SHIFTED | SDLK_t,                             -1, TARGET_TAB, "Target Previous Ship", CC_TYPE_TRIGGER, -1, -1, 0 },
415         {                           SDLK_h,                             2,  TARGET_TAB, "Target Next Closest Hostile Ship", CC_TYPE_TRIGGER, -1, -1, 0 },
416         {                  KEY_SHIFTED | SDLK_h,                                -1, TARGET_TAB, "Target Previous Closest Hostile Ship", CC_TYPE_TRIGGER, -1, -1, 0 },
417         { KEY_ALTED |               SDLK_h,                             -1, TARGET_TAB, "Toggle Auto Targeting", CC_TYPE_TRIGGER, -1, -1, 0 },
418         {                           SDLK_f,                             -1, TARGET_TAB, "Target Next Closest Friendly Ship", CC_TYPE_TRIGGER, -1, -1, 0 },
419         {             KEY_SHIFTED | SDLK_f,                             -1, TARGET_TAB, "Target Previous Closest Friendly Ship", CC_TYPE_TRIGGER, -1, -1, 0 },
420         {                           SDLK_y,                             4,  TARGET_TAB, "Target Ship in Reticle", CC_TYPE_TRIGGER, -1, -1, 0 },
421         {                           SDLK_g,                             -1, TARGET_TAB, "Target Target's Nearest Attacker", CC_TYPE_TRIGGER, -1, -1, 0 },
422         { KEY_ALTED     |                                        SDLK_y,                                -1, TARGET_TAB, "Target Last Ship to Send Transmission", CC_TYPE_TRIGGER, -1, -1, 0 },
423         { KEY_ALTED |               SDLK_t,                             -1, TARGET_TAB, "Turn Off Auto-Targeting", CC_TYPE_TRIGGER, -1, -1, 0 },
424
425         // targeting a ship's subsystem
426         {                           SDLK_v,                             -1, TARGET_TAB, "Target Subsystem in Reticle", CC_TYPE_TRIGGER, -1, -1, 0 },
427         {                           SDLK_s,                             -1, TARGET_TAB, "Target Next Subsystem", CC_TYPE_TRIGGER, -1, -1, 0 },
428         {             KEY_SHIFTED | SDLK_s,                             -1, TARGET_TAB, "Target Previous Subsystem", CC_TYPE_TRIGGER, -1, -1, 0 },
429         { KEY_ALTED |               SDLK_s,                             -1, TARGET_TAB, "Turn Off Auto-Targeting of Subsystems", CC_TYPE_TRIGGER, -1, -1, 0 },
430
431         // matching speed
432         {                           SDLK_m,                             -1, COMPUTER_TAB,       "Match Target Speed", CC_TYPE_TRIGGER, -1, -1, 0 },
433         { KEY_ALTED |               SDLK_m,                             -1, COMPUTER_TAB,       "Toggle Auto Speed Matching", CC_TYPE_TRIGGER, -1, -1, 0 },
434
435         // weapons
436         {                           SDLK_LCTRL,                 0,       WEAPON_TAB,    "Fire Primary Weapon", CC_TYPE_CONTINUOUS, -1, -1, 0 },
437         {                           SDLK_SPACE,         1,  WEAPON_TAB, "Fire Secondary Weapon", CC_TYPE_CONTINUOUS, -1, -1, 0 },
438         {                           SDLK_PERIOD,                -1, WEAPON_TAB, "Cycle Forward Primary Weapon", CC_TYPE_TRIGGER, -1, -1, 0 },
439         {                           SDLK_COMMA,                 -1, WEAPON_TAB, "Cycle Backward Primary Weapon", CC_TYPE_TRIGGER, -1, -1, 0 },
440         {                           SDLK_SLASH,         -1, WEAPON_TAB, "Cycle Secondary Weapon Bank", CC_TYPE_TRIGGER, -1, -1, 0 },
441         {             KEY_SHIFTED | SDLK_SLASH,         -1, WEAPON_TAB, "Cycle Secondary Weapon Firing Rate", CC_TYPE_TRIGGER, -1, -1, 0 },
442         {                           SDLK_x,                             3,       WEAPON_TAB,    "Launch Countermeasure", CC_TYPE_TRIGGER, -1, -1, 0 },
443
444         // controls
445         {                           SDLK_a,                             -1, SHIP_TAB,           "Forward Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0 },
446         {                           SDLK_z,                             -1, SHIP_TAB,           "Reverse Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0 },
447         {                           SDLK_KP_7,                  -1, SHIP_TAB,           "Bank Left", CC_TYPE_CONTINUOUS, -1, -1, 0 },
448         {                           SDLK_KP_9,                  -1, SHIP_TAB,           "Bank Right", CC_TYPE_CONTINUOUS, -1, -1, 0 },
449         {                           SDLK_KP_8,                  -1, SHIP_TAB,           "Pitch Forward", CC_TYPE_CONTINUOUS, -1, -1, 0 },
450         {                           SDLK_KP_2,                  -1, SHIP_TAB,           "Pitch Backward", CC_TYPE_CONTINUOUS, -1, -1, 0 },
451         {                           SDLK_KP_4,                  -1, SHIP_TAB,           "Turn Left", CC_TYPE_CONTINUOUS, -1, -1, 0 },
452         {                           SDLK_KP_6,                  -1, SHIP_TAB,           "Turn Right", CC_TYPE_CONTINUOUS, -1, -1, 0 },
453
454         // throttle controls
455         {                           SDLK_BACKSPACE,             -1, SHIP_TAB,           "Set Throttle to Zero", CC_TYPE_TRIGGER, -1, -1, 0 },
456         {                           SDLK_BACKSLASH,                     -1, SHIP_TAB,           "Set Throttle to Max", CC_TYPE_TRIGGER, -1, -1, 0 },
457         {                           SDLK_LEFTBRACKET,           -1, SHIP_TAB,           "Set Throttle to One-Third", CC_TYPE_TRIGGER, -1, -1, 0 },
458         {                           SDLK_RIGHTBRACKET,          -1, SHIP_TAB,           "Set Throttle to Two-Thirds", CC_TYPE_TRIGGER, -1, -1, 0 },
459         {                           SDLK_EQUALS,                        -1, SHIP_TAB,           "Increase Throttle 5 Percent", CC_TYPE_TRIGGER, -1, -1, 0 },
460         {                           SDLK_MINUS,                 -1, SHIP_TAB,           "Decrease Throttle 5 Percent", CC_TYPE_TRIGGER, -1, -1, 0 },
461
462         // squadmate messaging
463         {             KEY_SHIFTED | SDLK_a,                             -1, COMPUTER_TAB,       "Attack My Target", CC_TYPE_TRIGGER, -1, -1, 0 },
464         {             KEY_SHIFTED | SDLK_z,                             -1, COMPUTER_TAB,       "Disarm My Target", CC_TYPE_TRIGGER, -1, -1, 0 },
465         {             KEY_SHIFTED | SDLK_d,                             -1, COMPUTER_TAB,       "Disable My Target", CC_TYPE_TRIGGER, -1, -1, 0 },
466         {             KEY_SHIFTED | SDLK_v,                             -1, COMPUTER_TAB,       "Attack my Subsystem", CC_TYPE_TRIGGER, -1, -1, 0 },
467         {             KEY_SHIFTED | SDLK_x,                             -1, COMPUTER_TAB,       "Capture My Target", CC_TYPE_TRIGGER, -1, -1, 0 },
468         {             KEY_SHIFTED | SDLK_e,                             -1, COMPUTER_TAB,       "Engage Enemy", CC_TYPE_TRIGGER, -1, -1, 0 },
469         {             KEY_SHIFTED | SDLK_w,                             -1, COMPUTER_TAB,       "Form on my Wing", CC_TYPE_TRIGGER, -1, -1, 0 },
470         {             KEY_SHIFTED | SDLK_i,                             -1, COMPUTER_TAB,       "Ignore my Target", CC_TYPE_TRIGGER, -1, -1, 0 },
471         {             KEY_SHIFTED | SDLK_p,                             -1, COMPUTER_TAB,       "Protect my Target", CC_TYPE_TRIGGER, -1, -1, 0 },
472         {             KEY_SHIFTED | SDLK_c,                             -1, COMPUTER_TAB,       "Cover me", CC_TYPE_TRIGGER, -1, -1, 0 },
473         {             KEY_SHIFTED | SDLK_j,                             -1, COMPUTER_TAB,       "Return to base", CC_TYPE_TRIGGER, -1, -1, 0 },
474         {                                 KEY_SHIFTED | SDLK_r,                         -1, COMPUTER_TAB, "Rearm me", CC_TYPE_TRIGGER, -1, -1, 0 },
475
476         {                                                                        SDLK_r,                                6,  TARGET_TAB, "Target Closest Attacking Ship", CC_TYPE_TRIGGER, -1, -1, 0 },
477
478         // Views
479         {                           SDLK_KP_MULTIPLY,   -1, COMPUTER_TAB,       "Chase View", CC_TYPE_TRIGGER, -1, -1, 0 },
480         {                           SDLK_KP_PERIOD,     -1, COMPUTER_TAB,       "External View", CC_TYPE_TRIGGER, -1, -1, 0 },
481         {                           SDLK_KP_ENTER,              -1, COMPUTER_TAB,       "Toggle External Camera Lock", CC_TYPE_TRIGGER, -1, -1, 0 },
482         {                           SDLK_KP_0,                  -1, COMPUTER_TAB,       "Free Look View", CC_TYPE_CONTINUOUS, -1, -1, 0 },
483         {                           SDLK_KP_DIVIDE,     -1, COMPUTER_TAB,       "Current Target View", CC_TYPE_TRIGGER, -1, -1, 0 },
484         {                           SDLK_KP_PLUS,               -1, COMPUTER_TAB,       "Increase View Distance", CC_TYPE_CONTINUOUS, -1, -1, 0 },
485         {                           SDLK_KP_MINUS,              -1, COMPUTER_TAB,       "Decrease View Distance", CC_TYPE_CONTINUOUS, -1, -1, 0 },
486         {                           SDLK_KP_5,                  -1, COMPUTER_TAB,       "Center View", CC_TYPE_CONTINUOUS, -1, -1, 0 },
487         {                                                                        -1,                                    33, COMPUTER_TAB, "View Up", CC_TYPE_CONTINUOUS, -1, -1, 0 },
488         {                                                                        -1,                                    32, COMPUTER_TAB, "View Rear", CC_TYPE_CONTINUOUS, -1, -1, 0 },
489         {                                                                        -1,                                    34, COMPUTER_TAB, "View Left", CC_TYPE_CONTINUOUS, -1, -1, 0 },
490         {                                                                        -1,                                    35, COMPUTER_TAB, "View Right", CC_TYPE_CONTINUOUS, -1, -1, 0 },
491
492         {                           SDLK_QUOTE,         -1, COMPUTER_TAB,       "Cycle Radar Range", CC_TYPE_TRIGGER, -1, -1, 0 },
493         {                           SDLK_c,                             -1, COMPUTER_TAB, "Communications Menu", CC_TYPE_TRIGGER, -1, -1, 0 },
494         {                           -1,                                 -1, -1,                         "Show Objectives", CC_TYPE_TRIGGER, -1, -1, 0 },
495         { KEY_ALTED |               SDLK_j,                             -1, COMPUTER_TAB,       "Enter Subspace (End Mission)", CC_TYPE_TRIGGER, -1, -1, 0 },
496         {                           SDLK_j,                             -1, TARGET_TAB, "Target Target's Target", CC_TYPE_TRIGGER, -1, -1, 0 },
497         {                           SDLK_TAB,                   5,  SHIP_TAB,           "Afterburner", CC_TYPE_CONTINUOUS, -1, -1, 0 },
498         
499         {                           SDLK_INSERT,                -1, COMPUTER_TAB,       "Increase Weapon Energy", CC_TYPE_TRIGGER, -1, -1, 0 },
500         {                           SDLK_DELETE,                -1, COMPUTER_TAB,       "Decrease Weapon Energy", CC_TYPE_TRIGGER, -1, -1, 0 },
501         {                           SDLK_HOME,                  -1, COMPUTER_TAB,       "Increase Shield Energy", CC_TYPE_TRIGGER, -1, -1, 0 },
502         {                           SDLK_END,                   -1, COMPUTER_TAB,       "Decrease Shield Energy", CC_TYPE_TRIGGER, -1, -1, 0 },
503         {                           SDLK_PAGEUP,                -1, COMPUTER_TAB,       "Increase Engine Energy", CC_TYPE_TRIGGER, -1, -1, 0 },
504         {                           SDLK_PAGEDOWN,              -1, COMPUTER_TAB,       "Decrease Engine Energy", CC_TYPE_TRIGGER, -1, -1, 0 },
505         { KEY_ALTED |               SDLK_d,                             -1, COMPUTER_TAB, "Equalize Energy Settings", CC_TYPE_TRIGGER, -1, -1, 0 },
506
507         {                           SDLK_q,                             7,  COMPUTER_TAB,       "Equalize Shield", CC_TYPE_TRIGGER, -1, -1, 0 },
508         {                           SDLK_UP,                            -1, COMPUTER_TAB,       "Augment Forward Shield", CC_TYPE_TRIGGER, -1, -1, 0 },
509         {                           SDLK_DOWN,                  -1, COMPUTER_TAB,       "Augment Rear Shield", CC_TYPE_TRIGGER, -1, -1, 0 },
510         {                           SDLK_LEFT,                  -1, COMPUTER_TAB,       "Augment Left Shield", CC_TYPE_TRIGGER, -1, -1, 0 },
511         {                           SDLK_RIGHT,                 -1, COMPUTER_TAB,       "Augment Right Shield", CC_TYPE_TRIGGER, -1, -1, 0 },
512         {                           SDLK_SCROLLLOCK,    -1, COMPUTER_TAB,       "Transfer Energy Laser->Shield", CC_TYPE_TRIGGER, -1, -1, 0 },
513         {             KEY_SHIFTED | SDLK_SCROLLLOCK,    -1, COMPUTER_TAB,       "Transfer Energy Shield->Laser", CC_TYPE_TRIGGER, -1, -1, 0 },
514         {                           -1,                                 -1, -1,                         "Show Damage Popup Window", CC_TYPE_TRIGGER, -1, -1, 0 },       
515
516         {                           -1,                                 -1, SHIP_TAB,           "Bank When Pressed", CC_TYPE_CONTINUOUS, -1, -1, 0 },
517         {                                                                        -1,                                    -1, -1,                         "Show NavMap", CC_TYPE_TRIGGER, -1, -1, 0 },
518         { KEY_ALTED |                SDLK_e,                            -1, COMPUTER_TAB,       "Add or Remove Escort", CC_TYPE_TRIGGER, -1, -1, 0 },
519         { KEY_ALTED | KEY_SHIFTED | SDLK_e,                             -1, COMPUTER_TAB,       "Clear Escort List", CC_TYPE_TRIGGER, -1, -1, 0 },
520         {                                                    SDLK_e,                            -1, TARGET_TAB, "Target Next Escort Ship", CC_TYPE_TRIGGER, -1, -1, 0 },
521         { KEY_ALTED     |                                        SDLK_r,                                -1, TARGET_TAB, "Target Closest Repair Ship", CC_TYPE_TRIGGER, -1, -1, 0 },
522
523         {                           SDLK_u,                             -1, TARGET_TAB, "Target Next Uninspected Cargo", CC_TYPE_TRIGGER, -1, -1, 0 },
524         {             KEY_SHIFTED | SDLK_u,                             -1, TARGET_TAB, "Target Previous Uninspected Cargo", CC_TYPE_TRIGGER, -1, -1, 0 },
525         {                                                                        SDLK_n,                                -1, TARGET_TAB, "Target Newest Ship In Area", CC_TYPE_TRIGGER, -1, -1, 0 },
526         {                           SDLK_k,                             -1, TARGET_TAB, "Target Next Live Turret", CC_TYPE_TRIGGER, -1, -1, 0 },
527         {             KEY_SHIFTED | SDLK_k,                             -1, TARGET_TAB, "Target Previous Live Turret", CC_TYPE_TRIGGER, -1, -1, 0 },
528
529         {                                                                        SDLK_b,                                -1, TARGET_TAB, "Target Next Hostile Bomb or Bomber", CC_TYPE_TRIGGER, -1, -1, 0 },
530         {             KEY_SHIFTED | SDLK_b,                             -1, TARGET_TAB, "Target Previous Hostile Bomb or Bomber", CC_TYPE_TRIGGER, -1, -1, 0 },
531
532         // multiplayer messaging keys
533         {                                                                        SDLK_1,                                -1, COMPUTER_TAB,       "(Multiplayer) Message All", CC_TYPE_CONTINUOUS, -1, -1, 0 },
534         {                                                                        SDLK_2,                                -1, COMPUTER_TAB, "(Multiplayer) Message Friendly", CC_TYPE_CONTINUOUS, -1, -1, 0 },
535         {                                                                        SDLK_3,                                -1, COMPUTER_TAB, "(Multiplayer) Message Hostile", CC_TYPE_CONTINUOUS, -1, -1, 0 },
536         {                                                                        SDLK_4,                                -1, COMPUTER_TAB, "(Multiplayer) Message Target", CC_TYPE_CONTINUOUS, -1, -1, 0 },
537         { KEY_ALTED     |                                        SDLK_x,                                -1, COMPUTER_TAB, "(Multiplayer) Observer zoom to target", CC_TYPE_TRIGGER, -1, -1, 0 },
538
539         {             KEY_SHIFTED | SDLK_PERIOD,                -1, COMPUTER_TAB,       "Increase time compression", CC_TYPE_TRIGGER, -1, -1, 0 },
540         {             KEY_SHIFTED | SDLK_COMMA,                 -1, COMPUTER_TAB,       "Decrease time compression", CC_TYPE_TRIGGER, -1, -1, 0 },
541 #ifndef MAKE_FS1
542         {                                                                        SDLK_l,                                -1, COMPUTER_TAB, "Toggle high HUD contrast", CC_TYPE_TRIGGER, -1, -1, 0 },
543
544 #ifndef FS2_DEMO
545         {                                 KEY_SHIFTED | SDLK_n,                         -1, COMPUTER_TAB, "(Multiplayer) Toggle network info", CC_TYPE_TRIGGER, -1, -1, 0 },
546         {                                 KEY_SHIFTED | SDLK_END,                       -1, COMPUTER_TAB, "(Multiplayer) Self destruct", CC_TYPE_TRIGGER, -1, -1, 0 },
547 #endif
548 #endif
549         {                           -1,                                 -1, -1,                         "", CC_TYPE_TRIGGER, -1, -1, 0 }
550 };
551 /*
552 #ifndef MAKE_FS1
553         "7",                            "8",                            "9",                            "0",                            "Akzent '",                             "\xE1",                         "R\x81""cktaste",               "Tab",
554 #else
555         "7",                            "8",                            "9",                            "0",                            "?",                            "Akzent '",                             "R\x81""cktaste",               "Tab",
556 #endif
557 #ifndef MAKE_FS1
558         "\xAE",                         "`",                            "Shift",                        "#",                            "Y",                            "X",                            "C",                            "V",
559 #else
560         "\x8E",                         "`",                            "Shift",                        "#",                            "Y",                            "X",                            "C",                            "V",
561 #endif
562 */
563 /*
564 const char *Scan_code_text_german[] = {
565         "",                             "Esc",                          "1",                            "2",                            "3",                            "4",                            "5",                            "6",
566         "7",                            "8",                            "9",                            "0",                            "Akzent '",                             "\xE1",                         "R\x81""cktaste",               "Tab",
567         "Q",                            "W",                            "E",                            "R",                            "T",                            "Z",                            "U",                            "I",
568         "O",                            "P",                            "\x9A",                         "+",                            "Eingabe",                      "Strg Links",                   "A",                            "S",
569
570         "D",                            "F",                            "G",                            "H",                            "J",                            "K",                            "L",                            "\x99",
571         "\xAE",                         "`",                            "Shift",                        "#",                            "Y",                            "X",                            "C",                            "V",
572         "B",                            "N",                            "M",                            ",",                            ".",                            "-",                            "Shift",                        "Num *",
573         "Alt",                          "Leertaste",                    "Hochstell",                    "F1",                           "F2",                           "F3",                           "F4",                           "F5",
574
575         "F6",                           "F7",                           "F8",                           "F9",                           "F10",                          "Pause",                        "Rollen",                       "Num 7",
576         "Num 8",                        "Num 9",                        "Num -",                        "Num 4",                        "Num 5",                        "Num 6",                        "Num +",                        "Num 1",
577         "Num 2",                        "Num 3",                        "Num 0",                        "Num ,",                        "",                             "",                             "",                             "F11",
578         "F12",                          "",                             "",                             "",                             "",                             "",                             "",                             "",
579
580         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
581         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
582         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
583         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
584
585         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
586         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
587         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
588         "",                             "",                             "",                             "",                             "Num Eingabe",                  "Strg Rechts",                  "",                             "",
589
590         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
591         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
592         "",                             "",                             "",                             "",                             "",                             "Num /",                        "",                             "Druck",
593         "Alt",                          "",                             "",                             "",                             "",                             "",                             "",                             "",
594
595         "",                             "",                             "",                             "",                             "",                             "Num Lock",                     "",                             "Pos 1",
596         "Pfeil Hoch",                   "Bild Hoch",                    "",                             "Pfeil Links",                  "",                             "Pfeil Rechts",                 "",                             "Ende",
597         "Pfeil Runter",                         "Bild Runter",                  "Einfg",                        "Entf",                         "",                             "",                             "",                             "",
598         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
599
600         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
601         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
602         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
603         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
604 };
605 */
606 const char *Scan_code_text_german[] = {
607         "",     "",     "",     "",     "A",    "B",    "C",    "D",    "E",
608         "F",    "G",    "H",    "I",    "J",    "K",    "L",    "M",
609         "N",    "O",    "P",    "Q",    "R",    "S",    "T",    "U",
610         "V",    "W",    "X",    "Z",    "Y",    "1",    "2",    "3",
611         "4",    "5",    "6",    "7",    "8",    "9",    "0",    "Eingabe",
612         "Esc",  "R\x81""cktaste",       "Tab",  "Leertaste",    "Akzent '",     "\xE1", "\x9A", "+",
613         "#",    "",     "\x99", "\xAE", "`",    ",",    ".",    "-",
614         "Hochstell",    "F1",   "F2",   "F3",   "F4",   "F5",   "F6",   "F7",
615         "F8",   "F9",   "F10",  "F11",  "F12",  "Druck",        "Rollen",       "Pause",
616         "Einfg",        "Pos 1",        "Bild Hoch",    "Entf", "Ende", "Bild Runter",  "Pfeil Rechts", "Pfeil Links",
617         "Pfeil Runter", "Pfeil Hoch",   "",     "Num /",        "Num *",        "Num -",        "Num +",        "Num Eingabe",
618         "Num 1",        "Num 2",        "Num 3",        "Num 4",        "Num 5",        "Num 6",        "Num 7",        "Num 8",
619         "Num 9",        "Num 0",        "Num ,",        "",     "",     "",     "",     "",
620         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
621         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
622         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
623         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
624         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
625         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
626         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
627         "",     "",     "",     "",     "",     "",     "",     "Strg Links",
628         "Shift",        "Alt",  "",     "Strg Rechts",  "Shift",        "Alt",  "",     "",
629         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
630         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
631         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
632         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
633         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
634         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
635         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
636         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
637         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
638         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
639         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
640         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
641         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
642         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
643         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
644         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
645         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
646         "",     "",     "",     "",     "",     "",     ""
647 };
648
649 const char *Joy_button_text_german[] = {
650         "Knopf 1",              "Knopf 2",              "Knopf 3",              "Knopf 4",              "Knopf 5",              "Knopf 6",
651         "Knopf 7",              "Knopf 8",              "Knopf 9",              "Knopf 10",             "Knopf 11",             "Knopf 12",
652         "Knopf 13",             "Knopf 14",             "Knopf 15",             "Knopf 16",             "Knopf 17",             "Knopf 18",
653         "Knopf 19",             "Knopf 20",             "Knopf 21",             "Knopf 22",             "Knopf 23",             "Knopf 24",
654         "Knopf 25",             "Knopf 26",             "Knopf 27",             "Knopf 28",             "Knopf 29",             "Knopf 30",
655         "Knopf 31",             "Knopf 32",             "Hut Hinten",   "Hut Vorne",    "Hut Links",    "Hut Rechts"
656 };
657
658 /*
659 const char *Scan_code_text_french[] = {
660         "",                             "\x90""chap",                   "1",                            "2",                            "3",                            "4",                            "5",                            "6",
661         "7",                            "8",                            "9",                            "0",                            "-",                            "=",                            "Fl\x82""che Ret.",                     "Tab",
662         "Q",                            "W",                            "E",                            "R",                            "T",                            "Y",                            "U",                            "I",
663         "O",                            "P",                            "[",                            "]",                            "Entr\x82""e",                  "Ctrl Gauche",                  "A",                            "S",
664
665         "D",                            "F",                            "G",                            "H",                            "J",                            "K",                            "L",                            ";",
666         "'",                            "`",                            "Maj.",                 "\\",                           "Z",                            "X",                            "C",                            "V",
667         "B",                            "N",                            "M",                            ",",                            ".",                            "/",                            "Maj.",                 "Pav\x82 *",
668         "Alt",                          "Espace",                       "Verr. Maj.",                   "F1",                           "F2",                           "F3",                           "F4",                           "F5",
669
670         "F6",                           "F7",                           "F8",                           "F9",                           "F10",                          "Pause",                        "Arret defil",          "Pav\x82 7",
671         "Pav\x82 8",                    "Pav\x82 9",                    "Pav\x82 -",                    "Pav\x82 4",                    "Pav\x82 5",                    "Pav\x82 6",                    "Pav\x82 +",                    "Pav\x82 1",
672         "Pav\x82 2",                    "Pav\x82 3",                    "Pav\x82 0",                    "Pav\x82 .",                    "",                             "",                             "",                             "F11",
673         "F12",                          "",                             "",                             "",                             "",                             "",                             "",                             "",
674
675         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
676         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
677         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
678         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
679
680         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
681         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
682         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
683         "",                             "",                             "",                             "",                             "Pav\x82 Entr",                 "Ctrl Droite",          "",                             "",
684
685         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
686         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
687         "",                             "",                             "",                             "",                             "",                             "Pav\x82 /",                    "",                             "Impr \x82""cran",
688         "Alt",                          "",                             "",                             "",                             "",                             "",                             "",                             "",
689
690         "",                             "",                             "",                             "",                             "",                             "Verr num",                     "",                             "Orig.",
691         "Fl\x82""che Haut",                     "Page Haut",                    "",                             "Fl\x82""che Gauche",                   "",                             "Fl\x82""che Droite",                   "",                     "Fin",
692         "Fl\x82""che Bas",                      "Page Bas",                     "Inser",                        "Suppr",                        "",                             "",                             "",                             "",
693         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
694
695         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
696         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
697         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
698         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
699 };
700 */
701 const char *Scan_code_text_french[] = {
702         "",     "",     "",     "",     "A",    "B",    "C",    "D",    "E",
703         "F",    "G",    "H",    "I",    "J",    "K",    "L",    "M",
704         "N",    "O",    "P",    "Q",    "R",    "S",    "T",    "U",
705         "V",    "W",    "X",    "Y",    "Z",    "1",    "2",    "3",
706         "4",    "5",    "6",    "7",    "8",    "9",    "0",    "Entr\x82""e",
707         "\x90""chap",   "Fl\x82""che Ret.",     "Tab",  "Espace",       "-",    "=",    "[",    "]",
708         "\\",   "",     ";",    "'",    "`",    ",",    ".",    "/",
709         "Verr. Maj.",   "F1",   "F2",   "F3",   "F4",   "F5",   "F6",   "F7",
710         "F8",   "F9",   "F10",  "F11",  "F12",  "Impr \x82""cran",      "Arret defil",  "Pause",
711         "Inser",        "Orig.",        "Page Haut",    "Suppr",        "Fin",  "Page Bas",     "Fl\x82""che Droite",   "Fl\x82""che Gauche",
712         "Fl\x82""che Bas",      "Fl\x82""che Haut",     "",     "Pav\x82 /",    "Pav\x82 *",    "Pav\x82 -",    "Pav\x82 +",    "Pav\x82 Entr",
713         "Pav\x82 1",    "Pav\x82 2",    "Pav\x82 3",    "Pav\x82 4",    "Pav\x82 5",    "Pav\x82 6",    "Pav\x82 7",    "Pav\x82 8",
714         "Pav\x82 9",    "Pav\x82 0",    "Pav\x82 .",    "",     "",     "",     "",     "",
715         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
716         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
717         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
718         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
719         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
720         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
721         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
722         "",     "",     "",     "",     "",     "",     "",     "Ctrl Gauche",
723         "Maj.", "Alt",  "",     "Ctrl Droite",  "Maj.", "Alt",  "",     "",
724         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
725         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
726         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
727         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
728         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
729         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
730         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
731         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
732         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
733         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
734         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
735         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
736         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
737         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
738         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
739         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
740         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
741         "",     "",     "",     "",     "",     "",     ""
742 };
743
744 const char *Joy_button_text_french[] = {
745         "Bouton 1",             "Bouton 2",             "Bouton 3",             "Bouton 4",             "Bouton 5",             "Bouton 6",
746         "Bouton 7",             "Bouton 8",             "Bouton 9",             "Bouton 10",            "Bouton 11",            "Bouton 12",
747         "Bouton 13",            "Bouton 14",            "Bouton 15",            "Bouton 16",            "Bouton 17",            "Bouton 18",
748         "Bouton 19",            "Bouton 20",            "Bouton 21",            "Bouton 22",            "Bouton 23",            "Bouton 24",
749         "Bouton 25",            "Bouton 26",            "Bouton 27",            "Bouton 28",            "Bouton 29",            "Bouton 30",
750         "Bouton 31",            "Bouton 32",            "Chapeau Arri\xE8re",           "Chapeau Avant",                "Chapeau Gauche",               "Chapeau Droite"
751 };
752
753 //      This is the text that is displayed on the screen for the keys a player selects
754 /*
755 const char *Scan_code_text_english[] = {
756         "",                             "Esc",                  "1",                            "2",                            "3",                            "4",                            "5",                            "6",
757         "7",                            "8",                            "9",                            "0",                            "-",                            "=",                            "Backspace",    "Tab",
758         "Q",                            "W",                            "E",                            "R",                            "T",                            "Y",                            "U",                            "I",
759         "O",                            "P",                            "[",                            "]",                            "Enter",                        "Left Ctrl",    "A",                            "S",
760
761         "D",                            "F",                            "G",                            "H",                            "J",                            "K",                            "L",                            ";",
762         "'",                            "`",                            "Shift",                        "\\",                           "Z",                            "X",                            "C",                            "V",
763         "B",                            "N",                            "M",                            ",",                            ".",                            "/",                            "Shift",                        "Pad *",
764         "Alt",                  "Spacebar",             "Caps Lock",    "F1",                           "F2",                           "F3",                           "F4",                           "F5",
765
766         "F6",                           "F7",                           "F8",                           "F9",                           "F10",                  "Pause",                        "Scroll Lock",  "Pad 7",
767         "Pad 8",                        "Pad 9",                        "Pad -",                        "Pad 4",                        "Pad 5",                        "Pad 6",                        "Pad +",                        "Pad 1",
768         "Pad 2",                        "Pad 3",                        "Pad 0",                        "Pad .",                        "",                             "",                             "",                             "F11",
769         "F12",                  "",                             "",                             "",                             "",                             "",                             "",                             "",
770
771         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
772         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
773         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
774         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
775
776         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
777         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
778         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
779         "",                             "",                             "",                             "",                             "Pad Enter",    "Right Ctrl",   "",                             "",
780
781         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
782         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
783         "",                             "",                             "",                             "",                             "",                             "Pad /",                        "",                             "Print Scrn",
784         "Alt",                  "",                             "",                             "",                             "",                             "",                             "",                             "",
785
786         "",                             "",                             "",                             "",                             "",                             "Num Lock",             "",                             "Home",
787         "Up Arrow",             "Page Up",              "",                             "Left Arrow",   "",                             "Right Arrow",  "",                             "End",
788         "Down Arrow",  "Page Down",     "Insert",               "Delete",               "",                             "",                             "",                             "",
789         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
790
791         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
792         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
793         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
794         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
795 };
796 */
797 const char *Scan_code_text_english[] = {
798         "",     "",     "",     "",     "A",    "B",    "C",    "D",    "E",
799         "F",    "G",    "H",    "I",    "J",    "K",    "L",    "M",
800         "N",    "O",    "P",    "Q",    "R",    "S",    "T",    "U",
801         "V",    "W",    "X",    "Y",    "Z",    "1",    "2",    "3",
802         "4",    "5",    "6",    "7",    "8",    "9",    "0",    "Enter",
803         "Esc",  "Backspace",    "Tab",  "Spacebar",     "-",    "=",    "[",    "]",
804         "\\",   "",     ";",    "'",    "`",    ",",    ".",    "/",
805         "Caps Lock",    "F1",   "F2",   "F3",   "F4",   "F5",   "F6",   "F7",
806         "F8",   "F9",   "F10",  "F11",  "F12",  "Print Scrn",   "Scroll Lock",  "Pause",
807         "Insert",       "Home", "Page Up",      "Delete",       "End",  "Page Down",    "Right Arrow",  "Left Arrow",
808         "Down Arrow",   "Up Arrow",     "",     "Pad /",        "Pad *",        "Pad -",        "Pad +",        "Pad Enter",
809         "Pad 1",        "Pad 2",        "Pad 3",        "Pad 4",        "Pad 5",        "Pad 6",        "Pad 7",        "Pad 8",
810         "Pad 9",        "Pad 0",        "Pad .",        "",     "",     "",     "",     "",
811         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
812         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
813         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
814         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
815         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
816         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
817         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
818         "",     "",     "",     "",     "",     "",     "",     "Left Ctrl",
819         "Shift",        "Alt",  "",     "Right Ctrl",   "Shift",        "Alt",  "",     "",
820         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
821         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
822         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
823         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
824         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
825         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
826         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
827         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
828         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
829         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
830         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
831         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
832         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
833         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
834         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
835         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
836         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
837         "",     "",     "",     "",     "",     "",     ""
838 };
839
840 const char *Joy_button_text_english[] = {
841         "Button 1",             "Button 2",             "Button 3",             "Button 4",             "Button 5",             "Button 6",
842         "Button 7",             "Button 8",             "Button 9",             "Button 10",    "Button 11",    "Button 12",
843         "Button 13",    "Button 14",    "Button 15",    "Button 16",    "Button 17",    "Button 18",
844         "Button 19",    "Button 20",    "Button 21",    "Button 22",    "Button 23",    "Button 24",
845         "Button 25",    "Button 26",    "Button 27",    "Button 28",    "Button 29",    "Button 30",
846         "Button 31",    "Button 32",    "Hat Back",             "Hat Forward",  "Hat Left",             "Hat Right"
847 };
848 /*
849 const char *Scan_code_text_polish[] = {
850         "",                             "Esc",                  "1",                            "2",                            "3",                            "4",                            "5",                            "6",
851         "7",                            "8",                            "9",                            "0",                            "-",                            "=",                            "Backspace",    "Tab",
852         "Q",                            "W",                            "E",                            "R",                            "T",                            "Y",                            "U",                            "I",
853         "O",                            "P",                            "[",                            "]",                            "Enter",                        "Lewy Ctrl",    "A",                            "S",
854
855         "D",                            "F",                            "G",                            "H",                            "J",                            "K",                            "L",                            ";",
856         "'",                            "`",                            "LShift",                       "\\",                           "Z",                            "X",                            "C",                            "V",
857         "B",                            "N",                            "M",                            ",",                            ".",                            "/",                            "PShift",                       "Num *",
858         "Alt",                  "Spacja",               "CapsLock",     "F1",                           "F2",                           "F3",                           "F4",                           "F5",
859
860         "F6",                           "F7",                           "F8",                           "F9",                           "F10",                  "Pause",                        "Scrlock",      "Num 7",
861         "Num 8",                        "Num 9",                        "Num -",                        "Num 4",                        "Num 5",                        "Num 6",                        "Num +",                        "Num 1",
862         "Num 2",                        "Num 3",                        "Num 0",                        "Num .",                        "",                             "",                             "",                             "F11",
863         "F12",                  "",                             "",                             "",                             "",                             "",                             "",                             "",
864
865         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
866         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
867         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
868         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
869
870         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
871         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
872         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
873         "",                             "",                             "",                             "",                             "Num Enter",    "Prawy Ctrl",   "",                             "",
874
875         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
876         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
877         "",                             "",                             "",                             "",                             "",                             "Num /",                        "",                             "PrntScr",
878         "Alt",                  "",                             "",                             "",                             "",                             "",                             "",                             "",
879
880         "",                             "",                             "",                             "",                             "",                             "Num Lock",             "",                             "Home",
881         "Kursor G\xF3ra",               "Page Up",              "",                             "Kursor Lewo",  "",                             "Kursor Prawo", "",                             "End",
882         "Kursor D\xF3\xB3",  "Page Down",       "Insert",               "Delete",               "",                             "",                             "",                             "",
883         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
884
885         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
886         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
887         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
888         "",                             "",                             "",                             "",                             "",                             "",                             "",                             "",
889 };
890 */
891 const char *Scan_code_text_polish[] = {
892         "",     "",     "",     "",     "A",    "B",    "C",    "D",    "E",
893         "F",    "G",    "H",    "I",    "J",    "K",    "L",    "M",
894         "N",    "O",    "P",    "Q",    "R",    "S",    "T",    "U",
895         "V",    "W",    "X",    "Y",    "Z",    "1",    "2",    "3",
896         "4",    "5",    "6",    "7",    "8",    "9",    "0",    "Enter",
897         "Esc",  "Backspace",    "Tab",  "Spacja",       "-",    "=",    "[",    "]",
898         "\\",   "",     ";",    "'",    "`",    ",",    ".",    "/",
899         "CapsLock",     "F1",   "F2",   "F3",   "F4",   "F5",   "F6",   "F7",
900         "F8",   "F9",   "F10",  "F11",  "F12",  "PrntScr",      "Scrlock",      "Pause",
901         "Insert",       "Home", "Page Up",      "Delete",       "End",  "Page Down",    "Kursor Prawo", "Kursor Lewo",
902         "Kursor D\xF3\xB3",     "Kursor G\xF3ra",       "",     "Num /",        "Num *",        "Num -",        "Num +",        "Num Enter",
903         "Num 1",        "Num 2",        "Num 3",        "Num 4",        "Num 5",        "Num 6",        "Num 7",        "Num 8",
904         "Num 9",        "Num 0",        "Num .",        "",     "",     "",     "",     "",
905         "",     "",     "",     "",     "",     "",     "",     "", "", "",     "",     "",     "",     "",     "",     "",
906         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
907         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
908         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
909         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
910         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
911         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
912         "",     "",     "",     "",     "",     "",     "",     "Lewy Ctrl",
913         "LShift",       "Alt",  "",     "Prawy Ctrl",   "PShift",       "Alt",  "",     "",
914         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
915         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
916         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
917         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
918         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
919         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
920         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
921         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
922         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
923         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
924         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
925         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
926         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
927         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
928         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
929         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
930         "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",     "",
931         "",     "",     "",     "",     "",     "",     ""
932 };
933
934 const char *Joy_button_text_polish[] = {
935         "Przyc.1",              "Przyc.2",              "Przyc.3",              "Przyc.4",              "Przyc.5",              "Przyc.6",
936         "Przyc.7",              "Przyc.8",              "Przyc.9",              "Przyc.10",     "Przyc.11",     "Przyc.12",
937         "Przyc.13",     "Przyc.14",     "Przyc.15",     "Przyc.16",     "Przyc.17",     "Przyc.18",
938         "Przyc.19",     "Przyc.20",     "Przyc.21",     "Przyc.22",     "Przyc.23",     "Przyc.24",
939         "Przyc.25",     "Przyc.26",     "Przyc.27",     "Przyc.28",     "Przyc.29",     "Przyc.30",
940         "Przyc.31",     "Przyc.32",     "Hat Ty\xB3",           "Hat Prz\xF3\x64",      "Hat Lewo",             "Hat Prawo"
941 };
942
943 const char **Scan_code_text = Scan_code_text_english;
944 const char **Joy_button_text = Joy_button_text_english;
945
946
947 void set_modifier_status()
948 {
949         int i;
950
951         Alt_is_modifier = 0;
952         Shift_is_modifier = 0;
953         Ctrl_is_modifier = 0;
954
955         for (i=0; i<CCFG_MAX; i++) {
956                 if (Control_config[i].key_id < 0)
957                         continue;
958
959                 if (Control_config[i].key_id & KEY_ALTED)
960                         Alt_is_modifier = 1;
961
962                 if (Control_config[i].key_id & KEY_SHIFTED)
963                         Shift_is_modifier = 1;
964
965                 if (Control_config[i].key_id & KEY_CTRLED) {
966                         SDL_assert(0);  // get Alan
967                         Ctrl_is_modifier = 1;
968                 }
969         }
970 }
971
972 int translate_key_to_index(const char *key)
973 {
974         int i, index = -1, alt = 0, shift = 0, max_scan_codes;
975
976         if (Lcl_gr) {
977                 max_scan_codes = sizeof(Scan_code_text_german) / sizeof(char *);
978         } else if (Lcl_fr) {
979                 max_scan_codes = sizeof(Scan_code_text_french) / sizeof(char *);
980         } else if (Lcl_pl) {
981                 max_scan_codes = sizeof(Scan_code_text_polish) / sizeof(char *);
982         } else {
983                 max_scan_codes = sizeof(Scan_code_text_english) / sizeof(char *);
984         }
985
986         // look for modifiers
987         SDL_assert(key);
988         if (!SDL_strncasecmp(key, "Alt", 3)) {
989                 alt = 1;
990                 key += 3;
991                 if (*key)
992                         key++;
993         }
994
995         const char *translated_shift;
996         
997         if(Lcl_gr){
998                 translated_shift = "Shift";
999         } else if(Lcl_fr){      
1000                 translated_shift = "Maj.";
1001         } else {        
1002                 translated_shift = "Shift";
1003         }
1004
1005         if (!SDL_strncasecmp(key, translated_shift, 5)) {
1006                 shift = 1;
1007                 key += 5;
1008                 if (*key)
1009                         key++;
1010         }
1011
1012 #ifdef MAKE_FS1
1013         // fix for German training mission key check
1014         if (Lcl_gr && !strcmp(key, "Links Ctrl")) {
1015                 key = "Left Ctrl";
1016         }
1017 #endif
1018
1019         // look up index for default key
1020         if (*key) {
1021                 for (i=0; i<max_scan_codes; i++)
1022                         if (!SDL_strcasecmp(key, Scan_code_text[i])) {
1023                                 index = SDL_GetKeyFromScancode((SDL_Scancode)i);
1024                                 break;
1025                         }
1026
1027                 if (i == max_scan_codes)
1028                         return -1;
1029
1030                 if (shift)
1031                         index |= KEY_SHIFTED;
1032                 if (alt)
1033                         index |= KEY_ALTED;
1034
1035                 // convert scancode to Control_config index
1036                 for (i=0; i<CCFG_MAX; i++) {
1037                         if (Control_config[i].key_default == index) {
1038                                 index = i;
1039                                 break;
1040                         }
1041                 }
1042
1043                 if (i == CCFG_MAX)
1044                         return -1;
1045
1046                 return index;
1047         }
1048
1049         return -1;
1050 }
1051
1052 // Given the system default key 'key', return the current key that is bound to the function
1053 // Both are 'key' and the return value are descriptive strings that can be displayed
1054 // directly to the user.  If 'key' isn't a real key or not normally bound to anything,
1055 // or there is no key current bound to the function, NULL is returned.
1056 const char *translate_key(const char *key)
1057 {
1058         int index = -1, code = -1;
1059
1060         index = translate_key_to_index(key);
1061         if (index < 0)
1062                 return NULL;
1063
1064         code = Control_config[index].key_id;
1065         Failed_key_index = index;
1066         if (code < 0) {
1067                 code = Control_config[index].joy_id;
1068                 if (code >= 0)
1069                         return Joy_button_text[code];
1070         }
1071
1072         return textify_scancode(code);
1073 }
1074
1075 const char *textify_scancode(int code)
1076 {
1077         static char text[40];
1078
1079         if (code < 0)
1080                 return "None";
1081
1082         *text = 0;
1083         if (code & KEY_ALTED) {
1084                 if(Lcl_gr){             
1085                         SDL_strlcat(text, "Alt-", SDL_arraysize(text));
1086                 } else if(Lcl_fr){              
1087                         SDL_strlcat(text, "Alt-", SDL_arraysize(text));
1088                 } else {                
1089                         SDL_strlcat(text, "Alt-", SDL_arraysize(text));
1090                 }               
1091         }
1092
1093         if (code & KEY_SHIFTED) {               
1094                 if(Lcl_gr){
1095                         SDL_strlcat(text, "Shift-", SDL_arraysize(text));
1096                 } else if(Lcl_fr){              
1097                         SDL_strlcat(text, "Maj.-", SDL_arraysize(text));
1098                 } else {                
1099                         SDL_strlcat(text, "Shift-", SDL_arraysize(text));
1100                 }
1101         }
1102
1103         code = SDL_GetScancodeFromKey(code & KEY_MASK);
1104
1105         SDL_strlcat(text, Scan_code_text[code], SDL_arraysize(text));
1106         return text;
1107 }
1108 //XSTR:ON
1109
1110 // initialize common control config stuff - call at game startup after localization has been initialized
1111 void control_config_common_init()
1112 {
1113         if(Lcl_gr){
1114                 Scan_code_text = Scan_code_text_german;
1115                 Joy_button_text = Joy_button_text_german;
1116                 
1117                 // swap init bindings for y and z keys
1118         //      Control_config[TARGET_SHIP_IN_RETICLE].key_default = SDLK_z;
1119         //      Control_config[TARGET_LAST_TRANMISSION_SENDER].key_default = KEY_ALTED | SDLK_z;
1120         //      Control_config[REVERSE_THRUST].key_default = SDLK_y;
1121         //      Control_config[DISARM_MESSAGE].key_default = KEY_SHIFTED | SDLK_y;
1122         } else if(Lcl_fr){
1123                 Scan_code_text = Scan_code_text_french;
1124                 Joy_button_text = Joy_button_text_french;
1125         } else if(Lcl_pl){
1126                 Scan_code_text = Scan_code_text_polish;
1127                 Joy_button_text = Joy_button_text_polish;
1128         } else {
1129                 Scan_code_text = Scan_code_text_english;
1130                 Joy_button_text = Joy_button_text_english;
1131         }
1132 }