diff --git a/src/screen.h b/src/screen.h index 4a41e5879db85f85311c9284cae802cc5d1d607f..ea493cbc328fcd5e97eb7bbaf17714caa919d5cd 100644 --- a/src/screen.h +++ b/src/screen.h @@ -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 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 extern void (*walldrawerfunc)(void); diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index ad255c79907ccf161b1dee87f664e93f07dcc879..c3565488aad3f72b5c3d9796d15c5b245ac18eb9 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -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 +// 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 boolean allow_fullscreen = false; static SDL_bool disable_fullscreen = SDL_FALSE; @@ -380,19 +383,26 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code, Uint32 type) default: break; } - if (keycode >= SDLK_a && keycode <= SDLK_z) - { - // get lowercase ASCII - return keycode - SDLK_a + 'a'; - } - if (keycode >= SDLK_1 && keycode <= SDLK_9) + // Tested by installing a French keymap + if (cv_forceqwerty.value) { - return keycode - SDLK_1 + '1'; + if (code >= SDL_SCANCODE_A && code <= SDL_SCANCODE_Z) + 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'; } - else if (keycode == SDLK_0) + else { - return '0'; + 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'; + else if (keycode == SDLK_0) + return '0'; } + #ifdef HWRENDER DBG_Printf("Unknown incoming scancode: %d, represented %c\n", code, @@ -1668,6 +1678,9 @@ void I_StartupGraphics(void) disable_mouse = M_CheckParm("-nomouse"); disable_fullscreen = M_CheckParm("-win") ? 1 : 0; + // Lactozilla + CV_RegisterVar (&cv_forceqwerty); + keyboard_started = true; #if !defined(HAVE_TTF)