Replaces TempClear flag with local variable

This commit is contained in:
Christopher Leggett 2022-05-29 16:46:59 -04:00
commit f18a31b974
No known key found for this signature in database
GPG key ID: 7093AE5FF7037D79

View file

@ -10,6 +10,8 @@
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3)
bool heartPieceSpawned;
void EnTk_Init(Actor* thisx, GlobalContext* globalCtx);
void EnTk_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnTk_Update(Actor* thisx, GlobalContext* globalCtx);
@ -505,6 +507,7 @@ void EnTk_Init(Actor* thisx, GlobalContext* globalCtx) {
this->currentReward = -1;
this->currentSpot = NULL;
this->actionFunc = EnTk_Rest;
heartPieceSpawned = false;
}
void EnTk_Destroy(Actor* thisx, GlobalContext* globalCtx) {
@ -614,13 +617,13 @@ void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) {
// 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 and set the vanilla itemGetInf flag and new temp clear flag.
if (!Flags_GetTempClear(globalCtx, TEMPCLEARFLAG_GRAVEDIGGING_HEART_PIECE) &&
if (!heartPieceSpawned &&
(!(gSaveContext.itemGetInf[1] & ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE) ||
CVar_GetS32("gGravediggingTourFix", 0) &&
!Flags_GetCollectible(globalCtx, COLLECTFLAG_GRAVEDIGGING_HEART_PIECE))) {
this->currentReward = 4;
gSaveContext.itemGetInf[1] |= ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE;
Flags_SetTempClear(globalCtx, TEMPCLEARFLAG_GRAVEDIGGING_HEART_PIECE);
heartPieceSpawned = true;
}
}