From ba2a8c91b3ce85ae0638a054b712adf419c72b4f Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 30 Dec 2023 00:48:33 -0800 Subject: [PATCH 1/2] Menus/Profile Accessibility: save profile settings --- src/menus/options-profiles-edit-1.c | 33 ++++++++++++++++++++++ src/menus/options-profiles-edit-controls.c | 12 -------- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/menus/options-profiles-edit-1.c b/src/menus/options-profiles-edit-1.c index f3b8cf322..e56f1d750 100644 --- a/src/menus/options-profiles-edit-1.c +++ b/src/menus/options-profiles-edit-1.c @@ -81,8 +81,41 @@ static boolean M_ProfileEditEnd(const UINT8 pid) return true; } +static void M_ProfileEditApply(void) +{ + SINT8 belongsto = PR_ProfileUsedBy(optionsmenu.profile); + // Save the profile + optionsmenu.profile->kickstartaccel = cv_dummyprofilekickstart.value; + optionsmenu.profile->autoroulette = cv_dummyprofileautoroulette.value; + optionsmenu.profile->litesteer = cv_dummyprofilelitesteer.value; + optionsmenu.profile->rumble = cv_dummyprofilerumble.value; + + // If this profile is in-use by anyone, apply the changes immediately upon exiting. + // Don't apply the profile itself as that would lead to issues mid-game. + if (belongsto > -1 && belongsto < MAXSPLITSCREENPLAYERS) + { + CV_SetValue(&cv_kickstartaccel[belongsto], cv_dummyprofilekickstart.value); + CV_SetValue(&cv_autoroulette[belongsto], cv_dummyprofileautoroulette.value); + CV_SetValue(&cv_litesteer[belongsto], cv_dummyprofilelitesteer.value); + CV_SetValue(&cv_rumble[belongsto], cv_dummyprofilerumble.value); + } + + // Reapply player 1's real profile. + // (And then we do this for P1 anyway. I didn't write + // this code so I'm not sure why it's doing this, but it + // can override cv_skin if forcecharacter is in effect! + // I suspect this is intended to set cv_currprofile. + // FIXME?) + if (cv_currprofile.value > -1) + { + PR_ApplyProfile(cv_lastprofile[0].value, 0); + } +} + static void M_ProfileEditExit(void) { + M_ProfileEditApply(); + if (M_GameTrulyStarted() == true) { optionsmenu.toptx = 160; diff --git a/src/menus/options-profiles-edit-controls.c b/src/menus/options-profiles-edit-controls.c index 3a83dff63..46d5c08dd 100644 --- a/src/menus/options-profiles-edit-controls.c +++ b/src/menus/options-profiles-edit-controls.c @@ -178,10 +178,6 @@ static void M_ProfileControlSaveResponse(INT32 choice) { SINT8 belongsto = PR_ProfileUsedBy(optionsmenu.profile); // Save the profile - optionsmenu.profile->kickstartaccel = cv_dummyprofilekickstart.value; - optionsmenu.profile->autoroulette = cv_dummyprofileautoroulette.value; - optionsmenu.profile->litesteer = cv_dummyprofilelitesteer.value; - optionsmenu.profile->rumble = cv_dummyprofilerumble.value; memcpy(&optionsmenu.profile->controls, optionsmenu.tempcontrols, sizeof(gamecontroldefault)); // If this profile is in-use by anyone, apply the changes immediately upon exiting. @@ -189,10 +185,6 @@ static void M_ProfileControlSaveResponse(INT32 choice) if (belongsto > -1 && belongsto < MAXSPLITSCREENPLAYERS) { memcpy(&gamecontrol[belongsto], optionsmenu.tempcontrols, sizeof(gamecontroldefault)); - CV_SetValue(&cv_kickstartaccel[belongsto], cv_dummyprofilekickstart.value); - CV_SetValue(&cv_autoroulette[belongsto], cv_dummyprofileautoroulette.value); - CV_SetValue(&cv_litesteer[belongsto], cv_dummyprofilelitesteer.value); - CV_SetValue(&cv_rumble[belongsto], cv_dummyprofilerumble.value); } M_GoBack(0); @@ -208,10 +200,6 @@ void M_ProfileControlsConfirm(INT32 choice) M_ProfileControlSaveResponse(MA_YES); - optionsmenu.profile->kickstartaccel = cv_dummyprofilekickstart.value; // Make sure to save kickstart accel. - optionsmenu.profile->autoroulette = cv_dummyprofileautoroulette.value; // We should really just rip this entire construct out at some point - optionsmenu.profile->rumble = cv_dummyprofilerumble.value; // And rumble too! - // Reapply player 1's real profile. if (cv_currprofile.value > -1) { From 2c1d42ae1250317e006811629c5e5f2513841b51 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 30 Dec 2023 00:52:17 -0800 Subject: [PATCH 2/2] PR_ApplyProfile_Settings: fix rumble not being reset when switching profiles --- src/k_profiles.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/k_profiles.c b/src/k_profiles.c index cd2491731..8dda612f4 100644 --- a/src/k_profiles.c +++ b/src/k_profiles.c @@ -493,6 +493,7 @@ static void PR_ApplyProfile_Settings(profile_t *p, UINT8 playernum) CV_StealthSetValue(&cv_kickstartaccel[playernum], p->kickstartaccel); CV_StealthSetValue(&cv_autoroulette[playernum], p->autoroulette); CV_StealthSetValue(&cv_litesteer[playernum], p->litesteer); + CV_StealthSetValue(&cv_rumble[playernum], p->rumble); // set controls... memcpy(&gamecontrol[playernum], p->controls, sizeof(gamecontroldefault));