From cc6e4238cf6eb143265de6b22c36efad584157e1 Mon Sep 17 00:00:00 2001 From: aMannus Date: Thu, 25 Aug 2022 08:49:15 +0200 Subject: [PATCH 1/4] Fixes BGS on skull tokens --- soh/src/code/z_parameter.c | 1 + 1 file changed, 1 insertion(+) diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 9d95bb0bc..e2aa0fe46 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -1644,6 +1644,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { if (item == ITEM_SWORD_BGS) { gSaveContext.swordHealth = 8; + gSaveContext.bgsFlag = 1; if (ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xF ||(gSaveContext.n64ddFlag && ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xE)) { // In rando, when buying Giant's Knife, also check From 69157640f6e6792e20f74fa9c71dd2a0b3f961d0 Mon Sep 17 00:00:00 2001 From: aMannus Date: Thu, 25 Aug 2022 17:34:45 +0200 Subject: [PATCH 2/4] Removed BGS flag in Item_Give() --- soh/src/code/z_parameter.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index e2aa0fe46..b47c86622 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -1642,13 +1642,16 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) { } else if ((item >= ITEM_SWORD_KOKIRI) && (item <= ITEM_SWORD_BGS)) { gSaveContext.inventory.equipment |= gBitFlags[item - ITEM_SWORD_KOKIRI] << gEquipShifts[EQUIP_SWORD]; + // Both Giant's Knife and Biggoron Sword have the same Item ID, so this part handles both of them if (item == ITEM_SWORD_BGS) { gSaveContext.swordHealth = 8; - gSaveContext.bgsFlag = 1; - if (ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xF - ||(gSaveContext.n64ddFlag && ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xE)) { // In rando, when buying Giant's Knife, also check - gSaveContext.inventory.equipment ^= 8 << gEquipShifts[EQUIP_SWORD]; // for 0xE in case we don't have Kokiri Sword + // In rando, when buying Giant's Knife, also check + // for 0xE in case we don't have Kokiri Sword + if (ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xF || (gSaveContext.n64ddFlag && ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xE)) { + + gSaveContext.inventory.equipment ^= 8 << gEquipShifts[EQUIP_SWORD]; + if (gSaveContext.equips.buttonItems[0] == ITEM_SWORD_KNIFE) { gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS; Interface_LoadItemIcon1(globalCtx, 0); From 49b48fb7a4db1d334a62c9cc6d3241e81a5c8848 Mon Sep 17 00:00:00 2001 From: aMannus Date: Thu, 25 Aug 2022 19:56:34 +0200 Subject: [PATCH 3/4] Fix BGS and maps/keys textboxes --- soh/src/overlays/actors/ovl_En_Si/z_en_si.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/soh/src/overlays/actors/ovl_En_Si/z_en_si.c b/soh/src/overlays/actors/ovl_En_Si/z_en_si.c index aa07c1450..87a3b854c 100644 --- a/soh/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/soh/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -205,13 +205,13 @@ void Randomizer_UpdateSkullReward(EnSi* this, GlobalContext* globalCtx) { getItem = Randomizer_GetRandomizedItem(GI_SKULL_TOKEN, this->actor.id, this->actor.params, globalCtx->sceneNum); getItemId = getItem.getItemId; if (getItemId == RG_ICE_TRAP) { - player->getItemEntry = getItem; player->pendingIceTrap = true; textId = 0xF8; } else { textId = getItem.textId; giveItemId = getItem.itemId; } + player->getItemEntry = getItem; } void Randomizer_GiveSkullReward(EnSi* this, GlobalContext* globalCtx) { @@ -222,5 +222,7 @@ void Randomizer_GiveSkullReward(EnSi* this, GlobalContext* globalCtx) { } else if (getItem.modIndex == MOD_RANDOMIZER) { Randomizer_Item_Give(globalCtx, getItem); } - player->getItemEntry = getItem; + if (getItem.getItemId == GI_SWORD_BGS) { + gSaveContext.bgsFlag = true; + } } From 29b9f0b37e586543d036a7f6ee58d5484b8d2167 Mon Sep 17 00:00:00 2001 From: aMannus Date: Thu, 25 Aug 2022 19:58:05 +0200 Subject: [PATCH 4/4] Comment --- soh/src/overlays/actors/ovl_En_Si/z_en_si.c | 1 + 1 file changed, 1 insertion(+) diff --git a/soh/src/overlays/actors/ovl_En_Si/z_en_si.c b/soh/src/overlays/actors/ovl_En_Si/z_en_si.c index 87a3b854c..39e1195f5 100644 --- a/soh/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/soh/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -222,6 +222,7 @@ void Randomizer_GiveSkullReward(EnSi* this, GlobalContext* globalCtx) { } else if (getItem.modIndex == MOD_RANDOMIZER) { Randomizer_Item_Give(globalCtx, getItem); } + // RANDOTOD: Move this into Item_Give() or some other more central location if (getItem.getItemId == GI_SWORD_BGS) { gSaveContext.bgsFlag = true; }