More vanilla bug fix exports (#497)

This commit is contained in:
LittleCube 2024-10-20 19:35:41 -04:00 committed by GitHub
parent 0f92410620
commit e862a38135
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 31 additions and 12 deletions

View File

@ -541,11 +541,24 @@ RECOMP_EXPORT void recomp_set_no_bow_epona_fix(bool new_val) {
no_bow_epona_fix = new_val; no_bow_epona_fix = new_val;
} }
bool h_and_d_no_sword_fix = false;
// @recomp_export void recomp_set_h_and_d_no_sword_fix(bool new_val): Set whether to enable the fix for playing Honey and Darling without a sword.
RECOMP_EXPORT void recomp_set_h_and_d_no_sword_fix(bool new_val) {
h_and_d_no_sword_fix = new_val;
}
extern s16 sPictoState; extern s16 sPictoState;
extern s16 sPictoPhotoBeingTaken; extern s16 sPictoPhotoBeingTaken;
extern void* gWorkBuffer; extern void* gWorkBuffer;
u16 func_801A5100(void); u16 func_801A5100(void);
#define ON_EPONA (player->stateFlags1 & PLAYER_STATE1_800000)
#define EPONA_FIX_ACTIVE (no_bow_epona_fix && ON_EPONA)
#define AT_H_AND_D (play->sceneId == SCENE_BOWLING)
#define H_AND_D_FIX_ACTIVE (h_and_d_no_sword_fix && AT_H_AND_D)
// @recomp Patched to update status of extra buttons via set_extra_item_slot_status. // @recomp Patched to update status of extra buttons via set_extra_item_slot_status.
RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) { RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx; InterfaceContext* interfaceCtx = &play->interfaceCtx;
@ -555,11 +568,11 @@ RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) {
if (gSaveContext.save.cutsceneIndex < 0xFFF0) { if (gSaveContext.save.cutsceneIndex < 0xFFF0) {
gSaveContext.hudVisibilityForceButtonAlphasByStatus = false; 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))) { (!CHECK_EVENTINF(EVENTINF_41) && (play->unk_1887C >= 2))) {
// Riding Epona OR Honey & Darling minigame OR Horseback balloon minigame OR related to swamp boat // Riding Epona OR Honey & Darling minigame OR Horseback balloon minigame OR related to swamp boat
// (non-minigame?) // (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)) { (gSaveContext.bButtonStatus == BTN_DISABLED)) {
// Riding Epona with blast mask? // Riding Epona with blast mask?
restoreHudVisibility = true; restoreHudVisibility = true;
@ -611,7 +624,7 @@ RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) {
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. // @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) { 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; BUTTON_STATUS(EQUIP_SLOT_B) = BTN_ENABLED;
@ -624,7 +637,7 @@ RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) {
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. // @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); gSaveContext.buttonStatus[EQUIP_SLOT_B] = BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B);
BUTTON_STATUS(EQUIP_SLOT_B) = BTN_DISABLED; BUTTON_STATUS(EQUIP_SLOT_B) = BTN_DISABLED;
} else { } else {
@ -635,7 +648,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. // @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_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;
@ -669,12 +682,12 @@ 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);
Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); 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); Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP);
} }
} }
} else { } else {
if (player->stateFlags1 & PLAYER_STATE1_800000) { if (ON_EPONA) {
Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP);
} }
@ -686,13 +699,16 @@ RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) {
} else { } else {
BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOW; BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOW;
} }
if (h_and_d_no_sword_fix) {
BUTTON_STATUS(EQUIP_SLOT_B) = BTN_ENABLED;
}
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);
} else { } else {
// @recomp_use_export_var no_bow_epona_fix: Part of the no bow Epona fix. // @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) { 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; BUTTON_STATUS(EQUIP_SLOT_B) = BTN_ENABLED;
@ -704,9 +720,9 @@ RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) {
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 && !H_AND_D_FIX_ACTIVE) {
// @recomp_use_export_var no_bow_epona_fix: Part of the no bow Epona fix. // @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); gSaveContext.buttonStatus[EQUIP_SLOT_B] = BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B);
BUTTON_STATUS(EQUIP_SLOT_B) = BTN_DISABLED; BUTTON_STATUS(EQUIP_SLOT_B) = BTN_DISABLED;
} else { } else {
@ -729,7 +745,7 @@ RECOMP_PATCH void Interface_UpdateButtonsPart1(PlayState* play) {
} }
// @recomp_use_export_var no_bow_epona_fix: If the B button does not contain the bow, don't disable the UI. // @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) { if ((!no_bow_epona_fix || BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_BOW) && !H_AND_D_FIX_ACTIVE) {
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;
@ -753,8 +769,11 @@ 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);
Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); 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); Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP);
} else if (H_AND_D_FIX_ACTIVE) {
Interface_LoadItemIconImpl(play, EQUIP_SLOT_B);
Interface_SetHudVisibility(HUD_VISIBILITY_B);
} }
} }
} else if (sPictoState != PICTO_BOX_STATE_OFF) { } else if (sPictoState != PICTO_BOX_STATE_OFF) {