Item cycling improvements (#3456)

* Simplify item cycling

* Simplify selection variables

* Fix adult bunny hood and gray appropriate items

* Don't go into cycling mode when there's no items to cycle to

* Restore updating c buttons

This was previously done with `Inventory_ReplaceItem` but that led to problems when another slot had the same item as the one that's being cycled.

* Address review
This commit is contained in:
Pepe20129 2023-12-27 18:55:09 +01:00 committed by GitHub
parent 9b74dc2892
commit dc4347253d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 176 additions and 100 deletions

View File

@ -14,8 +14,6 @@ u8 gAmmoItems[] = {
static s16 sEquipState = 0; static s16 sEquipState = 0;
static s16 sEquipAnimTimer = 0; static s16 sEquipAnimTimer = 0;
static s16 sEquipMoveTimer = 10; static s16 sEquipMoveTimer = 10;
bool gSelectingMask;
bool gSelectingAdultTrade;
static s16 sAmmoVtxOffset[] = { static s16 sAmmoVtxOffset[] = {
0, 2, 4, 6, 99, 99, 8, 99, 10, 99, 99, 99, 99, 99, 12, 0, 2, 4, 6, 99, 99, 8, 99, 10, 99, 99, 99, 99, 99, 12,
@ -87,6 +85,10 @@ void KaleidoScope_SetItemCursorVtx(PauseContext* pauseCtx) {
KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_ITEM] * 4, pauseCtx->itemVtx); KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_ITEM] * 4, pauseCtx->itemVtx);
} }
#pragma region Item Cycling
s8 gCurrentItemCyclingSlot;
// Vertices for the extra items // Vertices for the extra items
static Vtx sCycleExtraItemVtx[] = { static Vtx sCycleExtraItemVtx[] = {
// Left Item // Left Item
@ -127,9 +129,11 @@ static Vtx sCycleAButtonVtx[] = {
static sSlotCycleActiveAnimTimer[24] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static sSlotCycleActiveAnimTimer[24] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
// Renders a left and/or right item for any item slot that can support cycling // Renders a left and/or right item for any item slot that can support cycling
void KaleidoScope_DrawItemCycleExtras(PlayState* play, u8 slot, u8 isCycling, u8 canCycle, u8 leftItem, u8 rightItem) { void KaleidoScope_DrawItemCycleExtras(PlayState* play, u8 slot, u8 canCycle, u8 leftItem, u8 rightItem) {
PauseContext* pauseCtx = &play->pauseCtx; PauseContext* pauseCtx = &play->pauseCtx;
u8 isCycling = gCurrentItemCyclingSlot == slot;
OPEN_DISPS(play->state.gfxCtx); OPEN_DISPS(play->state.gfxCtx);
// Update active cycling animation timer // Update active cycling animation timer
@ -208,10 +212,20 @@ void KaleidoScope_DrawItemCycleExtras(PlayState* play, u8 slot, u8 isCycling, u8
gSPVertex(POLY_KAL_DISP++, sCycleExtraItemVtx, 8, 0); gSPVertex(POLY_KAL_DISP++, sCycleExtraItemVtx, 8, 0);
if (showLeftItem) { if (showLeftItem) {
if (!CHECK_AGE_REQ_ITEM(leftItem)) {
gDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255);
gSPGrayscale(POLY_KAL_DISP++, true);
}
KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gItemIcons[leftItem], 32, 32, 0); KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gItemIcons[leftItem], 32, 32, 0);
gSPGrayscale(POLY_KAL_DISP++, false);
} }
if (showRightItem) { if (showRightItem) {
if (!CHECK_AGE_REQ_ITEM(rightItem)) {
gDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255);
gSPGrayscale(POLY_KAL_DISP++, true);
}
KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gItemIcons[rightItem], 32, 32, 4); KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gItemIcons[rightItem], 32, 32, 4);
gSPGrayscale(POLY_KAL_DISP++, false);
} }
Matrix_Pop(); Matrix_Pop();
@ -220,6 +234,155 @@ void KaleidoScope_DrawItemCycleExtras(PlayState* play, u8 slot, u8 isCycling, u8
CLOSE_DISPS(play->state.gfxCtx); CLOSE_DISPS(play->state.gfxCtx);
} }
void KaleidoScope_HandleItemCycleExtras(PlayState* play, u8 slot, bool canCycle, u8 leftItem, u8 rightItem, bool replaceCButtons) {
Input* input = &play->state.input[0];
PauseContext* pauseCtx = &play->pauseCtx;
bool dpad = (CVarGetInteger("gDpadPause", 0) && !CHECK_BTN_ALL(input->cur.button, BTN_CUP));
u8 slotItem = gSaveContext.inventory.items[slot];
u8 hasLeftItem = leftItem != ITEM_NONE && slotItem != leftItem;
u8 hasRightItem = rightItem != ITEM_NONE && slotItem != rightItem && leftItem != rightItem;
if (
canCycle &&
pauseCtx->cursorSlot[PAUSE_ITEM] == slot &&
CHECK_BTN_ALL(input->press.button, BTN_A) &&
(hasLeftItem || hasRightItem)
) {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
gCurrentItemCyclingSlot = gCurrentItemCyclingSlot == slot ? -1 : slot;
}
if (gCurrentItemCyclingSlot == slot) {
pauseCtx->cursorColorSet = 8;
if ((pauseCtx->stickRelX > 30 || pauseCtx->stickRelY > 30) ||
dpad && CHECK_BTN_ANY(input->press.button, BTN_DRIGHT | BTN_DUP)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
if (replaceCButtons) {
for (int i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if (gSaveContext.equips.buttonItems[i] == gSaveContext.inventory.items[slot]) {
if (CHECK_AGE_REQ_ITEM(rightItem)) {
gSaveContext.equips.buttonItems[i] = rightItem;
Interface_LoadItemIcon1(play, i);
} else {
gSaveContext.equips.buttonItems[i] = ITEM_NONE;
}
break;
}
}
}
gSaveContext.inventory.items[slot] = rightItem;
} else if ((pauseCtx->stickRelX < -30 || pauseCtx->stickRelY < -30) ||
dpad && CHECK_BTN_ANY(input->press.button, BTN_DLEFT | BTN_DDOWN)) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
if (replaceCButtons) {
for (int i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if (gSaveContext.equips.buttonItems[i] == gSaveContext.inventory.items[slot]) {
if (CHECK_AGE_REQ_ITEM(leftItem)) {
gSaveContext.equips.buttonItems[i] = leftItem;
Interface_LoadItemIcon1(play, i);
} else {
gSaveContext.equips.buttonItems[i] = ITEM_NONE;
}
break;
}
}
}
gSaveContext.inventory.items[slot] = leftItem;
}
gCurrentItemCyclingSlot = pauseCtx->cursorSlot[PAUSE_ITEM] == slot ? slot : -1;
}
}
bool CanMaskSelect() {
// only allow mask select when:
// the shop is open:
// * zelda's letter check: Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_ZELDAS_LETTER)
// * kak gate check: Flags_GetInfTable(INFTABLE_SHOWED_ZELDAS_LETTER_TO_GATE_GUARD)
// and the mask quest is complete: Flags_GetEventChkInf(EVENTCHKINF_PAID_BACK_BUNNY_HOOD_FEE)
return CVarGetInteger("gMaskSelect", 0) &&
Flags_GetEventChkInf(EVENTCHKINF_PAID_BACK_BUNNY_HOOD_FEE) &&
Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_ZELDAS_LETTER) &&
Flags_GetInfTable(INFTABLE_SHOWED_ZELDAS_LETTER_TO_GATE_GUARD);
}
void KaleidoScope_HandleItemCycles(PlayState* play) {
//handle the mask select
KaleidoScope_HandleItemCycleExtras(
play,
SLOT_TRADE_CHILD,
CanMaskSelect(),
INV_CONTENT(ITEM_TRADE_CHILD) <= ITEM_MASK_KEATON || INV_CONTENT(ITEM_TRADE_CHILD) > ITEM_MASK_TRUTH ?
ITEM_MASK_TRUTH :
INV_CONTENT(ITEM_TRADE_CHILD) - 1,
INV_CONTENT(ITEM_TRADE_CHILD) >= ITEM_MASK_TRUTH || INV_CONTENT(ITEM_TRADE_CHILD) < ITEM_MASK_KEATON ?
ITEM_MASK_KEATON :
INV_CONTENT(ITEM_TRADE_CHILD) + 1,
true
);
//the slot age requirement for the child trade slot has to be updated
//in case it currently holds the bunny hood
//to allow adult link to wear it if the setting is enabled
gSlotAgeReqs[SLOT_TRADE_CHILD] =
(
((CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA) && CVarGetInteger("gAdultBunnyHood", 0)) ||
CVarGetInteger("gTimelessEquipment", 0)
) &&
INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_MASK_BUNNY
? AGE_REQ_NONE
: AGE_REQ_CHILD;
//also update the age requirement for the bunny hood itself
gItemAgeReqs[ITEM_MASK_BUNNY] =
((CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA) && CVarGetInteger("gAdultBunnyHood", 0)) ||
CVarGetInteger("gTimelessEquipment", 0)
? AGE_REQ_NONE
: AGE_REQ_CHILD;
//handle the adult trade select
KaleidoScope_HandleItemCycleExtras(
play,
SLOT_TRADE_ADULT,
IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE),
Randomizer_GetPrevAdultTradeItem(),
Randomizer_GetNextAdultTradeItem(),
true
);
}
void KaleidoScope_DrawItemCycles(PlayState* play) {
//draw the mask select
KaleidoScope_DrawItemCycleExtras(
play,
SLOT_TRADE_CHILD,
CanMaskSelect(),
INV_CONTENT(ITEM_TRADE_CHILD) <= ITEM_MASK_KEATON || INV_CONTENT(ITEM_TRADE_CHILD) > ITEM_MASK_TRUTH ?
ITEM_MASK_TRUTH :
INV_CONTENT(ITEM_TRADE_CHILD) - 1,
INV_CONTENT(ITEM_TRADE_CHILD) >= ITEM_MASK_TRUTH || INV_CONTENT(ITEM_TRADE_CHILD) < ITEM_MASK_KEATON ?
ITEM_MASK_KEATON :
INV_CONTENT(ITEM_TRADE_CHILD) + 1
);
//draw the adult trade select
KaleidoScope_DrawItemCycleExtras(
play,
SLOT_TRADE_ADULT,
IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE),
Randomizer_GetPrevAdultTradeItem(),
Randomizer_GetNextAdultTradeItem()
);
}
bool IsItemCycling() {
return gCurrentItemCyclingSlot != -1;
}
void KaleidoScope_ResetItemCycling() {
gCurrentItemCyclingSlot = -1;
}
#pragma endregion
void KaleidoScope_DrawItemSelect(PlayState* play) { void KaleidoScope_DrawItemSelect(PlayState* play) {
static s16 magicArrowEffectsR[] = { 255, 100, 255 }; static s16 magicArrowEffectsR[] = { 255, 100, 255 };
static s16 magicArrowEffectsG[] = { 0, 100, 255 }; static s16 magicArrowEffectsG[] = { 0, 100, 255 };
@ -240,16 +403,6 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
bool pauseAnyCursor = (CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && IS_RANDO) || bool pauseAnyCursor = (CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && IS_RANDO) ||
(CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_ALWAYS_ON); (CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_ALWAYS_ON);
// only allow mask select when:
// the shop is open:
// * zelda's letter check: Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_ZELDAS_LETTER)
// * kak gate check: Flags_GetInfTable(INFTABLE_SHOWED_ZELDAS_LETTER_TO_GATE_GUARD)
// and the mask quest is complete: Flags_GetEventChkInf(EVENTCHKINF_PAID_BACK_BUNNY_HOOD_FEE)
bool canMaskSelect = CVarGetInteger("gMaskSelect", 0) &&
Flags_GetEventChkInf(EVENTCHKINF_PAID_BACK_BUNNY_HOOD_FEE) &&
Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_ZELDAS_LETTER) &&
Flags_GetInfTable(INFTABLE_SHOWED_ZELDAS_LETTER_TO_GATE_GUARD);
OPEN_DISPS(play->state.gfxCtx); OPEN_DISPS(play->state.gfxCtx);
Gfx_SetupDL_42Opa(play->state.gfxCtx); Gfx_SetupDL_42Opa(play->state.gfxCtx);
@ -260,7 +413,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
pauseCtx->nameColorSet = 0; pauseCtx->nameColorSet = 0;
if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM)) { if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM)) {
moveCursorResult = 0 || gSelectingMask || gSelectingAdultTrade; moveCursorResult = 0 || IsItemCycling();
oldCursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM]; oldCursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM];
cursorItem = pauseCtx->cursorItem[PAUSE_ITEM]; cursorItem = pauseCtx->cursorItem[PAUSE_ITEM];
@ -434,7 +587,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
if (pauseCtx->cursorSpecialPos == 0) { if (pauseCtx->cursorSpecialPos == 0) {
if (cursorItem != PAUSE_ITEM_NONE) { if (cursorItem != PAUSE_ITEM_NONE) {
if ((ABS(pauseCtx->stickRelY) > 30) || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DDOWN | BTN_DUP))) { if ((ABS(pauseCtx->stickRelY) > 30) || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DDOWN | BTN_DUP))) {
moveCursorResult = 0 || gSelectingMask || gSelectingAdultTrade; moveCursorResult = 0 || IsItemCycling();
cursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM]; cursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM];
cursorY = pauseCtx->cursorY[PAUSE_ITEM]; cursorY = pauseCtx->cursorY[PAUSE_ITEM];
@ -499,68 +652,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
KaleidoScope_SetCursorVtx(pauseCtx, index, pauseCtx->itemVtx); KaleidoScope_SetCursorVtx(pauseCtx, index, pauseCtx->itemVtx);
if ((pauseCtx->debugState == 0) && (pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0)) { if ((pauseCtx->debugState == 0) && (pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0)) {
if (canMaskSelect && cursorSlot == SLOT_TRADE_CHILD && CHECK_BTN_ALL(input->press.button, BTN_A)) { KaleidoScope_HandleItemCycles(play);
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)) {
// Change to keaton mask if no mask is in child trade slot. Catches Zelda's letter and bottle duping over this slot.
if (INV_CONTENT(ITEM_TRADE_CHILD) < ITEM_MASK_KEATON || INV_CONTENT(ITEM_TRADE_CHILD) > ITEM_MASK_TRUTH) {
INV_CONTENT(ITEM_TRADE_CHILD) = ITEM_MASK_KEATON;
} else {
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 || CVarGetInteger("gTimelessEquipment", 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;
gSlotAgeReqs[SLOT_TRADE_CHILD] = gItemAgeReqs[ITEM_MASK_BUNNY] =
((((CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA) && CVarGetInteger("gAdultBunnyHood", 0)) || CVarGetInteger("gTimelessEquipment", 0)) &&
INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_MASK_BUNNY)
? AGE_REQ_NONE
: AGE_REQ_CHILD;
}
if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE) &&
cursorSlot == SLOT_TRADE_ADULT && CHECK_BTN_ALL(input->press.button, BTN_A)) {
Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
gSelectingAdultTrade = !gSelectingAdultTrade;
}
if (gSelectingAdultTrade) {
pauseCtx->cursorColorSet = 8;
if (((pauseCtx->stickRelX > 30 || pauseCtx->stickRelY > 30) ||
dpad && CHECK_BTN_ANY(input->press.button, BTN_DRIGHT | BTN_DUP))) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
Inventory_ReplaceItem(play, INV_CONTENT(ITEM_TRADE_ADULT), Randomizer_GetNextAdultTradeItem());
} else if (((pauseCtx->stickRelX < -30 || pauseCtx->stickRelY < -30) ||
dpad && CHECK_BTN_ANY(input->press.button, BTN_DLEFT | BTN_DDOWN))) {
Audio_PlaySoundGeneral(NA_SE_SY_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
Inventory_ReplaceItem(play, INV_CONTENT(ITEM_TRADE_ADULT), Randomizer_GetPrevAdultTradeItem());
}
gSelectingAdultTrade = cursorSlot == SLOT_TRADE_ADULT;
}
u16 buttonsToCheck = BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT; u16 buttonsToCheck = BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT;
if (CVarGetInteger("gDpadEquips", 0) && (!CVarGetInteger("gDpadPause", 0) || CHECK_BTN_ALL(input->cur.button, BTN_CUP))) { if (CVarGetInteger("gDpadEquips", 0) && (!CVarGetInteger("gDpadPause", 0) || CHECK_BTN_ALL(input->cur.button, BTN_CUP))) {
buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT;
@ -678,15 +770,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
} }
} }
// Adult trade item cycle KaleidoScope_DrawItemCycles(play);
KaleidoScope_DrawItemCycleExtras(play, SLOT_TRADE_ADULT, gSelectingAdultTrade,
IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE),
Randomizer_GetPrevAdultTradeItem(), Randomizer_GetNextAdultTradeItem());
// Child mask item cycle (mimics the left/right item behavior from the cycling logic above)
u8 childTradeItem = INV_CONTENT(ITEM_TRADE_CHILD);
KaleidoScope_DrawItemCycleExtras(play, SLOT_TRADE_CHILD, gSelectingMask, canMaskSelect,
childTradeItem <= ITEM_MASK_KEATON ? ITEM_MASK_TRUTH : childTradeItem - 1,
childTradeItem >= ITEM_MASK_TRUTH ? ITEM_MASK_KEATON : childTradeItem + 1);
CLOSE_DISPS(play->state.gfxCtx); CLOSE_DISPS(play->state.gfxCtx);
} }
@ -694,8 +778,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
void KaleidoScope_SetupItemEquip(PlayState* play, u16 item, u16 slot, s16 animX, s16 animY) { void KaleidoScope_SetupItemEquip(PlayState* play, u16 item, u16 slot, s16 animX, s16 animY) {
Input* input = &play->state.input[0]; Input* input = &play->state.input[0];
PauseContext* pauseCtx = &play->pauseCtx; PauseContext* pauseCtx = &play->pauseCtx;
gSelectingMask = false; KaleidoScope_ResetItemCycling();
gSelectingAdultTrade = false;
if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
pauseCtx->equipTargetCBtn = 0; pauseCtx->equipTargetCBtn = 0;
@ -1080,8 +1163,3 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) {
} }
} }
} }
void KaleidoScope_ResetTradeSelect() {
gSelectingMask = false;
gSelectingAdultTrade = false;
}

View File

@ -11,7 +11,6 @@ extern u8 gEquipAgeReqs[][4];
extern u8 gSlotAgeReqs[]; extern u8 gSlotAgeReqs[];
extern u8 gItemAgeReqs[]; extern u8 gItemAgeReqs[];
extern u8 gAreaGsFlags[]; extern u8 gAreaGsFlags[];
extern bool gSelectingMask;
#define MAP_48x85_TEX_WIDTH 48 #define MAP_48x85_TEX_WIDTH 48
#define MAP_48x85_TEX_HEIGHT 85 #define MAP_48x85_TEX_HEIGHT 85
@ -50,6 +49,6 @@ void PauseMapMark_Draw(PlayState* play);
void KaleidoScope_UpdateCursorSize(PauseContext* pauseCtx); void KaleidoScope_UpdateCursorSize(PauseContext* pauseCtx);
void KaleidoScope_ResetTradeSelect(); void KaleidoScope_ResetItemCycling();
#endif #endif

View File

@ -1008,7 +1008,7 @@ void KaleidoScope_SetDefaultCursor(PlayState* play) {
PauseContext* pauseCtx = &play->pauseCtx; PauseContext* pauseCtx = &play->pauseCtx;
s16 s; s16 s;
s16 i; s16 i;
gSelectingMask = false; KaleidoScope_ResetItemCycling();
switch (pauseCtx->pageIndex) { switch (pauseCtx->pageIndex) {
case PAUSE_ITEM: case PAUSE_ITEM:
@ -1042,7 +1042,6 @@ void KaleidoScope_SetDefaultCursor(PlayState* play) {
void KaleidoScope_SwitchPage(PauseContext* pauseCtx, u8 pt) { void KaleidoScope_SwitchPage(PauseContext* pauseCtx, u8 pt) {
pauseCtx->unk_1E4 = 1; pauseCtx->unk_1E4 = 1;
pauseCtx->unk_1EA = 0; pauseCtx->unk_1EA = 0;
gSelectingMask = false;
if (!pt) { if (!pt) {
pauseCtx->mode = pauseCtx->pageIndex * 2 + 1; pauseCtx->mode = pauseCtx->pageIndex * 2 + 1;
@ -1074,7 +1073,7 @@ void KaleidoScope_SwitchPage(PauseContext* pauseCtx, u8 pt) {
gSaveContext.unk_13EA = 0; gSaveContext.unk_13EA = 0;
Interface_ChangeAlpha(50); Interface_ChangeAlpha(50);
KaleidoScope_ResetTradeSelect(); KaleidoScope_ResetItemCycling();
} }
void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) { void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) {
@ -3857,7 +3856,7 @@ void KaleidoScope_Update(PlayState* play)
} }
} }
KaleidoScope_ResetTradeSelect(); KaleidoScope_ResetItemCycling();
pauseCtx->state = 4; pauseCtx->state = 4;
break; break;