From 4a3d60d0616ec2fe99d4c864137222831aad7db9 Mon Sep 17 00:00:00 2001 From: Eric Hoey <121978037+A-Green-Spoon@users.noreply.github.com> Date: Tue, 8 Apr 2025 11:27:08 -0400 Subject: [PATCH] Fix Rando Give for Adult Fishing as Child Glitch (#5349) * VBVBVB * Update soh/soh/Enhancements/randomizer/hook_handlers.cpp * Update soh/soh/Enhancements/randomizer/hook_handlers.cpp * first try --- .../vanilla-behavior/GIVanillaBehavior.h | 8 ++++++++ soh/soh/Enhancements/randomizer/hook_handlers.cpp | 11 +++++++++++ soh/src/overlays/actors/ovl_Fishing/z_fishing.c | 4 +++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h index 1c516fc6e..6c18a6edb 100644 --- a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h +++ b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h @@ -946,6 +946,14 @@ typedef enum { // - `*VBFishingData` VB_GIVE_RANDO_FISHING_PRIZE, + // #### `result` + // ```c + // false + // ``` + // #### `args` + // - '*Fishing' (&this) + VB_GIVE_RANDO_GLITCH_FISHING_PRIZE, + // #### `result` // ```c // true diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index 4c96d839d..a10e8b67f 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -1591,6 +1591,17 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l } break; } + case VB_GIVE_RANDO_GLITCH_FISHING_PRIZE: { + if (IS_RANDO) { + Fishing* fishing = va_arg(args, Fishing*); + if (!Flags_GetRandomizerInf(RAND_INF_ADULT_FISHING)) { + Flags_SetRandomizerInf(RAND_INF_ADULT_FISHING); + } + *should = true; + fishing->stateAndTimer = 0; + } + break; + } case VB_TRADE_TIMER_EYEDROPS: { EnMk* enMk = va_arg(args, EnMk*); Flags_SetRandomizerInf(RAND_INF_ADULT_TRADES_LH_TRADE_FROG); diff --git a/soh/src/overlays/actors/ovl_Fishing/z_fishing.c b/soh/src/overlays/actors/ovl_Fishing/z_fishing.c index 3c2028ce0..94d7e15ca 100644 --- a/soh/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/soh/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -5170,7 +5170,9 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->stateAndTimer = 24; } else { - Actor_OfferGetItem(&this->actor, play, GI_SCALE_GOLDEN, 2000.0f, 1000.0f); + if (!GameInteractor_Should(VB_GIVE_RANDO_GLITCH_FISHING_PRIZE, false, &this)) { + Actor_OfferGetItem(&this->actor, play, GI_SCALE_GOLDEN, 2000.0f, 1000.0f); + } } break;