From 18124740a4d75ae95948f95ca6f63c320e51501c Mon Sep 17 00:00:00 2001 From: golem galvanize Date: Thu, 6 Dec 2018 23:14:33 -0500 Subject: [PATCH] pushing so I can merge --- asm/party_menu.s | 3223 ----------------------------------------- include/party_menu.h | 7 +- include/rom_8011DC0.h | 1 + include/strings.h | 6 + src/party_menu.c | 1617 ++++++++++++++++++++- 5 files changed, 1618 insertions(+), 3236 deletions(-) diff --git a/asm/party_menu.s b/asm/party_menu.s index 399a9f215c..54d7510d92 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -5,3229 +5,6 @@ .text - thumb_func_start sub_81B1760 -sub_81B1760: @ 81B1760 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gMain - ldrh r1, [r0, 0x30] - adds r3, r0, 0 - cmp r1, 0x20 - beq _081B178E - cmp r1, 0x20 - bgt _081B177C - cmp r1, 0x10 - beq _081B1792 - b _081B1796 - .pool -_081B177C: - cmp r1, 0x40 - beq _081B1786 - cmp r1, 0x80 - beq _081B178A - b _081B1796 -_081B1786: - movs r1, 0xFF - b _081B17B2 -_081B178A: - movs r1, 0x1 - b _081B17B2 -_081B178E: - movs r1, 0xFE - b _081B17B2 -_081B1792: - movs r1, 0x2 - b _081B17B2 -_081B1796: - bl sub_812210C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B17AA - cmp r0, 0x2 - beq _081B17AE - movs r1, 0 - b _081B17B0 -_081B17AA: - movs r1, 0xFF - b _081B17B0 -_081B17AE: - movs r1, 0x1 -_081B17B0: - ldr r3, =gMain -_081B17B2: - ldrh r2, [r3, 0x2E] - movs r0, 0x8 - ands r0, r2 - cmp r0, 0 - beq _081B17C4 - movs r0, 0x8 - b _081B17F0 - .pool -_081B17C4: - lsls r0, r1, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B17D6 - adds r0, r4, 0 - bl sub_81B17F8 - movs r0, 0 - b _081B17F0 -_081B17D6: - movs r0, 0x1 - ands r0, r2 - cmp r0, 0 - beq _081B17EA - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0x7 - bne _081B17EA - movs r0, 0x2 - b _081B17F0 -_081B17EA: - ldrh r1, [r3, 0x2E] - movs r0, 0x3 - ands r0, r1 -_081B17F0: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81B1760 - - thumb_func_start sub_81B17F8 -sub_81B17F8: @ 81B17F8 - push {r4,r5,lr} - adds r5, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldrb r4, [r5] - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0x8] - lsls r0, 26 - lsrs r0, 30 - cmp r0, 0 - bne _081B1820 - lsls r1, 24 - asrs r1, 24 - adds r0, r5, 0 - bl sub_81B1854 - b _081B182A - .pool -_081B1820: - lsls r1, 24 - asrs r1, 24 - adds r0, r5, 0 - bl sub_81B195C -_081B182A: - movs r1, 0 - ldrsb r1, [r5, r1] - lsls r4, 24 - asrs r0, r4, 24 - cmp r1, r0 - beq _081B184C - movs r0, 0x5 - bl PlaySE - lsrs r0, r4, 24 - movs r1, 0 - bl sub_81B0FCC - ldrb r0, [r5] - movs r1, 0x1 - bl sub_81B0FCC -_081B184C: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81B17F8 - - thumb_func_start sub_81B1854 -sub_81B1854: @ 81B1854 - push {r4,lr} - adds r4, r0, 0 - lsls r1, 24 - asrs r1, 24 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B187A - cmp r1, r0 - bgt _081B1870 - subs r0, 0x1 - cmp r1, r0 - beq _081B1924 - b _081B1952 -_081B1870: - cmp r1, 0x1 - beq _081B18C0 - cmp r1, 0x2 - beq _081B18F8 - b _081B1952 -_081B187A: - ldrb r0, [r4] - movs r1, 0 - ldrsb r1, [r4, r1] - cmp r1, 0 - bne _081B1888 - movs r0, 0x7 - b _081B1950 -_081B1888: - cmp r1, 0x6 - bne _081B1898 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - subs r0, 0x1 - b _081B1950 - .pool -_081B1898: - cmp r1, 0x7 - bne _081B18BC - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 31 - cmp r0, 0 - beq _081B18B0 - movs r0, 0x6 - b _081B1950 - .pool -_081B18B0: - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - subs r0, 0x1 - b _081B1950 - .pool -_081B18BC: - subs r0, 0x1 - b _081B1950 -_081B18C0: - ldrb r2, [r4] - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0x7 - beq _081B194E - movs r1, 0 - ldrsb r1, [r4, r1] - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - subs r0, 0x1 - cmp r1, r0 - bne _081B18F4 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 31 - cmp r0, 0 - beq _081B18F0 - movs r0, 0x6 - b _081B1950 - .pool -_081B18F0: - movs r0, 0x7 - b _081B1950 -_081B18F4: - adds r0, r2, 0x1 - b _081B1950 -_081B18F8: - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r0, 0x1 - beq _081B1952 - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0 - bne _081B1952 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 28 - lsrs r0, 29 - cmp r0, 0 - bne _081B1950 - movs r0, 0x1 - b _081B1950 - .pool -_081B1924: - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0 - beq _081B1952 - cmp r0, 0x6 - beq _081B1952 - cmp r0, 0x7 - beq _081B1952 - ldr r0, =gUnknown_0203CEC4 - ldr r3, [r0] - movs r1, 0 - ldrsb r1, [r4, r1] - movs r0, 0x7 - ands r1, r0 - lsls r1, 1 - ldrb r2, [r3, 0x8] - movs r0, 0xF - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x8] -_081B194E: - movs r0, 0 -_081B1950: - strb r0, [r4] -_081B1952: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1854 - - thumb_func_start sub_81B195C -sub_81B195C: @ 81B195C - push {r4-r6,lr} - adds r4, r0, 0 - lsls r1, 24 - lsrs r2, r1, 24 - asrs r5, r1, 24 - movs r6, 0x1 - negs r6, r6 - cmp r5, r6 - beq _081B1988 - cmp r5, r6 - bgt _081B197E - movs r0, 0x2 - negs r0, r0 - cmp r5, r0 - bne _081B197C - b _081B1A9C -_081B197C: - b _081B1AF4 -_081B197E: - cmp r5, 0x1 - beq _081B19E4 - cmp r5, 0x2 - beq _081B1A24 - b _081B1AF4 -_081B1988: - ldrb r1, [r4] - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0 - bne _081B1996 - movs r0, 0x7 - b _081B1AF2 -_081B1996: - cmp r0, 0x6 - bne _081B19A8 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - subs r0, 0x1 - b _081B1AF2 - .pool -_081B19A8: - cmp r0, 0x7 - bne _081B19C4 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 31 - cmp r0, 0 - beq _081B19C0 - movs r0, 0x6 - b _081B1AF2 - .pool -_081B19C0: - subs r0, r1, 0x1 - strb r0, [r4] -_081B19C4: - movs r0, 0 - ldrsb r0, [r4, r0] - lsls r1, r2, 24 - asrs r1, 24 - bl sub_81B1B00 - lsls r0, 24 - lsrs r2, r0, 24 - asrs r0, 24 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - bne _081B19E0 - b _081B1AF4 -_081B19E0: - strb r2, [r4] - b _081B1AF4 -_081B19E4: - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0x6 - bne _081B19F0 - movs r0, 0x7 - b _081B1AF2 -_081B19F0: - cmp r0, 0x7 - bne _081B19F8 - movs r0, 0 - b _081B1AF2 -_081B19F8: - movs r0, 0 - ldrsb r0, [r4, r0] - movs r1, 0x1 - bl sub_81B1B00 - lsls r0, 24 - lsrs r2, r0, 24 - asrs r0, 24 - cmp r0, r6 - bne _081B19E0 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 31 - cmp r0, 0 - beq _081B1A20 - movs r0, 0x6 - b _081B1AF2 - .pool -_081B1A20: - movs r0, 0x7 - b _081B1AF2 -_081B1A24: - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0 - bne _081B1A5C - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 28 - lsrs r6, r0, 29 - cmp r6, 0x3 - bne _081B1A54 - ldr r0, =gPlayerParty + 300 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B1AF4 - strb r6, [r4] - b _081B1AF4 - .pool -_081B1A54: - ldr r0, =gPlayerParty + 200 - b _081B1A70 - .pool -_081B1A5C: - cmp r0, 0x1 - bne _081B1AF4 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 28 - lsrs r5, r0, 29 - cmp r5, 0x5 - bne _081B1A88 - ldr r0, =gPlayerParty + 500 -_081B1A70: - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B1AF4 - strb r5, [r4] - b _081B1AF4 - .pool -_081B1A88: - ldr r0, =gPlayerParty + 400 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B1AF4 - movs r0, 0x4 - b _081B1AF2 - .pool -_081B1A9C: - ldrb r1, [r4] - subs r0, r1, 0x2 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _081B1ACC - ldr r0, =gUnknown_0203CEC4 - ldr r3, [r0] - movs r1, 0 - ldrsb r1, [r4, r1] - movs r0, 0x7 - ands r1, r0 - lsls r1, 1 - ldrb r2, [r3, 0x8] - movs r0, 0xF - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x8] - movs r0, 0 - b _081B1AF2 - .pool -_081B1ACC: - subs r0, r1, 0x4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _081B1AF4 - ldr r0, =gUnknown_0203CEC4 - ldr r3, [r0] - movs r1, 0 - ldrsb r1, [r4, r1] - movs r0, 0x7 - ands r1, r0 - lsls r1, 1 - ldrb r2, [r3, 0x8] - movs r0, 0xF - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x8] - movs r0, 0x1 -_081B1AF2: - strb r0, [r4] -_081B1AF4: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B195C - - thumb_func_start sub_81B1B00 -sub_81B1B00: @ 81B1B00 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - asrs r6, r1, 24 -_081B1B0A: - lsls r0, r5, 24 - asrs r0, 24 - adds r0, r6 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, r5, 24 - lsrs r0, r1, 24 - cmp r0, 0x5 - bhi _081B1B38 - asrs r4, r1, 24 - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B1B0A - adds r0, r4, 0 - b _081B1B3C - .pool -_081B1B38: - movs r0, 0x1 - negs r0, r0 -_081B1B3C: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_81B1B00 - - thumb_func_start GetMonNickname -@ u8 *GetMonNickname(struct pokemon *mon, u8 *dest) -GetMonNickname: @ 81B1B44 - push {r4,lr} - adds r4, r1, 0 - movs r1, 0x2 - adds r2, r4, 0 - bl GetMonData - adds r0, r4, 0 - bl StringGetEnd10 - pop {r4} - pop {r1} - bx r1 - thumb_func_end GetMonNickname - - thumb_func_start sub_81B1B5C -sub_81B1B5C: @ 81B1B5C - push {r4,lr} - lsls r4, r1, 24 - lsrs r4, 24 - bl sub_81B3300 - ldr r0, =sub_81B1B8C - movs r1, 0x1 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0x8] - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B1B5C - - thumb_func_start sub_81B1B8C -sub_81B1B8C: @ 81B1B8C - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - movs r0, 0x6 - bl RunTextPrintersRetIsActive - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1 - beq _081B1BC8 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - movs r2, 0x8 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _081B1BC2 - movs r0, 0x6 - movs r1, 0 - bl sub_8198070 - movs r0, 0x6 - bl ClearWindowTilemap -_081B1BC2: - adds r0, r5, 0 - bl DestroyTask -_081B1BC8: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1B8C - - thumb_func_start sub_81B1BD4 -sub_81B1BD4: @ 81B1BD4 - push {lr} - ldr r0, =sub_81B1B8C - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B1BD4 - - thumb_func_start sub_81B1BE8 -sub_81B1BE8: @ 81B1BE8 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B1C0E - movs r0, 0 - bl display_pokemon_menu_message - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1370 - str r0, [r1] -_081B1C0E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1BE8 - - thumb_func_start sub_81B1C1C -sub_81B1C1C: @ 81B1C1C - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B1C74 - movs r0, 0x6 - movs r1, 0 - bl sub_8198070 - movs r0, 0x6 - bl ClearWindowTilemap - bl sub_81221AC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B1C60 - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1BE8 - b _081B1C72 - .pool -_081B1C60: - movs r0, 0 - bl display_pokemon_menu_message - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1370 -_081B1C72: - str r0, [r1] -_081B1C74: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1C1C - - thumb_func_start sub_81B1C84 -sub_81B1C84: @ 81B1C84 - push {r4,r5,lr} - adds r4, r1, 0 - adds r5, r2, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 24 - lsrs r5, 24 - ldr r1, =gStringVar1 - bl GetMonNickname - ldr r1, =gStringVar2 - adds r0, r4, 0 - bl CopyItemName - ldr r4, =gStringVar4 - ldr r1, =gText_PkmnWasGivenItem - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1C84 - - thumb_func_start sub_81B1CD0 -sub_81B1CD0: @ 81B1CD0 - push {r4,r5,lr} - adds r4, r1, 0 - adds r5, r2, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 24 - lsrs r5, 24 - ldr r1, =gStringVar1 - bl GetMonNickname - ldr r1, =gStringVar2 - adds r0, r4, 0 - bl CopyItemName - ldr r4, =gStringVar4 - ldr r1, =gText_RecievedItemFromPkmn - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1CD0 - - thumb_func_start sub_81B1D1C -sub_81B1D1C: @ 81B1D1C - push {r4,r5,lr} - adds r4, r1, 0 - adds r5, r2, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 24 - lsrs r5, 24 - ldr r1, =gStringVar1 - bl GetMonNickname - ldr r1, =gStringVar2 - adds r0, r4, 0 - bl CopyItemName - ldr r4, =gStringVar4 - ldr r1, =gText_SwitchPkmnItem - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1D1C - - thumb_func_start sub_81B1D68 -sub_81B1D68: @ 81B1D68 - push {r4,r5,lr} - adds r4, r1, 0 - adds r5, r2, 0 - lsls r0, 16 - lsrs r0, 16 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 24 - lsrs r5, 24 - ldr r1, =gStringVar1 - bl CopyItemName - ldr r1, =gStringVar2 - adds r0, r4, 0 - bl CopyItemName - ldr r4, =gStringVar4 - ldr r1, =gText_SwitchedPkmnItem - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - adds r1, r5, 0 - bl sub_81B1B5C - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1D68 - - thumb_func_start sub_81B1DB8 -sub_81B1DB8: @ 81B1DB8 - push {r4-r7,lr} - sub sp, 0x4 - adds r6, r0, 0 - lsls r5, r1, 16 - lsrs r4, r5, 16 - adds r7, r4, 0 - adds r0, r4, 0 - bl ItemIsMail - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B1DE2 - adds r0, r6, 0 - adds r1, r4, 0 - bl GiveMailToMon - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _081B1DF6 -_081B1DE2: - mov r0, sp - strb r7, [r0] - mov r1, sp - lsrs r0, r5, 24 - strb r0, [r1, 0x1] - adds r0, r6, 0 - movs r1, 0xC - mov r2, sp - bl SetMonData -_081B1DF6: - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B1DB8 - - thumb_func_start sub_81B1E00 -sub_81B1E00: @ 81B1E00 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - movs r1, 0xC - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - mov r1, sp - strh r0, [r1] - cmp r0, 0 - bne _081B1E1C - movs r0, 0 - b _081B1E3E -_081B1E1C: - movs r1, 0x1 - bl AddBagItem - lsls r0, 24 - cmp r0, 0 - beq _081B1E3C - movs r1, 0 - mov r0, sp - strh r1, [r0] - adds r0, r4, 0 - movs r1, 0xC - mov r2, sp - bl SetMonData - movs r0, 0x2 - b _081B1E3E -_081B1E3C: - movs r0, 0x1 -_081B1E3E: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81B1E00 - - thumb_func_start pokemon_item_not_removed -pokemon_item_not_removed: @ 81B1E48 - push {lr} - ldr r0, =gStringVar4 - ldr r1, =gText_BagFullCouldNotRemoveItem - bl StringExpandPlaceholders - pop {r0} - bx r0 - .pool - thumb_func_end pokemon_item_not_removed - - thumb_func_start sub_81B1E60 -sub_81B1E60: @ 81B1E60 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r0, 2 - add r0, r8 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r7, r0, r1 - ldrh r0, [r7, 0x4] - ldrh r1, [r7] - adds r0, r1 - strh r0, [r7] - ldrh r0, [r7, 0x6] - subs r0, 0x1 - strh r0, [r7, 0x6] - movs r2, 0x8 - ldrsh r0, [r7, r2] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x39 - adds r2, r7, 0 - bl SetMonData - movs r3, 0x8 - ldrsh r2, [r7, r3] - adds r0, r2, 0 - muls r0, r5 - adds r0, r4 - ldr r6, =gUnknown_0203CEDC - lsls r2, 4 - ldr r1, [r6] - adds r1, r2 - movs r2, 0x1 - bl sub_81B2CD4 - movs r0, 0x8 - ldrsh r2, [r7, r0] - adds r0, r2, 0 - muls r0, r5 - adds r0, r4 - lsls r2, 4 - ldr r1, [r6] - adds r1, r2 - bl sub_81B2E28 - movs r1, 0x6 - ldrsh r0, [r7, r1] - cmp r0, 0 - beq _081B1EDC - movs r2, 0 - ldrsh r1, [r7, r2] - cmp r1, 0 - beq _081B1EDC - movs r3, 0x2 - ldrsh r0, [r7, r3] - cmp r1, r0 - bne _081B1EFE -_081B1EDC: - movs r0, 0 - ldrsh r1, [r7, r0] - movs r2, 0xA - ldrsh r0, [r7, r2] - cmp r1, r0 - ble _081B1EF8 - ldr r0, =gStringVar2 - movs r3, 0xA - ldrsh r2, [r7, r3] - subs r1, r2 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN -_081B1EF8: - mov r0, r8 - bl SwitchTaskToFollowupFunc -_081B1EFE: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1E60 - - thumb_func_start sub_81B1F18 -sub_81B1F18: @ 81B1F18 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r8, r0 - mov r9, r1 - adds r5, r2, 0 - mov r10, r3 - ldr r7, [sp, 0x20] - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - mov r0, r9 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - lsls r5, 24 - lsrs r5, 24 - mov r0, r10 - lsls r0, 16 - lsrs r0, 16 - mov r10, r0 - movs r0, 0x64 - mov r6, r9 - muls r6, r0 - ldr r0, =gPlayerParty - adds r6, r0 - mov r0, r8 - lsls r4, r0, 2 - add r4, r8 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - adds r0, r6, 0 - movs r1, 0x39 - bl GetMonData - strh r0, [r4] - adds r0, r6, 0 - movs r1, 0x3A - bl GetMonData - strh r0, [r4, 0x2] - lsls r5, 24 - asrs r5, 24 - strh r5, [r4, 0x4] - mov r0, r10 - strh r0, [r4, 0x6] - mov r0, r9 - strh r0, [r4, 0x8] - ldrh r0, [r4] - strh r0, [r4, 0xA] - ldr r1, =sub_81B1E60 - mov r0, r8 - adds r2, r7, 0 - bl SetTaskFuncWithFollowupFunc - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1F18 - - thumb_func_start sub_81B1FA8 -sub_81B1FA8: @ 81B1FA8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r3, r0, r1 - cmp r5, 0x5 - bhi _081B200A - lsls r0, r5, 2 - ldr r1, =_081B1FD4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081B1FD4: - .4byte _081B1FEC - .4byte _081B1FF2 - .4byte _081B1FF6 - .4byte _081B1FFA - .4byte _081B1FFE - .4byte _081B2002 -_081B1FEC: - strh r2, [r3] - strh r2, [r3, 0xA] - b _081B200A -_081B1FF2: - strh r2, [r3, 0x2] - b _081B200A -_081B1FF6: - strh r2, [r3, 0x4] - b _081B200A -_081B1FFA: - strh r2, [r3, 0x6] - b _081B200A -_081B1FFE: - strh r2, [r3, 0x8] - b _081B200A -_081B2002: - ldr r1, =sub_81B1E60 - adds r0, r4, 0 - bl SetTaskFuncWithFollowupFunc -_081B200A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1FA8 - - thumb_func_start pokemon_ailments_get_primary -pokemon_ailments_get_primary: @ 81B2014 - push {lr} - adds r1, r0, 0 - movs r0, 0x88 - ands r0, r1 - cmp r0, 0 - beq _081B2024 - movs r0, 0x1 - b _081B2056 -_081B2024: - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081B2030 - movs r0, 0x2 - b _081B2056 -_081B2030: - movs r0, 0x7 - ands r0, r1 - cmp r0, 0 - beq _081B203C - movs r0, 0x3 - b _081B2056 -_081B203C: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _081B2048 - movs r0, 0x4 - b _081B2056 -_081B2048: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _081B2054 - movs r0, 0 - b _081B2056 -_081B2054: - movs r0, 0x5 -_081B2056: - pop {r1} - bx r1 - thumb_func_end pokemon_ailments_get_primary - - thumb_func_start sub_81B205C -@ u8 sub_81B205C(struct pokemon *mon, int a2, void *a3) -sub_81B205C: @ 81B205C - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - bne _081B206E - movs r0, 0x7 - b _081B2096 -_081B206E: - adds r0, r4, 0 - movs r1, 0x37 - bl GetMonData - bl pokemon_ailments_get_primary - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - bne _081B2096 - adds r0, r4, 0 - movs r1, 0 - bl CheckPartyPokerus - lsls r0, 24 - cmp r0, 0 - bne _081B2094 - movs r0, 0 - b _081B2096 -_081B2094: - movs r0, 0x6 -_081B2096: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81B205C - - thumb_func_start sub_81B209C -sub_81B209C: @ 81B209C - push {r4,r5,lr} - ldr r2, =gUnknown_0203CEC8 - ldrb r1, [r2, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0xB - bne _081B2126 - adds r5, r2, 0 - adds r5, 0xE - movs r0, 0 - strh r0, [r2, 0xE] - ldr r0, =gSpecialVar_0x8005 - ldrh r0, [r0] - cmp r0, 0 - bne _081B20FC - movs r4, 0 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r4, r0 - bcs _081B2126 -_081B20C4: - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - bl sub_81B2134 - lsls r0, 16 - lsrs r0, 16 - lsls r0, r4 - ldrh r1, [r5] - adds r0, r1 - strh r0, [r5] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r4, r0 - bcc _081B20C4 - b _081B2126 - .pool -_081B20FC: - movs r4, 0 - b _081B211E -_081B2100: - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - bl sub_81B2164 - lsls r0, 16 - lsrs r0, 16 - lsls r0, r4 - ldrh r1, [r5] - adds r0, r1 - strh r0, [r5] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_081B211E: - ldr r0, =gPlayerPartyCount - ldrb r0, [r0] - cmp r4, r0 - bcc _081B2100 -_081B2126: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B209C - - thumb_func_start sub_81B2134 -sub_81B2134: @ 81B2134 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0x1 - beq _081B215A - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - bl sub_802C908 - cmp r0, 0 - beq _081B215A - movs r0, 0x1 - b _081B215C -_081B215A: - movs r0, 0 -_081B215C: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81B2134 - - thumb_func_start sub_81B2164 -sub_81B2164: @ 81B2164 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0x1 - beq _081B2182 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0x55 - bne _081B2182 - movs r0, 0x1 - b _081B2184 -_081B2182: - movs r0, 0 -_081B2184: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81B2164 - - thumb_func_start sub_81B218C -sub_81B218C: @ 81B218C - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203CEC8 - movs r2, 0xE - ldrsh r1, [r1, r2] - asrs r1, r0 - movs r0, 0x1 - ands r1, r0 - cmp r1, 0 - bne _081B21A4 - movs r0, 0 -_081B21A4: - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B218C - - thumb_func_start sub_81B21AC -sub_81B21AC: @ 81B21AC - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - adds r0, r5, 0 - bl sub_81B218C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B21DC - movs r0, 0x5 - bl PlaySE - ldr r0, =gSpecialVar_0x8004 - strh r5, [r0] - adds r0, r4, 0 - bl sub_81B12C0 - b _081B21FE - .pool -_081B21DC: - movs r0, 0x20 - bl PlaySE - ldr r0, =gText_PkmnCantParticipate - movs r1, 0 - bl sub_81B1B5C - movs r0, 0x2 - 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_81B1C1C - str r1, [r0] -_081B21FE: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B21AC - - thumb_func_start sub_81B2210 -sub_81B2210: @ 81B2210 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gText_CancelParticipation - movs r1, 0x1 - bl sub_81B1B5C - movs r0, 0x2 - 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_81B2248 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2210 - - thumb_func_start sub_81B2248 -sub_81B2248: @ 81B2248 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_81B1BD4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B226C - bl sub_81B334C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B227C - str r0, [r1] -_081B226C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2248 - - thumb_func_start sub_81B227C -sub_81B227C: @ 81B227C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl Menu_ProcessInputNoWrap_ - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _081B22A2 - cmp r1, 0 - bgt _081B229C - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _081B22B4 - b _081B22C8 -_081B229C: - cmp r1, 0x1 - beq _081B22BA - b _081B22C8 -_081B22A2: - ldr r1, =gSpecialVar_0x8004 - movs r0, 0x7 - strh r0, [r1] - adds r0, r4, 0 - bl sub_81B12C0 - b _081B22C8 - .pool -_081B22B4: - movs r0, 0x5 - bl PlaySE -_081B22BA: - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_81B1C1C - str r0, [r1] -_081B22C8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B227C - - thumb_func_start sub_81B22D8 -sub_81B22D8: @ 81B22D8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r0, 0 - lsls r1, 16 - lsrs r4, r1, 16 - adds r7, r4, 0 - lsls r2, 24 - lsrs r6, r2, 24 - mov r8, r6 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - beq _081B22FA - movs r0, 0x3 - b _081B2356 -_081B22FA: - movs r0, 0x90 - lsls r0, 1 - cmp r4, r0 - bls _081B231C - adds r1, r4, 0 - subs r1, 0x21 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl CanMonLearnTMHM - cmp r0, 0 - beq _081B2334 - adds r0, r7, 0 - bl ItemIdToBattleMoveId - b _081B233E -_081B231C: - adds r0, r5, 0 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - adds r1, r6, 0 - bl sub_81B2370 - lsls r0, 24 - cmp r0, 0 - bne _081B2338 -_081B2334: - movs r0, 0x1 - b _081B2356 -_081B2338: - mov r0, r8 - bl sub_81B2360 -_081B233E: - lsls r0, 16 - lsrs r1, r0, 16 - adds r0, r5, 0 - bl pokemon_has_move - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B2354 - movs r0, 0 - b _081B2356 -_081B2354: - movs r0, 0x2 -_081B2356: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81B22D8 - - thumb_func_start sub_81B2360 -sub_81B2360: @ 81B2360 - lsls r0, 24 - ldr r1, =gUnknown_0861500C - lsrs r0, 23 - adds r0, r1 - ldrh r0, [r0] - bx lr - .pool - thumb_func_end sub_81B2360 - - thumb_func_start sub_81B2370 -sub_81B2370: @ 81B2370 - push {lr} - lsls r0, 16 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gUnknown_08615048 - lsrs r0, 14 - adds r0, r2 - movs r2, 0x1 - lsls r2, r1 - ldr r0, [r0] - ands r0, r2 - cmp r0, 0 - bne _081B2394 - movs r0, 0 - b _081B2396 - .pool -_081B2394: - movs r0, 0x1 -_081B2396: - pop {r1} - bx r1 - thumb_func_end sub_81B2370 - - thumb_func_start sub_81B239C -sub_81B239C: @ 81B239C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - cmp r0, 0x1 - beq _081B23C4 - cmp r0, 0x1 - bgt _081B23B2 - cmp r0, 0 - beq _081B23B8 - b _081B23DC -_081B23B2: - cmp r1, 0x2 - beq _081B23D0 - b _081B23DC -_081B23B8: - ldr r0, =gUnknown_08615810 - bl InitWindows - b _081B23E2 - .pool -_081B23C4: - ldr r0, =gUnknown_08615850 - bl InitWindows - b _081B23E2 - .pool -_081B23D0: - ldr r0, =gUnknown_08615890 - bl InitWindows - b _081B23E2 - .pool -_081B23DC: - ldr r0, =gUnknown_086158D0 - bl InitWindows -_081B23E2: - bl DeactivateAllTextPrinters - movs r4, 0 -_081B23E8: - adds r0, r4, 0 - movs r1, 0 - bl FillWindowPixelBuffer - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x5 - bls _081B23E8 - movs r0, 0 - movs r1, 0x4F - movs r2, 0xD0 - bl LoadUserWindowBorderGfx - bl GetOverworldTextboxPalettePtr - movs r1, 0xE0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_0860F074 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B239C - - thumb_func_start sub_81B2428 -sub_81B2428: @ 81B2428 - push {r4-r6,lr} - sub sp, 0x14 - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gUnknown_0203CEC8 - ldrb r1, [r0, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x5 - bne _081B243E - b _081B2554 -_081B243E: - cmp r2, 0x1 - bne _081B24B4 - ldr r0, =gUnknown_08615918 - bl AddWindow - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - movs r1, 0 - bl FillWindowPixelBuffer - ldr r5, =gMenuText_Confirm - movs r0, 0 - adds r1, r5, 0 - movs r2, 0x30 - bl GetStringCenterAlignXOffset - lsls r0, 24 - lsrs r2, r0, 24 - movs r0, 0 - str r0, [sp] - str r0, [sp, 0x4] - ldr r0, =gUnknown_086157FC - str r0, [sp, 0x8] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0xC] - str r5, [sp, 0x10] - adds r0, r4, 0 - movs r1, 0 - movs r3, 0x1 - bl AddTextPrinterParameterized4 - adds r0, r4, 0 - bl PutWindowTilemap - adds r0, r4, 0 - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, =gUnknown_08615910 - bl AddWindow - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - b _081B24C0 - .pool -_081B24B4: - ldr r0, =gUnknown_08615908 - bl AddWindow - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0x3 -_081B24C0: - adds r0, r5, 0 - movs r1, 0 - bl FillWindowPixelBuffer - ldr r0, =gUnknown_0203CEC8 - ldrb r1, [r0, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0xA - beq _081B2514 - ldr r4, =gText_Cancel - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x30 - bl GetStringCenterAlignXOffset - lsls r0, 24 - lsrs r2, r0, 24 - adds r2, r6 - lsls r2, 24 - lsrs r2, 24 - ldr r0, =gUnknown_086157FC - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - str r4, [sp, 0x8] - adds r0, r5, 0 - movs r1, 0 - movs r3, 0x1 - bl AddTextPrinterParameterized3 - b _081B2540 - .pool -_081B2514: - ldr r4, =gText_Cancel2 - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x30 - bl GetStringCenterAlignXOffset - lsls r0, 24 - lsrs r2, r0, 24 - adds r2, r6 - lsls r2, 24 - lsrs r2, 24 - ldr r0, =gUnknown_086157FC - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - str r4, [sp, 0x8] - adds r0, r5, 0 - movs r1, 0 - movs r3, 0x1 - bl AddTextPrinterParameterized3 -_081B2540: - adds r0, r5, 0 - bl PutWindowTilemap - adds r0, r5, 0 - movs r1, 0x2 - bl CopyWindowToVram - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram -_081B2554: - add sp, 0x14 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2428 - - thumb_func_start sub_81B2564 -sub_81B2564: @ 81B2564 - lsls r0, 24 - ldr r1, =gUnknown_0203CEC4 - lsrs r0, 23 - adds r0, 0x18 - ldr r1, [r1] - adds r1, r0 - adds r0, r1, 0 - bx lr - .pool - thumb_func_end sub_81B2564 - - thumb_func_start sub_81B2578 -sub_81B2578: @ 81B2578 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x2C - str r1, [sp, 0xC] - ldr r1, [sp, 0x4C] - ldr r4, [sp, 0x50] - ldr r5, [sp, 0x54] - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x8] - lsls r2, 24 - lsrs r2, 24 - str r2, [sp, 0x10] - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0x14] - lsls r1, 24 - lsrs r1, 24 - str r1, [sp, 0x18] - lsls r4, 24 - lsrs r6, r4, 24 - lsls r5, 24 - lsrs r5, 24 - mov r10, r5 - mov r0, r10 - muls r0, r6 - lsls r0, 5 - bl AllocZeroed - mov r9, r0 - cmp r0, 0 - beq _081B2646 - movs r5, 0 - ldr r0, [sp, 0x14] - lsls r0, 19 - str r0, [sp, 0x1C] - ldr r1, [sp, 0x18] - lsls r1, 19 - str r1, [sp, 0x20] - lsls r2, r6, 19 - str r2, [sp, 0x24] - mov r0, r10 - lsls r0, 19 - str r0, [sp, 0x28] - cmp r5, r10 - bcs _081B2624 -_081B25DA: - movs r4, 0 - adds r1, r5, 0x1 - mov r8, r1 - cmp r4, r6 - bcs _081B261A - ldr r2, [sp, 0x18] - adds r0, r2, r5 - ldr r2, [sp, 0x10] - adds r1, r0, 0 - muls r1, r2 - adds r7, r1, 0 -_081B25F0: - ldr r1, [sp, 0x14] - adds r0, r1, r4 - adds r0, r7 - ldr r2, [sp, 0xC] - adds r0, r2, r0 - ldrb r0, [r0] - bl sub_81B0DD4 - adds r1, r5, 0 - muls r1, r6 - adds r1, r4 - lsls r1, 5 - add r1, r9 - movs r2, 0x10 - bl CpuSet - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r6 - bcc _081B25F0 -_081B261A: - mov r1, r8 - lsls r0, r1, 24 - lsrs r5, r0, 24 - cmp r5, r10 - bcc _081B25DA -_081B2624: - ldr r0, [sp, 0x1C] - lsrs r2, r0, 16 - ldr r1, [sp, 0x20] - lsrs r3, r1, 16 - ldr r1, [sp, 0x24] - lsrs r0, r1, 16 - str r0, [sp] - ldr r1, [sp, 0x28] - lsrs r0, r1, 16 - str r0, [sp, 0x4] - ldr r0, [sp, 0x8] - mov r1, r9 - bl BlitBitmapToWindow - mov r0, r9 - bl Free -_081B2646: - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B2578 - - thumb_func_start sub_81B2658 -sub_81B2658: @ 81B2658 - push {r4-r6,lr} - sub sp, 0xC - ldr r4, [sp, 0x1C] - ldr r5, [sp, 0x20] - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r6, r1, 24 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r3, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - cmp r3, 0 - bne _081B2684 - cmp r4, 0 - bne _081B2684 - movs r3, 0xA - movs r4, 0x7 -_081B2684: - cmp r5, 0 - bne _081B26A0 - ldr r1, =gUnknown_08615988 - str r2, [sp] - str r3, [sp, 0x4] - str r4, [sp, 0x8] - movs r2, 0xA - adds r3, r6, 0 - bl sub_81B2578 - b _081B26B0 - .pool -_081B26A0: - ldr r1, =gUnknown_086159CE - str r2, [sp] - str r3, [sp, 0x4] - str r4, [sp, 0x8] - movs r2, 0xA - adds r3, r6, 0 - bl sub_81B2578 -_081B26B0: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2658 - - thumb_func_start sub_81B26BC -sub_81B26BC: @ 81B26BC - push {r4-r6,lr} - sub sp, 0xC - ldr r4, [sp, 0x1C] - ldr r5, [sp, 0x20] - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r6, r1, 24 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r3, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - cmp r3, 0 - bne _081B26E8 - cmp r4, 0 - bne _081B26E8 - movs r3, 0x12 - movs r4, 0x3 -_081B26E8: - cmp r5, 0 - bne _081B2704 - ldr r1, =gUnknown_08615A14 - str r2, [sp] - str r3, [sp, 0x4] - str r4, [sp, 0x8] - movs r2, 0x12 - adds r3, r6, 0 - bl sub_81B2578 - b _081B2714 - .pool -_081B2704: - ldr r1, =gUnknown_08615A4A - str r2, [sp] - str r3, [sp, 0x4] - str r4, [sp, 0x8] - movs r2, 0x12 - adds r3, r6, 0 - bl sub_81B2578 -_081B2714: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B26BC - - thumb_func_start sub_81B2720 -sub_81B2720: @ 81B2720 - push {lr} - sub sp, 0xC - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_08615A80 - movs r2, 0 - str r2, [sp] - movs r2, 0x12 - str r2, [sp, 0x4] - movs r2, 0x3 - str r2, [sp, 0x8] - movs r2, 0x12 - movs r3, 0 - bl sub_81B2578 - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2720 - - thumb_func_start sub_81B2748 -sub_81B2748: @ 81B2748 - push {r4-r7,lr} - lsls r1, 24 - lsrs r4, r1, 24 - adds r5, r4, 0 - ldrb r0, [r0, 0x8] - movs r1, 0x5 - bl GetWindowAttribute - lsls r0, 28 - lsrs r6, r0, 24 - adds r7, r6, 0 - movs r0, 0x40 - ands r0, r4 - cmp r0, 0 - beq _081B277C - ldr r5, =gUnknown_08615AF1 - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615AC0 - b _081B297E - .pool -_081B277C: - movs r0, 0x20 - ands r0, r4 - cmp r0, 0 - beq _081B27D8 - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _081B2794 - ldr r5, =gUnknown_08615ADF - b _081B2942 - .pool -_081B2794: - ldr r5, =gUnknown_08615ADF - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615ABA - ldrb r1, [r4] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x2] - bl sub_81B2564 - ldrb r1, [r4, 0x2] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldr r5, =gUnknown_08615AEE - b _081B2976 - .pool -_081B27D8: - movs r0, 0x10 - ands r0, r4 - cmp r0, 0 - beq _081B2824 - ldr r5, =gUnknown_08615ADF - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615ABA - ldrb r1, [r4] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x2] - bl sub_81B2564 - ldrb r1, [r4, 0x2] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldr r5, =gUnknown_08615AEE - b _081B2976 - .pool -_081B2824: - movs r0, 0x4 - ands r0, r4 - cmp r0, 0 - beq _081B2880 - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _081B283C - ldr r5, =gUnknown_08615ADF - b _081B2942 - .pool -_081B283C: - ldr r5, =gUnknown_08615ADF - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615ABA - ldrb r1, [r4] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x2] - bl sub_81B2564 - ldrb r1, [r4, 0x2] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldr r5, =gUnknown_08615AEE - b _081B2976 - .pool -_081B2880: - movs r0, 0x2 - ands r0, r4 - cmp r0, 0 - beq _081B28DC - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _081B2898 - ldr r5, =gUnknown_08615ADC - b _081B2942 - .pool -_081B2898: - ldr r5, =gUnknown_08615AD3 - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615ABA - ldrb r1, [r4] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x2] - bl sub_81B2564 - ldrb r1, [r4, 0x2] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldr r5, =gUnknown_08615AE8 - b _081B2976 - .pool -_081B28DC: - movs r0, 0x8 - ands r0, r4 - cmp r0, 0 - beq _081B2938 - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _081B28F4 - ldr r5, =gUnknown_08615AD9 - b _081B2942 - .pool -_081B28F4: - ldr r5, =gUnknown_08615AD0 - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615ABA - ldrb r1, [r4] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x2] - bl sub_81B2564 - ldrb r1, [r4, 0x2] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldr r5, =gUnknown_08615AE5 - b _081B2976 - .pool -_081B2938: - movs r0, 0x1 - ands r5, r0 - cmp r5, 0 - beq _081B29BC - ldr r5, =gUnknown_08615AD6 -_081B2942: - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615ABA - ldrb r1, [r4] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x2] - bl sub_81B2564 - ldrb r1, [r4, 0x2] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldr r5, =gUnknown_08615AEB -_081B2976: - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615ABD -_081B297E: - ldrb r1, [r4] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x2] - bl sub_81B2564 - ldrb r1, [r4, 0x2] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - b _081B2A24 - .pool -_081B29BC: - ldr r5, =gUnknown_08615ACD - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615ABA - ldrb r1, [r4] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x2] - bl sub_81B2564 - ldrb r1, [r4, 0x2] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette - ldr r5, =gUnknown_08615AE2 - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615ABD - ldrb r1, [r4] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x2] - bl sub_81B2564 - ldrb r1, [r4, 0x2] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette -_081B2A24: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2748 - - thumb_func_start sub_81B2A3C -sub_81B2A3C: @ 81B2A3C - push {r4,r5,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r0, 24 - lsls r2, 24 - lsrs r2, 24 - ldrb r5, [r3] - ldrb r3, [r3, 0x1] - lsls r4, r2, 1 - adds r4, r2 - ldr r2, =gUnknown_086157FC - adds r4, r2 - str r4, [sp] - movs r2, 0 - str r2, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0 - adds r2, r5, 0 - bl AddTextPrinterParameterized3 - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2A3C - - thumb_func_start sub_81B2A70 -sub_81B2A70: @ 81B2A70 - push {r4-r7,lr} - sub sp, 0x14 - adds r7, r0, 0 - adds r6, r1, 0 - lsls r2, 24 - lsrs r4, r2, 24 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B2AC0 - cmp r4, 0x1 - bne _081B2AAA - ldr r5, [r6] - ldrb r0, [r6, 0x8] - ldrb r1, [r5, 0x4] - lsrs r1, 3 - ldrb r2, [r5, 0x5] - lsrs r2, 3 - ldrb r3, [r5, 0x6] - lsrs r3, 3 - ldrb r4, [r5, 0x7] - lsrs r4, 3 - str r4, [sp] - movs r4, 0 - str r4, [sp, 0x4] - ldr r4, [r5] - bl _call_via_r4 -_081B2AAA: - adds r0, r7, 0 - add r1, sp, 0x8 - bl GetMonNickname - ldrb r0, [r6, 0x8] - ldr r3, [r6] - adds r3, 0x4 - add r1, sp, 0x8 - movs r2, 0 - bl sub_81B2A3C -_081B2AC0: - add sp, 0x14 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B2A70 - - thumb_func_start sub_81B2AC8 -sub_81B2AC8: @ 81B2AC8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - adds r6, r0, 0 - adds r7, r1, 0 - lsls r2, 24 - lsrs r4, r2, 24 - mov r8, r4 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B2B34 - adds r0, r6, 0 - bl sub_81B205C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _081B2AF6 - cmp r0, 0x6 - bne _081B2B34 -_081B2AF6: - cmp r4, 0 - beq _081B2B1C - ldr r5, [r7] - ldrb r0, [r7, 0x8] - ldrb r1, [r5, 0x8] - lsrs r1, 3 - ldrb r2, [r5, 0x9] - lsrs r2, 3 - adds r2, 0x1 - ldrb r3, [r5, 0xA] - lsrs r3, 3 - ldrb r4, [r5, 0xB] - lsrs r4, 3 - str r4, [sp] - movs r4, 0 - str r4, [sp, 0x4] - ldr r4, [r5] - bl _call_via_r4 -_081B2B1C: - mov r0, r8 - cmp r0, 0x2 - beq _081B2B34 - adds r0, r6, 0 - movs r1, 0x38 - bl GetMonData - lsls r0, 24 - lsrs r0, 24 - adds r1, r7, 0 - bl sub_81B2B40 -_081B2B34: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B2AC8 - - thumb_func_start sub_81B2B40 -sub_81B2B40: @ 81B2B40 - push {r4-r6,lr} - adds r2, r0, 0 - adds r6, r1, 0 - lsls r2, 24 - lsrs r2, 24 - ldr r5, =gStringVar2 - adds r0, r5, 0 - adds r1, r2, 0 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar1 - ldr r1, =gText_LevelSymbol - adds r0, r4, 0 - bl StringCopy - adds r0, r4, 0 - adds r1, r5, 0 - bl StringAppend - ldrb r0, [r6, 0x8] - ldr r3, [r6] - adds r3, 0x8 - adds r1, r4, 0 - movs r2, 0 - bl sub_81B2A3C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2B40 - - thumb_func_start sub_81B2B8C -sub_81B2B8C: @ 81B2B8C - push {r4-r7,lr} - sub sp, 0x14 - adds r6, r0, 0 - adds r7, r1, 0 - lsls r2, 24 - lsrs r2, 24 - cmp r2, 0x1 - bne _081B2BBE - ldr r5, [r7] - ldrb r0, [r7, 0x8] - ldrb r1, [r5, 0xC] - lsrs r1, 3 - ldrb r2, [r5, 0xD] - lsrs r2, 3 - adds r2, 0x1 - ldrb r3, [r5, 0xE] - lsrs r3, 3 - ldrb r4, [r5, 0xF] - lsrs r4, 3 - str r4, [sp] - movs r4, 0 - str r4, [sp, 0x4] - ldr r4, [r5] - bl _call_via_r4 -_081B2BBE: - adds r0, r6, 0 - add r1, sp, 0x8 - bl GetMonNickname - adds r0, r6, 0 - bl GetMonGender - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - movs r1, 0xB - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - add r2, sp, 0x8 - adds r3, r7, 0 - bl sub_81B2BF4 - add sp, 0x14 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B2B8C - - thumb_func_start sub_81B2BF4 -sub_81B2BF4: @ 81B2BF4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - mov r9, r2 - adds r7, r3, 0 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r1, 16 - lsrs r4, r1, 16 - adds r5, r4, 0 - ldrb r0, [r7, 0x8] - movs r1, 0x5 - bl GetWindowAttribute - lsls r0, 28 - lsrs r6, r0, 24 - cmp r4, 0 - beq _081B2CBA - cmp r4, 0x20 - beq _081B2C24 - cmp r4, 0x1D - bne _081B2C38 -_081B2C24: - movs r0, 0xB - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gSpeciesNames - adds r1, r0 - mov r0, r9 - bl StringCompare - cmp r0, 0 - beq _081B2CBA -_081B2C38: - mov r0, r8 - cmp r0, 0 - beq _081B2C48 - cmp r0, 0xFE - beq _081B2C88 - b _081B2CBA - .pool -_081B2C48: - ldr r5, =gUnknown_08615AC3 - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615AB6 - ldrb r1, [r4] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r7, 0x8] - ldr r1, =gText_MaleSymbol - ldr r3, [r7] - adds r3, 0xC - movs r2, 0x2 - bl sub_81B2A3C - b _081B2CBA - .pool -_081B2C88: - ldr r5, =gUnknown_08615AC5 - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615AB6 - ldrb r1, [r4] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r6 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r7, 0x8] - ldr r1, =gText_FemaleSymbol - ldr r3, [r7] - adds r3, 0xC - movs r2, 0x2 - bl sub_81B2A3C -_081B2CBA: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2BF4 - - thumb_func_start sub_81B2CD4 -sub_81B2CD4: @ 81B2CD4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - adds r7, r0, 0 - adds r6, r1, 0 - lsls r2, 24 - lsrs r4, r2, 24 - mov r8, r4 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B2D2E - cmp r4, 0 - beq _081B2D16 - ldr r5, [r6] - ldrb r0, [r6, 0x8] - ldrb r1, [r5, 0x10] - lsrs r1, 3 - ldrb r2, [r5, 0x11] - lsrs r2, 3 - adds r2, 0x1 - ldrb r3, [r5, 0x12] - lsrs r3, 3 - ldrb r4, [r5, 0x13] - lsrs r4, 3 - str r4, [sp] - movs r4, 0 - str r4, [sp, 0x4] - ldr r4, [r5] - bl _call_via_r4 -_081B2D16: - mov r0, r8 - cmp r0, 0x2 - beq _081B2D2E - adds r0, r7, 0 - movs r1, 0x39 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - adds r1, r6, 0 - bl sub_81B2D3C -_081B2D2E: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B2CD4 - - thumb_func_start sub_81B2D3C -sub_81B2D3C: @ 81B2D3C - push {r4,r5,lr} - adds r2, r0, 0 - adds r4, r1, 0 - lsls r2, 16 - lsrs r2, 16 - ldr r5, =gStringVar1 - adds r0, r5, 0 - adds r1, r2, 0 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - movs r1, 0xBA - strb r1, [r0] - movs r1, 0xFF - strb r1, [r0, 0x1] - ldrb r0, [r4, 0x8] - ldr r3, [r4] - adds r3, 0x10 - adds r1, r5, 0 - movs r2, 0 - bl sub_81B2A3C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2D3C - - thumb_func_start sub_81B2D74 -sub_81B2D74: @ 81B2D74 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - adds r7, r0, 0 - adds r6, r1, 0 - lsls r2, 24 - lsrs r4, r2, 24 - mov r8, r4 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B2DD0 - cmp r4, 0 - beq _081B2DB8 - ldr r5, [r6] - ldrb r0, [r6, 0x8] - ldrb r1, [r5, 0x14] - lsrs r1, 3 - adds r1, 0x1 - ldrb r2, [r5, 0x15] - lsrs r2, 3 - adds r2, 0x1 - ldrb r3, [r5, 0x16] - lsrs r3, 3 - ldrb r4, [r5, 0x17] - lsrs r4, 3 - str r4, [sp] - movs r4, 0 - str r4, [sp, 0x4] - ldr r4, [r5] - bl _call_via_r4 -_081B2DB8: - mov r0, r8 - cmp r0, 0x2 - beq _081B2DD0 - adds r0, r7, 0 - movs r1, 0x3A - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - adds r1, r6, 0 - bl sub_81B2DDC -_081B2DD0: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81B2D74 - - thumb_func_start sub_81B2DDC -sub_81B2DDC: @ 81B2DDC - push {r4-r6,lr} - adds r2, r0, 0 - adds r6, r1, 0 - lsls r2, 16 - lsrs r2, 16 - ldr r5, =gStringVar2 - adds r0, r5, 0 - adds r1, r2, 0 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar1 - ldr r1, =gText_Slash - adds r0, r4, 0 - bl StringCopy - adds r0, r4, 0 - adds r1, r5, 0 - bl StringAppend - ldrb r0, [r6, 0x8] - ldr r3, [r6] - adds r3, 0x14 - adds r1, r4, 0 - movs r2, 0 - bl sub_81B2A3C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2DDC - - thumb_func_start sub_81B2E28 -sub_81B2E28: @ 81B2E28 - push {r4-r6,lr} - adds r5, r0, 0 - adds r6, r1, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B2E5C - adds r0, r5, 0 - movs r1, 0x39 - bl GetMonData - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r5, 0 - movs r1, 0x3A - bl GetMonData - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - adds r2, r6, 0 - bl sub_81B2E64 -_081B2E5C: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81B2E28 - - thumb_func_start sub_81B2E64 -sub_81B2E64: @ 81B2E64 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x8 - adds r6, r2, 0 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - lsls r1, 16 - lsrs r1, 16 - mov r9, r1 - ldrb r0, [r6, 0x8] - movs r1, 0x5 - bl GetWindowAttribute - lsls r0, 28 - lsrs r7, r0, 24 - mov r1, r8 - lsls r0, r1, 16 - asrs r0, 16 - mov r2, r9 - lsls r1, r2, 16 - asrs r1, 16 - bl GetHPBarLevel - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - beq _081B2EB0 - cmp r0, 0x2 - blt _081B2EE0 - cmp r0, 0x4 - bgt _081B2EE0 - ldr r5, =gUnknown_08615AC7 - b _081B2EB2 - .pool -_081B2EB0: - ldr r5, =gUnknown_08615AC9 -_081B2EB2: - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615AB8 - ldrb r1, [r4] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette - b _081B2F04 - .pool -_081B2EE0: - ldr r5, =gUnknown_08615ACB - ldrb r0, [r5] - bl sub_81B2564 - ldr r4, =gUnknown_08615AB8 - ldrb r1, [r4] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette - ldrb r0, [r5, 0x1] - bl sub_81B2564 - ldrb r1, [r4, 0x1] - adds r1, r7 - movs r2, 0x2 - bl LoadPalette -_081B2F04: - mov r1, r8 - lsls r0, r1, 16 - asrs r0, 16 - mov r2, r9 - lsls r1, r2, 16 - asrs r1, 16 - ldr r2, [r6] - ldrb r2, [r2, 0x1A] - bl GetScaledHPFraction - lsls r0, 24 - lsrs r5, r0, 24 - ldrb r0, [r6, 0x8] - ldr r4, =gUnknown_08615AB8 - ldrb r1, [r4, 0x1] - ldr r3, [r6] - ldrb r2, [r3, 0x18] - ldrb r3, [r3, 0x19] - str r5, [sp] - movs r7, 0x1 - str r7, [sp, 0x4] - bl FillWindowPixelRect - ldrb r0, [r6, 0x8] - ldrb r1, [r4] - ldr r3, [r6] - ldrb r2, [r3, 0x18] - ldrb r3, [r3, 0x19] - adds r3, 0x1 - str r5, [sp] - movs r4, 0x2 - str r4, [sp, 0x4] - bl FillWindowPixelRect - ldr r1, [r6] - ldrb r0, [r1, 0x1A] - cmp r5, r0 - beq _081B2F88 - ldrb r0, [r6, 0x8] - ldrb r2, [r1, 0x18] - adds r2, r5 - ldrb r3, [r1, 0x19] - ldrb r1, [r1, 0x1A] - subs r1, r5 - lsls r1, 16 - lsrs r1, 16 - str r1, [sp] - str r7, [sp, 0x4] - movs r1, 0xD - bl FillWindowPixelRect - ldrb r0, [r6, 0x8] - ldr r1, [r6] - ldrb r2, [r1, 0x18] - adds r2, r5 - ldrb r3, [r1, 0x19] - adds r3, 0x1 - ldrb r1, [r1, 0x1A] - subs r1, r5 - lsls r1, 16 - lsrs r1, 16 - str r1, [sp] - str r4, [sp, 0x4] - movs r1, 0x2 - bl FillWindowPixelRect -_081B2F88: - ldrb r0, [r6, 0x8] - movs r1, 0x2 - bl CopyWindowToVram - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2E64 - - thumb_func_start sub_81B2FA8 -sub_81B2FA8: @ 81B2FA8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - adds r6, r1, 0 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r2, 24 - lsrs r7, r2, 24 - cmp r7, 0 - beq _081B2FF2 - ldr r5, [r6] - ldrb r1, [r5, 0x1C] - movs r4, 0x7 - adds r0, r1, 0 - ands r0, r4 - ldrb r2, [r5, 0x1E] - adds r0, r2 - adds r3, r0, 0x7 - asrs r3, 3 - ldrb r2, [r5, 0x1D] - adds r0, r2, 0 - ands r0, r4 - ldrb r4, [r5, 0x1F] - adds r0, r4 - adds r4, r0, 0x7 - ldrb r0, [r6, 0x8] - lsrs r1, 3 - lsrs r2, 3 - lsrs r4, 3 - str r4, [sp] - movs r4, 0x1 - str r4, [sp, 0x4] - ldr r4, [r5] - bl _call_via_r4 -_081B2FF2: - cmp r7, 0x2 - beq _081B3018 - ldrb r0, [r6, 0x8] - ldr r1, [r6] - ldrb r2, [r1, 0x1C] - ldrb r3, [r1, 0x1D] - ldr r1, =gUnknown_086157FC - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - ldr r4, =gUnknown_08615B60 - mov r5, r8 - lsls r1, r5, 2 - adds r1, r4 - ldr r1, [r1] - str r1, [sp, 0x8] - movs r1, 0x1 - bl AddTextPrinterParameterized3 -_081B3018: - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B2FA8 - - thumb_func_start sub_81B302C -sub_81B302C: @ 81B302C - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0xFF - beq _081B304C - movs r1, 0 - bl sub_8198070 - ldrb r0, [r4] - bl RemoveWindow - movs r0, 0xFF - strb r0, [r4] - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram -_081B304C: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B302C - - thumb_func_start display_pokemon_menu_message -display_pokemon_menu_message: @ 81B3054 - push {r4-r6,lr} - sub sp, 0xC - adds r6, r0, 0 - ldr r0, =gUnknown_0203CEC4 - ldr r4, [r0] - adds r5, r4, 0 - adds r5, 0xD - ldrb r0, [r4, 0xD] - cmp r0, 0xFF - beq _081B306E - adds r0, r5, 0 - bl sub_81B302C -_081B306E: - cmp r6, 0x7F - beq _081B313C - adds r0, r6, 0 - subs r0, 0x15 - cmp r0, 0x5 - bhi _081B30D4 - lsls r0, 2 - ldr r1, =_081B308C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081B308C: - .4byte _081B30A4 - .4byte _081B30BC - .4byte _081B30BC - .4byte _081B30AC - .4byte _081B30B4 - .4byte _081B30C4 -_081B30A4: - ldr r0, =gUnknown_08615928 - b _081B30C6 - .pool -_081B30AC: - ldr r0, =gUnknown_08615930 - b _081B30C6 - .pool -_081B30B4: - ldr r0, =gUnknown_08615938 - b _081B30C6 - .pool -_081B30BC: - ldr r0, =gUnknown_08615940 - b _081B30C6 - .pool -_081B30C4: - ldr r0, =gUnknown_08615948 -_081B30C6: - bl AddWindow - strb r0, [r5] - b _081B30DC - .pool -_081B30D4: - ldr r0, =gUnknown_08615920 - bl AddWindow - strb r0, [r4, 0xD] -_081B30DC: - cmp r6, 0 - bne _081B3104 - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 31 - cmp r0, 0 - beq _081B30F8 - movs r6, 0x2 - b _081B3104 - .pool -_081B30F8: - bl sub_81B314C - lsls r0, 24 - cmp r0, 0 - bne _081B3104 - movs r6, 0x1 -_081B3104: - ldrb r0, [r5] - movs r1, 0 - movs r2, 0x4F - movs r3, 0xD - bl SetWindowBorderStyle - ldr r4, =gStringVar4 - ldr r1, =gUnknown_08615AF4 - lsls r0, r6, 2 - adds r0, r1 - ldr r1, [r0] - adds r0, r4, 0 - bl StringExpandPlaceholders - ldrb r0, [r5] - movs r1, 0x1 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0 - bl AddTextPrinterParameterized - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram -_081B313C: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end display_pokemon_menu_message - - thumb_func_start sub_81B314C -sub_81B314C: @ 81B314C - push {r4-r7,lr} - ldr r7, =gPlayerParty - movs r6, 0 - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0xB] - cmp r0, 0x1 - bne _081B3168 -_081B315A: - movs r0, 0x1 - b _081B31AA - .pool -_081B3168: - movs r5, 0 -_081B316A: - movs r0, 0x64 - muls r0, r5 - adds r4, r7, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B319A - adds r0, r4, 0 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - bne _081B3194 - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - beq _081B319A -_081B3194: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_081B319A: - cmp r6, 0x1 - bhi _081B315A - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _081B316A - movs r0, 0 -_081B31AA: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81B314C - thumb_func_start sub_81B31B0 sub_81B31B0: @ 81B31B0 push {r4-r7,lr} diff --git a/include/party_menu.h b/include/party_menu.h index f2615dac56..30a86e1622 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -12,7 +12,8 @@ enum AILMENT_SLP, AILMENT_FRZ, AILMENT_BRN, - AILMENT_FNT = 7 + AILMENT_PKRS, + AILMENT_FNT }; enum @@ -35,12 +36,12 @@ struct Struct203CEC8 { s8 unkA; u8 unkB; u8 unkD; - u8 unkE; + s16 unkE; }; extern struct Struct203CEC8 gUnknown_0203CEC8; -extern const u16 gUnknown_0861500C[]; +extern const u16 gUnknown_0861500C[]; // tutor table bool8 pokemon_has_move(struct Pokemon *, u16); void sub_81B58A8(void); diff --git a/include/rom_8011DC0.h b/include/rom_8011DC0.h index b6ca0e2484..1aa663bc78 100644 --- a/include/rom_8011DC0.h +++ b/include/rom_8011DC0.h @@ -11,5 +11,6 @@ void sub_8018438(void); u16 mevent_081445C0(u8); void sub_801B990(u32, u32); u8 sub_8013F78(void); +bool32 sub_802C908(u16); #endif //GUARD_rom_8011DC0_H diff --git a/include/strings.h b/include/strings.h index 31b8f399dc..d8b1f4f7c4 100644 --- a/include/strings.h +++ b/include/strings.h @@ -370,6 +370,12 @@ extern const u8 gText_ThreeDashes[]; extern const u8 gText_PkmnHPRestoredByVar2[]; extern const u8 gText_CantBeUsedOnPkmn[]; extern const u8 gText_CancelParticipation[]; +extern const u8 gText_PkmnWasGivenItem[]; +extern const u8 gText_RecievedItemFromPkmn[]; +extern const u8 gText_SwitchPkmnItem[]; +extern const u8 gText_SwitchedPkmnItem[]; +extern const u8 gText_BagFullCouldNotRemoveItem[]; +extern const u8 gText_PkmnCantParticipate[]; //pokedex text extern const u8 gText_CryOf[]; diff --git a/src/party_menu.c b/src/party_menu.c index 07519d6482..1f419f6bb7 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -1,19 +1,25 @@ #include "global.h" #include "battle.h" +#include "battle_interface.h" #include "bg.h" +#include "constants/battle.h" +#include "constants/items.h" #include "constants/rgb.h" #include "constants/songs.h" #include "constants/species.h" #include "contest.h" +#include "data2.h" #include "decompress.h" #include "event_data.h" #include "fldeff_softboiled.h" #include "gpu_regs.h" #include "graphics.h" #include "international_string_util.h" +#include "item.h" #include "item_menu.h" #include "item_use.h" #include "main.h" +#include "mail.h" #include "malloc.h" #include "menu.h" #include "menu_helpers.h" @@ -21,6 +27,7 @@ #include "party_menu.h" #include "pokemon.h" #include "pokemon_icon.h" +#include "rom_8011DC0.h" #include "scanline_effect.h" #include "sound.h" #include "sprite.h" @@ -28,11 +35,16 @@ #include "strings.h" #include "task.h" #include "text.h" +#include "text_window.h" #include "window.h" struct Unk_Rodata1 { void (*unk0)(u8, u8, u8, u8, u8, u8); - u32 unk4[7]; + u8 unk4[24]; + u8 unk1C; + u8 unk1D; + u8 unk1E; + u8 unk1F; }; struct Unk_203CEC4 { @@ -52,7 +64,7 @@ struct Unk_203CEC4 { struct Unk_203CEDC { struct Unk_Rodata1 *unk0; - u32 *unk4; + u8 *unk4; u8 unk8; u8 unk9; u8 unkA; @@ -78,12 +90,57 @@ extern u8 gUnknown_0203CEF8[]; // BELOW TO BE CONVERTED TO C +extern u32 gUnknown_08615048[]; // tutor compatibility table extern struct BgTemplate gUnknown_086156B8[]; extern struct Unk_Rodata1 gUnknown_086156C4[2]; // extern struct Unk_Rodata1 gUnknown_086156E4; -extern u32 gUnknown_08615704[][6][2]; +extern u8 gUnknown_08615704[][6][8]; extern u8 gUnknown_086157C4[]; extern u8 gUnknown_086157E0[]; +extern const u8 gUnknown_086157FC[][3]; +extern struct WindowTemplate gUnknown_08615810[]; +extern struct WindowTemplate gUnknown_08615850[]; +extern struct WindowTemplate gUnknown_086158D0[]; +extern struct WindowTemplate gUnknown_08615890[]; +extern struct WindowTemplate gUnknown_08615908; +extern struct WindowTemplate gUnknown_08615910; +extern struct WindowTemplate gUnknown_08615918; +extern struct WindowTemplate gUnknown_08615920; +extern struct WindowTemplate gUnknown_08615928; +extern struct WindowTemplate gUnknown_08615930; +extern struct WindowTemplate gUnknown_08615938; +extern struct WindowTemplate gUnknown_08615940; +extern struct WindowTemplate gUnknown_08615948; +extern u8 gUnknown_08615988[]; +extern u8 gUnknown_086159CE[]; +extern u8 gUnknown_08615A14[]; +extern u8 gUnknown_08615A4A[]; +extern u8 gUnknown_08615A80[]; +extern u8 gUnknown_08615AB6[]; +extern u8 gUnknown_08615AB8[]; +extern u8 gUnknown_08615ABA[]; +extern u8 gUnknown_08615ABD[]; +extern u8 gUnknown_08615AC0[]; +extern u8 gUnknown_08615AC3[]; +extern u8 gUnknown_08615AC5[]; +extern u8 gUnknown_08615AC7[]; +extern u8 gUnknown_08615AC9[]; +extern u8 gUnknown_08615ACB[]; +extern u8 gUnknown_08615ACD[]; +extern u8 gUnknown_08615AD0[]; +extern u8 gUnknown_08615AD3[]; +extern u8 gUnknown_08615AD6[]; +extern u8 gUnknown_08615AD9[]; +extern u8 gUnknown_08615ADC[]; +extern u8 gUnknown_08615ADF[]; +extern u8 gUnknown_08615AE2[]; +extern u8 gUnknown_08615AE5[]; +extern u8 gUnknown_08615AE8[]; +extern u8 gUnknown_08615AEB[]; +extern u8 gUnknown_08615AEE[]; +extern u8 gUnknown_08615AF1[]; +extern const u8 *gUnknown_08615AF4[]; +extern const u8 *gUnknown_08615B60[]; // ABOVE TO BE CONVERTED TO C @@ -132,7 +189,7 @@ bool8 sub_81B85AC(struct Pokemon *); bool8 sub_81B218C(u8); void sub_81B0C94(u8, u16, u8); u8 sub_81B22D8(struct Pokemon *, u16, u8); -void sub_81B2A3C(u8, u8*, u8, u32*); +void sub_81B2A3C(u8, const u8*, u8, u8*); void sub_81B2B40(u8, struct Unk_203CEDC *); void sub_81B2BF4(u8, u16, u8*, struct Unk_203CEDC *); void sub_81B2D3C(u16, struct Unk_203CEDC *); @@ -182,7 +239,21 @@ void sub_81B1708(u8); bool8 sub_81B1BD4(void); void sub_81B1C1C(u8); void sub_81B8558(void); -void sub_81B17F8(s8*); +void sub_81B17F8(s8*, s8); +void sub_81B1854(s8*, s8); +void sub_81B195C(s8*, s8); +s8 sub_81B1B00(s8, s8); +void sub_81B3300(const u8*); +void sub_81B1B8C(u8); +void sub_81B2CD4(struct Pokemon*, struct Unk_203CEDC*, u8); +void sub_81B2E28(struct Pokemon*, struct Unk_203CEDC*); +bool16 sub_81B2134(struct Pokemon*); +bool16 sub_81B2164(struct Pokemon*); +void sub_81B2248(u8); +void sub_81B227C(u8); +bool8 sub_81B2370(u16, u8); +u16 sub_81B2360(u8); +bool8 sub_81B314C(void); void sub_81B0038(u8 a, u8 b, u8 c, u8 d, u8 e, TaskFunc f, MainCallback g) { @@ -642,7 +713,7 @@ void sub_81B0B08(u8 slot) void sub_81B0B60(u8 slot) { - if (!GetNumberOfRelearnableMoves(&gPlayerParty[slot])) + if (GetNumberOfRelearnableMoves(&gPlayerParty[slot]) == 0) sub_81B0A10(slot, 9); else sub_81B0A10(slot, 8); @@ -1139,7 +1210,7 @@ void sub_81B1708(u8 taskId) } } -/* u16 sub_81B1760(s8* ptr) +u16 sub_81B1760(s8 *ptr) { s8 r1; @@ -1175,9 +1246,9 @@ void sub_81B1708(u8 taskId) if (gMain.newKeys & START_BUTTON) return 8; - if ((s8)r1) + if (r1) { - sub_81B17F8(ptr); + sub_81B17F8(ptr, r1); return 0; } @@ -1185,4 +1256,1530 @@ void sub_81B1708(u8 taskId) return 2; return gMain.newKeys & (A_BUTTON | B_BUTTON); -} */ +} + +#ifdef NONMATCHING +void sub_81B17F8(s8 *ptr, s8 b) +{ + s8 slot = *ptr; + + if (!gUnknown_0203CEC8.unk8_1) + sub_81B1854(ptr, b); + else + sub_81B195C(ptr, b); + + if (*ptr != slot) + { + PlaySE(SE_SELECT); + sub_81B0FCC(slot, 0); + sub_81B0FCC(*ptr, 1); + } +} +#else +NAKED +void sub_81B17F8(s8 *ptr, s8 b) +{ + asm_unified("push {r4,r5,lr}\n\ + adds r5, r0, 0\n\ + lsls r1, 24\n\ + lsrs r1, 24\n\ + ldrb r4, [r5]\n\ + ldr r0, =gUnknown_0203CEC8\n\ + ldrb r0, [r0, 0x8]\n\ + lsls r0, 26\n\ + lsrs r0, 30\n\ + cmp r0, 0\n\ + bne _081B1820\n\ + lsls r1, 24\n\ + asrs r1, 24\n\ + adds r0, r5, 0\n\ + bl sub_81B1854\n\ + b _081B182A\n\ + .pool\n\ +_081B1820:\n\ + lsls r1, 24\n\ + asrs r1, 24\n\ + adds r0, r5, 0\n\ + bl sub_81B195C\n\ +_081B182A:\n\ + movs r1, 0\n\ + ldrsb r1, [r5, r1]\n\ + lsls r4, 24\n\ + asrs r0, r4, 24\n\ + cmp r1, r0\n\ + beq _081B184C\n\ + movs r0, 0x5\n\ + bl PlaySE\n\ + lsrs r0, r4, 24\n\ + movs r1, 0\n\ + bl sub_81B0FCC\n\ + ldrb r0, [r5]\n\ + movs r1, 0x1\n\ + bl sub_81B0FCC\n\ +_081B184C:\n\ + pop {r4,r5}\n\ + pop {r0}\n\ + bx r0\n"); +} +#endif + +#ifdef NONMATCHING +void sub_81B1854(s8 *ptr, s8 b) +{ + u8 r0r2; + + switch (b) + { + case -1: + r0r2 = *ptr; + if (*ptr == 0) + { + *ptr = 7; + } + else if (*ptr == 6) + { + *ptr = gPlayerPartyCount - 1; + } + else if (*ptr == 7) + { + if (gUnknown_0203CEC4->unk8_0) + *ptr = 6; + else + *ptr = gPlayerPartyCount - 1; + } + else + { + *ptr = r0r2 - 1; + } + break; + case 1: + r0r2 = *ptr; + if (*ptr != 7) + { + if ((u32)*ptr == gPlayerPartyCount - 1) + { + if (gUnknown_0203CEC4->unk8_0) + *ptr = 6; + else + *ptr = 7; + } + else + { + *ptr = r0r2 + 1; + } + } + else + { + *ptr = 0; + } + break; + case 2: + if (gPlayerPartyCount != 1 && *ptr == 0) + { + if (gUnknown_0203CEC4->unk8_1 == 0) + *ptr = 1; + else + *ptr = gUnknown_0203CEC4->unk8_1; + } + break; + case -2: + if (*ptr != 0 && *ptr != 6 && *ptr != 7) + { + gUnknown_0203CEC4->unk8_1 = *ptr; + *ptr = 0; + } + break; + } +} +#else +NAKED +void sub_81B1854(s8 *ptr, s8 b) +{ + asm_unified("push {r4,lr}\n\ + adds r4, r0, 0\n\ + lsls r1, 24\n\ + asrs r1, 24\n\ + movs r0, 0x1\n\ + negs r0, r0\n\ + cmp r1, r0\n\ + beq _081B187A\n\ + cmp r1, r0\n\ + bgt _081B1870\n\ + subs r0, 0x1\n\ + cmp r1, r0\n\ + beq _081B1924\n\ + b _081B1952\n\ +_081B1870:\n\ + cmp r1, 0x1\n\ + beq _081B18C0\n\ + cmp r1, 0x2\n\ + beq _081B18F8\n\ + b _081B1952\n\ +_081B187A:\n\ + ldrb r0, [r4]\n\ + movs r1, 0\n\ + ldrsb r1, [r4, r1]\n\ + cmp r1, 0\n\ + bne _081B1888\n\ + movs r0, 0x7\n\ + b _081B1950\n\ +_081B1888:\n\ + cmp r1, 0x6\n\ + bne _081B1898\n\ + ldr r0, =gPlayerPartyCount\n\ + ldrb r0, [r0]\n\ + subs r0, 0x1\n\ + b _081B1950\n\ + .pool\n\ +_081B1898:\n\ + cmp r1, 0x7\n\ + bne _081B18BC\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x8]\n\ + lsls r0, 31\n\ + cmp r0, 0\n\ + beq _081B18B0\n\ + movs r0, 0x6\n\ + b _081B1950\n\ + .pool\n\ +_081B18B0:\n\ + ldr r0, =gPlayerPartyCount\n\ + ldrb r0, [r0]\n\ + subs r0, 0x1\n\ + b _081B1950\n\ + .pool\n\ +_081B18BC:\n\ + subs r0, 0x1\n\ + b _081B1950\n\ +_081B18C0:\n\ + ldrb r2, [r4]\n\ + movs r0, 0\n\ + ldrsb r0, [r4, r0]\n\ + cmp r0, 0x7\n\ + beq _081B194E\n\ + movs r1, 0\n\ + ldrsb r1, [r4, r1]\n\ + ldr r0, =gPlayerPartyCount\n\ + ldrb r0, [r0]\n\ + subs r0, 0x1\n\ + cmp r1, r0\n\ + bne _081B18F4\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x8]\n\ + lsls r0, 31\n\ + cmp r0, 0\n\ + beq _081B18F0\n\ + movs r0, 0x6\n\ + b _081B1950\n\ + .pool\n\ +_081B18F0:\n\ + movs r0, 0x7\n\ + b _081B1950\n\ +_081B18F4:\n\ + adds r0, r2, 0x1\n\ + b _081B1950\n\ +_081B18F8:\n\ + ldr r0, =gPlayerPartyCount\n\ + ldrb r0, [r0]\n\ + cmp r0, 0x1\n\ + beq _081B1952\n\ + movs r0, 0\n\ + ldrsb r0, [r4, r0]\n\ + cmp r0, 0\n\ + bne _081B1952\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x8]\n\ + lsls r0, 28\n\ + lsrs r0, 29\n\ + cmp r0, 0\n\ + bne _081B1950\n\ + movs r0, 0x1\n\ + b _081B1950\n\ + .pool\n\ +_081B1924:\n\ + movs r0, 0\n\ + ldrsb r0, [r4, r0]\n\ + cmp r0, 0\n\ + beq _081B1952\n\ + cmp r0, 0x6\n\ + beq _081B1952\n\ + cmp r0, 0x7\n\ + beq _081B1952\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r3, [r0]\n\ + movs r1, 0\n\ + ldrsb r1, [r4, r1]\n\ + movs r0, 0x7\n\ + ands r1, r0\n\ + lsls r1, 1\n\ + ldrb r2, [r3, 0x8]\n\ + movs r0, 0xF\n\ + negs r0, r0\n\ + ands r0, r2\n\ + orrs r0, r1\n\ + strb r0, [r3, 0x8]\n\ +_081B194E:\n\ + movs r0, 0\n\ +_081B1950:\n\ + strb r0, [r4]\n\ +_081B1952:\n\ + pop {r4}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n"); +} +#endif + +#ifdef NONMATCHING +void sub_81B195C(s8 *ptr, s8 b) +{ + u8 unk; + s8 unk2 = b; + u8 unk3; + + switch (b) + { + case -1: + unk = *ptr; + if (*ptr == 0) + { + *ptr = 7; + } + else if (*ptr == 6) + { + *ptr = gPlayerPartyCount - 1; + } + else if (*ptr == 7) + { + if (gUnknown_0203CEC4->unk8_0) + { + *ptr = 6; + } + else + { + *ptr = unk - 1; + unk2 = sub_81B1B00(*ptr, unk2); + if (unk2 != -1) + *ptr = unk2; + } + } + else + { + unk2 = sub_81B1B00(*ptr, unk2); + if (unk2 != -1) + *ptr = unk2; + } + break; + case 1: + if (*ptr == 6) + { + *ptr = 7; + } + else if (*ptr == 7) + { + *ptr = 0; + } + else + { + unk2 = sub_81B1B00(*ptr, 1); + if (unk2 == -1) + { + if (gUnknown_0203CEC4->unk8_0) + *ptr = 6; + else + *ptr = 7; + } + else + { + *ptr = unk2; + } + } + break; + case 2: + if (*ptr == 0) + { + if (gUnknown_0203CEC4->unk8_1 == 3) + { + if (GetMonData(&gPlayerParty[3], MON_DATA_SPECIES) != SPECIES_NONE) + *ptr = 3; + } + else if (GetMonData(&gPlayerParty[2], MON_DATA_SPECIES) != SPECIES_NONE) + { + *ptr = 2; + } + } + else if (*ptr == 1) + { + if (gUnknown_0203CEC4->unk8_1 == 5) + { + if (GetMonData(&gPlayerParty[5], MON_DATA_SPECIES) != SPECIES_NONE) + *ptr = 5; + } + else if (GetMonData(&gPlayerParty[4], MON_DATA_SPECIES) != SPECIES_NONE) + { + *ptr = 4; + } + } + break; + case -2: + unk3 = *ptr - 2; + if (unk3 <= 1) + { + gUnknown_0203CEC4->unk8_1 = *ptr; + *ptr = 0; + } + else + { + unk3 = *ptr - 4; + if (unk3 <= 1) + { + gUnknown_0203CEC4->unk8_1 = *ptr; + *ptr = 1; + } + } + break; + } +} +#else +NAKED +void sub_81B195C(s8 *ptr, s8 b) +{ + asm_unified("push {r4-r6,lr}\n\ + adds r4, r0, 0\n\ + lsls r1, 24\n\ + lsrs r2, r1, 24\n\ + asrs r5, r1, 24\n\ + movs r6, 0x1\n\ + negs r6, r6\n\ + cmp r5, r6\n\ + beq _081B1988\n\ + cmp r5, r6\n\ + bgt _081B197E\n\ + movs r0, 0x2\n\ + negs r0, r0\n\ + cmp r5, r0\n\ + bne _081B197C\n\ + b _081B1A9C\n\ +_081B197C:\n\ + b _081B1AF4\n\ +_081B197E:\n\ + cmp r5, 0x1\n\ + beq _081B19E4\n\ + cmp r5, 0x2\n\ + beq _081B1A24\n\ + b _081B1AF4\n\ +_081B1988:\n\ + ldrb r1, [r4]\n\ + movs r0, 0\n\ + ldrsb r0, [r4, r0]\n\ + cmp r0, 0\n\ + bne _081B1996\n\ + movs r0, 0x7\n\ + b _081B1AF2\n\ +_081B1996:\n\ + cmp r0, 0x6\n\ + bne _081B19A8\n\ + ldr r0, =gPlayerPartyCount\n\ + ldrb r0, [r0]\n\ + subs r0, 0x1\n\ + b _081B1AF2\n\ + .pool\n\ +_081B19A8:\n\ + cmp r0, 0x7\n\ + bne _081B19C4\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x8]\n\ + lsls r0, 31\n\ + cmp r0, 0\n\ + beq _081B19C0\n\ + movs r0, 0x6\n\ + b _081B1AF2\n\ + .pool\n\ +_081B19C0:\n\ + subs r0, r1, 0x1\n\ + strb r0, [r4]\n\ +_081B19C4:\n\ + movs r0, 0\n\ + ldrsb r0, [r4, r0]\n\ + lsls r1, r2, 24\n\ + asrs r1, 24\n\ + bl sub_81B1B00\n\ + lsls r0, 24\n\ + lsrs r2, r0, 24\n\ + asrs r0, 24\n\ + movs r1, 0x1\n\ + negs r1, r1\n\ + cmp r0, r1\n\ + bne _081B19E0\n\ + b _081B1AF4\n\ +_081B19E0:\n\ + strb r2, [r4]\n\ + b _081B1AF4\n\ +_081B19E4:\n\ + movs r0, 0\n\ + ldrsb r0, [r4, r0]\n\ + cmp r0, 0x6\n\ + bne _081B19F0\n\ + movs r0, 0x7\n\ + b _081B1AF2\n\ +_081B19F0:\n\ + cmp r0, 0x7\n\ + bne _081B19F8\n\ + movs r0, 0\n\ + b _081B1AF2\n\ +_081B19F8:\n\ + movs r0, 0\n\ + ldrsb r0, [r4, r0]\n\ + movs r1, 0x1\n\ + bl sub_81B1B00\n\ + lsls r0, 24\n\ + lsrs r2, r0, 24\n\ + asrs r0, 24\n\ + cmp r0, r6\n\ + bne _081B19E0\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x8]\n\ + lsls r0, 31\n\ + cmp r0, 0\n\ + beq _081B1A20\n\ + movs r0, 0x6\n\ + b _081B1AF2\n\ + .pool\n\ +_081B1A20:\n\ + movs r0, 0x7\n\ + b _081B1AF2\n\ +_081B1A24:\n\ + movs r0, 0\n\ + ldrsb r0, [r4, r0]\n\ + cmp r0, 0\n\ + bne _081B1A5C\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x8]\n\ + lsls r0, 28\n\ + lsrs r6, r0, 29\n\ + cmp r6, 0x3\n\ + bne _081B1A54\n\ + ldr r0, =gPlayerParty + 300\n\ + movs r1, 0xB\n\ + bl GetMonData\n\ + cmp r0, 0\n\ + beq _081B1AF4\n\ + strb r6, [r4]\n\ + b _081B1AF4\n\ + .pool\n\ +_081B1A54:\n\ + ldr r0, =gPlayerParty + 200\n\ + b _081B1A70\n\ + .pool\n\ +_081B1A5C:\n\ + cmp r0, 0x1\n\ + bne _081B1AF4\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x8]\n\ + lsls r0, 28\n\ + lsrs r5, r0, 29\n\ + cmp r5, 0x5\n\ + bne _081B1A88\n\ + ldr r0, =gPlayerParty + 500\n\ +_081B1A70:\n\ + movs r1, 0xB\n\ + bl GetMonData\n\ + cmp r0, 0\n\ + beq _081B1AF4\n\ + strb r5, [r4]\n\ + b _081B1AF4\n\ + .pool\n\ +_081B1A88:\n\ + ldr r0, =gPlayerParty + 400\n\ + movs r1, 0xB\n\ + bl GetMonData\n\ + cmp r0, 0\n\ + beq _081B1AF4\n\ + movs r0, 0x4\n\ + b _081B1AF2\n\ + .pool\n\ +_081B1A9C:\n\ + ldrb r1, [r4]\n\ + subs r0, r1, 0x2\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + cmp r0, 0x1\n\ + bhi _081B1ACC\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r3, [r0]\n\ + movs r1, 0\n\ + ldrsb r1, [r4, r1]\n\ + movs r0, 0x7\n\ + ands r1, r0\n\ + lsls r1, 1\n\ + ldrb r2, [r3, 0x8]\n\ + movs r0, 0xF\n\ + negs r0, r0\n\ + ands r0, r2\n\ + orrs r0, r1\n\ + strb r0, [r3, 0x8]\n\ + movs r0, 0\n\ + b _081B1AF2\n\ + .pool\n\ +_081B1ACC:\n\ + subs r0, r1, 0x4\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + cmp r0, 0x1\n\ + bhi _081B1AF4\n\ + ldr r0, =gUnknown_0203CEC4\n\ + ldr r3, [r0]\n\ + movs r1, 0\n\ + ldrsb r1, [r4, r1]\n\ + movs r0, 0x7\n\ + ands r1, r0\n\ + lsls r1, 1\n\ + ldrb r2, [r3, 0x8]\n\ + movs r0, 0xF\n\ + negs r0, r0\n\ + ands r0, r2\n\ + orrs r0, r1\n\ + strb r0, [r3, 0x8]\n\ + movs r0, 0x1\n\ +_081B1AF2:\n\ + strb r0, [r4]\n\ +_081B1AF4:\n\ + pop {r4-r6}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n"); +} +#endif + +s8 sub_81B1B00(s8 a, s8 b) +{ + while (TRUE) + { + a += b; + if ((u8)a >= 6) + return -1; + if (GetMonData(&gPlayerParty[a], MON_DATA_SPECIES) != SPECIES_NONE) + return a; + } +} + +u8* GetMonNickname(struct Pokemon *mon, u8 *dest) +{ + GetMonData(mon, MON_DATA_NICKNAME, dest); + return StringGetEnd10(dest); +} + +u8 sub_81B1B5C(const u8* str, u8 b) +{ + u8 taskId; + + sub_81B3300(str); + taskId = CreateTask(sub_81B1B8C, 1); + gTasks[taskId].data[0] = b; + return taskId; +} + +void sub_81B1B8C(u8 taskId) +{ + if (RunTextPrintersRetIsActive(6) != TRUE) + { + if (gTasks[taskId].data[0] == 0) + { + sub_8198070(6, 0); + ClearWindowTilemap(6); + } + DestroyTask(taskId); + } +} + +bool8 sub_81B1BD4(void) +{ + return FuncIsActiveTask(sub_81B1B8C); +} + +void sub_81B1BE8(u8 taskId) +{ + if (sub_81221EC() != TRUE) + { + display_pokemon_menu_message(0); + gTasks[taskId].func = sub_81B1370; + } +} + +void sub_81B1C1C(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_8198070(6, 0); + ClearWindowTilemap(6); + if (sub_81221AC() == TRUE) + { + gTasks[taskId].func = sub_81B1BE8; + } + else + { + display_pokemon_menu_message(0); + gTasks[taskId].func = sub_81B1370; + } + } +} + +void sub_81B1C84(struct Pokemon *mon, u16 item, u8 c) +{ + GetMonNickname(mon, gStringVar1); + CopyItemName(item, gStringVar2); + StringExpandPlaceholders(gStringVar4, gText_PkmnWasGivenItem); + sub_81B1B5C(gStringVar4, c); + schedule_bg_copy_tilemap_to_vram(2); +} + +void sub_81B1CD0(struct Pokemon *mon, u16 item, u8 c) +{ + GetMonNickname(mon, gStringVar1); + CopyItemName(item, gStringVar2); + StringExpandPlaceholders(gStringVar4, gText_RecievedItemFromPkmn); + sub_81B1B5C(gStringVar4, c); + schedule_bg_copy_tilemap_to_vram(2); +} + +void sub_81B1D1C(struct Pokemon *mon, u16 item, u8 c) +{ + GetMonNickname(mon, gStringVar1); + CopyItemName(item, gStringVar2); + StringExpandPlaceholders(gStringVar4, gText_SwitchPkmnItem); + sub_81B1B5C(gStringVar4, c); + schedule_bg_copy_tilemap_to_vram(2); +} + +void sub_81B1D68(u16 item, u16 item2, u8 c) +{ + CopyItemName(item, gStringVar1); + CopyItemName(item2, gStringVar2); + StringExpandPlaceholders(gStringVar4, gText_SwitchedPkmnItem); + sub_81B1B5C(gStringVar4, c); + schedule_bg_copy_tilemap_to_vram(2); +} + +void sub_81B1DB8(struct Pokemon *mon, u16 item) +{ + u8 itemBytes[2]; + + if (ItemIsMail(item) == TRUE) + { + if (GiveMailToMon(mon, item) == 0xFF) + return; + } + itemBytes[0] = item; + itemBytes[1] = item >> 8; + SetMonData(mon, MON_DATA_HELD_ITEM, itemBytes); +} + +u8 sub_81B1E00(struct Pokemon* mon) +{ + u16 item = GetMonData(mon, MON_DATA_HELD_ITEM); + + if (item == ITEM_NONE) + return 0; + if (AddBagItem(item, 1) == FALSE) + return 1; + + item = ITEM_NONE; + SetMonData(mon, MON_DATA_HELD_ITEM, &item); + return 2; +} + +void pokemon_item_not_removed(void) +{ + StringExpandPlaceholders(gStringVar4, gText_BagFullCouldNotRemoveItem); +} + +void sub_81B1E60(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + data[0] += data[2]; + data[3]--; + SetMonData(&gPlayerParty[data[4]], MON_DATA_HP, &data[0]); + sub_81B2CD4(&gPlayerParty[data[4]], &gUnknown_0203CEDC[data[4]], 1); + sub_81B2E28(&gPlayerParty[data[4]], &gUnknown_0203CEDC[data[4]]); + if (data[3] == 0 || data[0] == 0 || data[0] == data[1]) + { + if (data[0] > data[5]) + ConvertIntToDecimalStringN(gStringVar2, data[0] - data[5], 0, 3); + SwitchTaskToFollowupFunc(taskId); + } +} + +void sub_81B1F18(u8 taskId, u8 slot, s8 c, s16 HPSomething, TaskFunc func) +{ + struct Pokemon *mon = &gPlayerParty[slot]; + s16 *data = gTasks[taskId].data; + + data[0] = GetMonData(mon, MON_DATA_HP); + data[1] = GetMonData(mon, MON_DATA_MAX_HP); + data[2] = c; + data[3] = HPSomething; + data[4] = slot; + data[5] = data[0]; + SetTaskFuncWithFollowupFunc(taskId, sub_81B1E60, func); +} + +void sub_81B1FA8(u8 taskId, u8 b, u32 hp) +{ + s16 *data = gTasks[taskId].data; + + switch (b) // only case 0 is used + { + case 0: + data[0] = hp; + data[5] = hp; + break; + case 1: + data[1] = hp; + break; + case 2: + data[2] = hp; + break; + case 3: + data[3] = hp; + break; + case 4: + data[4] = hp; + break; + case 5: + SetTaskFuncWithFollowupFunc(taskId, sub_81B1E60, (TaskFunc)hp); // >casting hp as a taskfunc + break; + } +} + +u8 pokemon_ailments_get_primary(u32 status) +{ + if (status & STATUS1_PSN_ANY) + return AILMENT_PSN; + if (status & STATUS1_PARALYSIS) + return AILMENT_PRZ; + if (status & STATUS1_SLEEP) + return AILMENT_SLP; + if (status & STATUS1_FREEZE) + return AILMENT_FRZ; + if (status & STATUS1_BURN) + return AILMENT_BRN; + return AILMENT_NONE; +} + +u8 sub_81B205C(struct Pokemon *mon) +{ + u8 ailment; + + if (GetMonData(mon, MON_DATA_HP) == 0) + return AILMENT_FNT; + ailment = pokemon_ailments_get_primary(GetMonData(mon, MON_DATA_STATUS)); + if (ailment != AILMENT_NONE) + return ailment; + if (CheckPartyPokerus(mon, 0)) + return AILMENT_PKRS; + return AILMENT_NONE; +} + +void sub_81B209C(void) +{ + u16 *ptr; + + if (gUnknown_0203CEC8.unk8_0 == 11) + { + u8 i; + + ptr = &gUnknown_0203CEC8.unkE; + gUnknown_0203CEC8.unkE = 0; + if (gSpecialVar_0x8005 == 0) + { + for (i = 0; i < gPlayerPartyCount; i++) + *ptr += sub_81B2134(&gPlayerParty[i]) << i; + } + else + { + for (i = 0; i < gPlayerPartyCount; i++) + *ptr += sub_81B2164(&gPlayerParty[i]) << i; + } + } +} + +bool16 sub_81B2134(struct Pokemon *mon) +{ + if (GetMonData(mon, MON_DATA_IS_EGG) != TRUE && sub_802C908(GetMonData(mon, MON_DATA_SPECIES)) != FALSE) + return TRUE; + return FALSE; +} + +// Dodrio Berry Picking select? + +bool16 sub_81B2164(struct Pokemon *mon) +{ + if (GetMonData(mon, MON_DATA_IS_EGG) != TRUE && GetMonData(mon, MON_DATA_SPECIES) == SPECIES_DODRIO) + return TRUE; + return FALSE; +} + +bool8 sub_81B218C(u8 slot) +{ + if (!((gUnknown_0203CEC8.unkE >> slot) & 1)) + return FALSE; + return TRUE; +} + +void sub_81B21AC(u8 taskId, u8 slot) +{ + if (sub_81B218C(slot) == TRUE) + { + PlaySE(SE_SELECT); + gSpecialVar_0x8004 = slot; + sub_81B12C0(taskId); + } + else + { + PlaySE(SE_HAZURE); + sub_81B1B5C(gText_PkmnCantParticipate, 0); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_81B1C1C; + } +} + +void sub_81B2210(u8 taskId) +{ + sub_81B1B5C(gText_CancelParticipation, 1); + schedule_bg_copy_tilemap_to_vram(2); + gTasks[taskId].func = sub_81B2248; +} + +void sub_81B2248(u8 taskId) +{ + if (sub_81B1BD4() != TRUE) + { + sub_81B334C(); + gTasks[taskId].func = sub_81B227C; + } +} + +void sub_81B227C(u8 taskId) +{ + switch (Menu_ProcessInputNoWrap_()) + { + case 0: + gSpecialVar_0x8004 = 7; + sub_81B12C0(taskId); + break; + case -1: + PlaySE(SE_SELECT); + case 1: + gTasks[taskId].func = sub_81B1C1C; + break; + } +} + +u8 sub_81B22D8(struct Pokemon *mon, u16 item, u8 c) +{ + u16 move; + + if (GetMonData(mon, MON_DATA_IS_EGG) != FALSE) + return 3; + if (item >= ITEM_TM01_FOCUS_PUNCH) + { + if (CanMonLearnTMHM(mon, item - 33) != FALSE) + move = ItemIdToBattleMoveId(item); + else + return 1; + do {} while (0); // :morphon: + } + else if (sub_81B2370(GetMonData(mon, MON_DATA_SPECIES), c) == FALSE) + { + return 1; + } + else + { + move = sub_81B2360(c); + } + + if (pokemon_has_move(mon, move) == TRUE) + return 2; + return 0; +} + +u16 sub_81B2360(u8 tutor) +{ + return gUnknown_0861500C[tutor]; +} + +bool8 sub_81B2370(u16 species, u8 tutor) +{ + if (gUnknown_08615048[species] & (1 << tutor)) + return TRUE; + return FALSE; +} + +void sub_81B239C(u8 a) +{ + u8 i; + + switch (a) + { + case 0: + InitWindows(gUnknown_08615810); + break; + case 1: + InitWindows(gUnknown_08615850); + break; + case 2: + InitWindows(gUnknown_08615890); + break; + default: + InitWindows(gUnknown_086158D0); + break; + } + DeactivateAllTextPrinters(); + for (i = 0; i < 6; i++) + FillWindowPixelBuffer(i, 0); + LoadUserWindowBorderGfx(0, 0x4F, 0xD0); + LoadPalette(GetOverworldTextboxPalettePtr(), 0xE0, 0x20); + LoadPalette(gUnknown_0860F074, 0xF0, 0x20); +} + +void sub_81B2428(bool8 a) +{ + u8 firstWindowId; + u8 windowId; + u8 offset; + u8 mainOffset; + + if (gUnknown_0203CEC8.unk8_0 != 5) + { + if (a == TRUE) + { + firstWindowId = AddWindow(&gUnknown_08615918); + FillWindowPixelBuffer(firstWindowId, 0); + mainOffset = GetStringCenterAlignXOffset(0, gMenuText_Confirm, 48); + AddTextPrinterParameterized4(firstWindowId, 0, mainOffset, 1, 0, 0, gUnknown_086157FC[0], -1, gMenuText_Confirm); + PutWindowTilemap(firstWindowId); + CopyWindowToVram(firstWindowId, 2); + windowId = AddWindow(&gUnknown_08615910); + offset = 0; + } + else + { + windowId = AddWindow(&gUnknown_08615908); + offset = 3; + } + FillWindowPixelBuffer(windowId, 0); + if (gUnknown_0203CEC8.unk8_0 != 10) + { + mainOffset = GetStringCenterAlignXOffset(0, gText_Cancel, 48); + AddTextPrinterParameterized3(windowId, 0, mainOffset + offset, 1, gUnknown_086157FC[0], -1, gText_Cancel); + } + else + { + mainOffset = GetStringCenterAlignXOffset(0, gText_Cancel2, 48); + AddTextPrinterParameterized3(windowId, 0, mainOffset + offset, 1, gUnknown_086157FC[0], -1, gText_Cancel2); + } + PutWindowTilemap(windowId); + CopyWindowToVram(windowId, 2); + schedule_bg_copy_tilemap_to_vram(0); + } +} + +u16* sub_81B2564(u8 a) +{ + return &gUnknown_0203CEC4->unk18[a]; +} + +void sub_81B2578(u8 windowId, u8 *b, u8 c, u8 x, u8 y, u8 width, u8 height) +{ + u8 *pixels = AllocZeroed(height * width * 32); + u8 i, j; + + if (pixels != NULL) + { + for (i = 0; i < height; i++) + { + for (j = 0; j < width; j++) + CpuCopy16(sub_81B0DD4(b[x + j + ((y + i) * c)]), &pixels[(i * width + j) * 32], 32); + } + BlitBitmapToWindow(windowId, pixels, x * 8, y * 8, width * 8, height * 8); + Free(pixels); + } +} + +void sub_81B2658(u8 windowId, u8 x, u8 y, u8 width, u8 height, u8 f) +{ + if (width == 0 && height == 0) + { + width = 10; + height = 7; + } + if (f == 0) + sub_81B2578(windowId, gUnknown_08615988, 10, x, y, width, height); + else + sub_81B2578(windowId, gUnknown_086159CE, 10, x, y, width, height); +} + +void sub_81B26BC(u8 windowId, u8 x, u8 y, u8 width, u8 height, u8 f) +{ + if (width == 0 && height == 0) + { + width = 18; + height = 3; + } + if (f == 0) + sub_81B2578(windowId, gUnknown_08615A14, 18, x, y, width, height); + else + sub_81B2578(windowId, gUnknown_08615A4A, 18, x, y, width, height); +} + +void sub_81B2720(u8 windowId) +{ + sub_81B2578(windowId, gUnknown_08615A80, 18, 0, 0, 18, 3); +} + +void sub_81B2748(struct Unk_203CEDC *ptr, u8 bitfield) +{ + u8 palNum = GetWindowAttribute(ptr->unk8, WINDOW_PALETTE_NUM) * 16; + + if (0x40 & bitfield) + { + LoadPalette(sub_81B2564(gUnknown_08615AF1[0]), gUnknown_08615AC0[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AF1[1]), gUnknown_08615AC0[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AF1[2]), gUnknown_08615AC0[2] + palNum, 2); + } + else if (0x20 & bitfield) + { + if (1 & bitfield) + { + LoadPalette(sub_81B2564(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); + } + else + { + LoadPalette(sub_81B2564(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEE[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEE[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEE[2]), gUnknown_08615ABD[2] + palNum, 2); + } + } + else if (0x10 & bitfield) + { + LoadPalette(sub_81B2564(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEE[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEE[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEE[2]), gUnknown_08615ABD[2] + palNum, 2); + } + else if (4 & bitfield) + { + if (1 & bitfield) + { + LoadPalette(sub_81B2564(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); + } + else + { + LoadPalette(sub_81B2564(gUnknown_08615ADF[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADF[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEE[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEE[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEE[2]), gUnknown_08615ABD[2] + palNum, 2); + } + } + else if (2 & bitfield) + { + if (1 & bitfield) + { + LoadPalette(sub_81B2564(gUnknown_08615ADC[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADC[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ADC[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); + } + else + { + LoadPalette(sub_81B2564(gUnknown_08615AD3[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AD3[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AD3[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AE8[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AE8[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AE8[2]), gUnknown_08615ABD[2] + palNum, 2); + } + } + else if (8 & bitfield) + { + if (1 & bitfield) + { + LoadPalette(sub_81B2564(gUnknown_08615AD9[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AD9[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AD9[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); + } + else + { + LoadPalette(sub_81B2564(gUnknown_08615AD0[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AD0[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AD0[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AE5[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AE5[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AE5[2]), gUnknown_08615ABD[2] + palNum, 2); + } + } + else if (1 & bitfield) + { + LoadPalette(sub_81B2564(gUnknown_08615AD6[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AD6[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AD6[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AEB[2]), gUnknown_08615ABD[2] + palNum, 2); + } + else + { + LoadPalette(sub_81B2564(gUnknown_08615ACD[0]), gUnknown_08615ABA[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ACD[1]), gUnknown_08615ABA[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ACD[2]), gUnknown_08615ABA[2] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AE2[0]), gUnknown_08615ABD[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AE2[1]), gUnknown_08615ABD[1] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AE2[2]), gUnknown_08615ABD[2] + palNum, 2); + } +} + +void sub_81B2A3C(u8 windowId, const u8 *str, u8 color, u8 *ptr) +{ + AddTextPrinterParameterized3(windowId, 0, ptr[0], ptr[1], gUnknown_086157FC[color], 0, str); +} + +void sub_81B2A70(struct Pokemon *mon, struct Unk_203CEDC *ptr, u8 c) +{ + u8 nickname[POKEMON_NAME_LENGTH + 1]; + + if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) + { + if (c == 1) + ptr->unk0->unk0(ptr->unk8, ptr->unk0->unk4[0] >> 3, ptr->unk0->unk4[1] >> 3, ptr->unk0->unk4[2] >> 3, ptr->unk0->unk4[3] >> 3, 0); + GetMonNickname(mon, nickname); + sub_81B2A3C(ptr->unk8, nickname, 0, ptr->unk0->unk4); + } +} + +void sub_81B2AC8(struct Pokemon *mon, struct Unk_203CEDC *ptr, u8 c) +{ + if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) + { + u8 ailment = sub_81B205C(mon); + if (ailment == AILMENT_NONE || ailment == AILMENT_PKRS) + { + if (c != 0) + ptr->unk0->unk0(ptr->unk8, ptr->unk0->unk4[4] >> 3, (ptr->unk0->unk4[5] >> 3) + 1, ptr->unk0->unk4[6] >> 3, ptr->unk0->unk4[7] >> 3, 0); + if (c != 2) + sub_81B2B40(GetMonData(mon, MON_DATA_LEVEL), ptr); + } + } +} + +void sub_81B2B40(u8 level, struct Unk_203CEDC *ptr) +{ + ConvertIntToDecimalStringN(gStringVar2, level, 0, 3); + StringCopy(gStringVar1, gText_LevelSymbol); + StringAppend(gStringVar1, gStringVar2); + sub_81B2A3C(ptr->unk8, gStringVar1, 0, &ptr->unk0->unk4[4]); +} + +void sub_81B2B8C(struct Pokemon *mon, struct Unk_203CEDC *ptr, u8 c) +{ + u8 nickname[POKEMON_NAME_LENGTH + 1]; + + if (c == 1) + ptr->unk0->unk0(ptr->unk8, ptr->unk0->unk4[8] >> 3, (ptr->unk0->unk4[9] >> 3) + 1, ptr->unk0->unk4[10] >> 3, ptr->unk0->unk4[11] >> 3, 0); + GetMonNickname(mon, nickname); + sub_81B2BF4(GetMonGender(mon), GetMonData(mon, MON_DATA_SPECIES), nickname, ptr); +} + +void sub_81B2BF4(u8 gender, u16 species, u8 *nickname, struct Unk_203CEDC *ptr) +{ + u8 palNum = GetWindowAttribute(ptr->unk8, WINDOW_PALETTE_NUM) * 16; + + if (species == SPECIES_NONE) + return; + if (species == SPECIES_NIDORAN_M || species == SPECIES_NIDORAN_F) + { + if (StringCompare(nickname, gSpeciesNames[species]) == 0) + return; + } + switch (gender) + { + case MON_MALE: + LoadPalette(sub_81B2564(gUnknown_08615AC3[0]), gUnknown_08615AB6[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AC3[1]), gUnknown_08615AB6[1] + palNum, 2); + sub_81B2A3C(ptr->unk8, gText_MaleSymbol, 2, &ptr->unk0->unk4[8]); + break; + case MON_FEMALE: + LoadPalette(sub_81B2564(gUnknown_08615AC5[0]), gUnknown_08615AB6[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AC5[1]), gUnknown_08615AB6[1] + palNum, 2); + sub_81B2A3C(ptr->unk8, gText_FemaleSymbol, 2, &ptr->unk0->unk4[8]); + break; + } +} + +void sub_81B2CD4(struct Pokemon *mon, struct Unk_203CEDC *ptr, u8 c) +{ + if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) + { + if (c != 0) + ptr->unk0->unk0(ptr->unk8, ptr->unk0->unk4[12] >> 3, (ptr->unk0->unk4[13] >> 3) + 1, ptr->unk0->unk4[14] >> 3, ptr->unk0->unk4[15] >> 3, 0); + if (c != 2) + sub_81B2D3C(GetMonData(mon, MON_DATA_HP), ptr); + } +} + +void sub_81B2D3C(u16 hp, struct Unk_203CEDC *ptr) +{ + u8 *strOut = ConvertIntToDecimalStringN(gStringVar1, hp, 1, 3); + + strOut[0] = CHAR_SLASH; + strOut[1] = EOS; + + sub_81B2A3C(ptr->unk8, gStringVar1, 0, &ptr->unk0->unk4[12]); +} + +void sub_81B2D74(struct Pokemon *mon, struct Unk_203CEDC *ptr, u8 c) +{ + if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) + { + if (c != 0) + ptr->unk0->unk0(ptr->unk8, (ptr->unk0->unk4[16] >> 3) + 1, (ptr->unk0->unk4[17] >> 3) + 1, ptr->unk0->unk4[18] >> 3, ptr->unk0->unk4[19] >> 3, 0); + if (c != 2) + sub_81B2DDC(GetMonData(mon, MON_DATA_MAX_HP), ptr); + } +} + +void sub_81B2DDC(u16 maxhp, struct Unk_203CEDC *ptr) +{ + ConvertIntToDecimalStringN(gStringVar2, maxhp, 1, 3); + StringCopy(gStringVar1, gText_Slash); + StringAppend(gStringVar1, gStringVar2); + sub_81B2A3C(ptr->unk8, gStringVar1, 0, &ptr->unk0->unk4[16]); +} + +void sub_81B2E28(struct Pokemon *mon, struct Unk_203CEDC *ptr) +{ + if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE) + sub_81B2E64(GetMonData(mon, MON_DATA_HP), GetMonData(mon, MON_DATA_MAX_HP), ptr); +} + +void sub_81B2E64(u16 hp, u16 maxhp, struct Unk_203CEDC *ptr) +{ + u8 palNum = GetWindowAttribute(ptr->unk8, WINDOW_PALETTE_NUM) * 16; + u8 hpFraction; + + switch (GetHPBarLevel(hp, maxhp)) + { + case 3: + case 4: + LoadPalette(sub_81B2564(gUnknown_08615AC7[0]), gUnknown_08615AB8[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AC7[1]), gUnknown_08615AB8[1] + palNum, 2); + break; + case 2: + LoadPalette(sub_81B2564(gUnknown_08615AC9[0]), gUnknown_08615AB8[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615AC9[1]), gUnknown_08615AB8[1] + palNum, 2); + break; + default: + LoadPalette(sub_81B2564(gUnknown_08615ACB[0]), gUnknown_08615AB8[0] + palNum, 2); + LoadPalette(sub_81B2564(gUnknown_08615ACB[1]), gUnknown_08615AB8[1] + palNum, 2); + break; + } + + hpFraction = GetScaledHPFraction(hp, maxhp, ptr->unk0->unk4[22]); + FillWindowPixelRect(ptr->unk8, gUnknown_08615AB8[1], ptr->unk0->unk4[20], ptr->unk0->unk4[21], hpFraction, 1); + FillWindowPixelRect(ptr->unk8, gUnknown_08615AB8[0], ptr->unk0->unk4[20], ptr->unk0->unk4[21] + 1, hpFraction, 2); + if (hpFraction != ptr->unk0->unk4[22]) + { + FillWindowPixelRect(ptr->unk8, 13, ptr->unk0->unk4[20] + hpFraction, ptr->unk0->unk4[21], ptr->unk0->unk4[22] - hpFraction, 1); + FillWindowPixelRect(ptr->unk8, 2, ptr->unk0->unk4[20] + hpFraction, ptr->unk0->unk4[21] + 1, ptr->unk0->unk4[22] - hpFraction, 2); + } + CopyWindowToVram(ptr->unk8, 2); +} + +#ifdef NONMATCHING +void sub_81B2FA8(u8 stringID, struct Unk_203CEDC *ptr, u8 c) +{ + if (c != 0) + { + int unk = ((ptr->unk0->unk1C & 7) + ptr->unk0->unk1E + 7) / 8; + int unk2 = ((ptr->unk0->unk1D & 7) + ptr->unk0->unk1F + 7) / 8; + ptr->unk0->unk0(ptr->unk8, ptr->unk0->unk1C >> 3, ptr->unk0->unk1D >> 3, unk, unk2, 1); + } + if (c != 2) + AddTextPrinterParameterized3(ptr->unk8, 1, ptr->unk0->unk1C, ptr->unk0->unk1D, gUnknown_086157FC[0], 0, gUnknown_08615B60[stringID]); +} +#else +NAKED +void sub_81B2FA8(u8 stringID, struct Unk_203CEDC *ptr, u8 c) +{ + asm_unified("push {r4-r7,lr}\n\ + mov r7, r8\n\ + push {r7}\n\ + sub sp, 0xC\n\ + adds r6, r1, 0\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r8, r0\n\ + lsls r2, 24\n\ + lsrs r7, r2, 24\n\ + cmp r7, 0\n\ + beq _081B2FF2\n\ + ldr r5, [r6]\n\ + ldrb r1, [r5, 0x1C]\n\ + movs r4, 0x7\n\ + adds r0, r1, 0\n\ + ands r0, r4\n\ + ldrb r2, [r5, 0x1E]\n\ + adds r0, r2\n\ + adds r3, r0, 0x7\n\ + asrs r3, 3\n\ + ldrb r2, [r5, 0x1D]\n\ + adds r0, r2, 0\n\ + ands r0, r4\n\ + ldrb r4, [r5, 0x1F]\n\ + adds r0, r4\n\ + adds r4, r0, 0x7\n\ + ldrb r0, [r6, 0x8]\n\ + lsrs r1, 3\n\ + lsrs r2, 3\n\ + lsrs r4, 3\n\ + str r4, [sp]\n\ + movs r4, 0x1\n\ + str r4, [sp, 0x4]\n\ + ldr r4, [r5]\n\ + bl _call_via_r4\n\ +_081B2FF2:\n\ + cmp r7, 0x2\n\ + beq _081B3018\n\ + ldrb r0, [r6, 0x8]\n\ + ldr r1, [r6]\n\ + ldrb r2, [r1, 0x1C]\n\ + ldrb r3, [r1, 0x1D]\n\ + ldr r1, =gUnknown_086157FC\n\ + str r1, [sp]\n\ + movs r1, 0\n\ + str r1, [sp, 0x4]\n\ + ldr r4, =gUnknown_08615B60\n\ + mov r5, r8\n\ + lsls r1, r5, 2\n\ + adds r1, r4\n\ + ldr r1, [r1]\n\ + str r1, [sp, 0x8]\n\ + movs r1, 0x1\n\ + bl AddTextPrinterParameterized3\n\ +_081B3018:\n\ + add sp, 0xC\n\ + pop {r3}\n\ + mov r8, r3\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n"); +} +#endif + +void sub_81B302C(u8 *ptr) +{ + if (*ptr != 0xFF) + { + sub_8198070(*ptr, 0); + RemoveWindow(*ptr); + *ptr = 0xFF; + schedule_bg_copy_tilemap_to_vram(2); + } +} + +void display_pokemon_menu_message(u32 stringID) +{ + u8 *windowPtr = &gUnknown_0203CEC4->unkC[1]; + + if (*windowPtr != 0xFF) + sub_81B302C(windowPtr); + + if (stringID != 0x7F) + { + switch (stringID - 21) + { + case 0: + *windowPtr = AddWindow(&gUnknown_08615928); + break; + case 3: + *windowPtr = AddWindow(&gUnknown_08615930); + break; + case 4: + *windowPtr = AddWindow(&gUnknown_08615938); + break; + case 1: + case 2: + *windowPtr = AddWindow(&gUnknown_08615940); + break; + case 5: + *windowPtr = AddWindow(&gUnknown_08615948); + break; + default: + *windowPtr = AddWindow(&gUnknown_08615920); + break; + } + if (stringID == 0) + { + if (gUnknown_0203CEC4->unk8_0 != FALSE) + stringID = 2; + else if (sub_81B314C() == FALSE) + stringID = 1; + } + SetWindowBorderStyle(*windowPtr, 0, 0x4F, 0xD); + StringExpandPlaceholders(gStringVar4, gUnknown_08615AF4[stringID]); + AddTextPrinterParameterized(*windowPtr, 1, gStringVar4, 0, 1, 0, 0); + schedule_bg_copy_tilemap_to_vram(2); + } +} + +bool8 sub_81B314C(void) +{ + struct Pokemon *party = gPlayerParty; + u8 i; + u8 j = 0; + + if (gUnknown_0203CEC8.unkB == 1) + return TRUE; + + for (i = 0; i < 6; i++) + { + if (GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE) + { + if (GetMonData(&party[i], MON_DATA_HP) != 0 || GetMonData(&party[i], MON_DATA_IS_EGG) != FALSE) + j++; + } + if (j > 1) + return TRUE; + } + return FALSE; +}