diff --git a/soh/soh/Enhancements/Fishing.cpp b/soh/soh/Enhancements/Fishing.cpp index cddfaa21b9..ea29fa8822 100644 --- a/soh/soh/Enhancements/Fishing.cpp +++ b/soh/soh/Enhancements/Fishing.cpp @@ -3,6 +3,7 @@ extern "C" { #include +#include extern PlayState* gPlayState; extern SaveContext gSaveContext; f32 Fishing_GetMinimumRequiredScore(); @@ -19,6 +20,21 @@ void RegisterFishingMessages() { COND_ID_HOOK(OnOpenText, 0x4080, CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFishing"), 0), BuildFishingMessage); } +void RegisterHoverFishing() { + COND_VB_SHOULD(VB_NOT_CAST_FISHING, (CVarGetInteger(CVAR_ENHANCEMENT("HoverFishing"), false)), { + Vec3f* rodCheckPos = va_arg(args, Vec3f*); + *should = false; + // Run only original NTSC 1.0 check before cast + if (BgCheck_SphVsFirstPoly(&gPlayState->colCtx, rodCheckPos, 20.0f)) { + *should = true; + } + }); + + COND_VB_SHOULD(VB_FISHING_ZERO_XZ, (CVarGetInteger(CVAR_ENHANCEMENT("HoverFishing"), false)), { + *should = false; // NTSC 1.0 + }); +} + // 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. @@ -43,5 +59,6 @@ void RegisterAllowFishingBlankB() { } static RegisterShipInitFunc initFunc(RegisterFishingMessages, { CVAR_ENHANCEMENT("CustomizeFishing") }); +static RegisterShipInitFunc initHoverFishing(RegisterHoverFishing, { CVAR_ENHANCEMENT("HoverFishing") }); static RegisterShipInitFunc initAllowFishingBlankB(RegisterAllowFishingBlankB, { CVAR_ENHANCEMENT("FishingBlankB"), "IS_RANDO" }); diff --git a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h index abc3b3793e..8a7c833d90 100644 --- a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h +++ b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h @@ -2573,6 +2573,23 @@ typedef enum { // - `*VBFishingData` VB_SHOULD_SET_FISHING_RECORD, + // #### `result` + // ```c + // !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.world.pos.z > 1300.0f) || + // BgCheck_SphVsFirstPoly(&play->colCtx, &rodCheckPos, 20.0f) + // ``` + // #### `args` + // - `*f32` + VB_NOT_CAST_FISHING, + + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - None + VB_FISHING_ZERO_XZ, + // #### `result` // ```c // false diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index 521dc3249c..933e742037 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -6598,17 +6598,20 @@ s32 func_8083C6B8(PlayState* play, Player* this) { rodCheckPos.y += 50.0f; - if (CVarGetInteger(CVAR_ENHANCEMENT("HoverFishing"), 0) - ? 0 - : !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.world.pos.z > 1300.0f) || - BgCheck_SphVsFirstPoly(&play->colCtx, &rodCheckPos, 20.0f)) { + if (GameInteractor_Should(VB_NOT_CAST_FISHING, + (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + (this->actor.world.pos.z > 1300.0f) || + BgCheck_SphVsFirstPoly(&play->colCtx, &rodCheckPos, 20.0f)), + &rodCheckPos)) { Sfx_PlaySfxCentered(NA_SE_SY_ERROR); return 0; } Player_SetupAction(play, this, Player_Action_80850C68, 0); this->unk_860 = 1; - Player_ZeroSpeedXZ(this); + if (GameInteractor_Should(VB_FISHING_ZERO_XZ, true)) { + Player_ZeroSpeedXZ(this); + } Player_AnimPlayOnce(play, this, &gPlayerAnim_link_fishing_throw); return 1; } else {