From dacf2059c601c5f88acd69f68943cfeb90b3675b Mon Sep 17 00:00:00 2001 From: mckinlee Date: Sat, 23 Sep 2023 01:13:40 -0400 Subject: [PATCH] Minor Bug Fix -Now link won't get soft locked when warping to the same location twice --- soh/soh/Enhancements/pausewarp.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/soh/soh/Enhancements/pausewarp.c b/soh/soh/Enhancements/pausewarp.c index 9757535eb..51e206e5c 100644 --- a/soh/soh/Enhancements/pausewarp.c +++ b/soh/soh/Enhancements/pausewarp.c @@ -16,6 +16,8 @@ extern bool IsSaveLoadedWrapper(); static PauseWarpState state; +static int lastPlayedSong = -1; + bool IsPauseWarpEnabled() { return CVarGetInteger("gPauseWarpEnabled", 0) && IsSaveLoadedWrapper(); } @@ -72,11 +74,27 @@ void PauseWarp_Idle() { if (gSaveContext.inventory.items[SLOT_OCARINA] == ITEM_NONE) return ResetStateFlags(&state); + int currentSong = play->pauseCtx.cursorPoint[PAUSE_QUEST]; + switch (play->msgCtx.msgMode) { - case 6: if (state.warpInitiated) state.textboxInitiated = true; break; - case 53: if (state.warpInitiated && state.textboxInitiated) state.inChoosingState = true; break; - case 54: if (state.warpInitiated && state.textboxInitiated && state.inChoosingState) HandleWarpConfirmation(play, player); break; - case 0: ResetStateFlags(&state); break; + case 6: + if (state.warpInitiated) state.textboxInitiated = true; + break; + case 53: + if (state.warpInitiated && state.textboxInitiated) state.inChoosingState = true; + break; + case 54: + if (state.warpInitiated && state.textboxInitiated && state.inChoosingState) { + HandleWarpConfirmation(play, player); + lastPlayedSong = currentSong; // Update the last played song + } + break; + case 0: + if (currentSong == lastPlayedSong) { + // Reset state flags if the same song is selected twice + ResetStateFlags(&state); + } + break; } HandleCooldowns();