Simplifies logic for whether or not to spawn heart piece

This commit is contained in:
Christopher Leggett 2022-05-29 12:17:38 -04:00
commit ead13423b3
No known key found for this signature in database
GPG key ID: 7093AE5FF7037D79

View file

@ -606,17 +606,17 @@ void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) {
rewardPos.z += this->actor.world.pos.z;
this->currentReward = EnTk_ChooseReward(this);
this->currentReward = 3;
if (this->currentReward == 3) {
/*
* Upgrade the purple rupee reward to the heart piece if this
* is the first grand prize dig.
*/
// Initialized with bugfixed condition, overriden with original check if bugfix cvar is 0 (which is default).
bool condition = Flags_GetCollectible(globalCtx, 0x19) == 0;
if (CVar_GetS32("gGravediggingTourFix", 0) == 0) {
condition = !(gSaveContext.itemGetInf[1] & 0x1000);
}
if (condition) {
// If vanilla itemGetInf flag is not set, it's impossible for the new flag to be set, so return true.
// Otherwise if the gGravediggingTourFix is enabled and the new flag hasn't been set, return true.
// If true, spawn the heart piece isntead of the purple rupee and set the vanilla itemGetInf flag.
if (!(gSaveContext.itemGetInf[1] & 0x1000)
|| CVar_GetS32("gGravediggingTourFix", 0) && !Flags_GetCollectible(globalCtx, 0x19)) {
this->currentReward = 4;
gSaveContext.itemGetInf[1] |= 0x1000;
}