commit 78e4c2833de6ae33f70dcfb9f5f656658eac2dfc
Author: Simon Howard <fraggle@gmail.com>
AuthorDate: Fri Oct 10 23:54:52 2008 +0000
Commit: Simon Howard <fraggle@gmail.com>
CommitDate: Fri Oct 10 23:54:52 2008 +0000
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 +++++++++++--------------
src/hexen/mn_menu.c | 25 +++++++++++--------------
2 files changed, 22 insertions(+), 28 deletions(-)
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);
diff --git a/src/hexen/mn_menu.c b/src/hexen/mn_menu.c
index 219cd139..f7b34bc8 100644
--- a/src/hexen/mn_menu.c
+++ b/src/hexen/mn_menu.c
@@ -1133,6 +1133,7 @@ static void SCInfo(int option)
boolean MN_Responder(event_t * event)
{
int key;
+ int charTyped;
int i;
MenuItem_t *item;
extern boolean automapactive;
@@ -1150,6 +1151,8 @@ boolean MN_Responder(event_t * event)
return (false);
}
key = event->data1;
+ charTyped = event->data2;
+
if (InfoType)
{
if (gamemode == shareware)
@@ -1186,7 +1189,7 @@ boolean MN_Responder(event_t * event)
if (askforquit)
{
- switch (key)
+ switch (charTyped)
{
case 'y':
if (askforquit)
@@ -1548,7 +1551,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;
@@ -1598,24 +1601,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);