diff --git a/asm/dodrio_berry_picking.s b/asm/dodrio_berry_picking.s deleted file mode 100755 index 8203696be..000000000 --- a/asm/dodrio_berry_picking.s +++ /dev/null @@ -1,7859 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_8026988 -sub_8026988: @ 8026988 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0x44 - adds r0, 0x48 - ldrb r0, [r0] - mov r8, r0 - ldrb r6, [r1] - cmp r6, r8 - bcs _08026A7A - ldr r0, =gUnknown_082F449C - mov r9, r0 -_080269A8: - ldr r0, =gUnknown_02022C98 - ldr r3, [r0] - adds r0, r3, 0 - adds r0, 0x28 - ldrb r1, [r0] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 2 - ldr r2, =0x000031a0 - adds r0, r2 - adds r7, r3, r0 - movs r0, 0xB - adds r2, r1, 0 - muls r2, r0 - adds r2, r6, r2 - adds r3, 0x24 - ldrb r1, [r3] - subs r1, 0x1 - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 3 - subs r0, r1 - adds r2, r0 - add r2, r9 - ldrb r4, [r2] - adds r0, r7, 0 - adds r0, 0x1F - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _080269FC - adds r0, r6, 0 - movs r1, 0 - bl sub_8028BF8 - b _08026A04 - .pool -_080269FC: - adds r0, r6, 0 - movs r1, 0x1 - bl sub_8028BF8 -_08026A04: - adds r0, r7, 0 - adds r0, 0x1F - adds r5, r0, r4 - ldrb r0, [r5] - cmp r0, 0x9 - bls _08026A30 - adds r0, r7, 0 - adds r0, 0x14 - adds r0, r4 - ldrb r1, [r0] - adds r1, 0x3 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl sub_8028CA4 - ldrb r1, [r5] - lsls r1, 25 - movs r0, 0xFF - lsls r0, 24 - adds r1, r0 - b _08026A52 -_08026A30: - adds r0, r7, 0 - adds r0, 0x14 - adds r3, r0, r4 - ldrb r0, [r3] - cmp r0, 0x3 - bne _08026A5C - movs r0, 0x7 - strb r0, [r5] - adds r0, r6, 0 - movs r1, 0x6 - bl sub_8028CA4 - ldrb r1, [r5] - lsls r1, 25 - movs r2, 0xFF - lsls r2, 24 - adds r1, r2 -_08026A52: - lsrs r1, 24 - adds r0, r6, 0 - bl sub_8028C7C - b _08026A70 -_08026A5C: - ldrb r1, [r3] - adds r0, r6, 0 - bl sub_8028CA4 - ldrb r1, [r5] - lsls r1, 25 - lsrs r1, 24 - adds r0, r6, 0 - bl sub_8028C7C -_08026A70: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, r8 - bcc _080269A8 -_08026A7A: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8026988 - - thumb_func_start sub_8026A88 -sub_8026A88: @ 8026A88 - push {r4-r6,lr} - ldr r1, =gUnknown_02022C98 - ldr r0, [r1] - adds r0, 0x24 - ldrb r5, [r0] - movs r4, 0 - cmp r4, r5 - bcs _08026ABA - adds r6, r1, 0 -_08026A9A: - lsls r0, r4, 4 - subs r0, r4 - lsls r0, 2 - ldr r1, [r6] - adds r0, r1 - ldr r1, =0x000031cc - adds r0, r1 - ldrb r1, [r0] - adds r0, r4, 0 - bl sub_80286B4 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _08026A9A -_08026ABA: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8026A88 - - thumb_func_start sub_8026AC8 -sub_8026AC8: @ 8026AC8 - push {r4,r5,lr} - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x24 - ldrb r5, [r0] - movs r4, 0 - cmp r4, r5 - bcs _08026AEA -_08026AD8: - adds r0, r4, 0 - movs r1, 0x4 - bl sub_80286B4 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _08026AD8 -_08026AEA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8026AC8 - - thumb_func_start sub_8026AF4 -sub_8026AF4: @ 8026AF4 - push {lr} - bl sub_8026988 - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x40 - ldrb r0, [r0] - cmp r0, 0x9 - bls _08026B10 - bl sub_8026AC8 - b _08026B14 - .pool -_08026B10: - bl sub_8026A88 -_08026B14: - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x40 - ldrb r0, [r0] - bl sub_80288D4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8026AF4 - - thumb_func_start sub_8026B28 -sub_8026B28: @ 8026B28 - push {lr} - bl sub_8026988 - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x40 - ldrb r0, [r0] - cmp r0, 0x9 - bls _08026B44 - bl sub_8026AC8 - b _08026B48 - .pool -_08026B44: - bl sub_8026A88 -_08026B48: - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x40 - ldrb r0, [r0] - bl sub_80288D4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8026B28 - - thumb_func_start sub_8026B5C -sub_8026B5C: @ 8026B5C - push {lr} - adds r3, r1, 0 - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x1 - cmp r0, 0x4 - bhi _08026BB4 - lsls r0, 2 - ldr r1, =_08026B78 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08026B78: - .4byte _08026B8C - .4byte _08026B94 - .4byte _08026B9C - .4byte _08026BA4 - .4byte _08026BAC -_08026B8C: - movs r0, 0x4 - strb r0, [r3] - movs r0, 0x7 - b _08026BB2 -_08026B94: - movs r0, 0x3 - strb r0, [r3] - movs r0, 0x8 - b _08026BB2 -_08026B9C: - movs r0, 0x2 - strb r0, [r3] - movs r0, 0x9 - b _08026BB2 -_08026BA4: - movs r0, 0x1 - strb r0, [r3] - movs r0, 0xA - b _08026BB2 -_08026BAC: - movs r0, 0 - strb r0, [r3] - movs r0, 0xB -_08026BB2: - strb r0, [r2] -_08026BB4: - pop {r0} - bx r0 - thumb_func_end sub_8026B5C - - thumb_func_start sub_8026BB8 -sub_8026BB8: @ 8026BB8 - push {r4-r6,lr} - ldr r1, =gUnknown_02022C98 - ldr r0, [r1] - adds r0, 0x24 - ldrb r5, [r0] - movs r4, 0x1 - cmp r4, r5 - bcs _08026C1E - adds r6, r1, 0 -_08026BCA: - ldr r0, [r6] - movs r1, 0xAC - lsls r1, 1 - adds r0, r1 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - bne _08026BEC - adds r0, r4, 0 - bl sub_8027DFC - ldr r1, [r6] - movs r2, 0xAC - lsls r2, 1 - adds r1, r2 - adds r1, r4 - strb r0, [r1] -_08026BEC: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _08026BCA - cmp r4, r5 - bcs _08026C1E - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - movs r2, 0xAC - lsls r2, 1 - adds r1, r0, r2 -_08026C04: - adds r0, r1, r4 - ldrb r0, [r0] - cmp r0, 0 - bne _08026C14 - movs r0, 0 - b _08026C20 - .pool -_08026C14: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _08026C04 -_08026C1E: - movs r0, 0x1 -_08026C20: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8026BB8 - - thumb_func_start sub_8026C28 -sub_8026C28: @ 8026C28 - push {r4,lr} - movs r1, 0 - ldr r4, =gUnknown_02022C98 - movs r3, 0xAC - lsls r3, 1 - movs r2, 0 -_08026C34: - ldr r0, [r4] - adds r0, r3 - adds r0, r1 - strb r2, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x4 - bls _08026C34 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8026C28 - - thumb_func_start sub_8026C50 -sub_8026C50: @ 8026C50 - push {r4,lr} - ldr r3, =gUnknown_02022C98 - ldr r1, [r3] - adds r2, r1, 0 - adds r2, 0x40 - ldrb r0, [r2] - cmp r0, 0x9 - bls _08026C88 - movs r4, 0x90 - lsls r4, 1 - adds r0, r1, r4 - ldr r0, [r0] - cmp r0, 0 - bne _08026C88 - movs r0, 0xA - strb r0, [r2] - ldr r0, [r3] - movs r1, 0x96 - lsls r1, 1 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0 - beq _08026C88 - movs r0, 0x1 - b _08026C8A - .pool -_08026C88: - movs r0, 0 -_08026C8A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8026C50 - - thumb_func_start sub_8026C90 -sub_8026C90: @ 8026C90 - push {r4-r6,lr} - ldr r4, =gUnknown_02022C98 - ldr r1, [r4] - adds r2, r1, 0 - adds r2, 0x40 - ldrb r0, [r2] - cmp r0, 0x9 - bls _08026D14 - adds r0, r1, 0 - adds r0, 0x44 - ldrb r3, [r0] - adds r0, 0x4 - ldrb r5, [r0] - movs r0, 0xA - strb r0, [r2] - ldr r4, [r4] - mov r12, r4 - movs r0, 0x96 - lsls r0, 1 - add r0, r12 - ldr r0, [r0] - cmp r0, 0 - beq _08026D14 - adds r4, r3, 0 - cmp r4, r5 - bcs _08026D04 - mov r0, r12 - adds r0, 0x28 - ldrb r3, [r0] - lsls r1, r3, 4 - subs r1, r3 - lsls r1, 2 - ldr r6, =gUnknown_082F449C - subs r0, 0x4 - ldrb r2, [r0] - subs r2, 0x1 - add r1, r12 - movs r0, 0xB - muls r3, r0 - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 3 - subs r2, r0, r2 - ldr r0, =0x000031bf - adds r1, r0 -_08026CEA: - adds r0, r4, r3 - adds r0, r2 - adds r0, r6 - ldrb r0, [r0] - adds r0, r1, r0 - ldrb r0, [r0] - cmp r0, 0xA - bne _08026D14 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _08026CEA -_08026D04: - movs r0, 0x1 - b _08026D16 - .pool -_08026D14: - movs r0, 0 -_08026D16: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8026C90 - - thumb_func_start sub_8026D1C -sub_8026D1C: @ 8026D1C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gUnknown_082F7A9C - mov r8, r0 - ldr r0, =gUnknown_02022C98 - ldr r6, [r0] - adds r0, r6, 0 - adds r0, 0x90 - adds r0, r5 - mov r9, r0 - ldrb r7, [r0] - adds r0, r7, 0 - movs r1, 0x7 - bl __umodsi3 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - add r4, r8 - adds r0, r7, 0 - movs r1, 0x7 - bl __udivsi3 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x64 - muls r0, r1 - ldrb r4, [r4] - adds r0, r4 - lsls r0, 24 - lsls r5, 1 - adds r6, 0x86 - adds r6, r5 - ldrh r1, [r6] - lsrs r0, 24 - cmp r1, r0 - bcc _08026D76 - adds r0, r7, 0x1 - mov r1, r9 - strb r0, [r1] -_08026D76: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8026D1C - - thumb_func_start sub_8026D8C -sub_8026D8C: @ 8026D8C - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gUnknown_082F449C+0x1AC - ldr r1, =gUnknown_02022C98 - ldr r1, [r1] - adds r1, 0x24 - ldrb r1, [r1] - subs r1, 0x1 - movs r2, 0xB - muls r1, r2 - adds r0, r1 - adds r0, r3 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_8026D8C - - thumb_func_start sub_8026DB0 -sub_8026DB0: @ 8026DB0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - ldr r4, =gUnknown_02022C98 - ldr r1, [r4] - adds r1, 0x24 - ldrb r2, [r1] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldr r3, =gUnknown_082F449C+0x15E - lsls r1, r0, 1 - adds r1, r0 - lsls r0, r2, 4 - subs r0, r2 - adds r1, r0 - adds r0, r1, r3 - ldrb r0, [r0] - mov r12, r0 - adds r0, r3, 0x1 - adds r0, r1, r0 - ldrb r7, [r0] - adds r3, 0x2 - adds r1, r3 - ldrb r1, [r1] - mov r8, r1 - movs r3, 0 - ldr r1, =gUnknown_082F449C+0x1E3 - lsls r0, r2, 2 - adds r2, r0, r2 - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _08026E18 - adds r6, r1, 0 -_08026DFE: - adds r0, r3, r2 - adds r0, r6 - ldrb r0, [r0] - cmp r5, r0 - beq _08026E3C - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - adds r0, r3, r2 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _08026DFE -_08026E18: - ldr r0, [r4] - adds r0, 0x90 - mov r1, r12 - adds r2, r0, r1 - adds r1, r0, r7 - ldrb r0, [r2] - ldrb r3, [r1] - cmp r0, r3 - bls _08026E46 - adds r1, r0, 0 - b _08026E48 - .pool -_08026E3C: - ldr r0, [r4] - adds r0, 0x90 - adds r0, r7 - ldrb r0, [r0] - b _08026E5A -_08026E46: - ldrb r1, [r1] -_08026E48: - ldr r0, [r4] - adds r0, 0x90 - mov r2, r8 - adds r4, r0, r2 - ldrb r0, [r4] - cmp r0, r1 - bls _08026E58 - adds r1, r0, 0 -_08026E58: - adds r0, r1, 0 -_08026E5A: - adds r1, r5, 0 - bl sub_8026E70 - lsls r0, 24 - lsrs r0, 24 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8026DB0 - - thumb_func_start sub_8026E70 -sub_8026E70: @ 8026E70 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gUnknown_02022C98 - ldr r2, [r2] - adds r2, 0xE8 - adds r2, r1 - ldrb r4, [r2] - movs r1, 0x7 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x6 - bhi _08026EDE - lsls r0, 2 - ldr r1, =_08026EA4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08026EA4: - .4byte _08026EDE - .4byte _08026ED6 - .4byte _08026EE2 - .4byte _08026EC0 - .4byte _08026EC6 - .4byte _08026ECC - .4byte _08026ED2 -_08026EC0: - cmp r4, 0 - beq _08026ED6 - b _08026EDE -_08026EC6: - cmp r4, 0 - beq _08026EE2 - b _08026EDE -_08026ECC: - cmp r4, 0x2 - beq _08026ED6 - b _08026EE2 -_08026ED2: - cmp r4, 0 - bne _08026EDA -_08026ED6: - movs r0, 0x1 - b _08026EE4 -_08026EDA: - cmp r4, 0x1 - beq _08026EE2 -_08026EDE: - movs r0, 0 - b _08026EE4 -_08026EE2: - movs r0, 0x2 -_08026EE4: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8026E70 - - thumb_func_start sub_8026EEC -sub_8026EEC: @ 8026EEC - push {r4-r6,lr} - movs r6, 0 - movs r5, 0 - adds r4, r0, 0 - b _08026EFE -_08026EF6: - ldrh r0, [r4, 0x6] - adds r6, r0 - adds r4, 0xC - adds r5, 0x1 -_08026EFE: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - blt _08026EF6 - cmp r6, 0xA - bgt _08026F12 - movs r0, 0 - b _08026F14 -_08026F12: - movs r0, 0x1 -_08026F14: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8026EEC - - thumb_func_start sub_8026F1C -sub_8026F1C: @ 8026F1C - push {r4-r6,lr} - lsls r0, 24 - lsrs r3, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - lsls r2, 24 - lsrs r2, 24 - ldr r6, =gUnknown_02022C98 - ldr r1, [r6] - adds r0, r1, 0 - adds r0, 0x24 - ldrb r5, [r0] - cmp r3, 0 - bge _08026F3A - b _0802722C -_08026F3A: - cmp r3, 0x2 - ble _08026F48 - cmp r3, 0x3 - beq _08026F78 - b _0802722C - .pool -_08026F48: - ldr r3, =0x000031b4 - adds r0, r1, r3 - adds r0, r4 - ldrb r4, [r0] - lsls r4, 1 - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r4, r0 - adds r0, r1, 0 - adds r0, 0x4A - adds r0, r4 - ldrh r0, [r0] - ldr r1, =0x00004e20 - bl sub_8027A28 - ldr r1, [r6] - adds r1, 0x4A - adds r1, r4 - b _0802722A - .pool -_08026F78: - adds r0, r1, 0 - adds r0, 0x4A - bl sub_8026EEC - cmp r0, 0 - beq _08026F86 - b _0802722C -_08026F86: - cmp r5, 0x3 - bne _08026F8C - b _08027154 -_08026F8C: - cmp r5, 0x3 - bgt _08026F98 - cmp r5, 0x2 - bne _08026F96 - b _080271E8 -_08026F96: - b _0802722C -_08026F98: - cmp r5, 0x4 - bne _08026F9E - b _08027090 -_08026F9E: - cmp r5, 0x5 - beq _08026FA4 - b _0802722C -_08026FA4: - cmp r4, 0x9 - bls _08026FAA - b _0802722C -_08026FAA: - lsls r0, r4, 2 - ldr r1, =_08026FB8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08026FB8: - .4byte _08026FE0 - .4byte _08026FF8 - .4byte _08027004 - .4byte _0802701C - .4byte _08027028 - .4byte _08027040 - .4byte _0802704C - .4byte _08027060 - .4byte _0802706C - .4byte _08027084 -_08026FE0: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x68 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x74 - b _08027226 - .pool -_08026FF8: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x74 - b _08027226 - .pool -_08027004: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x74 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x80 - b _08027226 - .pool -_0802701C: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x80 - b _08027226 - .pool -_08027028: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x80 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x50 - b _08027226 - .pool -_08027040: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x50 - b _08027226 - .pool -_0802704C: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x50 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - b _08027224 - .pool -_08027060: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _08027224 - .pool -_0802706C: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x5C - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x68 - b _08027226 - .pool -_08027084: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x68 - b _08027226 - .pool -_08027090: - subs r0, r4, 0x1 - cmp r0, 0x7 - bls _08027098 - b _0802722C -_08027098: - lsls r0, 2 - ldr r1, =_080270A8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080270A8: - .4byte _080270C8 - .4byte _080270E0 - .4byte _080270EC - .4byte _08027104 - .4byte _08027110 - .4byte _08027124 - .4byte _08027130 - .4byte _08027148 -_080270C8: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x68 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x74 - b _08027226 - .pool -_080270E0: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x74 - b _08027226 - .pool -_080270EC: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x74 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x50 - b _08027226 - .pool -_08027104: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x50 - b _08027226 - .pool -_08027110: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x50 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - b _08027224 - .pool -_08027124: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _08027224 - .pool -_08027130: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x5C - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x68 - b _08027226 - .pool -_08027148: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x68 - b _08027226 - .pool -_08027154: - subs r0, r4, 0x2 - cmp r0, 0x5 - bhi _0802722C - lsls r0, 2 - ldr r1, =_08027168 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08027168: - .4byte _08027180 - .4byte _08027198 - .4byte _080271A4 - .4byte _080271BC - .4byte _080271C8 - .4byte _080271DC -_08027180: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x5C - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x68 - b _08027226 - .pool -_08027198: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x68 - b _08027226 - .pool -_080271A4: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x68 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - adds r1, 0x50 - b _08027226 - .pool -_080271BC: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x50 - b _08027226 - .pool -_080271C8: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x50 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - b _08027224 - .pool -_080271DC: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - b _08027224 - .pool -_080271E8: - cmp r4, 0x4 - beq _0802720E - cmp r4, 0x4 - bgt _080271F6 - cmp r4, 0x3 - beq _08027200 - b _0802722C -_080271F6: - cmp r4, 0x5 - beq _08027214 - cmp r4, 0x6 - beq _08027222 - b _0802722C -_08027200: - ldr r1, [r6] - adds r2, r1, 0 - adds r2, 0x50 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - b _08027224 -_0802720E: - ldr r1, [r6] - adds r1, 0x50 - b _08027226 -_08027214: - ldr r1, [r6] - adds r2, r1, 0 - adds r2, 0x50 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - b _08027224 -_08027222: - ldr r1, [r6] -_08027224: - adds r1, 0x5C -_08027226: - ldrh r0, [r1] - adds r0, 0x1 -_0802722A: - strh r0, [r1] -_0802722C: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8026F1C - - thumb_func_start sub_8027234 -sub_8027234: @ 8027234 - push {r4,r5,lr} - adds r1, r0, 0 - ldr r4, =gUnknown_02022C98 - ldr r3, [r4] - adds r0, r3, 0 - adds r0, 0x24 - ldrb r0, [r0] - cmp r0, 0x5 - bne _0802729E - cmp r1, 0x1 - bne _08027280 - movs r5, 0x89 - lsls r5, 1 - adds r1, r3, r5 - ldrh r0, [r1] - adds r2, r0, 0x1 - strh r2, [r1] - movs r0, 0x8A - lsls r0, 1 - adds r1, r3, r0 - lsls r0, r2, 16 - lsrs r0, 16 - ldrh r3, [r1] - cmp r0, r3 - bls _08027268 - strh r2, [r1] -_08027268: - ldr r0, [r4] - adds r2, r0, r5 - ldrh r0, [r2] - ldr r1, =0x0000270f - cmp r0, r1 - bls _0802729E - strh r1, [r2] - b _0802729E - .pool -_08027280: - movs r2, 0x89 - lsls r2, 1 - adds r0, r3, r2 - movs r5, 0x8A - lsls r5, 1 - adds r1, r3, r5 - ldrh r0, [r0] - ldrh r3, [r1] - cmp r0, r3 - bls _08027296 - strh r0, [r1] -_08027296: - ldr r0, [r4] - adds r0, r2 - movs r1, 0 - strh r1, [r0] -_0802729E: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8027234 - - thumb_func_start sub_80272A4 -sub_80272A4: @ 80272A4 - push {r4,r5,lr} - movs r3, 0 - ldr r2, =gUnknown_02022C98 - ldr r0, [r2] - adds r0, 0x24 - ldrb r0, [r0] - cmp r3, r0 - bcs _080272DC - adds r5, r2, 0 - movs r4, 0x8A - lsls r4, 1 -_080272BA: - ldr r2, [r5] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r1, r2, 0 - adds r1, 0x54 - adds r1, r0 - adds r0, r2, r4 - ldrh r0, [r0] - strh r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - adds r2, 0x24 - ldrb r2, [r2] - cmp r3, r2 - bcc _080272BA -_080272DC: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80272A4 - - thumb_func_start sub_80272E8 -sub_80272E8: @ 80272E8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r5, 0 - ldr r7, =gUnknown_02022C98 - movs r4, 0 - ldr r0, =0x000031bf - mov r10, r0 -_080272FC: - movs r2, 0 - lsls r6, r5, 4 - lsls r1, r5, 1 - mov r8, r1 - lsls r0, r5, 3 - mov r12, r0 - adds r1, r5, 0x1 - mov r9, r1 - subs r0, r6, r5 - lsls r3, r0, 2 -_08027310: - ldr r0, [r7] - adds r1, r2, r3 - add r0, r10 - adds r0, r1 - strb r4, [r0] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0xA - bls _08027310 - ldr r0, [r7] - subs r1, r6, r5 - lsls r1, 2 - adds r0, r1 - ldr r2, =0x000031cc - adds r0, r2 - strb r4, [r0] - ldr r0, [r7] - adds r0, r1 - ldr r1, =0x000031d0 - adds r0, r1 - strb r4, [r0] - ldr r0, [r7] - adds r0, 0x90 - adds r0, r5 - strb r4, [r0] - ldr r1, [r7] - adds r0, r1, 0 - adds r0, 0x86 - add r0, r8 - strh r4, [r0] - add r1, r12 - ldr r2, =0x00003308 - adds r1, r2 - strb r4, [r1] - ldr r2, [r7] - ldr r1, =0x0000330c - adds r0, r2, r1 - add r0, r12 - str r4, [r0] - mov r0, r8 - adds r1, r0, r5 - lsls r1, 2 - adds r0, r2, 0 - adds r0, 0x4A - adds r0, r1 - strh r4, [r0] - adds r0, r2, 0 - adds r0, 0x4C - adds r0, r1 - strh r4, [r0] - adds r0, r2, 0 - adds r0, 0x4E - adds r0, r1 - strh r4, [r0] - adds r0, r2, 0 - adds r0, 0x50 - adds r0, r1 - strh r4, [r0] - adds r0, r2, 0 - adds r0, 0x52 - adds r0, r1 - strh r4, [r0] - adds r0, r2, 0 - adds r0, 0x54 - adds r0, r1 - strh r4, [r0] - mov r1, r9 - lsls r0, r1, 24 - lsrs r5, r0, 24 - cmp r5, 0x4 - bls _080272FC - ldr r2, =gUnknown_02022C98 - ldr r0, [r2] - movs r1, 0xAA - lsls r1, 1 - adds r0, r1 - movs r2, 0 - strb r2, [r0] - ldr r1, =gUnknown_02022C98 - ldr r0, [r1] - movs r1, 0x89 - lsls r1, 1 - adds r3, r0, r1 - movs r1, 0 - strh r2, [r3] - adds r0, 0x40 - strb r1, [r0] - bl sub_8026A88 - bl sub_8026988 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80272E8 - - thumb_func_start sub_80273F0 -sub_80273F0: @ 80273F0 - push {r4,r5,lr} - movs r4, 0 - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x24 - ldrb r0, [r0] - cmp r0, 0x4 - beq _0802740C - cmp r0, 0x5 - beq _08027410 - b _08027412 - .pool -_0802740C: - movs r4, 0x1 - b _08027412 -_08027410: - movs r4, 0x2 -_08027412: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xA - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - movs r3, 0 - lsls r1, r4, 2 - ldr r5, =gUnknown_02022C98 - ldr r2, =gUnknown_082F7AA4 - adds r1, r4 - lsls r1, 1 - adds r0, r1 - adds r0, r2 - ldrb r2, [r0] -_08027436: - ldr r1, [r5] - lsls r0, r3, 1 - adds r0, r3 - lsls r0, 2 - adds r1, 0x52 - adds r1, r0 - strh r2, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x4 - bls _08027436 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80273F0 - - thumb_func_start sub_802745C -sub_802745C: @ 802745C - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02022C98 - ldr r2, [r1] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r0, r2, 0 - adds r0, 0x4A - adds r0, r1 - ldrh r3, [r0] - adds r0, r2, 0 - adds r0, 0x4C - adds r0, r1 - ldrh r0, [r0] - adds r2, 0x4E - adds r2, r1 - adds r3, r0 - ldrh r2, [r2] - adds r0, r3, r2 - ldr r1, =0x0000270f - cmp r0, r1 - bls _0802748E - adds r0, r1, 0 -_0802748E: - pop {r1} - bx r1 - .pool - thumb_func_end sub_802745C - - thumb_func_start sub_802749C -sub_802749C: @ 802749C - push {r4-r6,lr} - ldr r5, =gUnknown_02022C98 - ldr r0, [r5] - adds r0, 0x28 - ldrb r0, [r0] - bl sub_802745C - ldr r1, =0x0000270f - bl sub_8027A38 - adds r4, r0, 0 - ldr r0, [r5] - adds r0, 0x28 - ldrb r0, [r0] - bl sub_80276C0 - ldr r1, =0x000f4236 - bl sub_8027A38 - adds r2, r0, 0 - ldr r3, =gSaveBlock2Ptr - ldr r0, [r3] - movs r6, 0x83 - lsls r6, 2 - adds r1, r0, r6 - ldr r0, [r1] - cmp r0, r2 - bcs _080274D6 - str r2, [r1] -_080274D6: - ldr r0, [r3] - movs r2, 0x84 - lsls r2, 2 - adds r1, r0, r2 - ldrh r0, [r1] - cmp r0, r4 - bcs _080274E6 - strh r4, [r1] -_080274E6: - ldr r0, [r3] - ldr r6, =0x00000212 - adds r2, r0, r6 - ldr r0, [r5] - movs r1, 0x8A - lsls r1, 1 - adds r0, r1 - ldrh r1, [r0] - ldrh r0, [r2] - cmp r0, r1 - bcs _080274FE - strh r1, [r2] -_080274FE: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802749C - - thumb_func_start sub_8027518 -sub_8027518: @ 8027518 - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r1, =gUnknown_02022C98 - ldr r0, [r1] - adds r0, 0x9B - ldrb r6, [r0] - movs r3, 0x3 - adds r5, r1, 0 - adds r4, r5, 0 -_0802752C: - ldr r0, [r4] - adds r0, 0x98 - adds r2, r0, r3 - subs r1, r3, 0x1 - adds r0, r1 - ldrb r0, [r0] - strb r0, [r2] - lsls r1, 24 - lsrs r3, r1, 24 - cmp r3, 0 - bne _0802752C - ldr r0, [r5] - adds r0, 0x98 - strb r7, [r0] - adds r0, r6, 0 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8027518 - - thumb_func_start sub_8027554 -sub_8027554: @ 8027554 - push {r4,lr} - ldr r4, =gUnknown_02022C98 - ldr r3, [r4] - adds r0, r3, 0 - adds r0, 0x28 - ldrb r1, [r0] - adds r0, 0x88 - adds r2, r0, r1 - ldrb r0, [r2] - cmp r0, 0 - bne _080275FC - ldr r0, =gMain - ldrh r2, [r0, 0x2E] - movs r0, 0x40 - ands r0, r2 - cmp r0, 0 - beq _08027594 - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 2 - adds r0, r3, r0 - ldr r1, =0x000031cc - adds r0, r1 - movs r1, 0x2 - b _080275CA - .pool -_08027594: - movs r0, 0x20 - ands r0, r2 - cmp r0, 0 - beq _080275B0 - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 2 - adds r0, r3, r0 - ldr r1, =0x000031cc - adds r0, r1 - movs r1, 0x3 - b _080275CA - .pool -_080275B0: - movs r0, 0x10 - ands r0, r2 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0 - beq _080275E8 - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 2 - adds r0, r3, r0 - ldr r1, =0x000031cc - adds r0, r1 - movs r1, 0x1 -_080275CA: - strb r1, [r0] - ldr r0, [r4] - adds r1, r0, 0 - adds r1, 0x28 - adds r0, 0xB0 - ldrb r1, [r1] - adds r0, r1 - movs r1, 0x6 - strb r1, [r0] - movs r0, 0xD4 - bl PlaySE - b _08027600 - .pool -_080275E8: - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 2 - adds r0, r3, r0 - ldr r1, =0x000031cc - adds r0, r1 - strb r2, [r0] - b _08027600 - .pool -_080275FC: - subs r0, 0x1 - strb r0, [r2] -_08027600: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8027554 - - thumb_func_start sub_8027608 -sub_8027608: @ 8027608 - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x28 - ldrb r2, [r0] - lsls r0, r2, 4 - subs r0, r2 - lsls r0, 2 - adds r1, r0 - ldr r0, =0x000031cc - adds r1, r0 - movs r0, 0 - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_8027608 - - thumb_func_start sub_802762C -sub_802762C: @ 802762C - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x28 - ldrb r2, [r0] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r1, 0x52 - adds r1, r0 - ldrh r0, [r1] - adds r0, 0x85 - lsls r0, 16 - lsrs r0, 16 - bx lr - .pool - thumb_func_end sub_802762C - - thumb_func_start sub_8027650 -sub_8027650: @ 8027650 - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x24 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_8027650 - - thumb_func_start sub_8027660 -sub_8027660: @ 8027660 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0802768C - ldr r0, =gUnknown_02022C98 - lsls r1, r2, 4 - subs r1, r2 - lsls r1, 2 - ldr r2, =0x000031a0 - adds r1, r2 - ldr r0, [r0] - b _08027694 - .pool -_0802768C: - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - ldr r1, =gLinkPlayers + 8 -_08027694: - adds r0, r1 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8027660 - - thumb_func_start sub_80276A0 -sub_80276A0: @ 80276A0 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - ldr r2, =gUnknown_02022C98 - ldr r3, [r2] - lsrs r1, 23 - lsls r2, r0, 1 - adds r2, r0 - lsls r2, 2 - adds r1, r2 - adds r3, 0x4A - adds r3, r1 - ldrh r0, [r3] - bx lr - .pool - thumb_func_end sub_80276A0 - - thumb_func_start sub_80276C0 -sub_80276C0: @ 80276C0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r4, r0, 24 - movs r5, 0 - movs r3, 0 - ldr r0, =gUnknown_02022C98 - mov r9, r0 - ldr r2, =gUnknown_082F7B24 - mov r10, r2 - ldr r2, [r0] - lsls r1, r4, 1 - adds r0, r1, r4 - lsls r0, 2 - str r0, [sp] - adds r6, r2, 0 - adds r6, 0x4A - mov r12, r1 - mov r8, r10 -_080276EE: - lsls r1, r3, 1 - ldr r7, [sp] - adds r0, r1, r7 - adds r0, r6, r0 - ldrh r2, [r0] - add r1, r8 - movs r7, 0 - ldrsh r0, [r1, r7] - muls r0, r2 - adds r5, r0 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x2 - bls _080276EE - mov r0, r9 - ldr r1, [r0] - mov r2, r12 - adds r0, r2, r4 - lsls r0, 2 - adds r1, 0x50 - adds r1, r0 - ldrh r1, [r1] - mov r3, r10 - movs r7, 0x6 - ldrsh r0, [r3, r7] - muls r0, r1 - cmp r5, r0 - bls _08027734 - subs r0, r5, r0 - b _08027736 - .pool -_08027734: - movs r0, 0 -_08027736: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80276C0 - - thumb_func_start sub_8027748 -sub_8027748: @ 8027748 - push {r4-r6,lr} - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x24 - ldrb r6, [r0] - movs r0, 0 - bl sub_80276C0 - adds r5, r0, 0 - movs r4, 0x1 - cmp r4, r6 - bcs _08027776 -_08027760: - adds r0, r4, 0 - bl sub_80276C0 - cmp r0, r5 - bls _0802776C - adds r5, r0, 0 -_0802776C: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r6 - bcc _08027760 -_08027776: - ldr r1, =0x000f4236 - adds r0, r5, 0 - bl sub_8027A38 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8027748 - - thumb_func_start sub_802778C -sub_802778C: @ 802778C - push {r4,r5,lr} - lsls r0, 24 - ldr r1, =gUnknown_02022C98 - ldr r2, [r1] - adds r1, r2, 0 - adds r1, 0x24 - ldrb r5, [r1] - lsrs r4, r0, 23 - adds r2, 0x4A - adds r0, r2, r4 - ldrh r3, [r0] - movs r1, 0 - cmp r1, r5 - bcs _080277C4 -_080277A8: - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r4, r0 - adds r0, r2, r0 - ldrh r0, [r0] - cmp r0, r3 - bls _080277BA - adds r3, r0, 0 -_080277BA: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, r5 - bcc _080277A8 -_080277C4: - adds r0, r3, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802778C - - thumb_func_start sub_80277D0 -sub_80277D0: @ 80277D0 - push {r4-r7,lr} - sub sp, 0x14 - lsls r0, 24 - lsrs r7, r0, 24 - movs r6, 0x1 - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x24 - ldrb r5, [r0] - movs r4, 0 - cmp r4, r5 - bcs _080277FE -_080277E8: - adds r0, r4, 0 - bl sub_80276C0 - lsls r1, r4, 2 - add r1, sp - str r0, [r1] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _080277E8 -_080277FE: - lsls r7, 2 - mov r12, r7 - cmp r6, 0 - beq _08027838 - subs r7, r5, 0x1 -_08027808: - movs r6, 0 - movs r4, 0 - cmp r6, r7 - bge _08027834 - adds r5, r7, 0 -_08027812: - lsls r0, r4, 2 - mov r2, sp - adds r1, r2, r0 - adds r4, 0x1 - lsls r0, r4, 2 - adds r3, r2, r0 - ldr r0, [r1] - ldr r2, [r3] - cmp r0, r2 - bcs _0802782C - str r2, [r1] - str r0, [r3] - movs r6, 0x1 -_0802782C: - lsls r0, r4, 24 - lsrs r4, r0, 24 - cmp r4, r5 - blt _08027812 -_08027834: - cmp r6, 0 - bne _08027808 -_08027838: - mov r0, sp - add r0, r12 - ldr r0, [r0] - add sp, 0x14 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80277D0 - - thumb_func_start sub_802784C -sub_802784C: @ 802784C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - movs r0, 0 - mov r10, r0 - mov r8, r0 - mov r9, r0 - ldr r6, =gUnknown_02022C98 - ldr r0, [r6] - adds r0, 0x24 - ldrb r5, [r0] - bl sub_8027748 - bl sub_8027748 - cmp r0, 0 - bne _080278A0 - movs r4, 0 - cmp r9, r5 - bcs _080278A0 - adds r2, r6, 0 - ldr r1, =0x00003308 - mov r12, r1 - movs r7, 0 - movs r6, 0x4 - ldr r3, =0x0000330c -_08027884: - ldr r0, [r2] - lsls r1, r4, 3 - adds r0, r1 - add r0, r12 - strb r6, [r0] - ldr r0, [r2] - adds r0, r3 - adds r0, r1 - str r7, [r0] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _08027884 -_080278A0: - movs r4, 0 - cmp r4, r5 - bcs _080278CA -_080278A6: - adds r0, r4, 0 - bl sub_80276C0 - ldr r1, =0x000f4236 - bl sub_8027A38 - ldr r1, =gUnknown_02022C98 - ldr r1, [r1] - lsls r2, r4, 3 - ldr r3, =0x0000330c - adds r1, r3 - adds r1, r2 - str r0, [r1] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _080278A6 -_080278CA: - mov r0, r10 - bl sub_80277D0 - adds r6, r0, 0 - mov r3, r8 - movs r4, 0 - cmp r4, r5 - bcs _08027916 - ldr r7, =gUnknown_02022C98 - mov r10, r7 -_080278DE: - mov r0, r10 - ldr r2, [r0] - lsls r1, r4, 3 - ldr r7, =0x0000330c - adds r0, r2, r7 - adds r0, r1 - ldr r0, [r0] - cmp r6, r0 - bne _0802790C - adds r0, r2, r1 - ldr r1, =0x00003308 - adds r0, r1 - strb r3, [r0] - mov r0, r8 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - mov r0, r9 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 -_0802790C: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _080278DE -_08027916: - mov r10, r8 - cmp r9, r5 - bcc _080278CA - movs r0, 0 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802784C - - thumb_func_start sub_802793C -sub_802793C: @ 802793C - lsls r1, 24 - ldr r2, =gUnknown_02022C98 - ldr r2, [r2] - lsrs r1, 21 - ldr r3, =0x00003308 - adds r2, r3 - adds r2, r1 - ldr r1, [r2] - ldr r2, [r2, 0x4] - str r1, [r0] - str r2, [r0, 0x4] - bx lr - .pool - thumb_func_end sub_802793C - - thumb_func_start sub_802795C -sub_802795C: @ 802795C - push {r4-r7,lr} - sub sp, 0x14 - lsls r0, 24 - lsrs r6, r0, 24 - movs r7, 0 - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x24 - ldrb r5, [r0] - mov r0, sp - movs r1, 0 - movs r2, 0x14 - bl memset - movs r4, 0 - cmp r7, r5 - bcs _08027994 -_0802797E: - adds r0, r4, 0 - bl sub_80276C0 - lsls r1, r4, 2 - add r1, sp - str r0, [r1] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _0802797E -_08027994: - lsls r0, r6, 2 - add r0, sp - ldr r1, [r0] - movs r4, 0 -_0802799C: - cmp r4, r6 - beq _080279B0 - lsls r0, r4, 2 - add r0, sp - ldr r0, [r0] - cmp r1, r0 - bcs _080279B0 - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 -_080279B0: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x4 - bls _0802799C - adds r0, r7, 0 - add sp, 0x14 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_802795C - - thumb_func_start sub_80279C8 -sub_80279C8: @ 80279C8 - push {r4-r6,lr} - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x28 - ldrb r4, [r0] - bl sub_802762C - lsls r0, 16 - lsrs r5, r0, 16 - adds r6, r5, 0 - adds r0, r4, 0 - bl sub_80276C0 - adds r4, r0, 0 - bl sub_8027748 - cmp r4, r0 - beq _080279F4 - movs r0, 0x3 - b _08027A22 - .pool -_080279F4: - adds r0, r5, 0 - movs r1, 0x1 - bl CheckBagHasSpace - lsls r0, 24 - cmp r0, 0 - bne _08027A06 - movs r0, 0x2 - b _08027A22 -_08027A06: - adds r0, r6, 0 - movs r1, 0x1 - bl AddBagItem - adds r0, r6, 0 - movs r1, 0x1 - bl CheckBagHasSpace - lsls r0, 24 - cmp r0, 0 - beq _08027A20 - movs r0, 0 - b _08027A22 -_08027A20: - movs r0, 0x1 -_08027A22: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80279C8 - - thumb_func_start sub_8027A28 -sub_8027A28: @ 8027A28 - push {lr} - adds r2, r0, 0 - adds r0, r1, 0 - cmp r2, r0 - bcs _08027A34 - adds r0, r2, 0x1 -_08027A34: - pop {r1} - bx r1 - thumb_func_end sub_8027A28 - - thumb_func_start sub_8027A38 -sub_8027A38: @ 8027A38 - push {lr} - adds r2, r0, 0 - adds r0, r1, 0 - cmp r2, r0 - bcs _08027A44 - adds r0, r2, 0 -_08027A44: - pop {r1} - bx r1 - thumb_func_end sub_8027A38 - - thumb_func_start sub_8027A48 -sub_8027A48: @ 8027A48 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02022C98 - ldr r1, [r1] - adds r1, 0x34 - adds r1, r0 - ldrb r0, [r1] - bx lr - .pool - thumb_func_end sub_8027A48 - - thumb_func_start sub_8027A5C -sub_8027A5C: @ 8027A5C - push {r4-r6,lr} - movs r5, 0 - ldr r6, =gSpecialVar_Result -_08027A62: - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0x5 - bl GetMonData - cmp r0, 0 - beq _08027A94 - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - cmp r0, 0x55 - bne _08027A94 - movs r0, 0x1 - strh r0, [r6] - b _08027AA0 - .pool -_08027A94: - adds r5, 0x1 - cmp r5, 0x5 - ble _08027A62 - ldr r1, =gSpecialVar_Result - movs r0, 0 - strh r0, [r1] -_08027AA0: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8027A5C - - thumb_func_start sub_8027AAC -sub_8027AAC: @ 8027AAC - push {r4,lr} - ldr r4, =sub_8027ACC - adds r0, r4, 0 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - bl _call_via_r4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8027AAC - - thumb_func_start sub_8027ACC -sub_8027ACC: @ 8027ACC - push {r4-r7,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r7, r0, r1 - movs r1, 0 - ldrsh r0, [r7, r1] - cmp r0, 0x1 - beq _08027B94 - cmp r0, 0x1 - bgt _08027AF4 - cmp r0, 0 - beq _08027AFE - b _08027BE2 - .pool -_08027AF4: - cmp r0, 0x2 - beq _08027BA0 - cmp r0, 0x3 - beq _08027BC8 - b _08027BE2 -_08027AFE: - ldr r0, =gUnknown_082F7B2C - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp] - str r1, [sp, 0x4] - ldr r1, =gText_BerryPickingRecords - movs r0, 0x1 - movs r2, 0 - bl GetStringWidth - adds r4, r0, 0 - movs r6, 0 - ldr r5, =gUnknown_082F7B34 -_08027B18: - ldr r1, [r5] - movs r0, 0x1 - movs r2, 0 - bl GetStringWidth - adds r0, 0x32 - cmp r0, r4 - ble _08027B2A - adds r4, r0, 0 -_08027B2A: - adds r5, 0x4 - adds r6, 0x1 - cmp r6, 0x2 - bls _08027B18 - adds r0, r4, 0x7 - cmp r0, 0 - bge _08027B3A - adds r0, 0x7 -_08027B3A: - asrs r4, r0, 3 - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _08027B46 - adds r4, 0x1 -_08027B46: - movs r1, 0x1E - subs r1, r4 - lsrs r0, r1, 31 - adds r1, r0 - asrs r1, 1 - lsls r1, 24 - lsrs r1, 16 - ldr r2, =0xffff00ff - ldr r0, [sp] - ands r0, r2 - orrs r0, r1 - lsls r2, r4, 24 - ldr r1, =0x00ffffff - ands r0, r1 - orrs r0, r2 - str r0, [sp] - mov r0, sp - bl AddWindow - strh r0, [r7, 0x2] - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl sub_8027BEC - ldrb r0, [r7, 0x2] - movs r1, 0x3 - b _08027BB6 - .pool -_08027B94: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _08027BE2 - b _08027BBA -_08027BA0: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _08027BE2 - ldrb r0, [r7, 0x2] - bl rbox_fill_rectangle - ldrb r0, [r7, 0x2] - movs r1, 0x1 -_08027BB6: - bl CopyWindowToVram -_08027BBA: - ldrh r0, [r7] - adds r0, 0x1 - strh r0, [r7] - b _08027BE2 - .pool -_08027BC8: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _08027BE2 - ldrb r0, [r7, 0x2] - bl RemoveWindow - adds r0, r4, 0 - bl DestroyTask - bl EnableBothScriptContexts -_08027BE2: - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8027ACC - - thumb_func_start sub_8027BEC -sub_8027BEC: @ 8027BEC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - str r1, [sp, 0x18] - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - movs r2, 0x84 - lsls r2, 2 - adds r0, r1, r2 - ldrh r0, [r0] - str r0, [sp, 0xC] - subs r2, 0x4 - adds r0, r1, r2 - ldr r0, [r0] - str r0, [sp, 0x10] - ldr r0, =0x00000212 - adds r1, r0 - ldrh r0, [r1] - str r0, [sp, 0x14] - ldr r4, =0x0000021d - adds r0, r7, 0 - adds r1, r4, 0 - movs r2, 0xD0 - bl LoadUserWindowBorderGfx_ - adds r0, r7, 0 - adds r1, r4, 0 - movs r2, 0xD - bl DrawTextBorderOuter - adds r0, r7, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r4, =gText_BerryPickingRecords - ldr r0, [sp, 0x18] - lsls r2, r0, 3 - movs r0, 0x1 - adds r1, r4, 0 - bl GetStringCenterAlignXOffset - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x1 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - adds r0, r7, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl AddTextPrinterParameterized - movs r6, 0 - ldr r2, =gStringVar1 - mov r8, r2 - movs r0, 0xFF - mov r10, r0 - mov r9, r6 - mov r2, sp - adds r2, 0xC - str r2, [sp, 0x1C] -_08027C76: - lsls r4, r6, 2 - ldr r0, [sp, 0x1C] - ldm r0!, {r1} - str r0, [sp, 0x1C] - ldr r0, =gUnknown_082F7B40 - adds r0, r6, r0 - ldrb r3, [r0] - mov r0, r8 - movs r2, 0 - bl ConvertIntToDecimalStringN - movs r0, 0x1 - mov r1, r8 - movs r2, 0x1 - negs r2, r2 - bl GetStringWidth - adds r5, r0, 0 - ldr r0, =gUnknown_082F7B34 - adds r4, r0 - ldr r2, [r4] - ldr r0, =gUnknown_082F7B44 - lsls r4, r6, 1 - adds r0, r4, r0 - ldrb r0, [r0] - str r0, [sp] - mov r0, r10 - str r0, [sp, 0x4] - mov r0, r9 - str r0, [sp, 0x8] - adds r0, r7, 0 - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldr r2, [sp, 0x18] - lsls r3, r2, 3 - subs r3, r5 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =gUnknown_082F7B4A - adds r4, r0 - ldrb r0, [r4] - str r0, [sp] - mov r0, r10 - str r0, [sp, 0x4] - mov r2, r9 - str r2, [sp, 0x8] - adds r0, r7, 0 - movs r1, 0x1 - mov r2, r8 - bl AddTextPrinterParameterized - adds r6, 0x1 - cmp r6, 0x2 - ble _08027C76 - adds r0, r7, 0 - bl PutWindowTilemap - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8027BEC - - thumb_func_start sub_8027D20 -sub_8027D20: @ 8027D20 - push {lr} - bl GetLinkPlayerCount - ldr r1, =gUnknown_02022C98 - ldr r1, [r1] - adds r1, 0x24 - strb r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8027D20 - - thumb_func_start sub_8027D38 -sub_8027D38: @ 8027D38 - push {r4-r7,lr} - ldr r0, =gUnknown_02022C98 - ldr r0, [r0] - adds r0, 0x24 - ldrb r4, [r0] - cmp r4, 0x4 - bhi _08027D66 - ldr r5, =gUnknown_082F7B90 -_08027D48: - lsls r0, r4, 3 - subs r0, r4 - lsls r0, 2 - ldr r1, =gLinkPlayers + 8 - adds r0, r1 - lsls r1, r4, 2 - adds r1, r5 - ldr r1, [r1] - bl StringCopy - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x4 - bls _08027D48 -_08027D66: - ldr r0, =gUnknown_02022C98 - ldr r1, [r0] - adds r1, 0x24 - movs r2, 0x5 - strb r2, [r1] - movs r1, 0 - mov r12, r0 -_08027D74: - movs r4, 0 - mov r2, r12 - ldr r0, [r2] - adds r0, 0x24 - adds r5, r1, 0x1 - ldrb r0, [r0] - cmp r4, r0 - bcs _08027DB2 - ldr r7, =gUnknown_02022C98 - lsls r3, r1, 1 - ldr r6, =gUnknown_082F7B50 -_08027D8A: - ldr r2, [r7] - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r0, r3, r0 - adds r1, r2, 0 - adds r1, 0x4A - adds r1, r0 - lsls r0, r4, 3 - adds r0, r3, r0 - adds r0, r6 - ldrh r0, [r0] - strh r0, [r1] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - adds r2, 0x24 - ldrb r2, [r2] - cmp r4, r2 - bcc _08027D8A -_08027DB2: - lsls r0, r5, 24 - lsrs r1, r0, 24 - cmp r1, 0x3 - bls _08027D74 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8027D38 - - thumb_func_start sub_8027DD0 -sub_8027DD0: @ 8027DD0 - push {lr} - sub sp, 0x8 - ldr r3, =0xffffff00 - ldr r1, [sp] - ands r1, r3 - movs r2, 0x1 - orrs r1, r2 - str r1, [sp] - lsls r0, 24 - lsrs r0, 24 - ldr r1, [sp, 0x4] - ands r1, r3 - orrs r1, r0 - str r1, [sp, 0x4] - mov r0, sp - bl sub_800FE50 - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8027DD0 - - thumb_func_start sub_8027DFC -sub_8027DFC: @ 8027DFC - push {lr} - adds r2, r0, 0 - ldr r3, =gRecvCmds - ldrh r0, [r3] - movs r1, 0xFF - lsls r1, 8 - ands r1, r0 - movs r0, 0xBC - lsls r0, 6 - cmp r1, r0 - bne _08027E1E - lsls r0, r2, 4 - adds r1, r3, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0x1 - beq _08027E28 -_08027E1E: - movs r0, 0 - b _08027E2A - .pool -_08027E28: - ldrb r0, [r1, 0x4] -_08027E2A: - pop {r1} - bx r1 - thumb_func_end sub_8027DFC - - thumb_func_start sub_8027E30 -sub_8027E30: @ 8027E30 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - ldr r4, [sp, 0x48] - lsls r4, 24 - str r4, [sp, 0x1C] - movs r4, 0x14 - adds r4, r0 - mov r9, r4 - mov r5, sp - movs r4, 0x2 - strb r4, [r5] - mov r10, sp - mov r5, r9 - ldrb r4, [r5, 0xB] - movs r7, 0xF - adds r5, r7, 0 - ands r5, r4 - mov r6, r10 - ldrb r6, [r6, 0x1] - mov r8, r6 - movs r4, 0x10 - negs r4, r4 - mov r6, r8 - ands r4, r6 - orrs r4, r5 - mov r5, r10 - strb r4, [r5, 0x1] - mov r8, sp - mov r6, r9 - ldrb r5, [r6, 0xC] - lsls r5, 4 - ands r4, r7 - orrs r4, r5 - mov r5, r8 - strb r4, [r5, 0x1] - ldrb r5, [r6, 0xD] - movs r6, 0xF - ands r5, r6 - mov r4, r10 - ldrb r4, [r4, 0x2] - mov r8, r4 - movs r4, 0x10 - negs r4, r4 - mov r6, r8 - ands r4, r6 - orrs r4, r5 - mov r5, r10 - strb r4, [r5, 0x2] - mov r8, sp - mov r6, r9 - ldrb r5, [r6, 0xE] - lsls r5, 4 - ands r4, r7 - orrs r4, r5 - mov r5, r8 - strb r4, [r5, 0x2] - ldrb r5, [r6, 0xF] - movs r6, 0xF - ands r5, r6 - mov r4, r10 - ldrb r4, [r4, 0x3] - mov r8, r4 - movs r4, 0x10 - negs r4, r4 - mov r6, r8 - ands r4, r6 - orrs r4, r5 - mov r5, r10 - strb r4, [r5, 0x3] - mov r8, sp - mov r6, r9 - ldrb r5, [r6, 0x10] - lsls r5, 4 - ands r4, r7 - orrs r4, r5 - mov r5, r8 - strb r4, [r5, 0x3] - ldrb r5, [r6, 0x11] - movs r6, 0xF - ands r5, r6 - mov r4, r10 - ldrb r4, [r4, 0x4] - mov r8, r4 - movs r4, 0x10 - negs r4, r4 - mov r6, r8 - ands r4, r6 - orrs r4, r5 - mov r5, r10 - strb r4, [r5, 0x4] - mov r8, sp - mov r6, r9 - ldrb r5, [r6, 0x12] - lsls r5, 4 - ands r4, r7 - orrs r4, r5 - mov r5, r8 - strb r4, [r5, 0x4] - ldrb r4, [r6, 0x13] - movs r6, 0xF - ands r4, r6 - mov r6, r8 - ldrb r5, [r6, 0x5] - movs r6, 0x10 - negs r6, r6 - ands r6, r5 - orrs r6, r4 - str r6, [sp, 0xC] - mov r4, r8 - strb r6, [r4, 0x5] - mov r5, sp - mov r6, r9 - ldrb r4, [r6, 0x14] - lsls r4, 4 - ldr r6, [sp, 0xC] - ands r6, r7 - orrs r6, r4 - strb r6, [r5, 0x5] - mov r7, sp - movs r4, 0x3 - mov r8, r4 - ldrb r0, [r0, 0x14] - mov r5, r8 - ands r0, r5 - ldrb r5, [r7, 0x6] - movs r6, 0x4 - negs r6, r6 - mov r10, r6 - mov r4, r10 - ands r4, r5 - orrs r4, r0 - strb r4, [r7, 0x6] - mov r5, r9 - ldrb r0, [r5, 0x1] - mov r6, r8 - ands r0, r6 - lsls r0, 2 - movs r5, 0xD - negs r5, r5 - ands r5, r4 - orrs r5, r0 - strb r5, [r7, 0x6] - mov r0, r9 - ldrb r4, [r0, 0x2] - ands r4, r6 - lsls r4, 4 - movs r0, 0x31 - negs r0, r0 - ands r0, r5 - orrs r0, r4 - strb r0, [r7, 0x6] - mov r5, sp - mov r6, r9 - ldrb r4, [r6, 0x3] - lsls r4, 6 - movs r6, 0x3F - ands r0, r6 - orrs r0, r4 - strb r0, [r5, 0x6] - mov r4, r9 - ldrb r0, [r4, 0x4] - mov r5, r8 - ands r0, r5 - ldrb r5, [r7, 0x7] - mov r4, r10 - ands r4, r5 - orrs r4, r0 - strb r4, [r7, 0x7] - mov r6, r9 - ldrb r0, [r6, 0x5] - mov r5, r8 - ands r0, r5 - lsls r0, 2 - movs r5, 0xD - negs r5, r5 - ands r5, r4 - orrs r5, r0 - strb r5, [r7, 0x7] - ldrb r4, [r6, 0x6] - mov r6, r8 - ands r4, r6 - lsls r4, 4 - movs r0, 0x31 - negs r0, r0 - ands r0, r5 - orrs r0, r4 - strb r0, [r7, 0x7] - mov r5, sp - mov r6, r9 - ldrb r4, [r6, 0x7] - lsls r4, 6 - movs r6, 0x3F - ands r0, r6 - orrs r0, r4 - strb r0, [r5, 0x7] - mov r8, sp - mov r0, r9 - ldrb r4, [r0, 0x8] - movs r7, 0x3 - adds r0, r7, 0 - ands r0, r4 - mov r4, r8 - ldrb r5, [r4, 0x8] - mov r4, r10 - ands r4, r5 - orrs r4, r0 - mov r5, r8 - strb r4, [r5, 0x8] - mov r6, r9 - ldrb r5, [r6, 0x9] - adds r0, r7, 0 - ands r0, r5 - lsls r0, 2 - movs r5, 0xD - negs r5, r5 - ands r5, r4 - orrs r5, r0 - mov r0, r8 - strb r5, [r0, 0x8] - ldrb r0, [r1] - adds r4, r7, 0 - ands r4, r0 - lsls r4, 4 - movs r0, 0x31 - negs r0, r0 - ands r0, r5 - orrs r0, r4 - mov r4, r8 - strb r0, [r4, 0x8] - mov r5, sp - ldrb r4, [r2] - lsls r4, 6 - movs r6, 0x3F - ands r0, r6 - orrs r0, r4 - strb r0, [r5, 0x8] - ldrb r4, [r3] - adds r0, r7, 0 - ands r0, r4 - ldrb r4, [r5, 0x9] - mov r6, r10 - ands r6, r4 - orrs r6, r0 - mov r10, r6 - strb r6, [r5, 0x9] - ldr r0, [sp, 0x40] - ldrb r4, [r0] - adds r0, r7, 0 - ands r0, r4 - lsls r0, 2 - movs r4, 0xD - negs r4, r4 - ands r6, r4 - orrs r6, r0 - str r6, [sp, 0x10] - strb r6, [r5, 0x9] - mov r4, sp - ldr r5, [sp, 0x44] - ldrb r0, [r5] - adds r6, r7, 0 - ands r6, r0 - lsls r0, r6, 4 - subs r7, 0x34 - ldr r5, [sp, 0x10] - ands r7, r5 - orrs r7, r0 - strb r7, [r4, 0x9] - mov r5, sp - ldrb r0, [r1, 0x4] - movs r6, 0x1 - mov r12, r6 - mov r4, r12 - ands r4, r0 - lsls r4, 6 - movs r0, 0x41 - negs r0, r0 - mov r10, r0 - ands r0, r7 - orrs r0, r4 - strb r0, [r5, 0x9] - ldrb r4, [r2, 0x4] - lsls r4, 7 - movs r5, 0x7F - ands r0, r5 - orrs r0, r4 - mov r4, r8 - strb r0, [r4, 0x9] - ldrb r4, [r3, 0x4] - mov r0, r12 - ands r0, r4 - mov r5, r8 - ldrb r4, [r5, 0xA] - movs r7, 0x2 - negs r7, r7 - adds r5, r7, 0 - ands r5, r4 - orrs r5, r0 - mov r6, r8 - strb r5, [r6, 0xA] - mov r9, sp - ldr r4, [sp, 0x40] - ldrb r0, [r4, 0x4] - mov r4, r12 - ands r4, r0 - lsls r4, 1 - movs r6, 0x3 - negs r6, r6 - mov r8, r6 - mov r0, r8 - ands r0, r5 - orrs r0, r4 - mov r4, r9 - strb r0, [r4, 0xA] - ldr r6, [sp, 0x44] - ldrb r5, [r6, 0x4] - mov r4, r12 - ands r4, r5 - lsls r4, 2 - movs r5, 0x5 - negs r5, r5 - ands r0, r5 - orrs r0, r4 - mov r4, r9 - strb r0, [r4, 0xA] - mov r4, sp - ldrb r1, [r1, 0x8] - mov r0, r12 - ands r0, r1 - lsls r0, 2 - ldrb r1, [r4, 0xB] - ands r5, r1 - orrs r5, r0 - strb r5, [r4, 0xB] - ldrb r1, [r2, 0x8] - mov r0, r12 - ands r0, r1 - lsls r0, 3 - movs r1, 0x9 - negs r1, r1 - ands r1, r5 - orrs r1, r0 - strb r1, [r4, 0xB] - ldrb r2, [r3, 0x8] - mov r0, r12 - ands r0, r2 - lsls r0, 4 - movs r2, 0x11 - negs r2, r2 - ands r2, r1 - orrs r2, r0 - strb r2, [r4, 0xB] - mov r3, sp - ldr r5, [sp, 0x40] - ldrb r0, [r5, 0x8] - mov r1, r12 - ands r1, r0 - lsls r1, 5 - movs r0, 0x21 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0xB] - mov r2, sp - ldrb r1, [r6, 0x8] - mov r6, r12 - ands r6, r1 - lsls r1, r6, 6 - mov r3, r10 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0xB] - ldr r4, [sp, 0x1C] - lsrs r3, r4, 21 - ldrb r1, [r2, 0xA] - movs r0, 0x7 - ands r0, r1 - orrs r0, r3 - strb r0, [r2, 0xA] - mov r1, sp - ldr r5, [sp, 0x4C] - movs r6, 0x1 - ands r5, r6 - lsls r2, r5, 1 - ldrb r0, [r1, 0xB] - mov r3, r8 - ands r3, r0 - orrs r3, r2 - mov r8, r3 - strb r3, [r1, 0xB] - mov r0, sp - ldr r4, [sp, 0x50] - ands r4, r6 - mov r5, r8 - ands r5, r7 - orrs r5, r4 - strb r5, [r0, 0xB] - bl sub_800FE50 - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8027E30 - - thumb_func_start sub_8028164 -sub_8028164: @ 8028164 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r7, r1, 0 - adds r5, r2, 0 - adds r6, r3, 0 - ldr r0, [sp, 0x1C] - mov r12, r0 - ldr r1, [sp, 0x20] - mov r8, r1 - ldr r0, [sp, 0x24] - mov r9, r0 - adds r2, r7, 0 - adds r2, 0x14 - ldr r4, =gRecvCmds - ldrh r0, [r4] - movs r1, 0xFF - lsls r1, 8 - ands r1, r0 - movs r0, 0xBC - lsls r0, 6 - cmp r1, r0 - bne _0802819C - adds r3, r4, 0x2 - ldrb r0, [r4, 0x2] - cmp r0, 0x2 - beq _080281A4 -_0802819C: - movs r0, 0 - b _080282DE - .pool -_080281A4: - ldrb r0, [r3, 0x1] - lsls r0, 28 - lsrs r0, 28 - strb r0, [r2, 0xB] - ldrb r0, [r3, 0x1] - lsrs r0, 4 - strb r0, [r2, 0xC] - ldrb r0, [r3, 0x2] - lsls r0, 28 - lsrs r0, 28 - strb r0, [r2, 0xD] - ldrb r0, [r3, 0x2] - lsrs r0, 4 - strb r0, [r2, 0xE] - ldrb r0, [r3, 0x3] - lsls r0, 28 - lsrs r0, 28 - strb r0, [r2, 0xF] - ldrb r0, [r3, 0x3] - lsrs r0, 4 - strb r0, [r2, 0x10] - ldrb r0, [r3, 0x4] - lsls r0, 28 - lsrs r0, 28 - strb r0, [r2, 0x11] - ldrb r0, [r3, 0x4] - lsrs r0, 4 - strb r0, [r2, 0x12] - ldrb r0, [r3, 0x5] - lsls r0, 28 - lsrs r0, 28 - strb r0, [r2, 0x13] - ldrb r0, [r3, 0x5] - lsrs r0, 4 - strb r0, [r2, 0x14] - ldrb r0, [r3, 0x1] - lsls r0, 28 - lsrs r0, 28 - strb r0, [r2, 0x15] - ldrb r0, [r3, 0x6] - lsls r0, 30 - lsrs r0, 30 - strb r0, [r7, 0x14] - ldrb r0, [r3, 0x6] - lsls r0, 28 - lsrs r0, 30 - strb r0, [r2, 0x1] - ldrb r0, [r3, 0x6] - lsls r0, 26 - lsrs r0, 30 - strb r0, [r2, 0x2] - ldrb r0, [r3, 0x6] - lsrs r0, 6 - strb r0, [r2, 0x3] - ldrb r0, [r3, 0x7] - lsls r0, 30 - lsrs r0, 30 - strb r0, [r2, 0x4] - ldrb r0, [r3, 0x7] - lsls r0, 28 - lsrs r0, 30 - strb r0, [r2, 0x5] - ldrb r0, [r3, 0x7] - lsls r0, 26 - lsrs r0, 30 - strb r0, [r2, 0x6] - ldrb r0, [r3, 0x7] - lsrs r0, 6 - strb r0, [r2, 0x7] - ldrb r0, [r3, 0x8] - lsls r0, 30 - lsrs r0, 30 - strb r0, [r2, 0x8] - ldrb r0, [r3, 0x8] - lsls r0, 28 - lsrs r0, 30 - strb r0, [r2, 0x9] - ldrb r0, [r3, 0x6] - lsls r0, 30 - lsrs r0, 30 - strb r0, [r2, 0xA] - ldrb r0, [r3, 0x8] - lsls r0, 26 - lsrs r0, 30 - strb r0, [r5] - ldrb r0, [r3, 0x9] - lsls r0, 25 - lsrs r0, 31 - strb r0, [r5, 0x4] - ldrb r0, [r3, 0xB] - lsls r0, 29 - lsrs r0, 31 - strb r0, [r5, 0x8] - ldrb r0, [r3, 0x8] - lsrs r0, 6 - strb r0, [r6] - ldrb r0, [r3, 0x9] - lsrs r0, 7 - strb r0, [r6, 0x4] - ldrb r0, [r3, 0xB] - lsls r0, 28 - lsrs r0, 31 - strb r0, [r6, 0x8] - ldrb r0, [r3, 0x9] - lsls r0, 30 - lsrs r0, 30 - mov r1, r12 - strb r0, [r1] - ldrb r0, [r3, 0xA] - lsls r0, 31 - lsrs r0, 31 - strb r0, [r1, 0x4] - ldrb r0, [r3, 0xB] - lsls r0, 27 - lsrs r0, 31 - strb r0, [r1, 0x8] - ldrb r0, [r3, 0x9] - lsls r0, 28 - lsrs r0, 30 - mov r1, r8 - strb r0, [r1] - ldrb r0, [r3, 0xA] - lsls r0, 30 - lsrs r0, 31 - strb r0, [r1, 0x4] - ldrb r0, [r3, 0xB] - lsls r0, 26 - lsrs r0, 31 - strb r0, [r1, 0x8] - ldrb r0, [r3, 0x9] - lsls r0, 26 - lsrs r0, 30 - mov r1, r9 - strb r0, [r1] - ldrb r0, [r3, 0xA] - lsls r0, 29 - lsrs r0, 31 - strb r0, [r1, 0x4] - ldrb r0, [r3, 0xB] - lsls r0, 25 - lsrs r0, 31 - strb r0, [r1, 0x8] - ldrb r0, [r3, 0xA] - lsrs r0, 3 - ldr r1, [sp, 0x28] - strb r0, [r1] - ldrb r0, [r3, 0xB] - lsls r0, 30 - lsrs r0, 31 - ldr r1, [sp, 0x2C] - str r0, [r1] - ldrb r0, [r3, 0xB] - lsls r0, 31 - lsrs r0, 31 - ldr r1, [sp, 0x30] - str r0, [r1] - movs r0, 0x1 -_080282DE: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8028164 - - thumb_func_start sub_80282EC -sub_80282EC: @ 80282EC - push {lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - ldr r3, =0xffffff00 - ldr r1, [sp] - ands r1, r3 - movs r2, 0x3 - orrs r1, r2 - str r1, [sp] - ldr r1, [sp, 0x4] - ands r1, r3 - orrs r1, r0 - str r1, [sp, 0x4] - mov r0, sp - bl sub_800FE50 - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80282EC - - thumb_func_start sub_8028318 -sub_8028318: @ 8028318 - push {r4,lr} - adds r2, r0, 0 - adds r4, r1, 0 - ldr r3, =gRecvCmds - ldrh r0, [r3] - movs r1, 0xFF - lsls r1, 8 - ands r1, r0 - movs r0, 0xBC - lsls r0, 6 - cmp r1, r0 - bne _0802833C - lsls r0, r2, 4 - adds r1, r3, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0x3 - beq _08028344 -_0802833C: - movs r0, 0 - b _0802834A - .pool -_08028344: - ldrb r0, [r1, 0x4] - strb r0, [r4] - movs r0, 0x1 -_0802834A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8028318 - - thumb_func_start sub_8028350 -sub_8028350: @ 8028350 - push {lr} - sub sp, 0x8 - ldr r2, =0xffffff00 - ldr r1, [sp] - ands r1, r2 - movs r2, 0x4 - orrs r1, r2 - str r1, [sp] - str r0, [sp, 0x4] - mov r0, sp - bl sub_800FE50 - add sp, 0x8 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028350 - - thumb_func_start sub_8028374 -sub_8028374: @ 8028374 - push {lr} - adds r2, r0, 0 - ldr r3, =gRecvCmds - ldrh r0, [r3] - movs r1, 0xFF - lsls r1, 8 - ands r1, r0 - movs r0, 0xBC - lsls r0, 6 - cmp r1, r0 - bne _08028396 - lsls r0, r2, 4 - adds r1, r3, 0x2 - adds r1, r0, r1 - ldrb r0, [r1] - cmp r0, 0x4 - beq _080283A0 -_08028396: - movs r0, 0 - b _080283A2 - .pool -_080283A0: - ldr r0, [r1, 0x4] -_080283A2: - pop {r1} - bx r1 - thumb_func_end sub_8028374 - - thumb_func_start sub_80283A8 -sub_80283A8: @ 80283A8 - push {r4,r5,lr} - sub sp, 0x18 - movs r5, 0xC0 - lsls r5, 6 - adds r0, r5, 0 - bl AllocZeroed - adds r4, r0, 0 - ldr r0, =gUnknown_082FB2D8 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x8] - str r1, [sp, 0xC] - ldr r0, =gUnknown_082FB2E0 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x10] - str r1, [sp, 0x14] - ldr r0, =gDodrioBerryPkmnGfx - adds r1, r4, 0 - bl LZ77UnCompWram - cmp r4, 0 - beq _080283E8 - str r4, [sp] - str r5, [sp, 0x4] - mov r0, sp - bl LoadSpriteSheet - adds r0, r4, 0 - bl Free -_080283E8: - add r0, sp, 0x8 - bl LoadSpritePalette - add r0, sp, 0x10 - bl LoadSpritePalette - add sp, 0x18 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80283A8 - - thumb_func_start sub_8028408 -sub_8028408: @ 8028408 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x30 - adds r6, r1, 0 - mov r8, r2 - adds r5, r3, 0 - lsls r6, 24 - lsrs r6, 24 - mov r1, r8 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - lsls r5, 24 - lsrs r5, 24 - add r1, sp, 0x18 - movs r3, 0 - strh r3, [r1] - ldrb r2, [r0] - mov r0, sp - adds r0, 0x1A - strh r2, [r0] - ldr r0, =gUnknown_082FB1E0 - str r0, [sp, 0x1C] - ldr r0, =gUnknown_082FB228 - str r0, [sp, 0x20] - str r3, [sp, 0x24] - ldr r0, =gDummySpriteAffineAnimTable - str r0, [sp, 0x28] - ldr r0, =sub_80284A8 - str r0, [sp, 0x2C] - mov r0, sp - movs r2, 0x18 - bl memcpy - movs r0, 0x4 - bl AllocZeroed - ldr r1, =gUnknown_02022C9C - mov r2, r8 - lsls r4, r2, 2 - adds r4, r1 - str r0, [r4] - adds r0, r6, 0 - adds r1, r5, 0 - bl sub_8028F14 - adds r1, r0, 0 - lsls r1, 16 - asrs r1, 16 - mov r0, sp - movs r2, 0x88 - movs r3, 0x3 - bl CreateSprite - ldr r1, [r4] - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1] - movs r0, 0x1 - mov r1, r8 - bl sub_8028654 - add sp, 0x30 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028408 - - thumb_func_start sub_80284A8 -sub_80284A8: @ 80284A8 - push {lr} - movs r2, 0x2E - ldrsh r1, [r0, r2] - cmp r1, 0x1 - beq _080284BC - cmp r1, 0x1 - ble _080284C6 - cmp r1, 0x2 - beq _080284C2 - b _080284C6 -_080284BC: - bl sub_802853C - b _080284C6 -_080284C2: - bl sub_80285AC -_080284C6: - pop {r0} - bx r0 - thumb_func_end sub_80284A8 - - thumb_func_start sub_80284CC -sub_80284CC: @ 80284CC - push {lr} - bl GetMultiplayerId - ldr r1, =gUnknown_02022C9C - lsls r0, 24 - lsrs r0, 22 - adds r0, r1 - ldr r0, [r0] - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r2, 0 - movs r1, 0x1 - strh r1, [r0, 0x2E] - strh r2, [r0, 0x30] - strh r2, [r0, 0x32] - strh r2, [r0, 0x34] - strh r2, [r0, 0x36] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80284CC - - thumb_func_start sub_8028504 -sub_8028504: @ 8028504 - push {lr} - bl GetMultiplayerId - ldr r1, =gUnknown_02022C9C - lsls r0, 24 - lsrs r0, 22 - adds r0, r1 - ldr r0, [r0] - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r2, 0 - movs r1, 0x2 - strh r1, [r0, 0x2E] - strh r2, [r0, 0x30] - strh r2, [r0, 0x32] - strh r2, [r0, 0x34] - strh r2, [r0, 0x36] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028504 - - thumb_func_start sub_802853C -sub_802853C: @ 802853C - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r2, r0, 16 - lsrs r0, 31 - adds r0, r2, r0 - asrs r1, r0, 1 - adds r0, r1, 0 - cmp r1, 0 - bge _08028558 - adds r0, r1, 0x3 -_08028558: - asrs r0, 2 - lsls r0, 2 - subs r0, r1, r0 - lsls r0, 24 - lsrs r0, 24 - cmp r2, 0x2 - ble _080285A2 - cmp r0, 0x2 - bgt _0802856E - cmp r0, 0x1 - bge _08028572 -_0802856E: - movs r0, 0x1 - b _08028574 -_08028572: - movs r0, 0xFF -_08028574: - lsls r0, 24 - asrs r0, 24 - ldrh r1, [r4, 0x20] - adds r0, r1 - strh r0, [r4, 0x20] - ldrh r0, [r4, 0x30] - adds r0, 0x1 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x27 - ble _080285A2 - movs r0, 0 - strh r0, [r4, 0x2E] - bl sub_8027650 - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0 - bl sub_8028F14 - strh r0, [r4, 0x20] -_080285A2: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_802853C - - thumb_func_start sub_80285AC -sub_80285AC: @ 80285AC - push {r4,r5,lr} - adds r5, r0, 0 - ldrh r0, [r5, 0x30] - adds r0, 0x1 - strh r0, [r5, 0x30] - lsls r0, 16 - asrs r0, 16 - movs r1, 0xD - bl __divsi3 - lsls r0, 16 - asrs r1, r0, 16 - adds r0, r1, 0 - cmp r1, 0 - bge _080285CC - adds r0, r1, 0x3 -_080285CC: - asrs r0, 2 - lsls r0, 2 - subs r0, r1, r0 - lsls r0, 24 - lsrs r4, r0, 24 - movs r1, 0x30 - ldrsh r0, [r5, r1] - movs r1, 0xD - bl __modsi3 - lsls r0, 16 - cmp r0, 0 - bne _080285F0 - cmp r4, 0 - beq _080285F0 - movs r0, 0xD4 - bl PlaySE -_080285F0: - movs r1, 0x30 - ldrsh r0, [r5, r1] - cmp r0, 0x67 - ble _080285FE - movs r0, 0 - strh r0, [r5, 0x2E] - movs r4, 0 -_080285FE: - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl sub_80286B4 - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80285AC - - thumb_func_start sub_8028614 -sub_8028614: @ 8028614 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 - cmp r4, r5 - bcs _08028646 - ldr r6, =gUnknown_02022C9C -_08028622: - lsls r0, r4, 2 - adds r0, r6 - ldr r0, [r0] - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - cmp r0, 0 - beq _0802863C - bl DestroySpriteAndFreeResources -_0802863C: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _08028622 -_08028646: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028614 - - thumb_func_start sub_8028654 -sub_8028654: @ 8028654 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - ldr r3, =gSprites - ldr r2, =gUnknown_02022C9C - lsrs r1, 22 - adds r1, r2 - ldr r1, [r1] - ldrh r1, [r1] - lsls r2, r1, 4 - adds r2, r1 - lsls r2, 2 - adds r2, r3 - adds r2, 0x3E - movs r1, 0x1 - ands r0, r1 - lsls r0, 2 - ldrb r3, [r2] - movs r1, 0x5 - negs r1, r1 - ands r1, r3 - orrs r1, r0 - strb r1, [r2] - bx lr - .pool - thumb_func_end sub_8028654 - - thumb_func_start sub_802868C -sub_802868C: @ 802868C - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - movs r4, 0 - cmp r4, r5 - bcs _080286AE -_0802869C: - adds r0, r6, 0 - adds r1, r4, 0 - bl sub_8028654 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r5 - bcc _0802869C -_080286AE: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_802868C - - thumb_func_start sub_80286B4 -sub_80286B4: @ 80286B4 - push {lr} - lsls r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gUnknown_02022C9C - lsrs r0, 22 - adds r0, r2 - ldr r0, [r0] - ldrh r2, [r0] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - ldr r2, =gSprites - adds r0, r2 - bl StartSpriteAnim - pop {r0} - bx r0 - .pool - thumb_func_end sub_80286B4 - - thumb_func_start nullsub_15 -nullsub_15: @ 80286E0 - bx lr - thumb_func_end nullsub_15 - - thumb_func_start sub_80286E4 -sub_80286E4: @ 80286E4 - push {r4-r7,lr} - movs r4, 0 - ldr r0, =gSprites - mov r12, r0 - movs r6, 0 - ldr r5, =gUnknown_02022CF4 -_080286F0: - ldr r3, [r5] - lsls r1, r4, 1 - adds r0, r3, 0 - adds r0, 0x2A - adds r0, r1 - ldrh r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - add r1, r12 - lsls r0, r4, 4 - adds r0, 0x30 - strh r0, [r1, 0x20] - lsls r2, r4, 3 - movs r7, 0x8 - negs r7, r7 - adds r0, r7, 0 - subs r0, r2 - strh r0, [r1, 0x22] - adds r3, 0xC - adds r3, r4 - strb r6, [r3] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x9 - bls _080286F0 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80286E4 - - thumb_func_start sub_8028734 -sub_8028734: @ 8028734 - push {r4-r6,lr} - sub sp, 0x28 - movs r4, 0xC0 - lsls r4, 1 - adds r0, r4, 0 - bl AllocZeroed - adds r6, r0, 0 - ldr r0, =gUnknown_082FB2E8 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x20] - str r1, [sp, 0x24] - ldr r0, =gDodrioBerryStatusGfx - adds r1, r6, 0 - bl LZ77UnCompWram - cmp r6, 0 - beq _080287C4 - str r6, [sp, 0x18] - add r5, sp, 0x18 - movs r0, 0x80 - lsls r0, 9 - orrs r0, r4 - str r0, [r5, 0x4] - mov r1, sp - ldr r0, =gUnknown_082FB2F0 - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldr r4, =gUnknown_02022CF4 - movs r0, 0x40 - bl AllocZeroed - str r0, [r4] - adds r0, r5, 0 - bl LoadSpriteSheet - add r0, sp, 0x20 - bl LoadSpritePalette - movs r4, 0 -_0802878A: - lsls r1, r4, 20 - movs r0, 0xC0 - lsls r0, 14 - adds r1, r0 - asrs r1, 16 - lsls r0, r4, 3 - movs r3, 0x8 - negs r3, r3 - adds r2, r3, 0 - subs r2, r0 - lsls r2, 16 - asrs r2, 16 - mov r0, sp - movs r3, 0 - bl CreateSprite - ldr r1, =gUnknown_02022CF4 - ldr r1, [r1] - lsls r2, r4, 1 - adds r1, 0x2A - adds r1, r2 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x9 - bls _0802878A -_080287C4: - adds r0, r6, 0 - bl Free - add sp, 0x28 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028734 - - thumb_func_start sub_80287E4 -sub_80287E4: @ 80287E4 - push {r4,r5,lr} - movs r4, 0 -_080287E8: - ldr r5, =gUnknown_02022CF4 - ldr r0, [r5] - lsls r1, r4, 1 - adds r0, 0x2A - adds r0, r1 - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - cmp r0, 0 - beq _08028806 - bl DestroySpriteAndFreeResources -_08028806: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x9 - bls _080287E8 - ldr r0, [r5] - bl Free - movs r0, 0 - str r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80287E4 - - thumb_func_start sub_8028828 -sub_8028828: @ 8028828 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - movs r3, 0 - movs r6, 0 - ldr r0, =gUnknown_02022CF4 - mov r9, r0 -_0802883A: - mov r7, r9 - ldr r2, [r7] - lsls r5, r6, 1 - adds r0, r2, 0 - adds r0, 0x2A - adds r0, r5 - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r4, r0, r1 - adds r0, r2, 0 - adds r0, 0x16 - adds r0, r5 - movs r1, 0x2 - strh r1, [r0] - adds r0, r2, 0 - adds r0, 0xC - adds r2, r0, r6 - ldrb r1, [r2] - cmp r1, 0 - beq _08028870 - movs r7, 0x22 - ldrsh r0, [r4, r7] - cmp r0, 0x8 - beq _080288A6 -_08028870: - movs r3, 0x1 - movs r7, 0x22 - ldrsh r0, [r4, r7] - cmp r0, 0x8 - bne _08028896 - cmp r1, 0 - bne _080288A6 - strb r3, [r2] - mov r1, r9 - ldr r0, [r1] - adds r0, 0x16 - adds r0, r5 - ldr r1, =0x0000fff0 - strh r1, [r0] - movs r0, 0x24 - str r3, [sp] - bl PlaySE - ldr r3, [sp] -_08028896: - mov r7, r9 - ldr r0, [r7] - adds r0, 0x16 - adds r0, r5 - ldrh r0, [r0] - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r4, 0x22] -_080288A6: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x9 - bls _0802883A - cmp r3, 0 - bne _080288C4 - movs r0, 0x1 - b _080288C6 - .pool -_080288C4: - movs r0, 0 -_080288C6: - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8028828 - - thumb_func_start sub_80288D4 -sub_80288D4: @ 80288D4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0xA - bls _08028910 - movs r4, 0 -_080288E0: - ldr r0, =gUnknown_02022CF4 - ldr r0, [r0] - lsls r1, r4, 1 - adds r0, 0x2A - adds r0, r1 - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0x1 - bl StartSpriteAnim - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x9 - bls _080288E0 - b _080289DA - .pool -_08028910: - movs r4, 0 - movs r0, 0xA - subs r0, r5 - cmp r4, r0 - bge _080289D6 - ldr r6, =gSprites -_0802891C: - cmp r5, 0x6 - bls _08028984 - ldr r0, =gUnknown_02022CF4 - ldr r2, [r0] - ldr r1, =0x0000fffa - adds r0, r1, 0 - ldrh r1, [r2, 0x3E] - adds r0, r1 - adds r0, r5 - movs r1, 0 - strh r0, [r2, 0x3E] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1E - bls _0802894C - strh r1, [r2, 0x3E] - b _0802899E - .pool -_0802894C: - cmp r0, 0xA - bls _0802896A - lsls r1, r4, 1 - adds r0, r2, 0 - adds r0, 0x2A - adds r0, r1 - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0x2 - bl StartSpriteAnim - b _0802899E -_0802896A: - lsls r1, r4, 1 - adds r0, r2, 0 - adds r0, 0x2A - adds r0, r1 - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0 - bl StartSpriteAnim - b _0802899E -_08028984: - ldr r0, =gUnknown_02022CF4 - ldr r0, [r0] - lsls r1, r4, 1 - adds r0, 0x2A - adds r0, r1 - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0 - bl StartSpriteAnim -_0802899E: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - movs r0, 0xA - subs r0, r5 - cmp r4, r0 - blt _0802891C - b _080289D6 - .pool -_080289B4: - ldr r0, =gUnknown_02022CF4 - ldr r0, [r0] - lsls r1, r4, 1 - adds r0, 0x2A - adds r0, r1 - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0x1 - bl StartSpriteAnim - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_080289D6: - cmp r4, 0x9 - bls _080289B4 -_080289DA: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80288D4 - - thumb_func_start sub_80289E8 -sub_80289E8: @ 80289E8 - push {r4-r7,lr} - lsls r0, 24 - lsrs r0, 24 - movs r3, 0 - ldr r7, =gSprites - movs r1, 0x1 - ands r0, r1 - lsls r4, r0, 2 - movs r6, 0x5 - negs r6, r6 - ldr r5, =gUnknown_02022CF4 -_080289FE: - ldr r0, [r5] - lsls r1, r3, 1 - adds r0, 0x2A - adds r0, r1 - ldrh r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r7 - adds r1, 0x3E - ldrb r2, [r1] - adds r0, r6, 0 - ands r0, r2 - orrs r0, r4 - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x9 - bls _080289FE - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80289E8 - - thumb_func_start sub_8028A34 -sub_8028A34: @ 8028A34 - push {r4,r5,lr} - sub sp, 0x10 - movs r5, 0x90 - lsls r5, 3 - adds r0, r5, 0 - bl AllocZeroed - adds r4, r0, 0 - ldr r0, =gUnknown_082FB314 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x8] - str r1, [sp, 0xC] - ldr r0, =gDodrioBerrySpritesGfx - adds r1, r4, 0 - bl LZ77UnCompWram - cmp r4, 0 - beq _08028A6A - str r4, [sp] - movs r0, 0x80 - lsls r0, 10 - orrs r0, r5 - str r0, [sp, 0x4] - mov r0, sp - bl LoadSpriteSheet -_08028A6A: - add r0, sp, 0x8 - bl LoadSpritePalette - adds r0, r4, 0 - bl Free - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028A34 - - thumb_func_start sub_8028A88 -sub_8028A88: @ 8028A88 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x30 - mov r1, sp - ldr r0, =gUnknown_082FB324 - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - add r2, sp, 0x18 - adds r1, r2, 0 - ldr r0, =gUnknown_082FB33C - ldm r0!, {r3-r5} - stm r1!, {r3-r5} - ldm r0!, {r3-r5} - stm r1!, {r3-r5} - movs r5, 0 - mov r9, r2 -_08028AB0: - movs r0, 0x4 - bl AllocZeroed - ldr r1, =gUnknown_02022CB8 - lsls r4, r5, 2 - adds r4, r1 - str r0, [r4] - lsls r0, r5, 3 - lsls r1, r5, 4 - adds r1, r0 - mov r0, sp - movs r2, 0x8 - movs r3, 0x1 - bl CreateSprite - ldr r1, [r4] - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1] - adds r0, r5, 0 - movs r1, 0x1 - bl sub_8028BF8 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0xA - bls _08028AB0 - movs r5, 0 - ldr r7, =gUnknown_02022CE4 - ldr r4, =gUnknown_082FB31C - mov r8, r4 -_08028AF0: - movs r0, 0x4 - bl AllocZeroed - lsls r1, r5, 2 - adds r4, r1, r7 - str r0, [r4] - adds r6, r1, 0 - cmp r5, 0x3 - bne _08028B2C - mov r0, r8 - movs r2, 0x6 - ldrsh r1, [r0, r2] - mov r0, r9 - movs r2, 0x31 - movs r3, 0 - bl CreateSprite - ldr r1, [r7, 0xC] - b _08028B40 - .pool -_08028B2C: - lsls r0, r5, 1 - add r0, r8 - movs r3, 0 - ldrsh r1, [r0, r3] - mov r0, r9 - movs r2, 0x34 - movs r3, 0 - bl CreateSprite - ldr r1, [r4] -_08028B40: - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1] - adds r0, r6, r7 - ldr r0, [r0] - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - adds r1, r5, 0 - bl StartSpriteAnim - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _08028AF0 - movs r0, 0x1 - bl sub_8028C30 - add sp, 0x30 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028A88 - - thumb_func_start sub_8028B80 -sub_8028B80: @ 8028B80 - push {r4-r6,lr} - movs r5, 0 - ldr r6, =gUnknown_02022CB8 -_08028B86: - lsls r0, r5, 2 - adds r4, r0, r6 - ldr r0, [r4] - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - cmp r0, 0 - beq _08028BA0 - bl DestroySprite -_08028BA0: - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0xA - bls _08028B86 - movs r5, 0 - ldr r6, =gUnknown_02022CE4 -_08028BB8: - lsls r0, r5, 2 - adds r4, r0, r6 - ldr r0, [r4] - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - cmp r0, 0 - beq _08028BD2 - bl DestroySprite -_08028BD2: - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _08028BB8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028B80 - - thumb_func_start sub_8028BF8 -sub_8028BF8: @ 8028BF8 - lsls r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r3, =gSprites - ldr r2, =gUnknown_02022CB8 - lsrs r0, 22 - adds r0, r2 - ldr r0, [r0] - ldrh r0, [r0] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r3 - adds r2, 0x3E - movs r0, 0x1 - ands r1, r0 - lsls r1, 2 - ldrb r3, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - bx lr - .pool - thumb_func_end sub_8028BF8 - - thumb_func_start sub_8028C30 -sub_8028C30: @ 8028C30 - push {r4-r7,lr} - lsls r0, 24 - lsrs r0, 24 - movs r3, 0 - ldr r7, =gSprites - ldr r6, =gUnknown_02022CE4 - movs r1, 0x1 - ands r0, r1 - lsls r4, r0, 2 - movs r5, 0x5 - negs r5, r5 -_08028C46: - lsls r0, r3, 2 - adds r0, r6 - ldr r0, [r0] - ldrh r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r7 - adds r1, 0x3E - ldrb r2, [r1] - adds r0, r5, 0 - ands r0, r2 - orrs r0, r4 - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _08028C46 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028C30 - - thumb_func_start sub_8028C7C -sub_8028C7C: @ 8028C7C - lsls r0, 24 - lsls r1, 24 - ldr r3, =gSprites - ldr r2, =gUnknown_02022CB8 - lsrs r0, 22 - adds r0, r2 - ldr r0, [r0] - ldrh r2, [r0] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - adds r0, r3 - lsrs r1, 21 - strh r1, [r0, 0x22] - bx lr - .pool - thumb_func_end sub_8028C7C - - thumb_func_start sub_8028CA4 -sub_8028CA4: @ 8028CA4 - push {lr} - lsls r0, 16 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gUnknown_02022CB8 - lsrs r0, 14 - adds r0, r2 - ldr r0, [r0] - ldrh r2, [r0] - lsls r0, r2, 4 - adds r0, r2 - lsls r0, 2 - ldr r2, =gSprites - adds r0, r2 - bl StartSpriteAnim - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028CA4 - - thumb_func_start sub_8028CD0 -sub_8028CD0: @ 8028CD0 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSprites - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r1 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 2 - adds r1, 0x32 - strh r1, [r2, 0x20] - movs r0, 0x32 - strh r0, [r2, 0x22] - bx lr - .pool - thumb_func_end sub_8028CD0 - - thumb_func_start sub_8028CF4 -sub_8028CF4: @ 8028CF4 - push {r4-r7,lr} - adds r4, r0, 0 - adds r0, 0x42 - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0x1 - beq _08028D36 - movs r3, 0 - ldr r7, =gUnknown_082FB354 - ldr r6, =gUnknown_02022CB0 - movs r5, 0 -_08028D0A: - lsls r0, r3, 2 - adds r2, r0, r6 - ldr r1, [r2] - ldrh r0, [r1, 0x2] - adds r0, 0x1 - strh r0, [r1, 0x2] - adds r1, r3, r7 - lsls r0, 16 - lsrs r0, 16 - ldrb r1, [r1] - cmp r0, r1 - bls _08028D2C - ldrh r0, [r4, 0x20] - subs r0, 0x1 - strh r0, [r4, 0x20] - ldr r0, [r2] - strh r5, [r0, 0x2] -_08028D2C: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x1 - bls _08028D0A -_08028D36: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028CF4 - - thumb_func_start sub_8028D44 -sub_8028D44: @ 8028D44 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x28 - movs r4, 0x80 - lsls r4, 3 - adds r0, r4, 0 - bl AllocZeroed - adds r6, r0, 0 - ldr r0, =gUnknown_082FB360 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x20] - str r1, [sp, 0x24] - ldr r0, =gDodrioBerryPlatformGfx - adds r1, r6, 0 - bl LZ77UnCompWram - cmp r6, 0 - beq _08028DD2 - str r6, [sp, 0x18] - add r0, sp, 0x18 - movs r1, 0xA0 - lsls r1, 11 - orrs r1, r4 - str r1, [r0, 0x4] - mov r2, sp - ldr r1, =gUnknown_082FB368 - ldm r1!, {r3-r5} - stm r2!, {r3-r5} - ldm r1!, {r3-r5} - stm r2!, {r3-r5} - bl LoadSpriteSheet - add r0, sp, 0x20 - bl LoadSpritePalette - movs r5, 0 - ldr r7, =gUnknown_082FB356 - adds r0, r7, 0x2 - mov r9, r0 - ldr r1, =gUnknown_02022CB0 - mov r8, r1 -_08028D9E: - movs r0, 0x4 - bl AllocZeroed - lsls r2, r5, 2 - mov r3, r8 - adds r4, r2, r3 - str r0, [r4] - adds r0, r2, r7 - movs r3, 0 - ldrsh r1, [r0, r3] - add r2, r9 - movs r0, 0 - ldrsh r2, [r2, r0] - mov r0, sp - movs r3, 0x4 - bl CreateSprite - ldr r1, [r4] - lsls r0, 24 - lsrs r0, 24 - strh r0, [r1] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x1 - bls _08028D9E -_08028DD2: - adds r0, r6, 0 - bl Free - add sp, 0x28 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028D44 - - thumb_func_start sub_8028DFC -sub_8028DFC: @ 8028DFC - push {r4-r7,lr} - movs r3, 0 - ldr r0, =gUnknown_02022CB0 - mov r12, r0 - ldr r4, =gUnknown_082FB356 - adds r7, r4, 0x2 - ldr r6, =gSprites - movs r5, 0x1 -_08028E0C: - lsls r2, r3, 2 - mov r1, r12 - adds r0, r2, r1 - ldr r0, [r0] - ldrh r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - adds r0, r1, 0 - adds r0, 0x42 - strh r5, [r0] - adds r0, r2, r4 - ldrh r0, [r0] - strh r0, [r1, 0x20] - adds r2, r7 - ldrh r0, [r2] - strh r0, [r1, 0x22] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x1 - bls _08028E0C - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028DFC - - thumb_func_start sub_8028E4C -sub_8028E4C: @ 8028E4C - push {r4,r5,lr} - movs r2, 0 - ldr r5, =gUnknown_02022CB0 - ldr r4, =gSprites - movs r3, 0 -_08028E56: - lsls r0, r2, 2 - adds r0, r5 - ldr r0, [r0] - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x42 - strh r3, [r0] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x1 - bls _08028E56 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028E4C - - thumb_func_start sub_8028E84 -sub_8028E84: @ 8028E84 - push {r4-r6,lr} - movs r5, 0 - ldr r6, =gUnknown_02022CB0 -_08028E8A: - lsls r0, r5, 2 - adds r4, r0, r6 - ldr r0, [r4] - ldrh r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - cmp r0, 0 - beq _08028EA4 - bl DestroySprite -_08028EA4: - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x1 - bls _08028E8A - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028E84 - - thumb_func_start sub_8028EC8 -sub_8028EC8: @ 8028EC8 - push {r4-r7,lr} - lsls r0, 24 - lsrs r0, 24 - movs r3, 0 - ldr r7, =gSprites - ldr r6, =gUnknown_02022CB0 - movs r1, 0x1 - ands r0, r1 - lsls r4, r0, 2 - movs r5, 0x5 - negs r5, r5 -_08028EDE: - lsls r0, r3, 2 - adds r0, r6 - ldr r0, [r0] - ldrh r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r7 - adds r1, 0x3E - ldrb r2, [r1] - adds r0, r5, 0 - ands r0, r2 - orrs r0, r4 - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x1 - bls _08028EDE - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8028EC8 - - thumb_func_start sub_8028F14 -sub_8028F14: @ 8028F14 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - lsls r1, 24 - lsrs r1, 24 - movs r3, 0 - subs r0, r1, 0x1 - cmp r0, 0x4 - bhi _08028FC6 - lsls r0, 2 - ldr r1, =_08028F34 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08028F34: - .4byte _08028FB4 - .4byte _08028F48 - .4byte _08028F52 - .4byte _08028F66 - .4byte _08028F8E -_08028F48: - cmp r2, 0 - beq _08028F7E - cmp r2, 0x1 - bne _08028FC6 - b _08028F82 -_08028F52: - cmp r2, 0x1 - beq _08028FB8 - cmp r2, 0x1 - bgt _08028F60 - cmp r2, 0 - beq _08028FB4 - b _08028FC6 -_08028F60: - cmp r2, 0x2 - bne _08028FC6 - b _08028FC4 -_08028F66: - cmp r2, 0x1 - beq _08028F82 - cmp r2, 0x1 - bgt _08028F74 - cmp r2, 0 - beq _08028F7E - b _08028FC6 -_08028F74: - cmp r2, 0x2 - beq _08028F86 - cmp r2, 0x3 - beq _08028F8A - b _08028FC6 -_08028F7E: - movs r3, 0xC - b _08028FC6 -_08028F82: - movs r3, 0x12 - b _08028FC6 -_08028F86: - movs r3, 0x18 - b _08028FC6 -_08028F8A: - movs r3, 0x6 - b _08028FC6 -_08028F8E: - cmp r2, 0x4 - bhi _08028FC6 - lsls r0, r2, 2 - ldr r1, =_08028FA0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08028FA0: - .4byte _08028FB4 - .4byte _08028FB8 - .4byte _08028FBC - .4byte _08028FC0 - .4byte _08028FC4 -_08028FB4: - movs r3, 0xF - b _08028FC6 -_08028FB8: - movs r3, 0x15 - b _08028FC6 -_08028FBC: - movs r3, 0x1B - b _08028FC6 -_08028FC0: - movs r3, 0x3 - b _08028FC6 -_08028FC4: - movs r3, 0x9 -_08028FC6: - lsls r0, r3, 3 - pop {r1} - bx r1 - thumb_func_end sub_8028F14 - - thumb_func_start sub_8028FCC -sub_8028FCC: @ 8028FCC - push {r4,lr} - movs r4, 0 -_08028FD0: - adds r0, r4, 0 - movs r1, 0x1 - bl sub_8028BF8 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_8028C7C - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xA - bls _08028FD0 - movs r0, 0 - bl sub_80289E8 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8028FCC - - thumb_func_start sub_8028FF8 -sub_8028FF8: @ 8028FF8 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl GetWindowFrameTilesPal - ldr r1, [r0] - movs r2, 0x90 - lsls r2, 1 - movs r0, 0 - movs r3, 0x1 - bl LoadBgTiles - adds r0, r4, 0 - bl GetWindowFrameTilesPal - ldr r0, [r0, 0x4] - movs r1, 0xA0 - movs r2, 0x20 - bl LoadPalette - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8028FF8 - - thumb_func_start sub_802902C -sub_802902C: @ 802902C - push {lr} - movs r0, 0 - movs r1, 0xA - movs r2, 0xB0 - bl LoadUserWindowBorderGfx_ - pop {r0} - bx r0 - thumb_func_end sub_802902C - - thumb_func_start sub_802903C -sub_802903C: @ 802903C - ldr r3, =gUnknown_02022CF8 - ldr r0, [r3] - movs r2, 0xC0 - lsls r2, 6 - adds r1, r0, r2 - movs r2, 0 - str r2, [r1] - ldr r1, =0x00003014 - adds r0, r1 - strb r2, [r0] - ldr r0, [r3] - adds r1, 0x4 - adds r0, r1 - strb r2, [r0] - ldr r0, [r3] - adds r1, 0x8 - adds r0, r1 - strb r2, [r0] - ldr r0, [r3] - adds r1, 0x4 - adds r0, r1 - strb r2, [r0] - bx lr - .pool - thumb_func_end sub_802903C - - thumb_func_start sub_8029074 -sub_8029074: @ 8029074 - push {r4-r6,lr} - sub sp, 0xC - adds r4, r0, 0 - movs r6, 0xA - ldrb r2, [r4, 0x1] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x2] - subs r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - movs r5, 0x1 - str r5, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x1] - ldrb r3, [r4, 0x2] - subs r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - ldrb r0, [r4, 0x3] - str r0, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x2 - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x3] - ldrb r0, [r4, 0x1] - adds r2, r0 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x2] - subs r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - str r5, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x3 - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x1] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x2] - str r5, [sp] - ldrb r0, [r4, 0x4] - str r0, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x4 - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x3] - ldrb r0, [r4, 0x1] - adds r2, r0 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x2] - str r5, [sp] - ldrb r0, [r4, 0x4] - str r0, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x6 - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x1] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x4] - ldrb r0, [r4, 0x2] - adds r3, r0 - lsls r3, 24 - lsrs r3, 24 - str r5, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x7 - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x1] - ldrb r3, [r4, 0x4] - ldrb r0, [r4, 0x2] - adds r3, r0 - lsls r3, 24 - lsrs r3, 24 - ldrb r0, [r4, 0x3] - str r0, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x8 - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x3] - ldrb r0, [r4, 0x1] - adds r2, r0 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x4] - ldrb r4, [r4, 0x2] - adds r3, r4 - lsls r3, 24 - lsrs r3, 24 - str r5, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x9 - bl FillBgTilemapBufferRect - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8029074 - - thumb_func_start sub_8029174 -sub_8029174: @ 8029174 - push {r4-r6,lr} - sub sp, 0xC - adds r4, r0, 0 - movs r6, 0xB - ldrb r2, [r4, 0x1] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x2] - subs r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - movs r5, 0x1 - str r5, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0xA - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x1] - ldrb r3, [r4, 0x2] - subs r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - ldrb r0, [r4, 0x3] - str r0, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0xB - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x3] - ldrb r0, [r4, 0x1] - adds r2, r0 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x2] - subs r3, 0x1 - lsls r3, 24 - lsrs r3, 24 - str r5, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0xC - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x1] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x2] - str r5, [sp] - ldrb r0, [r4, 0x4] - str r0, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0xD - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x3] - ldrb r0, [r4, 0x1] - adds r2, r0 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x2] - str r5, [sp] - ldrb r0, [r4, 0x4] - str r0, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0xF - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x1] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x4] - ldrb r0, [r4, 0x2] - adds r3, r0 - lsls r3, 24 - lsrs r3, 24 - str r5, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x10 - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x1] - ldrb r3, [r4, 0x4] - ldrb r0, [r4, 0x2] - adds r3, r0 - lsls r3, 24 - lsrs r3, 24 - ldrb r0, [r4, 0x3] - str r0, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x11 - bl FillBgTilemapBufferRect - ldrb r2, [r4, 0x3] - ldrb r0, [r4, 0x1] - adds r2, r0 - lsls r2, 24 - lsrs r2, 24 - ldrb r3, [r4, 0x4] - ldrb r4, [r4, 0x2] - adds r3, r4 - lsls r3, 24 - lsrs r3, 24 - str r5, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r0, 0 - movs r1, 0x12 - bl FillBgTilemapBufferRect - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8029174 - - thumb_func_start sub_8029274 -sub_8029274: @ 8029274 - push {r4,lr} - ldr r4, =gUnknown_02022CF8 - str r0, [r4] - movs r2, 0xC0 - lsls r2, 6 - adds r1, r0, r2 - movs r2, 0 - str r2, [r1] - ldr r3, =0x00003014 - adds r1, r0, r3 - strb r2, [r1] - ldr r1, =0x00003018 - adds r0, r1 - strb r2, [r0] - ldr r0, [r4] - adds r3, 0xC - adds r0, r3 - strb r2, [r0] - ldr r0, [r4] - adds r1, 0xC - adds r0, r1 - strb r2, [r0] - ldr r0, =sub_8029314 - movs r1, 0x3 - bl CreateTask - ldr r1, [r4] - ldr r2, =0x00003004 - adds r1, r2 - strb r0, [r1] - ldr r0, =sub_8029338 - bl sub_802A72C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8029274 - - thumb_func_start sub_80292D4 -sub_80292D4: @ 80292D4 - push {lr} - bl FreeAllWindowBuffers - pop {r0} - bx r0 - thumb_func_end sub_80292D4 - - thumb_func_start sub_80292E0 -sub_80292E0: @ 80292E0 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - movs r4, 0 - ldr r5, =gUnknown_082FB40C - adds r7, r5, 0x4 -_080292EC: - lsls r1, r4, 3 - adds r0, r1, r5 - ldrb r0, [r0] - cmp r0, r6 - bne _080292FE - adds r0, r1, r7 - ldr r0, [r0] - bl sub_802A72C -_080292FE: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x9 - bls _080292EC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80292E0 - - thumb_func_start sub_8029314 -sub_8029314: @ 8029314 - push {lr} - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0 - bne _0802932E - bl sub_802A75C - bl _call_via_r0 -_0802932E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8029314 - - thumb_func_start sub_8029338 -sub_8029338: @ 8029338 - push {lr} - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r2, =0x00003014 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x4 - bhi _08029430 - lsls r0, 2 - ldr r1, =_08029360 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08029360: - .4byte _08029374 - .4byte _0802937A - .4byte _08029394 - .4byte _080293D8 - .4byte _08029404 -_08029374: - bl sub_802A7A8 - b _08029414 -_0802937A: - bl sub_802A8E8 - cmp r0, 0x1 - bne _0802943A - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r2, =0x00003014 - adds r1, r2 - b _0802941C - .pool -_08029394: - ldr r1, =gDodrioBerryBgTilemap1 - movs r0, 0x3 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - ldr r1, =gDodrioBerryBgTilemap2Left - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - ldr r1, =gDodrioBerryBgTilemap2Right - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - b _08029414 - .pool -_080293D8: - movs r0, 0 - bl ShowBg - movs r0, 0x3 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r2, =0x00003014 - adds r1, r2 - b _0802941C - .pool -_08029404: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x14] - lsrs r0, 3 - bl sub_8028FF8 - bl sub_802902C -_08029414: - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r0, =0x00003014 - adds r1, r0 -_0802941C: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0802943A - .pool -_08029430: - movs r2, 0xC0 - lsls r2, 6 - adds r1, r2 - movs r0, 0x1 - str r0, [r1] -_0802943A: - pop {r0} - bx r0 - thumb_func_end sub_8029338 - - thumb_func_start sub_8029440 -sub_8029440: @ 8029440 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x1C - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r2, =0x00003014 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0 - beq _08029488 - cmp r0, 0x1 - bne _08029460 - b _080295EC -_08029460: - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xB4 - bhi _0802946E - b _0802968E -_0802946E: - bl sub_8027650 - lsls r0, 24 - lsrs r7, r0, 24 - movs r6, 0 - cmp r6, r7 - bcc _0802947E - b _08029666 -_0802947E: - b _08029640 - .pool -_08029488: - bl sub_8027650 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r1, =gUnknown_082FB3C8 - subs r0, r7, 0x1 - lsls r0, 2 - adds r0, r1 - ldr r5, [r0] - ldr r2, =0xffffff00 - ldr r0, [sp, 0xC] - ands r0, r2 - ldr r1, =0x00ffffff - ands r0, r1 - movs r1, 0xE0 - lsls r1, 19 - orrs r0, r1 - str r0, [sp, 0xC] - ldr r0, [sp, 0x10] - ands r0, r2 - movs r1, 0x2 - orrs r0, r1 - ldr r1, =0xffff00ff - ands r0, r1 - movs r1, 0xD0 - lsls r1, 4 - orrs r0, r1 - ldr r1, =0x0000ffff - ands r0, r1 - movs r1, 0x98 - lsls r1, 13 - orrs r0, r1 - str r0, [sp, 0x10] - movs r6, 0 - cmp r6, r7 - bcs _080295B8 - mov r3, sp - adds r3, 0xC - str r3, [sp, 0x18] - mov r10, r4 - ldr r0, =0x00003008 - mov r9, r0 -_080294DC: - movs r1, 0 - mov r8, r1 - adds r0, r6, 0 - bl sub_8027A48 - lsls r0, 24 - lsrs r0, 24 - adds r4, r0, 0 - bl sub_8027660 - adds r1, r0, 0 - movs r0, 0x1 - movs r2, 0x1 - negs r2, r2 - bl GetStringWidth - movs r1, 0x38 - subs r1, r0 - lsrs r1, 1 - str r1, [sp, 0x14] - ldrb r0, [r5] - lsls r0, 8 - ldr r2, =0xffff00ff - ldr r1, [sp, 0xC] - ands r1, r2 - orrs r1, r0 - str r1, [sp, 0xC] - ldrb r2, [r5, 0x1] - lsls r2, 16 - ldr r0, =0xff00ffff - ands r0, r1 - orrs r0, r2 - str r0, [sp, 0xC] - add r0, sp, 0xC - bl AddWindow - mov r2, r10 - ldr r1, [r2] - add r1, r9 - adds r1, r6 - strb r0, [r1] - ldr r0, [r2] - add r0, r9 - adds r0, r6 - ldrb r0, [r0] - bl ClearWindowTilemap - mov r3, r10 - ldr r0, [r3] - add r0, r9 - adds r0, r6 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bne _0802955A - movs r0, 0x2 - mov r8, r0 -_0802955A: - adds r0, r4, 0 - bl sub_8027660 - adds r4, r0, 0 - mov r1, r10 - ldr r0, [r1] - add r0, r9 - adds r0, r6 - ldrb r0, [r0] - ldr r3, [sp, 0x14] - lsls r2, r3, 24 - lsrs r2, 24 - mov r3, r8 - lsls r1, r3, 1 - add r1, r8 - ldr r3, =gUnknown_082FB380 - adds r1, r3 - str r1, [sp] - movs r1, 0x1 - negs r1, r1 - str r1, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x1 - bl AddTextPrinterParameterized3 - mov r2, r10 - ldr r0, [r2] - add r0, r9 - adds r0, r6 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r3, [sp, 0x18] - ldrh r0, [r3, 0x6] - adds r0, 0xE - strh r0, [r3, 0x6] - add r0, sp, 0xC - bl sub_8029174 - adds r5, 0x4 - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, r7 - bcc _080294DC -_080295B8: - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r0, =0x00003014 - adds r1, r0 - b _0802962A - .pool -_080295EC: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802968E - bl sub_8027650 - lsls r0, 24 - lsrs r7, r0, 24 - movs r6, 0 - cmp r6, r7 - bcs _0802961C -_08029604: - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - adds r0, r6 - ldrb r0, [r0] - bl PutWindowTilemap - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, r7 - bcc _08029604 -_0802961C: - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r2, =0x00003014 - adds r1, r2 -_0802962A: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0802968E - .pool -_08029640: - ldr r5, =gUnknown_02022CF8 - ldr r0, [r5] - ldr r4, =0x00003008 - adds r0, r4 - adds r0, r6 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r5] - adds r0, r4 - adds r0, r6 - ldrb r0, [r0] - bl RemoveWindow - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, r7 - bcc _08029640 -_08029666: - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - movs r3, 0xC0 - lsls r3, 6 - adds r0, r3 - movs r1, 0x1 - str r1, [r0] -_0802968E: - add sp, 0x1C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8029440 - - thumb_func_start sub_80296A8 -sub_80296A8: @ 80296A8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x6C - lsls r0, 24 - movs r1, 0 - mov r8, r1 - movs r6, 0 - lsrs r7, r0, 24 - add r4, sp, 0x2C - ldr r1, =gUnknown_082FB45C - adds r0, r4, 0 - movs r2, 0x5 - bl memcpy - movs r5, 0 - cmp r5, r7 - bcs _080296F8 - add r4, sp, 0x34 -_080296D2: - mov r0, sp - adds r0, r5 - adds r0, 0x2C - strb r5, [r0] - add r0, sp, 0x5C - adds r1, r5, 0 - bl sub_802793C - lsls r2, r5, 3 - adds r2, r4, r2 - ldr r0, [sp, 0x5C] - ldr r1, [sp, 0x60] - str r0, [r2] - str r1, [r2, 0x4] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, r7 - bcc _080296D2 -_080296F8: - bl sub_8027748 - cmp r0, 0 - beq _0802972E -_08029700: - movs r5, 0 - cmp r5, r7 - bcs _08029728 - add r2, sp, 0x34 - add r1, sp, 0x2C -_0802970A: - lsls r0, r5, 3 - adds r0, r2, r0 - ldrb r0, [r0] - cmp r0, r8 - bne _0802971E - adds r0, r1, r6 - strb r5, [r0] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_0802971E: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, r7 - bcc _0802970A -_08029728: - mov r8, r6 - cmp r6, r7 - bcc _08029700 -_0802972E: - movs r5, 0 - ldr r4, =gText_SpacePoints - cmp r5, r7 - bcs _08029754 - add r1, sp, 0x34 - add r6, sp, 0x38 - subs r3, r7, 0x1 -_0802973C: - lsls r2, r5, 3 - adds r0, r6, r2 - ldr r0, [r0] - cmp r0, 0 - bne _0802974A - adds r0, r1, r2 - strb r3, [r0] -_0802974A: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, r7 - bcc _0802973C -_08029754: - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0 - bl GetStringWidth - movs r1, 0xD8 - subs r1, r0 - str r1, [sp, 0x64] - movs r5, 0 - cmp r5, r7 - bcs _08029860 - mov r2, sp - adds r2, 0x34 - str r2, [sp, 0x68] - ldr r3, =0x00003009 - mov r10, r3 -_08029774: - movs r0, 0 - mov r8, r0 - mov r0, sp - adds r0, r5 - adds r0, 0x2C - ldrb r0, [r0] - adds r4, r0, 0 - lsls r1, r4, 3 - add r0, sp, 0x38 - adds r0, r1 - ldr r0, [r0] - mov r9, r0 - ldr r2, =gUnknown_02022CF8 - ldr r0, [r2] - add r0, r10 - ldrb r0, [r0] - ldr r2, =gUnknown_082FB3DC - ldr r3, [sp, 0x68] - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 2 - adds r1, r2 - ldr r2, [r1] - ldr r3, =gUnknown_082FB402 - lsls r1, r5, 1 - adds r1, r3 - ldrb r6, [r1] - str r6, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - mov r3, r8 - str r3, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl AddTextPrinterParameterized - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bne _080297CC - movs r0, 0x2 - mov r8, r0 -_080297CC: - adds r0, r4, 0 - bl sub_8027660 - adds r3, r0, 0 - ldr r1, =gUnknown_02022CF8 - ldr r0, [r1] - add r0, r10 - ldrb r0, [r0] - mov r2, r8 - lsls r1, r2, 1 - add r1, r8 - ldr r2, =gUnknown_082FB380 - adds r1, r2 - str r1, [sp] - movs r1, 0x1 - negs r1, r1 - str r1, [sp, 0x4] - str r3, [sp, 0x8] - movs r1, 0x1 - movs r2, 0x1C - adds r3, r6, 0 - bl AddTextPrinterParameterized3 - add r0, sp, 0xC - mov r1, r9 - movs r2, 0 - movs r3, 0x7 - bl ConvertIntToDecimalStringN - movs r0, 0x1 - add r1, sp, 0xC - movs r2, 0x1 - negs r2, r2 - bl GetStringWidth - adds r3, r0, 0 - ldr r2, =gUnknown_02022CF8 - ldr r0, [r2] - add r0, r10 - ldrb r0, [r0] - ldr r1, [sp, 0x64] - subs r3, r1, r3 - lsls r3, 24 - lsrs r3, 24 - str r6, [sp] - movs r2, 0xFF - str r2, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - add r2, sp, 0xC - bl AddTextPrinterParameterized - ldr r2, =gUnknown_02022CF8 - ldr r0, [r2] - add r0, r10 - ldrb r0, [r0] - ldr r1, [sp, 0x64] - lsls r3, r1, 24 - str r6, [sp] - movs r2, 0xFF - str r2, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - ldr r2, =gText_SpacePoints - lsrs r3, 24 - bl AddTextPrinterParameterized - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, r7 - bcc _08029774 -_08029860: - add sp, 0x6C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80296A8 - - thumb_func_start sub_802988C -sub_802988C: @ 802988C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - bl sub_8027650 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0xC] - ldr r6, =gUnknown_02022CF8 - ldr r1, [r6] - ldr r2, =0x00003014 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0xB - bls _080298B2 - b _08029FA8 -_080298B2: - lsls r0, 2 - ldr r1, =_080298C8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080298C8: - .4byte _080298F8 - .4byte _08029914 - .4byte _0802996C - .4byte _08029B6C - .4byte _08029BB8 - .4byte _08029BFC - .4byte _08029C60 - .4byte _08029C9C - .4byte _08029CE0 - .4byte _08029DA0 - .4byte _08029F08 - .4byte _08029F5C -_080298F8: - bl sub_802784C - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r0, =0x0000301c - adds r2, r1, r0 - movs r0, 0 - strh r0, [r2] - b _08029F8A - .pool -_08029914: - ldr r6, =gUnknown_082F7BBC - adds r0, r6, 0 - bl AddWindow - ldr r4, =gUnknown_02022CF8 - ldr r1, [r4] - ldr r2, =0x00003008 - mov r8, r2 - add r1, r8 - strb r0, [r1] - movs r0, 0x8 - adds r0, r6 - mov r9, r0 - bl AddWindow - ldr r1, [r4] - ldr r5, =0x00003009 - adds r1, r5 - strb r0, [r1] - ldr r0, [r4] - add r0, r8 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl ClearWindowTilemap - adds r0, r6, 0 - bl sub_8029174 - mov r0, r9 - bl sub_8029174 - b _08029F88 - .pool -_0802996C: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r5, =0x00003008 - adds r0, r5 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r4] - ldr r1, =0x00003009 - mov r9, r1 - add r0, r9 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r2, =gText_BerryPickingResults - mov r8, r2 - movs r2, 0x1 - negs r2, r2 - movs r0, 0x1 - mov r1, r8 - bl GetStringWidth - adds r1, r0, 0 - movs r0, 0xE0 - subs r0, r1 - lsrs r3, r0, 1 - ldr r0, [r4] - adds r0, r5 - ldrb r0, [r0] - lsls r3, 24 - lsrs r3, 24 - movs r1, 0x1 - str r1, [sp] - movs r6, 0xFF - str r6, [sp, 0x4] - movs r5, 0 - str r5, [sp, 0x8] - mov r2, r8 - bl AddTextPrinterParameterized - ldr r0, [r4] - add r0, r9 - ldrb r0, [r0] - ldr r2, =gText_10P30P50P50P - movs r1, 0x11 - str r1, [sp] - str r6, [sp, 0x4] - str r5, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x44 - bl AddTextPrinterParameterized - mov r9, r5 - ldr r0, [sp, 0xC] - cmp r9, r0 - bcc _080299E2 - b _08029B2A -_080299E2: - movs r4, 0 - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - cmp r9, r0 - bne _080299F2 - movs r4, 0x2 -_080299F2: - mov r0, r9 - bl sub_8027660 - adds r6, r0, 0 - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r1, =0x00003009 - adds r0, r1 - ldrb r0, [r0] - mov r2, r9 - lsls r5, r2, 1 - ldr r2, =gUnknown_082FB3F8 - adds r1, r5, r2 - ldrb r3, [r1] - lsls r1, r4, 1 - adds r1, r4 - ldr r2, =gUnknown_082FB380 - adds r1, r2 - str r1, [sp] - movs r4, 0x1 - negs r4, r4 - str r4, [sp, 0x4] - str r6, [sp, 0x8] - movs r1, 0x1 - movs r2, 0 - bl AddTextPrinterParameterized3 - movs r7, 0 - mov r8, r5 - mov r0, r9 - adds r0, 0x1 - str r0, [sp, 0x10] - ldr r1, =gStringVar4 - mov r10, r1 -_08029A36: - mov r0, r9 - adds r1, r7, 0 - bl sub_80276A0 - lsls r0, 16 - lsrs r0, 16 - ldr r1, =0x0000270f - bl sub_8027A38 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r7, 0 - bl sub_802778C - ldr r1, =0x0000270f - bl sub_8027A38 - lsls r0, 16 - lsrs r6, r0, 16 - mov r0, r10 - adds r1, r4, 0 - movs r2, 0 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - movs r0, 0x1 - mov r1, r10 - movs r2, 0x1 - negs r2, r2 - bl GetStringWidth - adds r5, r0, 0 - cmp r6, r4 - bne _08029AE0 - cmp r6, 0 - beq _08029AE0 - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - lsls r1, r7, 1 - ldr r2, =gUnknown_082FB3F0 - adds r1, r2 - ldrb r2, [r1] - subs r2, r5 - lsls r2, 24 - lsrs r2, 24 - ldr r1, =gUnknown_082FB3F8 - add r1, r8 - ldrb r3, [r1] - ldr r1, =gUnknown_082FB383 - str r1, [sp] - movs r1, 0x1 - negs r1, r1 - str r1, [sp, 0x4] - mov r1, r10 - str r1, [sp, 0x8] - movs r1, 0x1 - bl AddTextPrinterParameterized3 - b _08029B10 - .pool -_08029AE0: - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - lsls r1, r7, 1 - ldr r2, =gUnknown_082FB3F0 - adds r1, r2 - ldrb r3, [r1] - subs r3, r5 - lsls r3, 24 - lsrs r3, 24 - ldr r1, =gUnknown_082FB3F8 - add r1, r8 - ldrb r1, [r1] - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - ldr r2, =gStringVar4 - bl AddTextPrinterParameterized -_08029B10: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0x3 - bls _08029A36 - ldr r1, [sp, 0x10] - lsls r0, r1, 24 - lsrs r0, 24 - mov r9, r0 - ldr r2, [sp, 0xC] - cmp r9, r2 - bcs _08029B2A - b _080299E2 -_08029B2A: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, [r4] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r4] - ldr r0, =0x00003014 - adds r1, r0 - b _08029F8E - .pool -_08029B6C: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _08029B90 - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r0, [r4] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - bl PutWindowTilemap -_08029B90: - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0 - bl sub_8028C30 - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r0, =0x00003014 - adds r1, r0 - b _08029F8E - .pool -_08029BB8: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x0000301c - adds r2, r0, r1 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1D - bhi _08029BD0 - b _08029FF8 -_08029BD0: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08029BDE - b _08029FF8 -_08029BDE: - movs r0, 0 - strh r0, [r2] - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - bl sub_8028C30 - b _08029F88 - .pool -_08029BFC: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r5, =0x00003008 - adds r0, r5 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r4] - ldr r1, =0x00003009 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r6, =gText_AnnouncingRankings - movs r2, 0x1 - negs r2, r2 - movs r0, 0x1 - adds r1, r6, 0 - bl GetStringWidth - adds r1, r0, 0 - movs r0, 0xE0 - subs r0, r1 - lsrs r3, r0, 1 - ldr r0, [r4] - adds r0, r5 - ldrb r0, [r0] - lsls r3, 24 - lsrs r3, 24 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r6, 0 - bl AddTextPrinterParameterized - b _08029F88 - .pool -_08029C60: - ldr r0, [sp, 0xC] - bl sub_80296A8 - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, [r4] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r4] - ldr r0, =0x00003014 - adds r1, r0 - b _08029F8E - .pool -_08029C9C: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _08029CC0 - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r0, [r4] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - bl PutWindowTilemap -_08029CC0: - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r0, =0x00003014 - adds r1, r0 - b _08029F8E - .pool -_08029CE0: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x0000301c - adds r2, r0, r1 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1D - bhi _08029CF8 - b _08029FF8 -_08029CF8: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08029D06 - b _08029FF8 -_08029D06: - movs r0, 0 - strh r0, [r2] - movs r0, 0x5 - bl PlaySE - bl sub_8027748 - ldr r1, =0x00000bb7 - cmp r0, r1 - bhi _08029D3C - ldr r0, [r4] - ldr r2, =0x00003014 - adds r0, r2 - movs r1, 0x7F - strb r1, [r0] - b _08029D4C - .pool -_08029D3C: - bl StopMapMusic - ldr r1, [r4] - ldr r0, =0x00003014 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_08029D4C: - movs r0, 0x1E - str r0, [sp] - movs r0, 0xF - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0x5 - bl FillBgTilemapBufferRect_Palette0 - ldr r5, =gUnknown_02022CF8 - ldr r0, [r5] - ldr r4, =0x00003009 - adds r0, r4 - ldrb r0, [r0] - bl RemoveWindow - ldr r6, =gUnknown_082F7BCC - adds r0, r6, 0 - bl AddWindow - ldr r1, [r5] - adds r1, r4 - strb r0, [r1] - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl ClearWindowTilemap - adds r0, r6, 0 - bl sub_8029174 - b _08029FF8 - .pool -_08029DA0: - ldr r0, =0x0000016f - bl PlayNewMapMusic - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r6, =0x00003008 - adds r0, r6 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r4] - ldr r1, =0x00003009 - mov r10, r1 - add r0, r10 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r5, =gText_AnnouncingPrizes - movs r2, 0x1 - negs r2, r2 - movs r0, 0x1 - adds r1, r5, 0 - bl GetStringWidth - adds r1, r0, 0 - movs r0, 0xE0 - subs r0, r1 - lsrs r3, r0, 1 - ldr r0, [r4] - adds r0, r6 - ldrb r0, [r0] - lsls r3, 24 - lsrs r3, 24 - movs r2, 0x1 - mov r9, r2 - str r2, [sp] - movs r1, 0xFF - mov r8, r1 - str r1, [sp, 0x4] - movs r6, 0 - str r6, [sp, 0x8] - movs r1, 0x1 - adds r2, r5, 0 - bl AddTextPrinterParameterized - bl DynamicPlaceholderTextUtil_Reset - bl sub_802762C - lsls r0, 16 - lsrs r0, 16 - ldr r5, =gStringVar1 - adds r1, r5, 0 - bl CopyItemName - movs r0, 0 - adds r1, r5, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - ldr r7, =gStringVar4 - ldr r1, =gText_FirstPlacePrize - adds r0, r7, 0 - bl DynamicPlaceholderTextUtil_ExpandPlaceholders - ldr r0, [r4] - add r0, r10 - ldrb r0, [r0] - mov r2, r9 - str r2, [sp] - mov r1, r8 - str r1, [sp, 0x4] - str r6, [sp, 0x8] - movs r1, 0x1 - adds r2, r7, 0 - movs r3, 0 - bl AddTextPrinterParameterized - bl sub_80279C8 - lsls r0, 24 - lsrs r4, r0, 24 - adds r6, r4, 0 - cmp r4, 0 - beq _08029EC8 - cmp r4, 0x3 - beq _08029EC8 - bl DynamicPlaceholderTextUtil_Reset - bl sub_802762C - lsls r0, 16 - lsrs r0, 16 - adds r1, r5, 0 - bl CopyItemName - movs r0, 0 - adds r1, r5, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - cmp r4, 0x2 - bne _08029E9C - ldr r1, =gText_CantHoldAnyMore - adds r0, r7, 0 - bl DynamicPlaceholderTextUtil_ExpandPlaceholders - b _08029EA8 - .pool -_08029E9C: - cmp r6, 0x1 - bne _08029EA8 - ldr r1, =gText_FilledStorageSpace - adds r0, r7, 0 - bl DynamicPlaceholderTextUtil_ExpandPlaceholders -_08029EA8: - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - ldr r2, =gStringVar4 - movs r1, 0x29 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized -_08029EC8: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, [r4] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r4] - ldr r0, =0x00003014 - adds r1, r0 - b _08029F8E - .pool -_08029F08: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _08029F2C - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r0, [r4] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - bl PutWindowTilemap -_08029F2C: - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, =0x0000020b - movs r1, 0x14 - movs r2, 0xA - bl FadeOutAndFadeInNewMapMusic - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r0, =0x00003014 - adds r1, r0 - b _08029F8E - .pool -_08029F5C: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x0000301c - adds r2, r0, r1 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1D - bls _08029FF8 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08029FF8 - movs r0, 0 - strh r0, [r2] - movs r0, 0x5 - bl PlaySE -_08029F88: - ldr r1, [r4] -_08029F8A: - ldr r2, =0x00003014 - adds r1, r2 -_08029F8E: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08029FF8 - .pool -_08029FA8: - ldr r5, =0x00003008 - adds r0, r1, r5 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r6] - ldr r4, =0x00003009 - adds r0, r4 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r6] - adds r0, r5 - ldrb r0, [r0] - bl RemoveWindow - ldr r0, [r6] - adds r0, r4 - ldrb r0, [r0] - bl RemoveWindow - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, [r6] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - movs r1, 0x1 - str r1, [r0] -_08029FF8: - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802988C - - thumb_func_start sub_802A010 -sub_802A010: @ 802A010 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - ldr r1, =gUnknown_02022CF8 - ldr r2, [r1] - ldr r3, =0x00003014 - adds r0, r2, r3 - ldrb r6, [r0] - adds r7, r1, 0 - cmp r6, 0x1 - beq _0802A0CC - cmp r6, 0x1 - bgt _0802A040 - cmp r6, 0 - beq _0802A04E - b _0802A2FC - .pool -_0802A040: - cmp r6, 0x2 - bne _0802A046 - b _0802A194 -_0802A046: - cmp r6, 0x3 - bne _0802A04C - b _0802A1D0 -_0802A04C: - b _0802A2FC -_0802A04E: - ldr r0, =gUnknown_082F7BD4 - mov r9, r0 - bl AddWindow - ldr r1, [r7] - ldr r4, =0x00003008 - adds r1, r4 - strb r0, [r1] - movs r1, 0x8 - add r1, r9 - mov r8, r1 - mov r0, r8 - bl AddWindow - ldr r1, [r7] - ldr r2, =0x00003009 - adds r1, r2 - strb r0, [r1] - ldr r0, [r7] - adds r0, r4 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r7] - ldr r3, =0x00003009 - adds r0, r3 - ldrb r0, [r0] - bl ClearWindowTilemap - mov r0, r9 - bl sub_8029174 - mov r0, r8 - bl sub_8029074 - ldr r1, [r7] - ldr r0, =0x00003014 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r7] - ldr r1, =0x00003020 - adds r0, r1 - strb r6, [r0] - ldr r0, [r7] - ldr r2, =0x00003024 - adds r0, r2 - strb r6, [r0] - b _0802A35E - .pool -_0802A0CC: - ldr r3, =0x00003008 - mov r8, r3 - adds r0, r2, r3 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r7] - ldr r1, =0x00003009 - mov r10, r1 - add r0, r10 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r7] - add r0, r8 - ldrb r0, [r0] - ldr r2, =gText_WantToPlayAgain - movs r1, 0x5 - str r1, [sp] - movs r3, 0xFF - mov r9, r3 - str r3, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldr r0, [r7] - add r0, r10 - ldrb r0, [r0] - ldr r2, =gText_Yes - str r6, [sp] - mov r3, r9 - str r3, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl AddTextPrinterParameterized - ldr r0, [r7] - add r0, r10 - ldrb r0, [r0] - ldr r2, =gText_No - movs r1, 0x11 - str r1, [sp] - mov r3, r9 - str r3, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl AddTextPrinterParameterized - ldr r0, [r7] - add r0, r10 - ldrb r0, [r0] - ldr r2, =gText_SelectorArrow2 - str r6, [sp] - mov r3, r9 - str r3, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldr r0, [r7] - add r0, r8 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, [r7] - add r0, r10 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r7] - ldr r2, =0x00003014 - adds r1, r2 - b _0802A2EA - .pool -_0802A194: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802A1B6 - ldr r0, [r7] - ldr r3, =0x00003008 - adds r0, r3 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r0, [r7] - ldr r1, =0x00003009 - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap -_0802A1B6: - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r1, [r7] - ldr r2, =0x00003014 - adds r1, r2 - b _0802A2EA - .pool -_0802A1D0: - ldr r3, =0x00003020 - adds r0, r2, r3 - ldrb r5, [r0] - cmp r5, 0 - bne _0802A1DC - movs r5, 0x1 -_0802A1DC: - ldr r0, =0x00003009 - mov r8, r0 - adds r0, r2, r0 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r7] - add r0, r8 - ldrb r0, [r0] - ldr r2, =gText_Yes - movs r1, 0x1 - str r1, [sp] - movs r3, 0xFF - mov r10, r3 - str r3, [sp, 0x4] - movs r1, 0 - mov r9, r1 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl AddTextPrinterParameterized - ldr r0, [r7] - add r0, r8 - ldrb r0, [r0] - ldr r2, =gText_No - movs r1, 0x11 - str r1, [sp] - mov r3, r10 - str r3, [sp, 0x4] - mov r1, r9 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl AddTextPrinterParameterized - ldr r0, [r7] - add r0, r8 - ldrb r0, [r0] - ldr r2, =gText_SelectorArrow2 - subs r1, r5, 0x1 - lsls r1, 4 - adds r1, 0x1 - lsls r1, 24 - lsrs r1, 24 - str r1, [sp] - mov r3, r10 - str r3, [sp, 0x4] - mov r1, r9 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldr r0, [r7] - add r0, r8 - ldrb r0, [r0] - movs r1, 0x3 - bl CopyWindowToVram - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r5, 0x1 - movs r2, 0x1 - ands r2, r1 - cmp r2, 0 - beq _0802A294 - movs r0, 0x5 - bl PlaySE - ldr r0, [r7] - ldr r3, =0x00003020 - adds r1, r0, r3 - ldrb r0, [r1] - cmp r0, 0 - bne _0802A2E4 - strb r5, [r1] - b _0802A2E4 - .pool -_0802A294: - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0 - beq _0802A2CC - movs r0, 0x5 - bl PlaySE - ldr r0, [r7] - ldr r2, =0x00003020 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0x1 - beq _0802A2C2 - cmp r0, 0x1 - bgt _0802A2BC - cmp r0, 0 - beq _0802A2C2 - b _0802A35E - .pool -_0802A2BC: - cmp r0, 0x2 - beq _0802A2C8 - b _0802A35E -_0802A2C2: - movs r0, 0x2 - strb r0, [r1] - b _0802A35E -_0802A2C8: - strb r5, [r1] - b _0802A35E -_0802A2CC: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0802A35E - movs r0, 0x5 - bl PlaySE - ldr r0, [r7] - ldr r3, =0x00003020 - adds r0, r3 - movs r1, 0x2 - strb r1, [r0] -_0802A2E4: - ldr r1, [r7] - ldr r0, =0x00003014 - adds r1, r0 -_0802A2EA: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0802A35E - .pool -_0802A2FC: - ldr r0, [r7] - ldr r2, =0x00003020 - adds r1, r0, r2 - ldrb r1, [r1] - ldr r3, =0x00003024 - adds r0, r3 - strb r1, [r0] - ldr r0, [r7] - ldr r6, =0x00003008 - adds r0, r6 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r7] - ldr r1, =0x00003009 - adds r0, r1 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r7] - adds r0, r6 - ldrb r0, [r0] - bl RemoveWindow - ldr r0, [r7] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - bl RemoveWindow - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, [r7] - movs r3, 0xC0 - lsls r3, 6 - adds r0, r3 - movs r1, 0x1 - str r1, [r0] -_0802A35E: - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802A010 - - thumb_func_start sub_802A380 -sub_802A380: @ 802A380 - push {r4-r6,lr} - sub sp, 0x10 - ldr r5, =gUnknown_02022CF8 - ldr r0, [r5] - ldr r6, =0x00003014 - adds r0, r6 - ldrb r4, [r0] - cmp r4, 0x1 - beq _0802A3D8 - cmp r4, 0x1 - bgt _0802A3A4 - cmp r4, 0 - beq _0802A3AE - b _0802A420 - .pool -_0802A3A4: - cmp r4, 0x2 - beq _0802A3EC - cmp r4, 0x3 - beq _0802A404 - b _0802A420 -_0802A3AE: - movs r0, 0 - movs r1, 0 - bl DrawDialogueFrame - ldr r2, =gText_SavingDontTurnOffPower - str r4, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized2 - b _0802A410 - .pool -_0802A3D8: - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - ldr r1, [r5] - ldr r0, =0x00003014 - adds r1, r0 - b _0802A414 - .pool -_0802A3EC: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802A448 - ldr r0, =sub_8153688 - movs r1, 0 - bl CreateTask - b _0802A410 - .pool -_0802A404: - ldr r0, =sub_8153688 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _0802A448 -_0802A410: - ldr r1, [r5] - adds r1, r6 -_0802A414: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0802A448 - .pool -_0802A420: - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - movs r1, 0x1 - str r1, [r0] -_0802A448: - add sp, 0x10 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802A380 - - thumb_func_start sub_802A454 -sub_802A454: @ 802A454 - push {r4-r6,lr} - sub sp, 0xC - ldr r1, =gUnknown_02022CF8 - ldr r2, [r1] - ldr r6, =0x00003014 - adds r0, r2, r6 - ldrb r0, [r0] - adds r5, r1, 0 - cmp r0, 0x1 - beq _0802A4AC - cmp r0, 0x1 - bgt _0802A47C - cmp r0, 0 - beq _0802A482 - b _0802A520 - .pool -_0802A47C: - cmp r0, 0x2 - beq _0802A4F4 - b _0802A520 -_0802A482: - ldr r4, =gUnknown_082F7BEC - adds r0, r4, 0 - bl AddWindow - ldr r1, [r5] - ldr r2, =0x00003008 - adds r1, r2 - strb r0, [r1] - ldr r0, [r5] - adds r0, r2 - ldrb r0, [r0] - bl ClearWindowTilemap - adds r0, r4, 0 - bl sub_8029174 - b _0802A510 - .pool -_0802A4AC: - ldr r4, =0x00003008 - adds r0, r2, r4 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - ldr r2, =gText_CommunicationStandby3 - movs r1, 0x5 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r5] - ldr r0, =0x00003014 - adds r1, r0 - b _0802A514 - .pool -_0802A4F4: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802A50A - ldr r0, [r5] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap -_0802A50A: - movs r0, 0 - bl CopyBgTilemapBufferToVram -_0802A510: - ldr r1, [r5] - adds r1, r6 -_0802A514: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0802A52C - .pool -_0802A520: - ldr r0, [r5] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - movs r1, 0x1 - str r1, [r0] -_0802A52C: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_802A454 - - thumb_func_start sub_802A534 -sub_802A534: @ 802A534 - push {r4,r5,lr} - sub sp, 0x8 - ldr r5, =gUnknown_02022CF8 - ldr r0, [r5] - ldr r4, =0x00003008 - adds r0, r4 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl RemoveWindow - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, [r5] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - movs r1, 0x1 - str r1, [r0] - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802A534 - - thumb_func_start sub_802A588 -sub_802A588: @ 802A588 - push {r4-r7,lr} - sub sp, 0xC - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r7, =0x00003014 - adds r2, r1, r7 - ldrb r5, [r2] - adds r6, r0, 0 - cmp r5, 0x1 - beq _0802A610 - cmp r5, 0x1 - bgt _0802A5B0 - cmp r5, 0 - beq _0802A5BA - b _0802A6A4 - .pool -_0802A5B0: - cmp r5, 0x2 - beq _0802A658 - cmp r5, 0x3 - beq _0802A684 - b _0802A6A4 -_0802A5BA: - ldr r4, =gUnknown_082F7BE4 - adds r0, r4, 0 - bl AddWindow - ldr r1, [r6] - ldr r2, =0x00003008 - adds r1, r2 - strb r0, [r1] - ldr r0, [r6] - adds r0, r2 - ldrb r0, [r0] - bl ClearWindowTilemap - adds r0, r4, 0 - bl sub_8029174 - ldr r1, [r6] - adds r1, r7 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r6] - ldr r2, =0x0000301c - adds r1, r0, r2 - movs r2, 0 - strh r5, [r1] - ldr r1, =0x00003020 - adds r0, r1 - strb r2, [r0] - ldr r0, [r6] - adds r1, 0x4 - adds r0, r1 - strb r2, [r0] - b _0802A6EA - .pool -_0802A610: - ldr r4, =0x00003008 - adds r0, r1, r4 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r6] - adds r0, r4 - ldrb r0, [r0] - ldr r2, =gText_SomeoneDroppedOut - movs r1, 0x5 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldr r0, [r6] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r6] - ldr r2, =0x00003014 - adds r1, r2 - b _0802A678 - .pool -_0802A658: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802A66E - ldr r0, [r6] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap -_0802A66E: - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r1, [r6] - adds r1, r7 -_0802A678: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0802A6EA - .pool -_0802A684: - ldr r0, =0x0000301c - adds r1, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x77 - bls _0802A6EA - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] - b _0802A6EA - .pool -_0802A6A4: - ldr r0, [r6] - ldr r1, =0x00003024 - adds r0, r1 - movs r1, 0x5 - strb r1, [r0] - ldr r0, [r6] - ldr r4, =0x00003008 - adds r0, r4 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r6] - adds r0, r4 - ldrb r0, [r0] - bl RemoveWindow - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, [r6] - movs r2, 0xC0 - lsls r2, 6 - adds r0, r2 - movs r1, 0x1 - str r1, [r0] -_0802A6EA: - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802A588 - - thumb_func_start unused_0 -unused_0: @ 802A6FC - push {r4,lr} - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003004 - adds r0, r1 - ldrb r0, [r0] - bl DestroyTask - ldr r0, [r4] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - movs r1, 0x1 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end unused_0 - - thumb_func_start nullsub_16 -nullsub_16: @ 802A728 - bx lr - thumb_func_end nullsub_16 - - thumb_func_start sub_802A72C -sub_802A72C: @ 802A72C - push {r4,lr} - ldr r2, =gUnknown_02022CF8 - ldr r1, [r2] - ldr r3, =0x00003014 - adds r1, r3 - movs r3, 0 - strb r3, [r1] - ldr r1, [r2] - movs r4, 0xC0 - lsls r4, 6 - adds r2, r1, r4 - str r3, [r2] - ldr r2, =0x00003028 - adds r1, r2 - str r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802A72C - - thumb_func_start sub_802A75C -sub_802A75C: @ 802A75C - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r1, =0x00003028 - adds r0, r1 - ldr r0, [r0] - bx lr - .pool - thumb_func_end sub_802A75C - - thumb_func_start sub_802A770 -sub_802A770: @ 802A770 - push {lr} - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0x1 - beq _0802A78C - movs r0, 0x1 - b _0802A78E - .pool -_0802A78C: - movs r0, 0 -_0802A78E: - pop {r1} - bx r1 - thumb_func_end sub_802A770 - - thumb_func_start sub_802A794 -sub_802A794: @ 802A794 - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r1, =0x00003024 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_802A794 - - thumb_func_start sub_802A7A8 -sub_802A7A8: @ 802A7A8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - movs r3, 0xC0 - lsls r3, 19 - movs r4, 0xC0 - lsls r4, 9 - add r0, sp, 0x4 - mov r8, r0 - mov r2, sp - movs r6, 0 - ldr r1, =0x040000d4 - movs r5, 0x80 - lsls r5, 5 - ldr r7, =0x81000800 - movs r0, 0x81 - lsls r0, 24 - mov r12, r0 -_0802A7CE: - strh r6, [r2] - mov r0, sp - str r0, [r1] - str r3, [r1, 0x4] - str r7, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r3, r5 - subs r4, r5 - cmp r4, r5 - bhi _0802A7CE - strh r6, [r2] - mov r2, sp - str r2, [r1] - str r3, [r1, 0x4] - lsrs r0, r4, 1 - mov r2, r12 - orrs r0, r2 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - movs r0, 0xE0 - lsls r0, 19 - movs r3, 0x80 - lsls r3, 3 - movs r4, 0 - str r4, [sp, 0x4] - ldr r2, =0x040000d4 - mov r1, r8 - str r1, [r2] - str r0, [r2, 0x4] - lsrs r0, r3, 2 - movs r1, 0x85 - lsls r1, 24 - orrs r0, r1 - str r0, [r2, 0x8] - ldr r0, [r2, 0x8] - movs r1, 0xA0 - lsls r1, 19 - mov r0, sp - strh r4, [r0] - str r0, [r2] - str r1, [r2, 0x4] - lsrs r3, 1 - movs r0, 0x81 - lsls r0, 24 - orrs r3, r0 - str r3, [r2, 0x8] - ldr r0, [r2, 0x8] - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_082F7BA4 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - bl InitStandardTextBoxWindows - bl sub_8197200 - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r4, =gUnknown_02022CF8 - ldr r1, [r4] - movs r0, 0x3 - bl SetBgTilemapBuffer - ldr r1, [r4] - movs r2, 0x80 - lsls r2, 5 - adds r1, r2 - movs r0, 0x1 - bl SetBgTilemapBuffer - ldr r1, [r4] - movs r0, 0x80 - lsls r0, 6 - adds r1, r0 - movs r0, 0x2 - bl SetBgTilemapBuffer - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802A7A8 - - thumb_func_start sub_802A8E8 -sub_802A8E8: @ 802A8E8 - push {lr} - sub sp, 0x4 - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r2, =0x00003018 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0x5 - bhi _0802A982 - lsls r0, 2 - ldr r1, =_0802A910 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0802A910: - .4byte _0802A928 - .4byte _0802A938 - .4byte _0802A93E - .4byte _0802A94C - .4byte _0802A964 - .4byte _0802A972 -_0802A928: - ldr r0, =gDodrioBerryBgPal1 - movs r1, 0 - movs r2, 0x40 - bl LoadPalette - b _0802A98A - .pool -_0802A938: - bl reset_temp_tile_data_buffers - b _0802A98A -_0802A93E: - ldr r1, =gDodrioBerryBgGfx1 - movs r0, 0 - str r0, [sp] - movs r0, 0x3 - b _0802A954 - .pool -_0802A94C: - ldr r1, =gDodrioBerryBgGfx2 - movs r0, 0 - str r0, [sp] - movs r0, 0x1 -_0802A954: - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - b _0802A98A - .pool -_0802A964: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0802A98A - b _0802A998 -_0802A972: - movs r0, 0x3 - bl stdpal_get - movs r1, 0xD0 - movs r2, 0x20 - bl LoadPalette - b _0802A98A -_0802A982: - movs r0, 0 - strb r0, [r1] - movs r0, 0x1 - b _0802A99A -_0802A98A: - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r0, =0x00003018 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_0802A998: - movs r0, 0 -_0802A99A: - add sp, 0x4 - pop {r1} - bx r1 - .pool - thumb_func_end sub_802A8E8 - - .align 2, 0 @ don't pad with nop diff --git a/data/dodrio_berry_picking.s b/data/dodrio_berry_picking.s deleted file mode 100755 index 7537d9f04..000000000 --- a/data/dodrio_berry_picking.s +++ /dev/null @@ -1,666 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gUnknown_082F449C:: @ 82F449C - .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 - .byte 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x03, 0x08 - .byte 0x09, 0x00, 0x00, 0x01, 0x02, 0x05, 0x06, 0x03 - .byte 0x04, 0x05, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 - .byte 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x02, 0x09 - .byte 0x00, 0x00, 0x01, 0x04, 0x05, 0x06, 0x07, 0x02 - .byte 0x03, 0x04, 0x09, 0x00, 0x00, 0x01, 0x06, 0x07 - .byte 0x02, 0x03, 0x04, 0x05, 0x06, 0x09, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02 - .byte 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01, 0x00 - .byte 0x00, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01 - .byte 0x02, 0x03, 0x00, 0x00, 0x05, 0x06, 0x07, 0x08 - .byte 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00, 0x07 - .byte 0x08, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03 - .byte 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x02 - .byte 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00 - .byte 0x01, 0x02, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 - .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x06, 0x07, 0x08 - .byte 0x09, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 - .byte 0x08, 0x09, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 - .byte 0x06, 0x07, 0x08 - -gUknnown_082F45AF:: - .byte 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 - .byte 0x04, 0x05, 0x05, 0x06, 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x05 - .byte 0x06, 0x06, 0x07, 0x02, 0x02, 0x03, 0x04, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x05 - .byte 0x05, 0x06, 0x07, 0x07, 0x08, 0x01, 0x01, 0x02 - .byte 0x03, 0x00, 0x00, 0x00, 0x04, 0x05, 0x06, 0x06 - .byte 0x07, 0x08, 0x08, 0x09, 0x00, 0x00, 0x01, 0x02 - .byte 0x02, 0x03, 0x04, 0x01, 0x00, 0x01, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x02, 0x01 - .byte 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x01, 0x00, 0x01, 0x02, 0x01, 0x02 - .byte 0x03, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04 - .byte 0x00, 0x01, 0x00, 0x01, 0x02, 0x01, 0x02, 0x03 - .byte 0x02, 0x03, 0x04, 0x03, 0x04, 0x00, 0x00, 0x00 - .byte 0x00, 0x09, 0x09, 0x09, 0x09, 0x01, 0x01, 0x01 - .byte 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x00 - .byte 0x00, 0x01, 0x01, 0x00, 0x09, 0x09, 0x09, 0x09 - .byte 0x09, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01 - .byte 0x09, 0x09, 0x09, 0x03, 0x03, 0x00, 0x00, 0x01 - .byte 0x01, 0x02, 0x02, 0x03, 0x09, 0x03, 0x03, 0x04 - .byte 0x04, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03 - .byte 0x05, 0x00, 0x00, 0x00, 0x00, 0x04, 0x06, 0x00 - .byte 0x00, 0x00, 0x03, 0x05, 0x07, 0x00, 0x00, 0x02 - .byte 0x04, 0x06, 0x08, 0x00, 0x01, 0x03, 0x05, 0x06 - .byte 0x09 - - .align 2 -gUnknown_082F7DF0_UnrefDupe:: @ 82F4698 - .incbin "graphics/link_games/dodrioberry_bg1.gbapal" - - .align 2 - .incbin "graphics/link_games/dodrioberry_bg2.gbapal" - - .align 2 -gUnknown_082F7E30_UnrefDupe:: @ 82F46B8 - .incbin "graphics/link_games/dodrioberry_pkmn.gbapal" - - .align 2 -gUnknown_082F7E50_UnrefDupe:: @ 82F46D8 - .incbin "graphics/link_games/dodrioberry_shiny.gbapal" - - .align 2 -gUnknown_082F7E70_UnrefDupe:: @ 82F46F8 - .incbin "graphics/link_games/dodrioberry_status.gbapal" - - .align 2 -gUnknown_082F7E90_UnrefDupe:: @ 82F4718 - .incbin "graphics/link_games/dodrioberry_berrysprites.gbapal" - - .align 2 -gUnknown_082F7EB0_UnrefDupe:: @ 82F4738 - .incbin "graphics/link_games/dodrioberry_berrysprites.4bpp.lz" - - .align 2 -gUnknown_082F8064_UnrefDupe:: @ 82F490C - .incbin "graphics/link_games/dodrioberry_platform.gbapal" - - .align 2 -gUnknown_082F8084_UnrefDupe:: @ 82F492C - .incbin "graphics/link_games/dodrioberry_bg1.4bpp.lz" - - .align 2 -gUnknown_082F8914_UnrefDupe:: @ 82F51BC - .incbin "graphics/link_games/dodrioberry_bg2.4bpp.lz" - - .align 2 -gUnknown_082F96E0_UnrefDupe:: @ 82F5F88 - .incbin "graphics/link_games/dodrioberry_status.4bpp.lz" - - .align 2 -gUnknown_082F9774_UnrefDupe:: @ 82F601C - .incbin "graphics/link_games/dodrioberry_platform.4bpp.lz" - - .align 2 -gUnknown_082F98BC_UnrefDupe:: @ 82F6164 - .incbin "graphics/link_games/dodrioberry_pkmn.4bpp.lz" - - .align 2 -gUnknown_082FAAD8_UnrefDupe:: @ 82F7380 - .incbin "graphics/link_games/dodrioberry_bg1.bin.lz" - - .align 2 -gUnknown_082FAD44_UnrefDupe:: @ 82F75EC - .incbin "graphics/link_games/dodrioberry_bg2right.bin.lz" - - .align 2 -gUnknown_082FAF94_UnrefDupe:: @ 82F783C - .incbin "graphics/link_games/dodrioberry_bg2left.bin.lz" - - .align 2 -gUnknown_082F7A88:: @ 82F7A88 - .byte 0x28, 0x18, 0x0d, 0x20, 0x13, 0x0a, 0x16, 0x0d - .byte 0x07, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F7A94:: @ 82F7A94 - .byte 0x08, 0x05, 0x08, 0x0b, 0x0f, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F7A9C:: @ 82F7A9C - .byte 0x05, 0x0a, 0x14, 0x1e, 0x32, 0x46, 0x64, 0x00 - - .align 2 -gUnknown_082F7AA4:: @ 82F7AA4 - .byte 0x0f, 0x10, 0x11, 0x12, 0x13, 0x13, 0x12, 0x11 - .byte 0x10, 0x0f, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19 - .byte 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21 - .byte 0x22, 0x22, 0x21, 0x20, 0x1f, 0x1e, 0x00, 0x00 - - .align 2 -gUnknown_082F7AC4:: @ 82F7AC4 - .4byte sub_8024DBC - .4byte sub_8024E00 - .4byte sub_8024E38 - .4byte sub_8024F10 - .4byte sub_8024F38 - .4byte sub_8025198 - .4byte sub_8025324 - .4byte sub_8025470 - .4byte sub_8025644 - .4byte sub_80256AC - .4byte sub_8025758 - .4byte sub_80250D4 - - .align 2 -gUnknown_082F7AF4:: @ 82F7AF4 - .4byte sub_8024DBC - .4byte sub_8024E00 - .4byte sub_8024E38 - .4byte sub_8024F10 - .4byte sub_8024FFC - .4byte sub_8025230 - .4byte sub_8025324 - .4byte sub_8025470 - .4byte sub_8025644 - .4byte sub_80256AC - .4byte sub_8025758 - .4byte sub_8025158 - - .align 2 -gUnknown_082F7B24:: @ 82F7B24 - .2byte 0x000a, 0x001e, 0x0032, 0x0032 - - .align 2 -gUnknown_082F7B2C:: @ 82F7B2C - .byte 0x00, 0x05, 0x01, 0x14, 0x0b, 0x0f, 0x01, 0x00 - - .align 2 -gUnknown_082F7B34:: @ 82F7B34 - .4byte gText_BerriesPicked - .4byte gText_BestScore - .4byte gText_BerriesInRowFivePlayers - - .align 2 -gUnknown_082F7B40:: @ 82F7B40 - .byte 0x04, 0x07, 0x04, 0x00 - - .align 2 -gUnknown_082F7B44:: @ 82F7B44 - .2byte 0x0019, 0x0029, 0x0039 - -gUnknown_082F7B4A:: @ 82F7B4A - .2byte 0x0019, 0x0029, 0x0049 - - .align 2 -gUnknown_082F7B50:: @ 82F7B50 - .2byte 0x270f, 0x0000, 0x005a, 0x270f, 0x270f, 0x270f, 0x0046, 0x270f - .2byte 0x270f, 0x0000, 0x270f, 0x0000, 0x270f, 0x270f, 0x003c, 0x0000 - .2byte 0x270f, 0x270f, 0x270f, 0x0000 - - .align 2 -gUnknown_082F7B78:: @ 82F7B78 - .string "ÀÁÂÇÈÉÊ$" - - .align 2 -gUnknown_082F7B80:: @ 82F7B80 - .string "ABCDEFG$" - - .align 2 -gUnknown_082F7B88:: @ 82F7B88 - .string "0123456$" - - .align 2 -gUnknown_082F7B90:: @ 82F7B90 - .4byte gUnknown_082F7B78 - .4byte gUnknown_082F7B78 - .4byte gUnknown_082F7B78 - .4byte gUnknown_082F7B80 - .4byte gUnknown_082F7B88 - - .align 2 -gUnknown_082F7BA4:: @ 82F7BA4 struct BgTemplate - .4byte 0x000001e0 - .4byte 0x000012c9 - .4byte 0x000012ea - .4byte 0x000021ff - .4byte 0x000000ff - .4byte 0x00000000 - - .align 2 -gUnknown_082F7BBC:: @ 82F7BBC - window_template 0x00, 0x01, 0x01, 0x1c, 0x02, 0x0d, 0x0013 - window_template 0x00, 0x01, 0x05, 0x1c, 0x0e, 0x0d, 0x004b - - .align 2 -gUnknown_082F7BCC:: @ 82F7BCC - window_template 0x00, 0x01, 0x05, 0x1c, 0x07, 0x0d, 0x004b - - .align 2 -gUnknown_082F7BD4:: @ 82F7BD4 - window_template 0x00, 0x01, 0x08, 0x13, 0x03, 0x0d, 0x0013 - window_template 0x00, 0x16, 0x07, 0x06, 0x04, 0x0d, 0x004c - - .align 2 -gUnknown_082F7BE4:: @ 82F7BE4 - window_template 0x00, 0x04, 0x06, 0x16, 0x05, 0x0d, 0x0013 - - .align 2 -gUnknown_082F7BEC:: @ 82F7BEC - window_template 0x00, 0x05, 0x08, 0x13, 0x03, 0x0d, 0x0013 - - .align 2 -gUnknown_082F449C_UnrefDupe:: @ 82F7BF4 - .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 - .byte 0x08, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x03, 0x08 - .byte 0x09, 0x00, 0x00, 0x01, 0x02, 0x05, 0x06, 0x03 - .byte 0x04, 0x05, 0x08, 0x09, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 - .byte 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x02, 0x09 - .byte 0x00, 0x00, 0x01, 0x04, 0x05, 0x06, 0x07, 0x02 - .byte 0x03, 0x04, 0x09, 0x00, 0x00, 0x01, 0x06, 0x07 - .byte 0x02, 0x03, 0x04, 0x05, 0x06, 0x09, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02 - .byte 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01, 0x00 - .byte 0x00, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x01 - .byte 0x02, 0x03, 0x00, 0x00, 0x05, 0x06, 0x07, 0x08 - .byte 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00, 0x07 - .byte 0x08, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03 - .byte 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x02 - .byte 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00 - .byte 0x01, 0x02, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 - .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x06, 0x07, 0x08 - .byte 0x09, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 - .byte 0x08, 0x09, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 - .byte 0x06, 0x07, 0x08, 0x04, 0x05, 0x06, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x03, 0x04, 0x05, 0x05, 0x06, 0x03 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x04, 0x05, 0x06, 0x06, 0x07, 0x02, 0x02 - .byte 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x04, 0x05, 0x05, 0x06, 0x07, 0x07, 0x08 - .byte 0x01, 0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x04 - .byte 0x05, 0x06, 0x06, 0x07, 0x08, 0x08, 0x09, 0x00 - .byte 0x00, 0x01, 0x02, 0x02, 0x03, 0x04, 0x01, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01 - .byte 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00 - .byte 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01 - .byte 0x02, 0x01, 0x02, 0x03, 0x02, 0x03, 0x00, 0x00 - .byte 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x01, 0x02 - .byte 0x01, 0x02, 0x03, 0x02, 0x03, 0x04, 0x03, 0x04 - .byte 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09 - .byte 0x01, 0x01, 0x01, 0x09, 0x09, 0x09, 0x09, 0x09 - .byte 0x09, 0x09, 0x00, 0x00, 0x01, 0x01, 0x00, 0x09 - .byte 0x09, 0x09, 0x09, 0x09, 0x02, 0x02, 0x00, 0x00 - .byte 0x01, 0x01, 0x01, 0x09, 0x09, 0x09, 0x03, 0x03 - .byte 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x09 - .byte 0x03, 0x03, 0x04, 0x04, 0x00, 0x00, 0x01, 0x01 - .byte 0x02, 0x02, 0x03, 0x05, 0x00, 0x00, 0x00, 0x00 - .byte 0x04, 0x06, 0x00, 0x00, 0x00, 0x03, 0x05, 0x07 - .byte 0x00, 0x00, 0x02, 0x04, 0x06, 0x08, 0x00, 0x01 - .byte 0x03, 0x05, 0x06, 0x09 - - .align 2 -gDodrioBerryBgPal1:: @ 82F7DF0 - .incbin "graphics/link_games/dodrioberry_bg1.gbapal" - - .align 2 - .incbin "graphics/link_games/dodrioberry_bg2.gbapal" - - .align 2 -gDodrioBerryPkmnPal:: @ 82F7E30 - .incbin "graphics/link_games/dodrioberry_pkmn.gbapal" - - .align 2 -gDodrioBerryShinyPal:: @ 82F7E50 - .incbin "graphics/link_games/dodrioberry_shiny.gbapal" - - .align 2 -gDodrioBerryStatusPal:: @ 82F7E70 - .incbin "graphics/link_games/dodrioberry_status.gbapal" - - .align 2 -gDodrioBerrySpritesPal:: @ 82F7E90 - .incbin "graphics/link_games/dodrioberry_berrysprites.gbapal" - - .align 2 -gDodrioBerrySpritesGfx:: @ 82F7EB0 - .incbin "graphics/link_games/dodrioberry_berrysprites.4bpp.lz" - - .align 2 -gDodrioBerryPlatformPal:: @ 82F8064 - .incbin "graphics/link_games/dodrioberry_platform.gbapal" - - .align 2 -gDodrioBerryBgGfx1:: @ 82F8084 - .incbin "graphics/link_games/dodrioberry_bg1.4bpp.lz" - - .align 2 -gDodrioBerryBgGfx2:: @ 82F8914 - .incbin "graphics/link_games/dodrioberry_bg2.4bpp.lz" - - .align 2 -gDodrioBerryStatusGfx:: @ 82F96E0 - .incbin "graphics/link_games/dodrioberry_status.4bpp.lz" - - .align 2 -gDodrioBerryPlatformGfx:: @ 82F9774 - .incbin "graphics/link_games/dodrioberry_platform.4bpp.lz" - - .align 2 -gDodrioBerryPkmnGfx:: @ 82F98BC - .incbin "graphics/link_games/dodrioberry_pkmn.4bpp.lz" - - .align 2 -gDodrioBerryBgTilemap1:: @ 82FAAD8 - .incbin "graphics/link_games/dodrioberry_bg1.bin.lz" - - .align 2 -gDodrioBerryBgTilemap2Right:: @ 82FAD44 - .incbin "graphics/link_games/dodrioberry_bg2right.bin.lz" - - .align 2 -gDodrioBerryBgTilemap2Left:: @ 82FAF94 - .incbin "graphics/link_games/dodrioberry_bg2left.bin.lz" - - .align 2 -gUnknown_082FB1E0:: @ 82FB1E0 - .byte 0x00, 0x00, 0x00, 0xc0, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082FB1E8:: @ 82FB1E8 - .byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082FB1F0:: @ 82FB1F0 - .byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082FB1F8:: @ 82FB1F8 - .byte 0x00, 0x40, 0x00, 0xc0, 0x00, 0x0c, 0x00, 0x00 - - .align 2 -gUnknown_082FB200:: @ 82FB200 - .2byte 0x0000, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB208:: @ 82FB208 - .2byte 0x0040, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB210:: @ 82FB210 - .2byte 0x0080, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB218:: @ 82FB218 - .2byte 0x00c0, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB220:: @ 82FB220 - .2byte 0x0100, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB228:: @ 82FB228 - .4byte gUnknown_082FB200 - .4byte gUnknown_082FB208 - .4byte gUnknown_082FB210 - .4byte gUnknown_082FB218 - .4byte gUnknown_082FB220 - - .align 2 -gUnknown_082FB23C:: @ 82FB23C - .2byte 0x0000, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB244:: @ 82FB244 - .2byte 0x0004, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB24C:: @ 82FB24C - .2byte 0x0008, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB254:: @ 82FB254 - .4byte gUnknown_082FB23C - .4byte gUnknown_082FB244 - .4byte gUnknown_082FB24C - - .align 2 -gUnknown_082FB260:: @ 82FB260 - .2byte 0x0000, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB268:: @ 82FB268 - .2byte 0x0004, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB270:: @ 82FB270 - .2byte 0x0008, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB278:: @ 82FB278 - .2byte 0x000c, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB280:: @ 82FB280 - .2byte 0x0010, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB288:: @ 82FB288 - .2byte 0x0014, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB290:: @ 82FB290 - .2byte 0x0018, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB298:: @ 82FB298 - .2byte 0x001c, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB2A0:: @ 82FB2A0 - .2byte 0x0020, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB2A8:: @ 82FB2A8 - .4byte gUnknown_082FB260 - .4byte gUnknown_082FB268 - .4byte gUnknown_082FB270 - .4byte gUnknown_082FB278 - .4byte gUnknown_082FB280 - .4byte gUnknown_082FB288 - .4byte gUnknown_082FB290 - .4byte gUnknown_082FB298 - .4byte gUnknown_082FB2A0 - - .align 2 -gUnknown_082FB2CC:: @ 82FB2CC - .2byte 0x0000, 0x0014 - .2byte 0xfffe, 0x0000 - - .align 2 -gUnknown_082FB2D4:: @ 82FB2D4 - .4byte gUnknown_082FB2CC - - .align 2 -gUnknown_082FB2D8:: @ 82FB2D8 - obj_pal gDodrioBerryPkmnPal, 0x0000 - - .align 2 -gUnknown_082FB2E0:: @ 82FB2E0 - obj_pal gDodrioBerryShinyPal, 0x0001 - - .align 2 -gUnknown_082FB2E8:: @ 82FB2E8 - obj_pal gDodrioBerryStatusPal, 0x0002 - - .align 2 -gUnknown_082FB2F0:: @ 82FB2F0 - spr_template 0x0001, 0x0002, gUnknown_082FB1E8, gUnknown_082FB254, NULL, gDummySpriteAffineAnimTable, nullsub_15 - - .align 2 - .byte 0xD4, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44 - .byte 0x45, 0xFB, 0x00, 0x00 - - .align 2 -gUnknown_082FB314:: @ 82FB314 - obj_pal gDodrioBerrySpritesPal, 0x0003 - - .align 2 -gUnknown_082FB31C:: @ 82FB31C - .2byte 0x0058, 0x0080, 0x00a8, 0x00d0 - - .align 2 -gUnknown_082FB324:: @ 82FB324 - spr_template 0x0002, 0x0003, gUnknown_082FB1F0, gUnknown_082FB2A8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082FB33C:: @ 82FB33C - spr_template 0x0002, 0x0003, gUnknown_082FB1E8, gUnknown_082FB2A8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082FB354:: @ 82FB354 - .byte 0x1E, 0x14 - -gUnknown_082FB356:: @ 82FB356 - .byte 0xE6, 0x00 - - .align 2 -gUnknown_082FB358:: @ 82FB358 - .2byte 0x0037, 0x001e, 0x004a, 0x0000 - - .align 2 -gUnknown_082FB360:: @ 82FB360 - obj_pal gDodrioBerryPlatformPal, 0x0006 - - .align 2 -gUnknown_082FB368:: @ 82FB368 - spr_template 0x0005, 0x0006, gUnknown_082FB1F8, gUnknown_082FB2D4, NULL, gDummySpriteAffineAnimTable, sub_8028CF4 - - .align 2 -gUnknown_082FB380:: @ 82FB380 - .byte 0x01, 0x02, 0x03 - -gUnknown_082FB383:: @ 82FB383 - .byte 0x01, 0x04, 0x05 - .byte 0x01, 0x08, 0x09 - .byte 0x01, 0x06, 0x07 - - .align 2 -gUnknown_082FB38C:: @ 82FB38C - .byte 0x0c, 0x06, 0x00, 0x00 - - .align 2 -gUnknown_082FB390:: @ 82FB390 - .byte 0x09, 0x0a, 0x00, 0x00, 0x0f, 0x06, 0x00, 0x00 - - .align 2 -gUnknown_082FB398:: @ 82FB398 - .byte 0x0c, 0x06, 0x00, 0x00, 0x12, 0x0a, 0x00, 0x00 - .byte 0x06, 0x0a, 0x00, 0x00 - - .align 2 -gUnknown_082FB3A4:: @ 82FB3A4 - .byte 0x09, 0x0a, 0x00, 0x00, 0x0f, 0x06, 0x00, 0x00 - .byte 0x15, 0x0a, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00 - - .align 2 -gUnknown_082FB3B4:: @ 82FB3B4 - .byte 0x0c, 0x06, 0x00, 0x00, 0x12, 0x0a, 0x00, 0x00 - .byte 0x17, 0x06, 0x00, 0x00, 0x01, 0x06, 0x00, 0x00 - .byte 0x06, 0x0a, 0x00, 0x00 - - .align 2 -gUnknown_082FB3C8:: @ 82FB3C8 - .4byte gUnknown_082FB38C - .4byte gUnknown_082FB390 - .4byte gUnknown_082FB398 - .4byte gUnknown_082FB3A4 - .4byte gUnknown_082FB3B4 - - .align 2 -gUnknown_082FB3DC:: @ 82FB3DC - .4byte gText_1Colon - .4byte gText_2Colon - .4byte gText_3Colon - .4byte gText_4Colon - .4byte gText_5Colon - - .align 2 -gUnknown_082FB3F0:: @ 82FB3F0 - .2byte 0x005c, 0x0084, 0x00ac, 0x00d4 - -gUnknown_082FB3F8:: @ 82FB3F8 - .2byte 0x0021, 0x0031, 0x0041, 0x0051, 0x0061 - -gUnknown_082FB402:: @ 82FB402 - .2byte 0x0011, 0x0021, 0x0031, 0x0041, 0x0051 - - .align 2 -gUnknown_082FB40C:: @ 82FB40C - .4byte 0x00000000, sub_8029338 - .4byte 0x00000001, sub_8029440 - .4byte 0x00000002, sub_802988C - .4byte 0x00000003, sub_802A010 - .4byte 0x00000004, sub_802A380 - .4byte 0x00000005, sub_802A454 - .4byte 0x00000006, sub_802A534 - .4byte 0x00000007, sub_802A588 - .4byte 0x00000008, unused_0 - .4byte 0x00000009, nullsub_16 - - .align 2 -gUnknown_082FB45C:: @ 82FB45C - .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00 diff --git a/include/berry_crush.h b/include/berry_crush.h index 101450a33..8909ae821 100755 --- a/include/berry_crush.h +++ b/include/berry_crush.h @@ -1,6 +1,8 @@ #ifndef GUARD_BERRY_CRUSH_H #define GUARD_BERRY_CRUSH_H +#include "main.h" + void sub_8020C70(MainCallback callback); #endif // GUARD_BERRY_CRUSH_H diff --git a/include/dodrio_berry_picking.h b/include/dodrio_berry_picking.h new file mode 100644 index 000000000..55e8fa880 --- /dev/null +++ b/include/dodrio_berry_picking.h @@ -0,0 +1,8 @@ +#ifndef GUARD_DODRIO_BERRY_PICKING_H +#define GUARD_DODRIO_BERRY_PICKING_H + +void sub_802493C(u16 a0, void (*callback)(void)); +void sub_8027A5C(void); +void sub_8027AAC(void); + +#endif // GUARD_DODRIO_BERRY_PICKING_H diff --git a/include/link_rfu.h b/include/link_rfu.h index 4bf106ec1..d6e1009e1 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -275,7 +275,7 @@ void sub_8010FCC(u32 a0, u32 a1, u32 a2); void sub_8011C84(void); void sub_8012188(const u8 *name, struct UnkLinkRfuStruct_02022B14 *structPtr, u8 a2); bool32 sub_8011B90(void); -void sub_800FE50(u16 *a0); +void sub_800FE50(void *a0); bool32 sub_800E540(u16 id, u8 *name); void sub_8011DE0(u32 arg0); u8 sub_801100C(s32 a0); diff --git a/include/menu.h b/include/menu.h index 08cad40bd..62e2558dc 100644 --- a/include/menu.h +++ b/include/menu.h @@ -25,7 +25,7 @@ void InitStandardTextBoxWindows(void); void sub_8197200(void); u16 RunTextPrintersAndIsPrinter0Active(void); void sub_81973A4(void); -void DrawDialogueFrame(u8, u8); +void DrawDialogueFrame(u8 windowId, bool8 copyToVram); void ClearStdWindowAndFrame(u8 windowId, bool8 copyToVram); u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 fgColor, u8 bgColor, u8 shadowColor); void PrintPlayerNameOnWindow(u8, const u8*, u16, u16); diff --git a/include/strings.h b/include/strings.h index 5d8d2eb79..261396678 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2708,6 +2708,28 @@ extern const u8 gText_Symbols[]; extern const u8 gText_Register2[]; extern const u8 gText_Exit2[]; +// Dodrio Berry Picking +extern const u8 gText_BerryPickingRecords[]; +extern const u8 gText_BerriesPicked[]; +extern const u8 gText_BerriesInRowFivePlayers[]; +extern const u8 gText_BestScore[]; +extern const u8 gText_1Colon[]; +extern const u8 gText_2Colon[]; +extern const u8 gText_3Colon[]; +extern const u8 gText_4Colon[]; +extern const u8 gText_5Colon[]; +extern const u8 gText_SpacePoints[]; +extern const u8 gText_10P30P50P50P[]; +extern const u8 gText_AnnouncingPrizes[]; +extern const u8 gText_AnnouncingRankings[]; +extern const u8 gText_FirstPlacePrize[]; +extern const u8 gText_CantHoldAnyMore[]; +extern const u8 gText_FilledStorageSpace[]; +extern const u8 gText_BerryPickingResults[]; +extern const u8 gText_WantToPlayAgain[]; +extern const u8 gText_CommunicationStandby3[]; +extern const u8 gText_SomeoneDroppedOut[]; + // Pokemon jump extern const u8 gText_WantToPlayAgain2[]; extern const u8 gText_SomeoneDroppedOut2[]; diff --git a/ld_script.txt b/ld_script.txt index 0b416109d..752f22da9 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -75,7 +75,6 @@ SECTIONS { asm/berry_crush.o(.text*); src/berry_powder.o(.text*); src/dodrio_berry_picking.o(.text*); - asm/dodrio_berry_picking.o(.text*); src/pokemon_jump.o(.text*); asm/pokemon_jump.o(.text*); src/rtc.o(.text*); @@ -447,7 +446,6 @@ SECTIONS { data/berry_crush.o(.rodata); data/berry_powder.o(.rodata); src/dodrio_berry_picking.o(.rodata); - data/dodrio_berry_picking.o(.rodata); src/pokemon_jump.o(.rodata); data/pokemon_jump.o(.rodata); src/rtc.o(.rodata); diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c index 0eb0c12f8..714b10ef6 100644 --- a/src/dodrio_berry_picking.c +++ b/src/dodrio_berry_picking.c @@ -1,249 +1,456 @@ #include "global.h" #include "alloc.h" -#include "palette.h" -#include "window.h" #include "bg.h" +#include "dodrio_berry_picking.h" +#include "dynamic_placeholder_text_util.h" +#include "event_data.h" #include "gpu_regs.h" -#include "random.h" +#include "international_string_util.h" +#include "item.h" #include "link.h" #include "link_rfu.h" -#include "task.h" -#include "main.h" -#include "constants/songs.h" -#include "sound.h" #include "m4a.h" +#include "main.h" +#include "palette.h" #include "pokemon_jump.h" +#include "random.h" +#include "save.h" +#include "script.h" +#include "sound.h" +#include "string_util.h" +#include "strings.h" +#include "task.h" +#include "text_window.h" +#include "window.h" +#include "constants/items.h" +#include "constants/songs.h" +#include "constants/species.h" -struct DodrioBerryPickingSubstruct_0160 +struct DodrioSubstruct_0160 { - /*0x0000 : 0x0160*/ u8 filler_000[12]; - /*0x000C : 0x016C*/ u8 unk_00C; - /*0x000D : 0x016D*/ u8 filler_00D[0x3000 - 0xd]; - /*0x3000 : 0x3160*/ u32 unk_3000; - /*0x3004 : 0x3164*/ u8 filler_3004[16]; - /*0x3014 : 0x3174*/ u8 unk_3014; - /*0x3015 : 0x3175*/ u8 filler_3015[0x318C - 0x3175]; + /*0x0000 : 0x3000*/ u16 ALIGNED(4) tilemapBuffers[3][BG_SCREEN_SIZE]; + /*0x3000 : 0x3160*/ bool32 finished; + /*0x3004 : 0x3164*/ u8 ALIGNED(4) unk3004; + /*0x3008 : 0x3168*/ u8 ALIGNED(4) unk3008[10]; + /*0x3014 : 0x3174*/ u8 ALIGNED(4) state; + /*0x3018 : 0x3178*/ u8 ALIGNED(4) unk3018; + /*0x301C : 0x317C*/ u16 ALIGNED(4) unk301C; + /*0x3020 : 0x3180*/ u8 ALIGNED(4) unk3020; + /*0x3024 : 0x3184*/ u8 ALIGNED(4) unk3024; + /*0x3024 : 0x3184*/ void (*unk3028)(void); }; // size = 0x302C -struct DodrioBerryPickingStruct_2022CF4 +struct DodrioStruct_2022CF4 { - u8 filler_00[0x40]; + u8 filler_00[0xc]; + u8 unkC[10]; + s16 unk16[10]; + u16 unk2A[10]; + u16 unk3E; }; // size = 0x40 -struct DodrioBerryPickingSubstruct_31A0_14 +struct DodrioSubstruct_31A0_14 { - u8 unk_0[11]; - u8 unk_B[11]; + u8 unk0[11]; + u8 unkB[11]; }; -struct DodrioBerryPickingSubstruct_31A0 +struct DodrioSubstruct_31A0_2C { - u8 unk_00[0x10]; - u32 unk_10; - struct DodrioBerryPickingSubstruct_31A0_14 unk_14; - u8 unk_2C; - u8 filler_2D[3]; - u8 unk_30; - u8 filler_31[3]; - u8 unk_34; - u8 filler_35[7]; + u8 unk0; + u8 ALIGNED(4) unk4; + u8 ALIGNED(4) unk8; +}; + +struct DodrioSubstruct_31A0 +{ + u8 name[0x10]; + u32 unk10; + struct DodrioSubstruct_31A0_14 unk14; + struct DodrioSubstruct_31A0_2C unk2C; + u8 filler_35[4]; }; // size = 0x3C -struct DodrioBerryPickingSubstruct_318C +struct DodrioSubstruct_318C { bool8 isShiny; }; -struct DodrioBerryPickingStruct +struct DodrioSubstruct_3308 +{ + u8 unk0; + u32 unk4; +}; + +struct DodrioStruct { /*0x0000*/ void (*savedCallback)(void); - /*0x0004*/ u8 unk_0004; - /*0x0005*/ u8 filler_0005[3]; - /*0x0008*/ u8 unk_0008; - /*0x0009*/ u8 filler_0009[3]; - /*0x000C*/ u8 unk_000C; - /*0x000D*/ u8 filler_000D[3]; - /*0x0010*/ u8 unk_0010; - /*0x0011*/ u8 filler_0011[3]; - /*0x0014*/ u8 unk_0014; - /*0x0015*/ u8 filler_0015[3]; - /*0x0018*/ u8 unk_0018; - /*0x0019*/ u8 filler_0019[3]; - /*0x001C*/ u8 unk_001C; - /*0x001D*/ u8 filler_001D[3]; - /*0x0020*/ u8 unk_0020; - /*0x0021*/ u8 filler_0021[3]; - /*0x0024*/ u8 unk_0024; - /*0x0025*/ u8 filler_0025[3]; - /*0x0028*/ u8 multiplayerId; + /*0x0004*/ u8 ALIGNED(4) unk04; + /*0x0008*/ u8 ALIGNED(4) unk08; + /*0x000C*/ u8 ALIGNED(4) unk0C; + /*0x0010*/ u8 ALIGNED(4) unk10; + /*0x0014*/ u8 ALIGNED(4) unk14; + /*0x0018*/ u8 ALIGNED(4) unk18; + /*0x001C*/ u8 ALIGNED(4) unk1C; + /*0x0020*/ u8 ALIGNED(4) unk20; + /*0x0024*/ u8 ALIGNED(4) unk24; + /*0x0028*/ u8 ALIGNED(4) multiplayerId; /*0x0029*/ u8 filler_0029[7]; - /*0x0030*/ u8 unk_0030; - /*0x0031*/ u8 filler_0031[3]; - /*0x0034*/ u8 unk_0034[5]; - /*0x0039*/ u8 filler_0039[3]; - /*0x003C*/ u8 unk_003C; - /*0x003D*/ u8 filler_003D[3]; - /*0x0040*/ u8 unk_0040; - /*0x0041*/ u8 filler_0041[3]; - /*0x0044*/ u8 unk_0044; - /*0x0045*/ u8 filler_0045[3]; - /*0x0048*/ u8 unk_0048; - // align 1 - /*0x004A*/ u16 unk_004A[5][6]; - /*0x0086*/ u16 unk_0086[5]; - /*0x0090*/ u8 unk_0090[5]; - /*0x0095*/ u8 filler_0095[3]; - /*0x0098*/ u8 unk_0098[4]; - /*0x009C*/ u8 unk_009C[12]; - /*0x00A8*/ u8 unk_00A8[5]; - /*0x00AD*/ u8 filler_00AD[3]; - /*0x00B0*/ u8 unk_00B0[5]; - /*0x00B5*/ u8 filler_00B5[3]; - /*0x00B8*/ u8 unk_00B8[5]; - /*0x00BD*/ u8 filler_00BD[7]; - /*0x00C4*/ u8 unk_00C4[11]; - /*0x00CF*/ u8 filler_00CF[1]; - /*0x00D0*/ u8 unk_00D0[11]; - /*0x00DB*/ u8 filler_00DB[1]; - /*0x00DC*/ u8 unk_00DC[11]; - /*0x00E7*/ u8 filler_0xE7[1]; - /*0x00E8*/ u8 unk_00E8[5]; - /*0x00ED*/ u8 filler_00ED[7]; - /*0x00F4*/ u8 unk_00F4[11][2]; - /*0x010A*/ u8 filler_010A[2]; - /*0x010C*/ u8 unk_010C[5]; - /*0x0111*/ u8 filler_0111[3]; - /*0x0114*/ u16 unk_0114; - // align 2 - /*0x0118*/ u32 unk_0118; - /*0x011C*/ u32 unk_011C; - /*0x0120*/ u32 unk_0120; - /*0x0124*/ u8 unk_0124; - /*0x0125*/ u8 filler_0125[3]; - /*0x0128*/ u8 unk_0128; - // align 2 - /*0x012C*/ u32 unk_012C; - /*0x0130*/ u32 unk_0130[5]; - /*0x0144*/ u8 unk_0144; - /*0x0145*/ u8 filler_0145[3]; - /*0x0148*/ u8 unk_0148[11]; - /*0x0153*/ u8 filler_0153[1]; - /*0x0154*/ u8 unk_0154; - /*0x0155*/ u8 filler_0155[11]; - /*0x0160*/ struct DodrioBerryPickingSubstruct_0160 unk_0160; - /*0x318C*/ struct DodrioBerryPickingSubstruct_318C unk_318C[5]; - /*0x31A0*/ struct DodrioBerryPickingSubstruct_31A0 unk_31A0[5]; - /*0x32CC*/ struct DodrioBerryPickingSubstruct_31A0 unk_32CC; - /*0x3308*/ u8 unk_3308[0x3330 - 0x3308]; + /*0x0030*/ u8 ALIGNED(4) unk30; + /*0x0034*/ u8 ALIGNED(4) unk34[5]; + /*0x003C*/ u8 ALIGNED(4) unk3C; + /*0x0040*/ u8 ALIGNED(4) unk40; + /*0x0044*/ u8 ALIGNED(4) unk44; + /*0x0048*/ u8 ALIGNED(4) unk48; + /*0x004A*/ u16 unk4A[5][6]; + /*0x0086*/ u16 unk86[5]; + /*0x0090*/ u8 ALIGNED(4) unk90[5]; + /*0x0098*/ u8 ALIGNED(4) unk98[4]; + /*0x009C*/ u8 ALIGNED(4) unk9C[11]; + /*0x00A8*/ u8 ALIGNED(4) unkA8[5]; + /*0x00B0*/ u8 ALIGNED(4) unkB0[5]; + /*0x00B8*/ u8 ALIGNED(4) unkB8[11]; + /*0x00C4*/ u8 ALIGNED(4) unkC4[11]; + /*0x00D0*/ u8 ALIGNED(4) unkD0[11]; + /*0x00DC*/ u8 ALIGNED(4) unkDC[11]; + /*0x00E8*/ u8 ALIGNED(4) unkE8[11]; + /*0x00F4*/ u8 ALIGNED(4) unkF4[11][2]; + /*0x010C*/ u8 ALIGNED(4) unk10C[5]; + /*0x0112*/ u16 unk112; + /*0x0114*/ u16 unk114; + /*0x0118*/ u32 unk118; + /*0x011C*/ u32 unk11C; + /*0x0120*/ u32 unk120; + /*0x0124*/ u8 ALIGNED(4) unk124; + /*0x0128*/ u8 ALIGNED(4) unk128; + /*0x012C*/ u32 unk12C; + /*0x0130*/ u32 unk130[5]; + /*0x0144*/ u8 ALIGNED(4) unk144; + /*0x0148*/ u8 ALIGNED(4) unk148[11]; + /*0x0154*/ u8 ALIGNED(4) unk154; + /*0x0158*/ u8 ALIGNED(4) unk158[5]; + /*0x0160*/ struct DodrioSubstruct_0160 unk160; + /*0x318C*/ struct DodrioSubstruct_318C unk318C[5]; + /*0x31A0*/ struct DodrioSubstruct_31A0 unk31A0[5]; + /*0x32CC*/ struct DodrioSubstruct_31A0 unk32CC; + /*0x3308*/ struct DodrioSubstruct_3308 unk3308[5]; }; // size = 0x3330 -EWRAM_DATA struct DodrioBerryPickingStruct * gUnknown_02022C98 = NULL; -EWRAM_DATA u16 * gUnknown_02022C9C[5] = {NULL}; -EWRAM_DATA u16 * gUnknown_02022CB0[2] = {NULL}; -EWRAM_DATA u16 * gUnknown_02022CB8[11] = {NULL}; -EWRAM_DATA u16 * gUnknown_02022CE4[4] = {NULL}; -EWRAM_DATA struct DodrioBerryPickingStruct_2022CF4 * gUnknown_02022CF4 = NULL; -EWRAM_DATA struct DodrioBerryPickingSubstruct_0160 * gUnknown_02022CF8 = NULL; +EWRAM_DATA static struct DodrioStruct * gUnknown_02022C98 = NULL; +EWRAM_DATA static u16 *gUnknown_02022C9C[5] = {NULL}; +EWRAM_DATA static u16 *gUnknown_02022CB0[2] = {NULL}; +EWRAM_DATA static u16 *gUnknown_02022CB8[11] = {NULL}; +EWRAM_DATA static u16 *gUnknown_02022CE4[4] = {NULL}; +EWRAM_DATA static struct DodrioStruct_2022CF4 *gUnknown_02022CF4 = NULL; +EWRAM_DATA static struct DodrioSubstruct_0160 *gUnknown_02022CF8 = NULL; static bool32 gUnknown_03000DB0; -void sub_8024A1C(void); -void sub_8024A30(struct DodrioBerryPickingStruct *); -void sub_8024BC8(u8 taskId); -void sub_8024DBC(void); -void sub_8024E00(void); -void sub_8024E38(void); -void sub_8024F10(void); -void sub_8024F38(void); -void sub_8024FFC(void); -void sub_80250D4(void); -void sub_8025158(void); -void sub_8025198(void); -void sub_8025230(void); -void sub_8025324(void); -void sub_8025470(void); -void sub_8025644(void); -void sub_80256AC(void); -void sub_8025758(void); -void sub_802589C(u8 taskId); -void sub_8025910(u8 taskId); -void sub_8025D04(void); -void sub_8025D50(void); -void sub_8025E0C(void); -void sub_8025ED8(void); -void sub_8025F48(void); -void sub_8026044(void); -void sub_80261CC(void); -void sub_80261E4(void); -void sub_80261F8(struct DodrioBerryPickingSubstruct_318C *, struct Pokemon *); -void sub_802620C(TaskFunc, u8); -void sub_802621C(TaskFunc); -void sub_8026240(u8); -bool32 sub_8026264(void); -void sub_80262C0(void); -u32 sub_8026634(u8, u8, u8); -void sub_802671C(void); -void sub_8026AF4(void); -void sub_8026B28(void); -void sub_8026B5C(u8, u8*, u8*); -u32 sub_8026BB8(void); -void sub_8026C28(void); -bool32 sub_8026C50(void); -bool32 sub_8026C90(void); -void sub_8026D1C(u8); -u8 sub_8026D8C(u8); -u8 sub_8026DB0(u8, u8); -void sub_8026F1C(u8, u8, u8); -void sub_8027234(u8); -void sub_80272A4(void); -void sub_80272E8(void); -void sub_80273F0(void); -void sub_802749C(void); -u8 sub_8027518(u8); -void sub_8027554(void); -void sub_8027608(void); -u32 sub_8027748(void); -void sub_8027DD0(u8); -u32 sub_8027E30(struct DodrioBerryPickingSubstruct_31A0 *, u8 *, u8 *, u8 *, u8 *, u8 *, u8, u32, u32); -u32 sub_8028164(u32 unused, struct DodrioBerryPickingSubstruct_31A0 *, u8 *, u8 *, u8 *, u8 *, u8 *, u8 *, u32 *, u32 *); -void sub_80282EC(u8); -u32 sub_8028318(u8, u8 *); -void sub_8028350(u8); -bool32 sub_8028374(u8); -void sub_80283A8(void); -void sub_8028408(struct DodrioBerryPickingSubstruct_318C *, u8, u8, u8); -void sub_80284CC(u8); -void sub_8028504(u8); -void sub_8028614(u8); -void sub_802868C(u8, u8); -void sub_8028734(void); -void sub_80287E4(void); -void sub_80289E8(u8); -void sub_80286E4(void); -bool32 sub_8028828(void); -void sub_8028A34(void); -void sub_8028A88(void); -void sub_8028B80(void); -void sub_8028D44(void); -void sub_8028DFC(void); -void sub_8028E4C(void); -void sub_8028E84(void); -void sub_8028EC8(u8); -void sub_8028FCC(void); -void sub_802903C(void); -void sub_8029274(struct DodrioBerryPickingSubstruct_0160 *); -void sub_80292E0(u8); -bool32 sub_802A770(void); -u8 sub_802A794(void); +static void sub_8024A1C(void); +static void sub_8024A30(struct DodrioStruct *); +static void sub_8024BC8(u8 taskId); +static void sub_8024DBC(void); +static void sub_8024E00(void); +static void sub_8024E38(void); +static void sub_8024F10(void); +static void sub_8024F38(void); +static void sub_8024FFC(void); +static void sub_80250D4(void); +static void sub_8025158(void); +static void sub_8025198(void); +static void sub_8025230(void); +static void sub_8025324(void); +static void sub_8025470(void); +static void sub_8025644(void); +static void sub_80256AC(void); +static void sub_8025758(void); +static void sub_802589C(u8 taskId); +static void sub_8025910(u8 taskId); +static void sub_8025D04(void); +static void sub_8025D50(void); +static void sub_8025E0C(void); +static void sub_8025ED8(void); +static void sub_8025F48(void); +static void sub_8026044(void); +static void sub_80261CC(void); +static void sub_80261E4(void); +static void sub_80261F8(struct DodrioSubstruct_318C *, struct Pokemon *); +static void sub_802620C(TaskFunc, u8); +static void sub_802621C(TaskFunc); +static void sub_8026240(u8); +static bool32 sub_8026264(void); +static void sub_80262C0(void); +static bool32 sub_8026634(u8, u8, u8); +static void sub_802671C(void); +static void sub_8026AF4(void); +static void sub_8026B28(void); +static void sub_8026B5C(u8, u8*, u8*); +static bool32 sub_8026BB8(void); +static void sub_8026C28(void); +static bool32 sub_8026C50(void); +static bool32 sub_8026C90(void); +static void sub_8026D1C(u8); +static u8 sub_8026D8C(u8); +static u8 sub_8026DB0(u8, u8); +static void sub_8026F1C(u8, u8, u8); +static void sub_8027234(bool32 arg0); +static void sub_80272A4(void); +static void sub_80272E8(void); +static void sub_80273F0(void); +static void sub_802749C(void); +static u8 sub_8027518(u8); +static void sub_8027554(void); +static void sub_8027608(void); +static u32 sub_8027748(void); +static void sub_8027DD0(u32 arg0); +static void sub_8027E30(struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 arg6, u32 arg7, u32 arg8); +static u32 sub_8028164(u32 unused, struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 *arg6, u32 *arg7, u32 *arg8); +static void sub_80282EC(u8); +static u32 sub_8028318(u32 arg0, u8 *arg1); +static void sub_8028350(u32 arg0); +static u32 sub_8028374(u32 arg0); +static void sub_80283A8(void); +static void sub_8028408(struct DodrioSubstruct_318C *arg0, u8 arg1, u8 id, u8 arg3); +static void sub_80284CC(u8); +static void sub_8028504(u8); +static void sub_8028614(u8 count); +static void sub_802868C(bool8 invisible, u8 count); +static void sub_8028734(void); +static void sub_80287E4(void); +static void sub_80289E8(bool8 invisible); +static void sub_80286E4(void); +static bool32 sub_8028828(void); +static void sub_8028A34(void); +static void sub_8028A88(void); +static void sub_8028B80(void); +static void sub_8028D44(void); +static void sub_8028DFC(void); +static void sub_8028E4C(void); +static void sub_8028E84(void); +static void sub_8028EC8(bool8 invisible); +static void sub_8028FCC(void); +static void sub_802903C(void); +static void sub_8029274(struct DodrioSubstruct_0160 *PTR); +static void sub_80292E0(u8); +static bool32 sub_802A770(void); +static u8 sub_802A794(void); +static void sub_8028BF8(u8 id, bool8 invisible); +static void sub_8028C30(bool8 invisible); +static void sub_8028CA4(u16 id, u8 frameNum); +static void sub_8028C7C(u8 id, u8 y); +static void sub_80286B4(u8 id, u8 frameNum); +static u8 sub_8026E70(u8 arg0, u8 arg1); +static void sub_80288D4(u8 arg0); +static u32 sub_8027DFC(u32 arg0); +static u32 IncrementWithLimit(u32 arg0, u32 arg1); +static u32 Min(u32 arg0, u32 arg1); +static u32 sub_80276C0(u8 arg0); +static void sub_8027ACC(u8 taskId); +static void sub_8029314(u8 taskId); +static void sub_8027BEC(u8 windowId, s32 width); +static void nullsub_15(struct Sprite *sprite); +static void sub_80284A8(struct Sprite *sprite); +static u32 sub_802853C(struct Sprite *sprite); +static u32 sub_80285AC(struct Sprite *sprite); +static s16 sub_8028F14(u8 arg0, u8 arg1); +static void sub_8028654(bool8 invisible, u8 id); +static void sub_8029338(void); +static bool32 sub_802A8E8(void); +static void sub_802A7A8(void); +static void sub_802A72C(void (*func)(void)); +static void (*sub_802A75C(void))(void); +static void sub_8029338(void); +static void sub_8029440(void); +static void sub_802988C(void); +static void sub_802A010(void); +static void sub_802A380(void); +static void sub_802A454(void); +static void sub_802A534(void); +static void sub_802A588(void); +static void sub_802A6FC(void); +static void nullsub_16(void); -extern const u8 gUnknown_082F7A88[][3]; -extern const u8 gUnknown_082F449C[]; -extern const u8 gUknnown_082F45AF[]; -extern const u8 gUnknown_082F7A94[]; -extern void (*const gUnknown_082F7AC4[])(void); -extern void (*const gUnknown_082F7AF4[])(void); +// const rom data +static const u8 gUnknown_082F449C[5][5][11] = +{ + { + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, + }, + { + {0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 0}, + {0, 1, 2, 5, 6, 3, 4, 5, 8, 9, 0}, + }, + { + {0, 1, 2, 3, 4, 5, 6, 7, 2, 9, 0}, + {0, 1, 4, 5, 6, 7, 2, 3, 4, 9, 0}, + {0, 1, 6, 7, 2, 3, 4, 5, 6, 9, 0}, + }, + { + {0, 1, 2, 3, 4, 5, 6, 7, 8, 1, 0}, + {0, 3, 4, 5, 6, 7, 8, 1, 2, 3, 0}, + {0, 5, 6, 7, 8, 1, 2, 3, 4, 5, 0}, + {0, 7, 8, 1, 2, 3, 4, 5, 6, 7, 0}, + }, + { + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, + {2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2}, + {4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4}, + {6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6}, + {8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8}, + }, +}; -void sub_802493C(u16 a0, void (*a1)(void)) +static const u8 gUknnown_082F45AF[5][5][3] = +{ + { + {4, 5, 6}, + }, + { + {3, 4, 5}, + {5, 6, 3}, + }, + { + {4, 5, 6}, + {6, 7, 2}, + {2, 3, 4}, + }, + { + {3, 4, 5}, + {5, 6, 7}, + {7, 8, 1}, + {1, 2, 3}, + }, + { + {4, 5, 6}, + {6, 7, 8}, + {8, 9, 0}, + {0, 1, 2}, + {2, 3, 4}, + }, +}; + +static const u8 gUnknown_082F45FA[5][5][3] = +{ + { + {1, 0, 1}, + }, + { + {1, 0, 1}, + {0, 1, 0}, + }, + { + {2, 0, 1}, + {0, 1, 2}, + {1, 2, 0}, + }, + { + {3, 0, 1}, + {0, 1, 2}, + {1, 2, 3}, + {2, 3, 0}, + }, + { + {4, 0, 1}, + {0, 1, 2}, + {1, 2, 3}, + {2, 3, 4}, + {3, 4, 0}, + }, +}; + +ALIGNED(4) +static const u8 gUnknown_082F4648[5][11] = +{ + {9, 9, 9, 9, 1, 1, 1, 9, 9, 9, 9}, + {9, 9, 9, 0, 0, 1, 1, 0, 9, 9, 9}, + {9, 9, 2, 2, 0, 0, 1, 1, 1, 9, 9}, + {9, 3, 3, 0, 0, 1, 1, 2, 2, 3, 9}, + {3, 3, 4, 4, 0, 0, 1, 1, 2, 2, 3}, +}; + +static const u8 gUnknown_082F467F[5][5] = +{ + {5}, + {4, 6}, + {3, 5, 7}, + {2, 4, 6, 8}, + {1, 3, 5, 6, 9}, +}; + +// Duplicate and unused gfx. Feel free to remove. +static const u32 sDuplicateGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_bg1.gbapal", + "graphics/link_games/dodrioberry_bg2.gbapal", + "graphics/link_games/dodrioberry_pkmn.gbapal", + "graphics/link_games/dodrioberry_shiny.gbapal", + "graphics/link_games/dodrioberry_status.gbapal", + "graphics/link_games/dodrioberry_berrysprites.gbapal", + "graphics/link_games/dodrioberry_berrysprites.4bpp.lz", + "graphics/link_games/dodrioberry_platform.gbapal", + "graphics/link_games/dodrioberry_bg1.4bpp.lz", + "graphics/link_games/dodrioberry_bg2.4bpp.lz", + "graphics/link_games/dodrioberry_status.4bpp.lz", + "graphics/link_games/dodrioberry_platform.4bpp.lz", + "graphics/link_games/dodrioberry_pkmn.4bpp.lz", + "graphics/link_games/dodrioberry_bg1.bin.lz", + "graphics/link_games/dodrioberry_bg2right.bin.lz", + "graphics/link_games/dodrioberry_bg2left.bin.lz"); + + +static const u8 gUnknown_082F7A88[][3] = +{ + {40, 24, 13}, + {32, 19, 10}, + {22, 13, 7}, +}; + +ALIGNED(4) +static const u8 gUnknown_082F7A94[] = {8, 5, 8, 11, 15}; + +ALIGNED(4) +static const u8 gUnknown_082F7A9C[] = {5, 10, 20, 30, 50, 70, 100}; + +ALIGNED(4) +static const u8 gUnknown_082F7AA4[][10] = +{ + {15, 16, 17, 18, 19, 19, 18, 17, 16, 15}, + {20, 21, 22, 23, 24, 25, 26, 27, 28, 29}, + {30, 31, 32, 33, 34, 34, 33, 32, 31, 30}, +}; + +static void (*const gUnknown_082F7AC4[])(void) = +{ + sub_8024DBC, + sub_8024E00, + sub_8024E38, + sub_8024F10, + sub_8024F38, + sub_8025198, + sub_8025324, + sub_8025470, + sub_8025644, + sub_80256AC, + sub_8025758, + sub_80250D4 +}; + +static void (*const gUnknown_082F7AF4[])(void) = +{ + sub_8024DBC, + sub_8024E00, + sub_8024E38, + sub_8024F10, + sub_8024FFC, + sub_8025230, + sub_8025324, + sub_8025470, + sub_8025644, + sub_80256AC, + sub_8025758, + sub_8025158 +}; + +// code +void sub_802493C(u16 a0, void (*callback)(void)) { gUnknown_03000DB0 = FALSE; @@ -251,108 +458,108 @@ void sub_802493C(u16 a0, void (*a1)(void)) { sub_8024A1C(); sub_8024A30(gUnknown_02022C98); - gUnknown_02022C98->savedCallback = a1; + gUnknown_02022C98->savedCallback = callback; gUnknown_02022C98->multiplayerId = GetMultiplayerId(); - gUnknown_02022C98->unk_32CC = gUnknown_02022C98->unk_31A0[gUnknown_02022C98->multiplayerId]; - sub_80261F8(&gUnknown_02022C98->unk_318C[gUnknown_02022C98->multiplayerId], &gPlayerParty[a0]); + gUnknown_02022C98->unk32CC = gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId]; + sub_80261F8(&gUnknown_02022C98->unk318C[gUnknown_02022C98->multiplayerId], &gPlayerParty[a0]); CreateTask(sub_8024BC8, 1); SetMainCallback2(sub_80261CC); sub_80273F0(); - sub_8026B5C(gUnknown_02022C98->unk_0024, &gUnknown_02022C98->unk_0044, &gUnknown_02022C98->unk_0048); + sub_8026B5C(gUnknown_02022C98->unk24, &gUnknown_02022C98->unk44, &gUnknown_02022C98->unk48); StopMapMusic(); PlayNewMapMusic(MUS_RG_KINOMIKUI); } else { - SetMainCallback2(a1); + SetMainCallback2(callback); return; } } -void sub_8024A1C(void) +static void sub_8024A1C(void) { ResetTasks(); ResetSpriteData(); FreeAllSpritePalettes(); } -void sub_8024A30(struct DodrioBerryPickingStruct * data) +static void sub_8024A30(struct DodrioStruct * data) { u8 i; - data->unk_000C = 0; - data->unk_0010 = 0; - data->unk_0014 = 0; - data->unk_0018 = 0; - data->unk_001C = 0; - data->unk_011C = 0; - data->unk_0120 = 0; - data->unk_0030 = 0; - data->unk_0040 = 0; - data->unk_003C = 0; - data->unk_012C = 0; + data->unk0C = 0; + data->unk10 = 0; + data->unk14 = 0; + data->unk18 = 0; + data->unk1C = 0; + data->unk11C = 0; + data->unk120 = 0; + data->unk30 = 0; + data->unk40 = 0; + data->unk3C = 0; + data->unk12C = 0; for (i = 0; i < 4; i++) { - data->unk_0098[i] = 0; + data->unk98[i] = 0; } for (i = 0; i < 5; i++) { - data->unk_00A8[i] = 0; - data->unk_00B0[i] = 0; - data->unk_004A[i][0] = 0; - data->unk_004A[i][1] = 0; - data->unk_004A[i][2] = 0; - data->unk_004A[i][3] = 0; - data->unk_004A[i][5] = 0; - data->unk_010C[i] = 0; - data->unk_0130[i] = 0; + data->unkA8[i] = 0; + data->unkB0[i] = 0; + data->unk4A[i][0] = 0; + data->unk4A[i][1] = 0; + data->unk4A[i][2] = 0; + data->unk4A[i][3] = 0; + data->unk4A[i][5] = 0; + data->unk10C[i] = 0; + data->unk130[i] = 0; } for (i = 0; i < 11; i++) { - data->unk_00D0[i] = 0; - data->unk_00DC[i] = 0; - data->unk_00C4[i] = 0; - data->unk_00F4[i][0] = 0xFF; - data->unk_00F4[i][1] = 0xFF; + data->unkD0[i] = 0; + data->unkDC[i] = 0; + data->unkC4[i] = 0; + data->unkF4[i][0] = 0xFF; + data->unkF4[i][1] = 0xFF; } - data->unk_0020 = GetMultiplayerId() == 0 ? 1 : 0; - data->unk_0024 = GetLinkPlayerCount(); - data->unk_0034[0] = GetMultiplayerId(); - for (i = 1; i < data->unk_0024; i++) + data->unk20 = GetMultiplayerId() == 0 ? 1 : 0; + data->unk24 = GetLinkPlayerCount(); + data->unk34[0] = GetMultiplayerId(); + for (i = 1; i < data->unk24; i++) { - data->unk_0034[i] = data->unk_0034[i - 1] + 1; - if (data->unk_0034[i] > data->unk_0024 - 1) - data->unk_0034[i] %= data->unk_0024; + data->unk34[i] = data->unk34[i - 1] + 1; + if (data->unk34[i] > data->unk24 - 1) + data->unk34[i] %= data->unk24; } } -void sub_8024BC8(u8 taskId) +static void sub_8024BC8(u8 taskId) { u8 r4, r5; - switch (gUnknown_02022C98->unk_000C) + switch (gUnknown_02022C98->unk0C) { case 0: SetVBlankCallback(NULL); sub_802620C(sub_8025910, 4); - gUnknown_02022C98->unk_000C++; + gUnknown_02022C98->unk0C++; break; case 1: if (!FuncIsActiveTask(sub_8025910)) { - sub_8029274(&gUnknown_02022C98->unk_0160); - gUnknown_02022C98->unk_000C++; + sub_8029274(&gUnknown_02022C98->unk160); + gUnknown_02022C98->unk0C++; } break; case 2: if (!sub_802A770()) { sub_8010434(); - gUnknown_02022C98->unk_000C++; + gUnknown_02022C98->unk0C++; } break; case 3: @@ -363,37 +570,37 @@ void sub_8024BC8(u8 taskId) LoadWirelessStatusIndicatorSpriteGfx(); CreateWirelessStatusIndicatorSprite(0, 0); } - gUnknown_02022C98->unk_000C++; + gUnknown_02022C98->unk0C++; } break; case 4: - r5 = gUnknown_02022C98->unk_0024; + r5 = gUnknown_02022C98->unk24; sub_80283A8(); for (r4 = 0; r4 < r5; r4++) { - sub_8028408(&gUnknown_02022C98->unk_318C[gUnknown_02022C98->unk_0034[r4]], r4, gUnknown_02022C98->unk_0034[r4], gUnknown_02022C98->unk_0024); + sub_8028408(&gUnknown_02022C98->unk318C[gUnknown_02022C98->unk34[r4]], r4, gUnknown_02022C98->unk34[r4], gUnknown_02022C98->unk24); } - sub_802868C(0, gUnknown_02022C98->unk_0024); - gUnknown_02022C98->unk_000C++; + sub_802868C(FALSE, gUnknown_02022C98->unk24); + gUnknown_02022C98->unk0C++; break; case 5: sub_8028A34(); sub_8028A88(); sub_8028D44(); sub_8028734(); - gUnknown_02022C98->unk_000C++; + gUnknown_02022C98->unk0C++; break; case 6: BlendPalettes(0xFFFFFFFF, 0x10, 0x00); BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); SetVBlankCallback(sub_80261E4); - gUnknown_02022C98->unk_000C++; + gUnknown_02022C98->unk0C++; break; case 7: UpdatePaletteFade(); if (!gPaletteFade.active) { - gUnknown_02022C98->unk_000C++; + gUnknown_02022C98->unk0C++; } break; default: @@ -403,36 +610,36 @@ void sub_8024BC8(u8 taskId) } } -void sub_8024D4C(u8 taskId) +static void sub_8024D4C(u8 taskId) { sub_8025D04(); - gUnknown_082F7AC4[gUnknown_02022C98->unk_0018](); - if (gUnknown_03000DB0 == FALSE) + gUnknown_082F7AC4[gUnknown_02022C98->unk18](); + if (!gUnknown_03000DB0) { sub_8026AF4(); } sub_8025D50(); } -void sub_8024D84(u8 taskId) +static void sub_8024D84(u8 taskId) { sub_8025E0C(); - gUnknown_082F7AF4[gUnknown_02022C98->unk_0018](); - if (gUnknown_03000DB0 == FALSE) + gUnknown_082F7AF4[gUnknown_02022C98->unk18](); + if (!gUnknown_03000DB0) { sub_8026B28(); } sub_8025ED8(); } -void sub_8024DBC(void) +static void sub_8024DBC(void) { - switch (gUnknown_02022C98->unk_0010) + switch (gUnknown_02022C98->unk10) { case 0: sub_8028504(1); sub_80292E0(1); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; break; case 1: if (!sub_802A770()) @@ -441,50 +648,50 @@ void sub_8024DBC(void) } } -void sub_8024E00(void) +static void sub_8024E00(void) { - if (gUnknown_02022C98->unk_0010 == 0) + if (gUnknown_02022C98->unk10 == 0) { sub_80262C0(); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } else { - gUnknown_02022C98->unk_0118 = 1; + gUnknown_02022C98->unk118 = 1; sub_8026240(2); } } -void sub_8024E38(void) +static void sub_8024E38(void) { - switch (gUnknown_02022C98->unk_0010) + switch (gUnknown_02022C98->unk10) { case 0: sub_802EB24(7, 8, 120, 80, 0); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; break; case 1: sub_8010434(); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; break; case 2: if (IsLinkTaskFinished()) { - gUnknown_02022C98->unk_0010++; - gUnknown_02022C98->unk_0030 = 0; + gUnknown_02022C98->unk10++; + gUnknown_02022C98->unk30 = 0; } break; case 3: if (!sub_802EB84()) { - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } break; case 4: - if (++gUnknown_02022C98->unk_0030 > 5) + if (++gUnknown_02022C98->unk30 > 5) { sub_8010434(); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } break; case 5: @@ -496,52 +703,52 @@ void sub_8024E38(void) } } -void sub_8024F10(void) +static void sub_8024F10(void) { - if (gUnknown_02022C98->unk_0010 == 0) + if (gUnknown_02022C98->unk10 == 0) { - if (gUnknown_02022C98->unk_011C != 0) + if (gUnknown_02022C98->unk11C != 0) { sub_8026240(4); } } } -void sub_8024F38(void) +static void sub_8024F38(void) { - if (gUnknown_02022C98->unk_0010 == 0) + if (gUnknown_02022C98->unk10 == 0) { - if (gUnknown_02022C98->unk_0040 < 10) + if (gUnknown_02022C98->unk40 < 10) { - if (gUnknown_02022C98->unk_00A8[0] == 0) + if (gUnknown_02022C98->unkA8[0] == 0) { if (JOY_NEW(DPAD_UP)) { - if (gUnknown_02022C98->unk_31A0[0].unk_2C == 0) + if (gUnknown_02022C98->unk31A0[0].unk2C.unk0 == 0) { - gUnknown_02022C98->unk_31A0[0].unk_30 = 0; - gUnknown_02022C98->unk_31A0[0].unk_2C = sub_8027518(2); + gUnknown_02022C98->unk31A0[0].unk2C.unk4 = 0; + gUnknown_02022C98->unk31A0[0].unk2C.unk0 = sub_8027518(2); } } else if (JOY_NEW(DPAD_RIGHT)) { - if (gUnknown_02022C98->unk_31A0[0].unk_2C == 0) + if (gUnknown_02022C98->unk31A0[0].unk2C.unk0 == 0) { - gUnknown_02022C98->unk_31A0[0].unk_30 = 0; - gUnknown_02022C98->unk_31A0[0].unk_2C = sub_8027518(1); + gUnknown_02022C98->unk31A0[0].unk2C.unk4 = 0; + gUnknown_02022C98->unk31A0[0].unk2C.unk0 = sub_8027518(1); } } else if (JOY_NEW(DPAD_LEFT)) { - if (gUnknown_02022C98->unk_31A0[0].unk_2C == 0) + if (gUnknown_02022C98->unk31A0[0].unk2C.unk0 == 0) { - gUnknown_02022C98->unk_31A0[0].unk_30 = 0; - gUnknown_02022C98->unk_31A0[0].unk_2C = sub_8027518(3); + gUnknown_02022C98->unk31A0[0].unk2C.unk4 = 0; + gUnknown_02022C98->unk31A0[0].unk2C.unk0 = sub_8027518(3); } } else { - gUnknown_02022C98->unk_31A0[0].unk_2C = sub_8027518(0); + gUnknown_02022C98->unk31A0[0].unk2C.unk0 = sub_8027518(0); } } } @@ -554,34 +761,34 @@ void sub_8024F38(void) } } -void sub_8024FFC(void) +static void sub_8024FFC(void) { - if (gUnknown_02022C98->unk_0040 < 10) + if (gUnknown_02022C98->unk40 < 10) { if (JOY_NEW(DPAD_UP)) { - if (gUnknown_02022C98->unk_31A0[gUnknown_02022C98->multiplayerId].unk_2C == 0) + if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 == 0) { - gUnknown_02022C98->unk_32CC.unk_2C = 2; + gUnknown_02022C98->unk32CC.unk2C.unk0 = 2; } } else if (JOY_NEW(DPAD_RIGHT)) { - if (gUnknown_02022C98->unk_31A0[gUnknown_02022C98->multiplayerId].unk_2C == 0) + if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 == 0) { - gUnknown_02022C98->unk_32CC.unk_2C = 1; + gUnknown_02022C98->unk32CC.unk2C.unk0 = 1; } } else if (JOY_NEW(DPAD_LEFT)) { - if (gUnknown_02022C98->unk_31A0[gUnknown_02022C98->multiplayerId].unk_2C == 0) + if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 == 0) { - gUnknown_02022C98->unk_32CC.unk_2C = 3; + gUnknown_02022C98->unk32CC.unk2C.unk0 = 3; } } else { - gUnknown_02022C98->unk_32CC.unk_2C = 0; + gUnknown_02022C98->unk32CC.unk2C.unk0 = 0; } } else @@ -591,7 +798,7 @@ void sub_8024FFC(void) sub_8026044(); } -void sub_80250D4(void) +static void sub_80250D4(void) { u8 i; @@ -604,26 +811,26 @@ void sub_80250D4(void) } else { - gUnknown_02022C98->unk_012C = 1; - for (i = 1; i < gUnknown_02022C98->unk_0024; i++) + gUnknown_02022C98->unk12C = 1; + for (i = 1; i < gUnknown_02022C98->unk24; i++) { - if (gUnknown_02022C98->unk_0130[i] != 1) + if (gUnknown_02022C98->unk130[i] != 1) { - gUnknown_02022C98->unk_012C = 0; + gUnknown_02022C98->unk12C = 0; break; } } } } -void sub_8025158(void) +static void sub_8025158(void) { sub_8026044(); if (sub_8026C90() == 1) sub_8026240(5); } -bool32 sub_8025170(void) +static bool32 sub_8025170(void) { u8 r4 = GetBlockReceivedStatus(); u8 r0 = sub_800A9D8(); @@ -638,32 +845,32 @@ bool32 sub_8025170(void) } } -void sub_8025198(void) +static void sub_8025198(void) { - switch (gUnknown_02022C98->unk_0010) + switch (gUnknown_02022C98->unk10) { case 0: - if (SendBlock(0, gUnknown_02022C98->unk_004A, sizeof(gUnknown_02022C98->unk_004A))) + if (SendBlock(0, gUnknown_02022C98->unk4A, sizeof(gUnknown_02022C98->unk4A))) { - gUnknown_02022C98->unk_0008 = 0; - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk08 = 0; + gUnknown_02022C98->unk10++; } break; case 1: if (IsLinkTaskFinished()) { - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } break; case 2: if (sub_8025170()) { - gUnknown_02022C98->unk_0008 = gUnknown_02022C98->unk_0024; + gUnknown_02022C98->unk08 = gUnknown_02022C98->unk24; } - if (gUnknown_02022C98->unk_0008 >= gUnknown_02022C98->unk_0024) + if (gUnknown_02022C98->unk08 >= gUnknown_02022C98->unk24) { - gUnknown_02022C98->unk_0014++; - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk14++; + gUnknown_02022C98->unk10++; } break; default: @@ -676,38 +883,38 @@ void sub_8025198(void) } } -void sub_8025230(void) +static void sub_8025230(void) { u8 i; - switch (gUnknown_02022C98->unk_0010) { + switch (gUnknown_02022C98->unk10) { case 0: - if (SendBlock(0, gUnknown_02022C98->unk_004A[gUnknown_02022C98->unk_0014], - sizeof(gUnknown_02022C98->unk_004A))) { - gUnknown_02022C98->unk_0008 = 0; - gUnknown_02022C98->unk_0010++; + if (SendBlock(0, gUnknown_02022C98->unk4A[gUnknown_02022C98->unk14], + sizeof(gUnknown_02022C98->unk4A))) { + gUnknown_02022C98->unk08 = 0; + gUnknown_02022C98->unk10++; } break; case 1: if (IsLinkTaskFinished()) { - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } break; case 2: if (sub_8025170()) { - for (i = 0; i < gUnknown_02022C98->unk_0024; i++) { - memcpy(gUnknown_02022C98->unk_004A, gBlockRecvBuffer, sizeof(gUnknown_02022C98->unk_004A)); - gUnknown_02022C98->unk_0008 = gUnknown_02022C98->unk_0024; + for (i = 0; i < gUnknown_02022C98->unk24; i++) { + memcpy(gUnknown_02022C98->unk4A, gBlockRecvBuffer, sizeof(gUnknown_02022C98->unk4A)); + gUnknown_02022C98->unk08 = gUnknown_02022C98->unk24; } } - if (gUnknown_02022C98->unk_0008 >= gUnknown_02022C98->unk_0024) { - gUnknown_02022C98->unk_0014++; - gUnknown_02022C98->unk_0010++; + if (gUnknown_02022C98->unk08 >= gUnknown_02022C98->unk24) { + gUnknown_02022C98->unk14++; + gUnknown_02022C98->unk10++; } break; default: if (WaitFanfare(TRUE)) { - gUnknown_02022C98->unk_0114 = gUnknown_02022C98->unk_004A[gUnknown_02022C98->multiplayerId][5]; + gUnknown_02022C98->unk114 = gUnknown_02022C98->unk4A[gUnknown_02022C98->multiplayerId][5]; sub_8026240(6); FadeOutAndPlayNewMapMusic(MUS_RG_WIN_YASEI, 4); } @@ -715,56 +922,56 @@ void sub_8025230(void) } } -void sub_8025324(void) +static void sub_8025324(void) { u8 sp00 = 1; u8 i; - switch (gUnknown_02022C98->unk_0010) + switch (gUnknown_02022C98->unk10) { case 0: sub_802749C(); - sub_80289E8(1); + sub_80289E8(TRUE); sub_8028DFC(); - sub_8028EC8(1); + sub_8028EC8(TRUE); sub_80292E0(2); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; break; case 1: if (!sub_802A770()) { sub_80292E0(5); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } break; case 2: sp00 = sub_802A794(); if (SendBlock(0, &sp00, sizeof(sp00))) { - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } break; case 3: if (IsLinkTaskFinished()) { - gUnknown_02022C98->unk_0010++; - gUnknown_02022C98->unk_0008 = 0; + gUnknown_02022C98->unk10++; + gUnknown_02022C98->unk08 = 0; } break; case 4: if (sub_8025170()) { - for (i = 0; i < gUnknown_02022C98->unk_0024; i++) + for (i = 0; i < gUnknown_02022C98->unk24; i++) { - *(gUnknown_02022C98->unk_010C + i) = *(u8 *)gBlockRecvBuffer[i]; - gUnknown_02022C98->unk_0008 = gUnknown_02022C98->unk_0024; + *(gUnknown_02022C98->unk10C + i) = *(u8 *)gBlockRecvBuffer[i]; + gUnknown_02022C98->unk08 = gUnknown_02022C98->unk24; } } - if (gUnknown_02022C98->unk_0008 >= gUnknown_02022C98->unk_0024) { - if (++gUnknown_02022C98->unk_0014 >= 120) + if (gUnknown_02022C98->unk08 >= gUnknown_02022C98->unk24) { + if (++gUnknown_02022C98->unk14 >= 120) { sub_80292E0(6); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } } break; @@ -777,74 +984,74 @@ void sub_8025324(void) } } -void sub_8025470(void) +static void sub_8025470(void) { u8 sp0; u8 i; - switch (gUnknown_02022C98->unk_0010) + switch (gUnknown_02022C98->unk10) { case 0: if (sub_8027748() >= 3000) { sub_80292E0(4); } - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; break; case 1: if (!sub_802A770()) { sub_80292E0(3); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } break; case 2: sub_8028FCC(); sub_80272E8(); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; break; case 3: if ((sp0 = sub_802A794()) != 0) { - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } break; case 4: if (!sub_802A770()) { sub_80292E0(5); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } break; case 5: sp0 = sub_802A794(); if (SendBlock(0, &sp0, sizeof(sp0))) { - gUnknown_02022C98->unk_0008 = 0; - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk08 = 0; + gUnknown_02022C98->unk10++; } break; case 6: if (IsLinkTaskFinished()) { - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } break; case 7: if (sub_8025170()) { - for (i = 0; i < gUnknown_02022C98->unk_0024; i++) + for (i = 0; i < gUnknown_02022C98->unk24; i++) { - *(gUnknown_02022C98->unk_010C + i) = *(u8 *)gBlockRecvBuffer[i]; - gUnknown_02022C98->unk_0008 = gUnknown_02022C98->unk_0024; + *(gUnknown_02022C98->unk10C + i) = *(u8 *)gBlockRecvBuffer[i]; + gUnknown_02022C98->unk08 = gUnknown_02022C98->unk24; } } - if (gUnknown_02022C98->unk_0008 >= gUnknown_02022C98->unk_0024) { - if (++gUnknown_02022C98->unk_0014 >= 120) + if (gUnknown_02022C98->unk08 >= gUnknown_02022C98->unk24) { + if (++gUnknown_02022C98->unk14 >= 120) { sub_8027608(); sub_80292E0(6); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } } else @@ -855,9 +1062,9 @@ void sub_8025470(void) default: if (!sub_802A770()) { - for (i = 0; i < gUnknown_02022C98->unk_0024; i++) + for (i = 0; i < gUnknown_02022C98->unk24; i++) { - if (gUnknown_02022C98->unk_010C[i] == 2) + if (gUnknown_02022C98->unk10C[i] == 2) { sub_8026240(8); return; @@ -869,25 +1076,25 @@ void sub_8025470(void) } } -void sub_8025644(void) +static void sub_8025644(void) { - switch (gUnknown_02022C98->unk_0010) + switch (gUnknown_02022C98->unk10) { case 0: sub_800AC34(); sub_80292E0(7); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; break; case 1: if (!sub_802A770()) { - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } break; case 2: if (sub_802A794() == 5) { - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } break; default: @@ -899,35 +1106,35 @@ void sub_8025644(void) } } -void sub_80256AC(void) +static void sub_80256AC(void) { - switch (gUnknown_02022C98->unk_0010) + switch (gUnknown_02022C98->unk10) { case 0: BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; break; case 1: UpdatePaletteFade(); if (!gPaletteFade.active) { - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } break; case 2: sub_8028B80(); sub_80287E4(); - sub_8028614(gUnknown_02022C98->unk_0024); + sub_8028614(gUnknown_02022C98->unk24); sub_8028E84(); gUnknown_03000DB0 = TRUE; sub_80292E0(8); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; break; default: if (!sub_802A770()) { SetMainCallback2(gUnknown_02022C98->savedCallback); - DestroyTask(gUnknown_02022C98->unk_0004); + DestroyTask(gUnknown_02022C98->unk04); Free(gUnknown_02022C98); FreeAllWindowBuffers(); } @@ -935,20 +1142,20 @@ void sub_80256AC(void) } } -void sub_8025758(void) +static void sub_8025758(void) { - switch (gUnknown_02022C98->unk_0010) + switch (gUnknown_02022C98->unk10) { case 0: sub_80292E0(9); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; break; case 1: UpdatePaletteFade(); if (!gPaletteFade.active) { - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } break; case 2: @@ -960,66 +1167,66 @@ void sub_8025758(void) ChangeBgY(2, 0, 0); ChangeBgX(3, 0, 0); ChangeBgY(3, 0, 0); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; break; case 3: StopMapMusic(); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; break; case 4: PlayNewMapMusic(MUS_RG_KINOMIKUI); sub_8028E4C(); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; break; case 5: BlendPalettes(0xFFFFFFFF, 16, 0); BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; break; case 6: UpdatePaletteFade(); if (!gPaletteFade.active) { - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } break; default: - DestroyTask(gUnknown_02022C98->unk_0004); + DestroyTask(gUnknown_02022C98->unk04); sub_802621C(sub_802589C); sub_802903C(); sub_8024A30(gUnknown_02022C98); if (gReceivedRemoteLinkPlayers == 0) { - gUnknown_02022C98->unk_0024 = 1; + gUnknown_02022C98->unk24 = 1; } sub_80273F0(); - sub_8028EC8(0); + sub_8028EC8(FALSE); break; } } -void sub_802589C(u8 taskId) +static void sub_802589C(u8 taskId) { - switch (gUnknown_02022C98->unk_0010) + switch (gUnknown_02022C98->unk10) { case 0: if (sub_8026264() == 1) { - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } break; case 1: sub_80286E4(); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; break; case 2: - if (sub_8028828() == 1) + if (sub_8028828() == TRUE) { - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } break; default: - if (gUnknown_02022C98->unk_0020 != 0) + if (gUnknown_02022C98->unk20 != 0) { sub_802621C(sub_8024D4C); } @@ -1032,7 +1239,7 @@ void sub_802589C(u8 taskId) } } -void sub_8025910(u8 taskId) +static void sub_8025910(u8 taskId) { s16 * data = gTasks[taskId].data; u8 i; @@ -1040,9 +1247,9 @@ void sub_8025910(u8 taskId) switch (data[0]) { case 0: - if (SendBlock(0, &gUnknown_02022C98->unk_318C[gUnknown_02022C98->multiplayerId].isShiny, sizeof(gUnknown_02022C98->unk_318C[gUnknown_02022C98->multiplayerId].isShiny))) + if (SendBlock(0, &gUnknown_02022C98->unk318C[gUnknown_02022C98->multiplayerId].isShiny, sizeof(gUnknown_02022C98->unk318C[gUnknown_02022C98->multiplayerId].isShiny))) { - gUnknown_02022C98->unk_0008 = 0; + gUnknown_02022C98->unk08 = 0; data[0]++; } break; @@ -1055,129 +1262,129 @@ void sub_8025910(u8 taskId) case 2: if (sub_8025170()) { - for (i = 0; i < gUnknown_02022C98->unk_0024; i++) + for (i = 0; i < gUnknown_02022C98->unk24; i++) { - *(u8 *)&gUnknown_02022C98->unk_318C[i] = *(u8 *)gBlockRecvBuffer[i]; - gUnknown_02022C98->unk_0008 = gUnknown_02022C98->unk_0024; + *(u8 *)&gUnknown_02022C98->unk318C[i] = *(u8 *)gBlockRecvBuffer[i]; + gUnknown_02022C98->unk08 = gUnknown_02022C98->unk24; } } - if (gUnknown_02022C98->unk_0008 >= gUnknown_02022C98->unk_0024) + if (gUnknown_02022C98->unk08 >= gUnknown_02022C98->unk24) { DestroyTask(taskId); sub_80292E0(6); - gUnknown_02022C98->unk_0010++; + gUnknown_02022C98->unk10++; } break; } } -void sub_80259FC(void) +static void sub_80259FC(void) { u8 i; - u8 r7 = gUnknown_02022C98->unk_0024; + u8 r7 = gUnknown_02022C98->unk24; - gUnknown_02022C98->unk_31A0[0].unk_10 = sub_8028164(0, &gUnknown_02022C98->unk_31A0[0], &gUnknown_02022C98->unk_31A0[0].unk_2C, &gUnknown_02022C98->unk_31A0[1].unk_2C, &gUnknown_02022C98->unk_31A0[2].unk_2C, &gUnknown_02022C98->unk_31A0[3].unk_2C, &gUnknown_02022C98->unk_31A0[4].unk_2C, &gUnknown_02022C98->unk_0040, &gUnknown_02022C98->unk_0120, &gUnknown_02022C98->unk_012C); - gUnknown_02022C98->unk_0128 = 1; + gUnknown_02022C98->unk31A0[0].unk10 = sub_8028164(0, &gUnknown_02022C98->unk31A0[0], &gUnknown_02022C98->unk31A0[0].unk2C, &gUnknown_02022C98->unk31A0[1].unk2C, &gUnknown_02022C98->unk31A0[2].unk2C, &gUnknown_02022C98->unk31A0[3].unk2C, &gUnknown_02022C98->unk31A0[4].unk2C, &gUnknown_02022C98->unk40, &gUnknown_02022C98->unk120, &gUnknown_02022C98->unk12C); + gUnknown_02022C98->unk128 = 1; for (i = 1; i < r7; i++) { - if ( gUnknown_02022C98->unk_00A8[i] == 0 - && sub_8028318(i, &gUnknown_02022C98->unk_31A0[i].unk_2C) == 0) + if ( gUnknown_02022C98->unkA8[i] == 0 + && sub_8028318(i, &gUnknown_02022C98->unk31A0[i].unk2C.unk0) == 0) { - gUnknown_02022C98->unk_31A0[i].unk_2C = 0; - gUnknown_02022C98->unk_0128 = 0; + gUnknown_02022C98->unk31A0[i].unk2C.unk0 = 0; + gUnknown_02022C98->unk128 = 0; } } - if (++gUnknown_02022C98->unk_0124 >= 60) + if (++gUnknown_02022C98->unk124 >= 60) { - if (gUnknown_02022C98->unk_0128 != 0) + if (gUnknown_02022C98->unk128 != 0) { sub_8011AC8(); - gUnknown_02022C98->unk_0124 = 0; + gUnknown_02022C98->unk124 = 0; } - else if (gUnknown_02022C98->unk_0124 > 70) + else if (gUnknown_02022C98->unk124 > 70) { sub_8011AC8(); - gUnknown_02022C98->unk_0124 = 0; + gUnknown_02022C98->unk124 = 0; } } for (i = 0; i < r7; i++) { - if ( gUnknown_02022C98->unk_31A0[i].unk_2C != 0 - && gUnknown_02022C98->unk_00A8[i] == 0) + if ( gUnknown_02022C98->unk31A0[i].unk2C.unk0 != 0 + && gUnknown_02022C98->unkA8[i] == 0) { - gUnknown_02022C98->unk_00A8[i] = 1; + gUnknown_02022C98->unkA8[i] = 1; } - switch (gUnknown_02022C98->unk_00A8[i]) + switch (gUnknown_02022C98->unkA8[i]) { case 0: default: break; case 1 ... 3: - if (++gUnknown_02022C98->unk_00B0[i] >= 6) + if (++gUnknown_02022C98->unkB0[i] >= 6) { - gUnknown_02022C98->unk_00B0[i] = 0; - gUnknown_02022C98->unk_00A8[i] = 0; - gUnknown_02022C98->unk_31A0[i].unk_2C = 0; - gUnknown_02022C98->unk_31A0[i].unk_30 = 0; - gUnknown_02022C98->unk_31A0[i].unk_34 = 0; + gUnknown_02022C98->unkB0[i] = 0; + gUnknown_02022C98->unkA8[i] = 0; + gUnknown_02022C98->unk31A0[i].unk2C.unk0 = 0; + gUnknown_02022C98->unk31A0[i].unk2C.unk4 = 0; + gUnknown_02022C98->unk31A0[i].unk2C.unk8 = 0; } break; case 4: - if (++gUnknown_02022C98->unk_00B0[i] >= 40) + if (++gUnknown_02022C98->unkB0[i] >= 40) { - gUnknown_02022C98->unk_00B0[i] = 0; - gUnknown_02022C98->unk_00A8[i] = 0; - gUnknown_02022C98->unk_31A0[i].unk_2C = 0; - gUnknown_02022C98->unk_31A0[i].unk_30 = 0; - gUnknown_02022C98->unk_31A0[i].unk_34 = 0; + gUnknown_02022C98->unkB0[i] = 0; + gUnknown_02022C98->unkA8[i] = 0; + gUnknown_02022C98->unk31A0[i].unk2C.unk0 = 0; + gUnknown_02022C98->unk31A0[i].unk2C.unk4 = 0; + gUnknown_02022C98->unk31A0[i].unk2C.unk8 = 0; } break; } } } -void sub_8025C0C(void) +static void sub_8025C0C(void) { u8 i; - u8 r6 = gUnknown_02022C98->unk_0024; + u8 r6 = gUnknown_02022C98->unk24; - gUnknown_02022C98->unk_31A0[0].unk_10 = sub_8028164(0, &gUnknown_02022C98->unk_31A0[0], &gUnknown_02022C98->unk_31A0[0].unk_2C, &gUnknown_02022C98->unk_31A0[1].unk_2C, &gUnknown_02022C98->unk_31A0[2].unk_2C, &gUnknown_02022C98->unk_31A0[3].unk_2C, &gUnknown_02022C98->unk_31A0[4].unk_2C, &gUnknown_02022C98->unk_0040, &gUnknown_02022C98->unk_0120, &gUnknown_02022C98->unk_012C); - gUnknown_02022C98->unk_0128 = 1; + gUnknown_02022C98->unk31A0[0].unk10 = sub_8028164(0, &gUnknown_02022C98->unk31A0[0], &gUnknown_02022C98->unk31A0[0].unk2C, &gUnknown_02022C98->unk31A0[1].unk2C, &gUnknown_02022C98->unk31A0[2].unk2C, &gUnknown_02022C98->unk31A0[3].unk2C, &gUnknown_02022C98->unk31A0[4].unk2C, &gUnknown_02022C98->unk40, &gUnknown_02022C98->unk120, &gUnknown_02022C98->unk12C); + gUnknown_02022C98->unk128 = 1; for (i = 1; i < r6; i++) { if (sub_8028374(i) != 0) { - gUnknown_02022C98->unk_0130[i] = 1; - gUnknown_02022C98->unk_0128 = 0; + gUnknown_02022C98->unk130[i] = 1; + gUnknown_02022C98->unk128 = 0; } } - if (++gUnknown_02022C98->unk_0124 >= 60) + if (++gUnknown_02022C98->unk124 >= 60) { - if (gUnknown_02022C98->unk_0128 != 0) + if (gUnknown_02022C98->unk128 != 0) { sub_8011AC8(); - gUnknown_02022C98->unk_0124 = 0; + gUnknown_02022C98->unk124 = 0; } - else if (gUnknown_02022C98->unk_0124 > 70) + else if (gUnknown_02022C98->unk124 > 70) { sub_8011AC8(); - gUnknown_02022C98->unk_0124 = 0; + gUnknown_02022C98->unk124 = 0; } } } -void sub_8025D04(void) +static void sub_8025D04(void) { - switch (gUnknown_02022C98->unk_0018) + switch (gUnknown_02022C98->unk18) { case 3: - if (sub_8026BB8() == 1) + if (sub_8026BB8() == TRUE) { sub_8026C28(); - gUnknown_02022C98->unk_011C = 1; + gUnknown_02022C98->unk11C = 1; } break; case 4: @@ -1189,48 +1396,48 @@ void sub_8025D04(void) } } -void sub_8025D50(void) +static void sub_8025D50(void) { - switch (gUnknown_02022C98->unk_0018) + switch (gUnknown_02022C98->unk18) { case 4: - sub_8027E30(&gUnknown_02022C98->unk_32CC, &gUnknown_02022C98->unk_31A0[0].unk_2C, &gUnknown_02022C98->unk_31A0[1].unk_2C, &gUnknown_02022C98->unk_31A0[2].unk_2C, &gUnknown_02022C98->unk_31A0[3].unk_2C, &gUnknown_02022C98->unk_31A0[4].unk_2C, gUnknown_02022C98->unk_0040, gUnknown_02022C98->unk_0120, gUnknown_02022C98->unk_012C); + sub_8027E30(&gUnknown_02022C98->unk32CC, &gUnknown_02022C98->unk31A0[0].unk2C, &gUnknown_02022C98->unk31A0[1].unk2C, &gUnknown_02022C98->unk31A0[2].unk2C, &gUnknown_02022C98->unk31A0[3].unk2C, &gUnknown_02022C98->unk31A0[4].unk2C, gUnknown_02022C98->unk40, gUnknown_02022C98->unk120, gUnknown_02022C98->unk12C); break; case 11: - sub_8027E30(&gUnknown_02022C98->unk_32CC, &gUnknown_02022C98->unk_31A0[0].unk_2C, &gUnknown_02022C98->unk_31A0[1].unk_2C, &gUnknown_02022C98->unk_31A0[2].unk_2C, &gUnknown_02022C98->unk_31A0[3].unk_2C, &gUnknown_02022C98->unk_31A0[4].unk_2C, gUnknown_02022C98->unk_0040, gUnknown_02022C98->unk_0120, gUnknown_02022C98->unk_012C); + sub_8027E30(&gUnknown_02022C98->unk32CC, &gUnknown_02022C98->unk31A0[0].unk2C, &gUnknown_02022C98->unk31A0[1].unk2C, &gUnknown_02022C98->unk31A0[2].unk2C, &gUnknown_02022C98->unk31A0[3].unk2C, &gUnknown_02022C98->unk31A0[4].unk2C, gUnknown_02022C98->unk40, gUnknown_02022C98->unk120, gUnknown_02022C98->unk12C); break; } } -void sub_8025E0C(void) +static void sub_8025E0C(void) { - switch (gUnknown_02022C98->unk_0018) + switch (gUnknown_02022C98->unk18) { case 4: - sub_8028164(gUnknown_02022C98->multiplayerId, &gUnknown_02022C98->unk_31A0[gUnknown_02022C98->multiplayerId], &gUnknown_02022C98->unk_31A0[0].unk_2C, &gUnknown_02022C98->unk_31A0[1].unk_2C, &gUnknown_02022C98->unk_31A0[2].unk_2C, &gUnknown_02022C98->unk_31A0[3].unk_2C, &gUnknown_02022C98->unk_31A0[4].unk_2C, &gUnknown_02022C98->unk_0040, &gUnknown_02022C98->unk_0120, &gUnknown_02022C98->unk_012C); + sub_8028164(gUnknown_02022C98->multiplayerId, &gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId], &gUnknown_02022C98->unk31A0[0].unk2C, &gUnknown_02022C98->unk31A0[1].unk2C, &gUnknown_02022C98->unk31A0[2].unk2C, &gUnknown_02022C98->unk31A0[3].unk2C, &gUnknown_02022C98->unk31A0[4].unk2C, &gUnknown_02022C98->unk40, &gUnknown_02022C98->unk120, &gUnknown_02022C98->unk12C); break; case 11: - sub_8028164(gUnknown_02022C98->multiplayerId, &gUnknown_02022C98->unk_31A0[gUnknown_02022C98->multiplayerId], &gUnknown_02022C98->unk_31A0[0].unk_2C, &gUnknown_02022C98->unk_31A0[1].unk_2C, &gUnknown_02022C98->unk_31A0[2].unk_2C, &gUnknown_02022C98->unk_31A0[3].unk_2C, &gUnknown_02022C98->unk_31A0[4].unk_2C, &gUnknown_02022C98->unk_0040, &gUnknown_02022C98->unk_0120, &gUnknown_02022C98->unk_012C); + sub_8028164(gUnknown_02022C98->multiplayerId, &gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId], &gUnknown_02022C98->unk31A0[0].unk2C, &gUnknown_02022C98->unk31A0[1].unk2C, &gUnknown_02022C98->unk31A0[2].unk2C, &gUnknown_02022C98->unk31A0[3].unk2C, &gUnknown_02022C98->unk31A0[4].unk2C, &gUnknown_02022C98->unk40, &gUnknown_02022C98->unk120, &gUnknown_02022C98->unk12C); break; } } -void sub_8025ED8(void) +static void sub_8025ED8(void) { - switch (gUnknown_02022C98->unk_0018) + switch (gUnknown_02022C98->unk18) { case 3: sub_8027DD0(1); - gUnknown_02022C98->unk_011C = 1; + gUnknown_02022C98->unk11C = 1; break; case 4: - if (gUnknown_02022C98->unk_32CC.unk_2C != 0) + if (gUnknown_02022C98->unk32CC.unk2C.unk0 != 0) { - sub_80282EC(gUnknown_02022C98->unk_32CC.unk_2C); + sub_80282EC(gUnknown_02022C98->unk32CC.unk2C.unk0); } break; case 11: - if (gUnknown_02022C98->unk_0120 == 0 && gUnknown_02022C98->unk_012C == 0) + if (gUnknown_02022C98->unk120 == 0 && gUnknown_02022C98->unk12C == 0) { sub_8028350(1); } @@ -1238,105 +1445,105 @@ void sub_8025ED8(void) } } -void sub_8025F48(void) +static void sub_8025F48(void) { - if (gUnknown_02022C98->unk_31A0[gUnknown_02022C98->multiplayerId].unk_2C == 0) + if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 == 0) { if (!IsSEPlaying()) { - gUnknown_02022C98->unk_0144 = 0; + gUnknown_02022C98->unk144 = 0; } } - else if (gUnknown_02022C98->unk_31A0[gUnknown_02022C98->multiplayerId].unk_30 == 1) + else if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk4 == 1) { - if (gUnknown_02022C98->unk_0144 == 0) + if (gUnknown_02022C98->unk144 == 0) { m4aSongNumStop(SE_SEIKAI); PlaySE(SE_SEIKAI); - gUnknown_02022C98->unk_0144 = 1; + gUnknown_02022C98->unk144 = 1; } } - else if (gUnknown_02022C98->unk_31A0[gUnknown_02022C98->multiplayerId].unk_34 == 1) + else if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk8 == 1) { - if (gUnknown_02022C98->unk_0144 == 0 && !IsSEPlaying()) + if (gUnknown_02022C98->unk144 == 0 && !IsSEPlaying()) { PlaySE(SE_BOO); sub_80284CC(1); - gUnknown_02022C98->unk_0144 = 1; + gUnknown_02022C98->unk144 = 1; } } - if (gUnknown_02022C98->unk_0154 == 0 && gUnknown_02022C98->unk_0040 >= 10) + if (gUnknown_02022C98->unk154 == 0 && gUnknown_02022C98->unk40 >= 10) { StopMapMusic(); - gUnknown_02022C98->unk_0154 = 1; + gUnknown_02022C98->unk154 = 1; } - else if (gUnknown_02022C98->unk_0154 == 1) + else if (gUnknown_02022C98->unk154 == 1) { PlayFanfareByFanfareNum(11); // MUS_ME_ZANNEN - gUnknown_02022C98->unk_0154 = 2; + gUnknown_02022C98->unk154 = 2; } } -void sub_8026044(void) +static void sub_8026044(void) { - u8 r8 = gUnknown_02022C98->unk_0044; - u8 r7 = gUnknown_02022C98->unk_0048; + u8 r8 = gUnknown_02022C98->unk44; + u8 r7 = gUnknown_02022C98->unk48; u8 r4; - if (gUnknown_02022C98->unk_31A0[gUnknown_02022C98->multiplayerId].unk_2C == 0) + if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 == 0) { - if (gUnknown_02022C98->unk_31A0[gUnknown_02022C98->multiplayerId].unk_30 != 1 && gUnknown_02022C98->unk_31A0[gUnknown_02022C98->multiplayerId].unk_34 != 1) + if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk4 != 1 && gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk8 != 1) { - gUnknown_02022C98->unk_0144 = 0; + gUnknown_02022C98->unk144 = 0; } } - else if (gUnknown_02022C98->unk_31A0[gUnknown_02022C98->multiplayerId].unk_30 == 1) + else if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk4 == 1) { - if (gUnknown_02022C98->unk_0144 == 0) + if (gUnknown_02022C98->unk144 == 0) { m4aSongNumStop(SE_SEIKAI); PlaySE(SE_SEIKAI); - gUnknown_02022C98->unk_0144 = 1; + gUnknown_02022C98->unk144 = 1; } } - else if (gUnknown_02022C98->unk_31A0[gUnknown_02022C98->multiplayerId].unk_34 == 1) + else if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk8 == 1) { - if (gUnknown_02022C98->unk_0144 == 0 && !IsSEPlaying()) + if (gUnknown_02022C98->unk144 == 0 && !IsSEPlaying()) { PlaySE(SE_BOO); sub_80284CC(1); - gUnknown_02022C98->unk_0144 = 1; + gUnknown_02022C98->unk144 = 1; } } for (r4 = r8; r4 < r7; r4++) { - struct DodrioBerryPickingSubstruct_31A0_14 * ptr = &gUnknown_02022C98->unk_31A0[gUnknown_02022C98->multiplayerId].unk_14; - if (ptr->unk_B[r4] >= 10) + struct DodrioSubstruct_31A0_14 * ptr = &gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk14; + if (ptr->unkB[r4] >= 10) { - if (gUnknown_02022C98->unk_0148[r4] == 0) + if (gUnknown_02022C98->unk148[r4] == 0) { - PlaySE(SE_FUUSEN1 + ptr->unk_0[r4]); - gUnknown_02022C98->unk_0148[r4] = 1; + PlaySE(SE_FUUSEN1 + ptr->unk0[r4]); + gUnknown_02022C98->unk148[r4] = 1; } } else { - gUnknown_02022C98->unk_0148[r4] = 0; + gUnknown_02022C98->unk148[r4] = 0; } } - if (gUnknown_02022C98->unk_0154 == 0 && gUnknown_02022C98->unk_0040 >= 10) + if (gUnknown_02022C98->unk154 == 0 && gUnknown_02022C98->unk40 >= 10) { StopMapMusic(); - gUnknown_02022C98->unk_0154 = 1; + gUnknown_02022C98->unk154 = 1; } - else if (gUnknown_02022C98->unk_0154 == 1) + else if (gUnknown_02022C98->unk154 == 1) { PlayFanfareByFanfareNum(11); // MUS_ME_ZANNEN - gUnknown_02022C98->unk_0154 = 2; + gUnknown_02022C98->unk154 = 2; } } -void sub_80261CC(void) +static void sub_80261CC(void) { RunTasks(); AnimateSprites(); @@ -1344,46 +1551,46 @@ void sub_80261CC(void) UpdatePaletteFade(); } -void sub_80261E4(void) +static void sub_80261E4(void) { TransferPlttBuffer(); LoadOam(); ProcessSpriteCopyRequests(); } -void sub_80261F8(struct DodrioBerryPickingSubstruct_318C * a0, struct Pokemon * a1) +static void sub_80261F8(struct DodrioSubstruct_318C * a0, struct Pokemon * a1) { a0->isShiny = IsMonShiny(a1); } -void sub_802620C(TaskFunc func, u8 priority) +static void sub_802620C(TaskFunc func, u8 priority) { CreateTask(func, priority); } -void sub_802621C(TaskFunc func) +static void sub_802621C(TaskFunc func) { - gUnknown_02022C98->unk_0004 = CreateTask(func, 1); - gUnknown_02022C98->unk_0010 = 0; - gUnknown_02022C98->unk_000C = 0; - gUnknown_02022C98->unk_0014 = 0; + gUnknown_02022C98->unk04 = CreateTask(func, 1); + gUnknown_02022C98->unk10 = 0; + gUnknown_02022C98->unk0C = 0; + gUnknown_02022C98->unk14 = 0; } -void sub_8026240(u8 a0) +static void sub_8026240(u8 a0) { - gUnknown_02022C98->unk_001C = gUnknown_02022C98->unk_0018; - gUnknown_02022C98->unk_0018 = a0; - gUnknown_02022C98->unk_0010 = 0; - gUnknown_02022C98->unk_0014 = 0; + gUnknown_02022C98->unk1C = gUnknown_02022C98->unk18; + gUnknown_02022C98->unk18 = a0; + gUnknown_02022C98->unk10 = 0; + gUnknown_02022C98->unk14 = 0; } -bool32 sub_8026264(void) +static bool32 sub_8026264(void) { - u8 r2 = gUnknown_02022C98->unk_0014 / 4; - gUnknown_02022C98->unk_0014++; - if (r2 != 0 && gUnknown_02022C98->unk_0014 % 4 == 0) + u8 r2 = gUnknown_02022C98->unk14 / 4; + gUnknown_02022C98->unk14++; + if (r2 != 0 && gUnknown_02022C98->unk14 % 4 == 0) { - if (r2 < gUnknown_082F7A94[gUnknown_02022C98->unk_0024 - 1]) + if (r2 < gUnknown_082F7A94[gUnknown_02022C98->unk24 - 1]) { SetGpuReg(REG_OFFSET_BG1HOFS, (r2 * 8)); SetGpuReg(REG_OFFSET_BG2HOFS, -(r2 * 8)); @@ -1400,530 +1607,125 @@ bool32 sub_8026264(void) } } -void sub_80262C0(void) +static void sub_80262C0(void) { u8 i; - u8 start = gUnknown_02022C98->unk_0044; - u8 finish = gUnknown_02022C98->unk_0048; + u8 start = gUnknown_02022C98->unk44; + u8 finish = gUnknown_02022C98->unk48; for (i = start; i < finish; i++) { - struct DodrioBerryPickingSubstruct_31A0_14 * ptr = &gUnknown_02022C98->unk_32CC.unk_14; - ptr->unk_B[i] = (i % 2 == 0) ? 1 : 0; - ptr->unk_0[i] = 0; + struct DodrioSubstruct_31A0_14 * ptr = &gUnknown_02022C98->unk32CC.unk14; + ptr->unkB[i] = (i % 2 == 0) ? 1 : 0; + ptr->unk0[i] = 0; } } -#ifdef NONMATCHING -void sub_8026324(void) +static void sub_8026324(void) { - u8 sp0 = gUnknown_02022C98->unk_0044; - u8 sp4 = gUnknown_02022C98->unk_0048; - u8 sp8 = gUnknown_02022C98->unk_0024; - u8 r6; - u8 r10; - s32 r2; - u8 r5; - u8 r3; - s32 r2_2; - u8 r4; - u8 r7, r7_2; + u8 sp0 = gUnknown_02022C98->unk44; + u8 sp4 = gUnknown_02022C98->unk48; + u8 sp8 = gUnknown_02022C98->unk24; + u8 i, j, k, r5; - if (gUnknown_02022C98->unk_0040 >= 10) + if (gUnknown_02022C98->unk40 >= 10) return; - for (r6 = 0; r6 < sp8; r6++) + for (i = 0; i < sp8; i++) { - if (gUnknown_02022C98->unk_31A0[r6].unk_2C != 0 && gUnknown_02022C98->unk_00A8[r6] == 1) + u8 *ptr = &gUnknown_02022C98->unk31A0[i].unk2C.unk0; + if (*ptr != 0 && gUnknown_02022C98->unkA8[i] == 1) { - for (r10 = sp0; r10 < sp4; r10++) + for (j = sp0; j < sp4; j++) { - r5 = gUnknown_082F449C[r10]; - if (gUnknown_02022C98->unk_00F4[r5][0] == r6) - { + r5 = gUnknown_082F449C[0][0][j]; + if (gUnknown_02022C98->unkF4[r5][0] == i || gUnknown_02022C98->unkF4[r5][1] == i) break; - } - if (gUnknown_02022C98->unk_00F4[r5][1] == r6) + if (sub_8026634(i, *ptr, r5) == TRUE) { - break; - } - if (sub_8026634(gUnknown_02022C98->unk_31A0[r6].unk_2C, r6, gUnknown_082F449C[r10]) == 1) - { - for (r2 = 0; r2 < 2; r2++) + for (k = 0; k < 2; k++) { - if (gUnknown_02022C98->unk_00F4[r5][r2] == 0xFF) + if (gUnknown_02022C98->unkF4[r5][k] == 0xFF) { - gUnknown_02022C98->unk_00F4[r5][r2] = r6; - gUnknown_02022C98->unk_00A8[r6] = 2; - gUnknown_02022C98->unk_00C4[r5] = 1; + gUnknown_02022C98->unkF4[r5][k] = i; + gUnknown_02022C98->unkA8[i] = 2; + gUnknown_02022C98->unkC4[r5] = 1; break; } } break; } - if (gUnknown_02022C98->unk_31A0[r6].unk_34 == 1) - { + if (gUnknown_02022C98->unk31A0[i].unk2C.unk8 == 1) break; - } } } } - for (r10 = sp0; r10 < sp4; r10++) + for (j = sp0; j < sp4; j++) { - r6 = 0xFF; - r5 = gUnknown_082F449C[r10]; - if (gUnknown_02022C98->unk_00C4[r5] == 1) + u8 id = 0xFF; + r5 = gUnknown_082F449C[0][0][j]; + if (gUnknown_02022C98->unkC4[r5] == 1) { - r3 = gUnknown_02022C98->unk_0090[sub_8026D8C(r5)] / 7; - if (r3 < 2) - { - r3 = 2; - } - r2 = gUnknown_082F7A88[r3][gUnknown_02022C98->unk_31A0[0].unk_14.unk_0[r5]] - gUnknown_02022C98->unk_00D0[r5]; + s32 r2; + u8 r4, r3 = gUnknown_02022C98->unk90[sub_8026D8C(r5)] / 7; + if (r3 >= ARRAY_COUNT(gUnknown_082F7A88) - 1) + r3 = ARRAY_COUNT(gUnknown_082F7A88) - 1; + + r2 = gUnknown_082F7A88[r3][gUnknown_02022C98->unk31A0[0].unk14.unk0[r5]] - gUnknown_02022C98->unkD0[r5]; if (r2 < 6) + gUnknown_02022C98->unk9C[r5] += r2; + + if (++gUnknown_02022C98->unk9C[r5] >= 6) { - gUnknown_02022C98->unk_009C[r5] += r2; - } - if (++gUnknown_02022C98->unk_009C[r5] >= 6) - { - gUnknown_02022C98->unk_009C[r5] = 0; - if (gUnknown_02022C98->unk_00F4[r5][0] != 0xFF && gUnknown_02022C98->unk_00F4[r5][1] == 0xFF) - { - r4 = gUnknown_02022C98->unk_00F4[r5][0]; - } - else if (gUnknown_02022C98->unk_00F4[r5][0] == 0xFF && gUnknown_02022C98->unk_00F4[r5][1] == 0xFF) + gUnknown_02022C98->unk9C[r5] = 0; + if (gUnknown_02022C98->unkF4[r5][0] == 0xFF && gUnknown_02022C98->unkF4[r5][1] == 0xFF) { continue; } + else if (gUnknown_02022C98->unkF4[r5][0] != 0xFF && gUnknown_02022C98->unkF4[r5][1] == 0xFF) + { + r4 = gUnknown_02022C98->unkF4[r5][0]; + } else { - r7 = gUnknown_02022C98->unk_00F4[r5][0]; - r7_2 = gUnknown_02022C98->unk_00F4[r5][1]; - if ((Random() & 1)) + u8 unk0 = gUnknown_02022C98->unkF4[r5][0]; + i = gUnknown_02022C98->unkF4[r5][1]; // Have to re-use the variable to match. + if (!(Random() & 1)) { - r4 = r7_2; - r6 = r7; + r4 = unk0; + id = i; } else { - r4 = r7; - r6 = r7_2; + r4 = i; + id = unk0; } } - gUnknown_02022C98->unk_32CC.unk_14.unk_B[r5] = 7; - gUnknown_02022C98->unk_00C4[r5] = 2; - gUnknown_02022C98->unk_00A8[r4] = 3; - gUnknown_02022C98->unk_00B8[r5] = r4; - gUnknown_02022C98->unk_31A0[r4].unk_30 = 1; - gUnknown_02022C98->unk_31A0[r6].unk_34 = 1; - gUnknown_02022C98->unk_0086[r4]++; + gUnknown_02022C98->unk32CC.unk14.unkB[r5] = 7; + gUnknown_02022C98->unkC4[r5] = 2; + gUnknown_02022C98->unkA8[r4] = 3; + gUnknown_02022C98->unkB8[r5] = r4; + gUnknown_02022C98->unk31A0[r4].unk2C.unk4 = 1; + gUnknown_02022C98->unk31A0[id].unk2C.unk8 = 1; + gUnknown_02022C98->unk86[r4]++; sub_8026F1C(0, r5, r4); - sub_8027234(1); + sub_8027234(TRUE); sub_8026D1C(r4); - gUnknown_02022C98->unk_00E8[r5] = gUnknown_02022C98->unk_32CC.unk_14.unk_0[r5]; - gUnknown_02022C98->unk_32CC.unk_14.unk_0[r5] = 3; - gUnknown_02022C98->unk_00F4[r5][0] = 0xFF; - gUnknown_02022C98->unk_00F4[r5][1] = 0xFF; + gUnknown_02022C98->unkE8[r5] = gUnknown_02022C98->unk32CC.unk14.unk0[r5]; + gUnknown_02022C98->unk32CC.unk14.unk0[r5] = 3; + gUnknown_02022C98->unkF4[r5][0] = 0xFF; + gUnknown_02022C98->unkF4[r5][1] = 0xFF; } } } } -#else -NAKED -void sub_8026324(void) -{ - asm_unified("\tpush {r4-r7,lr}\n" - "\tmov r7, r10\n" - "\tmov r6, r9\n" - "\tmov r5, r8\n" - "\tpush {r5-r7}\n" - "\tsub sp, 0x10\n" - "\tldr r0, =gUnknown_02022C98\n" - "\tldr r1, [r0]\n" - "\tadds r0, r1, 0\n" - "\tadds r0, 0x44\n" - "\tldrb r0, [r0]\n" - "\tstr r0, [sp]\n" - "\tadds r0, r1, 0\n" - "\tadds r0, 0x48\n" - "\tldrb r0, [r0]\n" - "\tstr r0, [sp, 0x4]\n" - "\tadds r0, r1, 0\n" - "\tadds r0, 0x24\n" - "\tldrb r0, [r0]\n" - "\tstr r0, [sp, 0x8]\n" - "\tadds r0, r1, 0\n" - "\tadds r0, 0x40\n" - "\tldrb r0, [r0]\n" - "\tcmp r0, 0x9\n" - "\tbls _08026358\n" - "\tb _08026614\n" - "_08026358:\n" - "\tmovs r6, 0\n" - "\tldr r0, [sp, 0x8]\n" - "\tcmp r6, r0\n" - "\tbcs _08026440\n" - "_08026360:\n" - "\tldr r3, =gUnknown_02022C98\n" - "\tlsls r0, r6, 4\n" - "\tsubs r1, r0, r6\n" - "\tlsls r1, 2\n" - "\tldr r2, [r3]\n" - "\tadds r1, r2\n" - "\tldr r4, =0x000031cc\n" - "\tadds r4, r1\n" - "\tmov r8, r4\n" - "\tldrb r1, [r4]\n" - "\tmov r9, r0\n" - "\tadds r0, r6, 0x1\n" - "\tstr r0, [sp, 0xC]\n" - "\tcmp r1, 0\n" - "\tbeq _08026434\n" - "\tadds r0, r2, 0\n" - "\tadds r0, 0xA8\n" - "\tadds r0, r6\n" - "\tldrb r0, [r0]\n" - "\tcmp r0, 0x1\n" - "\tbne _08026434\n" - "\tldr r1, [sp]\n" - "\tmov r10, r1\n" - "\tldr r2, [sp, 0x4]\n" - "\tcmp r10, r2\n" - "\tbcs _08026434\n" - "\tadds r7, r3, 0\n" - "_08026396:\n" - "\tldr r0, =gUnknown_082F449C\n" - "\tadd r0, r10\n" - "\tldrb r5, [r0]\n" - "\tldr r1, [r7]\n" - "\tlsls r4, r5, 1\n" - "\tadds r0, r1, 0\n" - "\tadds r0, 0xF4\n" - "\tadds r0, r4\n" - "\tldrb r0, [r0]\n" - "\tcmp r0, r6\n" - "\tbeq _08026434\n" - "\tadds r0, r1, 0\n" - "\tadds r0, 0xF5\n" - "\tadds r0, r4\n" - "\tldrb r0, [r0]\n" - "\tcmp r0, r6\n" - "\tbeq _08026434\n" - "\tmov r0, r8\n" - "\tldrb r1, [r0]\n" - "\tadds r0, r6, 0\n" - "\tadds r2, r5, 0\n" - "\tbl sub_8026634\n" - "\tcmp r0, 0x1\n" - "\tbne _08026410\n" - "\tmovs r2, 0\n" - "\tldr r3, =gUnknown_02022C98\n" - "\tmov r8, r4\n" - "_080263CE:\n" - "\tldr r0, [r3]\n" - "\tmov r4, r8\n" - "\tadds r1, r2, r4\n" - "\tadds r0, 0xF4\n" - "\tadds r1, r0, r1\n" - "\tldrb r0, [r1]\n" - "\tcmp r0, 0xFF\n" - "\tbne _08026404\n" - "\tstrb r6, [r1]\n" - "\tldr r0, [r3]\n" - "\tadds r0, 0xA8\n" - "\tadds r0, r6\n" - "\tmovs r1, 0x2\n" - "\tstrb r1, [r0]\n" - "\tldr r0, [r3]\n" - "\tadds r0, 0xC4\n" - "\tadds r0, r5\n" - "\tmovs r1, 0x1\n" - "\tstrb r1, [r0]\n" - "\tb _08026434\n" - "\t.pool\n" - "_08026404:\n" - "\tadds r0, r2, 0x1\n" - "\tlsls r0, 24\n" - "\tlsrs r2, r0, 24\n" - "\tcmp r2, 0x1\n" - "\tbls _080263CE\n" - "\tb _08026434\n" - "_08026410:\n" - "\tldr r0, [r7]\n" - "\tmov r2, r9\n" - "\tsubs r1, r2, r6\n" - "\tlsls r1, 2\n" - "\tadds r0, r1\n" - "\tldr r4, =0x000031d4\n" - "\tadds r0, r4\n" - "\tldrb r0, [r0]\n" - "\tcmp r0, 0x1\n" - "\tbeq _08026434\n" - "\tmov r0, r10\n" - "\tadds r0, 0x1\n" - "\tlsls r0, 24\n" - "\tlsrs r0, 24\n" - "\tmov r10, r0\n" - "\tldr r0, [sp, 0x4]\n" - "\tcmp r10, r0\n" - "\tbcc _08026396\n" - "_08026434:\n" - "\tldr r1, [sp, 0xC]\n" - "\tlsls r0, r1, 24\n" - "\tlsrs r6, r0, 24\n" - "\tldr r2, [sp, 0x8]\n" - "\tcmp r6, r2\n" - "\tbcc _08026360\n" - "_08026440:\n" - "\tldr r4, [sp]\n" - "\tmov r10, r4\n" - "\tldr r0, [sp, 0x4]\n" - "\tcmp r10, r0\n" - "\tbcc _0802644C\n" - "\tb _08026614\n" - "_0802644C:\n" - "\tldr r1, =gUnknown_02022C98\n" - "\tmov r9, r1\n" - "_08026450:\n" - "\tmovs r6, 0xFF\n" - "\tldr r0, =gUnknown_082F449C\n" - "\tadd r0, r10\n" - "\tldrb r5, [r0]\n" - "\tmov r2, r9\n" - "\tldr r0, [r2]\n" - "\tadds r0, 0xC4\n" - "\tadds r0, r5\n" - "\tldrb r0, [r0]\n" - "\tcmp r0, 0x1\n" - "\tbeq _08026468\n" - "\tb _08026602\n" - "_08026468:\n" - "\tadds r0, r5, 0\n" - "\tbl sub_8026D8C\n" - "\tmov r1, r9\n" - "\tldr r4, [r1]\n" - "\tlsls r0, 24\n" - "\tlsrs r0, 24\n" - "\tadds r1, r4, 0\n" - "\tadds r1, 0x90\n" - "\tadds r1, r0\n" - "\tldrb r0, [r1]\n" - "\tmovs r1, 0x7\n" - "\tbl __udivsi3\n" - "\tlsls r0, 24\n" - "\tlsrs r3, r0, 24\n" - "\tcmp r3, 0x1\n" - "\tbls _0802648E\n" - "\tmovs r3, 0x2\n" - "_0802648E:\n" - "\tldr r2, =gUnknown_082F7A88\n" - "\tldr r0, =0x000031b4\n" - "\tadds r1, r4, r0\n" - "\tadds r1, r5\n" - "\tlsls r0, r3, 1\n" - "\tadds r0, r3\n" - "\tldrb r1, [r1]\n" - "\tadds r0, r1\n" - "\tadds r0, r2\n" - "\tldrb r1, [r0]\n" - "\tadds r0, r4, 0\n" - "\tadds r0, 0xD0\n" - "\tadds r0, r5\n" - "\tldrb r0, [r0]\n" - "\tsubs r2, r1, r0\n" - "\tcmp r2, 0x5\n" - "\tbgt _080264BC\n" - "\tadds r1, r4, 0\n" - "\tadds r1, 0x9C\n" - "\tadds r1, r5\n" - "\tldrb r0, [r1]\n" - "\tadds r0, r2\n" - "\tstrb r0, [r1]\n" - "_080264BC:\n" - "\tmov r2, r9\n" - "\tldr r1, [r2]\n" - "\tadds r1, 0x9C\n" - "\tadds r1, r5\n" - "\tldrb r0, [r1]\n" - "\tadds r0, 0x1\n" - "\tmovs r2, 0\n" - "\tstrb r0, [r1]\n" - "\tmovs r4, 0xFF\n" - "\tands r0, r4\n" - "\tcmp r0, 0x5\n" - "\tbhi _080264D6\n" - "\tb _08026602\n" - "_080264D6:\n" - "\tmov r1, r9\n" - "\tldr r0, [r1]\n" - "\tadds r0, 0x9C\n" - "\tadds r0, r5\n" - "\tstrb r2, [r0]\n" - "\tldr r3, [r1]\n" - "\tlsls r1, r5, 1\n" - "\tadds r0, r3, 0\n" - "\tadds r0, 0xF4\n" - "\tadds r2, r0, r1\n" - "\tldrb r0, [r2]\n" - "\tmov r8, r1\n" - "\tcmp r0, 0xFF\n" - "\tbne _08026518\n" - "\tadds r0, r3, 0\n" - "\tadds r0, 0xF5\n" - "\tadd r0, r8\n" - "\tldrb r0, [r0]\n" - "\tcmp r0, 0xFF\n" - "\tbne _08026500\n" - "\tb _08026602\n" - "_08026500:\n" - "\tb _08026528\n" - "\t.pool\n" - "_08026518:\n" - "\tadds r0, r3, 0\n" - "\tadds r0, 0xF5\n" - "\tadd r0, r8\n" - "\tldrb r0, [r0]\n" - "\tcmp r0, 0xFF\n" - "\tbne _08026528\n" - "\tldrb r4, [r2]\n" - "\tb _0802654E\n" - "_08026528:\n" - "\tmov r2, r9\n" - "\tldr r1, [r2]\n" - "\tadds r0, r1, 0\n" - "\tadds r0, 0xF4\n" - "\tadd r0, r8\n" - "\tldrb r7, [r0]\n" - "\tadds r1, 0xF5\n" - "\tadd r1, r8\n" - "\tldrb r6, [r1]\n" - "\tbl Random\n" - "\tmovs r1, 0x1\n" - "\tands r1, r0\n" - "\tcmp r1, 0\n" - "\tbne _0802654A\n" - "\tadds r4, r7, 0\n" - "\tb _0802654E\n" - "_0802654A:\n" - "\tadds r4, r6, 0\n" - "\tadds r6, r7, 0\n" - "_0802654E:\n" - "\tmov r1, r9\n" - "\tldr r0, [r1]\n" - "\tldr r2, =0x000032eb\n" - "\tadds r0, r2\n" - "\tadds r0, r5\n" - "\tmovs r1, 0x7\n" - "\tstrb r1, [r0]\n" - "\tmov r1, r9\n" - "\tldr r0, [r1]\n" - "\tadds r0, 0xC4\n" - "\tadds r0, r5\n" - "\tmovs r1, 0x2\n" - "\tstrb r1, [r0]\n" - "\tmov r2, r9\n" - "\tldr r0, [r2]\n" - "\tadds r0, 0xA8\n" - "\tadds r0, r4\n" - "\tmovs r1, 0x3\n" - "\tstrb r1, [r0]\n" - "\tldr r0, [r2]\n" - "\tadds r0, 0xB8\n" - "\tadds r0, r5\n" - "\tstrb r4, [r0]\n" - "\tldr r1, [r2]\n" - "\tlsls r0, r4, 4\n" - "\tsubs r0, r4\n" - "\tlsls r0, 2\n" - "\tadds r1, r0\n" - "\tldr r2, =0x000031d0\n" - "\tadds r1, r2\n" - "\tmovs r0, 0x1\n" - "\tstrb r0, [r1]\n" - "\tmov r2, r9\n" - "\tldr r1, [r2]\n" - "\tlsls r0, r6, 4\n" - "\tsubs r0, r6\n" - "\tlsls r0, 2\n" - "\tadds r1, r0\n" - "\tldr r0, =0x000031d4\n" - "\tadds r1, r0\n" - "\tmovs r2, 0x1\n" - "\tstrb r2, [r1]\n" - "\tmov r0, r9\n" - "\tldr r1, [r0]\n" - "\tlsls r0, r4, 1\n" - "\tadds r1, 0x86\n" - "\tadds r1, r0\n" - "\tldrh r0, [r1]\n" - "\tadds r0, 0x1\n" - "\tstrh r0, [r1]\n" - "\tmovs r0, 0\n" - "\tadds r1, r5, 0\n" - "\tadds r2, r4, 0\n" - "\tbl sub_8026F1C\n" - "\tmovs r0, 0x1\n" - "\tbl sub_8027234\n" - "\tadds r0, r4, 0\n" - "\tbl sub_8026D1C\n" - "\tmov r1, r9\n" - "\tldr r0, [r1]\n" - "\tadds r1, r0, 0\n" - "\tadds r1, 0xE8\n" - "\tadds r1, r5\n" - "\tldr r2, =0x000032e0\n" - "\tadds r0, r2\n" - "\tadds r0, r5\n" - "\tldrb r0, [r0]\n" - "\tstrb r0, [r1]\n" - "\tmov r4, r9\n" - "\tldr r0, [r4]\n" - "\tadds r0, r2\n" - "\tadds r0, r5\n" - "\tmovs r1, 0x3\n" - "\tstrb r1, [r0]\n" - "\tldr r1, [r4]\n" - "\tadds r1, 0xF4\n" - "\tadd r1, r8\n" - "\tldrb r0, [r1]\n" - "\tmovs r2, 0xFF\n" - "\torrs r0, r2\n" - "\tstrb r0, [r1]\n" - "\tldr r1, [r4]\n" - "\tadds r1, 0xF5\n" - "\tadd r1, r8\n" - "\tldrb r0, [r1]\n" - "\torrs r0, r2\n" - "\tstrb r0, [r1]\n" - "_08026602:\n" - "\tmov r0, r10\n" - "\tadds r0, 0x1\n" - "\tlsls r0, 24\n" - "\tlsrs r0, 24\n" - "\tmov r10, r0\n" - "\tldr r4, [sp, 0x4]\n" - "\tcmp r10, r4\n" - "\tbcs _08026614\n" - "\tb _08026450\n" - "_08026614:\n" - "\tadd sp, 0x10\n" - "\tpop {r3-r5}\n" - "\tmov r8, r3\n" - "\tmov r9, r4\n" - "\tmov r10, r5\n" - "\tpop {r4-r7}\n" - "\tpop {r0}\n" - "\tbx r0\n" - "\t.pool"); -} -#endif // NONMATCHING -u32 sub_8026634(u8 a0, u8 a1, u8 a2) +static bool32 sub_8026634(u8 a0, u8 a1, u8 a2) { s32 r7 = 0; - u8 r5 = gUnknown_02022C98->unk_0024 - 1; - struct DodrioBerryPickingSubstruct_31A0_14 * ptr = &gUnknown_02022C98->unk_32CC.unk_14; + u8 r5 = gUnknown_02022C98->unk24 - 1; + struct DodrioSubstruct_31A0_14 * ptr = &gUnknown_02022C98->unk32CC.unk14; switch (a1) { @@ -1938,13 +1740,13 @@ u32 sub_8026634(u8 a0, u8 a1, u8 a2) r7 = 2; break; } - if (ptr->unk_B[a2] == 6 || ptr->unk_B[a2] == 7) + if (ptr->unkB[a2] == 6 || ptr->unkB[a2] == 7) { - if (a2 == gUknnown_082F45AF[r7 + a0 * 3 + 15 * r5]) + if (a2 == gUknnown_082F45AF[r5][a0][r7]) { - if (gUnknown_02022C98->unk_00C4[a2] == 1 || gUnknown_02022C98->unk_00C4[a2] == 2) + if (gUnknown_02022C98->unkC4[a2] == 1 || gUnknown_02022C98->unkC4[a2] == 2) { - gUnknown_02022C98->unk_31A0[a0].unk_34 = 1; + gUnknown_02022C98->unk31A0[a0].unk2C.unk8 = 1; return FALSE; } else @@ -1955,98 +1757,3330 @@ u32 sub_8026634(u8 a0, u8 a1, u8 a2) } else { - if (a2 == gUknnown_082F45AF[r7 + a0 * 3 + 15 * r5]) + if (a2 == gUknnown_082F45AF[r5][a0][r7]) { - gUnknown_02022C98->unk_00A8[a0] = 4; - gUnknown_02022C98->unk_31A0[a0].unk_34 = 1; + gUnknown_02022C98->unkA8[a0] = 4; + gUnknown_02022C98->unk31A0[a0].unk2C.unk8 = 1; } } return FALSE; } -void sub_802671C(void) +static void sub_802671C(void) { - u8 r1 = gUnknown_02022C98->unk_0044; - u8 r9 = gUnknown_02022C98->unk_0048; + u8 r1 = gUnknown_02022C98->unk44; + u8 r9 = gUnknown_02022C98->unk48; u8 r3 = 0; u8 r10 = 0; u8 i; u8 r2; - struct DodrioBerryPickingStruct *ptr; + struct DodrioStruct *ptr; - gUnknown_02022C98->unk_0120 = 0; + gUnknown_02022C98->unk120 = 0; for (i = r1; i < r9 - 1; i++) { ptr = gUnknown_02022C98; - if (gUnknown_02022C98->unk_00C4[i] == 0 || gUnknown_02022C98->unk_00C4[i] == 1) + if (gUnknown_02022C98->unkC4[i] == 0 || gUnknown_02022C98->unkC4[i] == 1) { - gUnknown_02022C98->unk_0120 = 1; - if (ptr->unk_32CC.unk_14.unk_B[i] >= 10) + gUnknown_02022C98->unk120 = 1; + if (ptr->unk32CC.unk14.unkB[i] >= 10) { - ptr->unk_32CC.unk_14.unk_B[i] = 10; - gUnknown_02022C98->unk_00C4[i] = 3; - if (gUnknown_02022C98->unk_0148[i] == 0) + ptr->unk32CC.unk14.unkB[i] = 10; + gUnknown_02022C98->unkC4[i] = 3; + if (gUnknown_02022C98->unk148[i] == 0) { - gUnknown_02022C98->unk_0148[i] = 1; - PlaySE(SE_FUUSEN1 + ptr->unk_32CC.unk_14.unk_0[i]); + gUnknown_02022C98->unk148[i] = 1; + PlaySE(SE_FUUSEN1 + ptr->unk32CC.unk14.unk0[i]); } - if (gUnknown_02022C98->unk_0040 < 10 || r10 == 1) + if (gUnknown_02022C98->unk40 < 10 || r10 == 1) { r10 = 1; - gUnknown_02022C98->unk_0148[i] = 0; - if (gUnknown_02022C98->unk_0040 < 10) + gUnknown_02022C98->unk148[i] = 0; + if (gUnknown_02022C98->unk40 < 10) { - gUnknown_02022C98->unk_0040++; + gUnknown_02022C98->unk40++; } sub_8026F1C(3, i, 0); - sub_8027234(0); + sub_8027234(FALSE); } } else { - r3 = gUnknown_02022C98->unk_0090[sub_8026D8C(i)] / 7; + r3 = gUnknown_02022C98->unk90[sub_8026D8C(i)] / 7; if (r3 >= 2) { r3 = 2; } - r2 = gUnknown_082F7A88[r3][ptr->unk_32CC.unk_14.unk_0[i]]; - if (++gUnknown_02022C98->unk_00D0[i] >= r2) + r2 = gUnknown_082F7A88[r3][ptr->unk32CC.unk14.unk0[i]]; + if (++gUnknown_02022C98->unkD0[i] >= r2) { - ptr->unk_32CC.unk_14.unk_B[i]++; - gUnknown_02022C98->unk_00D0[i] = 0; + ptr->unk32CC.unk14.unkB[i]++; + gUnknown_02022C98->unkD0[i] = 0; } sub_8026324(); } } - else if (gUnknown_02022C98->unk_00C4[i] == 2) + else if (gUnknown_02022C98->unkC4[i] == 2) { - gUnknown_02022C98->unk_0120 = 1; - if (++gUnknown_02022C98->unk_00DC[i] >= 20) + gUnknown_02022C98->unk120 = 1; + if (++gUnknown_02022C98->unkDC[i] >= 20) { - gUnknown_02022C98->unk_31A0[gUnknown_02022C98->unk_00B8[i]].unk_30 = 0; - gUnknown_02022C98->unk_00DC[i] = 0; - gUnknown_02022C98->unk_00D0[i] = 0; - gUnknown_02022C98->unk_00C4[i] = 0; - ptr->unk_32CC.unk_14.unk_B[i] = 1; - ptr->unk_32CC.unk_14.unk_0[i] = sub_8026DB0(sub_8026D8C(i), i); + gUnknown_02022C98->unk31A0[gUnknown_02022C98->unkB8[i]].unk2C.unk4 = 0; + gUnknown_02022C98->unkDC[i] = 0; + gUnknown_02022C98->unkD0[i] = 0; + gUnknown_02022C98->unkC4[i] = 0; + ptr->unk32CC.unk14.unkB[i] = 1; + ptr->unk32CC.unk14.unk0[i] = sub_8026DB0(sub_8026D8C(i), i); } } - else if (gUnknown_02022C98->unk_00C4[i] == 3) + else if (gUnknown_02022C98->unkC4[i] == 3) { - if (++gUnknown_02022C98->unk_00DC[i] >= 20) + if (++gUnknown_02022C98->unkDC[i] >= 20) { - if (gUnknown_02022C98->unk_0040 < 10) + if (gUnknown_02022C98->unk40 < 10) { - gUnknown_02022C98->unk_00DC[i] = 0; - gUnknown_02022C98->unk_00D0[i] = 0; - gUnknown_02022C98->unk_00C4[i] = 0; - ptr->unk_32CC.unk_14.unk_B[i] = 1; - gUnknown_02022C98->unk_00E8[i] = ptr->unk_32CC.unk_14.unk_0[i]; - ptr->unk_32CC.unk_14.unk_0[i] = sub_8026DB0(sub_8026D8C(i), i); + gUnknown_02022C98->unkDC[i] = 0; + gUnknown_02022C98->unkD0[i] = 0; + gUnknown_02022C98->unkC4[i] = 0; + ptr->unk32CC.unk14.unkB[i] = 1; + gUnknown_02022C98->unkE8[i] = ptr->unk32CC.unk14.unk0[i]; + ptr->unk32CC.unk14.unk0[i] = sub_8026DB0(sub_8026D8C(i), i); } } } } } + +static void sub_8026988(void) +{ + u8 i, first, count; + + first = gUnknown_02022C98->unk44; + count = gUnknown_02022C98->unk48; + for (i = first; i < count; i++) + { + struct DodrioSubstruct_31A0 *ptr = &gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId]; + u8 var = gUnknown_082F449C[gUnknown_02022C98->unk24 - 1][gUnknown_02022C98->multiplayerId][i]; + + if (ptr->unk14.unkB[var] != 0) + sub_8028BF8(i, FALSE); + else + sub_8028BF8(i, TRUE); + + if (ptr->unk14.unkB[var] > 9) + { + sub_8028CA4(i, ptr->unk14.unk0[var] + 3); + sub_8028C7C(i, ptr->unk14.unkB[var] * 2 - 1); + } + else if (ptr->unk14.unk0[var] == 3) + { + ptr->unk14.unkB[var] = 7; + sub_8028CA4(i, 6); + sub_8028C7C(i, ptr->unk14.unkB[var] * 2 - 1); + } + else + { + sub_8028CA4(i, ptr->unk14.unk0[var]); + sub_8028C7C(i, ptr->unk14.unkB[var] * 2); + } + } +} + +static void sub_8026A88(void) +{ + u8 i, count; + + count = gUnknown_02022C98->unk24; + for (i = 0; i < count; i++) + { + struct DodrioSubstruct_31A0 *ptr = &gUnknown_02022C98->unk31A0[i]; + sub_80286B4(i, ptr->unk2C.unk0); + } +} + +static void sub_8026AC8(void) +{ + u8 i, count; + + count = gUnknown_02022C98->unk24; + for (i = 0; i < count; i++) + sub_80286B4(i, 4); +} + +static void sub_8026AF4(void) +{ + sub_8026988(); + if (gUnknown_02022C98->unk40 > 9) + sub_8026AC8(); + else + sub_8026A88(); + + sub_80288D4(gUnknown_02022C98->unk40); +} + +// This function is literally the same as the one above...Why? +static void sub_8026B28(void) +{ + sub_8026988(); + if (gUnknown_02022C98->unk40 > 9) + sub_8026AC8(); + else + sub_8026A88(); + + sub_80288D4(gUnknown_02022C98->unk40); +} + +static void sub_8026B5C(u8 arg0, u8 *arg1, u8 *arg2) +{ + switch (arg0) + { + case 1: + *arg1 = 4, *arg2 = 7; + break; + case 2: + *arg1 = 3, *arg2 = 8; + break; + case 3: + *arg1 = 2, *arg2 = 9; + break; + case 4: + *arg1 = 1, *arg2 = 10; + break; + case 5: + *arg1 = 0, *arg2 = 11; + break; + } +} + +static bool32 sub_8026BB8(void) +{ + u8 i, count; + + count = gUnknown_02022C98->unk24; + for (i = 1; i < count; i++) + { + if (gUnknown_02022C98->unk158[i] == 0) + gUnknown_02022C98->unk158[i] = sub_8027DFC(i); + } + + // This loop won't ever run, the seemingly poitnless assingment below is to make the compiler + // generate code for it. + count = count; + for (; i < count; i++) + { + if (gUnknown_02022C98->unk158[i] == 0) + return FALSE; + } + + return TRUE; +} + +static void sub_8026C28(void) +{ + u8 i; + + for (i = 0; i < 5; i++) + gUnknown_02022C98->unk158[i] = 0; +} + +static bool32 sub_8026C50(void) +{ + if (gUnknown_02022C98->unk40 > 9 && gUnknown_02022C98->unk120 == 0) + { + gUnknown_02022C98->unk40 = 10; + if (gUnknown_02022C98->unk12C != 0) + return TRUE; + } + + return FALSE; +} + +static bool32 sub_8026C90(void) +{ + u8 i, first, count; + + if (gUnknown_02022C98->unk40 > 9) + { + first = gUnknown_02022C98->unk44; + count = gUnknown_02022C98->unk48; + gUnknown_02022C98->unk40 = 10; + if (gUnknown_02022C98->unk12C != 0) + { + for (i = first; i < count; i++) + { + struct DodrioSubstruct_31A0 *ptr = &gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId]; + u8 var = gUnknown_082F449C[gUnknown_02022C98->unk24 - 1][gUnknown_02022C98->multiplayerId][i]; + + if (ptr->unk14.unkB[var] != 10) + return FALSE; + } + return TRUE; + } + } + + return FALSE; +} + +static void sub_8026D1C(u8 arg0) +{ + u8 var = gUnknown_082F7A9C[gUnknown_02022C98->unk90[arg0] % 7] + (gUnknown_02022C98->unk90[arg0] / 7) * 100; + if (gUnknown_02022C98->unk86[arg0] >= var) + gUnknown_02022C98->unk90[arg0]++; +} + +static u8 sub_8026D8C(u8 arg0) +{ + return gUnknown_082F4648[gUnknown_02022C98->unk24 - 1][arg0]; +} + +static u8 sub_8026DB0(u8 arg0, u8 arg1) +{ + u8 i, var3; + u8 count = gUnknown_02022C98->unk24 - 1; + u8 var0 = gUnknown_082F45FA[count][arg0][0]; + u8 var1 = gUnknown_082F45FA[count][arg0][1]; + u8 var2 = gUnknown_082F45FA[count][arg0][2]; + + for (i = 0; gUnknown_082F467F[count][i] != 0; i++) + { + if (arg1 == gUnknown_082F467F[count][i]) + return sub_8026E70(gUnknown_02022C98->unk90[var1], arg1); + } + + // Gets the highest of the three. + if (gUnknown_02022C98->unk90[var0] > gUnknown_02022C98->unk90[var1]) + var3 = gUnknown_02022C98->unk90[var0]; + else + var3 = gUnknown_02022C98->unk90[var1]; + + if (gUnknown_02022C98->unk90[var2] > var3) + var3 = gUnknown_02022C98->unk90[var2]; + + return sub_8026E70(var3, arg1); +} + +static u8 sub_8026E70(u8 arg0, u8 arg1) +{ + u8 var = gUnknown_02022C98->unkE8[arg1]; + switch (arg0 % 7) + { + default: return 0; + case 0: return 0; + case 1: return 1; + case 2: return 2; + case 3: + if (var == 0) + return 1; + else + return 0; + case 4: + if (var == 0) + return 2; + else + return 0; + case 5: + if (var == 2) + return 1; + else + return 2; + case 6: + if (var == 0) + return 1; + else if (var == 1) + return 2; + else + return 0; + } +} + +static bool32 sub_8026EEC(u16 arg0[5][6]) +{ + int sum, i; + for (sum = 0, i = 0; i < GetLinkPlayerCount(); sum += arg0[i][3], i++) + ; + + if (sum >= 11) + return TRUE; + else + return FALSE; +} + +static void sub_8026F1C(u8 arg0, u8 arg1, u8 arg2) +{ + u8 var; + u8 count = gUnknown_02022C98->unk24; + switch (arg0) + { + case 0: + case 1: + case 2: + var = gUnknown_02022C98->unk31A0[0].unk14.unk0[arg1]; + gUnknown_02022C98->unk4A[arg2][var] = IncrementWithLimit(gUnknown_02022C98->unk4A[arg2][var], 20000); + break; + case 3: + if (sub_8026EEC(gUnknown_02022C98->unk4A)) + break; + switch (count) + { + case 5: + switch (arg1) + { + case 0: + gUnknown_02022C98->unk4A[2][3]++; + gUnknown_02022C98->unk4A[3][3]++; + break; + case 1: + gUnknown_02022C98->unk4A[3][3]++; + break; + case 2: + gUnknown_02022C98->unk4A[3][3]++; + gUnknown_02022C98->unk4A[4][3]++; + break; + case 3: + gUnknown_02022C98->unk4A[4][3]++; + break; + case 4: + gUnknown_02022C98->unk4A[4][3]++; + gUnknown_02022C98->unk4A[0][3]++; + break; + case 5: + gUnknown_02022C98->unk4A[0][3]++; + break; + case 6: + gUnknown_02022C98->unk4A[0][3]++; + gUnknown_02022C98->unk4A[1][3]++; + break; + case 7: + gUnknown_02022C98->unk4A[1][3]++; + break; + case 8: + gUnknown_02022C98->unk4A[1][3]++; + gUnknown_02022C98->unk4A[2][3]++; + break; + case 9: + gUnknown_02022C98->unk4A[2][3]++; + break; + } + break; + case 4: + switch (arg1) + { + case 1: + gUnknown_02022C98->unk4A[2][3]++; + gUnknown_02022C98->unk4A[3][3]++; + break; + case 2: + gUnknown_02022C98->unk4A[3][3]++; + break; + case 3: + gUnknown_02022C98->unk4A[3][3]++; + gUnknown_02022C98->unk4A[0][3]++; + break; + case 4: + gUnknown_02022C98->unk4A[0][3]++; + break; + case 5: + gUnknown_02022C98->unk4A[0][3]++; + gUnknown_02022C98->unk4A[1][3]++; + break; + case 6: + gUnknown_02022C98->unk4A[1][3]++; + break; + case 7: + gUnknown_02022C98->unk4A[1][3]++; + gUnknown_02022C98->unk4A[2][3]++; + break; + case 8: + gUnknown_02022C98->unk4A[2][3]++; + break; + } + break; + case 3: + switch (arg1) + { + case 2: + gUnknown_02022C98->unk4A[1][3]++; + gUnknown_02022C98->unk4A[2][3]++; + break; + case 3: + gUnknown_02022C98->unk4A[2][3]++; + break; + case 4: + gUnknown_02022C98->unk4A[2][3]++; + gUnknown_02022C98->unk4A[0][3]++; + break; + case 5: + gUnknown_02022C98->unk4A[0][3]++; + break; + case 6: + gUnknown_02022C98->unk4A[0][3]++; + gUnknown_02022C98->unk4A[1][3]++; + break; + case 7: + gUnknown_02022C98->unk4A[1][3]++; + break; + } + break; + case 2: + switch (arg1) + { + case 3: + gUnknown_02022C98->unk4A[0][3]++; + gUnknown_02022C98->unk4A[1][3]++; + break; + case 4: + gUnknown_02022C98->unk4A[0][3]++; + break; + case 5: + gUnknown_02022C98->unk4A[0][3]++; + gUnknown_02022C98->unk4A[1][3]++; + break; + case 6: + gUnknown_02022C98->unk4A[1][3]++; + break; + } + break; + } + break; + } +} + +static void sub_8027234(bool32 arg0) +{ + if (gUnknown_02022C98->unk24 != 5) + return; + + if (arg0 == TRUE) + { + if (++gUnknown_02022C98->unk112 > gUnknown_02022C98->unk114) + gUnknown_02022C98->unk114 = gUnknown_02022C98->unk112; + if (gUnknown_02022C98->unk112 > 9999) + gUnknown_02022C98->unk112 = 9999; + } + else + { + if (gUnknown_02022C98->unk112 > gUnknown_02022C98->unk114) + gUnknown_02022C98->unk114 = gUnknown_02022C98->unk112; + gUnknown_02022C98->unk112 = 0; + } +} + +static void sub_80272A4(void) +{ + u8 i; + for (i = 0; i < gUnknown_02022C98->unk24; i++) + gUnknown_02022C98->unk4A[i][5] = gUnknown_02022C98->unk114; +} + +static void sub_80272E8(void) +{ + u8 i, j; + + for (i = 0; i < 5; i++) + { + for (j = 0; j < 11; j++) + gUnknown_02022C98->unk31A0[i].unk14.unkB[j] = 0; + gUnknown_02022C98->unk31A0[i].unk2C.unk0 = 0; + gUnknown_02022C98->unk31A0[i].unk2C.unk4 = 0; + gUnknown_02022C98->unk90[i] = 0; + gUnknown_02022C98->unk86[i] = 0; + gUnknown_02022C98->unk3308[i].unk0 = 0; + gUnknown_02022C98->unk3308[i].unk4 = 0; + gUnknown_02022C98->unk4A[i][0] = 0; + gUnknown_02022C98->unk4A[i][1] = 0; + gUnknown_02022C98->unk4A[i][2] = 0; + gUnknown_02022C98->unk4A[i][3] = 0; + gUnknown_02022C98->unk4A[i][4] = 0; + gUnknown_02022C98->unk4A[i][5] = 0; + } + gUnknown_02022C98->unk154 = 0; + gUnknown_02022C98->unk112 = 0; + gUnknown_02022C98->unk40 = 0; + sub_8026A88(); + sub_8026988(); +} + +static const s16 gUnknown_082F7B24[] = {10, 30, 50, 50}; + +static void sub_80273F0(void) +{ + u8 i, var = 0, var2 = 0; + + switch (gUnknown_02022C98->unk24) + { + case 4: var = 1; break; + case 5: var = 2; break; + } + + var2 = Random() % 10; + for (i = 0; i < 5; i++) + gUnknown_02022C98->unk4A[i][4] = gUnknown_082F7AA4[var][var2]; +} + +static u32 sub_802745C(u8 arg0) +{ + u32 sum = gUnknown_02022C98->unk4A[arg0][0] + + gUnknown_02022C98->unk4A[arg0][1] + + gUnknown_02022C98->unk4A[arg0][2]; + return min(sum, 9999); +} + +static void sub_802749C(void) +{ + u32 berriesPicked = Min(sub_802745C(gUnknown_02022C98->multiplayerId), 9999); + u32 score = Min(sub_80276C0(gUnknown_02022C98->multiplayerId), 999990); + + if (gSaveBlock2Ptr->berryPick.bestScore < score) + gSaveBlock2Ptr->berryPick.bestScore = score; + if (gSaveBlock2Ptr->berryPick.berriesPicked < berriesPicked) + gSaveBlock2Ptr->berryPick.berriesPicked = berriesPicked; + if (gSaveBlock2Ptr->berryPick.berriesPickedInRow < gUnknown_02022C98->unk114) + gSaveBlock2Ptr->berryPick.berriesPickedInRow = gUnknown_02022C98->unk114; +} + +static u8 sub_8027518(u8 arg0) +{ + u8 i, saved; + + saved = gUnknown_02022C98->unk98[3]; + for (i = 3; i != 0; i--) + gUnknown_02022C98->unk98[i] = gUnknown_02022C98->unk98[i - 1]; + gUnknown_02022C98->unk98[0] = arg0; + return saved; +} + +static void sub_8027554(void) +{ + if (gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] == 0) + { + if (gMain.newKeys & DPAD_UP) + { + gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 2; + gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] = 6; + PlaySE(SE_W204); + } + else if (gMain.newKeys & DPAD_LEFT) + { + gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 3; + gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] = 6; + PlaySE(SE_W204); + } + else if (gMain.newKeys & DPAD_RIGHT) + { + gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 1; + gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] = 6; + PlaySE(SE_W204); + } + else + { + gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 0; + } + } + else + { + gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId]--; + } +} + +static void sub_8027608(void) +{ + gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 0; +} + +static u16 sub_802762C(void) +{ + return gUnknown_02022C98->unk4A[gUnknown_02022C98->multiplayerId][4] + FIRST_BERRY_INDEX; +} + +static u8 sub_8027650(void) +{ + return gUnknown_02022C98->unk24; +} + +static u8 *sub_8027660(u8 id) +{ + if (gReceivedRemoteLinkPlayers) + return gLinkPlayers[id].name; + else + return gUnknown_02022C98->unk31A0[id].name; +} + +static u16 sub_80276A0(u8 arg0, u8 arg1) +{ + return gUnknown_02022C98->unk4A[arg0][arg1]; +} + +static u32 sub_80276C0(u8 arg0) +{ + u8 i; + u32 var, sum = 0; + + for (i = 0; i < 3; i++) + sum += gUnknown_02022C98->unk4A[arg0][i] * gUnknown_082F7B24[i]; + + var = gUnknown_02022C98->unk4A[arg0][3] * gUnknown_082F7B24[3]; + if (sum <= var) + return 0; + else + return sum - var; +} + +static u32 sub_8027748(void) +{ + u8 i, count = gUnknown_02022C98->unk24; + u32 maxVar = sub_80276C0(0); + + for (i = 1; i < count; i++) + { + u32 var = sub_80276C0(i); + if (var > maxVar) + maxVar = var; + } + return Min(maxVar, 999990); +} + +static u32 sub_802778C(u8 arg0) +{ + u8 i, count = gUnknown_02022C98->unk24; + u16 maxVar = gUnknown_02022C98->unk4A[0][arg0]; + + for (i = 0; i < count; i++) + { + u16 var = gUnknown_02022C98->unk4A[i][arg0]; + if (var > maxVar) + maxVar = var; + } + return maxVar; +} + +static u32 sub_80277D0(u8 arg0) +{ + u32 vals[5], temp; + s16 r6 = TRUE; + u8 i, count = gUnknown_02022C98->unk24; + + for (i = 0; i < count; i++) + vals[i] = temp = sub_80276C0(i); + + while (r6) + { + r6 = FALSE; + for (i = 0; i < count - 1; i++) + { + if (vals[i] < vals[i + 1]) + { + SWAP(vals[i], vals[i + 1], temp); + r6 = TRUE; + } + } + } + + return vals[arg0]; +} + +static u32 sub_802784C(void) +{ + u8 i, r10 = 0, r8 = 0, r9 = 0, count = gUnknown_02022C98->unk24; + + // Function called two times for some reason. + sub_8027748(); + if (sub_8027748() == 0) + { + for (i = 0; i < count; i++) + { + gUnknown_02022C98->unk3308[i].unk0 = 4; + gUnknown_02022C98->unk3308[i].unk4 = 0; + } + } + + for (i = 0; i < count; i++) + gUnknown_02022C98->unk3308[i].unk4 = Min(sub_80276C0(i), 999990); + + do + { + u32 r6 = sub_80277D0(r10); + u8 r3 = r8; + for (i = 0; i < count; i++) + { + if (r6 == gUnknown_02022C98->unk3308[i].unk4) + { + gUnknown_02022C98->unk3308[i].unk0 = r3; + r8++; + r9++; + } + } + r10 = r8; + } while (r9 < count); + + return 0; +} + +static void sub_802793C(struct DodrioSubstruct_3308 *dst, u8 id) +{ + *dst = gUnknown_02022C98->unk3308[id]; +} + +// Unused function +static u8 sub_802795C(u8 arg0) +{ + u8 i, ret = 0, count = gUnknown_02022C98->unk24; + u32 var, vars[5] = {0}; + + for (i = 0; i < count; i++) + vars[i] = sub_80276C0(i); + + var = vars[arg0]; + for (i = 0; i < 5; i++) + { + if (i != arg0 && var < vars[i]) + ret++; + } + + return ret; +} + +static u8 sub_80279C8(void) +{ + u8 multiplayerId = gUnknown_02022C98->multiplayerId; + u16 itemId = sub_802762C(); + + if (sub_80276C0(multiplayerId) != sub_8027748()) + return 3; + if (!CheckBagHasSpace(itemId, 1)) + return 2; + + AddBagItem(itemId, 1); + if (!CheckBagHasSpace(itemId, 1)) + return 1; + return 0; +} + +// Really? What next, u32 Add(u32 a)return a+1;? +static u32 IncrementWithLimit(u32 a, u32 max) +{ + if (a < max) + return a + 1; + else + return max; +} + +// Gamefreak pls, min(a, b) ((a) < (b) ? (a) : (b)) is a well-known macro +static u32 Min(u32 a, u32 b) +{ + if (a < b) + return a; + else + return b; +} + +static u8 sub_8027A48(u8 id) +{ + return gUnknown_02022C98->unk34[id]; +} + +void sub_8027A5C(void) +{ + int i; + for (i = 0; i < PARTY_SIZE; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_HAS_SPECIES) + && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) == SPECIES_DODRIO) + { + gSpecialVar_Result = 1; + return; + } + } + + gSpecialVar_Result = 0; +} + +void sub_8027AAC(void) +{ + u8 taskId = CreateTask(sub_8027ACC, 0); + sub_8027ACC(taskId); +} + +// Data related to printing saved results. +static const struct WindowTemplate gUnknown_082F7B2C = +{ + .bg = 0, + .tilemapLeft = 5, + .tilemapTop = 1, + .width = 20, + .height = 11, + .paletteNum = 15, + .baseBlock = 0x1, +}; + +static const u8 *const gUnknown_082F7B34[3] = {gText_BerriesPicked, gText_BestScore, gText_BerriesInRowFivePlayers}; +static const u8 gUnknown_082F7B40[] = {4, 7, 4}; + +ALIGNED(4) +static const u8 gUnknown_082F7B44[][2] = {{25}, {41}, {57}}; +static const u8 gUnknown_082F7B4A[][2] = {{25}, {41}, {73}}; + +static void sub_8027ACC(u8 taskId) +{ + struct WindowTemplate window; + s32 i, width, widthCurr; + s16 *data = gTasks[taskId].data; + + switch (data[0]) + { + case 0: + window = gUnknown_082F7B2C; + width = GetStringWidth(1, gText_BerryPickingRecords, 0); + for (i = 0; i < ARRAY_COUNT(gUnknown_082F7B34); i++) + { + widthCurr = GetStringWidth(1, gUnknown_082F7B34[i], 0) + 50; + if (widthCurr > width) + width = widthCurr; + } + width = (width + 7) / 8; + if (width & 1) + width++; + window.tilemapLeft = (30 - width) / 2; + window.width = width; + data[1] = AddWindow(&window); + sub_8027BEC(data[1], width); + CopyWindowToVram(data[1], 3); + data[0]++; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + data[0]++; + break; + case 2: + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + rbox_fill_rectangle(data[1]); + CopyWindowToVram(data[1], 1); + data[0]++; + } + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + { + RemoveWindow(data[1]); + DestroyTask(taskId); + EnableBothScriptContexts(); + } + break; + } +} + +static void sub_8027BEC(u8 windowId, s32 width) +{ + s32 i, x, numWidth; + s32 results[3]; + results[0] = gSaveBlock2Ptr->berryPick.berriesPicked; + results[1] = gSaveBlock2Ptr->berryPick.bestScore; + results[2] = gSaveBlock2Ptr->berryPick.berriesPickedInRow; + + LoadUserWindowBorderGfx_(windowId, 0x21D, 0xD0); + DrawTextBorderOuter(windowId, 0x21D, 0xD); + FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); + AddTextPrinterParameterized(windowId, 1, gText_BerryPickingRecords, GetStringCenterAlignXOffset(1, gText_BerryPickingRecords, width * 8), 1, TEXT_SPEED_FF, NULL); + for (i = 0; i < 3; i++) + { + ConvertIntToDecimalStringN(gStringVar1, results[i], STR_CONV_MODE_LEFT_ALIGN, gUnknown_082F7B40[i]); + numWidth = GetStringWidth(1, gStringVar1, -1); + AddTextPrinterParameterized(windowId, 1, gUnknown_082F7B34[i], 0, gUnknown_082F7B44[i][0], TEXT_SPEED_FF, NULL); + x = (width * 8) - numWidth; + AddTextPrinterParameterized(windowId, 1, gStringVar1, x, gUnknown_082F7B4A[i][0], TEXT_SPEED_FF, NULL); + } + PutWindowTilemap(windowId); +} + +// Debug functions? +static const u16 gUnknown_082F7B50[][4] = +{ + {9999, 0, 90, 9999}, + {9999, 9999, 70, 9999}, + {9999, 0, 9999, 0}, + {9999, 9999, 60, 0}, + {9999, 9999, 9999, 0}, +}; + +static const u8 gUnknown_082F7B78[] = _("あいうえおかき"); +static const u8 gUnknown_082F7B80[] = _("ABCDEFG"); +static const u8 gUnknown_082F7B88[] = _("0123456"); + +static const u8 *const gUnknown_082F7B90[] = +{ + gUnknown_082F7B78, + gUnknown_082F7B78, + gUnknown_082F7B78, + gUnknown_082F7B80, + gUnknown_082F7B88 +}; + +static void sub_8027D20(void) +{ + gUnknown_02022C98->unk24 = GetLinkPlayerCount(); +} + +static void sub_8027D38(void) +{ + u8 i, playerId; + + for (playerId = gUnknown_02022C98->unk24; playerId < 5; playerId++) + StringCopy(gLinkPlayers[playerId].name, gUnknown_082F7B90[playerId]); + + gUnknown_02022C98->unk24 = 5; + for (i = 0; i < 4; i++) + { + for (playerId = 0; playerId < gUnknown_02022C98->unk24; playerId++) + gUnknown_02022C98->unk4A[playerId][i] = gUnknown_082F7B50[playerId][i]; + } +} + +struct UnkPacket1 +{ + u8 id; + u8 ALIGNED(4) unk4; +}; + +static void sub_8027DD0(u32 arg0) +{ + struct UnkPacket1 packet; + packet.id = 1; + packet.unk4 = arg0; + sub_800FE50(&packet); +} + +static u32 sub_8027DFC(u32 arg0) +{ + struct UnkPacket1 *packet; + + if ((gRecvCmds[0][0] & 0xFF00) != 0x2F00) + return 0; + + packet = (void *)&gRecvCmds[arg0][1]; + if (packet->id == 1) + return packet->unk4; + + return 0; +} + +struct UnkPacket2 +{ + u8 id; + u8 unk1_0:4; + u8 unk1_1:4; + u8 unk2_0:4; + u8 unk2_1:4; + u8 unk3_0:4; + u8 unk3_1:4; + u8 unk4_0:4; + u8 unk4_1:4; + u8 unk5_0:4; + u8 unk5_1:4; + u8 unk6_0:2; + u8 unk6_1:2; + u8 unk6_2:2; + u8 unk6_3:2; + u8 unk7_0:2; + u8 unk7_1:2; + u8 unk7_2:2; + u8 unk7_3:2; + u8 unk8_0:2; + u8 unk8_1:2; + u8 unk8_2:2; + u8 unk8_3:2; + u8 unk9_0:2; + u8 unk9_1:2; + u8 unk9_2:2; + u8 unk9_3:1; + u8 unk9_4:1; + u8 unkA_0:1; + u8 unkA_1:1; + u8 unkA_2:1; + u8 unkA_3:5; + u8 unkB_0:1; + u8 unkB_1:1; + u8 unkB_2:1; + u8 unkB_3:1; + u8 unkB_4:1; + u8 unkB_5:1; + u8 unkB_6:1; +}; + +#ifdef NONMATCHING +static void sub_8027E30(struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 arg6, u32 arg7, u32 arg8) +{ + struct UnkPacket2 packet; + struct DodrioSubstruct_31A0_14 *ptr = &arg0->unk14; + + packet.id = 2; + packet.unk1_0 = ptr->unkB[0]; + packet.unk1_1 = ptr->unkB[1]; + packet.unk2_0 = ptr->unkB[2]; + packet.unk2_1 = ptr->unkB[3]; + packet.unk3_0 = ptr->unkB[4]; + packet.unk3_1 = ptr->unkB[5]; + packet.unk4_0 = ptr->unkB[6]; + packet.unk4_1 = ptr->unkB[7]; + packet.unk5_0 = ptr->unkB[8]; + packet.unk5_1 = ptr->unkB[9]; + + packet.unk6_0 = ptr->unk0[0]; + packet.unk6_1 = ptr->unk0[1]; + packet.unk6_2 = ptr->unk0[2]; + packet.unk6_3 = ptr->unk0[3]; + packet.unk7_0 = ptr->unk0[4]; + packet.unk7_1 = ptr->unk0[5]; + packet.unk7_2 = ptr->unk0[6]; + packet.unk7_3 = ptr->unk0[7]; + packet.unk8_0 = ptr->unk0[8]; + packet.unk8_1 = ptr->unk0[9]; + + packet.unk8_2 = arg1->unk0; + packet.unk8_3 = arg2->unk0; + packet.unk9_0 = arg3->unk0; + packet.unk9_1 = arg4->unk0; + packet.unk9_2 = arg5->unk0; + + packet.unk9_3 = arg1->unk4; + packet.unk9_4 = arg2->unk4; + packet.unkA_0 = arg3->unk4; + packet.unkA_1 = arg4->unk4; + packet.unkA_2 = arg5->unk4; + + packet.unkB_2 = arg1->unk8; + packet.unkB_3 = arg2->unk8; + packet.unkB_4 = arg3->unk8; + packet.unkB_5 = arg4->unk8; + packet.unkB_6 = arg5->unk8; + + packet.unkA_3 = arg6; + packet.unkB_1 = arg7; + packet.unkB_0 = arg8; + sub_800FE50(&packet); +} +#else +NAKED +static void sub_8027E30(struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 arg6, u32 arg7, u32 arg8) +{ + asm_unified(" push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x20\n\ + ldr r4, [sp, 0x48]\n\ + lsls r4, 24\n\ + str r4, [sp, 0x1C]\n\ + movs r4, 0x14\n\ + adds r4, r0\n\ + mov r9, r4\n\ + mov r5, sp\n\ + movs r4, 0x2\n\ + strb r4, [r5]\n\ + mov r10, sp\n\ + mov r5, r9\n\ + ldrb r4, [r5, 0xB]\n\ + movs r7, 0xF\n\ + adds r5, r7, 0\n\ + ands r5, r4\n\ + mov r6, r10\n\ + ldrb r6, [r6, 0x1]\n\ + mov r8, r6\n\ + movs r4, 0x10\n\ + negs r4, r4\n\ + mov r6, r8\n\ + ands r4, r6\n\ + orrs r4, r5\n\ + mov r5, r10\n\ + strb r4, [r5, 0x1]\n\ + mov r8, sp\n\ + mov r6, r9\n\ + ldrb r5, [r6, 0xC]\n\ + lsls r5, 4\n\ + ands r4, r7\n\ + orrs r4, r5\n\ + mov r5, r8\n\ + strb r4, [r5, 0x1]\n\ + ldrb r5, [r6, 0xD]\n\ + movs r6, 0xF\n\ + ands r5, r6\n\ + mov r4, r10\n\ + ldrb r4, [r4, 0x2]\n\ + mov r8, r4\n\ + movs r4, 0x10\n\ + negs r4, r4\n\ + mov r6, r8\n\ + ands r4, r6\n\ + orrs r4, r5\n\ + mov r5, r10\n\ + strb r4, [r5, 0x2]\n\ + mov r8, sp\n\ + mov r6, r9\n\ + ldrb r5, [r6, 0xE]\n\ + lsls r5, 4\n\ + ands r4, r7\n\ + orrs r4, r5\n\ + mov r5, r8\n\ + strb r4, [r5, 0x2]\n\ + ldrb r5, [r6, 0xF]\n\ + movs r6, 0xF\n\ + ands r5, r6\n\ + mov r4, r10\n\ + ldrb r4, [r4, 0x3]\n\ + mov r8, r4\n\ + movs r4, 0x10\n\ + negs r4, r4\n\ + mov r6, r8\n\ + ands r4, r6\n\ + orrs r4, r5\n\ + mov r5, r10\n\ + strb r4, [r5, 0x3]\n\ + mov r8, sp\n\ + mov r6, r9\n\ + ldrb r5, [r6, 0x10]\n\ + lsls r5, 4\n\ + ands r4, r7\n\ + orrs r4, r5\n\ + mov r5, r8\n\ + strb r4, [r5, 0x3]\n\ + ldrb r5, [r6, 0x11]\n\ + movs r6, 0xF\n\ + ands r5, r6\n\ + mov r4, r10\n\ + ldrb r4, [r4, 0x4]\n\ + mov r8, r4\n\ + movs r4, 0x10\n\ + negs r4, r4\n\ + mov r6, r8\n\ + ands r4, r6\n\ + orrs r4, r5\n\ + mov r5, r10\n\ + strb r4, [r5, 0x4]\n\ + mov r8, sp\n\ + mov r6, r9\n\ + ldrb r5, [r6, 0x12]\n\ + lsls r5, 4\n\ + ands r4, r7\n\ + orrs r4, r5\n\ + mov r5, r8\n\ + strb r4, [r5, 0x4]\n\ + ldrb r4, [r6, 0x13]\n\ + movs r6, 0xF\n\ + ands r4, r6\n\ + mov r6, r8\n\ + ldrb r5, [r6, 0x5]\n\ + movs r6, 0x10\n\ + negs r6, r6\n\ + ands r6, r5\n\ + orrs r6, r4\n\ + str r6, [sp, 0xC]\n\ + mov r4, r8\n\ + strb r6, [r4, 0x5]\n\ + mov r5, sp\n\ + mov r6, r9\n\ + ldrb r4, [r6, 0x14]\n\ + lsls r4, 4\n\ + ldr r6, [sp, 0xC]\n\ + ands r6, r7\n\ + orrs r6, r4\n\ + strb r6, [r5, 0x5]\n\ + mov r7, sp\n\ + movs r4, 0x3\n\ + mov r8, r4\n\ + ldrb r0, [r0, 0x14]\n\ + mov r5, r8\n\ + ands r0, r5\n\ + ldrb r5, [r7, 0x6]\n\ + movs r6, 0x4\n\ + negs r6, r6\n\ + mov r10, r6\n\ + mov r4, r10\n\ + ands r4, r5\n\ + orrs r4, r0\n\ + strb r4, [r7, 0x6]\n\ + mov r5, r9\n\ + ldrb r0, [r5, 0x1]\n\ + mov r6, r8\n\ + ands r0, r6\n\ + lsls r0, 2\n\ + movs r5, 0xD\n\ + negs r5, r5\n\ + ands r5, r4\n\ + orrs r5, r0\n\ + strb r5, [r7, 0x6]\n\ + mov r0, r9\n\ + ldrb r4, [r0, 0x2]\n\ + ands r4, r6\n\ + lsls r4, 4\n\ + movs r0, 0x31\n\ + negs r0, r0\n\ + ands r0, r5\n\ + orrs r0, r4\n\ + strb r0, [r7, 0x6]\n\ + mov r5, sp\n\ + mov r6, r9\n\ + ldrb r4, [r6, 0x3]\n\ + lsls r4, 6\n\ + movs r6, 0x3F\n\ + ands r0, r6\n\ + orrs r0, r4\n\ + strb r0, [r5, 0x6]\n\ + mov r4, r9\n\ + ldrb r0, [r4, 0x4]\n\ + mov r5, r8\n\ + ands r0, r5\n\ + ldrb r5, [r7, 0x7]\n\ + mov r4, r10\n\ + ands r4, r5\n\ + orrs r4, r0\n\ + strb r4, [r7, 0x7]\n\ + mov r6, r9\n\ + ldrb r0, [r6, 0x5]\n\ + mov r5, r8\n\ + ands r0, r5\n\ + lsls r0, 2\n\ + movs r5, 0xD\n\ + negs r5, r5\n\ + ands r5, r4\n\ + orrs r5, r0\n\ + strb r5, [r7, 0x7]\n\ + ldrb r4, [r6, 0x6]\n\ + mov r6, r8\n\ + ands r4, r6\n\ + lsls r4, 4\n\ + movs r0, 0x31\n\ + negs r0, r0\n\ + ands r0, r5\n\ + orrs r0, r4\n\ + strb r0, [r7, 0x7]\n\ + mov r5, sp\n\ + mov r6, r9\n\ + ldrb r4, [r6, 0x7]\n\ + lsls r4, 6\n\ + movs r6, 0x3F\n\ + ands r0, r6\n\ + orrs r0, r4\n\ + strb r0, [r5, 0x7]\n\ + mov r8, sp\n\ + mov r0, r9\n\ + ldrb r4, [r0, 0x8]\n\ + movs r7, 0x3\n\ + adds r0, r7, 0\n\ + ands r0, r4\n\ + mov r4, r8\n\ + ldrb r5, [r4, 0x8]\n\ + mov r4, r10\n\ + ands r4, r5\n\ + orrs r4, r0\n\ + mov r5, r8\n\ + strb r4, [r5, 0x8]\n\ + mov r6, r9\n\ + ldrb r5, [r6, 0x9]\n\ + adds r0, r7, 0\n\ + ands r0, r5\n\ + lsls r0, 2\n\ + movs r5, 0xD\n\ + negs r5, r5\n\ + ands r5, r4\n\ + orrs r5, r0\n\ + mov r0, r8\n\ + strb r5, [r0, 0x8]\n\ + ldrb r0, [r1]\n\ + adds r4, r7, 0\n\ + ands r4, r0\n\ + lsls r4, 4\n\ + movs r0, 0x31\n\ + negs r0, r0\n\ + ands r0, r5\n\ + orrs r0, r4\n\ + mov r4, r8\n\ + strb r0, [r4, 0x8]\n\ + mov r5, sp\n\ + ldrb r4, [r2]\n\ + lsls r4, 6\n\ + movs r6, 0x3F\n\ + ands r0, r6\n\ + orrs r0, r4\n\ + strb r0, [r5, 0x8]\n\ + ldrb r4, [r3]\n\ + adds r0, r7, 0\n\ + ands r0, r4\n\ + ldrb r4, [r5, 0x9]\n\ + mov r6, r10\n\ + ands r6, r4\n\ + orrs r6, r0\n\ + mov r10, r6\n\ + strb r6, [r5, 0x9]\n\ + ldr r0, [sp, 0x40]\n\ + ldrb r4, [r0]\n\ + adds r0, r7, 0\n\ + ands r0, r4\n\ + lsls r0, 2\n\ + movs r4, 0xD\n\ + negs r4, r4\n\ + ands r6, r4\n\ + orrs r6, r0\n\ + str r6, [sp, 0x10]\n\ + strb r6, [r5, 0x9]\n\ + mov r4, sp\n\ + ldr r5, [sp, 0x44]\n\ + ldrb r0, [r5]\n\ + adds r6, r7, 0\n\ + ands r6, r0\n\ + lsls r0, r6, 4\n\ + subs r7, 0x34\n\ + ldr r5, [sp, 0x10]\n\ + ands r7, r5\n\ + orrs r7, r0\n\ + strb r7, [r4, 0x9]\n\ + mov r5, sp\n\ + ldrb r0, [r1, 0x4]\n\ + movs r6, 0x1\n\ + mov r12, r6\n\ + mov r4, r12\n\ + ands r4, r0\n\ + lsls r4, 6\n\ + movs r0, 0x41\n\ + negs r0, r0\n\ + mov r10, r0\n\ + ands r0, r7\n\ + orrs r0, r4\n\ + strb r0, [r5, 0x9]\n\ + ldrb r4, [r2, 0x4]\n\ + lsls r4, 7\n\ + movs r5, 0x7F\n\ + ands r0, r5\n\ + orrs r0, r4\n\ + mov r4, r8\n\ + strb r0, [r4, 0x9]\n\ + ldrb r4, [r3, 0x4]\n\ + mov r0, r12\n\ + ands r0, r4\n\ + mov r5, r8\n\ + ldrb r4, [r5, 0xA]\n\ + movs r7, 0x2\n\ + negs r7, r7\n\ + adds r5, r7, 0\n\ + ands r5, r4\n\ + orrs r5, r0\n\ + mov r6, r8\n\ + strb r5, [r6, 0xA]\n\ + mov r9, sp\n\ + ldr r4, [sp, 0x40]\n\ + ldrb r0, [r4, 0x4]\n\ + mov r4, r12\n\ + ands r4, r0\n\ + lsls r4, 1\n\ + movs r6, 0x3\n\ + negs r6, r6\n\ + mov r8, r6\n\ + mov r0, r8\n\ + ands r0, r5\n\ + orrs r0, r4\n\ + mov r4, r9\n\ + strb r0, [r4, 0xA]\n\ + ldr r6, [sp, 0x44]\n\ + ldrb r5, [r6, 0x4]\n\ + mov r4, r12\n\ + ands r4, r5\n\ + lsls r4, 2\n\ + movs r5, 0x5\n\ + negs r5, r5\n\ + ands r0, r5\n\ + orrs r0, r4\n\ + mov r4, r9\n\ + strb r0, [r4, 0xA]\n\ + mov r4, sp\n\ + ldrb r1, [r1, 0x8]\n\ + mov r0, r12\n\ + ands r0, r1\n\ + lsls r0, 2\n\ + ldrb r1, [r4, 0xB]\n\ + ands r5, r1\n\ + orrs r5, r0\n\ + strb r5, [r4, 0xB]\n\ + ldrb r1, [r2, 0x8]\n\ + mov r0, r12\n\ + ands r0, r1\n\ + lsls r0, 3\n\ + movs r1, 0x9\n\ + negs r1, r1\n\ + ands r1, r5\n\ + orrs r1, r0\n\ + strb r1, [r4, 0xB]\n\ + ldrb r2, [r3, 0x8]\n\ + mov r0, r12\n\ + ands r0, r2\n\ + lsls r0, 4\n\ + movs r2, 0x11\n\ + negs r2, r2\n\ + ands r2, r1\n\ + orrs r2, r0\n\ + strb r2, [r4, 0xB]\n\ + mov r3, sp\n\ + ldr r5, [sp, 0x40]\n\ + ldrb r0, [r5, 0x8]\n\ + mov r1, r12\n\ + ands r1, r0\n\ + lsls r1, 5\n\ + movs r0, 0x21\n\ + negs r0, r0\n\ + ands r0, r2\n\ + orrs r0, r1\n\ + strb r0, [r3, 0xB]\n\ + mov r2, sp\n\ + ldrb r1, [r6, 0x8]\n\ + mov r6, r12\n\ + ands r6, r1\n\ + lsls r1, r6, 6\n\ + mov r3, r10\n\ + ands r0, r3\n\ + orrs r0, r1\n\ + strb r0, [r2, 0xB]\n\ + ldr r4, [sp, 0x1C]\n\ + lsrs r3, r4, 21\n\ + ldrb r1, [r2, 0xA]\n\ + movs r0, 0x7\n\ + ands r0, r1\n\ + orrs r0, r3\n\ + strb r0, [r2, 0xA]\n\ + mov r1, sp\n\ + ldr r5, [sp, 0x4C]\n\ + movs r6, 0x1\n\ + ands r5, r6\n\ + lsls r2, r5, 1\n\ + ldrb r0, [r1, 0xB]\n\ + mov r3, r8\n\ + ands r3, r0\n\ + orrs r3, r2\n\ + mov r8, r3\n\ + strb r3, [r1, 0xB]\n\ + mov r0, sp\n\ + ldr r4, [sp, 0x50]\n\ + ands r4, r6\n\ + mov r5, r8\n\ + ands r5, r7\n\ + orrs r5, r4\n\ + strb r5, [r0, 0xB]\n\ + bl sub_800FE50\n\ + add sp, 0x20\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ +"); +} +#endif + +static u32 sub_8028164(u32 unused, struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 *arg6, u32 *arg7, u32 *arg8) +{ + struct UnkPacket2 *packet; + struct DodrioSubstruct_31A0_14 *ptr = &arg0->unk14; + + if ((gRecvCmds[0][0] & 0xFF00) != 0x2F00) + return 0; + + packet = (void *)&gRecvCmds[0][1]; + if (packet->id == 2) + { + ptr->unkB[0] = packet->unk1_0; + ptr->unkB[1] = packet->unk1_1; + ptr->unkB[2] = packet->unk2_0; + ptr->unkB[3] = packet->unk2_1; + ptr->unkB[4] = packet->unk3_0; + ptr->unkB[5] = packet->unk3_1; + ptr->unkB[6] = packet->unk4_0; + ptr->unkB[7] = packet->unk4_1; + ptr->unkB[8] = packet->unk5_0; + ptr->unkB[9] = packet->unk5_1; + ptr->unkB[10] = packet->unk1_0; + + ptr->unk0[0] = packet->unk6_0; + ptr->unk0[1] = packet->unk6_1; + ptr->unk0[2] = packet->unk6_2; + ptr->unk0[3] = packet->unk6_3; + ptr->unk0[4] = packet->unk7_0; + ptr->unk0[5] = packet->unk7_1; + ptr->unk0[6] = packet->unk7_2; + ptr->unk0[7] = packet->unk7_3; + ptr->unk0[8] = packet->unk8_0; + ptr->unk0[9] = packet->unk8_1; + ptr->unk0[10] = packet->unk6_0; + + arg1->unk0 = packet->unk8_2; + arg1->unk4 = packet->unk9_3; + arg1->unk8 = packet->unkB_2; + + arg2->unk0 = packet->unk8_3; + arg2->unk4 = packet->unk9_4; + arg2->unk8 = packet->unkB_3; + + arg3->unk0 = packet->unk9_0; + arg3->unk4 = packet->unkA_0; + arg3->unk8 = packet->unkB_4; + + arg4->unk0 = packet->unk9_1; + arg4->unk4 = packet->unkA_1; + arg4->unk8 = packet->unkB_5; + + arg5->unk0 = packet->unk9_2; + arg5->unk4 = packet->unkA_2; + arg5->unk8 = packet->unkB_6; + + *arg6 = packet->unkA_3; + *arg7 = packet->unkB_1; + *arg8 = packet->unkB_0; + return 1; + } + + return 0; +} + +struct UnkPacket3 +{ + u8 id; + u8 ALIGNED(4) unk4; +}; + +static void sub_80282EC(u8 arg0) +{ + struct UnkPacket3 packet; + packet.id = 3; + packet.unk4 = arg0; + sub_800FE50(&packet); +} + +static u32 sub_8028318(u32 arg0, u8 *arg1) +{ + struct UnkPacket3 *packet; + + if ((gRecvCmds[0][0] & 0xFF00) != 0x2F00) + return 0; + + packet = (void *)&gRecvCmds[arg0][1]; + if (packet->id == 3) + { + *arg1 = packet->unk4; + return 1; + } + + return 0; +} + +struct UnkPacket4 +{ + u8 id; + u32 unk4; +}; + +static void sub_8028350(u32 arg0) +{ + struct UnkPacket4 packet; + packet.id = 4; + packet.unk4 = arg0; + sub_800FE50(&packet); +} + +static u32 sub_8028374(u32 arg0) +{ + struct UnkPacket4 *packet; + + if ((gRecvCmds[0][0] & 0xFF00) != 0x2F00) + return 0; + + packet = (void *)&gRecvCmds[arg0][1]; + if (packet->id == 4) + return packet->unk4; + + return 0; +} + +// Large chunk of data +static const struct BgTemplate gUnknown_082F7BA4[] = +{ + { + .bg = 0, + .charBaseIndex = 0, + .mapBaseIndex = 30, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, + { + .bg = 1, + .charBaseIndex = 2, + .mapBaseIndex = 12, + .screenSize = 1, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, + { + .bg = 2, + .charBaseIndex = 2, + .mapBaseIndex = 14, + .screenSize = 1, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, + { + .bg = 3, + .charBaseIndex = 3, + .mapBaseIndex = 31, + .screenSize = 0, + .paletteMode = 0, + .priority = 2, + .baseTile = 0 + }, +}; + +// Unknown unreferenced data, feel free to remove. +static const u32 sUnused[] = {255, 0}; + +static const struct WindowTemplate gUnknown_082F7BBC[] = +{ + { + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 28, + .height = 2, + .paletteNum = 13, + .baseBlock = 0x13, + }, + { + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 5, + .width = 28, + .height = 14, + .paletteNum = 13, + .baseBlock = 0x4B, + } +}; +static const struct WindowTemplate gUnknown_082F7BCC = +{ + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 5, + .width = 28, + .height = 7, + .paletteNum = 13, + .baseBlock = 0x4B, +}; +static const struct WindowTemplate gUnknown_082F7BD4[] = +{ + { + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 8, + .width = 19, + .height = 3, + .paletteNum = 13, + .baseBlock = 0x13, + }, + { + .bg = 0, + .tilemapLeft = 22, + .tilemapTop = 7, + .width = 6, + .height = 4, + .paletteNum = 13, + .baseBlock = 0x4C, + } +}; +static const struct WindowTemplate gUnknown_082F7BE4 = +{ + .bg = 0, + .tilemapLeft = 4, + .tilemapTop = 6, + .width = 22, + .height = 5, + .paletteNum = 13, + .baseBlock = 0x13, +}; +static const struct WindowTemplate gUnknown_082F7BEC = +{ + .bg = 0, + .tilemapLeft = 5, + .tilemapTop = 8, + .width = 19, + .height = 3, + .paletteNum = 13, + .baseBlock = 0x13, +}; + +// This is an unused copy of the tables from the top of the file. Feel free to remove. +static const u8 sDuplicateArray[] = +{ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 0, 0, 1, 2, 5, 6, 3, 4, 5, 8, 9, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 2, 9, + 0, 0, 1, 4, 5, 6, 7, 2, 3, 4, 9, 0, 0, 1, 6, 7, 2, 3, 4, 5, 6, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 1, 0, 0, 3, 4, 5, 6, 7, 8, 1, 2, 3, 0, 0, 5, 6, 7, 8, 1, 2, 3, 4, 5, 0, 0, 7, + 8, 1, 2, 3, 4, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 2, 3, 4, 5, 6, 7, 8, 9, 0, + 1, 2, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 4, 5, 6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 5, 5, 6, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 6, 6, 7, 2, 2, 3, 4, 0, 0, 0, 0, 0, 0, + 3, 4, 5, 5, 6, 7, 7, 8, 1, 1, 2, 3, 0, 0, 0, 4, 5, 6, 6, 7, 8, 8, 9, 0, 0, 1, 2, 2, 3, 4, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 0, 1, 2, 1, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 1, 0, 1, + 2, 1, 2, 3, 2, 3, 0, 0, 0, 0, 4, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 0, 0, 0, 0, 9, 9, 9, 9, 1, 1, 1, 9, 9, 9, 9, 9, + 9, 9, 0, 0, 1, 1, 0, 9, 9, 9, 9, 9, 2, 2, 0, 0, 1, 1, 1, 9, 9, 9, 3, 3, 0, 0, 1, 1, 2, 2, 3, 9, 3, 3, 4, 4, 0, 0, 1, 1, + 2, 2, 3, 5, 0, 0, 0, 0, 4, 6, 0, 0, 0, 3, 5, 7, 0, 0, 2, 4, 6, 8, 0, 1, 3, 5, 6, 9 +}; + +static const u16 gDodrioBerryBgPal1[] = INCBIN_U16("graphics/link_games/dodrioberry_bg1.gbapal", + "graphics/link_games/dodrioberry_bg2.gbapal"); +static const u16 gDodrioBerryPkmnPal[] = INCBIN_U16("graphics/link_games/dodrioberry_pkmn.gbapal"); +static const u16 gDodrioBerryShinyPal[] = INCBIN_U16("graphics/link_games/dodrioberry_shiny.gbapal"); +static const u16 gDodrioBerryStatusPal[] = INCBIN_U16("graphics/link_games/dodrioberry_status.gbapal"); +static const u16 gDodrioBerrySpritesPal[] = INCBIN_U16("graphics/link_games/dodrioberry_berrysprites.gbapal"); +static const u32 gDodrioBerrySpritesGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_berrysprites.4bpp.lz"); +static const u16 gDodrioBerryPlatformPal[] = INCBIN_U16("graphics/link_games/dodrioberry_platform.gbapal"); +static const u32 gDodrioBerryBgGfx1[] = INCBIN_U32("graphics/link_games/dodrioberry_bg1.4bpp.lz"); +static const u32 gDodrioBerryBgGfx2[] = INCBIN_U32("graphics/link_games/dodrioberry_bg2.4bpp.lz"); +static const u32 gDodrioBerryStatusGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_status.4bpp.lz"); +static const u32 gDodrioBerryPlatformGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_platform.4bpp.lz"); +static const u32 gDodrioBerryPkmnGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_pkmn.4bpp.lz"); +static const u32 gDodrioBerryBgTilemap1[] = INCBIN_U32("graphics/link_games/dodrioberry_bg1.bin.lz"); +static const u32 gDodrioBerryBgTilemap2Right[] = INCBIN_U32("graphics/link_games/dodrioberry_bg2right.bin.lz"); +static const u32 gDodrioBerryBgTilemap2Left[] = INCBIN_U32("graphics/link_games/dodrioberry_bg2left.bin.lz"); + +static const struct OamData sOamData_82FB1E0 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 2, + .paletteNum = 0, + .affineParam = 0 +}; + +static const struct OamData sOamData_82FB1E8 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 1, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0 +}; + +static const struct OamData sOamData_82FB1F0 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 1, + .tileNum = 0, + .priority = 2, + .paletteNum = 0, + .affineParam = 0 +}; + +static const struct OamData sOamData_82FB1F8 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 1, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 3, + .paletteNum = 0, + .affineParam = 0 +}; + +static const union AnimCmd sSpriteAnim_82FB200[] = +{ + ANIMCMD_FRAME(0, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sSpriteAnim_82FB208[] = +{ + ANIMCMD_FRAME(64, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sSpriteAnim_82FB210[] = +{ + ANIMCMD_FRAME(128, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sSpriteAnim_82FB218[] = +{ + ANIMCMD_FRAME(192, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sSpriteAnim_82FB220[] = +{ + ANIMCMD_FRAME(256, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd *const sSpriteAnimTable_82FB228[] = +{ + sSpriteAnim_82FB200, + sSpriteAnim_82FB208, + sSpriteAnim_82FB210, + sSpriteAnim_82FB218, + sSpriteAnim_82FB220 +}; + +static const union AnimCmd sSpriteAnim_82FB23C[] = +{ + ANIMCMD_FRAME(0, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sSpriteAnim_82FB244[] = +{ + ANIMCMD_FRAME(4, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sSpriteAnim_82FB24C[] = +{ + ANIMCMD_FRAME(8, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd *const sSpriteAnimTable_82FB254[] = +{ + sSpriteAnim_82FB23C, + sSpriteAnim_82FB244, + sSpriteAnim_82FB24C +}; + +static const union AnimCmd sSpriteAnim_82FB260[] = +{ + ANIMCMD_FRAME(0, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sSpriteAnim_82FB268[] = +{ + ANIMCMD_FRAME(4, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sSpriteAnim_82FB270[] = +{ + ANIMCMD_FRAME(8, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sSpriteAnim_82FB278[] = +{ + ANIMCMD_FRAME(12, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sSpriteAnim_82FB280[] = +{ + ANIMCMD_FRAME(16, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sSpriteAnim_82FB288[] = +{ + ANIMCMD_FRAME(20, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sSpriteAnim_82FB290[] = +{ + ANIMCMD_FRAME(24, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sSpriteAnim_82FB298[] = +{ + ANIMCMD_FRAME(28, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd sSpriteAnim_82FB2A0[] = +{ + ANIMCMD_FRAME(32, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd *const sSpriteAnimTable_82FB2A8[] = +{ + sSpriteAnim_82FB260, + sSpriteAnim_82FB268, + sSpriteAnim_82FB270, + sSpriteAnim_82FB278, + sSpriteAnim_82FB280, + sSpriteAnim_82FB288, + sSpriteAnim_82FB290, + sSpriteAnim_82FB298, + sSpriteAnim_82FB2A0 +}; + +static const union AnimCmd sSpriteAnim_82FB2CC[] = +{ + ANIMCMD_FRAME(0, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd *const sSpriteAnimTable_82FB2D4[] = +{ + sSpriteAnim_82FB2CC +}; + +static void sub_80283A8(void) +{ + void *ptr = AllocZeroed(0x3000); + struct SpritePalette pal1 = {gDodrioBerryPkmnPal, 0}; + struct SpritePalette pal2 = {gDodrioBerryShinyPal, 1}; + + LZ77UnCompWram(gDodrioBerryPkmnGfx, ptr); + // This check should be one line up. + if (ptr != NULL) + { + struct SpriteSheet sheet = {ptr, 0x3000, 0}; + LoadSpriteSheet(&sheet); + Free(ptr); + } + LoadSpritePalette(&pal1); + LoadSpritePalette(&pal2); +} + +static void sub_8028408(struct DodrioSubstruct_318C *arg0, u8 arg1, u8 id, u8 arg3) +{ + struct SpriteTemplate sprTemplate = + { + .tileTag = 0, + .paletteTag = arg0->isShiny, + .oam = &sOamData_82FB1E0, + .anims = sSpriteAnimTable_82FB228, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80284A8, + }; + + gUnknown_02022C9C[id] = AllocZeroed(4); + *gUnknown_02022C9C[id] = CreateSprite(&sprTemplate, sub_8028F14(arg1, arg3), 136, 3); + sub_8028654(TRUE, id); +} + +static void sub_80284A8(struct Sprite *sprite) +{ + switch (sprite->data[0]) + { + case 0: + break; + case 1: + sub_802853C(sprite); + break; + case 2: + sub_80285AC(sprite); + break; + } +} + +static void sub_80284CC(u8 unused) +{ + struct Sprite *sprite = &gSprites[*gUnknown_02022C9C[GetMultiplayerId()]]; + sprite->data[0] = 1; + sprite->data[1] = 0; + sprite->data[2] = 0; + sprite->data[3] = 0; + sprite->data[4] = 0; +} + +static void sub_8028504(u8 unused) +{ + struct Sprite *sprite = &gSprites[*gUnknown_02022C9C[GetMultiplayerId()]]; + sprite->data[0] = 2; + sprite->data[1] = 0; + sprite->data[2] = 0; + sprite->data[3] = 0; + sprite->data[4] = 0; +} + +static u32 sub_802853C(struct Sprite *sprite) +{ + s8 var; + u8 mod = (++sprite->data[1] / 2) % 4; + + if (sprite->data[1] >= 3) + { + switch (mod) + { + default: + var = 1; + break; + case 1: + case 2: + var = -1; + break; + } + + sprite->pos1.x += var; + if (++sprite->data[1] >= 40) + { + sprite->data[0] = 0; + sprite->pos1.x = sub_8028F14(0, sub_8027650()); + } + } + + return 0; +} + +static u32 sub_80285AC(struct Sprite *sprite) +{ + u8 mod = (++sprite->data[1] / 13) % 4; + + if (sprite->data[1] % 13 == 0 && mod != 0) + PlaySE(SE_W204); + if (sprite->data[1] >= 104) + { + sprite->data[0] = 0; + mod = 0; + } + sub_80286B4(GetMultiplayerId(), mod); + return 0; +} + +static void sub_8028614(u8 count) +{ + u8 i; + for (i = 0; i < count; i++) + { + struct Sprite *sprite = &gSprites[*gUnknown_02022C9C[i]]; + if (sprite != NULL) + DestroySpriteAndFreeResources(sprite); + // Memory should be freed here but is not. + } +} + +static void sub_8028654(bool8 invisible, u8 id) +{ + gSprites[*gUnknown_02022C9C[id]].invisible = invisible; +} + +static void sub_802868C(bool8 invisible, u8 count) +{ + u8 i; + for (i = 0; i < count; i++) + sub_8028654(invisible, i); +} + +static void sub_80286B4(u8 id, u8 frameNum) +{ + StartSpriteAnim(&gSprites[*gUnknown_02022C9C[id]], frameNum); +} + +static void nullsub_15(struct Sprite *sprite) +{ + +} + +static void sub_80286E4(void) +{ + u8 i; + for (i = 0; i < 10; i++) + { + struct Sprite *sprite = &gSprites[gUnknown_02022CF4->unk2A[i]]; + sprite->pos1.x = (i * 16) + 48; + sprite->pos1.y = -8 - (i * 8); + gUnknown_02022CF4->unkC[i] = 0; + } +} + +static void sub_8028734(void) +{ + u8 i; + void *ptr = AllocZeroed(0x180); + struct SpritePalette spPal = {gDodrioBerryStatusPal, 2}; + + LZ77UnCompWram(gDodrioBerryStatusGfx, ptr); + // This check should be one line up. + if (ptr != NULL) + { + struct SpriteSheet spSheet = {ptr, 0x180, 1}; + struct SpriteTemplate spTemplate = + { + .tileTag = 1, + .paletteTag = 2, + .oam = &sOamData_82FB1E8, + .anims = sSpriteAnimTable_82FB254, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = nullsub_15, + }; + + gUnknown_02022CF4 = AllocZeroed(sizeof(*gUnknown_02022CF4)); + LoadSpriteSheet(&spSheet); + LoadSpritePalette(&spPal); + for (i = 0; i < 10; i++) + gUnknown_02022CF4->unk2A[i] = CreateSprite(&spTemplate, (i * 16) + 48, -8 - (i * 8), 0); + } + + Free(ptr); +} + +static void sub_80287E4(void) +{ + u8 i; + for (i = 0; i < 10; i++) + { + struct Sprite *sprite = &gSprites[gUnknown_02022CF4->unk2A[i]]; + if (sprite != NULL) + DestroySpriteAndFreeResources(sprite); + } + FREE_AND_SET_NULL(gUnknown_02022CF4); +} + +static bool32 sub_8028828(void) +{ + u8 i; + bool32 r3 = FALSE; + for (i = 0; i < 10; i++) + { + struct Sprite *sprite = &gSprites[gUnknown_02022CF4->unk2A[i]]; + gUnknown_02022CF4->unk16[i] = 2; + if (gUnknown_02022CF4->unkC[i] != 0 && sprite->pos1.y == 8) + continue; + r3 = TRUE; + if (sprite->pos1.y == 8) + { + if (gUnknown_02022CF4->unkC[i] != 0) + continue; + gUnknown_02022CF4->unkC[i] = 1; + gUnknown_02022CF4->unk16[i] = -16; + PlaySE(SE_TK_KASYA); + } + sprite->pos1.y += gUnknown_02022CF4->unk16[i]; + } + + if (r3) + return FALSE; + else + return TRUE; +} + +static void sub_80288D4(u8 arg0) +{ + u8 i; + + if (arg0 > 10) + { + for (i = 0; i < 10; i++) + StartSpriteAnim(&gSprites[gUnknown_02022CF4->unk2A[i]], 1); + } + else + { + for (i = 0; i < 10 - arg0; i++) + { + if (arg0 > 6) + { + gUnknown_02022CF4->unk3E += arg0 - 6; + if (gUnknown_02022CF4->unk3E > 30) + gUnknown_02022CF4->unk3E = 0; + else if (gUnknown_02022CF4->unk3E > 10) + StartSpriteAnim(&gSprites[gUnknown_02022CF4->unk2A[i]], 2); + else + StartSpriteAnim(&gSprites[gUnknown_02022CF4->unk2A[i]], 0); + } + else + { + StartSpriteAnim(&gSprites[gUnknown_02022CF4->unk2A[i]], 0); + } + } + for (; i < 10; i++) + StartSpriteAnim(&gSprites[gUnknown_02022CF4->unk2A[i]], 1); + } +} + +static void sub_80289E8(bool8 invisible) +{ + u8 i; + for (i = 0; i < 10; i++) + gSprites[gUnknown_02022CF4->unk2A[i]].invisible = invisible; +} + +// Unknown unused data, feel free to remove. +static const u8 sUnused2[] = {0xD4, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0xFB, 0x0, 0x0}; + +static void sub_8028A34(void) +{ + void *ptr = AllocZeroed(0x480); + struct SpritePalette sprPal = {gDodrioBerrySpritesPal, 3}; + + LZ77UnCompWram(gDodrioBerrySpritesGfx, ptr); + if (ptr != NULL) + { + struct SpriteSheet sprSheet = {ptr, 0x480, 2}; + LoadSpriteSheet(&sprSheet); + } + + LoadSpritePalette(&sprPal); + Free(ptr); +} + +static const s16 gUnknown_082FB31C[] = {88, 128, 168, 208}; + +static void sub_8028A88(void) +{ + u8 i; + s16 x; + + struct SpriteTemplate sprTemplate1 = + { + .tileTag = 2, + .paletteTag = 3, + .oam = &sOamData_82FB1F0, + .anims = sSpriteAnimTable_82FB2A8, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }; + struct SpriteTemplate sprTemplate2 = + { + .tileTag = 2, + .paletteTag = 3, + .oam = &sOamData_82FB1E8, + .anims = sSpriteAnimTable_82FB2A8, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }; + + for (i = 0; i < 11; i++) + { + gUnknown_02022CB8[i] = AllocZeroed(4); + x = i * 16; + *gUnknown_02022CB8[i] = CreateSprite(&sprTemplate1, x + (i * 8), 8, 1); + sub_8028BF8(i, TRUE); + } + for (i = 0; i < 4; i++) + { + gUnknown_02022CE4[i] = AllocZeroed(4); + if (i == 3) + *gUnknown_02022CE4[i] = CreateSprite(&sprTemplate2, gUnknown_082FB31C[i], 49, 0); + else + *gUnknown_02022CE4[i] = CreateSprite(&sprTemplate2, gUnknown_082FB31C[i], 52, 0); + StartSpriteAnim(&gSprites[*gUnknown_02022CE4[i]], i); + } + + sub_8028C30(TRUE); +} + +static void sub_8028B80(void) +{ + struct Sprite *sprite; + u8 i; + + for (i = 0; i < 11; i++) + { + sprite = &gSprites[*gUnknown_02022CB8[i]]; + if (sprite != NULL) + DestroySprite(sprite); + FREE_AND_SET_NULL(gUnknown_02022CB8[i]); + } + for (i = 0; i < 4; i++) + { + sprite = &gSprites[*gUnknown_02022CE4[i]]; + if (sprite != NULL) + DestroySprite(sprite); + FREE_AND_SET_NULL(gUnknown_02022CE4[i]); + } +} + +static void sub_8028BF8(u8 id, bool8 invisible) +{ + gSprites[*gUnknown_02022CB8[id]].invisible = invisible; +} + +static void sub_8028C30(bool8 invisible) +{ + u8 i; + for (i = 0; i < 4; i++) + gSprites[*gUnknown_02022CE4[i]].invisible = invisible; +} + +static void sub_8028C7C(u8 id, u8 y) +{ + gSprites[*gUnknown_02022CB8[id]].pos1.y = y * 8; +} + +static void sub_8028CA4(u16 id, u8 frameNum) +{ + StartSpriteAnim(&gSprites[*gUnknown_02022CB8[id]], frameNum); +} + +// Unused +static void sub_8028CD0(u8 spriteId) +{ + gSprites[spriteId].pos1.x = 20 * spriteId + 50; + gSprites[spriteId].pos1.y = 50; +} + +// Gamefreak made a mistake there and goes out of bounds for the data array as it holds 8 elements +// in turn overwriting sprite's subpriority and subsprites fields. +#if defined(NONMATCHING) || MODERN + #define sKeepPosX data[1] +#else + #define sKeepPosX data[10] +#endif // NONMATCHING + +static void sub_8028CF4(struct Sprite *sprite) +{ + u8 i; + static const u8 array[] = {30, 20}; + + if (sprite->sKeepPosX != TRUE) + { + for (i = 0; i < 2; i++) + { + if (++gUnknown_02022CB0[i][1] > array[i]) + { + sprite->pos1.x--; + gUnknown_02022CB0[i][1] = 0; + } + } + } +} + +static const s16 gUnknown_082FB356[][2] = {{230, 55}, {30, 74}}; + +static void sub_8028D44(void) +{ + u8 i; + void *ptr = AllocZeroed(0x400); + struct SpritePalette sprPal = {gDodrioBerryPlatformPal, 6}; + + LZ77UnCompWram(gDodrioBerryPlatformGfx, ptr); + if (ptr != NULL) + { + struct SpriteSheet sprSheet = {ptr, 0x400, 5}; + struct SpriteTemplate sprTemplate = + { + .tileTag = 5, + .paletteTag = 6, + .oam = &sOamData_82FB1F8, + .anims = sSpriteAnimTable_82FB2D4, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8028CF4, + }; + + LoadSpriteSheet(&sprSheet); + LoadSpritePalette(&sprPal); + for (i = 0; i < 2; i++) + { + gUnknown_02022CB0[i] = AllocZeroed(4); + *gUnknown_02022CB0[i] = CreateSprite(&sprTemplate, gUnknown_082FB356[i][0], gUnknown_082FB356[i][1], 4); + } + } + + Free(ptr); +} + +static void sub_8028DFC(void) +{ + u8 i; + for (i = 0; i < 2; i++) + { + struct Sprite *sprite = &gSprites[*gUnknown_02022CB0[i]]; + sprite->sKeepPosX = TRUE; + sprite->pos1.x = gUnknown_082FB356[i][0]; + sprite->pos1.y = gUnknown_082FB356[i][1]; + } +} + +static void sub_8028E4C(void) +{ + u8 i; + for (i = 0; i < 2; i++) + { + struct Sprite *sprite = &gSprites[*gUnknown_02022CB0[i]]; + sprite->sKeepPosX = FALSE; + } +} + +static void sub_8028E84(void) +{ + u8 i; + for (i = 0; i < 2; i++) + { + struct Sprite *sprite = &gSprites[*gUnknown_02022CB0[i]]; + if (sprite) + DestroySprite(sprite); + FREE_AND_SET_NULL(gUnknown_02022CB0[i]); + } +} + +static void sub_8028EC8(bool8 invisible) +{ + u8 i; + for (i = 0; i < 2; i++) + gSprites[*gUnknown_02022CB0[i]].invisible = invisible; +} + +#undef sKeepPosX + +static s16 sub_8028F14(u8 arg0, u8 arg1) +{ + s16 x = 0; + switch (arg1) + { + case 1: + x = 15; + break; + case 2: + switch (arg0) + { + case 0: x = 12; break; + case 1: x = 18; break; + } + break; + case 3: + switch (arg0) + { + case 0: x = 15; break; + case 1: x = 21; break; + case 2: x = 9; break; + } + break; + case 4: + switch (arg0) + { + case 0: x = 12; break; + case 1: x = 18; break; + case 2: x = 24; break; + case 3: x = 6; break; + } + break; + case 5: + switch (arg0) + { + case 0: x = 15; break; + case 1: x = 21; break; + case 2: x = 27; break; + case 3: x = 3; break; + case 4: x = 9; break; + } + break; + } + + return x * 8; +} + +static void sub_8028FCC(void) +{ + u8 i; + for (i = 0; i < 11; i++) + { + sub_8028BF8(i, TRUE); + sub_8028C7C(i, 1); + } + sub_80289E8(FALSE); +} + +static void sub_8028FF8(u8 frameId) +{ + LoadBgTiles(0, GetWindowFrameTilesPal(frameId)->tiles, 0x120, 1); + LoadPalette(GetWindowFrameTilesPal(frameId)->pal, 0xA0, 0x20); +} + +static void sub_802902C(void) +{ + LoadUserWindowBorderGfx_(0, 0xA, 0xB0); +} + +static void sub_802903C(void) +{ + gUnknown_02022CF8->finished = FALSE; + gUnknown_02022CF8->state = 0; + gUnknown_02022CF8->unk3018 = 0; + gUnknown_02022CF8->unk3020 = 0; + gUnknown_02022CF8->unk3024 = 0; +} + +static void sub_8029074(const struct WindowTemplate *winTempl) +{ + u8 pal = 0xA; + + FillBgTilemapBufferRect(0, 1, winTempl->tilemapLeft - 1, winTempl->tilemapTop - 1, 1, 1, pal); + FillBgTilemapBufferRect(0, 2, winTempl->tilemapLeft, winTempl->tilemapTop - 1, winTempl->width, 1, pal); + FillBgTilemapBufferRect(0, 3, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop - 1, 1, 1, pal); + FillBgTilemapBufferRect(0, 4, winTempl->tilemapLeft - 1, winTempl->tilemapTop, 1, winTempl->height, pal); + FillBgTilemapBufferRect(0, 6, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop, 1, winTempl->height, pal); + FillBgTilemapBufferRect(0, 7, winTempl->tilemapLeft - 1, winTempl->tilemapTop + winTempl->height, 1, 1, pal); + FillBgTilemapBufferRect(0, 8, winTempl->tilemapLeft, winTempl->tilemapTop + winTempl->height, winTempl->width, 1, pal); + FillBgTilemapBufferRect(0, 9, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop + winTempl->height, 1, 1, pal); +} + +static void sub_8029174(const struct WindowTemplate *winTempl) +{ + u8 pal = 0xB; + + FillBgTilemapBufferRect(0, 10, winTempl->tilemapLeft - 1, winTempl->tilemapTop - 1, 1, 1, pal); + FillBgTilemapBufferRect(0, 11, winTempl->tilemapLeft, winTempl->tilemapTop - 1, winTempl->width, 1, pal); + FillBgTilemapBufferRect(0, 12, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop - 1, 1, 1, pal); + FillBgTilemapBufferRect(0, 13, winTempl->tilemapLeft - 1, winTempl->tilemapTop, 1, winTempl->height, pal); + FillBgTilemapBufferRect(0, 15, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop, 1, winTempl->height, pal); + FillBgTilemapBufferRect(0, 16, winTempl->tilemapLeft - 1, winTempl->tilemapTop + winTempl->height, 1, 1, pal); + FillBgTilemapBufferRect(0, 17, winTempl->tilemapLeft, winTempl->tilemapTop + winTempl->height, winTempl->width, 1, pal); + FillBgTilemapBufferRect(0, 18, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop + winTempl->height, 1, 1, pal); +} + +static void sub_8029274(struct DodrioSubstruct_0160 *ptr) +{ + gUnknown_02022CF8 = ptr; + gUnknown_02022CF8->finished = FALSE; + gUnknown_02022CF8->state = 0; + gUnknown_02022CF8->unk3018 = 0; + gUnknown_02022CF8->unk3020 = 0; + gUnknown_02022CF8->unk3024 = 0; + gUnknown_02022CF8->unk3004 = CreateTask(sub_8029314, 3); + sub_802A72C(sub_8029338); +} + +static void sub_80292D4(void) +{ + FreeAllWindowBuffers(); +} + +// Data used by functions below. +struct WinCoords +{ + u8 left; + u8 top; +}; + +static const u8 gUnknown_082FB380[][3] = +{ + {1, 2, 3}, + {1, 4, 5}, + {1, 8, 9}, + {1, 6, 7}, +}; + +static const struct WinCoords gUnknown_082FB38C[] = {{12, 6}}; +static const struct WinCoords gUnknown_082FB390[] = {{9, 10}, {15, 6}}; +static const struct WinCoords gUnknown_082FB398[] = {{12, 6}, {18, 10}, {6, 10}}; +static const struct WinCoords gUnknown_082FB3A4[] = {{9, 10}, {15, 6}, {21, 10}, {3, 6}}; +static const struct WinCoords gUnknown_082FB3B4[] = {{12, 6}, {18, 10}, {23, 6}, {1, 6}, {6, 10}}; + +static const struct WinCoords *const gUnknown_082FB3C8[] = +{ + gUnknown_082FB38C, + gUnknown_082FB390, + gUnknown_082FB398, + gUnknown_082FB3A4, + gUnknown_082FB3B4, +}; + +static const u8 *const gUnknown_082FB3DC[] = +{ + gText_1Colon, + gText_2Colon, + gText_3Colon, + gText_4Colon, + gText_5Colon, +}; + +static const u16 gUnknown_082FB3F0[] = {92, 132, 172, 212}; +static const u16 gUnknown_082FB3F8[] = {33, 49, 65, 81, 97}; +static const u16 gUnknown_082FB402[] = {17, 33, 49, 65, 81}; + +struct +{ + u8 id; + void (*func)(void); +} const gUnknown_082FB40C[] = +{ + {0, sub_8029338}, + {1, sub_8029440}, + {2, sub_802988C}, + {3, sub_802A010}, + {4, sub_802A380}, + {5, sub_802A454}, + {6, sub_802A534}, + {7, sub_802A588}, + {8, sub_802A6FC}, + {9, nullsub_16}, +}; + +static void sub_80292E0(u8 arg0) +{ + u8 i; + for (i = 0; i < 10; i++) + { + if (gUnknown_082FB40C[i].id == arg0) + sub_802A72C(gUnknown_082FB40C[i].func); + } +} + +static void sub_8029314(u8 taskId) +{ + if (!gUnknown_02022CF8->finished) + sub_802A75C()(); +} + +static void sub_8029338(void) +{ + switch (gUnknown_02022CF8->state) + { + case 0: + sub_802A7A8(); + gUnknown_02022CF8->state++; + break; + case 1: + if (sub_802A8E8() == TRUE) + gUnknown_02022CF8->state++; + break; + case 2: + CopyToBgTilemapBuffer(3, gDodrioBerryBgTilemap1, 0, 0); + CopyToBgTilemapBuffer(1, gDodrioBerryBgTilemap2Left, 0, 0); + CopyToBgTilemapBuffer(2, gDodrioBerryBgTilemap2Right, 0, 0); + CopyBgTilemapBufferToVram(3); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + gUnknown_02022CF8->state++; + break; + case 3: + ShowBg(0); + ShowBg(3); + ShowBg(1); + ShowBg(2); + gUnknown_02022CF8->state++; + break; + case 4: + sub_8028FF8(gSaveBlock2Ptr->optionsWindowFrameType); + sub_802902C(); + gUnknown_02022CF8->state++; + break; + default: + gUnknown_02022CF8->finished = TRUE; + break; + } +} + +static void sub_8029440(void) +{ + u8 i, playersCount, id, colorsId, *name; + u32 left; + struct WindowTemplate window; + const struct WinCoords *ptr; + + switch (gUnknown_02022CF8->state) + { + case 0: + playersCount = sub_8027650(); + ptr = gUnknown_082FB3C8[playersCount - 1]; + window.bg = 0; + window.width = 7; + window.height = 2; + window.paletteNum = 0xD; + window.baseBlock = 0x13; + for (i = 0; i < playersCount; ptr++, i++) + { + colorsId = 0; + id = sub_8027A48(i); + left = (56 - GetStringWidth(1, sub_8027660(id), -1)) / 2u; + window.tilemapLeft = ptr->left; + window.tilemapTop = ptr->top; + gUnknown_02022CF8->unk3008[i] = AddWindow(&window); + ClearWindowTilemap(gUnknown_02022CF8->unk3008[i]); + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[i], PIXEL_FILL(1)); + if (id == GetMultiplayerId()) + colorsId = 2; + name = sub_8027660(id); + AddTextPrinterParameterized3(gUnknown_02022CF8->unk3008[i], 1, left, 1, gUnknown_082FB380[colorsId], -1, name); + CopyWindowToVram(gUnknown_02022CF8->unk3008[i], 2); + window.baseBlock += 0xE; + sub_8029174(&window); + } + gUnknown_02022CF8->state++; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + { + playersCount = sub_8027650(); + for (i = 0; i < playersCount; i++) + PutWindowTilemap(gUnknown_02022CF8->unk3008[i]); + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->state++; + } + break; + default: + if (++gUnknown_02022CF8->state > 180) + { + playersCount = sub_8027650(); + for (i = 0; i < playersCount; i++) + { + ClearWindowTilemap(gUnknown_02022CF8->unk3008[i]); + RemoveWindow(gUnknown_02022CF8->unk3008[i]); + } + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->finished = TRUE; + } + break; + } +} + +static void sub_80296A8(u8 playersCount_) +{ + u8 i, r8 = 0, r6 = 0; + u8 playersCount = playersCount_; // Pointless variable, I know, but it's needed to match. + u8 *name; + u32 x, numWidth; + u8 numString[32]; + u8 array[5] = {0, 1, 2, 3, 4}; + struct DodrioSubstruct_3308 temp, structArray[5]; + + for (i = 0; i < playersCount; i++) + { + array[i] = i; + sub_802793C(&temp, i); + structArray[i] = temp; + } + + if (sub_8027748() != 0) + { + do + { + for (i = 0; i < playersCount; i++) + { + if (structArray[i].unk0 == r8) + { + array[r6] = i; + r6++; + } + } + r8 = r6; + } while (r6 < playersCount); + } + + for (i = 0; i < playersCount; i++) + { + if (structArray[i].unk4 == 0) + structArray[i].unk0 = playersCount - 1; + } + + x = 216 - GetStringWidth(1, gText_SpacePoints, 0); + for (i = 0; i < playersCount; i++) + { + u8 colorsId = 0; + u8 id = array[i]; + u32 points = structArray[id].unk4; + + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gUnknown_082FB3DC[structArray[id].unk0], 8, gUnknown_082FB402[i], -1, NULL); + if (id == GetMultiplayerId()) + colorsId = 2; + name = sub_8027660(id); + AddTextPrinterParameterized3(gUnknown_02022CF8->unk3008[1], 1, 28, gUnknown_082FB402[i], gUnknown_082FB380[colorsId], -1, name); + ConvertIntToDecimalStringN(numString, points, STR_CONV_MODE_LEFT_ALIGN, 7); + numWidth = GetStringWidth(1, numString, -1); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, numString, x - numWidth, gUnknown_082FB402[i], -1, NULL); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_SpacePoints, x, gUnknown_082FB402[i], -1, NULL); + } +} + +static void sub_802988C(void) +{ + u8 i, j, itemGiveRet, playersCount = sub_8027650(); + u8 *name; + u32 strWidth, x; + + switch (gUnknown_02022CF8->state) + { + case 0: + sub_802784C(); + gUnknown_02022CF8->unk301C = 0; + gUnknown_02022CF8->state++; + break; + case 1: + gUnknown_02022CF8->unk3008[0] = AddWindow(&gUnknown_082F7BBC[0]); + gUnknown_02022CF8->unk3008[1] = AddWindow(&gUnknown_082F7BBC[1]); + ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); + ClearWindowTilemap(gUnknown_02022CF8->unk3008[1]); + sub_8029174(&gUnknown_082F7BBC[0]); + sub_8029174(&gUnknown_082F7BBC[1]); + gUnknown_02022CF8->state++; + break; + case 2: + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[0], PIXEL_FILL(1)); + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[1], PIXEL_FILL(1)); + strWidth = GetStringWidth(1, gText_BerryPickingResults, -1); + x = (224 - strWidth) / 2; + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[0], 1, gText_BerryPickingResults, x, 1, -1, NULL); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_10P30P50P50P, 68, 17, -1, NULL); + for (i = 0; i < playersCount; i++) + { + u8 colorsId = 0; + if (i == GetMultiplayerId()) + colorsId = 2; + + name = sub_8027660(i); + AddTextPrinterParameterized3(gUnknown_02022CF8->unk3008[1], 1, 0, gUnknown_082FB3F8[i], gUnknown_082FB380[colorsId], -1, name); + for (j = 0; j < 4; j++) + { + u32 width; + u16 result1 = Min(sub_80276A0(i, j), 9999); + u16 result2 = Min(sub_802778C(j), 9999); + + ConvertIntToDecimalStringN(gStringVar4, result1, STR_CONV_MODE_LEFT_ALIGN, 4); + width = GetStringWidth(1, gStringVar4, -1); + if (result2 == result1 && result2 != 0) + AddTextPrinterParameterized3(gUnknown_02022CF8->unk3008[1], 1, gUnknown_082FB3F0[j] - width, gUnknown_082FB3F8[i], gUnknown_082FB380[1], -1, gStringVar4); + else + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gStringVar4, gUnknown_082FB3F0[j] - width, gUnknown_082FB3F8[i], -1, NULL); + } + } + CopyWindowToVram(gUnknown_02022CF8->unk3008[0], 2); + CopyWindowToVram(gUnknown_02022CF8->unk3008[1], 2); + gUnknown_02022CF8->state++; + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + { + PutWindowTilemap(gUnknown_02022CF8->unk3008[0]); + PutWindowTilemap(gUnknown_02022CF8->unk3008[1]); + } + CopyBgTilemapBufferToVram(0); + sub_8028C30(FALSE); + gUnknown_02022CF8->state++; + break; + case 4: + if (++gUnknown_02022CF8->unk301C >= 30 && gMain.newKeys & A_BUTTON) + { + gUnknown_02022CF8->unk301C = 0; + PlaySE(SE_SELECT); + sub_8028C30(TRUE); + gUnknown_02022CF8->state++; + } + break; + case 5: + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[0], PIXEL_FILL(1)); + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[1], PIXEL_FILL(1)); + strWidth = GetStringWidth(1, gText_AnnouncingRankings, -1); + x = (224 - strWidth) / 2; + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[0], 1, gText_AnnouncingRankings, x, 1, -1, NULL); + gUnknown_02022CF8->state++; + break; + case 6: + sub_80296A8(playersCount); + CopyWindowToVram(gUnknown_02022CF8->unk3008[0], 2); + CopyWindowToVram(gUnknown_02022CF8->unk3008[1], 2); + gUnknown_02022CF8->state++; + break; + case 7: + if (!IsDma3ManagerBusyWithBgCopy()) + { + PutWindowTilemap(gUnknown_02022CF8->unk3008[0]); + PutWindowTilemap(gUnknown_02022CF8->unk3008[1]); + } + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->state++; + break; + case 8: + if (++gUnknown_02022CF8->unk301C >= 30 && gMain.newKeys & A_BUTTON) + { + gUnknown_02022CF8->unk301C = 0; + PlaySE(SE_SELECT); + if (sub_8027748() < 3000) + { + gUnknown_02022CF8->state = 127; + } + else + { + StopMapMusic(); + gUnknown_02022CF8->state++; + } + + FillBgTilemapBufferRect_Palette0(0, 0, 0, 5, 30, 15); + RemoveWindow(gUnknown_02022CF8->unk3008[1]); + gUnknown_02022CF8->unk3008[1] = AddWindow(&gUnknown_082F7BCC); + ClearWindowTilemap(gUnknown_02022CF8->unk3008[1]); + sub_8029174(&gUnknown_082F7BCC); + } + break; + case 9: + PlayNewMapMusic(MUS_FANFA1); + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[0], PIXEL_FILL(1)); + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[1], PIXEL_FILL(1)); + strWidth = GetStringWidth(1, gText_AnnouncingPrizes, -1); + x = (224 - strWidth) / 2; + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[0], 1, gText_AnnouncingPrizes, x, 1, -1, NULL); + DynamicPlaceholderTextUtil_Reset(); + CopyItemName(sub_802762C(), gStringVar1); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1); + DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gText_FirstPlacePrize); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gStringVar4, 0, 1, -1, NULL); + itemGiveRet = sub_80279C8(); + if (itemGiveRet != 0 && itemGiveRet != 3) + { + DynamicPlaceholderTextUtil_Reset(); + CopyItemName(sub_802762C(), gStringVar1); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1); + if (itemGiveRet == 2) + DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gText_CantHoldAnyMore); + else if (itemGiveRet == 1) + DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gText_FilledStorageSpace); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gStringVar4, 0, 41, -1, NULL); + } + CopyWindowToVram(gUnknown_02022CF8->unk3008[0], 2); + CopyWindowToVram(gUnknown_02022CF8->unk3008[1], 2); + gUnknown_02022CF8->state++; + break; + case 10: + if (!IsDma3ManagerBusyWithBgCopy()) + { + PutWindowTilemap(gUnknown_02022CF8->unk3008[0]); + PutWindowTilemap(gUnknown_02022CF8->unk3008[1]); + } + CopyBgTilemapBufferToVram(0); + FadeOutAndFadeInNewMapMusic(MUS_RG_WIN_YASEI, 20, 10); + gUnknown_02022CF8->state++; + break; + case 11: + if (++gUnknown_02022CF8->unk301C >= 30 && gMain.newKeys & A_BUTTON) + { + gUnknown_02022CF8->unk301C = 0; + PlaySE(SE_SELECT); + gUnknown_02022CF8->state++; + } + break; + default: + ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); + ClearWindowTilemap(gUnknown_02022CF8->unk3008[1]); + RemoveWindow(gUnknown_02022CF8->unk3008[0]); + RemoveWindow(gUnknown_02022CF8->unk3008[1]); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->finished = TRUE; + break; + } +} + +static void sub_802A010(void) +{ + u8 y; + + switch (gUnknown_02022CF8->state) + { + case 0: + gUnknown_02022CF8->unk3008[0] = AddWindow(&gUnknown_082F7BD4[0]); + gUnknown_02022CF8->unk3008[1] = AddWindow(&gUnknown_082F7BD4[1]); + ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); + ClearWindowTilemap(gUnknown_02022CF8->unk3008[1]); + sub_8029174(&gUnknown_082F7BD4[0]); + sub_8029074(&gUnknown_082F7BD4[1]); + gUnknown_02022CF8->state++; + gUnknown_02022CF8->unk3020 = 0; + gUnknown_02022CF8->unk3024 = 0; + break; + case 1: + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[0], PIXEL_FILL(1)); + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[1], PIXEL_FILL(1)); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[0], 1, gText_WantToPlayAgain, 0, 5, -1, NULL); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_Yes, 8, 1, -1, NULL); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_No, 8, 17, -1, NULL); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_SelectorArrow2, 0, 1, -1, NULL); + CopyWindowToVram(gUnknown_02022CF8->unk3008[0], 2); + CopyWindowToVram(gUnknown_02022CF8->unk3008[1], 2); + gUnknown_02022CF8->state++; + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + { + PutWindowTilemap(gUnknown_02022CF8->unk3008[0]); + PutWindowTilemap(gUnknown_02022CF8->unk3008[1]); + } + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->state++; + break; + case 3: + y = gUnknown_02022CF8->unk3020; + if (y == 0) + y = 1; + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[1], PIXEL_FILL(1)); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_Yes, 8, 1, -1, NULL); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_No, 8, 17, -1, NULL); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_SelectorArrow2, 0, ((y - 1) * 16) + 1, -1, NULL); + CopyWindowToVram(gUnknown_02022CF8->unk3008[1], 3); + // Increment state only if A or B button have been pressed. + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + if (gUnknown_02022CF8->unk3020 == 0) + gUnknown_02022CF8->unk3020 = 1; + gUnknown_02022CF8->state++; + } + else if (gMain.newKeys & (DPAD_UP | DPAD_DOWN)) + { + PlaySE(SE_SELECT); + switch (gUnknown_02022CF8->unk3020) + { + case 0: + gUnknown_02022CF8->unk3020 = 2; + break; + case 1: + gUnknown_02022CF8->unk3020 = 2; + break; + case 2: + gUnknown_02022CF8->unk3020 = 1; + break; + } + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + gUnknown_02022CF8->unk3020 = 2; + gUnknown_02022CF8->state++; + } + break; + default: + gUnknown_02022CF8->unk3024 = gUnknown_02022CF8->unk3020; + ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); + ClearWindowTilemap(gUnknown_02022CF8->unk3008[1]); + RemoveWindow(gUnknown_02022CF8->unk3008[0]); + RemoveWindow(gUnknown_02022CF8->unk3008[1]); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->finished = TRUE; + break; + } +} + +static void sub_802A380(void) +{ + switch (gUnknown_02022CF8->state) + { + case 0: + DrawDialogueFrame(0, FALSE); + AddTextPrinterParameterized2(0, 1, gText_SavingDontTurnOffPower, 0, NULL, 2, 1, 3); + gUnknown_02022CF8->state++; + break; + case 1: + CopyWindowToVram(0, 3); + gUnknown_02022CF8->state++; + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + { + CreateTask(sub_8153688, 0); + gUnknown_02022CF8->state++; + } + break; + case 3: + if (!FuncIsActiveTask(sub_8153688)) + gUnknown_02022CF8->state++; + break; + default: + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->finished = TRUE; + break; + } +} + +static void sub_802A454(void) +{ + switch (gUnknown_02022CF8->state) + { + case 0: + gUnknown_02022CF8->unk3008[0] = AddWindow(&gUnknown_082F7BEC); + ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); + sub_8029174(&gUnknown_082F7BEC); + gUnknown_02022CF8->state++; + break; + case 1: + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[0], PIXEL_FILL(1)); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[0], 1, gText_CommunicationStandby3, 0, 5, -1, NULL); + CopyWindowToVram(gUnknown_02022CF8->unk3008[0], 2); + gUnknown_02022CF8->state++; + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + PutWindowTilemap(gUnknown_02022CF8->unk3008[0]); + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->state++; + break; + default: + gUnknown_02022CF8->finished = TRUE; + break; + } +} + +static void sub_802A534(void) +{ + ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); + RemoveWindow(gUnknown_02022CF8->unk3008[0]); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->finished = TRUE; +} + +static void sub_802A588(void) +{ + switch (gUnknown_02022CF8->state) + { + case 0: + gUnknown_02022CF8->unk3008[0] = AddWindow(&gUnknown_082F7BE4); + ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); + sub_8029174(&gUnknown_082F7BE4); + gUnknown_02022CF8->state++; + gUnknown_02022CF8->unk301C = 0; + gUnknown_02022CF8->unk3020 = 0; + gUnknown_02022CF8->unk3024 = 0; + break; + case 1: + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[0], PIXEL_FILL(1)); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[0], 1, gText_SomeoneDroppedOut, 0, 5, -1, NULL); + CopyWindowToVram(gUnknown_02022CF8->unk3008[0], 2); + gUnknown_02022CF8->state++; + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + PutWindowTilemap(gUnknown_02022CF8->unk3008[0]); + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->state++; + break; + case 3: + if (++gUnknown_02022CF8->unk301C >= 120) + gUnknown_02022CF8->state++; + break; + default: + gUnknown_02022CF8->unk3024 = 5; + ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); + RemoveWindow(gUnknown_02022CF8->unk3008[0]); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->finished = TRUE; + break; + } +} + +static void sub_802A6FC(void) +{ + DestroyTask(gUnknown_02022CF8->unk3004); + gUnknown_02022CF8->finished = TRUE; +} + +static void nullsub_16(void) +{ + +} + +static void sub_802A72C(void (*func)(void)) +{ + gUnknown_02022CF8->state = 0; + gUnknown_02022CF8->finished = FALSE; + gUnknown_02022CF8->unk3028 = func; +} + +static void (*sub_802A75C(void))(void) +{ + return gUnknown_02022CF8->unk3028; +} + +static bool32 sub_802A770(void) +{ + if (gUnknown_02022CF8->finished == TRUE) + return FALSE; + else + return TRUE; +} + +static u8 sub_802A794(void) +{ + return gUnknown_02022CF8->unk3024; +} + +static void sub_802A7A8(void) +{ + DmaClearLarge16(3, (void *)VRAM, VRAM_SIZE, 0x1000); + DmaClear32(3,(void *)OAM, OAM_SIZE); + DmaClear16(3, (void *)PLTT, PLTT_SIZE); + SetGpuReg(REG_OFFSET_DISPCNT, 0); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_082F7BA4, ARRAY_COUNT(gUnknown_082F7BA4)); + ChangeBgX(0, 0, 0); + ChangeBgY(0, 0, 0); + ChangeBgX(1, 0, 0); + ChangeBgY(1, 0, 0); + ChangeBgX(2, 0, 0); + ChangeBgY(2, 0, 0); + ChangeBgX(3, 0, 0); + ChangeBgY(3, 0, 0); + InitStandardTextBoxWindows(); + sub_8197200(); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); + SetBgTilemapBuffer(3, gUnknown_02022CF8->tilemapBuffers[0]); + SetBgTilemapBuffer(1, gUnknown_02022CF8->tilemapBuffers[1]); + SetBgTilemapBuffer(2, gUnknown_02022CF8->tilemapBuffers[2]); +} + +static bool32 sub_802A8E8(void) +{ + switch (gUnknown_02022CF8->unk3018) + { + case 0: + LoadPalette(gDodrioBerryBgPal1, 0, sizeof(gDodrioBerryBgPal1)); + break; + case 1: + reset_temp_tile_data_buffers(); + break; + case 2: + decompress_and_copy_tile_data_to_vram(3, gDodrioBerryBgGfx1, 0, 0, 0); + break; + case 3: + decompress_and_copy_tile_data_to_vram(1, gDodrioBerryBgGfx2, 0, 0, 0); + break; + case 4: + if (free_temp_tile_data_buffers_if_possible() == TRUE) + return FALSE; + break; + case 5: + LoadPalette(stdpal_get(3), 0xD0, 0x20); + break; + default: + gUnknown_02022CF8->unk3018 = 0; + return TRUE; + } + + gUnknown_02022CF8->unk3018++; + return FALSE; +} diff --git a/src/link_rfu.c b/src/link_rfu.c index f7ffa4aca..1f3ae4f3c 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -2415,7 +2415,7 @@ void RecordMixTrainerNames(void) } } } - + // Save the connected trainers first, at the top of the list. nextSpace = 0; for (i = 0; i < GetLinkPlayerCount(); i++) @@ -2446,7 +2446,7 @@ void RecordMixTrainerNames(void) } } } - + // Finalize the new list, and clean up. memcpy(gSaveBlock1Ptr->trainerNameRecords, newRecords, 20 * sizeof(struct TrainerNameRecord)); free(newRecords); @@ -3495,7 +3495,7 @@ void sub_800FD14(u16 command) } } -void sub_800FE50(u16 *a0) +void sub_800FE50(void *a0) { if (gSendCmd[0] == 0 && !sub_8011A80()) { diff --git a/src/union_room.c b/src/union_room.c index 486771af7..01288c8cc 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -1,53 +1,54 @@ #include "global.h" -#include "window.h" +#include "alloc.h" +#include "battle.h" +#include "berry_crush.h" #include "bg.h" -#include "random.h" -#include "string_util.h" -#include "task.h" +#include "cable_club.h" +#include "data.h" +#include "decompress.h" +#include "dodrio_berry_picking.h" +#include "dynamic_placeholder_text_util.h" +#include "easy_chat.h" #include "event_data.h" +#include "event_obj_lock.h" +#include "field_control_avatar.h" +#include "field_player_avatar.h" +#include "field_screen_effect.h" +#include "field_weather.h" +#include "international_string_util.h" +#include "librfu.h" #include "link.h" #include "link_rfu.h" -#include "librfu.h" -#include "alloc.h" -#include "menu.h" #include "list_menu.h" +#include "load_save.h" +#include "menu.h" #include "menu_helpers.h" +#include "mevent.h" +#include "mystery_gift.h" +#include "overworld.h" +#include "palette.h" +#include "party_menu.h" +#include "pokemon_jump.h" +#include "random.h" #include "script.h" +#include "script_pokemon_util_80F87D8.h" #include "sound.h" -#include "constants/songs.h" -#include "constants/game_stat.h" -#include "constants/maps.h" -#include "constants/species.h" -#include "constants/rgb.h" -#include "constants/battle_frontier.h" +#include "start_menu.h" +#include "string_util.h" +#include "strings.h" +#include "task.h" #include "trade.h" #include "trainer_card.h" -#include "overworld.h" -#include "battle.h" -#include "load_save.h" -#include "cable_club.h" -#include "field_control_avatar.h" -#include "party_menu.h" -#include "field_weather.h" -#include "palette.h" -#include "decompress.h" -#include "start_menu.h" -#include "data.h" -#include "field_screen_effect.h" -#include "script_pokemon_util_80F87D8.h" -#include "international_string_util.h" -#include "field_player_avatar.h" -#include "strings.h" -#include "mevent.h" -#include "dynamic_placeholder_text_util.h" #include "union_room.h" -#include "easy_chat.h" -#include "event_obj_lock.h" #include "union_room_chat.h" -#include "berry_crush.h" -#include "mystery_gift.h" #include "union_room_player_avatar.h" -#include "pokemon_jump.h" +#include "window.h" +#include "constants/battle_frontier.h" +#include "constants/game_stat.h" +#include "constants/maps.h" +#include "constants/rgb.h" +#include "constants/songs.h" +#include "constants/species.h" EWRAM_DATA u8 gUnknown_02022C20[12] = {}; EWRAM_DATA u8 gUnknown_02022C2C = 0; @@ -98,7 +99,6 @@ bool32 sub_8017678(struct UnkStruct_Shared *arg0, struct UnkStruct_Shared *arg1) u32 sub_8018120(struct TradeUnkStruct *arg0, u8 multiplayerId); void sub_801807C(struct TradeUnkStruct *arg0); void sub_801AC54(void); -void sub_802493C(u8 monId, MainCallback callback); void sub_80149D8(void); void MG_DrawTextBorder(u8 windowId); s8 mevent_message_print_and_prompt_yes_no(u8 *textState, u8 *arg1, u8 arg2, const u8 *str);