mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-22 08:08:53 -05:00
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
This commit is contained in:
parent
63eaae8774
commit
bd142a0eed
@ -387,7 +387,7 @@ typedef enum {
|
|||||||
/* 0x35 */ GI_GAUNTLETS_SILVER,
|
/* 0x35 */ GI_GAUNTLETS_SILVER,
|
||||||
/* 0x36 */ GI_GAUNTLETS_GOLD,
|
/* 0x36 */ GI_GAUNTLETS_GOLD,
|
||||||
/* 0x37 */ GI_SCALE_SILVER,
|
/* 0x37 */ GI_SCALE_SILVER,
|
||||||
/* 0x38 */ GI_SCALE_GOLD,
|
/* 0x38 */ GI_SCALE_GOLDEN,
|
||||||
/* 0x39 */ GI_STONE_OF_AGONY,
|
/* 0x39 */ GI_STONE_OF_AGONY,
|
||||||
/* 0x3A */ GI_GERUDO_CARD,
|
/* 0x3A */ GI_GERUDO_CARD,
|
||||||
/* 0x3B */ GI_OCARINA_FAIRY, // uses Ocarina of Time message ID
|
/* 0x3B */ GI_OCARINA_FAIRY, // uses Ocarina of Time message ID
|
||||||
|
@ -146,6 +146,7 @@ typedef enum {
|
|||||||
TEXT_FISHING_DIFFERENT_POND = 0x4094,
|
TEXT_FISHING_DIFFERENT_POND = 0x4094,
|
||||||
TEXT_FISHING_SCRATCHING = 0x4095,
|
TEXT_FISHING_SCRATCHING = 0x4095,
|
||||||
TEXT_FISHING_CLOUDY = 0x4096,
|
TEXT_FISHING_CLOUDY = 0x4096,
|
||||||
|
TEXT_FISHING_RELEASE_THIS_ONE = 0x409C,
|
||||||
TEXT_FISHING_TRY_ANOTHER_LURE_WITH_SINKING_LURE = 0x40AF,
|
TEXT_FISHING_TRY_ANOTHER_LURE_WITH_SINKING_LURE = 0x40AF,
|
||||||
TEXT_DAMPES_DIARY = 0x5003,
|
TEXT_DAMPES_DIARY = 0x5003,
|
||||||
TEXT_GRANNYS_SHOP = 0x500C,
|
TEXT_GRANNYS_SHOP = 0x500C,
|
||||||
|
@ -291,6 +291,15 @@ typedef enum {
|
|||||||
VB_PLAY_RAINBOW_BRIDGE_CS,
|
VB_PLAY_RAINBOW_BRIDGE_CS,
|
||||||
// Opt: *EnBox
|
// Opt: *EnBox
|
||||||
VB_PLAY_SLOW_CHEST_CS,
|
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,
|
VB_PLAY_THROW_ANIMATION,
|
||||||
|
|
||||||
/*** Give Items ***/
|
/*** Give Items ***/
|
||||||
|
@ -35,6 +35,7 @@ extern "C" {
|
|||||||
#include "src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h"
|
#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_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_En_Ge1/z_en_ge1.h"
|
||||||
|
#include "src/overlays/actors/ovl_Fishing/z_fishing.h"
|
||||||
#include "adult_trade_shuffle.h"
|
#include "adult_trade_shuffle.h"
|
||||||
#include "draw.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;
|
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) {
|
void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* optionalArg) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case VB_PLAY_SLOW_CHEST_CS: {
|
case VB_PLAY_SLOW_CHEST_CS: {
|
||||||
@ -1162,6 +1179,52 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case VB_SHOULD_CHECK_FOR_FISHING_RECORD: {
|
||||||
|
f32 sFishOnHandLength = *static_cast<f32*>(optionalArg);
|
||||||
|
*should = *should || ShouldGiveFishingPrize(sFishOnHandLength);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case VB_SHOULD_SET_FISHING_RECORD: {
|
||||||
|
VBFishingData* fishData = static_cast<VBFishingData*>(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<VBFishingData*>(optionalArg);
|
||||||
|
*should = !IS_RANDO && ShouldGiveFishingPrize(fishData->fishWeight);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case VB_GIVE_RANDO_FISHING_PRIZE: {
|
||||||
|
if (IS_RANDO){
|
||||||
|
VBFishingData* fishData = static_cast<VBFishingData*>(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_ODD_MUSHROOM:
|
||||||
case VB_TRADE_TIMER_EYEDROPS:
|
case VB_TRADE_TIMER_EYEDROPS:
|
||||||
case VB_TRADE_TIMER_FROG:
|
case VB_TRADE_TIMER_FROG:
|
||||||
|
@ -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_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_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_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_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_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);
|
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);
|
||||||
|
@ -2163,8 +2163,12 @@ void Settings::FinalizeSettings(const std::set<RandomizerCheck>& excludedLocatio
|
|||||||
mOptions[RSK_KAK_100_SKULLS_HINT].SetSelectedIndex(RO_GENERIC_OFF);
|
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)) {
|
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)) {
|
if (mOptions[RSK_CUCCO_COUNT].Is(0)) {
|
||||||
|
@ -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_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_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_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_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_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),
|
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<ItemID, GetItemID> ItemIDtoGetItemIDMap {
|
|||||||
{ ITEM_RUPEE_RED, GI_RUPEE_RED },
|
{ ITEM_RUPEE_RED, GI_RUPEE_RED },
|
||||||
{ ITEM_RUPEE_RED, GI_RUPEE_RED_LOSE },
|
{ ITEM_RUPEE_RED, GI_RUPEE_RED_LOSE },
|
||||||
{ ITEM_SAW, GI_SAW },
|
{ ITEM_SAW, GI_SAW },
|
||||||
{ ITEM_SCALE_GOLDEN, GI_SCALE_GOLD },
|
{ ITEM_SCALE_GOLDEN, GI_SCALE_GOLDEN },
|
||||||
{ ITEM_SCALE_SILVER, GI_SCALE_SILVER },
|
{ ITEM_SCALE_SILVER, GI_SCALE_SILVER },
|
||||||
{ ITEM_SEEDS, GI_SEEDS_5 },
|
{ ITEM_SEEDS, GI_SEEDS_5 },
|
||||||
{ ITEM_SEEDS_30, GI_SEEDS_30 },
|
{ ITEM_SEEDS_30, GI_SEEDS_30 },
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
#include "vt.h"
|
#include "vt.h"
|
||||||
|
|
||||||
#include "soh/frame_interpolation.h"
|
#include "soh/frame_interpolation.h"
|
||||||
|
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||||
|
|
||||||
#define FLAGS ACTOR_FLAG_UPDATE_WHILE_CULLED
|
#define FLAGS ACTOR_FLAG_UPDATE_WHILE_CULLED
|
||||||
|
|
||||||
#define WATER_SURFACE_Y(play) play->colCtx.colHeader->waterBoxes->ySurface
|
#define WATER_SURFACE_Y(play) play->colCtx.colHeader->waterBoxes->ySurface
|
||||||
bool getShouldSpawnLoaches();
|
bool getShouldSpawnLoaches();
|
||||||
|
|
||||||
@ -4959,7 +4959,8 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) {
|
|||||||
this->stateAndTimer = 20;
|
this->stateAndTimer = 20;
|
||||||
} else if (sFishOnHandIsLoach == 0) {
|
} else if (sFishOnHandIsLoach == 0) {
|
||||||
sFishLengthToWeigh = sFishOnHandLength;
|
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) {
|
if (sLureCaughtWith == FS_LURE_SINKING) {
|
||||||
this->actor.textId = 0x40B0;
|
this->actor.textId = 0x40B0;
|
||||||
} else {
|
} else {
|
||||||
@ -5028,41 +5029,53 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) {
|
|||||||
GetItemEntry getItemEntry = (GetItemEntry)GET_ITEM_NONE;
|
GetItemEntry getItemEntry = (GetItemEntry)GET_ITEM_NONE;
|
||||||
|
|
||||||
Message_CloseTextbox(play);
|
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) {
|
if (sFishOnHandIsLoach == 0) {
|
||||||
sFishingRecordLength = sFishOnHandLength;
|
//if we set the record. Needed because of the wider check at VB_SHOULD_CHECK_FOR_FISHING_RECORD
|
||||||
sFishOnHandLength = 0.0f;
|
//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) {
|
if (sLinkAge == LINK_AGE_CHILD) {
|
||||||
f32 temp;
|
f32 temp;
|
||||||
|
|
||||||
HIGH_SCORE(HS_FISHING) &= 0xFFFFFF00;
|
HIGH_SCORE(HS_FISHING) &= 0xFFFFFF00;
|
||||||
HIGH_SCORE(HS_FISHING) |= (s32)sFishingRecordLength & HS_FISH_LENGTH_CHILD;
|
HIGH_SCORE(HS_FISHING) |= (s32)sFishingRecordLength & HS_FISH_LENGTH_CHILD;
|
||||||
|
|
||||||
temp = (HIGH_SCORE(HS_FISHING) & HS_FISH_LENGTH_ADULT) >> 0x18;
|
temp = (HIGH_SCORE(HS_FISHING) & HS_FISH_LENGTH_ADULT) >> 0x18;
|
||||||
if (temp < sFishingRecordLength) {
|
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) &= 0xFFFFFF;
|
||||||
HIGH_SCORE(HS_FISHING) |= ((s32)sFishingRecordLength & HS_FISH_LENGTH_CHILD) << 0x18;
|
HIGH_SCORE(HS_FISHING) |= ((s32)sFishingRecordLength & HS_FISH_LENGTH_CHILD) << 0x18;
|
||||||
|
|
||||||
if (sLureCaughtWith == FS_LURE_SINKING) {
|
if (sLureCaughtWith == FS_LURE_SINKING) {
|
||||||
HIGH_SCORE(HS_FISHING) |= HS_FISH_CHEAT_ADULT;
|
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
|
if (sFishingRecordLength >= 60.0f) { // 13 lbs
|
||||||
@ -5076,56 +5089,34 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sLinkAge == LINK_AGE_CHILD) { // 9 lbs
|
if (sLinkAge == LINK_AGE_CHILD) { // 9 lbs
|
||||||
if ((!IS_RANDO && !(HIGH_SCORE(HS_FISHING) & HS_FISH_PRIZE_CHILD)) ||
|
//if we should give the main prize AND it's not rando
|
||||||
(IS_RANDO && !Flags_GetRandomizerInf(RAND_INF_CHILD_FISHING))
|
if (GameInteractor_Should(VB_SHOULD_GIVE_VANILLA_FISHING_PRIZE, false, &fishData)){
|
||||||
) {
|
//((sFishingRecordLength >= 50.0f) && !(HIGH_SCORE(HS_FISHING) & HS_FISH_PRIZE_CHILD)) {
|
||||||
if (sFishingRecordLength >= Fishing_GetMinimumRequiredScore()) {
|
HIGH_SCORE(HS_FISHING) |= HS_FISH_PRIZE_CHILD;
|
||||||
HIGH_SCORE(HS_FISHING) |= HS_FISH_PRIZE_CHILD;
|
getItemId = GI_HEART_PIECE;
|
||||||
Flags_SetRandomizerInf(RAND_INF_CHILD_FISHING);
|
sSinkingLureLocation = (u8)Rand_ZeroFloat(3.999f) + 1;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else { // 13 lbs
|
} else { // 13 lbs
|
||||||
if ((!IS_RANDO && !(HIGH_SCORE(HS_FISHING) & HS_FISH_PRIZE_ADULT)) ||
|
//if we should give the main prize AND it's not rando
|
||||||
(IS_RANDO && !Flags_GetRandomizerInf(RAND_INF_ADULT_FISHING))
|
if (GameInteractor_Should(VB_SHOULD_GIVE_VANILLA_FISHING_PRIZE, false, &fishData)){
|
||||||
) {
|
//(sFishingRecordLength >= 60.0f) && !(HIGH_SCORE(HS_FISHING) & HS_FISH_PRIZE_ADULT)) {
|
||||||
if (sFishingRecordLength >= Fishing_GetMinimumRequiredScore()) {
|
HIGH_SCORE(HS_FISHING) |= HS_FISH_PRIZE_ADULT;
|
||||||
HIGH_SCORE(HS_FISHING) |= HS_FISH_PRIZE_ADULT;
|
getItemId = GI_SCALE_GOLDEN;
|
||||||
Flags_SetRandomizerInf(RAND_INF_ADULT_FISHING);
|
sSinkingLureLocation = (u8)Rand_ZeroFloat(3.999f) + 1;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (IS_RANDO && !Flags_GetRandomizerInf(RAND_INF_CAUGHT_LOACH)) {
|
getItemId = GI_RUPEE_PURPLE;
|
||||||
Flags_SetRandomizerInf(RAND_INF_CAUGHT_LOACH);
|
|
||||||
getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LH_HYRULE_LOACH, GI_RUPEE_PURPLE);
|
|
||||||
getItemId = getItemEntry.getItemId;
|
|
||||||
} else {
|
|
||||||
getItemId = GI_RUPEE_PURPLE;
|
|
||||||
}
|
|
||||||
sFishOnHandLength = 0.0f; // doesn't record loach
|
sFishOnHandLength = 0.0f; // doesn't record loach
|
||||||
}
|
}
|
||||||
|
|
||||||
this->actor.parent = NULL;
|
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);
|
Actor_OfferGetItem(&this->actor, play, getItemId, 2000.0f, 1000.0f);
|
||||||
} else {
|
this->stateAndTimer = 23;
|
||||||
GiveItemEntryFromActor(&this->actor, play, getItemEntry, 2000.0f, 1000.0f);
|
|
||||||
}
|
}
|
||||||
this->stateAndTimer = 23;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -5175,19 +5166,13 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) {
|
|||||||
if (Actor_HasParent(&this->actor, play)) {
|
if (Actor_HasParent(&this->actor, play)) {
|
||||||
this->stateAndTimer = 24;
|
this->stateAndTimer = 24;
|
||||||
} else {
|
} else {
|
||||||
if (!IS_RANDO) {
|
Actor_OfferGetItem(&this->actor, play, GI_SCALE_GOLDEN, 2000.0f, 1000.0f);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 24:
|
case 24:
|
||||||
sIsRodVisible = false;
|
sIsRodVisible = false;
|
||||||
if (((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) ||
|
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) {
|
||||||
(IS_RANDO && GET_PLAYER(play)->getItemId == GI_ICE_TRAP)) {
|
|
||||||
if (sFishOnHandIsLoach == 0) {
|
if (sFishOnHandIsLoach == 0) {
|
||||||
this->stateAndTimer = 0;
|
this->stateAndTimer = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -63,4 +63,13 @@ typedef struct Fishing {
|
|||||||
#define EN_FISH_PARAM 100 // param base for fish in pond.
|
#define EN_FISH_PARAM 100 // param base for fish in pond.
|
||||||
#define EN_FISH_AQUARIUM 200 // param for record fish in tank.
|
#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
|
#endif
|
||||||
|
@ -50,7 +50,7 @@ static s16 sDrawItemIndexes[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static s16 sGetItemIds[] = {
|
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,
|
GI_ARROW_FIRE, GI_NONE, GI_NONE, GI_NONE, GI_NONE, GI_NONE, GI_NONE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user