From 0efb0082139095a13ff0a553c584f692ab04fdcb Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Sun, 7 Aug 2022 13:17:06 -0400 Subject: [PATCH] Partially fixes Ice Traps Obtaining a freestanding Ice Trap causes link to slide forward and receiving one from an NPC plays the sound effect and damage animation but doesn't freeze link. --- soh/soh/Enhancements/randomizer/randomizer.cpp | 6 ++++-- soh/src/code/z_en_item00.c | 4 ++-- soh/src/overlays/actors/ovl_player_actor/z_player.c | 9 +++++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 7974dbdf8..ae712a00a 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -2329,8 +2329,8 @@ GetItemID Randomizer::GetItemFromGet(RandomizerGet randoGet, GetItemID ogItemId) // todo figure out what GI_HEART_CONTAINER_2 is return GI_HEART_CONTAINER; - case RG_ICE_TRAP: - return GI_ICE_TRAP; + // case RG_ICE_TRAP: + // return GI_ICE_TRAP; case RG_MILK: return GI_MILK; //todo logic around needing a bottle? @@ -2429,6 +2429,7 @@ bool Randomizer::IsGetItemRandoExclusive(RandomizerGet randoGet) { case RG_BOTTLE_WITH_BUGS: case RG_BOTTLE_WITH_POE: case RG_BOTTLE_WITH_BIG_POE: + case RG_ICE_TRAP: return true; default: return false; @@ -4807,6 +4808,7 @@ void InitRandoItemTable() { // Starting here, these do not have ItemIDs or GetItemIDs from vanilla, so I'm using their // RandomizerGet enum values for both. + GET_ITEM(RG_ICE_TRAP, OBJECT_INVALID, GID_RUPEE_GOLD, 0, 0, CHEST_ANIM_SHORT), GET_ITEM(RG_MAGIC_SINGLE, OBJECT_GI_MAGICPOT, GID_MAGIC_SMALL, 0xE4, 0x80, CHEST_ANIM_LONG), GET_ITEM(RG_MAGIC_DOUBLE, OBJECT_GI_MAGICPOT, GID_MAGIC_LARGE, 0xE8, 0x80, CHEST_ANIM_LONG), GET_ITEM(RG_DOUBLE_DEFENSE, OBJECT_GI_HEARTS, GID_HEART_CONTAINER, 0xE9, 0x80, CHEST_ANIM_LONG), diff --git a/soh/src/code/z_en_item00.c b/soh/src/code/z_en_item00.c index 43c1c64b3..ba6f46c2c 100644 --- a/soh/src/code/z_en_item00.c +++ b/soh/src/code/z_en_item00.c @@ -1339,7 +1339,7 @@ void EnItem00_DrawCollectible(EnItem00* this, GlobalContext* globalCtx) { GetItemEntry randoGetItemEntry = Randomizer_GetRandomizedItem(this->getItemId, this->actor.id, this->ogParams, globalCtx->sceneNum); EnItem00_CustomItemsParticles(&this->actor, globalCtx, randoGetItemEntry); - GetItem_Draw(globalCtx, randoGetItemEntry.gi); + GetItem_Draw(globalCtx, ABS(randoGetItemEntry.gi) - 1); } else { s32 texIndex = this->actor.params - 3; @@ -1399,7 +1399,7 @@ void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx) { GetItemEntry randoGetItemEntry = Randomizer_GetRandomizedItem(GI_HEART_PIECE, this->actor.id, this->ogParams, globalCtx->sceneNum); EnItem00_CustomItemsParticles(&this->actor, globalCtx, randoGetItemEntry); - GetItem_Draw(globalCtx, ABS(randoGetItemEntry.gi - 1)); + GetItem_Draw(globalCtx, ABS(randoGetItemEntry.gi) - 1); } else { s32 pad; diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index 275597ab1..de938305e 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -6281,7 +6281,12 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { } if (this->getItemId < GI_MAX) { - GetItemEntry giEntry = ItemTable_Retrieve(this->getItemId - 1); + GetItemEntry giEntry; + if (this->getItemEntry.objectId == OBJECT_INVALID) { + giEntry = ItemTable_Retrieve(this->getItemId - 1); + } else { + giEntry = this->getItemEntry; + } if ((interactedActor != &this->actor) && !iREG(67)) { interactedActor->parent = &this->actor; @@ -6289,7 +6294,7 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { iREG(67) = false; - if (gSaveContext.n64ddFlag && this->getItemId == GI_ICE_TRAP) { + if (gSaveContext.n64ddFlag && this->getItemId == RG_ICE_TRAP) { this->stateFlags1 &= ~(PLAYER_STATE1_10 | PLAYER_STATE1_11); this->actor.colChkInfo.damage = 0; func_80837C0C(globalCtx, this, 3, 0.0f, 0.0f, 0, 20);