diff --git a/mm/2s2h/BenGui/BenMenuBar.cpp b/mm/2s2h/BenGui/BenMenuBar.cpp index 54a1fe6aa..f987b312b 100644 --- a/mm/2s2h/BenGui/BenMenuBar.cpp +++ b/mm/2s2h/BenGui/BenMenuBar.cpp @@ -743,6 +743,15 @@ void DrawEnhancementsMenu() { ImGui::EndMenu(); } + if (UIWidgets::BeginMenu("Difficulty Options")) { + if (UIWidgets::CVarCheckbox("Disable Takkuri Steal", "gEnhancements.Cheats.DisableTakkuriSteal", + { .tooltip = "Prevents the Takkuri from stealing key items like bottles and " + "swords. It may still steal other items." })) { + RegisterDisableTakkuriSteal(); + } + ImGui::EndMenu(); + } + if (mHudEditorWindow) { UIWidgets::WindowButton("Hud Editor", "gWindows.HudEditor", mHudEditorWindow, { .tooltip = "Enables the Hud Editor window, allowing you to edit your hud" }); diff --git a/mm/2s2h/BenGui/SearchableMenuItems.h b/mm/2s2h/BenGui/SearchableMenuItems.h index 2bd672834..a6caf6df4 100644 --- a/mm/2s2h/BenGui/SearchableMenuItems.h +++ b/mm/2s2h/BenGui/SearchableMenuItems.h @@ -1306,6 +1306,15 @@ void AddEnhancements() { WIDGET_CVAR_CHECKBOX, {}, [](widgetInfo& info) { RegisterWoodfallMountainAppearance(); } } } } }); + enhancementsSidebar.push_back( + { "Difficulty Options", + 3, + { { { "Disable Takkuri Steal", + "gEnhancements.Cheats.DisableTakkuriSteal", + "Prevents the Takkuri from stealing key items like bottles and swords. It may still steal other items.", + WIDGET_CVAR_CHECKBOX, + {}, + [](widgetInfo& info) { RegisterDisableTakkuriSteal(); } } } } }); enhancementsSidebar.push_back({ "HUD Editor", 1, { // HUD Editor diff --git a/mm/2s2h/Enhancements/DifficultyOptions/DifficultyOptions.h b/mm/2s2h/Enhancements/DifficultyOptions/DifficultyOptions.h new file mode 100644 index 000000000..5680ec0af --- /dev/null +++ b/mm/2s2h/Enhancements/DifficultyOptions/DifficultyOptions.h @@ -0,0 +1,6 @@ +#ifndef DIFFICULTY_OPTIONS_H +#define DIFFICULTY_OPTIONS_H + +void RegisterDisableTakkuriSteal(); + +#endif // DIFFICULTY_OPTIONS_H \ No newline at end of file diff --git a/mm/2s2h/Enhancements/DifficultyOptions/DisableTakkuriSteal.cpp b/mm/2s2h/Enhancements/DifficultyOptions/DisableTakkuriSteal.cpp new file mode 100644 index 000000000..214c38202 --- /dev/null +++ b/mm/2s2h/Enhancements/DifficultyOptions/DisableTakkuriSteal.cpp @@ -0,0 +1,14 @@ +#include +#include "2s2h/GameInteractor/GameInteractor.h" + +void RegisterDisableTakkuriSteal() { + static HOOK_ID thiefBirdStealHookID = 0; + GameInteractor::Instance->UnregisterGameHookForID(thiefBirdStealHookID); + thiefBirdStealHookID = 0; + + if (!CVarGetInteger("gEnhancements.Cheats.DisableTakkuriSteal", 0)) { + return; + } + + thiefBirdStealHookID = REGISTER_VB_SHOULD(VB_THIEF_BIRD_STEAL, { *should = false; }); +} \ No newline at end of file diff --git a/mm/2s2h/Enhancements/Enhancements.cpp b/mm/2s2h/Enhancements/Enhancements.cpp index 3afba3157..4b90ac954 100644 --- a/mm/2s2h/Enhancements/Enhancements.cpp +++ b/mm/2s2h/Enhancements/Enhancements.cpp @@ -72,4 +72,7 @@ void InitEnhancements() { // Modes RegisterPlayAsKafei(); RegisterTimeMovesWhenYouMove(); + + // Difficulty Options + RegisterDisableTakkuriSteal(); } diff --git a/mm/2s2h/Enhancements/Enhancements.h b/mm/2s2h/Enhancements/Enhancements.h index 8ec82aa36..5abf01fc6 100644 --- a/mm/2s2h/Enhancements/Enhancements.h +++ b/mm/2s2h/Enhancements/Enhancements.h @@ -16,6 +16,7 @@ #include "Restorations/Restorations.h" #include "Saving/SavingEnhancements.h" #include "Songs/Songs.h" +#include "DifficultyOptions/DifficultyOptions.h" enum AlwaysWinDoggyRaceOptions { ALWAYS_WIN_DOGGY_RACE_OFF, diff --git a/mm/2s2h/GameInteractor/GameInteractor.h b/mm/2s2h/GameInteractor/GameInteractor.h index 20cada536..3af119040 100644 --- a/mm/2s2h/GameInteractor/GameInteractor.h +++ b/mm/2s2h/GameInteractor/GameInteractor.h @@ -63,6 +63,7 @@ typedef enum { VB_CLOCK_TOWER_OPENING_CONSIDER_THIS_FIRST_CYCLE, VB_DRAW_SLIME_BODY_ITEM, VB_ZTARGET_SPEED_CHECK, + VB_THIEF_BIRD_STEAL, } GIVanillaBehavior; typedef enum { diff --git a/mm/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c b/mm/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c index 19ac9ad60..144f35f11 100644 --- a/mm/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/mm/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -10,6 +10,8 @@ #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" #include "2s2h/Enhancements/FrameInterpolation/FrameInterpolation.h" +#include "2s2h/GameInteractor/GameInteractor.h" + #define FLAGS \ (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_200 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_80000000) @@ -585,7 +587,7 @@ void func_80C1193C(EnThiefbird* this, PlayState* play) { if (!(this->collider.base.atFlags & AT_BOUNCED)) { if ((D_80C1392C != 0) && CUR_UPG_VALUE(UPG_QUIVER) && ((STOLEN_ITEM_1 == STOLEN_ITEM_NONE) || (STOLEN_ITEM_2 == STOLEN_ITEM_NONE)) && - (Rand_ZeroOne() < 0.5f) && func_80C10B0C(this, play)) { + GameInteractor_Should(VB_THIEF_BIRD_STEAL, Rand_ZeroOne() < 0.5f) && func_80C10B0C(this, play)) { func_80C1242C(this); } else if (func_80C10E98(play)) { func_80C11338(this, play);