Skip to content

Commit

Permalink
Tweak infinite deku hops to stop velocity loss while in the air
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettjoecox committed Jan 17, 2025
1 parent 5200487 commit 33c9d8b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
4 changes: 3 additions & 1 deletion mm/2s2h/BenGui/SearchableMenuItems.h
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,9 @@ void AddEnhancements() {
"Speeds up the time it takes to be able to get maximum height from launching out of a deku flower",
WIDGET_CVAR_CHECKBOX },
{ "Infinite Deku Hopping", "gEnhancements.Player.InfiniteDekuHopping",
"Allows Deku Link to hop indefinitely in water without drowning.", WIDGET_CVAR_CHECKBOX },
"Allows Deku Link to hop indefinitely in water without drowning. This also prevents the velocity loss "
"while in the air.",
WIDGET_CVAR_CHECKBOX },
{ "Instant Putaway", "gEnhancements.Player.InstantPutaway",
"Allows Link to instantly puts away held item without waiting.", WIDGET_CVAR_CHECKBOX },
{ "Fierce Deity Putaway", "gEnhancements.Player.FierceDeityPutaway",
Expand Down
7 changes: 7 additions & 0 deletions mm/2s2h/Enhancements/Player/InfiniteDekuHopping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ void RegisterInfiniteDekuHopping() {
player->remainingHopsCounter = 5;
}
});

COND_VB_SHOULD(VB_SET_DEKU_FORM_JUMP_SPEED_TARGET_MULTIPLIER, CVAR, {
f32* dekuSpeedTargetMultiplier = va_arg(args, f32*);

*dekuSpeedTargetMultiplier = 1.0f;
*should = false;
});
}

static RegisterShipInitFunc initFunc(RegisterInfiniteDekuHopping, { 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_SET_DEKU_FORM_JUMP_SPEED_TARGET_MULTIPLIER,
} GIVanillaBehavior;

typedef enum {
Expand Down
7 changes: 6 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 @@ -15014,9 +15014,14 @@ void Player_Action_25(Player* this, PlayState* play) {

if (this->transformation == PLAYER_FORM_DEKU) {
s16 prevYaw = this->currentYaw;
f32 dekuSpeedTargetMultiplier;
if (GameInteractor_Should(VB_SET_DEKU_FORM_JUMP_SPEED_TARGET_MULTIPLIER, true,
&dekuSpeedTargetMultiplier)) {
dekuSpeedTargetMultiplier = 0.5f;
}

func_808378FC(play, this);
func_8083CBC4(this, speedTarget * 0.5f, yawTarget, 2.0f, 0.2f, 0.1f, 0x190);
func_8083CBC4(this, speedTarget * dekuSpeedTargetMultiplier, yawTarget, 2.0f, 0.2f, 0.1f, 0x190);

if (BEN_ANIM_EQUAL(this->skelAnime.animation, gPlayerAnim_pn_attack)) {
this->stateFlags2 |= (PLAYER_STATE2_20 | PLAYER_STATE2_40);
Expand Down

0 comments on commit 33c9d8b

Please sign in to comment.