fix shifted keys when typing savegame names

Fixes #1773
This commit is contained in:
Fabian Greffrath 2024-07-13 21:28:14 +02:00
parent 4b1a859f95
commit 4c4e9af6fe
2 changed files with 12 additions and 1 deletions

View File

@ -101,6 +101,8 @@ void HU_BindHUDVariables(void);
byte* HU_ColorByHealth(int health, int maxhealth, boolean invul); byte* HU_ColorByHealth(int health, int maxhealth, boolean invul);
extern const char shiftxform[];
extern int speedometer; extern int speedometer;
#endif #endif

View File

@ -32,6 +32,7 @@
#include "d_event.h" #include "d_event.h"
#include "d_main.h" #include "d_main.h"
#include "doomdef.h" #include "doomdef.h"
#include "doomkeys.h"
#include "doomstat.h" #include "doomstat.h"
#include "doomtype.h" #include "doomtype.h"
#include "dstrings.h" #include "dstrings.h"
@ -2536,6 +2537,7 @@ boolean M_Responder(event_t *ev)
{ {
int ch; int ch;
static int joywait = 0; static int joywait = 0;
static boolean shiftdown = false;
static menu_action_t repeat = MENU_NULL; static menu_action_t repeat = MENU_NULL;
menu_action_t action = MENU_NULL; menu_action_t action = MENU_NULL;
@ -2544,6 +2546,12 @@ boolean M_Responder(event_t *ev)
ch = 0; // will be changed to a legit char if we're going to use it here ch = 0; // will be changed to a legit char if we're going to use it here
if (ev->data1 == KEY_RSHIFT)
{
shiftdown = (ev->type == ev_keydown);
return false;
}
switch (ev->type) switch (ev->type)
{ {
// "close" button pressed on window? // "close" button pressed on window?
@ -2702,7 +2710,8 @@ boolean M_Responder(event_t *ev)
} }
else else
{ {
ch = M_ToUpper(ch); if (shiftdown || (ch >= 'a' && ch <= 'z'))
ch = shiftxform[ch];
if (ch >= 32 && ch <= 127 && saveCharIndex < SAVESTRINGSIZE - 1 if (ch >= 32 && ch <= 127 && saveCharIndex < SAVESTRINGSIZE - 1
&& MN_StringWidth(savegamestrings[saveSlot]) && MN_StringWidth(savegamestrings[saveSlot])