Skip to content

Commit

Permalink
Ask to Continue After Saving
Browse files Browse the repository at this point in the history
  • Loading branch information
lilDavid committed Jun 20, 2023
1 parent 83ebaa2 commit 92bedfa
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 5 deletions.
1 change: 1 addition & 0 deletions soh/soh/Enhancements/presets.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ const std::vector<const char*> enhancementsCvars = {
"gGsCutscene",
"gSkipSaveConfirmation",
"gAutosave",
"gSaveAndQuit",
"gDisableCritWiggle",
"gChestSizeDependsStoneOfAgony",
"gSkipArrowAnimation",
Expand Down
5 changes: 5 additions & 0 deletions soh/soh/SohMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,11 @@ void DrawEnhancementsMenu() {
UIWidgets::PaddedEnhancementCheckbox("Disable Crit wiggle", "gDisableCritWiggle", true, false);
UIWidgets::Tooltip("Disable random camera wiggle at low health");

UIWidgets::PaddedEnhancementCheckbox("Ask to continue playing after saving", "gSaveAndQuit", true, false);
UIWidgets::Tooltip(
"The save dialog from the pause menu will ask you to continue playing after you select Yes or No.\n"
"Pressing B or Start on the save prompt will close the pause menu without displaying the extra screen.");

ImGui::EndMenu();
}

Expand Down
2 changes: 1 addition & 1 deletion soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void KaleidoScope_UpdatePrompt(PlayState* play) {
s16 step;
bool dpad = CVarGetInteger("gDpadPause", 0);

if (((pauseCtx->state == 7) && (pauseCtx->unk_1EC == 1)) || (pauseCtx->state == 0xE) || (pauseCtx->state == 0x10)) {
if (((pauseCtx->state == 7) && (pauseCtx->unk_1EC == 1 || pauseCtx->unk_1EC == 7)) || (pauseCtx->state == 0xE) || (pauseCtx->state == 0x10)) {
if ((pauseCtx->promptChoice == 0) && ((relStickX >= 30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT)))) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
pauseCtx->promptChoice = 4;
Expand Down
66 changes: 62 additions & 4 deletions soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c
Original file line number Diff line number Diff line change
Expand Up @@ -1464,9 +1464,17 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {

gSPVertex(POLY_KAL_DISP++, &pauseCtx->saveVtx[60], 32, 0);

if (((pauseCtx->state == 7) && (pauseCtx->unk_1EC < 4)) || (pauseCtx->state == 0xE)) {
POLY_KAL_DISP =
KaleidoScope_QuadTextureIA8(POLY_KAL_DISP, sSavePromptTexs[gSaveContext.language], 152, 16, 0);
if (((pauseCtx->state == 7) &&
(pauseCtx->unk_1EC < 4 || pauseCtx->unk_1EC == 7 ||
(CVarGetInteger("gSaveAndQuit", 0) && pauseCtx->unk_1EC == 5))) ||
(pauseCtx->state == 0xE)) {
if (pauseCtx->unk_1EC == 7 || pauseCtx->unk_1EC == 5) {
POLY_KAL_DISP =
KaleidoScope_QuadTextureIA8(POLY_KAL_DISP, sContinuePromptTexs[gSaveContext.language], 152, 16, 0);
} else {
POLY_KAL_DISP =
KaleidoScope_QuadTextureIA8(POLY_KAL_DISP, sSavePromptTexs[gSaveContext.language], 152, 16, 0);
}

gDPSetCombineLERP(POLY_KAL_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0, TEXEL0,
0, PRIMITIVE, 0);
Expand Down Expand Up @@ -3797,6 +3805,12 @@ void KaleidoScope_Update(PlayState* play)
case 1:
if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
if (pauseCtx->promptChoice != 0) {
if (CVarGetInteger("gSaveAndQuit", 0)) {
pauseCtx->promptChoice = 0;
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
pauseCtx->unk_1EC = 7;
break;
}
Interface_SetDoAction(play, DO_ACTION_NONE);
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = BTN_ENABLED;
Expand All @@ -3812,7 +3826,7 @@ void KaleidoScope_Update(PlayState* play)
Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
Play_PerformSave(play);
pauseCtx->unk_1EC = 4;
pauseCtx->unk_1EC = CVarGetInteger("gSaveAndQuit", 0) ? 7 : 4;
D_8082B25C = CVarGetInteger("gSkipSaveConfirmation", 0) ? 3 /* 0.1 sec */ : 90 /* 3 secs */;
}
} else if (CHECK_BTN_ALL(input->press.button, BTN_START) ||
Expand All @@ -3834,6 +3848,10 @@ void KaleidoScope_Update(PlayState* play)
case 4:
if (CHECK_BTN_ALL(input->press.button, BTN_B) || CHECK_BTN_ALL(input->press.button, BTN_A) ||
CHECK_BTN_ALL(input->press.button, BTN_START) || (--D_8082B25C == 0)) {
if (CVarGetInteger("gSaveAndQuit", 0)) {
pauseCtx->unk_1EC = 7;
break;
}
Interface_SetDoAction(play, DO_ACTION_NONE);
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = BTN_ENABLED;
Expand Down Expand Up @@ -3884,6 +3902,46 @@ void KaleidoScope_Update(PlayState* play)
pauseCtx->unk_204 = -434.0f;
}
break;

// 7 and 8 are used by "Prompt to quit after saving" enhancement
case 7:
if (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_B) ||
CHECK_BTN_ALL(input->press.button, BTN_START)) {
if (pauseCtx->promptChoice == 0 || CHECK_BTN_ALL(input->press.button, BTN_B)) {
Interface_SetDoAction(play, DO_ACTION_NONE);
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = BTN_ENABLED;
gSaveContext.buttonStatus[5] = gSaveContext.buttonStatus[6] = gSaveContext.buttonStatus[7] =
gSaveContext.buttonStatus[8] = BTN_ENABLED;
gSaveContext.unk_13EA = 0;
Interface_ChangeAlpha(50);
pauseCtx->unk_1EC = 5;
WREG(2) = -6240;
YREG(8) = pauseCtx->unk_204;
func_800F64E0(0);
} else {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
pauseCtx->unk_1EC = 8;
}
}
break;

case 8:
if (interfaceCtx->unk_244 != 255) {
interfaceCtx->unk_244 += 10;
if (interfaceCtx->unk_244 >= 255) {
interfaceCtx->unk_244 = 255;
pauseCtx->state = 0;
R_UPDATE_RATE = 3;
R_PAUSE_MENU_MODE = 0;
func_800981B8(&play->objectCtx);
func_800418D0(&play->colCtx, play);
play->state.running = 0;
SET_NEXT_GAMESTATE(&play->state, Opening_Init, OpeningContext);
}
}
break;
}
break;

Expand Down

0 comments on commit 92bedfa

Please sign in to comment.