mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-25 05:41:42 +00:00
Fixes
This commit is contained in:
parent
bd3e1d37e6
commit
82bd4a1967
2 changed files with 75 additions and 55 deletions
51
src/m_menu.c
51
src/m_menu.c
|
@ -3110,8 +3110,13 @@ static boolean M_ChangeStringCvar(INT32 choice)
|
||||||
char buf[MAXSTRINGLENGTH];
|
char buf[MAXSTRINGLENGTH];
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
if (shiftdown && choice >= 32 && choice <= 127)
|
#ifdef TEXTINPUTEVENTS
|
||||||
choice = shiftxform[choice];
|
if (!cv_keyboardlocale.value)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (shiftdown && choice >= 32 && choice <= 127)
|
||||||
|
choice = shiftxform[choice];
|
||||||
|
}
|
||||||
|
|
||||||
switch (choice)
|
switch (choice)
|
||||||
{
|
{
|
||||||
|
@ -3194,10 +3199,29 @@ static void Command_Manual_f(void)
|
||||||
|
|
||||||
boolean M_TextInput(void)
|
boolean M_TextInput(void)
|
||||||
{
|
{
|
||||||
// Of course return false if the menus are down...
|
menuitem_t *item = &(currentMenu->menuitems[itemOn]);
|
||||||
|
|
||||||
|
// Return false if the menus are not active.
|
||||||
if (!menuactive)
|
if (!menuactive)
|
||||||
return false;
|
return false;
|
||||||
return ((currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_KEYHANDLER);
|
|
||||||
|
if (item->itemaction)
|
||||||
|
{
|
||||||
|
if ((item->status & IT_TYPE) == IT_KEYHANDLER)
|
||||||
|
{
|
||||||
|
void (*action)(INT32 choice) = item->itemaction;
|
||||||
|
if (action == M_HandleAddons)
|
||||||
|
return true;
|
||||||
|
else if (action == M_HandleSetupMultiPlayer)
|
||||||
|
return (itemOn == 0);
|
||||||
|
else if (action == M_HandleConnectIP)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if ((item->status & IT_TYPE) == IT_CVAR)
|
||||||
|
return ((item->status & IT_CVARTYPE) == IT_CV_STRING);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -3427,8 +3451,14 @@ boolean M_Responder(event_t *ev)
|
||||||
// Handle menuitems which need a specific key handling
|
// Handle menuitems which need a specific key handling
|
||||||
if (routine && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_KEYHANDLER)
|
if (routine && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_KEYHANDLER)
|
||||||
{
|
{
|
||||||
if (shiftdown && ch >= 32 && ch <= 127)
|
#ifdef TEXTINPUTEVENTS
|
||||||
ch = shiftxform[ch];
|
if (!(cv_keyboardlocale.value && M_TextInput()))
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (shiftdown && ch >= 32 && ch <= 127)
|
||||||
|
ch = shiftxform[ch];
|
||||||
|
}
|
||||||
|
|
||||||
routine(ch);
|
routine(ch);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -6608,8 +6638,13 @@ static void M_AddonExec(INT32 ch)
|
||||||
#define len menusearch[0]
|
#define len menusearch[0]
|
||||||
static boolean M_ChangeStringAddons(INT32 choice)
|
static boolean M_ChangeStringAddons(INT32 choice)
|
||||||
{
|
{
|
||||||
if (shiftdown && choice >= 32 && choice <= 127)
|
#ifdef TEXTINPUTEVENTS
|
||||||
choice = shiftxform[choice];
|
if (!cv_keyboardlocale.value)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (shiftdown && choice >= 32 && choice <= 127)
|
||||||
|
choice = shiftxform[choice];
|
||||||
|
}
|
||||||
|
|
||||||
switch (choice)
|
switch (choice)
|
||||||
{
|
{
|
||||||
|
|
|
@ -277,19 +277,17 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Keysym keysym, Uint32 type)
|
||||||
SDL_Scancode scancode = keysym.scancode;
|
SDL_Scancode scancode = keysym.scancode;
|
||||||
SDL_Keycode keycode = keysym.sym;
|
SDL_Keycode keycode = keysym.sym;
|
||||||
|
|
||||||
boolean useqwerty = true;
|
boolean intextfield = (CON_AcceptInput() || M_TextInput() || HU_ChatActive());
|
||||||
boolean uselocale = (!!cv_usekeycodes.value);
|
boolean usekeycodes = (!!cv_usekeycodes.value);
|
||||||
|
boolean forceqwerty = (!!cv_forceqwerty.value);
|
||||||
|
|
||||||
#ifdef TEXTINPUTEVENTS
|
// Only use keycodes in text fields
|
||||||
if (cv_keyboardlocale.value)
|
if (cv_usekeycodes.value == 2 && !intextfield)
|
||||||
uselocale = true;
|
{
|
||||||
#else
|
usekeycodes = false;
|
||||||
if (cv_usekeycodes.value == 2
|
}
|
||||||
&& !(CON_AcceptInput() || M_TextInput() || HU_ChatActive()))
|
|
||||||
uselocale = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (uselocale)
|
if (usekeycodes)
|
||||||
{
|
{
|
||||||
// Lactozilla: Use keycodes instead of scancodes, so that non-US keyboards can work.
|
// Lactozilla: Use keycodes instead of scancodes, so that non-US keyboards can work.
|
||||||
switch (keycode)
|
switch (keycode)
|
||||||
|
@ -335,29 +333,14 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Keysym keysym, Uint32 type)
|
||||||
return KEY_F1 + (keycode - SDLK_F1);
|
return KEY_F1 + (keycode - SDLK_F1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send key up events to avoid stuck movement keys
|
|
||||||
if (type != SDL_KEYUP && (!ctrldown))
|
|
||||||
{
|
|
||||||
#ifdef TEXTINPUTEVENTS
|
#ifdef TEXTINPUTEVENTS
|
||||||
if (cv_keyboardlocale.value)
|
// Don't send key events if a text field is active.
|
||||||
{
|
// Send key up events to avoid stuck movement keys.
|
||||||
// console input
|
if (type != SDL_KEYUP && (!ctrldown) && cv_keyboardlocale.value && intextfield)
|
||||||
if (CON_AcceptInput())
|
{
|
||||||
return 0;
|
return 0;
|
||||||
// menu text input
|
|
||||||
if (M_TextInput())
|
|
||||||
return 0;
|
|
||||||
// chat input
|
|
||||||
if (HU_ChatActive())
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (CON_AcceptInput() // console input
|
|
||||||
|| M_TextInput() // menu text input
|
|
||||||
|| HU_ChatActive()) // chat input
|
|
||||||
useqwerty = (cv_forceqwerty.value);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (keycode)
|
switch (keycode)
|
||||||
{
|
{
|
||||||
|
@ -411,23 +394,35 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Keysym keysym, Uint32 type)
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useqwerty)
|
if (forceqwerty)
|
||||||
{
|
{
|
||||||
if (scancode >= SDL_SCANCODE_A && scancode <= SDL_SCANCODE_Z)
|
if (scancode >= SDL_SCANCODE_A && scancode <= SDL_SCANCODE_Z)
|
||||||
|
{
|
||||||
return scancode - SDL_SCANCODE_A + 'a';
|
return scancode - SDL_SCANCODE_A + 'a';
|
||||||
|
}
|
||||||
else if (scancode >= SDL_SCANCODE_1 && scancode <= SDL_SCANCODE_9)
|
else if (scancode >= SDL_SCANCODE_1 && scancode <= SDL_SCANCODE_9)
|
||||||
|
{
|
||||||
return scancode - SDL_SCANCODE_1 + '1';
|
return scancode - SDL_SCANCODE_1 + '1';
|
||||||
|
}
|
||||||
else if (scancode == SDL_SCANCODE_0)
|
else if (scancode == SDL_SCANCODE_0)
|
||||||
|
{
|
||||||
return '0';
|
return '0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (keycode >= SDLK_a && keycode <= SDLK_z)
|
if (keycode >= SDLK_a && keycode <= SDLK_z)
|
||||||
|
{
|
||||||
return keycode - SDLK_a + 'a';
|
return keycode - SDLK_a + 'a';
|
||||||
|
}
|
||||||
else if (keycode >= SDLK_1 && keycode <= SDLK_9)
|
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';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -477,21 +472,11 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Keysym keysym, Uint32 type)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TEXTINPUTEVENTS
|
#ifdef TEXTINPUTEVENTS
|
||||||
// Send key up events to avoid stuck movement keys
|
// Don't send key events if a text field is active.
|
||||||
if (type != SDL_KEYUP && (!ctrldown))
|
// Send key up events to avoid stuck movement keys.
|
||||||
|
if (type != SDL_KEYUP && (!ctrldown) && cv_keyboardlocale.value && intextfield)
|
||||||
{
|
{
|
||||||
if (cv_keyboardlocale.value)
|
return 0;
|
||||||
{
|
|
||||||
// console input
|
|
||||||
if (CON_AcceptInput())
|
|
||||||
return 0;
|
|
||||||
// menu text input
|
|
||||||
if (M_TextInput())
|
|
||||||
return 0;
|
|
||||||
// chat input
|
|
||||||
if (HU_ChatActive())
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue