diff --git a/asm/berry_tag_screen.s b/asm/berry_tag_screen.s index 422f5f3d6..75e50f88d 100644 --- a/asm/berry_tag_screen.s +++ b/asm/berry_tag_screen.s @@ -115,7 +115,7 @@ _08177CD8: .4byte _08177DC2 _08177D18: bl SetVBlankHBlankCallbacksToNull - bl sub_8121DA0 + bl ResetVramOamAndBgCntRegs bl clear_scheduled_bg_copies_to_vram b _08177DDC _08177D26: @@ -246,7 +246,7 @@ sub_8177E14: @ 8177E14 adds r1, r0 movs r0, 0x3 bl SetBgTilemapBuffer - bl sub_8121E10 + bl ResetAllBgsCoordinates movs r0, 0x2 bl schedule_bg_copy_tilemap_to_vram movs r0, 0x3 diff --git a/asm/item_menu.s b/asm/item_menu.s index 1be72593a..49f587939 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 @@ -568,7 +568,7 @@ _081AB046: thumb_func_start bag_menu_init_bgs bag_menu_init_bgs: @ 81AB050 push {r4,lr} - bl sub_8121DA0 + bl ResetVramOamAndBgCntRegs ldr r4, =gUnknown_0203CE54 ldr r0, [r4] adds r0, 0x4 @@ -586,7 +586,7 @@ bag_menu_init_bgs: @ 81AB050 adds r1, 0x4 movs r0, 0x2 bl SetBgTilemapBuffer - bl sub_8121E10 + bl ResetAllBgsCoordinates movs r0, 0x2 bl schedule_bg_copy_tilemap_to_vram movs r1, 0x82 @@ -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/item_use.s b/asm/item_use.s index f732c34e9..ebf5ac979 100644 --- a/asm/item_use.s +++ b/asm/item_use.s @@ -1497,7 +1497,7 @@ sub_80FDBEC: @ 80FDBEC push {lr} ldr r1, =bag_menu_mail_related movs r0, 0 - bl sub_81357FC + bl OpenPokeblockCase pop {r0} bx r0 .pool @@ -1517,7 +1517,7 @@ sub_80FDC00: @ 80FDC00 bl overworld_free_bg_tilemaps ldr r1, =c2_exit_to_overworld_2_switch movs r0, 0 - bl sub_81357FC + bl OpenPokeblockCase adds r0, r4, 0 bl DestroyTask _080FDC24: diff --git a/asm/learn_move.s b/asm/learn_move.s index acd9f4f98..f42514e68 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 @@ -175,14 +175,14 @@ sub_8160740: @ 8160740 thumb_func_start sub_81607EC sub_81607EC: @ 81607EC push {lr} - bl sub_8121DA0 + bl ResetVramOamAndBgCntRegs movs r0, 0 bl ResetBgsAndClearDma3BusyFlags ldr r1, =gUnknown_085CEC28 movs r0, 0 movs r2, 0x2 bl InitBgsFromTemplates - bl sub_8121E10 + bl ResetAllBgsCoordinates movs r1, 0x82 lsls r1, 5 movs r0, 0 @@ -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 953e1ac25..a6e580d5c 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 7419bd56f..26e800944 100644 --- a/asm/menu_helpers.s +++ b/asm/menu_helpers.s @@ -5,8 +5,8 @@ .text - thumb_func_start sub_8121DA0 -sub_8121DA0: @ 8121DA0 + thumb_func_start ResetVramOamAndBgCntRegs +ResetVramOamAndBgCntRegs: @ 8121DA0 push {r4,lr} sub sp, 0xC movs r0, 0 @@ -50,10 +50,10 @@ sub_8121DA0: @ 8121DA0 pop {r0} bx r0 .pool - thumb_func_end sub_8121DA0 + thumb_func_end ResetVramOamAndBgCntRegs - thumb_func_start sub_8121E10 -sub_8121E10: @ 8121E10 + thumb_func_start ResetAllBgsCoordinates +ResetAllBgsCoordinates: @ 8121E10 push {lr} movs r0, 0 movs r1, 0 @@ -89,7 +89,7 @@ sub_8121E10: @ 8121E10 bl ChangeBgY pop {r0} bx r0 - thumb_func_end sub_8121E10 + thumb_func_end ResetAllBgsCoordinates thumb_func_start SetVBlankHBlankCallbacksToNull @ void SetVBlankHBlankCallbacksToNull() @@ -177,8 +177,8 @@ _08121EC0: .pool thumb_func_end DisplayMessageAndContinueTask - thumb_func_start sub_8121F20 -sub_8121F20: @ 8121F20 + thumb_func_start RunTextPrintersRetIsActive +RunTextPrintersRetIsActive: @ 8121F20 push {r4,lr} adds r4, r0, 0 lsls r4, 24 @@ -191,7 +191,7 @@ sub_8121F20: @ 8121F20 pop {r4} pop {r1} bx r1 - thumb_func_end sub_8121F20 + thumb_func_end RunTextPrintersRetIsActive thumb_func_start Task_ContinueTaskAfterMessagePrints @ void Task_ContinueTaskAfterMessagePrints(u8 taskId) @@ -201,7 +201,7 @@ Task_ContinueTaskAfterMessagePrints: @ 8121F3C lsrs r4, r0, 24 ldr r0, =gUnknown_0203A140 ldrb r0, [r0] - bl sub_8121F20 + bl RunTextPrintersRetIsActive lsls r0, 16 cmp r0, 0 bne _08121F5A @@ -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 fb3c023b1..f86097ce9 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/party_menu.s b/asm/party_menu.s index 0ee74ea95..4a70ab1da 100755 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -98,7 +98,7 @@ _081B0234: .4byte _081B0474 _081B0290: bl SetVBlankHBlankCallbacksToNull - bl sub_8121DA0 + bl ResetVramOamAndBgCntRegs bl clear_scheduled_bg_copies_to_vram ldr r1, =gMain movs r0, 0x87 @@ -429,7 +429,7 @@ sub_81B0550: @ 81B0550 ldr r1, [r5] movs r0, 0x1 bl SetBgTilemapBuffer - bl sub_8121E10 + bl ResetAllBgsCoordinates movs r0, 0x1 bl schedule_bg_copy_tilemap_to_vram movs r1, 0x82 @@ -3161,7 +3161,7 @@ sub_81B1B8C: @ 81B1B8C lsrs r4, r0, 24 adds r5, r4, 0 movs r0, 0x6 - bl sub_8121F20 + bl RunTextPrintersRetIsActive lsls r0, 16 lsrs r0, 16 cmp r0, 0x1 diff --git a/asm/player_pc.s b/asm/player_pc.s index 47cea14f5..5f32a00c2 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_feed.s b/asm/pokeblock_feed.s deleted file mode 100644 index 08559a8a2..000000000 --- a/asm/pokeblock_feed.s +++ /dev/null @@ -1,1873 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_8179B68 -sub_8179B68: @ 8179B68 - 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_8179B68 - - thumb_func_start sub_8179B84 -sub_8179B84: @ 8179B84 - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_8179B84 - - thumb_func_start sub_8179B98 -sub_8179B98: @ 8179B98 - push {r4,lr} - sub sp, 0x4 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0xD - bls _08179BAC - b _08179D4C -_08179BAC: - lsls r0, 2 - ldr r1, =_08179BC0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08179BC0: - .4byte _08179BF8 - .4byte _08179C20 - .4byte _08179C34 - .4byte _08179C48 - .4byte _08179C4E - .4byte _08179C60 - .4byte _08179C66 - .4byte _08179C78 - .4byte _08179C98 - .4byte _08179CB0 - .4byte _08179CDC - .4byte _08179CF8 - .4byte _08179CFE - .4byte _08179D18 -_08179BF8: - ldr r4, =gUnknown_0203BD18 - ldr r0, =0x00001084 - bl AllocZeroed - str r0, [r4] - bl SetVBlankHBlankCallbacksToNull - bl clear_scheduled_bg_copies_to_vram - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _08179D3A - .pool -_08179C20: - bl ResetPaletteFade - ldr r2, =gPaletteFade - ldrb r0, [r2, 0x8] - movs r1, 0x80 - orrs r0, r1 - b _08179D30 - .pool -_08179C34: - bl ResetSpriteData - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _08179D3A - .pool -_08179C48: - bl FreeAllSpritePalettes - b _08179D32 -_08179C4E: - bl AllocateMonSpritesGfx - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _08179D3A - .pool -_08179C60: - bl sub_8179D9C - b _08179D32 -_08179C66: - bl sub_8179FAC - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _08179D3A - .pool -_08179C78: - ldr r0, =gUnknown_0203BC9C - ldrb r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - bl sub_8179DF4 - lsls r0, 24 - cmp r0, 0 - beq _08179D64 - b _08179D32 - .pool -_08179C98: - bl sub_817A4A4 - ldr r1, =gUnknown_0203BD18 - ldr r1, [r1] - ldr r2, =0x0000105e - adds r1, r2 - strb r0, [r1] - b _08179D32 - .pool -_08179CB0: - ldr r0, =gUnknown_0203BC9C - ldrb r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - bl sub_817A358 - ldr r1, =gUnknown_0203BD18 - ldr r1, [r1] - ldr r2, =0x0000105d - adds r1, r2 - strb r0, [r1] - b _08179D32 - .pool -_08179CDC: - movs r0, 0 - movs r1, 0x1 - movs r2, 0x1 - movs r3, 0xE - bl SetWindowBorderStyle - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _08179D3A - .pool -_08179CF8: - bl sub_817A168 - b _08179D32 -_08179CFE: - movs r0, 0x1 - negs r0, r0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _08179D3A - .pool -_08179D18: - 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 -_08179D30: - strb r0, [r2, 0x8] -_08179D32: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 -_08179D3A: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08179D64 - .pool -_08179D4C: - ldr r0, =sub_8179B84 - bl SetVBlankCallback - ldr r0, =sub_8179B68 - bl SetMainCallback2 - movs r0, 0x1 - b _08179D66 - .pool -_08179D64: - movs r0, 0 -_08179D66: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8179B98 - - thumb_func_start sub_8179D70 -sub_8179D70: @ 8179D70 - push {lr} -_08179D72: - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08179D96 - bl sub_8179B98 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08179D96 - bl sub_81221AC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _08179D72 -_08179D96: - pop {r0} - bx r0 - thumb_func_end sub_8179D70 - - thumb_func_start sub_8179D9C -sub_8179D9C: @ 8179D9C - push {lr} - bl sub_8121DA0 - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_085F0550 - movs r0, 0 - movs r2, 0x2 - bl InitBgsFromTemplates - ldr r0, =gUnknown_0203BD18 - ldr r1, [r0] - adds r1, 0x48 - movs r0, 0x1 - bl SetBgTilemapBuffer - bl sub_8121E10 - movs r0, 0x1 - 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, 0x50 - movs r1, 0 - bl SetGpuReg - pop {r0} - bx r0 - .pool - thumb_func_end sub_8179D9C - - thumb_func_start sub_8179DF4 -sub_8179DF4: @ 8179DF4 - push {r4-r6,lr} - sub sp, 0x4 - adds r6, r0, 0 - ldr r0, =gUnknown_0203BD18 - ldr r0, [r0] - ldr r1, =0x0000107e - adds r0, r1 - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0x8 - bls _08179E0C - b _08179FA0 -_08179E0C: - lsls r0, 2 - ldr r1, =_08179E24 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08179E24: - .4byte _08179E48 - .4byte _08179E84 - .4byte _08179EC4 - .4byte _08179ED8 - .4byte _08179EEC - .4byte _08179F00 - .4byte _08179F20 - .4byte _08179F44 - .4byte _08179F78 -_08179E48: - adds r0, r6, 0 - movs r1, 0x41 - bl GetMonData - lsls r0, 16 - lsrs r5, r0, 16 - adds r0, r6, 0 - movs r1, 0 - bl GetMonData - adds r4, r0, 0 - lsls r0, r5, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - ldr r1, [r1, 0x8] - adds r2, r5, 0 - adds r3, r4, 0 - bl HandleLoadSpecialPokePic_2 - ldr r0, =gUnknown_0203BD18 - ldr r1, [r0] - b _08179F5E - .pool -_08179E84: - adds r0, r6, 0 - movs r1, 0x41 - bl GetMonData - lsls r0, 16 - lsrs r5, r0, 16 - adds r0, r6, 0 - movs r1, 0 - bl GetMonData - adds r4, r0, 0 - adds r0, r6, 0 - movs r1, 0x1 - bl GetMonData - adds r1, r0, 0 - adds r0, r5, 0 - adds r2, r4, 0 - bl GetMonSpritePalStructFromOtIdPersonality - adds r4, r0, 0 - bl LoadCompressedObjectPalette - ldrh r0, [r4, 0x4] - movs r1, 0x1 - bl sub_806A068 - ldr r0, =gUnknown_0203BD18 - ldr r1, [r0] - b _08179F5E - .pool -_08179EC4: - ldr r0, =gUnknown_085B26F4 - bl LoadCompressedObjectPic - ldr r0, =gUnknown_0203BD18 - ldr r1, [r0] - b _08179F5E - .pool -_08179ED8: - ldr r0, =gUnknown_085B26FC - bl LoadCompressedObjectPalette - ldr r0, =gUnknown_0203BD18 - ldr r1, [r0] - b _08179F5E - .pool -_08179EEC: - ldr r0, =gUnknown_085F06A0 - bl LoadCompressedObjectPic - ldr r0, =gUnknown_0203BD18 - ldr r1, [r0] - b _08179F5E - .pool -_08179F00: - ldr r0, =gSpecialVar_ItemId - ldrb r0, [r0] - bl sub_8179FEC - ldr r0, =gUnknown_0203BD1C - bl LoadCompressedObjectPalette - ldr r0, =gUnknown_0203BD18 - ldr r1, [r0] - b _08179F5E - .pool -_08179F20: - bl reset_temp_tile_data_buffers - ldr r1, =gBattleTerrainTiles_Building - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r0, =gUnknown_0203BD18 - ldr r1, [r0] - b _08179F5E - .pool -_08179F44: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08179FA0 - ldr r0, =gUnknown_08D9BA44 - ldr r4, =gUnknown_0203BD18 - ldr r1, [r4] - adds r1, 0x48 - bl LZDecompressWram - ldr r1, [r4] -_08179F5E: - ldr r0, =0x0000107e - adds r1, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - b _08179FA0 - .pool -_08179F78: - ldr r0, =gBattleTerrainPalette_Frontier - movs r1, 0x20 - movs r2, 0x60 - bl LoadCompressedPalette - ldr r0, =gUnknown_0203BD18 - ldr r0, [r0] - ldr r1, =0x0000107e - adds r0, r1 - movs r1, 0 - strh r1, [r0] - movs r0, 0x1 - b _08179FA2 - .pool -_08179FA0: - movs r0, 0 -_08179FA2: - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8179DF4 - - thumb_func_start sub_8179FAC -sub_8179FAC: @ 8179FAC - push {lr} - ldr r0, =gUnknown_085F0558 - bl InitWindows - bl DeactivateAllTextPrinters - movs r0, 0 - movs r1, 0x1 - movs r2, 0xE0 - bl sub_809882C - ldr r0, =gUnknown_0860F074 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0 - bl PutWindowTilemap - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - pop {r0} - bx r0 - .pool - thumb_func_end sub_8179FAC - - thumb_func_start sub_8179FEC -sub_8179FEC: @ 8179FEC - push {lr} - lsls r0, 24 - ldr r1, =gSaveBlock1Ptr - lsrs r0, 21 - ldr r2, =0x00000848 - adds r0, r2 - ldr r1, [r1] - adds r1, r0 - adds r0, r1, 0 - movs r1, 0 - bl sub_8136F9C - lsls r0, 24 - ldr r2, =gUnknown_0203BD1C - ldr r1, =gUnknown_085F0568 - lsrs r0, 22 - subs r0, 0x4 - adds r0, r1 - ldr r0, [r0] - str r0, [r2] - ldr r0, =0x000039e2 - strh r0, [r2, 0x4] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8179FEC - - thumb_func_start sub_817A030 -sub_817A030: @ 817A030 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0817A044 - b _0817A154 -_0817A044: - ldr r0, =gTasks - lsls r2, r4, 2 - adds r1, r2, r4 - lsls r1, 3 - adds r1, r0 - movs r0, 0x8 - ldrsh r3, [r1, r0] - ldr r0, =0x0000010d - adds r5, r2, 0 - cmp r3, r0 - beq _0817A0C8 - cmp r3, r0 - bgt _0817A074 - cmp r3, 0 - beq _0817A088 - cmp r3, 0xFF - beq _0817A0AC - b _0817A104 - .pool -_0817A074: - ldr r0, =0x00000119 - cmp r3, r0 - beq _0817A0E0 - adds r0, 0x10 - cmp r3, r0 - beq _0817A0F8 - b _0817A104 - .pool -_0817A088: - ldr r0, =gUnknown_0203BD18 - ldr r1, [r0] - ldr r2, =0x00001050 - adds r1, r2 - strb r3, [r1] - ldr r0, [r0] - ldr r1, =0x00001058 - adds r0, r1 - strh r3, [r0] - bl sub_817A5CC - b _0817A104 - .pool -_0817A0AC: - ldr r0, =gUnknown_0203BD18 - ldr r0, [r0] - ldr r2, =0x0000105e - adds r0, r2 - ldrb r0, [r0] - ldrb r1, [r1, 0xA] - bl sub_817A4F8 - b _0817A104 - .pool -_0817A0C8: - bl sub_817A56C - ldr r1, =gUnknown_0203BD18 - ldr r1, [r1] - ldr r2, =0x0000105f - adds r1, r2 - strb r0, [r1] - b _0817A104 - .pool -_0817A0E0: - ldr r0, =gUnknown_0203BD18 - ldr r0, [r0] - ldr r1, =0x0000105d - adds r0, r1 - ldrb r0, [r0] - bl sub_817A434 - b _0817A104 - .pool -_0817A0F8: - ldr r0, =sub_817A1C4 - str r0, [r1] - b _0817A154 - .pool -_0817A104: - ldr r0, =gUnknown_0203BD18 - ldr r0, [r0] - ldr r2, =0x00001058 - adds r1, r0, r2 - subs r2, 0x2 - adds r0, r2 - ldrh r1, [r1] - ldrh r0, [r0] - cmp r1, r0 - bcs _0817A128 - bl sub_817A634 - b _0817A138 - .pool -_0817A128: - cmp r1, r0 - bne _0817A138 - ldr r0, =gTasks - adds r1, r5, r4 - lsls r1, 3 - adds r1, r0 - movs r0, 0xFE - strh r0, [r1, 0x8] -_0817A138: - ldr r0, =gUnknown_0203BD18 - ldr r1, [r0] - ldr r0, =0x00001058 - adds r1, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - ldr r0, =gTasks - adds r1, r5, r4 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_0817A154: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817A030 - - thumb_func_start sub_817A168 -sub_817A168: @ 817A168 - push {lr} - ldr r0, =sub_817A030 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r0, 0 - strh r0, [r1, 0x8] - movs r0, 0x1 - strh r0, [r1, 0xA] - pop {r0} - bx r0 - .pool - thumb_func_end sub_817A168 - - thumb_func_start sub_817A194 -sub_817A194: @ 817A194 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0 - bl sub_8121F20 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1 - beq _0817A1B6 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_817A320 - str r0, [r1] -_0817A1B6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817A194 - - thumb_func_start sub_817A1C4 -sub_817A1C4: @ 817A1C4 - push {r4-r7,lr} - sub sp, 0x10 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gUnknown_0203BC9C - ldrb r1, [r0] - movs r0, 0x64 - adds r5, r1, 0 - muls r5, r0 - ldr r0, =gPlayerParty - adds r5, r0 - ldr r1, =gSaveBlock1Ptr - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - lsls r0, 3 - ldr r2, =0x00000848 - adds r0, r2 - ldr r4, [r1] - adds r4, r0 - adds r0, r5, 0 - bl GetNature - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl PokeblockGetGain - ldr r6, =gUnknown_0203BC9E - strh r0, [r6] - ldr r1, =gStringVar1 - adds r0, r5, 0 - bl GetMonNickname - ldr r1, =gStringVar2 - adds r0, r4, 0 - bl sub_8137044 - movs r1, 0 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _0817A248 - ldr r0, =gStringVar4 - ldr r1, =gText_Var1AteTheVar2 - bl StringExpandPlaceholders - b _0817A268 - .pool -_0817A248: - cmp r0, 0 - ble _0817A260 - ldr r0, =gStringVar4 - ldr r1, =gText_Var1HappilyAteVar2 - bl StringExpandPlaceholders - b _0817A268 - .pool -_0817A260: - ldr r0, =gStringVar4 - ldr r1, =gText_Var1DisdainfullyAteVar2 - bl StringExpandPlaceholders -_0817A268: - ldr r2, =gTextFlags - ldrb r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2] - bl GetPlayerTextSpeed - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - ldr r2, =gStringVar4 - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - bl AddTextPrinterParametrized - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_817A194 - str r1, [r0] - add sp, 0x10 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817A1C4 - - thumb_func_start sub_817A2C0 -sub_817A2C0: @ 817A2C0 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0817A304 - bl ResetSpriteData - bl FreeAllSpritePalettes - ldr r0, =gMPlay_BGM - ldr r1, =0x0000ffff - movs r2, 0x80 - lsls r2, 1 - bl m4aMPlayVolumeControl - ldr r0, =gMain - ldr r0, [r0, 0x8] - bl SetMainCallback2 - adds r0, r4, 0 - bl DestroyTask - bl FreeAllWindowBuffers - ldr r0, =gUnknown_0203BD18 - ldr r0, [r0] - bl Free - bl FreeMonSpritesGfx -_0817A304: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817A2C0 - - thumb_func_start sub_817A320 -sub_817A320: @ 817A320 - 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_817A2C0 - str r1, [r0] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817A320 - - thumb_func_start sub_817A358 -sub_817A358: @ 817A358 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r5, r0, 0 - movs r1, 0x41 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =gUnknown_0202499C - movs r1, 0x30 - movs r2, 0x50 - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r0, =gUnknown_0203BD18 - mov r9, r0 - ldr r0, [r0] - ldr r2, =0x00001054 - adds r1, r0, r2 - strh r4, [r1] - ldr r1, =0x0000105b - adds r0, r1 - mov r2, r8 - strb r2, [r0] - adds r0, r5, 0 - bl GetNature - mov r2, r9 - ldr r1, [r2] - ldr r2, =0x0000105a - adds r1, r2 - strb r0, [r1] - ldr r7, =gSprites - mov r1, r8 - lsls r0, r1, 4 - add r0, r8 - lsls r5, r0, 2 - adds r6, r5, r7 - strh r4, [r6, 0x32] - adds r0, r7, 0 - adds r0, 0x1C - adds r0, r5, r0 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - mov r2, r9 - ldr r0, [r2] - ldr r1, =0x00001053 - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] - adds r0, r4, 0 - bl IsPokeSpriteNotFlipped - lsls r0, 24 - cmp r0, 0 - bne _0817A402 - adds r0, r7, 0 - adds r0, 0x10 - adds r0, r5, r0 - ldr r1, =gUnknown_085F05B0 - str r1, [r0] - ldrb r3, [r6, 0x1] - movs r0, 0x3 - orrs r3, r0 - strb r3, [r6, 0x1] - lsrs r1, r3, 6 - ldrb r2, [r6, 0x3] - lsrs r2, 6 - lsls r3, 30 - lsrs r3, 30 - adds r0, r6, 0 - bl CalcCenterToCornerVec - mov r2, r9 - ldr r0, [r2] - ldr r1, =0x00001053 - adds r0, r1 - movs r1, 0 - strb r1, [r0] -_0817A402: - mov r0, r8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_817A358 - - thumb_func_start sub_817A434 -sub_817A434: @ 817A434 - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r2, r1, r3 - movs r0, 0x30 - strh r0, [r2, 0x20] - movs r0, 0x50 - strh r0, [r2, 0x22] - ldr r0, =0x0000fff8 - strh r0, [r2, 0x2E] - movs r0, 0x1 - strh r0, [r2, 0x30] - adds r3, 0x1C - adds r1, r3 - ldr r0, =sub_817A468 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_817A434 - - thumb_func_start sub_817A468 -sub_817A468: @ 817A468 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x20] - adds r0, 0x4 - strh r0, [r4, 0x20] - ldrh r0, [r4, 0x2E] - ldrh r2, [r4, 0x22] - adds r1, r0, r2 - strh r1, [r4, 0x22] - ldrh r1, [r4, 0x30] - adds r0, r1 - strh r0, [r4, 0x2E] - lsls r0, 16 - cmp r0, 0 - bne _0817A48E - ldrh r0, [r4, 0x32] - movs r1, 0 - bl PlayCry1 -_0817A48E: - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x9 - bne _0817A49A - ldr r0, =SpriteCallbackDummy - str r0, [r4, 0x1C] -_0817A49A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817A468 - - thumb_func_start sub_817A4A4 -sub_817A4A4: @ 817A4A4 - push {r4,r5,lr} - movs r0, 0xBC - movs r1, 0x64 - movs r2, 0x2 - bl sub_8136444 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =gSprites - lsls r3, r4, 4 - adds r3, r4 - lsls r3, 2 - adds r0, r3, r5 - ldrb r2, [r0, 0x1] - movs r1, 0x4 - negs r1, r1 - ands r1, r2 - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0, 0x1] - adds r1, r5, 0 - adds r1, 0x10 - adds r1, r3, r1 - ldr r2, =gUnknown_085F0664 - str r2, [r1] - adds r5, 0x1C - adds r3, r5 - ldr r1, =SpriteCallbackDummy - str r1, [r3] - bl InitSpriteAffineAnim - adds r0, r4, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_817A4A4 - - thumb_func_start sub_817A4F8 -sub_817A4F8: @ 817A4F8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r1, 0 - lsls r0, 24 - lsrs r7, r0, 24 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gSprites - mov r8, r0 - lsls r0, r7, 4 - adds r0, r7 - lsls r6, r0, 2 - mov r0, r8 - adds r4, r6, r0 - ldrb r0, [r4, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - ldrb r0, [r4, 0x1] - movs r1, 0x3 - orrs r0, r1 - strb r0, [r4, 0x1] - cmp r5, 0 - bne _0817A540 - mov r0, r8 - adds r0, 0x10 - adds r0, r6, r0 - ldr r1, =gUnknown_085F0668 - b _0817A548 - .pool -_0817A540: - mov r0, r8 - adds r0, 0x10 - adds r0, r6, r0 - ldr r1, =gUnknown_085F066C -_0817A548: - str r1, [r0] - lsls r0, r7, 4 - adds r0, r7 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl InitSpriteAffineAnim - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817A4F8 - - thumb_func_start sub_817A56C -sub_817A56C: @ 817A56C - push {lr} - ldr r0, =gUnknown_085F06A8 - movs r1, 0xAE - movs r2, 0x54 - movs r3, 0x1 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldr r2, =0x0000fff4 - strh r2, [r1, 0x2E] - movs r2, 0x1 - strh r2, [r1, 0x30] - pop {r1} - bx r1 - .pool - thumb_func_end sub_817A56C - - thumb_func_start sub_817A5A0 -sub_817A5A0: @ 817A5A0 - push {lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x20] - subs r0, 0x4 - strh r0, [r2, 0x20] - ldrh r0, [r2, 0x2E] - ldrh r3, [r2, 0x22] - adds r1, r0, r3 - strh r1, [r2, 0x22] - ldrh r1, [r2, 0x30] - adds r0, r1 - strh r0, [r2, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA - bne _0817A5C6 - adds r0, r2, 0 - bl DestroySprite -_0817A5C6: - pop {r0} - bx r0 - thumb_func_end sub_817A5A0 - - thumb_func_start sub_817A5CC -sub_817A5CC: @ 817A5CC - push {r4-r7,lr} - ldr r0, =gUnknown_0203BD18 - ldr r1, [r0] - ldr r0, =0x00001056 - adds r3, r1, r0 - movs r0, 0x1 - strh r0, [r3] - ldr r2, =gUnknown_085EFEBC - ldr r7, =0x0000105a - adds r1, r7 - ldrb r0, [r1] - lsls r0, 1 - adds r0, r2 - ldrb r2, [r0] - movs r4, 0 - ldr r5, =gUnknown_085EFF00 - adds r6, r5, 0 - subs r6, 0xA -_0817A5F0: - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 2 - adds r0, r1, r6 - ldrh r0, [r0] - ldrh r7, [r3] - adds r0, r7 - strh r0, [r3] - adds r1, r5 - movs r7, 0 - ldrsh r0, [r1, r7] - cmp r0, 0x1 - beq _0817A61A - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r4, 0x7 - bls _0817A5F0 -_0817A61A: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817A5CC - - thumb_func_start sub_817A634 -sub_817A634: @ 817A634 - push {r4,lr} - ldr r0, =gUnknown_0203BD18 - ldr r4, [r0] - ldr r1, =0x00001050 - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0x5A - bls _0817A646 - b _0817A90E -_0817A646: - lsls r0, 2 - ldr r1, =_0817A65C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0817A65C: - .4byte _0817A7C8 - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A818 - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A858 - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A8A2 - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A8FC - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E - .4byte _0817A90E -_0817A7C8: - ldr r1, =gUnknown_085EFEBC - ldr r2, =0x0000105a - adds r0, r4, r2 - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrb r1, [r0] - ldr r3, =0x00001051 - adds r0, r4, r3 - strb r1, [r0] - ldr r1, =0x0000105b - adds r0, r4, r1 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - adds r0, r4, 0 - stm r0!, {r1} - movs r2, 0x44 - bl memcpy - ldr r2, =0x00001050 - adds r1, r4, r2 - movs r0, 0xA - strb r0, [r1] - b _0817A90E - .pool -_0817A818: - bl sub_817A91C - ldr r1, =gUnknown_085EFEBC - ldr r3, =0x0000105a - adds r0, r4, r3 - ldrb r0, [r0] - lsls r0, 1 - adds r1, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0817A850 - ldr r2, [r4] - ldrb r0, [r2, 0x1] - movs r1, 0x3 - orrs r0, r1 - strb r0, [r2, 0x1] - ldr r2, [r4] - ldrb r1, [r2, 0x3] - movs r0, 0x3F - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x3] - ldr r0, [r4] - ldr r1, =gUnknown_085F04FC - str r1, [r0, 0x10] - bl InitSpriteAffineAnim -_0817A850: - ldr r0, =0x00001050 - adds r1, r4, r0 - movs r0, 0x32 - strb r0, [r1] -_0817A858: - ldr r1, =gUnknown_085EFEBC - ldr r2, =0x0000105a - adds r0, r4, r2 - ldrb r0, [r0] - lsls r0, 1 - adds r1, 0x1 - adds r2, r0, r1 - ldrb r1, [r2] - cmp r1, 0 - beq _0817A8C8 - ldr r3, =0x00001053 - adds r0, r4, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _0817A898 - ldr r0, [r4] - adds r1, 0xA - lsls r1, 24 - lsrs r1, 24 - bl StartSpriteAffineAnim - b _0817A8C8 - .pool -_0817A898: - ldr r0, [r4] - ldrb r1, [r2] - bl StartSpriteAffineAnim - b _0817A8C8 -_0817A8A2: - bl sub_817A9E4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0817A90E - ldr r1, =0x00001072 - adds r0, r4, r1 - movs r2, 0 - ldrsh r0, [r0, r2] - cmp r0, 0 - bne _0817A8E0 - ldr r3, =0x00001051 - adds r1, r4, r3 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - bl sub_817A91C -_0817A8C8: - ldr r0, =0x00001050 - adds r1, r4, r0 - movs r0, 0x3C - strb r0, [r1] - b _0817A90E - .pool -_0817A8E0: - ldr r0, [r4] - ldrb r0, [r0, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - ldr r2, =0x00001050 - adds r1, r4, r2 - movs r0, 0x46 - strb r0, [r1] - b _0817A90E - .pool -_0817A8FC: - bl sub_817AA3C - ldr r3, =0x00001051 - adds r0, r4, r3 - movs r1, 0 - strb r1, [r0] - ldr r2, =0x00001050 - adds r0, r4, r2 - strb r1, [r0] -_0817A90E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817A634 - - thumb_func_start sub_817A91C -sub_817A91C: @ 817A91C - push {r4-r7,lr} - ldr r0, =gUnknown_0203BD18 - ldr r5, [r0] - movs r4, 0 - movs r0, 0x83 - lsls r0, 5 - adds r7, r5, r0 - ldr r1, =gUnknown_085EFEEE - mov r12, r1 - ldr r2, =0x00001051 - adds r6, r5, r2 -_0817A932: - lsls r2, r4, 1 - adds r3, r7, r2 - ldrb r1, [r6] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 2 - adds r2, r0 - add r2, r12 - ldrh r0, [r2] - strh r0, [r3] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x9 - bls _0817A932 - ldr r0, =0x00001068 - adds r6, r5, r0 - movs r1, 0 - ldrsh r0, [r6, r1] - cmp r0, 0 - beq _0817A9DC - movs r2, 0x83 - lsls r2, 5 - adds r4, r5, r2 - movs r1, 0 - ldrsh r0, [r4, r1] - adds r2, 0x4 - adds r1, r5, r2 - movs r2, 0 - ldrsh r1, [r1, r2] - bl Sin - ldr r2, =0x00001074 - adds r1, r5, r2 - strh r0, [r1] - movs r1, 0 - ldrsh r0, [r4, r1] - subs r2, 0xE - adds r1, r5, r2 - movs r2, 0 - ldrsh r1, [r1, r2] - bl Cos - ldr r2, =0x00001076 - adds r1, r5, r2 - strh r0, [r1] - ldrh r0, [r6] - ldr r1, =0x00001078 - adds r4, r5, r1 - strh r0, [r4] - ldr r0, [r5] - ldrh r1, [r0, 0x24] - adds r2, 0x4 - adds r0, r5, r2 - strh r1, [r0] - ldr r0, [r5] - ldrh r1, [r0, 0x26] - adds r2, 0x2 - adds r0, r5, r2 - strh r1, [r0] - bl sub_817AB68 - ldrh r0, [r4] - strh r0, [r6] - bl sub_817AA54 - ldrh r0, [r4] - strh r0, [r6] - movs r0, 0 - b _0817A9DE - .pool -_0817A9DC: - movs r0, 0x1 -_0817A9DE: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_817A91C - - thumb_func_start sub_817A9E4 -sub_817A9E4: @ 817A9E4 - push {r4,r5,lr} - ldr r0, =gUnknown_0203BD18 - ldr r2, [r0] - ldr r1, =0x00001078 - adds r0, r2, r1 - ldr r5, =0x00001068 - adds r4, r2, r5 - ldrh r1, [r0] - ldrh r0, [r4] - subs r1, r0 - lsls r1, 16 - ldr r3, [r2] - lsrs r1, 15 - movs r5, 0x85 - lsls r5, 4 - adds r0, r2, r5 - adds r0, r1 - ldrh r0, [r0] - strh r0, [r3, 0x24] - ldr r3, [r2] - movs r0, 0xC5 - lsls r0, 4 - adds r2, r0 - adds r2, r1 - ldrh r0, [r2] - strh r0, [r3, 0x26] - ldrh r0, [r4] - subs r0, 0x1 - strh r0, [r4] - lsls r0, 16 - cmp r0, 0 - beq _0817AA34 - movs r0, 0 - b _0817AA36 - .pool -_0817AA34: - movs r0, 0x1 -_0817AA36: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_817A9E4 - - thumb_func_start sub_817AA3C -sub_817AA3C: @ 817AA3C - push {lr} - ldr r0, =gUnknown_0203BD18 - ldr r0, [r0] - ldr r0, [r0] - bl FreeSpriteOamMatrix - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_817AA3C - - thumb_func_start sub_817AA54 -sub_817AA54: @ 817AA54 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - ldr r0, =gUnknown_0203BD18 - ldr r7, [r0] - ldr r1, =0x00001070 - adds r0, r7, r1 - ldrh r0, [r0] - mov r9, r0 - ldr r2, =0x00001078 - adds r0, r7, r2 - ldrh r0, [r0] - mov r3, r9 - subs r0, r3 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - ldr r4, =0x0000107a - adds r1, r7, r4 - subs r2, 0xC - adds r0, r7, r2 - ldrh r0, [r0] - ldrh r1, [r1] - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp] - ldr r3, =0x0000107c - adds r1, r7, r3 - subs r4, 0xC - adds r0, r7, r4 - ldrh r0, [r0] - ldrh r1, [r1] - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0x4] - movs r5, 0 - mov r0, r8 - subs r0, 0x1 - cmp r5, r0 - bge _0817AB20 - ldr r1, [sp] - lsls r0, r1, 16 - asrs r0, 16 - str r0, [sp, 0x8] - ldr r2, [sp, 0x4] - lsls r0, r2, 16 - asrs r0, 16 - mov r10, r0 -_0817AABE: - mov r3, r9 - adds r0, r3, r5 - lsls r0, 1 - movs r4, 0x85 - lsls r4, 4 - adds r2, r7, r4 - adds r2, r0 - ldrh r6, [r2] - ldr r3, [sp, 0x8] - subs r1, r6, r3 - movs r4, 0xC5 - lsls r4, 4 - adds r3, r7, r4 - adds r3, r0 - ldrh r4, [r3] - mov r0, r10 - subs r4, r0 - lsls r4, 16 - lsrs r4, 16 - lsls r1, 16 - asrs r1, 16 - adds r5, 0x1 - adds r0, r1, 0 - muls r0, r5 - mov r1, r8 - str r2, [sp, 0xC] - str r3, [sp, 0x10] - bl __divsi3 - subs r6, r0 - ldr r2, [sp, 0xC] - strh r6, [r2] - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - muls r0, r5 - mov r1, r8 - bl __divsi3 - ldr r3, [sp, 0x10] - ldrh r1, [r3] - subs r1, r0 - strh r1, [r3] - lsls r5, 16 - lsrs r5, 16 - mov r0, r8 - subs r0, 0x1 - cmp r5, r0 - blt _0817AABE -_0817AB20: - mov r0, r9 - add r0, r8 - subs r0, 0x1 - lsls r0, 1 - movs r2, 0x85 - lsls r2, 4 - adds r1, r7, r2 - adds r1, r0 - mov r3, sp - ldrh r3, [r3] - strh r3, [r1] - movs r4, 0xC5 - lsls r4, 4 - adds r1, r7, r4 - adds r1, r0 - mov r0, sp - ldrh r0, [r0, 0x4] - strh r0, [r1] - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_817AA54 - - thumb_func_start sub_817AB68 -sub_817AB68: @ 817AB68 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - ldr r0, =gUnknown_0203BD18 - ldr r6, [r0] - movs r0, 0 - str r0, [sp] - ldr r1, =0x0000107a - adds r0, r6, r1 - ldr r2, =0x00001074 - adds r1, r6, r2 - ldrh r2, [r0] - ldrh r0, [r1] - subs r2, r0 - ldr r3, =0x0000107c - adds r0, r6, r3 - ldr r1, =0x00001076 - adds r3, r6, r1 - ldrh r1, [r0] - ldrh r0, [r3] - subs r1, r0 - ldr r3, =0x00001068 - adds r3, r6 - mov r9, r3 - movs r0, 0x83 - lsls r0, 5 - adds r0, r6 - mov r8, r0 - lsls r2, 16 - asrs r2, 16 - str r2, [sp, 0x4] - lsls r1, 16 - asrs r1, 16 - mov r10, r1 -_0817ABB2: - ldr r1, =0x0000106a - adds r0, r6, r1 - movs r2, 0 - ldrsh r0, [r0, r2] - cmp r0, 0 - bge _0817ABC0 - negs r0, r0 -_0817ABC0: - lsls r0, 16 - ldr r3, =0x00001066 - adds r7, r6, r3 - lsrs r0, 16 - ldrh r1, [r7] - adds r0, r1 - lsls r4, r0, 16 - strh r0, [r7] - ldr r2, =0x00001064 - adds r0, r6, r2 - ldrh r2, [r0] - movs r3, 0 - ldrsh r0, [r0, r3] - cmp r0, 0 - bge _0817ABE2 - movs r0, 0x1 - str r0, [sp] -_0817ABE2: - ldr r1, =0x00001078 - adds r0, r6, r1 - ldrh r0, [r0] - mov r3, r9 - ldrh r1, [r3] - subs r0, r1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r1, 0 - beq _0817ACB8 - ldr r0, [sp] - cmp r0, 0 - bne _0817AC54 - mov r1, r8 - movs r3, 0 - ldrsh r0, [r1, r3] - lsrs r4, 24 - adds r1, r2, r4 - lsls r1, 16 - asrs r1, 16 - bl Sin - lsls r5, 1 - movs r2, 0x85 - lsls r2, 4 - adds r1, r6, r2 - adds r1, r5 - ldr r3, [sp, 0x4] - adds r0, r3, r0 - strh r0, [r1] - mov r1, r8 - movs r2, 0 - ldrsh r0, [r1, r2] - ldrh r1, [r7] - adds r1, r4 - b _0817AC80 - .pool -_0817AC54: - mov r1, r8 - movs r3, 0 - ldrsh r0, [r1, r3] - lsrs r4, 24 - subs r1, r2, r4 - lsls r1, 16 - asrs r1, 16 - bl Sin - lsls r5, 1 - movs r2, 0x85 - lsls r2, 4 - adds r1, r6, r2 - adds r1, r5 - ldr r3, [sp, 0x4] - adds r0, r3, r0 - strh r0, [r1] - mov r1, r8 - movs r2, 0 - ldrsh r0, [r1, r2] - ldrh r1, [r7] - subs r1, r4 -_0817AC80: - lsls r1, 16 - asrs r1, 16 - bl Cos - movs r3, 0xC5 - lsls r3, 4 - adds r1, r6, r3 - adds r1, r5 - add r0, r10 - strh r0, [r1] - ldr r1, =0x00001062 - adds r0, r6, r1 - ldrh r0, [r0] - mov r2, r8 - ldrh r2, [r2] - adds r0, r2 - movs r1, 0xFF - ands r0, r1 - mov r3, r8 - strh r0, [r3] - mov r1, r9 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - b _0817ABB2 - .pool -_0817ACB8: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_817AB68 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index 91fd35c1f..5ae458d6d 100755 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -2351,7 +2351,7 @@ _081C51D6: thumb_func_start sub_81C51DC sub_81C51DC: @ 81C51DC push {lr} - bl sub_8121DA0 + bl ResetVramOamAndBgCntRegs movs r0, 0 bl ResetBgsAndClearDma3BusyFlags ldr r1, =gUnknown_0861F2B4 @@ -2363,7 +2363,7 @@ sub_81C51DC: @ 81C51DC adds r1, 0x4 movs r0, 0x2 bl SetBgTilemapBuffer - bl sub_8121E10 + bl ResetAllBgsCoordinates movs r0, 0x2 bl schedule_bg_copy_tilemap_to_vram movs r1, 0x82 @@ -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 8b38def62..de7b93c5f 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/rayquaza_scene.s b/asm/rayquaza_scene.s index f9936f1ca..58380a354 100755 --- a/asm/rayquaza_scene.s +++ b/asm/rayquaza_scene.s @@ -1066,7 +1066,7 @@ sub_81D6FD0: @ 81D6FD0 thumb_func_start sub_81D6FE0 sub_81D6FE0: @ 81D6FE0 push {r4,lr} - bl sub_8121DA0 + bl ResetVramOamAndBgCntRegs movs r0, 0 bl ResetBgsAndClearDma3BusyFlags ldr r1, =gUnknown_0862A888 @@ -1088,7 +1088,7 @@ sub_81D6FE0: @ 81D6FE0 adds r1, r0 movs r0, 0x2 bl SetBgTilemapBuffer - bl sub_8121E10 + bl ResetAllBgsCoordinates movs r0, 0 bl schedule_bg_copy_tilemap_to_vram movs r0, 0x1 @@ -2758,7 +2758,7 @@ _081D7E08: thumb_func_start sub_81D7E10 sub_81D7E10: @ 81D7E10 push {r4,lr} - bl sub_8121DA0 + bl ResetVramOamAndBgCntRegs movs r0, 0 bl ResetBgsAndClearDma3BusyFlags ldr r1, =gUnknown_0862AA54 @@ -2780,7 +2780,7 @@ sub_81D7E10: @ 81D7E10 adds r1, r0 movs r0, 0x2 bl SetBgTilemapBuffer - bl sub_8121E10 + bl ResetAllBgsCoordinates movs r0, 0 bl schedule_bg_copy_tilemap_to_vram movs r0, 0x1 @@ -3292,7 +3292,7 @@ _081D829A: thumb_func_start sub_81D82B0 sub_81D82B0: @ 81D82B0 push {r4,lr} - bl sub_8121DA0 + bl ResetVramOamAndBgCntRegs movs r0, 0 bl ResetBgsAndClearDma3BusyFlags ldr r1, =gUnknown_0862AACC @@ -3319,7 +3319,7 @@ sub_81D82B0: @ 81D82B0 adds r1, r0 movs r0, 0x3 bl SetBgTilemapBuffer - bl sub_8121E10 + bl ResetAllBgsCoordinates movs r0, 0 bl schedule_bg_copy_tilemap_to_vram movs r0, 0x1 @@ -3899,7 +3899,7 @@ _081D8818: thumb_func_start sub_81D8828 sub_81D8828: @ 81D8828 push {r4,lr} - bl sub_8121DA0 + bl ResetVramOamAndBgCntRegs movs r0, 0 bl ResetBgsAndClearDma3BusyFlags ldr r1, =gUnknown_0862AB44 @@ -3926,7 +3926,7 @@ sub_81D8828: @ 81D8828 adds r1, r0 movs r0, 0x3 bl SetBgTilemapBuffer - bl sub_8121E10 + bl ResetAllBgsCoordinates movs r0, 0 bl schedule_bg_copy_tilemap_to_vram movs r0, 0x1 @@ -4354,7 +4354,7 @@ _081D8C26: thumb_func_start sub_81D8C38 sub_81D8C38: @ 81D8C38 push {r4,lr} - bl sub_8121DA0 + bl ResetVramOamAndBgCntRegs movs r0, 0 bl ResetBgsAndClearDma3BusyFlags ldr r1, =gUnknown_0862AD08 @@ -4376,7 +4376,7 @@ sub_81D8C38: @ 81D8C38 adds r1, r0 movs r0, 0x2 bl SetBgTilemapBuffer - bl sub_8121E10 + bl ResetAllBgsCoordinates movs r0, 0 bl schedule_bg_copy_tilemap_to_vram movs r0, 0x1 diff --git a/asm/rom6.s b/asm/rom6.s index f2fabec35..e3145fb8a 100644 --- a/asm/rom6.s +++ b/asm/rom6.s @@ -447,12330 +447,5 @@ _081357EE: bx r0 .pool thumb_func_end sub_81357BC - - thumb_func_start sub_81357FC -sub_81357FC: @ 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, =gUnknown_085B269B - 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, =gUnknown_085B269D - 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, =gUnknown_085B269F - 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, =gUnknown_085B2698 - 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 sub_81357FC - - thumb_func_start sub_81358F4 -sub_81358F4: @ 81358F4 - push {lr} - ldr r1, =SetCB2ToReshowScreenAfterMenu2 - movs r0, 0x1 - bl sub_81357FC - 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 sub_81357FC - 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 sub_8136444 - 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 sub_8121DA0 - 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 sub_8121E10 - 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, =gUnknown_08D9B2B4 - 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, =gUnknown_08D9B7C8 - ldr r4, =gUnknown_0203AB50 - ldr r1, [r4] - bl LZDecompressWram - ldr r1, [r4] - b _08135CE2 - .pool -_08135CBC: - ldr r0, =gUnknown_08D9B470 - movs r1, 0 - movs r2, 0xC0 - bl LoadCompressedPalette - b _08135CDE - .pool -_08135CCC: - ldr r0, =gUnknown_085B26F4 - bl LoadCompressedObjectPic - b _08135CDE - .pool -_08135CD8: - ldr r0, =gUnknown_085B26FC - 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, =gUnknown_085B271C - 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 sub_8136F9C - 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 sub_8136444 -sub_8136444: @ 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, =gUnknown_085B2704 - 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 sub_8136444 - - 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, =gUnknown_085B26F0 - 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 - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - ldr r0, =gUnknown_0203AB50 - ldr r0, [r0] - ldr r1, =0x00000808 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x3 - bne _08136968 - movs r0, 0x8 - b _0813696A - .pool -_08136968: - movs r0, 0x9 -_0813696A: - strh r0, [r6, 0x2] - bl sub_8136418 - ldrb r0, [r6, 0x2] - movs r1, 0 - movs r2, 0x1 - movs r3, 0xE - bl SetWindowBorderStyle - ldrb r0, [r6, 0x2] - ldr r5, =gUnknown_0203AB50 - ldr r3, [r5] - ldr r4, =0x00000808 - adds r1, r3, r4 - ldrb r1, [r1] - ldr r2, =gUnknown_085B2668 - mov r12, r2 - ldr r2, =0x00000804 - adds r3, r2 - ldr r3, [r3] - mov r2, r12 - bl sub_81995E4 - ldrb r0, [r6, 0x2] - ldr r1, [r5] - adds r1, r4 - ldrb r1, [r1] - movs r2, 0 - bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed - ldrb r0, [r6, 0x2] - bl PutWindowTilemap - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81369E0 - str r1, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8136938 - - thumb_func_start sub_81369E0 -sub_81369E0: @ 81369E0 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r6, r5, 0 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08136A3C - bl ProcessMenuInputNoWrapAround - lsls r0, 24 - asrs r4, r0, 24 - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _08136A3C - adds r0, 0x1 - cmp r4, r0 - bne _08136A18 - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - bl sub_8136DE8 - b _08136A3C -_08136A18: - movs r0, 0x5 - bl PlaySE - ldr r1, =gUnknown_085B2668 - ldr r0, =gUnknown_0203AB50 - ldr r0, [r0] - ldr r2, =0x00000804 - adds r0, r2 - ldr r0, [r0] - adds r0, r4 - ldrb r0, [r0] - lsls r0, 3 - adds r1, 0x4 - adds r0, r1 - ldr r1, [r0] - adds r0, r6, 0 - bl _call_via_r1 -_08136A3C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81369E0 - - thumb_func_start sub_8136A50 -sub_8136A50: @ 8136A50 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203AB50 - ldr r1, [r1] - movs r2, 0x80 - lsls r2, 4 - adds r1, r2 - ldr r2, =sub_8136A74 - str r2, [r1] - bl sub_81364EC - pop {r0} - bx r0 - .pool - thumb_func_end sub_8136A50 - - thumb_func_start sub_8136A74 -sub_8136A74: @ 8136A74 - push {lr} - ldr r2, =gSaveBlock1Ptr - ldr r0, =gSpecialVar_ItemId - ldrh r1, [r0] - lsls r1, 3 - ldr r0, =0x00000848 - adds r1, r0 - ldr r0, [r2] - adds r0, r1 - ldr r1, =sub_8136AA0 - bl sub_8166204 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8136A74 - - thumb_func_start sub_8136AA0 -sub_8136AA0: @ 8136AA0 - push {lr} - ldr r0, =gUnknown_0203AB48 - ldr r1, [r0] - movs r0, 0 - bl sub_81357FC - pop {r0} - bx r0 - .pool - thumb_func_end sub_8136AA0 - - thumb_func_start sub_8136AB4 -sub_8136AB4: @ 8136AB4 - push {r4,r5,lr} - sub sp, 0x10 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r0, r1 - ldrb r0, [r0, 0x2] - movs r1, 0 - bl sub_8198070 - ldr r0, =gStringVar1 - ldr r3, =gPokeblockNames - ldr r1, =gSaveBlock1Ptr - ldr r2, [r1] - ldr r1, =gSpecialVar_ItemId - ldrh r1, [r1] - lsls r1, 3 - adds r2, r1 - ldr r1, =0x00000848 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 2 - adds r1, r3 - ldr r1, [r1] - bl StringCopy - ldr r5, =gStringVar4 - ldr r1, =gText_ThrowAwayVar1 - adds r0, r5, 0 - bl StringExpandPlaceholders - bl GetPlayerTextSpeed - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - str r1, [sp] - str r0, [sp, 0x4] - str r5, [sp, 0x8] - ldr r0, =sub_8136B48 - str r0, [sp, 0xC] - adds r0, r4, 0 - movs r1, 0xA - movs r2, 0xA - movs r3, 0xD - bl DisplayMessageAndContinueTask - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8136AB4 - - thumb_func_start sub_8136B48 -sub_8136B48: @ 8136B48 - push {lr} - sub sp, 0x10 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_085B27A8 - movs r2, 0x2 - str r2, [sp] - movs r2, 0x1 - str r2, [sp, 0x4] - movs r2, 0xE - str r2, [sp, 0x8] - ldr r2, =gUnknown_085B26A4 - str r2, [sp, 0xC] - movs r2, 0x1 - movs r3, 0 - bl CreateYesNoMenuWithCallbacks - add sp, 0x10 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8136B48 - - thumb_func_start sub_8136B78 -sub_8136B78: @ 8136B78 - push {r4,r5,lr} - sub sp, 0x10 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =gStringVar4 - ldr r1, =gText_Var1ThrownAway - adds r0, r5, 0 - bl StringExpandPlaceholders - bl GetPlayerTextSpeed - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - str r1, [sp] - str r0, [sp, 0x4] - str r5, [sp, 0x8] - ldr r0, =sub_8136BC0 - str r0, [sp, 0xC] - adds r0, r4, 0 - movs r1, 0xA - movs r2, 0xA - movs r3, 0xD - bl DisplayMessageAndContinueTask - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8136B78 - - thumb_func_start sub_8136BC0 -sub_8136BC0: @ 8136BC0 - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _08136C36 - ldr r0, =gSpecialVar_ItemId - ldrb r0, [r0] - bl sub_8136F68 - movs r0, 0x5 - bl PlaySE - ldr r5, =gUnknown_0203AB4E - subs r6, r5, 0x2 - lsls r4, r7, 2 - adds r4, r7 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - ldrb r0, [r4] - adds r1, r5, 0 - adds r2, r6, 0 - bl sub_81AE6C8 - ldrh r0, [r6] - movs r1, 0x5 - bl sub_8136110 - bl sub_813625C - bl sub_81362E0 - bl sub_8135E2C - ldr r0, =gUnknown_03006310 - ldrh r1, [r5] - ldrh r2, [r6] - bl ListMenuInit - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4] - ldrh r0, [r6] - ldr r1, =0x00001005 - bl sub_8136110 - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - adds r0, r7, 0 - bl sub_8136C54 -_08136C36: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8136BC0 - - thumb_func_start sub_8136C54 -sub_8136C54: @ 8136C54 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0xA - movs r1, 0 - bl sub_8197DF8 - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - bl sub_81363BC - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81365C8 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8136C54 - - thumb_func_start sub_8136C8C -sub_8136C8C: @ 8136C8C - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r0, =gEnemyParty - bl GetNature - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gSaveBlock1Ptr - ldr r7, =gSpecialVar_ItemId - ldrh r2, [r7] - lsls r2, 3 - ldr r6, =0x00000848 - adds r2, r6 - ldr r1, [r5] - adds r1, r2 - bl PokeblockGetGain - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =gBattleTextBuff1 - ldr r3, =gPokeblockNames - ldr r2, [r5] - ldrh r1, [r7] - lsls r1, 3 - adds r2, r1 - adds r2, r6 - ldrb r1, [r2] - lsls r1, 2 - adds r1, r3 - ldr r1, [r1] - bl StringCopy - ldrb r0, [r7] - bl sub_8136F68 - ldr r1, [r5] - ldrh r0, [r7] - lsls r0, 3 - adds r1, r0 - adds r1, r6 - ldrb r0, [r1] - lsls r0, 8 - strh r0, [r7] - lsls r4, 16 - asrs r4, 16 - cmp r4, 0 - bne _08136D10 - adds r0, 0x1 - b _08136D1A - .pool -_08136D10: - cmp r4, 0 - ble _08136D18 - adds r0, 0x2 - b _08136D1A -_08136D18: - adds r0, 0x3 -_08136D1A: - strh r0, [r7] - mov r0, r8 - bl sub_81364EC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8136C8C - - thumb_func_start sub_8136D2C -sub_8136D2C: @ 8136D2C - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =gSpecialVar_ItemId - ldrb r0, [r5] - bl SafariZoneActivatePokeblockFeeder - ldr r0, =gStringVar1 - ldr r3, =gPokeblockNames - ldr r1, =gSaveBlock1Ptr - ldr r2, [r1] - ldrh r1, [r5] - lsls r1, 3 - adds r2, r1 - ldr r1, =0x00000848 - adds r2, r1 - ldrb r1, [r2] - lsls r1, 2 - adds r1, r3 - ldr r1, [r1] - bl StringCopy - ldr r1, =gSpecialVar_Result - ldrh r0, [r5] - strh r0, [r1] - lsls r0, 24 - lsrs r0, 24 - bl sub_8136F68 - movs r0, 0 - strh r0, [r5] - adds r0, r4, 0 - bl sub_81364EC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8136D2C - - thumb_func_start sub_8136D90 -sub_8136D90: @ 8136D90 - push {r4-r6,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r6, =gSpecialVar_0x8004 - ldr r0, =gSaveBlock1Ptr - ldr r5, =gSpecialVar_ItemId - ldrh r1, [r5] - lsls r1, 3 - ldr r2, =0x00000848 - adds r1, r2 - ldr r0, [r0] - adds r0, r1 - bl sub_818E704 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6] - ldr r1, =gSpecialVar_Result - ldrh r0, [r5] - strh r0, [r1] - lsls r0, 24 - lsrs r0, 24 - bl sub_8136F68 - movs r0, 0 - strh r0, [r5] - adds r0, r4, 0 - bl sub_81364EC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8136D90 - - thumb_func_start sub_8136DE8 -sub_8136DE8: @ 8136DE8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r5, =gTasks + 0x8 - adds r0, r4, r5 - ldrb r0, [r0, 0x2] - movs r1, 0 - bl sub_8198070 - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - bl sub_81363BC - subs r5, 0x8 - adds r4, r5 - ldr r0, =sub_81365C8 - str r0, [r4] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8136DE8 - - thumb_func_start sub_8136E20 -sub_8136E20: @ 8136E20 - push {r4,lr} - lsls r0, 24 - ldr r3, =gSaveBlock1Ptr - ldr r1, [r3] - lsrs r0, 21 - adds r1, r0 - ldr r2, =0x00000848 - adds r1, r2 - movs r2, 0 - strb r2, [r1] - ldr r1, [r3] - adds r1, r0 - ldr r4, =0x00000849 - adds r1, r4 - strb r2, [r1] - ldr r1, [r3] - adds r1, r0 - adds r4, 0x1 - adds r1, r4 - strb r2, [r1] - ldr r1, [r3] - adds r1, r0 - adds r4, 0x1 - adds r1, r4 - strb r2, [r1] - ldr r1, [r3] - adds r1, r0 - adds r4, 0x1 - adds r1, r4 - strb r2, [r1] - ldr r1, [r3] - adds r1, r0 - adds r4, 0x1 - adds r1, r4 - strb r2, [r1] - ldr r1, [r3] - adds r1, r0 - ldr r0, =0x0000084e - adds r1, r0 - strb r2, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8136E20 - - thumb_func_start ClearPokeblocks -ClearPokeblocks: @ 8136E88 - push {r4,lr} - movs r4, 0 -_08136E8C: - adds r0, r4, 0 - bl sub_8136E20 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x27 - bls _08136E8C - pop {r4} - pop {r0} - bx r0 - thumb_func_end ClearPokeblocks - - thumb_func_start GetHighestPokeblocksFlavorLevel -GetHighestPokeblocksFlavorLevel: @ 8136EA4 - push {r4-r6,lr} - adds r6, r0, 0 - movs r1, 0x1 - bl sub_8136F9C - lsls r0, 24 - lsrs r5, r0, 24 - movs r1, 0x1 -_08136EB4: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r6, 0 - adds r1, r4, 0 - bl sub_8136F9C - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - bcs _08136ECC - adds r5, r0, 0 -_08136ECC: - adds r1, r4, 0 - cmp r1, 0x4 - bls _08136EB4 - adds r0, r5, 0 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end GetHighestPokeblocksFlavorLevel - - thumb_func_start GetPokeblocksFeel -GetPokeblocksFeel: @ 8136EDC - push {lr} - movs r1, 0x6 - bl sub_8136F9C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x63 - bls _08136EEE - movs r0, 0x63 -_08136EEE: - pop {r1} - bx r1 - thumb_func_end GetPokeblocksFeel - - thumb_func_start GetFirstFreePokeblockSlot -GetFirstFreePokeblockSlot: @ 8136EF4 - push {lr} - movs r1, 0 - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldr r3, =0x00000848 -_08136EFE: - lsls r0, r1, 3 - adds r0, r2, r0 - adds r0, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _08136F18 - lsls r0, r1, 24 - asrs r0, 24 - b _08136F26 - .pool -_08136F18: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x27 - bls _08136EFE - movs r0, 0x1 - negs r0, r0 -_08136F26: - pop {r1} - bx r1 - thumb_func_end GetFirstFreePokeblockSlot - - thumb_func_start AddPokeblock -AddPokeblock: @ 8136F2C - push {r4,lr} - adds r4, r0, 0 - bl GetFirstFreePokeblockSlot - lsls r0, 24 - asrs r1, r0, 24 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08136F60 - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - lsls r0, r1, 3 - ldr r1, =0x00000848 - adds r2, r1 - adds r2, r0 - ldr r0, [r4] - ldr r1, [r4, 0x4] - str r0, [r2] - str r1, [r2, 0x4] - movs r0, 0x1 - b _08136F62 - .pool -_08136F60: - movs r0, 0 -_08136F62: - pop {r4} - pop {r1} - bx r1 - thumb_func_end AddPokeblock - - thumb_func_start sub_8136F68 -sub_8136F68: @ 8136F68 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - lsls r1, r2, 3 - adds r0, r1 - ldr r1, =0x00000848 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _08136F94 - adds r0, r2, 0 - bl sub_8136E20 - movs r0, 0x1 - b _08136F96 - .pool -_08136F94: - movs r0, 0 -_08136F96: - pop {r1} - bx r1 - thumb_func_end sub_8136F68 - - thumb_func_start sub_8136F9C -sub_8136F9C: @ 8136F9C - push {lr} - lsls r1, 24 - lsrs r1, 24 - adds r2, r1, 0 - cmp r1, 0 - bne _08136FAC - ldrb r0, [r0] - b _08136FDE -_08136FAC: - cmp r1, 0x1 - bne _08136FB4 - ldrb r0, [r0, 0x1] - b _08136FDE -_08136FB4: - cmp r1, 0x2 - bne _08136FBC - ldrb r0, [r0, 0x2] - b _08136FDE -_08136FBC: - cmp r1, 0x3 - bne _08136FC4 - ldrb r0, [r0, 0x3] - b _08136FDE -_08136FC4: - cmp r1, 0x4 - bne _08136FCC - ldrb r0, [r0, 0x4] - b _08136FDE -_08136FCC: - cmp r1, 0x5 - bne _08136FD4 - ldrb r0, [r0, 0x5] - b _08136FDE -_08136FD4: - cmp r2, 0x6 - beq _08136FDC - movs r0, 0 - b _08136FDE -_08136FDC: - ldrb r0, [r0, 0x6] -_08136FDE: - pop {r1} - bx r1 - thumb_func_end sub_8136F9C - - thumb_func_start PokeblockGetGain -PokeblockGetGain: @ 8136FE4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - mov r8, r1 - lsls r0, 24 - lsrs r0, 24 - movs r6, 0 - movs r4, 0 - ldr r1, =gPokeblockFlavorCompatibilityTable - mov r9, r1 - lsls r1, r0, 2 - adds r7, r1, r0 -_08136FFE: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - mov r0, r8 - adds r1, r5, 0 - bl sub_8136F9C - lsls r0, 16 - asrs r1, r0, 16 - cmp r1, 0 - ble _0813702A - adds r0, r7, r4 - add r0, r9 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - muls r1, r0 - lsls r0, r6, 16 - asrs r0, 16 - adds r0, r1 - lsls r0, 16 - lsrs r6, r0, 16 -_0813702A: - adds r4, r5, 0 - cmp r4, 0x4 - bls _08136FFE - lsls r0, r6, 16 - asrs r0, 16 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end PokeblockGetGain - - thumb_func_start sub_8137044 -sub_8137044: @ 8137044 - push {r4,lr} - adds r4, r1, 0 - movs r1, 0 - bl sub_8136F9C - lsls r0, 24 - ldr r1, =gPokeblockNames - lsrs r0, 22 - adds r0, r1 - ldr r1, [r0] - adds r0, r4, 0 - bl StringCopy - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8137044 - - thumb_func_start sub_8137068 -sub_8137068: @ 8137068 - push {r4-r7,lr} - adds r6, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 - ldr r7, =gPokeblockNames -_08137074: - lsls r1, r4, 3 - ldr r0, =gUnknown_085B2720 - adds r1, r0 - adds r0, r5, 0 - bl PokeblockGetGain - lsls r0, 16 - cmp r0, 0 - ble _081370A0 - adds r0, r4, 0x1 - lsls r0, 2 - adds r0, r7 - ldr r1, [r0] - adds r0, r6, 0 - bl StringCopy - movs r0, 0x1 - b _081370AC - .pool -_081370A0: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x4 - bls _08137074 - movs r0, 0 -_081370AC: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8137068 - - thumb_func_start GetPokeblocksFlavor -GetPokeblocksFlavor: @ 81370B4 - push {r4-r7,lr} - adds r5, r0, 0 - movs r7, 0 - movs r6, 0 -_081370BC: - adds r1, r7, 0x1 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl sub_8136F9C - adds r4, r0, 0 - adds r1, r6, 0x1 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl sub_8136F9C - lsls r4, 16 - lsls r0, 16 - lsls r1, r6, 16 - cmp r4, r0 - bge _081370E2 - lsrs r7, r1, 16 -_081370E2: - movs r2, 0x80 - lsls r2, 9 - adds r0, r1, r2 - lsrs r6, r0, 16 - asrs r0, 16 - cmp r0, 0x4 - ble _081370BC - lsls r0, r7, 24 - lsrs r0, 24 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end GetPokeblocksFlavor - - thumb_func_start sub_81370FC -sub_81370FC: @ 81370FC - push {r4,lr} - bl ShouldDoBrailleFlyEffect - lsls r0, 24 - cmp r0, 0 - beq _08137134 - ldr r4, =gSpecialVar_Result - bl GetCursorSelectionMonId - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4] - ldr r1, =gUnknown_03005DB0 - ldr r0, =hm_add_c3_launch_phase_2 - str r0, [r1] - ldr r1, =gUnknown_0203CEEC - ldr r0, =sub_8179918 - b _08137152 - .pool -_08137134: - ldr r0, =gMapHeader - ldrb r0, [r0, 0x15] - cmp r0, 0x1 - bne _08137170 - ldr r0, =0x00000888 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - bne _08137170 - ldr r1, =gUnknown_03005DB0 - ldr r0, =hm_add_c3_launch_phase_2 - str r0, [r1] - ldr r1, =gUnknown_0203CEEC - ldr r0, =hm2_flash -_08137152: - str r0, [r1] - movs r0, 0x1 - b _08137172 - .pool -_08137170: - movs r0, 0 -_08137172: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81370FC - - thumb_func_start hm2_flash -hm2_flash: @ 8137178 - push {r4,lr} - bl oei_task_add - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl GetCursorSelectionMonId - ldr r1, =gFieldEffectArguments - lsls r0, 24 - lsrs r0, 24 - str r0, [r1] - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r2, =sub_81371B4 - lsrs r1, r2, 16 - strh r1, [r0, 0x18] - strh r2, [r0, 0x1A] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end hm2_flash - - thumb_func_start sub_81371B4 -sub_81371B4: @ 81371B4 - push {lr} - movs r0, 0xCF - bl PlaySE - ldr r0, =0x00000888 - bl FlagSet - ldr r0, =EventScript_2926F8 - bl ScriptContext1_SetupScript - pop {r0} - bx r0 - .pool - thumb_func_end sub_81371B4 - - thumb_func_start sub_81371D4 -sub_81371D4: @ 81371D4 - push {lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_81371D4 - - thumb_func_start sub_81371EC -sub_81371EC: @ 81371EC - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_81371EC - - thumb_func_start c2_change_map -c2_change_map: @ 8137200 - push {r4,lr} - sub sp, 0x8 - movs r0, 0 - bl SetVBlankCallback - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0xC - movs r1, 0 - bl SetGpuReg - movs r0, 0xA - movs r1, 0 - bl SetGpuReg - movs r0, 0x8 - movs r1, 0 - bl SetGpuReg - movs r0, 0x18 - movs r1, 0 - bl SetGpuReg - movs r0, 0x1A - movs r1, 0 - bl SetGpuReg - movs r0, 0x14 - movs r1, 0 - bl SetGpuReg - movs r0, 0x16 - movs r1, 0 - bl SetGpuReg - movs r0, 0x10 - movs r1, 0 - bl SetGpuReg - movs r0, 0x12 - movs r1, 0 - bl SetGpuReg - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r1, =0x040000d4 - mov r0, sp - str r0, [r1] - movs r0, 0xC0 - lsls r0, 19 - str r0, [r1, 0x4] - ldr r0, =0x8100c000 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - movs r4, 0 - str r4, [sp, 0x4] - add r0, sp, 0x4 - str r0, [r1] - movs r0, 0xE0 - lsls r0, 19 - str r0, [r1, 0x4] - ldr r0, =0x85000100 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - mov r0, sp - strh r4, [r0] - str r0, [r1] - ldr r0, =0x05000002 - str r0, [r1, 0x4] - ldr r0, =0x810001ff - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - bl ResetPaletteFade - bl ResetTasks - bl ResetSpriteData - ldr r3, =0x04000208 - ldrh r2, [r3] - strh r4, [r3] - ldr r4, =0x04000200 - ldrh r0, [r4] - movs r1, 0x1 - orrs r0, r1 - strh r0, [r4] - strh r2, [r3] - ldr r0, =sub_81371EC - bl SetVBlankCallback - ldr r0, =sub_81371D4 - bl SetMainCallback2 - bl sub_8137304 - lsls r0, 24 - cmp r0, 0 - bne _081372D2 - ldr r0, =gMain - ldr r0, [r0, 0x8] - bl SetMainCallback2 -_081372D2: - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end c2_change_map - - thumb_func_start sub_8137304 -sub_8137304: @ 8137304 - push {r4-r7,lr} - bl get_map_light_from_warp0 - lsls r0, 24 - lsrs r6, r0, 24 - bl sav1_map_get_light_level - lsls r0, 24 - lsrs r5, r0, 24 - movs r3, 0 - ldr r4, =gUnknown_085B27C8 - ldrb r0, [r4] - cmp r0, 0 - beq _08137358 - adds r7, r4, 0 - adds r0, r4, 0x4 - mov r12, r0 -_08137326: - lsls r2, r3, 3 - adds r1, r2, r7 - ldrb r0, [r1] - cmp r0, r6 - bne _08137348 - ldrb r0, [r1, 0x1] - cmp r0, r5 - bne _08137348 - mov r1, r12 - adds r0, r2, r1 - ldr r0, [r0] - bl _call_via_r0 - movs r0, 0x1 - b _0813735A - .pool -_08137348: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - lsls r0, r3, 3 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - bne _08137326 -_08137358: - movs r0, 0 -_0813735A: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8137304 - - thumb_func_start sub_8137360 -sub_8137360: @ 8137360 - push {r4-r6,lr} - lsls r0, 24 - lsls r1, 24 - lsrs r5, r0, 24 - lsrs r4, r1, 24 - movs r3, 0 - ldr r1, =gUnknown_085B27C8 - ldrb r0, [r1] - cmp r0, 0 - beq _081373A0 - adds r6, r1, 0 -_08137376: - lsls r0, r3, 3 - adds r2, r0, r6 - ldrb r0, [r2] - cmp r0, r5 - bne _08137390 - ldrb r0, [r2, 0x1] - cmp r0, r4 - bne _08137390 - ldrb r0, [r2, 0x2] - b _081373A2 - .pool -_08137390: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - lsls r0, r3, 3 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _08137376 -_081373A0: - movs r0, 0 -_081373A2: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8137360 - - thumb_func_start fade_type_for_given_maplight_pair -fade_type_for_given_maplight_pair: @ 81373A8 - push {r4-r6,lr} - lsls r0, 24 - lsls r1, 24 - lsrs r5, r0, 24 - lsrs r4, r1, 24 - movs r3, 0 - ldr r1, =gUnknown_085B27C8 - ldrb r0, [r1] - cmp r0, 0 - beq _081373E8 - adds r6, r1, 0 -_081373BE: - lsls r0, r3, 3 - adds r2, r0, r6 - ldrb r0, [r2] - cmp r0, r5 - bne _081373D8 - ldrb r0, [r2, 0x1] - cmp r0, r4 - bne _081373D8 - ldrb r0, [r2, 0x3] - b _081373EA - .pool -_081373D8: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - lsls r0, r3, 3 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _081373BE -_081373E8: - movs r0, 0 -_081373EA: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end fade_type_for_given_maplight_pair - - thumb_func_start sub_81373F0 -sub_81373F0: @ 81373F0 - push {lr} - ldr r0, =sub_8137404 - movs r1, 0 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_81373F0 - - thumb_func_start sub_8137404 -sub_8137404: @ 8137404 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldr r0, =sub_8137420 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_8137404 - - thumb_func_start sub_8137420 -sub_8137420: @ 8137420 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0 - bl SetGpuReg - ldr r0, =gUnknown_085B2A90 - ldr r1, =0x0600c000 - bl LZ77UnCompVram - ldr r0, =gUnknown_085B28B0 - ldr r1, =0x0600f800 - bl LZ77UnCompVram - ldr r0, =gUnknown_085B2850 - movs r1, 0xE0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_085B28A0 - movs r1, 0xE0 - movs r2, 0x10 - bl LoadPalette - ldr r1, =0x00003e41 - movs r0, 0x50 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - ldr r1, =0x00001f0c - movs r0, 0x8 - bl SetGpuReg - movs r1, 0x8A - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81374C4 - str r1, [r0] - movs r2, 0 - movs r1, 0x10 - strh r1, [r0, 0x8] - strh r2, [r0, 0xA] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8137420 - - thumb_func_start sub_81374C4 -sub_81374C4: @ 81374C4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r5, r1, r2 - ldrh r4, [r5, 0xA] - movs r0, 0x80 - lsls r0, 5 - adds r1, r4, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - cmp r4, 0x10 - bhi _081374F8 - ldrh r0, [r5, 0xA] - adds r0, 0x1 - strh r0, [r5, 0xA] - b _08137500 - .pool -_081374F8: - movs r0, 0 - strh r0, [r5, 0xC] - ldr r0, =sub_813750C - str r0, [r5] -_08137500: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81374C4 - - thumb_func_start sub_813750C -sub_813750C: @ 813750C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r1, =0x00001010 - movs r0, 0x52 - bl SetGpuReg - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r4, r0, r1 - ldrh r1, [r4, 0xC] - cmp r1, 0x7 - bhi _08137554 - adds r0, r1, 0x1 - strh r0, [r4, 0xC] - lsls r1, 1 - ldr r0, =gUnknown_085B28A0 - adds r0, r1, r0 - movs r2, 0x10 - subs r2, r1 - lsls r2, 16 - lsrs r2, 16 - movs r1, 0xE0 - bl LoadPalette - b _08137566 - .pool -_08137554: - ldr r0, =gUnknown_085B2850 - movs r1, 0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =sub_8137574 - str r0, [r4] - movs r0, 0x8 - strh r0, [r4, 0xC] -_08137566: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813750C - - thumb_func_start sub_8137574 -sub_8137574: @ 8137574 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldrh r2, [r1, 0xC] - movs r3, 0xC - ldrsh r0, [r1, r3] - cmp r0, 0 - beq _08137598 - subs r0, r2, 0x1 - strh r0, [r1, 0xC] - b _081375A0 - .pool -_08137598: - ldr r0, =gMain - ldr r0, [r0, 0x8] - bl SetMainCallback2 -_081375A0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8137574 - - thumb_func_start sub_81375A8 -sub_81375A8: @ 81375A8 - push {lr} - ldr r0, =sub_81375BC - movs r1, 0 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_81375A8 - - thumb_func_start sub_81375BC -sub_81375BC: @ 81375BC - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldr r0, =sub_81375D8 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_81375BC - - thumb_func_start sub_81375D8 -sub_81375D8: @ 81375D8 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0 - bl SetGpuReg - ldr r0, =gUnknown_085B2A90 - ldr r1, =0x0600c000 - bl LZ77UnCompVram - ldr r0, =gUnknown_085B28B0 - ldr r1, =0x0600f800 - bl LZ77UnCompVram - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - ldr r1, =0x00001f0c - movs r0, 0x8 - bl SetGpuReg - movs r1, 0x8A - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r0, =gUnknown_085B2850 - movs r1, 0xE0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_085B2870 - movs r1, 0 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_8137678 - str r1, [r0] - movs r2, 0 - movs r1, 0x10 - strh r1, [r0, 0x8] - strh r2, [r0, 0xA] - strh r2, [r0, 0xC] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81375D8 - - thumb_func_start sub_8137678 -sub_8137678: @ 8137678 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 - ldrh r1, [r4, 0xC] - cmp r1, 0xF - bhi _081376B4 - adds r2, r1, 0x1 - adds r0, r2, 0x1 - strh r0, [r4, 0xC] - movs r0, 0xF - subs r0, r1 - lsls r0, 1 - ldr r1, =gUnknown_085B2890 - adds r0, r1 - lsls r2, 17 - lsrs r2, 16 - movs r1, 0xE0 - bl LoadPalette - b _081376C8 - .pool -_081376B4: - ldr r1, =0x00001010 - movs r0, 0x52 - bl SetGpuReg - ldr r1, =0x00003e41 - movs r0, 0x50 - bl SetGpuReg - ldr r0, =sub_81376DC - str r0, [r4] -_081376C8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8137678 - - thumb_func_start sub_81376DC -sub_81376DC: @ 81376DC - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r5, r1, r2 - ldrh r0, [r5, 0xA] - movs r1, 0x10 - subs r1, r0 - lsls r1, 16 - lsrs r4, r1, 16 - movs r0, 0x80 - lsls r0, 21 - adds r1, r0 - lsrs r1, 16 - movs r0, 0x52 - bl SetGpuReg - cmp r4, 0 - beq _08137714 - ldrh r0, [r5, 0xA] - adds r0, 0x1 - strh r0, [r5, 0xA] - b _08137726 - .pool -_08137714: - ldr r0, =gUnknown_085B2870 - movs r1, 0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gMain - ldr r0, [r0, 0x8] - bl SetMainCallback2 -_08137726: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81376DC - - thumb_func_start sub_8137734 -sub_8137734: @ 8137734 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x1C - bl sp000_heal_pokemon - ldr r4, =0x00000864 - adds r0, r4, 0 - bl FlagGet - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x1 - bne _08137760 - ldr r0, =gHasHallOfFameRecords - strb r1, [r0] - b _0813776C - .pool -_08137760: - ldr r1, =gHasHallOfFameRecords - movs r0, 0 - strb r0, [r1] - adds r0, r4, 0 - bl FlagSet -_0813776C: - movs r0, 0x1 - bl GetGameStat - cmp r0, 0 - bne _0813778E - ldr r0, =gSaveBlock2Ptr - ldr r2, [r0] - ldrh r1, [r2, 0xE] - lsls r1, 16 - ldrb r0, [r2, 0x10] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x11] - orrs r1, r0 - movs r0, 0x1 - bl sav12_xor_set -_0813778E: - bl sub_8076D48 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - cmp r0, 0 - bne _081377AC - movs r0, 0x1 - bl sub_8084F6C - b _081377B2 - .pool -_081377AC: - movs r0, 0x2 - bl sub_8084F6C -_081377B2: - movs r7, 0 - movs r6, 0 - add r0, sp, 0x18 - mov r8, r0 - mov r5, sp -_081377BC: - movs r0, 0x64 - adds r1, r6, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - movs r0, 0 - strb r6, [r5] - strb r0, [r5, 0x1] - adds r0, r4, 0 - movs r1, 0x5 - bl GetMonData - cmp r0, 0 - beq _0813780A - adds r0, r4, 0 - movs r1, 0x6 - bl GetMonData - cmp r0, 0 - bne _0813780A - adds r0, r4, 0 - movs r1, 0x43 - bl GetMonData - cmp r0, 0 - bne _0813780A - movs r0, 0x1 - mov r1, r8 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x43 - add r2, sp, 0x18 - bl SetMonData - adds r0, r4, 0 - bl GetRibbonCount - strb r0, [r5, 0x1] - movs r7, 0x1 -_0813780A: - adds r5, 0x4 - adds r6, 0x1 - cmp r6, 0x5 - ble _081377BC - cmp r7, 0x1 - bne _0813785A - movs r0, 0x2A - bl IncrementGameStat - ldr r0, =0x0000089b - bl FlagSet - mov r3, sp - add r2, sp, 0x4 - movs r6, 0x4 -_08137828: - ldrb r1, [r3, 0x1] - ldrb r0, [r2, 0x1] - cmp r0, r1 - bls _08137838 - ldr r1, [sp] - ldr r0, [r2] - str r0, [sp] - str r1, [r2] -_08137838: - adds r2, 0x4 - subs r6, 0x1 - cmp r6, 0 - bge _08137828 - mov r0, sp - ldrb r0, [r0, 0x1] - cmp r0, 0x4 - bls _0813785A - mov r0, sp - ldrb r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x43 - bl sub_80EE4DC -_0813785A: - ldr r0, =CB2_DoHallOfFameScreen - bl SetMainCallback2 - movs r0, 0 - add sp, 0x1C - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8137734 - - thumb_func_start sp0C8_whiteout_maybe -sp0C8_whiteout_maybe: @ 813787C - push {lr} - ldr r0, =CB2_WhiteOut - bl SetMainCallback2 - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sp0C8_whiteout_maybe - -@ time_events.o - - thumb_func_start sub_8137890 -sub_8137890: @ 8137890 - push {r4,lr} - ldr r0, =0x00004024 - bl VarGet - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =0x00004025 - bl VarGet - lsls r0, 16 - lsrs r0, 16 - lsls r4, 16 - orrs r4, r0 - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8137890 - - thumb_func_start sub_81378BC -sub_81378BC: @ 81378BC - push {r4,lr} - adds r4, r0, 0 - ldr r0, =0x00004024 - lsrs r1, r4, 16 - bl VarSet - ldr r0, =0x00004025 - lsls r4, 16 - lsrs r4, 16 - adds r1, r4, 0 - bl VarSet - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81378BC - - thumb_func_start sub_81378E4 -sub_81378E4: @ 81378E4 - push {r4,lr} - bl Random - adds r4, r0, 0 - bl Random - lsls r4, 16 - lsls r0, 16 - lsrs r0, 16 - orrs r4, r0 - adds r0, r4, 0 - bl sub_81378BC - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81378E4 - - thumb_func_start UpdateMirageRnd -UpdateMirageRnd: @ 8137904 - push {r4,lr} - lsls r0, 16 - lsrs r4, r0, 16 - bl sub_8137890 - adds r1, r0, 0 - cmp r4, 0 - beq _08137928 - ldr r3, =0x41c64e6d - ldr r2, =0x00003039 -_08137918: - adds r0, r1, 0 - muls r0, r3 - adds r1, r0, r2 - subs r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0 - bne _08137918 -_08137928: - adds r0, r1, 0 - bl sub_81378BC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end UpdateMirageRnd - - thumb_func_start sub_813793C -sub_813793C: @ 813793C - push {r4-r6,lr} - bl sub_8137890 - lsrs r6, r0, 16 - movs r5, 0 -_08137946: - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _08137978 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - ldr r1, =0x0000ffff - ands r1, r0 - cmp r1, r6 - bne _08137978 - movs r0, 0x1 - b _08137980 - .pool -_08137978: - adds r5, 0x1 - cmp r5, 0x5 - ble _08137946 - movs r0, 0 -_08137980: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_813793C - - thumb_func_start sub_8137988 -sub_8137988: @ 8137988 - push {lr} - bl get_map_light_from_warp0 - lsls r0, 24 - lsrs r0, 24 - bl is_light_level_1_2_3_5_or_6 - lsls r0, 24 - cmp r0, 0 - beq _081379CE - bl RtcCalcLocalTime - ldr r1, =gUnknown_085B2B44 - ldr r0, =gLocalTime - ldrb r0, [r0, 0x2] - lsls r0, 24 - asrs r0, 24 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _081379C8 - ldr r0, =0x0000089a - bl FlagSet - b _081379CE - .pool -_081379C8: - ldr r0, =0x0000089a - bl FlagClear -_081379CE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8137988 - - thumb_func_start sub_81379D8 -sub_81379D8: @ 81379D8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_80AC3BC - lsls r0, 24 - cmp r0, 0 - beq _081379F2 - bl EnableBothScriptContexts - adds r0, r4, 0 - bl DestroyTask -_081379F2: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81379D8 - - thumb_func_start sub_81379F8 -sub_81379F8: @ 81379F8 - push {lr} - ldr r0, =sub_81379D8 - movs r1, 0x50 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_81379F8 - - thumb_func_start sub_8137A0C -sub_8137A0C: @ 8137A0C - push {lr} - ldr r0, =0x00004049 - bl GetVarPointer - movs r1, 0 - strh r1, [r0] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8137A0C - - thumb_func_start UpdateBirchState -UpdateBirchState: @ 8137A20 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =0x00004049 - bl GetVarPointer - adds r5, r0, 0 - ldrh r0, [r5] - adds r4, r0 - strh r4, [r5] - ldrh r0, [r5] - movs r1, 0x7 - bl __umodsi3 - strh r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end UpdateBirchState - -@ birch_pc.o - - thumb_func_start sub_8137A4C -sub_8137A4C: @ 8137A4C - push {lr} - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r0, 0 - bne _08137A70 - movs r0, 0 - bl sub_80C0844 - ldr r1, =gSpecialVar_0x8005 - strh r0, [r1] - movs r0, 0x1 - bl sub_80C0844 - b _08137A80 - .pool -_08137A70: - movs r0, 0 - bl pokedex_count - ldr r1, =gSpecialVar_0x8005 - strh r0, [r1] - movs r0, 0x1 - bl pokedex_count -_08137A80: - ldr r1, =gSpecialVar_0x8006 - strh r0, [r1] - bl IsNationalPokedexEnabled - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8137A4C - - thumb_func_start sub_8137A98 -sub_8137A98: @ 8137A98 - push {lr} - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x9 - bhi _08137AA4 - b _08137BFC -_08137AA4: - cmp r0, 0x13 - bhi _08137AB0 - ldr r0, =gUnknown_082A5DAB - b _08137C06 - .pool -_08137AB0: - cmp r0, 0x1D - bhi _08137ABC - ldr r0, =gUnknown_082A5DF1 - b _08137C06 - .pool -_08137ABC: - cmp r0, 0x27 - bhi _08137AC8 - ldr r0, =gUnknown_082A5E34 - b _08137C06 - .pool -_08137AC8: - cmp r0, 0x31 - bhi _08137AD4 - ldr r0, =gUnknown_082A5E83 - b _08137C06 - .pool -_08137AD4: - cmp r0, 0x3B - bhi _08137AE0 - ldr r0, =gUnknown_082A5EB9 - b _08137C06 - .pool -_08137AE0: - cmp r0, 0x45 - bhi _08137AEC - ldr r0, =gUnknown_082A5EF4 - b _08137C06 - .pool -_08137AEC: - cmp r0, 0x4F - bhi _08137AF8 - ldr r0, =gUnknown_082A5F39 - b _08137C06 - .pool -_08137AF8: - cmp r0, 0x59 - bhi _08137B04 - ldr r0, =gUnknown_082A5F82 - b _08137C06 - .pool -_08137B04: - cmp r0, 0x63 - bhi _08137B10 - ldr r0, =gUnknown_082A5FB9 - b _08137C06 - .pool -_08137B10: - cmp r0, 0x6D - bhi _08137B1C - ldr r0, =gUnknown_082A6018 - b _08137C06 - .pool -_08137B1C: - cmp r0, 0x77 - bhi _08137B28 - ldr r0, =gUnknown_082A6061 - b _08137C06 - .pool -_08137B28: - cmp r0, 0x81 - bhi _08137B34 - ldr r0, =gUnknown_082A609C - b _08137C06 - .pool -_08137B34: - cmp r0, 0x8B - bhi _08137B40 - ldr r0, =gUnknown_082A60D5 - b _08137C06 - .pool -_08137B40: - cmp r0, 0x95 - bhi _08137B4C - ldr r0, =gUnknown_082A6124 - b _08137C06 - .pool -_08137B4C: - cmp r0, 0x9F - bhi _08137B58 - ldr r0, =gUnknown_082A616F - b _08137C06 - .pool -_08137B58: - cmp r0, 0xA9 - bhi _08137B64 - ldr r0, =gUnknown_082A61D6 - b _08137C06 - .pool -_08137B64: - cmp r0, 0xB3 - bhi _08137B70 - ldr r0, =gUnknown_082A623A - b _08137C06 - .pool -_08137B70: - cmp r0, 0xBD - bhi _08137B7C - ldr r0, =gUnknown_082A6287 - b _08137C06 - .pool -_08137B7C: - cmp r0, 0xC7 - bls _08137BEA - cmp r0, 0xC8 - bne _08137BB8 - ldr r0, =0x00000199 - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - bl GetSetPokedexFlag - lsls r0, 24 - cmp r0, 0 - bne _08137BEA - movs r0, 0xCD - lsls r0, 1 - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - bl GetSetPokedexFlag - lsls r0, 24 - cmp r0, 0 - bne _08137BEA - b _08137C04 - .pool -_08137BB8: - cmp r0, 0xC9 - bne _08137BF8 - ldr r0, =0x00000199 - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - bl GetSetPokedexFlag - lsls r0, 24 - cmp r0, 0 - beq _08137C04 - movs r0, 0xCD - lsls r0, 1 - bl SpeciesToNationalPokedexNum - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - bl GetSetPokedexFlag - lsls r0, 24 - cmp r0, 0 - beq _08137C04 -_08137BEA: - ldr r0, =gUnknown_082A62C9 - b _08137C06 - .pool -_08137BF8: - cmp r0, 0xCA - beq _08137C04 -_08137BFC: - ldr r0, =gUnknown_082A5D6C - b _08137C06 - .pool -_08137C04: - ldr r0, =gUnknown_082A6312 -_08137C06: - pop {r1} - bx r1 - .pool - thumb_func_end sub_8137A98 - - thumb_func_start sub_8137C10 -sub_8137C10: @ 8137C10 - push {lr} - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - bl sub_8137A98 - bl ShowFieldMessage - pop {r0} - bx r0 - .pool - thumb_func_end sub_8137C10 - - thumb_func_start sub_8137C28 -sub_8137C28: @ 8137C28 - push {lr} - ldr r0, =CB2_DoHallOfFamePC - bl SetMainCallback2 - bl ScriptContext2_Enable - pop {r0} - bx r0 - .pool - thumb_func_end sub_8137C28 - - thumb_func_start sub_8137C3C -sub_8137C3C: @ 8137C3C - push {lr} - ldr r0, =c2_exit_to_overworld_2_switch - bl SetMainCallback2 - ldr r1, =gFieldCallback - ldr r0, =mapldr_080CA5C0 - str r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8137C3C - - thumb_func_start mapldr_080CA5C0 -mapldr_080CA5C0: @ 8137C5C - push {lr} - sub sp, 0x4 - bl ScriptContext2_Enable - bl sub_8085784 - bl sp109_CreatePCMenu - bl sub_80E2514 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, =sub_8137C94 - movs r1, 0xA - bl CreateTask - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end mapldr_080CA5C0 - - thumb_func_start sub_8137C94 -sub_8137C94: @ 8137C94 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08137CAC - adds r0, r2, 0 - bl DestroyTask -_08137CAC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8137C94 - - thumb_func_start sub_8137CB4 -sub_8137CB4: @ 8137CB4 - push {lr} - ldr r0, =CB2_ShowDiploma - bl SetMainCallback2 - bl ScriptContext2_Enable - pop {r0} - bx r0 - .pool - thumb_func_end sub_8137CB4 - - thumb_func_start Special_ViewWallClock -Special_ViewWallClock: @ 8137CC8 - push {lr} - ldr r0, =gMain - ldr r1, =c2_exit_to_overworld_2_switch - str r1, [r0, 0x8] - ldr r0, =Cb2_ViewWallClock - bl SetMainCallback2 - bl ScriptContext2_Enable - pop {r0} - bx r0 - .pool - thumb_func_end Special_ViewWallClock - - thumb_func_start wild_pokemon_reroll -wild_pokemon_reroll: @ 8137CEC - ldr r0, =gUnknown_0203AB54 - movs r1, 0 - strb r1, [r0] - ldr r0, =gUnknown_0203AB55 - strb r1, [r0] - ldr r1, =gUnknown_0203AB58 - movs r0, 0 - str r0, [r1] - bx lr - .pool - thumb_func_end wild_pokemon_reroll - - thumb_func_start sub_8137D0C -sub_8137D0C: @ 8137D0C - ldr r1, =gUnknown_0203AB54 - movs r0, 0x1 - strb r0, [r1] - ldr r1, =gUnknown_0203AB55 - movs r0, 0 - strb r0, [r1] - ldr r1, =gUnknown_0203AB58 - ldr r0, =gMain - ldr r0, [r0, 0x20] - str r0, [r1] - bx lr - .pool - thumb_func_end sub_8137D0C - - thumb_func_start sp0E3_walkrun_bitfield_interpretation -sp0E3_walkrun_bitfield_interpretation: @ 8137D34 - push {lr} - movs r0, 0x4 - bl TestPlayerAvatarFlags - lsls r0, 24 - cmp r0, 0 - beq _08137D46 - movs r0, 0x1 - b _08137D58 -_08137D46: - movs r0, 0x2 - bl TestPlayerAvatarFlags - lsls r0, 24 - cmp r0, 0 - bne _08137D56 - movs r0, 0 - b _08137D58 -_08137D56: - movs r0, 0x2 -_08137D58: - pop {r1} - bx r1 - thumb_func_end sp0E3_walkrun_bitfield_interpretation - - thumb_func_start sub_8137D5C -sub_8137D5C: @ 8137D5C - push {r4-r7,lr} - adds r7, r0, 0 - lsls r1, 24 - lsrs r6, r1, 24 - cmp r6, 0x63 - bhi _08137D88 - ldr r4, =gStringVar1 - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r1, =gText_SpaceTimes - adds r0, r4, 0 - bl StringAppend - b _08137D90 - .pool -_08137D88: - ldr r0, =gStringVar1 - ldr r1, =gText_99TimesPlus - bl StringCopy -_08137D90: - ldr r0, =0x00000e0f - cmp r7, r0 - bhi _08137DF0 - ldr r4, =gStringVar2 - adds r0, r7, 0 - movs r1, 0x3C - bl __udivsi3 - adds r1, r0, 0 - adds r0, r4, 0 - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - movs r0, 0xAD - strb r0, [r4, 0x2] - adds r5, r4, 0x3 - adds r0, r7, 0 - movs r1, 0x3C - bl __umodsi3 - movs r1, 0x64 - muls r0, r1 - movs r1, 0x3C - bl __udivsi3 - adds r1, r0, 0 - adds r0, r5, 0 - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r1, =gText_SpaceSeconds - adds r0, r4, 0 - bl StringAppend - b _08137DF8 - .pool -_08137DF0: - ldr r0, =gStringVar2 - ldr r1, =gText_1MinutePlus - bl StringCopy -_08137DF8: - movs r4, 0 - cmp r6, 0 - bne _08137E0C - movs r4, 0x5 - b _08137E2A - .pool -_08137E0C: - cmp r6, 0x3 - bhi _08137E14 - movs r4, 0x4 - b _08137E2A -_08137E14: - cmp r6, 0x9 - bhi _08137E1C - movs r4, 0x3 - b _08137E2A -_08137E1C: - cmp r6, 0x13 - bhi _08137E24 - movs r4, 0x2 - b _08137E2A -_08137E24: - cmp r6, 0x63 - bhi _08137E2A - movs r4, 0x1 -_08137E2A: - adds r0, r7, 0 - movs r1, 0x3C - bl __udivsi3 - cmp r0, 0xA - bhi _08137E3A - adds r0, r4, 0x5 - b _08137E58 -_08137E3A: - cmp r0, 0xF - bhi _08137E42 - adds r0, r4, 0x4 - b _08137E58 -_08137E42: - cmp r0, 0x14 - bhi _08137E4A - adds r0, r4, 0x3 - b _08137E58 -_08137E4A: - cmp r0, 0x28 - bhi _08137E52 - adds r0, r4, 0x2 - b _08137E58 -_08137E52: - cmp r0, 0x3B - bhi _08137E5C - adds r0, r4, 0x1 -_08137E58: - lsls r0, 24 - lsrs r4, r0, 24 -_08137E5C: - ldr r0, =gSpecialVar_Result - strh r4, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8137D5C - - thumb_func_start sub_8137E6C -sub_8137E6C: @ 8137E6C - push {r4,r5,lr} - ldr r0, =gMain - ldr r1, =gUnknown_0203AB58 - ldr r4, [r0, 0x20] - ldr r0, [r1] - subs r4, r0 - ldr r5, =gUnknown_0203AB55 - ldrb r1, [r5] - adds r0, r4, 0 - bl sub_8137D5C - ldrb r1, [r5] - adds r0, r4, 0 - bl sub_8137E9C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8137E6C - - thumb_func_start sub_8137E9C -sub_8137E9C: @ 8137E9C - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - ldr r6, =0x00004028 - adds r0, r6, 0 - bl VarGet - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r7, =0x00004029 - adds r0, r7, 0 - bl VarGet - lsls r0, 16 - adds r4, r0 - cmp r4, r5 - bhi _08137ECC - cmp r4, 0 - bne _08137EE6 -_08137ECC: - lsls r1, r5, 16 - lsrs r1, 16 - adds r0, r6, 0 - bl VarSet - lsrs r1, r5, 16 - adds r0, r7, 0 - bl VarSet - ldr r0, =0x00004027 - mov r1, r8 - bl VarSet -_08137EE6: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8137E9C - - thumb_func_start sub_8137EFC -sub_8137EFC: @ 8137EFC - push {r4,lr} - ldr r0, =0x00004028 - bl VarGet - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =0x00004029 - bl VarGet - lsls r0, 16 - adds r4, r0 - cmp r4, 0 - beq _08137F3C - ldr r0, =0x00004027 - bl VarGet - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_8137D5C - movs r0, 0x1 - b _08137F3E - .pool -_08137F3C: - movs r0, 0 -_08137F3E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8137EFC - - thumb_func_start sub_8137F44 -sub_8137F44: @ 8137F44 - push {r4,lr} - ldr r0, =gUnknown_020322DC - ldrh r1, [r0] - ldr r0, =0x00000c1d - cmp r1, r0 - beq _08137F7C - ldr r4, =0x000040a9 - adds r0, r4, 0 - bl VarGet - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - beq _08137F6E - adds r0, r4, 0 - bl VarGet - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x3 - bne _08137F7C -_08137F6E: - adds r0, r4, 0 - movs r1, 0 - bl VarSet - movs r0, 0 - bl Overworld_SetSavedMusic -_08137F7C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8137F44 - - thumb_func_start sub_8137F90 -sub_8137F90: @ 8137F90 - push {lr} - ldr r0, =0x0000088d - bl FlagSet - ldr r0, =0x0000404a - bl GetVarPointer - movs r1, 0 - strh r1, [r0] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8137F90 - - thumb_func_start sub_8137FB0 -sub_8137FB0: @ 8137FB0 - push {lr} - ldr r0, =0x0000088d - bl FlagClear - pop {r0} - bx r0 - .pool - thumb_func_end sub_8137FB0 - - thumb_func_start CountSSTidalStep -CountSSTidalStep: @ 8137FC0 - push {r4,lr} - lsls r0, 16 - lsrs r4, r0, 16 - ldr r0, =0x0000088d - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _08137FE6 - ldr r0, =0x0000404a - bl GetVarPointer - ldrh r1, [r0] - adds r1, r4, r1 - strh r1, [r0] - lsls r1, 16 - lsrs r1, 16 - cmp r1, 0xCC - bhi _08137FF4 -_08137FE6: - movs r0, 0 - b _08137FF6 - .pool -_08137FF4: - movs r0, 0x1 -_08137FF6: - pop {r4} - pop {r1} - bx r1 - thumb_func_end CountSSTidalStep - - thumb_func_start GetSSTidalLocation -GetSSTidalLocation: @ 8137FFC - push {r4-r7,lr} - mov r7, r8 - push {r7} - mov r8, r0 - adds r5, r1, 0 - adds r6, r2, 0 - adds r7, r3, 0 - ldr r0, =0x0000404a - bl GetVarPointer - adds r4, r0, 0 - ldr r0, =0x000040b4 - bl GetVarPointer - ldrh r0, [r0] - subs r0, 0x1 - cmp r0, 0x9 - bhi _081380C2 - lsls r0, 2 - ldr r1, =_08138038 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08138038: - .4byte _08138060 - .4byte _08138070 - .4byte _08138064 - .4byte _08138068 - .4byte _08138068 - .4byte _0813806C - .4byte _08138098 - .4byte _08138060 - .4byte _08138064 - .4byte _0813806C -_08138060: - movs r0, 0x1 - b _081380CE -_08138064: - movs r0, 0x4 - b _081380CE -_08138068: - movs r0, 0x2 - b _081380CE -_0813806C: - movs r0, 0x3 - b _081380CE -_08138070: - ldrh r0, [r4] - cmp r0, 0x3B - bhi _08138080 - movs r0, 0x31 - strb r0, [r5] - ldrh r0, [r4] - adds r0, 0x13 - b _081380C0 -_08138080: - cmp r0, 0x8B - bhi _0813808E - movs r0, 0x30 - strb r0, [r5] - ldrh r0, [r4] - subs r0, 0x3C - b _081380C0 -_0813808E: - movs r0, 0x2F - strb r0, [r5] - ldrh r0, [r4] - subs r0, 0x8C - b _081380C0 -_08138098: - ldrh r0, [r4] - cmp r0, 0x41 - bhi _081380A8 - movs r0, 0x2F - strb r0, [r5] - ldrh r1, [r4] - movs r0, 0x41 - b _081380BE -_081380A8: - cmp r0, 0x91 - bhi _081380B6 - movs r0, 0x30 - strb r0, [r5] - ldrh r1, [r4] - movs r0, 0x91 - b _081380BE -_081380B6: - movs r0, 0x31 - strb r0, [r5] - ldrh r1, [r4] - movs r0, 0xE0 -_081380BE: - subs r0, r1 -_081380C0: - strh r0, [r6] -_081380C2: - movs r0, 0 - mov r1, r8 - strb r0, [r1] - movs r0, 0x14 - strh r0, [r7] - movs r0, 0 -_081380CE: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end GetSSTidalLocation - - thumb_func_start is_tile_that_overrides_player_control -is_tile_that_overrides_player_control: @ 81380D8 - push {lr} - movs r0, 0x88 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _0813810A - ldr r0, =gMapHeader - ldrb r0, [r0, 0x17] - cmp r0, 0x1 - blt _0813810A - cmp r0, 0x3 - ble _081380F6 - cmp r0, 0x6 - bne _0813810A -_081380F6: - ldr r0, =0x000040f2 - bl GetVarPointer - ldrh r1, [r0] - adds r1, 0x1 - strh r1, [r0] - lsls r1, 16 - lsrs r1, 16 - cmp r1, 0xF9 - bhi _08138118 -_0813810A: - movs r0, 0 - b _0813811A - .pool -_08138118: - movs r0, 0x1 -_0813811A: - pop {r1} - bx r1 - thumb_func_end is_tile_that_overrides_player_control - - thumb_func_start sub_8138120 -sub_8138120: @ 8138120 - push {lr} - movs r0, 0x8A - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _08138152 - ldr r0, =gMapHeader - ldrb r0, [r0, 0x17] - cmp r0, 0x1 - blt _08138152 - cmp r0, 0x3 - ble _0813813E - cmp r0, 0x6 - bne _08138152 -_0813813E: - ldr r0, =0x000040f3 - bl GetVarPointer - ldrh r1, [r0] - adds r1, 0x1 - strh r1, [r0] - lsls r1, 16 - lsrs r1, 16 - cmp r1, 0x9 - bhi _08138160 -_08138152: - movs r0, 0 - b _08138162 - .pool -_08138160: - movs r0, 0x1 -_08138162: - pop {r1} - bx r1 - thumb_func_end sub_8138120 - - thumb_func_start sub_8138168 -sub_8138168: @ 8138168 - push {lr} - movs r0, 0x72 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _0813819A - ldr r0, =gMapHeader - ldrb r0, [r0, 0x17] - cmp r0, 0x1 - blt _0813819A - cmp r0, 0x3 - ble _08138186 - cmp r0, 0x6 - bne _0813819A -_08138186: - ldr r0, =0x000040f5 - bl GetVarPointer - ldrh r1, [r0] - adds r1, 0x1 - strh r1, [r0] - lsls r1, 16 - lsrs r1, 16 - cmp r1, 0x9 - bhi _081381A8 -_0813819A: - movs r0, 0 - b _081381AA - .pool -_081381A8: - movs r0, 0x1 -_081381AA: - pop {r1} - bx r1 - thumb_func_end sub_8138168 - - thumb_func_start sub_81381B0 -sub_81381B0: @ 81381B0 - push {lr} - movs r0, 0x80 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _081381E2 - ldr r0, =gMapHeader - ldrb r0, [r0, 0x17] - cmp r0, 0x1 - blt _081381E2 - cmp r0, 0x3 - ble _081381CE - cmp r0, 0x6 - bne _081381E2 -_081381CE: - ldr r0, =0x000040f4 - bl GetVarPointer - ldrh r1, [r0] - adds r1, 0x1 - strh r1, [r0] - lsls r1, 16 - lsrs r1, 16 - cmp r1, 0xF9 - bhi _081381F0 -_081381E2: - movs r0, 0 - b _081381F2 - .pool -_081381F0: - movs r0, 0x1 -_081381F2: - pop {r1} - bx r1 - thumb_func_end sub_81381B0 - - thumb_func_start sub_81381F8 -sub_81381F8: @ 81381F8 - push {lr} - movs r0, 0x75 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _0813822A - ldr r0, =gMapHeader - ldrb r0, [r0, 0x17] - cmp r0, 0x1 - blt _0813822A - cmp r0, 0x3 - ble _08138216 - cmp r0, 0x6 - bne _0813822A -_08138216: - ldr r0, =0x000040f6 - bl GetVarPointer - ldrh r1, [r0] - adds r1, 0x1 - strh r1, [r0] - lsls r1, 16 - lsrs r1, 16 - cmp r1, 0xF9 - bhi _08138238 -_0813822A: - movs r0, 0 - b _0813823A - .pool -_08138238: - movs r0, 0x1 -_0813823A: - pop {r1} - bx r1 - thumb_func_end sub_81381F8 - - thumb_func_start sub_8138240 -sub_8138240: @ 8138240 - push {r4-r7,lr} - mov r7, r8 - push {r7} - movs r6, 0 - bl GetMultiplayerId - lsls r0, 24 - lsrs r7, r0, 24 - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 - cmp r4, r5 - bcs _0813828A - ldr r0, =gTVStringVarPtrs - mov r8, r0 -_08138262: - cmp r7, r4 - beq _08138280 - lsls r0, r6, 2 - add r0, r8 - ldr r0, [r0] - lsls r1, r4, 3 - subs r1, r4 - lsls r1, 2 - ldr r2, =gLinkPlayers + 8 - adds r1, r2 - bl StringCopy - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_08138280: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _08138262 -_0813828A: - adds r0, r5, 0 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8138240 - - thumb_func_start SpawnLinkPartnerFieldObject -SpawnLinkPartnerFieldObject: @ 81382A0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - movs r7, 0 - movs r0, 0 - mov r9, r0 - mov r8, r0 - ldr r1, =gUnknown_085B2B5C - add r0, sp, 0x8 - movs r2, 0x4 - bl memcpy - add r4, sp, 0xC - ldr r1, =gUnknown_085B2B60 - adds r0, r4, 0 - movs r2, 0x8 - bl memcpy - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - bl player_get_direction_lower_nybble - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - cmp r0, 0x2 - beq _08138310 - cmp r0, 0x2 - bgt _081382F4 - cmp r0, 0x1 - beq _0813833C - b _08138350 - .pool -_081382F4: - cmp r1, 0x3 - beq _081382FE - cmp r1, 0x4 - beq _08138324 - b _08138350 -_081382FE: - movs r7, 0x2 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldrh r0, [r1] - subs r0, 0x1 - b _0813832C - .pool -_08138310: - movs r7, 0x1 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrh r1, [r0] - mov r9, r1 - ldrh r0, [r0, 0x2] - subs r0, 0x1 - b _0813834A - .pool -_08138324: - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldrh r0, [r1] - adds r0, 0x1 -_0813832C: - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - ldrh r1, [r1, 0x2] - mov r8, r1 - b _08138350 - .pool -_0813833C: - movs r7, 0x3 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrh r3, [r0] - mov r9, r3 - ldrh r0, [r0, 0x2] - adds r0, 0x1 -_0813834A: - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 -_08138350: - movs r6, 0 - b _08138410 - .pool -_08138358: - cmp r10, r6 - beq _0813840A - ldr r0, =gLinkPlayers - lsls r2, r6, 3 - subs r1, r2, r6 - lsls r1, 2 - adds r1, r0 - ldrb r3, [r1] - adds r4, r0, 0 - cmp r3, 0x1 - blt _0813838C - cmp r3, 0x2 - ble _0813837C - cmp r3, 0x3 - beq _08138388 - b _0813838C - .pool -_0813837C: - ldrb r0, [r1, 0x13] - movs r5, 0xEC - cmp r0, 0 - bne _0813839C - movs r5, 0xEB - b _0813839C -_08138388: - ldrb r0, [r1, 0x13] - b _08138394 -_0813838C: - subs r0, r2, r6 - lsls r0, 2 - adds r0, r4 - ldrb r0, [r0, 0x13] -_08138394: - movs r5, 0x69 - cmp r0, 0 - bne _0813839C - movs r5, 0x64 -_0813839C: - mov r0, sp - adds r0, r7 - adds r0, 0x8 - ldrb r1, [r0] - movs r4, 0xF0 - subs r4, r6 - lsls r4, 24 - lsrs r4, 24 - lsls r2, r7, 1 - mov r0, sp - adds r0, r2 - adds r0, 0xC - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - mov r3, r9 - lsls r3, 16 - asrs r3, 16 - mov r12, r3 - add r0, r12 - adds r3, r0, 0x7 - lsls r3, 16 - asrs r3, 16 - mov r12, r3 - mov r0, sp - adds r0, 0xD - adds r0, r2 - movs r2, 0 - ldrsb r2, [r0, r2] - mov r3, r8 - lsls r0, r3, 16 - asrs r0, 16 - adds r0, r2 - adds r0, 0x7 - lsls r0, 16 - asrs r0, 16 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - adds r0, r5, 0 - adds r2, r4, 0 - mov r3, r12 - bl SpawnSpecialFieldObjectParametrized - adds r0, r5, 0 - adds r1, r4, 0 - adds r2, r6, 0 - bl sub_813842C - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0x4 - bne _0813840A - movs r7, 0 -_0813840A: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_08138410: - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r6, r0 - bcc _08138358 - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end SpawnLinkPartnerFieldObject - - thumb_func_start sub_813842C -sub_813842C: @ 813842C - push {r4,r5,lr} - lsls r0, 24 - lsls r1, 24 - lsrs r3, r1, 24 - lsls r2, 24 - movs r1, 0xC0 - lsls r1, 19 - adds r2, r1 - lsrs r5, r2, 24 - lsrs r4, r0, 24 - movs r2, 0xA8 - lsls r2, 21 - adds r0, r2 - lsrs r0, 24 - cmp r0, 0x1 - bls _08138454 - cmp r4, 0x64 - beq _08138454 - cmp r4, 0x69 - bne _081384E6 -_08138454: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrb r1, [r0, 0x5] - ldrb r2, [r0, 0x4] - adds r0, r3, 0 - bl GetFieldObjectIdByLocalIdAndMap - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x10 - beq _081384E6 - ldr r1, =gMapObjects - lsls r0, r2, 3 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - lsls r3, r5, 4 - ldrb r2, [r1, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - cmp r4, 0x69 - beq _081384D8 - cmp r4, 0x69 - bgt _081384A8 - cmp r4, 0x64 - beq _081384C4 - b _081384E6 - .pool -_081384A8: - cmp r4, 0xEB - beq _081384B2 - cmp r4, 0xEC - beq _081384BC - b _081384E6 -_081384B2: - ldr r0, =gFieldObjectPalette33 - b _081384C6 - .pool -_081384BC: - ldr r0, =gFieldObjectPalette34 - b _081384C6 - .pool -_081384C4: - ldr r0, =gFieldObjectPalette8 -_081384C6: - movs r2, 0x80 - lsls r2, 1 - adds r1, r3, r2 - movs r2, 0x20 - bl LoadPalette - b _081384E6 - .pool -_081384D8: - ldr r0, =gFieldObjectPalette17 - movs r2, 0x80 - lsls r2, 1 - adds r1, r3, r2 - movs r2, 0x20 - bl LoadPalette -_081384E6: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813842C - - thumb_func_start sub_81384F0 -sub_81384F0: @ 81384F0 - push {r4,r5,lr} - movs r4, 0 - ldr r5, =gUnknown_085B2B68 -_081384F6: - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r4, r0 - bne _0813851C - lsls r1, r4, 2 - adds r1, r5 - ldrb r0, [r1] - ldrb r1, [r1, 0x1] - ldr r2, =0x00000206 - bl MapGridSetMetatileIdAt - b _0813852A - .pool -_0813851C: - lsls r1, r4, 2 - adds r1, r5 - ldrb r0, [r1] - ldrb r1, [r1, 0x1] - ldr r2, =0x00000205 - bl MapGridSetMetatileIdAt -_0813852A: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _081384F6 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81384F0 - - thumb_func_start sub_8138540 -sub_8138540: @ 8138540 - push {r4-r6,lr} - movs r5, 0xC -_08138544: - movs r4, 0x7 - adds r6, r5, 0x1 -_08138548: - adds r0, r4, 0 - adds r1, r5, 0 - bl MapGridGetMetatileIdAt - ldr r1, =0xfffffde6 - adds r0, r1 - cmp r0, 0x37 - bls _0813855A - b _08138734 -_0813855A: - lsls r0, 2 - ldr r1, =_0813856C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813856C: - .4byte _081386F2 - .4byte _08138734 - .4byte _08138734 - .4byte _08138734 - .4byte _08138734 - .4byte _08138734 - .4byte _0813864C - .4byte _08138652 - .4byte _0813868C - .4byte _08138694 - .4byte _08138734 - .4byte _08138734 - .4byte _08138734 - .4byte _08138734 - .4byte _0813865C - .4byte _08138662 - .4byte _0813869C - .4byte _081386A4 - .4byte _08138734 - .4byte _08138734 - .4byte _08138734 - .4byte _08138734 - .4byte _0813866C - .4byte _08138672 - .4byte _081386AC - .4byte _081386B4 - .4byte _08138734 - .4byte _08138734 - .4byte _08138734 - .4byte _08138734 - .4byte _0813867C - .4byte _08138684 - .4byte _081386BC - .4byte _081386C4 - .4byte _08138734 - .4byte _08138734 - .4byte _08138734 - .4byte _08138734 - .4byte _081386CC - .4byte _081386DC - .4byte _081386EC - .4byte _08138714 - .4byte _08138734 - .4byte _08138734 - .4byte _08138734 - .4byte _08138734 - .4byte _081386D4 - .4byte _081386E4 - .4byte _08138734 - .4byte _08138734 - .4byte _08138734 - .4byte _08138734 - .4byte _08138734 - .4byte _08138734 - .4byte _0813872A - .4byte _0813871C -_0813864C: - movs r2, 0x8C - lsls r2, 2 - b _08138720 -_08138652: - ldr r2, =0x00000231 - b _08138720 - .pool -_0813865C: - movs r2, 0x8E - lsls r2, 2 - b _08138720 -_08138662: - ldr r2, =0x00000239 - b _08138720 - .pool -_0813866C: - movs r2, 0x88 - lsls r2, 2 - b _08138720 -_08138672: - ldr r2, =0x00000221 - b _08138720 - .pool -_0813867C: - ldr r2, =0x00000e28 - b _08138720 - .pool -_08138684: - ldr r2, =0x00000e29 - b _08138720 - .pool -_0813868C: - ldr r2, =0x00000232 - b _08138720 - .pool -_08138694: - ldr r2, =0x00000233 - b _08138720 - .pool -_0813869C: - ldr r2, =0x0000023a - b _08138720 - .pool -_081386A4: - ldr r2, =0x0000023b - b _08138720 - .pool -_081386AC: - ldr r2, =0x00000222 - b _08138720 - .pool -_081386B4: - ldr r2, =0x00000223 - b _08138720 - .pool -_081386BC: - ldr r2, =0x00000e2a - b _08138720 - .pool -_081386C4: - ldr r2, =0x00000e2b - b _08138720 - .pool -_081386CC: - ldr r2, =0x00000e42 - b _08138720 - .pool -_081386D4: - ldr r2, =0x0000021a - b _08138720 - .pool -_081386DC: - ldr r2, =0x00000e43 - b _08138720 - .pool -_081386E4: - ldr r2, =0x0000021a - b _08138720 - .pool -_081386EC: - movs r2, 0xE4 - lsls r2, 4 - b _08138720 -_081386F2: - subs r1, r5, 0x1 - adds r0, r4, 0 - bl MapGridGetMetatileIdAt - movs r1, 0x90 - lsls r1, 2 - cmp r0, r1 - bne _0813870C - ldr r2, =0x00000e48 - b _08138720 - .pool -_0813870C: - ldr r2, =0x00000e49 - b _08138720 - .pool -_08138714: - ldr r2, =0x00000e41 - b _08138720 - .pool -_0813871C: - movs r2, 0xE5 - lsls r2, 4 -_08138720: - adds r0, r4, 0 - adds r1, r5, 0 - bl MapGridSetMetatileIdAt - b _08138734 -_0813872A: - ldr r2, =0x00000251 - adds r0, r4, 0 - adds r1, r5, 0 - bl MapGridSetMetatileIdAt -_08138734: - adds r4, 0x1 - cmp r4, 0xF - bgt _0813873C - b _08138548 -_0813873C: - adds r5, r6, 0 - cmp r5, 0x17 - bgt _08138744 - b _08138544 -_08138744: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8138540 - - thumb_func_start sub_8138750 -sub_8138750: @ 8138750 - push {r4-r6,lr} - ldr r4, =gUnknown_085B2B68 - movs r5, 0x3 -_08138756: - ldrb r0, [r4] - ldrb r1, [r4, 0x1] - ldr r2, =0x00000206 - bl MapGridSetMetatileIdAt - adds r4, 0x4 - subs r5, 0x1 - cmp r5, 0 - bge _08138756 - movs r5, 0xC -_0813876A: - movs r4, 0x7 - adds r6, r5, 0x1 -_0813876E: - adds r0, r4, 0 - adds r1, r5, 0 - bl MapGridGetMetatileIdAt - ldr r1, =0xfffffde0 - adds r0, r1 - cmp r0, 0x30 - bls _08138780 - b _081388CA -_08138780: - lsls r0, 2 - ldr r1, =_0813879C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813879C: - .4byte _08138860 - .4byte _08138866 - .4byte _08138880 - .4byte _08138888 - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _08138870 - .4byte _08138876 - .4byte _08138890 - .4byte _08138898 - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388A0 - .4byte _081388A8 - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388B0 - .4byte _081388B0 - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388CA - .4byte _081388C0 -_08138860: - movs r2, 0x8C - lsls r2, 2 - b _081388B2 -_08138866: - ldr r2, =0x00000231 - b _081388B2 - .pool -_08138870: - movs r2, 0x8E - lsls r2, 2 - b _081388B2 -_08138876: - ldr r2, =0x00000239 - b _081388B2 - .pool -_08138880: - ldr r2, =0x00000232 - b _081388B2 - .pool -_08138888: - ldr r2, =0x00000233 - b _081388B2 - .pool -_08138890: - ldr r2, =0x0000023a - b _081388B2 - .pool -_08138898: - ldr r2, =0x0000023b - b _081388B2 - .pool -_081388A0: - ldr r2, =0x00000e42 - b _081388B2 - .pool -_081388A8: - ldr r2, =0x00000e43 - b _081388B2 - .pool -_081388B0: - ldr r2, =0x0000021a -_081388B2: - adds r0, r4, 0 - adds r1, r5, 0 - bl MapGridSetMetatileIdAt - b _081388CA - .pool -_081388C0: - ldr r2, =0x00000251 - adds r0, r4, 0 - adds r1, r5, 0 - bl MapGridSetMetatileIdAt -_081388CA: - adds r4, 0x1 - cmp r4, 0xF - bgt _081388D2 - b _0813876E -_081388D2: - adds r5, r6, 0 - cmp r5, 0x17 - bgt _081388DA - b _0813876A -_081388DA: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8138750 - - thumb_func_start sub_81388E4 -sub_81388E4: @ 81388E4 - push {lr} - ldr r0, =gUnknown_0203AB5C - movs r1, 0 - strb r1, [r0] - ldr r0, =gUnknown_0203AB5D - strb r1, [r0] - movs r0, 0x2C - bl PlaySE - ldr r0, =sub_8138910 - movs r1, 0x8 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_81388E4 - - thumb_func_start sub_8138910 -sub_8138910: @ 8138910 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gUnknown_085B2B78 - ldr r5, =gUnknown_0203AB5D - ldrb r1, [r5] - adds r0, r1, r0 - ldr r4, =gUnknown_0203AB5C - ldrb r2, [r4] - ldrb r0, [r0] - cmp r0, r2 - bne _0813896C - ldr r0, =gSpecialVar_0x8004 - ldrb r0, [r0] - ldr r2, =gUnknown_085B2B7E - lsls r1, 1 - adds r1, r2 - ldrh r1, [r1] - bl sub_8138978 - movs r0, 0 - strb r0, [r4] - ldrb r0, [r5] - adds r0, 0x1 - strb r0, [r5] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x5 - bne _08138970 - adds r0, r6, 0 - bl DestroyTask - bl EnableBothScriptContexts - b _08138970 - .pool -_0813896C: - adds r0, r2, 0x1 - strb r0, [r4] -_08138970: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8138910 - - thumb_func_start sub_8138978 -sub_8138978: @ 8138978 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x10 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 16 - lsrs r2, r1, 16 - movs r7, 0 - subs r0, 0x1 - cmp r0, 0x7 - bhi _08138A40 - lsls r0, 2 - ldr r1, =_081389A0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081389A0: - .4byte _081389C0 - .4byte _081389D2 - .4byte _081389E4 - .4byte _081389F6 - .4byte _08138A04 - .4byte _08138A1A - .4byte _08138A26 - .4byte _08138A34 -_081389C0: - movs r7, 0x2 - mov r1, sp - movs r0, 0x1 - strh r0, [r1] - movs r0, 0x7 - strh r0, [r1, 0x2] - add r1, sp, 0x8 - movs r0, 0x68 - b _08138A14 -_081389D2: - movs r7, 0x2 - mov r1, sp - movs r0, 0x1 - strh r0, [r1] - movs r0, 0x7 - strh r0, [r1, 0x2] - add r1, sp, 0x8 - movs r0, 0x4E - b _08138A14 -_081389E4: - movs r7, 0x2 - mov r1, sp - movs r0, 0x1 - strh r0, [r1] - movs r0, 0x7 - strh r0, [r1, 0x2] - add r1, sp, 0x8 - movs r0, 0x5B - b _08138A14 -_081389F6: - movs r7, 0x1 - mov r1, sp - movs r0, 0x7 - strh r0, [r1] - add r1, sp, 0x8 - movs r0, 0x27 - b _08138A3E -_08138A04: - movs r7, 0x2 - mov r1, sp - movs r0, 0x1 - strh r0, [r1] - movs r0, 0x7 - strh r0, [r1, 0x2] - add r1, sp, 0x8 - movs r0, 0x34 -_08138A14: - strh r0, [r1] - strh r0, [r1, 0x2] - b _08138A40 -_08138A1A: - movs r7, 0x1 - mov r0, sp - strh r7, [r0] - add r1, sp, 0x8 - movs r0, 0x41 - b _08138A3E -_08138A26: - movs r7, 0x1 - mov r1, sp - movs r0, 0x7 - strh r0, [r1] - add r1, sp, 0x8 - movs r0, 0xD - b _08138A3E -_08138A34: - movs r7, 0x1 - mov r0, sp - strh r7, [r0] - add r1, sp, 0x8 - movs r0, 0x1A -_08138A3E: - strh r0, [r1] -_08138A40: - movs r6, 0 - cmp r6, r7 - bcs _08138A92 - movs r1, 0xC0 - lsls r1, 4 - adds r0, r1, 0 - adds r1, r2, 0 - orrs r1, r0 - lsls r1, 16 - mov r9, r1 - adds r1, r2, 0 - adds r1, 0x8 - orrs r1, r0 - lsls r1, 16 - mov r8, r1 -_08138A5E: - lsls r1, r6, 1 - mov r3, sp - adds r5, r3, r1 - ldrh r0, [r5] - adds r0, 0x7 - add r4, sp, 0x8 - adds r4, r1 - ldrh r1, [r4] - adds r1, 0x7 - mov r3, r9 - lsrs r2, r3, 16 - bl MapGridSetMetatileIdAt - ldrh r0, [r5] - adds r0, 0x7 - ldrh r1, [r4] - adds r1, 0x8 - mov r3, r8 - lsrs r2, r3, 16 - bl MapGridSetMetatileIdAt - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, r7 - bcc _08138A5E -_08138A92: - bl DrawWholeMapView - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8138978 - - thumb_func_start sub_8138AA4 -sub_8138AA4: @ 8138AA4 - push {lr} - ldr r0, =gSpecialVar_0x8004 - ldrb r0, [r0] - ldr r1, =gUnknown_085B2B7E - ldrh r1, [r1, 0x8] - bl sub_8138978 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8138AA4 - - thumb_func_start sub_8138AC0 -sub_8138AC0: @ 8138AC0 - push {lr} - ldr r0, =gStringVar4 - bl ShowFieldMessage - pop {r0} - bx r0 - .pool - thumb_func_end sub_8138AC0 - - thumb_func_start sub_8138AD0 -sub_8138AD0: @ 8138AD0 - ldr r1, =gSpecialVar_0x8004 - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldrh r0, [r2] - strh r0, [r1] - ldr r1, =gSpecialVar_0x8005 - ldrh r0, [r2, 0x2] - strh r0, [r1] - bx lr - .pool - thumb_func_end sub_8138AD0 - - thumb_func_start sub_8138AF0 -sub_8138AF0: @ 8138AF0 - push {lr} - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r1, [r0, 0xB] - lsls r1, 8 - ldrb r0, [r0, 0xA] - orrs r0, r1 - movs r1, 0xA - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8138AF0 - - thumb_func_start sub_8138B10 -sub_8138B10: @ 8138B10 - push {lr} - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - cmp r0, 0 - bne _08138B34 - ldr r0, =gStringVar1 - ldr r1, =gText_BigGuy - bl StringCopy - b _08138B3C - .pool -_08138B34: - ldr r0, =gStringVar1 - ldr r1, =gText_BigGirl - bl StringCopy -_08138B3C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8138B10 - - thumb_func_start sub_8138B48 -sub_8138B48: @ 8138B48 - push {lr} - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - cmp r0, 0 - bne _08138B6C - ldr r0, =gStringVar1 - ldr r1, =gText_Daughter - bl StringCopy - b _08138B74 - .pool -_08138B6C: - ldr r0, =gStringVar1 - ldr r1, =gText_Son - bl StringCopy -_08138B74: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8138B48 - - thumb_func_start sub_8138B80 -sub_8138B80: @ 8138B80 - ldr r0, =gBattleOutcome - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_8138B80 - - thumb_func_start sub_8138B8C -sub_8138B8C: @ 8138B8C - push {lr} - sub sp, 0x4 - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r0, 0 - beq _08138BB0 - movs r2, 0x1 - negs r2, r2 - movs r0, 0x4 - str r0, [sp] - movs r0, 0x13 - movs r1, 0 - movs r3, 0x6 - bl Overworld_SetWarpDestination - b _08138BC2 - .pool -_08138BB0: - movs r2, 0x1 - negs r2, r2 - movs r0, 0x4 - str r0, [sp] - movs r0, 0x13 - movs r1, 0x1 - movs r3, 0x6 - bl Overworld_SetWarpDestination -_08138BC2: - add sp, 0x4 - pop {r0} - bx r0 - thumb_func_end sub_8138B8C - - thumb_func_start sub_8138BC8 -sub_8138BC8: @ 8138BC8 - push {lr} - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - bl FlagSet - pop {r0} - bx r0 - .pool - thumb_func_end sub_8138BC8 - - thumb_func_start sub_8138BDC -sub_8138BDC: @ 8138BDC - push {lr} - ldr r0, =gLocalTime - movs r1, 0 - ldrsh r0, [r0, r1] - movs r1, 0x7 - bl __divsi3 - lsls r0, 16 - lsrs r0, 16 - ldr r1, =0x0000270f - cmp r0, r1 - bls _08138BF6 - adds r0, r1, 0 -_08138BF6: - pop {r1} - bx r1 - .pool - thumb_func_end sub_8138BDC - - thumb_func_start sub_8138C04 -sub_8138C04: @ 8138C04 - push {r4,lr} - bl GetLeadMonIndex - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - cmp r0, 0xFF - bne _08138C2C - movs r0, 0x6 - b _08138C7E - .pool -_08138C2C: - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - cmp r0, 0xC7 - bls _08138C3C - movs r0, 0x5 - b _08138C7E -_08138C3C: - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - cmp r0, 0x95 - bls _08138C4C - movs r0, 0x4 - b _08138C7E -_08138C4C: - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - cmp r0, 0x63 - bls _08138C5C - movs r0, 0x3 - b _08138C7E -_08138C5C: - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - cmp r0, 0x31 - bls _08138C6C - movs r0, 0x2 - b _08138C7E -_08138C6C: - adds r0, r4, 0 - movs r1, 0x20 - bl GetMonData - cmp r0, 0 - bne _08138C7C - movs r0, 0 - b _08138C7E -_08138C7C: - movs r0, 0x1 -_08138C7E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8138C04 - - thumb_func_start sub_8138C84 -sub_8138C84: @ 8138C84 - push {lr} - ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music - bl sub_817018C - pop {r0} - bx r0 - .pool - thumb_func_end sub_8138C84 - - thumb_func_start sub_8138C94 -sub_8138C94: @ 8138C94 - push {lr} - ldr r0, =sub_8138C84 - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8138C94 - - thumb_func_start sp0D9_ComputerRelated -sp0D9_ComputerRelated: @ 8138CA4 - push {r4,lr} - ldr r4, =sub_8138CE8 - adds r0, r4, 0 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08138CD8 - adds r0, r4, 0 - movs r1, 0x8 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r2, 0 - strh r2, [r1, 0x8] - strh r0, [r1, 0xA] - strh r2, [r1, 0xC] - strh r2, [r1, 0xE] - strh r2, [r1, 0x10] -_08138CD8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sp0D9_ComputerRelated - - thumb_func_start sub_8138CE8 -sub_8138CE8: @ 8138CE8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks - adds r1, r0 - movs r2, 0x8 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _08138D06 - adds r0, r1, 0 - bl sub_8138D10 -_08138D06: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8138CE8 - - thumb_func_start sub_8138D10 -sub_8138D10: @ 8138D10 - push {r4-r6,lr} - adds r4, r0, 0 - movs r6, 0 - movs r5, 0 - movs r1, 0xE - ldrsh r0, [r4, r1] - cmp r0, 0x6 - bne _08138D7C - strh r5, [r4, 0xE] - bl player_get_direction_lower_nybble - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - cmp r0, 0x3 - beq _08138D44 - cmp r0, 0x3 - bgt _08138D3A - cmp r0, 0x2 - beq _08138D40 - b _08138D4C -_08138D3A: - cmp r1, 0x4 - beq _08138D48 - b _08138D4C -_08138D40: - movs r6, 0 - b _08138D4A -_08138D44: - movs r6, 0xFF - b _08138D4A -_08138D48: - movs r6, 0x1 -_08138D4A: - movs r5, 0xFF -_08138D4C: - movs r1, 0x10 - ldrsh r0, [r4, r1] - lsls r1, r6, 24 - asrs r1, 24 - lsls r2, r5, 24 - asrs r2, 24 - bl sub_8138D88 - bl DrawWholeMapView - ldrh r0, [r4, 0x10] - movs r1, 0x1 - eors r0, r1 - strh r0, [r4, 0x10] - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5 - bne _08138D7C - ldrb r0, [r4, 0xA] - bl DestroyTask -_08138D7C: - ldrh r0, [r4, 0xE] - adds r0, 0x1 - strh r0, [r4, 0xE] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8138D10 - - thumb_func_start sub_8138D88 -sub_8138D88: @ 8138D88 - push {r4,r5,lr} - lsls r1, 24 - lsrs r1, 24 - lsls r2, 24 - lsrs r4, r2, 24 - movs r3, 0 - lsls r0, 16 - cmp r0, 0 - beq _08138DC4 - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r0, 0 - bne _08138DAC - movs r3, 0x4 - b _08138DE6 - .pool -_08138DAC: - cmp r0, 0x1 - bne _08138DB8 - ldr r3, =0x0000025a - b _08138DE6 - .pool -_08138DB8: - cmp r0, 0x2 - bne _08138DE6 - ldr r3, =0x00000259 - b _08138DE6 - .pool -_08138DC4: - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r0, 0 - bne _08138DD4 - movs r3, 0x5 - b _08138DE6 - .pool -_08138DD4: - cmp r0, 0x1 - bne _08138DE0 - ldr r3, =0x0000027f - b _08138DE6 - .pool -_08138DE0: - cmp r0, 0x2 - bne _08138DE6 - ldr r3, =0x0000027e -_08138DE6: - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - movs r5, 0 - ldrsh r0, [r2, r5] - lsls r1, 24 - asrs r1, 24 - adds r0, r1 - adds r0, 0x7 - movs r5, 0x2 - ldrsh r1, [r2, r5] - lsls r2, r4, 24 - asrs r2, 24 - adds r1, r2 - adds r1, 0x7 - movs r4, 0xC0 - lsls r4, 4 - adds r2, r4, 0 - orrs r3, r2 - adds r2, r3, 0 - bl MapGridSetMetatileIdAt - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8138D88 - - thumb_func_start sub_8138E20 -sub_8138E20: @ 8138E20 - push {lr} - bl sub_8138E2C - pop {r0} - bx r0 - thumb_func_end sub_8138E20 - - thumb_func_start sub_8138E2C -sub_8138E2C: @ 8138E2C - push {r4-r6,lr} - movs r6, 0 - movs r5, 0 - movs r4, 0 - bl player_get_direction_lower_nybble - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - cmp r0, 0x3 - beq _08138E56 - cmp r0, 0x3 - bgt _08138E4C - cmp r0, 0x2 - beq _08138E52 - b _08138E5E -_08138E4C: - cmp r1, 0x4 - beq _08138E5A - b _08138E5E -_08138E52: - movs r6, 0 - b _08138E5C -_08138E56: - movs r6, 0xFF - b _08138E5C -_08138E5A: - movs r6, 0x1 -_08138E5C: - movs r5, 0xFF -_08138E5E: - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r0, 0 - bne _08138E70 - movs r4, 0x4 - b _08138E82 - .pool -_08138E70: - cmp r0, 0x1 - bne _08138E7C - ldr r4, =0x0000025a - b _08138E82 - .pool -_08138E7C: - cmp r0, 0x2 - bne _08138E82 - ldr r4, =0x00000259 -_08138E82: - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - movs r1, 0 - ldrsh r0, [r2, r1] - lsls r1, r6, 24 - asrs r1, 24 - adds r0, r1 - adds r0, 0x7 - movs r3, 0x2 - ldrsh r1, [r2, r3] - lsls r2, r5, 24 - asrs r2, 24 - adds r1, r2 - adds r1, 0x7 - movs r3, 0xC0 - lsls r3, 4 - adds r2, r3, 0 - orrs r4, r2 - adds r2, r4, 0 - bl MapGridSetMetatileIdAt - bl DrawWholeMapView - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8138E2C - - thumb_func_start sub_8138EC0 -sub_8138EC0: @ 8138EC0 - push {r4,lr} - ldr r4, =sub_8138F04 - adds r0, r4, 0 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08138EF4 - adds r0, r4, 0 - movs r1, 0x8 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r2, 0 - strh r2, [r1, 0x8] - strh r0, [r1, 0xA] - strh r2, [r1, 0xC] - strh r2, [r1, 0xE] - strh r2, [r1, 0x10] -_08138EF4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8138EC0 - - thumb_func_start sub_8138F04 -sub_8138F04: @ 8138F04 - push {lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks - adds r1, r0 - movs r2, 0x8 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _08138F22 - adds r0, r1, 0 - bl sub_8138F2C -_08138F22: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8138F04 - - thumb_func_start sub_8138F2C -sub_8138F2C: @ 8138F2C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0xE - ldrsh r0, [r4, r1] - cmp r0, 0x6 - bne _08138F9A - movs r0, 0 - strh r0, [r4, 0xE] - movs r1, 0x10 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _08138F64 - ldr r2, =0x00000e9d - movs r0, 0x12 - movs r1, 0x8 - bl MapGridSetMetatileIdAt - ldr r2, =0x00000ea5 - movs r0, 0x12 - movs r1, 0x9 - bl MapGridSetMetatileIdAt - b _08138F7A - .pool -_08138F64: - ldr r2, =0x00000e58 - movs r0, 0x12 - movs r1, 0x8 - bl MapGridSetMetatileIdAt - movs r2, 0xE6 - lsls r2, 4 - movs r0, 0x12 - movs r1, 0x9 - bl MapGridSetMetatileIdAt -_08138F7A: - bl DrawWholeMapView - ldrh r0, [r4, 0x10] - movs r1, 0x1 - eors r0, r1 - strh r0, [r4, 0x10] - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5 - bne _08138F9A - ldrb r0, [r4, 0xA] - bl DestroyTask -_08138F9A: - ldrh r0, [r4, 0xE] - adds r0, 0x1 - strh r0, [r4, 0xE] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8138F2C - - thumb_func_start sub_8138FAC -sub_8138FAC: @ 8138FAC - push {lr} - ldr r2, =0x00000e9d - movs r0, 0x12 - movs r1, 0x8 - bl MapGridSetMetatileIdAt - ldr r2, =0x00000ea5 - movs r0, 0x12 - movs r1, 0x9 - bl MapGridSetMetatileIdAt - bl DrawWholeMapView - pop {r0} - bx r0 - .pool - thumb_func_end sub_8138FAC - - thumb_func_start sub_8138FD4 -sub_8138FD4: @ 8138FD4 - push {lr} - ldr r1, =gSpecialVar_0x8004 - ldr r0, =0x000001f5 - strh r0, [r1] - bl FlagSet - pop {r0} - bx r0 - .pool - thumb_func_end sub_8138FD4 - - thumb_func_start sub_8138FEC -sub_8138FEC: @ 8138FEC - push {lr} - ldr r1, =gSpecialVar_0x8004 - ldr r0, =0x000001f5 - strh r0, [r1] - bl FlagClear - pop {r0} - bx r0 - .pool - thumb_func_end sub_8138FEC - - thumb_func_start sub_8139004 -sub_8139004: @ 8139004 - push {lr} - bl GetLeadMonIndex - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x16 - bl GetMonData - cmp r0, 0xC7 - bls _08139028 - movs r0, 0x1 - b _0813902A - .pool -_08139028: - movs r0, 0 -_0813902A: - pop {r1} - bx r1 - thumb_func_end sub_8139004 - - thumb_func_start sub_8139030 -sub_8139030: @ 8139030 - push {lr} - bl GetLeadMonIndex - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x17 - bl GetMonData - cmp r0, 0xC7 - bls _08139054 - movs r0, 0x1 - b _08139056 - .pool -_08139054: - movs r0, 0 -_08139056: - pop {r1} - bx r1 - thumb_func_end sub_8139030 - - thumb_func_start sub_813905C -sub_813905C: @ 813905C - push {lr} - bl GetLeadMonIndex - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x18 - bl GetMonData - cmp r0, 0xC7 - bls _08139080 - movs r0, 0x1 - b _08139082 - .pool -_08139080: - movs r0, 0 -_08139082: - pop {r1} - bx r1 - thumb_func_end sub_813905C - - thumb_func_start sub_8139088 -sub_8139088: @ 8139088 - push {lr} - bl GetLeadMonIndex - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x21 - bl GetMonData - cmp r0, 0xC7 - bls _081390AC - movs r0, 0x1 - b _081390AE - .pool -_081390AC: - movs r0, 0 -_081390AE: - pop {r1} - bx r1 - thumb_func_end sub_8139088 - - thumb_func_start sub_81390B4 -sub_81390B4: @ 81390B4 - push {lr} - bl GetLeadMonIndex - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2F - bl GetMonData - cmp r0, 0xC7 - bls _081390D8 - movs r0, 0x1 - b _081390DA - .pool -_081390D8: - movs r0, 0 -_081390DA: - pop {r1} - bx r1 - thumb_func_end sub_81390B4 - - thumb_func_start sub_81390E0 -sub_81390E0: @ 81390E0 - push {r4-r6,lr} - movs r5, 0 - ldr r6, =gBaseStats -_081390E6: - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x5 - bl GetMonData - cmp r0, 0 - beq _0813913C - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - bne _0813913C - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r6 - ldrb r0, [r1, 0x6] - cmp r0, 0xC - beq _08139128 - ldrb r0, [r1, 0x7] - cmp r0, 0xC - bne _0813913C -_08139128: - ldr r1, =gSpecialVar_Result - movs r0, 0x1 - b _0813914A - .pool -_0813913C: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _081390E6 - ldr r1, =gSpecialVar_Result - movs r0, 0 -_0813914A: - strh r0, [r1] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81390E0 - - thumb_func_start SpawnScriptFieldObject -SpawnScriptFieldObject: @ 8139158 - push {lr} - sub sp, 0x8 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrh r3, [r0] - adds r3, 0x7 - lsls r3, 16 - asrs r3, 16 - ldrh r0, [r0, 0x2] - adds r0, 0x7 - lsls r0, 16 - asrs r0, 16 - str r0, [sp] - movs r0, 0x3 - str r0, [sp, 0x4] - movs r0, 0x7 - movs r1, 0x8 - movs r2, 0x7F - bl SpawnSpecialFieldObjectParametrized - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gMapObjects - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r0, [r1, 0x1] - movs r2, 0x20 - orrs r0, r2 - strb r0, [r1, 0x1] - ldrb r0, [r1, 0x4] - bl CameraObjectSetFollowedObjectId - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end SpawnScriptFieldObject - - thumb_func_start RemoveScriptFieldObject -RemoveScriptFieldObject: @ 81391AC - push {lr} - bl GetPlayerAvatarObjectId - lsls r0, 24 - lsrs r0, 24 - bl CameraObjectSetFollowedObjectId - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrb r1, [r0, 0x5] - ldrb r2, [r0, 0x4] - movs r0, 0x7F - bl RemoveFieldObjectByLocalIdAndMap - pop {r0} - bx r0 - .pool - thumb_func_end RemoveScriptFieldObject - - thumb_func_start sub_81391D0 -sub_81391D0: @ 81391D0 - push {lr} - bl GetLeadMonIndex - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - bl GetNature - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gStringVar1 - bl sub_8137068 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81391D0 - - thumb_func_start sub_8139200 -sub_8139200: @ 8139200 - push {r4,lr} - ldr r4, =gStringVar1 - ldr r0, =0x00004026 - bl VarGet - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - movs r2, 0 - bl GetMapName - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8139200 - - thumb_func_start sub_8139228 -sub_8139228: @ 8139228 - push {lr} - movs r0, 0x20 - bl GetGameStat - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end sub_8139228 - - thumb_func_start sub_8139238 -sub_8139238: @ 8139238 - push {lr} - ldr r0, =gStringVar1 - bl GetEreaderTrainerName - pop {r0} - bx r0 - .pool - thumb_func_end sub_8139238 - - thumb_func_start sub_8139248 -sub_8139248: @ 8139248 - push {r4,r5,lr} - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldr r1, =0x00002e68 - adds r0, r2, r1 - ldrb r1, [r0] - lsls r1, 25 - ldr r0, =0x00002e6a - adds r2, r0 - lsrs r1, 25 - ldrh r2, [r2] - adds r1, r2 - ldr r2, =gUnknown_085B2B88 - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - adds r0, r2 - ldrb r0, [r0] - adds r5, r1, r0 - movs r0, 0x2 - bl GetPriceReduction - lsls r0, 24 - cmp r0, 0 - bne _08139294 - ldr r4, =gUnknown_085B2B94 - b _08139296 - .pool -_08139294: - ldr r4, =gUnknown_085B2BA0 -_08139296: - adds r0, r5, 0 - movs r1, 0xC - bl __umodsi3 - adds r0, r4 - ldrb r0, [r0] - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8139248 - - thumb_func_start sub_81392AC -sub_81392AC: @ 81392AC - push {lr} - ldr r1, =gSpecialVar_0x8004 - ldr r0, =0x00000213 - strh r0, [r1] - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _081392CC - movs r0, 0x1 - b _081392CE - .pool -_081392CC: - movs r0, 0 -_081392CE: - pop {r1} - bx r1 - thumb_func_end sub_81392AC - - thumb_func_start sub_81392D4 -sub_81392D4: @ 81392D4 - push {lr} - ldr r1, =gSpecialVar_0x8004 - movs r0, 0x85 - lsls r0, 2 - strh r0, [r1] - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _081392F0 - movs r0, 0x1 - b _081392F2 - .pool -_081392F0: - movs r0, 0 -_081392F2: - pop {r1} - bx r1 - thumb_func_end sub_81392D4 - - thumb_func_start sub_81392F8 -sub_81392F8: @ 81392F8 - push {lr} - ldr r1, =gSpecialVar_0x8004 - ldr r0, =0x00000215 - strh r0, [r1] - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _08139318 - movs r0, 0x1 - b _0813931A - .pool -_08139318: - movs r0, 0 -_0813931A: - pop {r1} - bx r1 - thumb_func_end sub_81392F8 - - thumb_func_start sub_8139320 -sub_8139320: @ 8139320 - push {lr} - ldr r1, =gSpecialVar_0x8004 - ldr r0, =0x00000216 - strh r0, [r1] - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _08139340 - movs r0, 0x1 - b _08139342 - .pool -_08139340: - movs r0, 0 -_08139342: - pop {r1} - bx r1 - thumb_func_end sub_8139320 - - thumb_func_start sub_8139348 -sub_8139348: @ 8139348 - push {lr} - bl GetLeadMonIndex - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x47 - movs r2, 0 - bl GetMonData - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8139348 - - thumb_func_start sub_8139370 -sub_8139370: @ 8139370 - push {r4,lr} - sub sp, 0x4 - movs r0, 0x2A - bl IncrementGameStat - ldr r0, =0x0000089b - bl FlagSet - movs r1, 0x1 - mov r0, sp - strb r1, [r0] - bl GetLeadMonIndex - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x64 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x47 - mov r2, sp - bl SetMonData - adds r0, r4, 0 - bl GetRibbonCount - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bls _081393B6 - adds r0, r4, 0 - movs r1, 0x47 - bl sub_80EE4DC -_081393B6: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8139370 - - thumb_func_start sub_81393C8 -sub_81393C8: @ 81393C8 - push {lr} - bl GetLeadMonIndex - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - bl GetMonEVCount - lsls r0, 16 - ldr r1, =0x01fd0000 - cmp r0, r1 - bhi _081393F4 - movs r0, 0 - b _081393F6 - .pool -_081393F4: - movs r0, 0x1 -_081393F6: - pop {r1} - bx r1 - thumb_func_end sub_81393C8 - - thumb_func_start sub_81393FC -sub_81393FC: @ 81393FC - push {lr} - movs r0, 0xC7 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - bne _08139454 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrh r1, [r0, 0x4] - movs r0, 0x83 - lsls r0, 3 - cmp r1, r0 - bne _08139454 - subs r0, 0x75 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _08139434 - ldr r0, =0x0000409a - movs r1, 0x4 - b _08139446 - .pool -_08139434: - movs r0, 0xE9 - lsls r0, 2 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _08139454 - ldr r0, =0x0000409a - movs r1, 0x5 -_08139446: - bl VarSet - movs r0, 0x1 - b _08139456 - .pool -_08139454: - movs r0, 0 -_08139456: - pop {r1} - bx r1 - thumb_func_end sub_81393FC - - thumb_func_start SetShoalItemFlag -SetShoalItemFlag: @ 813945C - push {lr} - ldr r0, =0x000008bf - bl FlagSet - pop {r0} - bx r0 - .pool - thumb_func_end SetShoalItemFlag - - thumb_func_start sub_813946C -sub_813946C: @ 813946C - push {r4,r5,lr} - sub sp, 0x14 - ldr r5, =gPlayerParty - movs r1, 0x90 - lsls r1, 1 - movs r4, 0 - str r4, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - str r4, [sp, 0xC] - adds r0, r5, 0 - movs r2, 0x7 - movs r3, 0x20 - bl CreateMon - movs r1, 0x1 - add r0, sp, 0x10 - strh r1, [r0] - adds r0, r5, 0 - movs r1, 0x2E - add r2, sp, 0x10 - bl SetMonData - add r1, sp, 0x10 - movs r0, 0x21 - strh r0, [r1] - adds r0, r5, 0 - movs r1, 0xD - add r2, sp, 0x10 - bl SetMonData - add r0, sp, 0x10 - strh r4, [r0] - adds r0, r5, 0 - movs r1, 0xE - add r2, sp, 0x10 - bl SetMonData - adds r0, r5, 0 - movs r1, 0xF - add r2, sp, 0x10 - bl SetMonData - adds r0, r5, 0 - movs r1, 0x10 - add r2, sp, 0x10 - bl SetMonData - add sp, 0x14 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813946C - - thumb_func_start sub_81394D8 -sub_81394D8: @ 81394D8 - push {r4-r6,lr} - ldr r0, =0x00004023 - bl VarGet - lsls r0, 16 - lsrs r0, 16 - bl GetStarterPokemon - lsls r0, 16 - lsrs r6, r0, 16 - bl CalculatePlayerPartyCount - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 - cmp r4, r5 - bcs _08139526 -_081394FA: - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x41 - movs r2, 0 - bl GetMonData - cmp r0, r6 - bne _0813951C - movs r0, 0x1 - b _08139528 - .pool -_0813951C: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _081394FA -_08139526: - movs r0, 0 -_08139528: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_81394D8 - - thumb_func_start sub_8139530 -sub_8139530: @ 8139530 - push {lr} - bl sub_80D2218 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_8139530 - - thumb_func_start sub_8139540 -sub_8139540: @ 8139540 - push {lr} - ldr r0, =gPlayerParty - movs r1, 0x3F - bl CheckPartyPokerus - lsls r0, 24 - cmp r0, 0 - beq _08139558 - movs r0, 0x1 - b _0813955A - .pool -_08139558: - movs r0, 0 -_0813955A: - pop {r1} - bx r1 - thumb_func_end sub_8139540 - - thumb_func_start sub_8139560 -sub_8139560: @ 8139560 - push {lr} - ldr r0, =sub_81395BC - movs r1, 0x9 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldr r0, =gSpecialVar_0x8005 - ldrh r0, [r0] - movs r2, 0 - strh r0, [r1, 0x8] - strh r2, [r1, 0xA] - ldr r0, =gSpecialVar_0x8006 - ldrh r0, [r0] - strh r0, [r1, 0xC] - ldr r0, =gSpecialVar_0x8007 - ldrh r0, [r0] - strh r0, [r1, 0xE] - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - strh r0, [r1, 0x10] - movs r0, 0 - bl SetCameraPanningCallback - movs r0, 0xD6 - bl PlaySE - pop {r0} - bx r0 - .pool - thumb_func_end sub_8139560 - - thumb_func_start sub_81395BC -sub_81395BC: @ 81395BC - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrh r0, [r4, 0x2] - adds r0, 0x1 - strh r0, [r4, 0x2] - movs r1, 0x2 - ldrsh r0, [r4, r1] - movs r2, 0x6 - ldrsh r1, [r4, r2] - bl __modsi3 - cmp r0, 0 - bne _08139614 - strh r0, [r4, 0x2] - ldrh r0, [r4, 0x4] - subs r0, 0x1 - strh r0, [r4, 0x4] - ldrh r0, [r4] - negs r0, r0 - strh r0, [r4] - ldrh r0, [r4, 0x8] - negs r0, r0 - strh r0, [r4, 0x8] - movs r1, 0 - ldrsh r0, [r4, r1] - movs r2, 0x8 - ldrsh r1, [r4, r2] - bl SetCameraPanning - movs r1, 0x4 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08139614 - adds r0, r5, 0 - bl sub_8139620 - bl InstallCameraPanAheadCallback -_08139614: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81395BC - - thumb_func_start sub_8139620 -sub_8139620: @ 8139620 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask - bl EnableBothScriptContexts - pop {r0} - bx r0 - thumb_func_end sub_8139620 - - thumb_func_start sub_8139634 -sub_8139634: @ 8139634 - push {lr} - movs r0, 0x95 - lsls r0, 2 - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_8139634 - - thumb_func_start sub_8139648 -sub_8139648: @ 8139648 - push {lr} - bl get_map_light_from_warp0 - lsls r0, 24 - lsrs r0, 24 - bl is_light_level_1_2_3_5_or_6 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08139664 - movs r0, 0x14 - bl SetSav1Weather -_08139664: - pop {r0} - bx r0 - thumb_func_end sub_8139648 - - thumb_func_start sub_8139668 -sub_8139668: @ 8139668 - push {lr} - bl get_map_light_from_warp0 - lsls r0, 24 - lsrs r0, 24 - bl is_light_level_1_2_3_5_or_6 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08139684 - movs r0, 0x15 - bl SetSav1Weather -_08139684: - pop {r0} - bx r0 - thumb_func_end sub_8139668 - - thumb_func_start GetLeadMonIndex -GetLeadMonIndex: @ 8139688 - push {r4-r6,lr} - bl CalculatePlayerPartyCount - lsls r0, 24 - lsrs r6, r0, 24 - movs r5, 0 - cmp r5, r6 - bcs _081396D6 -_08139698: - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x41 - movs r2, 0 - bl GetMonData - movs r1, 0xCE - lsls r1, 1 - cmp r0, r1 - beq _081396CC - adds r0, r4, 0 - movs r1, 0x41 - movs r2, 0 - bl GetMonData - cmp r0, 0 - beq _081396CC - adds r0, r5, 0 - b _081396D8 - .pool -_081396CC: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, r6 - bcc _08139698 -_081396D6: - movs r0, 0 -_081396D8: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end GetLeadMonIndex - - thumb_func_start sub_81396E0 -sub_81396E0: @ 81396E0 - push {lr} - ldr r0, =gSpecialVar_0x8004 - ldrh r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x41 - movs r2, 0 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81396E0 - - thumb_func_start nullsub_54 -nullsub_54: @ 8139708 - bx lr - thumb_func_end nullsub_54 - - thumb_func_start sub_813970C -sub_813970C: @ 813970C - push {r4,lr} - ldr r0, =0x000040c2 - bl VarGet - lsls r0, 16 - lsrs r0, 16 - adds r3, r0, 0 - ldr r2, =gLocalTime - movs r1, 0 - ldrsh r0, [r2, r1] - subs r0, r3 - cmp r0, 0x6 - ble _08139734 - movs r0, 0 - b _0813974C - .pool -_08139734: - ldrh r1, [r2] - movs r4, 0 - ldrsh r0, [r2, r4] - cmp r0, 0 - blt _0813974A - subs r1, r3 - movs r0, 0x7 - subs r0, r1 - lsls r0, 16 - lsrs r0, 16 - b _0813974C -_0813974A: - movs r0, 0x8 -_0813974C: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_813970C - - thumb_func_start sub_8139754 -sub_8139754: @ 8139754 - push {r4,lr} - ldr r0, =0x000040c2 - ldr r4, =gLocalTime - ldrh r1, [r4] - bl VarSet - ldrh r0, [r4] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8139754 - - thumb_func_start sub_8139770 -sub_8139770: @ 8139770 - push {r4-r6,lr} - ldr r6, =gSpecialVar_0x8004 - ldrh r0, [r6] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x3 - bl GetMonData - cmp r0, 0x2 - bne _081397A6 - ldrh r0, [r6] - muls r0, r5 - adds r0, r4 - ldr r4, =gStringVar1 - movs r1, 0x7 - adds r2, r4, 0 - bl GetMonData - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - adds r1, r4, 0 - bl StringCompare - cmp r0, 0 - beq _081397BC -_081397A6: - movs r0, 0x1 - b _081397BE - .pool -_081397BC: - movs r0, 0 -_081397BE: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8139770 - - thumb_func_start sub_81397C4 -sub_81397C4: @ 81397C4 - push {r4,r5,lr} - ldr r2, =gSpecialVar_Result - ldrh r1, [r2] - ldr r0, =0x0000270f - cmp r1, r0 - bls _081397E0 - movs r0, 0 - bl TV_PrintIntToStringVar - b _08139862 - .pool -_081397E0: - ldr r0, =0x000003e7 - cmp r1, r0 - bls _081397F8 - ldr r4, =gStringVar1 - movs r0, 0xA1 - strb r0, [r4] - adds r4, 0x1 - b _0813981C - .pool -_081397F8: - cmp r1, 0x63 - bls _0813980C - ldr r4, =gStringVar1 - movs r0, 0xA1 - strb r0, [r4] - strb r0, [r4, 0x1] - adds r4, 0x2 - b _0813981C - .pool -_0813980C: - cmp r1, 0x9 - bls _0813983C - ldr r4, =gStringVar1 - movs r0, 0xA1 - strb r0, [r4] - strb r0, [r4, 0x1] - strb r0, [r4, 0x2] - adds r4, 0x3 -_0813981C: - ldrh r5, [r2] - adds r0, r5, 0 - bl sub_80EF370 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0 - bl ConvertIntToDecimalStringN - b _08139862 - .pool -_0813983C: - ldr r4, =gStringVar1 - movs r0, 0xA1 - strb r0, [r4] - strb r0, [r4, 0x1] - strb r0, [r4, 0x2] - strb r0, [r4, 0x3] - adds r4, 0x4 - ldrh r5, [r2] - adds r0, r5, 0 - bl sub_80EF370 - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0 - bl ConvertIntToDecimalStringN -_08139862: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81397C4 - - thumb_func_start sub_813986C -sub_813986C: @ 813986C - push {lr} - ldr r0, =gSpecialVar_Result - ldrh r0, [r0] - cmp r0, 0x4 - bhi _081398B8 - lsls r0, 2 - ldr r1, =_08139888 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08139888: - .4byte _0813989C - .4byte _081398A0 - .4byte _081398A4 - .4byte _081398A8 - .4byte _081398AC -_0813989C: - movs r0, 0x3 - b _081398AE -_081398A0: - movs r0, 0x4 - b _081398AE -_081398A4: - movs r0, 0 - b _081398AE -_081398A8: - movs r0, 0x1 - b _081398AE -_081398AC: - movs r0, 0x2 -_081398AE: - bl mevent_081445C0 - lsls r0, 16 - lsrs r0, 16 - b _081398BA -_081398B8: - movs r0, 0 -_081398BA: - pop {r1} - bx r1 - thumb_func_end sub_813986C - - thumb_func_start sub_81398C0 -sub_81398C0: @ 81398C0 - push {r4,lr} - ldr r1, =gSpecialVar_0x8004 - ldr r2, =0xfffffedf - adds r0, r2, 0 - ldrh r2, [r1] - adds r0, r2 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x39 - bls _081398E0 - movs r0, 0 - b _081398FC - .pool -_081398E0: - ldr r4, =gStringVar2 - ldrh r0, [r1] - bl ItemIdToBattleMoveId - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xD - muls r1, r0 - ldr r0, =gMoveNames - adds r1, r0 - adds r0, r4, 0 - bl StringCopy - movs r0, 0x1 -_081398FC: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81398C0 - - thumb_func_start sub_813990C -sub_813990C: @ 813990C - push {r4,r5,lr} - bl CalculatePlayerPartyCount - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 - cmp r4, r5 - bcs _08139942 -_0813991C: - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x4 - bl GetMonData - cmp r0, 0x1 - bne _08139938 - movs r0, 0x1 - b _08139944 - .pool -_08139938: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _0813991C -_08139942: - movs r0, 0 -_08139944: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_813990C - - thumb_func_start InMultiBattleRoom -InMultiBattleRoom: @ 813994C - push {lr} - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrh r1, [r0, 0x4] - ldr r0, =0x00000f1a - cmp r1, r0 - bne _08139978 - ldr r0, =0x000040ce - bl VarGet - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - bne _08139978 - movs r0, 0x1 - b _0813997A - .pool -_08139978: - movs r0, 0 -_0813997A: - pop {r1} - bx r1 - thumb_func_end InMultiBattleRoom - - thumb_func_start sub_8139980 -sub_8139980: @ 8139980 - push {lr} - movs r0, 0 - bl SetCameraPanningCallback - movs r0, 0x8 - movs r1, 0 - bl SetCameraPanning - pop {r0} - bx r0 - thumb_func_end sub_8139980 - - thumb_func_start sub_8139994 -sub_8139994: @ 8139994 - push {lr} - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x15] - subs r0, 0x10 - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x5 - bhi _081399E4 - lsls r0, 2 - ldr r1, =_081399B8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081399B8: - .4byte _081399E4 - .4byte _081399D0 - .4byte _081399D4 - .4byte _081399D8 - .4byte _081399DC - .4byte _081399E0 -_081399D0: - movs r1, 0x5 - b _081399E6 -_081399D4: - movs r1, 0x6 - b _081399E6 -_081399D8: - movs r1, 0x7 - b _081399E6 -_081399DC: - movs r1, 0x8 - b _081399E6 -_081399E0: - movs r1, 0xF - b _081399E6 -_081399E4: - movs r1, 0x4 -_081399E6: - ldr r0, =0x00004043 - bl VarSet - pop {r0} - bx r0 - .pool - thumb_func_end sub_8139994 - - thumb_func_start sub_81399F4 -sub_81399F4: @ 81399F4 - push {r4,lr} - ldr r2, =gUnknown_0203AB60 - movs r0, 0 - strh r0, [r2] - ldr r1, =gUnknown_0203AB62 - strh r0, [r1] - ldr r0, =gSaveBlock1Ptr - ldr r3, [r0] - movs r0, 0x14 - ldrsb r0, [r3, r0] - adds r4, r1, 0 - cmp r0, 0xD - bne _08139A6E - ldrb r0, [r3, 0x15] - subs r0, 0x10 - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x4 - bhi _08139A6E - lsls r0, 2 - ldr r1, =_08139A34 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08139A34: - .4byte _08139A66 - .4byte _08139A5E - .4byte _08139A56 - .4byte _08139A4E - .4byte _08139A48 -_08139A48: - movs r0, 0 - strh r0, [r2] - b _08139A6C -_08139A4E: - movs r0, 0 - strh r0, [r2] - movs r0, 0x1 - b _08139A6C -_08139A56: - movs r0, 0 - strh r0, [r2] - movs r0, 0x2 - b _08139A6C -_08139A5E: - movs r0, 0 - strh r0, [r2] - movs r0, 0x3 - b _08139A6C -_08139A66: - movs r0, 0 - strh r0, [r2] - movs r0, 0x4 -_08139A6C: - strh r0, [r4] -_08139A6E: - ldrh r0, [r4] - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81399F4 - - thumb_func_start sub_8139A78 -sub_8139A78: @ 8139A78 - push {r4-r6,lr} - ldr r0, =sub_8139AF4 - movs r1, 0x9 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r4, r1, r0 - movs r3, 0 - strh r3, [r4, 0x2] - strh r3, [r4, 0x4] - movs r6, 0x1 - strh r6, [r4, 0x8] - ldr r0, =gSpecialVar_0x8005 - ldr r1, =gSpecialVar_0x8006 - ldrh r2, [r0] - ldrh r0, [r1] - cmp r2, r0 - bls _08139AC0 - subs r0, r2, r0 - lsls r0, 16 - lsrs r5, r0, 16 - strh r6, [r4, 0xC] - b _08139AC8 - .pool -_08139AC0: - subs r0, r2 - lsls r0, 16 - lsrs r5, r0, 16 - strh r3, [r4, 0xC] -_08139AC8: - cmp r5, 0x8 - bls _08139ACE - movs r5, 0x8 -_08139ACE: - ldr r0, =gUnknown_085B2C18 - adds r0, r5, r0 - ldrb r0, [r0] - strh r0, [r4, 0xA] - movs r0, 0 - bl SetCameraPanningCallback - ldrb r1, [r4, 0xC] - adds r0, r5, 0 - bl sub_8139C2C - movs r0, 0x59 - bl PlaySE - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8139A78 - - thumb_func_start sub_8139AF4 -sub_8139AF4: @ 8139AF4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrh r0, [r4, 0x2] - adds r0, 0x1 - strh r0, [r4, 0x2] - movs r1, 0x2 - ldrsh r0, [r4, r1] - movs r1, 0x3 - bl __modsi3 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bne _08139B54 - strh r0, [r4, 0x2] - ldrh r0, [r4, 0x4] - adds r0, 0x1 - strh r0, [r4, 0x4] - ldrh r0, [r4, 0x8] - negs r0, r0 - strh r0, [r4, 0x8] - movs r2, 0x8 - ldrsh r1, [r4, r2] - movs r0, 0 - bl SetCameraPanning - movs r0, 0x4 - ldrsh r1, [r4, r0] - movs r2, 0xA - ldrsh r0, [r4, r2] - cmp r1, r0 - bne _08139B54 - movs r0, 0x49 - bl PlaySE - adds r0, r5, 0 - bl DestroyTask - bl EnableBothScriptContexts - bl InstallCameraPanAheadCallback -_08139B54: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8139AF4 - - thumb_func_start sub_8139B60 -sub_8139B60: @ 8139B60 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0xC - ldr r5, =gUnknown_0203AB5E - ldr r0, =gUnknown_085B2BAC - bl AddWindow - strb r0, [r5] - ldrb r0, [r5] - movs r1, 0 - bl SetStandardWindowBorderStyle - ldr r4, =gText_ElevatorNowOn - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x40 - bl GetStringCenterAlignXOffset - adds r3, r0, 0 - ldrb r0, [r5] - lsls r3, 24 - lsrs r3, 24 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - mov r9, r1 - str r1, [sp, 0x4] - movs r1, 0 - mov r8, r1 - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r4, 0 - bl PrintTextOnWindow - ldr r6, =gUnknown_085B2BB4 - ldr r4, =gSpecialVar_0x8005 - ldrh r0, [r4] - lsls r0, 2 - adds r0, r6 - ldr r1, [r0] - movs r0, 0x1 - movs r2, 0x40 - bl GetStringCenterAlignXOffset - adds r3, r0, 0 - ldrb r0, [r5] - ldrh r1, [r4] - lsls r1, 2 - adds r1, r6 - ldr r2, [r1] - lsls r3, 24 - lsrs r3, 24 - movs r1, 0x11 - str r1, [sp] - mov r1, r9 - str r1, [sp, 0x4] - mov r1, r8 - str r1, [sp, 0x8] - movs r1, 0x1 - bl PrintTextOnWindow - ldrb r0, [r5] - bl PutWindowTilemap - ldrb r0, [r5] - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0xC - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8139B60 - - thumb_func_start sub_8139C10 -sub_8139C10: @ 8139C10 - push {r4,lr} - ldr r4, =gUnknown_0203AB5E - ldrb r0, [r4] - movs r1, 0x1 - bl sub_8198070 - ldrb r0, [r4] - bl RemoveWindow - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8139C10 - - thumb_func_start sub_8139C2C -sub_8139C2C: @ 8139C2C - push {r4-r6,lr} - lsls r0, 16 - lsrs r6, r0, 16 - lsls r1, 24 - lsrs r5, r1, 24 - ldr r4, =sub_8139C80 - adds r0, r4, 0 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08139C6C - adds r0, r4, 0 - movs r1, 0x8 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r0, 0 - strh r0, [r1, 0x8] - strh r0, [r1, 0xA] - strh r5, [r1, 0xC] - ldr r0, =gUnknown_085B2C21 - adds r0, r6, r0 - ldrb r0, [r0] - strh r0, [r1, 0xE] -_08139C6C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8139C2C - - thumb_func_start sub_8139C80 -sub_8139C80: @ 8139C80 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - lsls r0, 2 - ldr r1, [sp] - adds r0, r1 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - movs r2, 0x2 - ldrsh r0, [r6, r2] - cmp r0, 0x6 - bne _08139D7C - ldrh r0, [r6] - adds r0, 0x1 - strh r0, [r6] - movs r1, 0x4 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _08139D10 - movs r1, 0 - ldr r2, =gUnknown_085B2BF4 - mov r10, r2 -_08139CBA: - movs r5, 0 - adds r7, r1, 0x7 - lsls r0, r1, 1 - adds r2, r1, 0x1 - mov r8, r2 - adds r0, r1 - lsls r0, 1 - mov r9, r0 -_08139CCA: - adds r4, r5, 0 - adds r4, 0x8 - movs r1, 0 - ldrsh r0, [r6, r1] - movs r1, 0x3 - bl __modsi3 - lsls r0, 16 - asrs r0, 15 - add r0, r9 - add r0, r10 - ldrh r0, [r0] - movs r1, 0xC0 - lsls r1, 4 - adds r2, r1, 0 - orrs r2, r0 - adds r0, r4, 0 - adds r1, r7, 0 - bl MapGridSetMetatileIdAt - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x2 - bls _08139CCA - mov r2, r8 - lsls r0, r2, 24 - lsrs r1, r0, 24 - cmp r1, 0x2 - bls _08139CBA - b _08139D62 - .pool -_08139D10: - movs r1, 0 - ldr r0, =gUnknown_085B2C06 - mov r10, r0 -_08139D16: - movs r5, 0 - adds r7, r1, 0x7 - lsls r0, r1, 1 - adds r2, r1, 0x1 - mov r8, r2 - adds r0, r1 - lsls r0, 1 - mov r9, r0 -_08139D26: - adds r4, r5, 0 - adds r4, 0x8 - movs r1, 0 - ldrsh r0, [r6, r1] - movs r1, 0x3 - bl __modsi3 - lsls r0, 16 - asrs r0, 15 - add r0, r9 - add r0, r10 - ldrh r0, [r0] - movs r1, 0xC0 - lsls r1, 4 - adds r2, r1, 0 - orrs r2, r0 - adds r0, r4, 0 - adds r1, r7, 0 - bl MapGridSetMetatileIdAt - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x2 - bls _08139D26 - mov r2, r8 - lsls r0, r2, 24 - lsrs r1, r0, 24 - cmp r1, 0x2 - bls _08139D16 -_08139D62: - bl DrawWholeMapView - movs r0, 0 - strh r0, [r6, 0x2] - movs r0, 0 - ldrsh r1, [r6, r0] - movs r2, 0x6 - ldrsh r0, [r6, r2] - cmp r1, r0 - bne _08139D7C - ldr r0, [sp] - bl DestroyTask -_08139D7C: - ldrh r0, [r6, 0x2] - adds r0, 0x1 - strh r0, [r6, 0x2] - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8139C80 - - thumb_func_start sub_8139D98 -sub_8139D98: @ 8139D98 - push {r4-r7,lr} - sub sp, 0x18 - ldr r6, =gSpecialVar_0x8004 - ldrh r0, [r6] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x27 - bl GetMonData - str r0, [sp] - ldrh r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0x28 - bl GetMonData - str r0, [sp, 0x4] - ldrh r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0x29 - bl GetMonData - str r0, [sp, 0x8] - ldrh r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0x2A - bl GetMonData - str r0, [sp, 0xC] - ldrh r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0x2B - bl GetMonData - str r0, [sp, 0x10] - ldrh r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0x2C - bl GetMonData - str r0, [sp, 0x14] - ldr r1, =gSpecialVar_0x8005 - movs r0, 0 - strh r0, [r1] - movs r4, 0 - adds r2, r1, 0 -_08139E00: - lsls r0, r4, 2 - add r0, sp - ldr r1, [r0] - ldrh r0, [r2] - adds r0, r1 - strh r0, [r2] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x5 - bls _08139E00 - ldr r2, =gSpecialVar_0x8006 - movs r0, 0 - strh r0, [r2] - ldr r1, =gSpecialVar_0x8007 - ldr r0, [sp] - strh r0, [r1] - movs r4, 0x1 - adds r6, r2, 0 - adds r7, r1, 0 -_08139E28: - ldrh r0, [r6] - lsls r0, 2 - mov r2, sp - adds r1, r2, r0 - lsls r0, r4, 2 - adds r5, r2, r0 - ldr r1, [r1] - ldr r0, [r5] - cmp r1, r0 - bcs _08139E54 - strh r4, [r6] - b _08139E6C - .pool -_08139E54: - cmp r1, r0 - bne _08139E6E - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08139E6E - strh r4, [r6] - ldr r0, [r5] -_08139E6C: - strh r0, [r7] -_08139E6E: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x5 - bls _08139E28 - add sp, 0x18 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8139D98 - - thumb_func_start warp0_in_pokecenter -warp0_in_pokecenter: @ 8139E80 - push {r4,lr} - ldr r0, =gUnknown_020322DC - movs r1, 0 - ldrsb r1, [r0, r1] - lsls r1, 8 - ldrb r0, [r0, 0x1] - lsls r0, 24 - asrs r0, 24 - adds r0, r1 - lsls r0, 16 - lsrs r3, r0, 16 - ldr r2, =gUnknown_085B2C2A - ldrh r0, [r2] - ldr r1, =0x0000ffff - cmp r0, r1 - beq _08139EC6 - adds r4, r1, 0 - adds r1, r2, 0 -_08139EA4: - ldrh r0, [r2] - cmp r0, r3 - bne _08139EBC - movs r0, 0x1 - b _08139EC8 - .pool -_08139EBC: - adds r1, 0x2 - adds r2, 0x2 - ldrh r0, [r1] - cmp r0, r4 - bne _08139EA4 -_08139EC6: - movs r0, 0 -_08139EC8: - pop {r4} - pop {r1} - bx r1 - thumb_func_end warp0_in_pokecenter - - thumb_func_start sub_8139ED0 -sub_8139ED0: @ 8139ED0 - push {lr} - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrh r1, [r0, 0x4] - ldr r0, =0x00003c1a - cmp r1, r0 - beq _08139EEC - movs r0, 0x1 - b _08139EEE - .pool -_08139EEC: - movs r0, 0 -_08139EEE: - pop {r1} - bx r1 - thumb_func_end sub_8139ED0 - - thumb_func_start UpdateFrontierManiac -UpdateFrontierManiac: @ 8139EF4 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =0x0000402f - bl GetVarPointer - adds r5, r0, 0 - ldrh r0, [r5] - adds r4, r0 - strh r4, [r5] - ldrh r0, [r5] - movs r1, 0xA - bl __umodsi3 - strh r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end UpdateFrontierManiac - - thumb_func_start sub_8139F20 -sub_8139F20: @ 8139F20 - push {r4-r7,lr} - movs r4, 0 - ldr r0, =0x0000402f - bl VarGet - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x9 - bls _08139F34 - b _0813A03A -_08139F34: - lsls r0, r6, 2 - ldr r1, =_08139F48 - adds r1, r0, r1 - ldr r1, [r1] - adds r2, r0, 0 - mov pc, r1 - .pool - .align 2, 0 -_08139F48: - .4byte _08139F70 - .4byte _08139F70 - .4byte _08139F70 - .4byte _08139F70 - .4byte _08139F94 - .4byte _08139FB4 - .4byte _08139FCC - .4byte _08139FE4 - .4byte _08139FFC - .4byte _0813A014 -_08139F70: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - movs r3, 0xCE - lsls r3, 4 - adds r1, r0, r3 - adds r3, r1, r2 - ldr r1, =0x00000ce2 - adds r0, r1 - adds r1, r0, r2 - ldrh r0, [r3] - ldrh r2, [r1] - cmp r0, r2 - bcs _0813A028 - b _0813A038 - .pool -_08139F94: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r3, =0x00000d0c - adds r2, r0, r3 - adds r3, 0x2 -_08139F9E: - adds r1, r0, r3 - ldrh r0, [r2] - ldrh r3, [r1] - cmp r0, r3 - bcs _0813A028 - b _0813A038 - .pool -_08139FB4: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000de2 - adds r2, r0, r1 - ldr r3, =0x00000de4 - b _08139F9E - .pool -_08139FCC: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000dc8 - adds r2, r0, r1 - ldr r3, =0x00000dca - b _08139F9E - .pool -_08139FE4: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000dda - adds r2, r0, r1 - ldr r3, =0x00000ddc - b _08139F9E - .pool -_08139FFC: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000e04 - adds r2, r0, r1 - ldr r3, =0x00000e06 - b _08139F9E - .pool -_0813A014: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000e1a - adds r2, r0, r1 - ldr r3, =0x00000e1c - adds r1, r0, r3 - ldrh r0, [r2] - ldrh r3, [r1] - cmp r0, r3 - bcc _0813A038 -_0813A028: - adds r4, r0, 0 - b _0813A03A - .pool -_0813A038: - ldrh r4, [r1] -_0813A03A: - movs r2, 0 - ldr r5, =gUnknown_085B2CC8 - lsls r0, r6, 1 - adds r1, r0, r5 - ldrb r1, [r1] - adds r3, r0, 0 - ldr r7, =gUnknown_085B2C50 - cmp r1, r4 - bcs _0813A062 - adds r1, r3, 0 -_0813A04E: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x1 - bhi _0813A062 - adds r0, r2, r1 - adds r0, r5 - ldrb r0, [r0] - cmp r0, r4 - bcc _0813A04E -_0813A062: - adds r0, r3, r6 - adds r0, r2 - lsls r0, 2 - adds r0, r7 - ldr r0, [r0] - bl ShowFieldMessage - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8139F20 - - thumb_func_start sub_813A080 -sub_813A080: @ 813A080 - push {r4-r7,lr} - ldr r0, =0x000040ce - bl VarGet - lsls r0, 16 - lsrs r5, r0, 16 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000ca9 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 30 - lsrs r4, r0, 30 - cmp r5, 0x2 - bne _0813A0D8 - movs r0, 0xA9 - lsls r0, 1 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - bne _0813A0D8 - ldr r1, =gSpecialVar_0x8005 - movs r0, 0x5 - strh r0, [r1] - ldr r1, =gSpecialVar_0x8006 - movs r0, 0x4 - strh r0, [r1] - b _0813A110 - .pool -_0813A0D0: - movs r0, 0x4 - strh r0, [r6] - adds r0, r3, 0x5 - b _0813A10E -_0813A0D8: - movs r3, 0 - ldr r6, =gSpecialVar_0x8005 - ldr r7, =gSpecialVar_0x8006 - lsls r1, r4, 1 - lsls r2, r5, 2 - ldr r4, =gUnknown_085B2CDC - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - adds r1, r2 - movs r2, 0xCE - lsls r2, 4 - adds r0, r2 - adds r0, r1 - ldrh r1, [r0] -_0813A0F4: - lsls r0, r3, 1 - adds r0, r4 - ldrh r0, [r0] - cmp r0, r1 - bhi _0813A0D0 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x8 - bls _0813A0F4 - movs r0, 0x4 - strh r0, [r6] - movs r0, 0xC -_0813A10E: - strh r0, [r7] -_0813A110: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A080 - - thumb_func_start sub_813A128 -sub_813A128: @ 813A128 - push {r4,lr} - ldr r0, =sub_813A2DC - movs r1, 0x8 - bl CreateTask - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks - adds r3, r0, r1 - ldr r1, =gSpecialVar_0x8004 - ldrh r0, [r1] - strh r0, [r3, 0x1E] - ldrh r0, [r1] - cmp r0, 0xC - bls _0813A14E - b _0813A2C6 -_0813A14E: - lsls r0, 2 - ldr r1, =_0813A168 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813A168: - .4byte _0813A19C - .4byte _0813A1AA - .4byte _0813A1C2 - .4byte _0813A1D6 - .4byte _0813A1F0 - .4byte _0813A208 - .4byte _0813A222 - .4byte _0813A23C - .4byte _0813A25A - .4byte _0813A274 - .4byte _0813A274 - .4byte _0813A28E - .4byte _0813A2A8 -_0813A19C: - movs r1, 0 - movs r0, 0x1 - strh r0, [r3, 0x8] - strh r0, [r3, 0xA] - strh r0, [r3, 0xC] - strh r0, [r3, 0xE] - b _0813A2BC -_0813A1AA: - movs r1, 0 - movs r0, 0x5 - strh r0, [r3, 0x8] - movs r0, 0x8 - strh r0, [r3, 0xA] - movs r0, 0x1 - strh r0, [r3, 0xC] - strh r0, [r3, 0xE] - movs r0, 0x9 - strh r0, [r3, 0x10] - movs r0, 0xA - b _0813A2BE -_0813A1C2: - movs r2, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - movs r1, 0xC - strh r1, [r3, 0xA] - movs r0, 0x1 - strh r0, [r3, 0xC] - strh r0, [r3, 0xE] - movs r0, 0x7 - b _0813A250 -_0813A1D6: - movs r1, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - movs r0, 0xB - strh r0, [r3, 0xA] - movs r0, 0xE - strh r0, [r3, 0xC] - movs r0, 0x1 - strh r0, [r3, 0xE] - movs r0, 0xF - strh r0, [r3, 0x10] - movs r0, 0xC - b _0813A2BE -_0813A1F0: - movs r1, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - strh r0, [r3, 0xA] - movs r0, 0xE - strh r0, [r3, 0xC] - movs r0, 0x1 - strh r0, [r3, 0xE] - movs r0, 0xF - strh r0, [r3, 0x10] - movs r0, 0xC - b _0813A2BE -_0813A208: - movs r1, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - movs r0, 0x7 - strh r0, [r3, 0xA] - movs r0, 0xE - strh r0, [r3, 0xC] - movs r0, 0x1 - strh r0, [r3, 0xE] - movs r0, 0xF - strh r0, [r3, 0x10] - movs r0, 0xC - b _0813A2BE -_0813A222: - movs r1, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - movs r0, 0xA - strh r0, [r3, 0xA] - movs r0, 0xE - strh r0, [r3, 0xC] - movs r0, 0x1 - strh r0, [r3, 0xE] - movs r0, 0xF - strh r0, [r3, 0x10] - movs r0, 0xC - b _0813A2BE -_0813A23C: - movs r2, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - movs r1, 0xC - strh r1, [r3, 0xA] - movs r0, 0xF - strh r0, [r3, 0xC] - movs r0, 0x1 - strh r0, [r3, 0xE] - movs r0, 0xE -_0813A250: - strh r0, [r3, 0x10] - strh r1, [r3, 0x12] - strh r2, [r3, 0x14] - strh r4, [r3, 0x26] - b _0813A2D2 -_0813A25A: - movs r1, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - movs r0, 0xA - strh r0, [r3, 0xA] - movs r0, 0x11 - strh r0, [r3, 0xC] - movs r0, 0x1 - strh r0, [r3, 0xE] - movs r0, 0xB - strh r0, [r3, 0x10] - movs r0, 0xC - b _0813A2BE -_0813A274: - movs r1, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - movs r0, 0xB - strh r0, [r3, 0xA] - movs r0, 0xF - strh r0, [r3, 0xC] - movs r0, 0x1 - strh r0, [r3, 0xE] - movs r0, 0xE - strh r0, [r3, 0x10] - movs r0, 0xC - b _0813A2BE -_0813A28E: - movs r1, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - movs r0, 0x7 - strh r0, [r3, 0xA] - movs r0, 0x13 - strh r0, [r3, 0xC] - movs r0, 0x1 - strh r0, [r3, 0xE] - movs r0, 0xA - strh r0, [r3, 0x10] - movs r0, 0xC - b _0813A2BE -_0813A2A8: - movs r1, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - movs r0, 0x7 - strh r0, [r3, 0xA] - movs r0, 0x11 - strh r0, [r3, 0xC] - movs r0, 0x1 - strh r0, [r3, 0xE] - movs r0, 0xC -_0813A2BC: - strh r0, [r3, 0x10] -_0813A2BE: - strh r0, [r3, 0x12] - strh r1, [r3, 0x14] - strh r4, [r3, 0x26] - b _0813A2D2 -_0813A2C6: - ldr r1, =gSpecialVar_Result - movs r0, 0x7F - strh r0, [r1] - adds r0, r4, 0 - bl DestroyTask -_0813A2D2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A128 - - thumb_func_start sub_813A2DC -sub_813A2DC: @ 813A2DC - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x20 - lsls r0, 24 - lsrs r7, r0, 24 - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - ldr r1, =gTasks - adds r6, r0, r1 - bl ScriptContext2_Enable - ldr r0, =gUnknown_0203AB68 - movs r5, 0 - strh r5, [r0] - ldr r1, =gUnknown_0203AB6C - movs r0, 0x40 - strb r0, [r1] - ldrh r0, [r6, 0x1E] - movs r1, 0 - bl sub_813AA60 - ldrb r0, [r6, 0x1E] - movs r1, 0 - bl sub_813ACE8 - ldr r4, =gUnknown_0203AB64 - movs r1, 0xA - ldrsh r0, [r6, r1] - lsls r0, 3 - bl AllocZeroed - str r0, [r4] - ldr r0, =gUnknown_0203AB6A - strh r5, [r0] - bl sub_813A42C - movs r3, 0 - movs r4, 0 - movs r2, 0xA - ldrsh r0, [r6, r2] - add r1, sp, 0x18 - mov r8, r1 - cmp r3, r0 - bge _0813A36A - ldr r5, =gUnknown_085B2CF0 -_0813A33A: - lsls r1, r4, 2 - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - lsls r0, 6 - adds r1, r0 - adds r1, r5 - ldr r0, [r1] - ldr r1, =gUnknown_0203AB64 - ldr r2, [r1] - lsls r1, r4, 3 - adds r1, r2 - str r0, [r1] - str r4, [r1, 0x4] - adds r1, r3, 0 - bl display_text_and_get_width - adds r3, r0, 0 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - movs r2, 0xA - ldrsh r0, [r6, r2] - cmp r4, r0 - blt _0813A33A -_0813A36A: - adds r0, r3, 0 - bl convert_pixel_width_to_tile_width - strh r0, [r6, 0x10] - movs r1, 0xC - ldrsh r0, [r6, r1] - movs r2, 0x10 - ldrsh r1, [r6, r2] - adds r0, r1 - cmp r0, 0x1D - ble _0813A38C - movs r0, 0x1D - subs r0, r1 - cmp r0, 0 - bge _0813A38A - movs r0, 0 -_0813A38A: - strh r0, [r6, 0xC] -_0813A38C: - ldrb r2, [r6, 0xC] - ldrb r3, [r6, 0xE] - ldrb r0, [r6, 0x10] - str r0, [sp] - ldrb r0, [r6, 0x12] - str r0, [sp, 0x4] - movs r0, 0xF - str r0, [sp, 0x8] - movs r0, 0x64 - str r0, [sp, 0xC] - add r0, sp, 0x10 - movs r1, 0 - bl sub_8198A50 - ldr r0, [sp, 0x10] - ldr r1, [sp, 0x14] - str r0, [sp, 0x18] - str r1, [sp, 0x1C] - mov r0, r8 - bl AddWindow - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6, 0x22] - movs r1, 0 - bl SetStandardWindowBorderStyle - ldr r4, =gUnknown_030061D0 - ldrh r0, [r6, 0xA] - strh r0, [r4, 0xC] - ldrh r0, [r6, 0x8] - strh r0, [r4, 0xE] - ldrh r0, [r6, 0x22] - strb r0, [r4, 0x10] - adds r0, r7, 0 - bl sub_813A694 - ldrh r1, [r6, 0x16] - ldrh r2, [r6, 0x18] - adds r0, r4, 0 - bl ListMenuInit - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6, 0x24] - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_813A4EC - str r1, [r0] - add sp, 0x20 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A2DC - - thumb_func_start sub_813A42C -sub_813A42C: @ 813A42C - ldr r1, =gUnknown_030061D0 - ldr r0, =gUnknown_0203AB64 - ldr r0, [r0] - str r0, [r1] - ldr r0, =sub_813A46C - str r0, [r1, 0x4] - movs r0, 0 - str r0, [r1, 0x8] - movs r2, 0 - movs r0, 0x1 - strh r0, [r1, 0xC] - strh r0, [r1, 0xE] - strb r2, [r1, 0x10] - strb r2, [r1, 0x11] - movs r0, 0x8 - strb r0, [r1, 0x12] - strb r2, [r1, 0x13] - movs r0, 0x21 - strb r0, [r1, 0x14] - movs r0, 0x31 - strb r0, [r1, 0x15] - movs r0, 0 - strb r0, [r1, 0x16] - movs r0, 0x1 - strb r0, [r1, 0x17] - bx lr - .pool - thumb_func_end sub_813A42C - - thumb_func_start sub_813A46C -sub_813A46C: @ 813A46C - push {r4,r5,lr} - sub sp, 0x4 - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_813A4EC - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _0813A4D4 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r0, =gTasks - adds r4, r0 - ldrh r0, [r4, 0x24] - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - movs r2, 0 - bl get_coro_args_x18_x1A - ldr r1, =gUnknown_0203AB68 - mov r0, sp - ldrh r0, [r0] - strh r0, [r1] - ldrh r0, [r4, 0x24] - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - bl sub_81AE838 - ldrh r0, [r4, 0x1E] - ldr r5, =gUnknown_0203AB6A - ldrh r1, [r5] - bl sub_813AC44 - ldrh r0, [r4, 0x1E] - mov r1, sp - ldrh r1, [r1] - bl sub_813AA60 - ldrb r0, [r4, 0x1E] - mov r1, sp - ldrh r1, [r1] - bl sub_813AD34 - mov r0, sp - ldrh r0, [r0] - strh r0, [r5] -_0813A4D4: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A46C - - thumb_func_start sub_813A4EC -sub_813A4EC: @ 813A4EC - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks - adds r6, r0, r1 - ldrh r0, [r6, 0x24] - lsls r0, 24 - lsrs r0, 24 - bl ListMenuHandleInput - adds r4, r0, 0 - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _0813A51C - adds r0, 0x1 - cmp r4, r0 - bne _0813A530 - b _0813A566 - .pool -_0813A51C: - ldr r1, =gSpecialVar_Result - movs r0, 0x7F - strh r0, [r1] - movs r0, 0x5 - bl PlaySE - b _0813A54C - .pool -_0813A530: - ldr r0, =gSpecialVar_Result - strh r4, [r0] - movs r0, 0x5 - bl PlaySE - movs r1, 0x14 - ldrsh r0, [r6, r1] - cmp r0, 0 - beq _0813A54C - movs r1, 0xA - ldrsh r0, [r6, r1] - subs r0, 0x1 - cmp r4, r0 - bne _0813A558 -_0813A54C: - adds r0, r5, 0 - bl sub_813A570 - b _0813A566 - .pool -_0813A558: - adds r0, r5, 0 - bl sub_813A738 - ldr r0, =sub_813A600 - str r0, [r6] - bl EnableBothScriptContexts -_0813A566: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A4EC - - thumb_func_start sub_813A570 -sub_813A570: @ 813A570 - push {r4,r5,lr} - sub sp, 0x4 - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - ldr r0, =gTasks - adds r4, r0 - ldrh r0, [r4, 0x24] - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - bl sub_81AE838 - ldrh r0, [r4, 0x1E] - mov r1, sp - ldrh r1, [r1] - bl sub_813AC44 - adds r0, r5, 0 - bl sub_813A738 - ldrh r0, [r4, 0x24] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - movs r2, 0 - bl sub_81AE6C8 - ldr r0, =gUnknown_0203AB64 - ldr r0, [r0] - bl Free - ldrh r0, [r4, 0x22] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - bl sub_8198070 - ldrh r0, [r4, 0x22] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl FillWindowPixelBuffer - ldrh r0, [r4, 0x22] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl CopyWindowToVram - ldrh r0, [r4, 0x22] - lsls r0, 24 - lsrs r0, 24 - bl RemoveWindow - adds r0, r5, 0 - bl DestroyTask - bl EnableBothScriptContexts - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A570 - - thumb_func_start sub_813A600 -sub_813A600: @ 813A600 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r2, 0x14 - ldrsh r0, [r1, r2] - cmp r0, 0x1 - beq _0813A624 - cmp r0, 0x2 - bne _0813A624 - movs r0, 0x1 - strh r0, [r1, 0x14] - ldr r0, =sub_813A664 - str r0, [r1] -_0813A624: - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A600 - - thumb_func_start sub_813A630 -sub_813A630: @ 813A630 - push {lr} - ldr r0, =sub_813A600 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xFF - bne _0813A64C - bl EnableBothScriptContexts - b _0813A65C - .pool -_0813A64C: - ldr r0, =gTasks - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x14] - adds r0, 0x1 - strh r0, [r1, 0x14] -_0813A65C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A630 - - thumb_func_start sub_813A664 -sub_813A664: @ 813A664 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl ScriptContext2_Enable - adds r0, r4, 0 - bl sub_813A694 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_813A4EC - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A664 - - thumb_func_start sub_813A694 -sub_813A694: @ 813A694 - push {r4,r5,lr} - sub sp, 0x10 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks - adds r4, r1, r0 - mov r1, sp - ldr r0, =gUnknown_085B3030 - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldr r0, [r0] - str r0, [r1] - movs r0, 0x8 - ldrsh r1, [r4, r0] - movs r2, 0xA - ldrsh r0, [r4, r2] - cmp r1, r0 - beq _0813A724 - mov r2, sp - movs r3, 0x10 - ldrsh r1, [r4, r3] - lsrs r0, r1, 31 - adds r1, r0 - asrs r1, 1 - lsls r1, 3 - adds r1, 0xC - movs r5, 0xC - ldrsh r0, [r4, r5] - subs r0, 0x1 - lsls r0, 3 - adds r1, r0 - movs r3, 0 - strb r1, [r2, 0x1] - mov r1, sp - movs r0, 0x8 - strb r0, [r1, 0x2] - movs r0, 0x10 - ldrsh r1, [r4, r0] - lsrs r0, r1, 31 - adds r1, r0 - asrs r1, 1 - lsls r1, 3 - adds r1, 0xC - movs r5, 0xC - ldrsh r0, [r4, r5] - subs r0, 0x1 - lsls r0, 3 - adds r1, r0 - strb r1, [r2, 0x4] - mov r1, sp - movs r2, 0x12 - ldrsh r0, [r4, r2] - lsls r0, 3 - adds r0, 0xA - strb r0, [r1, 0x5] - mov r0, sp - strh r3, [r0, 0x6] - mov r2, sp - ldrh r0, [r4, 0xA] - ldrh r1, [r4, 0x8] - subs r0, r1 - strh r0, [r2, 0x8] - ldr r1, =gUnknown_0203AB68 - mov r0, sp - bl AddScrollIndicatorArrowPair - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x20] -_0813A724: - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A694 - - thumb_func_start sub_813A738 -sub_813A738: @ 813A738 - push {lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks - adds r2, r1, r0 - movs r0, 0x8 - ldrsh r1, [r2, r0] - movs r3, 0xA - ldrsh r0, [r2, r3] - cmp r1, r0 - beq _0813A75E - ldrh r0, [r2, 0x20] - lsls r0, 24 - lsrs r0, 24 - bl RemoveScrollIndicatorArrowPair -_0813A75E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A738 - - thumb_func_start nullsub_55 -nullsub_55: @ 813A768 - bx lr - thumb_func_end nullsub_55 - - thumb_func_start sub_813A76C -sub_813A76C: @ 813A76C - push {r4-r6,lr} - movs r4, 0 - ldr r6, =gLinkPlayers - ldr r0, =0x0000401f - adds r5, r0, 0 -_0813A776: - lsls r0, r4, 3 - subs r0, r4 - lsls r0, 2 - adds r0, r6 - ldrb r0, [r0, 0x13] - cmp r0, 0 - bne _0813A79C - subs r0, r5, r4 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0 - bl VarSet - b _0813A7A8 - .pool -_0813A79C: - subs r0, r5, r4 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x69 - bl VarSet -_0813A7A8: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x1 - bls _0813A776 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_813A76C - - thumb_func_start sub_813A7B8 -sub_813A7B8: @ 813A7B8 - push {lr} - ldr r1, =gSpecialVar_0x8004 - ldrh r0, [r1] - cmp r0, 0x5 - bls _0813A7C6 - movs r0, 0 - strh r0, [r1] -_0813A7C6: - ldrh r1, [r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - bl GetNature - lsls r0, 24 - ldr r1, =gUnknown_085B3040 - lsrs r0, 22 - adds r0, r1 - ldr r0, [r0] - bl ShowFieldMessage - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A7B8 - - thumb_func_start UpdateFrontierGambler -UpdateFrontierGambler: @ 813A7F4 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =0x00004030 - bl GetVarPointer - adds r5, r0, 0 - ldrh r0, [r5] - adds r4, r0 - strh r4, [r5] - ldrh r0, [r5] - movs r1, 0xC - bl __umodsi3 - strh r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end UpdateFrontierGambler - - thumb_func_start sub_813A820 -sub_813A820: @ 813A820 - push {r4,lr} - ldr r0, =0x00004030 - bl VarGet - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r1, =gUnknown_085B30A4 - lsls r0, r4, 2 - adds r0, r1 - ldr r0, [r0] - bl ShowFieldMessage - ldr r0, =0x00004031 - adds r1, r4, 0 - bl VarSet - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A820 - - thumb_func_start sub_813A854 -sub_813A854: @ 813A854 - push {r4,lr} - ldr r4, =gUnknown_085B30D4 - ldr r0, =0x00004031 - bl VarGet - lsls r0, 16 - lsrs r0, 14 - adds r0, r4 - ldr r0, [r0] - bl ShowFieldMessage - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A854 - - thumb_func_start sub_813A878 -sub_813A878: @ 813A878 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r0, =0x000040ce - bl VarGet - lsls r0, 16 - lsrs r7, r0, 16 - ldr r0, =0x00004031 - bl VarGet - lsls r0, 16 - lsrs r6, r0, 16 - ldr r0, =0x000040cf - bl VarGet - lsls r0, 16 - lsrs r5, r0, 16 - ldr r4, =0x00004033 - adds r0, r4, 0 - bl VarGet - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1 - bne _0813A8F0 - ldr r1, =gUnknown_085B3104 - lsls r0, r6, 1 - adds r0, r1 - ldrh r1, [r0] - lsls r0, r5, 8 - adds r0, r7 - cmp r1, r0 - bne _0813A8F0 - mov r0, r8 - cmp r0, 0 - beq _0813A8E8 - adds r0, r4, 0 - movs r1, 0x2 - bl VarSet - b _0813A8F0 - .pool -_0813A8E8: - adds r0, r4, 0 - movs r1, 0x3 - bl VarSet -_0813A8F0: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_813A878 - - thumb_func_start sub_813A8FC -sub_813A8FC: @ 813A8FC - push {lr} - sub sp, 0x2C - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000eb8 - adds r0, r1 - ldrh r1, [r0] - add r0, sp, 0xC - movs r2, 0x1 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - ldr r1, =gText_BP - bl StringCopy - movs r0, 0x1 - add r1, sp, 0xC - movs r2, 0x30 - bl GetStringRightAlignXOffset - adds r3, r0, 0 - ldr r0, =gUnknown_0203AB6D - ldrb r0, [r0] - lsls r3, 24 - lsrs r3, 24 - movs r1, 0x1 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x1 - add r2, sp, 0xC - bl PrintTextOnWindow - add sp, 0x2C - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A8FC - - thumb_func_start sub_813A958 -sub_813A958: @ 813A958 - push {r4,lr} - ldr r4, =gUnknown_0203AB6D - ldr r0, =gUnknown_085B311C - bl AddWindow - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0 - bl SetStandardWindowBorderStyle - bl sub_813A8FC - ldrb r0, [r4] - movs r1, 0x2 - bl CopyWindowToVram - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A958 - - thumb_func_start sub_813A988 -sub_813A988: @ 813A988 - push {r4,lr} - ldr r4, =gUnknown_0203AB6D - ldrb r0, [r4] - movs r1, 0x1 - bl sub_8198070 - ldrb r0, [r4] - bl RemoveWindow - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A988 - - thumb_func_start sub_813A9A4 -sub_813A9A4: @ 813A9A4 - push {lr} - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r2, =0x00000eb8 - adds r1, r0, r2 - ldr r0, =gSpecialVar_0x8004 - ldrh r2, [r1] - ldrh r0, [r0] - cmp r2, r0 - bcs _0813A9C8 - movs r0, 0 - b _0813A9CA - .pool -_0813A9C8: - subs r0, r2, r0 -_0813A9CA: - strh r0, [r1] - pop {r0} - bx r0 - thumb_func_end sub_813A9A4 - - thumb_func_start sub_813A9D0 -sub_813A9D0: @ 813A9D0 - push {lr} - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000eb8 - adds r2, r0, r1 - ldrh r1, [r2] - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - adds r1, r0 - ldr r0, =0x0000270f - cmp r1, r0 - ble _0813A9FC - strh r0, [r2] - b _0813A9FE - .pool -_0813A9FC: - strh r1, [r2] -_0813A9FE: - pop {r0} - bx r0 - thumb_func_end sub_813A9D0 - - thumb_func_start sub_813AA04 -sub_813AA04: @ 813AA04 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000eb8 - adds r0, r1 - ldrh r0, [r0] - bx lr - .pool - thumb_func_end sub_813AA04 - - thumb_func_start sub_813AA18 -sub_813AA18: @ 813AA18 - push {r4,lr} - ldr r4, =gUnknown_0203AB6E - ldr r0, =gUnknown_085B3124 - bl AddWindow - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0 - bl SetStandardWindowBorderStyle - ldrb r0, [r4] - movs r1, 0x2 - bl CopyWindowToVram - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813AA18 - - thumb_func_start sub_813AA44 -sub_813AA44: @ 813AA44 - push {r4,lr} - ldr r4, =gUnknown_0203AB6E - ldrb r0, [r4] - movs r1, 0x1 - bl sub_8198070 - ldrb r0, [r4] - bl RemoveWindow - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813AA44 - - thumb_func_start sub_813AA60 -sub_813AA60: @ 813AA60 - push {r4,r5,lr} - sub sp, 0x10 - lsls r0, 16 - lsls r1, 16 - lsrs r5, r1, 16 - lsrs r4, r0, 16 - ldr r1, =0xfffd0000 - adds r0, r1 - lsrs r0, 16 - cmp r0, 0x3 - bls _0813AA78 - b _0813ABC2 -_0813AA78: - movs r0, 0xD8 - str r0, [sp] - movs r0, 0x20 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0x11 - movs r2, 0 - movs r3, 0 - bl FillWindowPixelRect - cmp r4, 0x4 - beq _0813AAE8 - cmp r4, 0x4 - bgt _0813AAA0 - cmp r4, 0x3 - beq _0813AAAA - b _0813ABC2 - .pool -_0813AAA0: - cmp r4, 0x5 - beq _0813AB5C - cmp r4, 0x6 - beq _0813AB94 - b _0813ABC2 -_0813AAAA: - ldr r1, =gUnknown_085B3170 - lsls r0, r5, 2 - adds r0, r1 - ldr r2, [r0] - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - str r4, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParametrized - ldr r1, =gUnknown_085B312C - lsls r0, r5, 1 - adds r1, r0, r1 - ldrh r5, [r1] - ldr r0, =0x0000ffff - cmp r5, r0 - beq _0813AB18 - b _0813AB2C - .pool -_0813AAE8: - ldr r1, =gUnknown_085B319C - lsls r0, r5, 2 - adds r0, r1 - ldr r2, [r0] - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParametrized - ldr r1, =gUnknown_085B3142 - lsls r0, r5, 1 - adds r1, r0, r1 - ldrh r5, [r1] - ldr r0, =0x0000ffff - cmp r5, r0 - bne _0813AB2C -_0813AB18: - ldrh r0, [r1] - bl sub_813ABD4 - b _0813ABC2 - .pool -_0813AB2C: - ldr r4, =0x0000157c - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - lsls r0, r5, 24 - lsrs r0, 24 - str r4, [sp] - str r4, [sp, 0x4] - movs r1, 0x21 - movs r2, 0x58 - movs r3, 0 - bl AddDecorationIconObject - ldr r1, =gUnknown_0203AB6C - strb r0, [r1] - b _0813ABC2 - .pool -_0813AB5C: - ldr r1, =gUnknown_085B31B4 - lsls r0, r5, 2 - adds r0, r1 - ldr r2, [r0] - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParametrized - ldr r1, =gUnknown_085B314E - lsls r0, r5, 1 - adds r0, r1 - ldrh r0, [r0] - bl sub_813ABD4 - b _0813ABC2 - .pool -_0813AB94: - ldr r1, =gUnknown_085B31D0 - lsls r0, r5, 2 - adds r0, r1 - ldr r2, [r0] - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParametrized - ldr r1, =gUnknown_085B315C - lsls r0, r5, 1 - adds r0, r1 - ldrh r0, [r0] - bl sub_813ABD4 -_0813ABC2: - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813AA60 - - thumb_func_start sub_813ABD4 -sub_813ABD4: @ 813ABD4 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 16 - lsrs r5, 16 - ldr r4, =0x0000157c - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - adds r0, r4, 0 - adds r1, r4, 0 - adds r2, r5, 0 - bl AddItemIconObject - ldr r4, =gUnknown_0203AB6C - strb r0, [r4] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _0813AC32 - ldr r3, =gSprites - ldrb r0, [r4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - ldrb r2, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x5] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0x24 - strh r1, [r0, 0x20] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0x5C - strh r1, [r0, 0x22] -_0813AC32: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813ABD4 - - thumb_func_start sub_813AC44 -sub_813AC44: @ 813AC44 - push {lr} - lsls r0, 16 - lsrs r1, r0, 16 - ldr r2, =gUnknown_0203AB6C - ldrb r0, [r2] - cmp r0, 0x40 - beq _0813AC70 - cmp r1, 0x6 - bgt _0813AC6A - cmp r1, 0x3 - blt _0813AC6A - adds r1, r0, 0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySpriteAndFreeResources -_0813AC6A: - ldr r1, =gUnknown_0203AB6C - movs r0, 0x40 - strb r0, [r1] -_0813AC70: - pop {r0} - bx r0 - .pool - thumb_func_end sub_813AC44 - - thumb_func_start sub_813AC7C -sub_813AC7C: @ 813AC7C - push {lr} - ldr r0, =gSpecialVar_0x8005 - ldrh r0, [r0] - cmp r0, 0 - beq _0813ACB8 - ldr r0, =gStringVar1 - ldr r2, =gUnknown_085B320C - ldr r1, =gSpecialVar_0x8004 - ldrh r1, [r1] - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0xD - muls r1, r2 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - b _0813ACD2 - .pool -_0813ACB8: - ldr r0, =gStringVar1 - ldr r2, =gUnknown_085B31F8 - ldr r1, =gSpecialVar_0x8004 - ldrh r1, [r1] - lsls r1, 1 - adds r1, r2 - ldrh r2, [r1] - movs r1, 0xD - muls r1, r2 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy -_0813ACD2: - pop {r0} - bx r0 - .pool - thumb_func_end sub_813AC7C - - thumb_func_start sub_813ACE8 -sub_813ACE8: @ 813ACE8 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - lsls r1, 16 - lsrs r6, r1, 16 - subs r0, 0x9 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _0813AD20 - ldr r0, =gSpecialVar_0x8006 - ldrh r0, [r0] - cmp r0, 0 - bne _0813AD18 - ldr r4, =gUnknown_0203AB5E - ldr r0, =gUnknown_085B3220 - bl AddWindow - strb r0, [r4] - ldrb r0, [r4] - movs r1, 0 - bl SetStandardWindowBorderStyle -_0813AD18: - adds r0, r5, 0 - adds r1, r6, 0 - bl sub_813AD34 -_0813AD20: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813ACE8 - - thumb_func_start sub_813AD34 -sub_813AD34: @ 813AD34 - push {r4-r7,lr} - sub sp, 0xC - lsls r0, 24 - lsls r1, 16 - lsrs r5, r1, 16 - adds r7, r5, 0 - lsrs r6, r0, 24 - movs r1, 0xF7 - lsls r1, 24 - adds r0, r1 - lsrs r0, 24 - cmp r0, 0x1 - bhi _0813ADAC - ldr r4, =gUnknown_0203AB5E - ldrb r0, [r4] - movs r1, 0x60 - str r1, [sp] - movs r1, 0x30 - str r1, [sp, 0x4] - movs r1, 0x11 - movs r2, 0 - movs r3, 0 - bl FillWindowPixelRect - cmp r6, 0xA - bne _0813AD90 - ldrb r0, [r4] - ldr r2, =gUnknown_085B3254 - lsls r1, r5, 2 - adds r1, r2 - ldr r2, [r1] - movs r1, 0x1 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - b _0813ADAC - .pool -_0813AD90: - ldrb r0, [r4] - ldr r2, =gUnknown_085B3228 - lsls r1, r7, 2 - adds r1, r2 - ldr r2, [r1] - movs r1, 0x1 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow -_0813ADAC: - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813AD34 - - thumb_func_start sub_813ADB8 -sub_813ADB8: @ 813ADB8 - push {r4,lr} - ldr r4, =gUnknown_0203AB5E - ldrb r0, [r4] - movs r1, 0x1 - bl sub_8198070 - ldrb r0, [r4] - bl RemoveWindow - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813ADB8 - - thumb_func_start sub_813ADD4 -sub_813ADD4: @ 813ADD4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x18 - ldr r0, =sub_813A600 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xFF - beq _0813AE90 - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - ldr r1, =gTasks - adds r6, r0, r1 - ldrh r0, [r6, 0x24] - lsls r0, 24 - lsrs r0, 24 - mov r4, sp - adds r4, 0x16 - add r1, sp, 0x14 - adds r2, r4, 0 - bl get_coro_args_x18_x1A - ldrh r0, [r6, 0x22] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl SetStandardWindowBorderStyle - movs r5, 0 - mov r9, r4 - ldr r0, =gUnknown_085B2CF0 - mov r8, r0 - movs r4, 0 -_0813AE1E: - ldrh r0, [r6, 0x22] - lsls r0, 24 - lsrs r0, 24 - add r1, sp, 0x14 - ldrh r2, [r1] - adds r2, r5 - lsls r2, 2 - ldr r1, =gSpecialVar_0x8004 - ldrh r1, [r1] - lsls r1, 6 - adds r2, r1 - add r2, r8 - ldr r2, [r2] - lsls r1, r5, 28 - lsrs r1, 24 - str r1, [sp] - movs r7, 0xFF - str r7, [sp, 0x4] - str r4, [sp, 0x8] - str r4, [sp, 0xC] - str r4, [sp, 0x10] - movs r1, 0x1 - movs r3, 0xA - bl sub_8199F74 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _0813AE1E - ldrh r0, [r6, 0x22] - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gText_SelectorArrow - mov r3, r9 - ldrh r1, [r3] - lsls r1, 28 - lsrs r1, 24 - str r1, [sp] - str r7, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - ldrh r0, [r6, 0x22] - lsls r0, 24 - lsrs r0, 24 - bl PutWindowTilemap - ldrh r0, [r6, 0x22] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x3 - bl CopyWindowToVram -_0813AE90: - add sp, 0x18 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813ADD4 - - thumb_func_start sub_813AEB4 -sub_813AEB4: @ 813AEB4 - push {r4,lr} - movs r1, 0 - ldr r0, =gSpecialVar_0x8005 - strh r1, [r0] - ldr r0, =0x0000400e - bl VarGet - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =0x0000400d - bl VarGet - lsls r0, 16 - lsrs r1, r0, 16 - cmp r4, 0 - beq _0813AF18 - movs r2, 0 - lsls r1, 1 - ldr r3, =gUnknown_0861500C - ldr r0, =gUnknown_085B320C - adds r0, r1, r0 - ldrh r1, [r0] -_0813AEE2: - lsls r0, r2, 1 - adds r0, r3 - ldrh r0, [r0] - cmp r0, r1 - beq _0813AF0C - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x1D - bls _0813AEE2 - b _0813AF38 - .pool -_0813AF0C: - ldr r0, =gSpecialVar_0x8005 - strh r2, [r0] - b _0813AF38 - .pool -_0813AF18: - movs r2, 0 - lsls r1, 1 - ldr r3, =gUnknown_0861500C - ldr r0, =gUnknown_085B31F8 - adds r0, r1, r0 - ldrh r1, [r0] -_0813AF24: - lsls r0, r2, 1 - adds r0, r3 - ldrh r0, [r0] - cmp r0, r1 - beq _0813AF0C - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x1D - bls _0813AF24 -_0813AF38: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813AEB4 - - thumb_func_start sub_813AF48 -sub_813AF48: @ 813AF48 - push {r4,r5,lr} - ldr r0, =sub_813A600 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0xFF - beq _0813AFB6 - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - ldr r0, =gTasks - adds r4, r0 - ldrh r0, [r4, 0x24] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - movs r2, 0 - bl sub_81AE6C8 - ldr r0, =gUnknown_0203AB64 - ldr r0, [r0] - bl Free - ldrh r0, [r4, 0x22] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - bl sub_8198070 - ldrh r0, [r4, 0x22] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl FillWindowPixelBuffer - ldrh r0, [r4, 0x22] - lsls r0, 24 - lsrs r0, 24 - bl ClearWindowTilemap - ldrh r0, [r4, 0x22] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl CopyWindowToVram - ldrh r0, [r4, 0x22] - lsls r0, 24 - lsrs r0, 24 - bl RemoveWindow - adds r0, r5, 0 - bl DestroyTask -_0813AFB6: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813AF48 - - thumb_func_start sub_813AFC8 -sub_813AFC8: @ 813AFC8 - push {lr} - ldr r0, =task_deoxys_sound - movs r1, 0x8 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_813AFC8 - - thumb_func_start task_deoxys_sound -task_deoxys_sound: @ 813AFDC - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =0x000008d4 - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0813B004 - ldr r1, =gSpecialVar_Result - movs r0, 0x3 - b _0813B06A - .pool -_0813B004: - ldr r0, =0x00004035 - mov r8, r0 - bl VarGet - lsls r0, 16 - lsrs r5, r0, 16 - ldr r4, =0x00004034 - adds r0, r4, 0 - bl VarGet - lsls r0, 16 - lsrs r6, r0, 16 - adds r0, r4, 0 - movs r1, 0 - bl VarSet - cmp r5, 0 - beq _0813B05C - ldr r0, =gUnknown_085B33F6 - subs r1, r5, 0x1 - adds r1, r0 - ldrb r0, [r1] - cmp r0, r6 - bcs _0813B05C - movs r0, 0 - bl sub_813B0B4 - mov r0, r8 - movs r1, 0 - bl VarSet - ldr r1, =gSpecialVar_Result - movs r0, 0 - strh r0, [r1] - b _0813B070 - .pool -_0813B05C: - cmp r5, 0xA - bne _0813B080 - ldr r0, =0x000008d4 - bl FlagSet - ldr r1, =gSpecialVar_Result - movs r0, 0x2 -_0813B06A: - strh r0, [r1] - bl EnableBothScriptContexts -_0813B070: - adds r0, r7, 0 - bl DestroyTask - b _0813B0A2 - .pool -_0813B080: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - lsls r0, r5, 24 - lsrs r0, 24 - bl sub_813B0B4 - ldr r0, =0x00004035 - adds r1, r5, 0 - bl VarSet - ldr r1, =gSpecialVar_Result - movs r0, 0x1 - strh r0, [r1] - adds r0, r7, 0 - bl DestroyTask -_0813B0A2: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end task_deoxys_sound - - thumb_func_start sub_813B0B4 -sub_813B0B4: @ 813B0B4 - push {r4,r5,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 5 - ldr r1, =gUnknown_085B3280 - adds r0, r1 - movs r1, 0xD0 - lsls r1, 1 - movs r2, 0x8 - bl LoadPalette - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrb r1, [r0, 0x5] - ldrb r2, [r0, 0x4] - movs r0, 0x1 - mov r3, sp - bl TryGetFieldObjectIdByLocalIdAndMap - cmp r4, 0 - bne _0813B0F0 - movs r0, 0xC4 - bl PlaySE - b _0813B0F8 - .pool -_0813B0F0: - movs r0, 0x82 - lsls r0, 1 - bl PlaySE -_0813B0F8: - ldr r0, =sub_813B160 - movs r1, 0x8 - bl CreateTask - ldr r3, =gFieldEffectArguments - movs r0, 0x1 - str r0, [r3] - movs r0, 0x3A - str r0, [r3, 0x4] - movs r0, 0x1A - str r0, [r3, 0x8] - ldr r0, =gUnknown_085B33E0 - lsls r2, r4, 1 - adds r1, r2, r0 - ldrb r1, [r1] - str r1, [r3, 0xC] - adds r0, 0x1 - adds r0, r2, r0 - ldrb r0, [r0] - str r0, [r3, 0x10] - adds r5, r2, 0 - cmp r4, 0 - bne _0813B138 - movs r0, 0x3C - b _0813B13A - .pool -_0813B138: - movs r0, 0x5 -_0813B13A: - str r0, [r3, 0x14] - movs r0, 0x42 - bl FieldEffectStart - ldr r0, =gUnknown_085B33E0 - adds r1, r5, r0 - ldrb r1, [r1] - adds r0, 0x1 - adds r0, r5, r0 - ldrb r2, [r0] - movs r0, 0x1 - bl Overworld_SetMapObjTemplateCoords - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B0B4 - - thumb_func_start sub_813B160 -sub_813B160: @ 813B160 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x42 - bl FieldEffectActiveListContains - lsls r0, 24 - cmp r0, 0 - bne _0813B17C - bl EnableBothScriptContexts - adds r0, r4, 0 - bl DestroyTask -_0813B17C: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_813B160 - - thumb_func_start increment_var_x4026_on_birth_island_modulo_100 -increment_var_x4026_on_birth_island_modulo_100: @ 813B184 - push {r4,lr} - ldr r4, =0x00004034 - adds r0, r4, 0 - bl VarGet - lsls r0, 16 - lsrs r2, r0, 16 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrh r1, [r0, 0x4] - ldr r0, =0x00003a1a - cmp r1, r0 - bne _0813B1C8 - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x63 - bls _0813B1C0 - adds r0, r4, 0 - movs r1, 0 - bl VarSet - b _0813B1C8 - .pool -_0813B1C0: - adds r0, r4, 0 - adds r1, r2, 0 - bl VarSet -_0813B1C8: - pop {r4} - pop {r0} - bx r0 - thumb_func_end increment_var_x4026_on_birth_island_modulo_100 - - thumb_func_start sub_813B1D0 -sub_813B1D0: @ 813B1D0 - push {lr} - ldr r0, =0x00004035 - bl VarGet - lsls r0, 24 - lsrs r0, 19 - ldr r1, =gUnknown_085B3280 - adds r0, r1 - movs r1, 0xD0 - lsls r1, 1 - movs r2, 0x8 - bl LoadPalette - movs r0, 0x80 - lsls r0, 19 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B1D0 - - thumb_func_start set_unknown_box_id -@ void set_unknown_box_id(char id) -set_unknown_box_id: @ 813B204 - ldr r1, =gUnknown_0203AB6F - strb r0, [r1] - bx lr - .pool - thumb_func_end set_unknown_box_id - - thumb_func_start get_unknown_box_id -get_unknown_box_id: @ 813B210 - ldr r0, =gUnknown_0203AB6F - ldrb r0, [r0] - bx lr - .pool - thumb_func_end get_unknown_box_id - - thumb_func_start sub_813B21C -sub_813B21C: @ 813B21C - push {r4,r5,lr} - ldr r5, =0x000008d7 - adds r0, r5, 0 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - bne _0813B258 - bl StorageGetCurrentBox - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =0x00004036 - bl VarGet - lsls r0, 16 - lsrs r0, 16 - cmp r4, r0 - beq _0813B258 - adds r0, r5, 0 - bl FlagSet - movs r0, 0x1 - b _0813B25A - .pool -_0813B258: - movs r0, 0 -_0813B25A: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_813B21C - - thumb_func_start sub_813B260 -sub_813B260: @ 813B260 - push {r4-r7,lr} - ldr r0, =0x00004036 - bl VarGet - lsls r0, 24 - lsrs r0, 24 - bl set_unknown_box_id - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r4, r0, 24 -_0813B278: - movs r5, 0 - lsls r6, r4, 24 - lsls r7, r4, 16 -_0813B27E: - lsls r1, r5, 24 - lsrs r1, 24 - lsrs r0, r6, 24 - bl GetBoxedMonPtr - movs r1, 0xB - movs r2, 0 - bl GetBoxMonData - cmp r0, 0 - bne _0813B2C0 - bl get_unknown_box_id - lsls r0, 16 - lsrs r0, 16 - cmp r0, r4 - beq _0813B2A6 - ldr r0, =0x000008d7 - bl FlagClear -_0813B2A6: - ldr r0, =0x00004036 - lsrs r1, r7, 16 - bl VarSet - bl sub_813B21C - lsls r0, 24 - lsrs r0, 24 - b _0813B2DC - .pool -_0813B2C0: - adds r5, 0x1 - cmp r5, 0x1D - ble _0813B27E - adds r4, 0x1 - cmp r4, 0xE - bne _0813B2CE - movs r4, 0 -_0813B2CE: - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bne _0813B278 - movs r0, 0 -_0813B2DC: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_813B260 - - thumb_func_start sub_813B2E4 -sub_813B2E4: @ 813B2E4 - push {r4,lr} - bl Random - lsls r0, 16 - lsrs r4, r0, 16 - ldr r0, =0x00004038 - movs r1, 0 - bl VarSet - movs r0, 0xDF - lsls r0, 1 - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0813B340 - ldr r0, =0x000001bf - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0813B330 - ldr r0, =0x00004037 - movs r1, 0x7 - ands r4, r1 - adds r1, r4, 0 - adds r1, 0x9 - bl VarSet - b _0813B36A - .pool -_0813B330: - movs r0, 0x1 - ands r4, r0 - cmp r4, 0 - bne _0813B354 - bl Random - lsls r0, 16 - lsrs r4, r0, 16 -_0813B340: - ldr r0, =0x00004037 - movs r1, 0x7 - ands r4, r1 - adds r1, r4, 0x1 - bl VarSet - b _0813B36A - .pool -_0813B354: - bl Random - lsls r0, 16 - lsrs r4, r0, 16 - ldr r0, =0x00004037 - movs r1, 0x7 - ands r4, r1 - adds r1, r4, 0 - adds r1, 0x9 - bl VarSet -_0813B36A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B2E4 - - thumb_func_start sub_813B374 -sub_813B374: @ 813B374 - push {r4,lr} - ldr r0, =0x00004037 - bl VarGet - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =gStringVar1 - ldr r2, =gUnknown_085B3400 - subs r1, r4, 0x1 - adds r1, r2 - ldrb r1, [r1] - movs r2, 0 - bl GetMapName - cmp r4, 0x8 - bls _0813B3A8 - movs r0, 0x1 - b _0813B3AA - .pool -_0813B3A8: - movs r0, 0 -_0813B3AA: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_813B374 - - thumb_func_start sub_813B3B0 -sub_813B3B0: @ 813B3B0 - push {r4-r6,lr} - ldr r5, =0x00004038 - adds r0, r5, 0 - bl VarGet - lsls r0, 16 - lsrs r4, r0, 16 - ldr r0, =0x00004037 - bl VarGet - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0 - beq _0813B47C - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - ldr r0, =0x000003e7 - cmp r4, r0 - bls _0813B474 - adds r0, r5, 0 - movs r1, 0 - bl VarSet - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - movs r0, 0x4 - ldrsb r0, [r1, r0] - cmp r0, 0x18 - bne _0813B414 - movs r0, 0x5 - ldrsb r0, [r1, r0] - cmp r0, 0x69 - bgt _0813B414 - cmp r0, 0x65 - blt _0813B414 - ldr r0, =0x00004039 - movs r1, 0x1 - b _0813B478 - .pool -_0813B414: - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - movs r1, 0x4 - ldrsb r1, [r2, r1] - adds r3, r0, 0 - cmp r1, 0 - bne _0813B444 - movs r0, 0x5 - ldrsb r0, [r2, r0] - cmp r0, 0x34 - beq _0813B436 - cmp r0, 0x34 - blt _0813B444 - cmp r0, 0x38 - bgt _0813B444 - cmp r0, 0x36 - blt _0813B444 -_0813B436: - ldr r0, =0x00004039 - movs r1, 0x1 - b _0813B478 - .pool -_0813B444: - ldr r3, [r3] - movs r2, 0x5 - ldrsb r2, [r3, r2] - ldr r1, =gUnknown_085B3410 - subs r0, r6, 0x1 - adds r0, r1 - ldrb r0, [r0] - cmp r2, r0 - bne _0813B468 - movs r0, 0x4 - ldrsb r0, [r3, r0] - cmp r0, 0 - bne _0813B468 - movs r0, 0x1 - b _0813B47E - .pool -_0813B468: - ldr r0, =0x00004037 - movs r1, 0 - b _0813B478 - .pool -_0813B474: - adds r0, r5, 0 - adds r1, r4, 0 -_0813B478: - bl VarSet -_0813B47C: - movs r0, 0 -_0813B47E: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_813B3B0 - - thumb_func_start sub_813B484 -sub_813B484: @ 813B484 - push {lr} - movs r0, 0x2 - bl sub_80AB104 - pop {r0} - bx r0 - thumb_func_end sub_813B484 - - thumb_func_start sub_813B490 -sub_813B490: @ 813B490 - push {r4-r7,lr} - movs r3, 0 - ldr r0, =gSaveBlock1Ptr - ldr r4, [r0] - movs r6, 0x4 - ldrsb r6, [r4, r6] - ldr r5, =gUnknown_085B3420 - adds r0, r5, 0x2 - mov r12, r0 - adds r7, r5, 0x1 -_0813B4A4: - lsls r0, r3, 1 - adds r2, r0, r3 - adds r0, r2, r5 - ldrb r0, [r0] - cmp r6, r0 - bne _0813B4CC - movs r1, 0x5 - ldrsb r1, [r4, r1] - adds r0, r2, r7 - ldrb r0, [r0] - cmp r1, r0 - bne _0813B4CC - mov r1, r12 - adds r0, r2, r1 - ldrb r0, [r0] - b _0813B4D8 - .pool -_0813B4CC: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0xB - bls _0813B4A4 - movs r0, 0x1 -_0813B4D8: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_813B490 - - thumb_func_start sub_813B4E0 -sub_813B4E0: @ 813B4E0 - push {lr} - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - bl sub_81D15CC - cmp r0, 0 - blt _0813B50C - movs r1, 0xAE - lsls r1, 1 - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0813B50C - movs r0, 0x1 - b _0813B50E - .pool -_0813B50C: - movs r0, 0 -_0813B50E: - pop {r1} - bx r1 - thumb_func_end sub_813B4E0 - - thumb_func_start sub_813B514 -sub_813B514: @ 813B514 - push {lr} - ldr r0, =0x0000403f - bl VarGet - lsls r0, 16 - cmp r0, 0 - beq _0813B52C - movs r0, 0x1 - b _0813B52E - .pool -_0813B52C: - movs r0, 0 -_0813B52E: - pop {r1} - bx r1 - thumb_func_end sub_813B514 - - thumb_func_start sub_813B534 -sub_813B534: @ 813B534 - push {lr} - ldr r2, =gUnknown_0203AB70 - ldr r1, =gBattleTypeFlags - ldr r0, [r1] - str r0, [r2] - movs r0, 0 - str r0, [r1] - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0813B552 - ldr r0, =sub_80B3AF8 - movs r1, 0x5 - bl CreateTask -_0813B552: - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B534 - - thumb_func_start sub_813B568 -sub_813B568: @ 813B568 - push {lr} - ldr r0, =sub_813B57C - movs r1, 0x5 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B568 - - thumb_func_start sub_813B57C -sub_813B57C: @ 813B57C - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0x8 - ldrsh r0, [r0, r1] - cmp r0, 0x9 - bls _0813B596 - b _0813B7C6 -_0813B596: - lsls r0, 2 - ldr r1, =_0813B5A8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813B5A8: - .4byte _0813B5D0 - .4byte _0813B5E4 - .4byte _0813B614 - .4byte _0813B6B4 - .4byte _0813B6E4 - .4byte _0813B728 - .4byte _0813B764 - .4byte _0813B772 - .4byte _0813B784 - .4byte _0813B7A8 -_0813B5D0: - ldr r0, =sub_80B3AF8 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - beq _0813B5DE - b _0813B7C6 -_0813B5DE: - b _0813B790 - .pool -_0813B5E4: - bl sub_800A520 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0813B5F2 - b _0813B7C6 -_0813B5F2: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _0813B5FE - b _0813B790 -_0813B5FE: - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSpecialVar_0x8004 - movs r2, 0x2 - bl SendBlock - b _0813B708 - .pool -_0813B614: - bl GetBlockReceivedStatus - movs r1, 0x2 - ands r1, r0 - cmp r1, 0 - bne _0813B622 - b _0813B7C6 -_0813B622: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - beq _0813B62E - b _0813B790 -_0813B62E: - ldr r5, =gSpecialVar_0x8005 - ldr r0, =gBlockRecvBuffer - movs r1, 0x80 - lsls r1, 1 - adds r0, r1 - ldrh r0, [r0] - strh r0, [r5] - movs r0, 0x1 - bl ResetBlockReceivedFlag - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r0, 0x1 - bne _0813B668 - ldrh r1, [r5] - cmp r1, 0x1 - bne _0813B668 - ldr r0, =gSpecialVar_Result - strh r1, [r0] - b _0813B790 - .pool -_0813B668: - ldr r0, =gSpecialVar_0x8004 - ldrh r1, [r0] - adds r2, r0, 0 - cmp r1, 0 - bne _0813B68C - ldr r0, =gSpecialVar_0x8005 - ldrh r0, [r0] - cmp r0, 0x1 - bne _0813B68C - ldr r1, =gSpecialVar_Result - movs r0, 0x2 - b _0813B6AC - .pool -_0813B68C: - ldrh r0, [r2] - cmp r0, 0x1 - bne _0813B6A8 - ldr r0, =gSpecialVar_0x8005 - ldrh r0, [r0] - cmp r0, 0 - bne _0813B6A8 - ldr r1, =gSpecialVar_Result - movs r0, 0x3 - b _0813B6AC - .pool -_0813B6A8: - ldr r1, =gSpecialVar_Result - movs r0, 0 -_0813B6AC: - strh r0, [r1] - b _0813B790 - .pool -_0813B6B4: - bl sub_800A520 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0813B6C2 - b _0813B7C6 -_0813B6C2: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _0813B790 - bl bitmask_all_link_players_but_self - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSpecialVar_Result - movs r2, 0x2 - bl SendBlock - b _0813B708 - .pool -_0813B6E4: - bl GetBlockReceivedStatus - movs r1, 0x1 - ands r1, r0 - cmp r1, 0 - beq _0813B7C6 - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - beq _0813B790 - ldr r1, =gSpecialVar_Result - ldr r0, =gBlockRecvBuffer - ldrh r0, [r0] - strh r0, [r1] - movs r0, 0 - bl ResetBlockReceivedFlag -_0813B708: - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - b _0813B7C6 - .pool -_0813B728: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - bne _0813B74C - ldr r0, =gSpecialVar_Result - ldrh r0, [r0] - cmp r0, 0x2 - bne _0813B790 - ldr r0, =gText_YourPartnerHasRetired - bl ShowFieldAutoScrollMessage - b _0813B790 - .pool -_0813B74C: - ldr r0, =gSpecialVar_Result - ldrh r0, [r0] - cmp r0, 0x3 - bne _0813B790 - ldr r0, =gText_YourPartnerHasRetired - bl ShowFieldAutoScrollMessage - b _0813B790 - .pool -_0813B764: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - cmp r0, 0 - bne _0813B7C6 - b _0813B790 -_0813B772: - bl sub_800A520 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0813B7C6 - bl sub_800ADF8 - b _0813B790 -_0813B784: - bl sub_800A520 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0813B7C6 -_0813B790: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _0813B7C6 - .pool -_0813B7A8: - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - bne _0813B7B4 - bl sub_800AC34 -_0813B7B4: - ldr r0, =gBattleTypeFlags - ldr r1, =gUnknown_0203AB70 - ldr r1, [r1] - str r1, [r0] - bl EnableBothScriptContexts - adds r0, r4, 0 - bl DestroyTask -_0813B7C6: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B57C - - thumb_func_start sub_813B7D8 -sub_813B7D8: @ 813B7D8 - push {lr} - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r0, 0 - bne _0813B7F8 - ldr r2, =c2_exit_to_overworld_1_continue_scripts_restart_music - movs r0, 0 - movs r1, 0x1 - bl sub_81D6720 - b _0813B802 - .pool -_0813B7F8: - ldr r2, =c2_exit_to_overworld_1_continue_scripts_restart_music - movs r0, 0x1 - movs r1, 0 - bl sub_81D6720 -_0813B802: - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B7D8 - - thumb_func_start sub_813B80C -sub_813B80C: @ 813B80C - push {lr} - ldr r0, =sub_813B824 - movs r1, 0x8 - bl CreateTask - movs r0, 0x9D - bl PlaySE - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B80C - - thumb_func_start sub_813B824 -sub_813B824: @ 813B824 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrh r0, [r4, 0x2] - adds r0, 0x1 - strh r0, [r4, 0x2] - movs r0, 0x2 - ldrsh r1, [r4, r0] - ldr r0, =gSpecialVar_0x8005 - ldrh r0, [r0] - cmp r1, r0 - bne _0813B858 - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - movs r0, 0 - strh r0, [r4, 0x2] - movs r0, 0x9D - bl PlaySE -_0813B858: - movs r0, 0 - ldrsh r1, [r4, r0] - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - subs r0, 0x1 - cmp r1, r0 - bne _0813B86C - adds r0, r5, 0 - bl DestroyTask -_0813B86C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B824 - - thumb_func_start sub_813B880 -sub_813B880: @ 813B880 - push {lr} - ldr r0, =_fwalk - movs r1, 0x8 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r2, 0 - movs r0, 0x4 - strh r0, [r1, 0x8] - strh r0, [r1, 0xA] - strh r0, [r1, 0xC] - strh r2, [r1, 0xE] - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B880 - - thumb_func_start _fwalk -_fwalk: @ 813B8B0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - lsls r0, 2 - add r0, r9 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - movs r0, 0x6 - ldrsh r1, [r5, r0] - lsls r1, 1 - adds r1, r5 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - movs r1, 0x6 - ldrsh r0, [r5, r1] - lsls r0, 1 - adds r0, r5 - movs r2, 0 - ldrsh r0, [r0, r2] - cmp r0, 0 - bne _0813B94E - movs r6, 0 -_0813B8EA: - movs r4, 0 - lsls r3, r6, 3 - mov r10, r3 - adds r7, r6, 0x1 - mov r8, r7 -_0813B8F4: - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - movs r2, 0 - ldrsh r0, [r1, r2] - adds r0, r4 - adds r0, 0x6 - movs r3, 0x2 - ldrsh r1, [r1, r3] - adds r1, r6 - adds r1, 0x4 - ldr r7, =0x00000201 - adds r2, r4, r7 - add r2, r10 - movs r7, 0x6 - ldrsh r3, [r5, r7] - lsls r3, 5 - adds r2, r3 - lsls r2, 16 - lsrs r2, 16 - bl MapGridSetMetatileIdAt - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x2 - bls _0813B8F4 - mov r1, r8 - lsls r0, r1, 24 - lsrs r6, r0, 24 - cmp r6, 0x3 - bls _0813B8EA - bl DrawWholeMapView - ldrh r0, [r5, 0x6] - adds r0, 0x1 - strh r0, [r5, 0x6] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3 - bne _0813B94E - mov r0, r9 - bl DestroyTask - bl EnableBothScriptContexts -_0813B94E: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end _fwalk - - thumb_func_start sub_813B968 -sub_813B968: @ 813B968 - push {r4,r5,lr} - ldr r5, =gSpecialVar_Result - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - movs r1, 0x7 - bl __udivsi3 - strh r0, [r5] - ldrh r4, [r5] - adds r0, r4, 0 - movs r1, 0x14 - bl __udivsi3 - lsls r0, 16 - lsrs r0, 16 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 2 - subs r4, r1 - strh r4, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B968 - - thumb_func_start sub_813B9A0 -sub_813B9A0: @ 813B9A0 - push {lr} - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrh r1, [r0, 0x1C] - movs r0, 0xB0 - lsls r0, 4 - cmp r1, r0 - bne _0813B9B6 - movs r0, 0x3 - bl Overworld_SetHealLocationWarp -_0813B9B6: - pop {r0} - bx r0 - .pool - thumb_func_end sub_813B9A0 - - thumb_func_start sub_813B9C0 -sub_813B9C0: @ 813B9C0 - push {r4,lr} - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - movs r1, 0x4 - ldrsb r1, [r0, r1] - lsls r1, 8 - ldrb r0, [r0, 0x5] - lsls r0, 24 - asrs r0, 24 - adds r0, r1 - lsls r0, 16 - lsrs r3, r0, 16 - ldr r2, =gUnknown_085B3444 - ldrh r0, [r2] - ldr r1, =0x0000ffff - cmp r0, r1 - beq _0813BA06 - adds r4, r1, 0 - adds r1, r2, 0 -_0813B9E6: - ldrh r0, [r2] - cmp r0, r3 - bne _0813B9FC - movs r0, 0x1 - b _0813BA08 - .pool -_0813B9FC: - adds r1, 0x2 - adds r2, 0x2 - ldrh r0, [r1] - cmp r0, r4 - bne _0813B9E6 -_0813BA06: - movs r0, 0 -_0813BA08: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_813B9C0 - - thumb_func_start ResetFanClub -ResetFanClub: @ 813BA10 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x0000141e - adds r1, r0, r2 - movs r2, 0 - strh r2, [r1] - movs r1, 0xA1 - lsls r1, 5 - adds r0, r1 - strh r2, [r0] - bx lr - .pool - thumb_func_end ResetFanClub - - thumb_func_start sub_813BA30 -sub_813BA30: @ 813BA30 - push {lr} - bl sub_813BF44 - lsls r0, 24 - cmp r0, 0 - beq _0813BA52 - bl sub_813BCE8 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrh r0, [r0, 0xE] - movs r2, 0xA1 - lsls r2, 5 - adds r1, r2 - strh r0, [r1] -_0813BA52: - pop {r0} - bx r0 - .pool - thumb_func_end sub_813BA30 - - thumb_func_start sub_813BA60 -sub_813BA60: @ 813BA60 - push {r4,lr} - ldr r4, =gSaveBlock1Ptr - ldr r0, [r4] - ldr r1, =0x0000141e - adds r0, r1 - ldrh r0, [r0] - lsrs r0, 7 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0813BAB6 - bl sub_813BF60 - bl sub_813BD84 - ldr r1, [r4] - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrh r0, [r0, 0xE] - movs r2, 0xA1 - lsls r2, 5 - adds r1, r2 - strh r0, [r1] - ldr r0, =0x00000315 - bl FlagClear - ldr r0, =0x00000316 - bl FlagClear - ldr r0, =0x00000317 - bl FlagClear - movs r0, 0xC6 - lsls r0, 2 - bl FlagClear - ldr r0, =0x000002da - bl FlagClear - ldr r0, =0x00004095 - movs r1, 0x1 - bl VarSet -_0813BAB6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813BA60 - - thumb_func_start sub_813BADC -sub_813BADC: @ 813BADC - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =0x00004095 - bl VarGet - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - bne _0813BB58 - ldr r4, =gSaveBlock1Ptr - ldr r0, [r4] - ldr r5, =0x0000141e - adds r3, r0, r5 - ldrh r2, [r3] - movs r1, 0x7F - ands r1, r2 - ldr r0, =gUnknown_085B3470 - adds r0, r6, r0 - ldrb r0, [r0] - adds r1, r0 - cmp r1, 0x13 - ble _0813BB54 - bl sub_813BCA8 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - bhi _0813BB3C - bl sub_813BB74 - ldr r0, [r4] - adds r0, r5 - ldrh r2, [r0] - ldr r1, =0x0000ff80 - ands r1, r2 - strh r1, [r0] - b _0813BB58 - .pool -_0813BB3C: - ldr r2, [r4] - adds r2, r5 - ldrh r1, [r2] - ldr r0, =0x0000ff80 - ands r0, r1 - movs r1, 0x14 - orrs r0, r1 - strh r0, [r2] - b _0813BB58 - .pool -_0813BB54: - adds r0, r2, r0 - strh r0, [r3] -_0813BB58: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x0000141e - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x7F - ands r0, r1 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_813BADC - - thumb_func_start sub_813BB74 -sub_813BB74: @ 813BB74 - push {r4-r7,lr} - sub sp, 0x8 - movs r3, 0 - movs r5, 0 - ldr r7, =gSaveBlock1Ptr - ldr r2, =0x0000141e - movs r6, 0x1 -_0813BB82: - ldr r0, [r7] - adds r0, r2 - ldrh r1, [r0] - ldr r0, =gUnknown_085B3474 - adds r0, r5, r0 - ldrb r4, [r0] - asrs r1, r4 - ands r1, r6 - cmp r1, 0 - bne _0813BBC8 - adds r3, r5, 0 - str r2, [sp] - str r3, [sp, 0x4] - bl Random - adds r1, r6, 0 - ands r1, r0 - ldr r2, [sp] - ldr r3, [sp, 0x4] - cmp r1, 0 - beq _0813BBC8 - ldr r0, [r7] - adds r0, r2 - adds r1, r6, 0 - lsls r1, r4 - ldrh r2, [r0] - orrs r1, r2 - strh r1, [r0] - b _0813BBEA - .pool -_0813BBC8: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x7 - bls _0813BB82 - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldr r0, =0x0000141e - adds r2, r0 - ldr r1, =gUnknown_085B3474 - adds r1, r3, r1 - movs r0, 0x1 - ldrb r1, [r1] - lsls r0, r1 - ldrh r1, [r2] - orrs r0, r1 - strh r0, [r2] -_0813BBEA: - adds r0, r3, 0 - add sp, 0x8 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_813BB74 - - thumb_func_start sub_813BC00 -sub_813BC00: @ 813BC00 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r0, 0 - mov r10, r0 - bl sub_813BCA8 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1 - bne _0813BC2E - movs r0, 0 - b _0813BC8E -_0813BC1E: - mov r1, r8 - ldr r0, [r1] - add r0, r9 - lsls r4, r6 - ldrh r1, [r0] - eors r4, r1 - strh r4, [r0] - b _0813BC8C -_0813BC2E: - movs r5, 0 - ldr r2, =gSaveBlock1Ptr - mov r8, r2 - ldr r0, =0x0000141e - mov r9, r0 - movs r4, 0x1 -_0813BC3A: - mov r1, r8 - ldr r0, [r1] - add r0, r9 - ldrh r1, [r0] - ldr r7, =gUnknown_085B347C - adds r0, r5, r7 - ldrb r6, [r0] - asrs r1, r6 - ands r1, r4 - cmp r1, 0 - beq _0813BC5E - mov r10, r5 - bl Random - adds r1, r4, 0 - ands r1, r0 - cmp r1, 0 - bne _0813BC1E -_0813BC5E: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x7 - bls _0813BC3A - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x0000141e - adds r4, r0, r2 - ldrh r1, [r4] - mov r2, r10 - adds r0, r2, r7 - ldrb r2, [r0] - adds r0, r1, 0 - asrs r0, r2 - movs r3, 0x1 - ands r0, r3 - cmp r0, 0 - beq _0813BC8C - adds r0, r3, 0 - lsls r0, r2 - eors r1, r0 - strh r1, [r4] -_0813BC8C: - mov r0, r10 -_0813BC8E: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_813BC00 - - thumb_func_start sub_813BCA8 -sub_813BCA8: @ 813BCA8 - push {r4,r5,lr} - movs r3, 0 - movs r2, 0 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x0000141e - adds r0, r1 - ldrh r4, [r0] - movs r5, 0x1 -_0813BCBA: - adds r1, r2, 0 - adds r1, 0x8 - adds r0, r4, 0 - asrs r0, r1 - ands r0, r5 - cmp r0, 0 - beq _0813BCCE - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 -_0813BCCE: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x7 - bls _0813BCBA - adds r0, r3, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_813BCA8 - - thumb_func_start sub_813BCE8 -sub_813BCE8: @ 813BCE8 - push {r4-r6,lr} - movs r5, 0 - ldr r2, =gSaveBlock2Ptr - ldr r0, [r2] - ldrh r1, [r0, 0xE] - ldr r0, =0x000003e6 - cmp r1, r0 - bhi _0813BD58 - adds r6, r2, 0 - b _0813BD32 - .pool -_0813BD04: - ldr r0, [r6] - ldrh r1, [r0, 0xE] - ldr r4, =gSaveBlock1Ptr - ldr r0, [r4] - movs r2, 0xA1 - lsls r2, 5 - adds r0, r2 - ldrh r0, [r0] - subs r1, r0 - cmp r1, 0xB - ble _0813BD58 - bl sub_813BC00 - ldr r0, [r4] - movs r1, 0xA1 - lsls r1, 5 - adds r0, r1 - ldrh r1, [r0] - adds r1, 0xC - strh r1, [r0] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_0813BD32: - bl sub_813BCA8 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x4 - bhi _0813BD54 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r0, [r6] - ldrh r0, [r0, 0xE] - movs r2, 0xA1 - lsls r2, 5 - adds r1, r2 - strh r0, [r1] - b _0813BD58 - .pool -_0813BD54: - cmp r5, 0x8 - bne _0813BD04 -_0813BD58: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_813BCE8 - - thumb_func_start sub_813BD60 -sub_813BD60: @ 813BD60 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x0000141e - adds r0, r1 - ldrh r0, [r0] - ldr r1, =gSpecialVar_0x8004 - ldrh r1, [r1] - asrs r0, r1 - movs r1, 0x1 - ands r0, r1 - bx lr - .pool - thumb_func_end sub_813BD60 - - thumb_func_start sub_813BD84 -sub_813BD84: @ 813BD84 - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldr r0, =0x0000141e - adds r2, r0 - ldrh r1, [r2] - movs r3, 0x80 - lsls r3, 6 - adds r0, r3, 0 - orrs r0, r1 - movs r3, 0x80 - lsls r3, 1 - adds r1, r3, 0 - orrs r0, r1 - movs r3, 0x80 - lsls r3, 3 - adds r1, r3, 0 - orrs r0, r1 - strh r0, [r2] - bx lr - .pool - thumb_func_end sub_813BD84 - - thumb_func_start sub_813BDB4 -sub_813BDB4: @ 813BDB4 - push {lr} - movs r3, 0 - movs r2, 0 - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - subs r0, 0x8 - cmp r0, 0x7 - bhi _0813BE14 - lsls r0, 2 - ldr r1, =_0813BDD8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813BDD8: - .4byte _0813BE14 - .4byte _0813BE14 - .4byte _0813BDF8 - .4byte _0813BDFE - .4byte _0813BE04 - .4byte _0813BE0A - .4byte _0813BE10 - .4byte _0813BE14 -_0813BDF8: - movs r3, 0 - movs r2, 0x3 - b _0813BE14 -_0813BDFE: - movs r3, 0 - movs r2, 0x1 - b _0813BE14 -_0813BE04: - movs r3, 0x1 - movs r2, 0 - b _0813BE14 -_0813BE0A: - movs r3, 0 - movs r2, 0x4 - b _0813BE14 -_0813BE10: - movs r3, 0x1 - movs r2, 0x5 -_0813BE14: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003150 - adds r0, r1 - adds r1, r3, 0 - bl sub_813BE30 - pop {r0} - bx r0 - .pool - thumb_func_end sub_813BDB4 - - thumb_func_start sub_813BE30 -sub_813BE30: @ 813BE30 - push {r4-r6,lr} - adds r6, r0, 0 - lsls r1, 24 - lsrs r5, r1, 24 - lsls r2, 24 - lsrs r2, 24 - lsls r0, r5, 4 - adds r1, r6, r0 - ldrb r0, [r1] - cmp r0, 0xFF - bne _0813BEE8 - cmp r2, 0x5 - bhi _0813BED4 - lsls r0, r2, 2 - ldr r1, =_0813BE58 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813BE58: - .4byte _0813BED4 - .4byte _0813BE70 - .4byte _0813BE84 - .4byte _0813BE98 - .4byte _0813BEAC - .4byte _0813BEC0 -_0813BE70: - ldr r0, =gStringVar1 - ldr r1, =gText_Steven - bl StringCopy - b _0813BF04 - .pool -_0813BE84: - ldr r0, =gStringVar1 - ldr r1, =gText_Brawly - bl StringCopy - b _0813BF04 - .pool -_0813BE98: - ldr r0, =gStringVar1 - ldr r1, =gText_Winona - bl StringCopy - b _0813BF04 - .pool -_0813BEAC: - ldr r0, =gStringVar1 - ldr r1, =gText_Phoebe - bl StringCopy - b _0813BF04 - .pool -_0813BEC0: - ldr r0, =gStringVar1 - ldr r1, =gText_Glacia - bl StringCopy - b _0813BF04 - .pool -_0813BED4: - ldr r0, =gStringVar1 - ldr r1, =gText_Wallace - bl StringCopy - b _0813BF04 - .pool -_0813BEE8: - ldr r4, =gStringVar1 - adds r0, r4, 0 - movs r2, 0x7 - bl StringCopyN - movs r0, 0xFF - strb r0, [r4, 0x7] - adds r0, r6, 0 - adds r0, 0x50 - adds r0, r5 - ldrb r1, [r0] - adds r0, r4, 0 - bl ConvertInternationalString -_0813BF04: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813BE30 - - thumb_func_start sub_813BF10 -sub_813BF10: @ 813BF10 - push {lr} - ldr r0, =0x00004095 - bl VarGet - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - bne _0813BF40 - bl sub_813BA30 - ldr r0, =gBattleOutcome - ldrb r0, [r0] - cmp r0, 0x1 - bne _0813BF3C - bl sub_813BB74 - b _0813BF40 - .pool -_0813BF3C: - bl sub_813BC00 -_0813BF40: - pop {r0} - bx r0 - thumb_func_end sub_813BF10 - - thumb_func_start sub_813BF44 -sub_813BF44: @ 813BF44 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x0000141e - adds r0, r1 - ldrh r0, [r0] - lsrs r0, 7 - movs r1, 0x1 - ands r0, r1 - bx lr - .pool - thumb_func_end sub_813BF44 - - thumb_func_start sub_813BF60 -sub_813BF60: @ 813BF60 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r0, =0x0000141e - adds r1, r0 - ldrh r2, [r1] - movs r0, 0x80 - orrs r0, r2 - strh r0, [r1] - bx lr - .pool - thumb_func_end sub_813BF60 - - thumb_func_start sub_813BF7C -sub_813BF7C: @ 813BF7C - push {lr} - ldr r0, =gSpecialVar_0x8004 - ldrb r0, [r0] - bl sub_813BADC - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_813BF7C - + .align 2, 0 @ Don't pad with nop. diff --git a/asm/rom_81370FC.s b/asm/rom_81370FC.s new file mode 100644 index 000000000..02d8fb350 --- /dev/null +++ b/asm/rom_81370FC.s @@ -0,0 +1,9455 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .syntax unified + + .text + + thumb_func_start sub_81370FC +sub_81370FC: @ 81370FC + push {r4,lr} + bl ShouldDoBrailleFlyEffect + lsls r0, 24 + cmp r0, 0 + beq _08137134 + ldr r4, =gSpecialVar_Result + bl GetCursorSelectionMonId + lsls r0, 24 + lsrs r0, 24 + strh r0, [r4] + ldr r1, =gUnknown_03005DB0 + ldr r0, =hm_add_c3_launch_phase_2 + str r0, [r1] + ldr r1, =gUnknown_0203CEEC + ldr r0, =sub_8179918 + b _08137152 + .pool +_08137134: + ldr r0, =gMapHeader + ldrb r0, [r0, 0x15] + cmp r0, 0x1 + bne _08137170 + ldr r0, =0x00000888 + bl FlagGet + lsls r0, 24 + cmp r0, 0 + bne _08137170 + ldr r1, =gUnknown_03005DB0 + ldr r0, =hm_add_c3_launch_phase_2 + str r0, [r1] + ldr r1, =gUnknown_0203CEEC + ldr r0, =hm2_flash +_08137152: + str r0, [r1] + movs r0, 0x1 + b _08137172 + .pool +_08137170: + movs r0, 0 +_08137172: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_81370FC + + thumb_func_start hm2_flash +hm2_flash: @ 8137178 + push {r4,lr} + bl oei_task_add + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + bl GetCursorSelectionMonId + ldr r1, =gFieldEffectArguments + lsls r0, 24 + lsrs r0, 24 + str r0, [r1] + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + ldr r2, =sub_81371B4 + lsrs r1, r2, 16 + strh r1, [r0, 0x18] + strh r2, [r0, 0x1A] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end hm2_flash + + thumb_func_start sub_81371B4 +sub_81371B4: @ 81371B4 + push {lr} + movs r0, 0xCF + bl PlaySE + ldr r0, =0x00000888 + bl FlagSet + ldr r0, =EventScript_2926F8 + bl ScriptContext1_SetupScript + pop {r0} + bx r0 + .pool + thumb_func_end sub_81371B4 + + thumb_func_start sub_81371D4 +sub_81371D4: @ 81371D4 + push {lr} + bl RunTasks + bl AnimateSprites + bl BuildOamBuffer + bl UpdatePaletteFade + pop {r0} + bx r0 + thumb_func_end sub_81371D4 + + thumb_func_start sub_81371EC +sub_81371EC: @ 81371EC + push {lr} + bl LoadOam + bl ProcessSpriteCopyRequests + bl TransferPlttBuffer + pop {r0} + bx r0 + thumb_func_end sub_81371EC + + thumb_func_start c2_change_map +c2_change_map: @ 8137200 + push {r4,lr} + sub sp, 0x8 + movs r0, 0 + bl SetVBlankCallback + movs r0, 0 + movs r1, 0 + bl SetGpuReg + movs r0, 0xC + movs r1, 0 + bl SetGpuReg + movs r0, 0xA + movs r1, 0 + bl SetGpuReg + movs r0, 0x8 + movs r1, 0 + bl SetGpuReg + movs r0, 0x18 + movs r1, 0 + bl SetGpuReg + movs r0, 0x1A + movs r1, 0 + bl SetGpuReg + movs r0, 0x14 + movs r1, 0 + bl SetGpuReg + movs r0, 0x16 + movs r1, 0 + bl SetGpuReg + movs r0, 0x10 + movs r1, 0 + bl SetGpuReg + movs r0, 0x12 + movs r1, 0 + bl SetGpuReg + mov r1, sp + movs r0, 0 + strh r0, [r1] + ldr r1, =0x040000d4 + mov r0, sp + str r0, [r1] + movs r0, 0xC0 + lsls r0, 19 + str r0, [r1, 0x4] + ldr r0, =0x8100c000 + str r0, [r1, 0x8] + ldr r0, [r1, 0x8] + movs r4, 0 + str r4, [sp, 0x4] + add r0, sp, 0x4 + str r0, [r1] + movs r0, 0xE0 + lsls r0, 19 + str r0, [r1, 0x4] + ldr r0, =0x85000100 + str r0, [r1, 0x8] + ldr r0, [r1, 0x8] + mov r0, sp + strh r4, [r0] + str r0, [r1] + ldr r0, =0x05000002 + str r0, [r1, 0x4] + ldr r0, =0x810001ff + str r0, [r1, 0x8] + ldr r0, [r1, 0x8] + bl ResetPaletteFade + bl ResetTasks + bl ResetSpriteData + ldr r3, =0x04000208 + ldrh r2, [r3] + strh r4, [r3] + ldr r4, =0x04000200 + ldrh r0, [r4] + movs r1, 0x1 + orrs r0, r1 + strh r0, [r4] + strh r2, [r3] + ldr r0, =sub_81371EC + bl SetVBlankCallback + ldr r0, =sub_81371D4 + bl SetMainCallback2 + bl sub_8137304 + lsls r0, 24 + cmp r0, 0 + bne _081372D2 + ldr r0, =gMain + ldr r0, [r0, 0x8] + bl SetMainCallback2 +_081372D2: + add sp, 0x8 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end c2_change_map + + thumb_func_start sub_8137304 +sub_8137304: @ 8137304 + push {r4-r7,lr} + bl get_map_light_from_warp0 + lsls r0, 24 + lsrs r6, r0, 24 + bl sav1_map_get_light_level + lsls r0, 24 + lsrs r5, r0, 24 + movs r3, 0 + ldr r4, =gUnknown_085B27C8 + ldrb r0, [r4] + cmp r0, 0 + beq _08137358 + adds r7, r4, 0 + adds r0, r4, 0x4 + mov r12, r0 +_08137326: + lsls r2, r3, 3 + adds r1, r2, r7 + ldrb r0, [r1] + cmp r0, r6 + bne _08137348 + ldrb r0, [r1, 0x1] + cmp r0, r5 + bne _08137348 + mov r1, r12 + adds r0, r2, r1 + ldr r0, [r0] + bl _call_via_r0 + movs r0, 0x1 + b _0813735A + .pool +_08137348: + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + lsls r0, r3, 3 + adds r0, r4 + ldrb r0, [r0] + cmp r0, 0 + bne _08137326 +_08137358: + movs r0, 0 +_0813735A: + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8137304 + + thumb_func_start sub_8137360 +sub_8137360: @ 8137360 + push {r4-r6,lr} + lsls r0, 24 + lsls r1, 24 + lsrs r5, r0, 24 + lsrs r4, r1, 24 + movs r3, 0 + ldr r1, =gUnknown_085B27C8 + ldrb r0, [r1] + cmp r0, 0 + beq _081373A0 + adds r6, r1, 0 +_08137376: + lsls r0, r3, 3 + adds r2, r0, r6 + ldrb r0, [r2] + cmp r0, r5 + bne _08137390 + ldrb r0, [r2, 0x1] + cmp r0, r4 + bne _08137390 + ldrb r0, [r2, 0x2] + b _081373A2 + .pool +_08137390: + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + lsls r0, r3, 3 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _08137376 +_081373A0: + movs r0, 0 +_081373A2: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_8137360 + + thumb_func_start fade_type_for_given_maplight_pair +fade_type_for_given_maplight_pair: @ 81373A8 + push {r4-r6,lr} + lsls r0, 24 + lsls r1, 24 + lsrs r5, r0, 24 + lsrs r4, r1, 24 + movs r3, 0 + ldr r1, =gUnknown_085B27C8 + ldrb r0, [r1] + cmp r0, 0 + beq _081373E8 + adds r6, r1, 0 +_081373BE: + lsls r0, r3, 3 + adds r2, r0, r6 + ldrb r0, [r2] + cmp r0, r5 + bne _081373D8 + ldrb r0, [r2, 0x1] + cmp r0, r4 + bne _081373D8 + ldrb r0, [r2, 0x3] + b _081373EA + .pool +_081373D8: + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + lsls r0, r3, 3 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0 + bne _081373BE +_081373E8: + movs r0, 0 +_081373EA: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end fade_type_for_given_maplight_pair + + thumb_func_start sub_81373F0 +sub_81373F0: @ 81373F0 + push {lr} + ldr r0, =sub_8137404 + movs r1, 0 + bl CreateTask + pop {r0} + bx r0 + .pool + thumb_func_end sub_81373F0 + + thumb_func_start sub_8137404 +sub_8137404: @ 8137404 + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r1, r2 + ldr r0, =sub_8137420 + str r0, [r1] + bx lr + .pool + thumb_func_end sub_8137404 + + thumb_func_start sub_8137420 +sub_8137420: @ 8137420 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0 + movs r1, 0 + bl SetGpuReg + ldr r0, =gUnknown_085B2A90 + ldr r1, =0x0600c000 + bl LZ77UnCompVram + ldr r0, =gUnknown_085B28B0 + ldr r1, =0x0600f800 + bl LZ77UnCompVram + ldr r0, =gUnknown_085B2850 + movs r1, 0xE0 + movs r2, 0x20 + bl LoadPalette + ldr r0, =gUnknown_085B28A0 + movs r1, 0xE0 + movs r2, 0x10 + bl LoadPalette + ldr r1, =0x00003e41 + movs r0, 0x50 + bl SetGpuReg + movs r0, 0x52 + movs r1, 0 + bl SetGpuReg + movs r0, 0x54 + movs r1, 0 + bl SetGpuReg + ldr r1, =0x00001f0c + movs r0, 0x8 + bl SetGpuReg + movs r1, 0x8A + lsls r1, 5 + movs r0, 0 + bl SetGpuReg + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_81374C4 + str r1, [r0] + movs r2, 0 + movs r1, 0x10 + strh r1, [r0, 0x8] + strh r2, [r0, 0xA] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8137420 + + thumb_func_start sub_81374C4 +sub_81374C4: @ 81374C4 + push {r4,r5,lr} + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r5, r1, r2 + ldrh r4, [r5, 0xA] + movs r0, 0x80 + lsls r0, 5 + adds r1, r4, r0 + lsls r1, 16 + lsrs r1, 16 + movs r0, 0x52 + bl SetGpuReg + cmp r4, 0x10 + bhi _081374F8 + ldrh r0, [r5, 0xA] + adds r0, 0x1 + strh r0, [r5, 0xA] + b _08137500 + .pool +_081374F8: + movs r0, 0 + strh r0, [r5, 0xC] + ldr r0, =sub_813750C + str r0, [r5] +_08137500: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81374C4 + + thumb_func_start sub_813750C +sub_813750C: @ 813750C + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r1, =0x00001010 + movs r0, 0x52 + bl SetGpuReg + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r4, r0, r1 + ldrh r1, [r4, 0xC] + cmp r1, 0x7 + bhi _08137554 + adds r0, r1, 0x1 + strh r0, [r4, 0xC] + lsls r1, 1 + ldr r0, =gUnknown_085B28A0 + adds r0, r1, r0 + movs r2, 0x10 + subs r2, r1 + lsls r2, 16 + lsrs r2, 16 + movs r1, 0xE0 + bl LoadPalette + b _08137566 + .pool +_08137554: + ldr r0, =gUnknown_085B2850 + movs r1, 0 + movs r2, 0x20 + bl LoadPalette + ldr r0, =sub_8137574 + str r0, [r4] + movs r0, 0x8 + strh r0, [r4, 0xC] +_08137566: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813750C + + thumb_func_start sub_8137574 +sub_8137574: @ 8137574 + push {lr} + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r1, r2 + ldrh r2, [r1, 0xC] + movs r3, 0xC + ldrsh r0, [r1, r3] + cmp r0, 0 + beq _08137598 + subs r0, r2, 0x1 + strh r0, [r1, 0xC] + b _081375A0 + .pool +_08137598: + ldr r0, =gMain + ldr r0, [r0, 0x8] + bl SetMainCallback2 +_081375A0: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8137574 + + thumb_func_start sub_81375A8 +sub_81375A8: @ 81375A8 + push {lr} + ldr r0, =sub_81375BC + movs r1, 0 + bl CreateTask + pop {r0} + bx r0 + .pool + thumb_func_end sub_81375A8 + + thumb_func_start sub_81375BC +sub_81375BC: @ 81375BC + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r1, r2 + ldr r0, =sub_81375D8 + str r0, [r1] + bx lr + .pool + thumb_func_end sub_81375BC + + thumb_func_start sub_81375D8 +sub_81375D8: @ 81375D8 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + movs r0, 0 + movs r1, 0 + bl SetGpuReg + ldr r0, =gUnknown_085B2A90 + ldr r1, =0x0600c000 + bl LZ77UnCompVram + ldr r0, =gUnknown_085B28B0 + ldr r1, =0x0600f800 + bl LZ77UnCompVram + movs r0, 0x50 + movs r1, 0 + bl SetGpuReg + movs r0, 0x52 + movs r1, 0 + bl SetGpuReg + movs r0, 0x54 + movs r1, 0 + bl SetGpuReg + ldr r1, =0x00001f0c + movs r0, 0x8 + bl SetGpuReg + movs r1, 0x8A + lsls r1, 5 + movs r0, 0 + bl SetGpuReg + ldr r0, =gUnknown_085B2850 + movs r1, 0xE0 + movs r2, 0x20 + bl LoadPalette + ldr r0, =gUnknown_085B2870 + movs r1, 0 + movs r2, 0x20 + bl LoadPalette + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_8137678 + str r1, [r0] + movs r2, 0 + movs r1, 0x10 + strh r1, [r0, 0x8] + strh r2, [r0, 0xA] + strh r2, [r0, 0xC] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81375D8 + + thumb_func_start sub_8137678 +sub_8137678: @ 8137678 + push {r4,lr} + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r4, r1, r2 + ldrh r1, [r4, 0xC] + cmp r1, 0xF + bhi _081376B4 + adds r2, r1, 0x1 + adds r0, r2, 0x1 + strh r0, [r4, 0xC] + movs r0, 0xF + subs r0, r1 + lsls r0, 1 + ldr r1, =gUnknown_085B2890 + adds r0, r1 + lsls r2, 17 + lsrs r2, 16 + movs r1, 0xE0 + bl LoadPalette + b _081376C8 + .pool +_081376B4: + ldr r1, =0x00001010 + movs r0, 0x52 + bl SetGpuReg + ldr r1, =0x00003e41 + movs r0, 0x50 + bl SetGpuReg + ldr r0, =sub_81376DC + str r0, [r4] +_081376C8: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8137678 + + thumb_func_start sub_81376DC +sub_81376DC: @ 81376DC + push {r4,r5,lr} + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r5, r1, r2 + ldrh r0, [r5, 0xA] + movs r1, 0x10 + subs r1, r0 + lsls r1, 16 + lsrs r4, r1, 16 + movs r0, 0x80 + lsls r0, 21 + adds r1, r0 + lsrs r1, 16 + movs r0, 0x52 + bl SetGpuReg + cmp r4, 0 + beq _08137714 + ldrh r0, [r5, 0xA] + adds r0, 0x1 + strh r0, [r5, 0xA] + b _08137726 + .pool +_08137714: + ldr r0, =gUnknown_085B2870 + movs r1, 0 + movs r2, 0x20 + bl LoadPalette + ldr r0, =gMain + ldr r0, [r0, 0x8] + bl SetMainCallback2 +_08137726: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81376DC + + thumb_func_start sub_8137734 +sub_8137734: @ 8137734 + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x1C + bl HealPlayerParty + ldr r4, =0x00000864 + adds r0, r4, 0 + bl FlagGet + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0x1 + bne _08137760 + ldr r0, =gHasHallOfFameRecords + strb r1, [r0] + b _0813776C + .pool +_08137760: + ldr r1, =gHasHallOfFameRecords + movs r0, 0 + strb r0, [r1] + adds r0, r4, 0 + bl FlagSet +_0813776C: + movs r0, 0x1 + bl GetGameStat + cmp r0, 0 + bne _0813778E + ldr r0, =gSaveBlock2Ptr + ldr r2, [r0] + ldrh r1, [r2, 0xE] + lsls r1, 16 + ldrb r0, [r2, 0x10] + lsls r0, 8 + orrs r1, r0 + ldrb r0, [r2, 0x11] + orrs r1, r0 + movs r0, 0x1 + bl sav12_xor_set +_0813778E: + bl sub_8076D48 + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldrb r0, [r0, 0x8] + cmp r0, 0 + bne _081377AC + movs r0, 0x1 + bl sub_8084F6C + b _081377B2 + .pool +_081377AC: + movs r0, 0x2 + bl sub_8084F6C +_081377B2: + movs r7, 0 + movs r6, 0 + add r0, sp, 0x18 + mov r8, r0 + mov r5, sp +_081377BC: + movs r0, 0x64 + adds r1, r6, 0 + muls r1, r0 + ldr r0, =gPlayerParty + adds r4, r1, r0 + movs r0, 0 + strb r6, [r5] + strb r0, [r5, 0x1] + adds r0, r4, 0 + movs r1, 0x5 + bl GetMonData + cmp r0, 0 + beq _0813780A + adds r0, r4, 0 + movs r1, 0x6 + bl GetMonData + cmp r0, 0 + bne _0813780A + adds r0, r4, 0 + movs r1, 0x43 + bl GetMonData + cmp r0, 0 + bne _0813780A + movs r0, 0x1 + mov r1, r8 + strb r0, [r1] + adds r0, r4, 0 + movs r1, 0x43 + add r2, sp, 0x18 + bl SetMonData + adds r0, r4, 0 + bl GetRibbonCount + strb r0, [r5, 0x1] + movs r7, 0x1 +_0813780A: + adds r5, 0x4 + adds r6, 0x1 + cmp r6, 0x5 + ble _081377BC + cmp r7, 0x1 + bne _0813785A + movs r0, 0x2A + bl IncrementGameStat + ldr r0, =0x0000089b + bl FlagSet + mov r3, sp + add r2, sp, 0x4 + movs r6, 0x4 +_08137828: + ldrb r1, [r3, 0x1] + ldrb r0, [r2, 0x1] + cmp r0, r1 + bls _08137838 + ldr r1, [sp] + ldr r0, [r2] + str r0, [sp] + str r1, [r2] +_08137838: + adds r2, 0x4 + subs r6, 0x1 + cmp r6, 0 + bge _08137828 + mov r0, sp + ldrb r0, [r0, 0x1] + cmp r0, 0x4 + bls _0813785A + mov r0, sp + ldrb r1, [r0] + movs r0, 0x64 + muls r0, r1 + ldr r1, =gPlayerParty + adds r0, r1 + movs r1, 0x43 + bl sub_80EE4DC +_0813785A: + ldr r0, =CB2_DoHallOfFameScreen + bl SetMainCallback2 + movs r0, 0 + add sp, 0x1C + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8137734 + + thumb_func_start sp0C8_whiteout_maybe +sp0C8_whiteout_maybe: @ 813787C + push {lr} + ldr r0, =CB2_WhiteOut + bl SetMainCallback2 + movs r0, 0 + pop {r1} + bx r1 + .pool + thumb_func_end sp0C8_whiteout_maybe + +@ time_events.o + + thumb_func_start sub_8137890 +sub_8137890: @ 8137890 + push {r4,lr} + ldr r0, =0x00004024 + bl VarGet + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + ldr r0, =0x00004025 + bl VarGet + lsls r0, 16 + lsrs r0, 16 + lsls r4, 16 + orrs r4, r0 + adds r0, r4, 0 + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8137890 + + thumb_func_start sub_81378BC +sub_81378BC: @ 81378BC + push {r4,lr} + adds r4, r0, 0 + ldr r0, =0x00004024 + lsrs r1, r4, 16 + bl VarSet + ldr r0, =0x00004025 + lsls r4, 16 + lsrs r4, 16 + adds r1, r4, 0 + bl VarSet + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81378BC + + thumb_func_start sub_81378E4 +sub_81378E4: @ 81378E4 + push {r4,lr} + bl Random + adds r4, r0, 0 + bl Random + lsls r4, 16 + lsls r0, 16 + lsrs r0, 16 + orrs r4, r0 + adds r0, r4, 0 + bl sub_81378BC + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_81378E4 + + thumb_func_start UpdateMirageRnd +UpdateMirageRnd: @ 8137904 + push {r4,lr} + lsls r0, 16 + lsrs r4, r0, 16 + bl sub_8137890 + adds r1, r0, 0 + cmp r4, 0 + beq _08137928 + ldr r3, =0x41c64e6d + ldr r2, =0x00003039 +_08137918: + adds r0, r1, 0 + muls r0, r3 + adds r1, r0, r2 + subs r0, r4, 0x1 + lsls r0, 16 + lsrs r4, r0, 16 + cmp r4, 0 + bne _08137918 +_08137928: + adds r0, r1, 0 + bl sub_81378BC + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end UpdateMirageRnd + + thumb_func_start sub_813793C +sub_813793C: @ 813793C + push {r4-r6,lr} + bl sub_8137890 + lsrs r6, r0, 16 + movs r5, 0 +_08137946: + movs r0, 0x64 + adds r1, r5, 0 + muls r1, r0 + ldr r0, =gPlayerParty + adds r4, r1, r0 + adds r0, r4, 0 + movs r1, 0xB + bl GetMonData + cmp r0, 0 + beq _08137978 + adds r0, r4, 0 + movs r1, 0 + bl GetMonData + ldr r1, =0x0000ffff + ands r1, r0 + cmp r1, r6 + bne _08137978 + movs r0, 0x1 + b _08137980 + .pool +_08137978: + adds r5, 0x1 + cmp r5, 0x5 + ble _08137946 + movs r0, 0 +_08137980: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_813793C + + thumb_func_start sub_8137988 +sub_8137988: @ 8137988 + push {lr} + bl get_map_light_from_warp0 + lsls r0, 24 + lsrs r0, 24 + bl is_light_level_1_2_3_5_or_6 + lsls r0, 24 + cmp r0, 0 + beq _081379CE + bl RtcCalcLocalTime + ldr r1, =gUnknown_085B2B44 + ldr r0, =gLocalTime + ldrb r0, [r0, 0x2] + lsls r0, 24 + asrs r0, 24 + adds r0, r1 + ldrb r0, [r0] + cmp r0, 0 + beq _081379C8 + ldr r0, =0x0000089a + bl FlagSet + b _081379CE + .pool +_081379C8: + ldr r0, =0x0000089a + bl FlagClear +_081379CE: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8137988 + + thumb_func_start sub_81379D8 +sub_81379D8: @ 81379D8 + push {r4,lr} + lsls r0, 24 + lsrs r4, r0, 24 + bl sub_80AC3BC + lsls r0, 24 + cmp r0, 0 + beq _081379F2 + bl EnableBothScriptContexts + adds r0, r4, 0 + bl DestroyTask +_081379F2: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_81379D8 + + thumb_func_start sub_81379F8 +sub_81379F8: @ 81379F8 + push {lr} + ldr r0, =sub_81379D8 + movs r1, 0x50 + bl CreateTask + pop {r0} + bx r0 + .pool + thumb_func_end sub_81379F8 + + thumb_func_start sub_8137A0C +sub_8137A0C: @ 8137A0C + push {lr} + ldr r0, =0x00004049 + bl GetVarPointer + movs r1, 0 + strh r1, [r0] + pop {r0} + bx r0 + .pool + thumb_func_end sub_8137A0C + + thumb_func_start UpdateBirchState +UpdateBirchState: @ 8137A20 + push {r4,r5,lr} + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + ldr r0, =0x00004049 + bl GetVarPointer + adds r5, r0, 0 + ldrh r0, [r5] + adds r4, r0 + strh r4, [r5] + ldrh r0, [r5] + movs r1, 0x7 + bl __umodsi3 + strh r0, [r5] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end UpdateBirchState + +@ birch_pc.o + + thumb_func_start sub_8137A4C +sub_8137A4C: @ 8137A4C + push {lr} + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + cmp r0, 0 + bne _08137A70 + movs r0, 0 + bl sub_80C0844 + ldr r1, =gSpecialVar_0x8005 + strh r0, [r1] + movs r0, 0x1 + bl sub_80C0844 + b _08137A80 + .pool +_08137A70: + movs r0, 0 + bl pokedex_count + ldr r1, =gSpecialVar_0x8005 + strh r0, [r1] + movs r0, 0x1 + bl pokedex_count +_08137A80: + ldr r1, =gSpecialVar_0x8006 + strh r0, [r1] + bl IsNationalPokedexEnabled + lsls r0, 16 + lsrs r0, 16 + pop {r1} + bx r1 + .pool + thumb_func_end sub_8137A4C + + thumb_func_start sub_8137A98 +sub_8137A98: @ 8137A98 + push {lr} + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x9 + bhi _08137AA4 + b _08137BFC +_08137AA4: + cmp r0, 0x13 + bhi _08137AB0 + ldr r0, =gUnknown_082A5DAB + b _08137C06 + .pool +_08137AB0: + cmp r0, 0x1D + bhi _08137ABC + ldr r0, =gUnknown_082A5DF1 + b _08137C06 + .pool +_08137ABC: + cmp r0, 0x27 + bhi _08137AC8 + ldr r0, =gUnknown_082A5E34 + b _08137C06 + .pool +_08137AC8: + cmp r0, 0x31 + bhi _08137AD4 + ldr r0, =gUnknown_082A5E83 + b _08137C06 + .pool +_08137AD4: + cmp r0, 0x3B + bhi _08137AE0 + ldr r0, =gUnknown_082A5EB9 + b _08137C06 + .pool +_08137AE0: + cmp r0, 0x45 + bhi _08137AEC + ldr r0, =gUnknown_082A5EF4 + b _08137C06 + .pool +_08137AEC: + cmp r0, 0x4F + bhi _08137AF8 + ldr r0, =gUnknown_082A5F39 + b _08137C06 + .pool +_08137AF8: + cmp r0, 0x59 + bhi _08137B04 + ldr r0, =gUnknown_082A5F82 + b _08137C06 + .pool +_08137B04: + cmp r0, 0x63 + bhi _08137B10 + ldr r0, =gUnknown_082A5FB9 + b _08137C06 + .pool +_08137B10: + cmp r0, 0x6D + bhi _08137B1C + ldr r0, =gUnknown_082A6018 + b _08137C06 + .pool +_08137B1C: + cmp r0, 0x77 + bhi _08137B28 + ldr r0, =gUnknown_082A6061 + b _08137C06 + .pool +_08137B28: + cmp r0, 0x81 + bhi _08137B34 + ldr r0, =gUnknown_082A609C + b _08137C06 + .pool +_08137B34: + cmp r0, 0x8B + bhi _08137B40 + ldr r0, =gUnknown_082A60D5 + b _08137C06 + .pool +_08137B40: + cmp r0, 0x95 + bhi _08137B4C + ldr r0, =gUnknown_082A6124 + b _08137C06 + .pool +_08137B4C: + cmp r0, 0x9F + bhi _08137B58 + ldr r0, =gUnknown_082A616F + b _08137C06 + .pool +_08137B58: + cmp r0, 0xA9 + bhi _08137B64 + ldr r0, =gUnknown_082A61D6 + b _08137C06 + .pool +_08137B64: + cmp r0, 0xB3 + bhi _08137B70 + ldr r0, =gUnknown_082A623A + b _08137C06 + .pool +_08137B70: + cmp r0, 0xBD + bhi _08137B7C + ldr r0, =gUnknown_082A6287 + b _08137C06 + .pool +_08137B7C: + cmp r0, 0xC7 + bls _08137BEA + cmp r0, 0xC8 + bne _08137BB8 + ldr r0, =0x00000199 + bl SpeciesToNationalPokedexNum + lsls r0, 16 + lsrs r0, 16 + movs r1, 0x1 + bl GetSetPokedexFlag + lsls r0, 24 + cmp r0, 0 + bne _08137BEA + movs r0, 0xCD + lsls r0, 1 + bl SpeciesToNationalPokedexNum + lsls r0, 16 + lsrs r0, 16 + movs r1, 0x1 + bl GetSetPokedexFlag + lsls r0, 24 + cmp r0, 0 + bne _08137BEA + b _08137C04 + .pool +_08137BB8: + cmp r0, 0xC9 + bne _08137BF8 + ldr r0, =0x00000199 + bl SpeciesToNationalPokedexNum + lsls r0, 16 + lsrs r0, 16 + movs r1, 0x1 + bl GetSetPokedexFlag + lsls r0, 24 + cmp r0, 0 + beq _08137C04 + movs r0, 0xCD + lsls r0, 1 + bl SpeciesToNationalPokedexNum + lsls r0, 16 + lsrs r0, 16 + movs r1, 0x1 + bl GetSetPokedexFlag + lsls r0, 24 + cmp r0, 0 + beq _08137C04 +_08137BEA: + ldr r0, =gUnknown_082A62C9 + b _08137C06 + .pool +_08137BF8: + cmp r0, 0xCA + beq _08137C04 +_08137BFC: + ldr r0, =gUnknown_082A5D6C + b _08137C06 + .pool +_08137C04: + ldr r0, =gUnknown_082A6312 +_08137C06: + pop {r1} + bx r1 + .pool + thumb_func_end sub_8137A98 + + thumb_func_start sub_8137C10 +sub_8137C10: @ 8137C10 + push {lr} + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + bl sub_8137A98 + bl ShowFieldMessage + pop {r0} + bx r0 + .pool + thumb_func_end sub_8137C10 + + thumb_func_start sub_8137C28 +sub_8137C28: @ 8137C28 + push {lr} + ldr r0, =CB2_DoHallOfFamePC + bl SetMainCallback2 + bl ScriptContext2_Enable + pop {r0} + bx r0 + .pool + thumb_func_end sub_8137C28 + + thumb_func_start sub_8137C3C +sub_8137C3C: @ 8137C3C + push {lr} + ldr r0, =c2_exit_to_overworld_2_switch + bl SetMainCallback2 + ldr r1, =gFieldCallback + ldr r0, =mapldr_080CA5C0 + str r0, [r1] + pop {r0} + bx r0 + .pool + thumb_func_end sub_8137C3C + + thumb_func_start mapldr_080CA5C0 +mapldr_080CA5C0: @ 8137C5C + push {lr} + sub sp, 0x4 + bl ScriptContext2_Enable + bl sub_8085784 + bl sp109_CreatePCMenu + bl sub_80E2514 + movs r0, 0x1 + negs r0, r0 + movs r1, 0 + str r1, [sp] + movs r2, 0x10 + movs r3, 0 + bl BeginNormalPaletteFade + ldr r0, =sub_8137C94 + movs r1, 0xA + bl CreateTask + add sp, 0x4 + pop {r0} + bx r0 + .pool + thumb_func_end mapldr_080CA5C0 + + thumb_func_start sub_8137C94 +sub_8137C94: @ 8137C94 + push {lr} + lsls r0, 24 + lsrs r2, r0, 24 + ldr r0, =gPaletteFade + ldrb r1, [r0, 0x7] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + bne _08137CAC + adds r0, r2, 0 + bl DestroyTask +_08137CAC: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8137C94 + + thumb_func_start sub_8137CB4 +sub_8137CB4: @ 8137CB4 + push {lr} + ldr r0, =CB2_ShowDiploma + bl SetMainCallback2 + bl ScriptContext2_Enable + pop {r0} + bx r0 + .pool + thumb_func_end sub_8137CB4 + + thumb_func_start Special_ViewWallClock +Special_ViewWallClock: @ 8137CC8 + push {lr} + ldr r0, =gMain + ldr r1, =c2_exit_to_overworld_2_switch + str r1, [r0, 0x8] + ldr r0, =Cb2_ViewWallClock + bl SetMainCallback2 + bl ScriptContext2_Enable + pop {r0} + bx r0 + .pool + thumb_func_end Special_ViewWallClock + + thumb_func_start wild_pokemon_reroll +wild_pokemon_reroll: @ 8137CEC + ldr r0, =gUnknown_0203AB54 + movs r1, 0 + strb r1, [r0] + ldr r0, =gUnknown_0203AB55 + strb r1, [r0] + ldr r1, =gUnknown_0203AB58 + movs r0, 0 + str r0, [r1] + bx lr + .pool + thumb_func_end wild_pokemon_reroll + + thumb_func_start sub_8137D0C +sub_8137D0C: @ 8137D0C + ldr r1, =gUnknown_0203AB54 + movs r0, 0x1 + strb r0, [r1] + ldr r1, =gUnknown_0203AB55 + movs r0, 0 + strb r0, [r1] + ldr r1, =gUnknown_0203AB58 + ldr r0, =gMain + ldr r0, [r0, 0x20] + str r0, [r1] + bx lr + .pool + thumb_func_end sub_8137D0C + + thumb_func_start sp0E3_walkrun_bitfield_interpretation +sp0E3_walkrun_bitfield_interpretation: @ 8137D34 + push {lr} + movs r0, 0x4 + bl TestPlayerAvatarFlags + lsls r0, 24 + cmp r0, 0 + beq _08137D46 + movs r0, 0x1 + b _08137D58 +_08137D46: + movs r0, 0x2 + bl TestPlayerAvatarFlags + lsls r0, 24 + cmp r0, 0 + bne _08137D56 + movs r0, 0 + b _08137D58 +_08137D56: + movs r0, 0x2 +_08137D58: + pop {r1} + bx r1 + thumb_func_end sp0E3_walkrun_bitfield_interpretation + + thumb_func_start sub_8137D5C +sub_8137D5C: @ 8137D5C + push {r4-r7,lr} + adds r7, r0, 0 + lsls r1, 24 + lsrs r6, r1, 24 + cmp r6, 0x63 + bhi _08137D88 + ldr r4, =gStringVar1 + adds r0, r4, 0 + adds r1, r6, 0 + movs r2, 0 + movs r3, 0x2 + bl ConvertIntToDecimalStringN + ldr r1, =gText_SpaceTimes + adds r0, r4, 0 + bl StringAppend + b _08137D90 + .pool +_08137D88: + ldr r0, =gStringVar1 + ldr r1, =gText_99TimesPlus + bl StringCopy +_08137D90: + ldr r0, =0x00000e0f + cmp r7, r0 + bhi _08137DF0 + ldr r4, =gStringVar2 + adds r0, r7, 0 + movs r1, 0x3C + bl __udivsi3 + adds r1, r0, 0 + adds r0, r4, 0 + movs r2, 0x1 + movs r3, 0x2 + bl ConvertIntToDecimalStringN + movs r0, 0xAD + strb r0, [r4, 0x2] + adds r5, r4, 0x3 + adds r0, r7, 0 + movs r1, 0x3C + bl __umodsi3 + movs r1, 0x64 + muls r0, r1 + movs r1, 0x3C + bl __udivsi3 + adds r1, r0, 0 + adds r0, r5, 0 + movs r2, 0x2 + movs r3, 0x2 + bl ConvertIntToDecimalStringN + ldr r1, =gText_SpaceSeconds + adds r0, r4, 0 + bl StringAppend + b _08137DF8 + .pool +_08137DF0: + ldr r0, =gStringVar2 + ldr r1, =gText_1MinutePlus + bl StringCopy +_08137DF8: + movs r4, 0 + cmp r6, 0 + bne _08137E0C + movs r4, 0x5 + b _08137E2A + .pool +_08137E0C: + cmp r6, 0x3 + bhi _08137E14 + movs r4, 0x4 + b _08137E2A +_08137E14: + cmp r6, 0x9 + bhi _08137E1C + movs r4, 0x3 + b _08137E2A +_08137E1C: + cmp r6, 0x13 + bhi _08137E24 + movs r4, 0x2 + b _08137E2A +_08137E24: + cmp r6, 0x63 + bhi _08137E2A + movs r4, 0x1 +_08137E2A: + adds r0, r7, 0 + movs r1, 0x3C + bl __udivsi3 + cmp r0, 0xA + bhi _08137E3A + adds r0, r4, 0x5 + b _08137E58 +_08137E3A: + cmp r0, 0xF + bhi _08137E42 + adds r0, r4, 0x4 + b _08137E58 +_08137E42: + cmp r0, 0x14 + bhi _08137E4A + adds r0, r4, 0x3 + b _08137E58 +_08137E4A: + cmp r0, 0x28 + bhi _08137E52 + adds r0, r4, 0x2 + b _08137E58 +_08137E52: + cmp r0, 0x3B + bhi _08137E5C + adds r0, r4, 0x1 +_08137E58: + lsls r0, 24 + lsrs r4, r0, 24 +_08137E5C: + ldr r0, =gSpecialVar_Result + strh r4, [r0] + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8137D5C + + thumb_func_start sub_8137E6C +sub_8137E6C: @ 8137E6C + push {r4,r5,lr} + ldr r0, =gMain + ldr r1, =gUnknown_0203AB58 + ldr r4, [r0, 0x20] + ldr r0, [r1] + subs r4, r0 + ldr r5, =gUnknown_0203AB55 + ldrb r1, [r5] + adds r0, r4, 0 + bl sub_8137D5C + ldrb r1, [r5] + adds r0, r4, 0 + bl sub_8137E9C + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8137E6C + + thumb_func_start sub_8137E9C +sub_8137E9C: @ 8137E9C + push {r4-r7,lr} + mov r7, r8 + push {r7} + adds r5, r0, 0 + lsls r1, 24 + lsrs r1, 24 + mov r8, r1 + ldr r6, =0x00004028 + adds r0, r6, 0 + bl VarGet + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + ldr r7, =0x00004029 + adds r0, r7, 0 + bl VarGet + lsls r0, 16 + adds r4, r0 + cmp r4, r5 + bhi _08137ECC + cmp r4, 0 + bne _08137EE6 +_08137ECC: + lsls r1, r5, 16 + lsrs r1, 16 + adds r0, r6, 0 + bl VarSet + lsrs r1, r5, 16 + adds r0, r7, 0 + bl VarSet + ldr r0, =0x00004027 + mov r1, r8 + bl VarSet +_08137EE6: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8137E9C + + thumb_func_start sub_8137EFC +sub_8137EFC: @ 8137EFC + push {r4,lr} + ldr r0, =0x00004028 + bl VarGet + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + ldr r0, =0x00004029 + bl VarGet + lsls r0, 16 + adds r4, r0 + cmp r4, 0 + beq _08137F3C + ldr r0, =0x00004027 + bl VarGet + adds r1, r0, 0 + lsls r1, 24 + lsrs r1, 24 + adds r0, r4, 0 + bl sub_8137D5C + movs r0, 0x1 + b _08137F3E + .pool +_08137F3C: + movs r0, 0 +_08137F3E: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8137EFC + + thumb_func_start sub_8137F44 +sub_8137F44: @ 8137F44 + push {r4,lr} + ldr r0, =gUnknown_020322DC + ldrh r1, [r0] + ldr r0, =0x00000c1d + cmp r1, r0 + beq _08137F7C + ldr r4, =0x000040a9 + adds r0, r4, 0 + bl VarGet + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x2 + beq _08137F6E + adds r0, r4, 0 + bl VarGet + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x3 + bne _08137F7C +_08137F6E: + adds r0, r4, 0 + movs r1, 0 + bl VarSet + movs r0, 0 + bl Overworld_SetSavedMusic +_08137F7C: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8137F44 + + thumb_func_start sub_8137F90 +sub_8137F90: @ 8137F90 + push {lr} + ldr r0, =0x0000088d + bl FlagSet + ldr r0, =0x0000404a + bl GetVarPointer + movs r1, 0 + strh r1, [r0] + pop {r0} + bx r0 + .pool + thumb_func_end sub_8137F90 + + thumb_func_start sub_8137FB0 +sub_8137FB0: @ 8137FB0 + push {lr} + ldr r0, =0x0000088d + bl FlagClear + pop {r0} + bx r0 + .pool + thumb_func_end sub_8137FB0 + + thumb_func_start CountSSTidalStep +CountSSTidalStep: @ 8137FC0 + push {r4,lr} + lsls r0, 16 + lsrs r4, r0, 16 + ldr r0, =0x0000088d + bl FlagGet + lsls r0, 24 + cmp r0, 0 + beq _08137FE6 + ldr r0, =0x0000404a + bl GetVarPointer + ldrh r1, [r0] + adds r1, r4, r1 + strh r1, [r0] + lsls r1, 16 + lsrs r1, 16 + cmp r1, 0xCC + bhi _08137FF4 +_08137FE6: + movs r0, 0 + b _08137FF6 + .pool +_08137FF4: + movs r0, 0x1 +_08137FF6: + pop {r4} + pop {r1} + bx r1 + thumb_func_end CountSSTidalStep + + thumb_func_start GetSSTidalLocation +GetSSTidalLocation: @ 8137FFC + push {r4-r7,lr} + mov r7, r8 + push {r7} + mov r8, r0 + adds r5, r1, 0 + adds r6, r2, 0 + adds r7, r3, 0 + ldr r0, =0x0000404a + bl GetVarPointer + adds r4, r0, 0 + ldr r0, =0x000040b4 + bl GetVarPointer + ldrh r0, [r0] + subs r0, 0x1 + cmp r0, 0x9 + bhi _081380C2 + lsls r0, 2 + ldr r1, =_08138038 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08138038: + .4byte _08138060 + .4byte _08138070 + .4byte _08138064 + .4byte _08138068 + .4byte _08138068 + .4byte _0813806C + .4byte _08138098 + .4byte _08138060 + .4byte _08138064 + .4byte _0813806C +_08138060: + movs r0, 0x1 + b _081380CE +_08138064: + movs r0, 0x4 + b _081380CE +_08138068: + movs r0, 0x2 + b _081380CE +_0813806C: + movs r0, 0x3 + b _081380CE +_08138070: + ldrh r0, [r4] + cmp r0, 0x3B + bhi _08138080 + movs r0, 0x31 + strb r0, [r5] + ldrh r0, [r4] + adds r0, 0x13 + b _081380C0 +_08138080: + cmp r0, 0x8B + bhi _0813808E + movs r0, 0x30 + strb r0, [r5] + ldrh r0, [r4] + subs r0, 0x3C + b _081380C0 +_0813808E: + movs r0, 0x2F + strb r0, [r5] + ldrh r0, [r4] + subs r0, 0x8C + b _081380C0 +_08138098: + ldrh r0, [r4] + cmp r0, 0x41 + bhi _081380A8 + movs r0, 0x2F + strb r0, [r5] + ldrh r1, [r4] + movs r0, 0x41 + b _081380BE +_081380A8: + cmp r0, 0x91 + bhi _081380B6 + movs r0, 0x30 + strb r0, [r5] + ldrh r1, [r4] + movs r0, 0x91 + b _081380BE +_081380B6: + movs r0, 0x31 + strb r0, [r5] + ldrh r1, [r4] + movs r0, 0xE0 +_081380BE: + subs r0, r1 +_081380C0: + strh r0, [r6] +_081380C2: + movs r0, 0 + mov r1, r8 + strb r0, [r1] + movs r0, 0x14 + strh r0, [r7] + movs r0, 0 +_081380CE: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end GetSSTidalLocation + + thumb_func_start is_tile_that_overrides_player_control +is_tile_that_overrides_player_control: @ 81380D8 + push {lr} + movs r0, 0x88 + bl FlagGet + lsls r0, 24 + cmp r0, 0 + beq _0813810A + ldr r0, =gMapHeader + ldrb r0, [r0, 0x17] + cmp r0, 0x1 + blt _0813810A + cmp r0, 0x3 + ble _081380F6 + cmp r0, 0x6 + bne _0813810A +_081380F6: + ldr r0, =0x000040f2 + bl GetVarPointer + ldrh r1, [r0] + adds r1, 0x1 + strh r1, [r0] + lsls r1, 16 + lsrs r1, 16 + cmp r1, 0xF9 + bhi _08138118 +_0813810A: + movs r0, 0 + b _0813811A + .pool +_08138118: + movs r0, 0x1 +_0813811A: + pop {r1} + bx r1 + thumb_func_end is_tile_that_overrides_player_control + + thumb_func_start sub_8138120 +sub_8138120: @ 8138120 + push {lr} + movs r0, 0x8A + bl FlagGet + lsls r0, 24 + cmp r0, 0 + beq _08138152 + ldr r0, =gMapHeader + ldrb r0, [r0, 0x17] + cmp r0, 0x1 + blt _08138152 + cmp r0, 0x3 + ble _0813813E + cmp r0, 0x6 + bne _08138152 +_0813813E: + ldr r0, =0x000040f3 + bl GetVarPointer + ldrh r1, [r0] + adds r1, 0x1 + strh r1, [r0] + lsls r1, 16 + lsrs r1, 16 + cmp r1, 0x9 + bhi _08138160 +_08138152: + movs r0, 0 + b _08138162 + .pool +_08138160: + movs r0, 0x1 +_08138162: + pop {r1} + bx r1 + thumb_func_end sub_8138120 + + thumb_func_start sub_8138168 +sub_8138168: @ 8138168 + push {lr} + movs r0, 0x72 + bl FlagGet + lsls r0, 24 + cmp r0, 0 + beq _0813819A + ldr r0, =gMapHeader + ldrb r0, [r0, 0x17] + cmp r0, 0x1 + blt _0813819A + cmp r0, 0x3 + ble _08138186 + cmp r0, 0x6 + bne _0813819A +_08138186: + ldr r0, =0x000040f5 + bl GetVarPointer + ldrh r1, [r0] + adds r1, 0x1 + strh r1, [r0] + lsls r1, 16 + lsrs r1, 16 + cmp r1, 0x9 + bhi _081381A8 +_0813819A: + movs r0, 0 + b _081381AA + .pool +_081381A8: + movs r0, 0x1 +_081381AA: + pop {r1} + bx r1 + thumb_func_end sub_8138168 + + thumb_func_start sub_81381B0 +sub_81381B0: @ 81381B0 + push {lr} + movs r0, 0x80 + bl FlagGet + lsls r0, 24 + cmp r0, 0 + beq _081381E2 + ldr r0, =gMapHeader + ldrb r0, [r0, 0x17] + cmp r0, 0x1 + blt _081381E2 + cmp r0, 0x3 + ble _081381CE + cmp r0, 0x6 + bne _081381E2 +_081381CE: + ldr r0, =0x000040f4 + bl GetVarPointer + ldrh r1, [r0] + adds r1, 0x1 + strh r1, [r0] + lsls r1, 16 + lsrs r1, 16 + cmp r1, 0xF9 + bhi _081381F0 +_081381E2: + movs r0, 0 + b _081381F2 + .pool +_081381F0: + movs r0, 0x1 +_081381F2: + pop {r1} + bx r1 + thumb_func_end sub_81381B0 + + thumb_func_start sub_81381F8 +sub_81381F8: @ 81381F8 + push {lr} + movs r0, 0x75 + bl FlagGet + lsls r0, 24 + cmp r0, 0 + beq _0813822A + ldr r0, =gMapHeader + ldrb r0, [r0, 0x17] + cmp r0, 0x1 + blt _0813822A + cmp r0, 0x3 + ble _08138216 + cmp r0, 0x6 + bne _0813822A +_08138216: + ldr r0, =0x000040f6 + bl GetVarPointer + ldrh r1, [r0] + adds r1, 0x1 + strh r1, [r0] + lsls r1, 16 + lsrs r1, 16 + cmp r1, 0xF9 + bhi _08138238 +_0813822A: + movs r0, 0 + b _0813823A + .pool +_08138238: + movs r0, 0x1 +_0813823A: + pop {r1} + bx r1 + thumb_func_end sub_81381F8 + + thumb_func_start sub_8138240 +sub_8138240: @ 8138240 + push {r4-r7,lr} + mov r7, r8 + push {r7} + movs r6, 0 + bl GetMultiplayerId + lsls r0, 24 + lsrs r7, r0, 24 + bl GetLinkPlayerCount + lsls r0, 24 + lsrs r5, r0, 24 + movs r4, 0 + cmp r4, r5 + bcs _0813828A + ldr r0, =gTVStringVarPtrs + mov r8, r0 +_08138262: + cmp r7, r4 + beq _08138280 + lsls r0, r6, 2 + add r0, r8 + ldr r0, [r0] + lsls r1, r4, 3 + subs r1, r4 + lsls r1, 2 + ldr r2, =gLinkPlayers + 8 + adds r1, r2 + bl StringCopy + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 +_08138280: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, r5 + bcc _08138262 +_0813828A: + adds r0, r5, 0 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8138240 + + thumb_func_start SpawnLinkPartnerFieldObject +SpawnLinkPartnerFieldObject: @ 81382A0 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x14 + movs r7, 0 + movs r0, 0 + mov r9, r0 + mov r8, r0 + ldr r1, =gUnknown_085B2B5C + add r0, sp, 0x8 + movs r2, 0x4 + bl memcpy + add r4, sp, 0xC + ldr r1, =gUnknown_085B2B60 + adds r0, r4, 0 + movs r2, 0x8 + bl memcpy + bl GetMultiplayerId + lsls r0, 24 + lsrs r0, 24 + mov r10, r0 + bl player_get_direction_lower_nybble + lsls r0, 24 + lsrs r0, 24 + adds r1, r0, 0 + cmp r0, 0x2 + beq _08138310 + cmp r0, 0x2 + bgt _081382F4 + cmp r0, 0x1 + beq _0813833C + b _08138350 + .pool +_081382F4: + cmp r1, 0x3 + beq _081382FE + cmp r1, 0x4 + beq _08138324 + b _08138350 +_081382FE: + movs r7, 0x2 + ldr r0, =gSaveBlock1Ptr + ldr r1, [r0] + ldrh r0, [r1] + subs r0, 0x1 + b _0813832C + .pool +_08138310: + movs r7, 0x1 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldrh r1, [r0] + mov r9, r1 + ldrh r0, [r0, 0x2] + subs r0, 0x1 + b _0813834A + .pool +_08138324: + ldr r0, =gSaveBlock1Ptr + ldr r1, [r0] + ldrh r0, [r1] + adds r0, 0x1 +_0813832C: + lsls r0, 16 + lsrs r0, 16 + mov r9, r0 + ldrh r1, [r1, 0x2] + mov r8, r1 + b _08138350 + .pool +_0813833C: + movs r7, 0x3 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldrh r3, [r0] + mov r9, r3 + ldrh r0, [r0, 0x2] + adds r0, 0x1 +_0813834A: + lsls r0, 16 + lsrs r0, 16 + mov r8, r0 +_08138350: + movs r6, 0 + b _08138410 + .pool +_08138358: + cmp r10, r6 + beq _0813840A + ldr r0, =gLinkPlayers + lsls r2, r6, 3 + subs r1, r2, r6 + lsls r1, 2 + adds r1, r0 + ldrb r3, [r1] + adds r4, r0, 0 + cmp r3, 0x1 + blt _0813838C + cmp r3, 0x2 + ble _0813837C + cmp r3, 0x3 + beq _08138388 + b _0813838C + .pool +_0813837C: + ldrb r0, [r1, 0x13] + movs r5, 0xEC + cmp r0, 0 + bne _0813839C + movs r5, 0xEB + b _0813839C +_08138388: + ldrb r0, [r1, 0x13] + b _08138394 +_0813838C: + subs r0, r2, r6 + lsls r0, 2 + adds r0, r4 + ldrb r0, [r0, 0x13] +_08138394: + movs r5, 0x69 + cmp r0, 0 + bne _0813839C + movs r5, 0x64 +_0813839C: + mov r0, sp + adds r0, r7 + adds r0, 0x8 + ldrb r1, [r0] + movs r4, 0xF0 + subs r4, r6 + lsls r4, 24 + lsrs r4, 24 + lsls r2, r7, 1 + mov r0, sp + adds r0, r2 + adds r0, 0xC + ldrb r0, [r0] + lsls r0, 24 + asrs r0, 24 + mov r3, r9 + lsls r3, 16 + asrs r3, 16 + mov r12, r3 + add r0, r12 + adds r3, r0, 0x7 + lsls r3, 16 + asrs r3, 16 + mov r12, r3 + mov r0, sp + adds r0, 0xD + adds r0, r2 + movs r2, 0 + ldrsb r2, [r0, r2] + mov r3, r8 + lsls r0, r3, 16 + asrs r0, 16 + adds r0, r2 + adds r0, 0x7 + lsls r0, 16 + asrs r0, 16 + str r0, [sp] + movs r0, 0 + str r0, [sp, 0x4] + adds r0, r5, 0 + adds r2, r4, 0 + mov r3, r12 + bl SpawnSpecialFieldObjectParametrized + adds r0, r5, 0 + adds r1, r4, 0 + adds r2, r6, 0 + bl sub_813842C + adds r0, r7, 0x1 + lsls r0, 24 + lsrs r7, r0, 24 + cmp r7, 0x4 + bne _0813840A + movs r7, 0 +_0813840A: + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 +_08138410: + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + cmp r6, r0 + bcc _08138358 + add sp, 0x14 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end SpawnLinkPartnerFieldObject + + thumb_func_start sub_813842C +sub_813842C: @ 813842C + push {r4,r5,lr} + lsls r0, 24 + lsls r1, 24 + lsrs r3, r1, 24 + lsls r2, 24 + movs r1, 0xC0 + lsls r1, 19 + adds r2, r1 + lsrs r5, r2, 24 + lsrs r4, r0, 24 + movs r2, 0xA8 + lsls r2, 21 + adds r0, r2 + lsrs r0, 24 + cmp r0, 0x1 + bls _08138454 + cmp r4, 0x64 + beq _08138454 + cmp r4, 0x69 + bne _081384E6 +_08138454: + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldrb r1, [r0, 0x5] + ldrb r2, [r0, 0x4] + adds r0, r3, 0 + bl GetFieldObjectIdByLocalIdAndMap + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x10 + beq _081384E6 + ldr r1, =gMapObjects + lsls r0, r2, 3 + adds r0, r2 + lsls r0, 2 + adds r0, r1 + ldrb r0, [r0, 0x4] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + ldr r0, =gSprites + adds r1, r0 + lsls r3, r5, 4 + ldrb r2, [r1, 0x5] + movs r0, 0xF + ands r0, r2 + orrs r0, r3 + strb r0, [r1, 0x5] + cmp r4, 0x69 + beq _081384D8 + cmp r4, 0x69 + bgt _081384A8 + cmp r4, 0x64 + beq _081384C4 + b _081384E6 + .pool +_081384A8: + cmp r4, 0xEB + beq _081384B2 + cmp r4, 0xEC + beq _081384BC + b _081384E6 +_081384B2: + ldr r0, =gFieldObjectPalette33 + b _081384C6 + .pool +_081384BC: + ldr r0, =gFieldObjectPalette34 + b _081384C6 + .pool +_081384C4: + ldr r0, =gFieldObjectPalette8 +_081384C6: + movs r2, 0x80 + lsls r2, 1 + adds r1, r3, r2 + movs r2, 0x20 + bl LoadPalette + b _081384E6 + .pool +_081384D8: + ldr r0, =gFieldObjectPalette17 + movs r2, 0x80 + lsls r2, 1 + adds r1, r3, r2 + movs r2, 0x20 + bl LoadPalette +_081384E6: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813842C + + thumb_func_start sub_81384F0 +sub_81384F0: @ 81384F0 + push {r4,r5,lr} + movs r4, 0 + ldr r5, =gUnknown_085B2B68 +_081384F6: + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + cmp r4, r0 + bne _0813851C + lsls r1, r4, 2 + adds r1, r5 + ldrb r0, [r1] + ldrb r1, [r1, 0x1] + ldr r2, =0x00000206 + bl MapGridSetMetatileIdAt + b _0813852A + .pool +_0813851C: + lsls r1, r4, 2 + adds r1, r5 + ldrb r0, [r1] + ldrb r1, [r1, 0x1] + ldr r2, =0x00000205 + bl MapGridSetMetatileIdAt +_0813852A: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x3 + bls _081384F6 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81384F0 + + thumb_func_start sub_8138540 +sub_8138540: @ 8138540 + push {r4-r6,lr} + movs r5, 0xC +_08138544: + movs r4, 0x7 + adds r6, r5, 0x1 +_08138548: + adds r0, r4, 0 + adds r1, r5, 0 + bl MapGridGetMetatileIdAt + ldr r1, =0xfffffde6 + adds r0, r1 + cmp r0, 0x37 + bls _0813855A + b _08138734 +_0813855A: + lsls r0, 2 + ldr r1, =_0813856C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0813856C: + .4byte _081386F2 + .4byte _08138734 + .4byte _08138734 + .4byte _08138734 + .4byte _08138734 + .4byte _08138734 + .4byte _0813864C + .4byte _08138652 + .4byte _0813868C + .4byte _08138694 + .4byte _08138734 + .4byte _08138734 + .4byte _08138734 + .4byte _08138734 + .4byte _0813865C + .4byte _08138662 + .4byte _0813869C + .4byte _081386A4 + .4byte _08138734 + .4byte _08138734 + .4byte _08138734 + .4byte _08138734 + .4byte _0813866C + .4byte _08138672 + .4byte _081386AC + .4byte _081386B4 + .4byte _08138734 + .4byte _08138734 + .4byte _08138734 + .4byte _08138734 + .4byte _0813867C + .4byte _08138684 + .4byte _081386BC + .4byte _081386C4 + .4byte _08138734 + .4byte _08138734 + .4byte _08138734 + .4byte _08138734 + .4byte _081386CC + .4byte _081386DC + .4byte _081386EC + .4byte _08138714 + .4byte _08138734 + .4byte _08138734 + .4byte _08138734 + .4byte _08138734 + .4byte _081386D4 + .4byte _081386E4 + .4byte _08138734 + .4byte _08138734 + .4byte _08138734 + .4byte _08138734 + .4byte _08138734 + .4byte _08138734 + .4byte _0813872A + .4byte _0813871C +_0813864C: + movs r2, 0x8C + lsls r2, 2 + b _08138720 +_08138652: + ldr r2, =0x00000231 + b _08138720 + .pool +_0813865C: + movs r2, 0x8E + lsls r2, 2 + b _08138720 +_08138662: + ldr r2, =0x00000239 + b _08138720 + .pool +_0813866C: + movs r2, 0x88 + lsls r2, 2 + b _08138720 +_08138672: + ldr r2, =0x00000221 + b _08138720 + .pool +_0813867C: + ldr r2, =0x00000e28 + b _08138720 + .pool +_08138684: + ldr r2, =0x00000e29 + b _08138720 + .pool +_0813868C: + ldr r2, =0x00000232 + b _08138720 + .pool +_08138694: + ldr r2, =0x00000233 + b _08138720 + .pool +_0813869C: + ldr r2, =0x0000023a + b _08138720 + .pool +_081386A4: + ldr r2, =0x0000023b + b _08138720 + .pool +_081386AC: + ldr r2, =0x00000222 + b _08138720 + .pool +_081386B4: + ldr r2, =0x00000223 + b _08138720 + .pool +_081386BC: + ldr r2, =0x00000e2a + b _08138720 + .pool +_081386C4: + ldr r2, =0x00000e2b + b _08138720 + .pool +_081386CC: + ldr r2, =0x00000e42 + b _08138720 + .pool +_081386D4: + ldr r2, =0x0000021a + b _08138720 + .pool +_081386DC: + ldr r2, =0x00000e43 + b _08138720 + .pool +_081386E4: + ldr r2, =0x0000021a + b _08138720 + .pool +_081386EC: + movs r2, 0xE4 + lsls r2, 4 + b _08138720 +_081386F2: + subs r1, r5, 0x1 + adds r0, r4, 0 + bl MapGridGetMetatileIdAt + movs r1, 0x90 + lsls r1, 2 + cmp r0, r1 + bne _0813870C + ldr r2, =0x00000e48 + b _08138720 + .pool +_0813870C: + ldr r2, =0x00000e49 + b _08138720 + .pool +_08138714: + ldr r2, =0x00000e41 + b _08138720 + .pool +_0813871C: + movs r2, 0xE5 + lsls r2, 4 +_08138720: + adds r0, r4, 0 + adds r1, r5, 0 + bl MapGridSetMetatileIdAt + b _08138734 +_0813872A: + ldr r2, =0x00000251 + adds r0, r4, 0 + adds r1, r5, 0 + bl MapGridSetMetatileIdAt +_08138734: + adds r4, 0x1 + cmp r4, 0xF + bgt _0813873C + b _08138548 +_0813873C: + adds r5, r6, 0 + cmp r5, 0x17 + bgt _08138744 + b _08138544 +_08138744: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8138540 + + thumb_func_start sub_8138750 +sub_8138750: @ 8138750 + push {r4-r6,lr} + ldr r4, =gUnknown_085B2B68 + movs r5, 0x3 +_08138756: + ldrb r0, [r4] + ldrb r1, [r4, 0x1] + ldr r2, =0x00000206 + bl MapGridSetMetatileIdAt + adds r4, 0x4 + subs r5, 0x1 + cmp r5, 0 + bge _08138756 + movs r5, 0xC +_0813876A: + movs r4, 0x7 + adds r6, r5, 0x1 +_0813876E: + adds r0, r4, 0 + adds r1, r5, 0 + bl MapGridGetMetatileIdAt + ldr r1, =0xfffffde0 + adds r0, r1 + cmp r0, 0x30 + bls _08138780 + b _081388CA +_08138780: + lsls r0, 2 + ldr r1, =_0813879C + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0813879C: + .4byte _08138860 + .4byte _08138866 + .4byte _08138880 + .4byte _08138888 + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _08138870 + .4byte _08138876 + .4byte _08138890 + .4byte _08138898 + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388A0 + .4byte _081388A8 + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388B0 + .4byte _081388B0 + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388CA + .4byte _081388C0 +_08138860: + movs r2, 0x8C + lsls r2, 2 + b _081388B2 +_08138866: + ldr r2, =0x00000231 + b _081388B2 + .pool +_08138870: + movs r2, 0x8E + lsls r2, 2 + b _081388B2 +_08138876: + ldr r2, =0x00000239 + b _081388B2 + .pool +_08138880: + ldr r2, =0x00000232 + b _081388B2 + .pool +_08138888: + ldr r2, =0x00000233 + b _081388B2 + .pool +_08138890: + ldr r2, =0x0000023a + b _081388B2 + .pool +_08138898: + ldr r2, =0x0000023b + b _081388B2 + .pool +_081388A0: + ldr r2, =0x00000e42 + b _081388B2 + .pool +_081388A8: + ldr r2, =0x00000e43 + b _081388B2 + .pool +_081388B0: + ldr r2, =0x0000021a +_081388B2: + adds r0, r4, 0 + adds r1, r5, 0 + bl MapGridSetMetatileIdAt + b _081388CA + .pool +_081388C0: + ldr r2, =0x00000251 + adds r0, r4, 0 + adds r1, r5, 0 + bl MapGridSetMetatileIdAt +_081388CA: + adds r4, 0x1 + cmp r4, 0xF + bgt _081388D2 + b _0813876E +_081388D2: + adds r5, r6, 0 + cmp r5, 0x17 + bgt _081388DA + b _0813876A +_081388DA: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8138750 + + thumb_func_start sub_81388E4 +sub_81388E4: @ 81388E4 + push {lr} + ldr r0, =gUnknown_0203AB5C + movs r1, 0 + strb r1, [r0] + ldr r0, =gUnknown_0203AB5D + strb r1, [r0] + movs r0, 0x2C + bl PlaySE + ldr r0, =sub_8138910 + movs r1, 0x8 + bl CreateTask + pop {r0} + bx r0 + .pool + thumb_func_end sub_81388E4 + + thumb_func_start sub_8138910 +sub_8138910: @ 8138910 + push {r4-r6,lr} + lsls r0, 24 + lsrs r6, r0, 24 + ldr r0, =gUnknown_085B2B78 + ldr r5, =gUnknown_0203AB5D + ldrb r1, [r5] + adds r0, r1, r0 + ldr r4, =gUnknown_0203AB5C + ldrb r2, [r4] + ldrb r0, [r0] + cmp r0, r2 + bne _0813896C + ldr r0, =gSpecialVar_0x8004 + ldrb r0, [r0] + ldr r2, =gUnknown_085B2B7E + lsls r1, 1 + adds r1, r2 + ldrh r1, [r1] + bl sub_8138978 + movs r0, 0 + strb r0, [r4] + ldrb r0, [r5] + adds r0, 0x1 + strb r0, [r5] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x5 + bne _08138970 + adds r0, r6, 0 + bl DestroyTask + bl EnableBothScriptContexts + b _08138970 + .pool +_0813896C: + adds r0, r2, 0x1 + strb r0, [r4] +_08138970: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_8138910 + + thumb_func_start sub_8138978 +sub_8138978: @ 8138978 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x10 + lsls r0, 24 + lsrs r0, 24 + lsls r1, 16 + lsrs r2, r1, 16 + movs r7, 0 + subs r0, 0x1 + cmp r0, 0x7 + bhi _08138A40 + lsls r0, 2 + ldr r1, =_081389A0 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_081389A0: + .4byte _081389C0 + .4byte _081389D2 + .4byte _081389E4 + .4byte _081389F6 + .4byte _08138A04 + .4byte _08138A1A + .4byte _08138A26 + .4byte _08138A34 +_081389C0: + movs r7, 0x2 + mov r1, sp + movs r0, 0x1 + strh r0, [r1] + movs r0, 0x7 + strh r0, [r1, 0x2] + add r1, sp, 0x8 + movs r0, 0x68 + b _08138A14 +_081389D2: + movs r7, 0x2 + mov r1, sp + movs r0, 0x1 + strh r0, [r1] + movs r0, 0x7 + strh r0, [r1, 0x2] + add r1, sp, 0x8 + movs r0, 0x4E + b _08138A14 +_081389E4: + movs r7, 0x2 + mov r1, sp + movs r0, 0x1 + strh r0, [r1] + movs r0, 0x7 + strh r0, [r1, 0x2] + add r1, sp, 0x8 + movs r0, 0x5B + b _08138A14 +_081389F6: + movs r7, 0x1 + mov r1, sp + movs r0, 0x7 + strh r0, [r1] + add r1, sp, 0x8 + movs r0, 0x27 + b _08138A3E +_08138A04: + movs r7, 0x2 + mov r1, sp + movs r0, 0x1 + strh r0, [r1] + movs r0, 0x7 + strh r0, [r1, 0x2] + add r1, sp, 0x8 + movs r0, 0x34 +_08138A14: + strh r0, [r1] + strh r0, [r1, 0x2] + b _08138A40 +_08138A1A: + movs r7, 0x1 + mov r0, sp + strh r7, [r0] + add r1, sp, 0x8 + movs r0, 0x41 + b _08138A3E +_08138A26: + movs r7, 0x1 + mov r1, sp + movs r0, 0x7 + strh r0, [r1] + add r1, sp, 0x8 + movs r0, 0xD + b _08138A3E +_08138A34: + movs r7, 0x1 + mov r0, sp + strh r7, [r0] + add r1, sp, 0x8 + movs r0, 0x1A +_08138A3E: + strh r0, [r1] +_08138A40: + movs r6, 0 + cmp r6, r7 + bcs _08138A92 + movs r1, 0xC0 + lsls r1, 4 + adds r0, r1, 0 + adds r1, r2, 0 + orrs r1, r0 + lsls r1, 16 + mov r9, r1 + adds r1, r2, 0 + adds r1, 0x8 + orrs r1, r0 + lsls r1, 16 + mov r8, r1 +_08138A5E: + lsls r1, r6, 1 + mov r3, sp + adds r5, r3, r1 + ldrh r0, [r5] + adds r0, 0x7 + add r4, sp, 0x8 + adds r4, r1 + ldrh r1, [r4] + adds r1, 0x7 + mov r3, r9 + lsrs r2, r3, 16 + bl MapGridSetMetatileIdAt + ldrh r0, [r5] + adds r0, 0x7 + ldrh r1, [r4] + adds r1, 0x8 + mov r3, r8 + lsrs r2, r3, 16 + bl MapGridSetMetatileIdAt + adds r0, r6, 0x1 + lsls r0, 24 + lsrs r6, r0, 24 + cmp r6, r7 + bcc _08138A5E +_08138A92: + bl DrawWholeMapView + add sp, 0x10 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8138978 + + thumb_func_start sub_8138AA4 +sub_8138AA4: @ 8138AA4 + push {lr} + ldr r0, =gSpecialVar_0x8004 + ldrb r0, [r0] + ldr r1, =gUnknown_085B2B7E + ldrh r1, [r1, 0x8] + bl sub_8138978 + pop {r0} + bx r0 + .pool + thumb_func_end sub_8138AA4 + + thumb_func_start sub_8138AC0 +sub_8138AC0: @ 8138AC0 + push {lr} + ldr r0, =gStringVar4 + bl ShowFieldMessage + pop {r0} + bx r0 + .pool + thumb_func_end sub_8138AC0 + + thumb_func_start sub_8138AD0 +sub_8138AD0: @ 8138AD0 + ldr r1, =gSpecialVar_0x8004 + ldr r0, =gSaveBlock1Ptr + ldr r2, [r0] + ldrh r0, [r2] + strh r0, [r1] + ldr r1, =gSpecialVar_0x8005 + ldrh r0, [r2, 0x2] + strh r0, [r1] + bx lr + .pool + thumb_func_end sub_8138AD0 + + thumb_func_start sub_8138AF0 +sub_8138AF0: @ 8138AF0 + push {lr} + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldrb r1, [r0, 0xB] + lsls r1, 8 + ldrb r0, [r0, 0xA] + orrs r0, r1 + movs r1, 0xA + bl __umodsi3 + lsls r0, 24 + lsrs r0, 24 + pop {r1} + bx r1 + .pool + thumb_func_end sub_8138AF0 + + thumb_func_start sub_8138B10 +sub_8138B10: @ 8138B10 + push {lr} + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldrb r0, [r0, 0x8] + cmp r0, 0 + bne _08138B34 + ldr r0, =gStringVar1 + ldr r1, =gText_BigGuy + bl StringCopy + b _08138B3C + .pool +_08138B34: + ldr r0, =gStringVar1 + ldr r1, =gText_BigGirl + bl StringCopy +_08138B3C: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8138B10 + + thumb_func_start sub_8138B48 +sub_8138B48: @ 8138B48 + push {lr} + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldrb r0, [r0, 0x8] + cmp r0, 0 + bne _08138B6C + ldr r0, =gStringVar1 + ldr r1, =gText_Daughter + bl StringCopy + b _08138B74 + .pool +_08138B6C: + ldr r0, =gStringVar1 + ldr r1, =gText_Son + bl StringCopy +_08138B74: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8138B48 + + thumb_func_start sub_8138B80 +sub_8138B80: @ 8138B80 + ldr r0, =gBattleOutcome + ldrb r0, [r0] + bx lr + .pool + thumb_func_end sub_8138B80 + + thumb_func_start sub_8138B8C +sub_8138B8C: @ 8138B8C + push {lr} + sub sp, 0x4 + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + cmp r0, 0 + beq _08138BB0 + movs r2, 0x1 + negs r2, r2 + movs r0, 0x4 + str r0, [sp] + movs r0, 0x13 + movs r1, 0 + movs r3, 0x6 + bl Overworld_SetWarpDestination + b _08138BC2 + .pool +_08138BB0: + movs r2, 0x1 + negs r2, r2 + movs r0, 0x4 + str r0, [sp] + movs r0, 0x13 + movs r1, 0x1 + movs r3, 0x6 + bl Overworld_SetWarpDestination +_08138BC2: + add sp, 0x4 + pop {r0} + bx r0 + thumb_func_end sub_8138B8C + + thumb_func_start sub_8138BC8 +sub_8138BC8: @ 8138BC8 + push {lr} + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + bl FlagSet + pop {r0} + bx r0 + .pool + thumb_func_end sub_8138BC8 + + thumb_func_start sub_8138BDC +sub_8138BDC: @ 8138BDC + push {lr} + ldr r0, =gLocalTime + movs r1, 0 + ldrsh r0, [r0, r1] + movs r1, 0x7 + bl __divsi3 + lsls r0, 16 + lsrs r0, 16 + ldr r1, =0x0000270f + cmp r0, r1 + bls _08138BF6 + adds r0, r1, 0 +_08138BF6: + pop {r1} + bx r1 + .pool + thumb_func_end sub_8138BDC + + thumb_func_start sub_8138C04 +sub_8138C04: @ 8138C04 + push {r4,lr} + bl GetLeadMonIndex + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x64 + muls r1, r0 + ldr r0, =gPlayerParty + adds r4, r1, r0 + adds r0, r4, 0 + movs r1, 0x20 + bl GetMonData + cmp r0, 0xFF + bne _08138C2C + movs r0, 0x6 + b _08138C7E + .pool +_08138C2C: + adds r0, r4, 0 + movs r1, 0x20 + bl GetMonData + cmp r0, 0xC7 + bls _08138C3C + movs r0, 0x5 + b _08138C7E +_08138C3C: + adds r0, r4, 0 + movs r1, 0x20 + bl GetMonData + cmp r0, 0x95 + bls _08138C4C + movs r0, 0x4 + b _08138C7E +_08138C4C: + adds r0, r4, 0 + movs r1, 0x20 + bl GetMonData + cmp r0, 0x63 + bls _08138C5C + movs r0, 0x3 + b _08138C7E +_08138C5C: + adds r0, r4, 0 + movs r1, 0x20 + bl GetMonData + cmp r0, 0x31 + bls _08138C6C + movs r0, 0x2 + b _08138C7E +_08138C6C: + adds r0, r4, 0 + movs r1, 0x20 + bl GetMonData + cmp r0, 0 + bne _08138C7C + movs r0, 0 + b _08138C7E +_08138C7C: + movs r0, 0x1 +_08138C7E: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8138C04 + + thumb_func_start sub_8138C84 +sub_8138C84: @ 8138C84 + push {lr} + ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music + bl sub_817018C + pop {r0} + bx r0 + .pool + thumb_func_end sub_8138C84 + + thumb_func_start sub_8138C94 +sub_8138C94: @ 8138C94 + push {lr} + ldr r0, =sub_8138C84 + bl SetMainCallback2 + pop {r0} + bx r0 + .pool + thumb_func_end sub_8138C94 + + thumb_func_start sp0D9_ComputerRelated +sp0D9_ComputerRelated: @ 8138CA4 + push {r4,lr} + ldr r4, =sub_8138CE8 + adds r0, r4, 0 + bl FuncIsActiveTask + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _08138CD8 + adds r0, r4, 0 + movs r1, 0x8 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r1, r2 + movs r2, 0 + strh r2, [r1, 0x8] + strh r0, [r1, 0xA] + strh r2, [r1, 0xC] + strh r2, [r1, 0xE] + strh r2, [r1, 0x10] +_08138CD8: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sp0D9_ComputerRelated + + thumb_func_start sub_8138CE8 +sub_8138CE8: @ 8138CE8 + push {lr} + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + ldr r0, =gTasks + adds r1, r0 + movs r2, 0x8 + ldrsh r0, [r1, r2] + cmp r0, 0 + bne _08138D06 + adds r0, r1, 0 + bl sub_8138D10 +_08138D06: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8138CE8 + + thumb_func_start sub_8138D10 +sub_8138D10: @ 8138D10 + push {r4-r6,lr} + adds r4, r0, 0 + movs r6, 0 + movs r5, 0 + movs r1, 0xE + ldrsh r0, [r4, r1] + cmp r0, 0x6 + bne _08138D7C + strh r5, [r4, 0xE] + bl player_get_direction_lower_nybble + lsls r0, 24 + lsrs r0, 24 + adds r1, r0, 0 + cmp r0, 0x3 + beq _08138D44 + cmp r0, 0x3 + bgt _08138D3A + cmp r0, 0x2 + beq _08138D40 + b _08138D4C +_08138D3A: + cmp r1, 0x4 + beq _08138D48 + b _08138D4C +_08138D40: + movs r6, 0 + b _08138D4A +_08138D44: + movs r6, 0xFF + b _08138D4A +_08138D48: + movs r6, 0x1 +_08138D4A: + movs r5, 0xFF +_08138D4C: + movs r1, 0x10 + ldrsh r0, [r4, r1] + lsls r1, r6, 24 + asrs r1, 24 + lsls r2, r5, 24 + asrs r2, 24 + bl sub_8138D88 + bl DrawWholeMapView + ldrh r0, [r4, 0x10] + movs r1, 0x1 + eors r0, r1 + strh r0, [r4, 0x10] + ldrh r0, [r4, 0xC] + adds r0, 0x1 + strh r0, [r4, 0xC] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x5 + bne _08138D7C + ldrb r0, [r4, 0xA] + bl DestroyTask +_08138D7C: + ldrh r0, [r4, 0xE] + adds r0, 0x1 + strh r0, [r4, 0xE] + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_8138D10 + + thumb_func_start sub_8138D88 +sub_8138D88: @ 8138D88 + push {r4,r5,lr} + lsls r1, 24 + lsrs r1, 24 + lsls r2, 24 + lsrs r4, r2, 24 + movs r3, 0 + lsls r0, 16 + cmp r0, 0 + beq _08138DC4 + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + cmp r0, 0 + bne _08138DAC + movs r3, 0x4 + b _08138DE6 + .pool +_08138DAC: + cmp r0, 0x1 + bne _08138DB8 + ldr r3, =0x0000025a + b _08138DE6 + .pool +_08138DB8: + cmp r0, 0x2 + bne _08138DE6 + ldr r3, =0x00000259 + b _08138DE6 + .pool +_08138DC4: + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + cmp r0, 0 + bne _08138DD4 + movs r3, 0x5 + b _08138DE6 + .pool +_08138DD4: + cmp r0, 0x1 + bne _08138DE0 + ldr r3, =0x0000027f + b _08138DE6 + .pool +_08138DE0: + cmp r0, 0x2 + bne _08138DE6 + ldr r3, =0x0000027e +_08138DE6: + ldr r0, =gSaveBlock1Ptr + ldr r2, [r0] + movs r5, 0 + ldrsh r0, [r2, r5] + lsls r1, 24 + asrs r1, 24 + adds r0, r1 + adds r0, 0x7 + movs r5, 0x2 + ldrsh r1, [r2, r5] + lsls r2, r4, 24 + asrs r2, 24 + adds r1, r2 + adds r1, 0x7 + movs r4, 0xC0 + lsls r4, 4 + adds r2, r4, 0 + orrs r3, r2 + adds r2, r3, 0 + bl MapGridSetMetatileIdAt + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8138D88 + + thumb_func_start sub_8138E20 +sub_8138E20: @ 8138E20 + push {lr} + bl sub_8138E2C + pop {r0} + bx r0 + thumb_func_end sub_8138E20 + + thumb_func_start sub_8138E2C +sub_8138E2C: @ 8138E2C + push {r4-r6,lr} + movs r6, 0 + movs r5, 0 + movs r4, 0 + bl player_get_direction_lower_nybble + lsls r0, 24 + lsrs r0, 24 + adds r1, r0, 0 + cmp r0, 0x3 + beq _08138E56 + cmp r0, 0x3 + bgt _08138E4C + cmp r0, 0x2 + beq _08138E52 + b _08138E5E +_08138E4C: + cmp r1, 0x4 + beq _08138E5A + b _08138E5E +_08138E52: + movs r6, 0 + b _08138E5C +_08138E56: + movs r6, 0xFF + b _08138E5C +_08138E5A: + movs r6, 0x1 +_08138E5C: + movs r5, 0xFF +_08138E5E: + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + cmp r0, 0 + bne _08138E70 + movs r4, 0x4 + b _08138E82 + .pool +_08138E70: + cmp r0, 0x1 + bne _08138E7C + ldr r4, =0x0000025a + b _08138E82 + .pool +_08138E7C: + cmp r0, 0x2 + bne _08138E82 + ldr r4, =0x00000259 +_08138E82: + ldr r0, =gSaveBlock1Ptr + ldr r2, [r0] + movs r1, 0 + ldrsh r0, [r2, r1] + lsls r1, r6, 24 + asrs r1, 24 + adds r0, r1 + adds r0, 0x7 + movs r3, 0x2 + ldrsh r1, [r2, r3] + lsls r2, r5, 24 + asrs r2, 24 + adds r1, r2 + adds r1, 0x7 + movs r3, 0xC0 + lsls r3, 4 + adds r2, r3, 0 + orrs r4, r2 + adds r2, r4, 0 + bl MapGridSetMetatileIdAt + bl DrawWholeMapView + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8138E2C + + thumb_func_start sub_8138EC0 +sub_8138EC0: @ 8138EC0 + push {r4,lr} + ldr r4, =sub_8138F04 + adds r0, r4, 0 + bl FuncIsActiveTask + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _08138EF4 + adds r0, r4, 0 + movs r1, 0x8 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r1, r2 + movs r2, 0 + strh r2, [r1, 0x8] + strh r0, [r1, 0xA] + strh r2, [r1, 0xC] + strh r2, [r1, 0xE] + strh r2, [r1, 0x10] +_08138EF4: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8138EC0 + + thumb_func_start sub_8138F04 +sub_8138F04: @ 8138F04 + push {lr} + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + ldr r0, =gTasks + adds r1, r0 + movs r2, 0x8 + ldrsh r0, [r1, r2] + cmp r0, 0 + bne _08138F22 + adds r0, r1, 0 + bl sub_8138F2C +_08138F22: + pop {r0} + bx r0 + .pool + thumb_func_end sub_8138F04 + + thumb_func_start sub_8138F2C +sub_8138F2C: @ 8138F2C + push {r4,lr} + adds r4, r0, 0 + movs r1, 0xE + ldrsh r0, [r4, r1] + cmp r0, 0x6 + bne _08138F9A + movs r0, 0 + strh r0, [r4, 0xE] + movs r1, 0x10 + ldrsh r0, [r4, r1] + cmp r0, 0 + beq _08138F64 + ldr r2, =0x00000e9d + movs r0, 0x12 + movs r1, 0x8 + bl MapGridSetMetatileIdAt + ldr r2, =0x00000ea5 + movs r0, 0x12 + movs r1, 0x9 + bl MapGridSetMetatileIdAt + b _08138F7A + .pool +_08138F64: + ldr r2, =0x00000e58 + movs r0, 0x12 + movs r1, 0x8 + bl MapGridSetMetatileIdAt + movs r2, 0xE6 + lsls r2, 4 + movs r0, 0x12 + movs r1, 0x9 + bl MapGridSetMetatileIdAt +_08138F7A: + bl DrawWholeMapView + ldrh r0, [r4, 0x10] + movs r1, 0x1 + eors r0, r1 + strh r0, [r4, 0x10] + ldrh r0, [r4, 0xC] + adds r0, 0x1 + strh r0, [r4, 0xC] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x5 + bne _08138F9A + ldrb r0, [r4, 0xA] + bl DestroyTask +_08138F9A: + ldrh r0, [r4, 0xE] + adds r0, 0x1 + strh r0, [r4, 0xE] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8138F2C + + thumb_func_start sub_8138FAC +sub_8138FAC: @ 8138FAC + push {lr} + ldr r2, =0x00000e9d + movs r0, 0x12 + movs r1, 0x8 + bl MapGridSetMetatileIdAt + ldr r2, =0x00000ea5 + movs r0, 0x12 + movs r1, 0x9 + bl MapGridSetMetatileIdAt + bl DrawWholeMapView + pop {r0} + bx r0 + .pool + thumb_func_end sub_8138FAC + + thumb_func_start sub_8138FD4 +sub_8138FD4: @ 8138FD4 + push {lr} + ldr r1, =gSpecialVar_0x8004 + ldr r0, =0x000001f5 + strh r0, [r1] + bl FlagSet + pop {r0} + bx r0 + .pool + thumb_func_end sub_8138FD4 + + thumb_func_start sub_8138FEC +sub_8138FEC: @ 8138FEC + push {lr} + ldr r1, =gSpecialVar_0x8004 + ldr r0, =0x000001f5 + strh r0, [r1] + bl FlagClear + pop {r0} + bx r0 + .pool + thumb_func_end sub_8138FEC + + thumb_func_start sub_8139004 +sub_8139004: @ 8139004 + push {lr} + bl GetLeadMonIndex + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x64 + muls r0, r1 + ldr r1, =gPlayerParty + adds r0, r1 + movs r1, 0x16 + bl GetMonData + cmp r0, 0xC7 + bls _08139028 + movs r0, 0x1 + b _0813902A + .pool +_08139028: + movs r0, 0 +_0813902A: + pop {r1} + bx r1 + thumb_func_end sub_8139004 + + thumb_func_start sub_8139030 +sub_8139030: @ 8139030 + push {lr} + bl GetLeadMonIndex + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x64 + muls r0, r1 + ldr r1, =gPlayerParty + adds r0, r1 + movs r1, 0x17 + bl GetMonData + cmp r0, 0xC7 + bls _08139054 + movs r0, 0x1 + b _08139056 + .pool +_08139054: + movs r0, 0 +_08139056: + pop {r1} + bx r1 + thumb_func_end sub_8139030 + + thumb_func_start sub_813905C +sub_813905C: @ 813905C + push {lr} + bl GetLeadMonIndex + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x64 + muls r0, r1 + ldr r1, =gPlayerParty + adds r0, r1 + movs r1, 0x18 + bl GetMonData + cmp r0, 0xC7 + bls _08139080 + movs r0, 0x1 + b _08139082 + .pool +_08139080: + movs r0, 0 +_08139082: + pop {r1} + bx r1 + thumb_func_end sub_813905C + + thumb_func_start sub_8139088 +sub_8139088: @ 8139088 + push {lr} + bl GetLeadMonIndex + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x64 + muls r0, r1 + ldr r1, =gPlayerParty + adds r0, r1 + movs r1, 0x21 + bl GetMonData + cmp r0, 0xC7 + bls _081390AC + movs r0, 0x1 + b _081390AE + .pool +_081390AC: + movs r0, 0 +_081390AE: + pop {r1} + bx r1 + thumb_func_end sub_8139088 + + thumb_func_start sub_81390B4 +sub_81390B4: @ 81390B4 + push {lr} + bl GetLeadMonIndex + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x64 + muls r0, r1 + ldr r1, =gPlayerParty + adds r0, r1 + movs r1, 0x2F + bl GetMonData + cmp r0, 0xC7 + bls _081390D8 + movs r0, 0x1 + b _081390DA + .pool +_081390D8: + movs r0, 0 +_081390DA: + pop {r1} + bx r1 + thumb_func_end sub_81390B4 + + thumb_func_start sub_81390E0 +sub_81390E0: @ 81390E0 + push {r4-r6,lr} + movs r5, 0 + ldr r6, =gBaseStats +_081390E6: + movs r0, 0x64 + adds r1, r5, 0 + muls r1, r0 + ldr r0, =gPlayerParty + adds r4, r1, r0 + adds r0, r4, 0 + movs r1, 0x5 + bl GetMonData + cmp r0, 0 + beq _0813913C + adds r0, r4, 0 + movs r1, 0x2D + bl GetMonData + cmp r0, 0 + bne _0813913C + adds r0, r4, 0 + movs r1, 0xB + bl GetMonData + lsls r0, 16 + lsrs r0, 16 + lsls r1, r0, 3 + subs r1, r0 + lsls r1, 2 + adds r1, r6 + ldrb r0, [r1, 0x6] + cmp r0, 0xC + beq _08139128 + ldrb r0, [r1, 0x7] + cmp r0, 0xC + bne _0813913C +_08139128: + ldr r1, =gSpecialVar_Result + movs r0, 0x1 + b _0813914A + .pool +_0813913C: + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x5 + bls _081390E6 + ldr r1, =gSpecialVar_Result + movs r0, 0 +_0813914A: + strh r0, [r1] + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81390E0 + + thumb_func_start SpawnScriptFieldObject +SpawnScriptFieldObject: @ 8139158 + push {lr} + sub sp, 0x8 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldrh r3, [r0] + adds r3, 0x7 + lsls r3, 16 + asrs r3, 16 + ldrh r0, [r0, 0x2] + adds r0, 0x7 + lsls r0, 16 + asrs r0, 16 + str r0, [sp] + movs r0, 0x3 + str r0, [sp, 0x4] + movs r0, 0x7 + movs r1, 0x8 + movs r2, 0x7F + bl SpawnSpecialFieldObjectParametrized + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gMapObjects + lsls r1, r0, 3 + adds r1, r0 + lsls r1, 2 + adds r1, r2 + ldrb r0, [r1, 0x1] + movs r2, 0x20 + orrs r0, r2 + strb r0, [r1, 0x1] + ldrb r0, [r1, 0x4] + bl CameraObjectSetFollowedObjectId + add sp, 0x8 + pop {r0} + bx r0 + .pool + thumb_func_end SpawnScriptFieldObject + + thumb_func_start RemoveScriptFieldObject +RemoveScriptFieldObject: @ 81391AC + push {lr} + bl GetPlayerAvatarObjectId + lsls r0, 24 + lsrs r0, 24 + bl CameraObjectSetFollowedObjectId + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldrb r1, [r0, 0x5] + ldrb r2, [r0, 0x4] + movs r0, 0x7F + bl RemoveFieldObjectByLocalIdAndMap + pop {r0} + bx r0 + .pool + thumb_func_end RemoveScriptFieldObject + + thumb_func_start sub_81391D0 +sub_81391D0: @ 81391D0 + push {lr} + bl GetLeadMonIndex + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x64 + muls r0, r1 + ldr r1, =gPlayerParty + adds r0, r1 + bl GetNature + lsls r0, 24 + lsrs r0, 24 + ldr r1, =gStringVar1 + bl CopyMonFavoritePokeblockName + lsls r0, 24 + lsrs r0, 24 + pop {r1} + bx r1 + .pool + thumb_func_end sub_81391D0 + + thumb_func_start sub_8139200 +sub_8139200: @ 8139200 + push {r4,lr} + ldr r4, =gStringVar1 + ldr r0, =0x00004026 + bl VarGet + adds r1, r0, 0 + lsls r1, 16 + lsrs r1, 16 + adds r0, r4, 0 + movs r2, 0 + bl GetMapName + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8139200 + + thumb_func_start sub_8139228 +sub_8139228: @ 8139228 + push {lr} + movs r0, 0x20 + bl GetGameStat + lsls r0, 16 + lsrs r0, 16 + pop {r1} + bx r1 + thumb_func_end sub_8139228 + + thumb_func_start sub_8139238 +sub_8139238: @ 8139238 + push {lr} + ldr r0, =gStringVar1 + bl GetEreaderTrainerName + pop {r0} + bx r0 + .pool + thumb_func_end sub_8139238 + + thumb_func_start sub_8139248 +sub_8139248: @ 8139248 + push {r4,r5,lr} + ldr r0, =gSaveBlock1Ptr + ldr r2, [r0] + ldr r1, =0x00002e68 + adds r0, r2, r1 + ldrb r1, [r0] + lsls r1, 25 + ldr r0, =0x00002e6a + adds r2, r0 + lsrs r1, 25 + ldrh r2, [r2] + adds r1, r2 + ldr r2, =gUnknown_085B2B88 + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + adds r0, r2 + ldrb r0, [r0] + adds r5, r1, r0 + movs r0, 0x2 + bl GetPriceReduction + lsls r0, 24 + cmp r0, 0 + bne _08139294 + ldr r4, =gUnknown_085B2B94 + b _08139296 + .pool +_08139294: + ldr r4, =gUnknown_085B2BA0 +_08139296: + adds r0, r5, 0 + movs r1, 0xC + bl __umodsi3 + adds r0, r4 + ldrb r0, [r0] + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8139248 + + thumb_func_start sub_81392AC +sub_81392AC: @ 81392AC + push {lr} + ldr r1, =gSpecialVar_0x8004 + ldr r0, =0x00000213 + strh r0, [r1] + bl FlagGet + lsls r0, 24 + cmp r0, 0 + beq _081392CC + movs r0, 0x1 + b _081392CE + .pool +_081392CC: + movs r0, 0 +_081392CE: + pop {r1} + bx r1 + thumb_func_end sub_81392AC + + thumb_func_start sub_81392D4 +sub_81392D4: @ 81392D4 + push {lr} + ldr r1, =gSpecialVar_0x8004 + movs r0, 0x85 + lsls r0, 2 + strh r0, [r1] + bl FlagGet + lsls r0, 24 + cmp r0, 0 + beq _081392F0 + movs r0, 0x1 + b _081392F2 + .pool +_081392F0: + movs r0, 0 +_081392F2: + pop {r1} + bx r1 + thumb_func_end sub_81392D4 + + thumb_func_start sub_81392F8 +sub_81392F8: @ 81392F8 + push {lr} + ldr r1, =gSpecialVar_0x8004 + ldr r0, =0x00000215 + strh r0, [r1] + bl FlagGet + lsls r0, 24 + cmp r0, 0 + beq _08139318 + movs r0, 0x1 + b _0813931A + .pool +_08139318: + movs r0, 0 +_0813931A: + pop {r1} + bx r1 + thumb_func_end sub_81392F8 + + thumb_func_start sub_8139320 +sub_8139320: @ 8139320 + push {lr} + ldr r1, =gSpecialVar_0x8004 + ldr r0, =0x00000216 + strh r0, [r1] + bl FlagGet + lsls r0, 24 + cmp r0, 0 + beq _08139340 + movs r0, 0x1 + b _08139342 + .pool +_08139340: + movs r0, 0 +_08139342: + pop {r1} + bx r1 + thumb_func_end sub_8139320 + + thumb_func_start sub_8139348 +sub_8139348: @ 8139348 + push {lr} + bl GetLeadMonIndex + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x64 + muls r0, r1 + ldr r1, =gPlayerParty + adds r0, r1 + movs r1, 0x47 + movs r2, 0 + bl GetMonData + lsls r0, 24 + lsrs r0, 24 + pop {r1} + bx r1 + .pool + thumb_func_end sub_8139348 + + thumb_func_start sub_8139370 +sub_8139370: @ 8139370 + push {r4,lr} + sub sp, 0x4 + movs r0, 0x2A + bl IncrementGameStat + ldr r0, =0x0000089b + bl FlagSet + movs r1, 0x1 + mov r0, sp + strb r1, [r0] + bl GetLeadMonIndex + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x64 + muls r1, r0 + ldr r0, =gPlayerParty + adds r4, r1, r0 + adds r0, r4, 0 + movs r1, 0x47 + mov r2, sp + bl SetMonData + adds r0, r4, 0 + bl GetRibbonCount + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x4 + bls _081393B6 + adds r0, r4, 0 + movs r1, 0x47 + bl sub_80EE4DC +_081393B6: + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8139370 + + thumb_func_start sub_81393C8 +sub_81393C8: @ 81393C8 + push {lr} + bl GetLeadMonIndex + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x64 + muls r0, r1 + ldr r1, =gPlayerParty + adds r0, r1 + bl GetMonEVCount + lsls r0, 16 + ldr r1, =0x01fd0000 + cmp r0, r1 + bhi _081393F4 + movs r0, 0 + b _081393F6 + .pool +_081393F4: + movs r0, 0x1 +_081393F6: + pop {r1} + bx r1 + thumb_func_end sub_81393C8 + + thumb_func_start sub_81393FC +sub_81393FC: @ 81393FC + push {lr} + movs r0, 0xC7 + bl FlagGet + lsls r0, 24 + cmp r0, 0 + bne _08139454 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldrh r1, [r0, 0x4] + movs r0, 0x83 + lsls r0, 3 + cmp r1, r0 + bne _08139454 + subs r0, 0x75 + bl FlagGet + lsls r0, 24 + cmp r0, 0 + beq _08139434 + ldr r0, =0x0000409a + movs r1, 0x4 + b _08139446 + .pool +_08139434: + movs r0, 0xE9 + lsls r0, 2 + bl FlagGet + lsls r0, 24 + cmp r0, 0 + beq _08139454 + ldr r0, =0x0000409a + movs r1, 0x5 +_08139446: + bl VarSet + movs r0, 0x1 + b _08139456 + .pool +_08139454: + movs r0, 0 +_08139456: + pop {r1} + bx r1 + thumb_func_end sub_81393FC + + thumb_func_start SetShoalItemFlag +SetShoalItemFlag: @ 813945C + push {lr} + ldr r0, =0x000008bf + bl FlagSet + pop {r0} + bx r0 + .pool + thumb_func_end SetShoalItemFlag + + thumb_func_start sub_813946C +sub_813946C: @ 813946C + push {r4,r5,lr} + sub sp, 0x14 + ldr r5, =gPlayerParty + movs r1, 0x90 + lsls r1, 1 + movs r4, 0 + str r4, [sp] + str r4, [sp, 0x4] + str r4, [sp, 0x8] + str r4, [sp, 0xC] + adds r0, r5, 0 + movs r2, 0x7 + movs r3, 0x20 + bl CreateMon + movs r1, 0x1 + add r0, sp, 0x10 + strh r1, [r0] + adds r0, r5, 0 + movs r1, 0x2E + add r2, sp, 0x10 + bl SetMonData + add r1, sp, 0x10 + movs r0, 0x21 + strh r0, [r1] + adds r0, r5, 0 + movs r1, 0xD + add r2, sp, 0x10 + bl SetMonData + add r0, sp, 0x10 + strh r4, [r0] + adds r0, r5, 0 + movs r1, 0xE + add r2, sp, 0x10 + bl SetMonData + adds r0, r5, 0 + movs r1, 0xF + add r2, sp, 0x10 + bl SetMonData + adds r0, r5, 0 + movs r1, 0x10 + add r2, sp, 0x10 + bl SetMonData + add sp, 0x14 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813946C + + thumb_func_start sub_81394D8 +sub_81394D8: @ 81394D8 + push {r4-r6,lr} + ldr r0, =0x00004023 + bl VarGet + lsls r0, 16 + lsrs r0, 16 + bl GetStarterPokemon + lsls r0, 16 + lsrs r6, r0, 16 + bl CalculatePlayerPartyCount + lsls r0, 24 + lsrs r5, r0, 24 + movs r4, 0 + cmp r4, r5 + bcs _08139526 +_081394FA: + movs r0, 0x64 + muls r0, r4 + ldr r1, =gPlayerParty + adds r0, r1 + movs r1, 0x41 + movs r2, 0 + bl GetMonData + cmp r0, r6 + bne _0813951C + movs r0, 0x1 + b _08139528 + .pool +_0813951C: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, r5 + bcc _081394FA +_08139526: + movs r0, 0 +_08139528: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_81394D8 + + thumb_func_start sub_8139530 +sub_8139530: @ 8139530 + push {lr} + bl sub_80D2218 + lsls r0, 24 + lsrs r0, 24 + pop {r1} + bx r1 + thumb_func_end sub_8139530 + + thumb_func_start sub_8139540 +sub_8139540: @ 8139540 + push {lr} + ldr r0, =gPlayerParty + movs r1, 0x3F + bl CheckPartyPokerus + lsls r0, 24 + cmp r0, 0 + beq _08139558 + movs r0, 0x1 + b _0813955A + .pool +_08139558: + movs r0, 0 +_0813955A: + pop {r1} + bx r1 + thumb_func_end sub_8139540 + + thumb_func_start sub_8139560 +sub_8139560: @ 8139560 + push {lr} + ldr r0, =sub_81395BC + movs r1, 0x9 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r1, r2 + ldr r0, =gSpecialVar_0x8005 + ldrh r0, [r0] + movs r2, 0 + strh r0, [r1, 0x8] + strh r2, [r1, 0xA] + ldr r0, =gSpecialVar_0x8006 + ldrh r0, [r0] + strh r0, [r1, 0xC] + ldr r0, =gSpecialVar_0x8007 + ldrh r0, [r0] + strh r0, [r1, 0xE] + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + strh r0, [r1, 0x10] + movs r0, 0 + bl SetCameraPanningCallback + movs r0, 0xD6 + bl PlaySE + pop {r0} + bx r0 + .pool + thumb_func_end sub_8139560 + + thumb_func_start sub_81395BC +sub_81395BC: @ 81395BC + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + ldrh r0, [r4, 0x2] + adds r0, 0x1 + strh r0, [r4, 0x2] + movs r1, 0x2 + ldrsh r0, [r4, r1] + movs r2, 0x6 + ldrsh r1, [r4, r2] + bl __modsi3 + cmp r0, 0 + bne _08139614 + strh r0, [r4, 0x2] + ldrh r0, [r4, 0x4] + subs r0, 0x1 + strh r0, [r4, 0x4] + ldrh r0, [r4] + negs r0, r0 + strh r0, [r4] + ldrh r0, [r4, 0x8] + negs r0, r0 + strh r0, [r4, 0x8] + movs r1, 0 + ldrsh r0, [r4, r1] + movs r2, 0x8 + ldrsh r1, [r4, r2] + bl SetCameraPanning + movs r1, 0x4 + ldrsh r0, [r4, r1] + cmp r0, 0 + bne _08139614 + adds r0, r5, 0 + bl sub_8139620 + bl InstallCameraPanAheadCallback +_08139614: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81395BC + + thumb_func_start sub_8139620 +sub_8139620: @ 8139620 + push {lr} + lsls r0, 24 + lsrs r0, 24 + bl DestroyTask + bl EnableBothScriptContexts + pop {r0} + bx r0 + thumb_func_end sub_8139620 + + thumb_func_start sub_8139634 +sub_8139634: @ 8139634 + push {lr} + movs r0, 0x95 + lsls r0, 2 + bl FlagGet + lsls r0, 24 + lsrs r0, 24 + pop {r1} + bx r1 + thumb_func_end sub_8139634 + + thumb_func_start sub_8139648 +sub_8139648: @ 8139648 + push {lr} + bl get_map_light_from_warp0 + lsls r0, 24 + lsrs r0, 24 + bl is_light_level_1_2_3_5_or_6 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _08139664 + movs r0, 0x14 + bl SetSav1Weather +_08139664: + pop {r0} + bx r0 + thumb_func_end sub_8139648 + + thumb_func_start sub_8139668 +sub_8139668: @ 8139668 + push {lr} + bl get_map_light_from_warp0 + lsls r0, 24 + lsrs r0, 24 + bl is_light_level_1_2_3_5_or_6 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _08139684 + movs r0, 0x15 + bl SetSav1Weather +_08139684: + pop {r0} + bx r0 + thumb_func_end sub_8139668 + + thumb_func_start GetLeadMonIndex +GetLeadMonIndex: @ 8139688 + push {r4-r6,lr} + bl CalculatePlayerPartyCount + lsls r0, 24 + lsrs r6, r0, 24 + movs r5, 0 + cmp r5, r6 + bcs _081396D6 +_08139698: + movs r0, 0x64 + adds r1, r5, 0 + muls r1, r0 + ldr r0, =gPlayerParty + adds r4, r1, r0 + adds r0, r4, 0 + movs r1, 0x41 + movs r2, 0 + bl GetMonData + movs r1, 0xCE + lsls r1, 1 + cmp r0, r1 + beq _081396CC + adds r0, r4, 0 + movs r1, 0x41 + movs r2, 0 + bl GetMonData + cmp r0, 0 + beq _081396CC + adds r0, r5, 0 + b _081396D8 + .pool +_081396CC: + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, r6 + bcc _08139698 +_081396D6: + movs r0, 0 +_081396D8: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end GetLeadMonIndex + + thumb_func_start sub_81396E0 +sub_81396E0: @ 81396E0 + push {lr} + ldr r0, =gSpecialVar_0x8004 + ldrh r1, [r0] + movs r0, 0x64 + muls r0, r1 + ldr r1, =gPlayerParty + adds r0, r1 + movs r1, 0x41 + movs r2, 0 + bl GetMonData + lsls r0, 16 + lsrs r0, 16 + pop {r1} + bx r1 + .pool + thumb_func_end sub_81396E0 + + thumb_func_start nullsub_54 +nullsub_54: @ 8139708 + bx lr + thumb_func_end nullsub_54 + + thumb_func_start sub_813970C +sub_813970C: @ 813970C + push {r4,lr} + ldr r0, =0x000040c2 + bl VarGet + lsls r0, 16 + lsrs r0, 16 + adds r3, r0, 0 + ldr r2, =gLocalTime + movs r1, 0 + ldrsh r0, [r2, r1] + subs r0, r3 + cmp r0, 0x6 + ble _08139734 + movs r0, 0 + b _0813974C + .pool +_08139734: + ldrh r1, [r2] + movs r4, 0 + ldrsh r0, [r2, r4] + cmp r0, 0 + blt _0813974A + subs r1, r3 + movs r0, 0x7 + subs r0, r1 + lsls r0, 16 + lsrs r0, 16 + b _0813974C +_0813974A: + movs r0, 0x8 +_0813974C: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_813970C + + thumb_func_start sub_8139754 +sub_8139754: @ 8139754 + push {r4,lr} + ldr r0, =0x000040c2 + ldr r4, =gLocalTime + ldrh r1, [r4] + bl VarSet + ldrh r0, [r4] + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_8139754 + + thumb_func_start sub_8139770 +sub_8139770: @ 8139770 + push {r4-r6,lr} + ldr r6, =gSpecialVar_0x8004 + ldrh r0, [r6] + movs r5, 0x64 + muls r0, r5 + ldr r4, =gPlayerParty + adds r0, r4 + movs r1, 0x3 + bl GetMonData + cmp r0, 0x2 + bne _081397A6 + ldrh r0, [r6] + muls r0, r5 + adds r0, r4 + ldr r4, =gStringVar1 + movs r1, 0x7 + adds r2, r4, 0 + bl GetMonData + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + adds r1, r4, 0 + bl StringCompare + cmp r0, 0 + beq _081397BC +_081397A6: + movs r0, 0x1 + b _081397BE + .pool +_081397BC: + movs r0, 0 +_081397BE: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_8139770 + + thumb_func_start sub_81397C4 +sub_81397C4: @ 81397C4 + push {r4,r5,lr} + ldr r2, =gSpecialVar_Result + ldrh r1, [r2] + ldr r0, =0x0000270f + cmp r1, r0 + bls _081397E0 + movs r0, 0 + bl TV_PrintIntToStringVar + b _08139862 + .pool +_081397E0: + ldr r0, =0x000003e7 + cmp r1, r0 + bls _081397F8 + ldr r4, =gStringVar1 + movs r0, 0xA1 + strb r0, [r4] + adds r4, 0x1 + b _0813981C + .pool +_081397F8: + cmp r1, 0x63 + bls _0813980C + ldr r4, =gStringVar1 + movs r0, 0xA1 + strb r0, [r4] + strb r0, [r4, 0x1] + adds r4, 0x2 + b _0813981C + .pool +_0813980C: + cmp r1, 0x9 + bls _0813983C + ldr r4, =gStringVar1 + movs r0, 0xA1 + strb r0, [r4] + strb r0, [r4, 0x1] + strb r0, [r4, 0x2] + adds r4, 0x3 +_0813981C: + ldrh r5, [r2] + adds r0, r5, 0 + bl sub_80EF370 + adds r3, r0, 0 + lsls r3, 24 + lsrs r3, 24 + adds r0, r4, 0 + adds r1, r5, 0 + movs r2, 0 + bl ConvertIntToDecimalStringN + b _08139862 + .pool +_0813983C: + ldr r4, =gStringVar1 + movs r0, 0xA1 + strb r0, [r4] + strb r0, [r4, 0x1] + strb r0, [r4, 0x2] + strb r0, [r4, 0x3] + adds r4, 0x4 + ldrh r5, [r2] + adds r0, r5, 0 + bl sub_80EF370 + adds r3, r0, 0 + lsls r3, 24 + lsrs r3, 24 + adds r0, r4, 0 + adds r1, r5, 0 + movs r2, 0 + bl ConvertIntToDecimalStringN +_08139862: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_81397C4 + + thumb_func_start sub_813986C +sub_813986C: @ 813986C + push {lr} + ldr r0, =gSpecialVar_Result + ldrh r0, [r0] + cmp r0, 0x4 + bhi _081398B8 + lsls r0, 2 + ldr r1, =_08139888 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08139888: + .4byte _0813989C + .4byte _081398A0 + .4byte _081398A4 + .4byte _081398A8 + .4byte _081398AC +_0813989C: + movs r0, 0x3 + b _081398AE +_081398A0: + movs r0, 0x4 + b _081398AE +_081398A4: + movs r0, 0 + b _081398AE +_081398A8: + movs r0, 0x1 + b _081398AE +_081398AC: + movs r0, 0x2 +_081398AE: + bl mevent_081445C0 + lsls r0, 16 + lsrs r0, 16 + b _081398BA +_081398B8: + movs r0, 0 +_081398BA: + pop {r1} + bx r1 + thumb_func_end sub_813986C + + thumb_func_start sub_81398C0 +sub_81398C0: @ 81398C0 + push {r4,lr} + ldr r1, =gSpecialVar_0x8004 + ldr r2, =0xfffffedf + adds r0, r2, 0 + ldrh r2, [r1] + adds r0, r2 + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x39 + bls _081398E0 + movs r0, 0 + b _081398FC + .pool +_081398E0: + ldr r4, =gStringVar2 + ldrh r0, [r1] + bl ItemIdToBattleMoveId + lsls r0, 16 + lsrs r0, 16 + movs r1, 0xD + muls r1, r0 + ldr r0, =gMoveNames + adds r1, r0 + adds r0, r4, 0 + bl StringCopy + movs r0, 0x1 +_081398FC: + pop {r4} + pop {r1} + bx r1 + .pool + thumb_func_end sub_81398C0 + + thumb_func_start sub_813990C +sub_813990C: @ 813990C + push {r4,r5,lr} + bl CalculatePlayerPartyCount + lsls r0, 24 + lsrs r5, r0, 24 + movs r4, 0 + cmp r4, r5 + bcs _08139942 +_0813991C: + movs r0, 0x64 + muls r0, r4 + ldr r1, =gPlayerParty + adds r0, r1 + movs r1, 0x4 + bl GetMonData + cmp r0, 0x1 + bne _08139938 + movs r0, 0x1 + b _08139944 + .pool +_08139938: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, r5 + bcc _0813991C +_08139942: + movs r0, 0 +_08139944: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_813990C + + thumb_func_start InMultiBattleRoom +InMultiBattleRoom: @ 813994C + push {lr} + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldrh r1, [r0, 0x4] + ldr r0, =0x00000f1a + cmp r1, r0 + bne _08139978 + ldr r0, =0x000040ce + bl VarGet + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x2 + bne _08139978 + movs r0, 0x1 + b _0813997A + .pool +_08139978: + movs r0, 0 +_0813997A: + pop {r1} + bx r1 + thumb_func_end InMultiBattleRoom + + thumb_func_start sub_8139980 +sub_8139980: @ 8139980 + push {lr} + movs r0, 0 + bl SetCameraPanningCallback + movs r0, 0x8 + movs r1, 0 + bl SetCameraPanning + pop {r0} + bx r0 + thumb_func_end sub_8139980 + + thumb_func_start sub_8139994 +sub_8139994: @ 8139994 + push {lr} + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldrb r0, [r0, 0x15] + subs r0, 0x10 + lsls r0, 24 + asrs r0, 24 + cmp r0, 0x5 + bhi _081399E4 + lsls r0, 2 + ldr r1, =_081399B8 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_081399B8: + .4byte _081399E4 + .4byte _081399D0 + .4byte _081399D4 + .4byte _081399D8 + .4byte _081399DC + .4byte _081399E0 +_081399D0: + movs r1, 0x5 + b _081399E6 +_081399D4: + movs r1, 0x6 + b _081399E6 +_081399D8: + movs r1, 0x7 + b _081399E6 +_081399DC: + movs r1, 0x8 + b _081399E6 +_081399E0: + movs r1, 0xF + b _081399E6 +_081399E4: + movs r1, 0x4 +_081399E6: + ldr r0, =0x00004043 + bl VarSet + pop {r0} + bx r0 + .pool + thumb_func_end sub_8139994 + + thumb_func_start sub_81399F4 +sub_81399F4: @ 81399F4 + push {r4,lr} + ldr r2, =gUnknown_0203AB60 + movs r0, 0 + strh r0, [r2] + ldr r1, =gUnknown_0203AB62 + strh r0, [r1] + ldr r0, =gSaveBlock1Ptr + ldr r3, [r0] + movs r0, 0x14 + ldrsb r0, [r3, r0] + adds r4, r1, 0 + cmp r0, 0xD + bne _08139A6E + ldrb r0, [r3, 0x15] + subs r0, 0x10 + lsls r0, 24 + asrs r0, 24 + cmp r0, 0x4 + bhi _08139A6E + lsls r0, 2 + ldr r1, =_08139A34 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_08139A34: + .4byte _08139A66 + .4byte _08139A5E + .4byte _08139A56 + .4byte _08139A4E + .4byte _08139A48 +_08139A48: + movs r0, 0 + strh r0, [r2] + b _08139A6C +_08139A4E: + movs r0, 0 + strh r0, [r2] + movs r0, 0x1 + b _08139A6C +_08139A56: + movs r0, 0 + strh r0, [r2] + movs r0, 0x2 + b _08139A6C +_08139A5E: + movs r0, 0 + strh r0, [r2] + movs r0, 0x3 + b _08139A6C +_08139A66: + movs r0, 0 + strh r0, [r2] + movs r0, 0x4 +_08139A6C: + strh r0, [r4] +_08139A6E: + ldrh r0, [r4] + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_81399F4 + + thumb_func_start sub_8139A78 +sub_8139A78: @ 8139A78 + push {r4-r6,lr} + ldr r0, =sub_8139AF4 + movs r1, 0x9 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + ldr r0, =gTasks + 0x8 + adds r4, r1, r0 + movs r3, 0 + strh r3, [r4, 0x2] + strh r3, [r4, 0x4] + movs r6, 0x1 + strh r6, [r4, 0x8] + ldr r0, =gSpecialVar_0x8005 + ldr r1, =gSpecialVar_0x8006 + ldrh r2, [r0] + ldrh r0, [r1] + cmp r2, r0 + bls _08139AC0 + subs r0, r2, r0 + lsls r0, 16 + lsrs r5, r0, 16 + strh r6, [r4, 0xC] + b _08139AC8 + .pool +_08139AC0: + subs r0, r2 + lsls r0, 16 + lsrs r5, r0, 16 + strh r3, [r4, 0xC] +_08139AC8: + cmp r5, 0x8 + bls _08139ACE + movs r5, 0x8 +_08139ACE: + ldr r0, =gUnknown_085B2C18 + adds r0, r5, r0 + ldrb r0, [r0] + strh r0, [r4, 0xA] + movs r0, 0 + bl SetCameraPanningCallback + ldrb r1, [r4, 0xC] + adds r0, r5, 0 + bl sub_8139C2C + movs r0, 0x59 + bl PlaySE + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8139A78 + + thumb_func_start sub_8139AF4 +sub_8139AF4: @ 8139AF4 + push {r4,r5,lr} + lsls r0, 24 + lsrs r5, r0, 24 + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + ldrh r0, [r4, 0x2] + adds r0, 0x1 + strh r0, [r4, 0x2] + movs r1, 0x2 + ldrsh r0, [r4, r1] + movs r1, 0x3 + bl __modsi3 + lsls r0, 16 + asrs r0, 16 + cmp r0, 0 + bne _08139B54 + strh r0, [r4, 0x2] + ldrh r0, [r4, 0x4] + adds r0, 0x1 + strh r0, [r4, 0x4] + ldrh r0, [r4, 0x8] + negs r0, r0 + strh r0, [r4, 0x8] + movs r2, 0x8 + ldrsh r1, [r4, r2] + movs r0, 0 + bl SetCameraPanning + movs r0, 0x4 + ldrsh r1, [r4, r0] + movs r2, 0xA + ldrsh r0, [r4, r2] + cmp r1, r0 + bne _08139B54 + movs r0, 0x49 + bl PlaySE + adds r0, r5, 0 + bl DestroyTask + bl EnableBothScriptContexts + bl InstallCameraPanAheadCallback +_08139B54: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8139AF4 + + thumb_func_start sub_8139B60 +sub_8139B60: @ 8139B60 + push {r4-r6,lr} + mov r6, r9 + mov r5, r8 + push {r5,r6} + sub sp, 0xC + ldr r5, =gUnknown_0203AB5E + ldr r0, =gUnknown_085B2BAC + bl AddWindow + strb r0, [r5] + ldrb r0, [r5] + movs r1, 0 + bl SetStandardWindowBorderStyle + ldr r4, =gText_ElevatorNowOn + movs r0, 0x1 + adds r1, r4, 0 + movs r2, 0x40 + bl GetStringCenterAlignXOffset + adds r3, r0, 0 + ldrb r0, [r5] + lsls r3, 24 + lsrs r3, 24 + movs r1, 0x1 + str r1, [sp] + movs r1, 0xFF + mov r9, r1 + str r1, [sp, 0x4] + movs r1, 0 + mov r8, r1 + str r1, [sp, 0x8] + movs r1, 0x1 + adds r2, r4, 0 + bl PrintTextOnWindow + ldr r6, =gUnknown_085B2BB4 + ldr r4, =gSpecialVar_0x8005 + ldrh r0, [r4] + lsls r0, 2 + adds r0, r6 + ldr r1, [r0] + movs r0, 0x1 + movs r2, 0x40 + bl GetStringCenterAlignXOffset + adds r3, r0, 0 + ldrb r0, [r5] + ldrh r1, [r4] + lsls r1, 2 + adds r1, r6 + ldr r2, [r1] + lsls r3, 24 + lsrs r3, 24 + movs r1, 0x11 + str r1, [sp] + mov r1, r9 + str r1, [sp, 0x4] + mov r1, r8 + str r1, [sp, 0x8] + movs r1, 0x1 + bl PrintTextOnWindow + ldrb r0, [r5] + bl PutWindowTilemap + ldrb r0, [r5] + movs r1, 0x3 + bl CopyWindowToVram + add sp, 0xC + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8139B60 + + thumb_func_start sub_8139C10 +sub_8139C10: @ 8139C10 + push {r4,lr} + ldr r4, =gUnknown_0203AB5E + ldrb r0, [r4] + movs r1, 0x1 + bl sub_8198070 + ldrb r0, [r4] + bl RemoveWindow + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8139C10 + + thumb_func_start sub_8139C2C +sub_8139C2C: @ 8139C2C + push {r4-r6,lr} + lsls r0, 16 + lsrs r6, r0, 16 + lsls r1, 24 + lsrs r5, r1, 24 + ldr r4, =sub_8139C80 + adds r0, r4, 0 + bl FuncIsActiveTask + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _08139C6C + adds r0, r4, 0 + movs r1, 0x8 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r1, r2 + movs r0, 0 + strh r0, [r1, 0x8] + strh r0, [r1, 0xA] + strh r5, [r1, 0xC] + ldr r0, =gUnknown_085B2C21 + adds r0, r6, r0 + ldrb r0, [r0] + strh r0, [r1, 0xE] +_08139C6C: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8139C2C + + thumb_func_start sub_8139C80 +sub_8139C80: @ 8139C80 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + lsls r0, 24 + lsrs r0, 24 + str r0, [sp] + lsls r0, 2 + ldr r1, [sp] + adds r0, r1 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r6, r0, r1 + movs r2, 0x2 + ldrsh r0, [r6, r2] + cmp r0, 0x6 + bne _08139D7C + ldrh r0, [r6] + adds r0, 0x1 + strh r0, [r6] + movs r1, 0x4 + ldrsh r0, [r6, r1] + cmp r0, 0 + bne _08139D10 + movs r1, 0 + ldr r2, =gUnknown_085B2BF4 + mov r10, r2 +_08139CBA: + movs r5, 0 + adds r7, r1, 0x7 + lsls r0, r1, 1 + adds r2, r1, 0x1 + mov r8, r2 + adds r0, r1 + lsls r0, 1 + mov r9, r0 +_08139CCA: + adds r4, r5, 0 + adds r4, 0x8 + movs r1, 0 + ldrsh r0, [r6, r1] + movs r1, 0x3 + bl __modsi3 + lsls r0, 16 + asrs r0, 15 + add r0, r9 + add r0, r10 + ldrh r0, [r0] + movs r1, 0xC0 + lsls r1, 4 + adds r2, r1, 0 + orrs r2, r0 + adds r0, r4, 0 + adds r1, r7, 0 + bl MapGridSetMetatileIdAt + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x2 + bls _08139CCA + mov r2, r8 + lsls r0, r2, 24 + lsrs r1, r0, 24 + cmp r1, 0x2 + bls _08139CBA + b _08139D62 + .pool +_08139D10: + movs r1, 0 + ldr r0, =gUnknown_085B2C06 + mov r10, r0 +_08139D16: + movs r5, 0 + adds r7, r1, 0x7 + lsls r0, r1, 1 + adds r2, r1, 0x1 + mov r8, r2 + adds r0, r1 + lsls r0, 1 + mov r9, r0 +_08139D26: + adds r4, r5, 0 + adds r4, 0x8 + movs r1, 0 + ldrsh r0, [r6, r1] + movs r1, 0x3 + bl __modsi3 + lsls r0, 16 + asrs r0, 15 + add r0, r9 + add r0, r10 + ldrh r0, [r0] + movs r1, 0xC0 + lsls r1, 4 + adds r2, r1, 0 + orrs r2, r0 + adds r0, r4, 0 + adds r1, r7, 0 + bl MapGridSetMetatileIdAt + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x2 + bls _08139D26 + mov r2, r8 + lsls r0, r2, 24 + lsrs r1, r0, 24 + cmp r1, 0x2 + bls _08139D16 +_08139D62: + bl DrawWholeMapView + movs r0, 0 + strh r0, [r6, 0x2] + movs r0, 0 + ldrsh r1, [r6, r0] + movs r2, 0x6 + ldrsh r0, [r6, r2] + cmp r1, r0 + bne _08139D7C + ldr r0, [sp] + bl DestroyTask +_08139D7C: + ldrh r0, [r6, 0x2] + adds r0, 0x1 + strh r0, [r6, 0x2] + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8139C80 + + thumb_func_start sub_8139D98 +sub_8139D98: @ 8139D98 + push {r4-r7,lr} + sub sp, 0x18 + ldr r6, =gSpecialVar_0x8004 + ldrh r0, [r6] + movs r5, 0x64 + muls r0, r5 + ldr r4, =gPlayerParty + adds r0, r4 + movs r1, 0x27 + bl GetMonData + str r0, [sp] + ldrh r0, [r6] + muls r0, r5 + adds r0, r4 + movs r1, 0x28 + bl GetMonData + str r0, [sp, 0x4] + ldrh r0, [r6] + muls r0, r5 + adds r0, r4 + movs r1, 0x29 + bl GetMonData + str r0, [sp, 0x8] + ldrh r0, [r6] + muls r0, r5 + adds r0, r4 + movs r1, 0x2A + bl GetMonData + str r0, [sp, 0xC] + ldrh r0, [r6] + muls r0, r5 + adds r0, r4 + movs r1, 0x2B + bl GetMonData + str r0, [sp, 0x10] + ldrh r0, [r6] + muls r0, r5 + adds r0, r4 + movs r1, 0x2C + bl GetMonData + str r0, [sp, 0x14] + ldr r1, =gSpecialVar_0x8005 + movs r0, 0 + strh r0, [r1] + movs r4, 0 + adds r2, r1, 0 +_08139E00: + lsls r0, r4, 2 + add r0, sp + ldr r1, [r0] + ldrh r0, [r2] + adds r0, r1 + strh r0, [r2] + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x5 + bls _08139E00 + ldr r2, =gSpecialVar_0x8006 + movs r0, 0 + strh r0, [r2] + ldr r1, =gSpecialVar_0x8007 + ldr r0, [sp] + strh r0, [r1] + movs r4, 0x1 + adds r6, r2, 0 + adds r7, r1, 0 +_08139E28: + ldrh r0, [r6] + lsls r0, 2 + mov r2, sp + adds r1, r2, r0 + lsls r0, r4, 2 + adds r5, r2, r0 + ldr r1, [r1] + ldr r0, [r5] + cmp r1, r0 + bcs _08139E54 + strh r4, [r6] + b _08139E6C + .pool +_08139E54: + cmp r1, r0 + bne _08139E6E + bl Random + lsls r0, 16 + lsrs r0, 16 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + beq _08139E6E + strh r4, [r6] + ldr r0, [r5] +_08139E6C: + strh r0, [r7] +_08139E6E: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x5 + bls _08139E28 + add sp, 0x18 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_8139D98 + + thumb_func_start warp0_in_pokecenter +warp0_in_pokecenter: @ 8139E80 + push {r4,lr} + ldr r0, =gUnknown_020322DC + movs r1, 0 + ldrsb r1, [r0, r1] + lsls r1, 8 + ldrb r0, [r0, 0x1] + lsls r0, 24 + asrs r0, 24 + adds r0, r1 + lsls r0, 16 + lsrs r3, r0, 16 + ldr r2, =gUnknown_085B2C2A + ldrh r0, [r2] + ldr r1, =0x0000ffff + cmp r0, r1 + beq _08139EC6 + adds r4, r1, 0 + adds r1, r2, 0 +_08139EA4: + ldrh r0, [r2] + cmp r0, r3 + bne _08139EBC + movs r0, 0x1 + b _08139EC8 + .pool +_08139EBC: + adds r1, 0x2 + adds r2, 0x2 + ldrh r0, [r1] + cmp r0, r4 + bne _08139EA4 +_08139EC6: + movs r0, 0 +_08139EC8: + pop {r4} + pop {r1} + bx r1 + thumb_func_end warp0_in_pokecenter + + thumb_func_start sub_8139ED0 +sub_8139ED0: @ 8139ED0 + push {lr} + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldrh r1, [r0, 0x4] + ldr r0, =0x00003c1a + cmp r1, r0 + beq _08139EEC + movs r0, 0x1 + b _08139EEE + .pool +_08139EEC: + movs r0, 0 +_08139EEE: + pop {r1} + bx r1 + thumb_func_end sub_8139ED0 + + thumb_func_start UpdateFrontierManiac +UpdateFrontierManiac: @ 8139EF4 + push {r4,r5,lr} + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + ldr r0, =0x0000402f + bl GetVarPointer + adds r5, r0, 0 + ldrh r0, [r5] + adds r4, r0 + strh r4, [r5] + ldrh r0, [r5] + movs r1, 0xA + bl __umodsi3 + strh r0, [r5] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end UpdateFrontierManiac + + thumb_func_start sub_8139F20 +sub_8139F20: @ 8139F20 + push {r4-r7,lr} + movs r4, 0 + ldr r0, =0x0000402f + bl VarGet + lsls r0, 16 + lsrs r6, r0, 16 + cmp r6, 0x9 + bls _08139F34 + b _0813A03A +_08139F34: + lsls r0, r6, 2 + ldr r1, =_08139F48 + adds r1, r0, r1 + ldr r1, [r1] + adds r2, r0, 0 + mov pc, r1 + .pool + .align 2, 0 +_08139F48: + .4byte _08139F70 + .4byte _08139F70 + .4byte _08139F70 + .4byte _08139F70 + .4byte _08139F94 + .4byte _08139FB4 + .4byte _08139FCC + .4byte _08139FE4 + .4byte _08139FFC + .4byte _0813A014 +_08139F70: + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + movs r3, 0xCE + lsls r3, 4 + adds r1, r0, r3 + adds r3, r1, r2 + ldr r1, =0x00000ce2 + adds r0, r1 + adds r1, r0, r2 + ldrh r0, [r3] + ldrh r2, [r1] + cmp r0, r2 + bcs _0813A028 + b _0813A038 + .pool +_08139F94: + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldr r3, =0x00000d0c + adds r2, r0, r3 + adds r3, 0x2 +_08139F9E: + adds r1, r0, r3 + ldrh r0, [r2] + ldrh r3, [r1] + cmp r0, r3 + bcs _0813A028 + b _0813A038 + .pool +_08139FB4: + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldr r1, =0x00000de2 + adds r2, r0, r1 + ldr r3, =0x00000de4 + b _08139F9E + .pool +_08139FCC: + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldr r1, =0x00000dc8 + adds r2, r0, r1 + ldr r3, =0x00000dca + b _08139F9E + .pool +_08139FE4: + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldr r1, =0x00000dda + adds r2, r0, r1 + ldr r3, =0x00000ddc + b _08139F9E + .pool +_08139FFC: + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldr r1, =0x00000e04 + adds r2, r0, r1 + ldr r3, =0x00000e06 + b _08139F9E + .pool +_0813A014: + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldr r1, =0x00000e1a + adds r2, r0, r1 + ldr r3, =0x00000e1c + adds r1, r0, r3 + ldrh r0, [r2] + ldrh r3, [r1] + cmp r0, r3 + bcc _0813A038 +_0813A028: + adds r4, r0, 0 + b _0813A03A + .pool +_0813A038: + ldrh r4, [r1] +_0813A03A: + movs r2, 0 + ldr r5, =gUnknown_085B2CC8 + lsls r0, r6, 1 + adds r1, r0, r5 + ldrb r1, [r1] + adds r3, r0, 0 + ldr r7, =gUnknown_085B2C50 + cmp r1, r4 + bcs _0813A062 + adds r1, r3, 0 +_0813A04E: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x1 + bhi _0813A062 + adds r0, r2, r1 + adds r0, r5 + ldrb r0, [r0] + cmp r0, r4 + bcc _0813A04E +_0813A062: + adds r0, r3, r6 + adds r0, r2 + lsls r0, 2 + adds r0, r7 + ldr r0, [r0] + bl ShowFieldMessage + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_8139F20 + + thumb_func_start sub_813A080 +sub_813A080: @ 813A080 + push {r4-r7,lr} + ldr r0, =0x000040ce + bl VarGet + lsls r0, 16 + lsrs r5, r0, 16 + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldr r1, =0x00000ca9 + adds r0, r1 + ldrb r0, [r0] + lsls r0, 30 + lsrs r4, r0, 30 + cmp r5, 0x2 + bne _0813A0D8 + movs r0, 0xA9 + lsls r0, 1 + bl FlagGet + lsls r0, 24 + cmp r0, 0 + bne _0813A0D8 + ldr r1, =gSpecialVar_0x8005 + movs r0, 0x5 + strh r0, [r1] + ldr r1, =gSpecialVar_0x8006 + movs r0, 0x4 + strh r0, [r1] + b _0813A110 + .pool +_0813A0D0: + movs r0, 0x4 + strh r0, [r6] + adds r0, r3, 0x5 + b _0813A10E +_0813A0D8: + movs r3, 0 + ldr r6, =gSpecialVar_0x8005 + ldr r7, =gSpecialVar_0x8006 + lsls r1, r4, 1 + lsls r2, r5, 2 + ldr r4, =gUnknown_085B2CDC + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + adds r1, r2 + movs r2, 0xCE + lsls r2, 4 + adds r0, r2 + adds r0, r1 + ldrh r1, [r0] +_0813A0F4: + lsls r0, r3, 1 + adds r0, r4 + ldrh r0, [r0] + cmp r0, r1 + bhi _0813A0D0 + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0x8 + bls _0813A0F4 + movs r0, 0x4 + strh r0, [r6] + movs r0, 0xC +_0813A10E: + strh r0, [r7] +_0813A110: + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813A080 + + thumb_func_start sub_813A128 +sub_813A128: @ 813A128 + push {r4,lr} + ldr r0, =sub_813A2DC + movs r1, 0x8 + bl CreateTask + lsls r0, 24 + lsrs r4, r0, 24 + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + ldr r1, =gTasks + adds r3, r0, r1 + ldr r1, =gSpecialVar_0x8004 + ldrh r0, [r1] + strh r0, [r3, 0x1E] + ldrh r0, [r1] + cmp r0, 0xC + bls _0813A14E + b _0813A2C6 +_0813A14E: + lsls r0, 2 + ldr r1, =_0813A168 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0813A168: + .4byte _0813A19C + .4byte _0813A1AA + .4byte _0813A1C2 + .4byte _0813A1D6 + .4byte _0813A1F0 + .4byte _0813A208 + .4byte _0813A222 + .4byte _0813A23C + .4byte _0813A25A + .4byte _0813A274 + .4byte _0813A274 + .4byte _0813A28E + .4byte _0813A2A8 +_0813A19C: + movs r1, 0 + movs r0, 0x1 + strh r0, [r3, 0x8] + strh r0, [r3, 0xA] + strh r0, [r3, 0xC] + strh r0, [r3, 0xE] + b _0813A2BC +_0813A1AA: + movs r1, 0 + movs r0, 0x5 + strh r0, [r3, 0x8] + movs r0, 0x8 + strh r0, [r3, 0xA] + movs r0, 0x1 + strh r0, [r3, 0xC] + strh r0, [r3, 0xE] + movs r0, 0x9 + strh r0, [r3, 0x10] + movs r0, 0xA + b _0813A2BE +_0813A1C2: + movs r2, 0 + movs r0, 0x6 + strh r0, [r3, 0x8] + movs r1, 0xC + strh r1, [r3, 0xA] + movs r0, 0x1 + strh r0, [r3, 0xC] + strh r0, [r3, 0xE] + movs r0, 0x7 + b _0813A250 +_0813A1D6: + movs r1, 0 + movs r0, 0x6 + strh r0, [r3, 0x8] + movs r0, 0xB + strh r0, [r3, 0xA] + movs r0, 0xE + strh r0, [r3, 0xC] + movs r0, 0x1 + strh r0, [r3, 0xE] + movs r0, 0xF + strh r0, [r3, 0x10] + movs r0, 0xC + b _0813A2BE +_0813A1F0: + movs r1, 0 + movs r0, 0x6 + strh r0, [r3, 0x8] + strh r0, [r3, 0xA] + movs r0, 0xE + strh r0, [r3, 0xC] + movs r0, 0x1 + strh r0, [r3, 0xE] + movs r0, 0xF + strh r0, [r3, 0x10] + movs r0, 0xC + b _0813A2BE +_0813A208: + movs r1, 0 + movs r0, 0x6 + strh r0, [r3, 0x8] + movs r0, 0x7 + strh r0, [r3, 0xA] + movs r0, 0xE + strh r0, [r3, 0xC] + movs r0, 0x1 + strh r0, [r3, 0xE] + movs r0, 0xF + strh r0, [r3, 0x10] + movs r0, 0xC + b _0813A2BE +_0813A222: + movs r1, 0 + movs r0, 0x6 + strh r0, [r3, 0x8] + movs r0, 0xA + strh r0, [r3, 0xA] + movs r0, 0xE + strh r0, [r3, 0xC] + movs r0, 0x1 + strh r0, [r3, 0xE] + movs r0, 0xF + strh r0, [r3, 0x10] + movs r0, 0xC + b _0813A2BE +_0813A23C: + movs r2, 0 + movs r0, 0x6 + strh r0, [r3, 0x8] + movs r1, 0xC + strh r1, [r3, 0xA] + movs r0, 0xF + strh r0, [r3, 0xC] + movs r0, 0x1 + strh r0, [r3, 0xE] + movs r0, 0xE +_0813A250: + strh r0, [r3, 0x10] + strh r1, [r3, 0x12] + strh r2, [r3, 0x14] + strh r4, [r3, 0x26] + b _0813A2D2 +_0813A25A: + movs r1, 0 + movs r0, 0x6 + strh r0, [r3, 0x8] + movs r0, 0xA + strh r0, [r3, 0xA] + movs r0, 0x11 + strh r0, [r3, 0xC] + movs r0, 0x1 + strh r0, [r3, 0xE] + movs r0, 0xB + strh r0, [r3, 0x10] + movs r0, 0xC + b _0813A2BE +_0813A274: + movs r1, 0 + movs r0, 0x6 + strh r0, [r3, 0x8] + movs r0, 0xB + strh r0, [r3, 0xA] + movs r0, 0xF + strh r0, [r3, 0xC] + movs r0, 0x1 + strh r0, [r3, 0xE] + movs r0, 0xE + strh r0, [r3, 0x10] + movs r0, 0xC + b _0813A2BE +_0813A28E: + movs r1, 0 + movs r0, 0x6 + strh r0, [r3, 0x8] + movs r0, 0x7 + strh r0, [r3, 0xA] + movs r0, 0x13 + strh r0, [r3, 0xC] + movs r0, 0x1 + strh r0, [r3, 0xE] + movs r0, 0xA + strh r0, [r3, 0x10] + movs r0, 0xC + b _0813A2BE +_0813A2A8: + movs r1, 0 + movs r0, 0x6 + strh r0, [r3, 0x8] + movs r0, 0x7 + strh r0, [r3, 0xA] + movs r0, 0x11 + strh r0, [r3, 0xC] + movs r0, 0x1 + strh r0, [r3, 0xE] + movs r0, 0xC +_0813A2BC: + strh r0, [r3, 0x10] +_0813A2BE: + strh r0, [r3, 0x12] + strh r1, [r3, 0x14] + strh r4, [r3, 0x26] + b _0813A2D2 +_0813A2C6: + ldr r1, =gSpecialVar_Result + movs r0, 0x7F + strh r0, [r1] + adds r0, r4, 0 + bl DestroyTask +_0813A2D2: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813A128 + + thumb_func_start sub_813A2DC +sub_813A2DC: @ 813A2DC + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x20 + lsls r0, 24 + lsrs r7, r0, 24 + lsls r0, r7, 2 + adds r0, r7 + lsls r0, 3 + ldr r1, =gTasks + adds r6, r0, r1 + bl ScriptContext2_Enable + ldr r0, =gUnknown_0203AB68 + movs r5, 0 + strh r5, [r0] + ldr r1, =gUnknown_0203AB6C + movs r0, 0x40 + strb r0, [r1] + ldrh r0, [r6, 0x1E] + movs r1, 0 + bl sub_813AA60 + ldrb r0, [r6, 0x1E] + movs r1, 0 + bl sub_813ACE8 + ldr r4, =gUnknown_0203AB64 + movs r1, 0xA + ldrsh r0, [r6, r1] + lsls r0, 3 + bl AllocZeroed + str r0, [r4] + ldr r0, =gUnknown_0203AB6A + strh r5, [r0] + bl sub_813A42C + movs r3, 0 + movs r4, 0 + movs r2, 0xA + ldrsh r0, [r6, r2] + add r1, sp, 0x18 + mov r8, r1 + cmp r3, r0 + bge _0813A36A + ldr r5, =gUnknown_085B2CF0 +_0813A33A: + lsls r1, r4, 2 + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + lsls r0, 6 + adds r1, r0 + adds r1, r5 + ldr r0, [r1] + ldr r1, =gUnknown_0203AB64 + ldr r2, [r1] + lsls r1, r4, 3 + adds r1, r2 + str r0, [r1] + str r4, [r1, 0x4] + adds r1, r3, 0 + bl display_text_and_get_width + adds r3, r0, 0 + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + movs r2, 0xA + ldrsh r0, [r6, r2] + cmp r4, r0 + blt _0813A33A +_0813A36A: + adds r0, r3, 0 + bl convert_pixel_width_to_tile_width + strh r0, [r6, 0x10] + movs r1, 0xC + ldrsh r0, [r6, r1] + movs r2, 0x10 + ldrsh r1, [r6, r2] + adds r0, r1 + cmp r0, 0x1D + ble _0813A38C + movs r0, 0x1D + subs r0, r1 + cmp r0, 0 + bge _0813A38A + movs r0, 0 +_0813A38A: + strh r0, [r6, 0xC] +_0813A38C: + ldrb r2, [r6, 0xC] + ldrb r3, [r6, 0xE] + ldrb r0, [r6, 0x10] + str r0, [sp] + ldrb r0, [r6, 0x12] + str r0, [sp, 0x4] + movs r0, 0xF + str r0, [sp, 0x8] + movs r0, 0x64 + str r0, [sp, 0xC] + add r0, sp, 0x10 + movs r1, 0 + bl sub_8198A50 + ldr r0, [sp, 0x10] + ldr r1, [sp, 0x14] + str r0, [sp, 0x18] + str r1, [sp, 0x1C] + mov r0, r8 + bl AddWindow + lsls r0, 24 + lsrs r0, 24 + strh r0, [r6, 0x22] + movs r1, 0 + bl SetStandardWindowBorderStyle + ldr r4, =gUnknown_030061D0 + ldrh r0, [r6, 0xA] + strh r0, [r4, 0xC] + ldrh r0, [r6, 0x8] + strh r0, [r4, 0xE] + ldrh r0, [r6, 0x22] + strb r0, [r4, 0x10] + adds r0, r7, 0 + bl sub_813A694 + ldrh r1, [r6, 0x16] + ldrh r2, [r6, 0x18] + adds r0, r4, 0 + bl ListMenuInit + lsls r0, 24 + lsrs r0, 24 + strh r0, [r6, 0x24] + movs r0, 0 + bl schedule_bg_copy_tilemap_to_vram + ldr r1, =gTasks + lsls r0, r7, 2 + adds r0, r7 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_813A4EC + str r1, [r0] + add sp, 0x20 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813A2DC + + thumb_func_start sub_813A42C +sub_813A42C: @ 813A42C + ldr r1, =gUnknown_030061D0 + ldr r0, =gUnknown_0203AB64 + ldr r0, [r0] + str r0, [r1] + ldr r0, =sub_813A46C + str r0, [r1, 0x4] + movs r0, 0 + str r0, [r1, 0x8] + movs r2, 0 + movs r0, 0x1 + strh r0, [r1, 0xC] + strh r0, [r1, 0xE] + strb r2, [r1, 0x10] + strb r2, [r1, 0x11] + movs r0, 0x8 + strb r0, [r1, 0x12] + strb r2, [r1, 0x13] + movs r0, 0x21 + strb r0, [r1, 0x14] + movs r0, 0x31 + strb r0, [r1, 0x15] + movs r0, 0 + strb r0, [r1, 0x16] + movs r0, 0x1 + strb r0, [r1, 0x17] + bx lr + .pool + thumb_func_end sub_813A42C + + thumb_func_start sub_813A46C +sub_813A46C: @ 813A46C + push {r4,r5,lr} + sub sp, 0x4 + movs r0, 0x5 + bl PlaySE + ldr r0, =sub_813A4EC + bl FindTaskIdByFunc + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0xFF + beq _0813A4D4 + lsls r4, r0, 2 + adds r4, r0 + lsls r4, 3 + ldr r0, =gTasks + adds r4, r0 + ldrh r0, [r4, 0x24] + lsls r0, 24 + lsrs r0, 24 + mov r1, sp + movs r2, 0 + bl sub_81AE860 + ldr r1, =gUnknown_0203AB68 + mov r0, sp + ldrh r0, [r0] + strh r0, [r1] + ldrh r0, [r4, 0x24] + lsls r0, 24 + lsrs r0, 24 + mov r1, sp + bl sub_81AE838 + ldrh r0, [r4, 0x1E] + ldr r5, =gUnknown_0203AB6A + ldrh r1, [r5] + bl sub_813AC44 + ldrh r0, [r4, 0x1E] + mov r1, sp + ldrh r1, [r1] + bl sub_813AA60 + ldrb r0, [r4, 0x1E] + mov r1, sp + ldrh r1, [r1] + bl sub_813AD34 + mov r0, sp + ldrh r0, [r0] + strh r0, [r5] +_0813A4D4: + add sp, 0x4 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813A46C + + thumb_func_start sub_813A4EC +sub_813A4EC: @ 813A4EC + push {r4-r6,lr} + lsls r0, 24 + lsrs r5, r0, 24 + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + ldr r1, =gTasks + adds r6, r0, r1 + ldrh r0, [r6, 0x24] + lsls r0, 24 + lsrs r0, 24 + bl ListMenuHandleInputGetItemId + adds r4, r0, 0 + movs r0, 0x2 + negs r0, r0 + cmp r4, r0 + beq _0813A51C + adds r0, 0x1 + cmp r4, r0 + bne _0813A530 + b _0813A566 + .pool +_0813A51C: + ldr r1, =gSpecialVar_Result + movs r0, 0x7F + strh r0, [r1] + movs r0, 0x5 + bl PlaySE + b _0813A54C + .pool +_0813A530: + ldr r0, =gSpecialVar_Result + strh r4, [r0] + movs r0, 0x5 + bl PlaySE + movs r1, 0x14 + ldrsh r0, [r6, r1] + cmp r0, 0 + beq _0813A54C + movs r1, 0xA + ldrsh r0, [r6, r1] + subs r0, 0x1 + cmp r4, r0 + bne _0813A558 +_0813A54C: + adds r0, r5, 0 + bl sub_813A570 + b _0813A566 + .pool +_0813A558: + adds r0, r5, 0 + bl sub_813A738 + ldr r0, =sub_813A600 + str r0, [r6] + bl EnableBothScriptContexts +_0813A566: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813A4EC + + thumb_func_start sub_813A570 +sub_813A570: @ 813A570 + push {r4,r5,lr} + sub sp, 0x4 + adds r5, r0, 0 + lsls r5, 24 + lsrs r5, 24 + lsls r4, r5, 2 + adds r4, r5 + lsls r4, 3 + ldr r0, =gTasks + adds r4, r0 + ldrh r0, [r4, 0x24] + lsls r0, 24 + lsrs r0, 24 + mov r1, sp + bl sub_81AE838 + ldrh r0, [r4, 0x1E] + mov r1, sp + ldrh r1, [r1] + bl sub_813AC44 + adds r0, r5, 0 + bl sub_813A738 + ldrh r0, [r4, 0x24] + lsls r0, 24 + lsrs r0, 24 + movs r1, 0 + movs r2, 0 + bl sub_81AE6C8 + ldr r0, =gUnknown_0203AB64 + ldr r0, [r0] + bl Free + ldrh r0, [r4, 0x22] + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x1 + bl sub_8198070 + ldrh r0, [r4, 0x22] + lsls r0, 24 + lsrs r0, 24 + movs r1, 0 + bl FillWindowPixelBuffer + ldrh r0, [r4, 0x22] + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x2 + bl CopyWindowToVram + ldrh r0, [r4, 0x22] + lsls r0, 24 + lsrs r0, 24 + bl RemoveWindow + adds r0, r5, 0 + bl DestroyTask + bl EnableBothScriptContexts + add sp, 0x4 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813A570 + + thumb_func_start sub_813A600 +sub_813A600: @ 813A600 + push {lr} + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r1, r2 + movs r2, 0x14 + ldrsh r0, [r1, r2] + cmp r0, 0x1 + beq _0813A624 + cmp r0, 0x2 + bne _0813A624 + movs r0, 0x1 + strh r0, [r1, 0x14] + ldr r0, =sub_813A664 + str r0, [r1] +_0813A624: + pop {r0} + bx r0 + .pool + thumb_func_end sub_813A600 + + thumb_func_start sub_813A630 +sub_813A630: @ 813A630 + push {lr} + ldr r0, =sub_813A600 + bl FindTaskIdByFunc + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0xFF + bne _0813A64C + bl EnableBothScriptContexts + b _0813A65C + .pool +_0813A64C: + ldr r0, =gTasks + lsls r1, r2, 2 + adds r1, r2 + lsls r1, 3 + adds r1, r0 + ldrh r0, [r1, 0x14] + adds r0, 0x1 + strh r0, [r1, 0x14] +_0813A65C: + pop {r0} + bx r0 + .pool + thumb_func_end sub_813A630 + + thumb_func_start sub_813A664 +sub_813A664: @ 813A664 + push {r4,lr} + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + bl ScriptContext2_Enable + adds r0, r4, 0 + bl sub_813A694 + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + ldr r1, =sub_813A4EC + str r1, [r0] + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813A664 + + thumb_func_start sub_813A694 +sub_813A694: @ 813A694 + push {r4,r5,lr} + sub sp, 0x10 + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + ldr r0, =gTasks + adds r4, r1, r0 + mov r1, sp + ldr r0, =gUnknown_085B3030 + ldm r0!, {r2,r3,r5} + stm r1!, {r2,r3,r5} + ldr r0, [r0] + str r0, [r1] + movs r0, 0x8 + ldrsh r1, [r4, r0] + movs r2, 0xA + ldrsh r0, [r4, r2] + cmp r1, r0 + beq _0813A724 + mov r2, sp + movs r3, 0x10 + ldrsh r1, [r4, r3] + lsrs r0, r1, 31 + adds r1, r0 + asrs r1, 1 + lsls r1, 3 + adds r1, 0xC + movs r5, 0xC + ldrsh r0, [r4, r5] + subs r0, 0x1 + lsls r0, 3 + adds r1, r0 + movs r3, 0 + strb r1, [r2, 0x1] + mov r1, sp + movs r0, 0x8 + strb r0, [r1, 0x2] + movs r0, 0x10 + ldrsh r1, [r4, r0] + lsrs r0, r1, 31 + adds r1, r0 + asrs r1, 1 + lsls r1, 3 + adds r1, 0xC + movs r5, 0xC + ldrsh r0, [r4, r5] + subs r0, 0x1 + lsls r0, 3 + adds r1, r0 + strb r1, [r2, 0x4] + mov r1, sp + movs r2, 0x12 + ldrsh r0, [r4, r2] + lsls r0, 3 + adds r0, 0xA + strb r0, [r1, 0x5] + mov r0, sp + strh r3, [r0, 0x6] + mov r2, sp + ldrh r0, [r4, 0xA] + ldrh r1, [r4, 0x8] + subs r0, r1 + strh r0, [r2, 0x8] + ldr r1, =gUnknown_0203AB68 + mov r0, sp + bl AddScrollIndicatorArrowPair + lsls r0, 24 + lsrs r0, 24 + strh r0, [r4, 0x20] +_0813A724: + add sp, 0x10 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813A694 + + thumb_func_start sub_813A738 +sub_813A738: @ 813A738 + push {lr} + lsls r0, 24 + lsrs r0, 24 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + ldr r0, =gTasks + adds r2, r1, r0 + movs r0, 0x8 + ldrsh r1, [r2, r0] + movs r3, 0xA + ldrsh r0, [r2, r3] + cmp r1, r0 + beq _0813A75E + ldrh r0, [r2, 0x20] + lsls r0, 24 + lsrs r0, 24 + bl RemoveScrollIndicatorArrowPair +_0813A75E: + pop {r0} + bx r0 + .pool + thumb_func_end sub_813A738 + + thumb_func_start nullsub_55 +nullsub_55: @ 813A768 + bx lr + thumb_func_end nullsub_55 + + thumb_func_start sub_813A76C +sub_813A76C: @ 813A76C + push {r4-r6,lr} + movs r4, 0 + ldr r6, =gLinkPlayers + ldr r0, =0x0000401f + adds r5, r0, 0 +_0813A776: + lsls r0, r4, 3 + subs r0, r4 + lsls r0, 2 + adds r0, r6 + ldrb r0, [r0, 0x13] + cmp r0, 0 + bne _0813A79C + subs r0, r5, r4 + lsls r0, 16 + lsrs r0, 16 + movs r1, 0 + bl VarSet + b _0813A7A8 + .pool +_0813A79C: + subs r0, r5, r4 + lsls r0, 16 + lsrs r0, 16 + movs r1, 0x69 + bl VarSet +_0813A7A8: + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x1 + bls _0813A776 + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_813A76C + + thumb_func_start sub_813A7B8 +sub_813A7B8: @ 813A7B8 + push {lr} + ldr r1, =gSpecialVar_0x8004 + ldrh r0, [r1] + cmp r0, 0x5 + bls _0813A7C6 + movs r0, 0 + strh r0, [r1] +_0813A7C6: + ldrh r1, [r1] + movs r0, 0x64 + muls r0, r1 + ldr r1, =gPlayerParty + adds r0, r1 + bl GetNature + lsls r0, 24 + ldr r1, =gUnknown_085B3040 + lsrs r0, 22 + adds r0, r1 + ldr r0, [r0] + bl ShowFieldMessage + pop {r0} + bx r0 + .pool + thumb_func_end sub_813A7B8 + + thumb_func_start UpdateFrontierGambler +UpdateFrontierGambler: @ 813A7F4 + push {r4,r5,lr} + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + ldr r0, =0x00004030 + bl GetVarPointer + adds r5, r0, 0 + ldrh r0, [r5] + adds r4, r0 + strh r4, [r5] + ldrh r0, [r5] + movs r1, 0xC + bl __umodsi3 + strh r0, [r5] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end UpdateFrontierGambler + + thumb_func_start sub_813A820 +sub_813A820: @ 813A820 + push {r4,lr} + ldr r0, =0x00004030 + bl VarGet + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + ldr r1, =gUnknown_085B30A4 + lsls r0, r4, 2 + adds r0, r1 + ldr r0, [r0] + bl ShowFieldMessage + ldr r0, =0x00004031 + adds r1, r4, 0 + bl VarSet + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813A820 + + thumb_func_start sub_813A854 +sub_813A854: @ 813A854 + push {r4,lr} + ldr r4, =gUnknown_085B30D4 + ldr r0, =0x00004031 + bl VarGet + lsls r0, 16 + lsrs r0, 14 + adds r0, r4 + ldr r0, [r0] + bl ShowFieldMessage + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813A854 + + thumb_func_start sub_813A878 +sub_813A878: @ 813A878 + push {r4-r7,lr} + mov r7, r8 + push {r7} + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + ldr r0, =0x000040ce + bl VarGet + lsls r0, 16 + lsrs r7, r0, 16 + ldr r0, =0x00004031 + bl VarGet + lsls r0, 16 + lsrs r6, r0, 16 + ldr r0, =0x000040cf + bl VarGet + lsls r0, 16 + lsrs r5, r0, 16 + ldr r4, =0x00004033 + adds r0, r4, 0 + bl VarGet + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x1 + bne _0813A8F0 + ldr r1, =gUnknown_085B3104 + lsls r0, r6, 1 + adds r0, r1 + ldrh r1, [r0] + lsls r0, r5, 8 + adds r0, r7 + cmp r1, r0 + bne _0813A8F0 + mov r0, r8 + cmp r0, 0 + beq _0813A8E8 + adds r0, r4, 0 + movs r1, 0x2 + bl VarSet + b _0813A8F0 + .pool +_0813A8E8: + adds r0, r4, 0 + movs r1, 0x3 + bl VarSet +_0813A8F0: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_813A878 + + thumb_func_start sub_813A8FC +sub_813A8FC: @ 813A8FC + push {lr} + sub sp, 0x2C + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldr r1, =0x00000eb8 + adds r0, r1 + ldrh r1, [r0] + add r0, sp, 0xC + movs r2, 0x1 + movs r3, 0x4 + bl ConvertIntToDecimalStringN + ldr r1, =gText_BP + bl StringCopy + movs r0, 0x1 + add r1, sp, 0xC + movs r2, 0x30 + bl GetStringRightAlignXOffset + adds r3, r0, 0 + ldr r0, =gUnknown_0203AB6D + ldrb r0, [r0] + lsls r3, 24 + lsrs r3, 24 + movs r1, 0x1 + str r1, [sp] + movs r1, 0 + str r1, [sp, 0x4] + str r1, [sp, 0x8] + movs r1, 0x1 + add r2, sp, 0xC + bl PrintTextOnWindow + add sp, 0x2C + pop {r0} + bx r0 + .pool + thumb_func_end sub_813A8FC + + thumb_func_start sub_813A958 +sub_813A958: @ 813A958 + push {r4,lr} + ldr r4, =gUnknown_0203AB6D + ldr r0, =gUnknown_085B311C + bl AddWindow + strb r0, [r4] + ldrb r0, [r4] + movs r1, 0 + bl SetStandardWindowBorderStyle + bl sub_813A8FC + ldrb r0, [r4] + movs r1, 0x2 + bl CopyWindowToVram + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813A958 + + thumb_func_start sub_813A988 +sub_813A988: @ 813A988 + push {r4,lr} + ldr r4, =gUnknown_0203AB6D + ldrb r0, [r4] + movs r1, 0x1 + bl sub_8198070 + ldrb r0, [r4] + bl RemoveWindow + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813A988 + + thumb_func_start sub_813A9A4 +sub_813A9A4: @ 813A9A4 + push {lr} + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldr r2, =0x00000eb8 + adds r1, r0, r2 + ldr r0, =gSpecialVar_0x8004 + ldrh r2, [r1] + ldrh r0, [r0] + cmp r2, r0 + bcs _0813A9C8 + movs r0, 0 + b _0813A9CA + .pool +_0813A9C8: + subs r0, r2, r0 +_0813A9CA: + strh r0, [r1] + pop {r0} + bx r0 + thumb_func_end sub_813A9A4 + + thumb_func_start sub_813A9D0 +sub_813A9D0: @ 813A9D0 + push {lr} + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldr r1, =0x00000eb8 + adds r2, r0, r1 + ldrh r1, [r2] + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + adds r1, r0 + ldr r0, =0x0000270f + cmp r1, r0 + ble _0813A9FC + strh r0, [r2] + b _0813A9FE + .pool +_0813A9FC: + strh r1, [r2] +_0813A9FE: + pop {r0} + bx r0 + thumb_func_end sub_813A9D0 + + thumb_func_start sub_813AA04 +sub_813AA04: @ 813AA04 + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldr r1, =0x00000eb8 + adds r0, r1 + ldrh r0, [r0] + bx lr + .pool + thumb_func_end sub_813AA04 + + thumb_func_start sub_813AA18 +sub_813AA18: @ 813AA18 + push {r4,lr} + ldr r4, =gUnknown_0203AB6E + ldr r0, =gUnknown_085B3124 + bl AddWindow + strb r0, [r4] + ldrb r0, [r4] + movs r1, 0 + bl SetStandardWindowBorderStyle + ldrb r0, [r4] + movs r1, 0x2 + bl CopyWindowToVram + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813AA18 + + thumb_func_start sub_813AA44 +sub_813AA44: @ 813AA44 + push {r4,lr} + ldr r4, =gUnknown_0203AB6E + ldrb r0, [r4] + movs r1, 0x1 + bl sub_8198070 + ldrb r0, [r4] + bl RemoveWindow + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813AA44 + + thumb_func_start sub_813AA60 +sub_813AA60: @ 813AA60 + push {r4,r5,lr} + sub sp, 0x10 + lsls r0, 16 + lsls r1, 16 + lsrs r5, r1, 16 + lsrs r4, r0, 16 + ldr r1, =0xfffd0000 + adds r0, r1 + lsrs r0, 16 + cmp r0, 0x3 + bls _0813AA78 + b _0813ABC2 +_0813AA78: + movs r0, 0xD8 + str r0, [sp] + movs r0, 0x20 + str r0, [sp, 0x4] + movs r0, 0 + movs r1, 0x11 + movs r2, 0 + movs r3, 0 + bl FillWindowPixelRect + cmp r4, 0x4 + beq _0813AAE8 + cmp r4, 0x4 + bgt _0813AAA0 + cmp r4, 0x3 + beq _0813AAAA + b _0813ABC2 + .pool +_0813AAA0: + cmp r4, 0x5 + beq _0813AB5C + cmp r4, 0x6 + beq _0813AB94 + b _0813ABC2 +_0813AAAA: + ldr r1, =gUnknown_085B3170 + lsls r0, r5, 2 + adds r0, r1 + ldr r2, [r0] + movs r0, 0 + str r0, [sp] + movs r0, 0x2 + str r0, [sp, 0x4] + movs r0, 0x1 + str r0, [sp, 0x8] + str r4, [sp, 0xC] + movs r0, 0 + movs r1, 0x1 + movs r3, 0 + bl AddTextPrinterParametrized + ldr r1, =gUnknown_085B312C + lsls r0, r5, 1 + adds r1, r0, r1 + ldrh r5, [r1] + ldr r0, =0x0000ffff + cmp r5, r0 + beq _0813AB18 + b _0813AB2C + .pool +_0813AAE8: + ldr r1, =gUnknown_085B319C + lsls r0, r5, 2 + adds r0, r1 + ldr r2, [r0] + movs r0, 0 + str r0, [sp] + movs r0, 0x2 + str r0, [sp, 0x4] + movs r0, 0x1 + str r0, [sp, 0x8] + movs r0, 0x3 + str r0, [sp, 0xC] + movs r0, 0 + movs r1, 0x1 + movs r3, 0 + bl AddTextPrinterParametrized + ldr r1, =gUnknown_085B3142 + lsls r0, r5, 1 + adds r1, r0, r1 + ldrh r5, [r1] + ldr r0, =0x0000ffff + cmp r5, r0 + bne _0813AB2C +_0813AB18: + ldrh r0, [r1] + bl sub_813ABD4 + b _0813ABC2 + .pool +_0813AB2C: + ldr r4, =0x0000157c + adds r0, r4, 0 + bl FreeSpriteTilesByTag + adds r0, r4, 0 + bl FreeSpritePaletteByTag + lsls r0, r5, 24 + lsrs r0, 24 + str r4, [sp] + str r4, [sp, 0x4] + movs r1, 0x21 + movs r2, 0x58 + movs r3, 0 + bl AddDecorationIconObject + ldr r1, =gUnknown_0203AB6C + strb r0, [r1] + b _0813ABC2 + .pool +_0813AB5C: + ldr r1, =gUnknown_085B31B4 + lsls r0, r5, 2 + adds r0, r1 + ldr r2, [r0] + movs r0, 0 + str r0, [sp] + movs r0, 0x2 + str r0, [sp, 0x4] + movs r0, 0x1 + str r0, [sp, 0x8] + movs r0, 0x3 + str r0, [sp, 0xC] + movs r0, 0 + movs r1, 0x1 + movs r3, 0 + bl AddTextPrinterParametrized + ldr r1, =gUnknown_085B314E + lsls r0, r5, 1 + adds r0, r1 + ldrh r0, [r0] + bl sub_813ABD4 + b _0813ABC2 + .pool +_0813AB94: + ldr r1, =gUnknown_085B31D0 + lsls r0, r5, 2 + adds r0, r1 + ldr r2, [r0] + movs r0, 0 + str r0, [sp] + movs r0, 0x2 + str r0, [sp, 0x4] + movs r0, 0x1 + str r0, [sp, 0x8] + movs r0, 0x3 + str r0, [sp, 0xC] + movs r0, 0 + movs r1, 0x1 + movs r3, 0 + bl AddTextPrinterParametrized + ldr r1, =gUnknown_085B315C + lsls r0, r5, 1 + adds r0, r1 + ldrh r0, [r0] + bl sub_813ABD4 +_0813ABC2: + add sp, 0x10 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813AA60 + + thumb_func_start sub_813ABD4 +sub_813ABD4: @ 813ABD4 + push {r4,r5,lr} + adds r5, r0, 0 + lsls r5, 16 + lsrs r5, 16 + ldr r4, =0x0000157c + adds r0, r4, 0 + bl FreeSpriteTilesByTag + adds r0, r4, 0 + bl FreeSpritePaletteByTag + adds r0, r4, 0 + adds r1, r4, 0 + adds r2, r5, 0 + bl AddItemIconObject + ldr r4, =gUnknown_0203AB6C + strb r0, [r4] + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x40 + beq _0813AC32 + ldr r3, =gSprites + ldrb r0, [r4] + lsls r1, r0, 4 + adds r1, r0 + lsls r1, 2 + adds r1, r3 + ldrb r2, [r1, 0x5] + movs r0, 0xD + negs r0, r0 + ands r0, r2 + strb r0, [r1, 0x5] + ldrb r1, [r4] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r3 + movs r1, 0x24 + strh r1, [r0, 0x20] + ldrb r1, [r4] + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + adds r0, r3 + movs r1, 0x5C + strh r1, [r0, 0x22] +_0813AC32: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813ABD4 + + thumb_func_start sub_813AC44 +sub_813AC44: @ 813AC44 + push {lr} + lsls r0, 16 + lsrs r1, r0, 16 + ldr r2, =gUnknown_0203AB6C + ldrb r0, [r2] + cmp r0, 0x40 + beq _0813AC70 + cmp r1, 0x6 + bgt _0813AC6A + cmp r1, 0x3 + blt _0813AC6A + adds r1, r0, 0 + lsls r0, r1, 4 + adds r0, r1 + lsls r0, 2 + ldr r1, =gSprites + adds r0, r1 + bl DestroySpriteAndFreeResources +_0813AC6A: + ldr r1, =gUnknown_0203AB6C + movs r0, 0x40 + strb r0, [r1] +_0813AC70: + pop {r0} + bx r0 + .pool + thumb_func_end sub_813AC44 + + thumb_func_start sub_813AC7C +sub_813AC7C: @ 813AC7C + push {lr} + ldr r0, =gSpecialVar_0x8005 + ldrh r0, [r0] + cmp r0, 0 + beq _0813ACB8 + ldr r0, =gStringVar1 + ldr r2, =gUnknown_085B320C + ldr r1, =gSpecialVar_0x8004 + ldrh r1, [r1] + lsls r1, 1 + adds r1, r2 + ldrh r2, [r1] + movs r1, 0xD + muls r1, r2 + ldr r2, =gMoveNames + adds r1, r2 + bl StringCopy + b _0813ACD2 + .pool +_0813ACB8: + ldr r0, =gStringVar1 + ldr r2, =gUnknown_085B31F8 + ldr r1, =gSpecialVar_0x8004 + ldrh r1, [r1] + lsls r1, 1 + adds r1, r2 + ldrh r2, [r1] + movs r1, 0xD + muls r1, r2 + ldr r2, =gMoveNames + adds r1, r2 + bl StringCopy +_0813ACD2: + pop {r0} + bx r0 + .pool + thumb_func_end sub_813AC7C + + thumb_func_start sub_813ACE8 +sub_813ACE8: @ 813ACE8 + push {r4-r6,lr} + lsls r0, 24 + lsrs r0, 24 + adds r5, r0, 0 + lsls r1, 16 + lsrs r6, r1, 16 + subs r0, 0x9 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bhi _0813AD20 + ldr r0, =gSpecialVar_0x8006 + ldrh r0, [r0] + cmp r0, 0 + bne _0813AD18 + ldr r4, =gUnknown_0203AB5E + ldr r0, =gUnknown_085B3220 + bl AddWindow + strb r0, [r4] + ldrb r0, [r4] + movs r1, 0 + bl SetStandardWindowBorderStyle +_0813AD18: + adds r0, r5, 0 + adds r1, r6, 0 + bl sub_813AD34 +_0813AD20: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813ACE8 + + thumb_func_start sub_813AD34 +sub_813AD34: @ 813AD34 + push {r4-r7,lr} + sub sp, 0xC + lsls r0, 24 + lsls r1, 16 + lsrs r5, r1, 16 + adds r7, r5, 0 + lsrs r6, r0, 24 + movs r1, 0xF7 + lsls r1, 24 + adds r0, r1 + lsrs r0, 24 + cmp r0, 0x1 + bhi _0813ADAC + ldr r4, =gUnknown_0203AB5E + ldrb r0, [r4] + movs r1, 0x60 + str r1, [sp] + movs r1, 0x30 + str r1, [sp, 0x4] + movs r1, 0x11 + movs r2, 0 + movs r3, 0 + bl FillWindowPixelRect + cmp r6, 0xA + bne _0813AD90 + ldrb r0, [r4] + ldr r2, =gUnknown_085B3254 + lsls r1, r5, 2 + adds r1, r2 + ldr r2, [r1] + movs r1, 0x1 + str r1, [sp] + movs r1, 0 + str r1, [sp, 0x4] + str r1, [sp, 0x8] + movs r1, 0x1 + movs r3, 0 + bl PrintTextOnWindow + b _0813ADAC + .pool +_0813AD90: + ldrb r0, [r4] + ldr r2, =gUnknown_085B3228 + lsls r1, r7, 2 + adds r1, r2 + ldr r2, [r1] + movs r1, 0x1 + str r1, [sp] + movs r1, 0 + str r1, [sp, 0x4] + str r1, [sp, 0x8] + movs r1, 0x1 + movs r3, 0 + bl PrintTextOnWindow +_0813ADAC: + add sp, 0xC + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813AD34 + + thumb_func_start sub_813ADB8 +sub_813ADB8: @ 813ADB8 + push {r4,lr} + ldr r4, =gUnknown_0203AB5E + ldrb r0, [r4] + movs r1, 0x1 + bl sub_8198070 + ldrb r0, [r4] + bl RemoveWindow + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813ADB8 + + thumb_func_start sub_813ADD4 +sub_813ADD4: @ 813ADD4 + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + sub sp, 0x18 + ldr r0, =sub_813A600 + bl FindTaskIdByFunc + lsls r0, 24 + lsrs r1, r0, 24 + cmp r1, 0xFF + beq _0813AE90 + lsls r0, r1, 2 + adds r0, r1 + lsls r0, 3 + ldr r1, =gTasks + adds r6, r0, r1 + ldrh r0, [r6, 0x24] + lsls r0, 24 + lsrs r0, 24 + mov r4, sp + adds r4, 0x16 + add r1, sp, 0x14 + adds r2, r4, 0 + bl sub_81AE860 + ldrh r0, [r6, 0x22] + lsls r0, 24 + lsrs r0, 24 + movs r1, 0 + bl SetStandardWindowBorderStyle + movs r5, 0 + mov r9, r4 + ldr r0, =gUnknown_085B2CF0 + mov r8, r0 + movs r4, 0 +_0813AE1E: + ldrh r0, [r6, 0x22] + lsls r0, 24 + lsrs r0, 24 + add r1, sp, 0x14 + ldrh r2, [r1] + adds r2, r5 + lsls r2, 2 + ldr r1, =gSpecialVar_0x8004 + ldrh r1, [r1] + lsls r1, 6 + adds r2, r1 + add r2, r8 + ldr r2, [r2] + lsls r1, r5, 28 + lsrs r1, 24 + str r1, [sp] + movs r7, 0xFF + str r7, [sp, 0x4] + str r4, [sp, 0x8] + str r4, [sp, 0xC] + str r4, [sp, 0x10] + movs r1, 0x1 + movs r3, 0xA + bl sub_8199F74 + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x5 + bls _0813AE1E + ldrh r0, [r6, 0x22] + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gText_SelectorArrow + mov r3, r9 + ldrh r1, [r3] + lsls r1, 28 + lsrs r1, 24 + str r1, [sp] + str r7, [sp, 0x4] + movs r1, 0 + str r1, [sp, 0x8] + movs r1, 0x1 + movs r3, 0 + bl PrintTextOnWindow + ldrh r0, [r6, 0x22] + lsls r0, 24 + lsrs r0, 24 + bl PutWindowTilemap + ldrh r0, [r6, 0x22] + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x3 + bl CopyWindowToVram +_0813AE90: + add sp, 0x18 + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813ADD4 + + thumb_func_start sub_813AEB4 +sub_813AEB4: @ 813AEB4 + push {r4,lr} + movs r1, 0 + ldr r0, =gSpecialVar_0x8005 + strh r1, [r0] + ldr r0, =0x0000400e + bl VarGet + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + ldr r0, =0x0000400d + bl VarGet + lsls r0, 16 + lsrs r1, r0, 16 + cmp r4, 0 + beq _0813AF18 + movs r2, 0 + lsls r1, 1 + ldr r3, =gUnknown_0861500C + ldr r0, =gUnknown_085B320C + adds r0, r1, r0 + ldrh r1, [r0] +_0813AEE2: + lsls r0, r2, 1 + adds r0, r3 + ldrh r0, [r0] + cmp r0, r1 + beq _0813AF0C + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x1D + bls _0813AEE2 + b _0813AF38 + .pool +_0813AF0C: + ldr r0, =gSpecialVar_0x8005 + strh r2, [r0] + b _0813AF38 + .pool +_0813AF18: + movs r2, 0 + lsls r1, 1 + ldr r3, =gUnknown_0861500C + ldr r0, =gUnknown_085B31F8 + adds r0, r1, r0 + ldrh r1, [r0] +_0813AF24: + lsls r0, r2, 1 + adds r0, r3 + ldrh r0, [r0] + cmp r0, r1 + beq _0813AF0C + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x1D + bls _0813AF24 +_0813AF38: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813AEB4 + + thumb_func_start sub_813AF48 +sub_813AF48: @ 813AF48 + push {r4,r5,lr} + ldr r0, =sub_813A600 + bl FindTaskIdByFunc + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0xFF + beq _0813AFB6 + lsls r4, r5, 2 + adds r4, r5 + lsls r4, 3 + ldr r0, =gTasks + adds r4, r0 + ldrh r0, [r4, 0x24] + lsls r0, 24 + lsrs r0, 24 + movs r1, 0 + movs r2, 0 + bl sub_81AE6C8 + ldr r0, =gUnknown_0203AB64 + ldr r0, [r0] + bl Free + ldrh r0, [r4, 0x22] + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x1 + bl sub_8198070 + ldrh r0, [r4, 0x22] + lsls r0, 24 + lsrs r0, 24 + movs r1, 0 + bl FillWindowPixelBuffer + ldrh r0, [r4, 0x22] + lsls r0, 24 + lsrs r0, 24 + bl ClearWindowTilemap + ldrh r0, [r4, 0x22] + lsls r0, 24 + lsrs r0, 24 + movs r1, 0x2 + bl CopyWindowToVram + ldrh r0, [r4, 0x22] + lsls r0, 24 + lsrs r0, 24 + bl RemoveWindow + adds r0, r5, 0 + bl DestroyTask +_0813AFB6: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813AF48 + + thumb_func_start sub_813AFC8 +sub_813AFC8: @ 813AFC8 + push {lr} + ldr r0, =task_deoxys_sound + movs r1, 0x8 + bl CreateTask + pop {r0} + bx r0 + .pool + thumb_func_end sub_813AFC8 + + thumb_func_start task_deoxys_sound +task_deoxys_sound: @ 813AFDC + push {r4-r7,lr} + mov r7, r8 + push {r7} + lsls r0, 24 + lsrs r7, r0, 24 + ldr r0, =0x000008d4 + bl FlagGet + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _0813B004 + ldr r1, =gSpecialVar_Result + movs r0, 0x3 + b _0813B06A + .pool +_0813B004: + ldr r0, =0x00004035 + mov r8, r0 + bl VarGet + lsls r0, 16 + lsrs r5, r0, 16 + ldr r4, =0x00004034 + adds r0, r4, 0 + bl VarGet + lsls r0, 16 + lsrs r6, r0, 16 + adds r0, r4, 0 + movs r1, 0 + bl VarSet + cmp r5, 0 + beq _0813B05C + ldr r0, =gUnknown_085B33F6 + subs r1, r5, 0x1 + adds r1, r0 + ldrb r0, [r1] + cmp r0, r6 + bcs _0813B05C + movs r0, 0 + bl sub_813B0B4 + mov r0, r8 + movs r1, 0 + bl VarSet + ldr r1, =gSpecialVar_Result + movs r0, 0 + strh r0, [r1] + b _0813B070 + .pool +_0813B05C: + cmp r5, 0xA + bne _0813B080 + ldr r0, =0x000008d4 + bl FlagSet + ldr r1, =gSpecialVar_Result + movs r0, 0x2 +_0813B06A: + strh r0, [r1] + bl EnableBothScriptContexts +_0813B070: + adds r0, r7, 0 + bl DestroyTask + b _0813B0A2 + .pool +_0813B080: + adds r0, r5, 0x1 + lsls r0, 16 + lsrs r5, r0, 16 + lsls r0, r5, 24 + lsrs r0, 24 + bl sub_813B0B4 + ldr r0, =0x00004035 + adds r1, r5, 0 + bl VarSet + ldr r1, =gSpecialVar_Result + movs r0, 0x1 + strh r0, [r1] + adds r0, r7, 0 + bl DestroyTask +_0813B0A2: + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end task_deoxys_sound + + thumb_func_start sub_813B0B4 +sub_813B0B4: @ 813B0B4 + push {r4,r5,lr} + sub sp, 0x4 + lsls r0, 24 + lsrs r4, r0, 24 + lsls r0, r4, 5 + ldr r1, =gUnknown_085B3280 + adds r0, r1 + movs r1, 0xD0 + lsls r1, 1 + movs r2, 0x8 + bl LoadPalette + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldrb r1, [r0, 0x5] + ldrb r2, [r0, 0x4] + movs r0, 0x1 + mov r3, sp + bl TryGetFieldObjectIdByLocalIdAndMap + cmp r4, 0 + bne _0813B0F0 + movs r0, 0xC4 + bl PlaySE + b _0813B0F8 + .pool +_0813B0F0: + movs r0, 0x82 + lsls r0, 1 + bl PlaySE +_0813B0F8: + ldr r0, =sub_813B160 + movs r1, 0x8 + bl CreateTask + ldr r3, =gFieldEffectArguments + movs r0, 0x1 + str r0, [r3] + movs r0, 0x3A + str r0, [r3, 0x4] + movs r0, 0x1A + str r0, [r3, 0x8] + ldr r0, =gUnknown_085B33E0 + lsls r2, r4, 1 + adds r1, r2, r0 + ldrb r1, [r1] + str r1, [r3, 0xC] + adds r0, 0x1 + adds r0, r2, r0 + ldrb r0, [r0] + str r0, [r3, 0x10] + adds r5, r2, 0 + cmp r4, 0 + bne _0813B138 + movs r0, 0x3C + b _0813B13A + .pool +_0813B138: + movs r0, 0x5 +_0813B13A: + str r0, [r3, 0x14] + movs r0, 0x42 + bl FieldEffectStart + ldr r0, =gUnknown_085B33E0 + adds r1, r5, r0 + ldrb r1, [r1] + adds r0, 0x1 + adds r0, r5, r0 + ldrb r2, [r0] + movs r0, 0x1 + bl Overworld_SetMapObjTemplateCoords + add sp, 0x4 + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813B0B4 + + thumb_func_start sub_813B160 +sub_813B160: @ 813B160 + push {r4,lr} + lsls r0, 24 + lsrs r4, r0, 24 + movs r0, 0x42 + bl FieldEffectActiveListContains + lsls r0, 24 + cmp r0, 0 + bne _0813B17C + bl EnableBothScriptContexts + adds r0, r4, 0 + bl DestroyTask +_0813B17C: + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_813B160 + + thumb_func_start increment_var_x4026_on_birth_island_modulo_100 +increment_var_x4026_on_birth_island_modulo_100: @ 813B184 + push {r4,lr} + ldr r4, =0x00004034 + adds r0, r4, 0 + bl VarGet + lsls r0, 16 + lsrs r2, r0, 16 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldrh r1, [r0, 0x4] + ldr r0, =0x00003a1a + cmp r1, r0 + bne _0813B1C8 + adds r0, r2, 0x1 + lsls r0, 16 + lsrs r2, r0, 16 + cmp r2, 0x63 + bls _0813B1C0 + adds r0, r4, 0 + movs r1, 0 + bl VarSet + b _0813B1C8 + .pool +_0813B1C0: + adds r0, r4, 0 + adds r1, r2, 0 + bl VarSet +_0813B1C8: + pop {r4} + pop {r0} + bx r0 + thumb_func_end increment_var_x4026_on_birth_island_modulo_100 + + thumb_func_start sub_813B1D0 +sub_813B1D0: @ 813B1D0 + push {lr} + ldr r0, =0x00004035 + bl VarGet + lsls r0, 24 + lsrs r0, 19 + ldr r1, =gUnknown_085B3280 + adds r0, r1 + movs r1, 0xD0 + lsls r1, 1 + movs r2, 0x8 + bl LoadPalette + movs r0, 0x80 + lsls r0, 19 + movs r1, 0x10 + movs r2, 0 + bl BlendPalettes + pop {r0} + bx r0 + .pool + thumb_func_end sub_813B1D0 + + thumb_func_start set_unknown_box_id +@ void set_unknown_box_id(char id) +set_unknown_box_id: @ 813B204 + ldr r1, =gUnknown_0203AB6F + strb r0, [r1] + bx lr + .pool + thumb_func_end set_unknown_box_id + + thumb_func_start get_unknown_box_id +get_unknown_box_id: @ 813B210 + ldr r0, =gUnknown_0203AB6F + ldrb r0, [r0] + bx lr + .pool + thumb_func_end get_unknown_box_id + + thumb_func_start sub_813B21C +sub_813B21C: @ 813B21C + push {r4,r5,lr} + ldr r5, =0x000008d7 + adds r0, r5, 0 + bl FlagGet + lsls r0, 24 + cmp r0, 0 + bne _0813B258 + bl StorageGetCurrentBox + adds r4, r0, 0 + lsls r4, 24 + lsrs r4, 24 + ldr r0, =0x00004036 + bl VarGet + lsls r0, 16 + lsrs r0, 16 + cmp r4, r0 + beq _0813B258 + adds r0, r5, 0 + bl FlagSet + movs r0, 0x1 + b _0813B25A + .pool +_0813B258: + movs r0, 0 +_0813B25A: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_813B21C + + thumb_func_start sub_813B260 +sub_813B260: @ 813B260 + push {r4-r7,lr} + ldr r0, =0x00004036 + bl VarGet + lsls r0, 24 + lsrs r0, 24 + bl set_unknown_box_id + bl StorageGetCurrentBox + lsls r0, 24 + lsrs r4, r0, 24 +_0813B278: + movs r5, 0 + lsls r6, r4, 24 + lsls r7, r4, 16 +_0813B27E: + lsls r1, r5, 24 + lsrs r1, 24 + lsrs r0, r6, 24 + bl GetBoxedMonPtr + movs r1, 0xB + movs r2, 0 + bl GetBoxMonData + cmp r0, 0 + bne _0813B2C0 + bl get_unknown_box_id + lsls r0, 16 + lsrs r0, 16 + cmp r0, r4 + beq _0813B2A6 + ldr r0, =0x000008d7 + bl FlagClear +_0813B2A6: + ldr r0, =0x00004036 + lsrs r1, r7, 16 + bl VarSet + bl sub_813B21C + lsls r0, 24 + lsrs r0, 24 + b _0813B2DC + .pool +_0813B2C0: + adds r5, 0x1 + cmp r5, 0x1D + ble _0813B27E + adds r4, 0x1 + cmp r4, 0xE + bne _0813B2CE + movs r4, 0 +_0813B2CE: + bl StorageGetCurrentBox + lsls r0, 24 + lsrs r0, 24 + cmp r4, r0 + bne _0813B278 + movs r0, 0 +_0813B2DC: + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_813B260 + + thumb_func_start sub_813B2E4 +sub_813B2E4: @ 813B2E4 + push {r4,lr} + bl Random + lsls r0, 16 + lsrs r4, r0, 16 + ldr r0, =0x00004038 + movs r1, 0 + bl VarSet + movs r0, 0xDF + lsls r0, 1 + bl FlagGet + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _0813B340 + ldr r0, =0x000001bf + bl FlagGet + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _0813B330 + ldr r0, =0x00004037 + movs r1, 0x7 + ands r4, r1 + adds r1, r4, 0 + adds r1, 0x9 + bl VarSet + b _0813B36A + .pool +_0813B330: + movs r0, 0x1 + ands r4, r0 + cmp r4, 0 + bne _0813B354 + bl Random + lsls r0, 16 + lsrs r4, r0, 16 +_0813B340: + ldr r0, =0x00004037 + movs r1, 0x7 + ands r4, r1 + adds r1, r4, 0x1 + bl VarSet + b _0813B36A + .pool +_0813B354: + bl Random + lsls r0, 16 + lsrs r4, r0, 16 + ldr r0, =0x00004037 + movs r1, 0x7 + ands r4, r1 + adds r1, r4, 0 + adds r1, 0x9 + bl VarSet +_0813B36A: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813B2E4 + + thumb_func_start sub_813B374 +sub_813B374: @ 813B374 + push {r4,lr} + ldr r0, =0x00004037 + bl VarGet + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + ldr r0, =gStringVar1 + ldr r2, =gUnknown_085B3400 + subs r1, r4, 0x1 + adds r1, r2 + ldrb r1, [r1] + movs r2, 0 + bl GetMapName + cmp r4, 0x8 + bls _0813B3A8 + movs r0, 0x1 + b _0813B3AA + .pool +_0813B3A8: + movs r0, 0 +_0813B3AA: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_813B374 + + thumb_func_start sub_813B3B0 +sub_813B3B0: @ 813B3B0 + push {r4-r6,lr} + ldr r5, =0x00004038 + adds r0, r5, 0 + bl VarGet + lsls r0, 16 + lsrs r4, r0, 16 + ldr r0, =0x00004037 + bl VarGet + lsls r0, 16 + lsrs r6, r0, 16 + cmp r6, 0 + beq _0813B47C + adds r0, r4, 0x1 + lsls r0, 16 + lsrs r4, r0, 16 + ldr r0, =0x000003e7 + cmp r4, r0 + bls _0813B474 + adds r0, r5, 0 + movs r1, 0 + bl VarSet + ldr r0, =gSaveBlock1Ptr + ldr r1, [r0] + movs r0, 0x4 + ldrsb r0, [r1, r0] + cmp r0, 0x18 + bne _0813B414 + movs r0, 0x5 + ldrsb r0, [r1, r0] + cmp r0, 0x69 + bgt _0813B414 + cmp r0, 0x65 + blt _0813B414 + ldr r0, =0x00004039 + movs r1, 0x1 + b _0813B478 + .pool +_0813B414: + ldr r0, =gSaveBlock1Ptr + ldr r2, [r0] + movs r1, 0x4 + ldrsb r1, [r2, r1] + adds r3, r0, 0 + cmp r1, 0 + bne _0813B444 + movs r0, 0x5 + ldrsb r0, [r2, r0] + cmp r0, 0x34 + beq _0813B436 + cmp r0, 0x34 + blt _0813B444 + cmp r0, 0x38 + bgt _0813B444 + cmp r0, 0x36 + blt _0813B444 +_0813B436: + ldr r0, =0x00004039 + movs r1, 0x1 + b _0813B478 + .pool +_0813B444: + ldr r3, [r3] + movs r2, 0x5 + ldrsb r2, [r3, r2] + ldr r1, =gUnknown_085B3410 + subs r0, r6, 0x1 + adds r0, r1 + ldrb r0, [r0] + cmp r2, r0 + bne _0813B468 + movs r0, 0x4 + ldrsb r0, [r3, r0] + cmp r0, 0 + bne _0813B468 + movs r0, 0x1 + b _0813B47E + .pool +_0813B468: + ldr r0, =0x00004037 + movs r1, 0 + b _0813B478 + .pool +_0813B474: + adds r0, r5, 0 + adds r1, r4, 0 +_0813B478: + bl VarSet +_0813B47C: + movs r0, 0 +_0813B47E: + pop {r4-r6} + pop {r1} + bx r1 + thumb_func_end sub_813B3B0 + + thumb_func_start sub_813B484 +sub_813B484: @ 813B484 + push {lr} + movs r0, 0x2 + bl sub_80AB104 + pop {r0} + bx r0 + thumb_func_end sub_813B484 + + thumb_func_start sub_813B490 +sub_813B490: @ 813B490 + push {r4-r7,lr} + movs r3, 0 + ldr r0, =gSaveBlock1Ptr + ldr r4, [r0] + movs r6, 0x4 + ldrsb r6, [r4, r6] + ldr r5, =gUnknown_085B3420 + adds r0, r5, 0x2 + mov r12, r0 + adds r7, r5, 0x1 +_0813B4A4: + lsls r0, r3, 1 + adds r2, r0, r3 + adds r0, r2, r5 + ldrb r0, [r0] + cmp r6, r0 + bne _0813B4CC + movs r1, 0x5 + ldrsb r1, [r4, r1] + adds r0, r2, r7 + ldrb r0, [r0] + cmp r1, r0 + bne _0813B4CC + mov r1, r12 + adds r0, r2, r1 + ldrb r0, [r0] + b _0813B4D8 + .pool +_0813B4CC: + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 + cmp r3, 0xB + bls _0813B4A4 + movs r0, 0x1 +_0813B4D8: + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_813B490 + + thumb_func_start sub_813B4E0 +sub_813B4E0: @ 813B4E0 + push {lr} + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + bl sub_81D15CC + cmp r0, 0 + blt _0813B50C + movs r1, 0xAE + lsls r1, 1 + adds r0, r1 + lsls r0, 16 + lsrs r0, 16 + bl FlagGet + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _0813B50C + movs r0, 0x1 + b _0813B50E + .pool +_0813B50C: + movs r0, 0 +_0813B50E: + pop {r1} + bx r1 + thumb_func_end sub_813B4E0 + + thumb_func_start sub_813B514 +sub_813B514: @ 813B514 + push {lr} + ldr r0, =0x0000403f + bl VarGet + lsls r0, 16 + cmp r0, 0 + beq _0813B52C + movs r0, 0x1 + b _0813B52E + .pool +_0813B52C: + movs r0, 0 +_0813B52E: + pop {r1} + bx r1 + thumb_func_end sub_813B514 + + thumb_func_start sub_813B534 +sub_813B534: @ 813B534 + push {lr} + ldr r2, =gUnknown_0203AB70 + ldr r1, =gBattleTypeFlags + ldr r0, [r1] + str r0, [r2] + movs r0, 0 + str r0, [r1] + ldr r0, =gReceivedRemoteLinkPlayers + ldrb r0, [r0] + cmp r0, 0 + bne _0813B552 + ldr r0, =sub_80B3AF8 + movs r1, 0x5 + bl CreateTask +_0813B552: + pop {r0} + bx r0 + .pool + thumb_func_end sub_813B534 + + thumb_func_start sub_813B568 +sub_813B568: @ 813B568 + push {lr} + ldr r0, =sub_813B57C + movs r1, 0x5 + bl CreateTask + pop {r0} + bx r0 + .pool + thumb_func_end sub_813B568 + + thumb_func_start sub_813B57C +sub_813B57C: @ 813B57C + push {r4,r5,lr} + lsls r0, 24 + lsrs r4, r0, 24 + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + movs r1, 0x8 + ldrsh r0, [r0, r1] + cmp r0, 0x9 + bls _0813B596 + b _0813B7C6 +_0813B596: + lsls r0, 2 + ldr r1, =_0813B5A8 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0813B5A8: + .4byte _0813B5D0 + .4byte _0813B5E4 + .4byte _0813B614 + .4byte _0813B6B4 + .4byte _0813B6E4 + .4byte _0813B728 + .4byte _0813B764 + .4byte _0813B772 + .4byte _0813B784 + .4byte _0813B7A8 +_0813B5D0: + ldr r0, =sub_80B3AF8 + bl FuncIsActiveTask + lsls r0, 24 + cmp r0, 0 + beq _0813B5DE + b _0813B7C6 +_0813B5DE: + b _0813B790 + .pool +_0813B5E4: + bl sub_800A520 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _0813B5F2 + b _0813B7C6 +_0813B5F2: + bl GetMultiplayerId + lsls r0, 24 + cmp r0, 0 + bne _0813B5FE + b _0813B790 +_0813B5FE: + bl bitmask_all_link_players_but_self + lsls r0, 24 + lsrs r0, 24 + ldr r1, =gSpecialVar_0x8004 + movs r2, 0x2 + bl SendBlock + b _0813B708 + .pool +_0813B614: + bl GetBlockReceivedStatus + movs r1, 0x2 + ands r1, r0 + cmp r1, 0 + bne _0813B622 + b _0813B7C6 +_0813B622: + bl GetMultiplayerId + lsls r0, 24 + cmp r0, 0 + beq _0813B62E + b _0813B790 +_0813B62E: + ldr r5, =gSpecialVar_0x8005 + ldr r0, =gBlockRecvBuffer + movs r1, 0x80 + lsls r1, 1 + adds r0, r1 + ldrh r0, [r0] + strh r0, [r5] + movs r0, 0x1 + bl ResetBlockReceivedFlag + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + cmp r0, 0x1 + bne _0813B668 + ldrh r1, [r5] + cmp r1, 0x1 + bne _0813B668 + ldr r0, =gSpecialVar_Result + strh r1, [r0] + b _0813B790 + .pool +_0813B668: + ldr r0, =gSpecialVar_0x8004 + ldrh r1, [r0] + adds r2, r0, 0 + cmp r1, 0 + bne _0813B68C + ldr r0, =gSpecialVar_0x8005 + ldrh r0, [r0] + cmp r0, 0x1 + bne _0813B68C + ldr r1, =gSpecialVar_Result + movs r0, 0x2 + b _0813B6AC + .pool +_0813B68C: + ldrh r0, [r2] + cmp r0, 0x1 + bne _0813B6A8 + ldr r0, =gSpecialVar_0x8005 + ldrh r0, [r0] + cmp r0, 0 + bne _0813B6A8 + ldr r1, =gSpecialVar_Result + movs r0, 0x3 + b _0813B6AC + .pool +_0813B6A8: + ldr r1, =gSpecialVar_Result + movs r0, 0 +_0813B6AC: + strh r0, [r1] + b _0813B790 + .pool +_0813B6B4: + bl sub_800A520 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + beq _0813B6C2 + b _0813B7C6 +_0813B6C2: + bl GetMultiplayerId + lsls r0, 24 + cmp r0, 0 + bne _0813B790 + bl bitmask_all_link_players_but_self + lsls r0, 24 + lsrs r0, 24 + ldr r1, =gSpecialVar_Result + movs r2, 0x2 + bl SendBlock + b _0813B708 + .pool +_0813B6E4: + bl GetBlockReceivedStatus + movs r1, 0x1 + ands r1, r0 + cmp r1, 0 + beq _0813B7C6 + bl GetMultiplayerId + lsls r0, 24 + cmp r0, 0 + beq _0813B790 + ldr r1, =gSpecialVar_Result + ldr r0, =gBlockRecvBuffer + ldrh r0, [r0] + strh r0, [r1] + movs r0, 0 + bl ResetBlockReceivedFlag +_0813B708: + ldr r1, =gTasks + lsls r0, r4, 2 + adds r0, r4 + lsls r0, 3 + adds r0, r1 + ldrh r1, [r0, 0x8] + adds r1, 0x1 + strh r1, [r0, 0x8] + b _0813B7C6 + .pool +_0813B728: + bl GetMultiplayerId + lsls r0, 24 + cmp r0, 0 + bne _0813B74C + ldr r0, =gSpecialVar_Result + ldrh r0, [r0] + cmp r0, 0x2 + bne _0813B790 + ldr r0, =gText_YourPartnerHasRetired + bl ShowFieldAutoScrollMessage + b _0813B790 + .pool +_0813B74C: + ldr r0, =gSpecialVar_Result + ldrh r0, [r0] + cmp r0, 0x3 + bne _0813B790 + ldr r0, =gText_YourPartnerHasRetired + bl ShowFieldAutoScrollMessage + b _0813B790 + .pool +_0813B764: + movs r0, 0 + bl IsTextPrinterActive + lsls r0, 16 + cmp r0, 0 + bne _0813B7C6 + b _0813B790 +_0813B772: + bl sub_800A520 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _0813B7C6 + bl sub_800ADF8 + b _0813B790 +_0813B784: + bl sub_800A520 + lsls r0, 24 + lsrs r0, 24 + cmp r0, 0x1 + bne _0813B7C6 +_0813B790: + ldr r0, =gTasks + lsls r1, r4, 2 + adds r1, r4 + lsls r1, 3 + adds r1, r0 + ldrh r0, [r1, 0x8] + adds r0, 0x1 + strh r0, [r1, 0x8] + b _0813B7C6 + .pool +_0813B7A8: + ldr r0, =gLinkVSyncDisabled + ldrb r0, [r0] + cmp r0, 0 + bne _0813B7B4 + bl sub_800AC34 +_0813B7B4: + ldr r0, =gBattleTypeFlags + ldr r1, =gUnknown_0203AB70 + ldr r1, [r1] + str r1, [r0] + bl EnableBothScriptContexts + adds r0, r4, 0 + bl DestroyTask +_0813B7C6: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813B57C + + thumb_func_start sub_813B7D8 +sub_813B7D8: @ 813B7D8 + push {lr} + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + cmp r0, 0 + bne _0813B7F8 + ldr r2, =c2_exit_to_overworld_1_continue_scripts_restart_music + movs r0, 0 + movs r1, 0x1 + bl sub_81D6720 + b _0813B802 + .pool +_0813B7F8: + ldr r2, =c2_exit_to_overworld_1_continue_scripts_restart_music + movs r0, 0x1 + movs r1, 0 + bl sub_81D6720 +_0813B802: + pop {r0} + bx r0 + .pool + thumb_func_end sub_813B7D8 + + thumb_func_start sub_813B80C +sub_813B80C: @ 813B80C + push {lr} + ldr r0, =sub_813B824 + movs r1, 0x8 + bl CreateTask + movs r0, 0x9D + bl PlaySE + pop {r0} + bx r0 + .pool + thumb_func_end sub_813B80C + + thumb_func_start sub_813B824 +sub_813B824: @ 813B824 + push {r4,r5,lr} + lsls r0, 24 + lsrs r0, 24 + adds r5, r0, 0 + lsls r0, r5, 2 + adds r0, r5 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r4, r0, r1 + ldrh r0, [r4, 0x2] + adds r0, 0x1 + strh r0, [r4, 0x2] + movs r0, 0x2 + ldrsh r1, [r4, r0] + ldr r0, =gSpecialVar_0x8005 + ldrh r0, [r0] + cmp r1, r0 + bne _0813B858 + ldrh r0, [r4] + adds r0, 0x1 + strh r0, [r4] + movs r0, 0 + strh r0, [r4, 0x2] + movs r0, 0x9D + bl PlaySE +_0813B858: + movs r0, 0 + ldrsh r1, [r4, r0] + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + subs r0, 0x1 + cmp r1, r0 + bne _0813B86C + adds r0, r5, 0 + bl DestroyTask +_0813B86C: + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813B824 + + thumb_func_start sub_813B880 +sub_813B880: @ 813B880 + push {lr} + ldr r0, =_fwalk + movs r1, 0x8 + bl CreateTask + lsls r0, 24 + lsrs r0, 24 + ldr r2, =gTasks + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 3 + adds r1, r2 + movs r2, 0 + movs r0, 0x4 + strh r0, [r1, 0x8] + strh r0, [r1, 0xA] + strh r0, [r1, 0xC] + strh r2, [r1, 0xE] + pop {r0} + bx r0 + .pool + thumb_func_end sub_813B880 + + thumb_func_start _fwalk +_fwalk: @ 813B8B0 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + lsls r0, 24 + lsrs r0, 24 + mov r9, r0 + lsls r0, 2 + add r0, r9 + lsls r0, 3 + ldr r1, =gTasks + 0x8 + adds r5, r0, r1 + movs r0, 0x6 + ldrsh r1, [r5, r0] + lsls r1, 1 + adds r1, r5 + ldrh r0, [r1] + subs r0, 0x1 + strh r0, [r1] + movs r1, 0x6 + ldrsh r0, [r5, r1] + lsls r0, 1 + adds r0, r5 + movs r2, 0 + ldrsh r0, [r0, r2] + cmp r0, 0 + bne _0813B94E + movs r6, 0 +_0813B8EA: + movs r4, 0 + lsls r3, r6, 3 + mov r10, r3 + adds r7, r6, 0x1 + mov r8, r7 +_0813B8F4: + ldr r0, =gSaveBlock1Ptr + ldr r1, [r0] + movs r2, 0 + ldrsh r0, [r1, r2] + adds r0, r4 + adds r0, 0x6 + movs r3, 0x2 + ldrsh r1, [r1, r3] + adds r1, r6 + adds r1, 0x4 + ldr r7, =0x00000201 + adds r2, r4, r7 + add r2, r10 + movs r7, 0x6 + ldrsh r3, [r5, r7] + lsls r3, 5 + adds r2, r3 + lsls r2, 16 + lsrs r2, 16 + bl MapGridSetMetatileIdAt + adds r0, r4, 0x1 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0x2 + bls _0813B8F4 + mov r1, r8 + lsls r0, r1, 24 + lsrs r6, r0, 24 + cmp r6, 0x3 + bls _0813B8EA + bl DrawWholeMapView + ldrh r0, [r5, 0x6] + adds r0, 0x1 + strh r0, [r5, 0x6] + lsls r0, 16 + asrs r0, 16 + cmp r0, 0x3 + bne _0813B94E + mov r0, r9 + bl DestroyTask + bl EnableBothScriptContexts +_0813B94E: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + .pool + thumb_func_end _fwalk + + thumb_func_start sub_813B968 +sub_813B968: @ 813B968 + push {r4,r5,lr} + ldr r5, =gSpecialVar_Result + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + movs r1, 0x7 + bl __udivsi3 + strh r0, [r5] + ldrh r4, [r5] + adds r0, r4, 0 + movs r1, 0x14 + bl __udivsi3 + lsls r0, 16 + lsrs r0, 16 + lsls r1, r0, 2 + adds r1, r0 + lsls r1, 2 + subs r4, r1 + strh r4, [r5] + pop {r4,r5} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813B968 + + thumb_func_start sub_813B9A0 +sub_813B9A0: @ 813B9A0 + push {lr} + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldrh r1, [r0, 0x1C] + movs r0, 0xB0 + lsls r0, 4 + cmp r1, r0 + bne _0813B9B6 + movs r0, 0x3 + bl Overworld_SetHealLocationWarp +_0813B9B6: + pop {r0} + bx r0 + .pool + thumb_func_end sub_813B9A0 + + thumb_func_start sub_813B9C0 +sub_813B9C0: @ 813B9C0 + push {r4,lr} + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + movs r1, 0x4 + ldrsb r1, [r0, r1] + lsls r1, 8 + ldrb r0, [r0, 0x5] + lsls r0, 24 + asrs r0, 24 + adds r0, r1 + lsls r0, 16 + lsrs r3, r0, 16 + ldr r2, =gUnknown_085B3444 + ldrh r0, [r2] + ldr r1, =0x0000ffff + cmp r0, r1 + beq _0813BA06 + adds r4, r1, 0 + adds r1, r2, 0 +_0813B9E6: + ldrh r0, [r2] + cmp r0, r3 + bne _0813B9FC + movs r0, 0x1 + b _0813BA08 + .pool +_0813B9FC: + adds r1, 0x2 + adds r2, 0x2 + ldrh r0, [r1] + cmp r0, r4 + bne _0813B9E6 +_0813BA06: + movs r0, 0 +_0813BA08: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_813B9C0 + + thumb_func_start ResetFanClub +ResetFanClub: @ 813BA10 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r2, =0x0000141e + adds r1, r0, r2 + movs r2, 0 + strh r2, [r1] + movs r1, 0xA1 + lsls r1, 5 + adds r0, r1 + strh r2, [r0] + bx lr + .pool + thumb_func_end ResetFanClub + + thumb_func_start sub_813BA30 +sub_813BA30: @ 813BA30 + push {lr} + bl sub_813BF44 + lsls r0, 24 + cmp r0, 0 + beq _0813BA52 + bl sub_813BCE8 + ldr r0, =gSaveBlock1Ptr + ldr r1, [r0] + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldrh r0, [r0, 0xE] + movs r2, 0xA1 + lsls r2, 5 + adds r1, r2 + strh r0, [r1] +_0813BA52: + pop {r0} + bx r0 + .pool + thumb_func_end sub_813BA30 + + thumb_func_start sub_813BA60 +sub_813BA60: @ 813BA60 + push {r4,lr} + ldr r4, =gSaveBlock1Ptr + ldr r0, [r4] + ldr r1, =0x0000141e + adds r0, r1 + ldrh r0, [r0] + lsrs r0, 7 + movs r1, 0x1 + ands r0, r1 + cmp r0, 0 + bne _0813BAB6 + bl sub_813BF60 + bl sub_813BD84 + ldr r1, [r4] + ldr r0, =gSaveBlock2Ptr + ldr r0, [r0] + ldrh r0, [r0, 0xE] + movs r2, 0xA1 + lsls r2, 5 + adds r1, r2 + strh r0, [r1] + ldr r0, =0x00000315 + bl FlagClear + ldr r0, =0x00000316 + bl FlagClear + ldr r0, =0x00000317 + bl FlagClear + movs r0, 0xC6 + lsls r0, 2 + bl FlagClear + ldr r0, =0x000002da + bl FlagClear + ldr r0, =0x00004095 + movs r1, 0x1 + bl VarSet +_0813BAB6: + pop {r4} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813BA60 + + thumb_func_start sub_813BADC +sub_813BADC: @ 813BADC + push {r4-r6,lr} + lsls r0, 24 + lsrs r6, r0, 24 + ldr r0, =0x00004095 + bl VarGet + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x2 + bne _0813BB58 + ldr r4, =gSaveBlock1Ptr + ldr r0, [r4] + ldr r5, =0x0000141e + adds r3, r0, r5 + ldrh r2, [r3] + movs r1, 0x7F + ands r1, r2 + ldr r0, =gUnknown_085B3470 + adds r0, r6, r0 + ldrb r0, [r0] + adds r1, r0 + cmp r1, 0x13 + ble _0813BB54 + bl sub_813BCA8 + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x2 + bhi _0813BB3C + bl sub_813BB74 + ldr r0, [r4] + adds r0, r5 + ldrh r2, [r0] + ldr r1, =0x0000ff80 + ands r1, r2 + strh r1, [r0] + b _0813BB58 + .pool +_0813BB3C: + ldr r2, [r4] + adds r2, r5 + ldrh r1, [r2] + ldr r0, =0x0000ff80 + ands r0, r1 + movs r1, 0x14 + orrs r0, r1 + strh r0, [r2] + b _0813BB58 + .pool +_0813BB54: + adds r0, r2, r0 + strh r0, [r3] +_0813BB58: + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x0000141e + adds r0, r1 + ldrb r1, [r0] + movs r0, 0x7F + ands r0, r1 + pop {r4-r6} + pop {r1} + bx r1 + .pool + thumb_func_end sub_813BADC + + thumb_func_start sub_813BB74 +sub_813BB74: @ 813BB74 + push {r4-r7,lr} + sub sp, 0x8 + movs r3, 0 + movs r5, 0 + ldr r7, =gSaveBlock1Ptr + ldr r2, =0x0000141e + movs r6, 0x1 +_0813BB82: + ldr r0, [r7] + adds r0, r2 + ldrh r1, [r0] + ldr r0, =gUnknown_085B3474 + adds r0, r5, r0 + ldrb r4, [r0] + asrs r1, r4 + ands r1, r6 + cmp r1, 0 + bne _0813BBC8 + adds r3, r5, 0 + str r2, [sp] + str r3, [sp, 0x4] + bl Random + adds r1, r6, 0 + ands r1, r0 + ldr r2, [sp] + ldr r3, [sp, 0x4] + cmp r1, 0 + beq _0813BBC8 + ldr r0, [r7] + adds r0, r2 + adds r1, r6, 0 + lsls r1, r4 + ldrh r2, [r0] + orrs r1, r2 + strh r1, [r0] + b _0813BBEA + .pool +_0813BBC8: + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x7 + bls _0813BB82 + ldr r0, =gSaveBlock1Ptr + ldr r2, [r0] + ldr r0, =0x0000141e + adds r2, r0 + ldr r1, =gUnknown_085B3474 + adds r1, r3, r1 + movs r0, 0x1 + ldrb r1, [r1] + lsls r0, r1 + ldrh r1, [r2] + orrs r0, r1 + strh r0, [r2] +_0813BBEA: + adds r0, r3, 0 + add sp, 0x8 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_813BB74 + + thumb_func_start sub_813BC00 +sub_813BC00: @ 813BC00 + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + movs r0, 0 + mov r10, r0 + bl sub_813BCA8 + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x1 + bne _0813BC2E + movs r0, 0 + b _0813BC8E +_0813BC1E: + mov r1, r8 + ldr r0, [r1] + add r0, r9 + lsls r4, r6 + ldrh r1, [r0] + eors r4, r1 + strh r4, [r0] + b _0813BC8C +_0813BC2E: + movs r5, 0 + ldr r2, =gSaveBlock1Ptr + mov r8, r2 + ldr r0, =0x0000141e + mov r9, r0 + movs r4, 0x1 +_0813BC3A: + mov r1, r8 + ldr r0, [r1] + add r0, r9 + ldrh r1, [r0] + ldr r7, =gUnknown_085B347C + adds r0, r5, r7 + ldrb r6, [r0] + asrs r1, r6 + ands r1, r4 + cmp r1, 0 + beq _0813BC5E + mov r10, r5 + bl Random + adds r1, r4, 0 + ands r1, r0 + cmp r1, 0 + bne _0813BC1E +_0813BC5E: + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 + cmp r5, 0x7 + bls _0813BC3A + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r2, =0x0000141e + adds r4, r0, r2 + ldrh r1, [r4] + mov r2, r10 + adds r0, r2, r7 + ldrb r2, [r0] + adds r0, r1, 0 + asrs r0, r2 + movs r3, 0x1 + ands r0, r3 + cmp r0, 0 + beq _0813BC8C + adds r0, r3, 0 + lsls r0, r2 + eors r1, r0 + strh r1, [r4] +_0813BC8C: + mov r0, r10 +_0813BC8E: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + .pool + thumb_func_end sub_813BC00 + + thumb_func_start sub_813BCA8 +sub_813BCA8: @ 813BCA8 + push {r4,r5,lr} + movs r3, 0 + movs r2, 0 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x0000141e + adds r0, r1 + ldrh r4, [r0] + movs r5, 0x1 +_0813BCBA: + adds r1, r2, 0 + adds r1, 0x8 + adds r0, r4, 0 + asrs r0, r1 + ands r0, r5 + cmp r0, 0 + beq _0813BCCE + adds r0, r3, 0x1 + lsls r0, 24 + lsrs r3, r0, 24 +_0813BCCE: + adds r0, r2, 0x1 + lsls r0, 24 + lsrs r2, r0, 24 + cmp r2, 0x7 + bls _0813BCBA + adds r0, r3, 0 + pop {r4,r5} + pop {r1} + bx r1 + .pool + thumb_func_end sub_813BCA8 + + thumb_func_start sub_813BCE8 +sub_813BCE8: @ 813BCE8 + push {r4-r6,lr} + movs r5, 0 + ldr r2, =gSaveBlock2Ptr + ldr r0, [r2] + ldrh r1, [r0, 0xE] + ldr r0, =0x000003e6 + cmp r1, r0 + bhi _0813BD58 + adds r6, r2, 0 + b _0813BD32 + .pool +_0813BD04: + ldr r0, [r6] + ldrh r1, [r0, 0xE] + ldr r4, =gSaveBlock1Ptr + ldr r0, [r4] + movs r2, 0xA1 + lsls r2, 5 + adds r0, r2 + ldrh r0, [r0] + subs r1, r0 + cmp r1, 0xB + ble _0813BD58 + bl sub_813BC00 + ldr r0, [r4] + movs r1, 0xA1 + lsls r1, 5 + adds r0, r1 + ldrh r1, [r0] + adds r1, 0xC + strh r1, [r0] + adds r0, r5, 0x1 + lsls r0, 24 + lsrs r5, r0, 24 +_0813BD32: + bl sub_813BCA8 + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x4 + bhi _0813BD54 + ldr r0, =gSaveBlock1Ptr + ldr r1, [r0] + ldr r0, [r6] + ldrh r0, [r0, 0xE] + movs r2, 0xA1 + lsls r2, 5 + adds r1, r2 + strh r0, [r1] + b _0813BD58 + .pool +_0813BD54: + cmp r5, 0x8 + bne _0813BD04 +_0813BD58: + pop {r4-r6} + pop {r0} + bx r0 + thumb_func_end sub_813BCE8 + + thumb_func_start sub_813BD60 +sub_813BD60: @ 813BD60 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x0000141e + adds r0, r1 + ldrh r0, [r0] + ldr r1, =gSpecialVar_0x8004 + ldrh r1, [r1] + asrs r0, r1 + movs r1, 0x1 + ands r0, r1 + bx lr + .pool + thumb_func_end sub_813BD60 + + thumb_func_start sub_813BD84 +sub_813BD84: @ 813BD84 + ldr r0, =gSaveBlock1Ptr + ldr r2, [r0] + ldr r0, =0x0000141e + adds r2, r0 + ldrh r1, [r2] + movs r3, 0x80 + lsls r3, 6 + adds r0, r3, 0 + orrs r0, r1 + movs r3, 0x80 + lsls r3, 1 + adds r1, r3, 0 + orrs r0, r1 + movs r3, 0x80 + lsls r3, 3 + adds r1, r3, 0 + orrs r0, r1 + strh r0, [r2] + bx lr + .pool + thumb_func_end sub_813BD84 + + thumb_func_start sub_813BDB4 +sub_813BDB4: @ 813BDB4 + push {lr} + movs r3, 0 + movs r2, 0 + ldr r0, =gSpecialVar_0x8004 + ldrh r0, [r0] + subs r0, 0x8 + cmp r0, 0x7 + bhi _0813BE14 + lsls r0, 2 + ldr r1, =_0813BDD8 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0813BDD8: + .4byte _0813BE14 + .4byte _0813BE14 + .4byte _0813BDF8 + .4byte _0813BDFE + .4byte _0813BE04 + .4byte _0813BE0A + .4byte _0813BE10 + .4byte _0813BE14 +_0813BDF8: + movs r3, 0 + movs r2, 0x3 + b _0813BE14 +_0813BDFE: + movs r3, 0 + movs r2, 0x1 + b _0813BE14 +_0813BE04: + movs r3, 0x1 + movs r2, 0 + b _0813BE14 +_0813BE0A: + movs r3, 0 + movs r2, 0x4 + b _0813BE14 +_0813BE10: + movs r3, 0x1 + movs r2, 0x5 +_0813BE14: + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x00003150 + adds r0, r1 + adds r1, r3, 0 + bl sub_813BE30 + pop {r0} + bx r0 + .pool + thumb_func_end sub_813BDB4 + + thumb_func_start sub_813BE30 +sub_813BE30: @ 813BE30 + push {r4-r6,lr} + adds r6, r0, 0 + lsls r1, 24 + lsrs r5, r1, 24 + lsls r2, 24 + lsrs r2, 24 + lsls r0, r5, 4 + adds r1, r6, r0 + ldrb r0, [r1] + cmp r0, 0xFF + bne _0813BEE8 + cmp r2, 0x5 + bhi _0813BED4 + lsls r0, r2, 2 + ldr r1, =_0813BE58 + adds r0, r1 + ldr r0, [r0] + mov pc, r0 + .pool + .align 2, 0 +_0813BE58: + .4byte _0813BED4 + .4byte _0813BE70 + .4byte _0813BE84 + .4byte _0813BE98 + .4byte _0813BEAC + .4byte _0813BEC0 +_0813BE70: + ldr r0, =gStringVar1 + ldr r1, =gText_Steven + bl StringCopy + b _0813BF04 + .pool +_0813BE84: + ldr r0, =gStringVar1 + ldr r1, =gText_Brawly + bl StringCopy + b _0813BF04 + .pool +_0813BE98: + ldr r0, =gStringVar1 + ldr r1, =gText_Winona + bl StringCopy + b _0813BF04 + .pool +_0813BEAC: + ldr r0, =gStringVar1 + ldr r1, =gText_Phoebe + bl StringCopy + b _0813BF04 + .pool +_0813BEC0: + ldr r0, =gStringVar1 + ldr r1, =gText_Glacia + bl StringCopy + b _0813BF04 + .pool +_0813BED4: + ldr r0, =gStringVar1 + ldr r1, =gText_Wallace + bl StringCopy + b _0813BF04 + .pool +_0813BEE8: + ldr r4, =gStringVar1 + adds r0, r4, 0 + movs r2, 0x7 + bl StringCopyN + movs r0, 0xFF + strb r0, [r4, 0x7] + adds r0, r6, 0 + adds r0, 0x50 + adds r0, r5 + ldrb r1, [r0] + adds r0, r4, 0 + bl ConvertInternationalString +_0813BF04: + pop {r4-r6} + pop {r0} + bx r0 + .pool + thumb_func_end sub_813BE30 + + thumb_func_start sub_813BF10 +sub_813BF10: @ 813BF10 + push {lr} + ldr r0, =0x00004095 + bl VarGet + lsls r0, 16 + lsrs r0, 16 + cmp r0, 0x2 + bne _0813BF40 + bl sub_813BA30 + ldr r0, =gBattleOutcome + ldrb r0, [r0] + cmp r0, 0x1 + bne _0813BF3C + bl sub_813BB74 + b _0813BF40 + .pool +_0813BF3C: + bl sub_813BC00 +_0813BF40: + pop {r0} + bx r0 + thumb_func_end sub_813BF10 + + thumb_func_start sub_813BF44 +sub_813BF44: @ 813BF44 + ldr r0, =gSaveBlock1Ptr + ldr r0, [r0] + ldr r1, =0x0000141e + adds r0, r1 + ldrh r0, [r0] + lsrs r0, 7 + movs r1, 0x1 + ands r0, r1 + bx lr + .pool + thumb_func_end sub_813BF44 + + thumb_func_start sub_813BF60 +sub_813BF60: @ 813BF60 + ldr r0, =gSaveBlock1Ptr + ldr r1, [r0] + ldr r0, =0x0000141e + adds r1, r0 + ldrh r2, [r1] + movs r0, 0x80 + orrs r0, r2 + strh r0, [r1] + bx lr + .pool + thumb_func_end sub_813BF60 + + thumb_func_start sub_813BF7C +sub_813BF7C: @ 813BF7C + push {lr} + ldr r0, =gSpecialVar_0x8004 + ldrb r0, [r0] + bl sub_813BADC + lsls r0, 24 + lsrs r0, 24 + pop {r1} + bx r1 + .pool + thumb_func_end sub_813BF7C + + .align 2, 0 @ Don't pad with nop. diff --git a/asm/roulette.s b/asm/roulette.s index 009f30717..85d857f39 100644 --- a/asm/roulette.s +++ b/asm/roulette.s @@ -425,8 +425,8 @@ _08140618: bl SetVBlankCallback bl remove_some_task bl SetVBlankHBlankCallbacksToNull - bl sub_8121DA0 - bl sub_8121E10 + bl ResetVramOamAndBgCntRegs + bl ResetAllBgsCoordinates b _081407F8 _08140630: bl sub_8140388 @@ -3258,8 +3258,8 @@ sub_8141E7C: @ 8141E7C ldr r0, =gSpriteCoordOffsetY strh r4, [r0] strh r4, [r1] - bl sub_8121DA0 - bl sub_8121E10 + bl ResetVramOamAndBgCntRegs + bl ResetAllBgsCoordinates movs r0, 0x50 movs r1, 0 bl SetGpuReg diff --git a/asm/script_pokemon_util_80F87D8.s b/asm/script_pokemon_util_80F87D8.s index e093ea149..4f0fb850b 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/asm/use_pokeblock.s b/asm/use_pokeblock.s index f22fd9061..b01f1eff4 100755 --- a/asm/use_pokeblock.s +++ b/asm/use_pokeblock.s @@ -5,350 +5,10 @@ .text - thumb_func_start sub_8166204 -sub_8166204: @ 8166204 - push {r4-r6,lr} - adds r5, r0, 0 - adds r6, r1, 0 - ldr r4, =gUnknown_0203BCAC - ldr r0, =0x0000806c - bl AllocZeroed - str r0, [r4] - ldr r1, =gUnknown_0203BC90 - ldr r2, =0x00007fd0 - adds r0, r2 - str r0, [r1] - str r5, [r0, 0x8] - str r6, [r0, 0x4] - ldr r0, =sub_8166380 - bl launch_c3_walk_stairs_and_run_once - ldr r0, =sub_816631C - bl SetMainCallback2 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8166204 - thumb_func_start sub_816624C -sub_816624C: @ 816624C - push {r4,r5,lr} - ldr r4, =gUnknown_0203BCAC - ldr r0, =0x0000806c - bl AllocZeroed - str r0, [r4] - ldr r5, =gUnknown_0203BC90 - ldr r1, =0x00007fd0 - adds r0, r1 - str r0, [r5] - ldr r1, =gUnknown_0203BC98 - ldr r1, [r1] - str r1, [r0, 0x8] - ldr r1, =gUnknown_0203BC94 - ldr r1, [r1] - str r1, [r0, 0x4] - ldr r4, =gUnknown_0203BC9C - ldrb r0, [r4] - bl sub_81672E4 - strb r0, [r4] - ldr r5, [r5] - movs r1, 0 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bls _08166284 - movs r1, 0x1 -_08166284: - adds r0, r5, 0 - adds r0, 0x56 - strb r1, [r0] - ldr r0, =sub_8166380 - bl launch_c3_walk_stairs_and_run_once - ldr r0, =sub_81662C0 - bl SetMainCallback2 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816624C - thumb_func_start sub_81662C0 -sub_81662C0: @ 81662C0 - push {r4,lr} - ldr r4, =gUnknown_0203BC90 - ldr r0, [r4] - ldr r0, [r0] - bl _call_via_r0 - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - ldr r4, [r4] - ldr r1, [r4] - ldr r0, =map_warp_consider_1_to_outside_or_stair_or_dive - cmp r1, r0 - bne _081662F0 - adds r0, r4, 0 - adds r0, 0x50 - movs r1, 0 - strb r1, [r0] - ldr r0, =sub_8166304 - bl SetMainCallback2 -_081662F0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81662C0 - - thumb_func_start sub_8166304 -sub_8166304: @ 8166304 - push {lr} - bl sub_81668F8 - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_8166304 - - thumb_func_start sub_816631C -sub_816631C: @ 816631C - push {lr} - ldr r0, =gUnknown_0203BC90 - ldr r0, [r0] - ldr r0, [r0] - bl _call_via_r0 - bl AnimateSprites - bl BuildOamBuffer - bl RunTextPrinters - bl UpdatePaletteFade - pop {r0} - bx r0 - .pool - thumb_func_end sub_816631C - - thumb_func_start sub_8166340 -sub_8166340: @ 8166340 - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - ldr r0, =gUnknown_0203BCAC - ldr r0, [r0] - ldr r1, =0x00007c58 - adds r0, r1 - bl sub_81D2108 - bl sub_80BA0A8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8166340 - - thumb_func_start launch_c3_walk_stairs_and_run_once -launch_c3_walk_stairs_and_run_once: @ 816636C - ldr r1, =gUnknown_0203BC90 - ldr r1, [r1] - str r0, [r1] - adds r1, 0x50 - movs r0, 0 - strb r0, [r1] - bx lr - .pool - thumb_func_end launch_c3_walk_stairs_and_run_once - - thumb_func_start sub_8166380 -sub_8166380: @ 8166380 - push {r4,r5,lr} - sub sp, 0x4 - ldr r1, =gUnknown_0203BC90 - ldr r0, [r1] - adds r0, 0x50 - ldrb r0, [r0] - adds r2, r1, 0 - cmp r0, 0xF - bls _08166394 - b _08166556 -_08166394: - lsls r0, 2 - ldr r1, =_081663A8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081663A8: - .4byte _081663E8 - .4byte _0816640C - .4byte _08166416 - .4byte _08166434 - .4byte _08166464 - .4byte _08166468 - .4byte _08166474 - .4byte _08166484 - .4byte _08166490 - .4byte _0816649C - .4byte _081664B8 - .4byte _081664BC - .4byte _081664E4 - .4byte _08166510 - .4byte _08166528 - .4byte _08166550 -_081663E8: - ldr r2, =gUnknown_0203BCAC - ldr r0, [r2] - ldr r1, =0x00007b10 - adds r0, r1 - movs r1, 0xFF - strb r1, [r0] - ldr r0, [r2] - ldr r2, =0x00007c58 - adds r0, r2 - bl sub_81D1ED4 - b _0816653C - .pool -_0816640C: - bl ResetSpriteData - bl FreeAllSpritePalettes - b _0816653C -_08166416: - movs r0, 0 - bl SetVBlankCallback - movs r0, 0 - str r0, [sp] - movs r1, 0xC0 - lsls r1, 19 - ldr r2, =0x05006000 - mov r0, sp - bl CpuSet - b _0816653C - .pool -_08166434: - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_085DFCCC - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - ldr r0, =gUnknown_085DFCDC - bl InitWindows - bl DeactivateAllTextPrinters - movs r0, 0 - movs r1, 0x97 - movs r2, 0xE0 - bl sub_809882C - b _0816653C - .pool -_08166464: - ldr r1, [r2] - b _08166540 -_08166468: - bl sub_8168328 - lsls r0, 24 - cmp r0, 0 - bne _08166556 - b _0816653C -_08166474: - ldr r1, =gKeyRepeatStartDelay - movs r0, 0x14 - strh r0, [r1] - bl sub_8167420 - b _0816653C - .pool -_08166484: - bl sub_8167930 - lsls r0, 24 - cmp r0, 0 - bne _08166556 - b _0816653C -_08166490: - movs r0, 0 - bl sub_8167608 - bl sub_8167760 - b _0816653C -_0816649C: - ldr r0, =gUnknown_0203BCAC - ldr r0, [r0] - ldr r1, =0x00007b0e - adds r0, r1 - bl sub_81D312C - lsls r0, 24 - cmp r0, 0 - bne _08166556 - b _0816653C - .pool -_081664B8: - ldr r1, [r2] - b _08166540 -_081664BC: - ldr r5, =gUnknown_0203BCAC - ldr r1, [r5] - ldr r4, =0x00007c58 - adds r0, r1, r4 - ldr r2, =0x00007c6c - adds r1, r2 - bl sub_81D2754 - ldr r0, [r5] - adds r0, r4 - bl sub_81D20AC - b _0816653C - .pool -_081664E4: - ldr r4, =gUnknown_0203BCAC - ldr r0, [r4] - ldr r1, =0x00007c58 - adds r0, r1 - bl sub_81D20BC - lsls r0, 24 - cmp r0, 0 - bne _08166556 - ldr r2, [r4] - ldr r1, =0x00007c58 - adds r0, r2, r1 - adds r1, 0x14 - adds r2, r1 - adds r1, r2, 0 - bl sub_81D1F84 - b _0816653C - .pool -_08166510: - ldr r0, =gUnknown_0203BCAC - ldr r0, [r0] - ldr r2, =0x00007c58 - adds r0, r2 - bl sub_81D2230 - b _0816653C - .pool -_08166528: - movs r0, 0 - bl PutWindowTilemap - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0 - movs r1, 0x1 - bl sub_8167BA0 -_0816653C: - ldr r0, =gUnknown_0203BC90 - ldr r1, [r0] -_08166540: - adds r1, 0x50 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08166556 - .pool -_08166550: - ldr r0, =map_warp_consider_1_to_outside_or_stair_or_dive - bl launch_c3_walk_stairs_and_run_once -_08166556: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8166380 - - thumb_func_start map_warp_consider_1_to_outside_or_stair_or_dive -map_warp_consider_1_to_outside_or_stair_or_dive: @ 8166564 + thumb_func_start sub_8166564 +sub_8166564: @ 8166564 push {r4,lr} sub sp, 0x4 ldr r4, =gUnknown_0203BC90 @@ -424,14 +84,14 @@ _081665C0: bl sub_81D3480 _0816660A: ldr r0, =sub_8166634 - bl launch_c3_walk_stairs_and_run_once + bl sub_816636C _08166610: add sp, 0x4 pop {r4} pop {r0} bx r0 .pool - thumb_func_end map_warp_consider_1_to_outside_or_stair_or_dive + thumb_func_end sub_8166564 thumb_func_start sub_8166634 sub_8166634: @ 8166634 @@ -567,7 +227,7 @@ _0816675C: .pool _08166788: ldr r0, =sub_8166BEC - bl launch_c3_walk_stairs_and_run_once + bl sub_816636C b _0816680E .pool _08166794: @@ -611,7 +271,7 @@ _081667CC: .pool _081667E8: ldr r0, =sub_816681C - bl launch_c3_walk_stairs_and_run_once + bl sub_816636C b _0816680E .pool _081667F4: @@ -656,7 +316,7 @@ _08166838: adds r0, r1 ldrb r0, [r0] bl sub_81672A4 - ldr r1, =gUnknown_0203BC9C + ldr r1, =gPokeblockMonId strb r0, [r1] ldr r1, =gUnknown_0203BC94 ldr r2, [r5] @@ -708,9 +368,9 @@ _08166888: str r5, [r4] bl FreeAllWindowBuffers ldr r1, =gMain - ldr r0, =sub_816624C + ldr r0, =CB2_ReturnAndChooseMonToGivePokeblock str r0, [r1, 0x8] - bl sub_8179D70 + bl CB2_PreparePokeblockFeedScene _081668D4: add sp, 0x4 pop {r4,r5} @@ -752,7 +412,7 @@ _0816693C: ldr r0, [r0] ldr r1, =0x00008041 adds r0, r1 - ldr r1, =gUnknown_0203BC9C + ldr r1, =gPokeblockMonId ldrb r0, [r0] ldrb r1, [r1] cmp r0, r1 @@ -837,7 +497,7 @@ _081669F4: adds r0, r1 bl sub_81D3464 ldr r0, =sub_8166A34 - bl launch_c3_walk_stairs_and_run_once + bl sub_816636C ldr r0, =sub_816631C bl SetMainCallback2 _08166A18: @@ -1018,9 +678,9 @@ _08166BB6: bne _08166BDA ldr r0, =gSpecialVar_ItemId ldrb r0, [r0] - bl sub_8136F68 + bl TryClearPokeblock ldr r0, =sub_8166BEC - bl launch_c3_walk_stairs_and_run_once + bl sub_816636C _08166BDA: pop {r4-r6} pop {r0} @@ -1225,7 +885,7 @@ sub_8166D44: @ 8166D44 movs r0, 0x2 movs r1, 0x3 bl CopyWindowToVram - ldr r0, =gUnknown_085DFCFC + ldr r0, =sUsePokeblockYesNoWinTemplate movs r1, 0x97 movs r2, 0xE movs r3, 0 @@ -1497,7 +1157,7 @@ sub_8166FD4: @ 8166FD4 movs r0, 0 _08166FEC: lsls r0, 16 - ldr r1, =gUnknown_085DFD04 + ldr r1, =sContestStatNames lsls r0, r3, 2 adds r0, r1 ldr r1, [r0] @@ -1719,7 +1379,7 @@ sub_8167184: @ 8167184 adds r0, r3, 0 adds r0, 0x6E strh r1, [r0] - ldr r0, =gUnknown_0203BC9E + ldr r0, =gPokeblockGain movs r1, 0 ldrsh r0, [r0, r1] cmp r0, 0 diff --git a/data/data4c.s b/data/data4d.s similarity index 93% rename from data/data4c.s rename to data/data4d.s index c18d0d592..57dc8befc 100644 --- a/data/data4c.s +++ b/data/data4d.s @@ -5,60 +5,6 @@ .section .rodata -gPokeblockFlavorCompatibilityTable:: @ 85B25A0 - .incbin "baserom.gba", 0x5b25a0, 0x80 - -gUnknown_085B2620:: @ 85B2620 - .incbin "baserom.gba", 0x5b2620, 0xc - -gPokeblockNames:: @ 85B262C - .incbin "baserom.gba", 0x5b262c, 0x3c - -gUnknown_085B2668:: @ 85B2668 - .incbin "baserom.gba", 0x5b2668, 0x30 - -gUnknown_085B2698:: @ 85B2698 - .incbin "baserom.gba", 0x5b2698, 0x3 - -gUnknown_085B269B:: @ 85B269B - .incbin "baserom.gba", 0x5b269b, 0x2 - -gUnknown_085B269D:: @ 85B269D - .incbin "baserom.gba", 0x5b269d, 0x2 - -gUnknown_085B269F:: @ 85B269F - .incbin "baserom.gba", 0x5b269f, 0x5 - -gUnknown_085B26A4:: @ 85B26A4 - .incbin "baserom.gba", 0x5b26a4, 0x4c - -gUnknown_085B26F0:: @ 85B26F0 - .incbin "baserom.gba", 0x5b26f0, 0x4 - -gUnknown_085B26F4:: @ 85B26F4 - .incbin "baserom.gba", 0x5b26f4, 0x8 - -gUnknown_085B26FC:: @ 85B26FC - .incbin "baserom.gba", 0x5b26fc, 0x8 - -gUnknown_085B2704:: @ 85B2704 - .incbin "baserom.gba", 0x5b2704, 0x18 - -gUnknown_085B271C:: @ 85B271C - .incbin "baserom.gba", 0x5b271c, 0x4 - -gUnknown_085B2720:: @ 85B2720 - .incbin "baserom.gba", 0x5b2720, 0x28 - -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 @@ -797,4 +743,3 @@ gUnknown_085C9A30:: @ 85C9A30 gUnknown_085C9A53:: @ 85C9A53 .incbin "baserom.gba", 0x5c9a53, 0x41 - diff --git a/data/event_scripts.s b/data/event_scripts.s index d25717007..30db7638c 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -1435,7 +1435,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 @@ -2194,7 +2194,7 @@ SSTidalRooms_EventScript_272083:: @ 8272083 fadescreen 1 playfanfare MUS_ME_ASA waitfanfare - special sp000_heal_pokemon + special HealPlayerParty fadescreen 0 return @@ -5133,7 +5133,7 @@ SecretBase_RedCave1_EventScript_276286:: @ 8276286 call_if 1, SecretBase_RedCave1_EventScript_2762C1 compare VAR_RESULT, 2 call_if 1, SecretBase_RedCave1_EventScript_2762C5 - special sp000_heal_pokemon + special HealPlayerParty release end diff --git a/data/graphics.s b/data/graphics.s index 113330e81..aebe35093 100644 --- a/data/graphics.s +++ b/data/graphics.s @@ -880,14 +880,80 @@ gBuyMenuFrame_Tilemap:: @ 8D9B0F0 gMenuMoneyGfx:: @ 8D9B230 .incbin "baserom.gba", 0xd9b230, 0x84 -gUnknown_08D9B2B4:: @ 8D9B2B4 +gMenuPokeblock_Gfx:: @ 8D9B2B4 .incbin "baserom.gba", 0xd9b2b4, 0x1bc -gUnknown_08D9B470:: @ 8D9B470 - .incbin "baserom.gba", 0xd9b470, 0x358 +gMenuPokeblock_Pal:: @ 8D9B470 + .incbin "baserom.gba", 0xd9b470, 0x70 + +gMenuPokeblockDevice_Gfx:: @ 8D9B4E0 + .incbin "baserom.gba", 0xd9b4e0, 0x2c0 + +gMenuPokeblockDevice_Pal:: @ 8D9B7A0 + .incbin "baserom.gba", 0xd9b7a0, 0x28 -gUnknown_08D9B7C8:: @ 8D9B7C8 - .incbin "baserom.gba", 0xd9b7c8, 0x27c +gMenuPokeblock_Tilemap:: @ 8D9B7C8 + .incbin "baserom.gba", 0xd9b7c8, 0x148 + + .align 2 +gPokeblock_Gfx:: + .incbin "graphics/pokeblock/pokeblock.4bpp.lz" + + .align 2 +gPokeblockRed_Pal:: + .incbin "graphics/pokeblock/red.gbapal.lz" + + .align 2 +gPokeblockBlue_Pal:: + .incbin "graphics/pokeblock/blue.gbapal.lz" + + .align 2 +gPokeblockPink_Pal:: + .incbin "graphics/pokeblock/pink.gbapal.lz" + + .align 2 +gPokeblockGreen_Pal:: + .incbin "graphics/pokeblock/green.gbapal.lz" + + .align 2 +gPokeblockYellow_Pal:: + .incbin "graphics/pokeblock/yellow.gbapal.lz" + + .align 2 +gPokeblockPurple_Pal:: + .incbin "graphics/pokeblock/purple.gbapal.lz" + + .align 2 +gPokeblockIndigo_Pal:: + .incbin "graphics/pokeblock/indigo.gbapal.lz" + + .align 2 +gPokeblockBrown_Pal:: + .incbin "graphics/pokeblock/brown.gbapal.lz" + + .align 2 +gPokeblockLiteBlue_Pal:: + .incbin "graphics/pokeblock/liteblue.gbapal.lz" + + .align 2 +gPokeblockOlive_Pal:: + .incbin "graphics/pokeblock/olive.gbapal.lz" + + .align 2 +gPokeblockGray_Pal:: + .incbin "graphics/pokeblock/gray.gbapal.lz" + + .align 2 +gPokeblockBlack_Pal:: + .incbin "graphics/pokeblock/black.gbapal.lz" + + .align 2 +gPokeblockWhite_Pal:: + .incbin "graphics/pokeblock/white.gbapal.lz" + + .align 2 +gPokeblockGold_Pal:: + .incbin "graphics/pokeblock/gold.gbapal.lz" gUnknown_08D9BA44:: @ 8D9BA44 .incbin "baserom.gba", 0xd9ba44, 0x100 diff --git a/data/pokeblock_feed.s b/data/pokeblock_feed.s deleted file mode 100644 index b4d3d192d..000000000 --- a/data/pokeblock_feed.s +++ /dev/null @@ -1,43 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - -gUnknown_085EFEBC:: @ 85EFEBC - .incbin "baserom.gba", 0x5efebc, 0x32 - -gUnknown_085EFEEE:: @ 85EFEEE - .incbin "baserom.gba", 0x5efeee, 0x12 - -gUnknown_085EFF00:: @ 85EFF00 - .incbin "baserom.gba", 0x5eff00, 0x5fc - -gUnknown_085F04FC:: @ 85F04FC - .incbin "baserom.gba", 0x5f04fc, 0x54 - -gUnknown_085F0550:: @ 85F0550 - .incbin "baserom.gba", 0x5f0550, 0x8 - -gUnknown_085F0558:: @ 85F0558 - .incbin "baserom.gba", 0x5f0558, 0x10 - -gUnknown_085F0568:: @ 85F0568 - .incbin "baserom.gba", 0x5f0568, 0x48 - -gUnknown_085F05B0:: @ 85F05B0 - .incbin "baserom.gba", 0x5f05b0, 0xb4 - -gUnknown_085F0664:: @ 85F0664 - .incbin "baserom.gba", 0x5f0664, 0x4 - -gUnknown_085F0668:: @ 85F0668 - .incbin "baserom.gba", 0x5f0668, 0x4 - -gUnknown_085F066C:: @ 85F066C - .incbin "baserom.gba", 0x5f066c, 0x34 - -gUnknown_085F06A0:: @ 85F06A0 - .incbin "baserom.gba", 0x5f06a0, 0x8 - -gUnknown_085F06A8:: @ 85F06A8 - .incbin "baserom.gba", 0x5f06a8, 0x18 diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc index 6ea5d5d88..5418e6e4e 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 f666be180..52351b549 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 MUS_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 a05055a1c..303a2c4c9 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 f5d2f0005..fce85e7d3 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 65235398e..33b5654d0 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 eab5bce02..5de099292 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 MUS_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 45b8be7be..7d1c57f66 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 f9806de9b..4c0528e34 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 MUS_ME_ASA waitfanfare - special sp000_heal_pokemon + special HealPlayerParty setvar VAR_0x8004, 9 special sub_81A1780 compare VAR_RESULT, 0 diff --git a/data/scripts/maps/BattleFrontier_BattlePalaceBattleRoom.inc b/data/scripts/maps/BattleFrontier_BattlePalaceBattleRoom.inc index 43b9f6f17..ccd285a3a 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 MUS_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 ffbcca8c3..2e0f152b4 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 30b0165bc..40b5e437f 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 36b761e22..30245d984 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 MUS_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 MUS_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 97232ea36..bf031e090 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 ea81248c9..9455479a7 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 ba111f080..7ed448c9a 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 MUS_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 01f427aaf..feaa18c8d 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 MUS_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 9accdb8ea..7c0762417 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 57b76cb49..c3ed02996 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 6277a9050..b4d0a5d9c 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 MUS_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 9c830ecb3..4d4334aca 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 1f6f2b02b..e0c6da76c 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 f6c09f9c1..6a0bafb45 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 MUS_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 8a7f81f9a..a7a24757f 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 MUS_ME_ASA waitfanfare - special sp000_heal_pokemon + special HealPlayerParty removeobject 1 setflag FLAG_0x384 compare VAR_0x40DA, 0 diff --git a/data/scripts/maps/SootopolisCity_MysteryEventsHouse_B1F.inc b/data/scripts/maps/SootopolisCity_MysteryEventsHouse_B1F.inc index 9a63398c2..f5b867405 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_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 502a8a7ed..38ae5b85f 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 208f9b4d2..b673e959b 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 MUS_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 8c3d5701f..c2d217f93 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_RESULT, 65535 goto_if 5, EventScript_2A4BE2 diff --git a/data/specials.inc b/data/specials.inc index bdd99f414..93df6aa75 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/data/strings.s b/data/strings.s index 3120c8953..e217a81e0 100644 --- a/data/strings.s +++ b/data/strings.s @@ -832,46 +832,46 @@ gText_UnkF908Var1Var2:: @ 85E9263 gText_BerryTag:: @ 85E926B .string "BERRY TAG$" -gUnknown_085E9275:: @ 85E9275 +gText_RedPokeblock:: @ 85E9275 .string "RED {POKEBLOCK}$" -gUnknown_085E927F:: @ 85E927F +gText_BluePokeblock:: @ 85E927F .string "BLUE {POKEBLOCK}$" -gUnknown_085E928A:: @ 85E928A +gText_PinkPokeblock:: @ 85E928A .string "PINK {POKEBLOCK}$" -gUnknown_085E9295:: @ 85E9295 +gText_GreenPokeblock:: @ 85E9295 .string "GREEN {POKEBLOCK}$" -gUnknown_085E92A1:: @ 85E92A1 +gText_YellowPokeblock:: @ 85E92A1 .string "YELLOW {POKEBLOCK}$" -gUnknown_085E92AE:: @ 85E92AE +gText_PurplePokeblock:: @ 85E92AE .string "PURPLE {POKEBLOCK}$" -gUnknown_085E92BB:: @ 85E92BB +gText_IndigoPokeblock:: @ 85E92BB .string "INDIGO {POKEBLOCK}$" -gUnknown_085E92C8:: @ 85E92C8 +gText_BrownPokeblock:: @ 85E92C8 .string "BROWN {POKEBLOCK}$" -gUnknown_085E92D4:: @ 85E92D4 +gText_LiteBluePokeblock:: @ 85E92D4 .string "LITEBLUE {POKEBLOCK}$" -gUnknown_085E92E3:: @ 85E92E3 +gText_OlivePokeblock:: @ 85E92E3 .string "OLIVE {POKEBLOCK}$" -gUnknown_085E92EF:: @ 85E92EF +gText_GrayPokeblock:: @ 85E92EF .string "GRAY {POKEBLOCK}$" -gUnknown_085E92FA:: @ 85E92FA +gText_BlackPokeblock:: @ 85E92FA .string "BLACK {POKEBLOCK}$" -gUnknown_085E9306:: @ 85E9306 +gText_WhitePokeblock:: @ 85E9306 .string "WHITE {POKEBLOCK}$" -gUnknown_085E9312:: @ 85E9312 +gText_GoldPokeblock:: @ 85E9312 .string "GOLD {POKEBLOCK}$" gText_Spicy:: @ 85E931D @@ -3158,19 +3158,19 @@ gText_PokemonCenter:: @ 85EC791 gText_GetsAPokeBlockQuestion:: @ 85EC7A0 .string " gets a {POKEBLOCK}?$" -gUnknown_085EC7AF:: @ 85EC7AF +gText_Coolness:: @ 85EC7AF .string "Coolness $" -gUnknown_085EC7B9:: @ 85EC7B9 +gText_Beauty3:: @ 85EC7B9 .string "Beauty $" -gUnknown_085EC7C1:: @ 85EC7C1 +gText_Cuteness:: @ 85EC7C1 .string "Cuteness $" -gUnknown_085EC7CB:: @ 85EC7CB +gText_Smartness:: @ 85EC7CB .string "Smartness $" -gUnknown_085EC7D6:: @ 85EC7D6 +gText_Toughness:: @ 85EC7D6 .string "Toughness $" gText_WasEnhanced:: @ 85EC7E1 diff --git a/data/use_pokeblock.s b/data/use_pokeblock.s index 9b557a0dd..a45ea27e1 100644 --- a/data/use_pokeblock.s +++ b/data/use_pokeblock.s @@ -19,22 +19,32 @@ gUnknown_085DFCB0:: @ 85DFCB0 .incbin "baserom.gba", 0x5dfcb0, 0x14 gUnknown_085DFCC4:: @ 85DFCC4 - .incbin "baserom.gba", 0x5dfcc4, 0x5 + .byte 0, 4, 3, 2, 1 gUnknown_085DFCC9:: @ 85DFCC9 - .incbin "baserom.gba", 0x5dfcc9, 0x3 + .byte 0, 8, 1 gUnknown_085DFCCC:: @ 85DFCCC - .incbin "baserom.gba", 0x5dfccc, 0x10 + .4byte 0x1F8 + .4byte 0x31E1 + .4byte 0x4021DF + .4byte 0x1172 gUnknown_085DFCDC:: @ 85DFCDC - .incbin "baserom.gba", 0x5dfcdc, 0x20 + window_template 0, 0xD, 1, 0xD, 4, 0xF, 1 + window_template 0, 0, 0xE, 0xB, 2, 0xF, 0x35 + window_template 0, 1, 0x11, 0x1C, 2, 0xF, 0x4B + window_template_terminator -gUnknown_085DFCFC:: @ 85DFCFC - .incbin "baserom.gba", 0x5dfcfc, 0x8 +sUsePokeblockYesNoWinTemplate:: @ 85DFCFC + window_template 0, 0x18, 0xB, 5, 4, 0xF, 0x83 -gUnknown_085DFD04:: @ 85DFD04 - .incbin "baserom.gba", 0x5dfd04, 0x14 +sContestStatNames:: @ 85DFD04 + .4byte gText_Coolness + .4byte gText_Toughness + .4byte gText_Smartness + .4byte gText_Cuteness + .4byte gText_Beauty3 gUnknown_085DFD18:: @ 85DFD18 .incbin "baserom.gba", 0x5dfd18, 0x8 diff --git a/graphics/pokeblock/black.pal b/graphics/pokeblock/black.pal new file mode 100644 index 000000000..2cb591a70 --- /dev/null +++ b/graphics/pokeblock/black.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +213 131 74 +41 41 41 +98 98 98 +148 148 148 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/pokeblock/blue.pal b/graphics/pokeblock/blue.pal new file mode 100644 index 000000000..8295c79e8 --- /dev/null +++ b/graphics/pokeblock/blue.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 0 0 +106 106 189 +148 148 255 +180 180 255 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/pokeblock/brown.pal b/graphics/pokeblock/brown.pal new file mode 100644 index 000000000..c936322bb --- /dev/null +++ b/graphics/pokeblock/brown.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 0 0 +106 0 0 +172 65 65 +197 123 123 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/pokeblock/gold.pal b/graphics/pokeblock/gold.pal new file mode 100644 index 000000000..c975554d1 --- /dev/null +++ b/graphics/pokeblock/gold.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 0 0 +222 197 49 +246 230 164 +255 238 197 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/pokeblock/gray.pal b/graphics/pokeblock/gray.pal new file mode 100644 index 000000000..0bd5c4d7c --- /dev/null +++ b/graphics/pokeblock/gray.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 0 0 +148 148 148 +189 189 189 +205 205 205 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/pokeblock/green.pal b/graphics/pokeblock/green.pal new file mode 100644 index 000000000..984ba41ea --- /dev/null +++ b/graphics/pokeblock/green.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 0 0 +0 106 0 +49 164 49 +90 230 90 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/pokeblock/indigo.pal b/graphics/pokeblock/indigo.pal new file mode 100644 index 000000000..4a57b8bde --- /dev/null +++ b/graphics/pokeblock/indigo.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +139 205 74 +0 0 106 +65 65 172 +123 123 255 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/pokeblock/liteblue.pal b/graphics/pokeblock/liteblue.pal new file mode 100644 index 000000000..e3a70c8be --- /dev/null +++ b/graphics/pokeblock/liteblue.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 0 0 +106 139 189 +148 213 255 +180 238 255 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/pokeblock/olive.pal b/graphics/pokeblock/olive.pal new file mode 100644 index 000000000..e7599fc1e --- /dev/null +++ b/graphics/pokeblock/olive.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 0 0 +115 180 106 +148 246 98 +205 255 139 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/pokeblock/pink.pal b/graphics/pokeblock/pink.pal new file mode 100644 index 000000000..7eb09a598 --- /dev/null +++ b/graphics/pokeblock/pink.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 0 0 +205 90 172 +255 156 197 +255 197 213 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/pokeblock/pokeblock.png b/graphics/pokeblock/pokeblock.png new file mode 100644 index 000000000..fd24e0621 Binary files /dev/null and b/graphics/pokeblock/pokeblock.png differ diff --git a/graphics/pokeblock/purple.pal b/graphics/pokeblock/purple.pal new file mode 100644 index 000000000..2b6f8ad43 --- /dev/null +++ b/graphics/pokeblock/purple.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 0 0 +164 0 164 +197 41 197 +255 131 255 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/pokeblock/red.pal b/graphics/pokeblock/red.pal new file mode 100644 index 000000000..a347854a9 --- /dev/null +++ b/graphics/pokeblock/red.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 0 0 +205 65 24 +255 123 90 +255 180 148 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/pokeblock/white.pal b/graphics/pokeblock/white.pal new file mode 100644 index 000000000..c1d00b93a --- /dev/null +++ b/graphics/pokeblock/white.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 0 0 +222 222 222 +238 238 238 +255 255 255 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/pokeblock/yellow.pal b/graphics/pokeblock/yellow.pal new file mode 100644 index 000000000..518042d9f --- /dev/null +++ b/graphics/pokeblock/yellow.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +0 0 0 +180 180 49 +246 230 49 +255 255 148 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/include/global.h b/include/global.h index 9fe0d975f..b6a496dd1 100644 --- a/include/global.h +++ b/include/global.h @@ -514,11 +514,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 { @@ -611,7 +612,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/graphics.h b/include/graphics.h index 15af31c6e..0a38c9b82 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -1,10 +1,7 @@ -// -// Created by scott on 10/21/2017. -// - #ifndef GUARD_GRAPHICS_H #define GUARD_GRAPHICS_H +// interface pokeballs extern const u8 gInterfaceGfx_PokeBall[]; extern const u8 gInterfacePal_PokeBall[]; extern const u8 gInterfaceGfx_GreatBall[]; @@ -31,6 +28,28 @@ extern const u8 gInterfaceGfx_PremierBall[]; extern const u8 gInterfacePal_PremierBall[]; extern const u8 gOpenPokeballGfx[]; +// pokeblock +extern const u8 gMenuPokeblock_Gfx[]; +extern const u8 gMenuPokeblock_Pal[]; +extern const u8 gMenuPokeblock_Tilemap[]; +extern const u8 gMenuPokeblockDevice_Gfx[]; +extern const u8 gMenuPokeblockDevice_Pal[]; +extern const u8 gPokeblockRed_Pal[]; +extern const u8 gPokeblockBlue_Pal[]; +extern const u8 gPokeblockPink_Pal[]; +extern const u8 gPokeblockGreen_Pal[]; +extern const u8 gPokeblockYellow_Pal[]; +extern const u8 gPokeblockPurple_Pal[]; +extern const u8 gPokeblockIndigo_Pal[]; +extern const u8 gPokeblockBrown_Pal[]; +extern const u8 gPokeblockLiteBlue_Pal[]; +extern const u8 gPokeblockOlive_Pal[]; +extern const u8 gPokeblockGray_Pal[]; +extern const u8 gPokeblockBlack_Pal[]; +extern const u8 gPokeblockWhite_Pal[]; +extern const u8 gPokeblockGold_Pal[]; +extern const u8 gPokeblock_Gfx[]; + extern const u8 gItemIcon_QuestionMark[]; extern const u8 gItemIconPalette_QuestionMark[]; extern const u8 gUnknown_08DB7AA0[]; diff --git a/include/lilycove_lady.h b/include/lilycove_lady.h index c7776131b..084e5722e 100644 --- a/include/lilycove_lady.h +++ b/include/lilycove_lady.h @@ -7,7 +7,7 @@ void sub_818DA78(void); void sub_818DEF4(void); void sub_818E564(void); void sub_818E570(const struct LilycoveLadyQuiz *quiz); -bool8 sub_818E704(struct Pokeblock *pokeblock); +bool8 GivePokeblockToContestLady(struct Pokeblock *pokeblock); void sub_818E7E0(u8 *dest1, u8 *dest2); void sub_818E81C(u8 *dest); void sub_818E848(u8 *dest); 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 99ff35adb..124303570 100644 --- a/include/menu.h +++ b/include/menu.h @@ -4,6 +4,9 @@ #include "text.h" #include "window.h" +#define MENU_NOTHING_CHOSEN -2 +#define MENU_B_PRESSED -1 + struct MenuAction { const u8 *text; @@ -32,7 +35,9 @@ void CreateYesNoMenu(const struct WindowTemplate *windowTemplate, u16 borderFirs s8 ProcessMenuInputNoWrap_(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); +void sub_81995E4(u8 windowId, u8 optionsNo, const struct MenuAction *actions, const u8 *actionIds); +void sub_8197DF8(u8 windowId, bool8 copyToVram); #endif // GUARD_MENU_H diff --git a/include/menu_helpers.h b/include/menu_helpers.h index f083a10e2..14b6d32ca 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; }; @@ -16,5 +17,15 @@ void sub_812225C(u16 *, u16 *, u8, u8); void sub_8122298(u16 *, u16 *, u8, u8, u8); void sub_8121F68(u8 taskId, const struct YesNoFuncTable *data); bool8 sub_81221AC(void); +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); +void DisplayMessageAndContinueTask(u8 taskId, u8 arg1, u16 arg2, u8 arg3, u8 arg4, u8 textSpeed, const u8 *string, void *taskFunc); +void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *template, u8 arg2, u8 arg3, u8 arg4, u16 tileStart, u8 palette, const struct YesNoFuncTable *yesNo); #endif //GUARD_MENU_HELPERS_H diff --git a/include/party_menu.h b/include/party_menu.h index c787bafb1..3756ef569 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -1,7 +1,8 @@ #ifndef GUARD_PARTY_MENU_H #define GUARD_PARTY_MENU_H -enum { +enum +{ AILMENT_NONE, AILMENT_PSN, AILMENT_PRZ, @@ -14,5 +15,6 @@ bool8 pokemon_has_move(struct Pokemon *, u16); void sub_81B58A8(void); void DoWallyTutorialBagMenu(void); u8 pokemon_ailments_get_primary(u32 status); +u8 *GetMonNickname(struct Pokemon *mon, u8 *dst); #endif // GUARD_PARTY_MENU_H diff --git a/include/pokeblock.h b/include/pokeblock.h index a145cbada..6dd07b689 100644 --- a/include/pokeblock.h +++ b/include/pokeblock.h @@ -1,6 +1,9 @@ #ifndef GUARD_POKEBLOCK_H #define GUARD_POKEBLOCK_H +#define GFX_TAG_POKEBLOCK 14818 +#define GFX_TAG_POKEBLOCK_CASE 14800 + enum { PBLOCK_CLR_BLACK, @@ -22,12 +25,44 @@ enum PBLOCK_FEEL, }; +enum +{ + PBLOCK_CASE_FIELD, + PBLOCK_CASE_BATTLE, + PBLOCK_CASE_FEEDER, + PBLOCK_CASE_GIVE +}; + +// use pokeblock +extern u8 gPokeblockMonId; +extern s16 gPokeblockGain; + +void ChooseMonToGivePokeblock(struct Pokeblock *pokeblock, void (*callback)(void)); + +// pokeblock feed +void CB2_PreparePokeblockFeedScene(void); + +// pokeblock +extern const s8 gPokeblockFlavorCompatibilityTable[]; +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); void ClearPokeblocks(void); -s8 GetFirstFreePokeblockSlot(void); -bool32 AddPokeblock(struct Pokeblock *pokeblock); u8 GetHighestPokeblocksFlavorLevel(const struct Pokeblock *pokeblock); u8 GetPokeblocksFeel(const struct Pokeblock *pokeblock); +s8 GetFirstFreePokeblockSlot(void); +bool32 AddPokeblock(const struct Pokeblock *pokeblock); +bool32 TryClearPokeblock(u8 pkblId); +s16 GetPokeblockData(const struct Pokeblock *pokeblock, u8 field); +s16 PokeblockGetGain(u8 nature, const struct Pokeblock *pokeblock); +void PokeblockCopyName(const struct Pokeblock *pokeblock, u8 *dest); +bool8 CopyMonFavoritePokeblockName(u8 nature, u8 *dest); u8 GetPokeblocksFlavor(const struct Pokeblock *pokeblock); -s16 PokeblockGetGain(u8, const struct Pokeblock *); #endif // GUARD_POKEBLOCK_H diff --git a/include/pokenav.h b/include/pokenav.h index 4335923c8..ebe3b325c 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -2,6 +2,16 @@ #define GUARD_POKENAV_H bool8 sub_81D5C18(void); +bool8 sub_81D20BC(void *arg0); +bool8 sub_81D312C(void *arg0); +void sub_81D1ED4(void *arg0); +void sub_81D2108(void *arg0); +void sub_81D20AC(void *arg0); +void sub_81D2230(void *arg0); +void sub_81D3464(void *arg0); +void sub_81D3480(void *arg0, u8 arg1); +void sub_81D2754(void *arg0, void *arg1); +void sub_81D1F84(void *arg0, void *arg1, void *arg2); const u8 *sub_81D62AC(void); #endif //GUARD_POKENAV_H diff --git a/include/rom6.h b/include/rom6.h index 6d20752e2..fc33b7d1f 100644 --- a/include/rom6.h +++ b/include/rom6.h @@ -1,7 +1,7 @@ #ifndef GUARD_ROM6_H #define GUARD_ROM6_H -void sub_81357FC(u8, void(void)); +void OpenPokeblockCase(u8, void(void)); u8 GetLeadMonIndex(void); u8 GetSSTidalLocation(u8 *grp, u8 *num, s16 *x, s16 *y); void sub_813BADC(bool8); diff --git a/include/strings.h b/include/strings.h index e3650bc63..5521d828b 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1,45 +1,62 @@ #ifndef GUARD_STRINGS_H #define GUARD_STRINGS_H -// Exported type declarations - -// Exported RAM declarations - -// Exported ROM declarations - extern const u8 gText_FromSpace[]; + extern const u8 gText_Lv50[]; extern const u8 gText_OpenLevel[]; + extern const u8 gText_Mom[]; extern const u8 gText_Dad[]; + extern const u8 gText_Cool[]; extern const u8 gText_Beauty[]; extern const u8 gText_Cute[]; extern const u8 gText_Smart[]; 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[]; extern const u8 gText_Bitter2[]; extern const u8 gText_Sour2[]; + extern const u8 gText_Excellent[]; extern const u8 gText_VeryGood[]; extern const u8 gText_Good[]; extern const u8 gText_SoSo[]; extern const u8 gText_Bad[]; extern const u8 gText_TheWorst[]; + extern const u8 gText_Slots[]; extern const u8 gText_Roulette[]; extern const u8 gText_Jackpot[]; + extern const u8 gText_First[]; extern const u8 gText_Second[]; extern const u8 gText_Third[]; + extern const u8 gText_NoDecorations[]; extern const u8 gText_NoDecorationsInUse[]; + extern const u8 gText_Exit[]; extern const u8 gText_Cancel[]; + +extern const u8 gText_ThrowAwayVar1[]; +extern const u8 gText_Var1ThrownAway[]; + extern const u8 gText_Color161Shadow161[]; extern const u8 gText_GoBackPrevMenu[]; extern const u8 gText_CantPlaceInRoom[]; @@ -56,12 +73,14 @@ extern const u8 gText_NoDecorationHere[]; extern const u8 gText_DecorationWillBeDiscarded[]; extern const u8 gText_CantThrowAwayInUse[]; extern const u8 gText_DecorationThrownAway[]; + extern const u8 gText_Desk[]; extern const u8 gText_Chair[]; extern const u8 gText_Plant[]; extern const u8 gText_Ornament[]; extern const u8 gText_Mat[]; extern const u8 gText_Poster[]; + extern const u8 gText_PutOutSelectedDecorItem[]; extern const u8 gText_StoreChosenDecorInPC[]; extern const u8 gText_ThrowAwayUnwantedDecors[]; @@ -92,4 +111,30 @@ extern const u8 gText_Draw[]; extern const u8 gText_Loss[]; extern const u8 gText_Win[]; +extern const u8 gText_Var1AteTheVar2[]; +extern const u8 gText_Var1HappilyAteVar2[]; +extern const u8 gText_Var1DisdainfullyAteVar2[]; + +extern const u8 gText_RedPokeblock[]; +extern const u8 gText_BluePokeblock[]; +extern const u8 gText_PinkPokeblock[]; +extern const u8 gText_GreenPokeblock[]; +extern const u8 gText_YellowPokeblock[]; +extern const u8 gText_PurplePokeblock[]; +extern const u8 gText_IndigoPokeblock[]; +extern const u8 gText_BrownPokeblock[]; +extern const u8 gText_LiteBluePokeblock[]; +extern const u8 gText_OlivePokeblock[]; +extern const u8 gText_GrayPokeblock[]; +extern const u8 gText_BlackPokeblock[]; +extern const u8 gText_WhitePokeblock[]; +extern const u8 gText_GoldPokeblock[]; + +extern const u8 gMenuText_Use[]; +extern const u8 gMenuText_Toss[]; +extern const u8 gMenuText_Give[]; +extern const u8 gMenuText_Give2[]; + +extern const u8 gText_Cancel2[]; + #endif //GUARD_STRINGS_H diff --git a/include/text_window.h b/include/text_window.h index da3fb301e..0af007397 100644 --- a/include/text_window.h +++ b/include/text_window.h @@ -3,8 +3,8 @@ struct TilesPal { - u32* tiles; - u16* pal; + u32 *tiles; + u16 *pal; }; const struct TilesPal* sub_8098758(u8 id); diff --git a/ld_script.txt b/ld_script.txt index fb4ee9107..394264024 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -179,6 +179,8 @@ SECTIONS { src/starter_choose.o(.text); src/wallclock.o(.text); asm/rom6.o(.text); + src/pokeblock.o(.text); + asm/rom_81370FC.o(.text); asm/battle_records.o(.text); asm/pokedex_area_screen.o(.text); src/evolution_scene.o(.text); @@ -207,6 +209,7 @@ SECTIONS { src/decoration_inventory.o(.text); src/roamer.o(.text); asm/battle_tower.o(.text); + src/use_pokeblock.o(.text); asm/use_pokeblock.o(.text); src/battle_controller_wally.o(.text); asm/player_pc.o(.text); @@ -222,7 +225,7 @@ SECTIONS { asm/mystery_event_menu.o(.text); src/save_failed_screen.o(.text); src/braille_puzzles.o(.text); - asm/pokeblock_feed.o(.text); + src/pokeblock_feed.o(.text); src/clear_save_data_screen.o(.text); asm/intro_credits_graphics.o(.text); src/evolution_graphics.o(.text); @@ -424,7 +427,8 @@ SECTIONS { data/data4.o(.rodata); data/starter_choose.o(.rodata); src/wallclock.o(.rodata); - data/data4c.o(.rodata); + src/pokeblock.o(.rodata); + data/data4d.o(.rodata); src/battle_controller_link_partner.o(.rodata); src/battle_message.o(.rodata); data/cable_car.o(.rodata); @@ -436,6 +440,7 @@ SECTIONS { data/learn_move.o(.rodata); src/roamer.o(.rodata); data/battle_tower.o(.rodata); + src/use_pokeblock.o(.rodata); data/use_pokeblock.o(.rodata); src/battle_controller_wally.o(.rodata); data/player_pc.o(.rodata); @@ -451,7 +456,7 @@ SECTIONS { data/mystery_event_menu.o(.rodata); src/save_failed_screen.o(.rodata); data/braille_puzzles.o(.rodata); - data/pokeblock_feed.o(.rodata); + src/pokeblock_feed.o(.rodata); src/clear_save_data_screen.o(.rodata); data/intro_credits_graphics.o(.rodata); src/evolution_graphics.o(.rodata); diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c index db4670523..64e6a0bc3 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/battle_interface.c b/src/battle_interface.c index 95f1a1111..6a6bf00a2 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -177,7 +177,6 @@ extern const u16 gBattleInterface_BallDisplayPal[]; extern const u8 gHealthboxElementsGfxTable[][32]; // functions -extern void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor *color, s8 speed, const u8 *str); // menu.h extern void LoadBattleBarGfx(u8 arg0); // this file's functions diff --git a/src/berry_blender.c b/src/berry_blender.c index 57b158870..9aa80612c 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -134,8 +134,6 @@ extern u8 gInGameOpponentsNo; extern u8 gUnknown_020322D5; extern u8 gResultsWindowId; -extern const u8 * const gPokeblockNames[]; - // graphics extern const u8 gBerryBlenderArrowTiles[]; extern const u8 gBerryBlenderStartTiles[]; diff --git a/src/daycare.c b/src/daycare.c index ce9952531..59ee562bd 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 987e628c5..faef779b7 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -792,17 +792,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) @@ -871,7 +871,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(); } @@ -889,8 +889,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/lilycove_lady.c b/src/lilycove_lady.c index 18fbdd64c..927b87c72 100644 --- a/src/lilycove_lady.c +++ b/src/lilycove_lady.c @@ -943,7 +943,7 @@ static void sub_818E6B0(u8 sheen) } } -bool8 sub_818E704(struct Pokeblock *pokeblock) +bool8 GivePokeblockToContestLady(struct Pokeblock *pokeblock) { u8 sheen; bool8 response; @@ -1079,7 +1079,7 @@ void sub_818E914(void) void sub_818E92C(void) { - sub_81357FC(3, c2_exit_to_overworld_2_switch); + OpenPokeblockCase(3, c2_exit_to_overworld_2_switch); } void sub_818E940(void) 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 new file mode 100644 index 000000000..8716e827f --- /dev/null +++ b/src/pokeblock.c @@ -0,0 +1,1337 @@ +#include "global.h" +#include "pokeblock.h" +#include "bg.h" +#include "strings.h" +#include "text.h" +#include "menu.h" +#include "task.h" +#include "menu_helpers.h" +#include "new_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 "constants/items.h" +#include "string_util.h" +#include "songs.h" +#include "sound.h" +#include "berry.h" +#include "menu_indicators.h" +#include "event_data.h" +#include "battle_message.h" +#include "safari_zone.h" +#include "lilycove_lady.h" + +#define POKEBLOCK_MAX_FEEL 99 +#define FIELD_E75_COUNT 7 + +struct PokeblockMenuStruct +{ + u8 tilemap[0x800]; + void (*callbackOnUse)(void); + const u8 *pokeblockOptionsIds; + 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 unused[8]; +}; + +struct PokeblockSavedData +{ + void (*callback)(void); + u16 lastItemPos; + u16 lastItemPage; +}; + +enum +{ + PKBL_USE_ON_FIELD, + PKBL_TOSS, + PKBL_CANCEL, + PKBL_USE_IN_BATTLE, + PKBL_USE_ON_FEEDER, + 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 +static void CB2_InitPokeblockMenu(void); +static bool8 InitPokeblockMenu(void); +static bool8 LoadPokeblockMenuGfx(void); +static void HandleInitBackgrounds(void); +static void HandleInitWindows(void); +static void SetMenuItemsCountAndMaxShowed(void); +static void sub_81362E0(void); +static void sub_8136344(void); +static void HandlePokeblockListMenuItems(void); +static void sub_81363BC(void); +static void MovePokeblockMenuCursor(u32 pkblId, bool8 arg1, struct ListMenu *arg2); +static void PutPokeblockInfoText(void); +static void HandlePokeblockMenuCursor(u16 cursorPos, u16 arg1); +static void PutPokeblockListMenuString(u8 *dst, u16 pkblId); +static void Task_HandlePokeblockMenuInput(u8 taskId); +static void PokeblockAction_UseOnField(u8 taskId); +static void PokeblockAction_Toss(u8 taskId); +static void PokeblockAction_Cancel(u8 taskId); +static void PokeblockAction_UseInBattle(u8 taskId); +static void PokeblockAction_UseOnPokeblockFeeder(u8 taskId); +static void PokeblockAction_GiveToContestLady(u8 taskId); +static void TossPokeblockChoice_Yes(u8 taskId); +static void TossPokeblockChoice_No(u8 taskId); +static void Task_FreeDataAndExitPokeblockCase(u8 taskId); +static void Task_HandlePokeblockOptionsInput(u8 taskId); +static void PutPokeblockOptionsWindow(u8 taskId); +static void Task_HandlePokeblocksSwapInput(u8 taskId); +static void sub_8136470(struct Sprite *sprite); +static void sub_8135FCC(s32 pkblId); +static void HandlePokeblocksSwap(u8 taskId, bool8 noSwap); +static void UsePokeblockOnField(void); +static void ReturnToPokeblockCaseOnField(void); +static void CreateTossPokeblockYesNoMenu(u8 taskId); +static void HandleErasePokeblock(u8 taskId); + +// ram variables +EWRAM_DATA static struct PokeblockSavedData sSavedPokeblockData = {0}; +EWRAM_DATA static struct PokeblockMenuStruct *sPokeblockMenu = NULL; + +// const rom data +const s8 gPokeblockFlavorCompatibilityTable[] = +{ + // Cool, Beauty, Cute, Smart, Tough + 0, 0, 0, 0, 0, // Hardy + 1, 0, 0, 0, -1, // Lonely + 1, 0, -1, 0, 0, // Brave + 1, -1, 0, 0, 0, // Adamant + 1, 0, 0, -1, 0, // Naughty + -1, 0, 0, 0, 1, // Bold + 0, 0, 0, 0, 0, // Docile + 0, 0, -1, 0, 1, // Relaxed + 0, -1, 0, 0, 1, // Impish + 0, 0, 0, -1, 1, // Lax + -1, 0, 1, 0, 0, // Timid + 0, 0, 1, 0, -1, // Hasty + 0, 0, 0, 0, 0, // Serious + 0, -1, 1, 0, 0, // Jolly + 0, 0, 1, -1, 0, // Naive + -1, 1, 0, 0, 0, // Modest + 0, 1, 0, 0, -1, // Mild + 0, 1, -1, 0, 0, // Quiet + 0, 0, 0, 0, 0, // Bashful + 0, 1, 0, -1, 0, // Rash + -1, 0, 0, 1, 0, // Calm + 0, 0, 0, 1, -1, // Gentle + 0, 0, -1, 1, 0, // Sassy + 0, -1, 0, 1, 0, // Careful + 0, 0, 0, 0, 0 // Quirky +}; + +static const struct BgTemplate sBgTemplatesForPokeblockMenu[] = +{ + { + .bg = 0, + .charBaseIndex = 0, + .mapBaseIndex = 31, + .screenSize = 0, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, + { + .bg = 1, + .charBaseIndex = 0, + .mapBaseIndex = 30, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, + { + .bg = 2, + .charBaseIndex = 3, + .mapBaseIndex = 29, + .screenSize = 0, + .paletteMode = 0, + .priority = 2, + .baseTile = 0 + } +}; + +const u8 *const gPokeblockNames[] = +{ + NULL, + gText_RedPokeblock, + gText_BluePokeblock, + gText_PinkPokeblock, + gText_GreenPokeblock, + gText_YellowPokeblock, + gText_PurplePokeblock, + gText_IndigoPokeblock, + gText_BrownPokeblock, + gText_LiteBluePokeblock, + gText_OlivePokeblock, + gText_GrayPokeblock, + gText_BlackPokeblock, + gText_WhitePokeblock, + gText_GoldPokeblock +}; + +static const struct MenuAction sPokeblockMenuActions[] = +{ + {gMenuText_Use, PokeblockAction_UseOnField}, + {gMenuText_Toss, PokeblockAction_Toss}, + {gText_Cancel2, PokeblockAction_Cancel}, + {gMenuText_Use, PokeblockAction_UseInBattle}, + {gMenuText_Use, PokeblockAction_UseOnPokeblockFeeder}, + {gMenuText_Give2, PokeblockAction_GiveToContestLady}, +}; + +static const u8 sActionsOnField[] = {PKBL_USE_ON_FIELD, PKBL_TOSS, PKBL_CANCEL}; +static const u8 sActionsInBattle[] = {PKBL_USE_IN_BATTLE, PKBL_CANCEL}; +static const u8 sActionsOnPokeblockFeeder[] = {PKBL_USE_ON_FEEDER, PKBL_CANCEL}; +static const u8 sActionsWhenGivingToLady[] = {PKBL_GIVE_TO_LADY, PKBL_CANCEL}; + +static const struct YesNoFuncTable sTossYesNoFuncTable = {TossPokeblockChoice_Yes, TossPokeblockChoice_No}; + +static const u8 sContestStatsMonData[] = {MON_DATA_COOL, MON_DATA_BEAUTY, MON_DATA_CUTE, MON_DATA_SMART, MON_DATA_TOUGH}; + +static const struct OamData sOamData_PokeblockCase = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 2, + .paletteNum = 0, + .affineParam = 0, +}; + +static const union AnimCmd sSpriteAnim_PokeblockCase[] = +{ + ANIMCMD_FRAME(0, 0), + ANIMCMD_END +}; + +static const union AnimCmd *const sSpriteAnimTable_PokeblockCase[] = +{ + sSpriteAnim_PokeblockCase +}; + +static const union AffineAnimCmd sSpriteAffineAnim_85B26C8[] = +{ + AFFINEANIMCMD_FRAME(0, 0, -2, 2), + AFFINEANIMCMD_FRAME(0, 0, 2, 4), + AFFINEANIMCMD_FRAME(0, 0, -2, 4), + AFFINEANIMCMD_FRAME(0, 0, 2, 2), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd *const sSpriteAffineAnimTable_85B26F0[] = +{ + sSpriteAffineAnim_85B26C8 +}; + +const struct CompressedSpriteSheet gPokeblockCase_SpriteSheet = +{ + gMenuPokeblockDevice_Gfx, 0x800, GFX_TAG_POKEBLOCK_CASE +}; + +const struct CompressedSpritePalette gPokeblockCase_SpritePal = +{ + gMenuPokeblockDevice_Pal, GFX_TAG_POKEBLOCK_CASE +}; + +static const struct SpriteTemplate sSpriteTemplate_PokeblockCase = +{ + GFX_TAG_POKEBLOCK_CASE, + GFX_TAG_POKEBLOCK_CASE, + &sOamData_PokeblockCase, + sSpriteAnimTable_PokeblockCase, + NULL, + gDummySpriteAffineAnimTable, + SpriteCallbackDummy +}; + +static const struct TextColor sTextColorInPokeblockMenu = {0, 2, 3}; + +static const struct Pokeblock sFavoritePokeblocksTable[] = +{ + { PBLOCK_CLR_RED, 20, 0, 0, 0, 0, 20}, + { PBLOCK_CLR_BLUE, 0, 20, 0, 0, 0, 20}, + { PBLOCK_CLR_PINK, 0, 0, 20, 0, 0, 20}, + { 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 +}; + +static const struct WindowTemplate sTossPkblockWindowTemplate = {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->callbackOnUse = NULL; + sPokeblockMenu->unkTaskId = 0xFF; + sPokeblockMenu->isSwapping = FALSE; + sSavedPokeblockData.callback = callback; + + switch (sPokeblockMenu->caseId) + { + case PBLOCK_CASE_BATTLE: + sPokeblockMenu->pokeblockOptionsIds = sActionsInBattle; + sPokeblockMenu->optionsNo = ARRAY_COUNT(sActionsInBattle); + break; + case PBLOCK_CASE_FEEDER: + sPokeblockMenu->pokeblockOptionsIds = sActionsOnPokeblockFeeder; + sPokeblockMenu->optionsNo = ARRAY_COUNT(sActionsOnPokeblockFeeder); + break; + case PBLOCK_CASE_GIVE: + sPokeblockMenu->pokeblockOptionsIds = sActionsWhenGivingToLady; + sPokeblockMenu->optionsNo = ARRAY_COUNT(sActionsWhenGivingToLady); + break; + default: + sPokeblockMenu->pokeblockOptionsIds = 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(); +} + +static void CB2_InitPokeblockMenu(void) +{ + while (1) + { + if (sub_81221EC() == TRUE) + break; + if (InitPokeblockMenu() == TRUE) + break; + if (sub_81221AC() == TRUE) + break; + } +} + +static 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); +} + +static 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); + } +} + +static 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); +} + +static void HandlePokeblockMenuCursor(u16 cursorPos, u16 arg1) +{ + FillBgTilemapBufferRect_Palette0(2, arg1, 0xF, (cursorPos * 2) + 1, 0xE, 2); + schedule_bg_copy_tilemap_to_vram(2); +} + +static 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; + } + } + } +} + +static 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; +} + +static 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; +} + +static 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; + } +} + +static 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++); + } +} + +static void sub_81363BC(void) +{ + if (sPokeblockMenu->unkTaskId == 0xFF) + { + sPokeblockMenu->unkTaskId = AddScrollIndicatorArrowPairParametrized(2, 0xB0, 8, 0x98, sPokeblockMenu->itemsNo - sPokeblockMenu->maxShowed, + 0x456, 0x456, &sSavedPokeblockData.lastItemPage); + } +} + +static 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; + } +} + +static void FadePaletteAndSetTaskToClosePokeblockCase(u8 taskId) +{ + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gTasks[taskId].func = Task_FreeDataAndExitPokeblockCase; +} + +static 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->callbackOnUse != NULL) + SetMainCallback2(sPokeblockMenu->callbackOnUse); + else + SetMainCallback2(sSavedPokeblockData.callback); + + FreeAllWindowBuffers(); + Free(sPokeblockMenu); + DestroyTask(taskId); + } +} + +static 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; + } + } +} + +static 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; +} + +static void PutPokeblockOptionsWindow(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + if (sPokeblockMenu->optionsNo == 3) + data[1] = 8; + else + data[1] = 9; + + sub_8136418(); + SetWindowBorderStyle(data[1], 0, 1, 0xE); + sub_81995E4(data[1], sPokeblockMenu->optionsNo, sPokeblockMenuActions, sPokeblockMenu->pokeblockOptionsIds); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[1], sPokeblockMenu->optionsNo, 0); + PutWindowTilemap(data[1]); + schedule_bg_copy_tilemap_to_vram(1); + + gTasks[taskId].func = Task_HandlePokeblockOptionsInput; +} + +static void Task_HandlePokeblockOptionsInput(u8 taskId) +{ + s8 itemId; + + if (sub_81221EC() == TRUE) + return; + + itemId = ProcessMenuInputNoWrapAround(); + if (itemId == MENU_NOTHING_CHOSEN) + { + return; + } + else if (itemId == MENU_B_PRESSED) + { + PlaySE(SE_SELECT); + PokeblockAction_Cancel(taskId); + } + else + { + PlaySE(SE_SELECT); + sPokeblockMenuActions[sPokeblockMenu->pokeblockOptionsIds[itemId]].func.void_u8(taskId); + } +} + +static void PokeblockAction_UseOnField(u8 taskId) +{ + sPokeblockMenu->callbackOnUse = UsePokeblockOnField; + FadePaletteAndSetTaskToClosePokeblockCase(taskId); +} + +static void UsePokeblockOnField(void) +{ + ChooseMonToGivePokeblock(&gSaveBlock1Ptr->pokeblocks[gSpecialVar_ItemId], ReturnToPokeblockCaseOnField); +} + +static void ReturnToPokeblockCaseOnField(void) +{ + OpenPokeblockCase(PBLOCK_CASE_FIELD, sSavedPokeblockData.callback); +} + +static void PokeblockAction_Toss(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + sub_8198070(data[1], FALSE); + StringCopy(gStringVar1, gPokeblockNames[gSaveBlock1Ptr->pokeblocks[gSpecialVar_ItemId].color]); + StringExpandPlaceholders(gStringVar4, gText_ThrowAwayVar1); + DisplayMessageAndContinueTask(taskId, 10, 10, 13, 1, GetPlayerTextSpeed(), gStringVar4, CreateTossPokeblockYesNoMenu); +} + +static void CreateTossPokeblockYesNoMenu(u8 taskId) +{ + CreateYesNoMenuWithCallbacks(taskId, &sTossPkblockWindowTemplate, 1, 0, 2, 1, 0xE, &sTossYesNoFuncTable); +} + +static void TossPokeblockChoice_Yes(u8 taskId) +{ + StringExpandPlaceholders(gStringVar4, gText_Var1ThrownAway); + DisplayMessageAndContinueTask(taskId, 10, 10, 13, 1, GetPlayerTextSpeed(), gStringVar4, HandleErasePokeblock); +} + +static void HandleErasePokeblock(u8 taskId) +{ + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + s16 *data; + u16 *lastPage, *lastPos; + + TryClearPokeblock(gSpecialVar_ItemId); + PlaySE(SE_SELECT); + + lastPage = &sSavedPokeblockData.lastItemPage; + lastPos = &sSavedPokeblockData.lastItemPos; + data = gTasks[taskId].data; + + sub_81AE6C8(data[0], lastPage, lastPos); + HandlePokeblockMenuCursor(*lastPos, 5); + SetMenuItemsCountAndMaxShowed(); + sub_81362E0(); + HandlePokeblockListMenuItems(); + data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *lastPage, *lastPos); + HandlePokeblockMenuCursor(*lastPos, 0x1005); + schedule_bg_copy_tilemap_to_vram(0); + schedule_bg_copy_tilemap_to_vram(1); + TossPokeblockChoice_No(taskId); + } +} + +static void TossPokeblockChoice_No(u8 taskId) +{ + sub_8197DF8(10, FALSE); + schedule_bg_copy_tilemap_to_vram(1); + sub_81363BC(); + gTasks[taskId].func = Task_HandlePokeblockMenuInput; +} + +static void PokeblockAction_UseInBattle(u8 taskId) +{ + u8 nature = GetNature(&gEnemyParty[0]); + s16 gain = PokeblockGetGain(nature, &gSaveBlock1Ptr->pokeblocks[gSpecialVar_ItemId]); + StringCopy(gBattleTextBuff1, gPokeblockNames[gSaveBlock1Ptr->pokeblocks[gSpecialVar_ItemId].color]); + TryClearPokeblock(gSpecialVar_ItemId); + + gSpecialVar_ItemId = gSaveBlock1Ptr->pokeblocks[gSpecialVar_ItemId].color << 8; + if (gain == 0) + gSpecialVar_ItemId += 1; + else if (gain > 0) + gSpecialVar_ItemId += 2; + else + gSpecialVar_ItemId += 3; + + FadePaletteAndSetTaskToClosePokeblockCase(taskId); +} + +static void PokeblockAction_UseOnPokeblockFeeder(u8 taskId) +{ + SafariZoneActivatePokeblockFeeder(gSpecialVar_ItemId); + StringCopy(gStringVar1, gPokeblockNames[gSaveBlock1Ptr->pokeblocks[gSpecialVar_ItemId].color]); + gSpecialVar_Result = gSpecialVar_ItemId; + TryClearPokeblock(gSpecialVar_ItemId); + gSpecialVar_ItemId = 0; + FadePaletteAndSetTaskToClosePokeblockCase(taskId); +} + +static void PokeblockAction_GiveToContestLady(u8 taskId) +{ + gSpecialVar_0x8004 = GivePokeblockToContestLady(&gSaveBlock1Ptr->pokeblocks[gSpecialVar_ItemId]); + gSpecialVar_Result = gSpecialVar_ItemId; + TryClearPokeblock(gSpecialVar_ItemId); + gSpecialVar_ItemId = 0; + FadePaletteAndSetTaskToClosePokeblockCase(taskId); +} + +static void PokeblockAction_Cancel(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + sub_8198070(data[1], FALSE); + schedule_bg_copy_tilemap_to_vram(1); + sub_81363BC(); + gTasks[taskId].func = Task_HandlePokeblockMenuInput; +} + +static void ClearPokeblock(u8 pkblId) +{ + gSaveBlock1Ptr->pokeblocks[pkblId].color = 0; + gSaveBlock1Ptr->pokeblocks[pkblId].spicy = 0; + gSaveBlock1Ptr->pokeblocks[pkblId].dry = 0; + gSaveBlock1Ptr->pokeblocks[pkblId].sweet = 0; + gSaveBlock1Ptr->pokeblocks[pkblId].bitter = 0; + gSaveBlock1Ptr->pokeblocks[pkblId].sour = 0; + gSaveBlock1Ptr->pokeblocks[pkblId].feel = 0; +} + +void ClearPokeblocks(void) +{ + u8 i; + + for (i = 0; i < POKEBLOCKS_COUNT; i++) + ClearPokeblock(i); +} + +u8 GetHighestPokeblocksFlavorLevel(const struct Pokeblock *pokeblock) +{ + u8 i; + u8 maxFlavor = GetPokeblockData(pokeblock, PBLOCK_SPICY); + + for (i = PBLOCK_SPICY; i < FLAVOR_COUNT; i++) + { + u8 currFlavor = GetPokeblockData(pokeblock, PBLOCK_SPICY + i); + if (maxFlavor < currFlavor) + maxFlavor = currFlavor; + } + + return maxFlavor; +} + +u8 GetPokeblocksFeel(const struct Pokeblock *pokeblock) +{ + u8 feel = GetPokeblockData(pokeblock, PBLOCK_FEEL); + if (feel > POKEBLOCK_MAX_FEEL) + feel = POKEBLOCK_MAX_FEEL; + + return feel; +} + +s8 GetFirstFreePokeblockSlot(void) +{ + u8 i; + + for (i = 0; i < POKEBLOCKS_COUNT; i++) + { + if (gSaveBlock1Ptr->pokeblocks[i].color == 0) + return i; + } + + return -1; +} + +bool32 AddPokeblock(const struct Pokeblock *pokeblock) +{ + s8 slot = GetFirstFreePokeblockSlot(); + + if (slot == -1) + { + return FALSE; + } + else + { + gSaveBlock1Ptr->pokeblocks[slot] = *pokeblock; + return TRUE; + } +} + +bool32 TryClearPokeblock(u8 pkblId) +{ + if (gSaveBlock1Ptr->pokeblocks[pkblId].color == 0) + { + return FALSE; + } + else + { + ClearPokeblock(pkblId); + return TRUE; + } +} + +s16 GetPokeblockData(const struct Pokeblock *pokeblock, u8 field) +{ + if (field == PBLOCK_COLOR) + return pokeblock->color; + if (field == PBLOCK_SPICY) + return pokeblock->spicy; + if (field == PBLOCK_DRY) + return pokeblock->dry; + if (field == PBLOCK_SWEET) + return pokeblock->sweet; + if (field == PBLOCK_BITTER) + return pokeblock->bitter; + if (field == PBLOCK_SOUR) + return pokeblock->sour; + if (field == PBLOCK_FEEL) + return pokeblock->feel; + + return 0; +} + +s16 PokeblockGetGain(u8 nature, const struct Pokeblock *pokeblock) +{ + u8 flavor; + s16 curGain, totalGain = 0; + + for (flavor = 0; flavor < FLAVOR_COUNT; flavor++) + { + curGain = GetPokeblockData(pokeblock, flavor + PBLOCK_SPICY); + if (curGain > 0) + totalGain += curGain * gPokeblockFlavorCompatibilityTable[5 * nature + flavor]; + } + + return totalGain; +} + +void PokeblockCopyName(const struct Pokeblock *pokeblock, u8 *dest) +{ + u8 color = GetPokeblockData(pokeblock, PBLOCK_COLOR); + StringCopy(dest, gPokeblockNames[color]); +} + +bool8 CopyMonFavoritePokeblockName(u8 nature, u8 *dest) +{ + u8 i; + + for (i = 0; i < FLAVOR_COUNT; i++) + { + if (PokeblockGetGain(nature, &sFavoritePokeblocksTable[i]) > 0) + { + StringCopy(dest, gPokeblockNames[i + 1]); + return TRUE; + } + } + + return FALSE; +} + +u8 GetPokeblocksFlavor(const struct Pokeblock *pokeblock) +{ + s16 bestFlavor = 0; + s16 i; + + for (i = 0; i < FLAVOR_COUNT; i++) + { + if (GetPokeblockData(pokeblock, bestFlavor + 1) < GetPokeblockData(pokeblock, i + 1)) + bestFlavor = i; + } + + return bestFlavor; +} diff --git a/src/pokeblock_feed.c b/src/pokeblock_feed.c new file mode 100644 index 000000000..1bf40bbe5 --- /dev/null +++ b/src/pokeblock_feed.c @@ -0,0 +1,1108 @@ +#include "global.h" +#include "pokeblock.h" +#include "sprite.h" +#include "task.h" +#include "palette.h" +#include "menu.h" +#include "malloc.h" +#include "pokemon.h" +#include "blend_palette.h" +#include "main.h" +#include "menu_helpers.h" +#include "bg.h" +#include "gpu_regs.h" +#include "data2.h" +#include "decompress.h" +#include "event_data.h" +#include "strings.h" +#include "string_util.h" +#include "new_menu_helpers.h" +#include "party_menu.h" +#include "m4a.h" +#include "sound.h" +#include "trig.h" +#include "graphics.h" +#include "battle.h" // to get rid of once gMonSpritesGfxPtr is put elsewhere + +struct PokeblockFeedStruct +{ + struct Sprite *monSpritePtr; + struct Sprite savedMonSprite; + u8 tilemapBuffer[0x808]; + s16 field_850[0x200]; + s16 field_C50[0x200]; + u8 field_1050; + u8 animId; + u8 field_1052; + bool8 noMonFlip; + u16 species; + u16 field_1056; + u16 field_1058; + u8 nature; + u8 monSpriteId_; + u8 field_105C; + u8 monSpriteId; + u8 pokeblockCaseSpriteId; + u8 pokeblockSpriteId; + s16 field_1060[15]; + s16 loadGfxState; + u8 unused; +}; + +extern u16 gSpecialVar_ItemId; +extern struct MusicPlayerInfo gMPlay_BGM; +extern struct SpriteTemplate gUnknown_0202499C; + +extern const u8 gBattleTerrainPalette_Frontier[]; +extern const u8 gBattleTerrainTiles_Building[]; +extern const u8 gUnknown_08D9BA44[]; +extern const struct CompressedSpriteSheet gMonFrontPicTable[]; +extern const u16 gUnknown_0860F074[]; + +extern bool8 sub_81221EC(void); +extern void sub_806A068(u16, u8); +extern void sub_809882C(u8, u16, u8); + +// this file's functions +static void HandleInitBackgrounds(void); +static void HandleInitWindows(void); +static void LaunchPokeblockFeedTask(void); +static void SetPokeblockSpritePal(u8 pokeblockCaseId); +static void sub_817A5CC(void); +static void sub_8148108(u8 spriteId, bool8 a1); +static void DoPokeblockCaseThrowEffect(u8 spriteId, bool8 arg1); +static void PrepareMonToMoveToPokeblock(u8 spriteId); +static void Task_HandleMonAtePokeblock(u8 taskId); +static void Task_PaletteFadeToReturn(u8 taskId); +static void sub_817A634(void); +static void sub_817A468(struct Sprite *sprite); +static void sub_817AB68(void); +static void sub_817AA54(void); +static bool8 sub_817A91C(void); +static bool8 FreeMonSpriteOamMatrix(void); +static bool8 sub_817A9E4(void); +static bool8 LoadMonAndSceneGfx(struct Pokemon *mon); +static u8 CreatePokeblockSprite(void); +static u8 CreatePokeblockCaseSpriteForFeeding(void); +static u8 CreateMonSprite(struct Pokemon *mon); +static void SpriteCB_ThrownPokeblock(struct Sprite* sprite); + +// ram variables +EWRAM_DATA static struct PokeblockFeedStruct *sPokeblockFeed = NULL; +EWRAM_DATA static struct CompressedSpritePalette sPokeblockSpritePal = {0}; + +// const rom data +static const u8 sNatureToMonPokeblockAnim[][2] = +{ + { 0, 0 }, // HARDY + { 3, 0 }, // LONELY + { 4, 1 }, // BRAVE + { 5, 0 }, // ADAMANT + { 10, 0 }, // NAUGHTY + { 13, 0 }, // BOLD + { 15, 0 }, // DOCILE + { 16, 2 }, // RELAXED + { 18, 0 }, // IMPISH + { 19, 0 }, // LAX + { 20, 0 }, // TIMID + { 25, 0 }, // HASTY + { 27, 3 }, // SERIOUS + { 28, 0 }, // JOLLY + { 29, 0 }, // NAIVE + { 33, 4 }, // MODEST + { 36, 0 }, // MILD + { 37, 0 }, // QUIET + { 39, 0 }, // BASHFUL + { 42, 0 }, // RASH + { 45, 0 }, // CALM + { 46, 5 }, // GENTLE + { 47, 6 }, // SASSY + { 48, 0 }, // CAREFUL + { 53, 0 }, // QUIRKY +}; + +static const s16 sMonPokeblockAnims[][10] = +{ + // HARDY + { 0, 4, 0, 8, 24, 0, 0, 0, 12, 0}, + { 0, 4, 0, 16, 24, 0, 0, 0, 12, 0}, + { 0, 4, 0, 32, 32, 0, 0, 0, 16, 1}, + + // LONELY + { 0, 3, 6, 0, 48, 0, 0, 0, 24, 1}, + + // BRAVE + { 64, 16, -24, 0, 32, 0, 0, 0, 0, 1}, + + // ADAMANT + { 0, 4, 8, 0, 16, 0, -8, 0, 0, 0}, + { 0, 0, 0, 0, 16, 0, 0, 0, 0, 0}, + { 0, 4, 8, 0, 16, 0, -8, 0, 0, 0}, + { 0, 0, 0, 0, 16, 0, 0, 0, 0, 0}, + { 0, 4, -16, 0, 4, 0, 16, 0, 0, 1}, + + // NAUGHTY + { 0, 3, 6, 0, 12, 0, 0, 0, 6, 0}, + { 0, 3, -6, 0, 12, 0, 0, 0, 6, 0}, + { 0, 16, 16, 0, 45, 1, 0, 0, 0, 1}, + + // BOLD + { 0, 16, 0, 24, 32, 0, 0, 0, 16, 0}, + { 0, 16, 0, 23, 32, 0, 0, 0, 16, 1}, + + // DOCILE + { 0, 0, 0, 0, 80, 0, 0, 0, 0, 1}, + + // RELAXED + { 0, 2, 8, 0, 32, 0, 0, 0, 0, 0}, + { 0, 2, -8, 0, 32, 0, 0, 0, 0, 1}, + + // IMPISH + { 0, 32, 2, 1, 48, 1, 0, 0, 24, 1}, + + // LAX + { 0, 2, 16, 16, 128, 0, 0, 0, 0, 1}, + + // TIMID + { 0, 2, -8, 0, 48, 0, -24, 0, 0, 0}, + { 0, 0, 0, 0, 8, 0, 0, 0, 0, 0}, + { 64, 32, 2, 0, 36, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 8, 0, 0, 0, 0, 0}, + { 0, 2, 8, 0, 48, 0, 24, 0, 0, 1}, + + // HASTY + { 64, 24, 16, 0, 32, 0, 0, 0, 0, 0}, + { 0, 28, 2, 1, 32, 1, 0, 0, 16, 1}, + + // SERIOUS + { 0, 0, 0, 0, 32, 0, 0, 0, 0, 1}, + + // JOLLY + { 64, 16, -16, 2, 48, 0, 0, 0, 32, 1}, + + // NAIVE + { 0, 12, -8, 4, 24, 0, 8, 0, 12, 0}, + { 0, 12, 8, 8, 24, 0, -16, 0, 12, 0}, + { 0, 12, -8, 16, 24, 0, 16, 0, 12, 0}, + { 0, 12, 8, 28, 24, 0, -8, 0, 12, 1}, + + // MODEST + { 0, 0, 0, 0, 8, 0, 0, 0, 0, 0}, + { 64, 16, -4, 0, 32, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 8, 0, 0, 0, 0, 1}, + + // MILD + { 128, 4, 0, 8, 64, 0, 0, 0, 0, 1}, + + // QUIET + { 0, 2, 16, 0, 48, 0, 0, 0, 0, 0}, + { 128, 2, 16, 0, 48, 0, 0, 0, 0, 1}, + + // BASHFUL + { 0, 2, -4, 0, 48, 0, -48, 0, 0, 0}, + { 0, 0, 0, 0, 80, 0, 0, 0, 0, 0}, + { 0, 2, 8, 0, 24, 0, 48, 0, 0, 1}, + + // RASH + { 64, 4, 64, 58, 52, 0, -88, 0, 0, 0}, + { 0, 0, 0, 0, 80, 0, 0, 0, 0, 0}, + { 0, 24, 80, 0, 32, 0, 88, 0, 0, 1}, + + // CALM + { 0, 2, 16, 4, 64, 0, 0, 0, 0, 1}, + + // GENTLE + { 0, 0, 0, 0, 32, 0, 0, 0, 0, 1}, + + // SASSY + { 0, 0, 0, 0, 42, 0, 0, 0, 0, 1}, + + // CAREFUL + { 0, 4, 0, 8, 24, 0, 0, 0, 12, 0}, + { 0, 0, 0, 0, 12, 0, 0, 0, 0, 0}, + { 0, 4, 0, 12, 24, 0, 0, 0, 12, 0}, + { 0, 0, 0, 0, 12, 0, 0, 0, 0, 0}, + { 0, 4, 0, 4, 24, 0, 0, 0, 12, 1}, + + // QUIRKY + { 0, 4, 16, 12, 64, 0, 0, 0, 0, 0}, + { 0, -4, 16, 12, 64, 0, 0, 0, 0, 1}, +}; + +static const union AffineAnimCmd sSpriteAffineAnim_8411E90[] = +{ + AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_8411EA0[] = +{ + AFFINEANIMCMD_FRAME(0, 0, 12, 1), + AFFINEANIMCMD_FRAME(0, 0, 0, 30), + AFFINEANIMCMD_FRAME(0, 0, -12, 1), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_8411EC0[] = +{ + AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(0, 0, 12, 1), + AFFINEANIMCMD_FRAME(0, 0, 0, 28), + AFFINEANIMCMD_FRAME(0, 0, -4, 3), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_8411EE8[] = +{ + AFFINEANIMCMD_FRAME(0x0, 0x0, 1, 16), + AFFINEANIMCMD_FRAME(0x0, 0x0, -1, 32), + AFFINEANIMCMD_FRAME(0x0, 0x0, 1, 16), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_8411F08[] = +{ + AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(0x0, 0x0, 1, 16), + AFFINEANIMCMD_FRAME(0x0, 0x0, -1, 32), + AFFINEANIMCMD_FRAME(0x0, 0x0, 1, 16), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_8411F30[] = +{ + AFFINEANIMCMD_FRAME(0x0, 0x0, -1, 8), + AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 16), + AFFINEANIMCMD_FRAME(0x0, 0x0, 1, 8), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_8411F50[] = +{ + AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(0x0, 0x0, -1, 8), + AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 16), + AFFINEANIMCMD_FRAME(0x0, 0x0, 1, 8), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_8411F78[] = +{ + AFFINEANIMCMD_FRAME(0x0, 0x0, -1, 8), + AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 32), + AFFINEANIMCMD_FRAME(0x0, 0x0, 1, 8), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_8411F98[] = +{ + AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(0x0, 0x0, -1, 8), + AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 32), + AFFINEANIMCMD_FRAME(0x0, 0x0, 1, 8), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_8411FC0[] = +{ + AFFINEANIMCMD_FRAME(0x0, 0x0, -1, 4), + AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 24), + AFFINEANIMCMD_FRAME(0x0, 0x0, 1, 4), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_8411FE0[] = +{ + AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(0x0, 0x0, -1, 4), + AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 24), + AFFINEANIMCMD_FRAME(0x0, 0x0, 1, 4), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_8412008[] = +{ + AFFINEANIMCMD_FRAME(0x0, 0x0, 1, 24), + AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 16), + AFFINEANIMCMD_FRAME(0x0, 0x0, -12, 2), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_8412028[] = +{ + AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(0x0, 0x0, 1, 24), + AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 16), + AFFINEANIMCMD_FRAME(0x0, 0x0, -12, 2), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd *const sSpriteAffineAnimTable_85F04FC[] = +{ + sSpriteAffineAnim_8411E90, + sSpriteAffineAnim_8411EA0, + sSpriteAffineAnim_8411EE8, + sSpriteAffineAnim_8411F30, + sSpriteAffineAnim_8411F78, + sSpriteAffineAnim_8411FC0, + sSpriteAffineAnim_8412008, + sSpriteAffineAnim_8411E90, + sSpriteAffineAnim_8411E90, + sSpriteAffineAnim_8411E90, + sSpriteAffineAnim_8411E90, + sSpriteAffineAnim_8411EC0, + sSpriteAffineAnim_8411F08, + sSpriteAffineAnim_8411F50, + sSpriteAffineAnim_8411F98, + sSpriteAffineAnim_8411FE0, + sSpriteAffineAnim_8412028, + sSpriteAffineAnim_8411E90, + sSpriteAffineAnim_8411E90, + sSpriteAffineAnim_8411E90, + sSpriteAffineAnim_8411E90, +}; + +static const struct BgTemplate sBackgroundTemplates[] = +{ + { + .bg = 0, + .charBaseIndex = 0, + .mapBaseIndex = 31, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, + { + .bg = 1, + .charBaseIndex = 2, + .mapBaseIndex = 30, + .screenSize = 0, + .paletteMode = 0, + .priority = 3, + .baseTile = 0 + } +}; + +static const struct WindowTemplate sWindowTemplates[] = +{ + {0, 1, 0xF, 0x1C, 4, 0xF, 0xA}, + DUMMY_WIN_TEMPLATE +}; + +static const u8* const sPokeblocksPals[] = +{ + gPokeblockRed_Pal, + gPokeblockBlue_Pal, + gPokeblockPink_Pal, + gPokeblockGreen_Pal, + gPokeblockYellow_Pal, + gPokeblockPurple_Pal, + gPokeblockIndigo_Pal, + gPokeblockBrown_Pal, + gPokeblockLiteBlue_Pal, + gPokeblockOlive_Pal, + gPokeblockGray_Pal, + gPokeblockBlack_Pal, + gPokeblockWhite_Pal, + gPokeblockGold_Pal +}; + +static const union AffineAnimCmd sSpriteAffineAnim_84120DC[] = +{ + AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd *const sSpriteAffineAnimTable_MonNoFlip[] = +{ + sSpriteAffineAnim_84120DC +}; + +static const union AffineAnimCmd sSpriteAffineAnim_84120F0[] = +{ + AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(0x0, 0x0, -8, 1), + AFFINEANIMCMD_FRAME(0x0, 0x0, -8, 1), + AFFINEANIMCMD_FRAME(0x0, 0x0, -8, 1), + AFFINEANIMCMD_FRAME(0x0, 0x0, -8, 1), + AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 8), + AFFINEANIMCMD_FRAME(0x0, 0x0, 16, 1), + AFFINEANIMCMD_FRAME(0x0, 0x0, 16, 1), + AFFINEANIMCMD_FRAME(0x0, 0x0, 16, 1), + AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_8412148[] = +{ + AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(0x0, 0x0, 8, 1), + AFFINEANIMCMD_FRAME(0x0, 0x0, 8, 1), + AFFINEANIMCMD_FRAME(0x0, 0x0, 8, 1), + AFFINEANIMCMD_FRAME(0x0, 0x0, 8, 1), + AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 8), + AFFINEANIMCMD_FRAME(0x0, 0x0, -16, 1), + AFFINEANIMCMD_FRAME(0x0, 0x0, -16, 1), + AFFINEANIMCMD_FRAME(0x0, 0x0, -16, 1), + AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd *const sSpriteAffineAnimTable_85F0664[] = +{ + sSpriteAffineAnim_84120DC +}; + +static const union AffineAnimCmd *const sSpriteAffineAnimTable_85F0668[] = +{ + sSpriteAffineAnim_84120F0 +}; + +static const union AffineAnimCmd *const sSpriteAffineAnimTable_85F066C[] = +{ + sSpriteAffineAnim_8412148 +}; + +static const struct OamData sThrownPokeblockOamData = +{ + .y = 0, + .affineMode = 3, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 0, + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0, +}; + +static const union AnimCmd sThrownPokeblockSpriteAnim[] = +{ + ANIMCMD_FRAME(0, 0), + ANIMCMD_END +}; + +static const union AnimCmd *const sThrownPokeblockAnimTable[] = +{ + sThrownPokeblockSpriteAnim, +}; + +static const union AffineAnimCmd sSpriteAffineAnim_84121C0[] = +{ + AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(-8, -8, 0, 1), + AFFINEANIMCMD_JUMP(1) +}; + +static const union AffineAnimCmd *const sThrownPokeblockAffineAnimTable[] = +{ + sSpriteAffineAnim_84121C0 +}; + +static const struct CompressedSpriteSheet sPokeblock_SpriteSheet = +{ + gPokeblock_Gfx, 0x20, GFX_TAG_POKEBLOCK +}; + +static const struct SpriteTemplate sThrownPokeblockSpriteTemplate = +{ + .tileTag = GFX_TAG_POKEBLOCK, + .paletteTag = GFX_TAG_POKEBLOCK, + .oam = &sThrownPokeblockOamData, + .anims = sThrownPokeblockAnimTable, + .images = NULL, + .affineAnims = sThrownPokeblockAffineAnimTable, + .callback = SpriteCB_ThrownPokeblock +}; + +// code +static void CB2_PokeblockFeed(void) +{ + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + do_scheduled_bg_tilemap_copies_to_vram(); + UpdatePaletteFade(); +} + +static void VBlankCB_PokeblockFeed(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +static bool8 TransitionToPokeblockFeedScene(void) +{ + switch (gMain.state) + { + case 0: + sPokeblockFeed = AllocZeroed(sizeof(*sPokeblockFeed)); + SetVBlankHBlankCallbacksToNull(); + clear_scheduled_bg_copies_to_vram(); + gMain.state++; + break; + case 1: + ResetPaletteFade(); + gPaletteFade.bufferTransferDisabled = 1; + gMain.state++; + break; + case 2: + ResetSpriteData(); + gMain.state++; + break; + case 3: + FreeAllSpritePalettes(); + gMain.state++; + break; + case 4: + AllocateMonSpritesGfx(); + gMain.state++; + break; + case 5: + HandleInitBackgrounds(); + gMain.state++; + break; + case 6: + HandleInitWindows(); + gMain.state++; + break; + case 7: + if (LoadMonAndSceneGfx(&gPlayerParty[gPokeblockMonId])) + { + gMain.state++; + } + break; + case 8: + sPokeblockFeed->pokeblockCaseSpriteId = CreatePokeblockCaseSpriteForFeeding(); + gMain.state++; + break; + case 9: + sPokeblockFeed->monSpriteId = CreateMonSprite(&gPlayerParty[gPokeblockMonId]); + gMain.state++; + break; + case 10: + SetWindowBorderStyle(0, 1, 1, 14); + gMain.state++; + break; + case 11: + LaunchPokeblockFeedTask(); + gMain.state++; + break; + case 12: + BlendPalettes(-1, 0x10, 0); + gMain.state++; + break; + case 13: + BeginNormalPaletteFade(-1, 0, 0x10, 0, 0); + gPaletteFade.bufferTransferDisabled = 0; + gMain.state++; + break; + default: + SetVBlankCallback(VBlankCB_PokeblockFeed); + SetMainCallback2(CB2_PokeblockFeed); + return TRUE; + } + return FALSE; +} + +void CB2_PreparePokeblockFeedScene(void) +{ + while (1) + { + if (sub_81221EC() == TRUE) + break; + if (TransitionToPokeblockFeedScene() == TRUE) + break; + if (sub_81221AC() == TRUE) + break; + } +} + +static void HandleInitBackgrounds(void) +{ + ResetVramOamAndBgCntRegs(); + + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, sBackgroundTemplates, ARRAY_COUNT(sBackgroundTemplates)); + SetBgTilemapBuffer(1, sPokeblockFeed->tilemapBuffer); + ResetAllBgsCoordinates(); + schedule_bg_copy_tilemap_to_vram(1); + + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); + + ShowBg(0); + ShowBg(1); + + SetGpuReg(REG_OFFSET_BLDCNT, 0); +} + +static bool8 LoadMonAndSceneGfx(struct Pokemon *mon) +{ + u16 species; + u32 personality, trainerId; + const struct CompressedSpritePalette *palette; + + switch (sPokeblockFeed->loadGfxState) + { + case 0: + species = GetMonData(mon, MON_DATA_SPECIES2); + personality = GetMonData(mon, MON_DATA_PERSONALITY); + HandleLoadSpecialPokePic_2(&gMonFrontPicTable[species], gMonSpritesGfxPtr->sprites[1], species, personality); + sPokeblockFeed->loadGfxState++; + break; + case 1: + species = GetMonData(mon, MON_DATA_SPECIES2); + personality = GetMonData(mon, MON_DATA_PERSONALITY); + trainerId = GetMonData(mon, MON_DATA_OT_ID); + palette = GetMonSpritePalStructFromOtIdPersonality(species, trainerId, personality); + + LoadCompressedObjectPalette(palette); + sub_806A068(palette->tag, 1); + sPokeblockFeed->loadGfxState++; + break; + case 2: + LoadCompressedObjectPic(&gPokeblockCase_SpriteSheet); + sPokeblockFeed->loadGfxState++; + break; + case 3: + LoadCompressedObjectPalette(&gPokeblockCase_SpritePal); + sPokeblockFeed->loadGfxState++; + break; + case 4: + LoadCompressedObjectPic(&sPokeblock_SpriteSheet); + sPokeblockFeed->loadGfxState++; + break; + case 5: + SetPokeblockSpritePal(gSpecialVar_ItemId); + LoadCompressedObjectPalette(&sPokeblockSpritePal); + sPokeblockFeed->loadGfxState++; + break; + case 6: + reset_temp_tile_data_buffers(); + decompress_and_copy_tile_data_to_vram(1, gBattleTerrainTiles_Building, 0, 0, 0); + sPokeblockFeed->loadGfxState++; + break; + case 7: + if (free_temp_tile_data_buffers_if_possible() != TRUE) + { + LZDecompressWram(gUnknown_08D9BA44, sPokeblockFeed->tilemapBuffer); + sPokeblockFeed->loadGfxState++; + } + break; + case 8: + LoadCompressedPalette(gBattleTerrainPalette_Frontier, 0x20, 0x60); + sPokeblockFeed->loadGfxState = 0; + return TRUE; + } + + return FALSE; +} + +static void HandleInitWindows(void) +{ + InitWindows(sWindowTemplates); + DeactivateAllTextPrinters(); + sub_809882C(0, 1, 0xE0); + LoadPalette(gUnknown_0860F074, 0xF0, 0x20); + FillWindowPixelBuffer(0, 0); + PutWindowTilemap(0); + schedule_bg_copy_tilemap_to_vram(0); +} + +static void SetPokeblockSpritePal(u8 pokeblockCaseId) +{ + u8 colorId = GetPokeblockData(&gSaveBlock1Ptr->pokeblocks[pokeblockCaseId], PBLOCK_COLOR); + sPokeblockSpritePal.data = sPokeblocksPals[colorId - 1]; + sPokeblockSpritePal.tag = GFX_TAG_POKEBLOCK; +} + +// defines for task data fields + +#define tFrames data[0] +#define tData1 data[1] + +static void Task_HandlePokeblockFeed(u8 taskId) +{ + if (!gPaletteFade.active) + { + switch (gTasks[taskId].tFrames) + { + case 0: + sPokeblockFeed->field_1050 = 0; + sPokeblockFeed->field_1058 = 0; + sub_817A5CC(); + break; + case 255: + DoPokeblockCaseThrowEffect(sPokeblockFeed->pokeblockCaseSpriteId, gTasks[taskId].tData1); + break; + case 269: + sPokeblockFeed->pokeblockSpriteId = CreatePokeblockSprite(); + break; + case 281: + PrepareMonToMoveToPokeblock(sPokeblockFeed->monSpriteId); + break; + case 297: + gTasks[taskId].func = Task_HandleMonAtePokeblock; + return; + } + + if (sPokeblockFeed->field_1058 < sPokeblockFeed->field_1056) + sub_817A634(); + else if (sPokeblockFeed->field_1058 == sPokeblockFeed->field_1056) + gTasks[taskId].tFrames = 254; + + sPokeblockFeed->field_1058++; + gTasks[taskId].tFrames++; + } +} + +static void LaunchPokeblockFeedTask(void) +{ + u8 taskId = CreateTask(Task_HandlePokeblockFeed, 0); + gTasks[taskId].tFrames = 0; + gTasks[taskId].tData1 = 1; +} + +static void Task_WaitForAtePokeblockText(u8 taskId) +{ + if (RunTextPrintersRetIsActive(0) != TRUE) + gTasks[taskId].func = Task_PaletteFadeToReturn; +} + +static void Task_HandleMonAtePokeblock(u8 taskId) +{ + struct Pokemon *mon = &gPlayerParty[gPokeblockMonId]; + struct Pokeblock *pokeblock = &gSaveBlock1Ptr->pokeblocks[gSpecialVar_ItemId]; + + gPokeblockGain = PokeblockGetGain(GetNature(mon), pokeblock); + GetMonNickname(mon, gStringVar1); + PokeblockCopyName(pokeblock, gStringVar2); + + if (gPokeblockGain == 0) + StringExpandPlaceholders(gStringVar4, gText_Var1AteTheVar2); + else if (gPokeblockGain > 0) + StringExpandPlaceholders(gStringVar4, gText_Var1HappilyAteVar2); + else + StringExpandPlaceholders(gStringVar4, gText_Var1DisdainfullyAteVar2); + + gTextFlags.flag_0 = 1; + AddTextPrinterParametrized(0, 1, gStringVar4, GetPlayerTextSpeed(), NULL, 2, 1, 3); + gTasks[taskId].func = Task_WaitForAtePokeblockText; +} + +static void Task_ReturnAfterPaletteFade(u8 taskId) +{ + if (!gPaletteFade.active) + { + ResetSpriteData(); + FreeAllSpritePalettes(); + m4aMPlayVolumeControl(&gMPlay_BGM, -1, 0x100); + SetMainCallback2(gMain.savedCallback); + DestroyTask(taskId); + FreeAllWindowBuffers(); + Free(sPokeblockFeed); + FreeMonSpritesGfx(); + } +} + +static void Task_PaletteFadeToReturn(u8 taskId) +{ + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gTasks[taskId].func = Task_ReturnAfterPaletteFade; +} + +#undef tFrames +#undef tData1 + +// defines for mon sprite data fields + +#define tDelta data[0] +#define tDeltaMod data[1] +#define tSpecies data[2] + +static u8 CreateMonSprite(struct Pokemon* mon) +{ + u16 species = GetMonData(mon, MON_DATA_SPECIES2); + u8 spriteId = CreateSprite(&gUnknown_0202499C, 48, 80, 2); + + sPokeblockFeed->species = species; + sPokeblockFeed->monSpriteId_ = spriteId; + sPokeblockFeed->nature = GetNature(mon); + gSprites[spriteId].tSpecies = species; + gSprites[spriteId].callback = SpriteCallbackDummy; + + sPokeblockFeed->noMonFlip = TRUE; + if (!IsPokeSpriteNotFlipped(species)) + { + gSprites[spriteId].affineAnims = sSpriteAffineAnimTable_MonNoFlip; + gSprites[spriteId].oam.affineMode = 3; + CalcCenterToCornerVec(&gSprites[spriteId], gSprites[spriteId].oam.shape, gSprites[spriteId].oam.size, gSprites[spriteId].oam.affineMode); + sPokeblockFeed->noMonFlip = FALSE; + } + + return spriteId; +} + +static void PrepareMonToMoveToPokeblock(u8 spriteId) +{ + gSprites[spriteId].pos1.x = 48; + gSprites[spriteId].pos1.y = 80; + gSprites[spriteId].tDelta = -8; + gSprites[spriteId].tDeltaMod = 1; + gSprites[spriteId].callback = sub_817A468; +} + +static void sub_817A468(struct Sprite* sprite) +{ + sprite->pos1.x += 4; + sprite->pos1.y += sprite->tDelta; + sprite->tDelta += sprite->tDeltaMod; + + if (sprite->tDelta == 0) + PlayCry1(sprite->tSpecies, 0); + if (sprite->tDelta == 9) + sprite->callback = SpriteCallbackDummy; +} + +#undef tDelta +#undef tDeltaMod +#undef tSpecies + +static u8 CreatePokeblockCaseSpriteForFeeding(void) +{ + u8 spriteId = CreatePokeblockCaseSprite(188, 100, 2); + gSprites[spriteId].oam.affineMode = 1; + gSprites[spriteId].affineAnims = sSpriteAffineAnimTable_85F0664; + gSprites[spriteId].callback = SpriteCallbackDummy; + InitSpriteAffineAnim(&gSprites[spriteId]); + return spriteId; +} + +static void DoPokeblockCaseThrowEffect(u8 spriteId, bool8 a1) +{ + FreeOamMatrix(gSprites[spriteId].oam.matrixNum); + gSprites[spriteId].oam.affineMode = 3; + + if (!a1) + gSprites[spriteId].affineAnims = sSpriteAffineAnimTable_85F0668; + else + gSprites[spriteId].affineAnims = sSpriteAffineAnimTable_85F066C; + + InitSpriteAffineAnim(&gSprites[spriteId]); +} + +// defines for the pokeblock sprite data fields +#define tDelta data[0] +#define tDeltaMod data[1] + +static u8 CreatePokeblockSprite(void) +{ + u8 spriteId = CreateSprite(&sThrownPokeblockSpriteTemplate, 174, 84, 1); + gSprites[spriteId].tDelta = -12; + gSprites[spriteId].tDeltaMod = 1; + return spriteId; +} + +static void SpriteCB_ThrownPokeblock(struct Sprite* sprite) +{ + sprite->pos1.x -= 4; + sprite->pos1.y += sprite->tDelta; + sprite->tDelta += sprite->tDeltaMod; + if (sprite->tDelta == 10) + DestroySprite(sprite); +} + +#undef tDelta +#undef tDeltaMod + +static void sub_817A5CC(void) +{ + u8 animId, i; + struct PokeblockFeedStruct *pokeblockFeed; + + pokeblockFeed = sPokeblockFeed; + pokeblockFeed->field_1056 = 1; + animId = sNatureToMonPokeblockAnim[pokeblockFeed->nature][0]; + for (i = 0; i < 8; i++, animId++) + { + pokeblockFeed->field_1056 += sMonPokeblockAnims[animId][4]; + if (sMonPokeblockAnims[animId][9] == 1) + break; + } +} + +static void sub_817A634(void) +{ + struct PokeblockFeedStruct *pokeblockFeed = sPokeblockFeed; + + switch (pokeblockFeed->field_1050) + { + case 0: + pokeblockFeed->animId = sNatureToMonPokeblockAnim[pokeblockFeed->nature][0]; + pokeblockFeed->monSpritePtr = &gSprites[pokeblockFeed->monSpriteId_]; + pokeblockFeed->savedMonSprite = *pokeblockFeed->monSpritePtr; + pokeblockFeed->field_1050 = 10; + break; + case 1 ... 9: + break; + case 10: + sub_817A91C(); + if (sNatureToMonPokeblockAnim[pokeblockFeed->nature][1] != 0) + { + pokeblockFeed->monSpritePtr->oam.affineMode = 3; + pokeblockFeed->monSpritePtr->oam.matrixNum = 0; + pokeblockFeed->monSpritePtr->affineAnims = sSpriteAffineAnimTable_85F04FC; + InitSpriteAffineAnim(pokeblockFeed->monSpritePtr); + } + pokeblockFeed->field_1050 = 50; + case 50: + if (sNatureToMonPokeblockAnim[pokeblockFeed->nature][1] != 0) + { + if (!pokeblockFeed->noMonFlip) // double negation, so mon's sprite is flipped + StartSpriteAffineAnim(pokeblockFeed->monSpritePtr, sNatureToMonPokeblockAnim[pokeblockFeed->nature][1] + 10); + else + StartSpriteAffineAnim(pokeblockFeed->monSpritePtr, sNatureToMonPokeblockAnim[pokeblockFeed->nature][1]); + } + pokeblockFeed->field_1050 = 60; + break; + case 60: + if (sub_817A9E4() == TRUE) + { + if (pokeblockFeed->field_1060[9] == 0) + { + pokeblockFeed->animId++; + sub_817A91C(); + pokeblockFeed->field_1050 = 60; + } + else + { + FreeOamMatrix(pokeblockFeed->monSpritePtr->oam.matrixNum); + pokeblockFeed->field_1050 = 70; + } + } + break; + case 70: + FreeMonSpriteOamMatrix(); + pokeblockFeed->animId = 0; + pokeblockFeed->field_1050 = 0; + break; + case 71 ... 90: + break; + } +} + +static bool8 sub_817A91C(void) +{ + struct PokeblockFeedStruct *pokeblockFeed = sPokeblockFeed; + u8 i; + + for (i = 0; i < 10; i++) + pokeblockFeed->field_1060[i] = sMonPokeblockAnims[pokeblockFeed->animId][i]; + + if (pokeblockFeed->field_1060[4] == 0) + { + return TRUE; + } + else + { + pokeblockFeed->field_1060[10] = Sin(pokeblockFeed->field_1060[0], pokeblockFeed->field_1060[2]); + pokeblockFeed->field_1060[11] = Cos(pokeblockFeed->field_1060[0], pokeblockFeed->field_1060[3]); + pokeblockFeed->field_1060[12] = pokeblockFeed->field_1060[4]; + pokeblockFeed->field_1060[13] = pokeblockFeed->monSpritePtr->pos2.x; + pokeblockFeed->field_1060[14] = pokeblockFeed->monSpritePtr->pos2.y; + sub_817AB68(); + pokeblockFeed->field_1060[4] = pokeblockFeed->field_1060[12]; + sub_817AA54(); + pokeblockFeed->field_1060[4] = pokeblockFeed->field_1060[12]; + return FALSE; + } +} + +static bool8 sub_817A9E4(void) +{ + u16 var = sPokeblockFeed->field_1060[12] - sPokeblockFeed->field_1060[4]; + + sPokeblockFeed->monSpritePtr->pos2.x = sPokeblockFeed->field_850[var]; + sPokeblockFeed->monSpritePtr->pos2.y = sPokeblockFeed->field_C50[var]; + + if (--sPokeblockFeed->field_1060[4] == 0) + return TRUE; + else + return FALSE; +} + +static bool8 FreeMonSpriteOamMatrix(void) +{ + FreeSpriteOamMatrix(sPokeblockFeed->monSpritePtr); + return FALSE; +} + +static void sub_817AA54(void) +{ + struct PokeblockFeedStruct *pokeblockFeed = sPokeblockFeed; + u16 i; + u16 r8 = pokeblockFeed->field_1060[8]; + u16 r7 = pokeblockFeed->field_1060[12] - r8; + s16 var3 = pokeblockFeed->field_1060[13] + pokeblockFeed->field_1060[6]; + s16 r9 = pokeblockFeed->field_1060[14] + pokeblockFeed->field_1060[7]; + + for (i = 0; i < r7 - 1; i++) + { + s16 r1 = pokeblockFeed->field_850[r8 + i] - (var3); + s16 r4 = pokeblockFeed->field_C50[r8 + i] - r9; + + pokeblockFeed->field_850[r8 + i] -= r1 * (i + 1) / r7; + pokeblockFeed->field_C50[r8 + i] -= r4 * (i + 1) / r7; + } + + pokeblockFeed->field_850[(r8 + r7) - 1] = var3; + pokeblockFeed->field_C50[(r8 + r7) - 1] = r9; +} + +static void sub_817AB68(void) +{ + struct PokeblockFeedStruct *pokeblockFeed = sPokeblockFeed; + bool8 var_24 = FALSE; + s16 r8 = pokeblockFeed->field_1060[13] - pokeblockFeed->field_1060[10]; + s16 r7 = pokeblockFeed->field_1060[14] - pokeblockFeed->field_1060[11]; + + while (1) + { + u16 r5; + u16 r4; + u16 var; + + var = abs(pokeblockFeed->field_1060[5]); + r5 = var + pokeblockFeed->field_1060[3]; + pokeblockFeed->field_1060[3] = r5; + + if (pokeblockFeed->field_1060[2] < 0) + var_24 = TRUE; + + r4 = pokeblockFeed->field_1060[12] - pokeblockFeed->field_1060[4]; + + if (pokeblockFeed->field_1060[4] == 0) + break; + + if (!var_24) + { + pokeblockFeed->field_850[r4] = Sin(pokeblockFeed->field_1060[0], pokeblockFeed->field_1060[2] + r5 / 0x100) + r8; + pokeblockFeed->field_C50[r4] = Cos(pokeblockFeed->field_1060[0], pokeblockFeed->field_1060[3] + r5 / 0x100) + r7; + } + else + { + pokeblockFeed->field_850[r4] = Sin(pokeblockFeed->field_1060[0], pokeblockFeed->field_1060[2] - r5 / 0x100) + r8; + pokeblockFeed->field_C50[r4] = Cos(pokeblockFeed->field_1060[0], pokeblockFeed->field_1060[3] - r5 / 0x100) + r7; + } + + pokeblockFeed->field_1060[0] += pokeblockFeed->field_1060[1]; + pokeblockFeed->field_1060[0] &= 0xFF; + pokeblockFeed->field_1060[4]--; + } +} diff --git a/src/pokemon_3.c b/src/pokemon_3.c index 164069fa6..95ec4b6a2 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -21,6 +21,7 @@ #include "constants/abilities.h" #include "pokemon_animation.h" #include "pokedex.h" +#include "pokeblock.h" extern struct BattlePokemon gBattleMons[4]; extern struct BattleEnigmaBerry gEnigmaBerries[4]; @@ -58,7 +59,6 @@ extern const u8 gText_PkmnsXPreventsSwitching[]; extern const struct CompressedSpritePalette gMonPaletteTable[]; extern const struct CompressedSpritePalette gMonShinyPaletteTable[]; extern const u16 gHMMoves[]; -extern const s8 gPokeblockFlavorCompatibilityTable[]; extern const u8 gMonAnimationDelayTable[]; extern const u8 gMonFrontAnimIdsTable[]; @@ -1298,21 +1298,21 @@ bool8 IsPokeSpriteNotFlipped(u16 species) return gBaseStats[species].noFlip; } -s8 GetMonFlavorRelation(struct Pokemon *mon, u8 a2) +s8 GetMonFlavorRelation(struct Pokemon *mon, u8 flavor) { u8 nature = GetNature(mon); - return gPokeblockFlavorCompatibilityTable[nature * 5 + a2]; + return gPokeblockFlavorCompatibilityTable[nature * 5 + flavor]; } -s8 GetFlavorRelationByPersonality(u32 personality, u8 a2) +s8 GetFlavorRelationByPersonality(u32 personality, u8 flavor) { u8 nature = GetNatureFromPersonality(personality); - return gPokeblockFlavorCompatibilityTable[nature * 5 + a2]; + return gPokeblockFlavorCompatibilityTable[nature * 5 + flavor]; } bool8 IsTradedMon(struct Pokemon *mon) { - u8 otName[8]; + u8 otName[OT_NAME_LENGTH + 1]; u32 otId; GetMonData(mon, MON_DATA_OT_NAME, otName); otId = GetMonData(mon, MON_DATA_OT_ID, 0); diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index b00979945..ba0c4dde7 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -73,7 +73,7 @@ extern void do_scheduled_bg_tilemap_copies_to_vram(void); extern u8 sub_81221EC(); extern u8 sub_81221AC(); extern void SetVBlankHBlankCallbacksToNull(); -extern void sub_8121DA0(); +extern void ResetVramOamAndBgCntRegs(); extern void clear_scheduled_bg_copies_to_vram(); extern void remove_some_task(); extern void ResetBgsAndClearDma3BusyFlags(u32 leftoverFireRedLeafGreenVariable); @@ -193,7 +193,7 @@ void sub_81C4A88(); void sub_81C4280(); void sub_81C0510(u8 taskId); void sub_81C171C(u8 taskId); -void sub_8121E10(); +void ResetAllBgsCoordinates(); u8 sub_81B205C(struct Pokemon* a); void sub_81C1DA4(u16 a, s16 b); void sub_81C1EFC(u16 a, s16 b, u16 c); @@ -450,7 +450,7 @@ bool8 sub_81BFB10(void) { case 0: SetVBlankHBlankCallbacksToNull(); - sub_8121DA0(); + ResetVramOamAndBgCntRegs(); clear_scheduled_bg_copies_to_vram(); gMain.state++; break; @@ -578,7 +578,7 @@ void sub_81BFE24() SetBgTilemapBuffer(1, &gUnknown_0203CF1C->unkTilemap2); SetBgTilemapBuffer(2, &gUnknown_0203CF1C->unkTilemap1); SetBgTilemapBuffer(3, &gUnknown_0203CF1C->unkTilemap0); - sub_8121E10(); + ResetAllBgsCoordinates(); schedule_bg_copy_tilemap_to_vram(1); schedule_bg_copy_tilemap_to_vram(2); schedule_bg_copy_tilemap_to_vram(3); diff --git a/src/safari_zone.c b/src/safari_zone.c index f1d59907d..ce1eb65bc 100644 --- a/src/safari_zone.c +++ b/src/safari_zone.c @@ -5,6 +5,7 @@ #include "main.h" #include "battle.h" #include "string_util.h" +#include "pokeblock.h" struct PokeblockFeeder { @@ -24,7 +25,6 @@ extern u8 EventScript_2A4B8A[]; extern u8 EventScript_2A4B6F[]; extern u8 EventScript_2A4B4C[]; extern u8 EventScript_2A4B9B[]; -extern const u8* const gPokeblockNames[]; extern void sub_80EE44C(u8, u8); extern void IncrementGameStat(u8 index); diff --git a/src/secret_base.c b/src/secret_base.c index cc320e5d7..bf6bec1f8 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -1082,13 +1082,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) { @@ -1098,11 +1098,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) @@ -1119,7 +1119,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); } @@ -1138,8 +1138,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/src/use_pokeblock.c b/src/use_pokeblock.c new file mode 100644 index 000000000..12f475c93 --- /dev/null +++ b/src/use_pokeblock.c @@ -0,0 +1,230 @@ +#include "global.h" +#include "main.h" +#include "pokeblock.h" +#include "malloc.h" +#include "palette.h" +#include "pokenav.h" +#include "unknown_task.h" +#include "text.h" +#include "bg.h" +#include "window.h" +#include "text_window.h" + +struct UsePokeblockSubStruct +{ + void (*field_0)(void); + void (*callback)(void); + struct Pokeblock *pokeblock; + struct Pokemon *pokemon; + u8 stringBuffer[0x40]; + u8 field_50; + u8 field_51; + u8 field_52; + u8 field_53; + u8 field_54; + u8 field_55; + u8 field_56; + u8 field_57[5]; + u8 field_5c[5]; + u8 field_61[5]; + s16 field_66[5]; +}; + +struct UsePokeblockStruct +{ + u8 field_0[0x7C58]; + u8 field_7C58[0x378]; + struct UsePokeblockSubStruct info; +}; + +extern u16 gKeyRepeatStartDelay; + +// this file's functions +void sub_816636C(void (*func)(void)); +void sub_8166380(void); +void sub_816631C(void); +void sub_81662C0(void); +void sub_8166564(void); +void sub_8166304(void); +void sub_81668F8(void); +void sub_8167420(void); +void sub_8167760(void); +u8 sub_81672E4(u8 arg0); +bool8 sub_8168328(void); +bool8 sub_8167930(void); +void sub_8167608(u8 arg0); +void sub_8167BA0(u16 arg0, u8 copyToVramMode); + +extern const struct BgTemplate gUnknown_085DFCCC[4]; +extern const struct WindowTemplate gUnknown_085DFCDC[]; + +// ram variables +EWRAM_DATA struct UsePokeblockSubStruct *gUnknown_0203BC90 = NULL; +EWRAM_DATA void (*gUnknown_0203BC94)(void) = NULL; +EWRAM_DATA struct Pokeblock *gUnknown_0203BC98 = NULL; +EWRAM_DATA u8 gPokeblockMonId = 0; +EWRAM_DATA s16 gPokeblockGain = 0; +EWRAM_DATA void *gUnknown_0203BCA0 = NULL; +EWRAM_DATA void *gUnknown_0203BCA4 = NULL; +EWRAM_DATA void *gUnknown_0203BCA8 = NULL; +EWRAM_DATA struct UsePokeblockStruct *gUnknown_0203BCAC = NULL; + +// const rom data +// todo: make it static once the file is decompiled + +// code +void ChooseMonToGivePokeblock(struct Pokeblock *pokeblock, void (*callback)(void)) +{ + gUnknown_0203BCAC = AllocZeroed(0x806C); + gUnknown_0203BC90 = &gUnknown_0203BCAC->info; + gUnknown_0203BC90->pokeblock = pokeblock; + gUnknown_0203BC90->callback = callback; + sub_816636C(sub_8166380); + SetMainCallback2(sub_816631C); +} + +void CB2_ReturnAndChooseMonToGivePokeblock(void) +{ + gUnknown_0203BCAC = AllocZeroed(0x806C); + gUnknown_0203BC90 = &gUnknown_0203BCAC->info; + gUnknown_0203BC90->pokeblock = gUnknown_0203BC98; + gUnknown_0203BC90->callback = gUnknown_0203BC94; + gPokeblockMonId = sub_81672E4(gPokeblockMonId); + gUnknown_0203BC90->field_56 = gPokeblockMonId < 4 ? 0 : 1; + sub_816636C(sub_8166380); + SetMainCallback2(sub_81662C0); +} + +void sub_81662C0(void) +{ + gUnknown_0203BC90->field_0(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); + if (gUnknown_0203BC90->field_0 == sub_8166564) + { + gUnknown_0203BC90->field_50 = 0; + SetMainCallback2(sub_8166304); + } +} + +void sub_8166304(void) +{ + sub_81668F8(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +void sub_816631C(void) +{ + gUnknown_0203BC90->field_0(); + AnimateSprites(); + BuildOamBuffer(); + RunTextPrinters(); + UpdatePaletteFade(); +} + +void sub_8166340(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); + sub_81D2108(gUnknown_0203BCAC->field_7C58); + sub_80BA0A8(); +} + +void sub_816636C(void (*func)(void)) +{ + gUnknown_0203BC90->field_0 = func; + gUnknown_0203BC90->field_50 = 0; +} + +void sub_8166380(void) +{ + switch (gUnknown_0203BC90->field_50) + { + case 0: + gUnknown_0203BCAC->field_0[0x7B10] = 0xFF; + sub_81D1ED4(gUnknown_0203BCAC->field_7C58); + gUnknown_0203BC90->field_50++; + break; + case 1: + ResetSpriteData(); + FreeAllSpritePalettes(); + gUnknown_0203BC90->field_50++; + break; + case 2: + SetVBlankCallback(NULL); + CpuFill32(0, (void*)(VRAM), VRAM_SIZE); + gUnknown_0203BC90->field_50++; + break; + case 3: + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_085DFCCC, ARRAY_COUNT(gUnknown_085DFCCC)); + InitWindows(gUnknown_085DFCDC); + DeactivateAllTextPrinters(); + sub_809882C(0, 0x97, 0xE0); + gUnknown_0203BC90->field_50++; + break; + case 4: + gUnknown_0203BC90->field_50++; + break; + case 5: + if (!sub_8168328()) + { + gUnknown_0203BC90->field_50++; + } + break; + case 6: + gKeyRepeatStartDelay = 20; + sub_8167420(); + gUnknown_0203BC90->field_50++; + break; + case 7: + if (!sub_8167930()) + { + gUnknown_0203BC90->field_50++; + } + break; + case 8: + sub_8167608(0); + sub_8167760(); + gUnknown_0203BC90->field_50++; + break; + case 9: + if (!sub_81D312C(&gUnknown_0203BCAC->field_0[0x7B0E])) + { + gUnknown_0203BC90->field_50++; + } + break; + case 10: + gUnknown_0203BC90->field_50++; + break; + case 11: + sub_81D2754(gUnknown_0203BCAC->field_7C58, &gUnknown_0203BCAC->field_0[0x7C6C]); + sub_81D20AC(gUnknown_0203BCAC->field_7C58); + gUnknown_0203BC90->field_50++; + break; + case 12: + if (!sub_81D20BC(gUnknown_0203BCAC->field_7C58)) + { + sub_81D1F84(gUnknown_0203BCAC->field_7C58, &gUnknown_0203BCAC->field_7C58[0x14], &gUnknown_0203BCAC->field_7C58[0x14]); + gUnknown_0203BC90->field_50++; + } + break; + case 13: + sub_81D2230(gUnknown_0203BCAC->field_7C58); + gUnknown_0203BC90->field_50++; + break; + case 14: + PutWindowTilemap(0); + PutWindowTilemap(1); + sub_8167BA0(0, 1); + gUnknown_0203BC90->field_50++; + break; + case 15: + sub_816636C(sub_8166564); + break; + } +} diff --git a/sym_common.txt b/sym_common.txt index be96f4c30..590597459 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -405,7 +405,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 3040a7c69..82717b1a1 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1115,15 +1115,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 @@ -1257,32 +1250,7 @@ gUnknown_0203BC88: @ 203BC88 gUnknown_0203BC8C: @ 203BC8C .space 0x4 -gUnknown_0203BC90: @ 203BC90 - .space 0x4 - -gUnknown_0203BC94: @ 203BC94 - .space 0x4 - -gUnknown_0203BC98: @ 203BC98 - .space 0x4 - -gUnknown_0203BC9C: @ 203BC9C - .space 0x2 - -gUnknown_0203BC9E: @ 203BC9E - .space 0x2 - -gUnknown_0203BCA0: @ 203BCA0 - .space 0x4 - -gUnknown_0203BCA4: @ 203BCA4 - .space 0x4 - -gUnknown_0203BCA8: @ 203BCA8 - .space 0x4 - -gUnknown_0203BCAC: @ 203BCAC - .space 0x4 + .include "src/use_pokeblock.o" gUnknown_0203BCB0: @ 203BCB0 .space 0x4 @@ -1344,11 +1312,7 @@ gUnknown_0203BCF8: @ 203BCF8 gBraillePuzzleCallbackFlag: @ 203BD14 .space 0x4 -gUnknown_0203BD18: @ 203BD18 - .space 0x4 - -gUnknown_0203BD1C: @ 203BD1C - .space 0x8 + .include "src/pokeblock_feed.o" gUnknown_0203BD24: @ 203BD24 .space 0x2