diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 4f1cdb61e..4d6479f7e 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -148,33 +148,19 @@ const char *CONFIG_AnalogNumToName(int32_t func) void CONFIG_SetDefaultKeys(int32_t type) { int32_t i,f; + const char (*keyptr)[MAXGAMEFUNCLEN] = type ? oldkeydefaults : keydefaults; Bmemset(ud.config.KeyboardKeys, 0xff, sizeof(ud.config.KeyboardKeys)); Bmemset(&KeyBindings,0,sizeof(KeyBindings)); Bmemset(&MouseBindings,0,sizeof(MouseBindings)); - if (type == 1) - { - for (i=0; i < (int32_t)(sizeof(oldkeydefaults)/sizeof(oldkeydefaults[0])); i+=3) - { - f = CONFIG_FunctionNameToNum(oldkeydefaults[i+0]); - if (f == -1) continue; - ud.config.KeyboardKeys[f][0] = KB_StringToScanCode(oldkeydefaults[i+1]); - ud.config.KeyboardKeys[f][1] = KB_StringToScanCode(oldkeydefaults[i+2]); - - if (f == gamefunc_Show_Console) OSD_CaptureKey(ud.config.KeyboardKeys[f][0]); - else CONFIG_MapKey(f, ud.config.KeyboardKeys[f][0], 0, ud.config.KeyboardKeys[f][1], 0); - } - return; - } - for (i=0; i < (int32_t)(sizeof(keydefaults)/sizeof(keydefaults[0])); i+=3) { - f = CONFIG_FunctionNameToNum(keydefaults[i+0]); + f = CONFIG_FunctionNameToNum(keyptr[i+0]); if (f == -1) continue; - ud.config.KeyboardKeys[f][0] = KB_StringToScanCode(keydefaults[i+1]); - ud.config.KeyboardKeys[f][1] = KB_StringToScanCode(keydefaults[i+2]); + ud.config.KeyboardKeys[f][0] = KB_StringToScanCode(keyptr[i+1]); + ud.config.KeyboardKeys[f][1] = KB_StringToScanCode(keyptr[i+2]); if (f == gamefunc_Show_Console) OSD_CaptureKey(ud.config.KeyboardKeys[f][0]); else CONFIG_MapKey(f, ud.config.KeyboardKeys[f][0], 0, ud.config.KeyboardKeys[f][1], 0); @@ -351,6 +337,9 @@ void CONFIG_MapKey(int32_t which, kb_scancode key1, kb_scancode oldkey1, kb_scan UNREFERENCED_PARAMETER(which); // CONTROL_MapKey(which, key1, key2); + if (which == gamefunc_Show_Console) + OSD_CaptureKey(key1); + for (k = 0; (unsigned)k < (sizeof(ii) / sizeof(ii[0])); k++) { if (ii[k] == 0xff || !ii[k]) continue; diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 0100d5361..f93efa204 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -3782,10 +3782,8 @@ cheat_for_port_credits2: S_PlaySound(PISTOL_BODYHIT); ud.config.KeyboardKeys[function][whichkey] = KB_GetLastScanCode(); - if (function == gamefunc_Show_Console) - OSD_CaptureKey(KB_GetLastScanCode()); - else - CONFIG_MapKey(function, ud.config.KeyboardKeys[function][0], key[0], ud.config.KeyboardKeys[function][1], key[1]); + + CONFIG_MapKey(function, ud.config.KeyboardKeys[function][0], key[0], ud.config.KeyboardKeys[function][1], key[1]); } M_ChangeMenu(MENU_KEYBOARDSETUP); diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index b971ed400..92ee7e59f 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -1035,6 +1035,9 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm) ud.config.KeyboardKeys[j][1] = ud.config.KeyboardKeys[j][0]; ud.config.KeyboardKeys[j][0] = ConsoleKeys[i].id; // CONTROL_MapKey(j, ConsoleKeys[i].id, ud.config.KeyboardKeys[j][0]); + + if (j == gamefunc_Show_Console) + OSD_CaptureKey(ConsoleKeys[i].id); } } } @@ -1548,7 +1551,7 @@ int32_t registerosdcommands(void) char *t; int32_t j; - if (!Bstrcmp(gamefunctions[i],"Show_Console")) continue; +// if (!Bstrcmp(gamefunctions[i],"Show_Console")) continue; Bsprintf(tempbuf,"gamefunc_%s",gamefunctions[i]); t = Bstrdup(tempbuf);