From f1421d94c384c1bd76304fcb961ca28d7f0e7e20 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 15 Dec 2018 23:58:47 +0100 Subject: [PATCH] Up to sub 0x80ce580 --- asm/contest_link_80F57C4.s | 2 +- asm/pokemon_storage_system.s | 6829 +----------------------------- asm/pokenav.s | 24 +- data/pokemon_storage_system.s | 441 +- include/constants/maps.h | 1 + include/global.h | 6 +- include/graphics.h | 9 + include/menu.h | 6 +- include/pokemon.h | 6 +- include/pokemon_icon.h | 3 + include/pokemon_storage_system.h | 113 +- include/text.h | 2 +- src/battle_pike.c | 2 +- src/daycare.c | 4 +- src/egg_hatch.c | 2 +- src/field_player_avatar.c | 2 +- src/field_poison.c | 2 +- src/field_specials.c | 4 +- src/menu.c | 10 +- src/overworld.c | 2 +- src/pokemon.c | 18 +- src/pokemon_icon.c | 13 +- src/pokemon_size_record.c | 2 +- src/pokemon_storage_system.c | 2601 +++++++++++- src/pokemon_summary_screen.c | 2 +- src/post_battle_event_funcs.c | 4 +- src/text.c | 7 +- src/wild_encounter.c | 12 +- sym_ewram.txt | 2 +- 29 files changed, 2776 insertions(+), 7355 deletions(-) diff --git a/asm/contest_link_80F57C4.s b/asm/contest_link_80F57C4.s index 3e35ab7f1..e09e0e25d 100644 --- a/asm/contest_link_80F57C4.s +++ b/asm/contest_link_80F57C4.s @@ -2093,7 +2093,7 @@ _080F6AA6: adds r0, r1 ldrh r0, [r0] movs r1, 0 - bl mon_icon_convert_unown_species_id + bl GetIconSpecies lsls r0, 16 lsrs r0, 16 adds r0, r6 diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index 642dc0270..b6822eeac 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -7,6707 +7,6 @@ - - thumb_func_start sub_80CAFAC -sub_80CAFAC: @ 80CAFAC - push {lr} - bl IsCursorInBox - lsls r0, 24 - movs r1, 0x1 - cmp r0, 0 - beq _080CAFBC - movs r1, 0x2 -_080CAFBC: - adds r0, r1, 0 - pop {r1} - bx r1 - thumb_func_end sub_80CAFAC - - thumb_func_start sub_80CAFC4 -sub_80CAFC4: @ 80CAFC4 - push {r4-r6,lr} - sub sp, 0x8 - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - ldr r4, =0x000020a4 - adds r0, r4 - movs r1, 0 - bl GetMonData - adds r6, r0, 0 - ldr r0, [r5] - adds r0, r4 - movs r1, 0x41 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - bl sub_80CAFAC - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - movs r0, 0x7 - str r0, [sp, 0x4] - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0 - movs r3, 0 - bl sub_80CC230 - ldr r1, [r5] - ldr r2, =0x00000a6c - adds r1, r2 - str r0, [r1] - ldr r1, =sub_80CC100 - str r1, [r0, 0x1C] - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CAFC4 - - thumb_func_start sub_80CB028 -sub_80CB028: @ 80CB028 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - movs r0, 0 - mov r8, r0 - movs r6, 0 - movs r7, 0 -_080CB042: - movs r5, 0 - adds r1, r7, 0x1 - mov r10, r1 -_080CB048: - mov r0, r9 - adds r1, r6, 0 - movs r2, 0x41 - bl GetBoxMonDataFromAnyBox - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0 - beq _080CB0B0 - mov r0, r9 - adds r1, r6, 0 - movs r2, 0 - bl GetBoxMonDataFromAnyBox - adds r1, r0, 0 - lsls r2, r5, 1 - adds r2, r5 - lsls r2, 19 - movs r3, 0xC8 - lsls r3, 15 - adds r2, r3 - asrs r2, 16 - lsls r3, r7, 1 - adds r3, r7 - lsls r3, 19 - movs r0, 0xB0 - lsls r0, 14 - adds r3, r0 - movs r0, 0x2 - str r0, [sp] - movs r0, 0x13 - subs r0, r5 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - adds r0, r4, 0 - asrs r3, 16 - bl sub_80CC230 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - mov r3, r8 - lsls r2, r3, 2 - ldr r3, =0x00000a88 - adds r1, r3 - adds r1, r2 - str r0, [r1] - b _080CB0C0 - .pool -_080CB0B0: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - mov r2, r8 - lsls r1, r2, 2 - ldr r3, =0x00000a88 - adds r0, r3 - adds r0, r1 - str r4, [r0] -_080CB0C0: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - mov r0, r8 - adds r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x5 - bls _080CB048 - mov r1, r10 - lsls r0, r1, 16 - lsrs r7, r0, 16 - cmp r7, 0x4 - bls _080CB042 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080CB126 - movs r6, 0 - movs r2, 0xD - negs r2, r2 - adds r4, r2, 0 -_080CB0F6: - mov r0, r9 - adds r1, r6, 0 - movs r2, 0xC - bl GetBoxMonDataFromAnyBox - cmp r0, 0 - bne _080CB11C - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - lsls r1, r6, 2 - ldr r3, =0x00000a88 - adds r0, r3 - adds r0, r1 - ldr r2, [r0] - ldrb r0, [r2, 0x1] - ands r0, r4 - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2, 0x1] -_080CB11C: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x1D - bls _080CB0F6 -_080CB126: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB028 - - thumb_func_start sub_80CB140 -sub_80CB140: @ 80CB140 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r7, r0, 24 - adds r0, r7, 0 - movs r1, 0x41 - bl GetBoxMonDataFromSelectedBox - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - cmp r0, 0 - beq _080CB1DA - adds r0, r7, 0 - movs r1, 0x6 - bl __umodsi3 - adds r6, r0, 0 - lsls r0, r6, 24 - lsrs r0, 24 - lsls r5, r0, 1 - adds r5, r0 - lsls r5, 19 - movs r0, 0xC8 - lsls r0, 15 - adds r5, r0 - lsrs r5, 16 - adds r0, r7, 0 - movs r1, 0x6 - bl __udivsi3 - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 1 - adds r4, r0 - lsls r4, 19 - movs r0, 0xB0 - lsls r0, 14 - adds r4, r0 - lsrs r4, 16 - adds r0, r7, 0 - movs r1, 0 - bl GetBoxMonDataFromSelectedBox - adds r1, r0, 0 - movs r0, 0x2 - str r0, [sp] - movs r0, 0x13 - subs r0, r6 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - mov r0, r8 - adds r2, r5, 0 - adds r3, r4, 0 - bl sub_80CC230 - adds r3, r0, 0 - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - lsls r1, r7, 2 - ldr r4, =0x00000a88 - adds r0, r2, r4 - adds r0, r1 - str r3, [r0] - ldrb r0, [r2, 0x1] - cmp r0, 0x3 - bne _080CB1DA - ldrb r0, [r3, 0x1] - movs r1, 0xD - negs r1, r1 - ands r1, r0 - movs r0, 0x4 - orrs r1, r0 - strb r1, [r3, 0x1] -_080CB1DA: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB140 - - thumb_func_start sub_80CB1F0 -sub_80CB1F0: @ 80CB1F0 - push {r4-r7,lr} - lsls r0, 16 - lsrs r3, r0, 16 - movs r2, 0 - ldr r7, =gUnknown_02039D08 - ldr r6, =0x00000a88 - movs r5, 0x1 - ldr r4, =sub_80CB278 -_080CB200: - ldr r0, [r7] - lsls r1, r2, 2 - adds r0, r6 - adds r1, r0, r1 - ldr r0, [r1] - cmp r0, 0 - beq _080CB218 - strh r3, [r0, 0x32] - ldr r0, [r1] - strh r5, [r0, 0x36] - ldr r0, [r1] - str r4, [r0, 0x1C] -_080CB218: - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x1D - bls _080CB200 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB1F0 - - thumb_func_start sub_80CB234 -sub_80CB234: @ 80CB234 - push {lr} - adds r2, r0, 0 - ldrh r1, [r2, 0x30] - movs r3, 0x30 - ldrsh r0, [r2, r3] - cmp r0, 0 - beq _080CB250 - subs r0, r1, 0x1 - strh r0, [r2, 0x30] - ldrh r0, [r2, 0x32] - ldrh r1, [r2, 0x20] - adds r0, r1 - strh r0, [r2, 0x20] - b _080CB266 -_080CB250: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r3, =0x00000c66 - adds r1, r3 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - ldrh r0, [r2, 0x34] - strh r0, [r2, 0x20] - ldr r0, =SpriteCallbackDummy - str r0, [r2, 0x1C] -_080CB266: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB234 - - thumb_func_start sub_80CB278 -sub_80CB278: @ 80CB278 - push {lr} - adds r2, r0, 0 - ldrh r1, [r2, 0x36] - movs r3, 0x36 - ldrsh r0, [r2, r3] - cmp r0, 0 - beq _080CB28C - subs r0, r1, 0x1 - strh r0, [r2, 0x36] - b _080CB2A8 -_080CB28C: - ldrh r0, [r2, 0x32] - ldrh r1, [r2, 0x20] - adds r0, r1 - strh r0, [r2, 0x20] - ldrh r1, [r2, 0x24] - adds r0, r1 - strh r0, [r2, 0x38] - subs r0, 0x45 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xB6 - bls _080CB2A8 - ldr r0, =SpriteCallbackDummy - str r0, [r2, 0x1C] -_080CB2A8: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB278 - - thumb_func_start sub_80CB2B0 -sub_80CB2B0: @ 80CB2B0 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r7, =gUnknown_02039D08 -_080CB2BA: - ldr r0, [r7] - lsls r4, r5, 2 - ldr r1, =0x00000a88 - adds r0, r1 - adds r0, r4 - ldr r0, [r0] - cmp r0, 0 - beq _080CB2DA - bl sub_80CC314 - ldr r0, [r7] - ldr r1, =0x00000a88 - adds r0, r1 - adds r0, r4 - movs r1, 0 - str r1, [r0] -_080CB2DA: - adds r0, r5, 0x6 - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x4 - bls _080CB2BA - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB2B0 - - thumb_func_start sub_80CB2F8 -sub_80CB2F8: @ 80CB2F8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x1C - lsls r0, 24 - lsrs r0, 24 - lsls r1, 16 - lsrs r1, 16 - str r1, [sp, 0x8] - lsls r2, 16 - movs r1, 0x2C - mov r8, r1 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 19 - movs r3, 0xC8 - lsls r3, 15 - adds r1, r3 - lsrs r1, 16 - str r1, [sp, 0x10] - ldr r1, [sp, 0x8] - adds r1, 0x1 - lsrs r6, r2, 16 - str r6, [sp, 0xC] - asrs r2, 16 - muls r1, r2 - ldr r2, [sp, 0x10] - subs r1, r2, r1 - lsls r1, 16 - lsrs r2, r1, 16 - movs r1, 0x13 - subs r1, r0 - lsls r1, 24 - lsrs r1, 24 - str r1, [sp, 0x14] - movs r3, 0 - mov r9, r3 - adds r5, r0, 0 - ldr r1, =gUnknown_02039D08 - ldr r0, [r1] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - beq _080CB3F0 - movs r7, 0x4 - lsls r2, 16 - mov r10, r2 -_080CB358: - ldr r6, =gUnknown_02039D08 - ldr r2, [r6] - lsls r0, r5, 1 - ldr r3, =0x00000ba8 - adds r1, r2, r3 - adds r1, r0 - ldrh r0, [r1] - cmp r0, 0 - beq _080CB3C2 - lsls r4, r5, 2 - ldr r6, =0x00000be4 - adds r1, r2, r6 - adds r1, r4 - ldr r1, [r1] - mov r2, r8 - lsls r3, r2, 16 - asrs r3, 16 - movs r2, 0x2 - str r2, [sp] - ldr r6, [sp, 0x14] - str r6, [sp, 0x4] - mov r6, r10 - asrs r2, r6, 16 - bl sub_80CC230 - adds r2, r0, 0 - ldr r1, =gUnknown_02039D08 - ldr r0, [r1] - ldr r3, =0x00000a88 - adds r0, r3 - adds r1, r0, r4 - str r2, [r1] - cmp r2, 0 - beq _080CB3C2 - mov r6, sp - ldrh r6, [r6, 0x8] - strh r6, [r2, 0x30] - ldr r0, [r1] - mov r2, sp - ldrh r2, [r2, 0xC] - strh r2, [r0, 0x32] - ldr r0, [r1] - mov r3, sp - ldrh r3, [r3, 0x10] - strh r3, [r0, 0x34] - ldr r1, [r1] - ldr r0, =sub_80CB234 - str r0, [r1, 0x1C] - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_080CB3C2: - adds r0, r5, 0x6 - lsls r0, 24 - lsrs r5, r0, 24 - mov r0, r8 - adds r0, 0x18 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - subs r7, 0x1 - cmp r7, 0 - bge _080CB358 - b _080CB4A6 - .pool -_080CB3F0: - mov r10, r1 - movs r7, 0x4 - lsls r2, 16 - str r2, [sp, 0x18] -_080CB3F8: - mov r6, r10 - ldr r2, [r6] - lsls r0, r5, 1 - ldr r3, =0x00000ba8 - adds r1, r2, r3 - adds r1, r0 - ldrh r0, [r1] - cmp r0, 0 - beq _080CB490 - lsls r4, r5, 2 - ldr r6, =0x00000be4 - adds r1, r2, r6 - adds r1, r4 - ldr r1, [r1] - mov r2, r8 - lsls r3, r2, 16 - asrs r3, 16 - movs r2, 0x2 - str r2, [sp] - ldr r6, [sp, 0x14] - str r6, [sp, 0x4] - ldr r6, [sp, 0x18] - asrs r2, r6, 16 - bl sub_80CC230 - adds r2, r0, 0 - mov r0, r10 - ldr r3, [r0] - ldr r1, =0x00000a88 - adds r0, r3, r1 - adds r1, r0, r4 - str r2, [r1] - cmp r2, 0 - beq _080CB490 - mov r6, sp - ldrh r6, [r6, 0x8] - strh r6, [r2, 0x30] - ldr r0, [r1] - mov r2, sp - ldrh r2, [r2, 0xC] - strh r2, [r0, 0x32] - ldr r0, [r1] - mov r6, sp - ldrh r6, [r6, 0x10] - strh r6, [r0, 0x34] - ldr r1, [r1] - ldr r0, =sub_80CB234 - str r0, [r1, 0x1C] - ldr r1, =0x00000c5c - adds r0, r3, r1 - ldrb r0, [r0] - adds r1, r5, 0 - movs r2, 0xC - bl GetBoxMonDataFromAnyBox - cmp r0, 0 - bne _080CB486 - mov r2, r10 - ldr r0, [r2] - ldr r3, =0x00000a88 - adds r0, r3 - adds r0, r4 - ldr r2, [r0] - ldrb r1, [r2, 0x1] - movs r6, 0xD - negs r6, r6 - adds r0, r6, 0 - ands r1, r0 - movs r0, 0x4 - orrs r1, r0 - strb r1, [r2, 0x1] -_080CB486: - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_080CB490: - adds r0, r5, 0x6 - lsls r0, 24 - lsrs r5, r0, 24 - mov r0, r8 - adds r0, 0x18 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - subs r7, 0x1 - cmp r7, 0 - bge _080CB3F8 -_080CB4A6: - mov r0, r9 - add sp, 0x1C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CB2F8 - - thumb_func_start sub_80CB4CC -sub_80CB4CC: @ 80CB4CC - push {r4-r7,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsrs r4, 24 - ldr r6, =gUnknown_02039D08 - ldr r1, [r6] - ldr r2, =0x00000c6a - adds r1, r2 - movs r5, 0 - strb r5, [r1] - ldr r1, [r6] - ldr r3, =0x00000c6b - adds r1, r3 - strb r0, [r1] - ldr r1, [r6] - ldr r7, =0x00000c69 - adds r1, r7 - strb r4, [r1] - ldr r3, [r6] - movs r1, 0xC6 - lsls r1, 4 - adds r2, r3, r1 - movs r1, 0x20 - strh r1, [r2] - lsls r4, 24 - asrs r4, 24 - lsls r1, r4, 1 - adds r1, r4 - lsls r1, 1 - negs r1, r1 - subs r7, 0x5 - adds r2, r3, r7 - strh r1, [r2] - ldr r1, =0x00000c66 - adds r3, r1 - strh r5, [r3] - bl sub_80CB6F0 - cmp r4, 0 - ble _080CB544 - ldr r0, [r6] - ldr r2, =0x00000c68 - adds r0, r2 - movs r1, 0 - b _080CB54C - .pool -_080CB544: - ldr r0, [r6] - ldr r3, =0x00000c68 - adds r0, r3 - movs r1, 0x5 -_080CB54C: - strb r1, [r0] - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - ldr r7, =0x00000c68 - adds r0, r2, r7 - ldrb r1, [r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - adds r0, 0x64 - ldr r3, =0x00000c62 - adds r1, r2, r3 - strh r0, [r1] - subs r7, 0x4 - adds r2, r7 - movs r1, 0 - ldrsh r0, [r2, r1] - bl sub_80CB1F0 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB4CC - - thumb_func_start sub_80CB584 -sub_80CB584: @ 80CB584 - push {r4-r6,lr} - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - movs r4, 0xC6 - lsls r4, 4 - adds r1, r0, r4 - ldrh r0, [r1] - cmp r0, 0 - beq _080CB59A - subs r0, 0x1 - strh r0, [r1] -_080CB59A: - ldr r3, [r5] - ldr r6, =0x00000c6a - adds r0, r3, r6 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080CB61C - cmp r0, 0x1 - bgt _080CB5B8 - cmp r0, 0 - beq _080CB5C0 - b _080CB6DE - .pool -_080CB5B8: - cmp r0, 0x2 - bne _080CB5BE - b _080CB6CC -_080CB5BE: - b _080CB6DE -_080CB5C0: - ldr r0, =0x00000c62 - adds r1, r3, r0 - ldr r2, =0x00000c64 - adds r0, r3, r2 - ldrh r0, [r0] - ldrh r2, [r1] - adds r0, r2 - strh r0, [r1] - subs r0, 0x41 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xBA - bhi _080CB5DC - b _080CB6E8 -_080CB5DC: - ldr r1, =0x00000c68 - adds r0, r3, r1 - ldrb r0, [r0] - bl sub_80CB2B0 - ldr r2, [r5] - ldr r0, =0x00000c62 - adds r3, r2, r0 - ldr r1, =0x00000c69 - adds r0, r2, r1 - movs r1, 0 - ldrsb r1, [r0, r1] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - ldrh r1, [r3] - adds r0, r1 - strh r0, [r3] - adds r2, r6 - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] - b _080CB6E8 - .pool -_080CB61C: - ldr r2, =0x00000c62 - adds r1, r3, r2 - ldr r6, =0x00000c64 - adds r2, r3, r6 - ldrh r0, [r2] - ldrh r6, [r1] - adds r0, r6 - strh r0, [r1] - ldr r6, =0x00000c68 - adds r0, r3, r6 - ldrb r0, [r0] - adds r1, r3, r4 - ldrh r1, [r1] - movs r3, 0 - ldrsh r2, [r2, r3] - bl sub_80CB2F8 - ldr r2, [r5] - ldr r3, =0x00000c66 - adds r1, r2, r3 - lsls r0, 24 - lsrs r0, 24 - ldrh r3, [r1] - adds r0, r3 - strh r0, [r1] - ldr r1, =0x00000c69 - adds r0, r2, r1 - movs r1, 0 - ldrsb r1, [r0, r1] - cmp r1, 0 - ble _080CB662 - adds r0, r2, r6 - ldrb r0, [r0] - cmp r0, 0x5 - beq _080CB66E -_080CB662: - cmp r1, 0 - bge _080CB69C - adds r0, r2, r6 - ldrb r0, [r0] - cmp r0, 0 - bne _080CB69C -_080CB66E: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x00000c6a - adds r1, r2 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080CB6E8 - .pool -_080CB69C: - ldr r3, =gUnknown_02039D08 - ldr r0, [r3] - ldr r6, =0x00000c68 - adds r1, r0, r6 - ldr r2, =0x00000c69 - adds r0, r2 - ldrb r0, [r0] - ldrb r6, [r1] - adds r0, r6 - movs r2, 0 - strb r0, [r1] - ldr r0, [r3] - ldr r1, =0x00000c6a - adds r0, r1 - strb r2, [r0] - b _080CB6E8 - .pool -_080CB6CC: - ldr r2, =0x00000c66 - adds r0, r3, r2 - ldrh r0, [r0] - cmp r0, 0 - bne _080CB6E8 - adds r1, r3, r4 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] -_080CB6DE: - movs r0, 0 - b _080CB6EA - .pool -_080CB6E8: - movs r0, 0x1 -_080CB6EA: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80CB584 - - thumb_func_start sub_80CB6F0 -sub_80CB6F0: @ 80CB6F0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r6, r0, 24 - movs r5, 0 - movs r0, 0 - ldr r1, =gUnknown_02039D08 - mov r9, r1 -_080CB704: - adds r0, 0x1 - mov r8, r0 - movs r7, 0x5 -_080CB70A: - lsls r0, r5, 24 - lsrs r4, r0, 24 - adds r0, r6, 0 - adds r1, r4, 0 - movs r2, 0x41 - bl GetBoxMonDataFromAnyBox - mov r2, r9 - ldr r1, [r2] - lsls r2, r5, 1 - ldr r3, =0x00000ba8 - adds r1, r3 - adds r1, r2 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - beq _080CB744 - adds r0, r6, 0 - adds r1, r4, 0 - movs r2, 0 - bl GetBoxMonDataFromAnyBox - mov r2, r9 - ldr r1, [r2] - lsls r2, r5, 2 - ldr r3, =0x00000be4 - adds r1, r3 - adds r1, r2 - str r0, [r1] -_080CB744: - adds r5, 0x1 - subs r7, 0x1 - cmp r7, 0 - bge _080CB70A - mov r0, r8 - cmp r0, 0x4 - ble _080CB704 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000c5c - adds r0, r1 - strb r6, [r0] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB6F0 - - thumb_func_start sub_80CB778 -sub_80CB778: @ 80CB778 - push {r4,r5,lr} - lsls r0, 24 - ldr r5, =gUnknown_02039D08 - ldr r1, [r5] - lsrs r4, r0, 22 - ldr r0, =0x00000a88 - adds r1, r0 - adds r1, r4 - ldr r0, [r1] - cmp r0, 0 - beq _080CB79E - bl sub_80CC314 - ldr r0, [r5] - ldr r1, =0x00000a88 - adds r0, r1 - adds r0, r4 - movs r1, 0 - str r1, [r0] -_080CB79E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB778 - - thumb_func_start sub_80CB7AC -sub_80CB7AC: @ 80CB7AC - push {lr} - lsls r0, 24 - lsls r1, 24 - lsrs r2, r1, 24 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - lsrs r0, 22 - ldr r3, =0x00000a88 - adds r1, r3 - adds r1, r0 - ldr r3, [r1] - cmp r3, 0 - beq _080CB7DA - movs r0, 0x3 - adds r1, r2, 0 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r3, 0x1] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x1] -_080CB7DA: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB7AC - - thumb_func_start sub_80CB7E8 -sub_80CB7E8: @ 80CB7E8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r4, =gPlayerParty - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - lsls r0, 16 - lsrs r5, r0, 16 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - adds r1, r0, 0 - movs r0, 0x1 - str r0, [sp] - movs r0, 0xC - str r0, [sp, 0x4] - adds r0, r5, 0 - movs r2, 0x68 - movs r3, 0x40 - bl sub_80CC230 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - movs r2, 0xA7 - lsls r2, 4 - adds r1, r2 - str r0, [r1] - movs r7, 0x1 - movs r6, 0x1 -_080CB830: - movs r0, 0x64 - adds r1, r6, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0 - beq _080CB894 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - adds r1, r0, 0 - subs r0, r6, 0x1 - lsls r3, r0, 1 - adds r3, r0 - lsls r3, 19 - movs r0, 0x80 - lsls r0, 13 - adds r3, r0 - asrs r3, 16 - movs r0, 0x1 - str r0, [sp] - movs r0, 0xC - str r0, [sp, 0x4] - adds r0, r5, 0 - movs r2, 0x98 - bl sub_80CC230 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - lsls r2, r6, 2 - movs r3, 0xA7 - lsls r3, 4 - adds r1, r3 - adds r1, r2 - str r0, [r1] - adds r0, r7, 0x1 - lsls r0, 16 - lsrs r7, r0, 16 - b _080CB8A4 - .pool -_080CB894: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - lsls r1, r6, 2 - movs r2, 0xA7 - lsls r2, 4 - adds r0, r2 - adds r0, r1 - str r5, [r0] -_080CB8A4: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x5 - bls _080CB830 - ldr r3, =gUnknown_02039D08 - mov r0, r8 - cmp r0, 0 - bne _080CB8EA - movs r6, 0 - cmp r6, r7 - bcs _080CB8EA - mov r12, r3 - movs r5, 0xA7 - lsls r5, 4 - movs r4, 0x4 -_080CB8C4: - mov r2, r12 - ldr r1, [r2] - lsls r0, r6, 2 - adds r1, r5 - adds r1, r0 - ldr r2, [r1] - ldrh r0, [r2, 0x22] - subs r0, 0xA0 - strh r0, [r2, 0x22] - ldr r1, [r1] - adds r1, 0x3E - ldrb r0, [r1] - orrs r0, r4 - strb r0, [r1] - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, r7 - bcc _080CB8C4 -_080CB8EA: - ldr r0, [r3] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080CB93C - movs r6, 0 - adds r7, r3, 0 - movs r5, 0xA7 - lsls r5, 4 -_080CB8FA: - ldr r0, [r7] - lsls r4, r6, 2 - adds r0, r5 - adds r0, r4 - ldr r0, [r0] - cmp r0, 0 - beq _080CB932 - movs r0, 0x64 - muls r0, r6 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - bl GetMonData - cmp r0, 0 - bne _080CB932 - ldr r0, [r7] - adds r0, r5 - adds r0, r4 - ldr r2, [r0] - ldrb r1, [r2, 0x1] - movs r3, 0xD - negs r3, r3 - adds r0, r3, 0 - ands r1, r0 - movs r0, 0x4 - orrs r1, r0 - strb r1, [r2, 0x1] -_080CB932: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x5 - bls _080CB8FA -_080CB93C: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB7E8 - - thumb_func_start sub_80CB950 -sub_80CB950: @ 80CB950 - push {r4-r7,lr} - sub sp, 0x4 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x00000c5e - adds r1, r2 - movs r2, 0 - strb r2, [r1] - movs r5, 0 - movs r6, 0 - adds r3, r0, 0 - movs r7, 0xA7 - lsls r7, 4 -_080CB96A: - ldr r0, [r3] - lsls r4, r5, 2 - adds r0, r7 - adds r0, r4 - ldr r0, [r0] - cmp r0, 0 - beq _080CB9A0 - cmp r5, r6 - beq _080CB99A - adds r1, r6, 0 - str r3, [sp] - bl sub_80CB9D0 - ldr r3, [sp] - ldr r2, [r3] - adds r0, r2, r7 - adds r0, r4 - movs r1, 0 - str r1, [r0] - ldr r0, =0x00000c5e - adds r2, r0 - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] -_080CB99A: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 -_080CB9A0: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x5 - bls _080CB96A - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB950 - - thumb_func_start sub_80CB9BC -sub_80CB9BC: @ 80CB9BC - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000c5e - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80CB9BC - - thumb_func_start sub_80CB9D0 -sub_80CB9D0: @ 80CB9D0 - push {r4,lr} - adds r2, r0, 0 - lsls r1, 16 - lsrs r1, 16 - strh r1, [r2, 0x30] - cmp r1, 0 - bne _080CB9E4 - movs r3, 0x68 - movs r4, 0x40 - b _080CB9F6 -_080CB9E4: - movs r3, 0x98 - subs r1, 0x1 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 19 - movs r1, 0x80 - lsls r1, 13 - adds r0, r1 - lsrs r4, r0, 16 -_080CB9F6: - ldrh r0, [r2, 0x20] - lsls r0, 3 - strh r0, [r2, 0x32] - ldrh r0, [r2, 0x22] - lsls r0, 3 - strh r0, [r2, 0x34] - lsls r1, r3, 3 - movs r3, 0x32 - ldrsh r0, [r2, r3] - subs r0, r1, r0 - cmp r0, 0 - bge _080CBA10 - adds r0, 0x7 -_080CBA10: - asrs r0, 3 - strh r0, [r2, 0x36] - lsls r0, r4, 16 - asrs r0, 13 - movs r3, 0x34 - ldrsh r1, [r2, r3] - subs r0, r1 - cmp r0, 0 - bge _080CBA24 - adds r0, 0x7 -_080CBA24: - asrs r0, 3 - strh r0, [r2, 0x38] - movs r0, 0x8 - strh r0, [r2, 0x3A] - ldr r0, =sub_80CBA3C - str r0, [r2, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB9D0 - - thumb_func_start sub_80CBA3C -sub_80CBA3C: @ 80CBA3C - push {r4,lr} - adds r3, r0, 0 - ldrh r2, [r3, 0x3A] - movs r1, 0x3A - ldrsh r0, [r3, r1] - cmp r0, 0 - beq _080CBA6C - ldrh r0, [r3, 0x36] - ldrh r4, [r3, 0x32] - adds r0, r4 - strh r0, [r3, 0x32] - ldrh r1, [r3, 0x38] - ldrh r4, [r3, 0x34] - adds r1, r4 - strh r1, [r3, 0x34] - lsls r0, 16 - asrs r0, 19 - strh r0, [r3, 0x20] - lsls r1, 16 - asrs r1, 19 - strh r1, [r3, 0x22] - subs r0, r2, 0x1 - strh r0, [r3, 0x3A] - b _080CBAB2 -_080CBA6C: - movs r1, 0x30 - ldrsh r0, [r3, r1] - cmp r0, 0 - bne _080CBA7C - movs r0, 0x68 - strh r0, [r3, 0x20] - movs r0, 0x40 - b _080CBA8E -_080CBA7C: - movs r0, 0x98 - strh r0, [r3, 0x20] - movs r4, 0x30 - ldrsh r1, [r3, r4] - subs r1, 0x1 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - adds r0, 0x10 -_080CBA8E: - strh r0, [r3, 0x22] - ldr r0, =SpriteCallbackDummy - str r0, [r3, 0x1C] - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - movs r0, 0x30 - ldrsh r1, [r3, r0] - lsls r1, 2 - movs r4, 0xA7 - lsls r4, 4 - adds r0, r2, r4 - adds r0, r1 - str r3, [r0] - ldr r0, =0x00000c5e - adds r2, r0 - ldrb r0, [r2] - subs r0, 0x1 - strb r0, [r2] -_080CBAB2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CBA3C - - thumb_func_start sub_80CBAC4 -sub_80CBAC4: @ 80CBAC4 - push {r4,lr} - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r1, =0x00000a6c - adds r0, r1 - ldr r0, [r0] - cmp r0, 0 - beq _080CBAE2 - bl sub_80CC314 - ldr r0, [r4] - ldr r1, =0x00000a6c - adds r0, r1 - movs r1, 0 - str r1, [r0] -_080CBAE2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CBAC4 - - thumb_func_start sub_80CBAF0 -sub_80CBAF0: @ 80CBAF0 - push {r4-r6,lr} - movs r3, 0 - ldr r6, =gUnknown_02039D08 - lsls r0, 16 - asrs r4, r0, 16 - movs r5, 0x5 - negs r5, r5 -_080CBAFE: - ldr r0, [r6] - lsls r1, r3, 2 - movs r2, 0xA7 - lsls r2, 4 - adds r0, r2 - adds r2, r0, r1 - ldr r1, [r2] - cmp r1, 0 - beq _080CBB56 - ldrh r0, [r1, 0x22] - adds r0, r4, r0 - strh r0, [r1, 0x22] - ldr r2, [r2] - ldrh r1, [r2, 0x26] - ldrh r0, [r2, 0x22] - adds r1, r0 - adds r0, r2, 0 - adds r0, 0x29 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - adds r0, r1 - lsls r0, 16 - movs r1, 0x80 - lsls r1, 13 - adds r0, r1 - lsrs r0, 16 - cmp r0, 0xC0 - bls _080CBB4C - adds r0, r2, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - b _080CBB56 - .pool -_080CBB4C: - adds r2, 0x3E - ldrb r1, [r2] - adds r0, r5, 0 - ands r0, r1 - strb r0, [r2] -_080CBB56: - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0x5 - bls _080CBAFE - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80CBAF0 - - thumb_func_start sub_80CBB68 -sub_80CBB68: @ 80CBB68 - push {r4,r5,lr} - lsls r0, 24 - ldr r5, =gUnknown_02039D08 - ldr r1, [r5] - lsrs r4, r0, 22 - movs r0, 0xA7 - lsls r0, 4 - adds r1, r0 - adds r1, r4 - ldr r0, [r1] - cmp r0, 0 - beq _080CBB92 - bl sub_80CC314 - ldr r0, [r5] - movs r1, 0xA7 - lsls r1, 4 - adds r0, r1 - adds r0, r4 - movs r1, 0 - str r1, [r0] -_080CBB92: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CBB68 - - thumb_func_start sub_80CBB9C -sub_80CBB9C: @ 80CBB9C - push {r4-r6,lr} - movs r5, 0 - ldr r6, =gUnknown_02039D08 -_080CBBA2: - ldr r0, [r6] - lsls r4, r5, 2 - movs r1, 0xA7 - lsls r1, 4 - adds r0, r1 - adds r0, r4 - ldr r0, [r0] - cmp r0, 0 - beq _080CBBC6 - bl sub_80CC314 - ldr r0, [r6] - movs r1, 0xA7 - lsls r1, 4 - adds r0, r1 - adds r0, r4 - movs r1, 0 - str r1, [r0] -_080CBBC6: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x5 - bls _080CBBA2 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CBB9C - - thumb_func_start sub_80CBBDC -sub_80CBBDC: @ 80CBBDC - push {lr} - lsls r0, 24 - lsls r1, 24 - lsrs r2, r1, 24 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - lsrs r0, 22 - movs r3, 0xA7 - lsls r3, 4 - adds r1, r3 - adds r1, r0 - ldr r3, [r1] - cmp r3, 0 - beq _080CBC0C - movs r0, 0x3 - adds r1, r2, 0 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r3, 0x1] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x1] -_080CBC0C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CBBDC - - thumb_func_start sub_80CBC14 -sub_80CBC14: @ 80CBC14 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r1, 24 - adds r5, r1, 0 - cmp r4, 0 - bne _080CBC44 - ldr r3, =gUnknown_02039D08 - ldr r0, [r3] - ldr r5, =0x00000a6c - adds r2, r0, r5 - lsls r1, 2 - adds r5, 0x4 - adds r0, r5 - adds r0, r1 - ldr r1, [r0] - str r1, [r2] - str r4, [r0] - b _080CBC60 - .pool -_080CBC44: - cmp r4, 0x1 - bne _080CBC96 - ldr r3, =gUnknown_02039D08 - ldr r0, [r3] - ldr r1, =0x00000a6c - adds r2, r0, r1 - lsls r1, r5, 2 - ldr r4, =0x00000a88 - adds r0, r4 - adds r0, r1 - ldr r1, [r0] - str r1, [r2] - movs r1, 0 - str r1, [r0] -_080CBC60: - adds r5, r3, 0 - ldr r0, [r5] - ldr r4, =0x00000a6c - adds r0, r4 - ldr r1, [r0] - ldr r0, =sub_80CC100 - str r0, [r1, 0x1C] - bl sub_80CAFAC - ldr r1, [r5] - adds r1, r4 - ldr r3, [r1] - movs r1, 0x3 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r3, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x5] - ldr r0, [r5] - adds r0, r4 - ldr r0, [r0] - adds r0, 0x43 - movs r1, 0x7 - strb r1, [r0] -_080CBC96: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CBC14 - - thumb_func_start sub_80CBCAC -sub_80CBCAC: @ 80CBCAC - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r6, r1, 24 - cmp r0, 0xE - bne _080CBCF8 - ldr r3, =gUnknown_02039D08 - ldr r1, [r3] - lsls r5, r6, 2 - movs r4, 0xA7 - lsls r4, 4 - adds r0, r1, r4 - adds r0, r5 - ldr r2, =0x00000a6c - adds r1, r2 - ldr r2, [r1] - str r2, [r0] - ldrb r1, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2, 0x5] - ldr r0, [r3] - adds r0, r4 - adds r0, r5 - ldr r0, [r0] - adds r0, 0x43 - movs r1, 0xC - strb r1, [r0] - b _080CBD34 - .pool -_080CBCF8: - ldr r5, =gUnknown_02039D08 - ldr r1, [r5] - lsls r4, r6, 2 - ldr r3, =0x00000a88 - adds r0, r1, r3 - adds r0, r4 - ldr r2, =0x00000a6c - adds r1, r2 - ldr r2, [r1] - str r2, [r0] - ldrb r1, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - movs r1, 0x8 - orrs r0, r1 - strb r0, [r2, 0x5] - ldr r0, [r5] - adds r0, r3 - adds r0, r4 - ldr r4, [r0] - adds r0, r6, 0 - movs r1, 0x6 - bl __umodsi3 - movs r1, 0x13 - subs r1, r0 - adds r4, 0x43 - strb r1, [r4] - adds r3, r5, 0 -_080CBD34: - ldr r1, [r3] - ldr r0, =0x00000a6c - adds r1, r0 - ldr r2, [r1] - ldr r0, =SpriteCallbackDummy - str r0, [r2, 0x1C] - movs r0, 0 - str r0, [r1] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CBCAC - - thumb_func_start sub_80CBD5C -sub_80CBD5C: @ 80CBD5C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - cmp r0, 0xE - bne _080CBD80 - ldr r3, =gUnknown_02039D08 - ldr r1, [r3] - movs r0, 0xB0 - lsls r0, 4 - adds r2, r1, r0 - lsls r0, r4, 2 - movs r4, 0xA7 - lsls r4, 4 - b _080CBD8E - .pool -_080CBD80: - ldr r3, =gUnknown_02039D08 - ldr r1, [r3] - movs r0, 0xB0 - lsls r0, 4 - adds r2, r1, r0 - lsls r0, r4, 2 - ldr r4, =0x00000a88 -_080CBD8E: - adds r0, r4 - adds r1, r0 - str r1, [r2] - ldr r1, [r3] - ldr r2, =0x00000a6c - adds r0, r1, r2 - ldr r2, [r0] - ldr r0, =SpriteCallbackDummy - str r0, [r2, 0x1C] - ldr r4, =0x00000c5d - adds r1, r4 - movs r0, 0 - strb r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CBD5C - - thumb_func_start sub_80CBDC4 -sub_80CBDC4: @ 80CBDC4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r6, =gUnknown_02039D08 - ldr r0, [r6] - ldr r1, =0x00000c5d - mov r9, r1 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0x10 - bne _080CBDE8 - movs r0, 0 - b _080CBEF4 - .pool -_080CBDE8: - adds r0, 0x1 - strb r0, [r1] - ldr r2, [r6] - ldr r5, =0x00000c5d - adds r0, r2, r5 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080CBE18 - movs r1, 0xB0 - lsls r1, 4 - adds r0, r2, r1 - ldr r0, [r0] - ldr r1, [r0] - ldrh r0, [r1, 0x22] - subs r0, 0x1 - strh r0, [r1, 0x22] - ldr r5, =0x00000a6c - adds r0, r2, r5 - ldr r1, [r0] - ldrh r0, [r1, 0x22] - adds r0, 0x1 - strh r0, [r1, 0x22] -_080CBE18: - ldr r3, [r6] - movs r7, 0xB0 - lsls r7, 4 - adds r4, r3, r7 - ldr r0, [r4] - ldr r0, [r0] - mov r8, r0 - ldr r5, =gSineTable - mov r0, r9 - adds r1, r3, r0 - ldrb r0, [r1] - lsls r0, 4 - adds r0, r5 - movs r2, 0 - ldrsh r0, [r0, r2] - cmp r0, 0 - bge _080CBE3C - adds r0, 0xF -_080CBE3C: - asrs r0, 4 - mov r2, r8 - strh r0, [r2, 0x24] - ldr r0, =0x00000a6c - mov r8, r0 - add r3, r8 - ldr r2, [r3] - ldrb r0, [r1] - lsls r0, 4 - adds r0, r5 - movs r5, 0 - ldrsh r0, [r0, r5] - cmp r0, 0 - bge _080CBE5A - adds r0, 0xF -_080CBE5A: - asrs r0, 4 - negs r0, r0 - strh r0, [r2, 0x24] - ldrb r0, [r1] - cmp r0, 0x8 - bne _080CBEBE - ldr r3, [r3] - ldr r0, [r4] - ldr r0, [r0] - ldrb r0, [r0, 0x5] - movs r5, 0x3 - movs r1, 0xC - ands r1, r0 - ldrb r2, [r3, 0x5] - movs r4, 0xD - negs r4, r4 - adds r0, r4, 0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x5] - ldr r0, [r6] - mov r2, r8 - adds r1, r0, r2 - ldr r1, [r1] - adds r0, r7 - ldr r0, [r0] - ldr r0, [r0] - adds r0, 0x43 - ldrb r0, [r0] - adds r1, 0x43 - strb r0, [r1] - bl sub_80CAFAC - ldr r1, [r6] - adds r1, r7 - ldr r1, [r1] - ldr r1, [r1] - ands r5, r0 - lsls r5, 2 - ldrb r0, [r1, 0x5] - ands r4, r0 - orrs r4, r5 - strb r4, [r1, 0x5] - ldr r0, [r6] - adds r0, r7 - ldr r0, [r0] - ldr r0, [r0] - adds r0, 0x43 - movs r1, 0x7 - strb r1, [r0] -_080CBEBE: - ldr r1, [r6] - mov r5, r9 - adds r0, r1, r5 - ldrb r0, [r0] - cmp r0, 0x10 - bne _080CBEF2 - mov r0, r8 - adds r2, r1, r0 - ldr r3, [r2] - adds r1, r7 - ldr r0, [r1] - ldr r0, [r0] - str r0, [r2] - ldr r0, [r1] - str r3, [r0] - ldr r1, [r6] - mov r2, r8 - adds r0, r1, r2 - ldr r2, [r0] - ldr r0, =sub_80CC100 - str r0, [r2, 0x1C] - adds r1, r7 - ldr r0, [r1] - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - str r0, [r1, 0x1C] -_080CBEF2: - movs r0, 0x1 -_080CBEF4: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CBDC4 - - thumb_func_start sub_80CBF14 -sub_80CBF14: @ 80CBF14 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - adds r2, r0, 0 - lsls r1, 24 - lsrs r4, r1, 24 - cmp r0, 0x1 - beq _080CBF4C - cmp r0, 0x1 - bgt _080CBF2E - cmp r0, 0 - beq _080CBF34 - b _080CBFC0 -_080CBF2E: - cmp r2, 0x2 - beq _080CBF70 - b _080CBFC0 -_080CBF34: - ldr r3, =gUnknown_02039D08 - ldr r1, [r3] - ldr r0, =0x00000b04 - adds r2, r1, r0 - lsls r0, r4, 2 - movs r4, 0xA7 - lsls r4, 4 - b _080CBF58 - .pool -_080CBF4C: - ldr r3, =gUnknown_02039D08 - ldr r1, [r3] - ldr r0, =0x00000b04 - adds r2, r1, r0 - lsls r0, r4, 2 - ldr r4, =0x00000a88 -_080CBF58: - adds r0, r4 - adds r1, r0 - str r1, [r2] - adds r4, r3, 0 - b _080CBF80 - .pool -_080CBF70: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r3, =0x00000b04 - adds r2, r1, r3 - ldr r4, =0x00000a6c - adds r1, r4 - str r1, [r2] - adds r4, r0, 0 -_080CBF80: - ldr r0, [r4] - ldr r1, =0x00000b04 - adds r0, r1 - ldr r0, [r0] - ldr r0, [r0] - cmp r0, 0 - beq _080CBFC0 - bl InitSpriteAffineAnim - ldr r0, [r4] - ldr r3, =0x00000b04 - adds r0, r3 - ldr r0, [r0] - ldr r2, [r0] - ldrb r1, [r2, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x1] - ldr r1, [r4] - adds r1, r3 - ldr r0, [r1] - ldr r2, [r0] - ldr r0, =gSpriteAffineAnimTable_857291C - str r0, [r2, 0x10] - ldr r0, [r1] - ldr r0, [r0] - movs r1, 0 - bl StartSpriteAffineAnim -_080CBFC0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CBF14 - - thumb_func_start sub_80CBFD8 -sub_80CBFD8: @ 80CBFD8 - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000b04 - adds r0, r1 - ldr r0, [r0] - ldr r1, [r0] - cmp r1, 0 - beq _080CBFF8 - adds r3, r1, 0 - adds r3, 0x3E - ldrb r2, [r3] - movs r0, 0x4 - ands r0, r2 - cmp r0, 0 - beq _080CC004 -_080CBFF8: - movs r0, 0 - b _080CC01A - .pool -_080CC004: - adds r0, r1, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080CC018 - movs r0, 0x4 - orrs r0, r2 - strb r0, [r3] -_080CC018: - movs r0, 0x1 -_080CC01A: - pop {r1} - bx r1 - thumb_func_end sub_80CBFD8 - - thumb_func_start sub_80CC020 -sub_80CC020: @ 80CC020 - push {r4,lr} - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r1, =0x00000b04 - adds r0, r1 - ldr r0, [r0] - ldr r0, [r0] - cmp r0, 0 - beq _080CC056 - ldrb r0, [r0, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - ldr r0, [r4] - ldr r1, =0x00000b04 - adds r0, r1 - ldr r0, [r0] - ldr r0, [r0] - bl sub_80CC314 - ldr r0, [r4] - ldr r1, =0x00000b04 - adds r0, r1 - ldr r1, [r0] - movs r0, 0 - str r0, [r1] -_080CC056: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CC020 - - thumb_func_start sub_80CC064 -sub_80CC064: @ 80CC064 - push {lr} - ldr r3, =gUnknown_02039D08 - ldr r0, [r3] - ldr r1, =0x00000b04 - adds r0, r1 - ldr r0, [r0] - ldr r0, [r0] - cmp r0, 0 - beq _080CC094 - adds r2, r0, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldr r0, [r3] - ldr r1, =0x00000b04 - adds r0, r1 - ldr r0, [r0] - ldr r0, [r0] - movs r1, 0x1 - bl StartSpriteAffineAnim -_080CC094: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CC064 - - thumb_func_start sub_80CC0A0 -sub_80CC0A0: @ 80CC0A0 - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000b04 - adds r2, r0, r1 - ldr r0, [r2] - cmp r0, 0 - bne _080CC0BC - movs r0, 0 - b _080CC0D0 - .pool -_080CC0BC: - ldr r0, [r0] - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080CC0CE - movs r0, 0 - str r0, [r2] -_080CC0CE: - movs r0, 0x1 -_080CC0D0: - pop {r1} - bx r1 - thumb_func_end sub_80CC0A0 - - thumb_func_start sub_80CC0D4 -sub_80CC0D4: @ 80CC0D4 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - ldr r2, =0x00000a6c - adds r1, r2 - ldr r3, [r1] - movs r1, 0x3 - ands r0, r1 - lsls r0, 2 - ldrb r2, [r3, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x5] - bx lr - .pool - thumb_func_end sub_80CC0D4 - - thumb_func_start sub_80CC100 -sub_80CC100: @ 80CC100 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - ldr r2, =0x00000cb4 - adds r1, r2 - ldr r2, [r1] - ldrh r2, [r2, 0x20] - strh r2, [r0, 0x20] - ldr r2, [r1] - ldrh r1, [r2, 0x26] - ldrh r2, [r2, 0x22] - adds r1, r2 - adds r1, 0x4 - strh r1, [r0, 0x22] - bx lr - .pool - thumb_func_end sub_80CC100 - - thumb_func_start sub_80CC124 -sub_80CC124: @ 80CC124 - push {r4-r6,lr} - lsls r0, 16 - lsrs r3, r0, 16 - movs r4, 0 - ldr r1, =gUnknown_02039D08 - ldr r0, [r1] - ldr r2, =0x00000b58 - adds r0, r2 - ldrh r0, [r0] - adds r2, r1, 0 - cmp r0, r3 - beq _080CC158 - adds r6, r2, 0 - ldr r5, =0x00000b58 -_080CC140: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x27 - bhi _080CC158 - ldr r0, [r6] - lsls r1, r4, 1 - adds r0, r5 - adds r0, r1 - ldrh r0, [r0] - cmp r0, r3 - bne _080CC140 -_080CC158: - cmp r4, 0x28 - bne _080CC198 - movs r4, 0 - ldr r0, [r2] - ldr r5, =0x00000b58 - adds r0, r5 - ldrh r0, [r0] - cmp r0, 0 - beq _080CC184 - adds r6, r2, 0 -_080CC16C: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x27 - bhi _080CC184 - ldr r0, [r6] - lsls r1, r4, 1 - adds r0, r5 - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0 - bne _080CC16C -_080CC184: - cmp r4, 0x28 - bne _080CC198 - ldr r0, =0x0000ffff - b _080CC1CA - .pool -_080CC198: - ldr r1, [r2] - lsls r2, r4, 1 - ldr r5, =0x00000b58 - adds r0, r1, r5 - adds r0, r2 - strh r3, [r0] - ldr r0, =0x00000b08 - adds r1, r0 - adds r1, r2 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - lsls r4, 20 - lsrs r4, 16 - adds r0, r3, 0 - movs r1, 0x1 - bl GetMonIconTiles - lsls r1, r4, 5 - ldr r2, =0x06010000 - adds r1, r2 - ldr r2, =0x04000080 - bl CpuSet - adds r0, r4, 0 -_080CC1CA: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CC124 - - thumb_func_start sub_80CC1E0 -sub_80CC1E0: @ 80CC1E0 - push {r4-r6,lr} - lsls r0, 16 - lsrs r5, r0, 16 - movs r3, 0 - ldr r6, =gUnknown_02039D08 -_080CC1EA: - ldr r1, [r6] - lsls r2, r3, 1 - ldr r4, =0x00000b58 - adds r0, r1, r4 - adds r4, r0, r2 - ldrh r0, [r4] - cmp r0, r5 - bne _080CC220 - ldr r0, =0x00000b08 - adds r1, r0 - adds r1, r2 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _080CC22A - strh r0, [r4] - b _080CC22A - .pool -_080CC220: - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0x27 - bls _080CC1EA -_080CC22A: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80CC1E0 - - thumb_func_start sub_80CC230 -sub_80CC230: @ 80CC230 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x1C - ldr r4, [sp, 0x3C] - ldr r5, [sp, 0x40] - lsls r0, 16 - lsrs r6, r0, 16 - lsls r2, 16 - lsrs r2, 16 - str r2, [sp, 0x18] - lsls r3, 16 - lsrs r3, 16 - mov r8, r3 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - mov r9, r5 - mov r2, sp - ldr r0, =gUnknown_085728D4 - ldm r0!, {r3,r5,r7} - stm r2!, {r3,r5,r7} - ldm r0!, {r3,r5,r7} - stm r2!, {r3,r5,r7} - adds r0, r6, 0 - bl mon_icon_convert_unown_species_id - mov r10, r0 - mov r6, r10 - mov r2, sp - ldr r1, =gMonIconPaletteIndices - adds r1, r6, r1 - ldr r3, =0x0000dac0 - adds r0, r3, 0 - ldrb r1, [r1] - adds r0, r1 - strh r0, [r2, 0x2] - adds r0, r6, 0 - bl sub_80CC124 - lsls r0, 16 - lsrs r0, 16 - adds r5, r0, 0 - ldr r0, =0x0000ffff - cmp r5, r0 - beq _080CC302 - ldr r7, [sp, 0x18] - lsls r1, r7, 16 - asrs r1, 16 - mov r0, r8 - lsls r2, r0, 16 - asrs r2, 16 - mov r0, sp - mov r3, r9 - bl CreateSprite - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x40 - beq _080CC2FC - ldr r1, =gSprites - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldr r2, =0x000003ff - ands r2, r5 - ldrh r3, [r0, 0x4] - ldr r1, =0xfffffc00 - ands r1, r3 - orrs r1, r2 - strh r1, [r0, 0x4] - movs r1, 0x3 - ands r4, r1 - lsls r3, r4, 2 - ldrb r2, [r0, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r2 - orrs r1, r3 - strb r1, [r0, 0x5] - mov r1, r10 - strh r1, [r0, 0x2E] - b _080CC304 - .pool -_080CC2FC: - adds r0, r6, 0 - bl sub_80CC1E0 -_080CC302: - movs r0, 0 -_080CC304: - add sp, 0x1C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80CC230 - - thumb_func_start sub_80CC314 -sub_80CC314: @ 80CC314 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - bl sub_80CC1E0 - adds r0, r4, 0 - bl DestroySprite - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80CC314 - - thumb_func_start sub_80CC32C -sub_80CC32C: @ 80CC32C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =sub_80CC370 - movs r1, 0x2 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0xC] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CC32C - - thumb_func_start sub_80CC35C -sub_80CC35C: @ 80CC35C - push {lr} - ldr r0, =sub_80CC370 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CC35C - - thumb_func_start sub_80CC370 -sub_80CC370: @ 80CC370 - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x4 - bhi _080CC454 - lsls r0, 2 - ldr r1, =_080CC39C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080CC39C: - .4byte _080CC3B0 - .4byte _080CC3E8 - .4byte _080CC41C - .4byte _080CC426 - .4byte _080CC44C -_080CC3B0: - ldr r1, =gUnknown_02039D08 - ldr r0, [r1] - ldr r2, =0x000002d2 - adds r0, r2 - movs r2, 0 - strb r2, [r0] - ldr r1, [r1] - movs r3, 0xB3 - lsls r3, 2 - adds r0, r1, r3 - strh r2, [r0] - ldr r0, =0x00004ac4 - adds r1, r0 - movs r2, 0x80 - lsls r2, 5 - movs r0, 0 - movs r3, 0x1 - bl RequestDma3Fill - strh r0, [r4, 0xA] - b _080CC458 - .pool -_080CC3E8: - movs r1, 0xA - ldrsh r0, [r4, r1] - bl CheckForSpaceForDma3Request - lsls r0, 16 - asrs r0, 16 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - beq _080CC45E - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x00004ac4 - adds r1, r2 - movs r0, 0x2 - bl SetBgTilemapBuffer - movs r0, 0x2 - bl ShowBg - b _080CC458 - .pool -_080CC41C: - ldrb r0, [r4, 0xC] - movs r1, 0 - bl sub_80CC7A0 - b _080CC458 -_080CC426: - bl sub_80CCA00 - cmp r0, 0 - beq _080CC45E - ldrb r0, [r4, 0xC] - bl sub_80CCB50 - bl sub_80CD02C - ldrb r0, [r4, 0xC] - bl sub_80CB028 - ldr r1, =0x00005b0a - movs r0, 0xC - bl SetGpuReg - b _080CC458 - .pool -_080CC44C: - adds r0, r2, 0 - bl DestroyTask - b _080CC458 -_080CC454: - movs r0, 0 - b _080CC45C -_080CC458: - ldrh r0, [r4, 0x8] - adds r0, 0x1 -_080CC45C: - strh r0, [r4, 0x8] -_080CC45E: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80CC370 - - thumb_func_start sub_80CC464 -sub_80CC464: @ 80CC464 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r4, r0, 24 - mov r8, r4 - adds r0, r4, 0 - bl sub_80CC644 - lsls r0, 24 - lsrs r0, 24 - adds r6, r0, 0 - ldr r5, =gUnknown_02039D08 - ldr r2, [r5] - lsls r0, r6, 24 - asrs r3, r0, 24 - movs r0, 0x6 - negs r0, r0 - adds r1, r0, 0 - cmp r3, 0 - ble _080CC490 - movs r1, 0x6 -_080CC490: - ldr r7, =0x000002ce - adds r0, r2, r7 - strh r1, [r0] - movs r1, 0x2 - cmp r3, 0 - ble _080CC49E - movs r1, 0x1 -_080CC49E: - ldr r7, =0x000002d3 - adds r0, r2, r7 - strb r1, [r0] - ldr r2, [r5] - movs r0, 0xB4 - lsls r0, 2 - adds r1, r2, r0 - movs r0, 0x20 - strh r0, [r1] - movs r1, 0xB5 - lsls r1, 2 - adds r0, r2, r1 - strb r4, [r0] - ldr r2, [r5] - movs r1, 0 - cmp r3, 0 - bgt _080CC4C2 - movs r1, 0x5 -_080CC4C2: - ldr r4, =0x000002d6 - adds r0, r2, r4 - strh r1, [r0] - movs r7, 0xB6 - lsls r7, 2 - adds r0, r2, r7 - strh r3, [r0] - movs r1, 0x38 - cmp r3, 0 - ble _080CC4DC - movs r0, 0x84 - lsls r0, 1 - adds r1, r0, 0 -_080CC4DC: - ldr r4, =0x000002da - adds r0, r2, r4 - strh r1, [r0] - movs r1, 0 - cmp r3, 0 - bgt _080CC4EA - movs r1, 0x5 -_080CC4EA: - movs r7, 0xB7 - lsls r7, 2 - adds r0, r2, r7 - strh r1, [r0] - ldr r0, =0x000002de - adds r1, r2, r0 - movs r0, 0 - strh r0, [r1] - movs r3, 0xB8 - lsls r3, 2 - adds r1, r2, r3 - movs r0, 0x2 - strh r0, [r1] - ldr r4, =0x00000a64 - adds r0, r2, r4 - mov r7, r8 - strb r7, [r0] - ldr r0, [r5] - ldr r1, =0x00000a65 - adds r0, r1 - strb r6, [r0] - ldr r0, [r5] - ldr r3, =0x00000a63 - adds r0, r3 - movs r1, 0 - strb r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CC464 - - thumb_func_start ScrollToBox -ScrollToBox: @ 80CC54C - push {r4-r6,lr} - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - ldr r5, =0x00000a63 - adds r0, r1, r5 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080CC594 - cmp r0, 0x1 - bgt _080CC570 - cmp r0, 0 - beq _080CC576 - b _080CC624 - .pool -_080CC570: - cmp r0, 0x2 - beq _080CC5E4 - b _080CC624 -_080CC576: - ldr r2, =0x00000a64 - adds r0, r1, r2 - ldrb r0, [r0] - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - bl sub_80CC7A0 - ldr r1, [r4] - adds r1, r5 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080CC594: - bl sub_80CCA00 - cmp r0, 0 - beq _080CC632 - ldr r6, =gUnknown_02039D08 - ldr r1, [r6] - ldr r4, =0x00000a64 - adds r0, r1, r4 - ldrb r0, [r0] - ldr r5, =0x00000a65 - adds r1, r5 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - bl sub_80CB4CC - ldr r1, [r6] - adds r4, r1, r4 - ldrb r0, [r4] - adds r1, r5 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - bl sub_80CCCFC - ldr r0, [r6] - adds r0, r5 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - bl sub_80CD0B8 - b _080CC624 - .pool -_080CC5E4: - bl sub_80CB584 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r2, [r4] - movs r4, 0xB4 - lsls r4, 2 - adds r3, r2, r4 - ldrh r0, [r3] - cmp r0, 0 - beq _080CC620 - movs r0, 0xB3 - lsls r0, 2 - adds r1, r2, r0 - subs r4, 0x2 - adds r0, r2, r4 - ldrh r0, [r0] - ldrh r2, [r1] - adds r0, r2 - strh r0, [r1] - ldrh r0, [r3] - subs r0, 0x1 - strh r0, [r3] - lsls r0, 16 - cmp r0, 0 - bne _080CC632 - bl sub_80CCEE0 - bl sub_80CD158 -_080CC620: - adds r0, r5, 0 - b _080CC634 -_080CC624: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r4, =0x00000a63 - adds r1, r4 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080CC632: - movs r0, 0x1 -_080CC634: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end ScrollToBox - - thumb_func_start sub_80CC644 -sub_80CC644: @ 80CC644 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r1, r0, 24 - movs r2, 0 - cmp r1, r4 - beq _080CC66E -_080CC658: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xD - bls _080CC664 - movs r1, 0 -_080CC664: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r1, r4 - bne _080CC658 -_080CC66E: - movs r0, 0x1 - negs r0, r0 - cmp r2, 0x6 - bhi _080CC678 - movs r0, 0x1 -_080CC678: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80CC644 - - thumb_func_start SetWallpaperForCurrentBox -SetWallpaperForCurrentBox: @ 80CC680 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl SetBoxWallpaper - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000a62 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end SetWallpaperForCurrentBox - - thumb_func_start DoWallpaperGfxChange -DoWallpaperGfxChange: @ 80CC6B0 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gUnknown_02039D08 - ldr r0, [r1] - ldr r2, =0x00000a62 - adds r0, r2 - ldrb r0, [r0] - adds r4, r1, 0 - cmp r0, 0x4 - bhi _080CC794 - lsls r0, 2 - ldr r1, =_080CC6DC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080CC6DC: - .4byte _080CC6F0 - .4byte _080CC718 - .4byte _080CC732 - .4byte _080CC76C - .4byte _080CC790 -_080CC6F0: - ldr r0, [r4] - movs r1, 0xE7 - lsls r1, 3 - adds r0, r1 - ldr r0, [r0] - ldr r1, =0x0000ffff - str r1, [sp] - movs r1, 0x1 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, [r4] - ldr r2, =0x00000a62 - adds r1, r2 - b _080CC77E - .pool -_080CC718: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _080CC794 - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl sub_80CC7A0 - b _080CC776 -_080CC732: - bl sub_80CCA00 - cmp r0, 0x1 - bne _080CC794 - bl sub_80CCF9C - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - movs r1, 0xE7 - lsls r1, 3 - adds r0, r1 - ldr r0, [r0] - ldr r1, =0x0000ffff - str r1, [sp] - movs r1, 0x1 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r1, [r4] - ldr r2, =0x00000a62 - adds r1, r2 - b _080CC77E - .pool -_080CC76C: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _080CC794 -_080CC776: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r0, =0x00000a62 - adds r1, r0 -_080CC77E: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080CC794 - .pool -_080CC790: - movs r0, 0 - b _080CC796 -_080CC794: - movs r0, 0x1 -_080CC796: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end DoWallpaperGfxChange - - thumb_func_start sub_80CC7A0 -sub_80CC7A0: @ 80CC7A0 - push {r4-r7,lr} - sub sp, 0x8 - ldr r4, =gUnknown_02039D08 - ldr r2, [r4] - ldr r3, =0x000006f9 - adds r2, r3 - movs r3, 0 - strb r3, [r2] - ldr r2, [r4] - ldr r3, =0x000006fa - adds r2, r3 - strb r0, [r2] - ldr r0, [r4] - ldr r2, =0x000006fb - adds r0, r2 - strb r1, [r0] - ldr r1, [r4] - adds r2, r1, r2 - movs r0, 0 - ldrsb r0, [r2, r0] - cmp r0, 0 - beq _080CC7E6 - movs r3, 0 - ldr r0, =0x000002d2 - adds r2, r1, r0 - ldrb r0, [r2] - cmp r0, 0 - bne _080CC7DA - movs r3, 0x1 -_080CC7DA: - strb r3, [r2] - ldr r0, [r4] - ldr r1, =0x00004ac4 - adds r0, r1 - bl sub_80CCAE0 -_080CC7E6: - ldr r7, =gUnknown_02039D08 - ldr r0, [r7] - ldr r2, =0x000006fa - adds r0, r2 - ldrb r0, [r0] - bl sub_80D20F8 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x10 - beq _080CC8C4 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - ldr r1, =gWallpaperTable - adds r6, r0, r1 - ldr r0, [r6, 0x4] - ldr r1, [r7] - ldr r5, =0x00000792 - adds r1, r5 - bl LZ77UnCompWram - ldr r0, [r7] - adds r5, r0, r5 - ldr r4, =0x000006fb - adds r1, r0, r4 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - ldr r3, =0x000002d2 - adds r0, r3 - ldrb r2, [r0] - adds r0, r5, 0 - bl sub_80CCA3C - ldr r1, [r7] - adds r4, r1, r4 - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0 - beq _080CC874 - ldr r0, [r6, 0x8] - ldr r2, =0x000002d2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 21 - movs r3, 0x80 - lsls r3, 15 - adds r1, r3 - lsrs r1, 16 - movs r2, 0x40 - bl LoadPalette - b _080CC888 - .pool -_080CC874: - ldr r0, [r6, 0x8] - ldr r2, =0x000002d2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 6 - ldr r2, =gPlttBufferUnfaded + 0x80 - adds r1, r2 - movs r2, 0x20 - bl CpuSet -_080CC888: - ldr r0, [r6] - mov r1, sp - bl malloc_and_decompress - adds r1, r0, 0 - ldr r0, =gUnknown_02039D08 - ldr r3, [r0] - ldr r2, =0x00000a68 - adds r0, r3, r2 - str r1, [r0] - ldr r2, [sp] - lsls r2, 16 - lsrs r2, 16 - ldr r0, =0x000002d2 - adds r3, r0 - ldrb r3, [r3] - lsls r3, 8 - movs r0, 0x2 - bl LoadBgTiles - b _080CC9DA - .pool -_080CC8C4: - bl GetWaldaWallpaperPatternId - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - ldr r0, =gUnknown_0857AF44 - adds r6, r1, r0 - ldr r0, [r6, 0x4] - ldr r1, [r7] - ldr r4, =0x00000792 - adds r1, r4 - bl LZ77UnCompWram - ldr r2, [r7] - adds r0, r2, r4 - ldr r5, =0x000006fb - adds r1, r2, r5 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - ldr r3, =0x000002d2 - adds r2, r3 - ldrb r2, [r2] - bl sub_80CCA3C - ldr r0, [r6, 0x8] - ldr r1, [r7] - adds r1, r4 - movs r2, 0x20 - bl CpuSet - bl GetWaldaWallpaperColorsPtr - ldr r1, [r7] - ldr r2, =0x00000794 - adds r1, r2 - movs r2, 0x2 - bl CpuSet - bl GetWaldaWallpaperColorsPtr - ldr r1, [r7] - ldr r3, =0x000007b4 - adds r1, r3 - movs r2, 0x2 - bl CpuSet - ldr r1, [r7] - adds r5, r1, r5 - movs r0, 0 - ldrsb r0, [r5, r0] - cmp r0, 0 - beq _080CC960 - adds r0, r1, r4 - ldr r2, =0x000002d2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 21 - movs r3, 0x80 - lsls r3, 15 - adds r1, r3 - lsrs r1, 16 - movs r2, 0x40 - bl LoadPalette - b _080CC976 - .pool -_080CC960: - ldr r2, =0x00000792 - adds r0, r1, r2 - ldr r3, =0x000002d2 - adds r1, r3 - ldrb r1, [r1] - lsls r1, 6 - ldr r2, =gPlttBufferUnfaded + 0x80 - adds r1, r2 - movs r2, 0x20 - bl CpuSet -_080CC976: - ldr r0, [r6] - mov r1, sp - bl malloc_and_decompress - ldr r6, =gUnknown_02039D08 - ldr r1, [r6] - ldr r5, =0x00000a68 - adds r1, r5 - str r0, [r1] - ldr r4, =gUnknown_0857B004 - bl GetWaldaWallpaperIconId - lsls r0, 2 - adds r0, r4 - ldr r0, [r0] - add r1, sp, 0x4 - bl malloc_and_decompress - adds r4, r0, 0 - ldr r0, [r6] - adds r0, r5 - ldr r1, [r0] - movs r0, 0x80 - lsls r0, 4 - adds r1, r0 - ldr r2, [sp, 0x4] - lsls r2, 9 - lsrs r2, 11 - movs r0, 0x80 - lsls r0, 19 - orrs r2, r0 - adds r0, r4, 0 - bl CpuSet - adds r0, r4, 0 - bl Free - ldr r0, [r6] - adds r5, r0, r5 - ldr r1, [r5] - ldr r2, [sp] - lsls r2, 16 - lsrs r2, 16 - ldr r3, =0x000002d2 - adds r0, r3 - ldrb r3, [r0] - lsls r3, 8 - movs r0, 0x2 - bl LoadBgTiles -_080CC9DA: - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CC7A0 - - thumb_func_start sub_80CCA00 -sub_80CCA00: @ 80CCA00 - push {r4,r5,lr} - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - beq _080CCA12 - movs r0, 0 - b _080CCA2E -_080CCA12: - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - ldr r1, =0x00000a68 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0 - beq _080CCA2C - bl Free - ldr r0, [r5] - ldr r1, =0x00000a68 - adds r0, r1 - str r4, [r0] -_080CCA2C: - movs r0, 0x1 -_080CCA2E: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CCA00 - - thumb_func_start sub_80CCA3C -sub_80CCA3C: @ 80CCA3C - push {r4-r7,lr} - sub sp, 0x24 - adds r5, r0, 0 - lsls r2, 24 - lsrs r2, 24 - lsls r4, r2, 17 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - movs r3, 0xB3 - lsls r3, 2 - adds r0, r3 - ldrh r3, [r0] - lsrs r3, 3 - adds r3, 0xA - lsls r1, 24 - asrs r7, r1, 24 - lsls r0, r7, 1 - adds r0, r7 - lsls r0, 3 - adds r6, r3, r0 - movs r0, 0x3F - ands r6, r0 - movs r3, 0x14 - str r3, [sp] - movs r1, 0x12 - str r1, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0x2 - str r0, [sp, 0xC] - str r3, [sp, 0x10] - str r1, [sp, 0x14] - movs r0, 0x11 - str r0, [sp, 0x18] - lsls r2, 24 - asrs r2, 16 - str r2, [sp, 0x1C] - movs r0, 0xC0 - lsls r0, 10 - adds r4, r0 - asrs r4, 16 - str r4, [sp, 0x20] - movs r0, 0x2 - adds r1, r5, 0 - movs r2, 0 - movs r3, 0 - bl CopyRectToBgTilemapBufferRect - cmp r7, 0 - beq _080CCAD2 - cmp r7, 0 - ble _080CCAB0 - lsls r0, r6, 16 - movs r1, 0xA0 - lsls r1, 13 - adds r0, r1 - b _080CCAB6 - .pool -_080CCAB0: - lsls r0, r6, 16 - ldr r3, =0xfffc0000 - adds r0, r3 -_080CCAB6: - lsrs r6, r0, 16 - lsls r2, r6, 24 - lsrs r2, 24 - movs r0, 0x4 - str r0, [sp] - movs r0, 0x12 - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0x2 - movs r1, 0 - movs r3, 0x2 - bl FillBgTilemapBufferRect -_080CCAD2: - add sp, 0x24 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CCA3C - - thumb_func_start sub_80CCAE0 -sub_80CCAE0: @ 80CCAE0 - push {r4-r6,lr} - adds r2, r0, 0 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - movs r1, 0xB3 - lsls r1, 2 - adds r0, r1 - ldrh r0, [r0] - lsrs r0, 3 - adds r3, r0, 0 - adds r3, 0x1E - movs r0, 0x3F - ands r3, r0 - adds r0, r3, 0 - cmp r0, 0x1F - bgt _080CCB10 - lsls r0, 1 - movs r6, 0x98 - lsls r6, 3 - adds r0, r6 - b _080CCB18 - .pool -_080CCB10: - lsls r0, 1 - movs r1, 0xC8 - lsls r1, 4 - adds r0, r1 -_080CCB18: - adds r2, r0 - movs r0, 0 - movs r5, 0 - movs r4, 0x3F -_080CCB20: - strh r5, [r2] - adds r2, 0x2 - adds r3, 0x1 - ands r3, r4 - adds r1, r3, 0 - cmp r1, 0 - bne _080CCB32 - ldr r6, =0xfffff7c0 - adds r2, r6 -_080CCB32: - cmp r1, 0x20 - bne _080CCB3C - movs r1, 0xF8 - lsls r1, 3 - adds r2, r1 -_080CCB3C: - adds r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2B - bls _080CCB20 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CCAE0 - - thumb_func_start sub_80CCB50 -sub_80CCB50: @ 80CCB50 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x30 - mov r8, r0 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r1, =gUnknown_02039D08 - mov r10, r1 - ldr r1, [r1] - movs r2, 0xBE - lsls r2, 2 - adds r0, r1, r2 - str r0, [sp, 0x24] - mov r3, sp - adds r3, 0x24 - str r3, [sp, 0x2C] - ldr r0, =0x00030200 - str r0, [r3, 0x4] - ldr r4, =0x000006fc - adds r1, r4 - str r1, [sp, 0x14] - add r0, sp, 0x18 - ldr r7, =0x0000dac9 - strh r7, [r0] - add r0, sp, 0x1C - movs r1, 0 - movs r2, 0x8 - bl memset - add r1, sp, 0x14 - add r0, sp, 0x4 - movs r2, 0x10 - bl memcpy - mov r0, r8 - bl sub_80D20F8 - lsls r0, 24 - mov r5, r10 - ldr r4, [r5] - ldr r2, =gUnknown_08577574 - lsrs r0, 22 - adds r1, r0, r2 - ldrh r3, [r1] - movs r5, 0xE3 - lsls r5, 3 - adds r1, r4, r5 - strh r3, [r1] - adds r2, 0x2 - adds r0, r2 - ldrh r0, [r0] - ldr r1, =0x0000071a - adds r4, r1 - strh r0, [r4] - add r0, sp, 0x4 - bl LoadSpritePalettes - mov r2, r10 - ldr r0, [r2] - movs r6, 0xE7 - lsls r6, 3 - adds r0, r6 - movs r1, 0xFC - lsls r1, 2 - str r1, [r0] - adds r0, r7, 0 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 24 - mov r4, r10 - ldr r3, [r4] - lsls r1, r0, 4 - movs r5, 0x87 - lsls r5, 1 - mov r9, r5 - add r1, r9 - ldr r4, =0x0000071c - adds r2, r3, r4 - strh r1, [r2] - adds r3, r6 - movs r5, 0x80 - lsls r5, 9 - adds r1, r5, 0 - lsls r1, r0 - ldr r0, [r3] - orrs r0, r1 - str r0, [r3] - adds r0, r7, 0 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 24 - mov r1, r10 - ldr r4, [r1] - lsls r1, r0, 4 - add r1, r9 - ldr r3, =0x0000071e - adds r2, r4, r3 - strh r1, [r2] - adds r6, r4, r6 - lsls r5, r0 - ldr r0, [r6] - orrs r0, r5 - str r0, [r6] - ldr r5, =0x000021b8 - adds r4, r5 - mov r0, r8 - bl GetBoxNamePtr - adds r1, r0, 0 - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x8 - bl StringCopyPadded - mov r4, r10 - ldr r1, [r4] - adds r5, r1, r5 - movs r0, 0xBE - lsls r0, 2 - adds r1, r0 - movs r0, 0x2 - str r0, [sp] - adds r0, r5, 0 - movs r2, 0 - movs r3, 0 - bl sub_80C6D80 - ldr r0, [sp, 0x2C] - bl LoadSpriteSheet - mov r0, r8 - bl GetBoxNamePtr - bl sub_80CD00C - movs r4, 0 - lsls r0, 16 - asrs r6, r0, 16 -_080CCC70: - lsls r1, r4, 5 - adds r1, r6, r1 - lsls r1, 16 - asrs r1, 16 - ldr r0, =gSpriteTemplate_857B0A8 - movs r2, 0x1C - movs r3, 0x18 - bl CreateSprite - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldr r5, =gUnknown_02039D08 - ldr r2, [r5] - lsls r0, r4, 2 - movs r3, 0xE4 - lsls r3, 3 - adds r2, r3 - adds r2, r0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - str r0, [r2] - lsls r1, r4, 24 - lsrs r1, 24 - bl StartSpriteAnim - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x1 - bls _080CCC70 - ldr r0, [r5] - movs r4, 0xDF - lsls r4, 3 - adds r0, r4 - movs r1, 0 - strb r1, [r0] - add sp, 0x30 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CCB50 - - thumb_func_start sub_80CCCFC -sub_80CCCFC: @ 80CCCFC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x2C - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x28] - lsls r1, 24 - lsrs r1, 24 - mov r10, r1 - ldr r4, =gUnknown_02039D08 - ldr r2, [r4] - movs r1, 0xBE - lsls r1, 2 - adds r0, r2, r1 - str r0, [sp, 0x1C] - add r3, sp, 0x1C - ldr r5, =0x0000ffff - mov r12, r5 - movs r6, 0xC0 - lsls r6, 10 - mov r9, r6 - ldr r0, =0x00030200 - str r0, [r3, 0x4] - add r1, sp, 0x4 - ldr r0, =gSpriteTemplate_857B0A8 - ldm r0!, {r5-r7} - stm r1!, {r5-r7} - ldm r0!, {r5-r7} - stm r1!, {r5-r7} - movs r1, 0 - movs r5, 0xDF - lsls r5, 3 - adds r2, r5 - ldrb r0, [r2] - mov r8, r4 - adds r6, r3, 0 - cmp r0, 0 - bne _080CCD50 - movs r1, 0x1 -_080CCD50: - strb r1, [r2] - mov r7, r8 - ldr r0, [r7] - adds r0, r5 - ldrb r0, [r0] - cmp r0, 0 - bne _080CCD8C - ldr r0, [r6, 0x4] - mov r1, r12 - ands r0, r1 - mov r3, r9 - orrs r0, r3 - str r0, [r6, 0x4] - ldr r0, [r7] - ldr r5, =0x0000071c - adds r0, r5 - ldrh r0, [r0] - mov r9, r0 - b _080CCDB0 - .pool -_080CCD8C: - ldr r0, [r6, 0x4] - mov r7, r12 - ands r0, r7 - movs r1, 0x80 - lsls r1, 11 - orrs r0, r1 - str r0, [r6, 0x4] - mov r1, r8 - ldr r0, [r1] - ldr r3, =0x0000071c - adds r0, r3 - ldrh r0, [r0] - mov r9, r0 - add r1, sp, 0x4 - movs r0, 0x4 - strh r0, [r1] - ldr r0, =0x0000dac9 - strh r0, [r1, 0x2] -_080CCDB0: - mov r5, r8 - ldr r4, [r5] - ldr r5, =0x000021b8 - adds r4, r5 - ldr r0, [sp, 0x28] - bl GetBoxNamePtr - adds r1, r0, 0 - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x8 - bl StringCopyPadded - mov r7, r8 - ldr r1, [r7] - adds r5, r1, r5 - movs r0, 0xBE - lsls r0, 2 - adds r1, r0 - movs r0, 0x2 - str r0, [sp] - adds r0, r5, 0 - movs r2, 0 - movs r3, 0 - bl sub_80C6D80 - adds r0, r6, 0 - bl LoadSpriteSheet - ldr r0, [sp, 0x28] - bl sub_80D20F8 - lsls r0, 24 - lsrs r0, 22 - ldr r1, =gUnknown_08577574 - adds r0, r1 - mov r1, r9 - movs r2, 0x4 - bl LoadPalette - ldr r0, [sp, 0x28] - bl GetBoxNamePtr - bl sub_80CD00C - lsls r0, 16 - mov r1, r10 - lsls r2, r1, 24 - asrs r2, 24 - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 6 - lsrs r3, r0, 16 - str r3, [sp, 0x24] - asrs r0, 16 - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - movs r7, 0 - mov r9, r8 - negs r2, r2 - mov r8, r2 -_080CCE2E: - lsls r6, r7, 5 - mov r5, r10 - lsls r1, r5, 16 - asrs r1, 16 - adds r1, r6 - lsls r1, 16 - asrs r1, 16 - add r0, sp, 0x4 - movs r2, 0x1C - movs r3, 0x18 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - mov r1, r9 - ldr r2, [r1] - lsls r5, r7, 2 - movs r3, 0xE5 - lsls r3, 3 - adds r2, r3 - adds r2, r5 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - str r1, [r2] - mov r0, r8 - lsls r4, r0, 1 - add r4, r8 - lsls r4, 1 - strh r4, [r1, 0x2E] - ldr r1, [r2] - ldr r3, [sp, 0x24] - lsls r0, r3, 16 - asrs r0, 16 - adds r0, r6 - strh r0, [r1, 0x30] - ldr r0, [r2] - movs r6, 0 - strh r6, [r0, 0x32] - ldr r0, [r2] - ldr r1, =sub_80CCF30 - str r1, [r0, 0x1C] - lsls r1, r7, 24 - lsrs r1, 24 - bl StartSpriteAnim - mov r1, r9 - ldr r0, [r1] - movs r3, 0xE4 - lsls r3, 3 - adds r0, r3 - adds r0, r5 - ldr r1, [r0] - strh r4, [r1, 0x2E] - ldr r2, [r0] - movs r1, 0x1 - strh r1, [r2, 0x30] - ldr r1, [r0] - ldr r0, =sub_80CCF64 - str r0, [r1, 0x1C] - adds r0, r7, 0x1 - lsls r0, 16 - lsrs r7, r0, 16 - cmp r7, 0x1 - bls _080CCE2E - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CCCFC - - thumb_func_start sub_80CCEE0 -sub_80CCEE0: @ 80CCEE0 - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - movs r1, 0xDF - lsls r1, 3 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080CCF00 - movs r0, 0x4 - bl FreeSpriteTilesByTag - b _080CCF06 - .pool -_080CCF00: - movs r0, 0x3 - bl FreeSpriteTilesByTag -_080CCF06: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - movs r3, 0xE4 - lsls r3, 3 - adds r2, r0, r3 - adds r3, 0x8 - adds r1, r0, r3 - ldr r1, [r1] - str r1, [r2] - ldr r2, =0x00000724 - adds r1, r0, r2 - adds r3, 0x4 - adds r0, r3 - ldr r0, [r0] - str r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CCEE0 - - thumb_func_start sub_80CCF30 -sub_80CCF30: @ 80CCF30 - push {lr} - adds r2, r0, 0 - ldrh r1, [r2, 0x32] - movs r3, 0x32 - ldrsh r0, [r2, r3] - cmp r0, 0 - beq _080CCF44 - subs r0, r1, 0x1 - strh r0, [r2, 0x32] - b _080CCF5C -_080CCF44: - ldrh r0, [r2, 0x2E] - ldrh r1, [r2, 0x20] - adds r0, r1 - strh r0, [r2, 0x20] - lsls r0, 16 - asrs r0, 16 - movs r3, 0x30 - ldrsh r1, [r2, r3] - cmp r0, r1 - bne _080CCF5C - ldr r0, =SpriteCallbackDummy - str r0, [r2, 0x1C] -_080CCF5C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CCF30 - - thumb_func_start sub_80CCF64 -sub_80CCF64: @ 80CCF64 - push {lr} - adds r2, r0, 0 - ldrh r1, [r2, 0x30] - movs r3, 0x30 - ldrsh r0, [r2, r3] - cmp r0, 0 - beq _080CCF78 - subs r0, r1, 0x1 - strh r0, [r2, 0x30] - b _080CCF96 -_080CCF78: - ldrh r0, [r2, 0x2E] - ldrh r1, [r2, 0x20] - adds r0, r1 - strh r0, [r2, 0x20] - ldrh r1, [r2, 0x24] - adds r0, r1 - strh r0, [r2, 0x32] - subs r0, 0x40 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xC0 - bls _080CCF96 - adds r0, r2, 0 - bl DestroySprite -_080CCF96: - pop {r0} - bx r0 - thumb_func_end sub_80CCF64 - - thumb_func_start sub_80CCF9C -sub_80CCF9C: @ 80CCF9C - push {lr} - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - bl sub_80D20F8 - lsls r0, 24 - lsrs r1, r0, 24 - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - movs r3, 0xDF - lsls r3, 3 - adds r0, r2, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _080CCFE4 - lsls r0, r1, 2 - ldr r1, =gUnknown_08577574 - adds r0, r1 - adds r3, 0x24 - adds r1, r2, r3 - ldrh r1, [r1] - lsls r1, 1 - ldr r2, =gPlttBufferUnfaded - adds r1, r2 - movs r2, 0x2 - bl CpuSet - b _080CCFFC - .pool -_080CCFE4: - lsls r0, r1, 2 - ldr r1, =gUnknown_08577574 - adds r0, r1 - ldr r3, =0x0000071e - adds r1, r2, r3 - ldrh r1, [r1] - lsls r1, 1 - ldr r2, =gPlttBufferUnfaded - adds r1, r2 - movs r2, 0x2 - bl CpuSet -_080CCFFC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CCF9C - - thumb_func_start sub_80CD00C -sub_80CD00C: @ 80CD00C - push {lr} - adds r1, r0, 0 - movs r0, 0x1 - movs r2, 0 - bl GetStringWidth - adds r1, r0, 0 - lsrs r0, r1, 31 - adds r1, r0 - asrs r1, 1 - movs r0, 0xB0 - subs r0, r1 - lsls r0, 16 - asrs r0, 16 - pop {r1} - bx r1 - thumb_func_end sub_80CD00C - - thumb_func_start sub_80CD02C -sub_80CD02C: @ 80CD02C - push {r4,r5,lr} - ldr r0, =gUnknown_0857B080 - bl LoadSpriteSheet - movs r5, 0 -_080CD036: - lsls r1, r5, 4 - adds r1, r5 - lsls r1, 19 - movs r0, 0xB8 - lsls r0, 15 - adds r1, r0 - asrs r1, 16 - ldr r0, =gUnknown_0857B0E0 - movs r2, 0x1C - movs r3, 0x16 - bl CreateSprite - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x40 - beq _080CD088 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r4, r0, r1 - lsls r1, r5, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim - movs r0, 0x1 - cmp r5, 0 - bne _080CD076 - movs r1, 0x1 - negs r1, r1 - adds r0, r1, 0 -_080CD076: - strh r0, [r4, 0x34] - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - lsls r1, r5, 2 - movs r2, 0xE6 - lsls r2, 3 - adds r0, r2 - adds r0, r1 - str r4, [r0] -_080CD088: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x1 - bls _080CD036 - bl IsCursorOnBox - lsls r0, 24 - cmp r0, 0 - beq _080CD0A2 - movs r0, 0x1 - bl sub_80CD1A8 -_080CD0A2: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD02C - - thumb_func_start sub_80CD0B8 -sub_80CD0B8: @ 80CD0B8 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r2, 0 - ldr r7, =gUnknown_02039D08 - mov r12, r7 - movs r6, 0xE6 - lsls r6, 3 - movs r4, 0 - movs r3, 0x2 -_080CD0CC: - mov r0, r12 - ldr r1, [r0] - lsls r0, r2, 2 - adds r1, r6 - adds r1, r0 - ldr r0, [r1] - strh r4, [r0, 0x24] - ldr r0, [r1] - strh r3, [r0, 0x2E] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x1 - bls _080CD0CC - lsls r0, r5, 24 - cmp r0, 0 - bge _080CD114 - ldr r1, [r7] - movs r2, 0xE6 - lsls r2, 3 - adds r3, r1, r2 - ldr r2, [r3] - movs r0, 0x1D - strh r0, [r2, 0x30] - ldr r0, =0x00000734 - adds r1, r0 - ldr r2, [r1] - movs r0, 0x5 - strh r0, [r2, 0x30] - ldr r0, [r3] - movs r2, 0x48 - b _080CD130 - .pool -_080CD114: - ldr r1, [r7] - movs r2, 0xE6 - lsls r2, 3 - adds r3, r1, r2 - ldr r2, [r3] - movs r0, 0x5 - strh r0, [r2, 0x30] - ldr r0, =0x00000734 - adds r1, r0 - ldr r2, [r1] - movs r0, 0x1D - strh r0, [r2, 0x30] - ldr r0, [r3] - movs r2, 0xF8 -_080CD130: - strh r2, [r0, 0x32] - ldr r0, [r1] - strh r2, [r0, 0x32] - ldr r1, [r7] - movs r2, 0xE6 - lsls r2, 3 - adds r0, r1, r2 - ldr r2, [r0] - movs r0, 0 - strh r0, [r2, 0x3C] - ldr r0, =0x00000734 - adds r1, r0 - ldr r1, [r1] - movs r0, 0x1 - strh r0, [r1, 0x3C] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD0B8 - - thumb_func_start sub_80CD158 -sub_80CD158: @ 80CD158 - push {r4-r6,lr} - movs r3, 0 - movs r5, 0 - movs r6, 0x5 - negs r6, r6 - ldr r4, =gUnknown_02039D08 -_080CD164: - ldr r1, [r4] - lsls r0, r3, 2 - movs r2, 0xE6 - lsls r2, 3 - adds r1, r2 - adds r1, r0 - ldr r2, [r1] - lsls r0, r3, 4 - adds r0, r3 - lsls r0, 3 - adds r0, 0x5C - strh r0, [r2, 0x20] - ldr r0, [r1] - strh r5, [r0, 0x24] - ldr r1, [r1] - adds r1, 0x3E - ldrb r2, [r1] - adds r0, r6, 0 - ands r0, r2 - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0x1 - bls _080CD164 - movs r0, 0x1 - bl sub_80CD1A8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD158 - - thumb_func_start sub_80CD1A8 -sub_80CD1A8: @ 80CD1A8 - push {r4-r6,lr} - lsls r0, 24 - cmp r0, 0 - beq _080CD1E4 - movs r2, 0 - ldr r6, =gUnknown_02039D08 - movs r5, 0xE6 - lsls r5, 3 - movs r3, 0 - movs r4, 0x1 -_080CD1BC: - ldr r1, [r6] - lsls r0, r2, 2 - adds r1, r5 - adds r1, r0 - ldr r0, [r1] - strh r4, [r0, 0x2E] - ldr r0, [r1] - strh r3, [r0, 0x30] - ldr r0, [r1] - strh r3, [r0, 0x32] - ldr r0, [r1] - strh r3, [r0, 0x36] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x1 - bls _080CD1BC - b _080CD204 - .pool -_080CD1E4: - movs r2, 0 - ldr r5, =gUnknown_02039D08 - movs r4, 0xE6 - lsls r4, 3 - movs r3, 0 -_080CD1EE: - ldr r0, [r5] - lsls r1, r2, 2 - adds r0, r4 - adds r0, r1 - ldr r0, [r0] - strh r3, [r0, 0x2E] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x1 - bls _080CD1EE -_080CD204: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD1A8 - - thumb_func_start sub_80CD210 -sub_80CD210: @ 80CD210 - push {lr} - adds r2, r0, 0 - movs r1, 0x2E - ldrsh r0, [r2, r1] - cmp r0, 0x4 - bhi _080CD2DC - lsls r0, 2 - ldr r1, =_080CD22C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080CD22C: - .4byte _080CD240 - .4byte _080CD246 - .4byte _080CD274 - .4byte _080CD27A - .4byte _080CD2CC -_080CD240: - movs r0, 0 - strh r0, [r2, 0x24] - b _080CD2DC -_080CD246: - ldrh r0, [r2, 0x30] - adds r0, 0x1 - movs r1, 0 - strh r0, [r2, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3 - ble _080CD2DC - strh r1, [r2, 0x30] - ldrh r0, [r2, 0x34] - ldrh r3, [r2, 0x24] - adds r0, r3 - strh r0, [r2, 0x24] - ldrh r0, [r2, 0x32] - adds r0, 0x1 - strh r0, [r2, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5 - ble _080CD2DC - strh r1, [r2, 0x32] - strh r1, [r2, 0x24] - b _080CD2DC -_080CD274: - movs r0, 0x3 - strh r0, [r2, 0x2E] - b _080CD2DC -_080CD27A: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r0, =0x000002ce - adds r1, r0 - ldrh r0, [r2, 0x20] - ldrh r1, [r1] - subs r0, r1 - strh r0, [r2, 0x20] - subs r0, 0x49 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xAE - bls _080CD2A0 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r3] -_080CD2A0: - ldrh r0, [r2, 0x30] - subs r0, 0x1 - strh r0, [r2, 0x30] - lsls r0, 16 - cmp r0, 0 - bne _080CD2DC - ldrh r0, [r2, 0x32] - strh r0, [r2, 0x20] - adds r3, r2, 0 - adds r3, 0x3E - ldrb r1, [r3] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r3] - movs r0, 0x4 - strh r0, [r2, 0x2E] - b _080CD2DC - .pool -_080CD2CC: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x000002ce - adds r0, r1 - ldrh r1, [r2, 0x20] - ldrh r0, [r0] - subs r1, r0 - strh r1, [r2, 0x20] -_080CD2DC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD210 - - thumb_func_start sub_80CD2E8 -sub_80CD2E8: @ 80CD2E8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r0, 0 - adds r6, r1, 0 - ldr r4, [sp, 0x18] - lsls r2, 24 - lsrs r7, r2, 24 - lsls r3, 24 - lsrs r3, 24 - mov r8, r3 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0857B0E0 - lsls r5, 16 - asrs r5, 16 - lsls r6, 16 - asrs r6, 16 - adds r1, r5, 0 - adds r2, r6, 0 - adds r3, r4, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _080CD360 - movs r1, 0x1 - ands r1, r7 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r5, =gSprites - adds r6, r4, r5 - adds r0, r6, 0 - bl StartSpriteAnim - movs r0, 0x3 - mov r1, r8 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r6, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r6, 0x5] - adds r5, 0x1C - adds r4, r5 - ldr r0, =SpriteCallbackDummy - str r0, [r4] - adds r0, r6, 0 - b _080CD362 - .pool -_080CD360: - movs r0, 0 -_080CD362: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80CD2E8 - - thumb_func_start sub_80CD36C -sub_80CD36C: @ 80CD36C - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r1, [r0, 0x1] - cmp r1, 0x1 - beq _080CD388 - ldr r1, =sBoxCursorAction - movs r0, 0 - strb r0, [r1] - b _080CD38C - .pool -_080CD388: - ldr r0, =sBoxCursorAction - strb r1, [r0] -_080CD38C: - ldr r0, =sBoxCursorPosition - movs r1, 0 - strb r1, [r0] - ldr r0, =sIsMonBeingMoved - strb r1, [r0] - ldr r0, =sMovingMonOrigBoxId - strb r1, [r0] - ldr r0, =sMovingMonOrigBoxPos - strb r1, [r0] - ldr r0, =sCanOnlyMove - strb r1, [r0] - bl sub_80CDC0C - bl sub_80CFC14 - ldr r2, =gUnknown_02039D08 - ldr r0, [r2] - ldr r1, =0x00000cd6 - adds r0, r1 - movs r3, 0 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r2] - ldr r1, =0x000021ff - adds r0, r1 - strb r3, [r0] - bl sub_80CEB40 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD36C - - thumb_func_start sub_80CD3EC -sub_80CD3EC: @ 80CD3EC - push {lr} - bl sub_80CFC14 - bl sub_80CEBDC - ldr r3, =gUnknown_02039D08 - ldr r0, [r3] - ldr r1, =0x00000cd6 - adds r0, r1 - movs r2, 0 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r3] - ldr r1, =0x000021ff - adds r0, r1 - strb r2, [r0] - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CD426 - ldr r0, [r3] - ldr r1, =0x000020a4 - adds r0, r1 - ldr r1, =gUnknown_02039D14 - movs r2, 0x64 - bl memcpy - bl sub_80CAFC4 -_080CD426: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD3EC - - thumb_func_start sub_80CD444 -sub_80CD444: @ 80CD444 - push {r4-r6,lr} - adds r4, r2, 0 - adds r6, r3, 0 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - cmp r0, 0x4 - bhi _080CD4FC - lsls r0, 2 - ldr r1, =_080CD464 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080CD464: - .4byte _080CD478 - .4byte _080CD4A6 - .4byte _080CD4CE - .4byte _080CD4D6 - .4byte _080CD4F4 -_080CD478: - adds r0, r5, 0 - movs r1, 0x6 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 3 - adds r1, 0x64 - strh r1, [r4] - adds r0, r5, 0 - movs r1, 0x6 - bl __udivsi3 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 3 - adds r1, 0x20 - strh r1, [r6] - b _080CD4FC -_080CD4A6: - cmp r5, 0 - bne _080CD4B2 - movs r0, 0x68 - strh r0, [r4] - movs r0, 0x34 - b _080CD4FA -_080CD4B2: - cmp r5, 0x6 - bne _080CD4BE - movs r0, 0x98 - strh r0, [r4] - movs r0, 0x84 - b _080CD4FA -_080CD4BE: - movs r0, 0x98 - strh r0, [r4] - subs r1, r5, 0x1 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - adds r0, 0x4 - b _080CD4FA -_080CD4CE: - movs r0, 0xA2 - strh r0, [r4] - movs r0, 0xC - b _080CD4FA -_080CD4D6: - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - movs r1, 0xE - cmp r0, 0 - beq _080CD4E2 - movs r1, 0x8 -_080CD4E2: - strh r1, [r6] - movs r0, 0x58 - muls r0, r5 - adds r0, 0x78 - strh r0, [r4] - b _080CD4FC - .pool -_080CD4F4: - movs r0, 0xA0 - strh r0, [r4] - movs r0, 0x60 -_080CD4FA: - strh r0, [r6] -_080CD4FC: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80CD444 - - thumb_func_start sub_80CD504 -sub_80CD504: @ 80CD504 - push {lr} - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - beq _080CD538 - cmp r0, 0x1 - bne _080CD54C - ldr r0, =sBoxCursorPosition - movs r1, 0 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - b _080CD542 - .pool -_080CD538: - ldr r0, =sBoxCursorPosition - ldrb r0, [r0] - movs r1, 0xB - bl GetBoxMonDataFromSelectedBox -_080CD542: - lsls r0, 16 - lsrs r0, 16 - b _080CD54E - .pool -_080CD54C: - movs r0, 0 -_080CD54E: - pop {r1} - bx r1 - thumb_func_end sub_80CD504 - - thumb_func_start sub_80CD554 -sub_80CD554: @ 80CD554 - push {r4-r7,lr} - ldr r7, =gUnknown_02039D08 - ldr r5, [r7] - movs r0, 0xCD - lsls r0, 4 - adds r1, r5, r0 - ldrh r0, [r1] - cmp r0, 0 - bne _080CD57E - ldrb r0, [r5, 0x1] - cmp r0, 0x3 - beq _080CD574 - movs r0, 0 - b _080CD69A - .pool -_080CD574: - bl sub_80D1218 - lsls r0, 24 - lsrs r0, 24 - b _080CD69A -_080CD57E: - subs r0, 0x1 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - beq _080CD67C - ldr r1, =0x00000cbc - adds r4, r5, r1 - ldr r2, =0x00000cc4 - adds r1, r5, r2 - ldr r0, [r4] - ldr r1, [r1] - adds r0, r1 - str r0, [r4] - movs r0, 0xCC - lsls r0, 4 - adds r3, r5, r0 - adds r2, 0x4 - adds r1, r5, r2 - ldr r0, [r3] - ldr r1, [r1] - adds r0, r1 - str r0, [r3] - ldr r6, =0x00000cb4 - adds r1, r5, r6 - ldr r2, [r1] - ldr r0, [r4] - asrs r0, 8 - strh r0, [r2, 0x20] - ldr r2, [r1] - ldr r0, [r3] - asrs r0, 8 - strh r0, [r2, 0x22] - ldr r1, [r1] - ldrh r2, [r1, 0x20] - movs r3, 0x20 - ldrsh r0, [r1, r3] - movs r3, 0x80 - lsls r3, 1 - cmp r0, r3 - ble _080CD5DA - ldr r4, =0xffffff00 - adds r0, r2, r4 - lsls r0, 16 - asrs r0, 16 - adds r0, 0x40 - strh r0, [r1, 0x20] -_080CD5DA: - ldr r0, [r7] - adds r0, r6 - ldr r1, [r0] - ldrh r2, [r1, 0x20] - movs r4, 0x20 - ldrsh r0, [r1, r4] - cmp r0, 0x3F - bgt _080CD5F6 - movs r0, 0x40 - subs r0, r2 - lsls r0, 16 - asrs r0, 16 - subs r0, r3, r0 - strh r0, [r1, 0x20] -_080CD5F6: - ldr r0, [r7] - adds r0, r6 - ldr r1, [r0] - ldrh r2, [r1, 0x22] - movs r3, 0x22 - ldrsh r0, [r1, r3] - cmp r0, 0xB0 - ble _080CD612 - adds r0, r2, 0 - subs r0, 0xB0 - lsls r0, 16 - asrs r0, 16 - subs r0, 0x10 - strh r0, [r1, 0x22] -_080CD612: - ldr r0, [r7] - adds r0, r6 - ldr r2, [r0] - ldrh r3, [r2, 0x22] - movs r4, 0x22 - ldrsh r0, [r2, r4] - movs r1, 0x10 - negs r1, r1 - cmp r0, r1 - bge _080CD632 - subs r0, r1, r3 - movs r1, 0xB0 - lsls r0, 16 - asrs r0, 16 - subs r1, r0 - strh r1, [r2, 0x22] -_080CD632: - ldr r0, [r7] - ldr r2, =0x00000cd7 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0 - beq _080CD698 - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - bne _080CD698 - ldr r0, [r7] - adds r0, r6 - ldr r2, [r0] - adds r2, 0x3F - ldrb r3, [r2] - lsrs r1, r3, 1 - movs r0, 0x1 - eors r1, r0 - ands r1, r0 - lsls r1, 1 - movs r0, 0x3 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - b _080CD698 - .pool -_080CD67C: - ldr r3, =0x00000cb4 - adds r2, r5, r3 - ldr r1, [r2] - ldr r4, =0x00000ccc - adds r0, r5, r4 - ldrh r0, [r0] - strh r0, [r1, 0x20] - ldr r1, [r2] - ldr r2, =0x00000cce - adds r0, r5, r2 - ldrh r0, [r0] - strh r0, [r1, 0x22] - bl sub_80CDA68 -_080CD698: - movs r0, 0x1 -_080CD69A: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CD554 - - thumb_func_start sub_80CD6AC -sub_80CD6AC: @ 80CD6AC - push {r4-r6,lr} - sub sp, 0x4 - adds r4, r0, 0 - adds r5, r1, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - mov r6, sp - adds r6, 0x2 - adds r0, r4, 0 - adds r1, r5, 0 - mov r2, sp - adds r3, r6, 0 - bl sub_80CD444 - ldr r1, =gUnknown_02039D08 - ldr r0, [r1] - ldr r2, =0x00000cd4 - adds r0, r2 - strb r4, [r0] - ldr r0, [r1] - ldr r3, =0x00000cd5 - adds r0, r3 - strb r5, [r0] - ldr r1, [r1] - mov r0, sp - ldrh r2, [r0] - subs r3, 0x9 - adds r0, r1, r3 - strh r2, [r0] - ldrh r0, [r6] - ldr r2, =0x00000cce - adds r1, r2 - strh r0, [r1] - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD6AC - - thumb_func_start sub_80CD70C -sub_80CD70C: @ 80CD70C - push {r4-r7,lr} - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - ldr r3, =0x00000cd2 - adds r1, r2, r3 - ldrh r1, [r1] - adds r4, r0, 0 - cmp r1, 0 - beq _080CD730 - movs r0, 0xCD - lsls r0, 4 - adds r1, r2, r0 - movs r0, 0xC - b _080CD738 - .pool -_080CD730: - movs r3, 0xCD - lsls r3, 4 - adds r1, r2, r3 - movs r0, 0x6 -_080CD738: - strh r0, [r1] - ldr r1, [r4] - ldr r0, =0x00000cd7 - adds r2, r1, r0 - ldrb r0, [r2] - cmp r0, 0 - beq _080CD752 - movs r3, 0xCD - lsls r3, 4 - adds r0, r1, r3 - ldrh r0, [r0] - lsrs r0, 1 - strb r0, [r2] -_080CD752: - ldr r2, [r4] - ldr r1, =0x00000cd2 - adds r0, r2, r1 - movs r1, 0 - ldrsb r1, [r0, r1] - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _080CD78C - cmp r1, 0x1 - beq _080CD7AC - ldr r3, =0x00000cce - adds r0, r2, r3 - movs r3, 0 - ldrsh r1, [r0, r3] - ldr r3, =0x00000cb4 - adds r0, r2, r3 - ldr r0, [r0] - movs r2, 0x22 - ldrsh r0, [r0, r2] - b _080CD7C0 - .pool -_080CD78C: - ldr r3, =0x00000cce - adds r0, r2, r3 - movs r3, 0 - ldrsh r1, [r0, r3] - ldr r3, =0x00000cb4 - adds r0, r2, r3 - ldr r0, [r0] - movs r2, 0x22 - ldrsh r0, [r0, r2] - adds r0, 0xC0 - b _080CD7C0 - .pool -_080CD7AC: - ldr r3, =0x00000cce - adds r0, r2, r3 - movs r3, 0 - ldrsh r1, [r0, r3] - ldr r3, =0x00000cb4 - adds r0, r2, r3 - ldr r0, [r0] - movs r2, 0x22 - ldrsh r0, [r0, r2] - subs r0, 0xC0 -_080CD7C0: - subs r7, r1, r0 - ldr r2, [r4] - ldr r3, =0x00000cd3 - adds r0, r2, r3 - movs r1, 0 - ldrsb r1, [r0, r1] - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _080CD7FC - cmp r1, 0x1 - beq _080CD81C - ldr r1, =0x00000ccc - adds r0, r2, r1 - movs r3, 0 - ldrsh r1, [r0, r3] - ldr r3, =0x00000cb4 - adds r0, r2, r3 - ldr r0, [r0] - movs r2, 0x20 - ldrsh r0, [r0, r2] - b _080CD830 - .pool -_080CD7FC: - ldr r3, =0x00000ccc - adds r0, r2, r3 - movs r3, 0 - ldrsh r1, [r0, r3] - ldr r3, =0x00000cb4 - adds r0, r2, r3 - ldr r0, [r0] - movs r2, 0x20 - ldrsh r0, [r0, r2] - adds r0, 0xC0 - b _080CD830 - .pool -_080CD81C: - ldr r3, =0x00000ccc - adds r0, r2, r3 - movs r3, 0 - ldrsh r1, [r0, r3] - ldr r3, =0x00000cb4 - adds r0, r2, r3 - ldr r0, [r0] - movs r2, 0x20 - ldrsh r0, [r0, r2] - subs r0, 0xC0 -_080CD830: - subs r0, r1, r0 - lsls r7, 8 - lsls r0, 8 - ldr r4, [r4] - ldr r3, =0x00000cc4 - adds r6, r4, r3 - movs r1, 0xCD - lsls r1, 4 - adds r5, r4, r1 - ldrh r1, [r5] - bl __divsi3 - str r0, [r6] - ldr r2, =0x00000cc8 - adds r6, r4, r2 - ldrh r1, [r5] - adds r0, r7, 0 - bl __divsi3 - str r0, [r6] - ldr r3, =0x00000cbc - adds r2, r4, r3 - ldr r0, =0x00000cb4 - adds r1, r4, r0 - ldr r0, [r1] - movs r3, 0x20 - ldrsh r0, [r0, r3] - lsls r0, 8 - str r0, [r2] - movs r0, 0xCC - lsls r0, 4 - adds r4, r0 - ldr r0, [r1] - movs r1, 0x22 - ldrsh r0, [r0, r1] - lsls r0, 8 - str r0, [r4] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD70C - - thumb_func_start sub_80CD894 -sub_80CD894: @ 80CD894 - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r6, r1, 24 - adds r0, r4, 0 - adds r1, r6, 0 - bl sub_80CD6AC - bl sub_80CD70C - ldr r5, =gUnknown_02039D08 - ldr r1, [r5] - ldrb r0, [r1, 0x1] - cmp r0, 0x3 - beq _080CD8E4 - ldr r2, =0x000021ff - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080CD8FC - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - bne _080CD8FC - ldr r2, =0x00000cb4 - adds r0, r1, r2 - ldr r0, [r0] - movs r1, 0x1 - bl StartSpriteAnim - b _080CD8FC - .pool -_080CD8E4: - bl sub_80D127C - lsls r0, 24 - cmp r0, 0 - bne _080CD8FC - ldr r0, [r5] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x1 - bl StartSpriteAnim -_080CD8FC: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080CD95C - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _080CD930 - ldr r0, =sBoxCursorPosition - ldrb r1, [r0] - movs r0, 0 - bl sub_80D0E50 - b _080CD93E - .pool -_080CD930: - cmp r0, 0x1 - bne _080CD93E - ldr r0, =sBoxCursorPosition - ldrb r1, [r0] - movs r0, 0x1 - bl sub_80D0E50 -_080CD93E: - cmp r4, 0 - bne _080CD950 - movs r0, 0 - adds r1, r6, 0 - bl sub_80D0D8C - b _080CD95C - .pool -_080CD950: - cmp r4, 0x1 - bne _080CD988 - movs r0, 0x1 - adds r1, r6, 0 - bl sub_80D0D8C -_080CD95C: - cmp r4, 0x1 - bne _080CD988 - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - beq _080CD988 - ldr r1, =gUnknown_02039D08 - ldr r0, [r1] - ldr r2, =0x00000cd6 - adds r0, r2 - strb r4, [r0] - ldr r0, [r1] - ldr r1, =0x00000cb8 - adds r0, r1 - ldr r1, [r0] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] -_080CD988: - cmp r4, 0 - beq _080CD9E4 - cmp r4, 0 - blt _080CDA56 - cmp r4, 0x3 - bgt _080CDA56 - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - ldr r2, =0x00000cb4 - adds r0, r2 - ldr r4, [r0] - ldrb r1, [r4, 0x5] - movs r2, 0xD - negs r2, r2 - adds r0, r2, 0 - ands r0, r1 - movs r3, 0x4 - orrs r0, r3 - strb r0, [r4, 0x5] - ldr r0, [r5] - ldr r4, =0x00000cb8 - adds r0, r4 - ldr r1, [r0] - adds r1, 0x3E - ldrb r0, [r1] - orrs r0, r3 - strb r0, [r1] - ldr r0, [r5] - adds r0, r4 - ldr r1, [r0] - ldrb r0, [r1, 0x5] - ands r2, r0 - orrs r2, r3 - strb r2, [r1, 0x5] - b _080CDA56 - .pool -_080CD9E4: - ldr r3, =gUnknown_02039D08 - ldr r1, [r3] - ldr r2, =0x000021ff - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080CDA28 - ldr r2, =0x00000cb4 - adds r0, r1, r2 - ldr r2, [r0] - ldrb r1, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x5] - ldr r0, [r3] - ldr r1, =0x00000cb8 - adds r0, r1 - ldr r1, [r0] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - b _080CDA56 - .pool -_080CDA28: - ldr r2, =0x00000cb4 - adds r0, r1, r2 - ldr r2, [r0] - ldrb r1, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - movs r1, 0x8 - orrs r0, r1 - strb r0, [r2, 0x5] - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _080CDA56 - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CDA56 - movs r0, 0x2 - bl sub_80CC0D4 -_080CDA56: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD894 - - thumb_func_start sub_80CDA68 -sub_80CDA68: @ 80CDA68 - push {r4,lr} - ldr r1, =sBoxCursorAction - ldr r4, =gUnknown_02039D08 - ldr r2, [r4] - ldr r3, =0x00000cd4 - adds r0, r2, r3 - ldrb r0, [r0] - strb r0, [r1] - ldr r1, =sBoxCursorPosition - adds r3, 0x1 - adds r0, r2, r3 - ldrb r0, [r0] - strb r0, [r1] - ldrb r0, [r2, 0x1] - cmp r0, 0x3 - beq _080CDAC0 - ldr r1, =0x000021ff - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080CDAD8 - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - bne _080CDAD8 - subs r3, 0x21 - adds r0, r2, r3 - ldr r0, [r0] - movs r1, 0 - bl StartSpriteAnim - b _080CDAD8 - .pool -_080CDAC0: - bl sub_80D127C - lsls r0, 24 - cmp r0, 0 - bne _080CDAD8 - ldr r0, [r4] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0 - bl StartSpriteAnim -_080CDAD8: - bl sub_80CEB40 - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - beq _080CDB0E - cmp r0, 0x1 - bgt _080CDAFC - cmp r0, 0 - beq _080CDB30 - b _080CDB8A - .pool -_080CDAFC: - cmp r0, 0x2 - beq _080CDB06 - cmp r0, 0x3 - bne _080CDB8A - b _080CDB1E -_080CDB06: - movs r0, 0x1 - bl sub_80CD1A8 - b _080CDB8A -_080CDB0E: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r2, =0x00000cb8 - adds r0, r2 - ldr r0, [r0] - adds r0, 0x43 - movs r1, 0xD - strb r1, [r0] -_080CDB1E: - movs r0, 0x1 - bl sub_80CC0D4 - b _080CDB8A - .pool -_080CDB30: - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - ldr r3, =0x000021ff - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _080CDB8A - ldr r2, =0x00000cb4 - adds r0, r1, r2 - ldr r3, [r0] - ldrb r1, [r3, 0x5] - movs r2, 0xD - negs r2, r2 - adds r0, r2, 0 - ands r0, r1 - movs r1, 0x4 - orrs r0, r1 - strb r0, [r3, 0x5] - ldr r0, [r4] - ldr r3, =0x00000cb8 - adds r0, r3 - ldr r1, [r0] - ldrb r0, [r1, 0x5] - ands r2, r0 - movs r0, 0x8 - orrs r2, r0 - strb r2, [r1, 0x5] - ldr r0, [r4] - adds r0, r3 - ldr r0, [r0] - adds r0, 0x43 - movs r1, 0x15 - strb r1, [r0] - ldr r0, [r4] - adds r0, r3 - ldr r1, [r0] - adds r1, 0x3E - ldrb r2, [r1] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - movs r0, 0x2 - bl sub_80CC0D4 -_080CDB8A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CDA68 - - thumb_func_start sub_80CDBA0 -sub_80CDBA0: @ 80CDBA0 - push {lr} - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - bne _080CDBB4 - movs r3, 0 - b _080CDBC2 - .pool -_080CDBB4: - bl CalculatePlayerPartyCount - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x5 - bls _080CDBC2 - movs r3, 0x5 -_080CDBC2: - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - ldr r1, =0x00000cb4 - adds r0, r2, r1 - ldr r0, [r0] - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080CDBE0 - ldr r0, =0x00000cd7 - adds r1, r2, r0 - movs r0, 0x1 - strb r0, [r1] -_080CDBE0: - movs r0, 0x1 - adds r1, r3, 0 - bl sub_80CD894 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CDBA0 - - thumb_func_start sub_80CDBF8 -sub_80CDBF8: @ 80CDBF8 - push {lr} - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0 - bl sub_80CD894 - pop {r0} - bx r0 - thumb_func_end sub_80CDBF8 - - thumb_func_start sub_80CDC0C -sub_80CDC0C: @ 80CDC0C - ldr r1, =gUnknown_02039D7E - movs r0, 0 - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_80CDC0C - - thumb_func_start sub_80CDC18 -sub_80CDC18: @ 80CDC18 - ldr r0, =gUnknown_02039D7E - ldr r1, =sBoxCursorPosition - ldrb r1, [r1] - strb r1, [r0] - bx lr - .pool - thumb_func_end sub_80CDC18 - - thumb_func_start sub_80CDC2C -sub_80CDC2C: @ 80CDC2C - ldr r0, =gUnknown_02039D7E - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80CDC2C - - thumb_func_start sub_80CDC38 -sub_80CDC38: @ 80CDC38 - lsls r0, 24 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - ldr r2, =0x00000d8c - adds r3, r1, r2 - ldr r2, =gUnknown_0857B998 - lsrs r0, 22 - adds r0, r2 - ldr r0, [r0] - str r0, [r3] - movs r0, 0xD9 - lsls r0, 4 - adds r1, r0 - movs r0, 0 - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_80CDC38 - - thumb_func_start sub_80CDC64 -sub_80CDC64: @ 80CDC64 - push {lr} - lsls r0, 24 - cmp r0, 0 - bne _080CDC84 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x00000d8c - adds r1, r2 - ldr r2, =sub_80CDEB4 - b _080CDC8E - .pool -_080CDC84: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x00000d8c - adds r1, r2 - ldr r2, =sub_80CDEC4 -_080CDC8E: - str r2, [r1] - ldr r0, [r0] - movs r1, 0xD9 - lsls r1, 4 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CDC64 - - thumb_func_start sub_80CDCAC -sub_80CDCAC: @ 80CDCAC - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000d8c - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CDCAC - - thumb_func_start sub_80CDCCC -sub_80CDCCC: @ 80CDCCC - push {r4,r5,lr} - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - movs r5, 0xD9 - lsls r5, 4 - adds r0, r1, r5 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080CDD1C - cmp r0, 0x1 - bgt _080CDCEC - cmp r0, 0 - beq _080CDCF6 - b _080CDD54 - .pool -_080CDCEC: - cmp r0, 0x2 - beq _080CDD40 - cmp r0, 0x3 - beq _080CDCFE - b _080CDD54 -_080CDCF6: - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CDD08 -_080CDCFE: - movs r0, 0 - b _080CDD56 - .pool -_080CDD08: - ldr r2, =0x00000cb4 - adds r0, r1, r2 - ldr r0, [r0] - movs r1, 0x2 - bl StartSpriteAnim - b _080CDD4A - .pool -_080CDD1C: - bl sub_80CDED4 - lsls r0, 24 - cmp r0, 0 - bne _080CDD54 - ldr r0, [r4] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x3 - bl StartSpriteAnim - bl sub_80CDF38 - b _080CDD4A - .pool -_080CDD40: - bl sub_80CDF08 - lsls r0, 24 - cmp r0, 0 - bne _080CDD54 -_080CDD4A: - ldr r1, [r4] - adds r1, r5 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080CDD54: - movs r0, 0x1 -_080CDD56: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80CDCCC - - thumb_func_start sub_80CDD5C -sub_80CDD5C: @ 80CDD5C - push {r4,r5,lr} - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - movs r5, 0xD9 - lsls r5, 4 - adds r0, r5 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080CDDA4 - cmp r0, 0x1 - bgt _080CDD7C - cmp r0, 0 - beq _080CDD82 - b _080CDDD0 - .pool -_080CDD7C: - cmp r0, 0x2 - beq _080CDDCC - b _080CDDD0 -_080CDD82: - bl sub_80CDED4 - lsls r0, 24 - cmp r0, 0 - bne _080CDDD0 - ldr r0, [r4] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x2 - bl StartSpriteAnim - bl sub_80CDFAC - b _080CDDBC - .pool -_080CDDA4: - bl sub_80CDF08 - lsls r0, 24 - cmp r0, 0 - bne _080CDDD0 - ldr r0, [r4] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0 - bl StartSpriteAnim -_080CDDBC: - ldr r1, [r4] - adds r1, r5 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080CDDD0 - .pool -_080CDDCC: - movs r0, 0 - b _080CDDD2 -_080CDDD0: - movs r0, 0x1 -_080CDDD2: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80CDD5C - - thumb_func_start sub_80CDDD8 -sub_80CDDD8: @ 80CDDD8 - push {r4,r5,lr} - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - movs r5, 0xD9 - lsls r5, 4 - adds r0, r1, r5 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080CDE68 - cmp r0, 0x1 - bgt _080CDDF8 - cmp r0, 0 - beq _080CDDFE - b _080CDEAC - .pool -_080CDDF8: - cmp r0, 0x2 - beq _080CDEA8 - b _080CDEAC -_080CDDFE: - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - beq _080CDE20 - cmp r0, 0x1 - bne _080CDEA8 - ldr r0, =0x00000d91 - adds r1, r0 - movs r0, 0xE - b _080CDE2A - .pool -_080CDE20: - bl StorageGetCurrentBox - ldr r1, [r4] - ldr r2, =0x00000d91 - adds r1, r2 -_080CDE2A: - strb r0, [r1] - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x2 - bl StartSpriteAnim - ldr r0, [r4] - ldr r2, =0x00000d91 - adds r0, r2 - ldrb r0, [r0] - ldr r1, =sBoxCursorPosition - ldrb r1, [r1] - bl sub_80CBD5C - ldr r1, [r4] - movs r0, 0xD9 - lsls r0, 4 - adds r1, r0 - b _080CDE94 - .pool -_080CDE68: - bl sub_80CBDC4 - lsls r0, 24 - cmp r0, 0 - bne _080CDEAC - ldr r0, [r4] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x3 - bl StartSpriteAnim - ldr r0, [r4] - ldr r2, =0x00000d91 - adds r0, r2 - ldrb r0, [r0] - ldr r1, =sBoxCursorPosition - ldrb r1, [r1] - bl diegohint1 - ldr r1, [r4] - adds r1, r5 -_080CDE94: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080CDEAC - .pool -_080CDEA8: - movs r0, 0 - b _080CDEAE -_080CDEAC: - movs r0, 0x1 -_080CDEAE: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80CDDD8 - - thumb_func_start sub_80CDEB4 -sub_80CDEB4: @ 80CDEB4 - push {lr} - bl sub_80CDED4 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_80CDEB4 - - thumb_func_start sub_80CDEC4 -sub_80CDEC4: @ 80CDEC4 - push {lr} - bl sub_80CDF08 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_80CDEC4 - - thumb_func_start sub_80CDED4 -sub_80CDED4: @ 80CDED4 - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r1, [r0] - movs r2, 0x26 - ldrsh r0, [r1, r2] - cmp r0, 0 - beq _080CDEEC - cmp r0, 0x8 - beq _080CDEFC -_080CDEEC: - ldrh r0, [r1, 0x26] - adds r0, 0x1 - strh r0, [r1, 0x26] - b _080CDF00 - .pool -_080CDEFC: - movs r0, 0 - b _080CDF02 -_080CDF00: - movs r0, 0x1 -_080CDF02: - pop {r1} - bx r1 - thumb_func_end sub_80CDED4 - - thumb_func_start sub_80CDF08 -sub_80CDF08: @ 80CDF08 - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r1, [r0] - movs r2, 0x26 - ldrsh r0, [r1, r2] - cmp r0, 0 - beq _080CDF30 - ldrh r0, [r1, 0x26] - subs r0, 0x1 - strh r0, [r1, 0x26] - movs r0, 0x1 - b _080CDF32 - .pool -_080CDF30: - movs r0, 0 -_080CDF32: - pop {r1} - bx r1 - thumb_func_end sub_80CDF08 - - thumb_func_start sub_80CDF38 -sub_80CDF38: @ 80CDF38 - push {r4,lr} - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - beq _080CDF68 - cmp r0, 0x1 - bne _080CDF94 - ldr r4, =sBoxCursorPosition - ldrb r1, [r4] - movs r0, 0xE - bl sub_80CE018 - ldrb r1, [r4] - movs r0, 0 - bl sub_80CBC14 - b _080CDF8E - .pool -_080CDF68: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x000021ff - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080CDF8E - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - ldr r4, =sBoxCursorPosition - ldrb r1, [r4] - bl sub_80CE018 - ldrb r1, [r4] - movs r0, 0x1 - bl sub_80CBC14 -_080CDF8E: - ldr r1, =sIsMonBeingMoved - movs r0, 0x1 - strb r0, [r1] -_080CDF94: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CDF38 - - thumb_func_start sub_80CDFAC -sub_80CDFAC: @ 80CDFAC - push {r4,r5,lr} - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - beq _080CDFDC - cmp r0, 0x1 - bne _080CDFFE - ldr r4, =sBoxCursorPosition - ldrb r1, [r4] - movs r0, 0xE - bl diegohint2 - ldrb r1, [r4] - movs r0, 0xE - bl sub_80CBCAC - b _080CDFF8 - .pool -_080CDFDC: - bl StorageGetCurrentBox - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =sBoxCursorPosition - ldrb r1, [r5] - adds r0, r4, 0 - bl diegohint2 - ldrb r1, [r5] - adds r0, r4, 0 - bl sub_80CBCAC -_080CDFF8: - ldr r1, =sIsMonBeingMoved - movs r0, 0 - strb r0, [r1] -_080CDFFE: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CDFAC - - thumb_func_start sub_80CE00C -sub_80CE00C: @ 80CE00C - push {lr} - bl sub_80CEB40 - pop {r0} - bx r0 - thumb_func_end sub_80CE00C - - thumb_func_start sub_80CE018 -sub_80CE018: @ 80CE018 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - cmp r4, 0xE - bne _080CE054 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x000020a4 - adds r0, r1 - ldr r3, =gPlayerParty - ldr r1, =sBoxCursorPosition - movs r2, 0 - ldrsb r2, [r1, r2] - movs r1, 0x64 - muls r1, r2 - adds r1, r3 - movs r2, 0x64 - bl memcpy - b _080CE064 - .pool -_080CE054: - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - ldr r0, =0x000020a4 - adds r2, r0 - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_80D2054 -_080CE064: - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_80CE0E8 - ldr r0, =sMovingMonOrigBoxId - strb r4, [r0] - ldr r0, =sMovingMonOrigBoxPos - strb r5, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE018 - - thumb_func_start diegohint2 -diegohint2: @ 80CE08C - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r7, r1, 24 - cmp r6, 0xE - bne _080CE0C0 - ldr r1, =gPlayerParty - movs r0, 0x64 - muls r0, r7 - adds r0, r1 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - ldr r2, =0x000020a4 - adds r1, r2 - movs r2, 0x64 - bl memcpy - b _080CE0D8 - .pool -_080CE0C0: - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - ldr r4, =0x000020a4 - adds r0, r4 - bl BoxMonRestorePP - ldr r2, [r5] - adds r2, r4 - adds r0, r6, 0 - adds r1, r7, 0 - bl CopyBoxMonFromAnyBox -_080CE0D8: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end diegohint2 - - thumb_func_start sub_80CE0E8 -sub_80CE0E8: @ 80CE0E8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - cmp r0, 0xE - bne _080CE108 - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - bl ZeroMonData - b _080CE10C - .pool -_080CE108: - bl ClearMonInBox -_080CE10C: - pop {r0} - bx r0 - thumb_func_end sub_80CE0E8 - - thumb_func_start diegohint1 -diegohint1: @ 80CE110 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r7, r1, 24 - cmp r6, 0xE - bne _080CE144 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00002108 - adds r0, r1 - ldr r2, =gPlayerParty - movs r1, 0x64 - muls r1, r7 - adds r1, r2 - movs r2, 0x64 - bl memcpy - b _080CE154 - .pool -_080CE144: - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - ldr r0, =0x00002108 - adds r2, r0 - adds r0, r6, 0 - adds r1, r7, 0 - bl sub_80D2054 -_080CE154: - adds r0, r6, 0 - adds r1, r7, 0 - bl diegohint2 - ldr r5, =gUnknown_02039D08 - ldr r1, [r5] - ldr r4, =0x000020a4 - adds r0, r1, r4 - ldr r2, =0x00002108 - adds r1, r2 - movs r2, 0x64 - bl memcpy - ldr r0, [r5] - adds r0, r4 - movs r1, 0 - bl sub_80CEC00 - ldr r0, =sMovingMonOrigBoxId - strb r6, [r0] - ldr r0, =sMovingMonOrigBoxPos - strb r7, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end diegohint1 - - thumb_func_start sub_80CE19C -sub_80CE19C: @ 80CE19C - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - adds r0, r6, 0 - bl GetFirstFreeBoxSpot - lsls r0, 16 - lsrs r4, r0, 16 - asrs r0, 16 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - bne _080CE1BA - movs r0, 0 - b _080CE21A -_080CE1BA: - ldr r5, =sIsMonBeingMoved - ldrb r0, [r5] - cmp r0, 0 - beq _080CE1DC - lsls r4, 24 - lsrs r1, r4, 24 - adds r0, r6, 0 - bl diegohint2 - bl sub_80CBAC4 - movs r0, 0 - strb r0, [r5] - b _080CE1F6 - .pool -_080CE1DC: - ldr r5, =sBoxCursorPosition - ldrb r1, [r5] - movs r0, 0xE - bl sub_80CE018 - lsls r4, 24 - lsrs r1, r4, 24 - adds r0, r6, 0 - bl diegohint2 - ldrb r0, [r5] - bl sub_80CBB68 -_080CE1F6: - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - cmp r6, r0 - bne _080CE208 - lsrs r0, r4, 24 - bl sub_80CB140 -_080CE208: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x1 - bl StartSpriteAnim - movs r0, 0x1 -_080CE21A: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CE19C - - thumb_func_start sub_80CE22C -sub_80CE22C: @ 80CE22C - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0 - bl StartSpriteAnim - bl sub_80CEB40 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE22C - - thumb_func_start sub_80CE250 -sub_80CE250: @ 80CE250 - push {lr} - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CE264 - movs r2, 0x2 - b _080CE274 - .pool -_080CE264: - ldr r0, =sBoxCursorAction - movs r1, 0 - ldrsb r1, [r0, r1] - movs r2, 0x1 - eors r1, r2 - negs r0, r1 - orrs r0, r1 - lsrs r2, r0, 31 -_080CE274: - ldr r0, =sBoxCursorPosition - ldrb r1, [r0] - adds r0, r2, 0 - bl sub_80CBF14 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x000021e0 - adds r0, r1, r2 - ldr r2, =0x00000cee - adds r1, r2 - bl StringCopy - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE250 - - thumb_func_start sub_80CE2A8 -sub_80CE2A8: @ 80CE2A8 - push {lr} - bl sub_80CBFD8 - lsls r0, 24 - cmp r0, 0 - beq _080CE2B8 - movs r0, 0x1 - b _080CE2CA -_080CE2B8: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0 - bl StartSpriteAnim - movs r0, 0 -_080CE2CA: - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CE2A8 - - thumb_func_start sub_80CE2D8 -sub_80CE2D8: @ 80CE2D8 - push {lr} - bl sub_80CC020 - ldr r1, =sIsMonBeingMoved - ldrb r0, [r1] - cmp r0, 0 - beq _080CE2F0 - movs r0, 0 - strb r0, [r1] - b _080CE316 - .pool -_080CE2F0: - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - bne _080CE304 - movs r2, 0xE - b _080CE30C - .pool -_080CE304: - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r2, r0, 24 -_080CE30C: - ldr r0, =sBoxCursorPosition - ldrb r1, [r0] - adds r0, r2, 0 - bl sub_80CE0E8 -_080CE316: - bl sub_80CEB40 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE2D8 - - thumb_func_start sub_80CE324 -sub_80CE324: @ 80CE324 - push {lr} - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CE33E - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x3 - bl StartSpriteAnim -_080CE33E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE324 - - thumb_func_start sub_80CE350 -sub_80CE350: @ 80CE350 - push {r4,r5,lr} - adds r3, r0, 0 - movs r5, 0 - ldr r4, =gUnknown_0857B9A4 -_080CE358: - movs r1, 0 - ldrsb r1, [r4, r1] - cmp r1, 0x22 - beq _080CE378 - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - movs r0, 0x4 - ldrsb r0, [r2, r0] - cmp r1, r0 - bne _080CE37E - movs r1, 0x1 - ldrsb r1, [r4, r1] - movs r0, 0x5 - ldrsb r0, [r2, r0] - cmp r1, r0 - bne _080CE37E -_080CE378: - ldrh r0, [r4, 0x2] - strh r0, [r3] - adds r3, 0x2 -_080CE37E: - adds r4, 0x4 - adds r5, 0x1 - cmp r5, 0x5 - bls _080CE358 - ldr r1, =0x00000163 - adds r0, r1, 0 - strh r0, [r3] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE350 - - thumb_func_start sub_80CE3A0 -sub_80CE3A0: @ 80CE3A0 - push {r4,r5,lr} - bl sub_80CE51C - adds r3, r0, 0 - cmp r3, 0 - bne _080CE3D0 - ldr r2, =gUnknown_02039D08 - ldr r0, [r2] - ldr r1, =0x0000216d - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r2] - ldr r2, =0x0000216c - adds r0, r2 - strb r3, [r0] - b _080CE504 - .pool -_080CE3D0: - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CE418 - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - ldr r3, =0x00002108 - adds r0, r1, r3 - ldr r2, =0x000020a4 - adds r1, r2 - movs r2, 0x64 - bl memcpy - ldr r0, [r4] - ldr r3, =0x00002170 - adds r0, r3 - movs r1, 0xFF - strb r1, [r0] - ldr r0, [r4] - ldr r1, =0x00002171 - adds r0, r1 - movs r1, 0x1 - negs r1, r1 - b _080CE494 - .pool -_080CE418: - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - bne _080CE464 - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r2, =0x00002108 - adds r0, r2 - ldr r3, =gPlayerParty - ldr r1, =sBoxCursorPosition - movs r2, 0 - ldrsb r2, [r1, r2] - movs r1, 0x64 - muls r1, r2 - adds r1, r3 - movs r2, 0x64 - bl memcpy - ldr r0, [r4] - ldr r3, =0x00002170 - adds r0, r3 - movs r1, 0xE - strb r1, [r0] - b _080CE488 - .pool -_080CE464: - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - ldr r1, =sBoxCursorPosition - ldrb r1, [r1] - ldr r4, =gUnknown_02039D08 - ldr r2, [r4] - ldr r3, =0x00002108 - adds r2, r3 - bl sub_80D2054 - bl StorageGetCurrentBox - ldr r1, [r4] - ldr r2, =0x00002170 - adds r1, r2 - strb r0, [r1] -_080CE488: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =sBoxCursorPosition - ldrb r1, [r1] - ldr r3, =0x00002171 - adds r0, r3 -_080CE494: - strb r1, [r0] - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - ldr r4, =0x00002176 - adds r0, r4 - bl sub_80CE350 - ldr r2, [r5] - ldr r1, =0x00002108 - adds r0, r2, r1 - adds r2, r4 - movs r1, 0x51 - bl GetMonData - ldr r2, [r5] - ldr r3, =0x00002174 - adds r1, r2, r3 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - beq _080CE4E8 - ldr r0, =0x0000216d - adds r1, r2, r0 - movs r0, 0 - strb r0, [r1] - b _080CE4F8 - .pool -_080CE4E8: - ldr r1, =0x0000216d - adds r0, r2, r1 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r5] - ldr r2, =0x0000216c - adds r0, r2 - strb r1, [r0] -_080CE4F8: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r3, =0x00002172 - adds r0, r3 - movs r1, 0 - strh r1, [r0] -_080CE504: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE3A0 - - thumb_func_start sub_80CE51C -sub_80CE51C: @ 80CE51C - push {r4-r6,lr} - ldr r0, =sIsMonBeingMoved - ldrb r1, [r0] - negs r0, r1 - orrs r0, r1 - lsrs r5, r0, 31 - movs r4, 0 -_080CE52A: - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x5 - bl GetMonData - cmp r0, 0 - beq _080CE53E - adds r5, 0x1 -_080CE53E: - adds r4, 0x1 - cmp r4, 0x5 - ble _080CE52A - cmp r5, 0x2 - ble _080CE554 -_080CE548: - movs r0, 0x1 - b _080CE578 - .pool -_080CE554: - movs r6, 0 -_080CE556: - movs r4, 0 -_080CE558: - adds r0, r6, 0 - adds r1, r4, 0 - bl sub_80D2270 - cmp r0, 0 - beq _080CE56A - adds r5, 0x1 - cmp r5, 0x2 - bgt _080CE548 -_080CE56A: - adds r4, 0x1 - cmp r4, 0x1D - ble _080CE558 - adds r6, 0x1 - cmp r6, 0xD - ble _080CE556 - movs r0, 0 -_080CE578: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80CE51C - - thumb_func_start sub_80CE580 -sub_80CE580: @ 80CE580 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - ldr r3, =0x0000216d - adds r1, r2, r3 - ldrb r1, [r1] - adds r5, r0, 0 - cmp r1, 0 - beq _080CE5B0 - ldr r1, =0x0000216c - adds r0, r2, r1 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - b _080CE736 - .pool -_080CE5B0: - ldr r3, =0x00002172 - adds r0, r2, r3 - ldrh r0, [r0] - cmp r0, 0 - beq _080CE5C4 - cmp r0, 0x1 - beq _080CE690 - b _080CE732 - .pool -_080CE5C4: - movs r6, 0 -_080CE5C6: - ldr r2, [r5] - ldr r1, =0x00002170 - adds r0, r2, r1 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0xE - bne _080CE5E4 - ldr r3, =0x00002171 - adds r0, r2, r3 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, r6 - beq _080CE606 -_080CE5E4: - movs r0, 0x64 - muls r0, r6 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =0x00002176 - adds r2, r1 - movs r1, 0x51 - bl GetMonData - lsls r0, 16 - lsrs r4, r0, 16 - ldr r1, [r5] - ldr r2, =0x00002174 - adds r1, r2 - ldrh r0, [r1] - bics r0, r4 - strh r0, [r1] -_080CE606: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x5 - bls _080CE5C6 - ldr r2, =gUnknown_02039D08 - ldr r1, [r2] - ldr r3, =0x00002174 - adds r0, r1, r3 - ldrh r0, [r0] - cmp r0, 0 - bne _080CE64C - subs r3, 0x7 - adds r0, r1, r3 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r2] - ldr r2, =0x0000216c - adds r0, r2 - strb r1, [r0] - b _080CE732 - .pool -_080CE64C: - ldr r3, =0x0000216e - adds r0, r1, r3 - movs r1, 0 - strb r1, [r0] - ldr r0, [r2] - adds r3, 0x1 - adds r0, r3 - strb r1, [r0] - ldr r1, [r2] - ldr r0, =0x00002172 - adds r1, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - b _080CE732 - .pool -_080CE674: - ldr r1, =0x0000216d - adds r0, r5, r1 - movs r1, 0x1 - strb r1, [r0] - mov r2, r8 - ldr r0, [r2] - ldr r3, =0x0000216c - adds r0, r3 - strb r1, [r0] - b _080CE732 - .pool -_080CE690: - movs r6, 0 - mov r8, r5 - ldr r7, =0x0000ffff -_080CE696: - mov r0, r8 - ldr r3, [r0] - ldr r1, =0x0000216e - adds r0, r3, r1 - ldrb r0, [r0] - ldr r2, =0x0000216f - adds r1, r3, r2 - ldrb r1, [r1] - adds r2, 0x7 - adds r3, r2 - movs r2, 0x51 - bl GetAndCopyBoxMonDataFromAnyBox - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0 - beq _080CE6E0 - ldr r5, [r5] - ldr r3, =0x00002170 - adds r0, r5, r3 - ldrh r2, [r0] - ldr r1, =0x0000216e - adds r0, r5, r1 - ldrh r3, [r0] - adds r1, r7, 0 - ands r1, r2 - adds r0, r7, 0 - ands r0, r3 - cmp r1, r0 - beq _080CE6E0 - ldr r2, =0x00002174 - adds r1, r5, r2 - ldrh r0, [r1] - bics r0, r4 - strh r0, [r1] - cmp r0, 0 - beq _080CE674 -_080CE6E0: - ldr r2, =gUnknown_02039D08 - ldr r1, [r2] - ldr r3, =0x0000216f - adds r1, r3 - ldrb r0, [r1] - adds r0, 0x1 - movs r3, 0 - strb r0, [r1] - lsls r0, 24 - asrs r0, 24 - adds r5, r2, 0 - cmp r0, 0x1D - ble _080CE728 - ldr r0, [r2] - ldr r1, =0x0000216f - adds r0, r1 - strb r3, [r0] - ldr r1, [r2] - ldr r0, =0x0000216e - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0xD - ble _080CE728 - ldr r0, [r2] - ldr r1, =0x0000216d - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r2] - ldr r2, =0x0000216c - adds r0, r2 - strb r3, [r0] -_080CE728: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x1D - bls _080CE696 -_080CE732: - movs r0, 0x1 - negs r0, r0 -_080CE736: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CE580 - thumb_func_start sub_80CE760 sub_80CE760: @ 80CE760 push {lr} @@ -6791,7 +90,7 @@ sub_80CE7E8: @ 80CE7E8 b _080CE8CA .pool _080CE838: - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -6980,7 +279,7 @@ sub_80CE9A8: @ 80CE9A8 b _080CEA1C .pool _080CE9E8: - ldr r4, =sBoxCursorAction + ldr r4, =sBoxCursorArea movs r0, 0 ldrsb r0, [r4, r0] cmp r0, 0x1 @@ -7016,7 +315,7 @@ _080CEA1C: thumb_func_start CanMoveMon CanMoveMon: @ 80CEA30 push {lr} - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -7049,7 +348,7 @@ CanShifMon: @ 80CEA6C ldrb r0, [r0] cmp r0, 0 beq _080CEAC8 - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -7097,7 +396,7 @@ IsMonBeingMoved: @ 80CEAD0 IsCursorOnBox: @ 80CEADC push {lr} movs r1, 0 - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -7115,7 +414,7 @@ _080CEAEE: IsCursorOnCloseBox: @ 80CEAF8 push {lr} movs r1, 0 - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -7139,7 +438,7 @@ _080CEB16: IsCursorInBox: @ 80CEB24 push {lr} movs r1, 0 - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -7171,7 +470,7 @@ _080CEB52: ldrb r0, [r3] cmp r0, 0 bne _080CEBD0 - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -7769,7 +1068,7 @@ sub_80CF108: @ 80CF108 mov r6, r9 mov r5, r8 push {r5-r7} - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] mov r8, r0 ldr r2, =sBoxCursorPosition @@ -8341,7 +1640,7 @@ sub_80CF5C4: @ 80CF5C4 mov r7, r9 mov r6, r8 push {r6,r7} - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] mov r9, r0 ldr r6, =sBoxCursorPosition @@ -8729,7 +2028,7 @@ sub_80CF8D8: @ 80CF8D8 push {r4-r7,lr} mov r7, r8 push {r7} - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] mov r8, r0 ldr r0, =sBoxCursorPosition @@ -8872,7 +2171,7 @@ sub_80CF9EC: @ 80CF9EC adds r4, r0, 0 cmp r1, 0 beq _080CFA30 - ldr r5, =sBoxCursorAction + ldr r5, =sBoxCursorArea _080CF9FC: lsls r0, r3, 3 adds r2, r0, r4 @@ -9007,7 +2306,7 @@ _080CFAF8: ldrb r0, [r0, 0x1] cmp r0, 0x2 bne _080CFB2A - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -9166,7 +2465,7 @@ sub_80CFC14: @ 80CFC14 ldr r5, =0x00000cd9 adds r1, r5 strb r0, [r1] - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] ldr r1, =sBoxCursorPosition ldrb r1, [r1] @@ -9236,7 +2535,7 @@ _080CFD18: movs r1, 0 str r1, [r0] _080CFD22: - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -9275,7 +2574,7 @@ _080CFD40: ands r0, r2 orrs r0, r3 strb r0, [r1, 0x5] - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -9352,7 +2651,7 @@ sub_80CFE14: @ 80CFE14 push {r4-r6,lr} adds r5, r0, 0 adds r6, r1, 0 - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -9426,7 +2725,7 @@ sub_80CFE84: @ 80CFE84 thumb_func_start sub_80CFEA8 sub_80CFEA8: @ 80CFEA8 push {lr} - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -9445,7 +2744,7 @@ _080CFEC0: thumb_func_start sub_80CFECC sub_80CFECC: @ 80CFECC push {lr} - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -10111,7 +3410,7 @@ _080D0442: movs r0, 0 b _080D046C _080D044E: - bl sub_80CDCAC + bl DoMonPlaceChange lsls r0, 24 cmp r0, 0 bne _080D0498 @@ -10135,7 +3434,7 @@ _080D047A: adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_80CDCAC + bl DoMonPlaceChange lsls r0, 24 lsrs r0, 24 cmp r4, 0 @@ -10207,7 +3506,7 @@ _080D04EE: bl sub_80CDC64 b _080D0546 _080D0506: - bl sub_80CDCAC + bl DoMonPlaceChange lsls r0, 24 cmp r0, 0 bne _080D0576 @@ -10224,7 +3523,7 @@ _080D0506: bl HideBg b _080D0546 _080D0532: - bl sub_80CDCAC + bl DoMonPlaceChange lsls r0, 24 cmp r0, 0 bne _080D0576 @@ -10580,12 +3879,12 @@ sub_80D07B0: @ 80D07B0 lsrs r4, 24 adds r0, r4, 0 movs r1, 0x41 - bl GetBoxMonDataFromSelectedBox + bl GetCurrentBoxMonData lsls r0, 16 lsrs r5, r0, 16 adds r0, r4, 0 movs r1, 0 - bl GetBoxMonDataFromSelectedBox + bl GetCurrentBoxMonData adds r1, r0, 0 cmp r5, 0 beq _080D0828 @@ -10644,7 +3943,7 @@ sub_80D0834: @ 80D0834 lsls r0, 24 lsrs r0, 24 movs r1, 0x41 - bl GetBoxMonDataFromSelectedBox + bl GetCurrentBoxMonData lsls r0, 16 cmp r0, 0 beq _080D0878 @@ -10867,10 +4166,10 @@ _080D09D0: subs r4, r7, r4 _080D09EC: adds r0, r5, 0 - bl sub_80CB778 + bl DestroyBoxMonIconAtPosition mov r0, r8 adds r1, r5, 0 - bl ClearMonInBox + bl ZeroBoxMonAt adds r0, r5, 0x1 lsls r0, 24 lsrs r5, r0, 24 @@ -11032,7 +4331,7 @@ _080D0B04: adds r2, r4 ldr r0, [sp, 0x4] adds r1, r6, 0 - bl CopyBoxMonFromAnyBox + bl SetBoxMonAt _080D0B2C: adds r0, r6, 0x1 lsls r0, 24 @@ -11161,7 +4460,7 @@ _080D0C04: beq _080D0C30 adds r0, r5, 0 movs r1, 0x5 - bl GetBoxMonDataFromSelectedBox + bl GetCurrentBoxMonData cmp r0, 0 beq _080D0C30 movs r0, 0 @@ -11355,12 +4654,12 @@ sub_80D0D8C: @ 80D0D8C _080D0DC4: adds r0, r7, 0 movs r1, 0x5 - bl GetBoxMonDataFromSelectedBox + bl GetCurrentBoxMonData cmp r0, 0 beq _080D0E42 adds r0, r7, 0 movs r1, 0xC - bl GetBoxMonDataFromSelectedBox + bl GetCurrentBoxMonData b _080D0DFC _080D0DDA: cmp r7, 0x5 @@ -11492,7 +4791,7 @@ sub_80D0E90: @ 80D0E90 bl SetCurrentBoxMonData adds r0, r5, 0 movs r1, 0x1 - bl sub_80CB7AC + bl SetBoxMonIconObjMode b _080D0F10 .pool _080D0EF8: @@ -11505,7 +4804,7 @@ _080D0EF8: bl SetMonData adds r0, r7, 0 movs r1, 0x1 - bl sub_80CBBDC + bl SetPartyMonIconObjMode _080D0F10: ldr r0, =gUnknown_02039D08 ldr r0, [r0] @@ -11608,7 +4907,7 @@ sub_80D0FAC: @ 80D0FAC bne _080D101C adds r0, r7, 0 movs r1, 0xC - bl GetBoxMonDataFromSelectedBox + bl GetCurrentBoxMonData lsls r0, 16 lsrs r6, r0, 16 mov r0, r8 @@ -11708,7 +5007,7 @@ sub_80D1080: @ 80D1080 bl SetCurrentBoxMonData adds r0, r5, 0 movs r1, 0 - bl sub_80CB7AC + bl SetBoxMonIconObjMode b _080D1100 .pool _080D10E0: @@ -11725,7 +5024,7 @@ _080D10E0: bl SetMonData mov r0, r8 movs r1, 0 - bl sub_80CBBDC + bl SetPartyMonIconObjMode _080D1100: pop {r3} mov r8, r3 @@ -11774,7 +5073,7 @@ sub_80D1114: @ 80D1114 bl SetCurrentBoxMonData adds r0, r5, 0 movs r1, 0x1 - bl sub_80CB7AC + bl SetBoxMonIconObjMode b _080D1188 .pool _080D1170: @@ -11787,7 +5086,7 @@ _080D1170: bl SetMonData adds r0, r7, 0 movs r1, 0x1 - bl sub_80CBBDC + bl SetPartyMonIconObjMode _080D1188: add sp, 0x4 pop {r4-r7} @@ -13266,8 +6565,8 @@ _080D1D28: .pool thumb_func_end SetCurrentBox - thumb_func_start GetBoxMonDataFromAnyBox -GetBoxMonDataFromAnyBox: @ 80D1D30 + thumb_func_start GetBoxMonDataAt +GetBoxMonDataAt: @ 80D1D30 push {r4,r5,lr} adds r5, r2, 0 lsls r0, 24 @@ -13301,7 +6600,7 @@ _080D1D6E: pop {r4,r5} pop {r1} bx r1 - thumb_func_end GetBoxMonDataFromAnyBox + thumb_func_end GetBoxMonDataAt thumb_func_start SetBoxMonDataFromAnyBox SetBoxMonDataFromAnyBox: @ 80D1D74 @@ -13339,8 +6638,8 @@ _080D1DAC: .pool thumb_func_end SetBoxMonDataFromAnyBox - thumb_func_start GetBoxMonDataFromSelectedBox -GetBoxMonDataFromSelectedBox: @ 80D1DB8 + thumb_func_start GetCurrentBoxMonData +GetCurrentBoxMonData: @ 80D1DB8 push {lr} adds r3, r0, 0 adds r2, r1, 0 @@ -13350,11 +6649,11 @@ GetBoxMonDataFromSelectedBox: @ 80D1DB8 ldr r0, [r0] ldrb r0, [r0] adds r1, r3, 0 - bl GetBoxMonDataFromAnyBox + bl GetBoxMonDataAt pop {r1} bx r1 .pool - thumb_func_end GetBoxMonDataFromSelectedBox + thumb_func_end GetCurrentBoxMonData thumb_func_start SetCurrentBoxMonData SetCurrentBoxMonData: @ 80D1DD8 @@ -13490,8 +6789,8 @@ _080D1EC6: .pool thumb_func_end SetBoxMonNickFromAnyBox - thumb_func_start GetAndCopyBoxMonDataFromAnyBox -GetAndCopyBoxMonDataFromAnyBox: @ 80D1ED0 + thumb_func_start GetAndCopyBoxMonDataAt +GetAndCopyBoxMonDataAt: @ 80D1ED0 push {r4-r6,lr} adds r5, r2, 0 adds r6, r3, 0 @@ -13527,10 +6826,10 @@ _080D1F12: pop {r4-r6} pop {r1} bx r1 - thumb_func_end GetAndCopyBoxMonDataFromAnyBox + thumb_func_end GetAndCopyBoxMonDataAt - thumb_func_start CopyBoxMonFromAnyBox -CopyBoxMonFromAnyBox: @ 80D1F18 + thumb_func_start SetBoxMonAt +SetBoxMonAt: @ 80D1F18 push {r4,r5,lr} adds r5, r2, 0 lsls r0, 24 @@ -13562,7 +6861,7 @@ _080D1F4E: pop {r0} bx r0 .pool - thumb_func_end CopyBoxMonFromAnyBox + thumb_func_end SetBoxMonAt thumb_func_start sub_80D1F58 sub_80D1F58: @ 80D1F58 @@ -13665,8 +6964,8 @@ _080D2004: .pool thumb_func_end sub_80D1F98 - thumb_func_start ClearMonInBox -ClearMonInBox: @ 80D2018 + thumb_func_start ZeroBoxMonAt +ZeroBoxMonAt: @ 80D2018 push {r4,lr} lsls r0, 24 lsrs r3, r0, 24 @@ -13695,10 +6994,10 @@ _080D2048: pop {r0} bx r0 .pool - thumb_func_end ClearMonInBox + thumb_func_end ZeroBoxMonAt - thumb_func_start sub_80D2054 -sub_80D2054: @ 80D2054 + thumb_func_start BoxMonAtToMon +BoxMonAtToMon: @ 80D2054 push {r4,r5,lr} adds r5, r2, 0 lsls r0, 24 @@ -13729,7 +7028,7 @@ _080D2088: pop {r0} bx r0 .pool - thumb_func_end sub_80D2054 + thumb_func_end BoxMonAtToMon thumb_func_start GetBoxedMonPtr @ pokemon *GetBoxedMonPtr(u8 box_id, u8 pos) @@ -13789,8 +7088,8 @@ _080D20EC: .pool thumb_func_end GetBoxNamePtr - thumb_func_start sub_80D20F8 -sub_80D20F8: @ 80D20F8 + thumb_func_start GetBoxWallpaper +GetBoxWallpaper: @ 80D20F8 push {lr} lsls r0, 24 lsrs r1, r0, 24 @@ -13809,7 +7108,7 @@ _080D2112: pop {r1} bx r1 .pool - thumb_func_end sub_80D20F8 + thumb_func_end GetBoxWallpaper thumb_func_start SetBoxWallpaper SetBoxWallpaper: @ 80D2120 @@ -13994,8 +7293,8 @@ _080D2262: bx r1 thumb_func_end CheckFreePokemonStorageSpace - thumb_func_start sub_80D2270 -sub_80D2270: @ 80D2270 + thumb_func_start CheckBoxedMonSanity +CheckBoxedMonSanity: @ 80D2270 push {r4-r6,lr} adds r2, r1, 0 cmp r0, 0xD @@ -14042,7 +7341,7 @@ _080D22CA: pop {r4-r6} pop {r1} bx r1 - thumb_func_end sub_80D2270 + thumb_func_end CheckBoxedMonSanity thumb_func_start sub_80D22D0 sub_80D22D0: @ 80D22D0 diff --git a/asm/pokenav.s b/asm/pokenav.s index 6fedbbd58..1ec7c15e1 100644 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -409,14 +409,14 @@ _081C73C2: _081C73C6: adds r0, r4, 0 adds r1, r5, 0 - bl sub_80D2270 + bl CheckBoxedMonSanity cmp r0, 0 beq _081C73EC lsls r1, r5, 24 lsrs r1, 24 lsrs r0, r6, 24 movs r2, 0x52 - bl GetBoxMonDataFromAnyBox + bl GetBoxMonDataAt cmp r0, 0 beq _081C73EC _081C73E2: @@ -16376,7 +16376,7 @@ _081CF1F4: _081CF1FC: adds r0, r5, 0 adds r1, r4, 0 - bl sub_80D2270 + bl CheckBoxedMonSanity cmp r0, 0 beq _081CF23A ldr r1, =0xffffff00 @@ -16392,7 +16392,7 @@ _081CF1FC: str r0, [sp] ldr r2, [r6, 0x14] adds r0, r7, 0 - bl GetBoxMonDataFromAnyBox + bl GetBoxMonDataAt lsls r0, 16 ldr r2, =0x0000ffff ldr r1, [sp] @@ -17735,7 +17735,7 @@ sub_81CFC40: @ 81CFC40 _081CFC60: adds r0, r7, 0 adds r1, r6, 0 - bl sub_80D2270 + bl CheckBoxedMonSanity cmp r0, 0 beq _081CFCA6 lsls r0, r7, 24 @@ -17745,7 +17745,7 @@ _081CFC60: adds r0, r5, 0 adds r1, r4, 0 movs r2, 0x52 - bl GetBoxMonDataFromAnyBox + bl GetBoxMonDataAt adds r3, r0, 0 cmp r3, 0 beq _081CFCA6 @@ -17900,14 +17900,14 @@ _081CFD92: _081CFD96: adds r0, r5, 0 adds r1, r4, 0 - bl sub_80D2270 + bl CheckBoxedMonSanity cmp r0, 0 beq _081CFDBC lsls r1, r4, 24 lsrs r1, 24 lsrs r0, r6, 24 movs r2, 0x53 - bl GetBoxMonDataFromAnyBox + bl GetBoxMonDataAt cmp r0, 0 beq _081CFDBC _081CFDB2: @@ -19257,7 +19257,7 @@ sub_81D07D8: @ 81D07D8 beq _081D07FA ldrb r1, [r1, 0x1] movs r2, 0x52 - bl GetBoxMonDataFromAnyBox + bl GetBoxMonDataAt b _081D080A _081D07FA: ldrb r1, [r1, 0x1] @@ -19302,7 +19302,7 @@ _081D0848: ldrb r0, [r1] ldrb r1, [r1, 0x1] movs r2, 0x53 - bl GetBoxMonDataFromAnyBox + bl GetBoxMonDataAt _081D0852: mov r12, r0 movs r0, 0 @@ -23046,14 +23046,14 @@ _081D2CB0: lsrs r0, 24 lsls r1, 24 lsrs r1, 24 - bl GetAndCopyBoxMonDataFromAnyBox + bl GetAndCopyBoxMonDataAt b _081D2CCA _081D2CBE: lsls r0, 24 lsrs r0, 24 lsls r1, 24 lsrs r1, 24 - bl GetBoxMonDataFromAnyBox + bl GetBoxMonDataAt _081D2CCA: pop {r1} bx r1 diff --git a/data/pokemon_storage_system.s b/data/pokemon_storage_system.s index 83344022f..a49793c74 100644 --- a/data/pokemon_storage_system.s +++ b/data/pokemon_storage_system.s @@ -4,441 +4,6 @@ .section .rodata - .align 2 -PCGfx_Arrow: @ 8577678 - .incbin "graphics/pokemon_storage/arrow.4bpp" - - .align 2 -gWallpaperPalettes_Zigzagoon:: @ 85776F8 - .incbin "graphics/pokemon_storage/friends_frame1.gbapal" - .incbin "graphics/pokemon_storage/zigzagoon_bg.gbapal" - - .align 2 -gWallpaperTiles_Zigzagoon: @ 8577738 - .incbin "graphics/pokemon_storage/zigzagoon.4bpp.lz" - - .align 2 -gWallpaperTilemap_Zigzagoon: @ 857792C - .incbin "graphics/pokemon_storage/zigzagoon.bin.lz" - - .align 2 -gWallpaperPalettes_Screen:: @ 8577A44 - .incbin "graphics/pokemon_storage/friends_frame1.gbapal" - .incbin "graphics/pokemon_storage/screen_bg.gbapal" - - .align 2 -gWallpaperTiles_Screen: @ 8577A84 - .incbin "graphics/pokemon_storage/screen.4bpp.lz" - - .align 2 -gWallpaperTilemap_Screen: @ 8577D00 - .incbin "graphics/pokemon_storage/screen.bin.lz" - - .align 2 -gWallpaperPalettes_Diagonal:: @ 8577E2C - .incbin "graphics/pokemon_storage/friends_frame1.gbapal" - .incbin "graphics/pokemon_storage/diagonal_bg.gbapal" - - .align 2 -gWallpaperTiles_Diagonal: @ 8577E6C - .incbin "graphics/pokemon_storage/diagonal.4bpp.lz" - - .align 2 -gWallpaperTilemap_Diagonal: @ 8578058 - .incbin "graphics/pokemon_storage/diagonal.bin.lz" - - .align 2 -gWallpaperPalettes_Block:: @ 8578148 - .incbin "graphics/pokemon_storage/block_bg.gbapal" - .incbin "graphics/pokemon_storage/block_bg.gbapal" - - .align 2 -gWallpaperTiles_Block: @ 8578188 - .incbin "graphics/pokemon_storage/block.4bpp.lz" - - .align 2 -gWallpaperTilemap_Block: @ 8578358 - .incbin "graphics/pokemon_storage/block.bin.lz" - - .align 2 -gWallpaperPalettes_Pokecenter2:: @ 8578450 - .incbin "graphics/pokemon_storage/pokecenter2_bg.gbapal" - .incbin "graphics/pokemon_storage/pokecenter2_bg.gbapal" - - .align 2 -gWallpaperTiles_Pokecenter2: @ 8578490 - .incbin "graphics/pokemon_storage/pokecenter2.4bpp.lz" - - .align 2 -gWallpaperTilemap_Pokecenter2: @ 85786D0 - .incbin "graphics/pokemon_storage/pokecenter2.bin.lz" - - .align 2 -gWallpaperPalettes_Frame:: @ 85787E4 - .incbin "graphics/pokemon_storage/frame_bg.gbapal" - .incbin "graphics/pokemon_storage/frame_bg.gbapal" - - .align 2 -gWallpaperTiles_Frame: @ 8578824 - .incbin "graphics/pokemon_storage/frame.4bpp.lz" - - .align 2 -gWallpaperTilemap_Frame: @ 8578A34 - .incbin "graphics/pokemon_storage/frame.bin.lz" - - .align 2 -gWallpaperPalettes_Blank:: @ 8578B48 - .incbin "graphics/pokemon_storage/friends_frame1.gbapal" - .incbin "graphics/pokemon_storage/zigzagoon_bg.gbapal" - - .align 2 -gWallpaperTiles_Blank: @ 8578B88 - .incbin "graphics/pokemon_storage/blank.4bpp.lz" - - .align 2 -gWallpaperTilemap_Blank: @ 8578D34 - .incbin "graphics/pokemon_storage/blank.bin.lz" - - .align 2 -gWallpaperPalettes_Circles:: @ 8578E10 - .incbin "graphics/pokemon_storage/friends_frame2.gbapal" - .incbin "graphics/pokemon_storage/circles_bg.gbapal" - - .align 2 -gWallpaperTiles_Circles: @ 8578E50 - .incbin "graphics/pokemon_storage/circles.4bpp.lz" - - .align 2 -gWallpaperTilemap_Circles: @ 85790A4 - .incbin "graphics/pokemon_storage/circles.bin.lz" - - .align 2 -gWallpaperPalettes_Azumarill:: @ 85791A0 - .incbin "graphics/pokemon_storage/friends_frame2.gbapal" - .incbin "graphics/pokemon_storage/azumarill_bg.gbapal" - - .align 2 -gWallpaperTiles_Azumarill: @ 85791E0 - .incbin "graphics/pokemon_storage/azumarill.4bpp.lz" - - .align 2 -gWallpaperTilemap_Azumarill: @ 85793CC - .incbin "graphics/pokemon_storage/azumarill.bin.lz" - - .align 2 -gWallpaperPalettes_Pikachu:: @ 85794C4 - .incbin "graphics/pokemon_storage/friends_frame2.gbapal" - .incbin "graphics/pokemon_storage/pikachu_bg.gbapal" - - .align 2 -gWallpaperTiles_Pikachu: @ 8579504 - .incbin "graphics/pokemon_storage/pikachu.4bpp.lz" - - .align 2 -gWallpaperTilemap_Pikachu: @ 8579738 - .incbin "graphics/pokemon_storage/pikachu.bin.lz" - - .align 2 -gWallpaperPalettes_Legendary:: @ 8579860 - .incbin "graphics/pokemon_storage/friends_frame2.gbapal" - .incbin "graphics/pokemon_storage/legendary_bg.gbapal" - - .align 2 -gWallpaperTiles_Legendary: @ 85798A0 - .incbin "graphics/pokemon_storage/legendary.4bpp.lz" - - .align 2 -gWallpaperTilemap_Legendary: @ 8579B80 - .incbin "graphics/pokemon_storage/legendary.bin.lz" - - .align 2 -gWallpaperPalettes_Dusclops:: @ 8579CC4 - .incbin "graphics/pokemon_storage/friends_frame2.gbapal" - .incbin "graphics/pokemon_storage/dusclops_bg.gbapal" - - .align 2 -gWallpaperTiles_Dusclops: @ 8579D04 - .incbin "graphics/pokemon_storage/dusclops.4bpp.lz" - - .align 2 -gWallpaperTilemap_Dusclops: @ 8579F50 - .incbin "graphics/pokemon_storage/dusclops.bin.lz" - - .align 2 -gWallpaperPalettes_Ludicolo:: @ 857A048 - .incbin "graphics/pokemon_storage/friends_frame2.gbapal" - .incbin "graphics/pokemon_storage/ludicolo_bg.gbapal" - - .align 2 -gWallpaperTiles_Ludicolo: @ 857A088 - .incbin "graphics/pokemon_storage/ludicolo.4bpp.lz" - - .align 2 -gWallpaperTilemap_Ludicolo: @ 857A348 - .incbin "graphics/pokemon_storage/ludicolo.bin.lz" - - .align 2 -gWallpaperPalettes_Whiscash:: @ 857A468 - .incbin "graphics/pokemon_storage/friends_frame2.gbapal" - .incbin "graphics/pokemon_storage/whiscash_bg.gbapal" - - .align 2 -gWallpaperTiles_Whiscash: @ 857A4A8 - .incbin "graphics/pokemon_storage/whiscash.4bpp.lz" - - .align 2 -gWallpaperTilemap_Whiscash: @ 857A6F0 - .incbin "graphics/pokemon_storage/whiscash.bin.lz" - - .align 2 -gWallpaperIcon_Aqua: @ 857A81C - .incbin "graphics/pokemon_storage/aqua_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Heart: @ 857A860 - .incbin "graphics/pokemon_storage/heart_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_FiveStar: @ 857A89C - .incbin "graphics/pokemon_storage/five_star_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Brick: @ 857A8DC - .incbin "graphics/pokemon_storage/brick_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_FourStar: @ 857A904 - .incbin "graphics/pokemon_storage/four_star_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Asterisk: @ 857A940 - .incbin "graphics/pokemon_storage/asterisk_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Dot: @ 857A990 - .incbin "graphics/pokemon_storage/dot_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_LineCircle: @ 857A9C0 - .incbin "graphics/pokemon_storage/line_circle_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_PokeBall: @ 857A9EC - .incbin "graphics/pokemon_storage/pokeball_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Maze: @ 857AA38 - .incbin "graphics/pokemon_storage/maze_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Footprint: @ 857AA7C - .incbin "graphics/pokemon_storage/footprint_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_BigAsterisk: @ 857AAC4 - .incbin "graphics/pokemon_storage/big_asterisk_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Circle: @ 857AB08 - .incbin "graphics/pokemon_storage/circle_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Koffing: @ 857AB48 - .incbin "graphics/pokemon_storage/koffing_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Ribbon: @ 857AB98 - .incbin "graphics/pokemon_storage/ribbon_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_FourCircles: @ 857AC00 - .incbin "graphics/pokemon_storage/four_circles_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Lotad: @ 857AC30 - .incbin "graphics/pokemon_storage/lotad_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Crystal: @ 857AC74 - .incbin "graphics/pokemon_storage/crystal_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Pichu: @ 857ACBC - .incbin "graphics/pokemon_storage/pichu_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Diglett: @ 857ACF4 - .incbin "graphics/pokemon_storage/diglett_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Luvdisc: @ 857AD44 - .incbin "graphics/pokemon_storage/luvdisc_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_StarInCircle: @ 857AD88 - .incbin "graphics/pokemon_storage/star_in_circle_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Spinda: @ 857ADCC - .incbin "graphics/pokemon_storage/spinda_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Latis: @ 857AE20 - .incbin "graphics/pokemon_storage/latis_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Minun: @ 857AE64 - .incbin "graphics/pokemon_storage/minun_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Togepi: @ 857AEAC - .incbin "graphics/pokemon_storage/togepi_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Magma: @ 857AF08 - .incbin "graphics/pokemon_storage/magma_icon.4bpp.lz" - - .align 2 -gUnknown_0857AF44:: @ 857AF44 - .4byte gWallpaperTiles_Zigzagoon, gWallpaperTilemap_Zigzagoon, gWallpaperPalettes_Zigzagoon - .4byte gWallpaperTiles_Screen, gWallpaperTilemap_Screen, gWallpaperPalettes_Screen - .4byte gWallpaperTiles_Horizontal, gWallpaperTilemap_Horizontal, gWallpaperPalettes_Horizontal - .4byte gWallpaperTiles_Diagonal, gWallpaperTilemap_Diagonal, gWallpaperPalettes_Diagonal - .4byte gWallpaperTiles_Block, gWallpaperTilemap_Block, gWallpaperPalettes_Block - .4byte gWallpaperTiles_Ribbon, gWallpaperTilemap_Ribbon, gWallpaperPalettes_Ribbon - .4byte gWallpaperTiles_Pokecenter2, gWallpaperTilemap_Pokecenter2, gWallpaperPalettes_Pokecenter2 - .4byte gWallpaperTiles_Frame, gWallpaperTilemap_Frame, gWallpaperPalettes_Frame - .4byte gWallpaperTiles_Blank, gWallpaperTilemap_Blank, gWallpaperPalettes_Blank - .4byte gWallpaperTiles_Circles, gWallpaperTilemap_Circles, gWallpaperPalettes_Circles - .4byte gWallpaperTiles_Azumarill, gWallpaperTilemap_Azumarill, gWallpaperPalettes_Azumarill - .4byte gWallpaperTiles_Pikachu, gWallpaperTilemap_Pikachu, gWallpaperPalettes_Pikachu - .4byte gWallpaperTiles_Legendary, gWallpaperTilemap_Legendary, gWallpaperPalettes_Legendary - .4byte gWallpaperTiles_Dusclops, gWallpaperTilemap_Dusclops, gWallpaperPalettes_Dusclops - .4byte gWallpaperTiles_Ludicolo, gWallpaperTilemap_Ludicolo, gWallpaperPalettes_Ludicolo - .4byte gWallpaperTiles_Whiscash, gWallpaperTilemap_Whiscash, gWallpaperPalettes_Whiscash - - .align 2 -gUnknown_0857B004:: @ 857B004 - .4byte gWallpaperIcon_Aqua - .4byte gWallpaperIcon_Heart - .4byte gWallpaperIcon_FiveStar - .4byte gWallpaperIcon_Brick - .4byte gWallpaperIcon_FourStar - .4byte gWallpaperIcon_Asterisk - .4byte gWallpaperIcon_Dot - .4byte gWallpaperIcon_Cross - .4byte gWallpaperIcon_LineCircle - .4byte gWallpaperIcon_PokeBall - .4byte gWallpaperIcon_Maze - .4byte gWallpaperIcon_Footprint - .4byte gWallpaperIcon_BigAsterisk - .4byte gWallpaperIcon_Circle - .4byte gWallpaperIcon_Koffing - .4byte gWallpaperIcon_Ribbon - .4byte gWallpaperIcon_Bolt - .4byte gWallpaperIcon_FourCircles - .4byte gWallpaperIcon_Lotad - .4byte gWallpaperIcon_Crystal - .4byte gWallpaperIcon_Pichu - .4byte gWallpaperIcon_Diglett - .4byte gWallpaperIcon_Luvdisc - .4byte gWallpaperIcon_StarInCircle - .4byte gWallpaperIcon_Spinda - .4byte gWallpaperIcon_Latis - .4byte gWallpaperIcon_Plusle - .4byte gWallpaperIcon_Minun - .4byte gWallpaperIcon_Togepi - .4byte gWallpaperIcon_Magma - - .align 2 -gUnknown_0857B07C:: @ 857B07C - .4byte 0x23BA - - .align 2 -gUnknown_0857B080:: @ 857B080 - obj_tiles PCGfx_Arrow, 128, 0x0006 - - .align 2 -gOamData_857B088:: @ 857B088 - .2byte 0x4000 - .2byte 0x8000 - .2byte 0x0800 - - .align 2 -gSpriteAnim_857B090:: @ 857B090 - obj_image_anim_frame 0, 5 - obj_image_anim_end - - .align 2 -gSpriteAnim_857B098:: @ 857B098 - obj_image_anim_frame 8, 5 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_857B0A0:: @ 857B0A0 - .4byte gSpriteAnim_857B090 - .4byte gSpriteAnim_857B098 - - .align 2 -gSpriteTemplate_857B0A8:: @ 857B0A8 - spr_template 0x0003, 0xDAC9, gOamData_857B088, gSpriteAnimTable_857B0A0, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gOamData_857B0C0:: @ 857B0C0 - .2byte 0x8000 - .2byte 0x0000 - .2byte 0x0800 - - .align 2 -gSpriteAnim_857B0C8:: @ 857B0C8 - obj_image_anim_frame 0, 5 - obj_image_anim_end - - .align 2 -gSpriteAnim_857B0D0:: @ 857B0D0 - obj_image_anim_frame 2, 5 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_857B0D8:: @ 857B0D8 - .4byte gSpriteAnim_857B0C8 - .4byte gSpriteAnim_857B0D0 - -gUnknown_0857B0E0:: @ 857B0E0 - spr_template 0x0006, 0xDACA, gOamData_857B0C0, gSpriteAnimTable_857B0D8, NULL, gDummySpriteAffineAnimTable, sub_80CD210 - - .align 2 -HandCursorPalette: @ 857B0F8 - .incbin "graphics/pokemon_storage/hand_cursor.gbapal" - - .align 2 -HandCursorTiles: @ 857B118 - .incbin "graphics/pokemon_storage/hand_cursor.4bpp" - - .align 2 -HandCursorShadowTiles: @ 857B918 - .incbin "graphics/pokemon_storage/hand_cursor_shadow.4bpp" - - .align 2 -gUnknown_0857B998:: @ 857B998 - .4byte sub_80CDCCC - .4byte sub_80CDD5C - .4byte sub_80CDDD8 - - .align 2 -gUnknown_0857B9A4:: @ 857B9A4 - .byte 0x22, 0x00 - .2byte 0x0039 - .byte 0x22, 0x00 - .2byte 0x0123 - .byte 0x10, 0x0a - .2byte 0x0046 - .byte 0x10, 0x0a - .2byte 0x00f9 - .byte 0x10, 0x0e - .2byte 0x0046 - .byte 0x10, 0x0e - .2byte 0x00f9 .align 2 gUnknown_0857B9BC:: @ 857B9BC @@ -450,13 +15,13 @@ gUnknown_0857B9BC:: @ 857B9BC .align 2 gHandCursorSpriteSheets:: @ 857B9E4 - obj_tiles HandCursorTiles, 0x0800, 0x0000 - obj_tiles HandCursorShadowTiles, 0x0080, 0x0001 + obj_tiles gHandCursorTiles, 0x0800, 0x0000 + obj_tiles gHandCursorShadowTiles, 0x0080, 0x0001 null_obj_tiles .align 2 gHandCursorSpritePalettes:: @ 857B9FC - obj_pal HandCursorPalette, 0xDAC7 + obj_pal gHandCursorPalette, 0xDAC7 null_obj_pal .align 2 diff --git a/include/constants/maps.h b/include/constants/maps.h index bcb778422..c65f373af 100644 --- a/include/constants/maps.h +++ b/include/constants/maps.h @@ -587,6 +587,7 @@ // Map Group 33 #define MAP_ROUTE124_DIVING_TREASURE_HUNTERS_HOUSE (0 | (33 << 8)) +#define MAP_GROUPS_COUNT 34 #define MAP_NONE (0x7F | (0x7F << 8)) #define MAP_UNDEFINED (0xFF | (0xFF << 8)) diff --git a/include/global.h b/include/global.h index cc8df049f..c976abd2d 100644 --- a/include/global.h +++ b/include/global.h @@ -858,15 +858,15 @@ typedef union // 3b58 struct WaldaPhrase { - u16 field_0; - u16 field_2; + u16 colors[2]; // Background, foreground. u8 text[16]; u8 iconId; u8 patternId; bool8 patternUnlocked; }; -struct UnkSaveSubstruct_3b98 { +struct UnkSaveSubstruct_3b98 +{ u32 trainerId; u8 trainerName[PLAYER_NAME_LENGTH + 1]; }; diff --git a/include/graphics.h b/include/graphics.h index 658239f5c..bfb57ccb9 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4743,6 +4743,15 @@ extern const u16 gPokedexAreaScreenAreaUnknown_Pal[]; // Pokemon Storage System extern const u32 gPSSMenu_Gfx[]; extern const u16 gPSSMenu_Pal[]; +extern const u32 gWallpaperIcon_Plusle[]; +extern const u32 gWallpaperIcon_Cross[]; +extern const u32 gWallpaperIcon_Bolt[]; extern const u32 gUnknown_08DD36C8[]; +extern const u32 gWallpaperTiles_Ribbon[]; +extern const u32 gWallpaperTilemap_Ribbon[]; +extern const u16 gWallpaperPalettes_Ribbon[][16]; +extern const u32 gWallpaperTiles_Horizontal[]; +extern const u32 gWallpaperTilemap_Horizontal[]; +extern const u16 gWallpaperPalettes_Horizontal[][16]; #endif //GUARD_GRAPHICS_H diff --git a/include/menu.h b/include/menu.h index e7a78f76e..f9b7c52df 100644 --- a/include/menu.h +++ b/include/menu.h @@ -48,11 +48,11 @@ s8 Menu_ProcessInput(void); s8 Menu_ProcessInputNoWrap(void); void blit_move_info_icon(u8 winId, u8 a2, u16 x, u16 y); void reset_temp_tile_data_buffers(void); -void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, int size, u16 offset, u8 mode); +void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, u32 size, u16 offset, u8 mode); bool8 free_temp_tile_data_buffers_if_possible(void); struct WindowTemplate CreateWindowTemplate(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock); void CreateYesNoMenu(const struct WindowTemplate *windowTemplate, u16 borderFirstTileNum, u8 borderPalette, u8 initialCursorPos); -void DecompressAndLoadBgGfxUsingHeap(u8 bgId, const void *src, int size, u16 offset, u8 mode); +void DecompressAndLoadBgGfxUsingHeap(u8 bgId, const void *src, u32 size, u16 offset, u8 mode); s8 Menu_ProcessInputNoWrapClearOnChoose(void); s8 ProcessMenuInput_other(void); void do_scheduled_bg_tilemap_copies_to_vram(void); @@ -62,7 +62,7 @@ void sub_8197B1C(u8 windowId, bool8 copyToVram, u16 a2, u8 a3); void sub_81995E4(u8 windowId, u8 optionsNo, const struct MenuAction *actions, const u8 *actionIds); void sub_8197DF8(u8 windowId, bool8 copyToVram); u16 sub_8198AA4(u8, u8, u8, u8, u8, u8, u16); -void *malloc_and_decompress(const void *src, int *sizeOut); +void *malloc_and_decompress(const void *src, u32 *sizeOut); u16 copy_decompressed_tile_data_to_vram(u8 bgId, const void *src, u16 size, u16 offset, u8 mode); void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress); void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, const u8 *a8); diff --git a/include/pokemon.h b/include/pokemon.h index 5d7f7f2ae..8807168ef 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -8,9 +8,9 @@ #define MON_DATA_OT_ID 1 #define MON_DATA_NICKNAME 2 #define MON_DATA_LANGUAGE 3 -#define MON_DATA_SANITY_BIT1 4 -#define MON_DATA_SANITY_BIT2 5 -#define MON_DATA_SANITY_BIT3 6 +#define MON_DATA_SANITY_IS_BAD_EGG 4 +#define MON_DATA_SANITY_HAS_SPECIES 5 +#define MON_DATA_SANITY_IS_EGG 6 #define MON_DATA_OT_NAME 7 #define MON_DATA_MARKINGS 8 #define MON_DATA_CHECKSUM 9 diff --git a/include/pokemon_icon.h b/include/pokemon_icon.h index f1c8a3e61..5a18109f2 100644 --- a/include/pokemon_icon.h +++ b/include/pokemon_icon.h @@ -1,9 +1,12 @@ #ifndef GUARD_POKEMON_ICON_H #define GUARD_POKEMON_ICON_H +extern const u8 gMonIconPaletteIndices[]; + const u8 *GetMonIconTiles(u16 species, bool32); const u8 *GetMonIconPtr(u16 speciesId, u32 personality, u32 frameNo); const u16 *GetValidMonIconPalettePtr(u16 speciesId); +u16 GetIconSpecies(u16 species, u32 personality); u16 GetUnownLetterByPersonality(u32 personality); u16 sub_80D2E84(u16 speciesId); void LoadMonIconPalettes(void); diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index d36f4b358..e9b3302c0 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -2,7 +2,9 @@ #define GUARD_POKEMON_STORAGE_SYSTEM_H #define TOTAL_BOXES_COUNT 14 -#define IN_BOX_COUNT 30 +#define IN_BOX_ROWS 6 +#define IN_BOX_COLUMS 5 +#define IN_BOX_COUNT (IN_BOX_ROWS * IN_BOX_COLUMS) #include "pc_screen_effect.h" #include "mon_markings.h" @@ -69,7 +71,6 @@ struct PokemonStorageSystemData u8 screenChangeType; bool8 isReshowingPSS; u8 taskId; - u8 unk_0005; struct UnkStruct_2000020 unk_0020; struct UnkStruct_2000028 unk_0028[8]; u16 field_90[16]; @@ -84,26 +85,86 @@ struct PokemonStorageSystemData bool8 unk_02C9; s16 newCurrBoxId; u16 bg2_X; - u8 field_2CE; - u8 field_2CF[1213]; + s16 field_2CE; + u16 field_2D0; + u8 field_2D2; + u8 field_2D3; + u8 field_2D4; + u8 field_2D5; + u16 field_2D6; + s16 field_2D8; + u16 field_2DA; + u16 field_2DC; + u16 field_2DE; + u16 field_2E0; + u8 field_2E2; + u8 field_2E3; + u8 field_2E4[20]; + u8 field_2F8[1024]; + u8 field_6F8; + u8 field_6F9; + u8 field_6FA; + s8 field_6FB; + u16 field_6FC[16]; + u16 field_71C; + u16 field_71E; + struct Sprite *field_720[2]; + struct Sprite *field_728[2]; + struct Sprite *field_730[2]; + u32 field_738; + u8 field_73C[80]; u16 field_78C; s16 wallpaperSetId; s16 wallpaperId; - u8 wallpaperTilemap[180 * 4]; + u16 field_792[360]; u8 wallpaperChangeState; u8 field_A63; u8 field_A64; - u8 field_A65; + s8 field_A65; u8 field_A66; u8 field_A67; - u8 *wallpaperTilemapPtr; + u8 *wallpaperTiles; struct Sprite *field_A6C; struct Sprite *partySprites[PARTY_SIZE]; struct Sprite *boxMonsSprites[IN_BOX_COUNT]; - u8 field_B00[8]; + struct Sprite **field_B00; + struct Sprite **field_B04; u16 field_B08[40]; u16 field_B58[40]; - u8 field_BA8[308]; + u16 boxSpecies[IN_BOX_COUNT]; + u32 boxPersonalities[IN_BOX_COUNT]; + u8 field_C5C; + u8 field_C5D; + u8 field_C5E; + u8 field_C5F; + u16 field_C60; + s16 field_C62; + s16 field_C64; + u16 field_C66; + u8 field_C68; + s8 field_C69; + u8 field_C6A; + u8 field_C6B; + u8 field_C6C[72]; + struct Sprite *field_CB4; + struct Sprite *field_CB8; + s32 field_CBC; + s32 field_CC0; + u32 field_CC4; + u32 field_CC8; + s16 field_CCC; + s16 field_CCE; + u16 field_CD0; + s8 field_CD2; + s8 field_CD3; + u8 field_CD4; + u8 field_CD5; + u8 field_CD6; + u8 field_CD7; + u8 field_CD8; + u8 field_CD9; + u8 field_CDA; + u8 field_CDB; u32 *field_CDC; u32 cursorMonPersonality; u16 cursorMonSpecies; @@ -117,13 +178,26 @@ struct PokemonStorageSystemData u8 cursorMonNick[36]; u8 cursorMonSpeciesName[36]; u8 cursorMonGenderLvlText[36]; - u8 cursorMonItemName[47]; + u8 cursorMonItemName[36]; + bool8 (*monPlaceChangeFunc)(void); + u8 monPlaceChangeState; + u8 field_D91; struct Sprite *field_D94; struct Sprite *field_D98[2]; u16 *field_DA0; struct PokemonMarkMenu field_DA4; struct UnkPSSStruct_2002370 field_1E5C; - u8 field_20A4[220]; + struct Pokemon field_20A4; + struct Pokemon field_2108; + s8 field_216C; + u8 field_216D; + s8 field_216E; + s8 field_216F; + s8 field_2170; + s8 field_2171; + u16 field_2172; + u16 field_2174; + u16 field_2176[5]; u8 field_2180; u8 field_2181; u8 field_2182; @@ -134,10 +208,18 @@ struct PokemonStorageSystemData u8 field_2187; u8 field_2188; struct BoxPokemon *field_218C; - u8 field_2190[80]; + u8 field_2190[40]; + u8 field_21B8[40]; u8 field_21E0[POKEMON_NAME_LENGTH + 1]; u8 field_21EB[15]; // TODO: ITEM NAME LENGTH + 1 - u8 field_21FA[58]; + u8 field_21FA; + u8 field_21FB; + u8 field_21FC; + u8 field_21FD; + u8 field_21FE; + u8 field_21FF; + u8 field_2200; + u8 field_2201[51]; u16 movingItem; u8 field_2236; u8 field_2237; @@ -149,7 +231,8 @@ struct PokemonStorageSystemData u16 field_2244[16]; u8 field_2264[96]; u8 field_22C4[0x800]; - u8 field_2AC4[12288]; + u8 field_2AC4[8192]; + u8 field_4AC4[0x1000]; u8 field_5AC4[0x800]; }; @@ -160,7 +243,7 @@ u8* GetBoxNamePtr(u8 boxNumber); struct BoxPokemon *GetBoxedMonPtr(u8, u8); void SetBoxMonNickFromAnyBox(u8, u8, u8 *); void CompactPartySlots(void); -u32 GetBoxMonDataFromAnyBox(u8 boxId, u8 monPosition, u32 request); +u32 GetBoxMonDataAt(u8 boxId, u8 monPosition, u32 request); bool8 CheckFreePokemonStorageSpace(void); u8 StorageGetCurrentBox(void); u8 sub_80D214C(struct BoxPokemon *a, u8 b, u8 c, u8 d); diff --git a/include/text.h b/include/text.h index 69cbb87ed..d9c7a9a2e 100644 --- a/include/text.h +++ b/include/text.h @@ -258,7 +258,7 @@ void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *c u16 RenderText(struct TextPrinter *textPrinter); u32 GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing); u32 (*GetFontWidthFunc(u8 glyphId))(u16, bool32); -u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing); +s32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing); u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str); u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y); u8 GetKeypadIconTileOffset(u8 keypadIconId); diff --git a/src/battle_pike.c b/src/battle_pike.c index d86677e48..4b2a1574d 100644 --- a/src/battle_pike.c +++ b/src/battle_pike.c @@ -1613,7 +1613,7 @@ static void sub_81A8830(void) static bool8 CanEncounterWildMon(u8 enemyMonLevel) { - if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3)) + if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)) { u8 monAbility = GetMonAbility(&gPlayerParty[0]); if (monAbility == ABILITY_KEEN_EYE || monAbility == ABILITY_INTIMIDATE) diff --git a/src/daycare.c b/src/daycare.c index 131540f6e..ef93fd2d8 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -901,7 +901,7 @@ static bool8 _DoEggActions_CheckHatch(struct DayCare *daycare) for (i = 0; i < DAYCARE_MON_COUNT; i++) { - if (GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SANITY_BIT2)) + if (GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SANITY_HAS_SPECIES)) daycare->mons[i].steps++, validEggs++; } @@ -922,7 +922,7 @@ static bool8 _DoEggActions_CheckHatch(struct DayCare *daycare) { if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)) continue; - if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_BIT1)) + if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_IS_BAD_EGG)) continue; steps = GetMonData(&gPlayerParty[i], MON_DATA_FRIENDSHIP); diff --git a/src/egg_hatch.c b/src/egg_hatch.c index 77296c707..9c1d6fdd8 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -876,7 +876,7 @@ u8 GetEggStepsToSubtract(void) u8 count, i; for (count = CalculatePlayerPartyCount(), i = 0; i < count; i++) { - if (!GetMonData(&gPlayerParty[i], MON_DATA_SANITY_BIT3)) + if (!GetMonData(&gPlayerParty[i], MON_DATA_SANITY_IS_EGG)) { u8 ability = GetMonAbility(&gPlayerParty[i]); if (ability == ABILITY_MAGMA_ARMOR || ability == ABILITY_FLAME_BODY) diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index a5aa23e32..7a6e16dd3 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -1845,7 +1845,7 @@ static bool8 Fishing6(struct Task *task) } else { - if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3)) + if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)) { u8 ability = GetMonAbility(&gPlayerParty[0]); if (ability == ABILITY_SUCTION_CUPS || ability == ABILITY_STICKY_HOLD) diff --git a/src/field_poison.c b/src/field_poison.c index 02f37f69f..de05bc407 100644 --- a/src/field_poison.c +++ b/src/field_poison.c @@ -122,7 +122,7 @@ s32 DoPoisonFieldEffect(void) u32 numFainted = 0; for (i = 0; i < PARTY_SIZE; i++) { - if (GetMonData(pokemon, MON_DATA_SANITY_BIT2) && pokemon_ailments_get_primary(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN) + if (GetMonData(pokemon, MON_DATA_SANITY_HAS_SPECIES) && pokemon_ailments_get_primary(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN) { hp = GetMonData(pokemon, MON_DATA_HP); if (hp == 0 || --hp == 0) diff --git a/src/field_specials.c b/src/field_specials.c index b47df09fc..34be71f30 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -1266,7 +1266,7 @@ void IsGrassTypeInParty(void) for (i = 0; i < PARTY_SIZE; i++) { pokemon = &gPlayerParty[i]; - if (GetMonData(pokemon, MON_DATA_SANITY_BIT2) && !GetMonData(pokemon, MON_DATA_IS_EGG)) + if (GetMonData(pokemon, MON_DATA_SANITY_HAS_SPECIES) && !GetMonData(pokemon, MON_DATA_IS_EGG)) { species = GetMonData(pokemon, MON_DATA_SPECIES); if (gBaseStats[species].type1 == TYPE_GRASS || gBaseStats[species].type2 == TYPE_GRASS) @@ -1658,7 +1658,7 @@ bool8 sub_813990C(void) for (i = 0; i < partyCount; i++) { - if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_BIT1) == 1) + if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_IS_BAD_EGG) == 1) return TRUE; } diff --git a/src/menu.c b/src/menu.c index 61096138a..84a0a23f3 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1797,9 +1797,9 @@ bool8 free_temp_tile_data_buffers_if_possible(void) } } -void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, int size, u16 offset, u8 mode) +void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, u32 size, u16 offset, u8 mode) { - int sizeOut; + u32 sizeOut; if (gUnknown_0203CDA8 < ARRAY_COUNT(gUnknown_0203CDAC)) { void *ptr = malloc_and_decompress(src, &sizeOut); @@ -1815,9 +1815,9 @@ void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, int size, return NULL; } -void DecompressAndLoadBgGfxUsingHeap(u8 bgId, const void *src, int size, u16 offset, u8 mode) +void DecompressAndLoadBgGfxUsingHeap(u8 bgId, const void *src, u32 size, u16 offset, u8 mode) { - int sizeOut; + u32 sizeOut; void *ptr = malloc_and_decompress(src, &sizeOut); if (!size) size = sizeOut; @@ -1838,7 +1838,7 @@ void task_free_buf_after_copying_tile_data_to_vram(u8 taskId) } } -void *malloc_and_decompress(const void *src, int *size) +void *malloc_and_decompress(const void *src, u32 *size) { void *ptr; u8 *sizeAsBytes = (u8 *)size; diff --git a/src/overworld.c b/src/overworld.c index 12e02a9b5..b2c7ad963 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -1342,7 +1342,7 @@ void UpdateAmbientCry(s16 *state, u16 *delayCounter) monsCount = CalculatePlayerPartyCount(); for (i = 0; i < monsCount; i++) { - if (!GetMonData(&gPlayerParty[i], MON_DATA_SANITY_BIT3) + if (!GetMonData(&gPlayerParty[i], MON_DATA_SANITY_IS_EGG) && GetMonAbility(&gPlayerParty[0]) == ABILITY_SWARM) { divBy = 2; diff --git a/src/pokemon.c b/src/pokemon.c index eec995050..aea52ecbb 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -4097,13 +4097,13 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data) case MON_DATA_LANGUAGE: retVal = boxMon->language; break; - case MON_DATA_SANITY_BIT1: + case MON_DATA_SANITY_IS_BAD_EGG: retVal = boxMon->isBadEgg; break; - case MON_DATA_SANITY_BIT2: + case MON_DATA_SANITY_HAS_SPECIES: retVal = boxMon->hasSpecies; break; - case MON_DATA_SANITY_BIT3: + case MON_DATA_SANITY_IS_EGG: retVal = boxMon->isEgg; break; case MON_DATA_OT_NAME: @@ -4304,7 +4304,7 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data) u16 *moves = (u16 *)data; s32 i = 0; - while (moves[i] != 355) + while (moves[i] != MOVES_COUNT) { u16 move = moves[i]; if (substruct1->moves[0] == move @@ -4466,13 +4466,13 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg) case MON_DATA_LANGUAGE: SET8(boxMon->language); break; - case MON_DATA_SANITY_BIT1: + case MON_DATA_SANITY_IS_BAD_EGG: SET8(boxMon->isBadEgg); break; - case MON_DATA_SANITY_BIT2: + case MON_DATA_SANITY_HAS_SPECIES: SET8(boxMon->hasSpecies); break; - case MON_DATA_SANITY_BIT3: + case MON_DATA_SANITY_IS_EGG: SET8(boxMon->isEgg); break; case MON_DATA_OT_NAME: @@ -4897,7 +4897,7 @@ bool8 IsPokemonStorageFull(void) for (i = 0; i < 14; i++) for (j = 0; j < 30; j++) - if (GetBoxMonDataFromAnyBox(i, j, MON_DATA_SPECIES) == SPECIES_NONE) + if (GetBoxMonDataAt(i, j, MON_DATA_SPECIES) == SPECIES_NONE) return FALSE; return TRUE; @@ -6859,7 +6859,7 @@ void SetWildMonHeldItem(void) u16 species = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, 0); u16 var1 = 45; u16 var2 = 95; - if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3, 0) + if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG, 0) && GetMonAbility(&gPlayerParty[0]) == ABILITY_COMPOUND_EYES) { var1 = 20; diff --git a/src/pokemon_icon.c b/src/pokemon_icon.c index c24c8a898..6b7d8656f 100644 --- a/src/pokemon_icon.c +++ b/src/pokemon_icon.c @@ -1076,7 +1076,7 @@ u8 sub_80D2D78(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 return spriteId; } -u16 mon_icon_convert_unown_species_id(u16 species, u32 personality) +u16 GetIconSpecies(u16 species, u32 personality) { u16 result; @@ -1104,7 +1104,8 @@ u16 GetUnownLetterByPersonality(u32 personality) { if (!personality) return 0; - return (((personality & 0x3000000) >> 18) | ((personality & 0x30000) >> 12) | ((personality & 0x300) >> 6) | (personality & 0x3)) % 0x1C; + else + return (((personality & 0x3000000) >> 18) | ((personality & 0x30000) >> 12) | ((personality & 0x300) >> 6) | (personality & 0x3)) % 0x1C; } u16 sub_80D2E84(u16 species) @@ -1121,19 +1122,17 @@ u16 sub_80D2E84(u16 species) } else { - if(species > (SPECIES_UNOWN_B - 1)) + if (species > (SPECIES_UNOWN_B - 1)) species = 260; - return mon_icon_convert_unown_species_id(species, 0); + return GetIconSpecies(species, 0); } } const u8 *GetMonIconPtr(u16 species, u32 personality, bool32 extra) { - return GetMonIconTiles(mon_icon_convert_unown_species_id(species, personality), extra); + return GetMonIconTiles(GetIconSpecies(species, personality), extra); } - - void sub_80D2EF8(struct Sprite *sprite) { sub_80D328C(sprite); diff --git a/src/pokemon_size_record.c b/src/pokemon_size_record.c index 2d9a2f08f..b0e14d2b1 100644 --- a/src/pokemon_size_record.c +++ b/src/pokemon_size_record.c @@ -210,7 +210,7 @@ void GiveGiftRibbonToParty(u8 index, u8 ribbonId) { struct Pokemon *mon = &gPlayerParty[i]; - if (GetMonData(mon, MON_DATA_SPECIES) != 0 && GetMonData(mon, MON_DATA_SANITY_BIT3) == 0) + if (GetMonData(mon, MON_DATA_SPECIES) != 0 && GetMonData(mon, MON_DATA_SANITY_IS_EGG) == 0) { SetMonData(mon, array[index], &data); gotRibbon = TRUE; diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index a37d38813..86041690c 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -29,8 +29,11 @@ #include "strings.h" #include "text.h" #include "text_window.h" +#include "trig.h" #include "walda_phrase.h" #include "window.h" +#include "constants/maps.h" +#include "constants/moves.h" #include "constants/rgb.h" #include "constants/songs.h" #include "constants/species.h" @@ -106,25 +109,71 @@ enum SCREEN_CHANGE_ITEM_FROM_BAG, }; +enum +{ + MODE_PARTY, + MODE_BOX, + MODE_2, +}; + +enum +{ + WALLPAPER_FOREST, + WALLPAPER_CITY, + WALLPAPER_DESERT, + WALLPAPER_SAVANNA, + WALLPAPER_CRAG, + WALLPAPER_VOLCANO, + WALLPAPER_SNOW, + WALLPAPER_CAVE, + WALLPAPER_BEACH, + WALLPAPER_SEAFLOOR, + WALLPAPER_RIVER, + WALLPAPER_SKY, + WALLPAPER_POLKADOT, + WALLPAPER_POKECENTER, + WALLPAPER_MACHINE, + WALLPAPER_PLAIN, + WALLPAPER_FRIENDS, // The one received as a gift from Walda's parents. +}; + +enum +{ + CURSOR_AREA_IN_BOX, + CURSOR_AREA_IN_PARTY, + CURSOR_AREA_BOX, + CURSOR_AREA_BUTTONS, // Party Pokemon and Close Box +}; + #define TAG_PAL_WAVEFORM 0xDACA #define TAG_PAL_DAC8 0xDAC8 #define TAG_PAL_DAC6 0xDAC6 #define TAG_PAL_DACE 0xDACE #define TAG_PAL_DAC7 0xDAC7 +#define TAG_PAL_DAC9 0xDAC9 #define TAG_TILE_WAVEFORM 0x5 #define TAG_TILE_10 0x10 #define TAG_TILE_2 0x2 #define TAG_TILE_D 0xD #define TAG_TILE_A 0xA +#define TAG_TILE_3 0x3 +#define TAG_TILE_4 0x4 IWRAM_DATA u8 gUnknown_03000F78[0x188]; extern u8 sPreviousBoxOption; extern u8 sCurrentBoxOption; +extern u8 sMovingMonOrigBoxPos; +extern u8 sMovingMonOrigBoxId; +extern s8 sBoxCursorPosition; +extern s8 sBoxCursorArea; extern u8 gUnknown_02039D10; +extern u8 gUnknown_02039D7E; extern u8 gUnknown_02039D0E; extern bool8 sInPartyMenu; +extern bool8 sCanOnlyMove; +extern bool8 sIsMonBeingMoved; extern u8 gUnknown_02039D0F; extern u16 gUnknown_02039D12; extern struct Pokemon gUnknown_02039D14; @@ -146,11 +195,16 @@ void Cb2_EnterPSS(u8 boxOption); u8 GetCurrentBoxOption(void); u8 sub_80CF9EC(void); u8 sub_80CDC2C(void); +u8 sub_80CB9BC(void); +void LoadWallpaperGfx(u8 boxId, s8 direction); +void sub_80CCCFC(u8 boxId, s8 direction); +void sub_80CD0B8(s8 direction); void SetBoxWallpaper(u8 boxId, u8 wallpaperId); void SetCurrentBox(u8 boxId); void sub_80CC32C(u8 boxId); -void ClearMonInBox(u8 boxId, u8 boxPos); +void ZeroBoxMonAt(u8 boxId, u8 boxPos); void sub_80C7958(u8 curBox); +void sub_80CCAE0(void *arg0); void ResetWaldaWallpaper(void); void sub_80C7B14(void); void sub_80C7BB4(void); @@ -163,7 +217,7 @@ void sub_80CE790(void); void sub_80CE8E4(void); void GiveChosenBagItem(void); void SetUpHidePartyMenu(void); -void sub_80CBB9C(void); +void DestroyAllPartyMonIcons(void); void sub_80D11CC(void); void LoadPSSMenuGfx(void); void LoadWaveformSpritePalette(void); @@ -171,6 +225,7 @@ void sub_80CDC18(void); void sub_80CD36C(void); void sub_80CD3EC(void); void sub_80CAC1C(void); +void sub_80CEBDC(void); void SetScrollingBackground(void); void sub_80CABE0(void); void sub_80CAEAC(void); @@ -199,7 +254,12 @@ void sub_80D1194(void); void PrintCursorMonInfo(void); void sub_80CA65C(void); void sub_80CADD8(void); +void sub_80CD02C(void); void sub_80CFEF0(void); +void sub_80CD158(void); +void sub_80CFC14(void); +void sub_80CEB40(void); +void sub_80CCEE0(void); void sub_80D1818(void); void sub_80CAA74(void); void sub_80D17B4(void); @@ -209,38 +269,48 @@ void sub_80CE7E8(void); void sub_80CFECC(void); void sub_80CA9EC(void); void FreePSSData(void); +void sub_80CCF9C(void); +void MoveMon(void); +void PlaceMon(void); void sub_80CAB20(void); void sub_80CE22C(void); +void sub_80CDA68(void); void sub_80CB950(void); void sub_80CA9C0(void); void SetUpDoShowPartyMenu(void); void BoxSetMosaic(void); void sub_80C7CF4(struct Sprite *sprite); +void sub_80CC100(struct Sprite *sprite); +void sub_80CB278(struct Sprite *sprite); +void sub_80CD210(struct Sprite *sprite); +bool32 WaitForWallpaperGfxLoad(void); bool8 InitPSSWindows(void); bool8 sub_80CC0A0(void); bool8 sub_80CE2A8(void); bool8 sub_80D0164(void); bool8 sub_80CC35C(void); bool8 sub_80D01E4(void); +bool8 sub_80CDED4(void); +bool8 sub_80CDF08(void); bool8 sub_80D184C(void); bool8 sub_80D18E4(void); bool8 DoShowPartyMenu(void); bool8 sub_80D1218(void); -bool8 sub_80CB9BC(void); bool8 ScrollToBox(void); bool8 sub_80CD554(void); bool8 HidePartyMenu(void); bool8 sub_80D127C(void); bool8 sub_80CA2B8(void); bool8 DoWallpaperGfxChange(void); -bool8 sub_80CDCAC(void); +bool8 DoMonPlaceChange(void); bool8 sub_80D00A8(void); bool8 CanMoveMon(void); bool8 CanShifMon(void); bool8 IsCursorOnCloseBox(void); bool8 IsCursorOnBox(void); +bool8 IsCursorInBox(void); bool8 IsMonBeingMoved(void); -bool8 sub_80CE19C(u8 arg0); +bool8 TryStorePartyMonInBox(u8 boxId); void Cb_InitPSS(u8 taskId); void Cb_PlaceMon(u8 taskId); void Cb_ChangeScreen(u8 taskId); @@ -275,18 +345,18 @@ void Cb_PrintCantStoreMail(u8 taskId); void Cb_HandleMovingMonFromParty(u8 taskId); void sub_80D2A90(struct UnkStruct_2000020 *arg0, struct UnkStruct_2000028 *arg1, u32 arg2); void sub_80D259C(u8 arg0); -void sub_80CC464(u8 arg0); +void SetUpScrollToBox(u8 boxId); void sub_80CFE54(u8 arg0); void sub_80D2918(u8 arg0); -void sub_80CC0D4(u8 arg0); -void sub_80CDC38(u8 arg0); +void sub_80CC0D4(u8 priority); +void InitMonPlaceChange(u8 arg0); void sub_80CE9A8(u8 markings); void ShowYesNoWindow(s8 cursorPos); void sub_80CDBF8(u8 arg0); void sub_80D01D0(u8 arg0); void sub_80CD1A8(bool8 arg0); void sub_80CA984(bool8 arg0); -void sub_80CB7E8(bool8 arg0); +void CreatePartyMonsSprites(bool8 arg0); void sub_80D2644(u8 arg0, u16 arg1, const void *arg2, u16 arg3, u16 arg4); void sub_80D2770(u8 arg0, u16 arg1, u16 arg2); void PrintStorageActionText(u8 id); @@ -302,17 +372,52 @@ void SetWallpaperForCurrentBox(u8 wallpaperId); void sub_80CAE0C(u8 wallpaperSet); u16 GetMovingItem(void); void SetCurrentBoxMonData(s32 monId, s32 request, const void *value); +s32 GetCurrentBoxMonData(u8 boxPosition, s32 request); void LoadCursorMonGfx(u16 species, u32 pid); void sub_80CA2D0(struct Sprite *sprite); +void sub_80CCF64(struct Sprite *sprite); +void sub_80CBA3C(struct Sprite *sprite); +void sub_80CCF30(struct Sprite *sprite); void sub_80D27AC(u8 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4); void sub_80D27F4(u8 arg0, u8 arg1, s8 arg2); -void sub_80CBAF0(s16 arg0); +void sub_80CBAF0(s16 yDelta); void sub_80CAAA8(u8 arg0, bool8 isPartyMon); const u8 *GetMovingItemName(void); bool32 IsWaldaWallpaperUnlocked(void); void sub_80CFF34(u8 arg0); -void sub_80D0D8C(bool8 arg0, u8 cursorPos); +void sub_80D0D8C(u8 arg0, u8 cursorPos); +void sub_80D0E50(u8 arg0, u8 cursorPos); void sub_80D0F38(u16 item); +static struct Sprite *CreateMonIconSprite(u16 species, u32 personality, s16 x, s16 y, u8 oamPriority, u8 subpriority); +void DestroyBoxMonIcon(struct Sprite *sprite); +void SetBoxSpeciesAndPersonalities(u8 boxId); +void sub_80CB9D0(struct Sprite *sprite, u16 partyId); +void sub_80CC370(u8 taskId); +void sub_80CCB50(u8 boxId); +s8 sub_80CC644(u8 boxId); +u8 GetBoxWallpaper(u8 boxId); +u32 GetWaldaWallpaperPatternId(void); +u32 GetWaldaWallpaperIconId(void); +void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2); +u16 *GetWaldaWallpaperColorsPtr(void); +void sub_80C6D80(u8 *arg0, void *arg1, u8 arg2, u8 arg3, s32 arg4); +s16 sub_80CD00C(const u8 *string); +bool8 MonPlaceChange_Shift(void); +bool8 MonPlaceChange_Move(void); +bool8 MonPlaceChange_Place(void); +bool8 sub_80CDEC4(void); +bool8 sub_80CDEB4(void); +void sub_80CD444(u8 a0, u8 a1, u16 *a2, u16 *a3); +void SetShiftedMonData(u8 boxId, u8 position); +void SetMovedMonData(u8 boxId, u8 position); +void SetPlacedMonData(u8 boxId, u8 position); +void PurgeMonOrBoxMon(u8 boxId, u8 position); +void BoxMonAtToMon(u8 boxId, u8 position, struct Pokemon *dst); +void SetBoxMonAt(u8 boxId, u8 position, struct BoxPokemon *src); +void sub_80CEC00(struct Pokemon *mon, u8 arg1); +bool32 AtLeastThreeUsableMons(void); +bool32 CheckBoxedMonSanity(s32 boxId, s32 boxPosition); +s32 GetAndCopyBoxMonDataAt(u8 boxId, u8 boxPosition, s32 request, void *dst); // const rom data const struct PSS_MenuStringPtrs gUnknown_085716C0[] = @@ -844,22 +949,320 @@ const u16 gUnknown_08577574[][2] = const struct WallpaperTable gWallpaperTable[] = { - WALLPAPER_ENTRY(Forest), - WALLPAPER_ENTRY(City), - WALLPAPER_ENTRY(Desert), - WALLPAPER_ENTRY(Savanna), - WALLPAPER_ENTRY(Crag), - WALLPAPER_ENTRY(Volcano), - WALLPAPER_ENTRY(Snow), - WALLPAPER_ENTRY(Cave), - WALLPAPER_ENTRY(Beach), - WALLPAPER_ENTRY(Seafloor), - WALLPAPER_ENTRY(River), - WALLPAPER_ENTRY(Sky), - WALLPAPER_ENTRY(PolkaDot), - WALLPAPER_ENTRY(Pokecenter), - WALLPAPER_ENTRY(Machine), - WALLPAPER_ENTRY(Plain), + [WALLPAPER_FOREST] = WALLPAPER_ENTRY(Forest), + [WALLPAPER_CITY] = WALLPAPER_ENTRY(City), + [WALLPAPER_DESERT] = WALLPAPER_ENTRY(Desert), + [WALLPAPER_SAVANNA] = WALLPAPER_ENTRY(Savanna), + [WALLPAPER_CRAG] = WALLPAPER_ENTRY(Crag), + [WALLPAPER_VOLCANO] = WALLPAPER_ENTRY(Volcano), + [WALLPAPER_SNOW] = WALLPAPER_ENTRY(Snow), + [WALLPAPER_CAVE] = WALLPAPER_ENTRY(Cave), + [WALLPAPER_BEACH] = WALLPAPER_ENTRY(Beach), + [WALLPAPER_SEAFLOOR] = WALLPAPER_ENTRY(Seafloor), + [WALLPAPER_RIVER] = WALLPAPER_ENTRY(River), + [WALLPAPER_SKY] = WALLPAPER_ENTRY(Sky), + [WALLPAPER_POLKADOT] = WALLPAPER_ENTRY(PolkaDot), + [WALLPAPER_POKECENTER] = WALLPAPER_ENTRY(Pokecenter), + [WALLPAPER_MACHINE] = WALLPAPER_ENTRY(Machine), + [WALLPAPER_PLAIN] = WALLPAPER_ENTRY(Plain), +}; + +const u8 gPCGfx_Arrow[] = INCBIN_U8("graphics/pokemon_storage/arrow.4bpp"); + +const u16 gWallpaperPalettes_Zigzagoon[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), + INCBIN_U16("graphics/pokemon_storage/zigzagoon_bg.gbapal"), +}; +const u32 gWallpaperTiles_Zigzagoon[] = INCBIN_U32("graphics/pokemon_storage/zigzagoon.4bpp.lz"); +const u32 gWallpaperTilemap_Zigzagoon[] = INCBIN_U32("graphics/pokemon_storage/zigzagoon.bin.lz"); + +const u16 gWallpaperPalettes_Screen[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), + INCBIN_U16("graphics/pokemon_storage/screen_bg.gbapal"), +}; +const u32 gWallpaperTiles_Screen[] = INCBIN_U32("graphics/pokemon_storage/screen.4bpp.lz"); +const u32 gWallpaperTilemap_Screen[] = INCBIN_U32("graphics/pokemon_storage/screen.bin.lz"); + +const u16 gWallpaperPalettes_Diagonal[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), + INCBIN_U16("graphics/pokemon_storage/diagonal_bg.gbapal"), +}; +const u32 gWallpaperTiles_Diagonal[] = INCBIN_U32("graphics/pokemon_storage/diagonal.4bpp.lz"); +const u32 gWallpaperTilemap_Diagonal[] = INCBIN_U32("graphics/pokemon_storage/diagonal.bin.lz"); + +const u16 gWallpaperPalettes_Block[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/block_bg.gbapal"), + INCBIN_U16("graphics/pokemon_storage/block_bg.gbapal"), +}; +const u32 gWallpaperTiles_Block[] = INCBIN_U32("graphics/pokemon_storage/block.4bpp.lz"); +const u32 gWallpaperTilemap_Block[] = INCBIN_U32("graphics/pokemon_storage/block.bin.lz"); + +const u16 gWallpaperPalettes_Pokecenter2[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/pokecenter2_bg.gbapal"), + INCBIN_U16("graphics/pokemon_storage/pokecenter2_bg.gbapal"), +}; +const u32 gWallpaperTiles_Pokecenter2[] = INCBIN_U32("graphics/pokemon_storage/pokecenter2.4bpp.lz"); +const u32 gWallpaperTilemap_Pokecenter2[] = INCBIN_U32("graphics/pokemon_storage/pokecenter2.bin.lz"); + +const u16 gWallpaperPalettes_Frame[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/frame_bg.gbapal"), + INCBIN_U16("graphics/pokemon_storage/frame_bg.gbapal"), +}; +const u32 gWallpaperTiles_Frame[] = INCBIN_U32("graphics/pokemon_storage/frame.4bpp.lz"); +const u32 gWallpaperTilemap_Frame[] = INCBIN_U32("graphics/pokemon_storage/frame.bin.lz"); + +const u16 gWallpaperPalettes_Blank[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), + INCBIN_U16("graphics/pokemon_storage/zigzagoon_bg.gbapal"), +}; +const u32 gWallpaperTiles_Blank[] = INCBIN_U32("graphics/pokemon_storage/blank.4bpp.lz"); +const u32 gWallpaperTilemap_Blank[] = INCBIN_U32("graphics/pokemon_storage/blank.bin.lz"); + +const u16 gWallpaperPalettes_Circles[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/circles_bg.gbapal"), +}; +const u32 gWallpaperTiles_Circles[] = INCBIN_U32("graphics/pokemon_storage/circles.4bpp.lz"); +const u32 gWallpaperTilemap_Circles[] = INCBIN_U32("graphics/pokemon_storage/circles.bin.lz"); + +const u16 gWallpaperPalettes_Azumarill[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/azumarill_bg.gbapal"), +}; +const u32 gWallpaperTiles_Azumarill[] = INCBIN_U32("graphics/pokemon_storage/azumarill.4bpp.lz"); +const u32 gWallpaperTilemap_Azumarill[] = INCBIN_U32("graphics/pokemon_storage/azumarill.bin.lz"); + +const u16 gWallpaperPalettes_Pikachu[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/pikachu_bg.gbapal"), +}; +const u32 gWallpaperTiles_Pikachu[] = INCBIN_U32("graphics/pokemon_storage/pikachu.4bpp.lz"); +const u32 gWallpaperTilemap_Pikachu[] = INCBIN_U32("graphics/pokemon_storage/pikachu.bin.lz"); + +const u16 gWallpaperPalettes_Legendary[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/legendary_bg.gbapal"), +}; +const u32 gWallpaperTiles_Legendary[] = INCBIN_U32("graphics/pokemon_storage/legendary.4bpp.lz"); +const u32 gWallpaperTilemap_Legendary[] = INCBIN_U32("graphics/pokemon_storage/legendary.bin.lz"); + +const u16 gWallpaperPalettes_Dusclops[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/dusclops_bg.gbapal"), +}; +const u32 gWallpaperTiles_Dusclops[] = INCBIN_U32("graphics/pokemon_storage/dusclops.4bpp.lz"); +const u32 gWallpaperTilemap_Dusclops[] = INCBIN_U32("graphics/pokemon_storage/dusclops.bin.lz"); + +const u16 gWallpaperPalettes_Ludicolo[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/ludicolo_bg.gbapal"), +}; +const u32 gWallpaperTiles_Ludicolo[] = INCBIN_U32("graphics/pokemon_storage/ludicolo.4bpp.lz"); +const u32 gWallpaperTilemap_Ludicolo[] = INCBIN_U32("graphics/pokemon_storage/ludicolo.bin.lz"); + +const u16 gWallpaperPalettes_Whiscash[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/whiscash_bg.gbapal"), +}; +const u32 gWallpaperTiles_Whiscash[] = INCBIN_U32("graphics/pokemon_storage/whiscash.4bpp.lz"); +const u32 gWallpaperTilemap_Whiscash[] = INCBIN_U32("graphics/pokemon_storage/whiscash.bin.lz"); + +const u32 gWallpaperIcon_Aqua[] = INCBIN_U32("graphics/pokemon_storage/aqua_icon.4bpp.lz"); +const u32 gWallpaperIcon_Heart[] = INCBIN_U32("graphics/pokemon_storage/heart_icon.4bpp.lz"); +const u32 gWallpaperIcon_FiveStar[] = INCBIN_U32("graphics/pokemon_storage/five_star_icon.4bpp.lz"); +const u32 gWallpaperIcon_Brick[] = INCBIN_U32("graphics/pokemon_storage/brick_icon.4bpp.lz"); +const u32 gWallpaperIcon_FourStar[] = INCBIN_U32("graphics/pokemon_storage/four_star_icon.4bpp.lz"); +const u32 gWallpaperIcon_Asterisk[] = INCBIN_U32("graphics/pokemon_storage/asterisk_icon.4bpp.lz"); +const u32 gWallpaperIcon_Dot[] = INCBIN_U32("graphics/pokemon_storage/dot_icon.4bpp.lz"); +const u32 gWallpaperIcon_LineCircle[] = INCBIN_U32("graphics/pokemon_storage/line_circle_icon.4bpp.lz"); +const u32 gWallpaperIcon_PokeBall[] = INCBIN_U32("graphics/pokemon_storage/pokeball_icon.4bpp.lz"); +const u32 gWallpaperIcon_Maze[] = INCBIN_U32("graphics/pokemon_storage/maze_icon.4bpp.lz"); +const u32 gWallpaperIcon_Footprint[] = INCBIN_U32("graphics/pokemon_storage/footprint_icon.4bpp.lz"); +const u32 gWallpaperIcon_BigAsterisk[] = INCBIN_U32("graphics/pokemon_storage/big_asterisk_icon.4bpp.lz"); +const u32 gWallpaperIcon_Circle[] = INCBIN_U32("graphics/pokemon_storage/circle_icon.4bpp.lz"); +const u32 gWallpaperIcon_Koffing[] = INCBIN_U32("graphics/pokemon_storage/koffing_icon.4bpp.lz"); +const u32 gWallpaperIcon_Ribbon[] = INCBIN_U32("graphics/pokemon_storage/ribbon_icon.4bpp.lz"); +const u32 gWallpaperIcon_FourCircles[] = INCBIN_U32("graphics/pokemon_storage/four_circles_icon.4bpp.lz"); +const u32 gWallpaperIcon_Lotad[] = INCBIN_U32("graphics/pokemon_storage/lotad_icon.4bpp.lz"); +const u32 gWallpaperIcon_Crystal[] = INCBIN_U32("graphics/pokemon_storage/crystal_icon.4bpp.lz"); +const u32 gWallpaperIcon_Pichu[] = INCBIN_U32("graphics/pokemon_storage/pichu_icon.4bpp.lz"); +const u32 gWallpaperIcon_Diglett[] = INCBIN_U32("graphics/pokemon_storage/diglett_icon.4bpp.lz"); +const u32 gWallpaperIcon_Luvdisc[] = INCBIN_U32("graphics/pokemon_storage/luvdisc_icon.4bpp.lz"); +const u32 gWallpaperIcon_StarInCircle[] = INCBIN_U32("graphics/pokemon_storage/star_in_circle_icon.4bpp.lz"); +const u32 gWallpaperIcon_Spinda[] = INCBIN_U32("graphics/pokemon_storage/spinda_icon.4bpp.lz"); +const u32 gWallpaperIcon_Latis[] = INCBIN_U32("graphics/pokemon_storage/latis_icon.4bpp.lz"); +const u32 gWallpaperIcon_Minun[] = INCBIN_U32("graphics/pokemon_storage/minun_icon.4bpp.lz"); +const u32 gWallpaperIcon_Togepi[] = INCBIN_U32("graphics/pokemon_storage/togepi_icon.4bpp.lz"); +const u32 gWallpaperIcon_Magma[] = INCBIN_U32("graphics/pokemon_storage/magma_icon.4bpp.lz"); + +const struct WallpaperTable gFriendsWallpaperTable[] = +{ + WALLPAPER_ENTRY(Zigzagoon), + WALLPAPER_ENTRY(Screen), + WALLPAPER_ENTRY(Horizontal), + WALLPAPER_ENTRY(Diagonal), + WALLPAPER_ENTRY(Block), + WALLPAPER_ENTRY(Ribbon), + WALLPAPER_ENTRY(Pokecenter2), + WALLPAPER_ENTRY(Frame), + WALLPAPER_ENTRY(Blank), + WALLPAPER_ENTRY(Circles), + WALLPAPER_ENTRY(Azumarill), + WALLPAPER_ENTRY(Pikachu), + WALLPAPER_ENTRY(Legendary), + WALLPAPER_ENTRY(Dusclops), + WALLPAPER_ENTRY(Ludicolo), + WALLPAPER_ENTRY(Whiscash), +}; + +const u32 *const gFriendsIcons[] = +{ + gWallpaperIcon_Aqua, + gWallpaperIcon_Heart, + gWallpaperIcon_FiveStar, + gWallpaperIcon_Brick, + gWallpaperIcon_FourStar, + gWallpaperIcon_Asterisk, + gWallpaperIcon_Dot, + gWallpaperIcon_Cross, + gWallpaperIcon_LineCircle, + gWallpaperIcon_PokeBall, + gWallpaperIcon_Maze, + gWallpaperIcon_Footprint, + gWallpaperIcon_BigAsterisk, + gWallpaperIcon_Circle, + gWallpaperIcon_Koffing, + gWallpaperIcon_Ribbon, + gWallpaperIcon_Bolt, + gWallpaperIcon_FourCircles, + gWallpaperIcon_Lotad, + gWallpaperIcon_Crystal, + gWallpaperIcon_Pichu, + gWallpaperIcon_Diglett, + gWallpaperIcon_Luvdisc, + gWallpaperIcon_StarInCircle, + gWallpaperIcon_Spinda, + gWallpaperIcon_Latis, + gWallpaperIcon_Plusle, + gWallpaperIcon_Minun, + gWallpaperIcon_Togepi, + gWallpaperIcon_Magma, +}; + +// Unknown Unused data. +const u16 gUnknown_0857B07C = 0x23BA; + +const struct SpriteSheet gUnknown_0857B080 = {gPCGfx_Arrow, 0x80, 6}; + +const struct OamData gOamData_83BB298 = +{ + .shape = ST_OAM_H_RECTANGLE, + .size = 2, + .priority = 2 +}; + +const union AnimCmd gSpriteAnim_83BB2A0[] = +{ + ANIMCMD_FRAME(0, 5), + ANIMCMD_END +}; + +const union AnimCmd gSpriteAnim_83BB2A8[] = +{ + ANIMCMD_FRAME(8, 5), + ANIMCMD_END +}; + +const union AnimCmd *const gSpriteAnimTable_83BB2B0[] = +{ + gSpriteAnim_83BB2A0, + gSpriteAnim_83BB2A8 +}; + +const struct SpriteTemplate gSpriteTemplate_857B0A8 = +{ + TAG_TILE_3, + TAG_PAL_DAC9, + &gOamData_83BB298, + gSpriteAnimTable_83BB2B0, + NULL, + gDummySpriteAffineAnimTable, + SpriteCallbackDummy +}; + +const struct OamData gOamData_83BB2D0 = +{ + .shape = ST_OAM_V_RECTANGLE, + .priority = 2 +}; + +const union AnimCmd gSpriteAnim_83BB2D8[] = +{ + ANIMCMD_FRAME(0, 5), + ANIMCMD_END +}; + +const union AnimCmd gSpriteAnim_83BB2E0[] = +{ + ANIMCMD_FRAME(2, 5), + ANIMCMD_END +}; + +const union AnimCmd *const gSpriteAnimTable_83BB2E8[] = +{ + gSpriteAnim_83BB2D8, + gSpriteAnim_83BB2E0 +}; + +const struct SpriteTemplate gUnknown_0857B0E0 = +{ + 6, + 0xDACA, + &gOamData_83BB2D0, + gSpriteAnimTable_83BB2E8, + NULL, + gDummySpriteAffineAnimTable, + sub_80CD210 +}; + +const u16 gHandCursorPalette[] = INCBIN_U16("graphics/pokemon_storage/hand_cursor.gbapal"); +const u8 gHandCursorTiles[] = INCBIN_U8("graphics/pokemon_storage/hand_cursor.4bpp"); +const u8 gHandCursorShadowTiles[] = INCBIN_U8("graphics/pokemon_storage/hand_cursor_shadow.4bpp"); + +bool8 (*const gUnknown_0857B998[])(void) = +{ + MonPlaceChange_Move, + MonPlaceChange_Place, + MonPlaceChange_Shift, +}; + +struct +{ + s8 mapGroup; + s8 mapNum; + u16 move; +} const gUnknown_0857B9A4[] = +{ + {MAP_GROUPS_COUNT, 0, MOVE_SURF}, + {MAP_GROUPS_COUNT, 0, MOVE_DIVE}, + {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MOVE_STRENGTH}, + {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MOVE_ROCK_SMASH}, + {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MOVE_STRENGTH}, + {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MOVE_ROCK_SMASH}, }; // code @@ -869,7 +1272,7 @@ u8 CountMonsInBox(u8 boxId) for (i = 0, count = 0; i < IN_BOX_COUNT; i++) { - if (GetBoxMonDataFromAnyBox(boxId, i, MON_DATA_SPECIES) != SPECIES_NONE) + if (GetBoxMonDataAt(boxId, i, MON_DATA_SPECIES) != SPECIES_NONE) count++; } @@ -882,7 +1285,7 @@ s16 GetFirstFreeBoxSpot(u8 boxId) for (i = 0; i < IN_BOX_COUNT; i++) { - if (GetBoxMonDataFromAnyBox(boxId, i, MON_DATA_SPECIES) == SPECIES_NONE) + if (GetBoxMonDataAt(boxId, i, MON_DATA_SPECIES) == SPECIES_NONE) return i; } @@ -1184,14 +1587,13 @@ s16 StorageSystemGetNextMonIndex(struct BoxPokemon *box, s8 startIdx, u8 stopIdx void ResetPokemonStorageSystem(void) { - u16 boxId; - u16 boxMon; + u16 boxId, boxPosition; SetCurrentBox(0); for (boxId = 0; boxId < TOTAL_BOXES_COUNT; boxId++) { - for (boxMon = 0; boxMon < IN_BOX_COUNT; boxMon++) - ClearMonInBox(boxId, boxMon); + for (boxPosition = 0; boxPosition < IN_BOX_COUNT; boxPosition++) + ZeroBoxMonAt(boxId, boxPosition); } for (boxId = 0; boxId < TOTAL_BOXES_COUNT; boxId++) { @@ -1735,7 +2137,7 @@ void Cb_MainPSS(u8 taskId) gUnknown_02039D08->newCurrBoxId = 0; if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) { - sub_80CC464(gUnknown_02039D08->newCurrBoxId); + SetUpScrollToBox(gUnknown_02039D08->newCurrBoxId); gUnknown_02039D08->state = 2; } else @@ -1751,7 +2153,7 @@ void Cb_MainPSS(u8 taskId) gUnknown_02039D08->newCurrBoxId = TOTAL_BOXES_COUNT - 1; if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) { - sub_80CC464(gUnknown_02039D08->newCurrBoxId); + SetUpScrollToBox(gUnknown_02039D08->newCurrBoxId); gUnknown_02039D08->state = 2; } else @@ -1930,7 +2332,7 @@ void Cb_MainPSS(u8 taskId) case 10: if (!sub_80D1218()) { - sub_80CC464(gUnknown_02039D08->newCurrBoxId); + SetUpScrollToBox(gUnknown_02039D08->newCurrBoxId); gUnknown_02039D08->state = 2; } break; @@ -2145,11 +2547,11 @@ void Cb_MoveMon(u8 taskId) switch (gUnknown_02039D08->state) { case 0: - sub_80CDC38(0); + InitMonPlaceChange(0); gUnknown_02039D08->state++; break; case 1: - if (!sub_80CDCAC()) + if (!DoMonPlaceChange()) { if (sInPartyMenu) SetPSSCallback(Cb_HandleMovingMonFromParty); @@ -2165,11 +2567,11 @@ void Cb_PlaceMon(u8 taskId) switch (gUnknown_02039D08->state) { case 0: - sub_80CDC38(1); + InitMonPlaceChange(1); gUnknown_02039D08->state++; break; case 1: - if (!sub_80CDCAC()) + if (!DoMonPlaceChange()) { if (sInPartyMenu) SetPSSCallback(Cb_HandleMovingMonFromParty); @@ -2185,11 +2587,11 @@ void Cb_ShiftMon(u8 taskId) switch (gUnknown_02039D08->state) { case 0: - sub_80CDC38(2); + InitMonPlaceChange(2); gUnknown_02039D08->state++; break; case 1: - if (!sub_80CDCAC()) + if (!DoMonPlaceChange()) { BoxSetMosaic(); SetPSSCallback(Cb_MainPSS); @@ -2211,7 +2613,7 @@ void Cb_WithdrawMon(u8 taskId) else { sub_80CDC18(); - sub_80CDC38(0); + InitMonPlaceChange(0); gUnknown_02039D08->state = 2; } break; @@ -2223,7 +2625,7 @@ void Cb_WithdrawMon(u8 taskId) } break; case 2: - if (!sub_80CDCAC()) + if (!DoMonPlaceChange()) { sub_80CC0D4(1); SetUpDoShowPartyMenu(); @@ -2233,12 +2635,12 @@ void Cb_WithdrawMon(u8 taskId) case 3: if (!DoShowPartyMenu()) { - sub_80CDC38(1); + InitMonPlaceChange(1); gUnknown_02039D08->state++; } break; case 4: - if (!sub_80CDCAC()) + if (!DoMonPlaceChange()) { sub_80CAB20(); gUnknown_02039D08->state++; @@ -2252,7 +2654,7 @@ void Cb_WithdrawMon(u8 taskId) void Cb_DepositMenu(u8 taskId) { - u8 r4; + u8 boxId; switch (gUnknown_02039D08->state) { @@ -2263,9 +2665,9 @@ void Cb_DepositMenu(u8 taskId) gUnknown_02039D08->state++; break; case 1: - r4 = sub_80C78F0(); - if (r4 == 200); - else if (r4 == 201) + boxId = sub_80C78F0(); + if (boxId == 200); + else if (boxId == 201) { ClearBottomWindow(); sub_80C78E4(); @@ -2274,9 +2676,9 @@ void Cb_DepositMenu(u8 taskId) } else { - if (sub_80CE19C(r4)) + if (TryStorePartyMonInBox(boxId)) { - gUnknown_02039D0E = r4; + gUnknown_02039D0E = boxId; ClearBottomWindow(); sub_80C78E4(); sub_80C7890(); @@ -2325,17 +2727,17 @@ void Cb_ReleaseMon(u8 taskId) case 1: switch (Menu_ProcessInputNoWrapClearOnChoose()) { - case -1: - case 1: - ClearBottomWindow(); - SetPSSCallback(Cb_MainPSS); - break; - case 0: - ClearBottomWindow(); - sub_80CE3A0(); - sub_80CE250(); - gUnknown_02039D08->state++; - break; + case -1: + case 1: + ClearBottomWindow(); + SetPSSCallback(Cb_MainPSS); + break; + case 0: + ClearBottomWindow(); + sub_80CE3A0(); + sub_80CE250(); + gUnknown_02039D08->state++; + break; } break; case 2: @@ -2352,7 +2754,7 @@ void Cb_ReleaseMon(u8 taskId) } if (r0 == 0) { - gUnknown_02039D08->state = 8; + gUnknown_02039D08->state = 8; // Can't release the mon. break; } } @@ -2933,7 +3335,7 @@ void Cb_JumpBox(u8 taskId) } break; case 2: - sub_80CC464(gUnknown_02039D08->newCurrBoxId); + SetUpScrollToBox(gUnknown_02039D08->newCurrBoxId); gUnknown_02039D08->state++; break; case 3: @@ -3439,7 +3841,7 @@ void sub_80CA704(void) if (sInPartyMenu) { sub_80CA984(TRUE); - sub_80CB7E8(TRUE); + CreatePartyMonsSprites(TRUE); sub_80D2918(2); sub_80D2918(1); } @@ -3460,7 +3862,7 @@ void SetUpShowPartyMenu(void) gUnknown_02039D08->field_2C0 = 20; gUnknown_02039D08->field_2C2 = 2; gUnknown_02039D08->field_2C5 = 0; - sub_80CB7E8(FALSE); + CreatePartyMonsSprites(FALSE); } bool8 ShowPartyMenu(void) @@ -3512,7 +3914,7 @@ bool8 HidePartyMenu(void) else { sInPartyMenu = FALSE; - sub_80CBB9C(); + DestroyAllPartyMonIcons(); CompactPartySlots(); sub_80D27AC(2, 0, 0, 9, 2); sub_80D2918(2); @@ -3762,9 +4164,9 @@ void sub_80CAEAC(void) if (!IsCursorOnBox()) { if (sInPartyMenu) - sub_80D0D8C(TRUE, GetBoxCursorPosition()); + sub_80D0D8C(1, GetBoxCursorPosition()); else - sub_80D0D8C(FALSE, GetBoxCursorPosition()); + sub_80D0D8C(0, GetBoxCursorPosition()); } if (gUnknown_02039D12 != 0) @@ -3791,3 +4193,2062 @@ void sub_80CAF04(void) gUnknown_02039D08->field_A6C = NULL; gUnknown_02039D08->field_78C = 0; } + +u8 sub_80CAFAC(void) +{ + return (IsCursorInBox() ? 2 : 1); +} + +void sub_80CAFC4(void) +{ + u32 personality = GetMonData(&gUnknown_02039D08->field_20A4, MON_DATA_PERSONALITY); + u16 species = GetMonData(&gUnknown_02039D08->field_20A4, MON_DATA_SPECIES2); + u8 priority = sub_80CAFAC(); + + gUnknown_02039D08->field_A6C = CreateMonIconSprite(species, personality, 0, 0, priority, 7); + gUnknown_02039D08->field_A6C->callback = sub_80CC100; +} + +void sub_80CB028(u8 boxId) +{ + u8 boxPosition; + u16 i, j, count; + u16 species; + u32 personality; + + count = 0; + boxPosition = 0; + for (i = 0; i < IN_BOX_COLUMS; i++) + { + for (j = 0; j < IN_BOX_ROWS; j++) + { + species = GetBoxMonDataAt(boxId, boxPosition, MON_DATA_SPECIES2); + if (species != SPECIES_NONE) + { + personality = GetBoxMonDataAt(boxId, boxPosition, MON_DATA_PERSONALITY); + gUnknown_02039D08->boxMonsSprites[count] = CreateMonIconSprite(species, personality, 8 * (3 * j) + 100, 8 * (3 * i) + 44, 2, 19 - j); + } + else + { + gUnknown_02039D08->boxMonsSprites[count] = NULL; + } + boxPosition++; + count++; + } + } + + if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + { + for (boxPosition = 0; boxPosition < IN_BOX_COUNT; boxPosition++) + { + if (GetBoxMonDataAt(boxId, boxPosition, MON_DATA_HELD_ITEM) == 0) + gUnknown_02039D08->boxMonsSprites[boxPosition]->oam.objMode = 1; + } + } +} + +void sub_80CB140(u8 boxPosition) +{ + u16 species = GetCurrentBoxMonData(boxPosition, MON_DATA_SPECIES2); + + if (species != SPECIES_NONE) + { + s16 x = 8 * (3 * (boxPosition % IN_BOX_ROWS)) + 100; + s16 y = 8 * (3 * (boxPosition / IN_BOX_ROWS)) + 44; + u32 personality = GetCurrentBoxMonData(boxPosition, MON_DATA_PERSONALITY); + + gUnknown_02039D08->boxMonsSprites[boxPosition] = CreateMonIconSprite(species, personality, x, y, 2, 19 - (boxPosition % IN_BOX_ROWS)); + if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + gUnknown_02039D08->boxMonsSprites[boxPosition]->oam.objMode = 1; + } +} + +void sub_80CB1F0(s16 arg0) +{ + u16 i; + + for (i = 0; i < IN_BOX_COUNT; i++) + { + if (gUnknown_02039D08->boxMonsSprites[i] != NULL) + { + gUnknown_02039D08->boxMonsSprites[i]->data[2] = arg0; + gUnknown_02039D08->boxMonsSprites[i]->data[4] = 1; + gUnknown_02039D08->boxMonsSprites[i]->callback = sub_80CB278; + } + } +} + +void sub_80CB234(struct Sprite *sprite) +{ + if (sprite->data[1] != 0) + { + sprite->data[1]--; + sprite->pos1.x += sprite->data[2]; + } + else + { + gUnknown_02039D08->field_C66--; + sprite->pos1.x = sprite->data[3]; + sprite->callback = SpriteCallbackDummy; + } +} + +void sub_80CB278(struct Sprite *sprite) +{ + if (sprite->data[4] != 0) + { + sprite->data[4]--; + } + else + { + sprite->pos1.x += sprite->data[2]; + sprite->data[5] = sprite->pos1.x + sprite->pos2.x; + if (sprite->data[5] <= 68 || sprite->data[5] >= 252) + sprite->callback = SpriteCallbackDummy; + } +} + +void DestroyAllIconsInRow(u8 row) +{ + u16 column; + u8 boxPosition = row; + + for (column = 0; column < IN_BOX_COLUMS; column++) + { + if (gUnknown_02039D08->boxMonsSprites[boxPosition] != NULL) + { + DestroyBoxMonIcon(gUnknown_02039D08->boxMonsSprites[boxPosition]); + gUnknown_02039D08->boxMonsSprites[boxPosition] = NULL; + } + boxPosition += IN_BOX_ROWS; + } +} + +u8 sub_80CB2F8(u8 row, u16 times, s16 xDelta) +{ + s32 i; + u16 y = 44; + s16 xDest = 8 * (3 * row) + 100; + u16 x = xDest - ((times + 1) * xDelta); + u8 subpriority = 19 - row; + u8 count = 0; + u8 boxPosition = row; + + if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + { + for (i = 0; i < IN_BOX_COLUMS; i++) + { + if (gUnknown_02039D08->boxSpecies[boxPosition] != SPECIES_NONE) + { + gUnknown_02039D08->boxMonsSprites[boxPosition] = CreateMonIconSprite(gUnknown_02039D08->boxSpecies[boxPosition], + gUnknown_02039D08->boxPersonalities[boxPosition], + x, y, 2, subpriority); + if (gUnknown_02039D08->boxMonsSprites[boxPosition] != NULL) + { + gUnknown_02039D08->boxMonsSprites[boxPosition]->data[1] = times; + gUnknown_02039D08->boxMonsSprites[boxPosition]->data[2] = xDelta; + gUnknown_02039D08->boxMonsSprites[boxPosition]->data[3] = xDest; + gUnknown_02039D08->boxMonsSprites[boxPosition]->callback = sub_80CB234; + count++; + } + } + boxPosition += IN_BOX_ROWS; + y += 24; + } + } + else + { + for (i = 0; i < IN_BOX_COLUMS; i++) + { + if (gUnknown_02039D08->boxSpecies[boxPosition] != SPECIES_NONE) + { + gUnknown_02039D08->boxMonsSprites[boxPosition] = CreateMonIconSprite(gUnknown_02039D08->boxSpecies[boxPosition], + gUnknown_02039D08->boxPersonalities[boxPosition], + x, y, 2, subpriority); + if (gUnknown_02039D08->boxMonsSprites[boxPosition] != NULL) + { + gUnknown_02039D08->boxMonsSprites[boxPosition]->data[1] = times; + gUnknown_02039D08->boxMonsSprites[boxPosition]->data[2] = xDelta; + gUnknown_02039D08->boxMonsSprites[boxPosition]->data[3] = xDest; + gUnknown_02039D08->boxMonsSprites[boxPosition]->callback = sub_80CB234; + if (GetBoxMonDataAt(gUnknown_02039D08->field_C5C, boxPosition, MON_DATA_HELD_ITEM) == 0) + gUnknown_02039D08->boxMonsSprites[boxPosition]->oam.objMode = 1; + count++; + } + } + boxPosition += IN_BOX_ROWS; + y += 24; + } + } + + return count; +} + +void sub_80CB4CC(u8 boxId, s8 direction) +{ + gUnknown_02039D08->field_C6A = 0; + gUnknown_02039D08->field_C6B = boxId; + gUnknown_02039D08->field_C69 = direction; + gUnknown_02039D08->field_C60 = 32; + gUnknown_02039D08->field_C64 = -(6 * direction); + gUnknown_02039D08->field_C66 = 0; + SetBoxSpeciesAndPersonalities(boxId); + if (direction > 0) + gUnknown_02039D08->field_C68 = 0; + else + gUnknown_02039D08->field_C68 = IN_BOX_ROWS - 1; + + gUnknown_02039D08->field_C62 = (24 * gUnknown_02039D08->field_C68) + 100; + sub_80CB1F0(gUnknown_02039D08->field_C64); +} + +bool8 sub_80CB584(void) +{ + if (gUnknown_02039D08->field_C60 != 0) + gUnknown_02039D08->field_C60--; + + switch (gUnknown_02039D08->field_C6A) + { + case 0: + gUnknown_02039D08->field_C62 += gUnknown_02039D08->field_C64; + if (gUnknown_02039D08->field_C62 <= 64 || gUnknown_02039D08->field_C62 >= 252) + { + DestroyAllIconsInRow(gUnknown_02039D08->field_C68); + gUnknown_02039D08->field_C62 += gUnknown_02039D08->field_C69 * 24; + gUnknown_02039D08->field_C6A++; + } + break; + case 1: + gUnknown_02039D08->field_C62 += gUnknown_02039D08->field_C64; + gUnknown_02039D08->field_C66 += sub_80CB2F8(gUnknown_02039D08->field_C68, gUnknown_02039D08->field_C60, gUnknown_02039D08->field_C64); + if ((gUnknown_02039D08->field_C69 > 0 && gUnknown_02039D08->field_C68 == IN_BOX_ROWS - 1) + || (gUnknown_02039D08->field_C69 < 0 && gUnknown_02039D08->field_C68 == 0)) + { + gUnknown_02039D08->field_C6A++; + } + else + { + gUnknown_02039D08->field_C68 += gUnknown_02039D08->field_C69; + gUnknown_02039D08->field_C6A = 0; + } + break; + case 2: + if (gUnknown_02039D08->field_C66 == 0) + { + gUnknown_02039D08->field_C60++; + return FALSE; + } + break; + default: + return FALSE; + } + + return TRUE; +} + +void SetBoxSpeciesAndPersonalities(u8 boxId) +{ + s32 i, j, boxPosition; + + boxPosition = 0; + for (i = 0; i < IN_BOX_COLUMS; i++) + { + for (j = 0; j < IN_BOX_ROWS; j++) + { + gUnknown_02039D08->boxSpecies[boxPosition] = GetBoxMonDataAt(boxId, boxPosition, MON_DATA_SPECIES2); + if (gUnknown_02039D08->boxSpecies[boxPosition] != SPECIES_NONE) + gUnknown_02039D08->boxPersonalities[boxPosition] = GetBoxMonDataAt(boxId, boxPosition, MON_DATA_PERSONALITY); + boxPosition++; + } + } + + gUnknown_02039D08->field_C5C = boxId; +} + +void DestroyBoxMonIconAtPosition(u8 boxPosition) +{ + if (gUnknown_02039D08->boxMonsSprites[boxPosition] != NULL) + { + DestroyBoxMonIcon(gUnknown_02039D08->boxMonsSprites[boxPosition]); + gUnknown_02039D08->boxMonsSprites[boxPosition] = NULL; + } +} + +void SetBoxMonIconObjMode(u8 boxPosition, u8 objMode) +{ + if (gUnknown_02039D08->boxMonsSprites[boxPosition] != NULL) + { + gUnknown_02039D08->boxMonsSprites[boxPosition]->oam.objMode = objMode; + } +} + +void CreatePartyMonsSprites(bool8 arg0) +{ + u16 i, count; + u16 species = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES2); + u32 personality = GetMonData(&gPlayerParty[0], MON_DATA_PERSONALITY); + + gUnknown_02039D08->partySprites[0] = CreateMonIconSprite(species, personality, 104, 64, 1, 12); + count = 1; + for (i = 1; i < PARTY_SIZE; i++) + { + species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); + if (species != SPECIES_NONE) + { + personality = GetMonData(&gPlayerParty[i], MON_DATA_PERSONALITY); + gUnknown_02039D08->partySprites[i] = CreateMonIconSprite(species, personality, 152, 8 * (3 * (i - 1)) + 16, 1, 12); + count++; + } + else + { + gUnknown_02039D08->partySprites[i] = NULL; + } + } + + if (!arg0) + { + for (i = 0; i < count; i++) + { + gUnknown_02039D08->partySprites[i]->pos1.y -= 160; + gUnknown_02039D08->partySprites[i]->invisible = TRUE; + } + } + + if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + { + for (i = 0; i < PARTY_SIZE; i++) + { + if (gUnknown_02039D08->partySprites[i] != NULL && GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM) == 0) + gUnknown_02039D08->partySprites[i]->oam.objMode = 1; + } + } +} + +void sub_80CB950(void) +{ + u16 i, count; + + gUnknown_02039D08->field_C5E = 0; + for (i = 0, count = 0; i < PARTY_SIZE; i++) + { + if (gUnknown_02039D08->partySprites[i] != NULL) + { + if (i != count) + { + sub_80CB9D0(gUnknown_02039D08->partySprites[i], count); + gUnknown_02039D08->partySprites[i] = NULL; + gUnknown_02039D08->field_C5E++; + } + count++; + } + } +} + +u8 sub_80CB9BC(void) +{ + return gUnknown_02039D08->field_C5E; +} + +void sub_80CB9D0(struct Sprite *sprite, u16 partyId) +{ + s16 x, y; + + sprite->data[1] = partyId; + if (partyId == 0) + x = 104, y = 64; + else + x = 152, y = 8 * (3 * (partyId - 1)) + 16; + + sprite->data[2] = (u16)(sprite->pos1.x) * 8; + sprite->data[3] = (u16)(sprite->pos1.y) * 8; + sprite->data[4] = ((x * 8) - sprite->data[2]) / 8; + sprite->data[5] = ((y * 8) - sprite->data[3]) / 8; + sprite->data[6] = 8; + sprite->callback = sub_80CBA3C; +} + +void sub_80CBA3C(struct Sprite *sprite) +{ + if (sprite->data[6] != 0) + { + s16 x = sprite->data[2] += sprite->data[4]; + s16 y = sprite->data[3] += sprite->data[5]; + sprite->pos1.x = x / 8u; + sprite->pos1.y = y / 8u; + sprite->data[6]--; + } + else + { + if (sprite->data[1] == 0) + { + sprite->pos1.x = 104; + sprite->pos1.y = 64; + } + else + { + sprite->pos1.x = 152; + sprite->pos1.y = 8 * (3 * (sprite->data[1] - 1)) + 16; + } + sprite->callback = SpriteCallbackDummy; + gUnknown_02039D08->partySprites[sprite->data[1]] = sprite; + gUnknown_02039D08->field_C5E--; + } +} + +void sub_80CBAC4(void) +{ + if (gUnknown_02039D08->field_A6C != NULL) + { + DestroyBoxMonIcon(gUnknown_02039D08->field_A6C); + gUnknown_02039D08->field_A6C = NULL; + } +} + +void sub_80CBAF0(s16 yDelta) +{ + u16 i, posY; + + for (i = 0; i < PARTY_SIZE; i++) + { + if (gUnknown_02039D08->partySprites[i] != NULL) + { + gUnknown_02039D08->partySprites[i]->pos1.y += yDelta; + posY = gUnknown_02039D08->partySprites[i]->pos1.y + gUnknown_02039D08->partySprites[i]->pos2.y + gUnknown_02039D08->partySprites[i]->centerToCornerVecY; + posY += 16; + if (posY > 192) + gUnknown_02039D08->partySprites[i]->invisible = TRUE; + else + gUnknown_02039D08->partySprites[i]->invisible = FALSE; + } + } +} + +void DestroyPartyMonIcon(u8 partyId) +{ + if (gUnknown_02039D08->partySprites[partyId] != NULL) + { + DestroyBoxMonIcon(gUnknown_02039D08->partySprites[partyId]); + gUnknown_02039D08->partySprites[partyId] = NULL; + } +} + +void DestroyAllPartyMonIcons(void) +{ + u16 i; + + for (i = 0; i < PARTY_SIZE; i++) + { + if (gUnknown_02039D08->partySprites[i] != NULL) + { + DestroyBoxMonIcon(gUnknown_02039D08->partySprites[i]); + gUnknown_02039D08->partySprites[i] = NULL; + } + } +} + +void SetPartyMonIconObjMode(u8 partyId, u8 objMode) +{ + if (gUnknown_02039D08->partySprites[partyId] != NULL) + { + gUnknown_02039D08->partySprites[partyId]->oam.objMode = objMode; + } +} + +void sub_80CBC14(u8 mode, u8 id) +{ + if (mode == MODE_PARTY) + { + gUnknown_02039D08->field_A6C = gUnknown_02039D08->partySprites[id]; + gUnknown_02039D08->partySprites[id] = NULL; + } + else if (mode == MODE_BOX) + { + gUnknown_02039D08->field_A6C = gUnknown_02039D08->boxMonsSprites[id]; + gUnknown_02039D08->boxMonsSprites[id] = NULL; + } + else + { + return; + } + + gUnknown_02039D08->field_A6C->callback = sub_80CC100; + gUnknown_02039D08->field_A6C->oam.priority = sub_80CAFAC(); + gUnknown_02039D08->field_A6C->subpriority = 7; +} + +void sub_80CBCAC(u8 boxId, u8 position) +{ + if (boxId == TOTAL_BOXES_COUNT) // party mon + { + gUnknown_02039D08->partySprites[position] = gUnknown_02039D08->field_A6C; + gUnknown_02039D08->partySprites[position]->oam.priority = 1; + gUnknown_02039D08->partySprites[position]->subpriority = 12; + } + else + { + gUnknown_02039D08->boxMonsSprites[position] = gUnknown_02039D08->field_A6C; + gUnknown_02039D08->boxMonsSprites[position]->oam.priority = 2; + gUnknown_02039D08->boxMonsSprites[position]->subpriority = 19 - (position % IN_BOX_ROWS); + } + gUnknown_02039D08->field_A6C->callback = SpriteCallbackDummy; + gUnknown_02039D08->field_A6C = NULL; +} + +void sub_80CBD5C(u8 boxId, u8 position) +{ + if (boxId == TOTAL_BOXES_COUNT) // party mon + gUnknown_02039D08->field_B00 = &gUnknown_02039D08->partySprites[position]; + else + gUnknown_02039D08->field_B00 = &gUnknown_02039D08->boxMonsSprites[position]; + + gUnknown_02039D08->field_A6C->callback = SpriteCallbackDummy; + gUnknown_02039D08->field_C5D = 0; +} + +bool8 sub_80CBDC4(void) +{ + if (gUnknown_02039D08->field_C5D == 16) + return FALSE; + + gUnknown_02039D08->field_C5D++; + if (gUnknown_02039D08->field_C5D & 1) + { + (*gUnknown_02039D08->field_B00)->pos1.y--; + gUnknown_02039D08->field_A6C->pos1.y++; + } + + (*gUnknown_02039D08->field_B00)->pos2.x = gSineTable[gUnknown_02039D08->field_C5D * 8] / 16; + gUnknown_02039D08->field_A6C->pos2.x = -(gSineTable[gUnknown_02039D08->field_C5D * 8] / 16); + if (gUnknown_02039D08->field_C5D == 8) + { + gUnknown_02039D08->field_A6C->oam.priority = (*gUnknown_02039D08->field_B00)->oam.priority; + gUnknown_02039D08->field_A6C->subpriority = (*gUnknown_02039D08->field_B00)->subpriority; + (*gUnknown_02039D08->field_B00)->oam.priority = sub_80CAFAC(); + (*gUnknown_02039D08->field_B00)->subpriority = 7; + } + + if (gUnknown_02039D08->field_C5D == 16) + { + struct Sprite *sprite = gUnknown_02039D08->field_A6C; + gUnknown_02039D08->field_A6C = (*gUnknown_02039D08->field_B00); + *gUnknown_02039D08->field_B00 = sprite; + + gUnknown_02039D08->field_A6C->callback = sub_80CC100; + (*gUnknown_02039D08->field_B00)->callback = SpriteCallbackDummy; + } + + return TRUE; +} + +void sub_80CBF14(u8 mode, u8 position) +{ + switch (mode) + { + case MODE_PARTY: + gUnknown_02039D08->field_B04 = &gUnknown_02039D08->partySprites[position]; + break; + case MODE_BOX: + gUnknown_02039D08->field_B04 = &gUnknown_02039D08->boxMonsSprites[position]; + break; + case MODE_2: + gUnknown_02039D08->field_B04 = &gUnknown_02039D08->field_A6C; + break; + default: + return; + } + + if (*gUnknown_02039D08->field_B04 != NULL) + { + InitSpriteAffineAnim(*gUnknown_02039D08->field_B04); + (*gUnknown_02039D08->field_B04)->oam.affineMode = 1; + (*gUnknown_02039D08->field_B04)->affineAnims = gSpriteAffineAnimTable_857291C; + StartSpriteAffineAnim(*gUnknown_02039D08->field_B04, 0); + } +} + +bool8 sub_80CBFD8(void) +{ + if (*gUnknown_02039D08->field_B04 == NULL || (*gUnknown_02039D08->field_B04)->invisible) + return FALSE; + + if ((*gUnknown_02039D08->field_B04)->affineAnimEnded) + (*gUnknown_02039D08->field_B04)->invisible = TRUE; + + return TRUE; +} + +void sub_80CC020(void) +{ + if (*gUnknown_02039D08->field_B04 != NULL) + { + FreeOamMatrix((*gUnknown_02039D08->field_B04)->oam.matrixNum); + DestroyBoxMonIcon(*gUnknown_02039D08->field_B04); + *gUnknown_02039D08->field_B04 = NULL; + } +} + +void sub_80CC064(void) +{ + if (*gUnknown_02039D08->field_B04 != NULL) + { + (*gUnknown_02039D08->field_B04)->invisible = FALSE; + StartSpriteAffineAnim(*gUnknown_02039D08->field_B04, 1); + } +} + +bool8 sub_80CC0A0(void) +{ + if (gUnknown_02039D08->field_B04 == NULL) + return FALSE; + + if ((*gUnknown_02039D08->field_B04)->affineAnimEnded) + gUnknown_02039D08->field_B04 = NULL; + + return TRUE; +} + +void sub_80CC0D4(u8 priority) +{ + gUnknown_02039D08->field_A6C->oam.priority = priority; +} + +void sub_80CC100(struct Sprite *sprite) +{ + sprite->pos1.x = gUnknown_02039D08->field_CB4->pos1.x; + sprite->pos1.y = gUnknown_02039D08->field_CB4->pos1.y + gUnknown_02039D08->field_CB4->pos2.y + 4; +} + +u16 sub_80CC124(u16 species) +{ + u16 i, var; + + for (i = 0; i < 40; i++) + { + if (gUnknown_02039D08->field_B58[i] == species) + break; + } + + if (i == 40) + { + for (i = 0; i < 40; i++) + { + if (gUnknown_02039D08->field_B58[i] == 0) + break; + } + if (i == 40) + return 0xFFFF; + } + + gUnknown_02039D08->field_B58[i] = species; + gUnknown_02039D08->field_B08[i]++; + var = 16 * i; + CpuCopy32(GetMonIconTiles(species, TRUE), (void*)(OBJ_VRAM0) + var * 32, 0x200); + + return var; +} + +void sub_80CC1E0(u16 species) +{ + u16 i; + + for (i = 0; i < 40; i++) + { + if (gUnknown_02039D08->field_B58[i] == species) + { + if (--gUnknown_02039D08->field_B08[i] == 0) + gUnknown_02039D08->field_B58[i] = 0; + break; + } + } +} + +static struct Sprite *CreateMonIconSprite(u16 species, u32 personality, s16 x, s16 y, u8 oamPriority, u8 subpriority) +{ + u16 tileNum; + u8 spriteId; + struct SpriteTemplate tempalte = gUnknown_085728D4; + + species = GetIconSpecies(species, personality); + tempalte.paletteTag = 0xDAC0 + gMonIconPaletteIndices[species]; + tileNum = sub_80CC124(species); + if (tileNum == 0xFFFF) + return NULL; + + spriteId = CreateSprite(&tempalte, x, y, subpriority); + if (spriteId == MAX_SPRITES) + { + sub_80CC1E0(species); + return NULL; + } + + gSprites[spriteId].oam.tileNum = tileNum; + gSprites[spriteId].oam.priority = oamPriority; + gSprites[spriteId].data[0] = species; + return &gSprites[spriteId]; +} + +void DestroyBoxMonIcon(struct Sprite *sprite) +{ + sub_80CC1E0(sprite->data[0]); + DestroySprite(sprite); +} + +void sub_80CC32C(u8 boxId) +{ + u8 taskId = CreateTask(sub_80CC370, 2); + + gTasks[taskId].data[2] = boxId; +} + +bool8 sub_80CC35C(void) +{ + return FuncIsActiveTask(sub_80CC370); +} + +void sub_80CC370(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + switch (task->data[0]) + { + case 0: + gUnknown_02039D08->field_2D2 = 0; + gUnknown_02039D08->bg2_X = 0; + task->data[1] = RequestDma3Fill(0, gUnknown_02039D08->field_4AC4, 0x1000, 1); + break; + case 1: + if (CheckForSpaceForDma3Request(task->data[1]) == -1) + return; + + SetBgTilemapBuffer(2, gUnknown_02039D08->field_4AC4); + ShowBg(2); + break; + case 2: + LoadWallpaperGfx(task->data[2], 0); + break; + case 3: + if (!WaitForWallpaperGfxLoad()) + return; + + sub_80CCB50(task->data[2]); + sub_80CD02C(); + sub_80CB028(task->data[2]); + SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2) | BGCNT_CHARBASE(2) | BGCNT_SCREENBASE(27) | BGCNT_TXT512x256); + break; + case 4: + DestroyTask(taskId); + break; + default: + task->data[0] = 0; + return; + } + + task->data[0]++; +} + +void SetUpScrollToBox(u8 boxId) +{ + s8 direction = sub_80CC644(boxId); + + gUnknown_02039D08->field_2CE = (direction > 0) ? 6 : -6; + gUnknown_02039D08->field_2D3 = (direction > 0) ? 1 : 2; + gUnknown_02039D08->field_2D0 = 32; + gUnknown_02039D08->field_2D4 = boxId; + gUnknown_02039D08->field_2D6 = (direction <= 0) ? 5 : 0; + gUnknown_02039D08->field_2D8 = direction; + gUnknown_02039D08->field_2DA = (direction > 0) ? 264 : 56; + gUnknown_02039D08->field_2DC = (direction <= 0) ? 5 : 0; + gUnknown_02039D08->field_2DE = 0; + gUnknown_02039D08->field_2E0 = 2; + gUnknown_02039D08->field_A64 = boxId; + gUnknown_02039D08->field_A65 = direction; + gUnknown_02039D08->field_A63 = 0; +} + +bool8 ScrollToBox(void) +{ + bool8 var; + + switch (gUnknown_02039D08->field_A63) + { + case 0: + LoadWallpaperGfx(gUnknown_02039D08->field_A64, gUnknown_02039D08->field_A65); + gUnknown_02039D08->field_A63++; + case 1: + if (!WaitForWallpaperGfxLoad()) + return TRUE; + + sub_80CB4CC(gUnknown_02039D08->field_A64, gUnknown_02039D08->field_A65); + sub_80CCCFC(gUnknown_02039D08->field_A64, gUnknown_02039D08->field_A65); + sub_80CD0B8(gUnknown_02039D08->field_A65); + break; + case 2: + var = sub_80CB584(); + if (gUnknown_02039D08->field_2D0 != 0) + { + gUnknown_02039D08->bg2_X += gUnknown_02039D08->field_2CE; + if (--gUnknown_02039D08->field_2D0 != 0) + return TRUE; + sub_80CCEE0(); + sub_80CD158(); + } + return var; + } + + gUnknown_02039D08->field_A63++; + return TRUE; +} + +s8 sub_80CC644(u8 boxId) +{ + u8 i; + u8 currentBox = StorageGetCurrentBox(); + + for (i = 0; currentBox != boxId; i++) + { + currentBox++; + if (currentBox >= TOTAL_BOXES_COUNT) + currentBox = 0; + } + + return (i < TOTAL_BOXES_COUNT / 2) ? 1 : -1; +} + +void SetWallpaperForCurrentBox(u8 wallpaperId) +{ + u8 boxId = StorageGetCurrentBox(); + SetBoxWallpaper(boxId, wallpaperId); + gUnknown_02039D08->wallpaperChangeState = 0; +} + +bool8 DoWallpaperGfxChange(void) +{ + switch (gUnknown_02039D08->wallpaperChangeState) + { + case 0: + BeginNormalPaletteFade(gUnknown_02039D08->field_738, 1, 0, 16, RGB_WHITEALPHA); + gUnknown_02039D08->wallpaperChangeState++; + break; + case 1: + if (!UpdatePaletteFade()) + { + u8 curBox = StorageGetCurrentBox(); + LoadWallpaperGfx(curBox, 0); + gUnknown_02039D08->wallpaperChangeState++; + } + break; + case 2: + if (WaitForWallpaperGfxLoad() == TRUE) + { + sub_80CCF9C(); + BeginNormalPaletteFade(gUnknown_02039D08->field_738, 1, 16, 0, RGB_WHITEALPHA); + gUnknown_02039D08->wallpaperChangeState++; + } + break; + case 3: + if (!UpdatePaletteFade()) + gUnknown_02039D08->wallpaperChangeState++; + break; + case 4: + return FALSE; + } + + return TRUE; +} + +void LoadWallpaperGfx(u8 boxId, s8 direction) +{ + u8 wallpaperId; + const struct WallpaperTable *wallpaperGfx; + void *iconGfx; + u32 size1, size2; + + gUnknown_02039D08->field_6F9 = 0; + gUnknown_02039D08->field_6FA = boxId; + gUnknown_02039D08->field_6FB = direction; + if (gUnknown_02039D08->field_6FB != 0) + { + gUnknown_02039D08->field_2D2 = (gUnknown_02039D08->field_2D2 == 0); + sub_80CCAE0(gUnknown_02039D08->field_4AC4); + } + + wallpaperId = GetBoxWallpaper(gUnknown_02039D08->field_6FA); + if (wallpaperId != WALLPAPER_FRIENDS) + { + wallpaperGfx = &gWallpaperTable[wallpaperId]; + LZ77UnCompWram(wallpaperGfx->tileMap, gUnknown_02039D08->field_792); + sub_80CCA3C(gUnknown_02039D08->field_792, gUnknown_02039D08->field_6FB, gUnknown_02039D08->field_2D2); + + if (gUnknown_02039D08->field_6FB != 0) + LoadPalette(wallpaperGfx->palettes, (gUnknown_02039D08->field_2D2 * 32) + 0x40, 0x40); + else + CpuCopy16(wallpaperGfx->palettes, &gPlttBufferUnfaded[(gUnknown_02039D08->field_2D2 * 32) + 0x40], 0x40); + + gUnknown_02039D08->wallpaperTiles = malloc_and_decompress(wallpaperGfx->tiles, &size1); + LoadBgTiles(2, gUnknown_02039D08->wallpaperTiles, size1, gUnknown_02039D08->field_2D2 << 8); + } + else + { + wallpaperGfx = &gFriendsWallpaperTable[GetWaldaWallpaperPatternId()]; + LZ77UnCompWram(wallpaperGfx->tileMap, gUnknown_02039D08->field_792); + sub_80CCA3C(gUnknown_02039D08->field_792, gUnknown_02039D08->field_6FB, gUnknown_02039D08->field_2D2); + + CpuCopy16(wallpaperGfx->palettes, gUnknown_02039D08->field_792, 0x40); + CpuCopy16(GetWaldaWallpaperColorsPtr(), &gUnknown_02039D08->field_792[1], 4); + CpuCopy16(GetWaldaWallpaperColorsPtr(), &gUnknown_02039D08->field_792[17], 4); + + if (gUnknown_02039D08->field_6FB != 0) + LoadPalette(gUnknown_02039D08->field_792, (gUnknown_02039D08->field_2D2 * 32) + 0x40, 0x40); + else + CpuCopy16(gUnknown_02039D08->field_792, &gPlttBufferUnfaded[(gUnknown_02039D08->field_2D2 * 32) + 0x40], 0x40); + + gUnknown_02039D08->wallpaperTiles = malloc_and_decompress(wallpaperGfx->tiles, &size1); + iconGfx = malloc_and_decompress(gFriendsIcons[GetWaldaWallpaperIconId()], &size2); + CpuCopy32(iconGfx, gUnknown_02039D08->wallpaperTiles + 0x800, size2); + Free(iconGfx); + LoadBgTiles(2, gUnknown_02039D08->wallpaperTiles, size1, gUnknown_02039D08->field_2D2 << 8); + } + + CopyBgTilemapBufferToVram(2); +} + +bool32 WaitForWallpaperGfxLoad(void) +{ + if (IsDma3ManagerBusyWithBgCopy()) + return FALSE; + + if (gUnknown_02039D08->wallpaperTiles != NULL) + { + Free(gUnknown_02039D08->wallpaperTiles); + gUnknown_02039D08->wallpaperTiles = NULL; + } + return TRUE; +} + +void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2) +{ + s16 var = (arg2 * 2) + 3; + s16 x = ((gUnknown_02039D08->bg2_X / 8 + 10) + (direction * 24)) & 0x3F; + + CopyRectToBgTilemapBufferRect(2, tilemap, 0, 0, 0x14, 0x12, x, 2, 0x14, 0x12, 0x11, arg2 << 8, var); + + if (direction == 0) + return; + else if (direction > 0) + x *= 1, x += 0x14; // x * 1 is needed to match, but can be safely removed as it makes no functional difference + else + x -= 4; + + FillBgTilemapBufferRect(2, 0, x, 2, 4, 0x12, 0x11); +} + +void sub_80CCAE0(void *arg0) +{ + u16 i; + u16 *dest = arg0; + s16 r3 = ((gUnknown_02039D08->bg2_X / 8) + 30) & 0x3F; + + if (r3 <= 31) + dest += r3 + 0x260; + else + dest += r3 + 0x640; + + for (i = 0; i < 0x2C; i++) + { + *dest++ = 0; + r3 = (r3 + 1) & 0x3F; + if (r3 == 0) + dest -= 0x420; + if (r3 == 0x20) + dest += 0x3e0; + } +} + +void sub_80CCB50(u8 boxId) +{ + u8 tagIndex; + s16 r6; + u16 i; + + struct SpriteSheet spriteSheet = {gUnknown_02039D08->field_2F8, 0x200, TAG_TILE_3}; + struct SpritePalette palettes[] = { + {gUnknown_02039D08->field_6FC, TAG_PAL_DAC9}, + {} + }; + + u16 wallpaperId = GetBoxWallpaper(boxId); + + gUnknown_02039D08->field_6FC[14] = gUnknown_08577574[wallpaperId][0]; + gUnknown_02039D08->field_6FC[15] = gUnknown_08577574[wallpaperId][1]; + LoadSpritePalettes(palettes); + gUnknown_02039D08->field_738 = 0x3f0; + + tagIndex = IndexOfSpritePaletteTag(TAG_PAL_DAC9); + gUnknown_02039D08->field_71C = 0x10e + 16 * tagIndex; + gUnknown_02039D08->field_738 |= 0x10000 << tagIndex; + + tagIndex = IndexOfSpritePaletteTag(TAG_PAL_DAC9); + gUnknown_02039D08->field_71E = 0x10e + 16 * tagIndex; + gUnknown_02039D08->field_738 |= 0x10000 << tagIndex; + + StringCopyPadded(gUnknown_02039D08->field_21B8, GetBoxNamePtr(boxId), 0, 8); + sub_80C6D80(gUnknown_02039D08->field_21B8, gUnknown_02039D08->field_2F8, 0, 0, 2); + LoadSpriteSheet(&spriteSheet); + r6 = sub_80CD00C(GetBoxNamePtr(boxId)); + + for (i = 0; i < 2; i++) + { + u8 spriteId = CreateSprite(&gSpriteTemplate_857B0A8, r6 + i * 32, 28, 24); + gUnknown_02039D08->field_720[i] = &gSprites[spriteId]; + StartSpriteAnim(gUnknown_02039D08->field_720[i], i); + } + gUnknown_02039D08->field_6F8 = 0; +} + +void sub_80CCCFC(u8 boxId, s8 direction) +{ + u16 r8; + s16 x, x2; + u16 i; + struct SpriteSheet spriteSheet = {gUnknown_02039D08->field_2F8, 0x200, TAG_TILE_3}; + struct SpriteTemplate template = gSpriteTemplate_857B0A8; + + gUnknown_02039D08->field_6F8 = (gUnknown_02039D08->field_6F8 == 0); + if (gUnknown_02039D08->field_6F8 == 0) + { + spriteSheet.tag = TAG_TILE_3; + r8 = gUnknown_02039D08->field_71C; + } + else + { + spriteSheet.tag = TAG_TILE_4; + r8 = gUnknown_02039D08->field_71C; + template.tileTag = 4; + template.paletteTag = TAG_PAL_DAC9; + } + + StringCopyPadded(gUnknown_02039D08->field_21B8, GetBoxNamePtr(boxId), 0, 8); + sub_80C6D80(gUnknown_02039D08->field_21B8, gUnknown_02039D08->field_2F8, 0, 0, 2); + LoadSpriteSheet(&spriteSheet); + LoadPalette(gUnknown_08577574[GetBoxWallpaper(boxId)], r8, 4); + x = sub_80CD00C(GetBoxNamePtr(boxId)); + x2 = x; + x2 += direction * 192; + + for (i = 0; i < 2; i++) + { + u8 spriteId = CreateSprite(&template, i * 32 + x2, 28, 24); + + gUnknown_02039D08->field_728[i] = &gSprites[spriteId]; + gUnknown_02039D08->field_728[i]->data[0] = (-direction) * 6; + gUnknown_02039D08->field_728[i]->data[1] = i * 32 + x; + gUnknown_02039D08->field_728[i]->data[2] = 0; + gUnknown_02039D08->field_728[i]->callback = sub_80CCF30; + StartSpriteAnim(gUnknown_02039D08->field_728[i], i); + + gUnknown_02039D08->field_720[i]->data[0] = (-direction) * 6; + gUnknown_02039D08->field_720[i]->data[1] = 1; + gUnknown_02039D08->field_720[i]->callback = sub_80CCF64; + } +} + +void sub_80CCEE0(void) +{ + if (gUnknown_02039D08->field_6F8 == 0) + FreeSpriteTilesByTag(TAG_TILE_4); + else + FreeSpriteTilesByTag(TAG_TILE_3); + + gUnknown_02039D08->field_720[0] = gUnknown_02039D08->field_728[0]; + gUnknown_02039D08->field_720[1] = gUnknown_02039D08->field_728[1]; +} + +void sub_80CCF30(struct Sprite *sprite) +{ + if (sprite->data[2] != 0) + sprite->data[2]--; + else if ((sprite->pos1.x += sprite->data[0]) == sprite->data[1]) + sprite->callback = SpriteCallbackDummy; +} + +void sub_80CCF64(struct Sprite *sprite) +{ + if (sprite->data[1] != 0) + { + sprite->data[1]--; + } + else + { + sprite->pos1.x += sprite->data[0]; + sprite->data[2] = sprite->pos1.x + sprite->pos2.x; + if (sprite->data[2] < 0x40 || sprite->data[2] > 0x100) + DestroySprite(sprite); + } +} + +void sub_80CCF9C(void) +{ + u8 boxId = StorageGetCurrentBox(); + u8 wallpaperId = GetBoxWallpaper(boxId); + if (gUnknown_02039D08->field_6F8 == 0) + CpuCopy16(gUnknown_08577574[wallpaperId], gPlttBufferUnfaded + gUnknown_02039D08->field_71C, 4); + else + CpuCopy16(gUnknown_08577574[wallpaperId], gPlttBufferUnfaded + gUnknown_02039D08->field_71E, 4); +} + +s16 sub_80CD00C(const u8 *string) +{ + return 0xB0 - GetStringWidth(1, string, 0) / 2; +} + +void sub_80CD02C(void) +{ + u16 i; + + LoadSpriteSheet(&gUnknown_0857B080); + for (i = 0; i < 2; i++) + { + u8 spriteId = CreateSprite(&gUnknown_0857B0E0, 0x5c + i * 0x88, 28, 22); + if (spriteId != MAX_SPRITES) + { + struct Sprite *sprite = &gSprites[spriteId]; + StartSpriteAnim(sprite, i); + sprite->data[3] = (i == 0) ? -1 : 1; + gUnknown_02039D08->field_730[i] = sprite; + } + } + if (IsCursorOnBox()) + sub_80CD1A8(TRUE); +} + +void sub_80CD0B8(s8 direction) +{ + u16 i; + + for (i = 0; i < 2; i++) + { + gUnknown_02039D08->field_730[i]->pos2.x = 0; + gUnknown_02039D08->field_730[i]->data[0] = 2; + } + if (direction < 0) + { + gUnknown_02039D08->field_730[0]->data[1] = 29; + gUnknown_02039D08->field_730[1]->data[1] = 5; + gUnknown_02039D08->field_730[0]->data[2] = 0x48; + gUnknown_02039D08->field_730[1]->data[2] = 0x48; + } + else + { + gUnknown_02039D08->field_730[0]->data[1] = 5; + gUnknown_02039D08->field_730[1]->data[1] = 29; + gUnknown_02039D08->field_730[0]->data[2] = 0xF8; + gUnknown_02039D08->field_730[1]->data[2] = 0xF8; + } + gUnknown_02039D08->field_730[0]->data[7] = 0; + gUnknown_02039D08->field_730[1]->data[7] = 1; +} + +void sub_80CD158(void) +{ + u16 i; + + for (i = 0; i < 2; i++) + { + gUnknown_02039D08->field_730[i]->pos1.x = 0x88 * i + 0x5c; + gUnknown_02039D08->field_730[i]->pos2.x = 0; + gUnknown_02039D08->field_730[i]->invisible = FALSE; + } + sub_80CD1A8(TRUE); +} + +void sub_80CD1A8(bool8 a0) +{ + u16 i; + + if (a0) + { + for (i = 0; i < 2; i++) + { + gUnknown_02039D08->field_730[i]->data[0] = 1; + gUnknown_02039D08->field_730[i]->data[1] = 0; + gUnknown_02039D08->field_730[i]->data[2] = 0; + gUnknown_02039D08->field_730[i]->data[4] = 0; + } + } + else + { + for (i = 0; i < 2; i++) + { + gUnknown_02039D08->field_730[i]->data[0] = 0; + } + } +} + +void sub_80CD210(struct Sprite *sprite) +{ + switch (sprite->data[0]) + { + case 0: + sprite->pos2.x = 0; + break; + case 1: + if (++sprite->data[1] > 3) + { + sprite->data[1] = 0; + sprite->pos2.x += sprite->data[3]; + if (++sprite->data[2] > 5) + { + sprite->data[2] = 0; + sprite->pos2.x = 0; + } + } + break; + case 2: + sprite->data[0] = 3; + break; + case 3: + sprite->pos1.x -= gUnknown_02039D08->field_2CE; + if (sprite->pos1.x < 0x49 || sprite->pos1.x > 0xf7) + sprite->invisible = TRUE; + if (--sprite->data[1] == 0) + { + sprite->pos1.x = sprite->data[2]; + sprite->invisible = FALSE; + sprite->data[0] = 4; + } + break; + case 4: + sprite->pos1.x -= gUnknown_02039D08->field_2CE; + break; + } +} + +struct Sprite *sub_80CD2E8(u16 x, u16 y, u8 animId, u8 priority, u8 subpriority) +{ + u8 spriteId = CreateSprite(&gUnknown_0857B0E0, x, y, subpriority); + if (spriteId == MAX_SPRITES) + return NULL; + + animId %= 2; + StartSpriteAnim(&gSprites[spriteId], animId); + gSprites[spriteId].oam.priority = priority; + gSprites[spriteId].callback = SpriteCallbackDummy; + return &gSprites[spriteId]; +} + +void sub_80CD36C(void) +{ + if (gUnknown_02039D08->boxOption != BOX_OPTION_DEPOSIT) + sBoxCursorArea = CURSOR_AREA_IN_BOX; + else + sBoxCursorArea = CURSOR_AREA_IN_PARTY; + + sBoxCursorPosition = 0; + sIsMonBeingMoved = FALSE; + sMovingMonOrigBoxId = 0; + sMovingMonOrigBoxPos = 0; + sCanOnlyMove = FALSE; + sub_80CDC0C(); + sub_80CFC14(); + gUnknown_02039D08->field_CD6 = 1; + gUnknown_02039D08->field_21FF = 0; + sub_80CEB40(); +} + +void sub_80CD3EC(void) +{ + sub_80CFC14(); + sub_80CEBDC(); + gUnknown_02039D08->field_CD6 = 1; + gUnknown_02039D08->field_21FF = 0; + if (sIsMonBeingMoved) + { + gUnknown_02039D08->field_20A4 = gUnknown_02039D14; + sub_80CAFC4(); + } +} + +void sub_80CD444(u8 a0, u8 a1, u16 *a2, u16 *a3) +{ + switch (a0) + { + case 0: + *a2 = (a1 % 6) * 24 + 100; + *a3 = (a1 / 6) * 24 + 32; + break; + case 1: + if (a1 == 0) + { + *a2 = 0x68; + *a3 = 0x34; + } + else if (a1 == 6) + { + *a2 = 0x98; + *a3 = 0x84; + } + else + { + *a2 = 0x98; + *a3 = (a1 - 1) * 24 + 4; + } + break; + case 2: + *a2 = 0xa2; + *a3 = 0x0c; + break; + case 3: + *a3 = sIsMonBeingMoved ? 8 : 14; + *a2 = a1 * 0x58 + 0x78; + break; + case 4: + *a2 = 0xa0; + *a3 = 0x60; + break; + } +} + +u16 sub_80CD504(void) +{ + switch (sBoxCursorArea) + { + case CURSOR_AREA_IN_PARTY: + return GetMonData(&gPlayerParty[sBoxCursorPosition], MON_DATA_SPECIES); + case CURSOR_AREA_IN_BOX: + return GetCurrentBoxMonData(sBoxCursorPosition, MON_DATA_SPECIES); + default: + return SPECIES_NONE; + } +} + +bool8 sub_80CD554(void) +{ + s16 tmp; + + if (gUnknown_02039D08->field_CD0 == 0) + { + if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + return FALSE; + else + return sub_80D1218(); + } + else if (--gUnknown_02039D08->field_CD0 != 0) + { + gUnknown_02039D08->field_CBC += gUnknown_02039D08->field_CC4; + gUnknown_02039D08->field_CC0 += gUnknown_02039D08->field_CC8; + gUnknown_02039D08->field_CB4->pos1.x = gUnknown_02039D08->field_CBC >> 8; + gUnknown_02039D08->field_CB4->pos1.y = gUnknown_02039D08->field_CC0 >> 8; + if (gUnknown_02039D08->field_CB4->pos1.x > 0x100) + { + tmp = gUnknown_02039D08->field_CB4->pos1.x - 0x100; + gUnknown_02039D08->field_CB4->pos1.x = tmp + 0x40; + } + if (gUnknown_02039D08->field_CB4->pos1.x < 0x40) + { + tmp = 0x40 - gUnknown_02039D08->field_CB4->pos1.x; + gUnknown_02039D08->field_CB4->pos1.x = 0x100 - tmp; + } + if (gUnknown_02039D08->field_CB4->pos1.y > 0xb0) + { + tmp = gUnknown_02039D08->field_CB4->pos1.y - 0xb0; + gUnknown_02039D08->field_CB4->pos1.y = tmp - 0x10; + } + if (gUnknown_02039D08->field_CB4->pos1.y < -0x10) + { + tmp = -0x10 - gUnknown_02039D08->field_CB4->pos1.y; + gUnknown_02039D08->field_CB4->pos1.y = 0xb0 - tmp; + } + if (gUnknown_02039D08->field_CD7 && --gUnknown_02039D08->field_CD7 == 0) + gUnknown_02039D08->field_CB4->vFlip = (gUnknown_02039D08->field_CB4->vFlip == FALSE); + } + else + { + gUnknown_02039D08->field_CB4->pos1.x = gUnknown_02039D08->field_CCC; + gUnknown_02039D08->field_CB4->pos1.y = gUnknown_02039D08->field_CCE; + sub_80CDA68(); + } + + return TRUE; +} + +void sub_80CD6AC(u8 a0, u8 a1) +{ + u16 x, y; + + sub_80CD444(a0, a1, &x, &y); + gUnknown_02039D08->field_CD4 = a0; + gUnknown_02039D08->field_CD5 = a1; + gUnknown_02039D08->field_CCC = x; + gUnknown_02039D08->field_CCE = y; +} + +void sub_80CD70C(void) +{ + int r7, r0; + + if (gUnknown_02039D08->field_CD2 != 0 || gUnknown_02039D08->field_CD3 != 0) + gUnknown_02039D08->field_CD0 = 12; + else + gUnknown_02039D08->field_CD0 = 6; + + if (gUnknown_02039D08->field_CD7) + gUnknown_02039D08->field_CD7 = gUnknown_02039D08->field_CD0 >> 1; + + switch (gUnknown_02039D08->field_CD2) + { + default: + r7 = gUnknown_02039D08->field_CCE - gUnknown_02039D08->field_CB4->pos1.y; + break; + case -1: + r7 = gUnknown_02039D08->field_CCE - 0xc0 - gUnknown_02039D08->field_CB4->pos1.y; + break; + case 1: + r7 = gUnknown_02039D08->field_CCE + 0xc0 - gUnknown_02039D08->field_CB4->pos1.y; + break; + } + + switch (gUnknown_02039D08->field_CD3) + { + default: + r0 = gUnknown_02039D08->field_CCC - gUnknown_02039D08->field_CB4->pos1.x; + break; + case -1: + r0 = gUnknown_02039D08->field_CCC - 0xc0 - gUnknown_02039D08->field_CB4->pos1.x; + break; + case 1: + r0 = gUnknown_02039D08->field_CCC + 0xc0 - gUnknown_02039D08->field_CB4->pos1.x; + break; + } + + r7 <<= 8; + r0 <<= 8; + gUnknown_02039D08->field_CC4 = r0 / gUnknown_02039D08->field_CD0; + gUnknown_02039D08->field_CC8 = r7 / gUnknown_02039D08->field_CD0; + gUnknown_02039D08->field_CBC = gUnknown_02039D08->field_CB4->pos1.x << 8; + gUnknown_02039D08->field_CC0 = gUnknown_02039D08->field_CB4->pos1.y << 8; +} + +void sub_80CD894(u8 a0, u8 a1) +{ + sub_80CD6AC(a0, a1); + sub_80CD70C(); + if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + { + if (gUnknown_02039D08->field_21FF == 0 && !sIsMonBeingMoved) + StartSpriteAnim(gUnknown_02039D08->field_CB4, 1); + } + else + { + if (!sub_80D127C()) + StartSpriteAnim(gUnknown_02039D08->field_CB4, 1); + } + + if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + { + if (sBoxCursorArea == CURSOR_AREA_IN_BOX) + sub_80D0E50(0, sBoxCursorPosition); + else if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) + sub_80D0E50(1, sBoxCursorPosition); + + if (a0 == 0) + sub_80D0D8C(0, a1); + else if (a0 == 1) + sub_80D0D8C(1, a1); + } + + if (a0 == 1 && sBoxCursorArea != CURSOR_AREA_IN_PARTY) + { + gUnknown_02039D08->field_CD6 = a0; + gUnknown_02039D08->field_CB8->invisible = TRUE; + } + + switch (a0) + { + case 1 ... 3: + gUnknown_02039D08->field_CB4->oam.priority = 1; + gUnknown_02039D08->field_CB8->invisible = TRUE; + gUnknown_02039D08->field_CB8->oam.priority = 1; + break; + case 0: + if (gUnknown_02039D08->field_21FF != 0) + { + gUnknown_02039D08->field_CB4->oam.priority = 0; + gUnknown_02039D08->field_CB8->invisible = TRUE; + } + else + { + gUnknown_02039D08->field_CB4->oam.priority = 2; + if (sBoxCursorArea == CURSOR_AREA_IN_BOX && sIsMonBeingMoved) + sub_80CC0D4(2); + } + break; + } +} + +void sub_80CDA68(void) +{ + sBoxCursorArea = gUnknown_02039D08->field_CD4; + sBoxCursorPosition = gUnknown_02039D08->field_CD5; + if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + { + if (gUnknown_02039D08->field_21FF == 0 && !sIsMonBeingMoved) + StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); + } + else + { + if (!sub_80D127C()) + StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); + } + + sub_80CEB40(); + switch (sBoxCursorArea) + { + case CURSOR_AREA_BUTTONS: + sub_80CC0D4(1); + break; + case CURSOR_AREA_BOX: + sub_80CD1A8(TRUE); + break; + case CURSOR_AREA_IN_PARTY: + gUnknown_02039D08->field_CB8->subpriority = 13; + sub_80CC0D4(1); + break; + case CURSOR_AREA_IN_BOX: + if (gUnknown_02039D08->field_21FF == 0) + { + gUnknown_02039D08->field_CB4->oam.priority = 1; + gUnknown_02039D08->field_CB8->oam.priority = 2; + gUnknown_02039D08->field_CB8->subpriority = 21; + gUnknown_02039D08->field_CB8->invisible = FALSE; + sub_80CC0D4(2); + } + break; + } +} + +void sub_80CDBA0(void) +{ + u8 partyCount; + + if (!sIsMonBeingMoved) + { + partyCount = 0; + } + else + { + partyCount = CalculatePlayerPartyCount(); + if (partyCount >= PARTY_SIZE) + partyCount = PARTY_SIZE - 1; + } + if (gUnknown_02039D08->field_CB4->vFlip) + gUnknown_02039D08->field_CD7 = 1; + sub_80CD894(1, partyCount); +} + +void sub_80CDBF8(u8 a0) +{ + sub_80CD894(0, a0); +} + +void sub_80CDC0C(void) +{ + gUnknown_02039D7E = 0; +} + +void sub_80CDC18(void) +{ + gUnknown_02039D7E = sBoxCursorPosition; +} + +u8 sub_80CDC2C(void) +{ + return gUnknown_02039D7E; +} + +void InitMonPlaceChange(u8 a0) +{ + gUnknown_02039D08->monPlaceChangeFunc = gUnknown_0857B998[a0]; + gUnknown_02039D08->monPlaceChangeState = 0; +} + +void sub_80CDC64(bool8 arg0) +{ + if (!arg0) + gUnknown_02039D08->monPlaceChangeFunc = sub_80CDEB4; + else + gUnknown_02039D08->monPlaceChangeFunc = sub_80CDEC4; + + gUnknown_02039D08->monPlaceChangeState = 0; +} + +bool8 DoMonPlaceChange(void) +{ + return gUnknown_02039D08->monPlaceChangeFunc(); +} + +bool8 MonPlaceChange_Move(void) +{ + switch (gUnknown_02039D08->monPlaceChangeState) + { + case 0: + if (sIsMonBeingMoved) + return FALSE; + StartSpriteAnim(gUnknown_02039D08->field_CB4, 2); + gUnknown_02039D08->monPlaceChangeState++; + break; + case 1: + if (!sub_80CDED4()) + { + StartSpriteAnim(gUnknown_02039D08->field_CB4, 3); + MoveMon(); + gUnknown_02039D08->monPlaceChangeState++; + } + break; + case 2: + if (!sub_80CDF08()) + gUnknown_02039D08->monPlaceChangeState++; + break; + case 3: + return FALSE; + } + + return TRUE; +} + +bool8 MonPlaceChange_Place(void) +{ + switch (gUnknown_02039D08->monPlaceChangeState) + { + case 0: + if (!sub_80CDED4()) + { + StartSpriteAnim(gUnknown_02039D08->field_CB4, 2); + PlaceMon(); + gUnknown_02039D08->monPlaceChangeState++; + } + break; + case 1: + if (!sub_80CDF08()) + { + StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); + gUnknown_02039D08->monPlaceChangeState++; + } + break; + case 2: + return FALSE; + } + + return TRUE; +} + +bool8 MonPlaceChange_Shift(void) +{ + switch (gUnknown_02039D08->monPlaceChangeState) + { + case 0: + switch (sBoxCursorArea) + { + case CURSOR_AREA_IN_PARTY: + gUnknown_02039D08->field_D91 = TOTAL_BOXES_COUNT; + break; + case CURSOR_AREA_IN_BOX: + gUnknown_02039D08->field_D91 = StorageGetCurrentBox(); + break; + default: + return FALSE; + } + StartSpriteAnim(gUnknown_02039D08->field_CB4, 2); + sub_80CBD5C(gUnknown_02039D08->field_D91, sBoxCursorPosition); + gUnknown_02039D08->monPlaceChangeState++; + break; + case 1: + if (!sub_80CBDC4()) + { + StartSpriteAnim(gUnknown_02039D08->field_CB4, 3); + SetShiftedMonData(gUnknown_02039D08->field_D91, sBoxCursorPosition); + gUnknown_02039D08->monPlaceChangeState++; + } + break; + case 2: + return FALSE; + } + + return TRUE; +} + +bool8 sub_80CDEB4(void) +{ + return sub_80CDED4(); +} + +bool8 sub_80CDEC4(void) +{ + return sub_80CDF08(); +} + +bool8 sub_80CDED4(void) +{ + switch (gUnknown_02039D08->field_CB4->pos2.y) + { + default: + gUnknown_02039D08->field_CB4->pos2.y++; + break; + case 0: + gUnknown_02039D08->field_CB4->pos2.y++; + break; + case 8: + return FALSE; + } + + return TRUE; +} + +bool8 sub_80CDF08(void) +{ + switch (gUnknown_02039D08->field_CB4->pos2.y) + { + case 0: + return FALSE; + default: + gUnknown_02039D08->field_CB4->pos2.y--; + break; + } + + return TRUE; +} + +void MoveMon(void) +{ + switch (sBoxCursorArea) + { + case CURSOR_AREA_IN_PARTY: + SetMovedMonData(TOTAL_BOXES_COUNT, sBoxCursorPosition); + sub_80CBC14(MODE_PARTY, sBoxCursorPosition); + break; + case CURSOR_AREA_IN_BOX: + if (gUnknown_02039D08->field_21FF == 0) + { + SetMovedMonData(StorageGetCurrentBox(), sBoxCursorPosition); + sub_80CBC14(MODE_BOX, sBoxCursorPosition); + } + break; + default: + return; + } + + sIsMonBeingMoved = TRUE; +} + +void PlaceMon(void) +{ + u8 boxId; + + switch (sBoxCursorArea) + { + case CURSOR_AREA_IN_PARTY: + SetPlacedMonData(TOTAL_BOXES_COUNT, sBoxCursorPosition); + sub_80CBCAC(TOTAL_BOXES_COUNT, sBoxCursorPosition); + break; + case CURSOR_AREA_IN_BOX: + boxId = StorageGetCurrentBox(); + SetPlacedMonData(boxId, sBoxCursorPosition); + sub_80CBCAC(boxId, sBoxCursorPosition); + break; + default: + return; + } + + sIsMonBeingMoved = FALSE; +} + +void sub_80CE00C(void) +{ + sub_80CEB40(); +} + +void SetMovedMonData(u8 boxId, u8 position) +{ + if (boxId == TOTAL_BOXES_COUNT) + gUnknown_02039D08->field_20A4 = gPlayerParty[sBoxCursorPosition]; + else + BoxMonAtToMon(boxId, position, &gUnknown_02039D08->field_20A4); + + PurgeMonOrBoxMon(boxId, position); + sMovingMonOrigBoxId = boxId; + sMovingMonOrigBoxPos = position; +} + +void SetPlacedMonData(u8 boxId, u8 position) +{ + if (boxId == TOTAL_BOXES_COUNT) + { + gPlayerParty[position] = gUnknown_02039D08->field_20A4; + } + else + { + BoxMonRestorePP(&gUnknown_02039D08->field_20A4.box); + SetBoxMonAt(boxId, position, &gUnknown_02039D08->field_20A4.box); + } +} + +void PurgeMonOrBoxMon(u8 boxId, u8 position) +{ + if (boxId == TOTAL_BOXES_COUNT) + ZeroMonData(&gPlayerParty[position]); + else + ZeroBoxMonAt(boxId, position); +} + +void SetShiftedMonData(u8 boxId, u8 position) +{ + if (boxId == TOTAL_BOXES_COUNT) + gUnknown_02039D08->field_2108 = gPlayerParty[position]; + else + BoxMonAtToMon(boxId, position, &gUnknown_02039D08->field_2108); + + SetPlacedMonData(boxId, position); + gUnknown_02039D08->field_20A4 = gUnknown_02039D08->field_2108; + sub_80CEC00(&gUnknown_02039D08->field_20A4, 0); + sMovingMonOrigBoxId = boxId; + sMovingMonOrigBoxPos = position; +} + +bool8 TryStorePartyMonInBox(u8 boxId) +{ + s16 boxPosition = GetFirstFreeBoxSpot(boxId); + if (boxPosition == -1) + return FALSE; + + if (sIsMonBeingMoved) + { + SetPlacedMonData(boxId, boxPosition); + sub_80CBAC4(); + sIsMonBeingMoved = FALSE; + } + else + { + SetMovedMonData(TOTAL_BOXES_COUNT, sBoxCursorPosition); + SetPlacedMonData(boxId, boxPosition); + DestroyPartyMonIcon(sBoxCursorPosition); + } + + if (boxId == StorageGetCurrentBox()) + sub_80CB140(boxPosition); + + StartSpriteAnim(gUnknown_02039D08->field_CB4, 1); + return TRUE; +} + +void sub_80CE22C(void) +{ + StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); + sub_80CEB40(); +} + +void sub_80CE250(void) +{ + u8 mode; + + if (sIsMonBeingMoved) + mode = MODE_2; + else if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) + mode = MODE_PARTY; + else + mode = MODE_BOX; + + sub_80CBF14(mode, sBoxCursorPosition); + StringCopy(gUnknown_02039D08->field_21E0, gUnknown_02039D08->field_CEE); +} + +bool8 sub_80CE2A8(void) +{ + if (!sub_80CBFD8()) + { + StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); + return FALSE; + } + else + { + return TRUE; + } +} + +void sub_80CE2D8(void) +{ + u8 boxId; + + sub_80CC020(); + if (sIsMonBeingMoved) + { + sIsMonBeingMoved = FALSE; + } + else + { + if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) + boxId = TOTAL_BOXES_COUNT; + else + boxId = StorageGetCurrentBox(); + + PurgeMonOrBoxMon(boxId, sBoxCursorPosition); + } + sub_80CEB40(); +} + +void sub_80CE324(void) +{ + if (sIsMonBeingMoved) + StartSpriteAnim(gUnknown_02039D08->field_CB4, 3); +} + +void sub_80CE350(u16 *moves) +{ + s32 i; + + for (i = 0; i < ARRAY_COUNT(gUnknown_0857B9A4); i++) + { + if (gUnknown_0857B9A4[i].mapGroup == MAP_GROUPS_COUNT + || (gUnknown_0857B9A4[i].mapGroup == gSaveBlock1Ptr->location.mapGroup && gUnknown_0857B9A4[i].mapNum == gSaveBlock1Ptr->location.mapNum)) + { + *moves = gUnknown_0857B9A4[i].move; + moves++; + } + } + + *moves = MOVES_COUNT; +} + +void sub_80CE3A0(void) +{ + if (!AtLeastThreeUsableMons()) + { + gUnknown_02039D08->field_216D = 1; + gUnknown_02039D08->field_216C = 0; + return; + } + + if (sIsMonBeingMoved) + { + gUnknown_02039D08->field_2108 = gUnknown_02039D08->field_20A4; + gUnknown_02039D08->field_2170 = -1; + gUnknown_02039D08->field_2171 = -1; + } + else + { + if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) + { + gUnknown_02039D08->field_2108 = gPlayerParty[sBoxCursorPosition]; + gUnknown_02039D08->field_2170 = TOTAL_BOXES_COUNT; + } + else + { + BoxMonAtToMon(StorageGetCurrentBox(), sBoxCursorPosition, &gUnknown_02039D08->field_2108); + gUnknown_02039D08->field_2170 = StorageGetCurrentBox(); + } + gUnknown_02039D08->field_2171 = sBoxCursorPosition; + } + + sub_80CE350(gUnknown_02039D08->field_2176); + gUnknown_02039D08->field_2174 = GetMonData(&gUnknown_02039D08->field_2108, MON_DATA_KNOWN_MOVES, gUnknown_02039D08->field_2176); + if (gUnknown_02039D08->field_2174 != 0) + { + gUnknown_02039D08->field_216D = 0; + } + else + { + gUnknown_02039D08->field_216D = 1; + gUnknown_02039D08->field_216C = 1; + } + + gUnknown_02039D08->field_2172 = 0; +} + +bool32 AtLeastThreeUsableMons(void) +{ + s32 i, j, count; + + count = (sIsMonBeingMoved != FALSE); + for (j = 0; j < PARTY_SIZE; j++) + { + if (GetMonData(&gPlayerParty[j], MON_DATA_SANITY_HAS_SPECIES)) + count++; + } + + if (count >= 3) + return TRUE; + + for (i = 0; i < TOTAL_BOXES_COUNT; i++) + { + for (j = 0; j < IN_BOX_COUNT; j++) + { + if (CheckBoxedMonSanity(i, j)) + { + if (++count >= 3) + return TRUE; + } + } + } + + return FALSE; +} + +s8 sub_80CE580(void) +{ + u16 i; + u16 knownMoves; + + if (gUnknown_02039D08->field_216D) + return gUnknown_02039D08->field_216C; + + switch (gUnknown_02039D08->field_2172) + { + case 0: + for (i = 0; i < PARTY_SIZE; i++) + { + if (gUnknown_02039D08->field_2170 != TOTAL_BOXES_COUNT || gUnknown_02039D08->field_2171 != i) + { + knownMoves = GetMonData(gPlayerParty + i, MON_DATA_KNOWN_MOVES, gUnknown_02039D08->field_2176); + gUnknown_02039D08->field_2174 &= ~(knownMoves); + } + } + if (gUnknown_02039D08->field_2174 == 0) + { + gUnknown_02039D08->field_216D = 1; + gUnknown_02039D08->field_216C = 1; + } + else + { + gUnknown_02039D08->field_216E = 0; + gUnknown_02039D08->field_216F = 0; + gUnknown_02039D08->field_2172++; + } + break; + case 1: + for (i = 0; i < IN_BOX_COUNT; i++) + { + knownMoves = GetAndCopyBoxMonDataAt(gUnknown_02039D08->field_216E, gUnknown_02039D08->field_216F, MON_DATA_KNOWN_MOVES, gUnknown_02039D08->field_2176); + if (knownMoves != 0 + && !(gUnknown_02039D08->field_2170 == gUnknown_02039D08->field_216E && gUnknown_02039D08->field_2171 == gUnknown_02039D08->field_216F)) + { + gUnknown_02039D08->field_2174 &= ~(knownMoves); + if (gUnknown_02039D08->field_2174 == 0) + { + gUnknown_02039D08->field_216D = 1; + gUnknown_02039D08->field_216C = 1; + break; + } + } + if (++gUnknown_02039D08->field_216F >= IN_BOX_COUNT) + { + gUnknown_02039D08->field_216F = 0; + if (++gUnknown_02039D08->field_216E >= TOTAL_BOXES_COUNT) + { + gUnknown_02039D08->field_216D = 1; + gUnknown_02039D08->field_216C = 0; + } + } + } + break; + } + + return -1; +} diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 48ba864f7..03a081af5 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1310,7 +1310,7 @@ static bool8 ExtractMonDataToSummaryStruct(struct Pokemon *a) sum->altAbility = GetMonData(a, MON_DATA_ALT_ABILITY); sum->item = GetMonData(a, MON_DATA_HELD_ITEM); sum->pid = GetMonData(a, MON_DATA_PERSONALITY); - sum->sanity = GetMonData(a, MON_DATA_SANITY_BIT1); + sum->sanity = GetMonData(a, MON_DATA_SANITY_IS_BAD_EGG); if (sum->sanity) sum->isEgg = TRUE; diff --git a/src/post_battle_event_funcs.c b/src/post_battle_event_funcs.c index 934972b7c..fe5e1089e 100644 --- a/src/post_battle_event_funcs.c +++ b/src/post_battle_event_funcs.c @@ -50,8 +50,8 @@ int GameClear(void) ribbonCounts[i].partyIndex = i; ribbonCounts[i].count = 0; - if (GetMonData(mon, MON_DATA_SANITY_BIT2) - && !GetMonData(mon, MON_DATA_SANITY_BIT3) + if (GetMonData(mon, MON_DATA_SANITY_HAS_SPECIES) + && !GetMonData(mon, MON_DATA_SANITY_IS_EGG) && !GetMonData(mon, MON_DATA_CHAMPION_RIBBON)) { u8 val[1] = {TRUE}; diff --git a/src/text.c b/src/text.c index 07c15596e..39e412633 100644 --- a/src/text.c +++ b/src/text.c @@ -1858,7 +1858,7 @@ u32 (*GetFontWidthFunc(u8 glyphId))(u16, bool32) return NULL; } -u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing) +s32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing) { bool8 isJapanese; int minGlyphWidth; @@ -1868,7 +1868,7 @@ u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing) u32 lineWidth; const u8 *bufferPointer; int glyphWidth; - u32 width; + s32 width; isJapanese = 0; minGlyphWidth = 0; @@ -2028,7 +2028,8 @@ u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing) if (lineWidth > width) return lineWidth; - return width; + else + return width; } u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str) diff --git a/src/wild_encounter.c b/src/wild_encounter.c index 3a8adaf15..d21f2e1d7 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -4802,7 +4802,7 @@ static u8 ChooseWildMonLevel(const struct WildPokemon *wildPokemon) rand = Random() % range; // check ability for max level mon - if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3)) + if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)) { u8 ability = GetMonAbility(&gPlayerParty[0]); if (ability == ABILITY_HUSTLE || ability == ABILITY_VITAL_SPIRIT || ability == ABILITY_PRESSURE) @@ -4883,7 +4883,7 @@ static u8 PickWildMonNature(void) } } // check synchronize for a pokemon with the same ability - if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3) + if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG) && GetMonAbility(&gPlayerParty[0]) == ABILITY_SYNCHRONIZE && Random() % 2 == 0) { @@ -4911,7 +4911,7 @@ static void CreateWildMon(u16 species, u8 level) } if (checkCuteCharm - && !GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3) + && !GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG) && GetMonAbility(&gPlayerParty[0]) == ABILITY_CUTE_CHARM && Random() % 3 != 0) { @@ -5029,7 +5029,7 @@ static bool8 DoWildEncounterRateTest(u32 encounterRate, bool8 ignoreAbility) encounterRate = encounterRate * 80 / 100; ApplyFluteEncounterRateMod(&encounterRate); ApplyCleanseTagEncounterRateMod(&encounterRate); - if (!ignoreAbility && !GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3)) + if (!ignoreAbility && !GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)) { u32 ability = GetMonAbility(&gPlayerParty[0]); @@ -5419,7 +5419,7 @@ static bool8 IsAbilityAllowingEncounter(u8 level) { u8 ability; - if (GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3)) + if (GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)) return TRUE; ability = GetMonAbility(&gPlayerParty[0]); @@ -5456,7 +5456,7 @@ static bool8 TryGetRandomWildMonIndexByType(const struct WildPokemon *wildMon, u static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, u8 type, u8 ability, u8 *monIndex) { - if (GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3)) + if (GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)) return FALSE; else if (GetMonAbility(&gPlayerParty[0]) != ability) return FALSE; diff --git a/sym_ewram.txt b/sym_ewram.txt index f3f654234..57b140a14 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -237,7 +237,7 @@ gUnknown_02039D12: @ 2039D12 gUnknown_02039D14: @ 2039D14 .space 0x64 -sBoxCursorAction: @ 2039D78 +sBoxCursorArea: @ 2039D78 .space 0x1 sBoxCursorPosition: @ 2039D79