diff --git a/asm/party_menu.s b/asm/party_menu.s index f8b75c0361..f5ed314ce2 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -5,1520 +5,6 @@ .text - thumb_func_start sub_81B0A10 -sub_81B0A10: @ 81B0A10 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - movs r1, 0x64 - adds r2, r0, 0 - muls r2, r1 - ldr r1, =gPlayerParty - adds r6, r2, r1 - ldr r7, =gUnknown_0203CEDC - ldr r1, [r7] - lsls r5, r0, 4 - adds r1, r5, r1 - ldr r2, [r1] - ldrb r0, [r1, 0x8] - movs r1, 0 - str r1, [sp] - movs r1, 0x1 - str r1, [sp, 0x4] - ldr r4, [r2] - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl _call_via_r4 - ldr r1, [r7] - adds r1, r5 - adds r0, r6, 0 - movs r2, 0 - bl sub_81B2A70 - adds r0, r6, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - bne _081B0A7C - ldr r1, [r7] - adds r1, r5 - adds r0, r6, 0 - movs r2, 0 - bl sub_81B2AC8 - ldr r1, [r7] - adds r1, r5 - adds r0, r6, 0 - movs r2, 0 - bl sub_81B2B8C -_081B0A7C: - ldr r1, [r7] - adds r1, r5 - mov r0, r8 - movs r2, 0 - bl sub_81B2FA8 - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B0A10 - - thumb_func_start sub_81B0A9C -sub_81B0A9C: @ 81B0A9C - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - ldr r6, =gUnknown_0203CEF8 - bl sub_81B85AC - lsls r0, 24 - cmp r0, 0 - bne _081B0AD6 - adds r0, r5, 0 - movs r1, 0x7 - bl sub_81B0A10 - b _081B0B02 - .pool -_081B0AC8: - adds r1, r4, 0x2 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl sub_81B0A10 - b _081B0B02 -_081B0AD6: - movs r4, 0 - b _081B0AEE -_081B0ADA: - adds r1, r6, r4 - ldrb r0, [r1] - cmp r0, 0 - beq _081B0AE8 - subs r0, 0x1 - cmp r0, r5 - beq _081B0AC8 -_081B0AE8: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_081B0AEE: - bl sub_81B8830 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bcc _081B0ADA - adds r0, r5, 0 - movs r1, 0x1 - bl sub_81B0A10 -_081B0B02: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81B0A9C - - thumb_func_start sub_81B0B08 -sub_81B0B08: @ 81B0B08 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - bl sub_80DAE0C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bhi _081B0B5A - lsls r0, 2 - ldr r1, =_081B0B34 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081B0B34: - .4byte _081B0B48 - .4byte _081B0B52 - .4byte _081B0B52 - .4byte _081B0B48 - .4byte _081B0B48 -_081B0B48: - adds r0, r4, 0 - movs r1, 0x7 - bl sub_81B0A10 - b _081B0B5A -_081B0B52: - adds r0, r4, 0 - movs r1, 0x6 - bl sub_81B0A10 -_081B0B5A: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B0B08 - - thumb_func_start sub_81B0B60 -sub_81B0B60: @ 81B0B60 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - bl GetNumberOfRelearnableMoves - lsls r0, 24 - cmp r0, 0 - bne _081B0B88 - adds r0, r4, 0 - movs r1, 0x9 - bl sub_81B0A10 - b _081B0B90 - .pool -_081B0B88: - adds r0, r4, 0 - movs r1, 0x8 - bl sub_81B0A10 -_081B0B90: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B0B60 - - thumb_func_start sub_81B0B98 -sub_81B0B98: @ 81B0B98 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl sub_81B218C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B0BB6 - adds r0, r4, 0 - movs r1, 0x6 - bl sub_81B0A10 - b _081B0BBE -_081B0BB6: - adds r0, r4, 0 - movs r1, 0x7 - bl sub_81B0A10 -_081B0BBE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B0B98 - - thumb_func_start sub_81B0BC4 -sub_81B0BC4: @ 81B0BC4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xC - bl GetMonData - cmp r0, 0 - beq _081B0BEC - adds r0, r4, 0 - movs r1, 0xB - bl sub_81B0A10 - b _081B0BF4 - .pool -_081B0BEC: - adds r0, r4, 0 - movs r1, 0xC - bl sub_81B0A10 -_081B0BF4: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B0BC4 - - thumb_func_start sub_81B0BFC -sub_81B0BFC: @ 81B0BFC - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r6, r1, r0 - ldr r0, =gSpecialVar_ItemId - ldrh r4, [r0] - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0xB] - cmp r0, 0xC - bne _081B0C40 - ldr r1, =gSpecialVar_Result - movs r0, 0 - strh r0, [r1] - ldr r0, =gSpecialVar_0x8005 - ldrb r2, [r0] - adds r0, r5, 0 - movs r1, 0 - bl sub_81B0C94 - b _081B0C8A - .pool -_081B0C40: - cmp r0, 0x3 - bne _081B0C56 - adds r0, r4, 0 - bl CheckIfItemIsTMHMOrEvolutionStone - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B0C5A - cmp r0, 0x2 - beq _081B0C66 -_081B0C56: - movs r0, 0 - b _081B0C8C -_081B0C5A: - adds r0, r5, 0 - adds r1, r4, 0 - movs r2, 0 - bl sub_81B0C94 - b _081B0C8A -_081B0C66: - adds r0, r6, 0 - movs r1, 0x2D - bl GetMonData - cmp r0, 0 - bne _081B0C82 - adds r0, r6, 0 - movs r1, 0x3 - adds r2, r4, 0 - bl GetEvolutionTargetSpecies - lsls r0, 16 - cmp r0, 0 - bne _081B0C56 -_081B0C82: - adds r0, r5, 0 - movs r1, 0 - bl sub_81B0A10 -_081B0C8A: - movs r0, 0x1 -_081B0C8C: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_81B0BFC - - thumb_func_start sub_81B0C94 -sub_81B0C94: @ 81B0C94 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 16 - lsrs r1, 16 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x64 - muls r0, r4 - ldr r3, =gPlayerParty - adds r0, r3 - bl sub_81B22D8 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - beq _081B0CD2 - cmp r0, 0x2 - bgt _081B0CC4 - cmp r0, 0x1 - beq _081B0CC8 - b _081B0CDC - .pool -_081B0CC4: - cmp r0, 0x3 - bne _081B0CDC -_081B0CC8: - adds r0, r4, 0 - movs r1, 0x9 - bl sub_81B0A10 - b _081B0CE4 -_081B0CD2: - adds r0, r4, 0 - movs r1, 0xA - bl sub_81B0A10 - b _081B0CE4 -_081B0CDC: - adds r0, r4, 0 - movs r1, 0x8 - bl sub_81B0A10 -_081B0CE4: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81B0C94 - - thumb_func_start sub_81B0CEC -sub_81B0CEC: @ 81B0CEC - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203CEDC - lsls r2, r0, 4 - ldr r1, [r1] - adds r6, r1, r2 - subs r0, 0x3 - lsls r0, 24 - ldr r5, =gUnknown_02022FF8 - lsrs r0, 19 - mov r8, r0 - adds r7, r0, r5 - ldrh r0, [r7] - cmp r0, 0 - bne _081B0D24 - ldrb r0, [r6, 0x8] - bl sub_81B2720 - b _081B0D8E - .pool -_081B0D24: - ldr r2, [r6] - ldrb r0, [r6, 0x8] - movs r1, 0 - str r1, [sp] - str r1, [sp, 0x4] - ldr r4, [r2] - movs r2, 0 - movs r3, 0 - bl _call_via_r4 - ldr r4, =gStringVar1 - adds r5, 0x4 - add r5, r8 - adds r0, r4, 0 - adds r1, r5, 0 - bl StringCopy - adds r0, r4, 0 - bl StringGetEnd10 - adds r0, r4, 0 - bl sub_81DB52C - ldrb r0, [r6, 0x8] - ldr r3, [r6] - adds r3, 0x4 - adds r1, r4, 0 - movs r2, 0 - bl sub_81B2A3C - ldrb r0, [r7, 0xF] - adds r1, r6, 0 - bl sub_81B2B40 - ldrb r0, [r7, 0x1C] - ldrh r1, [r7] - adds r2, r5, 0 - adds r3, r6, 0 - bl sub_81B2BF4 - ldrh r0, [r7, 0x10] - adds r1, r6, 0 - bl sub_81B2D3C - ldrh r0, [r7, 0x12] - adds r1, r6, 0 - bl sub_81B2DDC - ldrh r0, [r7, 0x10] - ldrh r1, [r7, 0x12] - adds r2, r6, 0 - bl sub_81B2E64 -_081B0D8E: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B0CEC - - thumb_func_start sub_81B0DA0 -sub_81B0DA0: @ 81B0DA0 - push {r4,r5,lr} - ldr r5, =gUnknown_0203CEC4 - ldr r0, [r5] - movs r4, 0x86 - lsls r4, 2 - adds r0, r4 - ldrb r0, [r0] - bl sub_81B07E0 - ldr r1, [r5] - adds r1, r4 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x6 - beq _081B0DCC - movs r0, 0 - b _081B0DCE - .pool -_081B0DCC: - movs r0, 0x1 -_081B0DCE: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81B0DA0 - - thumb_func_start sub_81B0DD4 -sub_81B0DD4: @ 81B0DD4 - lsls r0, 16 - ldr r1, =gUnknown_0203CEE0 - lsrs r0, 11 - ldr r1, [r1] - adds r1, r0 - adds r0, r1, 0 - bx lr - .pool - thumb_func_end sub_81B0DD4 - - thumb_func_start party_menu_add_per_mon_objects_internal -party_menu_add_per_mon_objects_internal: @ 81B0DE8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gUnknown_0203CEC8 - ldrb r1, [r0, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x5 - bne _081B0E98 - cmp r7, 0x2 - bls _081B0E98 - subs r0, r7, 0x3 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - ldr r0, =gUnknown_02022FF8 - mov r9, r0 - mov r2, r10 - lsls r2, 5 - mov r8, r2 - mov r6, r8 - add r6, r9 - ldrh r0, [r6] - cmp r0, 0 - beq _081B0EDC - mov r1, r9 - adds r1, 0x18 - add r1, r8 - ldr r1, [r1] - ldr r4, =gUnknown_0203CEDC - lsls r5, r7, 4 - ldr r2, [r4] - adds r2, r5 - movs r3, 0 - str r3, [sp] - bl party_menu_link_mon_icon_anim - ldrh r0, [r6] - ldrh r1, [r6, 0x2] - ldr r2, [r4] - adds r2, r5 - bl party_menu_link_mon_held_item_object - ldrh r0, [r6] - ldr r1, [r4] - adds r1, r5 - bl party_menu_link_mon_pokeball_object - ldrh r0, [r6, 0x10] - cmp r0, 0 - bne _081B0E68 - movs r3, 0x7 - b _081B0E78 - .pool -_081B0E68: - mov r0, r9 - adds r0, 0x14 - add r0, r8 - ldr r0, [r0] - bl pokemon_ailments_get_primary - lsls r0, 24 - lsrs r3, r0, 24 -_081B0E78: - ldr r1, =gUnknown_02022FF8 - mov r2, r10 - lsls r0, r2, 5 - adds r0, r1 - ldrh r0, [r0] - ldr r1, =gUnknown_0203CEDC - ldr r2, [r1] - adds r2, r5 - adds r1, r3, 0 - bl party_menu_link_mon_status_condition_object - b _081B0EDC - .pool -_081B0E98: - movs r0, 0x64 - adds r1, r7, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r6, r1, r0 - adds r0, r6, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B0EDC - ldr r4, =gUnknown_0203CEDC - lsls r5, r7, 4 - ldr r1, [r4] - adds r1, r5 - adds r0, r6, 0 - adds r2, r7, 0 - bl party_menu_icon_anim - ldr r1, [r4] - adds r1, r5 - adds r0, r6, 0 - bl party_menu_held_item_object - ldr r1, [r4] - adds r1, r5 - adds r0, r6, 0 - bl party_menu_pokeball_object - ldr r1, [r4] - adds r1, r5 - adds r0, r6, 0 - bl party_menu_status_condition_object -_081B0EDC: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end party_menu_add_per_mon_objects_internal - - thumb_func_start party_menu_add_per_mon_objects -party_menu_add_per_mon_objects: @ 81B0EF4 - push {r4,r5,lr} - ldr r5, =gUnknown_0203CEC4 - ldr r0, [r5] - movs r4, 0x86 - lsls r4, 2 - adds r0, r4 - ldrb r0, [r0] - bl party_menu_add_per_mon_objects_internal - ldr r1, [r5] - adds r1, r4 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x6 - beq _081B0F20 - movs r0, 0 - b _081B0F22 - .pool -_081B0F20: - movs r0, 0x1 -_081B0F22: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end party_menu_add_per_mon_objects - - thumb_func_start sub_81B0F28 -sub_81B0F28: @ 81B0F28 - push {r4,lr} - sub sp, 0xC - ldr r0, =gUnknown_0203CEC8 - ldrb r1, [r0, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x5 - bne _081B0F54 - movs r0, 0x7 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r1, 0xE - movs r2, 0x17 - movs r3, 0x11 - bl FillBgTilemapBufferRect - b _081B0FBC - .pool -_081B0F54: - ldr r4, =gUnknown_0203CEC4 - ldr r0, [r4] - ldrb r0, [r0, 0x8] - lsls r0, 31 - cmp r0, 0 - beq _081B0F94 - movs r0, 0xBF - movs r1, 0x88 - bl sub_81B5F74 - ldr r3, [r4] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x7F - ands r0, r1 - lsls r0, 4 - ldrh r2, [r3, 0x8] - ldr r1, =0xfffff80f - ands r1, r2 - orrs r1, r0 - strh r1, [r3, 0x8] - bl sub_81B120C - movs r0, 0xBF - movs r1, 0x98 - bl sub_81B5F74 - b _081B0F9C - .pool -_081B0F94: - movs r0, 0xC6 - movs r1, 0x94 - bl sub_81B5F34 -_081B0F9C: - ldr r3, [r4] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x7F - ands r0, r1 - lsls r0, 11 - ldr r1, [r3, 0x8] - ldr r2, =0xfffc07ff - ands r1, r2 - orrs r1, r0 - str r1, [r3, 0x8] - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0x9] - movs r1, 0x1 - bl sub_81B0FCC -_081B0FBC: - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B0F28 - - thumb_func_start sub_81B0FCC -sub_81B0FCC: @ 81B0FCC - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r7, r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - cmp r7, 0x6 - beq _081B1038 - cmp r7, 0x7 - beq _081B1074 - movs r0, 0x64 - muls r0, r7 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - beq _081B10E8 - ldr r6, =gUnknown_0203CEDC - lsls r5, r7, 4 - ldr r4, [r6] - adds r4, r5 - adds r0, r7, 0 - mov r1, r8 - bl sub_81B10F8 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_81B2748 - ldr r0, [r6] - adds r0, r5, r0 - ldrb r0, [r0, 0x9] - mov r1, r8 - bl sub_81B5B6C - ldr r0, [r6] - adds r5, r0 - ldrb r0, [r5, 0xB] - mov r1, r8 - bl sub_81B5F98 - b _081B10E8 - .pool -_081B1038: - mov r0, r8 - cmp r0, 0 - bne _081B1052 - movs r0, 0x2 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r1, 0x17 - movs r2, 0x10 - movs r3, 0x7 - bl sub_8199C30 - b _081B1064 -_081B1052: - movs r0, 0x2 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x1 - movs r1, 0x17 - movs r2, 0x10 - movs r3, 0x7 - bl sub_8199C30 -_081B1064: - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrh r0, [r0, 0x8] - lsls r0, 21 - b _081B10DA - .pool -_081B1074: - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 31 - cmp r0, 0 - bne _081B10A6 - mov r0, r8 - cmp r0, 0 - bne _081B1098 - movs r0, 0x2 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r1, 0x17 - movs r2, 0x11 - b _081B10B8 - .pool -_081B1098: - movs r0, 0x2 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x1 - movs r1, 0x17 - movs r2, 0x11 - b _081B10B8 -_081B10A6: - mov r0, r8 - cmp r0, 0 - bne _081B10C0 - movs r0, 0x2 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r1, 0x17 - movs r2, 0x12 -_081B10B8: - movs r3, 0x7 - bl sub_8199C30 - b _081B10D2 -_081B10C0: - movs r0, 0x2 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x1 - movs r1, 0x17 - movs r2, 0x12 - movs r3, 0x7 - bl sub_8199C30 -_081B10D2: - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldr r0, [r0, 0x8] - lsls r0, 14 -_081B10DA: - lsrs r0, 25 - mov r1, r8 - bl sub_81B5F98 - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram -_081B10E8: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B0FCC - - thumb_func_start sub_81B10F8 -sub_81B10F8: @ 81B10F8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - lsrs r1, 24 - movs r4, 0 - cmp r1, 0x1 - bne _081B110A - movs r4, 0x1 -_081B110A: - movs r0, 0x64 - muls r0, r5 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - bne _081B1120 - movs r0, 0x2 - orrs r4, r0 -_081B1120: - adds r0, r5, 0 - bl sub_81B118C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081B1136 - movs r0, 0x8 - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_081B1136: - ldr r0, =gUnknown_0203CEC8 - ldrb r1, [r0, 0xB] - adds r2, r0, 0 - cmp r1, 0x9 - bne _081B1148 - movs r0, 0x10 - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_081B1148: - cmp r1, 0x8 - bne _081B1164 - movs r0, 0x9 - ldrsb r0, [r2, r0] - cmp r5, r0 - beq _081B115C - movs r0, 0xA - ldrsb r0, [r2, r0] - cmp r5, r0 - bne _081B1164 -_081B115C: - movs r0, 0x4 - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_081B1164: - ldrb r0, [r2, 0xB] - cmp r0, 0xA - bne _081B117A - movs r0, 0x9 - ldrsb r0, [r2, r0] - cmp r5, r0 - bne _081B117A - movs r0, 0x20 - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 -_081B117A: - adds r0, r4, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B10F8 - - thumb_func_start sub_81B118C -sub_81B118C: @ 81B118C - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gUnknown_0203CEC8 - ldrb r1, [r0, 0x8] - movs r0, 0x30 - ands r0, r1 - cmp r0, 0x20 - bne _081B11B4 - cmp r2, 0x1 - beq _081B11AA - cmp r2, 0x4 - beq _081B11AA - cmp r2, 0x5 - bne _081B11B4 -_081B11AA: - movs r0, 0x1 - b _081B11F8 - .pool -_081B11B4: - cmp r2, 0x2 - bhi _081B11F6 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 11 - ands r0, r1 - cmp r0, 0 - beq _081B11F6 - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081B11F6 - adds r0, r2, 0 - bl sub_81B8F38 - ldr r1, =gBattleStruct - ldr r1, [r1] - movs r2, 0xA8 - lsls r2, 2 - adds r1, r2 - ldrb r1, [r1] - lsls r0, 24 - lsrs r0, 24 - asrs r1, r0 - movs r0, 0x1 - ands r1, r0 - cmp r1, 0 - bne _081B11F8 -_081B11F6: - movs r0, 0 -_081B11F8: - pop {r1} - bx r1 - .pool - thumb_func_end sub_81B118C - - thumb_func_start sub_81B120C -sub_81B120C: @ 81B120C - push {r4-r6,lr} - sub sp, 0xC - ldr r1, =gUnknown_086157C4 - movs r6, 0x7 - str r6, [sp] - movs r5, 0x2 - str r5, [sp, 0x4] - movs r4, 0x11 - str r4, [sp, 0x8] - movs r0, 0x1 - movs r2, 0x17 - movs r3, 0x10 - bl CopyToBgTilemapBufferRect_ChangePalette - ldr r1, =gUnknown_086157E0 - str r6, [sp] - str r5, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x1 - movs r2, 0x17 - movs r3, 0x12 - bl CopyToBgTilemapBufferRect_ChangePalette - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B120C - - thumb_func_start sub_81B1250 -sub_81B1250: @ 81B1250 - push {lr} - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x49 - ands r0, r1 - cmp r0, 0x49 - bne _081B1280 - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081B1280 - movs r0, 0x1 - b _081B1282 - .pool -_081B1280: - movs r0, 0 -_081B1282: - pop {r1} - bx r1 - thumb_func_end sub_81B1250 - - thumb_func_start sub_81B1288 -sub_81B1288: @ 81B1288 - push {r4-r6,lr} - adds r4, r0, 0 - adds r6, r1, 0 - movs r0, 0x64 - bl Alloc - adds r5, r0, 0 - adds r1, r4, 0 - movs r2, 0x64 - bl memcpy - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0x64 - bl memcpy - adds r0, r6, 0 - adds r1, r5, 0 - movs r2, 0x64 - bl memcpy - adds r0, r5, 0 - bl Free - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_81B1288 - - thumb_func_start sub_81B12C0 -sub_81B12C0: @ 81B12C0 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =c3_0811FAB4 - str r1, [r0] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B12C0 - - thumb_func_start c3_0811FAB4 -c3_0811FAB4: @ 81B12F8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081B134C - ldr r4, =gUnknown_0203CEC8 - ldrb r1, [r4, 0x8] - movs r0, 0xF - ands r0, r1 - cmp r0, 0x1 - bne _081B131A - bl sub_81B9080 -_081B131A: - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldr r0, [r0, 0x4] - cmp r0, 0 - beq _081B1338 - bl SetMainCallback2 - b _081B133E - .pool -_081B1338: - ldr r0, [r4] - bl SetMainCallback2 -_081B133E: - bl ResetSpriteData - bl sub_81B06F4 - adds r0, r5, 0 - bl DestroyTask -_081B134C: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end c3_0811FAB4 - - thumb_func_start GetCursorSelectionMonId -GetCursorSelectionMonId: @ 81B1354 - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0x9] - bx lr - .pool - thumb_func_end GetCursorSelectionMonId - - thumb_func_start sub_81B1360 -sub_81B1360: @ 81B1360 - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0x8] - lsls r0, 28 - lsrs r0, 28 - bx lr - .pool - thumb_func_end sub_81B1360 - - thumb_func_start sub_81B1370 -sub_81B1370: @ 81B1370 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r6, r5, 0 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081B13E0 - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B13E0 - bl sub_81B13EC - adds r4, r0, 0 - bl sub_81B1760 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2 - beq _081B13C0 - cmp r0, 0x2 - bgt _081B13B0 - cmp r0, 0x1 - beq _081B13B6 - b _081B13E0 - .pool -_081B13B0: - cmp r0, 0x8 - beq _081B13CA - b _081B13E0 -_081B13B6: - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_81B140C - b _081B13E0 -_081B13C0: - adds r0, r6, 0 - adds r1, r4, 0 - bl sub_81B15D0 - b _081B13E0 -_081B13CA: - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - ldrb r0, [r0, 0x8] - lsls r0, 31 - cmp r0, 0 - beq _081B13E0 - movs r0, 0x5 - bl PlaySE - bl sub_81B4F88 -_081B13E0: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B1370 - - thumb_func_start sub_81B13EC -sub_81B13EC: @ 81B13EC - push {lr} - ldr r0, =gUnknown_0203CEC8 - ldrb r1, [r0, 0xB] - cmp r1, 0x8 - beq _081B13FA - cmp r1, 0xA - bne _081B1404 -_081B13FA: - adds r0, 0xA - b _081B1406 - .pool -_081B1404: - adds r0, 0x9 -_081B1406: - pop {r1} - bx r1 - thumb_func_end sub_81B13EC - - thumb_func_start sub_81B140C -sub_81B140C: @ 81B140C - push {r4,r5,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0x6 - bne _081B142C - ldr r0, =gUnknown_0203CEC8 - ldr r1, [r0, 0x4] - adds r0, r5, 0 - bl _call_via_r1 - b _081B159E - .pool -_081B142C: - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0xB] - subs r0, 0x3 - cmp r0, 0xA - bls _081B1438 - b _081B1592 -_081B1438: - lsls r0, 2 - ldr r1, =_081B144C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081B144C: - .4byte _081B149C - .4byte _081B1592 - .4byte _081B1538 - .4byte _081B1538 - .4byte _081B1510 - .4byte _081B1560 - .4byte _081B1592 - .4byte _081B1478 - .4byte _081B156E - .4byte _081B14E8 - .4byte _081B157C -_081B1478: - adds r0, r4, 0 - bl sub_81B15A4 - lsls r0, 24 - cmp r0, 0 - bne _081B1486 - b _081B159E -_081B1486: - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - adds r0, 0xD - bl sub_81B302C - adds r0, r5, 0 - bl sub_81615A8 - b _081B159E - .pool -_081B149C: - adds r0, r4, 0 - bl sub_81B15A4 - lsls r0, 24 - cmp r0, 0 - bne _081B14AA - b _081B159E -_081B14AA: - ldr r0, =gUnknown_0203CEC8 - ldrb r1, [r0, 0x8] - movs r0, 0xF - ands r0, r1 - ldr r2, =gUnknown_0203CEC4 - cmp r0, 0x1 - bne _081B14BE - ldr r1, [r2] - ldr r0, =sub_81B9140 - str r0, [r1, 0x4] -_081B14BE: - ldr r0, [r2] - adds r0, 0xD - bl sub_81B302C - ldr r0, =gUnknown_03006328 - ldr r1, =sub_81B6794 - ldr r2, [r0] - adds r0, r5, 0 - bl _call_via_r2 - b _081B159E - .pool -_081B14E8: - adds r0, r4, 0 - bl sub_81B15A4 - lsls r0, 24 - cmp r0, 0 - beq _081B159E - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - adds r0, 0xD - bl sub_81B302C - adds r0, r5, 0 - bl sub_81B7E4C - b _081B159E - .pool -_081B1510: - adds r0, r4, 0 - bl sub_81B15A4 - lsls r0, 24 - cmp r0, 0 - beq _081B159E - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - adds r0, 0xD - bl sub_81B302C - adds r0, r5, 0 - bl sub_81B8474 - b _081B159E - .pool -_081B1538: - adds r0, r4, 0 - bl sub_81B15A4 - lsls r0, 24 - cmp r0, 0 - beq _081B159E - movs r0, 0x5 - bl PlaySE - ldr r0, =gUnknown_0203CEC4 - ldr r0, [r0] - adds r0, 0xD - bl sub_81B302C - adds r0, r5, 0 - bl sub_81B7FAC - b _081B159E - .pool -_081B1560: - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - bl sub_81B3938 - b _081B159E -_081B156E: - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - bl sub_81B12C0 - b _081B159E -_081B157C: - adds r0, r4, 0 - bl sub_81B15A4 - lsls r0, 24 - cmp r0, 0 - beq _081B159E - ldrb r1, [r4] - adds r0, r5, 0 - bl sub_81B21AC - b _081B159E -_081B1592: - movs r0, 0x5 - bl PlaySE - adds r0, r5, 0 - bl sub_81B36FC -_081B159E: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81B140C - - thumb_func_start sub_81B15A4 -sub_81B15A4: @ 81B15A4 - push {lr} - ldrb r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2D - bl GetMonData - cmp r0, 0x1 - beq _081B15C4 - movs r0, 0x1 - b _081B15CC - .pool -_081B15C4: - movs r0, 0x20 - bl PlaySE - movs r0, 0 -_081B15CC: - pop {r1} - bx r1 - thumb_func_end sub_81B15A4 - - thumb_func_start sub_81B15D0 -sub_81B15D0: @ 81B15D0 - push {r4,r5,lr} - adds r5, r1, 0 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gUnknown_0203CEC8 - ldrb r0, [r0, 0xB] - cmp r0, 0x8 - beq _081B1602 - cmp r0, 0x8 - bgt _081B15F0 - cmp r0, 0x1 - beq _081B15FA - b _081B161E - .pool -_081B15F0: - cmp r0, 0xA - beq _081B1602 - cmp r0, 0xD - beq _081B1610 - b _081B161E -_081B15FA: - movs r0, 0x20 - bl PlaySE - b _081B1652 -_081B1602: - movs r0, 0x5 - bl PlaySE - adds r0, r4, 0 - bl sub_81B407C - b _081B1652 -_081B1610: - movs r0, 0x5 - bl PlaySE - adds r0, r4, 0 - bl sub_81B2210 - b _081B1652 -_081B161E: - movs r0, 0x5 - bl PlaySE - adds r0, r4, 0 - bl sub_81B1660 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081B1652 - bl sub_81221AC - lsls r0, 24 - cmp r0, 0 - bne _081B1642 - ldr r1, =gSpecialVar_0x8004 - movs r0, 0x7 - strh r0, [r1] -_081B1642: - ldr r0, =gUnknown_0203CEE8 - movs r1, 0 - strb r1, [r0] - movs r0, 0x7 - strb r0, [r5] - adds r0, r4, 0 - bl sub_81B12C0 -_081B1652: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81B15D0 - thumb_func_start sub_81B1660 sub_81B1660: @ 81B1660 push {r4-r6,lr} diff --git a/include/contest.h b/include/contest.h index d62d33ab70..f15a7310ec 100644 --- a/include/contest.h +++ b/include/contest.h @@ -427,5 +427,6 @@ bool8 Contest_IsMonsTurnDisabled(u8 a); bool8 sub_80DE1E8(u8 a); void SetStartledString(u8 a, u8 b); s8 Contest_GetMoveExcitement(u16); +u8 sub_80DAE0C(struct Pokemon *); #endif //GUARD_CONTEST_H diff --git a/include/fldeff_softboiled.h b/include/fldeff_softboiled.h new file mode 100755 index 0000000000..8579c6cfea --- /dev/null +++ b/include/fldeff_softboiled.h @@ -0,0 +1,6 @@ +#ifndef GUARD_FLDEFF_SOFTBOILED_H +#define GUARD_FLDEFF_SOFTBOILED_H + +void sub_81615A8(u8 taskId); + +#endif // GUARD_FLDEFF_SOFTBOILED_H diff --git a/include/party_menu.h b/include/party_menu.h index b93b78544c..a0a8bdbe6d 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -10,7 +10,8 @@ enum AILMENT_PRZ, AILMENT_SLP, AILMENT_FRZ, - AILMENT_BRN + AILMENT_BRN, + AILMENT_FNT = 7 }; enum @@ -23,13 +24,17 @@ enum PARTY_GIVE_ITEM, }; -struct Struct203CEC8 -{ - u8 filler[0x9]; +struct Struct203CEC8 { + MainCallback unk0; + TaskFunc unk4; + u8 unk8_0:4; + u8 unk8_1:2; + u8 unk8_2:2; s8 unk9; s8 unkA; u8 unkB; - u8 filler2[0x2]; + u8 unkD; + u8 unkE; }; extern struct Struct203CEC8 gUnknown_0203CEC8; @@ -47,7 +52,7 @@ void sub_81B7F60(void); void sub_81B0FCC(u8 partyIdx, u8 a); void sub_81B1370(u8 taskId); -void display_pokemon_menu_message(u8 windowId); +void display_pokemon_menu_message(u32 windowId); void sub_81B1F18(u8 taskId, u8 pokemonIdx, s8 a, s16 hp, TaskFunc func); void sub_81B1B5C(void *a, u8 b); u8 sub_81B1BD4(); @@ -62,14 +67,14 @@ void sub_81B617C(void); u8 sub_81B6D14(u16 a); bool8 hm_add_c3_without_phase_2(void); -extern void dp05_ether(u8, u16, TaskFunc); -extern void dp05_pp_up(u8, u16, TaskFunc); -extern void dp05_rare_candy(u8, u16, TaskFunc); +extern void dp05_ether(u8, TaskFunc); +extern void dp05_pp_up(u8, TaskFunc); +extern void dp05_rare_candy(u8, TaskFunc); -extern void sub_81B67C8(u8, u16, TaskFunc); -extern void sub_81B79E8(u8, u16, TaskFunc); -extern void sub_81B6DC4(u8, u16, TaskFunc); -extern void sub_81B7C74(u8, u16, TaskFunc); +extern void sub_81B67C8(u8, TaskFunc); +extern void sub_81B79E8(u8, TaskFunc); +extern void sub_81B6DC4(u8, TaskFunc); +extern void sub_81B7C74(u8, TaskFunc); extern u16 ItemIdToBattleMoveId(u16); #endif // GUARD_PARTY_MENU_H diff --git a/src/item_use.c b/src/item_use.c index 67bdabd879..601c2b81b5 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -38,7 +38,7 @@ #include "constants/vars.h" extern void(*gUnknown_0203A0F4)(u8 taskId); -extern void (*gUnknown_03006328)(u8, u16, TaskFunc); +extern void (*gUnknown_03006328)(u8, TaskFunc); extern void unknown_ItemMenu_Confirm(u8 taskId); extern void sub_81C5B14(u8 taskId); extern void ScriptUnfreezeEventObjects(void); @@ -52,7 +52,7 @@ extern u8 BattleFrontier_OutsideEast_EventScript_242CFC[]; extern int sub_80247BC(void); extern struct MapHeader* mapconnection_get_mapheader(struct MapConnection *connection); extern void SetUpItemUseCallback(u8 taskId); -extern void ItemUseCB_Medicine(u8, u16, TaskFunc); +extern void ItemUseCB_Medicine(u8, TaskFunc); extern void bag_menu_yes_no(u8, u8, const struct YesNoFuncTable*); extern void sub_81C5924(void); extern void sub_81C59BC(void); diff --git a/src/party_menu.c b/src/party_menu.c index 9b89474655..c15f0d59ce 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -1,20 +1,30 @@ #include "global.h" -#include "battle_main.h" +#include "battle.h" #include "bg.h" #include "constants/rgb.h" +#include "constants/songs.h" #include "constants/species.h" +#include "contest.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_menu.h" +#include "item_use.h" #include "main.h" #include "malloc.h" #include "menu.h" #include "menu_helpers.h" #include "palette.h" +#include "party_menu.h" #include "pokemon.h" #include "pokemon_icon.h" #include "scanline_effect.h" +#include "sound.h" #include "sprite.h" +#include "string_util.h" #include "task.h" #include "text.h" #include "window.h" @@ -26,7 +36,7 @@ struct Unk_Rodata1 { struct Unk_203CEC4 { TaskFunc unk0; - void *unk4; + MainCallback unk4; u32 unk8_0:1; u32 unk8_1:3; u32 unk8_2:7; @@ -39,17 +49,6 @@ struct Unk_203CEC4 { s16 unk218[16]; }; -struct Unk_203CEC8 { - MainCallback unk0; - u8 filler[4]; - u8 unk8_0:4; - u8 unk8_1:2; - u8 unk8_2:2; - s8 unk9; - u8 unkA; - u8 unkB; -}; - struct Unk_203CEDC { struct Unk_Rodata1 *unk0; u32 *unk4; @@ -67,10 +66,12 @@ struct Unk_203CEE4 { // BELOW TO BE PUT IN EWRAM extern struct Unk_203CEC4 *gUnknown_0203CEC4; -extern struct Unk_203CEC8 gUnknown_0203CEC8; +extern struct Struct203CEC8 gUnknown_0203CEC8; extern struct Unk_203CEDC *gUnknown_0203CEDC; extern u8 *gUnknown_0203CEE0; extern struct Unk_203CEE4 *gUnknown_0203CEE4; +extern u8 gUnknown_0203CEE8; +extern u8 gUnknown_0203CEF8[]; // ABOVE TO BE PUT IN EWRAM @@ -80,9 +81,13 @@ 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_086157C4[]; +extern u8 gUnknown_086157E0[]; // ABOVE TO BE CONVERTED TO C +extern void (*gUnknown_03006328)(u8, TaskFunc); + void reset_brm(void); void c2_811EBD0(void); bool8 sub_81B020C(void); @@ -120,6 +125,54 @@ void sub_81B2B8C(struct Pokemon *, struct Unk_203CEDC *, u8); void sub_81B2CD4(struct Pokemon *, struct Unk_203CEDC *, u8); void sub_81B2D74(struct Pokemon *, struct Unk_203CEDC *, u8); void sub_81B2E28(struct Pokemon *, struct Unk_203CEDC *); +void sub_81B2FA8(u8, struct Unk_203CEDC *, u8); +u8 sub_81B8830(void); +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_81B2B40(u8, struct Unk_203CEDC *); +void sub_81B2BF4(u8, u16, u8*, struct Unk_203CEDC *); +void sub_81B2D3C(u16, struct Unk_203CEDC *); +void sub_81B2DDC(u16, struct Unk_203CEDC *); +void sub_81B2E64(u16, u16, struct Unk_203CEDC *); +void party_menu_link_mon_icon_anim(u16, u32, struct Unk_203CEDC *, u8, u8); +void party_menu_link_mon_held_item_object(u16, u16, struct Unk_203CEDC *); +void party_menu_link_mon_pokeball_object(u16, struct Unk_203CEDC *); +void party_menu_link_mon_status_condition_object(u16, u8, struct Unk_203CEDC *); +void party_menu_held_item_object(struct Pokemon *, struct Unk_203CEDC *); +void party_menu_pokeball_object(struct Pokemon *, struct Unk_203CEDC *); +void party_menu_icon_anim(struct Pokemon *, struct Unk_203CEDC *, u8); +void party_menu_status_condition_object(struct Pokemon *, struct Unk_203CEDC *); +u8 sub_81B5F74(u8, u8); +void sub_81B120C(void); +u8 sub_81B5F34(u8, u8); +void sub_81B5B6C(u8, u8); +void sub_81B5F98(u8, u8); +u8 sub_81B10F8(u8, u8); +bool8 sub_81B118C(u8); +u8 sub_81B8F38(u8); +void c3_0811FAB4(u8); +void sub_81B9080(void); +void sub_81B4F88(void); +void sub_81B15D0(u8, s8*); +void sub_81B140C(u8, s8*); +u16 sub_81B1760(s8*); +s8* sub_81B13EC(void); +bool8 sub_81B15A4(u8*); +void sub_81B302C(u8*); +void sub_81B9140(void); +void sub_81B6794(u8); +void sub_81B7E4C(u8); +void sub_81B8474(u8); +void sub_81B7FAC(u8); +void sub_81B3938(u8); +void sub_81B21AC(u8, u8); +void sub_81B36FC(u8); +void sub_81B407C(u8); +void sub_81B2210(u8); +bool8 sub_81B1660(u8); void sub_81B0038(u8 a, u8 b, u8 c, u8 d, u8 e, TaskFunc f, MainCallback g) { @@ -453,69 +506,579 @@ void sub_81B0740(u8 a) gUnknown_0203CEDC[1].unk0 = &gUnknown_086156C4[0]; } -void sub_81B07E0(u8 a) +void sub_81B07E0(u8 slot) { - if (gUnknown_0203CEC8.unk8_0 == 5 && a > 2) + if (gUnknown_0203CEC8.unk8_0 == 5 && slot > 2) { - sub_81B0CEC(a); - if (gUnknown_02022FF8[a - 3].species == SPECIES_NONE) - sub_81B2748(&gUnknown_0203CEDC[a], 0x40); + sub_81B0CEC(slot); + if (gUnknown_02022FF8[slot - 3].species == SPECIES_NONE) + sub_81B2748(&gUnknown_0203CEDC[slot], 0x40); else - sub_81B2748(&gUnknown_0203CEDC[a], 8); - CopyWindowToVram(gUnknown_0203CEDC[a].unk8, 2); - PutWindowTilemap(gUnknown_0203CEDC[a].unk8); + sub_81B2748(&gUnknown_0203CEDC[slot], 8); + CopyWindowToVram(gUnknown_0203CEDC[slot].unk8, 2); + PutWindowTilemap(gUnknown_0203CEDC[slot].unk8); schedule_bg_copy_tilemap_to_vram(2); } else { - if (GetMonData(&gPlayerParty[a], MON_DATA_SPECIES) == SPECIES_NONE) + if (GetMonData(&gPlayerParty[slot], MON_DATA_SPECIES) == SPECIES_NONE) { - sub_81B2720(gUnknown_0203CEDC[a].unk8); - sub_81B2748(&gUnknown_0203CEDC[a], 0x40); - CopyWindowToVram(gUnknown_0203CEDC[a].unk8, 2); + sub_81B2720(gUnknown_0203CEDC[slot].unk8); + sub_81B2748(&gUnknown_0203CEDC[slot], 0x40); + CopyWindowToVram(gUnknown_0203CEDC[slot].unk8, 2); } else { if (gUnknown_0203CEC8.unk8_0 == 7) - sub_81B0B60(a); + sub_81B0B60(slot); else if (gUnknown_0203CEC8.unk8_0 == 2) - sub_81B0B08(a); + sub_81B0B08(slot); else if (gUnknown_0203CEC8.unk8_0 == 4) - sub_81B0A9C(a); + sub_81B0A9C(slot); else if (gUnknown_0203CEC8.unk8_0 == 11) - sub_81B0B98(a); + sub_81B0B98(slot); else if (gUnknown_0203CEC8.unk8_0 == 12) - sub_81B0BC4(a); - else if (!sub_81B0BFC(a)) - sub_81B0948(a); + sub_81B0BC4(slot); + else if (!sub_81B0BFC(slot)) + sub_81B0948(slot); if (gUnknown_0203CEC8.unk8_0 == 5) - sub_81B0FCC(a, 0); - else if (gUnknown_0203CEC8.unk9 == a) - sub_81B0FCC(a, 1); + sub_81B0FCC(slot, 0); + else if (gUnknown_0203CEC8.unk9 == slot) + sub_81B0FCC(slot, 1); else - sub_81B0FCC(a, 0); + sub_81B0FCC(slot, 0); } - PutWindowTilemap(gUnknown_0203CEDC[a].unk8); + PutWindowTilemap(gUnknown_0203CEDC[slot].unk8); schedule_bg_copy_tilemap_to_vram(0); } } -void sub_81B0948(u8 a) +void sub_81B0948(u8 slot) { - if (GetMonData(&gPlayerParty[a], MON_DATA_IS_EGG)) + if (GetMonData(&gPlayerParty[slot], MON_DATA_IS_EGG)) { - gUnknown_0203CEDC[a].unk0->unk0(gUnknown_0203CEDC[a].unk8, 0, 0, 0, 0, 1); - sub_81B2A70(&gPlayerParty[a], &gUnknown_0203CEDC[a], 0); + gUnknown_0203CEDC[slot].unk0->unk0(gUnknown_0203CEDC[slot].unk8, 0, 0, 0, 0, 1); + sub_81B2A70(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); } else { - gUnknown_0203CEDC[a].unk0->unk0(gUnknown_0203CEDC[a].unk8, 0, 0, 0, 0, 0); - sub_81B2A70(&gPlayerParty[a], &gUnknown_0203CEDC[a], 0); - sub_81B2AC8(&gPlayerParty[a], &gUnknown_0203CEDC[a], 0); - sub_81B2B8C(&gPlayerParty[a], &gUnknown_0203CEDC[a], 0); - sub_81B2CD4(&gPlayerParty[a], &gUnknown_0203CEDC[a], 0); - sub_81B2D74(&gPlayerParty[a], &gUnknown_0203CEDC[a], 0); - sub_81B2E28(&gPlayerParty[a], &gUnknown_0203CEDC[a]); + gUnknown_0203CEDC[slot].unk0->unk0(gUnknown_0203CEDC[slot].unk8, 0, 0, 0, 0, 0); + sub_81B2A70(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); + sub_81B2AC8(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); + sub_81B2B8C(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); + sub_81B2CD4(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); + sub_81B2D74(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], 0); + sub_81B2E28(&gPlayerParty[slot], &gUnknown_0203CEDC[slot]); } } + +void sub_81B0A10(u8 slot, u8 b) +{ + struct Pokemon *currentPokemon = &gPlayerParty[slot]; + + gUnknown_0203CEDC[slot].unk0->unk0(gUnknown_0203CEDC[slot].unk8, 0, 0, 0, 0, 1); + sub_81B2A70(currentPokemon, &gUnknown_0203CEDC[slot], 0); + if (!GetMonData(currentPokemon, MON_DATA_IS_EGG)) + { + sub_81B2AC8(currentPokemon, &gUnknown_0203CEDC[slot], 0); + sub_81B2B8C(currentPokemon, &gUnknown_0203CEDC[slot], 0); + } + sub_81B2FA8(b, &gUnknown_0203CEDC[slot], 0); +} + +void sub_81B0A9C(u8 slot) +{ + u8 i; + struct Pokemon *currentPokemon = &gPlayerParty[slot]; + u8 *ptr = gUnknown_0203CEF8; + + if (!sub_81B85AC(currentPokemon)) + { + sub_81B0A10(slot, 7); + return; + } + else + { + i = 0; + while (i < sub_81B8830()) + { + if (ptr[i] != 0 && (ptr[i] - 1) == slot) + { + sub_81B0A10(slot, i + 2); + return; + } + i++; + } + sub_81B0A10(slot, 1); + } +} + +void sub_81B0B08(u8 slot) +{ + switch (sub_80DAE0C(&gPlayerParty[slot])) + { + case 0: + case 3: + case 4: + sub_81B0A10(slot, 7); + break; + case 1: + case 2: + sub_81B0A10(slot, 6); + break; + } +} + +void sub_81B0B60(u8 slot) +{ + if (!GetNumberOfRelearnableMoves(&gPlayerParty[slot])) + sub_81B0A10(slot, 9); + else + sub_81B0A10(slot, 8); +} + +void sub_81B0B98(u8 slot) +{ + if (sub_81B218C(slot) == TRUE) + sub_81B0A10(slot, 6); + else + sub_81B0A10(slot, 7); +} + +void sub_81B0BC4(u8 slot) +{ + if (GetMonData(&gPlayerParty[slot], MON_DATA_HELD_ITEM)) + sub_81B0A10(slot, 11); + else + sub_81B0A10(slot, 12); +} + +bool8 sub_81B0BFC(u8 slot) +{ + struct Pokemon *currentPokemon = &gPlayerParty[slot]; + u16 item = gSpecialVar_ItemId; + + if (gUnknown_0203CEC8.unkB == 12) + { + gSpecialVar_Result = FALSE; + sub_81B0C94(slot, 0, gSpecialVar_0x8005); + } + else + { + if (gUnknown_0203CEC8.unkB != 3) + return FALSE; + + switch (CheckIfItemIsTMHMOrEvolutionStone(item)) + { + default: + return FALSE; + case 1: + sub_81B0C94(slot, item, 0); + break; + case 2: + if (!GetMonData(currentPokemon, MON_DATA_IS_EGG) && GetEvolutionTargetSpecies(currentPokemon, 3, item) != SPECIES_NONE) + return FALSE; + sub_81B0A10(slot, 0); + break; + } + } + return TRUE; +} + +void sub_81B0C94(u8 slot, u16 item, u8 c) +{ + switch (sub_81B22D8(&gPlayerParty[slot], item, c)) + { + case 1: + case 3: + sub_81B0A10(slot, 9); + break; + case 2: + sub_81B0A10(slot, 10); + break; + default: + sub_81B0A10(slot, 8); + break; + } +} + +void sub_81B0CEC(u8 slot) +{ + struct Unk_203CEDC *structPtr = &gUnknown_0203CEDC[slot]; + u8 actualSlot = slot - 3; + + if (gUnknown_02022FF8[actualSlot].species == SPECIES_NONE) + { + sub_81B2720(structPtr->unk8); + } + else + { + structPtr->unk0->unk0(structPtr->unk8, 0, 0, 0, 0, 0); + StringCopy(gStringVar1, gUnknown_02022FF8[actualSlot].nickname); + StringGetEnd10(gStringVar1); + sub_81DB52C(gStringVar1); + sub_81B2A3C(structPtr->unk8, gStringVar1, 0, structPtr->unk0->unk4); + sub_81B2B40(gUnknown_02022FF8[actualSlot].level, structPtr); + sub_81B2BF4(gUnknown_02022FF8[actualSlot].gender, gUnknown_02022FF8[actualSlot].species, gUnknown_02022FF8[actualSlot].nickname, structPtr); + sub_81B2D3C(gUnknown_02022FF8[actualSlot].hp, structPtr); + sub_81B2DDC(gUnknown_02022FF8[actualSlot].maxhp, structPtr); + sub_81B2E64(gUnknown_02022FF8[actualSlot].hp, gUnknown_02022FF8[actualSlot].maxhp, structPtr); + } +} + +bool8 sub_81B0DA0(void) +{ + sub_81B07E0(gUnknown_0203CEC4->unk218[0]); + if (++gUnknown_0203CEC4->unk218[0] == 6) + return TRUE; + return FALSE; +} + +u8* sub_81B0DD4(u16 a) +{ + return &gUnknown_0203CEE0[a << 5]; +} + +void party_menu_add_per_mon_objects_internal(u8 slot) +{ + u8 actualSlot; + + if (gUnknown_0203CEC8.unk8_0 == 5 && slot > 2) + { + u8 status; + actualSlot = slot - 3; + + if (gUnknown_02022FF8[actualSlot].species != SPECIES_NONE) + { + party_menu_link_mon_icon_anim(gUnknown_02022FF8[actualSlot].species, gUnknown_02022FF8[actualSlot].personality, &gUnknown_0203CEDC[slot], 0, 0); + party_menu_link_mon_held_item_object(gUnknown_02022FF8[actualSlot].species, gUnknown_02022FF8[actualSlot].heldItem, &gUnknown_0203CEDC[slot]); + party_menu_link_mon_pokeball_object(gUnknown_02022FF8[actualSlot].species, &gUnknown_0203CEDC[slot]); + if (gUnknown_02022FF8[actualSlot].hp == 0) + status = AILMENT_FNT; + else + status = pokemon_ailments_get_primary(gUnknown_02022FF8[actualSlot].status); + party_menu_link_mon_status_condition_object(gUnknown_02022FF8[actualSlot].species, status, &gUnknown_0203CEDC[slot]); + } + } + else if (GetMonData(&gPlayerParty[slot], MON_DATA_SPECIES) != SPECIES_NONE) + { + party_menu_icon_anim(&gPlayerParty[slot], &gUnknown_0203CEDC[slot], slot); + party_menu_held_item_object(&gPlayerParty[slot], &gUnknown_0203CEDC[slot]); + party_menu_pokeball_object(&gPlayerParty[slot], &gUnknown_0203CEDC[slot]); + party_menu_status_condition_object(&gPlayerParty[slot], &gUnknown_0203CEDC[slot]); + } +} + +bool8 party_menu_add_per_mon_objects(void) +{ + party_menu_add_per_mon_objects_internal(gUnknown_0203CEC4->unk218[0]); + if (++gUnknown_0203CEC4->unk218[0] == 6) + return TRUE; + return FALSE; +} + +void sub_81B0F28(void) +{ + if (gUnknown_0203CEC8.unk8_0 == 5) + { + FillBgTilemapBufferRect(1, 14, 23, 17, 7, 2, 1); + } + else + { + if (gUnknown_0203CEC4->unk8_0 != FALSE) + { + gUnknown_0203CEC4->unk8_2 = sub_81B5F74(0xBF, 0x88); + sub_81B120C(); + gUnknown_0203CEC4->unk9_0 = sub_81B5F74(0xBF, 0x98); + } + else + { + gUnknown_0203CEC4->unk9_0 = sub_81B5F34(0xC6, 0x94); + } + sub_81B0FCC(gUnknown_0203CEC8.unk9, 1); + } +} + +void sub_81B0FCC(u8 slot, u8 b) +{ + u8 spriteId; + + switch (slot) + { + default: + if (GetMonData(&gPlayerParty[slot], MON_DATA_SPECIES) != SPECIES_NONE) + { + sub_81B2748(&gUnknown_0203CEDC[slot], sub_81B10F8(slot, b)); + sub_81B5B6C(gUnknown_0203CEDC[slot].unk9, b); + sub_81B5F98(gUnknown_0203CEDC[slot].unkB, b); + } + return; + case 6: + if (b == 0) + sub_8199C30(1, 23, 16, 7, 2, 1); + else + sub_8199C30(1, 23, 16, 7, 2, 2); + spriteId = gUnknown_0203CEC4->unk8_2; + break; + case 7: + if (!gUnknown_0203CEC4->unk8_0) + { + if (b == 0) + sub_8199C30(1, 23, 17, 7, 2, 1); + else + sub_8199C30(1, 23, 17, 7, 2, 2); + } + else if (b == 0) + { + sub_8199C30(1, 23, 18, 7, 2, 1); + } + else + { + sub_8199C30(1, 23, 18, 7, 2, 2); + } + spriteId = gUnknown_0203CEC4->unk9_0; + break; + } + sub_81B5F98(spriteId, b); + schedule_bg_copy_tilemap_to_vram(1); +} + +u8 sub_81B10F8(u8 slot, u8 b) +{ + u8 returnVar = 0; + if (b == 1) + returnVar = 1; + if (GetMonData(&gPlayerParty[slot], MON_DATA_HP) == 0) + returnVar |= 2; + if (sub_81B118C(slot) == TRUE) + returnVar |= 8; + if (gUnknown_0203CEC8.unkB == 9) + returnVar |= 16; + if (gUnknown_0203CEC8.unkB == 8) + { + if (slot == gUnknown_0203CEC8.unk9 || slot == gUnknown_0203CEC8.unkA) + returnVar |= 4; + } + if (gUnknown_0203CEC8.unkB == 10 && slot == gUnknown_0203CEC8.unk9 ) + returnVar |= 32; + + return returnVar; +} + +bool8 sub_81B118C(u8 slot) +{ + if (gUnknown_0203CEC8.unk8_1 == 2 && (slot == 1 || slot == 4 || slot == 5)) + return TRUE; + + if (slot < 3 && (gBattleTypeFlags & BATTLE_TYPE_ARENA) && gMain.inBattle && (gBattleStruct->field_2A0 >> sub_81B8F38(slot) & 1)) + return TRUE; + + return FALSE; +} + +void sub_81B120C(void) +{ + CopyToBgTilemapBufferRect_ChangePalette(1, gUnknown_086157C4, 23, 16, 7, 2, 17); + CopyToBgTilemapBufferRect_ChangePalette(1, gUnknown_086157E0, 23, 18, 7, 2, 17); + schedule_bg_copy_tilemap_to_vram(1); +} + +bool8 sub_81B1250(void) +{ + if ((gBattleTypeFlags & (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_TRAINER | BATTLE_TYPE_MULTI)) == (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_TRAINER | BATTLE_TYPE_MULTI) && gMain.inBattle) + return TRUE; + return FALSE; +} + +void sub_81B1288(struct Pokemon *partySlot, struct Pokemon *pokemon) +{ + struct Pokemon *temp = Alloc(sizeof(struct Pokemon)); + + *temp = *partySlot; + *partySlot = *pokemon; + *pokemon = *temp; + + Free(temp); +} + +void sub_81B12C0(u8 taskId) +{ + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gTasks[taskId].func = c3_0811FAB4; +} + +void c3_0811FAB4(u8 taskId) +{ + if (!gPaletteFade.active) + { + if (gUnknown_0203CEC8.unk8_0 == 1) + sub_81B9080(); + + if (gUnknown_0203CEC4->unk4 != NULL) + SetMainCallback2(gUnknown_0203CEC4->unk4); + else + SetMainCallback2(gUnknown_0203CEC8.unk0); + + ResetSpriteData(); + sub_81B06F4(); + DestroyTask(taskId); + } +} + +u8 GetCursorSelectionMonId(void) +{ + return gUnknown_0203CEC8.unk9; +} + +u8 sub_81B1360(void) +{ + return gUnknown_0203CEC8.unk8_0; +} + +void sub_81B1370(u8 taskId) +{ + if (!gPaletteFade.active && sub_81221EC() != TRUE) + { + s8 *ptr = sub_81B13EC(); + + switch (sub_81B1760(ptr)) + { + case 1: + sub_81B140C(taskId, ptr); + break; + case 2: + sub_81B15D0(taskId, ptr); + break; + case 8: + if (gUnknown_0203CEC4->unk8_0) + { + PlaySE(SE_SELECT); + sub_81B4F88(); + } + } + } +} + +s8* sub_81B13EC(void) +{ + if (gUnknown_0203CEC8.unkB == 8 || gUnknown_0203CEC8.unkB == 10) + return &gUnknown_0203CEC8.unkA; + return &gUnknown_0203CEC8.unk9; +} + +void sub_81B140C(u8 taskId, s8 *ptr) +{ + if (*ptr == 6) + { + gUnknown_0203CEC8.unk4(taskId); + } + else + { + switch (gUnknown_0203CEC8.unkB - 3) + { + case 7: + if (sub_81B15A4((u8*)ptr)) + { + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + sub_81615A8(taskId); + } + break; + case 0: + if (sub_81B15A4((u8*)ptr)) + { + if (gUnknown_0203CEC8.unk8_0 == 1) + gUnknown_0203CEC4->unk4 = sub_81B9140; + + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + gUnknown_03006328(taskId, sub_81B6794); + } + break; + case 9: + if (sub_81B15A4((u8*)ptr)) + { + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + sub_81B7E4C(taskId); + } + break; + case 4: + if (sub_81B15A4((u8*)ptr)) + { + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + sub_81B8474(taskId); + } + break; + case 2: + case 3: + if (sub_81B15A4((u8*)ptr)) + { + PlaySE(SE_SELECT); + sub_81B302C(&gUnknown_0203CEC4->unkC[1]); + sub_81B7FAC(taskId); + } + break; + case 5: + PlaySE(SE_SELECT); + sub_81B3938(taskId); + break; + case 8: + PlaySE(SE_SELECT); + sub_81B12C0(taskId); + break; + case 10: + if (sub_81B15A4((u8*)ptr)) + { + sub_81B21AC(taskId, (u8)*ptr); + } + break; + default: + case 1: + case 6: + PlaySE(SE_SELECT); + sub_81B36FC(taskId); + break; + } + } +} + +bool8 sub_81B15A4(u8 *slotPtr) +{ + if (GetMonData(&gPlayerParty[*slotPtr], MON_DATA_IS_EGG) == TRUE) + { + PlaySE(SE_HAZURE); + return FALSE; + } + return TRUE; +} + +void sub_81B15D0(u8 taskId, s8 *ptr) +{ + switch (gUnknown_0203CEC8.unkB) + { + case 1: + PlaySE(SE_HAZURE); + break; + case 8: + case 10: + PlaySE(SE_SELECT); + sub_81B407C(taskId); + break; + case 13: + PlaySE(SE_SELECT); + sub_81B2210(taskId); + break; + default: + PlaySE(SE_SELECT); + if (sub_81B1660(taskId) != TRUE) + { + if (!sub_81221AC()) + gSpecialVar_0x8004 = 7; + gUnknown_0203CEE8 = 0; + *ptr = 7; + sub_81B12C0(taskId); + } + break; + } +}