Commit 30baffe7 authored by Dino Bollinger's avatar Dino Bollinger Committed by Richard Gobeille
Browse files

Duke3D: Add console cvar 'cl_kbconfirm' to toggle the keybind confirmation dialog

parent b42d4f70
......@@ -296,7 +296,8 @@ static char const *MEOSN_Gamefuncs[NUMGAMEFUNCTIONS+1];
static int32_t MEOSV_Gamefuncs[NUMGAMEFUNCTIONS+1];
static MenuOptionSet_t MEOS_Gamefuncs = MAKE_MENUOPTIONSET( MEOSN_Gamefuncs, MEOSV_Gamefuncs, 0x1 );
int32_t kbo_type_cvar = 1;
int32_t cvar_kbo_type = 1;
int32_t cvar_kbconfirm = 1;
static int g_lookAxis = -1;
static int g_turnAxis = -1;
......@@ -1955,13 +1956,13 @@ static void Menu_EraseMatchingBinds(const int32_t sc)
}
}
static void Menu_SetKeyboardScanCode(MenuCustom2Col_t* column, const int32_t sc, const bool override)
static void Menu_SetKeyboardScanCode(MenuCustom2Col_t* column, const int32_t sc, const bool eraseBinds)
{
char key[2];
key[0] = ud.config.KeyboardKeys[column->linkIndex][0];
key[1] = ud.config.KeyboardKeys[column->linkIndex][1];
if (override) Menu_EraseMatchingBinds(sc);
if (eraseBinds) Menu_EraseMatchingBinds(sc);
*column->column[M_KEYBOARDKEYS.currentColumn] = sc;
CONFIG_MapKey(column->linkIndex,
......@@ -1984,7 +1985,7 @@ void Menu_Init(void)
else
{
// else, change based on cvar
if (kbo_type_cvar == 1)
if (cvar_kbo_type == 1)
init_keybind_order = keybind_order_modern;
else
init_keybind_order = keybind_order_classic;
......@@ -3641,7 +3642,7 @@ static int32_t Menu_PreCustom2ColScreen(MenuEntry_t *entry)
}
S_PlaySound(PISTOL_BODYHIT);
if (alreadyAssigned)
if (cvar_kbconfirm && alreadyAssigned)
{
s_saved_scancode = sc;
s_saved_keycolumn = column;
......
......@@ -38,7 +38,8 @@ extern "C" {
# define EDUKE32_ANDROID_MENU
#endif
extern int32_t kbo_type_cvar;
extern int32_t cvar_kbo_type;
extern int32_t cvar_kbconfirm;
// #define EDUKE32_SIMPLE_MENU
......
......@@ -621,7 +621,7 @@ static int osdcmd_setvar(osdcmdptr_t parm)
if (parm->numparms != 2)
return OSDCMD_SHOWHELP;
int i = hash_find(&h_gamevars, parm->parms[1]);
int const newValue = (i == -1) ? Batol(parm->parms[1]) : Gv_GetVar(i, g_player[myconnectindex].ps->i, myconnectindex);
......@@ -1621,7 +1621,9 @@ int32_t registerosdcommands(void)
{ "cl_weaponsway", "weapon sways when moving" CVAR_BOOL_OPTSTR, (void *)&ud.weaponsway, CVAR_BOOL, 0, 1 },
{ "cl_weaponswitch", "bitmask controlling switching weapon when out of ammo or a new weapon is picked up:\n 0: disabled\n 1: if new\n 2: if empty\n 4: determined by wchoice", (void *)&ud.weaponswitch, CVAR_INT|CVAR_MULTI, 0, 7 },
{ "cl_keybindorder", "default order for the keybind menu (overridden by custom order, requires a restart):\n 0: classic\n 1: modern", (void *)&kbo_type_cvar, CVAR_BOOL, 0, 1 },
{ "cl_keybindorder", "default order for the keybind menu (overridden by custom order, requires a restart):\n 0: classic\n 1: modern", (void *)&cvar_kbo_type, CVAR_BOOL, 0, 1 },
{ "cl_kbconfirm", "on assigning a keyboard bind, will display a confirmation dialog if key is already assigned:\n 0: disabled\n 1: enabled", (void *)&cvar_kbconfirm, CVAR_BOOL, 0, 1 },
{ "color", "player palette", (void *)&ud.color, CVAR_INT|CVAR_MULTI, 0, MAXPALOOKUPS-1 },
......@@ -1848,4 +1850,3 @@ int32_t registerosdcommands(void)
return 0;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment