Fix console key changing breakage

git-svn-id: https://svn.eduke32.com/eduke32@3128 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2012-11-08 17:00:31 +00:00
parent 0f35221820
commit d37e1093f5
3 changed files with 13 additions and 23 deletions

View file

@ -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;

View file

@ -3782,9 +3782,7 @@ 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]);
}

View file

@ -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);