diff options
| author | Eblo <7004497+Eblo@users.noreply.github.com> | 2025-06-05 09:17:42 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-05 07:17:42 -0600 |
| commit | 3221402a77079c2e316563bc032c23fd5c63876b (patch) | |
| tree | 2df155608b4697e861e9b4e82dfa028c069a90b8 | |
| parent | 298fea47fa20f7603757b785392311f4d9ec8d0b (diff) | |
Add enhancement for hidden grottos visibility (#1158)
| -rw-r--r-- | mm/2s2h/BenGui/BenMenu.cpp | 12 | ||||
| -rw-r--r-- | mm/2s2h/BenGui/BenMenu.h | 7 | ||||
| -rw-r--r-- | mm/2s2h/Enhancements/DifficultyOptions/HiddenGrottosVisibility.cpp | 51 | ||||
| -rw-r--r-- | mm/2s2h/Enhancements/Enhancements.h | 7 |
4 files changed, 77 insertions, 0 deletions
diff --git a/mm/2s2h/BenGui/BenMenu.cpp b/mm/2s2h/BenGui/BenMenu.cpp index 3271b8343..d433efcec 100644 --- a/mm/2s2h/BenGui/BenMenu.cpp +++ b/mm/2s2h/BenGui/BenMenu.cpp @@ -1385,6 +1385,18 @@ void BenMenu::AddEnhancements() { "- No trade: Gibdos will vanish without taking items.") .DefaultIndex(GibdoTradeSequenceOptions::GIBDO_TRADE_SEQUENCE_VANILLA) .ComboMap(gibdoTradeSequenceOptions)); + AddWidget(path, "Hidden Grottos Visibility", WIDGET_CVAR_COMBOBOX) + .CVar("gEnhancements.DifficultyOptions.HiddenGrottosVisibility") + .Options( + ComboboxOptions() + .Tooltip( + "Enable visual markers for hidden grottos:\n" + "- Off: No visual markers for hidden grottos. Vanilla behavior.\n" + "- Wear Mask of Truth: Hidden grottos are visible when wearing the Mask of Truth. MM3D behavior.\n" + "- Have Mask of Truth: Hidden grottos are visible once the Mask of Truth is obtained.\n" + "- Always: Hidden grottos always have a visual marker.\n") + .DefaultIndex(HiddenGrottosVisibilityOptions::HIDDEN_GROTTOS_VISIBLITY_OFF) + .ComboMap(maskOfTruthGrottoOptions)); path.column = SECTION_COLUMN_2; AddWidget(path, "Hyper Enemies", WIDGET_CVAR_CHECKBOX) diff --git a/mm/2s2h/BenGui/BenMenu.h b/mm/2s2h/BenGui/BenMenu.h index 2ad05c65c..3198ee109 100644 --- a/mm/2s2h/BenGui/BenMenu.h +++ b/mm/2s2h/BenGui/BenMenu.h @@ -103,6 +103,13 @@ static const std::unordered_map<int32_t, const char*> powerCrouchStabOptions = { { 2, "Unpatched (OoT)" }, }; +static const std::unordered_map<int32_t, const char*> maskOfTruthGrottoOptions = { + { HIDDEN_GROTTOS_VISIBLITY_OFF, "Off" }, + { HIDDEN_GROTTOS_VISIBLITY_WEAR_MASK_OF_TRUTH, "Wear Mask of Truth" }, + { HIDDEN_GROTTOS_VISIBLITY_HAVE_MASK_OF_TRUTH, "Have Mask of Truth" }, + { HIDDEN_GROTTOS_VISIBLITY_ALWAYS, "Always" }, +}; + static const std::unordered_map<int32_t, const char*> damageMultiplierOptions = { { 0, "1x" }, { 1, "2x" }, { 2, "4x" }, { 3, "8x" }, { 4, "16x" }, { 10, "1 Hit KO" }, }; diff --git a/mm/2s2h/Enhancements/DifficultyOptions/HiddenGrottosVisibility.cpp b/mm/2s2h/Enhancements/DifficultyOptions/HiddenGrottosVisibility.cpp new file mode 100644 index 000000000..21f47fb8e --- /dev/null +++ b/mm/2s2h/Enhancements/DifficultyOptions/HiddenGrottosVisibility.cpp @@ -0,0 +1,51 @@ +#include "public/bridge/consolevariablebridge.h" +#include "2s2h/GameInteractor/GameInteractor.h" +#include "2s2h/ShipInit.hpp" +#include "2s2h/Enhancements/Enhancements.h" + +extern "C" { +#include "overlays/actors/ovl_Door_Ana/z_door_ana.h" +} + +#define CVAR_NAME "gEnhancements.DifficultyOptions.HiddenGrottosVisibility" +#define CVAR CVarGetInteger(CVAR_NAME, 0) + +void drawHiddenGrottoMarker(Actor* actor) { + s32 grottoType = DOORANA_GET_TYPE(actor); + if (grottoType == DOORANA_TYPE_HIDDEN_STORMS || grottoType == DOORANA_TYPE_HIDDEN_BOMB) { + if (gGameState->frames % 4) { + return; + } + + static Vec3f sVelocity = { 0.0f, 3.0f, 0.0f }; + static Vec3f sAccel = { 0.0f, 0.0f, 0.0f }; + static Color_RGBA8 sPrimColor = { 255, 255, 255, 255 }; + static Color_RGBA8 sEnvColor = { 0, 255, 64, 255 }; + Vec3f newPos; + + newPos.x = Rand_CenteredFloat(10.0f) + actor->world.pos.x; + newPos.y = (Rand_ZeroOne() * 10.0f) + actor->world.pos.y; + newPos.z = Rand_CenteredFloat(10.0f) + actor->world.pos.z; + + EffectSsKirakira_SpawnDispersed(gPlayState, &newPos, &sVelocity, &sAccel, &sPrimColor, &sEnvColor, 5000, 16); + } +} + +void RegisterHiddenGrottosVisibility() { + COND_ID_HOOK(OnActorDraw, ACTOR_DOOR_ANA, CVAR == HIDDEN_GROTTOS_VISIBLITY_HAVE_MASK_OF_TRUTH, [](Actor* actor) { + if (INV_CONTENT(ITEM_MASK_TRUTH) == ITEM_MASK_TRUTH) { + drawHiddenGrottoMarker(actor); + } + }); + + COND_ID_HOOK(OnActorDraw, ACTOR_DOOR_ANA, CVAR == HIDDEN_GROTTOS_VISIBLITY_WEAR_MASK_OF_TRUTH, [](Actor* actor) { + if (Player_GetMask(gPlayState) == PLAYER_MASK_TRUTH) { + drawHiddenGrottoMarker(actor); + } + }); + + COND_ID_HOOK(OnActorDraw, ACTOR_DOOR_ANA, CVAR == HIDDEN_GROTTOS_VISIBLITY_ALWAYS, + [](Actor* actor) { drawHiddenGrottoMarker(actor); }); +} + +static RegisterShipInitFunc initFunc(RegisterHiddenGrottosVisibility, { CVAR_NAME }); diff --git a/mm/2s2h/Enhancements/Enhancements.h b/mm/2s2h/Enhancements/Enhancements.h index cfda54a43..0e6e71098 100644 --- a/mm/2s2h/Enhancements/Enhancements.h +++ b/mm/2s2h/Enhancements/Enhancements.h @@ -39,6 +39,13 @@ enum DekuGuardSearchBallsOptions { DEKU_GUARD_SEARCH_BALLS_ALWAYS, }; +enum HiddenGrottosVisibilityOptions { + HIDDEN_GROTTOS_VISIBLITY_OFF, + HIDDEN_GROTTOS_VISIBLITY_WEAR_MASK_OF_TRUTH, + HIDDEN_GROTTOS_VISIBLITY_HAVE_MASK_OF_TRUTH, + HIDDEN_GROTTOS_VISIBLITY_ALWAYS, +}; + // Old Entry Point void InitEnhancements(); |
