From 9ea5b3febfbdccb81e983bc305d155f0f907ea1f Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 29 Jun 2008 11:33:51 +0000 Subject: [PATCH] osdcmd_unbind() git-svn-id: https://svn.eduke32.com/eduke32@810 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/osdcmds.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index fb8746c1b..06fd956aa 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -979,7 +979,9 @@ static int osdcmd_bind(const osdfuncparm_t *parm) } if (parm->numparms < 2) return OSDCMD_SHOWHELP; - for (i=0;keynames[i].name;i++)if (!Bstrcasecmp(parm->parms[0],keynames[i].name))break; + for (i=0;keynames[i].name;i++) + if (!Bstrcasecmp(parm->parms[0],keynames[i].name)) + break; if (!keynames[i].name) return OSDCMD_SHOWHELP; j = 1; @@ -995,6 +997,29 @@ static int osdcmd_bind(const osdfuncparm_t *parm) return OSDCMD_OK; } +static int osdcmd_unbind(const osdfuncparm_t *parm) +{ + int i, j; + + if (parm->numparms==1&&!Bstrcasecmp(parm->parms[0],"all")) + { + for (i=0;inumparms < 1) return OSDCMD_SHOWHELP; + for (i=0;keynames[i].name;i++) + if (!Bstrcasecmp(parm->parms[0],keynames[i].name)) + break; + if (!keynames[i].name) return OSDCMD_SHOWHELP; + + boundkeys[keynames[i].id].repeat = 0; + boundkeys[keynames[i].id].name[0] = 0; + OSD_Printf("unbound key %s\n",keynames[i].name); + return OSDCMD_OK; +} + int registerosdcommands(void) { unsigned int i; @@ -1050,7 +1075,8 @@ int registerosdcommands(void) OSD_RegisterFunction("vidmode","vidmode [xdim ydim] [bpp] [fullscreen]: immediately change the video mode",osdcmd_vidmode); - OSD_RegisterFunction("bind","bind : executes a command script when gets pressed. Type \"bind showkeys\" for a list of keys.", osdcmd_bind); + OSD_RegisterFunction("bind","bind : associates a keypress with a string of console input. Type \"bind showkeys\" for a list of keys and \"listsymbols\" for a list of valid console commands.", osdcmd_bind); + OSD_RegisterFunction("unbind","unbind : unbinds a key. Type \"unbind all\" to unbind all keys.", osdcmd_unbind); for (i=0;i