Make back button properly confirm settings

This commit is contained in:
Sally Coolatta 2022-08-30 05:23:54 -04:00
parent 0fe3e6ceeb
commit 6eb5b2dee9
3 changed files with 22 additions and 12 deletions

View file

@ -856,6 +856,7 @@ void M_ProfileSetControl(INT32 ch);
void M_MapProfileControl(event_t *ev);
void M_ProfileTryController(INT32 choice);
void M_ProfileConfirm(INT32 choice);
// video modes menu (resolution)
void M_VideoModeMenu(INT32 choice);

View file

@ -680,8 +680,8 @@ menuitem_t OPTIONS_ProfileControls[] = {
{IT_STRING | IT_CALL, "TRY MAPPINGS", "Test your controls.",
NULL, {.routine = M_ProfileTryController}, 0, 0},
{IT_STRING | IT_CALL, "BACK...", "Go back to profile setup.",
NULL, {.routine = M_GoBack}, 0, 0},
{IT_STRING | IT_CALL, "CONFIRM", "Go back to profile setup.",
NULL, {.routine = M_ProfileConfirm}, 0, 0},
};

View file

@ -5113,6 +5113,24 @@ static void M_ProfileControlSaveResponse(INT32 choice)
}
}
void M_ProfileConfirm(INT32 choice)
{
(void)choice;
//M_StartMessage(M_GetText("Exiting will save the control changes\nfor this Profile.\nIs this okay?\n\n(Press A to confirm)"), FUNCPTRCAST(M_ProfileControlSaveResponse), MM_YESNO);
// TODO: Add a graphic for controls saving, instead of obnoxious prompt.
M_ProfileControlSaveResponse(MA_YES);
optionsmenu.profile->kickstartaccel = cv_dummyprofilekickstart.value; // Make sure to save kickstart accel.
// Reapply player 1's real profile.
if (cv_currprofile.value > -1)
{
PR_ApplyProfile(cv_lastprofile[0].value, 0);
}
}
boolean M_ProfileControlsInputs(INT32 ch)
{
const UINT8 pid = 0;
@ -5165,16 +5183,7 @@ boolean M_ProfileControlsInputs(INT32 ch)
}
else if (M_MenuBackPressed(pid))
{
//M_StartMessage(M_GetText("Exiting will save the control changes\nfor this Profile.\nIs this okay?\n\n(Press A to confirm)"), FUNCPTRCAST(M_ProfileControlSaveResponse), MM_YESNO);
// TODO: Add a graphic for controls saving, instead of obnoxious prompt.
M_ProfileControlSaveResponse(MA_YES);
optionsmenu.profile->kickstartaccel = cv_dummyprofilekickstart.value; // Make sure to save kickstart accel.
// Reapply player 1's real profile.
if (cv_currprofile.value > -1)
PR_ApplyProfile(cv_lastprofile[0].value, 0);
M_ProfileControlsConfirm();
return true;
}