Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion soh/soh/Enhancements/Fishing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

extern "C" {
#include <variables.h>

extern PlayState* gPlayState;
extern SaveContext gSaveContext;
f32 Fishing_GetMinimumRequiredScore();
}

Expand All @@ -18,4 +19,25 @@ void RegisterFishingMessages() {
COND_ID_HOOK(OnOpenText, 0x4080, CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFishing"), 0), BuildFishingMessage);
}

// Vanilla bug: Not possible to fish with blank B because the blank B item value 0xFF gets saved
// as temp B, which also makes B button disabled - fishing pole gets unequipped.
// Fix: Disregard disabled B when fishing, and set used item to fishing pole on B press.
void RegisterAllowFishingBlankB() {
COND_VB_SHOULD(VB_ALLOW_BLANK_B_FISHING_EQUIP, (IS_RANDO || CVarGetInteger(CVAR_ENHANCEMENT("FishingBlankB"), 0)), {
if (gPlayState->interfaceCtx.unk_260 != 0 && gSaveContext.equips.buttonItems[0] == ITEM_FISHING_POLE) {
*should = false;
}
});

COND_VB_SHOULD(VB_ALLOW_BLANK_B_FISHING_ITEM, (IS_RANDO || CVarGetInteger(CVAR_ENHANCEMENT("FishingBlankB"), 0)), {
s32* i = va_arg(args, s32*);
Player* player = va_arg(args, Player*);
if (gPlayState->interfaceCtx.unk_260 != 0 && i == 0 && player->itemAction == PLAYER_IA_FISHING_POLE) {
*should = true;
}
});
}

static RegisterShipInitFunc initFunc(RegisterFishingMessages, { CVAR_ENHANCEMENT("CustomizeFishing") });
static RegisterShipInitFunc initAllowFishingBlankB(RegisterAllowFishingBlankB,
{ CVAR_ENHANCEMENT("FishingBlankB"), "IS_RANDO" });
Original file line number Diff line number Diff line change
Expand Up @@ -3111,6 +3111,23 @@ typedef enum {
// - `s16* (&this->actor.parent->id)`
VB_PREVENT_HOOKSHOT_PARENT_SOFTLOCK,

// #### `result`
// ```c
// false if gPlayState->interfaceCtx.unk_260 != 0 && gSaveContext.equips.buttonItems[0] == ITEM_FISHING_POLE
// ```
// #### `args`
// - none
VB_ALLOW_BLANK_B_FISHING_EQUIP,

// #### `result`
// ```c
// gPlayState->interfaceCtx.unk_260 != 0 && i == 0 && player->itemAction == PLAYER_IA_FISHING_POLE
// ```
// #### `args`
// - `s32* i`
// - `Player*`
VB_ALLOW_BLANK_B_FISHING_ITEM,

// true
// ```
// #### `args`
Expand Down
4 changes: 4 additions & 0 deletions soh/soh/SohGui/SohMenuEnhancements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1633,6 +1633,10 @@ void SohMenu::AddMenuEnhancements() {
.PreFunc(fishingDisabledFunc)
.Options(IntSliderOptions().Min(6).Max(13).DefaultValue(13).Format("%d lbs.").Tooltip(
"The minimum weight for the unique fishing reward as an adult."));
AddWidget(path, "Allow fishing with blank B", WIDGET_CVAR_CHECKBOX)
.CVar(CVAR_ENHANCEMENT("FishingBlankB"))
.Options(CheckboxOptions().Tooltip("Allow fishing even when not having any item equipped on the B button, "
"fixing a vanilla bug."));

// Extra Modes
path.sidebarName = "Extra Modes";
Expand Down
12 changes: 9 additions & 3 deletions soh/src/overlays/actors/ovl_player_actor/z_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -2523,8 +2523,10 @@ void Player_ProcessItemButtons(Player* this, PlayState* play) {
}
if (!Player_ItemIsInUse(this, B_BTN_ITEM) && !Player_ItemIsInUse(this, C_BTN_ITEM(0)) &&
!Player_ItemIsInUse(this, C_BTN_ITEM(1)) && !Player_ItemIsInUse(this, C_BTN_ITEM(2)) && !hasOnDpad) {
Player_UseItem(play, this, ITEM_NONE);
return;
if (GameInteractor_Should(VB_ALLOW_BLANK_B_FISHING_EQUIP, true)) {
Player_UseItem(play, this, ITEM_NONE);
return;
}
}
}

Expand All @@ -2534,7 +2536,11 @@ void Player_ProcessItemButtons(Player* this, PlayState* play) {
}
}

item = Player_GetItemOnButton(play, i);
if (GameInteractor_Should(VB_ALLOW_BLANK_B_FISHING_ITEM, false, i, this)) {
item = ITEM_FISHING_POLE;
} else {
item = Player_GetItemOnButton(play, i);
}
Comment thread
serprex marked this conversation as resolved.
Outdated

if (item >= ITEM_NONE_FE) {
for (i = 0; i < ARRAY_COUNT(sItemButtons); i++) {
Expand Down
Loading