From 7a75fe84114b65ad58200f65c33dee3dfddf8b92 Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Wed, 25 Jan 2023 16:27:11 -0600 Subject: [PATCH] Add faster farores enhancement (#2394) * Add faster farores enhancement * Add preset entry --- soh/soh/Enhancements/presets.h | 3 +++ soh/soh/GameMenuBar.cpp | 2 ++ soh/src/code/z_actor.c | 2 +- .../actors/ovl_player_actor/z_player.c | 20 +++++++++++++------ 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/soh/soh/Enhancements/presets.h b/soh/soh/Enhancements/presets.h index 38e753acf..bcda84b95 100644 --- a/soh/soh/Enhancements/presets.h +++ b/soh/soh/Enhancements/presets.h @@ -177,6 +177,7 @@ const std::vector enhancementsCvars = { "gSilverRupeeJingleExtend", "gStaticExplosionRadius", "gNoInputForCredits", + "gFastFarores", }; const std::vector randomizerCvars = { @@ -620,6 +621,8 @@ const std::vector randomizerPresetEntries = { PRESET_ENTRY_S32("gMinFrameCount", 200), PRESET_ENTRY_S32("gNoInputForCredits", 1), + + PRESET_ENTRY_S32("gFastFarores", 1), }; const std::vector s6PresetEntries = { diff --git a/soh/soh/GameMenuBar.cpp b/soh/soh/GameMenuBar.cpp index 9862a0d2b..4ccf41e90 100644 --- a/soh/soh/GameMenuBar.cpp +++ b/soh/soh/GameMenuBar.cpp @@ -374,6 +374,8 @@ namespace GameMenuBar { UIWidgets::PaddedEnhancementCheckbox("Exit Market at Night", "gMarketSneak", true, false); UIWidgets::Tooltip("Allows exiting Hyrule Castle Market Town to Hyrule Field at night by speaking " "to the guard next to the gate."); + UIWidgets::PaddedEnhancementCheckbox("Faster Farore's Wind", "gFastFarores", true, false); + UIWidgets::Tooltip("Greatly increases cast time of Farore's Wind magic spell."); ImGui::EndMenu(); } diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index a86ad33f7..30ed71641 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -2311,7 +2311,7 @@ void Actor_DrawFaroresWindPointer(PlayState* play) { D_8015BC14 = 60; D_8015BC18 = 1.0f; } else if (D_8015BC14) { - D_8015BC14--; + D_8015BC14-= CVarGetInteger("gFastFarores", 0) ? 5 : 1; } else if (D_8015BC18 > 0.0f) { static Vec3f effectVel = { 0.0f, -0.05f, 0.0f }; static Vec3f effectAccel = { 0.0f, -0.025f, 0.0f }; 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 71501754b..0aa4a65bf 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -4969,7 +4969,14 @@ void func_8083AF44(PlayState* play, Player* this, s32 magicSpell) { this->unk_84F = magicSpell - 3; func_80087708(play, sMagicSpellCosts[magicSpell], 4); - LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, &gPlayerAnim_link_magic_tame, 0.83f); + u8 isFastFarores = CVarGetInteger("gFastFarores", 0) && this->itemAction == PLAYER_IA_FARORES_WIND; + + if (isFastFarores) { + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, &gPlayerAnim_link_magic_tame, 0.83f * 2); + return; + } else { + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, &gPlayerAnim_link_magic_tame, 0.83f); + } if (magicSpell == 5) { this->subCamId = OnePointCutscene_Init(play, 1100, -101, NULL, MAIN_CAM); @@ -13794,15 +13801,16 @@ static struct_80832924 D_80854A8C[][2] = { }; void func_808507F4(Player* this, PlayState* play) { + u8 isFastFarores = CVarGetInteger("gFastFarores", 0) && this->itemAction == PLAYER_IA_FARORES_WIND; if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->unk_84F < 0) { - if ((this->itemAction == PLAYER_IA_NAYRUS_LOVE) || (gSaveContext.magicState == 0)) { + if ((this->itemAction == PLAYER_IA_NAYRUS_LOVE) || isFastFarores || (gSaveContext.magicState == 0)) { func_80839FFC(this, play); func_8005B1A4(Play_GetCamera(play, 0)); } } else { if (this->unk_850 == 0) { - LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, D_80854A58[this->unk_84F], 0.83f); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, D_80854A58[this->unk_84F], 0.83f * (isFastFarores ? 2 : 1)); if (func_80846A00(play, this, this->unk_84F) != NULL) { this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29; @@ -13813,7 +13821,7 @@ void func_808507F4(Player* this, PlayState* play) { func_800876C8(play); } } else { - LinkAnimation_PlayLoopSetSpeed(play, &this->skelAnime, D_80854A64[this->unk_84F], 0.83f); + LinkAnimation_PlayLoopSetSpeed(play, &this->skelAnime, D_80854A64[this->unk_84F], 0.83f * (isFastFarores ? 2 : 1)); if (this->unk_84F == 0) { this->unk_850 = -10; @@ -13849,8 +13857,8 @@ void func_808507F4(Player* this, PlayState* play) { if ((this->unk_84F == 2) && LinkAnimation_OnFrame(&this->skelAnime, 30.0f)) { this->stateFlags1 &= ~(PLAYER_STATE1_28 | PLAYER_STATE1_29); } - } else if (D_80854A7C[this->unk_84F] < this->unk_850++) { - LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, D_80854A70[this->unk_84F], 0.83f); + } else if ((isFastFarores ? 10 : D_80854A7C[this->unk_84F]) < this->unk_850++) { + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, D_80854A70[this->unk_84F], 0.83f * (isFastFarores ? 2 : 1)); this->currentYaw = this->actor.shape.rot.y; this->unk_84F = -1; }