More Sword Toggle Options (#3889)

* Sword Unequipping Toggle

* better macro

* less ugly format

* cvar prefix

* Update soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c

* Update soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c

---------

Co-authored-by: Garrett Cox <garrettjcox@gmail.com>
This commit is contained in:
inspectredc 2024-02-16 02:15:44 +00:00 committed by GitHub
parent 1bc15d5bf3
commit 457a75e9f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 39 additions and 8 deletions

View File

@ -78,4 +78,10 @@ typedef enum {
DEKU_STICK_UNBREAKABLE_AND_ALWAYS_ON_FIRE, DEKU_STICK_UNBREAKABLE_AND_ALWAYS_ON_FIRE,
} DekuStickType; } DekuStickType;
typedef enum {
SWORD_TOGGLE_NONE,
SWORD_TOGGLE_CHILD,
SWORD_TOGGLE_BOTH_AGES,
} SwordToggleMode;
#endif #endif

View File

@ -105,6 +105,7 @@ static const char* imguiScaleOptions[4] = { "Small", "Normal", "Large", "X-Large
"OHKO" "OHKO"
}; };
static const char* timeTravelOptions[3] = { "Disabled", "Ocarina of Time", "Any Ocarina" }; static const char* timeTravelOptions[3] = { "Disabled", "Ocarina of Time", "Any Ocarina" };
static const char* swordToggleModes[3] = { "Disabled", "Child Toggle", "Both Ages (May lead to unintended behaviour)"};
extern "C" SaveContext gSaveContext; extern "C" SaveContext gSaveContext;
@ -1006,6 +1007,17 @@ void DrawEnhancementsMenu() {
UIWidgets::Tooltip("Allows equipping the tunic and boots to c-buttons"); UIWidgets::Tooltip("Allows equipping the tunic and boots to c-buttons");
UIWidgets::PaddedEnhancementCheckbox("Equipment Toggle", "gEquipmentCanBeRemoved", true, false); UIWidgets::PaddedEnhancementCheckbox("Equipment Toggle", "gEquipmentCanBeRemoved", true, false);
UIWidgets::Tooltip("Allows equipment to be removed by toggling it off on\nthe equipment subscreen."); UIWidgets::Tooltip("Allows equipment to be removed by toggling it off on\nthe equipment subscreen.");
if (CVarGetInteger("gEquipmentCanBeRemoved", 0)) {
UIWidgets::PaddedText("Sword Toggle Options", true, false);
UIWidgets::EnhancementCombobox("gEnhancements.SwordToggle", swordToggleModes, SWORD_TOGGLE_NONE);
UIWidgets::Tooltip(
"Introduces Options for unequipping Link's sword\n\n"
"None: Only Biggoron's Sword/Giant's Knife can be toggled. Doing so will equip the Master Sword.\n\n"
"Child Toggle: This will allow for completely unequipping any sword as child link.\n\n"
"Both Ages: Any sword can be unequipped as either age. This may lead to swordless glitches as Adult.\n"
);
}
UIWidgets::PaddedEnhancementCheckbox("Link's Cow in Both Time Periods", "gCowOfTime", true, false); UIWidgets::PaddedEnhancementCheckbox("Link's Cow in Both Time Periods", "gCowOfTime", true, false);
UIWidgets::Tooltip("Allows the Lon Lon Ranch obstacle course reward to be shared across time periods"); UIWidgets::Tooltip("Allows the Lon Lon Ranch obstacle course reward to be shared across time periods");
UIWidgets::PaddedEnhancementCheckbox("Enable visible guard vision", "gGuardVision", true, false); UIWidgets::PaddedEnhancementCheckbox("Enable visible guard vision", "gGuardVision", true, false);

View File

@ -2,6 +2,7 @@
#include "textures/icon_item_static/icon_item_static.h" #include "textures/icon_item_static/icon_item_static.h"
#include "textures/parameter_static/parameter_static.h" #include "textures/parameter_static/parameter_static.h"
#include "soh/Enhancements/cosmetics/cosmeticsTypes.h" #include "soh/Enhancements/cosmetics/cosmeticsTypes.h"
#include "soh/Enhancements/enhancementTypes.h"
static u8 sChildUpgrades[] = { UPG_BULLET_BAG, UPG_BOMB_BAG, UPG_STRENGTH, UPG_SCALE }; static u8 sChildUpgrades[] = { UPG_BULLET_BAG, UPG_BOMB_BAG, UPG_STRENGTH, UPG_SCALE };
static u8 sAdultUpgrades[] = { UPG_QUIVER, UPG_BOMB_BAG, UPG_STRENGTH, UPG_SCALE }; static u8 sAdultUpgrades[] = { UPG_QUIVER, UPG_BOMB_BAG, UPG_STRENGTH, UPG_SCALE };
@ -562,6 +563,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
if (CHECK_AGE_REQ_EQUIP(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP])) { if (CHECK_AGE_REQ_EQUIP(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP])) {
if (CHECK_BTN_ALL(input->press.button, BTN_A)) { if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
// #Region SoH [Enhancements]
// Allow Link to remove his equipment from the equipment subscreen by toggling on/off // Allow Link to remove his equipment from the equipment subscreen by toggling on/off
// Shields will be un-equipped entirely, and tunics/boots will revert to Kokiri Tunic/Kokiri Boots // Shields will be un-equipped entirely, and tunics/boots will revert to Kokiri Tunic/Kokiri Boots
// Only BGS/Giant's Knife is affected, and it will revert to Master Sword. // Only BGS/Giant's Knife is affected, and it will revert to Master Sword.
@ -569,13 +571,24 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
// If we have the feature toggled on // If we have the feature toggled on
if (CVarGetInteger("gEquipmentCanBeRemoved", 0)) { if (CVarGetInteger("gEquipmentCanBeRemoved", 0)) {
// If we're on the "swords" section of the equipment screen AND we're on a currently-equipped BGS/Giant's Knife if (CVarGetInteger("gEnhancements.SwordToggle", SWORD_TOGGLE_NONE) == SWORD_TOGGLE_BOTH_AGES ||
if (pauseCtx->cursorY[PAUSE_EQUIP] == 0 && pauseCtx->cursorX[PAUSE_EQUIP] == 3 (CVarGetInteger("gEnhancements.SwordToggle", SWORD_TOGGLE_NONE) == SWORD_TOGGLE_CHILD) && LINK_IS_CHILD) {
&& CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) == EQUIP_VALUE_SWORD_BIGGORON && CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_MASTER)){ // And we have the Master Sword // If we're on the "swords" section of the equipment screen AND we're on a currently-equipped sword
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_MASTER); // "Unequip" it by equipping Master Sword if (pauseCtx->cursorY[PAUSE_EQUIP] == 0 && pauseCtx->cursorX[PAUSE_EQUIP] == CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD)) {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER; Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_NONE);
gSaveContext.infTable[29] = 0; gSaveContext.equips.buttonItems[0] = ITEM_NONE;
goto RESUME_EQUIPMENT_SWORD; // Skip to here so we don't re-equip it Flags_SetInfTable(INFTABLE_SWORDLESS);
goto RESUME_EQUIPMENT_SWORD; // Skip to here so we don't re-equip it
}
} else {
// If we're on the "swords" section of the equipment screen AND we're on a currently-equipped BGS/Giant's Knife
if (pauseCtx->cursorY[PAUSE_EQUIP] == 0 && pauseCtx->cursorX[PAUSE_EQUIP] == 3
&& CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) == EQUIP_VALUE_SWORD_BIGGORON && CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_MASTER)){ // And we have the Master Sword
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_MASTER); // "Unequip" it by equipping Master Sword
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER;
Flags_UnsetInfTable(INFTABLE_SWORDLESS);
goto RESUME_EQUIPMENT_SWORD; // Skip to here so we don't re-equip it
}
} }
// If we're on the "shields" section of the equipment screen AND we're on a currently-equipped shield // If we're on the "shields" section of the equipment screen AND we're on a currently-equipped shield