From 435167674968749684710d7ad5c4f628c6b4ae86 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 16 Dec 2017 00:08:23 +0100 Subject: [PATCH] decompile more of pokeblock.s --- asm/item_menu.s | 32 +- asm/learn_move.s | 8 +- asm/link.s | 32 +- asm/list_menu.s | 18 +- asm/menu_helpers.s | 6 +- asm/overworld.s | 2 +- asm/player_pc.s | 26 +- asm/pokeblock.s | 2002 +---------------- asm/pokemon_summary_screen.s | 24 +- asm/pokenav.s | 4 +- asm/script_pokemon_util_80F87D8.s | 6 +- asm/shop.s | 10 +- data/data4d.s | 9 - data/event_scripts.s | 6 +- data/scripts/cable_club.inc | 4 +- .../BattleFrontier_BattleArenaBattleRoom.inc | 6 +- .../maps/BattleFrontier_BattleArenaLobby.inc | 2 +- .../BattleFrontier_BattleDomeBattleRoom.inc | 4 +- .../maps/BattleFrontier_BattleDomeLobby.inc | 6 +- ...BattleFrontier_BattleDomePreBattleRoom.inc | 2 +- ...BattleFrontier_BattleFactoryBattleRoom.inc | 4 +- ...tleFrontier_BattleFactoryPreBattleRoom.inc | 2 +- .../BattleFrontier_BattlePalaceBattleRoom.inc | 6 +- .../maps/BattleFrontier_BattlePalaceLobby.inc | 2 +- .../maps/BattleFrontier_BattlePikeLobby.inc | 8 +- .../BattleFrontier_BattlePikeRandomRoom1.inc | 4 +- ...attleFrontier_BattlePyramidEmptySquare.inc | 2 +- .../BattleFrontier_BattlePyramidLobby.inc | 6 +- .../BattleFrontier_BattleTowerBattleRoom.inc | 6 +- .../BattleFrontier_BattleTowerBattleRoom2.inc | 2 +- .../maps/BattleFrontier_BattleTowerLobby.inc | 2 +- ...tleFrontier_BattleTowerMultiBattleRoom.inc | 2 +- .../FallarborTown_BattleTentBattleRoom.inc | 2 +- data/scripts/maps/Route101.inc | 2 +- .../SlateportCity_BattleTentBattleRoom.inc | 2 +- .../maps/SlateportCity_BattleTentCorridor.inc | 2 +- .../maps/SlateportCity_OceanicMuseum_2F.inc | 2 +- .../SootopolisCity_MysteryEventsHouse_B1F.inc | 2 +- data/scripts/maps/TrainerHill_Entrance.inc | 4 +- .../VerdanturfTown_BattleTentBattleRoom.inc | 2 +- data/scripts/safari_zone.inc | 2 +- data/specials.inc | 4 +- include/global.h | 13 +- include/list_menu.h | 23 +- include/menu.h | 2 +- include/menu_helpers.h | 7 +- include/pokeblock.h | 15 +- include/strings.h | 9 + src/battle_controller_safari.c | 7 +- src/daycare.c | 9 +- src/decoration.c | 24 +- src/new_game.c | 3 +- src/pokeblock.c | 817 ++++++- src/secret_base.c | 24 +- sym_common.txt | 2 +- sym_ewram.txt | 11 +- 56 files changed, 1061 insertions(+), 2184 deletions(-) diff --git a/asm/item_menu.s b/asm/item_menu.s index b762e8fed..43483216f 100755 --- a/asm/item_menu.s +++ b/asm/item_menu.s @@ -463,7 +463,7 @@ _081AAF54: adds r5, r0, 0 lsls r5, 24 lsrs r5, 24 - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate ldrb r2, [r4, 0x5] lsls r2, 1 adds r1, r4, 0 @@ -719,7 +719,7 @@ _081AB1B2: b _081AB1E4 .pool _081AB1CC: - bl sub_8122328 + bl LoadListMenuArrowsGfx ldr r0, [r4] ldr r1, =0x00000834 adds r0, r1 @@ -902,7 +902,7 @@ _081AB30C: cmp r6, r0 bcc _081AB30C _081AB34A: - ldr r2, =gUnknown_03006310 + ldr r2, =gMultiuseListMenuTemplate adds r1, r2, 0 ldr r0, =gUnknown_08613F9C ldm r0!, {r3-r5} @@ -1924,7 +1924,7 @@ bag_menu_inits_lists_menu: @ 81ABBBC bl sub_81ABA88 ldrb r0, [r7, 0x5] bl load_bag_item_list_buffers - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate mov r2, r8 ldrh r1, [r2] ldrh r2, [r4] @@ -2133,7 +2133,7 @@ _081ABDCC: ldrb r0, [r6] adds r1, r7, 0 mov r2, r8 - bl get_coro_args_x18_x1A + bl sub_81AE860 ldrh r2, [r7] mov r3, r8 ldrh r0, [r3] @@ -2157,12 +2157,12 @@ _081ABDCC: .pool _081ABE10: ldrb r0, [r6] - bl ListMenuHandleInput + bl ListMenuHandleInputGetItemId adds r4, r0, 0 ldrb r0, [r6] adds r1, r7, 0 mov r2, r8 - bl get_coro_args_x18_x1A + bl sub_81AE860 movs r0, 0x2 negs r0, r0 cmp r4, r0 @@ -2603,7 +2603,7 @@ _081AC1DC: subs r5, r4, 0x5 ldrb r0, [r5, 0x5] bl load_bag_item_list_buffers - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate ldrb r2, [r5, 0x5] lsls r2, 1 adds r1, r4, 0 @@ -2847,12 +2847,12 @@ sub_81AC3C0: @ 81AC3C0 adds r1, r2, r1 adds r3, 0x8 adds r2, r3 - bl get_coro_args_x18_x1A + bl sub_81AE860 b _081AC472 .pool _081AC418: ldrb r0, [r4] - bl ListMenuHandleInput + bl ListMenuHandleInputGetItemId adds r7, r0, 0 ldrb r0, [r4] ldr r5, =gUnknown_0203CE58 @@ -2864,7 +2864,7 @@ _081AC418: adds r4, r5, 0 adds r4, 0x8 adds r2, r4 - bl get_coro_args_x18_x1A + bl sub_81AE860 movs r0, 0 bl sub_80D4FC8 ldrb r0, [r5, 0x5] @@ -2989,7 +2989,7 @@ _081AC4F8: _081AC538: ldrb r0, [r5, 0x5] bl load_bag_item_list_buffers - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate mov r2, r8 ldrh r1, [r2] ldrh r2, [r7] @@ -3070,7 +3070,7 @@ sub_81AC590: @ 81AC590 _081AC5F2: ldrb r0, [r4, 0x5] bl load_bag_item_list_buffers - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate ldrh r1, [r6] ldrh r2, [r5] bl ListMenuInit @@ -4326,7 +4326,7 @@ Task_ActuallyToss: @ 81AD150 bl sub_81ABA88 ldrb r0, [r4, 0x5] bl load_bag_item_list_buffers - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate mov r2, r8 ldrh r1, [r2] ldrh r2, [r7] @@ -4388,7 +4388,7 @@ _081AD23A: ldr r0, =gUnknown_0203CE58 ldrb r0, [r0, 0x5] bl load_bag_item_list_buffers - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate ldrh r1, [r6] ldrh r2, [r5] bl ListMenuInit @@ -5155,7 +5155,7 @@ sub_81AD8C8: @ 81AD8C8 bl sub_81ABA88 ldrb r0, [r7, 0x5] bl load_bag_item_list_buffers - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate mov r2, r9 ldrh r1, [r2] ldrh r2, [r5] diff --git a/asm/learn_move.s b/asm/learn_move.s index 6d500d7f6..4670b4e48 100755 --- a/asm/learn_move.s +++ b/asm/learn_move.s @@ -94,7 +94,7 @@ sub_81606A0: @ 81606A0 ldr r0, =gUnknown_085CEBB8 bl LoadSpritePalette bl sub_81610B8 - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate ldrh r1, [r4] ldrh r2, [r4, 0x2] bl ListMenuInit @@ -151,7 +151,7 @@ sub_8160740: @ 8160740 ldr r0, =gUnknown_085CEBB8 bl LoadSpritePalette bl sub_81610B8 - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate ldrh r1, [r4] ldrh r2, [r4, 0x2] bl ListMenuInit @@ -980,7 +980,7 @@ sub_8160F50: @ 8160F50 lsls r4, 1 adds r0, r4 ldrb r0, [r0] - bl ListMenuHandleInput + bl ListMenuHandleInputGetItemId adds r5, r0, 0 ldr r0, [r6] adds r0, r4 @@ -988,7 +988,7 @@ sub_8160F50: @ 8160F50 ldr r4, =gUnknown_0203BC38 adds r2, r4, 0x2 adds r1, r4, 0 - bl get_coro_args_x18_x1A + bl sub_81AE860 movs r0, 0x2 negs r0, r0 cmp r5, r0 diff --git a/asm/link.s b/asm/link.s index 2e6f3f8d3..dc156b269 100644 --- a/asm/link.s +++ b/asm/link.s @@ -18243,7 +18243,7 @@ _08012938: ldrb r0, [r6, 0xF] movs r1, 0 bl sub_81973FC - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate adds r2, r0, 0 ldr r1, =gUnknown_082F015C ldm r1!, {r3,r5,r7} @@ -19724,7 +19724,7 @@ _0801360C: ldrb r0, [r6, 0xB] movs r1, 0 bl sub_81973FC - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate adds r2, r0, 0 ldr r1, =gUnknown_082F0204 ldm r1!, {r3,r5,r7} @@ -19769,7 +19769,7 @@ _080136EA: b _08013A72 _080136F2: ldrb r0, [r6, 0xE] - bl ListMenuHandleInput + bl ListMenuHandleInputGetItemId adds r4, r0, 0 ldr r0, =gMain ldrh r1, [r0, 0x2E] @@ -21038,7 +21038,7 @@ sub_8014210: @ 8014210 adds r6, r0, 0 lsls r6, 16 lsrs r6, 16 - bl sp000_heal_pokemon + bl HealPlayerParty bl copy_player_party_to_sav1 bl copy_bags_and_unk_data_from_save_blocks ldr r5, =gLinkPlayers @@ -21406,7 +21406,7 @@ _080145F4: ldr r0, =gBlockSendBuffer movs r1, 0x1 bl sub_80143E4 - bl sp000_heal_pokemon + bl HealPlayerParty bl copy_player_party_to_sav1 bl copy_bags_and_unk_data_from_save_blocks movs r0, 0x1 @@ -21419,7 +21419,7 @@ _080145F4: .pool _08014620: bl overworld_free_bg_tilemaps - bl sp000_heal_pokemon + bl HealPlayerParty bl copy_player_party_to_sav1 bl copy_bags_and_unk_data_from_save_blocks ldr r0, =gBlockSendBuffer @@ -21435,7 +21435,7 @@ _08014620: .pool _0801464C: bl overworld_free_bg_tilemaps - bl sp000_heal_pokemon + bl HealPlayerParty bl copy_player_party_to_sav1 bl copy_bags_and_unk_data_from_save_blocks ldr r0, =gBlockSendBuffer @@ -21969,7 +21969,7 @@ _08014AEC: strb r0, [r5, 0xF] ldrb r0, [r5, 0xF] bl sub_8018784 - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate adds r2, r0, 0 ldr r1, =gUnknown_082F015C ldm r1!, {r3,r4,r6} @@ -22501,7 +22501,7 @@ _08014FE8: strb r0, [r7, 0xD] ldrb r0, [r7, 0xB] bl sub_8018784 - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate adds r2, r0, 0 ldr r1, =gUnknown_082F0204 ldm r1!, {r3-r5} @@ -22549,7 +22549,7 @@ _080150CE: b _080152A0 _080150D6: ldrb r0, [r7, 0xE] - bl ListMenuHandleInput + bl ListMenuHandleInputGetItemId adds r2, r0, 0 ldr r0, =gMain ldrh r1, [r0, 0x2E] @@ -22874,7 +22874,7 @@ _08015398: strb r0, [r5, 0xB] ldrb r0, [r5, 0xB] bl sub_8018784 - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate adds r2, r0, 0 ldr r1, =gUnknown_082F0204 ldm r1!, {r3,r4,r6} @@ -22920,7 +22920,7 @@ _08015446: cmp r0, 0 beq _08015452 ldrb r0, [r5, 0xE] - bl ListMenuHandleInput + bl ListMenuHandleInputGetItemId _08015452: ldrb r0, [r5, 0x14] cmp r0, 0x78 @@ -26270,7 +26270,7 @@ _080171DC: ldrb r0, [r5] movs r1, 0 bl sub_81973FC - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate adds r2, r0, 0 ldr r1, [sp, 0x24] ldm r1!, {r3,r4,r6} @@ -26295,7 +26295,7 @@ _080171DC: _08017228: mov r3, r9 ldrb r0, [r3] - bl ListMenuHandleInput + bl ListMenuHandleInputGetItemId mov r8, r0 ldr r0, =gMain ldrh r1, [r0, 0x2E] @@ -26383,7 +26383,7 @@ _080172C8: ldrb r0, [r6] movs r1, 0 bl sub_81973FC - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate adds r2, r0, 0 ldr r1, [sp, 0x24] ldm r1!, {r3,r4,r7} @@ -26411,7 +26411,7 @@ _08017314: _0801731C: mov r3, r10 ldrb r0, [r3] - bl ListMenuHandleInput + bl ListMenuHandleInputGetItemId adds r1, r0, 0 ldr r0, =gMain ldrh r2, [r0, 0x2E] diff --git a/asm/list_menu.s b/asm/list_menu.s index 5e6da159e..7fa0a8dd2 100755 --- a/asm/list_menu.s +++ b/asm/list_menu.s @@ -64,7 +64,7 @@ _081AE4B0: ldr r1, [sp, 0x4] bl sub_8098858 _081AE4C0: - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate adds r2, r0, 0 ldr r1, [sp] ldm r1!, {r3-r5} @@ -87,7 +87,7 @@ _081AE4C0: .pool _081AE4F4: ldrb r0, [r5, 0x6] - bl ListMenuHandleInput + bl ListMenuHandleInputGetItemId str r0, [r5] ldr r1, =gMain ldrh r0, [r1, 0x2E] @@ -227,9 +227,9 @@ _081AE5F0: bx r1 thumb_func_end Unused_ListMenuInit2 - thumb_func_start ListMenuHandleInput -@ int ListMenuHandleInput(u8 taskId) -ListMenuHandleInput: @ 81AE604 + thumb_func_start ListMenuHandleInputGetItemId +@ int ListMenuHandleInputGetItemId(u8 taskId) +ListMenuHandleInputGetItemId: @ 81AE604 push {lr} lsls r0, 24 lsrs r0, 24 @@ -337,7 +337,7 @@ _081AE6BE: _081AE6C2: pop {r1} bx r1 - thumb_func_end ListMenuHandleInput + thumb_func_end ListMenuHandleInputGetItemId thumb_func_start sub_81AE6C8 sub_81AE6C8: @ 81AE6C8 @@ -557,8 +557,8 @@ _081AE856: .pool thumb_func_end sub_81AE838 - thumb_func_start get_coro_args_x18_x1A -get_coro_args_x18_x1A: @ 81AE860 + thumb_func_start sub_81AE860 +sub_81AE860: @ 81AE860 push {lr} adds r3, r1, 0 lsls r0, 24 @@ -581,7 +581,7 @@ _081AE882: pop {r0} bx r0 .pool - thumb_func_end get_coro_args_x18_x1A + thumb_func_end sub_81AE860 thumb_func_start ListMenuGetYCoordForPrintingArrowCursor @ u8 ListMenuGetYCoordForPrintingArrowCursor(u8 taskId) diff --git a/asm/menu_helpers.s b/asm/menu_helpers.s index c21ddee78..0dc4cdbf1 100644 --- a/asm/menu_helpers.s +++ b/asm/menu_helpers.s @@ -752,8 +752,8 @@ _08122322: bx r0 thumb_func_end sub_8122298 - thumb_func_start sub_8122328 -sub_8122328: @ 8122328 + thumb_func_start LoadListMenuArrowsGfx +LoadListMenuArrowsGfx: @ 8122328 push {lr} ldr r0, =gUnknown_0859F514 bl LoadCompressedObjectPic @@ -762,7 +762,7 @@ sub_8122328: @ 8122328 pop {r0} bx r0 .pool - thumb_func_end sub_8122328 + thumb_func_end LoadListMenuArrowsGfx thumb_func_start sub_8122344 sub_8122344: @ 8122344 diff --git a/asm/overworld.s b/asm/overworld.s index ea03b8a8d..c8f5d6699 100644 --- a/asm/overworld.s +++ b/asm/overworld.s @@ -21,7 +21,7 @@ sub_8084620: @ 8084620 lsrs r1, 1 adds r0, r4, 0 bl SetMoney - bl sp000_heal_pokemon + bl HealPlayerParty bl sub_8084720 bl copy_saved_warp3_bank_and_enter_x_to_warp1 bl warp_in diff --git a/asm/player_pc.s b/asm/player_pc.s index 2287d4123..125650cda 100644 --- a/asm/player_pc.s +++ b/asm/player_pc.s @@ -733,7 +733,7 @@ sub_816B430: @ 816B430 bl sub_816B4C0 bl sub_816BC14 bl gpu_pal_allocator_reset__manage_upper_four - bl sub_8122328 + bl LoadListMenuArrowsGfx ldr r0, =gUnknown_0203BCC4 ldr r0, [r0] movs r1, 0xCD @@ -1013,7 +1013,7 @@ sub_816B674: @ 816B674 cmp r0, 0 bne _0816B71E ldrb r0, [r4, 0xA] - bl ListMenuHandleInput + bl ListMenuHandleInputGetItemId adds r6, r0, 0 ldrb r0, [r4, 0xA] ldr r7, =gUnknown_0203BCBA @@ -1021,7 +1021,7 @@ sub_816B674: @ 816B674 mov r8, r1 adds r1, r7, 0 mov r2, r8 - bl get_coro_args_x18_x1A + bl sub_81AE860 movs r0, 0x2 negs r0, r0 cmp r6, r0 @@ -1820,7 +1820,7 @@ _0816BD58: movs r1, 0x2 negs r1, r1 str r1, [r0] - ldr r4, =gUnknown_03006310 + ldr r4, =gMultiuseListMenuTemplate adds r1, r4, 0 ldr r0, =gUnknown_085DFF44 ldm r0!, {r2,r3,r6} @@ -2327,7 +2327,7 @@ _0816C186: bl sub_816C110 bl sub_816C140 bl sub_816BD04 - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate ldr r2, =gUnknown_0203BCB8 ldrh r1, [r2, 0x2] ldrh r2, [r2] @@ -2476,7 +2476,7 @@ sub_816C30C: @ 816C30C ldr r1, =gUnknown_0203BCBA subs r4, r1, 0x2 adds r2, r4, 0 - bl get_coro_args_x18_x1A + bl sub_81AE860 ldrh r1, [r4, 0x2] ldrh r0, [r4] adds r1, r0 @@ -2492,12 +2492,12 @@ sub_816C30C: @ 816C30C .pool _0816C35C: ldrb r0, [r4, 0xA] - bl ListMenuHandleInput + bl ListMenuHandleInputGetItemId adds r6, r0, 0 ldrb r0, [r4, 0xA] ldr r1, =gUnknown_0203BCBA subs r2, r1, 0x2 - bl get_coro_args_x18_x1A + bl sub_81AE860 movs r0, 0x2 negs r0, r0 cmp r6, r0 @@ -2691,18 +2691,18 @@ sub_816C4FC: @ 816C4FC ldrb r0, [r4, 0xA] ldr r1, =gUnknown_0203BCBA subs r2, r1, 0x2 - bl get_coro_args_x18_x1A + bl sub_81AE860 b _0816C57E .pool _0816C530: ldrb r0, [r4, 0xA] - bl ListMenuHandleInput + bl ListMenuHandleInputGetItemId adds r6, r0, 0 ldrb r0, [r4, 0xA] ldr r1, =gUnknown_0203BCBA subs r4, r1, 0x2 adds r2, r4, 0 - bl get_coro_args_x18_x1A + bl sub_81AE860 ldr r0, =gUnknown_0203BCC4 ldr r0, [r0] movs r1, 0xCD @@ -2825,7 +2825,7 @@ _0816C622: adds r0, r2 movs r1, 0xFF strb r1, [r0] - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate ldr r2, =gUnknown_0203BCB8 ldrh r1, [r2, 0x2] ldrh r2, [r2] @@ -3363,7 +3363,7 @@ sub_816CB04: @ 816CB04 bl sub_816C110 bl sub_816C140 bl sub_816BD04 - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate ldrh r1, [r4, 0x2] ldrh r2, [r4] bl ListMenuInit diff --git a/asm/pokeblock.s b/asm/pokeblock.s index c5273a731..cd129adb5 100644 --- a/asm/pokeblock.s +++ b/asm/pokeblock.s @@ -5,1963 +5,9 @@ .text - thumb_func_start OpenPokeblockCase -OpenPokeblockCase: @ 81357FC - push {r4-r6,lr} - adds r4, r0, 0 - adds r6, r1, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =gUnknown_0203AB50 - ldr r0, =0x00000e88 - bl Alloc - str r0, [r5] - ldr r2, =0x00000809 - adds r0, r2 - movs r3, 0 - strb r4, [r0] - ldr r0, [r5] - movs r4, 0x80 - lsls r4, 4 - adds r1, r0, r4 - str r3, [r1] - ldr r1, =0x00000e7c - adds r0, r1 - movs r1, 0xFF - strb r1, [r0] - ldr r0, [r5] - ldr r4, =0x00000e7d - adds r0, r4 - strb r3, [r0] - ldr r0, =gUnknown_0203AB48 - str r6, [r0] - ldr r5, [r5] - adds r2, r5, r2 - ldrb r2, [r2] - cmp r2, 0x2 - beq _08135888 - cmp r2, 0x2 - bgt _08135864 - cmp r2, 0x1 - beq _0813586A - b _081358C0 - .pool -_08135864: - cmp r2, 0x3 - beq _081358A4 - b _081358C0 -_0813586A: - ldr r0, =0x00000804 - adds r1, r5, r0 - ldr r0, =sActionsInBattle - str r0, [r1] - ldr r4, =0x00000808 - adds r1, r5, r4 - movs r0, 0x2 - b _081358D2 - .pool -_08135888: - ldr r1, =0x00000804 - adds r0, r5, r1 - ldr r1, =sActionsOnPokeblockFeeder - str r1, [r0] - ldr r4, =0x00000808 - adds r0, r5, r4 - strb r2, [r0] - b _081358D4 - .pool -_081358A4: - ldr r0, =0x00000804 - adds r1, r5, r0 - ldr r0, =sActionsWhenGivingToLady - str r0, [r1] - ldr r4, =0x00000808 - adds r1, r5, r4 - movs r0, 0x2 - b _081358D2 - .pool -_081358C0: - ldr r0, =gUnknown_0203AB50 - ldr r1, [r0] - ldr r0, =0x00000804 - adds r2, r1, r0 - ldr r0, =sActionsOnField - str r0, [r2] - ldr r4, =0x00000808 - adds r1, r4 - movs r0, 0x3 -_081358D2: - strb r0, [r1] -_081358D4: - ldr r0, =sub_813594C - bl SetMainCallback2 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end OpenPokeblockCase - thumb_func_start sub_81358F4 -sub_81358F4: @ 81358F4 - push {lr} - ldr r1, =SetCB2ToReshowScreenAfterMenu2 - movs r0, 0x1 - bl OpenPokeblockCase - pop {r0} - bx r0 - .pool - thumb_func_end sub_81358F4 - - thumb_func_start sub_8135908 -sub_8135908: @ 8135908 - push {lr} - ldr r1, =c2_exit_to_overworld_2_switch - movs r0, 0x2 - bl OpenPokeblockCase - pop {r0} - bx r0 - .pool - thumb_func_end sub_8135908 - - thumb_func_start sub_813591C -sub_813591C: @ 813591C - push {lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl do_scheduled_bg_tilemap_copies_to_vram - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_813591C - - thumb_func_start sub_8135938 -sub_8135938: @ 8135938 - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_8135938 - - thumb_func_start sub_813594C -sub_813594C: @ 813594C - push {lr} -_0813594E: - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08135972 - bl sub_8135978 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08135972 - bl sub_81221AC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0813594E -_08135972: - pop {r0} - bx r0 - thumb_func_end sub_813594C - - thumb_func_start sub_8135978 -sub_8135978: @ 8135978 - push {r4,lr} - sub sp, 0x4 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x12 - bls _0813598C - b _08135BB8 -_0813598C: - lsls r0, 2 - ldr r1, =_081359A0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081359A0: - .4byte _081359EC - .4byte _081359F6 - .4byte _08135A08 - .4byte _08135A0E - .4byte _08135A30 - .4byte _08135A36 - .4byte _08135A54 - .4byte _08135A70 - .4byte _08135A8C - .4byte _08135A9A - .4byte _08135AC4 - .4byte _08135ADC - .4byte _08135AFC - .4byte _08135B02 - .4byte _08135B14 - .4byte _08135B1A - .4byte _08135B64 - .4byte _08135B6A - .4byte _08135B84 -_081359EC: - bl SetVBlankHBlankCallbacksToNull - bl clear_scheduled_bg_copies_to_vram - b _08135B9E -_081359F6: - bl remove_some_task - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _08135BA6 - .pool -_08135A08: - bl FreeAllSpritePalettes - b _08135B9E -_08135A0E: - bl ResetPaletteFade - ldr r2, =gPaletteFade - ldrb r0, [r2, 0x8] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2, 0x8] - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _08135BA6 - .pool -_08135A30: - bl ResetSpriteData - b _08135B9E -_08135A36: - ldr r0, =gUnknown_0203AB50 - ldr r0, [r0] - ldr r1, =0x00000809 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - bne _08135A46 - b _08135B9E -_08135A46: - bl ResetTasks - b _08135B9E - .pool -_08135A54: - bl sub_8135BDC - ldr r0, =gUnknown_0203AB50 - ldr r0, [r0] - ldr r1, =0x00000e7e - adds r0, r1 - movs r1, 0 - strh r1, [r0] - b _08135B9E - .pool -_08135A70: - bl sub_8135C38 - lsls r0, 24 - cmp r0, 0 - bne _08135A7C - b _08135BD0 -_08135A7C: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _08135BA6 - .pool -_08135A8C: - bl sub_813625C - bl sub_81362E0 - bl sub_8136344 - b _08135B9E -_08135A9A: - movs r0, 0x38 - movs r1, 0x40 - movs r2, 0 - bl CreatePokeblockCaseSprite - ldr r1, =gUnknown_0203AB50 - ldr r1, [r1] - ldr r2, =0x00000e74 - adds r1, r2 - strb r0, [r1] - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _08135BA6 - .pool -_08135AC4: - ldr r0, =gUnknown_0203AB50 - ldr r0, [r0] - ldr r1, =0x00000e75 - adds r0, r1 - movs r1, 0x7 - bl sub_8122344 - b _08135B9E - .pool -_08135ADC: - ldr r0, =gUnknown_0203AB48 - ldrh r0, [r0, 0x4] - ldr r1, =0x00001005 - bl sub_8136110 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _08135BA6 - .pool -_08135AFC: - bl sub_8135D24 - b _08135B9E -_08135B02: - bl sub_8135E2C - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _08135BA6 - .pool -_08135B14: - bl sub_81363BC - b _08135B9E -_08135B1A: - ldr r0, =sub_81365C8 - movs r1, 0 - bl CreateTask - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_03006310 - ldr r2, =gUnknown_0203AB48 - ldrh r1, [r2, 0x6] - ldrh r2, [r2, 0x4] - bl ListMenuInit - ldr r2, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r2 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x8] - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _08135BA6 - .pool -_08135B64: - bl sub_8135DAC - b _08135B9E -_08135B6A: - movs r0, 0x1 - negs r0, r0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _08135BA6 - .pool -_08135B84: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x8] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x8] -_08135B9E: - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 -_08135BA6: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08135BD0 - .pool -_08135BB8: - ldr r0, =sub_8135938 - bl SetVBlankCallback - ldr r0, =sub_813591C - bl SetMainCallback2 - movs r0, 0x1 - b _08135BD2 - .pool -_08135BD0: - movs r0, 0 -_08135BD2: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8135978 - - thumb_func_start sub_8135BDC -sub_8135BDC: @ 8135BDC - push {lr} - bl ResetVramOamAndBgCntRegs - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_085B2620 - movs r0, 0 - movs r2, 0x3 - bl InitBgsFromTemplates - ldr r0, =gUnknown_0203AB50 - ldr r1, [r0] - movs r0, 0x2 - bl SetBgTilemapBuffer - bl ResetAllBgsCoordinates - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - pop {r0} - bx r0 - .pool - thumb_func_end sub_8135BDC - - thumb_func_start sub_8135C38 -sub_8135C38: @ 8135C38 - push {r4,lr} - sub sp, 0x4 - ldr r0, =gUnknown_0203AB50 - ldr r0, [r0] - ldr r1, =0x00000e7e - adds r0, r1 - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0x5 - bhi _08135D18 - lsls r0, 2 - ldr r1, =_08135C64 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08135C64: - .4byte _08135C7C - .4byte _08135C98 - .4byte _08135CBC - .4byte _08135CCC - .4byte _08135CD8 - .4byte _08135CFC -_08135C7C: - bl reset_temp_tile_data_buffers - ldr r1, =gMenuPokeblock_Gfx - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - b _08135CDE - .pool -_08135C98: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08135D18 - ldr r0, =gMenuPokeblock_Tilemap - ldr r4, =gUnknown_0203AB50 - ldr r1, [r4] - bl LZDecompressWram - ldr r1, [r4] - b _08135CE2 - .pool -_08135CBC: - ldr r0, =gMenuPokeblock_Pal - movs r1, 0 - movs r2, 0xC0 - bl LoadCompressedPalette - b _08135CDE - .pool -_08135CCC: - ldr r0, =gPokeblockCase_SpriteSheet - bl LoadCompressedObjectPic - b _08135CDE - .pool -_08135CD8: - ldr r0, =gPokeblockCase_SpritePal - bl LoadCompressedObjectPalette -_08135CDE: - ldr r0, =gUnknown_0203AB50 - ldr r1, [r0] -_08135CE2: - ldr r0, =0x00000e7e - adds r1, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - b _08135D18 - .pool -_08135CFC: - bl sub_8122328 - ldr r0, =gUnknown_0203AB50 - ldr r0, [r0] - ldr r1, =0x00000e7e - adds r0, r1 - movs r1, 0 - strh r1, [r0] - movs r0, 0x1 - b _08135D1A - .pool -_08135D18: - movs r0, 0 -_08135D1A: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8135C38 - - thumb_func_start sub_8135D24 -sub_8135D24: @ 8135D24 - push {r4,lr} - ldr r0, =gUnknown_085B2748 - bl InitWindows - bl DeactivateAllTextPrinters - movs r0, 0 - movs r1, 0x1 - movs r2, 0xE0 - bl sub_809882C - movs r0, 0 - movs r1, 0xA - movs r2, 0xD0 - bl copy_textbox_border_tile_patterns_to_vram - ldr r0, =gUnknown_0860F074 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - movs r4, 0 -_08135D50: - adds r0, r4, 0 - movs r1, 0 - bl FillWindowPixelBuffer - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xA - bls _08135D50 - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8135D24 - - thumb_func_start sub_8135D7C -sub_8135D7C: @ 8135D7C - push {r4,lr} - sub sp, 0x14 - lsls r0, 24 - lsrs r0, 24 - lsls r2, 24 - lsrs r2, 24 - movs r4, 0 - str r4, [sp] - str r4, [sp, 0x4] - ldr r3, =sTextColorInPokeblockMenu - str r3, [sp, 0x8] - str r4, [sp, 0xC] - str r1, [sp, 0x10] - movs r1, 0x1 - movs r3, 0x1 - bl AddTextPrinterParametrized2 - add sp, 0x14 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8135D7C - - thumb_func_start sub_8135DAC -sub_8135DAC: @ 8135DAC - push {r4,lr} - ldr r0, =0x00000111 - bl ItemId_GetItem - adds r4, r0, 0 - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x48 - bl GetStringCenterAlignXOffset - adds r2, r0, 0 - movs r0, 0 - adds r1, r4, 0 - bl sub_8135D7C - ldr r1, =gText_Spicy - movs r0, 0x2 - movs r2, 0 - bl sub_8135D7C - ldr r1, =gText_Dry - movs r0, 0x3 - movs r2, 0 - bl sub_8135D7C - ldr r1, =gText_Sweet - movs r0, 0x4 - movs r2, 0 - bl sub_8135D7C - ldr r1, =gText_Bitter - movs r0, 0x5 - movs r2, 0 - bl sub_8135D7C - ldr r1, =gText_Sour - movs r0, 0x6 - movs r2, 0 - bl sub_8135D7C - movs r4, 0 -_08135DFE: - adds r0, r4, 0 - bl PutWindowTilemap - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x7 - bls _08135DFE - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8135DAC - - thumb_func_start sub_8135E2C -sub_8135E2C: @ 8135E2C - push {r4-r7,lr} - movs r6, 0 - ldr r1, =gUnknown_0203AB50 - ldr r0, [r1] - ldr r2, =0x0000080a - adds r0, r2 - ldrb r0, [r0] - subs r0, 0x1 - cmp r6, r0 - bge _08135E7C - adds r5, r1, 0 -_08135E42: - lsls r4, r6, 5 - ldr r3, =0x00000954 - adds r4, r3 - ldr r0, [r5] - adds r0, r4 - adds r1, r6, 0 - bl sub_8135F04 - ldr r1, [r5] - lsls r2, r6, 3 - ldr r7, =0x0000080c - adds r0, r1, r7 - adds r0, r2 - adds r4, r1, r4 - str r4, [r0] - movs r3, 0x81 - lsls r3, 4 - adds r0, r1, r3 - adds r0, r2 - str r6, [r0] - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - ldr r4, =0x0000080a - adds r1, r4 - ldrb r0, [r1] - subs r0, 0x1 - cmp r6, r0 - blt _08135E42 -_08135E7C: - ldr r5, =gUnknown_0203AB50 - lsls r4, r6, 5 - ldr r7, =0x00000954 - adds r4, r7 - ldr r0, [r5] - adds r0, r4 - ldr r1, =gText_StowCase - bl StringCopy - ldr r1, [r5] - lsls r2, r6, 3 - ldr r3, =0x0000080c - adds r0, r1, r3 - adds r0, r2 - adds r4, r1, r4 - str r4, [r0] - movs r0, 0x81 - lsls r0, 4 - adds r1, r0 - adds r1, r2 - movs r0, 0x2 - negs r0, r0 - str r0, [r1] - ldr r2, =gUnknown_03006310 - adds r1, r2, 0 - ldr r0, =gUnknown_085B27B0 - ldm r0!, {r4,r6,r7} - stm r1!, {r4,r6,r7} - ldm r0!, {r4,r6,r7} - stm r1!, {r4,r6,r7} - ldrb r1, [r2, 0x17] - movs r0, 0x40 - negs r0, r0 - ands r0, r1 - movs r1, 0x7 - orrs r0, r1 - strb r0, [r2, 0x17] - ldr r1, [r5] - ldr r4, =0x0000080a - adds r0, r1, r4 - ldrb r0, [r0] - strh r0, [r2, 0xC] - adds r3, r1, r3 - str r3, [r2] - ldr r6, =0x0000080b - adds r1, r6 - ldrb r0, [r1] - strh r0, [r2, 0xE] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8135E2C - - thumb_func_start sub_8135F04 -sub_8135F04: @ 8135F04 - push {r4-r6,lr} - lsls r1, 16 - ldr r2, =gSaveBlock1Ptr - lsrs r1, 13 - ldr r3, =0x00000848 - adds r1, r3 - ldr r5, [r2] - adds r5, r1 - ldr r2, =gPokeblockNames - ldrb r1, [r5] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl StringCopy - adds r4, r0, 0 - movs r0, 0xFC - strb r0, [r4] - adds r4, 0x1 - movs r0, 0x12 - strb r0, [r4] - adds r4, 0x1 - movs r0, 0x57 - strb r0, [r4] - adds r4, 0x1 - ldr r6, =gStringVar1 - adds r0, r5, 0 - bl GetHighestPokeblocksFlavorLevel - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r1, =gText_LvVar1 - adds r0, r4, 0 - bl StringExpandPlaceholders - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8135F04 - - thumb_func_start sub_8135F70 -sub_8135F70: @ 8135F70 - push {r4,lr} - adds r4, r0, 0 - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x1 - beq _08135F9C - movs r0, 0x5 - bl PlaySE - ldr r2, =gSprites - ldr r0, =gUnknown_0203AB50 - ldr r0, [r0] - ldr r1, =0x00000e74 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8136470 - str r1, [r0] -_08135F9C: - ldr r0, =gUnknown_0203AB50 - ldr r0, [r0] - ldr r1, =0x00000e7d - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _08135FB0 - adds r0, r4, 0 - bl sub_8135FCC -_08135FB0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8135F70 - - thumb_func_start sub_8135FCC -sub_8135FCC: @ 8135FCC - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - adds r4, r0, 0 - movs r0, 0x7 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _081360A0 - ldr r1, =gSaveBlock1Ptr - lsls r0, r4, 3 - ldr r2, =0x00000848 - adds r0, r2 - ldr r1, [r1] - adds r1, r0 - mov r8, r1 - add r1, sp, 0x8 - movs r0, 0x17 - strh r0, [r1] - movs r0, 0x18 - strh r0, [r1, 0x2] - movs r5, 0 - adds r6, r1, 0 -_08136002: - adds r4, r5, 0x1 - lsls r1, r4, 24 - lsrs r1, 24 - mov r0, r8 - bl GetPokeblockData - lsls r0, 16 - adds r7, r4, 0 - cmp r0, 0 - ble _0813602C - lsls r1, r5, 12 - adds r0, r1, 0 - adds r0, 0x17 - strh r0, [r6] - adds r1, 0x18 - strh r1, [r6, 0x2] - b _08136032 - .pool -_0813602C: - movs r0, 0xF - strh r0, [r6] - strh r0, [r6, 0x2] -_08136032: - adds r0, r5, 0 - movs r1, 0x3 - bl __udivsi3 - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 1 - adds r4, r0 - lsls r4, 1 - adds r4, 0x1 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - movs r1, 0x3 - bl __umodsi3 - adds r3, r0, 0 - lsls r3, 25 - movs r0, 0xD0 - lsls r0, 20 - adds r3, r0 - lsrs r3, 24 - movs r0, 0x1 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - add r1, sp, 0x8 - adds r2, r4, 0 - bl CopyToBgTilemapBufferRect - lsls r0, r7, 24 - lsrs r5, r0, 24 - cmp r5, 0x4 - bls _08136002 - ldr r4, =gStringVar1 - mov r0, r8 - bl GetPokeblocksFeel - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - movs r0, 0x7 - adds r1, r4, 0 - movs r2, 0x4 - bl sub_8135D7C - b _081360F8 - .pool -_081360A0: - add r0, sp, 0x8 - movs r1, 0xF - strh r1, [r0] - strh r1, [r0, 0x2] - movs r5, 0 -_081360AA: - adds r0, r5, 0 - movs r1, 0x3 - bl __udivsi3 - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 1 - adds r4, r0 - lsls r4, 1 - adds r4, 0x1 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - movs r1, 0x3 - bl __umodsi3 - adds r3, r0, 0 - lsls r3, 25 - movs r2, 0xD0 - lsls r2, 20 - adds r3, r2 - lsrs r3, 24 - movs r0, 0x1 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - add r1, sp, 0x8 - adds r2, r4, 0 - bl CopyToBgTilemapBufferRect - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x4 - bls _081360AA - movs r0, 0x7 - movs r1, 0x2 - bl CopyWindowToVram -_081360F8: - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8135FCC - - thumb_func_start sub_8136110 -sub_8136110: @ 8136110 - push {lr} - sub sp, 0x8 - adds r3, r0, 0 - lsls r3, 16 - lsls r1, 16 - lsrs r1, 16 - lsrs r3, 15 - adds r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0xE - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r2, 0xF - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0x8 - pop {r0} - bx r0 - thumb_func_end sub_8136110 - - thumb_func_start sub_8136140 -sub_8136140: @ 8136140 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - movs r2, 0 -_0813614A: - adds r1, r2, 0x1 - lsls r0, r1, 16 - lsrs r6, r0, 16 - mov r12, r1 - cmp r6, 0x27 - bhi _08136192 - ldr r0, =gSaveBlock1Ptr - mov r9, r0 - lsls r7, r2, 3 - ldr r1, =0x00000848 - mov r8, r1 -_08136160: - mov r0, r9 - ldr r2, [r0] - adds r0, r2, r7 - add r0, r8 - ldrb r0, [r0] - cmp r0, 0 - bne _08136188 - ldr r1, =0x00000848 - adds r2, r1 - adds r3, r2, r7 - ldr r4, [r3] - ldr r5, [r3, 0x4] - lsls r0, r6, 3 - adds r2, r0 - ldr r0, [r2] - ldr r1, [r2, 0x4] - str r0, [r3] - str r1, [r3, 0x4] - str r4, [r2] - str r5, [r2, 0x4] -_08136188: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x27 - bls _08136160 -_08136192: - mov r1, r12 - lsls r0, r1, 16 - lsrs r2, r0, 16 - cmp r2, 0x26 - bls _0813614A - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8136140 - - thumb_func_start sub_81361B0 -sub_81361B0: @ 81361B0 - push {r4-r7,lr} - adds r4, r0, 0 - adds r5, r1, 0 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00000848 - adds r6, r0, r1 - cmp r4, r5 - beq _08136246 - movs r0, 0x8 - bl Alloc - adds r7, r0, 0 - lsls r0, r4, 3 - adds r0, r6 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [r7] - str r1, [r7, 0x4] - cmp r5, r4 - bls _0813620C - subs r5, 0x1 - lsls r3, r4, 16 - lsls r0, r5, 16 - asrs r1, r0, 16 - cmp r3, r0 - bge _08136234 - adds r4, r1, 0 -_081361E8: - asrs r3, 16 - lsls r2, r3, 3 - adds r2, r6 - ldr r0, [r2, 0x8] - ldr r1, [r2, 0xC] - str r0, [r2] - str r1, [r2, 0x4] - adds r3, 0x1 - lsls r3, 16 - asrs r0, r3, 16 - cmp r0, r4 - blt _081361E8 - b _08136234 - .pool -_0813620C: - lsls r3, r4, 16 - lsls r0, r5, 16 - asrs r1, r0, 16 - cmp r3, r0 - ble _08136234 - adds r4, r1, 0 -_08136218: - asrs r3, 16 - lsls r2, r3, 3 - adds r2, r6 - adds r0, r2, 0 - subs r0, 0x8 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [r2] - str r1, [r2, 0x4] - subs r3, 0x1 - lsls r3, 16 - asrs r0, r3, 16 - cmp r0, r4 - bgt _08136218 -_08136234: - lsls r2, r5, 3 - adds r2, r6 - ldr r0, [r7] - ldr r1, [r7, 0x4] - str r0, [r2] - str r1, [r2, 0x4] - adds r0, r7, 0 - bl Free -_08136246: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81361B0 - - thumb_func_start sub_813624C -sub_813624C: @ 813624C - ldr r1, =gUnknown_0203AB48 - movs r0, 0 - strh r0, [r1, 0x4] - strh r0, [r1, 0x6] - bx lr - .pool - thumb_func_end sub_813624C - - thumb_func_start sub_813625C -sub_813625C: @ 813625C - push {r4,r5,lr} - bl sub_8136140 - ldr r0, =gUnknown_0203AB50 - ldr r0, [r0] - ldr r1, =0x0000080a - adds r0, r1 - movs r1, 0 - strb r1, [r0] - movs r2, 0 - ldr r5, =gSaveBlock1Ptr - ldr r4, =0x00000848 -_08136274: - ldr r0, [r5] - lsls r1, r2, 3 - adds r0, r1 - adds r0, r4 - ldrb r0, [r0] - ldr r3, =gUnknown_0203AB50 - cmp r0, 0 - beq _08136290 - ldr r1, [r3] - ldr r0, =0x0000080a - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_08136290: - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x27 - bls _08136274 - ldr r0, [r3] - ldr r2, =0x0000080a - adds r0, r2 - ldrb r1, [r0] - adds r1, 0x1 - strb r1, [r0] - ldr r0, [r3] - adds r2, r0, r2 - ldrb r2, [r2] - cmp r2, 0x9 - bls _081362D0 - ldr r2, =0x0000080b - adds r1, r0, r2 - movs r0, 0x9 - strb r0, [r1] - b _081362D6 - .pool -_081362D0: - ldr r1, =0x0000080b - adds r0, r1 - strb r2, [r0] -_081362D6: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813625C - - thumb_func_start sub_81362E0 -sub_81362E0: @ 81362E0 - push {r4,r5,lr} - ldr r0, =gUnknown_0203AB48 - ldrh r1, [r0, 0x6] - adds r3, r0, 0 - ldr r4, =gUnknown_0203AB50 - cmp r1, 0 - beq _08136308 - ldrh r0, [r3, 0x6] - ldr r1, [r4] - ldr r5, =0x0000080b - adds r2, r1, r5 - ldrb r2, [r2] - adds r0, r2 - subs r5, 0x1 - adds r1, r5 - ldrb r1, [r1] - cmp r0, r1 - ble _08136308 - subs r0, r1, r2 - strh r0, [r3, 0x6] -_08136308: - adds r2, r3, 0 - ldrh r1, [r2, 0x6] - ldrh r0, [r2, 0x4] - adds r1, r0 - ldr r0, [r4] - ldr r4, =0x0000080a - adds r0, r4 - ldrb r0, [r0] - cmp r1, r0 - blt _0813633C - adds r1, r0, 0 - cmp r1, 0 - bne _08136338 - strh r1, [r2, 0x4] - b _0813633C - .pool -_08136338: - subs r0, 0x1 - strh r0, [r3, 0x4] -_0813633C: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81362E0 - - thumb_func_start sub_8136344 -sub_8136344: @ 8136344 - push {r4-r7,lr} - ldr r0, =gUnknown_0203AB48 - ldrh r1, [r0, 0x4] - adds r5, r0, 0 - cmp r1, 0x4 - bls _081363A4 - movs r4, 0 - ldrh r0, [r5, 0x4] - subs r0, 0x4 - cmp r4, r0 - bge _081363A4 - ldrh r2, [r5, 0x6] - ldr r6, =gUnknown_0203AB50 - ldr r0, [r6] - ldr r3, =0x0000080b - adds r1, r0, r3 - ldrb r1, [r1] - adds r2, r1 - ldr r7, =0x0000080a - adds r0, r7 - ldrb r0, [r0] - cmp r2, r0 - beq _081363A4 - adds r3, r5, 0 -_08136374: - ldrh r0, [r3, 0x4] - subs r0, 0x1 - strh r0, [r3, 0x4] - ldrh r0, [r3, 0x6] - adds r0, 0x1 - strh r0, [r3, 0x6] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - ldrh r0, [r3, 0x4] - subs r0, 0x4 - cmp r4, r0 - bge _081363A4 - ldrh r2, [r5, 0x6] - ldr r1, [r6] - ldr r7, =0x0000080b - adds r0, r1, r7 - ldrb r0, [r0] - adds r2, r0 - ldr r0, =0x0000080a - adds r1, r0 - ldrb r1, [r1] - cmp r2, r1 - bne _08136374 -_081363A4: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8136344 - - thumb_func_start sub_81363BC -sub_81363BC: @ 81363BC - push {r4,lr} - sub sp, 0x10 - ldr r4, =gUnknown_0203AB50 - ldr r1, [r4] - ldr r2, =0x00000e7c - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0xFF - bne _081363FC - ldr r2, =0x0000080a - adds r0, r1, r2 - ldrb r0, [r0] - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - subs r0, r1 - str r0, [sp] - ldr r0, =0x00000456 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - ldr r0, =gUnknown_0203AB4E - str r0, [sp, 0xC] - movs r0, 0x2 - movs r1, 0xB0 - movs r2, 0x8 - movs r3, 0x98 - bl AddScrollIndicatorArrowPairParametrized - ldr r1, [r4] - ldr r2, =0x00000e7c - adds r1, r2 - strb r0, [r1] -_081363FC: - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81363BC - - thumb_func_start sub_8136418 -sub_8136418: @ 8136418 - push {r4,lr} - ldr r4, =gUnknown_0203AB50 - ldr r0, [r4] - ldr r2, =0x00000e7c - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0xFF - beq _08136436 - bl RemoveScrollIndicatorArrowPair - ldr r0, [r4] - ldr r1, =0x00000e7c - adds r0, r1 - movs r1, 0xFF - strb r1, [r0] -_08136436: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8136418 - - thumb_func_start CreatePokeblockCaseSprite -CreatePokeblockCaseSprite: @ 8136444 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r3, r2, 0 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =sSpriteTemplate_PokeblockCase - lsls r4, 16 - asrs r4, 16 - lsls r5, 16 - asrs r5, 16 - adds r1, r4, 0 - adds r2, r5, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end CreatePokeblockCaseSprite - - thumb_func_start sub_8136470 -sub_8136470: @ 8136470 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x1 - ble _08136480 - movs r0, 0 - strh r0, [r4, 0x2E] -_08136480: - movs r0, 0x2E - ldrsh r5, [r4, r0] - cmp r5, 0 - beq _0813648E - cmp r5, 0x1 - beq _081364B4 - b _081364E0 -_0813648E: - ldrb r1, [r4, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r4, 0x1] - ldr r0, =sSpriteAffineAnimTable_85B26F0 - str r0, [r4, 0x10] - adds r0, r4, 0 - bl InitSpriteAffineAnim - movs r0, 0x1 - strh r0, [r4, 0x2E] - strh r5, [r4, 0x30] - b _081364E0 - .pool -_081364B4: - ldrh r0, [r4, 0x30] - adds r0, 0x1 - movs r2, 0 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xB - ble _081364E0 - ldrb r1, [r4, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r1 - strb r0, [r4, 0x1] - strh r2, [r4, 0x2E] - strh r2, [r4, 0x30] - ldrb r0, [r4, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - ldr r0, =SpriteCallbackDummy - str r0, [r4, 0x1C] -_081364E0: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8136470 - - thumb_func_start sub_81364EC -sub_81364EC: @ 81364EC - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_8136524 - str r1, [r0] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81364EC - - thumb_func_start sub_8136524 -sub_8136524: @ 8136524 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r2, r0, r1 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081365BE - ldr r6, =gUnknown_0203AB50 - ldr r0, [r6] - ldr r1, =0x00000809 - adds r0, r1 - ldrb r0, [r0] - subs r0, 0x2 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _0813655A - ldr r1, =gFieldCallback - ldr r0, =sub_80AF168 - str r0, [r1] -_0813655A: - ldrb r0, [r2] - ldr r4, =gUnknown_0203AB4E - subs r2, r4, 0x2 - adds r1, r4, 0 - bl sub_81AE6C8 - bl sub_8136418 - bl ResetSpriteData - bl FreeAllSpritePalettes - ldr r0, [r6] - movs r1, 0x80 - lsls r1, 4 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0 - beq _081365A4 - bl SetMainCallback2 - b _081365AC - .pool -_081365A4: - subs r0, r4, 0x6 - ldr r0, [r0] - bl SetMainCallback2 -_081365AC: - bl FreeAllWindowBuffers - ldr r0, =gUnknown_0203AB50 - ldr r0, [r0] - bl Free - adds r0, r5, 0 - bl DestroyTask -_081365BE: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8136524 - - thumb_func_start sub_81365C8 -sub_81365C8: @ 81365C8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r7, r0, 24 - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - mov r8, r0 - ldr r0, =gTasks + 0x8 - mov r10, r0 - mov r6, r8 - add r6, r10 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _081365F4 - b _08136708 -_081365F4: - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08136602 - b _08136708 -_08136602: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x4 - ands r0, r1 - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - cmp r0, 0 - beq _08136688 - ldrb r0, [r6] - ldr r4, =gUnknown_0203AB4E - subs r2, r4, 0x2 - adds r1, r4, 0 - bl get_coro_args_x18_x1A - subs r4, 0x6 - ldrh r1, [r4, 0x6] - ldrh r0, [r4, 0x4] - adds r1, r0 - ldr r5, =gUnknown_0203AB50 - ldr r0, [r5] - ldr r2, =0x0000080a - adds r0, r2 - ldrb r0, [r0] - subs r0, 0x1 - cmp r1, r0 - beq _08136708 - movs r0, 0x5 - bl PlaySE - ldrh r0, [r4, 0x4] - ldr r1, =0x00002005 - bl sub_8136110 - ldrh r0, [r4, 0x4] - ldrh r4, [r4, 0x6] - adds r0, r4 - strh r0, [r6, 0x4] - ldr r0, [r5] - ldr r1, =0x00000e7d - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] - mov r0, r10 - subs r0, 0x8 - add r0, r8 - ldr r1, =sub_813671C - str r1, [r0] - b _08136708 - .pool -_08136688: - ldr r5, =gUnknown_0203AB48 - ldrh r2, [r5, 0x4] - mov r8, r2 - ldrb r0, [r6] - bl ListMenuHandleInput - adds r4, r0, 0 - ldrb r0, [r6] - adds r1, r5, 0x6 - adds r2, r5, 0x4 - bl get_coro_args_x18_x1A - ldrh r0, [r5, 0x4] - cmp r8, r0 - beq _081366B6 - mov r0, r8 - movs r1, 0x5 - bl sub_8136110 - ldrh r0, [r5, 0x4] - ldr r1, =0x00001005 - bl sub_8136110 -_081366B6: - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _081366D0 - adds r0, 0x1 - cmp r4, r0 - bne _081366F8 - b _08136708 - .pool -_081366D0: - movs r0, 0x5 - bl PlaySE - ldr r0, =gSpecialVar_Result - ldr r2, =0x0000ffff - adds r1, r2, 0 - strh r1, [r0] - ldr r0, =gSpecialVar_ItemId - mov r1, r9 - strh r1, [r0] - adds r0, r7, 0 - bl sub_81364EC - b _08136708 - .pool -_081366F8: - movs r0, 0x5 - bl PlaySE - ldr r0, =gSpecialVar_ItemId - strh r4, [r0] - adds r0, r7, 0 - bl sub_8136938 -_08136708: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81365C8 - - thumb_func_start sub_813671C -sub_813671C: @ 813671C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r0, 2 - add r0, r8 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r7, r0, r1 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08136742 - b _08136848 -_08136742: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0813676C - movs r0, 0x5 - bl PlaySE - ldrb r0, [r7] - ldr r1, =gUnknown_0203AB4E - subs r2, r1, 0x2 - bl get_coro_args_x18_x1A - b _08136822 - .pool -_0813676C: - ldr r6, =gUnknown_0203AB48 - ldrh r4, [r6, 0x6] - ldrh r5, [r6, 0x4] - ldrb r0, [r7] - bl ListMenuHandleInput - mov r9, r0 - ldrb r0, [r7] - adds r1, r6, 0x6 - adds r2, r6, 0x4 - bl get_coro_args_x18_x1A - ldrh r0, [r6, 0x6] - cmp r4, r0 - bne _08136790 - ldrh r6, [r6, 0x4] - cmp r5, r6 - beq _081367CA -_08136790: - movs r4, 0 -_08136792: - ldr r0, =gUnknown_0203AB48 - ldrh r0, [r0, 0x6] - adds r0, r4, r0 - lsls r0, 16 - lsrs r5, r0, 16 - movs r1, 0x4 - ldrsh r0, [r7, r1] - cmp r5, r0 - bne _081367B8 - adds r0, r4, 0 - ldr r1, =0x00002005 - bl sub_8136110 - b _081367C0 - .pool -_081367B8: - adds r0, r4, 0 - movs r1, 0x5 - bl sub_8136110 -_081367C0: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x8 - bls _08136792 -_081367CA: - ldr r5, =gUnknown_0203AB50 - ldr r0, [r5] - ldr r4, =0x00000e75 - adds r0, r4 - movs r1, 0x7 - movs r2, 0 - bl sub_81223FC - ldr r0, [r5] - adds r0, r4 - ldr r1, =gUnknown_0203AB48 - ldrh r3, [r1, 0x4] - lsls r3, 4 - adds r3, 0x8 - lsls r3, 16 - lsrs r3, 16 - movs r1, 0x7 - movs r2, 0x80 - bl sub_8122448 - movs r0, 0x2 - negs r0, r0 - cmp r9, r0 - beq _08136810 - adds r0, 0x1 - cmp r9, r0 - bne _0813683A - b _08136848 - .pool -_08136810: - movs r0, 0x5 - bl PlaySE - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08136830 -_08136822: - mov r0, r8 - movs r1, 0 - bl sub_8136854 - b _08136848 - .pool -_08136830: - mov r0, r8 - movs r1, 0x1 - bl sub_8136854 - b _08136848 -_0813683A: - movs r0, 0x5 - bl PlaySE - mov r0, r8 - movs r1, 0 - bl sub_8136854 -_08136848: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_813671C - - thumb_func_start sub_8136854 -sub_8136854: @ 8136854 - push {r4-r7,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r7, r0, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - ldr r2, =gUnknown_0203AB48 - ldrh r0, [r2, 0x4] - ldrh r1, [r2, 0x6] - adds r0, r1 - lsls r0, 16 - lsrs r5, r0, 16 - ldr r0, =gUnknown_0203AB50 - ldr r0, [r0] - ldr r1, =0x00000e7d - adds r0, r1 - movs r1, 0 - strb r1, [r0] - ldrb r0, [r6] - adds r1, r2, 0x6 - adds r2, 0x4 - bl sub_81AE6C8 - cmp r4, 0 - bne _081368AA - movs r0, 0x4 - ldrsh r1, [r6, r0] - cmp r1, r5 - beq _081368BA - subs r0, r5, 0x1 - cmp r1, r0 - beq _081368AA - adds r0, r1, 0 - adds r1, r5, 0 - bl sub_81361B0 - bl sub_8135E2C -_081368AA: - movs r1, 0x4 - ldrsh r0, [r6, r1] - cmp r0, r5 - bge _081368BA - ldr r1, =gUnknown_0203AB48 - ldrh r0, [r1, 0x4] - subs r0, 0x1 - strh r0, [r1, 0x4] -_081368BA: - ldr r0, =gUnknown_03006310 - ldr r2, =gUnknown_0203AB48 - ldrh r1, [r2, 0x6] - ldrh r2, [r2, 0x4] - bl ListMenuInit - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6] - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - ldr r0, =gUnknown_0203AB50 - ldr r0, [r0] - ldr r1, =0x00000e75 - adds r0, r1 - movs r1, 0x7 - movs r2, 0x1 - bl sub_81223FC - movs r4, 0 - lsls r5, r7, 2 -_081368E6: - adds r0, r4, 0 - movs r1, 0x5 - bl sub_8136110 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x8 - bls _081368E6 - ldr r0, =gUnknown_0203AB48 - ldrh r0, [r0, 0x4] - ldr r1, =0x00001005 - bl sub_8136110 - ldr r1, =gTasks - adds r0, r5, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81365C8 - str r1, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8136854 - - thumb_func_start sub_8136938 -sub_8136938: @ 8136938 + thumb_func_start PutPokeblockOptionsWindow +PutPokeblockOptionsWindow: @ 8136938 push {r4-r7,lr} lsls r0, 24 lsrs r7, r0, 24 @@ -1970,7 +16,7 @@ sub_8136938: @ 8136938 lsls r0, 3 ldr r1, =gTasks + 0x8 adds r6, r0, r1 - ldr r0, =gUnknown_0203AB50 + ldr r0, =sPokeblockMenu ldr r0, [r0] ldr r1, =0x00000808 adds r0, r1 @@ -1991,7 +37,7 @@ _0813696A: movs r3, 0xE bl SetWindowBorderStyle ldrb r0, [r6, 0x2] - ldr r5, =gUnknown_0203AB50 + ldr r5, =sPokeblockMenu ldr r3, [r5] ldr r4, =0x00000808 adds r1, r3, r4 @@ -2024,7 +70,7 @@ _0813696A: pop {r0} bx r0 .pool - thumb_func_end sub_8136938 + thumb_func_end PutPokeblockOptionsWindow thumb_func_start sub_81369E0 sub_81369E0: @ 81369E0 @@ -2056,7 +102,7 @@ _08136A18: movs r0, 0x5 bl PlaySE ldr r1, =sPokeblockMenuActions - ldr r0, =gUnknown_0203AB50 + ldr r0, =sPokeblockMenu ldr r0, [r0] ldr r2, =0x00000804 adds r0, r2 @@ -2081,14 +127,14 @@ PokeblockAction_UseOnField: @ 8136A50 push {lr} lsls r0, 24 lsrs r0, 24 - ldr r1, =gUnknown_0203AB50 + ldr r1, =sPokeblockMenu ldr r1, [r1] movs r2, 0x80 lsls r2, 4 adds r1, r2 ldr r2, =sub_8136A74 str r2, [r1] - bl sub_81364EC + bl FadePaletteAndSetTaskToClosePokeblockCase pop {r0} bx r0 .pool @@ -2115,7 +161,7 @@ sub_8136A74: @ 8136A74 thumb_func_start sub_8136AA0 sub_8136AA0: @ 8136AA0 push {lr} - ldr r0, =gUnknown_0203AB48 + ldr r0, =sSavedPokeblockData ldr r1, [r0] movs r0, 0 bl OpenPokeblockCase @@ -2251,7 +297,7 @@ sub_8136BC0: @ 8136BC0 bl sub_8136F68 movs r0, 0x5 bl PlaySE - ldr r5, =gUnknown_0203AB4E + ldr r5, =sSavedPokeblockData + 6 subs r6, r5, 0x2 lsls r4, r7, 2 adds r4, r7 @@ -2264,11 +310,11 @@ sub_8136BC0: @ 8136BC0 bl sub_81AE6C8 ldrh r0, [r6] movs r1, 0x5 - bl sub_8136110 - bl sub_813625C + bl HandlePokeblockMenuCursor + bl SetMenuItemsCountAndMaxShowed bl sub_81362E0 - bl sub_8135E2C - ldr r0, =gUnknown_03006310 + bl HandlePokeblockListMenuItems + ldr r0, =gMultiuseListMenuTemplate ldrh r1, [r5] ldrh r2, [r6] bl ListMenuInit @@ -2277,7 +323,7 @@ sub_8136BC0: @ 8136BC0 strh r0, [r4] ldrh r0, [r6] ldr r1, =0x00001005 - bl sub_8136110 + bl HandlePokeblockMenuCursor movs r0, 0 bl schedule_bg_copy_tilemap_to_vram movs r0, 0x1 @@ -2308,7 +354,7 @@ TossPokeblockChoice_No: @ 8136C54 adds r0, r4 lsls r0, 3 adds r0, r1 - ldr r1, =sub_81365C8 + ldr r1, =Task_HandlePokeblockMenuInput str r1, [r0] pop {r4} pop {r0} @@ -2379,7 +425,7 @@ _08136D18: _08136D1A: strh r0, [r7] mov r0, r8 - bl sub_81364EC + bl FadePaletteAndSetTaskToClosePokeblockCase pop {r3} mov r8, r3 pop {r4-r7} @@ -2419,7 +465,7 @@ PokeblockAction_UseOnPokeblockFeeder: @ 8136D2C movs r0, 0 strh r0, [r5] adds r0, r4, 0 - bl sub_81364EC + bl FadePaletteAndSetTaskToClosePokeblockCase pop {r4,r5} pop {r0} bx r0 @@ -2454,7 +500,7 @@ PokeblockAction_GiveToContestLady: @ 8136D90 movs r0, 0 strh r0, [r5] adds r0, r4, 0 - bl sub_81364EC + bl FadePaletteAndSetTaskToClosePokeblockCase pop {r4-r6} pop {r0} bx r0 @@ -2479,7 +525,7 @@ PokeblockAction_Cancel: @ 8136DE8 bl sub_81363BC subs r5, 0x8 adds r4, r5 - ldr r0, =sub_81365C8 + ldr r0, =Task_HandlePokeblockMenuInput str r0, [r4] pop {r4,r5} pop {r0} @@ -3592,7 +1638,7 @@ sub_8137734: @ 8137734 mov r7, r8 push {r7} sub sp, 0x1C - bl sp000_heal_pokemon + bl HealPlayerParty ldr r4, =0x00000864 adds r0, r4, 0 bl FlagGet @@ -9148,7 +7194,7 @@ sub_813A46C: @ 813A46C lsrs r0, 24 mov r1, sp movs r2, 0 - bl get_coro_args_x18_x1A + bl sub_81AE860 ldr r1, =gUnknown_0203AB68 mov r0, sp ldrh r0, [r0] @@ -9194,7 +7240,7 @@ sub_813A4EC: @ 813A4EC ldrh r0, [r6, 0x24] lsls r0, 24 lsrs r0, 24 - bl ListMenuHandleInput + bl ListMenuHandleInputGetItemId adds r4, r0, 0 movs r0, 0x2 negs r0, r0 @@ -10266,7 +8312,7 @@ sub_813ADD4: @ 813ADD4 adds r4, 0x16 add r1, sp, 0x14 adds r2, r4, 0 - bl get_coro_args_x18_x1A + bl sub_81AE860 ldrh r0, [r6, 0x22] lsls r0, 24 lsrs r0, 24 diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index 6cea86ec6..b71d6518c 100755 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -2460,7 +2460,7 @@ _081C52DC: b _081C5308 .pool _081C52F0: - bl sub_8122328 + bl LoadListMenuArrowsGfx ldr r0, [r4] ldr r1, =0x00000984 adds r0, r1 @@ -2559,7 +2559,7 @@ _081C5382: movs r0, 0x2 negs r0, r0 str r0, [r1] - ldr r2, =gUnknown_03006310 + ldr r2, =gMultiuseListMenuTemplate adds r1, r2, 0 ldr r0, =gUnknown_0861F2C0 ldm r0!, {r4,r6,r7} @@ -2918,7 +2918,7 @@ sub_81C56F8: @ 81C56F8 lsls r4, 3 ldr r0, =gTasks + 0x8 adds r4, r0 - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate ldr r2, =gUnknown_0203CF30 ldrh r1, [r2, 0x8] ldrh r2, [r2, 0x6] @@ -3545,7 +3545,7 @@ _081C5C12: adds r1, r4, 0 adds r1, 0x8 adds r2, r4, 0x6 - bl get_coro_args_x18_x1A + bl sub_81AE860 ldrh r1, [r4, 0x8] ldrh r0, [r4, 0x6] adds r1, r0 @@ -3565,14 +3565,14 @@ _081C5C12: .pool _081C5C5C: ldrb r0, [r7] - bl ListMenuHandleInput + bl ListMenuHandleInputGetItemId adds r6, r0, 0 ldrb r0, [r7] ldr r1, =gUnknown_0203CF38 mov r8, r1 mov r2, r8 subs r2, 0x2 - bl get_coro_args_x18_x1A + bl sub_81AE860 movs r0, 0x2 negs r0, r0 cmp r6, r0 @@ -4646,7 +4646,7 @@ sub_81C65CC: @ 81C65CC bl sub_81C5924 bl sub_81C59BC bl sub_81C5314 - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate ldrh r1, [r6] ldrh r2, [r7] bl ListMenuInit @@ -4953,18 +4953,18 @@ sub_81C68B0: @ 81C68B0 ldrb r0, [r4] ldr r1, =gUnknown_0203CF38 subs r2, r1, 0x2 - bl get_coro_args_x18_x1A + bl sub_81AE860 b _081C6940 .pool _081C68F8: ldrb r0, [r4] - bl ListMenuHandleInput + bl ListMenuHandleInputGetItemId adds r6, r0, 0 ldrb r0, [r4] ldr r4, =gUnknown_0203CF38 subs r2, r4, 0x2 adds r1, r4, 0 - bl get_coro_args_x18_x1A + bl sub_81AE860 movs r0, 0 bl sub_81C7028 subs r4, 0x8 @@ -5066,7 +5066,7 @@ _081C69A8: strh r0, [r1, 0x6] _081C69E0: bl sub_81C5314 - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate ldrh r1, [r7] mov r3, r8 ldrh r2, [r3] @@ -5124,7 +5124,7 @@ sub_81C6A14: @ 81C6A14 strh r0, [r1, 0x6] _081C6A5E: bl sub_81C5314 - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate ldrh r1, [r5] ldrh r2, [r7] bl ListMenuInit diff --git a/asm/pokenav.s b/asm/pokenav.s index 532d7599b..d0988563a 100755 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -21921,7 +21921,7 @@ sub_81D1DC0: @ 81D1DC0 ldr r7, =gUnknown_0203CF4C ldr r0, =gText_Cancel2 mov r12, r0 - ldr r4, =gUnknown_03006310 + ldr r4, =gMultiuseListMenuTemplate ldr r1, =gUnknown_0203CF48 mov r8, r1 ldr r2, =sub_81D1E7C @@ -23376,7 +23376,7 @@ sub_81D28C8: @ 81D28C8 push {r4-r7,lr} lsls r1, 16 lsrs r4, r1, 16 - ldr r3, =gUnknown_03006310 + ldr r3, =gMultiuseListMenuTemplate adds r2, r3, 0 ldr r1, =gUnknown_08625548 ldm r1!, {r5-r7} diff --git a/asm/script_pokemon_util_80F87D8.s b/asm/script_pokemon_util_80F87D8.s index 3a3cf4269..8f25318ab 100644 --- a/asm/script_pokemon_util_80F87D8.s +++ b/asm/script_pokemon_util_80F87D8.s @@ -1174,8 +1174,8 @@ _080F917A: bx r1 thumb_func_end sub_80F9160 - thumb_func_start sp000_heal_pokemon -sp000_heal_pokemon: @ 80F9180 + thumb_func_start HealPlayerParty +HealPlayerParty: @ 80F9180 push {r4-r7,lr} mov r7, r10 mov r6, r9 @@ -1267,7 +1267,7 @@ _080F922C: pop {r0} bx r0 .pool - thumb_func_end sp000_heal_pokemon + thumb_func_end HealPlayerParty thumb_func_start ScriptGiveMon @ void ScriptGiveMon(s16 species_num, u8 level, int held_item) diff --git a/asm/shop.s b/asm/shop.s index 2d6791a62..ccbf458c9 100644 --- a/asm/shop.s +++ b/asm/shop.s @@ -409,7 +409,7 @@ _080DFDAC: adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - ldr r0, =gUnknown_03006310 + ldr r0, =gMultiuseListMenuTemplate movs r1, 0 movs r2, 0 bl ListMenuInit @@ -601,7 +601,7 @@ _080DFF78: movs r0, 0x2 negs r0, r0 str r0, [r1, 0x4] - ldr r3, =gUnknown_03006310 + ldr r3, =gMultiuseListMenuTemplate adds r1, r3, 0 ldr r0, =gUnknown_08589A48 ldm r0!, {r4-r6} @@ -627,7 +627,7 @@ _080DFFDC: _080DFFDE: ldr r0, =gUnknown_02039F70 ldr r0, [r0] - ldr r1, =gUnknown_03006310 + ldr r1, =gMultiuseListMenuTemplate ldrh r1, [r1, 0xE] ldr r2, =0x00002004 adds r0, r2 @@ -1976,7 +1976,7 @@ Task_BuyMenu: @ 80E0AC8 b _080E0C8E _080E0AEA: ldrb r0, [r4, 0xE] - bl ListMenuHandleInput + bl ListMenuHandleInputGetItemId adds r5, r0, 0 ldrb r0, [r4, 0xE] ldr r7, =gUnknown_02039F70 @@ -1985,7 +1985,7 @@ _080E0AEA: adds r1, r2, r3 subs r3, 0x2 adds r2, r3 - bl get_coro_args_x18_x1A + bl sub_81AE860 movs r0, 0x2 negs r0, r0 cmp r5, r0 diff --git a/data/data4d.s b/data/data4d.s index 604c9f2b0..57dc8befc 100644 --- a/data/data4d.s +++ b/data/data4d.s @@ -5,15 +5,6 @@ .section .rodata -gUnknown_085B2748:: @ 85B2748 - .incbin "baserom.gba", 0x5b2748, 0x60 - -gUnknown_085B27A8:: @ 85B27A8 - .incbin "baserom.gba", 0x5b27a8, 0x8 - -gUnknown_085B27B0:: @ 85B27B0 - .incbin "baserom.gba", 0x5b27b0, 0x18 - gUnknown_085B27C8:: @ 85B27C8 .incbin "baserom.gba", 0x5b27c8, 0x88 diff --git a/data/event_scripts.s b/data/event_scripts.s index 763b39585..3f60fa02c 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -1431,7 +1431,7 @@ OldaleTown_PokemonCenter_1F_EventScript_271993:: @ 8271993 waitfieldeffect 25 applymovement VAR_0x800B, OldaleTown_PokemonCenter_1F_Movement_2725AA waitmovement 0 - special sp000_heal_pokemon + special HealPlayerParty return OldaleTown_PokemonCenter_1F_EventScript_2719B1:: @ 82719B1 @@ -2190,7 +2190,7 @@ SSTidalRooms_EventScript_272083:: @ 8272083 fadescreen 1 playfanfare BGM_ME_ASA waitfanfare - special sp000_heal_pokemon + special HealPlayerParty fadescreen 0 return @@ -5129,7 +5129,7 @@ SecretBase_RedCave1_EventScript_276286:: @ 8276286 call_if 1, SecretBase_RedCave1_EventScript_2762C1 compare_var_to_value VAR_RESULT, 2 call_if 1, SecretBase_RedCave1_EventScript_2762C5 - special sp000_heal_pokemon + special HealPlayerParty release end diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc index 71e3303b5..362a78e65 100644 --- a/data/scripts/cable_club.inc +++ b/data/scripts/cable_club.inc @@ -449,7 +449,7 @@ OldaleTown_PokemonCenter_2F_EventScript_276F60:: @ 8276F60 end OldaleTown_PokemonCenter_2F_EventScript_276FBD:: @ 8276FBD - special sp000_heal_pokemon + special HealPlayerParty special copy_player_party_to_sav1 special copy_bags_and_unk_data_from_save_blocks copyvar VAR_0x4087, VAR_0x8004 @@ -1031,7 +1031,7 @@ OldaleTown_PokemonCenter_2F_EventScript_27759F:: @ 827759F goto_eq OldaleTown_PokemonCenter_2F_EventScript_2772EC msgbox OldaleTown_PokemonCenter_2F_Text_27961C, 4 closemessage - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 6 copyvar VAR_0x4087, VAR_0x8004 call OldaleTown_PokemonCenter_2F_EventScript_277BBE diff --git a/data/scripts/maps/BattleFrontier_BattleArenaBattleRoom.inc b/data/scripts/maps/BattleFrontier_BattleArenaBattleRoom.inc index 27886b8a5..e4df57716 100644 --- a/data/scripts/maps/BattleFrontier_BattleArenaBattleRoom.inc +++ b/data/scripts/maps/BattleFrontier_BattleArenaBattleRoom.inc @@ -143,7 +143,7 @@ BattleFrontier_BattleArenaBattleRoom_EventScript_257630:: @ 8257630 special sub_81A1780 playfanfare BGM_ME_ASA waitfanfare - special sp000_heal_pokemon + special HealPlayerParty BattleFrontier_BattleArenaBattleRoom_EventScript_2576B0:: @ 82576B0 setvar VAR_0x8004, 9 @@ -430,14 +430,14 @@ FallarborTown_BattleTentBattleRoom_EventScript_257B6C:: @ 8257B6C setvar VAR_0x8005, 6 setvar VAR_0x8006, 0 special sub_81A1780 - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 5 setvar VAR_0x8005, 0 special sub_8163AC4 waitstate setvar VAR_0x8004, 18 special sub_81A1780 - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 21 special sub_81A1780 return diff --git a/data/scripts/maps/BattleFrontier_BattleArenaLobby.inc b/data/scripts/maps/BattleFrontier_BattleArenaLobby.inc index dbd4d2db6..135751d89 100644 --- a/data/scripts/maps/BattleFrontier_BattleArenaLobby.inc +++ b/data/scripts/maps/BattleFrontier_BattleArenaLobby.inc @@ -90,7 +90,7 @@ BattleFrontier_BattleArenaLobby_EventScript_255D59:: @ 8255D59 setvar VAR_0x8004, 8 special sub_81A1780 special copy_player_party_from_sav1 - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 3 setvar VAR_0x8005, 0 special sub_81A5238 diff --git a/data/scripts/maps/BattleFrontier_BattleDomeBattleRoom.inc b/data/scripts/maps/BattleFrontier_BattleDomeBattleRoom.inc index 963e8e6c2..5fa5c7c95 100644 --- a/data/scripts/maps/BattleFrontier_BattleDomeBattleRoom.inc +++ b/data/scripts/maps/BattleFrontier_BattleDomeBattleRoom.inc @@ -528,7 +528,7 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_24C440:: @ 824C440 setvar VAR_0x8005, 6 setvar VAR_0x8006, 0 special sub_81A1780 - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 3 setvar VAR_0x8005, 0 setvar VAR_0x4009, 1 @@ -537,7 +537,7 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_24C440:: @ 824C440 setvar VAR_0x4009, 0 setvar VAR_0x8004, 17 special sub_818E9AC - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 16 special sub_818E9AC return diff --git a/data/scripts/maps/BattleFrontier_BattleDomeLobby.inc b/data/scripts/maps/BattleFrontier_BattleDomeLobby.inc index 397793888..592c6b1db 100644 --- a/data/scripts/maps/BattleFrontier_BattleDomeLobby.inc +++ b/data/scripts/maps/BattleFrontier_BattleDomeLobby.inc @@ -95,7 +95,7 @@ BattleFrontier_BattleDomeLobby_EventScript_2498C9:: @ 82498C9 setvar VAR_0x8006, 1 special sub_818E9AC special copy_player_party_from_sav1 - special sp000_heal_pokemon + special HealPlayerParty goto BattleFrontier_BattleDomeLobby_EventScript_249991 BattleFrontier_BattleDomeLobby_EventScript_249940:: @ 8249940 @@ -118,7 +118,7 @@ BattleFrontier_BattleDomeLobby_EventScript_249940:: @ 8249940 setvar VAR_0x8006, 1 special sub_818E9AC special copy_player_party_from_sav1 - special sp000_heal_pokemon + special HealPlayerParty BattleFrontier_BattleDomeLobby_EventScript_249991:: @ 8249991 setvar VAR_0x8004, 13 @@ -265,7 +265,7 @@ BattleFrontier_BattleDomeLobby_EventScript_249BC2:: @ 8249BC2 msgbox BattleFrontier_BattleDomeLobby_Text_24A437, 4 closemessage call BattleFrontier_BattleDomeLobby_EventScript_249C6E - special sp000_heal_pokemon + special HealPlayerParty warp BATTLE_FRONTIER_BATTLE_DOME_CORRIDOR, 255, 23, 6 setvar VAR_0x4000, 0 waitstate diff --git a/data/scripts/maps/BattleFrontier_BattleDomePreBattleRoom.inc b/data/scripts/maps/BattleFrontier_BattleDomePreBattleRoom.inc index 30b6d5d39..59d5aa05e 100644 --- a/data/scripts/maps/BattleFrontier_BattleDomePreBattleRoom.inc +++ b/data/scripts/maps/BattleFrontier_BattleDomePreBattleRoom.inc @@ -249,7 +249,7 @@ BattleFrontier_BattleDomePreBattleRoom_EventScript_24B5C7:: @ 824B5C7 special sub_81A1780 playfanfare BGM_ME_ASA waitfanfare - special sp000_heal_pokemon + special HealPlayerParty call BattleFrontier_BattleDomePreBattleRoom_EventScript_24B600 fadescreen 1 setvar VAR_0x8004, 11 diff --git a/data/scripts/maps/BattleFrontier_BattleFactoryBattleRoom.inc b/data/scripts/maps/BattleFrontier_BattleFactoryBattleRoom.inc index 2d21f080c..3e7f062de 100644 --- a/data/scripts/maps/BattleFrontier_BattleFactoryBattleRoom.inc +++ b/data/scripts/maps/BattleFrontier_BattleFactoryBattleRoom.inc @@ -89,7 +89,7 @@ BattleFrontier_BattleFactoryBattleRoom_EventScript_25AEA7:: @ 825AEA7 setvar VAR_0x8005, 6 setvar VAR_0x8006, 0 special sub_81A1780 - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 6 setvar VAR_0x8005, 0 special sub_8163AC4 @@ -225,7 +225,7 @@ BattleFrontier_BattleFactoryBattleRoom_EventScript_25B0E0:: @ 825B0E0 setvar VAR_0x8005, 6 setvar VAR_0x8006, 0 special sub_81A1780 - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 6 setvar VAR_0x8005, 0 special sub_8163AC4 diff --git a/data/scripts/maps/BattleFrontier_BattleFactoryPreBattleRoom.inc b/data/scripts/maps/BattleFrontier_BattleFactoryPreBattleRoom.inc index cd34a1d15..76c35667b 100644 --- a/data/scripts/maps/BattleFrontier_BattleFactoryPreBattleRoom.inc +++ b/data/scripts/maps/BattleFrontier_BattleFactoryPreBattleRoom.inc @@ -72,7 +72,7 @@ BattleFrontier_BattleFactoryPreBattleRoom_EventScript_259BA5:: @ 8259BA5 msgbox BattleFrontier_BattleFactoryPreBattleRoom_Text_25A22D, 4 playfanfare BGM_ME_ASA waitfanfare - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 9 special sub_81A1780 compare_var_to_value VAR_RESULT, 0 diff --git a/data/scripts/maps/BattleFrontier_BattlePalaceBattleRoom.inc b/data/scripts/maps/BattleFrontier_BattlePalaceBattleRoom.inc index 9178ca8bd..fc61002c8 100644 --- a/data/scripts/maps/BattleFrontier_BattlePalaceBattleRoom.inc +++ b/data/scripts/maps/BattleFrontier_BattlePalaceBattleRoom.inc @@ -100,7 +100,7 @@ BattleFrontier_BattlePalaceBattleRoom_EventScript_24F911:: @ 824F911 special sub_81A1780 playfanfare BGM_ME_ASA waitfanfare - special sp000_heal_pokemon + special HealPlayerParty BattleFrontier_BattlePalaceBattleRoom_EventScript_24F98A:: @ 824F98A setvar VAR_0x8004, 9 @@ -337,14 +337,14 @@ VerdanturfTown_BattleTentBattleRoom_EventScript_24FDF7:: @ 824FDF7 setvar VAR_0x8005, 6 setvar VAR_0x8006, 0 special sub_81A1780 - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 4 setvar VAR_0x8005, 0 special sub_8163AC4 waitstate setvar VAR_0x8004, 18 special sub_81A1780 - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 21 special sub_81A1780 return diff --git a/data/scripts/maps/BattleFrontier_BattlePalaceLobby.inc b/data/scripts/maps/BattleFrontier_BattlePalaceLobby.inc index d62bc4412..cfacb1f96 100644 --- a/data/scripts/maps/BattleFrontier_BattlePalaceLobby.inc +++ b/data/scripts/maps/BattleFrontier_BattlePalaceLobby.inc @@ -90,7 +90,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_24D8A1:: @ 824D8A1 setvar VAR_0x8004, 8 special sub_81A1780 special copy_player_party_from_sav1 - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 7 setvar VAR_0x8005, 0 special sub_8195960 diff --git a/data/scripts/maps/BattleFrontier_BattlePikeLobby.inc b/data/scripts/maps/BattleFrontier_BattlePikeLobby.inc index 66226b9ce..40d282f01 100644 --- a/data/scripts/maps/BattleFrontier_BattlePikeLobby.inc +++ b/data/scripts/maps/BattleFrontier_BattlePikeLobby.inc @@ -25,7 +25,7 @@ BattleFrontier_BattlePikeLobby_EventScript_25B707:: @ 825B707 end BattleFrontier_BattlePikeLobby_EventScript_25B710:: @ 825B710 - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 27 special sub_81A703C lockall @@ -77,7 +77,7 @@ BattleFrontier_BattlePikeLobby_EventScript_25B78D:: @ 825B78D copyvar VAR_0x8006, VAR_RESULT special sub_81A703C special copy_player_party_from_sav1 - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 27 special sub_81A703C message BattleFrontier_BattlePikeLobby_Text_25C1DF @@ -108,7 +108,7 @@ BattleFrontier_BattlePikeLobby_EventScript_25B806:: @ 825B806 setvar VAR_0x8006, 0 special sub_81A703C special copy_player_party_from_sav1 - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 27 special sub_81A703C setvar VAR_0x8004, 8 @@ -210,7 +210,7 @@ BattleFrontier_BattlePikeLobby_EventScript_25B95C:: @ 825B95C setvar VAR_0x8004, 5 special sub_81A1780 call BattleFrontier_BattlePikeLobby_EventScript_25BA94 - special sp000_heal_pokemon + special HealPlayerParty call BattleFrontier_BattlePikeLobby_EventScript_25BB49 warpsilent BATTLE_FRONTIER_BATTLE_PIKE_CORRIDOR, 255, 6, 7 setvar VAR_0x4000, 0 diff --git a/data/scripts/maps/BattleFrontier_BattlePikeRandomRoom1.inc b/data/scripts/maps/BattleFrontier_BattlePikeRandomRoom1.inc index 69dc87eaa..543257f3c 100644 --- a/data/scripts/maps/BattleFrontier_BattlePikeRandomRoom1.inc +++ b/data/scripts/maps/BattleFrontier_BattlePikeRandomRoom1.inc @@ -89,7 +89,7 @@ BattleFrontier_BattlePikeRandomRoom1_EventScript_25D285:: @ 825D285 msgbox BattleFrontier_BattlePikeRandomRoom1_Text_25DE3F, 4 playfanfare BGM_ME_ASA waitfanfare - special sp000_heal_pokemon + special HealPlayerParty msgbox BattleFrontier_BattlePikeRandomRoom1_Text_25DE94, 4 closemessage release @@ -257,7 +257,7 @@ BattleFrontier_BattlePikeRandomRoom1_EventScript_25D50E:: @ 825D50E waitmessage playfanfare BGM_ME_ASA waitfanfare - special sp000_heal_pokemon + special HealPlayerParty msgbox BattleFrontier_BattlePikeRandomRoom1_Text_25DA13, 4 closemessage applymovement 1, BattleFrontier_BattlePikeRandomRoom1_Movement_25D798 diff --git a/data/scripts/maps/BattleFrontier_BattlePyramidEmptySquare.inc b/data/scripts/maps/BattleFrontier_BattlePyramidEmptySquare.inc index 85fd5e417..757f5eae2 100644 --- a/data/scripts/maps/BattleFrontier_BattlePyramidEmptySquare.inc +++ b/data/scripts/maps/BattleFrontier_BattlePyramidEmptySquare.inc @@ -90,7 +90,7 @@ BattleFrontier_BattlePyramidTop_EventScript_252B66:: @ 8252B66 special sub_81A8E7C setvar VAR_0x8004, 14 special sub_81A8E7C - special sp000_heal_pokemon + special HealPlayerParty warpsilent BATTLE_FRONTIER_BATTLE_PYRAMID_LOBBY, 255, 7, 13 waitstate end diff --git a/data/scripts/maps/BattleFrontier_BattlePyramidLobby.inc b/data/scripts/maps/BattleFrontier_BattlePyramidLobby.inc index f5043f13e..422de3909 100644 --- a/data/scripts/maps/BattleFrontier_BattlePyramidLobby.inc +++ b/data/scripts/maps/BattleFrontier_BattlePyramidLobby.inc @@ -70,7 +70,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_2507DA:: @ 82507DA special copy_player_party_from_sav1 setvar VAR_0x8004, 14 special sub_81A8E7C - special sp000_heal_pokemon + special HealPlayerParty message BattleFrontier_BattlePyramidLobby_Text_2519F8 waitmessage playse SE_EXPMAX @@ -100,7 +100,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_250852:: @ 8250852 special copy_player_party_from_sav1 setvar VAR_0x8004, 14 special sub_81A8E7C - special sp000_heal_pokemon + special HealPlayerParty lockall message BattleFrontier_BattlePyramidLobby_Text_251B5A waitmessage @@ -218,7 +218,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_250A21:: @ 8250A21 setvar VAR_0x8006, 0 special sub_81A1780 setvar VAR_RESULT, 0 - special sp000_heal_pokemon + special HealPlayerParty warp BATTLE_FRONTIER_BATTLE_PYRAMID_EMPTY_SQUARE, 255, 1, 1 setvar VAR_0x4000, 0 waitstate diff --git a/data/scripts/maps/BattleFrontier_BattleTowerBattleRoom.inc b/data/scripts/maps/BattleFrontier_BattleTowerBattleRoom.inc index 71f0cff2d..b436185b1 100644 --- a/data/scripts/maps/BattleFrontier_BattleTowerBattleRoom.inc +++ b/data/scripts/maps/BattleFrontier_BattleTowerBattleRoom.inc @@ -84,7 +84,7 @@ BattleFrontier_BattleTowerBattleRoom_EventScript_241C2F:: @ 8241C2F msgbox BattleFrontier_BattleTowerBattleRoom_Text_242217, 4 playfanfare BGM_ME_ASA waitfanfare - special sp000_heal_pokemon + special HealPlayerParty BattleFrontier_BattleTowerBattleRoom_EventScript_241C8F:: @ 8241C8F setvar VAR_0x8004, 9 @@ -361,7 +361,7 @@ BattleFrontier_BattleTowerBattleRoom_EventScript_24210E:: @ 824210E setvar VAR_0x8005, 6 setvar VAR_0x8006, 0 special sub_81A1780 - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 0 setvar VAR_0x8005, 0 special sub_8163AC4 @@ -371,7 +371,7 @@ BattleFrontier_BattleTowerBattleRoom_EventScript_24210E:: @ 824210E goto_eq BattleFrontier_BattleTowerBattleRoom_EventScript_24215A setvar VAR_0x8004, 18 special sub_81A1780 - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 21 special sub_81A1780 diff --git a/data/scripts/maps/BattleFrontier_BattleTowerBattleRoom2.inc b/data/scripts/maps/BattleFrontier_BattleTowerBattleRoom2.inc index 2ea9c897b..8d5032b8d 100644 --- a/data/scripts/maps/BattleFrontier_BattleTowerBattleRoom2.inc +++ b/data/scripts/maps/BattleFrontier_BattleTowerBattleRoom2.inc @@ -161,7 +161,7 @@ BattleFrontier_BattleTowerBattleRoom2_EventScript_249121:: @ 8249121 call_if 1, BattleFrontier_BattleTowerBattleRoom2_EventScript_249514 playfanfare BGM_ME_ASA waitfanfare - special sp000_heal_pokemon + special HealPlayerParty BattleFrontier_BattleTowerBattleRoom2_EventScript_249143:: @ 8249143 setvar VAR_0x8004, 1 diff --git a/data/scripts/maps/BattleFrontier_BattleTowerLobby.inc b/data/scripts/maps/BattleFrontier_BattleTowerLobby.inc index d21c607d8..ab7cefc3b 100644 --- a/data/scripts/maps/BattleFrontier_BattleTowerLobby.inc +++ b/data/scripts/maps/BattleFrontier_BattleTowerLobby.inc @@ -153,7 +153,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23E84D:: @ 823E84D setvar VAR_0x8004, 8 special sub_81A1780 special copy_player_party_from_sav1 - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 6 setvar VAR_0x8005, 0 special sub_8161F74 diff --git a/data/scripts/maps/BattleFrontier_BattleTowerMultiBattleRoom.inc b/data/scripts/maps/BattleFrontier_BattleTowerMultiBattleRoom.inc index b2d411b64..2e9d8e5e8 100644 --- a/data/scripts/maps/BattleFrontier_BattleTowerMultiBattleRoom.inc +++ b/data/scripts/maps/BattleFrontier_BattleTowerMultiBattleRoom.inc @@ -68,7 +68,7 @@ BattleFrontier_BattleTowerMultiBattleRoom_EventScript_243E41:: @ 8243E41 applymovement 255, BattleFrontier_BattleTowerMultiBattleRoom_Movement_2725A6 waitmovement 0 msgbox BattleFrontier_BattleTowerMultiBattleRoom_Text_244056, 4 - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x4001, 1 releaseall end diff --git a/data/scripts/maps/FallarborTown_BattleTentBattleRoom.inc b/data/scripts/maps/FallarborTown_BattleTentBattleRoom.inc index a20ca4f1c..2c3800b5b 100644 --- a/data/scripts/maps/FallarborTown_BattleTentBattleRoom.inc +++ b/data/scripts/maps/FallarborTown_BattleTentBattleRoom.inc @@ -110,7 +110,7 @@ FallarborTown_BattleTentBattleRoom_EventScript_2009B3:: @ 82009B3 special sub_81A1780 playfanfare BGM_ME_ASA waitfanfare - special sp000_heal_pokemon + special HealPlayerParty FallarborTown_BattleTentBattleRoom_EventScript_200A2A:: @ 8200A2A setvar VAR_0x8004, 1 diff --git a/data/scripts/maps/Route101.inc b/data/scripts/maps/Route101.inc index 27c83f3d0..a50fec657 100644 --- a/data/scripts/maps/Route101.inc +++ b/data/scripts/maps/Route101.inc @@ -230,7 +230,7 @@ Route101_EventScript_1EBE16:: @ 81EBE16 applymovement 2, Route101_Movement_1EBE8D waitmovement 0 msgbox Route101_Text_1EBF12, 4 - special sp000_heal_pokemon + special HealPlayerParty setflag FLAG_0x2D0 clearflag FLAG_0x2D1 setflag FLAG_0x2BC diff --git a/data/scripts/maps/SlateportCity_BattleTentBattleRoom.inc b/data/scripts/maps/SlateportCity_BattleTentBattleRoom.inc index 6917cac5d..82ffea2be 100644 --- a/data/scripts/maps/SlateportCity_BattleTentBattleRoom.inc +++ b/data/scripts/maps/SlateportCity_BattleTentBattleRoom.inc @@ -54,7 +54,7 @@ SlateportCity_BattleTentBattleRoom_EventScript_2099BE:: @ 82099BE msgbox 0x2021fc4, 4 waitmessage closemessage - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 6 setvar VAR_0x8005, 0 special sub_8163AC4 diff --git a/data/scripts/maps/SlateportCity_BattleTentCorridor.inc b/data/scripts/maps/SlateportCity_BattleTentCorridor.inc index 2d14359f0..b39cc7472 100644 --- a/data/scripts/maps/SlateportCity_BattleTentCorridor.inc +++ b/data/scripts/maps/SlateportCity_BattleTentCorridor.inc @@ -65,7 +65,7 @@ SlateportCity_BattleTentCorridor_EventScript_208EEE:: @ 8208EEE msgbox SlateportCity_BattleTentCorridor_Text_25A22D, 4 playfanfare BGM_ME_ASA waitfanfare - special sp000_heal_pokemon + special HealPlayerParty SlateportCity_BattleTentCorridor_EventScript_208F0D:: @ 8208F0D setvar VAR_0x8004, 1 diff --git a/data/scripts/maps/SlateportCity_OceanicMuseum_2F.inc b/data/scripts/maps/SlateportCity_OceanicMuseum_2F.inc index 463c7235c..bacb4ec20 100644 --- a/data/scripts/maps/SlateportCity_OceanicMuseum_2F.inc +++ b/data/scripts/maps/SlateportCity_OceanicMuseum_2F.inc @@ -78,7 +78,7 @@ SlateportCity_OceanicMuseum_2F_EventScript_20BB00:: @ 820BB00 fadescreen 1 playfanfare BGM_ME_ASA waitfanfare - special sp000_heal_pokemon + special HealPlayerParty removeobject 1 setflag FLAG_0x384 compare_var_to_value VAR_0x40DA, 0 diff --git a/data/scripts/maps/SootopolisCity_MysteryEventsHouse_B1F.inc b/data/scripts/maps/SootopolisCity_MysteryEventsHouse_B1F.inc index 94733f189..7f6939824 100644 --- a/data/scripts/maps/SootopolisCity_MysteryEventsHouse_B1F.inc +++ b/data/scripts/maps/SootopolisCity_MysteryEventsHouse_B1F.inc @@ -29,7 +29,7 @@ SootopolisCity_MysteryEventsHouse_B1F_EventScript_227E68:: @ 8227E68 compare_var_to_value VAR_RESULT, 2 call_if 1, SootopolisCity_MysteryEventsHouse_B1F_EventScript_227EE8 closemessage - special sp000_heal_pokemon + special HealPlayerParty applymovement 255, SootopolisCity_MysteryEventsHouse_B1F_Movement_227EF9 waitmovement 0 special copy_player_party_from_sav1 diff --git a/data/scripts/maps/TrainerHill_Entrance.inc b/data/scripts/maps/TrainerHill_Entrance.inc index d4cc8a2ba..adcd67ea1 100644 --- a/data/scripts/maps/TrainerHill_Entrance.inc +++ b/data/scripts/maps/TrainerHill_Entrance.inc @@ -97,7 +97,7 @@ TrainerHill_Entrance_EventScript_2681DA:: @ 82681DA applymovement 255, TrainerHill_Entrance_Movement_268381 waitmovement 0 setvar VAR_0x40D6, 0 - special sp000_heal_pokemon + special HealPlayerParty releaseall TrainerHill_Entrance_EventScript_2681EE:: @ 82681EE @@ -174,7 +174,7 @@ TrainerHill_Entrance_EventScript_2682C8:: @ 82682C8 special sp194_trainer_tower setvar VAR_0x40D6, 1 setvar VAR_0x4005, 0 - special sp000_heal_pokemon + special HealPlayerParty msgbox TrainerHill_Entrance_Text_26862A, 4 setvar VAR_0x8004, 0 special sp194_trainer_tower diff --git a/data/scripts/maps/VerdanturfTown_BattleTentBattleRoom.inc b/data/scripts/maps/VerdanturfTown_BattleTentBattleRoom.inc index e2ff39cd7..a80048723 100644 --- a/data/scripts/maps/VerdanturfTown_BattleTentBattleRoom.inc +++ b/data/scripts/maps/VerdanturfTown_BattleTentBattleRoom.inc @@ -88,7 +88,7 @@ VerdanturfTown_BattleTentBattleRoom_EventScript_2023C8:: @ 82023C8 special sub_81A1780 playfanfare BGM_ME_ASA waitfanfare - special sp000_heal_pokemon + special HealPlayerParty VerdanturfTown_BattleTentBattleRoom_EventScript_20243C:: @ 820243C setvar VAR_0x8004, 1 diff --git a/data/scripts/safari_zone.inc b/data/scripts/safari_zone.inc index a052c90cc..982401047 100644 --- a/data/scripts/safari_zone.inc +++ b/data/scripts/safari_zone.inc @@ -53,7 +53,7 @@ EventScript_2A4BAC:: @ 82A4BAC EventScript_2A4BD0:: @ 82A4BD0 fadescreen 1 - special sub_8135908 + special OpenPokeblockCaseOnFeeder waitstate compare_var_to_value VAR_RESULT, 65535 goto_if 5, EventScript_2A4BE2 diff --git a/data/specials.inc b/data/specials.inc index 19adbae4d..bf06289bb 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -7,7 +7,7 @@ .set __special__, 0 .align 2 gSpecials:: @ 81DBA64 - def_special sp000_heal_pokemon + def_special HealPlayerParty def_special sub_809D2BC def_special sub_80AF948 def_special sub_80AF9F8 @@ -218,7 +218,7 @@ gSpecials:: @ 81DBA64 def_special EnterSafariMode def_special ExitSafariMode def_special GetPokeblockFeederInFront - def_special sub_8135908 + def_special OpenPokeblockCaseOnFeeder def_special sub_813793C def_special sub_8137988 def_special sub_8137A0C diff --git a/include/global.h b/include/global.h index f3ec9ce33..fdcebc924 100644 --- a/include/global.h +++ b/include/global.h @@ -489,11 +489,12 @@ struct RecordMixingDayCareMail bool16 holdsItem[DAYCARE_MON_COUNT]; }; -#define MAP_OBJECTS_COUNT 16 -#define BERRY_TREES_COUNT 128 -#define FLAGS_COUNT 300 -#define VARS_COUNT 256 -#define MAIL_COUNT 16 +#define POKEBLOCKS_COUNT 40 +#define MAP_OBJECTS_COUNT 16 +#define BERRY_TREES_COUNT 128 +#define FLAGS_COUNT 300 +#define VARS_COUNT 256 +#define MAIL_COUNT 16 enum { @@ -586,7 +587,7 @@ struct SaveBlock1 /*0x650*/ struct ItemSlot bagPocket_PokeBalls[16]; /*0x690*/ struct ItemSlot bagPocket_TMHM[64]; /*0x790*/ struct ItemSlot bagPocket_Berries[46]; - /*0x848*/ struct Pokeblock pokeblocks[40]; + /*0x848*/ struct Pokeblock pokeblocks[POKEBLOCKS_COUNT]; /*0x988*/ u8 seen1[52]; /*0x9BC*/ u16 berryBlenderRecords[3]; /*0x9C2*/ u8 field_9C2[6]; diff --git a/include/list_menu.h b/include/list_menu.h index 0249b06af..8b793c0e4 100644 --- a/include/list_menu.h +++ b/include/list_menu.h @@ -1,14 +1,17 @@ #ifndef GUARD_LIST_MENU_H #define GUARD_LIST_MENU_H +#define LIST_NOTHING_CHOSEN -1 +#define LIST_B_PRESSED -2 + // Exported type declarations // Exported RAM declarations struct ListMenuItem { - const u8 *unk_00; - s32 unk_04; + const u8 *name; + s32 id; }; struct ListMenu; @@ -16,7 +19,7 @@ struct ListMenu; struct ListMenuTemplate { const struct ListMenuItem *items; - void (* unk_04)(u32, bool8, struct ListMenu *); + void (* moveCursorFunc)(u32, bool8, struct ListMenu *); void (* unk_08)(u8, s32, u8); u16 totalItems; u16 maxShowed; @@ -32,9 +35,11 @@ struct ListMenuTemplate u32 spaceBetweenItems:6; // x20000, x40000, x80000, x100000, x200000, x400000 = x7E0000 u32 unk_16_7:1; // x800000 u32 unk_17_0:6; // x1000000, x2000000, x4000000, x8000000, x10000000, x20000000 = x3F000000 + u32 cursorKind:2; // x40000000, x80000000 }; -struct ListMenu { +struct ListMenu +{ struct ListMenuTemplate _template; u16 scrollOffset; u16 selectedRow; @@ -44,13 +49,13 @@ struct ListMenu { u8 unk_1F; }; -extern struct ListMenuTemplate gUnknown_03006310; +extern struct ListMenuTemplate gMultiuseListMenuTemplate; // Exported ROM declarations -u8 ListMenuInit(struct ListMenuTemplate *template, u16 a1, u16 a2); -s32 ListMenuHandleInput(u8 id); -void get_coro_args_x18_x1A(u8 a0, u16 *a1, u16 *a2); -void sub_81AE6C8(u8 a0, u16 *a1, u16 *a2); +u8 ListMenuInit(struct ListMenuTemplate *template, u16 cursorPage, u16 cursorPosition); +s32 ListMenuHandleInputGetItemId(u8 listTaskId); +void sub_81AE860(u8 listTaskId, u16 *a1, u16 *a2); +void sub_81AE6C8(u8 listTaskId, u16 *a1, u16 *a2); #endif //GUARD_LIST_MENU_H diff --git a/include/menu.h b/include/menu.h index 2052a8dad..b57cfd455 100644 --- a/include/menu.h +++ b/include/menu.h @@ -32,7 +32,7 @@ void CreateYesNoMenu(const struct WindowTemplate *windowTemplate, u16 borderFirs s8 sub_8198C58(void); void do_scheduled_bg_tilemap_copies_to_vram(void); void clear_scheduled_bg_copies_to_vram(void); -void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor *color, s8 speed, const u8 *str); +void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, const struct TextColor *color, s8 speed, const u8 *str); void sub_8197B1C(u8 windowId, bool8 copyToVram, u16 a2, u16 a3); #endif // GUARD_MENU_H diff --git a/include/menu_helpers.h b/include/menu_helpers.h index 4abe5c006..4d76104b7 100644 --- a/include/menu_helpers.h +++ b/include/menu_helpers.h @@ -3,7 +3,8 @@ // Exported type declarations -struct YesNoFuncTable { +struct YesNoFuncTable +{ TaskFunc yesFunc; TaskFunc noFunc; }; @@ -20,5 +21,9 @@ void ResetVramOamAndBgCntRegs(void); void SetVBlankHBlankCallbacksToNull(void); void ResetAllBgsCoordinates(void); bool16 RunTextPrintersRetIsActive(u8 textPrinterId); +void sub_8122344(void *arg0, u8 arg1); +void LoadListMenuArrowsGfx(void); +void sub_81223FC(u8 *a0, u8 count, u8 a2); +void sub_8122448(u8 *a0, u8 count, u16 x, u16 y); #endif //GUARD_MENU_HELPERS_H diff --git a/include/pokeblock.h b/include/pokeblock.h index 5d691df22..c69aa07dc 100644 --- a/include/pokeblock.h +++ b/include/pokeblock.h @@ -25,6 +25,14 @@ enum PBLOCK_FEEL, }; +enum +{ + PBLOCK_CASE_FIELD, + PBLOCK_CASE_BATTLE, + PBLOCK_CASE_FEEDER, + PBLOCK_CASE_GIVE +}; + // use pokeblock extern u8 gPokeblockMonId; extern s16 gPokeblockGain; @@ -40,8 +48,13 @@ extern const u8 *const gPokeblockNames[]; extern const struct CompressedSpriteSheet gPokeblockCase_SpriteSheet; extern const struct CompressedSpritePalette gPokeblockCase_SpritePal; +void OpenPokeblockCase(u8 caseId, void (*callback)(void)); +void OpenPokeblockCaseInBattle(void); +void OpenPokeblockCaseOnFeeder(void); +void ResetPokeblockScrollPositions(void); + u8 CreatePokeblockCaseSprite(s16 x, s16 y, u8 subpriority); -u8 GetPokeblockData(const struct Pokeblock *pokeblock, u8 dataId); +s16 GetPokeblockData(const struct Pokeblock *pokeblock, u8 dataId); void ClearPokeblocks(void); s8 GetFirstFreePokeblockSlot(void); bool32 AddPokeblock(struct Pokeblock *pokeblock); diff --git a/include/strings.h b/include/strings.h index 6a379ee19..51027adff 100644 --- a/include/strings.h +++ b/include/strings.h @@ -18,6 +18,15 @@ extern const u8 gText_Tough[]; extern const u8 gText_Single[]; extern const u8 gText_Double[]; +extern const u8 gText_Spicy[]; +extern const u8 gText_Dry[]; +extern const u8 gText_Sweet[]; +extern const u8 gText_Bitter[]; +extern const u8 gText_Sour[]; + +extern const u8 gText_StowCase[]; +extern const u8 gText_LvVar1[]; + extern const u8 gText_Spicy2[]; extern const u8 gText_Dry2[]; extern const u8 gText_Sweet2[]; diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c index 2ec14cab5..5cfeb6da6 100644 --- a/src/battle_controller_safari.c +++ b/src/battle_controller_safari.c @@ -19,6 +19,7 @@ #include "reshow_battle_screen.h" #include "pokeball.h" #include "data2.h" +#include "pokeblock.h" extern u32 gBattleExecBuffer; extern u8 gActiveBank; @@ -291,13 +292,13 @@ static void CompleteOnSpecialAnimDone(void) SafariBufferExecCompleted(); } -static void OpenPokeblockCase(void) +static void SafariOpenPokeblockCase(void) { if (!gPaletteFade.active) { gBattleBankFunc[gActiveBank] = CompleteWhenChosePokeblock; FreeAllWindowBuffers(); - sub_81358F4(); + OpenPokeblockCaseInBattle(); } } @@ -497,7 +498,7 @@ static void SafariHandleChooseItem(void) s32 i; BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); - gBattleBankFunc[gActiveBank] = OpenPokeblockCase; + gBattleBankFunc[gActiveBank] = SafariOpenPokeblockCase; gBankInMenu = gActiveBank; } diff --git a/src/daycare.c b/src/daycare.c index 1c0548058..5866f274d 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -40,7 +40,7 @@ extern const u8 gDaycareText_PlayOther[]; extern u8 GetCursorSelectionMonId(void); extern u16 ItemIdToBattleMoveId(u16); -extern s32 ListMenuHandleInput(u8); +extern s32 ListMenuHandleInputGetItemId(u8); extern void sub_81AE6C8(u8, u16*, u16*); extern void sub_819746C(u8, bool8); extern void sub_81973FC(u8, bool8); @@ -75,7 +75,7 @@ static const struct ListMenuItem sLevelMenuItems[] = static const struct ListMenuTemplate sDaycareListMenuLevelTemplate = { .items = sLevelMenuItems, - .unk_04 = sub_81AF078, + .moveCursorFunc = sub_81AF078, .unk_08 = DaycarePrintMonInfo, .totalItems = 3, .maxShowed = 3, @@ -90,7 +90,8 @@ static const struct ListMenuTemplate sDaycareListMenuLevelTemplate = .unk_16_0 = TRUE, .spaceBetweenItems = 0, .unk_16_7 = FALSE, - .unk_17_0 = 1 + .unk_17_0 = 1, + .cursorKind = 0 }; static const u8 *const sCompatibilityMessages[] = @@ -1256,7 +1257,7 @@ static void DaycarePrintMonInfo(u8 windowId, s32 daycareSlotId, u8 y) static void Task_HandleDaycareLevelMenuInput(u8 taskId) { - u32 var = ListMenuHandleInput(gTasks[taskId].tMenuListTaskId); + u32 var = ListMenuHandleInputGetItemId(gTasks[taskId].tMenuListTaskId); if (gMain.newKeys & A_BUTTON) { diff --git a/src/decoration.c b/src/decoration.c index e4c84d0b9..974b60c7a 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -791,17 +791,17 @@ void sub_8127330(u8 taskId) for (i = 0; i < sDecorPCBuffer->unk_520 - 1; i ++) { sub_8127454(sDecorPCBuffer->names[i], gCurDecorInventoryItems[i]); - sDecorPCBuffer->items[i].unk_00 = sDecorPCBuffer->names[i]; - sDecorPCBuffer->items[i].unk_04 = i; + sDecorPCBuffer->items[i].name = sDecorPCBuffer->names[i]; + sDecorPCBuffer->items[i].id = i; } StringCopy(sDecorPCBuffer->names[i], gText_Cancel); - sDecorPCBuffer->items[i].unk_00 = sDecorPCBuffer->names[i]; - sDecorPCBuffer->items[i].unk_04 = -2; - gUnknown_03006310 = gUnknown_085A6BD0; - gUnknown_03006310.unk_10 = sDecorMenuWindowIndices[1]; - gUnknown_03006310.totalItems = sDecorPCBuffer->unk_520; - gUnknown_03006310.items = sDecorPCBuffer->items; - gUnknown_03006310.maxShowed = sDecorPCBuffer->unk_521; + sDecorPCBuffer->items[i].name = sDecorPCBuffer->names[i]; + sDecorPCBuffer->items[i].id = -2; + gMultiuseListMenuTemplate = gUnknown_085A6BD0; + gMultiuseListMenuTemplate.unk_10 = sDecorMenuWindowIndices[1]; + gMultiuseListMenuTemplate.totalItems = sDecorPCBuffer->unk_520; + gMultiuseListMenuTemplate.items = sDecorPCBuffer->items; + gMultiuseListMenuTemplate.maxShowed = sDecorPCBuffer->unk_521; } void sub_8127454(u8 *dest, u16 decorId) @@ -870,7 +870,7 @@ void sub_812759C(u8 taskId) sub_81272C8(); sub_81272F8(); sub_8127330(taskId); - data[13] = ListMenuInit(&gUnknown_03006310, sSecretBasePCSelectDecorPageNo, sSecretBasePCSelectDecorLineNo); + data[13] = ListMenuInit(&gMultiuseListMenuTemplate, sSecretBasePCSelectDecorPageNo, sSecretBasePCSelectDecorLineNo); sub_8127500(); } @@ -888,8 +888,8 @@ void sub_812764C(u8 taskId) data = gTasks[taskId].data; if (!gPaletteFade.active) { - input = ListMenuHandleInput(data[13]); - get_coro_args_x18_x1A(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo); + input = ListMenuHandleInputGetItemId(data[13]); + sub_81AE860(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo); switch (input) { case -1: diff --git a/src/new_game.c b/src/new_game.c index 12873fec9..89771e92b 100644 --- a/src/new_game.c +++ b/src/new_game.c @@ -33,7 +33,6 @@ extern void Overworld_SetWarpDestination(s8 mapBank, s8 mapNo, s8 warpNo, s8 xPo extern void warp_in(void); extern void sub_80BB358(void); extern void ResetBagScrollPositions(void); -extern void sub_813624C(void); // clears something pokeblock related extern void ResetPokedex(void); extern void sub_8084400(void); extern void ClearMailData(void); @@ -148,7 +147,7 @@ void sub_808447C(void) ZeroPlayerPartyMons(); ZeroEnemyPartyMons(); ResetBagScrollPositions(); - sub_813624C(); + ResetPokeblockScrollPositions(); } void NewGameInitData(void) diff --git a/src/pokeblock.c b/src/pokeblock.c index 4c8a9504f..6ea487bb2 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -8,6 +8,59 @@ #include "menu_helpers.h" #include "pokemon.h" #include "graphics.h" +#include "malloc.h" +#include "main.h" +#include "battle.h" +#include "battle_controllers.h" +#include "palette.h" +#include "unknown_task.h" +#include "list_menu.h" +#include "gpu_regs.h" +#include "decompress.h" +#include "international_string_util.h" +#include "item.h" +#include "items.h" +#include "string_util.h" +#include "songs.h" +#include "sound.h" +#include "berry.h" +#include "menu_indicators.h" +#include "event_data.h" + +#define FIELD_E75_COUNT 7 + +struct PokeblockMenuStruct +{ + u8 tilemap[0x800]; + void (*debugCallback)(void); + const u8 *pokeblockOptions; + u8 optionsNo; + u8 caseId; + u8 itemsNo; + u8 maxShowed; + struct ListMenuItem items[POKEBLOCKS_COUNT + 1]; + u8 menuItemsStrings[POKEBLOCKS_COUNT + 1][0x20]; // + 1 because of STOW CASE item + u8 pokeblockCaseSpriteId; + u8 field_E75[FIELD_E75_COUNT]; + u8 unkTaskId; + bool8 isSwapping; + s16 gfxState; + u8 field_E80; + u8 field_E81; + u8 field_E82; + u8 field_E83; + u8 field_E84; + u8 field_E85; + u8 field_E86; + u8 field_E87; +}; + +struct PokeblockSavedData +{ + void (*callback)(void); + u16 lastItemPos; + u16 lastItemPage; +}; enum { @@ -19,7 +72,33 @@ enum PKBL_GIVE_TO_LADY }; +extern u16 gSpecialVar_ItemId; +extern void (*gFieldCallback)(void); + +extern const u16 gUnknown_0860F074[]; + +extern void c2_exit_to_overworld_2_switch(void); +extern bool8 sub_81221EC(void); +extern void sub_809882C(u8, u16, u8); +extern void copy_textbox_border_tile_patterns_to_vram(u8, u16, u8); +extern void sub_80AF168(void); + // this file's functions +void CB2_InitPokeblockMenu(void); +bool8 InitPokeblockMenu(void); +static bool8 LoadPokeblockMenuGfx(void); +static void HandleInitBackgrounds(void); +static void HandleInitWindows(void); +void SetMenuItemsCountAndMaxShowed(void); +void sub_81362E0(void); +void sub_8136344(void); +void HandlePokeblockListMenuItems(void); +void sub_81363BC(void); +static void MovePokeblockMenuCursor(u32 pkblId, bool8 arg1, struct ListMenu *arg2); +static void PutPokeblockInfoText(void); +void HandlePokeblockMenuCursor(u16 cursorPos, u16 arg1); +static void PutPokeblockListMenuString(u8 *dst, u16 pkblId); +void Task_HandlePokeblockMenuInput(u8 taskId); void PokeblockAction_UseOnField(u8 taskId); void PokeblockAction_Toss(u8 taskId); void PokeblockAction_Cancel(u8 taskId); @@ -28,6 +107,16 @@ void PokeblockAction_UseOnPokeblockFeeder(u8 taskId); void PokeblockAction_GiveToContestLady(u8 taskId); void TossPokeblockChoice_Yes(u8 taskId); void TossPokeblockChoice_No(u8 taskId); +void Task_FreeDataAndExitPokeblockCase(u8 taskId); +void PutPokeblockOptionsWindow(u8 taskId); +static void Task_HandlePokeblocksSwapInput(u8 taskId); +static void sub_8136470(struct Sprite *sprite); +static void sub_8135FCC(s32 pkblId); +void HandlePokeblocksSwap(u8 taskId, bool8 noSwap); + +// ram variables +EWRAM_DATA struct PokeblockSavedData sSavedPokeblockData = {0}; +EWRAM_DATA struct PokeblockMenuStruct *sPokeblockMenu = NULL; // const rom data const s8 gPokeblockFlavorCompatibilityTable[] = @@ -60,7 +149,7 @@ const s8 gPokeblockFlavorCompatibilityTable[] = 0, 0, 0, 0, 0 // Quirky }; -const struct BgTemplate gUnknown_085B2620[] = +static const struct BgTemplate sBgTemplatesForPokeblockMenu[] = { { .bg = 0, @@ -181,7 +270,7 @@ const struct CompressedSpritePalette gPokeblockCase_SpritePal = gMenuPokeblockDevice_Pal, GFX_TAG_POKEBLOCK_CASE }; -const struct SpriteTemplate sSpriteTemplate_PokeblockCase = +static const struct SpriteTemplate sSpriteTemplate_PokeblockCase = { GFX_TAG_POKEBLOCK_CASE, GFX_TAG_POKEBLOCK_CASE, @@ -202,3 +291,727 @@ const struct Pokeblock sFavoritePokeblocksTable[] = { PBLOCK_CLR_GREEN, 0, 0, 0, 20, 0, 20}, { PBLOCK_CLR_YELLOW, 0, 0, 0, 0, 20, 20} }; + +static const struct WindowTemplate sWindowTemplatesForPokeblockMenu[] = +{ + {0, 2, 1, 9, 2, 0xF, 0x1E}, + {0, 0xF, 1, 0xE, 0x12, 0xF, 0x30}, + {0, 2, 0xD, 5, 2, 0xF, 0x12C}, + {0, 2, 0xF, 5, 2, 0xF, 0x136}, + {0, 2, 0x11, 5, 2, 0xF, 0x140}, + {0, 8, 0xD, 5, 2, 0xF, 0x14A}, + {0, 8, 0xF, 5, 2, 0xF, 0x154}, + {0, 0xB, 0x11, 2, 2, 0xF, 0x15E}, + {1, 7, 5, 6, 6, 0xF, 0x162}, + {1, 7, 7, 6, 4, 0xF, 0x186}, + {1, 2, 0xF, 0x1B, 4, 0xF, 0x19E}, + DUMMY_WIN_TEMPLATE +}; + +const struct WindowTemplate gUnknown_085B27A8[] = {1, 0x15, 9, 5, 4, 0xF, 0x20A}; + +static const struct ListMenuTemplate sPokeblockListMenuTemplate = +{ + .items = NULL, + .moveCursorFunc = MovePokeblockMenuCursor, + .unk_08 = NULL, + .totalItems = 0, + .maxShowed = 0, + .unk_10 = 1, + .unk_11 = 0, + .unk_12 = 1, + .cursor_Y = 0, + .upText_Y = 1, + .cursorColor = 2, + .fillColor = 0, + .cursorShadowColor = 3, + .unk_16_0 = FALSE, + .spaceBetweenItems = 32, + .unk_16_7 = FALSE, + .unk_17_0 = 1, + .cursorKind = 1 +}; + +// code +void OpenPokeblockCase(u8 caseId, void (*callback)(void)) +{ + sPokeblockMenu = Alloc(sizeof(*sPokeblockMenu)); + sPokeblockMenu->caseId = caseId; + sPokeblockMenu->debugCallback = NULL; + sPokeblockMenu->unkTaskId = 0xFF; + sPokeblockMenu->isSwapping = FALSE; + sSavedPokeblockData.callback = callback; + + switch (sPokeblockMenu->caseId) + { + case PBLOCK_CASE_BATTLE: + sPokeblockMenu->pokeblockOptions = sActionsInBattle; + sPokeblockMenu->optionsNo = ARRAY_COUNT(sActionsInBattle); + break; + case PBLOCK_CASE_FEEDER: + sPokeblockMenu->pokeblockOptions = sActionsOnPokeblockFeeder; + sPokeblockMenu->optionsNo = ARRAY_COUNT(sActionsOnPokeblockFeeder); + break; + case PBLOCK_CASE_GIVE: + sPokeblockMenu->pokeblockOptions = sActionsWhenGivingToLady; + sPokeblockMenu->optionsNo = ARRAY_COUNT(sActionsWhenGivingToLady); + break; + default: + sPokeblockMenu->pokeblockOptions = sActionsOnField; + sPokeblockMenu->optionsNo = ARRAY_COUNT(sActionsOnField); + break; + } + + SetMainCallback2(CB2_InitPokeblockMenu); +} + +void OpenPokeblockCaseInBattle(void) +{ + OpenPokeblockCase(PBLOCK_CASE_BATTLE, SetCB2ToReshowScreenAfterMenu2); +} + +void OpenPokeblockCaseOnFeeder(void) +{ + OpenPokeblockCase(PBLOCK_CASE_FEEDER, c2_exit_to_overworld_2_switch); +} + +static void CB2_PokeblockMenu(void) +{ + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + do_scheduled_bg_tilemap_copies_to_vram(); + UpdatePaletteFade(); +} + +static void VBlankCB_PokeblockMenu(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +void CB2_InitPokeblockMenu(void) +{ + while (1) + { + if (sub_81221EC() == TRUE) + break; + if (InitPokeblockMenu() == TRUE) + break; + if (sub_81221AC() == TRUE) + break; + } +} + +bool8 InitPokeblockMenu(void) +{ + u8 taskId; + + switch (gMain.state) + { + case 0: + SetVBlankHBlankCallbacksToNull(); + clear_scheduled_bg_copies_to_vram(); + gMain.state++; + break; + case 1: + remove_some_task(); + gMain.state++; + break; + case 2: + FreeAllSpritePalettes(); + gMain.state++; + break; + case 3: + ResetPaletteFade(); + gPaletteFade.bufferTransferDisabled = 1; + gMain.state++; + break; + case 4: + ResetSpriteData(); + gMain.state++; + break; + case 5: + if (sPokeblockMenu->caseId != PBLOCK_CASE_BATTLE) + ResetTasks(); + gMain.state++; + break; + case 6: + HandleInitBackgrounds(); + sPokeblockMenu->gfxState = 0; + gMain.state++; + break; + case 7: + if (!LoadPokeblockMenuGfx()) + return FALSE; + gMain.state++; + break; + case 8: + SetMenuItemsCountAndMaxShowed(); + sub_81362E0(); + sub_8136344(); + gMain.state++; + break; + case 9: + sPokeblockMenu->pokeblockCaseSpriteId = CreatePokeblockCaseSprite(56, 64, 0); + gMain.state++; + break; + case 10: + sub_8122344(&sPokeblockMenu->field_E75, FIELD_E75_COUNT); + gMain.state++; + break; + case 11: + HandlePokeblockMenuCursor(sSavedPokeblockData.lastItemPos, 0x1005); + gMain.state++; + break; + case 12: + HandleInitWindows(); + gMain.state++; + break; + case 13: + HandlePokeblockListMenuItems(); + gMain.state++; + break; + case 14: + sub_81363BC(); + gMain.state++; + break; + case 15: + taskId = CreateTask(Task_HandlePokeblockMenuInput, 0); + gTasks[taskId].data[0] = ListMenuInit(&gMultiuseListMenuTemplate, sSavedPokeblockData.lastItemPage, sSavedPokeblockData.lastItemPos); + gMain.state++; + break; + case 16: + PutPokeblockInfoText(); + gMain.state++; + break; + case 17: + BlendPalettes(-1, 0x10, 0); + gMain.state++; + break; + case 18: + BeginNormalPaletteFade(-1, 0, 0x10, 0, 0); + gPaletteFade.bufferTransferDisabled = 0; + gMain.state++; + break; + default: + SetVBlankCallback(VBlankCB_PokeblockMenu); + SetMainCallback2(CB2_PokeblockMenu); + return TRUE; + } + + return FALSE; +} + +static void HandleInitBackgrounds(void) +{ + ResetVramOamAndBgCntRegs(); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, sBgTemplatesForPokeblockMenu, ARRAY_COUNT(sBgTemplatesForPokeblockMenu)); + SetBgTilemapBuffer(2, sPokeblockMenu->tilemap); + ResetAllBgsCoordinates(); + schedule_bg_copy_tilemap_to_vram(2); + + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); + + ShowBg(0); + ShowBg(1); + ShowBg(2); + + SetGpuReg(REG_OFFSET_BLDCNT, 0); +} + +static bool8 LoadPokeblockMenuGfx(void) +{ + switch (sPokeblockMenu->gfxState) + { + case 0: + reset_temp_tile_data_buffers(); + decompress_and_copy_tile_data_to_vram(2, gMenuPokeblock_Gfx, 0, 0, 0); + sPokeblockMenu->gfxState++; + break; + case 1: + if (free_temp_tile_data_buffers_if_possible() != TRUE) + { + LZDecompressWram(gMenuPokeblock_Tilemap, sPokeblockMenu->tilemap); + sPokeblockMenu->gfxState++; + } + break; + case 2: + LoadCompressedPalette(gMenuPokeblock_Pal, 0, 0xC0); + sPokeblockMenu->gfxState++; + break; + case 3: + LoadCompressedObjectPic(&gPokeblockCase_SpriteSheet); + sPokeblockMenu->gfxState++; + break; + case 4: + LoadCompressedObjectPalette(&gPokeblockCase_SpritePal); + sPokeblockMenu->gfxState++; + break; + case 5: + LoadListMenuArrowsGfx(); + sPokeblockMenu->gfxState = 0; + return TRUE; + } + + return FALSE; +} + +static void HandleInitWindows(void) +{ + u8 i; + + InitWindows(sWindowTemplatesForPokeblockMenu); + DeactivateAllTextPrinters(); + sub_809882C(0, 1, 0xE0); + copy_textbox_border_tile_patterns_to_vram(0, 0xA, 0xD0); + LoadPalette(gUnknown_0860F074, 0xF0, 0x20); + + for (i = 0; i < ARRAY_COUNT(sWindowTemplatesForPokeblockMenu) - 1; i++) + { + FillWindowPixelBuffer(i, 0); + } + + schedule_bg_copy_tilemap_to_vram(0); + schedule_bg_copy_tilemap_to_vram(1); +} + +void PrintOnPokeblockWindow(u8 windowId, const u8 *string, s32 x) +{ + AddTextPrinterParametrized2(windowId, 1, x, 1, 0, 0, &sTextColorInPokeblockMenu, 0, string); +} + +static void PutPokeblockInfoText(void) +{ + u8 i; + + const u8 *itemName = ItemId_GetItem(ITEM_POKEBLOCK_CASE)->name; + PrintOnPokeblockWindow(0, itemName, GetStringCenterAlignXOffset(1, itemName, 0x48)); + + PrintOnPokeblockWindow(2, gText_Spicy, 0); + PrintOnPokeblockWindow(3, gText_Dry, 0); + PrintOnPokeblockWindow(4, gText_Sweet, 0); + PrintOnPokeblockWindow(5, gText_Bitter, 0); + PrintOnPokeblockWindow(6, gText_Sour, 0); + + for (i = 0; i < 8; i++) + { + PutWindowTilemap(i); + } +} + +void HandlePokeblockListMenuItems(void) +{ + u16 i; + + for (i = 0; i < sPokeblockMenu->itemsNo - 1; i++) + { + PutPokeblockListMenuString(sPokeblockMenu->menuItemsStrings[i], i); + sPokeblockMenu->items[i].name = sPokeblockMenu->menuItemsStrings[i]; + sPokeblockMenu->items[i].id = i; + } + + StringCopy(sPokeblockMenu->menuItemsStrings[i], gText_StowCase); + sPokeblockMenu->items[i].name = sPokeblockMenu->menuItemsStrings[i]; + sPokeblockMenu->items[i].id = LIST_B_PRESSED; + + gMultiuseListMenuTemplate = sPokeblockListMenuTemplate; + gMultiuseListMenuTemplate.unk_17_0 = 7; + gMultiuseListMenuTemplate.totalItems = sPokeblockMenu->itemsNo; + gMultiuseListMenuTemplate.items = sPokeblockMenu->items; + gMultiuseListMenuTemplate.maxShowed = sPokeblockMenu->maxShowed; +} + +static void PutPokeblockListMenuString(u8 *dst, u16 pkblId) +{ + struct Pokeblock *pkblock = &gSaveBlock1Ptr->pokeblocks[pkblId]; + u8 *txtPtr = StringCopy(dst, gPokeblockNames[pkblock->color]); + + *(txtPtr++) = EXT_CTRL_CODE_BEGIN; + *(txtPtr++) = 0x12; + *(txtPtr++) = 0x57; + + ConvertIntToDecimalStringN(gStringVar1, GetHighestPokeblocksFlavorLevel(pkblock), STR_CONV_MODE_LEFT_ALIGN, 3); + StringExpandPlaceholders(txtPtr, gText_LvVar1); +} + +static void MovePokeblockMenuCursor(u32 pkblId, bool8 arg1, struct ListMenu *arg2) +{ + if (arg1 != TRUE) + { + PlaySE(SE_SELECT); + gSprites[sPokeblockMenu->pokeblockCaseSpriteId].callback = sub_8136470; + } + + if (!sPokeblockMenu->isSwapping) + sub_8135FCC(pkblId); +} + +static void sub_8135FCC(s32 pkblId) +{ + u8 i; + struct Pokeblock *pokeblock; + u16 rectTilemapSrc[2]; + + FillWindowPixelBuffer(7, 0); + + if (pkblId != LIST_B_PRESSED) + { + pokeblock = &gSaveBlock1Ptr->pokeblocks[pkblId]; + rectTilemapSrc[0] = 0x17; + rectTilemapSrc[1] = 0x18; + for (i = 0; i < FLAVOR_COUNT; i++) + { + if (GetPokeblockData(pokeblock, PBLOCK_SPICY + i) > 0) + { + rectTilemapSrc[0] = (i << 0xC) + 0x17; + rectTilemapSrc[1] = (i << 0xC) + 0x18; + } + else + { + rectTilemapSrc[0] = 0xF; + rectTilemapSrc[1] = 0xF; + } + CopyToBgTilemapBufferRect(2, rectTilemapSrc, (i / 3 * 6) + 1, (i % 3 * 2) + 13, 1, 2); + } + ConvertIntToDecimalStringN(gStringVar1, GetPokeblocksFeel(pokeblock), STR_CONV_MODE_RIGHT_ALIGN, 2); + PrintOnPokeblockWindow(7, gStringVar1, 4); + } + else + { + rectTilemapSrc[0] = 0xF; + rectTilemapSrc[1] = 0xF; + + for (i = 0; i < FLAVOR_COUNT; i++) + { + CopyToBgTilemapBufferRect(2, rectTilemapSrc, (i / 3 * 6) + 1, (i % 3 * 2) + 13, 1, 2); + } + CopyWindowToVram(7, 2); + } + + schedule_bg_copy_tilemap_to_vram(0); + schedule_bg_copy_tilemap_to_vram(2); +} + +void HandlePokeblockMenuCursor(u16 cursorPos, u16 arg1) +{ + FillBgTilemapBufferRect_Palette0(2, arg1, 0xF, (cursorPos * 2) + 1, 0xE, 2); + schedule_bg_copy_tilemap_to_vram(2); +} + +void CompactPokeblockSlots(void) +{ + u16 i, j; + + for (i = 0; i < POKEBLOCKS_COUNT - 1; i++) + { + for (j = i + 1; j < POKEBLOCKS_COUNT; j++) + { + if (gSaveBlock1Ptr->pokeblocks[i].color == 0) + { + struct Pokeblock temp = gSaveBlock1Ptr->pokeblocks[i]; + gSaveBlock1Ptr->pokeblocks[i] = gSaveBlock1Ptr->pokeblocks[j]; + gSaveBlock1Ptr->pokeblocks[j] = temp; + } + } + } +} + +void SwapSortPokeblocksInternalData(u32 id1, u32 id2) +{ + s16 i, count; + struct Pokeblock *pokeblocks = gSaveBlock1Ptr->pokeblocks; + struct Pokeblock *copyPokeblock1; + + if (id1 == id2) + return; + + copyPokeblock1 = Alloc(sizeof(struct Pokeblock)); + *copyPokeblock1 = pokeblocks[id1]; + + if (id2 > id1) + { + id2--; + for (count = id2, i = id1; i < count; i++) + pokeblocks[i] = pokeblocks[i + 1]; + } + else + { + for (count = id2, i = id1; i > count; i--) + pokeblocks[i] = pokeblocks[i - 1]; + } + + pokeblocks[id2] = *copyPokeblock1; + Free(copyPokeblock1); +} + +void ResetPokeblockScrollPositions(void) +{ + sSavedPokeblockData.lastItemPos = 0; + sSavedPokeblockData.lastItemPage = 0; +} + +void SetMenuItemsCountAndMaxShowed(void) +{ + u16 i; + + CompactPokeblockSlots(); + + for (sPokeblockMenu->itemsNo = 0, i = 0; i < POKEBLOCKS_COUNT; i++) + { + if (gSaveBlock1Ptr->pokeblocks[i].color != 0) + sPokeblockMenu->itemsNo++; + } + + sPokeblockMenu->itemsNo++; // STOW CASE menu item + + if (sPokeblockMenu->itemsNo > 9) + sPokeblockMenu->maxShowed = 9; + else + sPokeblockMenu->maxShowed = sPokeblockMenu->itemsNo; +} + +void sub_81362E0(void) +{ + if (sSavedPokeblockData.lastItemPage != 0) + { + if (sSavedPokeblockData.lastItemPage + sPokeblockMenu->maxShowed > sPokeblockMenu->itemsNo) + sSavedPokeblockData.lastItemPage = sPokeblockMenu->itemsNo - sPokeblockMenu->maxShowed; + } + + if (sSavedPokeblockData.lastItemPage + sSavedPokeblockData.lastItemPos >= sPokeblockMenu->itemsNo) + { + if (sPokeblockMenu->itemsNo == 0) + sSavedPokeblockData.lastItemPos = 0; + else + sSavedPokeblockData.lastItemPos = sPokeblockMenu->itemsNo - 1; + } +} + +void sub_8136344(void) +{ + if (sSavedPokeblockData.lastItemPos > 4) + { + u8 i; + + for (i = 0; + i < sSavedPokeblockData.lastItemPos - 4 && sSavedPokeblockData.lastItemPage + sPokeblockMenu->maxShowed != sPokeblockMenu->itemsNo; + sSavedPokeblockData.lastItemPos--, sSavedPokeblockData.lastItemPage++, i++); + } +} + +void sub_81363BC(void) +{ + if (sPokeblockMenu->unkTaskId == 0xFF) + { + sPokeblockMenu->unkTaskId = AddScrollIndicatorArrowPairParametrized(2, 0xB0, 8, 0x98, sPokeblockMenu->itemsNo - sPokeblockMenu->maxShowed, + 0x456, 0x456, &sSavedPokeblockData.lastItemPage); + } +} + +void sub_8136418(void) +{ + if (sPokeblockMenu->unkTaskId != 0xFF) + { + RemoveScrollIndicatorArrowPair(sPokeblockMenu->unkTaskId); + sPokeblockMenu->unkTaskId = 0xFF; + } +} + +u8 CreatePokeblockCaseSprite(s16 x, s16 y, u8 subpriority) +{ + return CreateSprite(&sSpriteTemplate_PokeblockCase, x, y, subpriority); +} + +static void sub_8136470(struct Sprite *sprite) +{ + if (sprite->data[0] > 1) + sprite->data[0] = 0; + + switch (sprite->data[0]) + { + case 0: + sprite->oam.affineMode = 1; + sprite->affineAnims = sSpriteAffineAnimTable_85B26F0; + InitSpriteAffineAnim(sprite); + sprite->data[0] = 1; + sprite->data[1] = 0; + break; + case 1: + if (++sprite->data[1] > 11) + { + sprite->oam.affineMode = 0; + sprite->data[0] = 0; + sprite->data[1] = 0; + FreeOamMatrix(sprite->oam.matrixNum); + sprite->callback = SpriteCallbackDummy; + } + break; + } +} + +void FadePaletteAndSetTaskToClosePokeblockCase(u8 taskId) +{ + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gTasks[taskId].func = Task_FreeDataAndExitPokeblockCase; +} + +void Task_FreeDataAndExitPokeblockCase(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + if (!gPaletteFade.active) + { + if (sPokeblockMenu->caseId == PBLOCK_CASE_FEEDER || sPokeblockMenu->caseId == PBLOCK_CASE_GIVE) + gFieldCallback = sub_80AF168; + + sub_81AE6C8(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); + sub_8136418(); + ResetSpriteData(); + FreeAllSpritePalettes(); + + if (sPokeblockMenu->debugCallback != NULL) + SetMainCallback2(sPokeblockMenu->debugCallback); + else + SetMainCallback2(sSavedPokeblockData.callback); + + FreeAllWindowBuffers(); + Free(sPokeblockMenu); + DestroyTask(taskId); + } +} + +void Task_HandlePokeblockMenuInput(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + if (!gPaletteFade.active && sub_81221EC() != TRUE) + { + if (gMain.newKeys & SELECT_BUTTON) + { + sub_81AE860(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); + if (sSavedPokeblockData.lastItemPage + sSavedPokeblockData.lastItemPos != sPokeblockMenu->itemsNo - 1) + { + PlaySE(SE_SELECT); + HandlePokeblockMenuCursor(sSavedPokeblockData.lastItemPos, 0x2005); + data[2] = sSavedPokeblockData.lastItemPage + sSavedPokeblockData.lastItemPos; + sPokeblockMenu->isSwapping = TRUE; + gTasks[taskId].func = Task_HandlePokeblocksSwapInput; + } + } + else + { + u16 oldPosition = sSavedPokeblockData.lastItemPos; + s32 itemId = ListMenuHandleInputGetItemId(data[0]); + + sub_81AE860(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); + if (oldPosition != sSavedPokeblockData.lastItemPos) + { + HandlePokeblockMenuCursor(oldPosition, 5); + HandlePokeblockMenuCursor(sSavedPokeblockData.lastItemPos, 0x1005); + } + + switch (itemId) + { + case LIST_NOTHING_CHOSEN: + break; + case LIST_B_PRESSED: + PlaySE(SE_SELECT); + gSpecialVar_Result = 0xFFFF; + gSpecialVar_ItemId = 0; + FadePaletteAndSetTaskToClosePokeblockCase(taskId); + break; + default: + PlaySE(SE_SELECT); + gSpecialVar_ItemId = itemId; + PutPokeblockOptionsWindow(taskId); + break; + } + } + } +} + +static void Task_HandlePokeblocksSwapInput(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + if (sub_81221EC() == TRUE) + return; + + if (gMain.newKeys & SELECT_BUTTON) + { + PlaySE(SE_SELECT); + sub_81AE860(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); + HandlePokeblocksSwap(taskId, FALSE); + } + else + { + u16 i = sSavedPokeblockData.lastItemPage; + u16 var = sSavedPokeblockData.lastItemPos; + s32 itemId = ListMenuHandleInputGetItemId(data[0]); + + sub_81AE860(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); + if (i != sSavedPokeblockData.lastItemPage || var != sSavedPokeblockData.lastItemPos) + { + for (i = 0; i < 9; i++) + { + var = i + sSavedPokeblockData.lastItemPage; + if (var == data[2]) + HandlePokeblockMenuCursor(i, 0x2005); + else + HandlePokeblockMenuCursor(i, 5); + } + } + + sub_81223FC(sPokeblockMenu->field_E75, FIELD_E75_COUNT, 0); + sub_8122448(sPokeblockMenu->field_E75, FIELD_E75_COUNT, 0x80, (sSavedPokeblockData.lastItemPos * 16) + 8); + + switch (itemId) + { + case LIST_NOTHING_CHOSEN: + break; + case LIST_B_PRESSED: // same id as STOW CASE field + PlaySE(SE_SELECT); + if (gMain.newKeys & A_BUTTON) + HandlePokeblocksSwap(taskId, FALSE); + else + HandlePokeblocksSwap(taskId, TRUE); + break; + default: + PlaySE(SE_SELECT); + HandlePokeblocksSwap(taskId, FALSE); + break; + } + } +} + +void HandlePokeblocksSwap(u8 taskId, bool8 noSwap) +{ + u8 i; + s16 *data = gTasks[taskId].data; + u16 swappedFromId = sSavedPokeblockData.lastItemPage + sSavedPokeblockData.lastItemPos; + + sPokeblockMenu->isSwapping = FALSE; + sub_81AE6C8(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos); + + if (!noSwap && data[2] != swappedFromId && data[2] != swappedFromId - 1) + { + SwapSortPokeblocksInternalData(data[2], swappedFromId); + HandlePokeblockListMenuItems(); + } + + if (data[2] < swappedFromId) + sSavedPokeblockData.lastItemPos--; + + data[0] = ListMenuInit(&gMultiuseListMenuTemplate, sSavedPokeblockData.lastItemPage, sSavedPokeblockData.lastItemPos); + schedule_bg_copy_tilemap_to_vram(0); + sub_81223FC(sPokeblockMenu->field_E75, FIELD_E75_COUNT, 1); + + for (i = 0; i < 9; i++) + HandlePokeblockMenuCursor(i, 5); + + HandlePokeblockMenuCursor(sSavedPokeblockData.lastItemPos, 0x1005); + gTasks[taskId].func = Task_HandlePokeblockMenuInput; +} diff --git a/src/secret_base.c b/src/secret_base.c index de2b7221a..2ae093bc2 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -1081,13 +1081,13 @@ void game_continue(u8 taskId) if (sub_80E9878(i)) { sub_80E9780(gUnknown_0203A020->names[count], i); - gUnknown_0203A020->items[count].unk_00 = gUnknown_0203A020->names[count]; - gUnknown_0203A020->items[count].unk_04 = i; + gUnknown_0203A020->items[count].name = gUnknown_0203A020->names[count]; + gUnknown_0203A020->items[count].id = i; count ++; } } - gUnknown_0203A020->items[count].unk_00 = gText_Cancel; - gUnknown_0203A020->items[count].unk_04 = -2; + gUnknown_0203A020->items[count].name = gText_Cancel; + gUnknown_0203A020->items[count].id = -2; data[0] = count + 1; if (data[0] < 8) { @@ -1097,11 +1097,11 @@ void game_continue(u8 taskId) { data[3] = 8; } - gUnknown_03006310 = gUnknown_0858D07C; - gUnknown_03006310.unk_10 = data[6]; - gUnknown_03006310.totalItems = data[0]; - gUnknown_03006310.items = gUnknown_0203A020->items; - gUnknown_03006310.maxShowed = data[3]; + gMultiuseListMenuTemplate = gUnknown_0858D07C; + gMultiuseListMenuTemplate.unk_10 = data[6]; + gMultiuseListMenuTemplate.totalItems = data[0]; + gMultiuseListMenuTemplate.items = gUnknown_0203A020->items; + gMultiuseListMenuTemplate.maxShowed = data[3]; } void sub_80E9DEC(u32 a0, bool8 flag, struct ListMenu *menu) @@ -1118,7 +1118,7 @@ void sub_80E9E00(u8 taskId) data = gTasks[taskId].data; SetStandardWindowBorderStyle(data[6], 0); - data[5] = ListMenuInit(&gUnknown_03006310, data[2], data[1]); + data[5] = ListMenuInit(&gMultiuseListMenuTemplate, data[2], data[1]); sub_80E9E44(taskId); schedule_bg_copy_tilemap_to_vram(0); } @@ -1137,8 +1137,8 @@ void sub_80E9E90(u8 taskId) s32 input; data = gTasks[taskId].data; - input = ListMenuHandleInput(data[5]); - get_coro_args_x18_x1A(data[5], &data[2], &data[1]); + input = ListMenuHandleInputGetItemId(data[5]); + sub_81AE860(data[5], &data[2], &data[1]); switch (input) { case -1: diff --git a/sym_common.txt b/sym_common.txt index 93b8431f4..1dcbbb68f 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -419,7 +419,7 @@ gUnknown_030062F4: @ 30062F4 gUnknown_03006300: @ 3006300 .space 0x10 -gUnknown_03006310: @ 3006310 +gMultiuseListMenuTemplate: @ 3006310 .space 0x18 gUnknown_03006328: @ 3006328 diff --git a/sym_ewram.txt b/sym_ewram.txt index 2e4295a03..fa195ffb2 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1164,15 +1164,8 @@ gUnknown_0203AB34: @ 203AB34 .align 2 gUnknown_0203AB40: @ 203AB40 .space 0x8 - -gUnknown_0203AB48: @ 203AB48 - .space 0x6 - -gUnknown_0203AB4E: @ 203AB4E - .space 0x2 - -gUnknown_0203AB50: @ 203AB50 - .space 0x4 + + .include "src/pokeblock.o" gUnknown_0203AB54: @ 203AB54 .space 0x1