mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
read/write binds to/from binds.cfg
git-svn-id: https://svn.eduke32.com/eduke32@813 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
f003af45dc
commit
ef183706e6
5 changed files with 21 additions and 3 deletions
|
@ -743,10 +743,26 @@ int32 CONFIG_ReadSetup(void)
|
|||
===================
|
||||
*/
|
||||
|
||||
void CONFIG_WriteBinds(void)
|
||||
{
|
||||
int i;
|
||||
FILE *fp = fopen("binds.cfg", "wt");
|
||||
|
||||
if (fp)
|
||||
{
|
||||
fprintf(fp,"// this file automatically generated by EDuke32\n// do not modify if you lack common sense\n");
|
||||
for (i=0;i<MAXBOUNDKEYS;i++)if (*boundkeys[i].name)
|
||||
fprintf(fp,"bind %s \"%s\"\n",boundkeys[i].key,boundkeys[i].name);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
void CONFIG_WriteSetup(void)
|
||||
{
|
||||
int32 dummy;
|
||||
|
||||
CONFIG_WriteBinds();
|
||||
|
||||
if (!ud.config.setupread) return;
|
||||
|
||||
if (ud.config.scripthandle < 0)
|
||||
|
|
|
@ -10652,6 +10652,7 @@ void app_main(int argc,const char **argv)
|
|||
clearsoundlocks();
|
||||
|
||||
load_script("autoexec.cfg");
|
||||
load_script("binds.cfg");
|
||||
|
||||
if (ud.warp_on > 1 && ud.multimode < 2)
|
||||
{
|
||||
|
|
|
@ -71,7 +71,6 @@ extern "C" {
|
|||
|
||||
#define DEFAULTMOUSESENSITIVITY 10 // 0x7000+MINIMUMMOUSESENSITIVITY
|
||||
|
||||
#define CONTROL_NUM_FLAGS 64
|
||||
#define INSTANT_ONOFF 0
|
||||
#define TOGGLE_ONOFF 1
|
||||
|
||||
|
|
|
@ -226,6 +226,8 @@ extern keybind boundkeys[MAXBOUNDKEYS];
|
|||
|
||||
void CONTROL_ProcessBinds(void);
|
||||
|
||||
#define CONTROL_NUM_FLAGS 64
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -952,7 +952,7 @@ static int osdcmd_name(const osdfuncparm_t *parm)
|
|||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
extern int extinput[64];
|
||||
extern int extinput[CONTROL_NUM_FLAGS];
|
||||
|
||||
static int osdcmd_button(const osdfuncparm_t *parm)
|
||||
{
|
||||
|
@ -999,7 +999,7 @@ static int osdcmd_bind(const osdfuncparm_t *parm)
|
|||
else boundkeys[keynames[i].id].repeat = 1;
|
||||
Bstrncpy(boundkeys[keynames[i].id].name,parm->parms[j], MAXBINDSTRINGLENGTH-1);
|
||||
boundkeys[keynames[i].id].key=keynames[i].name;
|
||||
// OSD_Printf("key %s repeat %d string %s\n",keynames[i].name,boundkeys[keynames[i].id].repeat, boundkeys[keynames[i].id].name);
|
||||
OSD_Printf("%s\n",parm->raw);
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue