Skip to content

Commit

Permalink
Restore ability to spam B to swim faster from OoT (#955)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettjoecox authored Jan 25, 2025
1 parent 9d5e05b commit 97ce989
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
3 changes: 3 additions & 0 deletions mm/2s2h/BenGui/BenMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,9 @@ void BenMenu::AddEnhancements() {
AddWidget(path, "Side Rolls", WIDGET_CVAR_CHECKBOX)
.CVar("gEnhancements.Restorations.SideRoll")
.Options(CheckboxOptions().Tooltip("Restores side rolling from OoT."));
AddWidget(path, "Faster Swim", WIDGET_CVAR_CHECKBOX)
.CVar("gEnhancements.Restorations.OoTFasterSwim")
.Options(CheckboxOptions().Tooltip("Restores the ability to swim faster by spamming the B button, as in OoT."));
AddWidget(path, "Tatl ISG", WIDGET_CVAR_CHECKBOX)
.CVar("gEnhancements.Restorations.TatlISG")
.Options(CheckboxOptions().Tooltip("Restores Navi ISG from OoT, but now with Tatl."));
Expand Down
27 changes: 27 additions & 0 deletions mm/2s2h/Enhancements/Restorations/OoTFasterSwim.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <libultraship/bridge.h>
#include "2s2h/GameInteractor/GameInteractor.h"
#include "2s2h/ShipInit.hpp"

extern "C" {
#include "variables.h"
void Player_Action_57(Player* player, PlayState* play);
}

#define CVAR_NAME "gEnhancements.Restorations.OoTFasterSwim"
#define CVAR CVarGetInteger(CVAR_NAME, 0)

void RegisterOoTFasterSwim() {
COND_VB_SHOULD(VB_CLAMP_ANIMATION_SPEED, CVAR, {
Player* player = GET_PLAYER(gPlayState);
f32* animationSpeed = va_arg(args, f32*);

if (player->actionFunc == Player_Action_57 && player->transformation == PLAYER_FORM_HUMAN) {
*should = false;
if (*animationSpeed < 1.0f) {
*animationSpeed = 1.0f;
}
}
});
}

static RegisterShipInitFunc initFunc(RegisterOoTFasterSwim, { CVAR_NAME });
1 change: 1 addition & 0 deletions mm/2s2h/GameInteractor/GameInteractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ typedef enum {
VB_GORON_ROLL_INCREASE_SPIKE_LEVEL,
VB_GORON_ROLL_DISABLE_SPIKE_MODE,
VB_DEKU_LINK_SPIN_ON_LAST_HOP,
VB_CLAMP_ANIMATION_SPEED,
} GIVanillaBehavior;

typedef enum {
Expand Down
4 changes: 3 additions & 1 deletion mm/src/overlays/actors/ovl_player_actor/z_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -13240,7 +13240,9 @@ void func_808477D0(PlayState* play, Player* this, Input* input, f32 arg3) {
}

var_fv0 = var_fv0 * arg3;
var_fv0 = CLAMP(var_fv0, 1.0f, 2.5f);
if (GameInteractor_Should(VB_CLAMP_ANIMATION_SPEED, true, &var_fv0)) {
var_fv0 = CLAMP(var_fv0, 1.0f, 2.5f);
}
this->skelAnime.playSpeed = var_fv0;

PlayerAnimation_Update(play, &this->skelAnime);
Expand Down

0 comments on commit 97ce989

Please sign in to comment.