Timer Savers: Mask Select in Inventory (#670)

* Timer Savers: Mask Select in Inventory

* Merge derp

* Implement suggestions per @briaguya-ai

* Fix cut & paste derp
This commit is contained in:
vaguerant 2022-07-24 23:14:36 +10:00 committed by GitHub
parent 1de5b72802
commit ccf1bffd4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 2 deletions

View File

@ -977,6 +977,8 @@ namespace SohImGui {
Tooltip("Skip the part where the Ocarina playback is called when you play\na song");
EnhancementCheckbox("Instant Putaway", "gInstantPutaway");
Tooltip("Allow Link to put items away without having to wait around");
EnhancementCheckbox("Mask Select in Inventory", "gMaskSelect");
Tooltip("After completing the mask trading sub-quest,\npress A and any direction on the mask slot to change masks");
ImGui::EndMenu();
}

View File

@ -9,6 +9,7 @@ u8 gAmmoItems[] = {
static s16 sEquipState = 0;
static s16 sEquipAnimTimer = 0;
static s16 sEquipMoveTimer = 10;
bool gSelectingMask;
static s16 sAmmoVtxOffset[] = {
0, 2, 4, 6, 99, 99, 8, 99, 99, 10, 99, 99, 99, 99, 99, 99, 12,
@ -108,7 +109,7 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
pauseCtx->nameColorSet = 0;
if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM)) {
moveCursorResult = 0;
moveCursorResult = 0 || gSelectingMask;
oldCursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM];
cursorItem = pauseCtx->cursorItem[PAUSE_ITEM];
@ -282,7 +283,7 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
if (pauseCtx->cursorSpecialPos == 0) {
if (cursorItem != PAUSE_ITEM_NONE) {
if ((ABS(pauseCtx->stickRelY) > 30) || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DDOWN | BTN_DUP))) {
moveCursorResult = 0;
moveCursorResult = 0 || gSelectingMask;
cursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM];
cursorY = pauseCtx->cursorY[PAUSE_ITEM];
@ -350,6 +351,40 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
KaleidoScope_SetCursorVtx(pauseCtx, index, pauseCtx->itemVtx);
if ((pauseCtx->debugState == 0) && (pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0)) {
if (CVar_GetS32("gMaskSelect", 0) && (gSaveContext.eventChkInf[8] & 0x8000) &&
cursorSlot == SLOT_TRADE_CHILD && CHECK_BTN_ALL(input->press.button, BTN_A)) {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
gSelectingMask = !gSelectingMask;
}
if (gSelectingMask) {
pauseCtx->cursorColorSet = 8;
if (((pauseCtx->stickRelX > 30 || pauseCtx->stickRelY > 30) ||
dpad && CHECK_BTN_ANY(input->press.button, BTN_DRIGHT | BTN_DUP)) &&
INV_CONTENT(ITEM_TRADE_CHILD) < ITEM_MASK_TRUTH) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
++INV_CONTENT(ITEM_TRADE_CHILD);
} else if (((pauseCtx->stickRelX < -30 || pauseCtx->stickRelY < -30) ||
dpad && CHECK_BTN_ANY(input->press.button, BTN_DLEFT | BTN_DDOWN)) &&
INV_CONTENT(ITEM_TRADE_CHILD) > ITEM_MASK_KEATON) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
--INV_CONTENT(ITEM_TRADE_CHILD);
} else if ((pauseCtx->stickRelX < -30 || pauseCtx->stickRelX > 30 || pauseCtx->stickRelY < -30 || pauseCtx->stickRelY > 30) ||
dpad && CHECK_BTN_ANY(input->press.button, BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT)) {
INV_CONTENT(ITEM_TRADE_CHILD) ^= ITEM_MASK_KEATON ^ ITEM_MASK_TRUTH;
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
for (uint16_t cSlotIndex = 0; cSlotIndex < ARRAY_COUNT(gSaveContext.equips.cButtonSlots); cSlotIndex++) {
if (gSaveContext.equips.cButtonSlots[cSlotIndex] == SLOT_TRADE_CHILD) {
if (!LINK_IS_ADULT || CVar_GetS32("gNoRestrictAge", 0)) {
gSaveContext.equips.buttonItems[cSlotIndex+1] = INV_CONTENT(ITEM_TRADE_CHILD);
} else if (INV_CONTENT(ITEM_TRADE_CHILD) != gSaveContext.equips.buttonItems[cSlotIndex+1]) {
gSaveContext.equips.cButtonSlots[cSlotIndex] = SLOT_NONE;
gSaveContext.equips.buttonItems[cSlotIndex+1] = ITEM_NONE;
}
}
}
gSelectingMask = cursorSlot == SLOT_TRADE_CHILD;
}
u16 buttonsToCheck = BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT;
if (CVar_GetS32("gDpadEquips", 0) && (!CVar_GetS32("gDpadPauseName", 0) || CHECK_BTN_ALL(input->cur.button, BTN_CUP))) {
buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT;
@ -474,6 +509,7 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
void KaleidoScope_SetupItemEquip(GlobalContext* globalCtx, u16 item, u16 slot, s16 animX, s16 animY) {
Input* input = &globalCtx->state.input[0];
PauseContext* pauseCtx = &globalCtx->pauseCtx;
gSelectingMask = false;
if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
pauseCtx->equipTargetCBtn = 0;

View File

@ -10,6 +10,7 @@ extern s16 D_8082AB2C[];
extern u8 gSlotAgeReqs[];
extern u8 gEquipAgeReqs[][4];
extern u8 gAreaGsFlags[];
extern bool gSelectingMask;
void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfxCtx);
s32 KaleidoScope_UpdateQuestStatusPoint(PauseContext* pauseCtx, s32 point);

View File

@ -867,6 +867,7 @@ void KaleidoScope_SetDefaultCursor(GlobalContext* globalCtx) {
PauseContext* pauseCtx = &globalCtx->pauseCtx;
s16 s;
s16 i;
gSelectingMask = false;
switch (pauseCtx->pageIndex) {
case PAUSE_ITEM:
@ -900,6 +901,7 @@ void KaleidoScope_SetDefaultCursor(GlobalContext* globalCtx) {
void KaleidoScope_SwitchPage(PauseContext* pauseCtx, u8 pt) {
pauseCtx->unk_1E4 = 1;
pauseCtx->unk_1EA = 0;
gSelectingMask = false;
if (!pt) {
pauseCtx->mode = pauseCtx->pageIndex * 2 + 1;