mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 02:30:46 +00:00
Keyboard configuration menu <-> binds
git-svn-id: https://svn.eduke32.com/eduke32@822 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
1783253ccd
commit
ef2683418e
5 changed files with 50 additions and 9 deletions
|
@ -150,7 +150,8 @@ void CONFIG_SetDefaultKeys(int type)
|
|||
{
|
||||
int32 i,f;
|
||||
|
||||
memset(ud.config.KeyboardKeys, 0xff, sizeof(ud.config.KeyboardKeys));
|
||||
Bmemset(ud.config.KeyboardKeys, 0xff, sizeof(ud.config.KeyboardKeys));
|
||||
Bmemset(&boundkeys,0,sizeof(boundkeys));
|
||||
|
||||
if (type == 1)
|
||||
{
|
||||
|
@ -162,7 +163,7 @@ void CONFIG_SetDefaultKeys(int type)
|
|||
ud.config.KeyboardKeys[f][1] = KB_StringToScanCode((char *)oldkeydefaults[i+2]);
|
||||
|
||||
if (f == gamefunc_Show_Console) OSD_CaptureKey(ud.config.KeyboardKeys[f][0]);
|
||||
else CONTROL_MapKey(f, ud.config.KeyboardKeys[f][0], ud.config.KeyboardKeys[f][1]);
|
||||
else MapKey(f, ud.config.KeyboardKeys[f][0], 0, ud.config.KeyboardKeys[f][1], 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -175,7 +176,7 @@ void CONFIG_SetDefaultKeys(int type)
|
|||
ud.config.KeyboardKeys[f][1] = KB_StringToScanCode(keydefaults[i+2]);
|
||||
|
||||
if (f == gamefunc_Show_Console) OSD_CaptureKey(ud.config.KeyboardKeys[f][0]);
|
||||
else CONTROL_MapKey(f, ud.config.KeyboardKeys[f][0], ud.config.KeyboardKeys[f][1]);
|
||||
else MapKey(f, ud.config.KeyboardKeys[f][0], 0, ud.config.KeyboardKeys[f][1], 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -420,10 +421,42 @@ void CONFIG_ReadKeys(void)
|
|||
if (i == gamefunc_Show_Console)
|
||||
OSD_CaptureKey(ud.config.KeyboardKeys[i][0]);
|
||||
else
|
||||
CONTROL_MapKey(i, ud.config.KeyboardKeys[i][0], ud.config.KeyboardKeys[i][1]);
|
||||
MapKey(i, ud.config.KeyboardKeys[i][0], 0, ud.config.KeyboardKeys[i][1], 0);
|
||||
}
|
||||
}
|
||||
|
||||
void MapKey(int32 which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2, kb_scancode oldkey2)
|
||||
{
|
||||
int j;
|
||||
|
||||
CONTROL_MapKey(which, key1, key2);
|
||||
if (key1)
|
||||
{
|
||||
boundkeys[key1].repeat = 1;
|
||||
for (j=0;keynames[j].name;j++)
|
||||
if (key1 == keynames[j].id)
|
||||
break;
|
||||
if (keynames[j].name)
|
||||
boundkeys[key1].key=Bstrdup(keynames[j].name);
|
||||
Bsprintf(tempbuf,"gamefunc_%s",CONFIG_FunctionNumToName(which));
|
||||
Bstrncpy(boundkeys[key1].name,tempbuf, MAXBINDSTRINGLENGTH-1);
|
||||
}
|
||||
if (key2)
|
||||
{
|
||||
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);
|
||||
Bsprintf(tempbuf,"gamefunc_%s",CONFIG_FunctionNumToName(which));
|
||||
Bstrncpy(boundkeys[key2].name,tempbuf, MAXBINDSTRINGLENGTH-1);
|
||||
}
|
||||
if (!key1 && oldkey1)
|
||||
boundkeys[oldkey1].name[0] = 0;
|
||||
if (!key2 && oldkey2)
|
||||
boundkeys[oldkey2].name[0] = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
|
|
|
@ -37,4 +37,6 @@ void CONFIG_SetDefaultKeys(int type);
|
|||
int32 CONFIG_GetMapBestTime(char *mapname);
|
||||
int32 CONFIG_SetMapBestTime(char *mapname, int32 tm);
|
||||
|
||||
void MapKey(int32 which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2, kb_scancode oldkey2);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -227,6 +227,7 @@ extern keybind boundkeys[MAXBOUNDKEYS];
|
|||
void CONTROL_ProcessBinds(void);
|
||||
|
||||
#define CONTROL_NUM_FLAGS 64
|
||||
extern int extinput[CONTROL_NUM_FLAGS];
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
|
|
|
@ -3350,8 +3350,11 @@ cheat_for_port_credits:
|
|||
}
|
||||
else if (KB_KeyPressed(sc_Delete))
|
||||
{
|
||||
char key[2];
|
||||
key[0] = ud.config.KeyboardKeys[probey][0];
|
||||
key[1] = ud.config.KeyboardKeys[probey][1];
|
||||
ud.config.KeyboardKeys[probey][currentlist] = 0;
|
||||
CONTROL_MapKey(probey, ud.config.KeyboardKeys[probey][0], ud.config.KeyboardKeys[probey][1]);
|
||||
MapKey(probey, ud.config.KeyboardKeys[probey][0], key[0], ud.config.KeyboardKeys[probey][1], key[1]);
|
||||
sound(KICK_HIT);
|
||||
KB_ClearKeyDown(sc_Delete);
|
||||
}
|
||||
|
@ -3406,13 +3409,17 @@ cheat_for_port_credits:
|
|||
}
|
||||
else
|
||||
{
|
||||
char key[2];
|
||||
key[0] = ud.config.KeyboardKeys[function][0];
|
||||
key[1] = ud.config.KeyboardKeys[function][1];
|
||||
|
||||
sound(PISTOL_BODYHIT);
|
||||
|
||||
ud.config.KeyboardKeys[function][whichkey] = KB_GetLastScanCode();
|
||||
if (function == gamefunc_Show_Console)
|
||||
OSD_CaptureKey(KB_GetLastScanCode());
|
||||
else
|
||||
CONTROL_MapKey(function, ud.config.KeyboardKeys[function][0], ud.config.KeyboardKeys[function][1]);
|
||||
MapKey(function, ud.config.KeyboardKeys[function][0], key[0], ud.config.KeyboardKeys[function][1], key[1]);
|
||||
}
|
||||
|
||||
cmenu(204);
|
||||
|
|
|
@ -918,12 +918,10 @@ static int osdcmd_name(const osdfuncparm_t *parm)
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
extern int extinput[CONTROL_NUM_FLAGS];
|
||||
|
||||
static int osdcmd_button(const osdfuncparm_t *parm)
|
||||
{
|
||||
char *p = (char *)parm->name+9; // skip "gamefunc_"
|
||||
extinput[CONFIG_FunctionNameToNum(p)] = 1;
|
||||
extinput[CONFIG_FunctionNameToNum(p)] = 1; // FIXME
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue