From 78e4c2833de6ae33f70dcfb9f5f656658eac2dfc Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 10 Oct 2008 23:54:52 +0000 Subject: Convert Heretic/Hexen menu code to use translated key value when entering save game names. Subversion-branch: /branches/raven-branch Subversion-revision: 1353 --- src/heretic/mn_menu.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'src/heretic/mn_menu.c') diff --git a/src/heretic/mn_menu.c b/src/heretic/mn_menu.c index f295c076..369da690 100644 --- a/src/heretic/mn_menu.c +++ b/src/heretic/mn_menu.c @@ -1030,6 +1030,7 @@ static boolean SCInfo(int option) boolean MN_Responder(event_t * event) { + int charTyped; int key; int i; MenuItem_t *item; @@ -1048,6 +1049,8 @@ boolean MN_Responder(event_t * event) return (false); } key = event->data1; + charTyped = event->data2; + if (InfoType) { if (gamemode == shareware) @@ -1081,7 +1084,7 @@ boolean MN_Responder(event_t * event) if (askforquit) { - switch (key) + switch (charTyped) { case 'y': if (askforquit) @@ -1413,7 +1416,7 @@ boolean MN_Responder(event_t * event) { if (CurrentMenu->items[i].text) { - if (toupper(key) + if (toupper(charTyped) == toupper(CurrentMenu->items[i].text[0])) { CurrentItPos = i; @@ -1463,24 +1466,18 @@ boolean MN_Responder(event_t * event) } if (slotptr < SLOTTEXTLEN && key != KEY_BACKSPACE) { - if ((key >= 'a' && key <= 'z')) - { - *textBuffer++ = key - 32; - *textBuffer = ASCII_CURSOR; - slotptr++; - return (true); - } - if (((key >= '0' && key <= '9') || key == ' ' - || key == ',' || key == '.' || key == '-') && !shiftdown) + if (isalpha(charTyped)) { - *textBuffer++ = key; + *textBuffer++ = toupper(charTyped); *textBuffer = ASCII_CURSOR; slotptr++; return (true); } - if (shiftdown && key == '1') + if (isdigit(charTyped) || charTyped == ' ' + || charTyped == ',' || charTyped == '.' || charTyped == '-' + || charTyped == '!') { - *textBuffer++ = '!'; + *textBuffer++ = charTyped; *textBuffer = ASCII_CURSOR; slotptr++; return (true); -- cgit v1.2.3