Merge branch 'loadconfig-defaultcontrols' into 'master'

Reset default controls for LOADCONFIG command

See merge request STJr/SRB2!403
This commit is contained in:
Digiku 2018-12-23 17:14:34 -05:00
commit 402860dc06
3 changed files with 15 additions and 0 deletions

View file

@ -1010,6 +1010,16 @@ void G_ClearControlKeys(INT32 (*setupcontrols)[2], INT32 control)
setupcontrols[control][1] = KEY_NULL; setupcontrols[control][1] = KEY_NULL;
} }
void G_ClearAllControlKeys(void)
{
INT32 i;
for (i = 0; i < num_gamecontrols; i++)
{
G_ClearControlKeys(gamecontrol, i);
G_ClearControlKeys(gamecontrolbis, i);
}
}
// //
// Returns the name of a key (or virtual key for mouse and joy) // Returns the name of a key (or virtual key for mouse and joy)
// the input value being an keynum // the input value being an keynum

View file

@ -160,6 +160,7 @@ INT32 G_KeyStringtoNum(const char *keystr);
// detach any keys associated to the given game control // detach any keys associated to the given game control
void G_ClearControlKeys(INT32 (*setupcontrols)[2], INT32 control); void G_ClearControlKeys(INT32 (*setupcontrols)[2], INT32 control);
void G_ClearAllControlKeys(void);
void Command_Setcontrol_f(void); void Command_Setcontrol_f(void);
void Command_Setcontrol2_f(void); void Command_Setcontrol2_f(void);
void G_Controldefault(void); void G_Controldefault(void);

View file

@ -442,6 +442,10 @@ void Command_LoadConfig_f(void)
strcpy(configfile, COM_Argv(1)); strcpy(configfile, COM_Argv(1));
FIL_ForceExtension(configfile, ".cfg"); FIL_ForceExtension(configfile, ".cfg");
// load default control
G_ClearAllControlKeys();
G_Controldefault();
// temporarily reset execversion to default // temporarily reset execversion to default
cv_execversion.flags &= ~CV_HIDEN; cv_execversion.flags &= ~CV_HIDEN;
COM_BufInsertText(va("%s \"%s\"\n", cv_execversion.name, cv_execversion.defaultvalue)); COM_BufInsertText(va("%s \"%s\"\n", cv_execversion.name, cv_execversion.defaultvalue));