From b294188782c162b26d77b13dc4a74aaed3f6f51f Mon Sep 17 00:00:00 2001 From: Pepper0ni Date: Fri, 20 Oct 2023 12:28:37 +0100 Subject: [PATCH] Faster Swim animations, full credit to kimimaru4000 Co-authored-by: kimimaru4000 --- soh/soh/Enhancements/presets.h | 1 + soh/soh/SohMenuBar.cpp | 2 ++ .../overlays/actors/ovl_player_actor/z_player.c | 16 +++++++++++++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/soh/soh/Enhancements/presets.h b/soh/soh/Enhancements/presets.h index 6afc36248..f73655160 100644 --- a/soh/soh/Enhancements/presets.h +++ b/soh/soh/Enhancements/presets.h @@ -136,6 +136,7 @@ const std::vector enhancementsCvars = { "gInjectItemCounts", "gDayGravePull", "gDampeAllNight", + "gSkipSwimDeepEndAnim", "gSkipScarecrow", "gBlueFireArrows", "gSunlightArrows", diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 04f25d2e8..328a31204 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -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(); } 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 5f799227b..d20e25d42 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -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);