From 431e7e7e5c390db7fa809f7e8ef1a47c0009468a Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 9 Dec 2018 21:06:43 +0100 Subject: [PATCH] More storage work --- asm/pokemon_storage_system.s | 2729 +----------------------------- include/mon_markings.h | 7 + include/pokemon_storage_system.h | 21 +- src/pokemon_storage_system.c | 1320 ++++++++++++++- 4 files changed, 1286 insertions(+), 2791 deletions(-) diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index f57b8fc9a..2bbf62625 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -7,2687 +7,6 @@ - - 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 PrintStorageActionText - ldr r1, [r4] - movs r0, 0x3 - strb r0, [r1] - b _080C879E - .pool -_080C83BC: - bl sub_80CDC0C - ldr r0, =sub_80C87A8 - bl SetPSSCallback - b _080C879E - .pool -_080C83CC: - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldrb r0, [r0, 0x1] - cmp r0, 0x2 - bne _080C8400 - bl IsMonBeingMoved - 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 SetPSSCallback - b _080C879E - .pool -_080C8414: - ldr r0, =sub_80C9BE8 - bl SetPSSCallback - b _080C879E - .pool -_080C8420: - ldr r0, =sub_80C9D1C - bl SetPSSCallback - b _080C879E - .pool -_080C842C: - movs r0, 0x5 - bl PlaySE - ldr r0, =box_related - bl SetPSSCallback - b _080C879E - .pool -_080C8440: - ldr r0, =sub_80C8864 - bl SetPSSCallback - 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 CanMoveMon - 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 SetPSSCallback - b _080C879E - .pool -_080C850C: - bl CanMoveMon - lsls r0, 24 - cmp r0, 0 - bne _080C8528 - movs r0, 0x5 - bl PlaySE - b _080C872C -_080C851E: - bl CanShifMon - 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 SetPSSCallback - b _080C879E - .pool -_080C854C: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C8C90 - bl SetPSSCallback - b _080C879E - .pool -_080C8560: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C8BEC - bl SetPSSCallback - b _080C879E - .pool -_080C8574: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C9128 - bl SetPSSCallback - b _080C879E - .pool -_080C8588: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C91DC - bl SetPSSCallback - b _080C879E - .pool -_080C859C: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C93B0 - bl SetPSSCallback - 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 IsCursorOnCloseBox - 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, =sInPartyMenu - ldrb r0, [r0] - cmp r0, 0 - bne _080C8690 - bl IsMonBeingMoved - 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 PrintStorageActionText - 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 SetPSSCallback - 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 SetPSSCallback - 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 SetPSSCallback -_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 SetPSSCallback -_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 PrintStorageActionText - 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 PrintStorageActionText - b _080C88F2 - .pool -_080C88EC: - movs r0, 0x18 - bl PrintStorageActionText -_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 SetPSSCallback - b _080C8B82 - .pool -_080C899C: - bl CanMoveMon - lsls r0, 24 - cmp r0, 0 - bne _080C8A52 - movs r0, 0x5 - bl PlaySE - bl sub_80CADC4 - ldr r0, =sub_80C8B90 - bl SetPSSCallback - b _080C8B82 - .pool -_080C89BC: - movs r0, 0x5 - bl PlaySE - bl sub_80CADC4 - ldr r0, =sub_80C8BEC - bl SetPSSCallback - b _080C8B82 - .pool -_080C89D4: - bl CanShifMon - lsls r0, 24 - cmp r0, 0 - beq _080C8A52 - movs r0, 0x5 - bl PlaySE - bl sub_80CADC4 - ldr r0, =c3_0808DC50 - bl SetPSSCallback - b _080C8B82 - .pool -_080C89F4: - movs r0, 0x5 - bl PlaySE - bl sub_80CADC4 - ldr r0, =sub_80C8C90 - bl SetPSSCallback - b _080C8B82 - .pool -_080C8A0C: - bl CanMoveMon - 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 SetPSSCallback - b _080C8B82 - .pool -_080C8A48: - bl CanMoveMon - 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 SetPSSCallback - b _080C8B82 - .pool -_080C8AAC: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C9B28 - bl SetPSSCallback - b _080C8B82 - .pool -_080C8AC0: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C90A4 - bl SetPSSCallback - b _080C8B82 - .pool -_080C8AD4: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C9128 - bl SetPSSCallback - b _080C8B82 - .pool -_080C8AE8: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C91DC - bl SetPSSCallback - b _080C8B82 - .pool -_080C8AFC: - ldr r0, =sub_80C9298 - bl SetPSSCallback - b _080C8B82 - .pool -_080C8B08: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C93B0 - bl SetPSSCallback - b _080C8B82 - .pool -_080C8B1C: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C9B88 - bl SetPSSCallback - b _080C8B82 - .pool -_080C8B30: - ldr r0, =sub_80C9498 - bl SetPSSCallback - 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 PrintStorageActionText - 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 SetPSSCallback -_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, =sInPartyMenu - ldrb r0, [r0] - cmp r0, 0 - beq _080C8BDC - ldr r0, =sub_80C9670 - bl SetPSSCallback - b _080C8BE2 - .pool -_080C8BDC: - ldr r0, =task_pokemon_box_related - bl SetPSSCallback -_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, =sInPartyMenu - ldrb r0, [r0] - cmp r0, 0 - beq _080C8C38 - ldr r0, =sub_80C9670 - bl SetPSSCallback - b _080C8C3E - .pool -_080C8C38: - ldr r0, =task_pokemon_box_related - bl SetPSSCallback -_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 SetPSSCallback -_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 PrintStorageActionText - 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 SetPSSCallback - 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 SetPSSCallback -_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 PrintStorageActionText - 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 PrintStorageActionText - 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 SetPSSCallback - 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 PrintStorageActionText - 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 PrintStorageActionText - 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, =sInPartyMenu - 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 SetPSSCallback - 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 PrintStorageActionText -_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 SetPSSCallback -_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 PrintStorageActionText - 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 SetPSSCallback -_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 SetPSSCallback - b _080C91D2 - .pool -_080C9174: - movs r0, 0x2 - bl sub_80CFE54 - ldr r0, =sInPartyMenu - 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 SetPSSCallback -_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, =sInPartyMenu - 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 PrintStorageActionText - 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 SetPSSCallback -_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 PrintStorageActionText - ldr r1, [r5] - movs r0, 0x3 - strb r0, [r1] - b _080C93A2 - .pool -_080C92FC: - movs r0, 0x5 - bl PlaySE - ldr r0, =sInPartyMenu - 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 PrintStorageActionText - 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 SetPSSCallback - 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 SetPSSCallback -_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 SetPSSCallback - b _080C948C - .pool -_080C9410: - movs r0, 0x2 - bl sub_80CFE54 - ldr r0, =sInPartyMenu - 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 PrintStorageActionText - 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 SetPSSCallback -_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 SetPSSCallback -_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 PrintStorageActionText - 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 PrintStorageActionText - 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 SetPSSCallback - b _080C9664 - .pool -_080C9654: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _080C9664 - ldr r0, =task_pokemon_box_related - bl SetPSSCallback -_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 SetPSSCallback -_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 PrintStorageActionText - 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 SetPSSCallback -_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 PrintStorageActionText - 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 SetPSSCallback - b _080C9818 - .pool -_080C97DC: - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_80C9AC8 - bl SetPSSCallback - b _080C9818 - .pool -_080C97F0: - movs r0, 0x5 - bl PlaySE - bl sub_80CADC4 - ldr r0, =sub_80C9824 - bl SetPSSCallback - b _080C9818 - .pool -_080C9808: - movs r0, 0x5 - bl PlaySE - bl sub_80CADC4 - ldr r0, =sub_80C99D8 - bl SetPSSCallback -_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 PrintStorageActionText - 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 PrintStorageActionText - 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 SetPSSCallback - 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 PrintStorageActionText - 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 SetPSSCallback - 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 SetPSSCallback -_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 SetPSSCallback -_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} @@ -2868,15 +187,15 @@ _080C9CA6: cmp r1, 0x1 bne _080C9D08 _080C9CAA: - bl sub_80CADC4 - ldr r0, =task_pokemon_box_related + bl ClearBottomWindow + ldr r0, =sub_80C82AC bl SetPSSCallback b _080C9D08 .pool _080C9CBC: movs r0, 0x3 bl PlaySE - bl sub_80CADC4 + bl ClearBottomWindow b _080C9CD2 _080C9CC8: movs r0, 0x14 @@ -3000,15 +319,15 @@ _080C9DDA: beq _080C9DF0 b _080C9E3C _080C9DE0: - bl sub_80CADC4 - ldr r0, =task_pokemon_box_related + bl ClearBottomWindow + ldr r0, =sub_80C82AC bl SetPSSCallback b _080C9E3C .pool _080C9DF0: movs r0, 0x3 bl PlaySE - bl sub_80CADC4 + bl ClearBottomWindow b _080C9E06 _080C9DFC: movs r0, 0x14 @@ -3173,7 +492,7 @@ sub_80C9F6C: @ 80C9F6C strh r1, [r0] cmp r1, 0 beq _080C9FC0 - bl sub_80CFE08 + bl GetBoxCursorPosition lsls r0, 24 lsrs r1, r0, 24 ldr r0, =sInPartyMenu @@ -4807,8 +2126,8 @@ sub_80CAD9C: @ 80CAD9C .pool thumb_func_end sub_80CAD9C - thumb_func_start sub_80CADC4 -sub_80CADC4: @ 80CADC4 + thumb_func_start ClearBottomWindow +ClearBottomWindow: @ 80CADC4 push {lr} movs r0, 0x1 movs r1, 0 @@ -4817,7 +2136,7 @@ sub_80CADC4: @ 80CADC4 bl schedule_bg_copy_tilemap_to_vram pop {r0} bx r0 - thumb_func_end sub_80CADC4 + thumb_func_end ClearBottomWindow thumb_func_start sub_80CADD8 sub_80CADD8: @ 80CADD8 @@ -4927,7 +2246,7 @@ sub_80CAEAC: @ 80CAEAC ldrb r0, [r0] cmp r0, 0 beq _080CAED8 - bl sub_80CFE08 + bl GetBoxCursorPosition adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -4936,7 +2255,7 @@ sub_80CAEAC: @ 80CAEAC b _080CAEE8 .pool _080CAED8: - bl sub_80CFE08 + bl GetBoxCursorPosition adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -7733,8 +5052,8 @@ _080CC4EA: .pool thumb_func_end sub_80CC464 - thumb_func_start sub_80CC54C -sub_80CC54C: @ 80CC54C + thumb_func_start ScrollToBox +ScrollToBox: @ 80CC54C push {r4-r6,lr} ldr r4, =gUnknown_02039D08 ldr r1, [r4] @@ -7845,7 +5164,7 @@ _080CC634: pop {r1} bx r1 .pool - thumb_func_end sub_80CC54C + thumb_func_end ScrollToBox thumb_func_start sub_80CC644 sub_80CC644: @ 80CC644 @@ -7883,8 +5202,8 @@ _080CC678: bx r1 thumb_func_end sub_80CC644 - thumb_func_start sub_80CC680 -sub_80CC680: @ 80CC680 + thumb_func_start SetWallpaperForCurrentBox +SetWallpaperForCurrentBox: @ 80CC680 push {r4,lr} adds r4, r0, 0 lsls r4, 24 @@ -7904,10 +5223,10 @@ sub_80CC680: @ 80CC680 pop {r0} bx r0 .pool - thumb_func_end sub_80CC680 + thumb_func_end SetWallpaperForCurrentBox - thumb_func_start sub_80CC6B0 -sub_80CC6B0: @ 80CC6B0 + thumb_func_start DoWallpaperGfxChange +DoWallpaperGfxChange: @ 80CC6B0 push {r4,lr} sub sp, 0x4 ldr r1, =gUnknown_02039D08 @@ -8007,7 +5326,7 @@ _080CC796: pop {r4} pop {r1} bx r1 - thumb_func_end sub_80CC6B0 + thumb_func_end DoWallpaperGfxChange thumb_func_start sub_80CC7A0 sub_80CC7A0: @ 80CC7A0 @@ -14367,13 +11686,13 @@ _080CFDD2: .pool thumb_func_end sub_80CFDC4 - thumb_func_start sub_80CFE08 -sub_80CFE08: @ 80CFE08 + thumb_func_start GetBoxCursorPosition +GetBoxCursorPosition: @ 80CFE08 ldr r0, =sBoxCursorPosition ldrb r0, [r0] bx lr .pool - thumb_func_end sub_80CFE08 + thumb_func_end GetBoxCursorPosition thumb_func_start sub_80CFE14 sub_80CFE14: @ 80CFE14 diff --git a/include/mon_markings.h b/include/mon_markings.h index 00df6815a..8e4ec58bd 100644 --- a/include/mon_markings.h +++ b/include/mon_markings.h @@ -22,7 +22,14 @@ struct PokemonMarkMenu }; // 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_storage_system.h b/include/pokemon_storage_system.h index 4a3adec78..ed2b20f46 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -76,12 +76,12 @@ struct PokemonStorageSystemData u8 unk_02C7; u8 unk_02C8; u8 unk_02C9; - s16 field_2CA; + s16 newCurrBoxId; u16 bg2_X; u8 field_2CE; - u8 field_2CF[1217]; - u8 changeWallpaper; - u8 field_791; + u8 field_2CF[1215]; + s16 wallpaperSetId; + s16 wallpaperId; u8 wallpaperTilemap[180 * 4]; u8 wallpaperChangeState; u8 field_A63; @@ -92,9 +92,18 @@ struct PokemonStorageSystemData u8 *wallpaperTilemapPtr; u8 field_A6C; u8 field_A6D[633]; - u16 field_CE6; - u8 field_CE8[188]; + u16 selectedItem; + u16 field_CE8; + u8 field_CEA; + u8 field_CEB; + u8 field_CEC; + u8 field_CED; + u8 field_CEE; + u8 field_CEF[181]; struct PokemonMarkMenu field_DA4; + struct UnkPSSStruct_2002370 field_1E5C; + u8 field_20A4[400]; + u16 field_2234; }; extern struct UnkPSSStruct_2002370 *gUnknown_02039D04; diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index b7b0e1295..3ec4701af 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -7,7 +7,9 @@ #include "field_weather.h" #include "gpu_regs.h" #include "international_string_util.h" +#include "item.h" #include "item_menu.h" +#include "mail.h" #include "main.h" #include "menu.h" #include "mon_markings.h" @@ -92,6 +94,8 @@ extern bool8 sub_80F9C1C(void); void StorageSystemCreatePrimaryMenu(u8 whichMenu, s16 *windowIdPtr); void sub_80C7D74(u8 boxOption); u8 sub_80CAEA0(void); +u8 sub_80CF9EC(void); +u8 sub_80CDC2C(void); void SetBoxWallpaper(u8 boxId, u8 wallpaperId); void SetCurrentBox(u8 boxId); void sub_80CC32C(u8 boxId); @@ -108,35 +112,126 @@ void sub_80CAA14(void); void sub_80CE790(void); void sub_80CE8E4(void); void sub_80C9F6C(void); +void sub_80CA888(void); void sub_80CA044(void); void sub_80CA0C8(void); +void sub_80CDC18(void); void sub_80CD36C(void); void sub_80CD3EC(void); void sub_80CAC1C(void); void sub_80C9FEC(void); void sub_80CAEAC(void); void sub_80D0C60(void); +void sub_80CFEA8(void); void sub_80CDC0C(void); void sub_80CAF04(void); void sub_80CA0D8(void); -void sub_80CADC4(void); +void sub_80CFFD0(void); +void sub_80CE250(void); +void sub_80CE3A0(void); +void sub_80CE2D8(void); +void sub_80CA230(void); +void sub_80CC064(void); +void sub_80CE324(void); +void ClearBottomWindow(void); void sub_80CA704(void); +void sub_80D013C(void); +void sub_80CE00C(void); +void sub_80D1194(void); +void sub_80CA4FC(void); +void sub_80CADD8(void); +void sub_80D1818(void); +void sub_80D17B4(void); +void sub_80CE760(void); +void sub_80CFECC(void); +void sub_80CA9EC(void); +void sub_80CAB20(void); +void sub_80CE22C(void); +void sub_80CB950(void); +void sub_80CA9C0(void); +void BoxSetMosaic(void); void sub_80C7CF4(struct Sprite *sprite); bool8 sub_80CA0A4(void); +bool8 sub_80CC0A0(void); +bool8 sub_80CE2A8(void); bool8 sub_80D0164(void); bool8 sub_80CC35C(void); +bool8 sub_80D01E4(void); +bool8 sub_80CAB4C(void); +bool8 sub_80D184C(void); +bool8 sub_80D18E4(void); +bool8 sub_80CAB70(void); +bool8 sub_80D1218(void); +bool8 sub_80CB9BC(void); +bool8 ScrollToBox(void); +bool8 sub_80CD554(void); +bool8 sub_80CA8C8(void); +bool8 sub_80D127C(void); +bool8 sub_80CA2B8(void); +bool8 DoWallpaperGfxChange(void); +bool8 sub_80CDCAC(void); +bool8 sub_80D00A8(void); +bool8 CanMoveMon(void); +bool8 CanShifMon(void); +bool8 IsCursorOnCloseBox(void); +bool8 IsMonBeingMoved(void); +bool8 sub_80CE19C(u8 arg0); void sub_80C7FA8(u8 taskId); +void sub_80C8BEC(u8 taskId); void sub_80C9E50(u8 taskId); void sub_80C81AC(u8 taskId); -void box_related_2(u8 taskId); +void sub_80C9D1C(u8 taskId); +void Cb_HandleBoxOptions(u8 taskId); +void sub_80C8864(u8 taskId); +void sub_80C9BE8(u8 taskId); +void sub_80C87E8(u8 taskId); +void sub_80C8D78(u8 taskId); +void sub_80C8B90(u8 taskId); +void sub_80C91DC(u8 taskId); +void Cb_SwitchSelectedItem(u8 taskId); +void sub_80C9128(u8 taskId); +void Cb_WithdrawMon(u8 taskId); +void c3_0808DC50(u8 taskId); +void sub_80C87A8(u8 taskId); +void sub_80C9498(u8 taskId); +void sub_80C9B88(u8 taskId); +void Cb_ItemToBag(u8 taskId); +void sub_80C9128(u8 taskId); +void sub_80C90A4(u8 taskId); +void sub_80C9B28(u8 taskId); +void Cb_ReleaseMon(u8 taskId); void task_pokemon_box_related(u8 taskId); +void sub_80C972C_2(u8 taskId); +void sub_80C82AC(u8 taskId); +void Cb_JumpBox(u8 taskId); +void Cb_HandleWallpapers(u8 taskId); +void Cb_NameBox(u8 taskId); +void Cb_PrintCantStoreMail(u8 taskId); +void sub_80C9670(u8 taskId); void sub_80D2A90(struct UnkStruct_2000020 *arg0, struct UnkStruct_2000028 *arg1, u32 arg2); void sub_80D259C(u8 arg0); +void sub_80CC464(u8 arg0); +void sub_80CFE54(u8 arg0); +void sub_80CC0D4(u8 arg0); +void sub_80CDC38(u8 arg0); +void sub_80CE9A8(u8 markings); +void sub_80CAD9C(u8 arg0); +void sub_80CDBF8(u8 arg0); void sub_80D01D0(u8 arg0); +void sub_80CD1A8(bool8 arg0); void sub_80D2644(u8 arg0, u16 arg1, const u16 *arg2, u16 arg3, u16 arg4); void sub_80D2770(u8 arg0, u16 arg1, u16 arg2); -void PrintStorageActionText(u8 arg0); +void PrintStorageActionText(u8 id); +s16 sub_80D00AC(void); +s8 sub_80CE580(void); +u8 GetBoxCursorPosition(void); +void sub_80D0E90(bool8 inParty, u8 boxPosition); +void sub_80D1080(bool8 inParty, u8 boxPosition); +void sub_80D1114(bool8 inParty, u8 boxPosition); +void sub_80D0FAC(bool8 inParty, u8 boxPosition); struct Sprite *sub_80CD2E8(u16 x, u16 y, u8 animId, u8 priority, u8 subpriority); +void SetWallpaperForCurrentBox(u8 wallpaperId); +void sub_80CAE0C(u8 arg0); // const rom data const struct PSS_MenuStringPtrs gUnknown_085716C0[] = @@ -340,37 +435,37 @@ const struct SpriteTemplate gUnknown_08572754 = const struct StorageAction gPCStorageActionTexts[] = { - {gText_ExitFromBox, 0}, - {gText_WhatDoYouWantToDo, 0}, - {gText_PleasePickATheme, 0}, - {gText_PickTheWallpaper, 0}, - {gText_PkmnIsSelected, 1}, - {gText_JumpToWhichBox, 0}, - {gText_DepositInWhichBox, 0}, - {gText_PkmnWasDeposited, 1}, - {gText_BoxIsFull2, 0}, - {gText_ReleaseThisPokemon, 0}, - {gText_PkmnWasReleased, 4}, - {gText_ByeByePkmn, 6}, - {gText_MarkYourPkmn, 0}, - {gText_ThatsYourLastPkmn, 0}, - {gText_YourPartysFull, 0}, - {gText_YoureHoldingAPkmn, 0}, - {gText_WhichOneWillYouTake, 0}, - {gText_YouCantReleaseAnEgg, 0}, - {gText_ContinueBoxOperations, 0}, - {gText_PkmnCameBack, 1}, - {gText_WasItWorriedAboutYou, 0}, - {gText_FourEllipsesExclamation, 0}, - {gText_PleaseRemoveTheMail, 0}, - {gText_PkmnIsSelected, 7}, - {gText_GiveToAPkmn, 0}, - {gText_PlacedItemInBag, 7}, - {gText_BagIsFull2, 0}, - {gText_PutItemInBag, 0}, - {gText_ItemIsNowHeld, 7}, - {gText_ChangedToNewItem, 7}, - {gText_MailCantBeStored, 0}, + [PC_TEXT_EXIT_BOX] = {gText_ExitFromBox, 0}, + [PC_TEXT_WHAT_YOU_DO] = {gText_WhatDoYouWantToDo, 0}, + [PC_TEXT_PICK_A_THEME] = {gText_PleasePickATheme, 0}, + [PC_TEXT_PICK_A_WALLPAPER] = {gText_PickTheWallpaper, 0}, + [PC_TEXT_IS_SELECTED] = {gText_PkmnIsSelected, 1}, + [PC_TEXT_JUMP_TO_WHICH_BOX] = {gText_JumpToWhichBox, 0}, + [PC_TEXT_DEPOSIT_IN_WHICH_BOX] = {gText_DepositInWhichBox, 0}, + [PC_TEXT_WAS_DEPOSITED] = {gText_PkmnWasDeposited, 1}, + [PC_TEXT_BOX_IS_FULL] = {gText_BoxIsFull2, 0}, + [PC_TEXT_RELEASE_POKE] = {gText_ReleaseThisPokemon, 0}, + [PC_TEXT_WAS_RELEASED] = {gText_PkmnWasReleased, 4}, + [PC_TEXT_BYE_BYE] = {gText_ByeByePkmn, 6}, + [PC_TEXT_MARK_POKE] = {gText_MarkYourPkmn, 0}, + [PC_TEXT_LAST_POKE] = {gText_ThatsYourLastPkmn, 0}, + [PC_TEXT_PARTY_FULL] = {gText_YourPartysFull, 0}, + [PC_TEXT_HOLDING_POKE] = {gText_YoureHoldingAPkmn, 0}, + [PC_TEXT_WHICH_ONE_WILL_TAKE] = {gText_WhichOneWillYouTake, 0}, + [PC_TEXT_CANT_RELEASE_EGG] = {gText_YouCantReleaseAnEgg, 0}, + [PC_TEXT_CONTINUE_BOX] = {gText_ContinueBoxOperations, 0}, + [PC_TEXT_CAME_BACK] = {gText_PkmnCameBack, 1}, + [PC_TEXT_WORRIED] = {gText_WasItWorriedAboutYou, 0}, + [PC_TEXT_SURPRISE] = {gText_FourEllipsesExclamation, 0}, + [PC_TEXT_PLEASE_REMOVE_MAIL] = {gText_PleaseRemoveTheMail, 0}, + [PC_TEXT_IS_SELECTED2] = {gText_PkmnIsSelected, 7}, + [PC_TEXT_GIVE_TO_MON] = {gText_GiveToAPkmn, 0}, + [PC_TEXT_PLACED_IN_BAG] = {gText_PlacedItemInBag, 7}, + [PC_TEXT_BAG_FULL] = {gText_BagIsFull2, 0}, + [PC_TEXT_PUT_IN_BAG] = {gText_PutItemInBag, 0}, + [PC_TEXT_ITEM_IS_HELD] = {gText_ItemIsNowHeld, 7}, + [PC_TEXT_CHANGED_TO_ITEM] = {gText_ChangedToNewItem, 7}, + [PC_TEXT_CANT_STORE_MAIL] = {gText_MailCantBeStored, 0}, }; // code @@ -1126,7 +1221,7 @@ void sub_80C7FA8(u8 taskId) else { BlendPalettes(0xFFFFFFFF, 0x10, 0); - SetPSSCallback(box_related_2); + SetPSSCallback(sub_80C972C_2); } SetVBlankCallback(sub_80C7D28); return; @@ -1148,12 +1243,12 @@ void sub_80C81AC(u8 taskId) break; case 1: if (!sub_80F9C1C()) - SetPSSCallback(task_pokemon_box_related); + SetPSSCallback(sub_80C82AC); break; } } -void box_related_2(u8 taskId) +void sub_80C972C_2(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -1166,31 +1261,30 @@ void box_related_2(u8 taskId) { if (gUnknown_02039D0F == 2 && gSpecialVar_ItemId != 0) { - PrintStorageActionText(0x1C); + PrintStorageActionText(PC_TEXT_ITEM_IS_HELD); gUnknown_02039D08->state++; } else { - SetPSSCallback(task_pokemon_box_related); + SetPSSCallback(sub_80C82AC); } } break; case 2: if (!IsDma3ManagerBusyWithBgCopy() && gMain.newKeys & (A_BUTTON | B_BUTTON)) { - sub_80CADC4(); + ClearBottomWindow(); gUnknown_02039D08->state++; } break; case 3: if (!IsDma3ManagerBusyWithBgCopy()) - SetPSSCallback(task_pokemon_box_related); + SetPSSCallback(sub_80C82AC); break; } } -/* -void task_pokemon_box_related(u8 taskId) +void sub_80C82AC(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -1202,7 +1296,7 @@ void task_pokemon_box_related(u8 taskId) gUnknown_02039D08->state = 1; break; case 5: - if (gUnknown_02039D08->boxOption != 0 && gUnknown_02039D08->boxOption != 1) + if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_MONS && gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) { PrintStorageActionText(PC_TEXT_WHICH_ONE_WILL_TAKE); gUnknown_02039D08->state = 3; @@ -1214,36 +1308,39 @@ void task_pokemon_box_related(u8 taskId) } break; case 6: - if (gUnknown_02039D08->unk_0005 == 2) + if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_MONS) { - if (sub_80CEAD0() && ItemIsMail(gUnknown_02039D08->field_CE6)) + if (IsMonBeingMoved() && ItemIsMail(gUnknown_02039D08->selectedItem)) gUnknown_02039D08->state = 5; else SetPSSCallback(sub_80C87E8); } + else if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + { + SetPSSCallback(sub_80C87E8); + } break; case 4: SetPSSCallback(sub_80C9BE8); break; - case 16: + case 19: SetPSSCallback(sub_80C9D1C); break; case 7: PlaySE(SE_SELECT); - SetPSSCallback(sub_80C972C); + SetPSSCallback(Cb_HandleBoxOptions); break; case 8: - PlaySE(SE_SELECT); SetPSSCallback(sub_80C8864); break; case 9: PlaySE(SE_SELECT); - gUnknown_02039D08->field_2CA = StorageGetCurrentBox() + 1; - if (gUnknown_02039D08->field_2C >= TOTAL_BOXES_COUNT) - gUnknown_02039D08->field_2CA = 0; - if (gUnknown_02039D08->boxOption != 3) + gUnknown_02039D08->newCurrBoxId = StorageGetCurrentBox() + 1; + if (gUnknown_02039D08->newCurrBoxId >= TOTAL_BOXES_COUNT) + gUnknown_02039D08->newCurrBoxId = 0; + if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) { - sub_80CC464(gUnknown_02039D08->field_2CA); + sub_80CC464(gUnknown_02039D08->newCurrBoxId); gUnknown_02039D08->state = 2; } else @@ -1254,12 +1351,12 @@ void task_pokemon_box_related(u8 taskId) break; case 10: PlaySE(SE_SELECT); - gUnknown_02039D08->field_2CA = StorageGetCurrentBox() - 1; - if (gUnknown_02039D08->field_2CA < 0) - gUnknown_02039D08->field_2CA = TOTAL_BOXES_COUNT; - if (gUnknown_02039D08->boxOption != 3) + gUnknown_02039D08->newCurrBoxId = StorageGetCurrentBox() - 1; + if (gUnknown_02039D08->newCurrBoxId < 0) + gUnknown_02039D08->newCurrBoxId = TOTAL_BOXES_COUNT - 1; + if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) { - sub_80CC464(gUnknown_02039D08->field_2CA); + sub_80CC464(gUnknown_02039D08->newCurrBoxId); gUnknown_02039D08->state = 2; } else @@ -1269,9 +1366,9 @@ void task_pokemon_box_related(u8 taskId) } break; case 11: - if (!sub_80CEA30()) + if (!CanMoveMon()) { - if (ItemIsMail(gUnknown_02039D08->field_CE6)) + if (ItemIsMail(gUnknown_02039D08->selectedItem)) { gUnknown_02039D08->state = 5; } @@ -1287,7 +1384,7 @@ void task_pokemon_box_related(u8 taskId) } break; case 13: - if (sub_80CEA30()) + if (CanMoveMon()) { gUnknown_02039D08->state = 4; } @@ -1298,7 +1395,7 @@ void task_pokemon_box_related(u8 taskId) } break; case 14: - if (!sub_80CEA30()) + if (!CanShifMon()) { gUnknown_02039D08->state = 4; } @@ -1310,7 +1407,7 @@ void task_pokemon_box_related(u8 taskId) break; case 12: PlaySE(SE_SELECT); - SetPSSCallback(sub_80C8C90); + SetPSSCallback(Cb_WithdrawMon); break; case 15: PlaySE(SE_SELECT); @@ -1326,7 +1423,7 @@ void task_pokemon_box_related(u8 taskId) break; case 18: PlaySE(SE_SELECT); - SetPSSCallback(sub_80C93B0); + SetPSSCallback(Cb_SwitchSelectedItem); break; case 20: PlaySE(SE_SELECT); @@ -1343,7 +1440,7 @@ void task_pokemon_box_related(u8 taskId) gUnknown_02039D08->state = 9; break; case 23: - sub_80D01D0(4); + sub_80D01D0(3); gUnknown_02039D08->state = 7; break; case 25: @@ -1356,36 +1453,48 @@ void task_pokemon_box_related(u8 taskId) sub_80D01D0(5); gUnknown_02039D08->state = 7; break; + case 24: + PlaySE(SE_HAZURE); + break; } break; case 1: - if (!sub_809AC00()) + if (!sub_80CD554()) { - if (sub_809BF48()) - sub_80986E8(); + if (IsCursorOnCloseBox()) + sub_80CA9C0(); else - sub_8098710(); - if (gUnknown_02039D08->unk_11f6) + sub_80CA9EC(); + if (gUnknown_02039D08->field_CEA) BoxSetMosaic(); gUnknown_02039D08->state = 0; } break; case 2: - if (!sub_8099D34()) + if (!ScrollToBox()) { - gPokemonStorage.currentBox = gUnknown_02039D08->unk_08b2; - if (!gUnknown_0203847C && !sub_80CEAD0()) + SetCurrentBox(gUnknown_02039D08->newCurrBoxId); + if (!sInPartyMenu && !IsMonBeingMoved()) { - sub_809B440(); + sub_80CE00C(); BoxSetMosaic(); } - gUnknown_02039D08->state = 0; + + if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + { + sub_80CFECC(); + gUnknown_02039D08->state = 11; + } + else + { + gUnknown_02039D08->state = 0; + } } break; case 3: if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { - sub_8098A5C(); + ClearBottomWindow(); gUnknown_02039D08->state = 0; } break; @@ -1402,10 +1511,1061 @@ void task_pokemon_box_related(u8 taskId) case 6: if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { - sub_8098A5C(); - SetPSSCallback(sub_8096C84); + ClearBottomWindow(); + SetPSSCallback(sub_80C82AC); + } + break; + case 7: + if (!sub_80D01E4()) + gUnknown_02039D08->state = 0; + break; + case 8: + if (!sub_80D01E4()) + SetPSSCallback(sub_80C8B90); + break; + case 9: + if (!sub_80D01E4()) + { + if (gUnknown_02039D08->field_CEA) + BoxSetMosaic(); + gUnknown_02039D08->state = 0; + } + break; + case 10: + if (!sub_80D1218()) + { + sub_80CC464(gUnknown_02039D08->newCurrBoxId); + gUnknown_02039D08->state = 2; + } + break; + case 11: + if (!sub_80D1218()) + gUnknown_02039D08->state = 0; + break; + } +} + +void sub_80C87A8(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + sub_80CAB4C(); + gUnknown_02039D08->state++; + break; + case 1: + if (!sub_80CAB70()) + SetPSSCallback(sub_80C82AC); + break; + } +} + +void sub_80C87E8(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + PlaySE(SE_SELECT); + sub_80CA888(); + gUnknown_02039D08->state++; + break; + case 1: + if (!sub_80CA8C8()) + { + sub_80CDBF8(sub_80CDC2C()); + gUnknown_02039D08->state++; + } + break; + case 2: + if (!sub_80CD554()) + { + if (gUnknown_02039D08->field_CEA) + BoxSetMosaic(); + SetPSSCallback(sub_80C82AC); + } + break; + } +} + +void sub_80C8864(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + if (!sub_80CA2B8()) + { + PlaySE(SE_SELECT); + if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + PrintStorageActionText(PC_TEXT_IS_SELECTED); + else if (sub_80D127C() || gUnknown_02039D08->selectedItem != 0) + PrintStorageActionText(PC_TEXT_IS_SELECTED2); + else + PrintStorageActionText(PC_TEXT_GIVE_TO_MON); + + sub_80CFFD0(); + gUnknown_02039D08->state = 1; + } + break; + case 1: // debug? + if (!sub_80D00A8()) + gUnknown_02039D08->state = 2; + break; + case 2: + switch (sub_80D00AC()) + { + case -1: + case 0: + ClearBottomWindow(); + SetPSSCallback(sub_80C82AC); + break; + case 3: + if (CanMoveMon()) + { + gUnknown_02039D08->state = 3; + } + else + { + PlaySE(SE_SELECT); + ClearBottomWindow(); + SetPSSCallback(sub_80C8B90); + } + break; + case 5: + PlaySE(SE_SELECT); + ClearBottomWindow(); + SetPSSCallback(sub_80C8BEC); + break; + case 4: + if (!CanShifMon()) + { + gUnknown_02039D08->state = 3; + } + else + { + PlaySE(SE_SELECT); + ClearBottomWindow(); + SetPSSCallback(c3_0808DC50); + } + break; + case 2: + PlaySE(SE_SELECT); + ClearBottomWindow(); + SetPSSCallback(Cb_WithdrawMon); + break; + case 1: + if (CanMoveMon()) + { + gUnknown_02039D08->state = 3; + } + else if (ItemIsMail(gUnknown_02039D08->selectedItem)) + { + gUnknown_02039D08->state = 4; + } + else + { + PlaySE(SE_SELECT); + ClearBottomWindow(); + SetPSSCallback(sub_80C8D78); + } + break; + case 7: + if (CanMoveMon()) + { + gUnknown_02039D08->state = 3; + } + else if (gUnknown_02039D08->field_CED) + { + gUnknown_02039D08->state = 5; + } + else if (ItemIsMail(gUnknown_02039D08->selectedItem)) + { + gUnknown_02039D08->state = 4; + } + else + { + PlaySE(SE_SELECT); + SetPSSCallback(Cb_ReleaseMon); + } + break; + case 6: + PlaySE(SE_SELECT); + SetPSSCallback(sub_80C9B28); + break; + case 8: + PlaySE(SE_SELECT); + SetPSSCallback(sub_80C90A4); + break; + case 12: + PlaySE(SE_SELECT); + SetPSSCallback(sub_80C9128); + break; + case 13: + PlaySE(SE_SELECT); + SetPSSCallback(sub_80C91DC); + break; + case 16: + SetPSSCallback(Cb_ItemToBag); + break; + case 15: + PlaySE(SE_SELECT); + SetPSSCallback(Cb_SwitchSelectedItem); + break; + case 14: + PlaySE(SE_SELECT); + SetPSSCallback(sub_80C9B88); + break; + case 17: + SetPSSCallback(sub_80C9498); + break; + } + break; + case 3: + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_LAST_POKE); + gUnknown_02039D08->state = 6; + break; + case 5: + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_CANT_RELEASE_EGG); + gUnknown_02039D08->state = 6; + break; + case 4: + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_PLEASE_REMOVE_MAIL); + gUnknown_02039D08->state = 6; + break; + case 6: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + SetPSSCallback(sub_80C82AC); + } + break; + } +} + +void sub_80C8B90(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + sub_80CDC38(0); + gUnknown_02039D08->state++; + break; + case 1: + if (!sub_80CDCAC()) + { + if (sInPartyMenu) + SetPSSCallback(sub_80C9670); + else + SetPSSCallback(sub_80C82AC); + } + break; + } +} + +void sub_80C8BEC(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + sub_80CDC38(1); + gUnknown_02039D08->state++; + break; + case 1: + if (!sub_80CDCAC()) + { + if (sInPartyMenu) + SetPSSCallback(sub_80C9670); + else + SetPSSCallback(sub_80C82AC); + } + break; + } +} + +void c3_0808DC50(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + sub_80CDC38(2); + gUnknown_02039D08->state++; + break; + case 1: + if (!sub_80CDCAC()) + { + BoxSetMosaic(); + SetPSSCallback(sub_80C82AC); + } + break; + } +} + +void Cb_WithdrawMon(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + if (CalculatePlayerPartyCount() == PARTY_SIZE) + { + PrintStorageActionText(PC_TEXT_PARTY_FULL); + gUnknown_02039D08->state = 1; + } + else + { + sub_80CDC18(); + sub_80CDC38(0); + gUnknown_02039D08->state = 2; + } + break; + case 1: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + SetPSSCallback(sub_80C82AC); + } + break; + case 2: + if (!sub_80CDCAC()) + { + sub_80CC0D4(1); + sub_80CAB4C(); + gUnknown_02039D08->state++; + } + break; + case 3: + if (!sub_80CAB70()) + { + sub_80CDC38(1); + gUnknown_02039D08->state++; + } + break; + case 4: + if (!sub_80CDCAC()) + { + sub_80CAB20(); + gUnknown_02039D08->state++; + } + break; + case 5: + SetPSSCallback(sub_80C87E8); + break; + } +} + +void sub_80C8D78(u8 taskId) +{ + u8 r4; + + switch (gUnknown_02039D08->state) + { + case 0: + PrintStorageActionText(PC_TEXT_DEPOSIT_IN_WHICH_BOX); + sub_80C77E8(&gUnknown_02039D08->field_1E5C, 10, 0xDAC7, 3, FALSE); + sub_80C78D4(gUnknown_02039D0E); + gUnknown_02039D08->state++; + break; + case 1: + r4 = sub_80C78F0(); + if (r4 == 200); + else if (r4 == 201) + { + ClearBottomWindow(); + sub_80C78E4(); + sub_80C7890(); + SetPSSCallback(sub_80C82AC); + } + else + { + if (sub_80CE19C(r4)) + { + gUnknown_02039D0E = r4; + ClearBottomWindow(); + sub_80C78E4(); + sub_80C7890(); + gUnknown_02039D08->state = 2; + } + else + { + PrintStorageActionText(PC_TEXT_BOX_IS_FULL); + gUnknown_02039D08->state = 4; + } + } + break; + case 2: + CompactPartySlots(); + sub_80CB950(); + gUnknown_02039D08->state++; + break; + case 3: + if (!sub_80CB9BC()) + { + sub_80CE22C(); + BoxSetMosaic(); + sub_80CAB20(); + SetPSSCallback(sub_80C82AC); + } + break; + case 4: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + PrintStorageActionText(PC_TEXT_DEPOSIT_IN_WHICH_BOX); + gUnknown_02039D08->state = 1; + } + break; + } +} + +void Cb_ReleaseMon(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + PrintStorageActionText(PC_TEXT_RELEASE_POKE); + sub_80CAD9C(1); + gUnknown_02039D08->state++; + // fallthrough + case 1: + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case -1: + case 1: + ClearBottomWindow(); + SetPSSCallback(sub_80C82AC); + break; + case 0: + ClearBottomWindow(); + sub_80CE3A0(); + sub_80CE250(); + gUnknown_02039D08->state++; + break; + } + break; + case 2: + sub_80CE580(); + if (!sub_80CE2A8()) + { + while (1) + { + s8 r0 = sub_80CE580(); + if (r0 == 1) + { + gUnknown_02039D08->state++; + break; + } + if (r0 == 0) + { + gUnknown_02039D08->state = 8; + break; + } + } + } + break; + case 3: + sub_80CE2D8(); + sub_80CA230(); + PrintStorageActionText(PC_TEXT_WAS_RELEASED); + gUnknown_02039D08->state++; + break; + case 4: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + PrintStorageActionText(PC_TEXT_BYE_BYE); + gUnknown_02039D08->state++; + } + break; + case 5: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + if (sInPartyMenu) + { + CompactPartySlots(); + sub_80CB950(); + gUnknown_02039D08->state++; + } + else + { + gUnknown_02039D08->state = 7; + } + } + break; + case 6: + if (!sub_80CB9BC()) + { + sub_80CE00C(); + BoxSetMosaic(); + sub_80CAB20(); + gUnknown_02039D08->state++; + } + break; + case 7: + SetPSSCallback(sub_80C82AC); + break; + case 8: + PrintStorageActionText(PC_TEXT_WAS_RELEASED); + gUnknown_02039D08->state++; + break; + case 9: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + PrintStorageActionText(PC_TEXT_SURPRISE); + gUnknown_02039D08->state++; + } + break; + case 10: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + sub_80CC064(); + gUnknown_02039D08->state++; + } + break; + case 11: + if (!sub_80CC0A0()) + { + sub_80CE324(); + PrintStorageActionText(PC_TEXT_CAME_BACK); + gUnknown_02039D08->state++; + } + break; + case 12: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + PrintStorageActionText(PC_TEXT_WORRIED); + gUnknown_02039D08->state++; + } + break; + case 13: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + SetPSSCallback(sub_80C82AC); + } + break; + } +} + +void sub_80C90A4(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + PrintStorageActionText(PC_TEXT_MARK_POKE); + gUnknown_02039D08->field_DA4.markings = gUnknown_02039D08->field_CEB; + sub_811FAA4(gUnknown_02039D08->field_CEB, 0xb0, 0x10); + gUnknown_02039D08->state++; + break; + case 1: + if (!sub_811FBA4()) + { + sub_811FAF8(); + ClearBottomWindow(); + sub_80CE9A8(gUnknown_02039D08->field_DA4.markings); + sub_80CA230(); + SetPSSCallback(sub_80C82AC); + } + break; + } +} + +void sub_80C9128(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + if (!ItemIsMail(gUnknown_02039D08->selectedItem)) + { + ClearBottomWindow(); + gUnknown_02039D08->state++; + } + else + { + SetPSSCallback(Cb_PrintCantStoreMail); + } + break; + case 1: + sub_80CFE54(2); + sub_80D0E90((sInPartyMenu != FALSE), GetBoxCursorPosition()); + gUnknown_02039D08->state++; + break; + case 2: + if (!sub_80D1218()) + { + sub_80CFE54(3); + ClearBottomWindow(); + sub_80CE00C(); + sub_80CA4FC(); + gUnknown_02039D08->state++; + } + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + SetPSSCallback(sub_80C82AC); + break; + } +} + +void sub_80C91DC(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + ClearBottomWindow(); + gUnknown_02039D08->state++; + break; + case 1: + sub_80CFE54(2); + sub_80D1080((sInPartyMenu != FALSE), GetBoxCursorPosition()); + gUnknown_02039D08->state++; + break; + case 2: + if (!sub_80D1218()) + { + sub_80CFE54(0); + sub_80CE00C(); + sub_80CA4FC(); + PrintStorageActionText(PC_TEXT_ITEM_IS_HELD); + gUnknown_02039D08->state++; + } + break; + case 3: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + gUnknown_02039D08->state++; + } + break; + case 4: + if (!IsDma3ManagerBusyWithBgCopy()) + SetPSSCallback(sub_80C82AC); + break; + } +} + +void Cb_ItemToBag(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + if (!AddBagItem(gUnknown_02039D08->selectedItem, 1)) + { + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_BAG_FULL); + gUnknown_02039D08->state = 3; + } + else + { + PlaySE(SE_SELECT); + sub_80D1114((sInPartyMenu != FALSE), GetBoxCursorPosition()); + gUnknown_02039D08->state = 1; + } + break; + case 1: + if (!sub_80D1218()) + { + PrintStorageActionText(PC_TEXT_PLACED_IN_BAG); + gUnknown_02039D08->state = 2; + } + break; + case 2: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + sub_80CE00C(); + sub_80CA4FC(); + gUnknown_02039D08->state = 4; + } + break; + case 4: + if (!IsDma3ManagerBusyWithBgCopy()) + SetPSSCallback(sub_80C82AC); + break; + case 3: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + SetPSSCallback(sub_80C82AC); + } + break; + } +} + +void Cb_SwitchSelectedItem(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + if (!ItemIsMail(gUnknown_02039D08->selectedItem)) + { + ClearBottomWindow(); + gUnknown_02039D08->state++; + } + else + { + SetPSSCallback(Cb_PrintCantStoreMail); + } + break; + case 1: + sub_80CFE54(2); + sub_80D0FAC((sInPartyMenu != FALSE), GetBoxCursorPosition()); + gUnknown_02039D08->state++; + break; + case 2: + if (!sub_80D1218()) + { + sub_80CFE54(3); + sub_80CE00C(); + sub_80CA4FC(); + PrintStorageActionText(PC_TEXT_CHANGED_TO_ITEM); + gUnknown_02039D08->state++; + } + break; + case 3: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + gUnknown_02039D08->state++; + } + break; + case 4: + if (!IsDma3ManagerBusyWithBgCopy()) + SetPSSCallback(sub_80C82AC); + break; + } +} + +void sub_80C9498(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + ClearBottomWindow(); + gUnknown_02039D08->state++; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + { + PlaySE(SE_WIN_OPEN); + sub_80D17B4(); + sub_80D1818(); + gUnknown_02039D08->state++; + } + break; + case 2: + if (!sub_80D184C()) + gUnknown_02039D08->state++; + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + gUnknown_02039D08->state++; + break; + case 4: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + PlaySE(SE_WIN_OPEN); + gUnknown_02039D08->state++; + } + break; + case 5: + if (!sub_80D18E4()) + gUnknown_02039D08->state++; + break; + case 6: + if (!IsDma3ManagerBusyWithBgCopy()) + SetPSSCallback(sub_80C82AC); + break; + } +} + +void sub_80C954C(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + PlaySE(SE_SELECT); + PrintStorageActionText(PC_TEXT_PUT_IN_BAG); + sub_80CAD9C(0); + gUnknown_02039D08->state = 1; + break; + case 1: + switch (Menu_ProcessInputNoWrapClearOnChoose()) + { + case -1: + case 1: + ClearBottomWindow(); + SetPSSCallback(sub_80C82AC); + break; + case 0: + if (AddBagItem(gUnknown_02039D08->field_2234, 1) == TRUE) + { + ClearBottomWindow(); + gUnknown_02039D08->state = 3; + } + else + { + PrintStorageActionText(PC_TEXT_BAG_FULL); + gUnknown_02039D08->state = 2; + } + break; + } + break; + case 2: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + gUnknown_02039D08->state = 5; + } + break; + case 3: + sub_80D1194(); + gUnknown_02039D08->state = 4; + break; + case 4: + if (!sub_80D1218()) + { + sub_80CFE54(0); + SetPSSCallback(sub_80C82AC); + } + break; + case 5: + if (!IsDma3ManagerBusyWithBgCopy()) + SetPSSCallback(sub_80C82AC); + break; + } +} + +void sub_80C9670(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + CompactPartySlots(); + sub_80CB950(); + gUnknown_02039D08->state++; + break; + case 1: + if (!sub_80CB9BC()) + { + sub_80CAB20(); + SetPSSCallback(sub_80C82AC); + } + break; + } +} + +void Cb_PrintCantStoreMail(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + PrintStorageActionText(PC_TEXT_CANT_STORE_MAIL); + gUnknown_02039D08->state++; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + gUnknown_02039D08->state++; + break; + case 2: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + ClearBottomWindow(); + gUnknown_02039D08->state++; + } + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + SetPSSCallback(sub_80C82AC); + break; + } +} + +void Cb_HandleBoxOptions(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + PrintStorageActionText(PC_TEXT_WHAT_YOU_DO); + sub_80CFFD0(); + gUnknown_02039D08->state++; + break; + case 1: + if (sub_80D00A8()) + return; + gUnknown_02039D08->state++; + case 2: + switch (sub_80D00AC()) + { + case -1: + case 0: + sub_80CD1A8(TRUE); + ClearBottomWindow(); + SetPSSCallback(sub_80C82AC); + 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; + } +} + +void Cb_HandleWallpapers(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + sub_80CADD8(); + PrintStorageActionText(PC_TEXT_PICK_A_THEME); + gUnknown_02039D08->state++; + break; + case 1: + if (!sub_80D00A8()) + gUnknown_02039D08->state++; + break; + case 2: + gUnknown_02039D08->wallpaperSetId = sub_80D00AC(); + switch (gUnknown_02039D08->wallpaperSetId) + { + case -1: + sub_80CD1A8(TRUE); + ClearBottomWindow(); + SetPSSCallback(sub_80C82AC); + break; + case 18 ... 21: + PlaySE(SE_SELECT); + sub_80D013C(); + gUnknown_02039D08->wallpaperSetId -= 18; + gUnknown_02039D08->state++; + break; + // New wallpaper from Walda. + case 22: + PlaySE(SE_SELECT); + gUnknown_02039D08->wallpaperId = 16; + sub_80D013C(); + ClearBottomWindow(); + gUnknown_02039D08->state = 6; + break; + } + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + { + sub_80CAE0C(gUnknown_02039D08->wallpaperSetId); + PrintStorageActionText(PC_TEXT_PICK_A_WALLPAPER); + gUnknown_02039D08->state++; + } + break; + case 4: + gUnknown_02039D08->wallpaperId = sub_80D00AC(); + switch (gUnknown_02039D08->wallpaperId) + { + case -2: + break; + case -1: + ClearBottomWindow(); + gUnknown_02039D08->state = 0; + break; + default: + PlaySE(SE_SELECT); + ClearBottomWindow(); + gUnknown_02039D08->wallpaperId -= 23; + SetWallpaperForCurrentBox(gUnknown_02039D08->wallpaperId); + gUnknown_02039D08->state++; + break; + } + break; + case 5: + if (!DoWallpaperGfxChange()) + { + sub_80CD1A8(TRUE); + SetPSSCallback(sub_80C82AC); + } + break; + case 6: + if (!IsDma3ManagerBusyWithBgCopy()) + { + SetWallpaperForCurrentBox(gUnknown_02039D08->wallpaperId); + gUnknown_02039D08->state = 5; + } + break; + } +} + +void Cb_JumpBox(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + PrintStorageActionText(PC_TEXT_JUMP_TO_WHICH_BOX); + sub_80C77E8(&gUnknown_02039D08->field_1E5C, 10, 0xDAC7, 3, FALSE); + sub_80C78D4(StorageGetCurrentBox()); + gUnknown_02039D08->state++; + break; + case 1: + gUnknown_02039D08->newCurrBoxId = sub_80C78F0(); + switch (gUnknown_02039D08->newCurrBoxId) + { + case 200: + break; + default: + ClearBottomWindow(); + sub_80C78E4(); + sub_80C7890(); + if (gUnknown_02039D08->newCurrBoxId == 201 || gUnknown_02039D08->newCurrBoxId == StorageGetCurrentBox()) + { + sub_80CD1A8(TRUE); + SetPSSCallback(sub_80C82AC); + } + else + { + gUnknown_02039D08->state++; + } + break; + } + break; + case 2: + sub_80CC464(gUnknown_02039D08->newCurrBoxId); + gUnknown_02039D08->state++; + break; + case 3: + if (!ScrollToBox()) + { + SetCurrentBox(gUnknown_02039D08->newCurrBoxId); + SetPSSCallback(sub_80C82AC); + } + break; + } +} + +void Cb_NameBox(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + sub_80CE760(); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gUnknown_02039D08->state++; + break; + case 1: + if (!UpdatePaletteFade()) + { + gUnknown_02039D0F = 1; + gUnknown_02039D08->unk_0002 = 2; + SetPSSCallback(sub_80C9E50); } break; } } -*/