diff --git a/mm/2s2h/BenGui/BenMenu.cpp b/mm/2s2h/BenGui/BenMenu.cpp index 4dd8c419c..283a10e0b 100644 --- a/mm/2s2h/BenGui/BenMenu.cpp +++ b/mm/2s2h/BenGui/BenMenu.cpp @@ -694,6 +694,9 @@ void BenMenu::AddEnhancements() { .Min(1) .Max(5) .DefaultValue(1)); + AddWidget(path, "Prevent Diving Over Water", WIDGET_CVAR_CHECKBOX) + .CVar("gEnhancements.Player.PreventDiveOverWater") + .Options(CheckboxOptions().Tooltip("Prevents Link from automatically diving over bodies of water.")); AddWidget(path, "Dpad Equips", WIDGET_CVAR_CHECKBOX) .CVar("gEnhancements.Dpad.DpadEquips") .Options(CheckboxOptions().Tooltip("Allows you to equip items to your d-pad")); diff --git a/mm/2s2h/Enhancements/Player/PreventDiveOverWater.cpp b/mm/2s2h/Enhancements/Player/PreventDiveOverWater.cpp new file mode 100644 index 000000000..4ba399c70 --- /dev/null +++ b/mm/2s2h/Enhancements/Player/PreventDiveOverWater.cpp @@ -0,0 +1,12 @@ +#include +#include "2s2h/GameInteractor/GameInteractor.h" +#include "2s2h/ShipInit.hpp" + +#define CVAR_NAME "gEnhancements.Player.PreventDiveOverWater" +#define CVAR CVarGetInteger(CVAR_NAME, 0) + +void RegisterPreventDiveOverWater() { + COND_VB_SHOULD(VB_LINK_DIVE_OVER_WATER, CVAR, { *should = false; }); +} + +static RegisterShipInitFunc initFunc(RegisterPreventDiveOverWater, { CVAR_NAME }); diff --git a/mm/2s2h/GameInteractor/GameInteractor.h b/mm/2s2h/GameInteractor/GameInteractor.h index 434e9f28b..8d3fbcbde 100644 --- a/mm/2s2h/GameInteractor/GameInteractor.h +++ b/mm/2s2h/GameInteractor/GameInteractor.h @@ -94,6 +94,7 @@ typedef enum { VB_GORON_ROLL_DISABLE_SPIKE_MODE, VB_DEKU_LINK_SPIN_ON_LAST_HOP, VB_CLAMP_ANIMATION_SPEED, + VB_LINK_DIVE_OVER_WATER, } GIVanillaBehavior; typedef enum { diff --git a/mm/src/overlays/actors/ovl_player_actor/z_player.c b/mm/src/overlays/actors/ovl_player_actor/z_player.c index 5a4be6e68..5469d0061 100644 --- a/mm/src/overlays/actors/ovl_player_actor/z_player.c +++ b/mm/src/overlays/actors/ovl_player_actor/z_player.c @@ -7343,8 +7343,10 @@ void func_8083827C(Player* this, PlayState* play) { sp48 = func_80835CD8(play, this, &D_8085D154, &sp4C, &sp60, &sp5C); sp44 = this->actor.world.pos.y; - if (WaterBox_GetSurface1(play, &play->colCtx, sp4C.x, sp4C.z, &sp44, &sp58) && - ((sp44 - sp48) > 50.0f)) { + if (GameInteractor_Should( + VB_LINK_DIVE_OVER_WATER, + WaterBox_GetSurface1(play, &play->colCtx, sp4C.x, sp4C.z, &sp44, &sp58) && + ((sp44 - sp48) > 50.0f))) { func_80834DB8(this, &gPlayerAnim_link_normal_run_jump_water_fall, 6.0f, play); Player_SetAction(play, this, Player_Action_27, 0); return;