summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/am_map.c2
-rw-r--r--src/m_menu.c38
-rw-r--r--src/st_stuff.c22
3 files changed, 30 insertions, 32 deletions
diff --git a/src/am_map.c b/src/am_map.c
index 11f77c1e..7ba71f5c 100644
--- a/src/am_map.c
+++ b/src/am_map.c
@@ -706,7 +706,7 @@ AM_Responder
cheatstate=0;
rc = false;
}
- if (!deathmatch && cht_CheckCheat(&cheat_amap, ev->data2))
+ if (!deathmatch && cht_CheckCheat(&cheat_amap, ev->data1))
{
rc = false;
cheating = (cheating+1) % 3;
diff --git a/src/m_menu.c b/src/m_menu.c
index 1b9f8014..0df17fa1 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -1406,17 +1406,10 @@ boolean M_Responder (event_t* ev)
static int mousex = 0;
static int lastx = 0;
- // There is a distinction here between the typed character and the key
- // pressed. 'key' is the key code, while 'ch' is the actual character
- // typed. For an example, on a German QWERTZ keyboard, if 'z' is
- // pressed, ch='z' but key='y' (the position it occupies on the
- // "standard" american keyboard)
- //
- // When dealing with actual keys pressed, we must use key, but any time
- // we want the actual character typed, we use ch.
-
- key = -1;
+ // key is the key pressed, ch is the actual character typed
+
ch = 0;
+ key = -1;
if (ev->type == ev_joystick && joywait < I_GetTime())
{
@@ -1498,11 +1491,13 @@ boolean M_Responder (event_t* ev)
}
}
else
+ {
if (ev->type == ev_keydown)
{
key = ev->data1;
- ch = ev->data2;
+ ch = ev->data2;
}
+ }
}
if (key == -1)
@@ -1547,11 +1542,14 @@ boolean M_Responder (event_t* ev)
break;
default:
- ch = toupper(ch);
- if (ch != ' ')
+ // Entering a character - use the 'ch' value, not the key
+
+ ch = toupper(ch);
+
+ if (ch != ' '
+ && (ch - HU_FONTSTART < 0 || ch - HU_FONTSTART >= HU_FONTSIZE))
{
- if (ch-HU_FONTSTART < 0 || ch-HU_FONTSTART >= HU_FONTSIZE)
- break;
+ break;
}
if (ch >= 32 && ch <= 127 &&
@@ -1560,7 +1558,7 @@ boolean M_Responder (event_t* ev)
(SAVESTRINGSIZE-2)*8)
{
savegamestrings[saveSlot][saveCharIndex++] = ch;
- savegamestrings[saveSlot][saveCharIndex] = '\0';
+ savegamestrings[saveSlot][saveCharIndex] = 0;
}
break;
}
@@ -1571,13 +1569,13 @@ boolean M_Responder (event_t* ev)
if (messageToPrint)
{
if (messageNeedsInput == true &&
- !(ch == ' ' || ch == 'n' || ch == 'y' || key == KEY_ESCAPE))
+ !(key == ' ' || key == 'n' || key == 'y' || key == KEY_ESCAPE))
return false;
menuactive = messageLastMenuActive;
messageToPrint = 0;
if (messageRoutine)
- messageRoutine(ch);
+ messageRoutine(key);
menuactive = false;
S_StartSound(NULL,sfx_swtchx);
@@ -1771,14 +1769,14 @@ boolean M_Responder (event_t* ev)
default:
for (i = itemOn+1;i < currentMenu->numitems;i++)
- if (currentMenu->menuitems[i].alphaKey == ch)
+ if (currentMenu->menuitems[i].alphaKey == key)
{
itemOn = i;
S_StartSound(NULL,sfx_pstop);
return true;
}
for (i = 0;i <= itemOn;i++)
- if (currentMenu->menuitems[i].alphaKey == ch)
+ if (currentMenu->menuitems[i].alphaKey == key)
{
itemOn = i;
S_StartSound(NULL,sfx_pstop);
diff --git a/src/st_stuff.c b/src/st_stuff.c
index b82504af..b8e636c5 100644
--- a/src/st_stuff.c
+++ b/src/st_stuff.c
@@ -474,7 +474,7 @@ ST_Responder (event_t* ev)
if (!netgame && gameskill != sk_nightmare)
{
// 'dqd' cheat for toggleable god mode
- if (cht_CheckCheat(&cheat_god, ev->data2))
+ if (cht_CheckCheat(&cheat_god, ev->data1))
{
plyr->cheats ^= CF_GODMODE;
if (plyr->cheats & CF_GODMODE)
@@ -489,7 +489,7 @@ ST_Responder (event_t* ev)
plyr->message = DEH_String(STSTR_DQDOFF);
}
// 'fa' cheat for killer fucking arsenal
- else if (cht_CheckCheat(&cheat_ammonokey, ev->data2))
+ else if (cht_CheckCheat(&cheat_ammonokey, ev->data1))
{
plyr->armorpoints = deh_idfa_armor;
plyr->armortype = deh_idfa_armor_class;
@@ -503,7 +503,7 @@ ST_Responder (event_t* ev)
plyr->message = DEH_String(STSTR_FAADDED);
}
// 'kfa' cheat for key full ammo
- else if (cht_CheckCheat(&cheat_ammo, ev->data2))
+ else if (cht_CheckCheat(&cheat_ammo, ev->data1))
{
plyr->armorpoints = deh_idkfa_armor;
plyr->armortype = deh_idkfa_armor_class;
@@ -520,7 +520,7 @@ ST_Responder (event_t* ev)
plyr->message = DEH_String(STSTR_KFAADDED);
}
// 'mus' cheat for changing music
- else if (cht_CheckCheat(&cheat_mus, ev->data2))
+ else if (cht_CheckCheat(&cheat_mus, ev->data1))
{
char buf[3];
@@ -549,9 +549,9 @@ ST_Responder (event_t* ev)
}
}
else if ( (gamemission == doom
- && cht_CheckCheat(&cheat_noclip, ev->data2))
+ && cht_CheckCheat(&cheat_noclip, ev->data1))
|| (gamemission != doom
- && cht_CheckCheat(&cheat_commercial_noclip,ev->data2)))
+ && cht_CheckCheat(&cheat_commercial_noclip,ev->data1)))
{
// Noclip cheat.
// For Doom 1, use the idspipsopd cheat; for all others, use
@@ -567,7 +567,7 @@ ST_Responder (event_t* ev)
// 'behold?' power-up cheats
for (i=0;i<6;i++)
{
- if (cht_CheckCheat(&cheat_powerup[i], ev->data2))
+ if (cht_CheckCheat(&cheat_powerup[i], ev->data1))
{
if (!plyr->powers[i])
P_GivePower( plyr, i);
@@ -581,19 +581,19 @@ ST_Responder (event_t* ev)
}
// 'behold' power-up menu
- if (cht_CheckCheat(&cheat_powerup[6], ev->data2))
+ if (cht_CheckCheat(&cheat_powerup[6], ev->data1))
{
plyr->message = DEH_String(STSTR_BEHOLD);
}
// 'choppers' invulnerability & chainsaw
- else if (cht_CheckCheat(&cheat_choppers, ev->data2))
+ else if (cht_CheckCheat(&cheat_choppers, ev->data1))
{
plyr->weaponowned[wp_chainsaw] = true;
plyr->powers[pw_invulnerability] = true;
plyr->message = DEH_String(STSTR_CHOPPERS);
}
// 'mypos' for player position
- else if (cht_CheckCheat(&cheat_mypos, ev->data2))
+ else if (cht_CheckCheat(&cheat_mypos, ev->data1))
{
static char buf[ST_MSGWIDTH];
sprintf(buf, "ang=0x%x;x,y=(0x%x,0x%x)",
@@ -605,7 +605,7 @@ ST_Responder (event_t* ev)
}
// 'clev' change-level cheat
- if (cht_CheckCheat(&cheat_clev, ev->data2))
+ if (cht_CheckCheat(&cheat_clev, ev->data1))
{
char buf[3];
int epsd;