From feba9e4a6c28b1e4e7f17b87e557552c541f3d0f Mon Sep 17 00:00:00 2001 From: lilDavid <1337lilDavid@gmail.com> Date: Tue, 23 Aug 2022 18:18:13 -0500 Subject: [PATCH] Ask to Continue After Saving --- soh/soh/Enhancements/presets.h | 1 + soh/soh/SohMenuBar.cpp | 5 ++ .../misc/ovl_kaleido_scope/z_kaleido_prompt.c | 2 +- .../ovl_kaleido_scope/z_kaleido_scope_PAL.c | 64 ++++++++++++++++++- 4 files changed, 68 insertions(+), 4 deletions(-) diff --git a/soh/soh/Enhancements/presets.h b/soh/soh/Enhancements/presets.h index eb7c34e2a54..9cc89fee8bf 100644 --- a/soh/soh/Enhancements/presets.h +++ b/soh/soh/Enhancements/presets.h @@ -176,6 +176,7 @@ const std::vector enhancementsCvars = { "gRestoreRBAValues", "gSkipSaveConfirmation", "gAutosave", + "gSaveAndQuit", "gDisableCritWiggle", "gChestSizeDependsStoneOfAgony", "gSkipArrowAnimation", diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index ade4f752380..e78d5ff6727 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -907,6 +907,11 @@ void DrawEnhancementsMenu() { UIWidgets::PaddedEnhancementCheckbox("Targetable Hookshot Reticle", "gHookshotableReticle", true, false); UIWidgets::Tooltip("Use a different color when aiming at hookshotable collision"); + 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(); } diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c index 0807b8356a8..53e30257fe7 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c @@ -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; diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 1475472a9af..5e2c4a99b45 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -1595,9 +1595,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->unk_1EC == 8)))) || + (pauseCtx->state == 0xE)) { + if (pauseCtx->unk_1EC == 5 || pauseCtx->unk_1EC == 7 || pauseCtx->unk_1EC == 8) { + 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); @@ -4049,6 +4057,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; @@ -4086,6 +4100,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; @@ -4136,6 +4154,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;