From ed458dc2b337db97efe2849b322e19e4f3bd9f3b Mon Sep 17 00:00:00 2001 From: gymnast86 Date: Wed, 20 May 2026 17:41:03 -0700 Subject: [PATCH] backend tracker updates --- include/d/d_item.h | 32 + src/d/d_item.cpp | 1144 +++++++++-------- src/d/d_stage.cpp | 4 + src/dusk/imgui/ImGuiMenuRandomizer.cpp | 55 +- src/dusk/imgui/ImGuiMenuRandomizer.hpp | 4 + .../randomizer/game/randomizer_context.cpp | 4 +- .../randomizer/game/randomizer_context.hpp | 3 +- src/dusk/randomizer/game/tools.cpp | 319 ++++- src/dusk/randomizer/game/tools.h | 8 +- .../world/overworld/Lanayru Province.yaml | 4 +- .../randomizer/generator/logic/item_pool.cpp | 8 + .../randomizer/generator/logic/search.cpp | 17 +- .../randomizer/generator/logic/search.hpp | 11 +- src/dusk/randomizer/generator/logic/world.cpp | 26 +- src/dusk/randomizer/generator/logic/world.hpp | 2 + 15 files changed, 1046 insertions(+), 595 deletions(-) diff --git a/include/d/d_item.h b/include/d/d_item.h index 525187ff18..23787a7340 100644 --- a/include/d/d_item.h +++ b/include/d/d_item.h @@ -305,6 +305,10 @@ int item_getcheck_func_ARROW_20(); int item_getcheck_func_ARROW_30(); int item_getcheck_func_ARROW_1(); int item_getcheck_func_PACHINKO_SHOT(); +#if TARGET_PC +int item_getcheck_func_ORDON_PORTAL(); +int item_getcheck_func_SOUTH_FARON_PORTAL(); +#endif int item_getcheck_func_WATER_BOMB_5(); int item_getcheck_func_WATER_BOMB_10(); int item_getcheck_func_WATER_BOMB_20(); @@ -338,6 +342,12 @@ int item_getcheck_func_DUNGEON_EXIT_2(); int item_getcheck_func_WALLET_LV1(); int item_getcheck_func_WALLET_LV2(); int item_getcheck_func_WALLET_LV3(); +#if TARGET_PC +int item_getcheck_func_UPPER_ZORAS_RIVER_PORTAL(); +int item_getcheck_func_CASTLE_TOWN_PORTAL(); +int item_getcheck_func_GERUDO_DESERT_PORTAL(); +int item_getcheck_func_NORTH_FARON_PORTAL(); +#endif int item_getcheck_func_ZORAS_JEWEL(); int item_getcheck_func_HAWK_EYE(); int item_getcheck_func_WOOD_STICK(); @@ -354,13 +364,23 @@ int item_getcheck_func_LIGHT_SWORD(); int item_getcheck_func_FISHING_ROD_1(); int item_getcheck_func_PACHINKO(); int item_getcheck_func_COPY_ROD_2(); +#if TARGET_PC +int item_getcheck_func_KAKARIKO_GORGE_PORTAL(); +int item_getcheck_func_KAKARIKO_VILLAGE_PORTAL(); +#endif int item_getcheck_func_BOMB_BAG_LV2(); int item_getcheck_func_BOMB_BAG_LV1(); int item_getcheck_func_BOMB_IN_BAG(); +#if TARGET_PC +int item_getcheck_func_DEATH_MOUNTAIN_PORTAL(); +#endif int item_getcheck_func_LIGHT_ARROW(); int item_getcheck_func_ARROW_LV1(); int item_getcheck_func_ARROW_LV2(); int item_getcheck_func_ARROW_LV3(); +#if TARGET_PC +int item_getcheck_func_ZORAS_DOMAIN_PORTAL(); +#endif int item_getcheck_func_LURE_ROD(); int item_getcheck_func_BOMB_ARROW(); int item_getcheck_func_HAWK_ARROW(); @@ -406,6 +426,10 @@ int item_getcheck_func_BILL(); int item_getcheck_func_WOOD_STATUE(); int item_getcheck_func_IRIAS_PENDANT(); int item_getcheck_func_HORSE_FLUTE(); +#if TARGET_PC +int item_getcheck_func_CAMP_SMALL_KEY(); +int item_getcheck_func_LAKE_HYLIA_PORTAL(); +#endif int item_getcheck_func_RAFRELS_MEMO(); int item_getcheck_func_ASHS_SCRIBBLING(); int item_getcheck_func_CHUCHU_YELLOW2(); @@ -420,12 +444,19 @@ int item_getcheck_func_FILLED_CONTAINER(); int item_getcheck_func_MIRROR_PIECE_2(); int item_getcheck_func_MIRROR_PIECE_3(); int item_getcheck_func_MIRROR_PIECE_4(); +#if TARGET_PC +int item_getcheck_func_MIRROR_CHAMBER_PORTAL(); +int item_getcheck_func_SNOWPEAK_PORTAL(); +#endif int item_getcheck_func_SMELL_YELIA_POUCH(); int item_getcheck_func_SMELL_PUMPKIN(); int item_getcheck_func_SMELL_POH(); int item_getcheck_func_SMELL_FISH(); int item_getcheck_func_SMELL_CHILDREN(); int item_getcheck_func_SMELL_MEDICINE(); +#if TARGET_PC +int item_getcheck_func_SACRED_GROVE_PORTAL(); +#endif int item_getcheck_func_M_BEETLE(); int item_getcheck_func_F_BEETLE(); int item_getcheck_func_M_BUTTERFLY(); @@ -465,6 +496,7 @@ int item_getcheck_func_HELM_SPLITTER(); int item_getcheck_func_MORTAL_DRAW(); int item_getcheck_func_JUMP_STRIKE(); int item_getcheck_func_GREAT_SPIN(); +int item_getcheck_func_ELDIN_BRIDGE_PORTAL(); #endif int item_getcheck_func_ANCIENT_DOCUMENT(); int item_getcheck_func_AIR_LETTER(); diff --git a/src/d/d_item.cpp b/src/d/d_item.cpp index 17c70ee942..4c39999e80 100644 --- a/src/d/d_item.cpp +++ b/src/d/d_item.cpp @@ -548,529 +548,534 @@ inline void getItemFunc(u8 i_itemNo) { void execItemGet(u8 i_itemNo) { #if TARGET_PC - if (randomizer_IsActive()) + if (randomizer_IsActive()) { i_itemNo = verifyProgressiveItem(i_itemNo); + // Basic checking to not update if we pickup hearts or rupees + if (i_itemNo > 0x13) + g_randomizerState.mUpdateTracker = true; + } + #endif getItemFunc(i_itemNo); } static int (*item_getcheck_func_ptr[256])() = { - item_getcheck_func_HEART, - item_getcheck_func_GREEN_RUPEE, - item_getcheck_func_BLUE_RUPEE, - item_getcheck_func_YELLOW_RUPEE, - item_getcheck_func_RED_RUPEE, - item_getcheck_func_PURPLE_RUPEE, - item_getcheck_func_ORANGE_RUPEE, - item_getcheck_func_SILVER_RUPEE, - item_getcheck_func_S_MAGIC, - item_getcheck_func_L_MAGIC, - item_getcheck_func_BOMB_5, - item_getcheck_func_BOMB_10, - item_getcheck_func_BOMB_20, - item_getcheck_func_BOMB_30, - item_getcheck_func_ARROW_10, - item_getcheck_func_ARROW_20, - item_getcheck_func_ARROW_30, - item_getcheck_func_ARROW_1, - item_getcheck_func_PACHINKO_SHOT, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_WATER_BOMB_5, - item_getcheck_func_WATER_BOMB_10, - item_getcheck_func_WATER_BOMB_20, - item_getcheck_func_WATER_BOMB_30, - item_getcheck_func_BOMB_INSECT_5, - item_getcheck_func_BOMB_INSECT_10, - item_getcheck_func_BOMB_INSECT_20, - item_getcheck_func_BOMB_INSECT_30, - item_getcheck_func_RECOVER_FAILY, - item_getcheck_func_TRIPLE_HEART, - item_getcheck_func_SMALL_KEY, - item_getcheck_func_KAKERA_HEART, - item_getcheck_func_UTUWA_HEART, - item_getcheck_func_MAP, - item_getcheck_func_COMPUS, - item_getcheck_func_DUNGEON_EXIT, - item_getcheck_func_BOSS_KEY, - item_getcheck_func_DUNGEON_BACK, - item_getcheck_func_SWORD, - item_getcheck_func_MASTER_SWORD, - item_getcheck_func_WOOD_SHIELD, - item_getcheck_func_SHIELD, - item_getcheck_func_HYLIA_SHIELD, - item_getcheck_func_TKS_LETTER, - item_getcheck_func_WEAR_CASUAL, - item_getcheck_func_WEAR_KOKIRI, - item_getcheck_func_ARMOR, - item_getcheck_func_WEAR_ZORA, - item_getcheck_func_MAGIC_LV1, - item_getcheck_func_DUNGEON_EXIT_2, - item_getcheck_func_WALLET_LV1, - item_getcheck_func_WALLET_LV2, - item_getcheck_func_WALLET_LV3, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_ZORAS_JEWEL, - item_getcheck_func_HAWK_EYE, - item_getcheck_func_WOOD_STICK, - item_getcheck_func_BOOMERANG, - item_getcheck_func_SPINNER, - item_getcheck_func_IRONBALL, - item_getcheck_func_BOW, - item_getcheck_func_HOOKSHOT, - item_getcheck_func_HVY_BOOTS, - item_getcheck_func_COPY_ROD, - item_getcheck_func_W_HOOKSHOT, - item_getcheck_func_KANTERA, - item_getcheck_func_LIGHT_SWORD, - item_getcheck_func_FISHING_ROD_1, - item_getcheck_func_PACHINKO, - item_getcheck_func_COPY_ROD_2, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_BOMB_BAG_LV2, - item_getcheck_func_BOMB_BAG_LV1, - item_getcheck_func_BOMB_IN_BAG, - item_getcheck_func_noentry, - item_getcheck_func_LIGHT_ARROW, - item_getcheck_func_ARROW_LV1, - item_getcheck_func_ARROW_LV2, - item_getcheck_func_ARROW_LV3, - item_getcheck_func_noentry, - item_getcheck_func_LURE_ROD, - item_getcheck_func_BOMB_ARROW, - item_getcheck_func_HAWK_ARROW, - item_getcheck_func_BEE_ROD, - item_getcheck_func_JEWEL_ROD, - item_getcheck_func_WORM_ROD, - item_getcheck_func_JEWEL_BEE_ROD, - item_getcheck_func_JEWEL_WORM_ROD, - item_getcheck_func_EMPTY_BOTTLE, - item_getcheck_func_RED_BOTTLE, - item_getcheck_func_GREEN_BOTTLE, - item_getcheck_func_BLUE_BOTTLE, - item_getcheck_func_MILK_BOTTLE, - item_getcheck_func_HALF_MILK_BOTTLE, - item_getcheck_func_OIL_BOTTLE, - item_getcheck_func_WATER_BOTTLE, - item_getcheck_func_OIL_BOTTLE2, - item_getcheck_func_RED_BOTTLE2, - item_getcheck_func_UGLY_SOUP, - item_getcheck_func_HOT_SPRING, - item_getcheck_func_FAIRY_BOTTLE, - item_getcheck_func_HOT_SPRING2, - item_getcheck_func_OIL2, - item_getcheck_func_OIL, - item_getcheck_func_NORMAL_BOMB, - item_getcheck_func_WATER_BOMB, - item_getcheck_func_POKE_BOMB, - item_getcheck_func_FAIRY_DROP, - item_getcheck_func_WORM, - item_getcheck_func_DROP_BOTTLE, - item_getcheck_func_BEE_CHILD, - item_getcheck_func_CHUCHU_RARE, - item_getcheck_func_CHUCHU_RED, - item_getcheck_func_CHUCHU_BLUE, - item_getcheck_func_CHUCHU_GREEN, - item_getcheck_func_CHUCHU_YELLOW, - item_getcheck_func_CHUCHU_PURPLE, - item_getcheck_func_LV1_SOUP, - item_getcheck_func_LV2_SOUP, - item_getcheck_func_LV3_SOUP, - item_getcheck_func_LETTER, - item_getcheck_func_BILL, - item_getcheck_func_WOOD_STATUE, - item_getcheck_func_IRIAS_PENDANT, - item_getcheck_func_HORSE_FLUTE, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_RAFRELS_MEMO, - item_getcheck_func_ASHS_SCRIBBLING, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_CHUCHU_YELLOW2, - item_getcheck_func_OIL_BOTTLE3, - item_getcheck_func_SHOP_BEE_CHILD, - item_getcheck_func_CHUCHU_BLACK, - item_getcheck_func_LIGHT_DROP, - item_getcheck_func_DROP_CONTAINER, - item_getcheck_func_DROP_CONTAINER02, - item_getcheck_func_DROP_CONTAINER03, - item_getcheck_func_FILLED_CONTAINER, - item_getcheck_func_MIRROR_PIECE_2, - item_getcheck_func_MIRROR_PIECE_3, - item_getcheck_func_MIRROR_PIECE_4, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_SMELL_YELIA_POUCH, - item_getcheck_func_SMELL_PUMPKIN, - item_getcheck_func_SMELL_POH, - item_getcheck_func_SMELL_FISH, - item_getcheck_func_SMELL_CHILDREN, - item_getcheck_func_SMELL_MEDICINE, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_M_BEETLE, - item_getcheck_func_F_BEETLE, - item_getcheck_func_M_BUTTERFLY, - item_getcheck_func_F_BUTTERFLY, - item_getcheck_func_M_STAG_BEETLE, - item_getcheck_func_F_STAG_BEETLE, - item_getcheck_func_M_GRASSHOPPER, - item_getcheck_func_F_GRASSHOPPER, - item_getcheck_func_M_NANAFUSHI, - item_getcheck_func_F_NANAFUSHI, - item_getcheck_func_M_DANGOMUSHI, - item_getcheck_func_F_DANGOMUSHI, - item_getcheck_func_M_MANTIS, - item_getcheck_func_F_MANTIS, - item_getcheck_func_M_LADYBUG, - item_getcheck_func_F_LADYBUG, - item_getcheck_func_M_SNAIL, - item_getcheck_func_F_SNAIL, - item_getcheck_func_M_DRAGONFLY, - item_getcheck_func_F_DRAGONFLY, - item_getcheck_func_M_ANT, - item_getcheck_func_F_ANT, - item_getcheck_func_M_MAYFLY, - item_getcheck_func_F_MAYFLY, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_POU_SPIRIT, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_ANCIENT_DOCUMENT, - item_getcheck_func_AIR_LETTER, - item_getcheck_func_ANCIENT_DOCUMENT2, - item_getcheck_func_LV7_DUNGEON_EXIT, - item_getcheck_func_LINKS_SAVINGS, - item_getcheck_func_SMALL_KEY2, - item_getcheck_func_POU_FIRE1, - item_getcheck_func_POU_FIRE2, - item_getcheck_func_POU_FIRE3, - item_getcheck_func_POU_FIRE4, - item_getcheck_func_BOSSRIDER_KEY, - item_getcheck_func_TOMATO_PUREE, - item_getcheck_func_TASTE, - item_getcheck_func_LV5_BOSS_KEY, - item_getcheck_func_SURFBOARD, - item_getcheck_func_KANTERA2, - item_getcheck_func_L2_KEY_PIECES1, - item_getcheck_func_L2_KEY_PIECES2, - item_getcheck_func_L2_KEY_PIECES3, - item_getcheck_func_KEY_OF_CARAVAN, - item_getcheck_func_LV2_BOSS_KEY, - item_getcheck_func_KEY_OF_FILONE, - item_getcheck_func_noentry, + /* 0x00 */ item_getcheck_func_HEART, + /* 0x01 */ item_getcheck_func_GREEN_RUPEE, + /* 0x02 */ item_getcheck_func_BLUE_RUPEE, + /* 0x03 */ item_getcheck_func_YELLOW_RUPEE, + /* 0x04 */ item_getcheck_func_RED_RUPEE, + /* 0x05 */ item_getcheck_func_PURPLE_RUPEE, + /* 0x06 */ item_getcheck_func_ORANGE_RUPEE, + /* 0x07 */ item_getcheck_func_SILVER_RUPEE, + /* 0x08 */ item_getcheck_func_S_MAGIC, + /* 0x09 */ item_getcheck_func_L_MAGIC, + /* 0x0A */ item_getcheck_func_BOMB_5, + /* 0x0B */ item_getcheck_func_BOMB_10, + /* 0x0C */ item_getcheck_func_BOMB_20, + /* 0x0D */ item_getcheck_func_BOMB_30, + /* 0x0E */ item_getcheck_func_ARROW_10, + /* 0x0F */ item_getcheck_func_ARROW_20, + /* 0x10 */ item_getcheck_func_ARROW_30, + /* 0x11 */ item_getcheck_func_ARROW_1, + /* 0x12 */ item_getcheck_func_PACHINKO_SHOT, + /* 0x13 */ item_getcheck_func_noentry, + /* 0x14 */ item_getcheck_func_noentry, + /* 0x15 */ item_getcheck_func_noentry, + /* 0x16 */ item_getcheck_func_WATER_BOMB_5, + /* 0x17 */ item_getcheck_func_WATER_BOMB_10, + /* 0x18 */ item_getcheck_func_WATER_BOMB_20, + /* 0x19 */ item_getcheck_func_WATER_BOMB_30, + /* 0x1A */ item_getcheck_func_BOMB_INSECT_5, + /* 0x1B */ item_getcheck_func_BOMB_INSECT_10, + /* 0x1C */ item_getcheck_func_BOMB_INSECT_20, + /* 0x1D */ item_getcheck_func_BOMB_INSECT_30, + /* 0x1E */ item_getcheck_func_RECOVER_FAILY, + /* 0x1F */ item_getcheck_func_TRIPLE_HEART, + /* 0x20 */ item_getcheck_func_SMALL_KEY, + /* 0x21 */ item_getcheck_func_KAKERA_HEART, + /* 0x22 */ item_getcheck_func_UTUWA_HEART, + /* 0x23 */ item_getcheck_func_MAP, + /* 0x24 */ item_getcheck_func_COMPUS, + /* 0x25 */ item_getcheck_func_DUNGEON_EXIT, + /* 0x26 */ item_getcheck_func_BOSS_KEY, + /* 0x27 */ item_getcheck_func_DUNGEON_BACK, + /* 0x28 */ item_getcheck_func_SWORD, + /* 0x29 */ item_getcheck_func_MASTER_SWORD, + /* 0x2A */ item_getcheck_func_WOOD_SHIELD, + /* 0x2B */ item_getcheck_func_SHIELD, + /* 0x2C */ item_getcheck_func_HYLIA_SHIELD, + /* 0x2D */ item_getcheck_func_TKS_LETTER, + /* 0x2E */ item_getcheck_func_WEAR_CASUAL, + /* 0x2F */ item_getcheck_func_WEAR_KOKIRI, + /* 0x30 */ item_getcheck_func_ARMOR, + /* 0x31 */ item_getcheck_func_WEAR_ZORA, + /* 0x32 */ item_getcheck_func_MAGIC_LV1, + /* 0x33 */ item_getcheck_func_DUNGEON_EXIT_2, + /* 0x34 */ item_getcheck_func_WALLET_LV1, + /* 0x35 */ item_getcheck_func_WALLET_LV2, + /* 0x36 */ item_getcheck_func_WALLET_LV3, + /* 0x37 */ item_getcheck_func_noentry, + /* 0x38 */ item_getcheck_func_noentry, + /* 0x39 */ item_getcheck_func_noentry, + /* 0x3A */ item_getcheck_func_noentry, + /* 0x3B */ item_getcheck_func_noentry, + /* 0x3C */ item_getcheck_func_noentry, + /* 0x3D */ item_getcheck_func_ZORAS_JEWEL, + /* 0x3E */ item_getcheck_func_HAWK_EYE, + /* 0x3F */ item_getcheck_func_WOOD_STICK, + /* 0x40 */ item_getcheck_func_BOOMERANG, + /* 0x41 */ item_getcheck_func_SPINNER, + /* 0x42 */ item_getcheck_func_IRONBALL, + /* 0x43 */ item_getcheck_func_BOW, + /* 0x44 */ item_getcheck_func_HOOKSHOT, + /* 0x45 */ item_getcheck_func_HVY_BOOTS, + /* 0x46 */ item_getcheck_func_COPY_ROD, + /* 0x47 */ item_getcheck_func_W_HOOKSHOT, + /* 0x48 */ item_getcheck_func_KANTERA, + /* 0x49 */ item_getcheck_func_LIGHT_SWORD, + /* 0x4A */ item_getcheck_func_FISHING_ROD_1, + /* 0x4B */ item_getcheck_func_PACHINKO, + /* 0x4C */ item_getcheck_func_COPY_ROD_2, + /* 0x4D */ item_getcheck_func_noentry, + /* 0x4E */ item_getcheck_func_noentry, + /* 0x4F */ item_getcheck_func_BOMB_BAG_LV2, + /* 0x50 */ item_getcheck_func_BOMB_BAG_LV1, + /* 0x51 */ item_getcheck_func_BOMB_IN_BAG, + /* 0x52 */ item_getcheck_func_noentry, + /* 0x53 */ item_getcheck_func_LIGHT_ARROW, + /* 0x54 */ item_getcheck_func_ARROW_LV1, + /* 0x55 */ item_getcheck_func_ARROW_LV2, + /* 0x56 */ item_getcheck_func_ARROW_LV3, + /* 0x57 */ item_getcheck_func_noentry, + /* 0x58 */ item_getcheck_func_LURE_ROD, + /* 0x59 */ item_getcheck_func_BOMB_ARROW, + /* 0x5A */ item_getcheck_func_HAWK_ARROW, + /* 0x5B */ item_getcheck_func_BEE_ROD, + /* 0x5C */ item_getcheck_func_JEWEL_ROD, + /* 0x5D */ item_getcheck_func_WORM_ROD, + /* 0x5E */ item_getcheck_func_JEWEL_BEE_ROD, + /* 0x5F */ item_getcheck_func_JEWEL_WORM_ROD, + /* 0x60 */ item_getcheck_func_EMPTY_BOTTLE, + /* 0x61 */ item_getcheck_func_RED_BOTTLE, + /* 0x62 */ item_getcheck_func_GREEN_BOTTLE, + /* 0x63 */ item_getcheck_func_BLUE_BOTTLE, + /* 0x64 */ item_getcheck_func_MILK_BOTTLE, + /* 0x65 */ item_getcheck_func_HALF_MILK_BOTTLE, + /* 0x66 */ item_getcheck_func_OIL_BOTTLE, + /* 0x67 */ item_getcheck_func_WATER_BOTTLE, + /* 0x68 */ item_getcheck_func_OIL_BOTTLE2, + /* 0x69 */ item_getcheck_func_RED_BOTTLE2, + /* 0x6A */ item_getcheck_func_UGLY_SOUP, + /* 0x6B */ item_getcheck_func_HOT_SPRING, + /* 0x6C */ item_getcheck_func_FAIRY_BOTTLE, + /* 0x6D */ item_getcheck_func_HOT_SPRING2, + /* 0x6E */ item_getcheck_func_OIL2, + /* 0x6F */ item_getcheck_func_OIL, + /* 0x70 */ item_getcheck_func_NORMAL_BOMB, + /* 0x71 */ item_getcheck_func_WATER_BOMB, + /* 0x72 */ item_getcheck_func_POKE_BOMB, + /* 0x73 */ item_getcheck_func_FAIRY_DROP, + /* 0x74 */ item_getcheck_func_WORM, + /* 0x75 */ item_getcheck_func_DROP_BOTTLE, + /* 0x76 */ item_getcheck_func_BEE_CHILD, + /* 0x77 */ item_getcheck_func_CHUCHU_RARE, + /* 0x78 */ item_getcheck_func_CHUCHU_RED, + /* 0x79 */ item_getcheck_func_CHUCHU_BLUE, + /* 0x7A */ item_getcheck_func_CHUCHU_GREEN, + /* 0x7B */ item_getcheck_func_CHUCHU_YELLOW, + /* 0x7C */ item_getcheck_func_CHUCHU_PURPLE, + /* 0x7D */ item_getcheck_func_LV1_SOUP, + /* 0x7E */ item_getcheck_func_LV2_SOUP, + /* 0x7F */ item_getcheck_func_LV3_SOUP, + /* 0x80 */ item_getcheck_func_LETTER, + /* 0x81 */ item_getcheck_func_BILL, + /* 0x82 */ item_getcheck_func_WOOD_STATUE, + /* 0x83 */ item_getcheck_func_IRIAS_PENDANT, + /* 0x84 */ item_getcheck_func_HORSE_FLUTE, + /* 0x85 */ item_getcheck_func_noentry, + /* 0x86 */ item_getcheck_func_noentry, + /* 0x87 */ item_getcheck_func_noentry, + /* 0x88 */ item_getcheck_func_noentry, + /* 0x89 */ item_getcheck_func_noentry, + /* 0x8A */ item_getcheck_func_noentry, + /* 0x8B */ item_getcheck_func_noentry, + /* 0x8C */ item_getcheck_func_noentry, + /* 0x8D */ item_getcheck_func_noentry, + /* 0x8E */ item_getcheck_func_noentry, + /* 0x8F */ item_getcheck_func_noentry, + /* 0x90 */ item_getcheck_func_RAFRELS_MEMO, + /* 0x91 */ item_getcheck_func_ASHS_SCRIBBLING, + /* 0x92 */ item_getcheck_func_noentry, + /* 0x93 */ item_getcheck_func_noentry, + /* 0x94 */ item_getcheck_func_noentry, + /* 0x95 */ item_getcheck_func_noentry, + /* 0x96 */ item_getcheck_func_noentry, + /* 0x97 */ item_getcheck_func_noentry, + /* 0x98 */ item_getcheck_func_noentry, + /* 0x99 */ item_getcheck_func_noentry, + /* 0x9A */ item_getcheck_func_noentry, + /* 0x9B */ item_getcheck_func_noentry, + /* 0x9C */ item_getcheck_func_CHUCHU_YELLOW2, + /* 0x9D */ item_getcheck_func_OIL_BOTTLE3, + /* 0x9E */ item_getcheck_func_SHOP_BEE_CHILD, + /* 0x9F */ item_getcheck_func_CHUCHU_BLACK, + /* 0xA0 */ item_getcheck_func_LIGHT_DROP, + /* 0xA1 */ item_getcheck_func_DROP_CONTAINER, + /* 0xA2 */ item_getcheck_func_DROP_CONTAINER02, + /* 0xA3 */ item_getcheck_func_DROP_CONTAINER03, + /* 0xA4 */ item_getcheck_func_FILLED_CONTAINER, + /* 0xA5 */ item_getcheck_func_MIRROR_PIECE_2, + /* 0xA6 */ item_getcheck_func_MIRROR_PIECE_3, + /* 0xA7 */ item_getcheck_func_MIRROR_PIECE_4, + /* 0xA8 */ item_getcheck_func_noentry, + /* 0xA9 */ item_getcheck_func_noentry, + /* 0xAA */ item_getcheck_func_noentry, + /* 0xAB */ item_getcheck_func_noentry, + /* 0xAC */ item_getcheck_func_noentry, + /* 0xAD */ item_getcheck_func_noentry, + /* 0xAE */ item_getcheck_func_noentry, + /* 0xAF */ item_getcheck_func_noentry, + /* 0xB0 */ item_getcheck_func_SMELL_YELIA_POUCH, + /* 0xB1 */ item_getcheck_func_SMELL_PUMPKIN, + /* 0xB2 */ item_getcheck_func_SMELL_POH, + /* 0xB3 */ item_getcheck_func_SMELL_FISH, + /* 0xB4 */ item_getcheck_func_SMELL_CHILDREN, + /* 0xB5 */ item_getcheck_func_SMELL_MEDICINE, + /* 0xB6 */ item_getcheck_func_noentry, + /* 0xB7 */ item_getcheck_func_noentry, + /* 0xB8 */ item_getcheck_func_noentry, + /* 0xB9 */ item_getcheck_func_noentry, + /* 0xBA */ item_getcheck_func_noentry, + /* 0xBB */ item_getcheck_func_noentry, + /* 0xBC */ item_getcheck_func_noentry, + /* 0xBD */ item_getcheck_func_noentry, + /* 0xBE */ item_getcheck_func_noentry, + /* 0xBF */ item_getcheck_func_noentry, + /* 0xC0 */ item_getcheck_func_M_BEETLE, + /* 0xC1 */ item_getcheck_func_F_BEETLE, + /* 0xC2 */ item_getcheck_func_M_BUTTERFLY, + /* 0xC3 */ item_getcheck_func_F_BUTTERFLY, + /* 0xC4 */ item_getcheck_func_M_STAG_BEETLE, + /* 0xC5 */ item_getcheck_func_F_STAG_BEETLE, + /* 0xC6 */ item_getcheck_func_M_GRASSHOPPER, + /* 0xC7 */ item_getcheck_func_F_GRASSHOPPER, + /* 0xC8 */ item_getcheck_func_M_NANAFUSHI, + /* 0xC9 */ item_getcheck_func_F_NANAFUSHI, + /* 0xCA */ item_getcheck_func_M_DANGOMUSHI, + /* 0xCB */ item_getcheck_func_F_DANGOMUSHI, + /* 0xCC */ item_getcheck_func_M_MANTIS, + /* 0xCD */ item_getcheck_func_F_MANTIS, + /* 0xCE */ item_getcheck_func_M_LADYBUG, + /* 0xCF */ item_getcheck_func_F_LADYBUG, + /* 0xD0 */ item_getcheck_func_M_SNAIL, + /* 0xD1 */ item_getcheck_func_F_SNAIL, + /* 0xD2 */ item_getcheck_func_M_DRAGONFLY, + /* 0xD3 */ item_getcheck_func_F_DRAGONFLY, + /* 0xD4 */ item_getcheck_func_M_ANT, + /* 0xD5 */ item_getcheck_func_F_ANT, + /* 0xD6 */ item_getcheck_func_M_MAYFLY, + /* 0xD7 */ item_getcheck_func_F_MAYFLY, + /* 0xD8 */ item_getcheck_func_noentry, + /* 0xD9 */ item_getcheck_func_noentry, + /* 0xDA */ item_getcheck_func_noentry, + /* 0xDB */ item_getcheck_func_noentry, + /* 0xDC */ item_getcheck_func_noentry, + /* 0xDD */ item_getcheck_func_noentry, + /* 0xDE */ item_getcheck_func_noentry, + /* 0xDF */ item_getcheck_func_noentry, + /* 0xE0 */ item_getcheck_func_POU_SPIRIT, + /* 0xE1 */ item_getcheck_func_noentry, + /* 0xE2 */ item_getcheck_func_noentry, + /* 0xE3 */ item_getcheck_func_noentry, + /* 0xE4 */ item_getcheck_func_noentry, + /* 0xE5 */ item_getcheck_func_noentry, + /* 0xE6 */ item_getcheck_func_noentry, + /* 0xE7 */ item_getcheck_func_noentry, + /* 0xE8 */ item_getcheck_func_noentry, + /* 0xE9 */ item_getcheck_func_ANCIENT_DOCUMENT, + /* 0xEA */ item_getcheck_func_AIR_LETTER, + /* 0xEB */ item_getcheck_func_ANCIENT_DOCUMENT2, + /* 0xEC */ item_getcheck_func_LV7_DUNGEON_EXIT, + /* 0xED */ item_getcheck_func_LINKS_SAVINGS, + /* 0xEE */ item_getcheck_func_SMALL_KEY2, + /* 0xEF */ item_getcheck_func_POU_FIRE1, + /* 0xF0 */ item_getcheck_func_POU_FIRE2, + /* 0xF1 */ item_getcheck_func_POU_FIRE3, + /* 0xF2 */ item_getcheck_func_POU_FIRE4, + /* 0xF3 */ item_getcheck_func_BOSSRIDER_KEY, + /* 0xF4 */ item_getcheck_func_TOMATO_PUREE, + /* 0xF5 */ item_getcheck_func_TASTE, + /* 0xF6 */ item_getcheck_func_LV5_BOSS_KEY, + /* 0xF7 */ item_getcheck_func_SURFBOARD, + /* 0xF8 */ item_getcheck_func_KANTERA2, + /* 0xF9 */ item_getcheck_func_L2_KEY_PIECES1, + /* 0xFA */ item_getcheck_func_L2_KEY_PIECES2, + /* 0xFB */ item_getcheck_func_L2_KEY_PIECES3, + /* 0xFC */ item_getcheck_func_KEY_OF_CARAVAN, + /* 0xFD */ item_getcheck_func_LV2_BOSS_KEY, + /* 0xFE */ item_getcheck_func_KEY_OF_FILONE, + /* 0xFF */ item_getcheck_func_noentry, }; #if TARGET_PC static int (*item_getcheck_func_ptr_randomizer[256])() = { - item_getcheck_func_HEART, - item_getcheck_func_GREEN_RUPEE, - item_getcheck_func_BLUE_RUPEE, - item_getcheck_func_YELLOW_RUPEE, - item_getcheck_func_RED_RUPEE, - item_getcheck_func_PURPLE_RUPEE, - item_getcheck_func_ORANGE_RUPEE, - item_getcheck_func_SILVER_RUPEE, - item_getcheck_func_S_MAGIC, - item_getcheck_func_L_MAGIC, - item_getcheck_func_BOMB_5, - item_getcheck_func_BOMB_10, - item_getcheck_func_BOMB_20, - item_getcheck_func_BOMB_30, - item_getcheck_func_ARROW_10, - item_getcheck_func_ARROW_20, - item_getcheck_func_ARROW_30, - item_getcheck_func_ARROW_1, - item_getcheck_func_PACHINKO_SHOT, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_WATER_BOMB_5, - item_getcheck_func_WATER_BOMB_10, - item_getcheck_func_WATER_BOMB_20, - item_getcheck_func_WATER_BOMB_30, - item_getcheck_func_BOMB_INSECT_5, - item_getcheck_func_BOMB_INSECT_10, - item_getcheck_func_BOMB_INSECT_20, - item_getcheck_func_BOMB_INSECT_30, - item_getcheck_func_RECOVER_FAILY, - item_getcheck_func_TRIPLE_HEART, - item_getcheck_func_SMALL_KEY, - item_getcheck_func_KAKERA_HEART, - item_getcheck_func_UTUWA_HEART, - item_getcheck_func_MAP, - item_getcheck_func_COMPUS, - item_getcheck_func_DUNGEON_EXIT, - item_getcheck_func_BOSS_KEY, - item_getcheck_func_DUNGEON_BACK, - item_getcheck_func_SWORD, - item_getcheck_func_MASTER_SWORD, - item_getcheck_func_WOOD_SHIELD, - item_getcheck_func_SHIELD, - item_getcheck_func_HYLIA_SHIELD, - item_getcheck_func_TKS_LETTER, - item_getcheck_func_WEAR_CASUAL, - item_getcheck_func_WEAR_KOKIRI, - item_getcheck_func_ARMOR, - item_getcheck_func_WEAR_ZORA, - item_getcheck_func_MAGIC_LV1, - item_getcheck_func_DUNGEON_EXIT_2, - item_getcheck_func_WALLET_LV1, - item_getcheck_func_WALLET_LV2, - item_getcheck_func_WALLET_LV3, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_ZORAS_JEWEL, - item_getcheck_func_HAWK_EYE, - item_getcheck_func_WOOD_STICK, - item_getcheck_func_BOOMERANG, - item_getcheck_func_SPINNER, - item_getcheck_func_IRONBALL, - item_getcheck_func_BOW, - item_getcheck_func_HOOKSHOT, - item_getcheck_func_HVY_BOOTS, - item_getcheck_func_COPY_ROD, - item_getcheck_func_W_HOOKSHOT, - item_getcheck_func_KANTERA, - item_getcheck_func_LIGHT_SWORD, - item_getcheck_func_FISHING_ROD_1, - item_getcheck_func_PACHINKO, - item_getcheck_func_COPY_ROD_2, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_BOMB_BAG_LV2, - item_getcheck_func_BOMB_BAG_LV1, - item_getcheck_func_BOMB_IN_BAG, - item_getcheck_func_noentry, - item_getcheck_func_LIGHT_ARROW, - item_getcheck_func_ARROW_LV1, - item_getcheck_func_ARROW_LV2, - item_getcheck_func_ARROW_LV3, - item_getcheck_func_noentry, - item_getcheck_func_LURE_ROD, - item_getcheck_func_BOMB_ARROW, - item_getcheck_func_HAWK_ARROW, - item_getcheck_func_BEE_ROD, - item_getcheck_func_JEWEL_ROD, - item_getcheck_func_WORM_ROD, - item_getcheck_func_JEWEL_BEE_ROD, - item_getcheck_func_JEWEL_WORM_ROD, - item_getcheck_func_EMPTY_BOTTLE, - item_getcheck_func_RED_BOTTLE, - item_getcheck_func_GREEN_BOTTLE, - item_getcheck_func_BLUE_BOTTLE, - item_getcheck_func_MILK_BOTTLE, - item_getcheck_func_HALF_MILK_BOTTLE, - item_getcheck_func_OIL_BOTTLE, - item_getcheck_func_WATER_BOTTLE, - item_getcheck_func_OIL_BOTTLE2, - item_getcheck_func_RED_BOTTLE2, - item_getcheck_func_UGLY_SOUP, - item_getcheck_func_HOT_SPRING, - item_getcheck_func_FAIRY_BOTTLE, - item_getcheck_func_HOT_SPRING2, - item_getcheck_func_OIL2, - item_getcheck_func_OIL, - item_getcheck_func_NORMAL_BOMB, - item_getcheck_func_WATER_BOMB, - item_getcheck_func_POKE_BOMB, - item_getcheck_func_FAIRY_DROP, - item_getcheck_func_WORM, - item_getcheck_func_DROP_BOTTLE, - item_getcheck_func_BEE_CHILD, - item_getcheck_func_CHUCHU_RARE, - item_getcheck_func_CHUCHU_RED, - item_getcheck_func_CHUCHU_BLUE, - item_getcheck_func_CHUCHU_GREEN, - item_getcheck_func_CHUCHU_YELLOW, - item_getcheck_func_CHUCHU_PURPLE, - item_getcheck_func_LV1_SOUP, - item_getcheck_func_LV2_SOUP, - item_getcheck_func_LV3_SOUP, - item_getcheck_func_LETTER, - item_getcheck_func_BILL, - item_getcheck_func_WOOD_STATUE, - item_getcheck_func_IRIAS_PENDANT, - item_getcheck_func_HORSE_FLUTE, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_RAFRELS_MEMO, - item_getcheck_func_ASHS_SCRIBBLING, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_CHUCHU_YELLOW2, - item_getcheck_func_OIL_BOTTLE3, - item_getcheck_func_SHOP_BEE_CHILD, - item_getcheck_func_CHUCHU_BLACK, - item_getcheck_func_LIGHT_DROP, - item_getcheck_func_DROP_CONTAINER, - item_getcheck_func_DROP_CONTAINER02, - item_getcheck_func_DROP_CONTAINER03, - item_getcheck_func_FILLED_CONTAINER, - item_getcheck_func_MIRROR_PIECE_2, - item_getcheck_func_MIRROR_PIECE_3, - item_getcheck_func_MIRROR_PIECE_4, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_SMELL_YELIA_POUCH, - item_getcheck_func_SMELL_PUMPKIN, - item_getcheck_func_SMELL_POH, - item_getcheck_func_SMELL_FISH, - item_getcheck_func_SMELL_CHILDREN, - item_getcheck_func_SMELL_MEDICINE, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_M_BEETLE, - item_getcheck_func_F_BEETLE, - item_getcheck_func_M_BUTTERFLY, - item_getcheck_func_F_BUTTERFLY, - item_getcheck_func_M_STAG_BEETLE, - item_getcheck_func_F_STAG_BEETLE, - item_getcheck_func_M_GRASSHOPPER, - item_getcheck_func_F_GRASSHOPPER, - item_getcheck_func_M_NANAFUSHI, - item_getcheck_func_F_NANAFUSHI, - item_getcheck_func_M_DANGOMUSHI, - item_getcheck_func_F_DANGOMUSHI, - item_getcheck_func_M_MANTIS, - item_getcheck_func_F_MANTIS, - item_getcheck_func_M_LADYBUG, - item_getcheck_func_F_LADYBUG, - item_getcheck_func_M_SNAIL, - item_getcheck_func_F_SNAIL, - item_getcheck_func_M_DRAGONFLY, - item_getcheck_func_F_DRAGONFLY, - item_getcheck_func_M_ANT, - item_getcheck_func_F_ANT, - item_getcheck_func_M_MAYFLY, - item_getcheck_func_F_MAYFLY, - item_getcheck_func_FUSED_SHADOW_1, - item_getcheck_func_FUSED_SHADOW_2, - item_getcheck_func_FUSED_SHADOW_3, - item_getcheck_func_MIRROR_PIECE_1, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_noentry, - item_getcheck_func_POU_SPIRIT, - item_getcheck_func_ENDING_BLOW, - item_getcheck_func_SHIELD_ATTACK, - item_getcheck_func_BACK_SLICE, - item_getcheck_func_HELM_SPLITTER, - item_getcheck_func_MORTAL_DRAW, - item_getcheck_func_JUMP_STRIKE, - item_getcheck_func_GREAT_SPIN, - item_getcheck_func_noentry, - item_getcheck_func_ANCIENT_DOCUMENT, - item_getcheck_func_AIR_LETTER, - item_getcheck_func_ANCIENT_DOCUMENT2, - item_getcheck_func_LV7_DUNGEON_EXIT, - item_getcheck_func_LINKS_SAVINGS, - item_getcheck_func_SMALL_KEY2, - item_getcheck_func_POU_FIRE1, - item_getcheck_func_POU_FIRE2, - item_getcheck_func_POU_FIRE3, - item_getcheck_func_POU_FIRE4, - item_getcheck_func_BOSSRIDER_KEY, - item_getcheck_func_TOMATO_PUREE, - item_getcheck_func_TASTE, - item_getcheck_func_LV5_BOSS_KEY, - item_getcheck_func_SURFBOARD, - item_getcheck_func_KANTERA2, - item_getcheck_func_L2_KEY_PIECES1, - item_getcheck_func_L2_KEY_PIECES2, - item_getcheck_func_L2_KEY_PIECES3, - item_getcheck_func_KEY_OF_CARAVAN, - item_getcheck_func_LV2_BOSS_KEY, - item_getcheck_func_KEY_OF_FILONE, - item_getcheck_func_noentry, + /* 0x00 */ item_getcheck_func_HEART, + /* 0x01 */ item_getcheck_func_GREEN_RUPEE, + /* 0x02 */ item_getcheck_func_BLUE_RUPEE, + /* 0x03 */ item_getcheck_func_YELLOW_RUPEE, + /* 0x04 */ item_getcheck_func_RED_RUPEE, + /* 0x05 */ item_getcheck_func_PURPLE_RUPEE, + /* 0x06 */ item_getcheck_func_ORANGE_RUPEE, + /* 0x07 */ item_getcheck_func_SILVER_RUPEE, + /* 0x08 */ item_getcheck_func_S_MAGIC, + /* 0x09 */ item_getcheck_func_L_MAGIC, + /* 0x0A */ item_getcheck_func_BOMB_5, + /* 0x0B */ item_getcheck_func_BOMB_10, + /* 0x0C */ item_getcheck_func_BOMB_20, + /* 0x0D */ item_getcheck_func_BOMB_30, + /* 0x0E */ item_getcheck_func_ARROW_10, + /* 0x0F */ item_getcheck_func_ARROW_20, + /* 0x10 */ item_getcheck_func_ARROW_30, + /* 0x11 */ item_getcheck_func_ARROW_1, + /* 0x12 */ item_getcheck_func_PACHINKO_SHOT, + /* 0x13 */ item_getcheck_func_noentry, + /* 0x14 */ item_getcheck_func_ORDON_PORTAL, + /* 0x15 */ item_getcheck_func_SOUTH_FARON_PORTAL, + /* 0x16 */ item_getcheck_func_WATER_BOMB_5, + /* 0x17 */ item_getcheck_func_WATER_BOMB_10, + /* 0x18 */ item_getcheck_func_WATER_BOMB_20, + /* 0x19 */ item_getcheck_func_WATER_BOMB_30, + /* 0x1A */ item_getcheck_func_BOMB_INSECT_5, + /* 0x1B */ item_getcheck_func_BOMB_INSECT_10, + /* 0x1C */ item_getcheck_func_BOMB_INSECT_20, + /* 0x1D */ item_getcheck_func_BOMB_INSECT_30, + /* 0x1E */ item_getcheck_func_RECOVER_FAILY, + /* 0x1F */ item_getcheck_func_TRIPLE_HEART, + /* 0x20 */ item_getcheck_func_SMALL_KEY, + /* 0x21 */ item_getcheck_func_KAKERA_HEART, + /* 0x22 */ item_getcheck_func_UTUWA_HEART, + /* 0x23 */ item_getcheck_func_MAP, + /* 0x24 */ item_getcheck_func_COMPUS, + /* 0x25 */ item_getcheck_func_DUNGEON_EXIT, + /* 0x26 */ item_getcheck_func_BOSS_KEY, + /* 0x27 */ item_getcheck_func_DUNGEON_BACK, + /* 0x28 */ item_getcheck_func_SWORD, + /* 0x29 */ item_getcheck_func_MASTER_SWORD, + /* 0x2A */ item_getcheck_func_WOOD_SHIELD, + /* 0x2B */ item_getcheck_func_SHIELD, + /* 0x2C */ item_getcheck_func_HYLIA_SHIELD, + /* 0x2D */ item_getcheck_func_TKS_LETTER, + /* 0x2E */ item_getcheck_func_WEAR_CASUAL, + /* 0x2F */ item_getcheck_func_WEAR_KOKIRI, + /* 0x30 */ item_getcheck_func_ARMOR, + /* 0x31 */ item_getcheck_func_WEAR_ZORA, + /* 0x32 */ item_getcheck_func_MAGIC_LV1, + /* 0x33 */ item_getcheck_func_DUNGEON_EXIT_2, + /* 0x34 */ item_getcheck_func_WALLET_LV1, + /* 0x35 */ item_getcheck_func_WALLET_LV2, + /* 0x36 */ item_getcheck_func_WALLET_LV3, + /* 0x37 */ item_getcheck_func_noentry, + /* 0x38 */ item_getcheck_func_noentry, + /* 0x39 */ item_getcheck_func_UPPER_ZORAS_RIVER_PORTAL, + /* 0x3A */ item_getcheck_func_CASTLE_TOWN_PORTAL, + /* 0x3B */ item_getcheck_func_GERUDO_DESERT_PORTAL, + /* 0x3C */ item_getcheck_func_NORTH_FARON_PORTAL, + /* 0x3D */ item_getcheck_func_ZORAS_JEWEL, + /* 0x3E */ item_getcheck_func_HAWK_EYE, + /* 0x3F */ item_getcheck_func_WOOD_STICK, + /* 0x40 */ item_getcheck_func_BOOMERANG, + /* 0x41 */ item_getcheck_func_SPINNER, + /* 0x42 */ item_getcheck_func_IRONBALL, + /* 0x43 */ item_getcheck_func_BOW, + /* 0x44 */ item_getcheck_func_HOOKSHOT, + /* 0x45 */ item_getcheck_func_HVY_BOOTS, + /* 0x46 */ item_getcheck_func_COPY_ROD, + /* 0x47 */ item_getcheck_func_W_HOOKSHOT, + /* 0x48 */ item_getcheck_func_KANTERA, + /* 0x49 */ item_getcheck_func_LIGHT_SWORD, + /* 0x4A */ item_getcheck_func_FISHING_ROD_1, + /* 0x4B */ item_getcheck_func_PACHINKO, + /* 0x4C */ item_getcheck_func_COPY_ROD_2, + /* 0x4D */ item_getcheck_func_KAKARIKO_GORGE_PORTAL, + /* 0x4E */ item_getcheck_func_KAKARIKO_VILLAGE_PORTAL, + /* 0x4F */ item_getcheck_func_BOMB_BAG_LV2, + /* 0x50 */ item_getcheck_func_BOMB_BAG_LV1, + /* 0x51 */ item_getcheck_func_BOMB_IN_BAG, + /* 0x52 */ item_getcheck_func_DEATH_MOUNTAIN_PORTAL, + /* 0x53 */ item_getcheck_func_LIGHT_ARROW, + /* 0x54 */ item_getcheck_func_ARROW_LV1, + /* 0x55 */ item_getcheck_func_ARROW_LV2, + /* 0x56 */ item_getcheck_func_ARROW_LV3, + /* 0x57 */ item_getcheck_func_ZORAS_DOMAIN_PORTAL, + /* 0x58 */ item_getcheck_func_LURE_ROD, + /* 0x59 */ item_getcheck_func_BOMB_ARROW, + /* 0x5A */ item_getcheck_func_HAWK_ARROW, + /* 0x5B */ item_getcheck_func_BEE_ROD, + /* 0x5C */ item_getcheck_func_JEWEL_ROD, + /* 0x5D */ item_getcheck_func_WORM_ROD, + /* 0x5E */ item_getcheck_func_JEWEL_BEE_ROD, + /* 0x5F */ item_getcheck_func_JEWEL_WORM_ROD, + /* 0x60 */ item_getcheck_func_EMPTY_BOTTLE, + /* 0x61 */ item_getcheck_func_RED_BOTTLE, + /* 0x62 */ item_getcheck_func_GREEN_BOTTLE, + /* 0x63 */ item_getcheck_func_BLUE_BOTTLE, + /* 0x64 */ item_getcheck_func_MILK_BOTTLE, + /* 0x65 */ item_getcheck_func_HALF_MILK_BOTTLE, + /* 0x66 */ item_getcheck_func_OIL_BOTTLE, + /* 0x67 */ item_getcheck_func_WATER_BOTTLE, + /* 0x68 */ item_getcheck_func_OIL_BOTTLE2, + /* 0x69 */ item_getcheck_func_RED_BOTTLE2, + /* 0x6A */ item_getcheck_func_UGLY_SOUP, + /* 0x6B */ item_getcheck_func_HOT_SPRING, + /* 0x6C */ item_getcheck_func_FAIRY_BOTTLE, + /* 0x6D */ item_getcheck_func_HOT_SPRING2, + /* 0x6E */ item_getcheck_func_OIL2, + /* 0x6F */ item_getcheck_func_OIL, + /* 0x70 */ item_getcheck_func_NORMAL_BOMB, + /* 0x71 */ item_getcheck_func_WATER_BOMB, + /* 0x72 */ item_getcheck_func_POKE_BOMB, + /* 0x73 */ item_getcheck_func_FAIRY_DROP, + /* 0x74 */ item_getcheck_func_WORM, + /* 0x75 */ item_getcheck_func_DROP_BOTTLE, + /* 0x76 */ item_getcheck_func_BEE_CHILD, + /* 0x77 */ item_getcheck_func_CHUCHU_RARE, + /* 0x78 */ item_getcheck_func_CHUCHU_RED, + /* 0x79 */ item_getcheck_func_CHUCHU_BLUE, + /* 0x7A */ item_getcheck_func_CHUCHU_GREEN, + /* 0x7B */ item_getcheck_func_CHUCHU_YELLOW, + /* 0x7C */ item_getcheck_func_CHUCHU_PURPLE, + /* 0x7D */ item_getcheck_func_LV1_SOUP, + /* 0x7E */ item_getcheck_func_LV2_SOUP, + /* 0x7F */ item_getcheck_func_LV3_SOUP, + /* 0x80 */ item_getcheck_func_LETTER, + /* 0x81 */ item_getcheck_func_BILL, + /* 0x82 */ item_getcheck_func_WOOD_STATUE, + /* 0x83 */ item_getcheck_func_IRIAS_PENDANT, + /* 0x84 */ item_getcheck_func_HORSE_FLUTE, + /* 0x85 */ item_getcheck_func_noentry, + /* 0x86 */ item_getcheck_func_noentry, + /* 0x87 */ item_getcheck_func_noentry, + /* 0x88 */ item_getcheck_func_noentry, + /* 0x89 */ item_getcheck_func_noentry, + /* 0x8A */ item_getcheck_func_noentry, + /* 0x8B */ item_getcheck_func_noentry, + /* 0x8C */ item_getcheck_func_noentry, + /* 0x8D */ item_getcheck_func_noentry, + /* 0x8E */ item_getcheck_func_CAMP_SMALL_KEY, + /* 0x8F */ item_getcheck_func_LAKE_HYLIA_PORTAL, + /* 0x90 */ item_getcheck_func_RAFRELS_MEMO, + /* 0x91 */ item_getcheck_func_ASHS_SCRIBBLING, + /* 0x92 */ item_getcheck_func_noentry, + /* 0x93 */ item_getcheck_func_noentry, + /* 0x94 */ item_getcheck_func_noentry, + /* 0x95 */ item_getcheck_func_noentry, + /* 0x96 */ item_getcheck_func_noentry, + /* 0x97 */ item_getcheck_func_noentry, + /* 0x98 */ item_getcheck_func_noentry, + /* 0x99 */ item_getcheck_func_noentry, + /* 0x9A */ item_getcheck_func_noentry, + /* 0x9B */ item_getcheck_func_noentry, + /* 0x9C */ item_getcheck_func_CHUCHU_YELLOW2, + /* 0x9D */ item_getcheck_func_OIL_BOTTLE3, + /* 0x9E */ item_getcheck_func_SHOP_BEE_CHILD, + /* 0x9F */ item_getcheck_func_CHUCHU_BLACK, + /* 0xA0 */ item_getcheck_func_LIGHT_DROP, + /* 0xA1 */ item_getcheck_func_DROP_CONTAINER, + /* 0xA2 */ item_getcheck_func_DROP_CONTAINER02, + /* 0xA3 */ item_getcheck_func_DROP_CONTAINER03, + /* 0xA4 */ item_getcheck_func_FILLED_CONTAINER, + /* 0xA5 */ item_getcheck_func_MIRROR_PIECE_2, + /* 0xA6 */ item_getcheck_func_MIRROR_PIECE_3, + /* 0xA7 */ item_getcheck_func_MIRROR_PIECE_4, + /* 0xA8 */ item_getcheck_func_noentry, + /* 0xA9 */ item_getcheck_func_noentry, + /* 0xAA */ item_getcheck_func_noentry, + /* 0xAB */ item_getcheck_func_noentry, + /* 0xAC */ item_getcheck_func_noentry, + /* 0xAD */ item_getcheck_func_noentry, + /* 0xAE */ item_getcheck_func_MIRROR_CHAMBER_PORTAL, + /* 0xAF */ item_getcheck_func_SNOWPEAK_PORTAL, + /* 0xB0 */ item_getcheck_func_SMELL_YELIA_POUCH, + /* 0xB1 */ item_getcheck_func_SMELL_PUMPKIN, + /* 0xB2 */ item_getcheck_func_SMELL_POH, + /* 0xB3 */ item_getcheck_func_SMELL_FISH, + /* 0xB4 */ item_getcheck_func_SMELL_CHILDREN, + /* 0xB5 */ item_getcheck_func_SMELL_MEDICINE, + /* 0xB6 */ item_getcheck_func_noentry, + /* 0xB7 */ item_getcheck_func_noentry, + /* 0xB8 */ item_getcheck_func_noentry, + /* 0xB9 */ item_getcheck_func_noentry, + /* 0xBA */ item_getcheck_func_noentry, + /* 0xBB */ item_getcheck_func_noentry, + /* 0xBC */ item_getcheck_func_noentry, + /* 0xBD */ item_getcheck_func_noentry, + /* 0xBE */ item_getcheck_func_noentry, + /* 0xBF */ item_getcheck_func_SACRED_GROVE_PORTAL, + /* 0xC0 */ item_getcheck_func_M_BEETLE, + /* 0xC1 */ item_getcheck_func_F_BEETLE, + /* 0xC2 */ item_getcheck_func_M_BUTTERFLY, + /* 0xC3 */ item_getcheck_func_F_BUTTERFLY, + /* 0xC4 */ item_getcheck_func_M_STAG_BEETLE, + /* 0xC5 */ item_getcheck_func_F_STAG_BEETLE, + /* 0xC6 */ item_getcheck_func_M_GRASSHOPPER, + /* 0xC7 */ item_getcheck_func_F_GRASSHOPPER, + /* 0xC8 */ item_getcheck_func_M_NANAFUSHI, + /* 0xC9 */ item_getcheck_func_F_NANAFUSHI, + /* 0xCA */ item_getcheck_func_M_DANGOMUSHI, + /* 0xCB */ item_getcheck_func_F_DANGOMUSHI, + /* 0xCC */ item_getcheck_func_M_MANTIS, + /* 0xCD */ item_getcheck_func_F_MANTIS, + /* 0xCE */ item_getcheck_func_M_LADYBUG, + /* 0xCF */ item_getcheck_func_F_LADYBUG, + /* 0xD0 */ item_getcheck_func_M_SNAIL, + /* 0xD1 */ item_getcheck_func_F_SNAIL, + /* 0xD2 */ item_getcheck_func_M_DRAGONFLY, + /* 0xD3 */ item_getcheck_func_F_DRAGONFLY, + /* 0xD4 */ item_getcheck_func_M_ANT, + /* 0xD5 */ item_getcheck_func_F_ANT, + /* 0xD6 */ item_getcheck_func_M_MAYFLY, + /* 0xD7 */ item_getcheck_func_F_MAYFLY, + /* 0xD8 */ item_getcheck_func_FUSED_SHADOW_1, + /* 0xD9 */ item_getcheck_func_FUSED_SHADOW_2, + /* 0xDA */ item_getcheck_func_FUSED_SHADOW_3, + /* 0xDB */ item_getcheck_func_MIRROR_PIECE_1, + /* 0xDC */ item_getcheck_func_noentry, + /* 0xDD */ item_getcheck_func_noentry, + /* 0xDE */ item_getcheck_func_noentry, + /* 0xDF */ item_getcheck_func_noentry, + /* 0xE0 */ item_getcheck_func_POU_SPIRIT, + /* 0xE1 */ item_getcheck_func_ENDING_BLOW, + /* 0xE2 */ item_getcheck_func_SHIELD_ATTACK, + /* 0xE3 */ item_getcheck_func_BACK_SLICE, + /* 0xE4 */ item_getcheck_func_HELM_SPLITTER, + /* 0xE5 */ item_getcheck_func_MORTAL_DRAW, + /* 0xE6 */ item_getcheck_func_JUMP_STRIKE, + /* 0xE7 */ item_getcheck_func_GREAT_SPIN, + /* 0xE8 */ item_getcheck_func_ELDIN_BRIDGE_PORTAL, + /* 0xE9 */ item_getcheck_func_ANCIENT_DOCUMENT, + /* 0xEA */ item_getcheck_func_AIR_LETTER, + /* 0xEB */ item_getcheck_func_ANCIENT_DOCUMENT2, + /* 0xEC */ item_getcheck_func_LV7_DUNGEON_EXIT, + /* 0xED */ item_getcheck_func_LINKS_SAVINGS, + /* 0xEE */ item_getcheck_func_SMALL_KEY2, + /* 0xEF */ item_getcheck_func_POU_FIRE1, + /* 0xF0 */ item_getcheck_func_POU_FIRE2, + /* 0xF1 */ item_getcheck_func_POU_FIRE3, + /* 0xF2 */ item_getcheck_func_POU_FIRE4, + /* 0xF3 */ item_getcheck_func_BOSSRIDER_KEY, + /* 0xF4 */ item_getcheck_func_TOMATO_PUREE, + /* 0xF5 */ item_getcheck_func_TASTE, + /* 0xF6 */ item_getcheck_func_LV5_BOSS_KEY, + /* 0xF7 */ item_getcheck_func_SURFBOARD, + /* 0xF8 */ item_getcheck_func_KANTERA2, + /* 0xF9 */ item_getcheck_func_L2_KEY_PIECES1, + /* 0xFA */ item_getcheck_func_L2_KEY_PIECES2, + /* 0xFB */ item_getcheck_func_L2_KEY_PIECES3, + /* 0xFC */ item_getcheck_func_KEY_OF_CARAVAN, + /* 0xFD */ item_getcheck_func_LV2_BOSS_KEY, + /* 0xFE */ item_getcheck_func_KEY_OF_FILONE, + /* 0xFF */ item_getcheck_func_noentry, }; #endif @@ -1217,9 +1222,9 @@ void item_func_PACHINKO_SHOT() { #if TARGET_PC void item_func_FOOLISH_ITEM() { // Failsafe: Make sure the count does not somehow exceed 100 - if (g_randomizerState.foolishItemCount < 100) + if (g_randomizerState.mFoolishItemCount < 100) { - g_randomizerState.foolishItemCount += 1; + g_randomizerState.mFoolishItemCount += 1; } } @@ -1470,7 +1475,7 @@ void item_func_CASTLE_TOWN_PORTAL() { } void item_func_GERUDO_DESERT_PORTAL() { - dComIfGs_onStageSwitch(0xA, 0x15); // Unlock Desrt Portal + dComIfGs_onStageSwitch(0xA, 0x15); // Unlock Desert Portal } void item_func_NORTH_FARON_PORTAL() { @@ -1983,15 +1988,6 @@ void item_func_MIRROR_PIECE_2() { #if TARGET_PC if (randomizer_IsActive()) { dComIfGs_onCollectMirror(1); - // TODO rando - /* - Adding rando code until framework is implemented - // Check if the requirement for the HC barrier is set to shards, and if so, set the flag - rando::gRandomizer->checkSetHCBarrierFlag(rando::HC_Mirror_Shards, 2); - - // Check if the requirement for the HC BK is set to shards, and if so, set the flag - rando::gRandomizer->checkSetHCBkFlag(rando::HC_BK_Mirror_Shards, 2); - */ } #endif } @@ -2000,15 +1996,6 @@ void item_func_MIRROR_PIECE_3() { #if TARGET_PC if (randomizer_IsActive()) { dComIfGs_onCollectMirror(2); - // TODO rando - /* - Adding rando code until framework is implemented - // Check if the requirement for the HC barrier is set to shards, and if so, set the flag - rando::gRandomizer->checkSetHCBarrierFlag(rando::HC_Mirror_Shards, 3); - - // Check if the requirement for the HC BK is set to shards, and if so, set the flag - rando::gRandomizer->checkSetHCBkFlag(rando::HC_BK_Mirror_Shards, 3); - */ } #endif } @@ -2017,21 +2004,6 @@ void item_func_MIRROR_PIECE_4() { #if TARGET_PC if (randomizer_IsActive()) { dComIfGs_onCollectMirror(3); - // TODO rando - /* - Adding rando code until framework is implemented - // If the player has the palace requirement set to Mirror Shards. - if (headerPtr->getPalaceRequirements() == rando::PalaceEntryRequirements::PoT_Mirror_Shards) - { - events::setSaveFileEventFlag(libtp::data::flags::FIXED_THE_MIRROR_OF_TWILIGHT); - } - - // Check if the requirement for the HC barrier is set to shards, and if so, set the flag - rando::gRandomizer->checkSetHCBarrierFlag(rando::HC_Mirror_Shards, 4); - - // Check if the requirement for the HC BK is set to shards, and if so, set the flag - rando::gRandomizer->checkSetHCBkFlag(rando::HC_BK_Mirror_Shards, 4); - */ } #endif } @@ -2493,6 +2465,16 @@ int item_getcheck_func_PACHINKO_SHOT() { return dComIfGs_isItemFirstBit(dItemNo_PACHINKO_SHOT_e); } +#if TARGET_PC +int item_getcheck_func_ORDON_PORTAL() { + return dComIfGs_isStageSwitch(0x0, 0x34); // Unlock Ordon Portal +} + +int item_getcheck_func_SOUTH_FARON_PORTAL() { + return dComIfGs_isStageSwitch(0x2, 0x47); // Unlock S Faron Portal +} +#endif + int item_getcheck_func_WATER_BOMB_5() { return -1; } @@ -2637,6 +2619,24 @@ int item_getcheck_func_WALLET_LV3() { return -1; } +#if TARGET_PC +int item_getcheck_func_UPPER_ZORAS_RIVER_PORTAL() { + return dComIfGs_isStageSwitch(0x4, 0x15); // Unlock UZR Portal +} + +int item_getcheck_func_CASTLE_TOWN_PORTAL() { + return dComIfGs_isStageSwitch(0x6, 0x3); // Unlock Castle Town Portal +} + +int item_getcheck_func_GERUDO_DESERT_PORTAL() { + return dComIfGs_isStageSwitch(0xA, 0x15); // Unlock Desert Portal +} + +int item_getcheck_func_NORTH_FARON_PORTAL() { + return dComIfGs_isStageSwitch(0x2, 0x2); // Unlock N Faron Portal +} +#endif + int item_getcheck_func_ZORAS_JEWEL() { return dComIfGs_getItem(SLOT_20, true) == dItemNo_ZORAS_JEWEL_e ? TRUE : FALSE; } @@ -2708,6 +2708,16 @@ int item_getcheck_func_COPY_ROD_2() { return -1; } +#if TARGET_PC +int item_getcheck_func_KAKARIKO_GORGE_PORTAL() { + return dComIfGs_isStageSwitch(0x6, 0x15); // Unlock Gorge Portal +} + +int item_getcheck_func_KAKARIKO_VILLAGE_PORTAL() { + return dComIfGs_isStageSwitch(0x3, 0x1F); // Unlock Kak Portal +} +#endif + int item_getcheck_func_BOMB_BAG_LV2() { return dComIfGs_isItemFirstBit(dItemNo_BOMB_BAG_LV2_e); } @@ -2720,6 +2730,12 @@ int item_getcheck_func_BOMB_IN_BAG() { return dComIfGs_isItemFirstBit(dItemNo_BOMB_IN_BAG_e); } +#if TARGET_PC +int item_getcheck_func_DEATH_MOUNTAIN_PORTAL() { + return dComIfGs_isStageSwitch(0x3, 0x15); // Unlock DM Portal +} +#endif + int item_getcheck_func_LIGHT_ARROW() { return dComIfGs_isItemFirstBit(dItemNo_LIGHT_ARROW_e); } @@ -2736,6 +2752,12 @@ int item_getcheck_func_ARROW_LV3() { return (dComIfGs_getItem(SLOT_4, false) == dItemNo_BOW_e && dComIfGs_getArrowMax() >= 100) ? TRUE : FALSE; } +#if TARGET_PC +int item_getcheck_func_ZORAS_DOMAIN_PORTAL() { + return dComIfGs_isStageSwitch(0x4, 0x2); // Unlock ZD Portal +} +#endif + int item_getcheck_func_LURE_ROD() { return -1; } @@ -2940,6 +2962,10 @@ int item_getcheck_func_HORSE_FLUTE() { int item_getcheck_func_CAMP_SMALL_KEY() { return dComIfGs_isItemFirstBit(dItemNo_Randomizer_CAMP_SMALL_KEY_e); } + +int item_getcheck_func_LAKE_HYLIA_PORTAL() { + return dComIfGs_isStageSwitch(0x4, 0xA); // Unlock Lake Portal +} #endif int item_getcheck_func_RAFRELS_MEMO() { @@ -3010,6 +3036,16 @@ int item_getcheck_func_MIRROR_PIECE_4() { return -1; } +#if TARGET_PC +int item_getcheck_func_MIRROR_CHAMBER_PORTAL() { + return dComIfGs_isStageSwitch(0xA, 0x28); // Unlock MC Portal +} + +int item_getcheck_func_SNOWPEAK_PORTAL() { + return dComIfGs_isStageSwitch(0x8, 0x15); // Unlock Snowpeak Portal +} +#endif + int item_getcheck_func_SMELL_YELIA_POUCH() { return dComIfGs_getCollectSmell() == dItemNo_SMELL_YELIA_POUCH_e ? TRUE : FALSE; } @@ -3034,6 +3070,12 @@ int item_getcheck_func_SMELL_MEDICINE() { return dComIfGs_getCollectSmell() == dItemNo_SMELL_MEDICINE_e ? TRUE : FALSE; } +#if TARGET_PC +int item_getcheck_func_SACRED_GROVE_PORTAL() { + return dComIfGs_isStageSwitch(0x7, 0x64); // Unlock Grove Portal +} +#endif + int item_getcheck_func_M_BEETLE() { return dComIfGs_isItemFirstBit(dItemNo_M_BEETLE_e); } @@ -3180,6 +3222,10 @@ int item_getcheck_func_JUMP_STRIKE() { int item_getcheck_func_GREAT_SPIN() { return dComIfGs_isItemFirstBit(dItemNo_Randomizer_GREAT_SPIN_e); } + +int item_getcheck_func_ELDIN_BRIDGE_PORTAL() { + return dComIfGs_isStageSwitch(0x6, 0x63); // Unlock Eldin Bridge Portal +} #endif int item_getcheck_func_ANCIENT_DOCUMENT() { diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp index 5e07a0ec20..53527ebdfd 100644 --- a/src/d/d_stage.cpp +++ b/src/d/d_stage.cpp @@ -3021,7 +3021,11 @@ int dStage_changeScene4Event(int i_exitId, s8 room_no, int i_wipe, bool param_3, // If randomizer is active and we're loading the first spawn, set our starting time of day if (randomizer_IsActive() && strcmp(scls_info->mStage, "F_SP103") == 0 && scls_info->mRoom == 1 && scls_info->mStart == 1) + { timeH = randomizer_GetContext().mStartHour; + g_randomizerState.mUpdateTracker = true; + } + #endif dKy_set_nexttime(15.0f * timeH); } diff --git a/src/dusk/imgui/ImGuiMenuRandomizer.cpp b/src/dusk/imgui/ImGuiMenuRandomizer.cpp index 1d9160bc12..b77928b0c5 100644 --- a/src/dusk/imgui/ImGuiMenuRandomizer.cpp +++ b/src/dusk/imgui/ImGuiMenuRandomizer.cpp @@ -3,19 +3,17 @@ #include "ImGuiConsole.hpp" #include "ImGuiMenuRandomizer.hpp" -#include "dusk/app_info.hpp" #include "dusk/logging.h" +#include "dusk/data.hpp" +#include "dusk/randomizer/generator/logic/search.hpp" #include "dusk/randomizer/game/randomizer_context.hpp" #include "dusk/randomizer/game/tools.h" -#include "SDL3/SDL_filesystem.h" - #include #include #include -#include "dusk/data.hpp" -#include "dusk/randomizer/generator/logic/search.hpp" +#include "dusk/randomizer/generator/utility/string.hpp" namespace dusk { @@ -221,9 +219,10 @@ namespace dusk { if (ImGui::Begin("Rando Tracker", nullptr, windowFlags)) { auto trackerRando = getTrackerRando(); - ImGui::Text("Here's where the tracker will be"); - if (ImGui::Button("Update Tracker")) { + // Uncomment button for manual updating + if (/*ImGui::Button("Update Tracker") || */g_randomizerState.mUpdateTracker) { + g_randomizerState.mUpdateTracker = false; auto trackerRando = getTrackerRando(); // Generate tracker world if it doesn't exist @@ -233,37 +232,49 @@ namespace dusk { if (trackerHash.empty() || (trackerHash != contextHash && !contextHash.empty())) { *trackerRando = randomizer::Randomizer(data::configured_data_path()); trackerRando->GenerateTrackerWorld(); - auto trackerWorld = trackerRando->GetWorlds()[0].get(); - auto currentItems = trackerWorld->GetStartingItemPool(); - - m_currentSearch = randomizer::logic::search::Search::Accessible(&trackerRando->GetWorlds(), currentItems); - m_currentSearch.SearchWorlds(); } else { - // Don't try to update inventory when on the title screen - if (!playerIsOnTitleScreen()) { - // TODO: Translate game save inventory into ItemPool that can be used for searching - randomizer::logic::item_pool::ItemPool currentItems = {}; - m_currentSearch = randomizer::logic::search::Search::Accessible(&trackerRando->GetWorlds(), currentItems); + if (randomizer_IsActive()) { + auto currentItems = getSaveItemPool(trackerRando->GetWorlds()[0].get()); + m_currentSearch = randomizer::logic::search::Search::AccessibleNoStartingInventory(&trackerRando->GetWorlds(), currentItems); } - m_currentSearch.SearchWorlds(); } } if (trackerRando->GetConfig().GetHash(false).empty()) { - ImGui::Text("There is currently no tracker world"); + ImGui::Text("Load a seed and start a file to activate the tracker"); } else { ImGui::Text("Tracker world loaded from seed %s", trackerRando->GetConfig().GetHash().c_str()); + ImGui::Checkbox("Show Only Accessible Locations", &m_onlyAccessible); + ImGui::Checkbox("Show Location Requirements", &m_showRequirements); + ImGui::InputText("Location Filter", m_locationFilter, 100); + // Show total number of available locations auto locations = trackerRando->GetWorlds()[0]->GetAllLocations(); + auto numProgressionLocations = std::ranges::count_if(locations, [](auto* location) {return location->IsProgression();}); auto numAvailableLocations = m_currentSearch._visitedLocations.size(); - ImGui::Text("Locations Available: %zu / %zu", numAvailableLocations, locations.size()); + ImGui::Text("Locations Available: %zu / %zu", numAvailableLocations, numProgressionLocations); if (ImGui::BeginChild("ScrollRegion", ImVec2(500, 500), true)) { + std::string filter = m_locationFilter; // Show all locations. Green for accessible. Red for Unaccessible for (auto location : locations) { + // Don't show locations which aren't progression + // Don't show any locations which aren't accessible if only accessible is checked + // Don't show any locations which don't meet the filter + if (!location->IsProgression() || + (m_onlyAccessible && !m_currentSearch._visitedLocations.contains(location)) || + !randomizer::utility::str::Contains(location->GetName(), filter)) { + continue; + } + + // Don't show warp portals for now either + if (location->HasCategories("Warp Portal")) { + continue; + } + // Color red auto color = ImVec4(1.f, 0.f, 0.f, 1.f); @@ -275,7 +286,9 @@ namespace dusk { ImGui::TextColored(color, "%s", location->GetName().c_str()); // Show requirements for the location below it (formatting isn't pretty right now) - ImGui::Text(" %s", location->GetComputedRequirement().to_string().c_str()); + if (m_showRequirements) { + ImGui::Text(" %s", location->GetComputedRequirement().to_string().c_str()); + } } } ImGui::EndChild(); diff --git a/src/dusk/imgui/ImGuiMenuRandomizer.hpp b/src/dusk/imgui/ImGuiMenuRandomizer.hpp index 0b983a5bc6..d681d16796 100644 --- a/src/dusk/imgui/ImGuiMenuRandomizer.hpp +++ b/src/dusk/imgui/ImGuiMenuRandomizer.hpp @@ -27,6 +27,10 @@ private: bool m_showRandoGeneration{false}; bool m_showRandoTracker{false}; + bool m_onlyAccessible{false}; + bool m_showRequirements{false}; + char m_locationFilter[100]; + randomizer::logic::search::Search m_currentSearch = randomizer::logic::search::Search(); }; } diff --git a/src/dusk/randomizer/game/randomizer_context.cpp b/src/dusk/randomizer/game/randomizer_context.cpp index 5333b3fdd0..bca6f07e6f 100644 --- a/src/dusk/randomizer/game/randomizer_context.cpp +++ b/src/dusk/randomizer/game/randomizer_context.cpp @@ -385,7 +385,7 @@ static bool checkFoolishItemEffectReady() } static void handleFoolishItem() { - u32 count = g_randomizerState.foolishItemCount; + u32 count = g_randomizerState.mFoolishItemCount; if (count == 0) { return; } @@ -401,7 +401,7 @@ static void handleFoolishItem() { } // Reset count - g_randomizerState.foolishItemCount = 0; + g_randomizerState.mFoolishItemCount = 0; /* Store the currently loaded sound wave to local variables as we will need to load them back later. * We use this method because if we just loaded the sound waves every time the item was gotten, we'd diff --git a/src/dusk/randomizer/game/randomizer_context.hpp b/src/dusk/randomizer/game/randomizer_context.hpp index d5d44d3ae1..e6d3383c52 100644 --- a/src/dusk/randomizer/game/randomizer_context.hpp +++ b/src/dusk/randomizer/game/randomizer_context.hpp @@ -172,7 +172,8 @@ public: // things like the sound of the rupee counter going up. u8 mFlowMessageItemId{0}; - int foolishItemCount{0}; + int mFoolishItemCount{0}; + bool mUpdateTracker{false}; }; extern RandomizerState g_randomizerState; diff --git a/src/dusk/randomizer/game/tools.cpp b/src/dusk/randomizer/game/tools.cpp index 96cc98bba2..87503a868b 100644 --- a/src/dusk/randomizer/game/tools.cpp +++ b/src/dusk/randomizer/game/tools.cpp @@ -1,10 +1,12 @@ #include "tools.h" -#include "stages.h" -#include "d/d_com_inf_game.h" #include "d/actor/d_a_alink.h" +#include "d/d_com_inf_game.h" #include "d/d_item.h" #include "d/d_item_data.h" +#include "dusk/logging.h" #include "f_op/f_op_actor_mng.h" +#include "stages.h" +#include "verify_item_functions.h" bool playerIsInRoomStage(s32 room, const char* stage) { @@ -149,4 +151,317 @@ int numMirrorShards() { numMirrorShards += dComIfGs_isCollectMirror(i); } return numMirrorShards; +} + +int getTempleKeysFound(int stage) { + static std::unordered_map> keyDoorFlags = { + {0xA, {0x0}}, + {0x10, {0x7, 0xB, 0x2B, 0x3E}}, + {0x11, {0x33, 0x3D, 0x3F}}, + {0x12, {0x23, 0x24, 0x34}}, + {0x13, {0x27, 0x46, 0x4D, 0x5A, 0x5B}}, + {0x14, {0x2B, 0x2C, 0x2F, 0x30}}, + {0x15, {0x1B, 0x1C, 0x1D}}, + {0x16, {0x6}}, + {0x17, {0x6, 0x7, 0x8, 0xB, 0x23, 0x24, 0x25}}, + {0x18, {0x4C, 0x6F, 0x7C}} + }; + + int count = dComIfGs_getKeyNum(stage); + + // Add number of unlocked key doors for this dungeon to current key count + for (auto flag : keyDoorFlags[stage]) { + if (dComIfGs_isSwitch(stage, flag)) { + count += 1; + } + } + + return count; +} + +bool isTempleBigKeyFound(int stage) { + // The boss key never gets taken away unlike small keys + return dComIfGs_isDungeonItemBossKey(stage); +} + +randomizer::logic::item_pool::ItemPool getSaveItemPool(randomizer::logic::world::World* world) { + randomizer::logic::item_pool::ItemPool pool{}; + + // Item wheel items + for (int i = 0; i < MAX_ITEM_SLOTS; ++i) { + switch (dComIfGs_getItem(i, false)) { + case dItemNo_Randomizer_HAWK_EYE_e: + pool.push_back(world->GetItem("Hawkeye", true)); + break; + case dItemNo_Randomizer_BOOMERANG_e: + pool.push_back(world->GetItem("Gale Boomerang", true)); + break; + case dItemNo_Randomizer_SPINNER_e: + pool.push_back(world->GetItem("Spinner", true)); + break; + case dItemNo_Randomizer_IRONBALL_e: + pool.push_back(world->GetItem("Ball and Chain", true)); + break; + case dItemNo_Randomizer_BOW_e: + pool.push_back(world->GetItem("Progressive Bow", true)); + break; + case dItemNo_Randomizer_W_HOOKSHOT_e: + pool.push_back(world->GetItem("Progressive Clawshot", true)); + [[fallthrough]]; + case dItemNo_Randomizer_HOOKSHOT_e: + pool.push_back(world->GetItem("Progressive Clawshot", true)); + break; + case dItemNo_Randomizer_HVY_BOOTS_e: + pool.push_back(world->GetItem("Iron Boots", true)); + break; + case dItemNo_Randomizer_COPY_ROD_e: + pool.push_back(world->GetItem("Progressive Dominion Rod", true)); + // Powered up dominion rod + if (dComIfGs_isEventBit(0x2580)) { + pool.push_back(world->GetItem("Progressive Dominion Rod", true)); + } + break; + case dItemNo_Randomizer_KANTERA_e: + pool.push_back(world->GetItem("Lantern", true)); + break; + case dItemNo_Randomizer_JEWEL_ROD_e: + case dItemNo_Randomizer_JEWEL_BEE_ROD_e: + case dItemNo_Randomizer_JEWEL_WORM_ROD_e: + pool.push_back(world->GetItem("Progressive Fishing Rod", true)); + [[fallthrough]]; + case dItemNo_Randomizer_FISHING_ROD_1_e: + case dItemNo_Randomizer_BEE_ROD_e: + case dItemNo_Randomizer_WORM_ROD_e: + pool.push_back(world->GetItem("Progressive Fishing Rod", true)); + break; + case dItemNo_Randomizer_PACHINKO_e: + pool.push_back(world->GetItem("Slingshot", true)); + break; + case dItemNo_Randomizer_BOMB_BAG_LV1_e: + pool.push_back(world->GetItem("Bomb Bag", true)); + break; + case dItemNo_Randomizer_RAFRELS_MEMO_e: + pool.push_back(world->GetItem("Aurus Memo", true)); + break; + case dItemNo_Randomizer_ASHS_SCRIBBLING_e: + pool.push_back(world->GetItem("Asheis Sketch", true)); + break; + case dItemNo_Randomizer_EMPTY_BOTTLE_e: + case dItemNo_Randomizer_RED_BOTTLE_e: + case dItemNo_Randomizer_GREEN_BOTTLE_e: + case dItemNo_Randomizer_BLUE_BOTTLE_e: + case dItemNo_Randomizer_MILK_BOTTLE_e: + case dItemNo_Randomizer_HALF_MILK_BOTTLE_e: + case dItemNo_Randomizer_OIL_BOTTLE_e: + case dItemNo_Randomizer_WATER_BOTTLE_e: + case dItemNo_Randomizer_OIL_BOTTLE_2_e: + case dItemNo_Randomizer_RED_BOTTLE_2_e: + case dItemNo_Randomizer_UGLY_SOUP_e: + case dItemNo_Randomizer_HOT_SPRING_e: + case dItemNo_Randomizer_FAIRY_e: + case dItemNo_Randomizer_HOT_SPRING_2_e: + case dItemNo_Randomizer_OIL2_e: + case dItemNo_Randomizer_OIL_e: + case dItemNo_Randomizer_FAIRY_DROP_e: + case dItemNo_Randomizer_DROP_BOTTLE_e: + case dItemNo_Randomizer_BEE_CHILD_e: + case dItemNo_Randomizer_CHUCHU_RARE_e: + case dItemNo_Randomizer_CHUCHU_RED_e: + case dItemNo_Randomizer_CHUCHU_BLUE_e: + case dItemNo_Randomizer_CHUCHU_GREEN_e: + case dItemNo_Randomizer_CHUCHU_YELLOW_e: + case dItemNo_Randomizer_CHUCHU_PURPLE_e: + case dItemNo_Randomizer_LV1_SOUP_e: + case dItemNo_Randomizer_LV2_SOUP_e: + case dItemNo_Randomizer_LV3_SOUP_e: + case dItemNo_Randomizer_OIL_BOTTLE3_e: + case dItemNo_Randomizer_CHUCHU_BLACK_e: + pool.push_back(world->GetItem("Empty Bottle", true)); + break; + default: + break; + } + } + + // Shadow Crystal + if (dComIfGs_isEventBit(0xD04)) { + pool.push_back(world->GetItem("Shadow Crystal", true)); + } + + // Fused Shadows + for (int i = 0; i < numFusedShadows(); ++i) { + pool.push_back(world->GetItem("Progressive Fused Shadow", true)); + } + + // Mirror Shards + for (int i = 0; i < numMirrorShards(); ++i) { + pool.push_back(world->GetItem("Progressive Mirror Shard", true)); + } + + // Poe Souls + for (int i = 0; i < dComIfGs_getPohSpiritNum(); ++i) { + pool.push_back(world->GetItem("Poe Soul", true)); + } + + // Hearts + for (int i = 0; i < dComIfGs_getMaxLife(); ++i) { + pool.push_back(world->GetItem("Piece of Heart", true)); + } + + // Sky Book characters + for (int i = 0; i < dComIfGs_getAncientDocumentNum(); ++i) { + pool.push_back(world->GetItem("Progressive Sky Book", true)); + } + + // Small Keys + static std::unordered_map keyRegionItemNameMap = { + {0xA, "Gerudo Desert Bulblin Camp Key"}, + {0x10, "Forest Temple Small Key"}, + {0x11, "Goron Mines Small Key"}, + {0x12, "Lakebed Temple Small Key"}, + {0x13, "Arbiters Grounds Small Key"}, + {0x14, "Snowpeak Ruins Small Key"}, + {0x15, "Temple of Time Small Key"}, + {0x16, "City in the Sky Small Key"}, + {0x17, "Palace of Twilight Small Key"}, + {0x18, "Hyrule Castle Small Key"}, + }; + for (auto& [stage, keyName] : keyRegionItemNameMap) { + for (int i = 0; i < getTempleKeysFound(stage); ++i) { + pool.push_back(world->GetItem(keyName, true)); + } + } + + // Gate Keys + if (haveItem(dItemNo_Randomizer_BOSSRIDER_KEY_e)) { + pool.push_back(world->GetItem(dItemNo_Randomizer_BOSSRIDER_KEY_e, true)); + } + + // Big Keys + static std::unordered_map bigKeyRegionItemNameMap = { + {0x10, "Forest Temple Big Key"}, + {0x12, "Lakebed Temple Big Key"}, + {0x13, "Arbiters Grounds Big Key"}, + {0x14, "Snowpeak Ruins Bedroom Key"}, + {0x15, "Temple of Time Big Key"}, + {0x16, "City in the Sky Big Key"}, + {0x17, "Palace of Twilight Big Key"}, + {0x18, "Hyrule Castle Big Key"}, + }; + for (auto& [stage, keyName] : bigKeyRegionItemNameMap) { + if (isTempleBigKeyFound(stage)) { + pool.push_back(world->GetItem(keyName, true)); + } + } + + // Goron Mines Key Shards + for (int i = dItemNo_Randomizer_L2_KEY_PIECES1_e; i < dItemNo_Randomizer_L2_KEY_PIECES3_e; ++i) { + if (haveItem(i)) { + pool.push_back(world->GetItem("Goron Mines Key Shard", true)); + } + } + + // Ordon Pumpkin + if (haveItem(dItemNo_Randomizer_TOMATO_PUREE_e)) { + pool.push_back(world->GetItem(dItemNo_Randomizer_TOMATO_PUREE_e, true)); + } + + // Ordon Cheese + if (haveItem(dItemNo_Randomizer_TASTE_e)) { + pool.push_back(world->GetItem(dItemNo_Randomizer_TASTE_e, true)); + } + + // Golden Bugs + for (int i = dItemNo_Randomizer_M_BEETLE_e; i < dItemNo_Randomizer_F_MAYFLY_e; ++i) { + if (haveItem(i)) { + pool.push_back(world->GetItem(i, true)); + } + } + + // Ilia quest items + for (int i = dItemNo_Randomizer_LETTER_e; i < dItemNo_Randomizer_HORSE_FLUTE_e; ++i) { + if (haveItem(i)) { + pool.push_back(world->GetItem(i, true)); + } + } + + // Warp Portals + // Item ids are scattered so we have to explicitly list them all + static const int portals[] = { + dItemNo_Randomizer_ORDON_PORTAL_e, + dItemNo_Randomizer_SOUTH_FARON_PORTAL_e, + dItemNo_Randomizer_NORTH_FARON_PORTAL_e, + dItemNo_Randomizer_SACRED_GROVE_PORTAL_e, + dItemNo_Randomizer_KAKARIKO_GORGE_PORTAL_e, + dItemNo_Randomizer_KAKARIKO_VILLAGE_PORTAL_e, + dItemNo_Randomizer_DEATH_MOUNTAIN_PORTAL_e, + dItemNo_Randomizer_ELDIN_BRIDGE_PORTAL_e, + dItemNo_Randomizer_CASTLE_TOWN_PORTAL_e, + dItemNo_Randomizer_UPPER_ZORAS_RIVER_PORTAL_e, + dItemNo_Randomizer_ZORAS_DOMAIN_PORTAL_e, + dItemNo_Randomizer_SNOWPEAK_PORTAL_e, + dItemNo_Randomizer_GERUDO_DESERT_PORTAL_e, + dItemNo_Randomizer_MIRROR_CHAMBER_PORTAL_e, + }; + for (auto portal : portals) { + if (haveItem(portal)) { + pool.push_back(world->GetItem(portal, true)); + } + } + + // Swords + static const int swords[] = { + dItemNo_Randomizer_WOOD_STICK_e, + dItemNo_Randomizer_SWORD_e, + dItemNo_Randomizer_MASTER_SWORD_e, + dItemNo_Randomizer_LIGHT_SWORD_e, + }; + for (auto sword : swords) { + if (haveItem(sword)) { + pool.push_back(world->GetItem("Progressive Sword", true)); + } + } + + // Other Equipment + static const int equipment[] = { + dItemNo_Randomizer_WOOD_SHIELD_e, + dItemNo_Randomizer_HYLIA_SHIELD_e, + dItemNo_Randomizer_WEAR_ZORA_e, + dItemNo_Randomizer_ARMOR_e, + }; + for (auto item : equipment) { + if (haveItem(item)) { + pool.push_back(world->GetItem(item, true)); + } + } + + // Hidden Skills + static const int hiddenSkills[] = { + dItemNo_Randomizer_ENDING_BLOW_e, + dItemNo_Randomizer_SHIELD_ATTACK_e, + dItemNo_Randomizer_BACK_SLICE_e, + dItemNo_Randomizer_HELM_SPLITTER_e, + dItemNo_Randomizer_MORTAL_DRAW_e, + dItemNo_Randomizer_JUMP_STRIKE_e, + dItemNo_Randomizer_GREAT_SPIN_e, + }; + for (auto skill : hiddenSkills) { + if (haveItem(skill)) { + pool.push_back(world->GetItem("Progressive Hidden Skill", true)); + } + } + + // Wallets + switch (dComIfGs_getWalletSize()) { + case GIANT_WALLET: + pool.push_back(world->GetItem("Progressive Wallet", true)); + [[fallthrough]]; + case BIG_WALLET: + pool.push_back(world->GetItem("Progressive Wallet", true)); + [[fallthrough]]; + default: + break; + } + + return pool; } \ No newline at end of file diff --git a/src/dusk/randomizer/game/tools.h b/src/dusk/randomizer/game/tools.h index 728b304fb9..55e64499ed 100644 --- a/src/dusk/randomizer/game/tools.h +++ b/src/dusk/randomizer/game/tools.h @@ -16,4 +16,10 @@ bool playerIsOnTitleScreen(); u16 getItemMessageID(u8 itemId); int numCompletedDungeons(); int numFusedShadows(); -int numMirrorShards(); \ No newline at end of file +int numMirrorShards(); + +/* + * Reads the current player inventory and returns an ItemPool that can be used for logic searches + * + */ +randomizer::logic::item_pool::ItemPool getSaveItemPool(randomizer::logic::world::World* world); \ No newline at end of file diff --git a/src/dusk/randomizer/generator/data/world/overworld/Lanayru Province.yaml b/src/dusk/randomizer/generator/data/world/overworld/Lanayru Province.yaml index 14d0176495..1d0c0c206a 100644 --- a/src/dusk/randomizer/generator/data/world/overworld/Lanayru Province.yaml +++ b/src/dusk/randomizer/generator/data/world/overworld/Lanayru Province.yaml @@ -281,7 +281,7 @@ - Name: Castle Town Doctors Office Entrance Can Transform: If Transform Anywhere Exits: - Castle Town Doctors Office Lower: Invoice + Castle Town Doctors Office Lower: Invoice and Can_Talk_to_Humans Castle Town Doctors Office West Door Interior: Nothing Castle Town Doctors Office East Door Interior: Nothing @@ -290,7 +290,7 @@ Medicine Scent: Can_Sniff Exits: Castle Town Doctors Office Upper: Wolf_Link - Castle Town Doctors Office Entrance: Invoice + Castle Town Doctors Office Entrance: Invoice and Can_Talk_to_Humans - Name: Castle Town Doctors Office Upper Exits: diff --git a/src/dusk/randomizer/generator/logic/item_pool.cpp b/src/dusk/randomizer/generator/logic/item_pool.cpp index 5d799b40de..5c67fdd5d7 100644 --- a/src/dusk/randomizer/generator/logic/item_pool.cpp +++ b/src/dusk/randomizer/generator/logic/item_pool.cpp @@ -28,6 +28,9 @@ namespace randomizer::logic::item_pool {"Aurus Memo", 1}, {"Asheis Sketch", 1}, {"Renados Letter", 1}, + {"Invoice", 1}, + {"Wooden Statue", 1}, + {"Ilias Charm", 1}, {"Zora Armor", 1}, {"Hylian Shield", 1}, {"Ordon Shield", 1}, @@ -127,6 +130,11 @@ namespace randomizer::logic::item_pool {"Gerudo Desert Portal", 1}, {"Mirror Chamber Portal", 1}, + // Tears + {"Faron Twilight Tear", 16}, + {"Eldin Twilight Tear", 16}, + {"Lanayru Twilight Tear", 16}, + // Junk we should always have {"Purple Rupee Links House", 1}, {"Green Rupee", 2}, diff --git a/src/dusk/randomizer/generator/logic/search.cpp b/src/dusk/randomizer/generator/logic/search.cpp index 6807a0ae07..bfbce40646 100644 --- a/src/dusk/randomizer/generator/logic/search.cpp +++ b/src/dusk/randomizer/generator/logic/search.cpp @@ -17,19 +17,22 @@ namespace randomizer::logic::search Search::Search(const SearchMode& searchMode, world::WorldPool* worlds, const item_pool::ItemPool& items /* = {} */, - const int& worldToSearch /* = -1 */): - _searchMode(searchMode), _worlds(worlds) + const int& worldToSearch /* = -1 */, + bool startingInventory /*= true */): + _searchMode(searchMode), _worlds(worlds), _startingInventory(startingInventory) { // Set the items we should already own this->_ownedItems.insert(items.begin(), items.end()); // Add starting inventory items for each world - for (const auto& world : *(this->_worlds)) - { - if (worldToSearch == -1 || world->GetID() == worldToSearch) + if (this->_startingInventory) { + for (const auto& world : *(this->_worlds)) { - const auto& startingInventory = world->GetStartingItemPool(); - this->_ownedItems.insert(startingInventory.begin(), startingInventory.end()); + if (worldToSearch == -1 || world->GetID() == worldToSearch) + { + const auto& startingInventory = world->GetStartingItemPool(); + this->_ownedItems.insert(startingInventory.begin(), startingInventory.end()); + } } } diff --git a/src/dusk/randomizer/generator/logic/search.hpp b/src/dusk/randomizer/generator/logic/search.hpp index 784fbf4395..c71b2ae6f0 100644 --- a/src/dusk/randomizer/generator/logic/search.hpp +++ b/src/dusk/randomizer/generator/logic/search.hpp @@ -64,7 +64,8 @@ namespace randomizer::logic::search Search(const SearchMode& searchMode, world::WorldPool* worlds, const item_pool::ItemPool& items = {}, - const int& worldToSearch = -1); + const int& worldToSearch = -1, + bool startingInventory = true); static auto Accessible(world::WorldPool* worlds, const item_pool::ItemPool& items = {}, @@ -73,6 +74,13 @@ namespace randomizer::logic::search return Search(SearchMode::ACCESSIBLE_LOCATIONS, worlds, items, worldToSearch); } + static auto AccessibleNoStartingInventory(world::WorldPool* worlds, + const item_pool::ItemPool& items = {}, + const int& worldToSearch = -1) + { + return Search(SearchMode::ACCESSIBLE_LOCATIONS, worlds, items, worldToSearch, false); + } + static auto AllLocationsReachable(world::WorldPool* worlds, const item_pool::ItemPool& items = {}, const int& worldToSearch = -1) @@ -136,6 +144,7 @@ namespace randomizer::logic::search bool _newThingsFound = true; bool _isBeatable = false; bool _collectItems = true; + bool _startingInventory = true; std::unordered_set _ownedEvents; std::unordered_multiset _ownedItems; diff --git a/src/dusk/randomizer/generator/logic/world.cpp b/src/dusk/randomizer/generator/logic/world.cpp index 8b12c2713f..4a9673272b 100644 --- a/src/dusk/randomizer/generator/logic/world.cpp +++ b/src/dusk/randomizer/generator/logic/world.cpp @@ -116,15 +116,8 @@ namespace randomizer::logic::world auto dungeonMap = itemNode["Dungeon Map"].as(""); // Make the item and insert it into the item table - auto item = std::make_unique(id, - name, - this, - importance, - gameWinningItem, - dungeonSmallKey != "", - dungeonBigKey != "", - dungeonCompass != "", - dungeonMap != ""); + auto item = std::make_unique(id, name, this, importance, gameWinningItem, + dungeonSmallKey != "", dungeonBigKey != "", dungeonCompass != "", dungeonMap != ""); this->_itemTable.try_emplace(name, std::move(item)); @@ -146,6 +139,9 @@ namespace randomizer::logic::world { this->GetDungeon(dungeonMap)->SetDungeonMap(curItem); } + + // Put item into itemIdTable as well + this->_itemIdTable.try_emplace(id, curItem); } } @@ -992,6 +988,18 @@ namespace randomizer::logic::world return this->_itemTable.at(name).get(); } + item::Item* World::GetItem(uint8_t id, const bool& ignoreError /*= false*/) { + if (!this->_itemIdTable.contains(id)) + { + if (!ignoreError) + { + throw std::runtime_error("Unknown item id \"" + std::to_string(id) + "\""); + } + return item::Nothing.get(); + } + return this->_itemIdTable.at(id); + } + item::Item* World::GetGameWinningItem() const { return this->_itemTable.at("Game Beatable").get(); diff --git a/src/dusk/randomizer/generator/logic/world.hpp b/src/dusk/randomizer/generator/logic/world.hpp index 6d4e59e0fa..efbbc3f422 100644 --- a/src/dusk/randomizer/generator/logic/world.hpp +++ b/src/dusk/randomizer/generator/logic/world.hpp @@ -113,6 +113,7 @@ namespace randomizer::logic::world dungeon::Dungeon* GetDungeon(const std::string& name); const std::map>& GetDungeonTable() const; item::Item* GetItem(const std::string& name, const bool& ignoreError = false); + item::Item* GetItem(uint8_t id, const bool& ignoreError = false); item::Item* GetShadowCrystal(); item::Item* GetGameWinningItem() const; item_pool::ItemPool& GetItemPool(); @@ -144,6 +145,7 @@ namespace randomizer::logic::world seedgen::settings::Settings _settings; std::map> _itemTable = {}; + std::map _itemIdTable = {}; std::map> _locationTable = {}; std::unordered_set _intentionallyRemovedLocations = {}; std::unordered_set _registeredLocationCategories = {};