From 3419928f5db3530cdb19c33698f8cb1952fc90a9 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Wed, 18 Dec 2024 15:03:51 -0700 Subject: [PATCH] Fix Save Prompt Cursor on Quest/Misc Item Tracker Windows (#4694) * Fix quest menu cursor "moving" in the background in the save game prompt. Fix misc item tracker also being able to select R and L/Z in save prompt. Include MigrationAction entry removal from item count fix PR. * Fix formatting. --- soh/soh/Enhancements/kaleido.cpp | 58 +++--- soh/soh/config/ConfigMigrators.h | 1 - .../ovl_kaleido_scope/z_kaleido_collect.c | 172 +++++++++--------- 3 files changed, 119 insertions(+), 112 deletions(-) diff --git a/soh/soh/Enhancements/kaleido.cpp b/soh/soh/Enhancements/kaleido.cpp index 33075ca50..36cf9d0a2 100644 --- a/soh/soh/Enhancements/kaleido.cpp +++ b/soh/soh/Enhancements/kaleido.cpp @@ -191,37 +191,41 @@ namespace Rando { // it would be a much larger Kaleido change. bool shouldScroll = false; bool dpad = CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0); - if ((!pauseCtx->unk_1E4 || (pauseCtx->unk_1E4 == 5) || (pauseCtx->unk_1E4 == 8)) && + if (((pauseCtx->unk_1E4 == 0) || (pauseCtx->unk_1E4 == 5) || (pauseCtx->unk_1E4 == 8)) && (pauseCtx->pageIndex == PAUSE_QUEST)) { - if (pauseCtx->cursorSpecialPos == 0) { - if ((pauseCtx->stickRelY > 30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DUP))) { - if (mTopIndex > 0) { - mTopIndex--; - shouldScroll = true; + if (!((pauseCtx->state != 6) || ((pauseCtx->stickRelX == 0) && (pauseCtx->stickRelY == 0)))) { + if (pauseCtx->cursorSpecialPos == 0) { + if ((pauseCtx->stickRelY > 30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DUP))) { + if (mTopIndex > 0) { + mTopIndex--; + shouldScroll = true; + } + } else if ((pauseCtx->stickRelY < -30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DDOWN))) { + if (mTopIndex + mNumVisible < mEntries.size()) { + mTopIndex++; + shouldScroll = true; + } } - } else if ((pauseCtx->stickRelY < -30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DDOWN))) { - if (mTopIndex + mNumVisible < mEntries.size()) { - mTopIndex++; - shouldScroll = true; + if ((pauseCtx->stickRelX < -30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DLEFT))) { + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); + pauseCtx->unk_1E4 = 0; + } else if ((pauseCtx->stickRelX > 30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT))) { + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); + pauseCtx->unk_1E4 = 0; + } + } else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { + if ((pauseCtx->stickRelX > 30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT))) { + pauseCtx->cursorSpecialPos = 0; + Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + } + } else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) { + if ((pauseCtx->stickRelX < -30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DLEFT))) { + pauseCtx->cursorSpecialPos = 0; + Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } - if ((pauseCtx->stickRelX < -30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DLEFT))) { - KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); - pauseCtx->unk_1E4 = 0; - } else if ((pauseCtx->stickRelX > 30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT))) { - KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); - pauseCtx->unk_1E4 = 0; - } - } else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { - if ((pauseCtx->stickRelX > 30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT))) { - pauseCtx->cursorSpecialPos = 0; - Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - } - } else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) { - if ((pauseCtx->stickRelX < -30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DLEFT))) { - pauseCtx->cursorSpecialPos = 0; - Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - } + } else if (pauseCtx->cursorSpecialPos != 0 && pauseCtx->state == 7) { + pauseCtx->cursorSpecialPos = 0; } } int yOffset = 2; diff --git a/soh/soh/config/ConfigMigrators.h b/soh/soh/config/ConfigMigrators.h index 1626e38a8..726356a04 100644 --- a/soh/soh/config/ConfigMigrators.h +++ b/soh/soh/config/ConfigMigrators.h @@ -260,7 +260,6 @@ namespace SOH { { MigrationAction::Rename, "gHurtContainer", "gEnhancements.HurtContainer" }, { MigrationAction::Rename, "gHyperBosses", "gEnhancements.HyperBosses" }, { MigrationAction::Rename, "gHyperEnemies", "gEnhancements.HyperEnemies" }, - { MigrationAction::Rename, "gInjectItemCounts", "gEnhancements.InjectItemCounts" }, { MigrationAction::Rename, "gInstantFishing", "gEnhancements.InstantFishing" }, { MigrationAction::Rename, "gInstantOcarinaGameWin", "gEnhancements.InstantOcarinaGameWin" }, { MigrationAction::Rename, "gInstantPutaway", "gEnhancements.InstantPutaway" }, diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c index 880725f40..e4f2e65ef 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c @@ -127,97 +127,101 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { OPEN_DISPS(gfxCtx); - if ((!pauseCtx->unk_1E4 || (pauseCtx->unk_1E4 == 5) || (pauseCtx->unk_1E4 == 8)) && + if (((pauseCtx->unk_1E4 == 0) || (pauseCtx->unk_1E4 == 5) || (pauseCtx->unk_1E4 == 8)) && (pauseCtx->pageIndex == PAUSE_QUEST)) { pauseCtx->cursorColorSet = 0; if (pauseCtx->cursorSpecialPos == 0) { pauseCtx->nameColorSet = 0; - sp216 = pauseCtx->cursorSlot[PAUSE_QUEST]; - phi_s3 = pauseCtx->cursorPoint[PAUSE_QUEST]; - - if ((pauseCtx->stickRelX < -30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DLEFT))) { - phi_s0 = D_8082A1AC[phi_s3][2]; - if (phi_s0 == -3) { - KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); - pauseCtx->unk_1E4 = 0; - } else { - while (phi_s0 >= 0) { - if ((s16)KaleidoScope_UpdateQuestStatusPoint(pauseCtx, phi_s0) != 0) { - break; - } - phi_s0 = D_8082A1AC[phi_s0][2]; - } - } - } else if ((pauseCtx->stickRelX > 30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT))) { - phi_s0 = D_8082A1AC[phi_s3][3]; - if (phi_s0 == -2) { - KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); - pauseCtx->unk_1E4 = 0; - } else { - while (phi_s0 >= 0) { - if ((s16)KaleidoScope_UpdateQuestStatusPoint(pauseCtx, phi_s0) != 0) { - break; - } - phi_s0 = D_8082A1AC[phi_s0][3]; - } - } - } - - if ((pauseCtx->stickRelY < -30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DDOWN))) { - phi_s0 = D_8082A1AC[phi_s3][1]; - while (phi_s0 >= 0) { - if ((s16)KaleidoScope_UpdateQuestStatusPoint(pauseCtx, phi_s0) != 0) { - break; - } - phi_s0 = D_8082A1AC[phi_s0][1]; - } - } else if ((pauseCtx->stickRelY > 30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DUP))) { - phi_s0 = D_8082A1AC[phi_s3][0]; - while (phi_s0 >= 0) { - if ((s16)KaleidoScope_UpdateQuestStatusPoint(pauseCtx, phi_s0) != 0) { - break; - } - phi_s0 = D_8082A1AC[phi_s0][0]; - } - } - - if (phi_s3 != pauseCtx->cursorPoint[PAUSE_QUEST]) { - pauseCtx->unk_1E4 = 0; - Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - } - - if (pauseCtx->cursorPoint[PAUSE_QUEST] != 0x18) { - if (CHECK_QUEST_ITEM(pauseCtx->cursorPoint[PAUSE_QUEST])) { - if (pauseCtx->cursorPoint[PAUSE_QUEST] < 6) { - phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x66; - osSyncPrintf("000 ccc=%d\n", phi_s0_2); - } else if (pauseCtx->cursorPoint[PAUSE_QUEST] < 0x12) { - phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x54; - osSyncPrintf("111 ccc=%d\n", phi_s0_2); - } else { - phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x5A; - osSyncPrintf("222 ccc=%d (%d, %d, %d)\n", phi_s0_2, pauseCtx->cursorPoint[PAUSE_QUEST], - 0x12, 0x6C); - } - } else { - phi_s0_2 = PAUSE_ITEM_NONE; - osSyncPrintf("999 ccc=%d (%d, %d)\n", PAUSE_ITEM_NONE, pauseCtx->cursorPoint[PAUSE_QUEST], - 0x18); - } + if ((pauseCtx->state != 6) || ((pauseCtx->stickRelX == 0) && (pauseCtx->stickRelY == 0))) { + // No cursor movement + sp216 = pauseCtx->cursorSlot[PAUSE_QUEST]; } else { - if ((gSaveContext.inventory.questItems & 0xF0000000) != 0) { - phi_s0_2 = 0x72; - } else { - phi_s0_2 = PAUSE_ITEM_NONE; - } - osSyncPrintf("888 ccc=%d (%d, %d, %x)\n", phi_s0_2, pauseCtx->cursorPoint[PAUSE_QUEST], 0x72, - gSaveContext.inventory.questItems & 0xF0000000); - } + phi_s3 = pauseCtx->cursorPoint[PAUSE_QUEST]; - sp216 = pauseCtx->cursorPoint[PAUSE_QUEST]; - pauseCtx->cursorItem[pauseCtx->pageIndex] = phi_s0_2; - pauseCtx->cursorSlot[pauseCtx->pageIndex] = sp216; + if ((pauseCtx->stickRelX < -30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DLEFT))) { + phi_s0 = D_8082A1AC[phi_s3][2]; + if (phi_s0 == -3) { + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); + pauseCtx->unk_1E4 = 0; + } else { + while (phi_s0 >= 0) { + if ((s16)KaleidoScope_UpdateQuestStatusPoint(pauseCtx, phi_s0) != 0) { + break; + } + phi_s0 = D_8082A1AC[phi_s0][2]; + } + } + } else if ((pauseCtx->stickRelX > 30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT))) { + phi_s0 = D_8082A1AC[phi_s3][3]; + if (phi_s0 == -2) { + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); + pauseCtx->unk_1E4 = 0; + } else { + while (phi_s0 >= 0) { + if ((s16)KaleidoScope_UpdateQuestStatusPoint(pauseCtx, phi_s0) != 0) { + break; + } + phi_s0 = D_8082A1AC[phi_s0][3]; + } + } + } + + if ((pauseCtx->stickRelY < -30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DDOWN))) { + phi_s0 = D_8082A1AC[phi_s3][1]; + while (phi_s0 >= 0) { + if ((s16)KaleidoScope_UpdateQuestStatusPoint(pauseCtx, phi_s0) != 0) { + break; + } + phi_s0 = D_8082A1AC[phi_s0][1]; + } + } else if ((pauseCtx->stickRelY > 30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DUP))) { + phi_s0 = D_8082A1AC[phi_s3][0]; + while (phi_s0 >= 0) { + if ((s16)KaleidoScope_UpdateQuestStatusPoint(pauseCtx, phi_s0) != 0) { + break; + } + phi_s0 = D_8082A1AC[phi_s0][0]; + } + } + + if (phi_s3 != pauseCtx->cursorPoint[PAUSE_QUEST]) { + pauseCtx->unk_1E4 = 0; + Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + } + + if (pauseCtx->cursorPoint[PAUSE_QUEST] != 0x18) { + if (CHECK_QUEST_ITEM(pauseCtx->cursorPoint[PAUSE_QUEST])) { + if (pauseCtx->cursorPoint[PAUSE_QUEST] < 6) { + phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x66; + osSyncPrintf("000 ccc=%d\n", phi_s0_2); + } else if (pauseCtx->cursorPoint[PAUSE_QUEST] < 0x12) { + phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x54; + osSyncPrintf("111 ccc=%d\n", phi_s0_2); + } else { + phi_s0_2 = pauseCtx->cursorPoint[PAUSE_QUEST] + 0x5A; + osSyncPrintf("222 ccc=%d (%d, %d, %d)\n", phi_s0_2, pauseCtx->cursorPoint[PAUSE_QUEST], + 0x12, 0x6C); + } + } else { + phi_s0_2 = PAUSE_ITEM_NONE; + osSyncPrintf("999 ccc=%d (%d, %d)\n", PAUSE_ITEM_NONE, pauseCtx->cursorPoint[PAUSE_QUEST], + 0x18); + } + } else { + if ((gSaveContext.inventory.questItems & 0xF0000000) != 0) { + phi_s0_2 = 0x72; + } else { + phi_s0_2 = PAUSE_ITEM_NONE; + } + osSyncPrintf("888 ccc=%d (%d, %d, %x)\n", phi_s0_2, pauseCtx->cursorPoint[PAUSE_QUEST], 0x72, + gSaveContext.inventory.questItems & 0xF0000000); + } + + sp216 = pauseCtx->cursorPoint[PAUSE_QUEST]; + pauseCtx->cursorItem[pauseCtx->pageIndex] = phi_s0_2; + pauseCtx->cursorSlot[pauseCtx->pageIndex] = sp216; + } KaleidoScope_SetCursorVtx(pauseCtx, sp216 * 4, pauseCtx->questVtx);