From 44ded41793364538e2727f1a7bdfc8aa67ef6a72 Mon Sep 17 00:00:00 2001 From: inspectredc <78732756+inspectredc@users.noreply.github.com> Date: Fri, 3 May 2024 18:34:11 +0100 Subject: [PATCH] [Enhancement] Un-patch side rolls (#290) --- mm/2s2h/BenGui/BenMenuBar.cpp | 8 ++++++++ mm/2s2h/Enhancements/Enhancements.cpp | 3 +++ mm/2s2h/Enhancements/Enhancements.h | 1 + mm/2s2h/Enhancements/GameInteractor/GameInteractor.h | 3 ++- mm/2s2h/Enhancements/Restorations/SideRoll.cpp | 10 ++++++++++ mm/2s2h/Enhancements/Restorations/SideRoll.h | 6 ++++++ mm/src/overlays/actors/ovl_player_actor/z_player.c | 8 ++++++-- 7 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 mm/2s2h/Enhancements/Restorations/SideRoll.cpp create mode 100644 mm/2s2h/Enhancements/Restorations/SideRoll.h diff --git a/mm/2s2h/BenGui/BenMenuBar.cpp b/mm/2s2h/BenGui/BenMenuBar.cpp index 4b2d93bb8..c3bcd1e08 100644 --- a/mm/2s2h/BenGui/BenMenuBar.cpp +++ b/mm/2s2h/BenGui/BenMenuBar.cpp @@ -316,6 +316,14 @@ void DrawEnhancementsMenu() { ImGui::EndMenu(); } + if (UIWidgets::BeginMenu("Restorations")) { + UIWidgets::CVarCheckbox("Side Rolls", "gEnhancements.Restorations.SideRoll", { + .tooltip = "Restores side rolling from OOT." + }); + + ImGui::EndMenu(); + } + if (UIWidgets::BeginMenu("Graphics")) { MotionBlur_RenderMenuOptions(); ImGui::EndMenu(); diff --git a/mm/2s2h/Enhancements/Enhancements.cpp b/mm/2s2h/Enhancements/Enhancements.cpp index 823e06f8f..443c0a3d3 100644 --- a/mm/2s2h/Enhancements/Enhancements.cpp +++ b/mm/2s2h/Enhancements/Enhancements.cpp @@ -10,6 +10,9 @@ void InitEnhancements() { // Masks RegisterFierceDeityAnywhere(); + + // Restorations + RegisterSideRoll(); // Time Savers RegisterTimeSaversHooks(); diff --git a/mm/2s2h/Enhancements/Enhancements.h b/mm/2s2h/Enhancements/Enhancements.h index b06190987..6e4504006 100644 --- a/mm/2s2h/Enhancements/Enhancements.h +++ b/mm/2s2h/Enhancements/Enhancements.h @@ -5,6 +5,7 @@ #include "Cheats/Infinite.h" #include "Cycle/EndOfCycle.h" #include "Masks/FierceDeityAnywhere.h" +#include "Restorations/SideRoll.h" #include "TimeSavers/TimeSavers.h" #ifdef __cplusplus diff --git a/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h b/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h index b34caae96..7b19376f2 100644 --- a/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h +++ b/mm/2s2h/Enhancements/GameInteractor/GameInteractor.h @@ -31,7 +31,8 @@ typedef enum { // Vanilla condition: gSaveContext.showTitleCard GI_VB_SHOW_TITLE_CARD, GI_VB_PLAY_ENTRANCE_CS, - GI_VB_DISABLE_FD_MASK + GI_VB_DISABLE_FD_MASK, + GI_VB_PATCH_SIDEROLL, } GIVanillaBehavior; #ifdef __cplusplus diff --git a/mm/2s2h/Enhancements/Restorations/SideRoll.cpp b/mm/2s2h/Enhancements/Restorations/SideRoll.cpp new file mode 100644 index 000000000..81362b0aa --- /dev/null +++ b/mm/2s2h/Enhancements/Restorations/SideRoll.cpp @@ -0,0 +1,10 @@ +#include +#include "Enhancements/GameInteractor/GameInteractor.h" + +void RegisterSideRoll() { + REGISTER_VB_SHOULD(GI_VB_PATCH_SIDEROLL, { + if (CVarGetInteger("gEnhancements.Restorations.SideRoll", 0)) { + *should = false; + } + }); +} diff --git a/mm/2s2h/Enhancements/Restorations/SideRoll.h b/mm/2s2h/Enhancements/Restorations/SideRoll.h new file mode 100644 index 000000000..f0fe430e0 --- /dev/null +++ b/mm/2s2h/Enhancements/Restorations/SideRoll.h @@ -0,0 +1,6 @@ +#ifndef RESTORATIONS_SIDEROLL_H +#define RESTORATIONS_SIDEROLL_H + +void RegisterSideRoll(); + +#endif // RESTORATIONS_SIDEROLL_H diff --git a/mm/src/overlays/actors/ovl_player_actor/z_player.c b/mm/src/overlays/actors/ovl_player_actor/z_player.c index 4e92961d7..d268bad7c 100644 --- a/mm/src/overlays/actors/ovl_player_actor/z_player.c +++ b/mm/src/overlays/actors/ovl_player_actor/z_player.c @@ -45,6 +45,8 @@ #include "objects/object_link_nuts/object_link_nuts.h" #include "objects/object_link_child/object_link_child.h" +#include "2s2h/Enhancements/GameInteractor/GameInteractor.h" + #define THIS ((Player*)thisx) void Player_Init(Actor* thisx, PlayState* play); @@ -6615,8 +6617,10 @@ void func_80836AD8(PlayState* play, Player* this) { } void func_80836B3C(PlayState* play, Player* this, f32 arg2) { - this->currentYaw = this->actor.shape.rot.y; - this->actor.world.rot.y = this->actor.shape.rot.y; + if (GameInteractor_Should(GI_VB_PATCH_SIDEROLL, true, NULL)) { + this->currentYaw = this->actor.shape.rot.y; + this->actor.world.rot.y = this->actor.shape.rot.y; + } if (this->transformation == PLAYER_FORM_GORON) { func_80836AD8(play, this);