From a67c6b9e674a98dc8c4118c515e10a9fb46d7503 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Fri, 19 Aug 2022 19:36:44 -0400 Subject: [PATCH] Fixes vanilla ice traps and randomized ice smoke --- soh/soh/Enhancements/item-tables/ItemTableTypes.h | 2 +- soh/src/overlays/actors/ovl_En_Box/z_en_box.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/soh/soh/Enhancements/item-tables/ItemTableTypes.h b/soh/soh/Enhancements/item-tables/ItemTableTypes.h index 1a703f30d..7e5f1a9a3 100644 --- a/soh/soh/Enhancements/item-tables/ItemTableTypes.h +++ b/soh/soh/Enhancements/item-tables/ItemTableTypes.h @@ -19,7 +19,7 @@ typedef struct { /* 0x03 */ uint16_t textId; /* 0x04 */ uint16_t objectId; /* 0x06 */ uint16_t modIndex; // 0 = Vanilla, 1 = Randomizer, future mods will increment up? - /* 0x08 */ uint16_t getItemId; + /* 0x08 */ int16_t getItemId; /* 0x0A */ uint16_t gid; // Stores the GID value unmodified for future reference. /* 0x0C */ uint16_t collectable; // determines whether the item can be collected on the overworld. Will be true in most cases. } GetItemEntry; // size = 0x0F diff --git a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c index a2f57ad6a..3e78982a3 100644 --- a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -481,8 +481,12 @@ void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) { } // Chests need to have a negative getItemId in order to not immediately give their item // when approaching. - sItem.getItemId = 0 - sItem.getItemId; - GiveItemEntryFromActorWithFixedRange(&this->dyna.actor, globalCtx, sItem); + if (gSaveContext.n64ddFlag) { + sItem.getItemId = 0 - sItem.getItemId; + GiveItemEntryFromActorWithFixedRange(&this->dyna.actor, globalCtx, sItem); + } else { + func_8002F554(&this->dyna.actor, globalCtx, -(this->dyna.actor.params >> 5 & 0x7F)); + } } if (Flags_GetTreasure(globalCtx, this->dyna.actor.params & 0x1F)) { EnBox_SetupAction(this, EnBox_Open); @@ -594,7 +598,7 @@ void EnBox_Update(Actor* thisx, GlobalContext* globalCtx) { } if (((!gSaveContext.n64ddFlag && ((this->dyna.actor.params >> 5 & 0x7F) == 0x7C)) || - (gSaveContext.n64ddFlag && sItem.getItemId == RG_ICE_TRAP)) && + (gSaveContext.n64ddFlag && ABS(sItem.getItemId) == RG_ICE_TRAP)) && this->actionFunc == EnBox_Open && this->skelanime.curFrame > 45 && this->iceSmokeTimer < 100) EnBox_SpawnIceSmoke(this, globalCtx); }