diff --git a/asm/contest.s b/asm/contest.s index 35dbaf385..a9abd9430 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -1657,7 +1657,7 @@ _080DC506: lsls r0, r5, 3 ldr r1, =gUnknown_08587AE8 adds r0, r1 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet ldr r0, =gSpriteTemplate_8587B18 adds r0, r6, r0 ldr r2, =gUnknown_08587A70 @@ -1713,7 +1713,7 @@ _080DC506: sub_80DC594: @ 80DC594 push {lr} ldr r0, =gUnknown_08587BB0 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet ldr r0, =gUnknown_08587BB8 bl LoadSpritePalette ldr r0, =gSpriteTemplate_8587BC8 @@ -2286,7 +2286,7 @@ sub_80DC9EC: @ 80DC9EC lsls r4, r1, 3 ldr r0, =gUnknown_08589904 adds r0, r4, r0 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet ldr r0, =gUnknown_08589924 adds r4, r0 adds r0, r4, 0 diff --git a/asm/contest_link_80F57C4.s b/asm/contest_link_80F57C4.s index 3e35ab7f1..b869adf1b 100644 --- a/asm/contest_link_80F57C4.s +++ b/asm/contest_link_80F57C4.s @@ -1417,7 +1417,7 @@ _080F64F2: adds r2, r4, 0 bl GetMonSpritePalStructFromOtIdPersonality adds r4, r0, 0 - bl LoadCompressedObjectPalette + bl LoadCompressedSpritePalette adds r0, r6, 0 movs r1, 0x1 bl SetMultiuseSpriteTemplateToPokemon @@ -1451,9 +1451,9 @@ _080F64F2: ldr r1, [r1] strb r0, [r1, 0x8] ldr r0, =gUnknown_0858D878 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet ldr r0, =gUnknown_0858D880 - bl LoadCompressedObjectPalette + bl LoadCompressedSpritePalette ldr r0, =sub_80F7670 movs r1, 0xA bl CreateTask @@ -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/easy_chat.s b/asm/easy_chat.s index 70786ab65..f6f09a87e 100644 --- a/asm/easy_chat.s +++ b/asm/easy_chat.s @@ -6455,7 +6455,7 @@ sub_811DE90: @ 811DE90 ldr r4, =gUnknown_08597CE8 _0811DEA2: adds r0, r4, 0 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet adds r4, 0x8 adds r5, 0x1 cmp r5, 0x3 diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s deleted file mode 100644 index 3fefdd530..000000000 --- a/asm/pokemon_storage_system.s +++ /dev/null @@ -1,20963 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - - - - thumb_func_start sub_80C7D74 -sub_80C7D74: @ 80C7D74 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - bl ResetTasks - ldr r0, =gUnknown_02039D0D - strb r5, [r0] - ldr r4, =gUnknown_02039D08 - ldr r0, =0x000062c4 - bl Alloc - str r0, [r4] - cmp r0, 0 - bne _080C7DA8 - ldr r0, =sub_80C7678 - bl SetMainCallback2 - b _080C7DD4 - .pool -_080C7DA8: - movs r2, 0 - strb r5, [r0, 0x1] - ldr r0, [r4] - strb r2, [r0, 0x3] - ldr r0, =gUnknown_02039D12 - movs r1, 0 - strh r2, [r0] - ldr r0, [r4] - strb r1, [r0] - ldr r0, =task_box_related_3 - movs r1, 0x3 - bl CreateTask - ldr r1, [r4] - strb r0, [r1, 0x4] - bl StorageGetCurrentBox - ldr r1, =gUnknown_02039D10 - strb r0, [r1] - ldr r0, =c2_Box - bl SetMainCallback2 -_080C7DD4: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C7D74 - - thumb_func_start c2_808CE60 -c2_808CE60: @ 80C7DEC - push {r4,lr} - bl ResetTasks - ldr r4, =gUnknown_02039D08 - ldr r0, =0x000062c4 - bl Alloc - adds r1, r0, 0 - str r1, [r4] - cmp r1, 0 - bne _080C7E18 - ldr r0, =sub_80C7678 - bl SetMainCallback2 - b _080C7E3C - .pool -_080C7E18: - ldr r0, =gUnknown_02039D0D - ldrb r0, [r0] - movs r2, 0 - strb r0, [r1, 0x1] - ldr r1, [r4] - movs r0, 0x1 - strb r0, [r1, 0x3] - ldr r0, [r4] - strb r2, [r0] - ldr r0, =task_box_related_3 - movs r1, 0x3 - bl CreateTask - ldr r1, [r4] - strb r0, [r1, 0x4] - ldr r0, =c2_Box - bl SetMainCallback2 -_080C7E3C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end c2_808CE60 - - thumb_func_start sub_80C7E50 -sub_80C7E50: @ 80C7E50 - push {lr} - movs r0, 0x10 - movs r1, 0 - bl SetGpuReg - movs r0, 0x12 - movs r1, 0 - bl SetGpuReg - movs r0, 0x14 - movs r1, 0 - bl SetGpuReg - movs r0, 0x16 - movs r1, 0 - bl SetGpuReg - movs r0, 0x18 - movs r1, 0 - bl SetGpuReg - movs r0, 0x1A - movs r1, 0 - bl SetGpuReg - movs r0, 0x1C - movs r1, 0 - bl SetGpuReg - movs r0, 0x1E - movs r1, 0 - bl SetGpuReg - pop {r0} - bx r0 - thumb_func_end sub_80C7E50 - - thumb_func_start sub_80C7E98 -sub_80C7E98: @ 80C7E98 - push {r4,lr} - sub sp, 0x4 - bl ResetPaletteFade - bl ResetSpriteData - bl FreeSpriteTileRanges - bl FreeAllSpritePalettes - bl ClearDma3Requests - ldr r1, =gReservedSpriteTileCount - movs r2, 0xA0 - lsls r2, 2 - adds r0, r2, 0 - strh r0, [r1] - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x8 - adds r1, 0x10 - movs r2, 0x8 - bl sub_80D2A90 - ldr r1, =gKeyRepeatStartDelay - movs r0, 0x14 - strh r0, [r1] - bl clear_scheduled_bg_copies_to_vram - movs r0, 0x3 - bl sub_80D259C - ldr r2, =gUnknown_0857239C - movs r0, 0x4 - str r0, [sp] - movs r0, 0 - movs r1, 0x1 - movs r3, 0x8 - bl sub_80D2644 - movs r0, 0 - movs r1, 0x1 - movs r2, 0 - bl sub_80D2770 - ldr r0, [r4] - ldr r1, =0x000002c7 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C7E98 - - thumb_func_start sub_80C7F1C -sub_80C7F1C: @ 80C7F1C - push {lr} - bl sub_80CDC0C - ldr r2, =gUnknown_02039D0C - movs r1, 0 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x1 - bne _080C7F32 - movs r1, 0x1 -_080C7F32: - strb r1, [r2] - ldr r1, =gUnknown_02039D0E - movs r0, 0 - strb r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C7F1C - - thumb_func_start sub_80C7F4C -sub_80C7F4C: @ 80C7F4C - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080C7F6A - movs r1, 0xFC - lsls r1, 6 - movs r0, 0x50 - bl SetGpuReg - ldr r1, =0x00000b07 - movs r0, 0x52 - bl SetGpuReg -_080C7F6A: - movs r1, 0xFA - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C7F4C - - thumb_func_start add_to_c3_somehow -add_to_c3_somehow: @ 80C7F80 - push {r4,lr} - ldr r4, =gTasks - ldr r1, =gUnknown_02039D08 - ldr r3, [r1] - ldrb r2, [r3, 0x4] - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r4 - str r0, [r1] - movs r0, 0 - strb r0, [r3] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end add_to_c3_somehow - - thumb_func_start task_box_related_3 -task_box_related_3: @ 80C7FA8 - push {lr} - sub sp, 0x4 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0xA - bls _080C7FB8 - b _080C81A2 -_080C7FB8: - lsls r0, 2 - ldr r1, =_080C7FCC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C7FCC: - .4byte _080C7FF8 - .4byte _080C8050 - .4byte _080C805E - .4byte _080C808C - .4byte _080C80A8 - .4byte _080C80C6 - .4byte _080C80E6 - .4byte _080C80EC - .4byte _080C80F2 - .4byte _080C8100 - .4byte _080C814A -_080C7FF8: - movs r0, 0 - bl SetVBlankCallback - movs r0, 0 - movs r1, 0 - bl SetGpuReg - bl sub_80C7E98 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x3] - cmp r0, 0 - beq _080C8046 - ldr r0, =gUnknown_02039D0F - ldrb r0, [r0] - cmp r0, 0x1 - beq _080C8036 - cmp r0, 0x1 - bgt _080C8030 - cmp r0, 0 - beq _080C803C - b _080C8046 - .pool -_080C8030: - cmp r0, 0x2 - beq _080C8042 - b _080C8046 -_080C8036: - bl sub_80CE790 - b _080C8046 -_080C803C: - bl sub_80CE8E4 - b _080C8046 -_080C8042: - bl sub_80C9F6C -_080C8046: - bl sub_80CA044 - bl sub_80CA0C8 - b _080C8198 -_080C8050: - bl sub_80CA0A4 - lsls r0, 24 - cmp r0, 0 - beq _080C805C - b _080C8198 -_080C805C: - b _080C80D0 -_080C805E: - movs r0, 0 - bl PutWindowTilemap - movs r0, 0x1 - bl ClearWindowTilemap - movs r0, 0 - str r0, [sp] - movs r1, 0xC0 - lsls r1, 19 - ldr r2, =0x05000080 - mov r0, sp - bl CpuSet - movs r0, 0x1 - movs r1, 0xB - movs r2, 0xE0 - bl LoadUserWindowBorderGfx - b _080C8198 - .pool -_080C808C: - bl sub_80C7E50 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x3] - cmp r0, 0 - beq _080C809C - b _080C8198 -_080C809C: - bl sub_80C7F1C - b _080C8198 - .pool -_080C80A8: - bl sub_80CAF04 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x3] - cmp r0, 0 - bne _080C80C0 - bl sub_80CD36C - b _080C8198 - .pool -_080C80C0: - bl sub_80CD3EC - b _080C8198 -_080C80C6: - bl sub_80D0164 - lsls r0, 24 - cmp r0, 0 - bne _080C80DC -_080C80D0: - ldr r0, =sub_80C9E50 - bl add_to_c3_somehow - b _080C81A2 - .pool -_080C80DC: - bl sub_80C9FEC - bl sub_80CAC1C - b _080C8198 -_080C80E6: - bl sub_80CA0D8 - b _080C8198 -_080C80EC: - bl sub_80CA704 - b _080C8198 -_080C80F2: - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - bl sub_80CC32C - b _080C8198 -_080C8100: - bl sub_80CC35C - lsls r0, 24 - cmp r0, 0 - bne _080C81A2 - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - ldrb r0, [r2, 0x1] - cmp r0, 0x3 - beq _080C8140 - ldr r1, =0x00000da4 - adds r0, r2, r1 - movs r1, 0xD - strh r1, [r0] - ldr r1, =0x00000da6 - adds r2, r1 - ldr r1, =0x0000dace - strh r1, [r2] - bl sub_811F90C - bl sub_811FA90 - b _080C8198 - .pool -_080C8140: - bl sub_80D0C60 - bl sub_80CAEAC - b _080C8198 -_080C814A: - bl sub_80C7F4C - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x3] - cmp r0, 0 - bne _080C8174 - movs r0, 0x1 - negs r0, r0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - ldr r0, =sub_80C81AC - bl add_to_c3_somehow - b _080C8186 - .pool -_080C8174: - movs r0, 0x1 - negs r0, r0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - ldr r0, =box_related_2 - bl add_to_c3_somehow -_080C8186: - ldr r0, =sub_80C7D28 - bl SetVBlankCallback - b _080C81A2 - .pool -_080C8198: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080C81A2: - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end task_box_related_3 - - thumb_func_start sub_80C81AC -sub_80C81AC: @ 80C81AC - push {r4,lr} - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldrb r0, [r0] - cmp r0, 0 - beq _080C81C4 - cmp r0, 0x1 - beq _080C81DE - b _080C81EE - .pool -_080C81C4: - movs r0, 0x2 - bl PlaySE - movs r0, 0x14 - movs r1, 0 - movs r2, 0x1 - bl sub_80F9BCC - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C81EE -_080C81DE: - bl sub_80F9C1C - lsls r0, 24 - cmp r0, 0 - bne _080C81EE - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow -_080C81EE: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C81AC - - thumb_func_start box_related_2 -box_related_2: @ 80C81F8 - push {r4,lr} - sub sp, 0x4 - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldrb r0, [r0] - cmp r0, 0x1 - beq _080C8230 - cmp r0, 0x1 - bgt _080C8214 - cmp r0, 0 - beq _080C821E - b _080C82A0 - .pool -_080C8214: - cmp r0, 0x2 - beq _080C8268 - cmp r0, 0x3 - beq _080C8290 - b _080C82A0 -_080C821E: - movs r1, 0x1 - negs r1, r1 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - b _080C8282 -_080C8230: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _080C82A0 - ldr r0, =gUnknown_02039D0F - ldrb r0, [r0] - cmp r0, 0x2 - bne _080C825C - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - cmp r0, 0 - beq _080C825C - movs r0, 0x1C - bl sub_80CAC58 - b _080C8282 - .pool -_080C825C: - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow - b _080C82A0 - .pool -_080C8268: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _080C82A0 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _080C82A0 - bl sub_80CADC4 -_080C8282: - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C82A0 - .pool -_080C8290: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _080C82A0 - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow -_080C82A0: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end box_related_2 - - thumb_func_start task_pokemon_box_related -task_pokemon_box_related: @ 80C82AC - push {r4,r5,lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0xB - bls _080C82BA - b _080C879E -_080C82BA: - lsls r0, 2 - ldr r1, =_080C82CC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C82CC: - .4byte _080C82FC - .4byte _080C861C - .4byte _080C865C - .4byte _080C86B4 - .4byte _080C86D8 - .4byte _080C86E2 - .4byte _080C86FC - .4byte _080C871C - .4byte _080C8722 - .4byte _080C8738 - .4byte _080C8764 - .4byte _080C878C -_080C82FC: - bl sub_80CF9EC - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x1 - cmp r0, 0x19 - bls _080C830C - b _080C879E -_080C830C: - lsls r0, 2 - ldr r1, =_080C831C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C831C: - .4byte _080C8384 - .4byte _080C879E - .4byte _080C879E - .4byte _080C8414 - .4byte _080C8398 - .4byte _080C83CC - .4byte _080C842C - .4byte _080C8440 - .4byte _080C844C - .4byte _080C8484 - .4byte _080C84C8 - .4byte _080C854C - .4byte _080C850C - .4byte _080C851E - .4byte _080C8560 - .4byte _080C8574 - .4byte _080C8588 - .4byte _080C859C - .4byte _080C8420 - .4byte _080C85B0 - .4byte _080C85D0 - .4byte _080C85BA - .4byte _080C85DA - .4byte _080C8614 - .4byte _080C85DE - .4byte _080C85F8 -_080C8384: - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x1 - strb r0, [r1] - b _080C879E - .pool -_080C8398: - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldrb r0, [r0, 0x1] - subs r0, 0x2 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bls _080C83BC - movs r0, 0x10 - bl sub_80CAC58 - ldr r1, [r4] - movs r0, 0x3 - strb r0, [r1] - b _080C879E - .pool -_080C83BC: - bl sub_80CDC0C - ldr r0, =sub_80C87A8 - bl add_to_c3_somehow - b _080C879E - .pool -_080C83CC: - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldrb r0, [r0, 0x1] - cmp r0, 0x2 - bne _080C8400 - bl sub_80CEAD0 - lsls r0, 24 - cmp r0, 0 - beq _080C8406 - ldr r0, [r4] - ldr r1, =0x00000ce6 - adds r0, r1 - ldrh r0, [r0] - bl ItemIsMail - lsls r0, 24 - cmp r0, 0 - beq _080C83F4 - b _080C84E6 -_080C83F4: - b _080C8406 - .pool -_080C8400: - cmp r0, 0x3 - beq _080C8406 - b _080C879E -_080C8406: - ldr r0, =sub_80C87E8 - bl add_to_c3_somehow - b _080C879E - .pool -_080C8414: - ldr r0, =sub_80C9BE8 - bl add_to_c3_somehow - b _080C879E - .pool -_080C8420: - ldr r0, =sub_80C9D1C - bl add_to_c3_somehow - b _080C879E - .pool -_080C842C: - movs r0, 0x5 - bl PlaySE - ldr r0, =box_related - bl add_to_c3_somehow - b _080C879E - .pool -_080C8440: - ldr r0, =sub_80C8864 - bl add_to_c3_somehow - b _080C879E - .pool -_080C844C: - movs r0, 0x5 - bl PlaySE - bl StorageGetCurrentBox - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - lsls r0, 24 - lsrs r0, 24 - adds r0, 0x1 - ldr r2, =0x000002ca - adds r1, r2 - strh r0, [r1] - cmp r0, 0xD - ble _080C846E - movs r0, 0 - strh r0, [r1] -_080C846E: - ldr r1, [r4] - ldrb r0, [r1, 0x1] - cmp r0, 0x3 - beq _080C84BC - adds r0, r1, r2 - b _080C8776 - .pool -_080C8484: - movs r0, 0x5 - bl PlaySE - bl StorageGetCurrentBox - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x1 - ldr r2, =0x000002ca - adds r1, r2 - strh r0, [r1] - cmp r0, 0 - bge _080C84A6 - movs r0, 0xD - strh r0, [r1] -_080C84A6: - ldr r1, [r4] - ldrb r0, [r1, 0x1] - cmp r0, 0x3 - beq _080C84BC - adds r0, r1, r2 - b _080C8776 - .pool -_080C84BC: - bl sub_80CFEA8 - ldr r1, [r4] - movs r0, 0xA - strb r0, [r1] - b _080C879E -_080C84C8: - bl sub_80CEA30 - lsls r0, 24 - cmp r0, 0 - bne _080C8528 - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r1, =0x00000ce6 - adds r0, r1 - ldrh r0, [r0] - bl ItemIsMail - lsls r0, 24 - cmp r0, 0 - beq _080C84F8 -_080C84E6: - ldr r1, [r4] - movs r0, 0x5 - strb r0, [r1] - b _080C879E - .pool -_080C84F8: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C8D78 - bl add_to_c3_somehow - b _080C879E - .pool -_080C850C: - bl sub_80CEA30 - lsls r0, 24 - cmp r0, 0 - bne _080C8528 - movs r0, 0x5 - bl PlaySE - b _080C872C -_080C851E: - bl sub_80CEA6C - lsls r0, 24 - cmp r0, 0 - bne _080C8538 -_080C8528: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x4 - strb r0, [r1] - b _080C879E - .pool -_080C8538: - movs r0, 0x5 - bl PlaySE - ldr r0, =c3_0808DC50 - bl add_to_c3_somehow - b _080C879E - .pool -_080C854C: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C8C90 - bl add_to_c3_somehow - b _080C879E - .pool -_080C8560: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C8BEC - bl add_to_c3_somehow - b _080C879E - .pool -_080C8574: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C9128 - bl add_to_c3_somehow - b _080C879E - .pool -_080C8588: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C91DC - bl add_to_c3_somehow - b _080C879E - .pool -_080C859C: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C93B0 - bl add_to_c3_somehow - b _080C879E - .pool -_080C85B0: - movs r0, 0x5 - bl PlaySE - movs r0, 0 - b _080C8600 -_080C85BA: - movs r0, 0x1 - bl sub_80D01D0 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x8 - strb r0, [r1] - b _080C879E - .pool -_080C85D0: - movs r0, 0x5 - bl PlaySE - movs r0, 0x2 - b _080C85E6 -_080C85DA: - movs r0, 0x3 - b _080C8600 -_080C85DE: - movs r0, 0x5 - bl PlaySE - movs r0, 0x4 -_080C85E6: - bl sub_80D01D0 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x9 - strb r0, [r1] - b _080C879E - .pool -_080C85F8: - movs r0, 0x5 - bl PlaySE - movs r0, 0x5 -_080C8600: - bl sub_80D01D0 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x7 - strb r0, [r1] - b _080C879E - .pool -_080C8614: - movs r0, 0x20 - bl PlaySE - b _080C879E -_080C861C: - bl sub_80CD554 - lsls r0, 24 - cmp r0, 0 - beq _080C8628 - b _080C879E -_080C8628: - bl sub_80CEAF8 - lsls r0, 24 - cmp r0, 0 - beq _080C8638 - bl sub_80CA9C0 - b _080C863C -_080C8638: - bl sub_80CA9EC -_080C863C: - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r1, =0x00000cea - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080C864E - bl BoxSetMosaic -_080C864E: - ldr r1, [r4] - b _080C86C8 - .pool -_080C865C: - bl sub_80CC54C - lsls r0, 24 - cmp r0, 0 - beq _080C8668 - b _080C879E -_080C8668: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x000002ca - adds r0, r1 - ldrb r0, [r0] - bl SetCurrentBox - ldr r0, =gUnknown_02039D0C - ldrb r0, [r0] - cmp r0, 0 - bne _080C8690 - bl sub_80CEAD0 - lsls r0, 24 - cmp r0, 0 - bne _080C8690 - bl sub_80CE00C - bl BoxSetMosaic -_080C8690: - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - ldrb r0, [r1, 0x1] - cmp r0, 0x3 - bne _080C86C8 - bl sub_80CFECC - ldr r1, [r4] - movs r0, 0xB - strb r0, [r1] - b _080C879E - .pool -_080C86B4: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _080C879E - bl sub_80CADC4 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] -_080C86C8: - movs r0, 0 - strb r0, [r1] - b _080C879E - .pool -_080C86D8: - movs r0, 0x20 - bl PlaySE - movs r0, 0xD - b _080C86EA -_080C86E2: - movs r0, 0x20 - bl PlaySE - movs r0, 0x16 -_080C86EA: - bl sub_80CAC58 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x6 - strb r0, [r1] - b _080C879E - .pool -_080C86FC: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _080C879E - bl sub_80CADC4 - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow - b _080C879E - .pool -_080C871C: - bl sub_80D01E4 - b _080C8790 -_080C8722: - bl sub_80D01E4 - lsls r0, 24 - cmp r0, 0 - bne _080C879E -_080C872C: - ldr r0, =sub_80C8B90 - bl add_to_c3_somehow - b _080C879E - .pool -_080C8738: - bl sub_80D01E4 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _080C879E - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - ldr r1, =0x00000cea - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080C8756 - bl BoxSetMosaic -_080C8756: - ldr r0, [r5] - strb r4, [r0] - b _080C879E - .pool -_080C8764: - bl sub_80D1218 - lsls r0, 24 - cmp r0, 0 - bne _080C879E - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r1, =0x000002ca - adds r0, r1 -_080C8776: - ldrb r0, [r0] - bl sub_80CC464 - ldr r1, [r4] - movs r0, 0x2 - strb r0, [r1] - b _080C879E - .pool -_080C878C: - bl sub_80D1218 -_080C8790: - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _080C879E - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - strb r1, [r0] -_080C879E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end task_pokemon_box_related - - thumb_func_start sub_80C87A8 -sub_80C87A8: @ 80C87A8 - push {r4,lr} - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldrb r0, [r0] - cmp r0, 0 - beq _080C87C0 - cmp r0, 0x1 - beq _080C87CE - b _080C87DE - .pool -_080C87C0: - bl sub_80CAB4C - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C87DE -_080C87CE: - bl sub_80CAB70 - lsls r0, 24 - cmp r0, 0 - bne _080C87DE - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow -_080C87DE: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C87A8 - - thumb_func_start sub_80C87E8 -sub_80C87E8: @ 80C87E8 - push {r4,lr} - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldrb r0, [r0] - cmp r0, 0x1 - beq _080C8816 - cmp r0, 0x1 - bgt _080C8804 - cmp r0, 0 - beq _080C880A - b _080C8856 - .pool -_080C8804: - cmp r0, 0x2 - beq _080C8836 - b _080C8856 -_080C880A: - movs r0, 0x5 - bl PlaySE - bl sub_80CA888 - b _080C882C -_080C8816: - bl sub_80CA8C8 - lsls r0, 24 - cmp r0, 0 - bne _080C8856 - bl sub_80CDC2C - lsls r0, 24 - lsrs r0, 24 - bl sub_80CDBF8 -_080C882C: - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C8856 -_080C8836: - bl sub_80CD554 - lsls r0, 24 - cmp r0, 0 - bne _080C8856 - ldr r0, [r4] - ldr r1, =0x00000cea - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080C8850 - bl BoxSetMosaic -_080C8850: - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow -_080C8856: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C87E8 - - thumb_func_start sub_80C8864 -sub_80C8864: @ 80C8864 - push {r4,lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x6 - bls _080C8872 - b _080C8B82 -_080C8872: - lsls r0, 2 - ldr r1, =_080C8884 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C8884: - .4byte _080C88A0 - .4byte _080C8904 - .4byte _080C8920 - .4byte _080C8B3C - .4byte _080C8B50 - .4byte _080C8B46 - .4byte _080C8B6C -_080C88A0: - bl sub_80CA2B8 - lsls r0, 24 - cmp r0, 0 - beq _080C88AC - b _080C8B82 -_080C88AC: - movs r0, 0x5 - bl PlaySE - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - beq _080C88C8 - movs r0, 0x4 - bl sub_80CAC58 - b _080C88F2 - .pool -_080C88C8: - bl sub_80D127C - lsls r0, 24 - cmp r0, 0 - bne _080C88DE - ldr r0, [r4] - ldr r1, =0x00000ce6 - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0 - beq _080C88EC -_080C88DE: - movs r0, 0x17 - bl sub_80CAC58 - b _080C88F2 - .pool -_080C88EC: - movs r0, 0x18 - bl sub_80CAC58 -_080C88F2: - bl sub_80CFFD0 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x1 - strb r0, [r1] - b _080C8B82 - .pool -_080C8904: - bl sub_80D00A8 - lsls r0, 24 - cmp r0, 0 - beq _080C8910 - b _080C8B82 -_080C8910: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x2 - strb r0, [r1] - b _080C8B82 - .pool -_080C8920: - bl sub_80D00AC - adds r0, 0x1 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x12 - bls _080C8930 - b _080C8B82 -_080C8930: - lsls r0, 2 - ldr r1, =_080C8940 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C8940: - .4byte _080C898C - .4byte _080C898C - .4byte _080C8A0C - .4byte _080C89F4 - .4byte _080C899C - .4byte _080C89D4 - .4byte _080C89BC - .4byte _080C8AAC - .4byte _080C8A48 - .4byte _080C8AC0 - .4byte _080C8B82 - .4byte _080C8B82 - .4byte _080C8B82 - .4byte _080C8AD4 - .4byte _080C8AE8 - .4byte _080C8B1C - .4byte _080C8B08 - .4byte _080C8AFC - .4byte _080C8B30 -_080C898C: - bl sub_80CADC4 - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow - b _080C8B82 - .pool -_080C899C: - bl sub_80CEA30 - lsls r0, 24 - cmp r0, 0 - bne _080C8A52 - movs r0, 0x5 - bl PlaySE - bl sub_80CADC4 - ldr r0, =sub_80C8B90 - bl add_to_c3_somehow - b _080C8B82 - .pool -_080C89BC: - movs r0, 0x5 - bl PlaySE - bl sub_80CADC4 - ldr r0, =sub_80C8BEC - bl add_to_c3_somehow - b _080C8B82 - .pool -_080C89D4: - bl sub_80CEA6C - lsls r0, 24 - cmp r0, 0 - beq _080C8A52 - movs r0, 0x5 - bl PlaySE - bl sub_80CADC4 - ldr r0, =c3_0808DC50 - bl add_to_c3_somehow - b _080C8B82 - .pool -_080C89F4: - movs r0, 0x5 - bl PlaySE - bl sub_80CADC4 - ldr r0, =sub_80C8C90 - bl add_to_c3_somehow - b _080C8B82 - .pool -_080C8A0C: - bl sub_80CEA30 - lsls r0, 24 - cmp r0, 0 - bne _080C8A52 - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r2, =0x00000ce6 - adds r0, r2 - ldrh r0, [r0] - bl ItemIsMail - lsls r0, 24 - cmp r0, 0 - bne _080C8A8C - movs r0, 0x5 - bl PlaySE - bl sub_80CADC4 - ldr r0, =sub_80C8D78 - bl add_to_c3_somehow - b _080C8B82 - .pool -_080C8A48: - bl sub_80CEA30 - lsls r0, 24 - cmp r0, 0 - beq _080C8A60 -_080C8A52: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x3 - strb r0, [r1] - b _080C8B82 - .pool -_080C8A60: - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - ldr r2, =0x00000ced - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080C8A7C - movs r0, 0x5 - strb r0, [r1] - b _080C8B82 - .pool -_080C8A7C: - ldr r2, =0x00000ce6 - adds r0, r1, r2 - ldrh r0, [r0] - bl ItemIsMail - lsls r0, 24 - cmp r0, 0 - beq _080C8A98 -_080C8A8C: - ldr r1, [r4] - movs r0, 0x4 - strb r0, [r1] - b _080C8B82 - .pool -_080C8A98: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C8EB4 - bl add_to_c3_somehow - b _080C8B82 - .pool -_080C8AAC: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C9B28 - bl add_to_c3_somehow - b _080C8B82 - .pool -_080C8AC0: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C90A4 - bl add_to_c3_somehow - b _080C8B82 - .pool -_080C8AD4: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C9128 - bl add_to_c3_somehow - b _080C8B82 - .pool -_080C8AE8: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C91DC - bl add_to_c3_somehow - b _080C8B82 - .pool -_080C8AFC: - ldr r0, =sub_80C9298 - bl add_to_c3_somehow - b _080C8B82 - .pool -_080C8B08: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C93B0 - bl add_to_c3_somehow - b _080C8B82 - .pool -_080C8B1C: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C9B88 - bl add_to_c3_somehow - b _080C8B82 - .pool -_080C8B30: - ldr r0, =sub_80C9498 - bl add_to_c3_somehow - b _080C8B82 - .pool -_080C8B3C: - movs r0, 0x20 - bl PlaySE - movs r0, 0xD - b _080C8B58 -_080C8B46: - movs r0, 0x20 - bl PlaySE - movs r0, 0x11 - b _080C8B58 -_080C8B50: - movs r0, 0x20 - bl PlaySE - movs r0, 0x16 -_080C8B58: - bl sub_80CAC58 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x6 - strb r0, [r1] - b _080C8B82 - .pool -_080C8B6C: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _080C8B82 - bl sub_80CADC4 - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow -_080C8B82: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C8864 - - thumb_func_start sub_80C8B90 -sub_80C8B90: @ 80C8B90 - push {r4,lr} - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldrb r0, [r0] - cmp r0, 0 - beq _080C8BA8 - cmp r0, 0x1 - beq _080C8BB8 - b _080C8BE2 - .pool -_080C8BA8: - movs r0, 0 - bl sub_80CDC38 - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C8BE2 -_080C8BB8: - bl sub_80CDCAC - lsls r0, 24 - cmp r0, 0 - bne _080C8BE2 - ldr r0, =gUnknown_02039D0C - ldrb r0, [r0] - cmp r0, 0 - beq _080C8BDC - ldr r0, =sub_80C9670 - bl add_to_c3_somehow - b _080C8BE2 - .pool -_080C8BDC: - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow -_080C8BE2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C8B90 - - thumb_func_start sub_80C8BEC -sub_80C8BEC: @ 80C8BEC - push {r4,lr} - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldrb r0, [r0] - cmp r0, 0 - beq _080C8C04 - cmp r0, 0x1 - beq _080C8C14 - b _080C8C3E - .pool -_080C8C04: - movs r0, 0x1 - bl sub_80CDC38 - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C8C3E -_080C8C14: - bl sub_80CDCAC - lsls r0, 24 - cmp r0, 0 - bne _080C8C3E - ldr r0, =gUnknown_02039D0C - ldrb r0, [r0] - cmp r0, 0 - beq _080C8C38 - ldr r0, =sub_80C9670 - bl add_to_c3_somehow - b _080C8C3E - .pool -_080C8C38: - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow -_080C8C3E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C8BEC - - thumb_func_start c3_0808DC50 -c3_0808DC50: @ 80C8C48 - push {r4,lr} - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldrb r0, [r0] - cmp r0, 0 - beq _080C8C60 - cmp r0, 0x1 - beq _080C8C70 - b _080C8C84 - .pool -_080C8C60: - movs r0, 0x2 - bl sub_80CDC38 - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C8C84 -_080C8C70: - bl sub_80CDCAC - lsls r0, 24 - cmp r0, 0 - bne _080C8C84 - bl BoxSetMosaic - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow -_080C8C84: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end c3_0808DC50 - - thumb_func_start sub_80C8C90 -sub_80C8C90: @ 80C8C90 - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x5 - bhi _080C8D6E - lsls r0, 2 - ldr r1, =_080C8CB0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C8CB0: - .4byte _080C8CC8 - .4byte _080C8D00 - .4byte _080C8D20 - .4byte _080C8D36 - .4byte _080C8D48 - .4byte _080C8D68 -_080C8CC8: - bl CalculatePlayerPartyCount - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x6 - bne _080C8CE8 - movs r0, 0xE - bl sub_80CAC58 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x1 - strb r0, [r1] - b _080C8D6E - .pool -_080C8CE8: - bl sub_80CDC18 - movs r0, 0 - bl sub_80CDC38 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x2 - strb r0, [r1] - b _080C8D6E - .pool -_080C8D00: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _080C8D6E - bl sub_80CADC4 - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow - b _080C8D6E - .pool -_080C8D20: - bl sub_80CDCAC - lsls r0, 24 - cmp r0, 0 - bne _080C8D6E - movs r0, 0x1 - bl sub_80CC0D4 - bl sub_80CAB4C - b _080C8D56 -_080C8D36: - bl sub_80CAB70 - lsls r0, 24 - cmp r0, 0 - bne _080C8D6E - movs r0, 0x1 - bl sub_80CDC38 - b _080C8D56 -_080C8D48: - bl sub_80CDCAC - lsls r0, 24 - cmp r0, 0 - bne _080C8D6E - bl sub_80CAB20 -_080C8D56: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C8D6E - .pool -_080C8D68: - ldr r0, =sub_80C87E8 - bl add_to_c3_somehow -_080C8D6E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C8C90 - - thumb_func_start sub_80C8D78 -sub_80C8D78: @ 80C8D78 - push {r4,lr} - sub sp, 0x4 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x4 - bls _080C8D88 - b _080C8EA2 -_080C8D88: - lsls r0, 2 - ldr r1, =_080C8D9C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C8D9C: - .4byte _080C8DB0 - .4byte _080C8DEC - .4byte _080C8E4C - .4byte _080C8E64 - .4byte _080C8E88 -_080C8DB0: - movs r0, 0x6 - bl sub_80CAC58 - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r1, =0x00001e5c - adds r0, r1 - ldr r2, =0x0000dac7 - movs r1, 0 - str r1, [sp] - movs r1, 0xA - movs r3, 0x3 - bl sub_80C77E8 - ldr r0, =gUnknown_02039D0E - ldrb r0, [r0] - bl sub_80C78D4 - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - b _080C8EA0 - .pool -_080C8DEC: - bl sub_80C78F0 - lsls r0, 24 - lsrs r0, 24 - adds r4, r0, 0 - cmp r0, 0xC8 - beq _080C8EA2 - cmp r0, 0xC9 - bne _080C8E0C - bl sub_80CADC4 - bl sub_80C78E4 - bl sub_80C7890 - b _080C8E7A -_080C8E0C: - adds r0, r4, 0 - bl sub_80CE19C - lsls r0, 24 - cmp r0, 0 - beq _080C8E38 - ldr r0, =gUnknown_02039D0E - strb r4, [r0] - bl sub_80CADC4 - bl sub_80C78E4 - bl sub_80C7890 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x2 - b _080C8EA0 - .pool -_080C8E38: - movs r0, 0x8 - bl sub_80CAC58 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x4 - b _080C8EA0 - .pool -_080C8E4C: - bl CompactPartySlots - bl sub_80CB950 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - b _080C8EA0 - .pool -_080C8E64: - bl sub_80CB9BC - lsls r0, 24 - cmp r0, 0 - bne _080C8EA2 - bl sub_80CE22C - bl BoxSetMosaic - bl sub_80CAB20 -_080C8E7A: - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow - b _080C8EA2 - .pool -_080C8E88: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _080C8EA2 - movs r0, 0x6 - bl sub_80CAC58 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x1 -_080C8EA0: - strb r0, [r1] -_080C8EA2: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C8D78 - - thumb_func_start sub_80C8EB4 -sub_80C8EB4: @ 80C8EB4 - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0xD - bls _080C8EC2 - b _080C9096 -_080C8EC2: - lsls r0, 2 - ldr r1, =_080C8ED4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C8ED4: - .4byte _080C8F0C - .4byte _080C8F22 - .4byte _080C8F5A - .4byte _080C8F80 - .4byte _080C8F8C - .4byte _080C8FA4 - .4byte _080C8FE0 - .4byte _080C8FF8 - .4byte _080C9004 - .4byte _080C9008 - .4byte _080C901C - .4byte _080C9038 - .4byte _080C904A - .4byte _080C9080 -_080C8F0C: - movs r0, 0x9 - bl sub_80CAC58 - movs r0, 0x1 - bl sub_80CAD9C - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080C8F22: - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _080C8F4C - cmp r1, 0 - bgt _080C8F40 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _080C8F46 - b _080C9096 - .pool -_080C8F40: - cmp r1, 0x1 - beq _080C8F46 - b _080C9096 -_080C8F46: - bl sub_80CADC4 - b _080C8FF8 -_080C8F4C: - bl sub_80CADC4 - bl sub_80CE3A0 - bl sub_80CE250 - b _080C905C -_080C8F5A: - bl sub_80CE580 - bl sub_80CE2A8 - lsls r0, 24 - cmp r0, 0 - beq _080C8F6A - b _080C9096 -_080C8F6A: - b _080C8F72 -_080C8F6C: - cmp r0, 0 - bne _080C8F72 - b _080C9070 -_080C8F72: - bl sub_80CE580 - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - bne _080C8F6C - b _080C905C -_080C8F80: - bl sub_80CE2D8 - bl sub_80CA230 - movs r0, 0xA - b _080C9058 -_080C8F8C: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - bne _080C8F9A - b _080C9096 -_080C8F9A: - movs r0, 0xB - b _080C9058 - .pool -_080C8FA4: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _080C9096 - bl sub_80CADC4 - ldr r0, =gUnknown_02039D0C - ldrb r0, [r0] - cmp r0, 0 - beq _080C8FD0 - bl CompactPartySlots - bl sub_80CB950 - b _080C905C - .pool -_080C8FD0: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x7 - strb r0, [r1] - b _080C9096 - .pool -_080C8FE0: - bl sub_80CB9BC - lsls r0, 24 - cmp r0, 0 - bne _080C9096 - bl sub_80CE00C - bl BoxSetMosaic - bl sub_80CAB20 - b _080C905C -_080C8FF8: - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow - b _080C9096 - .pool -_080C9004: - movs r0, 0xA - b _080C9058 -_080C9008: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _080C9096 - movs r0, 0x15 - b _080C9058 - .pool -_080C901C: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _080C9096 - bl sub_80CADC4 - bl sub_80CC064 - b _080C905C - .pool -_080C9038: - bl sub_80CC0A0 - lsls r0, 24 - cmp r0, 0 - bne _080C9096 - bl sub_80CE324 - movs r0, 0x13 - b _080C9058 -_080C904A: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _080C9096 - movs r0, 0x14 -_080C9058: - bl sub_80CAC58 -_080C905C: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C9096 - .pool -_080C9070: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x8 - strb r0, [r1] - b _080C9096 - .pool -_080C9080: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _080C9096 - bl sub_80CADC4 - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow -_080C9096: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C8EB4 - - thumb_func_start sub_80C90A4 -sub_80C90A4: @ 80C90A4 - push {r4,lr} - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldrb r0, [r0] - cmp r0, 0 - beq _080C90BC - cmp r0, 0x1 - beq _080C90F0 - b _080C9118 - .pool -_080C90BC: - movs r0, 0xC - bl sub_80CAC58 - ldr r0, [r4] - ldr r2, =0x00000ceb - adds r1, r0, r2 - ldrb r1, [r1] - ldr r3, =0x00000da8 - adds r0, r3 - strb r1, [r0] - ldr r0, [r4] - adds r0, r2 - ldrb r0, [r0] - movs r1, 0xB0 - movs r2, 0x10 - bl sub_811FAA4 - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C9118 - .pool -_080C90F0: - bl sub_811FBA4 - lsls r0, 24 - cmp r0, 0 - bne _080C9118 - bl sub_811FAF8 - bl sub_80CADC4 - ldr r0, [r4] - ldr r1, =0x00000da8 - adds r0, r1 - ldrb r0, [r0] - bl sub_80CE9A8 - bl sub_80CA230 - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow -_080C9118: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C90A4 - - thumb_func_start sub_80C9128 -sub_80C9128: @ 80C9128 - push {r4,r5,lr} - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - ldrb r1, [r0] - cmp r1, 0x1 - beq _080C9174 - cmp r1, 0x1 - bgt _080C9144 - cmp r1, 0 - beq _080C914E - b _080C91D2 - .pool -_080C9144: - cmp r1, 0x2 - beq _080C919C - cmp r1, 0x3 - beq _080C91C2 - b _080C91D2 -_080C914E: - ldr r1, =0x00000ce6 - adds r0, r1 - ldrh r0, [r0] - bl ItemIsMail - lsls r0, 24 - cmp r0, 0 - bne _080C9168 - bl sub_80CADC4 - b _080C91B8 - .pool -_080C9168: - ldr r0, =sub_80C96B8 - bl add_to_c3_somehow - b _080C91D2 - .pool -_080C9174: - movs r0, 0x2 - bl sub_80CFE54 - ldr r0, =gUnknown_02039D0C - ldrb r0, [r0] - negs r4, r0 - orrs r4, r0 - lsrs r4, 31 - bl sub_80CFE08 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_80D0E90 - b _080C91B8 - .pool -_080C919C: - bl sub_80D1218 - lsls r0, 24 - cmp r0, 0 - bne _080C91D2 - movs r0, 0x3 - bl sub_80CFE54 - bl sub_80CADC4 - bl sub_80CE00C - bl sub_80CA4FC -_080C91B8: - ldr r1, [r5] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C91D2 -_080C91C2: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _080C91D2 - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow -_080C91D2: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C9128 - - thumb_func_start sub_80C91DC -sub_80C91DC: @ 80C91DC - push {r4,lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x4 - bhi _080C928C - lsls r0, 2 - ldr r1, =_080C91FC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C91FC: - .4byte _080C9264 - .4byte _080C9210 - .4byte _080C9238 - .4byte _080C9258 - .4byte _080C927C -_080C9210: - movs r0, 0x2 - bl sub_80CFE54 - ldr r0, =gUnknown_02039D0C - ldrb r0, [r0] - negs r4, r0 - orrs r4, r0 - lsrs r4, 31 - bl sub_80CFE08 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_80D1080 - b _080C9268 - .pool -_080C9238: - bl sub_80D1218 - lsls r0, 24 - cmp r0, 0 - bne _080C928C - movs r0, 0 - bl sub_80CFE54 - bl sub_80CE00C - bl sub_80CA4FC - movs r0, 0x1C - bl sub_80CAC58 - b _080C9268 -_080C9258: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _080C928C -_080C9264: - bl sub_80CADC4 -_080C9268: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C928C - .pool -_080C927C: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _080C928C - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow -_080C928C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C91DC - - thumb_func_start sub_80C9298 -sub_80C9298: @ 80C9298 - push {r4,r5,lr} - ldr r1, =gUnknown_02039D08 - ldr r0, [r1] - ldrb r0, [r0] - adds r5, r1, 0 - cmp r0, 0x4 - bls _080C92A8 - b _080C93A2 -_080C92A8: - lsls r0, 2 - ldr r1, =_080C92BC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C92BC: - .4byte _080C92D0 - .4byte _080C9328 - .4byte _080C9348 - .4byte _080C938C - .4byte _080C9374 -_080C92D0: - ldr r0, [r5] - ldr r1, =0x00000ce6 - adds r0, r1 - ldrh r0, [r0] - movs r1, 0x1 - bl AddBagItem - lsls r0, 24 - cmp r0, 0 - bne _080C92FC - movs r0, 0x20 - bl PlaySE - movs r0, 0x1A - bl sub_80CAC58 - ldr r1, [r5] - movs r0, 0x3 - strb r0, [r1] - b _080C93A2 - .pool -_080C92FC: - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_02039D0C - ldrb r0, [r0] - negs r4, r0 - orrs r4, r0 - lsrs r4, 31 - bl sub_80CFE08 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_80D1114 - ldr r1, [r5] - movs r0, 0x1 - strb r0, [r1] - b _080C93A2 - .pool -_080C9328: - bl sub_80D1218 - lsls r0, 24 - cmp r0, 0 - bne _080C93A2 - movs r0, 0x19 - bl sub_80CAC58 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x2 - strb r0, [r1] - b _080C93A2 - .pool -_080C9348: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _080C93A2 - bl sub_80CADC4 - bl sub_80CE00C - bl sub_80CA4FC - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x4 - strb r0, [r1] - b _080C93A2 - .pool -_080C9374: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _080C93A2 - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow - b _080C93A2 - .pool -_080C938C: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _080C93A2 - bl sub_80CADC4 - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow -_080C93A2: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C9298 - - thumb_func_start sub_80C93B0 -sub_80C93B0: @ 80C93B0 - push {r4,lr} - ldr r1, =gUnknown_02039D08 - ldr r0, [r1] - ldrb r0, [r0] - adds r4, r1, 0 - cmp r0, 0x4 - bhi _080C948C - lsls r0, 2 - ldr r1, =_080C93D0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C93D0: - .4byte _080C93E4 - .4byte _080C9410 - .4byte _080C9438 - .4byte _080C9458 - .4byte _080C947C -_080C93E4: - ldr r0, [r4] - ldr r1, =0x00000ce6 - adds r0, r1 - ldrh r0, [r0] - bl ItemIsMail - lsls r0, 24 - cmp r0, 0 - bne _080C9404 - bl sub_80CADC4 - ldr r1, [r4] - b _080C946C - .pool -_080C9404: - ldr r0, =sub_80C96B8 - bl add_to_c3_somehow - b _080C948C - .pool -_080C9410: - movs r0, 0x2 - bl sub_80CFE54 - ldr r0, =gUnknown_02039D0C - ldrb r0, [r0] - negs r4, r0 - orrs r4, r0 - lsrs r4, 31 - bl sub_80CFE08 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_80D0FAC - b _080C9468 - .pool -_080C9438: - bl sub_80D1218 - lsls r0, 24 - cmp r0, 0 - bne _080C948C - movs r0, 0x3 - bl sub_80CFE54 - bl sub_80CE00C - bl sub_80CA4FC - movs r0, 0x1D - bl sub_80CAC58 - b _080C9468 -_080C9458: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _080C948C - bl sub_80CADC4 -_080C9468: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] -_080C946C: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C948C - .pool -_080C947C: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _080C948C - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow -_080C948C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C93B0 - - thumb_func_start sub_80C9498 -sub_80C9498: @ 80C9498 - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x6 - bhi _080C9544 - lsls r0, 2 - ldr r1, =_080C94B8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C94B8: - .4byte _080C94D4 - .4byte _080C94DA - .4byte _080C94F4 - .4byte _080C94FA - .4byte _080C9500 - .4byte _080C9518 - .4byte _080C9534 -_080C94D4: - bl sub_80CADC4 - b _080C9522 -_080C94DA: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _080C9544 - movs r0, 0x6 - bl PlaySE - bl sub_80D17B4 - bl sub_80D1818 - b _080C9522 -_080C94F4: - bl sub_80D184C - b _080C951C -_080C94FA: - bl IsDma3ManagerBusyWithBgCopy - b _080C951C -_080C9500: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _080C9544 - movs r0, 0x6 - bl PlaySE - b _080C9522 - .pool -_080C9518: - bl sub_80D18E4 -_080C951C: - lsls r0, 24 - cmp r0, 0 - bne _080C9544 -_080C9522: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C9544 - .pool -_080C9534: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _080C9544 - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow -_080C9544: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C9498 - - thumb_func_start sub_80C954C -sub_80C954C: @ 80C954C - push {r4,lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x5 - bls _080C955A - b _080C9664 -_080C955A: - lsls r0, 2 - ldr r1, =_080C956C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C956C: - .4byte _080C9584 - .4byte _080C95A4 - .4byte _080C9602 - .4byte _080C9624 - .4byte _080C9638 - .4byte _080C9654 -_080C9584: - movs r0, 0x5 - bl PlaySE - movs r0, 0x1B - bl sub_80CAC58 - movs r0, 0 - bl sub_80CAD9C - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x1 - strb r0, [r1] - b _080C9664 - .pool -_080C95A4: - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _080C95C8 - cmp r1, 0 - bgt _080C95BE - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _080C95C2 - b _080C9664 -_080C95BE: - cmp r1, 0x1 - bne _080C9664 -_080C95C2: - bl sub_80CADC4 - b _080C9648 -_080C95C8: - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r1, =0x00002234 - adds r0, r1 - ldrh r0, [r0] - movs r1, 0x1 - bl AddBagItem - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080C95F4 - bl sub_80CADC4 - ldr r1, [r4] - movs r0, 0x3 - strb r0, [r1] - b _080C9664 - .pool -_080C95F4: - movs r0, 0x1A - bl sub_80CAC58 - ldr r1, [r4] - movs r0, 0x2 - strb r0, [r1] - b _080C9664 -_080C9602: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _080C9664 - bl sub_80CADC4 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x5 - strb r0, [r1] - b _080C9664 - .pool -_080C9624: - bl sub_80D1194 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x4 - strb r0, [r1] - b _080C9664 - .pool -_080C9638: - bl sub_80D1218 - lsls r0, 24 - cmp r0, 0 - bne _080C9664 - movs r0, 0 - bl sub_80CFE54 -_080C9648: - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow - b _080C9664 - .pool -_080C9654: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _080C9664 - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow -_080C9664: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C954C - - thumb_func_start sub_80C9670 -sub_80C9670: @ 80C9670 - push {r4,lr} - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldrb r0, [r0] - cmp r0, 0 - beq _080C9688 - cmp r0, 0x1 - beq _080C969A - b _080C96AE - .pool -_080C9688: - bl CompactPartySlots - bl sub_80CB950 - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C96AE -_080C969A: - bl sub_80CB9BC - lsls r0, 24 - cmp r0, 0 - bne _080C96AE - bl sub_80CAB20 - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow -_080C96AE: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C9670 - - thumb_func_start sub_80C96B8 -sub_80C96B8: @ 80C96B8 - push {r4,lr} - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldrb r0, [r0] - cmp r0, 0x1 - beq _080C96E6 - cmp r0, 0x1 - bgt _080C96D4 - cmp r0, 0 - beq _080C96DE - b _080C9720 - .pool -_080C96D4: - cmp r0, 0x2 - beq _080C96F2 - cmp r0, 0x3 - beq _080C9710 - b _080C9720 -_080C96DE: - movs r0, 0x1E - bl sub_80CAC58 - b _080C9702 -_080C96E6: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _080C9720 - b _080C9702 -_080C96F2: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _080C9720 - bl sub_80CADC4 -_080C9702: - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C9720 - .pool -_080C9710: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _080C9720 - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow -_080C9720: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C96B8 - - thumb_func_start box_related -box_related: @ 80C972C - push {r4,lr} - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldrb r0, [r0] - cmp r0, 0x1 - beq _080C9762 - cmp r0, 0x1 - bgt _080C9748 - cmp r0, 0 - beq _080C974E - b _080C9818 - .pool -_080C9748: - cmp r0, 0x2 - beq _080C9774 - b _080C9818 -_080C974E: - movs r0, 0x1 - bl sub_80CAC58 - bl sub_80CFFD0 - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C9818 -_080C9762: - bl sub_80D00A8 - lsls r0, 24 - cmp r0, 0 - bne _080C9818 - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080C9774: - bl sub_80D00AC - adds r0, 0x1 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xC - bhi _080C9818 - lsls r0, 2 - ldr r1, =_080C9790 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C9790: - .4byte _080C97C4 - .4byte _080C97C4 - .4byte _080C9818 - .4byte _080C9818 - .4byte _080C9818 - .4byte _080C9818 - .4byte _080C9818 - .4byte _080C9818 - .4byte _080C9818 - .4byte _080C9818 - .4byte _080C9808 - .4byte _080C97F0 - .4byte _080C97DC -_080C97C4: - movs r0, 0x1 - bl sub_80CD1A8 - bl sub_80CADC4 - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow - b _080C9818 - .pool -_080C97DC: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C9AC8 - bl add_to_c3_somehow - b _080C9818 - .pool -_080C97F0: - movs r0, 0x5 - bl PlaySE - bl sub_80CADC4 - ldr r0, =sub_80C9824 - bl add_to_c3_somehow - b _080C9818 - .pool -_080C9808: - movs r0, 0x5 - bl PlaySE - bl sub_80CADC4 - ldr r0, =sub_80C99D8 - bl add_to_c3_somehow -_080C9818: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end box_related - - thumb_func_start sub_80C9824 -sub_80C9824: @ 80C9824 - push {r4,r5,lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x6 - bls _080C9832 - b _080C99CC -_080C9832: - lsls r0, 2 - ldr r1, =_080C9844 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C9844: - .4byte _080C9860 - .4byte _080C9878 - .4byte _080C9894 - .4byte _080C990C - .4byte _080C993C - .4byte _080C9990 - .4byte _080C99AC -_080C9860: - bl sub_80CADD8 - movs r0, 0x2 - bl sub_80CAC58 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - b _080C99CA - .pool -_080C9878: - bl sub_80D00A8 - lsls r0, 24 - cmp r0, 0 - beq _080C9884 - b _080C99CC -_080C9884: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - b _080C99CA - .pool -_080C9894: - bl sub_80D00AC - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - ldr r5, =0x0000078e - adds r1, r5 - strh r0, [r1] - movs r0, 0 - ldrsh r1, [r1, r0] - cmp r1, 0x15 - bgt _080C98C0 - cmp r1, 0x12 - bge _080C98D2 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _080C98C6 - b _080C99CC - .pool -_080C98C0: - cmp r1, 0x16 - beq _080C98EC - b _080C99CC -_080C98C6: - movs r0, 0x1 - bl sub_80CD1A8 - bl sub_80CADC4 - b _080C99A0 -_080C98D2: - movs r0, 0x5 - bl PlaySE - bl sub_80D013C - ldr r1, [r4] - adds r2, r1, r5 - ldrh r0, [r2] - subs r0, 0x12 - strh r0, [r2] - ldrb r0, [r1] - adds r0, 0x1 - b _080C99CA -_080C98EC: - movs r0, 0x5 - bl PlaySE - ldr r0, [r4] - movs r1, 0xF2 - lsls r1, 3 - adds r0, r1 - movs r1, 0x10 - strh r1, [r0] - bl sub_80D013C - bl sub_80CADC4 - ldr r1, [r4] - movs r0, 0x6 - b _080C99CA -_080C990C: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _080C99CC - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r1, =0x0000078e - adds r0, r1 - ldrb r0, [r0] - bl sub_80CAE0C - movs r0, 0x3 - bl sub_80CAC58 - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - b _080C99CA - .pool -_080C993C: - bl sub_80D00AC - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - movs r5, 0xF2 - lsls r5, 3 - adds r1, r5 - strh r0, [r1] - movs r0, 0 - ldrsh r1, [r1, r0] - movs r0, 0x2 - negs r0, r0 - cmp r1, r0 - beq _080C99CC - adds r0, 0x1 - cmp r1, r0 - bne _080C996C - bl sub_80CADC4 - ldr r1, [r4] - movs r0, 0 - b _080C99CA - .pool -_080C996C: - movs r0, 0x5 - bl PlaySE - bl sub_80CADC4 - ldr r1, [r4] - adds r1, r5 - ldrh r0, [r1] - subs r0, 0x17 - strh r0, [r1] - lsls r0, 24 - lsrs r0, 24 - bl sub_80CC680 - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - b _080C99CA -_080C9990: - bl sub_80CC6B0 - lsls r0, 24 - cmp r0, 0 - bne _080C99CC - movs r0, 0x1 - bl sub_80CD1A8 -_080C99A0: - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow - b _080C99CC - .pool -_080C99AC: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _080C99CC - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - movs r1, 0xF2 - lsls r1, 3 - adds r0, r1 - ldrb r0, [r0] - bl sub_80CC680 - ldr r1, [r4] - movs r0, 0x5 -_080C99CA: - strb r0, [r1] -_080C99CC: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C9824 - - thumb_func_start sub_80C99D8 -sub_80C99D8: @ 80C99D8 - push {r4,r5,lr} - sub sp, 0x4 - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - ldrb r4, [r0] - cmp r4, 0x1 - beq _080C9A2C - cmp r4, 0x1 - bgt _080C99F4 - cmp r4, 0 - beq _080C99FE - b _080C9AB8 - .pool -_080C99F4: - cmp r4, 0x2 - beq _080C9A84 - cmp r4, 0x3 - beq _080C9A9C - b _080C9AB8 -_080C99FE: - movs r0, 0x5 - bl sub_80CAC58 - ldr r0, [r5] - ldr r1, =0x00001e5c - adds r0, r1 - ldr r2, =0x0000dac7 - str r4, [sp] - movs r1, 0xA - movs r3, 0x3 - bl sub_80C77E8 - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - bl sub_80C78D4 - b _080C9A8E - .pool -_080C9A2C: - bl sub_80C78F0 - ldr r1, [r5] - lsls r0, 24 - lsrs r0, 24 - ldr r2, =0x000002ca - adds r1, r2 - strh r0, [r1] - movs r2, 0 - ldrsh r0, [r1, r2] - cmp r0, 0xC8 - beq _080C9AB8 - bl sub_80CADC4 - bl sub_80C78E4 - bl sub_80C7890 - ldr r0, [r5] - ldr r2, =0x000002ca - adds r1, r0, r2 - movs r2, 0 - ldrsh r0, [r1, r2] - cmp r0, 0xC9 - beq _080C9A6C - adds r4, r0, 0 - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bne _080C9A8E -_080C9A6C: - movs r0, 0x1 - bl sub_80CD1A8 - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow - b _080C9AB8 - .pool -_080C9A84: - ldr r1, =0x000002ca - adds r0, r1 - ldrb r0, [r0] - bl sub_80CC464 -_080C9A8E: - ldr r1, [r5] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C9AB8 - .pool -_080C9A9C: - bl sub_80CC54C - lsls r0, 24 - cmp r0, 0 - bne _080C9AB8 - ldr r0, [r5] - ldr r2, =0x000002ca - adds r0, r2 - ldrb r0, [r0] - bl SetCurrentBox - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow -_080C9AB8: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C99D8 - - thumb_func_start sub_80C9AC8 -sub_80C9AC8: @ 80C9AC8 - push {r4,r5,lr} - sub sp, 0x4 - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - ldrb r4, [r0] - cmp r4, 0 - beq _080C9AE0 - cmp r4, 0x1 - beq _080C9AFE - b _080C9B18 - .pool -_080C9AE0: - bl sub_80CE760 - movs r0, 0x1 - negs r0, r0 - str r4, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, [r5] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C9B18 -_080C9AFE: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _080C9B18 - ldr r0, =gUnknown_02039D0F - strb r4, [r0] - ldr r1, [r5] - movs r0, 0x2 - strb r0, [r1, 0x2] - ldr r0, =sub_80C9E50 - bl add_to_c3_somehow -_080C9B18: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C9AC8 - - thumb_func_start sub_80C9B28 -sub_80C9B28: @ 80C9B28 - push {r4,r5,lr} - sub sp, 0x4 - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - ldrb r4, [r0] - cmp r4, 0 - beq _080C9B40 - cmp r4, 0x1 - beq _080C9B5E - b _080C9B78 - .pool -_080C9B40: - bl sub_80CE7E8 - movs r0, 0x1 - negs r0, r0 - str r4, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, [r5] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C9B78 -_080C9B5E: - bl UpdatePaletteFade - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _080C9B78 - ldr r0, =gUnknown_02039D0F - strb r1, [r0] - ldr r0, [r5] - strb r4, [r0, 0x2] - ldr r0, =sub_80C9E50 - bl add_to_c3_somehow -_080C9B78: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C9B28 - - thumb_func_start sub_80C9B88 -sub_80C9B88: @ 80C9B88 - push {r4,lr} - sub sp, 0x4 - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldrb r1, [r0] - cmp r1, 0 - beq _080C9BA0 - cmp r1, 0x1 - beq _080C9BBA - b _080C9BD6 - .pool -_080C9BA0: - movs r0, 0x1 - negs r0, r0 - str r1, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C9BD6 -_080C9BBA: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _080C9BD6 - ldr r1, =gUnknown_02039D0F - movs r0, 0x2 - strb r0, [r1] - ldr r1, [r4] - movs r0, 0x3 - strb r0, [r1, 0x2] - ldr r0, =sub_80C9E50 - bl add_to_c3_somehow -_080C9BD6: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C9B88 - - thumb_func_start sub_80C9BE8 -sub_80C9BE8: @ 80C9BE8 - push {r4,lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x4 - bls _080C9BF6 - b _080C9D08 -_080C9BF6: - lsls r0, 2 - ldr r1, =_080C9C08 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C9C08: - .4byte _080C9C1C - .4byte _080C9C78 - .4byte _080C9C8C - .4byte _080C9CC8 - .4byte _080C9CE4 -_080C9C1C: - bl sub_80CEAD0 - lsls r0, 24 - cmp r0, 0 - beq _080C9C40 - movs r0, 0x20 - bl PlaySE - movs r0, 0xF - bl sub_80CAC58 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x1 - strb r0, [r1] - b _080C9D08 - .pool -_080C9C40: - bl sub_80D127C - lsls r0, 24 - cmp r0, 0 - beq _080C9C58 - ldr r0, =sub_80C954C - bl add_to_c3_somehow - b _080C9D08 - .pool -_080C9C58: - movs r0, 0x5 - bl PlaySE - movs r0, 0 - bl sub_80CAC58 - movs r0, 0 - bl sub_80CAD9C - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x2 - strb r0, [r1] - b _080C9D08 - .pool -_080C9C78: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _080C9D08 - b _080C9CAA - .pool -_080C9C8C: - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _080C9CBC - cmp r1, 0 - bgt _080C9CA6 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _080C9CAA - b _080C9D08 -_080C9CA6: - cmp r1, 0x1 - bne _080C9D08 -_080C9CAA: - bl sub_80CADC4 - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow - b _080C9D08 - .pool -_080C9CBC: - movs r0, 0x3 - bl PlaySE - bl sub_80CADC4 - b _080C9CD2 -_080C9CC8: - movs r0, 0x14 - movs r1, 0 - movs r2, 0x1 - bl sub_80F9BF4 -_080C9CD2: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C9D08 - .pool -_080C9CE4: - bl sub_80F9C30 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _080C9D08 - bl sub_80CABE0 - bl CalculatePlayerPartyCount - ldr r1, =gPlayerPartyCount - strb r0, [r1] - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - strb r4, [r0, 0x2] - ldr r0, =sub_80C9E50 - bl add_to_c3_somehow -_080C9D08: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C9BE8 - - thumb_func_start sub_80C9D1C -sub_80C9D1C: @ 80C9D1C - push {r4,lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x4 - bls _080C9D2A - b _080C9E3C -_080C9D2A: - lsls r0, 2 - ldr r1, =_080C9D3C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C9D3C: - .4byte _080C9D50 - .4byte _080C9DAC - .4byte _080C9DC0 - .4byte _080C9DFC - .4byte _080C9E18 -_080C9D50: - bl sub_80CEAD0 - lsls r0, 24 - cmp r0, 0 - beq _080C9D74 - movs r0, 0x20 - bl PlaySE - movs r0, 0xF - bl sub_80CAC58 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x1 - strb r0, [r1] - b _080C9E3C - .pool -_080C9D74: - bl sub_80D127C - lsls r0, 24 - cmp r0, 0 - beq _080C9D8C - ldr r0, =sub_80C954C - bl add_to_c3_somehow - b _080C9E3C - .pool -_080C9D8C: - movs r0, 0x5 - bl PlaySE - movs r0, 0x12 - bl sub_80CAC58 - movs r0, 0 - bl sub_80CAD9C - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0x2 - strb r0, [r1] - b _080C9E3C - .pool -_080C9DAC: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0xF3 - ands r0, r1 - cmp r0, 0 - beq _080C9E3C - b _080C9DE0 - .pool -_080C9DC0: - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _080C9DE0 - cmp r1, 0 - bgt _080C9DDA - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _080C9DF0 - b _080C9E3C -_080C9DDA: - cmp r1, 0x1 - beq _080C9DF0 - b _080C9E3C -_080C9DE0: - bl sub_80CADC4 - ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow - b _080C9E3C - .pool -_080C9DF0: - movs r0, 0x3 - bl PlaySE - bl sub_80CADC4 - b _080C9E06 -_080C9DFC: - movs r0, 0x14 - movs r1, 0 - movs r2, 0 - bl sub_80F9BF4 -_080C9E06: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C9E3C - .pool -_080C9E18: - bl sub_80F9C30 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _080C9E3C - bl sub_80CABE0 - bl CalculatePlayerPartyCount - ldr r1, =gPlayerPartyCount - strb r0, [r1] - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - strb r4, [r0, 0x2] - ldr r0, =sub_80C9E50 - bl add_to_c3_somehow -_080C9E3C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C9D1C - - thumb_func_start sub_80C9E50 -sub_80C9E50: @ 80C9E50 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r4, [r0, 0x2] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080C9E88 - bl sub_80D127C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080C9E88 - bl sub_80D12D4 - ldr r1, =gUnknown_02039D12 - b _080C9E8C - .pool -_080C9E88: - ldr r1, =gUnknown_02039D12 - movs r0, 0 -_080C9E8C: - strh r0, [r1] - cmp r4, 0x1 - beq _080C9EB4 - cmp r4, 0x1 - ble _080C9E9E - cmp r4, 0x2 - beq _080C9F1C - cmp r4, 0x3 - beq _080C9F48 -_080C9E9E: - bl sub_80C9FC8 - ldr r0, =sub_80C7678 - bl SetMainCallback2 - b _080C9F56 - .pool -_080C9EB4: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x0000218c - adds r0, r1, r2 - ldr r4, [r0] - subs r2, 0x5 - adds r0, r1, r2 - ldrb r7, [r0] - subs r2, 0x1 - adds r0, r1, r2 - ldrb r6, [r0] - ldr r0, =0x00002188 - adds r1, r0 - ldrb r5, [r1] - bl sub_80C9FC8 - cmp r5, 0 - bne _080C9F04 - ldr r0, =gUnknown_02039D14 - cmp r4, r0 - bne _080C9F04 - ldr r0, =c2_808CE60 - str r0, [sp] - movs r0, 0 - adds r1, r4, 0 - adds r2, r7, 0 - adds r3, r6, 0 - bl ShowPokemonSummaryScreenSet40EF - b _080C9F56 - .pool -_080C9F04: - ldr r0, =c2_808CE60 - str r0, [sp] - adds r0, r5, 0 - adds r1, r4, 0 - adds r2, r7, 0 - adds r3, r6, 0 - bl ShowPokemonSummaryScreen - b _080C9F56 - .pool -_080C9F1C: - bl sub_80C9FC8 - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - bl GetBoxNamePtr - adds r1, r0, 0 - movs r0, 0 - str r0, [sp] - ldr r0, =c2_808CE60 - str r0, [sp, 0x4] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl DoNamingScreen - b _080C9F56 - .pool -_080C9F48: - bl sub_80C9FC8 - ldr r2, =c2_808CE60 - movs r0, 0xB - movs r1, 0 - bl GoToBagMenu -_080C9F56: - mov r0, r8 - bl DestroyTask - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C9E50 - - thumb_func_start sub_80C9F6C -sub_80C9F6C: @ 80C9F6C - push {lr} - sub sp, 0x4 - ldr r0, =gSpecialVar_ItemId - ldrh r1, [r0] - mov r0, sp - strh r1, [r0] - cmp r1, 0 - beq _080C9FC0 - bl sub_80CFE08 - lsls r0, 24 - lsrs r1, r0, 24 - ldr r0, =gUnknown_02039D0C - ldrb r0, [r0] - cmp r0, 0 - beq _080C9FAC - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - mov r2, sp - bl SetMonData - b _080C9FB6 - .pool -_080C9FAC: - adds r0, r1, 0 - movs r1, 0xC - mov r2, sp - bl SetBoxMonDataFromSelectedBox -_080C9FB6: - mov r0, sp - ldrh r0, [r0] - movs r1, 0x1 - bl RemoveBagItem -_080C9FC0: - add sp, 0x4 - pop {r0} - bx r0 - thumb_func_end sub_80C9F6C - - thumb_func_start sub_80C9FC8 -sub_80C9FC8: @ 80C9FC8 - push {r4,lr} - bl sub_80D25F0 - bl sub_80D01B8 - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] - bl FreeAllWindowBuffers - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C9FC8 - - thumb_func_start sub_80C9FEC -sub_80C9FEC: @ 80C9FEC - push {lr} - sub sp, 0x4 - ldr r1, =0x00001f0f - movs r0, 0xE - bl SetGpuReg - ldr r1, =gUnknown_085720DC - movs r0, 0 - str r0, [sp] - movs r0, 0x3 - movs r2, 0 - movs r3, 0 - bl DecompressAndLoadBgGfxUsingHeap - ldr r0, =gUnknown_08572174 - ldr r1, =0x0600f800 - bl LZ77UnCompVram - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C9FEC - - thumb_func_start sub_80CA028 -sub_80CA028: @ 80CA028 - push {lr} - movs r0, 0x3 - movs r1, 0x80 - movs r2, 0x1 - bl ChangeBgX - movs r0, 0x3 - movs r1, 0x80 - movs r2, 0x2 - bl ChangeBgY - pop {r0} - bx r0 - thumb_func_end sub_80CA028 - - thumb_func_start sub_80CA044 -sub_80CA044: @ 80CA044 - push {r4,r5,lr} - sub sp, 0x4 - ldr r1, =gUnknown_08572734 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - ldr r1, =gPSSMenu_Gfx - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl DecompressAndLoadBgGfxUsingHeap - ldr r0, =gUnknown_085722A0 - ldr r5, =gUnknown_02039D08 - ldr r1, [r5] - ldr r4, =0x00005ac4 - adds r1, r4 - bl LZ77UnCompWram - ldr r1, [r5] - adds r1, r4 - movs r0, 0x1 - bl SetBgTilemapBuffer - movs r0, 0x1 - bl ShowBg - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CA044 - - thumb_func_start sub_80CA0A4 -sub_80CA0A4: @ 80CA0A4 - push {lr} - ldr r0, =gUnknown_08572714 - bl InitWindows - lsls r0, 16 - cmp r0, 0 - beq _080CA0C0 - bl DeactivateAllTextPrinters - movs r0, 0x1 - b _080CA0C2 - .pool -_080CA0C0: - movs r0, 0 -_080CA0C2: - pop {r1} - bx r1 - thumb_func_end sub_80CA0A4 - - thumb_func_start sub_80CA0C8 -sub_80CA0C8: @ 80CA0C8 - push {lr} - ldr r0, =gWaveformSpritePalette - bl LoadSpritePalette - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CA0C8 - - thumb_func_start sub_80CA0D8 -sub_80CA0D8: @ 80CA0D8 - push {lr} - ldr r0, =gUnknown_085723DC - movs r1, 0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_085723FC - movs r1, 0x20 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_085726F4 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - beq _080CA124 - ldr r0, =gUnknown_0857241C - movs r1, 0x30 - movs r2, 0x20 - bl LoadPalette - b _080CA12E - .pool -_080CA124: - ldr r0, =gUnknown_0857243C - movs r1, 0x30 - movs r2, 0x20 - bl LoadPalette -_080CA12E: - ldr r1, =0x00001e05 - movs r0, 0xA - bl SetGpuReg - bl sub_80CA318 - bl sub_80CA154 - bl sub_80CA1C4 - bl sub_80CA230 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CA0D8 - - thumb_func_start sub_80CA154 -sub_80CA154: @ 80CA154 - push {r4,lr} - ldr r1, =0x0000dac8 - movs r0, 0x10 - movs r2, 0 - bl sub_811FFB4 - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - ldr r3, =0x00000d94 - adds r1, r3 - str r0, [r1] - ldrb r2, [r0, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r2 - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0, 0x5] - ldr r0, [r4] - adds r0, r3 - ldr r0, [r0] - adds r0, 0x43 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r4] - adds r0, r3 - ldr r2, [r0] - movs r1, 0x28 - strh r1, [r2, 0x20] - ldr r1, [r0] - movs r0, 0x96 - strh r0, [r1, 0x22] - movs r0, 0x10 - bl GetSpriteTileStartByTag - ldr r1, [r4] - movs r2, 0xDA - lsls r2, 4 - adds r1, r2 - lsls r0, 16 - lsrs r0, 11 - ldr r2, =0x06010000 - adds r0, r2 - str r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CA154 - - thumb_func_start sub_80CA1C4 -sub_80CA1C4: @ 80CA1C4 - push {r4,lr} - sub sp, 0x8 - ldr r0, =gWaveformSpriteSheet - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp] - str r1, [sp, 0x4] - mov r0, sp - bl LoadSpriteSheet - movs r4, 0 -_080CA1DA: - lsls r1, r4, 6 - subs r1, r4 - adds r1, 0x8 - lsls r1, 16 - asrs r1, 16 - ldr r0, =gUnknown_085728BC - movs r2, 0x9 - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02039D08 - ldr r2, [r1] - lsls r1, r4, 2 - ldr r3, =0x00000d98 - adds r2, r3 - adds r2, r1 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - str r1, [r2] - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x1 - bls _080CA1DA - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CA1C4 - - thumb_func_start sub_80CA230 -sub_80CA230: @ 80CA230 - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x00000ce4 - adds r0, r1, r2 - ldrh r0, [r0] - subs r2, 0x4 - adds r1, r2 - ldr r1, [r1] - bl sub_80CA44C - bl sub_80CA4FC - bl sub_80CA65C - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CA230 - - thumb_func_start BoxSetMosaic -BoxSetMosaic: @ 80CA260 - push {lr} - bl sub_80CA230 - ldr r3, =gUnknown_02039D08 - ldr r0, [r3] - movs r1, 0x89 - lsls r1, 6 - adds r0, r1 - ldr r2, [r0] - cmp r2, 0 - beq _080CA2AC - ldrb r0, [r2, 0x1] - movs r1, 0x10 - orrs r0, r1 - strb r0, [r2, 0x1] - ldr r1, [r3] - movs r0, 0x89 - lsls r0, 6 - adds r1, r0 - ldr r2, [r1] - movs r0, 0xA - strh r0, [r2, 0x2E] - ldr r2, [r1] - movs r0, 0x1 - strh r0, [r2, 0x30] - ldr r2, [r1] - ldr r0, =BoxSetMosaic2 - str r0, [r2, 0x1C] - ldr r0, [r1] - ldrh r0, [r0, 0x2E] - lsls r1, r0, 12 - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x4C - bl SetGpuReg -_080CA2AC: - pop {r0} - bx r0 - .pool - thumb_func_end BoxSetMosaic - - thumb_func_start sub_80CA2B8 -sub_80CA2B8: @ 80CA2B8 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - movs r1, 0x89 - lsls r1, 6 - adds r0, r1 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - lsls r0, 27 - lsrs r0, 31 - bx lr - .pool - thumb_func_end sub_80CA2B8 - - thumb_func_start BoxSetMosaic2 -BoxSetMosaic2: @ 80CA2D0 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - ldrh r1, [r4, 0x30] - subs r0, r1 - strh r0, [r4, 0x2E] - lsls r0, 16 - cmp r0, 0 - bge _080CA2E6 - movs r0, 0 - strh r0, [r4, 0x2E] -_080CA2E6: - ldrh r0, [r4, 0x2E] - lsls r1, r0, 12 - lsls r0, 8 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x4C - bl SetGpuReg - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080CA30E - ldrb r0, [r4, 0x1] - movs r1, 0x11 - negs r1, r1 - ands r1, r0 - strb r1, [r4, 0x1] - ldr r0, =SpriteCallbackDummy - str r0, [r4, 0x1C] -_080CA30E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end BoxSetMosaic2 - - thumb_func_start sub_80CA318 -sub_80CA318: @ 80CA318 - push {r4-r7,lr} - sub sp, 0x28 - ldr r0, =gUnknown_02039D08 - mov r12, r0 - ldr r1, [r0] - ldr r4, =0x000022c4 - adds r0, r1, r4 - str r0, [sp, 0x18] - add r3, sp, 0x18 - movs r0, 0x82 - lsls r0, 10 - str r0, [r3, 0x4] - ldr r5, =0x00002244 - adds r1, r5 - str r1, [sp, 0x20] - ldr r0, =0x0000dac6 - add r2, sp, 0x20 - str r0, [r2, 0x4] - mov r1, sp - ldr r0, =gUnknown_08572754 - ldm r0!, {r5-r7} - stm r1!, {r5-r7} - ldm r0!, {r5-r7} - stm r1!, {r5-r7} - movs r6, 0 - adds r7, r2, 0 - mov r5, r12 - movs r2, 0 - ldr r1, =0x000007ff -_080CA352: - ldr r0, [r5] - adds r0, r4 - adds r0, r6 - strb r2, [r0] - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, r1 - bls _080CA352 - movs r6, 0 - ldr r5, =gUnknown_02039D08 - ldr r4, =0x00002244 - movs r2, 0 -_080CA36C: - ldr r0, [r5] - lsls r1, r6, 1 - adds r0, r4 - adds r0, r1 - strh r2, [r0] - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0xF - bls _080CA36C - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - movs r6, 0x89 - lsls r6, 6 - adds r0, r6 - movs r1, 0 - str r1, [r0] - adds r0, r3, 0 - bl LoadSpriteSheet - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0 - beq _080CA420 - adds r0, r7, 0 - bl LoadSpritePalette - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xFF - beq _080CA420 - b _080CA40C - .pool -_080CA3C4: - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - movs r7, 0x89 - lsls r7, 6 - adds r3, r2, r7 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - str r0, [r3] - lsls r0, r4, 4 - movs r1, 0x80 - lsls r1, 1 - adds r0, r1 - ldr r3, =0x0000223a - adds r1, r2, r3 - strh r0, [r1] - ldr r6, =0x0000223c - adds r2, r6 - lsls r0, r5, 5 - ldr r7, =0x06010000 - adds r0, r7 - str r0, [r2] - b _080CA420 - .pool -_080CA40C: - mov r0, sp - movs r1, 0x28 - movs r2, 0x30 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x40 - bne _080CA3C4 -_080CA420: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - movs r1, 0x89 - lsls r1, 6 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0 - bne _080CA43C - movs r0, 0x2 - bl FreeSpriteTilesByTag - ldr r0, =0x0000dac6 - bl FreeSpritePaletteByTag -_080CA43C: - add sp, 0x28 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CA318 - - thumb_func_start sub_80CA44C -sub_80CA44C: @ 80CA44C - push {r4-r7,lr} - sub sp, 0x4 - adds r3, r1, 0 - lsls r0, 16 - lsrs r4, r0, 16 - ldr r6, =gUnknown_02039D08 - ldr r2, [r6] - movs r7, 0x89 - lsls r7, 6 - adds r0, r2, r7 - ldr r0, [r0] - cmp r0, 0 - beq _080CA4F2 - cmp r4, 0 - beq _080CA4E8 - lsls r0, r4, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r5, =0x000022c4 - adds r1, r2, r5 - movs r2, 0x1 - str r2, [sp] - adds r2, r4, 0 - bl LoadSpecialPokePic - ldr r1, [r6] - ldr r2, =0x00000cdc - adds r0, r1, r2 - ldr r0, [r0] - ldr r4, =0x00002244 - adds r1, r4 - bl LZ77UnCompWram - ldr r0, [r6] - adds r5, r0, r5 - ldr r1, =0x0000223c - adds r0, r1 - ldr r1, [r0] - ldr r2, =0x04000200 - adds r0, r5, 0 - bl CpuSet - ldr r0, [r6] - adds r4, r0, r4 - ldr r2, =0x0000223a - adds r0, r2 - ldrh r1, [r0] - adds r0, r4, 0 - movs r2, 0x20 - bl LoadPalette - ldr r0, [r6] - adds r0, r7 - ldr r1, [r0] - adds r1, 0x3E - ldrb r2, [r1] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - b _080CA4F2 - .pool -_080CA4E8: - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] -_080CA4F2: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80CA44C - - thumb_func_start sub_80CA4FC -sub_80CA4FC: @ 80CA4FC - push {r4-r6,lr} - sub sp, 0xC - movs r0, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r6, =gUnknown_02039D08 - ldr r2, [r6] - ldrb r0, [r2, 0x1] - cmp r0, 0x3 - beq _080CA588 - ldr r0, =0x00000cf9 - adds r2, r0 - movs r4, 0 - str r4, [sp] - movs r5, 0xFF - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - movs r3, 0x6 - bl AddTextPrinterParameterized - ldr r2, [r6] - ldr r1, =0x00000d1d - adds r2, r1 - movs r0, 0xF - str r0, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r1, 0x2 - movs r3, 0x6 - bl AddTextPrinterParameterized - ldr r2, [r6] - ldr r0, =0x00000d41 - adds r2, r0 - movs r0, 0x1D - str r0, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r1, 0x2 - movs r3, 0xA - bl AddTextPrinterParameterized - ldr r2, [r6] - ldr r1, =0x00000d65 - adds r2, r1 - movs r0, 0x2B - str r0, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r3, 0x6 - bl AddTextPrinterParameterized - b _080CA5E8 - .pool -_080CA588: - ldr r0, =0x00000d65 - adds r2, r0 - movs r4, 0 - str r4, [sp] - movs r5, 0xFF - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r3, 0x6 - bl AddTextPrinterParameterized - ldr r2, [r6] - ldr r1, =0x00000cf9 - adds r2, r1 - movs r0, 0xD - str r0, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - movs r3, 0x6 - bl AddTextPrinterParameterized - ldr r2, [r6] - ldr r0, =0x00000d1d - adds r2, r0 - movs r0, 0x1C - str r0, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r1, 0x2 - movs r3, 0x6 - bl AddTextPrinterParameterized - ldr r2, [r6] - ldr r1, =0x00000d41 - adds r2, r1 - movs r0, 0x2A - str r0, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r1, 0x2 - movs r3, 0xA - bl AddTextPrinterParameterized -_080CA5E8: - movs r0, 0 - movs r1, 0x2 - bl CopyWindowToVram - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - ldr r2, =0x00000ce4 - adds r0, r1, r2 - ldrh r0, [r0] - cmp r0, 0 - beq _080CA640 - adds r2, 0x7 - adds r0, r1, r2 - ldrb r0, [r0] - adds r2, 0xB5 - adds r1, r2 - ldr r1, [r1] - bl sub_8120084 - ldr r0, [r4] - ldr r1, =0x00000d94 - adds r0, r1 - ldr r1, [r0] - adds r1, 0x3E - ldrb r2, [r1] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - b _080CA64E - .pool -_080CA640: - ldr r2, =0x00000d94 - adds r0, r1, r2 - ldr r1, [r0] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 -_080CA64E: - strb r0, [r1] - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CA4FC - - thumb_func_start sub_80CA65C -sub_80CA65C: @ 80CA65C - push {r4,lr} - sub sp, 0x4 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000ce4 - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0 - beq _080CA6B4 - movs r0, 0x2 - str r0, [sp] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0x8 - bl sub_80D27AC - movs r4, 0 -_080CA680: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - lsls r1, r4, 2 - ldr r2, =0x00000d98 - adds r0, r2 - adds r0, r1 - ldr r0, [r0] - lsls r1, r4, 1 - adds r1, 0x1 - lsls r1, 24 - lsrs r1, 24 - bl StartSpriteAnimIfDifferent - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x1 - bls _080CA680 - b _080CA6E6 - .pool -_080CA6B4: - movs r0, 0x2 - str r0, [sp] - movs r0, 0 - movs r1, 0 - movs r2, 0x2 - movs r3, 0x8 - bl sub_80D27AC - movs r4, 0 -_080CA6C6: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - lsls r1, r4, 2 - ldr r2, =0x00000d98 - adds r0, r2 - adds r0, r1 - ldr r0, [r0] - lsls r1, r4, 25 - lsrs r1, 24 - bl StartSpriteAnim - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x1 - bls _080CA6C6 -_080CA6E6: - movs r0, 0 - bl sub_80D2918 - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CA65C - - thumb_func_start sub_80CA704 -sub_80CA704: @ 80CA704 - push {r4,lr} - sub sp, 0x4 - ldr r0, =gUnknown_08DD36C8 - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - adds r1, 0xB0 - bl LZ77UnCompWram - ldr r0, =gPSSMenu_Pal - movs r1, 0x10 - movs r2, 0x20 - bl LoadPalette - ldr r2, [r4] - adds r2, 0xB0 - movs r0, 0x16 - str r0, [sp] - movs r0, 0x1 - movs r1, 0x1 - movs r3, 0xC - bl sub_80D2644 - ldr r2, =gUnknown_0857245C - movs r0, 0x4 - str r0, [sp] - movs r0, 0x2 - movs r1, 0x1 - movs r3, 0x9 - bl sub_80D2644 - movs r0, 0x1 - movs r1, 0xA - movs r2, 0 - bl sub_80D2770 - movs r0, 0x2 - movs r1, 0x15 - movs r2, 0 - bl sub_80D2770 - bl sub_80CAA74 - ldr r0, =gUnknown_02039D0C - ldrb r0, [r0] - cmp r0, 0 - beq _080CA790 - movs r0, 0x1 - bl sub_80CA984 - movs r0, 0x1 - bl sub_80CB7E8 - movs r0, 0x2 - bl sub_80D2918 - movs r0, 0x1 - bl sub_80D2918 - b _080CA7B2 - .pool -_080CA790: - movs r0, 0x2 - str r0, [sp] - movs r0, 0x1 - movs r1, 0 - movs r2, 0x14 - movs r3, 0xC - bl sub_80D27AC - movs r0, 0x1 - bl sub_80CA984 - movs r0, 0x1 - bl sub_80D2918 - movs r0, 0x2 - bl sub_80D2918 -_080CA7B2: - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x000002c7 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CA704 - - thumb_func_start sub_80CA7D4 -sub_80CA7D4: @ 80CA7D4 - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r0, 0xB0 - lsls r0, 2 - adds r2, r1, r0 - movs r3, 0 - movs r0, 0x14 - strh r0, [r2] - ldr r0, =0x000002c2 - adds r2, r1, r0 - movs r0, 0x2 - strh r0, [r2] - ldr r0, =0x000002c5 - adds r1, r0 - strb r3, [r1] - movs r0, 0 - bl sub_80CB7E8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CA7D4 - - thumb_func_start sub_80CA80C -sub_80CA80C: @ 80CA80C - push {r4,lr} - ldr r4, =gUnknown_02039D08 - ldr r2, [r4] - ldr r1, =0x000002c5 - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0x14 - beq _080CA87A - movs r0, 0xB0 - lsls r0, 2 - adds r1, r2, r0 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - ldr r0, =0x000002c2 - adds r1, r2, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - movs r0, 0x1 - movs r1, 0x3 - movs r2, 0x1 - bl sub_80D27F4 - movs r0, 0x1 - bl sub_80D2918 - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x8 - bl sub_80CBAF0 - ldr r1, [r4] - ldr r0, =0x000002c5 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x14 - beq _080CA874 - movs r0, 0x1 - b _080CA87C - .pool -_080CA874: - ldr r1, =gUnknown_02039D0C - movs r0, 0x1 - strb r0, [r1] -_080CA87A: - movs r0, 0 -_080CA87C: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CA80C - - thumb_func_start sub_80CA888 -sub_80CA888: @ 80CA888 - push {r4,lr} - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - movs r0, 0xB0 - lsls r0, 2 - adds r2, r1, r0 - movs r3, 0 - movs r0, 0 - strh r0, [r2] - ldr r0, =0x000002c2 - adds r2, r1, r0 - movs r0, 0x16 - strh r0, [r2] - ldr r0, =0x000002c5 - adds r1, r0 - strb r3, [r1] - ldr r0, [r4] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080CA8B4 - bl sub_80D11CC -_080CA8B4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CA888 - - thumb_func_start sub_80CA8C8 -sub_80CA8C8: @ 80CA8C8 - push {r4,r5,lr} - sub sp, 0x8 - ldr r5, =gUnknown_02039D08 - ldr r2, [r5] - ldr r1, =0x000002c5 - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0x14 - beq _080CA974 - movs r0, 0xB0 - lsls r0, 2 - adds r1, r2, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - ldr r4, =0x000002c2 - adds r1, r2, r4 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - movs r2, 0x1 - negs r2, r2 - movs r0, 0x1 - movs r1, 0x3 - bl sub_80D27F4 - movs r0, 0x1 - bl sub_80D2918 - movs r1, 0x80 - lsls r1, 1 - ldr r0, [r5] - adds r0, r4 - ldrb r3, [r0] - movs r0, 0xC - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r2, 0xA - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0x8 - negs r0, r0 - bl sub_80CBAF0 - ldr r1, [r5] - ldr r0, =0x000002c5 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x14 - beq _080CA94C - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x1 - b _080CA976 - .pool -_080CA94C: - ldr r0, =gUnknown_02039D0C - movs r1, 0 - strb r1, [r0] - bl sub_80CBB9C - bl CompactPartySlots - movs r0, 0x2 - str r0, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x9 - bl sub_80D27AC - movs r0, 0x2 - bl sub_80D2918 - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram -_080CA974: - movs r0, 0 -_080CA976: - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CA8C8 - - thumb_func_start sub_80CA984 -sub_80CA984: @ 80CA984 - push {lr} - sub sp, 0x4 - lsls r0, 24 - cmp r0, 0 - beq _080CA99E - movs r0, 0x2 - str r0, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x9 - bl sub_80D27AC - b _080CA9AC -_080CA99E: - movs r0, 0x2 - str r0, [sp] - movs r1, 0 - movs r2, 0x2 - movs r3, 0x9 - bl sub_80D27AC -_080CA9AC: - movs r0, 0x2 - bl sub_80D2918 - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0x4 - pop {r0} - bx r0 - thumb_func_end sub_80CA984 - - thumb_func_start sub_80CA9C0 -sub_80CA9C0: @ 80CA9C0 - ldr r2, =gUnknown_02039D08 - ldr r0, [r2] - ldr r1, =0x000002c7 - adds r0, r1 - movs r3, 0x1 - strb r3, [r0] - ldr r0, [r2] - adds r1, 0x1 - adds r0, r1 - movs r1, 0x1E - strb r1, [r0] - ldr r0, [r2] - ldr r1, =0x000002c9 - adds r0, r1 - strb r3, [r0] - bx lr - .pool - thumb_func_end sub_80CA9C0 - - thumb_func_start sub_80CA9EC -sub_80CA9EC: @ 80CA9EC - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r2, =0x000002c7 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0 - beq _080CAA06 - movs r0, 0 - strb r0, [r1] - movs r0, 0x1 - bl sub_80CA984 -_080CAA06: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CA9EC - - thumb_func_start sub_80CAA14 -sub_80CAA14: @ 80CAA14 - push {r4,lr} - ldr r3, =gUnknown_02039D08 - ldr r1, [r3] - ldr r2, =0x000002c7 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080CAA60 - movs r0, 0xB2 - lsls r0, 2 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1E - bls _080CAA60 - ldr r0, [r3] - movs r1, 0xB2 - lsls r1, 2 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - ldr r0, [r3] - movs r2, 0 - ldr r4, =0x000002c9 - adds r1, r0, r4 - ldrb r0, [r1] - cmp r0, 0 - bne _080CAA54 - movs r2, 0x1 -_080CAA54: - strb r2, [r1] - ldr r0, [r3] - adds r0, r4 - ldrb r0, [r0] - bl sub_80CA984 -_080CAA60: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CAA14 - - thumb_func_start sub_80CAA74 -sub_80CAA74: @ 80CAA74 - push {r4,lr} - movs r4, 0x1 -_080CAA78: - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - negs r1, r0 - orrs r1, r0 - lsrs r1, 31 - adds r0, r4, 0 - bl sub_80CAAA8 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x5 - bls _080CAA78 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CAA74 - - thumb_func_start sub_80CAAA8 -sub_80CAAA8: @ 80CAAA8 - push {r4-r7,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - ldr r7, =gUnknown_085724BC - cmp r1, 0 - beq _080CAAB8 - ldr r7, =gUnknown_085724A4 -_080CAAB8: - subs r0, 0x1 - lsls r1, r0, 1 - adds r1, r0 - adds r1, 0x1 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 18 - movs r1, 0xE0 - lsls r1, 11 - adds r0, r1 - lsrs r3, r0, 16 - movs r0, 0 - ldr r1, =gUnknown_02039D08 - mov r12, r1 -_080CAAD4: - movs r2, 0 - adds r4, r7, 0 - adds r4, 0x8 - adds r5, r3, 0 - adds r5, 0xC - adds r6, r0, 0x1 -_080CAAE0: - mov r0, r12 - ldr r1, [r0] - adds r0, r3, r2 - lsls r0, 1 - adds r1, 0xB0 - adds r1, r0 - lsls r0, r2, 1 - adds r0, r7 - ldrh r0, [r0] - strh r0, [r1] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x3 - bls _080CAAE0 - adds r7, r4, 0 - lsls r0, r5, 16 - lsrs r3, r0, 16 - lsls r0, r6, 16 - lsrs r0, 16 - cmp r0, 0x2 - bls _080CAAD4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CAAA8 - - thumb_func_start sub_80CAB20 -sub_80CAB20: @ 80CAB20 - push {lr} - sub sp, 0x4 - bl sub_80CAA74 - movs r0, 0x16 - str r0, [sp] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0xC - bl sub_80D27AC - movs r0, 0x1 - bl sub_80D2918 - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0x4 - pop {r0} - bx r0 - thumb_func_end sub_80CAB20 - - thumb_func_start sub_80CAB4C -sub_80CAB4C: @ 80CAB4C - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x000002c6 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - movs r0, 0x6 - bl PlaySE - bl sub_80CA7D4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CAB4C - - thumb_func_start sub_80CAB70 -sub_80CAB70: @ 80CAB70 - push {r4,r5,lr} - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r5, =0x000002c6 - adds r0, r5 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080CABAA - cmp r0, 0x1 - bgt _080CAB94 - cmp r0, 0 - beq _080CAB9A - b _080CABD8 - .pool -_080CAB94: - cmp r0, 0x2 - beq _080CABD4 - b _080CABD8 -_080CAB9A: - bl sub_80CA80C - lsls r0, 24 - cmp r0, 0 - bne _080CABD8 - bl sub_80CDBA0 - b _080CABC4 -_080CABAA: - bl sub_80CD554 - lsls r0, 24 - cmp r0, 0 - bne _080CABD8 - ldr r0, [r4] - ldr r1, =0x00000cea - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080CABC4 - bl BoxSetMosaic -_080CABC4: - ldr r1, [r4] - adds r1, r5 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080CABD8 - .pool -_080CABD4: - movs r0, 0 - b _080CABDA -_080CABD8: - movs r0, 0x1 -_080CABDA: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80CAB70 - - thumb_func_start sub_80CABE0 -sub_80CABE0: @ 80CABE0 - push {r4,lr} - ldr r4, =gUnknown_02039D10 - bl StorageGetCurrentBox - ldrb r1, [r4] - lsls r0, 24 - lsrs r0, 24 - cmp r1, r0 - beq _080CAC0A - ldr r0, =0x000008d7 - bl FlagClear - ldr r4, =0x00004036 - bl StorageGetCurrentBox - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl VarSet -_080CAC0A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CABE0 - - thumb_func_start sub_80CAC1C -sub_80CAC1C: @ 80CAC1C - push {lr} - sub sp, 0xC - movs r1, 0xE8 - lsls r1, 5 - movs r0, 0x8 - bl SetGpuReg - movs r0, 0x1 - movs r1, 0x2 - movs r2, 0xD0 - bl LoadUserWindowBorderGfx - movs r0, 0x20 - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0xC - pop {r0} - bx r0 - thumb_func_end sub_80CAC1C - - thumb_func_start sub_80CAC58 -sub_80CAC58: @ 80CAC58 - push {r4-r6,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r6, r0, 24 - bl DynamicPlaceholderTextUtil_Reset - ldr r1, =gUnknown_0857276C - lsls r0, r6, 3 - adds r0, r1 - ldrb r0, [r0, 0x4] - cmp r0, 0x7 - bhi _080CAD30 - lsls r0, 2 - ldr r1, =_080CAC84 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080CAC84: - .4byte _080CAD30 - .4byte _080CACA4 - .4byte _080CACA4 - .4byte _080CACA4 - .4byte _080CACB8 - .4byte _080CACB8 - .4byte _080CACB8 - .4byte _080CACD0 -_080CACA4: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r0, =0x00000cee - adds r1, r0 - b _080CACC0 - .pool -_080CACB8: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x000021e0 - adds r1, r2 -_080CACC0: - movs r0, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - b _080CAD30 - .pool -_080CACD0: - bl sub_80D127C - lsls r0, 24 - cmp r0, 0 - beq _080CACF4 - ldr r0, =gUnknown_02039D08 - ldr r4, [r0] - ldr r0, =0x000021eb - adds r4, r0 - bl sub_80D12B8 - adds r1, r0, 0 - adds r0, r4, 0 - b _080CAD00 - .pool -_080CACF4: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x000021eb - adds r0, r1, r2 - ldr r2, =0x00000d65 - adds r1, r2 -_080CAD00: - bl StringCopy - adds r2, r0, 0 - b _080CAD16 - .pool -_080CAD14: - adds r2, r1, 0 -_080CAD16: - subs r1, r2, 0x1 - ldrb r0, [r1] - cmp r0, 0 - beq _080CAD14 - movs r0, 0xFF - strb r0, [r2] - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r0, =0x000021eb - adds r1, r0 - movs r0, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr -_080CAD30: - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - ldr r4, =0x00002190 - adds r0, r4 - ldr r2, =gUnknown_0857276C - lsls r1, r6, 3 - adds r1, r2 - ldr r1, [r1] - bl DynamicPlaceholderTextUtil_ExpandPlaceholders - movs r0, 0x1 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r2, [r5] - adds r2, r4 - movs r0, 0x1 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - movs r0, 0x1 - movs r1, 0x2 - movs r2, 0xE - bl sub_8098858 - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0x1 - movs r1, 0x2 - bl CopyWindowToVram - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CAC58 - - thumb_func_start sub_80CAD9C -sub_80CAD9C: @ 80CAD9C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_08572864 - movs r1, 0xB - movs r2, 0xE - movs r3, 0 - bl CreateYesNoMenu - lsls r4, 24 - asrs r4, 24 - adds r0, r4, 0 - bl MoveMenuCursorNoWrapAround - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CAD9C - - thumb_func_start sub_80CADC4 -sub_80CADC4: @ 80CADC4 - push {lr} - movs r0, 0x1 - movs r1, 0 - bl sub_8198070 - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - pop {r0} - bx r0 - thumb_func_end sub_80CADC4 - - thumb_func_start sub_80CADD8 -sub_80CADD8: @ 80CADD8 - push {lr} - bl sub_80CFEF0 - movs r0, 0x12 - bl sub_80CFF34 - movs r0, 0x13 - bl sub_80CFF34 - movs r0, 0x14 - bl sub_80CFF34 - movs r0, 0x15 - bl sub_80CFF34 - bl IsWaldaWallpaperUnlocked - cmp r0, 0 - beq _080CAE04 - movs r0, 0x16 - bl sub_80CFF34 -_080CAE04: - bl sub_80CFFD0 - pop {r0} - bx r0 - thumb_func_end sub_80CADD8 - - thumb_func_start sub_80CAE0C -sub_80CAE0C: @ 80CAE0C - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - bl sub_80CFEF0 - cmp r4, 0x1 - beq _080CAE4A - cmp r4, 0x1 - bgt _080CAE26 - cmp r4, 0 - beq _080CAE30 - b _080CAE96 -_080CAE26: - cmp r5, 0x2 - beq _080CAE64 - cmp r5, 0x3 - beq _080CAE7E - b _080CAE96 -_080CAE30: - movs r0, 0x17 - bl sub_80CFF34 - movs r0, 0x18 - bl sub_80CFF34 - movs r0, 0x19 - bl sub_80CFF34 - movs r0, 0x1A - bl sub_80CFF34 - b _080CAE96 -_080CAE4A: - movs r0, 0x1B - bl sub_80CFF34 - movs r0, 0x1C - bl sub_80CFF34 - movs r0, 0x1D - bl sub_80CFF34 - movs r0, 0x1E - bl sub_80CFF34 - b _080CAE96 -_080CAE64: - movs r0, 0x1F - bl sub_80CFF34 - movs r0, 0x20 - bl sub_80CFF34 - movs r0, 0x21 - bl sub_80CFF34 - movs r0, 0x22 - bl sub_80CFF34 - b _080CAE96 -_080CAE7E: - movs r0, 0x23 - bl sub_80CFF34 - movs r0, 0x24 - bl sub_80CFF34 - movs r0, 0x25 - bl sub_80CFF34 - movs r0, 0x26 - bl sub_80CFF34 -_080CAE96: - bl sub_80CFFD0 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80CAE0C - - thumb_func_start sub_80CAEA0 -sub_80CAEA0: @ 80CAEA0 - ldr r0, =gUnknown_02039D0D - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80CAEA0 - - thumb_func_start sub_80CAEAC -sub_80CAEAC: @ 80CAEAC - push {lr} - bl sub_80CEADC - lsls r0, 24 - cmp r0, 0 - bne _080CAEE8 - ldr r0, =gUnknown_02039D0C - ldrb r0, [r0] - cmp r0, 0 - beq _080CAED8 - bl sub_80CFE08 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x1 - bl sub_80D0D8C - b _080CAEE8 - .pool -_080CAED8: - bl sub_80CFE08 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0 - bl sub_80D0D8C -_080CAEE8: - ldr r1, =gUnknown_02039D12 - ldrh r0, [r1] - cmp r0, 0 - beq _080CAEFA - bl sub_80D0F38 - movs r0, 0x3 - bl sub_80CFE54 -_080CAEFA: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CAEAC - - thumb_func_start sub_80CAF04 -sub_80CAF04: @ 80CAF04 - push {r4-r6,lr} - bl LoadMonIconPalettes - movs r2, 0 - ldr r3, =gUnknown_02039D08 - ldr r5, =0x00000b08 - movs r4, 0 - adds r6, r3, 0 -_080CAF14: - ldr r0, [r3] - lsls r1, r2, 1 - adds r0, r5 - adds r0, r1 - strh r4, [r0] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x27 - bls _080CAF14 - movs r2, 0 - ldr r5, =gUnknown_02039D08 - ldr r4, =0x00000b58 - movs r3, 0 -_080CAF30: - ldr r0, [r5] - lsls r1, r2, 1 - adds r0, r4 - adds r0, r1 - strh r3, [r0] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x27 - bls _080CAF30 - movs r2, 0 - ldr r5, =gUnknown_02039D08 - movs r4, 0xA7 - lsls r4, 4 - movs r3, 0 -_080CAF4E: - ldr r0, [r5] - lsls r1, r2, 2 - adds r0, r4 - adds r0, r1 - str r3, [r0] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x5 - bls _080CAF4E - movs r2, 0 - ldr r5, =gUnknown_02039D08 - ldr r4, =0x00000a88 - movs r3, 0 -_080CAF6A: - ldr r0, [r5] - lsls r1, r2, 2 - adds r0, r4 - adds r0, r1 - str r3, [r0] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x1D - bls _080CAF6A - ldr r0, [r6] - ldr r2, =0x00000a6c - adds r1, r0, r2 - movs r2, 0 - str r2, [r1] - ldr r1, =0x0000078c - adds r0, r1 - strh r2, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CAF04 - - thumb_func_start sub_80CAFAC -sub_80CAFAC: @ 80CAFAC - push {lr} - bl sub_80CEB24 - 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 sub_80CC54C -sub_80CC54C: @ 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 sub_80CC54C - - 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 sub_80CC680 -sub_80CC680: @ 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 sub_80CC680 - - thumb_func_start sub_80CC6B0 -sub_80CC6B0: @ 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 sub_80CC6B0 - - 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 sub_80CEADC - 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, =gUnknown_02039D78 - movs r0, 0 - strb r0, [r1] - b _080CD38C - .pool -_080CD388: - ldr r0, =gUnknown_02039D78 - strb r1, [r0] -_080CD38C: - ldr r0, =gUnknown_02039D79 - movs r1, 0 - strb r1, [r0] - ldr r0, =gUnknown_02039D7A - strb r1, [r0] - ldr r0, =gUnknown_02039D7B - strb r1, [r0] - ldr r0, =gUnknown_02039D7C - strb r1, [r0] - ldr r0, =gUnknown_02039D7D - 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, =gUnknown_02039D7A - 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, =gUnknown_02039D7A - 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, =gUnknown_02039D78 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - beq _080CD538 - cmp r0, 0x1 - bne _080CD54C - ldr r0, =gUnknown_02039D79 - 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, =gUnknown_02039D79 - 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, =gUnknown_02039D7A - 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, =gUnknown_02039D78 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _080CD930 - ldr r0, =gUnknown_02039D79 - ldrb r1, [r0] - movs r0, 0 - bl sub_80D0E50 - b _080CD93E - .pool -_080CD930: - cmp r0, 0x1 - bne _080CD93E - ldr r0, =gUnknown_02039D79 - 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, =gUnknown_02039D78 - 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, =gUnknown_02039D78 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _080CDA56 - ldr r0, =gUnknown_02039D7A - 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, =gUnknown_02039D78 - ldr r4, =gUnknown_02039D08 - ldr r2, [r4] - ldr r3, =0x00000cd4 - adds r0, r2, r3 - ldrb r0, [r0] - strb r0, [r1] - ldr r1, =gUnknown_02039D79 - 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, =gUnknown_02039D7A - 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, =gUnknown_02039D78 - 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, =gUnknown_02039D7A - 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, =gUnknown_02039D79 - 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, =gUnknown_02039D7A - 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, =gUnknown_02039D78 - 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, =gUnknown_02039D79 - 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, =gUnknown_02039D79 - 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, =gUnknown_02039D78 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - beq _080CDF68 - cmp r0, 0x1 - bne _080CDF94 - ldr r4, =gUnknown_02039D79 - 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, =gUnknown_02039D79 - ldrb r1, [r4] - bl sub_80CE018 - ldrb r1, [r4] - movs r0, 0x1 - bl sub_80CBC14 -_080CDF8E: - ldr r1, =gUnknown_02039D7A - 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, =gUnknown_02039D78 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - beq _080CDFDC - cmp r0, 0x1 - bne _080CDFFE - ldr r4, =gUnknown_02039D79 - 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, =gUnknown_02039D79 - ldrb r1, [r5] - adds r0, r4, 0 - bl diegohint2 - ldrb r1, [r5] - adds r0, r4, 0 - bl sub_80CBCAC -_080CDFF8: - ldr r1, =gUnknown_02039D7A - 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, =gUnknown_02039D79 - 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, =gUnknown_02039D7B - strb r4, [r0] - ldr r0, =gUnknown_02039D7C - 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, =gUnknown_02039D7B - strb r6, [r0] - ldr r0, =gUnknown_02039D7C - 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, =gUnknown_02039D7A - 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, =gUnknown_02039D79 - 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, =gUnknown_02039D7A - ldrb r0, [r0] - cmp r0, 0 - beq _080CE264 - movs r2, 0x2 - b _080CE274 - .pool -_080CE264: - ldr r0, =gUnknown_02039D78 - 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, =gUnknown_02039D79 - 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, =gUnknown_02039D7A - ldrb r0, [r1] - cmp r0, 0 - beq _080CE2F0 - movs r0, 0 - strb r0, [r1] - b _080CE316 - .pool -_080CE2F0: - ldr r0, =gUnknown_02039D78 - 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, =gUnknown_02039D79 - 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, =gUnknown_02039D7A - 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, =gUnknown_02039D7A - 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, =gUnknown_02039D78 - 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, =gUnknown_02039D79 - 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, =gUnknown_02039D79 - 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, =gUnknown_02039D79 - 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, =gUnknown_02039D7A - 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} - ldr r0, =gUnknown_02039D7A - ldrb r0, [r0] - cmp r0, 0 - beq _080CE77A - ldr r0, =gUnknown_02039D14 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - ldr r2, =0x000020a4 - adds r1, r2 - movs r2, 0x64 - bl memcpy -_080CE77A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE760 - - thumb_func_start sub_80CE790 -sub_80CE790: @ 80CE790 - push {lr} - ldr r0, =gUnknown_02039D7A - ldrb r0, [r0] - cmp r0, 0 - beq _080CE7D8 - ldr r0, =gUnknown_02039D7B - ldrb r0, [r0] - cmp r0, 0xE - bne _080CE7C8 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x000020a4 - adds r0, r1 - ldr r1, =gUnknown_02039D14 - movs r2, 0x64 - bl memcpy - b _080CE7D8 - .pool -_080CE7C8: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x000020a4 - adds r0, r1 - ldr r1, =gUnknown_02039D14 - movs r2, 0x50 - bl memcpy -_080CE7D8: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE790 - - thumb_func_start sub_80CE7E8 -sub_80CE7E8: @ 80CE7E8 - push {r4,r5,lr} - ldr r0, =gUnknown_02039D7A - ldrb r5, [r0] - cmp r5, 0 - beq _080CE838 - bl sub_80CE760 - ldr r3, =gUnknown_02039D08 - ldr r1, [r3] - ldr r0, =0x0000218c - adds r2, r1, r0 - ldr r0, =gUnknown_02039D14 - str r0, [r2] - ldr r2, =0x00002187 - adds r1, r2 - movs r2, 0 - strb r2, [r1] - ldr r0, [r3] - ldr r4, =0x00002186 - adds r0, r4 - strb r2, [r0] - ldr r0, [r3] - ldr r1, =0x00002188 - adds r0, r1 - strb r2, [r0] - b _080CE8CA - .pool -_080CE838: - ldr r0, =gUnknown_02039D78 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - bne _080CE894 - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - ldr r0, =0x0000218c - adds r2, r1, r0 - ldr r0, =gPlayerParty - str r0, [r2] - ldr r0, =gUnknown_02039D79 - ldrb r0, [r0] - ldr r2, =0x00002187 - adds r1, r2 - strb r0, [r1] - bl CountPartyMons - ldr r1, [r4] - subs r0, 0x1 - ldr r2, =0x00002186 - adds r1, r2 - strb r0, [r1] - ldr r0, [r4] - ldr r4, =0x00002188 - adds r0, r4 - strb r5, [r0] - b _080CE8CA - .pool -_080CE894: - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl GetBoxedMonPtr - ldr r3, =gUnknown_02039D08 - ldr r2, [r3] - ldr r4, =0x0000218c - adds r1, r2, r4 - str r0, [r1] - ldr r0, =gUnknown_02039D79 - ldrb r0, [r0] - ldr r1, =0x00002187 - adds r2, r1 - strb r0, [r2] - ldr r0, [r3] - ldr r2, =0x00002186 - adds r0, r2 - movs r1, 0x1D - strb r1, [r0] - ldr r0, [r3] - subs r4, 0x4 - adds r0, r4 - movs r1, 0x2 - strb r1, [r0] -_080CE8CA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE7E8 - - thumb_func_start sub_80CE8E4 -sub_80CE8E4: @ 80CE8E4 - push {lr} - ldr r0, =gUnknown_02039D7A - ldrb r0, [r0] - cmp r0, 0 - beq _080CE8F8 - bl sub_80CE790 - b _080CE900 - .pool -_080CE8F8: - ldr r0, =gUnknown_02039D79 - ldr r1, =gUnknown_0203CF20 - ldrb r1, [r1] - strb r1, [r0] -_080CE900: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE8E4 - - thumb_func_start CompactPartySlots -CompactPartySlots: @ 80CE90C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r7, =0x0000ffff - movs r6, 0 - movs r5, 0 - movs r0, 0x64 - mov r9, r0 - ldr r1, =gPlayerParty - mov r8, r1 - subs r0, 0x65 - mov r10, r0 -_080CE928: - mov r0, r9 - muls r0, r6 - mov r1, r8 - adds r4, r0, r1 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - cmp r0, 0 - beq _080CE960 - cmp r6, r5 - beq _080CE950 - mov r0, r9 - muls r0, r5 - add r0, r8 - adds r1, r4, 0 - movs r2, 0x64 - bl memcpy -_080CE950: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - b _080CE96A - .pool -_080CE960: - lsls r0, r7, 16 - asrs r0, 16 - cmp r0, r10 - bne _080CE96A - adds r7, r6, 0 -_080CE96A: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x5 - bls _080CE928 - lsls r7, 16 - cmp r5, 0x5 - bhi _080CE992 - movs r6, 0x64 - ldr r4, =gPlayerParty -_080CE97E: - adds r0, r5, 0 - muls r0, r6 - adds r0, r4 - bl ZeroMonData - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x5 - bls _080CE97E -_080CE992: - asrs r0, r7, 16 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end CompactPartySlots - - thumb_func_start sub_80CE9A8 -sub_80CE9A8: @ 80CE9A8 - push {r4,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - strb r0, [r1] - ldr r2, =gUnknown_02039D08 - ldr r1, [r2] - ldr r3, =0x00000ceb - adds r1, r3 - strb r0, [r1] - ldr r0, =gUnknown_02039D7A - ldrb r0, [r0] - cmp r0, 0 - beq _080CE9E8 - ldr r0, [r2] - ldr r1, =0x000020a4 - adds r0, r1 - movs r1, 0x8 - mov r2, sp - bl SetMonData - b _080CEA1C - .pool -_080CE9E8: - ldr r4, =gUnknown_02039D78 - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0x1 - bne _080CEA08 - ldr r0, =gUnknown_02039D79 - movs r1, 0 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x8 - mov r2, sp - bl SetMonData -_080CEA08: - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0 - bne _080CEA1C - ldr r0, =gUnknown_02039D79 - ldrb r0, [r0] - movs r1, 0x8 - mov r2, sp - bl SetBoxMonDataFromSelectedBox -_080CEA1C: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE9A8 - - thumb_func_start sub_80CEA30 -sub_80CEA30: @ 80CEA30 - push {lr} - ldr r0, =gUnknown_02039D78 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - bne _080CEA64 - ldr r0, =gUnknown_02039D7A - ldrb r0, [r0] - cmp r0, 0 - bne _080CEA64 - ldr r0, =gUnknown_02039D79 - ldrb r0, [r0] - bl CountPartyAliveNonEggMonsExcept - lsls r0, 24 - cmp r0, 0 - bne _080CEA64 - movs r0, 0x1 - b _080CEA66 - .pool -_080CEA64: - movs r0, 0 -_080CEA66: - pop {r1} - bx r1 - thumb_func_end sub_80CEA30 - - thumb_func_start sub_80CEA6C -sub_80CEA6C: @ 80CEA6C - push {lr} - ldr r0, =gUnknown_02039D7A - ldrb r0, [r0] - cmp r0, 0 - beq _080CEAC8 - ldr r0, =gUnknown_02039D78 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - bne _080CEAAC - ldr r0, =gUnknown_02039D79 - ldrb r0, [r0] - bl CountPartyAliveNonEggMonsExcept - lsls r0, 24 - cmp r0, 0 - bne _080CEAAC - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x00000ced - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080CEAC8 - ldr r2, =0x000020a4 - adds r0, r1, r2 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - beq _080CEAC8 -_080CEAAC: - movs r0, 0x1 - b _080CEACA - .pool -_080CEAC8: - movs r0, 0 -_080CEACA: - pop {r1} - bx r1 - thumb_func_end sub_80CEA6C - - thumb_func_start sub_80CEAD0 -sub_80CEAD0: @ 80CEAD0 - ldr r0, =gUnknown_02039D7A - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80CEAD0 - - thumb_func_start sub_80CEADC -sub_80CEADC: @ 80CEADC - push {lr} - movs r1, 0 - ldr r0, =gUnknown_02039D78 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x2 - bne _080CEAEE - movs r1, 0x1 -_080CEAEE: - adds r0, r1, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CEADC - - thumb_func_start sub_80CEAF8 -sub_80CEAF8: @ 80CEAF8 - push {lr} - movs r1, 0 - ldr r0, =gUnknown_02039D78 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x3 - bne _080CEB16 - ldr r0, =gUnknown_02039D79 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - bne _080CEB16 - movs r1, 0x1 -_080CEB16: - adds r0, r1, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CEAF8 - - thumb_func_start sub_80CEB24 -sub_80CEB24: @ 80CEB24 - push {lr} - movs r1, 0 - ldr r0, =gUnknown_02039D78 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _080CEB36 - movs r1, 0x1 -_080CEB36: - adds r0, r1, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CEB24 - - thumb_func_start sub_80CEB40 -sub_80CEB40: @ 80CEB40 - push {r4,lr} - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r2, 0 - ldr r3, =gUnknown_02039D7A - ldrb r0, [r3] - cmp r0, 0 - bne _080CEB52 - movs r2, 0x1 -_080CEB52: - ldr r4, =0x00000cea - adds r0, r1, r4 - strb r2, [r0] - ldrb r0, [r3] - cmp r0, 0 - bne _080CEBD0 - ldr r0, =gUnknown_02039D78 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - beq _080CEB8A - cmp r0, 0x1 - bgt _080CEB84 - cmp r0, 0 - beq _080CEBBA - b _080CEBD0 - .pool -_080CEB84: - cmp r0, 0x3 - bgt _080CEBD0 - b _080CEBB0 -_080CEB8A: - ldr r1, =gUnknown_02039D79 - movs r0, 0 - ldrsb r0, [r1, r0] - cmp r0, 0x5 - bgt _080CEBB0 - adds r1, r0, 0 - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0 - bl sub_80CEC00 - b _080CEBD0 - .pool -_080CEBB0: - movs r0, 0 - movs r1, 0x2 - bl sub_80CEC00 - b _080CEBD0 -_080CEBBA: - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02039D79 - ldrb r1, [r1] - bl GetBoxedMonPtr - movs r1, 0x1 - bl sub_80CEC00 -_080CEBD0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CEB40 - - thumb_func_start sub_80CEBDC -sub_80CEBDC: @ 80CEBDC - push {lr} - ldr r0, =gUnknown_02039D7A - ldrb r0, [r0] - cmp r0, 0 - beq _080CEBF8 - ldr r0, =gUnknown_02039D14 - movs r1, 0 - bl sub_80CEC00 - b _080CEBFC - .pool -_080CEBF8: - bl sub_80CEB40 -_080CEBFC: - pop {r0} - bx r0 - thumb_func_end sub_80CEBDC - - thumb_func_start sub_80CEC00 -sub_80CEC00: @ 80CEC00 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - adds r4, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r5, r1, 0 - ldr r0, =gUnknown_02039D08 - mov r8, r0 - ldr r1, [r0] - ldr r3, =0x00000ce6 - adds r2, r1, r3 - movs r0, 0 - strh r0, [r2] - mov r9, r0 - mov r10, r0 - cmp r5, 0 - bne _080CED18 - adds r6, r4, 0 - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - mov r2, r8 - ldr r1, [r2] - ldr r3, =0x00000ce4 - adds r1, r3 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - bne _080CEC44 - b _080CEE34 -_080CEC44: - adds r0, r4, 0 - movs r1, 0x4 - bl GetMonData - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - cmp r0, 0 - beq _080CEC74 - mov r1, r8 - ldr r0, [r1] - ldr r2, =0x00000ced - adds r0, r2 - movs r1, 0x1 - strb r1, [r0] - b _080CEC86 - .pool -_080CEC74: - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - mov r3, r8 - ldr r1, [r3] - ldr r2, =0x00000ced - adds r1, r2 - strb r0, [r1] -_080CEC86: - ldr r4, =gUnknown_02039D08 - ldr r2, [r4] - ldr r5, =0x00000cee - adds r2, r5 - adds r0, r6, 0 - movs r1, 0x2 - bl GetMonData - ldr r0, [r4] - adds r0, r5 - bl StringGetEnd10 - adds r0, r6, 0 - movs r1, 0x38 - bl GetMonData - ldr r1, [r4] - ldr r3, =0x00000cec - adds r1, r3 - strb r0, [r1] - adds r0, r6, 0 - movs r1, 0x8 - bl GetMonData - ldr r1, [r4] - ldr r2, =0x00000ceb - adds r1, r2 - strb r0, [r1] - adds r0, r6, 0 - movs r1, 0 - bl GetMonData - ldr r1, [r4] - movs r3, 0xCE - lsls r3, 4 - adds r1, r3 - str r0, [r1] - adds r0, r6, 0 - bl GetMonFrontSpritePal - ldr r1, [r4] - ldr r2, =0x00000cdc - adds r1, r2 - str r0, [r1] - adds r0, r6, 0 - bl GetMonGender - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - adds r0, r6, 0 - movs r1, 0xC - bl GetMonData - ldr r1, [r4] - ldr r3, =0x00000ce6 - adds r1, r3 - strh r0, [r1] - b _080CEE26 - .pool -_080CED18: - cmp r5, 0x1 - beq _080CED1E - b _080CEE1C -_080CED1E: - adds r7, r4, 0 - adds r0, r7, 0 - movs r1, 0x41 - bl GetBoxMonData - mov r2, r8 - ldr r1, [r2] - ldr r3, =0x00000ce4 - adds r1, r3 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - bne _080CED3A - b _080CEE34 -_080CED3A: - adds r0, r7, 0 - movs r1, 0x1 - bl GetBoxMonData - mov r9, r0 - adds r0, r7, 0 - movs r1, 0x4 - bl GetBoxMonData - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - cmp r0, 0 - beq _080CED6C - mov r1, r8 - ldr r0, [r1] - ldr r2, =0x00000ced - adds r0, r2 - strb r5, [r0] - b _080CED7E - .pool -_080CED6C: - adds r0, r7, 0 - movs r1, 0x2D - bl GetBoxMonData - mov r3, r8 - ldr r1, [r3] - ldr r2, =0x00000ced - adds r1, r2 - strb r0, [r1] -_080CED7E: - ldr r5, =gUnknown_02039D08 - ldr r2, [r5] - ldr r4, =0x00000cee - adds r2, r4 - adds r0, r7, 0 - movs r1, 0x2 - bl GetBoxMonData - ldr r0, [r5] - adds r0, r4 - bl StringGetEnd10 - adds r0, r7, 0 - bl GetLevelFromBoxMonExp - ldr r1, [r5] - ldr r3, =0x00000cec - adds r1, r3 - strb r0, [r1] - adds r0, r7, 0 - movs r1, 0x8 - bl GetBoxMonData - ldr r1, [r5] - ldr r2, =0x00000ceb - adds r1, r2 - strb r0, [r1] - adds r0, r7, 0 - movs r1, 0 - bl GetBoxMonData - adds r2, r0, 0 - ldr r1, [r5] - movs r6, 0xCE - lsls r6, 4 - adds r0, r1, r6 - str r2, [r0] - subs r4, 0xA - adds r1, r4 - ldrh r0, [r1] - mov r1, r9 - bl GetFrontSpritePalFromSpeciesAndPersonality - ldr r1, [r5] - ldr r3, =0x00000cdc - adds r2, r1, r3 - str r0, [r2] - adds r4, r1, r4 - ldrh r0, [r4] - adds r1, r6 - ldr r1, [r1] - bl GetGenderFromSpeciesAndPersonality - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - adds r0, r7, 0 - movs r1, 0xC - bl GetBoxMonData - ldr r1, [r5] - ldr r2, =0x00000ce6 - adds r1, r2 - strh r0, [r1] - b _080CEE26 - .pool -_080CEE1C: - ldr r3, =0x00000ce4 - adds r0, r1, r3 - mov r1, r9 - strh r1, [r0] - strh r1, [r2] -_080CEE26: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x00000ce4 - adds r0, r1, r2 - ldrh r2, [r0] - cmp r2, 0 - bne _080CEE94 -_080CEE34: - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r3, =0x00000cee - adds r0, r3 - movs r1, 0 - movs r2, 0x5 - bl StringFill - ldr r0, [r4] - ldr r1, =0x00000cf9 - adds r0, r1 - movs r1, 0 - movs r2, 0x8 - bl StringFill - ldr r0, [r4] - ldr r2, =0x00000d1d - adds r0, r2 - movs r1, 0 - movs r2, 0x8 - bl StringFill - ldr r0, [r4] - ldr r3, =0x00000d41 - adds r0, r3 - movs r1, 0 - movs r2, 0x8 - bl StringFill - ldr r0, [r4] - ldr r1, =0x00000d65 - adds r0, r1 - b _080CEEF2 - .pool -_080CEE94: - ldr r3, =0x00000ced - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, 0 - beq _080CEF14 - mov r0, r10 - cmp r0, 0 - beq _080CEEC0 - ldr r2, =0x00000cf9 - adds r0, r1, r2 - adds r3, 0x1 - adds r1, r3 - movs r2, 0 - movs r3, 0x5 - bl StringCopyPadded - b _080CEECE - .pool -_080CEEC0: - ldr r2, =0x00000cf9 - adds r0, r1, r2 - ldr r1, =gText_EggNickname - movs r2, 0 - movs r3, 0x8 - bl StringCopyPadded -_080CEECE: - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r3, =0x00000d1d - adds r0, r3 - movs r1, 0 - movs r2, 0x8 - bl StringFill - ldr r0, [r4] - ldr r1, =0x00000d41 - adds r0, r1 - movs r1, 0 - movs r2, 0x8 - bl StringFill - ldr r0, [r4] - ldr r2, =0x00000d65 - adds r0, r2 -_080CEEF2: - movs r1, 0 - movs r2, 0x8 - bl StringFill - b _080CF0B8 - .pool -_080CEF14: - cmp r2, 0x1D - beq _080CEF1C - cmp r2, 0x20 - bne _080CEF20 -_080CEF1C: - movs r3, 0xFF - mov r9, r3 -_080CEF20: - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - ldr r2, =0x00000cf9 - adds r0, r1, r2 - ldr r3, =0x00000cee - adds r1, r3 - movs r2, 0 - movs r3, 0x5 - bl StringCopyPadded - ldr r1, [r4] - ldr r0, =0x00000d1d - adds r2, r1, r0 - movs r0, 0xBA - strb r0, [r2] - ldr r3, =0x00000d1e - adds r2, r1, r3 - ldr r0, [r4] - ldr r1, =0x00000ce4 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0xB - muls r1, r0 - ldr r0, =gSpeciesNames - adds r1, r0 - adds r0, r2, 0 - movs r2, 0 - movs r3, 0x5 - bl StringCopyPadded - ldr r4, [r4] - ldr r3, =0x00000d41 - adds r2, r4, r3 - movs r0, 0xFC - strb r0, [r2] - ldr r0, =0x00000d42 - adds r2, r4, r0 - movs r0, 0x4 - strb r0, [r2] - ldr r1, =0x00000d43 - adds r2, r4, r1 - mov r3, r9 - cmp r3, 0 - beq _080CEFD4 - cmp r3, 0xFE - beq _080CF000 - movs r0, 0x2 - strb r0, [r2] - ldr r0, =0x00000d44 - adds r2, r4, r0 - movs r0, 0x1 - strb r0, [r2] - adds r1, 0x2 - adds r2, r4, r1 - movs r0, 0x3 - strb r0, [r2] - ldr r3, =0x00000d46 - adds r2, r4, r3 - movs r0, 0x77 - strb r0, [r2] - ldr r0, =0x00000d47 - adds r2, r4, r0 - b _080CF020 - .pool -_080CEFD4: - strb r0, [r2] - ldr r1, =0x00000d44 - adds r2, r4, r1 - movs r0, 0x1 - strb r0, [r2] - ldr r3, =0x00000d45 - adds r2, r4, r3 - movs r0, 0x5 - strb r0, [r2] - ldr r0, =0x00000d46 - adds r2, r4, r0 - movs r0, 0xB5 - strb r0, [r2] - adds r1, 0x3 - adds r2, r4, r1 - b _080CF020 - .pool -_080CF000: - movs r0, 0x6 - strb r0, [r2] - ldr r3, =0x00000d44 - adds r2, r4, r3 - movs r0, 0x1 - strb r0, [r2] - ldr r0, =0x00000d45 - adds r2, r4, r0 - movs r0, 0x7 - strb r0, [r2] - ldr r1, =0x00000d46 - adds r2, r4, r1 - movs r0, 0xB6 - strb r0, [r2] - adds r3, 0x3 - adds r2, r4, r3 -_080CF020: - movs r0, 0xFC - strb r0, [r2] - adds r2, 0x1 - movs r0, 0x4 - strb r0, [r2] - adds r2, 0x1 - movs r0, 0x2 - strb r0, [r2] - adds r2, 0x1 - movs r0, 0x1 - strb r0, [r2] - adds r2, 0x1 - movs r0, 0x3 - strb r0, [r2] - adds r2, 0x1 - movs r5, 0 - strb r5, [r2] - adds r2, 0x1 - movs r0, 0xF9 - strb r0, [r2] - adds r2, 0x1 - movs r0, 0x5 - strb r0, [r2] - adds r2, 0x1 - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r1, =0x00000cec - adds r0, r1 - ldrb r1, [r0] - adds r0, r2, 0 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r2, r0, 0 - strb r5, [r2] - movs r0, 0xFF - strb r0, [r2, 0x1] - ldr r4, [r4] - ldr r2, =0x00000ce6 - adds r1, r4, r2 - ldrh r0, [r1] - cmp r0, 0 - beq _080CF0AC - ldr r3, =0x00000d65 - adds r4, r3 - bl ItemId_GetName - adds r1, r0, 0 - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x8 - bl StringCopyPadded - b _080CF0B8 - .pool -_080CF0AC: - ldr r1, =0x00000d65 - adds r0, r4, r1 - movs r1, 0 - movs r2, 0x8 - bl StringFill -_080CF0B8: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CEC00 - - thumb_func_start sub_80CF0CC -sub_80CF0CC: @ 80CF0CC - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x000021ff - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080CF0F4 - cmp r0, 0x1 - ble _080CF0E4 - cmp r0, 0x2 - beq _080CF0FA -_080CF0E4: - bl sub_80CF108 - b _080CF0FE - .pool -_080CF0F4: - bl sub_80CF374 - b _080CF0FE -_080CF0FA: - bl sub_80CF4B0 -_080CF0FE: - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_80CF0CC - - thumb_func_start sub_80CF108 -sub_80CF108: @ 80CF108 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r0, =gUnknown_02039D78 - ldrb r0, [r0] - mov r8, r0 - ldr r2, =gUnknown_02039D79 - ldrb r4, [r2] - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - ldr r1, =0x00000cd2 - mov r10, r1 - add r0, r10 - movs r1, 0 - strb r1, [r0] - ldr r0, [r5] - ldr r7, =0x00000cd3 - adds r0, r7 - strb r1, [r0] - ldr r0, [r5] - ldr r3, =0x00000cd7 - mov r9, r3 - add r0, r9 - strb r1, [r0] - ldr r6, =gMain - ldrh r1, [r6, 0x30] - movs r0, 0x40 - ands r0, r1 - adds r3, r2, 0 - cmp r0, 0 - beq _080CF14C - b _080CF33C -_080CF14C: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080CF1A8 - movs r6, 0x1 - lsls r0, r4, 24 - movs r1, 0xC0 - lsls r1, 19 - adds r0, r1 - lsrs r4, r0, 24 - asrs r0, 24 - cmp r0, 0x1D - bgt _080CF168 - b _080CF358 -_080CF168: - movs r2, 0x3 - mov r8, r2 - subs r0, 0x1E - lsls r0, 24 - asrs r0, 24 - movs r1, 0x3 - bl __divsi3 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, [r5] - add r0, r10 - strb r6, [r0] - ldr r0, [r5] - add r0, r9 - strb r6, [r0] - b _080CF358 - .pool -_080CF1A8: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080CF1DE - movs r6, 0x1 - movs r0, 0 - ldrsb r0, [r3, r0] - movs r1, 0x6 - bl __modsi3 - lsls r0, 24 - cmp r0, 0 - beq _080CF1CA - lsls r0, r4, 24 - movs r3, 0xFF - lsls r3, 24 - b _080CF34C -_080CF1CA: - ldr r0, [r5] - adds r0, r7 - movs r1, 0xFF - strb r1, [r0] - lsls r0, r4, 24 - movs r1, 0xA0 - lsls r1, 19 - adds r0, r1 - lsrs r4, r0, 24 - b _080CF358 -_080CF1DE: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080CF212 - movs r6, 0x1 - movs r0, 0 - ldrsb r0, [r3, r0] - adds r0, 0x1 - movs r1, 0x6 - bl __modsi3 - cmp r0, 0 - beq _080CF204 - lsls r0, r4, 24 - movs r2, 0x80 - lsls r2, 17 - adds r0, r2 - lsrs r4, r0, 24 - b _080CF358 -_080CF204: - ldr r0, [r5] - adds r0, r7 - strb r6, [r0] - lsls r0, r4, 24 - movs r3, 0xFB - lsls r3, 24 - b _080CF34C -_080CF212: - ldrh r1, [r6, 0x2E] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _080CF220 - movs r6, 0x1 - b _080CF352 -_080CF220: - movs r4, 0x1 - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080CF2E4 - bl sub_80CFA5C - lsls r0, 24 - cmp r0, 0 - beq _080CF2E4 - ldr r0, =gUnknown_02039D7D - ldrb r0, [r0] - cmp r0, 0 - bne _080CF244 - movs r0, 0x8 - b _080CF366 - .pool -_080CF244: - ldr r1, [r5] - ldrb r0, [r1, 0x1] - cmp r0, 0x2 - bne _080CF254 - ldr r0, =gUnknown_02039D7A - ldrb r0, [r0] - cmp r0, 0x1 - bne _080CF2D4 -_080CF254: - movs r0, 0 - bl sub_80CFF98 - subs r0, 0x1 - lsls r0, 24 - asrs r0, 24 - cmp r0, 0xE - bhi _080CF2E4 - lsls r0, 2 - ldr r1, =_080CF278 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080CF278: - .4byte _080CF2B4 - .4byte _080CF2B8 - .4byte _080CF2BC - .4byte _080CF2C0 - .4byte _080CF2C4 - .4byte _080CF2E4 - .4byte _080CF2E4 - .4byte _080CF2E4 - .4byte _080CF2E4 - .4byte _080CF2E4 - .4byte _080CF2E4 - .4byte _080CF2C8 - .4byte _080CF2CC - .4byte _080CF2E4 - .4byte _080CF2D0 -_080CF2B4: - movs r0, 0xB - b _080CF366 -_080CF2B8: - movs r0, 0xC - b _080CF366 -_080CF2BC: - movs r0, 0xD - b _080CF366 -_080CF2C0: - movs r0, 0xE - b _080CF366 -_080CF2C4: - movs r0, 0xF - b _080CF366 -_080CF2C8: - movs r0, 0x10 - b _080CF366 -_080CF2CC: - movs r0, 0x11 - b _080CF366 -_080CF2D0: - movs r0, 0x12 - b _080CF366 -_080CF2D4: - ldr r2, =0x000021ff - adds r0, r1, r2 - strb r4, [r0] - movs r0, 0x14 - b _080CF366 - .pool -_080CF2E4: - ldr r2, =gMain - ldrh r1, [r2, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080CF2F8 - movs r0, 0x13 - b _080CF366 - .pool -_080CF2F8: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x13] - cmp r0, 0x1 - bne _080CF326 - ldrh r1, [r2, 0x2C] - movs r0, 0x80 - lsls r0, 2 - ands r0, r1 - cmp r0, 0 - beq _080CF318 - movs r0, 0xA - b _080CF366 - .pool -_080CF318: - movs r0, 0x80 - lsls r0, 1 - ands r0, r1 - cmp r0, 0 - beq _080CF326 - movs r0, 0x9 - b _080CF366 -_080CF326: - ldrh r1, [r2, 0x2E] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080CF338 - bl sub_80CFDC4 - movs r0, 0 - b _080CF366 -_080CF338: - movs r6, 0 - b _080CF364 -_080CF33C: - movs r6, 0x1 - movs r0, 0 - ldrsb r0, [r2, r0] - cmp r0, 0x5 - ble _080CF352 - lsls r0, r4, 24 - movs r3, 0xFA - lsls r3, 24 -_080CF34C: - adds r0, r3 - lsrs r4, r0, 24 - b _080CF358 -_080CF352: - movs r0, 0x2 - mov r8, r0 - movs r4, 0 -_080CF358: - cmp r6, 0 - beq _080CF364 - mov r0, r8 - adds r1, r4, 0 - bl sub_80CD894 -_080CF364: - adds r0, r6, 0 -_080CF366: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80CF108 - - thumb_func_start sub_80CF374 -sub_80CF374: @ 80CF374 - push {r4,lr} - ldr r1, =gMain - ldrh r0, [r1, 0x2C] - movs r4, 0x1 - ands r4, r0 - cmp r4, 0 - beq _080CF428 - ldrh r1, [r1, 0x30] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _080CF3AC - ldr r4, =gUnknown_02039D79 - movs r0, 0 - ldrsb r0, [r4, r0] - movs r1, 0x6 - bl __divsi3 - lsls r0, 24 - cmp r0, 0 - beq _080CF420 - ldrb r1, [r4] - subs r1, 0x6 - b _080CF40E - .pool -_080CF3AC: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080CF3CC - ldr r1, =gUnknown_02039D79 - movs r0, 0 - ldrsb r0, [r1, r0] - adds r0, 0x6 - cmp r0, 0x1D - bgt _080CF420 - ldrb r1, [r1] - adds r1, 0x6 - b _080CF40E - .pool -_080CF3CC: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080CF3F0 - ldr r4, =gUnknown_02039D79 - movs r0, 0 - ldrsb r0, [r4, r0] - movs r1, 0x6 - bl __modsi3 - lsls r0, 24 - cmp r0, 0 - beq _080CF420 - ldrb r1, [r4] - subs r1, 0x1 - b _080CF40E - .pool -_080CF3F0: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080CF424 - ldr r4, =gUnknown_02039D79 - movs r0, 0 - ldrsb r0, [r4, r0] - adds r0, 0x1 - movs r1, 0x6 - bl __modsi3 - cmp r0, 0 - beq _080CF420 - ldrb r1, [r4] - adds r1, 0x1 -_080CF40E: - lsls r1, 24 - lsrs r1, 24 - movs r0, 0 - bl sub_80CD894 - movs r0, 0x15 - b _080CF49C - .pool -_080CF420: - movs r0, 0x18 - b _080CF49C -_080CF424: - movs r0, 0 - b _080CF49C -_080CF428: - bl sub_80D0BA4 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02039D79 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - cmp r0, r1 - beq _080CF47C - ldr r2, =gUnknown_02039D7A - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r3, =0x00000ce4 - adds r0, r1, r3 - ldrh r0, [r0] - negs r0, r0 - lsrs r0, 31 - strb r0, [r2] - ldr r0, =0x000021ff - adds r1, r0 - movs r0, 0x2 - strb r0, [r1] - bl StorageGetCurrentBox - ldr r1, =gUnknown_02039D7B - strb r0, [r1] - movs r0, 0x17 - b _080CF49C - .pool -_080CF47C: - ldr r1, =gUnknown_02039D08 - ldr r0, [r1] - ldr r2, =0x000021ff - adds r0, r2 - strb r4, [r0] - ldr r0, [r1] - ldr r3, =0x00000cb8 - 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, 0x16 -_080CF49C: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CF374 - - thumb_func_start sub_80CF4B0 -sub_80CF4B0: @ 80CF4B0 - push {r4,lr} - ldr r2, =gMain - ldrh r1, [r2, 0x30] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _080CF4DC - movs r0, 0 - bl sub_80D0580 - lsls r0, 24 - cmp r0, 0 - beq _080CF588 - ldr r0, =gUnknown_02039D79 - ldrb r1, [r0] - subs r1, 0x6 - b _080CF53A - .pool -_080CF4DC: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080CF4FC - movs r0, 0x1 - bl sub_80D0580 - lsls r0, 24 - cmp r0, 0 - beq _080CF588 - ldr r0, =gUnknown_02039D79 - ldrb r1, [r0] - adds r1, 0x6 - b _080CF53A - .pool -_080CF4FC: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080CF51C - movs r0, 0x2 - bl sub_80D0580 - lsls r0, 24 - cmp r0, 0 - beq _080CF5A2 - ldr r0, =gUnknown_02039D79 - ldrb r1, [r0] - subs r1, 0x1 - b _080CF53A - .pool -_080CF51C: - movs r0, 0x10 - ands r0, r1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0 - beq _080CF54C - movs r0, 0x3 - bl sub_80D0580 - lsls r0, 24 - cmp r0, 0 - beq _080CF5B6 - ldr r0, =gUnknown_02039D79 - ldrb r1, [r0] - adds r1, 0x1 -_080CF53A: - lsls r1, 24 - lsrs r1, 24 - movs r0, 0 - bl sub_80CD894 - movs r0, 0x19 - b _080CF5BC - .pool -_080CF54C: - ldrh r1, [r2, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080CF580 - bl sub_80D0BC0 - lsls r0, 24 - cmp r0, 0 - beq _080CF588 - ldr r0, =gUnknown_02039D7A - strb r4, [r0] - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x000021ff - adds r0, r1 - strb r4, [r0] - movs r0, 0x1A - b _080CF5BC - .pool -_080CF580: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080CF58C -_080CF588: - movs r0, 0x18 - b _080CF5BC -_080CF58C: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x13] - cmp r0, 0x1 - bne _080CF5BA - ldrh r1, [r2, 0x2C] - movs r0, 0x80 - lsls r0, 2 - ands r0, r1 - cmp r0, 0 - beq _080CF5AC -_080CF5A2: - movs r0, 0xA - b _080CF5BC - .pool -_080CF5AC: - movs r0, 0x80 - lsls r0, 1 - ands r0, r1 - cmp r0, 0 - beq _080CF5BA -_080CF5B6: - movs r0, 0x9 - b _080CF5BC -_080CF5BA: - movs r0, 0 -_080CF5BC: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80CF4B0 - - thumb_func_start sub_80CF5C4 -sub_80CF5C4: @ 80CF5C4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r0, =gUnknown_02039D78 - ldrb r0, [r0] - mov r9, r0 - ldr r6, =gUnknown_02039D79 - ldrb r4, [r6] - ldr r2, =gUnknown_02039D08 - ldr r0, [r2] - ldr r1, =0x00000cd3 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - ldr r0, [r2] - ldr r3, =0x00000cd2 - adds r0, r3 - strb r1, [r0] - ldr r0, [r2] - adds r3, 0x5 - adds r0, r3 - strb r1, [r0] - mov r8, r1 - movs r7, 0 - ldr r1, =gMain - ldrh r3, [r1, 0x30] - movs r0, 0x40 - ands r0, r3 - adds r5, r6, 0 - mov r12, r1 - cmp r0, 0 - beq _080CF608 - b _080CF7A8 -_080CF608: - movs r0, 0x80 - ands r0, r3 - cmp r0, 0 - beq _080CF64C - lsls r0, r4, 24 - movs r1, 0x80 - lsls r1, 17 - adds r0, r1 - lsrs r4, r0, 24 - asrs r0, 24 - cmp r0, 0x6 - ble _080CF622 - movs r4, 0 -_080CF622: - lsls r0, r4, 24 - asrs r0, 24 - movs r1, 0 - ldrsb r1, [r5, r1] - cmp r0, r1 - bne _080CF630 - b _080CF7C6 -_080CF630: - movs r7, 0x1 - b _080CF7CA - .pool -_080CF64C: - movs r0, 0x20 - ands r0, r3 - cmp r0, 0 - beq _080CF670 - ldrb r1, [r5] - movs r0, 0 - ldrsb r0, [r5, r0] - cmp r0, 0 - beq _080CF670 - movs r7, 0x1 - ldr r0, [r2] - ldr r2, =0x00000cd6 - adds r0, r2 - strb r1, [r0] - movs r4, 0 - b _080CF7C6 - .pool -_080CF670: - mov r3, r12 - ldrh r1, [r3, 0x30] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080CF69E - movs r0, 0 - ldrsb r0, [r5, r0] - cmp r0, 0 - bne _080CF694 - movs r7, 0x1 - ldr r0, [r2] - ldr r1, =0x00000cd6 - adds r0, r1 - ldrb r4, [r0] - b _080CF7C6 - .pool -_080CF694: - movs r7, 0x6 - movs r2, 0 - mov r9, r2 - movs r4, 0 - b _080CF7C6 -_080CF69E: - mov r3, r12 - ldrh r1, [r3, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080CF75C - movs r0, 0 - ldrsb r0, [r5, r0] - cmp r0, 0x6 - bne _080CF6C4 - ldr r0, [r2] - ldrb r0, [r0, 0x1] - cmp r0, 0x1 - bne _080CF6BE - movs r0, 0x4 - b _080CF7D8 -_080CF6BE: - movs r0, 0x1 - mov r8, r0 - b _080CF75C -_080CF6C4: - bl sub_80CFA5C - lsls r0, 24 - cmp r0, 0 - beq _080CF75C - ldr r0, =gUnknown_02039D7D - ldrb r0, [r0] - cmp r0, 0 - bne _080CF6E0 - movs r0, 0x8 - b _080CF7D8 - .pool -_080CF6E0: - movs r0, 0 - bl sub_80CFF98 - subs r0, 0x1 - lsls r0, 24 - asrs r0, 24 - cmp r0, 0xE - bhi _080CF75C - lsls r0, 2 - ldr r1, =_080CF700 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080CF700: - .4byte _080CF73C - .4byte _080CF740 - .4byte _080CF744 - .4byte _080CF748 - .4byte _080CF74C - .4byte _080CF75C - .4byte _080CF75C - .4byte _080CF75C - .4byte _080CF75C - .4byte _080CF75C - .4byte _080CF75C - .4byte _080CF750 - .4byte _080CF754 - .4byte _080CF75C - .4byte _080CF758 -_080CF73C: - movs r0, 0xB - b _080CF7D8 -_080CF740: - movs r0, 0xC - b _080CF7D8 -_080CF744: - movs r0, 0xD - b _080CF7D8 -_080CF748: - movs r0, 0xE - b _080CF7D8 -_080CF74C: - movs r0, 0xF - b _080CF7D8 -_080CF750: - movs r0, 0x10 - b _080CF7D8 -_080CF754: - movs r0, 0x11 - b _080CF7D8 -_080CF758: - movs r0, 0x12 - b _080CF7D8 -_080CF75C: - ldr r2, =gMain - ldrh r1, [r2, 0x2E] - movs r0, 0x2 - ands r0, r1 - mov r12, r2 - cmp r0, 0 - beq _080CF784 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x1 - bne _080CF780 - movs r0, 0x13 - b _080CF7D8 - .pool -_080CF780: - movs r1, 0x1 - mov r8, r1 -_080CF784: - mov r2, r8 - cmp r2, 0 - beq _080CF794 - movs r7, 0x6 - movs r3, 0 - mov r9, r3 - movs r4, 0 - b _080CF7C6 -_080CF794: - mov r0, r12 - ldrh r1, [r0, 0x2E] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080CF7C6 - bl sub_80CFDC4 - movs r0, 0 - b _080CF7D8 -_080CF7A8: - lsls r0, r4, 24 - movs r1, 0xFF - lsls r1, 24 - adds r0, r1 - lsrs r4, r0, 24 - cmp r0, 0 - bge _080CF7B8 - movs r4, 0x6 -_080CF7B8: - lsls r0, r4, 24 - asrs r0, 24 - movs r1, 0 - ldrsb r1, [r6, r1] - cmp r0, r1 - beq _080CF7C6 - movs r7, 0x1 -_080CF7C6: - cmp r7, 0 - beq _080CF7D6 -_080CF7CA: - cmp r7, 0x6 - beq _080CF7D6 - mov r0, r9 - adds r1, r4, 0 - bl sub_80CD894 -_080CF7D6: - adds r0, r7, 0 -_080CF7D8: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80CF5C4 - - thumb_func_start sub_80CF7E4 -sub_80CF7E4: @ 80CF7E4 - push {r4-r6,lr} - ldr r3, =gUnknown_02039D08 - ldr r0, [r3] - ldr r1, =0x00000cd3 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - ldr r0, [r3] - ldr r2, =0x00000cd2 - adds r0, r2 - strb r1, [r0] - ldr r0, [r3] - ldr r5, =0x00000cd7 - adds r0, r5 - strb r1, [r0] - ldr r1, =gMain - ldrh r2, [r1, 0x30] - movs r0, 0x40 - ands r0, r2 - cmp r0, 0 - bne _080CF8AA - movs r0, 0x80 - ands r0, r2 - cmp r0, 0 - beq _080CF834 - movs r4, 0x1 - movs r1, 0 - movs r6, 0x2 - b _080CF8B6 - .pool -_080CF834: - ldrh r2, [r1, 0x2C] - movs r0, 0x20 - ands r0, r2 - cmp r0, 0 - bne _080CF85A - movs r0, 0x10 - ands r0, r2 - cmp r0, 0 - bne _080CF86E - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x13] - cmp r0, 0x1 - bne _080CF872 - movs r0, 0x80 - lsls r0, 2 - ands r0, r2 - cmp r0, 0 - beq _080CF864 -_080CF85A: - movs r0, 0xA - b _080CF8D2 - .pool -_080CF864: - movs r0, 0x80 - lsls r0, 1 - ands r0, r2 - cmp r0, 0 - beq _080CF872 -_080CF86E: - movs r0, 0x9 - b _080CF8D2 -_080CF872: - ldrh r1, [r1, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080CF88A - movs r0, 0 - bl sub_80CD1A8 - bl sub_80CFA38 - movs r0, 0x7 - b _080CF8D2 -_080CF88A: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080CF896 - movs r0, 0x13 - b _080CF8D2 -_080CF896: - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080CF8A6 - bl sub_80CFDC4 - movs r0, 0 - b _080CF8D2 -_080CF8A6: - movs r4, 0 - b _080CF8D0 -_080CF8AA: - movs r4, 0x1 - movs r1, 0x3 - movs r6, 0 - ldr r0, [r3] - adds r0, r5 - strb r4, [r0] -_080CF8B6: - cmp r4, 0 - beq _080CF8D0 - lsls r5, r1, 24 - cmp r1, 0x2 - beq _080CF8C6 - movs r0, 0 - bl sub_80CD1A8 -_080CF8C6: - lsrs r0, r5, 24 - lsls r1, r6, 24 - lsrs r1, 24 - bl sub_80CD894 -_080CF8D0: - adds r0, r4, 0 -_080CF8D2: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80CF7E4 - - thumb_func_start sub_80CF8D8 -sub_80CF8D8: @ 80CF8D8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r0, =gUnknown_02039D78 - ldrb r0, [r0] - mov r8, r0 - ldr r0, =gUnknown_02039D79 - mov r12, r0 - ldrb r2, [r0] - ldr r3, =gUnknown_02039D08 - ldr r0, [r3] - ldr r1, =0x00000cd3 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - ldr r0, [r3] - ldr r6, =0x00000cd2 - adds r0, r6 - strb r1, [r0] - ldr r0, [r3] - ldr r5, =0x00000cd7 - adds r0, r5 - strb r1, [r0] - ldr r7, =gMain - ldrh r1, [r7, 0x30] - movs r0, 0x40 - ands r0, r1 - adds r4, r3, 0 - cmp r0, 0 - bne _080CF9B2 - movs r0, 0x88 - ands r0, r1 - cmp r0, 0 - beq _080CF944 - movs r7, 0x1 - movs r0, 0x2 - mov r8, r0 - movs r2, 0 - ldr r0, [r4] - b _080CF9D0 - .pool -_080CF944: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080CF960 - movs r7, 0x1 - lsls r0, r2, 24 - movs r1, 0xFF - lsls r1, 24 - adds r0, r1 - lsrs r2, r0, 24 - cmp r0, 0 - bge _080CF9D4 - movs r2, 0x1 - b _080CF9D4 -_080CF960: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080CF97E - movs r7, 0x1 - lsls r0, r2, 24 - movs r1, 0x80 - lsls r1, 17 - adds r0, r1 - lsrs r2, r0, 24 - asrs r0, 24 - cmp r0, 0x1 - ble _080CF9D4 - movs r2, 0 - b _080CF9D4 -_080CF97E: - ldrh r1, [r7, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080CF992 - movs r0, 0x4 - cmp r2, 0 - bne _080CF9E2 - movs r0, 0x5 - b _080CF9E2 -_080CF992: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080CF99E - movs r0, 0x13 - b _080CF9E2 -_080CF99E: - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080CF9AE - bl sub_80CFDC4 - movs r0, 0 - b _080CF9E2 -_080CF9AE: - movs r7, 0 - b _080CF9E0 -_080CF9B2: - movs r7, 0x1 - movs r0, 0 - mov r8, r0 - ldr r0, [r3] - adds r0, r6 - movs r1, 0xFF - strb r1, [r0] - mov r1, r12 - movs r0, 0 - ldrsb r0, [r1, r0] - movs r2, 0x1D - cmp r0, 0 - bne _080CF9CE - movs r2, 0x18 -_080CF9CE: - ldr r0, [r3] -_080CF9D0: - adds r0, r5 - strb r7, [r0] -_080CF9D4: - cmp r7, 0 - beq _080CF9E0 - mov r0, r8 - adds r1, r2, 0 - bl sub_80CD894 -_080CF9E0: - adds r0, r7, 0 -_080CF9E2: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80CF8D8 - - thumb_func_start sub_80CF9EC -sub_80CF9EC: @ 80CF9EC - push {r4,r5,lr} - movs r3, 0 - ldr r0, =gUnknown_0857B9BC - ldr r1, [r0] - adds r4, r0, 0 - cmp r1, 0 - beq _080CFA30 - ldr r5, =gUnknown_02039D78 -_080CF9FC: - lsls r0, r3, 3 - adds r2, r0, r4 - movs r1, 0x4 - ldrsb r1, [r2, r1] - movs r0, 0 - ldrsb r0, [r5, r0] - cmp r1, r0 - bne _080CFA20 - ldr r0, [r2] - bl _call_via_r0 - lsls r0, 24 - lsrs r0, 24 - b _080CFA32 - .pool -_080CFA20: - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - lsls r0, r3, 3 - adds r0, r4 - ldr r0, [r0] - cmp r0, 0 - bne _080CF9FC -_080CFA30: - movs r0, 0 -_080CFA32: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80CF9EC - - thumb_func_start sub_80CFA38 -sub_80CFA38: @ 80CFA38 - push {lr} - bl sub_80CFEF0 - movs r0, 0x9 - bl sub_80CFF34 - movs r0, 0xA - bl sub_80CFF34 - movs r0, 0xB - bl sub_80CFF34 - movs r0, 0 - bl sub_80CFF34 - pop {r0} - bx r0 - thumb_func_end sub_80CFA38 - - thumb_func_start sub_80CFA5C -sub_80CFA5C: @ 80CFA5C - push {lr} - bl sub_80CFEF0 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080CFA78 - bl sub_80CFB44 - b _080CFA7C - .pool -_080CFA78: - bl sub_80CFA84 -_080CFA7C: - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_80CFA5C - - thumb_func_start sub_80CFA84 -sub_80CFA84: @ 80CFA84 - push {lr} - bl sub_80CD504 - lsls r0, 16 - lsrs r1, r0, 16 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x1 - beq _080CFAAE - cmp r0, 0x1 - bgt _080CFAA8 - cmp r0, 0 - beq _080CFABA - b _080CFAF4 - .pool -_080CFAA8: - cmp r0, 0x2 - beq _080CFAC6 - b _080CFAF4 -_080CFAAE: - cmp r1, 0 - beq _080CFAF4 - movs r0, 0x1 - bl sub_80CFF34 - b _080CFAF8 -_080CFABA: - cmp r1, 0 - beq _080CFAF4 - movs r0, 0x2 - bl sub_80CFF34 - b _080CFAF8 -_080CFAC6: - ldr r0, =gUnknown_02039D7A - ldrb r0, [r0] - cmp r0, 0 - beq _080CFAE8 - cmp r1, 0 - beq _080CFAE0 - movs r0, 0x4 - bl sub_80CFF34 - b _080CFAF8 - .pool -_080CFAE0: - movs r0, 0x5 - bl sub_80CFF34 - b _080CFAF8 -_080CFAE8: - cmp r1, 0 - beq _080CFAF4 - movs r0, 0x3 - bl sub_80CFF34 - b _080CFAF8 -_080CFAF4: - movs r0, 0 - b _080CFB3E -_080CFAF8: - movs r0, 0x6 - bl sub_80CFF34 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x2 - bne _080CFB2A - ldr r0, =gUnknown_02039D78 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _080CFB24 - movs r0, 0x2 - bl sub_80CFF34 - b _080CFB2A - .pool -_080CFB24: - movs r0, 0x1 - bl sub_80CFF34 -_080CFB2A: - movs r0, 0x8 - bl sub_80CFF34 - movs r0, 0x7 - bl sub_80CFF34 - movs r0, 0 - bl sub_80CFF34 - movs r0, 0x1 -_080CFB3E: - pop {r1} - bx r1 - thumb_func_end sub_80CFA84 - - thumb_func_start sub_80CFB44 -sub_80CFB44: @ 80CFB44 - push {r4,r5,lr} - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r5, =0x00000ce4 - adds r0, r5 - ldrh r1, [r0] - movs r0, 0xCE - lsls r0, 1 - cmp r1, r0 - beq _080CFBDA - bl sub_80D127C - lsls r0, 24 - cmp r0, 0 - bne _080CFBAC - ldr r2, [r4] - ldr r0, =0x00000ce6 - adds r1, r2, r0 - ldrh r0, [r1] - cmp r0, 0 - bne _080CFB8C - adds r0, r2, r5 - ldrh r0, [r0] - cmp r0, 0 - beq _080CFBDA - movs r0, 0xE - bl sub_80CFF34 - b _080CFBE4 - .pool -_080CFB8C: - ldrh r0, [r1] - bl ItemIsMail - lsls r0, 24 - cmp r0, 0 - bne _080CFBA4 - movs r0, 0xC - bl sub_80CFF34 - movs r0, 0x10 - bl sub_80CFF34 -_080CFBA4: - movs r0, 0x11 - bl sub_80CFF34 - b _080CFBE4 -_080CFBAC: - ldr r2, [r4] - ldr r0, =0x00000ce6 - adds r1, r2, r0 - ldrh r0, [r1] - cmp r0, 0 - bne _080CFBCC - adds r0, r2, r5 - ldrh r0, [r0] - cmp r0, 0 - beq _080CFBDA - movs r0, 0xD - bl sub_80CFF34 - b _080CFBE4 - .pool -_080CFBCC: - ldrh r0, [r1] - bl ItemIsMail - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080CFBDE -_080CFBDA: - movs r0, 0 - b _080CFBEC -_080CFBDE: - movs r0, 0xF - bl sub_80CFF34 -_080CFBE4: - movs r0, 0 - bl sub_80CFF34 - movs r0, 0x1 -_080CFBEC: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80CFB44 - - thumb_func_start sub_80CFBF4 -sub_80CFBF4: @ 80CFBF4 - 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 r1, [r1] - ldrh r1, [r1, 0x22] - adds r1, 0x14 - strh r1, [r0, 0x22] - bx lr - .pool - thumb_func_end sub_80CFBF4 - - thumb_func_start sub_80CFC14 -sub_80CFC14: @ 80CFC14 - push {r4-r6,lr} - sub sp, 0x2C - mov r1, sp - ldr r0, =gHandCursorSpriteSheets - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - add r4, sp, 0x18 - adds r1, r4, 0 - ldr r0, =gHandCursorSpritePalettes - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldr r0, [r0] - str r0, [r1] - mov r0, sp - bl LoadSpriteSheets - adds r0, r4, 0 - bl LoadSpritePalettes - ldr r0, =0x0000daca - bl IndexOfSpritePaletteTag - ldr r6, =gUnknown_02039D08 - ldr r1, [r6] - ldr r4, =0x00000cd8 - adds r1, r4 - strb r0, [r1] - ldr r0, =0x0000dac7 - bl IndexOfSpritePaletteTag - ldr r1, [r6] - ldr r5, =0x00000cd9 - adds r1, r5 - strb r0, [r1] - ldr r0, =gUnknown_02039D78 - ldrb r0, [r0] - ldr r1, =gUnknown_02039D79 - ldrb r1, [r1] - add r4, sp, 0x28 - mov r5, sp - adds r5, 0x2A - adds r2, r4, 0 - adds r3, r5, 0 - bl sub_80CD444 - ldr r0, =gSpriteTemplate_857BA50 - movs r2, 0 - ldrsh r1, [r4, r2] - movs r3, 0 - ldrsh r2, [r5, r3] - movs r3, 0x6 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _080CFD18 - ldr r2, [r6] - ldr r4, =0x00000cb4 - adds r3, r2, r4 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - str r1, [r3] - ldr r0, =gUnknown_02039D7D - ldr r5, =0x00000cd8 - adds r2, r5 - ldrb r0, [r0] - adds r2, r0 - ldrb r2, [r2] - lsls r2, 4 - ldrb r3, [r1, 0x5] - movs r0, 0xF - ands r0, r3 - orrs r0, r2 - strb r0, [r1, 0x5] - ldr r0, [r6] - adds r0, r4 - ldr 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, =gUnknown_02039D7A - ldrb r0, [r0] - cmp r0, 0 - beq _080CFD22 - ldr r0, [r6] - adds r0, r4 - ldr r0, [r0] - movs r1, 0x3 - bl StartSpriteAnim - b _080CFD22 - .pool -_080CFD18: - ldr r0, [r6] - ldr r1, =0x00000cb4 - adds r0, r1 - movs r1, 0 - str r1, [r0] -_080CFD22: - ldr r0, =gUnknown_02039D78 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - bne _080CFD3C - movs r3, 0xD - movs r4, 0x1 - b _080CFD40 - .pool -_080CFD3C: - movs r3, 0x15 - movs r4, 0x2 -_080CFD40: - ldr r0, =gSpriteTemplate_857BA68 - movs r1, 0 - movs r2, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _080CFDA8 - ldr r5, =gUnknown_02039D08 - ldr r2, [r5] - ldr r3, =0x00000cb8 - adds r2, r3 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - str r1, [r2] - lsls r3, r4, 2 - ldrb r2, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldr r0, =gUnknown_02039D78 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - beq _080CFDB4 - ldr r0, [r5] - ldr r4, =0x00000cb8 - adds r0, r4 - ldr r1, [r0] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - b _080CFDB4 - .pool -_080CFDA8: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r5, =0x00000cb8 - adds r0, r5 - movs r1, 0 - str r1, [r0] -_080CFDB4: - add sp, 0x2C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CFC14 - - thumb_func_start sub_80CFDC4 -sub_80CFDC4: @ 80CFDC4 - push {lr} - ldr r2, =gUnknown_02039D7D - movs r1, 0 - ldrb r0, [r2] - cmp r0, 0 - bne _080CFDD2 - movs r1, 0x1 -_080CFDD2: - strb r1, [r2] - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r3, =0x00000cb4 - adds r1, r0, r3 - ldr r3, [r1] - ldr r1, =0x00000cd8 - adds r0, r1 - ldrb r2, [r2] - adds r0, r2 - ldrb r1, [r0] - lsls r1, 4 - ldrb r2, [r3, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x5] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CFDC4 - - thumb_func_start sub_80CFE08 -sub_80CFE08: @ 80CFE08 - ldr r0, =gUnknown_02039D79 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80CFE08 - - thumb_func_start sub_80CFE14 -sub_80CFE14: @ 80CFE14 - push {r4-r6,lr} - adds r5, r0, 0 - adds r6, r1, 0 - ldr r0, =gUnknown_02039D78 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _080CFE48 - ldr r4, =gUnknown_02039D79 - movs r0, 0 - ldrsb r0, [r4, r0] - movs r1, 0x6 - bl __modsi3 - strb r0, [r5] - movs r0, 0 - ldrsb r0, [r4, r0] - movs r1, 0x6 - bl __divsi3 - b _080CFE4C - .pool -_080CFE48: - movs r0, 0 - strb r0, [r5] -_080CFE4C: - strb r0, [r6] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80CFE14 - - thumb_func_start sub_80CFE54 -sub_80CFE54: @ 80CFE54 - push {lr} - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r2, =0x00000cb4 - adds r0, r2 - ldr r0, [r0] - bl StartSpriteAnim - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CFE54 - - thumb_func_start sub_80CFE78 -sub_80CFE78: @ 80CFE78 - ldr r0, =gUnknown_02039D7B - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80CFE78 - - thumb_func_start sub_80CFE84 -sub_80CFE84: @ 80CFE84 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr 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] - bx lr - .pool - thumb_func_end sub_80CFE84 - - thumb_func_start sub_80CFEA8 -sub_80CFEA8: @ 80CFEA8 - push {lr} - ldr r0, =gUnknown_02039D78 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _080CFEC0 - ldr r0, =gUnknown_02039D79 - ldrb r1, [r0] - movs r0, 0 - bl sub_80D0E50 -_080CFEC0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CFEA8 - - thumb_func_start sub_80CFECC -sub_80CFECC: @ 80CFECC - push {lr} - ldr r0, =gUnknown_02039D78 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _080CFEE4 - ldr r0, =gUnknown_02039D79 - ldrb r1, [r0] - movs r0, 0 - bl sub_80D0D8C -_080CFEE4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CFECC - - thumb_func_start sub_80CFEF0 -sub_80CFEF0: @ 80CFEF0 - ldr r2, =gUnknown_02039D08 - ldr r0, [r2] - ldr r1, =0x00000cac - adds r0, r1 - movs r1, 0 - strb r1, [r0] - ldr r0, [r2] - ldr r3, =0x00000cad - adds r0, r3 - strb r1, [r0] - ldr r0, [r2] - subs r3, 0x41 - adds r0, r3 - strb r1, [r0] - ldr r0, [r2] - ldr r1, =0x00000c71 - adds r0, r1 - movs r1, 0xF - strb r1, [r0] - ldr r0, [r2] - adds r3, 0x6 - adds r0, r3 - movs r1, 0x5C - strh r1, [r0] - bx lr - .pool - thumb_func_end sub_80CFEF0 - - thumb_func_start sub_80CFF34 -sub_80CFF34: @ 80CFF34 - push {r4,r5,lr} - lsls r0, 24 - lsrs r3, r0, 24 - ldr r4, =gUnknown_02039D08 - ldr r2, [r4] - ldr r5, =0x00000cac - adds r1, r2, r5 - ldrb r0, [r1] - cmp r0, 0x6 - bhi _080CFF7E - adds r1, r0, 0 - lsls r1, 3 - ldr r0, =0x00000c74 - adds r1, r0 - adds r1, r2, r1 - ldr r2, =gUnknown_0857BA80 - lsls r0, r3, 2 - adds r0, r2 - ldr r0, [r0] - str r0, [r1] - str r3, [r1, 0x4] - bl StringLength - lsls r0, 24 - lsrs r1, r0, 24 - ldr r0, [r4] - ldr r2, =0x00000cad - adds r0, r2 - ldrb r2, [r0] - cmp r1, r2 - bls _080CFF74 - strb r1, [r0] -_080CFF74: - ldr r1, [r4] - adds r1, r5 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080CFF7E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CFF34 - - thumb_func_start sub_80CFF98 -sub_80CFF98: @ 80CFF98 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r3, =0x00000cac - adds r0, r1, r3 - ldrb r0, [r0] - cmp r2, r0 - bcs _080CFFC8 - lsls r0, r2, 3 - ldr r2, =0x00000c78 - adds r1, r2 - adds r1, r0 - movs r0, 0 - ldrsb r0, [r1, r0] - b _080CFFCC - .pool -_080CFFC8: - movs r0, 0x1 - negs r0, r0 -_080CFFCC: - pop {r1} - bx r1 - thumb_func_end sub_80CFF98 - - thumb_func_start sub_80CFFD0 -sub_80CFFD0: @ 80CFFD0 - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r5, =gUnknown_02039D08 - ldr r1, [r5] - ldr r2, =0x00000cad - adds r0, r1, r2 - ldrb r0, [r0] - adds r0, 0x2 - subs r2, 0x3E - adds r1, r2 - strb r0, [r1] - ldr r1, [r5] - ldr r6, =0x00000cac - adds r0, r1, r6 - ldrb r0, [r0] - lsls r0, 1 - movs r3, 0xC7 - lsls r3, 4 - adds r1, r3 - strb r0, [r1] - ldr r1, [r5] - adds r2, r1, r2 - ldrb r2, [r2] - movs r0, 0x1D - subs r0, r2 - ldr r2, =0x00000c6d - adds r1, r2 - strb r0, [r1] - ldr r1, [r5] - adds r3, r1, r3 - ldrb r2, [r3] - movs r0, 0xF - subs r0, r2 - ldr r3, =0x00000c6e - adds r1, r3 - strb r0, [r1] - ldr r0, [r5] - ldr r1, =0x00000c6c - adds r0, r1 - bl AddWindow - ldr r1, [r5] - movs r4, 0xCB - lsls r4, 4 - adds r1, r4 - movs r2, 0 - mov r8, r2 - strh r0, [r1] - lsls r0, 24 - lsrs r0, 24 - bl ClearWindowTilemap - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0 - movs r2, 0xB - movs r3, 0xE - bl SetWindowBorderStyle - ldr r2, [r5] - adds r0, r2, r4 - ldrb r0, [r0] - adds r1, r2, r6 - ldrb r1, [r1] - ldr r3, =0x00000c74 - adds r2, r3 - bl PrintMenuTable - ldr r1, [r5] - adds r4, r1, r4 - ldrb r0, [r4] - adds r1, r6 - ldrb r1, [r1] - movs r2, 0 - bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - ldr r0, [r5] - ldr r1, =0x00000cae - adds r0, r1 - mov r2, r8 - strb r2, [r0] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CFFD0 - - thumb_func_start sub_80D00A8 -sub_80D00A8: @ 80D00A8 - movs r0, 0 - bx lr - thumb_func_end sub_80D00A8 - - thumb_func_start sub_80D00AC -sub_80D00AC: @ 80D00AC - push {r4,r5,lr} - movs r5, 0x2 - negs r5, r5 - ldr r4, =gMain - ldrh r1, [r4, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _080D0102 - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080D00CE - movs r0, 0x5 - bl PlaySE - adds r5, 0x1 -_080D00CE: - ldrh r1, [r4, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _080D00EC - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - negs r0, r0 - bl MoveMenuCursor - b _080D010A - .pool -_080D00EC: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080D010A - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - bl MoveMenuCursor - b _080D010A -_080D0102: - bl GetMenuCursorPos - lsls r0, 24 - lsrs r5, r0, 24 -_080D010A: - movs r0, 0x2 - negs r0, r0 - cmp r5, r0 - beq _080D0116 - bl sub_80D013C -_080D0116: - cmp r5, 0 - blt _080D0128 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - lsls r1, r5, 3 - ldr r2, =0x00000c78 - adds r0, r2 - adds r0, r1 - ldr r5, [r0] -_080D0128: - lsls r0, r5, 16 - asrs r0, 16 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80D00AC - - thumb_func_start sub_80D013C -sub_80D013C: @ 80D013C - push {r4,r5,lr} - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - movs r4, 0xCB - lsls r4, 4 - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x1 - bl sub_8198070 - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl RemoveWindow - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D013C - - thumb_func_start sub_80D0164 -sub_80D0164: @ 80D0164 - push {r4,lr} - ldr r4, =gUnknown_02039D80 - ldr r0, =0x00000974 - bl Alloc - str r0, [r4] - cmp r0, 0 - beq _080D01B0 - ldr r0, =gUnknown_0857BB1C - bl AddWindow8Bit - adds r1, r0, 0 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - movs r2, 0x88 - lsls r2, 6 - adds r0, r2 - strh r1, [r0] - lsls r0, r1, 16 - lsrs r0, 16 - cmp r0, 0xFF - beq _080D01B0 - lsls r0, r1, 24 - lsrs r0, 24 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x1 - b _080D01B2 - .pool -_080D01B0: - movs r0, 0 -_080D01B2: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80D0164 - - thumb_func_start sub_80D01B8 -sub_80D01B8: @ 80D01B8 - push {lr} - ldr r0, =gUnknown_02039D80 - ldr r0, [r0] - cmp r0, 0 - beq _080D01C6 - bl Free -_080D01C6: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D01B8 - - thumb_func_start sub_80D01D0 -sub_80D01D0: @ 80D01D0 - ldr r2, =gUnknown_02039D80 - ldr r1, [r2] - movs r3, 0 - strb r0, [r1] - ldr r0, [r2] - strb r3, [r0, 0x1] - bx lr - .pool - thumb_func_end sub_80D01D0 - - thumb_func_start sub_80D01E4 -sub_80D01E4: @ 80D01E4 - push {lr} - ldr r0, =gUnknown_02039D80 - ldr r0, [r0] - ldrb r0, [r0] - cmp r0, 0x5 - bhi _080D0244 - lsls r0, 2 - ldr r1, =_080D0204 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080D0204: - .4byte _080D021C - .4byte _080D0222 - .4byte _080D0228 - .4byte _080D022E - .4byte _080D0234 - .4byte _080D023A -_080D021C: - bl sub_80D024C - b _080D023E -_080D0222: - bl sub_80D0344 - b _080D023E -_080D0228: - bl sub_80D03B0 - b _080D023E -_080D022E: - bl sub_80D0420 - b _080D023E -_080D0234: - bl sub_80D04A0 - b _080D023E -_080D023A: - bl sub_80D04C8 -_080D023E: - lsls r0, 24 - lsrs r0, 24 - b _080D0246 -_080D0244: - movs r0, 0 -_080D0246: - pop {r1} - bx r1 - thumb_func_end sub_80D01E4 - - thumb_func_start sub_80D024C -sub_80D024C: @ 80D024C - push {r4-r6,lr} - sub sp, 0x8 - ldr r6, =gUnknown_02039D80 - ldr r1, [r6] - ldrb r0, [r1, 0x1] - cmp r0, 0x1 - beq _080D027C - cmp r0, 0x1 - bgt _080D0268 - cmp r0, 0 - beq _080D026E - b _080D0338 - .pool -_080D0268: - cmp r0, 0x2 - beq _080D0324 - b _080D0338 -_080D026E: - movs r0, 0 - bl HideBg - movs r0, 0x80 - bl sub_80D304C - b _080D030E -_080D027C: - adds r0, r1, 0x2 - adds r1, 0x3 - bl sub_80CFE14 - ldr r1, [r6] - ldrb r0, [r1, 0x2] - strb r0, [r1, 0x4] - ldr r1, [r6] - ldrb r0, [r1, 0x3] - strb r0, [r1, 0x5] - ldr r4, =0xfffffc00 - movs r0, 0 - adds r1, r4, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - adds r1, r4, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - movs r4, 0x88 - lsls r4, 6 - adds r0, r4 - ldrb r0, [r0] - movs r1, 0 - bl FillWindowPixelBuffer8Bit - ldr r1, [r6] - ldrb r0, [r1, 0x2] - ldrb r1, [r1, 0x3] - bl sub_80D07B0 - movs r0, 0 - movs r1, 0x4 - movs r2, 0x1 - bl SetBgAttribute - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x3 - bl CopyWindowToVram8Bit - movs r0, 0xFC - lsls r0, 6 - ldr r2, =0x00007fff - movs r1, 0x8 - bl BlendPalettes - movs r0, 0x2 - bl sub_80CFE54 - movs r0, 0x8 - movs r1, 0x80 - bl SetGpuRegBits -_080D030E: - ldr r1, [r6] - ldrb r0, [r1, 0x1] - adds r0, 0x1 - strb r0, [r1, 0x1] - b _080D0338 - .pool -_080D0324: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _080D0338 - movs r0, 0 - bl ShowBg - movs r0, 0 - b _080D033A -_080D0338: - movs r0, 0x1 -_080D033A: - add sp, 0x8 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80D024C - - thumb_func_start sub_80D0344 -sub_80D0344: @ 80D0344 - push {r4,lr} - ldr r4, =gUnknown_02039D80 - ldr r0, [r4] - ldrb r0, [r0, 0x1] - cmp r0, 0x1 - beq _080D036E - cmp r0, 0x1 - bgt _080D0360 - cmp r0, 0 - beq _080D0366 - b _080D03A8 - .pool -_080D0360: - cmp r0, 0x2 - beq _080D0382 - b _080D03A8 -_080D0366: - movs r0, 0 - bl HideBg - b _080D0378 -_080D036E: - bl sub_80D0B5C - movs r0, 0 - bl sub_80CFE54 -_080D0378: - ldr r1, [r4] - ldrb r0, [r1, 0x1] - adds r0, 0x1 - strb r0, [r1, 0x1] - b _080D03A8 -_080D0382: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _080D03A8 - bl sub_80CFE84 - movs r0, 0x3 - bl stdpal_get - movs r1, 0xD0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0 - bl ShowBg - movs r0, 0 - b _080D03AA -_080D03A8: - movs r0, 0x1 -_080D03AA: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80D0344 - - thumb_func_start sub_80D03B0 -sub_80D03B0: @ 80D03B0 - push {r4,lr} - ldr r4, =gUnknown_02039D80 - ldr r0, [r4] - ldrb r0, [r0, 0x1] - cmp r0, 0 - beq _080D03C8 - cmp r0, 0x1 - beq _080D040C - b _080D0416 - .pool -_080D03C8: - bl sub_80CD554 - lsls r0, 24 - cmp r0, 0 - bne _080D0416 - ldr r1, [r4] - adds r0, r1, 0x6 - adds r1, 0x7 - bl sub_80CFE14 - bl sub_80D062C - ldr r1, [r4] - ldrb r0, [r1, 0x6] - strb r0, [r1, 0x4] - ldr r1, [r4] - ldrb r0, [r1, 0x7] - strb r0, [r1, 0x5] - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - movs r1, 0x88 - lsls r1, 6 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram8Bit - ldr r1, [r4] - ldrb r0, [r1, 0x1] - adds r0, 0x1 - strb r0, [r1, 0x1] - b _080D0416 - .pool -_080D040C: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _080D0418 -_080D0416: - movs r0, 0x1 -_080D0418: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80D03B0 - - thumb_func_start sub_80D0420 -sub_80D0420: @ 80D0420 - push {r4,lr} - ldr r4, =gUnknown_02039D80 - ldr r0, [r4] - ldrb r0, [r0, 0x1] - cmp r0, 0x1 - beq _080D044E - cmp r0, 0x1 - bgt _080D043C - cmp r0, 0 - beq _080D0442 - b _080D0498 - .pool -_080D043C: - cmp r0, 0x2 - beq _080D047A - b _080D0498 -_080D0442: - bl sub_80D08CC - bl sub_80D09A4 - movs r0, 0 - b _080D046C -_080D044E: - bl sub_80CDCAC - lsls r0, 24 - cmp r0, 0 - bne _080D0498 - movs r0, 0x3 - bl sub_80CFE54 - movs r1, 0x80 - lsls r1, 1 - movs r0, 0 - movs r2, 0x8 - bl sub_80D0884 - movs r0, 0x1 -_080D046C: - bl sub_80CDC64 - ldr r1, [r4] - ldrb r0, [r1, 0x1] - adds r0, 0x1 - strb r0, [r1, 0x1] - b _080D0498 -_080D047A: - bl sub_80D0894 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_80CDCAC - lsls r0, 24 - lsrs r0, 24 - cmp r4, 0 - bne _080D0498 - cmp r0, 0 - bne _080D0498 - movs r0, 0 - b _080D049A -_080D0498: - movs r0, 0x1 -_080D049A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80D0420 - - thumb_func_start sub_80D04A0 -sub_80D04A0: @ 80D04A0 - push {r4,lr} - bl sub_80CD554 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_80D0894 - lsls r0, 24 - lsrs r0, 24 - cmp r4, 0 - bne _080D04C0 - cmp r0, 0 - bne _080D04C0 - movs r0, 0 - b _080D04C2 -_080D04C0: - movs r0, 0x1 -_080D04C2: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80D04A0 - - thumb_func_start sub_80D04C8 -sub_80D04C8: @ 80D04C8 - push {r4,lr} - ldr r4, =gUnknown_02039D80 - ldr r0, [r4] - ldrb r0, [r0, 0x1] - cmp r0, 0x1 - beq _080D0506 - cmp r0, 0x1 - bgt _080D04E4 - cmp r0, 0 - beq _080D04EE - b _080D0576 - .pool -_080D04E4: - cmp r0, 0x2 - beq _080D0532 - cmp r0, 0x3 - beq _080D0550 - b _080D0576 -_080D04EE: - bl sub_80D0AAC - movs r1, 0xFF - lsls r1, 8 - movs r0, 0 - movs r2, 0x8 - bl sub_80D0884 - movs r0, 0 - bl sub_80CDC64 - b _080D0546 -_080D0506: - bl sub_80CDCAC - lsls r0, 24 - cmp r0, 0 - bne _080D0576 - bl sub_80D0894 - lsls r0, 24 - cmp r0, 0 - bne _080D0576 - bl sub_80D0A1C - movs r0, 0x2 - bl sub_80CFE54 - movs r0, 0x1 - bl sub_80CDC64 - movs r0, 0 - bl HideBg - b _080D0546 -_080D0532: - bl sub_80CDCAC - lsls r0, 24 - cmp r0, 0 - bne _080D0576 - movs r0, 0 - bl sub_80CFE54 - bl sub_80D0B5C -_080D0546: - ldr r1, [r4] - ldrb r0, [r1, 0x1] - adds r0, 0x1 - strb r0, [r1, 0x1] - b _080D0576 -_080D0550: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _080D0576 - movs r0, 0x3 - bl stdpal_get - movs r1, 0xD0 - movs r2, 0x20 - bl LoadPalette - bl sub_80CFE84 - movs r0, 0 - bl ShowBg - movs r0, 0 - b _080D0578 -_080D0576: - movs r0, 0x1 -_080D0578: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80D04C8 - - thumb_func_start sub_80D0580 -sub_80D0580: @ 80D0580 - push {lr} - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - cmp r0, 0x1 - beq _080D05BC - cmp r0, 0x1 - bgt _080D0596 - cmp r0, 0 - beq _080D05A0 - b _080D0624 -_080D0596: - cmp r1, 0x2 - beq _080D05DC - cmp r1, 0x3 - beq _080D05FC - b _080D0624 -_080D05A0: - ldr r0, =gUnknown_02039D80 - ldr r1, [r0] - ldrb r0, [r1, 0x9] - cmp r0, 0 - beq _080D060A - subs r0, 0x1 - strb r0, [r1, 0x9] - movs r1, 0x80 - lsls r1, 3 - movs r0, 0 - b _080D05F0 - .pool -_080D05BC: - ldr r0, =gUnknown_02039D80 - ldr r1, [r0] - ldrb r2, [r1, 0x9] - ldrb r0, [r1, 0xB] - adds r0, r2, r0 - cmp r0, 0x4 - bgt _080D060A - adds r0, r2, 0x1 - strb r0, [r1, 0x9] - movs r1, 0xFC - lsls r1, 8 - movs r0, 0 - b _080D05F0 - .pool -_080D05DC: - ldr r0, =gUnknown_02039D80 - ldr r1, [r0] - ldrb r0, [r1, 0x8] - cmp r0, 0 - beq _080D060A - subs r0, 0x1 - strb r0, [r1, 0x8] - movs r0, 0x80 - lsls r0, 3 - movs r1, 0 -_080D05F0: - movs r2, 0x6 - bl sub_80D0884 - b _080D0624 - .pool -_080D05FC: - ldr r0, =gUnknown_02039D80 - ldr r1, [r0] - ldrb r2, [r1, 0x8] - ldrb r0, [r1, 0xA] - adds r0, r2, r0 - cmp r0, 0x5 - ble _080D0614 -_080D060A: - movs r0, 0 - b _080D0626 - .pool -_080D0614: - adds r0, r2, 0x1 - strb r0, [r1, 0x8] - movs r0, 0xFC - lsls r0, 8 - movs r1, 0 - movs r2, 0x6 - bl sub_80D0884 -_080D0624: - movs r0, 0x1 -_080D0626: - pop {r1} - bx r1 - thumb_func_end sub_80D0580 - - thumb_func_start sub_80D062C -sub_80D062C: @ 80D062C - push {r4-r7,lr} - ldr r6, =gUnknown_02039D80 - ldr r2, [r6] - ldrb r3, [r2, 0x2] - ldrb r5, [r2, 0x6] - subs r1, r3, r5 - cmp r1, 0 - bge _080D063E - negs r1, r1 -_080D063E: - ldrb r0, [r2, 0x4] - subs r0, r3, r0 - cmp r0, 0 - bge _080D0648 - negs r0, r0 -_080D0648: - subs r0, r1, r0 - lsls r0, 16 - lsrs r4, r0, 16 - ldrb r1, [r2, 0x3] - ldrb r0, [r2, 0x7] - subs r3, r1, r0 - cmp r3, 0 - bge _080D065A - negs r3, r3 -_080D065A: - ldrb r2, [r2, 0x5] - subs r0, r1, r2 - cmp r0, 0 - bge _080D0664 - negs r0, r0 -_080D0664: - subs r0, r3, r0 - lsls r0, 16 - lsrs r7, r0, 16 - lsls r0, r4, 16 - asrs r4, r0, 16 - cmp r4, 0 - ble _080D0678 - adds r0, r5, 0 - bl sub_80D06D0 -_080D0678: - cmp r4, 0 - bge _080D0694 - ldr r2, [r6] - ldrb r0, [r2, 0x4] - ldrb r1, [r2, 0x3] - ldrb r2, [r2, 0x5] - bl sub_80D0740 - ldr r2, [r6] - ldrb r0, [r2, 0x6] - ldrb r1, [r2, 0x3] - ldrb r2, [r2, 0x5] - bl sub_80D06D0 -_080D0694: - lsls r0, r7, 16 - asrs r4, r0, 16 - cmp r4, 0 - ble _080D06A8 - ldr r2, [r6] - ldrb r0, [r2, 0x7] - ldrb r1, [r2, 0x2] - ldrb r2, [r2, 0x4] - bl sub_80D0708 -_080D06A8: - cmp r4, 0 - bge _080D06C4 - ldr r2, [r6] - ldrb r0, [r2, 0x5] - ldrb r1, [r2, 0x2] - ldrb r2, [r2, 0x4] - bl sub_80D0778 - ldr r2, [r6] - ldrb r0, [r2, 0x7] - ldrb r1, [r2, 0x2] - ldrb r2, [r2, 0x4] - bl sub_80D0708 -_080D06C4: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D062C - - thumb_func_start sub_80D06D0 -sub_80D06D0: @ 80D06D0 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - adds r1, r4, 0 - lsls r2, 24 - lsrs r5, r2, 24 - adds r0, r5, 0 - cmp r4, r5 - bls _080D06EE - adds r4, r5, 0 - adds r5, r1, 0 - cmp r0, r5 - bhi _080D0700 -_080D06EE: - adds r1, r4, 0 - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r6, 0 - bl sub_80D07B0 - cmp r4, r5 - bls _080D06EE -_080D0700: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80D06D0 - - thumb_func_start sub_80D0708 -sub_80D0708: @ 80D0708 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - adds r1, r4, 0 - lsls r2, 24 - lsrs r5, r2, 24 - adds r0, r5, 0 - cmp r4, r5 - bls _080D0726 - adds r4, r5, 0 - adds r5, r1, 0 - cmp r0, r5 - bhi _080D0738 -_080D0726: - adds r0, r4, 0 - adds r1, r0, 0x1 - lsls r1, 24 - lsrs r4, r1, 24 - adds r1, r6, 0 - bl sub_80D07B0 - cmp r4, r5 - bls _080D0726 -_080D0738: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80D0708 - - thumb_func_start sub_80D0740 -sub_80D0740: @ 80D0740 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - adds r1, r4, 0 - lsls r2, 24 - lsrs r5, r2, 24 - adds r0, r5, 0 - cmp r4, r5 - bls _080D075E - adds r4, r5, 0 - adds r5, r1, 0 - cmp r0, r5 - bhi _080D0770 -_080D075E: - adds r1, r4, 0 - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r6, 0 - bl sub_80D0834 - cmp r4, r5 - bls _080D075E -_080D0770: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80D0740 - - thumb_func_start sub_80D0778 -sub_80D0778: @ 80D0778 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - adds r1, r4, 0 - lsls r2, 24 - lsrs r5, r2, 24 - adds r0, r5, 0 - cmp r4, r5 - bls _080D0796 - adds r4, r5, 0 - adds r5, r1, 0 - cmp r0, r5 - bhi _080D07A8 -_080D0796: - adds r0, r4, 0 - adds r1, r0, 0x1 - lsls r1, 24 - lsrs r4, r1, 24 - adds r1, r6, 0 - bl sub_80D0834 - cmp r4, r5 - bls _080D0796 -_080D07A8: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80D0778 - - thumb_func_start sub_80D07B0 -sub_80D07B0: @ 80D07B0 - push {r4-r7,lr} - sub sp, 0x1C - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 1 - adds r7, r0, r1 - lsls r4, r7, 1 - adds r4, r6, r4 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - movs r1, 0x41 - bl GetBoxMonDataFromSelectedBox - lsls r0, 16 - lsrs r5, r0, 16 - adds r0, r4, 0 - movs r1, 0 - bl GetBoxMonDataFromSelectedBox - adds r1, r0, 0 - cmp r5, 0 - beq _080D0828 - adds r0, r5, 0 - movs r2, 0x1 - bl GetMonIconPtr - adds r4, r0, 0 - adds r0, r5, 0 - bl sub_80D3080 - adds r0, 0x8 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - movs r2, 0x88 - lsls r2, 6 - adds r1, r2 - ldrb r3, [r1] - movs r2, 0x20 - str r2, [sp] - str r2, [sp, 0x4] - lsls r1, r6, 1 - adds r1, r6 - lsls r1, 3 - str r1, [sp, 0x8] - lsls r1, r7, 3 - str r1, [sp, 0xC] - str r2, [sp, 0x10] - str r2, [sp, 0x14] - str r0, [sp, 0x18] - adds r0, r3, 0 - adds r1, r4, 0 - movs r2, 0 - movs r3, 0 - bl BlitBitmapRectToWindow4BitTo8Bit -_080D0828: - add sp, 0x1C - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D07B0 - - thumb_func_start sub_80D0834 -sub_80D0834: @ 80D0834 - push {r4,r5,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 1 - adds r5, r0, r1 - lsls r0, r5, 1 - adds r0, r4, r0 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x41 - bl GetBoxMonDataFromSelectedBox - lsls r0, 16 - cmp r0, 0 - beq _080D0878 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - movs r1, 0x88 - lsls r1, 6 - adds r0, r1 - ldrb r0, [r0] - lsls r2, r4, 1 - adds r2, r4 - lsls r2, 3 - lsls r3, r5, 3 - movs r1, 0x20 - str r1, [sp] - str r1, [sp, 0x4] - movs r1, 0 - bl FillWindowPixelRect8Bit -_080D0878: - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D0834 - - thumb_func_start sub_80D0884 -sub_80D0884: @ 80D0884 - ldr r3, =gUnknown_02039D80 - ldr r3, [r3] - strh r0, [r3, 0xC] - strh r1, [r3, 0xE] - strh r2, [r3, 0x10] - bx lr - .pool - thumb_func_end sub_80D0884 - - thumb_func_start sub_80D0894 -sub_80D0894: @ 80D0894 - push {r4,lr} - ldr r4, =gUnknown_02039D80 - ldr r1, [r4] - ldrh r0, [r1, 0x10] - cmp r0, 0 - beq _080D08BE - ldrh r1, [r1, 0xC] - movs r0, 0 - movs r2, 0x1 - bl ChangeBgX - ldr r0, [r4] - ldrh r1, [r0, 0xE] - movs r0, 0 - movs r2, 0x1 - bl ChangeBgY - ldr r1, [r4] - ldrh r0, [r1, 0x10] - subs r0, 0x1 - strh r0, [r1, 0x10] -_080D08BE: - ldr r0, [r4] - ldrb r0, [r0, 0x10] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80D0894 - - thumb_func_start sub_80D08CC -sub_80D08CC: @ 80D08CC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r4, =gUnknown_02039D80 - ldr r1, [r4] - ldrb r0, [r1, 0x4] - ldrb r2, [r1, 0x2] - cmp r0, r2 - bls _080D08E4 - adds r0, r2, 0 -_080D08E4: - strb r0, [r1, 0x8] - ldr r1, [r4] - ldrb r0, [r1, 0x5] - ldrb r2, [r1, 0x3] - cmp r0, r2 - bls _080D08F2 - adds r0, r2, 0 -_080D08F2: - strb r0, [r1, 0x9] - ldr r2, [r4] - ldrb r1, [r2, 0x2] - ldrb r0, [r2, 0x4] - subs r0, r1, r0 - cmp r0, 0 - bge _080D0902 - negs r0, r0 -_080D0902: - adds r0, 0x1 - strb r0, [r2, 0xA] - ldr r2, [r4] - ldrb r1, [r2, 0x3] - ldrb r0, [r2, 0x5] - subs r0, r1, r0 - cmp r0, 0 - bge _080D0914 - negs r0, r0 -_080D0914: - adds r0, 0x1 - strb r0, [r2, 0xB] - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - movs r6, 0 - ldr r0, [r4] - ldrb r2, [r0, 0x8] - ldrb r1, [r0, 0xA] - adds r2, r1 - mov r8, r2 - ldrb r1, [r0, 0x9] - ldrb r0, [r0, 0xB] - adds r0, r1 - mov r9, r0 - adds r2, r1, 0 - cmp r2, r9 - bge _080D0990 -_080D093C: - lsls r0, r2, 1 - adds r0, r2 - ldr r3, =gUnknown_02039D80 - ldr r1, [r3] - lsls r0, 1 - ldrb r3, [r1, 0x8] - adds r0, r3 - lsls r0, 24 - lsrs r5, r0, 24 - ldrb r4, [r1, 0x8] - adds r7, r2, 0x1 - cmp r4, r8 - bge _080D098A - mov r0, r8 - subs r4, r0, r4 -_080D095A: - mov r0, r10 - adds r1, r5, 0 - bl GetBoxedMonPtr - adds r1, r0, 0 - ldr r2, =gUnknown_02039D80 - ldr r0, [r2] - lsls r2, r6, 2 - adds r2, r6 - lsls r2, 4 - adds r0, r2 - adds r0, 0x14 - movs r2, 0x50 - bl memcpy - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - subs r4, 0x1 - cmp r4, 0 - bne _080D095A -_080D098A: - adds r2, r7, 0 - cmp r2, r9 - blt _080D093C -_080D0990: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D08CC - - thumb_func_start sub_80D09A4 -sub_80D09A4: @ 80D09A4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r4, =gUnknown_02039D80 - ldr r0, [r4] - ldrb r2, [r0, 0x8] - ldrb r1, [r0, 0xA] - adds r7, r2, r1 - ldrb r1, [r0, 0x9] - ldrb r0, [r0, 0xB] - adds r1, r0 - mov r9, r1 - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r0, [r4] - ldrb r2, [r0, 0x9] - cmp r2, r9 - bge _080D0A0C -_080D09D0: - lsls r0, r2, 1 - adds r0, r2 - ldr r1, =gUnknown_02039D80 - ldr r1, [r1] - lsls r0, 1 - ldrb r3, [r1, 0x8] - adds r0, r3 - lsls r0, 24 - lsrs r5, r0, 24 - ldrb r4, [r1, 0x8] - adds r6, r2, 0x1 - cmp r4, r7 - bge _080D0A06 - subs r4, r7, r4 -_080D09EC: - adds r0, r5, 0 - bl sub_80CB778 - mov r0, r8 - adds r1, r5, 0 - bl ClearMonInBox - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - subs r4, 0x1 - cmp r4, 0 - bne _080D09EC -_080D0A06: - adds r2, r6, 0 - cmp r2, r9 - blt _080D09D0 -_080D0A0C: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D09A4 - - thumb_func_start sub_80D0A1C -sub_80D0A1C: @ 80D0A1C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r0, =gUnknown_02039D80 - ldr r0, [r0] - ldrb r2, [r0, 0x8] - ldrb r1, [r0, 0xA] - adds r2, r1 - mov r8, r2 - ldrb r1, [r0, 0x9] - ldrb r0, [r0, 0xB] - adds r0, r1 - mov r10, r0 - movs r6, 0 - adds r2, r1, 0 - cmp r2, r10 - bge _080D0A98 -_080D0A42: - lsls r0, r2, 1 - adds r0, r2 - ldr r3, =gUnknown_02039D80 - ldr r1, [r3] - lsls r0, 1 - ldrb r4, [r1, 0x8] - adds r0, r4 - lsls r0, 24 - lsrs r5, r0, 24 - ldrb r4, [r1, 0x8] - adds r7, r2, 0x1 - cmp r4, r8 - bge _080D0A92 - mov r9, r3 - mov r0, r8 - subs r4, r0, r4 -_080D0A62: - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 4 - adds r1, 0x14 - mov r2, r9 - ldr r0, [r2] - adds r0, r1 - movs r1, 0x5 - bl GetBoxMonData - cmp r0, 0 - beq _080D0A80 - adds r0, r5, 0 - bl sub_80CB140 -_080D0A80: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - subs r4, 0x1 - cmp r4, 0 - bne _080D0A62 -_080D0A92: - adds r2, r7, 0 - cmp r2, r10 - blt _080D0A42 -_080D0A98: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D0A1C - - thumb_func_start sub_80D0AAC -sub_80D0AAC: @ 80D0AAC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - ldr r4, =gUnknown_02039D80 - ldr r0, [r4] - ldrb r2, [r0, 0x8] - ldrb r1, [r0, 0xA] - adds r2, r1 - mov r10, r2 - ldrb r1, [r0, 0x9] - ldrb r0, [r0, 0xB] - adds r1, r0 - str r1, [sp] - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - movs r7, 0 - ldr r0, [r4] - ldrb r3, [r0, 0x9] - ldr r0, [sp] - cmp r3, r0 - bge _080D0B46 -_080D0AE2: - lsls r0, r3, 1 - adds r0, r3 - ldr r2, =gUnknown_02039D80 - ldr r1, [r2] - lsls r0, 1 - ldrb r4, [r1, 0x8] - adds r0, r4 - lsls r0, 24 - lsrs r6, r0, 24 - ldrb r5, [r1, 0x8] - adds r3, 0x1 - mov r9, r3 - cmp r5, r10 - bge _080D0B3E - mov r8, r2 - mov r0, r10 - subs r5, r0, r5 -_080D0B04: - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 4 - adds r4, r0, 0 - adds r4, 0x14 - mov r1, r8 - ldr r0, [r1] - adds r0, r4 - movs r1, 0x5 - bl GetBoxMonData - cmp r0, 0 - beq _080D0B2C - mov r0, r8 - ldr r2, [r0] - adds r2, r4 - ldr r0, [sp, 0x4] - adds r1, r6, 0 - bl CopyBoxMonFromAnyBox -_080D0B2C: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - subs r5, 0x1 - cmp r5, 0 - bne _080D0B04 -_080D0B3E: - mov r3, r9 - ldr r1, [sp] - cmp r3, r1 - blt _080D0AE2 -_080D0B46: - 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_80D0AAC - - thumb_func_start sub_80D0B5C -sub_80D0B5C: @ 80D0B5C - push {lr} - sub sp, 0x8 - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0 - movs r1, 0x4 - movs r2, 0 - bl SetBgAttribute - movs r0, 0x8 - movs r1, 0x80 - bl ClearGpuRegBits - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0x8 - pop {r0} - bx r0 - thumb_func_end sub_80D0B5C - - thumb_func_start sub_80D0BA4 -sub_80D0BA4: @ 80D0BA4 - ldr r0, =gUnknown_02039D80 - ldr r2, [r0] - ldrb r1, [r2, 0x3] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 1 - ldrb r2, [r2, 0x2] - adds r0, r2 - lsls r0, 24 - lsrs r0, 24 - bx lr - .pool - thumb_func_end sub_80D0BA4 - - thumb_func_start sub_80D0BC0 -sub_80D0BC0: @ 80D0BC0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - ldr r0, =gUnknown_02039D80 - ldr r0, [r0] - ldrb r2, [r0, 0x8] - ldrb r1, [r0, 0xA] - adds r2, r1 - mov r9, r2 - ldrb r1, [r0, 0x9] - ldrb r0, [r0, 0xB] - adds r0, r1, r0 - str r0, [sp] - movs r7, 0 - adds r6, r1, 0 - cmp r6, r0 - bge _080D0C4E - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 1 - mov r8, r0 -_080D0BF0: - ldr r2, =gUnknown_02039D80 - ldr r1, [r2] - ldrb r0, [r1, 0x8] - add r0, r8 - lsls r0, 24 - lsrs r5, r0, 24 - ldrb r4, [r1, 0x8] - cmp r4, r9 - bge _080D0C42 - mov r10, r2 -_080D0C04: - lsls r1, r7, 2 - adds r1, r7 - lsls r1, 4 - adds r1, 0x14 - mov r2, r10 - ldr r0, [r2] - adds r0, r1 - movs r1, 0x5 - bl GetBoxMonData - cmp r0, 0 - beq _080D0C30 - adds r0, r5, 0 - movs r1, 0x5 - bl GetBoxMonDataFromSelectedBox - cmp r0, 0 - beq _080D0C30 - movs r0, 0 - b _080D0C50 - .pool -_080D0C30: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - adds r4, 0x1 - cmp r4, r9 - blt _080D0C04 -_080D0C42: - movs r0, 0x6 - add r8, r0 - adds r6, 0x1 - ldr r2, [sp] - cmp r6, r2 - blt _080D0BF0 -_080D0C4E: - movs r0, 0x1 -_080D0C50: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80D0BC0 - - thumb_func_start sub_80D0C60 -sub_80D0C60: @ 80D0C60 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - ldr r3, =gUnknown_02039D08 - ldr r0, [r3] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080D0D3E - ldr r0, =gUnknown_03000F78 - str r0, [sp, 0x18] - ldr r1, =0xffff0000 - add r2, sp, 0x18 - ldr r0, [r2, 0x4] - ands r0, r1 - movs r1, 0x80 - lsls r1, 2 - orrs r0, r1 - str r0, [r2, 0x4] - mov r1, sp - ldr r0, =gSpriteTemplate_857BC70 - ldm r0!, {r4-r6} - stm r1!, {r4-r6} - ldm r0!, {r4-r6} - stm r1!, {r4-r6} - movs r7, 0 - mov r9, r2 - mov r8, r3 - movs r0, 0 - mov r10, r0 -_080D0CA0: - adds r6, r7, 0x7 - lsls r1, r6, 16 - mov r2, r9 - ldrh r0, [r2, 0x4] - orrs r0, r1 - str r0, [r2, 0x4] - mov r0, r9 - bl LoadCompressedObjectPic - mov r4, r9 - ldrh r0, [r4, 0x6] - bl GetSpriteTileStartByTag - mov r5, r8 - ldr r1, [r5] - lsls r5, r7, 4 - ldr r2, =0x00002208 - adds r1, r2 - adds r1, r5 - lsls r0, 16 - lsrs r0, 11 - ldr r4, =0x06010000 - adds r0, r4 - str r0, [r1] - ldr r0, =0xffffdacb - adds r4, r7, r0 - lsls r0, r4, 16 - lsrs r0, 16 - bl AllocSpritePalette - mov r2, r8 - ldr r1, [r2] - adds r1, r5 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =0x0000220c - adds r1, r2 - strh r0, [r1] - ldrh r0, [r1] - lsls r0, 4 - movs r2, 0x80 - lsls r2, 1 - adds r0, r2 - strh r0, [r1] - mov r0, sp - strh r6, [r0] - strh r4, [r0, 0x2] - movs r1, 0 - movs r2, 0 - movs r3, 0xB - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - mov r4, r8 - ldr r2, [r4] - ldr r6, =0x00002204 - adds r2, r6 - adds r2, r5 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - str r1, [r2] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - ldr r0, [r4] - adds r0, r5 - ldr r1, =0x00002210 - adds r0, r1 - mov r2, r10 - strb r2, [r0] - adds r7, 0x1 - cmp r7, 0x2 - ble _080D0CA0 -_080D0D3E: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r4, =0x00002234 - adds r0, r4 - movs r1, 0 - strh r1, [r0] - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D0C60 - - thumb_func_start sub_80D0D8C -sub_80D0D8C: @ 80D0D8C - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r1, 24 - lsrs r7, r1, 24 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080D0E42 - mov r0, r8 - adds r1, r7, 0 - bl sub_80D1324 - cmp r0, 0 - bne _080D0E42 - mov r0, r8 - cmp r0, 0 - beq _080D0DC4 - cmp r0, 0x1 - beq _080D0DDA - b _080D0E42 - .pool -_080D0DC4: - adds r0, r7, 0 - movs r1, 0x5 - bl GetBoxMonDataFromSelectedBox - cmp r0, 0 - beq _080D0E42 - adds r0, r7, 0 - movs r1, 0xC - bl GetBoxMonDataFromSelectedBox - b _080D0DFC -_080D0DDA: - cmp r7, 0x5 - bhi _080D0E42 - movs r0, 0x64 - adds r1, r7, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x5 - bl GetMonData - cmp r0, 0 - beq _080D0E42 - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData -_080D0DFC: - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0 - beq _080D0E42 - adds r0, r4, 0 - bl GetItemIconPic - adds r6, r0, 0 - adds r0, r4, 0 - bl GetItemIconPalette - adds r5, r0, 0 - bl sub_80D12E8 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - mov r1, r8 - adds r2, r7, 0 - bl sub_80D140C - adds r0, r4, 0 - adds r1, r6, 0 - adds r2, r5, 0 - bl sub_80D1524 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80D15D4 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80D1740 -_080D0E42: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D0D8C - - thumb_func_start sub_80D0E50 -sub_80D0E50: @ 80D0E50 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080D0E86 - adds r0, r6, 0 - adds r1, r5, 0 - bl sub_80D1370 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - movs r1, 0x2 - bl sub_80D15D4 - adds r0, r4, 0 - movs r1, 0 - adds r2, r6, 0 - adds r3, r5, 0 - bl sub_80D1604 -_080D0E86: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D0E50 - - thumb_func_start sub_80D0E90 -sub_80D0E90: @ 80D0E90 - push {r4-r7,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - adds r7, r5, 0 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080D0F20 - adds r0, r6, 0 - adds r1, r5, 0 - bl sub_80D1370 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r1, 0 - mov r0, sp - strh r1, [r0] - adds r0, r4, 0 - movs r1, 0x3 - bl sub_80D15D4 - adds r0, r4, 0 - movs r1, 0x1 - adds r2, r6, 0 - adds r3, r5, 0 - bl sub_80D1604 - adds r0, r4, 0 - movs r1, 0x2 - movs r2, 0 - bl sub_80D140C - cmp r6, 0 - bne _080D0EF8 - adds r0, r5, 0 - movs r1, 0xC - mov r2, sp - bl SetBoxMonDataFromSelectedBox - adds r0, r5, 0 - movs r1, 0x1 - bl sub_80CB7AC - b _080D0F10 - .pool -_080D0EF8: - movs r0, 0x64 - muls r0, r7 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - mov r2, sp - bl SetMonData - adds r0, r7, 0 - movs r1, 0x1 - bl sub_80CBBDC -_080D0F10: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r2, =0x00000ce6 - adds r1, r0, r2 - ldrh r1, [r1] - ldr r2, =0x00002234 - adds r0, r2 - strh r1, [r0] -_080D0F20: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D0E90 - - thumb_func_start sub_80D0F38 -sub_80D0F38: @ 80D0F38 - push {r4-r6,lr} - mov r6, r8 - push {r6} - adds r5, r0, 0 - lsls r5, 16 - lsrs r5, 16 - adds r0, r5, 0 - bl GetItemIconPic - mov r8, r0 - adds r0, r5, 0 - bl GetItemIconPalette - adds r6, r0, 0 - bl sub_80D12E8 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - mov r1, r8 - adds r2, r6, 0 - bl sub_80D1524 - adds r0, r4, 0 - movs r1, 0x6 - bl sub_80D15D4 - adds r0, r4, 0 - movs r1, 0x1 - movs r2, 0 - movs r3, 0 - bl sub_80D1604 - adds r0, r4, 0 - movs r1, 0x2 - movs r2, 0 - bl sub_80D140C - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80D1740 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00002234 - adds r0, r1 - strh r5, [r0] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D0F38 - - thumb_func_start sub_80D0FAC -sub_80D0FAC: @ 80D0FAC - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - lsls r1, 24 - lsrs r7, r1, 24 - ldr r0, =gUnknown_02039D08 - mov r8, r0 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080D106A - mov r0, r9 - adds r1, r7, 0 - bl sub_80D1370 - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - movs r1, 0x3 - bl sub_80D15D4 - adds r0, r4, 0 - movs r1, 0x3 - movs r2, 0x2 - movs r3, 0 - bl sub_80D1604 - mov r1, r9 - cmp r1, 0 - bne _080D101C - adds r0, r7, 0 - movs r1, 0xC - bl GetBoxMonDataFromSelectedBox - lsls r0, 16 - lsrs r6, r0, 16 - mov r0, r8 - ldr r2, [r0] - ldr r4, =0x00002234 - adds r2, r4 - adds r0, r7, 0 - movs r1, 0xC - bl SetBoxMonDataFromSelectedBox - mov r1, r8 - ldr r0, [r1] - adds r0, r4 - b _080D1048 - .pool -_080D101C: - movs r0, 0x64 - adds r4, r7, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r6, r0, 16 - mov r0, r8 - ldr r2, [r0] - ldr r5, =0x00002234 - adds r2, r5 - adds r0, r4, 0 - movs r1, 0xC - bl SetMonData - mov r1, r8 - ldr r0, [r1] - adds r0, r5 -_080D1048: - strh r6, [r0] - movs r0, 0x2 - movs r1, 0 - bl sub_80D1370 - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - movs r1, 0x4 - bl sub_80D15D4 - adds r0, r4, 0 - movs r1, 0x4 - mov r2, r9 - adds r3, r7, 0 - bl sub_80D1604 -_080D106A: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D0FAC - - thumb_func_start sub_80D1080 -sub_80D1080: @ 80D1080 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r7, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - mov r8, r5 - ldr r6, =gUnknown_02039D08 - ldr r0, [r6] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080D1100 - movs r0, 0x2 - movs r1, 0 - bl sub_80D1370 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - movs r1, 0x4 - bl sub_80D15D4 - adds r0, r4, 0 - movs r1, 0x2 - adds r2, r7, 0 - adds r3, r5, 0 - bl sub_80D1604 - cmp r7, 0 - bne _080D10E0 - ldr r2, [r6] - ldr r0, =0x00002234 - adds r2, r0 - adds r0, r5, 0 - movs r1, 0xC - bl SetBoxMonDataFromSelectedBox - adds r0, r5, 0 - movs r1, 0 - bl sub_80CB7AC - b _080D1100 - .pool -_080D10E0: - movs r0, 0x64 - mov r1, r8 - muls r1, r0 - adds r0, r1, 0 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r2, [r6] - ldr r1, =0x00002234 - adds r2, r1 - movs r1, 0xC - bl SetMonData - mov r0, r8 - movs r1, 0 - bl sub_80CBBDC -_080D1100: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D1080 - - thumb_func_start sub_80D1114 -sub_80D1114: @ 80D1114 - push {r4-r7,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - adds r7, r5, 0 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080D1188 - movs r1, 0 - mov r0, sp - strh r1, [r0] - adds r0, r6, 0 - adds r1, r5, 0 - bl sub_80D1370 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - movs r1, 0x2 - bl sub_80D15D4 - adds r0, r4, 0 - movs r1, 0 - adds r2, r6, 0 - adds r3, r5, 0 - bl sub_80D1604 - cmp r6, 0 - bne _080D1170 - adds r0, r5, 0 - movs r1, 0xC - mov r2, sp - bl SetBoxMonDataFromSelectedBox - adds r0, r5, 0 - movs r1, 0x1 - bl sub_80CB7AC - b _080D1188 - .pool -_080D1170: - movs r0, 0x64 - muls r0, r7 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - mov r2, sp - bl SetMonData - adds r0, r7, 0 - movs r1, 0x1 - bl sub_80CBBDC -_080D1188: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D1114 - - thumb_func_start sub_80D1194 -sub_80D1194: @ 80D1194 - push {r4,lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080D11C2 - movs r0, 0x2 - movs r1, 0 - bl sub_80D1370 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - movs r1, 0x5 - bl sub_80D15D4 - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x2 - movs r3, 0 - bl sub_80D1604 -_080D11C2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D1194 - - thumb_func_start sub_80D11CC -sub_80D11CC: @ 80D11CC - push {r4,lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080D120A - movs r4, 0 -_080D11DA: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - lsls r0, r4, 4 - adds r1, r0 - ldr r2, =0x00002210 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080D1204 - subs r2, 0x2 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x1 - bne _080D1204 - lsls r0, r4, 24 - lsrs r0, 24 - movs r1, 0x7 - movs r2, 0x2 - movs r3, 0 - bl sub_80D1604 -_080D1204: - adds r4, 0x1 - cmp r4, 0x2 - ble _080D11DA -_080D120A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D11CC - - thumb_func_start sub_80D1218 -sub_80D1218: @ 80D1218 - push {r4,r5,lr} - movs r5, 0 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00002204 - adds r4, r0, r1 - adds r3, r0, 0 -_080D1226: - ldr r1, =0x00002210 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080D1268 - ldr r2, [r4] - adds r0, r2, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x28 - ands r0, r1 - cmp r0, 0x8 - beq _080D124E - ldr r1, [r2, 0x1C] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _080D1268 - ldr r0, =sub_80D1AD8 - cmp r1, r0 - beq _080D1268 -_080D124E: - movs r0, 0x1 - b _080D1274 - .pool -_080D1268: - adds r4, 0x10 - adds r3, 0x10 - adds r5, 0x1 - cmp r5, 0x2 - ble _080D1226 - movs r0, 0 -_080D1274: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80D1218 - - thumb_func_start sub_80D127C -sub_80D127C: @ 80D127C - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldrb r0, [r1, 0x1] - cmp r0, 0x3 - bne _080D12B0 - movs r2, 0 - ldr r0, =0x0000220e - adds r1, r0 -_080D128E: - ldrb r0, [r1, 0x2] - cmp r0, 0 - beq _080D12A8 - ldrb r0, [r1] - cmp r0, 0x2 - bne _080D12A8 - movs r0, 0x1 - b _080D12B2 - .pool -_080D12A8: - adds r1, 0x10 - adds r2, 0x1 - cmp r2, 0x2 - ble _080D128E -_080D12B0: - movs r0, 0 -_080D12B2: - pop {r1} - bx r1 - thumb_func_end sub_80D127C - - thumb_func_start sub_80D12B8 -sub_80D12B8: @ 80D12B8 - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00002234 - adds r0, r1 - ldrh r0, [r0] - bl ItemId_GetName - pop {r1} - bx r1 - .pool - thumb_func_end sub_80D12B8 - - thumb_func_start sub_80D12D4 -sub_80D12D4: @ 80D12D4 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00002234 - adds r0, r1 - ldrh r0, [r0] - bx lr - .pool - thumb_func_end sub_80D12D4 - - thumb_func_start sub_80D12E8 -sub_80D12E8: @ 80D12E8 - push {r4,r5,lr} - movs r2, 0 - ldr r5, =gUnknown_02039D08 - ldr r3, =0x00002210 - movs r4, 0x1 -_080D12F2: - ldr r0, [r5] - lsls r1, r2, 4 - adds r0, r1 - adds r1, r0, r3 - ldrb r0, [r1] - cmp r0, 0 - bne _080D1310 - strb r4, [r1] - adds r0, r2, 0 - b _080D131C - .pool -_080D1310: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x2 - bls _080D12F2 - movs r0, 0x3 -_080D131C: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80D12E8 - - thumb_func_start sub_80D1324 -sub_80D1324: @ 80D1324 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r1, 24 - movs r3, 0 - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] -_080D1334: - ldr r5, =0x00002210 - adds r0, r2, r5 - ldrb r0, [r0] - cmp r0, 0 - beq _080D1360 - subs r5, 0x2 - adds r0, r2, r5 - ldrb r0, [r0] - cmp r0, r4 - bne _080D1360 - adds r5, 0x1 - adds r0, r2, r5 - ldrb r0, [r0] - cmp r0, r1 - bne _080D1360 - movs r0, 0x1 - b _080D136A - .pool -_080D1360: - adds r2, 0x10 - adds r3, 0x1 - cmp r3, 0x2 - ble _080D1334 - movs r0, 0 -_080D136A: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80D1324 - - thumb_func_start sub_80D1370 -sub_80D1370: @ 80D1370 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - movs r3, 0 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] -_080D1380: - lsls r0, r3, 4 - adds r2, r1, r0 - ldr r6, =0x00002210 - adds r0, r2, r6 - ldrb r0, [r0] - cmp r0, 0 - beq _080D13B0 - subs r6, 0x2 - adds r0, r2, r6 - ldrb r0, [r0] - cmp r0, r5 - bne _080D13B0 - adds r6, 0x1 - adds r0, r2, r6 - ldrb r0, [r0] - cmp r0, r4 - bne _080D13B0 - adds r0, r3, 0 - b _080D13BC - .pool -_080D13B0: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x2 - bls _080D1380 - movs r0, 0x3 -_080D13BC: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80D1370 - - thumb_func_start sub_80D13C4 -sub_80D13C4: @ 80D13C4 - push {r4-r6,lr} - adds r5, r0, 0 - movs r2, 0 - ldr r0, =gUnknown_02039D08 - ldr r3, [r0] - ldr r0, =0x00002204 - adds r4, r3, r0 - ldr r6, =0x00002210 -_080D13D4: - lsls r1, r2, 4 - adds r0, r3, r1 - adds r0, r6 - ldrb r0, [r0] - cmp r0, 0 - beq _080D13F8 - adds r0, r4, r1 - ldr r0, [r0] - cmp r0, r5 - bne _080D13F8 - adds r0, r2, 0 - b _080D1404 - .pool -_080D13F8: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x2 - bls _080D13D4 - movs r0, 0x3 -_080D1404: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80D13C4 - - thumb_func_start sub_80D140C -sub_80D140C: @ 80D140C - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - lsls r2, 24 - lsrs r7, r2, 24 - cmp r5, 0x2 - bhi _080D150A - cmp r1, 0 - beq _080D1438 - cmp r1, 0x1 - beq _080D1494 - ldr r4, =gUnknown_02039D08 - lsls r3, r5, 4 - b _080D14F4 - .pool -_080D1438: - adds r0, r7, 0 - movs r1, 0x6 - bl __umodsi3 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r7, 0 - movs r1, 0x6 - bl __udivsi3 - lsls r0, 24 - lsrs r0, 24 - ldr r6, =gUnknown_02039D08 - ldr r2, [r6] - lsls r5, 4 - ldr r1, =0x00002204 - adds r2, r1 - adds r2, r5 - ldr r3, [r2] - lsls r1, r4, 1 - adds r1, r4 - lsls r1, 3 - adds r1, 0x70 - strh r1, [r3, 0x20] - ldr r3, [r2] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 3 - adds r1, 0x38 - strh r1, [r3, 0x22] - ldr r2, [r2] - ldrb r1, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - movs r1, 0x8 - orrs r0, r1 - strb r0, [r2, 0x5] - adds r4, r6, 0 - adds r3, r5, 0 - b _080D14F4 - .pool -_080D1494: - cmp r7, 0 - bne _080D14BC - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - lsls r3, r5, 4 - ldr r1, =0x00002204 - adds r0, r1 - adds r0, r3 - ldr r2, [r0] - movs r1, 0x74 - strh r1, [r2, 0x20] - ldr r1, [r0] - movs r0, 0x4C - strh r0, [r1, 0x22] - b _080D14DC - .pool -_080D14BC: - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - lsls r3, r5, 4 - ldr r1, =0x00002204 - adds r0, r1 - adds r0, r3 - ldr r2, [r0] - movs r1, 0xA4 - strh r1, [r2, 0x20] - ldr r2, [r0] - subs r1, r7, 0x1 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - adds r0, 0x1C - strh r0, [r2, 0x22] -_080D14DC: - ldr r0, [r4] - ldr r1, =0x00002204 - adds r0, r1 - adds r0, r3 - ldr 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] -_080D14F4: - ldr r0, [r4] - adds r0, r3 - ldr r1, =0x0000220e - adds r0, r1 - mov r1, r8 - strb r1, [r0] - ldr r0, [r4] - adds r0, r3 - ldr r1, =0x0000220f - adds r0, r1 - strb r7, [r0] -_080D150A: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D140C - - thumb_func_start sub_80D1524 -sub_80D1524: @ 80D1524 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - mov r8, r1 - mov r9, r2 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0x2 - bhi _080D15AC - movs r0, 0 - str r0, [sp] - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - ldr r6, =0x000042c4 - adds r1, r6 - ldr r2, =0x01000080 - mov r0, sp - bl CpuFastSet - ldr r1, [r4] - ldr r5, =0x000022c4 - adds r1, r5 - mov r0, r8 - bl LZ77UnCompWram - lsls r7, 4 - mov r8, r7 - adds r7, r4, 0 - movs r4, 0x2 -_080D1562: - ldr r1, [r7] - adds r0, r1, r5 - adds r1, r6 - movs r2, 0x18 - bl CpuFastSet - adds r6, 0x80 - adds r5, 0x60 - subs r4, 0x1 - cmp r4, 0 - bge _080D1562 - ldr r5, =gUnknown_02039D08 - ldr r1, [r5] - ldr r4, =0x000042c4 - adds r0, r1, r4 - ldr r2, =0x00002208 - adds r1, r2 - add r1, r8 - ldr r1, [r1] - movs r2, 0x80 - bl CpuFastSet - ldr r1, [r5] - adds r1, r4 - mov r0, r9 - bl LZ77UnCompWram - ldr r0, [r5] - adds r4, r0, r4 - add r0, r8 - ldr r1, =0x0000220c - adds r0, r1 - ldrh r1, [r0] - adds r0, r4, 0 - movs r2, 0x20 - bl LoadPalette -_080D15AC: - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D1524 - - thumb_func_start sub_80D15D4 -sub_80D15D4: @ 80D15D4 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r1, 24 - lsrs r3, r1, 24 - cmp r2, 0x2 - bhi _080D15F6 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - lsls r1, r2, 4 - ldr r2, =0x00002204 - adds r0, r2 - adds r0, r1 - ldr r0, [r0] - adds r1, r3, 0 - bl StartSpriteAffineAnim -_080D15F6: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D15D4 - - thumb_func_start sub_80D1604 -sub_80D1604: @ 80D1604 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r0, r1, 24 - lsls r2, 24 - lsrs r5, r2, 24 - lsls r3, 24 - lsrs r3, 24 - cmp r4, 0x2 - bls _080D161C - b _080D172E -_080D161C: - cmp r0, 0x7 - bls _080D1622 - b _080D172E -_080D1622: - lsls r0, 2 - ldr r1, =_080D1630 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080D1630: - .4byte _080D1650 - .4byte _080D1674 - .4byte _080D1698 - .4byte _080D16C4 - .4byte _080D16F0 - .4byte _080D172E - .4byte _080D172E - .4byte _080D171C -_080D1650: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - lsls r1, r4, 4 - ldr r2, =0x00002204 - adds r0, r2 - adds r0, r1 - ldr r1, [r0] - strh r4, [r1, 0x2E] - ldr r1, [r0] - ldr r0, =sub_80D1A48 - b _080D172C - .pool -_080D1674: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - lsls r1, r4, 4 - ldr r2, =0x00002204 - adds r0, r2 - adds r0, r1 - ldr r2, [r0] - movs r1, 0 - strh r1, [r2, 0x2E] - ldr r1, [r0] - ldr r0, =sub_80D1A74 - b _080D172C - .pool -_080D1698: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - lsls r1, r4, 4 - ldr r2, =0x00002204 - adds r0, r2 - adds r0, r1 - ldr r2, [r0] - movs r1, 0 - strh r1, [r2, 0x2E] - ldr r1, [r0] - strh r5, [r1, 0x3A] - ldr r1, [r0] - strh r3, [r1, 0x3C] - ldr r1, [r0] - ldr r0, =sub_80D1B14 - b _080D172C - .pool -_080D16C4: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - lsls r1, r4, 4 - ldr r2, =0x00002204 - adds r0, r2 - adds r0, r1 - ldr r2, [r0] - movs r1, 0 - strh r1, [r2, 0x2E] - ldr r2, [r0] - ldr r1, =sub_80D1B94 - str r1, [r2, 0x1C] - strh r5, [r2, 0x3A] - ldr r0, [r0] - strh r3, [r0, 0x3C] - b _080D172E - .pool -_080D16F0: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - lsls r1, r4, 4 - ldr r2, =0x00002204 - adds r0, r2 - adds r0, r1 - ldr r2, [r0] - movs r1, 0 - strh r1, [r2, 0x2E] - ldr r1, [r0] - strh r5, [r1, 0x3A] - ldr r1, [r0] - strh r3, [r1, 0x3C] - ldr r1, [r0] - ldr r0, =sub_80D1C30 - b _080D172C - .pool -_080D171C: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - lsls r1, r4, 4 - ldr r2, =0x00002204 - adds r0, r2 - adds r0, r1 - ldr r1, [r0] - ldr r0, =sub_80D1CCC -_080D172C: - str r0, [r1, 0x1C] -_080D172E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D1604 - - thumb_func_start sub_80D1740 -sub_80D1740: @ 80D1740 - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - cmp r2, 0x2 - bhi _080D1780 - ldr r1, =gUnknown_02039D08 - ldr r0, [r1] - lsls r2, 4 - adds r0, r2 - ldr r3, =0x00002210 - adds r0, r3 - strb r4, [r0] - ldr r0, [r1] - ldr r1, =0x00002204 - adds r0, r1 - adds r0, r2 - ldr r0, [r0] - movs r3, 0 - cmp r4, 0 - bne _080D176E - movs r3, 0x1 -_080D176E: - adds r2, r0, 0 - adds r2, 0x3E - lsls r3, 2 - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - orrs r0, r3 - strb r0, [r2] -_080D1780: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D1740 - - thumb_func_start GetItemIconPic -GetItemIconPic: @ 80D1794 - push {lr} - lsls r0, 16 - lsrs r0, 16 - movs r1, 0 - bl GetItemIconPicOrPalette - pop {r1} - bx r1 - thumb_func_end GetItemIconPic - - thumb_func_start GetItemIconPalette -GetItemIconPalette: @ 80D17A4 - push {lr} - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - bl GetItemIconPicOrPalette - pop {r1} - bx r1 - thumb_func_end GetItemIconPalette - - thumb_func_start sub_80D17B4 -sub_80D17B4: @ 80D17B4 - push {r4,lr} - sub sp, 0x14 - bl sub_80D127C - lsls r0, 24 - cmp r0, 0 - beq _080D17D4 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00002234 - b _080D17DA - .pool -_080D17D4: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000ce6 -_080D17DA: - adds r0, r1 - ldrh r0, [r0] - bl ItemId_GetDescription - adds r4, r0, 0 - movs r0, 0x2 - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r0, 0 - str r0, [sp] - str r0, [sp, 0x4] - str r0, [sp, 0x8] - str r0, [sp, 0xC] - movs r0, 0x1 - str r0, [sp, 0x10] - movs r0, 0x2 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0x4 - bl AddTextPrinterParameterized5 - add sp, 0x14 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D17B4 - - thumb_func_start sub_80D1818 -sub_80D1818: @ 80D1818 - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00002236 - adds r0, r1 - movs r1, 0x15 - strh r1, [r0] - ldr r1, =gUnknown_0857BB24 - movs r3, 0x9D - lsls r3, 1 - movs r0, 0 - movs r2, 0x80 - bl LoadBgTiles - movs r0, 0 - bl sub_80D19B4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D1818 - - thumb_func_start sub_80D184C -sub_80D184C: @ 80D184C - push {r4,r5,lr} - sub sp, 0x10 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r2, =0x00002236 - adds r1, r0, r2 - ldrh r0, [r1] - cmp r0, 0 - bne _080D186C - movs r0, 0 - b _080D18D2 - .pool -_080D186C: - subs r0, 0x1 - strh r0, [r1] - ldrh r1, [r1] - movs r0, 0x15 - subs r5, r0, r1 - movs r4, 0 - cmp r4, r5 - bge _080D18BC -_080D187C: - movs r0, 0 - movs r1, 0xA - bl GetBgAttribute - adds r1, r0, 0 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r2, =0x00002236 - adds r0, r2 - adds r1, 0x14 - ldrh r0, [r0] - adds r1, r0 - adds r1, r4 - lsls r1, 16 - lsrs r1, 16 - lsls r2, r4, 24 - lsrs r2, 24 - movs r0, 0x1 - str r0, [sp] - movs r0, 0x7 - str r0, [sp, 0x4] - movs r0, 0xF - str r0, [sp, 0x8] - movs r0, 0x15 - str r0, [sp, 0xC] - movs r0, 0 - movs r3, 0xD - bl WriteSequenceToBgTilemapBuffer - adds r4, 0x1 - cmp r4, r5 - blt _080D187C -_080D18BC: - adds r0, r5, 0 - bl sub_80D19B4 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00002236 - adds r0, r1 - ldrh r1, [r0] - negs r0, r1 - orrs r0, r1 - lsrs r0, 31 -_080D18D2: - add sp, 0x10 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80D184C - - thumb_func_start sub_80D18E4 -sub_80D18E4: @ 80D18E4 - push {r4,r5,lr} - sub sp, 0x10 - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - ldr r4, =0x00002236 - adds r0, r4 - ldrh r0, [r0] - cmp r0, 0x16 - bne _080D1904 - movs r0, 0 - b _080D19A4 - .pool -_080D1904: - cmp r0, 0 - bne _080D1920 - movs r0, 0x1 - str r0, [sp] - movs r0, 0x9 - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0x15 - movs r3, 0xC - bl FillBgTilemapBufferRect -_080D1920: - ldr r1, [r5] - adds r1, r4 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - ldrh r1, [r1] - movs r0, 0x15 - subs r5, r0, r1 - movs r4, 0 - cmp r4, r5 - bge _080D1976 -_080D1936: - movs r0, 0 - movs r1, 0xA - bl GetBgAttribute - adds r1, r0, 0 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r2, =0x00002236 - adds r0, r2 - adds r1, 0x14 - ldrh r0, [r0] - adds r1, r0 - adds r1, r4 - lsls r1, 16 - lsrs r1, 16 - lsls r2, r4, 24 - lsrs r2, 24 - movs r0, 0x1 - str r0, [sp] - movs r0, 0x7 - str r0, [sp, 0x4] - movs r0, 0xF - str r0, [sp, 0x8] - movs r0, 0x15 - str r0, [sp, 0xC] - movs r0, 0 - movs r3, 0xD - bl WriteSequenceToBgTilemapBuffer - adds r4, 0x1 - cmp r4, r5 - blt _080D1936 -_080D1976: - cmp r5, 0 - blt _080D1980 - adds r0, r5, 0 - bl sub_80D19B4 -_080D1980: - adds r2, r5, 0x1 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x1 - str r0, [sp] - movs r0, 0x9 - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r3, 0xC - bl FillBgTilemapBufferRect - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - movs r0, 0x1 -_080D19A4: - add sp, 0x10 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80D18E4 - - thumb_func_start sub_80D19B4 -sub_80D19B4: @ 80D19B4 - push {r4-r7,lr} - sub sp, 0xC - adds r7, r0, 0 - cmp r7, 0 - beq _080D19EC - movs r1, 0x9D - lsls r1, 1 - lsls r4, r7, 24 - lsrs r4, 24 - str r4, [sp] - movs r6, 0x1 - str r6, [sp, 0x4] - movs r5, 0xF - str r5, [sp, 0x8] - movs r0, 0 - movs r2, 0 - movs r3, 0xC - bl FillBgTilemapBufferRect - ldr r1, =0x0000093a - str r4, [sp] - str r6, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0 - movs r2, 0 - movs r3, 0x14 - bl FillBgTilemapBufferRect -_080D19EC: - ldr r1, =0x0000013b - lsls r5, r7, 24 - lsrs r5, 24 - movs r4, 0x1 - str r4, [sp] - movs r0, 0x7 - str r0, [sp, 0x4] - movs r6, 0xF - str r6, [sp, 0x8] - movs r0, 0 - adds r2, r5, 0 - movs r3, 0xD - bl FillBgTilemapBufferRect - movs r1, 0x9E - lsls r1, 1 - str r4, [sp] - str r4, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - adds r2, r5, 0 - movs r3, 0xC - bl FillBgTilemapBufferRect - ldr r1, =0x0000013d - str r4, [sp] - str r4, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - adds r2, r5, 0 - movs r3, 0x14 - bl FillBgTilemapBufferRect - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D19B4 - - thumb_func_start sub_80D1A48 -sub_80D1A48: @ 80D1A48 - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080D1A68 - ldrh r0, [r4, 0x2E] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl sub_80D1740 - ldr r0, =SpriteCallbackDummy - str r0, [r4, 0x1C] -_080D1A68: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D1A48 - - thumb_func_start sub_80D1A74 -sub_80D1A74: @ 80D1A74 - push {lr} - adds r3, r0, 0 - movs r0, 0x2E - ldrsh r1, [r3, r0] - cmp r1, 0 - beq _080D1A86 - cmp r1, 0x1 - beq _080D1AA2 - b _080D1AD0 -_080D1A86: - ldrh r0, [r3, 0x20] - lsls r0, 4 - strh r0, [r3, 0x30] - ldrh r0, [r3, 0x22] - lsls r0, 4 - strh r0, [r3, 0x32] - movs r0, 0xA - strh r0, [r3, 0x34] - movs r0, 0x15 - strh r0, [r3, 0x36] - strh r1, [r3, 0x38] - ldrh r0, [r3, 0x2E] - adds r0, 0x1 - strh r0, [r3, 0x2E] -_080D1AA2: - ldrh r1, [r3, 0x30] - ldrh r0, [r3, 0x34] - subs r1, r0 - strh r1, [r3, 0x30] - ldrh r0, [r3, 0x32] - ldrh r2, [r3, 0x36] - subs r0, r2 - strh r0, [r3, 0x32] - lsls r1, 16 - asrs r1, 20 - strh r1, [r3, 0x20] - lsls r0, 16 - asrs r0, 20 - strh r0, [r3, 0x22] - ldrh r0, [r3, 0x38] - adds r0, 0x1 - strh r0, [r3, 0x38] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xB - ble _080D1AD0 - ldr r0, =sub_80D1AD8 - str r0, [r3, 0x1C] -_080D1AD0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D1A74 - - thumb_func_start sub_80D1AD8 -sub_80D1AD8: @ 80D1AD8 - ldr r1, =gUnknown_02039D08 - ldr r3, [r1] - ldr r1, =0x00000cb4 - adds r3, r1 - ldr r1, [r3] - ldrh r1, [r1, 0x20] - adds r1, 0x4 - strh r1, [r0, 0x20] - ldr r2, [r3] - ldrh r1, [r2, 0x26] - ldrh r2, [r2, 0x22] - adds r1, r2 - adds r1, 0x8 - strh r1, [r0, 0x22] - ldr r1, [r3] - ldrb r1, [r1, 0x5] - movs r2, 0xC - ands r2, r1 - ldrb r3, [r0, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r3 - orrs r1, r2 - strb r1, [r0, 0x5] - bx lr - .pool - thumb_func_end sub_80D1AD8 - - thumb_func_start sub_80D1B14 -sub_80D1B14: @ 80D1B14 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x2E - ldrsh r1, [r4, r0] - cmp r1, 0 - beq _080D1B26 - cmp r1, 0x1 - beq _080D1B42 - b _080D1B8A -_080D1B26: - ldrh r0, [r4, 0x20] - lsls r0, 4 - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x22] - lsls r0, 4 - strh r0, [r4, 0x32] - movs r0, 0xA - strh r0, [r4, 0x34] - movs r0, 0x15 - strh r0, [r4, 0x36] - strh r1, [r4, 0x38] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] -_080D1B42: - ldrh r0, [r4, 0x34] - ldrh r1, [r4, 0x30] - adds r0, r1 - strh r0, [r4, 0x30] - ldrh r1, [r4, 0x36] - ldrh r2, [r4, 0x32] - adds r1, r2 - strh r1, [r4, 0x32] - lsls r0, 16 - asrs r0, 20 - strh r0, [r4, 0x20] - lsls r1, 16 - asrs r1, 20 - strh r1, [r4, 0x22] - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xB - ble _080D1B8A - adds r0, r4, 0 - bl sub_80D13C4 - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x3A] - lsls r1, 24 - lsrs r1, 24 - ldrh r2, [r4, 0x3C] - lsls r2, 24 - lsrs r2, 24 - bl sub_80D140C - ldr r0, =SpriteCallbackDummy - str r0, [r4, 0x1C] -_080D1B8A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D1B14 - - thumb_func_start sub_80D1B94 -sub_80D1B94: @ 80D1B94 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x2E - ldrsh r1, [r4, r0] - cmp r1, 0 - beq _080D1BA6 - cmp r1, 0x1 - beq _080D1BC2 - b _080D1C20 -_080D1BA6: - ldrh r0, [r4, 0x20] - lsls r0, 4 - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x22] - lsls r0, 4 - strh r0, [r4, 0x32] - movs r0, 0xA - strh r0, [r4, 0x34] - movs r0, 0x15 - strh r0, [r4, 0x36] - strh r1, [r4, 0x38] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] -_080D1BC2: - ldrh r1, [r4, 0x30] - ldrh r0, [r4, 0x34] - subs r1, r0 - strh r1, [r4, 0x30] - ldrh r0, [r4, 0x32] - ldrh r2, [r4, 0x36] - subs r0, r2 - strh r0, [r4, 0x32] - lsls r1, 16 - asrs r1, 20 - strh r1, [r4, 0x20] - lsls r0, 16 - asrs r0, 20 - strh r0, [r4, 0x22] - ldr r1, =gSineTable - movs r2, 0x38 - ldrsh r0, [r4, r2] - lsls r0, 4 - adds r0, r1 - ldrh r0, [r0] - lsls r0, 16 - asrs r0, 20 - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xB - ble _080D1C20 - adds r0, r4, 0 - bl sub_80D13C4 - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x3A] - lsls r1, 24 - lsrs r1, 24 - ldrh r2, [r4, 0x3C] - lsls r2, 24 - lsrs r2, 24 - bl sub_80D140C - movs r0, 0 - strh r0, [r4, 0x24] - ldr r0, =sub_80D1AD8 - str r0, [r4, 0x1C] -_080D1C20: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D1B94 - - thumb_func_start sub_80D1C30 -sub_80D1C30: @ 80D1C30 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x2E - ldrsh r1, [r4, r0] - cmp r1, 0 - beq _080D1C42 - cmp r1, 0x1 - beq _080D1C5E - b _080D1CBE -_080D1C42: - ldrh r0, [r4, 0x20] - lsls r0, 4 - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x22] - lsls r0, 4 - strh r0, [r4, 0x32] - movs r0, 0xA - strh r0, [r4, 0x34] - movs r0, 0x15 - strh r0, [r4, 0x36] - strh r1, [r4, 0x38] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] -_080D1C5E: - ldrh r0, [r4, 0x34] - ldrh r1, [r4, 0x30] - adds r0, r1 - strh r0, [r4, 0x30] - ldrh r1, [r4, 0x36] - ldrh r2, [r4, 0x32] - adds r1, r2 - strh r1, [r4, 0x32] - lsls r0, 16 - asrs r0, 20 - strh r0, [r4, 0x20] - lsls r1, 16 - asrs r1, 20 - strh r1, [r4, 0x22] - ldr r1, =gSineTable - movs r2, 0x38 - ldrsh r0, [r4, r2] - lsls r0, 4 - adds r0, r1 - ldrh r0, [r0] - lsls r0, 16 - asrs r0, 20 - negs r0, r0 - strh r0, [r4, 0x24] - ldrh r0, [r4, 0x38] - adds r0, 0x1 - strh r0, [r4, 0x38] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xB - ble _080D1CBE - adds r0, r4, 0 - bl sub_80D13C4 - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r4, 0x3A] - lsls r1, 24 - lsrs r1, 24 - ldrh r2, [r4, 0x3C] - lsls r2, 24 - lsrs r2, 24 - bl sub_80D140C - ldr r0, =SpriteCallbackDummy - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x24] -_080D1CBE: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D1C30 - - thumb_func_start sub_80D1CCC -sub_80D1CCC: @ 80D1CCC - push {lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x22] - subs r0, 0x8 - strh r0, [r2, 0x22] - movs r1, 0x22 - ldrsh r0, [r2, r1] - movs r3, 0x26 - ldrsh r1, [r2, r3] - adds r0, r1 - movs r1, 0x10 - negs r1, r1 - cmp r0, r1 - bge _080D1CFC - ldr r0, =SpriteCallbackDummy - str r0, [r2, 0x1C] - adds r0, r2, 0 - bl sub_80D13C4 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl sub_80D1740 -_080D1CFC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D1CCC - - thumb_func_start TaskDummy0 -TaskDummy0: @ 80D1D04 - bx lr - thumb_func_end TaskDummy0 - - thumb_func_start nullsub_98 -nullsub_98: @ 80D1D08 - bx lr - thumb_func_end nullsub_98 - - thumb_func_start StorageGetCurrentBox -@ char StorageGetCurrentBox() -StorageGetCurrentBox: @ 80D1D0C - ldr r0, =gPokemonStoragePtr - ldr r0, [r0] - ldrb r0, [r0] - bx lr - .pool - thumb_func_end StorageGetCurrentBox - - thumb_func_start SetCurrentBox -SetCurrentBox: @ 80D1D18 - push {lr} - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xD - bhi _080D1D28 - ldr r0, =gPokemonStoragePtr - ldr r0, [r0] - strb r1, [r0] -_080D1D28: - pop {r0} - bx r0 - .pool - thumb_func_end SetCurrentBox - - thumb_func_start GetBoxMonDataFromAnyBox -GetBoxMonDataFromAnyBox: @ 80D1D30 - push {r4,r5,lr} - adds r5, r2, 0 - lsls r0, 24 - lsrs r3, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - cmp r3, 0xD - bhi _080D1D6C - cmp r4, 0x1D - bhi _080D1D6C - ldr r2, =gPokemonStoragePtr - lsls r0, r3, 2 - adds r0, r3 - lsls r1, r0, 4 - subs r1, r0 - lsls r1, 5 - adds r1, 0x4 - ldr r0, [r2] - adds r0, r1 - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 4 - adds r0, r1 - adds r1, r5, 0 - bl GetBoxMonData - b _080D1D6E - .pool -_080D1D6C: - movs r0, 0 -_080D1D6E: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end GetBoxMonDataFromAnyBox - - thumb_func_start SetBoxMonDataFromAnyBox -SetBoxMonDataFromAnyBox: @ 80D1D74 - push {r4-r6,lr} - adds r5, r2, 0 - adds r6, r3, 0 - lsls r0, 24 - lsrs r3, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - cmp r3, 0xD - bhi _080D1DAC - cmp r4, 0x1D - bhi _080D1DAC - ldr r2, =gPokemonStoragePtr - lsls r0, r3, 2 - adds r0, r3 - lsls r1, r0, 4 - subs r1, r0 - lsls r1, 5 - adds r1, 0x4 - ldr r0, [r2] - adds r0, r1 - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 4 - adds r0, r1 - adds r1, r5, 0 - adds r2, r6, 0 - bl SetBoxMonData -_080D1DAC: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end SetBoxMonDataFromAnyBox - - thumb_func_start GetBoxMonDataFromSelectedBox -GetBoxMonDataFromSelectedBox: @ 80D1DB8 - push {lr} - adds r3, r0, 0 - adds r2, r1, 0 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =gPokemonStoragePtr - ldr r0, [r0] - ldrb r0, [r0] - adds r1, r3, 0 - bl GetBoxMonDataFromAnyBox - pop {r1} - bx r1 - .pool - thumb_func_end GetBoxMonDataFromSelectedBox - - thumb_func_start SetBoxMonDataFromSelectedBox -SetBoxMonDataFromSelectedBox: @ 80D1DD8 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r3, r2, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gPokemonStoragePtr - ldr r0, [r0] - ldrb r0, [r0] - adds r1, r4, 0 - adds r2, r5, 0 - bl SetBoxMonDataFromAnyBox - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end SetBoxMonDataFromSelectedBox - - thumb_func_start GetBoxMonNickFromAnyBox -GetBoxMonNickFromAnyBox: @ 80D1DFC - push {r4,r5,lr} - adds r5, r2, 0 - lsls r0, 24 - lsrs r3, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - cmp r3, 0xD - bhi _080D1E38 - cmp r4, 0x1D - bhi _080D1E38 - ldr r2, =gPokemonStoragePtr - lsls r0, r3, 2 - adds r0, r3 - lsls r1, r0, 4 - subs r1, r0 - lsls r1, 5 - adds r1, 0x4 - ldr r0, [r2] - adds r0, r1 - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 4 - adds r0, r1 - movs r1, 0x2 - adds r2, r5, 0 - bl GetBoxMonData - b _080D1E3C - .pool -_080D1E38: - movs r0, 0xFF - strb r0, [r5] -_080D1E3C: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end GetBoxMonNickFromAnyBox - - thumb_func_start sub_80D1E44 -sub_80D1E44: @ 80D1E44 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r2, r1, 24 - cmp r0, 0xD - bhi _080D1E84 - cmp r2, 0x1D - bhi _080D1E84 - ldr r6, =gPokemonStoragePtr - lsls r1, r0, 2 - adds r1, r0 - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 5 - adds r5, r0, 0x4 - ldr r0, [r6] - adds r0, r5 - lsls r1, r2, 2 - adds r1, r2 - lsls r4, r1, 4 - adds r0, r4 - movs r1, 0x5 - bl GetBoxMonData - cmp r0, 0 - beq _080D1E84 - ldr r0, [r6] - adds r0, r5 - adds r0, r4 - bl GetLevelFromBoxMonExp -_080D1E84: - movs r0, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80D1E44 - - thumb_func_start SetBoxMonNickFromAnyBox -SetBoxMonNickFromAnyBox: @ 80D1E90 - push {r4,r5,lr} - adds r5, r2, 0 - lsls r0, 24 - lsrs r3, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - cmp r3, 0xD - bhi _080D1EC6 - cmp r4, 0x1D - bhi _080D1EC6 - ldr r2, =gPokemonStoragePtr - lsls r0, r3, 2 - adds r0, r3 - lsls r1, r0, 4 - subs r1, r0 - lsls r1, 5 - adds r1, 0x4 - ldr r0, [r2] - adds r0, r1 - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 4 - adds r0, r1 - movs r1, 0x2 - adds r2, r5, 0 - bl SetBoxMonData -_080D1EC6: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end SetBoxMonNickFromAnyBox - - thumb_func_start GetAndCopyBoxMonDataFromAnyBox -GetAndCopyBoxMonDataFromAnyBox: @ 80D1ED0 - push {r4-r6,lr} - adds r5, r2, 0 - adds r6, r3, 0 - lsls r0, 24 - lsrs r3, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - cmp r3, 0xD - bhi _080D1F10 - cmp r4, 0x1D - bhi _080D1F10 - ldr r2, =gPokemonStoragePtr - lsls r0, r3, 2 - adds r0, r3 - lsls r1, r0, 4 - subs r1, r0 - lsls r1, 5 - adds r1, 0x4 - ldr r0, [r2] - adds r0, r1 - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 4 - adds r0, r1 - adds r1, r5, 0 - adds r2, r6, 0 - bl GetBoxMonData - b _080D1F12 - .pool -_080D1F10: - movs r0, 0 -_080D1F12: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end GetAndCopyBoxMonDataFromAnyBox - - thumb_func_start CopyBoxMonFromAnyBox -CopyBoxMonFromAnyBox: @ 80D1F18 - push {r4,r5,lr} - adds r5, r2, 0 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r1, 24 - cmp r4, 0xD - bhi _080D1F4E - cmp r1, 0x1D - bhi _080D1F4E - ldr r0, =gPokemonStoragePtr - ldr r0, [r0] - lsls r3, r1, 2 - adds r3, r1 - lsls r3, 4 - lsls r2, r4, 2 - adds r2, r4 - lsls r1, r2, 4 - subs r1, r2 - lsls r1, 5 - adds r3, r1 - adds r0, r3 - adds r0, 0x4 - adds r1, r5, 0 - movs r2, 0x50 - bl memcpy -_080D1F4E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end CopyBoxMonFromAnyBox - - thumb_func_start sub_80D1F58 -sub_80D1F58: @ 80D1F58 - push {r4,r5,lr} - adds r5, r2, 0 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r2, r1, 24 - cmp r4, 0xD - bhi _080D1F8E - cmp r2, 0x1D - bhi _080D1F8E - ldr r0, =gPokemonStoragePtr - ldr r1, [r0] - lsls r3, r2, 2 - adds r3, r2 - lsls r3, 4 - lsls r2, r4, 2 - adds r2, r4 - lsls r0, r2, 4 - subs r0, r2 - lsls r0, 5 - adds r3, r0 - adds r1, r3 - adds r1, 0x4 - adds r0, r5, 0 - movs r2, 0x50 - bl memcpy -_080D1F8E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D1F58 - - thumb_func_start sub_80D1F98 -sub_80D1F98: @ 80D1F98 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x14 - ldr r4, [sp, 0x30] - ldr r5, [sp, 0x34] - ldr r6, [sp, 0x3C] - mov r12, r6 - lsls r0, 24 - lsrs r7, r0, 24 - lsls r1, 24 - lsrs r6, r1, 24 - lsls r2, 16 - lsrs r2, 16 - mov r9, r2 - lsls r3, 24 - lsrs r3, 24 - mov r8, r3 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - mov r0, r12 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r7, 0xD - bhi _080D2004 - cmp r6, 0x1D - bhi _080D2004 - ldr r2, =gPokemonStoragePtr - lsls r0, r7, 2 - adds r0, r7 - lsls r1, r0, 4 - subs r1, r0 - lsls r1, 5 - adds r1, 0x4 - ldr r0, [r2] - adds r0, r1 - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 4 - adds r0, r1 - str r5, [sp] - ldr r1, [sp, 0x38] - str r1, [sp, 0x4] - str r3, [sp, 0x8] - ldr r1, [sp, 0x40] - str r1, [sp, 0xC] - mov r1, r9 - mov r2, r8 - adds r3, r4, 0 - bl CreateBoxMon -_080D2004: - add sp, 0x14 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D1F98 - - thumb_func_start ClearMonInBox -ClearMonInBox: @ 80D2018 - push {r4,lr} - lsls r0, 24 - lsrs r3, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - cmp r3, 0xD - bhi _080D2048 - cmp r4, 0x1D - bhi _080D2048 - ldr r2, =gPokemonStoragePtr - lsls r0, r3, 2 - adds r0, r3 - lsls r1, r0, 4 - subs r1, r0 - lsls r1, 5 - adds r1, 0x4 - ldr r0, [r2] - adds r0, r1 - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 4 - adds r0, r1 - bl ZeroBoxMonData -_080D2048: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end ClearMonInBox - - thumb_func_start sub_80D2054 -sub_80D2054: @ 80D2054 - push {r4,r5,lr} - adds r5, r2, 0 - lsls r0, 24 - lsrs r3, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - cmp r3, 0xD - bhi _080D2088 - cmp r4, 0x1D - bhi _080D2088 - ldr r2, =gPokemonStoragePtr - lsls r0, r3, 2 - adds r0, r3 - lsls r1, r0, 4 - subs r1, r0 - lsls r1, 5 - adds r1, 0x4 - ldr r0, [r2] - adds r0, r1 - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 4 - adds r0, r1 - adds r1, r5, 0 - bl BoxMonToMon -_080D2088: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D2054 - - thumb_func_start GetBoxedMonPtr -@ pokemon *GetBoxedMonPtr(u8 box_id, u8 pos) -GetBoxedMonPtr: @ 80D2094 - push {r4,lr} - lsls r0, 24 - lsrs r3, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - cmp r3, 0xD - bhi _080D20C8 - cmp r4, 0x1D - bhi _080D20C8 - ldr r2, =gPokemonStoragePtr - lsls r0, r3, 2 - adds r0, r3 - lsls r1, r0, 4 - subs r1, r0 - lsls r1, 5 - adds r1, 0x4 - ldr r0, [r2] - adds r0, r1 - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 4 - adds r0, r1 - b _080D20CA - .pool -_080D20C8: - movs r0, 0 -_080D20CA: - pop {r4} - pop {r1} - bx r1 - thumb_func_end GetBoxedMonPtr - - thumb_func_start GetBoxNamePtr -GetBoxNamePtr: @ 80D20D0 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xD - bls _080D20DE - movs r0, 0 - b _080D20EC -_080D20DE: - ldr r0, =gPokemonStoragePtr - lsls r1, r2, 3 - adds r1, r2 - ldr r2, =0x00008344 - adds r1, r2 - ldr r0, [r0] - adds r0, r1 -_080D20EC: - pop {r1} - bx r1 - .pool - thumb_func_end GetBoxNamePtr - - thumb_func_start sub_80D20F8 -sub_80D20F8: @ 80D20F8 - push {lr} - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xD - bls _080D2106 - movs r0, 0 - b _080D2112 -_080D2106: - ldr r0, =gPokemonStoragePtr - ldr r0, [r0] - ldr r2, =0x000083c2 - adds r0, r2 - adds r0, r1 - ldrb r0, [r0] -_080D2112: - pop {r1} - bx r1 - .pool - thumb_func_end sub_80D20F8 - - thumb_func_start SetBoxWallpaper -SetBoxWallpaper: @ 80D2120 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r1, 24 - lsrs r1, 24 - cmp r2, 0xD - bhi _080D213E - cmp r1, 0x10 - bhi _080D213E - ldr r0, =gPokemonStoragePtr - ldr r0, [r0] - ldr r3, =0x000083c2 - adds r0, r3 - adds r0, r2 - strb r1, [r0] -_080D213E: - pop {r0} - bx r0 - .pool - thumb_func_end SetBoxWallpaper - - thumb_func_start sub_80D214C -sub_80D214C: @ 80D214C - push {r4-r7,lr} - mov r7, r8 - push {r7} - mov r8, r0 - lsls r1, 24 - lsrs r0, r1, 24 - lsls r2, 24 - lsrs r7, r2, 24 - lsls r3, 24 - lsrs r3, 24 - adds r4, r3, 0 - ldr r2, =0x0000ffff - cmp r3, 0x1 - bhi _080D216E - movs r2, 0x1 - cmp r3, 0x1 - beq _080D2172 -_080D216E: - cmp r4, 0x3 - bne _080D21BC -_080D2172: - lsls r0, 24 - asrs r0, 24 - lsls r2, 16 - asrs r1, r2, 16 - adds r1, r0 - lsls r0, r1, 16 - asrs r1, r0, 16 - adds r6, r2, 0 - cmp r1, 0 - blt _080D2208 - cmp r1, r7 - bgt _080D2208 -_080D218A: - asrs r4, r0, 16 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 4 - add r0, r8 - movs r1, 0xB - bl GetBoxMonData - cmp r0, 0 - bne _080D21B4 - asrs r0, r6, 16 - adds r0, r4, r0 - lsls r0, 16 - asrs r2, r0, 16 - cmp r2, 0 - blt _080D2208 - cmp r2, r7 - ble _080D218A - b _080D2208 - .pool -_080D21B4: - adds r0, r4, 0 - b _080D220C -_080D21B8: - adds r0, r5, 0 - b _080D220C -_080D21BC: - lsls r0, 24 - asrs r0, 24 - lsls r2, 16 - asrs r1, r2, 16 - adds r1, r0 - lsls r0, r1, 16 - asrs r1, r0, 16 - adds r6, r2, 0 - cmp r1, 0 - blt _080D2208 - cmp r1, r7 - bgt _080D2208 -_080D21D4: - asrs r5, r0, 16 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 4 - mov r1, r8 - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetBoxMonData - cmp r0, 0 - beq _080D21F8 - adds r0, r4, 0 - movs r1, 0x2D - bl GetBoxMonData - cmp r0, 0 - beq _080D21B8 -_080D21F8: - asrs r0, r6, 16 - adds r0, r5, r0 - lsls r0, 16 - asrs r2, r0, 16 - cmp r2, 0 - blt _080D2208 - cmp r2, r7 - ble _080D21D4 -_080D2208: - movs r0, 0x1 - negs r0, r0 -_080D220C: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80D214C - - thumb_func_start CheckFreePokemonStorageSpace -CheckFreePokemonStorageSpace: @ 80D2218 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - movs r2, 0 - ldr r0, =gPokemonStoragePtr - mov r8, r0 - movs r7, 0x4 -_080D2228: - movs r5, 0 - adds r6, r7, 0 - movs r4, 0 -_080D222E: - mov r1, r8 - ldr r0, [r1] - adds r0, r6 - adds r0, r4 - movs r1, 0x5 - str r2, [sp] - bl GetBoxMonData - ldr r2, [sp] - cmp r0, 0 - bne _080D224C - movs r0, 0x1 - b _080D2262 - .pool -_080D224C: - adds r4, 0x50 - adds r5, 0x1 - cmp r5, 0x1D - ble _080D222E - movs r0, 0x96 - lsls r0, 4 - adds r7, r0 - adds r2, 0x1 - cmp r2, 0xD - ble _080D2228 - movs r0, 0 -_080D2262: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end CheckFreePokemonStorageSpace - - thumb_func_start sub_80D2270 -sub_80D2270: @ 80D2270 - push {r4-r6,lr} - adds r2, r1, 0 - cmp r0, 0xD - bhi _080D22C8 - cmp r2, 0x1D - bhi _080D22C8 - ldr r6, =gPokemonStoragePtr - lsls r1, r0, 2 - adds r1, r0 - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 5 - adds r5, r0, 0x4 - ldr r0, [r6] - adds r0, r5 - lsls r1, r2, 2 - adds r1, r2 - lsls r4, r1, 4 - adds r0, r4 - movs r1, 0x5 - bl GetBoxMonData - cmp r0, 0 - beq _080D22C8 - ldr r0, [r6] - adds r0, r5 - adds r0, r4 - movs r1, 0x6 - bl GetBoxMonData - cmp r0, 0 - bne _080D22C8 - ldr r0, [r6] - adds r0, r5 - adds r0, r4 - movs r1, 0x4 - bl GetBoxMonData - cmp r0, 0 - bne _080D22C8 - movs r0, 0x1 - b _080D22CA - .pool -_080D22C8: - movs r0, 0 -_080D22CA: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80D2270 - - thumb_func_start sub_80D22D0 -sub_80D22D0: @ 80D22D0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - movs r7, 0 - movs r0, 0 - ldr r1, =gPokemonStoragePtr - mov r9, r1 -_080D22E0: - lsls r1, r0, 2 - adds r2, r0, 0x1 - mov r8, r2 - adds r1, r0 - movs r5, 0 - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 5 - adds r4, r0, 0x4 - movs r6, 0x1D -_080D22F4: - mov r1, r9 - ldr r0, [r1] - adds r0, r4 - adds r0, r5 - movs r1, 0x5 - bl GetBoxMonData - cmp r0, 0 - beq _080D231A - mov r2, r9 - ldr r0, [r2] - adds r0, r4 - adds r0, r5 - movs r1, 0x6 - bl GetBoxMonData - cmp r0, 0 - bne _080D231A - adds r7, 0x1 -_080D231A: - adds r5, 0x50 - subs r6, 0x1 - cmp r6, 0 - bge _080D22F4 - mov r0, r8 - cmp r0, 0xD - ble _080D22E0 - adds r0, r7, 0 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80D22D0 - - thumb_func_start sub_80D233C -sub_80D233C: @ 80D233C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - movs r7, 0 - movs r0, 0 - ldr r1, =gPokemonStoragePtr - mov r9, r1 -_080D234C: - lsls r1, r0, 2 - adds r2, r0, 0x1 - mov r8, r2 - adds r1, r0 - movs r5, 0 - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 5 - adds r4, r0, 0x4 - movs r6, 0x1D -_080D2360: - mov r1, r9 - ldr r0, [r1] - adds r0, r4 - adds r0, r5 - movs r1, 0x5 - bl GetBoxMonData - cmp r0, 0 - bne _080D2384 - mov r2, r9 - ldr r0, [r2] - adds r0, r4 - adds r0, r5 - movs r1, 0x6 - bl GetBoxMonData - cmp r0, 0 - beq _080D2386 -_080D2384: - adds r7, 0x1 -_080D2386: - adds r5, 0x50 - subs r6, 0x1 - cmp r6, 0 - bge _080D2360 - mov r0, r8 - cmp r0, 0xD - ble _080D234C - adds r0, r7, 0 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80D233C - - thumb_func_start sub_80D23A8 -sub_80D23A8: @ 80D23A8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - mov r1, sp - strh r0, [r1] - ldr r0, =0x00000163 - strh r0, [r1, 0x2] - movs r0, 0 - mov r8, r0 - ldr r7, =gPokemonStoragePtr - movs r5, 0x4 -_080D23C0: - movs r6, 0 - movs r4, 0 -_080D23C4: - ldr r0, [r7] - adds r0, r5 - adds r0, r4 - movs r1, 0x5 - bl GetBoxMonData - cmp r0, 0 - beq _080D2404 - ldr r0, [r7] - adds r0, r5 - adds r0, r4 - movs r1, 0x6 - bl GetBoxMonData - cmp r0, 0 - bne _080D2404 - ldr r0, [r7] - adds r0, r5 - adds r0, r4 - movs r1, 0x51 - mov r2, sp - bl GetBoxMonData - cmp r0, 0 - beq _080D2404 - movs r0, 0x1 - b _080D241E - .pool -_080D2404: - adds r4, 0x50 - adds r6, 0x1 - cmp r6, 0x1D - ble _080D23C4 - movs r0, 0x96 - lsls r0, 4 - adds r5, r0 - movs r0, 0x1 - add r8, r0 - mov r0, r8 - cmp r0, 0xD - ble _080D23C0 - movs r0, 0 -_080D241E: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80D23A8 - - thumb_func_start ResetWaldaWallpaper -ResetWaldaWallpaper: @ 80D242C - ldr r2, =gSaveBlock1Ptr - ldr r0, [r2] - ldr r1, =0x00003d84 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - ldr r0, [r2] - ldr r3, =0x00003d85 - adds r0, r3 - strb r1, [r0] - ldr r0, [r2] - adds r3, 0x1 - adds r0, r3 - strb r1, [r0] - ldr r1, [r2] - ldr r0, =0x00003d70 - adds r2, r1, r0 - ldr r0, =0x00007b35 - strh r0, [r2] - subs r3, 0x14 - adds r2, r1, r3 - ldr r0, =0x00006186 - strh r0, [r2] - ldr r0, =0x00003d74 - adds r1, r0 - movs r0, 0xFF - strb r0, [r1] - bx lr - .pool - thumb_func_end ResetWaldaWallpaper - - thumb_func_start SetWaldaWallpaperLockedOrUnlocked -SetWaldaWallpaperLockedOrUnlocked: @ 80D2480 - ldr r1, =gSaveBlock1Ptr - ldr r1, [r1] - ldr r2, =0x00003d86 - adds r1, r2 - strb r0, [r1] - bx lr - .pool - thumb_func_end SetWaldaWallpaperLockedOrUnlocked - - thumb_func_start IsWaldaWallpaperUnlocked -IsWaldaWallpaperUnlocked: @ 80D2494 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003d86 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end IsWaldaWallpaperUnlocked - - thumb_func_start GetWaldaWallpaperPatternId -GetWaldaWallpaperPatternId: @ 80D24A8 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003d85 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end GetWaldaWallpaperPatternId - - thumb_func_start SetWaldaWallpaperPatternId -SetWaldaWallpaperPatternId: @ 80D24BC - push {lr} - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xF - bhi _080D24D0 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x00003d85 - adds r0, r2 - strb r1, [r0] -_080D24D0: - pop {r0} - bx r0 - .pool - thumb_func_end SetWaldaWallpaperPatternId - - thumb_func_start GetWaldaWallpaperIconId -GetWaldaWallpaperIconId: @ 80D24DC - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003d84 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end GetWaldaWallpaperIconId - - thumb_func_start SetWaldaWallpaperIconId -SetWaldaWallpaperIconId: @ 80D24F0 - push {lr} - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x1D - bhi _080D2504 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x00003d84 - adds r0, r2 - strb r1, [r0] -_080D2504: - pop {r0} - bx r0 - .pool - thumb_func_end SetWaldaWallpaperIconId - - thumb_func_start GetWaldaWallpaperColorsPtr -GetWaldaWallpaperColorsPtr: @ 80D2510 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003d70 - adds r0, r1 - bx lr - .pool - thumb_func_end GetWaldaWallpaperColorsPtr - - thumb_func_start SetWaldaWallpaperColors -SetWaldaWallpaperColors: @ 80D2524 - push {r4,lr} - ldr r2, =gSaveBlock1Ptr - ldr r2, [r2] - ldr r4, =0x00003d70 - adds r3, r2, r4 - strh r0, [r3] - ldr r0, =0x00003d72 - adds r2, r0 - strh r1, [r2] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end SetWaldaWallpaperColors - - thumb_func_start GetWaldaPhrasePtr -GetWaldaPhrasePtr: @ 80D2548 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00003d74 - adds r0, r1 - bx lr - .pool - thumb_func_end GetWaldaPhrasePtr - - thumb_func_start SetWaldaPhrase -SetWaldaPhrase: @ 80D255C - push {lr} - adds r1, r0, 0 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x00003d74 - adds r0, r2 - bl StringCopy - pop {r0} - bx r0 - .pool - thumb_func_end SetWaldaPhrase - - thumb_func_start IsWaldaPhraseEmpty -IsWaldaPhraseEmpty: @ 80D2578 - push {lr} - movs r1, 0 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x00003d74 - adds r0, r2 - ldrb r0, [r0] - cmp r0, 0xFF - bne _080D258C - movs r1, 0x1 -_080D258C: - adds r0, r1, 0 - pop {r1} - bx r1 - .pool - thumb_func_end IsWaldaPhraseEmpty - - thumb_func_start sub_80D259C -sub_80D259C: @ 80D259C - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r6, =gUnknown_02039D84 - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 4 - bl Alloc - str r0, [r6] - ldr r5, =gUnknown_02039D88 - movs r1, 0 - cmp r0, 0 - beq _080D25BA - adds r1, r4, 0 -_080D25BA: - strh r1, [r5] - movs r2, 0 - cmp r2, r1 - bcs _080D25E2 - movs r3, 0 - adds r4, r5, 0 -_080D25C6: - ldr r0, [r6] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 4 - adds r1, r0 - str r3, [r1, 0x18] - adds r1, 0x2C - strb r3, [r1] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - ldrh r0, [r4] - cmp r2, r0 - bcc _080D25C6 -_080D25E2: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D259C - - thumb_func_start sub_80D25F0 -sub_80D25F0: @ 80D25F0 - push {lr} - ldr r0, =gUnknown_02039D84 - ldr r0, [r0] - bl Free - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D25F0 - - thumb_func_start sub_80D2604 -sub_80D2604: @ 80D2604 - push {r4,r5,lr} - movs r4, 0 - ldr r0, =gUnknown_02039D88 - ldrh r0, [r0] - cmp r4, r0 - bge _080D2634 - movs r5, 0 -_080D2612: - ldr r0, =gUnknown_02039D84 - ldr r0, [r0] - adds r0, r5, r0 - adds r0, 0x2C - ldrb r0, [r0] - cmp r0, 0x1 - bne _080D2628 - lsls r0, r4, 24 - lsrs r0, 24 - bl sub_80D2918 -_080D2628: - adds r5, 0x30 - adds r4, 0x1 - ldr r0, =gUnknown_02039D88 - ldrh r0, [r0] - cmp r4, r0 - blt _080D2612 -_080D2634: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D2604 - - thumb_func_start sub_80D2644 -sub_80D2644: @ 80D2644 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - adds r4, r2, 0 - ldr r2, [sp, 0x24] - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r7, r1, 24 - lsls r3, 16 - lsrs r3, 16 - mov r10, r3 - lsls r2, 16 - lsrs r2, 16 - str r2, [sp] - ldr r0, =gUnknown_02039D88 - ldrh r0, [r0] - cmp r6, r0 - bcs _080D272C - ldr r0, =gUnknown_02039D84 - mov r9, r0 - ldr r0, [r0] - lsls r1, r6, 1 - mov r8, r1 - adds r5, r1, r6 - lsls r5, 4 - adds r0, r5, r0 - movs r1, 0 - str r1, [r0, 0x18] - str r4, [r0, 0x1C] - adds r0, 0x2B - strb r7, [r0] - mov r2, r9 - ldr r0, [r2] - adds r0, r5, r0 - mov r3, r10 - strh r3, [r0, 0x24] - mov r1, sp - ldrh r1, [r1] - strh r1, [r0, 0x26] - adds r0, r7, 0 - movs r1, 0x3 - bl GetBgAttribute - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r7, 0 - movs r1, 0x9 - bl GetBgAttribute - lsls r0, 16 - lsrs r0, 16 - mov r2, r9 - ldr r1, [r2] - adds r5, r1 - ldr r2, =gSpriteTemplate_857BC88 - lsls r4, 2 - lsls r1, r0, 4 - adds r4, r1 - adds r4, r2 - ldrh r1, [r4] - strh r1, [r5, 0x20] - ldrh r1, [r4, 0x2] - strh r1, [r5, 0x22] - mov r2, r8 - cmp r0, 0 - beq _080D26E8 - adds r1, r5, 0 - adds r1, 0x2A - movs r0, 0x1 - b _080D26EE - .pool -_080D26E8: - adds r1, r5, 0 - adds r1, 0x2A - movs r0, 0x2 -_080D26EE: - strb r0, [r1] - ldr r4, =gUnknown_02039D84 - ldr r1, [r4] - adds r2, r6 - lsls r2, 4 - adds r1, r2, r1 - adds r0, r1, 0 - adds r0, 0x2A - ldrb r0, [r0] - mov r3, r10 - muls r3, r0 - movs r0, 0 - strh r3, [r1, 0x28] - mov r3, r10 - strh r3, [r1, 0x10] - mov r5, sp - ldrh r5, [r5] - strh r5, [r1, 0x12] - strh r0, [r1, 0xC] - strh r0, [r1, 0xE] - strh r0, [r1, 0x14] - strh r0, [r1, 0x16] - adds r0, r1, 0 - adds r0, 0xC - ldm r0!, {r3,r5,r6} - stm r1!, {r3,r5,r6} - ldr r0, [r4] - adds r2, r0 - adds r2, 0x2C - movs r0, 0x1 - strb r0, [r2] -_080D272C: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D2644 - - thumb_func_start sub_80D2740 -sub_80D2740: @ 80D2740 - push {lr} - adds r3, r1, 0 - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gUnknown_02039D88 - ldrh r0, [r0] - cmp r2, r0 - bcs _080D2764 - ldr r0, =gUnknown_02039D84 - ldr r1, [r0] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 4 - adds r0, r1 - str r3, [r0, 0x18] - adds r0, 0x2C - movs r1, 0x1 - strb r1, [r0] -_080D2764: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D2740 - - thumb_func_start sub_80D2770 -sub_80D2770: @ 80D2770 - push {r4,lr} - lsls r0, 24 - lsrs r3, r0, 24 - lsls r1, 16 - lsrs r4, r1, 16 - lsls r2, 16 - lsrs r2, 16 - ldr r0, =gUnknown_02039D88 - ldrh r0, [r0] - cmp r3, r0 - bcs _080D279C - ldr r0, =gUnknown_02039D84 - ldr r1, [r0] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 4 - adds r0, r1 - strh r4, [r0, 0x14] - strh r2, [r0, 0x16] - adds r0, 0x2C - movs r1, 0x1 - strb r1, [r0] -_080D279C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D2770 - - thumb_func_start sub_80D27AC -sub_80D27AC: @ 80D27AC - push {r4-r6,lr} - ldr r4, [sp, 0x10] - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 16 - lsrs r6, r1, 16 - lsls r2, 16 - lsrs r2, 16 - lsls r3, 16 - lsrs r3, 16 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =gUnknown_02039D88 - ldrh r0, [r0] - cmp r5, r0 - bcs _080D27E6 - ldr r0, =gUnknown_02039D84 - ldr r1, [r0] - lsls r0, r5, 1 - adds r0, r5 - lsls r0, 4 - adds r0, r1 - strh r6, [r0, 0xC] - strh r2, [r0, 0xE] - strh r3, [r0, 0x10] - strh r4, [r0, 0x12] - adds r0, 0x2C - movs r1, 0x1 - strb r1, [r0] -_080D27E6: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D27AC - - thumb_func_start sub_80D27F4 -sub_80D27F4: @ 80D27F4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - lsrs r1, 24 - lsls r2, 24 - lsrs r6, r2, 24 - ldr r0, =gUnknown_02039D88 - ldrh r0, [r0] - cmp r5, r0 - bcc _080D280C - b _080D290E -_080D280C: - ldr r4, =gUnknown_02039D84 - lsls r2, r5, 1 - cmp r1, 0x5 - bls _080D2816 - b _080D2900 -_080D2816: - lsls r0, r1, 2 - ldr r1, =_080D282C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080D282C: - .4byte _080D2844 - .4byte _080D2864 - .4byte _080D2888 - .4byte _080D28A8 - .4byte _080D28CC - .4byte _080D28E8 -_080D2844: - ldr r4, =gUnknown_02039D84 - ldr r0, [r4] - lsls r3, r5, 1 - adds r1, r3, r5 - lsls r1, 4 - adds r1, r0 - lsls r2, r6, 24 - asrs r2, 24 - ldrh r0, [r1, 0x14] - adds r0, r2 - strh r0, [r1, 0x14] - ldrh r0, [r1, 0x10] - subs r0, r2 - b _080D287E - .pool -_080D2864: - ldr r4, =gUnknown_02039D84 - ldr r0, [r4] - lsls r3, r5, 1 - adds r1, r3, r5 - lsls r1, 4 - adds r1, r0 - lsls r2, r6, 24 - asrs r2, 24 - ldrh r0, [r1, 0xC] - adds r0, r2 - strh r0, [r1, 0xC] - ldrh r0, [r1, 0x10] - adds r0, r2 -_080D287E: - strh r0, [r1, 0x10] - adds r2, r3, 0 - b _080D2900 - .pool -_080D2888: - ldr r4, =gUnknown_02039D84 - ldr r0, [r4] - lsls r3, r5, 1 - adds r1, r3, r5 - lsls r1, 4 - adds r1, r0 - lsls r2, r6, 24 - asrs r2, 24 - ldrh r0, [r1, 0x16] - adds r0, r2 - strh r0, [r1, 0x16] - ldrh r0, [r1, 0x12] - subs r0, r2 - b _080D28C2 - .pool -_080D28A8: - ldr r4, =gUnknown_02039D84 - ldr r0, [r4] - lsls r3, r5, 1 - adds r1, r3, r5 - lsls r1, 4 - adds r1, r0 - lsls r2, r6, 24 - asrs r2, 24 - ldrh r0, [r1, 0xE] - subs r0, r2 - strh r0, [r1, 0xE] - ldrh r0, [r1, 0x12] - adds r0, r2 -_080D28C2: - strh r0, [r1, 0x12] - adds r2, r3, 0 - b _080D2900 - .pool -_080D28CC: - ldr r3, =gUnknown_02039D84 - ldr r0, [r3] - lsls r2, r5, 1 - adds r1, r2, r5 - lsls r1, 4 - adds r1, r0 - lsls r0, r6, 24 - asrs r0, 24 - ldrh r4, [r1, 0x14] - adds r0, r4 - strh r0, [r1, 0x14] - b _080D28FE - .pool -_080D28E8: - ldr r3, =gUnknown_02039D84 - ldr r0, [r3] - lsls r2, r5, 1 - adds r1, r2, r5 - lsls r1, 4 - adds r1, r0 - lsls r0, r6, 24 - asrs r0, 24 - ldrh r4, [r1, 0x16] - adds r0, r4 - strh r0, [r1, 0x16] -_080D28FE: - adds r4, r3, 0 -_080D2900: - ldr r0, [r4] - adds r1, r2, r5 - lsls r1, 4 - adds r1, r0 - adds r1, 0x2C - movs r0, 0x1 - strb r0, [r1] -_080D290E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D27F4 - - thumb_func_start sub_80D2918 -sub_80D2918: @ 80D2918 - push {r4-r6,lr} - lsls r0, 24 - lsrs r2, r0, 24 - adds r6, r2, 0 - ldr r0, =gUnknown_02039D88 - ldrh r0, [r0] - cmp r2, r0 - bcs _080D2952 - ldr r5, =gUnknown_02039D84 - ldr r0, [r5] - lsls r1, r2, 1 - adds r1, r2 - lsls r4, r1, 4 - adds r0, r4, r0 - ldr r0, [r0, 0x18] - cmp r0, 0 - beq _080D2940 - adds r0, r2, 0 - bl sub_80D2960 -_080D2940: - adds r0, r6, 0 - bl sub_80D29F8 - ldr r1, [r5] - adds r1, r4, r1 - adds r0, r1, 0 - adds r0, 0xC - ldm r0!, {r2-r4} - stm r1!, {r2-r4} -_080D2952: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D2918 - - thumb_func_start sub_80D2960 -sub_80D2960: @ 80D2960 - 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 r8, r0 - ldr r4, =gUnknown_02039D84 - ldr r1, [r4] - lsls r5, r0, 1 - adds r0, r5, r0 - lsls r0, 4 - adds r0, r1 - adds r1, r0, 0 - adds r1, 0x2A - ldrb r3, [r1] - ldrh r1, [r0, 0x20] - adds r2, r3, 0 - muls r2, r1 - mov r9, r2 - movs r6, 0xA - ldrsh r1, [r0, r6] - mov r2, r9 - muls r2, r1 - ldr r1, [r0, 0x18] - adds r1, r2 - movs r6, 0x8 - ldrsh r2, [r0, r6] - muls r2, r3 - adds r7, r1, r2 - movs r6, 0 - ldrh r0, [r0, 0x6] - cmp r6, r0 - bge _080D29E4 - mov r10, r4 -_080D29AA: - mov r0, r10 - ldr r1, [r0] - mov r2, r8 - adds r4, r5, r2 - lsls r4, 4 - adds r1, r4, r1 - adds r0, r1, 0 - adds r0, 0x2B - ldrb r0, [r0] - ldrb r2, [r1, 0x8] - ldrb r3, [r1, 0xA] - adds r3, r6 - lsls r3, 24 - lsrs r3, 24 - ldrb r1, [r1, 0x4] - str r1, [sp] - movs r1, 0x1 - str r1, [sp, 0x4] - adds r1, r7, 0 - bl CopyToBgTilemapBufferRect - add r7, r9 - adds r6, 0x1 - mov r1, r10 - ldr r0, [r1] - adds r4, r0 - ldrh r4, [r4, 0x6] - cmp r6, r4 - blt _080D29AA -_080D29E4: - 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_80D2960 - - thumb_func_start sub_80D29F8 -sub_80D29F8: @ 80D29F8 - 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 r8, r0 - ldr r4, =gUnknown_02039D84 - ldr r1, [r4] - lsls r5, r0, 1 - adds r0, r5, r0 - lsls r0, 4 - adds r0, r1 - adds r1, r0, 0 - adds r1, 0x2A - ldrb r3, [r1] - ldrh r1, [r0, 0x24] - adds r2, r3, 0 - muls r2, r1 - mov r9, r2 - movs r6, 0xE - ldrsh r1, [r0, r6] - mov r2, r9 - muls r2, r1 - ldr r1, [r0, 0x1C] - adds r1, r2 - movs r6, 0xC - ldrsh r2, [r0, r6] - muls r2, r3 - adds r7, r1, r2 - movs r6, 0 - ldrh r0, [r0, 0x12] - cmp r6, r0 - bge _080D2A7C - mov r10, r4 -_080D2A42: - mov r0, r10 - ldr r1, [r0] - mov r2, r8 - adds r4, r5, r2 - lsls r4, 4 - adds r1, r4, r1 - adds r0, r1, 0 - adds r0, 0x2B - ldrb r0, [r0] - ldrb r2, [r1, 0x14] - ldrb r3, [r1, 0x16] - adds r3, r6 - lsls r3, 24 - lsrs r3, 24 - ldrb r1, [r1, 0x10] - str r1, [sp] - movs r1, 0x1 - str r1, [sp, 0x4] - adds r1, r7, 0 - bl CopyToBgTilemapBufferRect - add r7, r9 - adds r6, 0x1 - mov r1, r10 - ldr r0, [r1] - adds r4, r0 - ldrh r4, [r4, 0x12] - cmp r6, r4 - blt _080D2A42 -_080D2A7C: - 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_80D29F8 - - thumb_func_start sub_80D2A90 -sub_80D2A90: @ 80D2A90 - ldr r3, =gUnknown_02039D8C - str r0, [r3] - str r1, [r0] - movs r1, 0 - strb r2, [r0, 0x5] - strb r1, [r0, 0x4] - bx lr - .pool - thumb_func_end sub_80D2A90 - - thumb_func_start sub_80D2AA4 -sub_80D2AA4: @ 80D2AA4 - push {r4,r5,lr} - ldr r2, =gUnknown_02039D8C - ldr r1, [r2] - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _080D2AE2 - movs r4, 0 - ldrb r1, [r1, 0x4] - cmp r4, r1 - bcs _080D2ADA - adds r5, r2, 0 -_080D2ABA: - ldr r0, [r5] - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 2 - ldr r0, [r0] - adds r0, r1 - ldr r1, [r0, 0x10] - bl _call_via_r1 - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - ldr r0, [r5] - ldrb r0, [r0, 0x4] - cmp r4, r0 - bcc _080D2ABA -_080D2ADA: - ldr r0, =gUnknown_02039D8C - ldr r1, [r0] - movs r0, 0 - strb r0, [r1, 0x4] -_080D2AE2: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D2AA4 - - thumb_func_start sub_80D2AEC -sub_80D2AEC: @ 80D2AEC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - mov r9, r0 - mov r10, r3 - ldr r0, [sp, 0x24] - ldr r3, [sp, 0x28] - ldr r4, [sp, 0x2C] - ldr r5, [sp, 0x30] - ldr r6, [sp, 0x34] - lsls r1, 16 - lsrs r1, 16 - mov r12, r1 - lsls r2, 16 - lsrs r2, 16 - str r2, [sp] - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - lsls r3, 16 - lsrs r3, 16 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - lsls r6, 16 - lsrs r6, 16 - ldr r0, =gUnknown_02039D8C - ldr r2, [r0] - ldrb r0, [r2, 0x4] - adds r1, r0, 0 - ldrb r7, [r2, 0x5] - cmp r1, r7 - bcs _080D2B74 - adds r0, 0x1 - strb r0, [r2, 0x4] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 2 - ldr r1, [r2] - adds r1, r0 - lsls r0, r4, 1 - strh r0, [r1, 0x8] - ldr r2, [sp] - lsls r0, r2, 5 - add r0, r12 - lsls r0, 1 - add r0, r9 - str r0, [r1, 0x4] - adds r0, r3, 0 - muls r0, r6 - add r0, r8 - lsls r0, 1 - add r0, r10 - str r0, [r1] - strh r5, [r1, 0xC] - strh r6, [r1, 0xA] - ldr r0, =sub_80D2B88 - str r0, [r1, 0x10] - movs r0, 0x1 - b _080D2B76 - .pool -_080D2B74: - movs r0, 0 -_080D2B76: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80D2AEC - - thumb_func_start sub_80D2B88 -sub_80D2B88: @ 80D2B88 - push {r4,r5,lr} - adds r4, r0, 0 - movs r5, 0 - b _080D2BB2 -_080D2B90: - ldr r0, [r4] - ldr r1, [r4, 0x4] - ldrh r2, [r4, 0x8] - lsrs r2, 1 - bl CpuSet - ldr r0, [r4, 0x4] - adds r0, 0x40 - str r0, [r4, 0x4] - ldrh r1, [r4, 0xA] - lsls r1, 1 - ldr r0, [r4] - adds r0, r1 - str r0, [r4] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 -_080D2BB2: - ldrh r0, [r4, 0xC] - cmp r5, r0 - bcc _080D2B90 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80D2B88 - - thumb_func_start sub_80D2BC0 -sub_80D2BC0: @ 80D2BC0 - push {r4-r7,lr} - mov r12, r0 - ldr r0, [sp, 0x14] - lsls r1, 16 - lsrs r6, r1, 16 - lsls r2, 16 - lsrs r4, r2, 16 - lsls r3, 16 - lsrs r3, 16 - lsls r0, 16 - lsrs r5, r0, 16 - ldr r0, =gUnknown_02039D8C - ldr r2, [r0] - ldrb r0, [r2, 0x4] - adds r1, r0, 0 - ldrb r7, [r2, 0x5] - cmp r1, r7 - bcs _080D2C14 - adds r0, 0x1 - strb r0, [r2, 0x4] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 2 - ldr r1, [r2] - adds r1, r0 - lsls r0, r3, 1 - strh r0, [r1, 0x8] - lsls r0, r4, 5 - adds r0, r6 - lsls r0, 1 - add r0, r12 - str r0, [r1, 0x4] - strh r5, [r1, 0xC] - ldr r0, =sub_80D2C1C - str r0, [r1, 0x10] - movs r0, 0x1 - b _080D2C16 - .pool -_080D2C14: - movs r0, 0 -_080D2C16: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80D2BC0 - - thumb_func_start sub_80D2C1C -sub_80D2C1C: @ 80D2C1C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - adds r6, r0, 0 - movs r0, 0 - ldrh r1, [r6, 0xC] - cmp r0, r1 - bcs _080D2CAA - movs r7, 0x80 - lsls r7, 5 - mov r5, sp - ldr r2, =0x040000d4 - mov r8, r2 - movs r1, 0x81 - lsls r1, 24 - mov r10, r1 -_080D2C42: - ldr r2, [r6, 0x4] - ldrh r3, [r6, 0x8] - mov r12, r2 - adds r0, 0x1 - mov r9, r0 - cmp r3, r7 - bhi _080D2C6C - movs r0, 0 - strh r0, [r5] - mov r2, sp - mov r0, r8 - str r2, [r0] - mov r1, r12 - str r1, [r0, 0x4] - lsrs r0, r3, 1 - mov r2, r10 - orrs r0, r2 - mov r1, r8 - b _080D2C94 - .pool -_080D2C6C: - movs r4, 0 - strh r4, [r5] - ldr r1, =0x040000d4 - mov r0, sp - str r0, [r1] - str r2, [r1, 0x4] - ldr r0, =0x81000800 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r2, r7 - subs r3, r7 - cmp r3, r7 - bhi _080D2C6C - strh r4, [r5] - mov r0, sp - str r0, [r1] - str r2, [r1, 0x4] - lsrs r0, r3, 1 - mov r2, r10 - orrs r0, r2 -_080D2C94: - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - mov r0, r12 - adds r0, 0x40 - str r0, [r6, 0x4] - mov r1, r9 - lsls r0, r1, 16 - lsrs r0, 16 - ldrh r2, [r6, 0xC] - cmp r0, r2 - bcc _080D2C42 -_080D2CAA: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D2C1C - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/pokenav.s b/asm/pokenav.s index 6fedbbd58..c1cd01c27 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 CheckBoxMonSanityAt 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: @@ -1524,7 +1524,7 @@ sub_81C7C28: @ 81C7C28 ldr r4, =gUnknown_0861FA4C _081C7C36: adds r0, r4, 0 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet adds r4, 0x8 adds r5, 0x1 cmp r5, 0 @@ -1648,7 +1648,7 @@ sub_81C7D28: @ 81C7D28 bl sub_81C763C adds r6, r0, 0 ldr r0, =gUnknown_0861FA64 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet movs r0, 0x1 bl AllocSpritePalette movs r0, 0x2 @@ -3924,7 +3924,7 @@ sub_81C8ED0: @ 81C8ED0 ldr r4, =gUnknown_0861FBFC _081C8ED6: adds r0, r4, 0 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet adds r4, 0x8 adds r5, 0x1 cmp r5, 0 @@ -6086,7 +6086,7 @@ sub_81C9FC4: @ 81C9FC4 ldr r4, =gUnknown_086201C4 _081C9FCA: adds r0, r4, 0 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet adds r4, 0x8 adds r5, 0x1 cmp r5, 0x1 @@ -10537,7 +10537,7 @@ sub_81CC214: @ 81CC214 ldr r4, =gUnknown_08622810 _081CC224: adds r0, r4, 0 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet adds r4, 0x8 adds r5, 0x1 cmp r5, 0 @@ -11509,7 +11509,7 @@ sub_81CC9C0: @ 81CC9C0 ldr r4, =gUnknown_086230F8 _081CC9C6: adds r0, r4, 0 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet adds r4, 0x8 adds r5, 0x1 cmp r5, 0 @@ -12444,7 +12444,7 @@ _081CD174: adds r1, r3, 0 movs r2, 0x8 mov r3, sp - bl SetBoxMonDataFromAnyBox + bl SetBoxMonDataAt _081CD180: ldr r0, =0x00006304 adds r1, r6, r0 @@ -16376,7 +16376,7 @@ _081CF1F4: _081CF1FC: adds r0, r5, 0 adds r1, r4, 0 - bl sub_80D2270 + bl CheckBoxMonSanityAt 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 CheckBoxMonSanityAt 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 CheckBoxMonSanityAt 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 @@ -20756,7 +20756,7 @@ sub_81D13FC: @ 81D13FC push {r4,lr} adds r4, r0, 0 ldr r0, =gUnknown_08624C78 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet ldr r0, =gUnknown_08624C80 bl sub_81C795C ldr r0, =gUnknown_08624D04 @@ -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/asm/rom_8011DC0.s b/asm/rom_8011DC0.s index 3e07135e6..b90c9701e 100644 --- a/asm/rom_8011DC0.s +++ b/asm/rom_8011DC0.s @@ -11006,7 +11006,7 @@ _0801C52C: cmp r0, 0x1 bne _0801C5EE ldr r0, =gUnknown_082F1D00 - bl LoadCompressedObjectPicUsingHeap + bl LoadCompressedSpriteSheetUsingHeap ldr r0, [r4] movs r2, 0xB8 lsls r2, 1 @@ -14596,7 +14596,7 @@ _0801E1B4: movs r0, 0x5 bl PlaySE movs r0, 0x1 - bl MoveMenuCursor + bl Menu_MoveCursor b _0801E23A .pool _0801E1D4: @@ -19425,7 +19425,7 @@ sub_8020890: @ 8020890 ldr r4, =gUnknown_082F3134 _08020896: adds r0, r4, 0 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet adds r4, 0x8 adds r5, 0x1 cmp r5, 0x4 @@ -23100,7 +23100,7 @@ sub_8022730: @ 8022730 _08022746: lsls r0, r5, 3 adds r0, r4 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet adds r0, r5, 0x1 lsls r0, 24 lsrs r5, r0, 24 @@ -43324,7 +43324,7 @@ sub_802C974: @ 802C974 ldr r5, =gUnknown_082FBE08 _0802C97C: adds r0, r5, 0 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet adds r5, 0x8 adds r4, 0x1 cmp r4, 0x4 @@ -43447,7 +43447,7 @@ _0802CA32: ands r1, r5 orrs r1, r4 str r1, [r0, 0x4] - bl LoadCompressedObjectPalette + bl LoadCompressedSpritePalette mov r0, r8 bl Free mov r0, r10 @@ -47113,7 +47113,7 @@ sub_802E75C: @ 802E75C lsls r0, 3 ldr r1, =gUnknown_082FE6C8 adds r0, r1 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet movs r2, 0x8 ldrsh r0, [r4, r2] lsls r0, 3 @@ -48126,7 +48126,7 @@ sub_802EF50: @ 802EF50 orrs r0, r1 str r0, [r4, 0x4] mov r0, sp - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet adds r0, r4, 0 bl LoadSpritePalette add sp, 0x10 diff --git a/asm/roulette.s b/asm/roulette.s index 1552ba4fe..4174924e6 100644 --- a/asm/roulette.s +++ b/asm/roulette.s @@ -4865,11 +4865,11 @@ sub_8142C0C: @ 8142C0C ldr r0, =gUnknown_085B7384 bl LoadSpritePalettes ldr r0, =gUnknown_085B7864 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet ldr r0, =gUnknown_085B7978 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet ldr r0, =gUnknown_085B7A40 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet b _08142C5A .pool _08142C44: diff --git a/asm/trade.s b/asm/trade.s index 7cb61a97e..e8ce28810 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -7156,7 +7156,7 @@ _0807AD94: _0807ADB2: mov r0, r8 bl GetMonSpritePalStruct - bl LoadCompressedObjectPalette + bl LoadCompressedSpritePalette ldr r0, =gUnknown_020322A0 ldr r1, [r0] adds r0, r1, 0 diff --git a/asm/trainer_card.s b/asm/trainer_card.s index e0cb5e21e..10e4d6d8f 100644 --- a/asm/trainer_card.s +++ b/asm/trainer_card.s @@ -6952,10 +6952,10 @@ sub_80C62DC: @ 80C62DC bl LoadSpritePalettes ldr r4, =gUnknown_085714BC adds r0, r4, 0 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet adds r4, 0x10 adds r0, r4, 0 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet ldr r0, =gUnknown_085715B4 ldr r1, =gUnknown_02039CEC ldr r2, [r1] @@ -7706,7 +7706,7 @@ sub_80C6974: @ 80C6974 bl LoadSpritePalettes ldr r6, =gUnknown_085714BC adds r0, r6, 0 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet ldr r0, =gUnknown_085715B4 mov r8, r0 ldr r4, =gUnknown_02039CF4 @@ -7747,7 +7747,7 @@ sub_80C6974: @ 80C6974 bl StartSpriteAnim adds r6, 0x8 adds r0, r6, 0 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet movs r3, 0x18 add r8, r3 ldr r6, =gUnknown_08571650 @@ -7875,7 +7875,7 @@ _080C6AEE: lsrs r4, r0, 16 _080C6AF2: ldr r0, =gUnknown_085714D4 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet mov r1, sp ldr r0, =gUnknown_085715FC ldm r0!, {r2,r3,r6} diff --git a/asm/use_pokeblock.s b/asm/use_pokeblock.s index d294a2fae..d2d4913b1 100644 --- a/asm/use_pokeblock.s +++ b/asm/use_pokeblock.s @@ -3273,7 +3273,7 @@ sub_8168248: @ 8168248 orrs r0, r1 str r0, [sp, 0x4] mov r0, sp - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet add r0, sp, 0x8 bl LoadSpritePalette add sp, 0x10 diff --git a/data/event_scripts.s b/data/event_scripts.s index 557515c70..2353d031f 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -1674,7 +1674,7 @@ EventScript_271E0E:: @ 8271E0E checkflag FLAG_SYS_PC_LANETTE call_if 1, EventScript_271E3E msgbox gUnknown_082726A3, MSGBOX_DEFAULT - special ShowPokemonStorageSystem + special ShowPokemonStorageSystemPC waitstate goto EventScript_271DAC end diff --git a/data/pokemon_storage_system.s b/data/pokemon_storage_system.s deleted file mode 100644 index b859133a6..000000000 --- a/data/pokemon_storage_system.s +++ /dev/null @@ -1,1118 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gUnknown_085720DC:: @ 85720DC - .incbin "graphics/pokemon_storage/scrolling_bg.4bpp.lz" - - .align 2 -gUnknown_08572174:: @ 8572174 - .incbin "graphics/pokemon_storage/scrolling_bg.bin.lz" - - .align 2 -gUnknown_08572280:: @ 8572280 - .incbin "graphics/unknown/unknown_572280.gbapal" - - .align 2 -gUnknown_085722A0:: @ 85722A0 - .incbin "graphics/unknown/unknown_5722A0.bin.lz" - - .align 1 -gUnknown_0857239C:: @ 857239C - .2byte 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x0108, 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, 0x0117, 0x0118 - .2byte 0x2101, 0x2102, 0x2103, 0x2104, 0x2105, 0x2106, 0x2107, 0x2108, 0x2111, 0x2112, 0x2113, 0x2114, 0x2115, 0x2116, 0x2117, 0x2118 - - .align 2 -gUnknown_085723DC:: @ 85723DC - .incbin "graphics/unknown/unknown_5723DC.gbapal" - - .align 2 -gUnknown_085723FC:: @ 85723FC - .incbin "graphics/unknown/unknown_5723FC.gbapal" - - .align 2 -gUnknown_0857241C:: @ 857241C - .incbin "graphics/unknown/unknown_57241C.gbapal" - - .align 2 -gUnknown_0857243C:: @ 857243C - .incbin "graphics/unknown/unknown_57243C.gbapal" - - .align 1 -gUnknown_0857245C:: @ 857245C - .2byte 0x014c, 0x014d, 0x014e, 0x014f, 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, 0x015c, 0x015d, 0x015e, 0x015f, 0x0180, 0x0181, 0x0182 - .2byte 0x0183, 0x0184, 0x0175, 0x0176, 0x0177, 0x0178, 0x0179, 0x017a, 0x017b, 0x017c, 0x017d, 0x0185, 0x0186, 0x0187, 0x0188, 0x0189 - .2byte 0x018a, 0x018b, 0x018c, 0x018d - - .align 1 -gUnknown_085724A4:: @ 85724A4 - .2byte 0x1140, 0x1141, 0x1141, 0x1142, 0x1150, 0x1151, 0x1151, 0x1152, 0x1160, 0x1161, 0x1161, 0x1162 - - .align 1 -gUnknown_085724BC:: @ 85724BC - .2byte 0x1143, 0x1144, 0x1144, 0x1145, 0x1153, 0x1154, 0x1154, 0x1155, 0x1163, 0x1164, 0x1164, 0x1165 - - .align 2 -WaveformPalette:: @ 85724D4 - .incbin "graphics/pokemon_storage/waveform.gbapal" - - .align 2 -WaveformTiles:: @ 85724F4 - .incbin "graphics/pokemon_storage/waveform.4bpp" - - .align 2 -gUnknown_085726B4:: @ 85726B4 - .incbin "graphics/unused/unknown_5726B4.gbapal" - - .align 2 -gUnknown_085726F4:: @ 85726F4 - .incbin "graphics/unknown/unknown_5726F4.gbapal" - - .align 2 -gUnknown_08572714:: @ 8572714 - window_template 0x01, 0x00, 0x0b, 0x09, 0x07, 0x03, 0x00c0 - window_template 0x00, 0x0b, 0x11, 0x12, 0x02, 0x0f, 0x0014 - window_template 0x00, 0x00, 0x0d, 0x15, 0x07, 0x0f, 0x0014 - null_window_template - - .align 2 -gUnknown_08572734:: @ 8572734 - .4byte 0x000001d0, 0x004011e5, 0x000023ba, 0x000031ff - - .align 2 -gWaveformSpritePalette:: @ 8572744 - obj_pal WaveformPalette, 0xDACA - - .align 2 -gWaveformSpriteSheet:: @ 857274C - obj_tiles WaveformTiles, 0x1C0, 5 - -gUnknown_08572754:: @ 8572754 - spr_template 2, 0xDAC6, gOamData_857286C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - -gUnknown_0857276C:: @ 857276C - .4byte gText_ExitFromBox, 0 - .4byte gText_WhatDoYouWantToDo, 0 - .4byte gText_PleasePickATheme, 0 - .4byte gText_PickTheWallpaper, 0 - .4byte gText_PkmnIsSelected, 1 - .4byte gText_JumpToWhichBox, 0 - .4byte gText_DepositInWhichBox, 0 - .4byte gText_PkmnWasDeposited, 1 - .4byte gText_BoxIsFull2, 0 - .4byte gText_ReleaseThisPokemon, 0 - .4byte gText_PkmnWasReleased, 4 - .4byte gText_ByeByePkmn, 6 - .4byte gText_MarkYourPkmn, 0 - .4byte gText_ThatsYourLastPkmn, 0 - .4byte gText_YourPartysFull, 0 - .4byte gText_YoureHoldingAPkmn, 0 - .4byte gText_WhichOneWillYouTake, 0 - .4byte gText_YouCantReleaseAnEgg, 0 - .4byte gText_ContinueBoxOperations, 0 - .4byte gText_PkmnCameBack, 1 - .4byte gText_WasItWorriedAboutYou, 0 - .4byte gText_FourEllipsesExclamation, 0 - .4byte gText_PleaseRemoveTheMail, 0 - .4byte gText_PkmnIsSelected, 7 - .4byte gText_GiveToAPkmn, 0 - .4byte gText_PlacedItemInBag, 7 - .4byte gText_BagIsFull2, 0 - .4byte gText_PutItemInBag, 0 - .4byte gText_ItemIsNowHeld, 7 - .4byte gText_ChangedToNewItem, 7 - .4byte gText_MailCantBeStored, 0 - - .align 2 -gUnknown_08572864:: @ 8572864 - window_template 0, 0x18, 0xB, 5, 4, 0xF, 0x5C - - .align 2 -gOamData_857286C:: @ 857286C - .2byte 0x0000 - .2byte 0xC000 - .2byte 0x0000 - - .align 2 -gOamData_8572874:: @ 8572874 - .2byte 0x4000 - .2byte 0x0000 - .2byte 0x0000 - - .align 2 -gSpriteAnim_857287C:: @ 857287C - obj_image_anim_frame 0, 5 - obj_image_anim_end - - .align 2 -gSpriteAnim_8572884:: @ 8572884 - obj_image_anim_frame 2, 8 - obj_image_anim_frame 4, 8 - obj_image_anim_frame 6, 8 - obj_image_anim_jump 0 - - .align 2 -gSpriteAnim_8572894:: @ 8572894 - obj_image_anim_frame 8, 5 - obj_image_anim_end - - .align 2 -gSpriteAnim_857289C:: @ 857289C - obj_image_anim_frame 10, 8 - obj_image_anim_frame 4, 8 - obj_image_anim_frame 12, 8 - obj_image_anim_jump 0 - - .align 2 -gSpriteAnimTable_85728AC:: @ 85728AC - .4byte gSpriteAnim_857287C - .4byte gSpriteAnim_8572884 - .4byte gSpriteAnim_8572894 - .4byte gSpriteAnim_857289C - -gUnknown_085728BC:: @ 85728BC - spr_template 5, 0xDACA, gOamData_8572874, gSpriteAnimTable_85728AC, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_085728D4:: @ 85728D4 - spr_template 0x12, 0xDAC0, gOamData_85728EC, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gOamData_85728EC:: @ 85728EC - .2byte 0x0000 - .2byte 0x8000 - .2byte 0x0000 - - .align 2 -gSpriteAffineAnim_85728F4:: @ 85728F4 - obj_rot_scal_anim_frame 0xFFFE, 0xFFFE, 0, 120 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnim_8572904:: @ 8572904 - obj_rot_scal_anim_frame 0x10, 0x10, 0, 0 - obj_rot_scal_anim_frame 0x10, 0x10, 0, 15 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnimTable_857291C:: @ 857291C - .4byte gSpriteAffineAnim_85728F4 - .4byte gSpriteAffineAnim_8572904 - - .align 2 -gWallpaperPalettes_Forest:: @ 8572924 - .incbin "graphics/pokemon_storage/forest_frame.gbapal" - .incbin "graphics/pokemon_storage/forest_bg.gbapal" - - .align 2 -gWallpaperTiles_Forest: @ 8572964 - .incbin "graphics/pokemon_storage/forest.4bpp.lz" - - .align 2 -gWallpaperTilemap_Forest:: @ 8572DE8 - .incbin "graphics/pokemon_storage/forest.bin.lz" - - .align 2 -gWallpaperPalettes_City: @ 8572EC8 - .incbin "graphics/pokemon_storage/city_frame.gbapal" - .incbin "graphics/pokemon_storage/city_bg.gbapal" - - .align 2 -gWallpaperTiles_City: @ 8572F08 - .incbin "graphics/pokemon_storage/city.4bpp.lz" - - .align 2 -gWallpaperTilemap_City: @ 8573220 - .incbin "graphics/pokemon_storage/city.bin.lz" - - .align 2 -gWallpaperPalettes_Desert: @ 85732FC - .incbin "graphics/pokemon_storage/desert_frame.gbapal" - .incbin "graphics/pokemon_storage/desert_bg.gbapal" - - .align 2 -gWallpaperTiles_Desert: @ 857333C - .incbin "graphics/pokemon_storage/desert.4bpp.lz" - - .align 2 -gWallpaperTilemap_Desert: @ 85736F0 - .incbin "graphics/pokemon_storage/desert.bin.lz" - - .align 2 -gWallpaperPalettes_Savanna: @ 85737EC - .incbin "graphics/pokemon_storage/savanna_frame.gbapal" - .incbin "graphics/pokemon_storage/savanna_bg.gbapal" - - .align 2 -gWallpaperTiles_Savanna: @ 857382C - .incbin "graphics/pokemon_storage/savanna.4bpp.lz" - - .align 2 -gWallpaperTilemap_Savanna: @ 8573C40 - .incbin "graphics/pokemon_storage/savanna.bin.lz" - - .align 2 -gWallpaperPalettes_Crag: @ 8573D44 - .incbin "graphics/pokemon_storage/crag_frame.gbapal" - .incbin "graphics/pokemon_storage/crag_bg.gbapal" - - .align 2 -gWallpaperTiles_Crag: @ 8573D84 - .incbin "graphics/pokemon_storage/crag.4bpp.lz" - - .align 2 -gWallpaperTilemap_Crag: @ 8574180 - .incbin "graphics/pokemon_storage/crag.bin.lz" - - .align 2 -gWallpaperPalettes_Volcano: @ 8573D44 - .incbin "graphics/pokemon_storage/volcano_frame.gbapal" - .incbin "graphics/pokemon_storage/volcano_bg.gbapal" - - .align 2 -gWallpaperTiles_Volcano: @ 8573D84 - .incbin "graphics/pokemon_storage/volcano.4bpp.lz" - - .align 2 -gWallpaperTilemap_Volcano: @ 85747A0 - .incbin "graphics/pokemon_storage/volcano.bin.lz" - - .align 2 -gWallpaperPalettes_Snow: @ 85748DC - .incbin "graphics/pokemon_storage/snow_frame.gbapal" - .incbin "graphics/pokemon_storage/snow_bg.gbapal" - - .align 2 -gWallpaperTiles_Snow: @ 857491C - .incbin "graphics/pokemon_storage/snow.4bpp.lz" - - .align 2 -gWallpaperTilemap_Snow: @ 8574D7C - .incbin "graphics/pokemon_storage/snow.bin.lz" - - .align 2 -gWallpaperPalettes_Cave: @ 8574E88 - .incbin "graphics/pokemon_storage/cave_frame.gbapal" - .incbin "graphics/pokemon_storage/cave_bg.gbapal" - - .align 2 -gWallpaperTiles_Cave: @ 8574EC8 - .incbin "graphics/pokemon_storage/cave.4bpp.lz" - - .align 2 -gWallpaperTilemap_Cave: @ 85752A0 - .incbin "graphics/pokemon_storage/cave.bin.lz" - - .align 2 -gWallpaperPalettes_Beach: @ 8575378 - .incbin "graphics/pokemon_storage/beach_frame.gbapal" - .incbin "graphics/pokemon_storage/beach_bg.gbapal" - - .align 2 -gWallpaperTiles_Beach: @ 85753B8 - .incbin "graphics/pokemon_storage/beach.4bpp.lz" - - .align 2 -gWallpaperTilemap_Beach: @ 8575788 - .incbin "graphics/pokemon_storage/beach.bin.lz" - - .align 2 -gWallpaperPalettes_Seafloor: @ 8575888 - .incbin "graphics/pokemon_storage/seafloor_frame.gbapal" - .incbin "graphics/pokemon_storage/seafloor_bg.gbapal" - - .align 2 -gWallpaperTiles_Seafloor: @ 85758C8 - .incbin "graphics/pokemon_storage/seafloor.4bpp.lz" - - .align 2 -gWallpaperTilemap_Seafloor: @ 8575BC4 - .incbin "graphics/pokemon_storage/seafloor.bin.lz" - - .align 2 -gWallpaperPalettes_River: @ 8575CD8 - .incbin "graphics/pokemon_storage/river_frame.gbapal" - .incbin "graphics/pokemon_storage/river_bg.gbapal" - - .align 2 -gWallpaperTiles_River: @ 8575D18 - .incbin "graphics/pokemon_storage/river.4bpp.lz" - - .align 2 -gWallpaperTilemap_River: @ 8576100 - .incbin "graphics/pokemon_storage/river.bin.lz" - - .align 2 -gWallpaperPalettes_Sky: @ 85761F8 - .incbin "graphics/pokemon_storage/sky_frame.gbapal" - .incbin "graphics/pokemon_storage/sky_bg.gbapal" - - .align 2 -gWallpaperTiles_Sky: @ 8576238 - .incbin "graphics/pokemon_storage/sky.4bpp.lz" - - .align 2 -gWallpaperTilemap_Sky: @ 85765C0 - .incbin "graphics/pokemon_storage/sky.bin.lz" - - .align 2 -gWallpaperPalettes_PolkaDot: @ 85766B0 - .incbin "graphics/pokemon_storage/polkadot_frame.gbapal" - .incbin "graphics/pokemon_storage/polkadot_bg.gbapal" - - .align 2 -gWallpaperTiles_PolkaDot: @ 85766F0 - .incbin "graphics/pokemon_storage/polkadot.4bpp.lz" - - .align 2 -gWallpaperTilemap_PolkaDot: @ 85769B8 - .incbin "graphics/pokemon_storage/polkadot.bin.lz" - - .align 2 -gWallpaperPalettes_Pokecenter: @ 8576AB8 - .incbin "graphics/pokemon_storage/pokecenter_frame.gbapal" - .incbin "graphics/pokemon_storage/pokecenter_bg.gbapal" - - .align 2 -gWallpaperTiles_Pokecenter: @ 8576AF8 - .incbin "graphics/pokemon_storage/pokecenter.4bpp.lz" - - .align 2 -gWallpaperTilemap_Pokecenter: @ 8576D74 - .incbin "graphics/pokemon_storage/pokecenter.bin.lz" - - .align 2 -gWallpaperPalettes_Machine: @ 8576E74 - .incbin "graphics/pokemon_storage/machine_frame.gbapal" - .incbin "graphics/pokemon_storage/machine_bg.gbapal" - - .align 2 -gWallpaperTiles_Machine: @ 8576EB4 - .incbin "graphics/pokemon_storage/machine.4bpp.lz" - - .align 2 -gWallpaperTilemap_Machine: @ 8577108 - .incbin "graphics/pokemon_storage/machine.bin.lz" - - .align 2 -gWallpaperPalettes_Plain: @ 85771CC - .incbin "graphics/pokemon_storage/plain_frame.gbapal" - .incbin "graphics/pokemon_storage/plain_bg.gbapal" - - .align 2 -gWallpaperTiles_Plain: @ 857720C - .incbin "graphics/pokemon_storage/plain.4bpp.lz" - - .align 2 -gWallpaperTilemap_Plain: @ 857732C - .incbin "graphics/pokemon_storage/plain.bin.lz" - -@ 12×18 tilemap - .incbin "graphics/unused/tilemap_5773C4.bin" - - .align 1 -gUnknown_08577574:: @ 8577574 - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - .2byte 0x1CE7, 0x7FFF - - .align 2 -gWallpaperTable:: @ 85775B8 - @ Forest - .4byte gWallpaperTiles_Forest - .4byte gWallpaperTilemap_Forest - .4byte gWallpaperPalettes_Forest - - @ City - .4byte gWallpaperTiles_City - .4byte gWallpaperTilemap_City - .4byte gWallpaperPalettes_City - - @ Desert - .4byte gWallpaperTiles_Desert - .4byte gWallpaperTilemap_Desert - .4byte gWallpaperPalettes_Desert - - @ Savanna - .4byte gWallpaperTiles_Savanna - .4byte gWallpaperTilemap_Savanna - .4byte gWallpaperPalettes_Savanna - - @ Crag - .4byte gWallpaperTiles_Crag - .4byte gWallpaperTilemap_Crag - .4byte gWallpaperPalettes_Crag - - @ Volcano - .4byte gWallpaperTiles_Volcano - .4byte gWallpaperTilemap_Volcano - .4byte gWallpaperPalettes_Volcano - - @ Snow - .4byte gWallpaperTiles_Snow - .4byte gWallpaperTilemap_Snow - .4byte gWallpaperPalettes_Snow - - @ Cave - .4byte gWallpaperTiles_Cave - .4byte gWallpaperTilemap_Cave - .4byte gWallpaperPalettes_Cave - - @ Beach - .4byte gWallpaperTiles_Beach - .4byte gWallpaperTilemap_Beach - .4byte gWallpaperPalettes_Beach - - @ Seafloor - .4byte gWallpaperTiles_Seafloor - .4byte gWallpaperTilemap_Seafloor - .4byte gWallpaperPalettes_Seafloor - - @ River - .4byte gWallpaperTiles_River - .4byte gWallpaperTilemap_River - .4byte gWallpaperPalettes_River - - @ Sky - .4byte gWallpaperTiles_Sky - .4byte gWallpaperTilemap_Sky - .4byte gWallpaperPalettes_Sky - - @ PolkaDot - .4byte gWallpaperTiles_PolkaDot - .4byte gWallpaperTilemap_PolkaDot - .4byte gWallpaperPalettes_PolkaDot - - @ Pokecenter - .4byte gWallpaperTiles_Pokecenter - .4byte gWallpaperTilemap_Pokecenter - .4byte gWallpaperPalettes_Pokecenter - - @ Machine - .4byte gWallpaperTiles_Machine - .4byte gWallpaperTilemap_Machine - .4byte gWallpaperPalettes_Machine - - @ Plain - .4byte gWallpaperTiles_Plain - .4byte gWallpaperTilemap_Plain - .4byte gWallpaperPalettes_Plain - - .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 - .4byte sub_80CF0CC, 0 - .4byte sub_80CF5C4, 1 - .4byte sub_80CF7E4, 2 - .4byte sub_80CF8D8, 3 - .4byte NULL, 0 - - .align 2 -gHandCursorSpriteSheets:: @ 857B9E4 - obj_tiles HandCursorTiles, 0x0800, 0x0000 - obj_tiles HandCursorShadowTiles, 0x0080, 0x0001 - null_obj_tiles - - .align 2 -gHandCursorSpritePalettes:: @ 857B9FC - obj_pal HandCursorPalette, 0xDAC7 - null_obj_pal - - .align 2 -gOamData_857BA0C:: @ 857BA0C - .2byte 0x0000 - .2byte 0x8000 - .2byte 0x0400 - - .align 2 -gOamData_857BA14:: @ 857BA14 - .2byte 0x0000 - .2byte 0x4000 - .2byte 0x0400 - - .align 2 -gSpriteAnim_857BA1C:: @ 857BA1C - obj_image_anim_frame 0, 30 - obj_image_anim_frame 16, 30 - obj_image_anim_jump 0 - - .align 2 -gSpriteAnim_857BA28:: @ 857BA28 - obj_image_anim_frame 0, 5 - obj_image_anim_end - - .align 2 -gSpriteAnim_857BA30:: @ 857BA30 - obj_image_anim_frame 32, 5 - obj_image_anim_end - - .align 2 -gSpriteAnim_857BA38:: @ 857BA38 - obj_image_anim_frame 48, 5 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_857BA40:: @ 857BA40 - .4byte gSpriteAnim_857BA1C - .4byte gSpriteAnim_857BA28 - .4byte gSpriteAnim_857BA30 - .4byte gSpriteAnim_857BA38 - - .align 2 -gSpriteTemplate_857BA50:: @ 857BA50 - spr_template 0, 0xDACA, gOamData_857BA0C, gSpriteAnimTable_857BA40, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gSpriteTemplate_857BA68:: @ 857BA68 - spr_template 1, 0xDACA, gOamData_857BA14, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80CFBF4 - - .align 2 -gUnknown_0857BA80:: @ 857BA80 - .4byte gPCText_Cancel - .4byte gPCText_Store - .4byte gPCText_Withdraw - .4byte gPCText_Move - .4byte gPCText_Shift - .4byte gPCText_Place - .4byte gPCText_Summary - .4byte gPCText_Release - .4byte gPCText_Mark - .4byte gPCText_Jump - .4byte gPCText_Wallpaper - .4byte gPCText_Name - .4byte gPCText_Take - .4byte gPCText_Give - .4byte gPCText_Give - .4byte gPCText_Switch - .4byte gPCText_Bag - .4byte gPCText_Info - .4byte gPCText_Scenery1 - .4byte gPCText_Scenery2 - .4byte gPCText_Scenery3 - .4byte gPCText_Etcetera - .4byte gPCText_Friends - .4byte gPCText_Forest - .4byte gPCText_City - .4byte gPCText_Desert - .4byte gPCText_Savanna - .4byte gPCText_Crag - .4byte gPCText_Volcano - .4byte gPCText_Snow - .4byte gPCText_Cave - .4byte gPCText_Beach - .4byte gPCText_Seafloor - .4byte gPCText_River - .4byte gPCText_Sky - .4byte gPCText_PolkaDot - .4byte gPCText_Pokecenter - .4byte gPCText_Machine - .4byte gPCText_Simple - - .align 2 -gUnknown_0857BB1C:: @ 857BB1C - window_template 0x00, 0x0a, 0x03, 0x14, 0x12, 0x09, 0x000a - - .align 2 -gUnknown_0857BB24:: @ 857BB24 - .incbin "graphics/pokemon_storage/unknown_frame.4bpp" - - .align 2 -gOamData_857BBA4:: @ 857BBA4 - .2byte 0x0100, 0x8000, 0x0400, 0x0000 - - .align 2 -gSpriteAffineAnim_857BBAC:: @ 857BBAC - .2byte 0x0080, 0x0080, 0x0000, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gSpriteAffineAnim_857BBBC:: @ 857BBBC - .2byte 0x0058, 0x0058, 0x0000, 0x0000, 0x0005, 0x0005, 0x0800, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gSpriteAffineAnim_857BBD4:: @ 857BBD4 - .2byte 0x0080, 0x0080, 0x0000, 0x0000, 0xfffb, 0xfffb, 0x0800, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gSpriteAffineAnim_857BBEC:: @ 857BBEC - .2byte 0x0080, 0x0080, 0x0000, 0x0000, 0x000a, 0x000a, 0x0c00, 0x0000, 0x0100, 0x0100, 0x0000, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gSpriteAffineAnim_857BC0C:: @ 857BC0C - .2byte 0x0100, 0x0100, 0x0000, 0x0000, 0xfff6, 0xfff6, 0x0c00, 0x0000, 0x0080, 0x0080, 0x0000, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gSpriteAffineAnim_857BC2C:: @ 857BC2C - .2byte 0x0100, 0x0100, 0x0000, 0x0000, 0xfffb, 0xfffb, 0x1000, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gSpriteAffineAnim_857BC44:: @ 857BC44 - .2byte 0x0100, 0x0100, 0x0000, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gSpriteAffineAnimTable_857BC54:: @ 857BC54 - .4byte gSpriteAffineAnim_857BBAC - .4byte gSpriteAffineAnim_857BBBC - .4byte gSpriteAffineAnim_857BBD4 - .4byte gSpriteAffineAnim_857BBEC - .4byte gSpriteAffineAnim_857BC0C - .4byte gSpriteAffineAnim_857BC2C - .4byte gSpriteAffineAnim_857BC44 - - .align 2 -gSpriteTemplate_857BC70:: @ 857BC70 - spr_template 0x0007, 0xdacb, gOamData_857BBA4, gDummySpriteAnimTable, NULL, gSpriteAffineAnimTable_857BC54, SpriteCallbackDummy - -gSpriteTemplate_857BC88:: @ 857BC88 - .2byte 0x0100, 0x0100, 0x0200, 0x0100, 0x0100, 0x0200, 0x0200, 0x0200, 0x0080, 0x0080, 0x0100, 0x0100, 0x0200, 0x0200, 0x0400, 0x0400 - diff --git a/data/specials.inc b/data/specials.inc index 3ae1a14f8..318d272d5 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -71,7 +71,7 @@ gSpecials:: @ 81DBA64 def_special ShouldTryRematchBattle def_special IsTrainerReadyForRematch def_special BattleSetup_StartRematchBattle - def_special ShowPokemonStorageSystem + def_special ShowPokemonStorageSystemPC def_special HasEnoughMonsForDoubleBattle def_special TurnOffTVScreen def_special DoTVShow diff --git a/include/bg.h b/include/bg.h index a10abaa8d..ffcaf43ed 100644 --- a/include/bg.h +++ b/include/bg.h @@ -56,11 +56,11 @@ void ShowBg(u8 bg); void HideBg(u8 bg); void SetBgAttribute(u8 bg, u8 attributeId, u8 value); u16 GetBgAttribute(u8 bg, u8 attributeId); -u32 ChangeBgX(u8 bg, u32 value, u8 op); -u32 GetBgX(u8 bg); -u32 ChangeBgY(u8 bg, u32 value, u8 op); -u32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op); -u32 GetBgY(u8 bg); +s32 ChangeBgX(u8 bg, s32 value, u8 op); +s32 GetBgX(u8 bg); +s32 ChangeBgY(u8 bg, s32 value, u8 op); +s32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op); +s32 GetBgY(u8 bg); void SetBgAffine(u8 bg, u32 srcCenterX, u32 srcCenterY, s16 dispCenterX, s16 dispCenterY, s16 scaleX, s16 scaleY, u16 rotationAngle); u8 Unused_AdjustBgMosaic(u8 a1, u8 a2); void SetBgTilemapBuffer(u8 bg, void *tilemap); diff --git a/include/blit.h b/include/blit.h index 2fe99d7bd..78f67766e 100644 --- a/include/blit.h +++ b/include/blit.h @@ -3,15 +3,15 @@ struct Bitmap { - u8* pixels; + u8 *pixels; u32 width:16; u32 height:16; }; -void BlitBitmapRect4BitWithoutColorKey(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height); -void BlitBitmapRect4Bit(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height, u8 colorKey); +void BlitBitmapRect4BitWithoutColorKey(const struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height); +void BlitBitmapRect4Bit(const struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height, u8 colorKey); void FillBitmapRect4Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue); -void BlitBitmapRect4BitTo8Bit(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height, u8 colorKey, u8 paletteOffset); +void BlitBitmapRect4BitTo8Bit(const struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height, u8 colorKey, u8 paletteOffset); void FillBitmapRect8Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 height, u8 fillValue); #endif // GUARD_BLIT_H 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/decompress.h b/include/decompress.h index 853230aea..02412defb 100644 --- a/include/decompress.h +++ b/include/decompress.h @@ -8,13 +8,13 @@ extern u8 gDecompressionBuffer[0x4000]; void LZDecompressWram(const u32 *src, void *dest); void LZDecompressVram(const u32 *src, void *dest); -u16 LoadCompressedObjectPic(const struct CompressedSpriteSheet *src); -void LoadCompressedObjectPicOverrideBuffer(const struct CompressedSpriteSheet *src, void *buffer); -bool8 LoadCompressedObjectPicUsingHeap(const struct CompressedSpriteSheet* src); +u16 LoadCompressedSpriteSheet(const struct CompressedSpriteSheet *src); +void LoadCompressedSpriteSheetOverrideBuffer(const struct CompressedSpriteSheet *src, void *buffer); +bool8 LoadCompressedSpriteSheetUsingHeap(const struct CompressedSpriteSheet* src); -void LoadCompressedObjectPalette(const struct CompressedSpritePalette *src); -void LoadCompressedObjectPaletteOverrideBuffer(const struct CompressedSpritePalette *a, void *buffer); -bool8 LoadCompressedObjectPaletteUsingHeap(const struct CompressedSpritePalette *src); +void LoadCompressedSpritePalette(const struct CompressedSpritePalette *src); +void LoadCompressedSpritePaletteOverrideBuffer(const struct CompressedSpritePalette *a, void *buffer); +bool8 LoadCompressedSpritePaletteUsingHeap(const struct CompressedSpritePalette *src); void DecompressPicFromTable(const struct CompressedSpriteSheet *src, void* buffer, s32 species); void DecompressPicFromTable_2(const struct CompressedSpriteSheet *src, void* buffer, s32 species); diff --git a/include/dma3.h b/include/dma3.h index 19a69ea80..8eff34f55 100644 --- a/include/dma3.h +++ b/include/dma3.h @@ -1,6 +1,51 @@ #ifndef GUARD_DMA3_H #define GUARD_DMA3_H +// Maximum amount of data we will transfer in one operation +#define MAX_DMA_BLOCK_SIZE 0x1000 + +#define Dma3CopyLarge_(src, dest, size, bit) \ +{ \ + const void *_src = src; \ + void *_dest = dest; \ + u32 _size = size; \ + while (1) \ + { \ + if (_size <= MAX_DMA_BLOCK_SIZE) \ + { \ + DmaCopy##bit(3, _src, _dest, _size); \ + break; \ + } \ + DmaCopy##bit(3, _src, _dest, MAX_DMA_BLOCK_SIZE); \ + _src += MAX_DMA_BLOCK_SIZE; \ + _dest += MAX_DMA_BLOCK_SIZE; \ + _size -= MAX_DMA_BLOCK_SIZE; \ + } \ +} + +#define Dma3CopyLarge16_(src, dest, size) Dma3CopyLarge_(src, dest, size, 16) +#define Dma3CopyLarge32_(src, dest, size) Dma3CopyLarge_(src, dest, size, 32) + +#define Dma3FillLarge_(value, dest, size, bit) \ +{ \ + void *_dest = dest; \ + u32 _size = size; \ + while (1) \ + { \ + if (_size <= MAX_DMA_BLOCK_SIZE) \ + { \ + DmaFill##bit(3, value, _dest, _size); \ + break; \ + } \ + DmaFill##bit(3, value, _dest, MAX_DMA_BLOCK_SIZE); \ + _dest += MAX_DMA_BLOCK_SIZE; \ + _size -= MAX_DMA_BLOCK_SIZE; \ + } \ +} + +#define Dma3FillLarge16_(value, dest, size) Dma3FillLarge_(value, dest, size, 16) +#define Dma3FillLarge32_(value, dest, size) Dma3FillLarge_(value, dest, size, 32) + void ClearDma3Requests(void); void ProcessDma3Requests(void); s16 RequestDma3Copy(const void *src, void *dest, u16 size, u8 mode); diff --git a/include/fldeff_misc.h b/include/fldeff_misc.h index fc2f1b3e3..fd96f5646 100644 --- a/include/fldeff_misc.h +++ b/include/fldeff_misc.h @@ -29,9 +29,9 @@ void DoWateringBerryTreeAnim(void); u8 CreateRecordMixingSprite(void); void DestroyRecordMixingSprite(void); -const struct SpritePalette gFieldEffectObjectPaletteInfo7; -const struct SpritePalette gFieldEffectObjectPaletteInfo8; -const struct SpritePalette gFieldEffectObjectPaletteInfo9; +extern const struct SpritePalette gFieldEffectObjectPaletteInfo7; +extern const struct SpritePalette gFieldEffectObjectPaletteInfo8; +extern const struct SpritePalette gFieldEffectObjectPaletteInfo9; extern const u16 gTilesetPalettes_SecretBase[][16]; #endif //GUARD_FLDEFF_MISC_H diff --git a/include/global.h b/include/global.h index e3792ac56..090ba7ce4 100644 --- a/include/global.h +++ b/include/global.h @@ -872,15 +872,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 cab639f0e..cc829b5a9 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4771,6 +4771,20 @@ extern const u32 gUnknown_08D8D58C[]; extern const u32 gPokedexAreaScreenAreaUnknown_Gfx[]; 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]; + // Cable Car extern const u32 gUnknown_08DBA5B8[]; extern const u16 gUnknown_08DBA518[]; diff --git a/include/menu.h b/include/menu.h index 2606b1f58..04677ae40 100644 --- a/include/menu.h +++ b/include/menu.h @@ -44,16 +44,16 @@ void SetWindowBorderStyle(u8 windowId, bool8 copyToVram, u16 tileStart, u8 palet void schedule_bg_copy_tilemap_to_vram(u8 bgNum); void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *strs); u8 InitMenuInUpperLeftCornerPlaySoundWhenAPressed(u8 windowId, u8 numItems, u8 initialCursorPos); -u8 GetMenuCursorPos(void); +u8 Menu_GetCursorPos(void); 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); @@ -63,7 +63,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); @@ -72,7 +72,8 @@ u8 sub_8199944(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount u8 sub_8199134(s8, s8); u8 GetStartMenuWindowId(void); void sub_819A2BC(u8, u8); -u8 MoveMenuCursor(s8 cursorDelta); +u8 Menu_MoveCursor(s8 cursorDelta); +u8 Menu_MoveCursorNoWrapAround(s8 cursorDelta); void NewMenuHelpers_DrawStdWindowFrame(u8 windowId, bool8 CopyToVram); u8 sub_81979C4(u8 a1); u8 sub_81983AC(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 initialCursorPos); diff --git a/include/mon_markings.h b/include/mon_markings.h index 22c3f14a4..8e4ec58bd 100644 --- a/include/mon_markings.h +++ b/include/mon_markings.h @@ -21,6 +21,15 @@ struct PokemonMarkMenu /*0x10B4*/ u8 tileLoadState; }; // 10b8 +void sub_811F90C(struct PokemonMarkMenu *ptr); +void sub_811F918(void); +bool8 sub_811F960(void); +void sub_811FA90(void); +void sub_811FAA4(u8 markings, s16 x, s16 y); +void sub_811FAF8(void); +bool8 sub_811FBA4(void); struct Sprite *sub_811FF94(u16 tileTag, u16 paletteTag, const u16 *palette); +struct Sprite *sub_811FFB4(u16 tileTag, u16 paletteTag, const u16 *palette); +void sub_8120084(u8 markings, void *dest); #endif //POKEEMERALD_MON_MARKINGS_H diff --git a/include/pokemon.h b/include/pokemon.h index 94dae089f..cfa5cc350 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 @@ -251,14 +251,6 @@ struct Pokemon u16 spDefense; }; -struct PokemonStorage -{ - /*0x0000*/ u8 currentBox; - /*0x0001*/ struct BoxPokemon boxes[14][30]; - /*0x8344*/ u8 boxNames[14][9]; - /*0x83C2*/ u8 boxWallpapers[14]; -}; - struct Unknown_806F160_Struct { u8 field_0_0:4; @@ -430,7 +422,6 @@ extern struct Pokemon gPlayerParty[PARTY_SIZE]; extern u8 gEnemyPartyCount; extern struct Pokemon gEnemyParty[PARTY_SIZE]; extern struct SpriteTemplate gMultiuseSpriteTemplate; -extern struct PokemonStorage* gPokemonStoragePtr; extern const struct BattleMove gBattleMoves[]; extern const u8 gFacilityClassToPicIndex[]; diff --git a/include/pokemon_icon.h b/include/pokemon_icon.h index 17c7d5573..4f27ef281 100644 --- a/include/pokemon_icon.h +++ b/include/pokemon_icon.h @@ -1,9 +1,14 @@ #ifndef GUARD_POKEMON_ICON_H #define GUARD_POKEMON_ICON_H +extern const u8 gMonIconPaletteIndices[]; + const u8 *GetMonIconTiles(u16 species, bool32); +void sub_80D304C(u16 offset); +u8 GetValidMonIconPalIndex(u16 species); 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 7f618498b..a85ee5ff4 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -2,88 +2,73 @@ #define GUARD_POKEMON_STORAGE_SYSTEM_H #define TOTAL_BOXES_COUNT 14 -#define IN_BOX_COUNT 30 +#define IN_BOX_ROWS 6 +#define IN_BOX_COLUMNS 5 +#define IN_BOX_COUNT (IN_BOX_ROWS * IN_BOX_COLUMNS) -#include "pc_screen_effect.h" -#include "mon_markings.h" +/* + ROWS +COLUMNS 0 1 2 3 4 5 + 6 7 8 9 10 11 + 12 13 14 15 16 17 + 18 19 20 21 22 23 + 24 25 26 27 28 29 +*/ -struct PokemonStorageSystemFunc +struct PokemonStorage { - u8 (*func)(void); - s8 unk4; + /*0x0000*/ u8 currentBox; + /*0x0001*/ struct BoxPokemon boxes[TOTAL_BOXES_COUNT][IN_BOX_COUNT]; + /*0x8344*/ u8 boxNames[TOTAL_BOXES_COUNT][9]; + /*0x83C2*/ u8 boxWallpapers[TOTAL_BOXES_COUNT]; }; -struct StorageAction -{ - const u8 *text; - u8 format; -}; +extern struct PokemonStorage *gPokemonStoragePtr; -struct StorageText -{ - const u8 *text; - int textId; -}; - -struct PSS_MenuStringPtrs -{ - const u8 *text; - const u8 *desc; -}; - -struct UnkStruct_2000028 -{ - const u8 *unk_00; - u8 *unk_04; - u16 unk_08; - u16 unk_0a; - void (*unk_0c)(struct UnkStruct_2000028 *data); -}; - -struct UnkStruct_2000020 -{ - struct UnkStruct_2000028 *unk_00; - u8 unk_04; - u8 unk_05; -}; - -struct UnkPSSStruct_2002370 -{ - struct Sprite *unk_0000; - struct Sprite *unk_0004[4]; - u32 unk_0014[3]; - struct Sprite *unk_0020[2]; - u8 filler_0028[0x214]; - u32 unk_023c; - u16 unk_0240; - u16 unk_0242; - u8 curBox; - u8 unk_0245; - u8 unk_0246; -}; - -struct PokemonStorageSystemData -{ - u8 state; - u8 boxOption; - u8 unk_0002; - u8 unk_0003; - u8 taskId; - u8 unk_0005[710]; - u16 bg2_X; -}; - -extern struct UnkPSSStruct_2002370 *gUnknown_02039D04; -extern struct PokemonStorageSystemData *gUnknown_02039D08; - -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); -bool8 CheckFreePokemonStorageSpace(void); +u8 CountMonsInBox(u8 boxId); +s16 GetFirstFreeBoxSpot(u8 boxId); +u8 CountPartyAliveNonEggMonsExcept(u8 slotToIgnore); +u16 CountPartyAliveNonEggMons_IgnoreVar0x8004Slot(void); +u8 CountPartyMons(void); +u8 *StringCopyAndFillWithSpaces(u8 *dst, const u8 *src, u16 n); +void ShowPokemonStorageSystemPC(void); +void ResetPokemonStorageSystem(void); +s16 CompactPartySlots(void); u8 StorageGetCurrentBox(void); -u8 sub_80D214C(struct BoxPokemon *a, u8 b, u8 c, u8 d); -bool32 sub_80D23A8(u16 move); +u32 GetBoxMonDataAt(u8 boxId, u8 boxPosition, s32 request); +void SetBoxMonDataAt(u8 boxId, u8 boxPosition, s32 request, const void *value); +u32 GetCurrentBoxMonData(u8 boxPosition, s32 request); +void SetCurrentBoxMonData(u8 boxPosition, s32 request, const void *value); +void GetBoxMonNickAt(u8 boxId, u8 boxPosition, u8 *dst); +u32 GetBoxMonLevelAt(u8 boxId, u8 boxPosition); +void SetBoxMonNickAt(u8 boxId, u8 boxPosition, const u8 *nick); +u32 GetAndCopyBoxMonDataAt(u8 boxId, u8 boxPosition, s32 request, void *dst); +void SetBoxMonAt(u8 boxId, u8 boxPosition, struct BoxPokemon *src); +void CopyBoxMonAt(u8 boxId, u8 boxPosition, struct BoxPokemon *dst); +void CreateBoxMonAt(u8 boxId, u8 boxPosition, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 personality, u8 otIDType, u32 otID); +void ZeroBoxMonAt(u8 boxId, u8 boxPosition); +void BoxMonAtToMon(u8 boxId, u8 boxPosition, struct Pokemon *dst); +struct BoxPokemon *GetBoxedMonPtr(u8 boxId, u8 boxPosition); +u8 *GetBoxNamePtr(u8 boxId); +u8 GetBoxWallpaper(u8 boxId); +void SetBoxWallpaper(u8 boxId, u8 wallpaperId); +s16 sub_80D214C(struct BoxPokemon *boxMons, u8 currIndex, u8 maxIndex, u8 arg3); +bool8 CheckFreePokemonStorageSpace(void); +bool32 CheckBoxMonSanityAt(u32 boxId, u32 boxPosition); +u32 CountStorageNonEggMons(void); +u32 CountAllStorageMons(void); +bool32 AnyStorageMonWithMove(u16 moveId); +void ResetWaldaWallpaper(void); +void SetWaldaWallpaperLockedOrUnlocked(bool32 unlocked); +bool32 IsWaldaWallpaperUnlocked(void); +u32 GetWaldaWallpaperPatternId(void); +void SetWaldaWallpaperPatternId(u8 id); +u32 GetWaldaWallpaperIconId(void); +void SetWaldaWallpaperIconId(u8 id); +u16 *GetWaldaWallpaperColorsPtr(void); +void SetWaldaWallpaperColors(u16 color1, u16 color2); +u8 *GetWaldaPhrasePtr(void); +void SetWaldaPhrase(const u8 *src); +bool32 IsWaldaPhraseEmpty(void); #endif // GUARD_POKEMON_STORAGE_SYSTEM_H diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index 63d740949..34f7934e1 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -6,6 +6,7 @@ extern u8 gUnknown_0203CF20; void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)); void sub_81C4F98(u8, void(*)(void)); void ShowSelectMovePokemonSummaryScreen(struct Pokemon *, u8, u8, MainCallback, u16); +void ShowPokemonSummaryScreenSet40EF(u8 mode, struct BoxPokemon *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)); u8 sub_81C1B94(void); // The Pokemon Summary Screen can operate in different modes. Certain features, @@ -14,7 +15,7 @@ enum PokemonSummaryScreenMode { PSS_MODE_NORMAL, PSS_MODE_UNK1, - PSS_MODE_UNK2, + PSS_MODE_BOX, PSS_MODE_SELECT_MOVE, }; diff --git a/include/strings.h b/include/strings.h index a6f61f603..eff40d8f2 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1801,4 +1801,78 @@ extern const u8 BattleFrontier_BattlePyramidEmptySquare_Text_254F47[]; extern const u8 BattleFrontier_BattlePyramidEmptySquare_Text_254F0E[]; extern const u8 BattleFrontier_BattlePyramidEmptySquare_Text_254ED3[]; +// PC strings +extern const u8 gText_ExitFromBox[]; +extern const u8 gText_WhatDoYouWantToDo[]; +extern const u8 gText_PleasePickATheme[]; +extern const u8 gText_PickTheWallpaper[]; +extern const u8 gText_PkmnIsSelected[]; +extern const u8 gText_JumpToWhichBox[]; +extern const u8 gText_DepositInWhichBox[]; +extern const u8 gText_PkmnWasDeposited[]; +extern const u8 gText_BoxIsFull2[]; +extern const u8 gText_ReleaseThisPokemon[]; +extern const u8 gText_PkmnWasReleased[]; +extern const u8 gText_ByeByePkmn[]; +extern const u8 gText_MarkYourPkmn[]; +extern const u8 gText_ThatsYourLastPkmn[]; +extern const u8 gText_YourPartysFull[]; +extern const u8 gText_YoureHoldingAPkmn[]; +extern const u8 gText_WhichOneWillYouTake[]; +extern const u8 gText_YouCantReleaseAnEgg[]; +extern const u8 gText_ContinueBoxOperations[]; +extern const u8 gText_PkmnCameBack[]; +extern const u8 gText_WasItWorriedAboutYou[]; +extern const u8 gText_FourEllipsesExclamation[]; +extern const u8 gText_PleaseRemoveTheMail[]; +extern const u8 gText_GiveToAPkmn[]; +extern const u8 gText_PlacedItemInBag[]; +extern const u8 gText_BagIsFull2[]; +extern const u8 gText_PutItemInBag[]; +extern const u8 gText_ItemIsNowHeld[]; +extern const u8 gText_ChangedToNewItem[]; +extern const u8 gText_MailCantBeStored[]; +extern const u8 gPCText_Cancel[]; +extern const u8 gPCText_Store[]; +extern const u8 gPCText_Withdraw[]; +extern const u8 gPCText_Move[]; +extern const u8 gPCText_Shift[]; +extern const u8 gPCText_Place[]; +extern const u8 gPCText_Summary[]; +extern const u8 gPCText_Release[]; +extern const u8 gPCText_Mark[]; +extern const u8 gPCText_Jump[]; +extern const u8 gPCText_Wallpaper[]; +extern const u8 gPCText_Name[]; +extern const u8 gPCText_Take[]; +extern const u8 gPCText_Give[]; +extern const u8 gPCText_Give[]; +extern const u8 gPCText_Switch[]; +extern const u8 gPCText_Bag[]; +extern const u8 gPCText_Info[]; +extern const u8 gPCText_Scenery1[]; +extern const u8 gPCText_Scenery2[]; +extern const u8 gPCText_Scenery3[]; +extern const u8 gPCText_Etcetera[]; +extern const u8 gPCText_Friends[]; +extern const u8 gPCText_Forest[]; +extern const u8 gPCText_City[]; +extern const u8 gPCText_Desert[]; +extern const u8 gPCText_Savanna[]; +extern const u8 gPCText_Crag[]; +extern const u8 gPCText_Volcano[]; +extern const u8 gPCText_Snow[]; +extern const u8 gPCText_Cave[]; +extern const u8 gPCText_Beach[]; +extern const u8 gPCText_Seafloor[]; +extern const u8 gPCText_River[]; +extern const u8 gPCText_Sky[]; +extern const u8 gPCText_PolkaDot[]; +extern const u8 gPCText_Pokecenter[]; +extern const u8 gPCText_Machine[]; +extern const u8 gPCText_Simple[]; +extern const u8 gText_PartyFull[]; +extern const u8 gText_Box[]; +extern const u8 gText_JustOnePkmn[]; + #endif //GUARD_STRINGS_H 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/include/window.h b/include/window.h index 692ca1d81..25573ac3e 100644 --- a/include/window.h +++ b/include/window.h @@ -61,10 +61,10 @@ void ScrollWindow(u8 windowId, u8 direction, u8 distance, u8 fillValue); void CallWindowFunction(u8 windowId, void ( *func)(u8, u8, u8, u8, u8, u8)); bool8 SetWindowAttribute(u8 windowId, u8 attributeId, u32 value); u32 GetWindowAttribute(u8 windowId, u8 attributeId); -u16 AddWindow8Bit(struct WindowTemplate *template); -u16 AddWindow8Bit(struct WindowTemplate *template); +u16 AddWindow8Bit(const struct WindowTemplate *template); +void FillWindowPixelBuffer8Bit(u8 windowId, u8 fillValue); void FillWindowPixelRect8Bit(u8 windowId, u8 fillValue, u16 x, u16 y, u16 width, u16 height); -void BlitBitmapRectToWindow4BitTo8Bit(u8 windowId, u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight, u8 paletteNum); +void BlitBitmapRectToWindow4BitTo8Bit(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight, u8 paletteNum); void CopyWindowToVram8Bit(u8 windowId, u8 mode); extern struct Window gWindows[]; diff --git a/ld_script.txt b/ld_script.txt index d6f994e0f..3c7ecd9ee 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -126,7 +126,6 @@ SECTIONS { src/pokedex.o(.text); asm/trainer_card.o(.text); src/pokemon_storage_system.o(.text); - asm/pokemon_storage_system.o(.text); src/pokemon_icon.o(.text); src/script_movement.o(.text); src/fldeff_cut.o(.text); @@ -459,7 +458,6 @@ SECTIONS { src/pokedex.o(.rodata); data/trainer_card.o(.rodata); src/pokemon_storage_system.o(.rodata); - data/pokemon_storage_system.o(.rodata); src/pokemon_icon.o(.rodata); src/fldeff_cut.o(.rodata); src/map_name_popup.o(.rodata); diff --git a/src/battle_anim.c b/src/battle_anim.c index 1e1219800..2d211c411 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -1605,8 +1605,8 @@ static void ScriptCmd_loadspritegfx(void) sBattleAnimScriptPtr++; index = T1_READ_16(sBattleAnimScriptPtr); - LoadCompressedObjectPicUsingHeap(&gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(index)]); - LoadCompressedObjectPaletteUsingHeap(&gBattleAnimPaletteTable[GET_TRUE_SPRITE_INDEX(index)]); + LoadCompressedSpriteSheetUsingHeap(&gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(index)]); + LoadCompressedSpritePaletteUsingHeap(&gBattleAnimPaletteTable[GET_TRUE_SPRITE_INDEX(index)]); sBattleAnimScriptPtr += 2; AddSpriteIndex(GET_TRUE_SPRITE_INDEX(index)); gAnimFramesToWait = 1; diff --git a/src/battle_anim_80A9C70.c b/src/battle_anim_80A9C70.c index 2eea276a1..001f99d7f 100644 --- a/src/battle_anim_80A9C70.c +++ b/src/battle_anim_80A9C70.c @@ -71,8 +71,8 @@ u8 sub_80A9C70(u8 battlerId, bool8 b) u8 spriteId2; u8 i; - LoadCompressedObjectPicUsingHeap(&gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_CIRCLE_IMPACT)]); - LoadCompressedObjectPaletteUsingHeap(&gBattleAnimPaletteTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_CIRCLE_IMPACT)]); + LoadCompressedSpriteSheetUsingHeap(&gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_CIRCLE_IMPACT)]); + LoadCompressedSpritePaletteUsingHeap(&gBattleAnimPaletteTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_CIRCLE_IMPACT)]); gTasks[taskId].data[0] = battlerId; if (b) { diff --git a/src/battle_anim_8170478.c b/src/battle_anim_8170478.c index 32214b58d..502c4cdbb 100755 --- a/src/battle_anim_8170478.c +++ b/src/battle_anim_8170478.c @@ -1376,8 +1376,8 @@ static void sub_8171D60(u8 ballId) if (GetSpriteTileStartByTag(gBallOpenParticleSpritesheets[ballId].tag) == 0xFFFF) { - LoadCompressedObjectPicUsingHeap(&gBallOpenParticleSpritesheets[ballId]); - LoadCompressedObjectPaletteUsingHeap(&gBallOpenParticlePalettes[ballId]); + LoadCompressedSpriteSheetUsingHeap(&gBallOpenParticleSpritesheets[ballId]); + LoadCompressedSpritePaletteUsingHeap(&gBallOpenParticlePalettes[ballId]); } } @@ -2032,8 +2032,8 @@ void sub_8172EF0(u8 battler, struct Pokemon *mon) { if (GetSpriteTileStartByTag(0x27F9) == 0xFFFF) { - LoadCompressedObjectPicUsingHeap(&gBattleAnimPicTable[233]); - LoadCompressedObjectPaletteUsingHeap(&gBattleAnimPaletteTable[233]); + LoadCompressedSpriteSheetUsingHeap(&gBattleAnimPicTable[233]); + LoadCompressedSpritePaletteUsingHeap(&gBattleAnimPaletteTable[233]); } taskId1 = CreateTask(sub_8172FEC, 10); @@ -2173,8 +2173,8 @@ void sub_81732B0(u8 taskId) { u8 paletteIndex; - LoadCompressedObjectPicUsingHeap(&gBattleAnimPicTable[269]); - LoadCompressedObjectPaletteUsingHeap(&gBattleAnimPaletteTable[269]); + LoadCompressedSpriteSheetUsingHeap(&gBattleAnimPicTable[269]); + LoadCompressedSpritePaletteUsingHeap(&gBattleAnimPaletteTable[269]); paletteIndex = IndexOfSpritePaletteTag(0x281D); // unused DestroyAnimVisualTask(taskId); } diff --git a/src/battle_arena.c b/src/battle_arena.c index cd2c976da..14f86c882 100644 --- a/src/battle_arena.c +++ b/src/battle_arena.c @@ -499,7 +499,7 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state) case 0: BeginNormalPaletteFade(0x7FFFFF1C, 4, 0, 8, 0); SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR); - LoadCompressedObjectPic(gUnknown_08611F74); + LoadCompressedSpriteSheet(gUnknown_08611F74); LoadCompressedPalette(gUnknown_08D855E8, 0x1F0, 0x20); gBattle_WIN0H = 0xFF; gBattle_WIN0V = 0x70; diff --git a/src/battle_bg.c b/src/battle_bg.c index bb66a41fd..7ba59e6be 100644 --- a/src/battle_bg.c +++ b/src/battle_bg.c @@ -1103,7 +1103,7 @@ void DrawBattleEntryBackground(void) SetGpuReg(REG_OFFSET_WINOUT, 0x36); gBattle_BG1_Y = 0xFF5C; gBattle_BG2_Y = 0xFF5C; - LoadCompressedObjectPicUsingHeap(&gUnknown_0831AA00); + LoadCompressedSpriteSheetUsingHeap(&gUnknown_0831AA00); } else if (gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000 | BATTLE_TYPE_EREADER_TRAINER)) { diff --git a/src/battle_dome.c b/src/battle_dome.c index 514b57c97..159d7e790 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -3536,7 +3536,7 @@ static void sub_8190400(u8 taskId) DecompressAndLoadBgGfxUsingHeap(2, gUnknown_08D83D50, 0x2000, 0, 0); DecompressAndLoadBgGfxUsingHeap(2, gUnknown_08D84970, 0x2000, 0, 1); DecompressAndLoadBgGfxUsingHeap(3, gUnknown_08D84F00, 0x800, 0, 1); - LoadCompressedObjectPic(gUnknown_0860CF50); + LoadCompressedSpriteSheet(gUnknown_0860CF50); LoadCompressedPalette(gUnknown_08D85358, 0, 0x200); LoadCompressedPalette(gUnknown_08D85444, 0x100, 0x200); LoadCompressedPalette(gUnknown_08D85600, 0xF0, 0x20); @@ -5707,7 +5707,7 @@ static void sub_8194220(u8 taskId) gTasks[taskId].data[0]++; break; case 3: - LoadCompressedObjectPic(gUnknown_0860CF50); + LoadCompressedSpriteSheet(gUnknown_0860CF50); if (r10 == 0) { for (i = 0; i < (unsigned) 31; i++) diff --git a/src/battle_factory_screen.c b/src/battle_factory_screen.c index 60b233daf..0bcdc0d66 100644 --- a/src/battle_factory_screen.c +++ b/src/battle_factory_screen.c @@ -131,8 +131,6 @@ struct FactorySwapMonsStruct bool8 unk30; }; -extern u8 gUnknown_0203CF20; - extern const u16 gBattleFrontierHeldItems[]; extern const struct FacilityMon gBattleFrontierMons[]; extern const struct FacilityMon gSlateportBattleTentMons[]; @@ -1167,7 +1165,7 @@ static void CB2_InitSelectScreen(void) case 4: LoadSpritePalettes(gUnknown_086103F4); LoadSpriteSheets(gUnknown_086103BC); - LoadCompressedObjectPic(gUnknown_086103E4); + LoadCompressedSpriteSheet(gUnknown_086103E4); ShowBg(0); ShowBg(1); SetVBlankCallback(Select_VblankCb); @@ -3171,7 +3169,7 @@ static void CB2_InitSwapScreen(void) case 4: LoadSpritePalettes(gUnknown_086106B0); LoadSpriteSheets(gUnknown_08610650); - LoadCompressedObjectPic(gUnknown_086106A0); + LoadCompressedSpriteSheet(gUnknown_086106A0); SetVBlankCallback(Swap_VblankCb); gMain.state++; break; diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index f53a6281d..a5d2566df 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -643,7 +643,7 @@ void DecompressTrainerFrontPic(u16 frontPicId, u8 battlerId) DecompressPicFromTable_2(&gTrainerFrontPicTable[frontPicId], gMonSpritesGfxPtr->sprites[position], SPECIES_NONE); - LoadCompressedObjectPalette(&gTrainerFrontPicPaletteTable[frontPicId]); + LoadCompressedSpritePalette(&gTrainerFrontPicPaletteTable[frontPicId]); } void DecompressTrainerBackPic(u16 backPicId, u8 battlerId) @@ -675,20 +675,20 @@ void BattleLoadAllHealthBoxesGfxAtOnce(void) LoadSpritePalette(&sSpritePalettes_HealthBoxHealthBar[1]); if (!IsDoubleBattle()) { - LoadCompressedObjectPic(&sSpriteSheet_SinglesPlayerHealthbox); - LoadCompressedObjectPic(&sSpriteSheet_SinglesOpponentHealthbox); + LoadCompressedSpriteSheet(&sSpriteSheet_SinglesPlayerHealthbox); + LoadCompressedSpriteSheet(&sSpriteSheet_SinglesOpponentHealthbox); numberOfBattlers = 2; } else { - LoadCompressedObjectPic(&sSpriteSheets_DoublesPlayerHealthbox[0]); - LoadCompressedObjectPic(&sSpriteSheets_DoublesPlayerHealthbox[1]); - LoadCompressedObjectPic(&sSpriteSheets_DoublesOpponentHealthbox[0]); - LoadCompressedObjectPic(&sSpriteSheets_DoublesOpponentHealthbox[1]); + LoadCompressedSpriteSheet(&sSpriteSheets_DoublesPlayerHealthbox[0]); + LoadCompressedSpriteSheet(&sSpriteSheets_DoublesPlayerHealthbox[1]); + LoadCompressedSpriteSheet(&sSpriteSheets_DoublesOpponentHealthbox[0]); + LoadCompressedSpriteSheet(&sSpriteSheets_DoublesOpponentHealthbox[1]); numberOfBattlers = 4; } for (i = 0; i < numberOfBattlers; i++) - LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[i]]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[i]]); } bool8 BattleLoadAllHealthBoxesGfx(u8 state) @@ -707,37 +707,37 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state) if (state == 2) { if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) - LoadCompressedObjectPic(&sSpriteSheet_SafariHealthbox); + LoadCompressedSpriteSheet(&sSpriteSheet_SafariHealthbox); else - LoadCompressedObjectPic(&sSpriteSheet_SinglesPlayerHealthbox); + LoadCompressedSpriteSheet(&sSpriteSheet_SinglesPlayerHealthbox); } else if (state == 3) - LoadCompressedObjectPic(&sSpriteSheet_SinglesOpponentHealthbox); + LoadCompressedSpriteSheet(&sSpriteSheet_SinglesOpponentHealthbox); else if (state == 4) - LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[0]]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[0]]); else if (state == 5) - LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[1]]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[1]]); else retVal = TRUE; } else { if (state == 2) - LoadCompressedObjectPic(&sSpriteSheets_DoublesPlayerHealthbox[0]); + LoadCompressedSpriteSheet(&sSpriteSheets_DoublesPlayerHealthbox[0]); else if (state == 3) - LoadCompressedObjectPic(&sSpriteSheets_DoublesPlayerHealthbox[1]); + LoadCompressedSpriteSheet(&sSpriteSheets_DoublesPlayerHealthbox[1]); else if (state == 4) - LoadCompressedObjectPic(&sSpriteSheets_DoublesOpponentHealthbox[0]); + LoadCompressedSpriteSheet(&sSpriteSheets_DoublesOpponentHealthbox[0]); else if (state == 5) - LoadCompressedObjectPic(&sSpriteSheets_DoublesOpponentHealthbox[1]); + LoadCompressedSpriteSheet(&sSpriteSheets_DoublesOpponentHealthbox[1]); else if (state == 6) - LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[0]]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[0]]); else if (state == 7) - LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[1]]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[1]]); else if (state == 8) - LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[2]]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[2]]); else if (state == 9) - LoadCompressedObjectPic(&sSpriteSheets_HealthBar[gBattlerPositions[3]]); + LoadCompressedSpriteSheet(&sSpriteSheets_HealthBar[gBattlerPositions[3]]); else retVal = TRUE; } @@ -1116,7 +1116,7 @@ void LoadAndCreateEnemyShadowSprites(void) { u8 battlerId; - LoadCompressedObjectPic(&gSpriteSheet_EnemyShadow); + LoadCompressedSpriteSheet(&gSpriteSheet_EnemyShadow); battlerId = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT); gBattleSpritesDataPtr->healthBoxesData[battlerId].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBattlerSpriteCoord(battlerId, 0), GetBattlerSpriteCoord(battlerId, 1) + 29, 0xC8); diff --git a/src/battle_interface.c b/src/battle_interface.c index 9fd8e116a..4a8422091 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -1523,7 +1523,7 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, bar_data0 = 5; } - LoadCompressedObjectPicUsingHeap(&sStatusSummaryBarSpriteSheet); + LoadCompressedSpriteSheetUsingHeap(&sStatusSummaryBarSpriteSheet); LoadSpriteSheet(&sStatusSummaryBallsSpriteSheet); LoadSpritePalette(&sStatusSummaryBarSpritePal); LoadSpritePalette(&sStatusSummaryBallsSpritePal); diff --git a/src/battle_pike.c b/src/battle_pike.c index 893796790..303146f6a 100644 --- a/src/battle_pike.c +++ b/src/battle_pike.c @@ -1611,7 +1611,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/battle_pyramid_bag.c b/src/battle_pyramid_bag.c index 8a6348522..12f631155 100644 --- a/src/battle_pyramid_bag.c +++ b/src/battle_pyramid_bag.c @@ -547,7 +547,7 @@ static bool8 sub_81C5238(void) gPyramidBagResources->state++; break; case 3: - LoadCompressedObjectPic(&gUnknown_0861F3CC); + LoadCompressedSpriteSheet(&gUnknown_0861F3CC); gPyramidBagResources->state++; break; case 4: @@ -964,7 +964,7 @@ static void HandleMenuActionInput(u8 taskId) { if (sub_81221EC() != TRUE) { - s8 id = GetMenuCursorPos(); + s8 id = Menu_GetCursorPos(); if (gMain.newKeys & DPAD_UP) { if (id > 0 && IsValidMenuAction(id - 2)) diff --git a/src/battle_tower.c b/src/battle_tower.c index 4a9e0dbc4..e60783fa2 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -2147,7 +2147,7 @@ static void FillFactoryTentTrainerParty(u16 trainerId, u8 firstMonId) void FrontierSpeechToString(const u16 *words) { ConvertEasyChatWordsToString(gStringVar4, words, 3, 2); - if (GetStringWidth(1, gStringVar4, -1) > 204) + if (GetStringWidth(1, gStringVar4, -1) > 204u) { s32 i = 0; diff --git a/src/berry_tag_screen.c b/src/berry_tag_screen.c index 22f99a426..6e968fc0a 100644 --- a/src/berry_tag_screen.c +++ b/src/berry_tag_screen.c @@ -349,11 +349,11 @@ static bool8 LoadBerryTagGfx(void) sBerryTag->gfxState++; break; case 5: - LoadCompressedObjectPic(&gUnknown_0857FDEC); + LoadCompressedSpriteSheet(&gUnknown_0857FDEC); sBerryTag->gfxState++; break; default: - LoadCompressedObjectPalette(&gUnknown_0857FDF4); + LoadCompressedSpritePalette(&gUnknown_0857FDF4); return TRUE; // done } diff --git a/src/bg.c b/src/bg.c index a41075ad7..21624e4a0 100644 --- a/src/bg.c +++ b/src/bg.c @@ -33,8 +33,8 @@ struct BgConfig2 u32 unk_3:18; void* tilemap; - u32 bg_x; - u32 bg_y; + s32 bg_x; + s32 bg_y; }; static IWRAM_DATA struct BgControl sGpuBgConfigs; @@ -524,12 +524,12 @@ u16 GetBgAttribute(u8 bg, u8 attributeId) case 8: switch (GetBgType(bg)) { - case 0: - return GetBgMetricTextMode(bg, 0) * 0x800; - case 1: - return GetBgMetricAffineMode(bg, 0) * 0x100; - default: - return 0; + case 0: + return GetBgMetricTextMode(bg, 0) * 0x800; + case 1: + return GetBgMetricAffineMode(bg, 0) * 0x100; + default: + return 0; } case 9: return GetBgType(bg); @@ -540,7 +540,7 @@ u16 GetBgAttribute(u8 bg, u8 attributeId) } } -u32 ChangeBgX(u8 bg, u32 value, u8 op) +s32 ChangeBgX(u8 bg, s32 value, u8 op) { u8 mode; u16 temp1; @@ -610,7 +610,7 @@ u32 ChangeBgX(u8 bg, u32 value, u8 op) return sGpuBgConfigs2[bg].bg_x; } -u32 GetBgX(u8 bg) +s32 GetBgX(u8 bg) { if (IsInvalidBg32(bg) != FALSE) return -1; @@ -620,7 +620,7 @@ u32 GetBgX(u8 bg) return sGpuBgConfigs2[bg].bg_x; } -u32 ChangeBgY(u8 bg, u32 value, u8 op) +s32 ChangeBgY(u8 bg, s32 value, u8 op) { u8 mode; u16 temp1; @@ -690,7 +690,7 @@ u32 ChangeBgY(u8 bg, u32 value, u8 op) return sGpuBgConfigs2[bg].bg_y; } -u32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op) +s32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op) { u8 mode; u16 temp1; @@ -761,7 +761,7 @@ u32 ChangeBgY_ScreenOff(u8 bg, u32 value, u8 op) return sGpuBgConfigs2[bg].bg_y; } -u32 GetBgY(u8 bg) +s32 GetBgY(u8 bg) { if (IsInvalidBg32(bg) != FALSE) return -1; @@ -778,14 +778,10 @@ void SetBgAffine(u8 bg, u32 srcCenterX, u32 srcCenterY, s16 dispCenterX, s16 dis u8 Unused_AdjustBgMosaic(u8 a1, u8 a2) { - u16 result; - s16 test1; - s16 test2; + u16 result = GetGpuReg(REG_OFFSET_MOSAIC); + s16 test1 = result & 0xF; + s16 test2 = (result >> 4) & 0xF; - result = GetGpuReg(REG_OFFSET_MOSAIC); - - test1 = result & 0xF; - test2 = (result >> 4) & 0xF; result &= 0xFF00; switch (a2) @@ -1039,47 +1035,43 @@ void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 widt u16 mode2; u16 attribute; u16 mode3; + u16 x16, y16; - u16 x16; - u16 y16; - - if (IsInvalidBg32(bg) == FALSE && IsTileMapOutsideWram(bg) == FALSE) + if (!IsInvalidBg32(bg) && !IsTileMapOutsideWram(bg)) { attribute = GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE); mode = GetBgMetricTextMode(bg, 0x1) * 0x20; mode2 = GetBgMetricTextMode(bg, 0x2) * 0x20; switch (GetBgType(bg)) { - case 0: - for (y16 = y; y16 < (y + height); y16++) + case 0: + for (y16 = y; y16 < (y + height); y16++) + { + for (x16 = x; x16 < (x + width); x16++) { - for (x16 = x; x16 < (x + width); x16++) - { - CopyTileMapEntry(&firstTileNum, &((u16*)sGpuBgConfigs2[bg].tilemap)[(u16)GetTileMapIndexFromCoords(x16, y16, attribute, mode, mode2)], paletteSlot, 0, 0); - firstTileNum = (firstTileNum & 0xFC00) + ((firstTileNum + tileNumDelta) & 0x3FF); - } + CopyTileMapEntry(&firstTileNum, &((u16*)sGpuBgConfigs2[bg].tilemap)[(u16)GetTileMapIndexFromCoords(x16, y16, attribute, mode, mode2)], paletteSlot, 0, 0); + firstTileNum = (firstTileNum & 0xFC00) + ((firstTileNum + tileNumDelta) & 0x3FF); } - break; - case 1: - mode3 = GetBgMetricAffineMode(bg, 0x1); - for (y16 = y; y16 < (y + height); y16++) + } + break; + case 1: + mode3 = GetBgMetricAffineMode(bg, 0x1); + for (y16 = y; y16 < (y + height); y16++) + { + for (x16 = x; x16 < (x + width); x16++) { - for (x16 = x; x16 < (x + width); x16++) - { - ((u8*)sGpuBgConfigs2[bg].tilemap)[(y16 * mode3) + x16] = firstTileNum; - firstTileNum = (firstTileNum & 0xFC00) + ((firstTileNum + tileNumDelta) & 0x3FF); - } + ((u8*)sGpuBgConfigs2[bg].tilemap)[(y16 * mode3) + x16] = firstTileNum; + firstTileNum = (firstTileNum & 0xFC00) + ((firstTileNum + tileNumDelta) & 0x3FF); } - break; + } + break; } } } u16 GetBgMetricTextMode(u8 bg, u8 whichMetric) { - u8 attribute; - - attribute = GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE); + u8 attribute = GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE); switch (whichMetric) { @@ -1125,9 +1117,7 @@ u16 GetBgMetricTextMode(u8 bg, u8 whichMetric) u32 GetBgMetricAffineMode(u8 bg, u8 whichMetric) { - u8 attribute; - - attribute = GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE); + u8 attribute = GetBgControlAttribute(bg, BG_CTRL_ATTR_SCREENSIZE); switch (whichMetric) { diff --git a/src/blit.c b/src/blit.c index b4d5f7de5..26a63fe9b 100644 --- a/src/blit.c +++ b/src/blit.c @@ -1,12 +1,12 @@ #include "global.h" #include "blit.h" -void BlitBitmapRect4BitWithoutColorKey(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height) +void BlitBitmapRect4BitWithoutColorKey(const struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height) { BlitBitmapRect4Bit(src, dst, srcX, srcY, dstX, dstY, width, height, 0xFF); } -void BlitBitmapRect4Bit(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height, u8 colorKey) +void BlitBitmapRect4Bit(const struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height, u8 colorKey) { s32 xEnd; s32 yEnd; @@ -14,7 +14,7 @@ void BlitBitmapRect4Bit(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 sr s32 multiplierDstY; s32 loopSrcY, loopDstY; s32 loopSrcX, loopDstX; - u8 *pixelsSrc; + const u8 *pixelsSrc; u8 *pixelsDst; s32 toOrr; s32 toAnd; @@ -103,7 +103,7 @@ void FillBitmapRect4Bit(struct Bitmap *surface, u16 x, u16 y, u16 width, u16 hei } } -void BlitBitmapRect4BitTo8Bit(struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height, u8 colorKey, u8 paletteOffset) +void BlitBitmapRect4BitTo8Bit(const struct Bitmap *src, struct Bitmap *dst, u16 srcX, u16 srcY, u16 dstX, u16 dstY, u16 width, u16 height, u8 colorKey, u8 paletteOffset) { s32 palOffsetBits; s32 xEnd; @@ -112,7 +112,7 @@ void BlitBitmapRect4BitTo8Bit(struct Bitmap *src, struct Bitmap *dst, u16 srcX, s32 multiplierDstY; s32 loopSrcY, loopDstY; s32 loopSrcX, loopDstX; - u8 *pixelsSrc; + const u8 *pixelsSrc; u8 *pixelsDst; s32 colorKeyBits; diff --git a/src/cable_car.c b/src/cable_car.c index 00606c905..207a0c22d 100755 --- a/src/cable_car.c +++ b/src/cable_car.c @@ -259,7 +259,7 @@ static void CableCarMainCallback_Setup(void) break; case 2: for (i = 0; i < 3; i++) - LoadCompressedObjectPic(&gUnknown_085CDB54[i]); + LoadCompressedSpriteSheet(&gUnknown_085CDB54[i]); LoadSpritePalettes(gUnknown_085CDB74); sCableCar->mtChimneyTilemap = malloc_and_decompress(gCableCarMtChimneyTilemap, &sizeOut); @@ -351,7 +351,7 @@ static void CableCarMainCallback_Run(void) static void CleanupCableCar(void) { u8 i = 0; - + HideBg(0); HideBg(1); HideBg(2); @@ -361,7 +361,7 @@ static void CleanupCableCar(void) sub_80AB130(WEATHER_NONE); for (i = 0; i < 20; i++) gWeatherPtr->sprites.s2.ashSprites[i] = NULL; - + ResetTasks(); ResetSpriteData(); ResetPaletteFade(); diff --git a/src/contest.c b/src/contest.c index 3d74109cb..34662b490 100644 --- a/src/contest.c +++ b/src/contest.c @@ -2484,7 +2484,7 @@ u8 sub_80DB0C4(void) { u8 spriteId; - LoadCompressedObjectPic(&gUnknown_08587C00); + LoadCompressedSpriteSheet(&gUnknown_08587C00); LoadCompressedPalette(gContest2Pal, 0x110, 32); spriteId = CreateSprite(&gSpriteTemplate_8587BE8, 112, 36, 30); gSprites[spriteId].oam.paletteNum = 1; @@ -2496,8 +2496,8 @@ u8 sub_80DB120(void) { u8 spriteId; - LoadCompressedObjectPic(&gUnknown_08587C08); - LoadCompressedObjectPalette(&gUnknown_08587C10); + LoadCompressedSpriteSheet(&gUnknown_08587C08); + LoadCompressedSpritePalette(&gUnknown_08587C10); spriteId = CreateSprite(&gSpriteTemplate_8587C18, 96, 10, 29); gSprites[spriteId].invisible = TRUE; gSprites[spriteId].data[0] = gSprites[spriteId].oam.tileNum; diff --git a/src/credits.c b/src/credits.c index 67ab97481..42bdbf454 100644 --- a/src/credits.c +++ b/src/credits.c @@ -1964,9 +1964,9 @@ static bool8 sub_8176AB0(u8 data, u8 taskIdA) case 2: if (gSaveBlock2Ptr->playerGender == MALE) { - LoadCompressedObjectPic(gUnknown_085F5334); - LoadCompressedObjectPic(gUnknown_085F53BC); - LoadCompressedObjectPic(gUnknown_085F5354); + LoadCompressedSpriteSheet(gUnknown_085F5334); + LoadCompressedSpriteSheet(gUnknown_085F53BC); + LoadCompressedSpriteSheet(gUnknown_085F5354); LoadSpritePalettes(gUnknown_085F5384); spriteId = intro_create_brendan_sprite(120, 46); @@ -1981,9 +1981,9 @@ static bool8 sub_8176AB0(u8 data, u8 taskIdA) } else { - LoadCompressedObjectPic(gUnknown_085F5344); - LoadCompressedObjectPic(gUnknown_085F53AC); - LoadCompressedObjectPic(gUnknown_085F5354); + LoadCompressedSpriteSheet(gUnknown_085F5344); + LoadCompressedSpriteSheet(gUnknown_085F53AC); + LoadCompressedSpriteSheet(gUnknown_085F5354); LoadSpritePalettes(gUnknown_085F5384); spriteId = intro_create_may_sprite(120, 46); 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/decompress.c b/src/decompress.c index 24d23209f..ed2f7a0bb 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -22,7 +22,7 @@ void LZDecompressVram(const u32 *src, void *dest) LZ77UnCompVram(src, dest); } -u16 LoadCompressedObjectPic(const struct CompressedSpriteSheet *src) +u16 LoadCompressedSpriteSheet(const struct CompressedSpriteSheet *src) { struct SpriteSheet dest; @@ -33,7 +33,7 @@ u16 LoadCompressedObjectPic(const struct CompressedSpriteSheet *src) return LoadSpriteSheet(&dest); } -void LoadCompressedObjectPicOverrideBuffer(const struct CompressedSpriteSheet *src, void *buffer) +void LoadCompressedSpriteSheetOverrideBuffer(const struct CompressedSpriteSheet *src, void *buffer) { struct SpriteSheet dest; @@ -44,7 +44,7 @@ void LoadCompressedObjectPicOverrideBuffer(const struct CompressedSpriteSheet *s LoadSpriteSheet(&dest); } -void LoadCompressedObjectPalette(const struct CompressedSpritePalette *src) +void LoadCompressedSpritePalette(const struct CompressedSpritePalette *src) { struct SpritePalette dest; @@ -54,7 +54,7 @@ void LoadCompressedObjectPalette(const struct CompressedSpritePalette *src) LoadSpritePalette(&dest); } -void LoadCompressedObjectPaletteOverrideBuffer(const struct CompressedSpritePalette *a, void *buffer) +void LoadCompressedSpritePaletteOverrideBuffer(const struct CompressedSpritePalette *a, void *buffer) { struct SpritePalette dest; @@ -465,7 +465,7 @@ u32 GetDecompressedDataSize(const u32 *ptr) return (ptr8[3] << 16) | (ptr8[2] << 8) | (ptr8[1]); } -bool8 LoadCompressedObjectPicUsingHeap(const struct CompressedSpriteSheet* src) +bool8 LoadCompressedSpriteSheetUsingHeap(const struct CompressedSpriteSheet* src) { struct SpriteSheet dest; void* buffer; @@ -482,7 +482,7 @@ bool8 LoadCompressedObjectPicUsingHeap(const struct CompressedSpriteSheet* src) return FALSE; } -bool8 LoadCompressedObjectPaletteUsingHeap(const struct CompressedSpritePalette *src) +bool8 LoadCompressedSpritePaletteUsingHeap(const struct CompressedSpritePalette *src) { struct SpritePalette dest; void* buffer; diff --git a/src/decoration.c b/src/decoration.c index dd691721a..addca6954 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -519,7 +519,7 @@ void sub_8126B80(u8 taskId) if (!gPaletteFade.active) { - menuPos = GetMenuCursorPos(); + menuPos = Menu_GetCursorPos(); switch (Menu_ProcessInput()) { default: @@ -527,7 +527,7 @@ void sub_8126B80(u8 taskId) sSecretBasePCMenuActions[sSecretBasePCMenuCursorPos].func.void_u8(taskId); break; case -2: - sSecretBasePCMenuCursorPos = GetMenuCursorPos(); + sSecretBasePCMenuCursorPos = Menu_GetCursorPos(); if ((s8)menuPos != sSecretBasePCMenuCursorPos) { sub_8126C08(); @@ -2065,7 +2065,7 @@ u8 AddDecorationIconObjectFromIconTable(u16 tilesTag, u16 paletteTag, u8 decor) LoadSpriteSheet(&sheet); palette.data = GetDecorationIconPicOrPalette(decor, 1); palette.tag = paletteTag; - LoadCompressedObjectPalette(&palette); + LoadCompressedSpritePalette(&palette); template = malloc(sizeof(struct SpriteTemplate)); *template = gItemIconSpriteTemplate; template->tileTag = tilesTag; diff --git a/src/dma3_manager.c b/src/dma3_manager.c index 28df9d932..51fa7072d 100644 --- a/src/dma3_manager.c +++ b/src/dma3_manager.c @@ -1,9 +1,6 @@ #include "global.h" #include "dma3.h" -// Maximum amount of data we will transfer in one operation -#define MAX_DMA_BLOCK_SIZE 0x1000 - #define MAX_DMA_REQUESTS 128 #define DMA_REQUEST_COPY32 1 @@ -40,49 +37,6 @@ void ClearDma3Requests(void) gDma3ManagerLocked = FALSE; } -#define Dma3CopyLarge_(src, dest, size, bit) \ -{ \ - const void *_src = src; \ - void *_dest = dest; \ - u32 _size = size; \ - while (1) \ - { \ - if (_size <= MAX_DMA_BLOCK_SIZE) \ - { \ - DmaCopy##bit(3, _src, _dest, _size); \ - break; \ - } \ - DmaCopy##bit(3, _src, _dest, MAX_DMA_BLOCK_SIZE); \ - _src += MAX_DMA_BLOCK_SIZE; \ - _dest += MAX_DMA_BLOCK_SIZE; \ - _size -= MAX_DMA_BLOCK_SIZE; \ - } \ -} - -#define Dma3CopyLarge16_(src, dest, size) Dma3CopyLarge_(src, dest, size, 16) -#define Dma3CopyLarge32_(src, dest, size) Dma3CopyLarge_(src, dest, size, 32) - -#define Dma3FillLarge_(value, dest, size, bit) \ -{ \ - void *_dest = dest; \ - u32 _size = size; \ - while (1) \ - { \ - if (_size <= MAX_DMA_BLOCK_SIZE) \ - { \ - DmaFill##bit(3, value, _dest, _size); \ - break; \ - } \ - DmaFill##bit(3, value, _dest, MAX_DMA_BLOCK_SIZE); \ - _dest += MAX_DMA_BLOCK_SIZE; \ - _size -= MAX_DMA_BLOCK_SIZE; \ - } \ -} - -#define Dma3FillLarge16_(value, dest, size) Dma3FillLarge_(value, dest, size, 16) -#define Dma3FillLarge32_(value, dest, size) Dma3FillLarge_(value, dest, size, 32) - - void ProcessDma3Requests(void) { u16 bytesTransferred; diff --git a/src/egg_hatch.c b/src/egg_hatch.c index ed25a2c68..360dd2466 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -30,6 +30,7 @@ #include "field_weather.h" #include "international_string_util.h" #include "naming_screen.h" +#include "pokemon_storage_system.h" #include "field_screen_effect.h" #include "battle.h" // to get rid of later @@ -60,10 +61,6 @@ extern const u32 gUnknown_08331F60[]; // tilemap gameboy circle extern const u8 gText_HatchedFromEgg[]; extern const u8 gText_NickHatchPrompt[]; -extern void PlayRainSoundEffect(void); -extern u16 sub_80D22D0(void); -extern u8 CountPartyAliveNonEggMonsExcept(u8); - static void Task_EggHatch(u8 taskID); static void CB2_EggHatch_0(void); static void CB2_EggHatch_1(void); @@ -442,7 +439,7 @@ static u8 EggHatchCreateMonSprite(u8 a0, u8 switchID, u8 pokeID, u16* speciesLoc HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species], gMonSpritesGfxPtr->sprites[(a0 * 2) + 1], species, pid); - LoadCompressedObjectPalette(GetMonSpritePalStruct(mon)); + LoadCompressedSpritePalette(GetMonSpritePalStruct(mon)); *speciesLoc = species; } break; @@ -876,7 +873,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) @@ -888,7 +885,7 @@ u8 GetEggStepsToSubtract(void) u16 sub_80722E0(void) { - u16 value = sub_80D22D0(); - value += CountPartyAliveNonEggMonsExcept(6); - return value; + u16 aliveNonEggMonsCount = CountStorageNonEggMons(); + aliveNonEggMonsCount += CountPartyAliveNonEggMonsExcept(6); + return aliveNonEggMonsCount; } diff --git a/src/evolution_graphics.c b/src/evolution_graphics.c index 022599dfb..bfd46978c 100644 --- a/src/evolution_graphics.c +++ b/src/evolution_graphics.c @@ -251,7 +251,7 @@ static void CreatePostEvoSparkleSet2(u8 arg0) void LoadEvoSparkleSpriteAndPal(void) { - LoadCompressedObjectPicUsingHeap(&sEvoSparkleSpriteSheets[0]); + LoadCompressedSpriteSheetUsingHeap(&sEvoSparkleSpriteSheets[0]); LoadSpritePalettes(sEvoSparkleSpritePals); } diff --git a/src/field_effect.c b/src/field_effect.c index 1442c611a..e1850d001 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -733,8 +733,8 @@ bool8 FieldEffectActiveListContains(u8 id) u8 CreateTrainerSprite(u8 trainerSpriteID, s16 x, s16 y, u8 subpriority, u8 *buffer) { struct SpriteTemplate spriteTemplate; - LoadCompressedObjectPaletteOverrideBuffer(&gTrainerFrontPicPaletteTable[trainerSpriteID], buffer); - LoadCompressedObjectPicOverrideBuffer(&gTrainerFrontPicTable[trainerSpriteID], buffer); + LoadCompressedSpritePaletteOverrideBuffer(&gTrainerFrontPicPaletteTable[trainerSpriteID], buffer); + LoadCompressedSpriteSheetOverrideBuffer(&gTrainerFrontPicTable[trainerSpriteID], buffer); spriteTemplate.tileTag = gTrainerFrontPicTable[trainerSpriteID].tag; spriteTemplate.paletteTag = gTrainerFrontPicPaletteTable[trainerSpriteID].tag; spriteTemplate.oam = &gNewGameBirchOamAttributes; 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 7aaab902f..fac17dea9 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 3f945fcfb..64ff46ce2 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/hall_of_fame.c b/src/hall_of_fame.c index f7792e935..fc60d2b08 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -1283,8 +1283,8 @@ static void sub_8174F70(void) ResetAllPicSprites(); FreeAllSpritePalettes(); gReservedSpritePaletteCount = 8; - LoadCompressedObjectPic(sHallOfFame_ConfettiSpriteSheet); - LoadCompressedObjectPalette(sHallOfFame_ConfettiSpritePalette); + LoadCompressedSpriteSheet(sHallOfFame_ConfettiSpriteSheet); + LoadCompressedSpritePalette(sHallOfFame_ConfettiSpritePalette); } static void sub_8174FAC(void) @@ -1475,8 +1475,8 @@ static void sub_8175364(u8 taskId) gSpecialVar_0x8004 = var; gSpecialVar_0x8005 = 0xFFFF; } - LoadCompressedObjectPic(sHallOfFame_ConfettiSpriteSheet); - LoadCompressedObjectPalette(sHallOfFame_ConfettiSpritePalette); + LoadCompressedSpriteSheet(sHallOfFame_ConfettiSpriteSheet); + LoadCompressedSpritePalette(sHallOfFame_ConfettiSpritePalette); data[0]++; break; case 1: diff --git a/src/intro.c b/src/intro.c index 94692e6ec..18a899fb0 100644 --- a/src/intro.c +++ b/src/intro.c @@ -1044,10 +1044,10 @@ static void Task_IntroLoadPart1Graphics(u8 taskId) SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(20) | BGCNT_16COLOR | BGCNT_TXT256x512); SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(1) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(18) | BGCNT_16COLOR | BGCNT_TXT256x512); SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(16) | BGCNT_16COLOR | BGCNT_TXT256x512); - LoadCompressedObjectPic(gUnknown_085E4FDC); - LoadCompressedObjectPic(gUnknown_085E4FEC); + LoadCompressedSpriteSheet(gUnknown_085E4FDC); + LoadCompressedSpriteSheet(gUnknown_085E4FEC); LoadSpritePalettes(gUnknown_085E4FFC); - LoadCompressedObjectPic(gUnknown_085E4A74); + LoadCompressedSpriteSheet(gUnknown_085E4A74); LoadSpritePalettes(gUnknown_085E4A84); CpuCopy16(gPlttBufferUnfaded + 0x100, gPlttBufferUnfaded + 0x1F0, 0x20); CpuCopy16(gPlttBufferUnfaded + 0x100, gPlttBufferUnfaded + 0x1E1, 0x1E); @@ -1204,16 +1204,16 @@ static void Task_IntroStartBikeRide(u8 taskId) u8 spriteId; if (gUnknown_0203BCC8 == 0) - LoadCompressedObjectPic(gIntro2BrendanSpriteSheet); + LoadCompressedSpriteSheet(gIntro2BrendanSpriteSheet); else - LoadCompressedObjectPic(gIntro2MaySpriteSheet); + LoadCompressedSpriteSheet(gIntro2MaySpriteSheet); - LoadCompressedObjectPic(gIntro2BicycleSpriteSheet); - LoadCompressedObjectPic(gIntro2FlygonSpriteSheet); + LoadCompressedSpriteSheet(gIntro2BicycleSpriteSheet); + LoadCompressedSpriteSheet(gIntro2FlygonSpriteSheet); for (spriteId = 0; spriteId < 3; spriteId++) { - LoadCompressedObjectPic(&gUnknown_085E4AE8[spriteId]); + LoadCompressedSpriteSheet(&gUnknown_085E4AE8[spriteId]); } LoadSpritePalettes(gUnknown_085F530C); @@ -1542,8 +1542,8 @@ static void Task_IntroLoadPart1Graphics3(u8 taskId) LZDecompressVram(gIntro3GroudonTilemap, (void *)(VRAM + 0xC000)); LZDecompressVram(gIntro3LegendBgGfx, (void *)(VRAM + 0x4000)); LZDecompressVram(gIntro3GroudonBgTilemap, (void *)(VRAM + 0xE000)); - LoadCompressedObjectPicUsingHeap(&gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_ROCKS)]); - LoadCompressedObjectPaletteUsingHeap(&gBattleAnimPaletteTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_ROCKS)]); + LoadCompressedSpriteSheetUsingHeap(&gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_ROCKS)]); + LoadCompressedSpritePaletteUsingHeap(&gBattleAnimPaletteTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_ROCKS)]); CpuCopy16(gIntro3BgPal, gPlttBufferUnfaded, sizeof(gIntro3BgPal)); gTasks[taskId].func = Task_IntroLoadPart1Graphics4; } @@ -1764,7 +1764,7 @@ static void Task_IntroLoadPart1Graphics9(u8 taskId) LZDecompressVram(gIntro3KyogreGfx, (void *)VRAM); LZDecompressVram(gIntro3KyogreTilemap, (void *)(VRAM + 0xC000)); LZDecompressVram(gIntro3KyogreBgTilemap, (void *)(VRAM + 0xE000)); - LoadCompressedObjectPic(gUnknown_085E4C88); + LoadCompressedSpriteSheet(gUnknown_085E4C88); LoadSpritePalette(gUnknown_085E4C98); BeginNormalPaletteFade(0xFFFFFFFE, 0, 0x10, 0, RGB_WHITEALPHA); gTasks[taskId].func = Task_IntroFadeIn0; @@ -2092,7 +2092,7 @@ static void Task_IntroFadeIn5(u8 taskId) gTasks[taskId].data[0] = 0; gTasks[taskId].data[6] = 1; gTasks[taskId].data[7] = 0; - LoadCompressedObjectPicUsingHeap(gUnknown_085E4BF4); + LoadCompressedSpriteSheetUsingHeap(gUnknown_085E4BF4); LoadSpritePalettes(gUnknown_085E4C04); } @@ -2169,7 +2169,7 @@ static void Task_IntroFadeIn7(u8 taskId) { u8 newTaskId; - LoadCompressedObjectPic(gUnknown_085E5048); + LoadCompressedSpriteSheet(gUnknown_085E5048); LoadSpritePalettes(gUnknown_085E5058); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP diff --git a/src/intro_credits_graphics.c b/src/intro_credits_graphics.c index 20a360901..d85e58938 100644 --- a/src/intro_credits_graphics.c +++ b/src/intro_credits_graphics.c @@ -341,7 +341,7 @@ void load_intro_part2_graphics(u8 a) LZ77UnCompVram(gUnknown_085F0DBC, (void *)(VRAM)); LZ77UnCompVram(gUnknown_085F1398, (void *)(VRAM + 0x3000)); LoadPalette(&gUnknown_085F0CFC, 0, 96); - LoadCompressedObjectPic(gUnknown_085F5064); + LoadCompressedSpriteSheet(gUnknown_085F5064); LoadPalette(&gUnknown_085F1668, 256, 32); sub_817B76C(); break; @@ -349,7 +349,7 @@ void load_intro_part2_graphics(u8 a) LZ77UnCompVram(gUnknown_085F1824, (void *)(VRAM)); LZ77UnCompVram(gUnknown_085F1EAC, (void *)(VRAM + 0x3000)); LoadPalette(&gUnknown_085F17E4, 0, 32); - LoadCompressedObjectPic(gUnknown_085F50EC); + LoadCompressedSpriteSheet(gUnknown_085F50EC); LoadPalette(&gUnknown_085F21B0, 256, 32); sub_817B788(); break; @@ -447,7 +447,7 @@ void sub_817B1C8(u8 a) LZ77UnCompVram(gUnknown_085F0DBC, (void *)(VRAM)); LZ77UnCompVram(gUnknown_085F1398, (void *)(VRAM + 0x3000)); LoadPalette(&gUnknown_085F0CFC, 0, 96); - LoadCompressedObjectPic(gUnknown_085F5064); + LoadCompressedSpriteSheet(gUnknown_085F5064); LZ77UnCompVram(gUnknown_085F16A8, (void *)(VRAM + 0x10000)); LoadPalette(&gUnknown_085F1668, 256, 32); sub_817B76C(); @@ -457,7 +457,7 @@ void sub_817B1C8(u8 a) LZ77UnCompVram(gUnknown_085F0DBC, (void *)(VRAM)); LZ77UnCompVram(gUnknown_085F1398, (void *)(VRAM + 0x3000)); LoadPalette(&gUnknown_085F0D5C, 0, 96); - LoadCompressedObjectPic(gUnknown_085F5064); + LoadCompressedSpriteSheet(gUnknown_085F5064); LZ77UnCompVram(gUnknown_085F16A8, (void *)(VRAM + 0x10000)); LoadPalette(&gUnknown_085F1688, 256, 32); sub_817B76C(); @@ -468,7 +468,7 @@ void sub_817B1C8(u8 a) LZ77UnCompVram(gUnknown_085F1824, (void *)(VRAM)); LZ77UnCompVram(gUnknown_085F1EAC, (void *)(VRAM + 0x3000)); LoadPalette(&gUnknown_085F1804, 0, 32); - LoadCompressedObjectPic(gUnknown_085F50EC); + LoadCompressedSpriteSheet(gUnknown_085F50EC); LoadPalette(&gUnknown_085F1804, 256, 32); sub_817B788(); break; @@ -477,7 +477,7 @@ void sub_817B1C8(u8 a) LZ77UnCompVram(gUnknown_085F235C, (void *)(VRAM)); LZ77UnCompVram(gUnknown_085F2568, (void *)(VRAM + 0x3000)); LoadPalette(&gUnknown_085F231C, 0, 64); - LoadCompressedObjectPic(gUnknown_085F5180); + LoadCompressedSpriteSheet(gUnknown_085F5180); LoadPalette(&gUnknown_085F2548, 256, 32); sub_817B7A4(); break; diff --git a/src/item_icon.c b/src/item_icon.c index d037782bd..e9379dbba 100644 --- a/src/item_icon.c +++ b/src/item_icon.c @@ -107,7 +107,7 @@ u8 AddItemIconSprite(u16 tilesTag, u16 paletteTag, u16 itemId) spritePalette.data = GetItemIconPicOrPalette(itemId, 1); spritePalette.tag = paletteTag; - LoadCompressedObjectPalette(&spritePalette); + LoadCompressedSpritePalette(&spritePalette); spriteTemplate = Alloc(sizeof(*spriteTemplate)); CpuCopy16(&gItemIconSpriteTemplate, spriteTemplate, sizeof(*spriteTemplate)); @@ -144,7 +144,7 @@ u8 AddCustomItemIconSprite(struct SpriteTemplate *customSpriteTemplate, u16 tile spritePalette.data = GetItemIconPicOrPalette(itemId, 1); spritePalette.tag = paletteTag; - LoadCompressedObjectPalette(&spritePalette); + LoadCompressedSpritePalette(&spritePalette); spriteTemplate = Alloc(sizeof(*spriteTemplate)); CpuCopy16(customSpriteTemplate, spriteTemplate, sizeof(*spriteTemplate)); diff --git a/src/item_menu.c b/src/item_menu.c index 32c42ac31..a220f02ef 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -713,13 +713,13 @@ bool8 load_bag_menu_graphics(void) break; case 3: if (IsWallysBag() == TRUE || gSaveBlock2Ptr->playerGender == MALE) - LoadCompressedObjectPic(&gUnknown_0857FB34); + LoadCompressedSpriteSheet(&gUnknown_0857FB34); else - LoadCompressedObjectPic(&gUnknown_0857FB3C); + LoadCompressedSpriteSheet(&gUnknown_0857FB3C); gUnknown_0203CE54->unk834++; break; case 4: - LoadCompressedObjectPalette(&gUnknown_0857FB44); + LoadCompressedSpritePalette(&gUnknown_0857FB44); gUnknown_0203CE54->unk834++; break; default: @@ -1564,7 +1564,7 @@ void Task_HandleOutOfBattleItemMenuInput(u8 taskId) { if (sub_81221EC() != TRUE) { - s8 cursorPos = GetMenuCursorPos(); + s8 cursorPos = Menu_GetCursorPos(); if (gMain.newKeys & DPAD_UP) { if (cursorPos > 0 && sub_81ACDFC(cursorPos - 2)) diff --git a/src/item_menu_icons.c b/src/item_menu_icons.c index 894574ec9..669195b33 100644 --- a/src/item_menu_icons.c +++ b/src/item_menu_icons.c @@ -583,7 +583,7 @@ static void sub_80D5070(u8 berryId) pal.data = gBerryPicTable[berryId].pal; pal.tag = 0x7544; - LoadCompressedObjectPalette(&pal); + LoadCompressedSpritePalette(&pal); LZDecompressWram(gBerryPicTable[berryId].tiles, &gDecompressionBuffer[0x1000]); sub_80D5018(&gDecompressionBuffer[0x1000], &gDecompressionBuffer[0]); } diff --git a/src/link_rfu.c b/src/link_rfu.c index 2c6e22475..5f4beadee 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -2244,7 +2244,7 @@ void sub_800E0E8(void) { if (GetSpriteTileStartByTag(sWirelessStatusIndicatorSpriteSheet.tag) == 0xFFFF) { - LoadCompressedObjectPic(&sWirelessStatusIndicatorSpriteSheet); + LoadCompressedSpriteSheet(&sWirelessStatusIndicatorSpriteSheet); } LoadSpritePalette(&sWirelessStatusIndicatorSpritePalette); gWirelessStatusIndicatorSpriteId = 0xFF; diff --git a/src/list_menu.c b/src/list_menu.c index caf4b798d..2476fae26 100644 --- a/src/list_menu.c +++ b/src/list_menu.c @@ -1074,7 +1074,7 @@ u8 AddScrollIndicatorArrowPair(const struct ScrollArrowsTemplate *arrowInfo, u16 spriteSheet.data = sRedArrowOtherGfx; spriteSheet.size = 0x100; spriteSheet.tag = arrowInfo->tileTag; - LoadCompressedObjectPic(&spriteSheet); + LoadCompressedSpriteSheet(&spriteSheet); if (arrowInfo->palTag == SPRITE_INVALID_TAG) { @@ -1320,7 +1320,7 @@ static u8 ListMenuAddRedOutlineCursorObject(struct CursorStruct *cursor) spriteSheet.data = sSelectorOutlineGfx; spriteSheet.size = 0x100; spriteSheet.tag = cursor->tileTag; - LoadCompressedObjectPic(&spriteSheet); + LoadCompressedSpriteSheet(&spriteSheet); if (cursor->palTag == SPRITE_INVALID_TAG) { @@ -1405,7 +1405,7 @@ static u8 ListMenuAddRedArrowCursorObject(struct CursorStruct *cursor) spriteSheet.data = sRedArrowGfx; spriteSheet.size = 0x80; spriteSheet.tag = cursor->tileTag; - LoadCompressedObjectPic(&spriteSheet); + LoadCompressedSpriteSheet(&spriteSheet); if (cursor->palTag == SPRITE_INVALID_TAG) { diff --git a/src/load_save.c b/src/load_save.c index 8ecf89959..963626428 100644 --- a/src/load_save.c +++ b/src/load_save.c @@ -3,6 +3,7 @@ #include "load_save.h" #include "main.h" #include "pokemon.h" +#include "pokemon_storage_system.h" #include "random.h" #include "alloc.h" #include "item.h" diff --git a/src/main_menu.c b/src/main_menu.c index e11f783eb..4cd5c8e14 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -1394,7 +1394,7 @@ static void Task_NewGameBirchSpeech_ChooseGender(u8 taskId) gTasks[taskId].func = Task_NewGameBirchSpeech_WhatsYourName; break; } - gender2 = GetMenuCursorPos(); + gender2 = Menu_GetCursorPos(); if (gender2 != gTasks[taskId].tPlayerGender) { gTasks[taskId].tPlayerGender = gender2; diff --git a/src/menu.c b/src/menu.c index 61096138a..e0e5eb4eb 100644 --- a/src/menu.c +++ b/src/menu.c @@ -132,7 +132,7 @@ extern void sub_8197BB4(u8, u8, u8, u8, u8, u8); extern void sub_8197E30(u8, u8, u8, u8, u8, u8); extern void DrawWindowBorder(u8, u8, u8, u8, u8, u8); extern void sub_81980A8(u8, u8, u8, u8, u8, u8); -extern u8 MoveMenuCursor(s8); +extern u8 Menu_MoveCursor(s8); extern u8 sub_8199134(s8, s8); extern void sub_8198C78(void); extern void task_free_buf_after_copying_tile_data_to_vram(u8 taskId); @@ -910,7 +910,7 @@ u8 sub_8198348(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numC else gUnknown_0203CD90.cursorPos = pos; - MoveMenuCursor(0); + Menu_MoveCursor(0); return gUnknown_0203CD90.cursorPos; } @@ -935,7 +935,7 @@ void RedrawMenuCursor(u8 oldPos, u8 newPos) AddTextPrinterParameterized(gUnknown_0203CD90.windowId, gUnknown_0203CD90.fontId, gText_SelectorArrow3, gUnknown_0203CD90.left, gUnknown_0203CD90.optionHeight * newPos + gUnknown_0203CD90.top, 0, 0); } -u8 MoveMenuCursor(s8 cursorDelta) +u8 Menu_MoveCursor(s8 cursorDelta) { u8 oldPos = gUnknown_0203CD90.cursorPos; int newPos = gUnknown_0203CD90.cursorPos + cursorDelta; @@ -951,7 +951,7 @@ u8 MoveMenuCursor(s8 cursorDelta) return gUnknown_0203CD90.cursorPos; } -u8 MoveMenuCursorNoWrapAround(s8 cursorDelta) +u8 Menu_MoveCursorNoWrapAround(s8 cursorDelta) { u8 oldPos = gUnknown_0203CD90.cursorPos; int newPos = gUnknown_0203CD90.cursorPos + cursorDelta; @@ -967,7 +967,7 @@ u8 MoveMenuCursorNoWrapAround(s8 cursorDelta) return gUnknown_0203CD90.cursorPos; } -u8 GetMenuCursorPos(void) +u8 Menu_GetCursorPos(void) { return gUnknown_0203CD90.cursorPos; } @@ -987,13 +987,13 @@ s8 Menu_ProcessInput(void) else if (gMain.newKeys & DPAD_UP) { PlaySE(SE_SELECT); - MoveMenuCursor(-1); + Menu_MoveCursor(-1); return MENU_NOTHING_CHOSEN; } else if (gMain.newKeys & DPAD_DOWN) { PlaySE(SE_SELECT); - MoveMenuCursor(1); + Menu_MoveCursor(1); return MENU_NOTHING_CHOSEN; } @@ -1016,13 +1016,13 @@ s8 Menu_ProcessInputNoWrap(void) } else if (gMain.newKeys & DPAD_UP) { - if (oldPos != MoveMenuCursorNoWrapAround(-1)) + if (oldPos != Menu_MoveCursorNoWrapAround(-1)) PlaySE(SE_SELECT); return MENU_NOTHING_CHOSEN; } else if (gMain.newKeys & DPAD_DOWN) { - if (oldPos != MoveMenuCursorNoWrapAround(1)) + if (oldPos != Menu_MoveCursorNoWrapAround(1)) PlaySE(SE_SELECT); return MENU_NOTHING_CHOSEN; } @@ -1045,13 +1045,13 @@ s8 ProcessMenuInput_other(void) else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP) { PlaySE(SE_SELECT); - MoveMenuCursor(-1); + Menu_MoveCursor(-1); return MENU_NOTHING_CHOSEN; } else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN) { PlaySE(SE_SELECT); - MoveMenuCursor(1); + Menu_MoveCursor(1); return MENU_NOTHING_CHOSEN; } @@ -1074,13 +1074,13 @@ s8 Menu_ProcessInputNoWrapAround_other(void) } else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP) { - if (oldPos != MoveMenuCursorNoWrapAround(-1)) + if (oldPos != Menu_MoveCursorNoWrapAround(-1)) PlaySE(SE_SELECT); return MENU_NOTHING_CHOSEN; } else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN) { - if (oldPos != MoveMenuCursorNoWrapAround(1)) + if (oldPos != Menu_MoveCursorNoWrapAround(1)) PlaySE(SE_SELECT); return MENU_NOTHING_CHOSEN; } @@ -1588,7 +1588,7 @@ u8 InitMenuInUpperLeftCorner(u8 windowId, u8 itemCount, u8 initialCursorPos, boo else gUnknown_0203CD90.cursorPos = pos; - return MoveMenuCursor(0); + return Menu_MoveCursor(0); } u8 InitMenuInUpperLeftCornerPlaySoundWhenAPressed(u8 windowId, u8 itemCount, u8 initialCursorPos) @@ -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/menu_helpers.c b/src/menu_helpers.c index a3c0be36a..0adc6228e 100644 --- a/src/menu_helpers.c +++ b/src/menu_helpers.c @@ -394,8 +394,8 @@ void sub_8122298(u16 *arg0, u16 *arg1, u8 arg2, u8 arg3, u8 arg4) void LoadListMenuArrowsGfx(void) { - LoadCompressedObjectPic(&gUnknown_0859F514); - LoadCompressedObjectPalette(&gUnknown_0859F51C); + LoadCompressedSpriteSheet(&gUnknown_0859F514); + LoadCompressedSpritePalette(&gUnknown_0859F51C); } void sub_8122344(u8 *spriteIds, u8 count) diff --git a/src/mon_markings.c b/src/mon_markings.c index 30015dbef..48f0f5ecb 100644 --- a/src/mon_markings.c +++ b/src/mon_markings.c @@ -390,7 +390,6 @@ void sub_811FAF8(void) } } - bool8 sub_811FBA4(void) { u16 i; diff --git a/src/money.c b/src/money.c index a347f818d..faf830637 100644 --- a/src/money.c +++ b/src/money.c @@ -186,8 +186,8 @@ void HideMoneyBox(void) void AddMoneyLabelObject(u16 x, u16 y) { - LoadCompressedObjectPic(&sSpriteSheet_MoneyLabel); - LoadCompressedObjectPalette(&sSpritePalette_MoneyLabel); + LoadCompressedSpriteSheet(&sSpriteSheet_MoneyLabel); + LoadCompressedSpritePalette(&sSpritePalette_MoneyLabel); sMoneyLabelSpriteId = CreateSprite(&sSpriteTemplate_MoneyLabel, x, y, 0); } diff --git a/src/overworld.c b/src/overworld.c index 6998c9d98..27bd0425a 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -1340,7 +1340,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/party_menu.c b/src/party_menu.c index 4edfe04c5..3a0878c4f 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -2706,7 +2706,7 @@ void sub_81B3730(u8 taskId) input = Menu_ProcessInputNoWrapAround_other(); else input = ProcessMenuInput_other(); - data[0] = GetMenuCursorPos(); + data[0] = Menu_GetCursorPos(); if (input != MENU_NOTHING_CHOSEN) { if (input == MENU_B_PRESSED) @@ -3599,7 +3599,7 @@ void sub_81B5430(u8 taskId) void sub_81B5470(u8 taskId) { - u8 fieldMove = gUnknown_0203CEC4->unkF[GetMenuCursorPos()] - 19; + u8 fieldMove = gUnknown_0203CEC4->unkF[Menu_GetCursorPos()] - 19; const struct MapHeader *mapHeader; PlaySE(SE_SELECT); @@ -4063,9 +4063,9 @@ void sub_81B5FBC(u8 spriteId, u8 spriteId2, u8 a) void LoadPartyMenuPokeballGfx(void) { - LoadCompressedObjectPic(&gUnknown_08615EF8); - LoadCompressedObjectPic(&gUnknown_08615F70); - LoadCompressedObjectPalette(&gUnknown_08615F00); + LoadCompressedSpriteSheet(&gUnknown_08615EF8); + LoadCompressedSpriteSheet(&gUnknown_08615F70); + LoadCompressedSpritePalette(&gUnknown_08615F00); } void party_menu_status_condition_object(struct Pokemon *mon, struct Struct203CEDC *ptr) @@ -4109,8 +4109,8 @@ void party_menu_update_status_condition_object(u8 status, struct Struct203CEDC * void LoadPartyMenuAilmentGfx(void) { - LoadCompressedObjectPic(&gUnknown_08615FF8); - LoadCompressedObjectPalette(&gUnknown_08616000); + LoadCompressedSpriteSheet(&gUnknown_08615FF8); + LoadCompressedSpritePalette(&gUnknown_08616000); } void sub_81B617C(void) @@ -4509,7 +4509,7 @@ void dp05_ether(u8 taskId, TaskFunc unused) void ether_effect_related_2(u8 taskId) { sub_81B302C(&gUnknown_0203CEC4->unkC[0]); - gUnknown_0203CEC8.unkE = GetMenuCursorPos(); + gUnknown_0203CEC8.unkE = Menu_GetCursorPos(); ether_effect_related(taskId); } @@ -6341,7 +6341,7 @@ void sub_81B9918(void) } } } - if (sub_80D23A8(move) != TRUE) + if (AnyStorageMonWithMove(move) != TRUE) gSpecialVar_Result = TRUE; } } diff --git a/src/player_pc.c b/src/player_pc.c index c41dfa380..b7380cee3 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -461,9 +461,9 @@ static void ItemStorageMenuProcessInput(u8 taskId) s8 r2; s8 inputOptionId; - r5 = GetMenuCursorPos(); + r5 = Menu_GetCursorPos(); inputOptionId = Menu_ProcessInput(); - r2 = GetMenuCursorPos(); + r2 = Menu_GetCursorPos(); switch(inputOptionId) { case -2: diff --git a/src/pokeball.c b/src/pokeball.c index aa29b020f..baa165649 100644 --- a/src/pokeball.c +++ b/src/pokeball.c @@ -999,8 +999,8 @@ void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 battlerId, u8 x, u8 y, { u8 spriteId; - LoadCompressedObjectPicUsingHeap(&gBallSpriteSheets[0]); - LoadCompressedObjectPaletteUsingHeap(&gBallSpritePalettes[0]); + LoadCompressedSpriteSheetUsingHeap(&gBallSpriteSheets[0]); + LoadCompressedSpritePaletteUsingHeap(&gBallSpritePalettes[0]); spriteId = CreateSprite(&gBallSpriteTemplates[0], x, y, subpriortiy); gSprites[spriteId].data[0] = monSpriteId; @@ -1101,8 +1101,8 @@ u8 sub_807671C(u8 a, u8 b, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 g, u32 { u8 spriteId; - LoadCompressedObjectPicUsingHeap(&gBallSpriteSheets[0]); - LoadCompressedObjectPaletteUsingHeap(&gBallSpritePalettes[0]); + LoadCompressedSpriteSheetUsingHeap(&gBallSpriteSheets[0]); + LoadCompressedSpritePaletteUsingHeap(&gBallSpritePalettes[0]); spriteId = CreateSprite(&gBallSpriteTemplates[0], x, y, subPriority); gSprites[spriteId].data[0] = a; gSprites[spriteId].data[1] = g; @@ -1245,8 +1245,8 @@ void LoadBallGfx(u8 ballId) if (GetSpriteTileStartByTag(gBallSpriteSheets[ballId].tag) == 0xFFFF) { - LoadCompressedObjectPicUsingHeap(&gBallSpriteSheets[ballId]); - LoadCompressedObjectPaletteUsingHeap(&gBallSpritePalettes[ballId]); + LoadCompressedSpriteSheetUsingHeap(&gBallSpriteSheets[ballId]); + LoadCompressedSpritePaletteUsingHeap(&gBallSpritePalettes[ballId]); } switch (ballId) { diff --git a/src/pokeblock.c b/src/pokeblock.c index 1418588b8..67f185ff6 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -640,11 +640,11 @@ static bool8 LoadPokeblockMenuGfx(void) sPokeblockMenu->gfxState++; break; case 3: - LoadCompressedObjectPic(&gPokeblockCase_SpriteSheet); + LoadCompressedSpriteSheet(&gPokeblockCase_SpriteSheet); sPokeblockMenu->gfxState++; break; case 4: - LoadCompressedObjectPalette(&gPokeblockCase_SpritePal); + LoadCompressedSpritePalette(&gPokeblockCase_SpritePal); sPokeblockMenu->gfxState++; break; case 5: diff --git a/src/pokeblock_feed.c b/src/pokeblock_feed.c index 2271d7adf..b1f182b66 100644 --- a/src/pokeblock_feed.c +++ b/src/pokeblock_feed.c @@ -656,25 +656,25 @@ static bool8 LoadMonAndSceneGfx(struct Pokemon *mon) trainerId = GetMonData(mon, MON_DATA_OT_ID); palette = GetMonSpritePalStructFromOtIdPersonality(species, trainerId, personality); - LoadCompressedObjectPalette(palette); + LoadCompressedSpritePalette(palette); SetMultiuseSpriteTemplateToPokemon(palette->tag, 1); sPokeblockFeed->loadGfxState++; break; case 2: - LoadCompressedObjectPic(&gPokeblockCase_SpriteSheet); + LoadCompressedSpriteSheet(&gPokeblockCase_SpriteSheet); sPokeblockFeed->loadGfxState++; break; case 3: - LoadCompressedObjectPalette(&gPokeblockCase_SpritePal); + LoadCompressedSpritePalette(&gPokeblockCase_SpritePal); sPokeblockFeed->loadGfxState++; break; case 4: - LoadCompressedObjectPic(&sPokeblock_SpriteSheet); + LoadCompressedSpriteSheet(&sPokeblock_SpriteSheet); sPokeblockFeed->loadGfxState++; break; case 5: SetPokeblockSpritePal(gSpecialVar_ItemId); - LoadCompressedObjectPalette(&sPokeblockSpritePal); + LoadCompressedSpritePalette(&sPokeblockSpritePal); sPokeblockFeed->loadGfxState++; break; case 6: diff --git a/src/pokedex.c b/src/pokedex.c index ef8905bb6..755a46821 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -1803,7 +1803,7 @@ bool8 sub_80BC514(u8 a) ResetSpriteData(); FreeAllSpritePalettes(); gReservedSpritePaletteCount = 8; - LoadCompressedObjectPic(&sInterfaceSpriteSheet[0]); + LoadCompressedSpriteSheet(&sInterfaceSpriteSheet[0]); LoadSpritePalettes(sInterfaceSpritePalette); CreateInterfaceSprites(a); gMain.state++; @@ -4815,7 +4815,7 @@ void sub_80C12E0(u8 taskId) } break; case 1: - LoadCompressedObjectPic(sInterfaceSpriteSheet); + LoadCompressedSpriteSheet(sInterfaceSpriteSheet); LoadSpritePalettes(sInterfaceSpritePalette); sub_80C2594(taskId); for (i = 0; i < 16; i++) diff --git a/src/pokemon.c b/src/pokemon.c index 640d70776..6700ef553 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -4091,13 +4091,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: @@ -4298,7 +4298,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 @@ -4460,13 +4460,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: @@ -4722,7 +4722,7 @@ u8 SendMonToPC(struct Pokemon* mon) do { - for (boxPos = 0; boxPos < 30; boxPos++) + for (boxPos = 0; boxPos < IN_BOX_COUNT; boxPos++) { struct BoxPokemon* checkingMon = GetBoxedMonPtr(boxNo, boxPos); if (GetBoxMonData(checkingMon, MON_DATA_SPECIES, NULL) == SPECIES_NONE) @@ -4739,7 +4739,7 @@ u8 SendMonToPC(struct Pokemon* mon) } boxNo++; - if (boxNo == 14) + if (boxNo == TOTAL_BOXES_COUNT) boxNo = 0; } while (boxNo != StorageGetCurrentBox()); @@ -4889,9 +4889,9 @@ bool8 IsPokemonStorageFull(void) { s32 i, j; - for (i = 0; i < 14; i++) - for (j = 0; j < 30; j++) - if (GetBoxMonDataFromAnyBox(i, j, MON_DATA_SPECIES) == SPECIES_NONE) + for (i = 0; i < TOTAL_BOXES_COUNT; i++) + for (j = 0; j < IN_BOX_COUNT; j++) + if (GetBoxMonDataAt(i, j, MON_DATA_SPECIES) == SPECIES_NONE) return FALSE; return TRUE; @@ -6847,7 +6847,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..36a7da0ee 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)) - species = 260; - return mon_icon_convert_unown_species_id(species, 0); + if (species > (SPECIES_UNOWN_B - 1)) + species = SPECIES_OLD_UNOWN_J; // That's an oddly specific species. + 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); @@ -1220,7 +1219,7 @@ void sub_80D304C(u16 offset) } } -u8 sub_80D3080(u16 species) +u8 GetValidMonIconPalIndex(u16 species) { if (species > SPECIES_EGG) species = 260; 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 ad56b1678..a988e4104 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -1,55 +1,728 @@ #include "global.h" +#include "alloc.h" #include "bg.h" +#include "data2.h" +#include "decompress.h" +#include "dma3.h" +#include "dynamic_placeholder_text_util.h" #include "event_data.h" #include "field_screen_effect.h" #include "field_weather.h" #include "gpu_regs.h" +#include "graphics.h" #include "international_string_util.h" +#include "item.h" +#include "item_icon.h" +#include "item_menu.h" +#include "mail.h" #include "main.h" #include "menu.h" +#include "mon_markings.h" +#include "naming_screen.h" #include "overworld.h" #include "palette.h" +#include "pc_screen_effect.h" #include "pokemon.h" +#include "pokemon_icon.h" +#include "pokemon_summary_screen.h" #include "pokemon_storage_system.h" #include "script.h" #include "sound.h" #include "string_util.h" #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" -IWRAM_DATA u8 gUnknown_03000F78[0x188]; +struct WallpaperTable +{ + const u32 *tiles; + const u32 *tileMap; + const u16 *palettes; +}; -extern const u8 gText_PartyFull[]; -extern const u8 gText_Box[]; -extern const u8 gText_JustOnePkmn[]; +struct PokemonStorageSystemFunc +{ + u8 (*func)(void); + s8 unk4; +}; -extern u8 gUnknown_02039D00; +struct StorageAction +{ + const u8 *text; + u8 format; +}; + +struct StorageMenu +{ + const u8 *text; + int textId; +}; + +struct PSS_MenuStringPtrs +{ + const u8 *text; + const u8 *desc; +}; + +struct UnkStruct_2000028 +{ + const u8 *unk_00; + u8 *unk_04; + u16 unk_08; + u16 unk_0a; + u16 newField; + void (*unk_0c)(struct UnkStruct_2000028 *data); +}; + +struct UnkStruct_2000020 +{ + struct UnkStruct_2000028 *unk_00; + u8 unk_04; + u8 unk_05; +}; + +struct UnkPSSStruct_2002370 +{ + struct Sprite *unk_0000; + struct Sprite *unk_0004[4]; + u32 unk_0014[3]; + struct Sprite *unk_0020[2]; + u8 filler_0028[0x214]; + u32 unk_023c; + u16 unk_0240; + u16 unk_0242; + u8 curBox; + u8 unk_0245; + u8 unk_0246; +}; + +struct UnkStorageStruct +{ + struct Sprite *sprite; + u8 *tiles; + u16 palIndex; + u8 unk8; + u8 unk9; + u8 unk10; +}; + +struct PokemonStorageSystemData +{ + u8 state; + u8 boxOption; + u8 screenChangeType; + bool8 isReshowingPSS; + u8 taskId; + struct UnkStruct_2000020 unk_0020; + struct UnkStruct_2000028 unk_0028[8]; + u16 field_B0[528 / 2]; + u16 field_2C0; + u16 field_2C2; + u8 field_2C4; + u8 field_2C5; + u8 showPartyMenuState; + u8 unk_02C7; + u8 unk_02C8; + bool8 unk_02C9; + s16 newCurrBoxId; + u16 bg2_X; + s16 field_2CE; + u16 field_2D0; + u8 field_2D2; + u8 field_2D3; + u8 field_2D4; + u16 field_2D6; + s16 field_2D8; + u16 field_2DA; + u16 field_2DC; + u16 field_2DE; + u16 field_2E0; + u8 filler[22]; + 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; + u16 field_792[360]; + u8 wallpaperChangeState; + u8 field_A63; + u8 field_A64; + s8 field_A65; + u8 *wallpaperTiles; + struct Sprite *movingMonSprite; + struct Sprite *partySprites[PARTY_SIZE]; + struct Sprite *boxMonsSprites[IN_BOX_COUNT]; + struct Sprite **field_B00; + struct Sprite **field_B04; + u16 field_B08[40]; + u16 field_B58[40]; + u16 boxSpecies[IN_BOX_COUNT]; + u32 boxPersonalities[IN_BOX_COUNT]; + u8 field_C5C; + u8 field_C5D; + u8 field_C5E; + u16 field_C60; + s16 field_C62; + s16 field_C64; + u16 field_C66; + u8 field_C68; + s8 field_C69; + u8 field_C6A; + u8 field_C6B; + struct WindowTemplate menuWindow; + struct StorageMenu menuItems[7]; + u8 menuItemsCount; + u8 menuWidth; + u8 field_CAE; + u16 field_CB0; + 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[2]; + const u32 *cursorMonPalette; + u32 cursorMonPersonality; + u16 cursorMonSpecies; + u16 cursorMonItem; + u16 field_CE8; + bool8 setMosaic; + u8 cursorMonMarkings; + u8 cursorMonLevel; + bool8 cursorMonIsEgg; + u8 cursorMonNick[POKEMON_NAME_LENGTH + 1]; + u8 cursorMonNickText[36]; + u8 cursorMonSpeciesName[36]; + u8 cursorMonGenderLvlText[36]; + 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; + struct Pokemon movingMon; + 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[8]; + u8 field_2186; + u8 field_2187; + u8 field_2188; + union + { + struct Pokemon *mon; + struct BoxPokemon *box; + } field_218C; + u8 field_2190[40]; + u8 field_21B8[40]; + u8 field_21E0[POKEMON_NAME_LENGTH + 1]; + u8 itemName[20]; + u8 inBoxMovingMode; + u16 field_2200; + struct UnkStorageStruct field_2204[3]; + u16 movingItem; + u16 field_2236; + u8 field_2238; + u16 field_223A; + u16 *field_223C; + struct Sprite *cursorMonSprite; + u16 field_2244[0x40]; + u8 field_22C4[0x800]; + u8 field_2AC4[0x1800]; + u8 field_42C4[0x800]; + u8 field_4AC4[0x1000]; + u8 field_5AC4[0x800]; +}; + +struct UnkSubStruct_2039D84 +{ + s16 field_0; + s16 field_2; + u16 field_4; + u16 field_6; + s16 field_8; + s16 field_A; +}; + +struct UnkStruct_2039D84 +{ + struct UnkSubStruct_2039D84 field_0[2]; + const void *field_18; + const void *field_1C; + u16 field_20; + u16 field_22; + u16 field_24; + u16 field_26; + u16 field_28; + u8 field_2A; + u8 field_2B; + u8 field_2C; + u8 field_2D; +}; + +enum +{ + BOX_OPTION_WITHDRAW, + BOX_OPTION_DEPOSIT, + BOX_OPTION_MOVE_MONS, + BOX_OPTION_MOVE_ITEMS, + BOX_OPTION_EXIT, +}; + +enum +{ + PC_TEXT_EXIT_BOX, + PC_TEXT_WHAT_YOU_DO, + PC_TEXT_PICK_A_THEME, + PC_TEXT_PICK_A_WALLPAPER, + PC_TEXT_IS_SELECTED, + PC_TEXT_JUMP_TO_WHICH_BOX, + PC_TEXT_DEPOSIT_IN_WHICH_BOX, + PC_TEXT_WAS_DEPOSITED, + PC_TEXT_BOX_IS_FULL, + PC_TEXT_RELEASE_POKE, + PC_TEXT_WAS_RELEASED, + PC_TEXT_BYE_BYE, + PC_TEXT_MARK_POKE, + PC_TEXT_LAST_POKE, + PC_TEXT_PARTY_FULL, + PC_TEXT_HOLDING_POKE, + PC_TEXT_WHICH_ONE_WILL_TAKE, + PC_TEXT_CANT_RELEASE_EGG, + PC_TEXT_CONTINUE_BOX, + PC_TEXT_CAME_BACK, + PC_TEXT_WORRIED, + PC_TEXT_SURPRISE, + PC_TEXT_PLEASE_REMOVE_MAIL, + PC_TEXT_IS_SELECTED2, + PC_TEXT_GIVE_TO_MON, + PC_TEXT_PLACED_IN_BAG, + PC_TEXT_BAG_FULL, + PC_TEXT_PUT_IN_BAG, + PC_TEXT_ITEM_IS_HELD, + PC_TEXT_CHANGED_TO_ITEM, + PC_TEXT_CANT_STORE_MAIL, +}; + +enum +{ + PC_TEXT_FMT_NORMAL, + PC_TEXT_FMT_MON_NAME_1, + PC_TEXT_FMT_MON_NAME_2, + PC_TEXT_FMT_MON_NAME_3, + PC_TEXT_FMT_MON_NAME_4, + PC_TEXT_FMT_MON_NAME_5, + PC_TEXT_FMT_MON_NAME_6, + PC_TEXT_FMT_ITEM_NAME, +}; + +enum +{ + SCREEN_CHANGE_EXIT_BOX, + SCREEN_CHANGE_SUMMARY_SCREEN, + SCREEN_CHANGE_NAME_BOX, + 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. + WALLPAPER_COUNT +}; + +enum +{ + FRIENDS_ZIGZAGOON, + FRIENDS_SCREEN, + FRIENDS_HORIZONTAL, + FRIENDS_DIAGONAL, + FRIENDS_BLOCK, + FRIENDS_RIBBON, + FRIENDS_POKECENTER2, + FRIENDS_FRAME, + FRIENDS_BLANK, + FRIENDS_CIRCLES, + FRIENDS_AZUMARILL, + FRIENDS_PIKACHU, + FRIENDS_LEGENDARY, + FRIENDS_DUSCLOPS, + FRIENDS_LUDICOLO, + FRIENDS_WHISCASH, + FRIENDS_WALLPAPERS_COUNT +}; + +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_PAL_DAC0 0xDAC0 +#define TAG_PAL_DACB 0xDACB + +#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 +#define TAG_TILE_12 0x12 +#define TAG_TILE_7 0x7 +#define TAG_TILE_0 0x0 +#define TAG_TILE_1 0x1 + +// IWRAM bss +IWRAM_DATA static u32 gUnknown_03000F78[98]; + +// EWRAM DATA +EWRAM_DATA static u8 sPreviousBoxOption = 0; +EWRAM_DATA static struct UnkPSSStruct_2002370 *gUnknown_02039D04 = NULL; +EWRAM_DATA static struct PokemonStorageSystemData *sPSSData = NULL; +EWRAM_DATA static bool8 sInPartyMenu = 0; +EWRAM_DATA static u8 sCurrentBoxOption = 0; +EWRAM_DATA static u8 gUnknown_02039D0E = 0; +EWRAM_DATA static u8 sWhichToReshow = 0; +EWRAM_DATA static u8 gUnknown_02039D10 = 0; +EWRAM_DATA static u16 gUnknown_02039D12 = 0; +EWRAM_DATA static struct Pokemon gUnknown_02039D14 = {0}; +EWRAM_DATA static s8 sBoxCursorArea = 0; +EWRAM_DATA static s8 sBoxCursorPosition = 0; +EWRAM_DATA static bool8 sIsMonBeingMoved = 0; +EWRAM_DATA static u8 sMovingMonOrigBoxId = 0; +EWRAM_DATA static u8 sMovingMonOrigBoxPos = 0; +EWRAM_DATA static bool8 sCanOnlyMove = 0; + +extern void sub_80F9BCC(u16, u16, u8); +extern void sub_80F9BF4(u16, u16, u8); +extern bool8 sub_80F9C1C(void); +extern bool8 sub_80F9C30(void); +extern void sub_80C6D80(u8 *arg0, void *arg1, u8 arg2, u8 arg3, s32 arg4); + +extern const struct CompressedSpriteSheet gMonFrontPicTable[]; // This file's functions. -void StorageSystemCreatePrimaryMenu(u8 whichMenu, s16 *windowIdPtr); -void sub_80C7D74(u8); -u8 sub_80CAEA0(void); -void SetBoxWallpaper(u8 boxId, u8 wallpaperId); -void SetCurrentBox(u8 boxId); -void ClearMonInBox(u8 boxId, u8 boxPos); -void ResetWaldaWallpaper(void); -void sub_80C7958(u8 curBox); -void sub_80C7B14(void); -void sub_80C7BB4(void); -void sub_80CA028(void); -void sub_80C7B80(void); -void sub_80D2AA4(void); -void sub_80C7BE4(void); -void sub_80CAA14(void); -void sub_80C7CF4(struct Sprite *sprite); -struct Sprite *sub_80CD2E8(u16 x, u16 y, u8 animId, u8 priority, u8 subpriority); +static void CreatePCMenu(u8 whichMenu, s16 *windowIdPtr); +static void Cb2_EnterPSS(u8 boxOption); +static u8 GetCurrentBoxOption(void); +static u8 HandleInput(void); +static u8 sub_80CDC2C(void); +static u8 sub_80CB9BC(void); +static void LoadWallpaperGfx(u8 boxId, s8 direction); +static void sub_80CCCFC(u8 boxId, s8 direction); +static void sub_80CD0B8(s8 direction); +static void SetCurrentBox(u8 boxId); +static void sub_80CC32C(u8 boxId); +static void sub_80C7958(u8 curBox); +static void sub_80CCAE0(void *arg0); +static void sub_80C7B14(void); +static void sub_80C7BB4(void); +static void ScrollBackground(void); +static void sub_80C7B80(void); +static void sub_80C7BE4(void); +static void sub_80CAA14(void); +static void sub_80CFDC4(void); +static void sub_80CE790(void); +static void sub_80CE8E4(void); +static void GiveChosenBagItem(void); +static void SetUpHidePartyMenu(void); +static void DestroyAllPartyMonIcons(void); +static void sub_80D11CC(void); +static void LoadPSSMenuGfx(void); +static void LoadWaveformSpritePalette(void); +static void sub_80CDC18(void); +static void sub_80CD36C(void); +static void sub_80CD3EC(void); +static void sub_80CAC1C(void); +static void sub_80CEBDC(void); +static void SetScrollingBackground(void); +static void sub_80CABE0(void); +static void sub_80CAEAC(void); +static void sub_80D0C60(void); +static void sub_80CFEA8(void); +static void sub_80CDC0C(void); +static void sub_80CAF04(void); +static void sub_80CA0D8(void); +static void AddMenu(void); +static void sub_80CE250(void); +static void InitCanRelaseMonVars(void); +static void sub_80D01B8(void); +static void ReleaseMon(void); +static void RefreshCursorMonData(void); +static void LoadCursorMonSprite(void); +static void sub_80CA154(void); +static void sub_80CA1C4(void); +static void sub_80CC064(void); +static void sub_80CE324(void); +static void ClearBottomWindow(void); +static void sub_80CA704(void); +static void sub_80D013C(void); +static void sub_80CE00C(void); +static void sub_80D1194(void); +static void PrintCursorMonInfo(void); +static void sub_80CA65C(void); +static void AddWallpaperSetsMenu(void); +static void sub_80CD02C(void); +static void InitMenu(void); +static void sub_80CD158(void); +static void sub_80CFC14(void); +static void sub_80CEB40(void); +static void sub_80CCEE0(void); +static void sub_80D1818(void); +static void sub_80D19B4(u32 arg0); +static void sub_80CAA74(void); +static void PrintItemDescription(void); +static void sub_80CE760(void); +static void sub_80CDBA0(void); +static void sub_80CE7E8(void); +static void sub_80CFECC(void); +static void sub_80CA9EC(void); +static void FreePSSData(void); +static void AddBoxMenu(void); +static void sub_80CCF9C(void); +static void MoveMon(void); +static void PlaceMon(void); +static void sub_80CAB20(void); +static void sub_80CE22C(void); +static void sub_80CDA68(void); +static void sub_80CB950(void); +static void sub_80CA9C0(void); +static void SetUpDoShowPartyMenu(void); +static void BoxSetMosaic(void); +static void sub_80C7CF4(struct Sprite *sprite); +static void sub_80CC100(struct Sprite *sprite); +static void sub_80CB278(struct Sprite *sprite); +static void sub_80CD210(struct Sprite *sprite); +static bool32 WaitForWallpaperGfxLoad(void); +static bool8 InitPSSWindows(void); +static bool8 sub_80CC0A0(void); +static bool8 sub_80CE2A8(void); +static bool8 sub_80D0164(void); +static bool8 sub_80CC35C(void); +static bool8 sub_80D01E4(void); +static bool8 sub_80CDED4(void); +static bool8 sub_80CDF08(void); +static bool8 sub_80D184C(void); +static bool8 sub_80D18E4(void); +static bool8 DoShowPartyMenu(void); +static bool8 sub_80D1218(void); +static bool8 ScrollToBox(void); +static bool8 sub_80CD554(void); +static bool8 HidePartyMenu(void); +static bool8 IsActiveItemMoving(void); +static bool8 sub_80D0580(u8 arg0); +static bool8 sub_80D0BC0(void); +static bool8 sub_80CA2B8(void); +static bool8 DoWallpaperGfxChange(void); +static bool8 DoMonPlaceChange(void); +static bool8 sub_80D00A8(void); +static bool8 CanMovePartyMon(void); +static bool8 CanShiftMon(void); +static bool8 IsCursorOnCloseBox(void); +static bool8 IsCursorOnBox(void); +static bool8 IsCursorInBox(void); +static bool8 IsMonBeingMoved(void); +static bool8 TryStorePartyMonInBox(u8 boxId); +static void Cb_InitPSS(u8 taskId); +static void Cb_PlaceMon(u8 taskId); +static void Cb_ChangeScreen(u8 taskId); +static void Cb_ShowPSS(u8 taskId); +static void Cb_OnBPressed(u8 taskId); +static void Cb_HandleBoxOptions(u8 taskId); +static void Cb_OnSelectedMon(u8 taskId); +static void Cb_OnCloseBoxPressed(u8 taskId); +static void Cb_HidePartyPokemon(u8 taskId); +static void Cb_DepositMenu(u8 taskId); +static void Cb_MoveMon(u8 taskId); +static void Cb_GiveMovingItemToMon(u8 taskId); +static void Cb_SwitchSelectedItem(u8 taskId); +static void Cb_TakeItemForMoving(u8 taskId); +static void Cb_WithdrawMon(u8 taskId); +static void Cb_ShiftMon(u8 taskId); +static void Cb_ShowPartyPokemon(u8 taskId); +static void Cb_ShowItemInfo(u8 taskId); +static void Cb_GiveItemFromBag(u8 taskId); +static void Cb_ItemToBag(u8 taskId); +static void Cb_TakeItemForMoving(u8 taskId); +static void Cb_ShowMarkMenu(u8 taskId); +static void Cb_ShowMonSummary(u8 taskId); +static void Cb_ReleaseMon(u8 taskId); +static void Cb_ReshowPSS(u8 taskId); +static void Cb_MainPSS(u8 taskId); +static void Cb_JumpBox(u8 taskId); +static void Cb_HandleWallpapers(u8 taskId); +static void Cb_NameBox(u8 taskId); +static void Cb_PrintCantStoreMail(u8 taskId); +static void Cb_HandleMovingMonFromParty(u8 taskId); +static void SetUpScrollToBox(u8 boxId); +static void sub_80CFE54(u8 animNum); +static void SetMovingMonPriority(u8 priority); +static void InitMonPlaceChange(u8 arg0); +static void SetMonMarkings(u8 markings); +static void ShowYesNoWindow(s8 cursorPos); +static void sub_80CDBF8(u8 cursorBoxPosition); +static void sub_80D01D0(u8 arg0); +static void sub_80CD1A8(bool8 arg0); +static void sub_80CA984(bool8 arg0); +static void CreatePartyMonsSprites(bool8 arg0); +static void PrintStorageActionText(u8 id); +static s16 sub_80D00AC(void); +static s8 RunCanReleaseMon(void); +static u8 GetBoxCursorPosition(void); +static void Item_FromMonToMoving(u8 cursorArea, u8 cursorPos); +static void Item_GiveMovingToMon(u8 cursorArea, u8 cursorPos); +static void Item_TakeMons(u8 cursorArea, u8 cursorPos); +static void Item_SwitchMonsWithMoving(u8 cursorArea, u8 cursorPos); +static struct Sprite *sub_80CD2E8(u16 x, u16 y, u8 animId, u8 priority, u8 subpriority); +static void SetWallpaperForCurrentBox(u8 wallpaperId); +static void AddWallpapersMenu(u8 wallpaperSet); +static u16 GetMovingItem(void); +static void LoadCursorMonGfx(u16 species, u32 pid); +static void sub_80CA2D0(struct Sprite *sprite); +static void sub_80CCF64(struct Sprite *sprite); +static void sub_80CBA3C(struct Sprite *sprite); +static void sub_80CCF30(struct Sprite *sprite); +static void sub_80CBAF0(s16 yDelta); +static void sub_80CAAA8(u8 arg0, bool8 isPartyMon); +static const u8 *GetMovingItemName(void); +static void SetMenuText(u8 textId); +static void sub_80D0D8C(u8 cursorArea, u8 cursorPos); +static void sub_80D0E50(u8 cursorArea, u8 cursorPos); +static void sub_80D0F38(u16 item); +static struct Sprite *CreateMonIconSprite(u16 species, u32 personality, s16 x, s16 y, u8 oamPriority, u8 subpriority); +static void DestroyBoxMonIcon(struct Sprite *sprite); +static void SetBoxSpeciesAndPersonalities(u8 boxId); +static void sub_80CB9D0(struct Sprite *sprite, u16 partyId); +static void sub_80CC370(u8 taskId); +static void sub_80CCB50(u8 boxId); +static s8 sub_80CC644(u8 boxId); +static void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2); +static s16 sub_80CD00C(const u8 *string); +static bool8 MonPlaceChange_Shift(void); +static bool8 MonPlaceChange_Move(void); +static bool8 MonPlaceChange_Place(void); +static bool8 sub_80CDEC4(void); +static bool8 sub_80CDEB4(void); +static void sub_80CD444(u8 cursorArea, u8 cursorPosition, u16 *x, u16 *y); +static void SetShiftedMonData(u8 boxId, u8 position); +static void SetMovedMonData(u8 boxId, u8 position); +static void SetPlacedMonData(u8 boxId, u8 position); +static void PurgeMonOrBoxMon(u8 boxId, u8 position); +static void SetCursorMonData(void *pokemon, u8 mode); +static bool32 AtLeastThreeUsableMons(void); +static u8 InBoxInput_Normal(void); +static u8 InBoxInput_MovingMultiple(void); +static u8 InBoxInput_GrabbingMultiple(void); +static s8 sub_80CFF98(u8 arg0); +static u8 sub_80CFA5C(void); +static u8 sub_80D0BA4(void); +static bool8 sub_80CFA84(void); +static bool8 sub_80CFB44(void); +static bool8 sub_80D024C(void); +static bool8 sub_80D0344(void); +static bool8 sub_80D03B0(void); +static bool8 sub_80D0420(void); +static bool8 sub_80D04A0(void); +static bool8 sub_80D04C8(void); +static void sub_80D07B0(u8 arg0, u8 arg1); +static void sub_80D0834(u8 arg0, u8 arg1); +static void sub_80D0B5C(void); +static void sub_80D062C(void); +static void sub_80D0884(u16 arg0, u16 arg1, u16 arg2); +static void sub_80D08CC(void); +static void sub_80D09A4(void); +static void sub_80D0A1C(void); +static void sub_80D0AAC(void); +static u8 sub_80D0894(void); +static void sub_80D0778(u8 arg0, u8 arg1, u8 arg2); +static void sub_80D0708(u8 arg0, u8 arg1, u8 arg2); +static void sub_80D06D0(u8 arg0, u8 arg1, u8 arg2); +static void sub_80D0740(u8 arg0, u8 arg1, u8 arg2); +static void sub_80D27AC(u8 id, u16 arg1, u16 arg2, u16 arg3, u16 arg4); +static void sub_80D27F4(u8 id, u8 arg1, s8 arg2); +static void sub_80D2644(u8 id, u8 bg, const void *arg2, u16 arg3, u16 arg4); +static void sub_80D2770(u8 id, u16 arg1, u16 arg2); +static void sub_80D259C(u8 count); +static void sub_80D25F0(void); +static void sub_80D2918(u8 id); +static void sub_80D2960(u8 id); +static void sub_80D29F8(u8 id); +static void sub_80D2A90(struct UnkStruct_2000020 *arg0, struct UnkStruct_2000028 *arg1, u32 arg2); +static void sub_80D2AA4(void); +static void sub_80D2B88(struct UnkStruct_2000028 *unkStruct); +static void sub_80D2C1C(struct UnkStruct_2000028 *unkStruct); -// const rom data -const struct PSS_MenuStringPtrs gUnknown_085716C0[] = +// static const rom data +static const struct PSS_MenuStringPtrs gUnknown_085716C0[] = { {gText_WithdrawPokemon, gText_WithdrawMonDescription}, {gText_DepositPokemon, gText_DepositMonDescription}, @@ -58,7 +731,16 @@ const struct PSS_MenuStringPtrs gUnknown_085716C0[] = {gText_SeeYa, gText_SeeYaDescription} }; -const struct WindowTemplate gUnknown_085716E8 = {0, 1, 1, 0x11, 0xA, 0xF, 1}; +static const struct WindowTemplate gUnknown_085716E8 = +{ + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 17, + .height = 10, + .paletteNum = 15, + .baseBlock = 0x1, +}; static const union AnimCmd sSpriteAnim_85716F0[] = { @@ -84,7 +766,7 @@ static const union AnimCmd sSpriteAnim_8571708[] = ANIMCMD_END }; -const union AnimCmd *const sSpriteAnimTable_8571710[] = +static const union AnimCmd *const sSpriteAnimTable_8571710[] = { sSpriteAnim_85716F0, sSpriteAnim_85716F8, @@ -103,12 +785,765 @@ static const union AffineAnimCmd *const sSpriteAffineAnimTable_8571730[] = sSpriteAffineAnim_8571720 }; -const u8 gUnknown_08571734[] = {4, 0xF, 0xE}; -const u8 gUnknown_08571737[] = _("/30"); +static const u8 gUnknown_08571734[] = {4, 0xF, 0xE}; +static const u8 gUnknown_08571737[] = _("/30"); -const u16 gBoxSelectionPopupPalette[] = INCBIN_U16("graphics/unknown/unknown_57173C.gbapal"); -const u8 gBoxSelectionPopupCenterTiles[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_center.4bpp"); -const u8 gBoxSelectionPopupSidesTiles[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_sides.4bpp"); +static const u16 gBoxSelectionPopupPalette[] = INCBIN_U16("graphics/unknown/unknown_57173C.gbapal"); +static const u8 gBoxSelectionPopupCenterTiles[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_center.4bpp"); +static const u8 gBoxSelectionPopupSidesTiles[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_sides.4bpp"); +static const u32 gPokemonStorageScrollingBGTileset[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.4bpp.lz"); +static const u32 gPokemonStorageScrollingBGTilemap[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.bin.lz"); +static const u32 gUnknown_08572280[] = INCBIN_U32("graphics/unknown/unknown_572280.gbapal"); +static const u32 gUnknown_085722A0[] = INCBIN_U32("graphics/unknown/unknown_5722A0.bin.lz"); + +static const u16 gUnknown_0857239C[] = +{ + 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x0108, 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, 0x0117, 0x0118, + 0x2101, 0x2102, 0x2103, 0x2104, 0x2105, 0x2106, 0x2107, 0x2108, 0x2111, 0x2112, 0x2113, 0x2114, 0x2115, 0x2116, 0x2117, 0x2118, +}; + +static const u16 gUnknown_085723DC[] = INCBIN_U16("graphics/unknown/unknown_5723DC.gbapal"); // Left-most part and Close Box. +static const u16 gUnknown_085723FC[] = INCBIN_U16("graphics/unknown/unknown_5723FC.gbapal"); +static const u16 gUnknown_0857241C[] = INCBIN_U16("graphics/unknown/unknown_57241C.gbapal"); +static const u16 gUnknown_0857243C[] = INCBIN_U16("graphics/unknown/unknown_57243C.gbapal"); + +static const u16 gUnknown_0857245C[] = +{ + 0x014c, 0x014d, 0x014e, 0x014f, 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, 0x015c, 0x015d, 0x015e, 0x015f, 0x0180, 0x0181, 0x0182, + 0x0183, 0x0184, 0x0175, 0x0176, 0x0177, 0x0178, 0x0179, 0x017a, 0x017b, 0x017c, 0x017d, 0x0185, 0x0186, 0x0187, 0x0188, 0x0189, + 0x018a, 0x018b, 0x018c, 0x018d +}; +static const u16 gUnknown_085724A4[] = +{ + 0x1140, 0x1141, 0x1141, 0x1142, 0x1150, 0x1151, 0x1151, 0x1152, 0x1160, 0x1161, 0x1161, 0x1162, +}; +static const u16 gUnknown_085724BC[] = +{ + 0x1143, 0x1144, 0x1144, 0x1145, 0x1153, 0x1154, 0x1154, 0x1155, 0x1163, 0x1164, 0x1164, 0x1165, +}; + +static const u16 gWaveformPalette[] = INCBIN_U16("graphics/pokemon_storage/waveform.gbapal"); +static const u32 gWaveformTiles[] = INCBIN_U32("graphics/pokemon_storage/waveform.4bpp"); +static const u32 gUnknown_085726B4[] = INCBIN_U32("graphics/unused/unknown_5726B4.gbapal"); +static const u32 gUnknown_085726F4[] = INCBIN_U32("graphics/unknown/unknown_5726F4.gbapal"); + +static const struct WindowTemplate gUnknown_08572714[] = +{ + { // 0 + .bg = 1, + .tilemapLeft = 0, + .tilemapTop = 11, + .width = 9, + .height = 7, + .paletteNum = 3, + .baseBlock = 0xC0, + }, + { // 1 + .bg = 0, + .tilemapLeft = 11, + .tilemapTop = 17, + .width = 18, + .height = 2, + .paletteNum = 15, + .baseBlock = 0x14, + }, + { // 2 + .bg = 0, + .tilemapLeft = 0, + .tilemapTop = 13, + .width = 21, + .height = 7, + .paletteNum = 15, + .baseBlock = 0x14, + }, + DUMMY_WIN_TEMPLATE +}; + +static const struct BgTemplate gUnknown_08572734[] = +{ + { + .bg = 0, + .charBaseIndex = 0, + .mapBaseIndex = 29, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, + { + .bg = 1, + .charBaseIndex = 1, + .mapBaseIndex = 30, + .screenSize = 0, + .paletteMode = 0, + .priority = 1, + .baseTile = 0x100 + }, + { + .bg = 2, + .charBaseIndex = 2, + .mapBaseIndex = 27, + .screenSize = 1, + .paletteMode = 0, + .priority = 2, + .baseTile = 0 + }, + { + .bg = 3, + .charBaseIndex = 3, + .mapBaseIndex = 31, + .screenSize = 0, + .paletteMode = 0, + .priority = 3, + .baseTile = 0 + }, +}; + +static const struct SpritePalette gWaveformSpritePalette = +{ + gWaveformPalette, TAG_PAL_WAVEFORM +}; + +static const struct SpriteSheet gWaveformSpriteSheet = +{ + gWaveformTiles, sizeof(gWaveformTiles), TAG_TILE_WAVEFORM +}; + +static const struct OamData sOamData_857286C; +static const struct SpriteTemplate sSpriteTemplate_CursorMon = +{ + .tileTag = TAG_TILE_2, + .paletteTag = TAG_PAL_DAC6, + .oam = &sOamData_857286C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; + +static const struct StorageAction gPCStorageActionTexts[] = +{ + [PC_TEXT_EXIT_BOX] = {gText_ExitFromBox, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_WHAT_YOU_DO] = {gText_WhatDoYouWantToDo, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_PICK_A_THEME] = {gText_PleasePickATheme, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_PICK_A_WALLPAPER] = {gText_PickTheWallpaper, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_IS_SELECTED] = {gText_PkmnIsSelected, PC_TEXT_FMT_MON_NAME_1}, + [PC_TEXT_JUMP_TO_WHICH_BOX] = {gText_JumpToWhichBox, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_DEPOSIT_IN_WHICH_BOX] = {gText_DepositInWhichBox, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_WAS_DEPOSITED] = {gText_PkmnWasDeposited, PC_TEXT_FMT_MON_NAME_1}, + [PC_TEXT_BOX_IS_FULL] = {gText_BoxIsFull2, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_RELEASE_POKE] = {gText_ReleaseThisPokemon, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_WAS_RELEASED] = {gText_PkmnWasReleased, PC_TEXT_FMT_MON_NAME_4}, + [PC_TEXT_BYE_BYE] = {gText_ByeByePkmn, PC_TEXT_FMT_MON_NAME_6}, + [PC_TEXT_MARK_POKE] = {gText_MarkYourPkmn, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_LAST_POKE] = {gText_ThatsYourLastPkmn, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_PARTY_FULL] = {gText_YourPartysFull, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_HOLDING_POKE] = {gText_YoureHoldingAPkmn, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_WHICH_ONE_WILL_TAKE] = {gText_WhichOneWillYouTake, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_CANT_RELEASE_EGG] = {gText_YouCantReleaseAnEgg, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_CONTINUE_BOX] = {gText_ContinueBoxOperations, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_CAME_BACK] = {gText_PkmnCameBack, PC_TEXT_FMT_MON_NAME_1}, + [PC_TEXT_WORRIED] = {gText_WasItWorriedAboutYou, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_SURPRISE] = {gText_FourEllipsesExclamation, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_PLEASE_REMOVE_MAIL] = {gText_PleaseRemoveTheMail, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_IS_SELECTED2] = {gText_PkmnIsSelected, PC_TEXT_FMT_ITEM_NAME}, + [PC_TEXT_GIVE_TO_MON] = {gText_GiveToAPkmn, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_PLACED_IN_BAG] = {gText_PlacedItemInBag, PC_TEXT_FMT_ITEM_NAME}, + [PC_TEXT_BAG_FULL] = {gText_BagIsFull2, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_PUT_IN_BAG] = {gText_PutItemInBag, PC_TEXT_FMT_NORMAL}, + [PC_TEXT_ITEM_IS_HELD] = {gText_ItemIsNowHeld, PC_TEXT_FMT_ITEM_NAME}, + [PC_TEXT_CHANGED_TO_ITEM] = {gText_ChangedToNewItem, PC_TEXT_FMT_ITEM_NAME}, + [PC_TEXT_CANT_STORE_MAIL] = {gText_MailCantBeStored, PC_TEXT_FMT_NORMAL}, +}; + +static const struct WindowTemplate sYesNoWindowTemplate = +{ + .bg = 0, + .tilemapLeft = 24, + .tilemapTop = 11, + .width = 5, + .height = 4, + .paletteNum = 15, + .baseBlock = 0x5C, +}; + +static const struct OamData sOamData_857286C = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0 +}; + +static const struct OamData sOamData_8572874 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 1, + .x = 0, + .matrixNum = 0, + .size = 0, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0 +}; + +static const union AnimCmd sSpriteAnim_857287C[] = +{ + ANIMCMD_FRAME(0, 5), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_8572884[] = +{ + ANIMCMD_FRAME(2, 8), + ANIMCMD_FRAME(4, 8), + ANIMCMD_FRAME(6, 8), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sSpriteAnim_8572894[] = +{ + ANIMCMD_FRAME(8, 5), + ANIMCMD_END +}; + +static const union AnimCmd sSpriteAnim_857289C[] = +{ + ANIMCMD_FRAME(10, 8), + ANIMCMD_FRAME(4, 8), + ANIMCMD_FRAME(12, 8), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd *const sSpriteAnimTable_85728AC[] = +{ + sSpriteAnim_857287C, + sSpriteAnim_8572884, + sSpriteAnim_8572894, + sSpriteAnim_857289C +}; + +static const struct SpriteTemplate sSpriteTemplate_Waveform = +{ + .tileTag = TAG_TILE_WAVEFORM, + .paletteTag = TAG_PAL_WAVEFORM, + .oam = &sOamData_8572874, + .anims = sSpriteAnimTable_85728AC, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; + +static const struct OamData sOamData_85728EC; +static const struct SpriteTemplate gUnknown_085728D4 = +{ + .tileTag = TAG_TILE_12, + .paletteTag = TAG_PAL_DAC0, + .oam = &sOamData_85728EC, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; + +static const struct OamData sOamData_85728EC = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 2, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0 +}; + +static const union AffineAnimCmd gSpriteAffineAnim_85728F4[] = +{ + AFFINEANIMCMD_FRAME(-2, -2, 0, 120), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd gSpriteAffineAnim_8572904[] = +{ + AFFINEANIMCMD_FRAME(16, 16, 0, 0), + AFFINEANIMCMD_FRAME(16, 16, 0, 15), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd *const gSpriteAffineAnimTable_857291C[] = +{ + gSpriteAffineAnim_85728F4, + gSpriteAffineAnim_8572904 +}; + +static const u16 gWallpaperPalettes_Forest[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/forest_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/forest_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Forest[] = INCBIN_U32("graphics/pokemon_storage/forest.4bpp.lz"); +static const u32 gWallpaperTilemap_Forest[] = INCBIN_U32("graphics/pokemon_storage/forest.bin.lz"); + +static const u16 gWallpaperPalettes_City[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/city_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/city_bg.gbapal"), +}; +static const u32 gWallpaperTiles_City[] = INCBIN_U32("graphics/pokemon_storage/city.4bpp.lz"); +static const u32 gWallpaperTilemap_City[] = INCBIN_U32("graphics/pokemon_storage/city.bin.lz"); + +static const u16 gWallpaperPalettes_Desert[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/desert_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/desert_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Desert[] = INCBIN_U32("graphics/pokemon_storage/desert.4bpp.lz"); +static const u32 gWallpaperTilemap_Desert[] = INCBIN_U32("graphics/pokemon_storage/desert.bin.lz"); + +static const u16 gWallpaperPalettes_Savanna[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/savanna_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/savanna_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Savanna[] = INCBIN_U32("graphics/pokemon_storage/savanna.4bpp.lz"); +static const u32 gWallpaperTilemap_Savanna[] = INCBIN_U32("graphics/pokemon_storage/savanna.bin.lz"); + +static const u16 gWallpaperPalettes_Crag[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/crag_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/crag_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Crag[] = INCBIN_U32("graphics/pokemon_storage/crag.4bpp.lz"); +static const u32 gWallpaperTilemap_Crag[] = INCBIN_U32("graphics/pokemon_storage/crag.bin.lz"); + +static const u16 gWallpaperPalettes_Volcano[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/volcano_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/volcano_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Volcano[] = INCBIN_U32("graphics/pokemon_storage/volcano.4bpp.lz"); +static const u32 gWallpaperTilemap_Volcano[] = INCBIN_U32("graphics/pokemon_storage/volcano.bin.lz"); + +static const u16 gWallpaperPalettes_Snow[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/snow_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/snow_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Snow[] = INCBIN_U32("graphics/pokemon_storage/snow.4bpp.lz"); +static const u32 gWallpaperTilemap_Snow[] = INCBIN_U32("graphics/pokemon_storage/snow.bin.lz"); + +static const u16 gWallpaperPalettes_Cave[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/cave_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/cave_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Cave[] = INCBIN_U32("graphics/pokemon_storage/cave.4bpp.lz"); +static const u32 gWallpaperTilemap_Cave[] = INCBIN_U32("graphics/pokemon_storage/cave.bin.lz"); + +static const u16 gWallpaperPalettes_Beach[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/beach_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/beach_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Beach[] = INCBIN_U32("graphics/pokemon_storage/beach.4bpp.lz"); +static const u32 gWallpaperTilemap_Beach[] = INCBIN_U32("graphics/pokemon_storage/beach.bin.lz"); + +static const u16 gWallpaperPalettes_Seafloor[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/seafloor_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/seafloor_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Seafloor[] = INCBIN_U32("graphics/pokemon_storage/seafloor.4bpp.lz"); +static const u32 gWallpaperTilemap_Seafloor[] = INCBIN_U32("graphics/pokemon_storage/seafloor.bin.lz"); + +static const u16 gWallpaperPalettes_River[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/river_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/river_bg.gbapal"), +}; +static const u32 gWallpaperTiles_River[] = INCBIN_U32("graphics/pokemon_storage/river.4bpp.lz"); +static const u32 gWallpaperTilemap_River[] = INCBIN_U32("graphics/pokemon_storage/river.bin.lz"); +static const u16 gWallpaperPalettes_Sky[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/sky_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/sky_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Sky[] = INCBIN_U32("graphics/pokemon_storage/sky.4bpp.lz"); +static const u32 gWallpaperTilemap_Sky[] = INCBIN_U32("graphics/pokemon_storage/sky.bin.lz"); + +static const u16 gWallpaperPalettes_PolkaDot[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/polkadot_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/polkadot_bg.gbapal"), +}; +static const u32 gWallpaperTiles_PolkaDot[] = INCBIN_U32("graphics/pokemon_storage/polkadot.4bpp.lz"); +static const u32 gWallpaperTilemap_PolkaDot[] = INCBIN_U32("graphics/pokemon_storage/polkadot.bin.lz"); + +static const u16 gWallpaperPalettes_Pokecenter[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/pokecenter_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/pokecenter_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Pokecenter[] = INCBIN_U32("graphics/pokemon_storage/pokecenter.4bpp.lz"); +static const u32 gWallpaperTilemap_Pokecenter[] = INCBIN_U32("graphics/pokemon_storage/pokecenter.bin.lz"); + +static const u16 gWallpaperPalettes_Machine[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/machine_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/machine_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Machine[] = INCBIN_U32("graphics/pokemon_storage/machine.4bpp.lz"); +static const u32 gWallpaperTilemap_Machine[] = INCBIN_U32("graphics/pokemon_storage/machine.bin.lz"); + +static const u16 gWallpaperPalettes_Plain[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/plain_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/plain_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Plain[] = INCBIN_U32("graphics/pokemon_storage/plain.4bpp.lz"); +static const u32 gWallpaperTilemap_Plain[] = INCBIN_U32("graphics/pokemon_storage/plain.bin.lz"); + +// 12×18 tilemap +static const u32 gUnknown_085773C4[] = INCBIN_U32("graphics/unused/tilemap_5773C4.bin"); + +static const u16 gUnknown_08577574[][2] = +{ + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF}, + {0x1CE7, 0x7FFF} +}; + +#define WALLPAPER_ENTRY(name) {gWallpaperTiles_##name, gWallpaperTilemap_##name, gWallpaperPalettes_##name[0]} + +static const struct WallpaperTable gWallpaperTable[] = +{ + [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), +}; + +static const u8 gPCGfx_Arrow[] = INCBIN_U8("graphics/pokemon_storage/arrow.4bpp"); + +static const u16 gWallpaperPalettes_Zigzagoon[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), + INCBIN_U16("graphics/pokemon_storage/zigzagoon_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Zigzagoon[] = INCBIN_U32("graphics/pokemon_storage/zigzagoon.4bpp.lz"); +static const u32 gWallpaperTilemap_Zigzagoon[] = INCBIN_U32("graphics/pokemon_storage/zigzagoon.bin.lz"); + +static const u16 gWallpaperPalettes_Screen[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), + INCBIN_U16("graphics/pokemon_storage/screen_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Screen[] = INCBIN_U32("graphics/pokemon_storage/screen.4bpp.lz"); +static const u32 gWallpaperTilemap_Screen[] = INCBIN_U32("graphics/pokemon_storage/screen.bin.lz"); + +static const u16 gWallpaperPalettes_Diagonal[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), + INCBIN_U16("graphics/pokemon_storage/diagonal_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Diagonal[] = INCBIN_U32("graphics/pokemon_storage/diagonal.4bpp.lz"); +static const u32 gWallpaperTilemap_Diagonal[] = INCBIN_U32("graphics/pokemon_storage/diagonal.bin.lz"); + +static const u16 gWallpaperPalettes_Block[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/block_bg.gbapal"), + INCBIN_U16("graphics/pokemon_storage/block_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Block[] = INCBIN_U32("graphics/pokemon_storage/block.4bpp.lz"); +static const u32 gWallpaperTilemap_Block[] = INCBIN_U32("graphics/pokemon_storage/block.bin.lz"); + +static const u16 gWallpaperPalettes_Pokecenter2[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/pokecenter2_bg.gbapal"), + INCBIN_U16("graphics/pokemon_storage/pokecenter2_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Pokecenter2[] = INCBIN_U32("graphics/pokemon_storage/pokecenter2.4bpp.lz"); +static const u32 gWallpaperTilemap_Pokecenter2[] = INCBIN_U32("graphics/pokemon_storage/pokecenter2.bin.lz"); + +static const u16 gWallpaperPalettes_Frame[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/frame_bg.gbapal"), + INCBIN_U16("graphics/pokemon_storage/frame_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Frame[] = INCBIN_U32("graphics/pokemon_storage/frame.4bpp.lz"); +static const u32 gWallpaperTilemap_Frame[] = INCBIN_U32("graphics/pokemon_storage/frame.bin.lz"); + +static const u16 gWallpaperPalettes_Blank[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), + INCBIN_U16("graphics/pokemon_storage/zigzagoon_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Blank[] = INCBIN_U32("graphics/pokemon_storage/blank.4bpp.lz"); +static const u32 gWallpaperTilemap_Blank[] = INCBIN_U32("graphics/pokemon_storage/blank.bin.lz"); + +static const u16 gWallpaperPalettes_Circles[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/circles_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Circles[] = INCBIN_U32("graphics/pokemon_storage/circles.4bpp.lz"); +static const u32 gWallpaperTilemap_Circles[] = INCBIN_U32("graphics/pokemon_storage/circles.bin.lz"); + +static const u16 gWallpaperPalettes_Azumarill[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/azumarill_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Azumarill[] = INCBIN_U32("graphics/pokemon_storage/azumarill.4bpp.lz"); +static const u32 gWallpaperTilemap_Azumarill[] = INCBIN_U32("graphics/pokemon_storage/azumarill.bin.lz"); + +static const u16 gWallpaperPalettes_Pikachu[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/pikachu_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Pikachu[] = INCBIN_U32("graphics/pokemon_storage/pikachu.4bpp.lz"); +static const u32 gWallpaperTilemap_Pikachu[] = INCBIN_U32("graphics/pokemon_storage/pikachu.bin.lz"); + +static const u16 gWallpaperPalettes_Legendary[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/legendary_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Legendary[] = INCBIN_U32("graphics/pokemon_storage/legendary.4bpp.lz"); +static const u32 gWallpaperTilemap_Legendary[] = INCBIN_U32("graphics/pokemon_storage/legendary.bin.lz"); + +static const u16 gWallpaperPalettes_Dusclops[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/dusclops_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Dusclops[] = INCBIN_U32("graphics/pokemon_storage/dusclops.4bpp.lz"); +static const u32 gWallpaperTilemap_Dusclops[] = INCBIN_U32("graphics/pokemon_storage/dusclops.bin.lz"); + +static const u16 gWallpaperPalettes_Ludicolo[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/ludicolo_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Ludicolo[] = INCBIN_U32("graphics/pokemon_storage/ludicolo.4bpp.lz"); +static const u32 gWallpaperTilemap_Ludicolo[] = INCBIN_U32("graphics/pokemon_storage/ludicolo.bin.lz"); + +static const u16 gWallpaperPalettes_Whiscash[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/whiscash_bg.gbapal"), +}; +static const u32 gWallpaperTiles_Whiscash[] = INCBIN_U32("graphics/pokemon_storage/whiscash.4bpp.lz"); +static const u32 gWallpaperTilemap_Whiscash[] = INCBIN_U32("graphics/pokemon_storage/whiscash.bin.lz"); + +static const u32 gWallpaperIcon_Aqua[] = INCBIN_U32("graphics/pokemon_storage/aqua_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Heart[] = INCBIN_U32("graphics/pokemon_storage/heart_icon.4bpp.lz"); +static const u32 gWallpaperIcon_FiveStar[] = INCBIN_U32("graphics/pokemon_storage/five_star_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Brick[] = INCBIN_U32("graphics/pokemon_storage/brick_icon.4bpp.lz"); +static const u32 gWallpaperIcon_FourStar[] = INCBIN_U32("graphics/pokemon_storage/four_star_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Asterisk[] = INCBIN_U32("graphics/pokemon_storage/asterisk_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Dot[] = INCBIN_U32("graphics/pokemon_storage/dot_icon.4bpp.lz"); +static const u32 gWallpaperIcon_LineCircle[] = INCBIN_U32("graphics/pokemon_storage/line_circle_icon.4bpp.lz"); +static const u32 gWallpaperIcon_PokeBall[] = INCBIN_U32("graphics/pokemon_storage/pokeball_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Maze[] = INCBIN_U32("graphics/pokemon_storage/maze_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Footprint[] = INCBIN_U32("graphics/pokemon_storage/footprint_icon.4bpp.lz"); +static const u32 gWallpaperIcon_BigAsterisk[] = INCBIN_U32("graphics/pokemon_storage/big_asterisk_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Circle[] = INCBIN_U32("graphics/pokemon_storage/circle_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Koffing[] = INCBIN_U32("graphics/pokemon_storage/koffing_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Ribbon[] = INCBIN_U32("graphics/pokemon_storage/ribbon_icon.4bpp.lz"); +static const u32 gWallpaperIcon_FourCircles[] = INCBIN_U32("graphics/pokemon_storage/four_circles_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Lotad[] = INCBIN_U32("graphics/pokemon_storage/lotad_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Crystal[] = INCBIN_U32("graphics/pokemon_storage/crystal_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Pichu[] = INCBIN_U32("graphics/pokemon_storage/pichu_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Diglett[] = INCBIN_U32("graphics/pokemon_storage/diglett_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Luvdisc[] = INCBIN_U32("graphics/pokemon_storage/luvdisc_icon.4bpp.lz"); +static const u32 gWallpaperIcon_StarInCircle[] = INCBIN_U32("graphics/pokemon_storage/star_in_circle_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Spinda[] = INCBIN_U32("graphics/pokemon_storage/spinda_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Latis[] = INCBIN_U32("graphics/pokemon_storage/latis_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Minun[] = INCBIN_U32("graphics/pokemon_storage/minun_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Togepi[] = INCBIN_U32("graphics/pokemon_storage/togepi_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Magma[] = INCBIN_U32("graphics/pokemon_storage/magma_icon.4bpp.lz"); + +static 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), +}; + +static 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. +static const u16 gUnknown_0857B07C = 0x23BA; + +static const struct SpriteSheet gUnknown_0857B080 = {gPCGfx_Arrow, 0x80, 6}; + +static const struct OamData gOamData_83BB298 = +{ + .shape = ST_OAM_H_RECTANGLE, + .size = 2, + .priority = 2 +}; + +static const union AnimCmd gSpriteAnim_83BB2A0[] = +{ + ANIMCMD_FRAME(0, 5), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_83BB2A8[] = +{ + ANIMCMD_FRAME(8, 5), + ANIMCMD_END +}; + +static const union AnimCmd *const gSpriteAnimTable_83BB2B0[] = +{ + gSpriteAnim_83BB2A0, + gSpriteAnim_83BB2A8 +}; + +static const struct SpriteTemplate gSpriteTemplate_857B0A8 = +{ + TAG_TILE_3, + TAG_PAL_DAC9, + &gOamData_83BB298, + gSpriteAnimTable_83BB2B0, + NULL, + gDummySpriteAffineAnimTable, + SpriteCallbackDummy +}; + +static const struct OamData gOamData_83BB2D0 = +{ + .shape = ST_OAM_V_RECTANGLE, + .priority = 2 +}; + +static const union AnimCmd gSpriteAnim_83BB2D8[] = +{ + ANIMCMD_FRAME(0, 5), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_83BB2E0[] = +{ + ANIMCMD_FRAME(2, 5), + ANIMCMD_END +}; + +static const union AnimCmd *const gSpriteAnimTable_83BB2E8[] = +{ + gSpriteAnim_83BB2D8, + gSpriteAnim_83BB2E0 +}; + +static const struct SpriteTemplate gUnknown_0857B0E0 = +{ + 6, + TAG_PAL_WAVEFORM, + &gOamData_83BB2D0, + gSpriteAnimTable_83BB2E8, + NULL, + gDummySpriteAffineAnimTable, + sub_80CD210 +}; + +static const u16 gHandCursorPalette[] = INCBIN_U16("graphics/pokemon_storage/hand_cursor.gbapal"); +static const u8 gHandCursorTiles[] = INCBIN_U8("graphics/pokemon_storage/hand_cursor.4bpp"); +static const u8 gHandCursorShadowTiles[] = INCBIN_U8("graphics/pokemon_storage/hand_cursor_shadow.4bpp"); // code u8 CountMonsInBox(u8 boxId) @@ -117,7 +1552,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++; } @@ -130,7 +1565,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; } @@ -191,7 +1626,7 @@ u8 CountPartyMons(void) return count; } -static u8 *StringCopyAndFillWithSpaces(u8 *dst, const u8 *src, u16 n) +u8 *StringCopyAndFillWithSpaces(u8 *dst, const u8 *src, u16 n) { u8 *str; @@ -217,28 +1652,7 @@ static void sub_80C7128(u16 *dest, u16 dest_left, u16 dest_top, const u16 *src, } } -#define MAX_DMA_BLOCK_SIZE 0x1000 -#define Dma3FillLarge_(value, dest, size, bit) \ -{ \ - void *_dest = dest; \ - u32 _size = size; \ - while (1) \ - { \ - if (_size <= MAX_DMA_BLOCK_SIZE) \ - { \ - DmaFill##bit(3, value, _dest, _size); \ - break; \ - } \ - DmaFill##bit(3, value, _dest, MAX_DMA_BLOCK_SIZE); \ - _dest += MAX_DMA_BLOCK_SIZE; \ - _size -= MAX_DMA_BLOCK_SIZE; \ - } \ -} - -#define Dma3FillLarge16_(value, dest, size) Dma3FillLarge_(value, dest, size, 16) -#define Dma3FillLarge32_(value, dest, size) Dma3FillLarge_(value, dest, size, 32) - -void sub_80C71A4(u16 *dest, u16 dest_left, u16 dest_top, u16 width, u16 height) +static void sub_80C71A4(u16 *dest, u16 dest_left, u16 dest_top, u16 width, u16 height) { u16 i; @@ -248,13 +1662,14 @@ void sub_80C71A4(u16 *dest, u16 dest_left, u16 dest_top, u16 width, u16 height) Dma3FillLarge16_(0, dest, width); } -void Task_PokemonStorageSystem(u8 taskId) +static void Task_PokemonStorageSystemPC(u8 taskId) { - struct Task *task = gTasks + taskId; + struct Task *task = &gTasks[taskId]; + switch (task->data[0]) { case 0: - StorageSystemCreatePrimaryMenu(task->data[1], &task->data[15]); + CreatePCMenu(task->data[1], &task->data[15]); sub_81973A4(); NewMenuHelpers_DrawDialogueFrame(0, 0); FillWindowPixelBuffer(0, 0x11); @@ -327,8 +1742,8 @@ void Task_PokemonStorageSystem(u8 taskId) { if (--task->data[1] < 0) task->data[1] = 4; - MoveMenuCursor(-1); - task->data[1] = GetMenuCursorPos(); + Menu_MoveCursor(-1); + task->data[1] = Menu_GetCursorPos(); FillWindowPixelBuffer(0, 0x11); AddTextPrinterParameterized2(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3); task->data[0] = 2; @@ -337,8 +1752,8 @@ void Task_PokemonStorageSystem(u8 taskId) { if (++task->data[1] > 3) task->data[1] = 0; - MoveMenuCursor(1); - task->data[1] = GetMenuCursorPos(); + Menu_MoveCursor(1); + task->data[1] = Menu_GetCursorPos(); FillWindowPixelBuffer(0, 0x11); AddTextPrinterParameterized2(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3); task->data[0] = 2; @@ -348,7 +1763,7 @@ void Task_PokemonStorageSystem(u8 taskId) if (!gPaletteFade.active) { overworld_free_bg_tilemaps(); - sub_80C7D74(task->data[2]); + Cb2_EnterPSS(task->data[2]); RemoveWindow(task->data[15]); DestroyTask(taskId); } @@ -356,29 +1771,29 @@ void Task_PokemonStorageSystem(u8 taskId) } } -void ShowPokemonStorageSystem(void) +void ShowPokemonStorageSystemPC(void) { - u8 taskId = CreateTask(Task_PokemonStorageSystem, 80); + u8 taskId = CreateTask(Task_PokemonStorageSystemPC, 80); gTasks[taskId].data[0] = 0; gTasks[taskId].data[1] = 0; ScriptContext2_Enable(); } -void mapldr_0808C6D8(void) +static void FieldCb_ReturnToPcMenu(void) { u8 taskId; MainCallback vblankCb = gMain.vblankCallback; SetVBlankCallback(NULL); - taskId = CreateTask(Task_PokemonStorageSystem, 80); + taskId = CreateTask(Task_PokemonStorageSystemPC, 80); gTasks[taskId].data[0] = 0; - gTasks[taskId].data[1] = gUnknown_02039D00; - Task_PokemonStorageSystem(taskId); + gTasks[taskId].data[1] = sPreviousBoxOption; + Task_PokemonStorageSystemPC(taskId); SetVBlankCallback(vblankCb); pal_fill_black(); } -void StorageSystemCreatePrimaryMenu(u8 whichMenu, s16 *windowIdPtr) +static void CreatePCMenu(u8 whichMenu, s16 *windowIdPtr) { s16 windowId; struct WindowTemplate winTemplate = gUnknown_085716E8; @@ -391,14 +1806,14 @@ void StorageSystemCreatePrimaryMenu(u8 whichMenu, s16 *windowIdPtr) *windowIdPtr = windowId; } -void sub_80C7678(void) +static void Cb2_ExitPSS(void) { - gUnknown_02039D00 = sub_80CAEA0(); - gFieldCallback = mapldr_0808C6D8; + sPreviousBoxOption = GetCurrentBoxOption(); + gFieldCallback = FieldCb_ReturnToPcMenu; SetMainCallback2(CB2_ReturnToField); } -s16 StorageSystemGetNextMonIndex(struct BoxPokemon *box, s8 startIdx, u8 stopIdx, u8 mode) +static s16 StorageSystemGetNextMonIndex(struct BoxPokemon *box, s8 startIdx, u8 stopIdx, u8 mode) { s16 i; s16 direction; @@ -431,14 +1846,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++) { @@ -452,7 +1866,7 @@ void ResetPokemonStorageSystem(void) ResetWaldaWallpaper(); } -void sub_80C77E8(struct UnkPSSStruct_2002370 *a0, u16 tileTag, u16 palTag, u8 a3, bool32 loadPal) +static void sub_80C77E8(struct UnkPSSStruct_2002370 *a0, u16 tileTag, u16 palTag, u8 a3, bool32 loadPal) { struct SpritePalette palette = { @@ -476,7 +1890,7 @@ void sub_80C77E8(struct UnkPSSStruct_2002370 *a0, u16 tileTag, u16 palTag, u8 a3 a0->unk_023c = loadPal; } -void sub_80C7890(void) +static void sub_80C7890(void) { if (gUnknown_02039D04->unk_023c) FreeSpritePaletteByTag(gUnknown_02039D04->unk_0242); @@ -484,17 +1898,17 @@ void sub_80C7890(void) FreeSpriteTilesByTag(gUnknown_02039D04->unk_0240 + 1); } -void sub_80C78D4(u8 curBox) +static void sub_80C78D4(u8 curBox) { sub_80C7958(curBox); } -void sub_80C78E4(void) +static void sub_80C78E4(void) { sub_80C7B14(); } -u8 sub_80C78F0(void) +static u8 HandleBoxChooseSelectionInput(void) { if (gMain.newKeys & B_BUTTON) { @@ -519,7 +1933,7 @@ u8 sub_80C78F0(void) return 200; } -void sub_80C7958(u8 curBox) +static void sub_80C7958(u8 curBox) { u16 i; u8 spriteId; @@ -535,7 +1949,7 @@ void sub_80C7958(u8 curBox) template.tileTag = gUnknown_02039D04->unk_0240; template.paletteTag = gUnknown_02039D04->unk_0242; - spriteId = CreateSprite(&template, 0xA0, 0x60, 0); + spriteId = CreateSprite(&template, 160, 96, 0); gUnknown_02039D04->unk_0000 = gSprites + spriteId; oamData.shape = ST_OAM_V_RECTANGLE; @@ -545,17 +1959,17 @@ void sub_80C7958(u8 curBox) for (i = 0; i < 4; i++) { u16 r5; - spriteId = CreateSprite(&template, 0x7c, 0x50, gUnknown_02039D04->unk_0246); + spriteId = CreateSprite(&template, 124, 80, gUnknown_02039D04->unk_0246); gUnknown_02039D04->unk_0004[i] = gSprites + spriteId; r5 = 0; if (i & 2) { - gUnknown_02039D04->unk_0004[i]->pos1.x = 0xc4; + gUnknown_02039D04->unk_0004[i]->pos1.x = 196; r5 = 2; } if (i & 1) { - gUnknown_02039D04->unk_0004[i]->pos1.y = 0x70; + gUnknown_02039D04->unk_0004[i]->pos1.y = 112; gUnknown_02039D04->unk_0004[i]->oam.size = 0; r5++; } @@ -573,7 +1987,7 @@ void sub_80C7958(u8 curBox) sub_80C7BE4(); } -void sub_80C7B14(void) +static void sub_80C7B14(void) { u16 i; if (gUnknown_02039D04->unk_0000) @@ -596,20 +2010,20 @@ void sub_80C7B14(void) } } -void sub_80C7B80(void) +static void sub_80C7B80(void) { if (++gUnknown_02039D04->curBox >= TOTAL_BOXES_COUNT) gUnknown_02039D04->curBox = 0; sub_80C7BE4(); } -void sub_80C7BB4(void) +static void sub_80C7BB4(void) { gUnknown_02039D04->curBox = (gUnknown_02039D04->curBox == 0 ? TOTAL_BOXES_COUNT - 1 : gUnknown_02039D04->curBox - 1); sub_80C7BE4(); } -void sub_80C7BE4(void) +static void sub_80C7BE4(void) { u8 text[16]; struct WindowTemplate winTemplate; @@ -626,13 +2040,13 @@ void sub_80C7BE4(void) windowId = AddWindow(&winTemplate); FillWindowPixelBuffer(windowId, 0x44); - center = GetStringCenterAlignXOffset(1, boxName, 0x40); + center = GetStringCenterAlignXOffset(1, boxName, 64); AddTextPrinterParameterized3(windowId, 1, center, 1, gUnknown_08571734, TEXT_SPEED_FF, boxName); ConvertIntToDecimalStringN(text, nPokemonInBox, 1, 2); StringAppend(text, gUnknown_08571737); - center = GetStringCenterAlignXOffset(1, text, 0x40); - AddTextPrinterParameterized3(windowId, 1, center, 0x11, gUnknown_08571734, TEXT_SPEED_FF, text); + center = GetStringCenterAlignXOffset(1, text, 64); + AddTextPrinterParameterized3(windowId, 1, center, 17, gUnknown_08571734, TEXT_SPEED_FF, text); winTileData = GetWindowAttribute(windowId, WINDOW_TILE_DATA); CpuCopy32((void *)winTileData, (void *)OBJ_VRAM0 + 0x100 + (GetSpriteTileStartByTag(gUnknown_02039D04->unk_0240) * 32), 0x400); @@ -640,7 +2054,7 @@ void sub_80C7BE4(void) RemoveWindow(windowId); } -void sub_80C7CF4(struct Sprite *sprite) +static void sub_80C7CF4(struct Sprite *sprite) { if (++sprite->data[1] > 3) { @@ -654,21 +2068,8587 @@ void sub_80C7CF4(struct Sprite *sprite) } } -void sub_80C7D28(void) +static void VblankCb_PSS(void) { LoadOam(); ProcessSpriteCopyRequests(); sub_80D2AA4(); TransferPlttBuffer(); - SetGpuReg(REG_OFFSET_BG2HOFS, gUnknown_02039D08->bg2_X); + SetGpuReg(REG_OFFSET_BG2HOFS, sPSSData->bg2_X); } -void c2_Box(void) +static void Cb2_PSS(void) { RunTasks(); do_scheduled_bg_tilemap_copies_to_vram(); - sub_80CA028(); + ScrollBackground(); sub_80CAA14(); AnimateSprites(); BuildOamBuffer(); } + +static void Cb2_EnterPSS(u8 boxOption) +{ + ResetTasks(); + sCurrentBoxOption = boxOption; + sPSSData = Alloc(sizeof(*sPSSData)); + if (sPSSData == NULL) + { + SetMainCallback2(Cb2_ExitPSS); + } + else + { + sPSSData->boxOption = boxOption; + sPSSData->isReshowingPSS = FALSE; + gUnknown_02039D12 = 0; + sPSSData->state = 0; + sPSSData->taskId = CreateTask(Cb_InitPSS, 3); + gUnknown_02039D10 = StorageGetCurrentBox(); + SetMainCallback2(Cb2_PSS); + } +} + +static void Cb2_ReturnToPSS(void) +{ + ResetTasks(); + sPSSData = Alloc(sizeof(*sPSSData)); + if (sPSSData == NULL) + { + SetMainCallback2(Cb2_ExitPSS); + } + else + { + sPSSData->boxOption = sCurrentBoxOption; + sPSSData->isReshowingPSS = TRUE; + sPSSData->state = 0; + sPSSData->taskId = CreateTask(Cb_InitPSS, 3); + SetMainCallback2(Cb2_PSS); + } +} + +static void ResetAllBgCoords(void) +{ + SetGpuReg(REG_OFFSET_BG0HOFS, 0); + SetGpuReg(REG_OFFSET_BG0VOFS, 0); + SetGpuReg(REG_OFFSET_BG1HOFS, 0); + SetGpuReg(REG_OFFSET_BG1VOFS, 0); + SetGpuReg(REG_OFFSET_BG2HOFS, 0); + SetGpuReg(REG_OFFSET_BG2VOFS, 0); + SetGpuReg(REG_OFFSET_BG3HOFS, 0); + SetGpuReg(REG_OFFSET_BG3VOFS, 0); +} + +static void sub_80C7E98(void) +{ + ResetPaletteFade(); + ResetSpriteData(); + FreeSpriteTileRanges(); + FreeAllSpritePalettes(); + ClearDma3Requests(); + gReservedSpriteTileCount = 0x280; + sub_80D2A90(&sPSSData->unk_0020, sPSSData->unk_0028, 8); + gKeyRepeatStartDelay = 20; + clear_scheduled_bg_copies_to_vram(); + sub_80D259C(3); + sub_80D2644(0, 1, gUnknown_0857239C, 8, 4); + sub_80D2770(0, 1, 0); + sPSSData->unk_02C7 = 0; +} + +static void sub_80C7F1C(void) +{ + sub_80CDC0C(); + sInPartyMenu = (sPSSData->boxOption == BOX_OPTION_DEPOSIT); + gUnknown_02039D0E = 0; +} + +static void sub_80C7F4C(void) +{ + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) + { + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(7, 11)); + } + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_1D_MAP); +} + +static void SetPSSCallback(TaskFunc newFunc) +{ + gTasks[sPSSData->taskId].func = newFunc; + sPSSData->state = 0; +} + +static void Cb_InitPSS(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + SetVBlankCallback(NULL); + SetGpuReg(REG_OFFSET_DISPCNT, 0); + sub_80C7E98(); + if (sPSSData->isReshowingPSS) + { + switch (sWhichToReshow) + { + case 1: + sub_80CE790(); + break; + case 0: + sub_80CE8E4(); + break; + case 2: + GiveChosenBagItem(); + break; + } + } + LoadPSSMenuGfx(); + LoadWaveformSpritePalette(); + break; + case 1: + if (!InitPSSWindows()) + { + SetPSSCallback(Cb_ChangeScreen); + return; + } + break; + case 2: + PutWindowTilemap(0); + ClearWindowTilemap(1); + CpuFill32(0, (void *)VRAM, 0x200); + LoadUserWindowBorderGfx(1, 0xB, 0xE0); + break; + case 3: + ResetAllBgCoords(); + if (!sPSSData->isReshowingPSS) + sub_80C7F1C(); + break; + case 4: + sub_80CAF04(); + if (!sPSSData->isReshowingPSS) + sub_80CD36C(); + else + sub_80CD3EC(); + break; + case 5: + if (!sub_80D0164()) + { + SetPSSCallback(Cb_ChangeScreen); + return; + } + else + { + SetScrollingBackground(); + sub_80CAC1C(); + } + break; + case 6: + sub_80CA0D8(); + break; + case 7: + sub_80CA704(); + break; + case 8: + sub_80CC32C(StorageGetCurrentBox()); + break; + case 9: + if (sub_80CC35C()) + return; + + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + { + sPSSData->field_DA4.baseTileTag = TAG_TILE_D; + sPSSData->field_DA4.basePaletteTag = TAG_PAL_DACE; + sub_811F90C(&sPSSData->field_DA4); + sub_811FA90(); + } + else + { + sub_80D0C60(); + sub_80CAEAC(); + } + break; + case 10: + sub_80C7F4C(); + if (!sPSSData->isReshowingPSS) + { + BlendPalettes(0xFFFFFFFF, 0x10, RGB_BLACK); + SetPSSCallback(Cb_ShowPSS); + } + else + { + BlendPalettes(0xFFFFFFFF, 0x10, RGB_BLACK); + SetPSSCallback(Cb_ReshowPSS); + } + SetVBlankCallback(VblankCb_PSS); + return; + default: + return; + } + + sPSSData->state++; +} + +static void Cb_ShowPSS(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + PlaySE(SE_PC_LOGIN); + sub_80F9BCC(0x14, 0, 1); + sPSSData->state++; + break; + case 1: + if (!sub_80F9C1C()) + SetPSSCallback(Cb_MainPSS); + break; + } +} + +static void Cb_ReshowPSS(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + BeginNormalPaletteFade(0xFFFFFFFF, -1, 0x10, 0, RGB_BLACK); + sPSSData->state++; + break; + case 1: + if (!UpdatePaletteFade()) + { + if (sWhichToReshow == 2 && gSpecialVar_ItemId != 0) + { + PrintStorageActionText(PC_TEXT_ITEM_IS_HELD); + sPSSData->state++; + } + else + { + SetPSSCallback(Cb_MainPSS); + } + } + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy() && gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + ClearBottomWindow(); + sPSSData->state++; + } + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + SetPSSCallback(Cb_MainPSS); + break; + } +} + +static void Cb_MainPSS(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + switch (HandleInput()) + { + case 1: + PlaySE(SE_SELECT); + sPSSData->state = 1; + break; + case 5: + if (sPSSData->boxOption != BOX_OPTION_MOVE_MONS && sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + { + PrintStorageActionText(PC_TEXT_WHICH_ONE_WILL_TAKE); + sPSSData->state = 3; + } + else + { + sub_80CDC0C(); + SetPSSCallback(Cb_ShowPartyPokemon); + } + break; + case 6: + if (sPSSData->boxOption == BOX_OPTION_MOVE_MONS) + { + if (IsMonBeingMoved() && ItemIsMail(sPSSData->cursorMonItem)) + sPSSData->state = 5; + else + SetPSSCallback(Cb_HidePartyPokemon); + } + else if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) + { + SetPSSCallback(Cb_HidePartyPokemon); + } + break; + case 4: + SetPSSCallback(Cb_OnCloseBoxPressed); + break; + case 19: + SetPSSCallback(Cb_OnBPressed); + break; + case 7: + PlaySE(SE_SELECT); + SetPSSCallback(Cb_HandleBoxOptions); + break; + case 8: + SetPSSCallback(Cb_OnSelectedMon); + break; + case 9: + PlaySE(SE_SELECT); + sPSSData->newCurrBoxId = StorageGetCurrentBox() + 1; + if (sPSSData->newCurrBoxId >= TOTAL_BOXES_COUNT) + sPSSData->newCurrBoxId = 0; + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + { + SetUpScrollToBox(sPSSData->newCurrBoxId); + sPSSData->state = 2; + } + else + { + sub_80CFEA8(); + sPSSData->state = 10; + } + break; + case 10: + PlaySE(SE_SELECT); + sPSSData->newCurrBoxId = StorageGetCurrentBox() - 1; + if (sPSSData->newCurrBoxId < 0) + sPSSData->newCurrBoxId = TOTAL_BOXES_COUNT - 1; + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + { + SetUpScrollToBox(sPSSData->newCurrBoxId); + sPSSData->state = 2; + } + else + { + sub_80CFEA8(); + sPSSData->state = 10; + } + break; + case 11: + if (!CanMovePartyMon()) + { + if (ItemIsMail(sPSSData->cursorMonItem)) + { + sPSSData->state = 5; + } + else + { + PlaySE(SE_SELECT); + SetPSSCallback(Cb_DepositMenu); + } + } + else + { + sPSSData->state = 4; + } + break; + case 13: + if (CanMovePartyMon()) + { + sPSSData->state = 4; + } + else + { + PlaySE(SE_SELECT); + SetPSSCallback(Cb_MoveMon); + } + break; + case 14: + if (!CanShiftMon()) + { + sPSSData->state = 4; + } + else + { + PlaySE(SE_SELECT); + SetPSSCallback(Cb_ShiftMon); + } + break; + case 12: + PlaySE(SE_SELECT); + SetPSSCallback(Cb_WithdrawMon); + break; + case 15: + PlaySE(SE_SELECT); + SetPSSCallback(Cb_PlaceMon); + break; + case 16: + PlaySE(SE_SELECT); + SetPSSCallback(Cb_TakeItemForMoving); + break; + case 17: + PlaySE(SE_SELECT); + SetPSSCallback(Cb_GiveMovingItemToMon); + break; + case 18: + PlaySE(SE_SELECT); + SetPSSCallback(Cb_SwitchSelectedItem); + break; + case 20: + PlaySE(SE_SELECT); + sub_80D01D0(0); + sPSSData->state = 7; + break; + case 22: + sub_80D01D0(1); + sPSSData->state = 8; + break; + case 21: + PlaySE(SE_SELECT); + sub_80D01D0(2); + sPSSData->state = 9; + break; + case 23: + sub_80D01D0(3); + sPSSData->state = 7; + break; + case 25: + PlaySE(SE_SELECT); + sub_80D01D0(4); + sPSSData->state = 9; + break; + case 26: + PlaySE(SE_SELECT); + sub_80D01D0(5); + sPSSData->state = 7; + break; + case 24: + PlaySE(SE_HAZURE); + break; + } + break; + case 1: + if (!sub_80CD554()) + { + if (IsCursorOnCloseBox()) + sub_80CA9C0(); + else + sub_80CA9EC(); + + if (sPSSData->setMosaic) + BoxSetMosaic(); + sPSSData->state = 0; + } + break; + case 2: + if (!ScrollToBox()) + { + SetCurrentBox(sPSSData->newCurrBoxId); + if (!sInPartyMenu && !IsMonBeingMoved()) + { + sub_80CE00C(); + BoxSetMosaic(); + } + + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) + { + sub_80CFECC(); + sPSSData->state = 11; + } + else + { + sPSSData->state = 0; + } + } + break; + case 3: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + sPSSData->state = 0; + } + break; + case 4: + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_LAST_POKE); + sPSSData->state = 6; + break; + case 5: + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_PLEASE_REMOVE_MAIL); + sPSSData->state = 6; + break; + case 6: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + SetPSSCallback(Cb_MainPSS); + } + break; + case 7: + if (!sub_80D01E4()) + sPSSData->state = 0; + break; + case 8: + if (!sub_80D01E4()) + SetPSSCallback(Cb_MoveMon); + break; + case 9: + if (!sub_80D01E4()) + { + if (sPSSData->setMosaic) + BoxSetMosaic(); + sPSSData->state = 0; + } + break; + case 10: + if (!sub_80D1218()) + { + SetUpScrollToBox(sPSSData->newCurrBoxId); + sPSSData->state = 2; + } + break; + case 11: + if (!sub_80D1218()) + sPSSData->state = 0; + break; + } +} + +static void Cb_ShowPartyPokemon(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + SetUpDoShowPartyMenu(); + sPSSData->state++; + break; + case 1: + if (!DoShowPartyMenu()) + SetPSSCallback(Cb_MainPSS); + break; + } +} + +static void Cb_HidePartyPokemon(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + PlaySE(SE_SELECT); + SetUpHidePartyMenu(); + sPSSData->state++; + break; + case 1: + if (!HidePartyMenu()) + { + sub_80CDBF8(sub_80CDC2C()); + sPSSData->state++; + } + break; + case 2: + if (!sub_80CD554()) + { + if (sPSSData->setMosaic) + BoxSetMosaic(); + SetPSSCallback(Cb_MainPSS); + } + break; + } +} + +static void Cb_OnSelectedMon(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + if (!sub_80CA2B8()) + { + PlaySE(SE_SELECT); + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + PrintStorageActionText(PC_TEXT_IS_SELECTED); + else if (IsActiveItemMoving() || sPSSData->cursorMonItem != 0) + PrintStorageActionText(PC_TEXT_IS_SELECTED2); + else + PrintStorageActionText(PC_TEXT_GIVE_TO_MON); + + AddMenu(); + sPSSData->state = 1; + } + break; + case 1: // debug? + if (!sub_80D00A8()) + sPSSData->state = 2; + break; + case 2: + switch (sub_80D00AC()) + { + case -1: + case 0: + ClearBottomWindow(); + SetPSSCallback(Cb_MainPSS); + break; + case 3: + if (CanMovePartyMon()) + { + sPSSData->state = 3; + } + else + { + PlaySE(SE_SELECT); + ClearBottomWindow(); + SetPSSCallback(Cb_MoveMon); + } + break; + case 5: + PlaySE(SE_SELECT); + ClearBottomWindow(); + SetPSSCallback(Cb_PlaceMon); + break; + case 4: + if (!CanShiftMon()) + { + sPSSData->state = 3; + } + else + { + PlaySE(SE_SELECT); + ClearBottomWindow(); + SetPSSCallback(Cb_ShiftMon); + } + break; + case 2: + PlaySE(SE_SELECT); + ClearBottomWindow(); + SetPSSCallback(Cb_WithdrawMon); + break; + case 1: + if (CanMovePartyMon()) + { + sPSSData->state = 3; + } + else if (ItemIsMail(sPSSData->cursorMonItem)) + { + sPSSData->state = 4; + } + else + { + PlaySE(SE_SELECT); + ClearBottomWindow(); + SetPSSCallback(Cb_DepositMenu); + } + break; + case 7: + if (CanMovePartyMon()) + { + sPSSData->state = 3; + } + else if (sPSSData->cursorMonIsEgg) + { + sPSSData->state = 5; // Cannot release an Egg. + } + else if (ItemIsMail(sPSSData->cursorMonItem)) + { + sPSSData->state = 4; + } + else + { + PlaySE(SE_SELECT); + SetPSSCallback(Cb_ReleaseMon); + } + break; + case 6: + PlaySE(SE_SELECT); + SetPSSCallback(Cb_ShowMonSummary); + break; + case 8: + PlaySE(SE_SELECT); + SetPSSCallback(Cb_ShowMarkMenu); + break; + case 12: + PlaySE(SE_SELECT); + SetPSSCallback(Cb_TakeItemForMoving); + break; + case 13: + PlaySE(SE_SELECT); + SetPSSCallback(Cb_GiveMovingItemToMon); + break; + case 16: + SetPSSCallback(Cb_ItemToBag); + break; + case 15: + PlaySE(SE_SELECT); + SetPSSCallback(Cb_SwitchSelectedItem); + break; + case 14: + PlaySE(SE_SELECT); + SetPSSCallback(Cb_GiveItemFromBag); + break; + case 17: + SetPSSCallback(Cb_ShowItemInfo); + break; + } + break; + case 3: + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_LAST_POKE); + sPSSData->state = 6; + break; + case 5: + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_CANT_RELEASE_EGG); + sPSSData->state = 6; + break; + case 4: + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_PLEASE_REMOVE_MAIL); + sPSSData->state = 6; + break; + case 6: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + SetPSSCallback(Cb_MainPSS); + } + break; + } +} + +static void Cb_MoveMon(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + InitMonPlaceChange(0); + sPSSData->state++; + break; + case 1: + if (!DoMonPlaceChange()) + { + if (sInPartyMenu) + SetPSSCallback(Cb_HandleMovingMonFromParty); + else + SetPSSCallback(Cb_MainPSS); + } + break; + } +} + +static void Cb_PlaceMon(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + InitMonPlaceChange(1); + sPSSData->state++; + break; + case 1: + if (!DoMonPlaceChange()) + { + if (sInPartyMenu) + SetPSSCallback(Cb_HandleMovingMonFromParty); + else + SetPSSCallback(Cb_MainPSS); + } + break; + } +} + +static void Cb_ShiftMon(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + InitMonPlaceChange(2); + sPSSData->state++; + break; + case 1: + if (!DoMonPlaceChange()) + { + BoxSetMosaic(); + SetPSSCallback(Cb_MainPSS); + } + break; + } +} + +static void Cb_WithdrawMon(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + if (CalculatePlayerPartyCount() == PARTY_SIZE) + { + PrintStorageActionText(PC_TEXT_PARTY_FULL); + sPSSData->state = 1; + } + else + { + sub_80CDC18(); + InitMonPlaceChange(0); + sPSSData->state = 2; + } + break; + case 1: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + SetPSSCallback(Cb_MainPSS); + } + break; + case 2: + if (!DoMonPlaceChange()) + { + SetMovingMonPriority(1); + SetUpDoShowPartyMenu(); + sPSSData->state++; + } + break; + case 3: + if (!DoShowPartyMenu()) + { + InitMonPlaceChange(1); + sPSSData->state++; + } + break; + case 4: + if (!DoMonPlaceChange()) + { + sub_80CAB20(); + sPSSData->state++; + } + break; + case 5: + SetPSSCallback(Cb_HidePartyPokemon); + break; + } +} + +static void Cb_DepositMenu(u8 taskId) +{ + u8 boxId; + + switch (sPSSData->state) + { + case 0: + PrintStorageActionText(PC_TEXT_DEPOSIT_IN_WHICH_BOX); + sub_80C77E8(&sPSSData->field_1E5C, TAG_TILE_A, TAG_PAL_DAC7, 3, FALSE); + sub_80C78D4(gUnknown_02039D0E); + sPSSData->state++; + break; + case 1: + boxId = HandleBoxChooseSelectionInput(); + if (boxId == 200) + { + // no box chosen yet + } + else if (boxId == 201) + { + ClearBottomWindow(); + sub_80C78E4(); + sub_80C7890(); + SetPSSCallback(Cb_MainPSS); + } + else + { + if (TryStorePartyMonInBox(boxId)) + { + gUnknown_02039D0E = boxId; + ClearBottomWindow(); + sub_80C78E4(); + sub_80C7890(); + sPSSData->state = 2; + } + else + { + PrintStorageActionText(PC_TEXT_BOX_IS_FULL); + sPSSData->state = 4; + } + } + break; + case 2: + CompactPartySlots(); + sub_80CB950(); + sPSSData->state++; + break; + case 3: + if (!sub_80CB9BC()) + { + sub_80CE22C(); + BoxSetMosaic(); + sub_80CAB20(); + SetPSSCallback(Cb_MainPSS); + } + break; + case 4: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + PrintStorageActionText(PC_TEXT_DEPOSIT_IN_WHICH_BOX); + sPSSData->state = 1; + } + break; + } +} + +static void Cb_ReleaseMon(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + PrintStorageActionText(PC_TEXT_RELEASE_POKE); + ShowYesNoWindow(1); + sPSSData->state++; + // fallthrough + case 1: + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case MENU_B_PRESSED: + case 1: + ClearBottomWindow(); + SetPSSCallback(Cb_MainPSS); + break; + case 0: + ClearBottomWindow(); + InitCanRelaseMonVars(); + sub_80CE250(); + sPSSData->state++; + break; + } + break; + case 2: + RunCanReleaseMon(); + if (!sub_80CE2A8()) + { + while (1) + { + s8 r0 = RunCanReleaseMon(); + if (r0 == 1) + { + sPSSData->state++; + break; + } + else if (r0 == 0) + { + sPSSData->state = 8; // Can't release the mon. + break; + } + } + } + break; + case 3: + ReleaseMon(); + RefreshCursorMonData(); + PrintStorageActionText(PC_TEXT_WAS_RELEASED); + sPSSData->state++; + break; + case 4: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + PrintStorageActionText(PC_TEXT_BYE_BYE); + sPSSData->state++; + } + break; + case 5: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + if (sInPartyMenu) + { + CompactPartySlots(); + sub_80CB950(); + sPSSData->state++; + } + else + { + sPSSData->state = 7; + } + } + break; + case 6: + if (!sub_80CB9BC()) + { + sub_80CE00C(); + BoxSetMosaic(); + sub_80CAB20(); + sPSSData->state++; + } + break; + case 7: + SetPSSCallback(Cb_MainPSS); + break; + case 8: + PrintStorageActionText(PC_TEXT_WAS_RELEASED); + sPSSData->state++; + break; + case 9: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + PrintStorageActionText(PC_TEXT_SURPRISE); + sPSSData->state++; + } + break; + case 10: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + sub_80CC064(); + sPSSData->state++; + } + break; + case 11: + if (!sub_80CC0A0()) + { + sub_80CE324(); + PrintStorageActionText(PC_TEXT_CAME_BACK); + sPSSData->state++; + } + break; + case 12: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + PrintStorageActionText(PC_TEXT_WORRIED); + sPSSData->state++; + } + break; + case 13: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + SetPSSCallback(Cb_MainPSS); + } + break; + } +} + +static void Cb_ShowMarkMenu(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + PrintStorageActionText(PC_TEXT_MARK_POKE); + sPSSData->field_DA4.markings = sPSSData->cursorMonMarkings; + sub_811FAA4(sPSSData->cursorMonMarkings, 0xb0, 0x10); + sPSSData->state++; + break; + case 1: + if (!sub_811FBA4()) + { + sub_811FAF8(); + ClearBottomWindow(); + SetMonMarkings(sPSSData->field_DA4.markings); + RefreshCursorMonData(); + SetPSSCallback(Cb_MainPSS); + } + break; + } +} + +static void Cb_TakeItemForMoving(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + if (!ItemIsMail(sPSSData->cursorMonItem)) + { + ClearBottomWindow(); + sPSSData->state++; + } + else + { + SetPSSCallback(Cb_PrintCantStoreMail); + } + break; + case 1: + sub_80CFE54(2); + Item_FromMonToMoving((sInPartyMenu != FALSE) ? CURSOR_AREA_IN_PARTY : CURSOR_AREA_IN_BOX, GetBoxCursorPosition()); + sPSSData->state++; + break; + case 2: + if (!sub_80D1218()) + { + sub_80CFE54(3); + ClearBottomWindow(); + sub_80CE00C(); + PrintCursorMonInfo(); + sPSSData->state++; + } + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + SetPSSCallback(Cb_MainPSS); + break; + } +} + +static void Cb_GiveMovingItemToMon(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + ClearBottomWindow(); + sPSSData->state++; + break; + case 1: + sub_80CFE54(2); + Item_GiveMovingToMon((sInPartyMenu != FALSE) ? CURSOR_AREA_IN_PARTY : CURSOR_AREA_IN_BOX, GetBoxCursorPosition()); + sPSSData->state++; + break; + case 2: + if (!sub_80D1218()) + { + sub_80CFE54(0); + sub_80CE00C(); + PrintCursorMonInfo(); + PrintStorageActionText(PC_TEXT_ITEM_IS_HELD); + sPSSData->state++; + } + break; + case 3: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + sPSSData->state++; + } + break; + case 4: + if (!IsDma3ManagerBusyWithBgCopy()) + SetPSSCallback(Cb_MainPSS); + break; + } +} + +static void Cb_ItemToBag(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + if (!AddBagItem(sPSSData->cursorMonItem, 1)) + { + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_BAG_FULL); + sPSSData->state = 3; + } + else + { + PlaySE(SE_SELECT); + Item_TakeMons((sInPartyMenu != FALSE) ? CURSOR_AREA_IN_PARTY : CURSOR_AREA_IN_BOX, GetBoxCursorPosition()); + sPSSData->state = 1; + } + break; + case 1: + if (!sub_80D1218()) + { + PrintStorageActionText(PC_TEXT_PLACED_IN_BAG); + sPSSData->state = 2; + } + break; + case 2: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + sub_80CE00C(); + PrintCursorMonInfo(); + sPSSData->state = 4; + } + break; + case 4: + if (!IsDma3ManagerBusyWithBgCopy()) + SetPSSCallback(Cb_MainPSS); + break; + case 3: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + SetPSSCallback(Cb_MainPSS); + } + break; + } +} + +static void Cb_SwitchSelectedItem(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + if (!ItemIsMail(sPSSData->cursorMonItem)) + { + ClearBottomWindow(); + sPSSData->state++; + } + else + { + SetPSSCallback(Cb_PrintCantStoreMail); + } + break; + case 1: + sub_80CFE54(2); + Item_SwitchMonsWithMoving((sInPartyMenu != FALSE) ? CURSOR_AREA_IN_PARTY : CURSOR_AREA_IN_BOX, GetBoxCursorPosition()); + sPSSData->state++; + break; + case 2: + if (!sub_80D1218()) + { + sub_80CFE54(3); + sub_80CE00C(); + PrintCursorMonInfo(); + PrintStorageActionText(PC_TEXT_CHANGED_TO_ITEM); + sPSSData->state++; + } + break; + case 3: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + sPSSData->state++; + } + break; + case 4: + if (!IsDma3ManagerBusyWithBgCopy()) + SetPSSCallback(Cb_MainPSS); + break; + } +} + +static void Cb_ShowItemInfo(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + ClearBottomWindow(); + sPSSData->state++; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + { + PlaySE(SE_WIN_OPEN); + PrintItemDescription(); + sub_80D1818(); + sPSSData->state++; + } + break; + case 2: + if (!sub_80D184C()) + sPSSData->state++; + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + sPSSData->state++; + break; + case 4: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + PlaySE(SE_WIN_OPEN); + sPSSData->state++; + } + break; + case 5: + if (!sub_80D18E4()) + sPSSData->state++; + break; + case 6: + if (!IsDma3ManagerBusyWithBgCopy()) + SetPSSCallback(Cb_MainPSS); + break; + } +} + +static void Cb_CloseBoxWhileHoldingItem(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + PlaySE(SE_SELECT); + PrintStorageActionText(PC_TEXT_PUT_IN_BAG); + ShowYesNoWindow(0); + sPSSData->state = 1; + break; + case 1: + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case MENU_B_PRESSED: + case 1: + ClearBottomWindow(); + SetPSSCallback(Cb_MainPSS); + break; + case 0: + if (AddBagItem(sPSSData->movingItem, 1) == TRUE) + { + ClearBottomWindow(); + sPSSData->state = 3; + } + else + { + PrintStorageActionText(PC_TEXT_BAG_FULL); + sPSSData->state = 2; + } + break; + } + break; + case 2: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + sPSSData->state = 5; + } + break; + case 3: + sub_80D1194(); + sPSSData->state = 4; + break; + case 4: + if (!sub_80D1218()) + { + sub_80CFE54(0); + SetPSSCallback(Cb_MainPSS); + } + break; + case 5: + if (!IsDma3ManagerBusyWithBgCopy()) + SetPSSCallback(Cb_MainPSS); + break; + } +} + +static void Cb_HandleMovingMonFromParty(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + CompactPartySlots(); + sub_80CB950(); + sPSSData->state++; + break; + case 1: + if (!sub_80CB9BC()) + { + sub_80CAB20(); + SetPSSCallback(Cb_MainPSS); + } + break; + } +} + +static void Cb_PrintCantStoreMail(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + PrintStorageActionText(PC_TEXT_CANT_STORE_MAIL); + sPSSData->state++; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + sPSSData->state++; + break; + case 2: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + sPSSData->state++; + } + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + SetPSSCallback(Cb_MainPSS); + break; + } +} + +static void Cb_HandleBoxOptions(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + PrintStorageActionText(PC_TEXT_WHAT_YOU_DO); + AddMenu(); + sPSSData->state++; + break; + case 1: + if (sub_80D00A8()) + return; + sPSSData->state++; + case 2: + switch (sub_80D00AC()) + { + case -1: + case 0: + sub_80CD1A8(TRUE); + ClearBottomWindow(); + SetPSSCallback(Cb_MainPSS); + break; + case 11: + PlaySE(SE_SELECT); + SetPSSCallback(Cb_NameBox); + break; + case 10: + PlaySE(SE_SELECT); + ClearBottomWindow(); + SetPSSCallback(Cb_HandleWallpapers); + break; + case 9: + PlaySE(SE_SELECT); + ClearBottomWindow(); + SetPSSCallback(Cb_JumpBox); + break; + } + break; + } +} + +static void Cb_HandleWallpapers(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + AddWallpaperSetsMenu(); + PrintStorageActionText(PC_TEXT_PICK_A_THEME); + sPSSData->state++; + break; + case 1: + if (!sub_80D00A8()) + sPSSData->state++; + break; + case 2: + sPSSData->wallpaperSetId = sub_80D00AC(); + switch (sPSSData->wallpaperSetId) + { + case -1: + sub_80CD1A8(TRUE); + ClearBottomWindow(); + SetPSSCallback(Cb_MainPSS); + break; + case 18 ... 21: + PlaySE(SE_SELECT); + sub_80D013C(); + sPSSData->wallpaperSetId -= 18; + sPSSData->state++; + break; + // New wallpaper from Walda. + case 22: + PlaySE(SE_SELECT); + sPSSData->wallpaperId = 16; + sub_80D013C(); + ClearBottomWindow(); + sPSSData->state = 6; + break; + } + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + { + AddWallpapersMenu(sPSSData->wallpaperSetId); + PrintStorageActionText(PC_TEXT_PICK_A_WALLPAPER); + sPSSData->state++; + } + break; + case 4: + sPSSData->wallpaperId = sub_80D00AC(); + switch (sPSSData->wallpaperId) + { + case -2: + break; + case -1: + ClearBottomWindow(); + sPSSData->state = 0; + break; + default: + PlaySE(SE_SELECT); + ClearBottomWindow(); + sPSSData->wallpaperId -= 23; + SetWallpaperForCurrentBox(sPSSData->wallpaperId); + sPSSData->state++; + break; + } + break; + case 5: + if (!DoWallpaperGfxChange()) + { + sub_80CD1A8(TRUE); + SetPSSCallback(Cb_MainPSS); + } + break; + case 6: + if (!IsDma3ManagerBusyWithBgCopy()) + { + SetWallpaperForCurrentBox(sPSSData->wallpaperId); + sPSSData->state = 5; + } + break; + } +} + +static void Cb_JumpBox(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + PrintStorageActionText(PC_TEXT_JUMP_TO_WHICH_BOX); + sub_80C77E8(&sPSSData->field_1E5C, TAG_TILE_A, TAG_PAL_DAC7, 3, FALSE); + sub_80C78D4(StorageGetCurrentBox()); + sPSSData->state++; + break; + case 1: + sPSSData->newCurrBoxId = HandleBoxChooseSelectionInput(); + switch (sPSSData->newCurrBoxId) + { + case 200: + break; + default: + ClearBottomWindow(); + sub_80C78E4(); + sub_80C7890(); + if (sPSSData->newCurrBoxId == 201 || sPSSData->newCurrBoxId == StorageGetCurrentBox()) + { + sub_80CD1A8(TRUE); + SetPSSCallback(Cb_MainPSS); + } + else + { + sPSSData->state++; + } + break; + } + break; + case 2: + SetUpScrollToBox(sPSSData->newCurrBoxId); + sPSSData->state++; + break; + case 3: + if (!ScrollToBox()) + { + SetCurrentBox(sPSSData->newCurrBoxId); + SetPSSCallback(Cb_MainPSS); + } + break; + } +} + +static void Cb_NameBox(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + sub_80CE760(); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + sPSSData->state++; + break; + case 1: + if (!UpdatePaletteFade()) + { + sWhichToReshow = 1; + sPSSData->screenChangeType = SCREEN_CHANGE_NAME_BOX; + SetPSSCallback(Cb_ChangeScreen); + } + break; + } +} + +static void Cb_ShowMonSummary(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + sub_80CE7E8(); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + sPSSData->state++; + break; + case 1: + if (!UpdatePaletteFade()) + { + sWhichToReshow = 0; + sPSSData->screenChangeType = SCREEN_CHANGE_SUMMARY_SCREEN; + SetPSSCallback(Cb_ChangeScreen); + } + break; + } +} + +static void Cb_GiveItemFromBag(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + sPSSData->state++; + break; + case 1: + if (!UpdatePaletteFade()) + { + sWhichToReshow = 2; + sPSSData->screenChangeType = SCREEN_CHANGE_ITEM_FROM_BAG; + SetPSSCallback(Cb_ChangeScreen); + } + break; + } +} + +static void Cb_OnCloseBoxPressed(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + if (IsMonBeingMoved()) + { + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_HOLDING_POKE); + sPSSData->state = 1; + } + else if (IsActiveItemMoving()) + { + SetPSSCallback(Cb_CloseBoxWhileHoldingItem); + } + else + { + PlaySE(SE_SELECT); + PrintStorageActionText(PC_TEXT_EXIT_BOX); + ShowYesNoWindow(0); + sPSSData->state = 2; + } + break; + case 1: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + SetPSSCallback(Cb_MainPSS); + } + break; + case 2: + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case MENU_B_PRESSED: + case 1: + ClearBottomWindow(); + SetPSSCallback(Cb_MainPSS); + break; + case 0: + PlaySE(SE_PC_OFF); + ClearBottomWindow(); + sPSSData->state++; + break; + } + break; + case 3: + sub_80F9BF4(0x14, 0, 1); + sPSSData->state++; + break; + case 4: + if (!sub_80F9C30()) + { + sub_80CABE0(); + gPlayerPartyCount = CalculatePlayerPartyCount(); + sPSSData->screenChangeType = SCREEN_CHANGE_EXIT_BOX; + SetPSSCallback(Cb_ChangeScreen); + } + break; + } +} + +static void Cb_OnBPressed(u8 taskId) +{ + switch (sPSSData->state) + { + case 0: + if (IsMonBeingMoved()) + { + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_HOLDING_POKE); + sPSSData->state = 1; + } + else if (IsActiveItemMoving()) + { + SetPSSCallback(Cb_CloseBoxWhileHoldingItem); + } + else + { + PlaySE(SE_SELECT); + PrintStorageActionText(PC_TEXT_CONTINUE_BOX); + ShowYesNoWindow(0); + sPSSData->state = 2; + } + break; + case 1: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + SetPSSCallback(Cb_MainPSS); + } + break; + case 2: + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case 0: + ClearBottomWindow(); + SetPSSCallback(Cb_MainPSS); + break; + case 1: + case MENU_B_PRESSED: + PlaySE(SE_PC_OFF); + ClearBottomWindow(); + sPSSData->state++; + break; + } + break; + case 3: + sub_80F9BF4(0x14, 0, 0); + sPSSData->state++; + break; + case 4: + if (!sub_80F9C30()) + { + sub_80CABE0(); + gPlayerPartyCount = CalculatePlayerPartyCount(); + sPSSData->screenChangeType = SCREEN_CHANGE_EXIT_BOX; + SetPSSCallback(Cb_ChangeScreen); + } + break; + } +} + +static void Cb_ChangeScreen(u8 taskId) +{ + struct BoxPokemon *boxMons; + u8 mode, monIndex, maxMonIndex; + u8 screenChangeType = sPSSData->screenChangeType; + + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS && IsActiveItemMoving() == TRUE) + gUnknown_02039D12 = GetMovingItem(); + else + gUnknown_02039D12 = 0; + + switch (screenChangeType) + { + case SCREEN_CHANGE_EXIT_BOX: + default: + FreePSSData(); + SetMainCallback2(Cb2_ExitPSS); + break; + case SCREEN_CHANGE_SUMMARY_SCREEN: + boxMons = sPSSData->field_218C.box; + monIndex = sPSSData->field_2187; + maxMonIndex = sPSSData->field_2186; + mode = sPSSData->field_2188; + FreePSSData(); + if (mode == PSS_MODE_NORMAL && boxMons == &gUnknown_02039D14.box) + ShowPokemonSummaryScreenSet40EF(mode, boxMons, monIndex, maxMonIndex, Cb2_ReturnToPSS); + else + ShowPokemonSummaryScreen(mode, boxMons, monIndex, maxMonIndex, Cb2_ReturnToPSS); + break; + case SCREEN_CHANGE_NAME_BOX: + FreePSSData(); + DoNamingScreen(NAMING_SCREEN_BOX, GetBoxNamePtr(StorageGetCurrentBox()), 0, 0, 0, Cb2_ReturnToPSS); + break; + case SCREEN_CHANGE_ITEM_FROM_BAG: + FreePSSData(); + GoToBagMenu(11, 0, Cb2_ReturnToPSS); + break; + } + + DestroyTask(taskId); +} + +static void GiveChosenBagItem(void) +{ + u16 item = gSpecialVar_ItemId; + + if (item != 0) + { + u8 id = GetBoxCursorPosition(); + + if (sInPartyMenu) + SetMonData(&gPlayerParty[id], MON_DATA_HELD_ITEM, &item); + else + SetCurrentBoxMonData(id, MON_DATA_HELD_ITEM, &item); + + RemoveBagItem(item, 1); + } +} + +static void FreePSSData(void) +{ + sub_80D25F0(); + sub_80D01B8(); + FREE_AND_SET_NULL(sPSSData); + FreeAllWindowBuffers(); +} + +static void SetScrollingBackground(void) +{ + SetGpuReg(REG_OFFSET_BG3CNT, BGCNT_PRIORITY(3) | BGCNT_CHARBASE(3) | BGCNT_16COLOR | BGCNT_SCREENBASE(31)); + DecompressAndLoadBgGfxUsingHeap(3, gPokemonStorageScrollingBGTileset, 0, 0, 0); + LZ77UnCompVram(gPokemonStorageScrollingBGTilemap, (void *)VRAM + 0xF800); +} + +static void ScrollBackground(void) +{ + ChangeBgX(3, 128, 1); + ChangeBgY(3, 128, 2); +} + +static void LoadPSSMenuGfx(void) +{ + InitBgsFromTemplates(0, gUnknown_08572734, ARRAY_COUNT(gUnknown_08572734)); + DecompressAndLoadBgGfxUsingHeap(1, gPSSMenu_Gfx, 0, 0, 0); + LZ77UnCompWram(gUnknown_085722A0, sPSSData->field_5AC4); + SetBgTilemapBuffer(1, sPSSData->field_5AC4); + ShowBg(1); + schedule_bg_copy_tilemap_to_vram(1); +} + +static bool8 InitPSSWindows(void) +{ + if (!InitWindows(gUnknown_08572714)) + { + return FALSE; + } + else + { + DeactivateAllTextPrinters(); + return TRUE; + } +} + +static void LoadWaveformSpritePalette(void) +{ + LoadSpritePalette(&gWaveformSpritePalette); +} + +static void sub_80CA0D8(void) +{ + LoadPalette(gUnknown_085723DC, 0, 0x20); + LoadPalette(gUnknown_085723FC, 0x20, 0x20); + LoadPalette(gUnknown_085726F4, 0xF0, 0x20); + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + LoadPalette(gUnknown_0857241C, 0x30, 0x20); + else + LoadPalette(gUnknown_0857243C, 0x30, 0x20); + + SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(1) | BGCNT_CHARBASE(1) | BGCNT_16COLOR | BGCNT_SCREENBASE(30)); + LoadCursorMonSprite(); + sub_80CA154(); + sub_80CA1C4(); + RefreshCursorMonData(); +} + +static void sub_80CA154(void) +{ + sPSSData->field_D94 = sub_811FFB4(TAG_TILE_10, TAG_PAL_DAC8, NULL); + sPSSData->field_D94->oam.priority = 1; + sPSSData->field_D94->subpriority = 1; + sPSSData->field_D94->pos1.x = 40; + sPSSData->field_D94->pos1.y = 150; + sPSSData->field_DA0 = (void*) OBJ_VRAM0 + 32 * GetSpriteTileStartByTag(TAG_TILE_10); +} + +static void sub_80CA1C4(void) +{ + u16 i; + struct SpriteSheet sheet = gWaveformSpriteSheet; + + LoadSpriteSheet(&sheet); + for (i = 0; i < 2; i++) + { + u8 spriteId = CreateSprite(&sSpriteTemplate_Waveform, i * 63 + 8, 9, 2); + sPSSData->field_D98[i] = &gSprites[spriteId]; + } +} + +static void RefreshCursorMonData(void) +{ + LoadCursorMonGfx(sPSSData->cursorMonSpecies, sPSSData->cursorMonPersonality); + PrintCursorMonInfo(); + sub_80CA65C(); + schedule_bg_copy_tilemap_to_vram(0); +} + +static void BoxSetMosaic(void) +{ + RefreshCursorMonData(); + if (sPSSData->cursorMonSprite) + { + sPSSData->cursorMonSprite->oam.mosaic = TRUE; + sPSSData->cursorMonSprite->data[0] = 10; + sPSSData->cursorMonSprite->data[1] = 1; + sPSSData->cursorMonSprite->callback = sub_80CA2D0; + SetGpuReg(REG_OFFSET_MOSAIC, (sPSSData->cursorMonSprite->data[0] << 12) | (sPSSData->cursorMonSprite->data[0] << 8)); + } +} + +static u8 sub_80CA2B8(void) +{ + return sPSSData->cursorMonSprite->oam.mosaic; +} + +static void sub_80CA2D0(struct Sprite *sprite) +{ + sprite->data[0] -= sprite->data[1]; + if (sprite->data[0] < 0) + sprite->data[0] = 0; + SetGpuReg(REG_OFFSET_MOSAIC, (sprite->data[0] << 12) | (sprite->data[0] << 8)); + if (sprite->data[0] == 0) + { + sprite->oam.mosaic = FALSE; + sprite->callback = SpriteCallbackDummy; + } +} + +static void LoadCursorMonSprite(void) +{ + u16 i; + u16 tileStart; + u8 palSlot; + u8 spriteId; + struct SpriteSheet sheet = {sPSSData->field_22C4, 0x800, TAG_TILE_2}; + struct SpritePalette palette = {sPSSData->field_2244, TAG_PAL_DAC6}; + struct SpriteTemplate template = sSpriteTemplate_CursorMon; + + for (i = 0; i < 0x800; i++) + sPSSData->field_22C4[i] = 0; + for (i = 0; i < 0x10; i++) + sPSSData->field_2244[i] = 0; + + sPSSData->cursorMonSprite = NULL; + + do + { + tileStart = LoadSpriteSheet(&sheet); + if (tileStart == 0) + break; + + palSlot = LoadSpritePalette(&palette); + if (palSlot == 0xFF) + break; + + spriteId = CreateSprite(&template, 40, 48, 0); + if (spriteId == MAX_SPRITES) + break; + + sPSSData->cursorMonSprite = &gSprites[spriteId]; + sPSSData->field_223A = palSlot * 16 + 0x100; + sPSSData->field_223C = (void*) OBJ_VRAM0 + tileStart * 32; + } while (0); + + if (sPSSData->cursorMonSprite == NULL) + { + FreeSpriteTilesByTag(TAG_TILE_2); + FreeSpritePaletteByTag(TAG_PAL_DAC6); + } +} + +static void LoadCursorMonGfx(u16 species, u32 pid) +{ + if (sPSSData->cursorMonSprite == NULL) + return; + + if (species != SPECIES_NONE) + { + LoadSpecialPokePic(&gMonFrontPicTable[species], sPSSData->field_22C4, species, pid, TRUE); + LZ77UnCompWram(sPSSData->cursorMonPalette, sPSSData->field_2244); + CpuCopy32(sPSSData->field_22C4, sPSSData->field_223C, 0x800); + LoadPalette(sPSSData->field_2244, sPSSData->field_223A, 0x20); + sPSSData->cursorMonSprite->invisible = FALSE; + } + else + { + sPSSData->cursorMonSprite->invisible = TRUE; + } +} + +static void PrintCursorMonInfo(void) +{ + FillWindowPixelBuffer(0, 0x11); + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + { + AddTextPrinterParameterized(0, 1, sPSSData->cursorMonNickText, 6, 0, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, 2, sPSSData->cursorMonSpeciesName, 6, 15, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, 2, sPSSData->cursorMonGenderLvlText, 10, 29, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, 0, sPSSData->cursorMonItemName, 6, 43, TEXT_SPEED_FF, NULL); + } + else + { + AddTextPrinterParameterized(0, 0, sPSSData->cursorMonItemName, 6, 0, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, 1, sPSSData->cursorMonNickText, 6, 13, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, 2, sPSSData->cursorMonSpeciesName, 6, 28, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, 2, sPSSData->cursorMonGenderLvlText, 10, 42, TEXT_SPEED_FF, NULL); + } + + CopyWindowToVram(0, 2); + if (sPSSData->cursorMonSpecies != SPECIES_NONE) + { + sub_8120084(sPSSData->cursorMonMarkings, sPSSData->field_DA0); + sPSSData->field_D94->invisible = FALSE; + } + else + { + sPSSData->field_D94->invisible = TRUE; + } +} + +static void sub_80CA65C(void) +{ + u16 i; + + if (sPSSData->cursorMonSpecies != SPECIES_NONE) + { + sub_80D27AC(0, 0, 0, 8, 2); + for (i = 0; i < 2; i++) + StartSpriteAnimIfDifferent(sPSSData->field_D98[i], i * 2 + 1); + } + else + { + sub_80D27AC(0, 0, 2, 8, 2); + for (i = 0; i < 2; i++) + StartSpriteAnim(sPSSData->field_D98[i], i * 2); + } + + sub_80D2918(0); + schedule_bg_copy_tilemap_to_vram(1); +} + +static void sub_80CA704(void) +{ + LZ77UnCompWram(gUnknown_08DD36C8, sPSSData->field_B0); + LoadPalette(gPSSMenu_Pal, 0x10, 0x20); + sub_80D2644(1, 1, sPSSData->field_B0, 12, 22); + sub_80D2644(2, 1, gUnknown_0857245C, 9, 4); + sub_80D2770(1, 10, 0); + sub_80D2770(2, 21, 0); + sub_80CAA74(); + if (sInPartyMenu) + { + sub_80CA984(TRUE); + CreatePartyMonsSprites(TRUE); + sub_80D2918(2); + sub_80D2918(1); + } + else + { + sub_80D27AC(1, 0, 20, 12, 2); + sub_80CA984(TRUE); + sub_80D2918(1); + sub_80D2918(2); + } + + schedule_bg_copy_tilemap_to_vram(1); + sPSSData->unk_02C7 = 0; +} + +static void SetUpShowPartyMenu(void) +{ + sPSSData->field_2C0 = 20; + sPSSData->field_2C2 = 2; + sPSSData->field_2C5 = 0; + CreatePartyMonsSprites(FALSE); +} + +static bool8 ShowPartyMenu(void) +{ + if (sPSSData->field_2C5 == 20) + return FALSE; + + sPSSData->field_2C0--; + sPSSData->field_2C2++; + sub_80D27F4(1, 3, 1); + sub_80D2918(1); + schedule_bg_copy_tilemap_to_vram(1); + sub_80CBAF0(8); + if (++sPSSData->field_2C5 == 20) + { + sInPartyMenu = TRUE; + return FALSE; + } + else + { + return TRUE; + } +} + +static void SetUpHidePartyMenu(void) +{ + sPSSData->field_2C0 = 0; + sPSSData->field_2C2 = 22; + sPSSData->field_2C5 = 0; + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) + sub_80D11CC(); +} + +static bool8 HidePartyMenu(void) +{ + if (sPSSData->field_2C5 != 20) + { + sPSSData->field_2C0++; + sPSSData->field_2C2--; + sub_80D27F4(1, 3, -1); + sub_80D2918(1); + FillBgTilemapBufferRect_Palette0(1, 0x100, 10, sPSSData->field_2C2, 12, 1); + sub_80CBAF0(-8); + if (++sPSSData->field_2C5 != 20) + { + schedule_bg_copy_tilemap_to_vram(1); + return TRUE; + } + else + { + sInPartyMenu = FALSE; + DestroyAllPartyMonIcons(); + CompactPartySlots(); + sub_80D27AC(2, 0, 0, 9, 2); + sub_80D2918(2); + schedule_bg_copy_tilemap_to_vram(1); + return FALSE; + } + } + + return FALSE; +} + +static void sub_80CA984(bool8 arg0) +{ + if (arg0) + sub_80D27AC(2, 0, 0, 9, 2); + else + sub_80D27AC(2, 0, 2, 9, 2); + + sub_80D2918(2); + schedule_bg_copy_tilemap_to_vram(1); +} + +static void sub_80CA9C0(void) +{ + sPSSData->unk_02C7 = 1; + sPSSData->unk_02C8 = 30; + sPSSData->unk_02C9 = TRUE; +} + +static void sub_80CA9EC(void) +{ + if (sPSSData->unk_02C7) + { + sPSSData->unk_02C7 = 0; + sub_80CA984(TRUE); + } +} + +static void sub_80CAA14(void) +{ + if (sPSSData->unk_02C7 && ++sPSSData->unk_02C8 > 30) + { + sPSSData->unk_02C8 = 0; + sPSSData->unk_02C9 = (sPSSData->unk_02C9 == FALSE); + sub_80CA984(sPSSData->unk_02C9); + } +} + +static void sub_80CAA74(void) +{ + u8 i; + + for (i = 1; i < PARTY_SIZE; i++) + { + s32 species = GetMonData(gPlayerParty + i, MON_DATA_SPECIES); + sub_80CAAA8(i, (species != SPECIES_NONE)); + } +} + +static void sub_80CAAA8(u8 arg0, bool8 isPartyMon) +{ + u16 i, j, index; + const u16 *data; + + if (isPartyMon) + data = gUnknown_085724A4; + else + data = gUnknown_085724BC; + + index = 3 * (3 * (arg0 - 1) + 1); + index *= 4; + index += 7; + for (i = 0; i < 3; i++) + { + for (j = 0; j < 4; j++) + { + sPSSData->field_B0[index + j] = data[j]; + } + data += 4; + index += 12; + } +} + +static void sub_80CAB20(void) +{ + sub_80CAA74(); + sub_80D27AC(1, 0, 0, 12, 22); + sub_80D2918(1); + schedule_bg_copy_tilemap_to_vram(1); +} + +static void SetUpDoShowPartyMenu(void) +{ + sPSSData->showPartyMenuState = 0; + PlaySE(SE_WIN_OPEN); + SetUpShowPartyMenu(); +} + +static bool8 DoShowPartyMenu(void) +{ + switch (sPSSData->showPartyMenuState) + { + case 0: + if (!ShowPartyMenu()) + { + sub_80CDBA0(); + sPSSData->showPartyMenuState++; + } + break; + case 1: + if (!sub_80CD554()) + { + if (sPSSData->setMosaic) + BoxSetMosaic(); + sPSSData->showPartyMenuState++; + } + break; + case 2: + return FALSE; + } + return TRUE; +} + +static void sub_80CABE0(void) +{ + if (gUnknown_02039D10 != StorageGetCurrentBox()) + { + FlagClear(FLAG_SYS_STORAGE_UNKNOWN_FLAG); + VarSet(VAR_STORAGE_UNKNOWN, StorageGetCurrentBox()); + } +} + +static void sub_80CAC1C(void) +{ + SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(29)); + LoadUserWindowBorderGfx(1, 2, 208); + FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 17); + CopyBgTilemapBufferToVram(0); +} + +static void PrintStorageActionText(u8 id) +{ + u8 *txtPtr; + + DynamicPlaceholderTextUtil_Reset(); + switch (gPCStorageActionTexts[id].format) + { + case PC_TEXT_FMT_NORMAL: + break; + case PC_TEXT_FMT_MON_NAME_1: + case PC_TEXT_FMT_MON_NAME_2: + case PC_TEXT_FMT_MON_NAME_3: + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, sPSSData->cursorMonNick); + break; + case PC_TEXT_FMT_MON_NAME_4: + case PC_TEXT_FMT_MON_NAME_5: + case PC_TEXT_FMT_MON_NAME_6: + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, sPSSData->field_21E0); + break; + case PC_TEXT_FMT_ITEM_NAME: + if (IsActiveItemMoving()) + txtPtr = StringCopy(sPSSData->itemName, GetMovingItemName()); + else + txtPtr = StringCopy(sPSSData->itemName, sPSSData->cursorMonItemName); + + while (*(txtPtr - 1) == CHAR_SPACE) + txtPtr--; + + *txtPtr = EOS; + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, sPSSData->itemName); + break; + } + + DynamicPlaceholderTextUtil_ExpandPlaceholders(sPSSData->field_2190, gPCStorageActionTexts[id].text); + FillWindowPixelBuffer(1, 0x11); + AddTextPrinterParameterized(1, 1, sPSSData->field_2190, 0, 1, TEXT_SPEED_FF, NULL); + sub_8098858(1, 2, 14); + PutWindowTilemap(1); + CopyWindowToVram(1, 2); + schedule_bg_copy_tilemap_to_vram(0); +} + +static void ShowYesNoWindow(s8 cursorPos) +{ + CreateYesNoMenu(&sYesNoWindowTemplate, 11, 14, 0); + Menu_MoveCursorNoWrapAround(cursorPos); +} + +static void ClearBottomWindow(void) +{ + sub_8198070(1, FALSE); + schedule_bg_copy_tilemap_to_vram(0); +} + +static void AddWallpaperSetsMenu(void) +{ + InitMenu(); + SetMenuText(18); + SetMenuText(19); + SetMenuText(20); + SetMenuText(21); + if (IsWaldaWallpaperUnlocked()) + SetMenuText(22); + AddMenu(); +} + +static void AddWallpapersMenu(u8 wallpaperSet) +{ + InitMenu(); + switch (wallpaperSet) + { + case 0: + SetMenuText(23); + SetMenuText(24); + SetMenuText(25); + SetMenuText(26); + break; + case 1: + SetMenuText(27); + SetMenuText(28); + SetMenuText(29); + SetMenuText(30); + break; + case 2: + SetMenuText(31); + SetMenuText(32); + SetMenuText(33); + SetMenuText(34); + break; + case 3: + SetMenuText(35); + SetMenuText(36); + SetMenuText(37); + SetMenuText(38); + break; + } + AddMenu(); +} + +static u8 GetCurrentBoxOption(void) +{ + return sCurrentBoxOption; +} + +static void sub_80CAEAC(void) +{ + if (!IsCursorOnBox()) + { + if (sInPartyMenu) + sub_80D0D8C(CURSOR_AREA_IN_PARTY, GetBoxCursorPosition()); + else + sub_80D0D8C(CURSOR_AREA_IN_BOX, GetBoxCursorPosition()); + } + + if (gUnknown_02039D12 != 0) + { + sub_80D0F38(gUnknown_02039D12); + sub_80CFE54(3); + } +} + +static void sub_80CAF04(void) +{ + u16 i; + + LoadMonIconPalettes(); + for (i = 0; i < 40; i++) + sPSSData->field_B08[i] = 0; + for (i = 0; i < 40; i++) + sPSSData->field_B58[i] = 0; + for (i = 0; i < PARTY_SIZE; i++) + sPSSData->partySprites[i] = NULL; + for (i = 0; i < IN_BOX_COUNT; i++) + sPSSData->boxMonsSprites[i] = NULL; + + sPSSData->movingMonSprite = NULL; + sPSSData->field_78C = 0; +} + +static u8 sub_80CAFAC(void) +{ + return (IsCursorInBox() ? 2 : 1); +} + +static void CreateMovingMonIcon(void) +{ + u32 personality = GetMonData(&sPSSData->movingMon, MON_DATA_PERSONALITY); + u16 species = GetMonData(&sPSSData->movingMon, MON_DATA_SPECIES2); + u8 priority = sub_80CAFAC(); + + sPSSData->movingMonSprite = CreateMonIconSprite(species, personality, 0, 0, priority, 7); + sPSSData->movingMonSprite->callback = sub_80CC100; +} + +static 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_COLUMNS; 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); + sPSSData->boxMonsSprites[count] = CreateMonIconSprite(species, personality, 8 * (3 * j) + 100, 8 * (3 * i) + 44, 2, 19 - j); + } + else + { + sPSSData->boxMonsSprites[count] = NULL; + } + boxPosition++; + count++; + } + } + + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) + { + for (boxPosition = 0; boxPosition < IN_BOX_COUNT; boxPosition++) + { + if (GetBoxMonDataAt(boxId, boxPosition, MON_DATA_HELD_ITEM) == 0) + sPSSData->boxMonsSprites[boxPosition]->oam.objMode = 1; + } + } +} + +static 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); + + sPSSData->boxMonsSprites[boxPosition] = CreateMonIconSprite(species, personality, x, y, 2, 19 - (boxPosition % IN_BOX_ROWS)); + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) + sPSSData->boxMonsSprites[boxPosition]->oam.objMode = 1; + } +} + +static void sub_80CB1F0(s16 arg0) +{ + u16 i; + + for (i = 0; i < IN_BOX_COUNT; i++) + { + if (sPSSData->boxMonsSprites[i] != NULL) + { + sPSSData->boxMonsSprites[i]->data[2] = arg0; + sPSSData->boxMonsSprites[i]->data[4] = 1; + sPSSData->boxMonsSprites[i]->callback = sub_80CB278; + } + } +} + +static void sub_80CB234(struct Sprite *sprite) +{ + if (sprite->data[1] != 0) + { + sprite->data[1]--; + sprite->pos1.x += sprite->data[2]; + } + else + { + sPSSData->field_C66--; + sprite->pos1.x = sprite->data[3]; + sprite->callback = SpriteCallbackDummy; + } +} + +static 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; + } +} + +static void DestroyAllIconsInRow(u8 row) +{ + u16 column; + u8 boxPosition = row; + + for (column = 0; column < IN_BOX_COLUMNS; column++) + { + if (sPSSData->boxMonsSprites[boxPosition] != NULL) + { + DestroyBoxMonIcon(sPSSData->boxMonsSprites[boxPosition]); + sPSSData->boxMonsSprites[boxPosition] = NULL; + } + boxPosition += IN_BOX_ROWS; + } +} + +static 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 (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + { + for (i = 0; i < IN_BOX_COLUMNS; i++) + { + if (sPSSData->boxSpecies[boxPosition] != SPECIES_NONE) + { + sPSSData->boxMonsSprites[boxPosition] = CreateMonIconSprite(sPSSData->boxSpecies[boxPosition], + sPSSData->boxPersonalities[boxPosition], + x, y, 2, subpriority); + if (sPSSData->boxMonsSprites[boxPosition] != NULL) + { + sPSSData->boxMonsSprites[boxPosition]->data[1] = times; + sPSSData->boxMonsSprites[boxPosition]->data[2] = xDelta; + sPSSData->boxMonsSprites[boxPosition]->data[3] = xDest; + sPSSData->boxMonsSprites[boxPosition]->callback = sub_80CB234; + count++; + } + } + boxPosition += IN_BOX_ROWS; + y += 24; + } + } + else + { + for (i = 0; i < IN_BOX_COLUMNS; i++) + { + if (sPSSData->boxSpecies[boxPosition] != SPECIES_NONE) + { + sPSSData->boxMonsSprites[boxPosition] = CreateMonIconSprite(sPSSData->boxSpecies[boxPosition], + sPSSData->boxPersonalities[boxPosition], + x, y, 2, subpriority); + if (sPSSData->boxMonsSprites[boxPosition] != NULL) + { + sPSSData->boxMonsSprites[boxPosition]->data[1] = times; + sPSSData->boxMonsSprites[boxPosition]->data[2] = xDelta; + sPSSData->boxMonsSprites[boxPosition]->data[3] = xDest; + sPSSData->boxMonsSprites[boxPosition]->callback = sub_80CB234; + if (GetBoxMonDataAt(sPSSData->field_C5C, boxPosition, MON_DATA_HELD_ITEM) == 0) + sPSSData->boxMonsSprites[boxPosition]->oam.objMode = 1; + count++; + } + } + boxPosition += IN_BOX_ROWS; + y += 24; + } + } + + return count; +} + +static void sub_80CB4CC(u8 boxId, s8 direction) +{ + sPSSData->field_C6A = 0; + sPSSData->field_C6B = boxId; + sPSSData->field_C69 = direction; + sPSSData->field_C60 = 32; + sPSSData->field_C64 = -(6 * direction); + sPSSData->field_C66 = 0; + SetBoxSpeciesAndPersonalities(boxId); + if (direction > 0) + sPSSData->field_C68 = 0; + else + sPSSData->field_C68 = IN_BOX_ROWS - 1; + + sPSSData->field_C62 = (24 * sPSSData->field_C68) + 100; + sub_80CB1F0(sPSSData->field_C64); +} + +static bool8 sub_80CB584(void) +{ + if (sPSSData->field_C60 != 0) + sPSSData->field_C60--; + + switch (sPSSData->field_C6A) + { + case 0: + sPSSData->field_C62 += sPSSData->field_C64; + if (sPSSData->field_C62 <= 64 || sPSSData->field_C62 >= 252) + { + DestroyAllIconsInRow(sPSSData->field_C68); + sPSSData->field_C62 += sPSSData->field_C69 * 24; + sPSSData->field_C6A++; + } + break; + case 1: + sPSSData->field_C62 += sPSSData->field_C64; + sPSSData->field_C66 += sub_80CB2F8(sPSSData->field_C68, sPSSData->field_C60, sPSSData->field_C64); + if ((sPSSData->field_C69 > 0 && sPSSData->field_C68 == IN_BOX_ROWS - 1) + || (sPSSData->field_C69 < 0 && sPSSData->field_C68 == 0)) + { + sPSSData->field_C6A++; + } + else + { + sPSSData->field_C68 += sPSSData->field_C69; + sPSSData->field_C6A = 0; + } + break; + case 2: + if (sPSSData->field_C66 == 0) + { + sPSSData->field_C60++; + return FALSE; + } + break; + default: + return FALSE; + } + + return TRUE; +} + +static void SetBoxSpeciesAndPersonalities(u8 boxId) +{ + s32 i, j, boxPosition; + + boxPosition = 0; + for (i = 0; i < IN_BOX_COLUMNS; i++) + { + for (j = 0; j < IN_BOX_ROWS; j++) + { + sPSSData->boxSpecies[boxPosition] = GetBoxMonDataAt(boxId, boxPosition, MON_DATA_SPECIES2); + if (sPSSData->boxSpecies[boxPosition] != SPECIES_NONE) + sPSSData->boxPersonalities[boxPosition] = GetBoxMonDataAt(boxId, boxPosition, MON_DATA_PERSONALITY); + boxPosition++; + } + } + + sPSSData->field_C5C = boxId; +} + +static void DestroyBoxMonIconAtPosition(u8 boxPosition) +{ + if (sPSSData->boxMonsSprites[boxPosition] != NULL) + { + DestroyBoxMonIcon(sPSSData->boxMonsSprites[boxPosition]); + sPSSData->boxMonsSprites[boxPosition] = NULL; + } +} + +static void SetBoxMonIconObjMode(u8 boxPosition, u8 objMode) +{ + if (sPSSData->boxMonsSprites[boxPosition] != NULL) + { + sPSSData->boxMonsSprites[boxPosition]->oam.objMode = objMode; + } +} + +static void CreatePartyMonsSprites(bool8 arg0) +{ + u16 i, count; + u16 species = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES2); + u32 personality = GetMonData(&gPlayerParty[0], MON_DATA_PERSONALITY); + + sPSSData->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); + sPSSData->partySprites[i] = CreateMonIconSprite(species, personality, 152, 8 * (3 * (i - 1)) + 16, 1, 12); + count++; + } + else + { + sPSSData->partySprites[i] = NULL; + } + } + + if (!arg0) + { + for (i = 0; i < count; i++) + { + sPSSData->partySprites[i]->pos1.y -= 160; + sPSSData->partySprites[i]->invisible = TRUE; + } + } + + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) + { + for (i = 0; i < PARTY_SIZE; i++) + { + if (sPSSData->partySprites[i] != NULL && GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM) == 0) + sPSSData->partySprites[i]->oam.objMode = 1; + } + } +} + +static void sub_80CB950(void) +{ + u16 i, count; + + sPSSData->field_C5E = 0; + for (i = 0, count = 0; i < PARTY_SIZE; i++) + { + if (sPSSData->partySprites[i] != NULL) + { + if (i != count) + { + sub_80CB9D0(sPSSData->partySprites[i], count); + sPSSData->partySprites[i] = NULL; + sPSSData->field_C5E++; + } + count++; + } + } +} + +static u8 sub_80CB9BC(void) +{ + return sPSSData->field_C5E; +} + +static 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; +} + +static 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; + sPSSData->partySprites[sprite->data[1]] = sprite; + sPSSData->field_C5E--; + } +} + +static void DestroyMovingMonIcon(void) +{ + if (sPSSData->movingMonSprite != NULL) + { + DestroyBoxMonIcon(sPSSData->movingMonSprite); + sPSSData->movingMonSprite = NULL; + } +} + +static void sub_80CBAF0(s16 yDelta) +{ + u16 i, posY; + + for (i = 0; i < PARTY_SIZE; i++) + { + if (sPSSData->partySprites[i] != NULL) + { + sPSSData->partySprites[i]->pos1.y += yDelta; + posY = sPSSData->partySprites[i]->pos1.y + sPSSData->partySprites[i]->pos2.y + sPSSData->partySprites[i]->centerToCornerVecY; + posY += 16; + if (posY > 192) + sPSSData->partySprites[i]->invisible = TRUE; + else + sPSSData->partySprites[i]->invisible = FALSE; + } + } +} + +static void DestroyPartyMonIcon(u8 partyId) +{ + if (sPSSData->partySprites[partyId] != NULL) + { + DestroyBoxMonIcon(sPSSData->partySprites[partyId]); + sPSSData->partySprites[partyId] = NULL; + } +} + +static void DestroyAllPartyMonIcons(void) +{ + u16 i; + + for (i = 0; i < PARTY_SIZE; i++) + { + if (sPSSData->partySprites[i] != NULL) + { + DestroyBoxMonIcon(sPSSData->partySprites[i]); + sPSSData->partySprites[i] = NULL; + } + } +} + +static void SetPartyMonIconObjMode(u8 partyId, u8 objMode) +{ + if (sPSSData->partySprites[partyId] != NULL) + { + sPSSData->partySprites[partyId]->oam.objMode = objMode; + } +} + +static void sub_80CBC14(u8 mode, u8 id) +{ + if (mode == MODE_PARTY) + { + sPSSData->movingMonSprite = sPSSData->partySprites[id]; + sPSSData->partySprites[id] = NULL; + } + else if (mode == MODE_BOX) + { + sPSSData->movingMonSprite = sPSSData->boxMonsSprites[id]; + sPSSData->boxMonsSprites[id] = NULL; + } + else + { + return; + } + + sPSSData->movingMonSprite->callback = sub_80CC100; + sPSSData->movingMonSprite->oam.priority = sub_80CAFAC(); + sPSSData->movingMonSprite->subpriority = 7; +} + +static void sub_80CBCAC(u8 boxId, u8 position) +{ + if (boxId == TOTAL_BOXES_COUNT) // party mon + { + sPSSData->partySprites[position] = sPSSData->movingMonSprite; + sPSSData->partySprites[position]->oam.priority = 1; + sPSSData->partySprites[position]->subpriority = 12; + } + else + { + sPSSData->boxMonsSprites[position] = sPSSData->movingMonSprite; + sPSSData->boxMonsSprites[position]->oam.priority = 2; + sPSSData->boxMonsSprites[position]->subpriority = 19 - (position % IN_BOX_ROWS); + } + sPSSData->movingMonSprite->callback = SpriteCallbackDummy; + sPSSData->movingMonSprite = NULL; +} + +static void sub_80CBD5C(u8 boxId, u8 position) +{ + if (boxId == TOTAL_BOXES_COUNT) // party mon + sPSSData->field_B00 = &sPSSData->partySprites[position]; + else + sPSSData->field_B00 = &sPSSData->boxMonsSprites[position]; + + sPSSData->movingMonSprite->callback = SpriteCallbackDummy; + sPSSData->field_C5D = 0; +} + +static bool8 sub_80CBDC4(void) +{ + if (sPSSData->field_C5D == 16) + return FALSE; + + sPSSData->field_C5D++; + if (sPSSData->field_C5D & 1) + { + (*sPSSData->field_B00)->pos1.y--; + sPSSData->movingMonSprite->pos1.y++; + } + + (*sPSSData->field_B00)->pos2.x = gSineTable[sPSSData->field_C5D * 8] / 16; + sPSSData->movingMonSprite->pos2.x = -(gSineTable[sPSSData->field_C5D * 8] / 16); + if (sPSSData->field_C5D == 8) + { + sPSSData->movingMonSprite->oam.priority = (*sPSSData->field_B00)->oam.priority; + sPSSData->movingMonSprite->subpriority = (*sPSSData->field_B00)->subpriority; + (*sPSSData->field_B00)->oam.priority = sub_80CAFAC(); + (*sPSSData->field_B00)->subpriority = 7; + } + + if (sPSSData->field_C5D == 16) + { + struct Sprite *sprite = sPSSData->movingMonSprite; + sPSSData->movingMonSprite = (*sPSSData->field_B00); + *sPSSData->field_B00 = sprite; + + sPSSData->movingMonSprite->callback = sub_80CC100; + (*sPSSData->field_B00)->callback = SpriteCallbackDummy; + } + + return TRUE; +} + +static void sub_80CBF14(u8 mode, u8 position) +{ + switch (mode) + { + case MODE_PARTY: + sPSSData->field_B04 = &sPSSData->partySprites[position]; + break; + case MODE_BOX: + sPSSData->field_B04 = &sPSSData->boxMonsSprites[position]; + break; + case MODE_2: + sPSSData->field_B04 = &sPSSData->movingMonSprite; + break; + default: + return; + } + + if (*sPSSData->field_B04 != NULL) + { + InitSpriteAffineAnim(*sPSSData->field_B04); + (*sPSSData->field_B04)->oam.affineMode = 1; + (*sPSSData->field_B04)->affineAnims = gSpriteAffineAnimTable_857291C; + StartSpriteAffineAnim(*sPSSData->field_B04, 0); + } +} + +static bool8 sub_80CBFD8(void) +{ + if (*sPSSData->field_B04 == NULL || (*sPSSData->field_B04)->invisible) + return FALSE; + + if ((*sPSSData->field_B04)->affineAnimEnded) + (*sPSSData->field_B04)->invisible = TRUE; + + return TRUE; +} + +static void sub_80CC020(void) +{ + if (*sPSSData->field_B04 != NULL) + { + FreeOamMatrix((*sPSSData->field_B04)->oam.matrixNum); + DestroyBoxMonIcon(*sPSSData->field_B04); + *sPSSData->field_B04 = NULL; + } +} + +static void sub_80CC064(void) +{ + if (*sPSSData->field_B04 != NULL) + { + (*sPSSData->field_B04)->invisible = FALSE; + StartSpriteAffineAnim(*sPSSData->field_B04, 1); + } +} + +static bool8 sub_80CC0A0(void) +{ + if (sPSSData->field_B04 == NULL) + return FALSE; + + if ((*sPSSData->field_B04)->affineAnimEnded) + sPSSData->field_B04 = NULL; + + return TRUE; +} + +static void SetMovingMonPriority(u8 priority) +{ + sPSSData->movingMonSprite->oam.priority = priority; +} + +static void sub_80CC100(struct Sprite *sprite) +{ + sprite->pos1.x = sPSSData->field_CB4->pos1.x; + sprite->pos1.y = sPSSData->field_CB4->pos1.y + sPSSData->field_CB4->pos2.y + 4; +} + +static u16 sub_80CC124(u16 species) +{ + u16 i, var; + + for (i = 0; i < 40; i++) + { + if (sPSSData->field_B58[i] == species) + break; + } + + if (i == 40) + { + for (i = 0; i < 40; i++) + { + if (sPSSData->field_B58[i] == 0) + break; + } + if (i == 40) + return 0xFFFF; + } + + sPSSData->field_B58[i] = species; + sPSSData->field_B08[i]++; + var = 16 * i; + CpuCopy32(GetMonIconTiles(species, TRUE), (void*)(OBJ_VRAM0) + var * 32, 0x200); + + return var; +} + +static void sub_80CC1E0(u16 species) +{ + u16 i; + + for (i = 0; i < 40; i++) + { + if (sPSSData->field_B58[i] == species) + { + if (--sPSSData->field_B08[i] == 0) + sPSSData->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]; +} + +static void DestroyBoxMonIcon(struct Sprite *sprite) +{ + sub_80CC1E0(sprite->data[0]); + DestroySprite(sprite); +} + +static void sub_80CC32C(u8 boxId) +{ + u8 taskId = CreateTask(sub_80CC370, 2); + + gTasks[taskId].data[2] = boxId; +} + +static bool8 sub_80CC35C(void) +{ + return FuncIsActiveTask(sub_80CC370); +} + +static void sub_80CC370(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + switch (task->data[0]) + { + case 0: + sPSSData->field_2D2 = 0; + sPSSData->bg2_X = 0; + task->data[1] = RequestDma3Fill(0, sPSSData->field_4AC4, 0x1000, 1); + break; + case 1: + if (CheckForSpaceForDma3Request(task->data[1]) == -1) + return; + + SetBgTilemapBuffer(2, sPSSData->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]++; +} + +static void SetUpScrollToBox(u8 boxId) +{ + s8 direction = sub_80CC644(boxId); + + sPSSData->field_2CE = (direction > 0) ? 6 : -6; + sPSSData->field_2D3 = (direction > 0) ? 1 : 2; + sPSSData->field_2D0 = 32; + sPSSData->field_2D4 = boxId; + sPSSData->field_2D6 = (direction <= 0) ? 5 : 0; + sPSSData->field_2D8 = direction; + sPSSData->field_2DA = (direction > 0) ? 264 : 56; + sPSSData->field_2DC = (direction <= 0) ? 5 : 0; + sPSSData->field_2DE = 0; + sPSSData->field_2E0 = 2; + sPSSData->field_A64 = boxId; + sPSSData->field_A65 = direction; + sPSSData->field_A63 = 0; +} + +static bool8 ScrollToBox(void) +{ + bool8 var; + + switch (sPSSData->field_A63) + { + case 0: + LoadWallpaperGfx(sPSSData->field_A64, sPSSData->field_A65); + sPSSData->field_A63++; + case 1: + if (!WaitForWallpaperGfxLoad()) + return TRUE; + + sub_80CB4CC(sPSSData->field_A64, sPSSData->field_A65); + sub_80CCCFC(sPSSData->field_A64, sPSSData->field_A65); + sub_80CD0B8(sPSSData->field_A65); + break; + case 2: + var = sub_80CB584(); + if (sPSSData->field_2D0 != 0) + { + sPSSData->bg2_X += sPSSData->field_2CE; + if (--sPSSData->field_2D0 != 0) + return TRUE; + sub_80CCEE0(); + sub_80CD158(); + } + return var; + } + + sPSSData->field_A63++; + return TRUE; +} + +static 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; +} + +static void SetWallpaperForCurrentBox(u8 wallpaperId) +{ + u8 boxId = StorageGetCurrentBox(); + SetBoxWallpaper(boxId, wallpaperId); + sPSSData->wallpaperChangeState = 0; +} + +static bool8 DoWallpaperGfxChange(void) +{ + switch (sPSSData->wallpaperChangeState) + { + case 0: + BeginNormalPaletteFade(sPSSData->field_738, 1, 0, 16, RGB_WHITEALPHA); + sPSSData->wallpaperChangeState++; + break; + case 1: + if (!UpdatePaletteFade()) + { + u8 curBox = StorageGetCurrentBox(); + LoadWallpaperGfx(curBox, 0); + sPSSData->wallpaperChangeState++; + } + break; + case 2: + if (WaitForWallpaperGfxLoad() == TRUE) + { + sub_80CCF9C(); + BeginNormalPaletteFade(sPSSData->field_738, 1, 16, 0, RGB_WHITEALPHA); + sPSSData->wallpaperChangeState++; + } + break; + case 3: + if (!UpdatePaletteFade()) + sPSSData->wallpaperChangeState++; + break; + case 4: + return FALSE; + } + + return TRUE; +} + +static void LoadWallpaperGfx(u8 boxId, s8 direction) +{ + u8 wallpaperId; + const struct WallpaperTable *wallpaperGfx; + void *iconGfx; + u32 size1, size2; + + sPSSData->field_6F9 = 0; + sPSSData->field_6FA = boxId; + sPSSData->field_6FB = direction; + if (sPSSData->field_6FB != 0) + { + sPSSData->field_2D2 = (sPSSData->field_2D2 == 0); + sub_80CCAE0(sPSSData->field_4AC4); + } + + wallpaperId = GetBoxWallpaper(sPSSData->field_6FA); + if (wallpaperId != WALLPAPER_FRIENDS) + { + wallpaperGfx = &gWallpaperTable[wallpaperId]; + LZ77UnCompWram(wallpaperGfx->tileMap, sPSSData->field_792); + sub_80CCA3C(sPSSData->field_792, sPSSData->field_6FB, sPSSData->field_2D2); + + if (sPSSData->field_6FB != 0) + LoadPalette(wallpaperGfx->palettes, (sPSSData->field_2D2 * 32) + 0x40, 0x40); + else + CpuCopy16(wallpaperGfx->palettes, &gPlttBufferUnfaded[(sPSSData->field_2D2 * 32) + 0x40], 0x40); + + sPSSData->wallpaperTiles = malloc_and_decompress(wallpaperGfx->tiles, &size1); + LoadBgTiles(2, sPSSData->wallpaperTiles, size1, sPSSData->field_2D2 << 8); + } + else + { + wallpaperGfx = &gFriendsWallpaperTable[GetWaldaWallpaperPatternId()]; + LZ77UnCompWram(wallpaperGfx->tileMap, sPSSData->field_792); + sub_80CCA3C(sPSSData->field_792, sPSSData->field_6FB, sPSSData->field_2D2); + + CpuCopy16(wallpaperGfx->palettes, sPSSData->field_792, 0x40); + CpuCopy16(GetWaldaWallpaperColorsPtr(), &sPSSData->field_792[1], 4); + CpuCopy16(GetWaldaWallpaperColorsPtr(), &sPSSData->field_792[17], 4); + + if (sPSSData->field_6FB != 0) + LoadPalette(sPSSData->field_792, (sPSSData->field_2D2 * 32) + 0x40, 0x40); + else + CpuCopy16(sPSSData->field_792, &gPlttBufferUnfaded[(sPSSData->field_2D2 * 32) + 0x40], 0x40); + + sPSSData->wallpaperTiles = malloc_and_decompress(wallpaperGfx->tiles, &size1); + iconGfx = malloc_and_decompress(gFriendsIcons[GetWaldaWallpaperIconId()], &size2); + CpuCopy32(iconGfx, sPSSData->wallpaperTiles + 0x800, size2); + Free(iconGfx); + LoadBgTiles(2, sPSSData->wallpaperTiles, size1, sPSSData->field_2D2 << 8); + } + + CopyBgTilemapBufferToVram(2); +} + +static bool32 WaitForWallpaperGfxLoad(void) +{ + if (IsDma3ManagerBusyWithBgCopy()) + return FALSE; + + if (sPSSData->wallpaperTiles != NULL) + { + Free(sPSSData->wallpaperTiles); + sPSSData->wallpaperTiles = NULL; + } + return TRUE; +} + +static void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2) +{ + s16 var = (arg2 * 2) + 3; + s16 x = ((sPSSData->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); +} + +static void sub_80CCAE0(void *arg0) +{ + u16 i; + u16 *dest = arg0; + s16 r3 = ((sPSSData->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; + } +} + +static void sub_80CCB50(u8 boxId) +{ + u8 tagIndex; + s16 r6; + u16 i; + + struct SpriteSheet spriteSheet = {sPSSData->field_2F8, 0x200, TAG_TILE_3}; + struct SpritePalette palettes[] = { + {sPSSData->field_6FC, TAG_PAL_DAC9}, + {} + }; + + u16 wallpaperId = GetBoxWallpaper(boxId); + + sPSSData->field_6FC[14] = gUnknown_08577574[wallpaperId][0]; + sPSSData->field_6FC[15] = gUnknown_08577574[wallpaperId][1]; + LoadSpritePalettes(palettes); + sPSSData->field_738 = 0x3f0; + + tagIndex = IndexOfSpritePaletteTag(TAG_PAL_DAC9); + sPSSData->field_71C = 0x10e + 16 * tagIndex; + sPSSData->field_738 |= 0x10000 << tagIndex; + + tagIndex = IndexOfSpritePaletteTag(TAG_PAL_DAC9); + sPSSData->field_71E = 0x10e + 16 * tagIndex; + sPSSData->field_738 |= 0x10000 << tagIndex; + + StringCopyPadded(sPSSData->field_21B8, GetBoxNamePtr(boxId), 0, 8); + sub_80C6D80(sPSSData->field_21B8, sPSSData->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); + sPSSData->field_720[i] = &gSprites[spriteId]; + StartSpriteAnim(sPSSData->field_720[i], i); + } + sPSSData->field_6F8 = 0; +} + +static void sub_80CCCFC(u8 boxId, s8 direction) +{ + u16 r8; + s16 x, x2; + u16 i; + struct SpriteSheet spriteSheet = {sPSSData->field_2F8, 0x200, TAG_TILE_3}; + struct SpriteTemplate template = gSpriteTemplate_857B0A8; + + sPSSData->field_6F8 = (sPSSData->field_6F8 == 0); + if (sPSSData->field_6F8 == 0) + { + spriteSheet.tag = TAG_TILE_3; + r8 = sPSSData->field_71C; + } + else + { + spriteSheet.tag = TAG_TILE_4; + r8 = sPSSData->field_71C; + template.tileTag = TAG_TILE_4; + template.paletteTag = TAG_PAL_DAC9; + } + + StringCopyPadded(sPSSData->field_21B8, GetBoxNamePtr(boxId), 0, 8); + sub_80C6D80(sPSSData->field_21B8, sPSSData->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); + + sPSSData->field_728[i] = &gSprites[spriteId]; + sPSSData->field_728[i]->data[0] = (-direction) * 6; + sPSSData->field_728[i]->data[1] = i * 32 + x; + sPSSData->field_728[i]->data[2] = 0; + sPSSData->field_728[i]->callback = sub_80CCF30; + StartSpriteAnim(sPSSData->field_728[i], i); + + sPSSData->field_720[i]->data[0] = (-direction) * 6; + sPSSData->field_720[i]->data[1] = 1; + sPSSData->field_720[i]->callback = sub_80CCF64; + } +} + +static void sub_80CCEE0(void) +{ + if (sPSSData->field_6F8 == 0) + FreeSpriteTilesByTag(TAG_TILE_4); + else + FreeSpriteTilesByTag(TAG_TILE_3); + + sPSSData->field_720[0] = sPSSData->field_728[0]; + sPSSData->field_720[1] = sPSSData->field_728[1]; +} + +static 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; +} + +static 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); + } +} + +static void sub_80CCF9C(void) +{ + u8 boxId = StorageGetCurrentBox(); + u8 wallpaperId = GetBoxWallpaper(boxId); + if (sPSSData->field_6F8 == 0) + CpuCopy16(gUnknown_08577574[wallpaperId], gPlttBufferUnfaded + sPSSData->field_71C, 4); + else + CpuCopy16(gUnknown_08577574[wallpaperId], gPlttBufferUnfaded + sPSSData->field_71E, 4); +} + +static s16 sub_80CD00C(const u8 *string) +{ + return 0xB0 - GetStringWidth(1, string, 0) / 2; +} + +static 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; + sPSSData->field_730[i] = sprite; + } + } + if (IsCursorOnBox()) + sub_80CD1A8(TRUE); +} + +static void sub_80CD0B8(s8 direction) +{ + u16 i; + + for (i = 0; i < 2; i++) + { + sPSSData->field_730[i]->pos2.x = 0; + sPSSData->field_730[i]->data[0] = 2; + } + if (direction < 0) + { + sPSSData->field_730[0]->data[1] = 29; + sPSSData->field_730[1]->data[1] = 5; + sPSSData->field_730[0]->data[2] = 0x48; + sPSSData->field_730[1]->data[2] = 0x48; + } + else + { + sPSSData->field_730[0]->data[1] = 5; + sPSSData->field_730[1]->data[1] = 29; + sPSSData->field_730[0]->data[2] = 0xF8; + sPSSData->field_730[1]->data[2] = 0xF8; + } + sPSSData->field_730[0]->data[7] = 0; + sPSSData->field_730[1]->data[7] = 1; +} + +static void sub_80CD158(void) +{ + u16 i; + + for (i = 0; i < 2; i++) + { + sPSSData->field_730[i]->pos1.x = 0x88 * i + 0x5c; + sPSSData->field_730[i]->pos2.x = 0; + sPSSData->field_730[i]->invisible = FALSE; + } + sub_80CD1A8(TRUE); +} + +static void sub_80CD1A8(bool8 a0) +{ + u16 i; + + if (a0) + { + for (i = 0; i < 2; i++) + { + sPSSData->field_730[i]->data[0] = 1; + sPSSData->field_730[i]->data[1] = 0; + sPSSData->field_730[i]->data[2] = 0; + sPSSData->field_730[i]->data[4] = 0; + } + } + else + { + for (i = 0; i < 2; i++) + { + sPSSData->field_730[i]->data[0] = 0; + } + } +} + +static 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 -= sPSSData->field_2CE; + if (sprite->pos1.x < 73 || sprite->pos1.x > 247) + 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 -= sPSSData->field_2CE; + break; + } +} + +static 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]; +} + +static void sub_80CD36C(void) +{ + if (sPSSData->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(); + sPSSData->field_CD6 = 1; + sPSSData->inBoxMovingMode = 0; + sub_80CEB40(); +} + +static void sub_80CD3EC(void) +{ + sub_80CFC14(); + sub_80CEBDC(); + sPSSData->field_CD6 = 1; + sPSSData->inBoxMovingMode = 0; + if (sIsMonBeingMoved) + { + sPSSData->movingMon = gUnknown_02039D14; + CreateMovingMonIcon(); + } +} + +static void sub_80CD444(u8 cursorArea, u8 cursorPosition, u16 *x, u16 *y) +{ + switch (cursorArea) + { + case CURSOR_AREA_IN_BOX: + *x = (cursorPosition % IN_BOX_ROWS) * 24 + 100; + *y = (cursorPosition / IN_BOX_ROWS) * 24 + 32; + break; + case CURSOR_AREA_IN_PARTY: + if (cursorPosition == 0) + { + *x = 0x68; + *y = 0x34; + } + else if (cursorPosition == PARTY_SIZE) + { + *x = 0x98; + *y = 0x84; + } + else + { + *x = 0x98; + *y = (cursorPosition - 1) * 24 + 4; + } + break; + case CURSOR_AREA_BOX: + *x = 0xa2; + *y = 0x0c; + break; + case CURSOR_AREA_BUTTONS: + *y = sIsMonBeingMoved ? 8 : 14; + *x = cursorPosition * 0x58 + 0x78; + break; + case 4: + *x = 0xa0; + *y = 0x60; + break; + } +} + +static 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; + } +} + +static bool8 sub_80CD554(void) +{ + s16 tmp; + + if (sPSSData->field_CD0 == 0) + { + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + return FALSE; + else + return sub_80D1218(); + } + else if (--sPSSData->field_CD0 != 0) + { + sPSSData->field_CBC += sPSSData->field_CC4; + sPSSData->field_CC0 += sPSSData->field_CC8; + sPSSData->field_CB4->pos1.x = sPSSData->field_CBC >> 8; + sPSSData->field_CB4->pos1.y = sPSSData->field_CC0 >> 8; + if (sPSSData->field_CB4->pos1.x > 0x100) + { + tmp = sPSSData->field_CB4->pos1.x - 0x100; + sPSSData->field_CB4->pos1.x = tmp + 0x40; + } + if (sPSSData->field_CB4->pos1.x < 0x40) + { + tmp = 0x40 - sPSSData->field_CB4->pos1.x; + sPSSData->field_CB4->pos1.x = 0x100 - tmp; + } + if (sPSSData->field_CB4->pos1.y > 0xb0) + { + tmp = sPSSData->field_CB4->pos1.y - 0xb0; + sPSSData->field_CB4->pos1.y = tmp - 0x10; + } + if (sPSSData->field_CB4->pos1.y < -0x10) + { + tmp = -0x10 - sPSSData->field_CB4->pos1.y; + sPSSData->field_CB4->pos1.y = 0xb0 - tmp; + } + if (sPSSData->field_CD7 && --sPSSData->field_CD7 == 0) + sPSSData->field_CB4->vFlip = (sPSSData->field_CB4->vFlip == FALSE); + } + else + { + sPSSData->field_CB4->pos1.x = sPSSData->field_CCC; + sPSSData->field_CB4->pos1.y = sPSSData->field_CCE; + sub_80CDA68(); + } + + return TRUE; +} + +static void sub_80CD6AC(u8 newCurosrArea, u8 newCursorPosition) +{ + u16 x, y; + + sub_80CD444(newCurosrArea, newCursorPosition, &x, &y); + sPSSData->field_CD4 = newCurosrArea; + sPSSData->field_CD5 = newCursorPosition; + sPSSData->field_CCC = x; + sPSSData->field_CCE = y; +} + +static void sub_80CD70C(void) +{ + int r7, r0; + + if (sPSSData->field_CD2 != 0 || sPSSData->field_CD3 != 0) + sPSSData->field_CD0 = 12; + else + sPSSData->field_CD0 = 6; + + if (sPSSData->field_CD7) + sPSSData->field_CD7 = sPSSData->field_CD0 >> 1; + + switch (sPSSData->field_CD2) + { + default: + r7 = sPSSData->field_CCE - sPSSData->field_CB4->pos1.y; + break; + case -1: + r7 = sPSSData->field_CCE - 0xc0 - sPSSData->field_CB4->pos1.y; + break; + case 1: + r7 = sPSSData->field_CCE + 0xc0 - sPSSData->field_CB4->pos1.y; + break; + } + + switch (sPSSData->field_CD3) + { + default: + r0 = sPSSData->field_CCC - sPSSData->field_CB4->pos1.x; + break; + case -1: + r0 = sPSSData->field_CCC - 0xc0 - sPSSData->field_CB4->pos1.x; + break; + case 1: + r0 = sPSSData->field_CCC + 0xc0 - sPSSData->field_CB4->pos1.x; + break; + } + + r7 <<= 8; + r0 <<= 8; + sPSSData->field_CC4 = r0 / sPSSData->field_CD0; + sPSSData->field_CC8 = r7 / sPSSData->field_CD0; + sPSSData->field_CBC = sPSSData->field_CB4->pos1.x << 8; + sPSSData->field_CC0 = sPSSData->field_CB4->pos1.y << 8; +} + +static void sub_80CD894(u8 newCurosrArea, u8 newCursorPosition) +{ + sub_80CD6AC(newCurosrArea, newCursorPosition); + sub_80CD70C(); + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + { + if (sPSSData->inBoxMovingMode == 0 && !sIsMonBeingMoved) + StartSpriteAnim(sPSSData->field_CB4, 1); + } + else + { + if (!IsActiveItemMoving()) + StartSpriteAnim(sPSSData->field_CB4, 1); + } + + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) + { + if (sBoxCursorArea == CURSOR_AREA_IN_BOX) + sub_80D0E50(CURSOR_AREA_IN_BOX, sBoxCursorPosition); + else if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) + sub_80D0E50(CURSOR_AREA_IN_PARTY, sBoxCursorPosition); + + if (newCurosrArea == CURSOR_AREA_IN_BOX) + sub_80D0D8C(newCurosrArea, newCursorPosition); + else if (newCurosrArea == CURSOR_AREA_IN_PARTY) + sub_80D0D8C(newCurosrArea, newCursorPosition); + } + + if (newCurosrArea == CURSOR_AREA_IN_PARTY && sBoxCursorArea != CURSOR_AREA_IN_PARTY) + { + sPSSData->field_CD6 = newCurosrArea; + sPSSData->field_CB8->invisible = TRUE; + } + + switch (newCurosrArea) + { + case CURSOR_AREA_IN_PARTY: + case CURSOR_AREA_BOX: + case CURSOR_AREA_BUTTONS: + sPSSData->field_CB4->oam.priority = 1; + sPSSData->field_CB8->invisible = TRUE; + sPSSData->field_CB8->oam.priority = 1; + break; + case CURSOR_AREA_IN_BOX: + if (sPSSData->inBoxMovingMode != 0) + { + sPSSData->field_CB4->oam.priority = 0; + sPSSData->field_CB8->invisible = TRUE; + } + else + { + sPSSData->field_CB4->oam.priority = 2; + if (sBoxCursorArea == CURSOR_AREA_IN_BOX && sIsMonBeingMoved) + SetMovingMonPriority(2); + } + break; + } +} + +static void sub_80CDA68(void) +{ + sBoxCursorArea = sPSSData->field_CD4; + sBoxCursorPosition = sPSSData->field_CD5; + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + { + if (sPSSData->inBoxMovingMode == 0 && !sIsMonBeingMoved) + StartSpriteAnim(sPSSData->field_CB4, 0); + } + else + { + if (!IsActiveItemMoving()) + StartSpriteAnim(sPSSData->field_CB4, 0); + } + + sub_80CEB40(); + switch (sBoxCursorArea) + { + case CURSOR_AREA_BUTTONS: + SetMovingMonPriority(1); + break; + case CURSOR_AREA_BOX: + sub_80CD1A8(TRUE); + break; + case CURSOR_AREA_IN_PARTY: + sPSSData->field_CB8->subpriority = 13; + SetMovingMonPriority(1); + break; + case CURSOR_AREA_IN_BOX: + if (sPSSData->inBoxMovingMode == 0) + { + sPSSData->field_CB4->oam.priority = 1; + sPSSData->field_CB8->oam.priority = 2; + sPSSData->field_CB8->subpriority = 21; + sPSSData->field_CB8->invisible = FALSE; + SetMovingMonPriority(2); + } + break; + } +} + +static void sub_80CDBA0(void) +{ + u8 partyCount; + + if (!sIsMonBeingMoved) + { + partyCount = 0; + } + else + { + partyCount = CalculatePlayerPartyCount(); + if (partyCount >= PARTY_SIZE) + partyCount = PARTY_SIZE - 1; + } + if (sPSSData->field_CB4->vFlip) + sPSSData->field_CD7 = 1; + sub_80CD894(CURSOR_AREA_IN_PARTY, partyCount); +} + +static void sub_80CDBF8(u8 cursorBoxPosition) +{ + sub_80CD894(CURSOR_AREA_IN_BOX, cursorBoxPosition); +} + +EWRAM_DATA static u8 gUnknown_02039D7E = 0; + +static void sub_80CDC0C(void) +{ + gUnknown_02039D7E = 0; +} + +static void sub_80CDC18(void) +{ + gUnknown_02039D7E = sBoxCursorPosition; +} + +static u8 sub_80CDC2C(void) +{ + return gUnknown_02039D7E; +} + +static void InitMonPlaceChange(u8 a0) +{ + static bool8 (*const placeChangeFuncs[])(void) = + { + MonPlaceChange_Move, + MonPlaceChange_Place, + MonPlaceChange_Shift, + }; + + sPSSData->monPlaceChangeFunc = placeChangeFuncs[a0]; + sPSSData->monPlaceChangeState = 0; +} + +static void sub_80CDC64(bool8 arg0) +{ + if (!arg0) + sPSSData->monPlaceChangeFunc = sub_80CDEB4; + else + sPSSData->monPlaceChangeFunc = sub_80CDEC4; + + sPSSData->monPlaceChangeState = 0; +} + +static bool8 DoMonPlaceChange(void) +{ + return sPSSData->monPlaceChangeFunc(); +} + +static bool8 MonPlaceChange_Move(void) +{ + switch (sPSSData->monPlaceChangeState) + { + case 0: + if (sIsMonBeingMoved) + return FALSE; + StartSpriteAnim(sPSSData->field_CB4, 2); + sPSSData->monPlaceChangeState++; + break; + case 1: + if (!sub_80CDED4()) + { + StartSpriteAnim(sPSSData->field_CB4, 3); + MoveMon(); + sPSSData->monPlaceChangeState++; + } + break; + case 2: + if (!sub_80CDF08()) + sPSSData->monPlaceChangeState++; + break; + case 3: + return FALSE; + } + + return TRUE; +} + +static bool8 MonPlaceChange_Place(void) +{ + switch (sPSSData->monPlaceChangeState) + { + case 0: + if (!sub_80CDED4()) + { + StartSpriteAnim(sPSSData->field_CB4, 2); + PlaceMon(); + sPSSData->monPlaceChangeState++; + } + break; + case 1: + if (!sub_80CDF08()) + { + StartSpriteAnim(sPSSData->field_CB4, 0); + sPSSData->monPlaceChangeState++; + } + break; + case 2: + return FALSE; + } + + return TRUE; +} + +static bool8 MonPlaceChange_Shift(void) +{ + switch (sPSSData->monPlaceChangeState) + { + case 0: + switch (sBoxCursorArea) + { + case CURSOR_AREA_IN_PARTY: + sPSSData->field_D91 = TOTAL_BOXES_COUNT; + break; + case CURSOR_AREA_IN_BOX: + sPSSData->field_D91 = StorageGetCurrentBox(); + break; + default: + return FALSE; + } + StartSpriteAnim(sPSSData->field_CB4, 2); + sub_80CBD5C(sPSSData->field_D91, sBoxCursorPosition); + sPSSData->monPlaceChangeState++; + break; + case 1: + if (!sub_80CBDC4()) + { + StartSpriteAnim(sPSSData->field_CB4, 3); + SetShiftedMonData(sPSSData->field_D91, sBoxCursorPosition); + sPSSData->monPlaceChangeState++; + } + break; + case 2: + return FALSE; + } + + return TRUE; +} + +static bool8 sub_80CDEB4(void) +{ + return sub_80CDED4(); +} + +static bool8 sub_80CDEC4(void) +{ + return sub_80CDF08(); +} + +static bool8 sub_80CDED4(void) +{ + switch (sPSSData->field_CB4->pos2.y) + { + default: + sPSSData->field_CB4->pos2.y++; + break; + case 0: + sPSSData->field_CB4->pos2.y++; + break; + case 8: + return FALSE; + } + + return TRUE; +} + +static bool8 sub_80CDF08(void) +{ + switch (sPSSData->field_CB4->pos2.y) + { + case 0: + return FALSE; + default: + sPSSData->field_CB4->pos2.y--; + break; + } + + return TRUE; +} + +static 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 (sPSSData->inBoxMovingMode == 0) + { + SetMovedMonData(StorageGetCurrentBox(), sBoxCursorPosition); + sub_80CBC14(MODE_BOX, sBoxCursorPosition); + } + break; + default: + return; + } + + sIsMonBeingMoved = TRUE; +} + +static 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; +} + +static void sub_80CE00C(void) +{ + sub_80CEB40(); +} + +static void SetMovedMonData(u8 boxId, u8 position) +{ + if (boxId == TOTAL_BOXES_COUNT) + sPSSData->movingMon = gPlayerParty[sBoxCursorPosition]; + else + BoxMonAtToMon(boxId, position, &sPSSData->movingMon); + + PurgeMonOrBoxMon(boxId, position); + sMovingMonOrigBoxId = boxId; + sMovingMonOrigBoxPos = position; +} + +static void SetPlacedMonData(u8 boxId, u8 position) +{ + if (boxId == TOTAL_BOXES_COUNT) + { + gPlayerParty[position] = sPSSData->movingMon; + } + else + { + BoxMonRestorePP(&sPSSData->movingMon.box); + SetBoxMonAt(boxId, position, &sPSSData->movingMon.box); + } +} + +static void PurgeMonOrBoxMon(u8 boxId, u8 position) +{ + if (boxId == TOTAL_BOXES_COUNT) + ZeroMonData(&gPlayerParty[position]); + else + ZeroBoxMonAt(boxId, position); +} + +static void SetShiftedMonData(u8 boxId, u8 position) +{ + if (boxId == TOTAL_BOXES_COUNT) + sPSSData->field_2108 = gPlayerParty[position]; + else + BoxMonAtToMon(boxId, position, &sPSSData->field_2108); + + SetPlacedMonData(boxId, position); + sPSSData->movingMon = sPSSData->field_2108; + SetCursorMonData(&sPSSData->movingMon, MODE_PARTY); + sMovingMonOrigBoxId = boxId; + sMovingMonOrigBoxPos = position; +} + +static bool8 TryStorePartyMonInBox(u8 boxId) +{ + s16 boxPosition = GetFirstFreeBoxSpot(boxId); + if (boxPosition == -1) + return FALSE; + + if (sIsMonBeingMoved) + { + SetPlacedMonData(boxId, boxPosition); + DestroyMovingMonIcon(); + sIsMonBeingMoved = FALSE; + } + else + { + SetMovedMonData(TOTAL_BOXES_COUNT, sBoxCursorPosition); + SetPlacedMonData(boxId, boxPosition); + DestroyPartyMonIcon(sBoxCursorPosition); + } + + if (boxId == StorageGetCurrentBox()) + sub_80CB140(boxPosition); + + StartSpriteAnim(sPSSData->field_CB4, 1); + return TRUE; +} + +static void sub_80CE22C(void) +{ + StartSpriteAnim(sPSSData->field_CB4, 0); + sub_80CEB40(); +} + +static 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(sPSSData->field_21E0, sPSSData->cursorMonNick); +} + +static bool8 sub_80CE2A8(void) +{ + if (!sub_80CBFD8()) + { + StartSpriteAnim(sPSSData->field_CB4, 0); + return FALSE; + } + else + { + return TRUE; + } +} + +static void ReleaseMon(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(); +} + +static void sub_80CE324(void) +{ + if (sIsMonBeingMoved) + StartSpriteAnim(sPSSData->field_CB4, 3); +} + +struct +{ + s8 mapGroup; + s8 mapNum; + u16 move; +} static 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}, +}; + +static 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; +} + +static void InitCanRelaseMonVars(void) +{ + if (!AtLeastThreeUsableMons()) + { + sPSSData->field_216D = 1; + sPSSData->field_216C = 0; + return; + } + + if (sIsMonBeingMoved) + { + sPSSData->field_2108 = sPSSData->movingMon; + sPSSData->field_2170 = -1; + sPSSData->field_2171 = -1; + } + else + { + if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) + { + sPSSData->field_2108 = gPlayerParty[sBoxCursorPosition]; + sPSSData->field_2170 = TOTAL_BOXES_COUNT; + } + else + { + BoxMonAtToMon(StorageGetCurrentBox(), sBoxCursorPosition, &sPSSData->field_2108); + sPSSData->field_2170 = StorageGetCurrentBox(); + } + sPSSData->field_2171 = sBoxCursorPosition; + } + + sub_80CE350(sPSSData->field_2176); + sPSSData->field_2174 = GetMonData(&sPSSData->field_2108, MON_DATA_KNOWN_MOVES, sPSSData->field_2176); + if (sPSSData->field_2174 != 0) + { + sPSSData->field_216D = 0; + } + else + { + sPSSData->field_216D = 1; + sPSSData->field_216C = 1; + } + + sPSSData->field_2172 = 0; +} + +static 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 (CheckBoxMonSanityAt(i, j)) + { + if (++count >= 3) + return TRUE; + } + } + } + + return FALSE; +} + +static s8 RunCanReleaseMon(void) +{ + u16 i; + u16 knownMoves; + + if (sPSSData->field_216D) + return sPSSData->field_216C; + + switch (sPSSData->field_2172) + { + case 0: + for (i = 0; i < PARTY_SIZE; i++) + { + if (sPSSData->field_2170 != TOTAL_BOXES_COUNT || sPSSData->field_2171 != i) + { + knownMoves = GetMonData(gPlayerParty + i, MON_DATA_KNOWN_MOVES, sPSSData->field_2176); + sPSSData->field_2174 &= ~(knownMoves); + } + } + if (sPSSData->field_2174 == 0) + { + sPSSData->field_216D = 1; + sPSSData->field_216C = 1; + } + else + { + sPSSData->field_216E = 0; + sPSSData->field_216F = 0; + sPSSData->field_2172++; + } + break; + case 1: + for (i = 0; i < IN_BOX_COUNT; i++) + { + knownMoves = GetAndCopyBoxMonDataAt(sPSSData->field_216E, sPSSData->field_216F, MON_DATA_KNOWN_MOVES, sPSSData->field_2176); + if (knownMoves != 0 + && !(sPSSData->field_2170 == sPSSData->field_216E && sPSSData->field_2171 == sPSSData->field_216F)) + { + sPSSData->field_2174 &= ~(knownMoves); + if (sPSSData->field_2174 == 0) + { + sPSSData->field_216D = 1; + sPSSData->field_216C = 1; + break; + } + } + if (++sPSSData->field_216F >= IN_BOX_COUNT) + { + sPSSData->field_216F = 0; + if (++sPSSData->field_216E >= TOTAL_BOXES_COUNT) + { + sPSSData->field_216D = 1; + sPSSData->field_216C = 0; + } + } + } + break; + } + + return -1; +} + +static void sub_80CE760(void) +{ + if (sIsMonBeingMoved) + gUnknown_02039D14 = sPSSData->movingMon; +} + +static void sub_80CE790(void) +{ + if (sIsMonBeingMoved) + { + if (sMovingMonOrigBoxId == TOTAL_BOXES_COUNT) + sPSSData->movingMon = gUnknown_02039D14; + else + sPSSData->movingMon.box = gUnknown_02039D14.box; + } +} + +static void sub_80CE7E8(void) +{ + if (sIsMonBeingMoved) + { + sub_80CE760(); + sPSSData->field_218C.mon = &gUnknown_02039D14; + sPSSData->field_2187 = 0; + sPSSData->field_2186 = 0; + sPSSData->field_2188 = 0; + } + else if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) + { + sPSSData->field_218C.mon = gPlayerParty; + sPSSData->field_2187 = sBoxCursorPosition; + sPSSData->field_2186 = CountPartyMons() - 1; + sPSSData->field_2188 = 0; + } + else + { + sPSSData->field_218C.box = GetBoxedMonPtr(StorageGetCurrentBox(), 0); + sPSSData->field_2187 = sBoxCursorPosition; + sPSSData->field_2186 = IN_BOX_COUNT - 1; + sPSSData->field_2188 = 2; + } +} + +static void sub_80CE8E4(void) +{ + if (sIsMonBeingMoved) + sub_80CE790(); + else + sBoxCursorPosition = gUnknown_0203CF20; +} + +s16 CompactPartySlots(void) +{ + s16 retVal = -1; + u16 i, last; + + for (i = 0, last = 0; i < PARTY_SIZE; i++) + { + u16 species = GetMonData(gPlayerParty + i, MON_DATA_SPECIES); + if (species != SPECIES_NONE) + { + if (i != last) + gPlayerParty[last] = gPlayerParty[i]; + last++; + } + else if (retVal == -1) + { + retVal = i; + } + } + for (; last < PARTY_SIZE; last++) + ZeroMonData(gPlayerParty + last); + + return retVal; +} + +static void SetMonMarkings(u8 markings) +{ + sPSSData->cursorMonMarkings = markings; + if (sIsMonBeingMoved) + { + SetMonData(&sPSSData->movingMon, MON_DATA_MARKINGS, &markings); + } + else + { + if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) + SetMonData(gPlayerParty + sBoxCursorPosition, MON_DATA_MARKINGS, &markings); + if (sBoxCursorArea == CURSOR_AREA_IN_BOX) + SetCurrentBoxMonData(sBoxCursorPosition, MON_DATA_MARKINGS, &markings); + } +} + +static bool8 CanMovePartyMon(void) +{ + if (sBoxCursorArea == CURSOR_AREA_IN_PARTY && !sIsMonBeingMoved && CountPartyAliveNonEggMonsExcept(sBoxCursorPosition) == 0) + return TRUE; + else + return FALSE; +} + +static bool8 CanShiftMon(void) +{ + if (sIsMonBeingMoved) + { + if (sBoxCursorArea == CURSOR_AREA_IN_PARTY && CountPartyAliveNonEggMonsExcept(sBoxCursorPosition) == 0) + { + if (sPSSData->cursorMonIsEgg || GetMonData(&sPSSData->movingMon, MON_DATA_HP) == 0) + return FALSE; + } + return TRUE; + } + return FALSE; +} + +static bool8 IsMonBeingMoved(void) +{ + return sIsMonBeingMoved; +} + +static bool8 IsCursorOnBox(void) +{ + return (sBoxCursorArea == CURSOR_AREA_BOX); +} + +static bool8 IsCursorOnCloseBox(void) +{ + return (sBoxCursorArea == CURSOR_AREA_BUTTONS && sBoxCursorPosition == 1); +} + +static bool8 IsCursorInBox(void) +{ + return (sBoxCursorArea == CURSOR_AREA_IN_BOX); +} + +static void sub_80CEB40(void) +{ + sPSSData->setMosaic = (sIsMonBeingMoved == FALSE); + if (!sIsMonBeingMoved) + { + switch (sBoxCursorArea) + { + case CURSOR_AREA_IN_PARTY: + if (sBoxCursorPosition < PARTY_SIZE) + { + SetCursorMonData(&gPlayerParty[sBoxCursorPosition], MODE_PARTY); + break; + } + // fallthrough + case CURSOR_AREA_BUTTONS: + case CURSOR_AREA_BOX: + SetCursorMonData(NULL, MODE_2); + break; + case CURSOR_AREA_IN_BOX: + SetCursorMonData(GetBoxedMonPtr(StorageGetCurrentBox(), sBoxCursorPosition), MODE_BOX); + break; + } + } +} + +static void sub_80CEBDC(void) +{ + if (sIsMonBeingMoved) + SetCursorMonData(&gUnknown_02039D14, MODE_PARTY); + else + sub_80CEB40(); +} + +static void SetCursorMonData(void *pokemon, u8 mode) +{ + u8 *txtPtr; + u16 gender; + bool8 sanityIsBagEgg; + + sPSSData->cursorMonItem = 0; + gender = MON_MALE; + sanityIsBagEgg = FALSE; + if (mode == MODE_PARTY) + { + struct Pokemon *mon = (struct Pokemon *)pokemon; + + sPSSData->cursorMonSpecies = GetMonData(mon, MON_DATA_SPECIES2); + if (sPSSData->cursorMonSpecies != SPECIES_NONE) + { + sanityIsBagEgg = GetMonData(mon, MON_DATA_SANITY_IS_BAD_EGG); + if (sanityIsBagEgg) + sPSSData->cursorMonIsEgg = TRUE; + else + sPSSData->cursorMonIsEgg = GetMonData(mon, MON_DATA_IS_EGG); + + GetMonData(mon, MON_DATA_NICKNAME, sPSSData->cursorMonNick); + StringGetEnd10(sPSSData->cursorMonNick); + sPSSData->cursorMonLevel = GetMonData(mon, MON_DATA_LEVEL); + sPSSData->cursorMonMarkings = GetMonData(mon, MON_DATA_MARKINGS); + sPSSData->cursorMonPersonality = GetMonData(mon, MON_DATA_PERSONALITY); + sPSSData->cursorMonPalette = GetMonFrontSpritePal(mon); + gender = GetMonGender(mon); + sPSSData->cursorMonItem = GetMonData(mon, MON_DATA_HELD_ITEM); + } + } + else if (mode == MODE_BOX) + { + struct BoxPokemon *boxMon = (struct BoxPokemon *)pokemon; + + sPSSData->cursorMonSpecies = GetBoxMonData(pokemon, MON_DATA_SPECIES2); + if (sPSSData->cursorMonSpecies != SPECIES_NONE) + { + u32 otId = GetBoxMonData(boxMon, MON_DATA_OT_ID); + sanityIsBagEgg = GetBoxMonData(boxMon, MON_DATA_SANITY_IS_BAD_EGG); + if (sanityIsBagEgg) + sPSSData->cursorMonIsEgg = TRUE; + else + sPSSData->cursorMonIsEgg = GetBoxMonData(boxMon, MON_DATA_IS_EGG); + + + GetBoxMonData(boxMon, MON_DATA_NICKNAME, sPSSData->cursorMonNick); + StringGetEnd10(sPSSData->cursorMonNick); + sPSSData->cursorMonLevel = GetLevelFromBoxMonExp(boxMon); + sPSSData->cursorMonMarkings = GetBoxMonData(boxMon, MON_DATA_MARKINGS); + sPSSData->cursorMonPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY); + sPSSData->cursorMonPalette = GetFrontSpritePalFromSpeciesAndPersonality(sPSSData->cursorMonSpecies, otId, sPSSData->cursorMonPersonality); + gender = GetGenderFromSpeciesAndPersonality(sPSSData->cursorMonSpecies, sPSSData->cursorMonPersonality); + sPSSData->cursorMonItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM); + } + } + else + { + sPSSData->cursorMonSpecies = SPECIES_NONE; + sPSSData->cursorMonItem = 0; + } + + if (sPSSData->cursorMonSpecies == SPECIES_NONE) + { + StringFill(sPSSData->cursorMonNick, CHAR_SPACE, 5); + StringFill(sPSSData->cursorMonNickText, CHAR_SPACE, 8); + StringFill(sPSSData->cursorMonSpeciesName, CHAR_SPACE, 8); + StringFill(sPSSData->cursorMonGenderLvlText, CHAR_SPACE, 8); + StringFill(sPSSData->cursorMonItemName, CHAR_SPACE, 8); + } + else if (sPSSData->cursorMonIsEgg) + { + if (sanityIsBagEgg) + StringCopyPadded(sPSSData->cursorMonNickText, sPSSData->cursorMonNick, CHAR_SPACE, 5); + else + StringCopyPadded(sPSSData->cursorMonNickText, gText_EggNickname, CHAR_SPACE, 8); + + StringFill(sPSSData->cursorMonSpeciesName, CHAR_SPACE, 8); + StringFill(sPSSData->cursorMonGenderLvlText, CHAR_SPACE, 8); + StringFill(sPSSData->cursorMonItemName, CHAR_SPACE, 8); + } + else + { + if (sPSSData->cursorMonSpecies == SPECIES_NIDORAN_F || sPSSData->cursorMonSpecies == SPECIES_NIDORAN_M) + gender = MON_GENDERLESS; + + StringCopyPadded(sPSSData->cursorMonNickText, sPSSData->cursorMonNick, CHAR_SPACE, 5); + + txtPtr = sPSSData->cursorMonSpeciesName; + *(txtPtr)++ = CHAR_SLASH; + StringCopyPadded(txtPtr, gSpeciesNames[sPSSData->cursorMonSpecies], CHAR_SPACE, 5); + + txtPtr = sPSSData->cursorMonGenderLvlText; + *(txtPtr)++ = EXT_CTRL_CODE_BEGIN; + *(txtPtr)++ = 4; + switch (gender) + { + case MON_MALE: + *(txtPtr)++ = 4; + *(txtPtr)++ = 1; + *(txtPtr)++ = 5; + *(txtPtr)++ = CHAR_MALE; + break; + case MON_FEMALE: + *(txtPtr)++ = 6; + *(txtPtr)++ = 1; + *(txtPtr)++ = 7; + *(txtPtr)++ = CHAR_FEMALE; + break; + default: + *(txtPtr)++ = 2; + *(txtPtr)++ = 1; + *(txtPtr)++ = 3; + *(txtPtr)++ = 0x77; + break; + } + + *(txtPtr++) = EXT_CTRL_CODE_BEGIN; + *(txtPtr++) = 4; + *(txtPtr++) = 2; + *(txtPtr++) = 1; + *(txtPtr++) = 3; + *(txtPtr++) = 0; + *(txtPtr++) = CHAR_SPECIAL_F9; + *(txtPtr++) = 5; + + txtPtr = ConvertIntToDecimalStringN(txtPtr, sPSSData->cursorMonLevel, STR_CONV_MODE_LEFT_ALIGN, 3); + txtPtr[0] = CHAR_SPACE; + txtPtr[1] = EOS; + + if (sPSSData->cursorMonItem != 0) + StringCopyPadded(sPSSData->cursorMonItemName, ItemId_GetName(sPSSData->cursorMonItem), CHAR_SPACE, 8); + else + StringFill(sPSSData->cursorMonItemName, CHAR_SPACE, 8); + } +} + +static u8 HandleInput_InBox(void) +{ + switch (sPSSData->inBoxMovingMode) + { + case 0: + default: + return InBoxInput_Normal(); + case 1: + return InBoxInput_GrabbingMultiple(); + case 2: + return InBoxInput_MovingMultiple(); + } +} + +// This group of four functions handling input simply CANNOT be matched. +// GF must have written them in a really weird way, a way not a sane person could dream to reproduce. +#ifdef NONMATCHING +static u8 InBoxInput_Normal(void) +{ + u8 retVal; + s8 cursorArea = sBoxCursorArea; + s8 cursorPosition = sBoxCursorPosition; + + sPSSData->field_CD2 = 0; + sPSSData->field_CD3 = 0; + sPSSData->field_CD7 = 0; + retVal = 0; + if (!(gMain.newAndRepeatedKeys & DPAD_UP)) + { + if (gMain.newAndRepeatedKeys & DPAD_DOWN) + { + retVal = TRUE; + cursorPosition += IN_BOX_ROWS; + if (cursorPosition >= IN_BOX_COUNT) + { + cursorArea = CURSOR_AREA_BUTTONS; + cursorPosition -= IN_BOX_COUNT; + cursorPosition /= 3; + sPSSData->field_CD2 = 1; + sPSSData->field_CD7 = 1; + } + } + else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + { + retVal = TRUE; + if (sBoxCursorPosition % IN_BOX_ROWS != 0) + { + cursorPosition--; + } + else + { + sPSSData->field_CD3 = -1; + cursorPosition += (IN_BOX_ROWS - 1); + } + } + else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + { + retVal = TRUE; + if ((sBoxCursorPosition + 1) % IN_BOX_ROWS != 0) + { + cursorPosition++; + } + else + { + sPSSData->field_CD3 = 1; + cursorPosition -= (IN_BOX_ROWS - 1); + } + } + else if (gMain.newKeys & START_BUTTON) + { + retVal = TRUE; + cursorArea = CURSOR_AREA_BOX; + cursorPosition = 0; + } + else + { + if ((gMain.newKeys & A_BUTTON) && sub_80CFA5C()) + { + if (!sCanOnlyMove) + return 8; + + if (sPSSData->boxOption == BOX_OPTION_MOVE_MONS || sIsMonBeingMoved == TRUE) + { + switch (sub_80CFF98(0)) + { + case 1: + return 11; + case 2: + return 12; + case 3: + return 13; + case 4: + return 14; + case 5: + return 15; + case 12: + return 16; + case 13: + return 17; + case 15: + return 18; + } + } + else + { + sPSSData->inBoxMovingMode = 1; + return 20; + } + } + + if (gMain.newKeys & B_BUTTON) + return 19; + + if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR) + { + if (gMain.heldKeys & L_BUTTON) + return 10; + if (gMain.heldKeys & R_BUTTON) + return 9; + } + + if (gMain.newKeys & SELECT_BUTTON) + { + sub_80CFDC4(); + return 0; + } + retVal = FALSE; + } + } + else + { + retVal = TRUE; + if (sBoxCursorPosition >= IN_BOX_ROWS) + { + cursorPosition -= IN_BOX_ROWS; + } + else + { + cursorArea = CURSOR_AREA_BOX; + cursorPosition = 0; + } + } + + if (retVal) + sub_80CD894(cursorArea, cursorPosition); + + return retVal; +} +#else +NAKED +static u8 InBoxInput_Normal(void) +{ + asm_unified("\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + ldr r0, =sBoxCursorArea\n\ + ldrb r0, [r0]\n\ + mov r8, r0\n\ + ldr r2, =sBoxCursorPosition\n\ + ldrb r4, [r2]\n\ + ldr r5, =sPSSData\n\ + ldr r0, [r5]\n\ + ldr r1, =0x00000cd2\n\ + mov r10, r1\n\ + add r0, r10\n\ + movs r1, 0\n\ + strb r1, [r0]\n\ + ldr r0, [r5]\n\ + ldr r7, =0x00000cd3\n\ + adds r0, r7\n\ + strb r1, [r0]\n\ + ldr r0, [r5]\n\ + ldr r3, =0x00000cd7\n\ + mov r9, r3\n\ + add r0, r9\n\ + strb r1, [r0]\n\ + ldr r6, =gMain\n\ + ldrh r1, [r6, 0x30]\n\ + movs r0, 0x40\n\ + ands r0, r1\n\ + adds r3, r2, 0\n\ + cmp r0, 0\n\ + beq _080CF14C\n\ + b _080CF33C\n\ +_080CF14C:\n\ + movs r0, 0x80\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF1A8\n\ + movs r6, 0x1\n\ + lsls r0, r4, 24\n\ + movs r1, 0xC0\n\ + lsls r1, 19\n\ + adds r0, r1\n\ + lsrs r4, r0, 24\n\ + asrs r0, 24\n\ + cmp r0, 0x1D\n\ + bgt _080CF168\n\ + b _080CF358\n\ +_080CF168:\n\ + movs r2, 0x3\n\ + mov r8, r2\n\ + subs r0, 0x1E\n\ + lsls r0, 24\n\ + asrs r0, 24\n\ + movs r1, 0x3\n\ + bl __divsi3\n\ + lsls r0, 24\n\ + lsrs r4, r0, 24\n\ + ldr r0, [r5]\n\ + add r0, r10\n\ + strb r6, [r0]\n\ + ldr r0, [r5]\n\ + add r0, r9\n\ + strb r6, [r0]\n\ + b _080CF358\n\ + .pool\n\ +_080CF1A8:\n\ + movs r0, 0x20\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF1DE\n\ + movs r6, 0x1\n\ + movs r0, 0\n\ + ldrsb r0, [r3, r0]\n\ + movs r1, 0x6\n\ + bl __modsi3\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + beq _080CF1CA\n\ + lsls r0, r4, 24\n\ + movs r3, 0xFF\n\ + lsls r3, 24\n\ + b _080CF34C\n\ +_080CF1CA:\n\ + ldr r0, [r5]\n\ + adds r0, r7\n\ + movs r1, 0xFF\n\ + strb r1, [r0]\n\ + lsls r0, r4, 24\n\ + movs r1, 0xA0\n\ + lsls r1, 19\n\ + adds r0, r1\n\ + lsrs r4, r0, 24\n\ + b _080CF358\n\ +_080CF1DE:\n\ + movs r0, 0x10\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF212\n\ + movs r6, 0x1\n\ + movs r0, 0\n\ + ldrsb r0, [r3, r0]\n\ + adds r0, 0x1\n\ + movs r1, 0x6\n\ + bl __modsi3\n\ + cmp r0, 0\n\ + beq _080CF204\n\ + lsls r0, r4, 24\n\ + movs r2, 0x80\n\ + lsls r2, 17\n\ + adds r0, r2\n\ + lsrs r4, r0, 24\n\ + b _080CF358\n\ +_080CF204:\n\ + ldr r0, [r5]\n\ + adds r0, r7\n\ + strb r6, [r0]\n\ + lsls r0, r4, 24\n\ + movs r3, 0xFB\n\ + lsls r3, 24\n\ + b _080CF34C\n\ +_080CF212:\n\ + ldrh r1, [r6, 0x2E]\n\ + movs r0, 0x8\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF220\n\ + movs r6, 0x1\n\ + b _080CF352\n\ +_080CF220:\n\ + movs r4, 0x1\n\ + movs r0, 0x1\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF2E4\n\ + bl sub_80CFA5C\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + beq _080CF2E4\n\ + ldr r0, =sCanOnlyMove\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + bne _080CF244\n\ + movs r0, 0x8\n\ + b _080CF366\n\ + .pool\n\ +_080CF244:\n\ + ldr r1, [r5]\n\ + ldrb r0, [r1, 0x1]\n\ + cmp r0, 0x2\n\ + bne _080CF254\n\ + ldr r0, =sIsMonBeingMoved\n\ + ldrb r0, [r0]\n\ + cmp r0, 0x1\n\ + bne _080CF2D4\n\ +_080CF254:\n\ + movs r0, 0\n\ + bl sub_80CFF98\n\ + subs r0, 0x1\n\ + lsls r0, 24\n\ + asrs r0, 24\n\ + cmp r0, 0xE\n\ + bhi _080CF2E4\n\ + lsls r0, 2\n\ + ldr r1, =_080CF278\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ +_080CF278:\n\ + .4byte _080CF2B4\n\ + .4byte _080CF2B8\n\ + .4byte _080CF2BC\n\ + .4byte _080CF2C0\n\ + .4byte _080CF2C4\n\ + .4byte _080CF2E4\n\ + .4byte _080CF2E4\n\ + .4byte _080CF2E4\n\ + .4byte _080CF2E4\n\ + .4byte _080CF2E4\n\ + .4byte _080CF2E4\n\ + .4byte _080CF2C8\n\ + .4byte _080CF2CC\n\ + .4byte _080CF2E4\n\ + .4byte _080CF2D0\n\ +_080CF2B4:\n\ + movs r0, 0xB\n\ + b _080CF366\n\ +_080CF2B8:\n\ + movs r0, 0xC\n\ + b _080CF366\n\ +_080CF2BC:\n\ + movs r0, 0xD\n\ + b _080CF366\n\ +_080CF2C0:\n\ + movs r0, 0xE\n\ + b _080CF366\n\ +_080CF2C4:\n\ + movs r0, 0xF\n\ + b _080CF366\n\ +_080CF2C8:\n\ + movs r0, 0x10\n\ + b _080CF366\n\ +_080CF2CC:\n\ + movs r0, 0x11\n\ + b _080CF366\n\ +_080CF2D0:\n\ + movs r0, 0x12\n\ + b _080CF366\n\ +_080CF2D4:\n\ + ldr r2, =0x000021ff\n\ + adds r0, r1, r2\n\ + strb r4, [r0]\n\ + movs r0, 0x14\n\ + b _080CF366\n\ + .pool\n\ +_080CF2E4:\n\ + ldr r2, =gMain\n\ + ldrh r1, [r2, 0x2E]\n\ + movs r0, 0x2\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF2F8\n\ + movs r0, 0x13\n\ + b _080CF366\n\ + .pool\n\ +_080CF2F8:\n\ + ldr r0, =gSaveBlock2Ptr\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x13]\n\ + cmp r0, 0x1\n\ + bne _080CF326\n\ + ldrh r1, [r2, 0x2C]\n\ + movs r0, 0x80\n\ + lsls r0, 2\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF318\n\ + movs r0, 0xA\n\ + b _080CF366\n\ + .pool\n\ +_080CF318:\n\ + movs r0, 0x80\n\ + lsls r0, 1\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF326\n\ + movs r0, 0x9\n\ + b _080CF366\n\ +_080CF326:\n\ + ldrh r1, [r2, 0x2E]\n\ + movs r0, 0x4\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF338\n\ + bl sub_80CFDC4\n\ + movs r0, 0\n\ + b _080CF366\n\ +_080CF338:\n\ + movs r6, 0\n\ + b _080CF364\n\ +_080CF33C:\n\ + movs r6, 0x1\n\ + movs r0, 0\n\ + ldrsb r0, [r2, r0]\n\ + cmp r0, 0x5\n\ + ble _080CF352\n\ + lsls r0, r4, 24\n\ + movs r3, 0xFA\n\ + lsls r3, 24\n\ +_080CF34C:\n\ + adds r0, r3\n\ + lsrs r4, r0, 24\n\ + b _080CF358\n\ +_080CF352:\n\ + movs r0, 0x2\n\ + mov r8, r0\n\ + movs r4, 0\n\ +_080CF358:\n\ + cmp r6, 0\n\ + beq _080CF364\n\ + mov r0, r8\n\ + adds r1, r4, 0\n\ + bl sub_80CD894\n\ +_080CF364:\n\ + adds r0, r6, 0\n\ +_080CF366:\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r1}\n\ + bx r1\n\ + "); +} +#endif + +static u8 InBoxInput_GrabbingMultiple(void) +{ + if (gMain.heldKeys & A_BUTTON) + { + if (gMain.newAndRepeatedKeys & DPAD_UP) + { + if (sBoxCursorPosition / IN_BOX_ROWS != 0) + { + sub_80CD894(CURSOR_AREA_IN_BOX, sBoxCursorPosition - IN_BOX_ROWS); + return 21; + } + else + { + return 24; + } + } + else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + { + if (sBoxCursorPosition + IN_BOX_ROWS < IN_BOX_COUNT) + { + sub_80CD894(CURSOR_AREA_IN_BOX, sBoxCursorPosition + IN_BOX_ROWS); + return 21; + } + else + { + return 24; + } + } + else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + { + if (sBoxCursorPosition % IN_BOX_ROWS != 0) + { + sub_80CD894(CURSOR_AREA_IN_BOX, sBoxCursorPosition - 1); + return 21; + } + else + { + return 24; + } + } + else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + { + if ((sBoxCursorPosition + 1) % IN_BOX_ROWS != 0) + { + sub_80CD894(CURSOR_AREA_IN_BOX, sBoxCursorPosition + 1); + return 21; + } + else + { + return 24; + } + } + else + { + return 0; + } + } + else + { + if (sub_80D0BA4() == sBoxCursorPosition) + { + sPSSData->inBoxMovingMode = 0; + sPSSData->field_CB8->invisible = FALSE; + return 22; + } + else + { + sIsMonBeingMoved = (sPSSData->cursorMonSpecies != SPECIES_NONE); + sPSSData->inBoxMovingMode = 2; + sMovingMonOrigBoxId = StorageGetCurrentBox(); + return 23; + } + } +} + +static u8 InBoxInput_MovingMultiple(void) +{ + if (gMain.newAndRepeatedKeys & DPAD_UP) + { + if (sub_80D0580(0)) + { + sub_80CD894(CURSOR_AREA_IN_BOX, sBoxCursorPosition - IN_BOX_ROWS); + return 25; + } + else + { + return 24; + } + } + else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + { + if (sub_80D0580(1)) + { + sub_80CD894(CURSOR_AREA_IN_BOX, sBoxCursorPosition + IN_BOX_ROWS); + return 25; + } + else + { + return 24; + } + } + else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + { + if (sub_80D0580(2)) + { + sub_80CD894(CURSOR_AREA_IN_BOX, sBoxCursorPosition - 1); + return 25; + } + else + { + return 10; + } + } + else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + { + if (sub_80D0580(3)) + { + sub_80CD894(CURSOR_AREA_IN_BOX, sBoxCursorPosition + 1); + return 25; + } + else + { + return 9; + } + } + else if (gMain.newKeys & A_BUTTON) + { + if (sub_80D0BC0()) + { + sIsMonBeingMoved = FALSE; + sPSSData->inBoxMovingMode = 0; + return 26; + } + else + { + return 24; + } + } + else if (gMain.newKeys & B_BUTTON) + { + return 24; + } + else + { + if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR) + { + if (gMain.heldKeys & L_BUTTON) + return 10; + if (gMain.heldKeys & R_BUTTON) + return 9; + } + + return 0; + } +} + +#ifdef NONMATCHING +static u8 HandleInput_InParty(void) +{ + u8 retVal; + bool8 gotoBox; + s8 cursorArea = sBoxCursorArea; + s8 cursorPosition = sBoxCursorPosition; + + sPSSData->field_CD3 = 0; + sPSSData->field_CD2 = 0; + sPSSData->field_CD7 = 0; + gotoBox = FALSE; + retVal = 0; + + if (!(gMain.newAndRepeatedKeys & DPAD_UP)) + { + if (gMain.newAndRepeatedKeys & DPAD_DOWN) + { + if (++cursorPosition > PARTY_SIZE) + cursorPosition = 0; + if (cursorPosition != sBoxCursorPosition) + retVal = 1; + } + else if ((gMain.newAndRepeatedKeys & DPAD_LEFT) && sBoxCursorPosition != 0) + { + retVal = 1; + sPSSData->field_CD6 = sBoxCursorPosition; + cursorPosition = 0; + } + else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + { + if (sBoxCursorPosition == 0) + { + retVal = 1; + cursorPosition = sPSSData->field_CD6; + } + else + { + retVal = 6; + cursorArea = CURSOR_AREA_IN_BOX; + cursorPosition = 0; + } + } + else + { + if (gMain.newKeys & A_BUTTON) + { + if (sBoxCursorPosition == PARTY_SIZE) + { + if (sPSSData->boxOption == BOX_OPTION_DEPOSIT) + return 4; + + gotoBox = TRUE; + } + else if (sub_80CFA5C()) + { + if (!sCanOnlyMove) + return 8; + + switch (sub_80CFF98(0)) + { + case 1: + return 11; + case 2: + return 12; + case 3: + return 13; + case 4: + return 14; + case 5: + return 15; + case 12: + return 16; + case 13: + return 17; + case 15: + return 18; + } + } + } + + if (gMain.newKeys & B_BUTTON) + { + if (sPSSData->boxOption == BOX_OPTION_DEPOSIT) + return 19; + + gotoBox = TRUE; + } + + if (gotoBox) + { + retVal = 6; + cursorArea = CURSOR_AREA_IN_BOX; + cursorPosition = 0; + } + else if (gMain.newKeys & SELECT_BUTTON) + { + sub_80CFDC4(); + return 0; + } + } + } + else + { + if (--cursorPosition < 0) + cursorPosition = PARTY_SIZE; + if (cursorPosition != sBoxCursorPosition) + retVal = 1; + } + if (retVal != 0) + { + if (retVal != 6) + sub_80CD894(cursorArea, cursorPosition); + } + + return retVal; +} +#else +NAKED +static u8 HandleInput_InParty(void) +{ + asm_unified("\n\ + push {r4-r7,lr}\n\ + mov r7, r9\n\ + mov r6, r8\n\ + push {r6,r7}\n\ + ldr r0, =sBoxCursorArea\n\ + ldrb r0, [r0]\n\ + mov r9, r0\n\ + ldr r6, =sBoxCursorPosition\n\ + ldrb r4, [r6]\n\ + ldr r2, =sPSSData\n\ + ldr r0, [r2]\n\ + ldr r1, =0x00000cd3\n\ + adds r0, r1\n\ + movs r1, 0\n\ + strb r1, [r0]\n\ + ldr r0, [r2]\n\ + ldr r3, =0x00000cd2\n\ + adds r0, r3\n\ + strb r1, [r0]\n\ + ldr r0, [r2]\n\ + adds r3, 0x5\n\ + adds r0, r3\n\ + strb r1, [r0]\n\ + mov r8, r1\n\ + movs r7, 0\n\ + ldr r1, =gMain\n\ + ldrh r3, [r1, 0x30]\n\ + movs r0, 0x40\n\ + ands r0, r3\n\ + adds r5, r6, 0\n\ + mov r12, r1\n\ + cmp r0, 0\n\ + beq _080CF608\n\ + b _080CF7A8\n\ +_080CF608:\n\ + movs r0, 0x80\n\ + ands r0, r3\n\ + cmp r0, 0\n\ + beq _080CF64C\n\ + lsls r0, r4, 24\n\ + movs r1, 0x80\n\ + lsls r1, 17\n\ + adds r0, r1\n\ + lsrs r4, r0, 24\n\ + asrs r0, 24\n\ + cmp r0, 0x6\n\ + ble _080CF622\n\ + movs r4, 0\n\ +_080CF622:\n\ + lsls r0, r4, 24\n\ + asrs r0, 24\n\ + movs r1, 0\n\ + ldrsb r1, [r5, r1]\n\ + cmp r0, r1\n\ + bne _080CF630\n\ + b _080CF7C6\n\ +_080CF630:\n\ + movs r7, 0x1\n\ + b _080CF7CA\n\ + .pool\n\ +_080CF64C:\n\ + movs r0, 0x20\n\ + ands r0, r3\n\ + cmp r0, 0\n\ + beq _080CF670\n\ + ldrb r1, [r5]\n\ + movs r0, 0\n\ + ldrsb r0, [r5, r0]\n\ + cmp r0, 0\n\ + beq _080CF670\n\ + movs r7, 0x1\n\ + ldr r0, [r2]\n\ + ldr r2, =0x00000cd6\n\ + adds r0, r2\n\ + strb r1, [r0]\n\ + movs r4, 0\n\ + b _080CF7C6\n\ + .pool\n\ +_080CF670:\n\ + mov r3, r12\n\ + ldrh r1, [r3, 0x30]\n\ + movs r0, 0x10\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF69E\n\ + movs r0, 0\n\ + ldrsb r0, [r5, r0]\n\ + cmp r0, 0\n\ + bne _080CF694\n\ + movs r7, 0x1\n\ + ldr r0, [r2]\n\ + ldr r1, =0x00000cd6\n\ + adds r0, r1\n\ + ldrb r4, [r0]\n\ + b _080CF7C6\n\ + .pool\n\ +_080CF694:\n\ + movs r7, 0x6\n\ + movs r2, 0\n\ + mov r9, r2\n\ + movs r4, 0\n\ + b _080CF7C6\n\ +_080CF69E:\n\ + mov r3, r12\n\ + ldrh r1, [r3, 0x2E]\n\ + movs r0, 0x1\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF75C\n\ + movs r0, 0\n\ + ldrsb r0, [r5, r0]\n\ + cmp r0, 0x6\n\ + bne _080CF6C4\n\ + ldr r0, [r2]\n\ + ldrb r0, [r0, 0x1]\n\ + cmp r0, 0x1\n\ + bne _080CF6BE\n\ + movs r0, 0x4\n\ + b _080CF7D8\n\ +_080CF6BE:\n\ + movs r0, 0x1\n\ + mov r8, r0\n\ + b _080CF75C\n\ +_080CF6C4:\n\ + bl sub_80CFA5C\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + beq _080CF75C\n\ + ldr r0, =sCanOnlyMove\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + bne _080CF6E0\n\ + movs r0, 0x8\n\ + b _080CF7D8\n\ + .pool\n\ +_080CF6E0:\n\ + movs r0, 0\n\ + bl sub_80CFF98\n\ + subs r0, 0x1\n\ + lsls r0, 24\n\ + asrs r0, 24\n\ + cmp r0, 0xE\n\ + bhi _080CF75C\n\ + lsls r0, 2\n\ + ldr r1, =_080CF700\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ +_080CF700:\n\ + .4byte _080CF73C\n\ + .4byte _080CF740\n\ + .4byte _080CF744\n\ + .4byte _080CF748\n\ + .4byte _080CF74C\n\ + .4byte _080CF75C\n\ + .4byte _080CF75C\n\ + .4byte _080CF75C\n\ + .4byte _080CF75C\n\ + .4byte _080CF75C\n\ + .4byte _080CF75C\n\ + .4byte _080CF750\n\ + .4byte _080CF754\n\ + .4byte _080CF75C\n\ + .4byte _080CF758\n\ +_080CF73C:\n\ + movs r0, 0xB\n\ + b _080CF7D8\n\ +_080CF740:\n\ + movs r0, 0xC\n\ + b _080CF7D8\n\ +_080CF744:\n\ + movs r0, 0xD\n\ + b _080CF7D8\n\ +_080CF748:\n\ + movs r0, 0xE\n\ + b _080CF7D8\n\ +_080CF74C:\n\ + movs r0, 0xF\n\ + b _080CF7D8\n\ +_080CF750:\n\ + movs r0, 0x10\n\ + b _080CF7D8\n\ +_080CF754:\n\ + movs r0, 0x11\n\ + b _080CF7D8\n\ +_080CF758:\n\ + movs r0, 0x12\n\ + b _080CF7D8\n\ +_080CF75C:\n\ + ldr r2, =gMain\n\ + ldrh r1, [r2, 0x2E]\n\ + movs r0, 0x2\n\ + ands r0, r1\n\ + mov r12, r2\n\ + cmp r0, 0\n\ + beq _080CF784\n\ + ldr r0, =sPSSData\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x1]\n\ + cmp r0, 0x1\n\ + bne _080CF780\n\ + movs r0, 0x13\n\ + b _080CF7D8\n\ + .pool\n\ +_080CF780:\n\ + movs r1, 0x1\n\ + mov r8, r1\n\ +_080CF784:\n\ + mov r2, r8\n\ + cmp r2, 0\n\ + beq _080CF794\n\ + movs r7, 0x6\n\ + movs r3, 0\n\ + mov r9, r3\n\ + movs r4, 0\n\ + b _080CF7C6\n\ +_080CF794:\n\ + mov r0, r12\n\ + ldrh r1, [r0, 0x2E]\n\ + movs r0, 0x4\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF7C6\n\ + bl sub_80CFDC4\n\ + movs r0, 0\n\ + b _080CF7D8\n\ +_080CF7A8:\n\ + lsls r0, r4, 24\n\ + movs r1, 0xFF\n\ + lsls r1, 24\n\ + adds r0, r1\n\ + lsrs r4, r0, 24\n\ + cmp r0, 0\n\ + bge _080CF7B8\n\ + movs r4, 0x6\n\ +_080CF7B8:\n\ + lsls r0, r4, 24\n\ + asrs r0, 24\n\ + movs r1, 0\n\ + ldrsb r1, [r6, r1]\n\ + cmp r0, r1\n\ + beq _080CF7C6\n\ + movs r7, 0x1\n\ +_080CF7C6:\n\ + cmp r7, 0\n\ + beq _080CF7D6\n\ +_080CF7CA:\n\ + cmp r7, 0x6\n\ + beq _080CF7D6\n\ + mov r0, r9\n\ + adds r1, r4, 0\n\ + bl sub_80CD894\n\ +_080CF7D6:\n\ + adds r0, r7, 0\n\ +_080CF7D8:\n\ + pop {r3,r4}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + pop {r4-r7}\n\ + pop {r1}\n\ + bx r1"); +} +#endif + +#ifdef NONMATCHING +static u8 HandleInput_OnBox(void) +{ + u8 retVal; + s8 cursorArea = sBoxCursorArea; + s8 cursorPosition = sBoxCursorPosition; + + sPSSData->field_CD3 = 0; + sPSSData->field_CD2 = 0; + sPSSData->field_CD7 = 0; + retVal = 0; + + if (!(gMain.newAndRepeatedKeys & DPAD_UP)) + { + if (gMain.newAndRepeatedKeys & DPAD_DOWN) + { + retVal = 1; + cursorArea = CURSOR_AREA_IN_BOX; + cursorPosition = 2; + } + else + { + if (gMain.heldKeys & DPAD_LEFT) + return 10; + if (gMain.heldKeys & DPAD_RIGHT) + return 9; + + if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR) + { + if (gMain.heldKeys & L_BUTTON) + return 10; + if (gMain.heldKeys & R_BUTTON) + return 9; + } + + if (gMain.newKeys & A_BUTTON) + { + sub_80CD1A8(FALSE); + AddBoxMenu(); + return 7; + } + + if (gMain.newKeys & B_BUTTON) + return 19; + + if (gMain.newKeys & SELECT_BUTTON) + { + sub_80CFDC4(); + return 0; + } + + retVal = 0; + } + } + else + { + retVal = 1; + cursorArea = CURSOR_AREA_BUTTONS; + cursorPosition = 0; + sPSSData->field_CD7 = 1; + } + + if (retVal) + { + if (cursorArea != CURSOR_AREA_BOX) + sub_80CD1A8(FALSE); + sub_80CD894(cursorArea, cursorPosition); + } + + return retVal; +} +#else +NAKED +static u8 HandleInput_OnBox(void) +{ + asm_unified("\n\ + push {r4-r6,lr}\n\ + ldr r3, =sPSSData\n\ + ldr r0, [r3]\n\ + ldr r1, =0x00000cd3\n\ + adds r0, r1\n\ + movs r1, 0\n\ + strb r1, [r0]\n\ + ldr r0, [r3]\n\ + ldr r2, =0x00000cd2\n\ + adds r0, r2\n\ + strb r1, [r0]\n\ + ldr r0, [r3]\n\ + ldr r5, =0x00000cd7\n\ + adds r0, r5\n\ + strb r1, [r0]\n\ + ldr r1, =gMain\n\ + ldrh r2, [r1, 0x30]\n\ + movs r0, 0x40\n\ + ands r0, r2\n\ + cmp r0, 0\n\ + bne _080CF8AA\n\ + movs r0, 0x80\n\ + ands r0, r2\n\ + cmp r0, 0\n\ + beq _080CF834\n\ + movs r4, 0x1\n\ + movs r1, 0\n\ + movs r6, 0x2\n\ + b _080CF8B6\n\ + .pool\n\ +_080CF834:\n\ + ldrh r2, [r1, 0x2C]\n\ + movs r0, 0x20\n\ + ands r0, r2\n\ + cmp r0, 0\n\ + bne _080CF85A\n\ + movs r0, 0x10\n\ + ands r0, r2\n\ + cmp r0, 0\n\ + bne _080CF86E\n\ + ldr r0, =gSaveBlock2Ptr\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x13]\n\ + cmp r0, 0x1\n\ + bne _080CF872\n\ + movs r0, 0x80\n\ + lsls r0, 2\n\ + ands r0, r2\n\ + cmp r0, 0\n\ + beq _080CF864\n\ +_080CF85A:\n\ + movs r0, 0xA\n\ + b _080CF8D2\n\ + .pool\n\ +_080CF864:\n\ + movs r0, 0x80\n\ + lsls r0, 1\n\ + ands r0, r2\n\ + cmp r0, 0\n\ + beq _080CF872\n\ +_080CF86E:\n\ + movs r0, 0x9\n\ + b _080CF8D2\n\ +_080CF872:\n\ + ldrh r1, [r1, 0x2E]\n\ + movs r0, 0x1\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF88A\n\ + movs r0, 0\n\ + bl sub_80CD1A8\n\ + bl AddBoxMenu\n\ + movs r0, 0x7\n\ + b _080CF8D2\n\ +_080CF88A:\n\ + movs r0, 0x2\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF896\n\ + movs r0, 0x13\n\ + b _080CF8D2\n\ +_080CF896:\n\ + movs r0, 0x4\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF8A6\n\ + bl sub_80CFDC4\n\ + movs r0, 0\n\ + b _080CF8D2\n\ +_080CF8A6:\n\ + movs r4, 0\n\ + b _080CF8D0\n\ +_080CF8AA:\n\ + movs r4, 0x1\n\ + movs r1, 0x3\n\ + movs r6, 0\n\ + ldr r0, [r3]\n\ + adds r0, r5\n\ + strb r4, [r0]\n\ +_080CF8B6:\n\ + cmp r4, 0\n\ + beq _080CF8D0\n\ + lsls r5, r1, 24\n\ + cmp r1, 0x2\n\ + beq _080CF8C6\n\ + movs r0, 0\n\ + bl sub_80CD1A8\n\ +_080CF8C6:\n\ + lsrs r0, r5, 24\n\ + lsls r1, r6, 24\n\ + lsrs r1, 24\n\ + bl sub_80CD894\n\ +_080CF8D0:\n\ + adds r0, r4, 0\n\ +_080CF8D2:\n\ + pop {r4-r6}\n\ + pop {r1}\n\ + bx r1\n\ + "); +} +#endif + +#ifdef NONMATCHING +static u8 HandleInput_OnButtons(void) +{ + u8 retVal; + s8 cursorArea = sBoxCursorArea; + s8 cursorPosition = sBoxCursorPosition; + + sPSSData->field_CD3 = 0; + sPSSData->field_CD2 = 0; + sPSSData->field_CD7 = 0; + + if (!(gMain.newAndRepeatedKeys & DPAD_UP)) + { + if (gMain.newAndRepeatedKeys & (DPAD_DOWN | START_BUTTON)) + { + retVal = 1; + cursorArea = CURSOR_AREA_BOX; + cursorPosition = 0; + sPSSData->field_CD7 = 1; + } + else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + { + retVal = 1; + if (--cursorPosition < 0) + { + cursorPosition = 1; + } + } + else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + { + retVal = 1; + if (++cursorPosition > 1) + { + cursorPosition = 0; + } + } + else if (gMain.newKeys & A_BUTTON) + { + return (cursorPosition == 0) ? 5 : 4; + } + else if (gMain.newKeys & B_BUTTON) + { + return 19; + } + else if (gMain.newKeys & SELECT_BUTTON) + { + sub_80CFDC4(); + return 0; + } + else + { + retVal = 0; + } + } + else + { + retVal = 1; + cursorArea = CURSOR_AREA_IN_BOX; + sPSSData->field_CD2 = -1; + cursorPosition = (sBoxCursorPosition == 0) ? IN_BOX_COUNT - 1 - 5 : IN_BOX_COUNT - 1; + sPSSData->field_CD7 = 1; + } + + if (retVal != 0) + { + sub_80CD894(cursorArea, cursorPosition); + } + + return retVal; +} +#else +NAKED +static u8 HandleInput_OnButtons(void) +{ + asm_unified("\n\ + push {r4-r7,lr}\n\ + mov r7, r8\n\ + push {r7}\n\ + ldr r0, =sBoxCursorArea\n\ + ldrb r0, [r0]\n\ + mov r8, r0\n\ + ldr r0, =sBoxCursorPosition\n\ + mov r12, r0\n\ + ldrb r2, [r0]\n\ + ldr r3, =sPSSData\n\ + ldr r0, [r3]\n\ + ldr r1, =0x00000cd3\n\ + adds r0, r1\n\ + movs r1, 0\n\ + strb r1, [r0]\n\ + ldr r0, [r3]\n\ + ldr r6, =0x00000cd2\n\ + adds r0, r6\n\ + strb r1, [r0]\n\ + ldr r0, [r3]\n\ + ldr r5, =0x00000cd7\n\ + adds r0, r5\n\ + strb r1, [r0]\n\ + ldr r7, =gMain\n\ + ldrh r1, [r7, 0x30]\n\ + movs r0, 0x40\n\ + ands r0, r1\n\ + adds r4, r3, 0\n\ + cmp r0, 0\n\ + bne _080CF9B2\n\ + movs r0, 0x88\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF944\n\ + movs r7, 0x1\n\ + movs r0, 0x2\n\ + mov r8, r0\n\ + movs r2, 0\n\ + ldr r0, [r4]\n\ + b _080CF9D0\n\ + .pool\n\ +_080CF944:\n\ + movs r0, 0x20\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF960\n\ + movs r7, 0x1\n\ + lsls r0, r2, 24\n\ + movs r1, 0xFF\n\ + lsls r1, 24\n\ + adds r0, r1\n\ + lsrs r2, r0, 24\n\ + cmp r0, 0\n\ + bge _080CF9D4\n\ + movs r2, 0x1\n\ + b _080CF9D4\n\ +_080CF960:\n\ + movs r0, 0x10\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF97E\n\ + movs r7, 0x1\n\ + lsls r0, r2, 24\n\ + movs r1, 0x80\n\ + lsls r1, 17\n\ + adds r0, r1\n\ + lsrs r2, r0, 24\n\ + asrs r0, 24\n\ + cmp r0, 0x1\n\ + ble _080CF9D4\n\ + movs r2, 0\n\ + b _080CF9D4\n\ +_080CF97E:\n\ + ldrh r1, [r7, 0x2E]\n\ + movs r0, 0x1\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF992\n\ + movs r0, 0x4\n\ + cmp r2, 0\n\ + bne _080CF9E2\n\ + movs r0, 0x5\n\ + b _080CF9E2\n\ +_080CF992:\n\ + movs r0, 0x2\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF99E\n\ + movs r0, 0x13\n\ + b _080CF9E2\n\ +_080CF99E:\n\ + movs r0, 0x4\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF9AE\n\ + bl sub_80CFDC4\n\ + movs r0, 0\n\ + b _080CF9E2\n\ +_080CF9AE:\n\ + movs r7, 0\n\ + b _080CF9E0\n\ +_080CF9B2:\n\ + movs r7, 0x1\n\ + movs r0, 0\n\ + mov r8, r0\n\ + ldr r0, [r3]\n\ + adds r0, r6\n\ + movs r1, 0xFF\n\ + strb r1, [r0]\n\ + mov r1, r12\n\ + movs r0, 0\n\ + ldrsb r0, [r1, r0]\n\ + movs r2, 0x1D\n\ + cmp r0, 0\n\ + bne _080CF9CE\n\ + movs r2, 0x18\n\ +_080CF9CE:\n\ + ldr r0, [r3]\n\ +_080CF9D0:\n\ + adds r0, r5\n\ + strb r7, [r0]\n\ +_080CF9D4:\n\ + cmp r7, 0\n\ + beq _080CF9E0\n\ + mov r0, r8\n\ + adds r1, r2, 0\n\ + bl sub_80CD894\n\ +_080CF9E0:\n\ + adds r0, r7, 0\n\ +_080CF9E2:\n\ + pop {r3}\n\ + mov r8, r3\n\ + pop {r4-r7}\n\ + pop {r1}\n\ + bx r1"); +} +#endif + +static u8 HandleInput(void) +{ + struct + { + u8 (*func)(void); + s8 area; + } + static const inputFuncs[] = + { + {HandleInput_InBox, CURSOR_AREA_IN_BOX}, + {HandleInput_InParty, CURSOR_AREA_IN_PARTY}, + {HandleInput_OnBox, CURSOR_AREA_BOX}, + {HandleInput_OnButtons, CURSOR_AREA_BUTTONS}, + {NULL, 0}, + }; + + u16 i = 0; + while (inputFuncs[i].func != NULL) + { + if (inputFuncs[i].area == sBoxCursorArea) + return inputFuncs[i].func(); + i++; + } + + return 0; +} + +static void AddBoxMenu(void) +{ + InitMenu(); + SetMenuText(9); + SetMenuText(10); + SetMenuText(11); + SetMenuText(0); +} + +static u8 sub_80CFA5C(void) +{ + InitMenu(); + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + return sub_80CFA84(); + else + return sub_80CFB44(); +} + +static bool8 sub_80CFA84(void) +{ + u16 var0 = sub_80CD504(); + + switch (sPSSData->boxOption) + { + case BOX_OPTION_DEPOSIT: + if (var0) + SetMenuText(1); + else + return FALSE; + break; + case BOX_OPTION_WITHDRAW: + if (var0) + SetMenuText(2); + else + return FALSE; + break; + case BOX_OPTION_MOVE_MONS: + if (sIsMonBeingMoved) + { + if (var0) + SetMenuText(4); + else + SetMenuText(5); + } + else + { + if (var0) + SetMenuText(3); + else + return FALSE; + } + break; + case BOX_OPTION_MOVE_ITEMS: + default: + return FALSE; + } + + SetMenuText(6); + if (sPSSData->boxOption == BOX_OPTION_MOVE_MONS) + { + if (!sBoxCursorArea) + SetMenuText(2); + else + SetMenuText(1); + } + + SetMenuText(8); + SetMenuText(7); + SetMenuText(0); + return TRUE; +} + +static bool8 sub_80CFB44(void) +{ + if (sPSSData->cursorMonSpecies == SPECIES_EGG) + return FALSE; + + if (!IsActiveItemMoving()) + { + if (sPSSData->cursorMonItem == 0) + { + if (sPSSData->cursorMonSpecies == SPECIES_NONE) + return FALSE; + + SetMenuText(14); + } + else + { + if (!ItemIsMail(sPSSData->cursorMonItem)) + { + SetMenuText(12); + SetMenuText(16); + } + SetMenuText(17); + } + } + else + { + if (sPSSData->cursorMonItem == 0) + { + if (sPSSData->cursorMonSpecies == SPECIES_NONE) + return FALSE; + + SetMenuText(13); + } + else + { + if (ItemIsMail(sPSSData->cursorMonItem) == TRUE) + return FALSE; + + SetMenuText(15); + } + } + + SetMenuText(0); + return TRUE; +} + +static void sub_80CFBF4(struct Sprite *sprite) +{ + sprite->pos1.x = sPSSData->field_CB4->pos1.x; + sprite->pos1.y = sPSSData->field_CB4->pos1.y + 20; +} + +static void sub_80CFC14(void) +{ + u16 x, y; + u8 spriteId; + u8 priority, subpriority; + struct SpriteSheet spriteSheets[] = + { + {gHandCursorTiles, 0x800, 0}, + {gHandCursorShadowTiles, 0x80, 1}, + {} + }; + + struct SpritePalette spritePalettes[] = + { + {gHandCursorPalette, TAG_PAL_DAC7}, + {} + }; + + static const struct OamData sOamData_857BA0C = + { + .size = 2, + .priority = 1, + }; + static const struct OamData sOamData_857BA14 = + { + .size = 1, + .priority = 1, + }; + + static const union AnimCmd sSpriteAnim_857BA1C[] = + { + ANIMCMD_FRAME(0, 30), + ANIMCMD_FRAME(16, 30), + ANIMCMD_JUMP(0) + }; + static const union AnimCmd sSpriteAnim_857BA28[] = + { + ANIMCMD_FRAME(0, 5), + ANIMCMD_END + }; + static const union AnimCmd sSpriteAnim_857BA30[] = + { + ANIMCMD_FRAME(32, 5), + ANIMCMD_END + }; + static const union AnimCmd sSpriteAnim_857BA38[] = + { + ANIMCMD_FRAME(48, 5), + ANIMCMD_END + }; + + static const union AnimCmd *const sSpriteAnimTable_857BA40[] = + { + sSpriteAnim_857BA1C, + sSpriteAnim_857BA28, + sSpriteAnim_857BA30, + sSpriteAnim_857BA38 + }; + + static const struct SpriteTemplate gSpriteTemplate_857BA50 = + { + .tileTag = TAG_TILE_0, + .paletteTag = TAG_PAL_WAVEFORM, + .oam = &sOamData_857BA0C, + .anims = sSpriteAnimTable_857BA40, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }; + + static const struct SpriteTemplate gSpriteTemplate_857BA68 = + { + .tileTag = TAG_TILE_1, + .paletteTag = TAG_PAL_WAVEFORM, + .oam = &sOamData_857BA14, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80CFBF4, + }; + + LoadSpriteSheets(spriteSheets); + LoadSpritePalettes(spritePalettes); + sPSSData->field_CD8[0] = IndexOfSpritePaletteTag(TAG_PAL_WAVEFORM); + sPSSData->field_CD8[1] = IndexOfSpritePaletteTag(TAG_PAL_DAC7); + + sub_80CD444(sBoxCursorArea, sBoxCursorPosition, &x, &y); + spriteId = CreateSprite(&gSpriteTemplate_857BA50, x, y, 6); + if (spriteId != MAX_SPRITES) + { + sPSSData->field_CB4 = &gSprites[spriteId]; + sPSSData->field_CB4->oam.paletteNum = sPSSData->field_CD8[sCanOnlyMove]; + sPSSData->field_CB4->oam.priority = 1; + if (sIsMonBeingMoved) + StartSpriteAnim(sPSSData->field_CB4, 3); + } + else + { + sPSSData->field_CB4 = NULL; + } + + if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) + { + subpriority = 13; + priority = 1; + } + else + { + subpriority = 21; + priority = 2; + } + + spriteId = CreateSprite(&gSpriteTemplate_857BA68, 0, 0, subpriority); + if (spriteId != MAX_SPRITES) + { + sPSSData->field_CB8 = &gSprites[spriteId]; + sPSSData->field_CB8->oam.priority = priority; + if (sBoxCursorArea) + sPSSData->field_CB8->invisible = 1; + } + else + { + sPSSData->field_CB8 = NULL; + } +} + +static void sub_80CFDC4(void) +{ + sCanOnlyMove = !sCanOnlyMove; + sPSSData->field_CB4->oam.paletteNum = sPSSData->field_CD8[sCanOnlyMove]; +} + +static u8 GetBoxCursorPosition(void) +{ + return sBoxCursorPosition; +} + +static void sub_80CFE14(u8 *arg0, u8 *arg1) +{ + if (sBoxCursorArea == CURSOR_AREA_IN_BOX) + { + *arg0 = sBoxCursorPosition % IN_BOX_ROWS; + *arg1 = sBoxCursorPosition / IN_BOX_ROWS; + } + else + { + *arg0 = 0; + *arg1 = 0; + } +} + +static void sub_80CFE54(u8 animNum) +{ + StartSpriteAnim(sPSSData->field_CB4, animNum); +} + +static u8 sub_80CFE78(void) +{ + return sMovingMonOrigBoxId; +} + +static void sub_80CFE84(void) +{ + sPSSData->field_CB4->oam.priority = 1; +} + +static void sub_80CFEA8(void) +{ + if (sBoxCursorArea == CURSOR_AREA_IN_BOX) + sub_80D0E50(CURSOR_AREA_IN_BOX, sBoxCursorPosition); +} + +static void sub_80CFECC(void) +{ + if (sBoxCursorArea == CURSOR_AREA_IN_BOX) + sub_80D0D8C(CURSOR_AREA_IN_BOX, sBoxCursorPosition); +} + +static void InitMenu(void) +{ + sPSSData->menuItemsCount = 0; + sPSSData->menuWidth = 0; + sPSSData->menuWindow.bg = 0; + sPSSData->menuWindow.paletteNum = 15; + sPSSData->menuWindow.baseBlock = 92; +} + +static const u8 *const gUnknown_0857BA80[] = +{ + gPCText_Cancel, + gPCText_Store, + gPCText_Withdraw, + gPCText_Move, + gPCText_Shift, + gPCText_Place, + gPCText_Summary, + gPCText_Release, + gPCText_Mark, + gPCText_Jump, + gPCText_Wallpaper, + gPCText_Name, + gPCText_Take, + gPCText_Give, + gPCText_Give, + gPCText_Switch, + gPCText_Bag, + gPCText_Info, + gPCText_Scenery1, + gPCText_Scenery2, + gPCText_Scenery3, + gPCText_Etcetera, + gPCText_Friends, + gPCText_Forest, + gPCText_City, + gPCText_Desert, + gPCText_Savanna, + gPCText_Crag, + gPCText_Volcano, + gPCText_Snow, + gPCText_Cave, + gPCText_Beach, + gPCText_Seafloor, + gPCText_River, + gPCText_Sky, + gPCText_PolkaDot, + gPCText_Pokecenter, + gPCText_Machine, + gPCText_Simple, +}; + +static void SetMenuText(u8 textId) +{ + if (sPSSData->menuItemsCount < 7) + { + u8 len; + struct StorageMenu *menu = &sPSSData->menuItems[sPSSData->menuItemsCount]; + + menu->text = gUnknown_0857BA80[textId]; + menu->textId = textId; + len = StringLength(menu->text); + if (len > sPSSData->menuWidth) + sPSSData->menuWidth = len; + + sPSSData->menuItemsCount++; + } +} + +static s8 sub_80CFF98(u8 arg0) +{ + if (arg0 >= sPSSData->menuItemsCount) + return -1; + else + return sPSSData->menuItems[arg0].textId; +} + +static void AddMenu(void) +{ + sPSSData->menuWindow.width = sPSSData->menuWidth + 2; + sPSSData->menuWindow.height = 2 * sPSSData->menuItemsCount; + sPSSData->menuWindow.tilemapLeft = 29 - sPSSData->menuWindow.width; + sPSSData->menuWindow.tilemapTop = 15 - sPSSData->menuWindow.height; + sPSSData->field_CB0 = AddWindow(&sPSSData->menuWindow); + ClearWindowTilemap(sPSSData->field_CB0); + SetWindowBorderStyle(sPSSData->field_CB0, FALSE, 11, 14); + PrintMenuTable(sPSSData->field_CB0, sPSSData->menuItemsCount, (void*)sPSSData->menuItems); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sPSSData->field_CB0, sPSSData->menuItemsCount, 0); + schedule_bg_copy_tilemap_to_vram(0); + sPSSData->field_CAE = 0; +} + +static bool8 sub_80D00A8(void) +{ + return FALSE; +} + +static s16 sub_80D00AC(void) +{ + s32 textId = -2; + + if (!(gMain.newKeys & A_BUTTON)) + { + if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + textId = -1; + } + + if (gMain.newKeys & DPAD_UP) + { + PlaySE(SE_SELECT); + Menu_MoveCursor(-1); + } + else if (gMain.newKeys & DPAD_DOWN) + { + PlaySE(SE_SELECT); + Menu_MoveCursor(1); + } + } + else + { + textId = Menu_GetCursorPos(); + } + + if (textId != -2) + sub_80D013C(); + + if (textId >= 0) + textId = sPSSData->menuItems[textId].textId; + + #ifndef NONMATCHING + asm("":::"r4"); + #endif // NONMATCHING + return textId; +} + +static void sub_80D013C(void) +{ + sub_8198070(sPSSData->field_CB0, TRUE); + RemoveWindow(sPSSData->field_CB0); +} + +// The functions below handle moving and grabbing multiple mons at once. +// The icons are converted to background 0 which coordinates are changed while moving mons. +// There is also a bit of math involved in determining how many column/rows of mons to grab/move. + +static const struct WindowTemplate gUnknown_0857BB1C = +{ + .bg = 0, + .tilemapLeft = 10, + .tilemapTop = 3, + .width = 20, + .height = 18, + .paletteNum = 9, + .baseBlock = 0xA, +}; + +EWRAM_DATA static struct +{ + u8 field_0; + u8 state; + u8 fromRow; + u8 fromColumn; + u8 toRow; + u8 toColumn; + u8 field_6; + u8 field_7; + u8 minRow; + u8 minColumn; + u8 rowsTotal; + u8 columsTotal; + u16 bgX; + u16 bgY; + u16 field_10; + struct BoxPokemon boxMons[IN_BOX_COUNT]; +} +*sMoveMonsPtr = NULL; + +static bool8 sub_80D0164(void) +{ + sMoveMonsPtr = Alloc(sizeof(*sMoveMonsPtr)); + if (sMoveMonsPtr != NULL) + { + sPSSData->field_2200 = AddWindow8Bit(&gUnknown_0857BB1C); + if (sPSSData->field_2200 != 0xFF) + { + FillWindowPixelBuffer(sPSSData->field_2200, 0); + return TRUE; + } + } + + return FALSE; +} + +static void sub_80D01B8(void) +{ + if (sMoveMonsPtr != NULL) + Free(sMoveMonsPtr); +} + +static void sub_80D01D0(u8 arg0) +{ + sMoveMonsPtr->field_0 = arg0; + sMoveMonsPtr->state = 0; +} + +static bool8 sub_80D01E4(void) +{ + switch (sMoveMonsPtr->field_0) + { + case 0: + return sub_80D024C(); + case 1: + return sub_80D0344(); + case 2: + return sub_80D03B0(); + case 3: + return sub_80D0420(); + case 4: + return sub_80D04A0(); + case 5: + return sub_80D04C8(); + } + + return FALSE; +} + +static bool8 sub_80D024C(void) +{ + switch (sMoveMonsPtr->state) + { + case 0: + HideBg(0); + sub_80D304C(0x80); + sMoveMonsPtr->state++; + break; + case 1: + sub_80CFE14(&sMoveMonsPtr->fromRow, &sMoveMonsPtr->fromColumn); + sMoveMonsPtr->toRow = sMoveMonsPtr->fromRow; + sMoveMonsPtr->toColumn = sMoveMonsPtr->fromColumn; + ChangeBgX(0, -1024, 0); + ChangeBgY(0, -1024, 0); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20); + FillWindowPixelBuffer8Bit(sPSSData->field_2200, 0); + sub_80D07B0(sMoveMonsPtr->fromRow, sMoveMonsPtr->fromColumn); + SetBgAttribute(0, 4, 1); + PutWindowTilemap(sPSSData->field_2200); + CopyWindowToVram8Bit(sPSSData->field_2200, 3); + BlendPalettes(0x3F00, 8, RGB_WHITE); + sub_80CFE54(2); + SetGpuRegBits(REG_OFFSET_BG0CNT, BGCNT_256COLOR); + sMoveMonsPtr->state++; + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + { + ShowBg(0); + return FALSE; + } + break; + } + + return TRUE; +} + +static bool8 sub_80D0344(void) +{ + switch (sMoveMonsPtr->state) + { + case 0: + HideBg(0); + sMoveMonsPtr->state++; + break; + case 1: + sub_80D0B5C(); + sub_80CFE54(0); + sMoveMonsPtr->state++; + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + { + sub_80CFE84(); + LoadPalette(stdpal_get(3), 0xD0, 0x20); + ShowBg(0); + return FALSE; + } + break; + } + + return TRUE; +} + +static bool8 sub_80D03B0(void) +{ + switch (sMoveMonsPtr->state) + { + case 0: + if (!sub_80CD554()) + { + sub_80CFE14(&sMoveMonsPtr->field_6, &sMoveMonsPtr->field_7); + sub_80D062C(); + sMoveMonsPtr->toRow = sMoveMonsPtr->field_6; + sMoveMonsPtr->toColumn = sMoveMonsPtr->field_7; + CopyWindowToVram8Bit(sPSSData->field_2200, 2); + sMoveMonsPtr->state++; + } + break; + case 1: + return IsDma3ManagerBusyWithBgCopy(); + } + + return TRUE; +} + +static bool8 sub_80D0420(void) +{ + u8 var1, var2; + + switch (sMoveMonsPtr->state) + { + case 0: + sub_80D08CC(); + sub_80D09A4(); + sub_80CDC64(FALSE); + sMoveMonsPtr->state++; + break; + case 1: + if (!DoMonPlaceChange()) + { + sub_80CFE54(3); + sub_80D0884(0, 256, 8); + sub_80CDC64(TRUE); + sMoveMonsPtr->state++; + } + break; + case 2: + var1 = sub_80D0894(); + var2 = DoMonPlaceChange(); + if (!var1 && !var2) + return FALSE; + break; + } + + return TRUE; +} + +static bool8 sub_80D04A0(void) +{ + u8 var1 = sub_80CD554(); + u8 var2 = sub_80D0894(); + + if (!var1 && !var2) + return FALSE; + else + return TRUE; +} + +static bool8 sub_80D04C8(void) +{ + switch (sMoveMonsPtr->state) + { + case 0: + sub_80D0AAC(); + sub_80D0884(0, -256, 8); + sub_80CDC64(FALSE); + sMoveMonsPtr->state++; + break; + case 1: + if (!DoMonPlaceChange() && !sub_80D0894()) + { + sub_80D0A1C(); + sub_80CFE54(2); + sub_80CDC64(TRUE); + HideBg(0); + sMoveMonsPtr->state++; + } + break; + case 2: + if (!DoMonPlaceChange()) + { + sub_80CFE54(0); + sub_80D0B5C(); + sMoveMonsPtr->state++; + } + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + { + LoadPalette(stdpal_get(3), 0xD0, 0x20); + sub_80CFE84(); + ShowBg(0); + return FALSE; + } + break; + } + + return TRUE; +} + +static bool8 sub_80D0580(u8 arg0) +{ + switch (arg0) + { + case 0: + if (sMoveMonsPtr->minColumn == 0) + return FALSE; + sMoveMonsPtr->minColumn--; + sub_80D0884(0, 1024, 6); + break; + case 1: + if (sMoveMonsPtr->minColumn + sMoveMonsPtr->columsTotal >= 5) + return FALSE; + sMoveMonsPtr->minColumn++; + sub_80D0884(0, -1024, 6); + break; + case 2: + if (sMoveMonsPtr->minRow == 0) + return FALSE; + sMoveMonsPtr->minRow--; + sub_80D0884(1024, 0, 6); + break; + case 3: + if (sMoveMonsPtr->minRow + sMoveMonsPtr->rowsTotal > 5) + return FALSE; + sMoveMonsPtr->minRow++; + sub_80D0884(-1024, 0, 6); + break; + } + + return TRUE; +} + +static void sub_80D062C(void) +{ + s16 var = (abs(sMoveMonsPtr->fromRow - sMoveMonsPtr->field_6)) - (abs(sMoveMonsPtr->fromRow - sMoveMonsPtr->toRow)); + s16 var2 = (abs(sMoveMonsPtr->fromColumn - sMoveMonsPtr->field_7)) - (abs(sMoveMonsPtr->fromColumn - sMoveMonsPtr->toColumn)); + + if (var > 0) + sub_80D06D0(sMoveMonsPtr->field_6, sMoveMonsPtr->fromColumn, sMoveMonsPtr->toColumn); + + if (var < 0) + { + sub_80D0740(sMoveMonsPtr->toRow, sMoveMonsPtr->fromColumn, sMoveMonsPtr->toColumn); + sub_80D06D0(sMoveMonsPtr->field_6, sMoveMonsPtr->fromColumn, sMoveMonsPtr->toColumn); + } + + if (var2 > 0) + sub_80D0708(sMoveMonsPtr->field_7, sMoveMonsPtr->fromRow, sMoveMonsPtr->toRow); + + if (var2 < 0) + { + sub_80D0778(sMoveMonsPtr->toColumn, sMoveMonsPtr->fromRow, sMoveMonsPtr->toRow); + sub_80D0708(sMoveMonsPtr->field_7, sMoveMonsPtr->fromRow, sMoveMonsPtr->toRow); + } +} + +static void sub_80D06D0(u8 arg0, u8 arg1, u8 arg2) +{ + u8 var1 = arg1; + + if (arg1 > arg2) + { + arg1 = arg2; + arg2 = var1; + } + + while (arg1 <= arg2) + sub_80D07B0(arg0, arg1++); +} + +static void sub_80D0708(u8 arg0, u8 arg1, u8 arg2) +{ + u8 var1 = arg1; + + if (arg1 > arg2) + { + arg1 = arg2; + arg2 = var1; + } + + while (arg1 <= arg2) + sub_80D07B0(arg1++, arg0); +} + +static void sub_80D0740(u8 arg0, u8 arg1, u8 arg2) +{ + u8 var1 = arg1; + + if (arg1 > arg2) + { + arg1 = arg2; + arg2 = var1; + } + + while (arg1 <= arg2) + sub_80D0834(arg0, arg1++); +} + +static void sub_80D0778(u8 arg0, u8 arg1, u8 arg2) +{ + u8 var1 = arg1; + + if (arg1 > arg2) + { + arg1 = arg2; + arg2 = var1; + } + + while (arg1 <= arg2) + sub_80D0834(arg1++, arg0); +} + +static void sub_80D07B0(u8 arg0, u8 arg1) +{ + u8 position = arg0 + (6 * arg1); + u16 species = GetCurrentBoxMonData(position, MON_DATA_SPECIES2); + u32 personality = GetCurrentBoxMonData(position, MON_DATA_PERSONALITY); + + if (species != SPECIES_NONE) + { + const u8 *iconGfx = GetMonIconPtr(species, personality, 1); + u8 index = GetValidMonIconPalIndex(species) + 8; + + BlitBitmapRectToWindow4BitTo8Bit(sPSSData->field_2200, + iconGfx, + 0, + 0, + 32, + 32, + 24 * arg0, + 24 * arg1, + 32, + 32, + index); + } +} + +static void sub_80D0834(u8 arg0, u8 arg1) +{ + u8 position = arg0 + (6 * arg1); + u16 species = GetCurrentBoxMonData(position, MON_DATA_SPECIES2); + + if (species != SPECIES_NONE) + { + FillWindowPixelRect8Bit(sPSSData->field_2200, + 0, + 24 * arg0, + 24 * arg1, + 32, + 32); + } +} + +static void sub_80D0884(u16 arg0, u16 arg1, u16 arg2) +{ + sMoveMonsPtr->bgX = arg0; + sMoveMonsPtr->bgY = arg1; + sMoveMonsPtr->field_10 = arg2; +} + +static u8 sub_80D0894(void) +{ + if (sMoveMonsPtr->field_10 != 0) + { + ChangeBgX(0, sMoveMonsPtr->bgX, 1); + ChangeBgY(0, sMoveMonsPtr->bgY, 1); + sMoveMonsPtr->field_10--; + } + + return sMoveMonsPtr->field_10; +} + +static void sub_80D08CC(void) +{ + s32 i, j, r8, r9; + s32 rowCount, columnCount; + u8 boxId; + u8 monArrayId; + + sMoveMonsPtr->minRow = min(sMoveMonsPtr->fromRow, sMoveMonsPtr->toRow); + sMoveMonsPtr->minColumn = min(sMoveMonsPtr->fromColumn, sMoveMonsPtr->toColumn); + sMoveMonsPtr->rowsTotal = abs(sMoveMonsPtr->fromRow - sMoveMonsPtr->toRow) + 1; + sMoveMonsPtr->columsTotal = abs(sMoveMonsPtr->fromColumn - sMoveMonsPtr->toColumn) + 1; + boxId = StorageGetCurrentBox(); + monArrayId = 0; + rowCount = sMoveMonsPtr->minRow + sMoveMonsPtr->rowsTotal; + columnCount = sMoveMonsPtr->minColumn + sMoveMonsPtr->columsTotal; + for (i = sMoveMonsPtr->minColumn; i < columnCount; i++) + { + u8 boxPosition = (IN_BOX_ROWS * i) + sMoveMonsPtr->minRow; + for (j = sMoveMonsPtr->minRow; j < rowCount; j++) + { + struct BoxPokemon *boxMon = GetBoxedMonPtr(boxId, boxPosition); + + sMoveMonsPtr->boxMons[monArrayId] = *boxMon; + monArrayId++; + boxPosition++; + } + } +} + +static void sub_80D09A4(void) +{ + s32 i, j; + s32 rowCount = sMoveMonsPtr->minRow + sMoveMonsPtr->rowsTotal; + s32 columnCount = sMoveMonsPtr->minColumn + sMoveMonsPtr->columsTotal; + u8 boxId = StorageGetCurrentBox(); + + for (i = sMoveMonsPtr->minColumn; i < columnCount; i++) + { + u8 boxPosition = (IN_BOX_ROWS * i) + sMoveMonsPtr->minRow; + for (j = sMoveMonsPtr->minRow; j < rowCount; j++) + { + DestroyBoxMonIconAtPosition(boxPosition); + ZeroBoxMonAt(boxId, boxPosition); + boxPosition++; + } + } +} + +static void sub_80D0A1C(void) +{ + s32 i, j; + s32 rowCount = sMoveMonsPtr->minRow + sMoveMonsPtr->rowsTotal; + s32 columnCount = sMoveMonsPtr->minColumn + sMoveMonsPtr->columsTotal; + u8 monArrayId = 0; + + for (i = sMoveMonsPtr->minColumn; i < columnCount; i++) + { + u8 boxPosition = (IN_BOX_ROWS * i) + sMoveMonsPtr->minRow; + for (j = sMoveMonsPtr->minRow; j < rowCount; j++) + { + if (GetBoxMonData(&sMoveMonsPtr->boxMons[monArrayId], MON_DATA_SANITY_HAS_SPECIES)) + sub_80CB140(boxPosition); + monArrayId++; + boxPosition++; + } + } +} + +static void sub_80D0AAC(void) +{ + s32 i, j; + s32 rowCount = sMoveMonsPtr->minRow + sMoveMonsPtr->rowsTotal; + s32 columnCount = sMoveMonsPtr->minColumn + sMoveMonsPtr->columsTotal; + u8 boxId = StorageGetCurrentBox(); + u8 monArrayId = 0; + + for (i = sMoveMonsPtr->minColumn; i < columnCount; i++) + { + u8 boxPosition = (IN_BOX_ROWS * i) + sMoveMonsPtr->minRow; + for (j = sMoveMonsPtr->minRow; j < rowCount; j++) + { + if (GetBoxMonData(&sMoveMonsPtr->boxMons[monArrayId], MON_DATA_SANITY_HAS_SPECIES)) + SetBoxMonAt(boxId, boxPosition, &sMoveMonsPtr->boxMons[monArrayId]); + boxPosition++; + monArrayId++; + } + } +} + +static void sub_80D0B5C(void) +{ + ChangeBgX(0, 0, 0); + ChangeBgY(0, 0, 0); + SetBgAttribute(0, 4, 0); + ClearGpuRegBits(REG_OFFSET_BG0CNT, BGCNT_256COLOR); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32); + CopyBgTilemapBufferToVram(0); +} + +static u8 sub_80D0BA4(void) +{ + return (IN_BOX_ROWS * sMoveMonsPtr->fromColumn) + sMoveMonsPtr->fromRow; +} + +static bool8 sub_80D0BC0(void) +{ + s32 i, j; + s32 rowCount = sMoveMonsPtr->minRow + sMoveMonsPtr->rowsTotal; + s32 columnCount = sMoveMonsPtr->minColumn + sMoveMonsPtr->columsTotal; + u8 monArrayId = 0; + + for (i = sMoveMonsPtr->minColumn; i < columnCount; i++) + { + u8 boxPosition = (IN_BOX_ROWS * i) + sMoveMonsPtr->minRow; + for (j = sMoveMonsPtr->minRow; j < rowCount; j++) + { + if (GetBoxMonData(&sMoveMonsPtr->boxMons[monArrayId], MON_DATA_SANITY_HAS_SPECIES) + && GetCurrentBoxMonData(boxPosition, MON_DATA_SANITY_HAS_SPECIES)) + return FALSE; + + monArrayId++; + boxPosition++; + } + } + + return TRUE; +} + +static const u32 gUnknown_0857BB24[] = INCBIN_U32("graphics/pokemon_storage/unknown_frame.4bpp"); + +static const struct OamData sOamData_857BBA4 = +{ + .y = 0, + .affineMode = 1, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 2, + .tileNum = 0, + .priority = 1, + .paletteNum = 0, + .affineParam = 0 +}; + +static const union AffineAnimCmd sSpriteAffineAnim_857BBAC[] = +{ + AFFINEANIMCMD_FRAME(128, 128, 0, 0), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_857BBBC[] = +{ + AFFINEANIMCMD_FRAME(88, 88, 0, 0), + AFFINEANIMCMD_FRAME(5, 5, 0, 8), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_857BBD4[] = +{ + AFFINEANIMCMD_FRAME(128, 128, 0, 0), + AFFINEANIMCMD_FRAME(-5, -5, 0, 8), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_857BBEC[] = +{ + AFFINEANIMCMD_FRAME(128, 128, 0, 0), + AFFINEANIMCMD_FRAME(10, 10, 0, 12), + AFFINEANIMCMD_FRAME(256, 256, 0, 0), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_857BC0C[] = +{ + AFFINEANIMCMD_FRAME(256, 256, 0, 0), + AFFINEANIMCMD_FRAME(-10, -10, 0, 12), + AFFINEANIMCMD_FRAME(128, 128, 0, 0), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_857BC2C[] = +{ + AFFINEANIMCMD_FRAME(256, 256, 0, 0), + AFFINEANIMCMD_FRAME(-5, -5, 0, 16), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd sSpriteAffineAnim_857BC44[] = +{ + AFFINEANIMCMD_FRAME(256, 256, 0, 0), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd *const sSpriteAffineAnimTable_857BC44[] = +{ + sSpriteAffineAnim_857BBAC, + sSpriteAffineAnim_857BBBC, + sSpriteAffineAnim_857BBD4, + sSpriteAffineAnim_857BBEC, + sSpriteAffineAnim_857BC0C, + sSpriteAffineAnim_857BC2C, + sSpriteAffineAnim_857BC44 +}; + +static const struct SpriteTemplate gSpriteTemplate_857BC70 = +{ + .tileTag = TAG_TILE_7, + .paletteTag = TAG_PAL_DACB, + .oam = &sOamData_857BBA4, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = sSpriteAffineAnimTable_857BC44, + .callback = SpriteCallbackDummy, +}; + +static void sub_80D0C60(void) +{ + s32 i; + u8 spriteId; + struct CompressedSpriteSheet spriteSheet; + struct SpriteTemplate spriteTemplate; + + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) + { + spriteSheet.data = gUnknown_03000F78; + spriteSheet.size = 0x200; + spriteTemplate = gSpriteTemplate_857BC70; + + for (i = 0; i < 3; i++) + { + spriteSheet.tag = TAG_TILE_7 + i; + LoadCompressedSpriteSheet(&spriteSheet); + sPSSData->field_2204[i].tiles = GetSpriteTileStartByTag(spriteSheet.tag) * 32 + (void*)(OBJ_VRAM0); + sPSSData->field_2204[i].palIndex = AllocSpritePalette(TAG_PAL_DACB + i); + sPSSData->field_2204[i].palIndex *= 16; + sPSSData->field_2204[i].palIndex += 0x100; + spriteTemplate.tileTag = TAG_TILE_7 + i; + spriteTemplate.paletteTag = TAG_PAL_DACB + i; + spriteId = CreateSprite(&spriteTemplate, 0, 0, 11); + sPSSData->field_2204[i].sprite = &gSprites[spriteId]; + sPSSData->field_2204[i].sprite->invisible = TRUE; + sPSSData->field_2204[i].unk10 = 0; + } + } + sPSSData->movingItem = 0; +} + +// The functions below handle new features of MOVE_ITEMS box option. +static bool32 sub_80D1324(u8 cursorArea, u8 cursorPos); +static const u32 *GetItemIconPic(u16 itemId); +static const u32 *GetItemIconPalette(u16 itemId); +static u8 sub_80D12E8(void); +static void sub_80D140C(u8 id, u8 cursorArea, u8 cursorPos); +static void sub_80D1524(u8 id, const u32 *itemTiles, const u32 *itemPal); +static void sub_80D15D4(u8 id, u8 animNum); +static void sub_80D1740(u8 id, bool8 arg1); +static u8 sub_80D1370(u8 cursorArea, u8 cursorPos); +static void sub_80D1604(u8 id, u8 arg1, u8 arg2, u8 arg3); +static void sub_80D1AD8(struct Sprite *sprite); +static void sub_80D1A48(struct Sprite *sprite); +static void sub_80D1A74(struct Sprite *sprite); +static void sub_80D1B14(struct Sprite *sprite); +static void sub_80D1B94(struct Sprite *sprite); +static void sub_80D1CCC(struct Sprite *sprite); +static void sub_80D1C30(struct Sprite *sprite); + +static void sub_80D0D8C(u8 cursorArea, u8 cursorPos) +{ + u16 heldItem; + + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + return; + if (sub_80D1324(cursorArea, cursorPos)) + return; + + switch (cursorArea) + { + case CURSOR_AREA_IN_BOX: + if (!GetCurrentBoxMonData(cursorPos, MON_DATA_SANITY_HAS_SPECIES)) + return; + heldItem = GetCurrentBoxMonData(cursorPos, MON_DATA_HELD_ITEM); + break; + case CURSOR_AREA_IN_PARTY: + if (cursorPos >= PARTY_SIZE || !GetMonData(&gPlayerParty[cursorPos], MON_DATA_SANITY_HAS_SPECIES)) + return; + heldItem = GetMonData(&gPlayerParty[cursorPos], MON_DATA_HELD_ITEM); + break; + default: + return; + } + + if (heldItem != 0) + { + const u32 *tiles = GetItemIconPic(heldItem); + const u32 *pal = GetItemIconPalette(heldItem); + u8 id = sub_80D12E8(); + + sub_80D140C(id, cursorArea, cursorPos); + sub_80D1524(id, tiles, pal); + sub_80D15D4(id, 1); + sub_80D1740(id, TRUE); + } +} + +static void sub_80D0E50(u8 cursorArea, u8 cursorPos) +{ + u8 id; + + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + return; + + id = sub_80D1370(cursorArea, cursorPos); + sub_80D15D4(id, 2); + sub_80D1604(id, 0, cursorArea, cursorPos); +} + +static void Item_FromMonToMoving(u8 cursorArea, u8 cursorPos) +{ + u8 id; + u16 item; + + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + return; + + id = sub_80D1370(cursorArea, cursorPos); + item = 0; + sub_80D15D4(id, 3); + sub_80D1604(id, 1, cursorArea, cursorPos); + sub_80D140C(id, 2, 0); + if (cursorArea == CURSOR_AREA_IN_BOX) + { + SetCurrentBoxMonData(cursorPos, MON_DATA_HELD_ITEM, &item); + SetBoxMonIconObjMode(cursorPos, 1); + } + else + { + SetMonData(&gPlayerParty[cursorPos], MON_DATA_HELD_ITEM, &item); + SetPartyMonIconObjMode(cursorPos, 1); + } + + sPSSData->movingItem = sPSSData->cursorMonItem; +} + +static void sub_80D0F38(u16 item) +{ + const u32 *tiles = GetItemIconPic(item); + const u32 *pal = GetItemIconPalette(item); + u8 id = sub_80D12E8(); + + sub_80D1524(id, tiles, pal); + sub_80D15D4(id, 6); + sub_80D1604(id, 1, 0, 0); + sub_80D140C(id, 2, 0); + sub_80D1740(id, TRUE); + sPSSData->movingItem = item; +} + +static void Item_SwitchMonsWithMoving(u8 cursorArea, u8 cursorPos) +{ + u8 id; + u16 item; + + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + return; + + id = sub_80D1370(cursorArea, cursorPos); + sub_80D15D4(id, 3); + sub_80D1604(id, 3, 2, 0); + if (cursorArea == CURSOR_AREA_IN_BOX) + { + item = GetCurrentBoxMonData(cursorPos, MON_DATA_HELD_ITEM); + SetCurrentBoxMonData(cursorPos, MON_DATA_HELD_ITEM, &sPSSData->movingItem); + sPSSData->movingItem = item; + } + else + { + item = GetMonData(&gPlayerParty[cursorPos], MON_DATA_HELD_ITEM); + SetMonData(&gPlayerParty[cursorPos], MON_DATA_HELD_ITEM, &sPSSData->movingItem); + sPSSData->movingItem = item; + } + + id = sub_80D1370(2, 0); + sub_80D15D4(id, 4); + sub_80D1604(id, 4, cursorArea, cursorPos); +} + +static void Item_GiveMovingToMon(u8 cursorArea, u8 cursorPos) +{ + u8 id; + + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + return; + + id = sub_80D1370(2, 0); + sub_80D15D4(id, 4); + sub_80D1604(id, 2, cursorArea, cursorPos); + if (cursorArea == CURSOR_AREA_IN_BOX) + { + SetCurrentBoxMonData(cursorPos, MON_DATA_HELD_ITEM, &sPSSData->movingItem); + SetBoxMonIconObjMode(cursorPos, 0); + } + else + { + SetMonData(&gPlayerParty[cursorPos], MON_DATA_HELD_ITEM, &sPSSData->movingItem); + SetPartyMonIconObjMode(cursorPos, 0); + } +} + +static void Item_TakeMons(u8 cursorArea, u8 cursorPos) +{ + u8 id; + u16 item; + + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + return; + + item = 0; + id = sub_80D1370(cursorArea, cursorPos); + sub_80D15D4(id, 2); + sub_80D1604(id, 0, cursorArea, cursorPos); + if (cursorArea == CURSOR_AREA_IN_BOX) + { + SetCurrentBoxMonData(cursorPos, MON_DATA_HELD_ITEM, &item); + SetBoxMonIconObjMode(cursorPos, 1); + } + else + { + SetMonData(&gPlayerParty[cursorPos], MON_DATA_HELD_ITEM, &item); + SetPartyMonIconObjMode(cursorPos, 1); + } +} + +static void sub_80D1194(void) +{ + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) + { + u8 id = sub_80D1370(2, 0); + sub_80D15D4(id, 5); + sub_80D1604(id, 0, 2, 0); + } +} + +static void sub_80D11CC(void) +{ + s32 i; + + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) + return; + + for (i = 0; i < 3; i++) + { + if (sPSSData->field_2204[i].unk10 && sPSSData->field_2204[i].unk8 == 1) + sub_80D1604(i, 7, 2, 0); + } +} + +static bool8 sub_80D1218(void) +{ + s32 i; + + for (i = 0; i < 3; i++) + { + if (sPSSData->field_2204[i].unk10) + { + if (!sPSSData->field_2204[i].sprite->affineAnimEnded && sPSSData->field_2204[i].sprite->affineAnimBeginning) + return TRUE; + if (sPSSData->field_2204[i].sprite->callback != SpriteCallbackDummy && sPSSData->field_2204[i].sprite->callback != sub_80D1AD8) + return TRUE; + } + } + + return FALSE; +} + +static bool8 IsActiveItemMoving(void) +{ + s32 i; + + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) + { + for (i = 0; i < 3; i++) + { + if (sPSSData->field_2204[i].unk10 && sPSSData->field_2204[i].unk8 == 2) + return TRUE; + } + } + + return FALSE; +} + +static const u8 *GetMovingItemName(void) +{ + return ItemId_GetName(sPSSData->movingItem); +} + +static u16 GetMovingItem(void) +{ + return sPSSData->movingItem; +} + +static u8 sub_80D12E8(void) +{ + u8 i; + + for (i = 0; i < 3; i++) + { + if (sPSSData->field_2204[i].unk10 == 0) + { + sPSSData->field_2204[i].unk10 = 1; + return i; + } + } + + return 3; +} + +static bool32 sub_80D1324(u8 cursorArea, u8 cursorPos) +{ + s32 i; + + for (i = 0; i < 3; i++) + { + if (sPSSData->field_2204[i].unk10 + && sPSSData->field_2204[i].unk8 == cursorArea + && sPSSData->field_2204[i].unk9 == cursorPos) + return TRUE; + } + + return FALSE; +} + +static u8 sub_80D1370(u8 cursorArea, u8 cursorPos) +{ + u8 i; + + for (i = 0; i < 3; i++) + { + if (sPSSData->field_2204[i].unk10 + && sPSSData->field_2204[i].unk8 == cursorArea + && sPSSData->field_2204[i].unk9 == cursorPos) + return i; + } + + return 3; +} + +static u8 sub_80D13C4(struct Sprite *sprite) +{ + u8 i; + + for (i = 0; i < 3; i++) + { + if (sPSSData->field_2204[i].unk10 + && sPSSData->field_2204[i].sprite == sprite) + return i; + } + + return 3; +} + +static void sub_80D140C(u8 id, u8 cursorArea, u8 cursorPos) +{ + u8 row, column; + + if (id >= 3) + return; + + switch (cursorArea) + { + case CURSOR_AREA_IN_BOX: + row = cursorPos % IN_BOX_ROWS; + column = cursorPos / IN_BOX_ROWS; + sPSSData->field_2204[id].sprite->pos1.x = (24 * row) + 112; + sPSSData->field_2204[id].sprite->pos1.y = (24 * column) + 56; + sPSSData->field_2204[id].sprite->oam.priority = 2; + break; + case CURSOR_AREA_IN_PARTY: + if (cursorPos == 0) + { + sPSSData->field_2204[id].sprite->pos1.x = 116; + sPSSData->field_2204[id].sprite->pos1.y = 76; + } + else + { + sPSSData->field_2204[id].sprite->pos1.x = 164; + sPSSData->field_2204[id].sprite->pos1.y = 24 * (cursorPos - 1) + 28; + } + sPSSData->field_2204[id].sprite->oam.priority = 1; + break; + } + + sPSSData->field_2204[id].unk8 = cursorArea; + sPSSData->field_2204[id].unk9 = cursorPos; +} + +static void sub_80D1524(u8 id, const u32 *itemTiles, const u32 *itemPal) +{ + s32 i; + + if (id >= 3) + return; + + CpuFastFill(0, sPSSData->field_42C4, 0x200); + LZ77UnCompWram(itemTiles, sPSSData->field_22C4); + for (i = 0; i < 3; i++) + CpuFastCopy(sPSSData->field_22C4 + (i * 0x60), sPSSData->field_42C4 + (i * 0x80), 0x60); + + CpuFastCopy(sPSSData->field_42C4, sPSSData->field_2204[id].tiles, 0x200); + LZ77UnCompWram(itemPal, sPSSData->field_42C4); + LoadPalette(sPSSData->field_42C4, sPSSData->field_2204[id].palIndex, 0x20); +} + +static void sub_80D15D4(u8 id, u8 animNum) +{ + if (id >= 3) + return; + + StartSpriteAffineAnim(sPSSData->field_2204[id].sprite, animNum); +} + +static void sub_80D1604(u8 id, u8 arg1, u8 arg2, u8 arg3) +{ + if (id >= 3) + return; + + switch (arg1) + { + case 0: + sPSSData->field_2204[id].sprite->data[0] = id; + sPSSData->field_2204[id].sprite->callback = sub_80D1A48; + break; + case 1: + sPSSData->field_2204[id].sprite->data[0] = 0; + sPSSData->field_2204[id].sprite->callback = sub_80D1A74; + break; + case 2: + sPSSData->field_2204[id].sprite->data[0] = 0; + sPSSData->field_2204[id].sprite->data[6] = arg2; + sPSSData->field_2204[id].sprite->data[7] = arg3; + sPSSData->field_2204[id].sprite->callback = sub_80D1B14; + break; + case 3: + sPSSData->field_2204[id].sprite->data[0] = 0; + sPSSData->field_2204[id].sprite->callback = sub_80D1B94; + sPSSData->field_2204[id].sprite->data[6] = arg2; + sPSSData->field_2204[id].sprite->data[7] = arg3; + break; + case 4: + sPSSData->field_2204[id].sprite->data[0] = 0; + sPSSData->field_2204[id].sprite->data[6] = arg2; + sPSSData->field_2204[id].sprite->data[7] = arg3; + sPSSData->field_2204[id].sprite->callback = sub_80D1C30; + break; + case 7: + sPSSData->field_2204[id].sprite->callback = sub_80D1CCC; + break; + } +} + +static void sub_80D1740(u8 id, bool8 arg1) +{ + if (id >= 3) + return; + + sPSSData->field_2204[id].unk10 = arg1; + sPSSData->field_2204[id].sprite->invisible = (arg1 == FALSE); +} + +static const u32 *GetItemIconPic(u16 itemId) +{ + return GetItemIconPicOrPalette(itemId, 0); +} + +static const u32 *GetItemIconPalette(u16 itemId) +{ + return GetItemIconPicOrPalette(itemId, 1); +} + +static void PrintItemDescription(void) +{ + const u8 *description; + + if (IsActiveItemMoving()) + description = ItemId_GetDescription(sPSSData->movingItem); + else + description = ItemId_GetDescription(sPSSData->cursorMonItem); + + FillWindowPixelBuffer(2, 0x11); + AddTextPrinterParameterized5(2, 1, description, 4, 0, 0, NULL, 0, 1); +} + +static void sub_80D1818(void) +{ + sPSSData->field_2236 = 0x15; + LoadBgTiles(0, gUnknown_0857BB24, 0x80, 0x13A); + sub_80D19B4(0); +} + +static bool8 sub_80D184C(void) +{ + s32 i, var; + + if (sPSSData->field_2236 == 0) + return FALSE; + + sPSSData->field_2236--; + var = 0x15 - sPSSData->field_2236; + for (i = 0; i < var; i++) + { + WriteSequenceToBgTilemapBuffer(0, GetBgAttribute(0, 10) + 0x14 + sPSSData->field_2236 + i, i, 13, 1, 7, 15, 21); + } + + sub_80D19B4(var); + return (sPSSData->field_2236 != 0); +} + +static bool8 sub_80D18E4(void) +{ + s32 i, var; + + if (sPSSData->field_2236 == 0x16) + return FALSE; + + if (sPSSData->field_2236 == 0) + FillBgTilemapBufferRect(0, 0, 21, 12, 1, 9, 17); + + sPSSData->field_2236++; + var = 0x15 - sPSSData->field_2236; + for (i = 0; i < var; i++) + { + WriteSequenceToBgTilemapBuffer(0, GetBgAttribute(0, 10) + 0x14 + sPSSData->field_2236 + i, i, 13, 1, 7, 15, 21); + } + + if (var >= 0) + sub_80D19B4(var); + + FillBgTilemapBufferRect(0, 0, var + 1, 12, 1, 9, 0x11); + schedule_bg_copy_tilemap_to_vram(0); + return TRUE; +} + +static void sub_80D19B4(u32 arg0) +{ + if (arg0 != 0) + { + FillBgTilemapBufferRect(0, 0x13A, 0, 0xC, arg0, 1, 0xFu); + FillBgTilemapBufferRect(0, 0x93A, 0, 0x14, arg0, 1, 0xFu); + } + FillBgTilemapBufferRect(0, 0x13B, arg0, 0xD, 1, 7, 0xFu); + FillBgTilemapBufferRect(0, 0x13C, arg0, 0xC, 1, 1, 0xFu); + FillBgTilemapBufferRect(0, 0x13D, arg0, 0x14, 1, 1, 0xFu); + schedule_bg_copy_tilemap_to_vram(0); +} + +static void sub_80D1A48(struct Sprite *sprite) +{ + if (sprite->affineAnimEnded) + { + sub_80D1740(sprite->data[0], FALSE); + sprite->callback = SpriteCallbackDummy; + } +} + +static void sub_80D1A74(struct Sprite *sprite) +{ + switch (sprite->data[0]) + { + case 0: + sprite->data[1] = sprite->pos1.x << 4; + sprite->data[2] = sprite->pos1.y << 4; + sprite->data[3] = 10; + sprite->data[4] = 21; + sprite->data[5] = 0; + sprite->data[0]++; + case 1: + sprite->data[1] -= sprite->data[3]; + sprite->data[2] -= sprite->data[4]; + sprite->pos1.x = sprite->data[1] >> 4; + sprite->pos1.y = sprite->data[2] >> 4; + if (++sprite->data[5] > 11) + sprite->callback = sub_80D1AD8; + break; + } +} + +static void sub_80D1AD8(struct Sprite *sprite) +{ + sprite->pos1.x = sPSSData->field_CB4->pos1.x + 4; + sprite->pos1.y = sPSSData->field_CB4->pos1.y + sPSSData->field_CB4->pos2.y + 8; + sprite->oam.priority = sPSSData->field_CB4->oam.priority; +} + +static void sub_80D1B14(struct Sprite *sprite) +{ + switch (sprite->data[0]) + { + case 0: + sprite->data[1] = sprite->pos1.x << 4; + sprite->data[2] = sprite->pos1.y << 4; + sprite->data[3] = 10; + sprite->data[4] = 21; + sprite->data[5] = 0; + sprite->data[0]++; + case 1: + sprite->data[1] += sprite->data[3]; + sprite->data[2] += sprite->data[4]; + sprite->pos1.x = sprite->data[1] >> 4; + sprite->pos1.y = sprite->data[2] >> 4; + if (++sprite->data[5] > 11) + { + sub_80D140C(sub_80D13C4(sprite), sprite->data[6], sprite->data[7]); + sprite->callback = SpriteCallbackDummy; + } + break; + } +} + +static void sub_80D1B94(struct Sprite *sprite) +{ + switch (sprite->data[0]) + { + case 0: + sprite->data[1] = sprite->pos1.x << 4; + sprite->data[2] = sprite->pos1.y << 4; + sprite->data[3] = 10; + sprite->data[4] = 21; + sprite->data[5] = 0; + sprite->data[0]++; + case 1: + sprite->data[1] -= sprite->data[3]; + sprite->data[2] -= sprite->data[4]; + sprite->pos1.x = sprite->data[1] >> 4; + sprite->pos1.y = sprite->data[2] >> 4; + sprite->pos2.x = gSineTable[sprite->data[5] * 8] >> 4; + if (++sprite->data[5] > 11) + { + sub_80D140C(sub_80D13C4(sprite), sprite->data[6], sprite->data[7]); + sprite->pos2.x = 0; + sprite->callback = sub_80D1AD8; + } + break; + } +} + +static void sub_80D1C30(struct Sprite *sprite) +{ + switch (sprite->data[0]) + { + case 0: + sprite->data[1] = sprite->pos1.x << 4; + sprite->data[2] = sprite->pos1.y << 4; + sprite->data[3] = 10; + sprite->data[4] = 21; + sprite->data[5] = 0; + sprite->data[0]++; + case 1: + sprite->data[1] += sprite->data[3]; + sprite->data[2] += sprite->data[4]; + sprite->pos1.x = sprite->data[1] >> 4; + sprite->pos1.y = sprite->data[2] >> 4; + sprite->pos2.x = -(gSineTable[sprite->data[5] * 8] >> 4); + if (++sprite->data[5] > 11) + { + sub_80D140C(sub_80D13C4(sprite), sprite->data[6], sprite->data[7]); + sprite->callback = SpriteCallbackDummy; + sprite->pos2.x = 0; + } + break; + } +} + +static void sub_80D1CCC(struct Sprite *sprite) +{ + sprite->pos1.y -= 8; + if (sprite->pos1.y + sprite->pos2.y < -16) + { + sprite->callback = SpriteCallbackDummy; + sub_80D1740(sub_80D13C4(sprite), FALSE); + } +} + +void nullsub_pss(void) +{ + +} + +void nullsub_98(void) +{ + +} + +// Functions here are general utility functions. +u8 StorageGetCurrentBox(void) +{ + return gPokemonStoragePtr->currentBox; +} + +static void SetCurrentBox(u8 boxId) +{ + if (boxId < TOTAL_BOXES_COUNT) + gPokemonStoragePtr->currentBox = boxId; +} + +u32 GetBoxMonDataAt(u8 boxId, u8 boxPosition, s32 request) +{ + if (boxId < TOTAL_BOXES_COUNT && boxPosition < IN_BOX_COUNT) + return GetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], request); + else + return 0; +} + +void SetBoxMonDataAt(u8 boxId, u8 boxPosition, s32 request, const void *value) +{ + if (boxId < TOTAL_BOXES_COUNT && boxPosition < IN_BOX_COUNT) + SetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], request, value); +} + +u32 GetCurrentBoxMonData(u8 boxPosition, s32 request) +{ + return GetBoxMonDataAt(gPokemonStoragePtr->currentBox, boxPosition, request); +} + +void SetCurrentBoxMonData(u8 boxPosition, s32 request, const void *value) +{ + SetBoxMonDataAt(gPokemonStoragePtr->currentBox, boxPosition, request, value); +} + +void GetBoxMonNickAt(u8 boxId, u8 boxPosition, u8 *dst) +{ + if (boxId < TOTAL_BOXES_COUNT && boxPosition < IN_BOX_COUNT) + GetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_NICKNAME, dst); + else + *dst = EOS; +} + +u32 GetBoxMonLevelAt(u8 boxId, u8 boxPosition) +{ + u32 lvl; + + // BUG: Missed 'else' statement. + if (boxId < TOTAL_BOXES_COUNT && boxPosition < IN_BOX_COUNT && GetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_SANITY_HAS_SPECIES)) + lvl = GetLevelFromBoxMonExp(&gPokemonStoragePtr->boxes[boxId][boxPosition]); + // else + lvl = 0; + + return lvl; +} + +void SetBoxMonNickAt(u8 boxId, u8 boxPosition, const u8 *nick) +{ + if (boxId < TOTAL_BOXES_COUNT && boxPosition < IN_BOX_COUNT) + SetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_NICKNAME, nick); +} + +u32 GetAndCopyBoxMonDataAt(u8 boxId, u8 boxPosition, s32 request, void *dst) +{ + if (boxId < TOTAL_BOXES_COUNT && boxPosition < IN_BOX_COUNT) + return GetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], request, dst); + else + return 0; +} + +void SetBoxMonAt(u8 boxId, u8 boxPosition, struct BoxPokemon *src) +{ + if (boxId < TOTAL_BOXES_COUNT && boxPosition < IN_BOX_COUNT) + gPokemonStoragePtr->boxes[boxId][boxPosition] = *src; +} + +void CopyBoxMonAt(u8 boxId, u8 boxPosition, struct BoxPokemon *dst) +{ + if (boxId < TOTAL_BOXES_COUNT && boxPosition < IN_BOX_COUNT) + *dst = gPokemonStoragePtr->boxes[boxId][boxPosition]; +} + +void CreateBoxMonAt(u8 boxId, u8 boxPosition, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 personality, u8 otIDType, u32 otID) +{ + if (boxId < TOTAL_BOXES_COUNT && boxPosition < IN_BOX_COUNT) + { + CreateBoxMon(&gPokemonStoragePtr->boxes[boxId][boxPosition], + species, + level, + fixedIV, + hasFixedPersonality, personality, + otIDType, otID); + } +} + +void ZeroBoxMonAt(u8 boxId, u8 boxPosition) +{ + if (boxId < TOTAL_BOXES_COUNT && boxPosition < IN_BOX_COUNT) + ZeroBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition]); +} + +void BoxMonAtToMon(u8 boxId, u8 boxPosition, struct Pokemon *dst) +{ + if (boxId < TOTAL_BOXES_COUNT && boxPosition < IN_BOX_COUNT) + BoxMonToMon(&gPokemonStoragePtr->boxes[boxId][boxPosition], dst); +} + +struct BoxPokemon *GetBoxedMonPtr(u8 boxId, u8 boxPosition) +{ + if (boxId < TOTAL_BOXES_COUNT && boxPosition < IN_BOX_COUNT) + return &gPokemonStoragePtr->boxes[boxId][boxPosition]; + else + return NULL; +} + +u8 *GetBoxNamePtr(u8 boxId) +{ + if (boxId < TOTAL_BOXES_COUNT) + return gPokemonStoragePtr->boxNames[boxId]; + else + return NULL; +} + +u8 GetBoxWallpaper(u8 boxId) +{ + if (boxId < TOTAL_BOXES_COUNT) + return gPokemonStoragePtr->boxWallpapers[boxId]; + else + return 0; +} + +void SetBoxWallpaper(u8 boxId, u8 wallpaperId) +{ + if (boxId < TOTAL_BOXES_COUNT && wallpaperId < WALLPAPER_COUNT) + gPokemonStoragePtr->boxWallpapers[boxId] = wallpaperId; +} + +s16 sub_80D214C(struct BoxPokemon *boxMons, u8 currIndex, u8 maxIndex, u8 arg3) +{ + s16 i; + s16 adder = -1; + + if (arg3 < 2) + adder = 1; + + if (arg3 == 1 || arg3 == 3) + { + for (i = (s8)currIndex + adder; i >= 0 && i <= maxIndex; i += adder) + { + if (GetBoxMonData(&boxMons[i], MON_DATA_SPECIES) != SPECIES_NONE) + return i; + } + } + else + { + for (i = (s8)currIndex + adder; i >= 0 && i <= maxIndex; i += adder) + { + if (GetBoxMonData(&boxMons[i], MON_DATA_SPECIES) != SPECIES_NONE + && !GetBoxMonData(&boxMons[i], MON_DATA_IS_EGG)) + return i; + } + } + + return -1; +} + +bool8 CheckFreePokemonStorageSpace(void) +{ + s32 i, j; + + for (i = 0; i < TOTAL_BOXES_COUNT; i++) + { + for (j = 0; j < IN_BOX_COUNT; j++) + { + if (!GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_SANITY_HAS_SPECIES)) + return TRUE; + } + } + + return FALSE; +} + +bool32 CheckBoxMonSanityAt(u32 boxId, u32 boxPosition) +{ + if (boxId < TOTAL_BOXES_COUNT + && boxPosition < IN_BOX_COUNT + && GetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_SANITY_HAS_SPECIES) + && !GetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_SANITY_IS_EGG) + && !GetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_SANITY_IS_BAD_EGG)) + return TRUE; + else + return FALSE; +} + +u32 CountStorageNonEggMons(void) +{ + s32 i, j; + u32 count = 0; + + for (i = 0; i < TOTAL_BOXES_COUNT; i++) + { + for (j = 0; j < IN_BOX_COUNT; j++) + { + if (GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_SANITY_HAS_SPECIES) + && !GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_SANITY_IS_EGG)) + count++; + } + } + + return count; +} + +u32 CountAllStorageMons(void) +{ + s32 i, j; + u32 count = 0; + + for (i = 0; i < TOTAL_BOXES_COUNT; i++) + { + for (j = 0; j < IN_BOX_COUNT; j++) + { + if (GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_SANITY_HAS_SPECIES) + || GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_SANITY_IS_EGG)) + count++; + } + } + + return count; +} + +bool32 AnyStorageMonWithMove(u16 moveId) +{ + u16 moves[] = {moveId, MOVES_COUNT}; + s32 i, j; + + for (i = 0; i < TOTAL_BOXES_COUNT; i++) + { + for (j = 0; j < IN_BOX_COUNT; j++) + { + if (GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_SANITY_HAS_SPECIES) + && !GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_SANITY_IS_EGG) + && GetBoxMonData(&gPokemonStoragePtr->boxes[i][j], MON_DATA_KNOWN_MOVES, moves)) + return TRUE; + } + } + + return FALSE; +} + +void ResetWaldaWallpaper(void) +{ + gSaveBlock1Ptr->waldaPhrase.iconId = 0; + gSaveBlock1Ptr->waldaPhrase.patternId = 0; + gSaveBlock1Ptr->waldaPhrase.patternUnlocked = FALSE; + gSaveBlock1Ptr->waldaPhrase.colors[0] = RGB(21, 25, 30); + gSaveBlock1Ptr->waldaPhrase.colors[1] = RGB(6, 12, 24); + gSaveBlock1Ptr->waldaPhrase.text[0] = EOS; +} + +void SetWaldaWallpaperLockedOrUnlocked(bool32 unlocked) +{ + gSaveBlock1Ptr->waldaPhrase.patternUnlocked = unlocked; +} + +bool32 IsWaldaWallpaperUnlocked(void) +{ + return gSaveBlock1Ptr->waldaPhrase.patternUnlocked; +} + +u32 GetWaldaWallpaperPatternId(void) +{ + return gSaveBlock1Ptr->waldaPhrase.patternId; +} + +void SetWaldaWallpaperPatternId(u8 id) +{ + if (id < FRIENDS_WALLPAPERS_COUNT) + gSaveBlock1Ptr->waldaPhrase.patternId = id; +} + +u32 GetWaldaWallpaperIconId(void) +{ + return gSaveBlock1Ptr->waldaPhrase.iconId; +} + +void SetWaldaWallpaperIconId(u8 id) +{ + if (id < 30) + gSaveBlock1Ptr->waldaPhrase.iconId = id; +} + +u16 *GetWaldaWallpaperColorsPtr(void) +{ + return gSaveBlock1Ptr->waldaPhrase.colors; +} + +void SetWaldaWallpaperColors(u16 color1, u16 color2) +{ + gSaveBlock1Ptr->waldaPhrase.colors[0] = color1; + gSaveBlock1Ptr->waldaPhrase.colors[1] = color2; +} + +u8 *GetWaldaPhrasePtr(void) +{ + return gSaveBlock1Ptr->waldaPhrase.text; +} + +void SetWaldaPhrase(const u8 *src) +{ + StringCopy(gSaveBlock1Ptr->waldaPhrase.text, src); +} + +bool32 IsWaldaPhraseEmpty(void) +{ + return (gSaveBlock1Ptr->waldaPhrase.text[0] == EOS); +} + +// Not sure what the purpose of these functions is. +// They seem to only be called while PSS is initialized. + +EWRAM_DATA static struct UnkStruct_2039D84 *gUnknown_02039D84 = NULL; +EWRAM_DATA static u16 gUnknown_02039D88 = 0; + +static void sub_80D259C(u8 count) +{ + u16 i; + + gUnknown_02039D84 = Alloc(sizeof(*gUnknown_02039D84) * count); + gUnknown_02039D88 = (gUnknown_02039D84 == NULL) ? 0 : count; + for (i = 0; i < gUnknown_02039D88; i++) + { + gUnknown_02039D84[i].field_18 = NULL; + gUnknown_02039D84[i].field_2C = 0; + } +} + +static void sub_80D25F0(void) +{ + Free(gUnknown_02039D84); +} + +static void sub_80D2604(void) +{ + s32 i; + + for (i = 0; i < gUnknown_02039D88; i++) + { + if (gUnknown_02039D84[i].field_2C == 1) + sub_80D2918(i); + } +} + +struct +{ + u16 a; + u16 b; +} +static const sUnkVars[][4] = +{ + { + {0x0100, 0x0100}, + {0x0200, 0x0100}, + {0x0100, 0x0200}, + {0x0200, 0x0200}, + }, + { + {0x0080, 0x0080}, + {0x0100, 0x0100}, + {0x0200, 0x0200}, + {0x0400, 0x0400}, + }, +}; + +static void sub_80D2644(u8 id, u8 bg, const void *arg2, u16 arg3, u16 arg4) +{ + u16 attribute1, attribute2; + + if (id >= gUnknown_02039D88) + return; + + gUnknown_02039D84[id].field_18 = NULL; + gUnknown_02039D84[id].field_1C = arg2; + gUnknown_02039D84[id].field_2B = bg; + gUnknown_02039D84[id].field_24 = arg3; + gUnknown_02039D84[id].field_26 = arg4; + + attribute1 = GetBgAttribute(bg, 3); + attribute2 = GetBgAttribute(bg, 9); + gUnknown_02039D84[id].field_20 = sUnkVars[attribute2][attribute1].a; + gUnknown_02039D84[id].field_22 = sUnkVars[attribute2][attribute1].b; + if (attribute2 != 0) + gUnknown_02039D84[id].field_2A = 1; + else + gUnknown_02039D84[id].field_2A = 2; + + gUnknown_02039D84[id].field_28 = gUnknown_02039D84[id].field_2A * arg3; + gUnknown_02039D84[id].field_0[1].field_4 = arg3; + gUnknown_02039D84[id].field_0[1].field_6 = arg4; + gUnknown_02039D84[id].field_0[1].field_0 = 0; + gUnknown_02039D84[id].field_0[1].field_2 = 0; + gUnknown_02039D84[id].field_0[1].field_8 = 0; + gUnknown_02039D84[id].field_0[1].field_A = 0; + gUnknown_02039D84[id].field_0[0] = gUnknown_02039D84[id].field_0[1]; + gUnknown_02039D84[id].field_2C = 1; +} + +static void sub_80D2740(u8 id, const void *arg1) +{ + if (id >= gUnknown_02039D88) + return; + + gUnknown_02039D84[id].field_18 = arg1; + gUnknown_02039D84[id].field_2C = 1; +} + +static void sub_80D2770(u8 id, u16 arg1, u16 arg2) +{ + if (id >= gUnknown_02039D88) + return; + + gUnknown_02039D84[id].field_0[1].field_8 = arg1; + gUnknown_02039D84[id].field_0[1].field_A = arg2; + gUnknown_02039D84[id].field_2C = 1; +} + +static void sub_80D27AC(u8 id, u16 arg1, u16 arg2, u16 arg3, u16 arg4) +{ + if (id >= gUnknown_02039D88) + return; + + gUnknown_02039D84[id].field_0[1].field_0 = arg1; + gUnknown_02039D84[id].field_0[1].field_2 = arg2; + gUnknown_02039D84[id].field_0[1].field_4 = arg3; + gUnknown_02039D84[id].field_0[1].field_6 = arg4; + gUnknown_02039D84[id].field_2C = 1; +} + +static void sub_80D27F4(u8 id, u8 arg1, s8 arg2) +{ + if (id >= gUnknown_02039D88) + return; + + switch (arg1) + { + case 0: + gUnknown_02039D84[id].field_0[1].field_8 += arg2; + gUnknown_02039D84[id].field_0[1].field_4 -= arg2; + break; + case 1: + gUnknown_02039D84[id].field_0[1].field_0 += arg2; + gUnknown_02039D84[id].field_0[1].field_4 += arg2; + break; + case 2: + gUnknown_02039D84[id].field_0[1].field_A += arg2; + gUnknown_02039D84[id].field_0[1].field_6 -= arg2; + break; + case 3: + gUnknown_02039D84[id].field_0[1].field_2 -= arg2; + gUnknown_02039D84[id].field_0[1].field_6 += arg2; + break; + case 4: + gUnknown_02039D84[id].field_0[1].field_8 += arg2; + break; + case 5: + gUnknown_02039D84[id].field_0[1].field_A += arg2; + break; + } + + gUnknown_02039D84[id].field_2C = 1; +} + +static void sub_80D2918(u8 id) +{ + if (id >= gUnknown_02039D88) + return; + + if (gUnknown_02039D84[id].field_18 != NULL) + sub_80D2960(id); + + sub_80D29F8(id); + gUnknown_02039D84[id].field_0[0] = gUnknown_02039D84[id].field_0[1]; +} + +static void sub_80D2960(u8 id) +{ + s32 i; + u32 adder = gUnknown_02039D84[id].field_2A * gUnknown_02039D84[id].field_20; + const void *tiles = (gUnknown_02039D84[id].field_18 + (adder * gUnknown_02039D84[id].field_0[0].field_A)) + + (gUnknown_02039D84[id].field_2A * gUnknown_02039D84[id].field_0[0].field_8); + + for (i = 0; i < gUnknown_02039D84[id].field_0[0].field_6; i++) + { + CopyToBgTilemapBufferRect(gUnknown_02039D84[id].field_2B, + tiles, + gUnknown_02039D84[id].field_0[0].field_8, + gUnknown_02039D84[id].field_0[0].field_A + i, + gUnknown_02039D84[id].field_0[0].field_4, + 1); + tiles += adder; + } +} + +static void sub_80D29F8(u8 id) +{ + s32 i; + u32 adder = gUnknown_02039D84[id].field_2A * gUnknown_02039D84[id].field_24; + const void *tiles = (gUnknown_02039D84[id].field_1C + (adder * gUnknown_02039D84[id].field_0[1].field_2)) + + (gUnknown_02039D84[id].field_2A * gUnknown_02039D84[id].field_0[1].field_0); + + for (i = 0; i < gUnknown_02039D84[id].field_0[1].field_6; i++) + { + CopyToBgTilemapBufferRect(gUnknown_02039D84[id].field_2B, + tiles, + gUnknown_02039D84[id].field_0[1].field_8, + gUnknown_02039D84[id].field_0[1].field_A + i, + gUnknown_02039D84[id].field_0[1].field_4, + 1); + tiles += adder; + } +} + +EWRAM_DATA static struct UnkStruct_2000020 *gUnknown_02039D8C = NULL; + +static void sub_80D2A90(struct UnkStruct_2000020 *arg0, struct UnkStruct_2000028 *arg1, u32 arg2) +{ + gUnknown_02039D8C = arg0; + arg0->unk_00 = arg1; + arg0->unk_05 = arg2; + arg0->unk_04 = 0; +} + +static void sub_80D2AA4(void) +{ + u16 i; + + if (gUnknown_02039D8C->unk_04) + { + for (i = 0; i < gUnknown_02039D8C->unk_04; i++) + { + struct UnkStruct_2000028 *unkStruct = &gUnknown_02039D8C->unk_00[i]; + unkStruct->unk_0c(unkStruct); + } + + gUnknown_02039D8C->unk_04 = 0; + } +} + +static bool8 sub_80D2AEC(u8 *dest, u16 dLeft, u16 dTop, const u8 *src, u16 sLeft, u16 sTop, u16 width, u16 height, u16 unkArg) +{ + struct UnkStruct_2000028 *unkStruct; + + if (gUnknown_02039D8C->unk_04 >= gUnknown_02039D8C->unk_05) + return FALSE; + + unkStruct = &gUnknown_02039D8C->unk_00[gUnknown_02039D8C->unk_04++]; + unkStruct->unk_08 = width * 2; + unkStruct->unk_04 = dest + 2 * (dTop * 32 + dLeft); + unkStruct->unk_00 = src + 2 * (sTop * unkArg + sLeft); + unkStruct->newField = height; + unkStruct->unk_0a = unkArg; + unkStruct->unk_0c = sub_80D2B88; + return TRUE; +} + +static void sub_80D2B88(struct UnkStruct_2000028 *unkStruct) +{ + u16 i; + + for (i = 0; i < unkStruct->newField; i++) + { + CpuSet(unkStruct->unk_00, unkStruct->unk_04, (unkStruct->unk_08 / 2)); + unkStruct->unk_04 += 64; + unkStruct->unk_00 += (unkStruct->unk_0a * 2); + } +} + +static bool8 sub_80D2BC0(void *dest, u16 dLeft, u16 dTop, u16 width, u16 height) +{ + struct UnkStruct_2000028 *unkStruct; + + if (gUnknown_02039D8C->unk_04 >= gUnknown_02039D8C->unk_05) + return FALSE; + + unkStruct = &gUnknown_02039D8C->unk_00[gUnknown_02039D8C->unk_04++]; + unkStruct->unk_08 = width * 2; + unkStruct->unk_04 = dest + ((dTop * 32) + dLeft) * 2; + unkStruct->newField = height; + unkStruct->unk_0c = sub_80D2C1C; + return TRUE; +} + +static void sub_80D2C1C(struct UnkStruct_2000028 *unkStruct) +{ + u16 i; + + for (i = 0; i < unkStruct->newField; i++) + { + Dma3FillLarge_(0, unkStruct->unk_04, unkStruct->unk_08, 16); + unkStruct->unk_04 += 64; + } +} diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index fb2a43786..a72e83b96 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1005,7 +1005,7 @@ void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, pssData->maxMonIndex = maxMonIndex; pssData->callback = callback; - if (mode == PSS_MODE_UNK2) + if (mode == PSS_MODE_BOX) pssData->isBoxMon = TRUE; else pssData->isBoxMon = FALSE; @@ -1013,7 +1013,7 @@ void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, switch (mode) { case PSS_MODE_NORMAL: - case PSS_MODE_UNK2: + case PSS_MODE_BOX: pssData->minPageIndex = 0; pssData->maxPageIndex = 3; break; @@ -1255,23 +1255,23 @@ static bool8 SummaryScreen_DecompressGraphics(void) pssData->unk40F0++; break; case 7: - LoadCompressedObjectPic(&sSpriteSheet_MoveTypes); + LoadCompressedSpriteSheet(&sSpriteSheet_MoveTypes); pssData->unk40F0++; break; case 8: - LoadCompressedObjectPic(&gUnknown_0861D074); + LoadCompressedSpriteSheet(&gUnknown_0861D074); pssData->unk40F0++; break; case 9: - LoadCompressedObjectPic(&gUnknown_0861D0F8); + LoadCompressedSpriteSheet(&gUnknown_0861D0F8); pssData->unk40F0++; break; case 10: - LoadCompressedObjectPalette(&gUnknown_0861D100); + LoadCompressedSpritePalette(&gUnknown_0861D100); pssData->unk40F0++; break; case 11: - LoadCompressedObjectPalette(&gUnknown_0861D07C); + LoadCompressedSpritePalette(&gUnknown_0861D07C); pssData->unk40F0++; break; case 12: @@ -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; @@ -1327,7 +1327,7 @@ static bool8 ExtractMonDataToSummaryStruct(struct Pokemon *a) sum->ppBonuses = GetMonData(a, MON_DATA_PP_BONUSES); break; case 2: - if (pssData->monList.mons == gPlayerParty || pssData->mode == PSS_MODE_UNK2 || pssData->unk40EF == TRUE) + if (pssData->monList.mons == gPlayerParty || pssData->mode == PSS_MODE_BOX || pssData->unk40EF == TRUE) { sum->nature = GetNature(a); sum->currentHP = GetMonData(a, MON_DATA_HP); @@ -3829,7 +3829,7 @@ static u8 sub_81C45F4(struct Pokemon *mon, s16 *a1) { if (gMonSpritesGfxPtr != NULL) { - if (pssData->monList.mons == gPlayerParty || pssData->mode == PSS_MODE_UNK2 || pssData->unk40EF == TRUE) + if (pssData->monList.mons == gPlayerParty || pssData->mode == PSS_MODE_BOX || pssData->unk40EF == TRUE) { HandleLoadSpecialPokePic_2(&gMonFrontPicTable[summary->species2], gMonSpritesGfxPtr->sprites[1], summary->species2, summary->pid); } @@ -3840,7 +3840,7 @@ static u8 sub_81C45F4(struct Pokemon *mon, s16 *a1) } else { - if (pssData->monList.mons == gPlayerParty || pssData->mode == PSS_MODE_UNK2 || pssData->unk40EF == TRUE) + if (pssData->monList.mons == gPlayerParty || pssData->mode == PSS_MODE_BOX || pssData->unk40EF == TRUE) { HandleLoadSpecialPokePic_2(&gMonFrontPicTable[summary->species2], sub_806F4F8(0, 1), summary->species2, summary->pid); } @@ -3854,7 +3854,7 @@ static u8 sub_81C45F4(struct Pokemon *mon, s16 *a1) return -1; case 1: pal = GetMonSpritePalStructFromOtIdPersonality(summary->species2, summary->OTID, summary->pid); - LoadCompressedObjectPalette(pal); + LoadCompressedSpritePalette(pal); SetMultiuseSpriteTemplateToPokemon(pal->tag, 1); (*a1)++; return -1; 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/rayquaza_scene.c b/src/rayquaza_scene.c index b22e1db32..94d81e30f 100644 --- a/src/rayquaza_scene.c +++ b/src/rayquaza_scene.c @@ -1528,14 +1528,14 @@ static void sub_81D706C(void) LZDecompressWram(gRaySceneClouds1_Tilemap, sRayScene->tilemapBuffers[1]); LZDecompressWram(gRaySceneClouds3_Tilemap, sRayScene->tilemapBuffers[2]); LoadCompressedPalette(gRaySceneClouds_Pal, 0, 0x40); - LoadCompressedObjectPic(&sUnknown_0862A8C4); - LoadCompressedObjectPic(&sUnknown_0862A8F8); - LoadCompressedObjectPic(&sUnknown_0862A924); - LoadCompressedObjectPic(&sUnknown_0862A9D4); - LoadCompressedObjectPic(&sUnknown_0862AA14); - LoadCompressedObjectPic(&sUnknown_0862AA34); - LoadCompressedObjectPalette(&sUnknown_0862A8CC); - LoadCompressedObjectPalette(&sUnknown_0862A9DC); + LoadCompressedSpriteSheet(&sUnknown_0862A8C4); + LoadCompressedSpriteSheet(&sUnknown_0862A8F8); + LoadCompressedSpriteSheet(&sUnknown_0862A924); + LoadCompressedSpriteSheet(&sUnknown_0862A9D4); + LoadCompressedSpriteSheet(&sUnknown_0862AA14); + LoadCompressedSpriteSheet(&sUnknown_0862AA34); + LoadCompressedSpritePalette(&sUnknown_0862A8CC); + LoadCompressedSpritePalette(&sUnknown_0862A9DC); } static void Task_DuoFightAnim(u8 taskId) @@ -1943,8 +1943,8 @@ static void sub_81D7E9C(void) LZDecompressWram(gRaySceneOvercast_Tilemap, sRayScene->tilemapBuffers[1]); LZDecompressWram(gRaySceneRayquaza_Tilemap, sRayScene->tilemapBuffers[2]); LoadCompressedPalette(gRaySceneRayquaza_Pal, 0, 0x40); - LoadCompressedObjectPic(&sUnknown_0862AA90); - LoadCompressedObjectPalette(&sUnknown_0862AA98); + LoadCompressedSpriteSheet(&sUnknown_0862AA90); + LoadCompressedSpritePalette(&sUnknown_0862AA98); } static void Task_RayTakesFlightAnim(u8 taskId) @@ -2118,9 +2118,9 @@ static void sub_81D8358(void) LoadCompressedPalette(gRaySceneOvercast2_Pal, 0, 0x40); gPlttBufferUnfaded[0] = RGB_WHITE; gPlttBufferFaded[0] = RGB_WHITE; - LoadCompressedObjectPic(&sUnknown_0862AAFC); - LoadCompressedObjectPic(&sUnknown_0862AB04); - LoadCompressedObjectPalette(&sUnknown_0862AB0C); + LoadCompressedSpriteSheet(&sUnknown_0862AAFC); + LoadCompressedSpriteSheet(&sUnknown_0862AB04); + LoadCompressedSpritePalette(&sUnknown_0862AB0C); } static void sub_81D844C(void) @@ -2489,16 +2489,16 @@ static void sub_81D8CC4(void) LZDecompressWram(gRaySceneHushBg_Tilemap, sRayScene->tilemapBuffers[0]); LZDecompressWram(gRaySceneHushRing_Map, sRayScene->tilemapBuffers[2]); LoadCompressedPalette(gRaySceneHushBg_Pal, 0, 0x60); - LoadCompressedObjectPic(&sUnknown_0862AC28); - LoadCompressedObjectPic(&sUnknown_0862AC30); - LoadCompressedObjectPic(&sUnknown_0862AC38); - LoadCompressedObjectPic(&sUnknown_0862AC40); - LoadCompressedObjectPic(&sUnknown_0862AC48); - LoadCompressedObjectPic(&sUnknown_0862AC50); - LoadCompressedObjectPalette(&sUnknown_0862AC58); - LoadCompressedObjectPalette(&sUnknown_0862AC60); - LoadCompressedObjectPalette(&sUnknown_0862AC68); - LoadCompressedObjectPalette(&sUnknown_0862AC70); + LoadCompressedSpriteSheet(&sUnknown_0862AC28); + LoadCompressedSpriteSheet(&sUnknown_0862AC30); + LoadCompressedSpriteSheet(&sUnknown_0862AC38); + LoadCompressedSpriteSheet(&sUnknown_0862AC40); + LoadCompressedSpriteSheet(&sUnknown_0862AC48); + LoadCompressedSpriteSheet(&sUnknown_0862AC50); + LoadCompressedSpritePalette(&sUnknown_0862AC58); + LoadCompressedSpritePalette(&sUnknown_0862AC60); + LoadCompressedSpritePalette(&sUnknown_0862AC68); + LoadCompressedSpritePalette(&sUnknown_0862AC70); } static void Task_RayChasesAwayAnim(u8 taskId) diff --git a/src/rom_8034C54.c b/src/rom_8034C54.c index e175ecc64..ba431778f 100644 --- a/src/rom_8034C54.c +++ b/src/rom_8034C54.c @@ -133,7 +133,7 @@ bool32 sub_8034D14(u32 id, s32 arg1, const struct UnkStruct3 *arg2) compSpriteSheet = *(struct CompressedSpriteSheet*)(arg2->spriteSheet); compSpriteSheet.size = GetDecompressedDataSize(arg2->spriteSheet->data); - gUnknown_02022E10->array[id].tileStart = LoadCompressedObjectPic(&compSpriteSheet); + gUnknown_02022E10->array[id].tileStart = LoadCompressedSpriteSheet(&compSpriteSheet); } if (gUnknown_02022E10->array[id].tileStart == 0xFFFF) diff --git a/src/save.c b/src/save.c index 4ae516fc9..905f075fb 100644 --- a/src/save.c +++ b/src/save.c @@ -5,6 +5,7 @@ #include "decompress.h" #include "load_save.h" #include "overworld.h" +#include "pokemon_storage_system.h" #include "main.h" #include "constants/game_stat.h" diff --git a/src/scrcmd.c b/src/scrcmd.c index e699bfeab..9d9c62a82 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -1485,7 +1485,7 @@ bool8 ScrCmd_braillemessage(struct ScriptContext *ctx) StringExpandPlaceholders(gStringVar4, ptr + 6); - width = GetStringWidth(6, gStringVar4, -1) / 8; + width = GetStringWidth(6, gStringVar4, -1) / 8u; if (width > 0x1C) width = 0x1C; diff --git a/src/script_menu.c b/src/script_menu.c index 2aa546288..6f16b1a8a 100644 --- a/src/script_menu.c +++ b/src/script_menu.c @@ -1640,27 +1640,27 @@ static void sub_80E2A94(u8 multichoiceId) { case 77: FillWindowPixelBuffer(0, 0x11); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBAC[GetMenuCursorPos()], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBAC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); break; case 76: FillWindowPixelBuffer(0, 0x11); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BB9C[GetMenuCursorPos()], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BB9C[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); break; case 78: FillWindowPixelBuffer(0, 0x11); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBBC[GetMenuCursorPos()], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBBC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); break; case 79: FillWindowPixelBuffer(0, 0x11); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBCC[GetMenuCursorPos()], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBCC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); break; case 75: FillWindowPixelBuffer(0, 0x11); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBEC[GetMenuCursorPos()], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBEC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); break; case 74: FillWindowPixelBuffer(0, 0x11); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBE0[GetMenuCursorPos()], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBE0[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); break; } } diff --git a/src/script_pokemon_util_80F87D8.c b/src/script_pokemon_util_80F87D8.c index fc5a06024..9e4cb7719 100755 --- a/src/script_pokemon_util_80F87D8.c +++ b/src/script_pokemon_util_80F87D8.c @@ -335,7 +335,7 @@ void ShowContestEntryMonPic(void) HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species], gMonSpritesGfxPtr->sprites[1], species, personality); palette = GetMonSpritePalStructFromOtIdPersonality(species, otId, personality); - LoadCompressedObjectPalette(palette); + LoadCompressedSpritePalette(palette); SetMultiuseSpriteTemplateToPokemon(species, 1); gMultiuseSpriteTemplate.paletteTag = palette->tag; spriteId = CreateSprite(&gMultiuseSpriteTemplate, (left + 1) * 8 + 32, (top * 8) + 40, 0); diff --git a/src/smokescreen.c b/src/smokescreen.c index 9b37cd234..d9780bbb6 100644 --- a/src/smokescreen.c +++ b/src/smokescreen.c @@ -14,8 +14,8 @@ u8 sub_807521C(s16 x, s16 y, u8 a3) if (GetSpriteTileStartByTag(gUnknown_0831C620.tag) == 0xFFFF) { - LoadCompressedObjectPicUsingHeap(&gUnknown_0831C620); - LoadCompressedObjectPaletteUsingHeap(&gUnknown_0831C628); + LoadCompressedSpriteSheetUsingHeap(&gUnknown_0831C620); + LoadCompressedSpritePaletteUsingHeap(&gUnknown_0831C628); } mainSpriteId = CreateInvisibleSpriteWithCallback(sub_8075370); diff --git a/src/start_menu.c b/src/start_menu.c index 0e52f05fb..ad7b4b6cc 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -574,13 +574,13 @@ static bool8 HandleStartMenuInput(void) if (gMain.newKeys & DPAD_UP) { PlaySE(SE_SELECT); - sStartMenuCursorPos = MoveMenuCursor(-1); + sStartMenuCursorPos = Menu_MoveCursor(-1); } if (gMain.newKeys & DPAD_DOWN) { PlaySE(SE_SELECT); - sStartMenuCursorPos = MoveMenuCursor(1); + sStartMenuCursorPos = Menu_MoveCursor(1); } if (gMain.newKeys & A_BUTTON) diff --git a/src/starter_choose.c b/src/starter_choose.c index 46aac5590..afa3fabbf 100644 --- a/src/starter_choose.c +++ b/src/starter_choose.c @@ -412,8 +412,8 @@ void CB2_ChooseStarter(void) LoadPalette(GetOverworldTextboxPalettePtr(), 0xE0, 0x20); LoadPalette(gBirchBagGrassPal, 0, 0x40); - LoadCompressedObjectPic(&gUnknown_085B1ED8[0]); - LoadCompressedObjectPic(&gUnknown_085B1EE8[0]); + LoadCompressedSpriteSheet(&gUnknown_085B1ED8[0]); + LoadCompressedSpriteSheet(&gUnknown_085B1EE8[0]); LoadSpritePalettes(gUnknown_085B1EF8); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, 0); 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/title_screen.c b/src/title_screen.c index d60e3fc0b..c6e9aa26f 100644 --- a/src/title_screen.c +++ b/src/title_screen.c @@ -518,9 +518,9 @@ void CB2_InitTitleScreen(void) ResetSpriteData(); FreeAllSpritePalettes(); gReservedSpritePaletteCount = 9; - LoadCompressedObjectPic(&sSpriteSheet_EmeraldVersion[0]); - LoadCompressedObjectPic(&sSpriteSheet_PressStart[0]); - LoadCompressedObjectPic(&sPokemonLogoShineSpriteSheet[0]); + LoadCompressedSpriteSheet(&sSpriteSheet_EmeraldVersion[0]); + LoadCompressedSpriteSheet(&sSpriteSheet_PressStart[0]); + LoadCompressedSpriteSheet(&sPokemonLogoShineSpriteSheet[0]); LoadPalette(gTitleScreenEmeraldVersionPal, 0x100, 0x20); LoadSpritePalette(&sSpritePalette_PressStart[0]); gMain.state = 2; diff --git a/src/trainer_pokemon_sprites.c b/src/trainer_pokemon_sprites.c index f5354a1e8..5ddae218b 100644 --- a/src/trainer_pokemon_sprites.c +++ b/src/trainer_pokemon_sprites.c @@ -115,7 +115,7 @@ static void LoadPicPaletteByTagOrSlot(u16 species, u32 otId, u32 personality, u8 else { sCreatingSpriteTemplate.paletteTag = paletteTag; - LoadCompressedObjectPalette(GetMonSpritePalStructFromOtIdPersonality(species, otId, personality)); + LoadCompressedSpritePalette(GetMonSpritePalStructFromOtIdPersonality(species, otId, personality)); } } else @@ -128,7 +128,7 @@ static void LoadPicPaletteByTagOrSlot(u16 species, u32 otId, u32 personality, u8 else { sCreatingSpriteTemplate.paletteTag = paletteTag; - LoadCompressedObjectPalette(&gTrainerFrontPicPaletteTable[species]); + LoadCompressedSpritePalette(&gTrainerFrontPicPaletteTable[species]); } } } diff --git a/src/tv.c b/src/tv.c index 4e7c46a7e..0ae105580 100644 --- a/src/tv.c +++ b/src/tv.c @@ -3469,7 +3469,7 @@ void ChangeBoxPokemonNickname(void) void ChangeBoxPokemonNickname_CB(void) { - SetBoxMonNickFromAnyBox(gSpecialVar_MonBoxId, gSpecialVar_MonBoxPos, gStringVar2); + SetBoxMonNickAt(gSpecialVar_MonBoxId, gSpecialVar_MonBoxPos, gStringVar2); CB2_ReturnToFieldContinueScriptPlayMapMusic(); } diff --git a/src/unk_transition.c b/src/unk_transition.c index 18cee2544..220570851 100644 --- a/src/unk_transition.c +++ b/src/unk_transition.c @@ -185,7 +185,7 @@ static void sub_81DA700(void) LZ77UnCompVram(gUnknown_0862AD54, dst2); LZ77UnCompVram(gUnknown_0862AF30, dst1); LoadPalette(gUnknown_0862B53C, 0xF0, 0x20); - LoadCompressedObjectPic(&sUnknown_0862B724); + LoadCompressedSpriteSheet(&sUnknown_0862B724); LoadSpritePalette(&sUnknown_0862B72C); } diff --git a/src/walda_phrase.c b/src/walda_phrase.c index ff2ee7399..83004777f 100644 --- a/src/walda_phrase.c +++ b/src/walda_phrase.c @@ -7,18 +7,11 @@ #include "text.h" #include "new_game.h" #include "overworld.h" +#include "pokemon_storage_system.h" +#include "field_screen_effect.h" extern const u8 gText_Peekaboo[]; -extern u8 *GetWaldaPhrasePtr(void); -extern bool32 IsWaldaPhraseEmpty(void); -extern void sub_80AF168(void); -extern void SetWaldaPhrase(const u8 *src); -extern void SetWaldaWallpaperPatternId(u8 patternId); -extern void SetWaldaWallpaperIconId(u8 iconId); -extern void SetWaldaWallpaperColors(u16 backgroundColor, u16 foregroundColor); -extern void SetWaldaWallpaperLockedOrUnlocked(bool32 unlocked); - // this file's functions static void CB2_HandleGivenWaldaPhrase(void); static u32 GetWaldaPhraseInputCase(u8 *inputPtr); diff --git a/src/wallclock.c b/src/wallclock.c index 5c8d920e7..58704c8a3 100644 --- a/src/wallclock.c +++ b/src/wallclock.c @@ -623,7 +623,7 @@ static void LoadWallClockGraphics(void) ResetSpriteData(); ResetPaletteFade(); FreeAllSpritePalettes(); - LoadCompressedObjectPic(&gUnknown_085B2208); + LoadCompressedSpriteSheet(&gUnknown_085B2208); LoadSpritePalettes(gUnknown_085B2218); } diff --git a/src/wild_encounter.c b/src/wild_encounter.c index 906cca3a0..00650fc8c 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -251,7 +251,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) @@ -332,7 +332,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) { @@ -360,7 +360,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) { @@ -478,7 +478,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]); @@ -868,7 +868,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]); @@ -905,7 +905,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/src/window.c b/src/window.c index 4e1a38eff..aa1df3a12 100644 --- a/src/window.c +++ b/src/window.c @@ -276,16 +276,16 @@ void CopyWindowToVram(u8 windowId, u8 mode) switch (mode) { - case 1: - CopyBgTilemapBufferToVram(windowLocal.window.bg); - break; - case 2: - LoadBgTiles(windowLocal.window.bg, windowLocal.tileData, windowSize, windowLocal.window.baseBlock); - break; - case 3: - LoadBgTiles(windowLocal.window.bg, windowLocal.tileData, windowSize, windowLocal.window.baseBlock); - CopyBgTilemapBufferToVram(windowLocal.window.bg); - break; + case 1: + CopyBgTilemapBufferToVram(windowLocal.window.bg); + break; + case 2: + LoadBgTiles(windowLocal.window.bg, windowLocal.tileData, windowSize, windowLocal.window.baseBlock); + break; + case 3: + LoadBgTiles(windowLocal.window.bg, windowLocal.tileData, windowSize, windowLocal.window.baseBlock); + CopyBgTilemapBufferToVram(windowLocal.window.bg); + break; } } @@ -308,16 +308,16 @@ void CopyWindowRectToVram(u32 windowId, u32 mode, u32 x, u32 y, u32 w, u32 h) switch (mode) { - case 1: - CopyBgTilemapBufferToVram(windowLocal.window.bg); - break; - case 2: - LoadBgTiles(windowLocal.window.bg, windowLocal.tileData + (rectPos * 32), rectSize, windowLocal.window.baseBlock + rectPos); - break; - case 3: - LoadBgTiles(windowLocal.window.bg, windowLocal.tileData + (rectPos * 32), rectSize, windowLocal.window.baseBlock + rectPos); - CopyBgTilemapBufferToVram(windowLocal.window.bg); - break; + case 1: + CopyBgTilemapBufferToVram(windowLocal.window.bg); + break; + case 2: + LoadBgTiles(windowLocal.window.bg, windowLocal.tileData + (rectPos * 32), rectSize, windowLocal.window.baseBlock + rectPos); + break; + case 3: + LoadBgTiles(windowLocal.window.bg, windowLocal.tileData + (rectPos * 32), rectSize, windowLocal.window.baseBlock + rectPos); + CopyBgTilemapBufferToVram(windowLocal.window.bg); + break; } } } @@ -601,7 +601,7 @@ static void nullsub_9(void) } -u16 AddWindow8Bit(struct WindowTemplate *template) +u16 AddWindow8Bit(const struct WindowTemplate *template) { u16 windowId; u8* memAddress; @@ -669,12 +669,12 @@ void FillWindowPixelRect8Bit(u8 windowId, u8 fillValue, u16 x, u16 y, u16 width, FillBitmapRect8Bit(&pixelRect, x, y, width, height, fillValue); } -void BlitBitmapRectToWindow4BitTo8Bit(u8 windowId, u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight, u8 paletteNum) +void BlitBitmapRectToWindow4BitTo8Bit(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight, u8 paletteNum) { struct Bitmap sourceRect; struct Bitmap destRect; - sourceRect.pixels = (u8*)pixels; + sourceRect.pixels = (u8*) pixels; sourceRect.width = srcWidth; sourceRect.height = srcHeight; @@ -692,16 +692,16 @@ void CopyWindowToVram8Bit(u8 windowId, u8 mode) switch (mode) { - case 1: - CopyBgTilemapBufferToVram(sWindowPtr->window.bg); - break; - case 2: - LoadBgTiles(sWindowPtr->window.bg, sWindowPtr->tileData, sWindowSize, sWindowPtr->window.baseBlock); - break; - case 3: - LoadBgTiles(sWindowPtr->window.bg, sWindowPtr->tileData, sWindowSize, sWindowPtr->window.baseBlock); - CopyBgTilemapBufferToVram(sWindowPtr->window.bg); - break; + case 1: + CopyBgTilemapBufferToVram(sWindowPtr->window.bg); + break; + case 2: + LoadBgTiles(sWindowPtr->window.bg, sWindowPtr->tileData, sWindowSize, sWindowPtr->window.baseBlock); + break; + case 3: + LoadBgTiles(sWindowPtr->window.bg, sWindowPtr->tileData, sWindowSize, sWindowPtr->window.baseBlock); + CopyBgTilemapBufferToVram(sWindowPtr->window.bg); + break; } } diff --git a/sym_ewram.txt b/sym_ewram.txt index e9a9cbf9c..f99dd1ab3 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -191,69 +191,7 @@ gUnknown_02039CF4: @ 2039CF4 gUnknown_02039CF8: @ 2039CF8 .space 0x8 -gUnknown_02039D00: @ 2039D00 - .space 0x4 - -gUnknown_02039D04: @ 2039D04 - .space 0x4 - -gUnknown_02039D08: @ 2039D08 - .space 0x4 - -gUnknown_02039D0C: @ 2039D0C - .space 0x1 - -gUnknown_02039D0D: @ 2039D0D - .space 0x1 - -gUnknown_02039D0E: @ 2039D0E - .space 0x1 - -gUnknown_02039D0F: @ 2039D0F - .space 0x1 - -gUnknown_02039D10: @ 2039D10 - .space 0x2 - -gUnknown_02039D12: @ 2039D12 - .space 0x2 - -gUnknown_02039D14: @ 2039D14 - .space 0x64 - -gUnknown_02039D78: @ 2039D78 - .space 0x1 - -gUnknown_02039D79: @ 2039D79 - .space 0x1 - -gUnknown_02039D7A: @ 2039D7A - .space 0x1 - -gUnknown_02039D7B: @ 2039D7B - .space 0x1 - -gUnknown_02039D7C: @ 2039D7C - .space 0x1 - -gUnknown_02039D7D: @ 2039D7D - .space 0x1 - -gUnknown_02039D7E: @ 2039D7E - .space 0x2 - -gUnknown_02039D80: @ 2039D80 - .space 0x4 - -gUnknown_02039D84: @ 2039D84 - .space 0x4 - -gUnknown_02039D88: @ 2039D88 - .space 0x4 - -gUnknown_02039D8C: @ 2039D8C - .space 0x4 - + .include "src/pokemon_storage_system.o" .include "src/script_movement.o" .include "src/fldeff_cut.o" .include "src/map_name_popup.o"