diff --git a/asm/player_pc.s b/asm/player_pc.s index 8a329a2fe..8c8bde42d 100644 --- a/asm/player_pc.s +++ b/asm/player_pc.s @@ -5,1286 +5,1289 @@ .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 + .equ gPcItemMenuOptionOrder, 0x0203BCB0 + .equ gPcItemMenuOptionsNum, 0x0203BCB4 + +// 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_816AE58 +//sub_816AE58: @ 816AE58 +// push {lr} +// ldr r1, =gPcItemMenuOptionOrder +// ldr r0, =gUnknown_085DFED4 +// str r0, [r1] +// ldr r1, =gPcItemMenuOptionsNum +// 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, =InitPlayerPCMenu +// 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_816AE98 +//sub_816AE98: @ 816AE98 +// push {lr} +// ldr r1, =gPcItemMenuOptionOrder +// ldr r0, =gUnknown_085DFED8 +// str r0, [r1] +// ldr r1, =gPcItemMenuOptionsNum +// 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, =InitPlayerPCMenu +// 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 InitPlayerPCMenu +//InitPlayerPCMenu: @ 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, =gPcItemMenuOptionsNum +// 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, =gPcItemMenuOptionOrder +// 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 InitPlayerPCMenu - 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 PlayerPCProcessMenuInput +//PlayerPCProcessMenuInput: @ 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, =gPcItemMenuOptionsNum +// 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, =PlayerPC_TurnOff +// 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, =sPlayerPCMenuActions +// ldr r0, =gPcItemMenuOptionOrder +// 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 PlayerPCProcessMenuInput - 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 ReshowPlayerPC +//ReshowPlayerPC: @ 816B060 +// push {lr} +// lsls r0, 24 +// lsrs r0, 24 +// ldr r1, =gText_WhatWouldYouLike +// ldr r2, =InitPlayerPCMenu +// bl DisplayItemMessageOnField +// pop {r0} +// bx r0 +// .pool +// thumb_func_end ReshowPlayerPC - 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 PlayerPC_ItemStorage +//PlayerPC_ItemStorage: @ 816B07C +// push {r4,lr} +// adds r4, r0, 0 +// lsls r4, 24 +// lsrs r4, 24 +// adds r0, r4, 0 +// movs r1, 0 +// bl InitItemStorageMenu +// ldr r1, =gTasks +// lsls r0, r4, 2 +// adds r0, r4 +// lsls r0, 3 +// adds r0, r1 +// ldr r1, =ItemStorageMenuProcessInput +// str r1, [r0] +// pop {r4} +// pop {r0} +// bx r0 +// .pool +// thumb_func_end PlayerPC_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 PlayerPC_Mailbox +//PlayerPC_Mailbox: @ 816B0A8 +// push {r4-r6,lr} +// lsls r0, 24 +// lsrs r4, r0, 24 +// adds r6, r4, 0 +// bl GetMailboxMailCount +// 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, =ReshowPlayerPC +// 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 Mailbox_UpdateMailList +// adds r0, r4, 0 +// bl ItemStorage_SetItemAndMailCount +// 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 Mailbox_DrawMailboxMenu +// ldr r0, =gTasks +// lsls r1, r4, 2 +// adds r1, r4 +// lsls r1, 3 +// adds r1, r0 +// ldr r0, =Mailbox_ProcessInput +// str r0, [r1] +// b _0816B12A +// .pool +//_0816B120: +// ldr r1, =gText_NoMailHere +// ldr r2, =ReshowPlayerPC +// adds r0, r6, 0 +// bl DisplayItemMessageOnField +//_0816B12A: +// pop {r4-r6} +// pop {r0} +// bx r0 +// .pool +// thumb_func_end PlayerPC_Mailbox - 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 PlayerPC_Decoration +//PlayerPC_Decoration: @ 816B138 +// push {lr} +// lsls r0, 24 +// lsrs r0, 24 +// bl sub_8126B2C +// pop {r0} +// bx r0 +// thumb_func_end PlayerPC_Decoration - 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 PlayerPC_TurnOff +//PlayerPC_TurnOff: @ 816B148 +// push {r4,lr} +// lsls r0, 24 +// lsrs r4, r0, 24 +// ldr r0, =gPcItemMenuOptionsNum +// 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 PlayerPC_TurnOff - 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 InitItemStorageMenu +//InitItemStorageMenu: @ 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, =gPCText_ItemPCOptionsText +// 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, =gPCText_OptionDescList +// 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 InitItemStorageMenu - 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_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 ItemStorageMenuProcessInput +//ItemStorageMenuProcessInput: @ 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, =gPCText_ItemPCOptionsText +// 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, =gPCText_OptionDescList +// lsls r1, r2, 2 +// adds r1, r0 +// ldr r0, [r1] +// bl ItemStorageMenuPrint +// b _0816B2C0 +// .pool +//_0816B2B4: +// movs r0, 0x5 +// bl PlaySE +// adds r0, r6, 0 +// bl ItemStorage_Exit +//_0816B2C0: +// pop {r4-r6} +// pop {r0} +// bx r0 +// thumb_func_end ItemStorageMenuProcessInput - 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 ItemStorage_Deposit +//ItemStorage_Deposit: @ 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 ItemStorage_Deposit +// +// 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_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, =ItemStorage_HandleReturnToProcessInput +// movs r1, 0 +// bl CreateTask +// lsls r0, 24 +// lsrs r0, 24 +// movs r1, 0x1 +// bl InitItemStorageMenu +// bl pal_fill_black +// pop {r0} +// bx r0 +// .pool +// thumb_func_end mapldr_080EBC0C +// +// thumb_func_start ItemStorage_HandleReturnToProcessInput +//ItemStorage_HandleReturnToProcessInput: @ 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, =ItemStorageMenuProcessInput +// str r0, [r1] +//_0816B388: +// pop {r4} +// pop {r0} +// bx r0 +// .pool +// thumb_func_end ItemStorage_HandleReturnToProcessInput - 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 ItemStorage_Withdraw +//ItemStorage_Withdraw: @ 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, =PlayerPC_ItemStorage +// adds r0, r5, 0 +// bl DisplayItemMessageOnField +//_0816B3D4: +// pop {r4,r5} +// pop {r0} +// bx r0 +// .pool +// thumb_func_end ItemStorage_Withdraw +// +// thumb_func_start ItemStorage_Toss +//ItemStorage_Toss: @ 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, =PlayerPC_ItemStorage +// adds r0, r5, 0 +// bl DisplayItemMessageOnField +//_0816B420: +// pop {r4,r5} +// pop {r0} +// bx r0 +// .pool +// thumb_func_end ItemStorage_Toss - 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_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 ItemStorage_SetItemAndMailCount +// 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_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 ItemStorage_Exit +//ItemStorage_Exit: @ 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 ReshowPlayerPC +// pop {r4} +// pop {r0} +// bx r0 +// thumb_func_end ItemStorage_Exit - 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 ItemStorage_SetItemAndMailCount +//ItemStorage_SetItemAndMailCount: @ 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 ItemStorage_SetItemAndMailCount - 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_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_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 GetMailboxMailCount +//GetMailboxMailCount: @ 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 GetMailboxMailCount - 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 Mailbox_UpdateMailList +//Mailbox_UpdateMailList: @ 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 Mailbox_UpdateMailList - 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 Mailbox_DrawMailboxMenu +//Mailbox_DrawMailboxMenu: @ 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 Mailbox_DrawMailboxMenu - 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 Mailbox_ProcessInput +//Mailbox_ProcessInput: @ 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 sub_81AE860 +// 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 sub_81AE6C8 +// 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 Mailbox_ProcessInput - 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_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_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_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 sub_81AE6C8 +// movs r0, 0 +// bl schedule_bg_copy_tilemap_to_vram +// bl sub_81D1EC0 +// adds r0, r5, 0 +// bl ReshowPlayerPC +// pop {r4,r5} +// pop {r0} +// bx r0 +// .pool +// thumb_func_end sub_816B798 - 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_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_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 sub_81AE860 - 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 sub_81AE6C8 - 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_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_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_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_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 sub_81AE6C8 - 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 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 @@ -1303,7 +1306,7 @@ pal_fill_for_maplights_or_black: @ 816B920 cmp r0, 0x1 bne _0816B954 adds r0, r4, 0 - bl sub_816B5F8 + bl Mailbox_DrawMailboxMenu b _0816B95A .pool _0816B954: @@ -1331,7 +1334,7 @@ task00_080EBBDC: @ 816B964 adds r1, r4 lsls r1, 3 adds r1, r0 - ldr r0, =sub_816B674 + ldr r0, =Mailbox_ProcessInput str r0, [r1] _0816B984: pop {r4} @@ -1445,7 +1448,7 @@ _0816BA68: bl DisplayItemMessageOnField adds r0, r5, 0 bl ClearMailStruct - bl sub_816B54C + bl Mailbox_UpdateMailList ldrb r0, [r4, 0x5] subs r0, 0x1 strb r0, [r4, 0x5] @@ -1461,7 +1464,7 @@ _0816BA68: strh r0, [r4, 0x2] _0816BA96: adds r0, r6, 0 - bl sub_816B4C0 + bl ItemStorage_SetItemAndMailCount _0816BA9C: pop {r4-r6} pop {r0} @@ -1555,9 +1558,9 @@ sub_816BB48: @ 816BB48 lsrs r6, r0, 24 ldr r5, =gUnknown_0203BCB8 ldrb r4, [r5, 0x5] - bl sub_816B510 + bl GetMailboxMailCount strb r0, [r5, 0x5] - bl sub_816B54C + bl Mailbox_UpdateMailList ldrb r0, [r5, 0x5] cmp r4, r0 beq _0816BB7E @@ -1573,7 +1576,7 @@ sub_816BB48: @ 816BB48 strh r0, [r5, 0x2] _0816BB7E: adds r0, r6, 0 - bl sub_816B4C0 + bl ItemStorage_SetItemAndMailCount bl sub_81973A4 ldr r0, =gUnknown_0203BCB8 ldrb r0, [r0, 0x5] @@ -1583,7 +1586,7 @@ _0816BB7E: cmp r0, 0x1 bne _0816BBA8 adds r0, r6, 0 - bl sub_816B5F8 + bl Mailbox_DrawMailboxMenu b _0816BBAE .pool _0816BBA8: @@ -1621,7 +1624,7 @@ sub_816BBD4: @ 816BBD4 movs r1, 0 bl sub_8197434 adds r0, r4, 0 - bl sub_816B5F8 + bl Mailbox_DrawMailboxMenu movs r0, 0 bl schedule_bg_copy_tilemap_to_vram ldr r1, =gTasks @@ -1629,7 +1632,7 @@ sub_816BBD4: @ 816BBD4 adds r0, r4 lsls r0, 3 adds r0, r1 - ldr r1, =sub_816B674 + ldr r1, =Mailbox_ProcessInput str r1, [r0] pop {r4} pop {r0} @@ -2547,20 +2550,20 @@ bx_battle_menu_t3: @ 816C3A4 bne _0816C3DC adds r0, r4, 0 movs r1, 0 - bl sub_816B190 + bl InitItemStorageMenu b _0816C3E4 .pool _0816C3DC: adds r0, r4, 0 movs r1, 0x2 - bl sub_816B190 + bl InitItemStorageMenu _0816C3E4: ldr r0, =gTasks lsls r1, r4, 2 adds r1, r4 lsls r1, 3 adds r1, r0 - ldr r0, =sub_816B248 + ldr r0, =ItemStorageMenuProcessInput str r0, [r1] _0816C3F2: pop {r4,r5} diff --git a/data/event_scripts.s b/data/event_scripts.s index 42c5aa1ad..44705269c 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 index 47bdbff39..ef8a2ba9c 100644 --- a/data/player_pc.s +++ b/data/player_pc.s @@ -5,36 +5,36 @@ .section .rodata .align 2 -gUnknown_085DFEA4:: @ 85DFEA4 +gPCText_OptionDescList:: @ 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 +sPlayerPCMenuActions:: @ 85DFEB4 + .4byte gText_ItemStorage, PlayerPC_ItemStorage + .4byte gText_Mailbox, PlayerPC_Mailbox + .4byte gText_Decoration, PlayerPC_Decoration + .4byte gText_TurnOff, PlayerPC_TurnOff .align 2 -gUnknown_085DFED4:: @ 85DFED4 +gBedroomPC_OptionOrder:: @ 85DFED4 .byte 0x00, 0x01, 0x02, 0x03 .align 2 -gUnknown_085DFED8:: @ 85DFED8 +gPlayerPC_OptionOrder:: @ 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 +gPCText_ItemPCOptionsText:: @ 85DFEDC + .4byte gText_WithdrawItem, ItemStorage_Withdraw + .4byte gText_DepositItem, ItemStorage_Deposit + .4byte gText_TossItem, ItemStorage_Toss + .4byte gText_Cancel, ItemStorage_Exit .align 2 -gUnknown_085DFEFC:: @ 85DFEFC +gNewGamePCItems:: @ 85DFEFC .2byte ITEM_POTION, 0x0001 .2byte 0x0000, 0x0000 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 62dd9717e..df85fb140 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/event_scripts.h b/include/event_scripts.h index 4c5dfd544..defeadc30 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -387,4 +387,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/item_menu.h b/include/item_menu.h index 5c1b26faa..ccf52a7a9 100644 --- a/include/item_menu.h +++ b/include/item_menu.h @@ -20,6 +20,7 @@ extern struct BagStruct gUnknown_0203CE58; 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 c2f15422a..4de9d4b75 100644 --- a/include/menu.h +++ b/include/menu.h @@ -53,6 +53,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/player_pc.h b/include/player_pc.h index cc2e85b2b..fcd58757e 100644 --- a/include/player_pc.h +++ b/include/player_pc.h @@ -1,13 +1,86 @@ #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 MailboxStruct +{ + u16 cursorPos; + u16 itemsAbove; + u8 pageItems; + u8 count; + u8 unk6[6]; + u8 unkC[4]; +}; + // Exported type declarations // Exported RAM declarations // Exported ROM declarations -void sub_816B060(u8 taskId); +void ReshowPlayerPC(u8 taskId); void sub_816B31C(void); #endif //GUARD_PLAYER_PC_H diff --git a/include/strings.h b/include/strings.h index ceb994900..907873160 100644 --- a/include/strings.h +++ b/include/strings.h @@ -372,4 +372,8 @@ extern const u8 gBirchDexRatingText_LessThan190[]; extern const u8 gBirchDexRatingText_LessThan200[]; extern const u8 gBirchDexRatingText_DexCompleted[]; +//player menu text +extern const u8 gText_WhatWouldYouLike[]; +extern const u8 gText_NoMailHere[]; + #endif //GUARD_STRINGS_H diff --git a/ld_script.txt b/ld_script.txt index 7dcf21569..27344f720 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -217,6 +217,7 @@ SECTIONS { src/use_pokeblock.o(.text); asm/use_pokeblock.o(.text); src/battle_controller_wally.o(.text); + src/player_pc.o(.text); asm/player_pc.o(.text); src/intro.o(.text); src/reset_save_heap.o(.text); diff --git a/src/decoration.c b/src/decoration.c index e4d867a34..0b1157000 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/player_pc.c b/src/player_pc.c new file mode 100644 index 000000000..aa58f2e32 --- /dev/null +++ b/src/player_pc.c @@ -0,0 +1,702 @@ +#include "global.h" +#include "constants/songs.h" +#include "decoration.h" +#include "event_scripts.h" +#include "field_fadetransition.h" +#include "field_screen.h" +#include "field_weather.h" +#include "international_string_util.h" +#include "item.h" +#include "item_menu.h" +#include "constants/items.h" +#include "mail.h" +#include "main.h" +#include "menu.h" +#include "menu_helpers.h" +#include "overworld.h" +#include "palette.h" +#include "player_pc.h" +#include "script.h" +#include "sound.h" +#include "string_util.h" +#include "strings.h" +#include "task.h" +#include "window.h" + + +static EWRAM_DATA u8 *gPcItemMenuOptionOrder = NULL; + +static EWRAM_DATA u8 gPcItemMenuOptionsNum = 0; + +extern struct MailboxStruct gUnknown_0203BCB8; + +#define eMailboxInfo gUnknown_0203BCB8 + +struct Struct203BCC4 +{ + u8 filler[0x668]; + u32 unk668; + u8 filler2[4]; + +}; + +extern struct Struct203BCC4 *gUnknown_0203BCC4; + + +/*static*/void InitPlayerPCMenu(u8 taskId); +/*static*/void PlayerPCProcessMenuInput(u8 taskId); +/*static*/void InitItemStorageMenu(u8 taskId, u8 var); +/*static*/ void ItemStorageMenuPrint(const u8 *); +/*static*/ void ItemStorageMenuProcessInput(u8 taskId); +/* +static void ItemStorage_ProcessInput(u8); +*/ +/*static*/ void ItemStorage_SetItemAndMailCount(u8); +/* +static void ItemStorage_DoItemAction(u8); +static void ItemStorage_GoBackToPlayerPCMenu(u8); +static void ItemStorage_HandleQuantityRolling(u8); +static void ItemStorage_DoItemWithdraw(u8); +static void ItemStorage_DoItemToss(u8); +static void ItemStorage_HandleRemoveItem(u8); +static void ItemStorage_WaitPressHandleResumeProcessInput(u8); +*/ +/*static*/ void ItemStorage_HandleReturnToProcessInput(u8); +/* +static void ItemStorage_HandleResumeProcessInput(u8); +static void ItemStorage_DoItemSwap(u8, bool8); +static void ItemStorage_DrawItemList(u8); +static void ItemStorage_PrintItemPcResponse(u16); +static void ItemStorage_DrawBothListAndDescription(u8); +static void ItemStorage_GoBackToItemPCMenu(u8, u8); +static void ItemStorage_LoadPalette(void); +*/ +/*static*/ u8 GetMailboxMailCount(void); + +/*static*/ void Mailbox_UpdateMailList(void); +/*static*/ void Mailbox_DrawMailboxMenu(u8); +/*static*/ void Mailbox_ProcessInput(u8); +/* +static void Mailbox_CloseScrollIndicators(void); +static void Mailbox_PrintWhatToDoWithPlayerMailText(u8); +static void Mailbox_TurnOff(u8); +static void Mailbox_PrintMailOptions(u8); +static void Mailbox_MailOptionsProcessInput(u8); +static void Mailbox_FadeAndReadMail(u8); +static void Mailbox_ReturnToFieldFromReadMail(void); +static void Mailbox_DrawYesNoBeforeMove(u8); +static void Mailbox_DoGiveMailPokeMenu(u8); +static void Mailbox_NoPokemonForMail(u8); +static void Mailbox_Cancel(u8); +static void Mailbox_DrawMailMenuAndDoProcessInput(u8); +*/ +/*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 ItemStorage_Withdraw(u8); +static void ItemStorage_Deposit(u8); +static void ItemStorage_Toss(u8); +*/ +/*static*/ void ItemStorage_Exit(u8); +/* +static void ItemStorage_ResumeInputFromYesToss(u8); +static void ItemStorage_ResumeInputFromNoToss(u8); +static void Mailbox_DoMailMoveToBag(u8); +static void Mailbox_ReturnToInputAfterNo(u8); +static void Mailbox_DoMailRead(u8); +static void Mailbox_MoveToBag(u8); +static void Mailbox_Give(u8); +static void Mailbox_Cancel(u8); +*/ + +extern const u8 *const gPCText_OptionDescList[]; +/* +static const u8 *const gPCText_OptionDescList[] = +{ + PCText_TakeOutItems, + PCText_StoreItems, + PCText_ThrowAwayItems, + gMenuText_GoBackToPrev +}; +*/ +/*static*/ extern const struct MenuAction sPlayerPCMenuActions[];/* = +{ + { SecretBaseText_ItemStorage, PlayerPC_ItemStorage }, + { gPCText_Mailbox, PlayerPC_Mailbox }, + { SecretBaseText_Decoration, PlayerPC_Decoration }, + { SecretBaseText_TurnOff, PlayerPC_TurnOff } +}; +*/ +/*static*/ extern u8 gBedroomPC_OptionOrder[];/* = +{ + PLAYERPC_MENU_ITEMSTORAGE, + PLAYERPC_MENU_MAILBOX, + PLAYERPC_MENU_DECORATION, + PLAYERPC_MENU_TURNOFF +}; +*/ +/*static*/ extern u8 gPlayerPC_OptionOrder[];/* = +{ + PLAYERPC_MENU_ITEMSTORAGE, + PLAYERPC_MENU_MAILBOX, + PLAYERPC_MENU_TURNOFF +}; +*/ +extern const struct MenuAction gPCText_ItemPCOptionsText[]; +/* +static const struct MenuAction2 gPCText_ItemPCOptionsText[] = +{ + { PCText_WithdrawItem, ItemStorage_Withdraw }, + { PCText_DepositItem, ItemStorage_Deposit }, + { PCText_TossItem, ItemStorage_Toss }, + { gUnknownText_Exit, ItemStorage_Exit } +}; + +static const struct YesNoFuncTable ResumeFromTossYesNoFuncList[] = // ResumeFromTossYesNoFuncList +{ + ItemStorage_ResumeInputFromYesToss, + ItemStorage_ResumeInputFromNoToss +}; + +static const struct YesNoFuncTable ResumeFromWithdrawYesNoFuncList[] = // ResumeFromWithdrawYesNoFuncList +{ + Mailbox_DoMailMoveToBag, + Mailbox_ReturnToInputAfterNo +}; +*/ +// the use of this struct is meant to be an ItemSlot struct, but NewGameInitPCItems refuses to match without a weird pointer access. +/*static*/ extern const struct ItemSlot gNewGamePCItems[];/* = +{ + { ITEM_POTION, 1 }, + { ITEM_NONE, 0 } +}; + +static const struct MenuAction2 gMailboxMailOptions[] = +{ + { OtherText_Read, Mailbox_DoMailRead }, + { gOtherText_MoveToBag, Mailbox_MoveToBag }, + { OtherText_Give, Mailbox_Give }, + { gOtherText_CancelNoTerminator, Mailbox_Cancel } +}; + +static const u8 gNonSelectedItemFormattedText[] = _("{STR_VAR_1}{CLEAR_TO 80}"); +static const u8 gSelectedItemFormattedText[] = _("{COLOR RED}{STR_VAR_1}{CLEAR_TO 80}"); +static const u8 gNonSelectedItemQuantityFormatText[] = _("{STR_VAR_1}"); +static const u8 gSelectedItemQuantityFormatText[] = _("{COLOR RED}{STR_VAR_1}"); +static const u8 gUnknown_08406330[] = _("{CLEAR_TO 32}"); +*/ + +extern const struct WindowTemplate gUnknown_085DFF24[3]; + +/* +extern u8 *gUnknown_02039314; +extern struct MenuAction gUnknown_08406298[]; + +extern u8 gUnknown_084062B8[]; +extern u8 gUnknown_084062BC[]; +extern u8 gUnknown_0840632A[]; +extern u8 gUnknown_08406327[]; +extern u8 gUnknown_0840631E[]; +extern u8 gUnknown_08406318[]; + +extern u8 gUnknown_030007B4; +extern u8 unk_201FE00[]; + +extern u8 gUnknown_08152850; +extern u8 gUnknown_08152C75; + +extern u32 gUnknown_08406288[]; +extern const struct MenuAction gUnknown_084062C0[]; +extern const struct YesNoFuncTable gUnknown_084062E0; +*/ + + +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; +} + +bool8 sub_81D1C44(u8); + +/*static*/ void PlayerPC_Mailbox(u8 taskId) +{ + + eMailboxInfo.count = GetMailboxMailCount(); + + if (eMailboxInfo.count == 0) + DisplayItemMessageOnField(taskId, gText_NoMailHere, ReshowPlayerPC); + else + { + eMailboxInfo.cursorPos = 0; + eMailboxInfo.itemsAbove = 0; + eMailboxInfo.unk6[3] = 0xFF; + Mailbox_UpdateMailList(); + ItemStorage_SetItemAndMailCount(taskId); + if(sub_81D1C44(eMailboxInfo.count) == TRUE) + { + sub_8197434(0, 0); + Mailbox_DrawMailboxMenu(taskId); + gTasks[taskId].func = Mailbox_ProcessInput; + } + else + DisplayItemMessageOnField(taskId, gText_NoMailHere, ReshowPlayerPC); + } +} + +void sub_8126B2C(u8); + +/*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); +} + +void ItemStorageMenuPrint(const u8*); + +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 var) +{ + 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(var); + break; + default: + PlaySE(SE_SELECT); + gPCText_ItemPCOptionsText[inputOptionId].func.void_u8(var); + break; + } +} + +void Task_ItemStorage_Deposit(u8 taskId); +/*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 mapldr_080EBC0C(void); + +void (*gFieldCallback)(void); +void sub_816B31C(void) +{ + gFieldCallback = mapldr_080EBC0C; + SetMainCallback2(CB2_ReturnToField); +} + +void mapldr_080EBC0C(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; +} + +u8 sub_80D6CE4(); //count of items +void sub_816B4DC(u8 taskId); +void sub_816B430(u8 taskId, bool8 toss); +extern const u8 gText_NoItems[]; + +/*static*/ void ItemStorage_Withdraw(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + NUM_ITEMS = sub_80D6CE4(); + + if (NUM_ITEMS != 0) + sub_816B430(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) + sub_816B430(taskId, TRUE); + else + { + sub_816B4DC(taskId); + DisplayItemMessageOnField(taskId, gText_NoItems, PlayerPC_ItemStorage); + } +} + +void sub_816BC14(void); +void gpu_pal_allocator_reset__manage_upper_four(void); +void sub_816C158(u8 taskId); + +/*static*/ void sub_816B430(u8 taskId, bool8 toss) +{ + u16 *data = gTasks[taskId].data; + + data[3] = toss; + sub_816B4DC(taskId); + eMailboxInfo.cursorPos = 0; + eMailboxInfo.itemsAbove = 0; + eMailboxInfo.unk6[3] = 0xFF; + ItemStorage_SetItemAndMailCount(taskId); + sub_816BC14(); + gpu_pal_allocator_reset__manage_upper_four(); + LoadListMenuArrowsGfx(); + sub_8122344(&(gUnknown_0203BCC4->unk668), 7); + sub_8197434(0,0); + gTasks[taskId].func = sub_816C158; +} + + + +/*static*/ void ItemStorage_Exit(u8 taskId) +{ + sub_816B4DC(taskId); + ReshowPlayerPC(taskId); +} + + +/*static*/ void ItemStorage_SetItemAndMailCount(u8 taskId) +{ + if (eMailboxInfo.count > 7) + eMailboxInfo.pageItems = 8; + else + eMailboxInfo.pageItems = eMailboxInfo.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; + } + } + } +} + +extern const u8 gText_Mailbox[]; +u8 sub_81D1C84(u8); +u8 sub_81D1DC0(struct MailboxStruct *); +void sub_81D1E90(struct MailboxStruct *); + + +/*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(&eMailboxInfo); + sub_81D1E90(&eMailboxInfo); +} + +u32 ListMenuHandleInputGetItemId(u8); +void sub_81AE860(u8, void *, void *); +void sub_81AE6C8(u8, void *, void *); +void sub_816B798(u8); +void RemoveScrollIndicatorArrowPair(u8); +void sub_81D1D04(u8); +void sub_816B730(u8); + +/*static*/ void Mailbox_ProcessInput(u8 taskId) +{ + u16 *data = gTasks[taskId].data; + s32 inputOptionId; + + if(!gPaletteFade.active) + { + inputOptionId = ListMenuHandleInputGetItemId(data[5]); + sub_81AE860(data[5], &(eMailboxInfo.itemsAbove), &eMailboxInfo); + + switch(inputOptionId) + { + case -1: + break; + case -2: + PlaySE(SE_SELECT); + RemoveScrollIndicatorArrowPair(eMailboxInfo.unk6[3]); + sub_816B798(taskId); + break; + default: + PlaySE(SE_SELECT); + sub_81D1D04(0); + sub_81D1D04(1); + sub_81AE6C8(data[5], &(eMailboxInfo.itemsAbove), &eMailboxInfo); + schedule_bg_copy_tilemap_to_vram(0); + RemoveScrollIndicatorArrowPair(eMailboxInfo.unk6[3]); + gTasks[taskId].func = sub_816B730; + break; + } + } +} + +void sub_81DB554(u8 *, u8); +void sub_816B7DC(u8); +extern const u8 gText_WhatToDoWithVar1sMail[]; + +/*static*/ void sub_816B730(u8 taskId)//Mailbox_PrintWhatToDoWithPlayerMailText(u8 taskId) +{ + StringCopy(gStringVar1, gSaveBlock1Ptr->mail[eMailboxInfo.itemsAbove + 6 + eMailboxInfo.cursorPos].playerName); + sub_81DB554(gStringVar1, 0); + StringExpandPlaceholders(gStringVar4, gText_WhatToDoWithVar1sMail); + DisplayItemMessageOnField(taskId, gStringVar4, sub_816B7DC); +} + +void sub_81D1EC0(void); + +/*static*/ void sub_816B798(u8 taskId)//Mailbox_ReturnToPlayerPC(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + sub_81D1D04(0); + sub_81D1D04(1); + sub_81AE6C8(data[5], NULL, NULL); + schedule_bg_copy_tilemap_to_vram(0); + sub_81D1EC0(); + ReshowPlayerPC(taskId); +} + +extern const struct MenuAction gUnknown_085DFF04[]; + +void sub_816B82C(u8 taskId); + +void sub_816B7DC(u8 taskId) +{ + u8 r4 = sub_81D1C84(2); + PrintMenuTable(r4, 4, gUnknown_085DFF04); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(r4, 4, 0); + schedule_bg_copy_tilemap_to_vram(0); + gTasks[taskId].func = sub_816B82C; +} + +void sub_816BBD4(u8 taskId); + +void sub_816B82C(u8 taskId) +{ + s8 inputOptionId = ProcessMenuInput_other(); + + switch(inputOptionId) + { + case -2: + break; + case -1: + PlaySE(SE_SELECT); + sub_816BBD4(taskId); + break; + default: + PlaySE(SE_SELECT); + gUnknown_085DFF04[inputOptionId].func.void_u8(taskId); + break; + } +} + +void sub_816B8A4(u8 taskId); + +void sub_816B878(u8 taskId) +{ + FadeScreen(1, 0); + gTasks[taskId].func = sub_816B8A4; +} + +void sub_816B900(); + +void sub_816B8A4(u8 taskId) +{ + if(!gPaletteFade.active) + { + sub_81D1EC0(); + overworld_free_bg_tilemaps(); + ReadMail(&(gSaveBlock1Ptr->mail[eMailboxInfo.itemsAbove + 6 + eMailboxInfo.cursorPos]), sub_816B900, TRUE); + DestroyTask(taskId); + } +} + +void pal_fill_for_maplights_or_black(); + +void sub_816B900() +{ + gFieldCallback = pal_fill_for_maplights_or_black; + SetMainCallback2(CB2_ReturnToField); +} + diff --git a/sym_ewram.txt b/sym_ewram.txt index 96862ccd5..da32fe5a0 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -805,12 +805,7 @@ gUnknown_0203BC8C: @ 203BC8C .space 0x4 .include "src/use_pokeblock.o" - -gUnknown_0203BCB0: @ 203BCB0 - .space 0x4 - -gUnknown_0203BCB4: @ 203BCB4 - .space 0x4 + .include "src/player_pc.o" gUnknown_0203BCB8: @ 203BCB8 .space 0x2