From e0f3de0b7483afe2b751ea9fb8204e7da49a371b Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 9 Dec 2018 16:44:01 +0100 Subject: [PATCH 01/13] Start pokemon storage system --- asm/pokemon_storage_system.s | 1124 ++++++++---------------------- data/pokemon_storage_system.s | 122 ---- include/mon_markings.h | 2 + include/pokemon_storage_system.h | 26 +- include/strings.h | 32 + src/mon_markings.c | 1 - src/pokemon_storage_system.c | 743 +++++++++++++++++++- sym_ewram.txt | 16 +- 8 files changed, 1084 insertions(+), 982 deletions(-) diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index 3fefdd530..f57b8fc9a 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -8,576 +8,6 @@ - - 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} @@ -670,7 +100,7 @@ _080C8398: cmp r0, 0x1 bls _080C83BC movs r0, 0x10 - bl sub_80CAC58 + bl PrintStorageActionText ldr r1, [r4] movs r0, 0x3 strb r0, [r1] @@ -679,7 +109,7 @@ _080C8398: _080C83BC: bl sub_80CDC0C ldr r0, =sub_80C87A8 - bl add_to_c3_somehow + bl SetPSSCallback b _080C879E .pool _080C83CC: @@ -688,7 +118,7 @@ _080C83CC: ldrb r0, [r0, 0x1] cmp r0, 0x2 bne _080C8400 - bl sub_80CEAD0 + bl IsMonBeingMoved lsls r0, 24 cmp r0, 0 beq _080C8406 @@ -710,29 +140,29 @@ _080C8400: b _080C879E _080C8406: ldr r0, =sub_80C87E8 - bl add_to_c3_somehow + bl SetPSSCallback b _080C879E .pool _080C8414: ldr r0, =sub_80C9BE8 - bl add_to_c3_somehow + bl SetPSSCallback b _080C879E .pool _080C8420: ldr r0, =sub_80C9D1C - bl add_to_c3_somehow + bl SetPSSCallback b _080C879E .pool _080C842C: movs r0, 0x5 bl PlaySE ldr r0, =box_related - bl add_to_c3_somehow + bl SetPSSCallback b _080C879E .pool _080C8440: ldr r0, =sub_80C8864 - bl add_to_c3_somehow + bl SetPSSCallback b _080C879E .pool _080C844C: @@ -790,7 +220,7 @@ _080C84BC: strb r0, [r1] b _080C879E _080C84C8: - bl sub_80CEA30 + bl CanMoveMon lsls r0, 24 cmp r0, 0 bne _080C8528 @@ -813,11 +243,11 @@ _080C84F8: movs r0, 0x5 bl PlaySE ldr r0, =sub_80C8D78 - bl add_to_c3_somehow + bl SetPSSCallback b _080C879E .pool _080C850C: - bl sub_80CEA30 + bl CanMoveMon lsls r0, 24 cmp r0, 0 bne _080C8528 @@ -825,7 +255,7 @@ _080C850C: bl PlaySE b _080C872C _080C851E: - bl sub_80CEA6C + bl CanShifMon lsls r0, 24 cmp r0, 0 bne _080C8538 @@ -840,42 +270,42 @@ _080C8538: movs r0, 0x5 bl PlaySE ldr r0, =c3_0808DC50 - bl add_to_c3_somehow + bl SetPSSCallback b _080C879E .pool _080C854C: movs r0, 0x5 bl PlaySE ldr r0, =sub_80C8C90 - bl add_to_c3_somehow + bl SetPSSCallback b _080C879E .pool _080C8560: movs r0, 0x5 bl PlaySE ldr r0, =sub_80C8BEC - bl add_to_c3_somehow + bl SetPSSCallback b _080C879E .pool _080C8574: movs r0, 0x5 bl PlaySE ldr r0, =sub_80C9128 - bl add_to_c3_somehow + bl SetPSSCallback b _080C879E .pool _080C8588: movs r0, 0x5 bl PlaySE ldr r0, =sub_80C91DC - bl add_to_c3_somehow + bl SetPSSCallback b _080C879E .pool _080C859C: movs r0, 0x5 bl PlaySE ldr r0, =sub_80C93B0 - bl add_to_c3_somehow + bl SetPSSCallback b _080C879E .pool _080C85B0: @@ -935,7 +365,7 @@ _080C861C: beq _080C8628 b _080C879E _080C8628: - bl sub_80CEAF8 + bl IsCursorOnCloseBox lsls r0, 24 cmp r0, 0 beq _080C8638 @@ -969,11 +399,11 @@ _080C8668: adds r0, r1 ldrb r0, [r0] bl SetCurrentBox - ldr r0, =gUnknown_02039D0C + ldr r0, =sInPartyMenu ldrb r0, [r0] cmp r0, 0 bne _080C8690 - bl sub_80CEAD0 + bl IsMonBeingMoved lsls r0, 24 cmp r0, 0 bne _080C8690 @@ -1016,7 +446,7 @@ _080C86E2: bl PlaySE movs r0, 0x16 _080C86EA: - bl sub_80CAC58 + bl PrintStorageActionText ldr r0, =gUnknown_02039D08 ldr r1, [r0] movs r0, 0x6 @@ -1032,7 +462,7 @@ _080C86FC: beq _080C879E bl sub_80CADC4 ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback b _080C879E .pool _080C871C: @@ -1045,7 +475,7 @@ _080C8722: bne _080C879E _080C872C: ldr r0, =sub_80C8B90 - bl add_to_c3_somehow + bl SetPSSCallback b _080C879E .pool _080C8738: @@ -1126,7 +556,7 @@ _080C87CE: cmp r0, 0 bne _080C87DE ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback _080C87DE: pop {r4} pop {r0} @@ -1186,7 +616,7 @@ _080C8836: bl BoxSetMosaic _080C8850: ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback _080C8856: pop {r4} pop {r0} @@ -1234,7 +664,7 @@ _080C88AC: cmp r0, 0x3 beq _080C88C8 movs r0, 0x4 - bl sub_80CAC58 + bl PrintStorageActionText b _080C88F2 .pool _080C88C8: @@ -1250,12 +680,12 @@ _080C88C8: beq _080C88EC _080C88DE: movs r0, 0x17 - bl sub_80CAC58 + bl PrintStorageActionText b _080C88F2 .pool _080C88EC: movs r0, 0x18 - bl sub_80CAC58 + bl PrintStorageActionText _080C88F2: bl sub_80CFFD0 ldr r0, =gUnknown_02039D08 @@ -1316,11 +746,11 @@ _080C8940: _080C898C: bl sub_80CADC4 ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback b _080C8B82 .pool _080C899C: - bl sub_80CEA30 + bl CanMoveMon lsls r0, 24 cmp r0, 0 bne _080C8A52 @@ -1328,7 +758,7 @@ _080C899C: bl PlaySE bl sub_80CADC4 ldr r0, =sub_80C8B90 - bl add_to_c3_somehow + bl SetPSSCallback b _080C8B82 .pool _080C89BC: @@ -1336,11 +766,11 @@ _080C89BC: bl PlaySE bl sub_80CADC4 ldr r0, =sub_80C8BEC - bl add_to_c3_somehow + bl SetPSSCallback b _080C8B82 .pool _080C89D4: - bl sub_80CEA6C + bl CanShifMon lsls r0, 24 cmp r0, 0 beq _080C8A52 @@ -1348,7 +778,7 @@ _080C89D4: bl PlaySE bl sub_80CADC4 ldr r0, =c3_0808DC50 - bl add_to_c3_somehow + bl SetPSSCallback b _080C8B82 .pool _080C89F4: @@ -1356,11 +786,11 @@ _080C89F4: bl PlaySE bl sub_80CADC4 ldr r0, =sub_80C8C90 - bl add_to_c3_somehow + bl SetPSSCallback b _080C8B82 .pool _080C8A0C: - bl sub_80CEA30 + bl CanMoveMon lsls r0, 24 cmp r0, 0 bne _080C8A52 @@ -1377,11 +807,11 @@ _080C8A0C: bl PlaySE bl sub_80CADC4 ldr r0, =sub_80C8D78 - bl add_to_c3_somehow + bl SetPSSCallback b _080C8B82 .pool _080C8A48: - bl sub_80CEA30 + bl CanMoveMon lsls r0, 24 cmp r0, 0 beq _080C8A60 @@ -1422,59 +852,59 @@ _080C8A98: movs r0, 0x5 bl PlaySE ldr r0, =sub_80C8EB4 - bl add_to_c3_somehow + bl SetPSSCallback b _080C8B82 .pool _080C8AAC: movs r0, 0x5 bl PlaySE ldr r0, =sub_80C9B28 - bl add_to_c3_somehow + bl SetPSSCallback b _080C8B82 .pool _080C8AC0: movs r0, 0x5 bl PlaySE ldr r0, =sub_80C90A4 - bl add_to_c3_somehow + bl SetPSSCallback b _080C8B82 .pool _080C8AD4: movs r0, 0x5 bl PlaySE ldr r0, =sub_80C9128 - bl add_to_c3_somehow + bl SetPSSCallback b _080C8B82 .pool _080C8AE8: movs r0, 0x5 bl PlaySE ldr r0, =sub_80C91DC - bl add_to_c3_somehow + bl SetPSSCallback b _080C8B82 .pool _080C8AFC: ldr r0, =sub_80C9298 - bl add_to_c3_somehow + bl SetPSSCallback b _080C8B82 .pool _080C8B08: movs r0, 0x5 bl PlaySE ldr r0, =sub_80C93B0 - bl add_to_c3_somehow + bl SetPSSCallback b _080C8B82 .pool _080C8B1C: movs r0, 0x5 bl PlaySE ldr r0, =sub_80C9B88 - bl add_to_c3_somehow + bl SetPSSCallback b _080C8B82 .pool _080C8B30: ldr r0, =sub_80C9498 - bl add_to_c3_somehow + bl SetPSSCallback b _080C8B82 .pool _080C8B3C: @@ -1492,7 +922,7 @@ _080C8B50: bl PlaySE movs r0, 0x16 _080C8B58: - bl sub_80CAC58 + bl PrintStorageActionText ldr r0, =gUnknown_02039D08 ldr r1, [r0] movs r0, 0x6 @@ -1508,7 +938,7 @@ _080C8B6C: beq _080C8B82 bl sub_80CADC4 ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback _080C8B82: pop {r4} pop {r0} @@ -1541,17 +971,17 @@ _080C8BB8: lsls r0, 24 cmp r0, 0 bne _080C8BE2 - ldr r0, =gUnknown_02039D0C + ldr r0, =sInPartyMenu ldrb r0, [r0] cmp r0, 0 beq _080C8BDC ldr r0, =sub_80C9670 - bl add_to_c3_somehow + bl SetPSSCallback b _080C8BE2 .pool _080C8BDC: ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback _080C8BE2: pop {r4} pop {r0} @@ -1584,17 +1014,17 @@ _080C8C14: lsls r0, 24 cmp r0, 0 bne _080C8C3E - ldr r0, =gUnknown_02039D0C + ldr r0, =sInPartyMenu ldrb r0, [r0] cmp r0, 0 beq _080C8C38 ldr r0, =sub_80C9670 - bl add_to_c3_somehow + bl SetPSSCallback b _080C8C3E .pool _080C8C38: ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback _080C8C3E: pop {r4} pop {r0} @@ -1629,7 +1059,7 @@ _080C8C70: bne _080C8C84 bl BoxSetMosaic ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback _080C8C84: pop {r4} pop {r0} @@ -1666,7 +1096,7 @@ _080C8CC8: cmp r0, 0x6 bne _080C8CE8 movs r0, 0xE - bl sub_80CAC58 + bl PrintStorageActionText ldr r0, =gUnknown_02039D08 ldr r1, [r0] movs r0, 0x1 @@ -1692,7 +1122,7 @@ _080C8D00: beq _080C8D6E bl sub_80CADC4 ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback b _080C8D6E .pool _080C8D20: @@ -1728,7 +1158,7 @@ _080C8D56: .pool _080C8D68: ldr r0, =sub_80C87E8 - bl add_to_c3_somehow + bl SetPSSCallback _080C8D6E: pop {r0} bx r0 @@ -1761,7 +1191,7 @@ _080C8D9C: .4byte _080C8E88 _080C8DB0: movs r0, 0x6 - bl sub_80CAC58 + bl PrintStorageActionText ldr r4, =gUnknown_02039D08 ldr r0, [r4] ldr r1, =0x00001e5c @@ -1811,7 +1241,7 @@ _080C8E0C: .pool _080C8E38: movs r0, 0x8 - bl sub_80CAC58 + bl PrintStorageActionText ldr r0, =gUnknown_02039D08 ldr r1, [r0] movs r0, 0x4 @@ -1836,7 +1266,7 @@ _080C8E64: bl sub_80CAB20 _080C8E7A: ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback b _080C8EA2 .pool _080C8E88: @@ -1847,7 +1277,7 @@ _080C8E88: cmp r0, 0 beq _080C8EA2 movs r0, 0x6 - bl sub_80CAC58 + bl PrintStorageActionText ldr r0, =gUnknown_02039D08 ldr r1, [r0] movs r0, 0x1 @@ -1895,7 +1325,7 @@ _080C8ED4: .4byte _080C9080 _080C8F0C: movs r0, 0x9 - bl sub_80CAC58 + bl PrintStorageActionText movs r0, 0x1 bl sub_80CAD9C ldr r0, =gUnknown_02039D08 @@ -1974,7 +1404,7 @@ _080C8FA4: cmp r0, 0 beq _080C9096 bl sub_80CADC4 - ldr r0, =gUnknown_02039D0C + ldr r0, =sInPartyMenu ldrb r0, [r0] cmp r0, 0 beq _080C8FD0 @@ -2000,7 +1430,7 @@ _080C8FE0: b _080C905C _080C8FF8: ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback b _080C9096 .pool _080C9004: @@ -2044,7 +1474,7 @@ _080C904A: beq _080C9096 movs r0, 0x14 _080C9058: - bl sub_80CAC58 + bl PrintStorageActionText _080C905C: ldr r0, =gUnknown_02039D08 ldr r1, [r0] @@ -2069,7 +1499,7 @@ _080C9080: beq _080C9096 bl sub_80CADC4 ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback _080C9096: pop {r0} bx r0 @@ -2090,7 +1520,7 @@ sub_80C90A4: @ 80C90A4 .pool _080C90BC: movs r0, 0xC - bl sub_80CAC58 + bl PrintStorageActionText ldr r0, [r4] ldr r2, =0x00000ceb adds r1, r0, r2 @@ -2124,7 +1554,7 @@ _080C90F0: bl sub_80CE9A8 bl sub_80CA230 ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback _080C9118: pop {r4} pop {r0} @@ -2165,13 +1595,13 @@ _080C914E: .pool _080C9168: ldr r0, =sub_80C96B8 - bl add_to_c3_somehow + bl SetPSSCallback b _080C91D2 .pool _080C9174: movs r0, 0x2 bl sub_80CFE54 - ldr r0, =gUnknown_02039D0C + ldr r0, =sInPartyMenu ldrb r0, [r0] negs r4, r0 orrs r4, r0 @@ -2206,7 +1636,7 @@ _080C91C2: cmp r0, 0 bne _080C91D2 ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback _080C91D2: pop {r4,r5} pop {r0} @@ -2238,7 +1668,7 @@ _080C91FC: _080C9210: movs r0, 0x2 bl sub_80CFE54 - ldr r0, =gUnknown_02039D0C + ldr r0, =sInPartyMenu ldrb r0, [r0] negs r4, r0 orrs r4, r0 @@ -2261,7 +1691,7 @@ _080C9238: bl sub_80CE00C bl sub_80CA4FC movs r0, 0x1C - bl sub_80CAC58 + bl PrintStorageActionText b _080C9268 _080C9258: ldr r0, =gMain @@ -2286,7 +1716,7 @@ _080C927C: cmp r0, 0 bne _080C928C ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback _080C928C: pop {r4} pop {r0} @@ -2331,7 +1761,7 @@ _080C92D0: movs r0, 0x20 bl PlaySE movs r0, 0x1A - bl sub_80CAC58 + bl PrintStorageActionText ldr r1, [r5] movs r0, 0x3 strb r0, [r1] @@ -2340,7 +1770,7 @@ _080C92D0: _080C92FC: movs r0, 0x5 bl PlaySE - ldr r0, =gUnknown_02039D0C + ldr r0, =sInPartyMenu ldrb r0, [r0] negs r4, r0 orrs r4, r0 @@ -2362,7 +1792,7 @@ _080C9328: cmp r0, 0 bne _080C93A2 movs r0, 0x19 - bl sub_80CAC58 + bl PrintStorageActionText ldr r0, =gUnknown_02039D08 ldr r1, [r0] movs r0, 0x2 @@ -2391,7 +1821,7 @@ _080C9374: cmp r0, 0 bne _080C93A2 ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback b _080C93A2 .pool _080C938C: @@ -2403,7 +1833,7 @@ _080C938C: beq _080C93A2 bl sub_80CADC4 ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback _080C93A2: pop {r4,r5} pop {r0} @@ -2448,13 +1878,13 @@ _080C93E4: .pool _080C9404: ldr r0, =sub_80C96B8 - bl add_to_c3_somehow + bl SetPSSCallback b _080C948C .pool _080C9410: movs r0, 0x2 bl sub_80CFE54 - ldr r0, =gUnknown_02039D0C + ldr r0, =sInPartyMenu ldrb r0, [r0] negs r4, r0 orrs r4, r0 @@ -2477,7 +1907,7 @@ _080C9438: bl sub_80CE00C bl sub_80CA4FC movs r0, 0x1D - bl sub_80CAC58 + bl PrintStorageActionText b _080C9468 _080C9458: ldr r0, =gMain @@ -2502,7 +1932,7 @@ _080C947C: cmp r0, 0 bne _080C948C ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback _080C948C: pop {r4} pop {r0} @@ -2583,7 +2013,7 @@ _080C9534: cmp r0, 0 bne _080C9544 ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback _080C9544: pop {r0} bx r0 @@ -2618,7 +2048,7 @@ _080C9584: movs r0, 0x5 bl PlaySE movs r0, 0x1B - bl sub_80CAC58 + bl PrintStorageActionText movs r0, 0 bl sub_80CAD9C ldr r0, =gUnknown_02039D08 @@ -2666,7 +2096,7 @@ _080C95C8: .pool _080C95F4: movs r0, 0x1A - bl sub_80CAC58 + bl PrintStorageActionText ldr r1, [r4] movs r0, 0x2 strb r0, [r1] @@ -2702,7 +2132,7 @@ _080C9638: bl sub_80CFE54 _080C9648: ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback b _080C9664 .pool _080C9654: @@ -2711,7 +2141,7 @@ _080C9654: cmp r0, 0 bne _080C9664 ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback _080C9664: pop {r4} pop {r0} @@ -2746,7 +2176,7 @@ _080C969A: bne _080C96AE bl sub_80CAB20 ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback _080C96AE: pop {r4} pop {r0} @@ -2776,7 +2206,7 @@ _080C96D4: b _080C9720 _080C96DE: movs r0, 0x1E - bl sub_80CAC58 + bl PrintStorageActionText b _080C9702 _080C96E6: bl IsDma3ManagerBusyWithBgCopy @@ -2805,7 +2235,7 @@ _080C9710: cmp r0, 0 bne _080C9720 ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback _080C9720: pop {r4} pop {r0} @@ -2833,7 +2263,7 @@ _080C9748: b _080C9818 _080C974E: movs r0, 0x1 - bl sub_80CAC58 + bl PrintStorageActionText bl sub_80CFFD0 ldr r1, [r4] ldrb r0, [r1] @@ -2882,14 +2312,14 @@ _080C97C4: bl sub_80CD1A8 bl sub_80CADC4 ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback b _080C9818 .pool _080C97DC: movs r0, 0x5 bl PlaySE ldr r0, =sub_80C9AC8 - bl add_to_c3_somehow + bl SetPSSCallback b _080C9818 .pool _080C97F0: @@ -2897,7 +2327,7 @@ _080C97F0: bl PlaySE bl sub_80CADC4 ldr r0, =sub_80C9824 - bl add_to_c3_somehow + bl SetPSSCallback b _080C9818 .pool _080C9808: @@ -2905,7 +2335,7 @@ _080C9808: bl PlaySE bl sub_80CADC4 ldr r0, =sub_80C99D8 - bl add_to_c3_somehow + bl SetPSSCallback _080C9818: pop {r4} pop {r0} @@ -2941,7 +2371,7 @@ _080C9844: _080C9860: bl sub_80CADD8 movs r0, 0x2 - bl sub_80CAC58 + bl PrintStorageActionText ldr r0, =gUnknown_02039D08 ldr r1, [r0] ldrb r0, [r1] @@ -3027,7 +2457,7 @@ _080C990C: ldrb r0, [r0] bl sub_80CAE0C movs r0, 0x3 - bl sub_80CAC58 + bl PrintStorageActionText ldr r1, [r4] ldrb r0, [r1] adds r0, 0x1 @@ -3080,7 +2510,7 @@ _080C9990: bl sub_80CD1A8 _080C99A0: ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback b _080C99CC .pool _080C99AC: @@ -3129,7 +2559,7 @@ _080C99F4: b _080C9AB8 _080C99FE: movs r0, 0x5 - bl sub_80CAC58 + bl PrintStorageActionText ldr r0, [r5] ldr r1, =0x00001e5c adds r0, r1 @@ -3176,7 +2606,7 @@ _080C9A6C: movs r0, 0x1 bl sub_80CD1A8 ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback b _080C9AB8 .pool _080C9A84: @@ -3202,7 +2632,7 @@ _080C9A9C: ldrb r0, [r0] bl SetCurrentBox ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback _080C9AB8: add sp, 0x4 pop {r4,r5} @@ -3249,7 +2679,7 @@ _080C9AFE: movs r0, 0x2 strb r0, [r1, 0x2] ldr r0, =sub_80C9E50 - bl add_to_c3_somehow + bl SetPSSCallback _080C9B18: add sp, 0x4 pop {r4,r5} @@ -3296,7 +2726,7 @@ _080C9B5E: ldr r0, [r5] strb r4, [r0, 0x2] ldr r0, =sub_80C9E50 - bl add_to_c3_somehow + bl SetPSSCallback _080C9B78: add sp, 0x4 pop {r4,r5} @@ -3343,7 +2773,7 @@ _080C9BBA: movs r0, 0x3 strb r0, [r1, 0x2] ldr r0, =sub_80C9E50 - bl add_to_c3_somehow + bl SetPSSCallback _080C9BD6: add sp, 0x4 pop {r4} @@ -3376,14 +2806,14 @@ _080C9C08: .4byte _080C9CC8 .4byte _080C9CE4 _080C9C1C: - bl sub_80CEAD0 + bl IsMonBeingMoved lsls r0, 24 cmp r0, 0 beq _080C9C40 movs r0, 0x20 bl PlaySE movs r0, 0xF - bl sub_80CAC58 + bl PrintStorageActionText ldr r0, =gUnknown_02039D08 ldr r1, [r0] movs r0, 0x1 @@ -3396,14 +2826,14 @@ _080C9C40: cmp r0, 0 beq _080C9C58 ldr r0, =sub_80C954C - bl add_to_c3_somehow + bl SetPSSCallback b _080C9D08 .pool _080C9C58: movs r0, 0x5 bl PlaySE movs r0, 0 - bl sub_80CAC58 + bl PrintStorageActionText movs r0, 0 bl sub_80CAD9C ldr r0, =gUnknown_02039D08 @@ -3440,7 +2870,7 @@ _080C9CA6: _080C9CAA: bl sub_80CADC4 ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback b _080C9D08 .pool _080C9CBC: @@ -3475,7 +2905,7 @@ _080C9CE4: ldr r0, [r0] strb r4, [r0, 0x2] ldr r0, =sub_80C9E50 - bl add_to_c3_somehow + bl SetPSSCallback _080C9D08: pop {r4} pop {r0} @@ -3507,14 +2937,14 @@ _080C9D3C: .4byte _080C9DFC .4byte _080C9E18 _080C9D50: - bl sub_80CEAD0 + bl IsMonBeingMoved lsls r0, 24 cmp r0, 0 beq _080C9D74 movs r0, 0x20 bl PlaySE movs r0, 0xF - bl sub_80CAC58 + bl PrintStorageActionText ldr r0, =gUnknown_02039D08 ldr r1, [r0] movs r0, 0x1 @@ -3527,14 +2957,14 @@ _080C9D74: cmp r0, 0 beq _080C9D8C ldr r0, =sub_80C954C - bl add_to_c3_somehow + bl SetPSSCallback b _080C9E3C .pool _080C9D8C: movs r0, 0x5 bl PlaySE movs r0, 0x12 - bl sub_80CAC58 + bl PrintStorageActionText movs r0, 0 bl sub_80CAD9C ldr r0, =gUnknown_02039D08 @@ -3572,7 +3002,7 @@ _080C9DDA: _080C9DE0: bl sub_80CADC4 ldr r0, =task_pokemon_box_related - bl add_to_c3_somehow + bl SetPSSCallback b _080C9E3C .pool _080C9DF0: @@ -3607,7 +3037,7 @@ _080C9E18: ldr r0, [r0] strb r4, [r0, 0x2] ldr r0, =sub_80C9E50 - bl add_to_c3_somehow + bl SetPSSCallback _080C9E3C: pop {r4} pop {r0} @@ -3746,7 +3176,7 @@ sub_80C9F6C: @ 80C9F6C bl sub_80CFE08 lsls r0, 24 lsrs r1, r0, 24 - ldr r0, =gUnknown_02039D0C + ldr r0, =sInPartyMenu ldrb r0, [r0] cmp r0, 0 beq _080C9FAC @@ -4627,7 +4057,7 @@ sub_80CA704: @ 80CA704 movs r2, 0 bl sub_80D2770 bl sub_80CAA74 - ldr r0, =gUnknown_02039D0C + ldr r0, =sInPartyMenu ldrb r0, [r0] cmp r0, 0 beq _080CA790 @@ -4741,7 +4171,7 @@ sub_80CA80C: @ 80CA80C b _080CA87C .pool _080CA874: - ldr r1, =gUnknown_02039D0C + ldr r1, =sInPartyMenu movs r0, 0x1 strb r0, [r1] _080CA87A: @@ -4842,7 +4272,7 @@ sub_80CA8C8: @ 80CA8C8 b _080CA976 .pool _080CA94C: - ldr r0, =gUnknown_02039D0C + ldr r0, =sInPartyMenu movs r1, 0 strb r1, [r0] bl sub_80CBB9C @@ -5226,14 +4656,14 @@ sub_80CAC1C: @ 80CAC1C bx r0 thumb_func_end sub_80CAC1C - thumb_func_start sub_80CAC58 -sub_80CAC58: @ 80CAC58 + thumb_func_start PrintStorageActionText +PrintStorageActionText: @ 80CAC58 push {r4-r6,lr} sub sp, 0xC lsls r0, 24 lsrs r6, r0, 24 bl DynamicPlaceholderTextUtil_Reset - ldr r1, =gUnknown_0857276C + ldr r1, =gPCStorageActionTexts lsls r0, r6, 3 adds r0, r1 ldrb r0, [r0, 0x4] @@ -5318,7 +4748,7 @@ _080CAD30: ldr r0, [r5] ldr r4, =0x00002190 adds r0, r4 - ldr r2, =gUnknown_0857276C + ldr r2, =gPCStorageActionTexts lsls r1, r6, 3 adds r1, r2 ldr r1, [r1] @@ -5354,7 +4784,7 @@ _080CAD30: pop {r0} bx r0 .pool - thumb_func_end sub_80CAC58 + thumb_func_end PrintStorageActionText thumb_func_start sub_80CAD9C sub_80CAD9C: @ 80CAD9C @@ -5480,7 +4910,7 @@ _080CAE96: thumb_func_start sub_80CAEA0 sub_80CAEA0: @ 80CAEA0 - ldr r0, =gUnknown_02039D0D + ldr r0, =sBoxOption ldrb r0, [r0] bx lr .pool @@ -5489,11 +4919,11 @@ sub_80CAEA0: @ 80CAEA0 thumb_func_start sub_80CAEAC sub_80CAEAC: @ 80CAEAC push {lr} - bl sub_80CEADC + bl IsCursorOnBox lsls r0, 24 cmp r0, 0 bne _080CAEE8 - ldr r0, =gUnknown_02039D0C + ldr r0, =sInPartyMenu ldrb r0, [r0] cmp r0, 0 beq _080CAED8 @@ -5609,7 +5039,7 @@ _080CAF6A: thumb_func_start sub_80CAFAC sub_80CAFAC: @ 80CAFAC push {lr} - bl sub_80CEB24 + bl IsCursorInBox lsls r0, 24 movs r1, 0x1 cmp r0, 0 @@ -9625,7 +9055,7 @@ _080CD088: lsrs r5, r0, 16 cmp r5, 0x1 bls _080CD036 - bl sub_80CEADC + bl IsCursorOnBox lsls r0, 24 cmp r0, 0 beq _080CD0A2 @@ -10000,25 +9430,25 @@ sub_80CD36C: @ 80CD36C ldrb r1, [r0, 0x1] cmp r1, 0x1 beq _080CD388 - ldr r1, =gUnknown_02039D78 + ldr r1, =sBoxCursorAction movs r0, 0 strb r0, [r1] b _080CD38C .pool _080CD388: - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction strb r1, [r0] _080CD38C: - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition movs r1, 0 strb r1, [r0] - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved strb r1, [r0] - ldr r0, =gUnknown_02039D7B + ldr r0, =sMovingMonOrigBoxId strb r1, [r0] - ldr r0, =gUnknown_02039D7C + ldr r0, =sMovingMonOrigBoxPos strb r1, [r0] - ldr r0, =gUnknown_02039D7D + ldr r0, =sCanOnlyMove strb r1, [r0] bl sub_80CDC0C bl sub_80CFC14 @@ -10055,7 +9485,7 @@ sub_80CD3EC: @ 80CD3EC ldr r1, =0x000021ff adds r0, r1 strb r2, [r0] - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] cmp r0, 0 beq _080CD426 @@ -10147,7 +9577,7 @@ _080CD4CE: movs r0, 0xC b _080CD4FA _080CD4D6: - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] movs r1, 0xE cmp r0, 0 @@ -10176,7 +9606,7 @@ _080CD4FC: thumb_func_start sub_80CD504 sub_80CD504: @ 80CD504 push {lr} - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -10184,7 +9614,7 @@ sub_80CD504: @ 80CD504 beq _080CD538 cmp r0, 0x1 bne _080CD54C - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition movs r1, 0 ldrsb r1, [r0, r1] movs r0, 0x64 @@ -10196,7 +9626,7 @@ sub_80CD504: @ 80CD504 b _080CD542 .pool _080CD538: - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition ldrb r0, [r0] movs r1, 0xB bl GetBoxMonDataFromSelectedBox @@ -10617,7 +10047,7 @@ sub_80CD894: @ 80CD894 ldrb r0, [r0] cmp r0, 0 bne _080CD8FC - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] cmp r0, 0 bne _080CD8FC @@ -10645,13 +10075,13 @@ _080CD8FC: ldrb r0, [r0, 0x1] cmp r0, 0x3 bne _080CD95C - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 cmp r0, 0 bne _080CD930 - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition ldrb r1, [r0] movs r0, 0 bl sub_80D0E50 @@ -10660,7 +10090,7 @@ _080CD8FC: _080CD930: cmp r0, 0x1 bne _080CD93E - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition ldrb r1, [r0] movs r0, 0x1 bl sub_80D0E50 @@ -10681,7 +10111,7 @@ _080CD950: _080CD95C: cmp r4, 0x1 bne _080CD988 - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -10776,13 +10206,13 @@ _080CDA28: movs r1, 0x8 orrs r0, r1 strb r0, [r2, 0x5] - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 cmp r0, 0 bne _080CDA56 - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] cmp r0, 0 beq _080CDA56 @@ -10798,14 +10228,14 @@ _080CDA56: thumb_func_start sub_80CDA68 sub_80CDA68: @ 80CDA68 push {r4,lr} - ldr r1, =gUnknown_02039D78 + ldr r1, =sBoxCursorAction ldr r4, =gUnknown_02039D08 ldr r2, [r4] ldr r3, =0x00000cd4 adds r0, r2, r3 ldrb r0, [r0] strb r0, [r1] - ldr r1, =gUnknown_02039D79 + ldr r1, =sBoxCursorPosition adds r3, 0x1 adds r0, r2, r3 ldrb r0, [r0] @@ -10818,7 +10248,7 @@ sub_80CDA68: @ 80CDA68 ldrb r0, [r0] cmp r0, 0 bne _080CDAD8 - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] cmp r0, 0 bne _080CDAD8 @@ -10842,7 +10272,7 @@ _080CDAC0: bl StartSpriteAnim _080CDAD8: bl sub_80CEB40 - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -10933,7 +10363,7 @@ _080CDB8A: thumb_func_start sub_80CDBA0 sub_80CDBA0: @ 80CDBA0 push {lr} - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] cmp r0, 0 bne _080CDBB4 @@ -10996,7 +10426,7 @@ sub_80CDC0C: @ 80CDC0C thumb_func_start sub_80CDC18 sub_80CDC18: @ 80CDC18 ldr r0, =gUnknown_02039D7E - ldr r1, =gUnknown_02039D79 + ldr r1, =sBoxCursorPosition ldrb r1, [r1] strb r1, [r0] bx lr @@ -11104,7 +10534,7 @@ _080CDCEC: beq _080CDCFE b _080CDD54 _080CDCF6: - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] cmp r0, 0 beq _080CDD08 @@ -11240,7 +10670,7 @@ _080CDDF8: beq _080CDEA8 b _080CDEAC _080CDDFE: - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -11271,7 +10701,7 @@ _080CDE2A: ldr r2, =0x00000d91 adds r0, r2 ldrb r0, [r0] - ldr r1, =gUnknown_02039D79 + ldr r1, =sBoxCursorPosition ldrb r1, [r1] bl sub_80CBD5C ldr r1, [r4] @@ -11295,7 +10725,7 @@ _080CDE68: ldr r2, =0x00000d91 adds r0, r2 ldrb r0, [r0] - ldr r1, =gUnknown_02039D79 + ldr r1, =sBoxCursorPosition ldrb r1, [r1] bl diegohint1 ldr r1, [r4] @@ -11395,7 +10825,7 @@ _080CDF32: thumb_func_start sub_80CDF38 sub_80CDF38: @ 80CDF38 push {r4,lr} - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -11403,7 +10833,7 @@ sub_80CDF38: @ 80CDF38 beq _080CDF68 cmp r0, 0x1 bne _080CDF94 - ldr r4, =gUnknown_02039D79 + ldr r4, =sBoxCursorPosition ldrb r1, [r4] movs r0, 0xE bl sub_80CE018 @@ -11423,14 +10853,14 @@ _080CDF68: bl StorageGetCurrentBox lsls r0, 24 lsrs r0, 24 - ldr r4, =gUnknown_02039D79 + ldr r4, =sBoxCursorPosition ldrb r1, [r4] bl sub_80CE018 ldrb r1, [r4] movs r0, 0x1 bl sub_80CBC14 _080CDF8E: - ldr r1, =gUnknown_02039D7A + ldr r1, =sIsMonBeingMoved movs r0, 0x1 strb r0, [r1] _080CDF94: @@ -11443,7 +10873,7 @@ _080CDF94: thumb_func_start sub_80CDFAC sub_80CDFAC: @ 80CDFAC push {r4,r5,lr} - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -11451,7 +10881,7 @@ sub_80CDFAC: @ 80CDFAC beq _080CDFDC cmp r0, 0x1 bne _080CDFFE - ldr r4, =gUnknown_02039D79 + ldr r4, =sBoxCursorPosition ldrb r1, [r4] movs r0, 0xE bl diegohint2 @@ -11465,7 +10895,7 @@ _080CDFDC: adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - ldr r5, =gUnknown_02039D79 + ldr r5, =sBoxCursorPosition ldrb r1, [r5] adds r0, r4, 0 bl diegohint2 @@ -11473,7 +10903,7 @@ _080CDFDC: adds r0, r4, 0 bl sub_80CBCAC _080CDFF8: - ldr r1, =gUnknown_02039D7A + ldr r1, =sIsMonBeingMoved movs r0, 0 strb r0, [r1] _080CDFFE: @@ -11505,7 +10935,7 @@ sub_80CE018: @ 80CE018 ldr r1, =0x000020a4 adds r0, r1 ldr r3, =gPlayerParty - ldr r1, =gUnknown_02039D79 + ldr r1, =sBoxCursorPosition movs r2, 0 ldrsb r2, [r1, r2] movs r1, 0x64 @@ -11527,9 +10957,9 @@ _080CE064: adds r0, r4, 0 adds r1, r5, 0 bl sub_80CE0E8 - ldr r0, =gUnknown_02039D7B + ldr r0, =sMovingMonOrigBoxId strb r4, [r0] - ldr r0, =gUnknown_02039D7C + ldr r0, =sMovingMonOrigBoxPos strb r5, [r0] pop {r4,r5} pop {r0} @@ -11644,9 +11074,9 @@ _080CE154: adds r0, r4 movs r1, 0 bl sub_80CEC00 - ldr r0, =gUnknown_02039D7B + ldr r0, =sMovingMonOrigBoxId strb r6, [r0] - ldr r0, =gUnknown_02039D7C + ldr r0, =sMovingMonOrigBoxPos strb r7, [r0] pop {r4-r7} pop {r0} @@ -11671,7 +11101,7 @@ sub_80CE19C: @ 80CE19C movs r0, 0 b _080CE21A _080CE1BA: - ldr r5, =gUnknown_02039D7A + ldr r5, =sIsMonBeingMoved ldrb r0, [r5] cmp r0, 0 beq _080CE1DC @@ -11685,7 +11115,7 @@ _080CE1BA: b _080CE1F6 .pool _080CE1DC: - ldr r5, =gUnknown_02039D79 + ldr r5, =sBoxCursorPosition ldrb r1, [r5] movs r0, 0xE bl sub_80CE018 @@ -11738,7 +11168,7 @@ sub_80CE22C: @ 80CE22C thumb_func_start sub_80CE250 sub_80CE250: @ 80CE250 push {lr} - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] cmp r0, 0 beq _080CE264 @@ -11746,7 +11176,7 @@ sub_80CE250: @ 80CE250 b _080CE274 .pool _080CE264: - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction movs r1, 0 ldrsb r1, [r0, r1] movs r2, 0x1 @@ -11755,7 +11185,7 @@ _080CE264: orrs r0, r1 lsrs r2, r0, 31 _080CE274: - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition ldrb r1, [r0] adds r0, r2, 0 bl sub_80CBF14 @@ -11799,7 +11229,7 @@ _080CE2CA: sub_80CE2D8: @ 80CE2D8 push {lr} bl sub_80CC020 - ldr r1, =gUnknown_02039D7A + ldr r1, =sIsMonBeingMoved ldrb r0, [r1] cmp r0, 0 beq _080CE2F0 @@ -11808,7 +11238,7 @@ sub_80CE2D8: @ 80CE2D8 b _080CE316 .pool _080CE2F0: - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -11822,7 +11252,7 @@ _080CE304: lsls r0, 24 lsrs r2, r0, 24 _080CE30C: - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition ldrb r1, [r0] adds r0, r2, 0 bl sub_80CE0E8 @@ -11836,7 +11266,7 @@ _080CE316: thumb_func_start sub_80CE324 sub_80CE324: @ 80CE324 push {lr} - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] cmp r0, 0 beq _080CE33E @@ -11914,7 +11344,7 @@ sub_80CE3A0: @ 80CE3A0 b _080CE504 .pool _080CE3D0: - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] cmp r0, 0 beq _080CE418 @@ -11939,7 +11369,7 @@ _080CE3D0: b _080CE494 .pool _080CE418: - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -11950,7 +11380,7 @@ _080CE418: ldr r2, =0x00002108 adds r0, r2 ldr r3, =gPlayerParty - ldr r1, =gUnknown_02039D79 + ldr r1, =sBoxCursorPosition movs r2, 0 ldrsb r2, [r1, r2] movs r1, 0x64 @@ -11969,7 +11399,7 @@ _080CE464: bl StorageGetCurrentBox lsls r0, 24 lsrs r0, 24 - ldr r1, =gUnknown_02039D79 + ldr r1, =sBoxCursorPosition ldrb r1, [r1] ldr r4, =gUnknown_02039D08 ldr r2, [r4] @@ -11984,7 +11414,7 @@ _080CE464: _080CE488: ldr r0, =gUnknown_02039D08 ldr r0, [r0] - ldr r1, =gUnknown_02039D79 + ldr r1, =sBoxCursorPosition ldrb r1, [r1] ldr r3, =0x00002171 adds r0, r3 @@ -12040,7 +11470,7 @@ _080CE504: thumb_func_start sub_80CE51C sub_80CE51C: @ 80CE51C push {r4-r6,lr} - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r1, [r0] negs r0, r1 orrs r0, r1 @@ -12309,7 +11739,7 @@ _080CE736: thumb_func_start sub_80CE760 sub_80CE760: @ 80CE760 push {lr} - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] cmp r0, 0 beq _080CE77A @@ -12329,11 +11759,11 @@ _080CE77A: thumb_func_start sub_80CE790 sub_80CE790: @ 80CE790 push {lr} - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] cmp r0, 0 beq _080CE7D8 - ldr r0, =gUnknown_02039D7B + ldr r0, =sMovingMonOrigBoxId ldrb r0, [r0] cmp r0, 0xE bne _080CE7C8 @@ -12363,7 +11793,7 @@ _080CE7D8: thumb_func_start sub_80CE7E8 sub_80CE7E8: @ 80CE7E8 push {r4,r5,lr} - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r5, [r0] cmp r5, 0 beq _080CE838 @@ -12389,7 +11819,7 @@ sub_80CE7E8: @ 80CE7E8 b _080CE8CA .pool _080CE838: - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -12401,7 +11831,7 @@ _080CE838: adds r2, r1, r0 ldr r0, =gPlayerParty str r0, [r2] - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition ldrb r0, [r0] ldr r2, =0x00002187 adds r1, r2 @@ -12429,7 +11859,7 @@ _080CE894: ldr r4, =0x0000218c adds r1, r2, r4 str r0, [r1] - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition ldrb r0, [r0] ldr r1, =0x00002187 adds r2, r1 @@ -12454,7 +11884,7 @@ _080CE8CA: thumb_func_start sub_80CE8E4 sub_80CE8E4: @ 80CE8E4 push {lr} - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] cmp r0, 0 beq _080CE8F8 @@ -12462,7 +11892,7 @@ sub_80CE8E4: @ 80CE8E4 b _080CE900 .pool _080CE8F8: - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition ldr r1, =gUnknown_0203CF20 ldrb r1, [r1] strb r1, [r0] @@ -12565,7 +11995,7 @@ sub_80CE9A8: @ 80CE9A8 ldr r3, =0x00000ceb adds r1, r3 strb r0, [r1] - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] cmp r0, 0 beq _080CE9E8 @@ -12578,12 +12008,12 @@ sub_80CE9A8: @ 80CE9A8 b _080CEA1C .pool _080CE9E8: - ldr r4, =gUnknown_02039D78 + ldr r4, =sBoxCursorAction movs r0, 0 ldrsb r0, [r4, r0] cmp r0, 0x1 bne _080CEA08 - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition movs r1, 0 ldrsb r1, [r0, r1] movs r0, 0x64 @@ -12598,7 +12028,7 @@ _080CEA08: ldrsb r0, [r4, r0] cmp r0, 0 bne _080CEA1C - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition ldrb r0, [r0] movs r1, 0x8 mov r2, sp @@ -12611,20 +12041,20 @@ _080CEA1C: .pool thumb_func_end sub_80CE9A8 - thumb_func_start sub_80CEA30 -sub_80CEA30: @ 80CEA30 + thumb_func_start CanMoveMon +CanMoveMon: @ 80CEA30 push {lr} - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 cmp r0, 0x1 bne _080CEA64 - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] cmp r0, 0 bne _080CEA64 - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition ldrb r0, [r0] bl CountPartyAliveNonEggMonsExcept lsls r0, 24 @@ -12638,22 +12068,22 @@ _080CEA64: _080CEA66: pop {r1} bx r1 - thumb_func_end sub_80CEA30 + thumb_func_end CanMoveMon - thumb_func_start sub_80CEA6C -sub_80CEA6C: @ 80CEA6C + thumb_func_start CanShifMon +CanShifMon: @ 80CEA6C push {lr} - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] cmp r0, 0 beq _080CEAC8 - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 cmp r0, 0x1 bne _080CEAAC - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition ldrb r0, [r0] bl CountPartyAliveNonEggMonsExcept lsls r0, 24 @@ -12681,21 +12111,21 @@ _080CEAC8: _080CEACA: pop {r1} bx r1 - thumb_func_end sub_80CEA6C + thumb_func_end CanShifMon - thumb_func_start sub_80CEAD0 -sub_80CEAD0: @ 80CEAD0 - ldr r0, =gUnknown_02039D7A + thumb_func_start IsMonBeingMoved +IsMonBeingMoved: @ 80CEAD0 + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] bx lr .pool - thumb_func_end sub_80CEAD0 + thumb_func_end IsMonBeingMoved - thumb_func_start sub_80CEADC -sub_80CEADC: @ 80CEADC + thumb_func_start IsCursorOnBox +IsCursorOnBox: @ 80CEADC push {lr} movs r1, 0 - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -12707,19 +12137,19 @@ _080CEAEE: pop {r1} bx r1 .pool - thumb_func_end sub_80CEADC + thumb_func_end IsCursorOnBox - thumb_func_start sub_80CEAF8 -sub_80CEAF8: @ 80CEAF8 + thumb_func_start IsCursorOnCloseBox +IsCursorOnCloseBox: @ 80CEAF8 push {lr} movs r1, 0 - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 cmp r0, 0x3 bne _080CEB16 - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -12731,13 +12161,13 @@ _080CEB16: pop {r1} bx r1 .pool - thumb_func_end sub_80CEAF8 + thumb_func_end IsCursorOnCloseBox - thumb_func_start sub_80CEB24 -sub_80CEB24: @ 80CEB24 + thumb_func_start IsCursorInBox +IsCursorInBox: @ 80CEB24 push {lr} movs r1, 0 - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -12749,7 +12179,7 @@ _080CEB36: pop {r1} bx r1 .pool - thumb_func_end sub_80CEB24 + thumb_func_end IsCursorInBox thumb_func_start sub_80CEB40 sub_80CEB40: @ 80CEB40 @@ -12757,7 +12187,7 @@ sub_80CEB40: @ 80CEB40 ldr r0, =gUnknown_02039D08 ldr r1, [r0] movs r2, 0 - ldr r3, =gUnknown_02039D7A + ldr r3, =sIsMonBeingMoved ldrb r0, [r3] cmp r0, 0 bne _080CEB52 @@ -12769,7 +12199,7 @@ _080CEB52: ldrb r0, [r3] cmp r0, 0 bne _080CEBD0 - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -12786,7 +12216,7 @@ _080CEB84: bgt _080CEBD0 b _080CEBB0 _080CEB8A: - ldr r1, =gUnknown_02039D79 + ldr r1, =sBoxCursorPosition movs r0, 0 ldrsb r0, [r1, r0] cmp r0, 0x5 @@ -12809,7 +12239,7 @@ _080CEBBA: bl StorageGetCurrentBox lsls r0, 24 lsrs r0, 24 - ldr r1, =gUnknown_02039D79 + ldr r1, =sBoxCursorPosition ldrb r1, [r1] bl GetBoxedMonPtr movs r1, 0x1 @@ -12824,7 +12254,7 @@ _080CEBD0: thumb_func_start sub_80CEBDC sub_80CEBDC: @ 80CEBDC push {lr} - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] cmp r0, 0 beq _080CEBF8 @@ -13367,10 +12797,10 @@ sub_80CF108: @ 80CF108 mov r6, r9 mov r5, r8 push {r5-r7} - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] mov r8, r0 - ldr r2, =gUnknown_02039D79 + ldr r2, =sBoxCursorPosition ldrb r4, [r2] ldr r5, =gUnknown_02039D08 ldr r0, [r5] @@ -13502,7 +12932,7 @@ _080CF220: lsls r0, 24 cmp r0, 0 beq _080CF2E4 - ldr r0, =gUnknown_02039D7D + ldr r0, =sCanOnlyMove ldrb r0, [r0] cmp r0, 0 bne _080CF244 @@ -13514,7 +12944,7 @@ _080CF244: ldrb r0, [r1, 0x1] cmp r0, 0x2 bne _080CF254 - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] cmp r0, 0x1 bne _080CF2D4 @@ -13674,7 +13104,7 @@ sub_80CF374: @ 80CF374 ands r0, r1 cmp r0, 0 beq _080CF3AC - ldr r4, =gUnknown_02039D79 + ldr r4, =sBoxCursorPosition movs r0, 0 ldrsb r0, [r4, r0] movs r1, 0x6 @@ -13691,7 +13121,7 @@ _080CF3AC: ands r0, r1 cmp r0, 0 beq _080CF3CC - ldr r1, =gUnknown_02039D79 + ldr r1, =sBoxCursorPosition movs r0, 0 ldrsb r0, [r1, r0] adds r0, 0x6 @@ -13706,7 +13136,7 @@ _080CF3CC: ands r0, r1 cmp r0, 0 beq _080CF3F0 - ldr r4, =gUnknown_02039D79 + ldr r4, =sBoxCursorPosition movs r0, 0 ldrsb r0, [r4, r0] movs r1, 0x6 @@ -13723,7 +13153,7 @@ _080CF3F0: ands r0, r1 cmp r0, 0 beq _080CF424 - ldr r4, =gUnknown_02039D79 + ldr r4, =sBoxCursorPosition movs r0, 0 ldrsb r0, [r4, r0] adds r0, 0x1 @@ -13751,13 +13181,13 @@ _080CF428: bl sub_80D0BA4 lsls r0, 24 lsrs r0, 24 - ldr r1, =gUnknown_02039D79 + ldr r1, =sBoxCursorPosition ldrb r1, [r1] lsls r1, 24 asrs r1, 24 cmp r0, r1 beq _080CF47C - ldr r2, =gUnknown_02039D7A + ldr r2, =sIsMonBeingMoved ldr r0, =gUnknown_02039D08 ldr r1, [r0] ldr r3, =0x00000ce4 @@ -13771,7 +13201,7 @@ _080CF428: movs r0, 0x2 strb r0, [r1] bl StorageGetCurrentBox - ldr r1, =gUnknown_02039D7B + ldr r1, =sMovingMonOrigBoxId strb r0, [r1] movs r0, 0x17 b _080CF49C @@ -13814,7 +13244,7 @@ sub_80CF4B0: @ 80CF4B0 lsls r0, 24 cmp r0, 0 beq _080CF588 - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition ldrb r1, [r0] subs r1, 0x6 b _080CF53A @@ -13829,7 +13259,7 @@ _080CF4DC: lsls r0, 24 cmp r0, 0 beq _080CF588 - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition ldrb r1, [r0] adds r1, 0x6 b _080CF53A @@ -13844,7 +13274,7 @@ _080CF4FC: lsls r0, 24 cmp r0, 0 beq _080CF5A2 - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition ldrb r1, [r0] subs r1, 0x1 b _080CF53A @@ -13861,7 +13291,7 @@ _080CF51C: lsls r0, 24 cmp r0, 0 beq _080CF5B6 - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition ldrb r1, [r0] adds r1, 0x1 _080CF53A: @@ -13882,7 +13312,7 @@ _080CF54C: lsls r0, 24 cmp r0, 0 beq _080CF588 - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved strb r4, [r0] ldr r0, =gUnknown_02039D08 ldr r0, [r0] @@ -13939,10 +13369,10 @@ sub_80CF5C4: @ 80CF5C4 mov r7, r9 mov r6, r8 push {r6,r7} - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] mov r9, r0 - ldr r6, =gUnknown_02039D79 + ldr r6, =sBoxCursorPosition ldrb r4, [r6] ldr r2, =gUnknown_02039D08 ldr r0, [r2] @@ -14063,7 +13493,7 @@ _080CF6C4: lsls r0, 24 cmp r0, 0 beq _080CF75C - ldr r0, =gUnknown_02039D7D + ldr r0, =sCanOnlyMove ldrb r0, [r0] cmp r0, 0 bne _080CF6E0 @@ -14327,10 +13757,10 @@ sub_80CF8D8: @ 80CF8D8 push {r4-r7,lr} mov r7, r8 push {r7} - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] mov r8, r0 - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition mov r12, r0 ldrb r2, [r0] ldr r3, =gUnknown_02039D08 @@ -14470,7 +13900,7 @@ sub_80CF9EC: @ 80CF9EC adds r4, r0, 0 cmp r1, 0 beq _080CFA30 - ldr r5, =gUnknown_02039D78 + ldr r5, =sBoxCursorAction _080CF9FC: lsls r0, r3, 3 adds r2, r0, r4 @@ -14574,7 +14004,7 @@ _080CFABA: bl sub_80CFF34 b _080CFAF8 _080CFAC6: - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] cmp r0, 0 beq _080CFAE8 @@ -14605,7 +14035,7 @@ _080CFAF8: ldrb r0, [r0, 0x1] cmp r0, 0x2 bne _080CFB2A - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -14764,9 +14194,9 @@ sub_80CFC14: @ 80CFC14 ldr r5, =0x00000cd9 adds r1, r5 strb r0, [r1] - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] - ldr r1, =gUnknown_02039D79 + ldr r1, =sBoxCursorPosition ldrb r1, [r1] add r4, sp, 0x28 mov r5, sp @@ -14794,7 +14224,7 @@ sub_80CFC14: @ 80CFC14 ldr r0, =gSprites adds r1, r0 str r1, [r3] - ldr r0, =gUnknown_02039D7D + ldr r0, =sCanOnlyMove ldr r5, =0x00000cd8 adds r2, r5 ldrb r0, [r0] @@ -14816,7 +14246,7 @@ sub_80CFC14: @ 80CFC14 movs r1, 0x4 orrs r0, r1 strb r0, [r2, 0x5] - ldr r0, =gUnknown_02039D7A + ldr r0, =sIsMonBeingMoved ldrb r0, [r0] cmp r0, 0 beq _080CFD22 @@ -14834,7 +14264,7 @@ _080CFD18: movs r1, 0 str r1, [r0] _080CFD22: - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -14873,7 +14303,7 @@ _080CFD40: ands r0, r2 orrs r0, r3 strb r0, [r1, 0x5] - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -14908,7 +14338,7 @@ _080CFDB4: thumb_func_start sub_80CFDC4 sub_80CFDC4: @ 80CFDC4 push {lr} - ldr r2, =gUnknown_02039D7D + ldr r2, =sCanOnlyMove movs r1, 0 ldrb r0, [r2] cmp r0, 0 @@ -14939,7 +14369,7 @@ _080CFDD2: thumb_func_start sub_80CFE08 sub_80CFE08: @ 80CFE08 - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition ldrb r0, [r0] bx lr .pool @@ -14950,13 +14380,13 @@ sub_80CFE14: @ 80CFE14 push {r4-r6,lr} adds r5, r0, 0 adds r6, r1, 0 - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 cmp r0, 0 bne _080CFE48 - ldr r4, =gUnknown_02039D79 + ldr r4, =sBoxCursorPosition movs r0, 0 ldrsb r0, [r4, r0] movs r1, 0x6 @@ -14997,7 +14427,7 @@ sub_80CFE54: @ 80CFE54 thumb_func_start sub_80CFE78 sub_80CFE78: @ 80CFE78 - ldr r0, =gUnknown_02039D7B + ldr r0, =sMovingMonOrigBoxId ldrb r0, [r0] bx lr .pool @@ -15024,13 +14454,13 @@ sub_80CFE84: @ 80CFE84 thumb_func_start sub_80CFEA8 sub_80CFEA8: @ 80CFEA8 push {lr} - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 cmp r0, 0 bne _080CFEC0 - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition ldrb r1, [r0] movs r0, 0 bl sub_80D0E50 @@ -15043,13 +14473,13 @@ _080CFEC0: thumb_func_start sub_80CFECC sub_80CFECC: @ 80CFECC push {lr} - ldr r0, =gUnknown_02039D78 + ldr r0, =sBoxCursorAction ldrb r0, [r0] lsls r0, 24 asrs r0, 24 cmp r0, 0 bne _080CFEE4 - ldr r0, =gUnknown_02039D79 + ldr r0, =sBoxCursorPosition ldrb r1, [r0] movs r0, 0 bl sub_80D0D8C diff --git a/data/pokemon_storage_system.s b/data/pokemon_storage_system.s index b859133a6..e9693f5f1 100644 --- a/data/pokemon_storage_system.s +++ b/data/pokemon_storage_system.s @@ -3,128 +3,6 @@ .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 diff --git a/include/mon_markings.h b/include/mon_markings.h index 22c3f14a4..00df6815a 100644 --- a/include/mon_markings.h +++ b/include/mon_markings.h @@ -21,6 +21,8 @@ struct PokemonMarkMenu /*0x10B4*/ u8 tileLoadState; }; // 10b8 +void sub_811F90C(struct PokemonMarkMenu *ptr); +void sub_811FA90(void); struct Sprite *sub_811FF94(u16 tileTag, u16 paletteTag, const u16 *palette); #endif //POKEEMERALD_MON_MARKINGS_H diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index 9b5358f06..4a3adec78 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -69,8 +69,32 @@ struct PokemonStorageSystemData u8 unk_0002; u8 unk_0003; u8 taskId; - u8 unk_0005[710]; + u8 unk_0005; + struct UnkStruct_2000020 unk_0020; + struct UnkStruct_2000028 unk_0028[8]; + u8 unk_90[567]; + u8 unk_02C7; + u8 unk_02C8; + u8 unk_02C9; + s16 field_2CA; u16 bg2_X; + u8 field_2CE; + u8 field_2CF[1217]; + u8 changeWallpaper; + u8 field_791; + u8 wallpaperTilemap[180 * 4]; + u8 wallpaperChangeState; + u8 field_A63; + u8 field_A64; + u8 field_A65; + u8 field_A66; + u8 field_A67; + u8 *wallpaperTilemapPtr; + u8 field_A6C; + u8 field_A6D[633]; + u16 field_CE6; + u8 field_CE8[188]; + struct PokemonMarkMenu field_DA4; }; extern struct UnkPSSStruct_2002370 *gUnknown_02039D04; diff --git a/include/strings.h b/include/strings.h index e17ea8646..744859c3e 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1403,4 +1403,36 @@ 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[]; + #endif //GUARD_STRINGS_H 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/pokemon_storage_system.c b/src/pokemon_storage_system.c index 465b97da2..b7b0e1295 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -1,12 +1,16 @@ #include "global.h" +#include "alloc.h" #include "bg.h" +#include "dma3.h" #include "event_data.h" #include "field_screen.h" #include "field_weather.h" #include "gpu_regs.h" #include "international_string_util.h" +#include "item_menu.h" #include "main.h" #include "menu.h" +#include "mon_markings.h" #include "overworld.h" #include "palette.h" #include "pokemon.h" @@ -16,11 +20,57 @@ #include "string_util.h" #include "strings.h" #include "text.h" +#include "text_window.h" #include "walda_phrase.h" #include "window.h" +#include "constants/rgb.h" #include "constants/songs.h" #include "constants/species.h" +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, +}; + IWRAM_DATA u8 gUnknown_03000F78[0x188]; extern const u8 gText_PartyFull[]; @@ -28,16 +78,26 @@ extern const u8 gText_Box[]; extern const u8 gText_JustOnePkmn[]; extern u8 gUnknown_02039D00; +extern u8 sBoxOption; +extern u8 gUnknown_02039D10; +extern u8 gUnknown_02039D0E; +extern bool8 sInPartyMenu; +extern u8 gUnknown_02039D0F; +extern u16 gUnknown_02039D12; + +extern void sub_80F9BCC(u16, u16, u8); +extern bool8 sub_80F9C1C(void); // This file's functions. void StorageSystemCreatePrimaryMenu(u8 whichMenu, s16 *windowIdPtr); -void sub_80C7D74(u8); +void sub_80C7D74(u8 boxOption); u8 sub_80CAEA0(void); void SetBoxWallpaper(u8 boxId, u8 wallpaperId); void SetCurrentBox(u8 boxId); +void sub_80CC32C(u8 boxId); void ClearMonInBox(u8 boxId, u8 boxPos); -void ResetWaldaWallpaper(void); void sub_80C7958(u8 curBox); +void ResetWaldaWallpaper(void); void sub_80C7B14(void); void sub_80C7BB4(void); void sub_80CA028(void); @@ -45,7 +105,37 @@ void sub_80C7B80(void); void sub_80D2AA4(void); void sub_80C7BE4(void); void sub_80CAA14(void); +void sub_80CE790(void); +void sub_80CE8E4(void); +void sub_80C9F6C(void); +void sub_80CA044(void); +void sub_80CA0C8(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_80CDC0C(void); +void sub_80CAF04(void); +void sub_80CA0D8(void); +void sub_80CADC4(void); +void sub_80CA704(void); void sub_80C7CF4(struct Sprite *sprite); +bool8 sub_80CA0A4(void); +bool8 sub_80D0164(void); +bool8 sub_80CC35C(void); +void sub_80C7FA8(u8 taskId); +void sub_80C9E50(u8 taskId); +void sub_80C81AC(u8 taskId); +void box_related_2(u8 taskId); +void task_pokemon_box_related(u8 taskId); +void sub_80D2A90(struct UnkStruct_2000020 *arg0, struct UnkStruct_2000028 *arg1, u32 arg2); +void sub_80D259C(u8 arg0); +void sub_80D01D0(u8 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); struct Sprite *sub_80CD2E8(u16 x, u16 y, u8 animId, u8 priority, u8 subpriority); // const rom data @@ -58,7 +148,16 @@ const struct PSS_MenuStringPtrs gUnknown_085716C0[] = {gText_SeeYa, gText_SeeYaDescription} }; -const struct WindowTemplate gUnknown_085716E8 = {0, 1, 1, 0x11, 0xA, 0xF, 1}; +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[] = { @@ -109,6 +208,170 @@ 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"); +const u32 gUnknown_085720DC[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.4bpp.lz"); +const u32 gUnknown_08572174[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.bin.lz"); +const u32 gUnknown_08572280[] = INCBIN_U32("graphics/unknown/unknown_572280.gbapal"); +const u32 gUnknown_085722A0[] = INCBIN_U32("graphics/unknown/unknown_5722A0.bin.lz"); + +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, +}; + +const u16 gUnknown_085723DC[] = INCBIN_U16("graphics/unknown/unknown_5723DC.gbapal"); +const u16 gUnknown_085723FC[] = INCBIN_U16("graphics/unknown/unknown_5723FC.gbapal"); +const u16 gUnknown_0857241C[] = INCBIN_U16("graphics/unknown/unknown_57241C.gbapal"); +const u16 gUnknown_0857243C[] = INCBIN_U16("graphics/unknown/unknown_57243C.gbapal"); + +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 +}; +const u16 gUnknown_085724A4[] = +{ + 0x1140, 0x1141, 0x1141, 0x1142, 0x1150, 0x1151, 0x1151, 0x1152, 0x1160, 0x1161, 0x1161, 0x1162, +}; +const u16 gUnknown_085724BC[] = +{ + 0x1143, 0x1144, 0x1144, 0x1145, 0x1153, 0x1154, 0x1154, 0x1155, 0x1163, 0x1164, 0x1164, 0x1165, +}; + +const u16 gWaveformPalette[] = INCBIN_U16("graphics/pokemon_storage/waveform.gbapal"); +const u32 gWaveformTiles[] = INCBIN_U32("graphics/pokemon_storage/waveform.4bpp"); +const u32 gUnknown_085726B4[] = INCBIN_U32("graphics/unused/unknown_5726B4.gbapal"); +const u32 gUnknown_085726F4[] = INCBIN_U32("graphics/unknown/unknown_5726F4.gbapal"); + +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 +}; + +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 + }, +}; + +const struct SpritePalette gWaveformSpritePalette = +{ + gWaveformPalette, 0xDACA +}; + +const struct SpriteSheet gWaveformSpriteSheet = +{ + gWaveformTiles, sizeof(gWaveformTiles), 5 +}; + +const struct OamData gOamData_857286C; +const struct SpriteTemplate gUnknown_08572754 = +{ + .tileTag = 2, + .paletteTag = 0xDAC6, + .oam = &gOamData_857286C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; + +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}, +}; // code u8 CountMonsInBox(u8 boxId) @@ -672,3 +935,477 @@ void c2_Box(void) AnimateSprites(); BuildOamBuffer(); } + +void sub_80C7D74(u8 boxOption) +{ + ResetTasks(); + sBoxOption = boxOption; + gUnknown_02039D08 = Alloc(0x62C4); + if (gUnknown_02039D08 == NULL) + { + SetMainCallback2(sub_80C7678); + } + else + { + gUnknown_02039D08->boxOption = boxOption; + gUnknown_02039D08->unk_0003 = 0; + gUnknown_02039D12 = 0; + gUnknown_02039D08->state = 0; + gUnknown_02039D08->taskId = CreateTask(sub_80C7FA8, 3); + gUnknown_02039D10 = StorageGetCurrentBox(); + SetMainCallback2(c2_Box); + } +} + +void c2_808CE60(void) +{ + ResetTasks(); + gUnknown_02039D08 = Alloc(0x62C4); + if (gUnknown_02039D08 == NULL) + { + SetMainCallback2(sub_80C7678); + } + else + { + gUnknown_02039D08->boxOption = sBoxOption; + gUnknown_02039D08->unk_0003 = 1; + gUnknown_02039D08->state = 0; + gUnknown_02039D08->taskId = CreateTask(sub_80C7FA8, 3); + SetMainCallback2(c2_Box); + } +} + +void sub_80C7E50(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); +} + +void sub_80C7E98(void) +{ + ResetPaletteFade(); + ResetSpriteData(); + FreeSpriteTileRanges(); + FreeAllSpritePalettes(); + ClearDma3Requests(); + gReservedSpriteTileCount = 0x280; + sub_80D2A90(&gUnknown_02039D08->unk_0020, gUnknown_02039D08->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); + gUnknown_02039D08->unk_02C7 = 0; +} + +void sub_80C7F1C(void) +{ + sub_80CDC0C(); + sInPartyMenu = (gUnknown_02039D08->boxOption == BOX_OPTION_DEPOSIT); + gUnknown_02039D0E = 0; +} + +void sub_80C7F4C(void) +{ + if (gUnknown_02039D08->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); +} + +void SetPSSCallback(TaskFunc newFunc) +{ + gTasks[gUnknown_02039D08->taskId].func = newFunc; + gUnknown_02039D08->state = 0; +} + +void sub_80C7FA8(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + SetVBlankCallback(NULL); + SetGpuReg(REG_OFFSET_DISPCNT, 0); + sub_80C7E98(); + if (gUnknown_02039D08->unk_0003 != 0) + { + switch (gUnknown_02039D0F) + { + case 1: + sub_80CE790(); + break; + case 0: + sub_80CE8E4(); + break; + case 2: + sub_80C9F6C(); + break; + } + } + sub_80CA044(); + sub_80CA0C8(); + break; + case 1: + if (!sub_80CA0A4()) + { + SetPSSCallback(sub_80C9E50); + return; + } + break; + case 2: + PutWindowTilemap(0); + ClearWindowTilemap(1); + CpuFill32(0, (void *)VRAM, 0x200); + LoadUserWindowBorderGfx(1, 0xB, 0xE0); + break; + case 3: + sub_80C7E50(); + if (gUnknown_02039D08->unk_0003 == 0) + sub_80C7F1C(); + break; + case 4: + sub_80CAF04(); + if (gUnknown_02039D08->unk_0003 == 0) + sub_80CD36C(); + else + sub_80CD3EC(); + break; + case 5: + if (!sub_80D0164()) + { + SetPSSCallback(sub_80C9E50); + return; + } + else + { + sub_80C9FEC(); + 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 (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + { + gUnknown_02039D08->field_DA4.baseTileTag = 0xD; + gUnknown_02039D08->field_DA4.basePaletteTag = 0xDACE; + sub_811F90C(&gUnknown_02039D08->field_DA4); + sub_811FA90(); + } + else + { + sub_80D0C60(); + sub_80CAEAC(); + } + break; + case 10: + sub_80C7F4C(); + if (gUnknown_02039D08->unk_0003 == 0) + { + BlendPalettes(0xFFFFFFFF, 0x10, 0); + SetPSSCallback(sub_80C81AC); + } + else + { + BlendPalettes(0xFFFFFFFF, 0x10, 0); + SetPSSCallback(box_related_2); + } + SetVBlankCallback(sub_80C7D28); + return; + default: + return; + } + + gUnknown_02039D08->state++; +} + +void sub_80C81AC(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + PlaySE(SE_PC_LOGIN); + sub_80F9BCC(0x14, 0, 1); + gUnknown_02039D08->state++; + break; + case 1: + if (!sub_80F9C1C()) + SetPSSCallback(task_pokemon_box_related); + break; + } +} + +void box_related_2(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + BeginNormalPaletteFade(0xFFFFFFFF, -1, 0x10, 0, RGB_BLACK); + gUnknown_02039D08->state++; + break; + case 1: + if (!UpdatePaletteFade()) + { + if (gUnknown_02039D0F == 2 && gSpecialVar_ItemId != 0) + { + PrintStorageActionText(0x1C); + gUnknown_02039D08->state++; + } + else + { + SetPSSCallback(task_pokemon_box_related); + } + } + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy() && gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + sub_80CADC4(); + gUnknown_02039D08->state++; + } + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + SetPSSCallback(task_pokemon_box_related); + break; + } +} + +/* +void task_pokemon_box_related(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + switch (sub_80CF9EC()) + { + case 1: + PlaySE(SE_SELECT); + gUnknown_02039D08->state = 1; + break; + case 5: + if (gUnknown_02039D08->boxOption != 0 && gUnknown_02039D08->boxOption != 1) + { + PrintStorageActionText(PC_TEXT_WHICH_ONE_WILL_TAKE); + gUnknown_02039D08->state = 3; + } + else + { + sub_80CDC0C(); + SetPSSCallback(sub_80C87A8); + } + break; + case 6: + if (gUnknown_02039D08->unk_0005 == 2) + { + if (sub_80CEAD0() && ItemIsMail(gUnknown_02039D08->field_CE6)) + gUnknown_02039D08->state = 5; + else + SetPSSCallback(sub_80C87E8); + } + break; + case 4: + SetPSSCallback(sub_80C9BE8); + break; + case 16: + SetPSSCallback(sub_80C9D1C); + break; + case 7: + PlaySE(SE_SELECT); + SetPSSCallback(sub_80C972C); + 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) + { + sub_80CC464(gUnknown_02039D08->field_2CA); + gUnknown_02039D08->state = 2; + } + else + { + sub_80CFEA8(); + gUnknown_02039D08->state = 10; + } + 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) + { + sub_80CC464(gUnknown_02039D08->field_2CA); + gUnknown_02039D08->state = 2; + } + else + { + sub_80CFEA8(); + gUnknown_02039D08->state = 10; + } + break; + case 11: + if (!sub_80CEA30()) + { + if (ItemIsMail(gUnknown_02039D08->field_CE6)) + { + gUnknown_02039D08->state = 5; + } + else + { + PlaySE(SE_SELECT); + SetPSSCallback(sub_80C8D78); + } + } + else + { + gUnknown_02039D08->state = 4; + } + break; + case 13: + if (sub_80CEA30()) + { + gUnknown_02039D08->state = 4; + } + else + { + PlaySE(SE_SELECT); + SetPSSCallback(sub_80C8B90); + } + break; + case 14: + if (!sub_80CEA30()) + { + gUnknown_02039D08->state = 4; + } + else + { + PlaySE(SE_SELECT); + SetPSSCallback(c3_0808DC50); + } + break; + case 12: + PlaySE(SE_SELECT); + SetPSSCallback(sub_80C8C90); + break; + case 15: + PlaySE(SE_SELECT); + SetPSSCallback(sub_80C8BEC); + break; + case 16: + PlaySE(SE_SELECT); + SetPSSCallback(sub_80C9128); + break; + case 17: + PlaySE(SE_SELECT); + SetPSSCallback(sub_80C91DC); + break; + case 18: + PlaySE(SE_SELECT); + SetPSSCallback(sub_80C93B0); + break; + case 20: + PlaySE(SE_SELECT); + sub_80D01D0(0); + gUnknown_02039D08->state = 7; + break; + case 22: + sub_80D01D0(1); + gUnknown_02039D08->state = 8; + break; + case 21: + PlaySE(SE_SELECT); + sub_80D01D0(2); + gUnknown_02039D08->state = 9; + break; + case 23: + sub_80D01D0(4); + gUnknown_02039D08->state = 7; + break; + case 25: + PlaySE(SE_SELECT); + sub_80D01D0(4); + gUnknown_02039D08->state = 9; + break; + case 26: + PlaySE(SE_SELECT); + sub_80D01D0(5); + gUnknown_02039D08->state = 7; + break; + } + break; + case 1: + if (!sub_809AC00()) + { + if (sub_809BF48()) + sub_80986E8(); + else + sub_8098710(); + if (gUnknown_02039D08->unk_11f6) + BoxSetMosaic(); + gUnknown_02039D08->state = 0; + } + break; + case 2: + if (!sub_8099D34()) + { + gPokemonStorage.currentBox = gUnknown_02039D08->unk_08b2; + if (!gUnknown_0203847C && !sub_80CEAD0()) + { + sub_809B440(); + BoxSetMosaic(); + } + gUnknown_02039D08->state = 0; + } + break; + case 3: + if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) + { + sub_8098A5C(); + gUnknown_02039D08->state = 0; + } + break; + case 4: + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_LAST_POKE); + gUnknown_02039D08->state = 6; + break; + case 5: + 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)) + { + sub_8098A5C(); + SetPSSCallback(sub_8096C84); + } + break; + } +} +*/ diff --git a/sym_ewram.txt b/sym_ewram.txt index af6480536..c8d323310 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -216,10 +216,10 @@ gUnknown_02039D04: @ 2039D04 gUnknown_02039D08: @ 2039D08 .space 0x4 -gUnknown_02039D0C: @ 2039D0C +sInPartyMenu: @ 2039D0C .space 0x1 -gUnknown_02039D0D: @ 2039D0D +sBoxOption: @ 2039D0D .space 0x1 gUnknown_02039D0E: @ 2039D0E @@ -237,22 +237,22 @@ gUnknown_02039D12: @ 2039D12 gUnknown_02039D14: @ 2039D14 .space 0x64 -gUnknown_02039D78: @ 2039D78 +sBoxCursorAction: @ 2039D78 .space 0x1 -gUnknown_02039D79: @ 2039D79 +sBoxCursorPosition: @ 2039D79 .space 0x1 -gUnknown_02039D7A: @ 2039D7A +sIsMonBeingMoved: @ 2039D7A .space 0x1 -gUnknown_02039D7B: @ 2039D7B +sMovingMonOrigBoxId: @ 2039D7B .space 0x1 -gUnknown_02039D7C: @ 2039D7C +sMovingMonOrigBoxPos: @ 2039D7C .space 0x1 -gUnknown_02039D7D: @ 2039D7D +sCanOnlyMove: @ 2039D7D .space 0x1 gUnknown_02039D7E: @ 2039D7E From 431e7e7e5c390db7fa809f7e8ef1a47c0009468a Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 9 Dec 2018 21:06:43 +0100 Subject: [PATCH 02/13] 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; } } -*/ From c2d887617492db009694e8715ff606418c691346 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 10 Dec 2018 21:36:52 +0100 Subject: [PATCH 03/13] Document PSS functions --- asm/pokemon_storage_system.s | 487 +------------------------------ data/event_scripts.s | 2 +- data/specials.inc | 2 +- include/item_menu.h | 1 + include/pokemon_storage_system.h | 17 +- include/pokemon_summary_screen.h | 3 +- src/pokemon_storage_system.c | 456 +++++++++++++++++++++-------- src/pokemon_summary_screen.c | 10 +- 8 files changed, 369 insertions(+), 609 deletions(-) diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index 2bbf62625..dda568eaa 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -7,481 +7,6 @@ - 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 SetPSSCallback -_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 SetPSSCallback -_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 IsMonBeingMoved - lsls r0, 24 - cmp r0, 0 - beq _080C9C40 - movs r0, 0x20 - bl PlaySE - movs r0, 0xF - bl PrintStorageActionText - 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 SetPSSCallback - b _080C9D08 - .pool -_080C9C58: - movs r0, 0x5 - bl PlaySE - movs r0, 0 - bl PrintStorageActionText - 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 ClearBottomWindow - ldr r0, =sub_80C82AC - bl SetPSSCallback - b _080C9D08 - .pool -_080C9CBC: - movs r0, 0x3 - bl PlaySE - bl ClearBottomWindow - 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 SetPSSCallback -_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 IsMonBeingMoved - lsls r0, 24 - cmp r0, 0 - beq _080C9D74 - movs r0, 0x20 - bl PlaySE - movs r0, 0xF - bl PrintStorageActionText - 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 SetPSSCallback - b _080C9E3C - .pool -_080C9D8C: - movs r0, 0x5 - bl PlaySE - movs r0, 0x12 - bl PrintStorageActionText - 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 ClearBottomWindow - ldr r0, =sub_80C82AC - bl SetPSSCallback - b _080C9E3C - .pool -_080C9DF0: - movs r0, 0x3 - bl PlaySE - bl ClearBottomWindow - 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 SetPSSCallback -_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} @@ -524,8 +49,8 @@ _080C9FC0: bx r0 thumb_func_end sub_80C9F6C - thumb_func_start sub_80C9FC8 -sub_80C9FC8: @ 80C9FC8 + thumb_func_start FreePSSData +FreePSSData: @ 80C9FC8 push {r4,lr} bl sub_80D25F0 bl sub_80D01B8 @@ -539,7 +64,7 @@ sub_80C9FC8: @ 80C9FC8 pop {r0} bx r0 .pool - thumb_func_end sub_80C9FC8 + thumb_func_end FreePSSData thumb_func_start sub_80C9FEC sub_80C9FEC: @ 80C9FEC @@ -14307,8 +13832,8 @@ sub_80D12B8: @ 80D12B8 .pool thumb_func_end sub_80D12B8 - thumb_func_start sub_80D12D4 -sub_80D12D4: @ 80D12D4 + thumb_func_start GetMovingItem +GetMovingItem: @ 80D12D4 ldr r0, =gUnknown_02039D08 ldr r0, [r0] ldr r1, =0x00002234 @@ -14316,7 +13841,7 @@ sub_80D12D4: @ 80D12D4 ldrh r0, [r0] bx lr .pool - thumb_func_end sub_80D12D4 + thumb_func_end GetMovingItem thumb_func_start sub_80D12E8 sub_80D12E8: @ 80D12E8 diff --git a/data/event_scripts.s b/data/event_scripts.s index d90dbf584..ce92cf388 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -1673,7 +1673,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/specials.inc b/data/specials.inc index 080f2c042..ab8bb59ab 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/item_menu.h b/include/item_menu.h index 649eb934c..6214c69fc 100644 --- a/include/item_menu.h +++ b/include/item_menu.h @@ -60,5 +60,6 @@ void CB2_BagMenuFromStartMenu(void); u8 sub_81ABB2C(u8 pocketId); bool8 UseRegisteredKeyItemOnField(void); void CB2_GoToSellMenu(void); +void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)()); #endif //GUARD_item_menu_H diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index ed2b20f46..c045eb481 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -66,7 +66,7 @@ struct PokemonStorageSystemData { u8 state; u8 boxOption; - u8 unk_0002; + u8 screenChangeType; u8 unk_0003; u8 taskId; u8 unk_0005; @@ -102,8 +102,19 @@ struct PokemonStorageSystemData u8 field_CEF[181]; struct PokemonMarkMenu field_DA4; struct UnkPSSStruct_2002370 field_1E5C; - u8 field_20A4[400]; - u16 field_2234; + u8 field_20A4[220]; + u8 field_2180; + u8 field_2181; + u8 field_2182; + u8 field_2183; + u8 field_2184; + u8 field_2185; + u8 field_2186; + u8 field_2187; + u8 field_2188; + struct BoxPokemon *field_218C; + u8 field_2190[164]; + u16 movingItem; }; extern struct UnkPSSStruct_2002370 *gUnknown_02039D04; diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index 5dc37c70d..d0926d388 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -4,6 +4,7 @@ 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)); // The Pokemon Summary Screen can operate in different modes. Certain features, // such as move re-ordering, are available in the different modes. @@ -11,7 +12,7 @@ enum PokemonSummaryScreenMode { PSS_MODE_NORMAL, PSS_MODE_UNK1, - PSS_MODE_UNK2, + PSS_MODE_BOX, PSS_MODE_SELECT_MOVE, }; diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 3ec4701af..bce9d1801 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -13,9 +13,11 @@ #include "main.h" #include "menu.h" #include "mon_markings.h" +#include "naming_screen.h" #include "overworld.h" #include "palette.h" #include "pokemon.h" +#include "pokemon_summary_screen.h" #include "pokemon_storage_system.h" #include "script.h" #include "sound.h" @@ -73,6 +75,14 @@ enum PC_TEXT_CANT_STORE_MAIL, }; +enum +{ + SCREEN_CHANGE_EXIT_BOX, + SCREEN_CHANGE_SUMMARY_SCREEN, + SCREEN_CHANGE_NAME_BOX, + SCREEN_CHANGE_ITEM_FROM_BAG, +}; + IWRAM_DATA u8 gUnknown_03000F78[0x188]; extern const u8 gText_PartyFull[]; @@ -86,13 +96,16 @@ extern u8 gUnknown_02039D0E; extern bool8 sInPartyMenu; extern u8 gUnknown_02039D0F; extern u16 gUnknown_02039D12; +extern struct Pokemon gUnknown_02039D14; extern void sub_80F9BCC(u16, u16, u8); +extern void sub_80F9BF4(u16, u16, u8); extern bool8 sub_80F9C1C(void); +extern bool8 sub_80F9C30(void); // This file's functions. -void StorageSystemCreatePrimaryMenu(u8 whichMenu, s16 *windowIdPtr); -void sub_80C7D74(u8 boxOption); +void CreatePCMenu(u8 whichMenu, s16 *windowIdPtr); +void Cb2_EnterPSS(u8 boxOption); u8 sub_80CAEA0(void); u8 sub_80CF9EC(void); u8 sub_80CDC2C(void); @@ -120,6 +133,7 @@ void sub_80CD36C(void); void sub_80CD3EC(void); void sub_80CAC1C(void); void sub_80C9FEC(void); +void sub_80CABE0(void); void sub_80CAEAC(void); void sub_80D0C60(void); void sub_80CFEA8(void); @@ -143,8 +157,10 @@ void sub_80CADD8(void); void sub_80D1818(void); void sub_80D17B4(void); void sub_80CE760(void); +void sub_80CE7E8(void); void sub_80CFECC(void); void sub_80CA9EC(void); +void FreePSSData(void); void sub_80CAB20(void); void sub_80CE22C(void); void sub_80CB950(void); @@ -177,37 +193,37 @@ 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 Cb_PlaceMon(u8 taskId); +void Cb_ChangeScreen(u8 taskId); void sub_80C81AC(u8 taskId); -void sub_80C9D1C(u8 taskId); +void Cb_OnBPressed(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_OnSelectedMon(u8 taskId); +void Cb_OnCloseBoxPressed(u8 taskId); +void Cb_HidePartyPokemon(u8 taskId); +void Cb_DepositMenu(u8 taskId); +void Cb_MoveMon(u8 taskId); +void Cb_GiveMovingItemToMon(u8 taskId); void Cb_SwitchSelectedItem(u8 taskId); -void sub_80C9128(u8 taskId); +void Cb_TakeItemForMoving(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_ShiftMon(u8 taskId); +void Cb_ShowPartyPokemon(u8 taskId); +void Cb_ShowItemInfo(u8 taskId); +void Cb_GiveItemFromBag(u8 taskId); void Cb_ItemToBag(u8 taskId); -void sub_80C9128(u8 taskId); -void sub_80C90A4(u8 taskId); -void sub_80C9B28(u8 taskId); +void Cb_TakeItemForMoving(u8 taskId); +void Cb_ShowMarkMenu(u8 taskId); +void Cb_ShowMonSummary(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_MainPSS(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 Cb_HandleMovingMonFromParty(u8 taskId); void sub_80D2A90(struct UnkStruct_2000020 *arg0, struct UnkStruct_2000028 *arg1, u32 arg2); void sub_80D259C(u8 arg0); void sub_80CC464(u8 arg0); @@ -232,6 +248,7 @@ 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); +u16 GetMovingItem(void); // const rom data const struct PSS_MenuStringPtrs gUnknown_085716C0[] = @@ -606,13 +623,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) +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); @@ -706,7 +724,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); } @@ -714,29 +732,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) +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); + Task_PokemonStorageSystemPC(taskId); SetVBlankCallback(vblankCb); pal_fill_black(); } -void StorageSystemCreatePrimaryMenu(u8 whichMenu, s16 *windowIdPtr) +void CreatePCMenu(u8 whichMenu, s16 *windowIdPtr) { s16 windowId; struct WindowTemplate winTemplate = gUnknown_085716E8; @@ -749,10 +767,10 @@ void StorageSystemCreatePrimaryMenu(u8 whichMenu, s16 *windowIdPtr) *windowIdPtr = windowId; } -void sub_80C7678(void) +void Cb2_ExitPSS(void) { gUnknown_02039D00 = sub_80CAEA0(); - gFieldCallback = mapldr_0808C6D8; + gFieldCallback = FieldCb_ReturnToPcMenu; SetMainCallback2(CB2_ReturnToField); } @@ -1031,14 +1049,14 @@ void c2_Box(void) BuildOamBuffer(); } -void sub_80C7D74(u8 boxOption) +void Cb2_EnterPSS(u8 boxOption) { ResetTasks(); sBoxOption = boxOption; gUnknown_02039D08 = Alloc(0x62C4); if (gUnknown_02039D08 == NULL) { - SetMainCallback2(sub_80C7678); + SetMainCallback2(Cb2_ExitPSS); } else { @@ -1052,13 +1070,13 @@ void sub_80C7D74(u8 boxOption) } } -void c2_808CE60(void) +void Cb2_ReturnToPSS(void) { ResetTasks(); gUnknown_02039D08 = Alloc(0x62C4); if (gUnknown_02039D08 == NULL) { - SetMainCallback2(sub_80C7678); + SetMainCallback2(Cb2_ExitPSS); } else { @@ -1151,7 +1169,7 @@ void sub_80C7FA8(u8 taskId) case 1: if (!sub_80CA0A4()) { - SetPSSCallback(sub_80C9E50); + SetPSSCallback(Cb_ChangeScreen); return; } break; @@ -1176,7 +1194,7 @@ void sub_80C7FA8(u8 taskId) case 5: if (!sub_80D0164()) { - SetPSSCallback(sub_80C9E50); + SetPSSCallback(Cb_ChangeScreen); return; } else @@ -1243,7 +1261,7 @@ void sub_80C81AC(u8 taskId) break; case 1: if (!sub_80F9C1C()) - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); break; } } @@ -1266,7 +1284,7 @@ void sub_80C972C_2(u8 taskId) } else { - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); } } break; @@ -1279,12 +1297,12 @@ void sub_80C972C_2(u8 taskId) break; case 3: if (!IsDma3ManagerBusyWithBgCopy()) - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); break; } } -void sub_80C82AC(u8 taskId) +void Cb_MainPSS(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -1304,7 +1322,7 @@ void sub_80C82AC(u8 taskId) else { sub_80CDC0C(); - SetPSSCallback(sub_80C87A8); + SetPSSCallback(Cb_ShowPartyPokemon); } break; case 6: @@ -1313,25 +1331,25 @@ void sub_80C82AC(u8 taskId) if (IsMonBeingMoved() && ItemIsMail(gUnknown_02039D08->selectedItem)) gUnknown_02039D08->state = 5; else - SetPSSCallback(sub_80C87E8); + SetPSSCallback(Cb_HidePartyPokemon); } else if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) { - SetPSSCallback(sub_80C87E8); + SetPSSCallback(Cb_HidePartyPokemon); } break; case 4: - SetPSSCallback(sub_80C9BE8); + SetPSSCallback(Cb_OnCloseBoxPressed); break; case 19: - SetPSSCallback(sub_80C9D1C); + SetPSSCallback(Cb_OnBPressed); break; case 7: PlaySE(SE_SELECT); SetPSSCallback(Cb_HandleBoxOptions); break; case 8: - SetPSSCallback(sub_80C8864); + SetPSSCallback(Cb_OnSelectedMon); break; case 9: PlaySE(SE_SELECT); @@ -1375,7 +1393,7 @@ void sub_80C82AC(u8 taskId) else { PlaySE(SE_SELECT); - SetPSSCallback(sub_80C8D78); + SetPSSCallback(Cb_DepositMenu); } } else @@ -1391,7 +1409,7 @@ void sub_80C82AC(u8 taskId) else { PlaySE(SE_SELECT); - SetPSSCallback(sub_80C8B90); + SetPSSCallback(Cb_MoveMon); } break; case 14: @@ -1402,7 +1420,7 @@ void sub_80C82AC(u8 taskId) else { PlaySE(SE_SELECT); - SetPSSCallback(c3_0808DC50); + SetPSSCallback(Cb_ShiftMon); } break; case 12: @@ -1411,15 +1429,15 @@ void sub_80C82AC(u8 taskId) break; case 15: PlaySE(SE_SELECT); - SetPSSCallback(sub_80C8BEC); + SetPSSCallback(Cb_PlaceMon); break; case 16: PlaySE(SE_SELECT); - SetPSSCallback(sub_80C9128); + SetPSSCallback(Cb_TakeItemForMoving); break; case 17: PlaySE(SE_SELECT); - SetPSSCallback(sub_80C91DC); + SetPSSCallback(Cb_GiveMovingItemToMon); break; case 18: PlaySE(SE_SELECT); @@ -1465,6 +1483,7 @@ void sub_80C82AC(u8 taskId) sub_80CA9C0(); else sub_80CA9EC(); + if (gUnknown_02039D08->field_CEA) BoxSetMosaic(); gUnknown_02039D08->state = 0; @@ -1512,7 +1531,7 @@ void sub_80C82AC(u8 taskId) if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); } break; case 7: @@ -1521,7 +1540,7 @@ void sub_80C82AC(u8 taskId) break; case 8: if (!sub_80D01E4()) - SetPSSCallback(sub_80C8B90); + SetPSSCallback(Cb_MoveMon); break; case 9: if (!sub_80D01E4()) @@ -1545,7 +1564,7 @@ void sub_80C82AC(u8 taskId) } } -void sub_80C87A8(u8 taskId) +void Cb_ShowPartyPokemon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -1555,12 +1574,12 @@ void sub_80C87A8(u8 taskId) break; case 1: if (!sub_80CAB70()) - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); break; } } -void sub_80C87E8(u8 taskId) +void Cb_HidePartyPokemon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -1581,13 +1600,13 @@ void sub_80C87E8(u8 taskId) { if (gUnknown_02039D08->field_CEA) BoxSetMosaic(); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); } break; } } -void sub_80C8864(u8 taskId) +void Cb_OnSelectedMon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -1616,7 +1635,7 @@ void sub_80C8864(u8 taskId) case -1: case 0: ClearBottomWindow(); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); break; case 3: if (CanMoveMon()) @@ -1627,13 +1646,13 @@ void sub_80C8864(u8 taskId) { PlaySE(SE_SELECT); ClearBottomWindow(); - SetPSSCallback(sub_80C8B90); + SetPSSCallback(Cb_MoveMon); } break; case 5: PlaySE(SE_SELECT); ClearBottomWindow(); - SetPSSCallback(sub_80C8BEC); + SetPSSCallback(Cb_PlaceMon); break; case 4: if (!CanShifMon()) @@ -1644,7 +1663,7 @@ void sub_80C8864(u8 taskId) { PlaySE(SE_SELECT); ClearBottomWindow(); - SetPSSCallback(c3_0808DC50); + SetPSSCallback(Cb_ShiftMon); } break; case 2: @@ -1665,7 +1684,7 @@ void sub_80C8864(u8 taskId) { PlaySE(SE_SELECT); ClearBottomWindow(); - SetPSSCallback(sub_80C8D78); + SetPSSCallback(Cb_DepositMenu); } break; case 7: @@ -1675,7 +1694,7 @@ void sub_80C8864(u8 taskId) } else if (gUnknown_02039D08->field_CED) { - gUnknown_02039D08->state = 5; + gUnknown_02039D08->state = 5; // Cannot release an Egg. } else if (ItemIsMail(gUnknown_02039D08->selectedItem)) { @@ -1689,19 +1708,19 @@ void sub_80C8864(u8 taskId) break; case 6: PlaySE(SE_SELECT); - SetPSSCallback(sub_80C9B28); + SetPSSCallback(Cb_ShowMonSummary); break; case 8: PlaySE(SE_SELECT); - SetPSSCallback(sub_80C90A4); + SetPSSCallback(Cb_ShowMarkMenu); break; case 12: PlaySE(SE_SELECT); - SetPSSCallback(sub_80C9128); + SetPSSCallback(Cb_TakeItemForMoving); break; case 13: PlaySE(SE_SELECT); - SetPSSCallback(sub_80C91DC); + SetPSSCallback(Cb_GiveMovingItemToMon); break; case 16: SetPSSCallback(Cb_ItemToBag); @@ -1712,10 +1731,10 @@ void sub_80C8864(u8 taskId) break; case 14: PlaySE(SE_SELECT); - SetPSSCallback(sub_80C9B88); + SetPSSCallback(Cb_GiveItemFromBag); break; case 17: - SetPSSCallback(sub_80C9498); + SetPSSCallback(Cb_ShowItemInfo); break; } break; @@ -1738,13 +1757,13 @@ void sub_80C8864(u8 taskId) if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); } break; } } -void sub_80C8B90(u8 taskId) +void Cb_MoveMon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -1756,15 +1775,15 @@ void sub_80C8B90(u8 taskId) if (!sub_80CDCAC()) { if (sInPartyMenu) - SetPSSCallback(sub_80C9670); + SetPSSCallback(Cb_HandleMovingMonFromParty); else - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); } break; } } -void sub_80C8BEC(u8 taskId) +void Cb_PlaceMon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -1776,15 +1795,15 @@ void sub_80C8BEC(u8 taskId) if (!sub_80CDCAC()) { if (sInPartyMenu) - SetPSSCallback(sub_80C9670); + SetPSSCallback(Cb_HandleMovingMonFromParty); else - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); } break; } } -void c3_0808DC50(u8 taskId) +void Cb_ShiftMon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -1796,7 +1815,7 @@ void c3_0808DC50(u8 taskId) if (!sub_80CDCAC()) { BoxSetMosaic(); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); } break; } @@ -1823,7 +1842,7 @@ void Cb_WithdrawMon(u8 taskId) if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); } break; case 2: @@ -1849,12 +1868,12 @@ void Cb_WithdrawMon(u8 taskId) } break; case 5: - SetPSSCallback(sub_80C87E8); + SetPSSCallback(Cb_HidePartyPokemon); break; } } -void sub_80C8D78(u8 taskId) +void Cb_DepositMenu(u8 taskId) { u8 r4; @@ -1874,7 +1893,7 @@ void sub_80C8D78(u8 taskId) ClearBottomWindow(); sub_80C78E4(); sub_80C7890(); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); } else { @@ -1904,7 +1923,7 @@ void sub_80C8D78(u8 taskId) sub_80CE22C(); BoxSetMosaic(); sub_80CAB20(); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); } break; case 4: @@ -1932,7 +1951,7 @@ void Cb_ReleaseMon(u8 taskId) case -1: case 1: ClearBottomWindow(); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); break; case 0: ClearBottomWindow(); @@ -2001,7 +2020,7 @@ void Cb_ReleaseMon(u8 taskId) } break; case 7: - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); break; case 8: PrintStorageActionText(PC_TEXT_WAS_RELEASED); @@ -2041,13 +2060,13 @@ void Cb_ReleaseMon(u8 taskId) if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); } break; } } -void sub_80C90A4(u8 taskId) +void Cb_ShowMarkMenu(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2064,13 +2083,13 @@ void sub_80C90A4(u8 taskId) ClearBottomWindow(); sub_80CE9A8(gUnknown_02039D08->field_DA4.markings); sub_80CA230(); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); } break; } } -void sub_80C9128(u8 taskId) +void Cb_TakeItemForMoving(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2102,12 +2121,12 @@ void sub_80C9128(u8 taskId) break; case 3: if (!IsDma3ManagerBusyWithBgCopy()) - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); break; } } -void sub_80C91DC(u8 taskId) +void Cb_GiveMovingItemToMon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2139,7 +2158,7 @@ void sub_80C91DC(u8 taskId) break; case 4: if (!IsDma3ManagerBusyWithBgCopy()) - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); break; } } @@ -2180,13 +2199,13 @@ void Cb_ItemToBag(u8 taskId) break; case 4: if (!IsDma3ManagerBusyWithBgCopy()) - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); break; case 3: if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); } break; } @@ -2231,12 +2250,12 @@ void Cb_SwitchSelectedItem(u8 taskId) break; case 4: if (!IsDma3ManagerBusyWithBgCopy()) - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); break; } } -void sub_80C9498(u8 taskId) +void Cb_ShowItemInfo(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2274,12 +2293,12 @@ void sub_80C9498(u8 taskId) break; case 6: if (!IsDma3ManagerBusyWithBgCopy()) - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); break; } } -void sub_80C954C(u8 taskId) +void Cb_CloseBoxWhileHoldingItem(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2295,10 +2314,10 @@ void sub_80C954C(u8 taskId) case -1: case 1: ClearBottomWindow(); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); break; case 0: - if (AddBagItem(gUnknown_02039D08->field_2234, 1) == TRUE) + if (AddBagItem(gUnknown_02039D08->movingItem, 1) == TRUE) { ClearBottomWindow(); gUnknown_02039D08->state = 3; @@ -2326,17 +2345,17 @@ void sub_80C954C(u8 taskId) if (!sub_80D1218()) { sub_80CFE54(0); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); } break; case 5: if (!IsDma3ManagerBusyWithBgCopy()) - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); break; } } -void sub_80C9670(u8 taskId) +void Cb_HandleMovingMonFromParty(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2349,7 +2368,7 @@ void sub_80C9670(u8 taskId) if (!sub_80CB9BC()) { sub_80CAB20(); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); } break; } @@ -2376,7 +2395,7 @@ void Cb_PrintCantStoreMail(u8 taskId) break; case 3: if (!IsDma3ManagerBusyWithBgCopy()) - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); break; } } @@ -2401,7 +2420,7 @@ void Cb_HandleBoxOptions(u8 taskId) case 0: sub_80CD1A8(TRUE); ClearBottomWindow(); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); break; case 11: PlaySE(SE_SELECT); @@ -2442,7 +2461,7 @@ void Cb_HandleWallpapers(u8 taskId) case -1: sub_80CD1A8(TRUE); ClearBottomWindow(); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); break; case 18 ... 21: PlaySE(SE_SELECT); @@ -2491,7 +2510,7 @@ void Cb_HandleWallpapers(u8 taskId) if (!DoWallpaperGfxChange()) { sub_80CD1A8(TRUE); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); } break; case 6: @@ -2527,7 +2546,7 @@ void Cb_JumpBox(u8 taskId) if (gUnknown_02039D08->newCurrBoxId == 201 || gUnknown_02039D08->newCurrBoxId == StorageGetCurrentBox()) { sub_80CD1A8(TRUE); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); } else { @@ -2544,7 +2563,7 @@ void Cb_JumpBox(u8 taskId) if (!ScrollToBox()) { SetCurrentBox(gUnknown_02039D08->newCurrBoxId); - SetPSSCallback(sub_80C82AC); + SetPSSCallback(Cb_MainPSS); } break; } @@ -2563,9 +2582,212 @@ void Cb_NameBox(u8 taskId) if (!UpdatePaletteFade()) { gUnknown_02039D0F = 1; - gUnknown_02039D08->unk_0002 = 2; - SetPSSCallback(sub_80C9E50); + gUnknown_02039D08->screenChangeType = SCREEN_CHANGE_NAME_BOX; + SetPSSCallback(Cb_ChangeScreen); } break; } } + +void Cb_ShowMonSummary(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + sub_80CE7E8(); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gUnknown_02039D08->state++; + break; + case 1: + if (!UpdatePaletteFade()) + { + gUnknown_02039D0F = 0; + gUnknown_02039D08->screenChangeType = SCREEN_CHANGE_SUMMARY_SCREEN; + SetPSSCallback(Cb_ChangeScreen); + } + break; + } +} + +void Cb_GiveItemFromBag(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gUnknown_02039D08->state++; + break; + case 1: + if (!UpdatePaletteFade()) + { + gUnknown_02039D0F = 2; + gUnknown_02039D08->screenChangeType = SCREEN_CHANGE_ITEM_FROM_BAG; + SetPSSCallback(Cb_ChangeScreen); + } + break; + } +} + +void Cb_OnCloseBoxPressed(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + if (IsMonBeingMoved()) + { + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_HOLDING_POKE); + gUnknown_02039D08->state = 1; + } + else if (sub_80D127C()) + { + SetPSSCallback(Cb_CloseBoxWhileHoldingItem); + } + else + { + PlaySE(SE_SELECT); + PrintStorageActionText(PC_TEXT_EXIT_BOX); + sub_80CAD9C(0); + gUnknown_02039D08->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 1: + case -1: + ClearBottomWindow(); + SetPSSCallback(Cb_MainPSS); + break; + case 0: + PlaySE(SE_PC_OFF); + ClearBottomWindow(); + gUnknown_02039D08->state++; + break; + } + break; + case 3: + sub_80F9BF4(0x14, 0, 1); + gUnknown_02039D08->state++; + break; + case 4: + if (!sub_80F9C30()) + { + sub_80CABE0(); + gPlayerPartyCount = CalculatePlayerPartyCount(); + gUnknown_02039D08->screenChangeType = SCREEN_CHANGE_EXIT_BOX; + SetPSSCallback(Cb_ChangeScreen); + } + break; + } +} + +void Cb_OnBPressed(u8 taskId) +{ + switch (gUnknown_02039D08->state) + { + case 0: + if (IsMonBeingMoved()) + { + PlaySE(SE_HAZURE); + PrintStorageActionText(PC_TEXT_HOLDING_POKE); + gUnknown_02039D08->state = 1; + } + else if (sub_80D127C()) + { + SetPSSCallback(Cb_CloseBoxWhileHoldingItem); + } + else + { + PlaySE(SE_SELECT); + PrintStorageActionText(PC_TEXT_CONTINUE_BOX); + sub_80CAD9C(0); + gUnknown_02039D08->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 -1: + PlaySE(SE_PC_OFF); + ClearBottomWindow(); + gUnknown_02039D08->state++; + break; + } + break; + case 3: + sub_80F9BF4(0x14, 0, 0); + gUnknown_02039D08->state++; + break; + case 4: + if (!sub_80F9C30()) + { + sub_80CABE0(); + gPlayerPartyCount = CalculatePlayerPartyCount(); + gUnknown_02039D08->screenChangeType = SCREEN_CHANGE_EXIT_BOX; + SetPSSCallback(Cb_ChangeScreen); + } + break; + } +} + +void Cb_ChangeScreen(u8 taskId) +{ + struct BoxPokemon *boxMons; + u8 mode, monIndex, maxMonIndex; + u8 screenChangeType = gUnknown_02039D08->screenChangeType; + + if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS && sub_80D127C() == 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 = gUnknown_02039D08->field_218C; + monIndex = gUnknown_02039D08->field_2187; + maxMonIndex = gUnknown_02039D08->field_2186; + mode = gUnknown_02039D08->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); +} diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index f1c248a1a..48ba864f7 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; @@ -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); } From c5b5f4bd777b4b255294818bb1dc7fe01bc38a6d Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 10 Dec 2018 23:42:44 +0100 Subject: [PATCH 04/13] More storage --- asm/pokemon_storage_system.s | 318 +------------------------ data/pokemon_storage_system.s | 75 ------ include/graphics.h | 3 + include/pokemon_storage_system.h | 9 +- src/pokemon_storage_system.c | 382 ++++++++++++++++++++++++++----- 5 files changed, 342 insertions(+), 445 deletions(-) diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index dda568eaa..4848eef41 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -7,309 +7,7 @@ - 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 GetBoxCursorPosition - lsls r0, 24 - lsrs r1, r0, 24 - ldr r0, =sInPartyMenu - 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 FreePSSData -FreePSSData: @ 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 FreePSSData - - 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 @@ -8876,7 +8574,7 @@ _080CEA08: ldrb r0, [r0] movs r1, 0x8 mov r2, sp - bl SetBoxMonDataFromSelectedBox + bl SetCurrentBoxMonData _080CEA1C: add sp, 0x4 pop {r4} @@ -13361,7 +13059,7 @@ sub_80D0E90: @ 80D0E90 adds r0, r5, 0 movs r1, 0xC mov r2, sp - bl SetBoxMonDataFromSelectedBox + bl SetCurrentBoxMonData adds r0, r5, 0 movs r1, 0x1 bl sub_80CB7AC @@ -13489,7 +13187,7 @@ sub_80D0FAC: @ 80D0FAC adds r2, r4 adds r0, r7, 0 movs r1, 0xC - bl SetBoxMonDataFromSelectedBox + bl SetCurrentBoxMonData mov r1, r8 ldr r0, [r1] adds r0, r4 @@ -13577,7 +13275,7 @@ sub_80D1080: @ 80D1080 adds r2, r0 adds r0, r5, 0 movs r1, 0xC - bl SetBoxMonDataFromSelectedBox + bl SetCurrentBoxMonData adds r0, r5, 0 movs r1, 0 bl sub_80CB7AC @@ -13643,7 +13341,7 @@ sub_80D1114: @ 80D1114 adds r0, r5, 0 movs r1, 0xC mov r2, sp - bl SetBoxMonDataFromSelectedBox + bl SetCurrentBoxMonData adds r0, r5, 0 movs r1, 0x1 bl sub_80CB7AC @@ -15228,8 +14926,8 @@ GetBoxMonDataFromSelectedBox: @ 80D1DB8 .pool thumb_func_end GetBoxMonDataFromSelectedBox - thumb_func_start SetBoxMonDataFromSelectedBox -SetBoxMonDataFromSelectedBox: @ 80D1DD8 + thumb_func_start SetCurrentBoxMonData +SetCurrentBoxMonData: @ 80D1DD8 push {r4,r5,lr} adds r4, r0, 0 adds r5, r1, 0 @@ -15246,7 +14944,7 @@ SetBoxMonDataFromSelectedBox: @ 80D1DD8 pop {r0} bx r0 .pool - thumb_func_end SetBoxMonDataFromSelectedBox + thumb_func_end SetCurrentBoxMonData thumb_func_start GetBoxMonNickFromAnyBox GetBoxMonNickFromAnyBox: @ 80D1DFC diff --git a/data/pokemon_storage_system.s b/data/pokemon_storage_system.s index e9693f5f1..4bd6b8c1a 100644 --- a/data/pokemon_storage_system.s +++ b/data/pokemon_storage_system.s @@ -3,81 +3,6 @@ .section .rodata - .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 diff --git a/include/graphics.h b/include/graphics.h index b51926b8d..a07a669d6 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4740,4 +4740,7 @@ extern const u32 gUnknown_08D8D58C[]; extern const u32 gPokedexAreaScreenAreaUnknown_Gfx[]; extern const u16 gPokedexAreaScreenAreaUnknown_Pal[]; +// Pokemon Storage System +extern const u32 gPSSMenu_Gfx[]; + #endif //GUARD_GRAPHICS_H diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index c045eb481..f582c2dc4 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -67,7 +67,7 @@ struct PokemonStorageSystemData u8 state; u8 boxOption; u8 screenChangeType; - u8 unk_0003; + bool8 isReshowingPSS; u8 taskId; u8 unk_0005; struct UnkStruct_2000020 unk_0020; @@ -99,7 +99,10 @@ struct PokemonStorageSystemData u8 field_CEC; u8 field_CED; u8 field_CEE; - u8 field_CEF[181]; + u8 field_CEF[165]; + struct Sprite *field_D94; + struct Sprite *field_D98[2]; + u16 *field_DA0; struct PokemonMarkMenu field_DA4; struct UnkPSSStruct_2002370 field_1E5C; u8 field_20A4[220]; @@ -115,6 +118,8 @@ struct PokemonStorageSystemData struct BoxPokemon *field_218C; u8 field_2190[164]; u16 movingItem; + u8 field_2236[14478]; + u8 field_5AC4[0x800]; }; extern struct UnkPSSStruct_2002370 *gUnknown_02039D04; diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index bce9d1801..9e0944257 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -1,11 +1,13 @@ #include "global.h" #include "alloc.h" #include "bg.h" +#include "decompress.h" #include "dma3.h" #include "event_data.h" #include "field_screen.h" #include "field_weather.h" #include "gpu_regs.h" +#include "graphics.h" #include "international_string_util.h" #include "item.h" #include "item_menu.h" @@ -83,6 +85,18 @@ enum SCREEN_CHANGE_ITEM_FROM_BAG, }; +#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_TILE_WAVEFORM 0x5 +#define TAG_TILE_10 0x10 +#define TAG_TILE_2 0x2 +#define TAG_TILE_D 0xD +#define TAG_TILE_A 0xA + IWRAM_DATA u8 gUnknown_03000F78[0x188]; extern const u8 gText_PartyFull[]; @@ -117,22 +131,22 @@ void sub_80C7958(u8 curBox); void ResetWaldaWallpaper(void); void sub_80C7B14(void); void sub_80C7BB4(void); -void sub_80CA028(void); +void ScrollBackground(void); void sub_80C7B80(void); void sub_80D2AA4(void); void sub_80C7BE4(void); void sub_80CAA14(void); void sub_80CE790(void); void sub_80CE8E4(void); -void sub_80C9F6C(void); +void GiveChosenBagItem(void); void sub_80CA888(void); -void sub_80CA044(void); -void sub_80CA0C8(void); +void LoadPSSMenuGfx(void); +void LoadWaveformSpritePalette(void); void sub_80CDC18(void); void sub_80CD36C(void); void sub_80CD3EC(void); void sub_80CAC1C(void); -void sub_80C9FEC(void); +void SetScrollingBackground(void); void sub_80CABE0(void); void sub_80CAEAC(void); void sub_80D0C60(void); @@ -143,8 +157,13 @@ void sub_80CA0D8(void); void sub_80CFFD0(void); void sub_80CE250(void); void sub_80CE3A0(void); +void sub_80D01B8(void); void sub_80CE2D8(void); +void sub_80D25F0(void); void sub_80CA230(void); +void sub_80CA318(void); +void sub_80CA154(void); +void sub_80CA1C4(void); void sub_80CC064(void); void sub_80CE324(void); void ClearBottomWindow(void); @@ -167,7 +186,7 @@ void sub_80CB950(void); void sub_80CA9C0(void); void BoxSetMosaic(void); void sub_80C7CF4(struct Sprite *sprite); -bool8 sub_80CA0A4(void); +bool8 InitPSSWindows(void); bool8 sub_80CC0A0(void); bool8 sub_80CE2A8(void); bool8 sub_80D0164(void); @@ -192,10 +211,10 @@ bool8 CanShifMon(void); bool8 IsCursorOnCloseBox(void); bool8 IsMonBeingMoved(void); bool8 sub_80CE19C(u8 arg0); -void sub_80C7FA8(u8 taskId); +void Cb_InitPSS(u8 taskId); void Cb_PlaceMon(u8 taskId); void Cb_ChangeScreen(u8 taskId); -void sub_80C81AC(u8 taskId); +void Cb_ShowPSS(u8 taskId); void Cb_OnBPressed(u8 taskId); void Cb_HandleBoxOptions(u8 taskId); void Cb_OnSelectedMon(u8 taskId); @@ -217,7 +236,7 @@ void Cb_ShowMarkMenu(u8 taskId); void Cb_ShowMonSummary(u8 taskId); void Cb_ReleaseMon(u8 taskId); void task_pokemon_box_related(u8 taskId); -void sub_80C972C_2(u8 taskId); +void Cb_ReshowPSSAfterChoosingBagItem(u8 taskId); void Cb_MainPSS(u8 taskId); void Cb_JumpBox(u8 taskId); void Cb_HandleWallpapers(u8 taskId); @@ -249,6 +268,7 @@ struct Sprite *sub_80CD2E8(u16 x, u16 y, u8 animId, u8 priority, u8 subpriority) void SetWallpaperForCurrentBox(u8 wallpaperId); void sub_80CAE0C(u8 arg0); u16 GetMovingItem(void); +void SetCurrentBoxMonData(s32 monId, s32 request, const void *value); // const rom data const struct PSS_MenuStringPtrs gUnknown_085716C0[] = @@ -271,25 +291,25 @@ const struct WindowTemplate gUnknown_085716E8 = .baseBlock = 0x1, }; -static const union AnimCmd sSpriteAnim_85716F0[] = +const union AnimCmd sSpriteAnim_85716F0[] = { ANIMCMD_FRAME(0, 5), ANIMCMD_END }; -static const union AnimCmd sSpriteAnim_85716F8[] = +const union AnimCmd sSpriteAnim_85716F8[] = { ANIMCMD_FRAME(4, 5), ANIMCMD_END }; -static const union AnimCmd sSpriteAnim_8571700[] = +const union AnimCmd sSpriteAnim_8571700[] = { ANIMCMD_FRAME(6, 5), ANIMCMD_END }; -static const union AnimCmd sSpriteAnim_8571708[] = +const union AnimCmd sSpriteAnim_8571708[] = { ANIMCMD_FRAME(10, 5), ANIMCMD_END @@ -303,13 +323,13 @@ const union AnimCmd *const sSpriteAnimTable_8571710[] = sSpriteAnim_8571708 }; -static const union AffineAnimCmd sSpriteAffineAnim_8571720[] = +const union AffineAnimCmd sSpriteAffineAnim_8571720[] = { AFFINEANIMCMD_FRAME(0xE0, 0xE0, 0, 0), AFFINEANIMCMD_END }; -static const union AffineAnimCmd *const sSpriteAffineAnimTable_8571730[] = +const union AffineAnimCmd *const sSpriteAffineAnimTable_8571730[] = { sSpriteAffineAnim_8571720 }; @@ -320,8 +340,8 @@ 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"); -const u32 gUnknown_085720DC[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.4bpp.lz"); -const u32 gUnknown_08572174[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.bin.lz"); +const u32 gPokemonStorageScrollingBGTileset[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.4bpp.lz"); +const u32 gPokemonStorageScrollingBGTilemap[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.bin.lz"); const u32 gUnknown_08572280[] = INCBIN_U32("graphics/unknown/unknown_572280.gbapal"); const u32 gUnknown_085722A0[] = INCBIN_U32("graphics/unknown/unknown_5722A0.bin.lz"); @@ -331,7 +351,7 @@ const u16 gUnknown_0857239C[] = 0x2101, 0x2102, 0x2103, 0x2104, 0x2105, 0x2106, 0x2107, 0x2108, 0x2111, 0x2112, 0x2113, 0x2114, 0x2115, 0x2116, 0x2117, 0x2118, }; -const u16 gUnknown_085723DC[] = INCBIN_U16("graphics/unknown/unknown_5723DC.gbapal"); +const u16 gUnknown_085723DC[] = INCBIN_U16("graphics/unknown/unknown_5723DC.gbapal"); // Left-most part and Close Box. const u16 gUnknown_085723FC[] = INCBIN_U16("graphics/unknown/unknown_5723FC.gbapal"); const u16 gUnknown_0857241C[] = INCBIN_U16("graphics/unknown/unknown_57241C.gbapal"); const u16 gUnknown_0857243C[] = INCBIN_U16("graphics/unknown/unknown_57243C.gbapal"); @@ -430,20 +450,20 @@ const struct BgTemplate gUnknown_08572734[] = const struct SpritePalette gWaveformSpritePalette = { - gWaveformPalette, 0xDACA + gWaveformPalette, TAG_PAL_WAVEFORM }; const struct SpriteSheet gWaveformSpriteSheet = { - gWaveformTiles, sizeof(gWaveformTiles), 5 + gWaveformTiles, sizeof(gWaveformTiles), TAG_TILE_WAVEFORM }; -const struct OamData gOamData_857286C; +const struct OamData sOamData_857286C; const struct SpriteTemplate gUnknown_08572754 = { - .tileTag = 2, - .paletteTag = 0xDAC6, - .oam = &gOamData_857286C, + .tileTag = TAG_TILE_2, + .paletteTag = TAG_PAL_DAC6, + .oam = &sOamData_857286C, .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, @@ -485,6 +505,146 @@ const struct StorageAction gPCStorageActionTexts[] = [PC_TEXT_CANT_STORE_MAIL] = {gText_MailCantBeStored, 0}, }; +const struct WindowTemplate gUnknown_08572864 = +{ + .bg = 0, + .tilemapLeft = 24, + .tilemapTop = 11, + .width = 5, + .height = 4, + .paletteNum = 15, + .baseBlock = 0x5C, +}; + +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 +}; + +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 +}; + +const union AnimCmd sSpriteAnim_857287C[] = +{ + ANIMCMD_FRAME(0, 5), + ANIMCMD_END +}; + +const union AnimCmd sSpriteAnim_8572884[] = +{ + ANIMCMD_FRAME(2, 8), + ANIMCMD_FRAME(4, 8), + ANIMCMD_FRAME(6, 8), + ANIMCMD_JUMP(0) +}; + +const union AnimCmd sSpriteAnim_8572894[] = +{ + ANIMCMD_FRAME(8, 5), + ANIMCMD_END +}; + +const union AnimCmd sSpriteAnim_857289C[] = +{ + ANIMCMD_FRAME(10, 8), + ANIMCMD_FRAME(4, 8), + ANIMCMD_FRAME(12, 8), + ANIMCMD_JUMP(0) +}; + +const union AnimCmd *const sSpriteAnimTable_85728AC[] = +{ + sSpriteAnim_857287C, + sSpriteAnim_8572884, + sSpriteAnim_8572894, + sSpriteAnim_857289C +}; + +const struct SpriteTemplate gUnknown_085728BC = +{ + .tileTag = 5, + .paletteTag = 0xDACA, + .oam = &sOamData_8572874, + .anims = sSpriteAnimTable_85728AC, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; + +const struct OamData sOamData_85728EC; +const struct SpriteTemplate gUnknown_085728D4 = +{ + .tileTag = 18, + .paletteTag = 0xDAC0, + .oam = &sOamData_85728EC, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; + +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 +}; + +const union AffineAnimCmd gSpriteAffineAnim_85728F4[] = +{ + AFFINEANIMCMD_FRAME(-2, -2, 0, 120), + AFFINEANIMCMD_END +}; + +const union AffineAnimCmd gSpriteAffineAnim_8572904[] = +{ + AFFINEANIMCMD_FRAME(16, 16, 0, 0), + AFFINEANIMCMD_FRAME(16, 16, 0, 15), + AFFINEANIMCMD_END +}; + +const union AffineAnimCmd *const gSpriteAffineAnimTable_857291C[] = +{ + gSpriteAffineAnim_85728F4, + gSpriteAffineAnim_8572904 +}; + // code u8 CountMonsInBox(u8 boxId) { @@ -566,7 +726,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; @@ -577,7 +737,7 @@ static u8 *StringCopyAndFillWithSpaces(u8 *dst, const u8 *src, u16 n) return str; } -static void sub_80C7128(u16 *dest, u16 dest_left, u16 dest_top, const u16 *src, u16 src_left, u16 src_top, u16 dest_width, u16 dest_height, u16 src_width) +void sub_80C7128(u16 *dest, u16 dest_left, u16 dest_top, const u16 *src, u16 src_left, u16 src_top, u16 dest_width, u16 dest_height, u16 src_width) { u16 i; @@ -1030,7 +1190,7 @@ void sub_80C7CF4(struct Sprite *sprite) } } -void sub_80C7D28(void) +void VblankCb_PSS(void) { LoadOam(); ProcessSpriteCopyRequests(); @@ -1039,11 +1199,11 @@ void sub_80C7D28(void) SetGpuReg(REG_OFFSET_BG2HOFS, gUnknown_02039D08->bg2_X); } -void c2_Box(void) +void Cb2_PSS(void) { RunTasks(); do_scheduled_bg_tilemap_copies_to_vram(); - sub_80CA028(); + ScrollBackground(); sub_80CAA14(); AnimateSprites(); BuildOamBuffer(); @@ -1053,7 +1213,7 @@ void Cb2_EnterPSS(u8 boxOption) { ResetTasks(); sBoxOption = boxOption; - gUnknown_02039D08 = Alloc(0x62C4); + gUnknown_02039D08 = Alloc(sizeof(*gUnknown_02039D08)); if (gUnknown_02039D08 == NULL) { SetMainCallback2(Cb2_ExitPSS); @@ -1061,19 +1221,19 @@ void Cb2_EnterPSS(u8 boxOption) else { gUnknown_02039D08->boxOption = boxOption; - gUnknown_02039D08->unk_0003 = 0; + gUnknown_02039D08->isReshowingPSS = FALSE; gUnknown_02039D12 = 0; gUnknown_02039D08->state = 0; - gUnknown_02039D08->taskId = CreateTask(sub_80C7FA8, 3); + gUnknown_02039D08->taskId = CreateTask(Cb_InitPSS, 3); gUnknown_02039D10 = StorageGetCurrentBox(); - SetMainCallback2(c2_Box); + SetMainCallback2(Cb2_PSS); } } void Cb2_ReturnToPSS(void) { ResetTasks(); - gUnknown_02039D08 = Alloc(0x62C4); + gUnknown_02039D08 = Alloc(sizeof(*gUnknown_02039D08)); if (gUnknown_02039D08 == NULL) { SetMainCallback2(Cb2_ExitPSS); @@ -1081,14 +1241,14 @@ void Cb2_ReturnToPSS(void) else { gUnknown_02039D08->boxOption = sBoxOption; - gUnknown_02039D08->unk_0003 = 1; + gUnknown_02039D08->isReshowingPSS = TRUE; gUnknown_02039D08->state = 0; - gUnknown_02039D08->taskId = CreateTask(sub_80C7FA8, 3); - SetMainCallback2(c2_Box); + gUnknown_02039D08->taskId = CreateTask(Cb_InitPSS, 3); + SetMainCallback2(Cb2_PSS); } } -void sub_80C7E50(void) +void ResetAllBgCoords(void) { SetGpuReg(REG_OFFSET_BG0HOFS, 0); SetGpuReg(REG_OFFSET_BG0VOFS, 0); @@ -1140,7 +1300,7 @@ void SetPSSCallback(TaskFunc newFunc) gUnknown_02039D08->state = 0; } -void sub_80C7FA8(u8 taskId) +void Cb_InitPSS(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -1148,7 +1308,7 @@ void sub_80C7FA8(u8 taskId) SetVBlankCallback(NULL); SetGpuReg(REG_OFFSET_DISPCNT, 0); sub_80C7E98(); - if (gUnknown_02039D08->unk_0003 != 0) + if (gUnknown_02039D08->isReshowingPSS) { switch (gUnknown_02039D0F) { @@ -1159,15 +1319,15 @@ void sub_80C7FA8(u8 taskId) sub_80CE8E4(); break; case 2: - sub_80C9F6C(); + GiveChosenBagItem(); break; } } - sub_80CA044(); - sub_80CA0C8(); + LoadPSSMenuGfx(); + LoadWaveformSpritePalette(); break; case 1: - if (!sub_80CA0A4()) + if (!InitPSSWindows()) { SetPSSCallback(Cb_ChangeScreen); return; @@ -1180,13 +1340,13 @@ void sub_80C7FA8(u8 taskId) LoadUserWindowBorderGfx(1, 0xB, 0xE0); break; case 3: - sub_80C7E50(); - if (gUnknown_02039D08->unk_0003 == 0) + ResetAllBgCoords(); + if (!gUnknown_02039D08->isReshowingPSS) sub_80C7F1C(); break; case 4: sub_80CAF04(); - if (gUnknown_02039D08->unk_0003 == 0) + if (!gUnknown_02039D08->isReshowingPSS) sub_80CD36C(); else sub_80CD3EC(); @@ -1199,7 +1359,7 @@ void sub_80C7FA8(u8 taskId) } else { - sub_80C9FEC(); + SetScrollingBackground(); sub_80CAC1C(); } break; @@ -1218,8 +1378,8 @@ void sub_80C7FA8(u8 taskId) if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) { - gUnknown_02039D08->field_DA4.baseTileTag = 0xD; - gUnknown_02039D08->field_DA4.basePaletteTag = 0xDACE; + gUnknown_02039D08->field_DA4.baseTileTag = TAG_TILE_D; + gUnknown_02039D08->field_DA4.basePaletteTag = TAG_PAL_DACE; sub_811F90C(&gUnknown_02039D08->field_DA4); sub_811FA90(); } @@ -1231,17 +1391,17 @@ void sub_80C7FA8(u8 taskId) break; case 10: sub_80C7F4C(); - if (gUnknown_02039D08->unk_0003 == 0) + if (!gUnknown_02039D08->isReshowingPSS) { BlendPalettes(0xFFFFFFFF, 0x10, 0); - SetPSSCallback(sub_80C81AC); + SetPSSCallback(Cb_ShowPSS); } else { BlendPalettes(0xFFFFFFFF, 0x10, 0); - SetPSSCallback(sub_80C972C_2); + SetPSSCallback(Cb_ReshowPSSAfterChoosingBagItem); } - SetVBlankCallback(sub_80C7D28); + SetVBlankCallback(VblankCb_PSS); return; default: return; @@ -1250,7 +1410,7 @@ void sub_80C7FA8(u8 taskId) gUnknown_02039D08->state++; } -void sub_80C81AC(u8 taskId) +void Cb_ShowPSS(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -1266,7 +1426,7 @@ void sub_80C81AC(u8 taskId) } } -void sub_80C972C_2(u8 taskId) +void Cb_ReshowPSSAfterChoosingBagItem(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -1881,7 +2041,7 @@ void Cb_DepositMenu(u8 taskId) { case 0: PrintStorageActionText(PC_TEXT_DEPOSIT_IN_WHICH_BOX); - sub_80C77E8(&gUnknown_02039D08->field_1E5C, 10, 0xDAC7, 3, FALSE); + sub_80C77E8(&gUnknown_02039D08->field_1E5C, TAG_TILE_A, TAG_PAL_DAC7, 3, FALSE); sub_80C78D4(gUnknown_02039D0E); gUnknown_02039D08->state++; break; @@ -2529,7 +2689,7 @@ void Cb_JumpBox(u8 taskId) { case 0: PrintStorageActionText(PC_TEXT_JUMP_TO_WHICH_BOX); - sub_80C77E8(&gUnknown_02039D08->field_1E5C, 10, 0xDAC7, 3, FALSE); + sub_80C77E8(&gUnknown_02039D08->field_1E5C, TAG_TILE_A, TAG_PAL_DAC7, 3, FALSE); sub_80C78D4(StorageGetCurrentBox()); gUnknown_02039D08->state++; break; @@ -2791,3 +2951,109 @@ void Cb_ChangeScreen(u8 taskId) DestroyTask(taskId); } + +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); + } +} + +void FreePSSData(void) +{ + sub_80D25F0(); + sub_80D01B8(); + FREE_AND_SET_NULL(gUnknown_02039D08); + FreeAllWindowBuffers(); +} + +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); +} + +void ScrollBackground(void) +{ + ChangeBgX(3, 128, 1); + ChangeBgY(3, 128, 2); +} + +void LoadPSSMenuGfx(void) +{ + InitBgsFromTemplates(0, gUnknown_08572734, ARRAY_COUNT(gUnknown_08572734)); + DecompressAndLoadBgGfxUsingHeap(1, gPSSMenu_Gfx, 0, 0, 0); + LZ77UnCompWram(gUnknown_085722A0, gUnknown_02039D08->field_5AC4); + SetBgTilemapBuffer(1, gUnknown_02039D08->field_5AC4); + ShowBg(1); + schedule_bg_copy_tilemap_to_vram(1); +} + +bool8 InitPSSWindows(void) +{ + if (!InitWindows(gUnknown_08572714)) + { + return FALSE; + } + else + { + DeactivateAllTextPrinters(); + return TRUE; + } +} + +void LoadWaveformSpritePalette(void) +{ + LoadSpritePalette(&gWaveformSpritePalette); +} + +void sub_80CA0D8(void) +{ + LoadPalette(gUnknown_085723DC, 0, 0x20); + LoadPalette(gUnknown_085723FC, 0x20, 0x20); + LoadPalette(gUnknown_085726F4, 0xF0, 0x20); + if (gUnknown_02039D08->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)); + sub_80CA318(); + sub_80CA154(); + sub_80CA1C4(); + sub_80CA230(); +} + +void sub_80CA154(void) +{ + gUnknown_02039D08->field_D94 = sub_811FFB4(TAG_TILE_10, TAG_PAL_DAC8, NULL); + gUnknown_02039D08->field_D94->oam.priority = 1; + gUnknown_02039D08->field_D94->subpriority = 1; + gUnknown_02039D08->field_D94->pos1.x = 40; + gUnknown_02039D08->field_D94->pos1.y = 150; + gUnknown_02039D08->field_DA0 = (void*) OBJ_VRAM0 + 32 * GetSpriteTileStartByTag(TAG_TILE_10); +} + +void sub_80CA1C4(void) +{ + u16 i; + struct SpriteSheet sheet = gWaveformSpriteSheet; + + LoadSpriteSheet(&sheet); + for (i = 0; i < 2; i++) + { + u8 spriteId = CreateSprite(&gUnknown_085728BC, i * 63 + 8, 9, 2); + gUnknown_02039D08->field_D98[i] = &gSprites[spriteId]; + } +} From 74746603ada01fa9e5d6b355476f67d03c652e9b Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 11 Dec 2018 23:09:12 +0100 Subject: [PATCH 05/13] More pokemon storage --- asm/pokemon_storage_system.s | 554 ------------------------------- include/pokemon_storage_system.h | 32 +- src/pokemon_storage_system.c | 183 +++++++++- 3 files changed, 200 insertions(+), 569 deletions(-) diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index 4848eef41..1823b9e94 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -8,560 +8,6 @@ - - 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} diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index f582c2dc4..d3beb88ab 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -91,7 +91,10 @@ struct PokemonStorageSystemData u8 field_A67; u8 *wallpaperTilemapPtr; u8 field_A6C; - u8 field_A6D[633]; + u8 field_A6D[623]; + u32 *field_CDC; + u32 cursorMonPersonality; + u16 cursorMonSpecies; u16 selectedItem; u16 field_CE8; u8 field_CEA; @@ -99,7 +102,20 @@ struct PokemonStorageSystemData u8 field_CEC; u8 field_CED; u8 field_CEE; - u8 field_CEF[165]; + u8 field_CEF; + u8 field_CF0; + u8 field_CF1; + u8 field_CF2; + u8 field_CF3; + u8 field_CF4; + u8 field_CF5; + u8 field_CF6; + u8 field_CF7; + u8 field_CF8; + u8 cursorMonNick[36]; + u8 cursorMonSpeciesName[36]; + u8 cursorMonGenderLvlText[36]; + u8 cursorMonItemName[47]; struct Sprite *field_D94; struct Sprite *field_D98[2]; u16 *field_DA0; @@ -118,7 +134,17 @@ struct PokemonStorageSystemData struct BoxPokemon *field_218C; u8 field_2190[164]; u16 movingItem; - u8 field_2236[14478]; + u8 field_2236; + u8 field_2237; + u8 field_2238; + u8 field_2239; + u16 field_223A; + u16 *field_223C; + struct Sprite *cursorMonSprite; + u16 field_2244[16]; + u8 field_2264[96]; + u8 field_22C4[0x800]; + u8 field_2AC4[12288]; u8 field_5AC4[0x800]; }; diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 9e0944257..edf322235 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -99,10 +99,6 @@ enum IWRAM_DATA u8 gUnknown_03000F78[0x188]; -extern const u8 gText_PartyFull[]; -extern const u8 gText_Box[]; -extern const u8 gText_JustOnePkmn[]; - extern u8 gUnknown_02039D00; extern u8 sBoxOption; extern u8 gUnknown_02039D10; @@ -117,6 +113,12 @@ extern void sub_80F9BF4(u16, u16, u8); extern bool8 sub_80F9C1C(void); extern bool8 sub_80F9C30(void); +extern const struct CompressedSpriteSheet gMonFrontPicTable[]; + +extern const u8 gText_PartyFull[]; +extern const u8 gText_Box[]; +extern const u8 gText_JustOnePkmn[]; + // This file's functions. void CreatePCMenu(u8 whichMenu, s16 *windowIdPtr); void Cb2_EnterPSS(u8 boxOption); @@ -161,7 +163,7 @@ void sub_80D01B8(void); void sub_80CE2D8(void); void sub_80D25F0(void); void sub_80CA230(void); -void sub_80CA318(void); +void LoadCursorMonSprite(void); void sub_80CA154(void); void sub_80CA1C4(void); void sub_80CC064(void); @@ -171,7 +173,8 @@ void sub_80CA704(void); void sub_80D013C(void); void sub_80CE00C(void); void sub_80D1194(void); -void sub_80CA4FC(void); +void PrintCursorMonInfo(void); +void sub_80CA65C(void); void sub_80CADD8(void); void sub_80D1818(void); void sub_80D17B4(void); @@ -247,6 +250,7 @@ void sub_80D2A90(struct UnkStruct_2000020 *arg0, struct UnkStruct_2000028 *arg1, void sub_80D259C(u8 arg0); void sub_80CC464(u8 arg0); void sub_80CFE54(u8 arg0); +void sub_80D2918(u8 arg0); void sub_80CC0D4(u8 arg0); void sub_80CDC38(u8 arg0); void sub_80CE9A8(u8 markings); @@ -269,6 +273,9 @@ void SetWallpaperForCurrentBox(u8 wallpaperId); void sub_80CAE0C(u8 arg0); u16 GetMovingItem(void); void SetCurrentBoxMonData(s32 monId, s32 request, const void *value); +void LoadCursorMonGfx(u16 species, u32 pid); +void sub_80CA2D0(struct Sprite *sprite); +void sub_80D27AC(u8 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4); // const rom data const struct PSS_MenuStringPtrs gUnknown_085716C0[] = @@ -459,7 +466,7 @@ const struct SpriteSheet gWaveformSpriteSheet = }; const struct OamData sOamData_857286C; -const struct SpriteTemplate gUnknown_08572754 = +const struct SpriteTemplate sSpriteTemplate_CursorMon = { .tileTag = TAG_TILE_2, .paletteTag = TAG_PAL_DAC6, @@ -2275,7 +2282,7 @@ void Cb_TakeItemForMoving(u8 taskId) sub_80CFE54(3); ClearBottomWindow(); sub_80CE00C(); - sub_80CA4FC(); + PrintCursorMonInfo(); gUnknown_02039D08->state++; } break; @@ -2304,7 +2311,7 @@ void Cb_GiveMovingItemToMon(u8 taskId) { sub_80CFE54(0); sub_80CE00C(); - sub_80CA4FC(); + PrintCursorMonInfo(); PrintStorageActionText(PC_TEXT_ITEM_IS_HELD); gUnknown_02039D08->state++; } @@ -2353,7 +2360,7 @@ void Cb_ItemToBag(u8 taskId) { ClearBottomWindow(); sub_80CE00C(); - sub_80CA4FC(); + PrintCursorMonInfo(); gUnknown_02039D08->state = 4; } break; @@ -2396,7 +2403,7 @@ void Cb_SwitchSelectedItem(u8 taskId) { sub_80CFE54(3); sub_80CE00C(); - sub_80CA4FC(); + PrintCursorMonInfo(); PrintStorageActionText(PC_TEXT_CHANGED_TO_ITEM); gUnknown_02039D08->state++; } @@ -3029,7 +3036,7 @@ void sub_80CA0D8(void) LoadPalette(gUnknown_0857243C, 0x30, 0x20); SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(1) | BGCNT_CHARBASE(1) | BGCNT_16COLOR | BGCNT_SCREENBASE(30)); - sub_80CA318(); + LoadCursorMonSprite(); sub_80CA154(); sub_80CA1C4(); sub_80CA230(); @@ -3057,3 +3064,155 @@ void sub_80CA1C4(void) gUnknown_02039D08->field_D98[i] = &gSprites[spriteId]; } } + +void sub_80CA230(void) +{ + LoadCursorMonGfx(gUnknown_02039D08->cursorMonSpecies, gUnknown_02039D08->cursorMonPersonality); + PrintCursorMonInfo(); + sub_80CA65C(); + schedule_bg_copy_tilemap_to_vram(0); +} + +void BoxSetMosaic(void) +{ + sub_80CA230(); + if (gUnknown_02039D08->cursorMonSprite) + { + gUnknown_02039D08->cursorMonSprite->oam.mosaic = TRUE; + gUnknown_02039D08->cursorMonSprite->data[0] = 10; + gUnknown_02039D08->cursorMonSprite->data[1] = 1; + gUnknown_02039D08->cursorMonSprite->callback = sub_80CA2D0; + SetGpuReg(REG_OFFSET_MOSAIC, (gUnknown_02039D08->cursorMonSprite->data[0] << 12) | (gUnknown_02039D08->cursorMonSprite->data[0] << 8)); + } +} + +u8 sub_80CA2B8(void) +{ + return gUnknown_02039D08->cursorMonSprite->oam.mosaic; +} + +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; + } +} + +void LoadCursorMonSprite(void) +{ + u16 i; + u16 tileStart; + u8 palSlot; + u8 spriteId; + struct SpriteSheet sheet = {gUnknown_02039D08->field_22C4, 0x800, TAG_TILE_2}; + struct SpritePalette palette = {gUnknown_02039D08->field_2244, TAG_PAL_DAC6}; + struct SpriteTemplate template = sSpriteTemplate_CursorMon; + + for (i = 0; i < 0x800; i++) + gUnknown_02039D08->field_22C4[i] = 0; + for (i = 0; i < 0x10; i++) + gUnknown_02039D08->field_2244[i] = 0; + + gUnknown_02039D08->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; + + gUnknown_02039D08->cursorMonSprite = &gSprites[spriteId]; + gUnknown_02039D08->field_223A = palSlot * 16 + 0x100; + gUnknown_02039D08->field_223C = (void*) OBJ_VRAM0 + tileStart * 32; + } while (0); + + if (gUnknown_02039D08->cursorMonSprite == NULL) + { + FreeSpriteTilesByTag(TAG_TILE_2); + FreeSpritePaletteByTag(TAG_PAL_DAC6); + } +} + +void LoadCursorMonGfx(u16 species, u32 pid) +{ + if (gUnknown_02039D08->cursorMonSprite == NULL) + return; + + if (species != SPECIES_NONE) + { + LoadSpecialPokePic(&gMonFrontPicTable[species], gUnknown_02039D08->field_22C4, species, pid, TRUE); + LZ77UnCompWram(gUnknown_02039D08->field_CDC, gUnknown_02039D08->field_2244); + CpuCopy32(gUnknown_02039D08->field_22C4, gUnknown_02039D08->field_223C, 0x800); + LoadPalette(gUnknown_02039D08->field_2244, gUnknown_02039D08->field_223A, 0x20); + gUnknown_02039D08->cursorMonSprite->invisible = FALSE; + } + else + { + gUnknown_02039D08->cursorMonSprite->invisible = TRUE; + } +} + +void PrintCursorMonInfo(void) +{ + FillWindowPixelBuffer(0, 0x11); + if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + { + AddTextPrinterParameterized(0, 1, gUnknown_02039D08->cursorMonNick, 6, 0, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, 2, gUnknown_02039D08->cursorMonSpeciesName, 6, 15, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, 2, gUnknown_02039D08->cursorMonGenderLvlText, 10, 29, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, 0, gUnknown_02039D08->cursorMonItemName, 6, 43, TEXT_SPEED_FF, NULL); + } + else + { + AddTextPrinterParameterized(0, 0, gUnknown_02039D08->cursorMonItemName, 6, 0, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, 1, gUnknown_02039D08->cursorMonNick, 6, 13, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, 2, gUnknown_02039D08->cursorMonSpeciesName, 6, 28, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, 2, gUnknown_02039D08->cursorMonGenderLvlText, 10, 42, TEXT_SPEED_FF, NULL); + } + + CopyWindowToVram(0, 2); + if (gUnknown_02039D08->cursorMonSpecies != SPECIES_NONE) + { + sub_8120084(gUnknown_02039D08->field_CEB, gUnknown_02039D08->field_DA0); + gUnknown_02039D08->field_D94->invisible = FALSE; + } + else + { + gUnknown_02039D08->field_D94->invisible = TRUE; + } +} + +void sub_80CA65C(void) +{ + u16 i; + + if (gUnknown_02039D08->cursorMonSpecies != SPECIES_NONE) + { + sub_80D27AC(0, 0, 0, 8, 2); + for (i = 0; i < 2; i++) + StartSpriteAnimIfDifferent(gUnknown_02039D08->field_D98[i], i * 2 + 1); + } + else + { + sub_80D27AC(0, 0, 2, 8, 2); + for (i = 0; i < 2; i++) + StartSpriteAnim(gUnknown_02039D08->field_D98[i], i * 2); + } + + sub_80D2918(0); + schedule_bg_copy_tilemap_to_vram(1); +} From 59a69eb62769003a81c0f9f50be5ec5abde96242 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 12 Dec 2018 23:19:50 +0100 Subject: [PATCH 06/13] Storage up to icon palettes --- asm/pokemon_storage_system.s | 1022 +----------------------------- data/pokemon_storage_system.s | 313 --------- include/graphics.h | 2 + include/menu.h | 1 + include/pokemon_storage_system.h | 39 +- src/pokemon_storage_system.c | 693 ++++++++++++++++++-- sym_ewram.txt | 4 +- 7 files changed, 664 insertions(+), 1410 deletions(-) diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index 1823b9e94..642dc0270 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -8,1022 +8,6 @@ - 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, =sInPartyMenu - 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, =sInPartyMenu - 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, =sInPartyMenu - 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 PrintStorageActionText -PrintStorageActionText: @ 80CAC58 - push {r4-r6,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r6, r0, 24 - bl DynamicPlaceholderTextUtil_Reset - ldr r1, =gPCStorageActionTexts - 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, =gPCStorageActionTexts - 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 PrintStorageActionText - - 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 ClearBottomWindow -ClearBottomWindow: @ 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 ClearBottomWindow - - 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, =sBoxOption - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80CAEA0 - - thumb_func_start sub_80CAEAC -sub_80CAEAC: @ 80CAEAC - push {lr} - bl IsCursorOnBox - lsls r0, 24 - cmp r0, 0 - bne _080CAEE8 - ldr r0, =sInPartyMenu - ldrb r0, [r0] - cmp r0, 0 - beq _080CAED8 - bl GetBoxCursorPosition - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0x1 - bl sub_80D0D8C - b _080CAEE8 - .pool -_080CAED8: - bl GetBoxCursorPosition - 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} @@ -12962,8 +11946,8 @@ _080D12B2: bx r1 thumb_func_end sub_80D127C - thumb_func_start sub_80D12B8 -sub_80D12B8: @ 80D12B8 + thumb_func_start GetMovingItemName +GetMovingItemName: @ 80D12B8 push {lr} ldr r0, =gUnknown_02039D08 ldr r0, [r0] @@ -12974,7 +11958,7 @@ sub_80D12B8: @ 80D12B8 pop {r1} bx r1 .pool - thumb_func_end sub_80D12B8 + thumb_func_end GetMovingItemName thumb_func_start GetMovingItem GetMovingItem: @ 80D12D4 diff --git a/data/pokemon_storage_system.s b/data/pokemon_storage_system.s index 4bd6b8c1a..83344022f 100644 --- a/data/pokemon_storage_system.s +++ b/data/pokemon_storage_system.s @@ -4,319 +4,6 @@ .section .rodata - .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" diff --git a/include/graphics.h b/include/graphics.h index a07a669d6..658239f5c 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4742,5 +4742,7 @@ extern const u16 gPokedexAreaScreenAreaUnknown_Pal[]; // Pokemon Storage System extern const u32 gPSSMenu_Gfx[]; +extern const u16 gPSSMenu_Pal[]; +extern const u32 gUnknown_08DD36C8[]; #endif //GUARD_GRAPHICS_H diff --git a/include/menu.h b/include/menu.h index eb525efe9..e7a78f76e 100644 --- a/include/menu.h +++ b/include/menu.h @@ -72,6 +72,7 @@ u8 sub_8199134(s8, s8); u8 GetStartMenuWindowId(void); void sub_819A2BC(u8, u8); u8 MoveMenuCursor(s8 cursorDelta); +u8 MoveMenuCursorNoWrapAround(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/pokemon_storage_system.h b/include/pokemon_storage_system.h index d3beb88ab..d36f4b358 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -72,14 +72,21 @@ struct PokemonStorageSystemData u8 unk_0005; struct UnkStruct_2000020 unk_0020; struct UnkStruct_2000028 unk_0028[8]; - u8 unk_90[567]; + u16 field_90[16]; + 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; - u8 unk_02C9; + bool8 unk_02C9; s16 newCurrBoxId; u16 bg2_X; u8 field_2CE; - u8 field_2CF[1215]; + u8 field_2CF[1213]; + u16 field_78C; s16 wallpaperSetId; s16 wallpaperId; u8 wallpaperTilemap[180 * 4]; @@ -90,8 +97,13 @@ struct PokemonStorageSystemData u8 field_A66; u8 field_A67; u8 *wallpaperTilemapPtr; - u8 field_A6C; - u8 field_A6D[623]; + struct Sprite *field_A6C; + struct Sprite *partySprites[PARTY_SIZE]; + struct Sprite *boxMonsSprites[IN_BOX_COUNT]; + u8 field_B00[8]; + u16 field_B08[40]; + u16 field_B58[40]; + u8 field_BA8[308]; u32 *field_CDC; u32 cursorMonPersonality; u16 cursorMonSpecies; @@ -101,17 +113,7 @@ struct PokemonStorageSystemData u8 field_CEB; u8 field_CEC; u8 field_CED; - u8 field_CEE; - u8 field_CEF; - u8 field_CF0; - u8 field_CF1; - u8 field_CF2; - u8 field_CF3; - u8 field_CF4; - u8 field_CF5; - u8 field_CF6; - u8 field_CF7; - u8 field_CF8; + u8 field_CEE[POKEMON_NAME_LENGTH + 1]; u8 cursorMonNick[36]; u8 cursorMonSpeciesName[36]; u8 cursorMonGenderLvlText[36]; @@ -132,7 +134,10 @@ struct PokemonStorageSystemData u8 field_2187; u8 field_2188; struct BoxPokemon *field_218C; - u8 field_2190[164]; + u8 field_2190[80]; + u8 field_21E0[POKEMON_NAME_LENGTH + 1]; + u8 field_21EB[15]; // TODO: ITEM NAME LENGTH + 1 + u8 field_21FA[58]; u16 movingItem; u8 field_2236; u8 field_2237; diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index edf322235..a37d38813 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -3,6 +3,7 @@ #include "bg.h" #include "decompress.h" #include "dma3.h" +#include "dynamic_placeholder_text_util.h" #include "event_data.h" #include "field_screen.h" #include "field_weather.h" @@ -19,6 +20,7 @@ #include "overworld.h" #include "palette.h" #include "pokemon.h" +#include "pokemon_icon.h" #include "pokemon_summary_screen.h" #include "pokemon_storage_system.h" #include "script.h" @@ -33,6 +35,13 @@ #include "constants/songs.h" #include "constants/species.h" +struct WallpaperTable +{ + const u32 *tiles; + const u32 *tileMap; + const u16 *palettes; +}; + enum { BOX_OPTION_WITHDRAW, @@ -77,6 +86,18 @@ enum 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, @@ -99,8 +120,8 @@ enum IWRAM_DATA u8 gUnknown_03000F78[0x188]; -extern u8 gUnknown_02039D00; -extern u8 sBoxOption; +extern u8 sPreviousBoxOption; +extern u8 sCurrentBoxOption; extern u8 gUnknown_02039D10; extern u8 gUnknown_02039D0E; extern bool8 sInPartyMenu; @@ -122,7 +143,7 @@ extern const u8 gText_JustOnePkmn[]; // This file's functions. void CreatePCMenu(u8 whichMenu, s16 *windowIdPtr); void Cb2_EnterPSS(u8 boxOption); -u8 sub_80CAEA0(void); +u8 GetCurrentBoxOption(void); u8 sub_80CF9EC(void); u8 sub_80CDC2C(void); void SetBoxWallpaper(u8 boxId, u8 wallpaperId); @@ -141,7 +162,9 @@ void sub_80CAA14(void); void sub_80CE790(void); void sub_80CE8E4(void); void GiveChosenBagItem(void); -void sub_80CA888(void); +void SetUpHidePartyMenu(void); +void sub_80CBB9C(void); +void sub_80D11CC(void); void LoadPSSMenuGfx(void); void LoadWaveformSpritePalette(void); void sub_80CDC18(void); @@ -176,9 +199,12 @@ void sub_80D1194(void); void PrintCursorMonInfo(void); void sub_80CA65C(void); void sub_80CADD8(void); +void sub_80CFEF0(void); void sub_80D1818(void); +void sub_80CAA74(void); void sub_80D17B4(void); void sub_80CE760(void); +void sub_80CDBA0(void); void sub_80CE7E8(void); void sub_80CFECC(void); void sub_80CA9EC(void); @@ -187,6 +213,7 @@ void sub_80CAB20(void); void sub_80CE22C(void); void sub_80CB950(void); void sub_80CA9C0(void); +void SetUpDoShowPartyMenu(void); void BoxSetMosaic(void); void sub_80C7CF4(struct Sprite *sprite); bool8 InitPSSWindows(void); @@ -195,15 +222,14 @@ 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 DoShowPartyMenu(void); bool8 sub_80D1218(void); bool8 sub_80CB9BC(void); bool8 ScrollToBox(void); bool8 sub_80CD554(void); -bool8 sub_80CA8C8(void); +bool8 HidePartyMenu(void); bool8 sub_80D127C(void); bool8 sub_80CA2B8(void); bool8 DoWallpaperGfxChange(void); @@ -212,6 +238,7 @@ bool8 sub_80D00A8(void); bool8 CanMoveMon(void); bool8 CanShifMon(void); bool8 IsCursorOnCloseBox(void); +bool8 IsCursorOnBox(void); bool8 IsMonBeingMoved(void); bool8 sub_80CE19C(u8 arg0); void Cb_InitPSS(u8 taskId); @@ -239,7 +266,7 @@ void Cb_ShowMarkMenu(u8 taskId); void Cb_ShowMonSummary(u8 taskId); void Cb_ReleaseMon(u8 taskId); void task_pokemon_box_related(u8 taskId); -void Cb_ReshowPSSAfterChoosingBagItem(u8 taskId); +void Cb_ReshowPSS(u8 taskId); void Cb_MainPSS(u8 taskId); void Cb_JumpBox(u8 taskId); void Cb_HandleWallpapers(u8 taskId); @@ -254,11 +281,13 @@ void sub_80D2918(u8 arg0); void sub_80CC0D4(u8 arg0); void sub_80CDC38(u8 arg0); void sub_80CE9A8(u8 markings); -void sub_80CAD9C(u8 arg0); +void ShowYesNoWindow(s8 cursorPos); 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_80CA984(bool8 arg0); +void sub_80CB7E8(bool8 arg0); +void sub_80D2644(u8 arg0, u16 arg1, const void *arg2, u16 arg3, u16 arg4); void sub_80D2770(u8 arg0, u16 arg1, u16 arg2); void PrintStorageActionText(u8 id); s16 sub_80D00AC(void); @@ -270,12 +299,20 @@ 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); +void sub_80CAE0C(u8 wallpaperSet); u16 GetMovingItem(void); void SetCurrentBoxMonData(s32 monId, s32 request, const void *value); void LoadCursorMonGfx(u16 species, u32 pid); void sub_80CA2D0(struct Sprite *sprite); void sub_80D27AC(u8 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4); +void sub_80D27F4(u8 arg0, u8 arg1, s8 arg2); +void sub_80CBAF0(s16 arg0); +void sub_80CAAA8(u8 arg0, bool8 isPartyMon); +const u8 *GetMovingItemName(void); +bool32 IsWaldaWallpaperUnlocked(void); +void sub_80CFF34(u8 arg0); +void sub_80D0D8C(bool8 arg0, u8 cursorPos); +void sub_80D0F38(u16 item); // const rom data const struct PSS_MenuStringPtrs gUnknown_085716C0[] = @@ -479,40 +516,40 @@ const struct SpriteTemplate sSpriteTemplate_CursorMon = const struct StorageAction gPCStorageActionTexts[] = { - [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}, + [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}, }; -const struct WindowTemplate gUnknown_08572864 = +const struct WindowTemplate sYesNoWindowTemplate = { .bg = 0, .tilemapLeft = 24, @@ -652,6 +689,179 @@ const union AffineAnimCmd *const gSpriteAffineAnimTable_857291C[] = gSpriteAffineAnim_8572904 }; +const u16 gWallpaperPalettes_Forest[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/forest_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/forest_bg.gbapal"), +}; +const u32 gWallpaperTiles_Forest[] = INCBIN_U32("graphics/pokemon_storage/forest.4bpp.lz"); +const u32 gWallpaperTilemap_Forest[] = INCBIN_U32("graphics/pokemon_storage/forest.bin.lz"); + +const u16 gWallpaperPalettes_City[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/city_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/city_bg.gbapal"), +}; +const u32 gWallpaperTiles_City[] = INCBIN_U32("graphics/pokemon_storage/city.4bpp.lz"); +const u32 gWallpaperTilemap_City[] = INCBIN_U32("graphics/pokemon_storage/city.bin.lz"); + +const u16 gWallpaperPalettes_Desert[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/desert_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/desert_bg.gbapal"), +}; +const u32 gWallpaperTiles_Desert[] = INCBIN_U32("graphics/pokemon_storage/desert.4bpp.lz"); +const u32 gWallpaperTilemap_Desert[] = INCBIN_U32("graphics/pokemon_storage/desert.bin.lz"); + +const u16 gWallpaperPalettes_Savanna[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/savanna_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/savanna_bg.gbapal"), +}; +const u32 gWallpaperTiles_Savanna[] = INCBIN_U32("graphics/pokemon_storage/savanna.4bpp.lz"); +const u32 gWallpaperTilemap_Savanna[] = INCBIN_U32("graphics/pokemon_storage/savanna.bin.lz"); + +const u16 gWallpaperPalettes_Crag[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/crag_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/crag_bg.gbapal"), +}; +const u32 gWallpaperTiles_Crag[] = INCBIN_U32("graphics/pokemon_storage/crag.4bpp.lz"); +const u32 gWallpaperTilemap_Crag[] = INCBIN_U32("graphics/pokemon_storage/crag.bin.lz"); + +const u16 gWallpaperPalettes_Volcano[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/volcano_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/volcano_bg.gbapal"), +}; +const u32 gWallpaperTiles_Volcano[] = INCBIN_U32("graphics/pokemon_storage/volcano.4bpp.lz"); +const u32 gWallpaperTilemap_Volcano[] = INCBIN_U32("graphics/pokemon_storage/volcano.bin.lz"); + +const u16 gWallpaperPalettes_Snow[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/snow_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/snow_bg.gbapal"), +}; +const u32 gWallpaperTiles_Snow[] = INCBIN_U32("graphics/pokemon_storage/snow.4bpp.lz"); +const u32 gWallpaperTilemap_Snow[] = INCBIN_U32("graphics/pokemon_storage/snow.bin.lz"); + +const u16 gWallpaperPalettes_Cave[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/cave_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/cave_bg.gbapal"), +}; +const u32 gWallpaperTiles_Cave[] = INCBIN_U32("graphics/pokemon_storage/cave.4bpp.lz"); +const u32 gWallpaperTilemap_Cave[] = INCBIN_U32("graphics/pokemon_storage/cave.bin.lz"); + +const u16 gWallpaperPalettes_Beach[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/beach_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/beach_bg.gbapal"), +}; +const u32 gWallpaperTiles_Beach[] = INCBIN_U32("graphics/pokemon_storage/beach.4bpp.lz"); +const u32 gWallpaperTilemap_Beach[] = INCBIN_U32("graphics/pokemon_storage/beach.bin.lz"); + +const u16 gWallpaperPalettes_Seafloor[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/seafloor_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/seafloor_bg.gbapal"), +}; +const u32 gWallpaperTiles_Seafloor[] = INCBIN_U32("graphics/pokemon_storage/seafloor.4bpp.lz"); +const u32 gWallpaperTilemap_Seafloor[] = INCBIN_U32("graphics/pokemon_storage/seafloor.bin.lz"); + +const u16 gWallpaperPalettes_River[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/river_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/river_bg.gbapal"), +}; +const u32 gWallpaperTiles_River[] = INCBIN_U32("graphics/pokemon_storage/river.4bpp.lz"); +const u32 gWallpaperTilemap_River[] = INCBIN_U32("graphics/pokemon_storage/river.bin.lz"); +const u16 gWallpaperPalettes_Sky[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/sky_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/sky_bg.gbapal"), +}; +const u32 gWallpaperTiles_Sky[] = INCBIN_U32("graphics/pokemon_storage/sky.4bpp.lz"); +const u32 gWallpaperTilemap_Sky[] = INCBIN_U32("graphics/pokemon_storage/sky.bin.lz"); + +const u16 gWallpaperPalettes_PolkaDot[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/polkadot_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/polkadot_bg.gbapal"), +}; +const u32 gWallpaperTiles_PolkaDot[] = INCBIN_U32("graphics/pokemon_storage/polkadot.4bpp.lz"); +const u32 gWallpaperTilemap_PolkaDot[] = INCBIN_U32("graphics/pokemon_storage/polkadot.bin.lz"); + +const u16 gWallpaperPalettes_Pokecenter[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/pokecenter_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/pokecenter_bg.gbapal"), +}; +const u32 gWallpaperTiles_Pokecenter[] = INCBIN_U32("graphics/pokemon_storage/pokecenter.4bpp.lz"); +const u32 gWallpaperTilemap_Pokecenter[] = INCBIN_U32("graphics/pokemon_storage/pokecenter.bin.lz"); + +const u16 gWallpaperPalettes_Machine[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/machine_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/machine_bg.gbapal"), +}; +const u32 gWallpaperTiles_Machine[] = INCBIN_U32("graphics/pokemon_storage/machine.4bpp.lz"); +const u32 gWallpaperTilemap_Machine[] = INCBIN_U32("graphics/pokemon_storage/machine.bin.lz"); + +const u16 gWallpaperPalettes_Plain[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/plain_frame.gbapal"), + INCBIN_U16("graphics/pokemon_storage/plain_bg.gbapal"), +}; +const u32 gWallpaperTiles_Plain[] = INCBIN_U32("graphics/pokemon_storage/plain.4bpp.lz"); +const u32 gWallpaperTilemap_Plain[] = INCBIN_U32("graphics/pokemon_storage/plain.bin.lz"); + +// 12×18 tilemap +const u32 gUnknown_085773C4[] = INCBIN_U32("graphics/unused/tilemap_5773C4.bin"); + +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]} + +const struct WallpaperTable gWallpaperTable[] = +{ + WALLPAPER_ENTRY(Forest), + WALLPAPER_ENTRY(City), + WALLPAPER_ENTRY(Desert), + WALLPAPER_ENTRY(Savanna), + WALLPAPER_ENTRY(Crag), + WALLPAPER_ENTRY(Volcano), + WALLPAPER_ENTRY(Snow), + WALLPAPER_ENTRY(Cave), + WALLPAPER_ENTRY(Beach), + WALLPAPER_ENTRY(Seafloor), + WALLPAPER_ENTRY(River), + WALLPAPER_ENTRY(Sky), + WALLPAPER_ENTRY(PolkaDot), + WALLPAPER_ENTRY(Pokecenter), + WALLPAPER_ENTRY(Machine), + WALLPAPER_ENTRY(Plain), +}; + // code u8 CountMonsInBox(u8 boxId) { @@ -915,7 +1125,7 @@ void FieldCb_ReturnToPcMenu(void) SetVBlankCallback(NULL); taskId = CreateTask(Task_PokemonStorageSystemPC, 80); gTasks[taskId].data[0] = 0; - gTasks[taskId].data[1] = gUnknown_02039D00; + gTasks[taskId].data[1] = sPreviousBoxOption; Task_PokemonStorageSystemPC(taskId); SetVBlankCallback(vblankCb); pal_fill_black(); @@ -936,7 +1146,7 @@ void CreatePCMenu(u8 whichMenu, s16 *windowIdPtr) void Cb2_ExitPSS(void) { - gUnknown_02039D00 = sub_80CAEA0(); + sPreviousBoxOption = GetCurrentBoxOption(); gFieldCallback = FieldCb_ReturnToPcMenu; SetMainCallback2(CB2_ReturnToField); } @@ -1219,7 +1429,7 @@ void Cb2_PSS(void) void Cb2_EnterPSS(u8 boxOption) { ResetTasks(); - sBoxOption = boxOption; + sCurrentBoxOption = boxOption; gUnknown_02039D08 = Alloc(sizeof(*gUnknown_02039D08)); if (gUnknown_02039D08 == NULL) { @@ -1247,7 +1457,7 @@ void Cb2_ReturnToPSS(void) } else { - gUnknown_02039D08->boxOption = sBoxOption; + gUnknown_02039D08->boxOption = sCurrentBoxOption; gUnknown_02039D08->isReshowingPSS = TRUE; gUnknown_02039D08->state = 0; gUnknown_02039D08->taskId = CreateTask(Cb_InitPSS, 3); @@ -1406,7 +1616,7 @@ void Cb_InitPSS(u8 taskId) else { BlendPalettes(0xFFFFFFFF, 0x10, 0); - SetPSSCallback(Cb_ReshowPSSAfterChoosingBagItem); + SetPSSCallback(Cb_ReshowPSS); } SetVBlankCallback(VblankCb_PSS); return; @@ -1433,7 +1643,7 @@ void Cb_ShowPSS(u8 taskId) } } -void Cb_ReshowPSSAfterChoosingBagItem(u8 taskId) +void Cb_ReshowPSS(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -1736,11 +1946,11 @@ void Cb_ShowPartyPokemon(u8 taskId) switch (gUnknown_02039D08->state) { case 0: - sub_80CAB4C(); + SetUpDoShowPartyMenu(); gUnknown_02039D08->state++; break; case 1: - if (!sub_80CAB70()) + if (!DoShowPartyMenu()) SetPSSCallback(Cb_MainPSS); break; } @@ -1752,11 +1962,11 @@ void Cb_HidePartyPokemon(u8 taskId) { case 0: PlaySE(SE_SELECT); - sub_80CA888(); + SetUpHidePartyMenu(); gUnknown_02039D08->state++; break; case 1: - if (!sub_80CA8C8()) + if (!HidePartyMenu()) { sub_80CDBF8(sub_80CDC2C()); gUnknown_02039D08->state++; @@ -2016,12 +2226,12 @@ void Cb_WithdrawMon(u8 taskId) if (!sub_80CDCAC()) { sub_80CC0D4(1); - sub_80CAB4C(); + SetUpDoShowPartyMenu(); gUnknown_02039D08->state++; } break; case 3: - if (!sub_80CAB70()) + if (!DoShowPartyMenu()) { sub_80CDC38(1); gUnknown_02039D08->state++; @@ -2109,7 +2319,7 @@ void Cb_ReleaseMon(u8 taskId) { case 0: PrintStorageActionText(PC_TEXT_RELEASE_POKE); - sub_80CAD9C(1); + ShowYesNoWindow(1); gUnknown_02039D08->state++; // fallthrough case 1: @@ -2472,7 +2682,7 @@ void Cb_CloseBoxWhileHoldingItem(u8 taskId) case 0: PlaySE(SE_SELECT); PrintStorageActionText(PC_TEXT_PUT_IN_BAG); - sub_80CAD9C(0); + ShowYesNoWindow(0); gUnknown_02039D08->state = 1; break; case 1: @@ -2814,7 +3024,7 @@ void Cb_OnCloseBoxPressed(u8 taskId) { PlaySE(SE_SELECT); PrintStorageActionText(PC_TEXT_EXIT_BOX); - sub_80CAD9C(0); + ShowYesNoWindow(0); gUnknown_02039D08->state = 2; } break; @@ -2875,7 +3085,7 @@ void Cb_OnBPressed(u8 taskId) { PlaySE(SE_SELECT); PrintStorageActionText(PC_TEXT_CONTINUE_BOX); - sub_80CAD9C(0); + ShowYesNoWindow(0); gUnknown_02039D08->state = 2; } break; @@ -3216,3 +3426,368 @@ void sub_80CA65C(void) sub_80D2918(0); schedule_bg_copy_tilemap_to_vram(1); } + +void sub_80CA704(void) +{ + LZ77UnCompWram(gUnknown_08DD36C8, gUnknown_02039D08->field_B0); + LoadPalette(gPSSMenu_Pal, 0x10, 0x20); + sub_80D2644(1, 1, gUnknown_02039D08->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); + sub_80CB7E8(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); + gUnknown_02039D08->unk_02C7 = 0; +} + +void SetUpShowPartyMenu(void) +{ + gUnknown_02039D08->field_2C0 = 20; + gUnknown_02039D08->field_2C2 = 2; + gUnknown_02039D08->field_2C5 = 0; + sub_80CB7E8(FALSE); +} + +bool8 ShowPartyMenu(void) +{ + if (gUnknown_02039D08->field_2C5 == 20) + return FALSE; + + gUnknown_02039D08->field_2C0--; + gUnknown_02039D08->field_2C2++; + sub_80D27F4(1, 3, 1); + sub_80D2918(1); + schedule_bg_copy_tilemap_to_vram(1); + sub_80CBAF0(8); + if (++gUnknown_02039D08->field_2C5 == 20) + { + sInPartyMenu = TRUE; + return FALSE; + } + else + { + return TRUE; + } +} + +void SetUpHidePartyMenu(void) +{ + gUnknown_02039D08->field_2C0 = 0; + gUnknown_02039D08->field_2C2 = 22; + gUnknown_02039D08->field_2C5 = 0; + if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + sub_80D11CC(); +} + +bool8 HidePartyMenu(void) +{ + if (gUnknown_02039D08->field_2C5 != 20) + { + gUnknown_02039D08->field_2C0++; + gUnknown_02039D08->field_2C2--; + sub_80D27F4(1, 3, -1); + sub_80D2918(1); + FillBgTilemapBufferRect_Palette0(1, 0x100, 10, gUnknown_02039D08->field_2C2, 12, 1); + sub_80CBAF0(-8); + if (++gUnknown_02039D08->field_2C5 != 20) + { + schedule_bg_copy_tilemap_to_vram(1); + return TRUE; + } + else + { + sInPartyMenu = FALSE; + sub_80CBB9C(); + CompactPartySlots(); + sub_80D27AC(2, 0, 0, 9, 2); + sub_80D2918(2); + schedule_bg_copy_tilemap_to_vram(1); + return FALSE; + } + } + + return FALSE; +} + +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); +} + +void sub_80CA9C0(void) +{ + gUnknown_02039D08->unk_02C7 = 1; + gUnknown_02039D08->unk_02C8 = 30; + gUnknown_02039D08->unk_02C9 = TRUE; +} + +void sub_80CA9EC(void) +{ + if (gUnknown_02039D08->unk_02C7) + { + gUnknown_02039D08->unk_02C7 = 0; + sub_80CA984(TRUE); + } +} + +void sub_80CAA14(void) +{ + if (gUnknown_02039D08->unk_02C7 && ++gUnknown_02039D08->unk_02C8 > 30) + { + gUnknown_02039D08->unk_02C8 = 0; + gUnknown_02039D08->unk_02C9 = (gUnknown_02039D08->unk_02C9 == FALSE); + sub_80CA984(gUnknown_02039D08->unk_02C9); + } +} + +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)); + } +} + +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++) + { + gUnknown_02039D08->field_B0[index + j] = data[j]; + } + data += 4; + index += 12; + } +} + +void sub_80CAB20(void) +{ + sub_80CAA74(); + sub_80D27AC(1, 0, 0, 12, 22); + sub_80D2918(1); + schedule_bg_copy_tilemap_to_vram(1); +} + +void SetUpDoShowPartyMenu(void) +{ + gUnknown_02039D08->showPartyMenuState = 0; + PlaySE(SE_WIN_OPEN); + SetUpShowPartyMenu(); +} + +bool8 DoShowPartyMenu(void) +{ + switch (gUnknown_02039D08->showPartyMenuState) + { + case 0: + if (!ShowPartyMenu()) + { + sub_80CDBA0(); + gUnknown_02039D08->showPartyMenuState++; + } + break; + case 1: + if (!sub_80CD554()) + { + if (gUnknown_02039D08->field_CEA) + BoxSetMosaic(); + gUnknown_02039D08->showPartyMenuState++; + } + break; + case 2: + return FALSE; + } + return TRUE; +} + +void sub_80CABE0(void) +{ + if (gUnknown_02039D10 != StorageGetCurrentBox()) + { + FlagClear(FLAG_SYS_STORAGE_UNKNOWN_FLAG); + VarSet(VAR_STORAGE_UNKNOWN, StorageGetCurrentBox()); + } +} + +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); +} + +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, gUnknown_02039D08->field_CEE); + 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, gUnknown_02039D08->field_21E0); + break; + case PC_TEXT_FMT_ITEM_NAME: + if (sub_80D127C()) + txtPtr = StringCopy(gUnknown_02039D08->field_21EB, GetMovingItemName()); + else + txtPtr = StringCopy(gUnknown_02039D08->field_21EB, gUnknown_02039D08->cursorMonItemName); + + while (*(txtPtr - 1) == CHAR_SPACE) + txtPtr--; + + *txtPtr = EOS; + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_02039D08->field_21EB); + break; + } + + DynamicPlaceholderTextUtil_ExpandPlaceholders(gUnknown_02039D08->field_2190, gPCStorageActionTexts[id].text); + FillWindowPixelBuffer(1, 0x11); + AddTextPrinterParameterized(1, 1, gUnknown_02039D08->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); +} + +void ShowYesNoWindow(s8 cursorPos) +{ + CreateYesNoMenu(&sYesNoWindowTemplate, 11, 14, 0); + MoveMenuCursorNoWrapAround(cursorPos); +} + +void ClearBottomWindow(void) +{ + sub_8198070(1, FALSE); + schedule_bg_copy_tilemap_to_vram(0); +} + +void sub_80CADD8(void) +{ + sub_80CFEF0(); + sub_80CFF34(18); + sub_80CFF34(19); + sub_80CFF34(20); + sub_80CFF34(21); + if (IsWaldaWallpaperUnlocked()) + sub_80CFF34(22); + sub_80CFFD0(); +} + +void sub_80CAE0C(u8 wallpaperSet) +{ + sub_80CFEF0(); + switch (wallpaperSet) + { + case 0: + sub_80CFF34(23); + sub_80CFF34(24); + sub_80CFF34(25); + sub_80CFF34(26); + break; + case 1: + sub_80CFF34(27); + sub_80CFF34(28); + sub_80CFF34(29); + sub_80CFF34(30); + break; + case 2: + sub_80CFF34(31); + sub_80CFF34(32); + sub_80CFF34(33); + sub_80CFF34(34); + break; + case 3: + sub_80CFF34(35); + sub_80CFF34(36); + sub_80CFF34(37); + sub_80CFF34(38); + break; + } + sub_80CFFD0(); +} + +u8 GetCurrentBoxOption(void) +{ + return sCurrentBoxOption; +} + +void sub_80CAEAC(void) +{ + if (!IsCursorOnBox()) + { + if (sInPartyMenu) + sub_80D0D8C(TRUE, GetBoxCursorPosition()); + else + sub_80D0D8C(FALSE, GetBoxCursorPosition()); + } + + if (gUnknown_02039D12 != 0) + { + sub_80D0F38(gUnknown_02039D12); + sub_80CFE54(3); + } +} + +void sub_80CAF04(void) +{ + u16 i; + + LoadMonIconPalettes(); + for (i = 0; i < 40; i++) + gUnknown_02039D08->field_B08[i] = 0; + for (i = 0; i < 40; i++) + gUnknown_02039D08->field_B58[i] = 0; + for (i = 0; i < PARTY_SIZE; i++) + gUnknown_02039D08->partySprites[i] = NULL; + for (i = 0; i < IN_BOX_COUNT; i++) + gUnknown_02039D08->boxMonsSprites[i] = NULL; + + gUnknown_02039D08->field_A6C = NULL; + gUnknown_02039D08->field_78C = 0; +} diff --git a/sym_ewram.txt b/sym_ewram.txt index c8d323310..f3f654234 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -207,7 +207,7 @@ gUnknown_02039CF4: @ 2039CF4 gUnknown_02039CF8: @ 2039CF8 .space 0x8 -gUnknown_02039D00: @ 2039D00 +sPreviousBoxOption: @ 2039D00 .space 0x4 gUnknown_02039D04: @ 2039D04 @@ -219,7 +219,7 @@ gUnknown_02039D08: @ 2039D08 sInPartyMenu: @ 2039D0C .space 0x1 -sBoxOption: @ 2039D0D +sCurrentBoxOption: @ 2039D0D .space 0x1 gUnknown_02039D0E: @ 2039D0E From f1421d94c384c1bd76304fcb961ca28d7f0e7e20 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 15 Dec 2018 23:58:47 +0100 Subject: [PATCH 07/13] Up to sub 0x80ce580 --- asm/contest_link_80F57C4.s | 2 +- asm/pokemon_storage_system.s | 6829 +----------------------------- asm/pokenav.s | 24 +- data/pokemon_storage_system.s | 441 +- include/constants/maps.h | 1 + include/global.h | 6 +- include/graphics.h | 9 + include/menu.h | 6 +- include/pokemon.h | 6 +- include/pokemon_icon.h | 3 + include/pokemon_storage_system.h | 113 +- include/text.h | 2 +- src/battle_pike.c | 2 +- src/daycare.c | 4 +- src/egg_hatch.c | 2 +- src/field_player_avatar.c | 2 +- src/field_poison.c | 2 +- src/field_specials.c | 4 +- src/menu.c | 10 +- src/overworld.c | 2 +- src/pokemon.c | 18 +- src/pokemon_icon.c | 13 +- src/pokemon_size_record.c | 2 +- src/pokemon_storage_system.c | 2601 +++++++++++- src/pokemon_summary_screen.c | 2 +- src/post_battle_event_funcs.c | 4 +- src/text.c | 7 +- src/wild_encounter.c | 12 +- sym_ewram.txt | 2 +- 29 files changed, 2776 insertions(+), 7355 deletions(-) diff --git a/asm/contest_link_80F57C4.s b/asm/contest_link_80F57C4.s index 3e35ab7f1..e09e0e25d 100644 --- a/asm/contest_link_80F57C4.s +++ b/asm/contest_link_80F57C4.s @@ -2093,7 +2093,7 @@ _080F6AA6: adds r0, r1 ldrh r0, [r0] movs r1, 0 - bl mon_icon_convert_unown_species_id + bl GetIconSpecies lsls r0, 16 lsrs r0, 16 adds r0, r6 diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index 642dc0270..b6822eeac 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -7,6707 +7,6 @@ - - thumb_func_start sub_80CAFAC -sub_80CAFAC: @ 80CAFAC - push {lr} - bl IsCursorInBox - lsls r0, 24 - movs r1, 0x1 - cmp r0, 0 - beq _080CAFBC - movs r1, 0x2 -_080CAFBC: - adds r0, r1, 0 - pop {r1} - bx r1 - thumb_func_end sub_80CAFAC - - thumb_func_start sub_80CAFC4 -sub_80CAFC4: @ 80CAFC4 - push {r4-r6,lr} - sub sp, 0x8 - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - ldr r4, =0x000020a4 - adds r0, r4 - movs r1, 0 - bl GetMonData - adds r6, r0, 0 - ldr r0, [r5] - adds r0, r4 - movs r1, 0x41 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - bl sub_80CAFAC - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - movs r0, 0x7 - str r0, [sp, 0x4] - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0 - movs r3, 0 - bl sub_80CC230 - ldr r1, [r5] - ldr r2, =0x00000a6c - adds r1, r2 - str r0, [r1] - ldr r1, =sub_80CC100 - str r1, [r0, 0x1C] - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CAFC4 - - thumb_func_start sub_80CB028 -sub_80CB028: @ 80CB028 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - movs r0, 0 - mov r8, r0 - movs r6, 0 - movs r7, 0 -_080CB042: - movs r5, 0 - adds r1, r7, 0x1 - mov r10, r1 -_080CB048: - mov r0, r9 - adds r1, r6, 0 - movs r2, 0x41 - bl GetBoxMonDataFromAnyBox - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0 - beq _080CB0B0 - mov r0, r9 - adds r1, r6, 0 - movs r2, 0 - bl GetBoxMonDataFromAnyBox - adds r1, r0, 0 - lsls r2, r5, 1 - adds r2, r5 - lsls r2, 19 - movs r3, 0xC8 - lsls r3, 15 - adds r2, r3 - asrs r2, 16 - lsls r3, r7, 1 - adds r3, r7 - lsls r3, 19 - movs r0, 0xB0 - lsls r0, 14 - adds r3, r0 - movs r0, 0x2 - str r0, [sp] - movs r0, 0x13 - subs r0, r5 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - adds r0, r4, 0 - asrs r3, 16 - bl sub_80CC230 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - mov r3, r8 - lsls r2, r3, 2 - ldr r3, =0x00000a88 - adds r1, r3 - adds r1, r2 - str r0, [r1] - b _080CB0C0 - .pool -_080CB0B0: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - mov r2, r8 - lsls r1, r2, 2 - ldr r3, =0x00000a88 - adds r0, r3 - adds r0, r1 - str r4, [r0] -_080CB0C0: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - mov r0, r8 - adds r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x5 - bls _080CB048 - mov r1, r10 - lsls r0, r1, 16 - lsrs r7, r0, 16 - cmp r7, 0x4 - bls _080CB042 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080CB126 - movs r6, 0 - movs r2, 0xD - negs r2, r2 - adds r4, r2, 0 -_080CB0F6: - mov r0, r9 - adds r1, r6, 0 - movs r2, 0xC - bl GetBoxMonDataFromAnyBox - cmp r0, 0 - bne _080CB11C - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - lsls r1, r6, 2 - ldr r3, =0x00000a88 - adds r0, r3 - adds r0, r1 - ldr r2, [r0] - ldrb r0, [r2, 0x1] - ands r0, r4 - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2, 0x1] -_080CB11C: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x1D - bls _080CB0F6 -_080CB126: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB028 - - thumb_func_start sub_80CB140 -sub_80CB140: @ 80CB140 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r7, r0, 24 - adds r0, r7, 0 - movs r1, 0x41 - bl GetBoxMonDataFromSelectedBox - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - cmp r0, 0 - beq _080CB1DA - adds r0, r7, 0 - movs r1, 0x6 - bl __umodsi3 - adds r6, r0, 0 - lsls r0, r6, 24 - lsrs r0, 24 - lsls r5, r0, 1 - adds r5, r0 - lsls r5, 19 - movs r0, 0xC8 - lsls r0, 15 - adds r5, r0 - lsrs r5, 16 - adds r0, r7, 0 - movs r1, 0x6 - bl __udivsi3 - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 1 - adds r4, r0 - lsls r4, 19 - movs r0, 0xB0 - lsls r0, 14 - adds r4, r0 - lsrs r4, 16 - adds r0, r7, 0 - movs r1, 0 - bl GetBoxMonDataFromSelectedBox - adds r1, r0, 0 - movs r0, 0x2 - str r0, [sp] - movs r0, 0x13 - subs r0, r6 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x4] - mov r0, r8 - adds r2, r5, 0 - adds r3, r4, 0 - bl sub_80CC230 - adds r3, r0, 0 - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - lsls r1, r7, 2 - ldr r4, =0x00000a88 - adds r0, r2, r4 - adds r0, r1 - str r3, [r0] - ldrb r0, [r2, 0x1] - cmp r0, 0x3 - bne _080CB1DA - ldrb r0, [r3, 0x1] - movs r1, 0xD - negs r1, r1 - ands r1, r0 - movs r0, 0x4 - orrs r1, r0 - strb r1, [r3, 0x1] -_080CB1DA: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB140 - - thumb_func_start sub_80CB1F0 -sub_80CB1F0: @ 80CB1F0 - push {r4-r7,lr} - lsls r0, 16 - lsrs r3, r0, 16 - movs r2, 0 - ldr r7, =gUnknown_02039D08 - ldr r6, =0x00000a88 - movs r5, 0x1 - ldr r4, =sub_80CB278 -_080CB200: - ldr r0, [r7] - lsls r1, r2, 2 - adds r0, r6 - adds r1, r0, r1 - ldr r0, [r1] - cmp r0, 0 - beq _080CB218 - strh r3, [r0, 0x32] - ldr r0, [r1] - strh r5, [r0, 0x36] - ldr r0, [r1] - str r4, [r0, 0x1C] -_080CB218: - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x1D - bls _080CB200 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB1F0 - - thumb_func_start sub_80CB234 -sub_80CB234: @ 80CB234 - push {lr} - adds r2, r0, 0 - ldrh r1, [r2, 0x30] - movs r3, 0x30 - ldrsh r0, [r2, r3] - cmp r0, 0 - beq _080CB250 - subs r0, r1, 0x1 - strh r0, [r2, 0x30] - ldrh r0, [r2, 0x32] - ldrh r1, [r2, 0x20] - adds r0, r1 - strh r0, [r2, 0x20] - b _080CB266 -_080CB250: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r3, =0x00000c66 - adds r1, r3 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - ldrh r0, [r2, 0x34] - strh r0, [r2, 0x20] - ldr r0, =SpriteCallbackDummy - str r0, [r2, 0x1C] -_080CB266: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB234 - - thumb_func_start sub_80CB278 -sub_80CB278: @ 80CB278 - push {lr} - adds r2, r0, 0 - ldrh r1, [r2, 0x36] - movs r3, 0x36 - ldrsh r0, [r2, r3] - cmp r0, 0 - beq _080CB28C - subs r0, r1, 0x1 - strh r0, [r2, 0x36] - b _080CB2A8 -_080CB28C: - ldrh r0, [r2, 0x32] - ldrh r1, [r2, 0x20] - adds r0, r1 - strh r0, [r2, 0x20] - ldrh r1, [r2, 0x24] - adds r0, r1 - strh r0, [r2, 0x38] - subs r0, 0x45 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xB6 - bls _080CB2A8 - ldr r0, =SpriteCallbackDummy - str r0, [r2, 0x1C] -_080CB2A8: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB278 - - thumb_func_start sub_80CB2B0 -sub_80CB2B0: @ 80CB2B0 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - ldr r7, =gUnknown_02039D08 -_080CB2BA: - ldr r0, [r7] - lsls r4, r5, 2 - ldr r1, =0x00000a88 - adds r0, r1 - adds r0, r4 - ldr r0, [r0] - cmp r0, 0 - beq _080CB2DA - bl sub_80CC314 - ldr r0, [r7] - ldr r1, =0x00000a88 - adds r0, r1 - adds r0, r4 - movs r1, 0 - str r1, [r0] -_080CB2DA: - adds r0, r5, 0x6 - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x4 - bls _080CB2BA - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB2B0 - - thumb_func_start sub_80CB2F8 -sub_80CB2F8: @ 80CB2F8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x1C - lsls r0, 24 - lsrs r0, 24 - lsls r1, 16 - lsrs r1, 16 - str r1, [sp, 0x8] - lsls r2, 16 - movs r1, 0x2C - mov r8, r1 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 19 - movs r3, 0xC8 - lsls r3, 15 - adds r1, r3 - lsrs r1, 16 - str r1, [sp, 0x10] - ldr r1, [sp, 0x8] - adds r1, 0x1 - lsrs r6, r2, 16 - str r6, [sp, 0xC] - asrs r2, 16 - muls r1, r2 - ldr r2, [sp, 0x10] - subs r1, r2, r1 - lsls r1, 16 - lsrs r2, r1, 16 - movs r1, 0x13 - subs r1, r0 - lsls r1, 24 - lsrs r1, 24 - str r1, [sp, 0x14] - movs r3, 0 - mov r9, r3 - adds r5, r0, 0 - ldr r1, =gUnknown_02039D08 - ldr r0, [r1] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - beq _080CB3F0 - movs r7, 0x4 - lsls r2, 16 - mov r10, r2 -_080CB358: - ldr r6, =gUnknown_02039D08 - ldr r2, [r6] - lsls r0, r5, 1 - ldr r3, =0x00000ba8 - adds r1, r2, r3 - adds r1, r0 - ldrh r0, [r1] - cmp r0, 0 - beq _080CB3C2 - lsls r4, r5, 2 - ldr r6, =0x00000be4 - adds r1, r2, r6 - adds r1, r4 - ldr r1, [r1] - mov r2, r8 - lsls r3, r2, 16 - asrs r3, 16 - movs r2, 0x2 - str r2, [sp] - ldr r6, [sp, 0x14] - str r6, [sp, 0x4] - mov r6, r10 - asrs r2, r6, 16 - bl sub_80CC230 - adds r2, r0, 0 - ldr r1, =gUnknown_02039D08 - ldr r0, [r1] - ldr r3, =0x00000a88 - adds r0, r3 - adds r1, r0, r4 - str r2, [r1] - cmp r2, 0 - beq _080CB3C2 - mov r6, sp - ldrh r6, [r6, 0x8] - strh r6, [r2, 0x30] - ldr r0, [r1] - mov r2, sp - ldrh r2, [r2, 0xC] - strh r2, [r0, 0x32] - ldr r0, [r1] - mov r3, sp - ldrh r3, [r3, 0x10] - strh r3, [r0, 0x34] - ldr r1, [r1] - ldr r0, =sub_80CB234 - str r0, [r1, 0x1C] - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_080CB3C2: - adds r0, r5, 0x6 - lsls r0, 24 - lsrs r5, r0, 24 - mov r0, r8 - adds r0, 0x18 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - subs r7, 0x1 - cmp r7, 0 - bge _080CB358 - b _080CB4A6 - .pool -_080CB3F0: - mov r10, r1 - movs r7, 0x4 - lsls r2, 16 - str r2, [sp, 0x18] -_080CB3F8: - mov r6, r10 - ldr r2, [r6] - lsls r0, r5, 1 - ldr r3, =0x00000ba8 - adds r1, r2, r3 - adds r1, r0 - ldrh r0, [r1] - cmp r0, 0 - beq _080CB490 - lsls r4, r5, 2 - ldr r6, =0x00000be4 - adds r1, r2, r6 - adds r1, r4 - ldr r1, [r1] - mov r2, r8 - lsls r3, r2, 16 - asrs r3, 16 - movs r2, 0x2 - str r2, [sp] - ldr r6, [sp, 0x14] - str r6, [sp, 0x4] - ldr r6, [sp, 0x18] - asrs r2, r6, 16 - bl sub_80CC230 - adds r2, r0, 0 - mov r0, r10 - ldr r3, [r0] - ldr r1, =0x00000a88 - adds r0, r3, r1 - adds r1, r0, r4 - str r2, [r1] - cmp r2, 0 - beq _080CB490 - mov r6, sp - ldrh r6, [r6, 0x8] - strh r6, [r2, 0x30] - ldr r0, [r1] - mov r2, sp - ldrh r2, [r2, 0xC] - strh r2, [r0, 0x32] - ldr r0, [r1] - mov r6, sp - ldrh r6, [r6, 0x10] - strh r6, [r0, 0x34] - ldr r1, [r1] - ldr r0, =sub_80CB234 - str r0, [r1, 0x1C] - ldr r1, =0x00000c5c - adds r0, r3, r1 - ldrb r0, [r0] - adds r1, r5, 0 - movs r2, 0xC - bl GetBoxMonDataFromAnyBox - cmp r0, 0 - bne _080CB486 - mov r2, r10 - ldr r0, [r2] - ldr r3, =0x00000a88 - adds r0, r3 - adds r0, r4 - ldr r2, [r0] - ldrb r1, [r2, 0x1] - movs r6, 0xD - negs r6, r6 - adds r0, r6, 0 - ands r1, r0 - movs r0, 0x4 - orrs r1, r0 - strb r1, [r2, 0x1] -_080CB486: - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_080CB490: - adds r0, r5, 0x6 - lsls r0, 24 - lsrs r5, r0, 24 - mov r0, r8 - adds r0, 0x18 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - subs r7, 0x1 - cmp r7, 0 - bge _080CB3F8 -_080CB4A6: - mov r0, r9 - add sp, 0x1C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CB2F8 - - thumb_func_start sub_80CB4CC -sub_80CB4CC: @ 80CB4CC - push {r4-r7,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsrs r4, 24 - ldr r6, =gUnknown_02039D08 - ldr r1, [r6] - ldr r2, =0x00000c6a - adds r1, r2 - movs r5, 0 - strb r5, [r1] - ldr r1, [r6] - ldr r3, =0x00000c6b - adds r1, r3 - strb r0, [r1] - ldr r1, [r6] - ldr r7, =0x00000c69 - adds r1, r7 - strb r4, [r1] - ldr r3, [r6] - movs r1, 0xC6 - lsls r1, 4 - adds r2, r3, r1 - movs r1, 0x20 - strh r1, [r2] - lsls r4, 24 - asrs r4, 24 - lsls r1, r4, 1 - adds r1, r4 - lsls r1, 1 - negs r1, r1 - subs r7, 0x5 - adds r2, r3, r7 - strh r1, [r2] - ldr r1, =0x00000c66 - adds r3, r1 - strh r5, [r3] - bl sub_80CB6F0 - cmp r4, 0 - ble _080CB544 - ldr r0, [r6] - ldr r2, =0x00000c68 - adds r0, r2 - movs r1, 0 - b _080CB54C - .pool -_080CB544: - ldr r0, [r6] - ldr r3, =0x00000c68 - adds r0, r3 - movs r1, 0x5 -_080CB54C: - strb r1, [r0] - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - ldr r7, =0x00000c68 - adds r0, r2, r7 - ldrb r1, [r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - adds r0, 0x64 - ldr r3, =0x00000c62 - adds r1, r2, r3 - strh r0, [r1] - subs r7, 0x4 - adds r2, r7 - movs r1, 0 - ldrsh r0, [r2, r1] - bl sub_80CB1F0 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB4CC - - thumb_func_start sub_80CB584 -sub_80CB584: @ 80CB584 - push {r4-r6,lr} - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - movs r4, 0xC6 - lsls r4, 4 - adds r1, r0, r4 - ldrh r0, [r1] - cmp r0, 0 - beq _080CB59A - subs r0, 0x1 - strh r0, [r1] -_080CB59A: - ldr r3, [r5] - ldr r6, =0x00000c6a - adds r0, r3, r6 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080CB61C - cmp r0, 0x1 - bgt _080CB5B8 - cmp r0, 0 - beq _080CB5C0 - b _080CB6DE - .pool -_080CB5B8: - cmp r0, 0x2 - bne _080CB5BE - b _080CB6CC -_080CB5BE: - b _080CB6DE -_080CB5C0: - ldr r0, =0x00000c62 - adds r1, r3, r0 - ldr r2, =0x00000c64 - adds r0, r3, r2 - ldrh r0, [r0] - ldrh r2, [r1] - adds r0, r2 - strh r0, [r1] - subs r0, 0x41 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xBA - bhi _080CB5DC - b _080CB6E8 -_080CB5DC: - ldr r1, =0x00000c68 - adds r0, r3, r1 - ldrb r0, [r0] - bl sub_80CB2B0 - ldr r2, [r5] - ldr r0, =0x00000c62 - adds r3, r2, r0 - ldr r1, =0x00000c69 - adds r0, r2, r1 - movs r1, 0 - ldrsb r1, [r0, r1] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - ldrh r1, [r3] - adds r0, r1 - strh r0, [r3] - adds r2, r6 - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] - b _080CB6E8 - .pool -_080CB61C: - ldr r2, =0x00000c62 - adds r1, r3, r2 - ldr r6, =0x00000c64 - adds r2, r3, r6 - ldrh r0, [r2] - ldrh r6, [r1] - adds r0, r6 - strh r0, [r1] - ldr r6, =0x00000c68 - adds r0, r3, r6 - ldrb r0, [r0] - adds r1, r3, r4 - ldrh r1, [r1] - movs r3, 0 - ldrsh r2, [r2, r3] - bl sub_80CB2F8 - ldr r2, [r5] - ldr r3, =0x00000c66 - adds r1, r2, r3 - lsls r0, 24 - lsrs r0, 24 - ldrh r3, [r1] - adds r0, r3 - strh r0, [r1] - ldr r1, =0x00000c69 - adds r0, r2, r1 - movs r1, 0 - ldrsb r1, [r0, r1] - cmp r1, 0 - ble _080CB662 - adds r0, r2, r6 - ldrb r0, [r0] - cmp r0, 0x5 - beq _080CB66E -_080CB662: - cmp r1, 0 - bge _080CB69C - adds r0, r2, r6 - ldrb r0, [r0] - cmp r0, 0 - bne _080CB69C -_080CB66E: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x00000c6a - adds r1, r2 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080CB6E8 - .pool -_080CB69C: - ldr r3, =gUnknown_02039D08 - ldr r0, [r3] - ldr r6, =0x00000c68 - adds r1, r0, r6 - ldr r2, =0x00000c69 - adds r0, r2 - ldrb r0, [r0] - ldrb r6, [r1] - adds r0, r6 - movs r2, 0 - strb r0, [r1] - ldr r0, [r3] - ldr r1, =0x00000c6a - adds r0, r1 - strb r2, [r0] - b _080CB6E8 - .pool -_080CB6CC: - ldr r2, =0x00000c66 - adds r0, r3, r2 - ldrh r0, [r0] - cmp r0, 0 - bne _080CB6E8 - adds r1, r3, r4 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] -_080CB6DE: - movs r0, 0 - b _080CB6EA - .pool -_080CB6E8: - movs r0, 0x1 -_080CB6EA: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80CB584 - - thumb_func_start sub_80CB6F0 -sub_80CB6F0: @ 80CB6F0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r6, r0, 24 - movs r5, 0 - movs r0, 0 - ldr r1, =gUnknown_02039D08 - mov r9, r1 -_080CB704: - adds r0, 0x1 - mov r8, r0 - movs r7, 0x5 -_080CB70A: - lsls r0, r5, 24 - lsrs r4, r0, 24 - adds r0, r6, 0 - adds r1, r4, 0 - movs r2, 0x41 - bl GetBoxMonDataFromAnyBox - mov r2, r9 - ldr r1, [r2] - lsls r2, r5, 1 - ldr r3, =0x00000ba8 - adds r1, r3 - adds r1, r2 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - beq _080CB744 - adds r0, r6, 0 - adds r1, r4, 0 - movs r2, 0 - bl GetBoxMonDataFromAnyBox - mov r2, r9 - ldr r1, [r2] - lsls r2, r5, 2 - ldr r3, =0x00000be4 - adds r1, r3 - adds r1, r2 - str r0, [r1] -_080CB744: - adds r5, 0x1 - subs r7, 0x1 - cmp r7, 0 - bge _080CB70A - mov r0, r8 - cmp r0, 0x4 - ble _080CB704 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000c5c - adds r0, r1 - strb r6, [r0] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB6F0 - - thumb_func_start sub_80CB778 -sub_80CB778: @ 80CB778 - push {r4,r5,lr} - lsls r0, 24 - ldr r5, =gUnknown_02039D08 - ldr r1, [r5] - lsrs r4, r0, 22 - ldr r0, =0x00000a88 - adds r1, r0 - adds r1, r4 - ldr r0, [r1] - cmp r0, 0 - beq _080CB79E - bl sub_80CC314 - ldr r0, [r5] - ldr r1, =0x00000a88 - adds r0, r1 - adds r0, r4 - movs r1, 0 - str r1, [r0] -_080CB79E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB778 - - thumb_func_start sub_80CB7AC -sub_80CB7AC: @ 80CB7AC - push {lr} - lsls r0, 24 - lsls r1, 24 - lsrs r2, r1, 24 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - lsrs r0, 22 - ldr r3, =0x00000a88 - adds r1, r3 - adds r1, r0 - ldr r3, [r1] - cmp r3, 0 - beq _080CB7DA - movs r0, 0x3 - adds r1, r2, 0 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r3, 0x1] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x1] -_080CB7DA: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB7AC - - thumb_func_start sub_80CB7E8 -sub_80CB7E8: @ 80CB7E8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r4, =gPlayerParty - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - lsls r0, 16 - lsrs r5, r0, 16 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - adds r1, r0, 0 - movs r0, 0x1 - str r0, [sp] - movs r0, 0xC - str r0, [sp, 0x4] - adds r0, r5, 0 - movs r2, 0x68 - movs r3, 0x40 - bl sub_80CC230 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - movs r2, 0xA7 - lsls r2, 4 - adds r1, r2 - str r0, [r1] - movs r7, 0x1 - movs r6, 0x1 -_080CB830: - movs r0, 0x64 - adds r1, r6, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0 - beq _080CB894 - adds r0, r4, 0 - movs r1, 0 - bl GetMonData - adds r1, r0, 0 - subs r0, r6, 0x1 - lsls r3, r0, 1 - adds r3, r0 - lsls r3, 19 - movs r0, 0x80 - lsls r0, 13 - adds r3, r0 - asrs r3, 16 - movs r0, 0x1 - str r0, [sp] - movs r0, 0xC - str r0, [sp, 0x4] - adds r0, r5, 0 - movs r2, 0x98 - bl sub_80CC230 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - lsls r2, r6, 2 - movs r3, 0xA7 - lsls r3, 4 - adds r1, r3 - adds r1, r2 - str r0, [r1] - adds r0, r7, 0x1 - lsls r0, 16 - lsrs r7, r0, 16 - b _080CB8A4 - .pool -_080CB894: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - lsls r1, r6, 2 - movs r2, 0xA7 - lsls r2, 4 - adds r0, r2 - adds r0, r1 - str r5, [r0] -_080CB8A4: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x5 - bls _080CB830 - ldr r3, =gUnknown_02039D08 - mov r0, r8 - cmp r0, 0 - bne _080CB8EA - movs r6, 0 - cmp r6, r7 - bcs _080CB8EA - mov r12, r3 - movs r5, 0xA7 - lsls r5, 4 - movs r4, 0x4 -_080CB8C4: - mov r2, r12 - ldr r1, [r2] - lsls r0, r6, 2 - adds r1, r5 - adds r1, r0 - ldr r2, [r1] - ldrh r0, [r2, 0x22] - subs r0, 0xA0 - strh r0, [r2, 0x22] - ldr r1, [r1] - adds r1, 0x3E - ldrb r0, [r1] - orrs r0, r4 - strb r0, [r1] - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, r7 - bcc _080CB8C4 -_080CB8EA: - ldr r0, [r3] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080CB93C - movs r6, 0 - adds r7, r3, 0 - movs r5, 0xA7 - lsls r5, 4 -_080CB8FA: - ldr r0, [r7] - lsls r4, r6, 2 - adds r0, r5 - adds r0, r4 - ldr r0, [r0] - cmp r0, 0 - beq _080CB932 - movs r0, 0x64 - muls r0, r6 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - bl GetMonData - cmp r0, 0 - bne _080CB932 - ldr r0, [r7] - adds r0, r5 - adds r0, r4 - ldr r2, [r0] - ldrb r1, [r2, 0x1] - movs r3, 0xD - negs r3, r3 - adds r0, r3, 0 - ands r1, r0 - movs r0, 0x4 - orrs r1, r0 - strb r1, [r2, 0x1] -_080CB932: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x5 - bls _080CB8FA -_080CB93C: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB7E8 - - thumb_func_start sub_80CB950 -sub_80CB950: @ 80CB950 - push {r4-r7,lr} - sub sp, 0x4 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x00000c5e - adds r1, r2 - movs r2, 0 - strb r2, [r1] - movs r5, 0 - movs r6, 0 - adds r3, r0, 0 - movs r7, 0xA7 - lsls r7, 4 -_080CB96A: - ldr r0, [r3] - lsls r4, r5, 2 - adds r0, r7 - adds r0, r4 - ldr r0, [r0] - cmp r0, 0 - beq _080CB9A0 - cmp r5, r6 - beq _080CB99A - adds r1, r6, 0 - str r3, [sp] - bl sub_80CB9D0 - ldr r3, [sp] - ldr r2, [r3] - adds r0, r2, r7 - adds r0, r4 - movs r1, 0 - str r1, [r0] - ldr r0, =0x00000c5e - adds r2, r0 - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] -_080CB99A: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 -_080CB9A0: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x5 - bls _080CB96A - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB950 - - thumb_func_start sub_80CB9BC -sub_80CB9BC: @ 80CB9BC - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000c5e - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80CB9BC - - thumb_func_start sub_80CB9D0 -sub_80CB9D0: @ 80CB9D0 - push {r4,lr} - adds r2, r0, 0 - lsls r1, 16 - lsrs r1, 16 - strh r1, [r2, 0x30] - cmp r1, 0 - bne _080CB9E4 - movs r3, 0x68 - movs r4, 0x40 - b _080CB9F6 -_080CB9E4: - movs r3, 0x98 - subs r1, 0x1 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 19 - movs r1, 0x80 - lsls r1, 13 - adds r0, r1 - lsrs r4, r0, 16 -_080CB9F6: - ldrh r0, [r2, 0x20] - lsls r0, 3 - strh r0, [r2, 0x32] - ldrh r0, [r2, 0x22] - lsls r0, 3 - strh r0, [r2, 0x34] - lsls r1, r3, 3 - movs r3, 0x32 - ldrsh r0, [r2, r3] - subs r0, r1, r0 - cmp r0, 0 - bge _080CBA10 - adds r0, 0x7 -_080CBA10: - asrs r0, 3 - strh r0, [r2, 0x36] - lsls r0, r4, 16 - asrs r0, 13 - movs r3, 0x34 - ldrsh r1, [r2, r3] - subs r0, r1 - cmp r0, 0 - bge _080CBA24 - adds r0, 0x7 -_080CBA24: - asrs r0, 3 - strh r0, [r2, 0x38] - movs r0, 0x8 - strh r0, [r2, 0x3A] - ldr r0, =sub_80CBA3C - str r0, [r2, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CB9D0 - - thumb_func_start sub_80CBA3C -sub_80CBA3C: @ 80CBA3C - push {r4,lr} - adds r3, r0, 0 - ldrh r2, [r3, 0x3A] - movs r1, 0x3A - ldrsh r0, [r3, r1] - cmp r0, 0 - beq _080CBA6C - ldrh r0, [r3, 0x36] - ldrh r4, [r3, 0x32] - adds r0, r4 - strh r0, [r3, 0x32] - ldrh r1, [r3, 0x38] - ldrh r4, [r3, 0x34] - adds r1, r4 - strh r1, [r3, 0x34] - lsls r0, 16 - asrs r0, 19 - strh r0, [r3, 0x20] - lsls r1, 16 - asrs r1, 19 - strh r1, [r3, 0x22] - subs r0, r2, 0x1 - strh r0, [r3, 0x3A] - b _080CBAB2 -_080CBA6C: - movs r1, 0x30 - ldrsh r0, [r3, r1] - cmp r0, 0 - bne _080CBA7C - movs r0, 0x68 - strh r0, [r3, 0x20] - movs r0, 0x40 - b _080CBA8E -_080CBA7C: - movs r0, 0x98 - strh r0, [r3, 0x20] - movs r4, 0x30 - ldrsh r1, [r3, r4] - subs r1, 0x1 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - adds r0, 0x10 -_080CBA8E: - strh r0, [r3, 0x22] - ldr r0, =SpriteCallbackDummy - str r0, [r3, 0x1C] - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - movs r0, 0x30 - ldrsh r1, [r3, r0] - lsls r1, 2 - movs r4, 0xA7 - lsls r4, 4 - adds r0, r2, r4 - adds r0, r1 - str r3, [r0] - ldr r0, =0x00000c5e - adds r2, r0 - ldrb r0, [r2] - subs r0, 0x1 - strb r0, [r2] -_080CBAB2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CBA3C - - thumb_func_start sub_80CBAC4 -sub_80CBAC4: @ 80CBAC4 - push {r4,lr} - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r1, =0x00000a6c - adds r0, r1 - ldr r0, [r0] - cmp r0, 0 - beq _080CBAE2 - bl sub_80CC314 - ldr r0, [r4] - ldr r1, =0x00000a6c - adds r0, r1 - movs r1, 0 - str r1, [r0] -_080CBAE2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CBAC4 - - thumb_func_start sub_80CBAF0 -sub_80CBAF0: @ 80CBAF0 - push {r4-r6,lr} - movs r3, 0 - ldr r6, =gUnknown_02039D08 - lsls r0, 16 - asrs r4, r0, 16 - movs r5, 0x5 - negs r5, r5 -_080CBAFE: - ldr r0, [r6] - lsls r1, r3, 2 - movs r2, 0xA7 - lsls r2, 4 - adds r0, r2 - adds r2, r0, r1 - ldr r1, [r2] - cmp r1, 0 - beq _080CBB56 - ldrh r0, [r1, 0x22] - adds r0, r4, r0 - strh r0, [r1, 0x22] - ldr r2, [r2] - ldrh r1, [r2, 0x26] - ldrh r0, [r2, 0x22] - adds r1, r0 - adds r0, r2, 0 - adds r0, 0x29 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - adds r0, r1 - lsls r0, 16 - movs r1, 0x80 - lsls r1, 13 - adds r0, r1 - lsrs r0, 16 - cmp r0, 0xC0 - bls _080CBB4C - adds r0, r2, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - b _080CBB56 - .pool -_080CBB4C: - adds r2, 0x3E - ldrb r1, [r2] - adds r0, r5, 0 - ands r0, r1 - strb r0, [r2] -_080CBB56: - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0x5 - bls _080CBAFE - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80CBAF0 - - thumb_func_start sub_80CBB68 -sub_80CBB68: @ 80CBB68 - push {r4,r5,lr} - lsls r0, 24 - ldr r5, =gUnknown_02039D08 - ldr r1, [r5] - lsrs r4, r0, 22 - movs r0, 0xA7 - lsls r0, 4 - adds r1, r0 - adds r1, r4 - ldr r0, [r1] - cmp r0, 0 - beq _080CBB92 - bl sub_80CC314 - ldr r0, [r5] - movs r1, 0xA7 - lsls r1, 4 - adds r0, r1 - adds r0, r4 - movs r1, 0 - str r1, [r0] -_080CBB92: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CBB68 - - thumb_func_start sub_80CBB9C -sub_80CBB9C: @ 80CBB9C - push {r4-r6,lr} - movs r5, 0 - ldr r6, =gUnknown_02039D08 -_080CBBA2: - ldr r0, [r6] - lsls r4, r5, 2 - movs r1, 0xA7 - lsls r1, 4 - adds r0, r1 - adds r0, r4 - ldr r0, [r0] - cmp r0, 0 - beq _080CBBC6 - bl sub_80CC314 - ldr r0, [r6] - movs r1, 0xA7 - lsls r1, 4 - adds r0, r1 - adds r0, r4 - movs r1, 0 - str r1, [r0] -_080CBBC6: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x5 - bls _080CBBA2 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CBB9C - - thumb_func_start sub_80CBBDC -sub_80CBBDC: @ 80CBBDC - push {lr} - lsls r0, 24 - lsls r1, 24 - lsrs r2, r1, 24 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - lsrs r0, 22 - movs r3, 0xA7 - lsls r3, 4 - adds r1, r3 - adds r1, r0 - ldr r3, [r1] - cmp r3, 0 - beq _080CBC0C - movs r0, 0x3 - adds r1, r2, 0 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r3, 0x1] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x1] -_080CBC0C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CBBDC - - thumb_func_start sub_80CBC14 -sub_80CBC14: @ 80CBC14 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r1, 24 - adds r5, r1, 0 - cmp r4, 0 - bne _080CBC44 - ldr r3, =gUnknown_02039D08 - ldr r0, [r3] - ldr r5, =0x00000a6c - adds r2, r0, r5 - lsls r1, 2 - adds r5, 0x4 - adds r0, r5 - adds r0, r1 - ldr r1, [r0] - str r1, [r2] - str r4, [r0] - b _080CBC60 - .pool -_080CBC44: - cmp r4, 0x1 - bne _080CBC96 - ldr r3, =gUnknown_02039D08 - ldr r0, [r3] - ldr r1, =0x00000a6c - adds r2, r0, r1 - lsls r1, r5, 2 - ldr r4, =0x00000a88 - adds r0, r4 - adds r0, r1 - ldr r1, [r0] - str r1, [r2] - movs r1, 0 - str r1, [r0] -_080CBC60: - adds r5, r3, 0 - ldr r0, [r5] - ldr r4, =0x00000a6c - adds r0, r4 - ldr r1, [r0] - ldr r0, =sub_80CC100 - str r0, [r1, 0x1C] - bl sub_80CAFAC - ldr r1, [r5] - adds r1, r4 - ldr r3, [r1] - movs r1, 0x3 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r3, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x5] - ldr r0, [r5] - adds r0, r4 - ldr r0, [r0] - adds r0, 0x43 - movs r1, 0x7 - strb r1, [r0] -_080CBC96: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CBC14 - - thumb_func_start sub_80CBCAC -sub_80CBCAC: @ 80CBCAC - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r6, r1, 24 - cmp r0, 0xE - bne _080CBCF8 - ldr r3, =gUnknown_02039D08 - ldr r1, [r3] - lsls r5, r6, 2 - movs r4, 0xA7 - lsls r4, 4 - adds r0, r1, r4 - adds r0, r5 - ldr r2, =0x00000a6c - adds r1, r2 - ldr r2, [r1] - str r2, [r0] - ldrb r1, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2, 0x5] - ldr r0, [r3] - adds r0, r4 - adds r0, r5 - ldr r0, [r0] - adds r0, 0x43 - movs r1, 0xC - strb r1, [r0] - b _080CBD34 - .pool -_080CBCF8: - ldr r5, =gUnknown_02039D08 - ldr r1, [r5] - lsls r4, r6, 2 - ldr r3, =0x00000a88 - adds r0, r1, r3 - adds r0, r4 - ldr r2, =0x00000a6c - adds r1, r2 - ldr r2, [r1] - str r2, [r0] - ldrb r1, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - movs r1, 0x8 - orrs r0, r1 - strb r0, [r2, 0x5] - ldr r0, [r5] - adds r0, r3 - adds r0, r4 - ldr r4, [r0] - adds r0, r6, 0 - movs r1, 0x6 - bl __umodsi3 - movs r1, 0x13 - subs r1, r0 - adds r4, 0x43 - strb r1, [r4] - adds r3, r5, 0 -_080CBD34: - ldr r1, [r3] - ldr r0, =0x00000a6c - adds r1, r0 - ldr r2, [r1] - ldr r0, =SpriteCallbackDummy - str r0, [r2, 0x1C] - movs r0, 0 - str r0, [r1] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CBCAC - - thumb_func_start sub_80CBD5C -sub_80CBD5C: @ 80CBD5C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - cmp r0, 0xE - bne _080CBD80 - ldr r3, =gUnknown_02039D08 - ldr r1, [r3] - movs r0, 0xB0 - lsls r0, 4 - adds r2, r1, r0 - lsls r0, r4, 2 - movs r4, 0xA7 - lsls r4, 4 - b _080CBD8E - .pool -_080CBD80: - ldr r3, =gUnknown_02039D08 - ldr r1, [r3] - movs r0, 0xB0 - lsls r0, 4 - adds r2, r1, r0 - lsls r0, r4, 2 - ldr r4, =0x00000a88 -_080CBD8E: - adds r0, r4 - adds r1, r0 - str r1, [r2] - ldr r1, [r3] - ldr r2, =0x00000a6c - adds r0, r1, r2 - ldr r2, [r0] - ldr r0, =SpriteCallbackDummy - str r0, [r2, 0x1C] - ldr r4, =0x00000c5d - adds r1, r4 - movs r0, 0 - strb r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CBD5C - - thumb_func_start sub_80CBDC4 -sub_80CBDC4: @ 80CBDC4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r6, =gUnknown_02039D08 - ldr r0, [r6] - ldr r1, =0x00000c5d - mov r9, r1 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0x10 - bne _080CBDE8 - movs r0, 0 - b _080CBEF4 - .pool -_080CBDE8: - adds r0, 0x1 - strb r0, [r1] - ldr r2, [r6] - ldr r5, =0x00000c5d - adds r0, r2, r5 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080CBE18 - movs r1, 0xB0 - lsls r1, 4 - adds r0, r2, r1 - ldr r0, [r0] - ldr r1, [r0] - ldrh r0, [r1, 0x22] - subs r0, 0x1 - strh r0, [r1, 0x22] - ldr r5, =0x00000a6c - adds r0, r2, r5 - ldr r1, [r0] - ldrh r0, [r1, 0x22] - adds r0, 0x1 - strh r0, [r1, 0x22] -_080CBE18: - ldr r3, [r6] - movs r7, 0xB0 - lsls r7, 4 - adds r4, r3, r7 - ldr r0, [r4] - ldr r0, [r0] - mov r8, r0 - ldr r5, =gSineTable - mov r0, r9 - adds r1, r3, r0 - ldrb r0, [r1] - lsls r0, 4 - adds r0, r5 - movs r2, 0 - ldrsh r0, [r0, r2] - cmp r0, 0 - bge _080CBE3C - adds r0, 0xF -_080CBE3C: - asrs r0, 4 - mov r2, r8 - strh r0, [r2, 0x24] - ldr r0, =0x00000a6c - mov r8, r0 - add r3, r8 - ldr r2, [r3] - ldrb r0, [r1] - lsls r0, 4 - adds r0, r5 - movs r5, 0 - ldrsh r0, [r0, r5] - cmp r0, 0 - bge _080CBE5A - adds r0, 0xF -_080CBE5A: - asrs r0, 4 - negs r0, r0 - strh r0, [r2, 0x24] - ldrb r0, [r1] - cmp r0, 0x8 - bne _080CBEBE - ldr r3, [r3] - ldr r0, [r4] - ldr r0, [r0] - ldrb r0, [r0, 0x5] - movs r5, 0x3 - movs r1, 0xC - ands r1, r0 - ldrb r2, [r3, 0x5] - movs r4, 0xD - negs r4, r4 - adds r0, r4, 0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x5] - ldr r0, [r6] - mov r2, r8 - adds r1, r0, r2 - ldr r1, [r1] - adds r0, r7 - ldr r0, [r0] - ldr r0, [r0] - adds r0, 0x43 - ldrb r0, [r0] - adds r1, 0x43 - strb r0, [r1] - bl sub_80CAFAC - ldr r1, [r6] - adds r1, r7 - ldr r1, [r1] - ldr r1, [r1] - ands r5, r0 - lsls r5, 2 - ldrb r0, [r1, 0x5] - ands r4, r0 - orrs r4, r5 - strb r4, [r1, 0x5] - ldr r0, [r6] - adds r0, r7 - ldr r0, [r0] - ldr r0, [r0] - adds r0, 0x43 - movs r1, 0x7 - strb r1, [r0] -_080CBEBE: - ldr r1, [r6] - mov r5, r9 - adds r0, r1, r5 - ldrb r0, [r0] - cmp r0, 0x10 - bne _080CBEF2 - mov r0, r8 - adds r2, r1, r0 - ldr r3, [r2] - adds r1, r7 - ldr r0, [r1] - ldr r0, [r0] - str r0, [r2] - ldr r0, [r1] - str r3, [r0] - ldr r1, [r6] - mov r2, r8 - adds r0, r1, r2 - ldr r2, [r0] - ldr r0, =sub_80CC100 - str r0, [r2, 0x1C] - adds r1, r7 - ldr r0, [r1] - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - str r0, [r1, 0x1C] -_080CBEF2: - movs r0, 0x1 -_080CBEF4: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CBDC4 - - thumb_func_start sub_80CBF14 -sub_80CBF14: @ 80CBF14 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - adds r2, r0, 0 - lsls r1, 24 - lsrs r4, r1, 24 - cmp r0, 0x1 - beq _080CBF4C - cmp r0, 0x1 - bgt _080CBF2E - cmp r0, 0 - beq _080CBF34 - b _080CBFC0 -_080CBF2E: - cmp r2, 0x2 - beq _080CBF70 - b _080CBFC0 -_080CBF34: - ldr r3, =gUnknown_02039D08 - ldr r1, [r3] - ldr r0, =0x00000b04 - adds r2, r1, r0 - lsls r0, r4, 2 - movs r4, 0xA7 - lsls r4, 4 - b _080CBF58 - .pool -_080CBF4C: - ldr r3, =gUnknown_02039D08 - ldr r1, [r3] - ldr r0, =0x00000b04 - adds r2, r1, r0 - lsls r0, r4, 2 - ldr r4, =0x00000a88 -_080CBF58: - adds r0, r4 - adds r1, r0 - str r1, [r2] - adds r4, r3, 0 - b _080CBF80 - .pool -_080CBF70: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r3, =0x00000b04 - adds r2, r1, r3 - ldr r4, =0x00000a6c - adds r1, r4 - str r1, [r2] - adds r4, r0, 0 -_080CBF80: - ldr r0, [r4] - ldr r1, =0x00000b04 - adds r0, r1 - ldr r0, [r0] - ldr r0, [r0] - cmp r0, 0 - beq _080CBFC0 - bl InitSpriteAffineAnim - ldr r0, [r4] - ldr r3, =0x00000b04 - adds r0, r3 - ldr r0, [r0] - ldr r2, [r0] - ldrb r1, [r2, 0x1] - movs r0, 0x4 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x1] - ldr r1, [r4] - adds r1, r3 - ldr r0, [r1] - ldr r2, [r0] - ldr r0, =gSpriteAffineAnimTable_857291C - str r0, [r2, 0x10] - ldr r0, [r1] - ldr r0, [r0] - movs r1, 0 - bl StartSpriteAffineAnim -_080CBFC0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CBF14 - - thumb_func_start sub_80CBFD8 -sub_80CBFD8: @ 80CBFD8 - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000b04 - adds r0, r1 - ldr r0, [r0] - ldr r1, [r0] - cmp r1, 0 - beq _080CBFF8 - adds r3, r1, 0 - adds r3, 0x3E - ldrb r2, [r3] - movs r0, 0x4 - ands r0, r2 - cmp r0, 0 - beq _080CC004 -_080CBFF8: - movs r0, 0 - b _080CC01A - .pool -_080CC004: - adds r0, r1, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080CC018 - movs r0, 0x4 - orrs r0, r2 - strb r0, [r3] -_080CC018: - movs r0, 0x1 -_080CC01A: - pop {r1} - bx r1 - thumb_func_end sub_80CBFD8 - - thumb_func_start sub_80CC020 -sub_80CC020: @ 80CC020 - push {r4,lr} - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r1, =0x00000b04 - adds r0, r1 - ldr r0, [r0] - ldr r0, [r0] - cmp r0, 0 - beq _080CC056 - ldrb r0, [r0, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - ldr r0, [r4] - ldr r1, =0x00000b04 - adds r0, r1 - ldr r0, [r0] - ldr r0, [r0] - bl sub_80CC314 - ldr r0, [r4] - ldr r1, =0x00000b04 - adds r0, r1 - ldr r1, [r0] - movs r0, 0 - str r0, [r1] -_080CC056: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CC020 - - thumb_func_start sub_80CC064 -sub_80CC064: @ 80CC064 - push {lr} - ldr r3, =gUnknown_02039D08 - ldr r0, [r3] - ldr r1, =0x00000b04 - adds r0, r1 - ldr r0, [r0] - ldr r0, [r0] - cmp r0, 0 - beq _080CC094 - adds r2, r0, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldr r0, [r3] - ldr r1, =0x00000b04 - adds r0, r1 - ldr r0, [r0] - ldr r0, [r0] - movs r1, 0x1 - bl StartSpriteAffineAnim -_080CC094: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CC064 - - thumb_func_start sub_80CC0A0 -sub_80CC0A0: @ 80CC0A0 - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000b04 - adds r2, r0, r1 - ldr r0, [r2] - cmp r0, 0 - bne _080CC0BC - movs r0, 0 - b _080CC0D0 - .pool -_080CC0BC: - ldr r0, [r0] - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080CC0CE - movs r0, 0 - str r0, [r2] -_080CC0CE: - movs r0, 0x1 -_080CC0D0: - pop {r1} - bx r1 - thumb_func_end sub_80CC0A0 - - thumb_func_start sub_80CC0D4 -sub_80CC0D4: @ 80CC0D4 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - ldr r2, =0x00000a6c - adds r1, r2 - ldr r3, [r1] - movs r1, 0x3 - ands r0, r1 - lsls r0, 2 - ldrb r2, [r3, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x5] - bx lr - .pool - thumb_func_end sub_80CC0D4 - - thumb_func_start sub_80CC100 -sub_80CC100: @ 80CC100 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - ldr r2, =0x00000cb4 - adds r1, r2 - ldr r2, [r1] - ldrh r2, [r2, 0x20] - strh r2, [r0, 0x20] - ldr r2, [r1] - ldrh r1, [r2, 0x26] - ldrh r2, [r2, 0x22] - adds r1, r2 - adds r1, 0x4 - strh r1, [r0, 0x22] - bx lr - .pool - thumb_func_end sub_80CC100 - - thumb_func_start sub_80CC124 -sub_80CC124: @ 80CC124 - push {r4-r6,lr} - lsls r0, 16 - lsrs r3, r0, 16 - movs r4, 0 - ldr r1, =gUnknown_02039D08 - ldr r0, [r1] - ldr r2, =0x00000b58 - adds r0, r2 - ldrh r0, [r0] - adds r2, r1, 0 - cmp r0, r3 - beq _080CC158 - adds r6, r2, 0 - ldr r5, =0x00000b58 -_080CC140: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x27 - bhi _080CC158 - ldr r0, [r6] - lsls r1, r4, 1 - adds r0, r5 - adds r0, r1 - ldrh r0, [r0] - cmp r0, r3 - bne _080CC140 -_080CC158: - cmp r4, 0x28 - bne _080CC198 - movs r4, 0 - ldr r0, [r2] - ldr r5, =0x00000b58 - adds r0, r5 - ldrh r0, [r0] - cmp r0, 0 - beq _080CC184 - adds r6, r2, 0 -_080CC16C: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x27 - bhi _080CC184 - ldr r0, [r6] - lsls r1, r4, 1 - adds r0, r5 - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0 - bne _080CC16C -_080CC184: - cmp r4, 0x28 - bne _080CC198 - ldr r0, =0x0000ffff - b _080CC1CA - .pool -_080CC198: - ldr r1, [r2] - lsls r2, r4, 1 - ldr r5, =0x00000b58 - adds r0, r1, r5 - adds r0, r2 - strh r3, [r0] - ldr r0, =0x00000b08 - adds r1, r0 - adds r1, r2 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - lsls r4, 20 - lsrs r4, 16 - adds r0, r3, 0 - movs r1, 0x1 - bl GetMonIconTiles - lsls r1, r4, 5 - ldr r2, =0x06010000 - adds r1, r2 - ldr r2, =0x04000080 - bl CpuSet - adds r0, r4, 0 -_080CC1CA: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CC124 - - thumb_func_start sub_80CC1E0 -sub_80CC1E0: @ 80CC1E0 - push {r4-r6,lr} - lsls r0, 16 - lsrs r5, r0, 16 - movs r3, 0 - ldr r6, =gUnknown_02039D08 -_080CC1EA: - ldr r1, [r6] - lsls r2, r3, 1 - ldr r4, =0x00000b58 - adds r0, r1, r4 - adds r4, r0, r2 - ldrh r0, [r4] - cmp r0, r5 - bne _080CC220 - ldr r0, =0x00000b08 - adds r1, r0 - adds r1, r2 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _080CC22A - strh r0, [r4] - b _080CC22A - .pool -_080CC220: - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0x27 - bls _080CC1EA -_080CC22A: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80CC1E0 - - thumb_func_start sub_80CC230 -sub_80CC230: @ 80CC230 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x1C - ldr r4, [sp, 0x3C] - ldr r5, [sp, 0x40] - lsls r0, 16 - lsrs r6, r0, 16 - lsls r2, 16 - lsrs r2, 16 - str r2, [sp, 0x18] - lsls r3, 16 - lsrs r3, 16 - mov r8, r3 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - mov r9, r5 - mov r2, sp - ldr r0, =gUnknown_085728D4 - ldm r0!, {r3,r5,r7} - stm r2!, {r3,r5,r7} - ldm r0!, {r3,r5,r7} - stm r2!, {r3,r5,r7} - adds r0, r6, 0 - bl mon_icon_convert_unown_species_id - mov r10, r0 - mov r6, r10 - mov r2, sp - ldr r1, =gMonIconPaletteIndices - adds r1, r6, r1 - ldr r3, =0x0000dac0 - adds r0, r3, 0 - ldrb r1, [r1] - adds r0, r1 - strh r0, [r2, 0x2] - adds r0, r6, 0 - bl sub_80CC124 - lsls r0, 16 - lsrs r0, 16 - adds r5, r0, 0 - ldr r0, =0x0000ffff - cmp r5, r0 - beq _080CC302 - ldr r7, [sp, 0x18] - lsls r1, r7, 16 - asrs r1, 16 - mov r0, r8 - lsls r2, r0, 16 - asrs r2, 16 - mov r0, sp - mov r3, r9 - bl CreateSprite - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x40 - beq _080CC2FC - ldr r1, =gSprites - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r1 - ldr r2, =0x000003ff - ands r2, r5 - ldrh r3, [r0, 0x4] - ldr r1, =0xfffffc00 - ands r1, r3 - orrs r1, r2 - strh r1, [r0, 0x4] - movs r1, 0x3 - ands r4, r1 - lsls r3, r4, 2 - ldrb r2, [r0, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r2 - orrs r1, r3 - strb r1, [r0, 0x5] - mov r1, r10 - strh r1, [r0, 0x2E] - b _080CC304 - .pool -_080CC2FC: - adds r0, r6, 0 - bl sub_80CC1E0 -_080CC302: - movs r0, 0 -_080CC304: - add sp, 0x1C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80CC230 - - thumb_func_start sub_80CC314 -sub_80CC314: @ 80CC314 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - bl sub_80CC1E0 - adds r0, r4, 0 - bl DestroySprite - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80CC314 - - thumb_func_start sub_80CC32C -sub_80CC32C: @ 80CC32C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =sub_80CC370 - movs r1, 0x2 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0xC] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CC32C - - thumb_func_start sub_80CC35C -sub_80CC35C: @ 80CC35C - push {lr} - ldr r0, =sub_80CC370 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CC35C - - thumb_func_start sub_80CC370 -sub_80CC370: @ 80CC370 - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0x4 - bhi _080CC454 - lsls r0, 2 - ldr r1, =_080CC39C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080CC39C: - .4byte _080CC3B0 - .4byte _080CC3E8 - .4byte _080CC41C - .4byte _080CC426 - .4byte _080CC44C -_080CC3B0: - ldr r1, =gUnknown_02039D08 - ldr r0, [r1] - ldr r2, =0x000002d2 - adds r0, r2 - movs r2, 0 - strb r2, [r0] - ldr r1, [r1] - movs r3, 0xB3 - lsls r3, 2 - adds r0, r1, r3 - strh r2, [r0] - ldr r0, =0x00004ac4 - adds r1, r0 - movs r2, 0x80 - lsls r2, 5 - movs r0, 0 - movs r3, 0x1 - bl RequestDma3Fill - strh r0, [r4, 0xA] - b _080CC458 - .pool -_080CC3E8: - movs r1, 0xA - ldrsh r0, [r4, r1] - bl CheckForSpaceForDma3Request - lsls r0, 16 - asrs r0, 16 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - beq _080CC45E - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x00004ac4 - adds r1, r2 - movs r0, 0x2 - bl SetBgTilemapBuffer - movs r0, 0x2 - bl ShowBg - b _080CC458 - .pool -_080CC41C: - ldrb r0, [r4, 0xC] - movs r1, 0 - bl sub_80CC7A0 - b _080CC458 -_080CC426: - bl sub_80CCA00 - cmp r0, 0 - beq _080CC45E - ldrb r0, [r4, 0xC] - bl sub_80CCB50 - bl sub_80CD02C - ldrb r0, [r4, 0xC] - bl sub_80CB028 - ldr r1, =0x00005b0a - movs r0, 0xC - bl SetGpuReg - b _080CC458 - .pool -_080CC44C: - adds r0, r2, 0 - bl DestroyTask - b _080CC458 -_080CC454: - movs r0, 0 - b _080CC45C -_080CC458: - ldrh r0, [r4, 0x8] - adds r0, 0x1 -_080CC45C: - strh r0, [r4, 0x8] -_080CC45E: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80CC370 - - thumb_func_start sub_80CC464 -sub_80CC464: @ 80CC464 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r4, r0, 24 - mov r8, r4 - adds r0, r4, 0 - bl sub_80CC644 - lsls r0, 24 - lsrs r0, 24 - adds r6, r0, 0 - ldr r5, =gUnknown_02039D08 - ldr r2, [r5] - lsls r0, r6, 24 - asrs r3, r0, 24 - movs r0, 0x6 - negs r0, r0 - adds r1, r0, 0 - cmp r3, 0 - ble _080CC490 - movs r1, 0x6 -_080CC490: - ldr r7, =0x000002ce - adds r0, r2, r7 - strh r1, [r0] - movs r1, 0x2 - cmp r3, 0 - ble _080CC49E - movs r1, 0x1 -_080CC49E: - ldr r7, =0x000002d3 - adds r0, r2, r7 - strb r1, [r0] - ldr r2, [r5] - movs r0, 0xB4 - lsls r0, 2 - adds r1, r2, r0 - movs r0, 0x20 - strh r0, [r1] - movs r1, 0xB5 - lsls r1, 2 - adds r0, r2, r1 - strb r4, [r0] - ldr r2, [r5] - movs r1, 0 - cmp r3, 0 - bgt _080CC4C2 - movs r1, 0x5 -_080CC4C2: - ldr r4, =0x000002d6 - adds r0, r2, r4 - strh r1, [r0] - movs r7, 0xB6 - lsls r7, 2 - adds r0, r2, r7 - strh r3, [r0] - movs r1, 0x38 - cmp r3, 0 - ble _080CC4DC - movs r0, 0x84 - lsls r0, 1 - adds r1, r0, 0 -_080CC4DC: - ldr r4, =0x000002da - adds r0, r2, r4 - strh r1, [r0] - movs r1, 0 - cmp r3, 0 - bgt _080CC4EA - movs r1, 0x5 -_080CC4EA: - movs r7, 0xB7 - lsls r7, 2 - adds r0, r2, r7 - strh r1, [r0] - ldr r0, =0x000002de - adds r1, r2, r0 - movs r0, 0 - strh r0, [r1] - movs r3, 0xB8 - lsls r3, 2 - adds r1, r2, r3 - movs r0, 0x2 - strh r0, [r1] - ldr r4, =0x00000a64 - adds r0, r2, r4 - mov r7, r8 - strb r7, [r0] - ldr r0, [r5] - ldr r1, =0x00000a65 - adds r0, r1 - strb r6, [r0] - ldr r0, [r5] - ldr r3, =0x00000a63 - adds r0, r3 - movs r1, 0 - strb r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CC464 - - thumb_func_start ScrollToBox -ScrollToBox: @ 80CC54C - push {r4-r6,lr} - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - ldr r5, =0x00000a63 - adds r0, r1, r5 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080CC594 - cmp r0, 0x1 - bgt _080CC570 - cmp r0, 0 - beq _080CC576 - b _080CC624 - .pool -_080CC570: - cmp r0, 0x2 - beq _080CC5E4 - b _080CC624 -_080CC576: - ldr r2, =0x00000a64 - adds r0, r1, r2 - ldrb r0, [r0] - adds r2, 0x1 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - bl sub_80CC7A0 - ldr r1, [r4] - adds r1, r5 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080CC594: - bl sub_80CCA00 - cmp r0, 0 - beq _080CC632 - ldr r6, =gUnknown_02039D08 - ldr r1, [r6] - ldr r4, =0x00000a64 - adds r0, r1, r4 - ldrb r0, [r0] - ldr r5, =0x00000a65 - adds r1, r5 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - bl sub_80CB4CC - ldr r1, [r6] - adds r4, r1, r4 - ldrb r0, [r4] - adds r1, r5 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - bl sub_80CCCFC - ldr r0, [r6] - adds r0, r5 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - bl sub_80CD0B8 - b _080CC624 - .pool -_080CC5E4: - bl sub_80CB584 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r2, [r4] - movs r4, 0xB4 - lsls r4, 2 - adds r3, r2, r4 - ldrh r0, [r3] - cmp r0, 0 - beq _080CC620 - movs r0, 0xB3 - lsls r0, 2 - adds r1, r2, r0 - subs r4, 0x2 - adds r0, r2, r4 - ldrh r0, [r0] - ldrh r2, [r1] - adds r0, r2 - strh r0, [r1] - ldrh r0, [r3] - subs r0, 0x1 - strh r0, [r3] - lsls r0, 16 - cmp r0, 0 - bne _080CC632 - bl sub_80CCEE0 - bl sub_80CD158 -_080CC620: - adds r0, r5, 0 - b _080CC634 -_080CC624: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r4, =0x00000a63 - adds r1, r4 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080CC632: - movs r0, 0x1 -_080CC634: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end ScrollToBox - - thumb_func_start sub_80CC644 -sub_80CC644: @ 80CC644 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r1, r0, 24 - movs r2, 0 - cmp r1, r4 - beq _080CC66E -_080CC658: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xD - bls _080CC664 - movs r1, 0 -_080CC664: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r1, r4 - bne _080CC658 -_080CC66E: - movs r0, 0x1 - negs r0, r0 - cmp r2, 0x6 - bhi _080CC678 - movs r0, 0x1 -_080CC678: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80CC644 - - thumb_func_start SetWallpaperForCurrentBox -SetWallpaperForCurrentBox: @ 80CC680 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl SetBoxWallpaper - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000a62 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end SetWallpaperForCurrentBox - - thumb_func_start DoWallpaperGfxChange -DoWallpaperGfxChange: @ 80CC6B0 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gUnknown_02039D08 - ldr r0, [r1] - ldr r2, =0x00000a62 - adds r0, r2 - ldrb r0, [r0] - adds r4, r1, 0 - cmp r0, 0x4 - bhi _080CC794 - lsls r0, 2 - ldr r1, =_080CC6DC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080CC6DC: - .4byte _080CC6F0 - .4byte _080CC718 - .4byte _080CC732 - .4byte _080CC76C - .4byte _080CC790 -_080CC6F0: - ldr r0, [r4] - movs r1, 0xE7 - lsls r1, 3 - adds r0, r1 - ldr r0, [r0] - ldr r1, =0x0000ffff - str r1, [sp] - movs r1, 0x1 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, [r4] - ldr r2, =0x00000a62 - adds r1, r2 - b _080CC77E - .pool -_080CC718: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _080CC794 - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl sub_80CC7A0 - b _080CC776 -_080CC732: - bl sub_80CCA00 - cmp r0, 0x1 - bne _080CC794 - bl sub_80CCF9C - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - movs r1, 0xE7 - lsls r1, 3 - adds r0, r1 - ldr r0, [r0] - ldr r1, =0x0000ffff - str r1, [sp] - movs r1, 0x1 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r1, [r4] - ldr r2, =0x00000a62 - adds r1, r2 - b _080CC77E - .pool -_080CC76C: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _080CC794 -_080CC776: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r0, =0x00000a62 - adds r1, r0 -_080CC77E: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080CC794 - .pool -_080CC790: - movs r0, 0 - b _080CC796 -_080CC794: - movs r0, 0x1 -_080CC796: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end DoWallpaperGfxChange - - thumb_func_start sub_80CC7A0 -sub_80CC7A0: @ 80CC7A0 - push {r4-r7,lr} - sub sp, 0x8 - ldr r4, =gUnknown_02039D08 - ldr r2, [r4] - ldr r3, =0x000006f9 - adds r2, r3 - movs r3, 0 - strb r3, [r2] - ldr r2, [r4] - ldr r3, =0x000006fa - adds r2, r3 - strb r0, [r2] - ldr r0, [r4] - ldr r2, =0x000006fb - adds r0, r2 - strb r1, [r0] - ldr r1, [r4] - adds r2, r1, r2 - movs r0, 0 - ldrsb r0, [r2, r0] - cmp r0, 0 - beq _080CC7E6 - movs r3, 0 - ldr r0, =0x000002d2 - adds r2, r1, r0 - ldrb r0, [r2] - cmp r0, 0 - bne _080CC7DA - movs r3, 0x1 -_080CC7DA: - strb r3, [r2] - ldr r0, [r4] - ldr r1, =0x00004ac4 - adds r0, r1 - bl sub_80CCAE0 -_080CC7E6: - ldr r7, =gUnknown_02039D08 - ldr r0, [r7] - ldr r2, =0x000006fa - adds r0, r2 - ldrb r0, [r0] - bl sub_80D20F8 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x10 - beq _080CC8C4 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - ldr r1, =gWallpaperTable - adds r6, r0, r1 - ldr r0, [r6, 0x4] - ldr r1, [r7] - ldr r5, =0x00000792 - adds r1, r5 - bl LZ77UnCompWram - ldr r0, [r7] - adds r5, r0, r5 - ldr r4, =0x000006fb - adds r1, r0, r4 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - ldr r3, =0x000002d2 - adds r0, r3 - ldrb r2, [r0] - adds r0, r5, 0 - bl sub_80CCA3C - ldr r1, [r7] - adds r4, r1, r4 - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0 - beq _080CC874 - ldr r0, [r6, 0x8] - ldr r2, =0x000002d2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 21 - movs r3, 0x80 - lsls r3, 15 - adds r1, r3 - lsrs r1, 16 - movs r2, 0x40 - bl LoadPalette - b _080CC888 - .pool -_080CC874: - ldr r0, [r6, 0x8] - ldr r2, =0x000002d2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 6 - ldr r2, =gPlttBufferUnfaded + 0x80 - adds r1, r2 - movs r2, 0x20 - bl CpuSet -_080CC888: - ldr r0, [r6] - mov r1, sp - bl malloc_and_decompress - adds r1, r0, 0 - ldr r0, =gUnknown_02039D08 - ldr r3, [r0] - ldr r2, =0x00000a68 - adds r0, r3, r2 - str r1, [r0] - ldr r2, [sp] - lsls r2, 16 - lsrs r2, 16 - ldr r0, =0x000002d2 - adds r3, r0 - ldrb r3, [r3] - lsls r3, 8 - movs r0, 0x2 - bl LoadBgTiles - b _080CC9DA - .pool -_080CC8C4: - bl GetWaldaWallpaperPatternId - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - ldr r0, =gUnknown_0857AF44 - adds r6, r1, r0 - ldr r0, [r6, 0x4] - ldr r1, [r7] - ldr r4, =0x00000792 - adds r1, r4 - bl LZ77UnCompWram - ldr r2, [r7] - adds r0, r2, r4 - ldr r5, =0x000006fb - adds r1, r2, r5 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - ldr r3, =0x000002d2 - adds r2, r3 - ldrb r2, [r2] - bl sub_80CCA3C - ldr r0, [r6, 0x8] - ldr r1, [r7] - adds r1, r4 - movs r2, 0x20 - bl CpuSet - bl GetWaldaWallpaperColorsPtr - ldr r1, [r7] - ldr r2, =0x00000794 - adds r1, r2 - movs r2, 0x2 - bl CpuSet - bl GetWaldaWallpaperColorsPtr - ldr r1, [r7] - ldr r3, =0x000007b4 - adds r1, r3 - movs r2, 0x2 - bl CpuSet - ldr r1, [r7] - adds r5, r1, r5 - movs r0, 0 - ldrsb r0, [r5, r0] - cmp r0, 0 - beq _080CC960 - adds r0, r1, r4 - ldr r2, =0x000002d2 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 21 - movs r3, 0x80 - lsls r3, 15 - adds r1, r3 - lsrs r1, 16 - movs r2, 0x40 - bl LoadPalette - b _080CC976 - .pool -_080CC960: - ldr r2, =0x00000792 - adds r0, r1, r2 - ldr r3, =0x000002d2 - adds r1, r3 - ldrb r1, [r1] - lsls r1, 6 - ldr r2, =gPlttBufferUnfaded + 0x80 - adds r1, r2 - movs r2, 0x20 - bl CpuSet -_080CC976: - ldr r0, [r6] - mov r1, sp - bl malloc_and_decompress - ldr r6, =gUnknown_02039D08 - ldr r1, [r6] - ldr r5, =0x00000a68 - adds r1, r5 - str r0, [r1] - ldr r4, =gUnknown_0857B004 - bl GetWaldaWallpaperIconId - lsls r0, 2 - adds r0, r4 - ldr r0, [r0] - add r1, sp, 0x4 - bl malloc_and_decompress - adds r4, r0, 0 - ldr r0, [r6] - adds r0, r5 - ldr r1, [r0] - movs r0, 0x80 - lsls r0, 4 - adds r1, r0 - ldr r2, [sp, 0x4] - lsls r2, 9 - lsrs r2, 11 - movs r0, 0x80 - lsls r0, 19 - orrs r2, r0 - adds r0, r4, 0 - bl CpuSet - adds r0, r4, 0 - bl Free - ldr r0, [r6] - adds r5, r0, r5 - ldr r1, [r5] - ldr r2, [sp] - lsls r2, 16 - lsrs r2, 16 - ldr r3, =0x000002d2 - adds r0, r3 - ldrb r3, [r0] - lsls r3, 8 - movs r0, 0x2 - bl LoadBgTiles -_080CC9DA: - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CC7A0 - - thumb_func_start sub_80CCA00 -sub_80CCA00: @ 80CCA00 - push {r4,r5,lr} - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - beq _080CCA12 - movs r0, 0 - b _080CCA2E -_080CCA12: - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - ldr r1, =0x00000a68 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0 - beq _080CCA2C - bl Free - ldr r0, [r5] - ldr r1, =0x00000a68 - adds r0, r1 - str r4, [r0] -_080CCA2C: - movs r0, 0x1 -_080CCA2E: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CCA00 - - thumb_func_start sub_80CCA3C -sub_80CCA3C: @ 80CCA3C - push {r4-r7,lr} - sub sp, 0x24 - adds r5, r0, 0 - lsls r2, 24 - lsrs r2, 24 - lsls r4, r2, 17 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - movs r3, 0xB3 - lsls r3, 2 - adds r0, r3 - ldrh r3, [r0] - lsrs r3, 3 - adds r3, 0xA - lsls r1, 24 - asrs r7, r1, 24 - lsls r0, r7, 1 - adds r0, r7 - lsls r0, 3 - adds r6, r3, r0 - movs r0, 0x3F - ands r6, r0 - movs r3, 0x14 - str r3, [sp] - movs r1, 0x12 - str r1, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0x2 - str r0, [sp, 0xC] - str r3, [sp, 0x10] - str r1, [sp, 0x14] - movs r0, 0x11 - str r0, [sp, 0x18] - lsls r2, 24 - asrs r2, 16 - str r2, [sp, 0x1C] - movs r0, 0xC0 - lsls r0, 10 - adds r4, r0 - asrs r4, 16 - str r4, [sp, 0x20] - movs r0, 0x2 - adds r1, r5, 0 - movs r2, 0 - movs r3, 0 - bl CopyRectToBgTilemapBufferRect - cmp r7, 0 - beq _080CCAD2 - cmp r7, 0 - ble _080CCAB0 - lsls r0, r6, 16 - movs r1, 0xA0 - lsls r1, 13 - adds r0, r1 - b _080CCAB6 - .pool -_080CCAB0: - lsls r0, r6, 16 - ldr r3, =0xfffc0000 - adds r0, r3 -_080CCAB6: - lsrs r6, r0, 16 - lsls r2, r6, 24 - lsrs r2, 24 - movs r0, 0x4 - str r0, [sp] - movs r0, 0x12 - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0x2 - movs r1, 0 - movs r3, 0x2 - bl FillBgTilemapBufferRect -_080CCAD2: - add sp, 0x24 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CCA3C - - thumb_func_start sub_80CCAE0 -sub_80CCAE0: @ 80CCAE0 - push {r4-r6,lr} - adds r2, r0, 0 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - movs r1, 0xB3 - lsls r1, 2 - adds r0, r1 - ldrh r0, [r0] - lsrs r0, 3 - adds r3, r0, 0 - adds r3, 0x1E - movs r0, 0x3F - ands r3, r0 - adds r0, r3, 0 - cmp r0, 0x1F - bgt _080CCB10 - lsls r0, 1 - movs r6, 0x98 - lsls r6, 3 - adds r0, r6 - b _080CCB18 - .pool -_080CCB10: - lsls r0, 1 - movs r1, 0xC8 - lsls r1, 4 - adds r0, r1 -_080CCB18: - adds r2, r0 - movs r0, 0 - movs r5, 0 - movs r4, 0x3F -_080CCB20: - strh r5, [r2] - adds r2, 0x2 - adds r3, 0x1 - ands r3, r4 - adds r1, r3, 0 - cmp r1, 0 - bne _080CCB32 - ldr r6, =0xfffff7c0 - adds r2, r6 -_080CCB32: - cmp r1, 0x20 - bne _080CCB3C - movs r1, 0xF8 - lsls r1, 3 - adds r2, r1 -_080CCB3C: - adds r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2B - bls _080CCB20 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CCAE0 - - thumb_func_start sub_80CCB50 -sub_80CCB50: @ 80CCB50 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x30 - mov r8, r0 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r1, =gUnknown_02039D08 - mov r10, r1 - ldr r1, [r1] - movs r2, 0xBE - lsls r2, 2 - adds r0, r1, r2 - str r0, [sp, 0x24] - mov r3, sp - adds r3, 0x24 - str r3, [sp, 0x2C] - ldr r0, =0x00030200 - str r0, [r3, 0x4] - ldr r4, =0x000006fc - adds r1, r4 - str r1, [sp, 0x14] - add r0, sp, 0x18 - ldr r7, =0x0000dac9 - strh r7, [r0] - add r0, sp, 0x1C - movs r1, 0 - movs r2, 0x8 - bl memset - add r1, sp, 0x14 - add r0, sp, 0x4 - movs r2, 0x10 - bl memcpy - mov r0, r8 - bl sub_80D20F8 - lsls r0, 24 - mov r5, r10 - ldr r4, [r5] - ldr r2, =gUnknown_08577574 - lsrs r0, 22 - adds r1, r0, r2 - ldrh r3, [r1] - movs r5, 0xE3 - lsls r5, 3 - adds r1, r4, r5 - strh r3, [r1] - adds r2, 0x2 - adds r0, r2 - ldrh r0, [r0] - ldr r1, =0x0000071a - adds r4, r1 - strh r0, [r4] - add r0, sp, 0x4 - bl LoadSpritePalettes - mov r2, r10 - ldr r0, [r2] - movs r6, 0xE7 - lsls r6, 3 - adds r0, r6 - movs r1, 0xFC - lsls r1, 2 - str r1, [r0] - adds r0, r7, 0 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 24 - mov r4, r10 - ldr r3, [r4] - lsls r1, r0, 4 - movs r5, 0x87 - lsls r5, 1 - mov r9, r5 - add r1, r9 - ldr r4, =0x0000071c - adds r2, r3, r4 - strh r1, [r2] - adds r3, r6 - movs r5, 0x80 - lsls r5, 9 - adds r1, r5, 0 - lsls r1, r0 - ldr r0, [r3] - orrs r0, r1 - str r0, [r3] - adds r0, r7, 0 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 24 - mov r1, r10 - ldr r4, [r1] - lsls r1, r0, 4 - add r1, r9 - ldr r3, =0x0000071e - adds r2, r4, r3 - strh r1, [r2] - adds r6, r4, r6 - lsls r5, r0 - ldr r0, [r6] - orrs r0, r5 - str r0, [r6] - ldr r5, =0x000021b8 - adds r4, r5 - mov r0, r8 - bl GetBoxNamePtr - adds r1, r0, 0 - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x8 - bl StringCopyPadded - mov r4, r10 - ldr r1, [r4] - adds r5, r1, r5 - movs r0, 0xBE - lsls r0, 2 - adds r1, r0 - movs r0, 0x2 - str r0, [sp] - adds r0, r5, 0 - movs r2, 0 - movs r3, 0 - bl sub_80C6D80 - ldr r0, [sp, 0x2C] - bl LoadSpriteSheet - mov r0, r8 - bl GetBoxNamePtr - bl sub_80CD00C - movs r4, 0 - lsls r0, 16 - asrs r6, r0, 16 -_080CCC70: - lsls r1, r4, 5 - adds r1, r6, r1 - lsls r1, 16 - asrs r1, 16 - ldr r0, =gSpriteTemplate_857B0A8 - movs r2, 0x1C - movs r3, 0x18 - bl CreateSprite - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldr r5, =gUnknown_02039D08 - ldr r2, [r5] - lsls r0, r4, 2 - movs r3, 0xE4 - lsls r3, 3 - adds r2, r3 - adds r2, r0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - str r0, [r2] - lsls r1, r4, 24 - lsrs r1, 24 - bl StartSpriteAnim - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0x1 - bls _080CCC70 - ldr r0, [r5] - movs r4, 0xDF - lsls r4, 3 - adds r0, r4 - movs r1, 0 - strb r1, [r0] - add sp, 0x30 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CCB50 - - thumb_func_start sub_80CCCFC -sub_80CCCFC: @ 80CCCFC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x2C - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x28] - lsls r1, 24 - lsrs r1, 24 - mov r10, r1 - ldr r4, =gUnknown_02039D08 - ldr r2, [r4] - movs r1, 0xBE - lsls r1, 2 - adds r0, r2, r1 - str r0, [sp, 0x1C] - add r3, sp, 0x1C - ldr r5, =0x0000ffff - mov r12, r5 - movs r6, 0xC0 - lsls r6, 10 - mov r9, r6 - ldr r0, =0x00030200 - str r0, [r3, 0x4] - add r1, sp, 0x4 - ldr r0, =gSpriteTemplate_857B0A8 - ldm r0!, {r5-r7} - stm r1!, {r5-r7} - ldm r0!, {r5-r7} - stm r1!, {r5-r7} - movs r1, 0 - movs r5, 0xDF - lsls r5, 3 - adds r2, r5 - ldrb r0, [r2] - mov r8, r4 - adds r6, r3, 0 - cmp r0, 0 - bne _080CCD50 - movs r1, 0x1 -_080CCD50: - strb r1, [r2] - mov r7, r8 - ldr r0, [r7] - adds r0, r5 - ldrb r0, [r0] - cmp r0, 0 - bne _080CCD8C - ldr r0, [r6, 0x4] - mov r1, r12 - ands r0, r1 - mov r3, r9 - orrs r0, r3 - str r0, [r6, 0x4] - ldr r0, [r7] - ldr r5, =0x0000071c - adds r0, r5 - ldrh r0, [r0] - mov r9, r0 - b _080CCDB0 - .pool -_080CCD8C: - ldr r0, [r6, 0x4] - mov r7, r12 - ands r0, r7 - movs r1, 0x80 - lsls r1, 11 - orrs r0, r1 - str r0, [r6, 0x4] - mov r1, r8 - ldr r0, [r1] - ldr r3, =0x0000071c - adds r0, r3 - ldrh r0, [r0] - mov r9, r0 - add r1, sp, 0x4 - movs r0, 0x4 - strh r0, [r1] - ldr r0, =0x0000dac9 - strh r0, [r1, 0x2] -_080CCDB0: - mov r5, r8 - ldr r4, [r5] - ldr r5, =0x000021b8 - adds r4, r5 - ldr r0, [sp, 0x28] - bl GetBoxNamePtr - adds r1, r0, 0 - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x8 - bl StringCopyPadded - mov r7, r8 - ldr r1, [r7] - adds r5, r1, r5 - movs r0, 0xBE - lsls r0, 2 - adds r1, r0 - movs r0, 0x2 - str r0, [sp] - adds r0, r5, 0 - movs r2, 0 - movs r3, 0 - bl sub_80C6D80 - adds r0, r6, 0 - bl LoadSpriteSheet - ldr r0, [sp, 0x28] - bl sub_80D20F8 - lsls r0, 24 - lsrs r0, 22 - ldr r1, =gUnknown_08577574 - adds r0, r1 - mov r1, r9 - movs r2, 0x4 - bl LoadPalette - ldr r0, [sp, 0x28] - bl GetBoxNamePtr - bl sub_80CD00C - lsls r0, 16 - mov r1, r10 - lsls r2, r1, 24 - asrs r2, 24 - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 6 - lsrs r3, r0, 16 - str r3, [sp, 0x24] - asrs r0, 16 - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - movs r7, 0 - mov r9, r8 - negs r2, r2 - mov r8, r2 -_080CCE2E: - lsls r6, r7, 5 - mov r5, r10 - lsls r1, r5, 16 - asrs r1, 16 - adds r1, r6 - lsls r1, 16 - asrs r1, 16 - add r0, sp, 0x4 - movs r2, 0x1C - movs r3, 0x18 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - mov r1, r9 - ldr r2, [r1] - lsls r5, r7, 2 - movs r3, 0xE5 - lsls r3, 3 - adds r2, r3 - adds r2, r5 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - str r1, [r2] - mov r0, r8 - lsls r4, r0, 1 - add r4, r8 - lsls r4, 1 - strh r4, [r1, 0x2E] - ldr r1, [r2] - ldr r3, [sp, 0x24] - lsls r0, r3, 16 - asrs r0, 16 - adds r0, r6 - strh r0, [r1, 0x30] - ldr r0, [r2] - movs r6, 0 - strh r6, [r0, 0x32] - ldr r0, [r2] - ldr r1, =sub_80CCF30 - str r1, [r0, 0x1C] - lsls r1, r7, 24 - lsrs r1, 24 - bl StartSpriteAnim - mov r1, r9 - ldr r0, [r1] - movs r3, 0xE4 - lsls r3, 3 - adds r0, r3 - adds r0, r5 - ldr r1, [r0] - strh r4, [r1, 0x2E] - ldr r2, [r0] - movs r1, 0x1 - strh r1, [r2, 0x30] - ldr r1, [r0] - ldr r0, =sub_80CCF64 - str r0, [r1, 0x1C] - adds r0, r7, 0x1 - lsls r0, 16 - lsrs r7, r0, 16 - cmp r7, 0x1 - bls _080CCE2E - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CCCFC - - thumb_func_start sub_80CCEE0 -sub_80CCEE0: @ 80CCEE0 - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - movs r1, 0xDF - lsls r1, 3 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080CCF00 - movs r0, 0x4 - bl FreeSpriteTilesByTag - b _080CCF06 - .pool -_080CCF00: - movs r0, 0x3 - bl FreeSpriteTilesByTag -_080CCF06: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - movs r3, 0xE4 - lsls r3, 3 - adds r2, r0, r3 - adds r3, 0x8 - adds r1, r0, r3 - ldr r1, [r1] - str r1, [r2] - ldr r2, =0x00000724 - adds r1, r0, r2 - adds r3, 0x4 - adds r0, r3 - ldr r0, [r0] - str r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CCEE0 - - thumb_func_start sub_80CCF30 -sub_80CCF30: @ 80CCF30 - push {lr} - adds r2, r0, 0 - ldrh r1, [r2, 0x32] - movs r3, 0x32 - ldrsh r0, [r2, r3] - cmp r0, 0 - beq _080CCF44 - subs r0, r1, 0x1 - strh r0, [r2, 0x32] - b _080CCF5C -_080CCF44: - ldrh r0, [r2, 0x2E] - ldrh r1, [r2, 0x20] - adds r0, r1 - strh r0, [r2, 0x20] - lsls r0, 16 - asrs r0, 16 - movs r3, 0x30 - ldrsh r1, [r2, r3] - cmp r0, r1 - bne _080CCF5C - ldr r0, =SpriteCallbackDummy - str r0, [r2, 0x1C] -_080CCF5C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CCF30 - - thumb_func_start sub_80CCF64 -sub_80CCF64: @ 80CCF64 - push {lr} - adds r2, r0, 0 - ldrh r1, [r2, 0x30] - movs r3, 0x30 - ldrsh r0, [r2, r3] - cmp r0, 0 - beq _080CCF78 - subs r0, r1, 0x1 - strh r0, [r2, 0x30] - b _080CCF96 -_080CCF78: - ldrh r0, [r2, 0x2E] - ldrh r1, [r2, 0x20] - adds r0, r1 - strh r0, [r2, 0x20] - ldrh r1, [r2, 0x24] - adds r0, r1 - strh r0, [r2, 0x32] - subs r0, 0x40 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xC0 - bls _080CCF96 - adds r0, r2, 0 - bl DestroySprite -_080CCF96: - pop {r0} - bx r0 - thumb_func_end sub_80CCF64 - - thumb_func_start sub_80CCF9C -sub_80CCF9C: @ 80CCF9C - push {lr} - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - bl sub_80D20F8 - lsls r0, 24 - lsrs r1, r0, 24 - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - movs r3, 0xDF - lsls r3, 3 - adds r0, r2, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _080CCFE4 - lsls r0, r1, 2 - ldr r1, =gUnknown_08577574 - adds r0, r1 - adds r3, 0x24 - adds r1, r2, r3 - ldrh r1, [r1] - lsls r1, 1 - ldr r2, =gPlttBufferUnfaded - adds r1, r2 - movs r2, 0x2 - bl CpuSet - b _080CCFFC - .pool -_080CCFE4: - lsls r0, r1, 2 - ldr r1, =gUnknown_08577574 - adds r0, r1 - ldr r3, =0x0000071e - adds r1, r2, r3 - ldrh r1, [r1] - lsls r1, 1 - ldr r2, =gPlttBufferUnfaded - adds r1, r2 - movs r2, 0x2 - bl CpuSet -_080CCFFC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CCF9C - - thumb_func_start sub_80CD00C -sub_80CD00C: @ 80CD00C - push {lr} - adds r1, r0, 0 - movs r0, 0x1 - movs r2, 0 - bl GetStringWidth - adds r1, r0, 0 - lsrs r0, r1, 31 - adds r1, r0 - asrs r1, 1 - movs r0, 0xB0 - subs r0, r1 - lsls r0, 16 - asrs r0, 16 - pop {r1} - bx r1 - thumb_func_end sub_80CD00C - - thumb_func_start sub_80CD02C -sub_80CD02C: @ 80CD02C - push {r4,r5,lr} - ldr r0, =gUnknown_0857B080 - bl LoadSpriteSheet - movs r5, 0 -_080CD036: - lsls r1, r5, 4 - adds r1, r5 - lsls r1, 19 - movs r0, 0xB8 - lsls r0, 15 - adds r1, r0 - asrs r1, 16 - ldr r0, =gUnknown_0857B0E0 - movs r2, 0x1C - movs r3, 0x16 - bl CreateSprite - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x40 - beq _080CD088 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r4, r0, r1 - lsls r1, r5, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim - movs r0, 0x1 - cmp r5, 0 - bne _080CD076 - movs r1, 0x1 - negs r1, r1 - adds r0, r1, 0 -_080CD076: - strh r0, [r4, 0x34] - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - lsls r1, r5, 2 - movs r2, 0xE6 - lsls r2, 3 - adds r0, r2 - adds r0, r1 - str r4, [r0] -_080CD088: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x1 - bls _080CD036 - bl IsCursorOnBox - lsls r0, 24 - cmp r0, 0 - beq _080CD0A2 - movs r0, 0x1 - bl sub_80CD1A8 -_080CD0A2: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD02C - - thumb_func_start sub_80CD0B8 -sub_80CD0B8: @ 80CD0B8 - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r2, 0 - ldr r7, =gUnknown_02039D08 - mov r12, r7 - movs r6, 0xE6 - lsls r6, 3 - movs r4, 0 - movs r3, 0x2 -_080CD0CC: - mov r0, r12 - ldr r1, [r0] - lsls r0, r2, 2 - adds r1, r6 - adds r1, r0 - ldr r0, [r1] - strh r4, [r0, 0x24] - ldr r0, [r1] - strh r3, [r0, 0x2E] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x1 - bls _080CD0CC - lsls r0, r5, 24 - cmp r0, 0 - bge _080CD114 - ldr r1, [r7] - movs r2, 0xE6 - lsls r2, 3 - adds r3, r1, r2 - ldr r2, [r3] - movs r0, 0x1D - strh r0, [r2, 0x30] - ldr r0, =0x00000734 - adds r1, r0 - ldr r2, [r1] - movs r0, 0x5 - strh r0, [r2, 0x30] - ldr r0, [r3] - movs r2, 0x48 - b _080CD130 - .pool -_080CD114: - ldr r1, [r7] - movs r2, 0xE6 - lsls r2, 3 - adds r3, r1, r2 - ldr r2, [r3] - movs r0, 0x5 - strh r0, [r2, 0x30] - ldr r0, =0x00000734 - adds r1, r0 - ldr r2, [r1] - movs r0, 0x1D - strh r0, [r2, 0x30] - ldr r0, [r3] - movs r2, 0xF8 -_080CD130: - strh r2, [r0, 0x32] - ldr r0, [r1] - strh r2, [r0, 0x32] - ldr r1, [r7] - movs r2, 0xE6 - lsls r2, 3 - adds r0, r1, r2 - ldr r2, [r0] - movs r0, 0 - strh r0, [r2, 0x3C] - ldr r0, =0x00000734 - adds r1, r0 - ldr r1, [r1] - movs r0, 0x1 - strh r0, [r1, 0x3C] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD0B8 - - thumb_func_start sub_80CD158 -sub_80CD158: @ 80CD158 - push {r4-r6,lr} - movs r3, 0 - movs r5, 0 - movs r6, 0x5 - negs r6, r6 - ldr r4, =gUnknown_02039D08 -_080CD164: - ldr r1, [r4] - lsls r0, r3, 2 - movs r2, 0xE6 - lsls r2, 3 - adds r1, r2 - adds r1, r0 - ldr r2, [r1] - lsls r0, r3, 4 - adds r0, r3 - lsls r0, 3 - adds r0, 0x5C - strh r0, [r2, 0x20] - ldr r0, [r1] - strh r5, [r0, 0x24] - ldr r1, [r1] - adds r1, 0x3E - ldrb r2, [r1] - adds r0, r6, 0 - ands r0, r2 - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0x1 - bls _080CD164 - movs r0, 0x1 - bl sub_80CD1A8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD158 - - thumb_func_start sub_80CD1A8 -sub_80CD1A8: @ 80CD1A8 - push {r4-r6,lr} - lsls r0, 24 - cmp r0, 0 - beq _080CD1E4 - movs r2, 0 - ldr r6, =gUnknown_02039D08 - movs r5, 0xE6 - lsls r5, 3 - movs r3, 0 - movs r4, 0x1 -_080CD1BC: - ldr r1, [r6] - lsls r0, r2, 2 - adds r1, r5 - adds r1, r0 - ldr r0, [r1] - strh r4, [r0, 0x2E] - ldr r0, [r1] - strh r3, [r0, 0x30] - ldr r0, [r1] - strh r3, [r0, 0x32] - ldr r0, [r1] - strh r3, [r0, 0x36] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x1 - bls _080CD1BC - b _080CD204 - .pool -_080CD1E4: - movs r2, 0 - ldr r5, =gUnknown_02039D08 - movs r4, 0xE6 - lsls r4, 3 - movs r3, 0 -_080CD1EE: - ldr r0, [r5] - lsls r1, r2, 2 - adds r0, r4 - adds r0, r1 - ldr r0, [r0] - strh r3, [r0, 0x2E] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x1 - bls _080CD1EE -_080CD204: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD1A8 - - thumb_func_start sub_80CD210 -sub_80CD210: @ 80CD210 - push {lr} - adds r2, r0, 0 - movs r1, 0x2E - ldrsh r0, [r2, r1] - cmp r0, 0x4 - bhi _080CD2DC - lsls r0, 2 - ldr r1, =_080CD22C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080CD22C: - .4byte _080CD240 - .4byte _080CD246 - .4byte _080CD274 - .4byte _080CD27A - .4byte _080CD2CC -_080CD240: - movs r0, 0 - strh r0, [r2, 0x24] - b _080CD2DC -_080CD246: - ldrh r0, [r2, 0x30] - adds r0, 0x1 - movs r1, 0 - strh r0, [r2, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3 - ble _080CD2DC - strh r1, [r2, 0x30] - ldrh r0, [r2, 0x34] - ldrh r3, [r2, 0x24] - adds r0, r3 - strh r0, [r2, 0x24] - ldrh r0, [r2, 0x32] - adds r0, 0x1 - strh r0, [r2, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5 - ble _080CD2DC - strh r1, [r2, 0x32] - strh r1, [r2, 0x24] - b _080CD2DC -_080CD274: - movs r0, 0x3 - strh r0, [r2, 0x2E] - b _080CD2DC -_080CD27A: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r0, =0x000002ce - adds r1, r0 - ldrh r0, [r2, 0x20] - ldrh r1, [r1] - subs r0, r1 - strh r0, [r2, 0x20] - subs r0, 0x49 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xAE - bls _080CD2A0 - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r3] -_080CD2A0: - ldrh r0, [r2, 0x30] - subs r0, 0x1 - strh r0, [r2, 0x30] - lsls r0, 16 - cmp r0, 0 - bne _080CD2DC - ldrh r0, [r2, 0x32] - strh r0, [r2, 0x20] - adds r3, r2, 0 - adds r3, 0x3E - ldrb r1, [r3] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r3] - movs r0, 0x4 - strh r0, [r2, 0x2E] - b _080CD2DC - .pool -_080CD2CC: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x000002ce - adds r0, r1 - ldrh r1, [r2, 0x20] - ldrh r0, [r0] - subs r1, r0 - strh r1, [r2, 0x20] -_080CD2DC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD210 - - thumb_func_start sub_80CD2E8 -sub_80CD2E8: @ 80CD2E8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r0, 0 - adds r6, r1, 0 - ldr r4, [sp, 0x18] - lsls r2, 24 - lsrs r7, r2, 24 - lsls r3, 24 - lsrs r3, 24 - mov r8, r3 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0857B0E0 - lsls r5, 16 - asrs r5, 16 - lsls r6, 16 - asrs r6, 16 - adds r1, r5, 0 - adds r2, r6, 0 - adds r3, r4, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _080CD360 - movs r1, 0x1 - ands r1, r7 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r5, =gSprites - adds r6, r4, r5 - adds r0, r6, 0 - bl StartSpriteAnim - movs r0, 0x3 - mov r1, r8 - ands r1, r0 - lsls r1, 2 - ldrb r2, [r6, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r6, 0x5] - adds r5, 0x1C - adds r4, r5 - ldr r0, =SpriteCallbackDummy - str r0, [r4] - adds r0, r6, 0 - b _080CD362 - .pool -_080CD360: - movs r0, 0 -_080CD362: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80CD2E8 - - thumb_func_start sub_80CD36C -sub_80CD36C: @ 80CD36C - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r1, [r0, 0x1] - cmp r1, 0x1 - beq _080CD388 - ldr r1, =sBoxCursorAction - movs r0, 0 - strb r0, [r1] - b _080CD38C - .pool -_080CD388: - ldr r0, =sBoxCursorAction - strb r1, [r0] -_080CD38C: - ldr r0, =sBoxCursorPosition - movs r1, 0 - strb r1, [r0] - ldr r0, =sIsMonBeingMoved - strb r1, [r0] - ldr r0, =sMovingMonOrigBoxId - strb r1, [r0] - ldr r0, =sMovingMonOrigBoxPos - strb r1, [r0] - ldr r0, =sCanOnlyMove - strb r1, [r0] - bl sub_80CDC0C - bl sub_80CFC14 - ldr r2, =gUnknown_02039D08 - ldr r0, [r2] - ldr r1, =0x00000cd6 - adds r0, r1 - movs r3, 0 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r2] - ldr r1, =0x000021ff - adds r0, r1 - strb r3, [r0] - bl sub_80CEB40 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD36C - - thumb_func_start sub_80CD3EC -sub_80CD3EC: @ 80CD3EC - push {lr} - bl sub_80CFC14 - bl sub_80CEBDC - ldr r3, =gUnknown_02039D08 - ldr r0, [r3] - ldr r1, =0x00000cd6 - adds r0, r1 - movs r2, 0 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r3] - ldr r1, =0x000021ff - adds r0, r1 - strb r2, [r0] - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CD426 - ldr r0, [r3] - ldr r1, =0x000020a4 - adds r0, r1 - ldr r1, =gUnknown_02039D14 - movs r2, 0x64 - bl memcpy - bl sub_80CAFC4 -_080CD426: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD3EC - - thumb_func_start sub_80CD444 -sub_80CD444: @ 80CD444 - push {r4-r6,lr} - adds r4, r2, 0 - adds r6, r3, 0 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - cmp r0, 0x4 - bhi _080CD4FC - lsls r0, 2 - ldr r1, =_080CD464 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080CD464: - .4byte _080CD478 - .4byte _080CD4A6 - .4byte _080CD4CE - .4byte _080CD4D6 - .4byte _080CD4F4 -_080CD478: - adds r0, r5, 0 - movs r1, 0x6 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 3 - adds r1, 0x64 - strh r1, [r4] - adds r0, r5, 0 - movs r1, 0x6 - bl __udivsi3 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 3 - adds r1, 0x20 - strh r1, [r6] - b _080CD4FC -_080CD4A6: - cmp r5, 0 - bne _080CD4B2 - movs r0, 0x68 - strh r0, [r4] - movs r0, 0x34 - b _080CD4FA -_080CD4B2: - cmp r5, 0x6 - bne _080CD4BE - movs r0, 0x98 - strh r0, [r4] - movs r0, 0x84 - b _080CD4FA -_080CD4BE: - movs r0, 0x98 - strh r0, [r4] - subs r1, r5, 0x1 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - adds r0, 0x4 - b _080CD4FA -_080CD4CE: - movs r0, 0xA2 - strh r0, [r4] - movs r0, 0xC - b _080CD4FA -_080CD4D6: - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - movs r1, 0xE - cmp r0, 0 - beq _080CD4E2 - movs r1, 0x8 -_080CD4E2: - strh r1, [r6] - movs r0, 0x58 - muls r0, r5 - adds r0, 0x78 - strh r0, [r4] - b _080CD4FC - .pool -_080CD4F4: - movs r0, 0xA0 - strh r0, [r4] - movs r0, 0x60 -_080CD4FA: - strh r0, [r6] -_080CD4FC: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80CD444 - - thumb_func_start sub_80CD504 -sub_80CD504: @ 80CD504 - push {lr} - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - beq _080CD538 - cmp r0, 0x1 - bne _080CD54C - ldr r0, =sBoxCursorPosition - movs r1, 0 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - b _080CD542 - .pool -_080CD538: - ldr r0, =sBoxCursorPosition - ldrb r0, [r0] - movs r1, 0xB - bl GetBoxMonDataFromSelectedBox -_080CD542: - lsls r0, 16 - lsrs r0, 16 - b _080CD54E - .pool -_080CD54C: - movs r0, 0 -_080CD54E: - pop {r1} - bx r1 - thumb_func_end sub_80CD504 - - thumb_func_start sub_80CD554 -sub_80CD554: @ 80CD554 - push {r4-r7,lr} - ldr r7, =gUnknown_02039D08 - ldr r5, [r7] - movs r0, 0xCD - lsls r0, 4 - adds r1, r5, r0 - ldrh r0, [r1] - cmp r0, 0 - bne _080CD57E - ldrb r0, [r5, 0x1] - cmp r0, 0x3 - beq _080CD574 - movs r0, 0 - b _080CD69A - .pool -_080CD574: - bl sub_80D1218 - lsls r0, 24 - lsrs r0, 24 - b _080CD69A -_080CD57E: - subs r0, 0x1 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - beq _080CD67C - ldr r1, =0x00000cbc - adds r4, r5, r1 - ldr r2, =0x00000cc4 - adds r1, r5, r2 - ldr r0, [r4] - ldr r1, [r1] - adds r0, r1 - str r0, [r4] - movs r0, 0xCC - lsls r0, 4 - adds r3, r5, r0 - adds r2, 0x4 - adds r1, r5, r2 - ldr r0, [r3] - ldr r1, [r1] - adds r0, r1 - str r0, [r3] - ldr r6, =0x00000cb4 - adds r1, r5, r6 - ldr r2, [r1] - ldr r0, [r4] - asrs r0, 8 - strh r0, [r2, 0x20] - ldr r2, [r1] - ldr r0, [r3] - asrs r0, 8 - strh r0, [r2, 0x22] - ldr r1, [r1] - ldrh r2, [r1, 0x20] - movs r3, 0x20 - ldrsh r0, [r1, r3] - movs r3, 0x80 - lsls r3, 1 - cmp r0, r3 - ble _080CD5DA - ldr r4, =0xffffff00 - adds r0, r2, r4 - lsls r0, 16 - asrs r0, 16 - adds r0, 0x40 - strh r0, [r1, 0x20] -_080CD5DA: - ldr r0, [r7] - adds r0, r6 - ldr r1, [r0] - ldrh r2, [r1, 0x20] - movs r4, 0x20 - ldrsh r0, [r1, r4] - cmp r0, 0x3F - bgt _080CD5F6 - movs r0, 0x40 - subs r0, r2 - lsls r0, 16 - asrs r0, 16 - subs r0, r3, r0 - strh r0, [r1, 0x20] -_080CD5F6: - ldr r0, [r7] - adds r0, r6 - ldr r1, [r0] - ldrh r2, [r1, 0x22] - movs r3, 0x22 - ldrsh r0, [r1, r3] - cmp r0, 0xB0 - ble _080CD612 - adds r0, r2, 0 - subs r0, 0xB0 - lsls r0, 16 - asrs r0, 16 - subs r0, 0x10 - strh r0, [r1, 0x22] -_080CD612: - ldr r0, [r7] - adds r0, r6 - ldr r2, [r0] - ldrh r3, [r2, 0x22] - movs r4, 0x22 - ldrsh r0, [r2, r4] - movs r1, 0x10 - negs r1, r1 - cmp r0, r1 - bge _080CD632 - subs r0, r1, r3 - movs r1, 0xB0 - lsls r0, 16 - asrs r0, 16 - subs r1, r0 - strh r1, [r2, 0x22] -_080CD632: - ldr r0, [r7] - ldr r2, =0x00000cd7 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0 - beq _080CD698 - subs r0, 0x1 - strb r0, [r1] - lsls r0, 24 - cmp r0, 0 - bne _080CD698 - ldr r0, [r7] - adds r0, r6 - ldr r2, [r0] - adds r2, 0x3F - ldrb r3, [r2] - lsrs r1, r3, 1 - movs r0, 0x1 - eors r1, r0 - ands r1, r0 - lsls r1, 1 - movs r0, 0x3 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - b _080CD698 - .pool -_080CD67C: - ldr r3, =0x00000cb4 - adds r2, r5, r3 - ldr r1, [r2] - ldr r4, =0x00000ccc - adds r0, r5, r4 - ldrh r0, [r0] - strh r0, [r1, 0x20] - ldr r1, [r2] - ldr r2, =0x00000cce - adds r0, r5, r2 - ldrh r0, [r0] - strh r0, [r1, 0x22] - bl sub_80CDA68 -_080CD698: - movs r0, 0x1 -_080CD69A: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CD554 - - thumb_func_start sub_80CD6AC -sub_80CD6AC: @ 80CD6AC - push {r4-r6,lr} - sub sp, 0x4 - adds r4, r0, 0 - adds r5, r1, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - mov r6, sp - adds r6, 0x2 - adds r0, r4, 0 - adds r1, r5, 0 - mov r2, sp - adds r3, r6, 0 - bl sub_80CD444 - ldr r1, =gUnknown_02039D08 - ldr r0, [r1] - ldr r2, =0x00000cd4 - adds r0, r2 - strb r4, [r0] - ldr r0, [r1] - ldr r3, =0x00000cd5 - adds r0, r3 - strb r5, [r0] - ldr r1, [r1] - mov r0, sp - ldrh r2, [r0] - subs r3, 0x9 - adds r0, r1, r3 - strh r2, [r0] - ldrh r0, [r6] - ldr r2, =0x00000cce - adds r1, r2 - strh r0, [r1] - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD6AC - - thumb_func_start sub_80CD70C -sub_80CD70C: @ 80CD70C - push {r4-r7,lr} - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - ldr r3, =0x00000cd2 - adds r1, r2, r3 - ldrh r1, [r1] - adds r4, r0, 0 - cmp r1, 0 - beq _080CD730 - movs r0, 0xCD - lsls r0, 4 - adds r1, r2, r0 - movs r0, 0xC - b _080CD738 - .pool -_080CD730: - movs r3, 0xCD - lsls r3, 4 - adds r1, r2, r3 - movs r0, 0x6 -_080CD738: - strh r0, [r1] - ldr r1, [r4] - ldr r0, =0x00000cd7 - adds r2, r1, r0 - ldrb r0, [r2] - cmp r0, 0 - beq _080CD752 - movs r3, 0xCD - lsls r3, 4 - adds r0, r1, r3 - ldrh r0, [r0] - lsrs r0, 1 - strb r0, [r2] -_080CD752: - ldr r2, [r4] - ldr r1, =0x00000cd2 - adds r0, r2, r1 - movs r1, 0 - ldrsb r1, [r0, r1] - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _080CD78C - cmp r1, 0x1 - beq _080CD7AC - ldr r3, =0x00000cce - adds r0, r2, r3 - movs r3, 0 - ldrsh r1, [r0, r3] - ldr r3, =0x00000cb4 - adds r0, r2, r3 - ldr r0, [r0] - movs r2, 0x22 - ldrsh r0, [r0, r2] - b _080CD7C0 - .pool -_080CD78C: - ldr r3, =0x00000cce - adds r0, r2, r3 - movs r3, 0 - ldrsh r1, [r0, r3] - ldr r3, =0x00000cb4 - adds r0, r2, r3 - ldr r0, [r0] - movs r2, 0x22 - ldrsh r0, [r0, r2] - adds r0, 0xC0 - b _080CD7C0 - .pool -_080CD7AC: - ldr r3, =0x00000cce - adds r0, r2, r3 - movs r3, 0 - ldrsh r1, [r0, r3] - ldr r3, =0x00000cb4 - adds r0, r2, r3 - ldr r0, [r0] - movs r2, 0x22 - ldrsh r0, [r0, r2] - subs r0, 0xC0 -_080CD7C0: - subs r7, r1, r0 - ldr r2, [r4] - ldr r3, =0x00000cd3 - adds r0, r2, r3 - movs r1, 0 - ldrsb r1, [r0, r1] - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _080CD7FC - cmp r1, 0x1 - beq _080CD81C - ldr r1, =0x00000ccc - adds r0, r2, r1 - movs r3, 0 - ldrsh r1, [r0, r3] - ldr r3, =0x00000cb4 - adds r0, r2, r3 - ldr r0, [r0] - movs r2, 0x20 - ldrsh r0, [r0, r2] - b _080CD830 - .pool -_080CD7FC: - ldr r3, =0x00000ccc - adds r0, r2, r3 - movs r3, 0 - ldrsh r1, [r0, r3] - ldr r3, =0x00000cb4 - adds r0, r2, r3 - ldr r0, [r0] - movs r2, 0x20 - ldrsh r0, [r0, r2] - adds r0, 0xC0 - b _080CD830 - .pool -_080CD81C: - ldr r3, =0x00000ccc - adds r0, r2, r3 - movs r3, 0 - ldrsh r1, [r0, r3] - ldr r3, =0x00000cb4 - adds r0, r2, r3 - ldr r0, [r0] - movs r2, 0x20 - ldrsh r0, [r0, r2] - subs r0, 0xC0 -_080CD830: - subs r0, r1, r0 - lsls r7, 8 - lsls r0, 8 - ldr r4, [r4] - ldr r3, =0x00000cc4 - adds r6, r4, r3 - movs r1, 0xCD - lsls r1, 4 - adds r5, r4, r1 - ldrh r1, [r5] - bl __divsi3 - str r0, [r6] - ldr r2, =0x00000cc8 - adds r6, r4, r2 - ldrh r1, [r5] - adds r0, r7, 0 - bl __divsi3 - str r0, [r6] - ldr r3, =0x00000cbc - adds r2, r4, r3 - ldr r0, =0x00000cb4 - adds r1, r4, r0 - ldr r0, [r1] - movs r3, 0x20 - ldrsh r0, [r0, r3] - lsls r0, 8 - str r0, [r2] - movs r0, 0xCC - lsls r0, 4 - adds r4, r0 - ldr r0, [r1] - movs r1, 0x22 - ldrsh r0, [r0, r1] - lsls r0, 8 - str r0, [r4] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD70C - - thumb_func_start sub_80CD894 -sub_80CD894: @ 80CD894 - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r6, r1, 24 - adds r0, r4, 0 - adds r1, r6, 0 - bl sub_80CD6AC - bl sub_80CD70C - ldr r5, =gUnknown_02039D08 - ldr r1, [r5] - ldrb r0, [r1, 0x1] - cmp r0, 0x3 - beq _080CD8E4 - ldr r2, =0x000021ff - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080CD8FC - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - bne _080CD8FC - ldr r2, =0x00000cb4 - adds r0, r1, r2 - ldr r0, [r0] - movs r1, 0x1 - bl StartSpriteAnim - b _080CD8FC - .pool -_080CD8E4: - bl sub_80D127C - lsls r0, 24 - cmp r0, 0 - bne _080CD8FC - ldr r0, [r5] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x1 - bl StartSpriteAnim -_080CD8FC: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080CD95C - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _080CD930 - ldr r0, =sBoxCursorPosition - ldrb r1, [r0] - movs r0, 0 - bl sub_80D0E50 - b _080CD93E - .pool -_080CD930: - cmp r0, 0x1 - bne _080CD93E - ldr r0, =sBoxCursorPosition - ldrb r1, [r0] - movs r0, 0x1 - bl sub_80D0E50 -_080CD93E: - cmp r4, 0 - bne _080CD950 - movs r0, 0 - adds r1, r6, 0 - bl sub_80D0D8C - b _080CD95C - .pool -_080CD950: - cmp r4, 0x1 - bne _080CD988 - movs r0, 0x1 - adds r1, r6, 0 - bl sub_80D0D8C -_080CD95C: - cmp r4, 0x1 - bne _080CD988 - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - beq _080CD988 - ldr r1, =gUnknown_02039D08 - ldr r0, [r1] - ldr r2, =0x00000cd6 - adds r0, r2 - strb r4, [r0] - ldr r0, [r1] - ldr r1, =0x00000cb8 - adds r0, r1 - ldr r1, [r0] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] -_080CD988: - cmp r4, 0 - beq _080CD9E4 - cmp r4, 0 - blt _080CDA56 - cmp r4, 0x3 - bgt _080CDA56 - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - ldr r2, =0x00000cb4 - adds r0, r2 - ldr r4, [r0] - ldrb r1, [r4, 0x5] - movs r2, 0xD - negs r2, r2 - adds r0, r2, 0 - ands r0, r1 - movs r3, 0x4 - orrs r0, r3 - strb r0, [r4, 0x5] - ldr r0, [r5] - ldr r4, =0x00000cb8 - adds r0, r4 - ldr r1, [r0] - adds r1, 0x3E - ldrb r0, [r1] - orrs r0, r3 - strb r0, [r1] - ldr r0, [r5] - adds r0, r4 - ldr r1, [r0] - ldrb r0, [r1, 0x5] - ands r2, r0 - orrs r2, r3 - strb r2, [r1, 0x5] - b _080CDA56 - .pool -_080CD9E4: - ldr r3, =gUnknown_02039D08 - ldr r1, [r3] - ldr r2, =0x000021ff - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080CDA28 - ldr r2, =0x00000cb4 - adds r0, r1, r2 - ldr r2, [r0] - ldrb r1, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x5] - ldr r0, [r3] - ldr r1, =0x00000cb8 - adds r0, r1 - ldr r1, [r0] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - b _080CDA56 - .pool -_080CDA28: - ldr r2, =0x00000cb4 - adds r0, r1, r2 - ldr r2, [r0] - ldrb r1, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - movs r1, 0x8 - orrs r0, r1 - strb r0, [r2, 0x5] - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _080CDA56 - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CDA56 - movs r0, 0x2 - bl sub_80CC0D4 -_080CDA56: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CD894 - - thumb_func_start sub_80CDA68 -sub_80CDA68: @ 80CDA68 - push {r4,lr} - ldr r1, =sBoxCursorAction - ldr r4, =gUnknown_02039D08 - ldr r2, [r4] - ldr r3, =0x00000cd4 - adds r0, r2, r3 - ldrb r0, [r0] - strb r0, [r1] - ldr r1, =sBoxCursorPosition - adds r3, 0x1 - adds r0, r2, r3 - ldrb r0, [r0] - strb r0, [r1] - ldrb r0, [r2, 0x1] - cmp r0, 0x3 - beq _080CDAC0 - ldr r1, =0x000021ff - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080CDAD8 - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - bne _080CDAD8 - subs r3, 0x21 - adds r0, r2, r3 - ldr r0, [r0] - movs r1, 0 - bl StartSpriteAnim - b _080CDAD8 - .pool -_080CDAC0: - bl sub_80D127C - lsls r0, 24 - cmp r0, 0 - bne _080CDAD8 - ldr r0, [r4] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0 - bl StartSpriteAnim -_080CDAD8: - bl sub_80CEB40 - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - beq _080CDB0E - cmp r0, 0x1 - bgt _080CDAFC - cmp r0, 0 - beq _080CDB30 - b _080CDB8A - .pool -_080CDAFC: - cmp r0, 0x2 - beq _080CDB06 - cmp r0, 0x3 - bne _080CDB8A - b _080CDB1E -_080CDB06: - movs r0, 0x1 - bl sub_80CD1A8 - b _080CDB8A -_080CDB0E: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r2, =0x00000cb8 - adds r0, r2 - ldr r0, [r0] - adds r0, 0x43 - movs r1, 0xD - strb r1, [r0] -_080CDB1E: - movs r0, 0x1 - bl sub_80CC0D4 - b _080CDB8A - .pool -_080CDB30: - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - ldr r3, =0x000021ff - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, 0 - bne _080CDB8A - ldr r2, =0x00000cb4 - adds r0, r1, r2 - ldr r3, [r0] - ldrb r1, [r3, 0x5] - movs r2, 0xD - negs r2, r2 - adds r0, r2, 0 - ands r0, r1 - movs r1, 0x4 - orrs r0, r1 - strb r0, [r3, 0x5] - ldr r0, [r4] - ldr r3, =0x00000cb8 - adds r0, r3 - ldr r1, [r0] - ldrb r0, [r1, 0x5] - ands r2, r0 - movs r0, 0x8 - orrs r2, r0 - strb r2, [r1, 0x5] - ldr r0, [r4] - adds r0, r3 - ldr r0, [r0] - adds r0, 0x43 - movs r1, 0x15 - strb r1, [r0] - ldr r0, [r4] - adds r0, r3 - ldr r1, [r0] - adds r1, 0x3E - ldrb r2, [r1] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - movs r0, 0x2 - bl sub_80CC0D4 -_080CDB8A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CDA68 - - thumb_func_start sub_80CDBA0 -sub_80CDBA0: @ 80CDBA0 - push {lr} - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - bne _080CDBB4 - movs r3, 0 - b _080CDBC2 - .pool -_080CDBB4: - bl CalculatePlayerPartyCount - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x5 - bls _080CDBC2 - movs r3, 0x5 -_080CDBC2: - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - ldr r1, =0x00000cb4 - adds r0, r2, r1 - ldr r0, [r0] - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080CDBE0 - ldr r0, =0x00000cd7 - adds r1, r2, r0 - movs r0, 0x1 - strb r0, [r1] -_080CDBE0: - movs r0, 0x1 - adds r1, r3, 0 - bl sub_80CD894 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CDBA0 - - thumb_func_start sub_80CDBF8 -sub_80CDBF8: @ 80CDBF8 - push {lr} - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0 - bl sub_80CD894 - pop {r0} - bx r0 - thumb_func_end sub_80CDBF8 - - thumb_func_start sub_80CDC0C -sub_80CDC0C: @ 80CDC0C - ldr r1, =gUnknown_02039D7E - movs r0, 0 - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_80CDC0C - - thumb_func_start sub_80CDC18 -sub_80CDC18: @ 80CDC18 - ldr r0, =gUnknown_02039D7E - ldr r1, =sBoxCursorPosition - ldrb r1, [r1] - strb r1, [r0] - bx lr - .pool - thumb_func_end sub_80CDC18 - - thumb_func_start sub_80CDC2C -sub_80CDC2C: @ 80CDC2C - ldr r0, =gUnknown_02039D7E - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80CDC2C - - thumb_func_start sub_80CDC38 -sub_80CDC38: @ 80CDC38 - lsls r0, 24 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - ldr r2, =0x00000d8c - adds r3, r1, r2 - ldr r2, =gUnknown_0857B998 - lsrs r0, 22 - adds r0, r2 - ldr r0, [r0] - str r0, [r3] - movs r0, 0xD9 - lsls r0, 4 - adds r1, r0 - movs r0, 0 - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_80CDC38 - - thumb_func_start sub_80CDC64 -sub_80CDC64: @ 80CDC64 - push {lr} - lsls r0, 24 - cmp r0, 0 - bne _080CDC84 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x00000d8c - adds r1, r2 - ldr r2, =sub_80CDEB4 - b _080CDC8E - .pool -_080CDC84: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x00000d8c - adds r1, r2 - ldr r2, =sub_80CDEC4 -_080CDC8E: - str r2, [r1] - ldr r0, [r0] - movs r1, 0xD9 - lsls r1, 4 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CDC64 - - thumb_func_start sub_80CDCAC -sub_80CDCAC: @ 80CDCAC - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000d8c - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CDCAC - - thumb_func_start sub_80CDCCC -sub_80CDCCC: @ 80CDCCC - push {r4,r5,lr} - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - movs r5, 0xD9 - lsls r5, 4 - adds r0, r1, r5 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080CDD1C - cmp r0, 0x1 - bgt _080CDCEC - cmp r0, 0 - beq _080CDCF6 - b _080CDD54 - .pool -_080CDCEC: - cmp r0, 0x2 - beq _080CDD40 - cmp r0, 0x3 - beq _080CDCFE - b _080CDD54 -_080CDCF6: - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CDD08 -_080CDCFE: - movs r0, 0 - b _080CDD56 - .pool -_080CDD08: - ldr r2, =0x00000cb4 - adds r0, r1, r2 - ldr r0, [r0] - movs r1, 0x2 - bl StartSpriteAnim - b _080CDD4A - .pool -_080CDD1C: - bl sub_80CDED4 - lsls r0, 24 - cmp r0, 0 - bne _080CDD54 - ldr r0, [r4] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x3 - bl StartSpriteAnim - bl sub_80CDF38 - b _080CDD4A - .pool -_080CDD40: - bl sub_80CDF08 - lsls r0, 24 - cmp r0, 0 - bne _080CDD54 -_080CDD4A: - ldr r1, [r4] - adds r1, r5 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080CDD54: - movs r0, 0x1 -_080CDD56: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80CDCCC - - thumb_func_start sub_80CDD5C -sub_80CDD5C: @ 80CDD5C - push {r4,r5,lr} - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - movs r5, 0xD9 - lsls r5, 4 - adds r0, r5 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080CDDA4 - cmp r0, 0x1 - bgt _080CDD7C - cmp r0, 0 - beq _080CDD82 - b _080CDDD0 - .pool -_080CDD7C: - cmp r0, 0x2 - beq _080CDDCC - b _080CDDD0 -_080CDD82: - bl sub_80CDED4 - lsls r0, 24 - cmp r0, 0 - bne _080CDDD0 - ldr r0, [r4] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x2 - bl StartSpriteAnim - bl sub_80CDFAC - b _080CDDBC - .pool -_080CDDA4: - bl sub_80CDF08 - lsls r0, 24 - cmp r0, 0 - bne _080CDDD0 - ldr r0, [r4] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0 - bl StartSpriteAnim -_080CDDBC: - ldr r1, [r4] - adds r1, r5 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080CDDD0 - .pool -_080CDDCC: - movs r0, 0 - b _080CDDD2 -_080CDDD0: - movs r0, 0x1 -_080CDDD2: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80CDD5C - - thumb_func_start sub_80CDDD8 -sub_80CDDD8: @ 80CDDD8 - push {r4,r5,lr} - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - movs r5, 0xD9 - lsls r5, 4 - adds r0, r1, r5 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080CDE68 - cmp r0, 0x1 - bgt _080CDDF8 - cmp r0, 0 - beq _080CDDFE - b _080CDEAC - .pool -_080CDDF8: - cmp r0, 0x2 - beq _080CDEA8 - b _080CDEAC -_080CDDFE: - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - beq _080CDE20 - cmp r0, 0x1 - bne _080CDEA8 - ldr r0, =0x00000d91 - adds r1, r0 - movs r0, 0xE - b _080CDE2A - .pool -_080CDE20: - bl StorageGetCurrentBox - ldr r1, [r4] - ldr r2, =0x00000d91 - adds r1, r2 -_080CDE2A: - strb r0, [r1] - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x2 - bl StartSpriteAnim - ldr r0, [r4] - ldr r2, =0x00000d91 - adds r0, r2 - ldrb r0, [r0] - ldr r1, =sBoxCursorPosition - ldrb r1, [r1] - bl sub_80CBD5C - ldr r1, [r4] - movs r0, 0xD9 - lsls r0, 4 - adds r1, r0 - b _080CDE94 - .pool -_080CDE68: - bl sub_80CBDC4 - lsls r0, 24 - cmp r0, 0 - bne _080CDEAC - ldr r0, [r4] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x3 - bl StartSpriteAnim - ldr r0, [r4] - ldr r2, =0x00000d91 - adds r0, r2 - ldrb r0, [r0] - ldr r1, =sBoxCursorPosition - ldrb r1, [r1] - bl diegohint1 - ldr r1, [r4] - adds r1, r5 -_080CDE94: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080CDEAC - .pool -_080CDEA8: - movs r0, 0 - b _080CDEAE -_080CDEAC: - movs r0, 0x1 -_080CDEAE: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80CDDD8 - - thumb_func_start sub_80CDEB4 -sub_80CDEB4: @ 80CDEB4 - push {lr} - bl sub_80CDED4 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_80CDEB4 - - thumb_func_start sub_80CDEC4 -sub_80CDEC4: @ 80CDEC4 - push {lr} - bl sub_80CDF08 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_80CDEC4 - - thumb_func_start sub_80CDED4 -sub_80CDED4: @ 80CDED4 - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r1, [r0] - movs r2, 0x26 - ldrsh r0, [r1, r2] - cmp r0, 0 - beq _080CDEEC - cmp r0, 0x8 - beq _080CDEFC -_080CDEEC: - ldrh r0, [r1, 0x26] - adds r0, 0x1 - strh r0, [r1, 0x26] - b _080CDF00 - .pool -_080CDEFC: - movs r0, 0 - b _080CDF02 -_080CDF00: - movs r0, 0x1 -_080CDF02: - pop {r1} - bx r1 - thumb_func_end sub_80CDED4 - - thumb_func_start sub_80CDF08 -sub_80CDF08: @ 80CDF08 - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r1, [r0] - movs r2, 0x26 - ldrsh r0, [r1, r2] - cmp r0, 0 - beq _080CDF30 - ldrh r0, [r1, 0x26] - subs r0, 0x1 - strh r0, [r1, 0x26] - movs r0, 0x1 - b _080CDF32 - .pool -_080CDF30: - movs r0, 0 -_080CDF32: - pop {r1} - bx r1 - thumb_func_end sub_80CDF08 - - thumb_func_start sub_80CDF38 -sub_80CDF38: @ 80CDF38 - push {r4,lr} - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - beq _080CDF68 - cmp r0, 0x1 - bne _080CDF94 - ldr r4, =sBoxCursorPosition - ldrb r1, [r4] - movs r0, 0xE - bl sub_80CE018 - ldrb r1, [r4] - movs r0, 0 - bl sub_80CBC14 - b _080CDF8E - .pool -_080CDF68: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x000021ff - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080CDF8E - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - ldr r4, =sBoxCursorPosition - ldrb r1, [r4] - bl sub_80CE018 - ldrb r1, [r4] - movs r0, 0x1 - bl sub_80CBC14 -_080CDF8E: - ldr r1, =sIsMonBeingMoved - movs r0, 0x1 - strb r0, [r1] -_080CDF94: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CDF38 - - thumb_func_start sub_80CDFAC -sub_80CDFAC: @ 80CDFAC - push {r4,r5,lr} - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - beq _080CDFDC - cmp r0, 0x1 - bne _080CDFFE - ldr r4, =sBoxCursorPosition - ldrb r1, [r4] - movs r0, 0xE - bl diegohint2 - ldrb r1, [r4] - movs r0, 0xE - bl sub_80CBCAC - b _080CDFF8 - .pool -_080CDFDC: - bl StorageGetCurrentBox - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =sBoxCursorPosition - ldrb r1, [r5] - adds r0, r4, 0 - bl diegohint2 - ldrb r1, [r5] - adds r0, r4, 0 - bl sub_80CBCAC -_080CDFF8: - ldr r1, =sIsMonBeingMoved - movs r0, 0 - strb r0, [r1] -_080CDFFE: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CDFAC - - thumb_func_start sub_80CE00C -sub_80CE00C: @ 80CE00C - push {lr} - bl sub_80CEB40 - pop {r0} - bx r0 - thumb_func_end sub_80CE00C - - thumb_func_start sub_80CE018 -sub_80CE018: @ 80CE018 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - cmp r4, 0xE - bne _080CE054 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x000020a4 - adds r0, r1 - ldr r3, =gPlayerParty - ldr r1, =sBoxCursorPosition - movs r2, 0 - ldrsb r2, [r1, r2] - movs r1, 0x64 - muls r1, r2 - adds r1, r3 - movs r2, 0x64 - bl memcpy - b _080CE064 - .pool -_080CE054: - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - ldr r0, =0x000020a4 - adds r2, r0 - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_80D2054 -_080CE064: - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_80CE0E8 - ldr r0, =sMovingMonOrigBoxId - strb r4, [r0] - ldr r0, =sMovingMonOrigBoxPos - strb r5, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE018 - - thumb_func_start diegohint2 -diegohint2: @ 80CE08C - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r7, r1, 24 - cmp r6, 0xE - bne _080CE0C0 - ldr r1, =gPlayerParty - movs r0, 0x64 - muls r0, r7 - adds r0, r1 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - ldr r2, =0x000020a4 - adds r1, r2 - movs r2, 0x64 - bl memcpy - b _080CE0D8 - .pool -_080CE0C0: - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - ldr r4, =0x000020a4 - adds r0, r4 - bl BoxMonRestorePP - ldr r2, [r5] - adds r2, r4 - adds r0, r6, 0 - adds r1, r7, 0 - bl CopyBoxMonFromAnyBox -_080CE0D8: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end diegohint2 - - thumb_func_start sub_80CE0E8 -sub_80CE0E8: @ 80CE0E8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - cmp r0, 0xE - bne _080CE108 - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - bl ZeroMonData - b _080CE10C - .pool -_080CE108: - bl ClearMonInBox -_080CE10C: - pop {r0} - bx r0 - thumb_func_end sub_80CE0E8 - - thumb_func_start diegohint1 -diegohint1: @ 80CE110 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r7, r1, 24 - cmp r6, 0xE - bne _080CE144 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00002108 - adds r0, r1 - ldr r2, =gPlayerParty - movs r1, 0x64 - muls r1, r7 - adds r1, r2 - movs r2, 0x64 - bl memcpy - b _080CE154 - .pool -_080CE144: - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - ldr r0, =0x00002108 - adds r2, r0 - adds r0, r6, 0 - adds r1, r7, 0 - bl sub_80D2054 -_080CE154: - adds r0, r6, 0 - adds r1, r7, 0 - bl diegohint2 - ldr r5, =gUnknown_02039D08 - ldr r1, [r5] - ldr r4, =0x000020a4 - adds r0, r1, r4 - ldr r2, =0x00002108 - adds r1, r2 - movs r2, 0x64 - bl memcpy - ldr r0, [r5] - adds r0, r4 - movs r1, 0 - bl sub_80CEC00 - ldr r0, =sMovingMonOrigBoxId - strb r6, [r0] - ldr r0, =sMovingMonOrigBoxPos - strb r7, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end diegohint1 - - thumb_func_start sub_80CE19C -sub_80CE19C: @ 80CE19C - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - adds r0, r6, 0 - bl GetFirstFreeBoxSpot - lsls r0, 16 - lsrs r4, r0, 16 - asrs r0, 16 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - bne _080CE1BA - movs r0, 0 - b _080CE21A -_080CE1BA: - ldr r5, =sIsMonBeingMoved - ldrb r0, [r5] - cmp r0, 0 - beq _080CE1DC - lsls r4, 24 - lsrs r1, r4, 24 - adds r0, r6, 0 - bl diegohint2 - bl sub_80CBAC4 - movs r0, 0 - strb r0, [r5] - b _080CE1F6 - .pool -_080CE1DC: - ldr r5, =sBoxCursorPosition - ldrb r1, [r5] - movs r0, 0xE - bl sub_80CE018 - lsls r4, 24 - lsrs r1, r4, 24 - adds r0, r6, 0 - bl diegohint2 - ldrb r0, [r5] - bl sub_80CBB68 -_080CE1F6: - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - cmp r6, r0 - bne _080CE208 - lsrs r0, r4, 24 - bl sub_80CB140 -_080CE208: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x1 - bl StartSpriteAnim - movs r0, 0x1 -_080CE21A: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CE19C - - thumb_func_start sub_80CE22C -sub_80CE22C: @ 80CE22C - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0 - bl StartSpriteAnim - bl sub_80CEB40 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE22C - - thumb_func_start sub_80CE250 -sub_80CE250: @ 80CE250 - push {lr} - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CE264 - movs r2, 0x2 - b _080CE274 - .pool -_080CE264: - ldr r0, =sBoxCursorAction - movs r1, 0 - ldrsb r1, [r0, r1] - movs r2, 0x1 - eors r1, r2 - negs r0, r1 - orrs r0, r1 - lsrs r2, r0, 31 -_080CE274: - ldr r0, =sBoxCursorPosition - ldrb r1, [r0] - adds r0, r2, 0 - bl sub_80CBF14 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x000021e0 - adds r0, r1, r2 - ldr r2, =0x00000cee - adds r1, r2 - bl StringCopy - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE250 - - thumb_func_start sub_80CE2A8 -sub_80CE2A8: @ 80CE2A8 - push {lr} - bl sub_80CBFD8 - lsls r0, 24 - cmp r0, 0 - beq _080CE2B8 - movs r0, 0x1 - b _080CE2CA -_080CE2B8: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0 - bl StartSpriteAnim - movs r0, 0 -_080CE2CA: - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CE2A8 - - thumb_func_start sub_80CE2D8 -sub_80CE2D8: @ 80CE2D8 - push {lr} - bl sub_80CC020 - ldr r1, =sIsMonBeingMoved - ldrb r0, [r1] - cmp r0, 0 - beq _080CE2F0 - movs r0, 0 - strb r0, [r1] - b _080CE316 - .pool -_080CE2F0: - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - bne _080CE304 - movs r2, 0xE - b _080CE30C - .pool -_080CE304: - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r2, r0, 24 -_080CE30C: - ldr r0, =sBoxCursorPosition - ldrb r1, [r0] - adds r0, r2, 0 - bl sub_80CE0E8 -_080CE316: - bl sub_80CEB40 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE2D8 - - thumb_func_start sub_80CE324 -sub_80CE324: @ 80CE324 - push {lr} - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CE33E - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r0, [r0] - movs r1, 0x3 - bl StartSpriteAnim -_080CE33E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE324 - - thumb_func_start sub_80CE350 -sub_80CE350: @ 80CE350 - push {r4,r5,lr} - adds r3, r0, 0 - movs r5, 0 - ldr r4, =gUnknown_0857B9A4 -_080CE358: - movs r1, 0 - ldrsb r1, [r4, r1] - cmp r1, 0x22 - beq _080CE378 - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - movs r0, 0x4 - ldrsb r0, [r2, r0] - cmp r1, r0 - bne _080CE37E - movs r1, 0x1 - ldrsb r1, [r4, r1] - movs r0, 0x5 - ldrsb r0, [r2, r0] - cmp r1, r0 - bne _080CE37E -_080CE378: - ldrh r0, [r4, 0x2] - strh r0, [r3] - adds r3, 0x2 -_080CE37E: - adds r4, 0x4 - adds r5, 0x1 - cmp r5, 0x5 - bls _080CE358 - ldr r1, =0x00000163 - adds r0, r1, 0 - strh r0, [r3] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE350 - - thumb_func_start sub_80CE3A0 -sub_80CE3A0: @ 80CE3A0 - push {r4,r5,lr} - bl sub_80CE51C - adds r3, r0, 0 - cmp r3, 0 - bne _080CE3D0 - ldr r2, =gUnknown_02039D08 - ldr r0, [r2] - ldr r1, =0x0000216d - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r2] - ldr r2, =0x0000216c - adds r0, r2 - strb r3, [r0] - b _080CE504 - .pool -_080CE3D0: - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CE418 - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - ldr r3, =0x00002108 - adds r0, r1, r3 - ldr r2, =0x000020a4 - adds r1, r2 - movs r2, 0x64 - bl memcpy - ldr r0, [r4] - ldr r3, =0x00002170 - adds r0, r3 - movs r1, 0xFF - strb r1, [r0] - ldr r0, [r4] - ldr r1, =0x00002171 - adds r0, r1 - movs r1, 0x1 - negs r1, r1 - b _080CE494 - .pool -_080CE418: - ldr r0, =sBoxCursorAction - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - bne _080CE464 - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r2, =0x00002108 - adds r0, r2 - ldr r3, =gPlayerParty - ldr r1, =sBoxCursorPosition - movs r2, 0 - ldrsb r2, [r1, r2] - movs r1, 0x64 - muls r1, r2 - adds r1, r3 - movs r2, 0x64 - bl memcpy - ldr r0, [r4] - ldr r3, =0x00002170 - adds r0, r3 - movs r1, 0xE - strb r1, [r0] - b _080CE488 - .pool -_080CE464: - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - ldr r1, =sBoxCursorPosition - ldrb r1, [r1] - ldr r4, =gUnknown_02039D08 - ldr r2, [r4] - ldr r3, =0x00002108 - adds r2, r3 - bl sub_80D2054 - bl StorageGetCurrentBox - ldr r1, [r4] - ldr r2, =0x00002170 - adds r1, r2 - strb r0, [r1] -_080CE488: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =sBoxCursorPosition - ldrb r1, [r1] - ldr r3, =0x00002171 - adds r0, r3 -_080CE494: - strb r1, [r0] - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - ldr r4, =0x00002176 - adds r0, r4 - bl sub_80CE350 - ldr r2, [r5] - ldr r1, =0x00002108 - adds r0, r2, r1 - adds r2, r4 - movs r1, 0x51 - bl GetMonData - ldr r2, [r5] - ldr r3, =0x00002174 - adds r1, r2, r3 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - beq _080CE4E8 - ldr r0, =0x0000216d - adds r1, r2, r0 - movs r0, 0 - strb r0, [r1] - b _080CE4F8 - .pool -_080CE4E8: - ldr r1, =0x0000216d - adds r0, r2, r1 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r5] - ldr r2, =0x0000216c - adds r0, r2 - strb r1, [r0] -_080CE4F8: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r3, =0x00002172 - adds r0, r3 - movs r1, 0 - strh r1, [r0] -_080CE504: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE3A0 - - thumb_func_start sub_80CE51C -sub_80CE51C: @ 80CE51C - push {r4-r6,lr} - ldr r0, =sIsMonBeingMoved - ldrb r1, [r0] - negs r0, r1 - orrs r0, r1 - lsrs r5, r0, 31 - movs r4, 0 -_080CE52A: - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x5 - bl GetMonData - cmp r0, 0 - beq _080CE53E - adds r5, 0x1 -_080CE53E: - adds r4, 0x1 - cmp r4, 0x5 - ble _080CE52A - cmp r5, 0x2 - ble _080CE554 -_080CE548: - movs r0, 0x1 - b _080CE578 - .pool -_080CE554: - movs r6, 0 -_080CE556: - movs r4, 0 -_080CE558: - adds r0, r6, 0 - adds r1, r4, 0 - bl sub_80D2270 - cmp r0, 0 - beq _080CE56A - adds r5, 0x1 - cmp r5, 0x2 - bgt _080CE548 -_080CE56A: - adds r4, 0x1 - cmp r4, 0x1D - ble _080CE558 - adds r6, 0x1 - cmp r6, 0xD - ble _080CE556 - movs r0, 0 -_080CE578: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80CE51C - - thumb_func_start sub_80CE580 -sub_80CE580: @ 80CE580 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r0, =gUnknown_02039D08 - ldr r2, [r0] - ldr r3, =0x0000216d - adds r1, r2, r3 - ldrb r1, [r1] - adds r5, r0, 0 - cmp r1, 0 - beq _080CE5B0 - ldr r1, =0x0000216c - adds r0, r2, r1 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - b _080CE736 - .pool -_080CE5B0: - ldr r3, =0x00002172 - adds r0, r2, r3 - ldrh r0, [r0] - cmp r0, 0 - beq _080CE5C4 - cmp r0, 0x1 - beq _080CE690 - b _080CE732 - .pool -_080CE5C4: - movs r6, 0 -_080CE5C6: - ldr r2, [r5] - ldr r1, =0x00002170 - adds r0, r2, r1 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0xE - bne _080CE5E4 - ldr r3, =0x00002171 - adds r0, r2, r3 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, r6 - beq _080CE606 -_080CE5E4: - movs r0, 0x64 - muls r0, r6 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r1, =0x00002176 - adds r2, r1 - movs r1, 0x51 - bl GetMonData - lsls r0, 16 - lsrs r4, r0, 16 - ldr r1, [r5] - ldr r2, =0x00002174 - adds r1, r2 - ldrh r0, [r1] - bics r0, r4 - strh r0, [r1] -_080CE606: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x5 - bls _080CE5C6 - ldr r2, =gUnknown_02039D08 - ldr r1, [r2] - ldr r3, =0x00002174 - adds r0, r1, r3 - ldrh r0, [r0] - cmp r0, 0 - bne _080CE64C - subs r3, 0x7 - adds r0, r1, r3 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r2] - ldr r2, =0x0000216c - adds r0, r2 - strb r1, [r0] - b _080CE732 - .pool -_080CE64C: - ldr r3, =0x0000216e - adds r0, r1, r3 - movs r1, 0 - strb r1, [r0] - ldr r0, [r2] - adds r3, 0x1 - adds r0, r3 - strb r1, [r0] - ldr r1, [r2] - ldr r0, =0x00002172 - adds r1, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - b _080CE732 - .pool -_080CE674: - ldr r1, =0x0000216d - adds r0, r5, r1 - movs r1, 0x1 - strb r1, [r0] - mov r2, r8 - ldr r0, [r2] - ldr r3, =0x0000216c - adds r0, r3 - strb r1, [r0] - b _080CE732 - .pool -_080CE690: - movs r6, 0 - mov r8, r5 - ldr r7, =0x0000ffff -_080CE696: - mov r0, r8 - ldr r3, [r0] - ldr r1, =0x0000216e - adds r0, r3, r1 - ldrb r0, [r0] - ldr r2, =0x0000216f - adds r1, r3, r2 - ldrb r1, [r1] - adds r2, 0x7 - adds r3, r2 - movs r2, 0x51 - bl GetAndCopyBoxMonDataFromAnyBox - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0 - beq _080CE6E0 - ldr r5, [r5] - ldr r3, =0x00002170 - adds r0, r5, r3 - ldrh r2, [r0] - ldr r1, =0x0000216e - adds r0, r5, r1 - ldrh r3, [r0] - adds r1, r7, 0 - ands r1, r2 - adds r0, r7, 0 - ands r0, r3 - cmp r1, r0 - beq _080CE6E0 - ldr r2, =0x00002174 - adds r1, r5, r2 - ldrh r0, [r1] - bics r0, r4 - strh r0, [r1] - cmp r0, 0 - beq _080CE674 -_080CE6E0: - ldr r2, =gUnknown_02039D08 - ldr r1, [r2] - ldr r3, =0x0000216f - adds r1, r3 - ldrb r0, [r1] - adds r0, 0x1 - movs r3, 0 - strb r0, [r1] - lsls r0, 24 - asrs r0, 24 - adds r5, r2, 0 - cmp r0, 0x1D - ble _080CE728 - ldr r0, [r2] - ldr r1, =0x0000216f - adds r0, r1 - strb r3, [r0] - ldr r1, [r2] - ldr r0, =0x0000216e - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0xD - ble _080CE728 - ldr r0, [r2] - ldr r1, =0x0000216d - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] - ldr r0, [r2] - ldr r2, =0x0000216c - adds r0, r2 - strb r3, [r0] -_080CE728: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x1D - bls _080CE696 -_080CE732: - movs r0, 0x1 - negs r0, r0 -_080CE736: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CE580 - thumb_func_start sub_80CE760 sub_80CE760: @ 80CE760 push {lr} @@ -6791,7 +90,7 @@ sub_80CE7E8: @ 80CE7E8 b _080CE8CA .pool _080CE838: - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -6980,7 +279,7 @@ sub_80CE9A8: @ 80CE9A8 b _080CEA1C .pool _080CE9E8: - ldr r4, =sBoxCursorAction + ldr r4, =sBoxCursorArea movs r0, 0 ldrsb r0, [r4, r0] cmp r0, 0x1 @@ -7016,7 +315,7 @@ _080CEA1C: thumb_func_start CanMoveMon CanMoveMon: @ 80CEA30 push {lr} - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -7049,7 +348,7 @@ CanShifMon: @ 80CEA6C ldrb r0, [r0] cmp r0, 0 beq _080CEAC8 - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -7097,7 +396,7 @@ IsMonBeingMoved: @ 80CEAD0 IsCursorOnBox: @ 80CEADC push {lr} movs r1, 0 - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -7115,7 +414,7 @@ _080CEAEE: IsCursorOnCloseBox: @ 80CEAF8 push {lr} movs r1, 0 - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -7139,7 +438,7 @@ _080CEB16: IsCursorInBox: @ 80CEB24 push {lr} movs r1, 0 - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -7171,7 +470,7 @@ _080CEB52: ldrb r0, [r3] cmp r0, 0 bne _080CEBD0 - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -7769,7 +1068,7 @@ sub_80CF108: @ 80CF108 mov r6, r9 mov r5, r8 push {r5-r7} - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] mov r8, r0 ldr r2, =sBoxCursorPosition @@ -8341,7 +1640,7 @@ sub_80CF5C4: @ 80CF5C4 mov r7, r9 mov r6, r8 push {r6,r7} - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] mov r9, r0 ldr r6, =sBoxCursorPosition @@ -8729,7 +2028,7 @@ sub_80CF8D8: @ 80CF8D8 push {r4-r7,lr} mov r7, r8 push {r7} - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] mov r8, r0 ldr r0, =sBoxCursorPosition @@ -8872,7 +2171,7 @@ sub_80CF9EC: @ 80CF9EC adds r4, r0, 0 cmp r1, 0 beq _080CFA30 - ldr r5, =sBoxCursorAction + ldr r5, =sBoxCursorArea _080CF9FC: lsls r0, r3, 3 adds r2, r0, r4 @@ -9007,7 +2306,7 @@ _080CFAF8: ldrb r0, [r0, 0x1] cmp r0, 0x2 bne _080CFB2A - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -9166,7 +2465,7 @@ sub_80CFC14: @ 80CFC14 ldr r5, =0x00000cd9 adds r1, r5 strb r0, [r1] - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] ldr r1, =sBoxCursorPosition ldrb r1, [r1] @@ -9236,7 +2535,7 @@ _080CFD18: movs r1, 0 str r1, [r0] _080CFD22: - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -9275,7 +2574,7 @@ _080CFD40: ands r0, r2 orrs r0, r3 strb r0, [r1, 0x5] - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -9352,7 +2651,7 @@ sub_80CFE14: @ 80CFE14 push {r4-r6,lr} adds r5, r0, 0 adds r6, r1, 0 - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -9426,7 +2725,7 @@ sub_80CFE84: @ 80CFE84 thumb_func_start sub_80CFEA8 sub_80CFEA8: @ 80CFEA8 push {lr} - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -9445,7 +2744,7 @@ _080CFEC0: thumb_func_start sub_80CFECC sub_80CFECC: @ 80CFECC push {lr} - ldr r0, =sBoxCursorAction + ldr r0, =sBoxCursorArea ldrb r0, [r0] lsls r0, 24 asrs r0, 24 @@ -10111,7 +3410,7 @@ _080D0442: movs r0, 0 b _080D046C _080D044E: - bl sub_80CDCAC + bl DoMonPlaceChange lsls r0, 24 cmp r0, 0 bne _080D0498 @@ -10135,7 +3434,7 @@ _080D047A: adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_80CDCAC + bl DoMonPlaceChange lsls r0, 24 lsrs r0, 24 cmp r4, 0 @@ -10207,7 +3506,7 @@ _080D04EE: bl sub_80CDC64 b _080D0546 _080D0506: - bl sub_80CDCAC + bl DoMonPlaceChange lsls r0, 24 cmp r0, 0 bne _080D0576 @@ -10224,7 +3523,7 @@ _080D0506: bl HideBg b _080D0546 _080D0532: - bl sub_80CDCAC + bl DoMonPlaceChange lsls r0, 24 cmp r0, 0 bne _080D0576 @@ -10580,12 +3879,12 @@ sub_80D07B0: @ 80D07B0 lsrs r4, 24 adds r0, r4, 0 movs r1, 0x41 - bl GetBoxMonDataFromSelectedBox + bl GetCurrentBoxMonData lsls r0, 16 lsrs r5, r0, 16 adds r0, r4, 0 movs r1, 0 - bl GetBoxMonDataFromSelectedBox + bl GetCurrentBoxMonData adds r1, r0, 0 cmp r5, 0 beq _080D0828 @@ -10644,7 +3943,7 @@ sub_80D0834: @ 80D0834 lsls r0, 24 lsrs r0, 24 movs r1, 0x41 - bl GetBoxMonDataFromSelectedBox + bl GetCurrentBoxMonData lsls r0, 16 cmp r0, 0 beq _080D0878 @@ -10867,10 +4166,10 @@ _080D09D0: subs r4, r7, r4 _080D09EC: adds r0, r5, 0 - bl sub_80CB778 + bl DestroyBoxMonIconAtPosition mov r0, r8 adds r1, r5, 0 - bl ClearMonInBox + bl ZeroBoxMonAt adds r0, r5, 0x1 lsls r0, 24 lsrs r5, r0, 24 @@ -11032,7 +4331,7 @@ _080D0B04: adds r2, r4 ldr r0, [sp, 0x4] adds r1, r6, 0 - bl CopyBoxMonFromAnyBox + bl SetBoxMonAt _080D0B2C: adds r0, r6, 0x1 lsls r0, 24 @@ -11161,7 +4460,7 @@ _080D0C04: beq _080D0C30 adds r0, r5, 0 movs r1, 0x5 - bl GetBoxMonDataFromSelectedBox + bl GetCurrentBoxMonData cmp r0, 0 beq _080D0C30 movs r0, 0 @@ -11355,12 +4654,12 @@ sub_80D0D8C: @ 80D0D8C _080D0DC4: adds r0, r7, 0 movs r1, 0x5 - bl GetBoxMonDataFromSelectedBox + bl GetCurrentBoxMonData cmp r0, 0 beq _080D0E42 adds r0, r7, 0 movs r1, 0xC - bl GetBoxMonDataFromSelectedBox + bl GetCurrentBoxMonData b _080D0DFC _080D0DDA: cmp r7, 0x5 @@ -11492,7 +4791,7 @@ sub_80D0E90: @ 80D0E90 bl SetCurrentBoxMonData adds r0, r5, 0 movs r1, 0x1 - bl sub_80CB7AC + bl SetBoxMonIconObjMode b _080D0F10 .pool _080D0EF8: @@ -11505,7 +4804,7 @@ _080D0EF8: bl SetMonData adds r0, r7, 0 movs r1, 0x1 - bl sub_80CBBDC + bl SetPartyMonIconObjMode _080D0F10: ldr r0, =gUnknown_02039D08 ldr r0, [r0] @@ -11608,7 +4907,7 @@ sub_80D0FAC: @ 80D0FAC bne _080D101C adds r0, r7, 0 movs r1, 0xC - bl GetBoxMonDataFromSelectedBox + bl GetCurrentBoxMonData lsls r0, 16 lsrs r6, r0, 16 mov r0, r8 @@ -11708,7 +5007,7 @@ sub_80D1080: @ 80D1080 bl SetCurrentBoxMonData adds r0, r5, 0 movs r1, 0 - bl sub_80CB7AC + bl SetBoxMonIconObjMode b _080D1100 .pool _080D10E0: @@ -11725,7 +5024,7 @@ _080D10E0: bl SetMonData mov r0, r8 movs r1, 0 - bl sub_80CBBDC + bl SetPartyMonIconObjMode _080D1100: pop {r3} mov r8, r3 @@ -11774,7 +5073,7 @@ sub_80D1114: @ 80D1114 bl SetCurrentBoxMonData adds r0, r5, 0 movs r1, 0x1 - bl sub_80CB7AC + bl SetBoxMonIconObjMode b _080D1188 .pool _080D1170: @@ -11787,7 +5086,7 @@ _080D1170: bl SetMonData adds r0, r7, 0 movs r1, 0x1 - bl sub_80CBBDC + bl SetPartyMonIconObjMode _080D1188: add sp, 0x4 pop {r4-r7} @@ -13266,8 +6565,8 @@ _080D1D28: .pool thumb_func_end SetCurrentBox - thumb_func_start GetBoxMonDataFromAnyBox -GetBoxMonDataFromAnyBox: @ 80D1D30 + thumb_func_start GetBoxMonDataAt +GetBoxMonDataAt: @ 80D1D30 push {r4,r5,lr} adds r5, r2, 0 lsls r0, 24 @@ -13301,7 +6600,7 @@ _080D1D6E: pop {r4,r5} pop {r1} bx r1 - thumb_func_end GetBoxMonDataFromAnyBox + thumb_func_end GetBoxMonDataAt thumb_func_start SetBoxMonDataFromAnyBox SetBoxMonDataFromAnyBox: @ 80D1D74 @@ -13339,8 +6638,8 @@ _080D1DAC: .pool thumb_func_end SetBoxMonDataFromAnyBox - thumb_func_start GetBoxMonDataFromSelectedBox -GetBoxMonDataFromSelectedBox: @ 80D1DB8 + thumb_func_start GetCurrentBoxMonData +GetCurrentBoxMonData: @ 80D1DB8 push {lr} adds r3, r0, 0 adds r2, r1, 0 @@ -13350,11 +6649,11 @@ GetBoxMonDataFromSelectedBox: @ 80D1DB8 ldr r0, [r0] ldrb r0, [r0] adds r1, r3, 0 - bl GetBoxMonDataFromAnyBox + bl GetBoxMonDataAt pop {r1} bx r1 .pool - thumb_func_end GetBoxMonDataFromSelectedBox + thumb_func_end GetCurrentBoxMonData thumb_func_start SetCurrentBoxMonData SetCurrentBoxMonData: @ 80D1DD8 @@ -13490,8 +6789,8 @@ _080D1EC6: .pool thumb_func_end SetBoxMonNickFromAnyBox - thumb_func_start GetAndCopyBoxMonDataFromAnyBox -GetAndCopyBoxMonDataFromAnyBox: @ 80D1ED0 + thumb_func_start GetAndCopyBoxMonDataAt +GetAndCopyBoxMonDataAt: @ 80D1ED0 push {r4-r6,lr} adds r5, r2, 0 adds r6, r3, 0 @@ -13527,10 +6826,10 @@ _080D1F12: pop {r4-r6} pop {r1} bx r1 - thumb_func_end GetAndCopyBoxMonDataFromAnyBox + thumb_func_end GetAndCopyBoxMonDataAt - thumb_func_start CopyBoxMonFromAnyBox -CopyBoxMonFromAnyBox: @ 80D1F18 + thumb_func_start SetBoxMonAt +SetBoxMonAt: @ 80D1F18 push {r4,r5,lr} adds r5, r2, 0 lsls r0, 24 @@ -13562,7 +6861,7 @@ _080D1F4E: pop {r0} bx r0 .pool - thumb_func_end CopyBoxMonFromAnyBox + thumb_func_end SetBoxMonAt thumb_func_start sub_80D1F58 sub_80D1F58: @ 80D1F58 @@ -13665,8 +6964,8 @@ _080D2004: .pool thumb_func_end sub_80D1F98 - thumb_func_start ClearMonInBox -ClearMonInBox: @ 80D2018 + thumb_func_start ZeroBoxMonAt +ZeroBoxMonAt: @ 80D2018 push {r4,lr} lsls r0, 24 lsrs r3, r0, 24 @@ -13695,10 +6994,10 @@ _080D2048: pop {r0} bx r0 .pool - thumb_func_end ClearMonInBox + thumb_func_end ZeroBoxMonAt - thumb_func_start sub_80D2054 -sub_80D2054: @ 80D2054 + thumb_func_start BoxMonAtToMon +BoxMonAtToMon: @ 80D2054 push {r4,r5,lr} adds r5, r2, 0 lsls r0, 24 @@ -13729,7 +7028,7 @@ _080D2088: pop {r0} bx r0 .pool - thumb_func_end sub_80D2054 + thumb_func_end BoxMonAtToMon thumb_func_start GetBoxedMonPtr @ pokemon *GetBoxedMonPtr(u8 box_id, u8 pos) @@ -13789,8 +7088,8 @@ _080D20EC: .pool thumb_func_end GetBoxNamePtr - thumb_func_start sub_80D20F8 -sub_80D20F8: @ 80D20F8 + thumb_func_start GetBoxWallpaper +GetBoxWallpaper: @ 80D20F8 push {lr} lsls r0, 24 lsrs r1, r0, 24 @@ -13809,7 +7108,7 @@ _080D2112: pop {r1} bx r1 .pool - thumb_func_end sub_80D20F8 + thumb_func_end GetBoxWallpaper thumb_func_start SetBoxWallpaper SetBoxWallpaper: @ 80D2120 @@ -13994,8 +7293,8 @@ _080D2262: bx r1 thumb_func_end CheckFreePokemonStorageSpace - thumb_func_start sub_80D2270 -sub_80D2270: @ 80D2270 + thumb_func_start CheckBoxedMonSanity +CheckBoxedMonSanity: @ 80D2270 push {r4-r6,lr} adds r2, r1, 0 cmp r0, 0xD @@ -14042,7 +7341,7 @@ _080D22CA: pop {r4-r6} pop {r1} bx r1 - thumb_func_end sub_80D2270 + thumb_func_end CheckBoxedMonSanity thumb_func_start sub_80D22D0 sub_80D22D0: @ 80D22D0 diff --git a/asm/pokenav.s b/asm/pokenav.s index 6fedbbd58..1ec7c15e1 100644 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -409,14 +409,14 @@ _081C73C2: _081C73C6: adds r0, r4, 0 adds r1, r5, 0 - bl sub_80D2270 + bl CheckBoxedMonSanity cmp r0, 0 beq _081C73EC lsls r1, r5, 24 lsrs r1, 24 lsrs r0, r6, 24 movs r2, 0x52 - bl GetBoxMonDataFromAnyBox + bl GetBoxMonDataAt cmp r0, 0 beq _081C73EC _081C73E2: @@ -16376,7 +16376,7 @@ _081CF1F4: _081CF1FC: adds r0, r5, 0 adds r1, r4, 0 - bl sub_80D2270 + bl CheckBoxedMonSanity cmp r0, 0 beq _081CF23A ldr r1, =0xffffff00 @@ -16392,7 +16392,7 @@ _081CF1FC: str r0, [sp] ldr r2, [r6, 0x14] adds r0, r7, 0 - bl GetBoxMonDataFromAnyBox + bl GetBoxMonDataAt lsls r0, 16 ldr r2, =0x0000ffff ldr r1, [sp] @@ -17735,7 +17735,7 @@ sub_81CFC40: @ 81CFC40 _081CFC60: adds r0, r7, 0 adds r1, r6, 0 - bl sub_80D2270 + bl CheckBoxedMonSanity cmp r0, 0 beq _081CFCA6 lsls r0, r7, 24 @@ -17745,7 +17745,7 @@ _081CFC60: adds r0, r5, 0 adds r1, r4, 0 movs r2, 0x52 - bl GetBoxMonDataFromAnyBox + bl GetBoxMonDataAt adds r3, r0, 0 cmp r3, 0 beq _081CFCA6 @@ -17900,14 +17900,14 @@ _081CFD92: _081CFD96: adds r0, r5, 0 adds r1, r4, 0 - bl sub_80D2270 + bl CheckBoxedMonSanity cmp r0, 0 beq _081CFDBC lsls r1, r4, 24 lsrs r1, 24 lsrs r0, r6, 24 movs r2, 0x53 - bl GetBoxMonDataFromAnyBox + bl GetBoxMonDataAt cmp r0, 0 beq _081CFDBC _081CFDB2: @@ -19257,7 +19257,7 @@ sub_81D07D8: @ 81D07D8 beq _081D07FA ldrb r1, [r1, 0x1] movs r2, 0x52 - bl GetBoxMonDataFromAnyBox + bl GetBoxMonDataAt b _081D080A _081D07FA: ldrb r1, [r1, 0x1] @@ -19302,7 +19302,7 @@ _081D0848: ldrb r0, [r1] ldrb r1, [r1, 0x1] movs r2, 0x53 - bl GetBoxMonDataFromAnyBox + bl GetBoxMonDataAt _081D0852: mov r12, r0 movs r0, 0 @@ -23046,14 +23046,14 @@ _081D2CB0: lsrs r0, 24 lsls r1, 24 lsrs r1, 24 - bl GetAndCopyBoxMonDataFromAnyBox + bl GetAndCopyBoxMonDataAt b _081D2CCA _081D2CBE: lsls r0, 24 lsrs r0, 24 lsls r1, 24 lsrs r1, 24 - bl GetBoxMonDataFromAnyBox + bl GetBoxMonDataAt _081D2CCA: pop {r1} bx r1 diff --git a/data/pokemon_storage_system.s b/data/pokemon_storage_system.s index 83344022f..a49793c74 100644 --- a/data/pokemon_storage_system.s +++ b/data/pokemon_storage_system.s @@ -4,441 +4,6 @@ .section .rodata - .align 2 -PCGfx_Arrow: @ 8577678 - .incbin "graphics/pokemon_storage/arrow.4bpp" - - .align 2 -gWallpaperPalettes_Zigzagoon:: @ 85776F8 - .incbin "graphics/pokemon_storage/friends_frame1.gbapal" - .incbin "graphics/pokemon_storage/zigzagoon_bg.gbapal" - - .align 2 -gWallpaperTiles_Zigzagoon: @ 8577738 - .incbin "graphics/pokemon_storage/zigzagoon.4bpp.lz" - - .align 2 -gWallpaperTilemap_Zigzagoon: @ 857792C - .incbin "graphics/pokemon_storage/zigzagoon.bin.lz" - - .align 2 -gWallpaperPalettes_Screen:: @ 8577A44 - .incbin "graphics/pokemon_storage/friends_frame1.gbapal" - .incbin "graphics/pokemon_storage/screen_bg.gbapal" - - .align 2 -gWallpaperTiles_Screen: @ 8577A84 - .incbin "graphics/pokemon_storage/screen.4bpp.lz" - - .align 2 -gWallpaperTilemap_Screen: @ 8577D00 - .incbin "graphics/pokemon_storage/screen.bin.lz" - - .align 2 -gWallpaperPalettes_Diagonal:: @ 8577E2C - .incbin "graphics/pokemon_storage/friends_frame1.gbapal" - .incbin "graphics/pokemon_storage/diagonal_bg.gbapal" - - .align 2 -gWallpaperTiles_Diagonal: @ 8577E6C - .incbin "graphics/pokemon_storage/diagonal.4bpp.lz" - - .align 2 -gWallpaperTilemap_Diagonal: @ 8578058 - .incbin "graphics/pokemon_storage/diagonal.bin.lz" - - .align 2 -gWallpaperPalettes_Block:: @ 8578148 - .incbin "graphics/pokemon_storage/block_bg.gbapal" - .incbin "graphics/pokemon_storage/block_bg.gbapal" - - .align 2 -gWallpaperTiles_Block: @ 8578188 - .incbin "graphics/pokemon_storage/block.4bpp.lz" - - .align 2 -gWallpaperTilemap_Block: @ 8578358 - .incbin "graphics/pokemon_storage/block.bin.lz" - - .align 2 -gWallpaperPalettes_Pokecenter2:: @ 8578450 - .incbin "graphics/pokemon_storage/pokecenter2_bg.gbapal" - .incbin "graphics/pokemon_storage/pokecenter2_bg.gbapal" - - .align 2 -gWallpaperTiles_Pokecenter2: @ 8578490 - .incbin "graphics/pokemon_storage/pokecenter2.4bpp.lz" - - .align 2 -gWallpaperTilemap_Pokecenter2: @ 85786D0 - .incbin "graphics/pokemon_storage/pokecenter2.bin.lz" - - .align 2 -gWallpaperPalettes_Frame:: @ 85787E4 - .incbin "graphics/pokemon_storage/frame_bg.gbapal" - .incbin "graphics/pokemon_storage/frame_bg.gbapal" - - .align 2 -gWallpaperTiles_Frame: @ 8578824 - .incbin "graphics/pokemon_storage/frame.4bpp.lz" - - .align 2 -gWallpaperTilemap_Frame: @ 8578A34 - .incbin "graphics/pokemon_storage/frame.bin.lz" - - .align 2 -gWallpaperPalettes_Blank:: @ 8578B48 - .incbin "graphics/pokemon_storage/friends_frame1.gbapal" - .incbin "graphics/pokemon_storage/zigzagoon_bg.gbapal" - - .align 2 -gWallpaperTiles_Blank: @ 8578B88 - .incbin "graphics/pokemon_storage/blank.4bpp.lz" - - .align 2 -gWallpaperTilemap_Blank: @ 8578D34 - .incbin "graphics/pokemon_storage/blank.bin.lz" - - .align 2 -gWallpaperPalettes_Circles:: @ 8578E10 - .incbin "graphics/pokemon_storage/friends_frame2.gbapal" - .incbin "graphics/pokemon_storage/circles_bg.gbapal" - - .align 2 -gWallpaperTiles_Circles: @ 8578E50 - .incbin "graphics/pokemon_storage/circles.4bpp.lz" - - .align 2 -gWallpaperTilemap_Circles: @ 85790A4 - .incbin "graphics/pokemon_storage/circles.bin.lz" - - .align 2 -gWallpaperPalettes_Azumarill:: @ 85791A0 - .incbin "graphics/pokemon_storage/friends_frame2.gbapal" - .incbin "graphics/pokemon_storage/azumarill_bg.gbapal" - - .align 2 -gWallpaperTiles_Azumarill: @ 85791E0 - .incbin "graphics/pokemon_storage/azumarill.4bpp.lz" - - .align 2 -gWallpaperTilemap_Azumarill: @ 85793CC - .incbin "graphics/pokemon_storage/azumarill.bin.lz" - - .align 2 -gWallpaperPalettes_Pikachu:: @ 85794C4 - .incbin "graphics/pokemon_storage/friends_frame2.gbapal" - .incbin "graphics/pokemon_storage/pikachu_bg.gbapal" - - .align 2 -gWallpaperTiles_Pikachu: @ 8579504 - .incbin "graphics/pokemon_storage/pikachu.4bpp.lz" - - .align 2 -gWallpaperTilemap_Pikachu: @ 8579738 - .incbin "graphics/pokemon_storage/pikachu.bin.lz" - - .align 2 -gWallpaperPalettes_Legendary:: @ 8579860 - .incbin "graphics/pokemon_storage/friends_frame2.gbapal" - .incbin "graphics/pokemon_storage/legendary_bg.gbapal" - - .align 2 -gWallpaperTiles_Legendary: @ 85798A0 - .incbin "graphics/pokemon_storage/legendary.4bpp.lz" - - .align 2 -gWallpaperTilemap_Legendary: @ 8579B80 - .incbin "graphics/pokemon_storage/legendary.bin.lz" - - .align 2 -gWallpaperPalettes_Dusclops:: @ 8579CC4 - .incbin "graphics/pokemon_storage/friends_frame2.gbapal" - .incbin "graphics/pokemon_storage/dusclops_bg.gbapal" - - .align 2 -gWallpaperTiles_Dusclops: @ 8579D04 - .incbin "graphics/pokemon_storage/dusclops.4bpp.lz" - - .align 2 -gWallpaperTilemap_Dusclops: @ 8579F50 - .incbin "graphics/pokemon_storage/dusclops.bin.lz" - - .align 2 -gWallpaperPalettes_Ludicolo:: @ 857A048 - .incbin "graphics/pokemon_storage/friends_frame2.gbapal" - .incbin "graphics/pokemon_storage/ludicolo_bg.gbapal" - - .align 2 -gWallpaperTiles_Ludicolo: @ 857A088 - .incbin "graphics/pokemon_storage/ludicolo.4bpp.lz" - - .align 2 -gWallpaperTilemap_Ludicolo: @ 857A348 - .incbin "graphics/pokemon_storage/ludicolo.bin.lz" - - .align 2 -gWallpaperPalettes_Whiscash:: @ 857A468 - .incbin "graphics/pokemon_storage/friends_frame2.gbapal" - .incbin "graphics/pokemon_storage/whiscash_bg.gbapal" - - .align 2 -gWallpaperTiles_Whiscash: @ 857A4A8 - .incbin "graphics/pokemon_storage/whiscash.4bpp.lz" - - .align 2 -gWallpaperTilemap_Whiscash: @ 857A6F0 - .incbin "graphics/pokemon_storage/whiscash.bin.lz" - - .align 2 -gWallpaperIcon_Aqua: @ 857A81C - .incbin "graphics/pokemon_storage/aqua_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Heart: @ 857A860 - .incbin "graphics/pokemon_storage/heart_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_FiveStar: @ 857A89C - .incbin "graphics/pokemon_storage/five_star_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Brick: @ 857A8DC - .incbin "graphics/pokemon_storage/brick_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_FourStar: @ 857A904 - .incbin "graphics/pokemon_storage/four_star_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Asterisk: @ 857A940 - .incbin "graphics/pokemon_storage/asterisk_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Dot: @ 857A990 - .incbin "graphics/pokemon_storage/dot_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_LineCircle: @ 857A9C0 - .incbin "graphics/pokemon_storage/line_circle_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_PokeBall: @ 857A9EC - .incbin "graphics/pokemon_storage/pokeball_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Maze: @ 857AA38 - .incbin "graphics/pokemon_storage/maze_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Footprint: @ 857AA7C - .incbin "graphics/pokemon_storage/footprint_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_BigAsterisk: @ 857AAC4 - .incbin "graphics/pokemon_storage/big_asterisk_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Circle: @ 857AB08 - .incbin "graphics/pokemon_storage/circle_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Koffing: @ 857AB48 - .incbin "graphics/pokemon_storage/koffing_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Ribbon: @ 857AB98 - .incbin "graphics/pokemon_storage/ribbon_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_FourCircles: @ 857AC00 - .incbin "graphics/pokemon_storage/four_circles_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Lotad: @ 857AC30 - .incbin "graphics/pokemon_storage/lotad_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Crystal: @ 857AC74 - .incbin "graphics/pokemon_storage/crystal_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Pichu: @ 857ACBC - .incbin "graphics/pokemon_storage/pichu_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Diglett: @ 857ACF4 - .incbin "graphics/pokemon_storage/diglett_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Luvdisc: @ 857AD44 - .incbin "graphics/pokemon_storage/luvdisc_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_StarInCircle: @ 857AD88 - .incbin "graphics/pokemon_storage/star_in_circle_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Spinda: @ 857ADCC - .incbin "graphics/pokemon_storage/spinda_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Latis: @ 857AE20 - .incbin "graphics/pokemon_storage/latis_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Minun: @ 857AE64 - .incbin "graphics/pokemon_storage/minun_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Togepi: @ 857AEAC - .incbin "graphics/pokemon_storage/togepi_icon.4bpp.lz" - - .align 2 -gWallpaperIcon_Magma: @ 857AF08 - .incbin "graphics/pokemon_storage/magma_icon.4bpp.lz" - - .align 2 -gUnknown_0857AF44:: @ 857AF44 - .4byte gWallpaperTiles_Zigzagoon, gWallpaperTilemap_Zigzagoon, gWallpaperPalettes_Zigzagoon - .4byte gWallpaperTiles_Screen, gWallpaperTilemap_Screen, gWallpaperPalettes_Screen - .4byte gWallpaperTiles_Horizontal, gWallpaperTilemap_Horizontal, gWallpaperPalettes_Horizontal - .4byte gWallpaperTiles_Diagonal, gWallpaperTilemap_Diagonal, gWallpaperPalettes_Diagonal - .4byte gWallpaperTiles_Block, gWallpaperTilemap_Block, gWallpaperPalettes_Block - .4byte gWallpaperTiles_Ribbon, gWallpaperTilemap_Ribbon, gWallpaperPalettes_Ribbon - .4byte gWallpaperTiles_Pokecenter2, gWallpaperTilemap_Pokecenter2, gWallpaperPalettes_Pokecenter2 - .4byte gWallpaperTiles_Frame, gWallpaperTilemap_Frame, gWallpaperPalettes_Frame - .4byte gWallpaperTiles_Blank, gWallpaperTilemap_Blank, gWallpaperPalettes_Blank - .4byte gWallpaperTiles_Circles, gWallpaperTilemap_Circles, gWallpaperPalettes_Circles - .4byte gWallpaperTiles_Azumarill, gWallpaperTilemap_Azumarill, gWallpaperPalettes_Azumarill - .4byte gWallpaperTiles_Pikachu, gWallpaperTilemap_Pikachu, gWallpaperPalettes_Pikachu - .4byte gWallpaperTiles_Legendary, gWallpaperTilemap_Legendary, gWallpaperPalettes_Legendary - .4byte gWallpaperTiles_Dusclops, gWallpaperTilemap_Dusclops, gWallpaperPalettes_Dusclops - .4byte gWallpaperTiles_Ludicolo, gWallpaperTilemap_Ludicolo, gWallpaperPalettes_Ludicolo - .4byte gWallpaperTiles_Whiscash, gWallpaperTilemap_Whiscash, gWallpaperPalettes_Whiscash - - .align 2 -gUnknown_0857B004:: @ 857B004 - .4byte gWallpaperIcon_Aqua - .4byte gWallpaperIcon_Heart - .4byte gWallpaperIcon_FiveStar - .4byte gWallpaperIcon_Brick - .4byte gWallpaperIcon_FourStar - .4byte gWallpaperIcon_Asterisk - .4byte gWallpaperIcon_Dot - .4byte gWallpaperIcon_Cross - .4byte gWallpaperIcon_LineCircle - .4byte gWallpaperIcon_PokeBall - .4byte gWallpaperIcon_Maze - .4byte gWallpaperIcon_Footprint - .4byte gWallpaperIcon_BigAsterisk - .4byte gWallpaperIcon_Circle - .4byte gWallpaperIcon_Koffing - .4byte gWallpaperIcon_Ribbon - .4byte gWallpaperIcon_Bolt - .4byte gWallpaperIcon_FourCircles - .4byte gWallpaperIcon_Lotad - .4byte gWallpaperIcon_Crystal - .4byte gWallpaperIcon_Pichu - .4byte gWallpaperIcon_Diglett - .4byte gWallpaperIcon_Luvdisc - .4byte gWallpaperIcon_StarInCircle - .4byte gWallpaperIcon_Spinda - .4byte gWallpaperIcon_Latis - .4byte gWallpaperIcon_Plusle - .4byte gWallpaperIcon_Minun - .4byte gWallpaperIcon_Togepi - .4byte gWallpaperIcon_Magma - - .align 2 -gUnknown_0857B07C:: @ 857B07C - .4byte 0x23BA - - .align 2 -gUnknown_0857B080:: @ 857B080 - obj_tiles PCGfx_Arrow, 128, 0x0006 - - .align 2 -gOamData_857B088:: @ 857B088 - .2byte 0x4000 - .2byte 0x8000 - .2byte 0x0800 - - .align 2 -gSpriteAnim_857B090:: @ 857B090 - obj_image_anim_frame 0, 5 - obj_image_anim_end - - .align 2 -gSpriteAnim_857B098:: @ 857B098 - obj_image_anim_frame 8, 5 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_857B0A0:: @ 857B0A0 - .4byte gSpriteAnim_857B090 - .4byte gSpriteAnim_857B098 - - .align 2 -gSpriteTemplate_857B0A8:: @ 857B0A8 - spr_template 0x0003, 0xDAC9, gOamData_857B088, gSpriteAnimTable_857B0A0, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gOamData_857B0C0:: @ 857B0C0 - .2byte 0x8000 - .2byte 0x0000 - .2byte 0x0800 - - .align 2 -gSpriteAnim_857B0C8:: @ 857B0C8 - obj_image_anim_frame 0, 5 - obj_image_anim_end - - .align 2 -gSpriteAnim_857B0D0:: @ 857B0D0 - obj_image_anim_frame 2, 5 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_857B0D8:: @ 857B0D8 - .4byte gSpriteAnim_857B0C8 - .4byte gSpriteAnim_857B0D0 - -gUnknown_0857B0E0:: @ 857B0E0 - spr_template 0x0006, 0xDACA, gOamData_857B0C0, gSpriteAnimTable_857B0D8, NULL, gDummySpriteAffineAnimTable, sub_80CD210 - - .align 2 -HandCursorPalette: @ 857B0F8 - .incbin "graphics/pokemon_storage/hand_cursor.gbapal" - - .align 2 -HandCursorTiles: @ 857B118 - .incbin "graphics/pokemon_storage/hand_cursor.4bpp" - - .align 2 -HandCursorShadowTiles: @ 857B918 - .incbin "graphics/pokemon_storage/hand_cursor_shadow.4bpp" - - .align 2 -gUnknown_0857B998:: @ 857B998 - .4byte sub_80CDCCC - .4byte sub_80CDD5C - .4byte sub_80CDDD8 - - .align 2 -gUnknown_0857B9A4:: @ 857B9A4 - .byte 0x22, 0x00 - .2byte 0x0039 - .byte 0x22, 0x00 - .2byte 0x0123 - .byte 0x10, 0x0a - .2byte 0x0046 - .byte 0x10, 0x0a - .2byte 0x00f9 - .byte 0x10, 0x0e - .2byte 0x0046 - .byte 0x10, 0x0e - .2byte 0x00f9 .align 2 gUnknown_0857B9BC:: @ 857B9BC @@ -450,13 +15,13 @@ gUnknown_0857B9BC:: @ 857B9BC .align 2 gHandCursorSpriteSheets:: @ 857B9E4 - obj_tiles HandCursorTiles, 0x0800, 0x0000 - obj_tiles HandCursorShadowTiles, 0x0080, 0x0001 + obj_tiles gHandCursorTiles, 0x0800, 0x0000 + obj_tiles gHandCursorShadowTiles, 0x0080, 0x0001 null_obj_tiles .align 2 gHandCursorSpritePalettes:: @ 857B9FC - obj_pal HandCursorPalette, 0xDAC7 + obj_pal gHandCursorPalette, 0xDAC7 null_obj_pal .align 2 diff --git a/include/constants/maps.h b/include/constants/maps.h index bcb778422..c65f373af 100644 --- a/include/constants/maps.h +++ b/include/constants/maps.h @@ -587,6 +587,7 @@ // Map Group 33 #define MAP_ROUTE124_DIVING_TREASURE_HUNTERS_HOUSE (0 | (33 << 8)) +#define MAP_GROUPS_COUNT 34 #define MAP_NONE (0x7F | (0x7F << 8)) #define MAP_UNDEFINED (0xFF | (0xFF << 8)) diff --git a/include/global.h b/include/global.h index cc8df049f..c976abd2d 100644 --- a/include/global.h +++ b/include/global.h @@ -858,15 +858,15 @@ typedef union // 3b58 struct WaldaPhrase { - u16 field_0; - u16 field_2; + u16 colors[2]; // Background, foreground. u8 text[16]; u8 iconId; u8 patternId; bool8 patternUnlocked; }; -struct UnkSaveSubstruct_3b98 { +struct UnkSaveSubstruct_3b98 +{ u32 trainerId; u8 trainerName[PLAYER_NAME_LENGTH + 1]; }; diff --git a/include/graphics.h b/include/graphics.h index 658239f5c..bfb57ccb9 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4743,6 +4743,15 @@ extern const u16 gPokedexAreaScreenAreaUnknown_Pal[]; // Pokemon Storage System extern const u32 gPSSMenu_Gfx[]; extern const u16 gPSSMenu_Pal[]; +extern const u32 gWallpaperIcon_Plusle[]; +extern const u32 gWallpaperIcon_Cross[]; +extern const u32 gWallpaperIcon_Bolt[]; extern const u32 gUnknown_08DD36C8[]; +extern const u32 gWallpaperTiles_Ribbon[]; +extern const u32 gWallpaperTilemap_Ribbon[]; +extern const u16 gWallpaperPalettes_Ribbon[][16]; +extern const u32 gWallpaperTiles_Horizontal[]; +extern const u32 gWallpaperTilemap_Horizontal[]; +extern const u16 gWallpaperPalettes_Horizontal[][16]; #endif //GUARD_GRAPHICS_H diff --git a/include/menu.h b/include/menu.h index e7a78f76e..f9b7c52df 100644 --- a/include/menu.h +++ b/include/menu.h @@ -48,11 +48,11 @@ s8 Menu_ProcessInput(void); s8 Menu_ProcessInputNoWrap(void); void blit_move_info_icon(u8 winId, u8 a2, u16 x, u16 y); void reset_temp_tile_data_buffers(void); -void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, int size, u16 offset, u8 mode); +void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, u32 size, u16 offset, u8 mode); bool8 free_temp_tile_data_buffers_if_possible(void); struct WindowTemplate CreateWindowTemplate(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock); void CreateYesNoMenu(const struct WindowTemplate *windowTemplate, u16 borderFirstTileNum, u8 borderPalette, u8 initialCursorPos); -void DecompressAndLoadBgGfxUsingHeap(u8 bgId, const void *src, int size, u16 offset, u8 mode); +void DecompressAndLoadBgGfxUsingHeap(u8 bgId, const void *src, u32 size, u16 offset, u8 mode); s8 Menu_ProcessInputNoWrapClearOnChoose(void); s8 ProcessMenuInput_other(void); void do_scheduled_bg_tilemap_copies_to_vram(void); @@ -62,7 +62,7 @@ void sub_8197B1C(u8 windowId, bool8 copyToVram, u16 a2, u8 a3); void sub_81995E4(u8 windowId, u8 optionsNo, const struct MenuAction *actions, const u8 *actionIds); void sub_8197DF8(u8 windowId, bool8 copyToVram); u16 sub_8198AA4(u8, u8, u8, u8, u8, u8, u16); -void *malloc_and_decompress(const void *src, int *sizeOut); +void *malloc_and_decompress(const void *src, u32 *sizeOut); u16 copy_decompressed_tile_data_to_vram(u8 bgId, const void *src, u16 size, u16 offset, u8 mode); void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress); void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, const u8 *a8); diff --git a/include/pokemon.h b/include/pokemon.h index 5d7f7f2ae..8807168ef 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -8,9 +8,9 @@ #define MON_DATA_OT_ID 1 #define MON_DATA_NICKNAME 2 #define MON_DATA_LANGUAGE 3 -#define MON_DATA_SANITY_BIT1 4 -#define MON_DATA_SANITY_BIT2 5 -#define MON_DATA_SANITY_BIT3 6 +#define MON_DATA_SANITY_IS_BAD_EGG 4 +#define MON_DATA_SANITY_HAS_SPECIES 5 +#define MON_DATA_SANITY_IS_EGG 6 #define MON_DATA_OT_NAME 7 #define MON_DATA_MARKINGS 8 #define MON_DATA_CHECKSUM 9 diff --git a/include/pokemon_icon.h b/include/pokemon_icon.h index f1c8a3e61..5a18109f2 100644 --- a/include/pokemon_icon.h +++ b/include/pokemon_icon.h @@ -1,9 +1,12 @@ #ifndef GUARD_POKEMON_ICON_H #define GUARD_POKEMON_ICON_H +extern const u8 gMonIconPaletteIndices[]; + const u8 *GetMonIconTiles(u16 species, bool32); const u8 *GetMonIconPtr(u16 speciesId, u32 personality, u32 frameNo); const u16 *GetValidMonIconPalettePtr(u16 speciesId); +u16 GetIconSpecies(u16 species, u32 personality); u16 GetUnownLetterByPersonality(u32 personality); u16 sub_80D2E84(u16 speciesId); void LoadMonIconPalettes(void); diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index d36f4b358..e9b3302c0 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -2,7 +2,9 @@ #define GUARD_POKEMON_STORAGE_SYSTEM_H #define TOTAL_BOXES_COUNT 14 -#define IN_BOX_COUNT 30 +#define IN_BOX_ROWS 6 +#define IN_BOX_COLUMS 5 +#define IN_BOX_COUNT (IN_BOX_ROWS * IN_BOX_COLUMS) #include "pc_screen_effect.h" #include "mon_markings.h" @@ -69,7 +71,6 @@ struct PokemonStorageSystemData u8 screenChangeType; bool8 isReshowingPSS; u8 taskId; - u8 unk_0005; struct UnkStruct_2000020 unk_0020; struct UnkStruct_2000028 unk_0028[8]; u16 field_90[16]; @@ -84,26 +85,86 @@ struct PokemonStorageSystemData bool8 unk_02C9; s16 newCurrBoxId; u16 bg2_X; - u8 field_2CE; - u8 field_2CF[1213]; + s16 field_2CE; + u16 field_2D0; + u8 field_2D2; + u8 field_2D3; + u8 field_2D4; + u8 field_2D5; + u16 field_2D6; + s16 field_2D8; + u16 field_2DA; + u16 field_2DC; + u16 field_2DE; + u16 field_2E0; + u8 field_2E2; + u8 field_2E3; + u8 field_2E4[20]; + u8 field_2F8[1024]; + u8 field_6F8; + u8 field_6F9; + u8 field_6FA; + s8 field_6FB; + u16 field_6FC[16]; + u16 field_71C; + u16 field_71E; + struct Sprite *field_720[2]; + struct Sprite *field_728[2]; + struct Sprite *field_730[2]; + u32 field_738; + u8 field_73C[80]; u16 field_78C; s16 wallpaperSetId; s16 wallpaperId; - u8 wallpaperTilemap[180 * 4]; + u16 field_792[360]; u8 wallpaperChangeState; u8 field_A63; u8 field_A64; - u8 field_A65; + s8 field_A65; u8 field_A66; u8 field_A67; - u8 *wallpaperTilemapPtr; + u8 *wallpaperTiles; struct Sprite *field_A6C; struct Sprite *partySprites[PARTY_SIZE]; struct Sprite *boxMonsSprites[IN_BOX_COUNT]; - u8 field_B00[8]; + struct Sprite **field_B00; + struct Sprite **field_B04; u16 field_B08[40]; u16 field_B58[40]; - u8 field_BA8[308]; + u16 boxSpecies[IN_BOX_COUNT]; + u32 boxPersonalities[IN_BOX_COUNT]; + u8 field_C5C; + u8 field_C5D; + u8 field_C5E; + u8 field_C5F; + u16 field_C60; + s16 field_C62; + s16 field_C64; + u16 field_C66; + u8 field_C68; + s8 field_C69; + u8 field_C6A; + u8 field_C6B; + u8 field_C6C[72]; + struct Sprite *field_CB4; + struct Sprite *field_CB8; + s32 field_CBC; + s32 field_CC0; + u32 field_CC4; + u32 field_CC8; + s16 field_CCC; + s16 field_CCE; + u16 field_CD0; + s8 field_CD2; + s8 field_CD3; + u8 field_CD4; + u8 field_CD5; + u8 field_CD6; + u8 field_CD7; + u8 field_CD8; + u8 field_CD9; + u8 field_CDA; + u8 field_CDB; u32 *field_CDC; u32 cursorMonPersonality; u16 cursorMonSpecies; @@ -117,13 +178,26 @@ struct PokemonStorageSystemData u8 cursorMonNick[36]; u8 cursorMonSpeciesName[36]; u8 cursorMonGenderLvlText[36]; - u8 cursorMonItemName[47]; + u8 cursorMonItemName[36]; + bool8 (*monPlaceChangeFunc)(void); + u8 monPlaceChangeState; + u8 field_D91; struct Sprite *field_D94; struct Sprite *field_D98[2]; u16 *field_DA0; struct PokemonMarkMenu field_DA4; struct UnkPSSStruct_2002370 field_1E5C; - u8 field_20A4[220]; + struct Pokemon field_20A4; + struct Pokemon field_2108; + s8 field_216C; + u8 field_216D; + s8 field_216E; + s8 field_216F; + s8 field_2170; + s8 field_2171; + u16 field_2172; + u16 field_2174; + u16 field_2176[5]; u8 field_2180; u8 field_2181; u8 field_2182; @@ -134,10 +208,18 @@ struct PokemonStorageSystemData u8 field_2187; u8 field_2188; struct BoxPokemon *field_218C; - u8 field_2190[80]; + u8 field_2190[40]; + u8 field_21B8[40]; u8 field_21E0[POKEMON_NAME_LENGTH + 1]; u8 field_21EB[15]; // TODO: ITEM NAME LENGTH + 1 - u8 field_21FA[58]; + u8 field_21FA; + u8 field_21FB; + u8 field_21FC; + u8 field_21FD; + u8 field_21FE; + u8 field_21FF; + u8 field_2200; + u8 field_2201[51]; u16 movingItem; u8 field_2236; u8 field_2237; @@ -149,7 +231,8 @@ struct PokemonStorageSystemData u16 field_2244[16]; u8 field_2264[96]; u8 field_22C4[0x800]; - u8 field_2AC4[12288]; + u8 field_2AC4[8192]; + u8 field_4AC4[0x1000]; u8 field_5AC4[0x800]; }; @@ -160,7 +243,7 @@ u8* GetBoxNamePtr(u8 boxNumber); struct BoxPokemon *GetBoxedMonPtr(u8, u8); void SetBoxMonNickFromAnyBox(u8, u8, u8 *); void CompactPartySlots(void); -u32 GetBoxMonDataFromAnyBox(u8 boxId, u8 monPosition, u32 request); +u32 GetBoxMonDataAt(u8 boxId, u8 monPosition, u32 request); bool8 CheckFreePokemonStorageSpace(void); u8 StorageGetCurrentBox(void); u8 sub_80D214C(struct BoxPokemon *a, u8 b, u8 c, u8 d); diff --git a/include/text.h b/include/text.h index 69cbb87ed..d9c7a9a2e 100644 --- a/include/text.h +++ b/include/text.h @@ -258,7 +258,7 @@ void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *c u16 RenderText(struct TextPrinter *textPrinter); u32 GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing); u32 (*GetFontWidthFunc(u8 glyphId))(u16, bool32); -u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing); +s32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing); u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str); u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y); u8 GetKeypadIconTileOffset(u8 keypadIconId); diff --git a/src/battle_pike.c b/src/battle_pike.c index d86677e48..4b2a1574d 100644 --- a/src/battle_pike.c +++ b/src/battle_pike.c @@ -1613,7 +1613,7 @@ static void sub_81A8830(void) static bool8 CanEncounterWildMon(u8 enemyMonLevel) { - if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3)) + if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)) { u8 monAbility = GetMonAbility(&gPlayerParty[0]); if (monAbility == ABILITY_KEEN_EYE || monAbility == ABILITY_INTIMIDATE) diff --git a/src/daycare.c b/src/daycare.c index 131540f6e..ef93fd2d8 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -901,7 +901,7 @@ static bool8 _DoEggActions_CheckHatch(struct DayCare *daycare) for (i = 0; i < DAYCARE_MON_COUNT; i++) { - if (GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SANITY_BIT2)) + if (GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SANITY_HAS_SPECIES)) daycare->mons[i].steps++, validEggs++; } @@ -922,7 +922,7 @@ static bool8 _DoEggActions_CheckHatch(struct DayCare *daycare) { if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)) continue; - if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_BIT1)) + if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_IS_BAD_EGG)) continue; steps = GetMonData(&gPlayerParty[i], MON_DATA_FRIENDSHIP); diff --git a/src/egg_hatch.c b/src/egg_hatch.c index 77296c707..9c1d6fdd8 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -876,7 +876,7 @@ u8 GetEggStepsToSubtract(void) u8 count, i; for (count = CalculatePlayerPartyCount(), i = 0; i < count; i++) { - if (!GetMonData(&gPlayerParty[i], MON_DATA_SANITY_BIT3)) + if (!GetMonData(&gPlayerParty[i], MON_DATA_SANITY_IS_EGG)) { u8 ability = GetMonAbility(&gPlayerParty[i]); if (ability == ABILITY_MAGMA_ARMOR || ability == ABILITY_FLAME_BODY) diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index a5aa23e32..7a6e16dd3 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -1845,7 +1845,7 @@ static bool8 Fishing6(struct Task *task) } else { - if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3)) + if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)) { u8 ability = GetMonAbility(&gPlayerParty[0]); if (ability == ABILITY_SUCTION_CUPS || ability == ABILITY_STICKY_HOLD) diff --git a/src/field_poison.c b/src/field_poison.c index 02f37f69f..de05bc407 100644 --- a/src/field_poison.c +++ b/src/field_poison.c @@ -122,7 +122,7 @@ s32 DoPoisonFieldEffect(void) u32 numFainted = 0; for (i = 0; i < PARTY_SIZE; i++) { - if (GetMonData(pokemon, MON_DATA_SANITY_BIT2) && pokemon_ailments_get_primary(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN) + if (GetMonData(pokemon, MON_DATA_SANITY_HAS_SPECIES) && pokemon_ailments_get_primary(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN) { hp = GetMonData(pokemon, MON_DATA_HP); if (hp == 0 || --hp == 0) diff --git a/src/field_specials.c b/src/field_specials.c index b47df09fc..34be71f30 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -1266,7 +1266,7 @@ void IsGrassTypeInParty(void) for (i = 0; i < PARTY_SIZE; i++) { pokemon = &gPlayerParty[i]; - if (GetMonData(pokemon, MON_DATA_SANITY_BIT2) && !GetMonData(pokemon, MON_DATA_IS_EGG)) + if (GetMonData(pokemon, MON_DATA_SANITY_HAS_SPECIES) && !GetMonData(pokemon, MON_DATA_IS_EGG)) { species = GetMonData(pokemon, MON_DATA_SPECIES); if (gBaseStats[species].type1 == TYPE_GRASS || gBaseStats[species].type2 == TYPE_GRASS) @@ -1658,7 +1658,7 @@ bool8 sub_813990C(void) for (i = 0; i < partyCount; i++) { - if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_BIT1) == 1) + if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_IS_BAD_EGG) == 1) return TRUE; } diff --git a/src/menu.c b/src/menu.c index 61096138a..84a0a23f3 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1797,9 +1797,9 @@ bool8 free_temp_tile_data_buffers_if_possible(void) } } -void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, int size, u16 offset, u8 mode) +void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, u32 size, u16 offset, u8 mode) { - int sizeOut; + u32 sizeOut; if (gUnknown_0203CDA8 < ARRAY_COUNT(gUnknown_0203CDAC)) { void *ptr = malloc_and_decompress(src, &sizeOut); @@ -1815,9 +1815,9 @@ void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, int size, return NULL; } -void DecompressAndLoadBgGfxUsingHeap(u8 bgId, const void *src, int size, u16 offset, u8 mode) +void DecompressAndLoadBgGfxUsingHeap(u8 bgId, const void *src, u32 size, u16 offset, u8 mode) { - int sizeOut; + u32 sizeOut; void *ptr = malloc_and_decompress(src, &sizeOut); if (!size) size = sizeOut; @@ -1838,7 +1838,7 @@ void task_free_buf_after_copying_tile_data_to_vram(u8 taskId) } } -void *malloc_and_decompress(const void *src, int *size) +void *malloc_and_decompress(const void *src, u32 *size) { void *ptr; u8 *sizeAsBytes = (u8 *)size; diff --git a/src/overworld.c b/src/overworld.c index 12e02a9b5..b2c7ad963 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -1342,7 +1342,7 @@ void UpdateAmbientCry(s16 *state, u16 *delayCounter) monsCount = CalculatePlayerPartyCount(); for (i = 0; i < monsCount; i++) { - if (!GetMonData(&gPlayerParty[i], MON_DATA_SANITY_BIT3) + if (!GetMonData(&gPlayerParty[i], MON_DATA_SANITY_IS_EGG) && GetMonAbility(&gPlayerParty[0]) == ABILITY_SWARM) { divBy = 2; diff --git a/src/pokemon.c b/src/pokemon.c index eec995050..aea52ecbb 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -4097,13 +4097,13 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data) case MON_DATA_LANGUAGE: retVal = boxMon->language; break; - case MON_DATA_SANITY_BIT1: + case MON_DATA_SANITY_IS_BAD_EGG: retVal = boxMon->isBadEgg; break; - case MON_DATA_SANITY_BIT2: + case MON_DATA_SANITY_HAS_SPECIES: retVal = boxMon->hasSpecies; break; - case MON_DATA_SANITY_BIT3: + case MON_DATA_SANITY_IS_EGG: retVal = boxMon->isEgg; break; case MON_DATA_OT_NAME: @@ -4304,7 +4304,7 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data) u16 *moves = (u16 *)data; s32 i = 0; - while (moves[i] != 355) + while (moves[i] != MOVES_COUNT) { u16 move = moves[i]; if (substruct1->moves[0] == move @@ -4466,13 +4466,13 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg) case MON_DATA_LANGUAGE: SET8(boxMon->language); break; - case MON_DATA_SANITY_BIT1: + case MON_DATA_SANITY_IS_BAD_EGG: SET8(boxMon->isBadEgg); break; - case MON_DATA_SANITY_BIT2: + case MON_DATA_SANITY_HAS_SPECIES: SET8(boxMon->hasSpecies); break; - case MON_DATA_SANITY_BIT3: + case MON_DATA_SANITY_IS_EGG: SET8(boxMon->isEgg); break; case MON_DATA_OT_NAME: @@ -4897,7 +4897,7 @@ bool8 IsPokemonStorageFull(void) for (i = 0; i < 14; i++) for (j = 0; j < 30; j++) - if (GetBoxMonDataFromAnyBox(i, j, MON_DATA_SPECIES) == SPECIES_NONE) + if (GetBoxMonDataAt(i, j, MON_DATA_SPECIES) == SPECIES_NONE) return FALSE; return TRUE; @@ -6859,7 +6859,7 @@ void SetWildMonHeldItem(void) u16 species = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, 0); u16 var1 = 45; u16 var2 = 95; - if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3, 0) + if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG, 0) && GetMonAbility(&gPlayerParty[0]) == ABILITY_COMPOUND_EYES) { var1 = 20; diff --git a/src/pokemon_icon.c b/src/pokemon_icon.c index c24c8a898..6b7d8656f 100644 --- a/src/pokemon_icon.c +++ b/src/pokemon_icon.c @@ -1076,7 +1076,7 @@ u8 sub_80D2D78(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 return spriteId; } -u16 mon_icon_convert_unown_species_id(u16 species, u32 personality) +u16 GetIconSpecies(u16 species, u32 personality) { u16 result; @@ -1104,7 +1104,8 @@ u16 GetUnownLetterByPersonality(u32 personality) { if (!personality) return 0; - return (((personality & 0x3000000) >> 18) | ((personality & 0x30000) >> 12) | ((personality & 0x300) >> 6) | (personality & 0x3)) % 0x1C; + else + return (((personality & 0x3000000) >> 18) | ((personality & 0x30000) >> 12) | ((personality & 0x300) >> 6) | (personality & 0x3)) % 0x1C; } u16 sub_80D2E84(u16 species) @@ -1121,19 +1122,17 @@ u16 sub_80D2E84(u16 species) } else { - if(species > (SPECIES_UNOWN_B - 1)) + if (species > (SPECIES_UNOWN_B - 1)) species = 260; - return mon_icon_convert_unown_species_id(species, 0); + return GetIconSpecies(species, 0); } } const u8 *GetMonIconPtr(u16 species, u32 personality, bool32 extra) { - return GetMonIconTiles(mon_icon_convert_unown_species_id(species, personality), extra); + return GetMonIconTiles(GetIconSpecies(species, personality), extra); } - - void sub_80D2EF8(struct Sprite *sprite) { sub_80D328C(sprite); diff --git a/src/pokemon_size_record.c b/src/pokemon_size_record.c index 2d9a2f08f..b0e14d2b1 100644 --- a/src/pokemon_size_record.c +++ b/src/pokemon_size_record.c @@ -210,7 +210,7 @@ void GiveGiftRibbonToParty(u8 index, u8 ribbonId) { struct Pokemon *mon = &gPlayerParty[i]; - if (GetMonData(mon, MON_DATA_SPECIES) != 0 && GetMonData(mon, MON_DATA_SANITY_BIT3) == 0) + if (GetMonData(mon, MON_DATA_SPECIES) != 0 && GetMonData(mon, MON_DATA_SANITY_IS_EGG) == 0) { SetMonData(mon, array[index], &data); gotRibbon = TRUE; diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index a37d38813..86041690c 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -29,8 +29,11 @@ #include "strings.h" #include "text.h" #include "text_window.h" +#include "trig.h" #include "walda_phrase.h" #include "window.h" +#include "constants/maps.h" +#include "constants/moves.h" #include "constants/rgb.h" #include "constants/songs.h" #include "constants/species.h" @@ -106,25 +109,71 @@ enum SCREEN_CHANGE_ITEM_FROM_BAG, }; +enum +{ + MODE_PARTY, + MODE_BOX, + MODE_2, +}; + +enum +{ + WALLPAPER_FOREST, + WALLPAPER_CITY, + WALLPAPER_DESERT, + WALLPAPER_SAVANNA, + WALLPAPER_CRAG, + WALLPAPER_VOLCANO, + WALLPAPER_SNOW, + WALLPAPER_CAVE, + WALLPAPER_BEACH, + WALLPAPER_SEAFLOOR, + WALLPAPER_RIVER, + WALLPAPER_SKY, + WALLPAPER_POLKADOT, + WALLPAPER_POKECENTER, + WALLPAPER_MACHINE, + WALLPAPER_PLAIN, + WALLPAPER_FRIENDS, // The one received as a gift from Walda's parents. +}; + +enum +{ + CURSOR_AREA_IN_BOX, + CURSOR_AREA_IN_PARTY, + CURSOR_AREA_BOX, + CURSOR_AREA_BUTTONS, // Party Pokemon and Close Box +}; + #define TAG_PAL_WAVEFORM 0xDACA #define TAG_PAL_DAC8 0xDAC8 #define TAG_PAL_DAC6 0xDAC6 #define TAG_PAL_DACE 0xDACE #define TAG_PAL_DAC7 0xDAC7 +#define TAG_PAL_DAC9 0xDAC9 #define TAG_TILE_WAVEFORM 0x5 #define TAG_TILE_10 0x10 #define TAG_TILE_2 0x2 #define TAG_TILE_D 0xD #define TAG_TILE_A 0xA +#define TAG_TILE_3 0x3 +#define TAG_TILE_4 0x4 IWRAM_DATA u8 gUnknown_03000F78[0x188]; extern u8 sPreviousBoxOption; extern u8 sCurrentBoxOption; +extern u8 sMovingMonOrigBoxPos; +extern u8 sMovingMonOrigBoxId; +extern s8 sBoxCursorPosition; +extern s8 sBoxCursorArea; extern u8 gUnknown_02039D10; +extern u8 gUnknown_02039D7E; extern u8 gUnknown_02039D0E; extern bool8 sInPartyMenu; +extern bool8 sCanOnlyMove; +extern bool8 sIsMonBeingMoved; extern u8 gUnknown_02039D0F; extern u16 gUnknown_02039D12; extern struct Pokemon gUnknown_02039D14; @@ -146,11 +195,16 @@ void Cb2_EnterPSS(u8 boxOption); u8 GetCurrentBoxOption(void); u8 sub_80CF9EC(void); u8 sub_80CDC2C(void); +u8 sub_80CB9BC(void); +void LoadWallpaperGfx(u8 boxId, s8 direction); +void sub_80CCCFC(u8 boxId, s8 direction); +void sub_80CD0B8(s8 direction); void SetBoxWallpaper(u8 boxId, u8 wallpaperId); void SetCurrentBox(u8 boxId); void sub_80CC32C(u8 boxId); -void ClearMonInBox(u8 boxId, u8 boxPos); +void ZeroBoxMonAt(u8 boxId, u8 boxPos); void sub_80C7958(u8 curBox); +void sub_80CCAE0(void *arg0); void ResetWaldaWallpaper(void); void sub_80C7B14(void); void sub_80C7BB4(void); @@ -163,7 +217,7 @@ void sub_80CE790(void); void sub_80CE8E4(void); void GiveChosenBagItem(void); void SetUpHidePartyMenu(void); -void sub_80CBB9C(void); +void DestroyAllPartyMonIcons(void); void sub_80D11CC(void); void LoadPSSMenuGfx(void); void LoadWaveformSpritePalette(void); @@ -171,6 +225,7 @@ void sub_80CDC18(void); void sub_80CD36C(void); void sub_80CD3EC(void); void sub_80CAC1C(void); +void sub_80CEBDC(void); void SetScrollingBackground(void); void sub_80CABE0(void); void sub_80CAEAC(void); @@ -199,7 +254,12 @@ void sub_80D1194(void); void PrintCursorMonInfo(void); void sub_80CA65C(void); void sub_80CADD8(void); +void sub_80CD02C(void); void sub_80CFEF0(void); +void sub_80CD158(void); +void sub_80CFC14(void); +void sub_80CEB40(void); +void sub_80CCEE0(void); void sub_80D1818(void); void sub_80CAA74(void); void sub_80D17B4(void); @@ -209,38 +269,48 @@ void sub_80CE7E8(void); void sub_80CFECC(void); void sub_80CA9EC(void); void FreePSSData(void); +void sub_80CCF9C(void); +void MoveMon(void); +void PlaceMon(void); void sub_80CAB20(void); void sub_80CE22C(void); +void sub_80CDA68(void); void sub_80CB950(void); void sub_80CA9C0(void); void SetUpDoShowPartyMenu(void); void BoxSetMosaic(void); void sub_80C7CF4(struct Sprite *sprite); +void sub_80CC100(struct Sprite *sprite); +void sub_80CB278(struct Sprite *sprite); +void sub_80CD210(struct Sprite *sprite); +bool32 WaitForWallpaperGfxLoad(void); bool8 InitPSSWindows(void); bool8 sub_80CC0A0(void); bool8 sub_80CE2A8(void); bool8 sub_80D0164(void); bool8 sub_80CC35C(void); bool8 sub_80D01E4(void); +bool8 sub_80CDED4(void); +bool8 sub_80CDF08(void); bool8 sub_80D184C(void); bool8 sub_80D18E4(void); bool8 DoShowPartyMenu(void); bool8 sub_80D1218(void); -bool8 sub_80CB9BC(void); bool8 ScrollToBox(void); bool8 sub_80CD554(void); bool8 HidePartyMenu(void); bool8 sub_80D127C(void); bool8 sub_80CA2B8(void); bool8 DoWallpaperGfxChange(void); -bool8 sub_80CDCAC(void); +bool8 DoMonPlaceChange(void); bool8 sub_80D00A8(void); bool8 CanMoveMon(void); bool8 CanShifMon(void); bool8 IsCursorOnCloseBox(void); bool8 IsCursorOnBox(void); +bool8 IsCursorInBox(void); bool8 IsMonBeingMoved(void); -bool8 sub_80CE19C(u8 arg0); +bool8 TryStorePartyMonInBox(u8 boxId); void Cb_InitPSS(u8 taskId); void Cb_PlaceMon(u8 taskId); void Cb_ChangeScreen(u8 taskId); @@ -275,18 +345,18 @@ void Cb_PrintCantStoreMail(u8 taskId); void Cb_HandleMovingMonFromParty(u8 taskId); void sub_80D2A90(struct UnkStruct_2000020 *arg0, struct UnkStruct_2000028 *arg1, u32 arg2); void sub_80D259C(u8 arg0); -void sub_80CC464(u8 arg0); +void SetUpScrollToBox(u8 boxId); void sub_80CFE54(u8 arg0); void sub_80D2918(u8 arg0); -void sub_80CC0D4(u8 arg0); -void sub_80CDC38(u8 arg0); +void sub_80CC0D4(u8 priority); +void InitMonPlaceChange(u8 arg0); void sub_80CE9A8(u8 markings); void ShowYesNoWindow(s8 cursorPos); void sub_80CDBF8(u8 arg0); void sub_80D01D0(u8 arg0); void sub_80CD1A8(bool8 arg0); void sub_80CA984(bool8 arg0); -void sub_80CB7E8(bool8 arg0); +void CreatePartyMonsSprites(bool8 arg0); void sub_80D2644(u8 arg0, u16 arg1, const void *arg2, u16 arg3, u16 arg4); void sub_80D2770(u8 arg0, u16 arg1, u16 arg2); void PrintStorageActionText(u8 id); @@ -302,17 +372,52 @@ void SetWallpaperForCurrentBox(u8 wallpaperId); void sub_80CAE0C(u8 wallpaperSet); u16 GetMovingItem(void); void SetCurrentBoxMonData(s32 monId, s32 request, const void *value); +s32 GetCurrentBoxMonData(u8 boxPosition, s32 request); void LoadCursorMonGfx(u16 species, u32 pid); void sub_80CA2D0(struct Sprite *sprite); +void sub_80CCF64(struct Sprite *sprite); +void sub_80CBA3C(struct Sprite *sprite); +void sub_80CCF30(struct Sprite *sprite); void sub_80D27AC(u8 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4); void sub_80D27F4(u8 arg0, u8 arg1, s8 arg2); -void sub_80CBAF0(s16 arg0); +void sub_80CBAF0(s16 yDelta); void sub_80CAAA8(u8 arg0, bool8 isPartyMon); const u8 *GetMovingItemName(void); bool32 IsWaldaWallpaperUnlocked(void); void sub_80CFF34(u8 arg0); -void sub_80D0D8C(bool8 arg0, u8 cursorPos); +void sub_80D0D8C(u8 arg0, u8 cursorPos); +void sub_80D0E50(u8 arg0, u8 cursorPos); void sub_80D0F38(u16 item); +static struct Sprite *CreateMonIconSprite(u16 species, u32 personality, s16 x, s16 y, u8 oamPriority, u8 subpriority); +void DestroyBoxMonIcon(struct Sprite *sprite); +void SetBoxSpeciesAndPersonalities(u8 boxId); +void sub_80CB9D0(struct Sprite *sprite, u16 partyId); +void sub_80CC370(u8 taskId); +void sub_80CCB50(u8 boxId); +s8 sub_80CC644(u8 boxId); +u8 GetBoxWallpaper(u8 boxId); +u32 GetWaldaWallpaperPatternId(void); +u32 GetWaldaWallpaperIconId(void); +void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2); +u16 *GetWaldaWallpaperColorsPtr(void); +void sub_80C6D80(u8 *arg0, void *arg1, u8 arg2, u8 arg3, s32 arg4); +s16 sub_80CD00C(const u8 *string); +bool8 MonPlaceChange_Shift(void); +bool8 MonPlaceChange_Move(void); +bool8 MonPlaceChange_Place(void); +bool8 sub_80CDEC4(void); +bool8 sub_80CDEB4(void); +void sub_80CD444(u8 a0, u8 a1, u16 *a2, u16 *a3); +void SetShiftedMonData(u8 boxId, u8 position); +void SetMovedMonData(u8 boxId, u8 position); +void SetPlacedMonData(u8 boxId, u8 position); +void PurgeMonOrBoxMon(u8 boxId, u8 position); +void BoxMonAtToMon(u8 boxId, u8 position, struct Pokemon *dst); +void SetBoxMonAt(u8 boxId, u8 position, struct BoxPokemon *src); +void sub_80CEC00(struct Pokemon *mon, u8 arg1); +bool32 AtLeastThreeUsableMons(void); +bool32 CheckBoxedMonSanity(s32 boxId, s32 boxPosition); +s32 GetAndCopyBoxMonDataAt(u8 boxId, u8 boxPosition, s32 request, void *dst); // const rom data const struct PSS_MenuStringPtrs gUnknown_085716C0[] = @@ -844,22 +949,320 @@ const u16 gUnknown_08577574[][2] = const struct WallpaperTable gWallpaperTable[] = { - WALLPAPER_ENTRY(Forest), - WALLPAPER_ENTRY(City), - WALLPAPER_ENTRY(Desert), - WALLPAPER_ENTRY(Savanna), - WALLPAPER_ENTRY(Crag), - WALLPAPER_ENTRY(Volcano), - WALLPAPER_ENTRY(Snow), - WALLPAPER_ENTRY(Cave), - WALLPAPER_ENTRY(Beach), - WALLPAPER_ENTRY(Seafloor), - WALLPAPER_ENTRY(River), - WALLPAPER_ENTRY(Sky), - WALLPAPER_ENTRY(PolkaDot), - WALLPAPER_ENTRY(Pokecenter), - WALLPAPER_ENTRY(Machine), - WALLPAPER_ENTRY(Plain), + [WALLPAPER_FOREST] = WALLPAPER_ENTRY(Forest), + [WALLPAPER_CITY] = WALLPAPER_ENTRY(City), + [WALLPAPER_DESERT] = WALLPAPER_ENTRY(Desert), + [WALLPAPER_SAVANNA] = WALLPAPER_ENTRY(Savanna), + [WALLPAPER_CRAG] = WALLPAPER_ENTRY(Crag), + [WALLPAPER_VOLCANO] = WALLPAPER_ENTRY(Volcano), + [WALLPAPER_SNOW] = WALLPAPER_ENTRY(Snow), + [WALLPAPER_CAVE] = WALLPAPER_ENTRY(Cave), + [WALLPAPER_BEACH] = WALLPAPER_ENTRY(Beach), + [WALLPAPER_SEAFLOOR] = WALLPAPER_ENTRY(Seafloor), + [WALLPAPER_RIVER] = WALLPAPER_ENTRY(River), + [WALLPAPER_SKY] = WALLPAPER_ENTRY(Sky), + [WALLPAPER_POLKADOT] = WALLPAPER_ENTRY(PolkaDot), + [WALLPAPER_POKECENTER] = WALLPAPER_ENTRY(Pokecenter), + [WALLPAPER_MACHINE] = WALLPAPER_ENTRY(Machine), + [WALLPAPER_PLAIN] = WALLPAPER_ENTRY(Plain), +}; + +const u8 gPCGfx_Arrow[] = INCBIN_U8("graphics/pokemon_storage/arrow.4bpp"); + +const u16 gWallpaperPalettes_Zigzagoon[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), + INCBIN_U16("graphics/pokemon_storage/zigzagoon_bg.gbapal"), +}; +const u32 gWallpaperTiles_Zigzagoon[] = INCBIN_U32("graphics/pokemon_storage/zigzagoon.4bpp.lz"); +const u32 gWallpaperTilemap_Zigzagoon[] = INCBIN_U32("graphics/pokemon_storage/zigzagoon.bin.lz"); + +const u16 gWallpaperPalettes_Screen[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), + INCBIN_U16("graphics/pokemon_storage/screen_bg.gbapal"), +}; +const u32 gWallpaperTiles_Screen[] = INCBIN_U32("graphics/pokemon_storage/screen.4bpp.lz"); +const u32 gWallpaperTilemap_Screen[] = INCBIN_U32("graphics/pokemon_storage/screen.bin.lz"); + +const u16 gWallpaperPalettes_Diagonal[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), + INCBIN_U16("graphics/pokemon_storage/diagonal_bg.gbapal"), +}; +const u32 gWallpaperTiles_Diagonal[] = INCBIN_U32("graphics/pokemon_storage/diagonal.4bpp.lz"); +const u32 gWallpaperTilemap_Diagonal[] = INCBIN_U32("graphics/pokemon_storage/diagonal.bin.lz"); + +const u16 gWallpaperPalettes_Block[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/block_bg.gbapal"), + INCBIN_U16("graphics/pokemon_storage/block_bg.gbapal"), +}; +const u32 gWallpaperTiles_Block[] = INCBIN_U32("graphics/pokemon_storage/block.4bpp.lz"); +const u32 gWallpaperTilemap_Block[] = INCBIN_U32("graphics/pokemon_storage/block.bin.lz"); + +const u16 gWallpaperPalettes_Pokecenter2[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/pokecenter2_bg.gbapal"), + INCBIN_U16("graphics/pokemon_storage/pokecenter2_bg.gbapal"), +}; +const u32 gWallpaperTiles_Pokecenter2[] = INCBIN_U32("graphics/pokemon_storage/pokecenter2.4bpp.lz"); +const u32 gWallpaperTilemap_Pokecenter2[] = INCBIN_U32("graphics/pokemon_storage/pokecenter2.bin.lz"); + +const u16 gWallpaperPalettes_Frame[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/frame_bg.gbapal"), + INCBIN_U16("graphics/pokemon_storage/frame_bg.gbapal"), +}; +const u32 gWallpaperTiles_Frame[] = INCBIN_U32("graphics/pokemon_storage/frame.4bpp.lz"); +const u32 gWallpaperTilemap_Frame[] = INCBIN_U32("graphics/pokemon_storage/frame.bin.lz"); + +const u16 gWallpaperPalettes_Blank[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), + INCBIN_U16("graphics/pokemon_storage/zigzagoon_bg.gbapal"), +}; +const u32 gWallpaperTiles_Blank[] = INCBIN_U32("graphics/pokemon_storage/blank.4bpp.lz"); +const u32 gWallpaperTilemap_Blank[] = INCBIN_U32("graphics/pokemon_storage/blank.bin.lz"); + +const u16 gWallpaperPalettes_Circles[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/circles_bg.gbapal"), +}; +const u32 gWallpaperTiles_Circles[] = INCBIN_U32("graphics/pokemon_storage/circles.4bpp.lz"); +const u32 gWallpaperTilemap_Circles[] = INCBIN_U32("graphics/pokemon_storage/circles.bin.lz"); + +const u16 gWallpaperPalettes_Azumarill[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/azumarill_bg.gbapal"), +}; +const u32 gWallpaperTiles_Azumarill[] = INCBIN_U32("graphics/pokemon_storage/azumarill.4bpp.lz"); +const u32 gWallpaperTilemap_Azumarill[] = INCBIN_U32("graphics/pokemon_storage/azumarill.bin.lz"); + +const u16 gWallpaperPalettes_Pikachu[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/pikachu_bg.gbapal"), +}; +const u32 gWallpaperTiles_Pikachu[] = INCBIN_U32("graphics/pokemon_storage/pikachu.4bpp.lz"); +const u32 gWallpaperTilemap_Pikachu[] = INCBIN_U32("graphics/pokemon_storage/pikachu.bin.lz"); + +const u16 gWallpaperPalettes_Legendary[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/legendary_bg.gbapal"), +}; +const u32 gWallpaperTiles_Legendary[] = INCBIN_U32("graphics/pokemon_storage/legendary.4bpp.lz"); +const u32 gWallpaperTilemap_Legendary[] = INCBIN_U32("graphics/pokemon_storage/legendary.bin.lz"); + +const u16 gWallpaperPalettes_Dusclops[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/dusclops_bg.gbapal"), +}; +const u32 gWallpaperTiles_Dusclops[] = INCBIN_U32("graphics/pokemon_storage/dusclops.4bpp.lz"); +const u32 gWallpaperTilemap_Dusclops[] = INCBIN_U32("graphics/pokemon_storage/dusclops.bin.lz"); + +const u16 gWallpaperPalettes_Ludicolo[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/ludicolo_bg.gbapal"), +}; +const u32 gWallpaperTiles_Ludicolo[] = INCBIN_U32("graphics/pokemon_storage/ludicolo.4bpp.lz"); +const u32 gWallpaperTilemap_Ludicolo[] = INCBIN_U32("graphics/pokemon_storage/ludicolo.bin.lz"); + +const u16 gWallpaperPalettes_Whiscash[][16] = +{ + INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), + INCBIN_U16("graphics/pokemon_storage/whiscash_bg.gbapal"), +}; +const u32 gWallpaperTiles_Whiscash[] = INCBIN_U32("graphics/pokemon_storage/whiscash.4bpp.lz"); +const u32 gWallpaperTilemap_Whiscash[] = INCBIN_U32("graphics/pokemon_storage/whiscash.bin.lz"); + +const u32 gWallpaperIcon_Aqua[] = INCBIN_U32("graphics/pokemon_storage/aqua_icon.4bpp.lz"); +const u32 gWallpaperIcon_Heart[] = INCBIN_U32("graphics/pokemon_storage/heart_icon.4bpp.lz"); +const u32 gWallpaperIcon_FiveStar[] = INCBIN_U32("graphics/pokemon_storage/five_star_icon.4bpp.lz"); +const u32 gWallpaperIcon_Brick[] = INCBIN_U32("graphics/pokemon_storage/brick_icon.4bpp.lz"); +const u32 gWallpaperIcon_FourStar[] = INCBIN_U32("graphics/pokemon_storage/four_star_icon.4bpp.lz"); +const u32 gWallpaperIcon_Asterisk[] = INCBIN_U32("graphics/pokemon_storage/asterisk_icon.4bpp.lz"); +const u32 gWallpaperIcon_Dot[] = INCBIN_U32("graphics/pokemon_storage/dot_icon.4bpp.lz"); +const u32 gWallpaperIcon_LineCircle[] = INCBIN_U32("graphics/pokemon_storage/line_circle_icon.4bpp.lz"); +const u32 gWallpaperIcon_PokeBall[] = INCBIN_U32("graphics/pokemon_storage/pokeball_icon.4bpp.lz"); +const u32 gWallpaperIcon_Maze[] = INCBIN_U32("graphics/pokemon_storage/maze_icon.4bpp.lz"); +const u32 gWallpaperIcon_Footprint[] = INCBIN_U32("graphics/pokemon_storage/footprint_icon.4bpp.lz"); +const u32 gWallpaperIcon_BigAsterisk[] = INCBIN_U32("graphics/pokemon_storage/big_asterisk_icon.4bpp.lz"); +const u32 gWallpaperIcon_Circle[] = INCBIN_U32("graphics/pokemon_storage/circle_icon.4bpp.lz"); +const u32 gWallpaperIcon_Koffing[] = INCBIN_U32("graphics/pokemon_storage/koffing_icon.4bpp.lz"); +const u32 gWallpaperIcon_Ribbon[] = INCBIN_U32("graphics/pokemon_storage/ribbon_icon.4bpp.lz"); +const u32 gWallpaperIcon_FourCircles[] = INCBIN_U32("graphics/pokemon_storage/four_circles_icon.4bpp.lz"); +const u32 gWallpaperIcon_Lotad[] = INCBIN_U32("graphics/pokemon_storage/lotad_icon.4bpp.lz"); +const u32 gWallpaperIcon_Crystal[] = INCBIN_U32("graphics/pokemon_storage/crystal_icon.4bpp.lz"); +const u32 gWallpaperIcon_Pichu[] = INCBIN_U32("graphics/pokemon_storage/pichu_icon.4bpp.lz"); +const u32 gWallpaperIcon_Diglett[] = INCBIN_U32("graphics/pokemon_storage/diglett_icon.4bpp.lz"); +const u32 gWallpaperIcon_Luvdisc[] = INCBIN_U32("graphics/pokemon_storage/luvdisc_icon.4bpp.lz"); +const u32 gWallpaperIcon_StarInCircle[] = INCBIN_U32("graphics/pokemon_storage/star_in_circle_icon.4bpp.lz"); +const u32 gWallpaperIcon_Spinda[] = INCBIN_U32("graphics/pokemon_storage/spinda_icon.4bpp.lz"); +const u32 gWallpaperIcon_Latis[] = INCBIN_U32("graphics/pokemon_storage/latis_icon.4bpp.lz"); +const u32 gWallpaperIcon_Minun[] = INCBIN_U32("graphics/pokemon_storage/minun_icon.4bpp.lz"); +const u32 gWallpaperIcon_Togepi[] = INCBIN_U32("graphics/pokemon_storage/togepi_icon.4bpp.lz"); +const u32 gWallpaperIcon_Magma[] = INCBIN_U32("graphics/pokemon_storage/magma_icon.4bpp.lz"); + +const struct WallpaperTable gFriendsWallpaperTable[] = +{ + WALLPAPER_ENTRY(Zigzagoon), + WALLPAPER_ENTRY(Screen), + WALLPAPER_ENTRY(Horizontal), + WALLPAPER_ENTRY(Diagonal), + WALLPAPER_ENTRY(Block), + WALLPAPER_ENTRY(Ribbon), + WALLPAPER_ENTRY(Pokecenter2), + WALLPAPER_ENTRY(Frame), + WALLPAPER_ENTRY(Blank), + WALLPAPER_ENTRY(Circles), + WALLPAPER_ENTRY(Azumarill), + WALLPAPER_ENTRY(Pikachu), + WALLPAPER_ENTRY(Legendary), + WALLPAPER_ENTRY(Dusclops), + WALLPAPER_ENTRY(Ludicolo), + WALLPAPER_ENTRY(Whiscash), +}; + +const u32 *const gFriendsIcons[] = +{ + gWallpaperIcon_Aqua, + gWallpaperIcon_Heart, + gWallpaperIcon_FiveStar, + gWallpaperIcon_Brick, + gWallpaperIcon_FourStar, + gWallpaperIcon_Asterisk, + gWallpaperIcon_Dot, + gWallpaperIcon_Cross, + gWallpaperIcon_LineCircle, + gWallpaperIcon_PokeBall, + gWallpaperIcon_Maze, + gWallpaperIcon_Footprint, + gWallpaperIcon_BigAsterisk, + gWallpaperIcon_Circle, + gWallpaperIcon_Koffing, + gWallpaperIcon_Ribbon, + gWallpaperIcon_Bolt, + gWallpaperIcon_FourCircles, + gWallpaperIcon_Lotad, + gWallpaperIcon_Crystal, + gWallpaperIcon_Pichu, + gWallpaperIcon_Diglett, + gWallpaperIcon_Luvdisc, + gWallpaperIcon_StarInCircle, + gWallpaperIcon_Spinda, + gWallpaperIcon_Latis, + gWallpaperIcon_Plusle, + gWallpaperIcon_Minun, + gWallpaperIcon_Togepi, + gWallpaperIcon_Magma, +}; + +// Unknown Unused data. +const u16 gUnknown_0857B07C = 0x23BA; + +const struct SpriteSheet gUnknown_0857B080 = {gPCGfx_Arrow, 0x80, 6}; + +const struct OamData gOamData_83BB298 = +{ + .shape = ST_OAM_H_RECTANGLE, + .size = 2, + .priority = 2 +}; + +const union AnimCmd gSpriteAnim_83BB2A0[] = +{ + ANIMCMD_FRAME(0, 5), + ANIMCMD_END +}; + +const union AnimCmd gSpriteAnim_83BB2A8[] = +{ + ANIMCMD_FRAME(8, 5), + ANIMCMD_END +}; + +const union AnimCmd *const gSpriteAnimTable_83BB2B0[] = +{ + gSpriteAnim_83BB2A0, + gSpriteAnim_83BB2A8 +}; + +const struct SpriteTemplate gSpriteTemplate_857B0A8 = +{ + TAG_TILE_3, + TAG_PAL_DAC9, + &gOamData_83BB298, + gSpriteAnimTable_83BB2B0, + NULL, + gDummySpriteAffineAnimTable, + SpriteCallbackDummy +}; + +const struct OamData gOamData_83BB2D0 = +{ + .shape = ST_OAM_V_RECTANGLE, + .priority = 2 +}; + +const union AnimCmd gSpriteAnim_83BB2D8[] = +{ + ANIMCMD_FRAME(0, 5), + ANIMCMD_END +}; + +const union AnimCmd gSpriteAnim_83BB2E0[] = +{ + ANIMCMD_FRAME(2, 5), + ANIMCMD_END +}; + +const union AnimCmd *const gSpriteAnimTable_83BB2E8[] = +{ + gSpriteAnim_83BB2D8, + gSpriteAnim_83BB2E0 +}; + +const struct SpriteTemplate gUnknown_0857B0E0 = +{ + 6, + 0xDACA, + &gOamData_83BB2D0, + gSpriteAnimTable_83BB2E8, + NULL, + gDummySpriteAffineAnimTable, + sub_80CD210 +}; + +const u16 gHandCursorPalette[] = INCBIN_U16("graphics/pokemon_storage/hand_cursor.gbapal"); +const u8 gHandCursorTiles[] = INCBIN_U8("graphics/pokemon_storage/hand_cursor.4bpp"); +const u8 gHandCursorShadowTiles[] = INCBIN_U8("graphics/pokemon_storage/hand_cursor_shadow.4bpp"); + +bool8 (*const gUnknown_0857B998[])(void) = +{ + MonPlaceChange_Move, + MonPlaceChange_Place, + MonPlaceChange_Shift, +}; + +struct +{ + s8 mapGroup; + s8 mapNum; + u16 move; +} const gUnknown_0857B9A4[] = +{ + {MAP_GROUPS_COUNT, 0, MOVE_SURF}, + {MAP_GROUPS_COUNT, 0, MOVE_DIVE}, + {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MOVE_STRENGTH}, + {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MOVE_ROCK_SMASH}, + {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MOVE_STRENGTH}, + {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MOVE_ROCK_SMASH}, }; // code @@ -869,7 +1272,7 @@ u8 CountMonsInBox(u8 boxId) for (i = 0, count = 0; i < IN_BOX_COUNT; i++) { - if (GetBoxMonDataFromAnyBox(boxId, i, MON_DATA_SPECIES) != SPECIES_NONE) + if (GetBoxMonDataAt(boxId, i, MON_DATA_SPECIES) != SPECIES_NONE) count++; } @@ -882,7 +1285,7 @@ s16 GetFirstFreeBoxSpot(u8 boxId) for (i = 0; i < IN_BOX_COUNT; i++) { - if (GetBoxMonDataFromAnyBox(boxId, i, MON_DATA_SPECIES) == SPECIES_NONE) + if (GetBoxMonDataAt(boxId, i, MON_DATA_SPECIES) == SPECIES_NONE) return i; } @@ -1184,14 +1587,13 @@ s16 StorageSystemGetNextMonIndex(struct BoxPokemon *box, s8 startIdx, u8 stopIdx void ResetPokemonStorageSystem(void) { - u16 boxId; - u16 boxMon; + u16 boxId, boxPosition; SetCurrentBox(0); for (boxId = 0; boxId < TOTAL_BOXES_COUNT; boxId++) { - for (boxMon = 0; boxMon < IN_BOX_COUNT; boxMon++) - ClearMonInBox(boxId, boxMon); + for (boxPosition = 0; boxPosition < IN_BOX_COUNT; boxPosition++) + ZeroBoxMonAt(boxId, boxPosition); } for (boxId = 0; boxId < TOTAL_BOXES_COUNT; boxId++) { @@ -1735,7 +2137,7 @@ void Cb_MainPSS(u8 taskId) gUnknown_02039D08->newCurrBoxId = 0; if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) { - sub_80CC464(gUnknown_02039D08->newCurrBoxId); + SetUpScrollToBox(gUnknown_02039D08->newCurrBoxId); gUnknown_02039D08->state = 2; } else @@ -1751,7 +2153,7 @@ void Cb_MainPSS(u8 taskId) gUnknown_02039D08->newCurrBoxId = TOTAL_BOXES_COUNT - 1; if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) { - sub_80CC464(gUnknown_02039D08->newCurrBoxId); + SetUpScrollToBox(gUnknown_02039D08->newCurrBoxId); gUnknown_02039D08->state = 2; } else @@ -1930,7 +2332,7 @@ void Cb_MainPSS(u8 taskId) case 10: if (!sub_80D1218()) { - sub_80CC464(gUnknown_02039D08->newCurrBoxId); + SetUpScrollToBox(gUnknown_02039D08->newCurrBoxId); gUnknown_02039D08->state = 2; } break; @@ -2145,11 +2547,11 @@ void Cb_MoveMon(u8 taskId) switch (gUnknown_02039D08->state) { case 0: - sub_80CDC38(0); + InitMonPlaceChange(0); gUnknown_02039D08->state++; break; case 1: - if (!sub_80CDCAC()) + if (!DoMonPlaceChange()) { if (sInPartyMenu) SetPSSCallback(Cb_HandleMovingMonFromParty); @@ -2165,11 +2567,11 @@ void Cb_PlaceMon(u8 taskId) switch (gUnknown_02039D08->state) { case 0: - sub_80CDC38(1); + InitMonPlaceChange(1); gUnknown_02039D08->state++; break; case 1: - if (!sub_80CDCAC()) + if (!DoMonPlaceChange()) { if (sInPartyMenu) SetPSSCallback(Cb_HandleMovingMonFromParty); @@ -2185,11 +2587,11 @@ void Cb_ShiftMon(u8 taskId) switch (gUnknown_02039D08->state) { case 0: - sub_80CDC38(2); + InitMonPlaceChange(2); gUnknown_02039D08->state++; break; case 1: - if (!sub_80CDCAC()) + if (!DoMonPlaceChange()) { BoxSetMosaic(); SetPSSCallback(Cb_MainPSS); @@ -2211,7 +2613,7 @@ void Cb_WithdrawMon(u8 taskId) else { sub_80CDC18(); - sub_80CDC38(0); + InitMonPlaceChange(0); gUnknown_02039D08->state = 2; } break; @@ -2223,7 +2625,7 @@ void Cb_WithdrawMon(u8 taskId) } break; case 2: - if (!sub_80CDCAC()) + if (!DoMonPlaceChange()) { sub_80CC0D4(1); SetUpDoShowPartyMenu(); @@ -2233,12 +2635,12 @@ void Cb_WithdrawMon(u8 taskId) case 3: if (!DoShowPartyMenu()) { - sub_80CDC38(1); + InitMonPlaceChange(1); gUnknown_02039D08->state++; } break; case 4: - if (!sub_80CDCAC()) + if (!DoMonPlaceChange()) { sub_80CAB20(); gUnknown_02039D08->state++; @@ -2252,7 +2654,7 @@ void Cb_WithdrawMon(u8 taskId) void Cb_DepositMenu(u8 taskId) { - u8 r4; + u8 boxId; switch (gUnknown_02039D08->state) { @@ -2263,9 +2665,9 @@ void Cb_DepositMenu(u8 taskId) gUnknown_02039D08->state++; break; case 1: - r4 = sub_80C78F0(); - if (r4 == 200); - else if (r4 == 201) + boxId = sub_80C78F0(); + if (boxId == 200); + else if (boxId == 201) { ClearBottomWindow(); sub_80C78E4(); @@ -2274,9 +2676,9 @@ void Cb_DepositMenu(u8 taskId) } else { - if (sub_80CE19C(r4)) + if (TryStorePartyMonInBox(boxId)) { - gUnknown_02039D0E = r4; + gUnknown_02039D0E = boxId; ClearBottomWindow(); sub_80C78E4(); sub_80C7890(); @@ -2325,17 +2727,17 @@ void Cb_ReleaseMon(u8 taskId) case 1: switch (Menu_ProcessInputNoWrapClearOnChoose()) { - case -1: - case 1: - ClearBottomWindow(); - SetPSSCallback(Cb_MainPSS); - break; - case 0: - ClearBottomWindow(); - sub_80CE3A0(); - sub_80CE250(); - gUnknown_02039D08->state++; - break; + case -1: + case 1: + ClearBottomWindow(); + SetPSSCallback(Cb_MainPSS); + break; + case 0: + ClearBottomWindow(); + sub_80CE3A0(); + sub_80CE250(); + gUnknown_02039D08->state++; + break; } break; case 2: @@ -2352,7 +2754,7 @@ void Cb_ReleaseMon(u8 taskId) } if (r0 == 0) { - gUnknown_02039D08->state = 8; + gUnknown_02039D08->state = 8; // Can't release the mon. break; } } @@ -2933,7 +3335,7 @@ void Cb_JumpBox(u8 taskId) } break; case 2: - sub_80CC464(gUnknown_02039D08->newCurrBoxId); + SetUpScrollToBox(gUnknown_02039D08->newCurrBoxId); gUnknown_02039D08->state++; break; case 3: @@ -3439,7 +3841,7 @@ void sub_80CA704(void) if (sInPartyMenu) { sub_80CA984(TRUE); - sub_80CB7E8(TRUE); + CreatePartyMonsSprites(TRUE); sub_80D2918(2); sub_80D2918(1); } @@ -3460,7 +3862,7 @@ void SetUpShowPartyMenu(void) gUnknown_02039D08->field_2C0 = 20; gUnknown_02039D08->field_2C2 = 2; gUnknown_02039D08->field_2C5 = 0; - sub_80CB7E8(FALSE); + CreatePartyMonsSprites(FALSE); } bool8 ShowPartyMenu(void) @@ -3512,7 +3914,7 @@ bool8 HidePartyMenu(void) else { sInPartyMenu = FALSE; - sub_80CBB9C(); + DestroyAllPartyMonIcons(); CompactPartySlots(); sub_80D27AC(2, 0, 0, 9, 2); sub_80D2918(2); @@ -3762,9 +4164,9 @@ void sub_80CAEAC(void) if (!IsCursorOnBox()) { if (sInPartyMenu) - sub_80D0D8C(TRUE, GetBoxCursorPosition()); + sub_80D0D8C(1, GetBoxCursorPosition()); else - sub_80D0D8C(FALSE, GetBoxCursorPosition()); + sub_80D0D8C(0, GetBoxCursorPosition()); } if (gUnknown_02039D12 != 0) @@ -3791,3 +4193,2062 @@ void sub_80CAF04(void) gUnknown_02039D08->field_A6C = NULL; gUnknown_02039D08->field_78C = 0; } + +u8 sub_80CAFAC(void) +{ + return (IsCursorInBox() ? 2 : 1); +} + +void sub_80CAFC4(void) +{ + u32 personality = GetMonData(&gUnknown_02039D08->field_20A4, MON_DATA_PERSONALITY); + u16 species = GetMonData(&gUnknown_02039D08->field_20A4, MON_DATA_SPECIES2); + u8 priority = sub_80CAFAC(); + + gUnknown_02039D08->field_A6C = CreateMonIconSprite(species, personality, 0, 0, priority, 7); + gUnknown_02039D08->field_A6C->callback = sub_80CC100; +} + +void sub_80CB028(u8 boxId) +{ + u8 boxPosition; + u16 i, j, count; + u16 species; + u32 personality; + + count = 0; + boxPosition = 0; + for (i = 0; i < IN_BOX_COLUMS; i++) + { + for (j = 0; j < IN_BOX_ROWS; j++) + { + species = GetBoxMonDataAt(boxId, boxPosition, MON_DATA_SPECIES2); + if (species != SPECIES_NONE) + { + personality = GetBoxMonDataAt(boxId, boxPosition, MON_DATA_PERSONALITY); + gUnknown_02039D08->boxMonsSprites[count] = CreateMonIconSprite(species, personality, 8 * (3 * j) + 100, 8 * (3 * i) + 44, 2, 19 - j); + } + else + { + gUnknown_02039D08->boxMonsSprites[count] = NULL; + } + boxPosition++; + count++; + } + } + + if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + { + for (boxPosition = 0; boxPosition < IN_BOX_COUNT; boxPosition++) + { + if (GetBoxMonDataAt(boxId, boxPosition, MON_DATA_HELD_ITEM) == 0) + gUnknown_02039D08->boxMonsSprites[boxPosition]->oam.objMode = 1; + } + } +} + +void sub_80CB140(u8 boxPosition) +{ + u16 species = GetCurrentBoxMonData(boxPosition, MON_DATA_SPECIES2); + + if (species != SPECIES_NONE) + { + s16 x = 8 * (3 * (boxPosition % IN_BOX_ROWS)) + 100; + s16 y = 8 * (3 * (boxPosition / IN_BOX_ROWS)) + 44; + u32 personality = GetCurrentBoxMonData(boxPosition, MON_DATA_PERSONALITY); + + gUnknown_02039D08->boxMonsSprites[boxPosition] = CreateMonIconSprite(species, personality, x, y, 2, 19 - (boxPosition % IN_BOX_ROWS)); + if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + gUnknown_02039D08->boxMonsSprites[boxPosition]->oam.objMode = 1; + } +} + +void sub_80CB1F0(s16 arg0) +{ + u16 i; + + for (i = 0; i < IN_BOX_COUNT; i++) + { + if (gUnknown_02039D08->boxMonsSprites[i] != NULL) + { + gUnknown_02039D08->boxMonsSprites[i]->data[2] = arg0; + gUnknown_02039D08->boxMonsSprites[i]->data[4] = 1; + gUnknown_02039D08->boxMonsSprites[i]->callback = sub_80CB278; + } + } +} + +void sub_80CB234(struct Sprite *sprite) +{ + if (sprite->data[1] != 0) + { + sprite->data[1]--; + sprite->pos1.x += sprite->data[2]; + } + else + { + gUnknown_02039D08->field_C66--; + sprite->pos1.x = sprite->data[3]; + sprite->callback = SpriteCallbackDummy; + } +} + +void sub_80CB278(struct Sprite *sprite) +{ + if (sprite->data[4] != 0) + { + sprite->data[4]--; + } + else + { + sprite->pos1.x += sprite->data[2]; + sprite->data[5] = sprite->pos1.x + sprite->pos2.x; + if (sprite->data[5] <= 68 || sprite->data[5] >= 252) + sprite->callback = SpriteCallbackDummy; + } +} + +void DestroyAllIconsInRow(u8 row) +{ + u16 column; + u8 boxPosition = row; + + for (column = 0; column < IN_BOX_COLUMS; column++) + { + if (gUnknown_02039D08->boxMonsSprites[boxPosition] != NULL) + { + DestroyBoxMonIcon(gUnknown_02039D08->boxMonsSprites[boxPosition]); + gUnknown_02039D08->boxMonsSprites[boxPosition] = NULL; + } + boxPosition += IN_BOX_ROWS; + } +} + +u8 sub_80CB2F8(u8 row, u16 times, s16 xDelta) +{ + s32 i; + u16 y = 44; + s16 xDest = 8 * (3 * row) + 100; + u16 x = xDest - ((times + 1) * xDelta); + u8 subpriority = 19 - row; + u8 count = 0; + u8 boxPosition = row; + + if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + { + for (i = 0; i < IN_BOX_COLUMS; i++) + { + if (gUnknown_02039D08->boxSpecies[boxPosition] != SPECIES_NONE) + { + gUnknown_02039D08->boxMonsSprites[boxPosition] = CreateMonIconSprite(gUnknown_02039D08->boxSpecies[boxPosition], + gUnknown_02039D08->boxPersonalities[boxPosition], + x, y, 2, subpriority); + if (gUnknown_02039D08->boxMonsSprites[boxPosition] != NULL) + { + gUnknown_02039D08->boxMonsSprites[boxPosition]->data[1] = times; + gUnknown_02039D08->boxMonsSprites[boxPosition]->data[2] = xDelta; + gUnknown_02039D08->boxMonsSprites[boxPosition]->data[3] = xDest; + gUnknown_02039D08->boxMonsSprites[boxPosition]->callback = sub_80CB234; + count++; + } + } + boxPosition += IN_BOX_ROWS; + y += 24; + } + } + else + { + for (i = 0; i < IN_BOX_COLUMS; i++) + { + if (gUnknown_02039D08->boxSpecies[boxPosition] != SPECIES_NONE) + { + gUnknown_02039D08->boxMonsSprites[boxPosition] = CreateMonIconSprite(gUnknown_02039D08->boxSpecies[boxPosition], + gUnknown_02039D08->boxPersonalities[boxPosition], + x, y, 2, subpriority); + if (gUnknown_02039D08->boxMonsSprites[boxPosition] != NULL) + { + gUnknown_02039D08->boxMonsSprites[boxPosition]->data[1] = times; + gUnknown_02039D08->boxMonsSprites[boxPosition]->data[2] = xDelta; + gUnknown_02039D08->boxMonsSprites[boxPosition]->data[3] = xDest; + gUnknown_02039D08->boxMonsSprites[boxPosition]->callback = sub_80CB234; + if (GetBoxMonDataAt(gUnknown_02039D08->field_C5C, boxPosition, MON_DATA_HELD_ITEM) == 0) + gUnknown_02039D08->boxMonsSprites[boxPosition]->oam.objMode = 1; + count++; + } + } + boxPosition += IN_BOX_ROWS; + y += 24; + } + } + + return count; +} + +void sub_80CB4CC(u8 boxId, s8 direction) +{ + gUnknown_02039D08->field_C6A = 0; + gUnknown_02039D08->field_C6B = boxId; + gUnknown_02039D08->field_C69 = direction; + gUnknown_02039D08->field_C60 = 32; + gUnknown_02039D08->field_C64 = -(6 * direction); + gUnknown_02039D08->field_C66 = 0; + SetBoxSpeciesAndPersonalities(boxId); + if (direction > 0) + gUnknown_02039D08->field_C68 = 0; + else + gUnknown_02039D08->field_C68 = IN_BOX_ROWS - 1; + + gUnknown_02039D08->field_C62 = (24 * gUnknown_02039D08->field_C68) + 100; + sub_80CB1F0(gUnknown_02039D08->field_C64); +} + +bool8 sub_80CB584(void) +{ + if (gUnknown_02039D08->field_C60 != 0) + gUnknown_02039D08->field_C60--; + + switch (gUnknown_02039D08->field_C6A) + { + case 0: + gUnknown_02039D08->field_C62 += gUnknown_02039D08->field_C64; + if (gUnknown_02039D08->field_C62 <= 64 || gUnknown_02039D08->field_C62 >= 252) + { + DestroyAllIconsInRow(gUnknown_02039D08->field_C68); + gUnknown_02039D08->field_C62 += gUnknown_02039D08->field_C69 * 24; + gUnknown_02039D08->field_C6A++; + } + break; + case 1: + gUnknown_02039D08->field_C62 += gUnknown_02039D08->field_C64; + gUnknown_02039D08->field_C66 += sub_80CB2F8(gUnknown_02039D08->field_C68, gUnknown_02039D08->field_C60, gUnknown_02039D08->field_C64); + if ((gUnknown_02039D08->field_C69 > 0 && gUnknown_02039D08->field_C68 == IN_BOX_ROWS - 1) + || (gUnknown_02039D08->field_C69 < 0 && gUnknown_02039D08->field_C68 == 0)) + { + gUnknown_02039D08->field_C6A++; + } + else + { + gUnknown_02039D08->field_C68 += gUnknown_02039D08->field_C69; + gUnknown_02039D08->field_C6A = 0; + } + break; + case 2: + if (gUnknown_02039D08->field_C66 == 0) + { + gUnknown_02039D08->field_C60++; + return FALSE; + } + break; + default: + return FALSE; + } + + return TRUE; +} + +void SetBoxSpeciesAndPersonalities(u8 boxId) +{ + s32 i, j, boxPosition; + + boxPosition = 0; + for (i = 0; i < IN_BOX_COLUMS; i++) + { + for (j = 0; j < IN_BOX_ROWS; j++) + { + gUnknown_02039D08->boxSpecies[boxPosition] = GetBoxMonDataAt(boxId, boxPosition, MON_DATA_SPECIES2); + if (gUnknown_02039D08->boxSpecies[boxPosition] != SPECIES_NONE) + gUnknown_02039D08->boxPersonalities[boxPosition] = GetBoxMonDataAt(boxId, boxPosition, MON_DATA_PERSONALITY); + boxPosition++; + } + } + + gUnknown_02039D08->field_C5C = boxId; +} + +void DestroyBoxMonIconAtPosition(u8 boxPosition) +{ + if (gUnknown_02039D08->boxMonsSprites[boxPosition] != NULL) + { + DestroyBoxMonIcon(gUnknown_02039D08->boxMonsSprites[boxPosition]); + gUnknown_02039D08->boxMonsSprites[boxPosition] = NULL; + } +} + +void SetBoxMonIconObjMode(u8 boxPosition, u8 objMode) +{ + if (gUnknown_02039D08->boxMonsSprites[boxPosition] != NULL) + { + gUnknown_02039D08->boxMonsSprites[boxPosition]->oam.objMode = objMode; + } +} + +void CreatePartyMonsSprites(bool8 arg0) +{ + u16 i, count; + u16 species = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES2); + u32 personality = GetMonData(&gPlayerParty[0], MON_DATA_PERSONALITY); + + gUnknown_02039D08->partySprites[0] = CreateMonIconSprite(species, personality, 104, 64, 1, 12); + count = 1; + for (i = 1; i < PARTY_SIZE; i++) + { + species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); + if (species != SPECIES_NONE) + { + personality = GetMonData(&gPlayerParty[i], MON_DATA_PERSONALITY); + gUnknown_02039D08->partySprites[i] = CreateMonIconSprite(species, personality, 152, 8 * (3 * (i - 1)) + 16, 1, 12); + count++; + } + else + { + gUnknown_02039D08->partySprites[i] = NULL; + } + } + + if (!arg0) + { + for (i = 0; i < count; i++) + { + gUnknown_02039D08->partySprites[i]->pos1.y -= 160; + gUnknown_02039D08->partySprites[i]->invisible = TRUE; + } + } + + if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + { + for (i = 0; i < PARTY_SIZE; i++) + { + if (gUnknown_02039D08->partySprites[i] != NULL && GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM) == 0) + gUnknown_02039D08->partySprites[i]->oam.objMode = 1; + } + } +} + +void sub_80CB950(void) +{ + u16 i, count; + + gUnknown_02039D08->field_C5E = 0; + for (i = 0, count = 0; i < PARTY_SIZE; i++) + { + if (gUnknown_02039D08->partySprites[i] != NULL) + { + if (i != count) + { + sub_80CB9D0(gUnknown_02039D08->partySprites[i], count); + gUnknown_02039D08->partySprites[i] = NULL; + gUnknown_02039D08->field_C5E++; + } + count++; + } + } +} + +u8 sub_80CB9BC(void) +{ + return gUnknown_02039D08->field_C5E; +} + +void sub_80CB9D0(struct Sprite *sprite, u16 partyId) +{ + s16 x, y; + + sprite->data[1] = partyId; + if (partyId == 0) + x = 104, y = 64; + else + x = 152, y = 8 * (3 * (partyId - 1)) + 16; + + sprite->data[2] = (u16)(sprite->pos1.x) * 8; + sprite->data[3] = (u16)(sprite->pos1.y) * 8; + sprite->data[4] = ((x * 8) - sprite->data[2]) / 8; + sprite->data[5] = ((y * 8) - sprite->data[3]) / 8; + sprite->data[6] = 8; + sprite->callback = sub_80CBA3C; +} + +void sub_80CBA3C(struct Sprite *sprite) +{ + if (sprite->data[6] != 0) + { + s16 x = sprite->data[2] += sprite->data[4]; + s16 y = sprite->data[3] += sprite->data[5]; + sprite->pos1.x = x / 8u; + sprite->pos1.y = y / 8u; + sprite->data[6]--; + } + else + { + if (sprite->data[1] == 0) + { + sprite->pos1.x = 104; + sprite->pos1.y = 64; + } + else + { + sprite->pos1.x = 152; + sprite->pos1.y = 8 * (3 * (sprite->data[1] - 1)) + 16; + } + sprite->callback = SpriteCallbackDummy; + gUnknown_02039D08->partySprites[sprite->data[1]] = sprite; + gUnknown_02039D08->field_C5E--; + } +} + +void sub_80CBAC4(void) +{ + if (gUnknown_02039D08->field_A6C != NULL) + { + DestroyBoxMonIcon(gUnknown_02039D08->field_A6C); + gUnknown_02039D08->field_A6C = NULL; + } +} + +void sub_80CBAF0(s16 yDelta) +{ + u16 i, posY; + + for (i = 0; i < PARTY_SIZE; i++) + { + if (gUnknown_02039D08->partySprites[i] != NULL) + { + gUnknown_02039D08->partySprites[i]->pos1.y += yDelta; + posY = gUnknown_02039D08->partySprites[i]->pos1.y + gUnknown_02039D08->partySprites[i]->pos2.y + gUnknown_02039D08->partySprites[i]->centerToCornerVecY; + posY += 16; + if (posY > 192) + gUnknown_02039D08->partySprites[i]->invisible = TRUE; + else + gUnknown_02039D08->partySprites[i]->invisible = FALSE; + } + } +} + +void DestroyPartyMonIcon(u8 partyId) +{ + if (gUnknown_02039D08->partySprites[partyId] != NULL) + { + DestroyBoxMonIcon(gUnknown_02039D08->partySprites[partyId]); + gUnknown_02039D08->partySprites[partyId] = NULL; + } +} + +void DestroyAllPartyMonIcons(void) +{ + u16 i; + + for (i = 0; i < PARTY_SIZE; i++) + { + if (gUnknown_02039D08->partySprites[i] != NULL) + { + DestroyBoxMonIcon(gUnknown_02039D08->partySprites[i]); + gUnknown_02039D08->partySprites[i] = NULL; + } + } +} + +void SetPartyMonIconObjMode(u8 partyId, u8 objMode) +{ + if (gUnknown_02039D08->partySprites[partyId] != NULL) + { + gUnknown_02039D08->partySprites[partyId]->oam.objMode = objMode; + } +} + +void sub_80CBC14(u8 mode, u8 id) +{ + if (mode == MODE_PARTY) + { + gUnknown_02039D08->field_A6C = gUnknown_02039D08->partySprites[id]; + gUnknown_02039D08->partySprites[id] = NULL; + } + else if (mode == MODE_BOX) + { + gUnknown_02039D08->field_A6C = gUnknown_02039D08->boxMonsSprites[id]; + gUnknown_02039D08->boxMonsSprites[id] = NULL; + } + else + { + return; + } + + gUnknown_02039D08->field_A6C->callback = sub_80CC100; + gUnknown_02039D08->field_A6C->oam.priority = sub_80CAFAC(); + gUnknown_02039D08->field_A6C->subpriority = 7; +} + +void sub_80CBCAC(u8 boxId, u8 position) +{ + if (boxId == TOTAL_BOXES_COUNT) // party mon + { + gUnknown_02039D08->partySprites[position] = gUnknown_02039D08->field_A6C; + gUnknown_02039D08->partySprites[position]->oam.priority = 1; + gUnknown_02039D08->partySprites[position]->subpriority = 12; + } + else + { + gUnknown_02039D08->boxMonsSprites[position] = gUnknown_02039D08->field_A6C; + gUnknown_02039D08->boxMonsSprites[position]->oam.priority = 2; + gUnknown_02039D08->boxMonsSprites[position]->subpriority = 19 - (position % IN_BOX_ROWS); + } + gUnknown_02039D08->field_A6C->callback = SpriteCallbackDummy; + gUnknown_02039D08->field_A6C = NULL; +} + +void sub_80CBD5C(u8 boxId, u8 position) +{ + if (boxId == TOTAL_BOXES_COUNT) // party mon + gUnknown_02039D08->field_B00 = &gUnknown_02039D08->partySprites[position]; + else + gUnknown_02039D08->field_B00 = &gUnknown_02039D08->boxMonsSprites[position]; + + gUnknown_02039D08->field_A6C->callback = SpriteCallbackDummy; + gUnknown_02039D08->field_C5D = 0; +} + +bool8 sub_80CBDC4(void) +{ + if (gUnknown_02039D08->field_C5D == 16) + return FALSE; + + gUnknown_02039D08->field_C5D++; + if (gUnknown_02039D08->field_C5D & 1) + { + (*gUnknown_02039D08->field_B00)->pos1.y--; + gUnknown_02039D08->field_A6C->pos1.y++; + } + + (*gUnknown_02039D08->field_B00)->pos2.x = gSineTable[gUnknown_02039D08->field_C5D * 8] / 16; + gUnknown_02039D08->field_A6C->pos2.x = -(gSineTable[gUnknown_02039D08->field_C5D * 8] / 16); + if (gUnknown_02039D08->field_C5D == 8) + { + gUnknown_02039D08->field_A6C->oam.priority = (*gUnknown_02039D08->field_B00)->oam.priority; + gUnknown_02039D08->field_A6C->subpriority = (*gUnknown_02039D08->field_B00)->subpriority; + (*gUnknown_02039D08->field_B00)->oam.priority = sub_80CAFAC(); + (*gUnknown_02039D08->field_B00)->subpriority = 7; + } + + if (gUnknown_02039D08->field_C5D == 16) + { + struct Sprite *sprite = gUnknown_02039D08->field_A6C; + gUnknown_02039D08->field_A6C = (*gUnknown_02039D08->field_B00); + *gUnknown_02039D08->field_B00 = sprite; + + gUnknown_02039D08->field_A6C->callback = sub_80CC100; + (*gUnknown_02039D08->field_B00)->callback = SpriteCallbackDummy; + } + + return TRUE; +} + +void sub_80CBF14(u8 mode, u8 position) +{ + switch (mode) + { + case MODE_PARTY: + gUnknown_02039D08->field_B04 = &gUnknown_02039D08->partySprites[position]; + break; + case MODE_BOX: + gUnknown_02039D08->field_B04 = &gUnknown_02039D08->boxMonsSprites[position]; + break; + case MODE_2: + gUnknown_02039D08->field_B04 = &gUnknown_02039D08->field_A6C; + break; + default: + return; + } + + if (*gUnknown_02039D08->field_B04 != NULL) + { + InitSpriteAffineAnim(*gUnknown_02039D08->field_B04); + (*gUnknown_02039D08->field_B04)->oam.affineMode = 1; + (*gUnknown_02039D08->field_B04)->affineAnims = gSpriteAffineAnimTable_857291C; + StartSpriteAffineAnim(*gUnknown_02039D08->field_B04, 0); + } +} + +bool8 sub_80CBFD8(void) +{ + if (*gUnknown_02039D08->field_B04 == NULL || (*gUnknown_02039D08->field_B04)->invisible) + return FALSE; + + if ((*gUnknown_02039D08->field_B04)->affineAnimEnded) + (*gUnknown_02039D08->field_B04)->invisible = TRUE; + + return TRUE; +} + +void sub_80CC020(void) +{ + if (*gUnknown_02039D08->field_B04 != NULL) + { + FreeOamMatrix((*gUnknown_02039D08->field_B04)->oam.matrixNum); + DestroyBoxMonIcon(*gUnknown_02039D08->field_B04); + *gUnknown_02039D08->field_B04 = NULL; + } +} + +void sub_80CC064(void) +{ + if (*gUnknown_02039D08->field_B04 != NULL) + { + (*gUnknown_02039D08->field_B04)->invisible = FALSE; + StartSpriteAffineAnim(*gUnknown_02039D08->field_B04, 1); + } +} + +bool8 sub_80CC0A0(void) +{ + if (gUnknown_02039D08->field_B04 == NULL) + return FALSE; + + if ((*gUnknown_02039D08->field_B04)->affineAnimEnded) + gUnknown_02039D08->field_B04 = NULL; + + return TRUE; +} + +void sub_80CC0D4(u8 priority) +{ + gUnknown_02039D08->field_A6C->oam.priority = priority; +} + +void sub_80CC100(struct Sprite *sprite) +{ + sprite->pos1.x = gUnknown_02039D08->field_CB4->pos1.x; + sprite->pos1.y = gUnknown_02039D08->field_CB4->pos1.y + gUnknown_02039D08->field_CB4->pos2.y + 4; +} + +u16 sub_80CC124(u16 species) +{ + u16 i, var; + + for (i = 0; i < 40; i++) + { + if (gUnknown_02039D08->field_B58[i] == species) + break; + } + + if (i == 40) + { + for (i = 0; i < 40; i++) + { + if (gUnknown_02039D08->field_B58[i] == 0) + break; + } + if (i == 40) + return 0xFFFF; + } + + gUnknown_02039D08->field_B58[i] = species; + gUnknown_02039D08->field_B08[i]++; + var = 16 * i; + CpuCopy32(GetMonIconTiles(species, TRUE), (void*)(OBJ_VRAM0) + var * 32, 0x200); + + return var; +} + +void sub_80CC1E0(u16 species) +{ + u16 i; + + for (i = 0; i < 40; i++) + { + if (gUnknown_02039D08->field_B58[i] == species) + { + if (--gUnknown_02039D08->field_B08[i] == 0) + gUnknown_02039D08->field_B58[i] = 0; + break; + } + } +} + +static struct Sprite *CreateMonIconSprite(u16 species, u32 personality, s16 x, s16 y, u8 oamPriority, u8 subpriority) +{ + u16 tileNum; + u8 spriteId; + struct SpriteTemplate tempalte = gUnknown_085728D4; + + species = GetIconSpecies(species, personality); + tempalte.paletteTag = 0xDAC0 + gMonIconPaletteIndices[species]; + tileNum = sub_80CC124(species); + if (tileNum == 0xFFFF) + return NULL; + + spriteId = CreateSprite(&tempalte, x, y, subpriority); + if (spriteId == MAX_SPRITES) + { + sub_80CC1E0(species); + return NULL; + } + + gSprites[spriteId].oam.tileNum = tileNum; + gSprites[spriteId].oam.priority = oamPriority; + gSprites[spriteId].data[0] = species; + return &gSprites[spriteId]; +} + +void DestroyBoxMonIcon(struct Sprite *sprite) +{ + sub_80CC1E0(sprite->data[0]); + DestroySprite(sprite); +} + +void sub_80CC32C(u8 boxId) +{ + u8 taskId = CreateTask(sub_80CC370, 2); + + gTasks[taskId].data[2] = boxId; +} + +bool8 sub_80CC35C(void) +{ + return FuncIsActiveTask(sub_80CC370); +} + +void sub_80CC370(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + + switch (task->data[0]) + { + case 0: + gUnknown_02039D08->field_2D2 = 0; + gUnknown_02039D08->bg2_X = 0; + task->data[1] = RequestDma3Fill(0, gUnknown_02039D08->field_4AC4, 0x1000, 1); + break; + case 1: + if (CheckForSpaceForDma3Request(task->data[1]) == -1) + return; + + SetBgTilemapBuffer(2, gUnknown_02039D08->field_4AC4); + ShowBg(2); + break; + case 2: + LoadWallpaperGfx(task->data[2], 0); + break; + case 3: + if (!WaitForWallpaperGfxLoad()) + return; + + sub_80CCB50(task->data[2]); + sub_80CD02C(); + sub_80CB028(task->data[2]); + SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2) | BGCNT_CHARBASE(2) | BGCNT_SCREENBASE(27) | BGCNT_TXT512x256); + break; + case 4: + DestroyTask(taskId); + break; + default: + task->data[0] = 0; + return; + } + + task->data[0]++; +} + +void SetUpScrollToBox(u8 boxId) +{ + s8 direction = sub_80CC644(boxId); + + gUnknown_02039D08->field_2CE = (direction > 0) ? 6 : -6; + gUnknown_02039D08->field_2D3 = (direction > 0) ? 1 : 2; + gUnknown_02039D08->field_2D0 = 32; + gUnknown_02039D08->field_2D4 = boxId; + gUnknown_02039D08->field_2D6 = (direction <= 0) ? 5 : 0; + gUnknown_02039D08->field_2D8 = direction; + gUnknown_02039D08->field_2DA = (direction > 0) ? 264 : 56; + gUnknown_02039D08->field_2DC = (direction <= 0) ? 5 : 0; + gUnknown_02039D08->field_2DE = 0; + gUnknown_02039D08->field_2E0 = 2; + gUnknown_02039D08->field_A64 = boxId; + gUnknown_02039D08->field_A65 = direction; + gUnknown_02039D08->field_A63 = 0; +} + +bool8 ScrollToBox(void) +{ + bool8 var; + + switch (gUnknown_02039D08->field_A63) + { + case 0: + LoadWallpaperGfx(gUnknown_02039D08->field_A64, gUnknown_02039D08->field_A65); + gUnknown_02039D08->field_A63++; + case 1: + if (!WaitForWallpaperGfxLoad()) + return TRUE; + + sub_80CB4CC(gUnknown_02039D08->field_A64, gUnknown_02039D08->field_A65); + sub_80CCCFC(gUnknown_02039D08->field_A64, gUnknown_02039D08->field_A65); + sub_80CD0B8(gUnknown_02039D08->field_A65); + break; + case 2: + var = sub_80CB584(); + if (gUnknown_02039D08->field_2D0 != 0) + { + gUnknown_02039D08->bg2_X += gUnknown_02039D08->field_2CE; + if (--gUnknown_02039D08->field_2D0 != 0) + return TRUE; + sub_80CCEE0(); + sub_80CD158(); + } + return var; + } + + gUnknown_02039D08->field_A63++; + return TRUE; +} + +s8 sub_80CC644(u8 boxId) +{ + u8 i; + u8 currentBox = StorageGetCurrentBox(); + + for (i = 0; currentBox != boxId; i++) + { + currentBox++; + if (currentBox >= TOTAL_BOXES_COUNT) + currentBox = 0; + } + + return (i < TOTAL_BOXES_COUNT / 2) ? 1 : -1; +} + +void SetWallpaperForCurrentBox(u8 wallpaperId) +{ + u8 boxId = StorageGetCurrentBox(); + SetBoxWallpaper(boxId, wallpaperId); + gUnknown_02039D08->wallpaperChangeState = 0; +} + +bool8 DoWallpaperGfxChange(void) +{ + switch (gUnknown_02039D08->wallpaperChangeState) + { + case 0: + BeginNormalPaletteFade(gUnknown_02039D08->field_738, 1, 0, 16, RGB_WHITEALPHA); + gUnknown_02039D08->wallpaperChangeState++; + break; + case 1: + if (!UpdatePaletteFade()) + { + u8 curBox = StorageGetCurrentBox(); + LoadWallpaperGfx(curBox, 0); + gUnknown_02039D08->wallpaperChangeState++; + } + break; + case 2: + if (WaitForWallpaperGfxLoad() == TRUE) + { + sub_80CCF9C(); + BeginNormalPaletteFade(gUnknown_02039D08->field_738, 1, 16, 0, RGB_WHITEALPHA); + gUnknown_02039D08->wallpaperChangeState++; + } + break; + case 3: + if (!UpdatePaletteFade()) + gUnknown_02039D08->wallpaperChangeState++; + break; + case 4: + return FALSE; + } + + return TRUE; +} + +void LoadWallpaperGfx(u8 boxId, s8 direction) +{ + u8 wallpaperId; + const struct WallpaperTable *wallpaperGfx; + void *iconGfx; + u32 size1, size2; + + gUnknown_02039D08->field_6F9 = 0; + gUnknown_02039D08->field_6FA = boxId; + gUnknown_02039D08->field_6FB = direction; + if (gUnknown_02039D08->field_6FB != 0) + { + gUnknown_02039D08->field_2D2 = (gUnknown_02039D08->field_2D2 == 0); + sub_80CCAE0(gUnknown_02039D08->field_4AC4); + } + + wallpaperId = GetBoxWallpaper(gUnknown_02039D08->field_6FA); + if (wallpaperId != WALLPAPER_FRIENDS) + { + wallpaperGfx = &gWallpaperTable[wallpaperId]; + LZ77UnCompWram(wallpaperGfx->tileMap, gUnknown_02039D08->field_792); + sub_80CCA3C(gUnknown_02039D08->field_792, gUnknown_02039D08->field_6FB, gUnknown_02039D08->field_2D2); + + if (gUnknown_02039D08->field_6FB != 0) + LoadPalette(wallpaperGfx->palettes, (gUnknown_02039D08->field_2D2 * 32) + 0x40, 0x40); + else + CpuCopy16(wallpaperGfx->palettes, &gPlttBufferUnfaded[(gUnknown_02039D08->field_2D2 * 32) + 0x40], 0x40); + + gUnknown_02039D08->wallpaperTiles = malloc_and_decompress(wallpaperGfx->tiles, &size1); + LoadBgTiles(2, gUnknown_02039D08->wallpaperTiles, size1, gUnknown_02039D08->field_2D2 << 8); + } + else + { + wallpaperGfx = &gFriendsWallpaperTable[GetWaldaWallpaperPatternId()]; + LZ77UnCompWram(wallpaperGfx->tileMap, gUnknown_02039D08->field_792); + sub_80CCA3C(gUnknown_02039D08->field_792, gUnknown_02039D08->field_6FB, gUnknown_02039D08->field_2D2); + + CpuCopy16(wallpaperGfx->palettes, gUnknown_02039D08->field_792, 0x40); + CpuCopy16(GetWaldaWallpaperColorsPtr(), &gUnknown_02039D08->field_792[1], 4); + CpuCopy16(GetWaldaWallpaperColorsPtr(), &gUnknown_02039D08->field_792[17], 4); + + if (gUnknown_02039D08->field_6FB != 0) + LoadPalette(gUnknown_02039D08->field_792, (gUnknown_02039D08->field_2D2 * 32) + 0x40, 0x40); + else + CpuCopy16(gUnknown_02039D08->field_792, &gPlttBufferUnfaded[(gUnknown_02039D08->field_2D2 * 32) + 0x40], 0x40); + + gUnknown_02039D08->wallpaperTiles = malloc_and_decompress(wallpaperGfx->tiles, &size1); + iconGfx = malloc_and_decompress(gFriendsIcons[GetWaldaWallpaperIconId()], &size2); + CpuCopy32(iconGfx, gUnknown_02039D08->wallpaperTiles + 0x800, size2); + Free(iconGfx); + LoadBgTiles(2, gUnknown_02039D08->wallpaperTiles, size1, gUnknown_02039D08->field_2D2 << 8); + } + + CopyBgTilemapBufferToVram(2); +} + +bool32 WaitForWallpaperGfxLoad(void) +{ + if (IsDma3ManagerBusyWithBgCopy()) + return FALSE; + + if (gUnknown_02039D08->wallpaperTiles != NULL) + { + Free(gUnknown_02039D08->wallpaperTiles); + gUnknown_02039D08->wallpaperTiles = NULL; + } + return TRUE; +} + +void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2) +{ + s16 var = (arg2 * 2) + 3; + s16 x = ((gUnknown_02039D08->bg2_X / 8 + 10) + (direction * 24)) & 0x3F; + + CopyRectToBgTilemapBufferRect(2, tilemap, 0, 0, 0x14, 0x12, x, 2, 0x14, 0x12, 0x11, arg2 << 8, var); + + if (direction == 0) + return; + else if (direction > 0) + x *= 1, x += 0x14; // x * 1 is needed to match, but can be safely removed as it makes no functional difference + else + x -= 4; + + FillBgTilemapBufferRect(2, 0, x, 2, 4, 0x12, 0x11); +} + +void sub_80CCAE0(void *arg0) +{ + u16 i; + u16 *dest = arg0; + s16 r3 = ((gUnknown_02039D08->bg2_X / 8) + 30) & 0x3F; + + if (r3 <= 31) + dest += r3 + 0x260; + else + dest += r3 + 0x640; + + for (i = 0; i < 0x2C; i++) + { + *dest++ = 0; + r3 = (r3 + 1) & 0x3F; + if (r3 == 0) + dest -= 0x420; + if (r3 == 0x20) + dest += 0x3e0; + } +} + +void sub_80CCB50(u8 boxId) +{ + u8 tagIndex; + s16 r6; + u16 i; + + struct SpriteSheet spriteSheet = {gUnknown_02039D08->field_2F8, 0x200, TAG_TILE_3}; + struct SpritePalette palettes[] = { + {gUnknown_02039D08->field_6FC, TAG_PAL_DAC9}, + {} + }; + + u16 wallpaperId = GetBoxWallpaper(boxId); + + gUnknown_02039D08->field_6FC[14] = gUnknown_08577574[wallpaperId][0]; + gUnknown_02039D08->field_6FC[15] = gUnknown_08577574[wallpaperId][1]; + LoadSpritePalettes(palettes); + gUnknown_02039D08->field_738 = 0x3f0; + + tagIndex = IndexOfSpritePaletteTag(TAG_PAL_DAC9); + gUnknown_02039D08->field_71C = 0x10e + 16 * tagIndex; + gUnknown_02039D08->field_738 |= 0x10000 << tagIndex; + + tagIndex = IndexOfSpritePaletteTag(TAG_PAL_DAC9); + gUnknown_02039D08->field_71E = 0x10e + 16 * tagIndex; + gUnknown_02039D08->field_738 |= 0x10000 << tagIndex; + + StringCopyPadded(gUnknown_02039D08->field_21B8, GetBoxNamePtr(boxId), 0, 8); + sub_80C6D80(gUnknown_02039D08->field_21B8, gUnknown_02039D08->field_2F8, 0, 0, 2); + LoadSpriteSheet(&spriteSheet); + r6 = sub_80CD00C(GetBoxNamePtr(boxId)); + + for (i = 0; i < 2; i++) + { + u8 spriteId = CreateSprite(&gSpriteTemplate_857B0A8, r6 + i * 32, 28, 24); + gUnknown_02039D08->field_720[i] = &gSprites[spriteId]; + StartSpriteAnim(gUnknown_02039D08->field_720[i], i); + } + gUnknown_02039D08->field_6F8 = 0; +} + +void sub_80CCCFC(u8 boxId, s8 direction) +{ + u16 r8; + s16 x, x2; + u16 i; + struct SpriteSheet spriteSheet = {gUnknown_02039D08->field_2F8, 0x200, TAG_TILE_3}; + struct SpriteTemplate template = gSpriteTemplate_857B0A8; + + gUnknown_02039D08->field_6F8 = (gUnknown_02039D08->field_6F8 == 0); + if (gUnknown_02039D08->field_6F8 == 0) + { + spriteSheet.tag = TAG_TILE_3; + r8 = gUnknown_02039D08->field_71C; + } + else + { + spriteSheet.tag = TAG_TILE_4; + r8 = gUnknown_02039D08->field_71C; + template.tileTag = 4; + template.paletteTag = TAG_PAL_DAC9; + } + + StringCopyPadded(gUnknown_02039D08->field_21B8, GetBoxNamePtr(boxId), 0, 8); + sub_80C6D80(gUnknown_02039D08->field_21B8, gUnknown_02039D08->field_2F8, 0, 0, 2); + LoadSpriteSheet(&spriteSheet); + LoadPalette(gUnknown_08577574[GetBoxWallpaper(boxId)], r8, 4); + x = sub_80CD00C(GetBoxNamePtr(boxId)); + x2 = x; + x2 += direction * 192; + + for (i = 0; i < 2; i++) + { + u8 spriteId = CreateSprite(&template, i * 32 + x2, 28, 24); + + gUnknown_02039D08->field_728[i] = &gSprites[spriteId]; + gUnknown_02039D08->field_728[i]->data[0] = (-direction) * 6; + gUnknown_02039D08->field_728[i]->data[1] = i * 32 + x; + gUnknown_02039D08->field_728[i]->data[2] = 0; + gUnknown_02039D08->field_728[i]->callback = sub_80CCF30; + StartSpriteAnim(gUnknown_02039D08->field_728[i], i); + + gUnknown_02039D08->field_720[i]->data[0] = (-direction) * 6; + gUnknown_02039D08->field_720[i]->data[1] = 1; + gUnknown_02039D08->field_720[i]->callback = sub_80CCF64; + } +} + +void sub_80CCEE0(void) +{ + if (gUnknown_02039D08->field_6F8 == 0) + FreeSpriteTilesByTag(TAG_TILE_4); + else + FreeSpriteTilesByTag(TAG_TILE_3); + + gUnknown_02039D08->field_720[0] = gUnknown_02039D08->field_728[0]; + gUnknown_02039D08->field_720[1] = gUnknown_02039D08->field_728[1]; +} + +void sub_80CCF30(struct Sprite *sprite) +{ + if (sprite->data[2] != 0) + sprite->data[2]--; + else if ((sprite->pos1.x += sprite->data[0]) == sprite->data[1]) + sprite->callback = SpriteCallbackDummy; +} + +void sub_80CCF64(struct Sprite *sprite) +{ + if (sprite->data[1] != 0) + { + sprite->data[1]--; + } + else + { + sprite->pos1.x += sprite->data[0]; + sprite->data[2] = sprite->pos1.x + sprite->pos2.x; + if (sprite->data[2] < 0x40 || sprite->data[2] > 0x100) + DestroySprite(sprite); + } +} + +void sub_80CCF9C(void) +{ + u8 boxId = StorageGetCurrentBox(); + u8 wallpaperId = GetBoxWallpaper(boxId); + if (gUnknown_02039D08->field_6F8 == 0) + CpuCopy16(gUnknown_08577574[wallpaperId], gPlttBufferUnfaded + gUnknown_02039D08->field_71C, 4); + else + CpuCopy16(gUnknown_08577574[wallpaperId], gPlttBufferUnfaded + gUnknown_02039D08->field_71E, 4); +} + +s16 sub_80CD00C(const u8 *string) +{ + return 0xB0 - GetStringWidth(1, string, 0) / 2; +} + +void sub_80CD02C(void) +{ + u16 i; + + LoadSpriteSheet(&gUnknown_0857B080); + for (i = 0; i < 2; i++) + { + u8 spriteId = CreateSprite(&gUnknown_0857B0E0, 0x5c + i * 0x88, 28, 22); + if (spriteId != MAX_SPRITES) + { + struct Sprite *sprite = &gSprites[spriteId]; + StartSpriteAnim(sprite, i); + sprite->data[3] = (i == 0) ? -1 : 1; + gUnknown_02039D08->field_730[i] = sprite; + } + } + if (IsCursorOnBox()) + sub_80CD1A8(TRUE); +} + +void sub_80CD0B8(s8 direction) +{ + u16 i; + + for (i = 0; i < 2; i++) + { + gUnknown_02039D08->field_730[i]->pos2.x = 0; + gUnknown_02039D08->field_730[i]->data[0] = 2; + } + if (direction < 0) + { + gUnknown_02039D08->field_730[0]->data[1] = 29; + gUnknown_02039D08->field_730[1]->data[1] = 5; + gUnknown_02039D08->field_730[0]->data[2] = 0x48; + gUnknown_02039D08->field_730[1]->data[2] = 0x48; + } + else + { + gUnknown_02039D08->field_730[0]->data[1] = 5; + gUnknown_02039D08->field_730[1]->data[1] = 29; + gUnknown_02039D08->field_730[0]->data[2] = 0xF8; + gUnknown_02039D08->field_730[1]->data[2] = 0xF8; + } + gUnknown_02039D08->field_730[0]->data[7] = 0; + gUnknown_02039D08->field_730[1]->data[7] = 1; +} + +void sub_80CD158(void) +{ + u16 i; + + for (i = 0; i < 2; i++) + { + gUnknown_02039D08->field_730[i]->pos1.x = 0x88 * i + 0x5c; + gUnknown_02039D08->field_730[i]->pos2.x = 0; + gUnknown_02039D08->field_730[i]->invisible = FALSE; + } + sub_80CD1A8(TRUE); +} + +void sub_80CD1A8(bool8 a0) +{ + u16 i; + + if (a0) + { + for (i = 0; i < 2; i++) + { + gUnknown_02039D08->field_730[i]->data[0] = 1; + gUnknown_02039D08->field_730[i]->data[1] = 0; + gUnknown_02039D08->field_730[i]->data[2] = 0; + gUnknown_02039D08->field_730[i]->data[4] = 0; + } + } + else + { + for (i = 0; i < 2; i++) + { + gUnknown_02039D08->field_730[i]->data[0] = 0; + } + } +} + +void sub_80CD210(struct Sprite *sprite) +{ + switch (sprite->data[0]) + { + case 0: + sprite->pos2.x = 0; + break; + case 1: + if (++sprite->data[1] > 3) + { + sprite->data[1] = 0; + sprite->pos2.x += sprite->data[3]; + if (++sprite->data[2] > 5) + { + sprite->data[2] = 0; + sprite->pos2.x = 0; + } + } + break; + case 2: + sprite->data[0] = 3; + break; + case 3: + sprite->pos1.x -= gUnknown_02039D08->field_2CE; + if (sprite->pos1.x < 0x49 || sprite->pos1.x > 0xf7) + sprite->invisible = TRUE; + if (--sprite->data[1] == 0) + { + sprite->pos1.x = sprite->data[2]; + sprite->invisible = FALSE; + sprite->data[0] = 4; + } + break; + case 4: + sprite->pos1.x -= gUnknown_02039D08->field_2CE; + break; + } +} + +struct Sprite *sub_80CD2E8(u16 x, u16 y, u8 animId, u8 priority, u8 subpriority) +{ + u8 spriteId = CreateSprite(&gUnknown_0857B0E0, x, y, subpriority); + if (spriteId == MAX_SPRITES) + return NULL; + + animId %= 2; + StartSpriteAnim(&gSprites[spriteId], animId); + gSprites[spriteId].oam.priority = priority; + gSprites[spriteId].callback = SpriteCallbackDummy; + return &gSprites[spriteId]; +} + +void sub_80CD36C(void) +{ + if (gUnknown_02039D08->boxOption != BOX_OPTION_DEPOSIT) + sBoxCursorArea = CURSOR_AREA_IN_BOX; + else + sBoxCursorArea = CURSOR_AREA_IN_PARTY; + + sBoxCursorPosition = 0; + sIsMonBeingMoved = FALSE; + sMovingMonOrigBoxId = 0; + sMovingMonOrigBoxPos = 0; + sCanOnlyMove = FALSE; + sub_80CDC0C(); + sub_80CFC14(); + gUnknown_02039D08->field_CD6 = 1; + gUnknown_02039D08->field_21FF = 0; + sub_80CEB40(); +} + +void sub_80CD3EC(void) +{ + sub_80CFC14(); + sub_80CEBDC(); + gUnknown_02039D08->field_CD6 = 1; + gUnknown_02039D08->field_21FF = 0; + if (sIsMonBeingMoved) + { + gUnknown_02039D08->field_20A4 = gUnknown_02039D14; + sub_80CAFC4(); + } +} + +void sub_80CD444(u8 a0, u8 a1, u16 *a2, u16 *a3) +{ + switch (a0) + { + case 0: + *a2 = (a1 % 6) * 24 + 100; + *a3 = (a1 / 6) * 24 + 32; + break; + case 1: + if (a1 == 0) + { + *a2 = 0x68; + *a3 = 0x34; + } + else if (a1 == 6) + { + *a2 = 0x98; + *a3 = 0x84; + } + else + { + *a2 = 0x98; + *a3 = (a1 - 1) * 24 + 4; + } + break; + case 2: + *a2 = 0xa2; + *a3 = 0x0c; + break; + case 3: + *a3 = sIsMonBeingMoved ? 8 : 14; + *a2 = a1 * 0x58 + 0x78; + break; + case 4: + *a2 = 0xa0; + *a3 = 0x60; + break; + } +} + +u16 sub_80CD504(void) +{ + switch (sBoxCursorArea) + { + case CURSOR_AREA_IN_PARTY: + return GetMonData(&gPlayerParty[sBoxCursorPosition], MON_DATA_SPECIES); + case CURSOR_AREA_IN_BOX: + return GetCurrentBoxMonData(sBoxCursorPosition, MON_DATA_SPECIES); + default: + return SPECIES_NONE; + } +} + +bool8 sub_80CD554(void) +{ + s16 tmp; + + if (gUnknown_02039D08->field_CD0 == 0) + { + if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + return FALSE; + else + return sub_80D1218(); + } + else if (--gUnknown_02039D08->field_CD0 != 0) + { + gUnknown_02039D08->field_CBC += gUnknown_02039D08->field_CC4; + gUnknown_02039D08->field_CC0 += gUnknown_02039D08->field_CC8; + gUnknown_02039D08->field_CB4->pos1.x = gUnknown_02039D08->field_CBC >> 8; + gUnknown_02039D08->field_CB4->pos1.y = gUnknown_02039D08->field_CC0 >> 8; + if (gUnknown_02039D08->field_CB4->pos1.x > 0x100) + { + tmp = gUnknown_02039D08->field_CB4->pos1.x - 0x100; + gUnknown_02039D08->field_CB4->pos1.x = tmp + 0x40; + } + if (gUnknown_02039D08->field_CB4->pos1.x < 0x40) + { + tmp = 0x40 - gUnknown_02039D08->field_CB4->pos1.x; + gUnknown_02039D08->field_CB4->pos1.x = 0x100 - tmp; + } + if (gUnknown_02039D08->field_CB4->pos1.y > 0xb0) + { + tmp = gUnknown_02039D08->field_CB4->pos1.y - 0xb0; + gUnknown_02039D08->field_CB4->pos1.y = tmp - 0x10; + } + if (gUnknown_02039D08->field_CB4->pos1.y < -0x10) + { + tmp = -0x10 - gUnknown_02039D08->field_CB4->pos1.y; + gUnknown_02039D08->field_CB4->pos1.y = 0xb0 - tmp; + } + if (gUnknown_02039D08->field_CD7 && --gUnknown_02039D08->field_CD7 == 0) + gUnknown_02039D08->field_CB4->vFlip = (gUnknown_02039D08->field_CB4->vFlip == FALSE); + } + else + { + gUnknown_02039D08->field_CB4->pos1.x = gUnknown_02039D08->field_CCC; + gUnknown_02039D08->field_CB4->pos1.y = gUnknown_02039D08->field_CCE; + sub_80CDA68(); + } + + return TRUE; +} + +void sub_80CD6AC(u8 a0, u8 a1) +{ + u16 x, y; + + sub_80CD444(a0, a1, &x, &y); + gUnknown_02039D08->field_CD4 = a0; + gUnknown_02039D08->field_CD5 = a1; + gUnknown_02039D08->field_CCC = x; + gUnknown_02039D08->field_CCE = y; +} + +void sub_80CD70C(void) +{ + int r7, r0; + + if (gUnknown_02039D08->field_CD2 != 0 || gUnknown_02039D08->field_CD3 != 0) + gUnknown_02039D08->field_CD0 = 12; + else + gUnknown_02039D08->field_CD0 = 6; + + if (gUnknown_02039D08->field_CD7) + gUnknown_02039D08->field_CD7 = gUnknown_02039D08->field_CD0 >> 1; + + switch (gUnknown_02039D08->field_CD2) + { + default: + r7 = gUnknown_02039D08->field_CCE - gUnknown_02039D08->field_CB4->pos1.y; + break; + case -1: + r7 = gUnknown_02039D08->field_CCE - 0xc0 - gUnknown_02039D08->field_CB4->pos1.y; + break; + case 1: + r7 = gUnknown_02039D08->field_CCE + 0xc0 - gUnknown_02039D08->field_CB4->pos1.y; + break; + } + + switch (gUnknown_02039D08->field_CD3) + { + default: + r0 = gUnknown_02039D08->field_CCC - gUnknown_02039D08->field_CB4->pos1.x; + break; + case -1: + r0 = gUnknown_02039D08->field_CCC - 0xc0 - gUnknown_02039D08->field_CB4->pos1.x; + break; + case 1: + r0 = gUnknown_02039D08->field_CCC + 0xc0 - gUnknown_02039D08->field_CB4->pos1.x; + break; + } + + r7 <<= 8; + r0 <<= 8; + gUnknown_02039D08->field_CC4 = r0 / gUnknown_02039D08->field_CD0; + gUnknown_02039D08->field_CC8 = r7 / gUnknown_02039D08->field_CD0; + gUnknown_02039D08->field_CBC = gUnknown_02039D08->field_CB4->pos1.x << 8; + gUnknown_02039D08->field_CC0 = gUnknown_02039D08->field_CB4->pos1.y << 8; +} + +void sub_80CD894(u8 a0, u8 a1) +{ + sub_80CD6AC(a0, a1); + sub_80CD70C(); + if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + { + if (gUnknown_02039D08->field_21FF == 0 && !sIsMonBeingMoved) + StartSpriteAnim(gUnknown_02039D08->field_CB4, 1); + } + else + { + if (!sub_80D127C()) + StartSpriteAnim(gUnknown_02039D08->field_CB4, 1); + } + + if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + { + if (sBoxCursorArea == CURSOR_AREA_IN_BOX) + sub_80D0E50(0, sBoxCursorPosition); + else if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) + sub_80D0E50(1, sBoxCursorPosition); + + if (a0 == 0) + sub_80D0D8C(0, a1); + else if (a0 == 1) + sub_80D0D8C(1, a1); + } + + if (a0 == 1 && sBoxCursorArea != CURSOR_AREA_IN_PARTY) + { + gUnknown_02039D08->field_CD6 = a0; + gUnknown_02039D08->field_CB8->invisible = TRUE; + } + + switch (a0) + { + case 1 ... 3: + gUnknown_02039D08->field_CB4->oam.priority = 1; + gUnknown_02039D08->field_CB8->invisible = TRUE; + gUnknown_02039D08->field_CB8->oam.priority = 1; + break; + case 0: + if (gUnknown_02039D08->field_21FF != 0) + { + gUnknown_02039D08->field_CB4->oam.priority = 0; + gUnknown_02039D08->field_CB8->invisible = TRUE; + } + else + { + gUnknown_02039D08->field_CB4->oam.priority = 2; + if (sBoxCursorArea == CURSOR_AREA_IN_BOX && sIsMonBeingMoved) + sub_80CC0D4(2); + } + break; + } +} + +void sub_80CDA68(void) +{ + sBoxCursorArea = gUnknown_02039D08->field_CD4; + sBoxCursorPosition = gUnknown_02039D08->field_CD5; + if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + { + if (gUnknown_02039D08->field_21FF == 0 && !sIsMonBeingMoved) + StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); + } + else + { + if (!sub_80D127C()) + StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); + } + + sub_80CEB40(); + switch (sBoxCursorArea) + { + case CURSOR_AREA_BUTTONS: + sub_80CC0D4(1); + break; + case CURSOR_AREA_BOX: + sub_80CD1A8(TRUE); + break; + case CURSOR_AREA_IN_PARTY: + gUnknown_02039D08->field_CB8->subpriority = 13; + sub_80CC0D4(1); + break; + case CURSOR_AREA_IN_BOX: + if (gUnknown_02039D08->field_21FF == 0) + { + gUnknown_02039D08->field_CB4->oam.priority = 1; + gUnknown_02039D08->field_CB8->oam.priority = 2; + gUnknown_02039D08->field_CB8->subpriority = 21; + gUnknown_02039D08->field_CB8->invisible = FALSE; + sub_80CC0D4(2); + } + break; + } +} + +void sub_80CDBA0(void) +{ + u8 partyCount; + + if (!sIsMonBeingMoved) + { + partyCount = 0; + } + else + { + partyCount = CalculatePlayerPartyCount(); + if (partyCount >= PARTY_SIZE) + partyCount = PARTY_SIZE - 1; + } + if (gUnknown_02039D08->field_CB4->vFlip) + gUnknown_02039D08->field_CD7 = 1; + sub_80CD894(1, partyCount); +} + +void sub_80CDBF8(u8 a0) +{ + sub_80CD894(0, a0); +} + +void sub_80CDC0C(void) +{ + gUnknown_02039D7E = 0; +} + +void sub_80CDC18(void) +{ + gUnknown_02039D7E = sBoxCursorPosition; +} + +u8 sub_80CDC2C(void) +{ + return gUnknown_02039D7E; +} + +void InitMonPlaceChange(u8 a0) +{ + gUnknown_02039D08->monPlaceChangeFunc = gUnknown_0857B998[a0]; + gUnknown_02039D08->monPlaceChangeState = 0; +} + +void sub_80CDC64(bool8 arg0) +{ + if (!arg0) + gUnknown_02039D08->monPlaceChangeFunc = sub_80CDEB4; + else + gUnknown_02039D08->monPlaceChangeFunc = sub_80CDEC4; + + gUnknown_02039D08->monPlaceChangeState = 0; +} + +bool8 DoMonPlaceChange(void) +{ + return gUnknown_02039D08->monPlaceChangeFunc(); +} + +bool8 MonPlaceChange_Move(void) +{ + switch (gUnknown_02039D08->monPlaceChangeState) + { + case 0: + if (sIsMonBeingMoved) + return FALSE; + StartSpriteAnim(gUnknown_02039D08->field_CB4, 2); + gUnknown_02039D08->monPlaceChangeState++; + break; + case 1: + if (!sub_80CDED4()) + { + StartSpriteAnim(gUnknown_02039D08->field_CB4, 3); + MoveMon(); + gUnknown_02039D08->monPlaceChangeState++; + } + break; + case 2: + if (!sub_80CDF08()) + gUnknown_02039D08->monPlaceChangeState++; + break; + case 3: + return FALSE; + } + + return TRUE; +} + +bool8 MonPlaceChange_Place(void) +{ + switch (gUnknown_02039D08->monPlaceChangeState) + { + case 0: + if (!sub_80CDED4()) + { + StartSpriteAnim(gUnknown_02039D08->field_CB4, 2); + PlaceMon(); + gUnknown_02039D08->monPlaceChangeState++; + } + break; + case 1: + if (!sub_80CDF08()) + { + StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); + gUnknown_02039D08->monPlaceChangeState++; + } + break; + case 2: + return FALSE; + } + + return TRUE; +} + +bool8 MonPlaceChange_Shift(void) +{ + switch (gUnknown_02039D08->monPlaceChangeState) + { + case 0: + switch (sBoxCursorArea) + { + case CURSOR_AREA_IN_PARTY: + gUnknown_02039D08->field_D91 = TOTAL_BOXES_COUNT; + break; + case CURSOR_AREA_IN_BOX: + gUnknown_02039D08->field_D91 = StorageGetCurrentBox(); + break; + default: + return FALSE; + } + StartSpriteAnim(gUnknown_02039D08->field_CB4, 2); + sub_80CBD5C(gUnknown_02039D08->field_D91, sBoxCursorPosition); + gUnknown_02039D08->monPlaceChangeState++; + break; + case 1: + if (!sub_80CBDC4()) + { + StartSpriteAnim(gUnknown_02039D08->field_CB4, 3); + SetShiftedMonData(gUnknown_02039D08->field_D91, sBoxCursorPosition); + gUnknown_02039D08->monPlaceChangeState++; + } + break; + case 2: + return FALSE; + } + + return TRUE; +} + +bool8 sub_80CDEB4(void) +{ + return sub_80CDED4(); +} + +bool8 sub_80CDEC4(void) +{ + return sub_80CDF08(); +} + +bool8 sub_80CDED4(void) +{ + switch (gUnknown_02039D08->field_CB4->pos2.y) + { + default: + gUnknown_02039D08->field_CB4->pos2.y++; + break; + case 0: + gUnknown_02039D08->field_CB4->pos2.y++; + break; + case 8: + return FALSE; + } + + return TRUE; +} + +bool8 sub_80CDF08(void) +{ + switch (gUnknown_02039D08->field_CB4->pos2.y) + { + case 0: + return FALSE; + default: + gUnknown_02039D08->field_CB4->pos2.y--; + break; + } + + return TRUE; +} + +void MoveMon(void) +{ + switch (sBoxCursorArea) + { + case CURSOR_AREA_IN_PARTY: + SetMovedMonData(TOTAL_BOXES_COUNT, sBoxCursorPosition); + sub_80CBC14(MODE_PARTY, sBoxCursorPosition); + break; + case CURSOR_AREA_IN_BOX: + if (gUnknown_02039D08->field_21FF == 0) + { + SetMovedMonData(StorageGetCurrentBox(), sBoxCursorPosition); + sub_80CBC14(MODE_BOX, sBoxCursorPosition); + } + break; + default: + return; + } + + sIsMonBeingMoved = TRUE; +} + +void PlaceMon(void) +{ + u8 boxId; + + switch (sBoxCursorArea) + { + case CURSOR_AREA_IN_PARTY: + SetPlacedMonData(TOTAL_BOXES_COUNT, sBoxCursorPosition); + sub_80CBCAC(TOTAL_BOXES_COUNT, sBoxCursorPosition); + break; + case CURSOR_AREA_IN_BOX: + boxId = StorageGetCurrentBox(); + SetPlacedMonData(boxId, sBoxCursorPosition); + sub_80CBCAC(boxId, sBoxCursorPosition); + break; + default: + return; + } + + sIsMonBeingMoved = FALSE; +} + +void sub_80CE00C(void) +{ + sub_80CEB40(); +} + +void SetMovedMonData(u8 boxId, u8 position) +{ + if (boxId == TOTAL_BOXES_COUNT) + gUnknown_02039D08->field_20A4 = gPlayerParty[sBoxCursorPosition]; + else + BoxMonAtToMon(boxId, position, &gUnknown_02039D08->field_20A4); + + PurgeMonOrBoxMon(boxId, position); + sMovingMonOrigBoxId = boxId; + sMovingMonOrigBoxPos = position; +} + +void SetPlacedMonData(u8 boxId, u8 position) +{ + if (boxId == TOTAL_BOXES_COUNT) + { + gPlayerParty[position] = gUnknown_02039D08->field_20A4; + } + else + { + BoxMonRestorePP(&gUnknown_02039D08->field_20A4.box); + SetBoxMonAt(boxId, position, &gUnknown_02039D08->field_20A4.box); + } +} + +void PurgeMonOrBoxMon(u8 boxId, u8 position) +{ + if (boxId == TOTAL_BOXES_COUNT) + ZeroMonData(&gPlayerParty[position]); + else + ZeroBoxMonAt(boxId, position); +} + +void SetShiftedMonData(u8 boxId, u8 position) +{ + if (boxId == TOTAL_BOXES_COUNT) + gUnknown_02039D08->field_2108 = gPlayerParty[position]; + else + BoxMonAtToMon(boxId, position, &gUnknown_02039D08->field_2108); + + SetPlacedMonData(boxId, position); + gUnknown_02039D08->field_20A4 = gUnknown_02039D08->field_2108; + sub_80CEC00(&gUnknown_02039D08->field_20A4, 0); + sMovingMonOrigBoxId = boxId; + sMovingMonOrigBoxPos = position; +} + +bool8 TryStorePartyMonInBox(u8 boxId) +{ + s16 boxPosition = GetFirstFreeBoxSpot(boxId); + if (boxPosition == -1) + return FALSE; + + if (sIsMonBeingMoved) + { + SetPlacedMonData(boxId, boxPosition); + sub_80CBAC4(); + sIsMonBeingMoved = FALSE; + } + else + { + SetMovedMonData(TOTAL_BOXES_COUNT, sBoxCursorPosition); + SetPlacedMonData(boxId, boxPosition); + DestroyPartyMonIcon(sBoxCursorPosition); + } + + if (boxId == StorageGetCurrentBox()) + sub_80CB140(boxPosition); + + StartSpriteAnim(gUnknown_02039D08->field_CB4, 1); + return TRUE; +} + +void sub_80CE22C(void) +{ + StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); + sub_80CEB40(); +} + +void sub_80CE250(void) +{ + u8 mode; + + if (sIsMonBeingMoved) + mode = MODE_2; + else if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) + mode = MODE_PARTY; + else + mode = MODE_BOX; + + sub_80CBF14(mode, sBoxCursorPosition); + StringCopy(gUnknown_02039D08->field_21E0, gUnknown_02039D08->field_CEE); +} + +bool8 sub_80CE2A8(void) +{ + if (!sub_80CBFD8()) + { + StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); + return FALSE; + } + else + { + return TRUE; + } +} + +void sub_80CE2D8(void) +{ + u8 boxId; + + sub_80CC020(); + if (sIsMonBeingMoved) + { + sIsMonBeingMoved = FALSE; + } + else + { + if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) + boxId = TOTAL_BOXES_COUNT; + else + boxId = StorageGetCurrentBox(); + + PurgeMonOrBoxMon(boxId, sBoxCursorPosition); + } + sub_80CEB40(); +} + +void sub_80CE324(void) +{ + if (sIsMonBeingMoved) + StartSpriteAnim(gUnknown_02039D08->field_CB4, 3); +} + +void sub_80CE350(u16 *moves) +{ + s32 i; + + for (i = 0; i < ARRAY_COUNT(gUnknown_0857B9A4); i++) + { + if (gUnknown_0857B9A4[i].mapGroup == MAP_GROUPS_COUNT + || (gUnknown_0857B9A4[i].mapGroup == gSaveBlock1Ptr->location.mapGroup && gUnknown_0857B9A4[i].mapNum == gSaveBlock1Ptr->location.mapNum)) + { + *moves = gUnknown_0857B9A4[i].move; + moves++; + } + } + + *moves = MOVES_COUNT; +} + +void sub_80CE3A0(void) +{ + if (!AtLeastThreeUsableMons()) + { + gUnknown_02039D08->field_216D = 1; + gUnknown_02039D08->field_216C = 0; + return; + } + + if (sIsMonBeingMoved) + { + gUnknown_02039D08->field_2108 = gUnknown_02039D08->field_20A4; + gUnknown_02039D08->field_2170 = -1; + gUnknown_02039D08->field_2171 = -1; + } + else + { + if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) + { + gUnknown_02039D08->field_2108 = gPlayerParty[sBoxCursorPosition]; + gUnknown_02039D08->field_2170 = TOTAL_BOXES_COUNT; + } + else + { + BoxMonAtToMon(StorageGetCurrentBox(), sBoxCursorPosition, &gUnknown_02039D08->field_2108); + gUnknown_02039D08->field_2170 = StorageGetCurrentBox(); + } + gUnknown_02039D08->field_2171 = sBoxCursorPosition; + } + + sub_80CE350(gUnknown_02039D08->field_2176); + gUnknown_02039D08->field_2174 = GetMonData(&gUnknown_02039D08->field_2108, MON_DATA_KNOWN_MOVES, gUnknown_02039D08->field_2176); + if (gUnknown_02039D08->field_2174 != 0) + { + gUnknown_02039D08->field_216D = 0; + } + else + { + gUnknown_02039D08->field_216D = 1; + gUnknown_02039D08->field_216C = 1; + } + + gUnknown_02039D08->field_2172 = 0; +} + +bool32 AtLeastThreeUsableMons(void) +{ + s32 i, j, count; + + count = (sIsMonBeingMoved != FALSE); + for (j = 0; j < PARTY_SIZE; j++) + { + if (GetMonData(&gPlayerParty[j], MON_DATA_SANITY_HAS_SPECIES)) + count++; + } + + if (count >= 3) + return TRUE; + + for (i = 0; i < TOTAL_BOXES_COUNT; i++) + { + for (j = 0; j < IN_BOX_COUNT; j++) + { + if (CheckBoxedMonSanity(i, j)) + { + if (++count >= 3) + return TRUE; + } + } + } + + return FALSE; +} + +s8 sub_80CE580(void) +{ + u16 i; + u16 knownMoves; + + if (gUnknown_02039D08->field_216D) + return gUnknown_02039D08->field_216C; + + switch (gUnknown_02039D08->field_2172) + { + case 0: + for (i = 0; i < PARTY_SIZE; i++) + { + if (gUnknown_02039D08->field_2170 != TOTAL_BOXES_COUNT || gUnknown_02039D08->field_2171 != i) + { + knownMoves = GetMonData(gPlayerParty + i, MON_DATA_KNOWN_MOVES, gUnknown_02039D08->field_2176); + gUnknown_02039D08->field_2174 &= ~(knownMoves); + } + } + if (gUnknown_02039D08->field_2174 == 0) + { + gUnknown_02039D08->field_216D = 1; + gUnknown_02039D08->field_216C = 1; + } + else + { + gUnknown_02039D08->field_216E = 0; + gUnknown_02039D08->field_216F = 0; + gUnknown_02039D08->field_2172++; + } + break; + case 1: + for (i = 0; i < IN_BOX_COUNT; i++) + { + knownMoves = GetAndCopyBoxMonDataAt(gUnknown_02039D08->field_216E, gUnknown_02039D08->field_216F, MON_DATA_KNOWN_MOVES, gUnknown_02039D08->field_2176); + if (knownMoves != 0 + && !(gUnknown_02039D08->field_2170 == gUnknown_02039D08->field_216E && gUnknown_02039D08->field_2171 == gUnknown_02039D08->field_216F)) + { + gUnknown_02039D08->field_2174 &= ~(knownMoves); + if (gUnknown_02039D08->field_2174 == 0) + { + gUnknown_02039D08->field_216D = 1; + gUnknown_02039D08->field_216C = 1; + break; + } + } + if (++gUnknown_02039D08->field_216F >= IN_BOX_COUNT) + { + gUnknown_02039D08->field_216F = 0; + if (++gUnknown_02039D08->field_216E >= TOTAL_BOXES_COUNT) + { + gUnknown_02039D08->field_216D = 1; + gUnknown_02039D08->field_216C = 0; + } + } + } + break; + } + + return -1; +} diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 48ba864f7..03a081af5 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1310,7 +1310,7 @@ static bool8 ExtractMonDataToSummaryStruct(struct Pokemon *a) sum->altAbility = GetMonData(a, MON_DATA_ALT_ABILITY); sum->item = GetMonData(a, MON_DATA_HELD_ITEM); sum->pid = GetMonData(a, MON_DATA_PERSONALITY); - sum->sanity = GetMonData(a, MON_DATA_SANITY_BIT1); + sum->sanity = GetMonData(a, MON_DATA_SANITY_IS_BAD_EGG); if (sum->sanity) sum->isEgg = TRUE; diff --git a/src/post_battle_event_funcs.c b/src/post_battle_event_funcs.c index 934972b7c..fe5e1089e 100644 --- a/src/post_battle_event_funcs.c +++ b/src/post_battle_event_funcs.c @@ -50,8 +50,8 @@ int GameClear(void) ribbonCounts[i].partyIndex = i; ribbonCounts[i].count = 0; - if (GetMonData(mon, MON_DATA_SANITY_BIT2) - && !GetMonData(mon, MON_DATA_SANITY_BIT3) + if (GetMonData(mon, MON_DATA_SANITY_HAS_SPECIES) + && !GetMonData(mon, MON_DATA_SANITY_IS_EGG) && !GetMonData(mon, MON_DATA_CHAMPION_RIBBON)) { u8 val[1] = {TRUE}; diff --git a/src/text.c b/src/text.c index 07c15596e..39e412633 100644 --- a/src/text.c +++ b/src/text.c @@ -1858,7 +1858,7 @@ u32 (*GetFontWidthFunc(u8 glyphId))(u16, bool32) return NULL; } -u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing) +s32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing) { bool8 isJapanese; int minGlyphWidth; @@ -1868,7 +1868,7 @@ u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing) u32 lineWidth; const u8 *bufferPointer; int glyphWidth; - u32 width; + s32 width; isJapanese = 0; minGlyphWidth = 0; @@ -2028,7 +2028,8 @@ u32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing) if (lineWidth > width) return lineWidth; - return width; + else + return width; } u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str) diff --git a/src/wild_encounter.c b/src/wild_encounter.c index 3a8adaf15..d21f2e1d7 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -4802,7 +4802,7 @@ static u8 ChooseWildMonLevel(const struct WildPokemon *wildPokemon) rand = Random() % range; // check ability for max level mon - if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3)) + if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)) { u8 ability = GetMonAbility(&gPlayerParty[0]); if (ability == ABILITY_HUSTLE || ability == ABILITY_VITAL_SPIRIT || ability == ABILITY_PRESSURE) @@ -4883,7 +4883,7 @@ static u8 PickWildMonNature(void) } } // check synchronize for a pokemon with the same ability - if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3) + if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG) && GetMonAbility(&gPlayerParty[0]) == ABILITY_SYNCHRONIZE && Random() % 2 == 0) { @@ -4911,7 +4911,7 @@ static void CreateWildMon(u16 species, u8 level) } if (checkCuteCharm - && !GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3) + && !GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG) && GetMonAbility(&gPlayerParty[0]) == ABILITY_CUTE_CHARM && Random() % 3 != 0) { @@ -5029,7 +5029,7 @@ static bool8 DoWildEncounterRateTest(u32 encounterRate, bool8 ignoreAbility) encounterRate = encounterRate * 80 / 100; ApplyFluteEncounterRateMod(&encounterRate); ApplyCleanseTagEncounterRateMod(&encounterRate); - if (!ignoreAbility && !GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3)) + if (!ignoreAbility && !GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)) { u32 ability = GetMonAbility(&gPlayerParty[0]); @@ -5419,7 +5419,7 @@ static bool8 IsAbilityAllowingEncounter(u8 level) { u8 ability; - if (GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3)) + if (GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)) return TRUE; ability = GetMonAbility(&gPlayerParty[0]); @@ -5456,7 +5456,7 @@ static bool8 TryGetRandomWildMonIndexByType(const struct WildPokemon *wildMon, u static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, u8 type, u8 ability, u8 *monIndex) { - if (GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3)) + if (GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)) return FALSE; else if (GetMonAbility(&gPlayerParty[0]) != ability) return FALSE; diff --git a/sym_ewram.txt b/sym_ewram.txt index f3f654234..57b140a14 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -237,7 +237,7 @@ gUnknown_02039D12: @ 2039D12 gUnknown_02039D14: @ 2039D14 .space 0x64 -sBoxCursorAction: @ 2039D78 +sBoxCursorArea: @ 2039D78 .space 0x1 sBoxCursorPosition: @ 2039D79 From aae36b5653537a063560dc2c7df261cc7b950a4c Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 16 Dec 2018 21:10:01 +0100 Subject: [PATCH 08/13] 6k left --- asm/party_menu.s | 6 +- asm/pokemon_storage_system.s | 3043 -------------------------- asm/rom_8011DC0.s | 2 +- data/pokemon_storage_system.s | 108 - include/menu.h | 6 +- include/pokemon_storage_system.h | 43 +- include/pokemon_summary_screen.h | 2 + include/strings.h | 39 + src/battle_factory_screen.c | 2 - src/battle_pyramid_bag.c | 2 +- src/decoration.c | 4 +- src/item_menu.c | 2 +- src/main_menu.c | 2 +- src/menu.c | 28 +- src/player_pc.c | 4 +- src/pokemon_storage_system.c | 3529 ++++++++++++++++++++++++------ src/script_menu.c | 12 +- src/start_menu.c | 4 +- 18 files changed, 2967 insertions(+), 3871 deletions(-) diff --git a/asm/party_menu.s b/asm/party_menu.s index bbb36b109..27ad74541 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -6700,7 +6700,7 @@ _081B3774: _081B3778: lsls r0, 24 lsrs r4, r0, 24 - bl GetMenuCursorPos + bl Menu_GetCursorPos lsls r0, 24 lsrs r0, 24 strh r0, [r5] @@ -9914,7 +9914,7 @@ sub_81B5470: @ 81B5470 push {r4-r7,lr} lsls r0, 24 lsrs r6, r0, 24 - bl GetMenuCursorPos + bl Menu_GetCursorPos ldr r5, =gUnknown_0203CEC4 ldr r1, [r5] lsls r0, 24 @@ -12639,7 +12639,7 @@ ether_effect_related_2: @ 81B6B80 ldr r0, [r0] adds r0, 0xC bl sub_81B302C - bl GetMenuCursorPos + bl Menu_GetCursorPos ldr r1, =gUnknown_0203CEC8 lsls r0, 24 lsrs r0, 24 diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index b6822eeac..38bb6ce8e 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -7,3049 +7,6 @@ - thumb_func_start sub_80CE760 -sub_80CE760: @ 80CE760 - push {lr} - ldr r0, =sIsMonBeingMoved - 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, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CE7D8 - ldr r0, =sMovingMonOrigBoxId - 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, =sIsMonBeingMoved - 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, =sBoxCursorArea - 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, =sBoxCursorPosition - 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, =sBoxCursorPosition - 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, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CE8F8 - bl sub_80CE790 - b _080CE900 - .pool -_080CE8F8: - ldr r0, =sBoxCursorPosition - 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, =sIsMonBeingMoved - 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, =sBoxCursorArea - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0x1 - bne _080CEA08 - ldr r0, =sBoxCursorPosition - 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, =sBoxCursorPosition - ldrb r0, [r0] - movs r1, 0x8 - mov r2, sp - bl SetCurrentBoxMonData -_080CEA1C: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE9A8 - - thumb_func_start CanMoveMon -CanMoveMon: @ 80CEA30 - push {lr} - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - bne _080CEA64 - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - bne _080CEA64 - ldr r0, =sBoxCursorPosition - 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 CanMoveMon - - thumb_func_start CanShifMon -CanShifMon: @ 80CEA6C - push {lr} - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CEAC8 - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - bne _080CEAAC - ldr r0, =sBoxCursorPosition - 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 CanShifMon - - thumb_func_start IsMonBeingMoved -IsMonBeingMoved: @ 80CEAD0 - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - bx lr - .pool - thumb_func_end IsMonBeingMoved - - thumb_func_start IsCursorOnBox -IsCursorOnBox: @ 80CEADC - push {lr} - movs r1, 0 - ldr r0, =sBoxCursorArea - 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 IsCursorOnBox - - thumb_func_start IsCursorOnCloseBox -IsCursorOnCloseBox: @ 80CEAF8 - push {lr} - movs r1, 0 - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x3 - bne _080CEB16 - ldr r0, =sBoxCursorPosition - 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 IsCursorOnCloseBox - - thumb_func_start IsCursorInBox -IsCursorInBox: @ 80CEB24 - push {lr} - movs r1, 0 - ldr r0, =sBoxCursorArea - 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 IsCursorInBox - - thumb_func_start sub_80CEB40 -sub_80CEB40: @ 80CEB40 - push {r4,lr} - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r2, 0 - ldr r3, =sIsMonBeingMoved - 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, =sBoxCursorArea - 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, =sBoxCursorPosition - 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, =sBoxCursorPosition - 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, =sIsMonBeingMoved - 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, =sBoxCursorArea - ldrb r0, [r0] - mov r8, r0 - ldr r2, =sBoxCursorPosition - 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, =sCanOnlyMove - 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, =sIsMonBeingMoved - 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, =sBoxCursorPosition - 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, =sBoxCursorPosition - 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, =sBoxCursorPosition - 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, =sBoxCursorPosition - 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, =sBoxCursorPosition - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - cmp r0, r1 - beq _080CF47C - ldr r2, =sIsMonBeingMoved - 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, =sMovingMonOrigBoxId - 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, =sBoxCursorPosition - 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, =sBoxCursorPosition - 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, =sBoxCursorPosition - 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, =sBoxCursorPosition - 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, =sIsMonBeingMoved - 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, =sBoxCursorArea - ldrb r0, [r0] - mov r9, r0 - ldr r6, =sBoxCursorPosition - 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, =sCanOnlyMove - 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, =sBoxCursorArea - ldrb r0, [r0] - mov r8, r0 - ldr r0, =sBoxCursorPosition - 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, =sBoxCursorArea -_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, =sIsMonBeingMoved - 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, =sBoxCursorArea - 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, =sBoxCursorArea - ldrb r0, [r0] - ldr r1, =sBoxCursorPosition - 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, =sCanOnlyMove - 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, =sIsMonBeingMoved - 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, =sBoxCursorArea - 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, =sBoxCursorArea - 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, =sCanOnlyMove - 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 GetBoxCursorPosition -GetBoxCursorPosition: @ 80CFE08 - ldr r0, =sBoxCursorPosition - ldrb r0, [r0] - bx lr - .pool - thumb_func_end GetBoxCursorPosition - - thumb_func_start sub_80CFE14 -sub_80CFE14: @ 80CFE14 - push {r4-r6,lr} - adds r5, r0, 0 - adds r6, r1, 0 - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _080CFE48 - ldr r4, =sBoxCursorPosition - 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, =sMovingMonOrigBoxId - 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, =sBoxCursorArea - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _080CFEC0 - ldr r0, =sBoxCursorPosition - 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, =sBoxCursorArea - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _080CFEE4 - ldr r0, =sBoxCursorPosition - 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 diff --git a/asm/rom_8011DC0.s b/asm/rom_8011DC0.s index 3e07135e6..41d57d7ca 100644 --- a/asm/rom_8011DC0.s +++ b/asm/rom_8011DC0.s @@ -14596,7 +14596,7 @@ _0801E1B4: movs r0, 0x5 bl PlaySE movs r0, 0x1 - bl MoveMenuCursor + bl Menu_MoveCursor b _0801E23A .pool _0801E1D4: diff --git a/data/pokemon_storage_system.s b/data/pokemon_storage_system.s index a49793c74..0d1cc375f 100644 --- a/data/pokemon_storage_system.s +++ b/data/pokemon_storage_system.s @@ -5,114 +5,6 @@ - .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 gHandCursorTiles, 0x0800, 0x0000 - obj_tiles gHandCursorShadowTiles, 0x0080, 0x0001 - null_obj_tiles - - .align 2 -gHandCursorSpritePalettes:: @ 857B9FC - obj_pal gHandCursorPalette, 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 diff --git a/include/menu.h b/include/menu.h index f9b7c52df..198e7bd4a 100644 --- a/include/menu.h +++ b/include/menu.h @@ -43,7 +43,7 @@ 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); @@ -71,8 +71,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 MoveMenuCursorNoWrapAround(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/pokemon_storage_system.h b/include/pokemon_storage_system.h index e9b3302c0..530fb7042 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -21,7 +21,7 @@ struct StorageAction u8 format; }; -struct StorageText +struct StorageMenu { const u8 *text; int textId; @@ -124,7 +124,7 @@ struct PokemonStorageSystemData u8 field_A66; u8 field_A67; u8 *wallpaperTiles; - struct Sprite *field_A6C; + struct Sprite *movingMonSprite; struct Sprite *partySprites[PARTY_SIZE]; struct Sprite *boxMonsSprites[IN_BOX_COUNT]; struct Sprite **field_B00; @@ -145,7 +145,15 @@ struct PokemonStorageSystemData s8 field_C69; u8 field_C6A; u8 field_C6B; - u8 field_C6C[72]; + struct WindowTemplate menuWindow; + struct StorageMenu menuItems[7]; + u8 menuItemsCount; + u8 menuWidth; + u8 field_CAE; + u8 field_CAF; + u16 field_CB0; + u8 field_CB2; + u8 field_CB3; struct Sprite *field_CB4; struct Sprite *field_CB8; s32 field_CBC; @@ -161,21 +169,20 @@ struct PokemonStorageSystemData u8 field_CD5; u8 field_CD6; u8 field_CD7; - u8 field_CD8; - u8 field_CD9; + u8 field_CD8[2]; u8 field_CDA; u8 field_CDB; - u32 *field_CDC; + const u32 *cursorMonPalette; u32 cursorMonPersonality; u16 cursorMonSpecies; - u16 selectedItem; + u16 cursorMonItem; u16 field_CE8; u8 field_CEA; - u8 field_CEB; - u8 field_CEC; - u8 field_CED; - u8 field_CEE[POKEMON_NAME_LENGTH + 1]; - u8 cursorMonNick[36]; + u8 cursorMonMarkings; + u8 cursorMonLevel; + bool8 cursorMonIsEgg; + u8 cursorMonNick[POKEMON_NAME_LENGTH + 1]; + u8 cursorMonNickText[36]; u8 cursorMonSpeciesName[36]; u8 cursorMonGenderLvlText[36]; u8 cursorMonItemName[36]; @@ -187,7 +194,7 @@ struct PokemonStorageSystemData u16 *field_DA0; struct PokemonMarkMenu field_DA4; struct UnkPSSStruct_2002370 field_1E5C; - struct Pokemon field_20A4; + struct Pokemon movingMon; struct Pokemon field_2108; s8 field_216C; u8 field_216D; @@ -207,7 +214,11 @@ struct PokemonStorageSystemData u8 field_2186; u8 field_2187; u8 field_2188; - struct BoxPokemon *field_218C; + union + { + struct Pokemon *mon; + struct BoxPokemon *box; + } field_218C; u8 field_2190[40]; u8 field_21B8[40]; u8 field_21E0[POKEMON_NAME_LENGTH + 1]; @@ -217,7 +228,7 @@ struct PokemonStorageSystemData u8 field_21FC; u8 field_21FD; u8 field_21FE; - u8 field_21FF; + u8 inBoxMovingMode; u8 field_2200; u8 field_2201[51]; u16 movingItem; @@ -242,7 +253,7 @@ extern struct PokemonStorageSystemData *gUnknown_02039D08; u8* GetBoxNamePtr(u8 boxNumber); struct BoxPokemon *GetBoxedMonPtr(u8, u8); void SetBoxMonNickFromAnyBox(u8, u8, u8 *); -void CompactPartySlots(void); +s16 CompactPartySlots(void); u32 GetBoxMonDataAt(u8 boxId, u8 monPosition, u32 request); bool8 CheckFreePokemonStorageSpace(void); u8 StorageGetCurrentBox(void); diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index d0926d388..c08c581c3 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -1,6 +1,8 @@ #ifndef GUARD_POKEMON_SUMMARY_SCREEN_H #define GUARD_POKEMON_SUMMARY_SCREEN_H +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); diff --git a/include/strings.h b/include/strings.h index 744859c3e..1557baa6b 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1434,5 +1434,44 @@ 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[]; #endif //GUARD_STRINGS_H diff --git a/src/battle_factory_screen.c b/src/battle_factory_screen.c index 60b233daf..93f3aa9cd 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[]; diff --git a/src/battle_pyramid_bag.c b/src/battle_pyramid_bag.c index 8a6348522..6d71e4b1d 100644 --- a/src/battle_pyramid_bag.c +++ b/src/battle_pyramid_bag.c @@ -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/decoration.c b/src/decoration.c index b45dec334..768b1541b 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(); diff --git a/src/item_menu.c b/src/item_menu.c index 2c75a80f2..b0eb7c78b 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -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/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 84a0a23f3..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) diff --git a/src/player_pc.c b/src/player_pc.c index f42d59147..ec0d250b4 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -462,9 +462,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/pokemon_storage_system.c b/src/pokemon_storage_system.c index 86041690c..54c83e329 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -1,6 +1,7 @@ #include "global.h" #include "alloc.h" #include "bg.h" +#include "data2.h" #include "decompress.h" #include "dma3.h" #include "dynamic_placeholder_text_util.h" @@ -193,234 +194,245 @@ extern const u8 gText_JustOnePkmn[]; void CreatePCMenu(u8 whichMenu, s16 *windowIdPtr); void Cb2_EnterPSS(u8 boxOption); u8 GetCurrentBoxOption(void); -u8 sub_80CF9EC(void); +static u8 HandleInput(void); u8 sub_80CDC2C(void); u8 sub_80CB9BC(void); void LoadWallpaperGfx(u8 boxId, s8 direction); -void sub_80CCCFC(u8 boxId, s8 direction); -void sub_80CD0B8(s8 direction); +static void sub_80CCCFC(u8 boxId, s8 direction); +static void sub_80CD0B8(s8 direction); void SetBoxWallpaper(u8 boxId, u8 wallpaperId); void SetCurrentBox(u8 boxId); -void sub_80CC32C(u8 boxId); +static void sub_80CC32C(u8 boxId); void ZeroBoxMonAt(u8 boxId, u8 boxPos); -void sub_80C7958(u8 curBox); -void sub_80CCAE0(void *arg0); +static void sub_80C7958(u8 curBox); +static void sub_80CCAE0(void *arg0); void ResetWaldaWallpaper(void); -void sub_80C7B14(void); -void sub_80C7BB4(void); +static void sub_80C7B14(void); +static void sub_80C7BB4(void); void ScrollBackground(void); -void sub_80C7B80(void); +static void sub_80C7B80(void); void sub_80D2AA4(void); -void sub_80C7BE4(void); -void sub_80CAA14(void); -void sub_80CE790(void); -void sub_80CE8E4(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); void GiveChosenBagItem(void); -void SetUpHidePartyMenu(void); -void DestroyAllPartyMonIcons(void); +static void SetUpHidePartyMenu(void); +static void DestroyAllPartyMonIcons(void); void sub_80D11CC(void); void LoadPSSMenuGfx(void); void LoadWaveformSpritePalette(void); -void sub_80CDC18(void); -void sub_80CD36C(void); -void sub_80CD3EC(void); -void sub_80CAC1C(void); -void sub_80CEBDC(void); -void SetScrollingBackground(void); -void sub_80CABE0(void); -void sub_80CAEAC(void); +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); void sub_80D0C60(void); void sub_80CFEA8(void); -void sub_80CDC0C(void); -void sub_80CAF04(void); -void sub_80CA0D8(void); -void sub_80CFFD0(void); -void sub_80CE250(void); -void sub_80CE3A0(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); +void InitCanRelaseMonVars(void); void sub_80D01B8(void); -void sub_80CE2D8(void); +void ReleaseMon(void); void sub_80D25F0(void); -void sub_80CA230(void); +void RefreshCursorMonData(void); void LoadCursorMonSprite(void); -void sub_80CA154(void); -void sub_80CA1C4(void); -void sub_80CC064(void); -void sub_80CE324(void); +static void sub_80CA154(void); +static void sub_80CA1C4(void); +static void sub_80CC064(void); +static void sub_80CE324(void); void ClearBottomWindow(void); -void sub_80CA704(void); +static void sub_80CA704(void); void sub_80D013C(void); -void sub_80CE00C(void); +static void sub_80CE00C(void); void sub_80D1194(void); -void PrintCursorMonInfo(void); -void sub_80CA65C(void); -void sub_80CADD8(void); -void sub_80CD02C(void); -void sub_80CFEF0(void); -void sub_80CD158(void); +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); void sub_80CFC14(void); -void sub_80CEB40(void); -void sub_80CCEE0(void); +static void sub_80CEB40(void); +static void sub_80CCEE0(void); void sub_80D1818(void); -void sub_80CAA74(void); +static void sub_80CAA74(void); void sub_80D17B4(void); -void sub_80CE760(void); -void sub_80CDBA0(void); -void sub_80CE7E8(void); +static void sub_80CE760(void); +static void sub_80CDBA0(void); +static void sub_80CE7E8(void); void sub_80CFECC(void); -void sub_80CA9EC(void); +static void sub_80CA9EC(void); void FreePSSData(void); -void sub_80CCF9C(void); +static void AddBoxMenu(void); +static void sub_80CCF9C(void); void MoveMon(void); void PlaceMon(void); -void sub_80CAB20(void); -void sub_80CE22C(void); -void sub_80CDA68(void); -void sub_80CB950(void); -void sub_80CA9C0(void); -void SetUpDoShowPartyMenu(void); +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); void BoxSetMosaic(void); -void sub_80C7CF4(struct Sprite *sprite); -void sub_80CC100(struct Sprite *sprite); -void sub_80CB278(struct Sprite *sprite); -void sub_80CD210(struct Sprite *sprite); +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); bool32 WaitForWallpaperGfxLoad(void); bool8 InitPSSWindows(void); -bool8 sub_80CC0A0(void); -bool8 sub_80CE2A8(void); +static bool8 sub_80CC0A0(void); +static bool8 sub_80CE2A8(void); bool8 sub_80D0164(void); -bool8 sub_80CC35C(void); +static bool8 sub_80CC35C(void); bool8 sub_80D01E4(void); -bool8 sub_80CDED4(void); -bool8 sub_80CDF08(void); +static bool8 sub_80CDED4(void); +static bool8 sub_80CDF08(void); bool8 sub_80D184C(void); bool8 sub_80D18E4(void); -bool8 DoShowPartyMenu(void); +static bool8 DoShowPartyMenu(void); bool8 sub_80D1218(void); bool8 ScrollToBox(void); bool8 sub_80CD554(void); -bool8 HidePartyMenu(void); +static bool8 HidePartyMenu(void); bool8 sub_80D127C(void); -bool8 sub_80CA2B8(void); -bool8 DoWallpaperGfxChange(void); +bool8 sub_80D0580(u8 arg0); +bool8 sub_80D0BC0(void); +static bool8 sub_80CA2B8(void); +static bool8 DoWallpaperGfxChange(void); bool8 DoMonPlaceChange(void); bool8 sub_80D00A8(void); -bool8 CanMoveMon(void); -bool8 CanShifMon(void); -bool8 IsCursorOnCloseBox(void); -bool8 IsCursorOnBox(void); -bool8 IsCursorInBox(void); -bool8 IsMonBeingMoved(void); -bool8 TryStorePartyMonInBox(u8 boxId); -void Cb_InitPSS(u8 taskId); -void Cb_PlaceMon(u8 taskId); -void Cb_ChangeScreen(u8 taskId); -void Cb_ShowPSS(u8 taskId); -void Cb_OnBPressed(u8 taskId); -void Cb_HandleBoxOptions(u8 taskId); -void Cb_OnSelectedMon(u8 taskId); -void Cb_OnCloseBoxPressed(u8 taskId); -void Cb_HidePartyPokemon(u8 taskId); -void Cb_DepositMenu(u8 taskId); -void Cb_MoveMon(u8 taskId); -void Cb_GiveMovingItemToMon(u8 taskId); -void Cb_SwitchSelectedItem(u8 taskId); -void Cb_TakeItemForMoving(u8 taskId); -void Cb_WithdrawMon(u8 taskId); -void Cb_ShiftMon(u8 taskId); -void Cb_ShowPartyPokemon(u8 taskId); -void Cb_ShowItemInfo(u8 taskId); -void Cb_GiveItemFromBag(u8 taskId); -void Cb_ItemToBag(u8 taskId); -void Cb_TakeItemForMoving(u8 taskId); -void Cb_ShowMarkMenu(u8 taskId); -void Cb_ShowMonSummary(u8 taskId); -void Cb_ReleaseMon(u8 taskId); -void task_pokemon_box_related(u8 taskId); -void Cb_ReshowPSS(u8 taskId); -void Cb_MainPSS(u8 taskId); -void Cb_JumpBox(u8 taskId); -void Cb_HandleWallpapers(u8 taskId); -void Cb_NameBox(u8 taskId); -void Cb_PrintCantStoreMail(u8 taskId); -void Cb_HandleMovingMonFromParty(u8 taskId); +static bool8 CanMovePartyMon(void); +static bool8 CanShifMon(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); void sub_80D2A90(struct UnkStruct_2000020 *arg0, struct UnkStruct_2000028 *arg1, u32 arg2); void sub_80D259C(u8 arg0); -void SetUpScrollToBox(u8 boxId); -void sub_80CFE54(u8 arg0); +static void SetUpScrollToBox(u8 boxId); +void sub_80CFE54(u8 animNum); void sub_80D2918(u8 arg0); -void sub_80CC0D4(u8 priority); +static void SetMovingMonPriority(u8 priority); void InitMonPlaceChange(u8 arg0); -void sub_80CE9A8(u8 markings); +static void SetMonMarkings(u8 markings); void ShowYesNoWindow(s8 cursorPos); -void sub_80CDBF8(u8 arg0); +static void sub_80CDBF8(u8 cursorBoxPosition); void sub_80D01D0(u8 arg0); -void sub_80CD1A8(bool8 arg0); -void sub_80CA984(bool8 arg0); +static void sub_80CD1A8(bool8 arg0); +static void sub_80CA984(bool8 arg0); void CreatePartyMonsSprites(bool8 arg0); void sub_80D2644(u8 arg0, u16 arg1, const void *arg2, u16 arg3, u16 arg4); void sub_80D2770(u8 arg0, u16 arg1, u16 arg2); void PrintStorageActionText(u8 id); s16 sub_80D00AC(void); -s8 sub_80CE580(void); +s8 RunCanReleaseMon(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 wallpaperSet); +static void SetWallpaperForCurrentBox(u8 wallpaperId); +static void AddWallpapersMenu(u8 wallpaperSet); u16 GetMovingItem(void); -void SetCurrentBoxMonData(s32 monId, s32 request, const void *value); +void SetCurrentBoxMonData(u8 monId, s32 request, const void *value); s32 GetCurrentBoxMonData(u8 boxPosition, s32 request); void LoadCursorMonGfx(u16 species, u32 pid); -void sub_80CA2D0(struct Sprite *sprite); -void sub_80CCF64(struct Sprite *sprite); -void sub_80CBA3C(struct Sprite *sprite); -void sub_80CCF30(struct Sprite *sprite); +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); void sub_80D27AC(u8 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4); void sub_80D27F4(u8 arg0, u8 arg1, s8 arg2); -void sub_80CBAF0(s16 yDelta); -void sub_80CAAA8(u8 arg0, bool8 isPartyMon); +static void sub_80CBAF0(s16 yDelta); +static void sub_80CAAA8(u8 arg0, bool8 isPartyMon); const u8 *GetMovingItemName(void); bool32 IsWaldaWallpaperUnlocked(void); -void sub_80CFF34(u8 arg0); +static void SetMenuText(u8 textId); void sub_80D0D8C(u8 arg0, u8 cursorPos); void sub_80D0E50(u8 arg0, u8 cursorPos); void sub_80D0F38(u16 item); static struct Sprite *CreateMonIconSprite(u16 species, u32 personality, s16 x, s16 y, u8 oamPriority, u8 subpriority); -void DestroyBoxMonIcon(struct Sprite *sprite); -void SetBoxSpeciesAndPersonalities(u8 boxId); -void sub_80CB9D0(struct Sprite *sprite, u16 partyId); -void sub_80CC370(u8 taskId); -void sub_80CCB50(u8 boxId); +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); s8 sub_80CC644(u8 boxId); u8 GetBoxWallpaper(u8 boxId); u32 GetWaldaWallpaperPatternId(void); u32 GetWaldaWallpaperIconId(void); -void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2); +static void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2); u16 *GetWaldaWallpaperColorsPtr(void); void sub_80C6D80(u8 *arg0, void *arg1, u8 arg2, u8 arg3, s32 arg4); -s16 sub_80CD00C(const u8 *string); -bool8 MonPlaceChange_Shift(void); -bool8 MonPlaceChange_Move(void); -bool8 MonPlaceChange_Place(void); -bool8 sub_80CDEC4(void); -bool8 sub_80CDEB4(void); -void sub_80CD444(u8 a0, u8 a1, u16 *a2, u16 *a3); -void SetShiftedMonData(u8 boxId, u8 position); -void SetMovedMonData(u8 boxId, u8 position); -void SetPlacedMonData(u8 boxId, u8 position); +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); +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); void PurgeMonOrBoxMon(u8 boxId, u8 position); void BoxMonAtToMon(u8 boxId, u8 position, struct Pokemon *dst); void SetBoxMonAt(u8 boxId, u8 position, struct BoxPokemon *src); -void sub_80CEC00(struct Pokemon *mon, u8 arg1); +static void SetCursorMonData(void *pokemon, u8 mode); bool32 AtLeastThreeUsableMons(void); bool32 CheckBoxedMonSanity(s32 boxId, s32 boxPosition); s32 GetAndCopyBoxMonDataAt(u8 boxId, u8 boxPosition, s32 request, void *dst); +static u8 InBoxInput_Normal(void); +static u8 InBoxInput_MovingMultiple(void); +static u8 InBoxInput_GrabbingMultiple(void); +s8 sub_80CFF98(u8 arg0); +u8 sub_80CFA5C(void); +u8 sub_80D0BA4(void); +static bool8 sub_80CFA84(void); +static bool8 sub_80CFB44(void); -// 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}, @@ -429,7 +441,7 @@ const struct PSS_MenuStringPtrs gUnknown_085716C0[] = {gText_SeeYa, gText_SeeYaDescription} }; -const struct WindowTemplate gUnknown_085716E8 = +static const struct WindowTemplate gUnknown_085716E8 = { .bg = 0, .tilemapLeft = 1, @@ -440,31 +452,31 @@ const struct WindowTemplate gUnknown_085716E8 = .baseBlock = 0x1, }; -const union AnimCmd sSpriteAnim_85716F0[] = +static const union AnimCmd sSpriteAnim_85716F0[] = { ANIMCMD_FRAME(0, 5), ANIMCMD_END }; -const union AnimCmd sSpriteAnim_85716F8[] = +static const union AnimCmd sSpriteAnim_85716F8[] = { ANIMCMD_FRAME(4, 5), ANIMCMD_END }; -const union AnimCmd sSpriteAnim_8571700[] = +static const union AnimCmd sSpriteAnim_8571700[] = { ANIMCMD_FRAME(6, 5), ANIMCMD_END }; -const union AnimCmd sSpriteAnim_8571708[] = +static const union AnimCmd sSpriteAnim_8571708[] = { ANIMCMD_FRAME(10, 5), ANIMCMD_END }; -const union AnimCmd *const sSpriteAnimTable_8571710[] = +static const union AnimCmd *const sSpriteAnimTable_8571710[] = { sSpriteAnim_85716F0, sSpriteAnim_85716F8, @@ -472,60 +484,60 @@ const union AnimCmd *const sSpriteAnimTable_8571710[] = sSpriteAnim_8571708 }; -const union AffineAnimCmd sSpriteAffineAnim_8571720[] = +static const union AffineAnimCmd sSpriteAffineAnim_8571720[] = { AFFINEANIMCMD_FRAME(0xE0, 0xE0, 0, 0), AFFINEANIMCMD_END }; -const union AffineAnimCmd *const sSpriteAffineAnimTable_8571730[] = +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"); -const u32 gPokemonStorageScrollingBGTileset[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.4bpp.lz"); -const u32 gPokemonStorageScrollingBGTilemap[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.bin.lz"); -const u32 gUnknown_08572280[] = INCBIN_U32("graphics/unknown/unknown_572280.gbapal"); -const u32 gUnknown_085722A0[] = INCBIN_U32("graphics/unknown/unknown_5722A0.bin.lz"); +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"); -const u16 gUnknown_0857239C[] = +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, }; -const u16 gUnknown_085723DC[] = INCBIN_U16("graphics/unknown/unknown_5723DC.gbapal"); // Left-most part and Close Box. -const u16 gUnknown_085723FC[] = INCBIN_U16("graphics/unknown/unknown_5723FC.gbapal"); -const u16 gUnknown_0857241C[] = INCBIN_U16("graphics/unknown/unknown_57241C.gbapal"); -const u16 gUnknown_0857243C[] = INCBIN_U16("graphics/unknown/unknown_57243C.gbapal"); +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"); -const u16 gUnknown_0857245C[] = +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 }; -const u16 gUnknown_085724A4[] = +static const u16 gUnknown_085724A4[] = { 0x1140, 0x1141, 0x1141, 0x1142, 0x1150, 0x1151, 0x1151, 0x1152, 0x1160, 0x1161, 0x1161, 0x1162, }; -const u16 gUnknown_085724BC[] = +static const u16 gUnknown_085724BC[] = { 0x1143, 0x1144, 0x1144, 0x1145, 0x1153, 0x1154, 0x1154, 0x1155, 0x1163, 0x1164, 0x1164, 0x1165, }; -const u16 gWaveformPalette[] = INCBIN_U16("graphics/pokemon_storage/waveform.gbapal"); -const u32 gWaveformTiles[] = INCBIN_U32("graphics/pokemon_storage/waveform.4bpp"); -const u32 gUnknown_085726B4[] = INCBIN_U32("graphics/unused/unknown_5726B4.gbapal"); -const u32 gUnknown_085726F4[] = INCBIN_U32("graphics/unknown/unknown_5726F4.gbapal"); +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"); -const struct WindowTemplate gUnknown_08572714[] = +static const struct WindowTemplate gUnknown_08572714[] = { { // 0 .bg = 1, @@ -557,7 +569,7 @@ const struct WindowTemplate gUnknown_08572714[] = DUMMY_WIN_TEMPLATE }; -const struct BgTemplate gUnknown_08572734[] = +static const struct BgTemplate gUnknown_08572734[] = { { .bg = 0, @@ -597,18 +609,18 @@ const struct BgTemplate gUnknown_08572734[] = }, }; -const struct SpritePalette gWaveformSpritePalette = +static const struct SpritePalette gWaveformSpritePalette = { gWaveformPalette, TAG_PAL_WAVEFORM }; -const struct SpriteSheet gWaveformSpriteSheet = +static const struct SpriteSheet gWaveformSpriteSheet = { gWaveformTiles, sizeof(gWaveformTiles), TAG_TILE_WAVEFORM }; -const struct OamData sOamData_857286C; -const struct SpriteTemplate sSpriteTemplate_CursorMon = +static const struct OamData sOamData_857286C; +static const struct SpriteTemplate sSpriteTemplate_CursorMon = { .tileTag = TAG_TILE_2, .paletteTag = TAG_PAL_DAC6, @@ -619,7 +631,7 @@ const struct SpriteTemplate sSpriteTemplate_CursorMon = .callback = SpriteCallbackDummy, }; -const struct StorageAction gPCStorageActionTexts[] = +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}, @@ -654,7 +666,7 @@ const struct StorageAction gPCStorageActionTexts[] = [PC_TEXT_CANT_STORE_MAIL] = {gText_MailCantBeStored, PC_TEXT_FMT_NORMAL}, }; -const struct WindowTemplate sYesNoWindowTemplate = +static const struct WindowTemplate sYesNoWindowTemplate = { .bg = 0, .tilemapLeft = 24, @@ -665,7 +677,7 @@ const struct WindowTemplate sYesNoWindowTemplate = .baseBlock = 0x5C, }; -const struct OamData sOamData_857286C = +static const struct OamData sOamData_857286C = { .y = 0, .affineMode = 0, @@ -682,7 +694,7 @@ const struct OamData sOamData_857286C = .affineParam = 0 }; -const struct OamData sOamData_8572874 = +static const struct OamData sOamData_8572874 = { .y = 0, .affineMode = 0, @@ -699,13 +711,13 @@ const struct OamData sOamData_8572874 = .affineParam = 0 }; -const union AnimCmd sSpriteAnim_857287C[] = +static const union AnimCmd sSpriteAnim_857287C[] = { ANIMCMD_FRAME(0, 5), ANIMCMD_END }; -const union AnimCmd sSpriteAnim_8572884[] = +static const union AnimCmd sSpriteAnim_8572884[] = { ANIMCMD_FRAME(2, 8), ANIMCMD_FRAME(4, 8), @@ -713,13 +725,13 @@ const union AnimCmd sSpriteAnim_8572884[] = ANIMCMD_JUMP(0) }; -const union AnimCmd sSpriteAnim_8572894[] = +static const union AnimCmd sSpriteAnim_8572894[] = { ANIMCMD_FRAME(8, 5), ANIMCMD_END }; -const union AnimCmd sSpriteAnim_857289C[] = +static const union AnimCmd sSpriteAnim_857289C[] = { ANIMCMD_FRAME(10, 8), ANIMCMD_FRAME(4, 8), @@ -727,7 +739,7 @@ const union AnimCmd sSpriteAnim_857289C[] = ANIMCMD_JUMP(0) }; -const union AnimCmd *const sSpriteAnimTable_85728AC[] = +static const union AnimCmd *const sSpriteAnimTable_85728AC[] = { sSpriteAnim_857287C, sSpriteAnim_8572884, @@ -735,7 +747,7 @@ const union AnimCmd *const sSpriteAnimTable_85728AC[] = sSpriteAnim_857289C }; -const struct SpriteTemplate gUnknown_085728BC = +static const struct SpriteTemplate gUnknown_085728BC = { .tileTag = 5, .paletteTag = 0xDACA, @@ -746,8 +758,8 @@ const struct SpriteTemplate gUnknown_085728BC = .callback = SpriteCallbackDummy, }; -const struct OamData sOamData_85728EC; -const struct SpriteTemplate gUnknown_085728D4 = +static const struct OamData sOamData_85728EC; +static const struct SpriteTemplate gUnknown_085728D4 = { .tileTag = 18, .paletteTag = 0xDAC0, @@ -758,7 +770,7 @@ const struct SpriteTemplate gUnknown_085728D4 = .callback = SpriteCallbackDummy, }; -const struct OamData sOamData_85728EC = +static const struct OamData sOamData_85728EC = { .y = 0, .affineMode = 0, @@ -775,156 +787,156 @@ const struct OamData sOamData_85728EC = .affineParam = 0 }; -const union AffineAnimCmd gSpriteAffineAnim_85728F4[] = +static const union AffineAnimCmd gSpriteAffineAnim_85728F4[] = { AFFINEANIMCMD_FRAME(-2, -2, 0, 120), AFFINEANIMCMD_END }; -const union AffineAnimCmd gSpriteAffineAnim_8572904[] = +static const union AffineAnimCmd gSpriteAffineAnim_8572904[] = { AFFINEANIMCMD_FRAME(16, 16, 0, 0), AFFINEANIMCMD_FRAME(16, 16, 0, 15), AFFINEANIMCMD_END }; -const union AffineAnimCmd *const gSpriteAffineAnimTable_857291C[] = +static const union AffineAnimCmd *const gSpriteAffineAnimTable_857291C[] = { gSpriteAffineAnim_85728F4, gSpriteAffineAnim_8572904 }; -const u16 gWallpaperPalettes_Forest[][16] = +static const u16 gWallpaperPalettes_Forest[][16] = { INCBIN_U16("graphics/pokemon_storage/forest_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/forest_bg.gbapal"), }; -const u32 gWallpaperTiles_Forest[] = INCBIN_U32("graphics/pokemon_storage/forest.4bpp.lz"); -const u32 gWallpaperTilemap_Forest[] = INCBIN_U32("graphics/pokemon_storage/forest.bin.lz"); +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"); -const u16 gWallpaperPalettes_City[][16] = +static const u16 gWallpaperPalettes_City[][16] = { INCBIN_U16("graphics/pokemon_storage/city_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/city_bg.gbapal"), }; -const u32 gWallpaperTiles_City[] = INCBIN_U32("graphics/pokemon_storage/city.4bpp.lz"); -const u32 gWallpaperTilemap_City[] = INCBIN_U32("graphics/pokemon_storage/city.bin.lz"); +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"); -const u16 gWallpaperPalettes_Desert[][16] = +static const u16 gWallpaperPalettes_Desert[][16] = { INCBIN_U16("graphics/pokemon_storage/desert_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/desert_bg.gbapal"), }; -const u32 gWallpaperTiles_Desert[] = INCBIN_U32("graphics/pokemon_storage/desert.4bpp.lz"); -const u32 gWallpaperTilemap_Desert[] = INCBIN_U32("graphics/pokemon_storage/desert.bin.lz"); +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"); -const u16 gWallpaperPalettes_Savanna[][16] = +static const u16 gWallpaperPalettes_Savanna[][16] = { INCBIN_U16("graphics/pokemon_storage/savanna_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/savanna_bg.gbapal"), }; -const u32 gWallpaperTiles_Savanna[] = INCBIN_U32("graphics/pokemon_storage/savanna.4bpp.lz"); -const u32 gWallpaperTilemap_Savanna[] = INCBIN_U32("graphics/pokemon_storage/savanna.bin.lz"); +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"); -const u16 gWallpaperPalettes_Crag[][16] = +static const u16 gWallpaperPalettes_Crag[][16] = { INCBIN_U16("graphics/pokemon_storage/crag_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/crag_bg.gbapal"), }; -const u32 gWallpaperTiles_Crag[] = INCBIN_U32("graphics/pokemon_storage/crag.4bpp.lz"); -const u32 gWallpaperTilemap_Crag[] = INCBIN_U32("graphics/pokemon_storage/crag.bin.lz"); +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"); -const u16 gWallpaperPalettes_Volcano[][16] = +static const u16 gWallpaperPalettes_Volcano[][16] = { INCBIN_U16("graphics/pokemon_storage/volcano_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/volcano_bg.gbapal"), }; -const u32 gWallpaperTiles_Volcano[] = INCBIN_U32("graphics/pokemon_storage/volcano.4bpp.lz"); -const u32 gWallpaperTilemap_Volcano[] = INCBIN_U32("graphics/pokemon_storage/volcano.bin.lz"); +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"); -const u16 gWallpaperPalettes_Snow[][16] = +static const u16 gWallpaperPalettes_Snow[][16] = { INCBIN_U16("graphics/pokemon_storage/snow_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/snow_bg.gbapal"), }; -const u32 gWallpaperTiles_Snow[] = INCBIN_U32("graphics/pokemon_storage/snow.4bpp.lz"); -const u32 gWallpaperTilemap_Snow[] = INCBIN_U32("graphics/pokemon_storage/snow.bin.lz"); +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"); -const u16 gWallpaperPalettes_Cave[][16] = +static const u16 gWallpaperPalettes_Cave[][16] = { INCBIN_U16("graphics/pokemon_storage/cave_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/cave_bg.gbapal"), }; -const u32 gWallpaperTiles_Cave[] = INCBIN_U32("graphics/pokemon_storage/cave.4bpp.lz"); -const u32 gWallpaperTilemap_Cave[] = INCBIN_U32("graphics/pokemon_storage/cave.bin.lz"); +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"); -const u16 gWallpaperPalettes_Beach[][16] = +static const u16 gWallpaperPalettes_Beach[][16] = { INCBIN_U16("graphics/pokemon_storage/beach_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/beach_bg.gbapal"), }; -const u32 gWallpaperTiles_Beach[] = INCBIN_U32("graphics/pokemon_storage/beach.4bpp.lz"); -const u32 gWallpaperTilemap_Beach[] = INCBIN_U32("graphics/pokemon_storage/beach.bin.lz"); +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"); -const u16 gWallpaperPalettes_Seafloor[][16] = +static const u16 gWallpaperPalettes_Seafloor[][16] = { INCBIN_U16("graphics/pokemon_storage/seafloor_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/seafloor_bg.gbapal"), }; -const u32 gWallpaperTiles_Seafloor[] = INCBIN_U32("graphics/pokemon_storage/seafloor.4bpp.lz"); -const u32 gWallpaperTilemap_Seafloor[] = INCBIN_U32("graphics/pokemon_storage/seafloor.bin.lz"); +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"); -const u16 gWallpaperPalettes_River[][16] = +static const u16 gWallpaperPalettes_River[][16] = { INCBIN_U16("graphics/pokemon_storage/river_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/river_bg.gbapal"), }; -const u32 gWallpaperTiles_River[] = INCBIN_U32("graphics/pokemon_storage/river.4bpp.lz"); -const u32 gWallpaperTilemap_River[] = INCBIN_U32("graphics/pokemon_storage/river.bin.lz"); -const u16 gWallpaperPalettes_Sky[][16] = +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"), }; -const u32 gWallpaperTiles_Sky[] = INCBIN_U32("graphics/pokemon_storage/sky.4bpp.lz"); -const u32 gWallpaperTilemap_Sky[] = INCBIN_U32("graphics/pokemon_storage/sky.bin.lz"); +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"); -const u16 gWallpaperPalettes_PolkaDot[][16] = +static const u16 gWallpaperPalettes_PolkaDot[][16] = { INCBIN_U16("graphics/pokemon_storage/polkadot_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/polkadot_bg.gbapal"), }; -const u32 gWallpaperTiles_PolkaDot[] = INCBIN_U32("graphics/pokemon_storage/polkadot.4bpp.lz"); -const u32 gWallpaperTilemap_PolkaDot[] = INCBIN_U32("graphics/pokemon_storage/polkadot.bin.lz"); +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"); -const u16 gWallpaperPalettes_Pokecenter[][16] = +static const u16 gWallpaperPalettes_Pokecenter[][16] = { INCBIN_U16("graphics/pokemon_storage/pokecenter_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/pokecenter_bg.gbapal"), }; -const u32 gWallpaperTiles_Pokecenter[] = INCBIN_U32("graphics/pokemon_storage/pokecenter.4bpp.lz"); -const u32 gWallpaperTilemap_Pokecenter[] = INCBIN_U32("graphics/pokemon_storage/pokecenter.bin.lz"); +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"); -const u16 gWallpaperPalettes_Machine[][16] = +static const u16 gWallpaperPalettes_Machine[][16] = { INCBIN_U16("graphics/pokemon_storage/machine_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/machine_bg.gbapal"), }; -const u32 gWallpaperTiles_Machine[] = INCBIN_U32("graphics/pokemon_storage/machine.4bpp.lz"); -const u32 gWallpaperTilemap_Machine[] = INCBIN_U32("graphics/pokemon_storage/machine.bin.lz"); +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"); -const u16 gWallpaperPalettes_Plain[][16] = +static const u16 gWallpaperPalettes_Plain[][16] = { INCBIN_U16("graphics/pokemon_storage/plain_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/plain_bg.gbapal"), }; -const u32 gWallpaperTiles_Plain[] = INCBIN_U32("graphics/pokemon_storage/plain.4bpp.lz"); -const u32 gWallpaperTilemap_Plain[] = INCBIN_U32("graphics/pokemon_storage/plain.bin.lz"); +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 -const u32 gUnknown_085773C4[] = INCBIN_U32("graphics/unused/tilemap_5773C4.bin"); +static const u32 gUnknown_085773C4[] = INCBIN_U32("graphics/unused/tilemap_5773C4.bin"); -const u16 gUnknown_08577574[][2] = +static const u16 gUnknown_08577574[][2] = { {0x1CE7, 0x7FFF}, {0x1CE7, 0x7FFF}, @@ -947,7 +959,7 @@ const u16 gUnknown_08577574[][2] = #define WALLPAPER_ENTRY(name) {gWallpaperTiles_##name, gWallpaperTilemap_##name, gWallpaperPalettes_##name[0]} -const struct WallpaperTable gWallpaperTable[] = +static const struct WallpaperTable gWallpaperTable[] = { [WALLPAPER_FOREST] = WALLPAPER_ENTRY(Forest), [WALLPAPER_CITY] = WALLPAPER_ENTRY(City), @@ -967,149 +979,149 @@ const struct WallpaperTable gWallpaperTable[] = [WALLPAPER_PLAIN] = WALLPAPER_ENTRY(Plain), }; -const u8 gPCGfx_Arrow[] = INCBIN_U8("graphics/pokemon_storage/arrow.4bpp"); +static const u8 gPCGfx_Arrow[] = INCBIN_U8("graphics/pokemon_storage/arrow.4bpp"); -const u16 gWallpaperPalettes_Zigzagoon[][16] = +static const u16 gWallpaperPalettes_Zigzagoon[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), INCBIN_U16("graphics/pokemon_storage/zigzagoon_bg.gbapal"), }; -const u32 gWallpaperTiles_Zigzagoon[] = INCBIN_U32("graphics/pokemon_storage/zigzagoon.4bpp.lz"); -const u32 gWallpaperTilemap_Zigzagoon[] = INCBIN_U32("graphics/pokemon_storage/zigzagoon.bin.lz"); +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"); -const u16 gWallpaperPalettes_Screen[][16] = +static const u16 gWallpaperPalettes_Screen[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), INCBIN_U16("graphics/pokemon_storage/screen_bg.gbapal"), }; -const u32 gWallpaperTiles_Screen[] = INCBIN_U32("graphics/pokemon_storage/screen.4bpp.lz"); -const u32 gWallpaperTilemap_Screen[] = INCBIN_U32("graphics/pokemon_storage/screen.bin.lz"); +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"); -const u16 gWallpaperPalettes_Diagonal[][16] = +static const u16 gWallpaperPalettes_Diagonal[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), INCBIN_U16("graphics/pokemon_storage/diagonal_bg.gbapal"), }; -const u32 gWallpaperTiles_Diagonal[] = INCBIN_U32("graphics/pokemon_storage/diagonal.4bpp.lz"); -const u32 gWallpaperTilemap_Diagonal[] = INCBIN_U32("graphics/pokemon_storage/diagonal.bin.lz"); +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"); -const u16 gWallpaperPalettes_Block[][16] = +static const u16 gWallpaperPalettes_Block[][16] = { INCBIN_U16("graphics/pokemon_storage/block_bg.gbapal"), INCBIN_U16("graphics/pokemon_storage/block_bg.gbapal"), }; -const u32 gWallpaperTiles_Block[] = INCBIN_U32("graphics/pokemon_storage/block.4bpp.lz"); -const u32 gWallpaperTilemap_Block[] = INCBIN_U32("graphics/pokemon_storage/block.bin.lz"); +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"); -const u16 gWallpaperPalettes_Pokecenter2[][16] = +static const u16 gWallpaperPalettes_Pokecenter2[][16] = { INCBIN_U16("graphics/pokemon_storage/pokecenter2_bg.gbapal"), INCBIN_U16("graphics/pokemon_storage/pokecenter2_bg.gbapal"), }; -const u32 gWallpaperTiles_Pokecenter2[] = INCBIN_U32("graphics/pokemon_storage/pokecenter2.4bpp.lz"); -const u32 gWallpaperTilemap_Pokecenter2[] = INCBIN_U32("graphics/pokemon_storage/pokecenter2.bin.lz"); +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"); -const u16 gWallpaperPalettes_Frame[][16] = +static const u16 gWallpaperPalettes_Frame[][16] = { INCBIN_U16("graphics/pokemon_storage/frame_bg.gbapal"), INCBIN_U16("graphics/pokemon_storage/frame_bg.gbapal"), }; -const u32 gWallpaperTiles_Frame[] = INCBIN_U32("graphics/pokemon_storage/frame.4bpp.lz"); -const u32 gWallpaperTilemap_Frame[] = INCBIN_U32("graphics/pokemon_storage/frame.bin.lz"); +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"); -const u16 gWallpaperPalettes_Blank[][16] = +static const u16 gWallpaperPalettes_Blank[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), INCBIN_U16("graphics/pokemon_storage/zigzagoon_bg.gbapal"), }; -const u32 gWallpaperTiles_Blank[] = INCBIN_U32("graphics/pokemon_storage/blank.4bpp.lz"); -const u32 gWallpaperTilemap_Blank[] = INCBIN_U32("graphics/pokemon_storage/blank.bin.lz"); +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"); -const u16 gWallpaperPalettes_Circles[][16] = +static const u16 gWallpaperPalettes_Circles[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), INCBIN_U16("graphics/pokemon_storage/circles_bg.gbapal"), }; -const u32 gWallpaperTiles_Circles[] = INCBIN_U32("graphics/pokemon_storage/circles.4bpp.lz"); -const u32 gWallpaperTilemap_Circles[] = INCBIN_U32("graphics/pokemon_storage/circles.bin.lz"); +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"); -const u16 gWallpaperPalettes_Azumarill[][16] = +static const u16 gWallpaperPalettes_Azumarill[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), INCBIN_U16("graphics/pokemon_storage/azumarill_bg.gbapal"), }; -const u32 gWallpaperTiles_Azumarill[] = INCBIN_U32("graphics/pokemon_storage/azumarill.4bpp.lz"); -const u32 gWallpaperTilemap_Azumarill[] = INCBIN_U32("graphics/pokemon_storage/azumarill.bin.lz"); +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"); -const u16 gWallpaperPalettes_Pikachu[][16] = +static const u16 gWallpaperPalettes_Pikachu[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), INCBIN_U16("graphics/pokemon_storage/pikachu_bg.gbapal"), }; -const u32 gWallpaperTiles_Pikachu[] = INCBIN_U32("graphics/pokemon_storage/pikachu.4bpp.lz"); -const u32 gWallpaperTilemap_Pikachu[] = INCBIN_U32("graphics/pokemon_storage/pikachu.bin.lz"); +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"); -const u16 gWallpaperPalettes_Legendary[][16] = +static const u16 gWallpaperPalettes_Legendary[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), INCBIN_U16("graphics/pokemon_storage/legendary_bg.gbapal"), }; -const u32 gWallpaperTiles_Legendary[] = INCBIN_U32("graphics/pokemon_storage/legendary.4bpp.lz"); -const u32 gWallpaperTilemap_Legendary[] = INCBIN_U32("graphics/pokemon_storage/legendary.bin.lz"); +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"); -const u16 gWallpaperPalettes_Dusclops[][16] = +static const u16 gWallpaperPalettes_Dusclops[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), INCBIN_U16("graphics/pokemon_storage/dusclops_bg.gbapal"), }; -const u32 gWallpaperTiles_Dusclops[] = INCBIN_U32("graphics/pokemon_storage/dusclops.4bpp.lz"); -const u32 gWallpaperTilemap_Dusclops[] = INCBIN_U32("graphics/pokemon_storage/dusclops.bin.lz"); +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"); -const u16 gWallpaperPalettes_Ludicolo[][16] = +static const u16 gWallpaperPalettes_Ludicolo[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), INCBIN_U16("graphics/pokemon_storage/ludicolo_bg.gbapal"), }; -const u32 gWallpaperTiles_Ludicolo[] = INCBIN_U32("graphics/pokemon_storage/ludicolo.4bpp.lz"); -const u32 gWallpaperTilemap_Ludicolo[] = INCBIN_U32("graphics/pokemon_storage/ludicolo.bin.lz"); +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"); -const u16 gWallpaperPalettes_Whiscash[][16] = +static const u16 gWallpaperPalettes_Whiscash[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), INCBIN_U16("graphics/pokemon_storage/whiscash_bg.gbapal"), }; -const u32 gWallpaperTiles_Whiscash[] = INCBIN_U32("graphics/pokemon_storage/whiscash.4bpp.lz"); -const u32 gWallpaperTilemap_Whiscash[] = INCBIN_U32("graphics/pokemon_storage/whiscash.bin.lz"); +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"); -const u32 gWallpaperIcon_Aqua[] = INCBIN_U32("graphics/pokemon_storage/aqua_icon.4bpp.lz"); -const u32 gWallpaperIcon_Heart[] = INCBIN_U32("graphics/pokemon_storage/heart_icon.4bpp.lz"); -const u32 gWallpaperIcon_FiveStar[] = INCBIN_U32("graphics/pokemon_storage/five_star_icon.4bpp.lz"); -const u32 gWallpaperIcon_Brick[] = INCBIN_U32("graphics/pokemon_storage/brick_icon.4bpp.lz"); -const u32 gWallpaperIcon_FourStar[] = INCBIN_U32("graphics/pokemon_storage/four_star_icon.4bpp.lz"); -const u32 gWallpaperIcon_Asterisk[] = INCBIN_U32("graphics/pokemon_storage/asterisk_icon.4bpp.lz"); -const u32 gWallpaperIcon_Dot[] = INCBIN_U32("graphics/pokemon_storage/dot_icon.4bpp.lz"); -const u32 gWallpaperIcon_LineCircle[] = INCBIN_U32("graphics/pokemon_storage/line_circle_icon.4bpp.lz"); -const u32 gWallpaperIcon_PokeBall[] = INCBIN_U32("graphics/pokemon_storage/pokeball_icon.4bpp.lz"); -const u32 gWallpaperIcon_Maze[] = INCBIN_U32("graphics/pokemon_storage/maze_icon.4bpp.lz"); -const u32 gWallpaperIcon_Footprint[] = INCBIN_U32("graphics/pokemon_storage/footprint_icon.4bpp.lz"); -const u32 gWallpaperIcon_BigAsterisk[] = INCBIN_U32("graphics/pokemon_storage/big_asterisk_icon.4bpp.lz"); -const u32 gWallpaperIcon_Circle[] = INCBIN_U32("graphics/pokemon_storage/circle_icon.4bpp.lz"); -const u32 gWallpaperIcon_Koffing[] = INCBIN_U32("graphics/pokemon_storage/koffing_icon.4bpp.lz"); -const u32 gWallpaperIcon_Ribbon[] = INCBIN_U32("graphics/pokemon_storage/ribbon_icon.4bpp.lz"); -const u32 gWallpaperIcon_FourCircles[] = INCBIN_U32("graphics/pokemon_storage/four_circles_icon.4bpp.lz"); -const u32 gWallpaperIcon_Lotad[] = INCBIN_U32("graphics/pokemon_storage/lotad_icon.4bpp.lz"); -const u32 gWallpaperIcon_Crystal[] = INCBIN_U32("graphics/pokemon_storage/crystal_icon.4bpp.lz"); -const u32 gWallpaperIcon_Pichu[] = INCBIN_U32("graphics/pokemon_storage/pichu_icon.4bpp.lz"); -const u32 gWallpaperIcon_Diglett[] = INCBIN_U32("graphics/pokemon_storage/diglett_icon.4bpp.lz"); -const u32 gWallpaperIcon_Luvdisc[] = INCBIN_U32("graphics/pokemon_storage/luvdisc_icon.4bpp.lz"); -const u32 gWallpaperIcon_StarInCircle[] = INCBIN_U32("graphics/pokemon_storage/star_in_circle_icon.4bpp.lz"); -const u32 gWallpaperIcon_Spinda[] = INCBIN_U32("graphics/pokemon_storage/spinda_icon.4bpp.lz"); -const u32 gWallpaperIcon_Latis[] = INCBIN_U32("graphics/pokemon_storage/latis_icon.4bpp.lz"); -const u32 gWallpaperIcon_Minun[] = INCBIN_U32("graphics/pokemon_storage/minun_icon.4bpp.lz"); -const u32 gWallpaperIcon_Togepi[] = INCBIN_U32("graphics/pokemon_storage/togepi_icon.4bpp.lz"); -const u32 gWallpaperIcon_Magma[] = INCBIN_U32("graphics/pokemon_storage/magma_icon.4bpp.lz"); +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"); -const struct WallpaperTable gFriendsWallpaperTable[] = +static const struct WallpaperTable gFriendsWallpaperTable[] = { WALLPAPER_ENTRY(Zigzagoon), WALLPAPER_ENTRY(Screen), @@ -1129,7 +1141,7 @@ const struct WallpaperTable gFriendsWallpaperTable[] = WALLPAPER_ENTRY(Whiscash), }; -const u32 *const gFriendsIcons[] = +static const u32 *const gFriendsIcons[] = { gWallpaperIcon_Aqua, gWallpaperIcon_Heart, @@ -1164,36 +1176,36 @@ const u32 *const gFriendsIcons[] = }; // Unknown Unused data. -const u16 gUnknown_0857B07C = 0x23BA; +static const u16 gUnknown_0857B07C = 0x23BA; -const struct SpriteSheet gUnknown_0857B080 = {gPCGfx_Arrow, 0x80, 6}; +static const struct SpriteSheet gUnknown_0857B080 = {gPCGfx_Arrow, 0x80, 6}; -const struct OamData gOamData_83BB298 = +static const struct OamData gOamData_83BB298 = { .shape = ST_OAM_H_RECTANGLE, .size = 2, .priority = 2 }; -const union AnimCmd gSpriteAnim_83BB2A0[] = +static const union AnimCmd gSpriteAnim_83BB2A0[] = { ANIMCMD_FRAME(0, 5), ANIMCMD_END }; -const union AnimCmd gSpriteAnim_83BB2A8[] = +static const union AnimCmd gSpriteAnim_83BB2A8[] = { ANIMCMD_FRAME(8, 5), ANIMCMD_END }; -const union AnimCmd *const gSpriteAnimTable_83BB2B0[] = +static const union AnimCmd *const gSpriteAnimTable_83BB2B0[] = { gSpriteAnim_83BB2A0, gSpriteAnim_83BB2A8 }; -const struct SpriteTemplate gSpriteTemplate_857B0A8 = +static const struct SpriteTemplate gSpriteTemplate_857B0A8 = { TAG_TILE_3, TAG_PAL_DAC9, @@ -1204,31 +1216,31 @@ const struct SpriteTemplate gSpriteTemplate_857B0A8 = SpriteCallbackDummy }; -const struct OamData gOamData_83BB2D0 = +static const struct OamData gOamData_83BB2D0 = { .shape = ST_OAM_V_RECTANGLE, .priority = 2 }; -const union AnimCmd gSpriteAnim_83BB2D8[] = +static const union AnimCmd gSpriteAnim_83BB2D8[] = { ANIMCMD_FRAME(0, 5), ANIMCMD_END }; -const union AnimCmd gSpriteAnim_83BB2E0[] = +static const union AnimCmd gSpriteAnim_83BB2E0[] = { ANIMCMD_FRAME(2, 5), ANIMCMD_END }; -const union AnimCmd *const gSpriteAnimTable_83BB2E8[] = +static const union AnimCmd *const gSpriteAnimTable_83BB2E8[] = { gSpriteAnim_83BB2D8, gSpriteAnim_83BB2E0 }; -const struct SpriteTemplate gUnknown_0857B0E0 = +static const struct SpriteTemplate gUnknown_0857B0E0 = { 6, 0xDACA, @@ -1243,28 +1255,6 @@ const u16 gHandCursorPalette[] = INCBIN_U16("graphics/pokemon_storage/hand_curso const u8 gHandCursorTiles[] = INCBIN_U8("graphics/pokemon_storage/hand_cursor.4bpp"); const u8 gHandCursorShadowTiles[] = INCBIN_U8("graphics/pokemon_storage/hand_cursor_shadow.4bpp"); -bool8 (*const gUnknown_0857B998[])(void) = -{ - MonPlaceChange_Move, - MonPlaceChange_Place, - MonPlaceChange_Shift, -}; - -struct -{ - s8 mapGroup; - s8 mapNum; - u16 move; -} const gUnknown_0857B9A4[] = -{ - {MAP_GROUPS_COUNT, 0, MOVE_SURF}, - {MAP_GROUPS_COUNT, 0, MOVE_DIVE}, - {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MOVE_STRENGTH}, - {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MOVE_ROCK_SMASH}, - {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MOVE_STRENGTH}, - {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MOVE_ROCK_SMASH}, -}; - // code u8 CountMonsInBox(u8 boxId) { @@ -1357,7 +1347,7 @@ u8 *StringCopyAndFillWithSpaces(u8 *dst, const u8 *src, u16 n) return str; } -void sub_80C7128(u16 *dest, u16 dest_left, u16 dest_top, const u16 *src, u16 src_left, u16 src_top, u16 dest_width, u16 dest_height, u16 src_width) +static void sub_80C7128(u16 *dest, u16 dest_left, u16 dest_top, const u16 *src, u16 src_left, u16 src_top, u16 dest_width, u16 dest_height, u16 src_width) { u16 i; @@ -1393,7 +1383,7 @@ void sub_80C7128(u16 *dest, u16 dest_left, u16 dest_top, const u16 *src, u16 src #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; @@ -1483,8 +1473,8 @@ void Task_PokemonStorageSystemPC(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; @@ -1493,8 +1483,8 @@ void Task_PokemonStorageSystemPC(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; @@ -1607,7 +1597,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 = { @@ -1631,7 +1621,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); @@ -1639,12 +1629,12 @@ 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(); } @@ -1674,7 +1664,7 @@ u8 sub_80C78F0(void) return 200; } -void sub_80C7958(u8 curBox) +static void sub_80C7958(u8 curBox) { u16 i; u8 spriteId; @@ -1728,7 +1718,7 @@ void sub_80C7958(u8 curBox) sub_80C7BE4(); } -void sub_80C7B14(void) +static void sub_80C7B14(void) { u16 i; if (gUnknown_02039D04->unk_0000) @@ -1751,20 +1741,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; @@ -1795,7 +1785,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) { @@ -1879,7 +1869,7 @@ void ResetAllBgCoords(void) SetGpuReg(REG_OFFSET_BG3VOFS, 0); } -void sub_80C7E98(void) +static void sub_80C7E98(void) { ResetPaletteFade(); ResetSpriteData(); @@ -1896,14 +1886,14 @@ void sub_80C7E98(void) gUnknown_02039D08->unk_02C7 = 0; } -void sub_80C7F1C(void) +static void sub_80C7F1C(void) { sub_80CDC0C(); sInPartyMenu = (gUnknown_02039D08->boxOption == BOX_OPTION_DEPOSIT); gUnknown_02039D0E = 0; } -void sub_80C7F4C(void) +static void sub_80C7F4C(void) { if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) { @@ -1913,13 +1903,13 @@ void sub_80C7F4C(void) SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_1D_MAP); } -void SetPSSCallback(TaskFunc newFunc) +static void SetPSSCallback(TaskFunc newFunc) { gTasks[gUnknown_02039D08->taskId].func = newFunc; gUnknown_02039D08->state = 0; } -void Cb_InitPSS(u8 taskId) +static void Cb_InitPSS(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2029,7 +2019,7 @@ void Cb_InitPSS(u8 taskId) gUnknown_02039D08->state++; } -void Cb_ShowPSS(u8 taskId) +static void Cb_ShowPSS(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2045,7 +2035,7 @@ void Cb_ShowPSS(u8 taskId) } } -void Cb_ReshowPSS(u8 taskId) +static void Cb_ReshowPSS(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2081,12 +2071,12 @@ void Cb_ReshowPSS(u8 taskId) } } -void Cb_MainPSS(u8 taskId) +static void Cb_MainPSS(u8 taskId) { switch (gUnknown_02039D08->state) { case 0: - switch (sub_80CF9EC()) + switch (HandleInput()) { case 1: PlaySE(SE_SELECT); @@ -2107,7 +2097,7 @@ void Cb_MainPSS(u8 taskId) case 6: if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_MONS) { - if (IsMonBeingMoved() && ItemIsMail(gUnknown_02039D08->selectedItem)) + if (IsMonBeingMoved() && ItemIsMail(gUnknown_02039D08->cursorMonItem)) gUnknown_02039D08->state = 5; else SetPSSCallback(Cb_HidePartyPokemon); @@ -2163,9 +2153,9 @@ void Cb_MainPSS(u8 taskId) } break; case 11: - if (!CanMoveMon()) + if (!CanMovePartyMon()) { - if (ItemIsMail(gUnknown_02039D08->selectedItem)) + if (ItemIsMail(gUnknown_02039D08->cursorMonItem)) { gUnknown_02039D08->state = 5; } @@ -2181,7 +2171,7 @@ void Cb_MainPSS(u8 taskId) } break; case 13: - if (CanMoveMon()) + if (CanMovePartyMon()) { gUnknown_02039D08->state = 4; } @@ -2343,7 +2333,7 @@ void Cb_MainPSS(u8 taskId) } } -void Cb_ShowPartyPokemon(u8 taskId) +static void Cb_ShowPartyPokemon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2358,7 +2348,7 @@ void Cb_ShowPartyPokemon(u8 taskId) } } -void Cb_HidePartyPokemon(u8 taskId) +static void Cb_HidePartyPokemon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2385,7 +2375,7 @@ void Cb_HidePartyPokemon(u8 taskId) } } -void Cb_OnSelectedMon(u8 taskId) +static void Cb_OnSelectedMon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2395,12 +2385,12 @@ void Cb_OnSelectedMon(u8 taskId) PlaySE(SE_SELECT); if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) PrintStorageActionText(PC_TEXT_IS_SELECTED); - else if (sub_80D127C() || gUnknown_02039D08->selectedItem != 0) + else if (sub_80D127C() || gUnknown_02039D08->cursorMonItem != 0) PrintStorageActionText(PC_TEXT_IS_SELECTED2); else PrintStorageActionText(PC_TEXT_GIVE_TO_MON); - sub_80CFFD0(); + AddMenu(); gUnknown_02039D08->state = 1; } break; @@ -2417,7 +2407,7 @@ void Cb_OnSelectedMon(u8 taskId) SetPSSCallback(Cb_MainPSS); break; case 3: - if (CanMoveMon()) + if (CanMovePartyMon()) { gUnknown_02039D08->state = 3; } @@ -2451,11 +2441,11 @@ void Cb_OnSelectedMon(u8 taskId) SetPSSCallback(Cb_WithdrawMon); break; case 1: - if (CanMoveMon()) + if (CanMovePartyMon()) { gUnknown_02039D08->state = 3; } - else if (ItemIsMail(gUnknown_02039D08->selectedItem)) + else if (ItemIsMail(gUnknown_02039D08->cursorMonItem)) { gUnknown_02039D08->state = 4; } @@ -2467,15 +2457,15 @@ void Cb_OnSelectedMon(u8 taskId) } break; case 7: - if (CanMoveMon()) + if (CanMovePartyMon()) { gUnknown_02039D08->state = 3; } - else if (gUnknown_02039D08->field_CED) + else if (gUnknown_02039D08->cursorMonIsEgg) { gUnknown_02039D08->state = 5; // Cannot release an Egg. } - else if (ItemIsMail(gUnknown_02039D08->selectedItem)) + else if (ItemIsMail(gUnknown_02039D08->cursorMonItem)) { gUnknown_02039D08->state = 4; } @@ -2542,7 +2532,7 @@ void Cb_OnSelectedMon(u8 taskId) } } -void Cb_MoveMon(u8 taskId) +static void Cb_MoveMon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2562,7 +2552,7 @@ void Cb_MoveMon(u8 taskId) } } -void Cb_PlaceMon(u8 taskId) +static void Cb_PlaceMon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2582,7 +2572,7 @@ void Cb_PlaceMon(u8 taskId) } } -void Cb_ShiftMon(u8 taskId) +static void Cb_ShiftMon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2600,7 +2590,7 @@ void Cb_ShiftMon(u8 taskId) } } -void Cb_WithdrawMon(u8 taskId) +static void Cb_WithdrawMon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2627,7 +2617,7 @@ void Cb_WithdrawMon(u8 taskId) case 2: if (!DoMonPlaceChange()) { - sub_80CC0D4(1); + SetMovingMonPriority(1); SetUpDoShowPartyMenu(); gUnknown_02039D08->state++; } @@ -2652,7 +2642,7 @@ void Cb_WithdrawMon(u8 taskId) } } -void Cb_DepositMenu(u8 taskId) +static void Cb_DepositMenu(u8 taskId) { u8 boxId; @@ -2715,7 +2705,7 @@ void Cb_DepositMenu(u8 taskId) } } -void Cb_ReleaseMon(u8 taskId) +static void Cb_ReleaseMon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2734,25 +2724,25 @@ void Cb_ReleaseMon(u8 taskId) break; case 0: ClearBottomWindow(); - sub_80CE3A0(); + InitCanRelaseMonVars(); sub_80CE250(); gUnknown_02039D08->state++; break; } break; case 2: - sub_80CE580(); + RunCanReleaseMon(); if (!sub_80CE2A8()) { while (1) { - s8 r0 = sub_80CE580(); + s8 r0 = RunCanReleaseMon(); if (r0 == 1) { gUnknown_02039D08->state++; break; } - if (r0 == 0) + else if (r0 == 0) { gUnknown_02039D08->state = 8; // Can't release the mon. break; @@ -2761,8 +2751,8 @@ void Cb_ReleaseMon(u8 taskId) } break; case 3: - sub_80CE2D8(); - sub_80CA230(); + ReleaseMon(); + RefreshCursorMonData(); PrintStorageActionText(PC_TEXT_WAS_RELEASED); gUnknown_02039D08->state++; break; @@ -2845,14 +2835,14 @@ void Cb_ReleaseMon(u8 taskId) } } -void Cb_ShowMarkMenu(u8 taskId) +static void Cb_ShowMarkMenu(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->field_DA4.markings = gUnknown_02039D08->cursorMonMarkings; + sub_811FAA4(gUnknown_02039D08->cursorMonMarkings, 0xb0, 0x10); gUnknown_02039D08->state++; break; case 1: @@ -2860,20 +2850,20 @@ void Cb_ShowMarkMenu(u8 taskId) { sub_811FAF8(); ClearBottomWindow(); - sub_80CE9A8(gUnknown_02039D08->field_DA4.markings); - sub_80CA230(); + SetMonMarkings(gUnknown_02039D08->field_DA4.markings); + RefreshCursorMonData(); SetPSSCallback(Cb_MainPSS); } break; } } -void Cb_TakeItemForMoving(u8 taskId) +static void Cb_TakeItemForMoving(u8 taskId) { switch (gUnknown_02039D08->state) { case 0: - if (!ItemIsMail(gUnknown_02039D08->selectedItem)) + if (!ItemIsMail(gUnknown_02039D08->cursorMonItem)) { ClearBottomWindow(); gUnknown_02039D08->state++; @@ -2905,7 +2895,7 @@ void Cb_TakeItemForMoving(u8 taskId) } } -void Cb_GiveMovingItemToMon(u8 taskId) +static void Cb_GiveMovingItemToMon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2942,12 +2932,12 @@ void Cb_GiveMovingItemToMon(u8 taskId) } } -void Cb_ItemToBag(u8 taskId) +static void Cb_ItemToBag(u8 taskId) { switch (gUnknown_02039D08->state) { case 0: - if (!AddBagItem(gUnknown_02039D08->selectedItem, 1)) + if (!AddBagItem(gUnknown_02039D08->cursorMonItem, 1)) { PlaySE(SE_HAZURE); PrintStorageActionText(PC_TEXT_BAG_FULL); @@ -2990,12 +2980,12 @@ void Cb_ItemToBag(u8 taskId) } } -void Cb_SwitchSelectedItem(u8 taskId) +static void Cb_SwitchSelectedItem(u8 taskId) { switch (gUnknown_02039D08->state) { case 0: - if (!ItemIsMail(gUnknown_02039D08->selectedItem)) + if (!ItemIsMail(gUnknown_02039D08->cursorMonItem)) { ClearBottomWindow(); gUnknown_02039D08->state++; @@ -3034,7 +3024,7 @@ void Cb_SwitchSelectedItem(u8 taskId) } } -void Cb_ShowItemInfo(u8 taskId) +static void Cb_ShowItemInfo(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3077,7 +3067,7 @@ void Cb_ShowItemInfo(u8 taskId) } } -void Cb_CloseBoxWhileHoldingItem(u8 taskId) +static void Cb_CloseBoxWhileHoldingItem(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3134,7 +3124,7 @@ void Cb_CloseBoxWhileHoldingItem(u8 taskId) } } -void Cb_HandleMovingMonFromParty(u8 taskId) +static void Cb_HandleMovingMonFromParty(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3153,7 +3143,7 @@ void Cb_HandleMovingMonFromParty(u8 taskId) } } -void Cb_PrintCantStoreMail(u8 taskId) +static void Cb_PrintCantStoreMail(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3179,13 +3169,13 @@ void Cb_PrintCantStoreMail(u8 taskId) } } -void Cb_HandleBoxOptions(u8 taskId) +static void Cb_HandleBoxOptions(u8 taskId) { switch (gUnknown_02039D08->state) { case 0: PrintStorageActionText(PC_TEXT_WHAT_YOU_DO); - sub_80CFFD0(); + AddMenu(); gUnknown_02039D08->state++; break; case 1: @@ -3220,12 +3210,12 @@ void Cb_HandleBoxOptions(u8 taskId) } } -void Cb_HandleWallpapers(u8 taskId) +static void Cb_HandleWallpapers(u8 taskId) { switch (gUnknown_02039D08->state) { case 0: - sub_80CADD8(); + AddWallpaperSetsMenu(); PrintStorageActionText(PC_TEXT_PICK_A_THEME); gUnknown_02039D08->state++; break; @@ -3261,7 +3251,7 @@ void Cb_HandleWallpapers(u8 taskId) case 3: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_80CAE0C(gUnknown_02039D08->wallpaperSetId); + AddWallpapersMenu(gUnknown_02039D08->wallpaperSetId); PrintStorageActionText(PC_TEXT_PICK_A_WALLPAPER); gUnknown_02039D08->state++; } @@ -3302,7 +3292,7 @@ void Cb_HandleWallpapers(u8 taskId) } } -void Cb_JumpBox(u8 taskId) +static void Cb_JumpBox(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3348,7 +3338,7 @@ void Cb_JumpBox(u8 taskId) } } -void Cb_NameBox(u8 taskId) +static void Cb_NameBox(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3368,7 +3358,7 @@ void Cb_NameBox(u8 taskId) } } -void Cb_ShowMonSummary(u8 taskId) +static void Cb_ShowMonSummary(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3388,7 +3378,7 @@ void Cb_ShowMonSummary(u8 taskId) } } -void Cb_GiveItemFromBag(u8 taskId) +static void Cb_GiveItemFromBag(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3407,7 +3397,7 @@ void Cb_GiveItemFromBag(u8 taskId) } } -void Cb_OnCloseBoxPressed(u8 taskId) +static void Cb_OnCloseBoxPressed(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3468,7 +3458,7 @@ void Cb_OnCloseBoxPressed(u8 taskId) } } -void Cb_OnBPressed(u8 taskId) +static void Cb_OnBPressed(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3529,7 +3519,7 @@ void Cb_OnBPressed(u8 taskId) } } -void Cb_ChangeScreen(u8 taskId) +static void Cb_ChangeScreen(u8 taskId) { struct BoxPokemon *boxMons; u8 mode, monIndex, maxMonIndex; @@ -3548,7 +3538,7 @@ void Cb_ChangeScreen(u8 taskId) SetMainCallback2(Cb2_ExitPSS); break; case SCREEN_CHANGE_SUMMARY_SCREEN: - boxMons = gUnknown_02039D08->field_218C; + boxMons = gUnknown_02039D08->field_218C.box; monIndex = gUnknown_02039D08->field_2187; maxMonIndex = gUnknown_02039D08->field_2186; mode = gUnknown_02039D08->field_2188; @@ -3596,7 +3586,7 @@ void FreePSSData(void) FreeAllWindowBuffers(); } -void SetScrollingBackground(void) +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); @@ -3637,7 +3627,7 @@ void LoadWaveformSpritePalette(void) LoadSpritePalette(&gWaveformSpritePalette); } -void sub_80CA0D8(void) +static void sub_80CA0D8(void) { LoadPalette(gUnknown_085723DC, 0, 0x20); LoadPalette(gUnknown_085723FC, 0x20, 0x20); @@ -3651,10 +3641,10 @@ void sub_80CA0D8(void) LoadCursorMonSprite(); sub_80CA154(); sub_80CA1C4(); - sub_80CA230(); + RefreshCursorMonData(); } -void sub_80CA154(void) +static void sub_80CA154(void) { gUnknown_02039D08->field_D94 = sub_811FFB4(TAG_TILE_10, TAG_PAL_DAC8, NULL); gUnknown_02039D08->field_D94->oam.priority = 1; @@ -3664,7 +3654,7 @@ void sub_80CA154(void) gUnknown_02039D08->field_DA0 = (void*) OBJ_VRAM0 + 32 * GetSpriteTileStartByTag(TAG_TILE_10); } -void sub_80CA1C4(void) +static void sub_80CA1C4(void) { u16 i; struct SpriteSheet sheet = gWaveformSpriteSheet; @@ -3677,7 +3667,7 @@ void sub_80CA1C4(void) } } -void sub_80CA230(void) +void RefreshCursorMonData(void) { LoadCursorMonGfx(gUnknown_02039D08->cursorMonSpecies, gUnknown_02039D08->cursorMonPersonality); PrintCursorMonInfo(); @@ -3687,7 +3677,7 @@ void sub_80CA230(void) void BoxSetMosaic(void) { - sub_80CA230(); + RefreshCursorMonData(); if (gUnknown_02039D08->cursorMonSprite) { gUnknown_02039D08->cursorMonSprite->oam.mosaic = TRUE; @@ -3703,7 +3693,7 @@ u8 sub_80CA2B8(void) return gUnknown_02039D08->cursorMonSprite->oam.mosaic; } -void sub_80CA2D0(struct Sprite *sprite) +static void sub_80CA2D0(struct Sprite *sprite) { sprite->data[0] -= sprite->data[1]; if (sprite->data[0] < 0) @@ -3767,7 +3757,7 @@ void LoadCursorMonGfx(u16 species, u32 pid) if (species != SPECIES_NONE) { LoadSpecialPokePic(&gMonFrontPicTable[species], gUnknown_02039D08->field_22C4, species, pid, TRUE); - LZ77UnCompWram(gUnknown_02039D08->field_CDC, gUnknown_02039D08->field_2244); + LZ77UnCompWram(gUnknown_02039D08->cursorMonPalette, gUnknown_02039D08->field_2244); CpuCopy32(gUnknown_02039D08->field_22C4, gUnknown_02039D08->field_223C, 0x800); LoadPalette(gUnknown_02039D08->field_2244, gUnknown_02039D08->field_223A, 0x20); gUnknown_02039D08->cursorMonSprite->invisible = FALSE; @@ -3778,12 +3768,12 @@ void LoadCursorMonGfx(u16 species, u32 pid) } } -void PrintCursorMonInfo(void) +static void PrintCursorMonInfo(void) { FillWindowPixelBuffer(0, 0x11); if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) { - AddTextPrinterParameterized(0, 1, gUnknown_02039D08->cursorMonNick, 6, 0, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, 1, gUnknown_02039D08->cursorMonNickText, 6, 0, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(0, 2, gUnknown_02039D08->cursorMonSpeciesName, 6, 15, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(0, 2, gUnknown_02039D08->cursorMonGenderLvlText, 10, 29, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(0, 0, gUnknown_02039D08->cursorMonItemName, 6, 43, TEXT_SPEED_FF, NULL); @@ -3791,7 +3781,7 @@ void PrintCursorMonInfo(void) else { AddTextPrinterParameterized(0, 0, gUnknown_02039D08->cursorMonItemName, 6, 0, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(0, 1, gUnknown_02039D08->cursorMonNick, 6, 13, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, 1, gUnknown_02039D08->cursorMonNickText, 6, 13, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(0, 2, gUnknown_02039D08->cursorMonSpeciesName, 6, 28, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(0, 2, gUnknown_02039D08->cursorMonGenderLvlText, 10, 42, TEXT_SPEED_FF, NULL); } @@ -3799,7 +3789,7 @@ void PrintCursorMonInfo(void) CopyWindowToVram(0, 2); if (gUnknown_02039D08->cursorMonSpecies != SPECIES_NONE) { - sub_8120084(gUnknown_02039D08->field_CEB, gUnknown_02039D08->field_DA0); + sub_8120084(gUnknown_02039D08->cursorMonMarkings, gUnknown_02039D08->field_DA0); gUnknown_02039D08->field_D94->invisible = FALSE; } else @@ -3808,7 +3798,7 @@ void PrintCursorMonInfo(void) } } -void sub_80CA65C(void) +static void sub_80CA65C(void) { u16 i; @@ -3829,7 +3819,7 @@ void sub_80CA65C(void) schedule_bg_copy_tilemap_to_vram(1); } -void sub_80CA704(void) +static void sub_80CA704(void) { LZ77UnCompWram(gUnknown_08DD36C8, gUnknown_02039D08->field_B0); LoadPalette(gPSSMenu_Pal, 0x10, 0x20); @@ -3857,7 +3847,7 @@ void sub_80CA704(void) gUnknown_02039D08->unk_02C7 = 0; } -void SetUpShowPartyMenu(void) +static void SetUpShowPartyMenu(void) { gUnknown_02039D08->field_2C0 = 20; gUnknown_02039D08->field_2C2 = 2; @@ -3865,7 +3855,7 @@ void SetUpShowPartyMenu(void) CreatePartyMonsSprites(FALSE); } -bool8 ShowPartyMenu(void) +static bool8 ShowPartyMenu(void) { if (gUnknown_02039D08->field_2C5 == 20) return FALSE; @@ -3887,7 +3877,7 @@ bool8 ShowPartyMenu(void) } } -void SetUpHidePartyMenu(void) +static void SetUpHidePartyMenu(void) { gUnknown_02039D08->field_2C0 = 0; gUnknown_02039D08->field_2C2 = 22; @@ -3896,7 +3886,7 @@ void SetUpHidePartyMenu(void) sub_80D11CC(); } -bool8 HidePartyMenu(void) +static bool8 HidePartyMenu(void) { if (gUnknown_02039D08->field_2C5 != 20) { @@ -3926,7 +3916,7 @@ bool8 HidePartyMenu(void) return FALSE; } -void sub_80CA984(bool8 arg0) +static void sub_80CA984(bool8 arg0) { if (arg0) sub_80D27AC(2, 0, 0, 9, 2); @@ -3937,14 +3927,14 @@ void sub_80CA984(bool8 arg0) schedule_bg_copy_tilemap_to_vram(1); } -void sub_80CA9C0(void) +static void sub_80CA9C0(void) { gUnknown_02039D08->unk_02C7 = 1; gUnknown_02039D08->unk_02C8 = 30; gUnknown_02039D08->unk_02C9 = TRUE; } -void sub_80CA9EC(void) +static void sub_80CA9EC(void) { if (gUnknown_02039D08->unk_02C7) { @@ -3953,7 +3943,7 @@ void sub_80CA9EC(void) } } -void sub_80CAA14(void) +static void sub_80CAA14(void) { if (gUnknown_02039D08->unk_02C7 && ++gUnknown_02039D08->unk_02C8 > 30) { @@ -3963,7 +3953,7 @@ void sub_80CAA14(void) } } -void sub_80CAA74(void) +static void sub_80CAA74(void) { u8 i; @@ -3974,7 +3964,7 @@ void sub_80CAA74(void) } } -void sub_80CAAA8(u8 arg0, bool8 isPartyMon) +static void sub_80CAAA8(u8 arg0, bool8 isPartyMon) { u16 i, j, index; const u16 *data; @@ -3998,7 +3988,7 @@ void sub_80CAAA8(u8 arg0, bool8 isPartyMon) } } -void sub_80CAB20(void) +static void sub_80CAB20(void) { sub_80CAA74(); sub_80D27AC(1, 0, 0, 12, 22); @@ -4006,14 +3996,14 @@ void sub_80CAB20(void) schedule_bg_copy_tilemap_to_vram(1); } -void SetUpDoShowPartyMenu(void) +static void SetUpDoShowPartyMenu(void) { gUnknown_02039D08->showPartyMenuState = 0; PlaySE(SE_WIN_OPEN); SetUpShowPartyMenu(); } -bool8 DoShowPartyMenu(void) +static bool8 DoShowPartyMenu(void) { switch (gUnknown_02039D08->showPartyMenuState) { @@ -4038,7 +4028,7 @@ bool8 DoShowPartyMenu(void) return TRUE; } -void sub_80CABE0(void) +static void sub_80CABE0(void) { if (gUnknown_02039D10 != StorageGetCurrentBox()) { @@ -4047,7 +4037,7 @@ void sub_80CABE0(void) } } -void sub_80CAC1C(void) +static void sub_80CAC1C(void) { SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(29)); LoadUserWindowBorderGfx(1, 2, 208); @@ -4067,7 +4057,7 @@ void PrintStorageActionText(u8 id) case PC_TEXT_FMT_MON_NAME_1: case PC_TEXT_FMT_MON_NAME_2: case PC_TEXT_FMT_MON_NAME_3: - DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_02039D08->field_CEE); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_02039D08->cursorMonNick); break; case PC_TEXT_FMT_MON_NAME_4: case PC_TEXT_FMT_MON_NAME_5: @@ -4100,7 +4090,7 @@ void PrintStorageActionText(u8 id) void ShowYesNoWindow(s8 cursorPos) { CreateYesNoMenu(&sYesNoWindowTemplate, 11, 14, 0); - MoveMenuCursorNoWrapAround(cursorPos); + Menu_MoveCursorNoWrapAround(cursorPos); } void ClearBottomWindow(void) @@ -4109,49 +4099,49 @@ void ClearBottomWindow(void) schedule_bg_copy_tilemap_to_vram(0); } -void sub_80CADD8(void) +static void AddWallpaperSetsMenu(void) { - sub_80CFEF0(); - sub_80CFF34(18); - sub_80CFF34(19); - sub_80CFF34(20); - sub_80CFF34(21); + InitMenu(); + SetMenuText(18); + SetMenuText(19); + SetMenuText(20); + SetMenuText(21); if (IsWaldaWallpaperUnlocked()) - sub_80CFF34(22); - sub_80CFFD0(); + SetMenuText(22); + AddMenu(); } -void sub_80CAE0C(u8 wallpaperSet) +static void AddWallpapersMenu(u8 wallpaperSet) { - sub_80CFEF0(); + InitMenu(); switch (wallpaperSet) { case 0: - sub_80CFF34(23); - sub_80CFF34(24); - sub_80CFF34(25); - sub_80CFF34(26); + SetMenuText(23); + SetMenuText(24); + SetMenuText(25); + SetMenuText(26); break; case 1: - sub_80CFF34(27); - sub_80CFF34(28); - sub_80CFF34(29); - sub_80CFF34(30); + SetMenuText(27); + SetMenuText(28); + SetMenuText(29); + SetMenuText(30); break; case 2: - sub_80CFF34(31); - sub_80CFF34(32); - sub_80CFF34(33); - sub_80CFF34(34); + SetMenuText(31); + SetMenuText(32); + SetMenuText(33); + SetMenuText(34); break; case 3: - sub_80CFF34(35); - sub_80CFF34(36); - sub_80CFF34(37); - sub_80CFF34(38); + SetMenuText(35); + SetMenuText(36); + SetMenuText(37); + SetMenuText(38); break; } - sub_80CFFD0(); + AddMenu(); } u8 GetCurrentBoxOption(void) @@ -4159,7 +4149,7 @@ u8 GetCurrentBoxOption(void) return sCurrentBoxOption; } -void sub_80CAEAC(void) +static void sub_80CAEAC(void) { if (!IsCursorOnBox()) { @@ -4176,7 +4166,7 @@ void sub_80CAEAC(void) } } -void sub_80CAF04(void) +static void sub_80CAF04(void) { u16 i; @@ -4190,7 +4180,7 @@ void sub_80CAF04(void) for (i = 0; i < IN_BOX_COUNT; i++) gUnknown_02039D08->boxMonsSprites[i] = NULL; - gUnknown_02039D08->field_A6C = NULL; + gUnknown_02039D08->movingMonSprite = NULL; gUnknown_02039D08->field_78C = 0; } @@ -4199,17 +4189,17 @@ u8 sub_80CAFAC(void) return (IsCursorInBox() ? 2 : 1); } -void sub_80CAFC4(void) +void CreateMovingMonIcon(void) { - u32 personality = GetMonData(&gUnknown_02039D08->field_20A4, MON_DATA_PERSONALITY); - u16 species = GetMonData(&gUnknown_02039D08->field_20A4, MON_DATA_SPECIES2); + u32 personality = GetMonData(&gUnknown_02039D08->movingMon, MON_DATA_PERSONALITY); + u16 species = GetMonData(&gUnknown_02039D08->movingMon, MON_DATA_SPECIES2); u8 priority = sub_80CAFAC(); - gUnknown_02039D08->field_A6C = CreateMonIconSprite(species, personality, 0, 0, priority, 7); - gUnknown_02039D08->field_A6C->callback = sub_80CC100; + gUnknown_02039D08->movingMonSprite = CreateMonIconSprite(species, personality, 0, 0, priority, 7); + gUnknown_02039D08->movingMonSprite->callback = sub_80CC100; } -void sub_80CB028(u8 boxId) +static void sub_80CB028(u8 boxId) { u8 boxPosition; u16 i, j, count; @@ -4263,7 +4253,7 @@ void sub_80CB140(u8 boxPosition) } } -void sub_80CB1F0(s16 arg0) +static void sub_80CB1F0(s16 arg0) { u16 i; @@ -4278,7 +4268,7 @@ void sub_80CB1F0(s16 arg0) } } -void sub_80CB234(struct Sprite *sprite) +static void sub_80CB234(struct Sprite *sprite) { if (sprite->data[1] != 0) { @@ -4293,7 +4283,7 @@ void sub_80CB234(struct Sprite *sprite) } } -void sub_80CB278(struct Sprite *sprite) +static void sub_80CB278(struct Sprite *sprite) { if (sprite->data[4] != 0) { @@ -4308,7 +4298,7 @@ void sub_80CB278(struct Sprite *sprite) } } -void DestroyAllIconsInRow(u8 row) +static void DestroyAllIconsInRow(u8 row) { u16 column; u8 boxPosition = row; @@ -4384,7 +4374,7 @@ u8 sub_80CB2F8(u8 row, u16 times, s16 xDelta) return count; } -void sub_80CB4CC(u8 boxId, s8 direction) +static void sub_80CB4CC(u8 boxId, s8 direction) { gUnknown_02039D08->field_C6A = 0; gUnknown_02039D08->field_C6B = boxId; @@ -4402,7 +4392,7 @@ void sub_80CB4CC(u8 boxId, s8 direction) sub_80CB1F0(gUnknown_02039D08->field_C64); } -bool8 sub_80CB584(void) +static bool8 sub_80CB584(void) { if (gUnknown_02039D08->field_C60 != 0) gUnknown_02039D08->field_C60--; @@ -4446,7 +4436,7 @@ bool8 sub_80CB584(void) return TRUE; } -void SetBoxSpeciesAndPersonalities(u8 boxId) +static void SetBoxSpeciesAndPersonalities(u8 boxId) { s32 i, j, boxPosition; @@ -4524,7 +4514,7 @@ void CreatePartyMonsSprites(bool8 arg0) } } -void sub_80CB950(void) +static void sub_80CB950(void) { u16 i, count; @@ -4549,7 +4539,7 @@ u8 sub_80CB9BC(void) return gUnknown_02039D08->field_C5E; } -void sub_80CB9D0(struct Sprite *sprite, u16 partyId) +static void sub_80CB9D0(struct Sprite *sprite, u16 partyId) { s16 x, y; @@ -4567,7 +4557,7 @@ void sub_80CB9D0(struct Sprite *sprite, u16 partyId) sprite->callback = sub_80CBA3C; } -void sub_80CBA3C(struct Sprite *sprite) +static void sub_80CBA3C(struct Sprite *sprite) { if (sprite->data[6] != 0) { @@ -4595,16 +4585,16 @@ void sub_80CBA3C(struct Sprite *sprite) } } -void sub_80CBAC4(void) +static void DestroyMovingMonIcon(void) { - if (gUnknown_02039D08->field_A6C != NULL) + if (gUnknown_02039D08->movingMonSprite != NULL) { - DestroyBoxMonIcon(gUnknown_02039D08->field_A6C); - gUnknown_02039D08->field_A6C = NULL; + DestroyBoxMonIcon(gUnknown_02039D08->movingMonSprite); + gUnknown_02039D08->movingMonSprite = NULL; } } -void sub_80CBAF0(s16 yDelta) +static void sub_80CBAF0(s16 yDelta) { u16 i, posY; @@ -4623,7 +4613,7 @@ void sub_80CBAF0(s16 yDelta) } } -void DestroyPartyMonIcon(u8 partyId) +static void DestroyPartyMonIcon(u8 partyId) { if (gUnknown_02039D08->partySprites[partyId] != NULL) { @@ -4632,7 +4622,7 @@ void DestroyPartyMonIcon(u8 partyId) } } -void DestroyAllPartyMonIcons(void) +static void DestroyAllPartyMonIcons(void) { u16 i; @@ -4654,16 +4644,16 @@ void SetPartyMonIconObjMode(u8 partyId, u8 objMode) } } -void sub_80CBC14(u8 mode, u8 id) +static void sub_80CBC14(u8 mode, u8 id) { if (mode == MODE_PARTY) { - gUnknown_02039D08->field_A6C = gUnknown_02039D08->partySprites[id]; + gUnknown_02039D08->movingMonSprite = gUnknown_02039D08->partySprites[id]; gUnknown_02039D08->partySprites[id] = NULL; } else if (mode == MODE_BOX) { - gUnknown_02039D08->field_A6C = gUnknown_02039D08->boxMonsSprites[id]; + gUnknown_02039D08->movingMonSprite = gUnknown_02039D08->boxMonsSprites[id]; gUnknown_02039D08->boxMonsSprites[id] = NULL; } else @@ -4671,41 +4661,41 @@ void sub_80CBC14(u8 mode, u8 id) return; } - gUnknown_02039D08->field_A6C->callback = sub_80CC100; - gUnknown_02039D08->field_A6C->oam.priority = sub_80CAFAC(); - gUnknown_02039D08->field_A6C->subpriority = 7; + gUnknown_02039D08->movingMonSprite->callback = sub_80CC100; + gUnknown_02039D08->movingMonSprite->oam.priority = sub_80CAFAC(); + gUnknown_02039D08->movingMonSprite->subpriority = 7; } -void sub_80CBCAC(u8 boxId, u8 position) +static void sub_80CBCAC(u8 boxId, u8 position) { if (boxId == TOTAL_BOXES_COUNT) // party mon { - gUnknown_02039D08->partySprites[position] = gUnknown_02039D08->field_A6C; + gUnknown_02039D08->partySprites[position] = gUnknown_02039D08->movingMonSprite; gUnknown_02039D08->partySprites[position]->oam.priority = 1; gUnknown_02039D08->partySprites[position]->subpriority = 12; } else { - gUnknown_02039D08->boxMonsSprites[position] = gUnknown_02039D08->field_A6C; + gUnknown_02039D08->boxMonsSprites[position] = gUnknown_02039D08->movingMonSprite; gUnknown_02039D08->boxMonsSprites[position]->oam.priority = 2; gUnknown_02039D08->boxMonsSprites[position]->subpriority = 19 - (position % IN_BOX_ROWS); } - gUnknown_02039D08->field_A6C->callback = SpriteCallbackDummy; - gUnknown_02039D08->field_A6C = NULL; + gUnknown_02039D08->movingMonSprite->callback = SpriteCallbackDummy; + gUnknown_02039D08->movingMonSprite = NULL; } -void sub_80CBD5C(u8 boxId, u8 position) +static void sub_80CBD5C(u8 boxId, u8 position) { if (boxId == TOTAL_BOXES_COUNT) // party mon gUnknown_02039D08->field_B00 = &gUnknown_02039D08->partySprites[position]; else gUnknown_02039D08->field_B00 = &gUnknown_02039D08->boxMonsSprites[position]; - gUnknown_02039D08->field_A6C->callback = SpriteCallbackDummy; + gUnknown_02039D08->movingMonSprite->callback = SpriteCallbackDummy; gUnknown_02039D08->field_C5D = 0; } -bool8 sub_80CBDC4(void) +static bool8 sub_80CBDC4(void) { if (gUnknown_02039D08->field_C5D == 16) return FALSE; @@ -4714,33 +4704,33 @@ bool8 sub_80CBDC4(void) if (gUnknown_02039D08->field_C5D & 1) { (*gUnknown_02039D08->field_B00)->pos1.y--; - gUnknown_02039D08->field_A6C->pos1.y++; + gUnknown_02039D08->movingMonSprite->pos1.y++; } (*gUnknown_02039D08->field_B00)->pos2.x = gSineTable[gUnknown_02039D08->field_C5D * 8] / 16; - gUnknown_02039D08->field_A6C->pos2.x = -(gSineTable[gUnknown_02039D08->field_C5D * 8] / 16); + gUnknown_02039D08->movingMonSprite->pos2.x = -(gSineTable[gUnknown_02039D08->field_C5D * 8] / 16); if (gUnknown_02039D08->field_C5D == 8) { - gUnknown_02039D08->field_A6C->oam.priority = (*gUnknown_02039D08->field_B00)->oam.priority; - gUnknown_02039D08->field_A6C->subpriority = (*gUnknown_02039D08->field_B00)->subpriority; + gUnknown_02039D08->movingMonSprite->oam.priority = (*gUnknown_02039D08->field_B00)->oam.priority; + gUnknown_02039D08->movingMonSprite->subpriority = (*gUnknown_02039D08->field_B00)->subpriority; (*gUnknown_02039D08->field_B00)->oam.priority = sub_80CAFAC(); (*gUnknown_02039D08->field_B00)->subpriority = 7; } if (gUnknown_02039D08->field_C5D == 16) { - struct Sprite *sprite = gUnknown_02039D08->field_A6C; - gUnknown_02039D08->field_A6C = (*gUnknown_02039D08->field_B00); + struct Sprite *sprite = gUnknown_02039D08->movingMonSprite; + gUnknown_02039D08->movingMonSprite = (*gUnknown_02039D08->field_B00); *gUnknown_02039D08->field_B00 = sprite; - gUnknown_02039D08->field_A6C->callback = sub_80CC100; + gUnknown_02039D08->movingMonSprite->callback = sub_80CC100; (*gUnknown_02039D08->field_B00)->callback = SpriteCallbackDummy; } return TRUE; } -void sub_80CBF14(u8 mode, u8 position) +static void sub_80CBF14(u8 mode, u8 position) { switch (mode) { @@ -4751,7 +4741,7 @@ void sub_80CBF14(u8 mode, u8 position) gUnknown_02039D08->field_B04 = &gUnknown_02039D08->boxMonsSprites[position]; break; case MODE_2: - gUnknown_02039D08->field_B04 = &gUnknown_02039D08->field_A6C; + gUnknown_02039D08->field_B04 = &gUnknown_02039D08->movingMonSprite; break; default: return; @@ -4766,7 +4756,7 @@ void sub_80CBF14(u8 mode, u8 position) } } -bool8 sub_80CBFD8(void) +static bool8 sub_80CBFD8(void) { if (*gUnknown_02039D08->field_B04 == NULL || (*gUnknown_02039D08->field_B04)->invisible) return FALSE; @@ -4777,7 +4767,7 @@ bool8 sub_80CBFD8(void) return TRUE; } -void sub_80CC020(void) +static void sub_80CC020(void) { if (*gUnknown_02039D08->field_B04 != NULL) { @@ -4787,7 +4777,7 @@ void sub_80CC020(void) } } -void sub_80CC064(void) +static void sub_80CC064(void) { if (*gUnknown_02039D08->field_B04 != NULL) { @@ -4796,7 +4786,7 @@ void sub_80CC064(void) } } -bool8 sub_80CC0A0(void) +static bool8 sub_80CC0A0(void) { if (gUnknown_02039D08->field_B04 == NULL) return FALSE; @@ -4807,18 +4797,18 @@ bool8 sub_80CC0A0(void) return TRUE; } -void sub_80CC0D4(u8 priority) +static void SetMovingMonPriority(u8 priority) { - gUnknown_02039D08->field_A6C->oam.priority = priority; + gUnknown_02039D08->movingMonSprite->oam.priority = priority; } -void sub_80CC100(struct Sprite *sprite) +static void sub_80CC100(struct Sprite *sprite) { sprite->pos1.x = gUnknown_02039D08->field_CB4->pos1.x; sprite->pos1.y = gUnknown_02039D08->field_CB4->pos1.y + gUnknown_02039D08->field_CB4->pos2.y + 4; } -u16 sub_80CC124(u16 species) +static u16 sub_80CC124(u16 species) { u16 i, var; @@ -4847,7 +4837,7 @@ u16 sub_80CC124(u16 species) return var; } -void sub_80CC1E0(u16 species) +static void sub_80CC1E0(u16 species) { u16 i; @@ -4887,25 +4877,25 @@ static struct Sprite *CreateMonIconSprite(u16 species, u32 personality, s16 x, s return &gSprites[spriteId]; } -void DestroyBoxMonIcon(struct Sprite *sprite) +static void DestroyBoxMonIcon(struct Sprite *sprite) { sub_80CC1E0(sprite->data[0]); DestroySprite(sprite); } -void sub_80CC32C(u8 boxId) +static void sub_80CC32C(u8 boxId) { u8 taskId = CreateTask(sub_80CC370, 2); gTasks[taskId].data[2] = boxId; } -bool8 sub_80CC35C(void) +static bool8 sub_80CC35C(void) { return FuncIsActiveTask(sub_80CC370); } -void sub_80CC370(u8 taskId) +static void sub_80CC370(u8 taskId) { struct Task *task = &gTasks[taskId]; @@ -4946,7 +4936,7 @@ void sub_80CC370(u8 taskId) task->data[0]++; } -void SetUpScrollToBox(u8 boxId) +static void SetUpScrollToBox(u8 boxId) { s8 direction = sub_80CC644(boxId); @@ -5014,14 +5004,14 @@ s8 sub_80CC644(u8 boxId) return (i < TOTAL_BOXES_COUNT / 2) ? 1 : -1; } -void SetWallpaperForCurrentBox(u8 wallpaperId) +static void SetWallpaperForCurrentBox(u8 wallpaperId) { u8 boxId = StorageGetCurrentBox(); SetBoxWallpaper(boxId, wallpaperId); gUnknown_02039D08->wallpaperChangeState = 0; } -bool8 DoWallpaperGfxChange(void) +static bool8 DoWallpaperGfxChange(void) { switch (gUnknown_02039D08->wallpaperChangeState) { @@ -5125,7 +5115,7 @@ bool32 WaitForWallpaperGfxLoad(void) return TRUE; } -void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2) +static void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2) { s16 var = (arg2 * 2) + 3; s16 x = ((gUnknown_02039D08->bg2_X / 8 + 10) + (direction * 24)) & 0x3F; @@ -5142,7 +5132,7 @@ void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2) FillBgTilemapBufferRect(2, 0, x, 2, 4, 0x12, 0x11); } -void sub_80CCAE0(void *arg0) +static void sub_80CCAE0(void *arg0) { u16 i; u16 *dest = arg0; @@ -5164,7 +5154,7 @@ void sub_80CCAE0(void *arg0) } } -void sub_80CCB50(u8 boxId) +static void sub_80CCB50(u8 boxId) { u8 tagIndex; s16 r6; @@ -5205,7 +5195,7 @@ void sub_80CCB50(u8 boxId) gUnknown_02039D08->field_6F8 = 0; } -void sub_80CCCFC(u8 boxId, s8 direction) +static void sub_80CCCFC(u8 boxId, s8 direction) { u16 r8; s16 x, x2; @@ -5252,7 +5242,7 @@ void sub_80CCCFC(u8 boxId, s8 direction) } } -void sub_80CCEE0(void) +static void sub_80CCEE0(void) { if (gUnknown_02039D08->field_6F8 == 0) FreeSpriteTilesByTag(TAG_TILE_4); @@ -5263,7 +5253,7 @@ void sub_80CCEE0(void) gUnknown_02039D08->field_720[1] = gUnknown_02039D08->field_728[1]; } -void sub_80CCF30(struct Sprite *sprite) +static void sub_80CCF30(struct Sprite *sprite) { if (sprite->data[2] != 0) sprite->data[2]--; @@ -5271,7 +5261,7 @@ void sub_80CCF30(struct Sprite *sprite) sprite->callback = SpriteCallbackDummy; } -void sub_80CCF64(struct Sprite *sprite) +static void sub_80CCF64(struct Sprite *sprite) { if (sprite->data[1] != 0) { @@ -5286,7 +5276,7 @@ void sub_80CCF64(struct Sprite *sprite) } } -void sub_80CCF9C(void) +static void sub_80CCF9C(void) { u8 boxId = StorageGetCurrentBox(); u8 wallpaperId = GetBoxWallpaper(boxId); @@ -5296,12 +5286,12 @@ void sub_80CCF9C(void) CpuCopy16(gUnknown_08577574[wallpaperId], gPlttBufferUnfaded + gUnknown_02039D08->field_71E, 4); } -s16 sub_80CD00C(const u8 *string) +static s16 sub_80CD00C(const u8 *string) { return 0xB0 - GetStringWidth(1, string, 0) / 2; } -void sub_80CD02C(void) +static void sub_80CD02C(void) { u16 i; @@ -5321,7 +5311,7 @@ void sub_80CD02C(void) sub_80CD1A8(TRUE); } -void sub_80CD0B8(s8 direction) +static void sub_80CD0B8(s8 direction) { u16 i; @@ -5348,7 +5338,7 @@ void sub_80CD0B8(s8 direction) gUnknown_02039D08->field_730[1]->data[7] = 1; } -void sub_80CD158(void) +static void sub_80CD158(void) { u16 i; @@ -5361,7 +5351,7 @@ void sub_80CD158(void) sub_80CD1A8(TRUE); } -void sub_80CD1A8(bool8 a0) +static void sub_80CD1A8(bool8 a0) { u16 i; @@ -5384,7 +5374,7 @@ void sub_80CD1A8(bool8 a0) } } -void sub_80CD210(struct Sprite *sprite) +static void sub_80CD210(struct Sprite *sprite) { switch (sprite->data[0]) { @@ -5436,7 +5426,7 @@ struct Sprite *sub_80CD2E8(u16 x, u16 y, u8 animId, u8 priority, u8 subpriority) return &gSprites[spriteId]; } -void sub_80CD36C(void) +static void sub_80CD36C(void) { if (gUnknown_02039D08->boxOption != BOX_OPTION_DEPOSIT) sBoxCursorArea = CURSOR_AREA_IN_BOX; @@ -5451,64 +5441,64 @@ void sub_80CD36C(void) sub_80CDC0C(); sub_80CFC14(); gUnknown_02039D08->field_CD6 = 1; - gUnknown_02039D08->field_21FF = 0; + gUnknown_02039D08->inBoxMovingMode = 0; sub_80CEB40(); } -void sub_80CD3EC(void) +static void sub_80CD3EC(void) { sub_80CFC14(); sub_80CEBDC(); gUnknown_02039D08->field_CD6 = 1; - gUnknown_02039D08->field_21FF = 0; + gUnknown_02039D08->inBoxMovingMode = 0; if (sIsMonBeingMoved) { - gUnknown_02039D08->field_20A4 = gUnknown_02039D14; - sub_80CAFC4(); + gUnknown_02039D08->movingMon = gUnknown_02039D14; + CreateMovingMonIcon(); } } -void sub_80CD444(u8 a0, u8 a1, u16 *a2, u16 *a3) +void sub_80CD444(u8 cursorArea, u8 cursorPosition, u16 *x, u16 *y) { - switch (a0) + switch (cursorArea) { - case 0: - *a2 = (a1 % 6) * 24 + 100; - *a3 = (a1 / 6) * 24 + 32; + case CURSOR_AREA_IN_BOX: + *x = (cursorPosition % IN_BOX_ROWS) * 24 + 100; + *y = (cursorPosition / IN_BOX_ROWS) * 24 + 32; break; - case 1: - if (a1 == 0) + case CURSOR_AREA_IN_PARTY: + if (cursorPosition == 0) { - *a2 = 0x68; - *a3 = 0x34; + *x = 0x68; + *y = 0x34; } - else if (a1 == 6) + else if (cursorPosition == PARTY_SIZE) { - *a2 = 0x98; - *a3 = 0x84; + *x = 0x98; + *y = 0x84; } else { - *a2 = 0x98; - *a3 = (a1 - 1) * 24 + 4; + *x = 0x98; + *y = (cursorPosition - 1) * 24 + 4; } break; - case 2: - *a2 = 0xa2; - *a3 = 0x0c; + case CURSOR_AREA_BOX: + *x = 0xa2; + *y = 0x0c; break; - case 3: - *a3 = sIsMonBeingMoved ? 8 : 14; - *a2 = a1 * 0x58 + 0x78; + case CURSOR_AREA_BUTTONS: + *y = sIsMonBeingMoved ? 8 : 14; + *x = cursorPosition * 0x58 + 0x78; break; case 4: - *a2 = 0xa0; - *a3 = 0x60; + *x = 0xa0; + *y = 0x60; break; } } -u16 sub_80CD504(void) +static u16 sub_80CD504(void) { switch (sBoxCursorArea) { @@ -5571,18 +5561,18 @@ bool8 sub_80CD554(void) return TRUE; } -void sub_80CD6AC(u8 a0, u8 a1) +static void sub_80CD6AC(u8 newCurosrArea, u8 newCursorPosition) { u16 x, y; - sub_80CD444(a0, a1, &x, &y); - gUnknown_02039D08->field_CD4 = a0; - gUnknown_02039D08->field_CD5 = a1; + sub_80CD444(newCurosrArea, newCursorPosition, &x, &y); + gUnknown_02039D08->field_CD4 = newCurosrArea; + gUnknown_02039D08->field_CD5 = newCursorPosition; gUnknown_02039D08->field_CCC = x; gUnknown_02039D08->field_CCE = y; } -void sub_80CD70C(void) +static void sub_80CD70C(void) { int r7, r0; @@ -5628,13 +5618,13 @@ void sub_80CD70C(void) gUnknown_02039D08->field_CC0 = gUnknown_02039D08->field_CB4->pos1.y << 8; } -void sub_80CD894(u8 a0, u8 a1) +static void sub_80CD894(u8 newCurosrArea, u8 newCursorPosition) { - sub_80CD6AC(a0, a1); + sub_80CD6AC(newCurosrArea, newCursorPosition); sub_80CD70C(); if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) { - if (gUnknown_02039D08->field_21FF == 0 && !sIsMonBeingMoved) + if (gUnknown_02039D08->inBoxMovingMode == 0 && !sIsMonBeingMoved) StartSpriteAnim(gUnknown_02039D08->field_CB4, 1); } else @@ -5650,27 +5640,29 @@ void sub_80CD894(u8 a0, u8 a1) else if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) sub_80D0E50(1, sBoxCursorPosition); - if (a0 == 0) - sub_80D0D8C(0, a1); - else if (a0 == 1) - sub_80D0D8C(1, a1); + if (newCurosrArea == CURSOR_AREA_IN_BOX) + sub_80D0D8C(0, newCursorPosition); + else if (newCurosrArea == CURSOR_AREA_IN_PARTY) + sub_80D0D8C(1, newCursorPosition); } - if (a0 == 1 && sBoxCursorArea != CURSOR_AREA_IN_PARTY) + if (newCurosrArea == CURSOR_AREA_IN_PARTY && sBoxCursorArea != CURSOR_AREA_IN_PARTY) { - gUnknown_02039D08->field_CD6 = a0; + gUnknown_02039D08->field_CD6 = newCurosrArea; gUnknown_02039D08->field_CB8->invisible = TRUE; } - switch (a0) + switch (newCurosrArea) { - case 1 ... 3: + case CURSOR_AREA_IN_PARTY: + case CURSOR_AREA_BOX: + case CURSOR_AREA_BUTTONS: gUnknown_02039D08->field_CB4->oam.priority = 1; gUnknown_02039D08->field_CB8->invisible = TRUE; gUnknown_02039D08->field_CB8->oam.priority = 1; break; - case 0: - if (gUnknown_02039D08->field_21FF != 0) + case CURSOR_AREA_IN_BOX: + if (gUnknown_02039D08->inBoxMovingMode != 0) { gUnknown_02039D08->field_CB4->oam.priority = 0; gUnknown_02039D08->field_CB8->invisible = TRUE; @@ -5679,19 +5671,19 @@ void sub_80CD894(u8 a0, u8 a1) { gUnknown_02039D08->field_CB4->oam.priority = 2; if (sBoxCursorArea == CURSOR_AREA_IN_BOX && sIsMonBeingMoved) - sub_80CC0D4(2); + SetMovingMonPriority(2); } break; } } -void sub_80CDA68(void) +static void sub_80CDA68(void) { sBoxCursorArea = gUnknown_02039D08->field_CD4; sBoxCursorPosition = gUnknown_02039D08->field_CD5; if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) { - if (gUnknown_02039D08->field_21FF == 0 && !sIsMonBeingMoved) + if (gUnknown_02039D08->inBoxMovingMode == 0 && !sIsMonBeingMoved) StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); } else @@ -5704,29 +5696,29 @@ void sub_80CDA68(void) switch (sBoxCursorArea) { case CURSOR_AREA_BUTTONS: - sub_80CC0D4(1); + SetMovingMonPriority(1); break; case CURSOR_AREA_BOX: sub_80CD1A8(TRUE); break; case CURSOR_AREA_IN_PARTY: gUnknown_02039D08->field_CB8->subpriority = 13; - sub_80CC0D4(1); + SetMovingMonPriority(1); break; case CURSOR_AREA_IN_BOX: - if (gUnknown_02039D08->field_21FF == 0) + if (gUnknown_02039D08->inBoxMovingMode == 0) { gUnknown_02039D08->field_CB4->oam.priority = 1; gUnknown_02039D08->field_CB8->oam.priority = 2; gUnknown_02039D08->field_CB8->subpriority = 21; gUnknown_02039D08->field_CB8->invisible = FALSE; - sub_80CC0D4(2); + SetMovingMonPriority(2); } break; } } -void sub_80CDBA0(void) +static void sub_80CDBA0(void) { u8 partyCount; @@ -5742,20 +5734,20 @@ void sub_80CDBA0(void) } if (gUnknown_02039D08->field_CB4->vFlip) gUnknown_02039D08->field_CD7 = 1; - sub_80CD894(1, partyCount); + sub_80CD894(CURSOR_AREA_IN_PARTY, partyCount); } -void sub_80CDBF8(u8 a0) +static void sub_80CDBF8(u8 cursorBoxPosition) { - sub_80CD894(0, a0); + sub_80CD894(CURSOR_AREA_IN_BOX, cursorBoxPosition); } -void sub_80CDC0C(void) +static void sub_80CDC0C(void) { gUnknown_02039D7E = 0; } -void sub_80CDC18(void) +static void sub_80CDC18(void) { gUnknown_02039D7E = sBoxCursorPosition; } @@ -5767,7 +5759,14 @@ u8 sub_80CDC2C(void) void InitMonPlaceChange(u8 a0) { - gUnknown_02039D08->monPlaceChangeFunc = gUnknown_0857B998[a0]; + static bool8 (*const placeChangeFuncs[])(void) = + { + MonPlaceChange_Move, + MonPlaceChange_Place, + MonPlaceChange_Shift, + }; + + gUnknown_02039D08->monPlaceChangeFunc = placeChangeFuncs[a0]; gUnknown_02039D08->monPlaceChangeState = 0; } @@ -5786,7 +5785,7 @@ bool8 DoMonPlaceChange(void) return gUnknown_02039D08->monPlaceChangeFunc(); } -bool8 MonPlaceChange_Move(void) +static bool8 MonPlaceChange_Move(void) { switch (gUnknown_02039D08->monPlaceChangeState) { @@ -5815,7 +5814,7 @@ bool8 MonPlaceChange_Move(void) return TRUE; } -bool8 MonPlaceChange_Place(void) +static bool8 MonPlaceChange_Place(void) { switch (gUnknown_02039D08->monPlaceChangeState) { @@ -5841,7 +5840,7 @@ bool8 MonPlaceChange_Place(void) return TRUE; } -bool8 MonPlaceChange_Shift(void) +static bool8 MonPlaceChange_Shift(void) { switch (gUnknown_02039D08->monPlaceChangeState) { @@ -5876,17 +5875,17 @@ bool8 MonPlaceChange_Shift(void) return TRUE; } -bool8 sub_80CDEB4(void) +static bool8 sub_80CDEB4(void) { return sub_80CDED4(); } -bool8 sub_80CDEC4(void) +static bool8 sub_80CDEC4(void) { return sub_80CDF08(); } -bool8 sub_80CDED4(void) +static bool8 sub_80CDED4(void) { switch (gUnknown_02039D08->field_CB4->pos2.y) { @@ -5903,7 +5902,7 @@ bool8 sub_80CDED4(void) return TRUE; } -bool8 sub_80CDF08(void) +static bool8 sub_80CDF08(void) { switch (gUnknown_02039D08->field_CB4->pos2.y) { @@ -5926,7 +5925,7 @@ void MoveMon(void) sub_80CBC14(MODE_PARTY, sBoxCursorPosition); break; case CURSOR_AREA_IN_BOX: - if (gUnknown_02039D08->field_21FF == 0) + if (gUnknown_02039D08->inBoxMovingMode == 0) { SetMovedMonData(StorageGetCurrentBox(), sBoxCursorPosition); sub_80CBC14(MODE_BOX, sBoxCursorPosition); @@ -5961,33 +5960,33 @@ void PlaceMon(void) sIsMonBeingMoved = FALSE; } -void sub_80CE00C(void) +static void sub_80CE00C(void) { sub_80CEB40(); } -void SetMovedMonData(u8 boxId, u8 position) +static void SetMovedMonData(u8 boxId, u8 position) { if (boxId == TOTAL_BOXES_COUNT) - gUnknown_02039D08->field_20A4 = gPlayerParty[sBoxCursorPosition]; + gUnknown_02039D08->movingMon = gPlayerParty[sBoxCursorPosition]; else - BoxMonAtToMon(boxId, position, &gUnknown_02039D08->field_20A4); + BoxMonAtToMon(boxId, position, &gUnknown_02039D08->movingMon); PurgeMonOrBoxMon(boxId, position); sMovingMonOrigBoxId = boxId; sMovingMonOrigBoxPos = position; } -void SetPlacedMonData(u8 boxId, u8 position) +static void SetPlacedMonData(u8 boxId, u8 position) { if (boxId == TOTAL_BOXES_COUNT) { - gPlayerParty[position] = gUnknown_02039D08->field_20A4; + gPlayerParty[position] = gUnknown_02039D08->movingMon; } else { - BoxMonRestorePP(&gUnknown_02039D08->field_20A4.box); - SetBoxMonAt(boxId, position, &gUnknown_02039D08->field_20A4.box); + BoxMonRestorePP(&gUnknown_02039D08->movingMon.box); + SetBoxMonAt(boxId, position, &gUnknown_02039D08->movingMon.box); } } @@ -5999,7 +5998,7 @@ void PurgeMonOrBoxMon(u8 boxId, u8 position) ZeroBoxMonAt(boxId, position); } -void SetShiftedMonData(u8 boxId, u8 position) +static void SetShiftedMonData(u8 boxId, u8 position) { if (boxId == TOTAL_BOXES_COUNT) gUnknown_02039D08->field_2108 = gPlayerParty[position]; @@ -6007,13 +6006,13 @@ void SetShiftedMonData(u8 boxId, u8 position) BoxMonAtToMon(boxId, position, &gUnknown_02039D08->field_2108); SetPlacedMonData(boxId, position); - gUnknown_02039D08->field_20A4 = gUnknown_02039D08->field_2108; - sub_80CEC00(&gUnknown_02039D08->field_20A4, 0); + gUnknown_02039D08->movingMon = gUnknown_02039D08->field_2108; + SetCursorMonData(&gUnknown_02039D08->movingMon, MODE_PARTY); sMovingMonOrigBoxId = boxId; sMovingMonOrigBoxPos = position; } -bool8 TryStorePartyMonInBox(u8 boxId) +static bool8 TryStorePartyMonInBox(u8 boxId) { s16 boxPosition = GetFirstFreeBoxSpot(boxId); if (boxPosition == -1) @@ -6022,7 +6021,7 @@ bool8 TryStorePartyMonInBox(u8 boxId) if (sIsMonBeingMoved) { SetPlacedMonData(boxId, boxPosition); - sub_80CBAC4(); + DestroyMovingMonIcon(); sIsMonBeingMoved = FALSE; } else @@ -6039,13 +6038,13 @@ bool8 TryStorePartyMonInBox(u8 boxId) return TRUE; } -void sub_80CE22C(void) +static void sub_80CE22C(void) { StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); sub_80CEB40(); } -void sub_80CE250(void) +static void sub_80CE250(void) { u8 mode; @@ -6057,10 +6056,10 @@ void sub_80CE250(void) mode = MODE_BOX; sub_80CBF14(mode, sBoxCursorPosition); - StringCopy(gUnknown_02039D08->field_21E0, gUnknown_02039D08->field_CEE); + StringCopy(gUnknown_02039D08->field_21E0, gUnknown_02039D08->cursorMonNick); } -bool8 sub_80CE2A8(void) +static bool8 sub_80CE2A8(void) { if (!sub_80CBFD8()) { @@ -6073,7 +6072,7 @@ bool8 sub_80CE2A8(void) } } -void sub_80CE2D8(void) +void ReleaseMon(void) { u8 boxId; @@ -6094,13 +6093,28 @@ void sub_80CE2D8(void) sub_80CEB40(); } -void sub_80CE324(void) +static void sub_80CE324(void) { if (sIsMonBeingMoved) StartSpriteAnim(gUnknown_02039D08->field_CB4, 3); } -void sub_80CE350(u16 *moves) +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; @@ -6117,7 +6131,7 @@ void sub_80CE350(u16 *moves) *moves = MOVES_COUNT; } -void sub_80CE3A0(void) +void InitCanRelaseMonVars(void) { if (!AtLeastThreeUsableMons()) { @@ -6128,7 +6142,7 @@ void sub_80CE3A0(void) if (sIsMonBeingMoved) { - gUnknown_02039D08->field_2108 = gUnknown_02039D08->field_20A4; + gUnknown_02039D08->field_2108 = gUnknown_02039D08->movingMon; gUnknown_02039D08->field_2170 = -1; gUnknown_02039D08->field_2171 = -1; } @@ -6191,7 +6205,7 @@ bool32 AtLeastThreeUsableMons(void) return FALSE; } -s8 sub_80CE580(void) +s8 RunCanReleaseMon(void) { u16 i; u16 knownMoves; @@ -6252,3 +6266,2186 @@ s8 sub_80CE580(void) return -1; } + +static void sub_80CE760(void) +{ + if (sIsMonBeingMoved) + gUnknown_02039D14 = gUnknown_02039D08->movingMon; +} + +static void sub_80CE790(void) +{ + if (sIsMonBeingMoved) + { + if (sMovingMonOrigBoxId == TOTAL_BOXES_COUNT) + gUnknown_02039D08->movingMon = gUnknown_02039D14; + else + gUnknown_02039D08->movingMon.box = gUnknown_02039D14.box; + } +} + +static void sub_80CE7E8(void) +{ + if (sIsMonBeingMoved) + { + sub_80CE760(); + gUnknown_02039D08->field_218C.mon = &gUnknown_02039D14; + gUnknown_02039D08->field_2187 = 0; + gUnknown_02039D08->field_2186 = 0; + gUnknown_02039D08->field_2188 = 0; + } + else if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) + { + gUnknown_02039D08->field_218C.mon = gPlayerParty; + gUnknown_02039D08->field_2187 = sBoxCursorPosition; + gUnknown_02039D08->field_2186 = CountPartyMons() - 1; + gUnknown_02039D08->field_2188 = 0; + } + else + { + gUnknown_02039D08->field_218C.box = GetBoxedMonPtr(StorageGetCurrentBox(), 0); + gUnknown_02039D08->field_2187 = sBoxCursorPosition; + gUnknown_02039D08->field_2186 = IN_BOX_COUNT - 1; + gUnknown_02039D08->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) +{ + gUnknown_02039D08->cursorMonMarkings = markings; + if (sIsMonBeingMoved) + { + SetMonData(&gUnknown_02039D08->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 CanShifMon(void) +{ + if (sIsMonBeingMoved) + { + if (sBoxCursorArea == CURSOR_AREA_IN_PARTY && CountPartyAliveNonEggMonsExcept(sBoxCursorPosition) == 0) + { + if (gUnknown_02039D08->cursorMonIsEgg || GetMonData(&gUnknown_02039D08->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) +{ + gUnknown_02039D08->field_CEA = (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; + + gUnknown_02039D08->cursorMonItem = 0; + gender = MON_MALE; + sanityIsBagEgg = FALSE; + if (mode == MODE_PARTY) + { + struct Pokemon *mon = (struct Pokemon *)pokemon; + + gUnknown_02039D08->cursorMonSpecies = GetMonData(mon, MON_DATA_SPECIES2); + if (gUnknown_02039D08->cursorMonSpecies != SPECIES_NONE) + { + sanityIsBagEgg = GetMonData(mon, MON_DATA_SANITY_IS_BAD_EGG); + if (sanityIsBagEgg) + gUnknown_02039D08->cursorMonIsEgg = TRUE; + else + gUnknown_02039D08->cursorMonIsEgg = GetMonData(mon, MON_DATA_IS_EGG); + + GetMonData(mon, MON_DATA_NICKNAME, gUnknown_02039D08->cursorMonNick); + StringGetEnd10(gUnknown_02039D08->cursorMonNick); + gUnknown_02039D08->cursorMonLevel = GetMonData(mon, MON_DATA_LEVEL); + gUnknown_02039D08->cursorMonMarkings = GetMonData(mon, MON_DATA_MARKINGS); + gUnknown_02039D08->cursorMonPersonality = GetMonData(mon, MON_DATA_PERSONALITY); + gUnknown_02039D08->cursorMonPalette = GetMonFrontSpritePal(mon); + gender = GetMonGender(mon); + gUnknown_02039D08->cursorMonItem = GetMonData(mon, MON_DATA_HELD_ITEM); + } + } + else if (mode == MODE_BOX) + { + struct BoxPokemon *boxMon = (struct BoxPokemon *)pokemon; + + gUnknown_02039D08->cursorMonSpecies = GetBoxMonData(pokemon, MON_DATA_SPECIES2); + if (gUnknown_02039D08->cursorMonSpecies != SPECIES_NONE) + { + u32 otId = GetBoxMonData(boxMon, MON_DATA_OT_ID); + sanityIsBagEgg = GetBoxMonData(boxMon, MON_DATA_SANITY_IS_BAD_EGG); + if (sanityIsBagEgg) + gUnknown_02039D08->cursorMonIsEgg = TRUE; + else + gUnknown_02039D08->cursorMonIsEgg = GetBoxMonData(boxMon, MON_DATA_IS_EGG); + + + GetBoxMonData(boxMon, MON_DATA_NICKNAME, gUnknown_02039D08->cursorMonNick); + StringGetEnd10(gUnknown_02039D08->cursorMonNick); + gUnknown_02039D08->cursorMonLevel = GetLevelFromBoxMonExp(boxMon); + gUnknown_02039D08->cursorMonMarkings = GetBoxMonData(boxMon, MON_DATA_MARKINGS); + gUnknown_02039D08->cursorMonPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY); + gUnknown_02039D08->cursorMonPalette = GetFrontSpritePalFromSpeciesAndPersonality(gUnknown_02039D08->cursorMonSpecies, otId, gUnknown_02039D08->cursorMonPersonality); + gender = GetGenderFromSpeciesAndPersonality(gUnknown_02039D08->cursorMonSpecies, gUnknown_02039D08->cursorMonPersonality); + gUnknown_02039D08->cursorMonItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM); + } + } + else + { + gUnknown_02039D08->cursorMonSpecies = SPECIES_NONE; + gUnknown_02039D08->cursorMonItem = 0; + } + + if (gUnknown_02039D08->cursorMonSpecies == SPECIES_NONE) + { + StringFill(gUnknown_02039D08->cursorMonNick, CHAR_SPACE, 5); + StringFill(gUnknown_02039D08->cursorMonNickText, CHAR_SPACE, 8); + StringFill(gUnknown_02039D08->cursorMonSpeciesName, CHAR_SPACE, 8); + StringFill(gUnknown_02039D08->cursorMonGenderLvlText, CHAR_SPACE, 8); + StringFill(gUnknown_02039D08->cursorMonItemName, CHAR_SPACE, 8); + } + else if (gUnknown_02039D08->cursorMonIsEgg) + { + if (sanityIsBagEgg) + StringCopyPadded(gUnknown_02039D08->cursorMonNickText, gUnknown_02039D08->cursorMonNick, CHAR_SPACE, 5); + else + StringCopyPadded(gUnknown_02039D08->cursorMonNickText, gText_EggNickname, CHAR_SPACE, 8); + + StringFill(gUnknown_02039D08->cursorMonSpeciesName, CHAR_SPACE, 8); + StringFill(gUnknown_02039D08->cursorMonGenderLvlText, CHAR_SPACE, 8); + StringFill(gUnknown_02039D08->cursorMonItemName, CHAR_SPACE, 8); + } + else + { + if (gUnknown_02039D08->cursorMonSpecies == SPECIES_NIDORAN_F || gUnknown_02039D08->cursorMonSpecies == SPECIES_NIDORAN_M) + gender = MON_GENDERLESS; + + StringCopyPadded(gUnknown_02039D08->cursorMonNickText, gUnknown_02039D08->cursorMonNick, CHAR_SPACE, 5); + + txtPtr = gUnknown_02039D08->cursorMonSpeciesName; + *(txtPtr)++ = CHAR_SLASH; + StringCopyPadded(txtPtr, gSpeciesNames[gUnknown_02039D08->cursorMonSpecies], CHAR_SPACE, 5); + + txtPtr = gUnknown_02039D08->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, gUnknown_02039D08->cursorMonLevel, STR_CONV_MODE_LEFT_ALIGN, 3); + txtPtr[0] = CHAR_SPACE; + txtPtr[1] = EOS; + + if (gUnknown_02039D08->cursorMonItem != 0) + StringCopyPadded(gUnknown_02039D08->cursorMonItemName, ItemId_GetName(gUnknown_02039D08->cursorMonItem), CHAR_SPACE, 8); + else + StringFill(gUnknown_02039D08->cursorMonItemName, CHAR_SPACE, 8); + } +} + +static u8 HandleInput_InBox(void) +{ + switch (gUnknown_02039D08->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; + + gUnknown_02039D08->field_CD2 = 0; + gUnknown_02039D08->field_CD3 = 0; + gUnknown_02039D08->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; + gUnknown_02039D08->field_CD2 = 1; + gUnknown_02039D08->field_CD7 = 1; + } + } + else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + { + retVal = TRUE; + if (sBoxCursorPosition % IN_BOX_ROWS != 0) + { + cursorPosition--; + } + else + { + gUnknown_02039D08->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 + { + gUnknown_02039D08->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 (gUnknown_02039D08->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 + { + gUnknown_02039D08->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, =gUnknown_02039D08\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) + { + gUnknown_02039D08->inBoxMovingMode = 0; + gUnknown_02039D08->field_CB8->invisible = FALSE; + return 22; + } + else + { + sIsMonBeingMoved = (gUnknown_02039D08->cursorMonSpecies != SPECIES_NONE); + gUnknown_02039D08->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; + gUnknown_02039D08->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; + + gUnknown_02039D08->field_CD3 = 0; + gUnknown_02039D08->field_CD2 = 0; + gUnknown_02039D08->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; + gUnknown_02039D08->field_CD6 = sBoxCursorPosition; + cursorPosition = 0; + } + else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + { + if (sBoxCursorPosition == 0) + { + retVal = 1; + cursorPosition = gUnknown_02039D08->field_CD6; + } + else + { + retVal = 6; + cursorArea = CURSOR_AREA_IN_BOX; + cursorPosition = 0; + } + } + else + { + if (gMain.newKeys & A_BUTTON) + { + if (sBoxCursorPosition == PARTY_SIZE) + { + if (gUnknown_02039D08->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 (gUnknown_02039D08->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, =gUnknown_02039D08\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, =gUnknown_02039D08\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; + + gUnknown_02039D08->field_CD3 = 0; + gUnknown_02039D08->field_CD2 = 0; + gUnknown_02039D08->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; + gUnknown_02039D08->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, =gUnknown_02039D08\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; + + gUnknown_02039D08->field_CD3 = 0; + gUnknown_02039D08->field_CD2 = 0; + gUnknown_02039D08->field_CD7 = 0; + + if (!(gMain.newAndRepeatedKeys & DPAD_UP)) + { + if (gMain.newAndRepeatedKeys & (DPAD_DOWN | START_BUTTON)) + { + retVal = 1; + cursorArea = CURSOR_AREA_BOX; + cursorPosition = 0; + gUnknown_02039D08->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; + gUnknown_02039D08->field_CD2 = -1; + cursorPosition = (sBoxCursorPosition == 0) ? IN_BOX_COUNT - 1 - 5 : IN_BOX_COUNT - 1; + gUnknown_02039D08->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, =gUnknown_02039D08\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; +} + +void AddBoxMenu(void) +{ + InitMenu(); + SetMenuText(9); + SetMenuText(10); + SetMenuText(11); + SetMenuText(0); +} + +u8 sub_80CFA5C(void) +{ + InitMenu(); + if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + return sub_80CFA84(); + else + return sub_80CFB44(); +} + +static bool8 sub_80CFA84(void) +{ + u16 var0 = sub_80CD504(); + + switch (gUnknown_02039D08->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 (gUnknown_02039D08->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 (gUnknown_02039D08->cursorMonSpecies == SPECIES_EGG) + return FALSE; + + if (!sub_80D127C()) + { + if (gUnknown_02039D08->cursorMonItem == 0) + { + if (gUnknown_02039D08->cursorMonSpecies == SPECIES_NONE) + return FALSE; + + SetMenuText(14); + } + else + { + if (!ItemIsMail(gUnknown_02039D08->cursorMonItem)) + { + SetMenuText(12); + SetMenuText(16); + } + SetMenuText(17); + } + } + else + { + if (gUnknown_02039D08->cursorMonItem == 0) + { + if (gUnknown_02039D08->cursorMonSpecies == SPECIES_NONE) + return FALSE; + + SetMenuText(13); + } + else + { + if (ItemIsMail(gUnknown_02039D08->cursorMonItem) == TRUE) + return FALSE; + + SetMenuText(15); + } + } + + SetMenuText(0); + return TRUE; +} + +void sub_80CFBF4(struct Sprite *sprite) +{ + sprite->pos1.x = gUnknown_02039D08->field_CB4->pos1.x; + sprite->pos1.y = gUnknown_02039D08->field_CB4->pos1.y + 20; +} + +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, 0xDAC7}, + {} + }; + +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 = 0, + .paletteTag = 0xDACA, + .oam = &sOamData_857BA0C, + .anims = sSpriteAnimTable_857BA40, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; + +static const struct SpriteTemplate gSpriteTemplate_857BA68 = +{ + .tileTag = 1, + .paletteTag = 0xDACA, + .oam = &sOamData_857BA14, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80CFBF4, +}; + + LoadSpriteSheets(spriteSheets); + LoadSpritePalettes(spritePalettes); + gUnknown_02039D08->field_CD8[0] = IndexOfSpritePaletteTag(0xDACA); + gUnknown_02039D08->field_CD8[1] = IndexOfSpritePaletteTag(0xDAC7); + + sub_80CD444(sBoxCursorArea, sBoxCursorPosition, &x, &y); + spriteId = CreateSprite(&gSpriteTemplate_857BA50, x, y, 6); + if (spriteId != MAX_SPRITES) + { + gUnknown_02039D08->field_CB4 = &gSprites[spriteId]; + gUnknown_02039D08->field_CB4->oam.paletteNum = gUnknown_02039D08->field_CD8[sCanOnlyMove]; + gUnknown_02039D08->field_CB4->oam.priority = 1; + if (sIsMonBeingMoved) + StartSpriteAnim(gUnknown_02039D08->field_CB4, 3); + } + else + { + gUnknown_02039D08->field_CB4 = NULL; + } + + if (sBoxCursorArea == 1) + { + subpriority = 13; + priority = 1; + } + else + { + subpriority = 21; + priority = 2; + } + + spriteId = CreateSprite(&gSpriteTemplate_857BA68, 0, 0, subpriority); + if (spriteId != MAX_SPRITES) + { + gUnknown_02039D08->field_CB8 = &gSprites[spriteId]; + gUnknown_02039D08->field_CB8->oam.priority = priority; + if (sBoxCursorArea) + gUnknown_02039D08->field_CB8->invisible = 1; + } + else + { + gUnknown_02039D08->field_CB8 = NULL; + } +} + +void sub_80CFDC4(void) +{ + sCanOnlyMove = !sCanOnlyMove; + gUnknown_02039D08->field_CB4->oam.paletteNum = gUnknown_02039D08->field_CD8[sCanOnlyMove]; +} + +u8 GetBoxCursorPosition(void) +{ + return sBoxCursorPosition; +} + +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; + } +} + +void sub_80CFE54(u8 animNum) +{ + StartSpriteAnim(gUnknown_02039D08->field_CB4, animNum); +} + +u8 sub_80CFE78(void) +{ + return sMovingMonOrigBoxId; +} + +void sub_80CFE84(void) +{ + gUnknown_02039D08->field_CB4->oam.priority = 1; +} + +void sub_80CFEA8(void) +{ + if (sBoxCursorArea == CURSOR_AREA_IN_BOX) + sub_80D0E50(0, sBoxCursorPosition); +} + +void sub_80CFECC(void) +{ + if (sBoxCursorArea == CURSOR_AREA_IN_BOX) + sub_80D0D8C(0, sBoxCursorPosition); +} + +static void InitMenu(void) +{ + gUnknown_02039D08->menuItemsCount = 0; + gUnknown_02039D08->menuWidth = 0; + gUnknown_02039D08->menuWindow.bg = 0; + gUnknown_02039D08->menuWindow.paletteNum = 15; + gUnknown_02039D08->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 (gUnknown_02039D08->menuItemsCount < 7) + { + u8 len; + struct StorageMenu *menu = &gUnknown_02039D08->menuItems[gUnknown_02039D08->menuItemsCount]; + + menu->text = gUnknown_0857BA80[textId]; + menu->textId = textId; + len = StringLength(menu->text); + if (len > gUnknown_02039D08->menuWidth) + gUnknown_02039D08->menuWidth = len; + + gUnknown_02039D08->menuItemsCount++; + } +} + +s8 sub_80CFF98(u8 arg0) +{ + if (arg0 >= gUnknown_02039D08->menuItemsCount) + return -1; + else + return gUnknown_02039D08->menuItems[arg0].textId; +} + +static void AddMenu(void) +{ + gUnknown_02039D08->menuWindow.width = gUnknown_02039D08->menuWidth + 2; + gUnknown_02039D08->menuWindow.height = 2 * gUnknown_02039D08->menuItemsCount; + gUnknown_02039D08->menuWindow.tilemapLeft = 29 - gUnknown_02039D08->menuWindow.width; + gUnknown_02039D08->menuWindow.tilemapTop = 15 - gUnknown_02039D08->menuWindow.height; + gUnknown_02039D08->field_CB0 = AddWindow(&gUnknown_02039D08->menuWindow); + ClearWindowTilemap(gUnknown_02039D08->field_CB0); + SetWindowBorderStyle(gUnknown_02039D08->field_CB0, FALSE, 11, 14); + PrintMenuTable(gUnknown_02039D08->field_CB0, gUnknown_02039D08->menuItemsCount, (void*)gUnknown_02039D08->menuItems); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(gUnknown_02039D08->field_CB0, gUnknown_02039D08->menuItemsCount, 0); + schedule_bg_copy_tilemap_to_vram(0); + gUnknown_02039D08->field_CAE = 0; +} + +bool8 sub_80D00A8(void) +{ + return 0; +} + +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 = gUnknown_02039D08->menuItems[textId].textId; + + #ifndef NONMATCHING + asm("":::"r4"); + #endif // NONMATCHING + return textId; +} + +void sub_80D013C(void) +{ + sub_8198070(gUnknown_02039D08->field_CB0, TRUE); + RemoveWindow(gUnknown_02039D08->field_CB0); +} 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/start_menu.c b/src/start_menu.c index 079f05be0..62fdc07d5 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) From 9ffd0c73829e5a0aded23518887007da9c3fc44c Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 17 Dec 2018 23:00:08 +0100 Subject: [PATCH 09/13] 3.5 asm left --- asm/battle_anim_8170478.s | 12 +- asm/cable_car.s | 2 +- asm/contest.s | 6 +- asm/contest_link_80F57C4.s | 6 +- asm/easy_chat.s | 2 +- asm/party_menu.s | 10 +- asm/pokemon_storage_system.s | 2372 ----------------------------- asm/pokenav.s | 14 +- asm/rom_8011DC0.s | 14 +- asm/roulette.s | 6 +- asm/trade.s | 2 +- asm/trainer_card.s | 10 +- asm/use_pokeblock.s | 2 +- data/pokemon_storage_system.s | 56 - include/bg.h | 10 +- include/blit.h | 2 +- include/decompress.h | 12 +- include/pokemon_icon.h | 1 + include/pokemon_storage_system.h | 14 +- include/window.h | 6 +- src/battle_anim.c | 4 +- src/battle_anim_80A9C70.c | 4 +- src/battle_arena.c | 2 +- src/battle_bg.c | 2 +- src/battle_dome.c | 4 +- src/battle_factory_screen.c | 4 +- src/battle_gfx_sfx_util.c | 44 +- src/battle_interface.c | 2 +- src/battle_pyramid_bag.c | 2 +- src/berry_tag_screen.c | 4 +- src/bg.c | 84 +- src/contest.c | 6 +- src/credits.c | 12 +- src/decompress.c | 12 +- src/decoration.c | 2 +- src/egg_hatch.c | 2 +- src/evolution_graphics.c | 2 +- src/field_effect.c | 4 +- src/hall_of_fame.c | 8 +- src/intro.c | 26 +- src/intro_credits_graphics.c | 12 +- src/item_icon.c | 4 +- src/item_menu.c | 6 +- src/item_menu_icons.c | 2 +- src/link_rfu.c | 2 +- src/list_menu.c | 6 +- src/menu_helpers.c | 4 +- src/money.c | 4 +- src/pokeball.c | 12 +- src/pokeblock.c | 4 +- src/pokeblock_feed.c | 10 +- src/pokedex.c | 4 +- src/pokemon_icon.c | 2 +- src/pokemon_storage_system.c | 1048 ++++++++++++- src/pokemon_summary_screen.c | 12 +- src/rayquaza_scene.c | 46 +- src/rom_8034C54.c | 2 +- src/script_pokemon_util_80F87D8.c | 2 +- src/smokescreen.c | 4 +- src/starter_choose.c | 4 +- src/title_screen.c | 6 +- src/trainer_pokemon_sprites.c | 4 +- src/unk_transition.c | 2 +- src/wallclock.c | 2 +- src/window.c | 66 +- 65 files changed, 1321 insertions(+), 2738 deletions(-) diff --git a/asm/battle_anim_8170478.s b/asm/battle_anim_8170478.s index c0881e682..44a5d624b 100644 --- a/asm/battle_anim_8170478.s +++ b/asm/battle_anim_8170478.s @@ -2996,10 +2996,10 @@ sub_8171D60: @ 8171D60 cmp r0, r1 bne _08171D86 adds r0, r4, 0 - bl LoadCompressedObjectPicUsingHeap + bl LoadCompressedSpriteSheetUsingHeap ldr r0, =gUnknown_085E50F4 adds r0, r5, r0 - bl LoadCompressedObjectPaletteUsingHeap + bl LoadCompressedSpritePaletteUsingHeap _08171D86: pop {r4,r5} pop {r0} @@ -5135,9 +5135,9 @@ _08172F4E: cmp r0, r7 bne _08172F6E ldr r0, =gBattleAnimPicTable + 0x748 - bl LoadCompressedObjectPicUsingHeap + bl LoadCompressedSpriteSheetUsingHeap ldr r0, =gBattleAnimPaletteTable + 0x748 - bl LoadCompressedObjectPaletteUsingHeap + bl LoadCompressedSpritePaletteUsingHeap _08172F6E: ldr r5, =sub_8172FEC adds r0, r5, 0 @@ -5534,9 +5534,9 @@ sub_81732B0: @ 81732B0 lsls r4, 24 lsrs r4, 24 ldr r0, =gBattleAnimPicTable + 0x868 - bl LoadCompressedObjectPicUsingHeap + bl LoadCompressedSpriteSheetUsingHeap ldr r0, =gBattleAnimPaletteTable + 0x868 - bl LoadCompressedObjectPaletteUsingHeap + bl LoadCompressedSpritePaletteUsingHeap ldr r0, =0x0000281d bl IndexOfSpritePaletteTag adds r0, r4, 0 diff --git a/asm/cable_car.s b/asm/cable_car.s index 276b878e2..c1eafc506 100644 --- a/asm/cable_car.s +++ b/asm/cable_car.s @@ -234,7 +234,7 @@ _0814FE90: _0814FE96: lsls r0, r4, 3 adds r0, r6 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet adds r0, r4, 0x1 lsls r0, 24 lsrs r4, r0, 24 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 e09e0e25d..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 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/party_menu.s b/asm/party_menu.s index 27ad74541..2706368c2 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -11361,11 +11361,11 @@ _081B602C: sub_81B6040: @ 81B6040 push {lr} ldr r0, =gUnknown_08615EF8 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet ldr r0, =gUnknown_08615F70 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet ldr r0, =gUnknown_08615F00 - bl LoadCompressedObjectPalette + bl LoadCompressedSpritePalette pop {r0} bx r0 .pool @@ -11506,9 +11506,9 @@ _081B6152: sub_81B6160: @ 81B6160 push {lr} ldr r0, =gUnknown_08615FF8 - bl LoadCompressedObjectPic + bl LoadCompressedSpriteSheet ldr r0, =gUnknown_08616000 - bl LoadCompressedObjectPalette + bl LoadCompressedSpritePalette pop {r0} bx r0 .pool diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index 38bb6ce8e..6dbe6b0f2 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -8,2378 +8,6 @@ - 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 DoMonPlaceChange - 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 DoMonPlaceChange - 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 DoMonPlaceChange - 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 DoMonPlaceChange - 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 GetCurrentBoxMonData - lsls r0, 16 - lsrs r5, r0, 16 - adds r0, r4, 0 - movs r1, 0 - bl GetCurrentBoxMonData - 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 GetCurrentBoxMonData - 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 DestroyBoxMonIconAtPosition - mov r0, r8 - adds r1, r5, 0 - bl ZeroBoxMonAt - 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 SetBoxMonAt -_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 GetCurrentBoxMonData - 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 GetCurrentBoxMonData - cmp r0, 0 - beq _080D0E42 - adds r0, r7, 0 - movs r1, 0xC - bl GetCurrentBoxMonData - 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 SetCurrentBoxMonData - adds r0, r5, 0 - movs r1, 0x1 - bl SetBoxMonIconObjMode - 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 SetPartyMonIconObjMode -_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 GetCurrentBoxMonData - 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 SetCurrentBoxMonData - 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 SetCurrentBoxMonData - adds r0, r5, 0 - movs r1, 0 - bl SetBoxMonIconObjMode - 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 SetPartyMonIconObjMode -_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 SetCurrentBoxMonData - adds r0, r5, 0 - movs r1, 0x1 - bl SetBoxMonIconObjMode - 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 SetPartyMonIconObjMode -_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 GetMovingItemName -GetMovingItemName: @ 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 GetMovingItemName - - thumb_func_start GetMovingItem -GetMovingItem: @ 80D12D4 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00002234 - adds r0, r1 - ldrh r0, [r0] - bx lr - .pool - thumb_func_end GetMovingItem - - 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 diff --git a/asm/pokenav.s b/asm/pokenav.s index 1ec7c15e1..a383f58d2 100644 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -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 @@ -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 diff --git a/asm/rom_8011DC0.s b/asm/rom_8011DC0.s index 41d57d7ca..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 @@ -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 341aa0869..e1e8588bf 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/pokemon_storage_system.s b/data/pokemon_storage_system.s index 0d1cc375f..3058f3578 100644 --- a/data/pokemon_storage_system.s +++ b/data/pokemon_storage_system.s @@ -4,62 +4,6 @@ .section .rodata - - - .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/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..b6c80b497 100644 --- a/include/blit.h +++ b/include/blit.h @@ -3,7 +3,7 @@ struct Bitmap { - u8* pixels; + const u8 *pixels; u32 width:16; u32 height:16; }; 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/pokemon_icon.h b/include/pokemon_icon.h index 5a18109f2..8da0c5958 100644 --- a/include/pokemon_icon.h +++ b/include/pokemon_icon.h @@ -4,6 +4,7 @@ extern const u8 gMonIconPaletteIndices[]; const u8 *GetMonIconTiles(u16 species, bool32); +u8 GetValidMonIconPalIndex(u16 species); const u8 *GetMonIconPtr(u16 speciesId, u32 personality, u32 frameNo); const u16 *GetValidMonIconPalettePtr(u16 speciesId); u16 GetIconSpecies(u16 species, u32 personality); diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index 530fb7042..9b880b2c9 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -64,6 +64,16 @@ struct UnkPSSStruct_2002370 u8 unk_0246; }; +struct UnkStorageStruct +{ + struct Sprite *sprite; + u8 *tiles; + u16 palIndex; + u8 unk8; + u8 unk9; + u8 unk10; +}; + struct PokemonStorageSystemData { u8 state; @@ -229,8 +239,8 @@ struct PokemonStorageSystemData u8 field_21FD; u8 field_21FE; u8 inBoxMovingMode; - u8 field_2200; - u8 field_2201[51]; + u16 field_2200; + struct UnkStorageStruct field_2204[3]; u16 movingItem; u8 field_2236; u8 field_2237; 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/src/battle_anim.c b/src/battle_anim.c index 95c6f7b3c..18099091c 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -1607,8 +1607,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 f1245a032..44c3ef79b 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_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 29b41c5db..391128cb0 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -3545,7 +3545,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); @@ -5716,7 +5716,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 93f3aa9cd..0bcdc0d66 100644 --- a/src/battle_factory_screen.c +++ b/src/battle_factory_screen.c @@ -1165,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); @@ -3169,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 8d7ed2dce..d9409b230 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_pyramid_bag.c b/src/battle_pyramid_bag.c index 6d71e4b1d..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: 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/contest.c b/src/contest.c index 0c4397f30..95c8563ed 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 02b01c072..ca82217cd 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/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 768b1541b..8453a055d 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -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/egg_hatch.c b/src/egg_hatch.c index 9c1d6fdd8..561987315 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -442,7 +442,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; 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 40e15c733..9d3eb2377 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/hall_of_fame.c b/src/hall_of_fame.c index ad5673036..27a3a29f9 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 b0eb7c78b..abae65a33 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -715,13 +715,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: diff --git a/src/item_menu_icons.c b/src/item_menu_icons.c index 85b42b9b3..c68e1d29e 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/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/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/pokeball.c b/src/pokeball.c index ad839e6af..d159d9254 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 e6198fd4f..ee5c99334 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -1812,7 +1812,7 @@ bool8 sub_80BC514(u8 a) ResetSpriteData(); FreeAllSpritePalettes(); gReservedSpritePaletteCount = 8; - LoadCompressedObjectPic(&sInterfaceSpriteSheet[0]); + LoadCompressedSpriteSheet(&sInterfaceSpriteSheet[0]); LoadSpritePalettes(sInterfaceSpritePalette); CreateInterfaceSprites(a); gMain.state++; @@ -4821,7 +4821,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_icon.c b/src/pokemon_icon.c index 6b7d8656f..9a69febcf 100644 --- a/src/pokemon_icon.c +++ b/src/pokemon_icon.c @@ -1219,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_storage_system.c b/src/pokemon_storage_system.c index 54c83e329..d9bc818ae 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -46,6 +46,26 @@ struct WallpaperTable const u16 *palettes; }; +struct Struct_02039D80 +{ + 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]; +}; + enum { BOX_OPTION_WITHDRAW, @@ -161,8 +181,9 @@ enum #define TAG_TILE_3 0x3 #define TAG_TILE_4 0x4 -IWRAM_DATA u8 gUnknown_03000F78[0x188]; +IWRAM_DATA u32 gUnknown_03000F78[98]; +// EWRAM DATA extern u8 sPreviousBoxOption; extern u8 sCurrentBoxOption; extern u8 sMovingMonOrigBoxPos; @@ -178,6 +199,7 @@ extern bool8 sIsMonBeingMoved; extern u8 gUnknown_02039D0F; extern u16 gUnknown_02039D12; extern struct Pokemon gUnknown_02039D14; +extern struct Struct_02039D80 *gUnknown_02039D80; extern void sub_80F9BCC(u16, u16, u8); extern void sub_80F9BF4(u16, u16, u8); @@ -367,10 +389,10 @@ void PrintStorageActionText(u8 id); s16 sub_80D00AC(void); s8 RunCanReleaseMon(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); +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); struct Sprite *sub_80CD2E8(u16 x, u16 y, u8 animId, u8 priority, u8 subpriority); static void SetWallpaperForCurrentBox(u8 wallpaperId); static void AddWallpapersMenu(u8 wallpaperSet); @@ -389,8 +411,8 @@ static void sub_80CAAA8(u8 arg0, bool8 isPartyMon); const u8 *GetMovingItemName(void); bool32 IsWaldaWallpaperUnlocked(void); static void SetMenuText(u8 textId); -void sub_80D0D8C(u8 arg0, u8 cursorPos); -void sub_80D0E50(u8 arg0, u8 cursorPos); +void sub_80D0D8C(u8 cursorArea, u8 cursorPos); +void sub_80D0E50(u8 cursorArea, u8 cursorPos); 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); @@ -430,6 +452,27 @@ u8 sub_80CFA5C(void); u8 sub_80D0BA4(void); static bool8 sub_80CFA84(void); static bool8 sub_80CFB44(void); +bool8 sub_80D024C(void); +bool8 sub_80D0344(void); +bool8 sub_80D03B0(void); +bool8 sub_80D0420(void); +bool8 sub_80D04A0(void); +bool8 sub_80D04C8(void); +void sub_80D304C(u16 palIndex); +void sub_80D07B0(u8 arg0, u8 arg1); +void sub_80D0834(u8 arg0, u8 arg1); +void sub_80D0B5C(void); +void sub_80D062C(void); +void sub_80D0884(u16 arg0, u16 arg1, u16 arg2); +void sub_80D08CC(void); +void sub_80D09A4(void); +void sub_80D0A1C(void); +void sub_80D0AAC(void); +u8 sub_80D0894(void); +void sub_80D0778(u8 arg0, u8 arg1, u8 arg2); +void sub_80D0708(u8 arg0, u8 arg1, u8 arg2); +void sub_80D06D0(u8 arg0, u8 arg1, u8 arg2); +void sub_80D0740(u8 arg0, u8 arg1, u8 arg2); // static const rom data static const struct PSS_MenuStringPtrs gUnknown_085716C0[] = @@ -2875,7 +2918,7 @@ static void Cb_TakeItemForMoving(u8 taskId) break; case 1: sub_80CFE54(2); - sub_80D0E90((sInPartyMenu != FALSE), GetBoxCursorPosition()); + Item_FromMonToMoving((sInPartyMenu != FALSE) ? CURSOR_AREA_IN_PARTY : CURSOR_AREA_IN_BOX, GetBoxCursorPosition()); gUnknown_02039D08->state++; break; case 2: @@ -2905,7 +2948,7 @@ static void Cb_GiveMovingItemToMon(u8 taskId) break; case 1: sub_80CFE54(2); - sub_80D1080((sInPartyMenu != FALSE), GetBoxCursorPosition()); + Item_GiveMovingToMon((sInPartyMenu != FALSE) ? CURSOR_AREA_IN_PARTY : CURSOR_AREA_IN_BOX, GetBoxCursorPosition()); gUnknown_02039D08->state++; break; case 2: @@ -2946,7 +2989,7 @@ static void Cb_ItemToBag(u8 taskId) else { PlaySE(SE_SELECT); - sub_80D1114((sInPartyMenu != FALSE), GetBoxCursorPosition()); + Item_TakeMons((sInPartyMenu != FALSE) ? CURSOR_AREA_IN_PARTY : CURSOR_AREA_IN_BOX, GetBoxCursorPosition()); gUnknown_02039D08->state = 1; } break; @@ -2997,7 +3040,7 @@ static void Cb_SwitchSelectedItem(u8 taskId) break; case 1: sub_80CFE54(2); - sub_80D0FAC((sInPartyMenu != FALSE), GetBoxCursorPosition()); + Item_SwitchMonsWithMoving((sInPartyMenu != FALSE) ? CURSOR_AREA_IN_PARTY : CURSOR_AREA_IN_BOX, GetBoxCursorPosition()); gUnknown_02039D08->state++; break; case 2: @@ -4154,9 +4197,9 @@ static void sub_80CAEAC(void) if (!IsCursorOnBox()) { if (sInPartyMenu) - sub_80D0D8C(1, GetBoxCursorPosition()); + sub_80D0D8C(CURSOR_AREA_IN_PARTY, GetBoxCursorPosition()); else - sub_80D0D8C(0, GetBoxCursorPosition()); + sub_80D0D8C(CURSOR_AREA_IN_BOX, GetBoxCursorPosition()); } if (gUnknown_02039D12 != 0) @@ -5636,14 +5679,14 @@ static void sub_80CD894(u8 newCurosrArea, u8 newCursorPosition) if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) { if (sBoxCursorArea == CURSOR_AREA_IN_BOX) - sub_80D0E50(0, sBoxCursorPosition); + sub_80D0E50(CURSOR_AREA_IN_BOX, sBoxCursorPosition); else if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) - sub_80D0E50(1, sBoxCursorPosition); + sub_80D0E50(CURSOR_AREA_IN_PARTY, sBoxCursorPosition); if (newCurosrArea == CURSOR_AREA_IN_BOX) - sub_80D0D8C(0, newCursorPosition); + sub_80D0D8C(newCurosrArea, newCursorPosition); else if (newCurosrArea == CURSOR_AREA_IN_PARTY) - sub_80D0D8C(1, newCursorPosition); + sub_80D0D8C(newCurosrArea, newCursorPosition); } if (newCurosrArea == CURSOR_AREA_IN_PARTY && sBoxCursorArea != CURSOR_AREA_IN_PARTY) @@ -8298,13 +8341,13 @@ void sub_80CFE84(void) void sub_80CFEA8(void) { if (sBoxCursorArea == CURSOR_AREA_IN_BOX) - sub_80D0E50(0, sBoxCursorPosition); + sub_80D0E50(CURSOR_AREA_IN_BOX, sBoxCursorPosition); } void sub_80CFECC(void) { if (sBoxCursorArea == CURSOR_AREA_IN_BOX) - sub_80D0D8C(0, sBoxCursorPosition); + sub_80D0D8C(CURSOR_AREA_IN_BOX, sBoxCursorPosition); } static void InitMenu(void) @@ -8449,3 +8492,970 @@ void sub_80D013C(void) sub_8198070(gUnknown_02039D08->field_CB0, TRUE); RemoveWindow(gUnknown_02039D08->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. + +const struct WindowTemplate gUnknown_0857BB1C = +{ + .bg = 0, + .tilemapLeft = 10, + .tilemapTop = 3, + .width = 20, + .height = 18, + .paletteNum = 9, + .baseBlock = 0xA, +}; + +bool8 sub_80D0164(void) +{ + gUnknown_02039D80 = Alloc(sizeof(*gUnknown_02039D80)); + if (gUnknown_02039D80 != NULL) + { + gUnknown_02039D08->field_2200 = AddWindow8Bit(&gUnknown_0857BB1C); + if (gUnknown_02039D08->field_2200 != 0xFF) + { + FillWindowPixelBuffer(gUnknown_02039D08->field_2200, 0); + return TRUE; + } + } + + return FALSE; +} + +void sub_80D01B8(void) +{ + if (gUnknown_02039D80 != NULL) + Free(gUnknown_02039D80); +} + +void sub_80D01D0(u8 arg0) +{ + gUnknown_02039D80->field_0 = arg0; + gUnknown_02039D80->state = 0; +} + +bool8 sub_80D01E4(void) +{ + switch (gUnknown_02039D80->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; +} + +bool8 sub_80D024C(void) +{ + switch (gUnknown_02039D80->state) + { + case 0: + HideBg(0); + sub_80D304C(0x80); + gUnknown_02039D80->state++; + break; + case 1: + sub_80CFE14(&gUnknown_02039D80->fromRow, &gUnknown_02039D80->fromColumn); + gUnknown_02039D80->toRow = gUnknown_02039D80->fromRow; + gUnknown_02039D80->toColumn = gUnknown_02039D80->fromColumn; + ChangeBgX(0, -1024, 0); + ChangeBgY(0, -1024, 0); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20); + FillWindowPixelBuffer8Bit(gUnknown_02039D08->field_2200, 0); + sub_80D07B0(gUnknown_02039D80->fromRow, gUnknown_02039D80->fromColumn); + SetBgAttribute(0, 4, 1); + PutWindowTilemap(gUnknown_02039D08->field_2200); + CopyWindowToVram8Bit(gUnknown_02039D08->field_2200, 3); + BlendPalettes(0x3F00, 8, 0x7FFF); + sub_80CFE54(2); + SetGpuRegBits(REG_OFFSET_BG0CNT, BGCNT_256COLOR); + gUnknown_02039D80->state++; + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + { + ShowBg(0); + return FALSE; + } + break; + } + + return TRUE; +} + +bool8 sub_80D0344(void) +{ + switch (gUnknown_02039D80->state) + { + case 0: + HideBg(0); + gUnknown_02039D80->state++; + break; + case 1: + sub_80D0B5C(); + sub_80CFE54(0); + gUnknown_02039D80->state++; + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + { + sub_80CFE84(); + LoadPalette(stdpal_get(3), 0xD0, 0x20); + ShowBg(0); + return FALSE; + } + break; + } + + return TRUE; +} + +bool8 sub_80D03B0(void) +{ + switch (gUnknown_02039D80->state) + { + case 0: + if (!sub_80CD554()) + { + sub_80CFE14(&gUnknown_02039D80->field_6, &gUnknown_02039D80->field_7); + sub_80D062C(); + gUnknown_02039D80->toRow = gUnknown_02039D80->field_6; + gUnknown_02039D80->toColumn = gUnknown_02039D80->field_7; + CopyWindowToVram8Bit(gUnknown_02039D08->field_2200, 2); + gUnknown_02039D80->state++; + } + break; + case 1: + return IsDma3ManagerBusyWithBgCopy(); + } + + return TRUE; +} + +bool8 sub_80D0420(void) +{ + u8 var1, var2; + + switch (gUnknown_02039D80->state) + { + case 0: + sub_80D08CC(); + sub_80D09A4(); + sub_80CDC64(FALSE); + gUnknown_02039D80->state++; + break; + case 1: + if (!DoMonPlaceChange()) + { + sub_80CFE54(3); + sub_80D0884(0, 256, 8); + sub_80CDC64(TRUE); + gUnknown_02039D80->state++; + } + break; + case 2: + var1 = sub_80D0894(); + var2 = DoMonPlaceChange(); + if (!var1 && !var2) + return FALSE; + break; + } + + return TRUE; +} + +bool8 sub_80D04A0(void) +{ + u8 var1 = sub_80CD554(); + u8 var2 = sub_80D0894(); + + if (!var1 && !var2) + return FALSE; + else + return TRUE; +} + +bool8 sub_80D04C8(void) +{ + switch (gUnknown_02039D80->state) + { + case 0: + sub_80D0AAC(); + sub_80D0884(0, -256, 8); + sub_80CDC64(FALSE); + gUnknown_02039D80->state++; + break; + case 1: + if (!DoMonPlaceChange() && !sub_80D0894()) + { + sub_80D0A1C(); + sub_80CFE54(2); + sub_80CDC64(TRUE); + HideBg(0); + gUnknown_02039D80->state++; + } + break; + case 2: + if (!DoMonPlaceChange()) + { + sub_80CFE54(0); + sub_80D0B5C(); + gUnknown_02039D80->state++; + } + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + { + LoadPalette(stdpal_get(3), 0xD0, 0x20); + sub_80CFE84(); + ShowBg(0); + return FALSE; + } + break; + } + + return TRUE; +} + +bool8 sub_80D0580(u8 arg0) +{ + switch (arg0) + { + case 0: + if (gUnknown_02039D80->minColumn == 0) + return FALSE; + gUnknown_02039D80->minColumn--; + sub_80D0884(0, 1024, 6); + break; + case 1: + if (gUnknown_02039D80->minColumn + gUnknown_02039D80->columsTotal >= 5) + return FALSE; + gUnknown_02039D80->minColumn++; + sub_80D0884(0, -1024, 6); + break; + case 2: + if (gUnknown_02039D80->minRow == 0) + return FALSE; + gUnknown_02039D80->minRow--; + sub_80D0884(1024, 0, 6); + break; + case 3: + if (gUnknown_02039D80->minRow + gUnknown_02039D80->rowsTotal > 5) + return FALSE; + gUnknown_02039D80->minRow++; + sub_80D0884(-1024, 0, 6); + break; + } + + return TRUE; +} + +void sub_80D062C(void) +{ + s16 var = (abs(gUnknown_02039D80->fromRow - gUnknown_02039D80->field_6)) - (abs(gUnknown_02039D80->fromRow - gUnknown_02039D80->toRow)); + s16 var2 = (abs(gUnknown_02039D80->fromColumn - gUnknown_02039D80->field_7)) - (abs(gUnknown_02039D80->fromColumn - gUnknown_02039D80->toColumn)); + + if (var > 0) + sub_80D06D0(gUnknown_02039D80->field_6, gUnknown_02039D80->fromColumn, gUnknown_02039D80->toColumn); + + if (var < 0) + { + sub_80D0740(gUnknown_02039D80->toRow, gUnknown_02039D80->fromColumn, gUnknown_02039D80->toColumn); + sub_80D06D0(gUnknown_02039D80->field_6, gUnknown_02039D80->fromColumn, gUnknown_02039D80->toColumn); + } + + if (var2 > 0) + sub_80D0708(gUnknown_02039D80->field_7, gUnknown_02039D80->fromRow, gUnknown_02039D80->toRow); + + if (var2 < 0) + { + sub_80D0778(gUnknown_02039D80->toColumn, gUnknown_02039D80->fromRow, gUnknown_02039D80->toRow); + sub_80D0708(gUnknown_02039D80->field_7, gUnknown_02039D80->fromRow, gUnknown_02039D80->toRow); + } +} + +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++); +} + +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); +} + +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++); +} + +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); +} + +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(gUnknown_02039D08->field_2200, + iconGfx, + 0, + 0, + 32, + 32, + 24 * arg0, + 24 * arg1, + 32, + 32, + index); + } +} + +void sub_80D0834(u8 arg0, u8 arg1) +{ + u8 position = arg0 + (6 * arg1); + u16 species = GetCurrentBoxMonData(position, MON_DATA_SPECIES2); + + if (species != SPECIES_NONE) + { + FillWindowPixelRect8Bit(gUnknown_02039D08->field_2200, + 0, + 24 * arg0, + 24 * arg1, + 32, + 32); + } +} + +void sub_80D0884(u16 arg0, u16 arg1, u16 arg2) +{ + gUnknown_02039D80->bgX = arg0; + gUnknown_02039D80->bgY = arg1; + gUnknown_02039D80->field_10 = arg2; +} + +u8 sub_80D0894(void) +{ + if (gUnknown_02039D80->field_10 != 0) + { + ChangeBgX(0, gUnknown_02039D80->bgX, 1); + ChangeBgY(0, gUnknown_02039D80->bgY, 1); + gUnknown_02039D80->field_10--; + } + + return gUnknown_02039D80->field_10; +} + +void sub_80D08CC(void) +{ + s32 i, j, r8, r9; + s32 rowCount, columnCount; + u8 boxId; + u8 monArrayId; + + gUnknown_02039D80->minRow = min(gUnknown_02039D80->fromRow, gUnknown_02039D80->toRow); + gUnknown_02039D80->minColumn = min(gUnknown_02039D80->fromColumn, gUnknown_02039D80->toColumn); + gUnknown_02039D80->rowsTotal = abs(gUnknown_02039D80->fromRow - gUnknown_02039D80->toRow) + 1; + gUnknown_02039D80->columsTotal = abs(gUnknown_02039D80->fromColumn - gUnknown_02039D80->toColumn) + 1; + boxId = StorageGetCurrentBox(); + monArrayId = 0; + rowCount = gUnknown_02039D80->minRow + gUnknown_02039D80->rowsTotal; + columnCount = gUnknown_02039D80->minColumn + gUnknown_02039D80->columsTotal; + for (i = gUnknown_02039D80->minColumn; i < columnCount; i++) + { + u8 boxPosition = (IN_BOX_ROWS * i) + gUnknown_02039D80->minRow; + for (j = gUnknown_02039D80->minRow; j < rowCount; j++) + { + struct BoxPokemon *boxMon = GetBoxedMonPtr(boxId, boxPosition); + + gUnknown_02039D80->boxMons[monArrayId] = *boxMon; + monArrayId++; + boxPosition++; + } + } +} + +void sub_80D09A4(void) +{ + s32 i, j; + s32 rowCount = gUnknown_02039D80->minRow + gUnknown_02039D80->rowsTotal; + s32 columnCount = gUnknown_02039D80->minColumn + gUnknown_02039D80->columsTotal; + u8 boxId = StorageGetCurrentBox(); + + for (i = gUnknown_02039D80->minColumn; i < columnCount; i++) + { + u8 boxPosition = (IN_BOX_ROWS * i) + gUnknown_02039D80->minRow; + for (j = gUnknown_02039D80->minRow; j < rowCount; j++) + { + DestroyBoxMonIconAtPosition(boxPosition); + ZeroBoxMonAt(boxId, boxPosition); + boxPosition++; + } + } +} + +void sub_80D0A1C(void) +{ + s32 i, j; + s32 rowCount = gUnknown_02039D80->minRow + gUnknown_02039D80->rowsTotal; + s32 columnCount = gUnknown_02039D80->minColumn + gUnknown_02039D80->columsTotal; + u8 monArrayId = 0; + + for (i = gUnknown_02039D80->minColumn; i < columnCount; i++) + { + u8 boxPosition = (IN_BOX_ROWS * i) + gUnknown_02039D80->minRow; + for (j = gUnknown_02039D80->minRow; j < rowCount; j++) + { + if (GetBoxMonData(&gUnknown_02039D80->boxMons[monArrayId], MON_DATA_SANITY_HAS_SPECIES)) + sub_80CB140(boxPosition); + monArrayId++; + boxPosition++; + } + } +} + +void sub_80D0AAC(void) +{ + s32 i, j; + s32 rowCount = gUnknown_02039D80->minRow + gUnknown_02039D80->rowsTotal; + s32 columnCount = gUnknown_02039D80->minColumn + gUnknown_02039D80->columsTotal; + u8 boxId = StorageGetCurrentBox(); + u8 monArrayId = 0; + + for (i = gUnknown_02039D80->minColumn; i < columnCount; i++) + { + u8 boxPosition = (IN_BOX_ROWS * i) + gUnknown_02039D80->minRow; + for (j = gUnknown_02039D80->minRow; j < rowCount; j++) + { + if (GetBoxMonData(&gUnknown_02039D80->boxMons[monArrayId], MON_DATA_SANITY_HAS_SPECIES)) + SetBoxMonAt(boxId, boxPosition, &gUnknown_02039D80->boxMons[monArrayId]); + boxPosition++; + monArrayId++; + } + } +} + +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); +} + +u8 sub_80D0BA4(void) +{ + return (IN_BOX_ROWS * gUnknown_02039D80->fromColumn) + gUnknown_02039D80->fromRow; +} + +bool8 sub_80D0BC0(void) +{ + s32 i, j; + s32 rowCount = gUnknown_02039D80->minRow + gUnknown_02039D80->rowsTotal; + s32 columnCount = gUnknown_02039D80->minColumn + gUnknown_02039D80->columsTotal; + u8 monArrayId = 0; + + for (i = gUnknown_02039D80->minColumn; i < columnCount; i++) + { + u8 boxPosition = (IN_BOX_ROWS * i) + gUnknown_02039D80->minRow; + for (j = gUnknown_02039D80->minRow; j < rowCount; j++) + { + if (GetBoxMonData(&gUnknown_02039D80->boxMons[monArrayId], MON_DATA_SANITY_HAS_SPECIES) + && GetCurrentBoxMonData(boxPosition, MON_DATA_SANITY_HAS_SPECIES)) + return FALSE; + + monArrayId++; + boxPosition++; + } + } + + return TRUE; +} + +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 +}; + +const struct SpriteTemplate gSpriteTemplate_857BC70 = +{ + .tileTag = 7, + .paletteTag = 0xdacb, + .oam = &sOamData_857BBA4, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = sSpriteAffineAnimTable_857BC44, + .callback = SpriteCallbackDummy, +}; + +void sub_80D0C60(void) +{ + s32 i; + u8 spriteId; + struct CompressedSpriteSheet spriteSheet; + struct SpriteTemplate spriteTemplate; + + if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + { + spriteSheet.data = gUnknown_03000F78; + spriteSheet.size = 0x200; + spriteTemplate = gSpriteTemplate_857BC70; + + for (i = 0; i < 3; i++) + { + spriteSheet.tag = 7 + i; + LoadCompressedSpriteSheet(&spriteSheet); + gUnknown_02039D08->field_2204[i].tiles = GetSpriteTileStartByTag(spriteSheet.tag) * 32 + (void*)(OBJ_VRAM0); + gUnknown_02039D08->field_2204[i].palIndex = AllocSpritePalette(0xDACB + i); + gUnknown_02039D08->field_2204[i].palIndex *= 16; + gUnknown_02039D08->field_2204[i].palIndex += 0x100; + spriteTemplate.tileTag = 7 + i; + spriteTemplate.paletteTag = 0xDACB + i; + spriteId = CreateSprite(&spriteTemplate, 0, 0, 11); + gUnknown_02039D08->field_2204[i].sprite = &gSprites[spriteId]; + gUnknown_02039D08->field_2204[i].sprite->invisible = TRUE; + gUnknown_02039D08->field_2204[i].unk10 = 0; + } + } + gUnknown_02039D08->movingItem = 0; +} + +// The functions below handle new features of MOVE_ITEMS box option. + +bool32 sub_80D1324(u8 cursorArea, u8 cursorPos); +const u32 *GetItemIconPic(u16 itemId); +const u16 *GetItemIconPalette(u16 itemId); +u8 sub_80D12E8(void); +void sub_80D140C(u8 id, u8 cursorArea, u8 cursorPos); +void sub_80D1524(u8 id, const u32 *itemTiles, const u16 *itemPal); +void sub_80D15D4(u8 id, u8 animNum); +void sub_80D1740(u8 id, bool8 arg1); +u8 sub_80D1370(u8 cursorArea, u8 cursorPos); +void sub_80D1604(u8 id, u8 arg1, u8 cursorArea, u8 cursorPos); +void sub_80D1AD8(struct Sprite *sprite); + +void sub_80D0D8C(u8 cursorArea, u8 cursorPos) +{ + u16 heldItem; + + if (gUnknown_02039D08->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 u16 *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); + } +} + +void sub_80D0E50(u8 cursorArea, u8 cursorPos) +{ + u8 id; + + if (gUnknown_02039D08->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 (gUnknown_02039D08->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); + } + + gUnknown_02039D08->movingItem = gUnknown_02039D08->cursorMonItem; +} + +void sub_80D0F38(u16 item) +{ + const u32 *tiles = GetItemIconPic(item); + const u16 *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); + gUnknown_02039D08->movingItem = item; +} + +static void Item_SwitchMonsWithMoving(u8 cursorArea, u8 cursorPos) +{ + u8 id; + u16 item; + + if (gUnknown_02039D08->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, &gUnknown_02039D08->movingItem); + gUnknown_02039D08->movingItem = item; + } + else + { + item = GetMonData(&gPlayerParty[cursorPos], MON_DATA_HELD_ITEM); + SetMonData(&gPlayerParty[cursorPos], MON_DATA_HELD_ITEM, &gUnknown_02039D08->movingItem); + gUnknown_02039D08->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 (gUnknown_02039D08->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, &gUnknown_02039D08->movingItem); + SetBoxMonIconObjMode(cursorPos, 0); + } + else + { + SetMonData(&gPlayerParty[cursorPos], MON_DATA_HELD_ITEM, &gUnknown_02039D08->movingItem); + SetPartyMonIconObjMode(cursorPos, 0); + } +} + +static void Item_TakeMons(u8 cursorArea, u8 cursorPos) +{ + u8 id; + u16 item; + + if (gUnknown_02039D08->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); + } +} + +void sub_80D1194(void) +{ + if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + { + u8 id = sub_80D1370(2, 0); + sub_80D15D4(id, 5); + sub_80D1604(id, 0, 2, 0); + } +} + +void sub_80D11CC(void) +{ + s32 i; + + if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + return; + + for (i = 0; i < 3; i++) + { + if (gUnknown_02039D08->field_2204[i].unk10 && gUnknown_02039D08->field_2204[i].unk8 == 1) + sub_80D1604(i, 7, 2, 0); + } +} + +bool8 sub_80D1218(void) +{ + s32 i; + + for (i = 0; i < 3; i++) + { + if (gUnknown_02039D08->field_2204[i].unk10) + { + if (!gUnknown_02039D08->field_2204[i].sprite->affineAnimEnded && gUnknown_02039D08->field_2204[i].sprite->affineAnimBeginning) + return TRUE; + if (gUnknown_02039D08->field_2204[i].sprite->callback != SpriteCallbackDummy && gUnknown_02039D08->field_2204[i].sprite->callback != sub_80D1AD8) + return TRUE; + } + } + + return FALSE; +} + +bool8 sub_80D127C(void) +{ + s32 i; + + if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + { + for (i = 0; i < 3; i++) + { + if (gUnknown_02039D08->field_2204[i].unk10 && gUnknown_02039D08->field_2204[i].unk8 == 2) + return TRUE; + } + } + + return FALSE; +} + +const u8 *GetMovingItemName(void) +{ + return ItemId_GetName(gUnknown_02039D08->movingItem); +} + +u16 GetMovingItem(void) +{ + return gUnknown_02039D08->movingItem; +} + +u8 sub_80D12E8(void) +{ + u8 i; + + for (i = 0; i < 3; i++) + { + if (gUnknown_02039D08->field_2204[i].unk10 == 0) + { + gUnknown_02039D08->field_2204[i].unk10 = 1; + return i; + } + } + + return 3; +} + +bool32 sub_80D1324(u8 cursorArea, u8 cursorPos) +{ + s32 i; + + for (i = 0; i < 3; i++) + { + if (gUnknown_02039D08->field_2204[i].unk10 + && gUnknown_02039D08->field_2204[i].unk8 == cursorArea + && gUnknown_02039D08->field_2204[i].unk9 == cursorPos) + return TRUE; + } + + return FALSE; +} + +u8 sub_80D1370(u8 cursorArea, u8 cursorPos) +{ + u8 i; + + for (i = 0; i < 3; i++) + { + if (gUnknown_02039D08->field_2204[i].unk10 + && gUnknown_02039D08->field_2204[i].unk8 == cursorArea + && gUnknown_02039D08->field_2204[i].unk9 == cursorPos) + return i; + } + + return 3; +} + +u8 sub_80D13C4(struct Sprite *sprite) +{ + u8 i; + + for (i = 0; i < 3; i++) + { + if (gUnknown_02039D08->field_2204[i].unk10 + && gUnknown_02039D08->field_2204[i].sprite == sprite) + return i; + } + + return 3; +} diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 03a081af5..ebdb8b21a 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -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: @@ -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/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/script_pokemon_util_80F87D8.c b/src/script_pokemon_util_80F87D8.c index 7fc61f953..9f18d4b3a 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/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/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/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/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/window.c b/src/window.c index 4e1a38eff..5ae6c7509 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 = 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; } } From 128239d65edefc9d290a642c269adcc5b859a6f4 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 19 Dec 2018 22:47:27 +0100 Subject: [PATCH 10/13] Almost there --- asm/party_menu.s | 2 +- asm/pokemon_storage_system.s | 2287 ------------------------------ asm/pokenav.s | 2 +- include/pokemon.h | 9 - include/pokemon_storage_system.h | 305 +--- src/egg_hatch.c | 9 +- src/pokemon_storage_system.c | 1415 ++++++++++++++---- src/tv.c | 2 +- src/walda_phrase.c | 11 +- 9 files changed, 1223 insertions(+), 2819 deletions(-) diff --git a/asm/party_menu.s b/asm/party_menu.s index 2706368c2..dd06806cb 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -17996,7 +17996,7 @@ _081B9980: cmp r6, r0 bcc _081B9958 mov r0, r8 - bl sub_80D23A8 + bl AnyStorageMonWithMove cmp r0, 0x1 beq _081B999C ldr r1, =gSpecialVar_Result diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index 6dbe6b0f2..3ae8a9a62 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -5,2293 +5,6 @@ .text - - - - - 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 GetBoxMonDataAt -GetBoxMonDataAt: @ 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 GetBoxMonDataAt - - 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 GetCurrentBoxMonData -GetCurrentBoxMonData: @ 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 GetBoxMonDataAt - pop {r1} - bx r1 - .pool - thumb_func_end GetCurrentBoxMonData - - thumb_func_start SetCurrentBoxMonData -SetCurrentBoxMonData: @ 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 SetCurrentBoxMonData - - 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 GetAndCopyBoxMonDataAt -GetAndCopyBoxMonDataAt: @ 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 GetAndCopyBoxMonDataAt - - thumb_func_start SetBoxMonAt -SetBoxMonAt: @ 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 SetBoxMonAt - - 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 ZeroBoxMonAt -ZeroBoxMonAt: @ 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 ZeroBoxMonAt - - thumb_func_start BoxMonAtToMon -BoxMonAtToMon: @ 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 BoxMonAtToMon - - 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 GetBoxWallpaper -GetBoxWallpaper: @ 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 GetBoxWallpaper - - 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 CheckBoxedMonSanity -CheckBoxedMonSanity: @ 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 CheckBoxedMonSanity - - 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} diff --git a/asm/pokenav.s b/asm/pokenav.s index a383f58d2..7a1b84997 100644 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -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 diff --git a/include/pokemon.h b/include/pokemon.h index 8807168ef..4f30e92ab 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -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_storage_system.h b/include/pokemon_storage_system.h index 9b880b2c9..4f882ddaf 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -6,267 +6,60 @@ #define IN_BOX_COLUMS 5 #define IN_BOX_COUNT (IN_BOX_ROWS * IN_BOX_COLUMS) -#include "pc_screen_effect.h" -#include "mon_markings.h" - -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 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; - 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_90[16]; - 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; - u8 field_2D5; - u16 field_2D6; - s16 field_2D8; - u16 field_2DA; - u16 field_2DC; - u16 field_2DE; - u16 field_2E0; - u8 field_2E2; - u8 field_2E3; - u8 field_2E4[20]; - u8 field_2F8[1024]; - u8 field_6F8; - u8 field_6F9; - u8 field_6FA; - s8 field_6FB; - u16 field_6FC[16]; - u16 field_71C; - u16 field_71E; - struct Sprite *field_720[2]; - struct Sprite *field_728[2]; - struct Sprite *field_730[2]; - u32 field_738; - u8 field_73C[80]; - u16 field_78C; - s16 wallpaperSetId; - s16 wallpaperId; - u16 field_792[360]; - u8 wallpaperChangeState; - u8 field_A63; - u8 field_A64; - s8 field_A65; - u8 field_A66; - u8 field_A67; - 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; - u8 field_C5F; - u16 field_C60; - s16 field_C62; - s16 field_C64; - u16 field_C66; - u8 field_C68; - s8 field_C69; - u8 field_C6A; - u8 field_C6B; - struct WindowTemplate menuWindow; - struct StorageMenu menuItems[7]; - u8 menuItemsCount; - u8 menuWidth; - u8 field_CAE; - u8 field_CAF; - u16 field_CB0; - u8 field_CB2; - u8 field_CB3; - 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]; - u8 field_CDA; - u8 field_CDB; - const u32 *cursorMonPalette; - u32 cursorMonPersonality; - u16 cursorMonSpecies; - u16 cursorMonItem; - u16 field_CE8; - u8 field_CEA; - 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[5]; - u8 field_2180; - u8 field_2181; - u8 field_2182; - u8 field_2183; - u8 field_2184; - u8 field_2185; - 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 field_21EB[15]; // TODO: ITEM NAME LENGTH + 1 - u8 field_21FA; - u8 field_21FB; - u8 field_21FC; - u8 field_21FD; - u8 field_21FE; - u8 inBoxMovingMode; - u16 field_2200; - struct UnkStorageStruct field_2204[3]; - u16 movingItem; - u8 field_2236; - u8 field_2237; - u8 field_2238; - u8 field_2239; - u16 field_223A; - u16 *field_223C; - struct Sprite *cursorMonSprite; - u16 field_2244[16]; - u8 field_2264[96]; - u8 field_22C4[0x800]; - u8 field_2AC4[8192]; - u8 field_4AC4[0x1000]; - u8 field_5AC4[0x800]; -}; - -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 *); +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); -u32 GetBoxMonDataAt(u8 boxId, u8 monPosition, u32 request); -bool8 CheckFreePokemonStorageSpace(void); u8 StorageGetCurrentBox(void); -u8 sub_80D214C(struct BoxPokemon *a, u8 b, u8 c, u8 d); +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, s8 currIndex, u8 maxIndex, u8 arg3); +bool8 CheckFreePokemonStorageSpace(void); +bool32 CheckBoxedMonSanity(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/src/egg_hatch.c b/src/egg_hatch.c index 561987315..97c264d49 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -31,6 +31,7 @@ #include "international_string_util.h" #include "naming_screen.h" #include "field_screen.h" +#include "pokemon_storage_system.h" #include "battle.h" // to get rid of later struct EggHatchData @@ -61,8 +62,6 @@ extern const u8 gText_HatchedFromEgg[]; extern const u8 gText_NickHatchPrompt[]; extern void play_some_sound(void); -extern u16 sub_80D22D0(void); -extern u8 CountPartyAliveNonEggMonsExcept(u8); static void Task_EggHatch(u8 taskID); static void CB2_EggHatch_0(void); @@ -888,7 +887,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/pokemon_storage_system.c b/src/pokemon_storage_system.c index d9bc818ae..faa7573d6 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -12,6 +12,7 @@ #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" @@ -20,6 +21,7 @@ #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" @@ -46,6 +48,12 @@ struct WallpaperTable const u16 *palettes; }; +struct PokemonStorageSystemFunc +{ + u8 (*func)(void); + s8 unk4; +}; + struct Struct_02039D80 { u8 field_0; @@ -66,6 +74,248 @@ struct Struct_02039D80 struct BoxPokemon boxMons[IN_BOX_COUNT]; }; +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; + 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_90[16]; + 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; + u8 field_2D5; + u16 field_2D6; + s16 field_2D8; + u16 field_2DA; + u16 field_2DC; + u16 field_2DE; + u16 field_2E0; + u8 field_2E2; + u8 field_2E3; + u8 field_2E4[20]; + u8 field_2F8[1024]; + u8 field_6F8; + u8 field_6F9; + u8 field_6FA; + s8 field_6FB; + u16 field_6FC[16]; + u16 field_71C; + u16 field_71E; + struct Sprite *field_720[2]; + struct Sprite *field_728[2]; + struct Sprite *field_730[2]; + u32 field_738; + u8 field_73C[80]; + u16 field_78C; + s16 wallpaperSetId; + s16 wallpaperId; + u16 field_792[360]; + u8 wallpaperChangeState; + u8 field_A63; + u8 field_A64; + s8 field_A65; + u8 field_A66; + u8 field_A67; + 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; + u8 field_C5F; + u16 field_C60; + s16 field_C62; + s16 field_C64; + u16 field_C66; + u8 field_C68; + s8 field_C69; + u8 field_C6A; + u8 field_C6B; + struct WindowTemplate menuWindow; + struct StorageMenu menuItems[7]; + u8 menuItemsCount; + u8 menuWidth; + u8 field_CAE; + u8 field_CAF; + u16 field_CB0; + u8 field_CB2; + u8 field_CB3; + 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]; + u8 field_CDA; + u8 field_CDB; + const u32 *cursorMonPalette; + u32 cursorMonPersonality; + u16 cursorMonSpecies; + u16 cursorMonItem; + u16 field_CE8; + u8 field_CEA; + 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[5]; + u8 field_2180; + u8 field_2181; + u8 field_2182; + u8 field_2183; + u8 field_2184; + u8 field_2185; + 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 field_21EB[15]; // TODO: ITEM NAME LENGTH + 1 + u8 field_21FA; + u8 field_21FB; + u8 field_21FC; + u8 field_21FD; + u8 field_21FE; + u8 inBoxMovingMode; + u16 field_2200; + struct UnkStorageStruct field_2204[3]; + u16 movingItem; + u16 field_2236; + u8 field_2238; + u8 field_2239; + u16 field_223A; + u16 *field_223C; + struct Sprite *cursorMonSprite; + u16 field_2244[16]; + u8 field_2264[96]; + u8 field_22C4[0x800]; + u8 field_2AC4[6144]; + u8 field_42C4[0x800]; + u8 field_4AC4[0x1000]; + u8 field_5AC4[0x800]; +}; + enum { BOX_OPTION_WITHDRAW, @@ -156,6 +406,28 @@ enum WALLPAPER_MACHINE, WALLPAPER_PLAIN, WALLPAPER_FRIENDS, // The one received as a gift from Walda's parents. + WALLPAPERS_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 @@ -200,11 +472,14 @@ extern u8 gUnknown_02039D0F; extern u16 gUnknown_02039D12; extern struct Pokemon gUnknown_02039D14; extern struct Struct_02039D80 *gUnknown_02039D80; +extern struct UnkPSSStruct_2002370 *gUnknown_02039D04; +extern struct PokemonStorageSystemData *gUnknown_02039D08; 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[]; @@ -213,38 +488,34 @@ extern const u8 gText_Box[]; extern const u8 gText_JustOnePkmn[]; // This file's functions. -void CreatePCMenu(u8 whichMenu, s16 *windowIdPtr); -void Cb2_EnterPSS(u8 boxOption); -u8 GetCurrentBoxOption(void); +static void CreatePCMenu(u8 whichMenu, s16 *windowIdPtr); +static void Cb2_EnterPSS(u8 boxOption); +static u8 GetCurrentBoxOption(void); static u8 HandleInput(void); -u8 sub_80CDC2C(void); -u8 sub_80CB9BC(void); -void LoadWallpaperGfx(u8 boxId, s8 direction); +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); -void SetBoxWallpaper(u8 boxId, u8 wallpaperId); -void SetCurrentBox(u8 boxId); +static void SetCurrentBox(u8 boxId); static void sub_80CC32C(u8 boxId); -void ZeroBoxMonAt(u8 boxId, u8 boxPos); static void sub_80C7958(u8 curBox); static void sub_80CCAE0(void *arg0); -void ResetWaldaWallpaper(void); static void sub_80C7B14(void); static void sub_80C7BB4(void); -void ScrollBackground(void); +static void ScrollBackground(void); static void sub_80C7B80(void); -void sub_80D2AA4(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); -void GiveChosenBagItem(void); +static void GiveChosenBagItem(void); static void SetUpHidePartyMenu(void); static void DestroyAllPartyMonIcons(void); -void sub_80D11CC(void); -void LoadPSSMenuGfx(void); -void LoadWaveformSpritePalette(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); @@ -253,84 +524,84 @@ static void sub_80CEBDC(void); static void SetScrollingBackground(void); static void sub_80CABE0(void); static void sub_80CAEAC(void); -void sub_80D0C60(void); -void sub_80CFEA8(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); -void InitCanRelaseMonVars(void); -void sub_80D01B8(void); -void ReleaseMon(void); -void sub_80D25F0(void); -void RefreshCursorMonData(void); -void LoadCursorMonSprite(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); -void ClearBottomWindow(void); +static void ClearBottomWindow(void); static void sub_80CA704(void); -void sub_80D013C(void); +static void sub_80D013C(void); static void sub_80CE00C(void); -void sub_80D1194(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); -void sub_80CFC14(void); +static void sub_80CFC14(void); static void sub_80CEB40(void); static void sub_80CCEE0(void); -void sub_80D1818(void); +static void sub_80D1818(void); +static void sub_80D19B4(u32 arg0); static void sub_80CAA74(void); -void sub_80D17B4(void); +static void PrintItemDescription(void); static void sub_80CE760(void); static void sub_80CDBA0(void); static void sub_80CE7E8(void); -void sub_80CFECC(void); +static void sub_80CFECC(void); static void sub_80CA9EC(void); -void FreePSSData(void); +static void FreePSSData(void); static void AddBoxMenu(void); static void sub_80CCF9C(void); -void MoveMon(void); -void PlaceMon(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); -void BoxSetMosaic(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); -bool32 WaitForWallpaperGfxLoad(void); -bool8 InitPSSWindows(void); +static bool32 WaitForWallpaperGfxLoad(void); +static bool8 InitPSSWindows(void); static bool8 sub_80CC0A0(void); static bool8 sub_80CE2A8(void); -bool8 sub_80D0164(void); +static bool8 sub_80D0164(void); static bool8 sub_80CC35C(void); -bool8 sub_80D01E4(void); +static bool8 sub_80D01E4(void); static bool8 sub_80CDED4(void); static bool8 sub_80CDF08(void); -bool8 sub_80D184C(void); -bool8 sub_80D18E4(void); +static bool8 sub_80D184C(void); +static bool8 sub_80D18E4(void); static bool8 DoShowPartyMenu(void); -bool8 sub_80D1218(void); -bool8 ScrollToBox(void); -bool8 sub_80CD554(void); +static bool8 sub_80D1218(void); +static bool8 ScrollToBox(void); +static bool8 sub_80CD554(void); static bool8 HidePartyMenu(void); -bool8 sub_80D127C(void); -bool8 sub_80D0580(u8 arg0); -bool8 sub_80D0BC0(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); -bool8 DoMonPlaceChange(void); -bool8 sub_80D00A8(void); +static bool8 DoMonPlaceChange(void); +static bool8 sub_80D00A8(void); static bool8 CanMovePartyMon(void); static bool8 CanShifMon(void); static bool8 IsCursorOnCloseBox(void); @@ -369,110 +640,100 @@ static void Cb_HandleWallpapers(u8 taskId); static void Cb_NameBox(u8 taskId); static void Cb_PrintCantStoreMail(u8 taskId); static void Cb_HandleMovingMonFromParty(u8 taskId); -void sub_80D2A90(struct UnkStruct_2000020 *arg0, struct UnkStruct_2000028 *arg1, u32 arg2); -void sub_80D259C(u8 arg0); static void SetUpScrollToBox(u8 boxId); -void sub_80CFE54(u8 animNum); -void sub_80D2918(u8 arg0); +static void sub_80CFE54(u8 animNum); static void SetMovingMonPriority(u8 priority); -void InitMonPlaceChange(u8 arg0); +static void InitMonPlaceChange(u8 arg0); static void SetMonMarkings(u8 markings); -void ShowYesNoWindow(s8 cursorPos); +static void ShowYesNoWindow(s8 cursorPos); static void sub_80CDBF8(u8 cursorBoxPosition); -void sub_80D01D0(u8 arg0); +static void sub_80D01D0(u8 arg0); static void sub_80CD1A8(bool8 arg0); static void sub_80CA984(bool8 arg0); -void CreatePartyMonsSprites(bool8 arg0); -void sub_80D2644(u8 arg0, u16 arg1, const void *arg2, u16 arg3, u16 arg4); -void sub_80D2770(u8 arg0, u16 arg1, u16 arg2); -void PrintStorageActionText(u8 id); -s16 sub_80D00AC(void); -s8 RunCanReleaseMon(void); -u8 GetBoxCursorPosition(void); +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); -struct Sprite *sub_80CD2E8(u16 x, u16 y, u8 animId, u8 priority, u8 subpriority); +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); -u16 GetMovingItem(void); -void SetCurrentBoxMonData(u8 monId, s32 request, const void *value); -s32 GetCurrentBoxMonData(u8 boxPosition, s32 request); -void LoadCursorMonGfx(u16 species, u32 pid); +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); -void sub_80D27AC(u8 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4); -void sub_80D27F4(u8 arg0, u8 arg1, s8 arg2); static void sub_80CBAF0(s16 yDelta); static void sub_80CAAA8(u8 arg0, bool8 isPartyMon); -const u8 *GetMovingItemName(void); -bool32 IsWaldaWallpaperUnlocked(void); +static const u8 *GetMovingItemName(void); static void SetMenuText(u8 textId); -void sub_80D0D8C(u8 cursorArea, u8 cursorPos); -void sub_80D0E50(u8 cursorArea, u8 cursorPos); -void sub_80D0F38(u16 item); +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); -s8 sub_80CC644(u8 boxId); -u8 GetBoxWallpaper(u8 boxId); -u32 GetWaldaWallpaperPatternId(void); -u32 GetWaldaWallpaperIconId(void); +static s8 sub_80CC644(u8 boxId); static void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2); -u16 *GetWaldaWallpaperColorsPtr(void); -void sub_80C6D80(u8 *arg0, void *arg1, u8 arg2, u8 arg3, s32 arg4); 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); -void sub_80CD444(u8 cursorArea, u8 cursorPosition, u16 *x, u16 *y); +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); -void PurgeMonOrBoxMon(u8 boxId, u8 position); -void BoxMonAtToMon(u8 boxId, u8 position, struct Pokemon *dst); -void SetBoxMonAt(u8 boxId, u8 position, struct BoxPokemon *src); +static void PurgeMonOrBoxMon(u8 boxId, u8 position); static void SetCursorMonData(void *pokemon, u8 mode); -bool32 AtLeastThreeUsableMons(void); -bool32 CheckBoxedMonSanity(s32 boxId, s32 boxPosition); -s32 GetAndCopyBoxMonDataAt(u8 boxId, u8 boxPosition, s32 request, void *dst); +static bool32 AtLeastThreeUsableMons(void); static u8 InBoxInput_Normal(void); static u8 InBoxInput_MovingMultiple(void); static u8 InBoxInput_GrabbingMultiple(void); -s8 sub_80CFF98(u8 arg0); -u8 sub_80CFA5C(void); -u8 sub_80D0BA4(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); -bool8 sub_80D024C(void); -bool8 sub_80D0344(void); -bool8 sub_80D03B0(void); -bool8 sub_80D0420(void); -bool8 sub_80D04A0(void); -bool8 sub_80D04C8(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); void sub_80D304C(u16 palIndex); -void sub_80D07B0(u8 arg0, u8 arg1); -void sub_80D0834(u8 arg0, u8 arg1); -void sub_80D0B5C(void); -void sub_80D062C(void); -void sub_80D0884(u16 arg0, u16 arg1, u16 arg2); -void sub_80D08CC(void); -void sub_80D09A4(void); -void sub_80D0A1C(void); -void sub_80D0AAC(void); -u8 sub_80D0894(void); -void sub_80D0778(u8 arg0, u8 arg1, u8 arg2); -void sub_80D0708(u8 arg0, u8 arg1, u8 arg2); -void sub_80D06D0(u8 arg0, u8 arg1, u8 arg2); -void sub_80D0740(u8 arg0, u8 arg1, u8 arg2); +void sub_80D27AC(u8 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4); +void sub_80D27F4(u8 arg0, u8 arg1, s8 arg2); +void sub_80D2644(u8 arg0, u16 arg1, const void *arg2, u16 arg3, u16 arg4); +void sub_80D2770(u8 arg0, u16 arg1, u16 arg2); +void sub_80D2A90(struct UnkStruct_2000020 *arg0, struct UnkStruct_2000028 *arg1, u32 arg2); +void sub_80D259C(u8 arg0); +void sub_80D25F0(void); +void sub_80D2AA4(void); +void sub_80D2918(u8 arg0); // static const rom data static const struct PSS_MenuStringPtrs gUnknown_085716C0[] = @@ -1294,9 +1555,9 @@ static const struct SpriteTemplate gUnknown_0857B0E0 = sub_80CD210 }; -const u16 gHandCursorPalette[] = INCBIN_U16("graphics/pokemon_storage/hand_cursor.gbapal"); -const u8 gHandCursorTiles[] = INCBIN_U8("graphics/pokemon_storage/hand_cursor.4bpp"); -const u8 gHandCursorShadowTiles[] = INCBIN_U8("graphics/pokemon_storage/hand_cursor_shadow.4bpp"); +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) @@ -1436,7 +1697,7 @@ static void sub_80C71A4(u16 *dest, u16 dest_left, u16 dest_top, u16 width, u16 h Dma3FillLarge16_(0, dest, width); } -void Task_PokemonStorageSystemPC(u8 taskId) +static void Task_PokemonStorageSystemPC(u8 taskId) { struct Task *task = &gTasks[taskId]; @@ -1553,7 +1814,7 @@ void ShowPokemonStorageSystemPC(void) ScriptContext2_Enable(); } -void FieldCb_ReturnToPcMenu(void) +static void FieldCb_ReturnToPcMenu(void) { u8 taskId; MainCallback vblankCb = gMain.vblankCallback; @@ -1567,7 +1828,7 @@ void FieldCb_ReturnToPcMenu(void) pal_fill_black(); } -void CreatePCMenu(u8 whichMenu, s16 *windowIdPtr) +static void CreatePCMenu(u8 whichMenu, s16 *windowIdPtr) { s16 windowId; struct WindowTemplate winTemplate = gUnknown_085716E8; @@ -1580,14 +1841,14 @@ void CreatePCMenu(u8 whichMenu, s16 *windowIdPtr) *windowIdPtr = windowId; } -void Cb2_ExitPSS(void) +static void Cb2_ExitPSS(void) { 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; @@ -1682,7 +1943,7 @@ static void sub_80C78E4(void) sub_80C7B14(); } -u8 sub_80C78F0(void) +static u8 sub_80C78F0(void) { if (gMain.newKeys & B_BUTTON) { @@ -1842,7 +2103,7 @@ static void sub_80C7CF4(struct Sprite *sprite) } } -void VblankCb_PSS(void) +static void VblankCb_PSS(void) { LoadOam(); ProcessSpriteCopyRequests(); @@ -1851,7 +2112,7 @@ void VblankCb_PSS(void) SetGpuReg(REG_OFFSET_BG2HOFS, gUnknown_02039D08->bg2_X); } -void Cb2_PSS(void) +static void Cb2_PSS(void) { RunTasks(); do_scheduled_bg_tilemap_copies_to_vram(); @@ -1861,7 +2122,7 @@ void Cb2_PSS(void) BuildOamBuffer(); } -void Cb2_EnterPSS(u8 boxOption) +static void Cb2_EnterPSS(u8 boxOption) { ResetTasks(); sCurrentBoxOption = boxOption; @@ -1882,7 +2143,7 @@ void Cb2_EnterPSS(u8 boxOption) } } -void Cb2_ReturnToPSS(void) +static void Cb2_ReturnToPSS(void) { ResetTasks(); gUnknown_02039D08 = Alloc(sizeof(*gUnknown_02039D08)); @@ -1900,7 +2161,7 @@ void Cb2_ReturnToPSS(void) } } -void ResetAllBgCoords(void) +static void ResetAllBgCoords(void) { SetGpuReg(REG_OFFSET_BG0HOFS, 0); SetGpuReg(REG_OFFSET_BG0VOFS, 0); @@ -2428,7 +2689,7 @@ static void Cb_OnSelectedMon(u8 taskId) PlaySE(SE_SELECT); if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) PrintStorageActionText(PC_TEXT_IS_SELECTED); - else if (sub_80D127C() || gUnknown_02039D08->cursorMonItem != 0) + else if (IsActiveItemMoving() || gUnknown_02039D08->cursorMonItem != 0) PrintStorageActionText(PC_TEXT_IS_SELECTED2); else PrintStorageActionText(PC_TEXT_GIVE_TO_MON); @@ -3079,7 +3340,7 @@ static void Cb_ShowItemInfo(u8 taskId) if (!IsDma3ManagerBusyWithBgCopy()) { PlaySE(SE_WIN_OPEN); - sub_80D17B4(); + PrintItemDescription(); sub_80D1818(); gUnknown_02039D08->state++; } @@ -3451,7 +3712,7 @@ static void Cb_OnCloseBoxPressed(u8 taskId) PrintStorageActionText(PC_TEXT_HOLDING_POKE); gUnknown_02039D08->state = 1; } - else if (sub_80D127C()) + else if (IsActiveItemMoving()) { SetPSSCallback(Cb_CloseBoxWhileHoldingItem); } @@ -3512,7 +3773,7 @@ static void Cb_OnBPressed(u8 taskId) PrintStorageActionText(PC_TEXT_HOLDING_POKE); gUnknown_02039D08->state = 1; } - else if (sub_80D127C()) + else if (IsActiveItemMoving()) { SetPSSCallback(Cb_CloseBoxWhileHoldingItem); } @@ -3568,7 +3829,7 @@ static void Cb_ChangeScreen(u8 taskId) u8 mode, monIndex, maxMonIndex; u8 screenChangeType = gUnknown_02039D08->screenChangeType; - if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS && sub_80D127C() == TRUE) + if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS && IsActiveItemMoving() == TRUE) gUnknown_02039D12 = GetMovingItem(); else gUnknown_02039D12 = 0; @@ -3604,7 +3865,7 @@ static void Cb_ChangeScreen(u8 taskId) DestroyTask(taskId); } -void GiveChosenBagItem(void) +static void GiveChosenBagItem(void) { u16 item = gSpecialVar_ItemId; @@ -3621,7 +3882,7 @@ void GiveChosenBagItem(void) } } -void FreePSSData(void) +static void FreePSSData(void) { sub_80D25F0(); sub_80D01B8(); @@ -3636,13 +3897,13 @@ static void SetScrollingBackground(void) LZ77UnCompVram(gPokemonStorageScrollingBGTilemap, (void *)VRAM + 0xF800); } -void ScrollBackground(void) +static void ScrollBackground(void) { ChangeBgX(3, 128, 1); ChangeBgY(3, 128, 2); } -void LoadPSSMenuGfx(void) +static void LoadPSSMenuGfx(void) { InitBgsFromTemplates(0, gUnknown_08572734, ARRAY_COUNT(gUnknown_08572734)); DecompressAndLoadBgGfxUsingHeap(1, gPSSMenu_Gfx, 0, 0, 0); @@ -3652,7 +3913,7 @@ void LoadPSSMenuGfx(void) schedule_bg_copy_tilemap_to_vram(1); } -bool8 InitPSSWindows(void) +static bool8 InitPSSWindows(void) { if (!InitWindows(gUnknown_08572714)) { @@ -3665,7 +3926,7 @@ bool8 InitPSSWindows(void) } } -void LoadWaveformSpritePalette(void) +static void LoadWaveformSpritePalette(void) { LoadSpritePalette(&gWaveformSpritePalette); } @@ -3710,7 +3971,7 @@ static void sub_80CA1C4(void) } } -void RefreshCursorMonData(void) +static void RefreshCursorMonData(void) { LoadCursorMonGfx(gUnknown_02039D08->cursorMonSpecies, gUnknown_02039D08->cursorMonPersonality); PrintCursorMonInfo(); @@ -3718,7 +3979,7 @@ void RefreshCursorMonData(void) schedule_bg_copy_tilemap_to_vram(0); } -void BoxSetMosaic(void) +static void BoxSetMosaic(void) { RefreshCursorMonData(); if (gUnknown_02039D08->cursorMonSprite) @@ -3731,7 +3992,7 @@ void BoxSetMosaic(void) } } -u8 sub_80CA2B8(void) +static u8 sub_80CA2B8(void) { return gUnknown_02039D08->cursorMonSprite->oam.mosaic; } @@ -3749,7 +4010,7 @@ static void sub_80CA2D0(struct Sprite *sprite) } } -void LoadCursorMonSprite(void) +static void LoadCursorMonSprite(void) { u16 i; u16 tileStart; @@ -3792,7 +4053,7 @@ void LoadCursorMonSprite(void) } } -void LoadCursorMonGfx(u16 species, u32 pid) +static void LoadCursorMonGfx(u16 species, u32 pid) { if (gUnknown_02039D08->cursorMonSprite == NULL) return; @@ -4088,7 +4349,7 @@ static void sub_80CAC1C(void) CopyBgTilemapBufferToVram(0); } -void PrintStorageActionText(u8 id) +static void PrintStorageActionText(u8 id) { u8 *txtPtr; @@ -4108,7 +4369,7 @@ void PrintStorageActionText(u8 id) DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_02039D08->field_21E0); break; case PC_TEXT_FMT_ITEM_NAME: - if (sub_80D127C()) + if (IsActiveItemMoving()) txtPtr = StringCopy(gUnknown_02039D08->field_21EB, GetMovingItemName()); else txtPtr = StringCopy(gUnknown_02039D08->field_21EB, gUnknown_02039D08->cursorMonItemName); @@ -4130,13 +4391,13 @@ void PrintStorageActionText(u8 id) schedule_bg_copy_tilemap_to_vram(0); } -void ShowYesNoWindow(s8 cursorPos) +static void ShowYesNoWindow(s8 cursorPos) { CreateYesNoMenu(&sYesNoWindowTemplate, 11, 14, 0); Menu_MoveCursorNoWrapAround(cursorPos); } -void ClearBottomWindow(void) +static void ClearBottomWindow(void) { sub_8198070(1, FALSE); schedule_bg_copy_tilemap_to_vram(0); @@ -4187,7 +4448,7 @@ static void AddWallpapersMenu(u8 wallpaperSet) AddMenu(); } -u8 GetCurrentBoxOption(void) +static u8 GetCurrentBoxOption(void) { return sCurrentBoxOption; } @@ -4227,12 +4488,12 @@ static void sub_80CAF04(void) gUnknown_02039D08->field_78C = 0; } -u8 sub_80CAFAC(void) +static u8 sub_80CAFAC(void) { return (IsCursorInBox() ? 2 : 1); } -void CreateMovingMonIcon(void) +static void CreateMovingMonIcon(void) { u32 personality = GetMonData(&gUnknown_02039D08->movingMon, MON_DATA_PERSONALITY); u16 species = GetMonData(&gUnknown_02039D08->movingMon, MON_DATA_SPECIES2); @@ -4280,7 +4541,7 @@ static void sub_80CB028(u8 boxId) } } -void sub_80CB140(u8 boxPosition) +static void sub_80CB140(u8 boxPosition) { u16 species = GetCurrentBoxMonData(boxPosition, MON_DATA_SPECIES2); @@ -4357,7 +4618,7 @@ static void DestroyAllIconsInRow(u8 row) } } -u8 sub_80CB2F8(u8 row, u16 times, s16 xDelta) +static u8 sub_80CB2F8(u8 row, u16 times, s16 xDelta) { s32 i; u16 y = 44; @@ -4498,7 +4759,7 @@ static void SetBoxSpeciesAndPersonalities(u8 boxId) gUnknown_02039D08->field_C5C = boxId; } -void DestroyBoxMonIconAtPosition(u8 boxPosition) +static void DestroyBoxMonIconAtPosition(u8 boxPosition) { if (gUnknown_02039D08->boxMonsSprites[boxPosition] != NULL) { @@ -4507,7 +4768,7 @@ void DestroyBoxMonIconAtPosition(u8 boxPosition) } } -void SetBoxMonIconObjMode(u8 boxPosition, u8 objMode) +static void SetBoxMonIconObjMode(u8 boxPosition, u8 objMode) { if (gUnknown_02039D08->boxMonsSprites[boxPosition] != NULL) { @@ -4515,7 +4776,7 @@ void SetBoxMonIconObjMode(u8 boxPosition, u8 objMode) } } -void CreatePartyMonsSprites(bool8 arg0) +static void CreatePartyMonsSprites(bool8 arg0) { u16 i, count; u16 species = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES2); @@ -4577,7 +4838,7 @@ static void sub_80CB950(void) } } -u8 sub_80CB9BC(void) +static u8 sub_80CB9BC(void) { return gUnknown_02039D08->field_C5E; } @@ -4679,7 +4940,7 @@ static void DestroyAllPartyMonIcons(void) } } -void SetPartyMonIconObjMode(u8 partyId, u8 objMode) +static void SetPartyMonIconObjMode(u8 partyId, u8 objMode) { if (gUnknown_02039D08->partySprites[partyId] != NULL) { @@ -4998,7 +5259,7 @@ static void SetUpScrollToBox(u8 boxId) gUnknown_02039D08->field_A63 = 0; } -bool8 ScrollToBox(void) +static bool8 ScrollToBox(void) { bool8 var; @@ -5032,7 +5293,7 @@ bool8 ScrollToBox(void) return TRUE; } -s8 sub_80CC644(u8 boxId) +static s8 sub_80CC644(u8 boxId) { u8 i; u8 currentBox = StorageGetCurrentBox(); @@ -5089,7 +5350,7 @@ static bool8 DoWallpaperGfxChange(void) return TRUE; } -void LoadWallpaperGfx(u8 boxId, s8 direction) +static void LoadWallpaperGfx(u8 boxId, s8 direction) { u8 wallpaperId; const struct WallpaperTable *wallpaperGfx; @@ -5145,7 +5406,7 @@ void LoadWallpaperGfx(u8 boxId, s8 direction) CopyBgTilemapBufferToVram(2); } -bool32 WaitForWallpaperGfxLoad(void) +static bool32 WaitForWallpaperGfxLoad(void) { if (IsDma3ManagerBusyWithBgCopy()) return FALSE; @@ -5456,7 +5717,7 @@ static void sub_80CD210(struct Sprite *sprite) } } -struct Sprite *sub_80CD2E8(u16 x, u16 y, u8 animId, u8 priority, u8 subpriority) +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) @@ -5501,7 +5762,7 @@ static void sub_80CD3EC(void) } } -void sub_80CD444(u8 cursorArea, u8 cursorPosition, u16 *x, u16 *y) +static void sub_80CD444(u8 cursorArea, u8 cursorPosition, u16 *x, u16 *y) { switch (cursorArea) { @@ -5554,7 +5815,7 @@ static u16 sub_80CD504(void) } } -bool8 sub_80CD554(void) +static bool8 sub_80CD554(void) { s16 tmp; @@ -5672,7 +5933,7 @@ static void sub_80CD894(u8 newCurosrArea, u8 newCursorPosition) } else { - if (!sub_80D127C()) + if (!IsActiveItemMoving()) StartSpriteAnim(gUnknown_02039D08->field_CB4, 1); } @@ -5731,7 +5992,7 @@ static void sub_80CDA68(void) } else { - if (!sub_80D127C()) + if (!IsActiveItemMoving()) StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); } @@ -5795,12 +6056,12 @@ static void sub_80CDC18(void) gUnknown_02039D7E = sBoxCursorPosition; } -u8 sub_80CDC2C(void) +static u8 sub_80CDC2C(void) { return gUnknown_02039D7E; } -void InitMonPlaceChange(u8 a0) +static void InitMonPlaceChange(u8 a0) { static bool8 (*const placeChangeFuncs[])(void) = { @@ -5813,7 +6074,7 @@ void InitMonPlaceChange(u8 a0) gUnknown_02039D08->monPlaceChangeState = 0; } -void sub_80CDC64(bool8 arg0) +static void sub_80CDC64(bool8 arg0) { if (!arg0) gUnknown_02039D08->monPlaceChangeFunc = sub_80CDEB4; @@ -5823,7 +6084,7 @@ void sub_80CDC64(bool8 arg0) gUnknown_02039D08->monPlaceChangeState = 0; } -bool8 DoMonPlaceChange(void) +static bool8 DoMonPlaceChange(void) { return gUnknown_02039D08->monPlaceChangeFunc(); } @@ -5959,7 +6220,7 @@ static bool8 sub_80CDF08(void) return TRUE; } -void MoveMon(void) +static void MoveMon(void) { switch (sBoxCursorArea) { @@ -5981,7 +6242,7 @@ void MoveMon(void) sIsMonBeingMoved = TRUE; } -void PlaceMon(void) +static void PlaceMon(void) { u8 boxId; @@ -6033,7 +6294,7 @@ static void SetPlacedMonData(u8 boxId, u8 position) } } -void PurgeMonOrBoxMon(u8 boxId, u8 position) +static void PurgeMonOrBoxMon(u8 boxId, u8 position) { if (boxId == TOTAL_BOXES_COUNT) ZeroMonData(&gPlayerParty[position]); @@ -6115,7 +6376,7 @@ static bool8 sub_80CE2A8(void) } } -void ReleaseMon(void) +static void ReleaseMon(void) { u8 boxId; @@ -6174,7 +6435,7 @@ static void sub_80CE350(u16 *moves) *moves = MOVES_COUNT; } -void InitCanRelaseMonVars(void) +static void InitCanRelaseMonVars(void) { if (!AtLeastThreeUsableMons()) { @@ -6219,7 +6480,7 @@ void InitCanRelaseMonVars(void) gUnknown_02039D08->field_2172 = 0; } -bool32 AtLeastThreeUsableMons(void) +static bool32 AtLeastThreeUsableMons(void) { s32 i, j, count; @@ -6248,7 +6509,7 @@ bool32 AtLeastThreeUsableMons(void) return FALSE; } -s8 RunCanReleaseMon(void) +static s8 RunCanReleaseMon(void) { u16 i; u16 knownMoves; @@ -8048,7 +8309,7 @@ static u8 HandleInput(void) return 0; } -void AddBoxMenu(void) +static void AddBoxMenu(void) { InitMenu(); SetMenuText(9); @@ -8057,7 +8318,7 @@ void AddBoxMenu(void) SetMenuText(0); } -u8 sub_80CFA5C(void) +static u8 sub_80CFA5C(void) { InitMenu(); if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) @@ -8125,7 +8386,7 @@ static bool8 sub_80CFB44(void) if (gUnknown_02039D08->cursorMonSpecies == SPECIES_EGG) return FALSE; - if (!sub_80D127C()) + if (!IsActiveItemMoving()) { if (gUnknown_02039D08->cursorMonItem == 0) { @@ -8166,13 +8427,13 @@ static bool8 sub_80CFB44(void) return TRUE; } -void sub_80CFBF4(struct Sprite *sprite) +static void sub_80CFBF4(struct Sprite *sprite) { sprite->pos1.x = gUnknown_02039D08->field_CB4->pos1.x; sprite->pos1.y = gUnknown_02039D08->field_CB4->pos1.y + 20; } -void sub_80CFC14(void) +static void sub_80CFC14(void) { u16 x, y; u8 spriteId; @@ -8298,18 +8559,18 @@ static const struct SpriteTemplate gSpriteTemplate_857BA68 = } } -void sub_80CFDC4(void) +static void sub_80CFDC4(void) { sCanOnlyMove = !sCanOnlyMove; gUnknown_02039D08->field_CB4->oam.paletteNum = gUnknown_02039D08->field_CD8[sCanOnlyMove]; } -u8 GetBoxCursorPosition(void) +static u8 GetBoxCursorPosition(void) { return sBoxCursorPosition; } -void sub_80CFE14(u8 *arg0, u8 *arg1) +static void sub_80CFE14(u8 *arg0, u8 *arg1) { if (sBoxCursorArea == CURSOR_AREA_IN_BOX) { @@ -8323,28 +8584,28 @@ void sub_80CFE14(u8 *arg0, u8 *arg1) } } -void sub_80CFE54(u8 animNum) +static void sub_80CFE54(u8 animNum) { StartSpriteAnim(gUnknown_02039D08->field_CB4, animNum); } -u8 sub_80CFE78(void) +static u8 sub_80CFE78(void) { return sMovingMonOrigBoxId; } -void sub_80CFE84(void) +static void sub_80CFE84(void) { gUnknown_02039D08->field_CB4->oam.priority = 1; } -void sub_80CFEA8(void) +static void sub_80CFEA8(void) { if (sBoxCursorArea == CURSOR_AREA_IN_BOX) sub_80D0E50(CURSOR_AREA_IN_BOX, sBoxCursorPosition); } -void sub_80CFECC(void) +static void sub_80CFECC(void) { if (sBoxCursorArea == CURSOR_AREA_IN_BOX) sub_80D0D8C(CURSOR_AREA_IN_BOX, sBoxCursorPosition); @@ -8419,7 +8680,7 @@ static void SetMenuText(u8 textId) } } -s8 sub_80CFF98(u8 arg0) +static s8 sub_80CFF98(u8 arg0) { if (arg0 >= gUnknown_02039D08->menuItemsCount) return -1; @@ -8442,12 +8703,12 @@ static void AddMenu(void) gUnknown_02039D08->field_CAE = 0; } -bool8 sub_80D00A8(void) +static bool8 sub_80D00A8(void) { return 0; } -s16 sub_80D00AC(void) +static s16 sub_80D00AC(void) { s32 textId = -2; @@ -8487,7 +8748,7 @@ s16 sub_80D00AC(void) return textId; } -void sub_80D013C(void) +static void sub_80D013C(void) { sub_8198070(gUnknown_02039D08->field_CB0, TRUE); RemoveWindow(gUnknown_02039D08->field_CB0); @@ -8497,7 +8758,7 @@ void sub_80D013C(void) // 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. -const struct WindowTemplate gUnknown_0857BB1C = +static const struct WindowTemplate gUnknown_0857BB1C = { .bg = 0, .tilemapLeft = 10, @@ -8508,7 +8769,7 @@ const struct WindowTemplate gUnknown_0857BB1C = .baseBlock = 0xA, }; -bool8 sub_80D0164(void) +static bool8 sub_80D0164(void) { gUnknown_02039D80 = Alloc(sizeof(*gUnknown_02039D80)); if (gUnknown_02039D80 != NULL) @@ -8524,19 +8785,19 @@ bool8 sub_80D0164(void) return FALSE; } -void sub_80D01B8(void) +static void sub_80D01B8(void) { if (gUnknown_02039D80 != NULL) Free(gUnknown_02039D80); } -void sub_80D01D0(u8 arg0) +static void sub_80D01D0(u8 arg0) { gUnknown_02039D80->field_0 = arg0; gUnknown_02039D80->state = 0; } -bool8 sub_80D01E4(void) +static bool8 sub_80D01E4(void) { switch (gUnknown_02039D80->field_0) { @@ -8557,7 +8818,7 @@ bool8 sub_80D01E4(void) return FALSE; } -bool8 sub_80D024C(void) +static bool8 sub_80D024C(void) { switch (gUnknown_02039D80->state) { @@ -8595,7 +8856,7 @@ bool8 sub_80D024C(void) return TRUE; } -bool8 sub_80D0344(void) +static bool8 sub_80D0344(void) { switch (gUnknown_02039D80->state) { @@ -8622,7 +8883,7 @@ bool8 sub_80D0344(void) return TRUE; } -bool8 sub_80D03B0(void) +static bool8 sub_80D03B0(void) { switch (gUnknown_02039D80->state) { @@ -8644,7 +8905,7 @@ bool8 sub_80D03B0(void) return TRUE; } -bool8 sub_80D0420(void) +static bool8 sub_80D0420(void) { u8 var1, var2; @@ -8676,7 +8937,7 @@ bool8 sub_80D0420(void) return TRUE; } -bool8 sub_80D04A0(void) +static bool8 sub_80D04A0(void) { u8 var1 = sub_80CD554(); u8 var2 = sub_80D0894(); @@ -8687,7 +8948,7 @@ bool8 sub_80D04A0(void) return TRUE; } -bool8 sub_80D04C8(void) +static bool8 sub_80D04C8(void) { switch (gUnknown_02039D80->state) { @@ -8729,7 +8990,7 @@ bool8 sub_80D04C8(void) return TRUE; } -bool8 sub_80D0580(u8 arg0) +static bool8 sub_80D0580(u8 arg0) { switch (arg0) { @@ -8762,7 +9023,7 @@ bool8 sub_80D0580(u8 arg0) return TRUE; } -void sub_80D062C(void) +static void sub_80D062C(void) { s16 var = (abs(gUnknown_02039D80->fromRow - gUnknown_02039D80->field_6)) - (abs(gUnknown_02039D80->fromRow - gUnknown_02039D80->toRow)); s16 var2 = (abs(gUnknown_02039D80->fromColumn - gUnknown_02039D80->field_7)) - (abs(gUnknown_02039D80->fromColumn - gUnknown_02039D80->toColumn)); @@ -8786,7 +9047,7 @@ void sub_80D062C(void) } } -void sub_80D06D0(u8 arg0, u8 arg1, u8 arg2) +static void sub_80D06D0(u8 arg0, u8 arg1, u8 arg2) { u8 var1 = arg1; @@ -8800,7 +9061,7 @@ void sub_80D06D0(u8 arg0, u8 arg1, u8 arg2) sub_80D07B0(arg0, arg1++); } -void sub_80D0708(u8 arg0, u8 arg1, u8 arg2) +static void sub_80D0708(u8 arg0, u8 arg1, u8 arg2) { u8 var1 = arg1; @@ -8814,7 +9075,7 @@ void sub_80D0708(u8 arg0, u8 arg1, u8 arg2) sub_80D07B0(arg1++, arg0); } -void sub_80D0740(u8 arg0, u8 arg1, u8 arg2) +static void sub_80D0740(u8 arg0, u8 arg1, u8 arg2) { u8 var1 = arg1; @@ -8828,7 +9089,7 @@ void sub_80D0740(u8 arg0, u8 arg1, u8 arg2) sub_80D0834(arg0, arg1++); } -void sub_80D0778(u8 arg0, u8 arg1, u8 arg2) +static void sub_80D0778(u8 arg0, u8 arg1, u8 arg2) { u8 var1 = arg1; @@ -8842,7 +9103,7 @@ void sub_80D0778(u8 arg0, u8 arg1, u8 arg2) sub_80D0834(arg1++, arg0); } -void sub_80D07B0(u8 arg0, u8 arg1) +static void sub_80D07B0(u8 arg0, u8 arg1) { u8 position = arg0 + (6 * arg1); u16 species = GetCurrentBoxMonData(position, MON_DATA_SPECIES2); @@ -8867,7 +9128,7 @@ void sub_80D07B0(u8 arg0, u8 arg1) } } -void sub_80D0834(u8 arg0, u8 arg1) +static void sub_80D0834(u8 arg0, u8 arg1) { u8 position = arg0 + (6 * arg1); u16 species = GetCurrentBoxMonData(position, MON_DATA_SPECIES2); @@ -8883,14 +9144,14 @@ void sub_80D0834(u8 arg0, u8 arg1) } } -void sub_80D0884(u16 arg0, u16 arg1, u16 arg2) +static void sub_80D0884(u16 arg0, u16 arg1, u16 arg2) { gUnknown_02039D80->bgX = arg0; gUnknown_02039D80->bgY = arg1; gUnknown_02039D80->field_10 = arg2; } -u8 sub_80D0894(void) +static u8 sub_80D0894(void) { if (gUnknown_02039D80->field_10 != 0) { @@ -8902,7 +9163,7 @@ u8 sub_80D0894(void) return gUnknown_02039D80->field_10; } -void sub_80D08CC(void) +static void sub_80D08CC(void) { s32 i, j, r8, r9; s32 rowCount, columnCount; @@ -8931,7 +9192,7 @@ void sub_80D08CC(void) } } -void sub_80D09A4(void) +static void sub_80D09A4(void) { s32 i, j; s32 rowCount = gUnknown_02039D80->minRow + gUnknown_02039D80->rowsTotal; @@ -8950,7 +9211,7 @@ void sub_80D09A4(void) } } -void sub_80D0A1C(void) +static void sub_80D0A1C(void) { s32 i, j; s32 rowCount = gUnknown_02039D80->minRow + gUnknown_02039D80->rowsTotal; @@ -8970,7 +9231,7 @@ void sub_80D0A1C(void) } } -void sub_80D0AAC(void) +static void sub_80D0AAC(void) { s32 i, j; s32 rowCount = gUnknown_02039D80->minRow + gUnknown_02039D80->rowsTotal; @@ -8991,7 +9252,7 @@ void sub_80D0AAC(void) } } -void sub_80D0B5C(void) +static void sub_80D0B5C(void) { ChangeBgX(0, 0, 0); ChangeBgY(0, 0, 0); @@ -9001,12 +9262,12 @@ void sub_80D0B5C(void) CopyBgTilemapBufferToVram(0); } -u8 sub_80D0BA4(void) +static u8 sub_80D0BA4(void) { return (IN_BOX_ROWS * gUnknown_02039D80->fromColumn) + gUnknown_02039D80->fromRow; } -bool8 sub_80D0BC0(void) +static bool8 sub_80D0BC0(void) { s32 i, j; s32 rowCount = gUnknown_02039D80->minRow + gUnknown_02039D80->rowsTotal; @@ -9030,7 +9291,7 @@ bool8 sub_80D0BC0(void) return TRUE; } -const u32 gUnknown_0857BB24[] = INCBIN_U32("graphics/pokemon_storage/unknown_frame.4bpp"); +static const u32 gUnknown_0857BB24[] = INCBIN_U32("graphics/pokemon_storage/unknown_frame.4bpp"); static const struct OamData sOamData_857BBA4 = { @@ -9109,7 +9370,7 @@ static const union AffineAnimCmd *const sSpriteAffineAnimTable_857BC44[] = sSpriteAffineAnim_857BC44 }; -const struct SpriteTemplate gSpriteTemplate_857BC70 = +static const struct SpriteTemplate gSpriteTemplate_857BC70 = { .tileTag = 7, .paletteTag = 0xdacb, @@ -9120,7 +9381,7 @@ const struct SpriteTemplate gSpriteTemplate_857BC70 = .callback = SpriteCallbackDummy, }; -void sub_80D0C60(void) +static void sub_80D0C60(void) { s32 i; u8 spriteId; @@ -9153,20 +9414,25 @@ void sub_80D0C60(void) } // 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); -bool32 sub_80D1324(u8 cursorArea, u8 cursorPos); -const u32 *GetItemIconPic(u16 itemId); -const u16 *GetItemIconPalette(u16 itemId); -u8 sub_80D12E8(void); -void sub_80D140C(u8 id, u8 cursorArea, u8 cursorPos); -void sub_80D1524(u8 id, const u32 *itemTiles, const u16 *itemPal); -void sub_80D15D4(u8 id, u8 animNum); -void sub_80D1740(u8 id, bool8 arg1); -u8 sub_80D1370(u8 cursorArea, u8 cursorPos); -void sub_80D1604(u8 id, u8 arg1, u8 cursorArea, u8 cursorPos); -void sub_80D1AD8(struct Sprite *sprite); - -void sub_80D0D8C(u8 cursorArea, u8 cursorPos) +static void sub_80D0D8C(u8 cursorArea, u8 cursorPos) { u16 heldItem; @@ -9194,7 +9460,7 @@ void sub_80D0D8C(u8 cursorArea, u8 cursorPos) if (heldItem != 0) { const u32 *tiles = GetItemIconPic(heldItem); - const u16 *pal = GetItemIconPalette(heldItem); + const u32 *pal = GetItemIconPalette(heldItem); u8 id = sub_80D12E8(); sub_80D140C(id, cursorArea, cursorPos); @@ -9204,7 +9470,7 @@ void sub_80D0D8C(u8 cursorArea, u8 cursorPos) } } -void sub_80D0E50(u8 cursorArea, u8 cursorPos) +static void sub_80D0E50(u8 cursorArea, u8 cursorPos) { u8 id; @@ -9243,10 +9509,10 @@ static void Item_FromMonToMoving(u8 cursorArea, u8 cursorPos) gUnknown_02039D08->movingItem = gUnknown_02039D08->cursorMonItem; } -void sub_80D0F38(u16 item) +static void sub_80D0F38(u16 item) { const u32 *tiles = GetItemIconPic(item); - const u16 *pal = GetItemIconPalette(item); + const u32 *pal = GetItemIconPalette(item); u8 id = sub_80D12E8(); sub_80D1524(id, tiles, pal); @@ -9332,7 +9598,7 @@ static void Item_TakeMons(u8 cursorArea, u8 cursorPos) } } -void sub_80D1194(void) +static void sub_80D1194(void) { if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) { @@ -9342,7 +9608,7 @@ void sub_80D1194(void) } } -void sub_80D11CC(void) +static void sub_80D11CC(void) { s32 i; @@ -9356,7 +9622,7 @@ void sub_80D11CC(void) } } -bool8 sub_80D1218(void) +static bool8 sub_80D1218(void) { s32 i; @@ -9374,7 +9640,7 @@ bool8 sub_80D1218(void) return FALSE; } -bool8 sub_80D127C(void) +static bool8 IsActiveItemMoving(void) { s32 i; @@ -9390,17 +9656,17 @@ bool8 sub_80D127C(void) return FALSE; } -const u8 *GetMovingItemName(void) +static const u8 *GetMovingItemName(void) { return ItemId_GetName(gUnknown_02039D08->movingItem); } -u16 GetMovingItem(void) +static u16 GetMovingItem(void) { return gUnknown_02039D08->movingItem; } -u8 sub_80D12E8(void) +static u8 sub_80D12E8(void) { u8 i; @@ -9416,7 +9682,7 @@ u8 sub_80D12E8(void) return 3; } -bool32 sub_80D1324(u8 cursorArea, u8 cursorPos) +static bool32 sub_80D1324(u8 cursorArea, u8 cursorPos) { s32 i; @@ -9431,7 +9697,7 @@ bool32 sub_80D1324(u8 cursorArea, u8 cursorPos) return FALSE; } -u8 sub_80D1370(u8 cursorArea, u8 cursorPos) +static u8 sub_80D1370(u8 cursorArea, u8 cursorPos) { u8 i; @@ -9446,7 +9712,7 @@ u8 sub_80D1370(u8 cursorArea, u8 cursorPos) return 3; } -u8 sub_80D13C4(struct Sprite *sprite) +static u8 sub_80D13C4(struct Sprite *sprite) { u8 i; @@ -9459,3 +9725,652 @@ u8 sub_80D13C4(struct Sprite *sprite) 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; + gUnknown_02039D08->field_2204[id].sprite->pos1.x = (24 * row) + 112; + gUnknown_02039D08->field_2204[id].sprite->pos1.y = (24 * column) + 56; + gUnknown_02039D08->field_2204[id].sprite->oam.priority = 2; + break; + case CURSOR_AREA_IN_PARTY: + if (cursorPos == 0) + { + gUnknown_02039D08->field_2204[id].sprite->pos1.x = 116; + gUnknown_02039D08->field_2204[id].sprite->pos1.y = 76; + } + else + { + gUnknown_02039D08->field_2204[id].sprite->pos1.x = 164; + gUnknown_02039D08->field_2204[id].sprite->pos1.y = 24 * (cursorPos - 1) + 28; + } + gUnknown_02039D08->field_2204[id].sprite->oam.priority = 1; + break; + } + + gUnknown_02039D08->field_2204[id].unk8 = cursorArea; + gUnknown_02039D08->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, gUnknown_02039D08->field_42C4, 0x200); + LZ77UnCompWram(itemTiles, gUnknown_02039D08->field_22C4); + for (i = 0; i < 3; i++) + CpuFastCopy(gUnknown_02039D08->field_22C4 + (i * 0x60), gUnknown_02039D08->field_42C4 + (i * 0x80), 0x60); + + CpuFastCopy(gUnknown_02039D08->field_42C4, gUnknown_02039D08->field_2204[id].tiles, 0x200); + LZ77UnCompWram(itemPal, gUnknown_02039D08->field_42C4); + LoadPalette(gUnknown_02039D08->field_42C4, gUnknown_02039D08->field_2204[id].palIndex, 0x20); +} + +static void sub_80D15D4(u8 id, u8 animNum) +{ + if (id >= 3) + return; + + StartSpriteAffineAnim(gUnknown_02039D08->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: + gUnknown_02039D08->field_2204[id].sprite->data[0] = id; + gUnknown_02039D08->field_2204[id].sprite->callback = sub_80D1A48; + break; + case 1: + gUnknown_02039D08->field_2204[id].sprite->data[0] = 0; + gUnknown_02039D08->field_2204[id].sprite->callback = sub_80D1A74; + break; + case 2: + gUnknown_02039D08->field_2204[id].sprite->data[0] = 0; + gUnknown_02039D08->field_2204[id].sprite->data[6] = arg2; + gUnknown_02039D08->field_2204[id].sprite->data[7] = arg3; + gUnknown_02039D08->field_2204[id].sprite->callback = sub_80D1B14; + break; + case 3: + gUnknown_02039D08->field_2204[id].sprite->data[0] = 0; + gUnknown_02039D08->field_2204[id].sprite->callback = sub_80D1B94; + gUnknown_02039D08->field_2204[id].sprite->data[6] = arg2; + gUnknown_02039D08->field_2204[id].sprite->data[7] = arg3; + break; + case 4: + gUnknown_02039D08->field_2204[id].sprite->data[0] = 0; + gUnknown_02039D08->field_2204[id].sprite->data[6] = arg2; + gUnknown_02039D08->field_2204[id].sprite->data[7] = arg3; + gUnknown_02039D08->field_2204[id].sprite->callback = sub_80D1C30; + break; + case 7: + gUnknown_02039D08->field_2204[id].sprite->callback = sub_80D1CCC; + break; + } +} + +static void sub_80D1740(u8 id, bool8 arg1) +{ + if (id >= 3) + return; + + gUnknown_02039D08->field_2204[id].unk10 = arg1; + gUnknown_02039D08->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(gUnknown_02039D08->movingItem); + else + description = ItemId_GetDescription(gUnknown_02039D08->cursorMonItem); + + FillWindowPixelBuffer(2, 0x11); + AddTextPrinterParameterized5(2, 1, description, 4, 0, 0, NULL, 0, 1); +} + +static void sub_80D1818(void) +{ + gUnknown_02039D08->field_2236 = 0x15; + LoadBgTiles(0, gUnknown_0857BB24, 0x80, 0x13A); + sub_80D19B4(0); +} + +static bool8 sub_80D184C(void) +{ + s32 i, var; + + if (gUnknown_02039D08->field_2236 == 0) + return FALSE; + + gUnknown_02039D08->field_2236--; + var = 0x15 - gUnknown_02039D08->field_2236; + for (i = 0; i < var; i++) + { + WriteSequenceToBgTilemapBuffer(0, GetBgAttribute(0, 10) + 0x14 + gUnknown_02039D08->field_2236 + i, i, 13, 1, 7, 15, 21); + } + + sub_80D19B4(var); + return (gUnknown_02039D08->field_2236 != 0); +} + +static bool8 sub_80D18E4(void) +{ + s32 i, var; + + if (gUnknown_02039D08->field_2236 == 0x16) + return FALSE; + + if (gUnknown_02039D08->field_2236 == 0) + FillBgTilemapBufferRect(0, 0, 21, 12, 1, 9, 17); + + gUnknown_02039D08->field_2236++; + var = 0x15 - gUnknown_02039D08->field_2236; + for (i = 0; i < var; i++) + { + WriteSequenceToBgTilemapBuffer(0, GetBgAttribute(0, 10) + 0x14 + gUnknown_02039D08->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 = gUnknown_02039D08->field_CB4->pos1.x + 4; + sprite->pos1.y = gUnknown_02039D08->field_CB4->pos1.y + gUnknown_02039D08->field_CB4->pos2.y + 8; + sprite->oam.priority = gUnknown_02039D08->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; + + // LMAO. Obvious bug there. + 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 < WALLPAPERS_COUNT) + gPokemonStoragePtr->boxWallpapers[boxId] = wallpaperId; +} + +s16 sub_80D214C(struct BoxPokemon *boxMons, s8 currIndex, u8 maxIndex, u8 arg3) +{ + s16 i; + s16 adder = -1; + + if (arg3 < 2) + adder = 1; + + if (arg3 == 1 || arg3 == 3) + { + for (i = currIndex + adder; i >= 0 && i <= maxIndex; i += adder) + { + if (GetBoxMonData(&boxMons[i], MON_DATA_SPECIES) != SPECIES_NONE) + return i; + } + } + else + { + for (i = 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 CheckBoxedMonSanity(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] = 0x7B35; + gSaveBlock1Ptr->waldaPhrase.colors[1] = 0x6186; + 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); +} diff --git a/src/tv.c b/src/tv.c index f77e93cb7..032bcde6a 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/walda_phrase.c b/src/walda_phrase.c index ff2ee7399..10a899583 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.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); From 7dcb614cca6d61c5e51960826dddc004858ed9f1 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Thu, 20 Dec 2018 22:14:36 +0100 Subject: [PATCH 11/13] PSS is done --- asm/pokemon_storage_system.s | 962 ----------- data/pokemon_storage_system.s | 9 - include/pokemon_icon.h | 1 + include/pokemon_storage_system.h | 9 + include/strings.h | 3 + ld_script.txt | 2 - src/pokemon_storage_system.c | 2762 ++++++++++++++++-------------- sym_ewram.txt | 64 +- 8 files changed, 1534 insertions(+), 2278 deletions(-) delete mode 100644 asm/pokemon_storage_system.s delete mode 100644 data/pokemon_storage_system.s diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s deleted file mode 100644 index 3ae8a9a62..000000000 --- a/asm/pokemon_storage_system.s +++ /dev/null @@ -1,962 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - 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/data/pokemon_storage_system.s b/data/pokemon_storage_system.s deleted file mode 100644 index 3058f3578..000000000 --- a/data/pokemon_storage_system.s +++ /dev/null @@ -1,9 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - -gSpriteTemplate_857BC88:: @ 857BC88 - .2byte 0x0100, 0x0100, 0x0200, 0x0100, 0x0100, 0x0200, 0x0200, 0x0200, 0x0080, 0x0080, 0x0100, 0x0100, 0x0200, 0x0200, 0x0400, 0x0400 - diff --git a/include/pokemon_icon.h b/include/pokemon_icon.h index 8da0c5958..9d6e88685 100644 --- a/include/pokemon_icon.h +++ b/include/pokemon_icon.h @@ -4,6 +4,7 @@ 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); diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index 4f882ddaf..afc0516b6 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -6,6 +6,15 @@ #define IN_BOX_COLUMS 5 #define IN_BOX_COUNT (IN_BOX_ROWS * IN_BOX_COLUMS) +/* + 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 PokemonStorage { /*0x0000*/ u8 currentBox; diff --git a/include/strings.h b/include/strings.h index 1557baa6b..71392eb6a 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1473,5 +1473,8 @@ 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/ld_script.txt b/ld_script.txt index 438a4435b..5e7fe714b 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -124,7 +124,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); @@ -454,7 +453,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/pokemon_storage_system.c b/src/pokemon_storage_system.c index faa7573d6..5c3e1b4a6 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -54,26 +54,6 @@ struct PokemonStorageSystemFunc s8 unk4; }; -struct Struct_02039D80 -{ - 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]; -}; - struct StorageAction { const u8 *text; @@ -98,6 +78,7 @@ struct UnkStruct_2000028 u8 *unk_04; u16 unk_08; u16 unk_0a; + u16 newField; void (*unk_0c)(struct UnkStruct_2000028 *data); }; @@ -142,7 +123,6 @@ struct PokemonStorageSystemData u8 taskId; struct UnkStruct_2000020 unk_0020; struct UnkStruct_2000028 unk_0028[8]; - u16 field_90[16]; u16 field_B0[528 / 2]; u16 field_2C0; u16 field_2C2; @@ -159,16 +139,13 @@ struct PokemonStorageSystemData u8 field_2D2; u8 field_2D3; u8 field_2D4; - u8 field_2D5; u16 field_2D6; s16 field_2D8; u16 field_2DA; u16 field_2DC; u16 field_2DE; u16 field_2E0; - u8 field_2E2; - u8 field_2E3; - u8 field_2E4[20]; + u8 filler[22]; u8 field_2F8[1024]; u8 field_6F8; u8 field_6F9; @@ -190,8 +167,6 @@ struct PokemonStorageSystemData u8 field_A63; u8 field_A64; s8 field_A65; - u8 field_A66; - u8 field_A67; u8 *wallpaperTiles; struct Sprite *movingMonSprite; struct Sprite *partySprites[PARTY_SIZE]; @@ -205,7 +180,6 @@ struct PokemonStorageSystemData u8 field_C5C; u8 field_C5D; u8 field_C5E; - u8 field_C5F; u16 field_C60; s16 field_C62; s16 field_C64; @@ -219,10 +193,7 @@ struct PokemonStorageSystemData u8 menuItemsCount; u8 menuWidth; u8 field_CAE; - u8 field_CAF; u16 field_CB0; - u8 field_CB2; - u8 field_CB3; struct Sprite *field_CB4; struct Sprite *field_CB8; s32 field_CBC; @@ -239,14 +210,12 @@ struct PokemonStorageSystemData u8 field_CD6; u8 field_CD7; u8 field_CD8[2]; - u8 field_CDA; - u8 field_CDB; const u32 *cursorMonPalette; u32 cursorMonPersonality; u16 cursorMonSpecies; u16 cursorMonItem; u16 field_CE8; - u8 field_CEA; + bool8 setMosaic; u8 cursorMonMarkings; u8 cursorMonLevel; bool8 cursorMonIsEgg; @@ -273,13 +242,7 @@ struct PokemonStorageSystemData s8 field_2171; u16 field_2172; u16 field_2174; - u16 field_2176[5]; - u8 field_2180; - u8 field_2181; - u8 field_2182; - u8 field_2183; - u8 field_2184; - u8 field_2185; + u16 field_2176[8]; u8 field_2186; u8 field_2187; u8 field_2188; @@ -291,31 +254,50 @@ struct PokemonStorageSystemData u8 field_2190[40]; u8 field_21B8[40]; u8 field_21E0[POKEMON_NAME_LENGTH + 1]; - u8 field_21EB[15]; // TODO: ITEM NAME LENGTH + 1 - u8 field_21FA; - u8 field_21FB; - u8 field_21FC; - u8 field_21FD; - u8 field_21FE; + u8 itemName[20]; u8 inBoxMovingMode; u16 field_2200; struct UnkStorageStruct field_2204[3]; u16 movingItem; u16 field_2236; u8 field_2238; - u8 field_2239; u16 field_223A; u16 *field_223C; struct Sprite *cursorMonSprite; - u16 field_2244[16]; - u8 field_2264[96]; + u16 field_2244[0x40]; u8 field_22C4[0x800]; - u8 field_2AC4[6144]; + 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, @@ -453,27 +435,26 @@ enum #define TAG_TILE_3 0x3 #define TAG_TILE_4 0x4 -IWRAM_DATA u32 gUnknown_03000F78[98]; +// IWRAM bss +IWRAM_DATA static u32 gUnknown_03000F78[98]; // EWRAM DATA -extern u8 sPreviousBoxOption; -extern u8 sCurrentBoxOption; -extern u8 sMovingMonOrigBoxPos; -extern u8 sMovingMonOrigBoxId; -extern s8 sBoxCursorPosition; -extern s8 sBoxCursorArea; -extern u8 gUnknown_02039D10; -extern u8 gUnknown_02039D7E; -extern u8 gUnknown_02039D0E; -extern bool8 sInPartyMenu; -extern bool8 sCanOnlyMove; -extern bool8 sIsMonBeingMoved; -extern u8 gUnknown_02039D0F; -extern u16 gUnknown_02039D12; -extern struct Pokemon gUnknown_02039D14; -extern struct Struct_02039D80 *gUnknown_02039D80; -extern struct UnkPSSStruct_2002370 *gUnknown_02039D04; -extern struct PokemonStorageSystemData *gUnknown_02039D08; +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); @@ -483,10 +464,6 @@ extern void sub_80C6D80(u8 *arg0, void *arg1, u8 arg2, u8 arg3, s32 arg4); extern const struct CompressedSpriteSheet gMonFrontPicTable[]; -extern const u8 gText_PartyFull[]; -extern const u8 gText_Box[]; -extern const u8 gText_JustOnePkmn[]; - // This file's functions. static void CreatePCMenu(u8 whichMenu, s16 *windowIdPtr); static void Cb2_EnterPSS(u8 boxOption); @@ -724,16 +701,19 @@ 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); -void sub_80D304C(u16 palIndex); -void sub_80D27AC(u8 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4); -void sub_80D27F4(u8 arg0, u8 arg1, s8 arg2); -void sub_80D2644(u8 arg0, u16 arg1, const void *arg2, u16 arg3, u16 arg4); -void sub_80D2770(u8 arg0, u16 arg1, u16 arg2); -void sub_80D2A90(struct UnkStruct_2000020 *arg0, struct UnkStruct_2000028 *arg1, u32 arg2); -void sub_80D259C(u8 arg0); -void sub_80D25F0(void); -void sub_80D2AA4(void); -void sub_80D2918(u8 arg0); +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); // static const rom data static const struct PSS_MenuStringPtrs gUnknown_085716C0[] = @@ -2109,7 +2089,7 @@ static void VblankCb_PSS(void) ProcessSpriteCopyRequests(); sub_80D2AA4(); TransferPlttBuffer(); - SetGpuReg(REG_OFFSET_BG2HOFS, gUnknown_02039D08->bg2_X); + SetGpuReg(REG_OFFSET_BG2HOFS, sPSSData->bg2_X); } static void Cb2_PSS(void) @@ -2126,18 +2106,18 @@ static void Cb2_EnterPSS(u8 boxOption) { ResetTasks(); sCurrentBoxOption = boxOption; - gUnknown_02039D08 = Alloc(sizeof(*gUnknown_02039D08)); - if (gUnknown_02039D08 == NULL) + sPSSData = Alloc(sizeof(*sPSSData)); + if (sPSSData == NULL) { SetMainCallback2(Cb2_ExitPSS); } else { - gUnknown_02039D08->boxOption = boxOption; - gUnknown_02039D08->isReshowingPSS = FALSE; + sPSSData->boxOption = boxOption; + sPSSData->isReshowingPSS = FALSE; gUnknown_02039D12 = 0; - gUnknown_02039D08->state = 0; - gUnknown_02039D08->taskId = CreateTask(Cb_InitPSS, 3); + sPSSData->state = 0; + sPSSData->taskId = CreateTask(Cb_InitPSS, 3); gUnknown_02039D10 = StorageGetCurrentBox(); SetMainCallback2(Cb2_PSS); } @@ -2146,17 +2126,17 @@ static void Cb2_EnterPSS(u8 boxOption) static void Cb2_ReturnToPSS(void) { ResetTasks(); - gUnknown_02039D08 = Alloc(sizeof(*gUnknown_02039D08)); - if (gUnknown_02039D08 == NULL) + sPSSData = Alloc(sizeof(*sPSSData)); + if (sPSSData == NULL) { SetMainCallback2(Cb2_ExitPSS); } else { - gUnknown_02039D08->boxOption = sCurrentBoxOption; - gUnknown_02039D08->isReshowingPSS = TRUE; - gUnknown_02039D08->state = 0; - gUnknown_02039D08->taskId = CreateTask(Cb_InitPSS, 3); + sPSSData->boxOption = sCurrentBoxOption; + sPSSData->isReshowingPSS = TRUE; + sPSSData->state = 0; + sPSSData->taskId = CreateTask(Cb_InitPSS, 3); SetMainCallback2(Cb2_PSS); } } @@ -2181,25 +2161,25 @@ static void sub_80C7E98(void) FreeAllSpritePalettes(); ClearDma3Requests(); gReservedSpriteTileCount = 0x280; - sub_80D2A90(&gUnknown_02039D08->unk_0020, gUnknown_02039D08->unk_0028, 8); + 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); - gUnknown_02039D08->unk_02C7 = 0; + sPSSData->unk_02C7 = 0; } static void sub_80C7F1C(void) { sub_80CDC0C(); - sInPartyMenu = (gUnknown_02039D08->boxOption == BOX_OPTION_DEPOSIT); + sInPartyMenu = (sPSSData->boxOption == BOX_OPTION_DEPOSIT); gUnknown_02039D0E = 0; } static void sub_80C7F4C(void) { - if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) { SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(7, 11)); @@ -2209,21 +2189,21 @@ static void sub_80C7F4C(void) static void SetPSSCallback(TaskFunc newFunc) { - gTasks[gUnknown_02039D08->taskId].func = newFunc; - gUnknown_02039D08->state = 0; + gTasks[sPSSData->taskId].func = newFunc; + sPSSData->state = 0; } static void Cb_InitPSS(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: SetVBlankCallback(NULL); SetGpuReg(REG_OFFSET_DISPCNT, 0); sub_80C7E98(); - if (gUnknown_02039D08->isReshowingPSS) + if (sPSSData->isReshowingPSS) { - switch (gUnknown_02039D0F) + switch (sWhichToReshow) { case 1: sub_80CE790(); @@ -2254,12 +2234,12 @@ static void Cb_InitPSS(u8 taskId) break; case 3: ResetAllBgCoords(); - if (!gUnknown_02039D08->isReshowingPSS) + if (!sPSSData->isReshowingPSS) sub_80C7F1C(); break; case 4: sub_80CAF04(); - if (!gUnknown_02039D08->isReshowingPSS) + if (!sPSSData->isReshowingPSS) sub_80CD36C(); else sub_80CD3EC(); @@ -2289,11 +2269,11 @@ static void Cb_InitPSS(u8 taskId) if (sub_80CC35C()) return; - if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) { - gUnknown_02039D08->field_DA4.baseTileTag = TAG_TILE_D; - gUnknown_02039D08->field_DA4.basePaletteTag = TAG_PAL_DACE; - sub_811F90C(&gUnknown_02039D08->field_DA4); + sPSSData->field_DA4.baseTileTag = TAG_TILE_D; + sPSSData->field_DA4.basePaletteTag = TAG_PAL_DACE; + sub_811F90C(&sPSSData->field_DA4); sub_811FA90(); } else @@ -2304,7 +2284,7 @@ static void Cb_InitPSS(u8 taskId) break; case 10: sub_80C7F4C(); - if (!gUnknown_02039D08->isReshowingPSS) + if (!sPSSData->isReshowingPSS) { BlendPalettes(0xFFFFFFFF, 0x10, 0); SetPSSCallback(Cb_ShowPSS); @@ -2320,17 +2300,17 @@ static void Cb_InitPSS(u8 taskId) return; } - gUnknown_02039D08->state++; + sPSSData->state++; } static void Cb_ShowPSS(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: PlaySE(SE_PC_LOGIN); sub_80F9BCC(0x14, 0, 1); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 1: if (!sub_80F9C1C()) @@ -2341,19 +2321,19 @@ static void Cb_ShowPSS(u8 taskId) static void Cb_ReshowPSS(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: BeginNormalPaletteFade(0xFFFFFFFF, -1, 0x10, 0, RGB_BLACK); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 1: if (!UpdatePaletteFade()) { - if (gUnknown_02039D0F == 2 && gSpecialVar_ItemId != 0) + if (sWhichToReshow == 2 && gSpecialVar_ItemId != 0) { PrintStorageActionText(PC_TEXT_ITEM_IS_HELD); - gUnknown_02039D08->state++; + sPSSData->state++; } else { @@ -2365,7 +2345,7 @@ static void Cb_ReshowPSS(u8 taskId) if (!IsDma3ManagerBusyWithBgCopy() && gMain.newKeys & (A_BUTTON | B_BUTTON)) { ClearBottomWindow(); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 3: @@ -2377,20 +2357,20 @@ static void Cb_ReshowPSS(u8 taskId) static void Cb_MainPSS(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: switch (HandleInput()) { case 1: PlaySE(SE_SELECT); - gUnknown_02039D08->state = 1; + sPSSData->state = 1; break; case 5: - if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_MONS && gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption != BOX_OPTION_MOVE_MONS && sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) { PrintStorageActionText(PC_TEXT_WHICH_ONE_WILL_TAKE); - gUnknown_02039D08->state = 3; + sPSSData->state = 3; } else { @@ -2399,14 +2379,14 @@ static void Cb_MainPSS(u8 taskId) } break; case 6: - if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_MONS) + if (sPSSData->boxOption == BOX_OPTION_MOVE_MONS) { - if (IsMonBeingMoved() && ItemIsMail(gUnknown_02039D08->cursorMonItem)) - gUnknown_02039D08->state = 5; + if (IsMonBeingMoved() && ItemIsMail(sPSSData->cursorMonItem)) + sPSSData->state = 5; else SetPSSCallback(Cb_HidePartyPokemon); } - else if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + else if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) { SetPSSCallback(Cb_HidePartyPokemon); } @@ -2426,42 +2406,42 @@ static void Cb_MainPSS(u8 taskId) break; case 9: PlaySE(SE_SELECT); - gUnknown_02039D08->newCurrBoxId = StorageGetCurrentBox() + 1; - if (gUnknown_02039D08->newCurrBoxId >= TOTAL_BOXES_COUNT) - gUnknown_02039D08->newCurrBoxId = 0; - if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + sPSSData->newCurrBoxId = StorageGetCurrentBox() + 1; + if (sPSSData->newCurrBoxId >= TOTAL_BOXES_COUNT) + sPSSData->newCurrBoxId = 0; + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) { - SetUpScrollToBox(gUnknown_02039D08->newCurrBoxId); - gUnknown_02039D08->state = 2; + SetUpScrollToBox(sPSSData->newCurrBoxId); + sPSSData->state = 2; } else { sub_80CFEA8(); - gUnknown_02039D08->state = 10; + sPSSData->state = 10; } break; case 10: PlaySE(SE_SELECT); - 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) + sPSSData->newCurrBoxId = StorageGetCurrentBox() - 1; + if (sPSSData->newCurrBoxId < 0) + sPSSData->newCurrBoxId = TOTAL_BOXES_COUNT - 1; + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) { - SetUpScrollToBox(gUnknown_02039D08->newCurrBoxId); - gUnknown_02039D08->state = 2; + SetUpScrollToBox(sPSSData->newCurrBoxId); + sPSSData->state = 2; } else { sub_80CFEA8(); - gUnknown_02039D08->state = 10; + sPSSData->state = 10; } break; case 11: if (!CanMovePartyMon()) { - if (ItemIsMail(gUnknown_02039D08->cursorMonItem)) + if (ItemIsMail(sPSSData->cursorMonItem)) { - gUnknown_02039D08->state = 5; + sPSSData->state = 5; } else { @@ -2471,13 +2451,13 @@ static void Cb_MainPSS(u8 taskId) } else { - gUnknown_02039D08->state = 4; + sPSSData->state = 4; } break; case 13: if (CanMovePartyMon()) { - gUnknown_02039D08->state = 4; + sPSSData->state = 4; } else { @@ -2488,7 +2468,7 @@ static void Cb_MainPSS(u8 taskId) case 14: if (!CanShifMon()) { - gUnknown_02039D08->state = 4; + sPSSData->state = 4; } else { @@ -2519,30 +2499,30 @@ static void Cb_MainPSS(u8 taskId) case 20: PlaySE(SE_SELECT); sub_80D01D0(0); - gUnknown_02039D08->state = 7; + sPSSData->state = 7; break; case 22: sub_80D01D0(1); - gUnknown_02039D08->state = 8; + sPSSData->state = 8; break; case 21: PlaySE(SE_SELECT); sub_80D01D0(2); - gUnknown_02039D08->state = 9; + sPSSData->state = 9; break; case 23: sub_80D01D0(3); - gUnknown_02039D08->state = 7; + sPSSData->state = 7; break; case 25: PlaySE(SE_SELECT); sub_80D01D0(4); - gUnknown_02039D08->state = 9; + sPSSData->state = 9; break; case 26: PlaySE(SE_SELECT); sub_80D01D0(5); - gUnknown_02039D08->state = 7; + sPSSData->state = 7; break; case 24: PlaySE(SE_HAZURE); @@ -2557,29 +2537,29 @@ static void Cb_MainPSS(u8 taskId) else sub_80CA9EC(); - if (gUnknown_02039D08->field_CEA) + if (sPSSData->setMosaic) BoxSetMosaic(); - gUnknown_02039D08->state = 0; + sPSSData->state = 0; } break; case 2: if (!ScrollToBox()) { - SetCurrentBox(gUnknown_02039D08->newCurrBoxId); + SetCurrentBox(sPSSData->newCurrBoxId); if (!sInPartyMenu && !IsMonBeingMoved()) { sub_80CE00C(); BoxSetMosaic(); } - if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) { sub_80CFECC(); - gUnknown_02039D08->state = 11; + sPSSData->state = 11; } else { - gUnknown_02039D08->state = 0; + sPSSData->state = 0; } } break; @@ -2587,18 +2567,18 @@ static void Cb_MainPSS(u8 taskId) if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); - gUnknown_02039D08->state = 0; + sPSSData->state = 0; } break; case 4: PlaySE(SE_HAZURE); PrintStorageActionText(PC_TEXT_LAST_POKE); - gUnknown_02039D08->state = 6; + sPSSData->state = 6; break; case 5: PlaySE(SE_HAZURE); PrintStorageActionText(PC_TEXT_PLEASE_REMOVE_MAIL); - gUnknown_02039D08->state = 6; + sPSSData->state = 6; break; case 6: if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) @@ -2609,7 +2589,7 @@ static void Cb_MainPSS(u8 taskId) break; case 7: if (!sub_80D01E4()) - gUnknown_02039D08->state = 0; + sPSSData->state = 0; break; case 8: if (!sub_80D01E4()) @@ -2618,32 +2598,32 @@ static void Cb_MainPSS(u8 taskId) case 9: if (!sub_80D01E4()) { - if (gUnknown_02039D08->field_CEA) + if (sPSSData->setMosaic) BoxSetMosaic(); - gUnknown_02039D08->state = 0; + sPSSData->state = 0; } break; case 10: if (!sub_80D1218()) { - SetUpScrollToBox(gUnknown_02039D08->newCurrBoxId); - gUnknown_02039D08->state = 2; + SetUpScrollToBox(sPSSData->newCurrBoxId); + sPSSData->state = 2; } break; case 11: if (!sub_80D1218()) - gUnknown_02039D08->state = 0; + sPSSData->state = 0; break; } } static void Cb_ShowPartyPokemon(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: SetUpDoShowPartyMenu(); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 1: if (!DoShowPartyMenu()) @@ -2654,24 +2634,24 @@ static void Cb_ShowPartyPokemon(u8 taskId) static void Cb_HidePartyPokemon(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: PlaySE(SE_SELECT); SetUpHidePartyMenu(); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 1: if (!HidePartyMenu()) { sub_80CDBF8(sub_80CDC2C()); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 2: if (!sub_80CD554()) { - if (gUnknown_02039D08->field_CEA) + if (sPSSData->setMosaic) BoxSetMosaic(); SetPSSCallback(Cb_MainPSS); } @@ -2681,26 +2661,26 @@ static void Cb_HidePartyPokemon(u8 taskId) static void Cb_OnSelectedMon(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: if (!sub_80CA2B8()) { PlaySE(SE_SELECT); - if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) PrintStorageActionText(PC_TEXT_IS_SELECTED); - else if (IsActiveItemMoving() || gUnknown_02039D08->cursorMonItem != 0) + else if (IsActiveItemMoving() || sPSSData->cursorMonItem != 0) PrintStorageActionText(PC_TEXT_IS_SELECTED2); else PrintStorageActionText(PC_TEXT_GIVE_TO_MON); AddMenu(); - gUnknown_02039D08->state = 1; + sPSSData->state = 1; } break; case 1: // debug? if (!sub_80D00A8()) - gUnknown_02039D08->state = 2; + sPSSData->state = 2; break; case 2: switch (sub_80D00AC()) @@ -2713,7 +2693,7 @@ static void Cb_OnSelectedMon(u8 taskId) case 3: if (CanMovePartyMon()) { - gUnknown_02039D08->state = 3; + sPSSData->state = 3; } else { @@ -2730,7 +2710,7 @@ static void Cb_OnSelectedMon(u8 taskId) case 4: if (!CanShifMon()) { - gUnknown_02039D08->state = 3; + sPSSData->state = 3; } else { @@ -2747,11 +2727,11 @@ static void Cb_OnSelectedMon(u8 taskId) case 1: if (CanMovePartyMon()) { - gUnknown_02039D08->state = 3; + sPSSData->state = 3; } - else if (ItemIsMail(gUnknown_02039D08->cursorMonItem)) + else if (ItemIsMail(sPSSData->cursorMonItem)) { - gUnknown_02039D08->state = 4; + sPSSData->state = 4; } else { @@ -2763,15 +2743,15 @@ static void Cb_OnSelectedMon(u8 taskId) case 7: if (CanMovePartyMon()) { - gUnknown_02039D08->state = 3; + sPSSData->state = 3; } - else if (gUnknown_02039D08->cursorMonIsEgg) + else if (sPSSData->cursorMonIsEgg) { - gUnknown_02039D08->state = 5; // Cannot release an Egg. + sPSSData->state = 5; // Cannot release an Egg. } - else if (ItemIsMail(gUnknown_02039D08->cursorMonItem)) + else if (ItemIsMail(sPSSData->cursorMonItem)) { - gUnknown_02039D08->state = 4; + sPSSData->state = 4; } else { @@ -2814,17 +2794,17 @@ static void Cb_OnSelectedMon(u8 taskId) case 3: PlaySE(SE_HAZURE); PrintStorageActionText(PC_TEXT_LAST_POKE); - gUnknown_02039D08->state = 6; + sPSSData->state = 6; break; case 5: PlaySE(SE_HAZURE); PrintStorageActionText(PC_TEXT_CANT_RELEASE_EGG); - gUnknown_02039D08->state = 6; + sPSSData->state = 6; break; case 4: PlaySE(SE_HAZURE); PrintStorageActionText(PC_TEXT_PLEASE_REMOVE_MAIL); - gUnknown_02039D08->state = 6; + sPSSData->state = 6; break; case 6: if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) @@ -2838,11 +2818,11 @@ static void Cb_OnSelectedMon(u8 taskId) static void Cb_MoveMon(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: InitMonPlaceChange(0); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 1: if (!DoMonPlaceChange()) @@ -2858,11 +2838,11 @@ static void Cb_MoveMon(u8 taskId) static void Cb_PlaceMon(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: InitMonPlaceChange(1); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 1: if (!DoMonPlaceChange()) @@ -2878,11 +2858,11 @@ static void Cb_PlaceMon(u8 taskId) static void Cb_ShiftMon(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: InitMonPlaceChange(2); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 1: if (!DoMonPlaceChange()) @@ -2896,19 +2876,19 @@ static void Cb_ShiftMon(u8 taskId) static void Cb_WithdrawMon(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: if (CalculatePlayerPartyCount() == PARTY_SIZE) { PrintStorageActionText(PC_TEXT_PARTY_FULL); - gUnknown_02039D08->state = 1; + sPSSData->state = 1; } else { sub_80CDC18(); InitMonPlaceChange(0); - gUnknown_02039D08->state = 2; + sPSSData->state = 2; } break; case 1: @@ -2923,21 +2903,21 @@ static void Cb_WithdrawMon(u8 taskId) { SetMovingMonPriority(1); SetUpDoShowPartyMenu(); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 3: if (!DoShowPartyMenu()) { InitMonPlaceChange(1); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 4: if (!DoMonPlaceChange()) { sub_80CAB20(); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 5: @@ -2950,13 +2930,13 @@ static void Cb_DepositMenu(u8 taskId) { u8 boxId; - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: PrintStorageActionText(PC_TEXT_DEPOSIT_IN_WHICH_BOX); - sub_80C77E8(&gUnknown_02039D08->field_1E5C, TAG_TILE_A, TAG_PAL_DAC7, 3, FALSE); + sub_80C77E8(&sPSSData->field_1E5C, TAG_TILE_A, TAG_PAL_DAC7, 3, FALSE); sub_80C78D4(gUnknown_02039D0E); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 1: boxId = sub_80C78F0(); @@ -2976,19 +2956,19 @@ static void Cb_DepositMenu(u8 taskId) ClearBottomWindow(); sub_80C78E4(); sub_80C7890(); - gUnknown_02039D08->state = 2; + sPSSData->state = 2; } else { PrintStorageActionText(PC_TEXT_BOX_IS_FULL); - gUnknown_02039D08->state = 4; + sPSSData->state = 4; } } break; case 2: CompactPartySlots(); sub_80CB950(); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 3: if (!sub_80CB9BC()) @@ -3003,7 +2983,7 @@ static void Cb_DepositMenu(u8 taskId) if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { PrintStorageActionText(PC_TEXT_DEPOSIT_IN_WHICH_BOX); - gUnknown_02039D08->state = 1; + sPSSData->state = 1; } break; } @@ -3011,12 +2991,12 @@ static void Cb_DepositMenu(u8 taskId) static void Cb_ReleaseMon(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: PrintStorageActionText(PC_TEXT_RELEASE_POKE); ShowYesNoWindow(1); - gUnknown_02039D08->state++; + sPSSData->state++; // fallthrough case 1: switch (Menu_ProcessInputNoWrapClearOnChoose()) @@ -3030,7 +3010,7 @@ static void Cb_ReleaseMon(u8 taskId) ClearBottomWindow(); InitCanRelaseMonVars(); sub_80CE250(); - gUnknown_02039D08->state++; + sPSSData->state++; break; } break; @@ -3043,12 +3023,12 @@ static void Cb_ReleaseMon(u8 taskId) s8 r0 = RunCanReleaseMon(); if (r0 == 1) { - gUnknown_02039D08->state++; + sPSSData->state++; break; } else if (r0 == 0) { - gUnknown_02039D08->state = 8; // Can't release the mon. + sPSSData->state = 8; // Can't release the mon. break; } } @@ -3058,13 +3038,13 @@ static void Cb_ReleaseMon(u8 taskId) ReleaseMon(); RefreshCursorMonData(); PrintStorageActionText(PC_TEXT_WAS_RELEASED); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 4: if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { PrintStorageActionText(PC_TEXT_BYE_BYE); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 5: @@ -3075,11 +3055,11 @@ static void Cb_ReleaseMon(u8 taskId) { CompactPartySlots(); sub_80CB950(); - gUnknown_02039D08->state++; + sPSSData->state++; } else { - gUnknown_02039D08->state = 7; + sPSSData->state = 7; } } break; @@ -3089,7 +3069,7 @@ static void Cb_ReleaseMon(u8 taskId) sub_80CE00C(); BoxSetMosaic(); sub_80CAB20(); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 7: @@ -3097,13 +3077,13 @@ static void Cb_ReleaseMon(u8 taskId) break; case 8: PrintStorageActionText(PC_TEXT_WAS_RELEASED); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 9: if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { PrintStorageActionText(PC_TEXT_SURPRISE); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 10: @@ -3111,7 +3091,7 @@ static void Cb_ReleaseMon(u8 taskId) { ClearBottomWindow(); sub_80CC064(); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 11: @@ -3119,14 +3099,14 @@ static void Cb_ReleaseMon(u8 taskId) { sub_80CE324(); PrintStorageActionText(PC_TEXT_CAME_BACK); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 12: if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { PrintStorageActionText(PC_TEXT_WORRIED); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 13: @@ -3141,20 +3121,20 @@ static void Cb_ReleaseMon(u8 taskId) static void Cb_ShowMarkMenu(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: PrintStorageActionText(PC_TEXT_MARK_POKE); - gUnknown_02039D08->field_DA4.markings = gUnknown_02039D08->cursorMonMarkings; - sub_811FAA4(gUnknown_02039D08->cursorMonMarkings, 0xb0, 0x10); - gUnknown_02039D08->state++; + sPSSData->field_DA4.markings = sPSSData->cursorMonMarkings; + sub_811FAA4(sPSSData->cursorMonMarkings, 0xb0, 0x10); + sPSSData->state++; break; case 1: if (!sub_811FBA4()) { sub_811FAF8(); ClearBottomWindow(); - SetMonMarkings(gUnknown_02039D08->field_DA4.markings); + SetMonMarkings(sPSSData->field_DA4.markings); RefreshCursorMonData(); SetPSSCallback(Cb_MainPSS); } @@ -3164,13 +3144,13 @@ static void Cb_ShowMarkMenu(u8 taskId) static void Cb_TakeItemForMoving(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: - if (!ItemIsMail(gUnknown_02039D08->cursorMonItem)) + if (!ItemIsMail(sPSSData->cursorMonItem)) { ClearBottomWindow(); - gUnknown_02039D08->state++; + sPSSData->state++; } else { @@ -3180,7 +3160,7 @@ static void Cb_TakeItemForMoving(u8 taskId) case 1: sub_80CFE54(2); Item_FromMonToMoving((sInPartyMenu != FALSE) ? CURSOR_AREA_IN_PARTY : CURSOR_AREA_IN_BOX, GetBoxCursorPosition()); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 2: if (!sub_80D1218()) @@ -3189,7 +3169,7 @@ static void Cb_TakeItemForMoving(u8 taskId) ClearBottomWindow(); sub_80CE00C(); PrintCursorMonInfo(); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 3: @@ -3201,16 +3181,16 @@ static void Cb_TakeItemForMoving(u8 taskId) static void Cb_GiveMovingItemToMon(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: ClearBottomWindow(); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 1: sub_80CFE54(2); Item_GiveMovingToMon((sInPartyMenu != FALSE) ? CURSOR_AREA_IN_PARTY : CURSOR_AREA_IN_BOX, GetBoxCursorPosition()); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 2: if (!sub_80D1218()) @@ -3219,14 +3199,14 @@ static void Cb_GiveMovingItemToMon(u8 taskId) sub_80CE00C(); PrintCursorMonInfo(); PrintStorageActionText(PC_TEXT_ITEM_IS_HELD); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 3: if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 4: @@ -3238,27 +3218,27 @@ static void Cb_GiveMovingItemToMon(u8 taskId) static void Cb_ItemToBag(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: - if (!AddBagItem(gUnknown_02039D08->cursorMonItem, 1)) + if (!AddBagItem(sPSSData->cursorMonItem, 1)) { PlaySE(SE_HAZURE); PrintStorageActionText(PC_TEXT_BAG_FULL); - gUnknown_02039D08->state = 3; + sPSSData->state = 3; } else { PlaySE(SE_SELECT); Item_TakeMons((sInPartyMenu != FALSE) ? CURSOR_AREA_IN_PARTY : CURSOR_AREA_IN_BOX, GetBoxCursorPosition()); - gUnknown_02039D08->state = 1; + sPSSData->state = 1; } break; case 1: if (!sub_80D1218()) { PrintStorageActionText(PC_TEXT_PLACED_IN_BAG); - gUnknown_02039D08->state = 2; + sPSSData->state = 2; } break; case 2: @@ -3267,7 +3247,7 @@ static void Cb_ItemToBag(u8 taskId) ClearBottomWindow(); sub_80CE00C(); PrintCursorMonInfo(); - gUnknown_02039D08->state = 4; + sPSSData->state = 4; } break; case 4: @@ -3286,13 +3266,13 @@ static void Cb_ItemToBag(u8 taskId) static void Cb_SwitchSelectedItem(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: - if (!ItemIsMail(gUnknown_02039D08->cursorMonItem)) + if (!ItemIsMail(sPSSData->cursorMonItem)) { ClearBottomWindow(); - gUnknown_02039D08->state++; + sPSSData->state++; } else { @@ -3302,7 +3282,7 @@ static void Cb_SwitchSelectedItem(u8 taskId) case 1: sub_80CFE54(2); Item_SwitchMonsWithMoving((sInPartyMenu != FALSE) ? CURSOR_AREA_IN_PARTY : CURSOR_AREA_IN_BOX, GetBoxCursorPosition()); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 2: if (!sub_80D1218()) @@ -3311,14 +3291,14 @@ static void Cb_SwitchSelectedItem(u8 taskId) sub_80CE00C(); PrintCursorMonInfo(); PrintStorageActionText(PC_TEXT_CHANGED_TO_ITEM); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 3: if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 4: @@ -3330,11 +3310,11 @@ static void Cb_SwitchSelectedItem(u8 taskId) static void Cb_ShowItemInfo(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: ClearBottomWindow(); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) @@ -3342,27 +3322,27 @@ static void Cb_ShowItemInfo(u8 taskId) PlaySE(SE_WIN_OPEN); PrintItemDescription(); sub_80D1818(); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 2: if (!sub_80D184C()) - gUnknown_02039D08->state++; + sPSSData->state++; break; case 3: if (!IsDma3ManagerBusyWithBgCopy()) - gUnknown_02039D08->state++; + sPSSData->state++; break; case 4: if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { PlaySE(SE_WIN_OPEN); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 5: if (!sub_80D18E4()) - gUnknown_02039D08->state++; + sPSSData->state++; break; case 6: if (!IsDma3ManagerBusyWithBgCopy()) @@ -3373,13 +3353,13 @@ static void Cb_ShowItemInfo(u8 taskId) static void Cb_CloseBoxWhileHoldingItem(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: PlaySE(SE_SELECT); PrintStorageActionText(PC_TEXT_PUT_IN_BAG); ShowYesNoWindow(0); - gUnknown_02039D08->state = 1; + sPSSData->state = 1; break; case 1: switch (Menu_ProcessInputNoWrapClearOnChoose()) @@ -3390,15 +3370,15 @@ static void Cb_CloseBoxWhileHoldingItem(u8 taskId) SetPSSCallback(Cb_MainPSS); break; case 0: - if (AddBagItem(gUnknown_02039D08->movingItem, 1) == TRUE) + if (AddBagItem(sPSSData->movingItem, 1) == TRUE) { ClearBottomWindow(); - gUnknown_02039D08->state = 3; + sPSSData->state = 3; } else { PrintStorageActionText(PC_TEXT_BAG_FULL); - gUnknown_02039D08->state = 2; + sPSSData->state = 2; } break; } @@ -3407,12 +3387,12 @@ static void Cb_CloseBoxWhileHoldingItem(u8 taskId) if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); - gUnknown_02039D08->state = 5; + sPSSData->state = 5; } break; case 3: sub_80D1194(); - gUnknown_02039D08->state = 4; + sPSSData->state = 4; break; case 4: if (!sub_80D1218()) @@ -3430,12 +3410,12 @@ static void Cb_CloseBoxWhileHoldingItem(u8 taskId) static void Cb_HandleMovingMonFromParty(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: CompactPartySlots(); sub_80CB950(); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 1: if (!sub_80CB9BC()) @@ -3449,21 +3429,21 @@ static void Cb_HandleMovingMonFromParty(u8 taskId) static void Cb_PrintCantStoreMail(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: PrintStorageActionText(PC_TEXT_CANT_STORE_MAIL); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) - gUnknown_02039D08->state++; + sPSSData->state++; break; case 2: if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY)) { ClearBottomWindow(); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 3: @@ -3475,17 +3455,17 @@ static void Cb_PrintCantStoreMail(u8 taskId) static void Cb_HandleBoxOptions(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: PrintStorageActionText(PC_TEXT_WHAT_YOU_DO); AddMenu(); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 1: if (sub_80D00A8()) return; - gUnknown_02039D08->state++; + sPSSData->state++; case 2: switch (sub_80D00AC()) { @@ -3516,20 +3496,20 @@ static void Cb_HandleBoxOptions(u8 taskId) static void Cb_HandleWallpapers(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: AddWallpaperSetsMenu(); PrintStorageActionText(PC_TEXT_PICK_A_THEME); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 1: if (!sub_80D00A8()) - gUnknown_02039D08->state++; + sPSSData->state++; break; case 2: - gUnknown_02039D08->wallpaperSetId = sub_80D00AC(); - switch (gUnknown_02039D08->wallpaperSetId) + sPSSData->wallpaperSetId = sub_80D00AC(); + switch (sPSSData->wallpaperSetId) { case -1: sub_80CD1A8(TRUE); @@ -3539,43 +3519,43 @@ static void Cb_HandleWallpapers(u8 taskId) case 18 ... 21: PlaySE(SE_SELECT); sub_80D013C(); - gUnknown_02039D08->wallpaperSetId -= 18; - gUnknown_02039D08->state++; + sPSSData->wallpaperSetId -= 18; + sPSSData->state++; break; // New wallpaper from Walda. case 22: PlaySE(SE_SELECT); - gUnknown_02039D08->wallpaperId = 16; + sPSSData->wallpaperId = 16; sub_80D013C(); ClearBottomWindow(); - gUnknown_02039D08->state = 6; + sPSSData->state = 6; break; } break; case 3: if (!IsDma3ManagerBusyWithBgCopy()) { - AddWallpapersMenu(gUnknown_02039D08->wallpaperSetId); + AddWallpapersMenu(sPSSData->wallpaperSetId); PrintStorageActionText(PC_TEXT_PICK_A_WALLPAPER); - gUnknown_02039D08->state++; + sPSSData->state++; } break; case 4: - gUnknown_02039D08->wallpaperId = sub_80D00AC(); - switch (gUnknown_02039D08->wallpaperId) + sPSSData->wallpaperId = sub_80D00AC(); + switch (sPSSData->wallpaperId) { case -2: break; case -1: ClearBottomWindow(); - gUnknown_02039D08->state = 0; + sPSSData->state = 0; break; default: PlaySE(SE_SELECT); ClearBottomWindow(); - gUnknown_02039D08->wallpaperId -= 23; - SetWallpaperForCurrentBox(gUnknown_02039D08->wallpaperId); - gUnknown_02039D08->state++; + sPSSData->wallpaperId -= 23; + SetWallpaperForCurrentBox(sPSSData->wallpaperId); + sPSSData->state++; break; } break; @@ -3589,8 +3569,8 @@ static void Cb_HandleWallpapers(u8 taskId) case 6: if (!IsDma3ManagerBusyWithBgCopy()) { - SetWallpaperForCurrentBox(gUnknown_02039D08->wallpaperId); - gUnknown_02039D08->state = 5; + SetWallpaperForCurrentBox(sPSSData->wallpaperId); + sPSSData->state = 5; } break; } @@ -3598,17 +3578,17 @@ static void Cb_HandleWallpapers(u8 taskId) static void Cb_JumpBox(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: PrintStorageActionText(PC_TEXT_JUMP_TO_WHICH_BOX); - sub_80C77E8(&gUnknown_02039D08->field_1E5C, TAG_TILE_A, TAG_PAL_DAC7, 3, FALSE); + sub_80C77E8(&sPSSData->field_1E5C, TAG_TILE_A, TAG_PAL_DAC7, 3, FALSE); sub_80C78D4(StorageGetCurrentBox()); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 1: - gUnknown_02039D08->newCurrBoxId = sub_80C78F0(); - switch (gUnknown_02039D08->newCurrBoxId) + sPSSData->newCurrBoxId = sub_80C78F0(); + switch (sPSSData->newCurrBoxId) { case 200: break; @@ -3616,26 +3596,26 @@ static void Cb_JumpBox(u8 taskId) ClearBottomWindow(); sub_80C78E4(); sub_80C7890(); - if (gUnknown_02039D08->newCurrBoxId == 201 || gUnknown_02039D08->newCurrBoxId == StorageGetCurrentBox()) + if (sPSSData->newCurrBoxId == 201 || sPSSData->newCurrBoxId == StorageGetCurrentBox()) { sub_80CD1A8(TRUE); SetPSSCallback(Cb_MainPSS); } else { - gUnknown_02039D08->state++; + sPSSData->state++; } break; } break; case 2: - SetUpScrollToBox(gUnknown_02039D08->newCurrBoxId); - gUnknown_02039D08->state++; + SetUpScrollToBox(sPSSData->newCurrBoxId); + sPSSData->state++; break; case 3: if (!ScrollToBox()) { - SetCurrentBox(gUnknown_02039D08->newCurrBoxId); + SetCurrentBox(sPSSData->newCurrBoxId); SetPSSCallback(Cb_MainPSS); } break; @@ -3644,18 +3624,18 @@ static void Cb_JumpBox(u8 taskId) static void Cb_NameBox(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: sub_80CE760(); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 1: if (!UpdatePaletteFade()) { - gUnknown_02039D0F = 1; - gUnknown_02039D08->screenChangeType = SCREEN_CHANGE_NAME_BOX; + sWhichToReshow = 1; + sPSSData->screenChangeType = SCREEN_CHANGE_NAME_BOX; SetPSSCallback(Cb_ChangeScreen); } break; @@ -3664,18 +3644,18 @@ static void Cb_NameBox(u8 taskId) static void Cb_ShowMonSummary(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: sub_80CE7E8(); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 1: if (!UpdatePaletteFade()) { - gUnknown_02039D0F = 0; - gUnknown_02039D08->screenChangeType = SCREEN_CHANGE_SUMMARY_SCREEN; + sWhichToReshow = 0; + sPSSData->screenChangeType = SCREEN_CHANGE_SUMMARY_SCREEN; SetPSSCallback(Cb_ChangeScreen); } break; @@ -3684,17 +3664,17 @@ static void Cb_ShowMonSummary(u8 taskId) static void Cb_GiveItemFromBag(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 1: if (!UpdatePaletteFade()) { - gUnknown_02039D0F = 2; - gUnknown_02039D08->screenChangeType = SCREEN_CHANGE_ITEM_FROM_BAG; + sWhichToReshow = 2; + sPSSData->screenChangeType = SCREEN_CHANGE_ITEM_FROM_BAG; SetPSSCallback(Cb_ChangeScreen); } break; @@ -3703,14 +3683,14 @@ static void Cb_GiveItemFromBag(u8 taskId) static void Cb_OnCloseBoxPressed(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: if (IsMonBeingMoved()) { PlaySE(SE_HAZURE); PrintStorageActionText(PC_TEXT_HOLDING_POKE); - gUnknown_02039D08->state = 1; + sPSSData->state = 1; } else if (IsActiveItemMoving()) { @@ -3721,7 +3701,7 @@ static void Cb_OnCloseBoxPressed(u8 taskId) PlaySE(SE_SELECT); PrintStorageActionText(PC_TEXT_EXIT_BOX); ShowYesNoWindow(0); - gUnknown_02039D08->state = 2; + sPSSData->state = 2; } break; case 1: @@ -3742,20 +3722,20 @@ static void Cb_OnCloseBoxPressed(u8 taskId) case 0: PlaySE(SE_PC_OFF); ClearBottomWindow(); - gUnknown_02039D08->state++; + sPSSData->state++; break; } break; case 3: sub_80F9BF4(0x14, 0, 1); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 4: if (!sub_80F9C30()) { sub_80CABE0(); gPlayerPartyCount = CalculatePlayerPartyCount(); - gUnknown_02039D08->screenChangeType = SCREEN_CHANGE_EXIT_BOX; + sPSSData->screenChangeType = SCREEN_CHANGE_EXIT_BOX; SetPSSCallback(Cb_ChangeScreen); } break; @@ -3764,14 +3744,14 @@ static void Cb_OnCloseBoxPressed(u8 taskId) static void Cb_OnBPressed(u8 taskId) { - switch (gUnknown_02039D08->state) + switch (sPSSData->state) { case 0: if (IsMonBeingMoved()) { PlaySE(SE_HAZURE); PrintStorageActionText(PC_TEXT_HOLDING_POKE); - gUnknown_02039D08->state = 1; + sPSSData->state = 1; } else if (IsActiveItemMoving()) { @@ -3782,7 +3762,7 @@ static void Cb_OnBPressed(u8 taskId) PlaySE(SE_SELECT); PrintStorageActionText(PC_TEXT_CONTINUE_BOX); ShowYesNoWindow(0); - gUnknown_02039D08->state = 2; + sPSSData->state = 2; } break; case 1: @@ -3803,20 +3783,20 @@ static void Cb_OnBPressed(u8 taskId) case -1: PlaySE(SE_PC_OFF); ClearBottomWindow(); - gUnknown_02039D08->state++; + sPSSData->state++; break; } break; case 3: sub_80F9BF4(0x14, 0, 0); - gUnknown_02039D08->state++; + sPSSData->state++; break; case 4: if (!sub_80F9C30()) { sub_80CABE0(); gPlayerPartyCount = CalculatePlayerPartyCount(); - gUnknown_02039D08->screenChangeType = SCREEN_CHANGE_EXIT_BOX; + sPSSData->screenChangeType = SCREEN_CHANGE_EXIT_BOX; SetPSSCallback(Cb_ChangeScreen); } break; @@ -3827,9 +3807,9 @@ static void Cb_ChangeScreen(u8 taskId) { struct BoxPokemon *boxMons; u8 mode, monIndex, maxMonIndex; - u8 screenChangeType = gUnknown_02039D08->screenChangeType; + u8 screenChangeType = sPSSData->screenChangeType; - if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS && IsActiveItemMoving() == TRUE) + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS && IsActiveItemMoving() == TRUE) gUnknown_02039D12 = GetMovingItem(); else gUnknown_02039D12 = 0; @@ -3842,10 +3822,10 @@ static void Cb_ChangeScreen(u8 taskId) SetMainCallback2(Cb2_ExitPSS); break; case SCREEN_CHANGE_SUMMARY_SCREEN: - boxMons = gUnknown_02039D08->field_218C.box; - monIndex = gUnknown_02039D08->field_2187; - maxMonIndex = gUnknown_02039D08->field_2186; - mode = gUnknown_02039D08->field_2188; + 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); @@ -3886,7 +3866,7 @@ static void FreePSSData(void) { sub_80D25F0(); sub_80D01B8(); - FREE_AND_SET_NULL(gUnknown_02039D08); + FREE_AND_SET_NULL(sPSSData); FreeAllWindowBuffers(); } @@ -3907,8 +3887,8 @@ static void LoadPSSMenuGfx(void) { InitBgsFromTemplates(0, gUnknown_08572734, ARRAY_COUNT(gUnknown_08572734)); DecompressAndLoadBgGfxUsingHeap(1, gPSSMenu_Gfx, 0, 0, 0); - LZ77UnCompWram(gUnknown_085722A0, gUnknown_02039D08->field_5AC4); - SetBgTilemapBuffer(1, gUnknown_02039D08->field_5AC4); + LZ77UnCompWram(gUnknown_085722A0, sPSSData->field_5AC4); + SetBgTilemapBuffer(1, sPSSData->field_5AC4); ShowBg(1); schedule_bg_copy_tilemap_to_vram(1); } @@ -3936,7 +3916,7 @@ static void sub_80CA0D8(void) LoadPalette(gUnknown_085723DC, 0, 0x20); LoadPalette(gUnknown_085723FC, 0x20, 0x20); LoadPalette(gUnknown_085726F4, 0xF0, 0x20); - if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) LoadPalette(gUnknown_0857241C, 0x30, 0x20); else LoadPalette(gUnknown_0857243C, 0x30, 0x20); @@ -3950,12 +3930,12 @@ static void sub_80CA0D8(void) static void sub_80CA154(void) { - gUnknown_02039D08->field_D94 = sub_811FFB4(TAG_TILE_10, TAG_PAL_DAC8, NULL); - gUnknown_02039D08->field_D94->oam.priority = 1; - gUnknown_02039D08->field_D94->subpriority = 1; - gUnknown_02039D08->field_D94->pos1.x = 40; - gUnknown_02039D08->field_D94->pos1.y = 150; - gUnknown_02039D08->field_DA0 = (void*) OBJ_VRAM0 + 32 * GetSpriteTileStartByTag(TAG_TILE_10); + 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) @@ -3967,13 +3947,13 @@ static void sub_80CA1C4(void) for (i = 0; i < 2; i++) { u8 spriteId = CreateSprite(&gUnknown_085728BC, i * 63 + 8, 9, 2); - gUnknown_02039D08->field_D98[i] = &gSprites[spriteId]; + sPSSData->field_D98[i] = &gSprites[spriteId]; } } static void RefreshCursorMonData(void) { - LoadCursorMonGfx(gUnknown_02039D08->cursorMonSpecies, gUnknown_02039D08->cursorMonPersonality); + LoadCursorMonGfx(sPSSData->cursorMonSpecies, sPSSData->cursorMonPersonality); PrintCursorMonInfo(); sub_80CA65C(); schedule_bg_copy_tilemap_to_vram(0); @@ -3982,19 +3962,19 @@ static void RefreshCursorMonData(void) static void BoxSetMosaic(void) { RefreshCursorMonData(); - if (gUnknown_02039D08->cursorMonSprite) + if (sPSSData->cursorMonSprite) { - gUnknown_02039D08->cursorMonSprite->oam.mosaic = TRUE; - gUnknown_02039D08->cursorMonSprite->data[0] = 10; - gUnknown_02039D08->cursorMonSprite->data[1] = 1; - gUnknown_02039D08->cursorMonSprite->callback = sub_80CA2D0; - SetGpuReg(REG_OFFSET_MOSAIC, (gUnknown_02039D08->cursorMonSprite->data[0] << 12) | (gUnknown_02039D08->cursorMonSprite->data[0] << 8)); + 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 gUnknown_02039D08->cursorMonSprite->oam.mosaic; + return sPSSData->cursorMonSprite->oam.mosaic; } static void sub_80CA2D0(struct Sprite *sprite) @@ -4016,16 +3996,16 @@ static void LoadCursorMonSprite(void) u16 tileStart; u8 palSlot; u8 spriteId; - struct SpriteSheet sheet = {gUnknown_02039D08->field_22C4, 0x800, TAG_TILE_2}; - struct SpritePalette palette = {gUnknown_02039D08->field_2244, TAG_PAL_DAC6}; + 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++) - gUnknown_02039D08->field_22C4[i] = 0; + sPSSData->field_22C4[i] = 0; for (i = 0; i < 0x10; i++) - gUnknown_02039D08->field_2244[i] = 0; + sPSSData->field_2244[i] = 0; - gUnknown_02039D08->cursorMonSprite = NULL; + sPSSData->cursorMonSprite = NULL; do { @@ -4041,12 +4021,12 @@ static void LoadCursorMonSprite(void) if (spriteId == MAX_SPRITES) break; - gUnknown_02039D08->cursorMonSprite = &gSprites[spriteId]; - gUnknown_02039D08->field_223A = palSlot * 16 + 0x100; - gUnknown_02039D08->field_223C = (void*) OBJ_VRAM0 + tileStart * 32; + sPSSData->cursorMonSprite = &gSprites[spriteId]; + sPSSData->field_223A = palSlot * 16 + 0x100; + sPSSData->field_223C = (void*) OBJ_VRAM0 + tileStart * 32; } while (0); - if (gUnknown_02039D08->cursorMonSprite == NULL) + if (sPSSData->cursorMonSprite == NULL) { FreeSpriteTilesByTag(TAG_TILE_2); FreeSpritePaletteByTag(TAG_PAL_DAC6); @@ -4055,50 +4035,50 @@ static void LoadCursorMonSprite(void) static void LoadCursorMonGfx(u16 species, u32 pid) { - if (gUnknown_02039D08->cursorMonSprite == NULL) + if (sPSSData->cursorMonSprite == NULL) return; if (species != SPECIES_NONE) { - LoadSpecialPokePic(&gMonFrontPicTable[species], gUnknown_02039D08->field_22C4, species, pid, TRUE); - LZ77UnCompWram(gUnknown_02039D08->cursorMonPalette, gUnknown_02039D08->field_2244); - CpuCopy32(gUnknown_02039D08->field_22C4, gUnknown_02039D08->field_223C, 0x800); - LoadPalette(gUnknown_02039D08->field_2244, gUnknown_02039D08->field_223A, 0x20); - gUnknown_02039D08->cursorMonSprite->invisible = FALSE; + 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 { - gUnknown_02039D08->cursorMonSprite->invisible = TRUE; + sPSSData->cursorMonSprite->invisible = TRUE; } } static void PrintCursorMonInfo(void) { FillWindowPixelBuffer(0, 0x11); - if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) { - AddTextPrinterParameterized(0, 1, gUnknown_02039D08->cursorMonNickText, 6, 0, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(0, 2, gUnknown_02039D08->cursorMonSpeciesName, 6, 15, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(0, 2, gUnknown_02039D08->cursorMonGenderLvlText, 10, 29, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(0, 0, gUnknown_02039D08->cursorMonItemName, 6, 43, TEXT_SPEED_FF, NULL); + 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, gUnknown_02039D08->cursorMonItemName, 6, 0, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(0, 1, gUnknown_02039D08->cursorMonNickText, 6, 13, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(0, 2, gUnknown_02039D08->cursorMonSpeciesName, 6, 28, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(0, 2, gUnknown_02039D08->cursorMonGenderLvlText, 10, 42, TEXT_SPEED_FF, NULL); + 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 (gUnknown_02039D08->cursorMonSpecies != SPECIES_NONE) + if (sPSSData->cursorMonSpecies != SPECIES_NONE) { - sub_8120084(gUnknown_02039D08->cursorMonMarkings, gUnknown_02039D08->field_DA0); - gUnknown_02039D08->field_D94->invisible = FALSE; + sub_8120084(sPSSData->cursorMonMarkings, sPSSData->field_DA0); + sPSSData->field_D94->invisible = FALSE; } else { - gUnknown_02039D08->field_D94->invisible = TRUE; + sPSSData->field_D94->invisible = TRUE; } } @@ -4106,17 +4086,17 @@ static void sub_80CA65C(void) { u16 i; - if (gUnknown_02039D08->cursorMonSpecies != SPECIES_NONE) + if (sPSSData->cursorMonSpecies != SPECIES_NONE) { sub_80D27AC(0, 0, 0, 8, 2); for (i = 0; i < 2; i++) - StartSpriteAnimIfDifferent(gUnknown_02039D08->field_D98[i], i * 2 + 1); + StartSpriteAnimIfDifferent(sPSSData->field_D98[i], i * 2 + 1); } else { sub_80D27AC(0, 0, 2, 8, 2); for (i = 0; i < 2; i++) - StartSpriteAnim(gUnknown_02039D08->field_D98[i], i * 2); + StartSpriteAnim(sPSSData->field_D98[i], i * 2); } sub_80D2918(0); @@ -4125,9 +4105,9 @@ static void sub_80CA65C(void) static void sub_80CA704(void) { - LZ77UnCompWram(gUnknown_08DD36C8, gUnknown_02039D08->field_B0); + LZ77UnCompWram(gUnknown_08DD36C8, sPSSData->field_B0); LoadPalette(gPSSMenu_Pal, 0x10, 0x20); - sub_80D2644(1, 1, gUnknown_02039D08->field_B0, 12, 22); + 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); @@ -4148,29 +4128,29 @@ static void sub_80CA704(void) } schedule_bg_copy_tilemap_to_vram(1); - gUnknown_02039D08->unk_02C7 = 0; + sPSSData->unk_02C7 = 0; } static void SetUpShowPartyMenu(void) { - gUnknown_02039D08->field_2C0 = 20; - gUnknown_02039D08->field_2C2 = 2; - gUnknown_02039D08->field_2C5 = 0; + sPSSData->field_2C0 = 20; + sPSSData->field_2C2 = 2; + sPSSData->field_2C5 = 0; CreatePartyMonsSprites(FALSE); } static bool8 ShowPartyMenu(void) { - if (gUnknown_02039D08->field_2C5 == 20) + if (sPSSData->field_2C5 == 20) return FALSE; - gUnknown_02039D08->field_2C0--; - gUnknown_02039D08->field_2C2++; + 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 (++gUnknown_02039D08->field_2C5 == 20) + if (++sPSSData->field_2C5 == 20) { sInPartyMenu = TRUE; return FALSE; @@ -4183,24 +4163,24 @@ static bool8 ShowPartyMenu(void) static void SetUpHidePartyMenu(void) { - gUnknown_02039D08->field_2C0 = 0; - gUnknown_02039D08->field_2C2 = 22; - gUnknown_02039D08->field_2C5 = 0; - if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + 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 (gUnknown_02039D08->field_2C5 != 20) + if (sPSSData->field_2C5 != 20) { - gUnknown_02039D08->field_2C0++; - gUnknown_02039D08->field_2C2--; + sPSSData->field_2C0++; + sPSSData->field_2C2--; sub_80D27F4(1, 3, -1); sub_80D2918(1); - FillBgTilemapBufferRect_Palette0(1, 0x100, 10, gUnknown_02039D08->field_2C2, 12, 1); + FillBgTilemapBufferRect_Palette0(1, 0x100, 10, sPSSData->field_2C2, 12, 1); sub_80CBAF0(-8); - if (++gUnknown_02039D08->field_2C5 != 20) + if (++sPSSData->field_2C5 != 20) { schedule_bg_copy_tilemap_to_vram(1); return TRUE; @@ -4233,27 +4213,27 @@ static void sub_80CA984(bool8 arg0) static void sub_80CA9C0(void) { - gUnknown_02039D08->unk_02C7 = 1; - gUnknown_02039D08->unk_02C8 = 30; - gUnknown_02039D08->unk_02C9 = TRUE; + sPSSData->unk_02C7 = 1; + sPSSData->unk_02C8 = 30; + sPSSData->unk_02C9 = TRUE; } static void sub_80CA9EC(void) { - if (gUnknown_02039D08->unk_02C7) + if (sPSSData->unk_02C7) { - gUnknown_02039D08->unk_02C7 = 0; + sPSSData->unk_02C7 = 0; sub_80CA984(TRUE); } } static void sub_80CAA14(void) { - if (gUnknown_02039D08->unk_02C7 && ++gUnknown_02039D08->unk_02C8 > 30) + if (sPSSData->unk_02C7 && ++sPSSData->unk_02C8 > 30) { - gUnknown_02039D08->unk_02C8 = 0; - gUnknown_02039D08->unk_02C9 = (gUnknown_02039D08->unk_02C9 == FALSE); - sub_80CA984(gUnknown_02039D08->unk_02C9); + sPSSData->unk_02C8 = 0; + sPSSData->unk_02C9 = (sPSSData->unk_02C9 == FALSE); + sub_80CA984(sPSSData->unk_02C9); } } @@ -4285,7 +4265,7 @@ static void sub_80CAAA8(u8 arg0, bool8 isPartyMon) { for (j = 0; j < 4; j++) { - gUnknown_02039D08->field_B0[index + j] = data[j]; + sPSSData->field_B0[index + j] = data[j]; } data += 4; index += 12; @@ -4302,28 +4282,28 @@ static void sub_80CAB20(void) static void SetUpDoShowPartyMenu(void) { - gUnknown_02039D08->showPartyMenuState = 0; + sPSSData->showPartyMenuState = 0; PlaySE(SE_WIN_OPEN); SetUpShowPartyMenu(); } static bool8 DoShowPartyMenu(void) { - switch (gUnknown_02039D08->showPartyMenuState) + switch (sPSSData->showPartyMenuState) { case 0: if (!ShowPartyMenu()) { sub_80CDBA0(); - gUnknown_02039D08->showPartyMenuState++; + sPSSData->showPartyMenuState++; } break; case 1: if (!sub_80CD554()) { - if (gUnknown_02039D08->field_CEA) + if (sPSSData->setMosaic) BoxSetMosaic(); - gUnknown_02039D08->showPartyMenuState++; + sPSSData->showPartyMenuState++; } break; case 2: @@ -4361,30 +4341,30 @@ static void PrintStorageActionText(u8 id) case PC_TEXT_FMT_MON_NAME_1: case PC_TEXT_FMT_MON_NAME_2: case PC_TEXT_FMT_MON_NAME_3: - DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_02039D08->cursorMonNick); + 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, gUnknown_02039D08->field_21E0); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, sPSSData->field_21E0); break; case PC_TEXT_FMT_ITEM_NAME: if (IsActiveItemMoving()) - txtPtr = StringCopy(gUnknown_02039D08->field_21EB, GetMovingItemName()); + txtPtr = StringCopy(sPSSData->itemName, GetMovingItemName()); else - txtPtr = StringCopy(gUnknown_02039D08->field_21EB, gUnknown_02039D08->cursorMonItemName); + txtPtr = StringCopy(sPSSData->itemName, sPSSData->cursorMonItemName); while (*(txtPtr - 1) == CHAR_SPACE) txtPtr--; *txtPtr = EOS; - DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_02039D08->field_21EB); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, sPSSData->itemName); break; } - DynamicPlaceholderTextUtil_ExpandPlaceholders(gUnknown_02039D08->field_2190, gPCStorageActionTexts[id].text); + DynamicPlaceholderTextUtil_ExpandPlaceholders(sPSSData->field_2190, gPCStorageActionTexts[id].text); FillWindowPixelBuffer(1, 0x11); - AddTextPrinterParameterized(1, 1, gUnknown_02039D08->field_2190, 0, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(1, 1, sPSSData->field_2190, 0, 1, TEXT_SPEED_FF, NULL); sub_8098858(1, 2, 14); PutWindowTilemap(1); CopyWindowToVram(1, 2); @@ -4476,16 +4456,16 @@ static void sub_80CAF04(void) LoadMonIconPalettes(); for (i = 0; i < 40; i++) - gUnknown_02039D08->field_B08[i] = 0; + sPSSData->field_B08[i] = 0; for (i = 0; i < 40; i++) - gUnknown_02039D08->field_B58[i] = 0; + sPSSData->field_B58[i] = 0; for (i = 0; i < PARTY_SIZE; i++) - gUnknown_02039D08->partySprites[i] = NULL; + sPSSData->partySprites[i] = NULL; for (i = 0; i < IN_BOX_COUNT; i++) - gUnknown_02039D08->boxMonsSprites[i] = NULL; + sPSSData->boxMonsSprites[i] = NULL; - gUnknown_02039D08->movingMonSprite = NULL; - gUnknown_02039D08->field_78C = 0; + sPSSData->movingMonSprite = NULL; + sPSSData->field_78C = 0; } static u8 sub_80CAFAC(void) @@ -4495,12 +4475,12 @@ static u8 sub_80CAFAC(void) static void CreateMovingMonIcon(void) { - u32 personality = GetMonData(&gUnknown_02039D08->movingMon, MON_DATA_PERSONALITY); - u16 species = GetMonData(&gUnknown_02039D08->movingMon, MON_DATA_SPECIES2); + u32 personality = GetMonData(&sPSSData->movingMon, MON_DATA_PERSONALITY); + u16 species = GetMonData(&sPSSData->movingMon, MON_DATA_SPECIES2); u8 priority = sub_80CAFAC(); - gUnknown_02039D08->movingMonSprite = CreateMonIconSprite(species, personality, 0, 0, priority, 7); - gUnknown_02039D08->movingMonSprite->callback = sub_80CC100; + sPSSData->movingMonSprite = CreateMonIconSprite(species, personality, 0, 0, priority, 7); + sPSSData->movingMonSprite->callback = sub_80CC100; } static void sub_80CB028(u8 boxId) @@ -4520,23 +4500,23 @@ static void sub_80CB028(u8 boxId) if (species != SPECIES_NONE) { personality = GetBoxMonDataAt(boxId, boxPosition, MON_DATA_PERSONALITY); - gUnknown_02039D08->boxMonsSprites[count] = CreateMonIconSprite(species, personality, 8 * (3 * j) + 100, 8 * (3 * i) + 44, 2, 19 - j); + sPSSData->boxMonsSprites[count] = CreateMonIconSprite(species, personality, 8 * (3 * j) + 100, 8 * (3 * i) + 44, 2, 19 - j); } else { - gUnknown_02039D08->boxMonsSprites[count] = NULL; + sPSSData->boxMonsSprites[count] = NULL; } boxPosition++; count++; } } - if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) { for (boxPosition = 0; boxPosition < IN_BOX_COUNT; boxPosition++) { if (GetBoxMonDataAt(boxId, boxPosition, MON_DATA_HELD_ITEM) == 0) - gUnknown_02039D08->boxMonsSprites[boxPosition]->oam.objMode = 1; + sPSSData->boxMonsSprites[boxPosition]->oam.objMode = 1; } } } @@ -4551,9 +4531,9 @@ static void sub_80CB140(u8 boxPosition) s16 y = 8 * (3 * (boxPosition / IN_BOX_ROWS)) + 44; u32 personality = GetCurrentBoxMonData(boxPosition, MON_DATA_PERSONALITY); - gUnknown_02039D08->boxMonsSprites[boxPosition] = CreateMonIconSprite(species, personality, x, y, 2, 19 - (boxPosition % IN_BOX_ROWS)); - if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) - gUnknown_02039D08->boxMonsSprites[boxPosition]->oam.objMode = 1; + 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; } } @@ -4563,11 +4543,11 @@ static void sub_80CB1F0(s16 arg0) for (i = 0; i < IN_BOX_COUNT; i++) { - if (gUnknown_02039D08->boxMonsSprites[i] != NULL) + if (sPSSData->boxMonsSprites[i] != NULL) { - gUnknown_02039D08->boxMonsSprites[i]->data[2] = arg0; - gUnknown_02039D08->boxMonsSprites[i]->data[4] = 1; - gUnknown_02039D08->boxMonsSprites[i]->callback = sub_80CB278; + sPSSData->boxMonsSprites[i]->data[2] = arg0; + sPSSData->boxMonsSprites[i]->data[4] = 1; + sPSSData->boxMonsSprites[i]->callback = sub_80CB278; } } } @@ -4581,7 +4561,7 @@ static void sub_80CB234(struct Sprite *sprite) } else { - gUnknown_02039D08->field_C66--; + sPSSData->field_C66--; sprite->pos1.x = sprite->data[3]; sprite->callback = SpriteCallbackDummy; } @@ -4609,10 +4589,10 @@ static void DestroyAllIconsInRow(u8 row) for (column = 0; column < IN_BOX_COLUMS; column++) { - if (gUnknown_02039D08->boxMonsSprites[boxPosition] != NULL) + if (sPSSData->boxMonsSprites[boxPosition] != NULL) { - DestroyBoxMonIcon(gUnknown_02039D08->boxMonsSprites[boxPosition]); - gUnknown_02039D08->boxMonsSprites[boxPosition] = NULL; + DestroyBoxMonIcon(sPSSData->boxMonsSprites[boxPosition]); + sPSSData->boxMonsSprites[boxPosition] = NULL; } boxPosition += IN_BOX_ROWS; } @@ -4628,21 +4608,21 @@ static u8 sub_80CB2F8(u8 row, u16 times, s16 xDelta) u8 count = 0; u8 boxPosition = row; - if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) { for (i = 0; i < IN_BOX_COLUMS; i++) { - if (gUnknown_02039D08->boxSpecies[boxPosition] != SPECIES_NONE) + if (sPSSData->boxSpecies[boxPosition] != SPECIES_NONE) { - gUnknown_02039D08->boxMonsSprites[boxPosition] = CreateMonIconSprite(gUnknown_02039D08->boxSpecies[boxPosition], - gUnknown_02039D08->boxPersonalities[boxPosition], + sPSSData->boxMonsSprites[boxPosition] = CreateMonIconSprite(sPSSData->boxSpecies[boxPosition], + sPSSData->boxPersonalities[boxPosition], x, y, 2, subpriority); - if (gUnknown_02039D08->boxMonsSprites[boxPosition] != NULL) + if (sPSSData->boxMonsSprites[boxPosition] != NULL) { - gUnknown_02039D08->boxMonsSprites[boxPosition]->data[1] = times; - gUnknown_02039D08->boxMonsSprites[boxPosition]->data[2] = xDelta; - gUnknown_02039D08->boxMonsSprites[boxPosition]->data[3] = xDest; - gUnknown_02039D08->boxMonsSprites[boxPosition]->callback = sub_80CB234; + 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++; } } @@ -4654,19 +4634,19 @@ static u8 sub_80CB2F8(u8 row, u16 times, s16 xDelta) { for (i = 0; i < IN_BOX_COLUMS; i++) { - if (gUnknown_02039D08->boxSpecies[boxPosition] != SPECIES_NONE) + if (sPSSData->boxSpecies[boxPosition] != SPECIES_NONE) { - gUnknown_02039D08->boxMonsSprites[boxPosition] = CreateMonIconSprite(gUnknown_02039D08->boxSpecies[boxPosition], - gUnknown_02039D08->boxPersonalities[boxPosition], + sPSSData->boxMonsSprites[boxPosition] = CreateMonIconSprite(sPSSData->boxSpecies[boxPosition], + sPSSData->boxPersonalities[boxPosition], x, y, 2, subpriority); - if (gUnknown_02039D08->boxMonsSprites[boxPosition] != NULL) + if (sPSSData->boxMonsSprites[boxPosition] != NULL) { - gUnknown_02039D08->boxMonsSprites[boxPosition]->data[1] = times; - gUnknown_02039D08->boxMonsSprites[boxPosition]->data[2] = xDelta; - gUnknown_02039D08->boxMonsSprites[boxPosition]->data[3] = xDest; - gUnknown_02039D08->boxMonsSprites[boxPosition]->callback = sub_80CB234; - if (GetBoxMonDataAt(gUnknown_02039D08->field_C5C, boxPosition, MON_DATA_HELD_ITEM) == 0) - gUnknown_02039D08->boxMonsSprites[boxPosition]->oam.objMode = 1; + 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++; } } @@ -4680,56 +4660,56 @@ static u8 sub_80CB2F8(u8 row, u16 times, s16 xDelta) static void sub_80CB4CC(u8 boxId, s8 direction) { - gUnknown_02039D08->field_C6A = 0; - gUnknown_02039D08->field_C6B = boxId; - gUnknown_02039D08->field_C69 = direction; - gUnknown_02039D08->field_C60 = 32; - gUnknown_02039D08->field_C64 = -(6 * direction); - gUnknown_02039D08->field_C66 = 0; + 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) - gUnknown_02039D08->field_C68 = 0; + sPSSData->field_C68 = 0; else - gUnknown_02039D08->field_C68 = IN_BOX_ROWS - 1; + sPSSData->field_C68 = IN_BOX_ROWS - 1; - gUnknown_02039D08->field_C62 = (24 * gUnknown_02039D08->field_C68) + 100; - sub_80CB1F0(gUnknown_02039D08->field_C64); + sPSSData->field_C62 = (24 * sPSSData->field_C68) + 100; + sub_80CB1F0(sPSSData->field_C64); } static bool8 sub_80CB584(void) { - if (gUnknown_02039D08->field_C60 != 0) - gUnknown_02039D08->field_C60--; + if (sPSSData->field_C60 != 0) + sPSSData->field_C60--; - switch (gUnknown_02039D08->field_C6A) + switch (sPSSData->field_C6A) { case 0: - gUnknown_02039D08->field_C62 += gUnknown_02039D08->field_C64; - if (gUnknown_02039D08->field_C62 <= 64 || gUnknown_02039D08->field_C62 >= 252) + sPSSData->field_C62 += sPSSData->field_C64; + if (sPSSData->field_C62 <= 64 || sPSSData->field_C62 >= 252) { - DestroyAllIconsInRow(gUnknown_02039D08->field_C68); - gUnknown_02039D08->field_C62 += gUnknown_02039D08->field_C69 * 24; - gUnknown_02039D08->field_C6A++; + DestroyAllIconsInRow(sPSSData->field_C68); + sPSSData->field_C62 += sPSSData->field_C69 * 24; + sPSSData->field_C6A++; } break; case 1: - gUnknown_02039D08->field_C62 += gUnknown_02039D08->field_C64; - gUnknown_02039D08->field_C66 += sub_80CB2F8(gUnknown_02039D08->field_C68, gUnknown_02039D08->field_C60, gUnknown_02039D08->field_C64); - if ((gUnknown_02039D08->field_C69 > 0 && gUnknown_02039D08->field_C68 == IN_BOX_ROWS - 1) - || (gUnknown_02039D08->field_C69 < 0 && gUnknown_02039D08->field_C68 == 0)) + 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)) { - gUnknown_02039D08->field_C6A++; + sPSSData->field_C6A++; } else { - gUnknown_02039D08->field_C68 += gUnknown_02039D08->field_C69; - gUnknown_02039D08->field_C6A = 0; + sPSSData->field_C68 += sPSSData->field_C69; + sPSSData->field_C6A = 0; } break; case 2: - if (gUnknown_02039D08->field_C66 == 0) + if (sPSSData->field_C66 == 0) { - gUnknown_02039D08->field_C60++; + sPSSData->field_C60++; return FALSE; } break; @@ -4749,30 +4729,30 @@ static void SetBoxSpeciesAndPersonalities(u8 boxId) { for (j = 0; j < IN_BOX_ROWS; j++) { - gUnknown_02039D08->boxSpecies[boxPosition] = GetBoxMonDataAt(boxId, boxPosition, MON_DATA_SPECIES2); - if (gUnknown_02039D08->boxSpecies[boxPosition] != SPECIES_NONE) - gUnknown_02039D08->boxPersonalities[boxPosition] = GetBoxMonDataAt(boxId, boxPosition, MON_DATA_PERSONALITY); + 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++; } } - gUnknown_02039D08->field_C5C = boxId; + sPSSData->field_C5C = boxId; } static void DestroyBoxMonIconAtPosition(u8 boxPosition) { - if (gUnknown_02039D08->boxMonsSprites[boxPosition] != NULL) + if (sPSSData->boxMonsSprites[boxPosition] != NULL) { - DestroyBoxMonIcon(gUnknown_02039D08->boxMonsSprites[boxPosition]); - gUnknown_02039D08->boxMonsSprites[boxPosition] = NULL; + DestroyBoxMonIcon(sPSSData->boxMonsSprites[boxPosition]); + sPSSData->boxMonsSprites[boxPosition] = NULL; } } static void SetBoxMonIconObjMode(u8 boxPosition, u8 objMode) { - if (gUnknown_02039D08->boxMonsSprites[boxPosition] != NULL) + if (sPSSData->boxMonsSprites[boxPosition] != NULL) { - gUnknown_02039D08->boxMonsSprites[boxPosition]->oam.objMode = objMode; + sPSSData->boxMonsSprites[boxPosition]->oam.objMode = objMode; } } @@ -4782,7 +4762,7 @@ static void CreatePartyMonsSprites(bool8 arg0) u16 species = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES2); u32 personality = GetMonData(&gPlayerParty[0], MON_DATA_PERSONALITY); - gUnknown_02039D08->partySprites[0] = CreateMonIconSprite(species, personality, 104, 64, 1, 12); + sPSSData->partySprites[0] = CreateMonIconSprite(species, personality, 104, 64, 1, 12); count = 1; for (i = 1; i < PARTY_SIZE; i++) { @@ -4790,12 +4770,12 @@ static void CreatePartyMonsSprites(bool8 arg0) if (species != SPECIES_NONE) { personality = GetMonData(&gPlayerParty[i], MON_DATA_PERSONALITY); - gUnknown_02039D08->partySprites[i] = CreateMonIconSprite(species, personality, 152, 8 * (3 * (i - 1)) + 16, 1, 12); + sPSSData->partySprites[i] = CreateMonIconSprite(species, personality, 152, 8 * (3 * (i - 1)) + 16, 1, 12); count++; } else { - gUnknown_02039D08->partySprites[i] = NULL; + sPSSData->partySprites[i] = NULL; } } @@ -4803,17 +4783,17 @@ static void CreatePartyMonsSprites(bool8 arg0) { for (i = 0; i < count; i++) { - gUnknown_02039D08->partySprites[i]->pos1.y -= 160; - gUnknown_02039D08->partySprites[i]->invisible = TRUE; + sPSSData->partySprites[i]->pos1.y -= 160; + sPSSData->partySprites[i]->invisible = TRUE; } } - if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) { for (i = 0; i < PARTY_SIZE; i++) { - if (gUnknown_02039D08->partySprites[i] != NULL && GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM) == 0) - gUnknown_02039D08->partySprites[i]->oam.objMode = 1; + if (sPSSData->partySprites[i] != NULL && GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM) == 0) + sPSSData->partySprites[i]->oam.objMode = 1; } } } @@ -4822,16 +4802,16 @@ static void sub_80CB950(void) { u16 i, count; - gUnknown_02039D08->field_C5E = 0; + sPSSData->field_C5E = 0; for (i = 0, count = 0; i < PARTY_SIZE; i++) { - if (gUnknown_02039D08->partySprites[i] != NULL) + if (sPSSData->partySprites[i] != NULL) { if (i != count) { - sub_80CB9D0(gUnknown_02039D08->partySprites[i], count); - gUnknown_02039D08->partySprites[i] = NULL; - gUnknown_02039D08->field_C5E++; + sub_80CB9D0(sPSSData->partySprites[i], count); + sPSSData->partySprites[i] = NULL; + sPSSData->field_C5E++; } count++; } @@ -4840,7 +4820,7 @@ static void sub_80CB950(void) static u8 sub_80CB9BC(void) { - return gUnknown_02039D08->field_C5E; + return sPSSData->field_C5E; } static void sub_80CB9D0(struct Sprite *sprite, u16 partyId) @@ -4884,17 +4864,17 @@ static void sub_80CBA3C(struct Sprite *sprite) sprite->pos1.y = 8 * (3 * (sprite->data[1] - 1)) + 16; } sprite->callback = SpriteCallbackDummy; - gUnknown_02039D08->partySprites[sprite->data[1]] = sprite; - gUnknown_02039D08->field_C5E--; + sPSSData->partySprites[sprite->data[1]] = sprite; + sPSSData->field_C5E--; } } static void DestroyMovingMonIcon(void) { - if (gUnknown_02039D08->movingMonSprite != NULL) + if (sPSSData->movingMonSprite != NULL) { - DestroyBoxMonIcon(gUnknown_02039D08->movingMonSprite); - gUnknown_02039D08->movingMonSprite = NULL; + DestroyBoxMonIcon(sPSSData->movingMonSprite); + sPSSData->movingMonSprite = NULL; } } @@ -4904,25 +4884,25 @@ static void sub_80CBAF0(s16 yDelta) for (i = 0; i < PARTY_SIZE; i++) { - if (gUnknown_02039D08->partySprites[i] != NULL) + if (sPSSData->partySprites[i] != NULL) { - gUnknown_02039D08->partySprites[i]->pos1.y += yDelta; - posY = gUnknown_02039D08->partySprites[i]->pos1.y + gUnknown_02039D08->partySprites[i]->pos2.y + gUnknown_02039D08->partySprites[i]->centerToCornerVecY; + 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) - gUnknown_02039D08->partySprites[i]->invisible = TRUE; + sPSSData->partySprites[i]->invisible = TRUE; else - gUnknown_02039D08->partySprites[i]->invisible = FALSE; + sPSSData->partySprites[i]->invisible = FALSE; } } } static void DestroyPartyMonIcon(u8 partyId) { - if (gUnknown_02039D08->partySprites[partyId] != NULL) + if (sPSSData->partySprites[partyId] != NULL) { - DestroyBoxMonIcon(gUnknown_02039D08->partySprites[partyId]); - gUnknown_02039D08->partySprites[partyId] = NULL; + DestroyBoxMonIcon(sPSSData->partySprites[partyId]); + sPSSData->partySprites[partyId] = NULL; } } @@ -4932,19 +4912,19 @@ static void DestroyAllPartyMonIcons(void) for (i = 0; i < PARTY_SIZE; i++) { - if (gUnknown_02039D08->partySprites[i] != NULL) + if (sPSSData->partySprites[i] != NULL) { - DestroyBoxMonIcon(gUnknown_02039D08->partySprites[i]); - gUnknown_02039D08->partySprites[i] = NULL; + DestroyBoxMonIcon(sPSSData->partySprites[i]); + sPSSData->partySprites[i] = NULL; } } } static void SetPartyMonIconObjMode(u8 partyId, u8 objMode) { - if (gUnknown_02039D08->partySprites[partyId] != NULL) + if (sPSSData->partySprites[partyId] != NULL) { - gUnknown_02039D08->partySprites[partyId]->oam.objMode = objMode; + sPSSData->partySprites[partyId]->oam.objMode = objMode; } } @@ -4952,83 +4932,83 @@ static void sub_80CBC14(u8 mode, u8 id) { if (mode == MODE_PARTY) { - gUnknown_02039D08->movingMonSprite = gUnknown_02039D08->partySprites[id]; - gUnknown_02039D08->partySprites[id] = NULL; + sPSSData->movingMonSprite = sPSSData->partySprites[id]; + sPSSData->partySprites[id] = NULL; } else if (mode == MODE_BOX) { - gUnknown_02039D08->movingMonSprite = gUnknown_02039D08->boxMonsSprites[id]; - gUnknown_02039D08->boxMonsSprites[id] = NULL; + sPSSData->movingMonSprite = sPSSData->boxMonsSprites[id]; + sPSSData->boxMonsSprites[id] = NULL; } else { return; } - gUnknown_02039D08->movingMonSprite->callback = sub_80CC100; - gUnknown_02039D08->movingMonSprite->oam.priority = sub_80CAFAC(); - gUnknown_02039D08->movingMonSprite->subpriority = 7; + 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 { - gUnknown_02039D08->partySprites[position] = gUnknown_02039D08->movingMonSprite; - gUnknown_02039D08->partySprites[position]->oam.priority = 1; - gUnknown_02039D08->partySprites[position]->subpriority = 12; + sPSSData->partySprites[position] = sPSSData->movingMonSprite; + sPSSData->partySprites[position]->oam.priority = 1; + sPSSData->partySprites[position]->subpriority = 12; } else { - gUnknown_02039D08->boxMonsSprites[position] = gUnknown_02039D08->movingMonSprite; - gUnknown_02039D08->boxMonsSprites[position]->oam.priority = 2; - gUnknown_02039D08->boxMonsSprites[position]->subpriority = 19 - (position % IN_BOX_ROWS); + sPSSData->boxMonsSprites[position] = sPSSData->movingMonSprite; + sPSSData->boxMonsSprites[position]->oam.priority = 2; + sPSSData->boxMonsSprites[position]->subpriority = 19 - (position % IN_BOX_ROWS); } - gUnknown_02039D08->movingMonSprite->callback = SpriteCallbackDummy; - gUnknown_02039D08->movingMonSprite = NULL; + sPSSData->movingMonSprite->callback = SpriteCallbackDummy; + sPSSData->movingMonSprite = NULL; } static void sub_80CBD5C(u8 boxId, u8 position) { if (boxId == TOTAL_BOXES_COUNT) // party mon - gUnknown_02039D08->field_B00 = &gUnknown_02039D08->partySprites[position]; + sPSSData->field_B00 = &sPSSData->partySprites[position]; else - gUnknown_02039D08->field_B00 = &gUnknown_02039D08->boxMonsSprites[position]; + sPSSData->field_B00 = &sPSSData->boxMonsSprites[position]; - gUnknown_02039D08->movingMonSprite->callback = SpriteCallbackDummy; - gUnknown_02039D08->field_C5D = 0; + sPSSData->movingMonSprite->callback = SpriteCallbackDummy; + sPSSData->field_C5D = 0; } static bool8 sub_80CBDC4(void) { - if (gUnknown_02039D08->field_C5D == 16) + if (sPSSData->field_C5D == 16) return FALSE; - gUnknown_02039D08->field_C5D++; - if (gUnknown_02039D08->field_C5D & 1) + sPSSData->field_C5D++; + if (sPSSData->field_C5D & 1) { - (*gUnknown_02039D08->field_B00)->pos1.y--; - gUnknown_02039D08->movingMonSprite->pos1.y++; + (*sPSSData->field_B00)->pos1.y--; + sPSSData->movingMonSprite->pos1.y++; } - (*gUnknown_02039D08->field_B00)->pos2.x = gSineTable[gUnknown_02039D08->field_C5D * 8] / 16; - gUnknown_02039D08->movingMonSprite->pos2.x = -(gSineTable[gUnknown_02039D08->field_C5D * 8] / 16); - if (gUnknown_02039D08->field_C5D == 8) + (*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) { - gUnknown_02039D08->movingMonSprite->oam.priority = (*gUnknown_02039D08->field_B00)->oam.priority; - gUnknown_02039D08->movingMonSprite->subpriority = (*gUnknown_02039D08->field_B00)->subpriority; - (*gUnknown_02039D08->field_B00)->oam.priority = sub_80CAFAC(); - (*gUnknown_02039D08->field_B00)->subpriority = 7; + 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 (gUnknown_02039D08->field_C5D == 16) + if (sPSSData->field_C5D == 16) { - struct Sprite *sprite = gUnknown_02039D08->movingMonSprite; - gUnknown_02039D08->movingMonSprite = (*gUnknown_02039D08->field_B00); - *gUnknown_02039D08->field_B00 = sprite; + struct Sprite *sprite = sPSSData->movingMonSprite; + sPSSData->movingMonSprite = (*sPSSData->field_B00); + *sPSSData->field_B00 = sprite; - gUnknown_02039D08->movingMonSprite->callback = sub_80CC100; - (*gUnknown_02039D08->field_B00)->callback = SpriteCallbackDummy; + sPSSData->movingMonSprite->callback = sub_80CC100; + (*sPSSData->field_B00)->callback = SpriteCallbackDummy; } return TRUE; @@ -5039,77 +5019,77 @@ static void sub_80CBF14(u8 mode, u8 position) switch (mode) { case MODE_PARTY: - gUnknown_02039D08->field_B04 = &gUnknown_02039D08->partySprites[position]; + sPSSData->field_B04 = &sPSSData->partySprites[position]; break; case MODE_BOX: - gUnknown_02039D08->field_B04 = &gUnknown_02039D08->boxMonsSprites[position]; + sPSSData->field_B04 = &sPSSData->boxMonsSprites[position]; break; case MODE_2: - gUnknown_02039D08->field_B04 = &gUnknown_02039D08->movingMonSprite; + sPSSData->field_B04 = &sPSSData->movingMonSprite; break; default: return; } - if (*gUnknown_02039D08->field_B04 != NULL) + if (*sPSSData->field_B04 != NULL) { - InitSpriteAffineAnim(*gUnknown_02039D08->field_B04); - (*gUnknown_02039D08->field_B04)->oam.affineMode = 1; - (*gUnknown_02039D08->field_B04)->affineAnims = gSpriteAffineAnimTable_857291C; - StartSpriteAffineAnim(*gUnknown_02039D08->field_B04, 0); + 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 (*gUnknown_02039D08->field_B04 == NULL || (*gUnknown_02039D08->field_B04)->invisible) + if (*sPSSData->field_B04 == NULL || (*sPSSData->field_B04)->invisible) return FALSE; - if ((*gUnknown_02039D08->field_B04)->affineAnimEnded) - (*gUnknown_02039D08->field_B04)->invisible = TRUE; + if ((*sPSSData->field_B04)->affineAnimEnded) + (*sPSSData->field_B04)->invisible = TRUE; return TRUE; } static void sub_80CC020(void) { - if (*gUnknown_02039D08->field_B04 != NULL) + if (*sPSSData->field_B04 != NULL) { - FreeOamMatrix((*gUnknown_02039D08->field_B04)->oam.matrixNum); - DestroyBoxMonIcon(*gUnknown_02039D08->field_B04); - *gUnknown_02039D08->field_B04 = NULL; + FreeOamMatrix((*sPSSData->field_B04)->oam.matrixNum); + DestroyBoxMonIcon(*sPSSData->field_B04); + *sPSSData->field_B04 = NULL; } } static void sub_80CC064(void) { - if (*gUnknown_02039D08->field_B04 != NULL) + if (*sPSSData->field_B04 != NULL) { - (*gUnknown_02039D08->field_B04)->invisible = FALSE; - StartSpriteAffineAnim(*gUnknown_02039D08->field_B04, 1); + (*sPSSData->field_B04)->invisible = FALSE; + StartSpriteAffineAnim(*sPSSData->field_B04, 1); } } static bool8 sub_80CC0A0(void) { - if (gUnknown_02039D08->field_B04 == NULL) + if (sPSSData->field_B04 == NULL) return FALSE; - if ((*gUnknown_02039D08->field_B04)->affineAnimEnded) - gUnknown_02039D08->field_B04 = NULL; + if ((*sPSSData->field_B04)->affineAnimEnded) + sPSSData->field_B04 = NULL; return TRUE; } static void SetMovingMonPriority(u8 priority) { - gUnknown_02039D08->movingMonSprite->oam.priority = priority; + sPSSData->movingMonSprite->oam.priority = priority; } static void sub_80CC100(struct Sprite *sprite) { - sprite->pos1.x = gUnknown_02039D08->field_CB4->pos1.x; - sprite->pos1.y = gUnknown_02039D08->field_CB4->pos1.y + gUnknown_02039D08->field_CB4->pos2.y + 4; + 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) @@ -5118,7 +5098,7 @@ static u16 sub_80CC124(u16 species) for (i = 0; i < 40; i++) { - if (gUnknown_02039D08->field_B58[i] == species) + if (sPSSData->field_B58[i] == species) break; } @@ -5126,15 +5106,15 @@ static u16 sub_80CC124(u16 species) { for (i = 0; i < 40; i++) { - if (gUnknown_02039D08->field_B58[i] == 0) + if (sPSSData->field_B58[i] == 0) break; } if (i == 40) return 0xFFFF; } - gUnknown_02039D08->field_B58[i] = species; - gUnknown_02039D08->field_B08[i]++; + sPSSData->field_B58[i] = species; + sPSSData->field_B08[i]++; var = 16 * i; CpuCopy32(GetMonIconTiles(species, TRUE), (void*)(OBJ_VRAM0) + var * 32, 0x200); @@ -5147,10 +5127,10 @@ static void sub_80CC1E0(u16 species) for (i = 0; i < 40; i++) { - if (gUnknown_02039D08->field_B58[i] == species) + if (sPSSData->field_B58[i] == species) { - if (--gUnknown_02039D08->field_B08[i] == 0) - gUnknown_02039D08->field_B58[i] = 0; + if (--sPSSData->field_B08[i] == 0) + sPSSData->field_B58[i] = 0; break; } } @@ -5206,15 +5186,15 @@ static void sub_80CC370(u8 taskId) switch (task->data[0]) { case 0: - gUnknown_02039D08->field_2D2 = 0; - gUnknown_02039D08->bg2_X = 0; - task->data[1] = RequestDma3Fill(0, gUnknown_02039D08->field_4AC4, 0x1000, 1); + 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, gUnknown_02039D08->field_4AC4); + SetBgTilemapBuffer(2, sPSSData->field_4AC4); ShowBg(2); break; case 2: @@ -5244,44 +5224,44 @@ static void SetUpScrollToBox(u8 boxId) { s8 direction = sub_80CC644(boxId); - gUnknown_02039D08->field_2CE = (direction > 0) ? 6 : -6; - gUnknown_02039D08->field_2D3 = (direction > 0) ? 1 : 2; - gUnknown_02039D08->field_2D0 = 32; - gUnknown_02039D08->field_2D4 = boxId; - gUnknown_02039D08->field_2D6 = (direction <= 0) ? 5 : 0; - gUnknown_02039D08->field_2D8 = direction; - gUnknown_02039D08->field_2DA = (direction > 0) ? 264 : 56; - gUnknown_02039D08->field_2DC = (direction <= 0) ? 5 : 0; - gUnknown_02039D08->field_2DE = 0; - gUnknown_02039D08->field_2E0 = 2; - gUnknown_02039D08->field_A64 = boxId; - gUnknown_02039D08->field_A65 = direction; - gUnknown_02039D08->field_A63 = 0; + 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 (gUnknown_02039D08->field_A63) + switch (sPSSData->field_A63) { case 0: - LoadWallpaperGfx(gUnknown_02039D08->field_A64, gUnknown_02039D08->field_A65); - gUnknown_02039D08->field_A63++; + LoadWallpaperGfx(sPSSData->field_A64, sPSSData->field_A65); + sPSSData->field_A63++; case 1: if (!WaitForWallpaperGfxLoad()) return TRUE; - sub_80CB4CC(gUnknown_02039D08->field_A64, gUnknown_02039D08->field_A65); - sub_80CCCFC(gUnknown_02039D08->field_A64, gUnknown_02039D08->field_A65); - sub_80CD0B8(gUnknown_02039D08->field_A65); + 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 (gUnknown_02039D08->field_2D0 != 0) + if (sPSSData->field_2D0 != 0) { - gUnknown_02039D08->bg2_X += gUnknown_02039D08->field_2CE; - if (--gUnknown_02039D08->field_2D0 != 0) + sPSSData->bg2_X += sPSSData->field_2CE; + if (--sPSSData->field_2D0 != 0) return TRUE; sub_80CCEE0(); sub_80CD158(); @@ -5289,7 +5269,7 @@ static bool8 ScrollToBox(void) return var; } - gUnknown_02039D08->field_A63++; + sPSSData->field_A63++; return TRUE; } @@ -5312,36 +5292,36 @@ static void SetWallpaperForCurrentBox(u8 wallpaperId) { u8 boxId = StorageGetCurrentBox(); SetBoxWallpaper(boxId, wallpaperId); - gUnknown_02039D08->wallpaperChangeState = 0; + sPSSData->wallpaperChangeState = 0; } static bool8 DoWallpaperGfxChange(void) { - switch (gUnknown_02039D08->wallpaperChangeState) + switch (sPSSData->wallpaperChangeState) { case 0: - BeginNormalPaletteFade(gUnknown_02039D08->field_738, 1, 0, 16, RGB_WHITEALPHA); - gUnknown_02039D08->wallpaperChangeState++; + BeginNormalPaletteFade(sPSSData->field_738, 1, 0, 16, RGB_WHITEALPHA); + sPSSData->wallpaperChangeState++; break; case 1: if (!UpdatePaletteFade()) { u8 curBox = StorageGetCurrentBox(); LoadWallpaperGfx(curBox, 0); - gUnknown_02039D08->wallpaperChangeState++; + sPSSData->wallpaperChangeState++; } break; case 2: if (WaitForWallpaperGfxLoad() == TRUE) { sub_80CCF9C(); - BeginNormalPaletteFade(gUnknown_02039D08->field_738, 1, 16, 0, RGB_WHITEALPHA); - gUnknown_02039D08->wallpaperChangeState++; + BeginNormalPaletteFade(sPSSData->field_738, 1, 16, 0, RGB_WHITEALPHA); + sPSSData->wallpaperChangeState++; } break; case 3: if (!UpdatePaletteFade()) - gUnknown_02039D08->wallpaperChangeState++; + sPSSData->wallpaperChangeState++; break; case 4: return FALSE; @@ -5357,50 +5337,50 @@ static void LoadWallpaperGfx(u8 boxId, s8 direction) void *iconGfx; u32 size1, size2; - gUnknown_02039D08->field_6F9 = 0; - gUnknown_02039D08->field_6FA = boxId; - gUnknown_02039D08->field_6FB = direction; - if (gUnknown_02039D08->field_6FB != 0) + sPSSData->field_6F9 = 0; + sPSSData->field_6FA = boxId; + sPSSData->field_6FB = direction; + if (sPSSData->field_6FB != 0) { - gUnknown_02039D08->field_2D2 = (gUnknown_02039D08->field_2D2 == 0); - sub_80CCAE0(gUnknown_02039D08->field_4AC4); + sPSSData->field_2D2 = (sPSSData->field_2D2 == 0); + sub_80CCAE0(sPSSData->field_4AC4); } - wallpaperId = GetBoxWallpaper(gUnknown_02039D08->field_6FA); + wallpaperId = GetBoxWallpaper(sPSSData->field_6FA); if (wallpaperId != WALLPAPER_FRIENDS) { wallpaperGfx = &gWallpaperTable[wallpaperId]; - LZ77UnCompWram(wallpaperGfx->tileMap, gUnknown_02039D08->field_792); - sub_80CCA3C(gUnknown_02039D08->field_792, gUnknown_02039D08->field_6FB, gUnknown_02039D08->field_2D2); + LZ77UnCompWram(wallpaperGfx->tileMap, sPSSData->field_792); + sub_80CCA3C(sPSSData->field_792, sPSSData->field_6FB, sPSSData->field_2D2); - if (gUnknown_02039D08->field_6FB != 0) - LoadPalette(wallpaperGfx->palettes, (gUnknown_02039D08->field_2D2 * 32) + 0x40, 0x40); + if (sPSSData->field_6FB != 0) + LoadPalette(wallpaperGfx->palettes, (sPSSData->field_2D2 * 32) + 0x40, 0x40); else - CpuCopy16(wallpaperGfx->palettes, &gPlttBufferUnfaded[(gUnknown_02039D08->field_2D2 * 32) + 0x40], 0x40); + CpuCopy16(wallpaperGfx->palettes, &gPlttBufferUnfaded[(sPSSData->field_2D2 * 32) + 0x40], 0x40); - gUnknown_02039D08->wallpaperTiles = malloc_and_decompress(wallpaperGfx->tiles, &size1); - LoadBgTiles(2, gUnknown_02039D08->wallpaperTiles, size1, gUnknown_02039D08->field_2D2 << 8); + sPSSData->wallpaperTiles = malloc_and_decompress(wallpaperGfx->tiles, &size1); + LoadBgTiles(2, sPSSData->wallpaperTiles, size1, sPSSData->field_2D2 << 8); } else { wallpaperGfx = &gFriendsWallpaperTable[GetWaldaWallpaperPatternId()]; - LZ77UnCompWram(wallpaperGfx->tileMap, gUnknown_02039D08->field_792); - sub_80CCA3C(gUnknown_02039D08->field_792, gUnknown_02039D08->field_6FB, gUnknown_02039D08->field_2D2); + LZ77UnCompWram(wallpaperGfx->tileMap, sPSSData->field_792); + sub_80CCA3C(sPSSData->field_792, sPSSData->field_6FB, sPSSData->field_2D2); - CpuCopy16(wallpaperGfx->palettes, gUnknown_02039D08->field_792, 0x40); - CpuCopy16(GetWaldaWallpaperColorsPtr(), &gUnknown_02039D08->field_792[1], 4); - CpuCopy16(GetWaldaWallpaperColorsPtr(), &gUnknown_02039D08->field_792[17], 4); + CpuCopy16(wallpaperGfx->palettes, sPSSData->field_792, 0x40); + CpuCopy16(GetWaldaWallpaperColorsPtr(), &sPSSData->field_792[1], 4); + CpuCopy16(GetWaldaWallpaperColorsPtr(), &sPSSData->field_792[17], 4); - if (gUnknown_02039D08->field_6FB != 0) - LoadPalette(gUnknown_02039D08->field_792, (gUnknown_02039D08->field_2D2 * 32) + 0x40, 0x40); + if (sPSSData->field_6FB != 0) + LoadPalette(sPSSData->field_792, (sPSSData->field_2D2 * 32) + 0x40, 0x40); else - CpuCopy16(gUnknown_02039D08->field_792, &gPlttBufferUnfaded[(gUnknown_02039D08->field_2D2 * 32) + 0x40], 0x40); + CpuCopy16(sPSSData->field_792, &gPlttBufferUnfaded[(sPSSData->field_2D2 * 32) + 0x40], 0x40); - gUnknown_02039D08->wallpaperTiles = malloc_and_decompress(wallpaperGfx->tiles, &size1); + sPSSData->wallpaperTiles = malloc_and_decompress(wallpaperGfx->tiles, &size1); iconGfx = malloc_and_decompress(gFriendsIcons[GetWaldaWallpaperIconId()], &size2); - CpuCopy32(iconGfx, gUnknown_02039D08->wallpaperTiles + 0x800, size2); + CpuCopy32(iconGfx, sPSSData->wallpaperTiles + 0x800, size2); Free(iconGfx); - LoadBgTiles(2, gUnknown_02039D08->wallpaperTiles, size1, gUnknown_02039D08->field_2D2 << 8); + LoadBgTiles(2, sPSSData->wallpaperTiles, size1, sPSSData->field_2D2 << 8); } CopyBgTilemapBufferToVram(2); @@ -5411,10 +5391,10 @@ static bool32 WaitForWallpaperGfxLoad(void) if (IsDma3ManagerBusyWithBgCopy()) return FALSE; - if (gUnknown_02039D08->wallpaperTiles != NULL) + if (sPSSData->wallpaperTiles != NULL) { - Free(gUnknown_02039D08->wallpaperTiles); - gUnknown_02039D08->wallpaperTiles = NULL; + Free(sPSSData->wallpaperTiles); + sPSSData->wallpaperTiles = NULL; } return TRUE; } @@ -5422,7 +5402,7 @@ static bool32 WaitForWallpaperGfxLoad(void) static void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2) { s16 var = (arg2 * 2) + 3; - s16 x = ((gUnknown_02039D08->bg2_X / 8 + 10) + (direction * 24)) & 0x3F; + 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); @@ -5440,7 +5420,7 @@ static void sub_80CCAE0(void *arg0) { u16 i; u16 *dest = arg0; - s16 r3 = ((gUnknown_02039D08->bg2_X / 8) + 30) & 0x3F; + s16 r3 = ((sPSSData->bg2_X / 8) + 30) & 0x3F; if (r3 <= 31) dest += r3 + 0x260; @@ -5464,39 +5444,39 @@ static void sub_80CCB50(u8 boxId) s16 r6; u16 i; - struct SpriteSheet spriteSheet = {gUnknown_02039D08->field_2F8, 0x200, TAG_TILE_3}; + struct SpriteSheet spriteSheet = {sPSSData->field_2F8, 0x200, TAG_TILE_3}; struct SpritePalette palettes[] = { - {gUnknown_02039D08->field_6FC, TAG_PAL_DAC9}, + {sPSSData->field_6FC, TAG_PAL_DAC9}, {} }; u16 wallpaperId = GetBoxWallpaper(boxId); - gUnknown_02039D08->field_6FC[14] = gUnknown_08577574[wallpaperId][0]; - gUnknown_02039D08->field_6FC[15] = gUnknown_08577574[wallpaperId][1]; + sPSSData->field_6FC[14] = gUnknown_08577574[wallpaperId][0]; + sPSSData->field_6FC[15] = gUnknown_08577574[wallpaperId][1]; LoadSpritePalettes(palettes); - gUnknown_02039D08->field_738 = 0x3f0; + sPSSData->field_738 = 0x3f0; tagIndex = IndexOfSpritePaletteTag(TAG_PAL_DAC9); - gUnknown_02039D08->field_71C = 0x10e + 16 * tagIndex; - gUnknown_02039D08->field_738 |= 0x10000 << tagIndex; + sPSSData->field_71C = 0x10e + 16 * tagIndex; + sPSSData->field_738 |= 0x10000 << tagIndex; tagIndex = IndexOfSpritePaletteTag(TAG_PAL_DAC9); - gUnknown_02039D08->field_71E = 0x10e + 16 * tagIndex; - gUnknown_02039D08->field_738 |= 0x10000 << tagIndex; + sPSSData->field_71E = 0x10e + 16 * tagIndex; + sPSSData->field_738 |= 0x10000 << tagIndex; - StringCopyPadded(gUnknown_02039D08->field_21B8, GetBoxNamePtr(boxId), 0, 8); - sub_80C6D80(gUnknown_02039D08->field_21B8, gUnknown_02039D08->field_2F8, 0, 0, 2); + 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); - gUnknown_02039D08->field_720[i] = &gSprites[spriteId]; - StartSpriteAnim(gUnknown_02039D08->field_720[i], i); + sPSSData->field_720[i] = &gSprites[spriteId]; + StartSpriteAnim(sPSSData->field_720[i], i); } - gUnknown_02039D08->field_6F8 = 0; + sPSSData->field_6F8 = 0; } static void sub_80CCCFC(u8 boxId, s8 direction) @@ -5504,25 +5484,25 @@ static void sub_80CCCFC(u8 boxId, s8 direction) u16 r8; s16 x, x2; u16 i; - struct SpriteSheet spriteSheet = {gUnknown_02039D08->field_2F8, 0x200, TAG_TILE_3}; + struct SpriteSheet spriteSheet = {sPSSData->field_2F8, 0x200, TAG_TILE_3}; struct SpriteTemplate template = gSpriteTemplate_857B0A8; - gUnknown_02039D08->field_6F8 = (gUnknown_02039D08->field_6F8 == 0); - if (gUnknown_02039D08->field_6F8 == 0) + sPSSData->field_6F8 = (sPSSData->field_6F8 == 0); + if (sPSSData->field_6F8 == 0) { spriteSheet.tag = TAG_TILE_3; - r8 = gUnknown_02039D08->field_71C; + r8 = sPSSData->field_71C; } else { spriteSheet.tag = TAG_TILE_4; - r8 = gUnknown_02039D08->field_71C; + r8 = sPSSData->field_71C; template.tileTag = 4; template.paletteTag = TAG_PAL_DAC9; } - StringCopyPadded(gUnknown_02039D08->field_21B8, GetBoxNamePtr(boxId), 0, 8); - sub_80C6D80(gUnknown_02039D08->field_21B8, gUnknown_02039D08->field_2F8, 0, 0, 2); + 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)); @@ -5533,28 +5513,28 @@ static void sub_80CCCFC(u8 boxId, s8 direction) { u8 spriteId = CreateSprite(&template, i * 32 + x2, 28, 24); - gUnknown_02039D08->field_728[i] = &gSprites[spriteId]; - gUnknown_02039D08->field_728[i]->data[0] = (-direction) * 6; - gUnknown_02039D08->field_728[i]->data[1] = i * 32 + x; - gUnknown_02039D08->field_728[i]->data[2] = 0; - gUnknown_02039D08->field_728[i]->callback = sub_80CCF30; - StartSpriteAnim(gUnknown_02039D08->field_728[i], i); + 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); - gUnknown_02039D08->field_720[i]->data[0] = (-direction) * 6; - gUnknown_02039D08->field_720[i]->data[1] = 1; - gUnknown_02039D08->field_720[i]->callback = sub_80CCF64; + 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 (gUnknown_02039D08->field_6F8 == 0) + if (sPSSData->field_6F8 == 0) FreeSpriteTilesByTag(TAG_TILE_4); else FreeSpriteTilesByTag(TAG_TILE_3); - gUnknown_02039D08->field_720[0] = gUnknown_02039D08->field_728[0]; - gUnknown_02039D08->field_720[1] = gUnknown_02039D08->field_728[1]; + sPSSData->field_720[0] = sPSSData->field_728[0]; + sPSSData->field_720[1] = sPSSData->field_728[1]; } static void sub_80CCF30(struct Sprite *sprite) @@ -5584,10 +5564,10 @@ static void sub_80CCF9C(void) { u8 boxId = StorageGetCurrentBox(); u8 wallpaperId = GetBoxWallpaper(boxId); - if (gUnknown_02039D08->field_6F8 == 0) - CpuCopy16(gUnknown_08577574[wallpaperId], gPlttBufferUnfaded + gUnknown_02039D08->field_71C, 4); + if (sPSSData->field_6F8 == 0) + CpuCopy16(gUnknown_08577574[wallpaperId], gPlttBufferUnfaded + sPSSData->field_71C, 4); else - CpuCopy16(gUnknown_08577574[wallpaperId], gPlttBufferUnfaded + gUnknown_02039D08->field_71E, 4); + CpuCopy16(gUnknown_08577574[wallpaperId], gPlttBufferUnfaded + sPSSData->field_71E, 4); } static s16 sub_80CD00C(const u8 *string) @@ -5608,7 +5588,7 @@ static void sub_80CD02C(void) struct Sprite *sprite = &gSprites[spriteId]; StartSpriteAnim(sprite, i); sprite->data[3] = (i == 0) ? -1 : 1; - gUnknown_02039D08->field_730[i] = sprite; + sPSSData->field_730[i] = sprite; } } if (IsCursorOnBox()) @@ -5621,25 +5601,25 @@ static void sub_80CD0B8(s8 direction) for (i = 0; i < 2; i++) { - gUnknown_02039D08->field_730[i]->pos2.x = 0; - gUnknown_02039D08->field_730[i]->data[0] = 2; + sPSSData->field_730[i]->pos2.x = 0; + sPSSData->field_730[i]->data[0] = 2; } if (direction < 0) { - gUnknown_02039D08->field_730[0]->data[1] = 29; - gUnknown_02039D08->field_730[1]->data[1] = 5; - gUnknown_02039D08->field_730[0]->data[2] = 0x48; - gUnknown_02039D08->field_730[1]->data[2] = 0x48; + 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 { - gUnknown_02039D08->field_730[0]->data[1] = 5; - gUnknown_02039D08->field_730[1]->data[1] = 29; - gUnknown_02039D08->field_730[0]->data[2] = 0xF8; - gUnknown_02039D08->field_730[1]->data[2] = 0xF8; + 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; } - gUnknown_02039D08->field_730[0]->data[7] = 0; - gUnknown_02039D08->field_730[1]->data[7] = 1; + sPSSData->field_730[0]->data[7] = 0; + sPSSData->field_730[1]->data[7] = 1; } static void sub_80CD158(void) @@ -5648,9 +5628,9 @@ static void sub_80CD158(void) for (i = 0; i < 2; i++) { - gUnknown_02039D08->field_730[i]->pos1.x = 0x88 * i + 0x5c; - gUnknown_02039D08->field_730[i]->pos2.x = 0; - gUnknown_02039D08->field_730[i]->invisible = FALSE; + 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); } @@ -5663,17 +5643,17 @@ static void sub_80CD1A8(bool8 a0) { for (i = 0; i < 2; i++) { - gUnknown_02039D08->field_730[i]->data[0] = 1; - gUnknown_02039D08->field_730[i]->data[1] = 0; - gUnknown_02039D08->field_730[i]->data[2] = 0; - gUnknown_02039D08->field_730[i]->data[4] = 0; + 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++) { - gUnknown_02039D08->field_730[i]->data[0] = 0; + sPSSData->field_730[i]->data[0] = 0; } } } @@ -5701,7 +5681,7 @@ static void sub_80CD210(struct Sprite *sprite) sprite->data[0] = 3; break; case 3: - sprite->pos1.x -= gUnknown_02039D08->field_2CE; + sprite->pos1.x -= sPSSData->field_2CE; if (sprite->pos1.x < 0x49 || sprite->pos1.x > 0xf7) sprite->invisible = TRUE; if (--sprite->data[1] == 0) @@ -5712,7 +5692,7 @@ static void sub_80CD210(struct Sprite *sprite) } break; case 4: - sprite->pos1.x -= gUnknown_02039D08->field_2CE; + sprite->pos1.x -= sPSSData->field_2CE; break; } } @@ -5732,7 +5712,7 @@ static struct Sprite *sub_80CD2E8(u16 x, u16 y, u8 animId, u8 priority, u8 subpr static void sub_80CD36C(void) { - if (gUnknown_02039D08->boxOption != BOX_OPTION_DEPOSIT) + if (sPSSData->boxOption != BOX_OPTION_DEPOSIT) sBoxCursorArea = CURSOR_AREA_IN_BOX; else sBoxCursorArea = CURSOR_AREA_IN_PARTY; @@ -5744,8 +5724,8 @@ static void sub_80CD36C(void) sCanOnlyMove = FALSE; sub_80CDC0C(); sub_80CFC14(); - gUnknown_02039D08->field_CD6 = 1; - gUnknown_02039D08->inBoxMovingMode = 0; + sPSSData->field_CD6 = 1; + sPSSData->inBoxMovingMode = 0; sub_80CEB40(); } @@ -5753,11 +5733,11 @@ static void sub_80CD3EC(void) { sub_80CFC14(); sub_80CEBDC(); - gUnknown_02039D08->field_CD6 = 1; - gUnknown_02039D08->inBoxMovingMode = 0; + sPSSData->field_CD6 = 1; + sPSSData->inBoxMovingMode = 0; if (sIsMonBeingMoved) { - gUnknown_02039D08->movingMon = gUnknown_02039D14; + sPSSData->movingMon = gUnknown_02039D14; CreateMovingMonIcon(); } } @@ -5819,46 +5799,46 @@ static bool8 sub_80CD554(void) { s16 tmp; - if (gUnknown_02039D08->field_CD0 == 0) + if (sPSSData->field_CD0 == 0) { - if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) return FALSE; else return sub_80D1218(); } - else if (--gUnknown_02039D08->field_CD0 != 0) + else if (--sPSSData->field_CD0 != 0) { - gUnknown_02039D08->field_CBC += gUnknown_02039D08->field_CC4; - gUnknown_02039D08->field_CC0 += gUnknown_02039D08->field_CC8; - gUnknown_02039D08->field_CB4->pos1.x = gUnknown_02039D08->field_CBC >> 8; - gUnknown_02039D08->field_CB4->pos1.y = gUnknown_02039D08->field_CC0 >> 8; - if (gUnknown_02039D08->field_CB4->pos1.x > 0x100) + 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 = gUnknown_02039D08->field_CB4->pos1.x - 0x100; - gUnknown_02039D08->field_CB4->pos1.x = tmp + 0x40; + tmp = sPSSData->field_CB4->pos1.x - 0x100; + sPSSData->field_CB4->pos1.x = tmp + 0x40; } - if (gUnknown_02039D08->field_CB4->pos1.x < 0x40) + if (sPSSData->field_CB4->pos1.x < 0x40) { - tmp = 0x40 - gUnknown_02039D08->field_CB4->pos1.x; - gUnknown_02039D08->field_CB4->pos1.x = 0x100 - tmp; + tmp = 0x40 - sPSSData->field_CB4->pos1.x; + sPSSData->field_CB4->pos1.x = 0x100 - tmp; } - if (gUnknown_02039D08->field_CB4->pos1.y > 0xb0) + if (sPSSData->field_CB4->pos1.y > 0xb0) { - tmp = gUnknown_02039D08->field_CB4->pos1.y - 0xb0; - gUnknown_02039D08->field_CB4->pos1.y = tmp - 0x10; + tmp = sPSSData->field_CB4->pos1.y - 0xb0; + sPSSData->field_CB4->pos1.y = tmp - 0x10; } - if (gUnknown_02039D08->field_CB4->pos1.y < -0x10) + if (sPSSData->field_CB4->pos1.y < -0x10) { - tmp = -0x10 - gUnknown_02039D08->field_CB4->pos1.y; - gUnknown_02039D08->field_CB4->pos1.y = 0xb0 - tmp; + tmp = -0x10 - sPSSData->field_CB4->pos1.y; + sPSSData->field_CB4->pos1.y = 0xb0 - tmp; } - if (gUnknown_02039D08->field_CD7 && --gUnknown_02039D08->field_CD7 == 0) - gUnknown_02039D08->field_CB4->vFlip = (gUnknown_02039D08->field_CB4->vFlip == FALSE); + if (sPSSData->field_CD7 && --sPSSData->field_CD7 == 0) + sPSSData->field_CB4->vFlip = (sPSSData->field_CB4->vFlip == FALSE); } else { - gUnknown_02039D08->field_CB4->pos1.x = gUnknown_02039D08->field_CCC; - gUnknown_02039D08->field_CB4->pos1.y = gUnknown_02039D08->field_CCE; + sPSSData->field_CB4->pos1.x = sPSSData->field_CCC; + sPSSData->field_CB4->pos1.y = sPSSData->field_CCE; sub_80CDA68(); } @@ -5870,74 +5850,74 @@ static void sub_80CD6AC(u8 newCurosrArea, u8 newCursorPosition) u16 x, y; sub_80CD444(newCurosrArea, newCursorPosition, &x, &y); - gUnknown_02039D08->field_CD4 = newCurosrArea; - gUnknown_02039D08->field_CD5 = newCursorPosition; - gUnknown_02039D08->field_CCC = x; - gUnknown_02039D08->field_CCE = 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 (gUnknown_02039D08->field_CD2 != 0 || gUnknown_02039D08->field_CD3 != 0) - gUnknown_02039D08->field_CD0 = 12; + if (sPSSData->field_CD2 != 0 || sPSSData->field_CD3 != 0) + sPSSData->field_CD0 = 12; else - gUnknown_02039D08->field_CD0 = 6; + sPSSData->field_CD0 = 6; - if (gUnknown_02039D08->field_CD7) - gUnknown_02039D08->field_CD7 = gUnknown_02039D08->field_CD0 >> 1; + if (sPSSData->field_CD7) + sPSSData->field_CD7 = sPSSData->field_CD0 >> 1; - switch (gUnknown_02039D08->field_CD2) + switch (sPSSData->field_CD2) { default: - r7 = gUnknown_02039D08->field_CCE - gUnknown_02039D08->field_CB4->pos1.y; + r7 = sPSSData->field_CCE - sPSSData->field_CB4->pos1.y; break; case -1: - r7 = gUnknown_02039D08->field_CCE - 0xc0 - gUnknown_02039D08->field_CB4->pos1.y; + r7 = sPSSData->field_CCE - 0xc0 - sPSSData->field_CB4->pos1.y; break; case 1: - r7 = gUnknown_02039D08->field_CCE + 0xc0 - gUnknown_02039D08->field_CB4->pos1.y; + r7 = sPSSData->field_CCE + 0xc0 - sPSSData->field_CB4->pos1.y; break; } - switch (gUnknown_02039D08->field_CD3) + switch (sPSSData->field_CD3) { default: - r0 = gUnknown_02039D08->field_CCC - gUnknown_02039D08->field_CB4->pos1.x; + r0 = sPSSData->field_CCC - sPSSData->field_CB4->pos1.x; break; case -1: - r0 = gUnknown_02039D08->field_CCC - 0xc0 - gUnknown_02039D08->field_CB4->pos1.x; + r0 = sPSSData->field_CCC - 0xc0 - sPSSData->field_CB4->pos1.x; break; case 1: - r0 = gUnknown_02039D08->field_CCC + 0xc0 - gUnknown_02039D08->field_CB4->pos1.x; + r0 = sPSSData->field_CCC + 0xc0 - sPSSData->field_CB4->pos1.x; break; } r7 <<= 8; r0 <<= 8; - gUnknown_02039D08->field_CC4 = r0 / gUnknown_02039D08->field_CD0; - gUnknown_02039D08->field_CC8 = r7 / gUnknown_02039D08->field_CD0; - gUnknown_02039D08->field_CBC = gUnknown_02039D08->field_CB4->pos1.x << 8; - gUnknown_02039D08->field_CC0 = gUnknown_02039D08->field_CB4->pos1.y << 8; + 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 (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) { - if (gUnknown_02039D08->inBoxMovingMode == 0 && !sIsMonBeingMoved) - StartSpriteAnim(gUnknown_02039D08->field_CB4, 1); + if (sPSSData->inBoxMovingMode == 0 && !sIsMonBeingMoved) + StartSpriteAnim(sPSSData->field_CB4, 1); } else { if (!IsActiveItemMoving()) - StartSpriteAnim(gUnknown_02039D08->field_CB4, 1); + StartSpriteAnim(sPSSData->field_CB4, 1); } - if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) { if (sBoxCursorArea == CURSOR_AREA_IN_BOX) sub_80D0E50(CURSOR_AREA_IN_BOX, sBoxCursorPosition); @@ -5952,8 +5932,8 @@ static void sub_80CD894(u8 newCurosrArea, u8 newCursorPosition) if (newCurosrArea == CURSOR_AREA_IN_PARTY && sBoxCursorArea != CURSOR_AREA_IN_PARTY) { - gUnknown_02039D08->field_CD6 = newCurosrArea; - gUnknown_02039D08->field_CB8->invisible = TRUE; + sPSSData->field_CD6 = newCurosrArea; + sPSSData->field_CB8->invisible = TRUE; } switch (newCurosrArea) @@ -5961,19 +5941,19 @@ static void sub_80CD894(u8 newCurosrArea, u8 newCursorPosition) case CURSOR_AREA_IN_PARTY: case CURSOR_AREA_BOX: case CURSOR_AREA_BUTTONS: - gUnknown_02039D08->field_CB4->oam.priority = 1; - gUnknown_02039D08->field_CB8->invisible = TRUE; - gUnknown_02039D08->field_CB8->oam.priority = 1; + sPSSData->field_CB4->oam.priority = 1; + sPSSData->field_CB8->invisible = TRUE; + sPSSData->field_CB8->oam.priority = 1; break; case CURSOR_AREA_IN_BOX: - if (gUnknown_02039D08->inBoxMovingMode != 0) + if (sPSSData->inBoxMovingMode != 0) { - gUnknown_02039D08->field_CB4->oam.priority = 0; - gUnknown_02039D08->field_CB8->invisible = TRUE; + sPSSData->field_CB4->oam.priority = 0; + sPSSData->field_CB8->invisible = TRUE; } else { - gUnknown_02039D08->field_CB4->oam.priority = 2; + sPSSData->field_CB4->oam.priority = 2; if (sBoxCursorArea == CURSOR_AREA_IN_BOX && sIsMonBeingMoved) SetMovingMonPriority(2); } @@ -5983,17 +5963,17 @@ static void sub_80CD894(u8 newCurosrArea, u8 newCursorPosition) static void sub_80CDA68(void) { - sBoxCursorArea = gUnknown_02039D08->field_CD4; - sBoxCursorPosition = gUnknown_02039D08->field_CD5; - if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + sBoxCursorArea = sPSSData->field_CD4; + sBoxCursorPosition = sPSSData->field_CD5; + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) { - if (gUnknown_02039D08->inBoxMovingMode == 0 && !sIsMonBeingMoved) - StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); + if (sPSSData->inBoxMovingMode == 0 && !sIsMonBeingMoved) + StartSpriteAnim(sPSSData->field_CB4, 0); } else { if (!IsActiveItemMoving()) - StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); + StartSpriteAnim(sPSSData->field_CB4, 0); } sub_80CEB40(); @@ -6006,16 +5986,16 @@ static void sub_80CDA68(void) sub_80CD1A8(TRUE); break; case CURSOR_AREA_IN_PARTY: - gUnknown_02039D08->field_CB8->subpriority = 13; + sPSSData->field_CB8->subpriority = 13; SetMovingMonPriority(1); break; case CURSOR_AREA_IN_BOX: - if (gUnknown_02039D08->inBoxMovingMode == 0) + if (sPSSData->inBoxMovingMode == 0) { - gUnknown_02039D08->field_CB4->oam.priority = 1; - gUnknown_02039D08->field_CB8->oam.priority = 2; - gUnknown_02039D08->field_CB8->subpriority = 21; - gUnknown_02039D08->field_CB8->invisible = FALSE; + 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; @@ -6036,8 +6016,8 @@ static void sub_80CDBA0(void) if (partyCount >= PARTY_SIZE) partyCount = PARTY_SIZE - 1; } - if (gUnknown_02039D08->field_CB4->vFlip) - gUnknown_02039D08->field_CD7 = 1; + if (sPSSData->field_CB4->vFlip) + sPSSData->field_CD7 = 1; sub_80CD894(CURSOR_AREA_IN_PARTY, partyCount); } @@ -6046,6 +6026,8 @@ 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; @@ -6070,46 +6052,46 @@ static void InitMonPlaceChange(u8 a0) MonPlaceChange_Shift, }; - gUnknown_02039D08->monPlaceChangeFunc = placeChangeFuncs[a0]; - gUnknown_02039D08->monPlaceChangeState = 0; + sPSSData->monPlaceChangeFunc = placeChangeFuncs[a0]; + sPSSData->monPlaceChangeState = 0; } static void sub_80CDC64(bool8 arg0) { if (!arg0) - gUnknown_02039D08->monPlaceChangeFunc = sub_80CDEB4; + sPSSData->monPlaceChangeFunc = sub_80CDEB4; else - gUnknown_02039D08->monPlaceChangeFunc = sub_80CDEC4; + sPSSData->monPlaceChangeFunc = sub_80CDEC4; - gUnknown_02039D08->monPlaceChangeState = 0; + sPSSData->monPlaceChangeState = 0; } static bool8 DoMonPlaceChange(void) { - return gUnknown_02039D08->monPlaceChangeFunc(); + return sPSSData->monPlaceChangeFunc(); } static bool8 MonPlaceChange_Move(void) { - switch (gUnknown_02039D08->monPlaceChangeState) + switch (sPSSData->monPlaceChangeState) { case 0: if (sIsMonBeingMoved) return FALSE; - StartSpriteAnim(gUnknown_02039D08->field_CB4, 2); - gUnknown_02039D08->monPlaceChangeState++; + StartSpriteAnim(sPSSData->field_CB4, 2); + sPSSData->monPlaceChangeState++; break; case 1: if (!sub_80CDED4()) { - StartSpriteAnim(gUnknown_02039D08->field_CB4, 3); + StartSpriteAnim(sPSSData->field_CB4, 3); MoveMon(); - gUnknown_02039D08->monPlaceChangeState++; + sPSSData->monPlaceChangeState++; } break; case 2: if (!sub_80CDF08()) - gUnknown_02039D08->monPlaceChangeState++; + sPSSData->monPlaceChangeState++; break; case 3: return FALSE; @@ -6120,21 +6102,21 @@ static bool8 MonPlaceChange_Move(void) static bool8 MonPlaceChange_Place(void) { - switch (gUnknown_02039D08->monPlaceChangeState) + switch (sPSSData->monPlaceChangeState) { case 0: if (!sub_80CDED4()) { - StartSpriteAnim(gUnknown_02039D08->field_CB4, 2); + StartSpriteAnim(sPSSData->field_CB4, 2); PlaceMon(); - gUnknown_02039D08->monPlaceChangeState++; + sPSSData->monPlaceChangeState++; } break; case 1: if (!sub_80CDF08()) { - StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); - gUnknown_02039D08->monPlaceChangeState++; + StartSpriteAnim(sPSSData->field_CB4, 0); + sPSSData->monPlaceChangeState++; } break; case 2: @@ -6146,30 +6128,30 @@ static bool8 MonPlaceChange_Place(void) static bool8 MonPlaceChange_Shift(void) { - switch (gUnknown_02039D08->monPlaceChangeState) + switch (sPSSData->monPlaceChangeState) { case 0: switch (sBoxCursorArea) { case CURSOR_AREA_IN_PARTY: - gUnknown_02039D08->field_D91 = TOTAL_BOXES_COUNT; + sPSSData->field_D91 = TOTAL_BOXES_COUNT; break; case CURSOR_AREA_IN_BOX: - gUnknown_02039D08->field_D91 = StorageGetCurrentBox(); + sPSSData->field_D91 = StorageGetCurrentBox(); break; default: return FALSE; } - StartSpriteAnim(gUnknown_02039D08->field_CB4, 2); - sub_80CBD5C(gUnknown_02039D08->field_D91, sBoxCursorPosition); - gUnknown_02039D08->monPlaceChangeState++; + StartSpriteAnim(sPSSData->field_CB4, 2); + sub_80CBD5C(sPSSData->field_D91, sBoxCursorPosition); + sPSSData->monPlaceChangeState++; break; case 1: if (!sub_80CBDC4()) { - StartSpriteAnim(gUnknown_02039D08->field_CB4, 3); - SetShiftedMonData(gUnknown_02039D08->field_D91, sBoxCursorPosition); - gUnknown_02039D08->monPlaceChangeState++; + StartSpriteAnim(sPSSData->field_CB4, 3); + SetShiftedMonData(sPSSData->field_D91, sBoxCursorPosition); + sPSSData->monPlaceChangeState++; } break; case 2: @@ -6191,13 +6173,13 @@ static bool8 sub_80CDEC4(void) static bool8 sub_80CDED4(void) { - switch (gUnknown_02039D08->field_CB4->pos2.y) + switch (sPSSData->field_CB4->pos2.y) { default: - gUnknown_02039D08->field_CB4->pos2.y++; + sPSSData->field_CB4->pos2.y++; break; case 0: - gUnknown_02039D08->field_CB4->pos2.y++; + sPSSData->field_CB4->pos2.y++; break; case 8: return FALSE; @@ -6208,12 +6190,12 @@ static bool8 sub_80CDED4(void) static bool8 sub_80CDF08(void) { - switch (gUnknown_02039D08->field_CB4->pos2.y) + switch (sPSSData->field_CB4->pos2.y) { case 0: return FALSE; default: - gUnknown_02039D08->field_CB4->pos2.y--; + sPSSData->field_CB4->pos2.y--; break; } @@ -6229,7 +6211,7 @@ static void MoveMon(void) sub_80CBC14(MODE_PARTY, sBoxCursorPosition); break; case CURSOR_AREA_IN_BOX: - if (gUnknown_02039D08->inBoxMovingMode == 0) + if (sPSSData->inBoxMovingMode == 0) { SetMovedMonData(StorageGetCurrentBox(), sBoxCursorPosition); sub_80CBC14(MODE_BOX, sBoxCursorPosition); @@ -6272,9 +6254,9 @@ static void sub_80CE00C(void) static void SetMovedMonData(u8 boxId, u8 position) { if (boxId == TOTAL_BOXES_COUNT) - gUnknown_02039D08->movingMon = gPlayerParty[sBoxCursorPosition]; + sPSSData->movingMon = gPlayerParty[sBoxCursorPosition]; else - BoxMonAtToMon(boxId, position, &gUnknown_02039D08->movingMon); + BoxMonAtToMon(boxId, position, &sPSSData->movingMon); PurgeMonOrBoxMon(boxId, position); sMovingMonOrigBoxId = boxId; @@ -6285,12 +6267,12 @@ static void SetPlacedMonData(u8 boxId, u8 position) { if (boxId == TOTAL_BOXES_COUNT) { - gPlayerParty[position] = gUnknown_02039D08->movingMon; + gPlayerParty[position] = sPSSData->movingMon; } else { - BoxMonRestorePP(&gUnknown_02039D08->movingMon.box); - SetBoxMonAt(boxId, position, &gUnknown_02039D08->movingMon.box); + BoxMonRestorePP(&sPSSData->movingMon.box); + SetBoxMonAt(boxId, position, &sPSSData->movingMon.box); } } @@ -6305,13 +6287,13 @@ static void PurgeMonOrBoxMon(u8 boxId, u8 position) static void SetShiftedMonData(u8 boxId, u8 position) { if (boxId == TOTAL_BOXES_COUNT) - gUnknown_02039D08->field_2108 = gPlayerParty[position]; + sPSSData->field_2108 = gPlayerParty[position]; else - BoxMonAtToMon(boxId, position, &gUnknown_02039D08->field_2108); + BoxMonAtToMon(boxId, position, &sPSSData->field_2108); SetPlacedMonData(boxId, position); - gUnknown_02039D08->movingMon = gUnknown_02039D08->field_2108; - SetCursorMonData(&gUnknown_02039D08->movingMon, MODE_PARTY); + sPSSData->movingMon = sPSSData->field_2108; + SetCursorMonData(&sPSSData->movingMon, MODE_PARTY); sMovingMonOrigBoxId = boxId; sMovingMonOrigBoxPos = position; } @@ -6338,13 +6320,13 @@ static bool8 TryStorePartyMonInBox(u8 boxId) if (boxId == StorageGetCurrentBox()) sub_80CB140(boxPosition); - StartSpriteAnim(gUnknown_02039D08->field_CB4, 1); + StartSpriteAnim(sPSSData->field_CB4, 1); return TRUE; } static void sub_80CE22C(void) { - StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); + StartSpriteAnim(sPSSData->field_CB4, 0); sub_80CEB40(); } @@ -6360,14 +6342,14 @@ static void sub_80CE250(void) mode = MODE_BOX; sub_80CBF14(mode, sBoxCursorPosition); - StringCopy(gUnknown_02039D08->field_21E0, gUnknown_02039D08->cursorMonNick); + StringCopy(sPSSData->field_21E0, sPSSData->cursorMonNick); } static bool8 sub_80CE2A8(void) { if (!sub_80CBFD8()) { - StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); + StartSpriteAnim(sPSSData->field_CB4, 0); return FALSE; } else @@ -6400,7 +6382,7 @@ static void ReleaseMon(void) static void sub_80CE324(void) { if (sIsMonBeingMoved) - StartSpriteAnim(gUnknown_02039D08->field_CB4, 3); + StartSpriteAnim(sPSSData->field_CB4, 3); } struct @@ -6439,45 +6421,45 @@ static void InitCanRelaseMonVars(void) { if (!AtLeastThreeUsableMons()) { - gUnknown_02039D08->field_216D = 1; - gUnknown_02039D08->field_216C = 0; + sPSSData->field_216D = 1; + sPSSData->field_216C = 0; return; } if (sIsMonBeingMoved) { - gUnknown_02039D08->field_2108 = gUnknown_02039D08->movingMon; - gUnknown_02039D08->field_2170 = -1; - gUnknown_02039D08->field_2171 = -1; + sPSSData->field_2108 = sPSSData->movingMon; + sPSSData->field_2170 = -1; + sPSSData->field_2171 = -1; } else { if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) { - gUnknown_02039D08->field_2108 = gPlayerParty[sBoxCursorPosition]; - gUnknown_02039D08->field_2170 = TOTAL_BOXES_COUNT; + sPSSData->field_2108 = gPlayerParty[sBoxCursorPosition]; + sPSSData->field_2170 = TOTAL_BOXES_COUNT; } else { - BoxMonAtToMon(StorageGetCurrentBox(), sBoxCursorPosition, &gUnknown_02039D08->field_2108); - gUnknown_02039D08->field_2170 = StorageGetCurrentBox(); + BoxMonAtToMon(StorageGetCurrentBox(), sBoxCursorPosition, &sPSSData->field_2108); + sPSSData->field_2170 = StorageGetCurrentBox(); } - gUnknown_02039D08->field_2171 = sBoxCursorPosition; + sPSSData->field_2171 = sBoxCursorPosition; } - sub_80CE350(gUnknown_02039D08->field_2176); - gUnknown_02039D08->field_2174 = GetMonData(&gUnknown_02039D08->field_2108, MON_DATA_KNOWN_MOVES, gUnknown_02039D08->field_2176); - if (gUnknown_02039D08->field_2174 != 0) + sub_80CE350(sPSSData->field_2176); + sPSSData->field_2174 = GetMonData(&sPSSData->field_2108, MON_DATA_KNOWN_MOVES, sPSSData->field_2176); + if (sPSSData->field_2174 != 0) { - gUnknown_02039D08->field_216D = 0; + sPSSData->field_216D = 0; } else { - gUnknown_02039D08->field_216D = 1; - gUnknown_02039D08->field_216C = 1; + sPSSData->field_216D = 1; + sPSSData->field_216C = 1; } - gUnknown_02039D08->field_2172 = 0; + sPSSData->field_2172 = 0; } static bool32 AtLeastThreeUsableMons(void) @@ -6514,54 +6496,54 @@ static s8 RunCanReleaseMon(void) u16 i; u16 knownMoves; - if (gUnknown_02039D08->field_216D) - return gUnknown_02039D08->field_216C; + if (sPSSData->field_216D) + return sPSSData->field_216C; - switch (gUnknown_02039D08->field_2172) + switch (sPSSData->field_2172) { case 0: for (i = 0; i < PARTY_SIZE; i++) { - if (gUnknown_02039D08->field_2170 != TOTAL_BOXES_COUNT || gUnknown_02039D08->field_2171 != i) + if (sPSSData->field_2170 != TOTAL_BOXES_COUNT || sPSSData->field_2171 != i) { - knownMoves = GetMonData(gPlayerParty + i, MON_DATA_KNOWN_MOVES, gUnknown_02039D08->field_2176); - gUnknown_02039D08->field_2174 &= ~(knownMoves); + knownMoves = GetMonData(gPlayerParty + i, MON_DATA_KNOWN_MOVES, sPSSData->field_2176); + sPSSData->field_2174 &= ~(knownMoves); } } - if (gUnknown_02039D08->field_2174 == 0) + if (sPSSData->field_2174 == 0) { - gUnknown_02039D08->field_216D = 1; - gUnknown_02039D08->field_216C = 1; + sPSSData->field_216D = 1; + sPSSData->field_216C = 1; } else { - gUnknown_02039D08->field_216E = 0; - gUnknown_02039D08->field_216F = 0; - gUnknown_02039D08->field_2172++; + sPSSData->field_216E = 0; + sPSSData->field_216F = 0; + sPSSData->field_2172++; } break; case 1: for (i = 0; i < IN_BOX_COUNT; i++) { - knownMoves = GetAndCopyBoxMonDataAt(gUnknown_02039D08->field_216E, gUnknown_02039D08->field_216F, MON_DATA_KNOWN_MOVES, gUnknown_02039D08->field_2176); + knownMoves = GetAndCopyBoxMonDataAt(sPSSData->field_216E, sPSSData->field_216F, MON_DATA_KNOWN_MOVES, sPSSData->field_2176); if (knownMoves != 0 - && !(gUnknown_02039D08->field_2170 == gUnknown_02039D08->field_216E && gUnknown_02039D08->field_2171 == gUnknown_02039D08->field_216F)) + && !(sPSSData->field_2170 == sPSSData->field_216E && sPSSData->field_2171 == sPSSData->field_216F)) { - gUnknown_02039D08->field_2174 &= ~(knownMoves); - if (gUnknown_02039D08->field_2174 == 0) + sPSSData->field_2174 &= ~(knownMoves); + if (sPSSData->field_2174 == 0) { - gUnknown_02039D08->field_216D = 1; - gUnknown_02039D08->field_216C = 1; + sPSSData->field_216D = 1; + sPSSData->field_216C = 1; break; } } - if (++gUnknown_02039D08->field_216F >= IN_BOX_COUNT) + if (++sPSSData->field_216F >= IN_BOX_COUNT) { - gUnknown_02039D08->field_216F = 0; - if (++gUnknown_02039D08->field_216E >= TOTAL_BOXES_COUNT) + sPSSData->field_216F = 0; + if (++sPSSData->field_216E >= TOTAL_BOXES_COUNT) { - gUnknown_02039D08->field_216D = 1; - gUnknown_02039D08->field_216C = 0; + sPSSData->field_216D = 1; + sPSSData->field_216C = 0; } } } @@ -6574,7 +6556,7 @@ static s8 RunCanReleaseMon(void) static void sub_80CE760(void) { if (sIsMonBeingMoved) - gUnknown_02039D14 = gUnknown_02039D08->movingMon; + gUnknown_02039D14 = sPSSData->movingMon; } static void sub_80CE790(void) @@ -6582,9 +6564,9 @@ static void sub_80CE790(void) if (sIsMonBeingMoved) { if (sMovingMonOrigBoxId == TOTAL_BOXES_COUNT) - gUnknown_02039D08->movingMon = gUnknown_02039D14; + sPSSData->movingMon = gUnknown_02039D14; else - gUnknown_02039D08->movingMon.box = gUnknown_02039D14.box; + sPSSData->movingMon.box = gUnknown_02039D14.box; } } @@ -6593,24 +6575,24 @@ static void sub_80CE7E8(void) if (sIsMonBeingMoved) { sub_80CE760(); - gUnknown_02039D08->field_218C.mon = &gUnknown_02039D14; - gUnknown_02039D08->field_2187 = 0; - gUnknown_02039D08->field_2186 = 0; - gUnknown_02039D08->field_2188 = 0; + 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) { - gUnknown_02039D08->field_218C.mon = gPlayerParty; - gUnknown_02039D08->field_2187 = sBoxCursorPosition; - gUnknown_02039D08->field_2186 = CountPartyMons() - 1; - gUnknown_02039D08->field_2188 = 0; + sPSSData->field_218C.mon = gPlayerParty; + sPSSData->field_2187 = sBoxCursorPosition; + sPSSData->field_2186 = CountPartyMons() - 1; + sPSSData->field_2188 = 0; } else { - gUnknown_02039D08->field_218C.box = GetBoxedMonPtr(StorageGetCurrentBox(), 0); - gUnknown_02039D08->field_2187 = sBoxCursorPosition; - gUnknown_02039D08->field_2186 = IN_BOX_COUNT - 1; - gUnknown_02039D08->field_2188 = 2; + sPSSData->field_218C.box = GetBoxedMonPtr(StorageGetCurrentBox(), 0); + sPSSData->field_2187 = sBoxCursorPosition; + sPSSData->field_2186 = IN_BOX_COUNT - 1; + sPSSData->field_2188 = 2; } } @@ -6647,10 +6629,10 @@ s16 CompactPartySlots(void) static void SetMonMarkings(u8 markings) { - gUnknown_02039D08->cursorMonMarkings = markings; + sPSSData->cursorMonMarkings = markings; if (sIsMonBeingMoved) { - SetMonData(&gUnknown_02039D08->movingMon, MON_DATA_MARKINGS, &markings); + SetMonData(&sPSSData->movingMon, MON_DATA_MARKINGS, &markings); } else { @@ -6675,7 +6657,7 @@ static bool8 CanShifMon(void) { if (sBoxCursorArea == CURSOR_AREA_IN_PARTY && CountPartyAliveNonEggMonsExcept(sBoxCursorPosition) == 0) { - if (gUnknown_02039D08->cursorMonIsEgg || GetMonData(&gUnknown_02039D08->movingMon, MON_DATA_HP) == 0) + if (sPSSData->cursorMonIsEgg || GetMonData(&sPSSData->movingMon, MON_DATA_HP) == 0) return FALSE; } return TRUE; @@ -6705,7 +6687,7 @@ static bool8 IsCursorInBox(void) static void sub_80CEB40(void) { - gUnknown_02039D08->field_CEA = (sIsMonBeingMoved == FALSE); + sPSSData->setMosaic = (sIsMonBeingMoved == FALSE); if (!sIsMonBeingMoved) { switch (sBoxCursorArea) @@ -6742,94 +6724,94 @@ static void SetCursorMonData(void *pokemon, u8 mode) u16 gender; bool8 sanityIsBagEgg; - gUnknown_02039D08->cursorMonItem = 0; + sPSSData->cursorMonItem = 0; gender = MON_MALE; sanityIsBagEgg = FALSE; if (mode == MODE_PARTY) { struct Pokemon *mon = (struct Pokemon *)pokemon; - gUnknown_02039D08->cursorMonSpecies = GetMonData(mon, MON_DATA_SPECIES2); - if (gUnknown_02039D08->cursorMonSpecies != SPECIES_NONE) + sPSSData->cursorMonSpecies = GetMonData(mon, MON_DATA_SPECIES2); + if (sPSSData->cursorMonSpecies != SPECIES_NONE) { sanityIsBagEgg = GetMonData(mon, MON_DATA_SANITY_IS_BAD_EGG); if (sanityIsBagEgg) - gUnknown_02039D08->cursorMonIsEgg = TRUE; + sPSSData->cursorMonIsEgg = TRUE; else - gUnknown_02039D08->cursorMonIsEgg = GetMonData(mon, MON_DATA_IS_EGG); + sPSSData->cursorMonIsEgg = GetMonData(mon, MON_DATA_IS_EGG); - GetMonData(mon, MON_DATA_NICKNAME, gUnknown_02039D08->cursorMonNick); - StringGetEnd10(gUnknown_02039D08->cursorMonNick); - gUnknown_02039D08->cursorMonLevel = GetMonData(mon, MON_DATA_LEVEL); - gUnknown_02039D08->cursorMonMarkings = GetMonData(mon, MON_DATA_MARKINGS); - gUnknown_02039D08->cursorMonPersonality = GetMonData(mon, MON_DATA_PERSONALITY); - gUnknown_02039D08->cursorMonPalette = GetMonFrontSpritePal(mon); + 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); - gUnknown_02039D08->cursorMonItem = GetMonData(mon, MON_DATA_HELD_ITEM); + sPSSData->cursorMonItem = GetMonData(mon, MON_DATA_HELD_ITEM); } } else if (mode == MODE_BOX) { struct BoxPokemon *boxMon = (struct BoxPokemon *)pokemon; - gUnknown_02039D08->cursorMonSpecies = GetBoxMonData(pokemon, MON_DATA_SPECIES2); - if (gUnknown_02039D08->cursorMonSpecies != SPECIES_NONE) + 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) - gUnknown_02039D08->cursorMonIsEgg = TRUE; + sPSSData->cursorMonIsEgg = TRUE; else - gUnknown_02039D08->cursorMonIsEgg = GetBoxMonData(boxMon, MON_DATA_IS_EGG); + sPSSData->cursorMonIsEgg = GetBoxMonData(boxMon, MON_DATA_IS_EGG); - GetBoxMonData(boxMon, MON_DATA_NICKNAME, gUnknown_02039D08->cursorMonNick); - StringGetEnd10(gUnknown_02039D08->cursorMonNick); - gUnknown_02039D08->cursorMonLevel = GetLevelFromBoxMonExp(boxMon); - gUnknown_02039D08->cursorMonMarkings = GetBoxMonData(boxMon, MON_DATA_MARKINGS); - gUnknown_02039D08->cursorMonPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY); - gUnknown_02039D08->cursorMonPalette = GetFrontSpritePalFromSpeciesAndPersonality(gUnknown_02039D08->cursorMonSpecies, otId, gUnknown_02039D08->cursorMonPersonality); - gender = GetGenderFromSpeciesAndPersonality(gUnknown_02039D08->cursorMonSpecies, gUnknown_02039D08->cursorMonPersonality); - gUnknown_02039D08->cursorMonItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM); + 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 { - gUnknown_02039D08->cursorMonSpecies = SPECIES_NONE; - gUnknown_02039D08->cursorMonItem = 0; + sPSSData->cursorMonSpecies = SPECIES_NONE; + sPSSData->cursorMonItem = 0; } - if (gUnknown_02039D08->cursorMonSpecies == SPECIES_NONE) + if (sPSSData->cursorMonSpecies == SPECIES_NONE) { - StringFill(gUnknown_02039D08->cursorMonNick, CHAR_SPACE, 5); - StringFill(gUnknown_02039D08->cursorMonNickText, CHAR_SPACE, 8); - StringFill(gUnknown_02039D08->cursorMonSpeciesName, CHAR_SPACE, 8); - StringFill(gUnknown_02039D08->cursorMonGenderLvlText, CHAR_SPACE, 8); - StringFill(gUnknown_02039D08->cursorMonItemName, CHAR_SPACE, 8); + 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 (gUnknown_02039D08->cursorMonIsEgg) + else if (sPSSData->cursorMonIsEgg) { if (sanityIsBagEgg) - StringCopyPadded(gUnknown_02039D08->cursorMonNickText, gUnknown_02039D08->cursorMonNick, CHAR_SPACE, 5); + StringCopyPadded(sPSSData->cursorMonNickText, sPSSData->cursorMonNick, CHAR_SPACE, 5); else - StringCopyPadded(gUnknown_02039D08->cursorMonNickText, gText_EggNickname, CHAR_SPACE, 8); + StringCopyPadded(sPSSData->cursorMonNickText, gText_EggNickname, CHAR_SPACE, 8); - StringFill(gUnknown_02039D08->cursorMonSpeciesName, CHAR_SPACE, 8); - StringFill(gUnknown_02039D08->cursorMonGenderLvlText, CHAR_SPACE, 8); - StringFill(gUnknown_02039D08->cursorMonItemName, CHAR_SPACE, 8); + StringFill(sPSSData->cursorMonSpeciesName, CHAR_SPACE, 8); + StringFill(sPSSData->cursorMonGenderLvlText, CHAR_SPACE, 8); + StringFill(sPSSData->cursorMonItemName, CHAR_SPACE, 8); } else { - if (gUnknown_02039D08->cursorMonSpecies == SPECIES_NIDORAN_F || gUnknown_02039D08->cursorMonSpecies == SPECIES_NIDORAN_M) + if (sPSSData->cursorMonSpecies == SPECIES_NIDORAN_F || sPSSData->cursorMonSpecies == SPECIES_NIDORAN_M) gender = MON_GENDERLESS; - StringCopyPadded(gUnknown_02039D08->cursorMonNickText, gUnknown_02039D08->cursorMonNick, CHAR_SPACE, 5); + StringCopyPadded(sPSSData->cursorMonNickText, sPSSData->cursorMonNick, CHAR_SPACE, 5); - txtPtr = gUnknown_02039D08->cursorMonSpeciesName; + txtPtr = sPSSData->cursorMonSpeciesName; *(txtPtr)++ = CHAR_SLASH; - StringCopyPadded(txtPtr, gSpeciesNames[gUnknown_02039D08->cursorMonSpecies], CHAR_SPACE, 5); + StringCopyPadded(txtPtr, gSpeciesNames[sPSSData->cursorMonSpecies], CHAR_SPACE, 5); - txtPtr = gUnknown_02039D08->cursorMonGenderLvlText; + txtPtr = sPSSData->cursorMonGenderLvlText; *(txtPtr)++ = EXT_CTRL_CODE_BEGIN; *(txtPtr)++ = 4; switch (gender) @@ -6863,20 +6845,20 @@ static void SetCursorMonData(void *pokemon, u8 mode) *(txtPtr++) = CHAR_SPECIAL_F9; *(txtPtr++) = 5; - txtPtr = ConvertIntToDecimalStringN(txtPtr, gUnknown_02039D08->cursorMonLevel, STR_CONV_MODE_LEFT_ALIGN, 3); + txtPtr = ConvertIntToDecimalStringN(txtPtr, sPSSData->cursorMonLevel, STR_CONV_MODE_LEFT_ALIGN, 3); txtPtr[0] = CHAR_SPACE; txtPtr[1] = EOS; - if (gUnknown_02039D08->cursorMonItem != 0) - StringCopyPadded(gUnknown_02039D08->cursorMonItemName, ItemId_GetName(gUnknown_02039D08->cursorMonItem), CHAR_SPACE, 8); + if (sPSSData->cursorMonItem != 0) + StringCopyPadded(sPSSData->cursorMonItemName, ItemId_GetName(sPSSData->cursorMonItem), CHAR_SPACE, 8); else - StringFill(gUnknown_02039D08->cursorMonItemName, CHAR_SPACE, 8); + StringFill(sPSSData->cursorMonItemName, CHAR_SPACE, 8); } } static u8 HandleInput_InBox(void) { - switch (gUnknown_02039D08->inBoxMovingMode) + switch (sPSSData->inBoxMovingMode) { case 0: default: @@ -6897,9 +6879,9 @@ static u8 InBoxInput_Normal(void) s8 cursorArea = sBoxCursorArea; s8 cursorPosition = sBoxCursorPosition; - gUnknown_02039D08->field_CD2 = 0; - gUnknown_02039D08->field_CD3 = 0; - gUnknown_02039D08->field_CD7 = 0; + sPSSData->field_CD2 = 0; + sPSSData->field_CD3 = 0; + sPSSData->field_CD7 = 0; retVal = 0; if (!(gMain.newAndRepeatedKeys & DPAD_UP)) { @@ -6912,8 +6894,8 @@ static u8 InBoxInput_Normal(void) cursorArea = CURSOR_AREA_BUTTONS; cursorPosition -= IN_BOX_COUNT; cursorPosition /= 3; - gUnknown_02039D08->field_CD2 = 1; - gUnknown_02039D08->field_CD7 = 1; + sPSSData->field_CD2 = 1; + sPSSData->field_CD7 = 1; } } else if (gMain.newAndRepeatedKeys & DPAD_LEFT) @@ -6925,7 +6907,7 @@ static u8 InBoxInput_Normal(void) } else { - gUnknown_02039D08->field_CD3 = -1; + sPSSData->field_CD3 = -1; cursorPosition += (IN_BOX_ROWS - 1); } } @@ -6938,7 +6920,7 @@ static u8 InBoxInput_Normal(void) } else { - gUnknown_02039D08->field_CD3 = 1; + sPSSData->field_CD3 = 1; cursorPosition -= (IN_BOX_ROWS - 1); } } @@ -6955,7 +6937,7 @@ static u8 InBoxInput_Normal(void) if (!sCanOnlyMove) return 8; - if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_MONS || sIsMonBeingMoved == TRUE) + if (sPSSData->boxOption == BOX_OPTION_MOVE_MONS || sIsMonBeingMoved == TRUE) { switch (sub_80CFF98(0)) { @@ -6979,7 +6961,7 @@ static u8 InBoxInput_Normal(void) } else { - gUnknown_02039D08->inBoxMovingMode = 1; + sPSSData->inBoxMovingMode = 1; return 20; } } @@ -7037,7 +7019,7 @@ static u8 InBoxInput_Normal(void) mov r8, r0\n\ ldr r2, =sBoxCursorPosition\n\ ldrb r4, [r2]\n\ - ldr r5, =gUnknown_02039D08\n\ + ldr r5, =sPSSData\n\ ldr r0, [r5]\n\ ldr r1, =0x00000cd2\n\ mov r10, r1\n\ @@ -7388,14 +7370,14 @@ static u8 InBoxInput_GrabbingMultiple(void) { if (sub_80D0BA4() == sBoxCursorPosition) { - gUnknown_02039D08->inBoxMovingMode = 0; - gUnknown_02039D08->field_CB8->invisible = FALSE; + sPSSData->inBoxMovingMode = 0; + sPSSData->field_CB8->invisible = FALSE; return 22; } else { - sIsMonBeingMoved = (gUnknown_02039D08->cursorMonSpecies != SPECIES_NONE); - gUnknown_02039D08->inBoxMovingMode = 2; + sIsMonBeingMoved = (sPSSData->cursorMonSpecies != SPECIES_NONE); + sPSSData->inBoxMovingMode = 2; sMovingMonOrigBoxId = StorageGetCurrentBox(); return 23; } @@ -7457,7 +7439,7 @@ static u8 InBoxInput_MovingMultiple(void) if (sub_80D0BC0()) { sIsMonBeingMoved = FALSE; - gUnknown_02039D08->inBoxMovingMode = 0; + sPSSData->inBoxMovingMode = 0; return 26; } else @@ -7491,9 +7473,9 @@ static u8 HandleInput_InParty(void) s8 cursorArea = sBoxCursorArea; s8 cursorPosition = sBoxCursorPosition; - gUnknown_02039D08->field_CD3 = 0; - gUnknown_02039D08->field_CD2 = 0; - gUnknown_02039D08->field_CD7 = 0; + sPSSData->field_CD3 = 0; + sPSSData->field_CD2 = 0; + sPSSData->field_CD7 = 0; gotoBox = FALSE; retVal = 0; @@ -7509,7 +7491,7 @@ static u8 HandleInput_InParty(void) else if ((gMain.newAndRepeatedKeys & DPAD_LEFT) && sBoxCursorPosition != 0) { retVal = 1; - gUnknown_02039D08->field_CD6 = sBoxCursorPosition; + sPSSData->field_CD6 = sBoxCursorPosition; cursorPosition = 0; } else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) @@ -7517,7 +7499,7 @@ static u8 HandleInput_InParty(void) if (sBoxCursorPosition == 0) { retVal = 1; - cursorPosition = gUnknown_02039D08->field_CD6; + cursorPosition = sPSSData->field_CD6; } else { @@ -7532,7 +7514,7 @@ static u8 HandleInput_InParty(void) { if (sBoxCursorPosition == PARTY_SIZE) { - if (gUnknown_02039D08->boxOption == BOX_OPTION_DEPOSIT) + if (sPSSData->boxOption == BOX_OPTION_DEPOSIT) return 4; gotoBox = TRUE; @@ -7566,7 +7548,7 @@ static u8 HandleInput_InParty(void) if (gMain.newKeys & B_BUTTON) { - if (gUnknown_02039D08->boxOption == BOX_OPTION_DEPOSIT) + if (sPSSData->boxOption == BOX_OPTION_DEPOSIT) return 19; gotoBox = TRUE; @@ -7614,7 +7596,7 @@ static u8 HandleInput_InParty(void) mov r9, r0\n\ ldr r6, =sBoxCursorPosition\n\ ldrb r4, [r6]\n\ - ldr r2, =gUnknown_02039D08\n\ + ldr r2, =sPSSData\n\ ldr r0, [r2]\n\ ldr r1, =0x00000cd3\n\ adds r0, r1\n\ @@ -7803,7 +7785,7 @@ _080CF75C:\n\ mov r12, r2\n\ cmp r0, 0\n\ beq _080CF784\n\ - ldr r0, =gUnknown_02039D08\n\ + ldr r0, =sPSSData\n\ ldr r0, [r0]\n\ ldrb r0, [r0, 0x1]\n\ cmp r0, 0x1\n\ @@ -7878,9 +7860,9 @@ static u8 HandleInput_OnBox(void) s8 cursorArea = sBoxCursorArea; s8 cursorPosition = sBoxCursorPosition; - gUnknown_02039D08->field_CD3 = 0; - gUnknown_02039D08->field_CD2 = 0; - gUnknown_02039D08->field_CD7 = 0; + sPSSData->field_CD3 = 0; + sPSSData->field_CD2 = 0; + sPSSData->field_CD7 = 0; retVal = 0; if (!(gMain.newAndRepeatedKeys & DPAD_UP)) @@ -7930,7 +7912,7 @@ static u8 HandleInput_OnBox(void) retVal = 1; cursorArea = CURSOR_AREA_BUTTONS; cursorPosition = 0; - gUnknown_02039D08->field_CD7 = 1; + sPSSData->field_CD7 = 1; } if (retVal) @@ -7948,7 +7930,7 @@ static u8 HandleInput_OnBox(void) { asm_unified("\n\ push {r4-r6,lr}\n\ - ldr r3, =gUnknown_02039D08\n\ + ldr r3, =sPSSData\n\ ldr r0, [r3]\n\ ldr r1, =0x00000cd3\n\ adds r0, r1\n\ @@ -8076,9 +8058,9 @@ static u8 HandleInput_OnButtons(void) s8 cursorArea = sBoxCursorArea; s8 cursorPosition = sBoxCursorPosition; - gUnknown_02039D08->field_CD3 = 0; - gUnknown_02039D08->field_CD2 = 0; - gUnknown_02039D08->field_CD7 = 0; + sPSSData->field_CD3 = 0; + sPSSData->field_CD2 = 0; + sPSSData->field_CD7 = 0; if (!(gMain.newAndRepeatedKeys & DPAD_UP)) { @@ -8087,7 +8069,7 @@ static u8 HandleInput_OnButtons(void) retVal = 1; cursorArea = CURSOR_AREA_BOX; cursorPosition = 0; - gUnknown_02039D08->field_CD7 = 1; + sPSSData->field_CD7 = 1; } else if (gMain.newAndRepeatedKeys & DPAD_LEFT) { @@ -8127,9 +8109,9 @@ static u8 HandleInput_OnButtons(void) { retVal = 1; cursorArea = CURSOR_AREA_IN_BOX; - gUnknown_02039D08->field_CD2 = -1; + sPSSData->field_CD2 = -1; cursorPosition = (sBoxCursorPosition == 0) ? IN_BOX_COUNT - 1 - 5 : IN_BOX_COUNT - 1; - gUnknown_02039D08->field_CD7 = 1; + sPSSData->field_CD7 = 1; } if (retVal != 0) @@ -8153,7 +8135,7 @@ static u8 HandleInput_OnButtons(void) ldr r0, =sBoxCursorPosition\n\ mov r12, r0\n\ ldrb r2, [r0]\n\ - ldr r3, =gUnknown_02039D08\n\ + ldr r3, =sPSSData\n\ ldr r0, [r3]\n\ ldr r1, =0x00000cd3\n\ adds r0, r1\n\ @@ -8321,7 +8303,7 @@ static void AddBoxMenu(void) static u8 sub_80CFA5C(void) { InitMenu(); - if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) return sub_80CFA84(); else return sub_80CFB44(); @@ -8331,7 +8313,7 @@ static bool8 sub_80CFA84(void) { u16 var0 = sub_80CD504(); - switch (gUnknown_02039D08->boxOption) + switch (sPSSData->boxOption) { case BOX_OPTION_DEPOSIT: if (var0) @@ -8367,7 +8349,7 @@ static bool8 sub_80CFA84(void) } SetMenuText(6); - if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_MONS) + if (sPSSData->boxOption == BOX_OPTION_MOVE_MONS) { if (!sBoxCursorArea) SetMenuText(2); @@ -8383,21 +8365,21 @@ static bool8 sub_80CFA84(void) static bool8 sub_80CFB44(void) { - if (gUnknown_02039D08->cursorMonSpecies == SPECIES_EGG) + if (sPSSData->cursorMonSpecies == SPECIES_EGG) return FALSE; if (!IsActiveItemMoving()) { - if (gUnknown_02039D08->cursorMonItem == 0) + if (sPSSData->cursorMonItem == 0) { - if (gUnknown_02039D08->cursorMonSpecies == SPECIES_NONE) + if (sPSSData->cursorMonSpecies == SPECIES_NONE) return FALSE; SetMenuText(14); } else { - if (!ItemIsMail(gUnknown_02039D08->cursorMonItem)) + if (!ItemIsMail(sPSSData->cursorMonItem)) { SetMenuText(12); SetMenuText(16); @@ -8407,16 +8389,16 @@ static bool8 sub_80CFB44(void) } else { - if (gUnknown_02039D08->cursorMonItem == 0) + if (sPSSData->cursorMonItem == 0) { - if (gUnknown_02039D08->cursorMonSpecies == SPECIES_NONE) + if (sPSSData->cursorMonSpecies == SPECIES_NONE) return FALSE; SetMenuText(13); } else { - if (ItemIsMail(gUnknown_02039D08->cursorMonItem) == TRUE) + if (ItemIsMail(sPSSData->cursorMonItem) == TRUE) return FALSE; SetMenuText(15); @@ -8429,8 +8411,8 @@ static bool8 sub_80CFB44(void) static void sub_80CFBF4(struct Sprite *sprite) { - sprite->pos1.x = gUnknown_02039D08->field_CB4->pos1.x; - sprite->pos1.y = gUnknown_02039D08->field_CB4->pos1.y + 20; + sprite->pos1.x = sPSSData->field_CB4->pos1.x; + sprite->pos1.y = sPSSData->field_CB4->pos1.y + 20; } static void sub_80CFC14(void) @@ -8516,22 +8498,22 @@ static const struct SpriteTemplate gSpriteTemplate_857BA68 = LoadSpriteSheets(spriteSheets); LoadSpritePalettes(spritePalettes); - gUnknown_02039D08->field_CD8[0] = IndexOfSpritePaletteTag(0xDACA); - gUnknown_02039D08->field_CD8[1] = IndexOfSpritePaletteTag(0xDAC7); + sPSSData->field_CD8[0] = IndexOfSpritePaletteTag(0xDACA); + sPSSData->field_CD8[1] = IndexOfSpritePaletteTag(0xDAC7); sub_80CD444(sBoxCursorArea, sBoxCursorPosition, &x, &y); spriteId = CreateSprite(&gSpriteTemplate_857BA50, x, y, 6); if (spriteId != MAX_SPRITES) { - gUnknown_02039D08->field_CB4 = &gSprites[spriteId]; - gUnknown_02039D08->field_CB4->oam.paletteNum = gUnknown_02039D08->field_CD8[sCanOnlyMove]; - gUnknown_02039D08->field_CB4->oam.priority = 1; + sPSSData->field_CB4 = &gSprites[spriteId]; + sPSSData->field_CB4->oam.paletteNum = sPSSData->field_CD8[sCanOnlyMove]; + sPSSData->field_CB4->oam.priority = 1; if (sIsMonBeingMoved) - StartSpriteAnim(gUnknown_02039D08->field_CB4, 3); + StartSpriteAnim(sPSSData->field_CB4, 3); } else { - gUnknown_02039D08->field_CB4 = NULL; + sPSSData->field_CB4 = NULL; } if (sBoxCursorArea == 1) @@ -8548,21 +8530,21 @@ static const struct SpriteTemplate gSpriteTemplate_857BA68 = spriteId = CreateSprite(&gSpriteTemplate_857BA68, 0, 0, subpriority); if (spriteId != MAX_SPRITES) { - gUnknown_02039D08->field_CB8 = &gSprites[spriteId]; - gUnknown_02039D08->field_CB8->oam.priority = priority; + sPSSData->field_CB8 = &gSprites[spriteId]; + sPSSData->field_CB8->oam.priority = priority; if (sBoxCursorArea) - gUnknown_02039D08->field_CB8->invisible = 1; + sPSSData->field_CB8->invisible = 1; } else { - gUnknown_02039D08->field_CB8 = NULL; + sPSSData->field_CB8 = NULL; } } static void sub_80CFDC4(void) { sCanOnlyMove = !sCanOnlyMove; - gUnknown_02039D08->field_CB4->oam.paletteNum = gUnknown_02039D08->field_CD8[sCanOnlyMove]; + sPSSData->field_CB4->oam.paletteNum = sPSSData->field_CD8[sCanOnlyMove]; } static u8 GetBoxCursorPosition(void) @@ -8586,7 +8568,7 @@ static void sub_80CFE14(u8 *arg0, u8 *arg1) static void sub_80CFE54(u8 animNum) { - StartSpriteAnim(gUnknown_02039D08->field_CB4, animNum); + StartSpriteAnim(sPSSData->field_CB4, animNum); } static u8 sub_80CFE78(void) @@ -8596,7 +8578,7 @@ static u8 sub_80CFE78(void) static void sub_80CFE84(void) { - gUnknown_02039D08->field_CB4->oam.priority = 1; + sPSSData->field_CB4->oam.priority = 1; } static void sub_80CFEA8(void) @@ -8613,11 +8595,11 @@ static void sub_80CFECC(void) static void InitMenu(void) { - gUnknown_02039D08->menuItemsCount = 0; - gUnknown_02039D08->menuWidth = 0; - gUnknown_02039D08->menuWindow.bg = 0; - gUnknown_02039D08->menuWindow.paletteNum = 15; - gUnknown_02039D08->menuWindow.baseBlock = 92; + sPSSData->menuItemsCount = 0; + sPSSData->menuWidth = 0; + sPSSData->menuWindow.bg = 0; + sPSSData->menuWindow.paletteNum = 15; + sPSSData->menuWindow.baseBlock = 92; } static const u8 *const gUnknown_0857BA80[] = @@ -8665,42 +8647,42 @@ static const u8 *const gUnknown_0857BA80[] = static void SetMenuText(u8 textId) { - if (gUnknown_02039D08->menuItemsCount < 7) + if (sPSSData->menuItemsCount < 7) { u8 len; - struct StorageMenu *menu = &gUnknown_02039D08->menuItems[gUnknown_02039D08->menuItemsCount]; + struct StorageMenu *menu = &sPSSData->menuItems[sPSSData->menuItemsCount]; menu->text = gUnknown_0857BA80[textId]; menu->textId = textId; len = StringLength(menu->text); - if (len > gUnknown_02039D08->menuWidth) - gUnknown_02039D08->menuWidth = len; + if (len > sPSSData->menuWidth) + sPSSData->menuWidth = len; - gUnknown_02039D08->menuItemsCount++; + sPSSData->menuItemsCount++; } } static s8 sub_80CFF98(u8 arg0) { - if (arg0 >= gUnknown_02039D08->menuItemsCount) + if (arg0 >= sPSSData->menuItemsCount) return -1; else - return gUnknown_02039D08->menuItems[arg0].textId; + return sPSSData->menuItems[arg0].textId; } static void AddMenu(void) { - gUnknown_02039D08->menuWindow.width = gUnknown_02039D08->menuWidth + 2; - gUnknown_02039D08->menuWindow.height = 2 * gUnknown_02039D08->menuItemsCount; - gUnknown_02039D08->menuWindow.tilemapLeft = 29 - gUnknown_02039D08->menuWindow.width; - gUnknown_02039D08->menuWindow.tilemapTop = 15 - gUnknown_02039D08->menuWindow.height; - gUnknown_02039D08->field_CB0 = AddWindow(&gUnknown_02039D08->menuWindow); - ClearWindowTilemap(gUnknown_02039D08->field_CB0); - SetWindowBorderStyle(gUnknown_02039D08->field_CB0, FALSE, 11, 14); - PrintMenuTable(gUnknown_02039D08->field_CB0, gUnknown_02039D08->menuItemsCount, (void*)gUnknown_02039D08->menuItems); - InitMenuInUpperLeftCornerPlaySoundWhenAPressed(gUnknown_02039D08->field_CB0, gUnknown_02039D08->menuItemsCount, 0); + 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); - gUnknown_02039D08->field_CAE = 0; + sPSSData->field_CAE = 0; } static bool8 sub_80D00A8(void) @@ -8740,7 +8722,7 @@ static s16 sub_80D00AC(void) sub_80D013C(); if (textId >= 0) - textId = gUnknown_02039D08->menuItems[textId].textId; + textId = sPSSData->menuItems[textId].textId; #ifndef NONMATCHING asm("":::"r4"); @@ -8750,8 +8732,8 @@ static s16 sub_80D00AC(void) static void sub_80D013C(void) { - sub_8198070(gUnknown_02039D08->field_CB0, TRUE); - RemoveWindow(gUnknown_02039D08->field_CB0); + sub_8198070(sPSSData->field_CB0, TRUE); + RemoveWindow(sPSSData->field_CB0); } // The functions below handle moving and grabbing multiple mons at once. @@ -8769,15 +8751,36 @@ static const struct WindowTemplate gUnknown_0857BB1C = .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) { - gUnknown_02039D80 = Alloc(sizeof(*gUnknown_02039D80)); - if (gUnknown_02039D80 != NULL) + sMoveMonsPtr = Alloc(sizeof(*sMoveMonsPtr)); + if (sMoveMonsPtr != NULL) { - gUnknown_02039D08->field_2200 = AddWindow8Bit(&gUnknown_0857BB1C); - if (gUnknown_02039D08->field_2200 != 0xFF) + sPSSData->field_2200 = AddWindow8Bit(&gUnknown_0857BB1C); + if (sPSSData->field_2200 != 0xFF) { - FillWindowPixelBuffer(gUnknown_02039D08->field_2200, 0); + FillWindowPixelBuffer(sPSSData->field_2200, 0); return TRUE; } } @@ -8787,19 +8790,19 @@ static bool8 sub_80D0164(void) static void sub_80D01B8(void) { - if (gUnknown_02039D80 != NULL) - Free(gUnknown_02039D80); + if (sMoveMonsPtr != NULL) + Free(sMoveMonsPtr); } static void sub_80D01D0(u8 arg0) { - gUnknown_02039D80->field_0 = arg0; - gUnknown_02039D80->state = 0; + sMoveMonsPtr->field_0 = arg0; + sMoveMonsPtr->state = 0; } static bool8 sub_80D01E4(void) { - switch (gUnknown_02039D80->field_0) + switch (sMoveMonsPtr->field_0) { case 0: return sub_80D024C(); @@ -8820,29 +8823,29 @@ static bool8 sub_80D01E4(void) static bool8 sub_80D024C(void) { - switch (gUnknown_02039D80->state) + switch (sMoveMonsPtr->state) { case 0: HideBg(0); sub_80D304C(0x80); - gUnknown_02039D80->state++; + sMoveMonsPtr->state++; break; case 1: - sub_80CFE14(&gUnknown_02039D80->fromRow, &gUnknown_02039D80->fromColumn); - gUnknown_02039D80->toRow = gUnknown_02039D80->fromRow; - gUnknown_02039D80->toColumn = gUnknown_02039D80->fromColumn; + 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(gUnknown_02039D08->field_2200, 0); - sub_80D07B0(gUnknown_02039D80->fromRow, gUnknown_02039D80->fromColumn); + FillWindowPixelBuffer8Bit(sPSSData->field_2200, 0); + sub_80D07B0(sMoveMonsPtr->fromRow, sMoveMonsPtr->fromColumn); SetBgAttribute(0, 4, 1); - PutWindowTilemap(gUnknown_02039D08->field_2200); - CopyWindowToVram8Bit(gUnknown_02039D08->field_2200, 3); + PutWindowTilemap(sPSSData->field_2200); + CopyWindowToVram8Bit(sPSSData->field_2200, 3); BlendPalettes(0x3F00, 8, 0x7FFF); sub_80CFE54(2); SetGpuRegBits(REG_OFFSET_BG0CNT, BGCNT_256COLOR); - gUnknown_02039D80->state++; + sMoveMonsPtr->state++; break; case 2: if (!IsDma3ManagerBusyWithBgCopy()) @@ -8858,16 +8861,16 @@ static bool8 sub_80D024C(void) static bool8 sub_80D0344(void) { - switch (gUnknown_02039D80->state) + switch (sMoveMonsPtr->state) { case 0: HideBg(0); - gUnknown_02039D80->state++; + sMoveMonsPtr->state++; break; case 1: sub_80D0B5C(); sub_80CFE54(0); - gUnknown_02039D80->state++; + sMoveMonsPtr->state++; break; case 2: if (!IsDma3ManagerBusyWithBgCopy()) @@ -8885,17 +8888,17 @@ static bool8 sub_80D0344(void) static bool8 sub_80D03B0(void) { - switch (gUnknown_02039D80->state) + switch (sMoveMonsPtr->state) { case 0: if (!sub_80CD554()) { - sub_80CFE14(&gUnknown_02039D80->field_6, &gUnknown_02039D80->field_7); + sub_80CFE14(&sMoveMonsPtr->field_6, &sMoveMonsPtr->field_7); sub_80D062C(); - gUnknown_02039D80->toRow = gUnknown_02039D80->field_6; - gUnknown_02039D80->toColumn = gUnknown_02039D80->field_7; - CopyWindowToVram8Bit(gUnknown_02039D08->field_2200, 2); - gUnknown_02039D80->state++; + sMoveMonsPtr->toRow = sMoveMonsPtr->field_6; + sMoveMonsPtr->toColumn = sMoveMonsPtr->field_7; + CopyWindowToVram8Bit(sPSSData->field_2200, 2); + sMoveMonsPtr->state++; } break; case 1: @@ -8909,13 +8912,13 @@ static bool8 sub_80D0420(void) { u8 var1, var2; - switch (gUnknown_02039D80->state) + switch (sMoveMonsPtr->state) { case 0: sub_80D08CC(); sub_80D09A4(); sub_80CDC64(FALSE); - gUnknown_02039D80->state++; + sMoveMonsPtr->state++; break; case 1: if (!DoMonPlaceChange()) @@ -8923,7 +8926,7 @@ static bool8 sub_80D0420(void) sub_80CFE54(3); sub_80D0884(0, 256, 8); sub_80CDC64(TRUE); - gUnknown_02039D80->state++; + sMoveMonsPtr->state++; } break; case 2: @@ -8950,13 +8953,13 @@ static bool8 sub_80D04A0(void) static bool8 sub_80D04C8(void) { - switch (gUnknown_02039D80->state) + switch (sMoveMonsPtr->state) { case 0: sub_80D0AAC(); sub_80D0884(0, -256, 8); sub_80CDC64(FALSE); - gUnknown_02039D80->state++; + sMoveMonsPtr->state++; break; case 1: if (!DoMonPlaceChange() && !sub_80D0894()) @@ -8965,7 +8968,7 @@ static bool8 sub_80D04C8(void) sub_80CFE54(2); sub_80CDC64(TRUE); HideBg(0); - gUnknown_02039D80->state++; + sMoveMonsPtr->state++; } break; case 2: @@ -8973,7 +8976,7 @@ static bool8 sub_80D04C8(void) { sub_80CFE54(0); sub_80D0B5C(); - gUnknown_02039D80->state++; + sMoveMonsPtr->state++; } break; case 3: @@ -8995,27 +8998,27 @@ static bool8 sub_80D0580(u8 arg0) switch (arg0) { case 0: - if (gUnknown_02039D80->minColumn == 0) + if (sMoveMonsPtr->minColumn == 0) return FALSE; - gUnknown_02039D80->minColumn--; + sMoveMonsPtr->minColumn--; sub_80D0884(0, 1024, 6); break; case 1: - if (gUnknown_02039D80->minColumn + gUnknown_02039D80->columsTotal >= 5) + if (sMoveMonsPtr->minColumn + sMoveMonsPtr->columsTotal >= 5) return FALSE; - gUnknown_02039D80->minColumn++; + sMoveMonsPtr->minColumn++; sub_80D0884(0, -1024, 6); break; case 2: - if (gUnknown_02039D80->minRow == 0) + if (sMoveMonsPtr->minRow == 0) return FALSE; - gUnknown_02039D80->minRow--; + sMoveMonsPtr->minRow--; sub_80D0884(1024, 0, 6); break; case 3: - if (gUnknown_02039D80->minRow + gUnknown_02039D80->rowsTotal > 5) + if (sMoveMonsPtr->minRow + sMoveMonsPtr->rowsTotal > 5) return FALSE; - gUnknown_02039D80->minRow++; + sMoveMonsPtr->minRow++; sub_80D0884(-1024, 0, 6); break; } @@ -9025,25 +9028,25 @@ static bool8 sub_80D0580(u8 arg0) static void sub_80D062C(void) { - s16 var = (abs(gUnknown_02039D80->fromRow - gUnknown_02039D80->field_6)) - (abs(gUnknown_02039D80->fromRow - gUnknown_02039D80->toRow)); - s16 var2 = (abs(gUnknown_02039D80->fromColumn - gUnknown_02039D80->field_7)) - (abs(gUnknown_02039D80->fromColumn - gUnknown_02039D80->toColumn)); + 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(gUnknown_02039D80->field_6, gUnknown_02039D80->fromColumn, gUnknown_02039D80->toColumn); + sub_80D06D0(sMoveMonsPtr->field_6, sMoveMonsPtr->fromColumn, sMoveMonsPtr->toColumn); if (var < 0) { - sub_80D0740(gUnknown_02039D80->toRow, gUnknown_02039D80->fromColumn, gUnknown_02039D80->toColumn); - sub_80D06D0(gUnknown_02039D80->field_6, gUnknown_02039D80->fromColumn, gUnknown_02039D80->toColumn); + sub_80D0740(sMoveMonsPtr->toRow, sMoveMonsPtr->fromColumn, sMoveMonsPtr->toColumn); + sub_80D06D0(sMoveMonsPtr->field_6, sMoveMonsPtr->fromColumn, sMoveMonsPtr->toColumn); } if (var2 > 0) - sub_80D0708(gUnknown_02039D80->field_7, gUnknown_02039D80->fromRow, gUnknown_02039D80->toRow); + sub_80D0708(sMoveMonsPtr->field_7, sMoveMonsPtr->fromRow, sMoveMonsPtr->toRow); if (var2 < 0) { - sub_80D0778(gUnknown_02039D80->toColumn, gUnknown_02039D80->fromRow, gUnknown_02039D80->toRow); - sub_80D0708(gUnknown_02039D80->field_7, gUnknown_02039D80->fromRow, gUnknown_02039D80->toRow); + sub_80D0778(sMoveMonsPtr->toColumn, sMoveMonsPtr->fromRow, sMoveMonsPtr->toRow); + sub_80D0708(sMoveMonsPtr->field_7, sMoveMonsPtr->fromRow, sMoveMonsPtr->toRow); } } @@ -9114,7 +9117,7 @@ static void sub_80D07B0(u8 arg0, u8 arg1) const u8 *iconGfx = GetMonIconPtr(species, personality, 1); u8 index = GetValidMonIconPalIndex(species) + 8; - BlitBitmapRectToWindow4BitTo8Bit(gUnknown_02039D08->field_2200, + BlitBitmapRectToWindow4BitTo8Bit(sPSSData->field_2200, iconGfx, 0, 0, @@ -9135,7 +9138,7 @@ static void sub_80D0834(u8 arg0, u8 arg1) if (species != SPECIES_NONE) { - FillWindowPixelRect8Bit(gUnknown_02039D08->field_2200, + FillWindowPixelRect8Bit(sPSSData->field_2200, 0, 24 * arg0, 24 * arg1, @@ -9146,21 +9149,21 @@ static void sub_80D0834(u8 arg0, u8 arg1) static void sub_80D0884(u16 arg0, u16 arg1, u16 arg2) { - gUnknown_02039D80->bgX = arg0; - gUnknown_02039D80->bgY = arg1; - gUnknown_02039D80->field_10 = arg2; + sMoveMonsPtr->bgX = arg0; + sMoveMonsPtr->bgY = arg1; + sMoveMonsPtr->field_10 = arg2; } static u8 sub_80D0894(void) { - if (gUnknown_02039D80->field_10 != 0) + if (sMoveMonsPtr->field_10 != 0) { - ChangeBgX(0, gUnknown_02039D80->bgX, 1); - ChangeBgY(0, gUnknown_02039D80->bgY, 1); - gUnknown_02039D80->field_10--; + ChangeBgX(0, sMoveMonsPtr->bgX, 1); + ChangeBgY(0, sMoveMonsPtr->bgY, 1); + sMoveMonsPtr->field_10--; } - return gUnknown_02039D80->field_10; + return sMoveMonsPtr->field_10; } static void sub_80D08CC(void) @@ -9170,22 +9173,22 @@ static void sub_80D08CC(void) u8 boxId; u8 monArrayId; - gUnknown_02039D80->minRow = min(gUnknown_02039D80->fromRow, gUnknown_02039D80->toRow); - gUnknown_02039D80->minColumn = min(gUnknown_02039D80->fromColumn, gUnknown_02039D80->toColumn); - gUnknown_02039D80->rowsTotal = abs(gUnknown_02039D80->fromRow - gUnknown_02039D80->toRow) + 1; - gUnknown_02039D80->columsTotal = abs(gUnknown_02039D80->fromColumn - gUnknown_02039D80->toColumn) + 1; + 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 = gUnknown_02039D80->minRow + gUnknown_02039D80->rowsTotal; - columnCount = gUnknown_02039D80->minColumn + gUnknown_02039D80->columsTotal; - for (i = gUnknown_02039D80->minColumn; i < columnCount; i++) + rowCount = sMoveMonsPtr->minRow + sMoveMonsPtr->rowsTotal; + columnCount = sMoveMonsPtr->minColumn + sMoveMonsPtr->columsTotal; + for (i = sMoveMonsPtr->minColumn; i < columnCount; i++) { - u8 boxPosition = (IN_BOX_ROWS * i) + gUnknown_02039D80->minRow; - for (j = gUnknown_02039D80->minRow; j < rowCount; j++) + u8 boxPosition = (IN_BOX_ROWS * i) + sMoveMonsPtr->minRow; + for (j = sMoveMonsPtr->minRow; j < rowCount; j++) { struct BoxPokemon *boxMon = GetBoxedMonPtr(boxId, boxPosition); - gUnknown_02039D80->boxMons[monArrayId] = *boxMon; + sMoveMonsPtr->boxMons[monArrayId] = *boxMon; monArrayId++; boxPosition++; } @@ -9195,14 +9198,14 @@ static void sub_80D08CC(void) static void sub_80D09A4(void) { s32 i, j; - s32 rowCount = gUnknown_02039D80->minRow + gUnknown_02039D80->rowsTotal; - s32 columnCount = gUnknown_02039D80->minColumn + gUnknown_02039D80->columsTotal; + s32 rowCount = sMoveMonsPtr->minRow + sMoveMonsPtr->rowsTotal; + s32 columnCount = sMoveMonsPtr->minColumn + sMoveMonsPtr->columsTotal; u8 boxId = StorageGetCurrentBox(); - for (i = gUnknown_02039D80->minColumn; i < columnCount; i++) + for (i = sMoveMonsPtr->minColumn; i < columnCount; i++) { - u8 boxPosition = (IN_BOX_ROWS * i) + gUnknown_02039D80->minRow; - for (j = gUnknown_02039D80->minRow; j < rowCount; j++) + u8 boxPosition = (IN_BOX_ROWS * i) + sMoveMonsPtr->minRow; + for (j = sMoveMonsPtr->minRow; j < rowCount; j++) { DestroyBoxMonIconAtPosition(boxPosition); ZeroBoxMonAt(boxId, boxPosition); @@ -9214,16 +9217,16 @@ static void sub_80D09A4(void) static void sub_80D0A1C(void) { s32 i, j; - s32 rowCount = gUnknown_02039D80->minRow + gUnknown_02039D80->rowsTotal; - s32 columnCount = gUnknown_02039D80->minColumn + gUnknown_02039D80->columsTotal; + s32 rowCount = sMoveMonsPtr->minRow + sMoveMonsPtr->rowsTotal; + s32 columnCount = sMoveMonsPtr->minColumn + sMoveMonsPtr->columsTotal; u8 monArrayId = 0; - for (i = gUnknown_02039D80->minColumn; i < columnCount; i++) + for (i = sMoveMonsPtr->minColumn; i < columnCount; i++) { - u8 boxPosition = (IN_BOX_ROWS * i) + gUnknown_02039D80->minRow; - for (j = gUnknown_02039D80->minRow; j < rowCount; j++) + u8 boxPosition = (IN_BOX_ROWS * i) + sMoveMonsPtr->minRow; + for (j = sMoveMonsPtr->minRow; j < rowCount; j++) { - if (GetBoxMonData(&gUnknown_02039D80->boxMons[monArrayId], MON_DATA_SANITY_HAS_SPECIES)) + if (GetBoxMonData(&sMoveMonsPtr->boxMons[monArrayId], MON_DATA_SANITY_HAS_SPECIES)) sub_80CB140(boxPosition); monArrayId++; boxPosition++; @@ -9234,18 +9237,18 @@ static void sub_80D0A1C(void) static void sub_80D0AAC(void) { s32 i, j; - s32 rowCount = gUnknown_02039D80->minRow + gUnknown_02039D80->rowsTotal; - s32 columnCount = gUnknown_02039D80->minColumn + gUnknown_02039D80->columsTotal; + s32 rowCount = sMoveMonsPtr->minRow + sMoveMonsPtr->rowsTotal; + s32 columnCount = sMoveMonsPtr->minColumn + sMoveMonsPtr->columsTotal; u8 boxId = StorageGetCurrentBox(); u8 monArrayId = 0; - for (i = gUnknown_02039D80->minColumn; i < columnCount; i++) + for (i = sMoveMonsPtr->minColumn; i < columnCount; i++) { - u8 boxPosition = (IN_BOX_ROWS * i) + gUnknown_02039D80->minRow; - for (j = gUnknown_02039D80->minRow; j < rowCount; j++) + u8 boxPosition = (IN_BOX_ROWS * i) + sMoveMonsPtr->minRow; + for (j = sMoveMonsPtr->minRow; j < rowCount; j++) { - if (GetBoxMonData(&gUnknown_02039D80->boxMons[monArrayId], MON_DATA_SANITY_HAS_SPECIES)) - SetBoxMonAt(boxId, boxPosition, &gUnknown_02039D80->boxMons[monArrayId]); + if (GetBoxMonData(&sMoveMonsPtr->boxMons[monArrayId], MON_DATA_SANITY_HAS_SPECIES)) + SetBoxMonAt(boxId, boxPosition, &sMoveMonsPtr->boxMons[monArrayId]); boxPosition++; monArrayId++; } @@ -9264,22 +9267,22 @@ static void sub_80D0B5C(void) static u8 sub_80D0BA4(void) { - return (IN_BOX_ROWS * gUnknown_02039D80->fromColumn) + gUnknown_02039D80->fromRow; + return (IN_BOX_ROWS * sMoveMonsPtr->fromColumn) + sMoveMonsPtr->fromRow; } static bool8 sub_80D0BC0(void) { s32 i, j; - s32 rowCount = gUnknown_02039D80->minRow + gUnknown_02039D80->rowsTotal; - s32 columnCount = gUnknown_02039D80->minColumn + gUnknown_02039D80->columsTotal; + s32 rowCount = sMoveMonsPtr->minRow + sMoveMonsPtr->rowsTotal; + s32 columnCount = sMoveMonsPtr->minColumn + sMoveMonsPtr->columsTotal; u8 monArrayId = 0; - for (i = gUnknown_02039D80->minColumn; i < columnCount; i++) + for (i = sMoveMonsPtr->minColumn; i < columnCount; i++) { - u8 boxPosition = (IN_BOX_ROWS * i) + gUnknown_02039D80->minRow; - for (j = gUnknown_02039D80->minRow; j < rowCount; j++) + u8 boxPosition = (IN_BOX_ROWS * i) + sMoveMonsPtr->minRow; + for (j = sMoveMonsPtr->minRow; j < rowCount; j++) { - if (GetBoxMonData(&gUnknown_02039D80->boxMons[monArrayId], MON_DATA_SANITY_HAS_SPECIES) + if (GetBoxMonData(&sMoveMonsPtr->boxMons[monArrayId], MON_DATA_SANITY_HAS_SPECIES) && GetCurrentBoxMonData(boxPosition, MON_DATA_SANITY_HAS_SPECIES)) return FALSE; @@ -9388,7 +9391,7 @@ static void sub_80D0C60(void) struct CompressedSpriteSheet spriteSheet; struct SpriteTemplate spriteTemplate; - if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) { spriteSheet.data = gUnknown_03000F78; spriteSheet.size = 0x200; @@ -9398,19 +9401,19 @@ static void sub_80D0C60(void) { spriteSheet.tag = 7 + i; LoadCompressedSpriteSheet(&spriteSheet); - gUnknown_02039D08->field_2204[i].tiles = GetSpriteTileStartByTag(spriteSheet.tag) * 32 + (void*)(OBJ_VRAM0); - gUnknown_02039D08->field_2204[i].palIndex = AllocSpritePalette(0xDACB + i); - gUnknown_02039D08->field_2204[i].palIndex *= 16; - gUnknown_02039D08->field_2204[i].palIndex += 0x100; + sPSSData->field_2204[i].tiles = GetSpriteTileStartByTag(spriteSheet.tag) * 32 + (void*)(OBJ_VRAM0); + sPSSData->field_2204[i].palIndex = AllocSpritePalette(0xDACB + i); + sPSSData->field_2204[i].palIndex *= 16; + sPSSData->field_2204[i].palIndex += 0x100; spriteTemplate.tileTag = 7 + i; spriteTemplate.paletteTag = 0xDACB + i; spriteId = CreateSprite(&spriteTemplate, 0, 0, 11); - gUnknown_02039D08->field_2204[i].sprite = &gSprites[spriteId]; - gUnknown_02039D08->field_2204[i].sprite->invisible = TRUE; - gUnknown_02039D08->field_2204[i].unk10 = 0; + sPSSData->field_2204[i].sprite = &gSprites[spriteId]; + sPSSData->field_2204[i].sprite->invisible = TRUE; + sPSSData->field_2204[i].unk10 = 0; } } - gUnknown_02039D08->movingItem = 0; + sPSSData->movingItem = 0; } // The functions below handle new features of MOVE_ITEMS box option. @@ -9436,7 +9439,7 @@ static void sub_80D0D8C(u8 cursorArea, u8 cursorPos) { u16 heldItem; - if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) return; if (sub_80D1324(cursorArea, cursorPos)) return; @@ -9474,7 +9477,7 @@ static void sub_80D0E50(u8 cursorArea, u8 cursorPos) { u8 id; - if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) return; id = sub_80D1370(cursorArea, cursorPos); @@ -9487,7 +9490,7 @@ static void Item_FromMonToMoving(u8 cursorArea, u8 cursorPos) u8 id; u16 item; - if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) return; id = sub_80D1370(cursorArea, cursorPos); @@ -9506,7 +9509,7 @@ static void Item_FromMonToMoving(u8 cursorArea, u8 cursorPos) SetPartyMonIconObjMode(cursorPos, 1); } - gUnknown_02039D08->movingItem = gUnknown_02039D08->cursorMonItem; + sPSSData->movingItem = sPSSData->cursorMonItem; } static void sub_80D0F38(u16 item) @@ -9520,7 +9523,7 @@ static void sub_80D0F38(u16 item) sub_80D1604(id, 1, 0, 0); sub_80D140C(id, 2, 0); sub_80D1740(id, TRUE); - gUnknown_02039D08->movingItem = item; + sPSSData->movingItem = item; } static void Item_SwitchMonsWithMoving(u8 cursorArea, u8 cursorPos) @@ -9528,7 +9531,7 @@ static void Item_SwitchMonsWithMoving(u8 cursorArea, u8 cursorPos) u8 id; u16 item; - if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) return; id = sub_80D1370(cursorArea, cursorPos); @@ -9537,14 +9540,14 @@ static void Item_SwitchMonsWithMoving(u8 cursorArea, u8 cursorPos) if (cursorArea == CURSOR_AREA_IN_BOX) { item = GetCurrentBoxMonData(cursorPos, MON_DATA_HELD_ITEM); - SetCurrentBoxMonData(cursorPos, MON_DATA_HELD_ITEM, &gUnknown_02039D08->movingItem); - gUnknown_02039D08->movingItem = 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, &gUnknown_02039D08->movingItem); - gUnknown_02039D08->movingItem = item; + SetMonData(&gPlayerParty[cursorPos], MON_DATA_HELD_ITEM, &sPSSData->movingItem); + sPSSData->movingItem = item; } id = sub_80D1370(2, 0); @@ -9556,7 +9559,7 @@ static void Item_GiveMovingToMon(u8 cursorArea, u8 cursorPos) { u8 id; - if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) return; id = sub_80D1370(2, 0); @@ -9564,12 +9567,12 @@ static void Item_GiveMovingToMon(u8 cursorArea, u8 cursorPos) sub_80D1604(id, 2, cursorArea, cursorPos); if (cursorArea == CURSOR_AREA_IN_BOX) { - SetCurrentBoxMonData(cursorPos, MON_DATA_HELD_ITEM, &gUnknown_02039D08->movingItem); + SetCurrentBoxMonData(cursorPos, MON_DATA_HELD_ITEM, &sPSSData->movingItem); SetBoxMonIconObjMode(cursorPos, 0); } else { - SetMonData(&gPlayerParty[cursorPos], MON_DATA_HELD_ITEM, &gUnknown_02039D08->movingItem); + SetMonData(&gPlayerParty[cursorPos], MON_DATA_HELD_ITEM, &sPSSData->movingItem); SetPartyMonIconObjMode(cursorPos, 0); } } @@ -9579,7 +9582,7 @@ static void Item_TakeMons(u8 cursorArea, u8 cursorPos) u8 id; u16 item; - if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) return; item = 0; @@ -9600,7 +9603,7 @@ static void Item_TakeMons(u8 cursorArea, u8 cursorPos) static void sub_80D1194(void) { - if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) { u8 id = sub_80D1370(2, 0); sub_80D15D4(id, 5); @@ -9612,12 +9615,12 @@ static void sub_80D11CC(void) { s32 i; - if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) return; for (i = 0; i < 3; i++) { - if (gUnknown_02039D08->field_2204[i].unk10 && gUnknown_02039D08->field_2204[i].unk8 == 1) + if (sPSSData->field_2204[i].unk10 && sPSSData->field_2204[i].unk8 == 1) sub_80D1604(i, 7, 2, 0); } } @@ -9628,11 +9631,11 @@ static bool8 sub_80D1218(void) for (i = 0; i < 3; i++) { - if (gUnknown_02039D08->field_2204[i].unk10) + if (sPSSData->field_2204[i].unk10) { - if (!gUnknown_02039D08->field_2204[i].sprite->affineAnimEnded && gUnknown_02039D08->field_2204[i].sprite->affineAnimBeginning) + if (!sPSSData->field_2204[i].sprite->affineAnimEnded && sPSSData->field_2204[i].sprite->affineAnimBeginning) return TRUE; - if (gUnknown_02039D08->field_2204[i].sprite->callback != SpriteCallbackDummy && gUnknown_02039D08->field_2204[i].sprite->callback != sub_80D1AD8) + if (sPSSData->field_2204[i].sprite->callback != SpriteCallbackDummy && sPSSData->field_2204[i].sprite->callback != sub_80D1AD8) return TRUE; } } @@ -9644,11 +9647,11 @@ static bool8 IsActiveItemMoving(void) { s32 i; - if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) + if (sPSSData->boxOption == BOX_OPTION_MOVE_ITEMS) { for (i = 0; i < 3; i++) { - if (gUnknown_02039D08->field_2204[i].unk10 && gUnknown_02039D08->field_2204[i].unk8 == 2) + if (sPSSData->field_2204[i].unk10 && sPSSData->field_2204[i].unk8 == 2) return TRUE; } } @@ -9658,12 +9661,12 @@ static bool8 IsActiveItemMoving(void) static const u8 *GetMovingItemName(void) { - return ItemId_GetName(gUnknown_02039D08->movingItem); + return ItemId_GetName(sPSSData->movingItem); } static u16 GetMovingItem(void) { - return gUnknown_02039D08->movingItem; + return sPSSData->movingItem; } static u8 sub_80D12E8(void) @@ -9672,9 +9675,9 @@ static u8 sub_80D12E8(void) for (i = 0; i < 3; i++) { - if (gUnknown_02039D08->field_2204[i].unk10 == 0) + if (sPSSData->field_2204[i].unk10 == 0) { - gUnknown_02039D08->field_2204[i].unk10 = 1; + sPSSData->field_2204[i].unk10 = 1; return i; } } @@ -9688,9 +9691,9 @@ static bool32 sub_80D1324(u8 cursorArea, u8 cursorPos) for (i = 0; i < 3; i++) { - if (gUnknown_02039D08->field_2204[i].unk10 - && gUnknown_02039D08->field_2204[i].unk8 == cursorArea - && gUnknown_02039D08->field_2204[i].unk9 == cursorPos) + if (sPSSData->field_2204[i].unk10 + && sPSSData->field_2204[i].unk8 == cursorArea + && sPSSData->field_2204[i].unk9 == cursorPos) return TRUE; } @@ -9703,9 +9706,9 @@ static u8 sub_80D1370(u8 cursorArea, u8 cursorPos) for (i = 0; i < 3; i++) { - if (gUnknown_02039D08->field_2204[i].unk10 - && gUnknown_02039D08->field_2204[i].unk8 == cursorArea - && gUnknown_02039D08->field_2204[i].unk9 == cursorPos) + if (sPSSData->field_2204[i].unk10 + && sPSSData->field_2204[i].unk8 == cursorArea + && sPSSData->field_2204[i].unk9 == cursorPos) return i; } @@ -9718,8 +9721,8 @@ static u8 sub_80D13C4(struct Sprite *sprite) for (i = 0; i < 3; i++) { - if (gUnknown_02039D08->field_2204[i].unk10 - && gUnknown_02039D08->field_2204[i].sprite == sprite) + if (sPSSData->field_2204[i].unk10 + && sPSSData->field_2204[i].sprite == sprite) return i; } @@ -9738,27 +9741,27 @@ static void sub_80D140C(u8 id, u8 cursorArea, u8 cursorPos) case CURSOR_AREA_IN_BOX: row = cursorPos % IN_BOX_ROWS; column = cursorPos / IN_BOX_ROWS; - gUnknown_02039D08->field_2204[id].sprite->pos1.x = (24 * row) + 112; - gUnknown_02039D08->field_2204[id].sprite->pos1.y = (24 * column) + 56; - gUnknown_02039D08->field_2204[id].sprite->oam.priority = 2; + 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) { - gUnknown_02039D08->field_2204[id].sprite->pos1.x = 116; - gUnknown_02039D08->field_2204[id].sprite->pos1.y = 76; + sPSSData->field_2204[id].sprite->pos1.x = 116; + sPSSData->field_2204[id].sprite->pos1.y = 76; } else { - gUnknown_02039D08->field_2204[id].sprite->pos1.x = 164; - gUnknown_02039D08->field_2204[id].sprite->pos1.y = 24 * (cursorPos - 1) + 28; + sPSSData->field_2204[id].sprite->pos1.x = 164; + sPSSData->field_2204[id].sprite->pos1.y = 24 * (cursorPos - 1) + 28; } - gUnknown_02039D08->field_2204[id].sprite->oam.priority = 1; + sPSSData->field_2204[id].sprite->oam.priority = 1; break; } - gUnknown_02039D08->field_2204[id].unk8 = cursorArea; - gUnknown_02039D08->field_2204[id].unk9 = cursorPos; + sPSSData->field_2204[id].unk8 = cursorArea; + sPSSData->field_2204[id].unk9 = cursorPos; } static void sub_80D1524(u8 id, const u32 *itemTiles, const u32 *itemPal) @@ -9768,14 +9771,14 @@ static void sub_80D1524(u8 id, const u32 *itemTiles, const u32 *itemPal) if (id >= 3) return; - CpuFastFill(0, gUnknown_02039D08->field_42C4, 0x200); - LZ77UnCompWram(itemTiles, gUnknown_02039D08->field_22C4); + CpuFastFill(0, sPSSData->field_42C4, 0x200); + LZ77UnCompWram(itemTiles, sPSSData->field_22C4); for (i = 0; i < 3; i++) - CpuFastCopy(gUnknown_02039D08->field_22C4 + (i * 0x60), gUnknown_02039D08->field_42C4 + (i * 0x80), 0x60); + CpuFastCopy(sPSSData->field_22C4 + (i * 0x60), sPSSData->field_42C4 + (i * 0x80), 0x60); - CpuFastCopy(gUnknown_02039D08->field_42C4, gUnknown_02039D08->field_2204[id].tiles, 0x200); - LZ77UnCompWram(itemPal, gUnknown_02039D08->field_42C4); - LoadPalette(gUnknown_02039D08->field_42C4, gUnknown_02039D08->field_2204[id].palIndex, 0x20); + 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) @@ -9783,7 +9786,7 @@ static void sub_80D15D4(u8 id, u8 animNum) if (id >= 3) return; - StartSpriteAffineAnim(gUnknown_02039D08->field_2204[id].sprite, animNum); + StartSpriteAffineAnim(sPSSData->field_2204[id].sprite, animNum); } static void sub_80D1604(u8 id, u8 arg1, u8 arg2, u8 arg3) @@ -9794,33 +9797,33 @@ static void sub_80D1604(u8 id, u8 arg1, u8 arg2, u8 arg3) switch (arg1) { case 0: - gUnknown_02039D08->field_2204[id].sprite->data[0] = id; - gUnknown_02039D08->field_2204[id].sprite->callback = sub_80D1A48; + sPSSData->field_2204[id].sprite->data[0] = id; + sPSSData->field_2204[id].sprite->callback = sub_80D1A48; break; case 1: - gUnknown_02039D08->field_2204[id].sprite->data[0] = 0; - gUnknown_02039D08->field_2204[id].sprite->callback = sub_80D1A74; + sPSSData->field_2204[id].sprite->data[0] = 0; + sPSSData->field_2204[id].sprite->callback = sub_80D1A74; break; case 2: - gUnknown_02039D08->field_2204[id].sprite->data[0] = 0; - gUnknown_02039D08->field_2204[id].sprite->data[6] = arg2; - gUnknown_02039D08->field_2204[id].sprite->data[7] = arg3; - gUnknown_02039D08->field_2204[id].sprite->callback = sub_80D1B14; + 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: - gUnknown_02039D08->field_2204[id].sprite->data[0] = 0; - gUnknown_02039D08->field_2204[id].sprite->callback = sub_80D1B94; - gUnknown_02039D08->field_2204[id].sprite->data[6] = arg2; - gUnknown_02039D08->field_2204[id].sprite->data[7] = arg3; + 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: - gUnknown_02039D08->field_2204[id].sprite->data[0] = 0; - gUnknown_02039D08->field_2204[id].sprite->data[6] = arg2; - gUnknown_02039D08->field_2204[id].sprite->data[7] = arg3; - gUnknown_02039D08->field_2204[id].sprite->callback = sub_80D1C30; + 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: - gUnknown_02039D08->field_2204[id].sprite->callback = sub_80D1CCC; + sPSSData->field_2204[id].sprite->callback = sub_80D1CCC; break; } } @@ -9830,8 +9833,8 @@ static void sub_80D1740(u8 id, bool8 arg1) if (id >= 3) return; - gUnknown_02039D08->field_2204[id].unk10 = arg1; - gUnknown_02039D08->field_2204[id].sprite->invisible = (arg1 == FALSE); + sPSSData->field_2204[id].unk10 = arg1; + sPSSData->field_2204[id].sprite->invisible = (arg1 == FALSE); } static const u32 *GetItemIconPic(u16 itemId) @@ -9849,9 +9852,9 @@ static void PrintItemDescription(void) const u8 *description; if (IsActiveItemMoving()) - description = ItemId_GetDescription(gUnknown_02039D08->movingItem); + description = ItemId_GetDescription(sPSSData->movingItem); else - description = ItemId_GetDescription(gUnknown_02039D08->cursorMonItem); + description = ItemId_GetDescription(sPSSData->cursorMonItem); FillWindowPixelBuffer(2, 0x11); AddTextPrinterParameterized5(2, 1, description, 4, 0, 0, NULL, 0, 1); @@ -9859,7 +9862,7 @@ static void PrintItemDescription(void) static void sub_80D1818(void) { - gUnknown_02039D08->field_2236 = 0x15; + sPSSData->field_2236 = 0x15; LoadBgTiles(0, gUnknown_0857BB24, 0x80, 0x13A); sub_80D19B4(0); } @@ -9868,35 +9871,35 @@ static bool8 sub_80D184C(void) { s32 i, var; - if (gUnknown_02039D08->field_2236 == 0) + if (sPSSData->field_2236 == 0) return FALSE; - gUnknown_02039D08->field_2236--; - var = 0x15 - gUnknown_02039D08->field_2236; + sPSSData->field_2236--; + var = 0x15 - sPSSData->field_2236; for (i = 0; i < var; i++) { - WriteSequenceToBgTilemapBuffer(0, GetBgAttribute(0, 10) + 0x14 + gUnknown_02039D08->field_2236 + i, i, 13, 1, 7, 15, 21); + WriteSequenceToBgTilemapBuffer(0, GetBgAttribute(0, 10) + 0x14 + sPSSData->field_2236 + i, i, 13, 1, 7, 15, 21); } sub_80D19B4(var); - return (gUnknown_02039D08->field_2236 != 0); + return (sPSSData->field_2236 != 0); } static bool8 sub_80D18E4(void) { s32 i, var; - if (gUnknown_02039D08->field_2236 == 0x16) + if (sPSSData->field_2236 == 0x16) return FALSE; - if (gUnknown_02039D08->field_2236 == 0) + if (sPSSData->field_2236 == 0) FillBgTilemapBufferRect(0, 0, 21, 12, 1, 9, 17); - gUnknown_02039D08->field_2236++; - var = 0x15 - gUnknown_02039D08->field_2236; + sPSSData->field_2236++; + var = 0x15 - sPSSData->field_2236; for (i = 0; i < var; i++) { - WriteSequenceToBgTilemapBuffer(0, GetBgAttribute(0, 10) + 0x14 + gUnknown_02039D08->field_2236 + i, i, 13, 1, 7, 15, 21); + WriteSequenceToBgTilemapBuffer(0, GetBgAttribute(0, 10) + 0x14 + sPSSData->field_2236 + i, i, 13, 1, 7, 15, 21); } if (var >= 0) @@ -9953,9 +9956,9 @@ static void sub_80D1A74(struct Sprite *sprite) static void sub_80D1AD8(struct Sprite *sprite) { - sprite->pos1.x = gUnknown_02039D08->field_CB4->pos1.x + 4; - sprite->pos1.y = gUnknown_02039D08->field_CB4->pos1.y + gUnknown_02039D08->field_CB4->pos2.y + 8; - sprite->oam.priority = gUnknown_02039D08->field_CB4->oam.priority; + 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) @@ -10374,3 +10377,278 @@ 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/sym_ewram.txt b/sym_ewram.txt index 57b140a14..8443eb377 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -207,69 +207,7 @@ gUnknown_02039CF4: @ 2039CF4 gUnknown_02039CF8: @ 2039CF8 .space 0x8 -sPreviousBoxOption: @ 2039D00 - .space 0x4 - -gUnknown_02039D04: @ 2039D04 - .space 0x4 - -gUnknown_02039D08: @ 2039D08 - .space 0x4 - -sInPartyMenu: @ 2039D0C - .space 0x1 - -sCurrentBoxOption: @ 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 - -sBoxCursorArea: @ 2039D78 - .space 0x1 - -sBoxCursorPosition: @ 2039D79 - .space 0x1 - -sIsMonBeingMoved: @ 2039D7A - .space 0x1 - -sMovingMonOrigBoxId: @ 2039D7B - .space 0x1 - -sMovingMonOrigBoxPos: @ 2039D7C - .space 0x1 - -sCanOnlyMove: @ 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" From 1374c11a1c029c26c19daaea67ddeeb7bbd246c7 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 21 Dec 2018 22:35:01 +0100 Subject: [PATCH 12/13] Review pokemon storage system chaanges --- src/pokemon.c | 8 +- src/pokemon_icon.c | 2 +- src/pokemon_storage_system.c | 1614 +++++++++++++++++----------------- 3 files changed, 815 insertions(+), 809 deletions(-) diff --git a/src/pokemon.c b/src/pokemon.c index 1e8126c5e..6700ef553 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -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,8 +4889,8 @@ bool8 IsPokemonStorageFull(void) { s32 i, j; - for (i = 0; i < 14; i++) - for (j = 0; j < 30; j++) + 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; diff --git a/src/pokemon_icon.c b/src/pokemon_icon.c index 9a69febcf..36a7da0ee 100644 --- a/src/pokemon_icon.c +++ b/src/pokemon_icon.c @@ -1123,7 +1123,7 @@ u16 sub_80D2E84(u16 species) else { if (species > (SPECIES_UNOWN_B - 1)) - species = 260; + species = SPECIES_OLD_UNOWN_J; // That's an oddly specific species. return GetIconSpecies(species, 0); } } diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 3028b5ca1..ba14a4c39 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -426,6 +426,8 @@ enum #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 @@ -434,6 +436,10 @@ enum #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]; @@ -804,8 +810,8 @@ static const u16 gUnknown_0857243C[] = INCBIN_U16("graphics/unknown/unknown_5724 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 + 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[] = { @@ -1031,10 +1037,10 @@ static const union AnimCmd *const sSpriteAnimTable_85728AC[] = sSpriteAnim_857289C }; -static const struct SpriteTemplate gUnknown_085728BC = +static const struct SpriteTemplate sSpriteTemplate_Waveform = { - .tileTag = 5, - .paletteTag = 0xDACA, + .tileTag = TAG_TILE_WAVEFORM, + .paletteTag = TAG_PAL_WAVEFORM, .oam = &sOamData_8572874, .anims = sSpriteAnimTable_85728AC, .images = NULL, @@ -1045,8 +1051,8 @@ static const struct SpriteTemplate gUnknown_085728BC = static const struct OamData sOamData_85728EC; static const struct SpriteTemplate gUnknown_085728D4 = { - .tileTag = 18, - .paletteTag = 0xDAC0, + .tileTag = TAG_TILE_12, + .paletteTag = TAG_PAL_DAC0, .oam = &sOamData_85728EC, .anims = gDummySpriteAnimTable, .images = NULL, @@ -1092,127 +1098,127 @@ static const union AffineAnimCmd *const gSpriteAffineAnimTable_857291C[] = static const u16 gWallpaperPalettes_Forest[][16] = { - INCBIN_U16("graphics/pokemon_storage/forest_frame.gbapal"), - INCBIN_U16("graphics/pokemon_storage/forest_bg.gbapal"), + 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"), + 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"), + 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"), + 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"), + 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"), + 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"), + 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"), + 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"), + 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"), + 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"), + 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"), + 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"), + 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"), + 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"), + 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"), + 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"); @@ -1268,7 +1274,7 @@ 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"), + 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"); @@ -1276,7 +1282,7 @@ static const u32 gWallpaperTilemap_Zigzagoon[] = INCBIN_U32("graphics/pokemon_st static const u16 gWallpaperPalettes_Screen[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), - INCBIN_U16("graphics/pokemon_storage/screen_bg.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"); @@ -1284,7 +1290,7 @@ static const u32 gWallpaperTilemap_Screen[] = INCBIN_U32("graphics/pokemon_stora static const u16 gWallpaperPalettes_Diagonal[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), - INCBIN_U16("graphics/pokemon_storage/diagonal_bg.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"); @@ -1292,7 +1298,7 @@ static const u32 gWallpaperTilemap_Diagonal[] = INCBIN_U32("graphics/pokemon_sto static const u16 gWallpaperPalettes_Block[][16] = { INCBIN_U16("graphics/pokemon_storage/block_bg.gbapal"), - 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"); @@ -1300,7 +1306,7 @@ static const u32 gWallpaperTilemap_Block[] = INCBIN_U32("graphics/pokemon_storag static const u16 gWallpaperPalettes_Pokecenter2[][16] = { INCBIN_U16("graphics/pokemon_storage/pokecenter2_bg.gbapal"), - 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"); @@ -1308,7 +1314,7 @@ static const u32 gWallpaperTilemap_Pokecenter2[] = INCBIN_U32("graphics/pokemon_ static const u16 gWallpaperPalettes_Frame[][16] = { INCBIN_U16("graphics/pokemon_storage/frame_bg.gbapal"), - 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"); @@ -1316,7 +1322,7 @@ static const u32 gWallpaperTilemap_Frame[] = INCBIN_U32("graphics/pokemon_storag static const u16 gWallpaperPalettes_Blank[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), - INCBIN_U16("graphics/pokemon_storage/zigzagoon_bg.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"); @@ -1324,7 +1330,7 @@ static const u32 gWallpaperTilemap_Blank[] = INCBIN_U32("graphics/pokemon_storag static const u16 gWallpaperPalettes_Circles[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), - INCBIN_U16("graphics/pokemon_storage/circles_bg.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"); @@ -1332,7 +1338,7 @@ static const u32 gWallpaperTilemap_Circles[] = INCBIN_U32("graphics/pokemon_stor static const u16 gWallpaperPalettes_Azumarill[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), - INCBIN_U16("graphics/pokemon_storage/azumarill_bg.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"); @@ -1340,7 +1346,7 @@ static const u32 gWallpaperTilemap_Azumarill[] = INCBIN_U32("graphics/pokemon_st static const u16 gWallpaperPalettes_Pikachu[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), - INCBIN_U16("graphics/pokemon_storage/pikachu_bg.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"); @@ -1348,7 +1354,7 @@ static const u32 gWallpaperTilemap_Pikachu[] = INCBIN_U32("graphics/pokemon_stor static const u16 gWallpaperPalettes_Legendary[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), - INCBIN_U16("graphics/pokemon_storage/legendary_bg.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"); @@ -1356,7 +1362,7 @@ static const u32 gWallpaperTilemap_Legendary[] = INCBIN_U32("graphics/pokemon_st static const u16 gWallpaperPalettes_Dusclops[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), - INCBIN_U16("graphics/pokemon_storage/dusclops_bg.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"); @@ -1364,7 +1370,7 @@ static const u32 gWallpaperTilemap_Dusclops[] = INCBIN_U32("graphics/pokemon_sto static const u16 gWallpaperPalettes_Ludicolo[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), - INCBIN_U16("graphics/pokemon_storage/ludicolo_bg.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"); @@ -1372,7 +1378,7 @@ static const u32 gWallpaperTilemap_Ludicolo[] = INCBIN_U32("graphics/pokemon_sto static const u16 gWallpaperPalettes_Whiscash[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), - INCBIN_U16("graphics/pokemon_storage/whiscash_bg.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"); @@ -1527,7 +1533,7 @@ static const union AnimCmd *const gSpriteAnimTable_83BB2E8[] = static const struct SpriteTemplate gUnknown_0857B0E0 = { 6, - 0xDACA, + TAG_PAL_WAVEFORM, &gOamData_83BB2D0, gSpriteAnimTable_83BB2E8, NULL, @@ -2286,12 +2292,12 @@ static void Cb_InitPSS(u8 taskId) sub_80C7F4C(); if (!sPSSData->isReshowingPSS) { - BlendPalettes(0xFFFFFFFF, 0x10, 0); + BlendPalettes(0xFFFFFFFF, 0x10, RGB_BLACK); SetPSSCallback(Cb_ShowPSS); } else { - BlendPalettes(0xFFFFFFFF, 0x10, 0); + BlendPalettes(0xFFFFFFFF, 0x10, RGB_BLACK); SetPSSCallback(Cb_ReshowPSS); } SetVBlankCallback(VblankCb_PSS); @@ -3946,7 +3952,7 @@ static void sub_80CA1C4(void) LoadSpriteSheet(&sheet); for (i = 0; i < 2; i++) { - u8 spriteId = CreateSprite(&gUnknown_085728BC, i * 63 + 8, 9, 2); + u8 spriteId = CreateSprite(&sSpriteTemplate_Waveform, i * 63 + 8, 9, 2); sPSSData->field_D98[i] = &gSprites[spriteId]; } } @@ -5497,7 +5503,7 @@ static void sub_80CCCFC(u8 boxId, s8 direction) { spriteSheet.tag = TAG_TILE_4; r8 = sPSSData->field_71C; - template.tileTag = 4; + template.tileTag = TAG_TILE_4; template.paletteTag = TAG_PAL_DAC9; } @@ -7009,302 +7015,302 @@ 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + .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\ + movs r0, 0xB\n\ + b _080CF366\n\ _080CF2B8:\n\ - movs r0, 0xC\n\ - b _080CF366\n\ + movs r0, 0xC\n\ + b _080CF366\n\ _080CF2BC:\n\ - movs r0, 0xD\n\ - b _080CF366\n\ + movs r0, 0xD\n\ + b _080CF366\n\ _080CF2C0:\n\ - movs r0, 0xE\n\ - b _080CF366\n\ + movs r0, 0xE\n\ + b _080CF366\n\ _080CF2C4:\n\ - movs r0, 0xF\n\ - b _080CF366\n\ + movs r0, 0xF\n\ + b _080CF366\n\ _080CF2C8:\n\ - movs r0, 0x10\n\ - b _080CF366\n\ + movs r0, 0x10\n\ + b _080CF366\n\ _080CF2CC:\n\ - movs r0, 0x11\n\ - b _080CF366\n\ + movs r0, 0x11\n\ + b _080CF366\n\ _080CF2D0:\n\ - movs r0, 0x12\n\ - b _080CF366\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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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 @@ -7574,282 +7580,282 @@ static u8 HandleInput_InParty(void) if (cursorPosition != sBoxCursorPosition) retVal = 1; } - if (retVal != 0) + if (retVal != 0) { if (retVal != 6) sub_80CD894(cursorArea, cursorPosition); } - return retVal; + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + .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\ + movs r0, 0xB\n\ + b _080CF7D8\n\ _080CF740:\n\ - movs r0, 0xC\n\ - b _080CF7D8\n\ + movs r0, 0xC\n\ + b _080CF7D8\n\ _080CF744:\n\ - movs r0, 0xD\n\ - b _080CF7D8\n\ + movs r0, 0xD\n\ + b _080CF7D8\n\ _080CF748:\n\ - movs r0, 0xE\n\ - b _080CF7D8\n\ + movs r0, 0xE\n\ + b _080CF7D8\n\ _080CF74C:\n\ - movs r0, 0xF\n\ - b _080CF7D8\n\ + movs r0, 0xF\n\ + b _080CF7D8\n\ _080CF750:\n\ - movs r0, 0x10\n\ - b _080CF7D8\n\ + movs r0, 0x10\n\ + b _080CF7D8\n\ _080CF754:\n\ - movs r0, 0x11\n\ - b _080CF7D8\n\ + movs r0, 0x11\n\ + b _080CF7D8\n\ _080CF758:\n\ - movs r0, 0x12\n\ - b _080CF7D8\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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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"); + pop {r3,r4}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + pop {r4-r7}\n\ + pop {r1}\n\ + bx r1"); } #endif @@ -7929,124 +7935,124 @@ 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + adds r0, r4, 0\n\ _080CF8D2:\n\ - pop {r4-r6}\n\ - pop {r1}\n\ - bx r1\n\ + pop {r4-r6}\n\ + pop {r1}\n\ + bx r1\n\ "); } #endif @@ -8126,141 +8132,141 @@ 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + 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\ + ldr r0, [r3]\n\ _080CF9D0:\n\ - adds r0, r5\n\ - strb r7, [r0]\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\ + 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\ + adds r0, r7, 0\n\ _080CF9E2:\n\ - pop {r3}\n\ - mov r8, r3\n\ - pop {r4-r7}\n\ - pop {r1}\n\ - bx r1"); + pop {r3}\n\ + mov r8, r3\n\ + pop {r4-r7}\n\ + pop {r1}\n\ + bx r1"); } #endif @@ -8429,7 +8435,7 @@ static void sub_80CFC14(void) struct SpritePalette spritePalettes[] = { - {gHandCursorPalette, 0xDAC7}, + {gHandCursorPalette, TAG_PAL_DAC7}, {} }; @@ -8476,8 +8482,8 @@ static const union AnimCmd *const sSpriteAnimTable_857BA40[] = static const struct SpriteTemplate gSpriteTemplate_857BA50 = { - .tileTag = 0, - .paletteTag = 0xDACA, + .tileTag = TAG_TILE_0, + .paletteTag = TAG_PAL_WAVEFORM, .oam = &sOamData_857BA0C, .anims = sSpriteAnimTable_857BA40, .images = NULL, @@ -8487,8 +8493,8 @@ static const struct SpriteTemplate gSpriteTemplate_857BA50 = static const struct SpriteTemplate gSpriteTemplate_857BA68 = { - .tileTag = 1, - .paletteTag = 0xDACA, + .tileTag = TAG_TILE_1, + .paletteTag = TAG_PAL_WAVEFORM, .oam = &sOamData_857BA14, .anims = gDummySpriteAnimTable, .images = NULL, @@ -8498,8 +8504,8 @@ static const struct SpriteTemplate gSpriteTemplate_857BA68 = LoadSpriteSheets(spriteSheets); LoadSpritePalettes(spritePalettes); - sPSSData->field_CD8[0] = IndexOfSpritePaletteTag(0xDACA); - sPSSData->field_CD8[1] = IndexOfSpritePaletteTag(0xDAC7); + 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); @@ -8842,7 +8848,7 @@ static bool8 sub_80D024C(void) SetBgAttribute(0, 4, 1); PutWindowTilemap(sPSSData->field_2200); CopyWindowToVram8Bit(sPSSData->field_2200, 3); - BlendPalettes(0x3F00, 8, 0x7FFF); + BlendPalettes(0x3F00, 8, RGB_WHITE); sub_80CFE54(2); SetGpuRegBits(REG_OFFSET_BG0CNT, BGCNT_256COLOR); sMoveMonsPtr->state++; @@ -9375,8 +9381,8 @@ static const union AffineAnimCmd *const sSpriteAffineAnimTable_857BC44[] = static const struct SpriteTemplate gSpriteTemplate_857BC70 = { - .tileTag = 7, - .paletteTag = 0xdacb, + .tileTag = TAG_TILE_7, + .paletteTag = TAG_PAL_DACB, .oam = &sOamData_857BBA4, .anims = gDummySpriteAnimTable, .images = NULL, @@ -9399,14 +9405,14 @@ static void sub_80D0C60(void) for (i = 0; i < 3; i++) { - spriteSheet.tag = 7 + 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(0xDACB + i); + sPSSData->field_2204[i].palIndex = AllocSpritePalette(TAG_PAL_DACB + i); sPSSData->field_2204[i].palIndex *= 16; sPSSData->field_2204[i].palIndex += 0x100; - spriteTemplate.tileTag = 7 + i; - spriteTemplate.paletteTag = 0xDACB + i; + 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; @@ -10108,7 +10114,7 @@ u32 GetBoxMonLevelAt(u8 boxId, u8 boxPosition) { u32 lvl; - // LMAO. Obvious bug there. + // 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 @@ -10315,8 +10321,8 @@ void ResetWaldaWallpaper(void) gSaveBlock1Ptr->waldaPhrase.iconId = 0; gSaveBlock1Ptr->waldaPhrase.patternId = 0; gSaveBlock1Ptr->waldaPhrase.patternUnlocked = FALSE; - gSaveBlock1Ptr->waldaPhrase.colors[0] = 0x7B35; - gSaveBlock1Ptr->waldaPhrase.colors[1] = 0x6186; + gSaveBlock1Ptr->waldaPhrase.colors[0] = RGB(21, 25, 30); + gSaveBlock1Ptr->waldaPhrase.colors[1] = RGB(6, 12, 24); gSaveBlock1Ptr->waldaPhrase.text[0] = EOS; } From c805bab48324f946845e1f81002035e4bdb07e62 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 22 Dec 2018 23:00:22 +0100 Subject: [PATCH 13/13] Storage - review changes --- asm/pokenav.s | 8 +- include/dma3.h | 45 +++++++ include/pokemon_storage_system.h | 8 +- src/dma3_manager.c | 46 ------- src/pokemon_storage_system.c | 218 +++++++++++++++---------------- 5 files changed, 159 insertions(+), 166 deletions(-) diff --git a/asm/pokenav.s b/asm/pokenav.s index 7a1b84997..c1cd01c27 100644 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -409,7 +409,7 @@ _081C73C2: _081C73C6: adds r0, r4, 0 adds r1, r5, 0 - bl CheckBoxedMonSanity + bl CheckBoxMonSanityAt cmp r0, 0 beq _081C73EC lsls r1, r5, 24 @@ -16376,7 +16376,7 @@ _081CF1F4: _081CF1FC: adds r0, r5, 0 adds r1, r4, 0 - bl CheckBoxedMonSanity + bl CheckBoxMonSanityAt cmp r0, 0 beq _081CF23A ldr r1, =0xffffff00 @@ -17735,7 +17735,7 @@ sub_81CFC40: @ 81CFC40 _081CFC60: adds r0, r7, 0 adds r1, r6, 0 - bl CheckBoxedMonSanity + bl CheckBoxMonSanityAt cmp r0, 0 beq _081CFCA6 lsls r0, r7, 24 @@ -17900,7 +17900,7 @@ _081CFD92: _081CFD96: adds r0, r5, 0 adds r1, r4, 0 - bl CheckBoxedMonSanity + bl CheckBoxMonSanityAt cmp r0, 0 beq _081CFDBC lsls r1, r4, 24 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/pokemon_storage_system.h b/include/pokemon_storage_system.h index 4b84856bb..a85ee5ff4 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -3,8 +3,8 @@ #define TOTAL_BOXES_COUNT 14 #define IN_BOX_ROWS 6 -#define IN_BOX_COLUMS 5 -#define IN_BOX_COUNT (IN_BOX_ROWS * IN_BOX_COLUMS) +#define IN_BOX_COLUMNS 5 +#define IN_BOX_COUNT (IN_BOX_ROWS * IN_BOX_COLUMNS) /* ROWS @@ -23,7 +23,7 @@ struct PokemonStorage /*0x83C2*/ u8 boxWallpapers[TOTAL_BOXES_COUNT]; }; -extern struct PokemonStorage* gPokemonStoragePtr; +extern struct PokemonStorage *gPokemonStoragePtr; u8 CountMonsInBox(u8 boxId); s16 GetFirstFreeBoxSpot(u8 boxId); @@ -54,7 +54,7 @@ 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 CheckBoxedMonSanity(u32 boxId, u32 boxPosition); +bool32 CheckBoxMonSanityAt(u32 boxId, u32 boxPosition); u32 CountStorageNonEggMons(void); u32 CountAllStorageMons(void); bool32 AnyStorageMonWithMove(u16 moveId); 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/pokemon_storage_system.c b/src/pokemon_storage_system.c index ba14a4c39..a988e4104 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -388,7 +388,7 @@ enum WALLPAPER_MACHINE, WALLPAPER_PLAIN, WALLPAPER_FRIENDS, // The one received as a gift from Walda's parents. - WALLPAPERS_COUNT + WALLPAPER_COUNT }; enum @@ -586,7 +586,7 @@ static bool8 DoWallpaperGfxChange(void); static bool8 DoMonPlaceChange(void); static bool8 sub_80D00A8(void); static bool8 CanMovePartyMon(void); -static bool8 CanShifMon(void); +static bool8 CanShiftMon(void); static bool8 IsCursorOnCloseBox(void); static bool8 IsCursorOnBox(void); static bool8 IsCursorInBox(void); @@ -1652,27 +1652,6 @@ 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) - static void sub_80C71A4(u16 *dest, u16 dest_left, u16 dest_top, u16 width, u16 height) { u16 i; @@ -1929,7 +1908,7 @@ static void sub_80C78E4(void) sub_80C7B14(); } -static u8 sub_80C78F0(void) +static u8 HandleBoxChooseSelectionInput(void) { if (gMain.newKeys & B_BUTTON) { @@ -1970,7 +1949,7 @@ static 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; @@ -1980,17 +1959,17 @@ static 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++; } @@ -2061,13 +2040,13 @@ static 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); @@ -2472,7 +2451,7 @@ static void Cb_MainPSS(u8 taskId) } break; case 14: - if (!CanShifMon()) + if (!CanShiftMon()) { sPSSData->state = 4; } @@ -2714,7 +2693,7 @@ static void Cb_OnSelectedMon(u8 taskId) SetPSSCallback(Cb_PlaceMon); break; case 4: - if (!CanShifMon()) + if (!CanShiftMon()) { sPSSData->state = 3; } @@ -2945,8 +2924,11 @@ static void Cb_DepositMenu(u8 taskId) sPSSData->state++; break; case 1: - boxId = sub_80C78F0(); - if (boxId == 200); + boxId = HandleBoxChooseSelectionInput(); + if (boxId == 200) + { + // no box chosen yet + } else if (boxId == 201) { ClearBottomWindow(); @@ -3007,7 +2989,7 @@ static void Cb_ReleaseMon(u8 taskId) case 1: switch (Menu_ProcessInputNoWrapClearOnChoose()) { - case -1: + case MENU_B_PRESSED: case 1: ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -3370,7 +3352,7 @@ static void Cb_CloseBoxWhileHoldingItem(u8 taskId) case 1: switch (Menu_ProcessInputNoWrapClearOnChoose()) { - case -1: + case MENU_B_PRESSED: case 1: ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); @@ -3593,7 +3575,7 @@ static void Cb_JumpBox(u8 taskId) sPSSData->state++; break; case 1: - sPSSData->newCurrBoxId = sub_80C78F0(); + sPSSData->newCurrBoxId = HandleBoxChooseSelectionInput(); switch (sPSSData->newCurrBoxId) { case 200: @@ -3720,8 +3702,8 @@ static void Cb_OnCloseBoxPressed(u8 taskId) case 2: switch (Menu_ProcessInputNoWrapClearOnChoose()) { + case MENU_B_PRESSED: case 1: - case -1: ClearBottomWindow(); SetPSSCallback(Cb_MainPSS); break; @@ -3786,7 +3768,7 @@ static void Cb_OnBPressed(u8 taskId) SetPSSCallback(Cb_MainPSS); break; case 1: - case -1: + case MENU_B_PRESSED: PlaySE(SE_PC_OFF); ClearBottomWindow(); sPSSData->state++; @@ -4498,7 +4480,7 @@ static void sub_80CB028(u8 boxId) count = 0; boxPosition = 0; - for (i = 0; i < IN_BOX_COLUMS; i++) + for (i = 0; i < IN_BOX_COLUMNS; i++) { for (j = 0; j < IN_BOX_ROWS; j++) { @@ -4593,7 +4575,7 @@ static void DestroyAllIconsInRow(u8 row) u16 column; u8 boxPosition = row; - for (column = 0; column < IN_BOX_COLUMS; column++) + for (column = 0; column < IN_BOX_COLUMNS; column++) { if (sPSSData->boxMonsSprites[boxPosition] != NULL) { @@ -4616,7 +4598,7 @@ static u8 sub_80CB2F8(u8 row, u16 times, s16 xDelta) if (sPSSData->boxOption != BOX_OPTION_MOVE_ITEMS) { - for (i = 0; i < IN_BOX_COLUMS; i++) + for (i = 0; i < IN_BOX_COLUMNS; i++) { if (sPSSData->boxSpecies[boxPosition] != SPECIES_NONE) { @@ -4638,7 +4620,7 @@ static u8 sub_80CB2F8(u8 row, u16 times, s16 xDelta) } else { - for (i = 0; i < IN_BOX_COLUMS; i++) + for (i = 0; i < IN_BOX_COLUMNS; i++) { if (sPSSData->boxSpecies[boxPosition] != SPECIES_NONE) { @@ -4731,7 +4713,7 @@ static void SetBoxSpeciesAndPersonalities(u8 boxId) s32 i, j, boxPosition; boxPosition = 0; - for (i = 0; i < IN_BOX_COLUMS; i++) + for (i = 0; i < IN_BOX_COLUMNS; i++) { for (j = 0; j < IN_BOX_ROWS; j++) { @@ -5688,7 +5670,7 @@ static void sub_80CD210(struct Sprite *sprite) break; case 3: sprite->pos1.x -= sPSSData->field_2CE; - if (sprite->pos1.x < 0x49 || sprite->pos1.x > 0xf7) + if (sprite->pos1.x < 73 || sprite->pos1.x > 247) sprite->invisible = TRUE; if (--sprite->data[1] == 0) { @@ -6486,7 +6468,7 @@ static bool32 AtLeastThreeUsableMons(void) { for (j = 0; j < IN_BOX_COUNT; j++) { - if (CheckBoxedMonSanity(i, j)) + if (CheckBoxMonSanityAt(i, j)) { if (++count >= 3) return TRUE; @@ -6625,7 +6607,9 @@ s16 CompactPartySlots(void) last++; } else if (retVal == -1) + { retVal = i; + } } for (; last < PARTY_SIZE; last++) ZeroMonData(gPlayerParty + last); @@ -6657,7 +6641,7 @@ static bool8 CanMovePartyMon(void) return FALSE; } -static bool8 CanShifMon(void) +static bool8 CanShiftMon(void) { if (sIsMonBeingMoved) { @@ -8439,68 +8423,68 @@ static void sub_80CFC14(void) {} }; -static const struct OamData sOamData_857BA0C = -{ - .size = 2, - .priority = 1, -}; -static const struct OamData sOamData_857BA14 = -{ - .size = 1, - .priority = 1, -}; + 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 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 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_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, -}; + 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); @@ -8522,7 +8506,7 @@ static const struct SpriteTemplate gSpriteTemplate_857BA68 = sPSSData->field_CB4 = NULL; } - if (sBoxCursorArea == 1) + if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) { subpriority = 13; priority = 1; @@ -8693,7 +8677,7 @@ static void AddMenu(void) static bool8 sub_80D00A8(void) { - return 0; + return FALSE; } static s16 sub_80D00AC(void) @@ -10200,7 +10184,7 @@ u8 GetBoxWallpaper(u8 boxId) void SetBoxWallpaper(u8 boxId, u8 wallpaperId) { - if (boxId < TOTAL_BOXES_COUNT && wallpaperId < WALLPAPERS_COUNT) + if (boxId < TOTAL_BOXES_COUNT && wallpaperId < WALLPAPER_COUNT) gPokemonStoragePtr->boxWallpapers[boxId] = wallpaperId; } @@ -10249,7 +10233,7 @@ bool8 CheckFreePokemonStorageSpace(void) return FALSE; } -bool32 CheckBoxedMonSanity(u32 boxId, u32 boxPosition) +bool32 CheckBoxMonSanityAt(u32 boxId, u32 boxPosition) { if (boxId < TOTAL_BOXES_COUNT && boxPosition < IN_BOX_COUNT @@ -10426,8 +10410,18 @@ struct } static const sUnkVars[][4] = { - 0x0100, 0x0100, 0x0200, 0x0100, 0x0100, 0x0200, 0x0200, 0x0200, - 0x0080, 0x0080, 0x0100, 0x0100, 0x0200, 0x0200, 0x0400, 0x0400, + { + {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)