diff --git a/soh/include/macros.h b/soh/include/macros.h index 4ff2b9a41..5f15b7a1b 100644 --- a/soh/include/macros.h +++ b/soh/include/macros.h @@ -38,6 +38,10 @@ #define LINK_IS_ADULT (gSaveContext.linkAge == 0) #define LINK_IS_CHILD (gSaveContext.linkAge == 1) +#define CHECK_EQUIPMENT_AGE(i, j) (CVar_GetS32("gTimelessEquipment", 0) || (gEquipAgeReqs[i][j] == 9) || (gEquipAgeReqs[i][j] == ((void)0, gSaveContext.linkAge))) +#define CHECK_SLOT_AGE(slotIndex) (CVar_GetS32("gTimelessEquipment", 0) || (gSlotAgeReqs[slotIndex] == 9) || gSlotAgeReqs[slotIndex] == ((void)0, gSaveContext.linkAge)) +#define CHECK_ITEM_AGE(itemIndex) (CVar_GetS32("gTimelessEquipment", 0) || (gItemAgeReqs[itemIndex] == 9) || (gItemAgeReqs[itemIndex] == gSaveContext.linkAge)) + #define YEARS_CHILD 5 #define YEARS_ADULT 17 #define LINK_AGE_IN_YEARS (!LINK_IS_ADULT ? YEARS_CHILD : YEARS_ADULT) diff --git a/soh/soh/GameMenuBar.cpp b/soh/soh/GameMenuBar.cpp index defa34bb7..23cf1a488 100644 --- a/soh/soh/GameMenuBar.cpp +++ b/soh/soh/GameMenuBar.cpp @@ -1352,6 +1352,8 @@ namespace GameMenuBar { UIWidgets::Tooltip("Makes every tunic have the effects of every other tunic"); UIWidgets::PaddedEnhancementCheckbox("Easy ISG", "gEzISG", true, false); UIWidgets::Tooltip("Passive Infinite Sword Glitch\nIt makes your sword's swing effect and hitbox stay active indefinitely"); + UIWidgets::PaddedEnhancementCheckbox("Timeless Equipment", "gTimelessEquipment", true, false); + UIWidgets::Tooltip("Allows any item to be equipped, regardless of age\nAlso allows Child to use Adult strength upgrades"); UIWidgets::PaddedEnhancementCheckbox("Easy Frame Advancing", "gCheatEasyPauseBufferEnabled", true, false); UIWidgets::Tooltip("Continue holding START button when unpausing to only advance a single frame and then re-pause"); UIWidgets::PaddedEnhancementCheckbox("Unrestricted Items", "gNoRestrictItems", true, false); diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index 5e5a10980..e187707c4 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -489,7 +489,7 @@ s32 Player_IsBurningStickInRange(GlobalContext* globalCtx, Vec3f* pos, f32 xzRan s32 Player_GetStrength(void) { s32 strengthUpgrade = CUR_UPG_VALUE(UPG_STRENGTH); - if (LINK_IS_ADULT) { + if (CVar_GetS32("gTimelessEquipment", 0) || LINK_IS_ADULT) { return strengthUpgrade; } else if (strengthUpgrade != 0) { return PLAYER_STR_BRACELET; 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 1b37c5433..1828a7d2e 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 @@ -474,9 +474,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { osSyncPrintf("kscope->select_name[Display_Equipment] = %d\n", pauseCtx->cursorItem[PAUSE_EQUIP]); - if (!((gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] == 9) || - (gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] == - ((void)0, gSaveContext.linkAge)))) { + if (!(CHECK_EQUIPMENT_AGE(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP]))) { pauseCtx->nameColorSet = 1; } @@ -511,9 +509,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { (pauseCtx->unk_1E4 == 0) && CHECK_BTN_ANY(input->press.button, buttonsToCheck) && (pauseCtx->cursorX[PAUSE_EQUIP] != 0)) { - if ((gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] == 9) || - (gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] == - ((void)0, gSaveContext.linkAge))) { + if (CHECK_EQUIPMENT_AGE(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP])) { if (CHECK_BTN_ALL(input->press.button, BTN_A)) { // Allow Link to remove his equipment from the equipment subscreen by toggling on/off @@ -645,7 +641,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { for (k = 0, temp = rowStart + 1, bit = rowStart, j = point; k < 3; k++, bit++, j += 4, temp++) { if ((gBitFlags[bit] & gSaveContext.inventory.equipment) && (pauseCtx->cursorSpecialPos == 0)) { - if ((gEquipAgeReqs[i][k + 1] == 9) || (gEquipAgeReqs[i][k + 1] == ((void)0, gSaveContext.linkAge))) { + if (CHECK_EQUIPMENT_AGE(i, k + 1)) { if (temp == cursorSlot) { pauseCtx->equipVtx[j].v.ob[0] = pauseCtx->equipVtx[j + 2].v.ob[0] = pauseCtx->equipVtx[j].v.ob[0] - 2; @@ -668,12 +664,13 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { for (rowStart = 0, j = 0, temp = 0, i = 0; i < 4; i++, rowStart += 4, j += 16) { gSPVertex(POLY_KAL_DISP++, &pauseCtx->equipVtx[j], 16, 0); - + bool drawGreyItems = !CVar_GetS32("gTimelessEquipment", 0); if (LINK_AGE_IN_YEARS == YEARS_CHILD) { point = CUR_UPG_VALUE(sChildUpgrades[i]); if ((point != 0) && (CUR_UPG_VALUE(sChildUpgrades[i]) != 0)) { - if ((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 + 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 gsDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255); gsSPGrayscale(POLY_KAL_DISP++, true); } @@ -682,15 +679,16 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { } } else { if ((i == 0) && (CUR_UPG_VALUE(sAdultUpgrades[i]) == 0)) { // If the player doesn't have the bow, load the current slingshot ammo upgrade instead. - { + if (drawGreyItems) { gsDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255); // Grey Out Slingshot Bullet Bags gsSPGrayscale(POLY_KAL_DISP++, true); } KaleidoScope_DrawQuadTextureRGBA32(globalCtx->state.gfxCtx, gItemIcons[sChildUpgradeItemBases[i] + CUR_UPG_VALUE(sChildUpgrades[i]) - 1], 32, 32, 0); gsSPGrayscale(POLY_KAL_DISP++, false); } else if (CUR_UPG_VALUE(sAdultUpgrades[i]) != 0) { - if ((sAdultUpgradeItemBases[i] + CUR_UPG_VALUE(sAdultUpgrades[i]) - 1) == ITEM_BRACELET && - !(gSaveContext.n64ddFlag)) { // Grey Out the Goron Bracelet when Not Randomized + if (drawGreyItems && + ((sAdultUpgradeItemBases[i] + CUR_UPG_VALUE(sAdultUpgrades[i]) - 1) == ITEM_BRACELET && + !(gSaveContext.n64ddFlag))) { // Grey Out the Goron Bracelet when Not Randomized gsDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255); gsSPGrayscale(POLY_KAL_DISP++, true); } @@ -702,7 +700,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { for (k = 0, bit = rowStart, point = 4; k < 3; k++, point += 4, temp++, bit++) { int itemId = ITEM_SWORD_KOKIRI + temp; - bool age_restricted = (gItemAgeReqs[itemId] != 9) && (gItemAgeReqs[itemId] != gSaveContext.linkAge); + bool age_restricted = !CHECK_ITEM_AGE(itemId); if (age_restricted) { gsDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255); gsSPGrayscale(POLY_KAL_DISP++, true); diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c index 0e5ea0bef..25e10dfc4 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c @@ -30,7 +30,7 @@ void KaleidoScope_DrawAmmoCount(PauseContext* pauseCtx, GraphicsContext* gfxCtx, gDPPipeSync(POLY_KAL_DISP++); - if (!((gSlotAgeReqs[SLOT(item)] == 9) || gSlotAgeReqs[SLOT(item)] == ((void)0, gSaveContext.linkAge))) { + if (!CHECK_SLOT_AGE(SLOT(item))) { gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 100, 100, 100, pauseCtx->alpha); } else { gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); @@ -343,9 +343,12 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { pauseCtx->cursorSlot[PAUSE_ITEM] = cursorSlot; gSlotAgeReqs[SLOT_TRADE_CHILD] = gItemAgeReqs[ITEM_MASK_BUNNY] = - (CVar_GetS32("gMMBunnyHood", 0) && INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_MASK_BUNNY) ? 9 : 1; + ((CVar_GetS32("gMMBunnyHood", 0) || CVar_GetS32("gTimelessEquipment", 0)) && + INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_MASK_BUNNY) + ? 9 + : 1; - if (!((gSlotAgeReqs[cursorSlot] == 9) || (gSlotAgeReqs[cursorSlot] == ((void)0, gSaveContext.linkAge)))) { + if (!CHECK_SLOT_AGE(cursorSlot)) { pauseCtx->nameColorSet = 1; } @@ -424,8 +427,7 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } if (CHECK_BTN_ANY(input->press.button, buttonsToCheck)) { - if (((gSlotAgeReqs[cursorSlot] == 9) || - (gSlotAgeReqs[cursorSlot] == ((void)0, gSaveContext.linkAge))) && + if (CHECK_SLOT_AGE(cursorSlot) && (cursorItem != ITEM_SOLD_OUT) && (cursorItem != ITEM_NONE)) { KaleidoScope_SetupItemEquip(globalCtx, cursorItem, cursorSlot, pauseCtx->itemVtx[index].v.ob[0] * 10, @@ -477,7 +479,7 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { if (gSaveContext.inventory.items[i] != ITEM_NONE) { if ((pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM) && (pauseCtx->cursorSpecialPos == 0)) { - if ((gSlotAgeReqs[i] == 9) || (gSlotAgeReqs[i] == ((void)0, gSaveContext.linkAge))) { + if (CHECK_SLOT_AGE(i)) { if ((sEquipState == 2) && (i == 3)) { gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, magicArrowEffectsR[pauseCtx->equipTargetItem - 0xBF], magicArrowEffectsG[pauseCtx->equipTargetItem - 0xBF], @@ -512,7 +514,7 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) { gSPVertex(POLY_KAL_DISP++, &pauseCtx->itemVtx[j + 0], 4, 0); int itemId = gSaveContext.inventory.items[i]; - bool not_acquired = (gItemAgeReqs[itemId] != 9) && (gItemAgeReqs[itemId] != gSaveContext.linkAge); + bool not_acquired = !CHECK_ITEM_AGE(itemId); if (not_acquired) { gsDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255); gsSPGrayscale(POLY_KAL_DISP++, true);