mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-03-03 18:21:55 -05:00
Gravedigging tour fix (#388)
* Fixes the Gravedigging Tour heartpiece bug. Basically just causes Dampe's Gravedigging Tour Heart Piece to set a Collect flag on the Graveyard Scene when collected instead of a GetItemInf flag when it's spawned. I did this by simply the result of Item_DropCollectible to a variable called reward and running reward->collectibleFlag = 0x19 if the reward was a heartpiece. There may be a better way to do this. This is unlike most of the other dropped items with collectible flags in the game, which have some binary operations performed on the item to be dropped before passing it into Item_DropCollectible. See z_en_geldb.c and z_bg_haka_tubo.c for examples of this. I tried to find some way to do something more like that here but I was unable to wrap my head around the binary operations being performed. I may revisit this in the future. * Reimplements vanilla bug, adds cvar and checkbox for the fix. * Adds some newlines to the Tooltip * Shortens ImGui tooltip. * Removes the hardcoded Purple Rupee/Heart Piece reward. * Sets collectibleFlag whether cvar is on or not to prevent duping. * Sets Gravedigging Tour Fix to enabled by default * Simplifies logic for whether or not to spawn heart piece * Adds TempClear flag set and check for heart piece. This originally introduced a bug where the player could spawn multiple heart pieces by simply not collecting the one that spawns and continuing to dig up spots. This fixes that by checking a temp clear flag before spawning the heart piece and setting it when the heart piece spawns. Since this is a temp clear flag it will not stay set if the player exits the scene, so this still does fix the bug of locking the player out of the heart piece when spawning it and leaving without picking it up. As far as I can tell this temp clear flag isn't used anywhere else in this scene. The only one used in this scene I could find is that killing the first Poe in this scene sets flag 0x02 (or maybe it's 0x01, not sure if the flags start at 1 or 0). * Replaces magic numbers with constants defined in z_en_tk.h * Updates comment explaining changed code. * Replaces another magic number I forgot to replace last commit. * Replaces TempClear flag with local variable * Removes TempClearFlag const and moves others out of .h to .c (felt like they made more sense there)
This commit is contained in:
parent
1f1b81ab40
commit
bf0935a5a2
@ -940,6 +940,8 @@ namespace SohImGui {
|
|||||||
Tooltip("Show dungeon entrances icon only when it should be");
|
Tooltip("Show dungeon entrances icon only when it should be");
|
||||||
EnhancementCheckbox("Fix Two Handed idle animations", "gTwoHandedIdle");
|
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");
|
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 bug where you can permanently miss the Gravedigging Tour Heart Piece");
|
||||||
EnhancementCheckbox("Fix Deku Nut upgrade", "gDekuNutUpgradeFix");
|
EnhancementCheckbox("Fix Deku Nut upgrade", "gDekuNutUpgradeFix");
|
||||||
Tooltip("Prevents the Forest Stage Deku Nut upgrade from becoming unobtainable after receiving the Poacher's Saw");
|
Tooltip("Prevents the Forest Stage Deku Nut upgrade from becoming unobtainable after receiving the Poacher's Saw");
|
||||||
EnhancementCheckbox("Fix Navi text HUD position", "gNaviTextFix");
|
EnhancementCheckbox("Fix Navi text HUD position", "gNaviTextFix");
|
||||||
|
@ -35,6 +35,7 @@ void BootCommands_Init()
|
|||||||
CVar_RegisterS32("gNewDrops", 0);
|
CVar_RegisterS32("gNewDrops", 0);
|
||||||
CVar_RegisterS32("gVisualAgony", 0);
|
CVar_RegisterS32("gVisualAgony", 0);
|
||||||
CVar_RegisterS32("gLanguages", 0); //0 = English / 1 = German / 2 = French
|
CVar_RegisterS32("gLanguages", 0); //0 = English / 1 = German / 2 = French
|
||||||
|
CVar_RegisterS32("gGravediggingTourFix", 1);
|
||||||
CVar_RegisterS32("gHudColors", 1); //0 = N64 / 1 = NGC / 2 = Custom
|
CVar_RegisterS32("gHudColors", 1); //0 = N64 / 1 = NGC / 2 = Custom
|
||||||
CVar_RegisterS32("gUseNaviCol", 0);
|
CVar_RegisterS32("gUseNaviCol", 0);
|
||||||
CVar_RegisterS32("gUseTunicsCol", 0);
|
CVar_RegisterS32("gUseTunicsCol", 0);
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
#include "objects/object_tk/object_tk.h"
|
#include "objects/object_tk/object_tk.h"
|
||||||
|
|
||||||
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3)
|
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3)
|
||||||
|
#define COLLECTFLAG_GRAVEDIGGING_HEART_PIECE 0x19
|
||||||
|
#define ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE 0x1000
|
||||||
|
|
||||||
|
bool heartPieceSpawned;
|
||||||
|
|
||||||
void EnTk_Init(Actor* thisx, GlobalContext* globalCtx);
|
void EnTk_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||||
void EnTk_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
void EnTk_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||||
@ -505,6 +509,7 @@ void EnTk_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||||||
this->currentReward = -1;
|
this->currentReward = -1;
|
||||||
this->currentSpot = NULL;
|
this->currentSpot = NULL;
|
||||||
this->actionFunc = EnTk_Rest;
|
this->actionFunc = EnTk_Rest;
|
||||||
|
heartPieceSpawned = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnTk_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
void EnTk_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||||
@ -611,13 +616,23 @@ void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) {
|
|||||||
* Upgrade the purple rupee reward to the heart piece if this
|
* Upgrade the purple rupee reward to the heart piece if this
|
||||||
* is the first grand prize dig.
|
* is the first grand prize dig.
|
||||||
*/
|
*/
|
||||||
if (!(gSaveContext.itemGetInf[1] & 0x1000)) {
|
// If vanilla itemGetInf flag is not set, it's impossible for the new flag to be set, so return true.
|
||||||
gSaveContext.itemGetInf[1] |= 0x1000;
|
// 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 (!heartPieceSpawned &&
|
||||||
|
(!(gSaveContext.itemGetInf[1] & ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE) ||
|
||||||
|
CVar_GetS32("gGravediggingTourFix", 0) &&
|
||||||
|
!Flags_GetCollectible(globalCtx, COLLECTFLAG_GRAVEDIGGING_HEART_PIECE))) {
|
||||||
this->currentReward = 4;
|
this->currentReward = 4;
|
||||||
|
gSaveContext.itemGetInf[1] |= ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE;
|
||||||
|
heartPieceSpawned = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item_DropCollectible(globalCtx, &rewardPos, rewardParams[this->currentReward]);
|
EnItem00* reward = Item_DropCollectible(globalCtx, &rewardPos, rewardParams[this->currentReward]);
|
||||||
|
if (this->currentReward == 4) {
|
||||||
|
reward->collectibleFlag = COLLECTFLAG_GRAVEDIGGING_HEART_PIECE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user