From 99674ff88c0ef9669d3782a7003d533a7d5e2f1b Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Mon, 29 Aug 2022 19:19:01 -0400 Subject: [PATCH] Readds missing workaround for spirit temple and ganon's castle keys. --- soh/src/code/z_parameter.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 73044df27..265c69ace 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -1690,12 +1690,35 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { } return ITEM_NONE; } else if (item == ITEM_KEY_SMALL) { - if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] < 0) { - gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] = 1; - return ITEM_NONE; + // Small key exceptions for rando with keysanity off. + if (gSaveContext.n64ddFlag) { + if (globalCtx->sceneNum == 10) { // ganon's tower -> ganon's castle + if (gSaveContext.inventory.dungeonKeys[13] < 0) { + gSaveContext.inventory.dungeonKeys[13] = 1; + return ITEM_NONE; + } else { + gSaveContext.inventory.dungeonKeys[13]++; + return ITEM_NONE; + } + } + + if (globalCtx->sceneNum == 92) { // Desert Colossus -> Spirit Temple. + if (gSaveContext.inventory.dungeonKeys[6] < 0) { + gSaveContext.inventory.dungeonKeys[6] = 1; + return ITEM_NONE; + } else { + gSaveContext.inventory.dungeonKeys[6]++; + return ITEM_NONE; + } + } } else { - gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]++; - return ITEM_NONE; + if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] < 0) { + gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] = 1; + return ITEM_NONE; + } else { + gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]++; + return ITEM_NONE; + } } } else if ((item == ITEM_QUIVER_30) || (item == ITEM_BOW)) { if (CUR_UPG_VALUE(UPG_QUIVER) == 0) {