Collected heart pieces getting reset to "0" when picking up freestanding heart containers at 18/19 hearts
Closed this issue · 9 comments
I've found every possible heart piece and only have 19/20 heart containers. Its only showing 1/4 heart pieces on the Quest Status screen. Did my seed glitch up and not give me 3 heart pieces? Why is the happening? I've gotten them from every possible location.
I remember seeing someone else mention a similar issue. It seems like when you have 18 heart containers and some number of pieces, finding the last heart container erases your current pieces of hearts down to 0
I remember seeing someone else mention a similar issue. It seems like when you have 18 heart containers and some number of pieces, finding the last heart container erases your current pieces of hearts down to 0
I hope this is fixed soon! Never used to have this issue with Potsanity. If randomizing Silver Rupees or the Treasure Shop Keys is causing this, then it needs to be fixed in the next update. Sounds like some kind of flag ID or hex error! Shouldn't be happening. Never had this issue, so why is it even happening in the first place? Something must've went wrong.
This is likely a bug in the code intended to prevent the player from having extra heart pieces at 20 hearts:
OoT-Randomizer/ASM/c/item_effects.c
Lines 218 to 222 in f3dad2b
My guess is that the order of the vanilla effect and the randomizer-added effect is different for different item locations, and @Cuphat didn't notice that when developing #1518. If anyone would like to test this hypothesis, you can do so by picking up a heart container from different location types (e.g. chests, shops, pots) while at 18 hearts and 1 heart piece, and checking whether you're at 19 hearts and 1 heart piece or just 19 hearts.
I tested a fix for this by changing the function above to >=20 and it appears to be functioning as intended now. I'll PR the fix shortly.
https://drive.google.com/file/d/1dDbmapi0tYDyGdoJnGp7Md0iRinVy8vv/view?usp=sharing
I ended up closing out my fix. I should have tested the current case first, and it doesn't happen w/ chests like I assumed it would
I did some testing on it. It seems to happen when you pick up heart container number 19 when its either a freestanding or in a pot (i assume also in a crate but I didn't test that directly). Getting from a chest or in a shop works fine currently.
https://drive.google.com/file/d/1b9rjPgreWR7jSsbPx2u6DBzqRrTaLfWz/view?usp=sharing
I am unsure whether to blame randomizer hooks or OoT in general but this game is dumb.
Easy fix for this specific case should be to move the effects of clear_excess_hearts
into an item upgrade function instead of an item effects function to ensure the code is ran before the actual hearts are added.
Looking through the code a bit more, it seems that dispatch_item
, which is used by pot/crate/freestanding/etc as well as gold skulltula locations, first calls z64_GiveItem
and then call_effect_function
, while try_pending_item
necessarily has to work the other way around. So the best fix for this is probably to standardize on “effect first” by changing the order of calls in dispatch_item
.