Skip to content
Snippets Groups Projects
Commit ac74abb3 authored by Lactozilla's avatar Lactozilla :speech_balloon:
Browse files

Fix directional / game input by forcing QWERTY for non-text input

parent faeae694
No related branches found
No related tags found
No related merge requests found
...@@ -148,6 +148,9 @@ extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_fu ...@@ -148,6 +148,9 @@ extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_fu
// wait for page flipping to end or not // wait for page flipping to end or not
extern consvar_t cv_vidwait; extern consvar_t cv_vidwait;
// This is an annoying place to put this cvar on
extern consvar_t cv_forceqwerty;
// quick fix for tall/short skies, depending on bytesperpixel // quick fix for tall/short skies, depending on bytesperpixel
extern void (*walldrawerfunc)(void); extern void (*walldrawerfunc)(void);
......
...@@ -102,6 +102,9 @@ static consvar_t cv_stretch = {"stretch", "Off", CV_SAVE|CV_NOSHOWHELP, CV_OnOff ...@@ -102,6 +102,9 @@ static consvar_t cv_stretch = {"stretch", "Off", CV_SAVE|CV_NOSHOWHELP, CV_OnOff
UINT8 graphics_started = 0; // Is used in console.c and screen.c UINT8 graphics_started = 0; // Is used in console.c and screen.c
// Lactozilla: keyboard input
consvar_t cv_forceqwerty = {"forceqwerty", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
// To disable fullscreen at startup; is set in VID_PrepareModeList // To disable fullscreen at startup; is set in VID_PrepareModeList
boolean allow_fullscreen = false; boolean allow_fullscreen = false;
static SDL_bool disable_fullscreen = SDL_FALSE; static SDL_bool disable_fullscreen = SDL_FALSE;
...@@ -380,19 +383,26 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code, Uint32 type) ...@@ -380,19 +383,26 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code, Uint32 type)
default: break; default: break;
} }
if (keycode >= SDLK_a && keycode <= SDLK_z) // Tested by installing a French keymap
if (cv_forceqwerty.value)
{ {
// get lowercase ASCII if (code >= SDL_SCANCODE_A && code <= SDL_SCANCODE_Z)
return keycode - SDLK_a + 'a'; return code - SDL_SCANCODE_A + 'a';
else if (code >= SDL_SCANCODE_1 && code <= SDL_SCANCODE_9)
return code - SDL_SCANCODE_1 + '1';
else if (code == SDL_SCANCODE_0)
return '0';
} }
if (keycode >= SDLK_1 && keycode <= SDLK_9) else
{ {
if (keycode >= SDLK_a && keycode <= SDLK_z)
return keycode - SDLK_a + 'a';
else if (keycode >= SDLK_1 && keycode <= SDLK_9)
return keycode - SDLK_1 + '1'; return keycode - SDLK_1 + '1';
}
else if (keycode == SDLK_0) else if (keycode == SDLK_0)
{
return '0'; return '0';
} }
#ifdef HWRENDER #ifdef HWRENDER
DBG_Printf("Unknown incoming scancode: %d, represented %c\n", DBG_Printf("Unknown incoming scancode: %d, represented %c\n",
code, code,
...@@ -1668,6 +1678,9 @@ void I_StartupGraphics(void) ...@@ -1668,6 +1678,9 @@ void I_StartupGraphics(void)
disable_mouse = M_CheckParm("-nomouse"); disable_mouse = M_CheckParm("-nomouse");
disable_fullscreen = M_CheckParm("-win") ? 1 : 0; disable_fullscreen = M_CheckParm("-win") ? 1 : 0;
// Lactozilla
CV_RegisterVar (&cv_forceqwerty);
keyboard_started = true; keyboard_started = true;
#if !defined(HAVE_TTF) #if !defined(HAVE_TTF)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment