osdcmd_unbind()

git-svn-id: https://svn.eduke32.com/eduke32@810 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-06-29 11:33:51 +00:00
parent 3c51265878
commit 9ea5b3febf

View file

@ -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;i<MAXBOUNDKEYS;i++)if (*boundkeys[i].name)
boundkeys[i].name[0] = 0;
OSD_Printf("unbound all key\n");
return OSDCMD_OK;
}
if (parm->numparms < 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 <key> <scriptfile>: executes a command script when <key> gets pressed. Type \"bind showkeys\" for a list of keys.", osdcmd_bind);
OSD_RegisterFunction("bind","bind <key> <string>: 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 <key>: unbinds a key. Type \"unbind all\" to unbind all keys.", osdcmd_unbind);
for (i=0;i<NUMGAMEFUNCTIONS;i++)
{
Bsprintf(tempbuf,"gamefunc_%s",gamefunctions[i]);