mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-08-12 12:18:32 -04:00
Vanilla bugfix, allow fishing with blank B (#6826)
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
|
||||
extern "C" {
|
||||
#include <variables.h>
|
||||
|
||||
extern PlayState* gPlayState;
|
||||
extern SaveContext gSaveContext;
|
||||
f32 Fishing_GetMinimumRequiredScore();
|
||||
}
|
||||
|
||||
@@ -18,4 +19,29 @@ void RegisterFishingMessages() {
|
||||
COND_ID_HOOK(OnOpenText, 0x4080, CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFishing"), 0), BuildFishingMessage);
|
||||
}
|
||||
|
||||
// Vanilla bug: Not possible to fish with blank B because blank B item value 0xFF is saved
|
||||
// as temp B = disabled B -> fishing pole is unequipped.
|
||||
// Fix: If fishing, disregard disabled B and on B press set used item to fishing pole.
|
||||
void RegisterAllowFishingBlankB() {
|
||||
COND_VB_SHOULD(VB_PUTAWAY_BECAUSE_DISABLED_ITEM_BUTTONS,
|
||||
(IS_RANDO || CVarGetInteger(CVAR_ENHANCEMENT("FishingBlankB"), IS_RANDO)), {
|
||||
if (gPlayState->interfaceCtx.unk_260 != 0 &&
|
||||
gSaveContext.equips.buttonItems[0] == ITEM_FISHING_POLE) {
|
||||
*should = false;
|
||||
}
|
||||
});
|
||||
|
||||
COND_VB_SHOULD(
|
||||
VB_OVERRIDE_BUTTON_ITEM_USED, (IS_RANDO || CVarGetInteger(CVAR_ENHANCEMENT("FishingBlankB"), IS_RANDO)), {
|
||||
s32* i = va_arg(args, s32*);
|
||||
Player* player = va_arg(args, Player*);
|
||||
s32* item = va_arg(args, s32*);
|
||||
if (gPlayState->interfaceCtx.unk_260 != 0 && *i == 0 && player->itemAction == PLAYER_IA_FISHING_POLE) {
|
||||
*item = ITEM_FISHING_POLE;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static RegisterShipInitFunc initFunc(RegisterFishingMessages, { CVAR_ENHANCEMENT("CustomizeFishing") });
|
||||
static RegisterShipInitFunc initAllowFishingBlankB(RegisterAllowFishingBlankB,
|
||||
{ CVAR_ENHANCEMENT("FishingBlankB"), "IS_RANDO" });
|
||||
|
||||
@@ -3394,6 +3394,25 @@ typedef enum {
|
||||
VB_PREVENT_HOOKSHOT_PARENT_SOFTLOCK,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// true
|
||||
// ```
|
||||
// #### `args`
|
||||
// - none
|
||||
VB_PUTAWAY_BECAUSE_DISABLED_ITEM_BUTTONS,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// true
|
||||
// ```
|
||||
// #### `args`
|
||||
// - `s32* i` (button index)
|
||||
// - `Player*`
|
||||
// - `s32* item`
|
||||
VB_OVERRIDE_BUTTON_ITEM_USED,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// true if Goron Link is talking
|
||||
// ```
|
||||
// #### `args`
|
||||
|
||||
@@ -1676,6 +1676,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. Always enabled in randomizer."));
|
||||
|
||||
// Extra Modes
|
||||
path.sidebarName = "Extra Modes";
|
||||
|
||||
@@ -2524,8 +2524,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_PUTAWAY_BECAUSE_DISABLED_ITEM_BUTTONS, true)) {
|
||||
Player_UseItem(play, this, ITEM_NONE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2536,6 +2538,7 @@ void Player_ProcessItemButtons(Player* this, PlayState* play) {
|
||||
}
|
||||
|
||||
item = Player_GetItemOnButton(play, i);
|
||||
GameInteractor_Should(VB_OVERRIDE_BUTTON_ITEM_USED, true, &i, this, &item);
|
||||
|
||||
if (item >= ITEM_NONE_FE) {
|
||||
for (i = 0; i < ARRAY_COUNT(sItemButtons); i++) {
|
||||
|
||||
Reference in New Issue
Block a user