Replaces magic numbers with constants defined in z_en_tk.h

This commit is contained in:
Christopher Leggett 2022-05-29 13:17:38 -04:00
commit 40d3802c3f
No known key found for this signature in database
GPG key ID: 7093AE5FF7037D79
2 changed files with 10 additions and 5 deletions

View file

@ -614,12 +614,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 isntead of the purple rupee and set the vanilla itemGetInf flag.
if (!Flags_GetTempClear(globalCtx, 0x1f) &&
(!(gSaveContext.itemGetInf[1] & 0x1000) ||
CVar_GetS32("gGravediggingTourFix", 0) && !Flags_GetCollectible(globalCtx, 0x19))) {
if (!Flags_GetTempClear(globalCtx, TEMPCLEARFLAG_GRAVEDIGGING_HEART_PIECE) &&
(!(gSaveContext.itemGetInf[1] & ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE) ||
CVar_GetS32("gGravediggingTourFix", 0) &&
!Flags_GetCollectible(globalCtx, COLLECTFLAG_GRAVEDIGGING_HEART_PIECE))) {
this->currentReward = 4;
gSaveContext.itemGetInf[1] |= 0x1000;
Flags_SetTempClear(globalCtx, 0x1f);
gSaveContext.itemGetInf[1] |= ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE;
Flags_SetTempClear(globalCtx, TEMPCLEARFLAG_GRAVEDIGGING_HEART_PIECE);
}
}

View file

@ -1,6 +1,10 @@
#ifndef Z_EN_TK_H
#define Z_EN_TK_H
#define COLLECTFLAG_GRAVEDIGGING_HEART_PIECE 0x19
#define TEMPCLEARFLAG_GRAVEDIGGING_HEART_PIECE 0x1f
#define ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE 0x1000
#include "ultra64.h"
#include "global.h"