From 70a7d1bd820ab23c088a98f7c4699bf2b3cd27dc Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 26 Oct 2019 21:16:23 +0200 Subject: [PATCH] - save all bound keys, not only the one with commands that have both slots assigned. --- source/common/gameconfigfile.cpp | 3 +- source/common/gamecontrol.cpp | 51 ++++++++++++++++---------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/source/common/gameconfigfile.cpp b/source/common/gameconfigfile.cpp index 0d039f3d5..1ce61e657 100644 --- a/source/common/gameconfigfile.cpp +++ b/source/common/gameconfigfile.cpp @@ -443,7 +443,8 @@ void FGameConfigFile::ArchiveGameData (const char *gamename) if (symb == NULL || symb->name == nullptr ||symb->help == nullptr) break; - SetValueForKey(symb->name, symb->help); + if (symb->func == (void*)OSD_ALIAS) + SetValueForKey(symb->name, symb->help); } } #endif diff --git a/source/common/gamecontrol.cpp b/source/common/gamecontrol.cpp index 5ee3425ec..bc4221d03 100644 --- a/source/common/gamecontrol.cpp +++ b/source/common/gamecontrol.cpp @@ -305,33 +305,32 @@ void CONFIG_SetDefaultKeys(const char *defbinds, bool lazy/*=false*/) { sc.MustGetToken(TK_StringConst); default1 = KB_StringToScanCode(sc.String); - if (num >= 0 && num < NUMGAMEFUNCTIONS) - { - auto& key = KeyboardKeys[num]; -#if 0 - // skip the function if the default key is already used - // or the function is assigned to another key - if (lazy && (key[0] != 0xff || (CONTROL_KeyIsBound(default0) && Bstrlen(CONTROL_KeyBinds[default0].cmdstr) > strlen_gamefunc_ - && CONFIG_FunctionNameToNum(CONTROL_KeyBinds[default0].cmdstr + strlen_gamefunc_) >= 0))) - { - continue; - } -#endif - key[0] = default0; - key[1] = default1; - - if (key[0]) CONTROL_FreeKeyBind(key[0]); - if (key[1]) CONTROL_FreeKeyBind(key[1]); - - if (num == gamefunc_Show_Console) - OSD_CaptureKey(key[0]); - else - CONFIG_MapKey(num, key[0], 0, key[1], 0); - - CONTROL_DefineFlag(num, false); - - } } + if (num >= 0 && num < NUMGAMEFUNCTIONS) + { + auto& key = KeyboardKeys[num]; +#if 0 + // skip the function if the default key is already used + // or the function is assigned to another key + if (lazy && (key[0] != 0xff || (CONTROL_KeyIsBound(default0) && Bstrlen(CONTROL_KeyBinds[default0].cmdstr) > strlen_gamefunc_ + && CONFIG_FunctionNameToNum(CONTROL_KeyBinds[default0].cmdstr + strlen_gamefunc_) >= 0))) + { + continue; + } +#endif + key[0] = default0; + key[1] = default1; + + if (key[0]) CONTROL_FreeKeyBind(key[0]); + if (key[1]) CONTROL_FreeKeyBind(key[1]); + + if (num == gamefunc_Show_Console) + OSD_CaptureKey(key[0]); + else + CONFIG_MapKey(num, key[0], 0, key[1], 0); + + } + CONTROL_DefineFlag(num, false); } }