Skip to content

Commit

Permalink
Faster Swim animations, full credit to kimimaru4000
Browse files Browse the repository at this point in the history
Co-authored-by: kimimaru4000 <[email protected]>
  • Loading branch information
Pepper0ni and kimimaru4000 committed Oct 20, 2023
1 parent 35b4357 commit b294188
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions soh/soh/Enhancements/presets.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ const std::vector<const char*> enhancementsCvars = {
"gInjectItemCounts",
"gDayGravePull",
"gDampeAllNight",
"gSkipSwimDeepEndAnim",
"gSkipScarecrow",
"gBlueFireArrows",
"gSunlightArrows",
Expand Down
2 changes: 2 additions & 0 deletions soh/soh/SohMenuBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,8 @@ void DrawEnhancementsMenu() {
"- Obtained the Master Sword\n"
"- Not within range of Time Block\n"
"- Not within range of Ocarina playing spots");
UIWidgets::PaddedEnhancementCheckbox("Skip water take breath animation", "gSkipSwimDeepEndAnim", true, false);
UIWidgets::Tooltip("Skips Link's taking breath animation after coming up from water. This setting does not interfere with getting items from underwater.");
ImGui::EndMenu();
}

Expand Down
16 changes: 13 additions & 3 deletions soh/src/overlays/actors/ovl_player_actor/z_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -5827,9 +5827,19 @@ s32 func_8083D12C(PlayState* play, Player* this, Input* arg2) {
}

func_80832340(play, this);
func_80832B0C(play, this,
(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) ? &gPlayerAnim_link_swimer_swim_get
: &gPlayerAnim_link_swimer_swim_deep_end);
// Skip take breath animation on surface if Link didn't grab an item while underwater and the setting is enabled
if (CVarGetInteger("gSkipSwimDeepEndAnim", 0) && !(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD))
{
auto lastAnimFrame = Animation_GetLastFrame(&gPlayerAnim_link_swimer_swim_deep_end);
LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_swimer_swim_deep_end, 1.0f,
lastAnimFrame, lastAnimFrame, ANIMMODE_ONCE, -6.0f);
}
else
{
func_80832B0C(play, this,
(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) ? &gPlayerAnim_link_swimer_swim_get
: &gPlayerAnim_link_swimer_swim_deep_end);
}

if (func_8083CFA8(play, this, this->actor.velocity.y, 500)) {
Player_PlaySfx(&this->actor, NA_SE_PL_FACE_UP);
Expand Down

0 comments on commit b294188

Please sign in to comment.