diff --git a/src/console.c b/src/console.c index 50d274908..668fbe14d 100644 --- a/src/console.c +++ b/src/console.c @@ -227,14 +227,6 @@ static void CONS_Clear_f(void) Unlock_state(); } -// Choose english keymap -// -/*static void CONS_English_f(void) -{ - shiftxform = english_shiftxform; - CONS_Printf(M_GetText("%s keymap.\n"), M_GetText("English")); -}*/ - static char *bindtable[NUMINPUTS]; static void CONS_Bind_f(void) @@ -675,23 +667,57 @@ void CON_MoveConsole(void) Unlock_state(); } +static char 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-' + '(', ')', '*', '+', + '<', // shift-, + '_', // shift-- + '>', // shift-. + '?', // shift-/ + ')', // shift-0 + '!', // shift-1 + '@', // shift-2 + '#', // shift-3 + '$', // shift-4 + '%', // shift-5 + '^', // shift-6 + '&', // shift-7 + '*', // shift-8 + '(', // shift-9 + ':', + ':', // 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', + '{', // shift-[ + '|', // shift-backslash - OH MY GOD DOES WATCOM SUCK + '}', // 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', + '{', '|', '}', '~', 127 +}; + INT32 CON_ShiftChar(INT32 ch) { - if (I_UseNativeKeyboard()) + if (I_UseNativeKeyboard() || ch >= sizeof(shiftxform)) return ch; + // warning: shiftdown is NOT a boolean, it's 1 or 2 for lshift/rshift if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) - { - if (shiftdown ^ capslock) - ch = shiftxform[ch]; - } + return !!shiftdown != capslock ? shiftxform[ch] : ch; else // if we're holding shift we should still shift non letter symbols - { - if (shiftdown) - ch = shiftxform[ch]; - } - - return ch; + return shiftdown ? shiftxform[ch] : ch; } // Clear time of console heads up messages diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 5b47f01fc..49f60622e 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -114,49 +114,6 @@ static void HU_DrawRankings(void); // KEYBOARD LAYOUTS FOR ENTERING TEXT //====================================================================== -char *shiftxform; - -char english_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-' - '(', ')', '*', '+', - '<', // shift-, - '_', // shift-- - '>', // shift-. - '?', // shift-/ - ')', // shift-0 - '!', // shift-1 - '@', // shift-2 - '#', // shift-3 - '$', // shift-4 - '%', // shift-5 - '^', // shift-6 - '&', // shift-7 - '*', // shift-8 - '(', // shift-9 - ':', - ':', // 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', - '{', // shift-[ - '|', // shift-backslash - OH MY GOD DOES WATCOM SUCK - '}', // 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', - '{', '|', '}', '~', 127 -}; - static char cechotext[1024]; static tic_t cechotimer = 0; static tic_t cechoduration = 5*TICRATE; @@ -235,9 +192,6 @@ void HU_Init(void) missingpat = W_CachePatchNum(missingnum, PU_STATIC); } - // set shift translation table - shiftxform = english_shiftxform; - /* Setup fonts */ diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 266f4747f..f34e6c935 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -68,9 +68,6 @@ enum }; #undef X -extern char *shiftxform; // english translation shift table -extern char english_shiftxform[]; - //------------------------------------ // sorted player lines //------------------------------------ diff --git a/src/m_menu.c b/src/m_menu.c index d423fbaa4..ad98339a4 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1616,8 +1616,6 @@ boolean M_Responder(event_t *ev) { if (M_WipeBuffer(ch, currentMenu->keyhandler)) return true; - if (shiftdown && ch >= 32 && ch <= 127) - ch = shiftxform[ch]; if (currentMenu->keyhandler(ch)) return true; }