Move child trade to flags

This commit is contained in:
Pepe20129 2025-01-29 15:17:08 +01:00
parent 24699f8ce3
commit 8c1a6bdd26
23 changed files with 157 additions and 53 deletions

View File

@ -19,7 +19,7 @@ extern "C" {
#include "functions.h" #include "functions.h"
#include "macros.h" #include "macros.h"
#include "soh/cvar_prefixes.h" #include "soh/cvar_prefixes.h"
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h" #include "soh/Enhancements/randomizer/trade_shuffle.h"
extern PlayState* gPlayState; extern PlayState* gPlayState;
#include "textures/icon_item_static/icon_item_static.h" #include "textures/icon_item_static/icon_item_static.h"

View File

@ -1600,6 +1600,30 @@ const std::vector<FlagTable> flagTables = {
{ RAND_INF_HYLIA_LAB_KEY_OBTAINED, "RAND_INF_HYLIA_LAB_KEY_OBTAINED" }, { RAND_INF_HYLIA_LAB_KEY_OBTAINED, "RAND_INF_HYLIA_LAB_KEY_OBTAINED" },
{ RAND_INF_FISHING_HOLE_UNLOCKED, "RAND_INF_FISHING_HOLE_UNLOCKED" }, { RAND_INF_FISHING_HOLE_UNLOCKED, "RAND_INF_FISHING_HOLE_UNLOCKED" },
{ RAND_INF_FISHING_HOLE_KEY_OBTAINED, "RAND_INF_FISHING_HOLE_KEY_OBTAINED" }, { RAND_INF_FISHING_HOLE_KEY_OBTAINED, "RAND_INF_FISHING_HOLE_KEY_OBTAINED" },
{ RAND_INF_CHILD_TRADES_HAS_WEIRD_EGG, "RAND_INF_CHILD_TRADES_HAS_WEIRD_EGG" },
{ RAND_INF_CHILD_TRADES_HAS_CHICKEN, "RAND_INF_CHILD_TRADES_HAS_CHICKEN" },
{ RAND_INF_CHILD_TRADES_HAS_LETTER_ZELDA, "RAND_INF_CHILD_TRADES_HAS_LETTER_ZELDA" },
{ RAND_INF_CHILD_TRADES_HAS_MASK_KEATON, "RAND_INF_CHILD_TRADES_HAS_MASK_KEATON" },
{ RAND_INF_CHILD_TRADES_HAS_MASK_SKULL, "RAND_INF_CHILD_TRADES_HAS_MASK_SKULL" },
{ RAND_INF_CHILD_TRADES_HAS_MASK_SPOOKY, "RAND_INF_CHILD_TRADES_HAS_MASK_SPOOKY" },
{ RAND_INF_CHILD_TRADES_HAS_MASK_BUNNY, "RAND_INF_CHILD_TRADES_HAS_MASK_BUNNY" },
{ RAND_INF_CHILD_TRADES_HAS_MASK_GORON, "RAND_INF_CHILD_TRADES_HAS_MASK_GORON" },
{ RAND_INF_CHILD_TRADES_HAS_MASK_ZORA, "RAND_INF_CHILD_TRADES_HAS_MASK_ZORA" },
{ RAND_INF_CHILD_TRADES_HAS_MASK_GERUDO, "RAND_INF_CHILD_TRADES_HAS_MASK_GERUDO" },
{ RAND_INF_CHILD_TRADES_HAS_MASK_TRUTH, "RAND_INF_CHILD_TRADES_HAS_MASK_TRUTH" },
{ RAND_INF_ADULT_TRADES_HAS_POCKET_EGG, "RAND_INF_ADULT_TRADES_HAS_POCKET_EGG" },
{ RAND_INF_ADULT_TRADES_HAS_POCKET_CUCCO, "RAND_INF_ADULT_TRADES_HAS_POCKET_CUCCO" },
{ RAND_INF_ADULT_TRADES_HAS_COJIRO, "RAND_INF_ADULT_TRADES_HAS_COJIRO" },
{ RAND_INF_ADULT_TRADES_HAS_ODD_MUSHROOM, "RAND_INF_ADULT_TRADES_HAS_ODD_MUSHROOM" },
{ RAND_INF_ADULT_TRADES_HAS_ODD_POTION, "RAND_INF_ADULT_TRADES_HAS_ODD_POTION" },
{ RAND_INF_ADULT_TRADES_HAS_SAW, "RAND_INF_ADULT_TRADES_HAS_SAW" },
{ RAND_INF_ADULT_TRADES_HAS_SWORD_BROKEN, "RAND_INF_ADULT_TRADES_HAS_SWORD_BROKEN" },
{ RAND_INF_ADULT_TRADES_HAS_PRESCRIPTION, "RAND_INF_ADULT_TRADES_HAS_PRESCRIPTION" },
{ RAND_INF_ADULT_TRADES_HAS_FROG, "RAND_INF_ADULT_TRADES_HAS_FROG" },
{ RAND_INF_ADULT_TRADES_HAS_EYEDROPS, "RAND_INF_ADULT_TRADES_HAS_EYEDROPS" },
{ RAND_INF_ADULT_TRADES_HAS_CLAIM_CHECK, "RAND_INF_ADULT_TRADES_HAS_CLAIM_CHECK" },
} }, } },
}; };

View File

@ -21,7 +21,7 @@ extern "C" {
#include "macros.h" #include "macros.h"
#include "functions.h" #include "functions.h"
#include "variables.h" #include "variables.h"
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h" #include "soh/Enhancements/randomizer/trade_shuffle.h"
#include "soh/Enhancements/randomizer/randomizer_entrance.h" #include "soh/Enhancements/randomizer/randomizer_entrance.h"
#include "soh/Enhancements/randomizer/randomizer_grotto.h" #include "soh/Enhancements/randomizer/randomizer_grotto.h"
#include "src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.h" #include "src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.h"
@ -56,7 +56,7 @@ extern "C" {
#include "src/overlays/actors/ovl_En_Xc/z_en_xc.h" #include "src/overlays/actors/ovl_En_Xc/z_en_xc.h"
#include "src/overlays/actors/ovl_Fishing/z_fishing.h" #include "src/overlays/actors/ovl_Fishing/z_fishing.h"
#include "src/overlays/actors/ovl_En_Mk/z_en_mk.h" #include "src/overlays/actors/ovl_En_Mk/z_en_mk.h"
#include "adult_trade_shuffle.h" #include "trade_shuffle.h"
#include "draw.h" #include "draw.h"
extern SaveContext gSaveContext; extern SaveContext gSaveContext;
@ -221,11 +221,11 @@ void RandomizerOnFlagSetHandler(int16_t flagType, int16_t flag) {
switch (flag) { switch (flag) {
case RAND_INF_ADULT_TRADES_DMT_TRADE_BROKEN_SWORD: case RAND_INF_ADULT_TRADES_DMT_TRADE_BROKEN_SWORD:
Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_SWORD_BROKEN); Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_SWORD_BROKEN);
Inventory_ReplaceItem(play, ITEM_SWORD_BROKEN, Randomizer_GetNextAdultTradeItem()); Inventory_ReplaceItem(gPlayState, ITEM_SWORD_BROKEN, Randomizer_GetNextAdultTradeItem());
break; break;
case RAND_INF_ADULT_TRADES_DMT_TRADE_EYEDROPS: case RAND_INF_ADULT_TRADES_DMT_TRADE_EYEDROPS:
Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_EYEDROPS); Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_EYEDROPS);
Inventory_ReplaceItem(play, ITEM_EYEDROPS, Randomizer_GetNextAdultTradeItem()); Inventory_ReplaceItem(gPlayState, ITEM_EYEDROPS, Randomizer_GetNextAdultTradeItem());
break; break;
} }
} }
@ -1182,7 +1182,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l
case VB_TRADE_POCKET_CUCCO: { case VB_TRADE_POCKET_CUCCO: {
EnNiwLady* enNiwLady = va_arg(args, EnNiwLady*); EnNiwLady* enNiwLady = va_arg(args, EnNiwLady*);
Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_POCKET_CUCCO); Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_POCKET_CUCCO);
Inventory_ReplaceItem(play, ITEM_POCKET_CUCCO, Randomizer_GetNextAdultTradeItem()); Inventory_ReplaceItem(gPlayState, ITEM_POCKET_CUCCO, Randomizer_GetNextAdultTradeItem());
// Trigger the reward now // Trigger the reward now
Flags_SetItemGetInf(ITEMGETINF_2E); Flags_SetItemGetInf(ITEMGETINF_2E);
enNiwLady->actionFunc = func_80ABA778; enNiwLady->actionFunc = func_80ABA778;
@ -1192,14 +1192,14 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l
} }
case VB_TRADE_COJIRO: { case VB_TRADE_COJIRO: {
Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_COJIRO); Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_COJIRO);
Inventory_ReplaceItem(play, ITEM_COJIRO, Randomizer_GetNextAdultTradeItem()); Inventory_ReplaceItem(gPlayState, ITEM_COJIRO, Randomizer_GetNextAdultTradeItem());
*should = false; *should = false;
break; break;
} }
case VB_TRADE_ODD_MUSHROOM: { case VB_TRADE_ODD_MUSHROOM: {
EnDs* granny = va_arg(args, EnDs*); EnDs* granny = va_arg(args, EnDs*);
Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_ODD_MUSHROOM); Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_ODD_MUSHROOM);
Inventory_ReplaceItem(play, ITEM_ODD_MUSHROOM, Randomizer_GetNextAdultTradeItem()); Inventory_ReplaceItem(gPlayState, ITEM_ODD_MUSHROOM, Randomizer_GetNextAdultTradeItem());
// Trigger the reward now // Trigger the reward now
Flags_SetItemGetInf(ITEMGETINF_30); Flags_SetItemGetInf(ITEMGETINF_30);
granny->actor.textId = 0x504F; granny->actor.textId = 0x504F;
@ -1211,7 +1211,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l
case VB_TRADE_ODD_POTION: { case VB_TRADE_ODD_POTION: {
EnKo* enKo = va_arg(args, EnKo*); EnKo* enKo = va_arg(args, EnKo*);
Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_ODD_POTION); Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_ODD_POTION);
Inventory_ReplaceItem(play, ITEM_ODD_POTION, Randomizer_GetNextAdultTradeItem()); Inventory_ReplaceItem(gPlayState, ITEM_ODD_POTION, Randomizer_GetNextAdultTradeItem());
// Trigger the reward now // Trigger the reward now
Flags_SetItemGetInf(ITEMGETINF_31); Flags_SetItemGetInf(ITEMGETINF_31);
*should = false; *should = false;
@ -1219,7 +1219,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l
} }
case VB_TRADE_SAW: { case VB_TRADE_SAW: {
Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_SAW); Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_SAW);
Inventory_ReplaceItem(play, ITEM_SAW, Randomizer_GetNextAdultTradeItem()); Inventory_ReplaceItem(gPlayState, ITEM_SAW, Randomizer_GetNextAdultTradeItem());
*should = false; *should = false;
break; break;
} }
@ -1237,7 +1237,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l
(hasShieldHoldingR && INV_CONTENT(ITEM_TRADE_ADULT) < ITEM_FROG)) { (hasShieldHoldingR && INV_CONTENT(ITEM_TRADE_ADULT) < ITEM_FROG)) {
Flags_SetRandomizerInf(RAND_INF_ADULT_TRADES_ZD_TRADE_PRESCRIPTION); Flags_SetRandomizerInf(RAND_INF_ADULT_TRADES_ZD_TRADE_PRESCRIPTION);
Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_PRESCRIPTION); Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_PRESCRIPTION);
Inventory_ReplaceItem(play, ITEM_PRESCRIPTION, Randomizer_GetNextAdultTradeItem()); Inventory_ReplaceItem(gPlayState, ITEM_PRESCRIPTION, Randomizer_GetNextAdultTradeItem());
} else { } else {
Flags_SetRandomizerInf(RAND_INF_KING_ZORA_THAWED); Flags_SetRandomizerInf(RAND_INF_KING_ZORA_THAWED);
} }
@ -1245,7 +1245,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l
if (enKz->isTrading) { if (enKz->isTrading) {
Flags_SetRandomizerInf(RAND_INF_ADULT_TRADES_ZD_TRADE_PRESCRIPTION); Flags_SetRandomizerInf(RAND_INF_ADULT_TRADES_ZD_TRADE_PRESCRIPTION);
Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_PRESCRIPTION); Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_PRESCRIPTION);
Inventory_ReplaceItem(play, ITEM_PRESCRIPTION, Randomizer_GetNextAdultTradeItem()); Inventory_ReplaceItem(gPlayState, ITEM_PRESCRIPTION, Randomizer_GetNextAdultTradeItem());
} else { } else {
Flags_SetRandomizerInf(RAND_INF_KING_ZORA_THAWED); Flags_SetRandomizerInf(RAND_INF_KING_ZORA_THAWED);
} }
@ -1255,7 +1255,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l
} }
case VB_TRADE_FROG: { case VB_TRADE_FROG: {
Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_FROG); Flags_UnsetRandomizerInf(RAND_INF_ADULT_TRADES_HAS_FROG);
Inventory_ReplaceItem(play, ITEM_FROG, Randomizer_GetNextAdultTradeItem()); Inventory_ReplaceItem(gPlayState, ITEM_FROG, Randomizer_GetNextAdultTradeItem());
*should = false; *should = false;
break; break;
} }

View File

@ -1325,6 +1325,18 @@ typedef enum {
RAND_INF_FISHING_HOLE_UNLOCKED, RAND_INF_FISHING_HOLE_UNLOCKED,
RAND_INF_FISHING_HOLE_KEY_OBTAINED, RAND_INF_FISHING_HOLE_KEY_OBTAINED,
RAND_INF_CHILD_TRADES_HAS_WEIRD_EGG,
RAND_INF_CHILD_TRADES_HAS_CHICKEN,
RAND_INF_CHILD_TRADES_HAS_LETTER_ZELDA,
RAND_INF_CHILD_TRADES_HAS_MASK_KEATON,
RAND_INF_CHILD_TRADES_HAS_MASK_SKULL,
RAND_INF_CHILD_TRADES_HAS_MASK_SPOOKY,
RAND_INF_CHILD_TRADES_HAS_MASK_BUNNY,
RAND_INF_CHILD_TRADES_HAS_MASK_GORON,
RAND_INF_CHILD_TRADES_HAS_MASK_ZORA,
RAND_INF_CHILD_TRADES_HAS_MASK_GERUDO,
RAND_INF_CHILD_TRADES_HAS_MASK_TRUTH,
RAND_INF_ADULT_TRADES_HAS_POCKET_EGG, RAND_INF_ADULT_TRADES_HAS_POCKET_EGG,
RAND_INF_ADULT_TRADES_HAS_POCKET_CUCCO, RAND_INF_ADULT_TRADES_HAS_POCKET_CUCCO,
RAND_INF_ADULT_TRADES_HAS_COJIRO, RAND_INF_ADULT_TRADES_HAS_COJIRO,

View File

@ -311,6 +311,7 @@ extern "C" void Randomizer_InitSaveFile() {
// Set "Got Zelda's Letter" flag. Also ensures Saria is back at SFM. // Set "Got Zelda's Letter" flag. Also ensures Saria is back at SFM.
Flags_SetEventChkInf(EVENTCHKINF_OBTAINED_ZELDAS_LETTER); Flags_SetEventChkInf(EVENTCHKINF_OBTAINED_ZELDAS_LETTER);
Flags_SetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_LETTER_ZELDA);
// Got item from impa // Got item from impa
Flags_SetEventChkInf(EVENTCHKINF_LEARNED_ZELDAS_LULLABY); Flags_SetEventChkInf(EVENTCHKINF_LEARNED_ZELDAS_LULLABY);
@ -320,6 +321,7 @@ extern "C" void Randomizer_InitSaveFile() {
// set this at the end to ensure we always start with the letter // set this at the end to ensure we always start with the letter
// this is for the off chance we got the weird egg from impa (which should never happen) // this is for the off chance we got the weird egg from impa (which should never happen)
INV_CONTENT(ITEM_LETTER_ZELDA) = ITEM_LETTER_ZELDA; INV_CONTENT(ITEM_LETTER_ZELDA) = ITEM_LETTER_ZELDA;
Flags_SetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_LETTER_ZELDA);
} }
if (Randomizer_GetSettingValue(RSK_SHUFFLE_MASTER_SWORD) && startingAge == RO_AGE_ADULT) { if (Randomizer_GetSettingValue(RSK_SHUFFLE_MASTER_SWORD) && startingAge == RO_AGE_ADULT) {
@ -370,6 +372,7 @@ extern "C" void Randomizer_InitSaveFile() {
if (Randomizer_GetSettingValue(RSK_KAK_GATE) == RO_KAK_GATE_OPEN) { if (Randomizer_GetSettingValue(RSK_KAK_GATE) == RO_KAK_GATE_OPEN) {
Flags_SetInfTable(INFTABLE_SHOWED_ZELDAS_LETTER_TO_GATE_GUARD); Flags_SetInfTable(INFTABLE_SHOWED_ZELDAS_LETTER_TO_GATE_GUARD);
Flags_UnsetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_LETTER_ZELDA);
} }
if (Randomizer_GetSettingValue(RSK_GERUDO_FORTRESS) == RO_GF_CARPENTERS_FAST || if (Randomizer_GetSettingValue(RSK_GERUDO_FORTRESS) == RO_GF_CARPENTERS_FAST ||
@ -407,6 +410,16 @@ extern "C" void Randomizer_InitSaveFile() {
if (Randomizer_GetSettingValue(RSK_COMPLETE_MASK_QUEST)) { if (Randomizer_GetSettingValue(RSK_COMPLETE_MASK_QUEST)) {
Flags_SetInfTable(INFTABLE_GATE_GUARD_PUT_ON_KEATON_MASK); Flags_SetInfTable(INFTABLE_GATE_GUARD_PUT_ON_KEATON_MASK);
Flags_SetEventChkInf(EVENTCHKINF_PAID_BACK_BUNNY_HOOD_FEE); Flags_SetEventChkInf(EVENTCHKINF_PAID_BACK_BUNNY_HOOD_FEE);
Flags_SetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_MASK_KEATON);
Flags_SetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_MASK_SKULL);
Flags_SetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_MASK_SPOOKY);
Flags_SetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_MASK_BUNNY);
Flags_SetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_MASK_GORON);
Flags_SetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_MASK_ZORA);
Flags_SetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_MASK_GERUDO);
Flags_SetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_MASK_TRUTH);
gSaveContext.itemGetInf[3] |= 0x100; // Sold Keaton Mask gSaveContext.itemGetInf[3] |= 0x100; // Sold Keaton Mask
gSaveContext.itemGetInf[3] |= 0x200; // Sold Skull Mask gSaveContext.itemGetInf[3] |= 0x200; // Sold Skull Mask
gSaveContext.itemGetInf[3] |= 0x400; // Sold Spooky Mask gSaveContext.itemGetInf[3] |= 0x400; // Sold Spooky Mask

View File

@ -2,6 +2,30 @@
#include "variables.h" #include "variables.h"
#include "macros.h" #include "macros.h"
u8 Randomizer_GetNextChildTradeItem() {
const u8 numTradeItems = ITEM_MASK_TRUTH - ITEM_WEIRD_EGG + 1;
u8 currentTradeItemIndex = INV_CONTENT(ITEM_TRADE_CHILD) - ITEM_WEIRD_EGG;
for (int i = 0; i < numTradeItems; i++) {
u8 tradeIndex = (currentTradeItemIndex + i + 1) % numTradeItems;
if (Flags_GetRandomizerInf(tradeIndex + RAND_INF_CHILD_TRADES_HAS_WEIRD_EGG)) {
return ITEM_WEIRD_EGG + tradeIndex;
}
}
return ITEM_NONE;
}
u8 Randomizer_GetPrevChildTradeItem() {
const u8 numTradeItems = ITEM_MASK_TRUTH - ITEM_WEIRD_EGG + 1;
u8 currentTradeItemIndex = INV_CONTENT(ITEM_TRADE_CHILD) - ITEM_WEIRD_EGG;
for (int i = 0; i < numTradeItems; i++) {
u8 tradeIndex = (currentTradeItemIndex - i - 1 + numTradeItems) % numTradeItems;
if (Flags_GetRandomizerInf(tradeIndex + RAND_INF_CHILD_TRADES_HAS_WEIRD_EGG)) {
return ITEM_WEIRD_EGG + tradeIndex;
}
}
return ITEM_NONE;
}
u8 Randomizer_GetNextAdultTradeItem() { u8 Randomizer_GetNextAdultTradeItem() {
const u8 numTradeItems = ITEM_CLAIM_CHECK - ITEM_POCKET_EGG + 1; const u8 numTradeItems = ITEM_CLAIM_CHECK - ITEM_POCKET_EGG + 1;
u8 currentTradeItemIndex = INV_CONTENT(ITEM_TRADE_ADULT) - ITEM_POCKET_EGG; u8 currentTradeItemIndex = INV_CONTENT(ITEM_TRADE_ADULT) - ITEM_POCKET_EGG;

View File

@ -3,6 +3,8 @@
#include <libultraship/libultra/types.h> #include <libultraship/libultra/types.h>
u8 Randomizer_GetNextChildTradeItem();
u8 Randomizer_GetPrevChildTradeItem();
u8 Randomizer_GetNextAdultTradeItem(); u8 Randomizer_GetNextAdultTradeItem();
u8 Randomizer_GetPrevAdultTradeItem(); u8 Randomizer_GetPrevAdultTradeItem();

View File

@ -2111,6 +2111,10 @@ void func_80075B44(PlayState* play) {
if ((Inventory_ReplaceItem(play, ITEM_WEIRD_EGG, ITEM_CHICKEN) || if ((Inventory_ReplaceItem(play, ITEM_WEIRD_EGG, ITEM_CHICKEN) ||
Inventory_HatchPocketCucco(play)) && Inventory_HatchPocketCucco(play)) &&
play->csCtx.state == 0 && !Player_InCsMode(play)) { play->csCtx.state == 0 && !Player_InCsMode(play)) {
if (IS_RANDO && LINK_IS_CHILD) {
Flags_UnsetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_WEIRD_EGG);
Flags_SetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_CHICKEN);
}
Message_StartTextbox(play, 0x3066, NULL); Message_StartTextbox(play, 0x3066, NULL);
} }
play->envCtx.unk_E0++; play->envCtx.unk_E0++;

View File

@ -4,7 +4,7 @@
#include "textures/do_action_static/do_action_static.h" #include "textures/do_action_static/do_action_static.h"
#include "textures/icon_item_static/icon_item_static.h" #include "textures/icon_item_static/icon_item_static.h"
#include "soh_assets.h" #include "soh_assets.h"
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h" #include "soh/Enhancements/randomizer/trade_shuffle.h"
#include "soh/Enhancements/randomizer/randomizer_entrance.h" #include "soh/Enhancements/randomizer/randomizer_entrance.h"
#include "libultraship/bridge.h" #include "libultraship/bridge.h"
@ -2446,8 +2446,17 @@ u8 Item_Give(PlayState* play, u8 item) {
Flags_SetItemGetInf(ITEMGETINF_OBTAINED_NUT_UPGRADE_FROM_STAGE); Flags_SetItemGetInf(ITEMGETINF_OBTAINED_NUT_UPGRADE_FROM_STAGE);
} }
if (item >= ITEM_POCKET_EGG && IS_RANDO) { if (IS_RANDO) {
Flags_SetRandomizerInf(item - ITEM_POCKET_EGG + RAND_INF_ADULT_TRADES_HAS_POCKET_EGG); if (item >= ITEM_POCKET_EGG) {
Flags_SetRandomizerInf(item - ITEM_POCKET_EGG + RAND_INF_ADULT_TRADES_HAS_POCKET_EGG);
} else if (item == ITEM_LETTER_ZELDA) {
//don't care about zelda's letter if it's already been shown to the guard
if (!Flags_GetInfTable(INFTABLE_SHOWED_ZELDAS_LETTER_TO_GATE_GUARD)) {
Flags_SetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_LETTER_ZELDA);
}
} else {
Flags_SetRandomizerInf(item - ITEM_WEIRD_EGG + RAND_INF_CHILD_TRADES_HAS_WEIRD_EGG);
}
} }
temp = INV_CONTENT(item); temp = INV_CONTENT(item);

View File

@ -526,6 +526,10 @@ void Play_Init(GameState* thisx) {
if (Inventory_ReplaceItem(play, ITEM_WEIRD_EGG, ITEM_CHICKEN) || if (Inventory_ReplaceItem(play, ITEM_WEIRD_EGG, ITEM_CHICKEN) ||
Inventory_HatchPocketCucco(play)) { Inventory_HatchPocketCucco(play)) {
if (IS_RANDO && LINK_IS_CHILD) {
Flags_UnsetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_WEIRD_EGG);
Flags_SetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_CHICKEN);
}
Message_StartTextbox(play, 0x3066, NULL); Message_StartTextbox(play, 0x3066, NULL);
} }

View File

@ -24,7 +24,7 @@
#include "overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h" #include "overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h"
#include "soh/mq_asset_hacks.h" #include "soh/mq_asset_hacks.h"
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h" #include "soh/Enhancements/randomizer/trade_shuffle.h"
#include "soh/OTRGlobals.h" #include "soh/OTRGlobals.h"
#include "soh/ResourceManagerHelpers.h" #include "soh/ResourceManagerHelpers.h"

View File

@ -6,7 +6,7 @@
#include "z_en_ds.h" #include "z_en_ds.h"
#include "objects/object_ds/object_ds.h" #include "objects/object_ds/object_ds.h"
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h" #include "soh/Enhancements/randomizer/trade_shuffle.h"
#include "soh/OTRGlobals.h" #include "soh/OTRGlobals.h"
#include "soh/ResourceManagerHelpers.h" #include "soh/ResourceManagerHelpers.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"

View File

@ -3,7 +3,7 @@
#include "objects/gameplay_keep/gameplay_keep.h" #include "objects/gameplay_keep/gameplay_keep.h"
#include "objects/object_oF1d_map/object_oF1d_map.h" #include "objects/object_oF1d_map/object_oF1d_map.h"
#include "soh/frame_interpolation.h" #include "soh/frame_interpolation.h"
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h" #include "soh/Enhancements/randomizer/trade_shuffle.h"
#include "soh/OTRGlobals.h" #include "soh/OTRGlobals.h"
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED)

View File

@ -3,7 +3,7 @@
#include "objects/gameplay_keep/gameplay_keep.h" #include "objects/gameplay_keep/gameplay_keep.h"
#include "objects/object_oF1d_map/object_oF1d_map.h" #include "objects/object_oF1d_map/object_oF1d_map.h"
#include "soh/frame_interpolation.h" #include "soh/frame_interpolation.h"
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h" #include "soh/Enhancements/randomizer/trade_shuffle.h"
#include "soh/OTRGlobals.h" #include "soh/OTRGlobals.h"
#include "soh/ResourceManagerHelpers.h" #include "soh/ResourceManagerHelpers.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"

View File

@ -408,6 +408,10 @@ void func_80A53AD4(EnHeishi2* this, PlayState* play) {
if (Actor_ProcessTalkRequest(&this->actor, play)) { if (Actor_ProcessTalkRequest(&this->actor, play)) {
exchangeItemId = func_8002F368(play); exchangeItemId = func_8002F368(play);
if (exchangeItemId == EXCH_ITEM_LETTER_ZELDA) { if (exchangeItemId == EXCH_ITEM_LETTER_ZELDA) {
if (IS_RANDO) {
//remove zelda's letter as this is the only use for it
Flags_UnsetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_LETTER_ZELDA);
}
Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME);
player->actor.textId = 0x2010; player->actor.textId = 0x2010;
this->unk_300 = TEXT_STATE_EVENT; this->unk_300 = TEXT_STATE_EVENT;

View File

@ -7,7 +7,7 @@
#include "z_en_hs.h" #include "z_en_hs.h"
#include "vt.h" #include "vt.h"
#include "objects/object_hs/object_hs.h" #include "objects/object_hs/object_hs.h"
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h" #include "soh/Enhancements/randomizer/trade_shuffle.h"
#include "soh/OTRGlobals.h" #include "soh/OTRGlobals.h"
#include "soh/ResourceManagerHelpers.h" #include "soh/ResourceManagerHelpers.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"

View File

@ -10,7 +10,7 @@
#include "objects/object_km1/object_km1.h" #include "objects/object_km1/object_km1.h"
#include "objects/object_kw1/object_kw1.h" #include "objects/object_kw1/object_kw1.h"
#include "vt.h" #include "vt.h"
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h" #include "soh/Enhancements/randomizer/trade_shuffle.h"
#include "soh/OTRGlobals.h" #include "soh/OTRGlobals.h"
#include "soh/ResourceManagerHelpers.h" #include "soh/ResourceManagerHelpers.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"

View File

@ -6,7 +6,7 @@
#include "z_en_kz.h" #include "z_en_kz.h"
#include "objects/object_kz/object_kz.h" #include "objects/object_kz/object_kz.h"
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h" #include "soh/Enhancements/randomizer/trade_shuffle.h"
#include "soh/OTRGlobals.h" #include "soh/OTRGlobals.h"
#include "soh/ResourceManagerHelpers.h" #include "soh/ResourceManagerHelpers.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"

View File

@ -6,7 +6,7 @@
#include "z_en_mk.h" #include "z_en_mk.h"
#include "objects/object_mk/object_mk.h" #include "objects/object_mk/object_mk.h"
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h" #include "soh/Enhancements/randomizer/trade_shuffle.h"
#include "soh/OTRGlobals.h" #include "soh/OTRGlobals.h"
#include "soh/ResourceManagerHelpers.h" #include "soh/ResourceManagerHelpers.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"

View File

@ -3,7 +3,7 @@
#include "objects/object_os_anime/object_os_anime.h" #include "objects/object_os_anime/object_os_anime.h"
#include "overlays/actors/ovl_En_Niw/z_en_niw.h" #include "overlays/actors/ovl_En_Niw/z_en_niw.h"
#include "vt.h" #include "vt.h"
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h" #include "soh/Enhancements/randomizer/trade_shuffle.h"
#include "soh/OTRGlobals.h" #include "soh/OTRGlobals.h"
#include "soh/ResourceManagerHelpers.h" #include "soh/ResourceManagerHelpers.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"

View File

@ -281,6 +281,10 @@ void func_80B14410(EnTa* this) {
if (!LINK_IS_ADULT) { if (!LINK_IS_ADULT) {
EnTa_SetupAction(this, EnTa_IdleAwakeInCastle, EnTa_AnimRepeatCurrent); EnTa_SetupAction(this, EnTa_IdleAwakeInCastle, EnTa_AnimRepeatCurrent);
Flags_SetEventChkInf(EVENTCHKINF_TALON_WOKEN_IN_CASTLE); Flags_SetEventChkInf(EVENTCHKINF_TALON_WOKEN_IN_CASTLE);
if (IS_RANDO) {
//remove chicken as this is the only use for it
Flags_UnsetRandomizerInf(RAND_INF_CHILD_TRADES_HAS_CHICKEN);
}
} else { } else {
EnTa_SetupAction(this, EnTa_IdleAwakeInKakariko, EnTa_AnimRepeatCurrent); EnTa_SetupAction(this, EnTa_IdleAwakeInKakariko, EnTa_AnimRepeatCurrent);
Flags_SetEventChkInf(EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO); Flags_SetEventChkInf(EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO);

View File

@ -6,7 +6,7 @@
#include "z_en_toryo.h" #include "z_en_toryo.h"
#include "objects/object_toryo/object_toryo.h" #include "objects/object_toryo/object_toryo.h"
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h" #include "soh/Enhancements/randomizer/trade_shuffle.h"
#include "soh/OTRGlobals.h" #include "soh/OTRGlobals.h"
#include "soh/ResourceManagerHelpers.h" #include "soh/ResourceManagerHelpers.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"

View File

@ -1,7 +1,7 @@
#include "z_kaleido_scope.h" #include "z_kaleido_scope.h"
#include "textures/parameter_static/parameter_static.h" #include "textures/parameter_static/parameter_static.h"
#include "textures/icon_item_static/icon_item_static.h" #include "textures/icon_item_static/icon_item_static.h"
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h" #include "soh/Enhancements/randomizer/trade_shuffle.h"
#include "soh/Enhancements/randomizer/randomizerTypes.h" #include "soh/Enhancements/randomizer/randomizerTypes.h"
#include "soh/Enhancements/enhancementTypes.h" #include "soh/Enhancements/enhancementTypes.h"
#include "soh/Enhancements/cosmetics/cosmeticsTypes.h" #include "soh/Enhancements/cosmetics/cosmeticsTypes.h"
@ -315,30 +315,26 @@ void KaleidoScope_HandleItemCycleExtras(PlayState* play, u8 slot, bool canCycle,
} }
} }
bool CanMaskSelect() {
// only allow mask select when:
// the shop is open:
// * zelda's letter check: Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_ZELDAS_LETTER)
// * kak gate check: Flags_GetInfTable(INFTABLE_SHOWED_ZELDAS_LETTER_TO_GATE_GUARD)
// and the mask quest is complete: Flags_GetEventChkInf(EVENTCHKINF_PAID_BACK_BUNNY_HOOD_FEE)
return CVarGetInteger(CVAR_ENHANCEMENT("MaskSelect"), 0) &&
Flags_GetEventChkInf(EVENTCHKINF_PAID_BACK_BUNNY_HOOD_FEE) &&
Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_ZELDAS_LETTER) &&
Flags_GetInfTable(INFTABLE_SHOWED_ZELDAS_LETTER_TO_GATE_GUARD);
}
void KaleidoScope_HandleItemCycles(PlayState* play) { void KaleidoScope_HandleItemCycles(PlayState* play) {
//handle the mask select //handle the mask select
KaleidoScope_HandleItemCycleExtras( KaleidoScope_HandleItemCycleExtras(
play, play,
SLOT_TRADE_CHILD, SLOT_TRADE_CHILD,
CanMaskSelect(), CVarGetInteger(CVAR_ENHANCEMENT("MaskSelect"), 0) /* || Randomizer_GetSettingValue(RSK_SHUFFLE_CHILD_TRADE) */,
INV_CONTENT(ITEM_TRADE_CHILD) <= ITEM_MASK_KEATON || INV_CONTENT(ITEM_TRADE_CHILD) > ITEM_MASK_TRUTH ? IS_RANDO ?
ITEM_MASK_TRUTH : Randomizer_GetPrevChildTradeItem() :
INV_CONTENT(ITEM_TRADE_CHILD) - 1, (
INV_CONTENT(ITEM_TRADE_CHILD) >= ITEM_MASK_TRUTH || INV_CONTENT(ITEM_TRADE_CHILD) < ITEM_MASK_KEATON ? INV_CONTENT(ITEM_TRADE_CHILD) <= ITEM_MASK_KEATON || INV_CONTENT(ITEM_TRADE_CHILD) > ITEM_MASK_TRUTH ?
ITEM_MASK_KEATON : ITEM_MASK_TRUTH :
INV_CONTENT(ITEM_TRADE_CHILD) + 1, INV_CONTENT(ITEM_TRADE_CHILD) - 1
),
IS_RANDO ?
Randomizer_GetNextChildTradeItem() :
(
INV_CONTENT(ITEM_TRADE_CHILD) >= ITEM_MASK_TRUTH || INV_CONTENT(ITEM_TRADE_CHILD) < ITEM_MASK_KEATON ?
ITEM_MASK_KEATON :
INV_CONTENT(ITEM_TRADE_CHILD) + 1
),
true true
); );
@ -378,13 +374,21 @@ void KaleidoScope_DrawItemCycles(PlayState* play) {
KaleidoScope_DrawItemCycleExtras( KaleidoScope_DrawItemCycleExtras(
play, play,
SLOT_TRADE_CHILD, SLOT_TRADE_CHILD,
CanMaskSelect(), CVarGetInteger(CVAR_ENHANCEMENT("MaskSelect"), 0) /* || Randomizer_GetSettingValue(RSK_SHUFFLE_CHILD_TRADE) */,
INV_CONTENT(ITEM_TRADE_CHILD) <= ITEM_MASK_KEATON || INV_CONTENT(ITEM_TRADE_CHILD) > ITEM_MASK_TRUTH ? IS_RANDO ?
ITEM_MASK_TRUTH : Randomizer_GetPrevChildTradeItem() :
INV_CONTENT(ITEM_TRADE_CHILD) - 1, (
INV_CONTENT(ITEM_TRADE_CHILD) >= ITEM_MASK_TRUTH || INV_CONTENT(ITEM_TRADE_CHILD) < ITEM_MASK_KEATON ? INV_CONTENT(ITEM_TRADE_CHILD) <= ITEM_MASK_KEATON || INV_CONTENT(ITEM_TRADE_CHILD) > ITEM_MASK_TRUTH ?
ITEM_MASK_KEATON : ITEM_MASK_TRUTH :
INV_CONTENT(ITEM_TRADE_CHILD) + 1 INV_CONTENT(ITEM_TRADE_CHILD) - 1
),
IS_RANDO ?
Randomizer_GetNextChildTradeItem() :
(
INV_CONTENT(ITEM_TRADE_CHILD) >= ITEM_MASK_TRUTH || INV_CONTENT(ITEM_TRADE_CHILD) < ITEM_MASK_KEATON ?
ITEM_MASK_KEATON :
INV_CONTENT(ITEM_TRADE_CHILD) + 1
)
); );
//draw the adult trade select //draw the adult trade select