#include "ActorBehavior.h"
#include <libultraship/bridge/consolevariablebridge.h>

#include "2s2h/CustomItem/CustomItem.h"
#include "2s2h/Rando/Rando.h"
#include "2s2h/ShipInit.hpp"
#include "2s2h/ObjectExtension/ActorListIndex.h"
#include "assets/2s2h_assets.h"

extern "C" {
#include "variables.h"
#include "overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h"
#include "objects/object_tsubo/object_tsubo.h"

void ObjTsubo_Draw(Actor* actor, PlayState* play);
}

std::map<std::tuple<s16, s16, s16>, RandoCheckId> potMap = {
    // Deku Shrine //
    { { SCENE_DANPEI, 0, 14 }, RC_DEKU_SHRINE_POT_01 },
    { { SCENE_DANPEI, 0, 15 }, RC_DEKU_SHRINE_POT_02 },
    // Stone Tower //
    { { SCENE_F40, 0, 52 }, RC_STONE_TOWER_HIGHER_SCARECROW_POT_02 },
    { { SCENE_F40, 0, 57 }, RC_STONE_TOWER_HIGHER_SCARECROW_POT_08 },
    { { SCENE_F40, 0, 47 }, RC_STONE_TOWER_LOWER_SCARECROW_POT_02 },
    { { SCENE_F40, 0, 45 }, RC_STONE_TOWER_LOWER_SCARECROW_POT_04 },
    { { SCENE_F40, 0, 48 }, RC_STONE_TOWER_LOWER_SCARECROW_POT_11 },
    // Beneath the Graveyard //
    { { SCENE_HAKASHITA, 1, 6 }, RC_BENEATH_THE_GRAVEYARD_NIGHT_1_BATS_POT_03 },
    { { SCENE_HAKASHITA, 3, 12 }, RC_BENEATH_THE_GRAVEYARD_NIGHT_2_AFTER_PIT_POT_01 },
    { { SCENE_HAKASHITA, 3, 11 }, RC_BENEATH_THE_GRAVEYARD_NIGHT_2_AFTER_PIT_POT_02 },
    { { SCENE_HAKASHITA, 3, 7 }, RC_BENEATH_THE_GRAVEYARD_NIGHT_2_AFTER_PIT_POT_03 },
    { { SCENE_HAKASHITA, 3, 8 }, RC_BENEATH_THE_GRAVEYARD_NIGHT_2_AFTER_PIT_POT_04 },
    // Snowhead Temple - Goht's Lair //
    { { SCENE_HAKUGIN_BS, 0, 9 }, RC_SNOWHEAD_TEMPLE_BOSS_POT_01 },
    { { SCENE_HAKUGIN_BS, 0, 1 }, RC_SNOWHEAD_TEMPLE_BOSS_POT_02 },
    { { SCENE_HAKUGIN_BS, 0, 3 }, RC_SNOWHEAD_TEMPLE_BOSS_POT_03 },
    { { SCENE_HAKUGIN_BS, 0, 10 }, RC_SNOWHEAD_TEMPLE_BOSS_POT_04 },
    { { SCENE_HAKUGIN_BS, 0, 7 }, RC_SNOWHEAD_TEMPLE_BOSS_POT_05 },
    { { SCENE_HAKUGIN_BS, 0, 8 }, RC_SNOWHEAD_TEMPLE_BOSS_POT_06 },
    { { SCENE_HAKUGIN_BS, 0, 11 }, RC_SNOWHEAD_TEMPLE_BOSS_POT_07 },
    { { SCENE_HAKUGIN_BS, 0, 2 }, RC_SNOWHEAD_TEMPLE_BOSS_POT_08 },
    { { SCENE_HAKUGIN_BS, 0, 4 }, RC_SNOWHEAD_TEMPLE_BOSS_POT_09 },
    { { SCENE_HAKUGIN_BS, 0, 12 }, RC_SNOWHEAD_TEMPLE_BOSS_POT_10 },
    { { SCENE_HAKUGIN_BS, 0, 13 }, RC_SNOWHEAD_TEMPLE_BOSS_EARLY_POT_01 },
    { { SCENE_HAKUGIN_BS, 0, 14 }, RC_SNOWHEAD_TEMPLE_BOSS_EARLY_POT_02 },
    { { SCENE_HAKUGIN_BS, 0, 5 }, RC_SNOWHEAD_TEMPLE_BOSS_EARLY_POT_03 },
    { { SCENE_HAKUGIN_BS, 0, 6 }, RC_SNOWHEAD_TEMPLE_BOSS_EARLY_POT_04 },
    // Snowhead Temple //
    { { SCENE_HAKUGIN, 3, 7 }, RC_SNOWHEAD_TEMPLE_BLOCK_ROOM_POT_01 },
    { { SCENE_HAKUGIN, 3, 0 }, RC_SNOWHEAD_TEMPLE_BLOCK_ROOM_POT_02 },
    { { SCENE_HAKUGIN, 2, 8 }, RC_SNOWHEAD_TEMPLE_BRIDGE_ROOM_POT_01 },
    { { SCENE_HAKUGIN, 2, 7 }, RC_SNOWHEAD_TEMPLE_BRIDGE_ROOM_POT_02 },
    { { SCENE_HAKUGIN, 2, 9 }, RC_SNOWHEAD_TEMPLE_BRIDGE_ROOM_POT_03 },
    { { SCENE_HAKUGIN, 2, 10 }, RC_SNOWHEAD_TEMPLE_BRIDGE_ROOM_POT_04 },
    { { SCENE_HAKUGIN, 2, 11 }, RC_SNOWHEAD_TEMPLE_BRIDGE_ROOM_POT_05 },
    { { SCENE_HAKUGIN, 2, 2 }, RC_SNOWHEAD_TEMPLE_BRIDGE_ROOM_AFTER_POT_01 },
    { { SCENE_HAKUGIN, 2, 1 }, RC_SNOWHEAD_TEMPLE_BRIDGE_ROOM_AFTER_POT_02 },
    { { SCENE_HAKUGIN, 4, 48 }, RC_SNOWHEAD_TEMPLE_CENTRAL_ROOM_BOTTOM_POT_01 },
    { { SCENE_HAKUGIN, 4, 49 }, RC_SNOWHEAD_TEMPLE_CENTRAL_ROOM_BOTTOM_POT_02 },
    { { SCENE_HAKUGIN, 4, 47 }, RC_SNOWHEAD_TEMPLE_CENTRAL_ROOM_LEVEL_2_POT_01 },
    { { SCENE_HAKUGIN, 4, 46 }, RC_SNOWHEAD_TEMPLE_CENTRAL_ROOM_LEVEL_2_POT_02 },
    { { SCENE_HAKUGIN, 4, 29 }, RC_SNOWHEAD_TEMPLE_CENTRAL_ROOM_NEAR_BOSS_KEY_POT_01 },
    { { SCENE_HAKUGIN, 4, 30 }, RC_SNOWHEAD_TEMPLE_CENTRAL_ROOM_NEAR_BOSS_KEY_POT_02 },
    { { SCENE_HAKUGIN, 4, 27 }, RC_SNOWHEAD_TEMPLE_CENTRAL_ROOM_SCARECROW_POT_01 },
    { { SCENE_HAKUGIN, 4, 28 }, RC_SNOWHEAD_TEMPLE_CENTRAL_ROOM_SCARECROW_POT_02 },
    { { SCENE_HAKUGIN, 1, 5 }, RC_SNOWHEAD_TEMPLE_COMPASS_ROOM_POT_01 },
    { { SCENE_HAKUGIN, 1, 6 }, RC_SNOWHEAD_TEMPLE_COMPASS_ROOM_POT_02 },
    { { SCENE_HAKUGIN, 1, 7 }, RC_SNOWHEAD_TEMPLE_COMPASS_ROOM_POT_03 },
    { { SCENE_HAKUGIN, 1, 8 }, RC_SNOWHEAD_TEMPLE_COMPASS_ROOM_POT_04 },
    { { SCENE_HAKUGIN, 1, 9 }, RC_SNOWHEAD_TEMPLE_COMPASS_ROOM_POT_05 },
    { { SCENE_HAKUGIN, 8, 12 }, RC_SNOWHEAD_TEMPLE_DUAL_SWITCHES_POT_01 },
    { { SCENE_HAKUGIN, 8, 11 }, RC_SNOWHEAD_TEMPLE_DUAL_SWITCHES_POT_02 },
    { { SCENE_HAKUGIN, 0, 21 }, RC_SNOWHEAD_TEMPLE_ENTRANCE_POT_01 },
    { { SCENE_HAKUGIN, 0, 22 }, RC_SNOWHEAD_TEMPLE_ENTRANCE_POT_02 },
    { { SCENE_HAKUGIN, 5, 12 }, RC_SNOWHEAD_TEMPLE_PILLARS_ROOM_LOWER_POT_01 },
    { { SCENE_HAKUGIN, 5, 13 }, RC_SNOWHEAD_TEMPLE_PILLARS_ROOM_LOWER_POT_02 },
    { { SCENE_HAKUGIN, 5, 14 }, RC_SNOWHEAD_TEMPLE_PILLARS_ROOM_LOWER_POT_03 },
    { { SCENE_HAKUGIN, 5, 15 }, RC_SNOWHEAD_TEMPLE_PILLARS_ROOM_LOWER_POT_04 },
    { { SCENE_HAKUGIN, 5, 18 }, RC_SNOWHEAD_TEMPLE_PILLARS_ROOM_LOWER_POT_05 },
    { { SCENE_HAKUGIN, 5, 17 }, RC_SNOWHEAD_TEMPLE_PILLARS_ROOM_LOWER_POT_06 },
    { { SCENE_HAKUGIN, 5, 16 }, RC_SNOWHEAD_TEMPLE_PILLARS_ROOM_LOWER_POT_07 },
    { { SCENE_HAKUGIN, 5, 4 }, RC_SNOWHEAD_TEMPLE_PILLARS_ROOM_UPPER_POT_01 },
    { { SCENE_HAKUGIN, 5, 6 }, RC_SNOWHEAD_TEMPLE_PILLARS_ROOM_UPPER_POT_02 },
    { { SCENE_HAKUGIN, 5, 5 }, RC_SNOWHEAD_TEMPLE_PILLARS_ROOM_UPPER_POT_03 },
    { { SCENE_HAKUGIN, 5, 3 }, RC_SNOWHEAD_TEMPLE_PILLARS_ROOM_UPPER_POT_04 },
    { { SCENE_HAKUGIN, 5, 8 }, RC_SNOWHEAD_TEMPLE_PILLARS_ROOM_UPPER_POT_05 },
    { { SCENE_HAKUGIN, 5, 7 }, RC_SNOWHEAD_TEMPLE_PILLARS_ROOM_UPPER_POT_06 },
    { { SCENE_HAKUGIN, 12, 8 }, RC_SNOWHEAD_TEMPLE_WIZZROBE_POT_01 },
    { { SCENE_HAKUGIN, 12, 10 }, RC_SNOWHEAD_TEMPLE_WIZZROBE_POT_02 },
    { { SCENE_HAKUGIN, 12, 11 }, RC_SNOWHEAD_TEMPLE_WIZZROBE_POT_03 },
    { { SCENE_HAKUGIN, 12, 12 }, RC_SNOWHEAD_TEMPLE_WIZZROBE_POT_04 },
    { { SCENE_HAKUGIN, 12, 9 }, RC_SNOWHEAD_TEMPLE_WIZZROBE_POT_05 },
    // The Moon - Majora's Lair //
    { { SCENE_LAST_BS, 0, 2 }, RC_MOON_MAJORA_POT_01 },
    { { SCENE_LAST_BS, 0, 1 }, RC_MOON_MAJORA_POT_02 },
    // The Moon - Goron Trial //
    { { SCENE_LAST_GORON, 0, 22 }, RC_MOON_TRIAL_GORON_POT_01 },
    { { SCENE_LAST_GORON, 0, 21 }, RC_MOON_TRIAL_GORON_POT_02 },
    { { SCENE_LAST_GORON, 0, 25 }, RC_MOON_TRIAL_GORON_POT_03 },
    { { SCENE_LAST_GORON, 0, 23 }, RC_MOON_TRIAL_GORON_POT_04 },
    { { SCENE_LAST_GORON, 0, 24 }, RC_MOON_TRIAL_GORON_POT_05 },
    { { SCENE_LAST_GORON, 0, 35 }, RC_MOON_TRIAL_GORON_POT_06 },
    { { SCENE_LAST_GORON, 0, 33 }, RC_MOON_TRIAL_GORON_POT_07 },
    { { SCENE_LAST_GORON, 0, 34 }, RC_MOON_TRIAL_GORON_POT_08 },
    { { SCENE_LAST_GORON, 0, 32 }, RC_MOON_TRIAL_GORON_POT_09 },
    { { SCENE_LAST_GORON, 0, 26 }, RC_MOON_TRIAL_GORON_POT_10 },
    { { SCENE_LAST_GORON, 0, 27 }, RC_MOON_TRIAL_GORON_POT_11 },
    { { SCENE_LAST_GORON, 0, 29 }, RC_MOON_TRIAL_GORON_EARLY_POT_01 },
    { { SCENE_LAST_GORON, 0, 28 }, RC_MOON_TRIAL_GORON_EARLY_POT_02 },
    { { SCENE_LAST_GORON, 0, 31 }, RC_MOON_TRIAL_GORON_EARLY_POT_03 },
    { { SCENE_LAST_GORON, 0, 30 }, RC_MOON_TRIAL_GORON_EARLY_POT_04 },
    // The Moon - Link Trial //
    { { SCENE_LAST_LINK, 0, 3 }, RC_MOON_TRIAL_LINK_POT_01 },
    { { SCENE_LAST_LINK, 0, 1 }, RC_MOON_TRIAL_LINK_POT_02 },
    { { SCENE_LAST_LINK, 0, 4 }, RC_MOON_TRIAL_LINK_POT_03 },
    { { SCENE_LAST_LINK, 0, 2 }, RC_MOON_TRIAL_LINK_POT_04 },
    { { SCENE_LAST_LINK, 0, 7 }, RC_MOON_TRIAL_LINK_POT_05 },
    { { SCENE_LAST_LINK, 0, 5 }, RC_MOON_TRIAL_LINK_POT_06 },
    { { SCENE_LAST_LINK, 0, 8 }, RC_MOON_TRIAL_LINK_POT_07 },
    { { SCENE_LAST_LINK, 0, 6 }, RC_MOON_TRIAL_LINK_POT_08 },
    // Pirates' Fortress Interior //
    { { SCENE_PIRATE, 13, 6 }, RC_PIRATE_FORTRESS_INTERIOR_GUARDED_POT_01 },
    { { SCENE_PIRATE, 11, 35 }, RC_PIRATE_FORTRESS_SEWERS_HEART_PIECE_ROOM_POT_02 },
    { { SCENE_PIRATE, 10, 8 }, RC_PIRATE_FORTRESS_SEWERS_WATERWAY_POT_01 },
    // Beneath the Well //
    { { SCENE_REDEAD, 12, 7 }, RC_BENEATH_THE_WELL_BIG_POE_POT_01 },
    { { SCENE_REDEAD, 12, 8 }, RC_BENEATH_THE_WELL_BIG_POE_POT_02 },
    { { SCENE_REDEAD, 12, 6 }, RC_BENEATH_THE_WELL_BIG_POE_POT_03 },
    { { SCENE_REDEAD, 12, 5 }, RC_BENEATH_THE_WELL_BIG_POE_POT_04 },
    { { SCENE_REDEAD, 6, 14 }, RC_BENEATH_THE_WELL_MIDDLE_POT_01 },
    { { SCENE_REDEAD, 6, 15 }, RC_BENEATH_THE_WELL_MIDDLE_POT_02 },
    { { SCENE_REDEAD, 6, 16 }, RC_BENEATH_THE_WELL_MIDDLE_POT_03 },
    { { SCENE_REDEAD, 6, 17 }, RC_BENEATH_THE_WELL_MIDDLE_POT_04 },
    { { SCENE_REDEAD, 6, 18 }, RC_BENEATH_THE_WELL_MIDDLE_POT_05 },
    { { SCENE_REDEAD, 6, 19 }, RC_BENEATH_THE_WELL_MIDDLE_POT_06 },
    { { SCENE_REDEAD, 6, 20 }, RC_BENEATH_THE_WELL_MIDDLE_POT_07 },
    { { SCENE_REDEAD, 6, 21 }, RC_BENEATH_THE_WELL_MIDDLE_POT_08 },
    { { SCENE_REDEAD, 6, 22 }, RC_BENEATH_THE_WELL_MIDDLE_POT_09 },
    { { SCENE_REDEAD, 6, 23 }, RC_BENEATH_THE_WELL_MIDDLE_POT_10 },
    // Woodfall Temple //
    { { SCENE_MITURIN, 2, 22 }, RC_WOODFALL_TEMPLE_ENTRANCE_POT },
    { { SCENE_MITURIN, 1, 22 }, RC_WOODFALL_TEMPLE_MAIN_ROOM_LOWER_POT_01 },
    { { SCENE_MITURIN, 1, 23 }, RC_WOODFALL_TEMPLE_MAIN_ROOM_LOWER_POT_02 },
    { { SCENE_MITURIN, 1, 27 }, RC_WOODFALL_TEMPLE_MAIN_ROOM_LOWER_POT_03 },
    { { SCENE_MITURIN, 1, 24 }, RC_WOODFALL_TEMPLE_MAIN_ROOM_LOWER_POT_04 },
    { { SCENE_MITURIN, 1, 26 }, RC_WOODFALL_TEMPLE_MAIN_ROOM_LOWER_POT_05 },
    { { SCENE_MITURIN, 1, 21 }, RC_WOODFALL_TEMPLE_MAIN_ROOM_LOWER_POT_06 },
    { { SCENE_MITURIN, 1, 10 }, RC_WOODFALL_TEMPLE_MAIN_ROOM_UPPER_POT_01 },
    { { SCENE_MITURIN, 1, 11 }, RC_WOODFALL_TEMPLE_MAIN_ROOM_UPPER_POT_02 },
    { { SCENE_MITURIN, 3, 13 }, RC_WOODFALL_TEMPLE_MAZE_POT_01 },
    { { SCENE_MITURIN, 3, 14 }, RC_WOODFALL_TEMPLE_MAZE_POT_02 },
    { { SCENE_MITURIN, 0, 28 }, RC_WOODFALL_TEMPLE_PRE_BOSS_POT_01 },
    { { SCENE_MITURIN, 0, 29 }, RC_WOODFALL_TEMPLE_PRE_BOSS_POT_02 },
    { { SCENE_MITURIN, 5, 14 }, RC_WOODFALL_TEMPLE_WATER_ROOM_POT_01 },
    { { SCENE_MITURIN, 5, 15 }, RC_WOODFALL_TEMPLE_WATER_ROOM_POT_02 },
    { { SCENE_MITURIN, 5, 16 }, RC_WOODFALL_TEMPLE_WATER_ROOM_POT_03 },
    { { SCENE_MITURIN, 5, 17 }, RC_WOODFALL_TEMPLE_WATER_ROOM_POT_04 },
    // Swamp Spider House //
    { { SCENE_KINSTA1, 2, 0 }, RC_SWAMP_SPIDER_HOUSE_GOLD_ROOM_LOWER_POT_01 },
    { { SCENE_KINSTA1, 2, 1 }, RC_SWAMP_SPIDER_HOUSE_GOLD_ROOM_LOWER_POT_02 },
    { { SCENE_KINSTA1, 2, 2 }, RC_SWAMP_SPIDER_HOUSE_GOLD_ROOM_UPPER_POT_01 },
    { { SCENE_KINSTA1, 2, 5 }, RC_SWAMP_SPIDER_HOUSE_GOLD_ROOM_UPPER_POT_02 },
    { { SCENE_KINSTA1, 2, 4 }, RC_SWAMP_SPIDER_HOUSE_GOLD_ROOM_UPPER_POT_03 },
    { { SCENE_KINSTA1, 2, 3 }, RC_SWAMP_SPIDER_HOUSE_GOLD_ROOM_UPPER_POT_04 },
    { { SCENE_KINSTA1, 4, 23 }, RC_SWAMP_SPIDER_HOUSE_JAR_ROOM_POT_01 },
    { { SCENE_KINSTA1, 4, 21 }, RC_SWAMP_SPIDER_HOUSE_JAR_ROOM_POT_02 },
    { { SCENE_KINSTA1, 4, 24 }, RC_SWAMP_SPIDER_HOUSE_JAR_ROOM_POT_03 },
    { { SCENE_KINSTA1, 4, 22 }, RC_SWAMP_SPIDER_HOUSE_JAR_ROOM_POT_04 },
    { { SCENE_KINSTA1, 4, 20 }, RC_SWAMP_SPIDER_HOUSE_JAR_ROOM_POT_05 },
    { { SCENE_KINSTA1, 4, 3 }, RC_SWAMP_SPIDER_HOUSE_JAR_ROOM_POT_06 },
    { { SCENE_KINSTA1, 4, 4 }, RC_SWAMP_SPIDER_HOUSE_JAR_ROOM_POT_07 },
    { { SCENE_KINSTA1, 1, 7 }, RC_SWAMP_SPIDER_HOUSE_MAIN_ROOM_LOWER_POT_01 },
    { { SCENE_KINSTA1, 1, 6 }, RC_SWAMP_SPIDER_HOUSE_MAIN_ROOM_LOWER_POT_02 },
    { { SCENE_KINSTA1, 1, 5 }, RC_SWAMP_SPIDER_HOUSE_MAIN_ROOM_LOWER_POT_03 },
    { { SCENE_KINSTA1, 1, 9 }, RC_SWAMP_SPIDER_HOUSE_MAIN_ROOM_UPPER_LEFT_POT_01 },
    { { SCENE_KINSTA1, 1, 8 }, RC_SWAMP_SPIDER_HOUSE_MAIN_ROOM_UPPER_LEFT_POT_02 },
    { { SCENE_KINSTA1, 1, 4 }, RC_SWAMP_SPIDER_HOUSE_MAIN_ROOM_UPPER_RIGHT_POT_01 },
    { { SCENE_KINSTA1, 1, 3 }, RC_SWAMP_SPIDER_HOUSE_MAIN_ROOM_UPPER_RIGHT_POT_02 },
    { { SCENE_KINSTA1, 3, 0 }, RC_SWAMP_SPIDER_HOUSE_MONUMENT_ROOM_POT_01 },
    { { SCENE_KINSTA1, 3, 1 }, RC_SWAMP_SPIDER_HOUSE_MONUMENT_ROOM_POT_02 },
    // Ocean Spider House //
    { { SCENE_KINDAN2, 1, 28 }, RC_OCEAN_SPIDER_HOUSE_MAIN_ROOM_POT_01 },
    { { SCENE_KINDAN2, 1, 27 }, RC_OCEAN_SPIDER_HOUSE_MAIN_ROOM_WEB_POT },
    { { SCENE_KINDAN2, 5, 12 }, RC_OCEAN_SPIDER_HOUSE_STORAGE_POT_02 },
    { { SCENE_KINDAN2, 5, 13 }, RC_OCEAN_SPIDER_HOUSE_STORAGE_POT_03 },
    // Great Bay Temple - Gyorg's Lair //
    { { SCENE_SEA_BS, 0, 2 }, RC_GREAT_BAY_TEMPLE_BOSS_POT_01 },
    { { SCENE_SEA_BS, 0, 3 }, RC_GREAT_BAY_TEMPLE_BOSS_POT_02 },
    { { SCENE_SEA_BS, 0, 4 }, RC_GREAT_BAY_TEMPLE_BOSS_POT_03 },
    { { SCENE_SEA_BS, 0, 1 }, RC_GREAT_BAY_TEMPLE_BOSS_POT_04 },
    { { SCENE_SEA_BS, 0, 5 }, RC_GREAT_BAY_TEMPLE_BOSS_UNDERWATER_POT_01 },
    { { SCENE_SEA_BS, 0, 8 }, RC_GREAT_BAY_TEMPLE_BOSS_UNDERWATER_POT_02 },
    { { SCENE_SEA_BS, 0, 7 }, RC_GREAT_BAY_TEMPLE_BOSS_UNDERWATER_POT_03 },
    { { SCENE_SEA_BS, 0, 6 }, RC_GREAT_BAY_TEMPLE_BOSS_UNDERWATER_POT_04 },
    // Great Bay Temple //
    { { SCENE_SEA, 14, 3 }, RC_GREAT_BAY_TEMPLE_BEFORE_WART_POT_03 },
    { { SCENE_SEA, 14, 5 }, RC_GREAT_BAY_TEMPLE_BEFORE_WART_POT_06 },
    { { SCENE_SEA, 14, 4 }, RC_GREAT_BAY_TEMPLE_BEFORE_WART_POT_07 },
    { { SCENE_SEA, 14, 10 }, RC_GREAT_BAY_TEMPLE_BEFORE_WART_POT_08 },
    { { SCENE_SEA, 14, 9 }, RC_GREAT_BAY_TEMPLE_BEFORE_WART_POT_09 },
    { { SCENE_SEA, 14, 2 }, RC_GREAT_BAY_TEMPLE_BEFORE_WART_POT_10 },
    { { SCENE_SEA, 14, 8 }, RC_GREAT_BAY_TEMPLE_BEFORE_WART_POT_11 },
    { { SCENE_SEA, 14, 7 }, RC_GREAT_BAY_TEMPLE_BEFORE_WART_POT_12 },
    { { SCENE_SEA, 0, 16 }, RC_GREAT_BAY_TEMPLE_CENTRAL_ROOM_POT_01 },
    { { SCENE_SEA, 0, 17 }, RC_GREAT_BAY_TEMPLE_CENTRAL_ROOM_POT_02 },
    { { SCENE_SEA, 4, 9 }, RC_GREAT_BAY_TEMPLE_COMPASS_ROOM_SURFACE_POT_01 },
    { { SCENE_SEA, 4, 20 }, RC_GREAT_BAY_TEMPLE_COMPASS_ROOM_SURFACE_POT_02 },
    { { SCENE_SEA, 4, 10 }, RC_GREAT_BAY_TEMPLE_COMPASS_ROOM_SURFACE_POT_03 },
    { { SCENE_SEA, 4, 21 }, RC_GREAT_BAY_TEMPLE_COMPASS_ROOM_SURFACE_POT_04 },
    { { SCENE_SEA, 4, 11 }, RC_GREAT_BAY_TEMPLE_COMPASS_ROOM_WATER_POT_01 },
    { { SCENE_SEA, 4, 13 }, RC_GREAT_BAY_TEMPLE_COMPASS_ROOM_WATER_POT_02 },
    { { SCENE_SEA, 4, 12 }, RC_GREAT_BAY_TEMPLE_COMPASS_ROOM_WATER_POT_03 },
    { { SCENE_SEA, 12, 9 }, RC_GREAT_BAY_TEMPLE_GREEN_PIPE_1_POT_01 },
    { { SCENE_SEA, 12, 7 }, RC_GREAT_BAY_TEMPLE_GREEN_PIPE_1_POT_02 },
    { { SCENE_SEA, 12, 6 }, RC_GREAT_BAY_TEMPLE_GREEN_PIPE_1_POT_03 },
    { { SCENE_SEA, 12, 8 }, RC_GREAT_BAY_TEMPLE_GREEN_PIPE_1_POT_04 },
    { { SCENE_SEA, 11, 5 }, RC_GREAT_BAY_TEMPLE_PRE_BOSS_POT_01 },
    { { SCENE_SEA, 11, 3 }, RC_GREAT_BAY_TEMPLE_PRE_BOSS_POT_02 },
    { { SCENE_SEA, 11, 15 }, RC_GREAT_BAY_TEMPLE_PRE_BOSS_POT_03 },
    { { SCENE_SEA, 11, 1 }, RC_GREAT_BAY_TEMPLE_PRE_BOSS_POT_04 },
    { { SCENE_SEA, 11, 14 }, RC_GREAT_BAY_TEMPLE_PRE_BOSS_POT_05 },
    { { SCENE_SEA, 11, 0 }, RC_GREAT_BAY_TEMPLE_PRE_BOSS_POT_06 },
    { { SCENE_SEA, 11, 2 }, RC_GREAT_BAY_TEMPLE_PRE_BOSS_POT_07 },
    { { SCENE_SEA, 11, 4 }, RC_GREAT_BAY_TEMPLE_PRE_BOSS_POT_08 },
    { { SCENE_SEA, 10, 5 }, RC_GREAT_BAY_TEMPLE_GREEN_PIPE_3_UPPER_POT_01 },
    { { SCENE_SEA, 10, 4 }, RC_GREAT_BAY_TEMPLE_GREEN_PIPE_3_UPPER_POT_02 },
    { { SCENE_SEA, 1, 3 }, RC_GREAT_BAY_TEMPLE_MAP_ROOM_SURFACE_POT_01 },
    { { SCENE_SEA, 1, 4 }, RC_GREAT_BAY_TEMPLE_MAP_ROOM_SURFACE_POT_02 },
    { { SCENE_SEA, 1, 16 }, RC_GREAT_BAY_TEMPLE_MAP_ROOM_SURFACE_POT_03 },
    { { SCENE_SEA, 1, 5 }, RC_GREAT_BAY_TEMPLE_MAP_ROOM_WATER_POT_03 },
    { { SCENE_SEA, 1, 6 }, RC_GREAT_BAY_TEMPLE_MAP_ROOM_WATER_POT_04 },
    { { SCENE_SEA, 1, 11 }, RC_GREAT_BAY_TEMPLE_MAP_ROOM_WATER_POT_05 },
    { { SCENE_SEA, 1, 13 }, RC_GREAT_BAY_TEMPLE_MAP_ROOM_WATER_POT_07 },
    { { SCENE_SEA, 1, 10 }, RC_GREAT_BAY_TEMPLE_MAP_ROOM_WATER_POT_08 },
    { { SCENE_SEA, 9, 24 }, RC_GREAT_BAY_TEMPLE_GREEN_PIPE_2_POT_01 },
    { { SCENE_SEA, 9, 25 }, RC_GREAT_BAY_TEMPLE_GREEN_PIPE_2_POT_02 },
    { { SCENE_SEA, 9, 23 }, RC_GREAT_BAY_TEMPLE_GREEN_PIPE_2_POT_03 },
    { { SCENE_SEA, 9, 22 }, RC_GREAT_BAY_TEMPLE_GREEN_PIPE_2_POT_04 },
    { { SCENE_SEA, 9, 26 }, RC_GREAT_BAY_TEMPLE_GREEN_PIPE_2_POT_05 },
    { { SCENE_SEA, 9, 27 }, RC_GREAT_BAY_TEMPLE_GREEN_PIPE_2_POT_06 },
    { { SCENE_SEA, 9, 20 }, RC_GREAT_BAY_TEMPLE_GREEN_PIPE_2_POT_07 },
    { { SCENE_SEA, 9, 21 }, RC_GREAT_BAY_TEMPLE_GREEN_PIPE_2_POT_08 },
    { { SCENE_SEA, 6, 11 }, RC_GREAT_BAY_TEMPLE_RED_PIPE_BEFORE_WART_POT_01 },
    { { SCENE_SEA, 6, 10 }, RC_GREAT_BAY_TEMPLE_RED_PIPE_BEFORE_WART_POT_02 },
    { { SCENE_SEA, 6, 8 }, RC_GREAT_BAY_TEMPLE_RED_PIPE_BEFORE_WART_POT_03 },
    { { SCENE_SEA, 6, 9 }, RC_GREAT_BAY_TEMPLE_RED_PIPE_BEFORE_WART_POT_04 },
    { { SCENE_SEA, 7, 2 }, RC_GREAT_BAY_TEMPLE_WART_POT_01 },
    { { SCENE_SEA, 7, 0 }, RC_GREAT_BAY_TEMPLE_WART_POT_02 },
    { { SCENE_SEA, 7, 6 }, RC_GREAT_BAY_TEMPLE_WART_POT_03 },
    { { SCENE_SEA, 7, 1 }, RC_GREAT_BAY_TEMPLE_WART_POT_04 },
    { { SCENE_SEA, 7, 7 }, RC_GREAT_BAY_TEMPLE_WART_POT_05 },
    { { SCENE_SEA, 7, 4 }, RC_GREAT_BAY_TEMPLE_WART_POT_06 },
    { { SCENE_SEA, 7, 5 }, RC_GREAT_BAY_TEMPLE_WART_POT_07 },
    { { SCENE_SEA, 7, 3 }, RC_GREAT_BAY_TEMPLE_WART_POT_08 },
    // Stone Tower Temple //
    { { SCENE_INISIE_N, 8, 14 }, RC_STONE_TOWER_TEMPLE_SPIKED_BAR_ROOM_POT_01 },
    { { SCENE_INISIE_N, 8, 15 }, RC_STONE_TOWER_TEMPLE_SPIKED_BAR_ROOM_POT_02 },
    { { SCENE_INISIE_N, 8, 18 }, RC_STONE_TOWER_TEMPLE_SPIKED_BAR_ROOM_POT_03 },
    { { SCENE_INISIE_N, 8, 21 }, RC_STONE_TOWER_TEMPLE_SPIKED_BAR_ROOM_POT_04 },
    { { SCENE_INISIE_N, 8, 16 }, RC_STONE_TOWER_TEMPLE_SPIKED_BAR_ROOM_POT_05 },
    { { SCENE_INISIE_N, 8, 17 }, RC_STONE_TOWER_TEMPLE_SPIKED_BAR_ROOM_POT_06 },
    { { SCENE_INISIE_N, 8, 19 }, RC_STONE_TOWER_TEMPLE_SPIKED_BAR_ROOM_POT_07 },
    { { SCENE_INISIE_N, 8, 20 }, RC_STONE_TOWER_TEMPLE_SPIKED_BAR_ROOM_POT_08 },
    { { SCENE_INISIE_N, 0, 7 }, RC_STONE_TOWER_TEMPLE_ENTRANCE_POT_01 },
    { { SCENE_INISIE_N, 0, 8 }, RC_STONE_TOWER_TEMPLE_ENTRANCE_POT_02 },
    { { SCENE_INISIE_N, 4, 15 }, RC_STONE_TOWER_TEMPLE_LAVA_ROOM_POT_01 },
    { { SCENE_INISIE_N, 4, 16 }, RC_STONE_TOWER_TEMPLE_LAVA_ROOM_POT_02 },
    { { SCENE_INISIE_N, 4, 13 }, RC_STONE_TOWER_TEMPLE_LAVA_ROOM_POT_03 },
    { { SCENE_INISIE_N, 4, 14 }, RC_STONE_TOWER_TEMPLE_LAVA_ROOM_POT_04 },
    { { SCENE_INISIE_N, 4, 17 }, RC_STONE_TOWER_TEMPLE_LAVA_ROOM_AFTER_BLOCK_POT_01 },
    { { SCENE_INISIE_N, 4, 12 }, RC_STONE_TOWER_TEMPLE_LAVA_ROOM_AFTER_BLOCK_POT_02 },
    { { SCENE_INISIE_N, 4, 18 }, RC_STONE_TOWER_TEMPLE_LAVA_ROOM_AFTER_BLOCK_POT_03 },
    { { SCENE_INISIE_N, 4, 11 }, RC_STONE_TOWER_TEMPLE_LAVA_ROOM_AFTER_BLOCK_POT_04 },
    { { SCENE_INISIE_N, 7, 6 }, RC_STONE_TOWER_TEMPLE_MIRROR_ROOM_POT_01 },
    { { SCENE_INISIE_N, 7, 5 }, RC_STONE_TOWER_TEMPLE_MIRROR_ROOM_POT_02 },
    { { SCENE_INISIE_N, 3, 12 }, RC_STONE_TOWER_TEMPLE_WATER_ROOM_UNDERWATER_LOWER_POT_01 },
    { { SCENE_INISIE_N, 3, 10 }, RC_STONE_TOWER_TEMPLE_WATER_ROOM_UNDERWATER_LOWER_POT_02 },
    { { SCENE_INISIE_N, 3, 11 }, RC_STONE_TOWER_TEMPLE_WATER_ROOM_UNDERWATER_LOWER_POT_03 },
    { { SCENE_INISIE_N, 3, 13 }, RC_STONE_TOWER_TEMPLE_WATER_ROOM_UNDERWATER_UPPER_POT_01 },
    { { SCENE_INISIE_N, 3, 14 }, RC_STONE_TOWER_TEMPLE_WATER_ROOM_UNDERWATER_UPPER_POT_02 },
    { { SCENE_INISIE_N, 9, 12 }, RC_STONE_TOWER_TEMPLE_WIND_ROOM_POT_01 },
    { { SCENE_INISIE_N, 9, 14 }, RC_STONE_TOWER_TEMPLE_WIND_ROOM_POT_02 },
    { { SCENE_INISIE_N, 9, 11 }, RC_STONE_TOWER_TEMPLE_WIND_ROOM_POT_03 },
    { { SCENE_INISIE_N, 9, 13 }, RC_STONE_TOWER_TEMPLE_WIND_ROOM_POT_04 },
    // Stone Tower Temple - Inverted //
    { { SCENE_INISIE_R, 11, 4 }, RC_STONE_TOWER_TEMPLE_INVERTED_GOMESS_POT_01 },
    { { SCENE_INISIE_R, 11, 1 }, RC_STONE_TOWER_TEMPLE_INVERTED_GOMESS_POT_02 },
    { { SCENE_INISIE_R, 11, 2 }, RC_STONE_TOWER_TEMPLE_INVERTED_GOMESS_POT_03 },
    { { SCENE_INISIE_R, 11, 3 }, RC_STONE_TOWER_TEMPLE_INVERTED_GOMESS_POT_04 },
    { { SCENE_INISIE_R, 2, 11 }, RC_STONE_TOWER_TEMPLE_INVERTED_POE_MAZE_SIDE_POT_01 },
    { { SCENE_INISIE_R, 2, 9 }, RC_STONE_TOWER_TEMPLE_INVERTED_POE_MAZE_SIDE_POT_02 },
    { { SCENE_INISIE_R, 2, 12 }, RC_STONE_TOWER_TEMPLE_INVERTED_POE_WIZZROBE_SIDE_POT_01 },
    { { SCENE_INISIE_R, 2, 10 }, RC_STONE_TOWER_TEMPLE_INVERTED_POE_WIZZROBE_SIDE_POT_02 },
    { { SCENE_INISIE_R, 8, 20 }, RC_STONE_TOWER_TEMPLE_INVERTED_PRE_BOSS_POT_01 },
    { { SCENE_INISIE_R, 8, 18 }, RC_STONE_TOWER_TEMPLE_INVERTED_PRE_BOSS_POT_02 },
    { { SCENE_INISIE_R, 8, 22 }, RC_STONE_TOWER_TEMPLE_INVERTED_PRE_BOSS_POT_03 },
    { { SCENE_INISIE_R, 8, 24 }, RC_STONE_TOWER_TEMPLE_INVERTED_PRE_BOSS_POT_04 },
    { { SCENE_INISIE_R, 8, 21 }, RC_STONE_TOWER_TEMPLE_INVERTED_PRE_BOSS_POT_05 },
    { { SCENE_INISIE_R, 8, 19 }, RC_STONE_TOWER_TEMPLE_INVERTED_PRE_BOSS_POT_06 },
    { { SCENE_INISIE_R, 8, 23 }, RC_STONE_TOWER_TEMPLE_INVERTED_PRE_BOSS_POT_07 },
    { { SCENE_INISIE_R, 8, 25 }, RC_STONE_TOWER_TEMPLE_INVERTED_PRE_BOSS_POT_08 },
    { { SCENE_INISIE_R, 3, 17 }, RC_STONE_TOWER_TEMPLE_INVERTED_UPDRAFTS_BRIDGE_POT_01 },
    { { SCENE_INISIE_R, 3, 16 }, RC_STONE_TOWER_TEMPLE_INVERTED_UPDRAFTS_BRIDGE_POT_02 },
    { { SCENE_INISIE_R, 3, 26 }, RC_STONE_TOWER_TEMPLE_INVERTED_UPDRAFTS_LEDGE_POT_02 },
    { { SCENE_INISIE_R, 3, 23 }, RC_STONE_TOWER_TEMPLE_INVERTED_UPDRAFTS_LEDGE_POT_03 },
    { { SCENE_INISIE_R, 4, 8 }, RC_STONE_TOWER_TEMPLE_INVERTED_WIZZROBE_POT_01 },
    { { SCENE_INISIE_R, 4, 13 }, RC_STONE_TOWER_TEMPLE_INVERTED_WIZZROBE_POT_02 },
    { { SCENE_INISIE_R, 4, 12 }, RC_STONE_TOWER_TEMPLE_INVERTED_WIZZROBE_POT_03 },
    { { SCENE_INISIE_R, 4, 9 }, RC_STONE_TOWER_TEMPLE_INVERTED_WIZZROBE_POT_04 },
};

// Identify the pot based on either the collectible flag if it exists or the scene Id, room, and actor list index
void IdentifyPot(Actor* actor, bool* should) {
    RandoCheckId randoCheckId = RC_UNKNOWN;
    s16 actorListIndex = GetActorListIndex(actor);
    auto randoStaticCheck =
        Rando::StaticData::GetCheckFromFlag(FLAG_CYCL_SCENE_COLLECTIBLE, OBJ_TSUBO_PFE00(actor), gPlayState->sceneId);
    if (randoStaticCheck.randoCheckId != RC_UNKNOWN && randoStaticCheck.randoCheckType == RCTYPE_POT) {
        // Pots using collectible flags
        randoCheckId = randoStaticCheck.randoCheckId;
    } else {
        auto it = potMap.find({ gPlayState->sceneId, gPlayState->roomCtx.curRoom.num, actorListIndex });
        if (it != potMap.end()) {
            randoCheckId = it->second;
        }
    }

    if (!RANDO_SAVE_CHECKS[randoCheckId].shuffled || RANDO_SAVE_CHECKS[randoCheckId].cycleObtained) {
        return;
    }

    Rando::ActorBehavior::SetObjectRandoCheckId(actor, randoCheckId);
}

void ObjTsubo_RandoDraw(Actor* actor, PlayState* play) {
    if (!CVarGetInteger("gRando.CSMC", 0)) {
        Gfx_DrawDListOpa(play, (Gfx*)gPotMajorDL);
        return;
    }

    RandoCheckId randoCheckId = Rando::ActorBehavior::GetObjectRandoCheckId(actor);
    RandoItemId randoItemId = Rando::ConvertItem(RANDO_SAVE_CHECKS[randoCheckId].randoItemId, randoCheckId);
    RandoItemType randoItemType = Rando::StaticData::Items[randoItemId].randoItemType;

    switch (randoItemType) {
        case RITYPE_BOSS_KEY:
            Gfx_DrawDListOpa(play, (Gfx*)gPotBossKeyDL);
            break;
        case RITYPE_HEALTH:
            Gfx_DrawDListOpa(play, (Gfx*)gPotHeartDL);
            break;
        case RITYPE_LESSER:
            Gfx_DrawDListOpa(play, (Gfx*)gPotMinorDL);
            break;
        case RITYPE_MAJOR:
            Gfx_DrawDListOpa(play, (Gfx*)gPotMajorDL);
            break;
        case RITYPE_MASK:
            Gfx_DrawDListOpa(play, (Gfx*)gPotMaskDL);
            break;
        case RITYPE_SKULLTULA_TOKEN:
            Gfx_DrawDListOpa(play, (Gfx*)gPotTokenDL);
            break;
        case RITYPE_SMALL_KEY:
            Gfx_DrawDListOpa(play, (Gfx*)gPotSmallKeyDL);
            break;
        case RITYPE_STRAY_FAIRY:
            Gfx_DrawDListOpa(play, (Gfx*)gPotFairyDL);
            break;
        default:
            Gfx_DrawDListOpa(play, (Gfx*)gPotStandardDL);
            break;
    }
}

void Rando::ActorBehavior::InitObjTsuboBehavior() {
    COND_ID_HOOK(ShouldActorInit, ACTOR_OBJ_TSUBO, IS_RANDO, IdentifyPot);

    COND_VB_SHOULD(VB_POT_DRAW_BE_OVERRIDDEN, IS_RANDO, {
        Actor* actor = va_arg(args, Actor*);
        RandoCheckId randoCheckId = Rando::ActorBehavior::GetObjectRandoCheckId(actor);
        if (randoCheckId != RC_UNKNOWN) {
            *should = false;
            actor->draw = ObjTsubo_RandoDraw;
        }
    });

    COND_VB_SHOULD(VB_POT_DROP_COLLECTIBLE, IS_RANDO, {
        Actor* actor = va_arg(args, Actor*);
        RandoCheckId randoCheckId = Rando::ActorBehavior::GetObjectRandoCheckId(actor);
        if (randoCheckId == RC_UNKNOWN) {
            return;
        }

        RandoSaveCheck& randoSaveCheck = RANDO_SAVE_CHECKS[randoCheckId];

        CustomItem::Spawn(
            actor->world.pos.x, actor->world.pos.y, actor->world.pos.z, 0,
            CustomItem::KILL_ON_TOUCH | CustomItem::TOSS_ON_SPAWN | CustomItem::ABLE_TO_ZORA_RANG, randoCheckId,
            [](Actor* actor, PlayState* play) {
                RandoSaveCheck& randoSaveCheck = RANDO_SAVE_CHECKS[CUSTOM_ITEM_PARAM];
                randoSaveCheck.eligible = true;
            },
            [](Actor* actor, PlayState* play) {
                auto& randoSaveCheck = RANDO_SAVE_CHECKS[CUSTOM_ITEM_PARAM];
                RandoItemId randoItemId = Rando::ConvertItem(randoSaveCheck.randoItemId);
                Matrix_Scale(30.0f, 30.0f, 30.0f, MTXMODE_APPLY);
                Rando::DrawItem(Rando::ConvertItem(randoSaveCheck.randoItemId, (RandoCheckId)CUSTOM_ITEM_PARAM),
                                (RandoCheckId)CUSTOM_ITEM_PARAM, actor);
            });
        *should = false;

        // Clear the stored Check ID for pots that are on a timed respawn
        Rando::ActorBehavior::SetObjectRandoCheckId(actor, RC_UNKNOWN);
        actor->draw = ObjTsubo_Draw;
    });
}
