From 020ca75cc9cf3ceab02b6e88915220cfc2e42a5b Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 25 Apr 2024 02:13:26 -0700 Subject: [PATCH] Default chat binding is keyboard 't', old profiles (version 1) are converted - Old profiles (version 1) have the chat key reset to default, unless the chat key was already bound to something else --- src/g_input.c | 1 + src/k_profiles.cpp | 27 ++++++++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/g_input.c b/src/g_input.c index 9175e53a8..e99f35499 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -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; diff --git a/src/k_profiles.cpp b/src/k_profiles.cpp index b55ac2a8b..213239f0b 100644 --- a/src/k_profiles.cpp +++ b/src/k_profiles.cpp @@ -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",