From bd142a0eed69c440dec1c6ce97eb9706e2938248 Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Sat, 5 Oct 2024 21:32:06 +0100 Subject: [PATCH] Fix duplicate fishing checks and a crash with fishing rod hint (#4288) * actor breaking * should be VB fishing * attempt to VB fisherman * commit fishing hell for review of VB viability, untested * fix rando, vanilla still broken. close enough * wait i forgot to remove that * small fix --- soh/include/z64item.h | 2 +- .../custom-message/CustomMessageTypes.h | 1 + .../game-interactor/GameInteractor.h | 9 ++ .../Enhancements/randomizer/hook_handlers.cpp | 63 +++++++++ soh/soh/Enhancements/randomizer/item_list.cpp | 2 +- soh/soh/Enhancements/randomizer/settings.cpp | 6 +- soh/soh/OTRGlobals.cpp | 4 +- .../overlays/actors/ovl_Fishing/z_fishing.c | 133 ++++++++---------- .../overlays/actors/ovl_Fishing/z_fishing.h | 9 ++ .../ovl_Item_Etcetera/z_item_etcetera.c | 2 +- 10 files changed, 151 insertions(+), 80 deletions(-) diff --git a/soh/include/z64item.h b/soh/include/z64item.h index ceba11d09..214d82711 100644 --- a/soh/include/z64item.h +++ b/soh/include/z64item.h @@ -387,7 +387,7 @@ typedef enum { /* 0x35 */ GI_GAUNTLETS_SILVER, /* 0x36 */ GI_GAUNTLETS_GOLD, /* 0x37 */ GI_SCALE_SILVER, - /* 0x38 */ GI_SCALE_GOLD, + /* 0x38 */ GI_SCALE_GOLDEN, /* 0x39 */ GI_STONE_OF_AGONY, /* 0x3A */ GI_GERUDO_CARD, /* 0x3B */ GI_OCARINA_FAIRY, // uses Ocarina of Time message ID diff --git a/soh/soh/Enhancements/custom-message/CustomMessageTypes.h b/soh/soh/Enhancements/custom-message/CustomMessageTypes.h index 5471a4886..fa8a4bb8a 100644 --- a/soh/soh/Enhancements/custom-message/CustomMessageTypes.h +++ b/soh/soh/Enhancements/custom-message/CustomMessageTypes.h @@ -146,6 +146,7 @@ typedef enum { TEXT_FISHING_DIFFERENT_POND = 0x4094, TEXT_FISHING_SCRATCHING = 0x4095, TEXT_FISHING_CLOUDY = 0x4096, + TEXT_FISHING_RELEASE_THIS_ONE = 0x409C, TEXT_FISHING_TRY_ANOTHER_LURE_WITH_SINKING_LURE = 0x40AF, TEXT_DAMPES_DIARY = 0x5003, TEXT_GRANNYS_SHOP = 0x500C, diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.h b/soh/soh/Enhancements/game-interactor/GameInteractor.h index 70fd70267..5f8a10d8e 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.h @@ -291,6 +291,15 @@ typedef enum { VB_PLAY_RAINBOW_BRIDGE_CS, // Opt: *EnBox VB_PLAY_SLOW_CHEST_CS, + //*Opt f32 sFishOnHandLength + // Vanilla condition: (s16)sFishingRecordLength < (s16)sFishOnHandLength + VB_SHOULD_CHECK_FOR_FISHING_RECORD, + //*Opt f32 sFishOnHandLength + // Vanilla condition is implied from previous code that could be bypassed by above hook + VB_SHOULD_SET_FISHING_RECORD, + //*Opt *s32 getItemId + VB_SHOULD_GIVE_VANILLA_FISHING_PRIZE, + VB_GIVE_RANDO_FISHING_PRIZE, VB_PLAY_THROW_ANIMATION, /*** Give Items ***/ diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index 75e9dd290..8c86af5ef 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -35,6 +35,7 @@ extern "C" { #include "src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h" #include "src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h" #include "src/overlays/actors/ovl_En_Ge1/z_en_ge1.h" +#include "src/overlays/actors/ovl_Fishing/z_fishing.h" #include "adult_trade_shuffle.h" #include "draw.h" @@ -582,6 +583,22 @@ void func_8083A434_override(PlayState* play, Player* player) { player->stateFlags1 |= PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_IN_CUTSCENE; } + +bool ShouldGiveFishingPrize(f32 sFishOnHandLength){ + // RANDOTODO: update the enhancement sliders to not allow + // values above rando fish weight values when rando'd + if(LINK_IS_CHILD) { + int32_t weight = CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFishing"), 0) ? CVarGetInteger(CVAR_ENHANCEMENT("MinimumFishWeightChild"), 10) : 10; + f32 score = sqrt(((f32)weight - 0.5f) / 0.0036f); + return sFishOnHandLength >= score && (IS_RANDO ? !Flags_GetRandomizerInf(RAND_INF_CHILD_FISHING) : !(HIGH_SCORE(HS_FISHING) & HS_FISH_PRIZE_CHILD)); + } else + { + int32_t weight = CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFishing"), 0) ? CVarGetInteger(CVAR_ENHANCEMENT("MinimumFishWeightAdult"), 13) : 13; + f32 score = sqrt(((f32)weight - 0.5f) / 0.0036f); + return sFishOnHandLength >= score && (IS_RANDO ? !Flags_GetRandomizerInf(RAND_INF_ADULT_FISHING) : !(HIGH_SCORE(HS_FISHING) & HS_FISH_PRIZE_ADULT)); + } +} + void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* optionalArg) { switch (id) { case VB_PLAY_SLOW_CHEST_CS: { @@ -1162,6 +1179,52 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void } break; } + case VB_SHOULD_CHECK_FOR_FISHING_RECORD: { + f32 sFishOnHandLength = *static_cast(optionalArg); + *should = *should || ShouldGiveFishingPrize(sFishOnHandLength); + break; + } + case VB_SHOULD_SET_FISHING_RECORD: { + VBFishingData* fishData = static_cast(optionalArg); + *should = (s16)fishData->sFishingRecordLength < (s16)fishData->fishWeight; + if (!*should){ + *fishData->sFishOnHandLength = 0.0f; + } + break; + } + case VB_SHOULD_GIVE_VANILLA_FISHING_PRIZE: { + VBFishingData* fishData = static_cast(optionalArg); + *should = !IS_RANDO && ShouldGiveFishingPrize(fishData->fishWeight); + break; + } + case VB_GIVE_RANDO_FISHING_PRIZE: { + if (IS_RANDO){ + VBFishingData* fishData = static_cast(optionalArg); + if (*fishData->sFishOnHandIsLoach) { + if (!Flags_GetRandomizerInf(RAND_INF_CAUGHT_LOACH) && + OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_FISHSANITY) == RO_FISHSANITY_HYRULE_LOACH){ + Flags_SetRandomizerInf(RAND_INF_CAUGHT_LOACH); + Message_StartTextbox(gPlayState, TEXT_FISHING_RELEASE_THIS_ONE, NULL); + *should = true; + fishData->actor->stateAndTimer = 20; + } + } else { + if (ShouldGiveFishingPrize(fishData->fishWeight)){ + if (LINK_IS_CHILD){ + Flags_SetRandomizerInf(RAND_INF_CHILD_FISHING); + HIGH_SCORE(HS_FISHING) |= HS_FISH_PRIZE_CHILD; + } else { + Flags_SetRandomizerInf(RAND_INF_ADULT_FISHING); + HIGH_SCORE(HS_FISHING) |= HS_FISH_PRIZE_ADULT; + } + *should = true; + *fishData->sSinkingLureLocation = (u8)Rand_ZeroFloat(3.999f) + 1; + fishData->actor->stateAndTimer = 0; + } + } + } + break; + } case VB_TRADE_TIMER_ODD_MUSHROOM: case VB_TRADE_TIMER_EYEDROPS: case VB_TRADE_TIMER_FROG: diff --git a/soh/soh/Enhancements/randomizer/item_list.cpp b/soh/soh/Enhancements/randomizer/item_list.cpp index 6b7b8a5e1..458144411 100644 --- a/soh/soh/Enhancements/randomizer/item_list.cpp +++ b/soh/soh/Enhancements/randomizer/item_list.cpp @@ -324,7 +324,7 @@ void Rando::StaticData::InitItemTable() { itemTable[RG_SILVER_GAUNTLETS] = Item(RG_SILVER_GAUNTLETS, Text{ "Silver Gauntlets", "Gantelets d'argent", "Silberhandschuhe" }, ITEMTYPE_ITEM, GI_GAUNTLETS_SILVER, true, LOGIC_PROGRESSIVE_STRENGTH, RHT_SILVER_GAUNTLETS, ITEM_GAUNTLETS_SILVER, OBJECT_GI_GLOVES, GID_GAUNTLETS_SILVER, 0x5B, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_NONE); itemTable[RG_GOLDEN_GAUNTLETS] = Item(RG_GOLDEN_GAUNTLETS, Text{ "Golden Gauntlets", "Gantelets d'or", "Goldhandschuhe" }, ITEMTYPE_ITEM, GI_GAUNTLETS_GOLD, true, LOGIC_PROGRESSIVE_STRENGTH, RHT_GOLDEN_GAUNTLETS, ITEM_GAUNTLETS_GOLD, OBJECT_GI_GLOVES, GID_GAUNTLETS_GOLD, 0x5C, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_NONE); itemTable[RG_SILVER_SCALE] = Item(RG_SILVER_SCALE, Text{ "Silver Scale", "Écaille d'argent", "Silberne Schuppe" }, ITEMTYPE_ITEM, GI_SCALE_SILVER, true, LOGIC_PROGRESSIVE_SCALE, RHT_SILVER_SCALE, ITEM_SCALE_SILVER, OBJECT_GI_SCALE, GID_SCALE_SILVER, 0xCD, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_NONE); - itemTable[RG_GOLDEN_SCALE] = Item(RG_GOLDEN_SCALE, Text{ "Golden Scale", "Écaille d'or", "Goldene Schuppe" }, ITEMTYPE_ITEM, GI_SCALE_GOLD, true, LOGIC_PROGRESSIVE_SCALE, RHT_GOLDEN_SCALE, ITEM_SCALE_GOLDEN, OBJECT_GI_SCALE, GID_SCALE_GOLDEN, 0xCE, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_NONE); + itemTable[RG_GOLDEN_SCALE] = Item(RG_GOLDEN_SCALE, Text{ "Golden Scale", "Écaille d'or", "Goldene Schuppe" }, ITEMTYPE_ITEM, GI_SCALE_GOLDEN, true, LOGIC_PROGRESSIVE_SCALE, RHT_GOLDEN_SCALE, ITEM_SCALE_GOLDEN, OBJECT_GI_SCALE, GID_SCALE_GOLDEN, 0xCE, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_NONE); itemTable[RG_ADULT_WALLET] = Item(RG_ADULT_WALLET, Text{ "Adult Wallet", "Grande Bourse", "Erwachsenengeldbörse" }, ITEMTYPE_ITEM, GI_WALLET_ADULT, true, LOGIC_PROGRESSIVE_WALLET, RHT_ADULT_WALLET, ITEM_WALLET_ADULT, OBJECT_GI_PURSE, GID_WALLET_ADULT, 0x5E, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_NONE); itemTable[RG_GIANT_WALLET] = Item(RG_GIANT_WALLET, Text{ "Giant Wallet", "Bourse de Géant", "Riesige Geldbörse" }, ITEMTYPE_ITEM, GI_WALLET_GIANT, true, LOGIC_PROGRESSIVE_WALLET, RHT_GIANT_WALLET, ITEM_WALLET_GIANT, OBJECT_GI_PURSE, GID_WALLET_GIANT, 0x5F, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_NONE); itemTable[RG_TYCOON_WALLET] = Item(RG_TYCOON_WALLET, Text{ "Tycoon Wallet", "Bourse de Magnat", "Goldene Geldbörse" }, ITEMTYPE_ITEM, RG_TYCOON_WALLET, true, LOGIC_PROGRESSIVE_WALLET, RHT_TYCOON_WALLET, RG_TYCOON_WALLET, OBJECT_GI_PURSE, GID_WALLET_GIANT, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_LESSER, MOD_RANDOMIZER); diff --git a/soh/soh/Enhancements/randomizer/settings.cpp b/soh/soh/Enhancements/randomizer/settings.cpp index 4ecdd5b18..b43d75301 100644 --- a/soh/soh/Enhancements/randomizer/settings.cpp +++ b/soh/soh/Enhancements/randomizer/settings.cpp @@ -2163,8 +2163,12 @@ void Settings::FinalizeSettings(const std::set& excludedLocatio mOptions[RSK_KAK_100_SKULLS_HINT].SetSelectedIndex(RO_GENERIC_OFF); } + if (!mOptions[RSK_SHUFFLE_FISHING_POLE]) { + mOptions[RSK_FISHING_POLE_HINT].SetSelectedIndex(RO_GENERIC_OFF); + } + if (mOptions[RSK_FISHSANITY].IsNot(RO_FISHSANITY_HYRULE_LOACH)) { - mOptions[RSK_LOACH_HINT].SetSelectedIndex(RO_FISHSANITY_OFF); + mOptions[RSK_LOACH_HINT].SetSelectedIndex(RO_GENERIC_OFF); } if (mOptions[RSK_CUCCO_COUNT].Is(0)) { diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index fee872f93..f99152f16 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -633,7 +633,7 @@ extern "C" void VanillaItemTable_Init() { GET_ITEM(ITEM_GAUNTLETS_SILVER, OBJECT_GI_GLOVES, GID_GAUNTLETS_SILVER, 0x5B, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_NONE, GI_GAUNTLETS_SILVER), GET_ITEM(ITEM_GAUNTLETS_GOLD, OBJECT_GI_GLOVES, GID_GAUNTLETS_GOLD, 0x5C, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_NONE, GI_GAUNTLETS_GOLD), GET_ITEM(ITEM_SCALE_SILVER, OBJECT_GI_SCALE, GID_SCALE_SILVER, 0xCD, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_NONE, GI_SCALE_SILVER), - GET_ITEM(ITEM_SCALE_GOLDEN, OBJECT_GI_SCALE, GID_SCALE_GOLDEN, 0xCE, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_NONE, GI_SCALE_GOLD), + GET_ITEM(ITEM_SCALE_GOLDEN, OBJECT_GI_SCALE, GID_SCALE_GOLDEN, 0xCE, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_NONE, GI_SCALE_GOLDEN), GET_ITEM(ITEM_STONE_OF_AGONY, OBJECT_GI_MAP, GID_STONE_OF_AGONY, 0x68, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_NONE, GI_STONE_OF_AGONY), GET_ITEM(ITEM_GERUDO_CARD, OBJECT_GI_GERUDO, GID_GERUDO_CARD, 0x7B, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_NONE, GI_GERUDO_CARD), GET_ITEM(ITEM_OCARINA_FAIRY, OBJECT_GI_OCARINA_0, GID_OCARINA_FAIRY, 0x4A, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_NONE, GI_OCARINA_FAIRY), @@ -817,7 +817,7 @@ std::unordered_map ItemIDtoGetItemIDMap { { ITEM_RUPEE_RED, GI_RUPEE_RED }, { ITEM_RUPEE_RED, GI_RUPEE_RED_LOSE }, { ITEM_SAW, GI_SAW }, - { ITEM_SCALE_GOLDEN, GI_SCALE_GOLD }, + { ITEM_SCALE_GOLDEN, GI_SCALE_GOLDEN }, { ITEM_SCALE_SILVER, GI_SCALE_SILVER }, { ITEM_SEEDS, GI_SEEDS_5 }, { ITEM_SEEDS_30, GI_SEEDS_30 }, diff --git a/soh/src/overlays/actors/ovl_Fishing/z_fishing.c b/soh/src/overlays/actors/ovl_Fishing/z_fishing.c index 63b66a301..6e003af21 100644 --- a/soh/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/soh/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -11,9 +11,9 @@ #include "vt.h" #include "soh/frame_interpolation.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #define FLAGS ACTOR_FLAG_UPDATE_WHILE_CULLED - #define WATER_SURFACE_Y(play) play->colCtx.colHeader->waterBoxes->ySurface bool getShouldSpawnLoaches(); @@ -4959,7 +4959,8 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) { this->stateAndTimer = 20; } else if (sFishOnHandIsLoach == 0) { sFishLengthToWeigh = sFishOnHandLength; - if ((s16)sFishingRecordLength < (s16)sFishOnHandLength) { + //if we set the record or get the reward + if (GameInteractor_Should(VB_SHOULD_CHECK_FOR_FISHING_RECORD, (s16)sFishingRecordLength < (s16)sFishOnHandLength, &sFishOnHandLength)) { if (sLureCaughtWith == FS_LURE_SINKING) { this->actor.textId = 0x40B0; } else { @@ -5028,42 +5029,54 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) { GetItemEntry getItemEntry = (GetItemEntry)GET_ITEM_NONE; Message_CloseTextbox(play); + //Declare and fill a struct for use in hooks + struct VBFishingData fishData; + fishData.actor = this; + fishData.sFishOnHandIsLoach = &sFishOnHandIsLoach; + fishData.sSinkingLureLocation = &sSinkingLureLocation; + fishData.fishWeight = sFishOnHandLength; + fishData.sFishOnHandLength = &sFishOnHandLength; + fishData.sFishingRecordLength = sFishingRecordLength; if (sFishOnHandIsLoach == 0) { - sFishingRecordLength = sFishOnHandLength; - sFishOnHandLength = 0.0f; + //if we set the record. Needed because of the wider check at VB_SHOULD_CHECK_FOR_FISHING_RECORD + //if not, reset sFishOnHandLength here as we carry it in the struct anyway + if(GameInteractor_Should(VB_SHOULD_SET_FISHING_RECORD, true, &fishData)){ + sFishingRecordLength = sFishOnHandLength; + sFishOnHandLength = 0.0f; //if skipped here, is set at the end of the function. needs to be kept for later checks - if (sLinkAge == LINK_AGE_CHILD) { - f32 temp; + if (sLinkAge == LINK_AGE_CHILD) { + f32 temp; - HIGH_SCORE(HS_FISHING) &= 0xFFFFFF00; - HIGH_SCORE(HS_FISHING) |= (s32)sFishingRecordLength & HS_FISH_LENGTH_CHILD; + HIGH_SCORE(HS_FISHING) &= 0xFFFFFF00; + HIGH_SCORE(HS_FISHING) |= (s32)sFishingRecordLength & HS_FISH_LENGTH_CHILD; - temp = (HIGH_SCORE(HS_FISHING) & HS_FISH_LENGTH_ADULT) >> 0x18; - if (temp < sFishingRecordLength) { + temp = (HIGH_SCORE(HS_FISHING) & HS_FISH_LENGTH_ADULT) >> 0x18; + if (temp < sFishingRecordLength) { + HIGH_SCORE(HS_FISHING) &= 0xFFFFFF; + HIGH_SCORE(HS_FISHING) |= ((s32)sFishingRecordLength & HS_FISH_LENGTH_CHILD) << 0x18; + + if (sLureCaughtWith == FS_LURE_SINKING) { + HIGH_SCORE(HS_FISHING) |= HS_FISH_CHEAT_ADULT; + } + } + + if (sLureCaughtWith == FS_LURE_SINKING) { + HIGH_SCORE(HS_FISHING) |= HS_FISH_CHEAT_CHILD; + this->stateAndTimer = 0; + break; + } + } else { HIGH_SCORE(HS_FISHING) &= 0xFFFFFF; HIGH_SCORE(HS_FISHING) |= ((s32)sFishingRecordLength & HS_FISH_LENGTH_CHILD) << 0x18; if (sLureCaughtWith == FS_LURE_SINKING) { HIGH_SCORE(HS_FISHING) |= HS_FISH_CHEAT_ADULT; + this->stateAndTimer = 0; + break; } } - - if (sLureCaughtWith == FS_LURE_SINKING) { - HIGH_SCORE(HS_FISHING) |= HS_FISH_CHEAT_CHILD; - this->stateAndTimer = 0; - break; - } - } else { - HIGH_SCORE(HS_FISHING) &= 0xFFFFFF; - HIGH_SCORE(HS_FISHING) |= ((s32)sFishingRecordLength & HS_FISH_LENGTH_CHILD) << 0x18; - - if (sLureCaughtWith == FS_LURE_SINKING) { - HIGH_SCORE(HS_FISHING) |= HS_FISH_CHEAT_ADULT; - this->stateAndTimer = 0; - break; - } - } + } if (sFishingRecordLength >= 60.0f) { // 13 lbs getItemId = GI_RUPEE_PURPLE; @@ -5074,58 +5087,36 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) { } else { getItemId = GI_RUPEE_GREEN; } - + if (sLinkAge == LINK_AGE_CHILD) { // 9 lbs - if ((!IS_RANDO && !(HIGH_SCORE(HS_FISHING) & HS_FISH_PRIZE_CHILD)) || - (IS_RANDO && !Flags_GetRandomizerInf(RAND_INF_CHILD_FISHING)) - ) { - if (sFishingRecordLength >= Fishing_GetMinimumRequiredScore()) { - HIGH_SCORE(HS_FISHING) |= HS_FISH_PRIZE_CHILD; - Flags_SetRandomizerInf(RAND_INF_CHILD_FISHING); - sSinkingLureLocation = (u8)Rand_ZeroFloat(3.999f) + 1; - if (!IS_RANDO) { - getItemId = GI_HEART_PIECE; - } else { - getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LH_CHILD_FISHING, GI_HEART_PIECE); - getItemId = getItemEntry.getItemId; - } - } + //if we should give the main prize AND it's not rando + if (GameInteractor_Should(VB_SHOULD_GIVE_VANILLA_FISHING_PRIZE, false, &fishData)){ + //((sFishingRecordLength >= 50.0f) && !(HIGH_SCORE(HS_FISHING) & HS_FISH_PRIZE_CHILD)) { + HIGH_SCORE(HS_FISHING) |= HS_FISH_PRIZE_CHILD; + getItemId = GI_HEART_PIECE; + sSinkingLureLocation = (u8)Rand_ZeroFloat(3.999f) + 1; } } else { // 13 lbs - if ((!IS_RANDO && !(HIGH_SCORE(HS_FISHING) & HS_FISH_PRIZE_ADULT)) || - (IS_RANDO && !Flags_GetRandomizerInf(RAND_INF_ADULT_FISHING)) - ) { - if (sFishingRecordLength >= Fishing_GetMinimumRequiredScore()) { - HIGH_SCORE(HS_FISHING) |= HS_FISH_PRIZE_ADULT; - Flags_SetRandomizerInf(RAND_INF_ADULT_FISHING); - sSinkingLureLocation = (u8)Rand_ZeroFloat(3.999f) + 1; - if (!IS_RANDO) { - getItemId = GI_SCALE_GOLD; - } else { - getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LH_ADULT_FISHING, GI_SCALE_GOLD); - getItemId = getItemEntry.getItemId; - } - } + //if we should give the main prize AND it's not rando + if (GameInteractor_Should(VB_SHOULD_GIVE_VANILLA_FISHING_PRIZE, false, &fishData)){ + //(sFishingRecordLength >= 60.0f) && !(HIGH_SCORE(HS_FISHING) & HS_FISH_PRIZE_ADULT)) { + HIGH_SCORE(HS_FISHING) |= HS_FISH_PRIZE_ADULT; + getItemId = GI_SCALE_GOLDEN; + sSinkingLureLocation = (u8)Rand_ZeroFloat(3.999f) + 1; } } } else { - if (IS_RANDO && !Flags_GetRandomizerInf(RAND_INF_CAUGHT_LOACH)) { - Flags_SetRandomizerInf(RAND_INF_CAUGHT_LOACH); - getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LH_HYRULE_LOACH, GI_RUPEE_PURPLE); - getItemId = getItemEntry.getItemId; - } else { - getItemId = GI_RUPEE_PURPLE; - } + getItemId = GI_RUPEE_PURPLE; sFishOnHandLength = 0.0f; // doesn't record loach } this->actor.parent = NULL; - if (!IS_RANDO || getItemEntry.getItemId == GI_NONE) { + + //if we should give the check in rando + if (!GameInteractor_Should(VB_GIVE_RANDO_FISHING_PRIZE, false, &fishData)){ Actor_OfferGetItem(&this->actor, play, getItemId, 2000.0f, 1000.0f); - } else { - GiveItemEntryFromActor(&this->actor, play, getItemEntry, 2000.0f, 1000.0f); + this->stateAndTimer = 23; } - this->stateAndTimer = 23; } break; @@ -5175,19 +5166,13 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->stateAndTimer = 24; } else { - if (!IS_RANDO) { - Actor_OfferGetItem(&this->actor, play, GI_SCALE_GOLD, 2000.0f, 1000.0f); - } else { - GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LH_ADULT_FISHING, GI_SCALE_GOLD); - GiveItemEntryFromActor(&this->actor, play, getItemEntry, 2000.0f, 1000.0f); - } + Actor_OfferGetItem(&this->actor, play, GI_SCALE_GOLDEN, 2000.0f, 1000.0f); } break; case 24: sIsRodVisible = false; - if (((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) || - (IS_RANDO && GET_PLAYER(play)->getItemId == GI_ICE_TRAP)) { + if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if (sFishOnHandIsLoach == 0) { this->stateAndTimer = 0; } else { diff --git a/soh/src/overlays/actors/ovl_Fishing/z_fishing.h b/soh/src/overlays/actors/ovl_Fishing/z_fishing.h index c0d478e2a..5a937b08c 100644 --- a/soh/src/overlays/actors/ovl_Fishing/z_fishing.h +++ b/soh/src/overlays/actors/ovl_Fishing/z_fishing.h @@ -63,4 +63,13 @@ typedef struct Fishing { #define EN_FISH_PARAM 100 // param base for fish in pond. #define EN_FISH_AQUARIUM 200 // param for record fish in tank. +struct VBFishingData { + Fishing* actor; + u8* sFishOnHandIsLoach; + u8* sSinkingLureLocation; + f32* sFishOnHandLength; + f32 fishWeight; + f32 sFishingRecordLength; +}; + #endif diff --git a/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c b/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c index 796b157a3..5aa223290 100644 --- a/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -50,7 +50,7 @@ static s16 sDrawItemIndexes[] = { }; static s16 sGetItemIds[] = { - GI_BOTTLE, GI_LETTER_RUTO, GI_SHIELD_HYLIAN, GI_QUIVER_40, GI_SCALE_SILVER, GI_SCALE_GOLD, GI_KEY_SMALL, + GI_BOTTLE, GI_LETTER_RUTO, GI_SHIELD_HYLIAN, GI_QUIVER_40, GI_SCALE_SILVER, GI_SCALE_GOLDEN, GI_KEY_SMALL, GI_ARROW_FIRE, GI_NONE, GI_NONE, GI_NONE, GI_NONE, GI_NONE, GI_NONE, };