diff --git a/patches/input.c b/patches/input.c index f65d2cc..a0c5e24 100644 --- a/patches/input.c +++ b/patches/input.c @@ -546,6 +546,9 @@ extern s16 sPictoPhotoBeingTaken; extern void* gWorkBuffer; u16 func_801A5100(void); +#define ON_EPONA (player->stateFlags1 & PLAYER_STATE1_800000) +#define EPONA_FIX_ACTIVE (no_bow_epona_fix && ON_EPONA) + // @recomp Patched to update status of extra buttons via set_extra_item_slot_status. RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) { InterfaceContext* interfaceCtx = &play->interfaceCtx; @@ -555,11 +558,11 @@ RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) { if (gSaveContext.save.cutsceneIndex < 0xFFF0) { gSaveContext.hudVisibilityForceButtonAlphasByStatus = false; - if ((player->stateFlags1 & PLAYER_STATE1_800000) || CHECK_WEEKEVENTREG(WEEKEVENTREG_08_01) || + if (ON_EPONA || CHECK_WEEKEVENTREG(WEEKEVENTREG_08_01) || (!CHECK_EVENTINF(EVENTINF_41) && (play->unk_1887C >= 2))) { // Riding Epona OR Honey & Darling minigame OR Horseback balloon minigame OR related to swamp boat // (non-minigame?) - if ((player->stateFlags1 & PLAYER_STATE1_800000) && (player->currentMask == PLAYER_MASK_BLAST) && + if (ON_EPONA && (player->currentMask == PLAYER_MASK_BLAST) && (gSaveContext.bButtonStatus == BTN_DISABLED)) { // Riding Epona with blast mask? restoreHudVisibility = true; @@ -611,7 +614,7 @@ RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) { set_extra_item_slot_status(BTN_DISABLED); } else { // @recomp_use_export_var no_bow_epona_fix: Part of the no bow Epona fix. - if (no_bow_epona_fix) { + if (EPONA_FIX_ACTIVE) { if (gSaveContext.save.saveInfo.inventory.items[SLOT_BOW] == ITEM_BOW) { BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOW; BUTTON_STATUS(EQUIP_SLOT_B) = BTN_ENABLED; @@ -624,7 +627,7 @@ RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) { Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); } else if (gSaveContext.save.saveInfo.inventory.items[SLOT_BOW] == ITEM_NONE) { // @recomp_use_export_var no_bow_epona_fix: Part of the no bow Epona fix. - if (no_bow_epona_fix) { + if (EPONA_FIX_ACTIVE) { gSaveContext.buttonStatus[EQUIP_SLOT_B] = BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B); BUTTON_STATUS(EQUIP_SLOT_B) = BTN_DISABLED; } else { @@ -635,7 +638,7 @@ RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) { } // @recomp_use_export_var no_bow_epona_fix: If the B button does not contain a sword, don't disable the UI. - if (!no_bow_epona_fix || BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) < ITEM_SWORD_KOKIRI || + if (!EPONA_FIX_ACTIVE || BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) < ITEM_SWORD_KOKIRI || BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) > ITEM_SWORD_GILDED) { BUTTON_STATUS(EQUIP_SLOT_C_LEFT) = BTN_DISABLED; BUTTON_STATUS(EQUIP_SLOT_C_DOWN) = BTN_DISABLED; @@ -669,12 +672,12 @@ RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) { BUTTON_STATUS(EQUIP_SLOT_C_RIGHT) = BTN_DISABLED; set_extra_item_slot_status(BTN_DISABLED); Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); - } else if (player->stateFlags1 & PLAYER_STATE1_800000) { + } else if (ON_EPONA) { Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); } } } else { - if (player->stateFlags1 & PLAYER_STATE1_800000) { + if (ON_EPONA) { Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); } @@ -692,7 +695,7 @@ RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) { set_extra_item_slot_status(BTN_DISABLED); } else { // @recomp_use_export_var no_bow_epona_fix: Part of the no bow Epona fix. - if (no_bow_epona_fix) { + if (EPONA_FIX_ACTIVE) { if (gSaveContext.save.saveInfo.inventory.items[SLOT_BOW] == ITEM_BOW) { BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOW; BUTTON_STATUS(EQUIP_SLOT_B) = BTN_ENABLED; @@ -706,7 +709,7 @@ RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) { Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); } else if (gSaveContext.save.saveInfo.inventory.items[SLOT_BOW] == ITEM_NONE) { // @recomp_use_export_var no_bow_epona_fix: Part of the no bow Epona fix. - if (no_bow_epona_fix) { + if (EPONA_FIX_ACTIVE) { gSaveContext.buttonStatus[EQUIP_SLOT_B] = BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B); BUTTON_STATUS(EQUIP_SLOT_B) = BTN_DISABLED; } else { @@ -753,7 +756,7 @@ RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) { BUTTON_STATUS(EQUIP_SLOT_C_RIGHT) = BTN_DISABLED; set_extra_item_slot_status(BTN_DISABLED); Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); - } else if (player->stateFlags1 & PLAYER_STATE1_800000) { + } else if (ON_EPONA) { Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); } }