summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2008-10-10 23:54:52 +0000
committerSimon Howard2008-10-10 23:54:52 +0000
commit78e4c2833de6ae33f70dcfb9f5f656658eac2dfc (patch)
tree7d9afb75b31b20b3d8b4974f2de5fc7e9806ab52 /src
parent32565063e7dd9a0e18e496a31bc46ddfe65eee4d (diff)
downloadchocolate-doom-78e4c2833de6ae33f70dcfb9f5f656658eac2dfc.tar.gz
chocolate-doom-78e4c2833de6ae33f70dcfb9f5f656658eac2dfc.tar.bz2
chocolate-doom-78e4c2833de6ae33f70dcfb9f5f656658eac2dfc.zip
Convert Heretic/Hexen menu code to use translated key value when
entering save game names. Subversion-branch: /branches/raven-branch Subversion-revision: 1353
Diffstat (limited to 'src')
-rw-r--r--src/heretic/mn_menu.c25
-rw-r--r--src/hexen/mn_menu.c25
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);