From 03ea465251f4bf78599457fb475a0fa71f3f1be0 Mon Sep 17 00:00:00 2001 From: inspectredc Date: Wed, 18 Oct 2023 21:21:50 +0100 Subject: [PATCH] Toggle Strength --- soh/soh/SohMenuBar.cpp | 6 +++ soh/src/code/z_player_lib.c | 4 ++ .../ovl_kaleido_scope/z_kaleido_equipment.c | 45 ++++++++++++++++--- 3 files changed, 50 insertions(+), 5 deletions(-) diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 04f25d2e8..c7233aef4 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -604,6 +604,12 @@ void DrawEnhancementsMenu() { UIWidgets::Tooltip("Prevent bombchus from forcing the camera into first-person mode when released."); UIWidgets::PaddedEnhancementCheckbox("Aiming reticle for the bow/slingshot", "gBowReticle", true, false); UIWidgets::Tooltip("Aiming with a bow or slingshot will display a reticle as with the hookshot when the projectile is ready to fire."); + if (UIWidgets::PaddedEnhancementCheckbox("Allow strength equipment to be toggled", "gToggleStrength", true, false)) { + if (!CVarGetInteger("gToggleStrength", 0)) { + CVarSetInteger("gStrengthDisabled", 0); + } + } + UIWidgets::Tooltip("Allows strength to be toggled on and off by pressing A on the strength upgrade in the equipment subscreen of the pause menu"); ImGui::EndMenu(); } diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index 32a3e6e48..0153cdbd5 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -509,6 +509,10 @@ s32 Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 y s32 Player_GetStrength(void) { s32 strengthUpgrade = CUR_UPG_VALUE(UPG_STRENGTH); + if (CVarGetInteger("gToggleStrength", 0) && CVarGetInteger("gStrengthDisabled", 0)) { + return PLAYER_STR_NONE; + } + if (CVarGetInteger("gTimelessEquipment", 0) || LINK_IS_ADULT) { return strengthUpgrade; } else if (strengthUpgrade != 0) { diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index dd6ea6a16..ec16564eb 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -488,6 +488,12 @@ void KaleidoScope_DrawEquipment(PlayState* play) { } } + // Grey Out Strength Upgrade Name when Disabled + if ((pauseCtx->cursorX[PAUSE_EQUIP] == 0) && (pauseCtx->cursorY[PAUSE_EQUIP] == 2) && + CVarGetInteger("gToggleStrength", 0) && CVarGetInteger("gStrengthDisabled", 0)) { + pauseCtx->nameColorSet = 1; + } + if ((pauseCtx->cursorX[PAUSE_EQUIP] == 0) && (pauseCtx->cursorY[PAUSE_EQUIP] == 0)) { if (LINK_AGE_IN_YEARS != YEARS_CHILD) { if ((cursorItem >= ITEM_BULLET_BAG_30) && (cursorItem <= ITEM_BULLET_BAG_50)) { @@ -507,6 +513,13 @@ void KaleidoScope_DrawEquipment(PlayState* play) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } + // Allow Toggling of Strength when Pressing A on Strength Upgrade Slot + if ((pauseCtx->cursorSpecialPos == 0) && (pauseCtx->state == 6) && + (pauseCtx->unk_1E4 == 0) && CHECK_BTN_ALL(input->press.button, BTN_A) && + (pauseCtx->cursorX[PAUSE_EQUIP] == 0) && (pauseCtx->cursorY[PAUSE_EQUIP] == 2) && CVarGetInteger("gToggleStrength", 0)) { + CVarSetInteger("gStrengthDisabled", !CVarGetInteger("gStrengthDisabled", 0)); + } + if ((pauseCtx->cursorSpecialPos == 0) && (cursorItem != PAUSE_ITEM_NONE) && (pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && CHECK_BTN_ANY(input->press.button, buttonsToCheck) && (pauseCtx->cursorX[PAUSE_EQUIP] != 0)) { @@ -659,6 +672,22 @@ void KaleidoScope_DrawEquipment(PlayState* play) { } } + // Add zoom effect to strength item if cursor is hovering over it and strength is not disabled when the toggle is on + if ((pauseCtx->cursorX[PAUSE_EQUIP] == 0) && (pauseCtx->cursorY[PAUSE_EQUIP] == 2) && + CVarGetInteger("gToggleStrength", 0) && !CVarGetInteger("gStrengthDisabled", 0)) { + i = 2; // row + k = 0; // column + j = 16 * i + 4 * k; // vtx index + pauseCtx->equipVtx[j].v.ob[0] = pauseCtx->equipVtx[j + 2].v.ob[0] = + pauseCtx->equipVtx[j].v.ob[0] - 2; + pauseCtx->equipVtx[j + 1].v.ob[0] = pauseCtx->equipVtx[j + 3].v.ob[0] = + pauseCtx->equipVtx[j + 1].v.ob[0] + 4; + pauseCtx->equipVtx[j].v.ob[1] = pauseCtx->equipVtx[j + 1].v.ob[1] = + pauseCtx->equipVtx[j].v.ob[1] + 2; + pauseCtx->equipVtx[j + 2].v.ob[1] = pauseCtx->equipVtx[j + 3].v.ob[1] = + pauseCtx->equipVtx[j + 2].v.ob[1] - 4; + } + Gfx_SetupDL_42Opa(play->state.gfxCtx); gDPSetCombineMode(POLY_KAL_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); @@ -670,9 +699,12 @@ void KaleidoScope_DrawEquipment(PlayState* play) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { point = CUR_UPG_VALUE(sChildUpgrades[i]); if ((point != 0) && (CUR_UPG_VALUE(sChildUpgrades[i]) != 0)) { - if (drawGreyItems && + // Grey Out the Gauntlets as Child + // Grey Out Strength Upgrades when Disabled and the Toggle Option is on + if ((drawGreyItems && ((sChildUpgradeItemBases[i] + CUR_UPG_VALUE(sChildUpgrades[i]) - 1) == ITEM_GAUNTLETS_SILVER || - (sChildUpgradeItemBases[i] + CUR_UPG_VALUE(sChildUpgrades[i]) - 1) == ITEM_GAUNTLETS_GOLD)) { // Grey Out the Gauntlets + (sChildUpgradeItemBases[i] + CUR_UPG_VALUE(sChildUpgrades[i]) - 1) == ITEM_GAUNTLETS_GOLD)) || + (CVarGetInteger("gToggleStrength", 0) && CVarGetInteger("gStrengthDisabled", 0) && sChildUpgrades[i] == UPG_STRENGTH)) { gDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255); gSPGrayscale(POLY_KAL_DISP++, true); } @@ -688,9 +720,12 @@ void KaleidoScope_DrawEquipment(PlayState* play) { KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gItemIcons[sChildUpgradeItemBases[i] + CUR_UPG_VALUE(sChildUpgrades[i]) - 1], 32, 32, 0); gSPGrayscale(POLY_KAL_DISP++, false); } else if (CUR_UPG_VALUE(sAdultUpgrades[i]) != 0) { - if (drawGreyItems && - ((sAdultUpgradeItemBases[i] + CUR_UPG_VALUE(sAdultUpgrades[i]) - 1) == ITEM_BRACELET && - !(IS_RANDO))) { // Grey Out the Goron Bracelet when Not Randomized + // Grey Out the Goron Bracelet when Not Randomized + // Grey Out Strength Upgrades when Disabled and the Toggle Option is on + if ((drawGreyItems && + (((sAdultUpgradeItemBases[i] + CUR_UPG_VALUE(sAdultUpgrades[i]) - 1) == ITEM_BRACELET && + !(IS_RANDO)))) || + (CVarGetInteger("gToggleStrength", 0) && CVarGetInteger("gStrengthDisabled", 0) && sAdultUpgrades[i] == UPG_STRENGTH)) { gDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255); gSPGrayscale(POLY_KAL_DISP++, true); }