Use VB hook to fix Deku Nut upgrade bug (#5047)

* Use VB hook to fix Deku Nut upgrade bug

* Use constexpr, remove unused extern

* Separate IS_RANDO out of value macro

* Restore mask check in hook

* Call VB hook in SkipMiscInteractions hook

* Mask of Truth hook not registered in rando
This commit is contained in:
Jordan Longstaff
2025-02-19 20:22:56 -05:00
committed by GitHub
parent 75f33a00d8
commit b6e2a995f1
6 changed files with 71 additions and 4 deletions

View File

@@ -2442,7 +2442,7 @@ u8 Item_Give(PlayState* play, u8 item) {
}
return Return_Item(item, MOD_NONE, ITEM_NONE);
} else if ((item >= ITEM_WEIRD_EGG) && (item <= ITEM_CLAIM_CHECK)) {
if ((item == ITEM_SAW) && CVarGetInteger(CVAR_ENHANCEMENT("DekuNutUpgradeFix"), 0) == 0) {
if (GameInteractor_Should(VB_POACHERS_SAW_SET_DEKU_NUT_UPGRADE_FLAG, item == ITEM_SAW)) {
Flags_SetItemGetInf(ITEMGETINF_OBTAINED_NUT_UPGRADE_FROM_STAGE);
}

View File

@@ -10,6 +10,7 @@
#include "overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h"
#include "vt.h"
#include "soh/OTRGlobals.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#define FLAGS 0
@@ -165,7 +166,9 @@ void EnDntDemo_Judge(EnDntDemo* this, PlayState* play) {
break;
}
case PLAYER_MASK_TRUTH:
if (!Flags_GetItemGetInf(ITEMGETINF_OBTAINED_NUT_UPGRADE_FROM_STAGE) && (Player_GetMask(play) != PLAYER_MASK_SKULL)) {
if (GameInteractor_Should(VB_DEKU_SCRUBS_REACT_TO_MASK_OF_TRUTH,
!Flags_GetItemGetInf(ITEMGETINF_OBTAINED_NUT_UPGRADE_FROM_STAGE) &&
(Player_GetMask(play) != PLAYER_MASK_SKULL))) {
Audio_PlaySoundGeneral(NA_SE_SY_TRE_BOX_APPEAR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultReverb);
this->prize = DNT_PRIZE_NUTS;