mirror of
https://github.com/Mr-Wiseguy/Zelda64Recomp.git
synced 2024-11-06 06:45:05 +01:00
Add exports for fd anywhere and epona fix patches (#494)
* add exports for fd anywhere and epona fix patches * use better logic for restoreHudVisibility * cleanup * fix a couple edge cases (being sent the bow while riding Epona)
This commit is contained in:
parent
8c8f5b889f
commit
21ca074bf7
@ -534,6 +534,13 @@ RECOMP_PATCH void Player_Action_86(Player *this, PlayState *play) {
|
|||||||
func_808550D0(play, this, this->unk_B10[4], this->unk_B10[5], (this->transformation == PLAYER_FORM_HUMAN) ? 0 : 1);
|
func_808550D0(play, this, this->unk_B10[4], this->unk_B10[5], (this->transformation == PLAYER_FORM_HUMAN) ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool no_bow_epona_fix = false;
|
||||||
|
|
||||||
|
// @recomp_export void recomp_set_no_bow_epona_fix(bool new_val): Set whether to enable the fix for getting on Epona without a bow.
|
||||||
|
RECOMP_EXPORT void recomp_set_no_bow_epona_fix(bool new_val) {
|
||||||
|
no_bow_epona_fix = new_val;
|
||||||
|
}
|
||||||
|
|
||||||
extern s16 sPictoState;
|
extern s16 sPictoState;
|
||||||
extern s16 sPictoPhotoBeingTaken;
|
extern s16 sPictoPhotoBeingTaken;
|
||||||
extern void* gWorkBuffer;
|
extern void* gWorkBuffer;
|
||||||
@ -603,16 +610,33 @@ RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) {
|
|||||||
BUTTON_STATUS(EQUIP_SLOT_C_RIGHT) = BTN_DISABLED;
|
BUTTON_STATUS(EQUIP_SLOT_C_RIGHT) = BTN_DISABLED;
|
||||||
set_extra_item_slot_status(BTN_DISABLED);
|
set_extra_item_slot_status(BTN_DISABLED);
|
||||||
} else {
|
} else {
|
||||||
|
// @recomp_use_export_var no_bow_epona_fix: Part of the no bow Epona fix.
|
||||||
|
if (no_bow_epona_fix) {
|
||||||
|
if (gSaveContext.save.saveInfo.inventory.items[SLOT_BOW] == ITEM_BOW) {
|
||||||
BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOW;
|
BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOW;
|
||||||
|
BUTTON_STATUS(EQUIP_SLOT_B) = BTN_ENABLED;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOW;
|
||||||
|
}
|
||||||
|
|
||||||
if (play->unk_1887C >= 2) {
|
if (play->unk_1887C >= 2) {
|
||||||
Interface_LoadItemIconImpl(play, EQUIP_SLOT_B);
|
Interface_LoadItemIconImpl(play, EQUIP_SLOT_B);
|
||||||
} else if (gSaveContext.save.saveInfo.inventory.items[SLOT_BOW] == ITEM_NONE) {
|
} 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) {
|
||||||
|
gSaveContext.buttonStatus[EQUIP_SLOT_B] = BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B);
|
||||||
|
BUTTON_STATUS(EQUIP_SLOT_B) = BTN_DISABLED;
|
||||||
|
} else {
|
||||||
BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NONE;
|
BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NONE;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Interface_LoadItemIconImpl(play, EQUIP_SLOT_B);
|
Interface_LoadItemIconImpl(play, EQUIP_SLOT_B);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @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 ||
|
||||||
|
BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) > ITEM_SWORD_GILDED) {
|
||||||
BUTTON_STATUS(EQUIP_SLOT_C_LEFT) = BTN_DISABLED;
|
BUTTON_STATUS(EQUIP_SLOT_C_LEFT) = BTN_DISABLED;
|
||||||
BUTTON_STATUS(EQUIP_SLOT_C_DOWN) = BTN_DISABLED;
|
BUTTON_STATUS(EQUIP_SLOT_C_DOWN) = BTN_DISABLED;
|
||||||
BUTTON_STATUS(EQUIP_SLOT_C_RIGHT) = BTN_DISABLED;
|
BUTTON_STATUS(EQUIP_SLOT_C_RIGHT) = BTN_DISABLED;
|
||||||
@ -620,6 +644,11 @@ RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) {
|
|||||||
Interface_SetHudVisibility(HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_WITH_OVERWRITE);
|
Interface_SetHudVisibility(HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_WITH_OVERWRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BUTTON_STATUS(EQUIP_SLOT_B) == BTN_DISABLED && BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOW) {
|
||||||
|
BUTTON_STATUS(EQUIP_SLOT_B) = BTN_ENABLED;
|
||||||
|
}
|
||||||
|
|
||||||
if (play->transitionMode != TRANS_MODE_OFF) {
|
if (play->transitionMode != TRANS_MODE_OFF) {
|
||||||
Interface_SetHudVisibility(HUD_VISIBILITY_NONE);
|
Interface_SetHudVisibility(HUD_VISIBILITY_NONE);
|
||||||
@ -662,27 +691,51 @@ RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) {
|
|||||||
BUTTON_STATUS(EQUIP_SLOT_C_RIGHT) = BTN_DISABLED;
|
BUTTON_STATUS(EQUIP_SLOT_C_RIGHT) = BTN_DISABLED;
|
||||||
set_extra_item_slot_status(BTN_DISABLED);
|
set_extra_item_slot_status(BTN_DISABLED);
|
||||||
} else {
|
} else {
|
||||||
|
// @recomp_use_export_var no_bow_epona_fix: Part of the no bow Epona fix.
|
||||||
|
if (no_bow_epona_fix) {
|
||||||
|
if (gSaveContext.save.saveInfo.inventory.items[SLOT_BOW] == ITEM_BOW) {
|
||||||
BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOW;
|
BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOW;
|
||||||
|
BUTTON_STATUS(EQUIP_SLOT_B) = BTN_ENABLED;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOW;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (play->unk_1887C >= 2) {
|
if (play->unk_1887C >= 2) {
|
||||||
Interface_LoadItemIconImpl(play, EQUIP_SLOT_B);
|
Interface_LoadItemIconImpl(play, EQUIP_SLOT_B);
|
||||||
} else if (gSaveContext.save.saveInfo.inventory.items[SLOT_BOW] == ITEM_NONE) {
|
} 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) {
|
||||||
|
gSaveContext.buttonStatus[EQUIP_SLOT_B] = BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B);
|
||||||
|
BUTTON_STATUS(EQUIP_SLOT_B) = BTN_DISABLED;
|
||||||
|
} else {
|
||||||
BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NONE;
|
BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NONE;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Interface_LoadItemIconImpl(play, EQUIP_SLOT_B);
|
Interface_LoadItemIconImpl(play, EQUIP_SLOT_B);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BUTTON_STATUS(EQUIP_SLOT_B) == BTN_DISABLED) {
|
if (BUTTON_STATUS(EQUIP_SLOT_B) == BTN_DISABLED) {
|
||||||
|
// @recomp_use_export_var no_bow_epona_fix: Don't enable the B button unless it is being used for the bow.
|
||||||
|
if (!no_bow_epona_fix || BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOW) {
|
||||||
BUTTON_STATUS(EQUIP_SLOT_B) = BTN_ENABLED;
|
BUTTON_STATUS(EQUIP_SLOT_B) = BTN_ENABLED;
|
||||||
restoreHudVisibility = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @recomp_use_export_var no_bow_epona_fix: Don't restore hud visibility from Epona without a sword.
|
||||||
|
if (!no_bow_epona_fix || (player->stateFlags1 & PLAYER_STATE1_800000) == 0) {
|
||||||
|
restoreHudVisibility = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// @recomp_use_export_var no_bow_epona_fix: If the B button does not contain the bow, don't disable the UI.
|
||||||
|
if (!no_bow_epona_fix || BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOW) {
|
||||||
BUTTON_STATUS(EQUIP_SLOT_C_LEFT) = BTN_DISABLED;
|
BUTTON_STATUS(EQUIP_SLOT_C_LEFT) = BTN_DISABLED;
|
||||||
BUTTON_STATUS(EQUIP_SLOT_C_DOWN) = BTN_DISABLED;
|
BUTTON_STATUS(EQUIP_SLOT_C_DOWN) = BTN_DISABLED;
|
||||||
BUTTON_STATUS(EQUIP_SLOT_C_RIGHT) = BTN_DISABLED;
|
BUTTON_STATUS(EQUIP_SLOT_C_RIGHT) = BTN_DISABLED;
|
||||||
set_extra_item_slot_status(BTN_DISABLED);
|
set_extra_item_slot_status(BTN_DISABLED);
|
||||||
Interface_SetHudVisibility(HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_WITH_OVERWRITE);
|
Interface_SetHudVisibility(HUD_VISIBILITY_A_HEARTS_MAGIC_MINIMAP_WITH_OVERWRITE);
|
||||||
|
}
|
||||||
|
|
||||||
if (play->transitionMode != TRANS_MODE_OFF) {
|
if (play->transitionMode != TRANS_MODE_OFF) {
|
||||||
Interface_SetHudVisibility(HUD_VISIBILITY_NONE);
|
Interface_SetHudVisibility(HUD_VISIBILITY_NONE);
|
||||||
@ -802,6 +855,13 @@ RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool fd_anywhere = false;
|
||||||
|
|
||||||
|
// @recomp_export void recomp_set_fd_anywhere(bool new_val): Set whether the Fierce Deity's Mask has scene restrictions.
|
||||||
|
RECOMP_EXPORT void recomp_set_fd_anywhere(bool new_val) {
|
||||||
|
fd_anywhere = new_val;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A continuation of the if-else chain from Interface_UpdateButtonsPart1
|
* A continuation of the if-else chain from Interface_UpdateButtonsPart1
|
||||||
* Also used directly when opening the pause menu i.e. skips part 1
|
* Also used directly when opening the pause menu i.e. skips part 1
|
||||||
@ -1181,7 +1241,8 @@ RECOMP_PATCH void Interface_UpdateButtonsPart2(PlayState* play) {
|
|||||||
}
|
}
|
||||||
} else if (GET_CUR_FORM_BTN_ITEM(i) == ITEM_MASK_FIERCE_DEITY) {
|
} else if (GET_CUR_FORM_BTN_ITEM(i) == ITEM_MASK_FIERCE_DEITY) {
|
||||||
// Fierce Deity's Mask is equipped
|
// Fierce Deity's Mask is equipped
|
||||||
if ((play->sceneId != SCENE_MITURIN_BS) && (play->sceneId != SCENE_HAKUGIN_BS) &&
|
// @recomp_use_export_var fd_anywhere: Allow the player to use the Fierce Deity's Mask anywhere if mods enable it.
|
||||||
|
if (!fd_anywhere && (play->sceneId != SCENE_MITURIN_BS) && (play->sceneId != SCENE_HAKUGIN_BS) &&
|
||||||
(play->sceneId != SCENE_SEA_BS) && (play->sceneId != SCENE_INISIE_BS) &&
|
(play->sceneId != SCENE_SEA_BS) && (play->sceneId != SCENE_INISIE_BS) &&
|
||||||
(play->sceneId != SCENE_LAST_BS)) {
|
(play->sceneId != SCENE_LAST_BS)) {
|
||||||
if (BUTTON_STATUS(i) != BTN_DISABLED) {
|
if (BUTTON_STATUS(i) != BTN_DISABLED) {
|
||||||
|
Loading…
Reference in New Issue
Block a user