From db9201fb477f929631cbce46527910b6286b665c Mon Sep 17 00:00:00 2001 From: lilDavid <1337lilDavid@gmail.com> Date: Wed, 20 Jul 2022 09:30:01 -0500 Subject: [PATCH 1/2] Add optional fixes for power crouch stab --- libultraship/libultraship/ImGuiImpl.cpp | 8 +++++ .../actors/ovl_player_actor/z_player.c | 32 +++++++++++++++---- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index b9ce62aee9a..a3c0df5ab28 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -1192,6 +1192,14 @@ namespace SohImGui { Tooltip("Correctly centers the Navi text prompt on the HUD's C-Up button"); EnhancementCheckbox("Fix Anubis fireballs", "gAnubisFix"); Tooltip("Make Anubis fireballs do fire damage when reflected\nback at them with the Mirror Shield"); + EnhancementCheckbox("Fix Megaton Hammer crouch stab", "gCrouchStabHammerFix"); + Tooltip("Make the Megaton Hammer's crouch stab able to destroy rocks without first swinging it normally"); + if (CVar_GetS32("gCrouchStabHammerFix", 0) == 0) { + CVar_SetS32("gCrouchStabFix", 0); + } else { + EnhancementCheckbox("Remove power crouch stab", "gCrouchStabFix"); + Tooltip("Make crouch stabbing always do the same damage as a regular slash"); + } 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 1f1d09a8db5..c9b212acee7 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -7846,15 +7846,35 @@ s32 func_8084285C(Player* this, f32 arg1, f32 arg2, f32 arg3) { } s32 func_808428D8(Player* this, GlobalContext* globalCtx) { - if (!Player_IsChildWithHylianShield(this) && Player_GetSwordHeld(this) && D_80853614) { - func_80832264(globalCtx, this, &gPlayerAnim_002EC8); - this->unk_84F = 1; - this->swordAnimation = 0xC; - this->currentYaw = this->actor.shape.rot.y + this->unk_6BE; + if (Player_IsChildWithHylianShield(this) || !Player_GetSwordHeld(this) || !D_80853614) { + return 0; + } + + func_80832264(globalCtx, this, &gPlayerAnim_002EC8); + this->unk_84F = 1; + this->swordAnimation = 0xC; + this->currentYaw = this->actor.shape.rot.y + this->unk_6BE; + + if (!CVar_GetS32("gCrouchStabHammerFix", 0)) { return 1; } - return 0; + u32 swordId; + if (Player_HoldsBrokenKnife(this)) { + swordId = 1; + } else { + swordId = Player_GetSwordHeld(this) - 1; + } + + if (swordId != 4 && !CVar_GetS32("gCrouchStabFix", 0)) { // 4 = Megaton Hammer + return 1; + } + + u32 flags = D_80854488[swordId][0]; + func_80837918(this, 0, flags); + func_80837918(this, 1, flags); + + return 1; } s32 func_80842964(Player* this, GlobalContext* globalCtx) { From 40a19d7670b96e954f41a9a1157f5e6182d8dfba Mon Sep 17 00:00:00 2001 From: lilDavid <1337lilDavid@gmail.com> Date: Thu, 21 Jul 2022 17:35:47 -0500 Subject: [PATCH 2/2] Add line break in "Fix Megaton Hammer" tooltip Co-authored-by: PurpleHato --- libultraship/libultraship/ImGuiImpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index a3c0df5ab28..24829791a8d 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -1193,7 +1193,7 @@ namespace SohImGui { EnhancementCheckbox("Fix Anubis fireballs", "gAnubisFix"); Tooltip("Make Anubis fireballs do fire damage when reflected\nback at them with the Mirror Shield"); EnhancementCheckbox("Fix Megaton Hammer crouch stab", "gCrouchStabHammerFix"); - Tooltip("Make the Megaton Hammer's crouch stab able to destroy rocks without first swinging it normally"); + Tooltip("Make the Megaton Hammer's crouch stab able to destroy\nrocks without first swinging it normally"); if (CVar_GetS32("gCrouchStabHammerFix", 0) == 0) { CVar_SetS32("gCrouchStabFix", 0); } else {