mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
CON_ShiftChar: Integrate numpad translation from CON_Responder, so both chat and menu input can take advantage
The original written comment by Callum remarks that it was good for writing IP addresses, and this makes it apply to the IP address Online Menu field... Also adds better comments.
This commit is contained in:
parent
8e4e2eb0a9
commit
c8f350aa70
1 changed files with 21 additions and 14 deletions
|
|
@ -648,11 +648,31 @@ INT32 CON_ShiftChar(INT32 ch)
|
|||
{
|
||||
if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))
|
||||
{
|
||||
// Standard Latin-script uppercase translation
|
||||
if (shiftdown ^ capslock)
|
||||
ch = shiftxform[ch];
|
||||
}
|
||||
else // if we're holding shift we should still shift non letter symbols
|
||||
else if (ch >= KEY_KEYPAD7 && ch <= KEY_KPADDEL)
|
||||
{
|
||||
// Numpad keycodes mapped to printable equivalent
|
||||
const char keypad_translation[] =
|
||||
{
|
||||
'7','8','9','-',
|
||||
'4','5','6','+',
|
||||
'1','2','3',
|
||||
'0','.'
|
||||
};
|
||||
|
||||
ch = keypad_translation[ch - KEY_KEYPAD7];
|
||||
}
|
||||
else if (ch == KEY_KPADSLASH)
|
||||
{
|
||||
// Ditto, but non-contiguous keycode
|
||||
ch = '/';
|
||||
}
|
||||
else
|
||||
{
|
||||
// QWERTY keycode translation
|
||||
if (shiftdown)
|
||||
ch = shiftxform[ch];
|
||||
}
|
||||
|
|
@ -1296,19 +1316,6 @@ boolean CON_Responder(event_t *ev)
|
|||
return true;
|
||||
}
|
||||
|
||||
// allow people to use keypad in console (good for typing IP addresses) - Calum
|
||||
if (key >= KEY_KEYPAD7 && key <= KEY_KPADDEL)
|
||||
{
|
||||
char keypad_translation[] = {'7','8','9','-',
|
||||
'4','5','6','+',
|
||||
'1','2','3',
|
||||
'0','.'};
|
||||
|
||||
key = keypad_translation[key - KEY_KEYPAD7];
|
||||
}
|
||||
else if (key == KEY_KPADSLASH)
|
||||
key = '/';
|
||||
|
||||
key = CON_ShiftChar(key);
|
||||
|
||||
// enter a char into the command prompt
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue