From 70e2067fa24276af947c6c7d29f80c1dc85671b9 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Thu, 19 May 2022 21:43:45 -0400 Subject: [PATCH] Fixes the Gravedigging Tour heartpiece bug. Basically just causes Dampe's Gravedigging Tour Heart Piece to set a Collect flag on the Graveyard Scene when collected instead of a GetItemInf flag when it's spawned. I did this by simply the result of Item_DropCollectible to a variable called reward and running reward->collectibleFlag = 0x19 if the reward was a heartpiece. There may be a better way to do this. This is unlike most of the other dropped items with collectible flags in the game, which have some binary operations performed on the item to be dropped before passing it into Item_DropCollectible. See z_en_geldb.c and z_bg_haka_tubo.c for examples of this. I tried to find some way to do something more like that here but I was unable to wrap my head around the binary operations being performed. I may revisit this in the future. --- soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 1559b188c..649a23b5d 100644 --- a/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -606,18 +606,22 @@ void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) { rewardPos.z += this->actor.world.pos.z; this->currentReward = EnTk_ChooseReward(this); + s32 collectibleParams = rewardParams[this->currentReward]; if (this->currentReward == 3) { /* * Upgrade the purple rupee reward to the heart piece if this * is the first grand prize dig. */ - if (!(gSaveContext.itemGetInf[1] & 0x1000)) { - gSaveContext.itemGetInf[1] |= 0x1000; + if (Flags_GetCollectible(globalCtx, 0x19) == 0) { this->currentReward = 4; + collectibleParams = ITEM00_HEART_PIECE; } } - Item_DropCollectible(globalCtx, &rewardPos, rewardParams[this->currentReward]); + EnItem00* reward = Item_DropCollectible(globalCtx, &rewardPos, collectibleParams); + if (this->currentReward == 4) { + reward->collectibleFlag = 0x19; + } } }