From 40d3802c3fd5657a5585ca97202188a75e1f5ee9 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Sun, 29 May 2022 13:17:38 -0400 Subject: [PATCH] Replaces magic numbers with constants defined in z_en_tk.h --- soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c | 11 ++++++----- soh/src/overlays/actors/ovl_En_Tk/z_en_tk.h | 4 ++++ 2 files changed, 10 insertions(+), 5 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 c2d1aeee8..1493b55fc 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 @@ -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); } } diff --git a/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.h b/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.h index cf871ce3b..b8c887ab9 100644 --- a/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.h +++ b/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.h @@ -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"