diff --git a/asm/party_menu.s b/asm/party_menu.s index b71804617..5d01bd745 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -15413,7 +15413,7 @@ sub_81B8448: @ 81B8448 str r0, [sp] ldr r0, =sub_81B1370 str r0, [sp, 0x4] - ldr r0, =sub_816BB28 + ldr r0, =Mailbox_ReturnToMailListAfterDeposit str r0, [sp, 0x8] movs r0, 0 movs r1, 0 @@ -15442,7 +15442,7 @@ sub_81B8474: @ 81B8474 movs r0, 0 strb r0, [r1] ldr r2, =gSaveBlock1Ptr - ldr r0, =gUnknown_0203BCB8 + ldr r0, =playerPCItemPageInfo ldrh r1, [r0] adds r1, 0x6 ldrh r0, [r0, 0x2] diff --git a/asm/player_pc.s b/asm/player_pc.s deleted file mode 100644 index 6fe4b3b85..000000000 --- a/asm/player_pc.s +++ /dev/null @@ -1,3436 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start NewGameInitPCItems -NewGameInitPCItems: @ 816ADF4 - push {r4-r6,lr} - movs r4, 0 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - movs r1, 0x93 - lsls r1, 3 - adds r0, r1 - movs r1, 0x32 - bl ClearItemSlots - ldr r1, =gUnknown_085DFEFC - ldrh r0, [r1] - cmp r0, 0 - beq _0816AE48 - ldrh r0, [r1, 0x2] - cmp r0, 0 - beq _0816AE48 - adds r5, r1, 0 - adds r6, r5, 0x2 -_0816AE1A: - lsls r1, r4, 2 - adds r0, r1, r5 - ldrh r0, [r0] - adds r1, r6 - ldrh r1, [r1] - bl AddPCItem - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0816AE48 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, r4, 2 - adds r0, r1, r5 - ldrh r0, [r0] - cmp r0, 0 - beq _0816AE48 - adds r0, r1, r6 - ldrh r0, [r0] - cmp r0, 0 - bne _0816AE1A -_0816AE48: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end NewGameInitPCItems - - thumb_func_start sub_816AE58 -sub_816AE58: @ 816AE58 - push {lr} - ldr r1, =gUnknown_0203BCB0 - ldr r0, =gUnknown_085DFED4 - str r0, [r1] - ldr r1, =gUnknown_0203BCB4 - movs r0, 0x4 - strb r0, [r1] - ldr r0, =TaskDummy - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gText_WhatWouldYouLike - ldr r2, =sub_816AED8 - bl DisplayItemMessageOnField - pop {r0} - bx r0 - .pool - thumb_func_end sub_816AE58 - - thumb_func_start sub_816AE98 -sub_816AE98: @ 816AE98 - push {lr} - ldr r1, =gUnknown_0203BCB0 - ldr r0, =gUnknown_085DFED8 - str r0, [r1] - ldr r1, =gUnknown_0203BCB4 - movs r0, 0x3 - strb r0, [r1] - ldr r0, =TaskDummy - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gText_WhatWouldYouLike - ldr r2, =sub_816AED8 - bl DisplayItemMessageOnField - pop {r0} - bx r0 - .pool - thumb_func_end sub_816AE98 - - thumb_func_start sub_816AED8 -sub_816AED8: @ 816AED8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r7, r0, 24 - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - ldr r0, =gUnknown_0203BCB4 - ldrb r1, [r0] - mov r8, r0 - cmp r1, 0x3 - bne _0816AF0C - ldr r0, =gUnknown_085DFF24 - ldr r1, [r0, 0x4] - ldr r0, [r0] - b _0816AF12 - .pool -_0816AF0C: - ldr r0, =gUnknown_085DFF24 - ldr r1, [r0, 0xC] - ldr r0, [r0, 0x8] -_0816AF12: - str r0, [sp] - str r1, [sp, 0x4] - ldr r5, =gUnknown_085DFEB4 - ldr r4, =gUnknown_0203BCB0 - ldr r1, [r4] - mov r0, r8 - ldrb r2, [r0] - adds r0, r5, 0 - bl sub_81DB3D8 - lsls r0, 24 - ldr r2, =0x00ffffff - ldr r1, [sp] - ands r1, r2 - orrs r1, r0 - str r1, [sp] - mov r0, sp - bl AddWindow - strh r0, [r6, 0x8] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl SetStandardWindowBorderStyle - ldrb r0, [r6, 0x8] - mov r2, r8 - ldrb r1, [r2] - ldr r3, [r4] - adds r2, r5, 0 - bl sub_81995E4 - ldrb r0, [r6, 0x8] - mov r2, r8 - ldrb r1, [r2] - movs r2, 0 - bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_816AF98 - str r1, [r0] - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816AED8 - - thumb_func_start sub_816AF98 -sub_816AF98: @ 816AF98 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldr r0, =gUnknown_0203BCB4 - ldrb r0, [r0] - cmp r0, 0x3 - bls _0816AFC0 - bl ProcessMenuInput - b _0816AFC4 - .pool -_0816AFC0: - bl ProcessMenuInputNoWrapAround -_0816AFC4: - lsls r0, 24 - lsrs r0, 24 - lsls r0, 24 - asrs r5, r0, 24 - movs r0, 0x2 - negs r0, r0 - cmp r5, r0 - beq _0816B04C - adds r0, 0x1 - cmp r5, r0 - bne _0816B014 - movs r0, 0x5 - bl PlaySE - ldrb r0, [r4, 0x8] - movs r1, 0 - bl sub_8198070 - ldrb r0, [r4, 0x8] - bl ClearWindowTilemap - ldrb r0, [r4, 0x8] - bl RemoveWindow - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_816B148 - str r1, [r0] - b _0816B04C - .pool -_0816B014: - ldrb r0, [r4, 0x8] - movs r1, 0 - bl sub_8198070 - ldrb r0, [r4, 0x8] - bl ClearWindowTilemap - ldrb r0, [r4, 0x8] - bl RemoveWindow - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - ldr r2, =gUnknown_085DFEB4 - ldr r0, =gUnknown_0203BCB0 - ldr r0, [r0] - adds r0, r5 - ldrb r0, [r0] - lsls r0, 3 - adds r2, 0x4 - adds r0, r2 - ldr r0, [r0] - str r0, [r1] -_0816B04C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816AF98 - - thumb_func_start sub_816B060 -sub_816B060: @ 816B060 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gText_WhatWouldYouLike - ldr r2, =sub_816AED8 - bl DisplayItemMessageOnField - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B060 - - thumb_func_start task_pc_itemstorage -task_pc_itemstorage: @ 816B07C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - movs r1, 0 - bl sub_816B190 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_816B248 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task_pc_itemstorage - - thumb_func_start sub_816B0A8 -sub_816B0A8: @ 816B0A8 - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r6, r4, 0 - bl sub_816B510 - ldr r5, =gUnknown_0203BCB8 - movs r1, 0 - strb r0, [r5, 0x5] - lsls r0, 24 - cmp r0, 0 - bne _0816B0D8 - ldr r1, =gText_NoMailHere - ldr r2, =sub_816B060 - adds r0, r4, 0 - bl DisplayItemMessageOnField - b _0816B12A - .pool -_0816B0D8: - strh r1, [r5] - strh r1, [r5, 0x2] - movs r0, 0xFF - strb r0, [r5, 0x9] - bl sub_816B54C - adds r0, r4, 0 - bl sub_816B4C0 - ldrb r0, [r5, 0x5] - bl sub_81D1C44 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0816B120 - movs r0, 0 - movs r1, 0 - bl sub_8197434 - adds r0, r4, 0 - bl sub_816B5F8 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_816B674 - str r0, [r1] - b _0816B12A - .pool -_0816B120: - ldr r1, =gText_NoMailHere - ldr r2, =sub_816B060 - adds r0, r6, 0 - bl DisplayItemMessageOnField -_0816B12A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B0A8 - - thumb_func_start sub_816B138 -sub_816B138: @ 816B138 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl sub_8126B2C - pop {r0} - bx r0 - thumb_func_end sub_816B138 - - thumb_func_start sub_816B148 -sub_816B148: @ 816B148 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gUnknown_0203BCB4 - ldrb r0, [r0] - cmp r0, 0x4 - bne _0816B180 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x8] - cmp r0, 0 - bne _0816B174 - ldr r0, =LittlerootTown_BrendansHouse_2F_EventScript_1F863F - bl ScriptContext1_SetupScript - b _0816B184 - .pool -_0816B174: - ldr r0, =LittlerootTown_MaysHouse_2F_EventScript_1F958F - bl ScriptContext1_SetupScript - b _0816B184 - .pool -_0816B180: - bl EnableBothScriptContexts -_0816B184: - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_816B148 - - thumb_func_start sub_816B190 -sub_816B190: @ 816B190 - push {r4-r6,lr} - sub sp, 0x8 - adds r5, r1, 0 - lsls r0, 24 - lsrs r0, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - ldr r0, =gUnknown_085DFF24 - ldr r1, [r0, 0x14] - ldr r0, [r0, 0x10] - str r0, [sp] - str r1, [sp, 0x4] - ldr r6, =gUnknown_085DFEDC - adds r0, r6, 0 - movs r1, 0x4 - bl GetMaxWidthInMenuTable - lsls r0, 24 - ldr r2, =0x00ffffff - ldr r1, [sp] - ands r1, r2 - orrs r1, r0 - str r1, [sp] - mov r0, sp - bl AddWindow - strh r0, [r4, 0x8] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl SetStandardWindowBorderStyle - ldrb r0, [r4, 0x8] - movs r1, 0x4 - adds r2, r6, 0 - bl PrintMenuTable - ldrb r0, [r4, 0x8] - movs r1, 0x4 - adds r2, r5, 0 - bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - ldr r0, =gUnknown_085DFEA4 - lsls r5, 2 - adds r5, r0 - ldr r0, [r5] - bl sub_816B21C - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B190 - - thumb_func_start sub_816B21C -sub_816B21C: @ 816B21C - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - movs r0, 0 - movs r1, 0 - bl NewMenuHelpers_DrawDialogueFrame - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0 - bl PrintTextOnWindow - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_816B21C - - thumb_func_start sub_816B248 -sub_816B248: @ 816B248 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - bl GetMenuCursorPos - lsls r0, 24 - lsrs r5, r0, 24 - bl ProcessMenuInput - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl GetMenuCursorPos - lsls r0, 24 - lsrs r2, r0, 24 - lsls r4, 24 - asrs r4, 24 - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _0816B298 - adds r0, 0x1 - cmp r4, r0 - beq _0816B2B4 - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_085DFEDC - lsls r1, r4, 3 - adds r0, 0x4 - adds r1, r0 - ldr r1, [r1] - adds r0, r6, 0 - bl _call_via_r1 - b _0816B2C0 - .pool -_0816B298: - lsls r1, r5, 24 - lsls r0, r2, 24 - asrs r2, r0, 24 - cmp r1, r0 - beq _0816B2C0 - ldr r0, =gUnknown_085DFEA4 - lsls r1, r2, 2 - adds r1, r0 - ldr r0, [r1] - bl sub_816B21C - b _0816B2C0 - .pool -_0816B2B4: - movs r0, 0x5 - bl PlaySE - adds r0, r6, 0 - bl sub_816B4A4 -_0816B2C0: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_816B248 - - thumb_func_start sub_816B2C8 -sub_816B2C8: @ 816B2C8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldr r0, =sub_816B2F0 - str r0, [r1] - movs r0, 0x1 - movs r1, 0 - bl FadeScreen - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B2C8 - - thumb_func_start sub_816B2F0 -sub_816B2F0: @ 816B2F0 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0816B310 - bl overworld_free_bg_tilemaps - bl sub_81AAC14 - adds r0, r4, 0 - bl DestroyTask -_0816B310: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B2F0 - - thumb_func_start sub_816B31C -sub_816B31C: @ 816B31C - push {lr} - ldr r0, =gFieldCallback - ldr r1, =mapldr_080EBC0C - str r1, [r0] - ldr r0, =CB2_ReturnToField - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B31C - - thumb_func_start mapldr_080EBC0C -mapldr_080EBC0C: @ 816B33C - push {lr} - bl sub_81973A4 - movs r0, 0 - movs r1, 0x1 - bl NewMenuHelpers_DrawDialogueFrame - ldr r0, =sub_816B368 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - bl sub_816B190 - bl pal_fill_black - pop {r0} - bx r0 - .pool - thumb_func_end mapldr_080EBC0C - - thumb_func_start sub_816B368 -sub_816B368: @ 816B368 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_80ABDFC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0816B388 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_816B248 - str r0, [r1] -_0816B388: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B368 - - thumb_func_start sub_816B398 -sub_816B398: @ 816B398 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - bl sub_80D6CE4 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2] - cmp r0, 0 - beq _0816B3C4 - adds r0, r5, 0 - movs r1, 0 - bl sub_816B430 - b _0816B3D4 - .pool -_0816B3C4: - adds r0, r5, 0 - bl sub_816B4DC - ldr r1, =gText_NoItems - ldr r2, =task_pc_itemstorage - adds r0, r5, 0 - bl DisplayItemMessageOnField -_0816B3D4: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B398 - - thumb_func_start sub_816B3E4 -sub_816B3E4: @ 816B3E4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - bl sub_80D6CE4 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x2] - cmp r0, 0 - beq _0816B410 - adds r0, r5, 0 - movs r1, 0x1 - bl sub_816B430 - b _0816B420 - .pool -_0816B410: - adds r0, r5, 0 - bl sub_816B4DC - ldr r1, =gText_NoItems - ldr r2, =task_pc_itemstorage - adds r0, r5, 0 - bl DisplayItemMessageOnField -_0816B420: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B3E4 - - thumb_func_start sub_816B430 -sub_816B430: @ 816B430 - push {r4-r6,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r1, 24 - lsrs r1, 24 - lsls r5, r4, 2 - adds r5, r4 - lsls r5, 3 - ldr r6, =gTasks + 0x8 - adds r0, r5, r6 - strh r1, [r0, 0x6] - adds r0, r4, 0 - bl sub_816B4DC - ldr r1, =gUnknown_0203BCB8 - movs r0, 0 - strh r0, [r1] - strh r0, [r1, 0x2] - movs r0, 0xFF - strb r0, [r1, 0x9] - adds r0, r4, 0 - bl sub_816B4C0 - bl sub_816BC14 - bl gpu_pal_allocator_reset__manage_upper_four - bl LoadListMenuArrowsGfx - ldr r0, =gUnknown_0203BCC4 - ldr r0, [r0] - movs r1, 0xCD - lsls r1, 3 - adds r0, r1 - movs r1, 0x7 - bl sub_8122344 - movs r0, 0 - movs r1, 0 - bl sub_8197434 - subs r6, 0x8 - adds r5, r6 - ldr r0, =sub_816C158 - str r0, [r5] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B430 - - thumb_func_start sub_816B4A4 -sub_816B4A4: @ 816B4A4 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl sub_816B4DC - adds r0, r4, 0 - bl sub_816B060 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_816B4A4 - - thumb_func_start sub_816B4C0 -sub_816B4C0: @ 816B4C0 - push {lr} - ldr r1, =gUnknown_0203BCB8 - ldrb r0, [r1, 0x5] - cmp r0, 0x7 - bls _0816B4D4 - movs r0, 0x8 - b _0816B4D6 - .pool -_0816B4D4: - adds r0, 0x1 -_0816B4D6: - strb r0, [r1, 0x4] - pop {r0} - bx r0 - thumb_func_end sub_816B4C0 - - thumb_func_start sub_816B4DC -sub_816B4DC: @ 816B4DC - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - ldrb r0, [r4, 0x8] - movs r1, 0 - bl sub_8198070 - ldrb r0, [r4, 0x8] - bl ClearWindowTilemap - ldrb r0, [r4, 0x8] - bl RemoveWindow - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B4DC - - thumb_func_start sub_816B510 -sub_816B510: @ 816B510 - push {r4,lr} - movs r2, 0 - movs r1, 0x6 - ldr r0, =gSaveBlock1Ptr - ldr r3, [r0] - movs r4, 0xB0 - lsls r4, 6 -_0816B51E: - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r3, r0 - adds r0, r4 - ldrh r0, [r0] - cmp r0, 0 - beq _0816B534 - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 -_0816B534: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xF - bls _0816B51E - adds r0, r2, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_816B510 - - thumb_func_start sub_816B54C -sub_816B54C: @ 816B54C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x24 - movs r2, 0x6 -_0816B55A: - adds r1, r2, 0x1 - lsls r0, r1, 24 - lsrs r4, r0, 24 - mov r8, r1 - cmp r4, 0xF - bhi _0816B5D4 - ldr r0, =gSaveBlock1Ptr - mov r10, r0 - lsls r0, r2, 3 - adds r0, r2 - lsls r0, 2 - mov r12, r0 - ldr r6, =0x00002be0 -_0816B574: - mov r1, r10 - ldr r1, [r1] - mov r9, r1 - mov r2, r9 - add r2, r12 - movs r3, 0xB0 - lsls r3, 6 - adds r0, r2, r3 - ldrh r0, [r0] - cmp r0, 0 - bne _0816B5CA - adds r2, r6 - mov r1, sp - adds r0, r2, 0 - ldm r0!, {r3,r5,r7} - stm r1!, {r3,r5,r7} - ldm r0!, {r3,r5,r7} - stm r1!, {r3,r5,r7} - ldm r0!, {r3,r5,r7} - stm r1!, {r3,r5,r7} - lsls r3, r4, 3 - adds r3, r4 - lsls r3, 2 - mov r5, r9 - adds r0, r5, r3 - adds r0, r6 - ldm r0!, {r1,r5,r7} - stm r2!, {r1,r5,r7} - ldm r0!, {r1,r5,r7} - stm r2!, {r1,r5,r7} - ldm r0!, {r1,r5,r7} - stm r2!, {r1,r5,r7} - mov r7, r10 - ldr r1, [r7] - adds r1, r3 - adds r1, r6 - mov r0, sp - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldm r0!, {r2,r3,r7} - stm r1!, {r2,r3,r7} - ldm r0!, {r2,r5,r7} - stm r1!, {r2,r5,r7} -_0816B5CA: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xF - bls _0816B574 -_0816B5D4: - mov r3, r8 - lsls r0, r3, 24 - lsrs r2, r0, 24 - cmp r2, 0xE - bls _0816B55A - add sp, 0x24 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B54C - - thumb_func_start sub_816B5F8 -sub_816B5F8: @ 816B5F8 - push {r4-r6,lr} - sub sp, 0xC - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - movs r0, 0 - bl sub_81D1C84 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - bl sub_81D1C84 - ldr r6, =gText_Mailbox - movs r0, 0x1 - adds r1, r6, 0 - movs r2, 0x40 - bl GetStringCenterAlignXOffset - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - adds r0, r4, 0 - movs r1, 0x1 - adds r2, r6, 0 - bl PrintTextOnWindow - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - ldr r4, =gUnknown_0203BCB8 - adds r0, r4, 0 - bl sub_81D1DC0 - ldr r2, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r2 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1, 0x12] - adds r0, r4, 0 - bl sub_81D1E90 - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B5F8 - - thumb_func_start sub_816B674 -sub_816B674: @ 816B674 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - mov r9, r0 - ldr r0, =gTasks + 0x8 - mov r10, r0 - mov r4, r9 - add r4, r10 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0816B71E - ldrb r0, [r4, 0xA] - bl ListMenuHandleInputGetItemId - adds r6, r0, 0 - ldrb r0, [r4, 0xA] - ldr r7, =gUnknown_0203BCBA - subs r1, r7, 0x2 - mov r8, r1 - adds r1, r7, 0 - mov r2, r8 - bl ListMenuGetScrollAndRow - movs r0, 0x2 - negs r0, r0 - cmp r6, r0 - beq _0816B6D4 - adds r0, 0x1 - cmp r6, r0 - bne _0816B6EA - b _0816B71E - .pool -_0816B6D4: - movs r0, 0x5 - bl PlaySE - mov r1, r8 - ldrb r0, [r1, 0x9] - bl RemoveScrollIndicatorArrowPair - adds r0, r5, 0 - bl sub_816B798 - b _0816B71E -_0816B6EA: - movs r0, 0x5 - bl PlaySE - movs r0, 0 - bl sub_81D1D04 - movs r0, 0x1 - bl sub_81D1D04 - ldrb r0, [r4, 0xA] - adds r1, r7, 0 - mov r2, r8 - bl DestroyListMenuTask - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - mov r1, r8 - ldrb r0, [r1, 0x9] - bl RemoveScrollIndicatorArrowPair - mov r0, r10 - subs r0, 0x8 - add r0, r9 - ldr r1, =sub_816B730 - str r1, [r0] -_0816B71E: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B674 - - thumb_func_start sub_816B730 -sub_816B730: @ 816B730 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =gStringVar1 - ldr r2, =gSaveBlock1Ptr - ldr r1, =gUnknown_0203BCB8 - ldrh r0, [r1] - adds r0, 0x6 - ldrh r1, [r1, 0x2] - adds r0, r1 - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - ldr r0, [r2] - adds r1, r0 - ldr r0, =0x00002bf2 - adds r1, r0 - adds r0, r5, 0 - bl StringCopy - adds r0, r5, 0 - movs r1, 0 - bl sub_81DB554 - ldr r5, =gStringVar4 - ldr r1, =gText_WhatToDoWithVar1sMail - adds r0, r5, 0 - bl StringExpandPlaceholders - ldr r2, =sub_816B7DC - adds r0, r4, 0 - adds r1, r5, 0 - bl DisplayItemMessageOnField - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B730 - - thumb_func_start sub_816B798 -sub_816B798: @ 816B798 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - movs r0, 0 - bl sub_81D1D04 - movs r0, 0x1 - bl sub_81D1D04 - ldrb r0, [r4, 0xA] - movs r1, 0 - movs r2, 0 - bl DestroyListMenuTask - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - bl sub_81D1EC0 - adds r0, r5, 0 - bl sub_816B060 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B798 - - thumb_func_start sub_816B7DC -sub_816B7DC: @ 816B7DC - push {r4,r5,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - movs r0, 0x2 - bl sub_81D1C84 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r2, =gUnknown_085DFF04 - adds r0, r4, 0 - movs r1, 0x4 - bl PrintMenuTable - adds r0, r4, 0 - movs r1, 0x4 - movs r2, 0 - bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_816B82C - str r1, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B7DC - - thumb_func_start sub_816B82C -sub_816B82C: @ 816B82C - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r6, r5, 0 - bl ProcessMenuInput_other - lsls r0, 24 - asrs r4, r0, 24 - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _0816B86E - adds r0, 0x1 - cmp r4, r0 - bne _0816B858 - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - bl sub_816BBD4 - b _0816B86E -_0816B858: - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_085DFF04 - lsls r1, r4, 3 - adds r0, 0x4 - adds r1, r0 - ldr r1, [r1] - adds r0, r6, 0 - bl _call_via_r1 -_0816B86E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B82C - - thumb_func_start sub_816B878 -sub_816B878: @ 816B878 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - movs r1, 0 - bl FadeScreen - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_816B8A4 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B878 - - thumb_func_start sub_816B8A4 -sub_816B8A4: @ 816B8A4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0816B8E6 - bl sub_81D1EC0 - bl overworld_free_bg_tilemaps - ldr r2, =gSaveBlock1Ptr - ldr r1, =gUnknown_0203BCB8 - ldrh r0, [r1] - adds r0, 0x6 - ldrh r1, [r1, 0x2] - adds r0, r1 - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - ldr r0, =0x00002be0 - adds r1, r0 - ldr r0, [r2] - adds r0, r1 - ldr r1, =sub_816B900 - movs r2, 0x1 - bl ReadMail - adds r0, r4, 0 - bl DestroyTask -_0816B8E6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B8A4 - - thumb_func_start sub_816B900 -sub_816B900: @ 816B900 - push {lr} - ldr r0, =gFieldCallback - ldr r1, =pal_fill_for_maplights_or_black - str r1, [r0] - ldr r0, =CB2_ReturnToField - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B900 - - thumb_func_start pal_fill_for_maplights_or_black -pal_fill_for_maplights_or_black: @ 816B920 - push {r4,lr} - bl sub_81973A4 - ldr r0, =task00_080EBBDC - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gUnknown_0203BCB8 - ldrb r0, [r0, 0x5] - bl sub_81D1C44 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0816B954 - adds r0, r4, 0 - bl sub_816B5F8 - b _0816B95A - .pool -_0816B954: - adds r0, r4, 0 - bl DestroyTask -_0816B95A: - bl pal_fill_black - pop {r4} - pop {r0} - bx r0 - thumb_func_end pal_fill_for_maplights_or_black - - thumb_func_start task00_080EBBDC -task00_080EBBDC: @ 816B964 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_80ABDFC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0816B984 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_816B674 - str r0, [r1] -_0816B984: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task00_080EBBDC - - thumb_func_start sub_816B994 -sub_816B994: @ 816B994 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gText_MessageWillBeLost - ldr r2, =sub_816B9B0 - bl DisplayItemMessageOnField - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B994 - - thumb_func_start sub_816B9B0 -sub_816B9B0: @ 816B9B0 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_8197930 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_816B9D8 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816B9B0 - - thumb_func_start sub_816B9D8 -sub_816B9D8: @ 816B9D8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl ProcessMenuInputNoWrap_ - lsls r0, 24 - asrs r0, 24 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - beq _0816BA04 - cmp r0, r1 - ble _0816BA10 - cmp r0, 0 - beq _0816B9FC - cmp r0, 0x1 - beq _0816BA0A - b _0816BA10 -_0816B9FC: - adds r0, r4, 0 - bl sub_816BA18 - b _0816BA10 -_0816BA04: - movs r0, 0x5 - bl PlaySE -_0816BA0A: - adds r0, r4, 0 - bl sub_816BAAC -_0816BA10: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_816B9D8 - - thumb_func_start sub_816BA18 -sub_816BA18: @ 816BA18 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r2, =gSaveBlock1Ptr - ldr r4, =gUnknown_0203BCB8 - ldrh r1, [r4] - adds r1, 0x6 - ldrh r0, [r4, 0x2] - adds r1, r0 - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =0x00002be0 - adds r0, r1 - ldr r1, [r2] - adds r5, r1, r0 - ldrh r0, [r5, 0x20] - movs r1, 0x1 - bl AddBagItem - lsls r0, 24 - cmp r0, 0 - bne _0816BA68 - ldr r1, =gText_BagIsFull - ldr r2, =sub_816BBD4 - adds r0, r6, 0 - bl DisplayItemMessageOnField - b _0816BA9C - .pool -_0816BA68: - ldr r1, =gText_MailToBagMessageErased - ldr r2, =sub_816BBD4 - adds r0, r6, 0 - bl DisplayItemMessageOnField - adds r0, r5, 0 - bl ClearMailStruct - bl sub_816B54C - ldrb r0, [r4, 0x5] - subs r0, 0x1 - strb r0, [r4, 0x5] - ldrb r1, [r4, 0x5] - ldrb r0, [r4, 0x4] - ldrh r2, [r4, 0x2] - adds r0, r2 - cmp r1, r0 - bge _0816BA96 - cmp r2, 0 - beq _0816BA96 - subs r0, r2, 0x1 - strh r0, [r4, 0x2] -_0816BA96: - adds r0, r6, 0 - bl sub_816B4C0 -_0816BA9C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816BA18 - - thumb_func_start sub_816BAAC -sub_816BAAC: @ 816BAAC - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl sub_816BBD4 - pop {r0} - bx r0 - thumb_func_end sub_816BAAC - - thumb_func_start sub_816BABC -sub_816BABC: @ 816BABC - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl CalculatePlayerPartyCount - lsls r0, 24 - cmp r0, 0 - bne _0816BAD4 - adds r0, r4, 0 - bl sub_816BBB8 - b _0816BAEA -_0816BAD4: - movs r0, 0x1 - movs r1, 0 - bl FadeScreen - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_816BAF8 - str r0, [r1] -_0816BAEA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816BABC - - thumb_func_start sub_816BAF8 -sub_816BAF8: @ 816BAF8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0816BB1C - bl sub_81D1EC0 - bl overworld_free_bg_tilemaps - bl sub_81B8448 - adds r0, r4, 0 - bl DestroyTask -_0816BB1C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816BAF8 - - thumb_func_start sub_816BB28 -sub_816BB28: @ 816BB28 - push {lr} - ldr r0, =gFieldCallback - ldr r1, =sub_816BB48 - str r1, [r0] - ldr r0, =CB2_ReturnToField - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_816BB28 - - thumb_func_start sub_816BB48 -sub_816BB48: @ 816BB48 - push {r4-r6,lr} - ldr r0, =task00_080EBBDC - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r6, r0, 24 - ldr r5, =gUnknown_0203BCB8 - ldrb r4, [r5, 0x5] - bl sub_816B510 - strb r0, [r5, 0x5] - bl sub_816B54C - ldrb r0, [r5, 0x5] - cmp r4, r0 - beq _0816BB7E - ldrb r1, [r5, 0x5] - ldrb r0, [r5, 0x4] - ldrh r2, [r5, 0x2] - adds r0, r2 - cmp r1, r0 - bge _0816BB7E - cmp r2, 0 - beq _0816BB7E - subs r0, r2, 0x1 - strh r0, [r5, 0x2] -_0816BB7E: - adds r0, r6, 0 - bl sub_816B4C0 - bl sub_81973A4 - ldr r0, =gUnknown_0203BCB8 - ldrb r0, [r0, 0x5] - bl sub_81D1C44 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0816BBA8 - adds r0, r6, 0 - bl sub_816B5F8 - b _0816BBAE - .pool -_0816BBA8: - adds r0, r6, 0 - bl DestroyTask -_0816BBAE: - bl pal_fill_black - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_816BB48 - - thumb_func_start sub_816BBB8 -sub_816BBB8: @ 816BBB8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gText_NoPokemon - ldr r2, =sub_816BBD4 - bl DisplayItemMessageOnField - pop {r0} - bx r0 - .pool - thumb_func_end sub_816BBB8 - - thumb_func_start sub_816BBD4 -sub_816BBD4: @ 816BBD4 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x2 - bl sub_81D1D04 - movs r0, 0 - movs r1, 0 - bl sub_8197434 - adds r0, r4, 0 - bl sub_816B5F8 - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_816B674 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816BBD4 - - thumb_func_start sub_816BC14 -sub_816BC14: @ 816BC14 - push {r4,lr} - ldr r4, =gUnknown_0203BCC4 - movs r0, 0xCE - lsls r0, 3 - bl AllocZeroed - str r0, [r4] - movs r1, 0xCC - lsls r1, 3 - adds r0, r1 - movs r1, 0xFF - movs r2, 0x6 - bl memset - ldr r0, [r4] - ldr r1, =0x00000666 - adds r0, r1 - movs r1, 0xFF - strb r1, [r0] - ldr r0, [r4] - ldr r1, =0x00000667 - adds r0, r1 - movs r1, 0x1 - negs r1, r1 - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816BC14 - - thumb_func_start sub_816BC58 -sub_816BC58: @ 816BC58 - push {r4,lr} - movs r4, 0 -_0816BC5C: - lsls r0, r4, 24 - lsrs r0, 24 - bl sub_816BCC4 - adds r4, 0x1 - cmp r4, 0x5 - bls _0816BC5C - ldr r0, =gUnknown_0203BCC4 - ldr r0, [r0] - bl Free - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816BC58 - - thumb_func_start sub_816BC7C -sub_816BC7C: @ 816BC7C - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gUnknown_0203BCC4 - movs r3, 0xCC - lsls r3, 3 - adds r1, r2, r3 - ldr r0, [r0] - adds r4, r0, r1 - ldrb r0, [r4] - cmp r0, 0xFF - bne _0816BCB4 - lsls r0, r2, 3 - ldr r1, =gUnknown_085DFF5C - adds r0, r1 - bl AddWindow - strb r0, [r4] - ldrb r0, [r4] - movs r2, 0x85 - lsls r2, 2 - movs r1, 0 - movs r3, 0xE - bl SetWindowBorderStyle - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram -_0816BCB4: - ldrb r0, [r4] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_816BC7C - - thumb_func_start sub_816BCC4 -sub_816BCC4: @ 816BCC4 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203BCC4 - movs r2, 0xCC - lsls r2, 3 - adds r0, r2 - ldr r1, [r1] - adds r4, r1, r0 - ldrb r0, [r4] - cmp r0, 0xFF - beq _0816BCF8 - movs r1, 0 - bl sub_8198070 - ldrb r0, [r4] - bl ClearWindowTilemap - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - ldrb r0, [r4] - bl RemoveWindow - movs r0, 0xFF - strb r0, [r4] -_0816BCF8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816BCC4 - - thumb_func_start sub_816BD04 -sub_816BD04: @ 816BD04 - push {r4-r6,lr} - movs r6, 0 - ldr r0, =gUnknown_0203BCB8 - ldrb r0, [r0, 0x5] - subs r0, 0x1 - cmp r6, r0 - bge _0816BD58 - ldr r5, =gUnknown_0203BCC4 -_0816BD14: - lsls r4, r6, 1 - adds r4, r6 - lsls r4, 3 - movs r0, 0xCC - lsls r0, 1 - adds r4, r0 - ldr r0, [r5] - adds r0, r4 - ldr r1, =gSaveBlock1Ptr - ldr r1, [r1] - lsls r2, r6, 2 - adds r1, r2 - movs r2, 0x93 - lsls r2, 3 - adds r1, r2 - ldrh r1, [r1] - bl sub_816BDC8 - ldr r0, [r5] - lsls r2, r6, 3 - adds r1, r0, r2 - adds r4, r0, r4 - str r4, [r1] - adds r0, 0x4 - adds r0, r2 - str r6, [r0] - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - ldr r0, =gUnknown_0203BCB8 - ldrb r0, [r0, 0x5] - subs r0, 0x1 - cmp r6, r0 - blt _0816BD14 -_0816BD58: - ldr r5, =gUnknown_0203BCC4 - lsls r4, r6, 1 - adds r4, r6 - lsls r4, 3 - movs r3, 0xCC - lsls r3, 1 - adds r4, r3 - ldr r0, [r5] - adds r0, r4 - ldr r1, =gText_Cancel2 - bl StringCopy - ldr r0, [r5] - lsls r2, r6, 3 - adds r1, r0, r2 - adds r4, r0, r4 - str r4, [r1] - adds r0, 0x4 - adds r0, r2 - movs r1, 0x2 - negs r1, r1 - str r1, [r0] - ldr r4, =gMultiuseListMenuTemplate - adds r1, r4, 0 - ldr r0, =gUnknown_085DFF44 - ldm r0!, {r2,r3,r6} - stm r1!, {r2,r3,r6} - ldm r0!, {r2,r3,r6} - stm r1!, {r2,r3,r6} - movs r0, 0 - bl sub_816BC7C - strb r0, [r4, 0x10] - ldr r1, =gUnknown_0203BCB8 - ldrb r0, [r1, 0x5] - strh r0, [r4, 0xC] - ldr r0, [r5] - str r0, [r4] - ldrb r0, [r1, 0x4] - strh r0, [r4, 0xE] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816BD04 - - thumb_func_start sub_816BDC8 -sub_816BDC8: @ 816BDC8 - push {lr} - adds r2, r0, 0 - lsls r0, r1, 16 - lsrs r0, 16 - adds r1, r2, 0 - bl CopyItemName - pop {r0} - bx r0 - thumb_func_end sub_816BDC8 - - thumb_func_start sub_816BDDC -sub_816BDDC: @ 816BDDC - push {r4,lr} - adds r4, r0, 0 - lsls r1, 24 - lsrs r1, 24 - cmp r1, 0x1 - beq _0816BDEE - movs r0, 0x5 - bl PlaySE -_0816BDEE: - ldr r0, =gUnknown_0203BCC4 - ldr r0, [r0] - ldr r1, =0x00000666 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0xFF - bne _0816BE38 - bl sub_816C0C8 - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _0816BE2C - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - lsls r1, r4, 2 - adds r0, r1 - movs r1, 0x93 - lsls r1, 3 - adds r0, r1 - ldrh r0, [r0] - bl sub_816C060 - b _0816BE32 - .pool -_0816BE2C: - ldr r0, =0x0000ffff - bl sub_816C060 -_0816BE32: - adds r0, r4, 0 - bl sub_816BEF0 -_0816BE38: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816BDDC - - thumb_func_start fish4_goto_x5_or_x6 -fish4_goto_x5_or_x6: @ 816BE44 - push {r4-r6,lr} - sub sp, 0xC - adds r4, r1, 0 - lsls r0, 24 - lsrs r6, r0, 24 - lsls r2, 24 - lsrs r5, r2, 24 - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _0816BED4 - ldr r0, =gUnknown_0203BCC4 - ldr r0, [r0] - ldr r1, =0x00000666 - adds r0, r1 - ldrb r1, [r0] - cmp r1, 0xFF - beq _0816BE8E - lsls r0, r4, 24 - lsrs r0, 24 - cmp r1, r0 - bne _0816BE84 - adds r0, r5, 0 - movs r1, 0 - movs r2, 0xFF - bl sub_816BFE0 - b _0816BE8E - .pool -_0816BE84: - adds r0, r5, 0 - movs r1, 0xFF - movs r2, 0xFF - bl sub_816BFE0 -_0816BE8E: - ldr r0, =gStringVar1 - ldr r1, =gSaveBlock1Ptr - ldr r1, [r1] - lsls r2, r4, 2 - adds r1, r2 - ldr r2, =0x0000049a - adds r1, r2 - ldrh r1, [r1] - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_xVar1 - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0x7 - adds r1, r4, 0 - movs r2, 0x68 - bl GetStringRightAlignXOffset - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - str r5, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - adds r0, r6, 0 - movs r1, 0x7 - adds r2, r4, 0 - bl PrintTextOnWindow -_0816BED4: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end fish4_goto_x5_or_x6 - - thumb_func_start sub_816BEF0 -sub_816BEF0: @ 816BEF0 - push {r4,r5,lr} - sub sp, 0xC - adds r1, r0, 0 - ldr r0, =gUnknown_0203BCC4 - ldr r0, [r0] - ldr r2, =0x00000661 - adds r0, r2 - ldrb r5, [r0] - movs r0, 0x2 - negs r0, r0 - cmp r1, r0 - beq _0816BF2C - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - lsls r1, 2 - adds r0, r1 - movs r1, 0x93 - lsls r1, 3 - adds r0, r1 - ldrh r0, [r0] - bl ItemId_GetDescription - b _0816BF32 - .pool -_0816BF2C: - ldr r0, =0x0000ffff - bl sub_816C228 -_0816BF32: - adds r4, r0, 0 - adds r0, r5, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0 - bl PrintTextOnWindow - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816BEF0 - - thumb_func_start sub_816BF60 -sub_816BF60: @ 816BF60 - push {r4,lr} - sub sp, 0x10 - ldr r4, =gUnknown_0203BCB8 - ldrb r0, [r4, 0x9] - cmp r0, 0xFF - bne _0816BF8C - ldrb r0, [r4, 0x5] - ldrb r1, [r4, 0x4] - subs r0, r1 - str r0, [sp] - ldr r0, =0x000013f8 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - adds r0, r4, 0x2 - str r0, [sp, 0xC] - movs r0, 0x2 - movs r1, 0xB0 - movs r2, 0xC - movs r3, 0x94 - bl AddScrollIndicatorArrowPairParametrized - strb r0, [r4, 0x9] -_0816BF8C: - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816BF60 - - thumb_func_start sub_816BF9C -sub_816BF9C: @ 816BF9C - push {r4,lr} - ldr r4, =gUnknown_0203BCB8 - ldrb r0, [r4, 0x9] - cmp r0, 0xFF - beq _0816BFAE - bl RemoveScrollIndicatorArrowPair - movs r0, 0xFF - strb r0, [r4, 0x9] -_0816BFAE: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816BF9C - - thumb_func_start sub_816BFB8 -sub_816BFB8: @ 816BFB8 - push {r4,r5,lr} - adds r4, r1, 0 - adds r5, r2, 0 - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - bl ListMenuGetYCoordForPrintingArrowCursor - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_816BFE0 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_816BFB8 - - thumb_func_start sub_816BFE0 -sub_816BFE0: @ 816BFE0 - push {r4-r6,lr} - sub sp, 0x14 - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r1, 24 - lsls r2, 24 - lsrs r2, 24 - ldr r0, =gUnknown_0203BCC4 - ldr r0, [r0] - movs r3, 0xCC - lsls r3, 3 - adds r0, r3 - ldrb r5, [r0] - cmp r1, 0xFF - bne _0816C030 - movs r0, 0x1 - movs r1, 0 - bl GetMenuCursorDimensionByFont - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - movs r1, 0x1 - bl GetMenuCursorDimensionByFont - lsls r0, 24 - lsrs r0, 24 - str r4, [sp] - str r0, [sp, 0x4] - adds r0, r5, 0 - movs r1, 0x11 - movs r2, 0 - adds r3, r6, 0 - bl FillWindowPixelRect - b _0816C050 - .pool -_0816C030: - movs r0, 0 - str r0, [sp] - str r0, [sp, 0x4] - ldr r0, =gUnknown_085DFF8C - str r0, [sp, 0x8] - lsls r0, r2, 24 - asrs r0, 24 - str r0, [sp, 0xC] - ldr r0, =gText_SelectorArrow2 - str r0, [sp, 0x10] - adds r0, r5, 0 - movs r1, 0x1 - movs r2, 0 - adds r3, r6, 0 - bl AddTextPrinterParameterized2 -_0816C050: - add sp, 0x14 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816BFE0 - - thumb_func_start sub_816C060 -sub_816C060: @ 816C060 - push {r4-r6,lr} - lsls r0, 16 - lsrs r6, r0, 16 - ldr r0, =gUnknown_0203BCC4 - ldr r0, [r0] - ldr r1, =0x00000667 - adds r5, r0, r1 - ldrb r0, [r5] - cmp r0, 0xFF - bne _0816C0B2 - ldr r4, =0x000013f6 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - adds r0, r4, 0 - adds r1, r4, 0 - adds r2, r6, 0 - bl AddItemIconSprite - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x40 - beq _0816C0B2 - strb r2, [r5] - ldr r0, =gSprites - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x5] - movs r0, 0x18 - strh r0, [r1, 0x24] - movs r0, 0x50 - strh r0, [r1, 0x26] -_0816C0B2: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816C060 - - thumb_func_start sub_816C0C8 -sub_816C0C8: @ 816C0C8 - push {r4,r5,lr} - ldr r0, =gUnknown_0203BCC4 - ldr r0, [r0] - ldr r1, =0x00000667 - adds r5, r0, r1 - ldrb r0, [r5] - cmp r0, 0xFF - beq _0816C0FA - ldr r4, =0x000013f6 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag - ldrb r1, [r5] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - movs r0, 0xFF - strb r0, [r5] -_0816C0FA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816C0C8 - - thumb_func_start sub_816C110 -sub_816C110: @ 816C110 - push {lr} - sub sp, 0x4 - bl sub_80D6E84 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - movs r1, 0x93 - lsls r1, 3 - adds r0, r1 - ldr r2, =gUnknown_0203BCBC - adds r3, r2, 0x1 - movs r1, 0x8 - str r1, [sp] - movs r1, 0x32 - bl sub_812220C - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_816C110 - - thumb_func_start sub_816C140 -sub_816C140: @ 816C140 - push {lr} - ldr r0, =gUnknown_0203BCBA - subs r1, r0, 0x2 - ldrb r2, [r1, 0x4] - ldrb r3, [r1, 0x5] - bl sub_812225C - pop {r0} - bx r0 - .pool - thumb_func_end sub_816C140 - - thumb_func_start sub_816C158 -sub_816C158: @ 816C158 - push {r4-r7,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r7, r0, r1 - movs r4, 0 -_0816C16C: - lsls r0, r4, 24 - lsrs r0, 24 - bl sub_816BC7C - adds r4, 0x1 - cmp r4, 0x3 - bls _0816C16C - movs r1, 0x6 - ldrsh r0, [r7, r1] - ldr r5, =gText_TossItem - cmp r0, 0 - bne _0816C186 - ldr r5, =gText_WithdrawItem -_0816C186: - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x68 - bl GetStringCenterAlignXOffset - adds r3, r0, 0 - ldr r4, =gUnknown_0203BCC4 - ldr r0, [r4] - ldr r1, =0x00000663 - adds r0, r1 - ldrb r0, [r0] - lsls r3, 24 - lsrs r3, 24 - movs r1, 0x1 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r5, 0 - bl PrintTextOnWindow - ldr r0, [r4] - ldr r1, =0x00000662 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - bl sub_816C110 - bl sub_816C140 - bl sub_816BD04 - ldr r0, =gMultiuseListMenuTemplate - ldr r2, =gUnknown_0203BCB8 - ldrh r1, [r2, 0x2] - ldrh r2, [r2] - bl ListMenuInit - lsls r0, 24 - lsrs r0, 24 - strh r0, [r7, 0xA] - bl sub_816BF60 - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_816C30C - str r1, [r0] - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816C158 - - thumb_func_start sub_816C228 -sub_816C228: @ 816C228 - push {lr} - lsls r0, 16 - lsrs r1, r0, 16 - ldr r2, =0xffff0009 - adds r0, r1, r2 - cmp r0, 0x8 - bhi _0816C2B4 - lsls r0, 2 - ldr r1, =_0816C248 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0816C248: - .4byte _0816C2AC - .4byte _0816C2A4 - .4byte _0816C29C - .4byte _0816C294 - .4byte _0816C28C - .4byte _0816C284 - .4byte _0816C27C - .4byte _0816C274 - .4byte _0816C26C -_0816C26C: - ldr r0, =gText_GoBackPrevMenu - b _0816C2BA - .pool -_0816C274: - ldr r0, =gText_WithdrawHowManyItems - b _0816C2BA - .pool -_0816C27C: - ldr r0, =gText_WithdrawXItems - b _0816C2BA - .pool -_0816C284: - ldr r0, =gText_TossHowManyVar1s - b _0816C2BA - .pool -_0816C28C: - ldr r0, =gText_ThrewAwayVar2Var1s - b _0816C2BA - .pool -_0816C294: - ldr r0, =gText_NoRoomInBag - b _0816C2BA - .pool -_0816C29C: - ldr r0, =gText_TooImportantToToss - b _0816C2BA - .pool -_0816C2A4: - ldr r0, =gText_ConfirmTossItems - b _0816C2BA - .pool -_0816C2AC: - ldr r0, =gText_MoveVar1Where - b _0816C2BA - .pool -_0816C2B4: - adds r0, r1, 0 - bl ItemId_GetDescription -_0816C2BA: - pop {r1} - bx r1 - thumb_func_end sub_816C228 - - thumb_func_start sub_816C2C0 -sub_816C2C0: @ 816C2C0 - push {r4-r6,lr} - sub sp, 0xC - adds r6, r0, 0 - ldr r0, =gUnknown_0203BCC4 - ldr r0, [r0] - ldr r1, =0x00000661 - adds r0, r1 - ldrb r5, [r0] - adds r0, r5, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r4, =gStringVar4 - adds r0, r4, 0 - adds r1, r6, 0 - bl StringExpandPlaceholders - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0 - bl PrintTextOnWindow - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816C2C0 - - thumb_func_start sub_816C30C -sub_816C30C: @ 816C30C - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0816C35C - ldrb r0, [r4, 0xA] - ldr r1, =gUnknown_0203BCBA - subs r4, r1, 0x2 - adds r2, r4, 0 - bl ListMenuGetScrollAndRow - ldrh r1, [r4, 0x2] - ldrh r0, [r4] - adds r1, r0 - ldrb r0, [r4, 0x5] - subs r0, 0x1 - cmp r1, r0 - beq _0816C39E - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - bl sub_816C450 - b _0816C39E - .pool -_0816C35C: - ldrb r0, [r4, 0xA] - bl ListMenuHandleInputGetItemId - adds r6, r0, 0 - ldrb r0, [r4, 0xA] - ldr r1, =gUnknown_0203BCBA - subs r2, r1, 0x2 - bl ListMenuGetScrollAndRow - movs r0, 0x2 - negs r0, r0 - cmp r6, r0 - beq _0816C384 - adds r0, 0x1 - cmp r6, r0 - bne _0816C392 - b _0816C39E - .pool -_0816C384: - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - bl sub_816C400 - b _0816C39E -_0816C392: - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - bl sub_816C71C -_0816C39E: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_816C30C - - thumb_func_start bx_battle_menu_t3 -bx_battle_menu_t3: @ 816C3A4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0816C3F2 - movs r0, 0 - movs r1, 0 - bl NewMenuHelpers_DrawDialogueFrame - movs r1, 0x6 - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _0816C3DC - adds r0, r4, 0 - movs r1, 0 - bl sub_816B190 - b _0816C3E4 - .pool -_0816C3DC: - adds r0, r4, 0 - movs r1, 0x2 - bl sub_816B190 -_0816C3E4: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_816B248 - str r0, [r1] -_0816C3F2: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end bx_battle_menu_t3 - - thumb_func_start sub_816C400 -sub_816C400: @ 816C400 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r6, =gTasks + 0x8 - adds r5, r4, r6 - bl sub_816C0C8 - bl sub_816BF9C - ldrb r0, [r5, 0xA] - movs r1, 0 - movs r2, 0 - bl DestroyListMenuTask - ldr r0, =gUnknown_0203BCC4 - ldr r0, [r0] - movs r1, 0xCD - lsls r1, 3 - adds r0, r1 - movs r1, 0x7 - bl sub_81223B0 - bl sub_816BC58 - subs r6, 0x8 - adds r4, r6 - ldr r0, =bx_battle_menu_t3 - str r0, [r4] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816C400 - - thumb_func_start sub_816C450 -sub_816C450: @ 816C450 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - mov r8, r0 - adds r1, r4, 0 - add r1, r8 - mov r9, r1 - ldrb r0, [r1, 0xA] - movs r1, 0x10 - movs r2, 0x1 - bl sub_81AF15C - ldr r6, =gUnknown_0203BCC4 - ldr r2, [r6] - ldr r1, =gUnknown_0203BCB8 - ldrb r0, [r1] - ldrb r1, [r1, 0x2] - adds r0, r1 - ldr r5, =0x00000666 - adds r2, r5 - strb r0, [r2] - mov r1, r9 - ldrb r0, [r1, 0xA] - movs r1, 0 - movs r2, 0 - bl sub_816BFB8 - ldr r0, [r6] - adds r0, r5 - ldrb r0, [r0] - bl sub_816C690 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r0, [r6] - adds r0, r5 - ldrb r0, [r0] - lsls r0, 2 - adds r1, r0 - movs r0, 0x93 - lsls r0, 3 - adds r1, r0 - ldrh r0, [r1] - ldr r1, =gStringVar1 - bl CopyItemName - ldr r0, =0x0000fff7 - bl sub_816C228 - bl sub_816C2C0 - movs r1, 0x8 - negs r1, r1 - add r8, r1 - add r4, r8 - ldr r0, =sub_816C4FC - str r0, [r4] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816C450 - - thumb_func_start sub_816C4FC -sub_816C4FC: @ 816C4FC - push {r4-r7,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldr r7, =gMain - ldrh r1, [r7, 0x2E] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0816C530 - ldrb r0, [r4, 0xA] - ldr r1, =gUnknown_0203BCBA - subs r2, r1, 0x2 - bl ListMenuGetScrollAndRow - b _0816C57E - .pool -_0816C530: - ldrb r0, [r4, 0xA] - bl ListMenuHandleInputGetItemId - adds r6, r0, 0 - ldrb r0, [r4, 0xA] - ldr r1, =gUnknown_0203BCBA - subs r4, r1, 0x2 - adds r2, r4, 0 - bl ListMenuGetScrollAndRow - ldr r0, =gUnknown_0203BCC4 - ldr r0, [r0] - movs r1, 0xCD - lsls r1, 3 - adds r0, r1 - movs r1, 0x7 - movs r2, 0 - bl sub_81223FC - ldrb r0, [r4] - bl sub_816C690 - movs r0, 0x2 - negs r0, r0 - cmp r6, r0 - beq _0816C574 - adds r0, 0x1 - cmp r6, r0 - bne _0816C592 - b _0816C59A - .pool -_0816C574: - ldrh r1, [r7, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0816C588 -_0816C57E: - adds r0, r5, 0 - movs r1, 0 - bl sub_816C5A0 - b _0816C59A -_0816C588: - adds r0, r5, 0 - movs r1, 0x1 - bl sub_816C5A0 - b _0816C59A -_0816C592: - adds r0, r5, 0 - movs r1, 0 - bl sub_816C5A0 -_0816C59A: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_816C4FC - - thumb_func_start sub_816C5A0 -sub_816C5A0: @ 816C5A0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r1, 0 - lsls r0, 24 - lsrs r7, r0, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r0, r1 - mov r8, r0 - ldr r4, =gUnknown_0203BCB8 - ldrh r0, [r4] - ldrh r1, [r4, 0x2] - adds r0, r1 - lsls r0, 16 - lsrs r6, r0, 16 - movs r0, 0x5 - bl PlaySE - mov r2, r8 - ldrb r0, [r2, 0xA] - adds r1, r4, 0x2 - adds r2, r4, 0 - bl DestroyListMenuTask - cmp r5, 0 - bne _0816C60A - ldr r1, =gUnknown_0203BCC4 - ldr r0, [r1] - ldr r2, =0x00000666 - adds r0, r2 - ldrb r2, [r0] - adds r4, r1, 0 - cmp r2, r6 - beq _0816C622 - subs r0, r6, 0x1 - cmp r2, r0 - beq _0816C60A - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - movs r1, 0x93 - lsls r1, 3 - adds r0, r1 - adds r1, r2, 0 - adds r2, r6, 0 - bl sub_80D702C - bl sub_816BD04 -_0816C60A: - ldr r0, =gUnknown_0203BCC4 - ldr r1, [r0] - ldr r2, =0x00000666 - adds r1, r2 - ldrb r1, [r1] - adds r4, r0, 0 - cmp r1, r6 - bcs _0816C622 - ldr r1, =gUnknown_0203BCB8 - ldrh r0, [r1] - subs r0, 0x1 - strh r0, [r1] -_0816C622: - ldr r0, [r4] - movs r1, 0xCD - lsls r1, 3 - adds r0, r1 - movs r1, 0x7 - movs r2, 0x1 - bl sub_81223FC - ldr r0, [r4] - ldr r2, =0x00000666 - adds r0, r2 - movs r1, 0xFF - strb r1, [r0] - ldr r0, =gMultiuseListMenuTemplate - ldr r2, =gUnknown_0203BCB8 - ldrh r1, [r2, 0x2] - ldrh r2, [r2] - bl ListMenuInit - lsls r0, 24 - lsrs r0, 24 - mov r1, r8 - strh r0, [r1, 0xA] - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_816C30C - str r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816C5A0 - - thumb_func_start sub_816C690 -sub_816C690: @ 816C690 - push {lr} - adds r3, r0, 0 - lsls r3, 24 - ldr r0, =gUnknown_0203BCC4 - ldr r0, [r0] - movs r1, 0xCD - lsls r1, 3 - adds r0, r1 - lsrs r3, 4 - movs r1, 0x80 - lsls r1, 13 - adds r3, r1 - lsrs r3, 16 - movs r1, 0x7 - movs r2, 0x80 - bl sub_8122448 - pop {r0} - bx r0 - .pool - thumb_func_end sub_816C690 - - thumb_func_start sub_816C6BC -sub_816C6BC: @ 816C6BC - push {r4-r6,lr} - sub sp, 0xC - adds r6, r0, 0 - ldr r5, [sp, 0x1C] - ldr r3, [sp, 0x20] - lsls r6, 24 - lsrs r6, 24 - lsls r1, 16 - lsrs r1, 16 - lsls r5, 24 - lsrs r5, 24 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =gStringVar1 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gText_xVar1 - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x30 - bl GetStringCenterAlignXOffset - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - str r5, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - adds r0, r6, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl PrintTextOnWindow - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816C6BC - - thumb_func_start sub_816C71C -sub_816C71C: @ 816C71C - push {r4-r6,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - ldr r1, =gUnknown_0203BCB8 - ldrh r0, [r1, 0x2] - ldrh r1, [r1] - adds r0, r1 - lsls r0, 16 - lsrs r4, r0, 16 - bl sub_816BF9C - movs r0, 0x1 - strh r0, [r6, 0x4] - movs r1, 0x6 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _0816C798 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - lsls r0, r4, 2 - adds r1, r0 - ldr r2, =0x0000049a - adds r0, r1, r2 - ldrh r0, [r0] - cmp r0, 0x1 - bne _0816C774 - adds r0, r5, 0 - bl sub_816C8FC - b _0816C7FE - .pool -_0816C774: - movs r2, 0x93 - lsls r2, 3 - adds r0, r1, r2 - ldrh r0, [r0] - ldr r1, =gStringVar1 - bl CopyItemName - ldr r0, =0x0000fffe - bl sub_816C228 - bl sub_816C2C0 - b _0816C7D4 - .pool -_0816C798: - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - lsls r0, r4, 2 - adds r1, r0 - ldr r2, =0x0000049a - adds r0, r1, r2 - ldrh r0, [r0] - cmp r0, 0x1 - bne _0816C7BC - adds r0, r5, 0 - bl sub_816C9B8 - b _0816C7FE - .pool -_0816C7BC: - movs r2, 0x93 - lsls r2, 3 - adds r0, r1, r2 - ldrh r0, [r0] - ldr r1, =gStringVar1 - bl CopyItemName - ldr r0, =0x0000fffc - bl sub_816C228 - bl sub_816C2C0 -_0816C7D4: - movs r0, 0x4 - bl sub_816BC7C - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r6, 0x4] - movs r2, 0x1 - str r2, [sp] - movs r2, 0x3 - str r2, [sp, 0x4] - movs r2, 0x2 - movs r3, 0x8 - bl sub_816C6BC - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_816C818 - str r1, [r0] -_0816C7FE: - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816C71C - - thumb_func_start sub_816C818 -sub_816C818: @ 816C818 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r5, r0, 24 - mov r9, r5 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - ldr r0, =gUnknown_0203BCB8 - ldrh r2, [r0, 0x2] - ldrh r0, [r0] - adds r2, r0 - lsls r2, 16 - adds r0, r6, 0x4 - ldr r1, =gSaveBlock1Ptr - mov r8, r1 - ldr r1, [r1] - lsrs r7, r2, 14 - adds r1, r7 - ldr r2, =0x0000049a - adds r1, r2 - ldrh r1, [r1] - bl AdjustQuantityAccordingToDPadInput - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x1 - bne _0816C888 - movs r0, 0x4 - bl sub_816BC7C - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r6, 0x4] - str r4, [sp] - movs r2, 0x3 - str r2, [sp, 0x4] - movs r2, 0x2 - movs r3, 0x8 - bl sub_816C6BC - b _0816C8EC - .pool -_0816C888: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0816C8BC - movs r0, 0x5 - bl PlaySE - movs r0, 0x4 - bl sub_816BCC4 - movs r3, 0x6 - ldrsh r0, [r6, r3] - cmp r0, 0 - bne _0816C8B4 - adds r0, r5, 0 - bl sub_816C8FC - b _0816C8EC - .pool -_0816C8B4: - adds r0, r5, 0 - bl sub_816C9B8 - b _0816C8EC -_0816C8BC: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0816C8EC - movs r0, 0x5 - bl PlaySE - movs r0, 0x4 - bl sub_816BCC4 - mov r1, r8 - ldr r0, [r1] - adds r0, r7 - movs r2, 0x93 - lsls r2, 3 - adds r0, r2 - ldrh r0, [r0] - bl sub_816C228 - bl sub_816C2C0 - mov r0, r9 - bl sub_816CBC0 -_0816C8EC: - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_816C818 - - thumb_func_start sub_816C8FC -sub_816C8FC: @ 816C8FC - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r6, r1, 3 - ldr r0, =gTasks + 0x8 - mov r8, r0 - adds r4, r6, r0 - ldr r0, =gUnknown_0203BCB8 - ldrh r1, [r0, 0x2] - ldrh r0, [r0] - adds r1, r0 - lsls r1, 16 - ldr r7, =gSaveBlock1Ptr - ldr r0, [r7] - lsrs r5, r1, 14 - adds r0, r5 - movs r1, 0x93 - lsls r1, 3 - adds r0, r1 - ldrh r0, [r0] - ldrh r1, [r4, 0x4] - bl AddBagItem - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0816C98C - ldr r0, [r7] - adds r0, r5 - movs r2, 0x93 - lsls r2, 3 - adds r0, r2 - ldrh r0, [r0] - ldr r1, =gStringVar1 - bl CopyItemName - ldr r0, =gStringVar2 - movs r2, 0x4 - ldrsh r1, [r4, r2] - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r0, =0x0000fffd - bl sub_816C228 - bl sub_816C2C0 - mov r0, r8 - subs r0, 0x8 - adds r0, r6, r0 - ldr r1, =sub_816CB04 - b _0816C9A2 - .pool -_0816C98C: - movs r0, 0 - strh r0, [r4, 0x4] - ldr r0, =0x0000fffa - bl sub_816C228 - bl sub_816C2C0 - mov r0, r8 - subs r0, 0x8 - adds r0, r6, r0 - ldr r1, =sub_816CB74 -_0816C9A2: - str r1, [r0] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816C8FC - - thumb_func_start sub_816C9B8 -sub_816C9B8: @ 816C9B8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x10 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - mov r8, r0 - ldr r0, =gTasks + 0x8 - mov r9, r0 - mov r7, r8 - add r7, r9 - ldr r0, =gUnknown_0203BCB8 - ldrh r1, [r0, 0x2] - ldrh r0, [r0] - adds r1, r0 - lsls r1, 16 - ldr r6, =gSaveBlock1Ptr - ldr r0, [r6] - lsrs r4, r1, 14 - adds r0, r4 - movs r1, 0x93 - lsls r1, 3 - adds r0, r1 - ldrh r0, [r0] - bl itemid_is_unique - lsls r0, 24 - cmp r0, 0 - bne _0816CA64 - ldr r0, [r6] - adds r0, r4 - movs r2, 0x93 - lsls r2, 3 - adds r0, r2 - ldrh r0, [r0] - ldr r1, =gStringVar1 - bl CopyItemName - ldr r0, =gStringVar2 - movs r2, 0x4 - ldrsh r1, [r7, r2] - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r0, =0x0000fff8 - bl sub_816C228 - bl sub_816C2C0 - ldr r1, =gUnknown_085DFF84 - movs r0, 0x1 - str r0, [sp] - movs r0, 0x85 - lsls r0, 2 - str r0, [sp, 0x4] - movs r0, 0xE - str r0, [sp, 0x8] - ldr r0, =gUnknown_085DFF3C - str r0, [sp, 0xC] - adds r0, r5, 0 - movs r2, 0x1 - movs r3, 0 - bl CreateYesNoMenuWithCallbacks - b _0816CA7C - .pool -_0816CA64: - movs r0, 0 - strh r0, [r7, 0x4] - ldr r0, =0x0000fff9 - bl sub_816C228 - bl sub_816C2C0 - mov r0, r9 - subs r0, 0x8 - add r0, r8 - ldr r1, =sub_816CB74 - str r1, [r0] -_0816CA7C: - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816C9B8 - - thumb_func_start sub_816CA94 -sub_816CA94: @ 816CA94 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =0x0000fffb - bl sub_816C228 - bl sub_816C2C0 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_816CB04 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816CA94 - - thumb_func_start sub_816CAC8 -sub_816CAC8: @ 816CAC8 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldr r1, =gUnknown_0203BCB8 - ldrh r0, [r1, 0x2] - ldrh r1, [r1] - adds r0, r1 - lsls r0, 2 - adds r2, r0 - movs r0, 0x93 - lsls r0, 3 - adds r2, r0 - ldrh r0, [r2] - bl sub_816C228 - bl sub_816C2C0 - adds r0, r4, 0 - bl sub_816CBC0 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816CAC8 - - thumb_func_start sub_816CB04 -sub_816CB04: @ 816CB04 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _0816CB5E - ldr r4, =gUnknown_0203BCB8 - ldrb r0, [r4, 0x2] - ldrb r1, [r4] - adds r0, r1 - lsls r0, 24 - lsrs r0, 24 - ldrh r1, [r5, 0x4] - bl sub_80D6E48 - ldrb r0, [r5, 0xA] - adds r1, r4, 0x2 - adds r2, r4, 0 - bl DestroyListMenuTask - bl sub_816C110 - bl sub_816C140 - bl sub_816BD04 - ldr r0, =gMultiuseListMenuTemplate - ldrh r1, [r4, 0x2] - ldrh r2, [r4] - bl ListMenuInit - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0xA] - adds r0, r6, 0 - bl sub_816CBC0 -_0816CB5E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816CB04 - - thumb_func_start sub_816CB74 -sub_816CB74: @ 816CB74 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _0816CBAC - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldr r1, =gUnknown_0203BCB8 - ldrh r0, [r1, 0x2] - ldrh r1, [r1] - adds r0, r1 - lsls r0, 2 - adds r2, r0 - movs r0, 0x93 - lsls r0, 3 - adds r2, r0 - ldrh r0, [r2] - bl sub_816C228 - bl sub_816C2C0 - adds r0, r4, 0 - bl sub_816CBC0 -_0816CBAC: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816CB74 - - thumb_func_start sub_816CBC0 -sub_816CBC0: @ 816CBC0 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_816BF60 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_816C30C - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816CBC0 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/pokenav.s b/asm/pokenav.s index fe96d51e7..47f350b29 100644 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -20753,7 +20753,7 @@ sub_81D1C84: @ 81D1C84 ldr r0, [r0, 0x10] str r0, [sp] str r1, [sp, 0x4] - ldr r0, =gUnknown_085DFF04 + ldr r0, =gMailboxMailOptions movs r1, 0x4 bl GetMaxWidthInMenuTable lsls r0, 24 diff --git a/data/event_scripts.s b/data/event_scripts.s index 22c44bee3..1343a4fa9 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -1788,7 +1788,7 @@ EventScript_271DBC:: @ 8271DBC EventScript_271DF9:: @ 8271DF9 playse SE_PC_LOGIN msgbox gUnknown_082726C2, 4 - special sub_816AE98 + special PlayerPC waitstate goto EventScript_271DAC end diff --git a/data/player_pc.s b/data/player_pc.s deleted file mode 100644 index 47bdbff39..000000000 --- a/data/player_pc.s +++ /dev/null @@ -1,75 +0,0 @@ -#include "constants/items.h" - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gUnknown_085DFEA4:: @ 85DFEA4 - .4byte gText_TakeOutItemsFromPC - .4byte gText_StoreItemsInPC - .4byte gText_ThrowAwayItemsInPC - .4byte gText_GoBackPrevMenu - - .align 2 -gUnknown_085DFEB4:: @ 85DFEB4 - .4byte gText_ItemStorage, task_pc_itemstorage - .4byte gText_Mailbox, sub_816B0A8 - .4byte gText_Decoration, sub_816B138 - .4byte gText_TurnOff, sub_816B148 - - .align 2 -gUnknown_085DFED4:: @ 85DFED4 - .byte 0x00, 0x01, 0x02, 0x03 - - .align 2 -gUnknown_085DFED8:: @ 85DFED8 - .byte 0x00, 0x01, 0x03, 0x00 - - .align 2 -gUnknown_085DFEDC:: @ 85DFEDC - .4byte gText_WithdrawItem, sub_816B398 - .4byte gText_DepositItem, sub_816B2C8 - .4byte gText_TossItem, sub_816B3E4 - .4byte gText_Cancel, sub_816B4A4 - - .align 2 -gUnknown_085DFEFC:: @ 85DFEFC - .2byte ITEM_POTION, 0x0001 - .2byte 0x0000, 0x0000 - - .align 2 -gUnknown_085DFF04:: @ 85DFF04 - .4byte gText_Read, sub_816B878 - .4byte gText_MoveToBag, sub_816B994 - .4byte gText_Give2, sub_816BABC - .4byte gText_Cancel2, sub_816BBD4 - - .align 2 -gUnknown_085DFF24:: @ 85DFF24 - .4byte 0x09010100, 0x00010f06, 0x09010100, 0x00010f08, 0x0a010100, 0x00010f08 - - .align 2 -gUnknown_085DFF3C:: @ 85DFF3C - .4byte sub_816CA94 - .4byte sub_816CAC8 - - .align 2 -gUnknown_085DFF44:: @ 85DFF44 - .4byte 0x00000000, sub_816BDDC, fish4_goto_x5_or_x6, 0x00000000, 0x00080000, 0x07003129 - - .align 2 -gUnknown_085DFF5C:: @ 85DFF5C - window_template 0x00, 0x10, 0x01, 0x0d, 0x12, 0x0f, 0x0001 - window_template 0x00, 0x01, 0x0d, 0x0d, 0x06, 0x0f, 0x00eb - window_template 0x00, 0x01, 0x08, 0x03, 0x03, 0x0f, 0x0153 - window_template 0x00, 0x01, 0x01, 0x0d, 0x02, 0x0f, 0x0139 - window_template 0x00, 0x08, 0x09, 0x06, 0x02, 0x0f, 0x015c - - .align 2 -gUnknown_085DFF84:: @ 85DFF84 - window_template 0x00, 0x09, 0x07, 0x05, 0x04, 0x0f, 0x0168 - - .align 2 -gUnknown_085DFF8C:: @ 85DFF8C - .byte 0x01, 0x03, 0x02, 0x00 diff --git a/data/scripts/maps/LittlerootTown_BrendansHouse_2F.inc b/data/scripts/maps/LittlerootTown_BrendansHouse_2F.inc index 0e7ecbf22..a5223d38a 100644 --- a/data/scripts/maps/LittlerootTown_BrendansHouse_2F.inc +++ b/data/scripts/maps/LittlerootTown_BrendansHouse_2F.inc @@ -259,7 +259,7 @@ LittlerootTown_BrendansHouse_2F_EventScript_1F8626:: @ 81F8626 special DoPCTurnOnEffect playse SE_PC_ON msgbox gUnknown_08272D87, 4 - special sub_816AE58 + special BedroomPC waitstate releaseall end diff --git a/data/scripts/maps/LittlerootTown_MaysHouse_2F.inc b/data/scripts/maps/LittlerootTown_MaysHouse_2F.inc index 327112d2f..f300b5849 100644 --- a/data/scripts/maps/LittlerootTown_MaysHouse_2F.inc +++ b/data/scripts/maps/LittlerootTown_MaysHouse_2F.inc @@ -320,7 +320,7 @@ LittlerootTown_MaysHouse_2F_EventScript_1F9576:: @ 81F9576 special DoPCTurnOnEffect playse SE_PC_ON msgbox gUnknown_08272D87, 4 - special sub_816AE58 + special BedroomPC waitstate releaseall end diff --git a/data/specials.inc b/data/specials.inc index 8b83702ad..ab1a441ff 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -260,8 +260,8 @@ gSpecials:: @ 81DBA64 def_special ValidateEReaderTrainer def_special sub_8139228 def_special sub_80F94E8 - def_special sub_816AE58 - def_special sub_816AE98 + def_special BedroomPC + def_special PlayerPC def_special FieldShowRegionMap def_special sub_807E73C def_special sub_807EA10 diff --git a/include/decoration.h b/include/decoration.h index c841bbfc1..a51d9ccce 100644 --- a/include/decoration.h +++ b/include/decoration.h @@ -69,5 +69,6 @@ extern EWRAM_DATA u8 gCurDecorationIndex; void sub_8126968(void); void sub_8126AD8(u8 taskId); void sub_8127D38(u16 mapX, u16 mapY, u16 decor); +void sub_8126B2C(u8 taskId); #endif //GUARD_DECORATION_H diff --git a/include/event_scripts.h b/include/event_scripts.h index ba137cf3b..6799b82b4 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -389,4 +389,8 @@ extern const u8 FieryPath_EventScript_2908FD[]; extern const u8 EventScript_290CAE[]; extern const u8 EventScript_2926F8[]; +//player pc +extern const u8 LittlerootTown_BrendansHouse_2F_EventScript_1F863F[]; +extern const u8 LittlerootTown_MaysHouse_2F_EventScript_1F958F[]; + #endif //GUARD_EVENT_SCRIPTS_H diff --git a/include/international_string_util.h b/include/international_string_util.h index f4ba827e3..426a2d48c 100644 --- a/include/international_string_util.h +++ b/include/international_string_util.h @@ -10,12 +10,12 @@ s32 GetStringRightAlignXOffset(s32 fontId, const u8 *str, s32 totalWidth); s32 GetStringCenterAlignXOffsetWithLetterSpacing(s32 fontId, const u8 *str, s32 totalWidth, s32 letterSpacing); s32 GetStringWidthDifference(s32 fontId, const u8 *str, s32 totalWidth, s32 letterSpacing); s32 GetMaxWidthInMenuTable(const struct MenuAction *str, s32 arg1); -s32 sub_81DB3D8(const struct MenuAction *str, u8* arg1, s32 arg2); +s32 sub_81DB3D8(const struct MenuAction *str, const u8* arg1, s32 arg2); // sub_81DB41C // CopyMonCategoryText // sub_81DB494 void PadNameString(u8 *dst, u8 padWith); -// sub_81DB554 +void sub_81DB554(u8 *, u8); // sub_81DB5AC u32 sub_81DB604(const u8 *); // sub_81DB620 diff --git a/include/item.h b/include/item.h index d81a3de33..33d434f78 100644 --- a/include/item.h +++ b/include/item.h @@ -64,5 +64,9 @@ u16 BagGetItemIdByPocketPosition(u8 pocketId, u16 pocketPos); void sub_80D6FB4(struct BagPocket*); void sub_80D6F64(struct BagPocket*); void sub_80D702C(struct ItemSlot*, s16, u16); +u8 sub_80D6CE4(); +bool8 itemid_is_unique(u16 itemId); +void sub_80D6E48(u8, u16); +void sub_80D6E84(void); #endif // ITEM_H diff --git a/include/item_menu.h b/include/item_menu.h index e49aeb861..68393c9ee 100644 --- a/include/item_menu.h +++ b/include/item_menu.h @@ -51,6 +51,7 @@ extern struct UnkBagStruct *gUnknown_0203CE54; extern u16 gSpecialVar_ItemId; // Exported ROM declarations +void sub_81AAC14(void); void sub_81AAC50(void); void sub_81AAC70(void); void bag_menu_mail_related(void); diff --git a/include/menu.h b/include/menu.h index cec2f018d..118e8f9a9 100644 --- a/include/menu.h +++ b/include/menu.h @@ -55,6 +55,7 @@ struct WindowTemplate sub_8198A50(u8, u8, u8, u8, u8, u8, u16); void CreateYesNoMenu(const struct WindowTemplate *windowTemplate, u16 borderFirstTileNum, u8 borderPalette, u8 initialCursorPos); void copy_decompressed_tile_data_to_vram_autofree(u8 bgId, const void *src, int size, u16 offset, u8 mode); s8 ProcessMenuInputNoWrap_(void); +s8 ProcessMenuInput_other(void); void do_scheduled_bg_tilemap_copies_to_vram(void); void clear_scheduled_bg_copies_to_vram(void); void AddTextPrinterParameterized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, const u8 *color, s8 speed, const u8 *str); diff --git a/include/menu_helpers.h b/include/menu_helpers.h index e744c293c..4de6603a3 100644 --- a/include/menu_helpers.h +++ b/include/menu_helpers.h @@ -14,7 +14,7 @@ struct YesNoFuncTable // Exported RAM declarations // Exported ROM declarations - +void sub_812220C(struct ItemSlot *, u8, u8 *, u8 *, u8); void sub_812225C(u16 *, u16 *, u8, u8); void sub_8122298(u16 *, u16 *, u8, u8, u8); void sub_8121F68(u8 taskId, const struct YesNoFuncTable *data); @@ -24,7 +24,8 @@ void ResetVramOamAndBgCntRegs(void); void SetVBlankHBlankCallbacksToNull(void); void ResetAllBgsCoordinates(void); bool16 RunTextPrintersRetIsActive(u8 textPrinterId); -void sub_8122344(void *arg0, u8 arg1); +void sub_8122344(u8 *arg0, u8 arg1); +void sub_81223B0(u8 *arg0, u8 arg1); void LoadListMenuArrowsGfx(void); void sub_81223FC(u8 *a0, u8 count, u8 a2); void sub_8122448(u8 *a0, u8 count, u16 x, u16 y); diff --git a/include/party_menu.h b/include/party_menu.h index 1ce12d98f..c96eb0d9d 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -37,5 +37,6 @@ void display_pokemon_menu_message(u8 windowId); void sub_81B1F18(u8 taskId, u8 pokemonIdx, s8 a, s16 hp, TaskFunc func); void sub_81B1B5C(void *a, u8 b); u8 sub_81B1BD4(); +void sub_81B8448(); #endif // GUARD_PARTY_MENU_H diff --git a/include/player_pc.h b/include/player_pc.h index cc2e85b2b..bd060faa8 100644 --- a/include/player_pc.h +++ b/include/player_pc.h @@ -1,13 +1,88 @@ #ifndef GUARD_PLAYER_PC_H #define GUARD_PLAYER_PC_H +// local task defines +#define PAGE_INDEX data[0] +#define ITEMS_ABOVE_TOP data[1] +#define NUM_ITEMS data[1] +#define NUM_QUANTITY_ROLLER data[3] +#define NUM_PAGE_ITEMS data[4] +// not used +#define CURRENT_ITEM_STORAGE_MENU data[3] +// not used +#define SWAP_ITEM_INDEX data[8] +#define SWITCH_MODE_ACTIVE data[9] + +// this is potentially an ewram access occuring in high ewram. TODO: investigate this further. +#define NEW_GAME_PC_ITEMS(i, type) ((u16)((u16 *)gNewGamePCItems + type)[i * 2]) + +// defined and used in the above macro +enum +{ + PC_ITEM_ID, + PC_QUANTITY +}; + +// player PC menu options +enum +{ + PLAYERPC_MENU_ITEMSTORAGE, + PLAYERPC_MENU_MAILBOX, + PLAYERPC_MENU_DECORATION, + PLAYERPC_MENU_TURNOFF +}; + +// item storage menus +enum +{ + ITEMPC_MENU_WITHDRAW, + ITEMPC_MENU_DEPOSIT, + ITEMPC_MENU_TOSS, + ITEMPC_MENU_EXIT +}; + +// mailbox mail options +enum +{ + MAILBOX_READ, + MAILBOX_MOVE_TO_BAG, + MAILBOX_GIVE, + MAILBOX_CANCEL, +}; + +// special item description handlers +enum +{ + ITEMPC_SWITCH_WHICH_ITEM = 0xFFF7, + ITEMPC_OKAY_TO_THROW_AWAY, + ITEMPC_TOO_IMPORTANT, + ITEMPC_NO_MORE_ROOM, + ITEMPC_THREW_AWAY_ITEM, + ITEMPC_HOW_MANY_TO_TOSS, + ITEMPC_WITHDREW_THING, + ITEMPC_HOW_MANY_TO_WITHDRAW, + ITEMPC_GO_BACK_TO_PREV +}; + +struct PlayerPCItemPageStruct +{ + u16 cursorPos; + u16 itemsAbove; + u8 pageItems; + u8 count; + u8 filler[3]; + u8 scrollIndicatorId; +}; + // Exported type declarations // Exported RAM declarations +extern struct PlayerPCItemPageStruct playerPCItemPageInfo; // Exported ROM declarations +extern const struct MenuAction gMailboxMailOptions[]; -void sub_816B060(u8 taskId); +void ReshowPlayerPC(u8 taskId); void sub_816B31C(void); #endif //GUARD_PLAYER_PC_H diff --git a/include/pokenav.h b/include/pokenav.h index ebe3b325c..fabe211ea 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -1,5 +1,6 @@ #ifndef GUARD_POKENAV_H #define GUARD_POKENAV_H +#include "player_pc.h" bool8 sub_81D5C18(void); bool8 sub_81D20BC(void *arg0); @@ -13,5 +14,12 @@ void sub_81D3480(void *arg0, u8 arg1); void sub_81D2754(void *arg0, void *arg1); void sub_81D1F84(void *arg0, void *arg1, void *arg2); const u8 *sub_81D62AC(void); +u8 sub_81D1C84(u8); +u8 sub_81D1DC0(struct PlayerPCItemPageStruct *); +void sub_81D1E90(struct PlayerPCItemPageStruct *); +void sub_81D1EC0(void); +void sub_81D1D04(u8); +bool8 sub_81D1C44(u8); + #endif //GUARD_POKENAV_H diff --git a/include/strings.h b/include/strings.h index cb76279f8..7c81dbcfb 100644 --- a/include/strings.h +++ b/include/strings.h @@ -389,4 +389,45 @@ extern const u8 gBirchDexRatingText_LessThan190[]; extern const u8 gBirchDexRatingText_LessThan200[]; extern const u8 gBirchDexRatingText_DexCompleted[]; +//player pc text +extern const u8 gText_WhatWouldYouLike[]; +extern const u8 gText_NoMailHere[]; + +extern const u8 gText_TakeOutItemsFromPC[]; +extern const u8 gText_StoreItemsInPC[]; +extern const u8 gText_ThrowAwayItemsInPC[]; +extern const u8 gText_GoBackPrevMenu[]; + +extern const u8 gText_ItemStorage[]; +extern const u8 gText_Mailbox[]; +extern const u8 gText_Decoration[]; +extern const u8 gText_TurnOff[]; + +extern const u8 gText_WithdrawItem[]; +extern const u8 gText_DepositItem[]; +extern const u8 gText_TossItem[]; +extern const u8 gText_Cancel[]; + +extern const u8 gText_Read[]; +extern const u8 gText_MoveToBag[]; +extern const u8 gText_Give2[]; +extern const u8 gText_Cancel2[]; + +extern const u8 gText_NoItems[]; +extern const u8 gText_WhatToDoWithVar1sMail[]; +extern const u8 gText_MessageWillBeLost[]; +extern const u8 gText_BagIsFull[]; + +extern const u8 gText_MailToBagMessageErased[]; +extern const u8 gText_GoBackPrevMenu[]; +extern const u8 gText_WithdrawHowManyItems[]; +extern const u8 gText_WithdrawXItems[]; +extern const u8 gText_TossHowManyVar1s[]; +extern const u8 gText_ThrewAwayVar2Var1s[]; +extern const u8 gText_NoRoomInBag[]; +extern const u8 gText_TooImportantToToss[]; +extern const u8 gText_ConfirmTossItems[]; +extern const u8 gText_MoveVar1Where[]; + + #endif //GUARD_STRINGS_H diff --git a/ld_script.txt b/ld_script.txt index cd30c8461..1eb425278 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -216,7 +216,7 @@ SECTIONS { src/use_pokeblock.o(.text); asm/use_pokeblock.o(.text); src/battle_controller_wally.o(.text); - asm/player_pc.o(.text); + src/player_pc.o(.text); src/intro.o(.text); src/reset_save_heap.o(.text); src/field_region_map.o(.text); @@ -495,7 +495,7 @@ SECTIONS { src/use_pokeblock.o(.rodata); data/use_pokeblock.o(.rodata); src/battle_controller_wally.o(.rodata); - data/player_pc.o(.rodata); + src/player_pc.o(.rodata); src/intro.o(.rodata); src/field_region_map.o(.rodata); data/battle_anim_8170478.o(.rodata); diff --git a/src/decoration.c b/src/decoration.c index ffa1c3a68..a0855db69 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -562,7 +562,7 @@ void SecretBasePC_Cancel(u8 taskId) } else { - sub_816B060(taskId); + ReshowPlayerPC(taskId); } } diff --git a/src/international_string_util.c b/src/international_string_util.c index 89b4a7a69..9de338c59 100644 --- a/src/international_string_util.c +++ b/src/international_string_util.c @@ -42,7 +42,7 @@ s32 GetMaxWidthInMenuTable(const struct MenuAction *str, s32 arg1) return convert_pixel_width_to_tile_width(var); } -s32 sub_81DB3D8(const struct MenuAction *str, u8* arg1, s32 arg2) +s32 sub_81DB3D8(const struct MenuAction *str, const u8* arg1, s32 arg2) { s32 i, var; diff --git a/src/player_pc.c b/src/player_pc.c new file mode 100644 index 000000000..f56ecb128 --- /dev/null +++ b/src/player_pc.c @@ -0,0 +1,1364 @@ +#include "global.h" +#include "constants/songs.h" +#include "bg.h" +#include "decoration.h" +#include "event_scripts.h" +#include "field_fadetransition.h" +#include "field_map_obj.h" +#include "field_screen.h" +#include "field_weather.h" +#include "international_string_util.h" +#include "item.h" +#include "item_icon.h" +#include "item_menu.h" +#include "constants/items.h" +#include "list_menu.h" +#include "mail.h" +#include "main.h" +#include "malloc.h" +#include "menu.h" +#include "menu_helpers.h" +#include "menu_indicators.h" +#include "overworld.h" +#include "palette.h" +#include "party_menu.h" +#include "pokenav.h" +#include "player_pc.h" +#include "script.h" +#include "sound.h" +#include "sprite.h" +#include "string_util.h" +#include "strings.h" +#include "task.h" +#include "window.h" + +// structures +struct Struct203BCC4 +{ + struct ListMenuItem unk0[51]; + u8 unk198[51][0x18]; + u8 windowIds[6]; + u8 unk666; + u8 spriteId; + u8 spriteIds[7]; +}; + +// extern offset +void (*gFieldCallback)(void); + +// static functions +static void InitPlayerPCMenu(u8 taskId); +static void PlayerPCProcessMenuInput(u8 taskId); +static void InitItemStorageMenu(u8 taskId, u8 var); + +static u8 GetMailboxMailCount(void); +static void Mailbox_UpdateMailList(void); +static void Mailbox_DrawMailboxMenu(u8 taskId); +static void Mailbox_ProcessInput(u8 taskId); +static void Mailbox_PrintWhatToDoWithPlayerMailText(u8 taskId); +static void Mailbox_ReturnToPlayerPC(u8); +static void Mailbox_PrintMailOptions(u8 taskId); +static void Mailbox_MailOptionsProcessInput(u8 taskId); + +static void PlayerPC_ItemStorage(u8 taskId); +static void PlayerPC_Mailbox(u8 taskId); +static void PlayerPC_Decoration(u8 var); +static void PlayerPC_TurnOff(u8 taskId); + +static void Mailbox_DoMailMoveToBag(u8 taskId); +static void Mailbox_DoMailRead(u8 taskId); +static void Mailbox_MoveToBag(u8 taskId); +static void Mailbox_Give(u8 taskId); +static void Mailbox_Cancel(u8 taskId); + +static void Mailbox_CancelMoveToBag(u8 taskId); +static void Mailbox_MoveToBagYesNoPrompt(u8 taskId); +static void Mailbox_DrawYesNoBeforeMove(u8 taskId); +static void Mailbox_DoGiveMailPokeMenu(u8 taskId); +static void Mailbox_NoPokemonForMail(u8 taskId); + +static void Mailbox_FadeAndReadMail(u8 taskId); +static void Mailbox_ReturnToFieldFromReadMail(void); +static void Mailbox_DoRedrawMailboxMenuAfterReturn(void); +static void pal_fill_for_maplights_or_black(void); +static void Mailbox_HandleReturnToProcessInput(u8 taskId); +static void Mailbox_UpdateMailListAfterDeposit(void); + +static void ItemStorage_Withdraw(u8 taskId); +static void ItemStorage_Deposit(u8 taskId); +static void ItemStorage_Toss(u8 taskId); +static void ItemStorage_Exit(u8 taskId); +static void ItemStorage_ResumeInputFromYesToss(u8 taskId); +static void ItemStorage_ResumeInputFromNoToss(u8 taskId); + +static void ItemStorageMenuPrint(const u8 *); +static void ItemStorageMenuProcessInput(u8 taskId); +static void ItemStorage_ProcessWithdrawTossInput(u8 taskId); +static void ItemStorage_SetItemAndMailCount(u8); +static void ItemStorage_HandleReturnToProcessInput(u8 taskId); + +static void ItemStorage_WithdrawToss_Helper(u8 taskId, bool8 toss); +static void Task_ItemStorage_Deposit(u8 taskId); +static void ItemStorage_DoItemWithdraw(u8 taskId); +static void ItemStorage_DoItemToss(u8 taskid); +static void ItemStorage_HandleQuantityRolling(u8 taskid); +static void ItemStorage_GoBackToPlayerPCMenu(u8 taskId); +static void ItemStorage_ItemSwapChoosePrompt(u8 taskId); +static void ItemStorage_DoItemAction(u8 taskId); +static void ItemStorage_ProcessInput(u8 taskId); +static void ItemStorage_DoItemSwap(u8 taskId, bool8 a); +static void ItemStorage_HandleRemoveItem(u8 taskId); +static void ItemStorage_WaitPressHandleResumeProcessInput(u8 taskId); +static void ItemStorage_StartScrollIndicatorAndProcessInput(u8 taskId); + +static const u8* ItemStorage_GetItemPcResponse(u16); +static void CopyItemName_PlayerPC(u8 *string, u16 itemId); + +static void sub_816BC14(void); +static void sub_816BFE0(u8 y, u8, u8 speed); +static void sub_816BCC4(u8); +static void sub_816C690(u8); +static void sub_816C4FC(u8 taskId); +static void sub_816C0C8(void); +static void sub_816C060(u16 itemId); +static void sub_816BEF0(s32 id); +static void sub_816B4DC(u8 taskId); +static void ItemStorage_MoveCursor(s32 id, bool8 b, struct ListMenu * thisMenu); +static void fish4_goto_x5_or_x6(u8 windowId, s32 id, u8 yOffset); + +// EWRAM +static EWRAM_DATA const u8 *gPcItemMenuOptionOrder = NULL; +static EWRAM_DATA u8 gPcItemMenuOptionsNum = 0; +EWRAM_DATA struct PlayerPCItemPageStruct playerPCItemPageInfo = {0, 0, 0, 0, {0, 0, 0}, 0}; +static EWRAM_DATA struct Struct203BCC4 *gUnknown_0203BCC4 = NULL; + +// .rodata +static const u8 *const gPCText_OptionDescList[] = +{ + gText_TakeOutItemsFromPC, + gText_StoreItemsInPC, + gText_ThrowAwayItemsInPC, + gText_GoBackPrevMenu, +}; + +static const struct MenuAction sPlayerPCMenuActions[] = +{ + { gText_ItemStorage, PlayerPC_ItemStorage }, + { gText_Mailbox, PlayerPC_Mailbox }, + { gText_Decoration, PlayerPC_Decoration }, + { gText_TurnOff, PlayerPC_TurnOff } +}; + +static const u8 gBedroomPC_OptionOrder[] = +{ + PLAYERPC_MENU_ITEMSTORAGE, + PLAYERPC_MENU_MAILBOX, + PLAYERPC_MENU_DECORATION, + PLAYERPC_MENU_TURNOFF +}; + +static const u8 gPlayerPC_OptionOrder[] = +{ + PLAYERPC_MENU_ITEMSTORAGE, + PLAYERPC_MENU_MAILBOX, + PLAYERPC_MENU_TURNOFF +}; + +static const struct MenuAction gPCText_ItemPCOptionsText[] = +{ + { gText_WithdrawItem, ItemStorage_Withdraw }, + { gText_DepositItem, ItemStorage_Deposit }, + { gText_TossItem, ItemStorage_Toss }, + { gText_Cancel, ItemStorage_Exit } +}; + +static const struct ItemSlot gNewGamePCItems[] = +{ + { ITEM_POTION, 1 }, + { ITEM_NONE, 0 } +}; + +const struct MenuAction gMailboxMailOptions[] = +{ + { gText_Read, Mailbox_DoMailRead }, + { gText_MoveToBag, Mailbox_MoveToBag }, + { gText_Give2, Mailbox_Give }, + { gText_Cancel2, Mailbox_Cancel } +}; + +static const struct WindowTemplate gUnknown_085DFF24[3] = +{ + {0x00, 0x01, 0x01, 0x09, 0x06, 0x0F, 0x0001}, + {0x00, 0x01, 0x01, 0x09, 0x08, 0x0F, 0x0001}, + {0x00, 0x01, 0x01, 0x0A, 0x08, 0x0F, 0x0001} +}; + +static const struct YesNoFuncTable ResumeFromWithdrawYesNoFuncList = // ResumeFromWithdrawYesNoFuncList +{ + ItemStorage_ResumeInputFromYesToss, + ItemStorage_ResumeInputFromNoToss +}; + +static const struct ListMenuTemplate gUnknown_085DFF44 = { + NULL, + ItemStorage_MoveCursor, + fish4_goto_x5_or_x6, + 0, 0, + 0, 0, 8, 0, + 9, 2, 1, 3, FALSE, 0, FALSE, 7 +}; + +static const struct WindowTemplate gUnknown_085DFF5C[5] = +{ + {0x00, 0x10, 0x01, 0x0D, 0x12, 0x0F, 0x0001}, + {0x00, 0x01, 0x0D, 0x0D, 0x06, 0x0F, 0x00EB}, + {0x00, 0x01, 0x08, 0x03, 0x03, 0x0F, 0x0153}, + {0x00, 0x01, 0x01, 0x0D, 0x02, 0x0F, 0x0139}, + {0x00, 0x08, 0x09, 0x06, 0x02, 0x0F, 0x015C} +}; + +static const struct WindowTemplate gUnknown_085DFF84 = +{ + 0x00, 0x09, 0x07, 0x05, 0x04, 0x0F, 0x0168 +}; + +static const u8 gUnknown_085DFF8C[] = {0x01, 0x03, 0x02, 0x00}; + +// text +void NewGameInitPCItems(void) +{ + u8 i; + + // because Game Freak don't know how to use a struct or a 2d array + for(i = 0, ClearItemSlots(gSaveBlock1Ptr->pcItems, ARRAY_COUNT(gSaveBlock1Ptr->pcItems)); NEW_GAME_PC_ITEMS(i, PC_ITEM_ID) && NEW_GAME_PC_ITEMS(i, PC_QUANTITY) && + AddPCItem(NEW_GAME_PC_ITEMS(i, PC_ITEM_ID), NEW_GAME_PC_ITEMS(i, PC_QUANTITY)) == TRUE; i++); +} + +void BedroomPC(void) +{ + gPcItemMenuOptionOrder = gBedroomPC_OptionOrder; + gPcItemMenuOptionsNum = 4; + DisplayItemMessageOnField(CreateTask(TaskDummy, 0), gText_WhatWouldYouLike, InitPlayerPCMenu); +} + +void PlayerPC(void) +{ + gPcItemMenuOptionOrder = gPlayerPC_OptionOrder; + gPcItemMenuOptionsNum = 3; + DisplayItemMessageOnField(CreateTask(TaskDummy, 0), gText_WhatWouldYouLike, InitPlayerPCMenu); +} + +static void InitPlayerPCMenu(u8 taskId) +{ + u16 *data; + struct WindowTemplate windowTemplate; + + data = gTasks[taskId].data; + if(gPcItemMenuOptionsNum == 3) + windowTemplate = gUnknown_085DFF24[0]; + else + windowTemplate = gUnknown_085DFF24[1]; + windowTemplate.width = sub_81DB3D8(sPlayerPCMenuActions, gPcItemMenuOptionOrder, gPcItemMenuOptionsNum); + data[4] = AddWindow(&windowTemplate); + SetStandardWindowBorderStyle(data[4], 0); + sub_81995E4(data[4], gPcItemMenuOptionsNum, sPlayerPCMenuActions, gPcItemMenuOptionOrder); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[4], gPcItemMenuOptionsNum, 0); + schedule_bg_copy_tilemap_to_vram(0); + gTasks[taskId].func = PlayerPCProcessMenuInput; +} + +static void PlayerPCProcessMenuInput(u8 taskId) +{ + u16 *data; + s8 inputOptionId; + + data = gTasks[taskId].data; + if(gPcItemMenuOptionsNum > 3) + inputOptionId = ProcessMenuInput(); + else + inputOptionId = ProcessMenuInputNoWrapAround(); + + switch(inputOptionId) + { + case -2: + break; + case -1: + PlaySE(SE_SELECT); + sub_8198070(data[4], FALSE); + ClearWindowTilemap(data[4]); + RemoveWindow(data[4]); + schedule_bg_copy_tilemap_to_vram(0); + gTasks[taskId].func = PlayerPC_TurnOff; + break; + default: + sub_8198070(data[4], FALSE); + ClearWindowTilemap(data[4]); + RemoveWindow(data[4]); + schedule_bg_copy_tilemap_to_vram(0); + gTasks[taskId].func = sPlayerPCMenuActions[gPcItemMenuOptionOrder[inputOptionId]].func.void_u8; + break; + } +} + +void ReshowPlayerPC(u8 var) +{ + DisplayItemMessageOnField(var, gText_WhatWouldYouLike, InitPlayerPCMenu); +} + +static void PlayerPC_ItemStorage(u8 taskId) +{ + InitItemStorageMenu(taskId, ITEMPC_MENU_WITHDRAW); + gTasks[taskId].func = ItemStorageMenuProcessInput; +} + +static void PlayerPC_Mailbox(u8 taskId) +{ + playerPCItemPageInfo.count = GetMailboxMailCount(); + + if (playerPCItemPageInfo.count == 0) + DisplayItemMessageOnField(taskId, gText_NoMailHere, ReshowPlayerPC); + else + { + playerPCItemPageInfo.cursorPos = 0; + playerPCItemPageInfo.itemsAbove = 0; + playerPCItemPageInfo.scrollIndicatorId = 0xFF; + Mailbox_UpdateMailList(); + ItemStorage_SetItemAndMailCount(taskId); + if(sub_81D1C44(playerPCItemPageInfo.count) == TRUE) + { + sub_8197434(0, 0); + Mailbox_DrawMailboxMenu(taskId); + gTasks[taskId].func = Mailbox_ProcessInput; + } + else + DisplayItemMessageOnField(taskId, gText_NoMailHere, ReshowPlayerPC); + } +} + +static void PlayerPC_Decoration(u8 var) +{ + sub_8126B2C(var); //DoPlayerPCDecoration(var); +} + +static void PlayerPC_TurnOff(u8 taskId) +{ + if (gPcItemMenuOptionsNum == 4) // if the option count is 4, we are at the bedroom PC and not player PC, so do gender specific handling. + { + if (gSaveBlock2Ptr->playerGender == MALE) + ScriptContext1_SetupScript(LittlerootTown_BrendansHouse_2F_EventScript_1F863F); + else + ScriptContext1_SetupScript(LittlerootTown_MaysHouse_2F_EventScript_1F958F); + } + else + { + EnableBothScriptContexts(); + } + DestroyTask(taskId); +} + +static void InitItemStorageMenu(u8 taskId, u8 var) +{ + u16 *data; + struct WindowTemplate windowTemplate; + + data = gTasks[taskId].data; + windowTemplate = gUnknown_085DFF24[2]; + windowTemplate.width = GetMaxWidthInMenuTable(gPCText_ItemPCOptionsText, 4); + data[4] = AddWindow(&windowTemplate); + SetStandardWindowBorderStyle(data[4], 0); + PrintMenuTable(data[4], 4, gPCText_ItemPCOptionsText); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[4], 4, var); + schedule_bg_copy_tilemap_to_vram(0); + ItemStorageMenuPrint(gPCText_OptionDescList[var]); +} + +static void ItemStorageMenuPrint(const u8 *textPtr) +{ + NewMenuHelpers_DrawDialogueFrame(0, 0); + PrintTextOnWindow(0, 1, textPtr, 0, 1, 0, 0); +} + +static void ItemStorageMenuProcessInput(u8 taskId) +{ + s8 r5; + s8 r2; + s8 inputOptionId; + + r5 = GetMenuCursorPos(); + inputOptionId = ProcessMenuInput(); + r2 = GetMenuCursorPos(); + switch(inputOptionId) + { + case -2: + if (r5 != r2) + ItemStorageMenuPrint(gPCText_OptionDescList[r2]); + break; + case -1: + PlaySE(SE_SELECT); + ItemStorage_Exit(taskId); + break; + default: + PlaySE(SE_SELECT); + gPCText_ItemPCOptionsText[inputOptionId].func.void_u8(taskId); + break; + } +} + +static void ItemStorage_Deposit(u8 taskId) +{ + gTasks[taskId].func = Task_ItemStorage_Deposit; + FadeScreen(1, 0); +} + +static void Task_ItemStorage_Deposit(u8 taskId) +{ + if (!gPaletteFade.active) + { + overworld_free_bg_tilemaps(); + sub_81AAC14(); + DestroyTask(taskId); + } +} + +void sub_816B31C(void) +{ + gFieldCallback = Mailbox_DoRedrawMailboxMenuAfterReturn; + SetMainCallback2(CB2_ReturnToField); +} + +void Mailbox_DoRedrawMailboxMenuAfterReturn(void) +{ + sub_81973A4(); + NewMenuHelpers_DrawDialogueFrame(0, 1); + InitItemStorageMenu(CreateTask(ItemStorage_HandleReturnToProcessInput, 0), 1); + pal_fill_black(); +} + +static void ItemStorage_HandleReturnToProcessInput(u8 taskId) +{ + if (sub_80ABDFC() == TRUE) + gTasks[taskId].func = ItemStorageMenuProcessInput; +} + +static void ItemStorage_Withdraw(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + NUM_ITEMS = sub_80D6CE4(); + if (NUM_ITEMS != 0) + ItemStorage_WithdrawToss_Helper(taskId, FALSE); + else + { + sub_816B4DC(taskId); + DisplayItemMessageOnField(taskId, gText_NoItems, PlayerPC_ItemStorage); + } + +} + +static void ItemStorage_Toss(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + NUM_ITEMS = sub_80D6CE4(); + if (NUM_ITEMS != 0) + ItemStorage_WithdrawToss_Helper(taskId, TRUE); + else + { + sub_816B4DC(taskId); + DisplayItemMessageOnField(taskId, gText_NoItems, PlayerPC_ItemStorage); + } +} + +static void ItemStorage_WithdrawToss_Helper(u8 taskId, bool8 toss) +{ + u16 *data = gTasks[taskId].data; + + data[3] = toss; + sub_816B4DC(taskId); + playerPCItemPageInfo.cursorPos = 0; + playerPCItemPageInfo.itemsAbove = 0; + playerPCItemPageInfo.scrollIndicatorId = 0xFF; + ItemStorage_SetItemAndMailCount(taskId); + sub_816BC14(); + gpu_pal_allocator_reset__manage_upper_four(); + LoadListMenuArrowsGfx(); + sub_8122344(gUnknown_0203BCC4->spriteIds, 7); + sub_8197434(0,0); + gTasks[taskId].func = ItemStorage_ProcessWithdrawTossInput; +} + +static void ItemStorage_Exit(u8 taskId) +{ + sub_816B4DC(taskId); + ReshowPlayerPC(taskId); +} + + +static void ItemStorage_SetItemAndMailCount(u8 taskId) +{ + if (playerPCItemPageInfo.count > 7) + playerPCItemPageInfo.pageItems = 8; + else + playerPCItemPageInfo.pageItems = playerPCItemPageInfo.count + 1; +} + +static void sub_816B4DC(u8 taskId) +{ + u16 *data = gTasks[taskId].data; + + sub_8198070(data[4], FALSE); + ClearWindowTilemap(data[4]); + RemoveWindow(data[4]); + schedule_bg_copy_tilemap_to_vram(0); +} + +static u8 GetMailboxMailCount(void) +{ + u8 i, j; + + for(i = 0, j = 6; j < 16; j++) + if(gSaveBlock1Ptr->mail[j].itemId != 0) + i++; + + return i; +} + +static void Mailbox_UpdateMailList(void) +{ + struct MailStruct mailBuffer; + u8 i, j; + + for (i=6; i<15; i++) + { + for (j=i+1; j<16; j++) + { + if (gSaveBlock1Ptr->mail[i].itemId == 0) + { + mailBuffer = gSaveBlock1Ptr->mail[i]; + gSaveBlock1Ptr->mail[i] = gSaveBlock1Ptr->mail[j]; + gSaveBlock1Ptr->mail[j] = mailBuffer; + } + } + } +} + +static void Mailbox_DrawMailboxMenu(u8 taskId) +{ + u8 windowId; + + windowId = sub_81D1C84(0); + sub_81D1C84(1); + PrintTextOnWindow(windowId, 1, gText_Mailbox, GetStringCenterAlignXOffset(1, gText_Mailbox, 0x40), 1, 0, NULL); + schedule_bg_copy_tilemap_to_vram(0); + gTasks[taskId].data[5] = sub_81D1DC0(&playerPCItemPageInfo); + sub_81D1E90(&playerPCItemPageInfo); +} + +static void Mailbox_ProcessInput(u8 taskId) +{ + u16 *data = gTasks[taskId].data; + s32 inputOptionId; + + if(!gPaletteFade.active) + { + inputOptionId = ListMenuHandleInputGetItemId(data[5]); + ListMenuGetScrollAndRow(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos)); + + switch(inputOptionId) + { + case -1: + break; + case -2: + PlaySE(SE_SELECT); + RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorId); + Mailbox_ReturnToPlayerPC(taskId); + break; + default: + PlaySE(SE_SELECT); + sub_81D1D04(0); + sub_81D1D04(1); + DestroyListMenuTask(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos)); + schedule_bg_copy_tilemap_to_vram(0); + RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorId); + gTasks[taskId].func = Mailbox_PrintWhatToDoWithPlayerMailText; + break; + } + } +} + +static void Mailbox_PrintWhatToDoWithPlayerMailText(u8 taskId) +{ + StringCopy(gStringVar1, gSaveBlock1Ptr->mail[playerPCItemPageInfo.itemsAbove + 6 + playerPCItemPageInfo.cursorPos].playerName); + sub_81DB554(gStringVar1, 0); + StringExpandPlaceholders(gStringVar4, gText_WhatToDoWithVar1sMail); + DisplayItemMessageOnField(taskId, gStringVar4, Mailbox_PrintMailOptions); +} + +static void Mailbox_ReturnToPlayerPC(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + sub_81D1D04(0); + sub_81D1D04(1); + DestroyListMenuTask(data[5], NULL, NULL); + schedule_bg_copy_tilemap_to_vram(0); + sub_81D1EC0(); + ReshowPlayerPC(taskId); +} + +static void Mailbox_PrintMailOptions(u8 taskId) +{ + u8 r4 = sub_81D1C84(2); + PrintMenuTable(r4, 4, gMailboxMailOptions); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(r4, 4, 0); + schedule_bg_copy_tilemap_to_vram(0); + gTasks[taskId].func = Mailbox_MailOptionsProcessInput; +} + +static void Mailbox_MailOptionsProcessInput(u8 taskId) +{ + s8 inputOptionId = ProcessMenuInput_other(); + + switch(inputOptionId) + { + case -2: + break; + case -1: + PlaySE(SE_SELECT); + Mailbox_Cancel(taskId); + break; + + default: + PlaySE(SE_SELECT); + gMailboxMailOptions[inputOptionId].func.void_u8(taskId); + break; + } +} + +static void Mailbox_DoMailRead(u8 taskId) +{ + FadeScreen(1, 0); + gTasks[taskId].func = Mailbox_FadeAndReadMail; +} + +static void Mailbox_FadeAndReadMail(u8 taskId) +{ + if(!gPaletteFade.active) + { + sub_81D1EC0(); + overworld_free_bg_tilemaps(); + ReadMail(&(gSaveBlock1Ptr->mail[playerPCItemPageInfo.itemsAbove + 6 + playerPCItemPageInfo.cursorPos]), Mailbox_ReturnToFieldFromReadMail, TRUE); + DestroyTask(taskId); + } +} + +static void Mailbox_ReturnToFieldFromReadMail(void) +{ + gFieldCallback = pal_fill_for_maplights_or_black; + SetMainCallback2(CB2_ReturnToField); +} + +static void pal_fill_for_maplights_or_black(void) +{ + u8 taskId; + + sub_81973A4(); + taskId = CreateTask(Mailbox_HandleReturnToProcessInput, 0); + if(sub_81D1C44(playerPCItemPageInfo.count) == TRUE) + Mailbox_DrawMailboxMenu(taskId); + else + DestroyTask(taskId); + pal_fill_black(); +} + +static void Mailbox_HandleReturnToProcessInput(u8 taskId) +{ + if(sub_80ABDFC() == TRUE) + gTasks[taskId].func = Mailbox_ProcessInput; +} + +static void Mailbox_MoveToBag(u8 taskId) +{ + DisplayItemMessageOnField(taskId, gText_MessageWillBeLost, Mailbox_DrawYesNoBeforeMove); +} + +static void Mailbox_DrawYesNoBeforeMove(u8 taskId) +{ + sub_8197930(); + gTasks[taskId].func = Mailbox_MoveToBagYesNoPrompt; +} + +static void Mailbox_MoveToBagYesNoPrompt(u8 taskId) +{ + switch(ProcessMenuInputNoWrap_()) + { + case 0: + Mailbox_DoMailMoveToBag(taskId); + break; + case -1: + PlaySE(SE_SELECT); + case 1: + Mailbox_CancelMoveToBag(taskId); + break; + case -2: + default: + break; + } +} + +static void Mailbox_DoMailMoveToBag(u8 taskId) +{ + struct MailStruct *mailStruct = &(gSaveBlock1Ptr->mail[playerPCItemPageInfo.itemsAbove + 6 + playerPCItemPageInfo.cursorPos]); + if(!AddBagItem(mailStruct->itemId, 1)) + { + DisplayItemMessageOnField(taskId, gText_BagIsFull, Mailbox_Cancel); + } + else + { + DisplayItemMessageOnField(taskId, gText_MailToBagMessageErased, Mailbox_Cancel); + ClearMailStruct(mailStruct); + Mailbox_UpdateMailList(); + playerPCItemPageInfo.count--; + if(playerPCItemPageInfo.count < (playerPCItemPageInfo.pageItems + playerPCItemPageInfo.itemsAbove) && playerPCItemPageInfo.itemsAbove != 0) + playerPCItemPageInfo.itemsAbove--; + ItemStorage_SetItemAndMailCount(taskId); + } +} + +static void Mailbox_CancelMoveToBag(u8 taskId) +{ + Mailbox_Cancel(taskId); +} + +static void Mailbox_Give(u8 taskId) +{ + if(CalculatePlayerPartyCount() == 0) + Mailbox_NoPokemonForMail(taskId); + else + { + FadeScreen(1, 0); + gTasks[taskId].func = Mailbox_DoGiveMailPokeMenu; + } +} + +static void Mailbox_DoGiveMailPokeMenu(u8 taskId) +{ + if(!gPaletteFade.active) + { + sub_81D1EC0(); + overworld_free_bg_tilemaps(); + sub_81B8448(); + DestroyTask(taskId); + } +} + +void Mailbox_ReturnToMailListAfterDeposit(void) +{ + gFieldCallback = Mailbox_UpdateMailListAfterDeposit; + SetMainCallback2(CB2_ReturnToField); +} + +static void Mailbox_UpdateMailListAfterDeposit(void) +{ + u8 taskId; + u8 prevCount; + taskId = CreateTask(Mailbox_HandleReturnToProcessInput, 0); + prevCount = playerPCItemPageInfo.count; + playerPCItemPageInfo.count = GetMailboxMailCount(); + Mailbox_UpdateMailList(); + if(prevCount != playerPCItemPageInfo.count && (playerPCItemPageInfo.count < (playerPCItemPageInfo.pageItems + playerPCItemPageInfo.itemsAbove)) + && playerPCItemPageInfo.itemsAbove != 0) + playerPCItemPageInfo.itemsAbove--; + ItemStorage_SetItemAndMailCount(taskId); + sub_81973A4(); + if(sub_81D1C44(playerPCItemPageInfo.count) == TRUE) + Mailbox_DrawMailboxMenu(taskId); + else + DestroyTask(taskId); + pal_fill_black(); +} + +static void Mailbox_NoPokemonForMail(u8 taskId) +{ + DisplayItemMessageOnField(taskId, gText_NoPokemon, Mailbox_Cancel); +} + +static void Mailbox_Cancel(u8 taskId) +{ + sub_81D1D04(2); + sub_8197434(0, 0); + Mailbox_DrawMailboxMenu(taskId); + schedule_bg_copy_tilemap_to_vram(0); + gTasks[taskId].func = Mailbox_ProcessInput; +} + +static void sub_816BC14(void) +{ + gUnknown_0203BCC4 = AllocZeroed(sizeof(struct Struct203BCC4)); + memset(gUnknown_0203BCC4->windowIds, 0xFF, 0x6); + gUnknown_0203BCC4->unk666 = 0xFF; + gUnknown_0203BCC4->spriteId = 0xFF; +} + +static void sub_816BC58(void) +{ + u32 i; + + for(i = 0; i < 6; i++) + sub_816BCC4(i); + Free(gUnknown_0203BCC4); +} + +static u8 sub_816BC7C(u8 a) +{ + u8 *windowIdLoc = &(gUnknown_0203BCC4->windowIds[a]); + if(*windowIdLoc == 0xFF) + { + *windowIdLoc = AddWindow(&gUnknown_085DFF5C[a]); + SetWindowBorderStyle(*windowIdLoc, FALSE, 0x214, 0xE); + schedule_bg_copy_tilemap_to_vram(0); + } + return *windowIdLoc; +} + +static void sub_816BCC4(u8 a) +{ + u8 *windowIdLoc = &(gUnknown_0203BCC4->windowIds[a]); + if(*windowIdLoc != 0xFF) + { + sub_8198070(*windowIdLoc, FALSE); + ClearWindowTilemap(*windowIdLoc); + schedule_bg_copy_tilemap_to_vram(0); + RemoveWindow(*windowIdLoc); + *windowIdLoc = 0xFF; + } +} + +void ItemStorage_RefreshListMenu(void) +{ + u16 i; + + for(i = 0; i < playerPCItemPageInfo.count - 1; i++) + { + CopyItemName_PlayerPC(&(gUnknown_0203BCC4->unk198[i][0]), gSaveBlock1Ptr->pcItems[i].itemId); + gUnknown_0203BCC4->unk0[i].name = &(gUnknown_0203BCC4->unk198[i][0]); + gUnknown_0203BCC4->unk0[i].id = i; + } + StringCopy(&(gUnknown_0203BCC4->unk198[i][0]) ,gText_Cancel2); + gUnknown_0203BCC4->unk0[i].name = &(gUnknown_0203BCC4->unk198[i][0]); + gUnknown_0203BCC4->unk0[i].id = -2; + gMultiuseListMenuTemplate = gUnknown_085DFF44; + gMultiuseListMenuTemplate.windowId = sub_816BC7C(0); + gMultiuseListMenuTemplate.totalItems = playerPCItemPageInfo.count; + gMultiuseListMenuTemplate.items = gUnknown_0203BCC4->unk0; + gMultiuseListMenuTemplate.maxShowed = playerPCItemPageInfo.pageItems; +} + +void CopyItemName_PlayerPC(u8 *string, u16 itemId) +{ + CopyItemName(itemId, string); +} + +static void ItemStorage_MoveCursor(s32 id, bool8 b, struct ListMenu *thisMenu) +{ + if(b != TRUE) + PlaySE(SE_SELECT); + if(gUnknown_0203BCC4->unk666 == 0xFF) + { + sub_816C0C8(); + if(id != -2) + sub_816C060(gSaveBlock1Ptr->pcItems[id].itemId); + else + sub_816C060(ITEMPC_GO_BACK_TO_PREV); + sub_816BEF0(id); + } +} + +static void fish4_goto_x5_or_x6(u8 windowId, s32 id, u8 yOffset) +{ + if(id != -2) + { + if(gUnknown_0203BCC4->unk666 != 0xFF) + { + if(gUnknown_0203BCC4->unk666 == (u8)id) + sub_816BFE0(yOffset, 0, 0xFF); + else + sub_816BFE0(yOffset, 0xFF, 0xFF); + } + ConvertIntToDecimalStringN(gStringVar1, gSaveBlock1Ptr->pcItems[id].quantity, STR_CONV_MODE_RIGHT_ALIGN, 3); + StringExpandPlaceholders(gStringVar4, gText_xVar1); + PrintTextOnWindow(windowId, 7, gStringVar4, GetStringRightAlignXOffset(7, gStringVar4, 104), yOffset, 0xFF, NULL); + } +} + +static void sub_816BEF0(s32 id) +{ + const u8* description; + u8 windowId = gUnknown_0203BCC4->windowIds[1]; + + if(id != -2) + description = (u8 *)ItemId_GetDescription(gSaveBlock1Ptr->pcItems[id].itemId); + else + description = ItemStorage_GetItemPcResponse(ITEMPC_GO_BACK_TO_PREV); + FillWindowPixelBuffer(windowId, 17); + PrintTextOnWindow(windowId, 1, description, 0, 1, 0, NULL); +} + +static void ItemStorage_StartScrollIndicator(void) +{ + if(playerPCItemPageInfo.scrollIndicatorId == 0xFF) + playerPCItemPageInfo.scrollIndicatorId = AddScrollIndicatorArrowPairParametrized(0x2, 0xB0, 0xC, 0x94, playerPCItemPageInfo.count - playerPCItemPageInfo.pageItems, 0x13F8, 0x13F8, &(playerPCItemPageInfo.itemsAbove)); +} + +static void ItemStorage_RemoveScrollIndicator(void) +{ + if(playerPCItemPageInfo.scrollIndicatorId != 0xFF) + { + RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorId); + playerPCItemPageInfo.scrollIndicatorId = 0xFF; + } +} + +static void sub_816BFB8(u8 a, u8 b, u8 speed) +{ + sub_816BFE0(ListMenuGetYCoordForPrintingArrowCursor(a), b, speed); +} + +static void sub_816BFE0(u8 y, u8 b, u8 speed) +{ + u8 windowId = gUnknown_0203BCC4->windowIds[0]; + if(b == 0xFF) + FillWindowPixelRect(windowId, 17, 0, y, GetMenuCursorDimensionByFont(1, 0), GetMenuCursorDimensionByFont(1, 1)); + else + AddTextPrinterParameterized2(windowId, 1, 0, y, 0, 0, gUnknown_085DFF8C, speed, gText_SelectorArrow2); +} + +static void sub_816C060(u16 itemId) +{ + u8 spriteId; + u8* spriteIdLoc = &(gUnknown_0203BCC4->spriteId); + + if(*spriteIdLoc == 0xFF) + { + FreeSpriteTilesByTag(0x13F6); + FreeSpritePaletteByTag(0x13F6); + spriteId = AddItemIconSprite(0x13F6, 0x13F6, itemId); + if(spriteId != 64) + { + *spriteIdLoc = spriteId; + gSprites[spriteId].oam.priority = 0; + gSprites[spriteId].pos2.x = 24; + gSprites[spriteId].pos2.y = 80; + } + } +} + +static void sub_816C0C8(void) +{ + u8* spriteIdLoc = &(gUnknown_0203BCC4->spriteId); + if(*spriteIdLoc != 0xFF) + { + FreeSpriteTilesByTag(0x13F6); + FreeSpritePaletteByTag(0x13F6); + DestroySprite(&(gSprites[*spriteIdLoc])); + *spriteIdLoc = 0xFF; + } +} + +static void sub_816C110(void) +{ + sub_80D6E84(); + sub_812220C(gSaveBlock1Ptr->pcItems, 50, &(playerPCItemPageInfo.pageItems), &(playerPCItemPageInfo.count), 0x8); +} + +static void sub_816C140(void) +{ + sub_812225C(&(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos), playerPCItemPageInfo.pageItems, playerPCItemPageInfo.count); +} + +static void ItemStorage_ProcessWithdrawTossInput(u8 taskId) +{ + s16 *data; + bool32 toss; + u32 i, x; + u8 windowId; + const u8* text; + + data = gTasks[taskId].data; + for(i = 0; i <=3; i++) + sub_816BC7C(i); + toss = data[3]; + text = gText_TossItem; + if(!toss) + text = gText_WithdrawItem; + x = GetStringCenterAlignXOffset(1, text, 104); + PrintTextOnWindow(gUnknown_0203BCC4->windowIds[3], 1, text, x, 1, 0, NULL); + CopyWindowToVram(gUnknown_0203BCC4->windowIds[2], 2); + sub_816C110(); + sub_816C140(); + ItemStorage_RefreshListMenu(); + data[5] = ListMenuInit(&gMultiuseListMenuTemplate, playerPCItemPageInfo.itemsAbove, playerPCItemPageInfo.cursorPos); + ItemStorage_StartScrollIndicator(); + schedule_bg_copy_tilemap_to_vram(0); + gTasks[taskId].func = ItemStorage_ProcessInput; +} + +static const u8* ItemStorage_GetItemPcResponse(u16 itemId) +{ + const u8 *string; + + switch(itemId) + { + case ITEMPC_GO_BACK_TO_PREV: + string = gText_GoBackPrevMenu; + break; + case ITEMPC_HOW_MANY_TO_WITHDRAW: + string = gText_WithdrawHowManyItems; + break; + case ITEMPC_WITHDREW_THING: + string = gText_WithdrawXItems; + break; + case ITEMPC_HOW_MANY_TO_TOSS: + string = gText_TossHowManyVar1s; + break; + case ITEMPC_THREW_AWAY_ITEM: + string = gText_ThrewAwayVar2Var1s; + break; + case ITEMPC_NO_MORE_ROOM: + string = gText_NoRoomInBag; + break; + case ITEMPC_TOO_IMPORTANT: + string = gText_TooImportantToToss; + break; + case ITEMPC_OKAY_TO_THROW_AWAY: + string = gText_ConfirmTossItems; + break; + case ITEMPC_SWITCH_WHICH_ITEM: + string = gText_MoveVar1Where; + break; + default: + string = ItemId_GetDescription(itemId); + break; + } + return string; +} + +static void ItemStorage_PrintItemPcResponse(const u8 *string) +{ + u8 windowId = gUnknown_0203BCC4->windowIds[1]; + FillWindowPixelBuffer(windowId, 0x11); + StringExpandPlaceholders(gStringVar4, string); + PrintTextOnWindow(windowId, 1, gStringVar4, 0, 1, 0, NULL); +} + +static void ItemStorage_ProcessInput(u8 taskId) +{ + s16 *data; + s32 id; + + data = gTasks[taskId].data; + if(gMain.newKeys & SELECT_BUTTON) + { + ListMenuGetScrollAndRow(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos)); + if((playerPCItemPageInfo.itemsAbove + playerPCItemPageInfo.cursorPos) != (playerPCItemPageInfo.count - 1)) + { + PlaySE(SE_SELECT); + ItemStorage_ItemSwapChoosePrompt(taskId); + } + } + else + { + id = ListMenuHandleInputGetItemId(data[5]); + ListMenuGetScrollAndRow(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos)); + switch(id) + { + case -1: + break; + case -2: + PlaySE(SE_SELECT); + ItemStorage_GoBackToPlayerPCMenu(taskId); + break; + default: + PlaySE(SE_SELECT); + ItemStorage_DoItemAction(taskId); + break; + } + } +} + +static void ItemStorage_GoBackToPlayerPCMenu_InitStorage(u8 taskId) +{ + s16 *data; + + data = gTasks[taskId].data; + if(!IsDma3ManagerBusyWithBgCopy()) + { + NewMenuHelpers_DrawDialogueFrame(0, 0); + if(!data[3]) + InitItemStorageMenu(taskId, ITEMPC_MENU_WITHDRAW); + else + InitItemStorageMenu(taskId, ITEMPC_MENU_TOSS); + gTasks[taskId].func = ItemStorageMenuProcessInput; + } +} + +static void ItemStorage_GoBackToPlayerPCMenu(u8 taskId) +{ + s16 *data; + + data = gTasks[taskId].data; + sub_816C0C8(); + ItemStorage_RemoveScrollIndicator(); + DestroyListMenuTask(data[5], NULL, NULL); + sub_81223B0(gUnknown_0203BCC4->spriteIds, 7); + sub_816BC58(); + gTasks[taskId].func = ItemStorage_GoBackToPlayerPCMenu_InitStorage; +} + +static void ItemStorage_ItemSwapChoosePrompt(u8 taskId) +{ + s16 *data; + + data = gTasks[taskId].data; + sub_81AF15C(data[5], 16, 1); + gUnknown_0203BCC4->unk666 = (playerPCItemPageInfo.itemsAbove + playerPCItemPageInfo.cursorPos); + sub_816BFB8(data[5], 0, 0); + sub_816C690(gUnknown_0203BCC4->unk666); + CopyItemName(gSaveBlock1Ptr->pcItems[gUnknown_0203BCC4->unk666].itemId, gStringVar1); + ItemStorage_PrintItemPcResponse(ItemStorage_GetItemPcResponse(ITEMPC_SWITCH_WHICH_ITEM)); + gTasks[taskId].func = sub_816C4FC; +} + +static void sub_816C4FC(u8 taskId) +{ + s16 *data; + s32 id; + + data = gTasks[taskId].data; + if(gMain.newKeys & SELECT_BUTTON) + { + ListMenuGetScrollAndRow(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos)); + ItemStorage_DoItemSwap(taskId, FALSE); + return; + } + id = ListMenuHandleInputGetItemId(data[5]); + ListMenuGetScrollAndRow(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos)); + sub_81223FC(gUnknown_0203BCC4->spriteIds, 7, 0); + sub_816C690(playerPCItemPageInfo.cursorPos); + switch(id) + { + case -1: + break; + case -2: + if(gMain.newKeys & A_BUTTON) + { + ItemStorage_DoItemSwap(taskId, FALSE); + } + else + ItemStorage_DoItemSwap(taskId, TRUE); + break; + default: + ItemStorage_DoItemSwap(taskId, FALSE); + break; + } +} + +static void ItemStorage_DoItemSwap(u8 taskId, bool8 a) +{ + s16 *data; + u16 b; + u8 c; + + data = gTasks[taskId].data; + b = (playerPCItemPageInfo.itemsAbove + playerPCItemPageInfo.cursorPos); + PlaySE(SE_SELECT); + DestroyListMenuTask(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos)); + if(!a) + { + c = gUnknown_0203BCC4->unk666; + if(c != b) + { + if(c != b - 1) + { + sub_80D702C(gSaveBlock1Ptr->pcItems, c, b); + ItemStorage_RefreshListMenu(); + } + } + else + goto LABEL_SKIP_CURSOR_DECREMENT; + } + if (gUnknown_0203BCC4->unk666 < b) + playerPCItemPageInfo.cursorPos--; + LABEL_SKIP_CURSOR_DECREMENT: + sub_81223FC(gUnknown_0203BCC4->spriteIds, 7, 1); + gUnknown_0203BCC4->unk666 = 0xFF; + data[5] = ListMenuInit(&gMultiuseListMenuTemplate, playerPCItemPageInfo.itemsAbove, playerPCItemPageInfo.cursorPos); + schedule_bg_copy_tilemap_to_vram(0); + gTasks[taskId].func = ItemStorage_ProcessInput; +} + +static void sub_816C690(u8 a) +{ + sub_8122448(gUnknown_0203BCC4->spriteIds, 7, 128, ((a+1) * 16)); +} + +static void sub_816C6BC(u8 windowId, u16 value, u32 mode, u8 x, u8 y, u8 n) +{ + ConvertIntToDecimalStringN(gStringVar1, value, mode, n); + StringExpandPlaceholders(gStringVar4, gText_xVar1); + PrintTextOnWindow(windowId, 1, gStringVar4, GetStringCenterAlignXOffset(1, gStringVar4, 48), y, 0, NULL); +} + +static void ItemStorage_DoItemAction(u8 taskId) +{ + s16 *data; + u16 b; + + data = gTasks[taskId].data; + b = (playerPCItemPageInfo.cursorPos + playerPCItemPageInfo.itemsAbove); + ItemStorage_RemoveScrollIndicator(); + data[2] = 1; + if(!data[3]) + { + if(gSaveBlock1Ptr->pcItems[b].quantity == 1) + { + ItemStorage_DoItemWithdraw(taskId); + return; + } + CopyItemName(gSaveBlock1Ptr->pcItems[b].itemId, gStringVar1); + ItemStorage_PrintItemPcResponse(ItemStorage_GetItemPcResponse(ITEMPC_HOW_MANY_TO_WITHDRAW)); + } + else + { + if(gSaveBlock1Ptr->pcItems[b].quantity == 1) + { + ItemStorage_DoItemToss(taskId); + return; + } + CopyItemName(gSaveBlock1Ptr->pcItems[b].itemId, gStringVar1); + ItemStorage_PrintItemPcResponse(ItemStorage_GetItemPcResponse(ITEMPC_HOW_MANY_TO_TOSS)); + } + sub_816C6BC(sub_816BC7C(4), data[2], STR_CONV_MODE_LEADING_ZEROS, 8, 1, 3); + gTasks[taskId].func = ItemStorage_HandleQuantityRolling; +} + +static void ItemStorage_HandleQuantityRolling(u8 taskId) +{ + s16 *data; + u16 b; + + data = gTasks[taskId].data; + b = (playerPCItemPageInfo.cursorPos + playerPCItemPageInfo.itemsAbove); + if(AdjustQuantityAccordingToDPadInput(&(data[2]), gSaveBlock1Ptr->pcItems[b].quantity) == TRUE) + sub_816C6BC(sub_816BC7C(4), data[2], STR_CONV_MODE_LEADING_ZEROS, 8, 1, 3); + else + { + if(gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + sub_816BCC4(4); + if(!data[3]) + ItemStorage_DoItemWithdraw(taskId); + else + ItemStorage_DoItemToss(taskId); + } + else if(gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + sub_816BCC4(4); + ItemStorage_PrintItemPcResponse(ItemStorage_GetItemPcResponse(gSaveBlock1Ptr->pcItems[b].itemId)); + ItemStorage_StartScrollIndicatorAndProcessInput(taskId); + } + } +} + +static void ItemStorage_DoItemWithdraw(u8 taskId) +{ + s16 *data; + u16 b; + + data = gTasks[taskId].data; + b = (playerPCItemPageInfo.cursorPos + playerPCItemPageInfo.itemsAbove); + if(AddBagItem(gSaveBlock1Ptr->pcItems[b].itemId, data[2]) == TRUE) + { + CopyItemName(gSaveBlock1Ptr->pcItems[b].itemId, gStringVar1); + ConvertIntToDecimalStringN(gStringVar2, data[2], STR_CONV_MODE_LEFT_ALIGN, 3); + ItemStorage_PrintItemPcResponse(ItemStorage_GetItemPcResponse(ITEMPC_WITHDREW_THING)); + gTasks[taskId].func = ItemStorage_HandleRemoveItem; + } + else + { + data[2] = 0; + ItemStorage_PrintItemPcResponse(ItemStorage_GetItemPcResponse(ITEMPC_NO_MORE_ROOM)); + gTasks[taskId].func = ItemStorage_WaitPressHandleResumeProcessInput; + } +} + +static void ItemStorage_DoItemToss(u8 taskId) +{ + s16 *data; + u16 b; + + data = gTasks[taskId].data; + b = (playerPCItemPageInfo.cursorPos + playerPCItemPageInfo.itemsAbove); + if(!itemid_is_unique(gSaveBlock1Ptr->pcItems[b].itemId)) + { + CopyItemName(gSaveBlock1Ptr->pcItems[b].itemId, gStringVar1); + ConvertIntToDecimalStringN(gStringVar2, data[2], STR_CONV_MODE_LEFT_ALIGN, 3); + ItemStorage_PrintItemPcResponse(ItemStorage_GetItemPcResponse(ITEMPC_OKAY_TO_THROW_AWAY)); + CreateYesNoMenuWithCallbacks(taskId, &gUnknown_085DFF84, 1, 0, 1, 0x214, 0xE, &ResumeFromWithdrawYesNoFuncList); + } + else + { + data[2] = 0; + ItemStorage_PrintItemPcResponse(ItemStorage_GetItemPcResponse(ITEMPC_TOO_IMPORTANT)); + gTasks[taskId].func = ItemStorage_WaitPressHandleResumeProcessInput; + } +} + +static void ItemStorage_ResumeInputFromYesToss(u8 taskId) +{ + ItemStorage_PrintItemPcResponse(ItemStorage_GetItemPcResponse(ITEMPC_THREW_AWAY_ITEM)); + gTasks[taskId].func = ItemStorage_HandleRemoveItem; +} + +static void ItemStorage_ResumeInputFromNoToss(u8 taskId) +{ + ItemStorage_PrintItemPcResponse(ItemStorage_GetItemPcResponse(gSaveBlock1Ptr->pcItems[(playerPCItemPageInfo.itemsAbove + playerPCItemPageInfo.cursorPos)].itemId)); + ItemStorage_StartScrollIndicatorAndProcessInput(taskId); +} + +static void ItemStorage_HandleRemoveItem(u8 taskId) +{ + s16 *data; + + data = gTasks[taskId].data; + if(gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + sub_80D6E48((playerPCItemPageInfo.cursorPos + playerPCItemPageInfo.itemsAbove), data[2]); + DestroyListMenuTask(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos)); + sub_816C110(); + sub_816C140(); + ItemStorage_RefreshListMenu(); + data[5] = ListMenuInit(&gMultiuseListMenuTemplate, playerPCItemPageInfo.itemsAbove, playerPCItemPageInfo.cursorPos); + ItemStorage_StartScrollIndicatorAndProcessInput(taskId); + } +} + +static void ItemStorage_WaitPressHandleResumeProcessInput(u8 taskId) +{ + s16 *data; + + data = gTasks[taskId].data; + if(gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + ItemStorage_PrintItemPcResponse(ItemStorage_GetItemPcResponse(gSaveBlock1Ptr->pcItems[(playerPCItemPageInfo.itemsAbove + playerPCItemPageInfo.cursorPos)].itemId)); + ItemStorage_StartScrollIndicatorAndProcessInput(taskId); + } +} + +static void ItemStorage_StartScrollIndicatorAndProcessInput(u8 taskId) +{ + ItemStorage_StartScrollIndicator(); + gTasks[taskId].func = ItemStorage_ProcessInput; +} diff --git a/src/pokeblock.c b/src/pokeblock.c index b244409c4..e829452b2 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -460,7 +460,7 @@ static bool8 InitPokeblockMenu(void) gMain.state++; break; case 10: - sub_8122344(&sPokeblockMenu->field_E75, FIELD_E75_COUNT); + sub_8122344(sPokeblockMenu->field_E75, FIELD_E75_COUNT); gMain.state++; break; case 11: diff --git a/sym_ewram.txt b/sym_ewram.txt index 96862ccd5..f96ce30e7 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -805,25 +805,7 @@ gUnknown_0203BC8C: @ 203BC8C .space 0x4 .include "src/use_pokeblock.o" - -gUnknown_0203BCB0: @ 203BCB0 - .space 0x4 - -gUnknown_0203BCB4: @ 203BCB4 - .space 0x4 - -gUnknown_0203BCB8: @ 203BCB8 - .space 0x2 - -gUnknown_0203BCBA: @ 203BCBA - .space 0x2 - -gUnknown_0203BCBC: @ 203BCBC - .space 0x8 - -gUnknown_0203BCC4: @ 203BCC4 - .space 0x4 - + .include "src/player_pc.o" .include "src/intro.o" .include "src/field_region_map.o" @@ -954,23 +936,8 @@ gUnknown_0203CEFC: @ 203CEFC gUnknown_0203CF00: @ 203CF00 .space 0x4 -gUnknown_0203CF04: @ 203CF04 - .space 0x4 - -gUnknown_0203CF08: @ 203CF08 - .space 0x4 - -gUnknown_0203CF0C: @ 203CF0C - .space 0x4 - -gUnknown_0203CF10: @ 203CF10 - .space 0x4 - -gUnknown_0203CF14: @ 203CF14 - .space 0x4 - -gUnknown_0203CF18: @ 203CF18 - .space 0x4 + .include "src/fossil_specials.o" + .include "src/fldeff_groundshake.o" gUnknown_0203CF1C: @ 203CF1C .space 0x4