Merge branch 'restore-chat-binding' into 'master'

Default chat binding is keyboard 't', old profiles (version 1) are converted

Closes #1294

See merge request KartKrew/Kart!2298
This commit is contained in:
James R. 2024-04-25 23:29:59 +00:00
commit 00f7d27d13
2 changed files with 21 additions and 7 deletions

View file

@ -937,6 +937,7 @@ void G_DefineDefaultControls(void)
gamecontroldefault[gc_l ][0] = KEY_SPACE;
gamecontroldefault[gc_r ][0] = 's';
gamecontroldefault[gc_start ][0] = KEY_ESCAPE;
gamecontroldefault[gc_talk ][0] = 't';
gamecontroldefault[gc_rankings ][0] = KEY_TAB;
gamecontroldefault[gc_screenshot ][0] = KEY_F8;
gamecontroldefault[gc_startmovie ][0] = KEY_F9;

View file

@ -468,13 +468,6 @@ void PR_LoadProfiles(void)
newprof->rumble = jsprof.preferences.rumble;
newprof->fov = jsprof.preferences.fov;
if (jsprof.version == 1)
{
// Version 1 -> 2: litesteer is now off by default, reset old profiles
newprof->litesteer = false;
converted = true;
}
try
{
for (size_t j = 0; j < num_gamecontrols; j++)
@ -491,6 +484,26 @@ void PR_LoadProfiles(void)
return;
}
if (jsprof.version == 1)
{
// Version 1 -> 2:
// - litesteer is now off by default, reset old profiles
newprof->litesteer = false;
auto unbound = [](const INT32* map)
{
INT32 zero[MAXINPUTMAPPING] = {};
return !memcmp(map, zero, sizeof zero);
};
if (unbound(newprof->controls[gc_talk]))
{
// - unbound talk control gets reset to default
memcpy(newprof->controls[gc_talk], gamecontroldefault[gc_talk], sizeof newprof->controls[gc_talk]);
}
converted = true;
}
if (converted)
{
CONS_Printf("Profile '%s' was converted from version %d to version %d\n",