From 59a69eb62769003a81c0f9f50be5ec5abde96242 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 12 Dec 2018 23:19:50 +0100 Subject: [PATCH] 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