Add back missing azerty stuff
This commit is contained in:
parent
80dbf97d25
commit
f9be340ca1
6 changed files with 183 additions and 11 deletions
|
|
@ -680,6 +680,46 @@ INT32 CON_ShiftChar(INT32 ch)
|
|||
if (I_UseNativeKeyboard())
|
||||
return ch;
|
||||
|
||||
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))
|
||||
{
|
||||
if (cv_keyboardlayout.value == 3)
|
||||
{
|
||||
if (shiftdown ^ capslock)
|
||||
ch = shiftxform[ch];
|
||||
else if (altdown & 0x2)
|
||||
ch = french_altgrxform[ch];
|
||||
else
|
||||
ch = HU_FallBackFrSpecialLetter(ch);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (shiftdown ^ capslock)
|
||||
ch = shiftxform[ch];
|
||||
}
|
||||
}
|
||||
else // if we're holding shift we should still shift non letter symbols
|
||||
{
|
||||
if (cv_keyboardlayout.value == 3)
|
||||
{
|
||||
if (shiftdown)
|
||||
ch = shiftxform[ch];
|
||||
else if (altdown & 0x2)
|
||||
ch = french_altgrxform[ch];
|
||||
else
|
||||
ch = HU_FallBackFrSpecialLetter(ch);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (shiftdown)
|
||||
ch = shiftxform[ch];
|
||||
}
|
||||
}
|
||||
|
||||
return ch;
|
||||
}
|
||||
|
||||
INT32 CON_ShitAndAltGrChar(INT32 ch)
|
||||
{
|
||||
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))
|
||||
{
|
||||
if (shiftdown ^ capslock)
|
||||
|
|
@ -689,6 +729,14 @@ INT32 CON_ShiftChar(INT32 ch)
|
|||
{
|
||||
if (shiftdown)
|
||||
ch = shiftxform[ch];
|
||||
else if (altdown & 0x2)
|
||||
{
|
||||
ch = french_altgrxform[ch];
|
||||
}
|
||||
else
|
||||
{
|
||||
ch = HU_FallBackFrSpecialLetter(ch);
|
||||
}
|
||||
}
|
||||
|
||||
return ch;
|
||||
|
|
@ -893,7 +941,7 @@ boolean CON_Responder(event_t *ev)
|
|||
return true;
|
||||
|
||||
// ctrl modifier -- changes behavior, adds shortcuts
|
||||
if (ctrldown)
|
||||
if ((cv_keyboardlayout.value != 3 && ctrldown) || (cv_keyboardlayout.value == 3 && ctrldown && !altdown))
|
||||
{
|
||||
// show all cvars/commands that match what we have inputted
|
||||
if (key == KEY_TAB)
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@ extern UINT8 *consolebgmap;
|
|||
extern UINT8 *promptbgmap;
|
||||
|
||||
INT32 CON_ShiftChar(INT32 ch);
|
||||
INT32 CON_ShitAndAltGrChar(INT32 ch);
|
||||
|
||||
void CON_SetupBackColormapEx(INT32 color, boolean prompt);
|
||||
void CON_SetupBackColormap(void);
|
||||
void CON_ClearHUD(void); // clear heads up messages
|
||||
|
|
|
|||
104
src/hu_stuff.c
104
src/hu_stuff.c
|
|
@ -162,6 +162,105 @@ char english_shiftxform[] =
|
|||
'{', '|', '}', '~', 127
|
||||
};
|
||||
|
||||
char french_shiftxform[] =
|
||||
{
|
||||
0,
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||||
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
|
||||
31,
|
||||
' ','$', //shift-!
|
||||
'3', //shift-"
|
||||
'#', '$', '%',
|
||||
'1', //shift-&
|
||||
'4', // shift-'
|
||||
'5', // shift-(
|
||||
')', // shift-)
|
||||
'*', '+',
|
||||
'?', // shift-,
|
||||
'6', // shift--
|
||||
'.', '/',
|
||||
'0', '1', '2', '3', '4', '5',
|
||||
'6', '7', '8', '9',
|
||||
'/', // shitf-:
|
||||
'.', // shift-;
|
||||
'>', // shift-<
|
||||
'+', // shift-=
|
||||
'>', '?', '@',
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
|
||||
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
||||
'[', '\\', ']', '^',
|
||||
'8', //shift-_
|
||||
'`',
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
|
||||
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
||||
'{', '|', '}', '~', 127,
|
||||
128, 129,
|
||||
'2',
|
||||
131, 132,
|
||||
'0',
|
||||
134,
|
||||
'9',
|
||||
136, 137,
|
||||
'7',
|
||||
139, 140,
|
||||
'%'
|
||||
};
|
||||
|
||||
char french_altgrxform[] =
|
||||
{
|
||||
0,
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||||
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
|
||||
31,
|
||||
' ', '!',
|
||||
'#', //altgr-"
|
||||
'#', '$', '%', '&',
|
||||
'{', //altgr-'
|
||||
'[', //altgr-(
|
||||
']', //altgr-)
|
||||
'*', '+', ',',
|
||||
'|', //altg--
|
||||
'.', '/',
|
||||
'0', '1', '2', '3', '4', '5',
|
||||
'6', '7', '8', '9',
|
||||
':', ';', '<',
|
||||
'}', //altgr-=
|
||||
'>', '?', '@',
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
|
||||
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
||||
'[', '\\', ']', '^',
|
||||
'\\', //altgr-backslash
|
||||
'`',
|
||||
'a', 'b', 'c', 'd', 'E', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
||||
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
|
||||
'{', '|', '}', '~', 127,
|
||||
128, 129,
|
||||
'~',
|
||||
131, 132,
|
||||
'@',
|
||||
134,
|
||||
'^',
|
||||
136, 137,
|
||||
'`',
|
||||
139, 140,
|
||||
KEY_FR_U_GRAVE
|
||||
};
|
||||
|
||||
//fallback for special letter non displayable in the game (i.e.: 'é','à',etc.)
|
||||
INT32 HU_FallBackFrSpecialLetter(INT32 key)
|
||||
{
|
||||
switch(key){
|
||||
case KEY_FR_E_AIGUE: return 'e';
|
||||
case KEY_FR_E_GRAVE: return 'e';
|
||||
case KEY_FR_C_CEDILLE: return 'c';
|
||||
case KEY_FR_A_GRAVE: return 'a';
|
||||
case KEY_FR_U_GRAVE: return 'u';
|
||||
default: return key;
|
||||
}
|
||||
}
|
||||
|
||||
static char cechotext[1024];
|
||||
static tic_t cechotimer = 0;
|
||||
static tic_t cechoduration = 5*TICRATE;
|
||||
|
|
@ -386,6 +485,11 @@ void HU_Start(void)
|
|||
headsupactive = true;
|
||||
}
|
||||
|
||||
void HU_Shiftform(void)
|
||||
{
|
||||
shiftxform = (cv_keyboardlayout.value == 3) ? french_shiftxform : english_shiftxform;
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
// EXECUTION
|
||||
//======================================================================
|
||||
|
|
|
|||
|
|
@ -71,6 +71,12 @@ enum
|
|||
extern char *shiftxform; // english translation shift table
|
||||
extern char english_shiftxform[];
|
||||
|
||||
extern char french_shiftxform[];
|
||||
extern char french_altgrxform[];
|
||||
|
||||
//fallback for special letter non displayable in the game (i.e.: 'é','à',etc.)
|
||||
INT32 HU_FallBackFrSpecialLetter(INT32 key);
|
||||
|
||||
//------------------------------------
|
||||
// sorted player lines
|
||||
//------------------------------------
|
||||
|
|
@ -125,6 +131,8 @@ patch_t *HU_UpdateOrBlankPatch(patch_t **user, boolean required, const char *for
|
|||
// reset heads up when consoleplayer respawns.
|
||||
void HU_Start(void);
|
||||
|
||||
void HU_Shiftform(void);
|
||||
|
||||
boolean HU_Responder(event_t *ev);
|
||||
void HU_Ticker(void);
|
||||
void HU_TickSongCredits(void);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include "v_video.h"
|
||||
#include "r_main.h" // renderisnewtic
|
||||
#include "i_system.h"
|
||||
#include "i_video.h"
|
||||
#include "keys.h"
|
||||
#include "console.h"
|
||||
|
||||
|
|
@ -235,8 +236,8 @@ void M_TextInputSetString(textinput_t *input, const char *c)
|
|||
static boolean M_TextInputHandleBase(textinput_t *input, INT32 key, boolean emotes)
|
||||
{
|
||||
if (key == KEY_LSHIFT || key == KEY_RSHIFT
|
||||
|| key == KEY_LCTRL || key == KEY_RCTRL
|
||||
|| key == KEY_LALT || key == KEY_RALT)
|
||||
|| key == KEY_LCTRL || key == KEY_RCTRL
|
||||
|| key == KEY_LALT || key == KEY_RALT)
|
||||
return false;
|
||||
|
||||
if (shiftdown && key == KEY_INS)
|
||||
|
|
@ -245,8 +246,7 @@ static boolean M_TextInputHandleBase(textinput_t *input, INT32 key, boolean emot
|
|||
return true;
|
||||
}
|
||||
|
||||
//if ((cv_keyboardlayout.value != 3 && ctrldown) || (cv_keyboardlayout.value == 3 && ctrldown && !altdown))
|
||||
if (ctrldown)
|
||||
if ((cv_keyboardlayout.value != 3 && ctrldown) || (cv_keyboardlayout.value == 3 && ctrldown && !altdown))
|
||||
{
|
||||
if (key == 'x' || key == 'X')
|
||||
{
|
||||
|
|
@ -372,17 +372,17 @@ static boolean M_TextInputHandleBase(textinput_t *input, INT32 key, boolean emot
|
|||
if (key >= KEY_KEYPAD7 && key <= KEY_KPADDEL)
|
||||
{
|
||||
char keypad_translation[] = {'7','8','9','-',
|
||||
'4','5','6','+',
|
||||
'1','2','3',
|
||||
'0','.'};
|
||||
'4','5','6','+',
|
||||
'1','2','3',
|
||||
'0','.'};
|
||||
|
||||
key = keypad_translation[key - KEY_KEYPAD7];
|
||||
key = keypad_translation[key - KEY_KEYPAD7];
|
||||
}
|
||||
else if (key == KEY_KPADSLASH)
|
||||
key = '/';
|
||||
|
||||
// same capslock code as hu_stuff.c's HU_responder. Check there for details.
|
||||
key = CON_ShiftChar(key);
|
||||
key = cv_keyboardlayout.value == 3 ? CON_ShitAndAltGrChar(key) : CON_ShiftChar(key);
|
||||
|
||||
// enter a char into the command prompt
|
||||
if (key < 32 || key > 127)
|
||||
|
|
|
|||
|
|
@ -87,8 +87,18 @@
|
|||
rendermode_t rendermode = render_soft;
|
||||
rendermode_t chosenrendermode = render_none; // set by command line arguments
|
||||
|
||||
static void KeyboardLayout_OnChange(void)
|
||||
{
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
if (cv_keyboardlayout.value != 2)
|
||||
SDL_StopTextInput(window);
|
||||
HU_Shiftform();
|
||||
}
|
||||
|
||||
static CV_PossibleValue_t keyboardlayout_cons_t[] = {{1,"Default US"}, {2, "Native"}, {3, "AZERTY"}, {0, NULL}};
|
||||
consvar_t cv_keyboardlayout = CVAR_INIT ("keyboardlayout", "Default US", CV_SAVE, keyboardlayout_cons_t, NULL);
|
||||
consvar_t cv_keyboardlayout = CVAR_INIT ("keyboardlayout", "Default US", CV_SAVE, keyboardlayout_cons_t, KeyboardLayout_OnChange);
|
||||
|
||||
boolean highcolor = false;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue