diff --git a/headers/data/overlay11.h b/headers/data/overlay11.h index 88b346a3..bb02a375 100644 --- a/headers/data/overlay11.h +++ b/headers/data/overlay11.h @@ -21,6 +21,7 @@ extern struct ground_entity_function_table PERFORMER_FUNCTION_TABLE; extern struct window_params TEAM_INFO_BOX_DEFAULT_WINDOW_PARAMS; extern struct overlay_load_entry OVERLAY11_OVERLAY_LOAD_TABLE[21]; extern struct main_ground_data GROUND_STATE_PTRS; +extern struct swap_shop_inventory_ptrs SWAP_SHOP_INVENTORY_PTRS; extern uint32_t WORLD_MAP_MODE; #endif diff --git a/headers/data/overlay21.h b/headers/data/overlay21.h index 033e3afa..77d3f837 100644 --- a/headers/data/overlay21.h +++ b/headers/data/overlay21.h @@ -8,6 +8,7 @@ extern struct simple_menu_id_item SWAP_SHOP_SUBMENU_ITEMS_2[4]; extern struct simple_menu_id_item SWAP_SHOP_MAIN_MENU_ITEMS_1[4]; extern struct simple_menu_id_item SWAP_SHOP_MAIN_MENU_ITEMS_2[5]; extern struct simple_menu_id_item SWAP_SHOP_SUBMENU_ITEMS_3[6]; +extern int16_t OVERLAY21_UNKNOWN_STRING_IDS[24]; extern struct window_params SWAP_SHOP_WINDOW_PARAMS_2; extern struct window_params SWAP_SHOP_WINDOW_PARAMS_3; extern struct window_params SWAP_SHOP_WINDOW_PARAMS_4; @@ -16,5 +17,35 @@ extern struct window_params SWAP_SHOP_WINDOW_PARAMS_6; extern struct window_params SWAP_SHOP_WINDOW_PARAMS_7; extern struct window_params SWAP_SHOP_WINDOW_PARAMS_8; extern struct window_params SWAP_SHOP_WINDOW_PARAMS_9; +extern char SWAP_SHOP_TALK_WELCOME_DEBUG_STRING[28]; +extern char SWAP_SHOP_MAIN_MENU_OPTIONS_DEBUG_STRING[33]; +extern char SWAP_SHOP_TALK_CONTINUE_SWAP_DEBUG_STRING[30]; +extern char SWAP_SHOP_TALK_SUBINFO_DEBUG_STRING[34]; +extern char SWAP_SHOP_TALK_COME_AGAIN_DEBUG_STRING[29]; +extern char SWAP_SHOP_TALK_LACKING_SWAP_ITEMS_DEBUG_STRING[31]; +extern char SWAP_SHOP_TALK_SWAP_BROKE_DEBUG_STRING[30]; +extern char SWAP_SHOP_TALK_SWAP_POOR_DEBUG_STRING[19]; +extern char SWAP_SHOP_UNK_8_DEBUG_STRING[34]; +extern char SWAP_SHOP_CLOSE_SHOP_DEBUG_STRING[26]; +extern char SWAP_SHOP_TALK_WHAT_ITEMS_DEBUG_STRING[35]; +extern char SWAP_SHOP_TALK_VALUABLE_SWAP_DEBUG_STRING[31]; +extern char SWAP_SHOP_INIT_SWAP_ITEMS_MENU_DEBUG_STRING[34]; +extern char SWAP_SHOP_SWAP_ITEMS_MENU_DEBUG_STRING[36]; +extern char SWAP_SHOP_RETURN_SWAP_ITEMS_MENU_DEBUG_STRING[38]; +extern char SWAP_SHOP_SELECT_SWAP_ITEM_OPTIONS_DEBUG_STRING[40]; +extern char SWAP_SHOP_SWAP_ITEM_GET_INFO_DEBUG_STRING[34]; +extern char SWAP_SHOP_ITEM_ZERO_STRING[8]; +extern char SWAP_SHOP_TALK_CONFIRM_SWAP_DEBUG_STRING[39]; +extern char SWAP_SHOP_CONFIRM_CHOICE_DEBUG_STRING[21]; +extern char SWAP_SHOP_INIT_SCRIPT_ACTION_1_DEBUG_STRING[43]; +extern char SWAP_SHOP_INIT_SCRIPT_ACTION_2_DEBUG_STRING[44]; +extern char SWAP_SHOP_INIT_SCRIPT_ACTION_3_DEBUG_STRING[44]; +extern char SWAP_SHOP_TEXT_PUT_IN_CAULDRON_DEBUG_STRING[38]; +extern char SWAP_SHOP_DO_SWAP_THEN_TALK_DEBUG_STRING[36]; +extern wchar_t OVERLAY21_JP_STRING[3]; +extern char SWAP_SHOP_GOLD_STRING[18]; +extern undefined OVERLAY21_RESERVED_SPACE[8]; +extern struct swap_shop_menu_data* SWAP_SHOP_MENU_DATA_PTR; +extern undefined* OVERLAY21_UNKNOWN_POINTER__NA_238CF44; #endif diff --git a/headers/functions/overlay11.h b/headers/functions/overlay11.h index ce96892b..1d0f5784 100644 --- a/headers/functions/overlay11.h +++ b/headers/functions/overlay11.h @@ -157,6 +157,8 @@ void CloseTopGroundMenu(void); int UpdateTopGroundMenu(void); bool IsBagNotEmpty(void); void GetExclusiveItemRequirements(undefined param_1, undefined param_2); +void SwapShopInventoryManager(enum swap_shop_inventory_case inventory_case, + int monster_id_or_exc_item_count); void HandleControlsTopScreenGround(void); bool GetDungeonMapPos(struct uvec2* out_pos, enum dungeon_id dungeon); void WorldMapSetMode(uint32_t world_map_mode); diff --git a/headers/functions/overlay21.h b/headers/functions/overlay21.h new file mode 100644 index 00000000..bad53433 --- /dev/null +++ b/headers/functions/overlay21.h @@ -0,0 +1,12 @@ +#ifndef HEADERS_FUNCTIONS_OVERLAY21_H_ +#define HEADERS_FUNCTIONS_OVERLAY21_H_ + +void SwapShopDialogueManager(enum swap_shared_case new_shared_case); +enum item_id GetFirstExclusivePrerequisite(enum item_id item_id); +int SwapShopEntryPoint(void); +void SwapShopDestructor(void); +int SwapShopMainManager(void); +void CloseTextboxAndSimpleMenu(void); +void SwapShopPrintCurrentGold(int window_id); + +#endif diff --git a/headers/types/common/common.h b/headers/types/common/common.h index f3ccc3de..bdf9343d 100644 --- a/headers/types/common/common.h +++ b/headers/types/common/common.h @@ -784,8 +784,9 @@ struct synth_template { struct item_id_16 exc_item_id; // 0x2: Weight for that item to appear in the swap shop. int16_t item_weight; - // 0x4: Seem to be powers of 2: 2/4/8/16/32. Possibly unused weights from EoTD? - int16_t unk_0x4; + // 0x4: Number of items required to trade for that item in the shop. Seems to match even for + // items with specific requirements. + int16_t num_to_trade; // 0x6: Minimum $SCENARIO_BALANCE_FLAG value for it to spawn. // Only used for the Water Float (6) and the Phione/Manaphy items (7). int16_t min_balance_flag; diff --git a/headers/types/ground_mode/enums.h b/headers/types/ground_mode/enums.h index 4a36955a..0fff3c11 100644 --- a/headers/types/ground_mode/enums.h +++ b/headers/types/ground_mode/enums.h @@ -2116,6 +2116,105 @@ enum script_routine_kind { ENUM_16_BIT(script_routine_kind); #pragma pack(pop) +enum swap_shop_shared_case { + SWAP_SHARED_CASE_TALK_WELCOME = 0, + SWAP_SHARED_CASE_TALK_CONTINUE_SWAP = 1, + SWAP_SHARED_CASE_TALK_WHAT_INFO = 2, + SWAP_SHARED_CASE_TALK_COME_AGAIN = 3, + SWAP_SHARED_CASE_CLOSE_SHOP = 4, + SWAP_SHARED_CASE_TALK_LACKING_SWAP_ITEMS = 5, + SWAP_SHARED_CASE_TALK_SWAP_BROKE = 6, + SWAP_SHARED_CASE_TALK_SWAP_POOR = 7, + // Seems to be an identical copy of SWAP_SHARED_CASE_TALK_SEND_TO_STORAGE. + // Perhaps this was once intended for trying to swap with a full storage, which is impossible by + // design. + SWAP_SHARED_CASE_UNK_0x8 = 8, + SWAP_SHARED_CASE_TALK_WHAT_ITEMS = 9, + SWAP_SHARED_CASE_TALK_VALUABLE_SWAP = 10, + SWAP_SHARED_CASE_INIT_SWAP_ITEMS_MENU = 11, + SWAP_SHARED_CASE_SWAP_ITEMS_MENU = 12, + SWAP_SHARED_CASE_RETURN_SWAP_ITEMS_MENU = 13, + SWAP_SHARED_CASE_SELECT_SWAP_ITEM_OPTIONS = 14, + SWAP_SHARED_CASE_SWAP_ITEM_GET_INFO = 15, + SWAP_SHARED_CASE_TALK_CONFIRM_SWAP = 16, + SWAP_SHARED_CASE_DO_SWAP_THEN_TALK = 17, + SWAP_SHARED_CASE_INIT_SCRIPT_ACTION_1 = 18, + SWAP_SHARED_CASE_INIT_SCRIPT_ACTION_2 = 19, + SWAP_SHARED_CASE_INIT_SCRIPT_ACTION_3 = 20, + SWAP_SHARED_CASE_TEXT_PUT_IN_CAULDRON = 21, + SWAP_SHARED_CASE_TALK_WHAT_WOAH = 22, + SWAP_SHARED_CASE_TALK_SUCCESSFUL_SWAP = 23, + SWAP_SHARED_CASE_TEXT_RECEIVE_SWAP_ITEM = 24, + SWAP_SHARED_CASE_TALK_SEND_TO_STORAGE = 25, + SWAP_SHARED_CASE_CLOSE_DIALOGUE_BOX = 26, + SWAP_SHARED_CASE_MAIN_MENU_OPTIONS = 27, + SWAP_SHARED_CASE_SWAP_CANCELLED = 28, + SWAP_SHARED_CASE_UNK_0x1D = 29, + SWAP_SHARED_CASE_CONFIRM_CHOICE = 30, + SWAP_SHARED_CASE_SWAP_DENIED = 31, + SWAP_SHARED_CASE_TALK_SUBINFO_TRADE_2 = 32, + SWAP_SHARED_CASE_SUBINFO_OPTIONS = 33, + SWAP_SHARED_CASE_TALK_SUBINFO_TRADE_1 = 34, + SWAP_SHARED_CASE_TALK_SUBINFO_LIST = 35, + SWAP_SHARED_CASE_TALK_VIEW_WHOSE_LIST = 36, + SWAP_SHARED_CASE_WHOSE_LIST_OPTIONS = 37, + SWAP_SHARED_CASE_WHOSE_LIST_SUBOPTIONS = 38, + SWAP_SHARED_CASE_CLOSE_LIST_SUBOPTIONS = 39, + SWAP_SHARED_CASE_SHOW_SPECIES_SUMMARY = 40, + SWAP_SHARED_CASE_CLOSE_SPECIES_SUMMARY = 41, + SWAP_SHARED_CASE_SHOW_SPECIES_MOVES = 42, + SWAP_SHARED_CASE_CLOSE_SPECIES_MOVES = 43, + SWAP_SHARED_CASE_SHOW_SPECIES_MOVE_INFO = 44, + SWAP_SHARED_CASE_RETURN_SPECIES_MOVES = 45, + SWAP_SHARED_CASE_SHOW_SPECIES_IQ = 46, + SWAP_SHARED_CASE_CLOSE_SPECIES_IQ = 47, + SWAP_SHARED_CASE_TALK_LIST_SPECIES_CAN_USE = 48, + SWAP_SHARED_CASE_INIT_SPECIES_LIST = 49, + SWAP_SHARED_CASE_CLOSE_SPECIES_LIST = 50, + SWAP_SHARED_CASE_SPECIES_LIST_ITEM_OPTIONS = 51, + SWAP_SHARED_CASE_SPECIES_LIST_ITEM_INFO = 52, + SWAP_SHARED_CASE_TALK_CANCEL_SPECIES_ITEM_LIST = 53, + SWAP_SHARED_CASE_TALK_SEE_OTHER_LISTS = 54, + SWAP_SHARED_CASE_SEE_OTHER_LIST_OPTIONS = 55, + SWAP_SHARED_CASE_TALK_NOBODY_TO_TRADE_WITH = 56, + SWAP_SHARED_CASE_TALK_WHICH_ITEMS_IN_RETURN = 57, + SWAP_SHARED_CASE_INIT_TRADE_AWAY_LIST = 58, + SWAP_SHARED_CASE_RESUME_TRADE_AWAY_LIST = 59, + SWAP_SHARED_CASE_CLOSE_TRADE_AWAY_ITEM_LIST = 60, + SWAP_SHARED_CASE_CLOSE_TRADE_AWAY_ITEM_LIST_INFO = 61, + SWAP_SHARED_CASE_TRADE_AWAY_LIST_ITEM_OPTIONS = 62, + SWAP_SHARED_CASE_SHOW_TRADE_AWAY_LIST_ITEM_INFO = 63, + SWAP_SHARED_CASE_TALK_CANCEL_TRADE_AWAY_ITEM_LIST = 64, + SWAP_SHARED_CASE_INIT_SWAP_SHOP = 65, + SWAP_SHARED_CASE_UNK_0x42 = 66, + SWAP_SHARED_CASE_UNK_0x43 = 67, +}; +// Used exclusively by SwapShopMainManager. +enum swap_shop_main_manager_case { + SWAP_MAIN_CASE_ENTRY_POINT = 0, // Assigned by SwapShopEntryPoint. Seems to set the script + // output case to 0, perhaps resetting it? + SWAP_MAIN_CASE_USE_SHARED_CASE = 1, // Will navigate to the shared_case-specific index. + SWAP_MAIN_CASE_CLOSE_PORTRAIT_AND_TEXTBOX = + 2, // Subsequently sets the case to SWAP_MAIN_CASE_EXIT_SWAP_SHOP + SWAP_MAIN_CASE_EXIT_SWAP_SHOP = 3, // Also sets the script output case to -1. + SWAP_MAIN_CASE_RUN_SCRIPT_ACTION = 4, // Called after each script action, and the entry point. + // Possibly enables the script to run? + SWAP_MAIN_CASE_UNK_0x5 = 5, // Always returns 1. Seems unused. + SWAP_MAIN_CASE_SET_SCRIPT_ACTION_1 = + 6, // Sets script output to 1, allowing croagunk to turn towards the cauldron. + SWAP_MAIN_CASE_SET_SCRIPT_ACTION_2 = + 7, // Sets script output to 2, causing flashing lights and earthquake effects + SWAP_MAIN_CASE_SET_SCRIPT_ACTION_3 = + 8, // Sets script output to 3, causing croagunk to turn towards the player. +}; + +enum swap_shop_inventory_case { + SWAP_INV_CASE_SHOP_ITEMS = 0, + SWAP_INV_CASE_UNK_0x1 = 1, + SWAP_INV_CASE_SPECIES_EXC_ITEM_LIST = 2, + SWAP_INV_CASE_CHOOSE_TRADE_AWAY_ITEMS_LIST = 3, +}; + // These are super long, so split them out into a separate file #include "version_dep_enums.h" diff --git a/headers/types/ground_mode/ground_mode.h b/headers/types/ground_mode/ground_mode.h index 9f48f6f7..9aa51606 100644 --- a/headers/types/ground_mode/ground_mode.h +++ b/headers/types/ground_mode/ground_mode.h @@ -636,4 +636,142 @@ struct ground_entity_function_table { }; ASSERT_SIZE(struct ground_entity_function_table, 80); +struct swap_shop_menu_data { + // 0x0: The switch case index shared by SwapShopMainManager and SwapShopDialogueManager. + enum swap_shop_shared_case current_shared_case; + // 0x4: The "next" switch case index to be shared, typically assigned by SwapShopMainManager. + enum swap_shop_shared_case next_shared_case; + // 0x8: Used exclusively by SwapShopMainManager. More research needed. + int32_t unk_windows_counter; + // 0xC: If true, croagunk will not ask the player if they want to continue swapping. + bool croagunk_out_of_swaps; + undefined field_0xd; + // 0xE: The item the player will receive by swapping. + struct bulk_item received_item; + undefined field_0x12; + undefined field_0x13; + undefined field_0x14; + undefined field_0x15; + undefined field_0x16; + undefined field_0x17; + // 0x18: While selecting which items to give croagunk, this field is filled when selecting + // "info" on an item in the list. + struct bulk_item described_item; + // 0x1C: Whenever a simple menu is run, this field is where the result is stored. + int32_t simple_menu_result; + // 0x20: Zeroed in SwapShopEntryPoint, but never modified + undefined4 unk_int_1; + // 0x24: Zeroed in SwapShopEntryPoint, but never modified + undefined4 unk_int_2; + // 0x28: Emotion for croagunk's portrait. + enum portrait_emotion emotion_id; + // 0x2C: The case menu for a smaller switch case at the top of SwapShopMainManager. + enum swap_shop_main_manager_case main_manager_case; + // 0x30: Stores preprocessor_args for the next window. + struct preprocessor_args preprocessor_args; + // 0x80: The window_id of the current dialogue box window. -2 if none are present. + int8_t dialogue_window_id; + // 0x81: The window_id of the current portrait window. -2 if none are present. + int8_t portrait_window_id; + // 0x82: The window_id of the current advanced textbox window. -2 if none are present. + int8_t advanced_textbox_window_id; + // 0x83: The window_id of the current simple menu window. -2 if none are present. + int8_t simple_menu_window_id; + // 0x84: The window_id of the current text box window. -2 if none are present. + int8_t text_window_id; + // 0x85: The window_id of the current scroll box window. -2 if none are present. + int8_t scroll_box_window_id; + // 0x86: A small buffer for preprocessed text strings. + char text_string[66]; + // 0xC8: Stores portrait_params for croagunk's next portrait. + struct portrait_params portrait_params; + // 0xD8: Stores the number of items required to trade for the current trade. + int16_t exc_item_trade_count; + // 0xDA: The number of exclusive items currently in the bag. + int16_t exc_bag_item_count; + // 0xDC: The individual item IDs of the exclusive items present in the bag. + struct item_id_16 exc_bag_items[50]; + // 0x140: The number of exclusive items currently in storage. + int16_t exc_storage_item_count; + // 0x142: The individual item IDs of the exclusive items in storage. + struct item_id_16 exc_storage_items[1000]; + undefined field_0x912; + undefined field_0x913; + // 0x914: The team member slot whose exclusive items are about to be viewed. + int32_t selected_team_member_slot; + // 0x918: The move slot to create an info menu for. + int16_t selected_move_slot; + // 0x91A: The four moves known by selected_team_member_slot. + struct move known_moves[4]; + undefined field_0x93a; + undefined field_0x93b; +}; +ASSERT_SIZE(struct swap_shop_menu_data, 2364); + +struct swap_shop_inventory_ptrs { + // 0x0: Seems to be a pointer to some kind of temporary variable? + undefined* temp_variable; + // 0x4: A pointer to the swap_shop_inventory_data struct. + struct swap_shop_inventory_data* inventory_data; +}; +ASSERT_SIZE(struct swap_shop_inventory_ptrs, 8); + +struct exc_item_trade_slot { + // 0x0: The trade type the item slot uses. + int16_t trade_type; + // 0x2: This is likely either the item_id of the slot, or the index of the slot. It might vary + // depending on the trade_type. + int16_t unk_0x2; + // 0x4: If the player has enough exclusive items to swap for the item, this will be true. + bool can_afford_item; + undefined unk_0x5; +}; +ASSERT_SIZE(struct exc_item_trade_slot, 6); + +struct swap_shop_inventory_data { + // 0x0: switch case id for SwapShopInventoryManager + enum swap_shop_inventory_case inventory_case; + // 0x4: A copy of num_valid_shop_items to be used by CreateCollectionMenu? + int32_t num_valid_shop_items_temp; + // 0x8: Seemingly unused, these are zeroed for some reason? + int32_t field_0x8[1068]; + // 0x10B8: If the item is purchasable, this field will be 0x2. Otherwise, it will be 0x0. + int8_t is_item_purchasable[1068]; + // 0x14E4: Seems to be a window_id for a collection menu. + int8_t collection_menu_window_id; + undefined field_0x14e5; + // 0x14E6: Seems to be a struct for each item in the shop. + struct exc_item_trade_slot exc_item_trade_slots[1068]; + // 0x2DEE: For each item in the swap list, is the number of that item available? + int16_t item_quantities[1068]; + // 0x3646: List of every exclusive item the player owns. + struct item_id_16 owned_exclusive_items[1000]; + // 0x3E16: List of how much of each owned_exclusive_item the player owns. + int16_t owned_item_quantities[1000]; + // 0x45E6: The synth_templates matching today's rolled swap shop items. + struct synth_template shop_synth_templates[8]; + // 0x4626: Total number of items for sale in the swap shop. + int16_t num_valid_shop_items; + // 0x4628: Number of items required to be traded to croagunk for the selected item. + int16_t num_required_trade_items; + undefined field_0x462a; + undefined field_0x462b; + // 0x462C + struct window_extra_info window_extra_info; + // 0x46C4: Whether or not the synth.bin file is open. + bool synth_bin_open; + undefined field_0x46c5; + undefined field_0x46c6; + undefined field_0x46c7; + // 0x46C8 + int32_t textbox_window_id; + struct text_box* textbox_ptr; + // 0x46D0: The item ID the player selects when choosing items to give croagunk. Used to check + // the item info. + struct item_id_16 selected_item; + undefined field_0x46d2; + undefined field_0x46d3; +}; +ASSERT_SIZE(struct swap_shop_inventory_data, 18132); + #endif diff --git a/symbols/overlay11.yml b/symbols/overlay11.yml index 1aad05ac..87a8e609 100644 --- a/symbols/overlay11.yml +++ b/symbols/overlay11.yml @@ -1487,6 +1487,16 @@ overlay11: r0: ? r1: ? + - name: SwapShopInventoryManager + address: + EU: 0x230BBA8 + description: |- + Called primarily handle the display and preparation of the swap shop inventory list, exclusive items list, and the item trade list. + Creates a swap_shop_inventory_data struct if one does not already exist. + Is the child function to SwapShopDialogueManager. + + r0: switch case index for the function: 0 = Swap List Inventory, 1 = Unknown, 2 = Species Exclusive Item List, 3 = Item Trade Away Selection List. + r1: Depends on r0. If case 2: ID of the monster to retrieve an exclusive item list for. If case 3: Number of Exclusive Items the player owns. - name: HandleControlsTopScreenGround address: EU: 0x230EFB4 @@ -1811,6 +1821,12 @@ overlay11: Host pointers to multiple structure used for performing an overworld scene type: struct main_ground_data + - name: SWAP_SHOP_INVENTORY_PTRS + address: + EU: 0x23258E4 + length: + EU: 0x8 + description: Host pointers to multiple structures used for performing internal Swap Shop checks. - name: WORLD_MAP_MODE address: EU: 0x2325924 diff --git a/symbols/overlay21.yml b/symbols/overlay21.yml index 400cf2b0..fbb33fe5 100644 --- a/symbols/overlay21.yml +++ b/symbols/overlay21.yml @@ -12,7 +12,65 @@ overlay21: NA: 0x2E20 JP: 0x2E40 description: Controls the Croagunk Swap Shop. - functions: [] + functions: + - name: SwapShopDialogueManager + address: + EU: 0x238AC80 + description: |- + Called primarily to fill dialogue boxes or display portraits, this function exists to print the next portrait, dialogue, or input for the Swap Shop. + Consistently writes the provided input to shared_switch_case, and occasionally writes to next_switch_case. + Often calls SwapShopInventoryManager, and is often called by SwapShopMainManager. + + r0: New current_switch_case value. + - name: GetFirstExclusivePrerequisite + address: + EU: 0x238C320 + description: |- + Retrieves the item ID of the first item needed to trade for the specified item. There are hardcoded exceptions for the Eeveelution/Hitmontrio items, + but outside of that, the output will be as follows. + output_id = input_id - ((input_id - 0x1FA) % 4) + + r0: item ID of the exclusive item to be checked. + return: item ID of the first exclusive item required to trade for the input. + - name: SwapShopEntryPoint + address: + EU: 0x238C388 + description: |- + Is the entrypoint of the overlay_load_entry, and seems to run once to initiate the Swap Shop. Is not called anywhere else. + Allocates space for swap_shop_menu_data, and initializes many of its fields. + + return: Always returns 1. + - name: SwapShopDestructor + address: + EU: 0x238C43C + description: |- + Is the destructor of the overlay_load_entry, and seems to run once on closing the Swap Shop. Is not called anywhere else. + Frees up the allocated space for swap_shop_menu_data if it is not already empty. + + No params. + - name: SwapShopMainManager + address: + EU: 0x238C468 + description: |- + Called every frame the Croagunk Swap Shop is open, acting as a parent function for the various processes the Swap Shop is responsible for. + Primarily handles displaying dialogue boxes, retrieving menu selections, and contributing updates to the various switch case indices. + Often calls SwapShopDialogueManager, either with an immediate or with the designated next_switch_case value. + + return: Typically returns 1, but seems to return 4 to exit the Swap Shop. Possibly related to the explorerscript output? + - name: CloseTextboxAndSimpleMenu + address: + EU: 0x238D460 + description: |- + Checks both the text_window_id and menu_window_id for -2. If either are not -2, close the textbox/simple menu, and assign the id to -2. + + No params. + - name: SwapShopPrintCurrentGold + address: + EU: 0x238D4E4 + description: |- + A text box callback function containing the player's current gold using SWAP_SHOP_GOLD_STRING, as seen on the Swap Shop main menu. + + r0: window_id of the textbox data: - name: SWAP_SHOP_WINDOW_PARAMS_1 address: @@ -22,7 +80,7 @@ overlay21: length: EU: 0x10 NA: 0x10 - description: "Note: unverified, ported from Irdkwia's notes" + description: Used with SwapShopPrintCurrentGold for a simple textbox. - name: SWAP_SHOP_MENU_ITEMS_CONFIRM address: EU: 0x238D578 @@ -32,6 +90,7 @@ overlay21: EU: 0x18 NA: 0x18 JP: 0x18 + description: Used with SWAP_SHOP_WINDOW_PARAMS_7. - name: SWAP_SHOP_SUBMENU_ITEMS_1 address: EU: 0x238D590 @@ -41,6 +100,7 @@ overlay21: EU: 0x18 NA: 0x18 JP: 0x18 + description: Used with SWAP_SHOP_WINDOW_PARAMS_6. - name: SWAP_SHOP_SUBMENU_ITEMS_2 address: EU: 0x238D5A8 @@ -50,6 +110,7 @@ overlay21: EU: 0x20 NA: 0x20 JP: 0x20 + description: Used with SWAP_SHOP_WINDOW_PARAMS_7. - name: SWAP_SHOP_MAIN_MENU_ITEMS_1 address: EU: 0x238D5C8 @@ -59,6 +120,7 @@ overlay21: EU: 0x20 NA: 0x20 JP: 0x20 + description: Used with SWAP_SHOP_WINDOW_PARAMS_6. - name: SWAP_SHOP_MAIN_MENU_ITEMS_2 address: EU: 0x238D5E8 @@ -68,6 +130,7 @@ overlay21: EU: 0x28 NA: 0x28 JP: 0x28 + description: Used alongside SWAP_SHOP_WINDOW_PARAMS_5. - name: SWAP_SHOP_SUBMENU_ITEMS_3 address: EU: 0x238D610 @@ -77,30 +140,35 @@ overlay21: EU: 0x30 NA: 0x30 JP: 0x30 + description: Used alongside SWAP_SHOP_WINDOW_PARAMS_9. - name: OVERLAY21_UNKNOWN_STRING_IDS address: + EU: 0x238D640 NA: 0x238CB00 length: NA: 0x38 - description: "Note: unverified, ported from Irdkwia's notes" + description: "Seem to be completely unused by the Swap Shop, but the strings are 1:1 for the ones that are in use elsewhere in the shop." - name: SWAP_SHOP_WINDOW_PARAMS_2 address: + EU: 0x238D678 NA: 0x238CB38 length: NA: 0x10 - description: "Note: unverified, ported from Irdkwia's notes" + description: Seem to be completely unused by the Swap Shop. - name: SWAP_SHOP_WINDOW_PARAMS_3 address: + EU: 0x238D688 NA: 0x238CB48 length: NA: 0x10 - description: "Note: unverified, ported from Irdkwia's notes" + description: Seem to be completely unused by the Swap Shop. - name: SWAP_SHOP_WINDOW_PARAMS_4 address: + EU: 0x238D698 NA: 0x238CB58 length: NA: 0x10 - description: "Note: unverified, ported from Irdkwia's notes" + description: Seem to be completely unused by the Swap Shop. - name: SWAP_SHOP_WINDOW_PARAMS_5 address: EU: 0x238D6A8 @@ -109,7 +177,7 @@ overlay21: length: EU: 0x10 NA: 0x10 - description: "Note: unverified, ported from Irdkwia's notes" + description: Used alongside SWAP_SHOP_MAIN_MENU_ITEMS_2. - name: SWAP_SHOP_WINDOW_PARAMS_6 address: EU: 0x238D6B8 @@ -118,7 +186,7 @@ overlay21: length: EU: 0x10 NA: 0x10 - description: "Note: unverified, ported from Irdkwia's notes" + description: Used alongside both SWAP_SHOP_MAIN_MENU_ITEMS_1 and SWAP_SHOP_SUBMENU_ITEMS_1. - name: SWAP_SHOP_WINDOW_PARAMS_7 address: EU: 0x238D6C8 @@ -127,7 +195,7 @@ overlay21: length: EU: 0x10 NA: 0x10 - description: "Note: unverified, ported from Irdkwia's notes" + description: Used alongside both SWAP_SHOP_MENU_ITEMS_CONFIRM and SWAP_SHOP_SUBMENU_ITEMS_2. - name: SWAP_SHOP_WINDOW_PARAMS_8 address: EU: 0x238D6D8 @@ -136,7 +204,7 @@ overlay21: length: EU: 0x10 NA: 0x10 - description: "Note: unverified, ported from Irdkwia's notes" + description: "Used alone, seemingly for the exclusive item description window." - name: SWAP_SHOP_WINDOW_PARAMS_9 address: EU: 0x238D6E8 @@ -145,7 +213,157 @@ overlay21: length: EU: 0x10 NA: 0x10 - description: "Note: unverified, ported from Irdkwia's notes" + description: Used alongside SWAP_SHOP_SUBMENU_ITEMS_3. + - name: SWAP_SHOP_TALK_WELCOME_DEBUG_STRING + address: + EU: 0x238D6F8 + length: + EU: 0x1D + description: "MENU_SYNTHESIS_MODE_START:\\n" + - name: SWAP_SHOP_MAIN_MENU_OPTIONS_DEBUG_STRING + address: + EU: 0x238D714 + length: + EU: 0x22 + description: "MENU_SYNTHESIS_MODE_SELECTMENU:\\n" + - name: SWAP_SHOP_TALK_CONTINUE_SWAP_DEBUG_STRING + address: + EU: 0x238D738 + length: + EU: 0x1F + description: "MENU_SYNTHESIS_MODE_RESTART:\\n" + - name: SWAP_SHOP_TALK_SUBINFO_DEBUG_STRING + address: + EU: 0x238D758 + length: + EU: 0x23 + description: "MENU_SYNTHESIS_MODE_EXPLANATION:\\n" + - name: SWAP_SHOP_TALK_COME_AGAIN_DEBUG_STRING + address: + EU: 0x238D77C + length: + EU: 0x1E + description: "MENU_SYNTHESIS_MODE_THANKS:\\n" + - name: SWAP_SHOP_TALK_LACKING_SWAP_ITEMS_DEBUG_STRING + address: + EU: 0x238D79C + length: + EU: 0x20 + description: "MENU_SYNTHESIS_MODE_ITEM_NON:\\n" + - name: SWAP_SHOP_TALK_SWAP_BROKE_DEBUG_STRING + address: + EU: 0x238D7BC + length: + EU: 0x1F + description: "MENU_SYNTHESIS_MODE_GOLD_NON\\n" + - name: SWAP_SHOP_TALK_SWAP_POOR_DEBUG_STRING + address: + EU: 0x238D7DC + length: + EU: 0x14 + description: MENU_SYNTHESIS_GOLD + - name: SWAP_SHOP_UNK_8_DEBUG_STRING + address: + EU: 0x238D800 + length: + EU: 0x23 + description: "MENU_SYNTHESIS_MODE_SELECT_FULL:\\n" + - name: SWAP_SHOP_CLOSE_SHOP_DEBUG_STRING + address: + EU: 0x238D824 + length: + EU: 0x1B + description: "MENU_SYNTHESIS_MODE_QUIT\\n" + - name: SWAP_SHOP_TALK_WHAT_ITEMS_DEBUG_STRING + address: + EU: 0x238D840 + length: + EU: 0x24 + description: "MENU_SYNTHESIS_MODE_SELECT_START:\\n" + - name: SWAP_SHOP_TALK_VALUABLE_SWAP_DEBUG_STRING + address: + EU: 0x238D864 + length: + EU: 0x20 + description: "MENU_SYNTHESIS_MODE__RESTART:\\n" + - name: SWAP_SHOP_INIT_SWAP_ITEMS_MENU_DEBUG_STRING + address: + EU: 0x238D884 + length: + EU: 0x23 + description: "MENU_SYNTHESIS_MODE_SELECT_INIT:\\n" + - name: SWAP_SHOP_SWAP_ITEMS_MENU_DEBUG_STRING + address: + EU: 0x238D8A8 + length: + EU: 0x25 + description: "MENU_SYNTHESIS_MODE_SELECT_SELECT:\\n" + - name: SWAP_SHOP_RETURN_SWAP_ITEMS_MENU_DEBUG_STRING + address: + EU: 0x238D8CC + length: + EU: 0x27 + description: "MENU_SYNTHESIS_MODE_SELECT_RESELECT:\\n" + - name: SWAP_SHOP_SELECT_SWAP_ITEM_OPTIONS_DEBUG_STRING + address: + EU: 0x238D8F4 + length: + EU: 0x29 + description: "\\tMENU_SYNTHESIS_MODE_SELECT_SUB_MENU:\\n" + - name: SWAP_SHOP_SWAP_ITEM_GET_INFO_DEBUG_STRING + address: + EU: 0x238D91C + length: + EU: 0x23 + description: "MENU_SYNTHESIS_MODE_SELECT_EXPLA\\n" + - name: SWAP_SHOP_ITEM_ZERO_STRING + address: + EU: 0x238D940 + length: + EU: 0x9 + description: "[item:0]" + - name: SWAP_SHOP_TALK_CONFIRM_SWAP_DEBUG_STRING + address: + EU: 0x238D94C + length: + EU: 0x28 + description: "MENU_SYNTHESIS_MODE_SELECT_CONFIRM_1:\\n" + - name: SWAP_SHOP_CONFIRM_CHOICE_DEBUG_STRING + address: + EU: 0x238D974 + length: + EU: 0x16 + description: "_SELL_CONFIRM NEW_1\\n" + - name: SWAP_SHOP_INIT_SCRIPT_ACTION_1_DEBUG_STRING + address: + EU: 0x238D98C + length: + EU: 0x2C + description: "MENU_SYNTHESIS_MODE_SELECT_THANKS_ACTION:\\n" + - name: SWAP_SHOP_INIT_SCRIPT_ACTION_2_DEBUG_STRING + address: + EU: 0x238D9B8 + length: + EU: 0x2D + description: "MENU_SYNTHESIS_MODE_SELECT_THANKS_ACTION2:\\n" + - name: SWAP_SHOP_INIT_SCRIPT_ACTION_3_DEBUG_STRING + address: + EU: 0x238D9E4 + length: + EU: 0x2D + description: "MENU_SYNTHESIS_MODE_SELECT_THANKS_ACTION3:\\n" + - name: SWAP_SHOP_TEXT_PUT_IN_CAULDRON_DEBUG_STRING + address: + EU: 0x238DA10 + length: + EU: 0x27 + description: "MENU_SYNTHESIS_MODE_SELECT_THANKS_1:\\n" + - name: SWAP_SHOP_DO_SWAP_THEN_TALK_DEBUG_STRING + address: + EU: 0x238DA38 + length: + EU: 0x25 + description: "MENU_SYNTHESIS_MODE_SELECT_THANKS:\\n" - name: OVERLAY21_JP_STRING address: EU: 0x238DA5C @@ -153,21 +371,27 @@ overlay21: JP: 0x238E48C length: NA: 0x8 - description: 合成: + description: 合成:(synthesis in Japanese) + - name: SWAP_SHOP_GOLD_STRING + address: + EU: 0x238DA64 + length: + EU: 0x13 + description: "[CS:V][gold:0][CR]" - name: OVERLAY21_RESERVED_SPACE address: NA: 0x238CF38 length: NA: 0x8 description: "Note: unverified, ported from Irdkwia's notes" - - name: OVERLAY21_UNKNOWN_POINTER__NA_238CF40 + - name: SWAP_SHOP_MENU_DATA_PTR address: EU: 0x238DA80 NA: 0x238CF40 JP: 0x238E4C0 length: NA: 0x4 - description: "Note: unverified, ported from Irdkwia's notes" + description: Pointer to the swap_shop_menu_data that governs the operations of most overlay_21 functions. - name: OVERLAY21_UNKNOWN_POINTER__NA_238CF44 address: NA: 0x238CF44