Menus/Profile Accessibility: save profile settings

This commit is contained in:
James R 2023-12-30 00:48:33 -08:00
parent 82aeb0d9a7
commit ba2a8c91b3
2 changed files with 33 additions and 12 deletions

View file

@ -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;

View file

@ -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)
{