Skip to content

Commit

Permalink
Add another option to PCS restoration (#1009)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettjoecox authored Feb 24, 2025
1 parent 4c80ffe commit 84673f6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
13 changes: 10 additions & 3 deletions mm/2s2h/BenGui/BenMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1154,10 +1154,17 @@ void BenMenu::AddEnhancements() {
AddWidget(path, "Constant Distance Backflips and Sidehops", WIDGET_CVAR_CHECKBOX)
.CVar("gEnhancements.Restorations.ConstantFlipsHops")
.Options(CheckboxOptions().Tooltip("Backflips and Sidehops travel a constant distance as they did in OoT."));
AddWidget(path, "Power Crouch Stab", WIDGET_CVAR_CHECKBOX)
AddWidget(path, "Power Crouch Stab", WIDGET_CVAR_COMBOBOX)
.CVar("gEnhancements.Restorations.PowerCrouchStab")
.Options(CheckboxOptions().Tooltip(
"Crouch stabs will use the power of Link's previous melee attack, as is in MM JP 1.0 and OoT."));
.Options(
ComboboxOptions()
.Tooltip("Crouch stabs will use the power of Link's previous melee attack.\n"
"- Patched: Crouch stabs will always do the same damage as a slash with your current weapon\n"
"- Unpatched (JP): Glitch restored, and your initial damage is 0 (Can be useful to get ISG on "
"pots)\n"
"- Unpatched (OoT): Glitch restored, and your initial damage is 1 (a kokiri sword slash).")
.DefaultIndex(0)
.ComboMap(powerCrouchStabOptions));
AddWidget(path, "Side Rolls", WIDGET_CVAR_CHECKBOX)
.CVar("gEnhancements.Restorations.SideRoll")
.Options(CheckboxOptions().Tooltip("Restores side rolling from OoT."));
Expand Down
6 changes: 6 additions & 0 deletions mm/2s2h/BenGui/BenMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ static const std::unordered_map<int32_t, const char*> dekuGuardSearchBallsOption
{ DEKU_GUARD_SEARCH_BALLS_ALWAYS, "Always" },
};

static const std::unordered_map<int32_t, const char*> powerCrouchStabOptions = {
{ 0, "Patched (US/EU)" },
{ 1, "Unpatched (JP)" },
{ 2, "Unpatched (OoT)" },
};

static const std::unordered_map<int32_t, const char*> damageMultiplierOptions = {
{ 0, "1x" }, { 1, "2x" }, { 2, "4x" }, { 3, "8x" }, { 4, "16x" }, { 10, "1 Hit KO" },
};
Expand Down
6 changes: 6 additions & 0 deletions mm/2s2h/Enhancements/Restorations/PowerCrouchStab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

void RegisterPowerCrouchStab() {
COND_VB_SHOULD(VB_PATCH_POWER_CROUCH_STAB, CVAR, { *should = false; });

COND_ID_HOOK(OnActorInit, ACTOR_PLAYER, CVAR == 2, [](Actor* actor) {
Player* player = (Player*)actor;
player->meleeWeaponQuads[0].info.toucher.dmgFlags = 512; // Kokiri Sword
player->meleeWeaponQuads[1].info.toucher.dmgFlags = 512; // Kokiri Sword
});
}

static RegisterShipInitFunc initFunc(RegisterPowerCrouchStab, { CVAR_NAME });

0 comments on commit 84673f6

Please sign in to comment.