Rename CVARs

This commit is contained in:
Jaime Ita Passos 2020-11-25 18:26:41 -03:00
parent 2f59b84460
commit bd3e1d37e6
7 changed files with 34 additions and 34 deletions

View file

@ -1259,8 +1259,8 @@ boolean CON_Responder(event_t *ev)
return true;
}
#ifdef HAVE_TEXTINPUT
if (!cv_textinput.value)
#ifdef TEXTINPUTEVENTS
if (!cv_keyboardlocale.value)
#endif
{
// allow people to use keypad in console (good for typing IP addresses) - Calum

View file

@ -817,20 +817,20 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_joyscale);
CV_RegisterVar(&cv_joyscale2);
// * cv_textinput allows "text input" events from SDL,
// so that console and chat is guaranteed to use
// the player's keyboard locale reliably
// * When disabled, the game will fallback to using
// keycode events, still following the player's locale
// * If cv_keyboardlocale is disabled, input will default
// to using the US keyboard layout
// * cv_forceqwerty forces a QWERTY layout, but only
// if text input events are disabled
// * cv_keyboardlocale uses text input events from the interface,
// so that the console, chat, and menu are guaranteed to
// use the player's keyboard locale.
// * If cv_usekeycodes is enabled, but cv_keyboardlocale is enabled,
// the game will use keycode events.
// * If cv_keyboardlocale is disabled, and cv_usekeycodes is disabled,
// the game will use scancode events.
// * cv_forceqwerty forces a QWERTY layout,
// if cv_keyboardlocale is disabled, and cv_usekeycodes is enabled.
#ifdef HAVE_TEXTINPUT
CV_RegisterVar (&cv_textinput);
#endif
#ifdef TEXTINPUTEVENTS
CV_RegisterVar (&cv_keyboardlocale);
#endif
CV_RegisterVar (&cv_usekeycodes);
CV_RegisterVar (&cv_forceqwerty);
// Analog Control

View file

@ -629,7 +629,7 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
#define SECTORSPECIALSAFTERTHINK
/// Text input events
#define HAVE_TEXTINPUT
#define TEXTINPUTEVENTS
/// Sprite rotation
#define ROTSPRITE

View file

@ -25,10 +25,10 @@ static CV_PossibleValue_t keyboardlocale_cons_t[] = {
{2, "Only in text fields"},
{0, NULL}};
#ifdef HAVE_TEXTINPUT
consvar_t cv_textinput = CVAR_INIT ("textinput", "On", CV_SAVE, CV_OnOff, NULL);
#ifdef TEXTINPUTEVENTS
consvar_t cv_keyboardlocale = CVAR_INIT ("keyboardlocale", "On", CV_SAVE, CV_OnOff, NULL);
#endif
consvar_t cv_keyboardlocale = CVAR_INIT ("keyboardlocale", "Off", CV_SAVE, keyboardlocale_cons_t, NULL);
consvar_t cv_usekeycodes = CVAR_INIT ("usekeycodes", "Off", CV_SAVE, keyboardlocale_cons_t, NULL);
consvar_t cv_forceqwerty = CVAR_INIT ("forceqwerty", "Off", CV_SAVE, CV_OnOff, NULL);
#define MAXMOUSESENSITIVITY 100 // sensitivity steps

View file

@ -111,10 +111,10 @@ typedef enum
num_gamecontrolschemes
} gamecontrolschemes_e;
#ifdef HAVE_TEXTINPUT
extern consvar_t cv_textinput;
#endif
#ifdef TEXTINPUTEVENTS
extern consvar_t cv_keyboardlocale;
#endif
extern consvar_t cv_usekeycodes;
extern consvar_t cv_forceqwerty;
// mouse values are used once

View file

@ -1167,8 +1167,8 @@ boolean HU_Responder(event_t *ev)
c = (INT32)ev->data1;
#ifdef HAVE_TEXTINPUT
if (!cv_textinput.value)
#ifdef TEXTINPUTEVENTS
if (!cv_keyboardlocale.value)
#endif
{
// I know this looks very messy but this works. If it ain't broke, don't fix it!

View file

@ -278,13 +278,13 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Keysym keysym, Uint32 type)
SDL_Keycode keycode = keysym.sym;
boolean useqwerty = true;
boolean uselocale = (!!cv_keyboardlocale.value);
boolean uselocale = (!!cv_usekeycodes.value);
#ifdef HAVE_TEXTINPUT
if (cv_textinput.value)
#ifdef TEXTINPUTEVENTS
if (cv_keyboardlocale.value)
uselocale = true;
#else
if (cv_keyboardlocale.value == 2
if (cv_usekeycodes.value == 2
&& !(CON_AcceptInput() || M_TextInput() || HU_ChatActive()))
uselocale = false;
#endif
@ -338,8 +338,8 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Keysym keysym, Uint32 type)
// Send key up events to avoid stuck movement keys
if (type != SDL_KEYUP && (!ctrldown))
{
#ifdef HAVE_TEXTINPUT
if (cv_textinput.value)
#ifdef TEXTINPUTEVENTS
if (cv_keyboardlocale.value)
{
// console input
if (CON_AcceptInput())
@ -476,11 +476,11 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Keysym keysym, Uint32 type)
return KEY_F1 + (scancode - SDL_SCANCODE_F1);
}
#ifdef HAVE_TEXTINPUT
#ifdef TEXTINPUTEVENTS
// Send key up events to avoid stuck movement keys
if (type != SDL_KEYUP && (!ctrldown))
{
if (cv_textinput.value)
if (cv_keyboardlocale.value)
{
// console input
if (CON_AcceptInput())
@ -842,12 +842,12 @@ static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type)
if (event.data1) D_PostEvent(&event);
}
#ifdef HAVE_TEXTINPUT
#ifdef TEXTINPUTEVENTS
static void Impl_HandleTextInputEvent(char *text)
{
event_t event;
if (!cv_textinput.value)
if (!cv_keyboardlocale.value)
return;
if (!(CON_AcceptInput() // console input
@ -1112,7 +1112,7 @@ void I_GetEvent(void)
case SDL_KEYDOWN:
Impl_HandleKeyboardEvent(evt.key, evt.type);
break;
#ifdef HAVE_TEXTINPUT
#ifdef TEXTINPUTEVENTS
case SDL_TEXTINPUT:
Impl_HandleTextInputEvent(evt.text.text);
break;