diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 9ccaf4e8b..31c90f5bf 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -152,6 +152,7 @@ void CONFIG_SetDefaultKeys(int type) Bmemset(ud.config.KeyboardKeys, 0xff, sizeof(ud.config.KeyboardKeys)); Bmemset(&boundkeys,0,sizeof(boundkeys)); + Bmemset(&mousebind,0,sizeof(mousebind)); if (type == 1) { @@ -333,7 +334,7 @@ void CONFIG_SetDefaults(void) void CONFIG_ReadKeys(void) { - int32 i, j; + int32 i; int32 numkeyentries; int32 function; char keyname1[80]; @@ -373,6 +374,7 @@ void CONFIG_ReadKeys(void) } ud.config.KeyboardKeys[function][0] = key1; ud.config.KeyboardKeys[function][1] = key2; +/* if (key1 != 0xff && keyname1[0]) { boundkeys[key1].repeat = 1; @@ -382,14 +384,14 @@ void CONFIG_ReadKeys(void) if (keynames[j].name) boundkeys[key1].key=Bstrdup(keynames[j].name); else boundkeys[key1].key=Bstrdup(keyname1); - Bsprintf(tempbuf,"gamefunc_%s",CONFIG_FunctionNumToName(function)); + Bsprintf(tempbuf,"gamefunc_%s;",CONFIG_FunctionNumToName(function)); if (!boundkeys[key1].cmd[0] || !Bstrcasecmp(tempbuf,boundkeys[key1].cmd)) { Bstrncpy(boundkeys[key1].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); } else { - Bsprintf(tempbuf,"; gamefunc_%s",CONFIG_FunctionNumToName(function)); + Bsprintf(tempbuf,"gamefunc_%s;",CONFIG_FunctionNumToName(function)); Bstrncat(boundkeys[key1].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); } } @@ -402,17 +404,18 @@ void CONFIG_ReadKeys(void) if (keynames[j].name) boundkeys[key2].key=Bstrdup(keynames[j].name); else boundkeys[key2].key=Bstrdup(keyname2); - Bsprintf(tempbuf,"gamefunc_%s",CONFIG_FunctionNumToName(function)); + Bsprintf(tempbuf,"gamefunc_%s;",CONFIG_FunctionNumToName(function)); if (!boundkeys[key2].cmd[0] || !Bstrcasecmp(tempbuf,boundkeys[key2].cmd)) { Bstrncpy(boundkeys[key2].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); } else { - Bsprintf(tempbuf,"; gamefunc_%s",CONFIG_FunctionNumToName(function)); + Bsprintf(tempbuf,"gamefunc_%s;",CONFIG_FunctionNumToName(function)); Bstrncat(boundkeys[key2].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); } } + */ } } @@ -425,55 +428,43 @@ void CONFIG_ReadKeys(void) } } +// wrapper for CONTROL_MapKey(), generates key bindings to reflect changes to keyboard setup void MapKey(int32 which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2, kb_scancode oldkey2) { - int j; + int i, j, k; + int ii[] = { key1, key2, oldkey1, oldkey2 }; + char buf[128]; CONTROL_MapKey(which, key1, key2); - if (key1 && key1 != 0xff) + + for (k = 0; (unsigned)k < (sizeof(ii) / sizeof(ii[0])); k++) { - boundkeys[key1].repeat = 1; + if (ii[k] == 0xff || !ii[k]) continue; + for (j=0;keynames[j].name;j++) - if (key1 == keynames[j].id) + if (ii[k] == keynames[j].id) break; if (keynames[j].name) - boundkeys[key1].key=Bstrdup(keynames[j].name); + boundkeys[ii[k]].key=Bstrdup(keynames[j].name); - Bsprintf(tempbuf,"gamefunc_%s",CONFIG_FunctionNumToName(which)); - if (!boundkeys[key1].cmd[0] || !Bstrcasecmp(tempbuf,boundkeys[key1].cmd)) - { - Bstrncpy(boundkeys[key1].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); - } - else - { - Bsprintf(tempbuf,"; gamefunc_%s",CONFIG_FunctionNumToName(which)); - Bstrncat(boundkeys[key1].cmd,tempbuf, MAXBINDSTRINGLENGTH-1); - } - } - if (key2 && key2 != 0xff) - { - boundkeys[key2].repeat = 1; - for (j=0;keynames[j].name;j++) - if (key2 == keynames[j].id) - break; - if (keynames[j].name) - boundkeys[key2].key=Bstrdup(keynames[j].name); + boundkeys[ii[k]].repeat = 1; + boundkeys[ii[k]].cmd[0] = 0; + tempbuf[0] = 0; - Bsprintf(tempbuf,"gamefunc_%s",CONFIG_FunctionNumToName(which)); - if (!boundkeys[key2].cmd[0] || !Bstrcasecmp(tempbuf,boundkeys[key2].cmd)) + for (i=0;inext) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index b73b8475a..654111da5 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -151,115 +151,6 @@ static char recbuf[180]; extern void computergetinput(int snum, input *syn); -keydef keynames[]= -{ - { "Escape", 0x1 }, - { "1", 0x2 }, - { "2", 0x3 }, - { "3", 0x4 }, - { "4", 0x5 }, - { "5", 0x6 }, - { "6", 0x7 }, - { "7", 0x8 }, - { "8", 0x9 }, - { "9", 0xa }, - { "0", 0xb }, - { "-", 0xc }, - { "=", 0xd }, - { "BakSpc", 0xe }, - { "Tab", 0xf }, - { "Q", 0x10 }, - { "W", 0x11 }, - { "E", 0x12 }, - { "R", 0x13 }, - { "T", 0x14 }, - { "Y", 0x15 }, - { "U", 0x16 }, - { "I", 0x17 }, - { "O", 0x18 }, - { "P", 0x19 }, - { "[", 0x1a }, - { "]", 0x1b }, - { "Enter", 0x1c }, - { "LCtrl", 0x1d }, - { "A", 0x1e }, - { "S", 0x1f }, - { "D", 0x20 }, - { "F", 0x21 }, - { "G", 0x22 }, - { "H", 0x23 }, - { "J", 0x24 }, - { "K", 0x25 }, - { "L", 0x26 }, - { "SemiColon", 0x27 }, - { "'", 0x28 }, - { "Tilde", 0x29 }, - { "LShift", 0x2a }, - { "\\", 0x2b }, - { "Z", 0x2c }, - { "X", 0x2d }, - { "C", 0x2e }, - { "V", 0x2f }, - { "B", 0x30 }, - { "N", 0x31 }, - { "M", 0x32 }, - { ",", 0x33 }, - { ".", 0x34 }, - { "/", 0x35 }, - { "RShift", 0x36 }, - { "Kpad*", 0x37 }, - { "LAlt", 0x38 }, - { "Space", 0x39 }, - { "CapLck", 0x3a }, - { "F1", 0x3b }, - { "F2", 0x3c }, - { "F3", 0x3d }, - { "F4", 0x3e }, - { "F5", 0x3f }, - { "F6", 0x40 }, - { "F7", 0x41 }, - { "F8", 0x42 }, - { "F9", 0x43 }, - { "F10", 0x44 }, - { "NumLck", 0x45 }, - { "ScrLck", 0x46 }, - { "Kpad7", 0x47 }, - { "Kpad8", 0x48 }, - { "Kpad9", 0x49 }, - { "Kpad-", 0x4a }, - { "Kpad4", 0x4b }, - { "Kpad5", 0x4c }, - { "Kpad6", 0x4d }, - { "Kpad+", 0x4e }, - { "Kpad1", 0x4f }, - { "Kpad2", 0x50 }, - { "Kpad3", 0x51 }, - { "Kpad0", 0x52 }, - { "Kpad.", 0x53 }, - { "F11", 0x57 }, - { "F12", 0x58 }, - { "KpdEnt", 0x9c }, - { "RCtrl", 0x9d }, - { "Kpad/", 0xb5 }, - { "RAlt", 0xb8 }, - { "PrtScn", 0xb7 }, - { "Pause", 0xc5 }, - { "Home", 0xc7 }, - { "Up", 0xc8 }, - { "PgUp", 0xc9 }, - { "Left", 0xcb }, - { "Right", 0xcd }, - { "End", 0xcf }, - { "Down", 0xd0 }, - { "PgDn", 0xd1 }, - { "Insert", 0xd2 }, - { "Delete", 0xd3 }, - - {0,0} -}; - -char *mousenames[] = { "mouse1", "mouse2", "mouse3", "mouse4", "mouse5", "mouse6" }; - enum { T_EOF = -2, diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index 6360bc86b..89f64ae60 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -927,6 +927,115 @@ static int osdcmd_button(const osdfuncparm_t *parm) return OSDCMD_OK; } +keydef keynames[]= +{ + { "Escape", 0x1 }, + { "1", 0x2 }, + { "2", 0x3 }, + { "3", 0x4 }, + { "4", 0x5 }, + { "5", 0x6 }, + { "6", 0x7 }, + { "7", 0x8 }, + { "8", 0x9 }, + { "9", 0xa }, + { "0", 0xb }, + { "-", 0xc }, + { "=", 0xd }, + { "BakSpc", 0xe }, + { "Tab", 0xf }, + { "Q", 0x10 }, + { "W", 0x11 }, + { "E", 0x12 }, + { "R", 0x13 }, + { "T", 0x14 }, + { "Y", 0x15 }, + { "U", 0x16 }, + { "I", 0x17 }, + { "O", 0x18 }, + { "P", 0x19 }, + { "[", 0x1a }, + { "]", 0x1b }, + { "Enter", 0x1c }, + { "LCtrl", 0x1d }, + { "A", 0x1e }, + { "S", 0x1f }, + { "D", 0x20 }, + { "F", 0x21 }, + { "G", 0x22 }, + { "H", 0x23 }, + { "J", 0x24 }, + { "K", 0x25 }, + { "L", 0x26 }, + { "SemiColon", 0x27 }, + { "'", 0x28 }, + { "Tilde", 0x29 }, + { "LShift", 0x2a }, + { "\\", 0x2b }, + { "Z", 0x2c }, + { "X", 0x2d }, + { "C", 0x2e }, + { "V", 0x2f }, + { "B", 0x30 }, + { "N", 0x31 }, + { "M", 0x32 }, + { ",", 0x33 }, + { ".", 0x34 }, + { "/", 0x35 }, + { "RShift", 0x36 }, + { "Kpad*", 0x37 }, + { "LAlt", 0x38 }, + { "Space", 0x39 }, + { "CapLck", 0x3a }, + { "F1", 0x3b }, + { "F2", 0x3c }, + { "F3", 0x3d }, + { "F4", 0x3e }, + { "F5", 0x3f }, + { "F6", 0x40 }, + { "F7", 0x41 }, + { "F8", 0x42 }, + { "F9", 0x43 }, + { "F10", 0x44 }, + { "NumLck", 0x45 }, + { "ScrLck", 0x46 }, + { "Kpad7", 0x47 }, + { "Kpad8", 0x48 }, + { "Kpad9", 0x49 }, + { "Kpad-", 0x4a }, + { "Kpad4", 0x4b }, + { "Kpad5", 0x4c }, + { "Kpad6", 0x4d }, + { "Kpad+", 0x4e }, + { "Kpad1", 0x4f }, + { "Kpad2", 0x50 }, + { "Kpad3", 0x51 }, + { "Kpad0", 0x52 }, + { "Kpad.", 0x53 }, + { "F11", 0x57 }, + { "F12", 0x58 }, + { "KpdEnt", 0x9c }, + { "RCtrl", 0x9d }, + { "Kpad/", 0xb5 }, + { "RAlt", 0xb8 }, + { "PrtScn", 0xb7 }, + { "Pause", 0xc5 }, + { "Home", 0xc7 }, + { "Up", 0xc8 }, + { "PgUp", 0xc9 }, + { "Left", 0xcb }, + { "Right", 0xcd }, + { "End", 0xcf }, + { "Down", 0xd0 }, + { "PgDn", 0xd1 }, + { "Insert", 0xd2 }, + { "Delete", 0xd3 }, + + {0,0} +}; + +char *mousenames[] = { "mouse1", "mouse2", "mouse3", "mouse4", "mouse5", "mouse6" }; + static int osdcmd_bind(const osdfuncparm_t *parm) { int i, j; @@ -944,16 +1053,17 @@ static int osdcmd_bind(const osdfuncparm_t *parm) OSD_Printf("Current key bindings:\n"); for (i=0;inumparms < 2) { - OSD_Printf("%-11s = %s\n",mousenames[i], mousebind[i].cmd); + OSD_Printf("%-9s %s\"%s\"\n",mousenames[i], mousebind[i].repeat?"":"norepeat ",mousebind[i].cmd); return OSDCMD_OK; } @@ -1005,7 +1115,7 @@ static int osdcmd_bind(const osdfuncparm_t *parm) if (parm->numparms < 2) { - OSD_Printf("%-11s = %s\n",keynames[i].name, boundkeys[keynames[i].id].cmd); + OSD_Printf("%-9s %s\"%s\"\n",keynames[i].name, boundkeys[keynames[i].id].repeat?"":"norepeat ", boundkeys[keynames[i].id].cmd); return OSDCMD_OK; } @@ -1095,7 +1205,7 @@ static int osdcmd_quickload(const osdfuncparm_t *parm) static int osdcmd_screenshot(const osdfuncparm_t *parm) { UNREFERENCED_PARAMETER(parm); - KB_ClearKeysDown(); +// KB_ClearKeysDown(); screencapture("duke0000.tga",0); return OSDCMD_OK; }