diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index d17d6ccee..d4dcf4f31 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -705,6 +705,8 @@ namespace SohImGui { Tooltip("Show dungeon entrances icon only when it should be"); EnhancementCheckbox("Fix Two Handed idle animations", "gTwoHandedIdle"); Tooltip("Makes two handed idle animation play, a seemingly finished animation that was disabled on accident in the original game"); + EnhancementCheckbox("Fix the Gravedigging Tour Glitch", "gGravediggingTourFix"); + Tooltip("Fixes a vanilla bug where you can permanently miss the Gravedigging Tour Heart Piece in Kakariko Graveyard if you spawn the Heart Piece and leave without picking it up"); ImGui::EndMenu(); } diff --git a/soh/soh/Enhancements/bootcommands.c b/soh/soh/Enhancements/bootcommands.c index 71bd00cac..ac39b864e 100644 --- a/soh/soh/Enhancements/bootcommands.c +++ b/soh/soh/Enhancements/bootcommands.c @@ -31,6 +31,7 @@ void BootCommands_Init() CVar_RegisterS32("gNewDrops", 0); CVar_RegisterS32("gVisualAgony", 0); CVar_RegisterS32("gLanguages", 0); //0 = English / 1 = German / 2 = French + CVar_RegisterS32("gGravediggingTourFix", 0); } //void BootCommands_ParseBootArgs(char* str) 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 649a23b5d..2edd983c6 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 @@ -606,21 +606,28 @@ void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) { rewardPos.z += this->actor.world.pos.z; this->currentReward = EnTk_ChooseReward(this); - s32 collectibleParams = rewardParams[this->currentReward]; + this->currentReward = 3; if (this->currentReward == 3) { /* * Upgrade the purple rupee reward to the heart piece if this * is the first grand prize dig. */ - if (Flags_GetCollectible(globalCtx, 0x19) == 0) { + // 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) { this->currentReward = 4; - collectibleParams = ITEM00_HEART_PIECE; + gSaveContext.itemGetInf[1] |= 0x1000; } } - EnItem00* reward = Item_DropCollectible(globalCtx, &rewardPos, collectibleParams); + EnItem00* reward = Item_DropCollectible(globalCtx, &rewardPos, rewardParams[this->currentReward]); if (this->currentReward == 4) { - reward->collectibleFlag = 0x19; + if (CVar_GetS32("gGravediggingTourFix", 0) != 0) { + reward->collectibleFlag = 0x19; + } } } }