From 02cadbee60c7b1a4806f790416a21619391fef15 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Thu, 1 Aug 2019 19:01:50 +0200 Subject: [PATCH] MORE DODRIO BERRY PICKINGgit status! --- asm/dodrio_berry_picking.s | 5226 +---------------------------------- data/dodrio_berry_picking.s | 558 ---- include/link_rfu.h | 2 +- include/strings.h | 6 + src/dodrio_berry_picking.c | 3012 ++++++++++++++++++-- src/link_rfu.c | 6 +- 6 files changed, 2837 insertions(+), 5973 deletions(-) diff --git a/asm/dodrio_berry_picking.s b/asm/dodrio_berry_picking.s index 4b88f6c99..5445da44b 100755 --- a/asm/dodrio_berry_picking.s +++ b/asm/dodrio_berry_picking.s @@ -8,5226 +8,6 @@ - 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 @@ -5649,14 +429,14 @@ _08029A36: lsls r0, 16 lsrs r0, 16 ldr r1, =0x0000270f - bl sub_8027A38 + bl Min adds r4, r0, 0 lsls r4, 16 lsrs r4, 16 adds r0, r7, 0 bl sub_802778C ldr r1, =0x0000270f - bl sub_8027A38 + bl Min lsls r0, 16 lsrs r6, r0, 16 mov r0, r10 @@ -5689,7 +469,7 @@ _08029A36: ldr r1, =gUnknown_082FB3F8 add r1, r8 ldrb r3, [r1] - ldr r1, =gUnknown_082FB383 + ldr r1, =gUnknown_082FB380 + 3 str r1, [sp] movs r1, 0x1 negs r1, r1 diff --git a/data/dodrio_berry_picking.s b/data/dodrio_berry_picking.s index afb757c81..64fabcff3 100755 --- a/data/dodrio_berry_picking.s +++ b/data/dodrio_berry_picking.s @@ -5,564 +5,6 @@ - - .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 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/strings.h b/include/strings.h index a959821d4..dfec425d5 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2723,4 +2723,10 @@ extern const u8 gText_NumberOfBattles[]; extern const u8 gText_Unknown[]; extern const u8 gText_TrainerCloseBy[]; +// Dodrio Berry Picking +extern const u8 gText_BerryPickingRecords[]; +extern const u8 gText_BerriesPicked[]; +extern const u8 gText_BerriesInRowFivePlayers[]; +extern const u8 gText_BestScore[]; + #endif // GUARD_STRINGS_H diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c index ceb2a6f9b..9fec2b35d 100644 --- a/src/dodrio_berry_picking.c +++ b/src/dodrio_berry_picking.c @@ -2,59 +2,92 @@ #include "alloc.h" #include "palette.h" #include "window.h" +#include "text_window.h" #include "bg.h" #include "gpu_regs.h" +#include "event_data.h" #include "random.h" +#include "item.h" #include "link.h" #include "link_rfu.h" +#include "strings.h" +#include "script.h" +#include "international_string_util.h" #include "task.h" +#include "string_util.h" #include "main.h" #include "constants/songs.h" +#include "constants/items.h" +#include "constants/species.h" #include "sound.h" #include "m4a.h" #include "pokemon_jump.h" -struct DodrioBerryPickingSubstruct_0160 +struct DodrioSubstruct_0160 { - /*0x0000 : 0x0160*/ u8 filler_000[12]; + /*0x0000 : 0x0160*/ u8 fill0[3]; + /*0x0004 : 0x0164*/ u8 fill2; + /*0x0005 : 0x0165*/ u8 fill1[0xc-5]; /*0x000C : 0x016C*/ u8 unkC; /*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]; + /*0x3000 : 0x3160*/ u32 unk3000; + /*0x3004 : 0x3164*/ u8 unk3004; + /*0x3008 : 0x3168*/ u8 ALIGNED(4) unk3008[5]; + /*0x300D : 0x316D*/ u8 fill6[0x3014 - 0x300d]; + /*0x3014 : 0x3174*/ u8 unk3014; + /*0x3018 : 0x3178*/ u8 ALIGNED(4) unk3018; + /*0x301C : 0x317C*/ u8 ALIGNED(4) unk301C; + /*0x3020 : 0x3180*/ u8 ALIGNED(4) unk3020; + /*0x3024 : 0x3184*/ u8 ALIGNED(4) unk3024; + /*0x3025 : 0x3185*/ u8 filler_3025[0x318C - 0x3185]; }; // 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 +// Possibly an array[4]? +struct DodrioSubstruct_31A0_2C { - u8 unk[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 fill0[3]; + u8 unk4; + u8 fill1[3]; + u8 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 unk04; @@ -112,7 +145,7 @@ struct DodrioBerryPickingStruct /*0x00F4*/ u8 unkF4[11][2]; /*0x010A*/ u8 filler_010A[2]; /*0x010C*/ u8 unk10C[5]; - /*0x0111*/ u8 filler_0111[3]; + /*0x0112*/ u16 unk112; /*0x0114*/ u16 unk114; // align 2 /*0x0118*/ u32 unk118; @@ -131,25 +164,25 @@ struct DodrioBerryPickingStruct /*0x0154*/ u8 unk154; /*0x0155*/ u8 filler_0155[3]; /*0x0158*/ u8 unk158[5]; - /*0x0160*/ struct DodrioBerryPickingSubstruct_0160 unk160; - /*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]; + /*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 struct DodrioStruct * 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 struct DodrioStruct_2022CF4 * gUnknown_02022CF4 = NULL; +EWRAM_DATA struct DodrioSubstruct_0160 * gUnknown_02022CF8 = NULL; static bool32 gUnknown_03000DB0; void sub_8024A1C(void); -void sub_8024A30(struct DodrioBerryPickingStruct *); +void sub_8024A30(struct DodrioStruct *); void sub_8024BC8(u8 taskId); void sub_8024DBC(void); void sub_8024E00(void); @@ -176,7 +209,7 @@ 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_80261F8(struct DodrioSubstruct_318C *, struct Pokemon *); void sub_802620C(TaskFunc, u8); void sub_802621C(TaskFunc); void sub_8026240(u8); @@ -195,7 +228,7 @@ 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_8027234(bool32 arg0); void sub_80272A4(void); void sub_80272E8(void); void sub_80273F0(void); @@ -204,22 +237,22 @@ 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_8027DD0(u32 arg0); +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); +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); void sub_80282EC(u8); -u32 sub_8028318(u8, u8 *); -void sub_8028350(u8); -bool32 sub_8028374(u8); +u32 sub_8028318(u32 arg0, u8 *arg1); +void sub_8028350(u32 arg0); +u32 sub_8028374(u32 arg0); void sub_80283A8(void); -void sub_8028408(struct DodrioBerryPickingSubstruct_318C *, u8, u8, u8); +void sub_8028408(struct DodrioSubstruct_318C *arg0, u8 arg1, u8 id, u8 arg3); void sub_80284CC(u8); void sub_8028504(u8); -void sub_8028614(u8); -void sub_802868C(u8, u8); +void sub_8028614(u8 count); +void sub_802868C(bool8 invisible, u8 count); void sub_8028734(void); void sub_80287E4(void); -void sub_80289E8(u8); +void sub_80289E8(bool8 invisible); void sub_80286E4(void); bool32 sub_8028828(void); void sub_8028A34(void); @@ -229,20 +262,40 @@ void sub_8028D44(void); void sub_8028DFC(void); void sub_8028E4C(void); void sub_8028E84(void); -void sub_8028EC8(u8); +void sub_8028EC8(bool8 invisible); void sub_8028FCC(void); void sub_802903C(void); -void sub_8029274(struct DodrioBerryPickingSubstruct_0160 *); +void sub_8029274(struct DodrioSubstruct_0160 *PTR); void sub_80292E0(u8); bool32 sub_802A770(void); u8 sub_802A794(void); +void sub_8028BF8(u8 id, bool8 invisible); +void sub_8028C30(bool8 invisible); +void sub_8028CA4(u16 id, u8 frameNum); +void sub_8028C7C(u8 id, u8 y); +void sub_80286B4(u8 id, u8 frameNum); +u8 sub_8026E70(u8 arg0, u8 arg1); +void sub_80288D4(u8 arg0); +u32 sub_8027DFC(u32 arg0); +u32 IncrementWithLimit(u32 arg0, u32 arg1); +u32 Min(u32 arg0, u32 arg1); +u32 sub_80276C0(u8 arg0); +void sub_8027ACC(u8 taskId); +void sub_8029314(u8 taskId); +void sub_8027BEC(u8 windowId, s32 width); +void nullsub_15(struct Sprite *sprite); +void sub_80284A8(struct Sprite *sprite); +u32 sub_802853C(struct Sprite *sprite); +u32 sub_80285AC(struct Sprite *sprite); +s16 sub_8028F14(u8 arg0, u8 arg1); +void sub_8028654(bool8 invisible, u8 id); +void sub_8029338(void); +bool32 sub_802A8E8(void); +void sub_802A7A8(void); +void sub_802A72C(void (*func)(void)); +void (*sub_802A75C(void))(void); -extern const u8 gUnknown_082F7A88[][3]; -extern const u8 gUnknown_082F7A94[]; -extern const u8 gUnknown_082F7A9C[]; -extern void (*const gUnknown_082F7AC4[])(void); -extern void (*const gUnknown_082F7AF4[])(void); - +// const rom data const u8 gUnknown_082F449C[5][5][11] = { { @@ -301,29 +354,124 @@ const u8 gUknnown_082F45AF[5][5][3] = }, }; -const u8 gToFix[] = +const u8 gUnknown_082F45FA[5][5][3] = { - 0x01, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x02, 0x01, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x01, 0x00, 0x01, 0x02, 0x01, 0x02, - 0x03, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, - 0x00, 0x01, 0x00, 0x01, 0x02, 0x01, 0x02, 0x03, - 0x02, 0x03, 0x04, 0x03, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x09, 0x09, 0x09, 0x09, 0x01, 0x01, 0x01, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x00, - 0x00, 0x01, 0x01, 0x00, 0x09, 0x09, 0x09, 0x09, - 0x09, 0x02, 0x02, 0x00, 0x00, 0x01, 0x01, 0x01, - 0x09, 0x09, 0x09, 0x03, 0x03, 0x00, 0x00, 0x01, - 0x01, 0x02, 0x02, 0x03, 0x09, 0x03, 0x03, 0x04, - 0x04, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, - 0x05, 0x00, 0x00, 0x00, 0x00, 0x04, 0x06, 0x00, - 0x00, 0x00, 0x03, 0x05, 0x07, 0x00, 0x00, 0x02, - 0x04, 0x06, 0x08, 0x00, 0x01, 0x03, 0x05, 0x06, - 0x09 + { + {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) +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}, +}; + +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. +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"); + + +const u8 gUnknown_082F7A88[][3] = +{ + {40, 24, 13}, + {32, 19, 10}, + {22, 13, 7}, +}; + +ALIGNED(4) +const u8 gUnknown_082F7A94[] = {8, 5, 8, 11, 15}; + +ALIGNED(4) +const u8 gUnknown_082F7A9C[] = {5, 10, 20, 30, 50, 70, 100}; + +ALIGNED(4) +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}, +}; + +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 +}; + +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 @@ -337,8 +485,8 @@ void sub_802493C(u16 a0, void (*a1)(void)) sub_8024A30(gUnknown_02022C98); gUnknown_02022C98->savedCallback = a1; 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(); @@ -360,7 +508,7 @@ void sub_8024A1C(void) FreeAllSpritePalettes(); } -void sub_8024A30(struct DodrioBerryPickingStruct * data) +void sub_8024A30(struct DodrioStruct * data) { u8 i; @@ -455,9 +603,9 @@ void sub_8024BC8(u8 taskId) sub_80283A8(); for (r4 = 0; r4 < r5; r4++) { - sub_8028408(&gUnknown_02022C98->unk_318C[gUnknown_02022C98->unk34[r4]], r4, gUnknown_02022C98->unk34[r4], gUnknown_02022C98->unk24); + sub_8028408(&gUnknown_02022C98->unk318C[gUnknown_02022C98->unk34[r4]], r4, gUnknown_02022C98->unk34[r4], gUnknown_02022C98->unk24); } - sub_802868C(0, gUnknown_02022C98->unk24); + sub_802868C(FALSE, gUnknown_02022C98->unk24); gUnknown_02022C98->unk0C++; break; case 5: @@ -491,7 +639,7 @@ void sub_8024D4C(u8 taskId) { sub_8025D04(); gUnknown_082F7AC4[gUnknown_02022C98->unk18](); - if (gUnknown_03000DB0 == FALSE) + if (!gUnknown_03000DB0) { sub_8026AF4(); } @@ -502,7 +650,7 @@ void sub_8024D84(u8 taskId) { sub_8025E0C(); gUnknown_082F7AF4[gUnknown_02022C98->unk18](); - if (gUnknown_03000DB0 == FALSE) + if (!gUnknown_03000DB0) { sub_8026B28(); } @@ -601,31 +749,31 @@ void sub_8024F38(void) { 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); } } } @@ -644,28 +792,28 @@ void sub_8024FFC(void) { 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 @@ -808,9 +956,9 @@ void sub_8025324(void) { case 0: sub_802749C(); - sub_80289E8(1); + sub_80289E8(TRUE); sub_8028DFC(); - sub_8028EC8(1); + sub_8028EC8(TRUE); sub_80292E0(2); gUnknown_02022C98->unk10++; break; @@ -1077,7 +1225,7 @@ void sub_8025758(void) gUnknown_02022C98->unk24 = 1; } sub_80273F0(); - sub_8028EC8(0); + sub_8028EC8(FALSE); break; } } @@ -1097,7 +1245,7 @@ void sub_802589C(u8 taskId) gUnknown_02022C98->unk10++; break; case 2: - if (sub_8028828() == 1) + if (sub_8028828() == TRUE) { gUnknown_02022C98->unk10++; } @@ -1124,7 +1272,7 @@ 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->unk08 = 0; data[0]++; @@ -1141,7 +1289,7 @@ void sub_8025910(u8 taskId) { for (i = 0; i < gUnknown_02022C98->unk24; i++) { - *(u8 *)&gUnknown_02022C98->unk_318C[i] = *(u8 *)gBlockRecvBuffer[i]; + *(u8 *)&gUnknown_02022C98->unk318C[i] = *(u8 *)gBlockRecvBuffer[i]; gUnknown_02022C98->unk08 = gUnknown_02022C98->unk24; } } @@ -1160,15 +1308,15 @@ void sub_80259FC(void) u8 i; 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->unk40, &gUnknown_02022C98->unk120, &gUnknown_02022C98->unk12C); + 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->unkA8[i] == 0 - && sub_8028318(i, &gUnknown_02022C98->unk_31A0[i].unk_2C) == 0) + && sub_8028318(i, &gUnknown_02022C98->unk31A0[i].unk2C.unk0) == 0) { - gUnknown_02022C98->unk_31A0[i].unk_2C = 0; + gUnknown_02022C98->unk31A0[i].unk2C.unk0 = 0; gUnknown_02022C98->unk128 = 0; } } @@ -1188,7 +1336,7 @@ void sub_80259FC(void) for (i = 0; i < r7; i++) { - if ( gUnknown_02022C98->unk_31A0[i].unk_2C != 0 + if ( gUnknown_02022C98->unk31A0[i].unk2C.unk0 != 0 && gUnknown_02022C98->unkA8[i] == 0) { gUnknown_02022C98->unkA8[i] = 1; @@ -1203,9 +1351,9 @@ void sub_80259FC(void) { gUnknown_02022C98->unkB0[i] = 0; gUnknown_02022C98->unkA8[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->unk31A0[i].unk2C.unk0 = 0; + gUnknown_02022C98->unk31A0[i].unk2C.unk4 = 0; + gUnknown_02022C98->unk31A0[i].unk2C.unk8 = 0; } break; case 4: @@ -1213,9 +1361,9 @@ void sub_80259FC(void) { gUnknown_02022C98->unkB0[i] = 0; gUnknown_02022C98->unkA8[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->unk31A0[i].unk2C.unk0 = 0; + gUnknown_02022C98->unk31A0[i].unk2C.unk4 = 0; + gUnknown_02022C98->unk31A0[i].unk2C.unk8 = 0; } break; } @@ -1227,7 +1375,7 @@ void sub_8025C0C(void) u8 i; 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->unk40, &gUnknown_02022C98->unk120, &gUnknown_02022C98->unk12C); + 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++) @@ -1278,10 +1426,10 @@ void sub_8025D50(void) 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->unk40, gUnknown_02022C98->unk120, gUnknown_02022C98->unk12C); + 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->unk40, gUnknown_02022C98->unk120, gUnknown_02022C98->unk12C); + 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; } } @@ -1291,10 +1439,10 @@ void sub_8025E0C(void) 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->unk40, &gUnknown_02022C98->unk120, &gUnknown_02022C98->unk12C); + 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->unk40, &gUnknown_02022C98->unk120, &gUnknown_02022C98->unk12C); + 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; } } @@ -1308,9 +1456,9 @@ void sub_8025ED8(void) 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: @@ -1324,14 +1472,14 @@ void sub_8025ED8(void) 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->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->unk144 == 0) { @@ -1340,7 +1488,7 @@ void sub_8025F48(void) 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->unk144 == 0 && !IsSEPlaying()) { @@ -1367,14 +1515,14 @@ void sub_8026044(void) 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->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->unk144 == 0) { @@ -1383,7 +1531,7 @@ void sub_8026044(void) 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->unk144 == 0 && !IsSEPlaying()) { @@ -1394,12 +1542,12 @@ void sub_8026044(void) } 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->unk148[r4] == 0) { - PlaySE(SE_FUUSEN1 + ptr->unk_0[r4]); + PlaySE(SE_FUUSEN1 + ptr->unk0[r4]); gUnknown_02022C98->unk148[r4] = 1; } } @@ -1435,7 +1583,7 @@ void sub_80261E4(void) ProcessSpriteCopyRequests(); } -void sub_80261F8(struct DodrioBerryPickingSubstruct_318C * a0, struct Pokemon * a1) +void sub_80261F8(struct DodrioSubstruct_318C * a0, struct Pokemon * a1) { a0->isShiny = IsMonShiny(a1); } @@ -1492,9 +1640,9 @@ void sub_80262C0(void) 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; } } @@ -1517,7 +1665,7 @@ void sub_8026324(void) for (i = 0; i < sp8; i++) { - u8 *ptr = &gUnknown_02022C98->unk_31A0[i].unk_2C; + u8 *ptr = &gUnknown_02022C98->unk31A0[i].unk2C.unk0; if (*ptr != 0 && gUnknown_02022C98->unkA8[i] == 1) { for (j = sp0; j < sp4; j++) @@ -1541,7 +1689,7 @@ void sub_8026324(void) } break; } - if (gUnknown_02022C98->unk_31A0[i].unk_34 == 1) + if (gUnknown_02022C98->unk31A0[i].unk2C.unk8 == 1) break; } } @@ -1557,7 +1705,7 @@ void sub_8026324(void) if (r3 < 2) r3 = 2; - r2 = gUnknown_082F7A88[r3][gUnknown_02022C98->unk_31A0[0].unk_14.unk_0[r5]] - gUnknown_02022C98->unkD0[r5]; + r2 = gUnknown_082F7A88[r3][gUnknown_02022C98->unk31A0[0].unk14.unk0[r5]] - gUnknown_02022C98->unkD0[r5]; if (r2 < 6) gUnknown_02022C98->unk9C[r5] += r2; @@ -1587,18 +1735,18 @@ void sub_8026324(void) i = r7_2; } } - gUnknown_02022C98->unk_32CC.unk_14.unk_B[r5] = 7; + gUnknown_02022C98->unk32CC.unk14.unkB[r5] = 7; gUnknown_02022C98->unkC4[r5] = 2; gUnknown_02022C98->unkA8[r4] = 3; gUnknown_02022C98->unkB8[r5] = r4; - gUnknown_02022C98->unk_31A0[r4].unk_30 = 1; - gUnknown_02022C98->unk_31A0[i].unk_34 = 1; + gUnknown_02022C98->unk31A0[r4].unk30 = 1; + gUnknown_02022C98->unk31A0[i].unk2C.unk8 = 1; gUnknown_02022C98->unk86[r4]++; sub_8026F1C(0, r5, r4); - sub_8027234(1); + sub_8027234(TRUE); sub_8026D1C(r4); - gUnknown_02022C98->unkE8[r5] = gUnknown_02022C98->unk_32CC.unk_14.unk_0[r5]; - gUnknown_02022C98->unk_32CC.unk_14.unk_0[r5] = 3; + 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; } @@ -1999,7 +2147,7 @@ bool32 sub_8026634(u8 a0, u8 a1, u8 a2) { s32 r7 = 0; u8 r5 = gUnknown_02022C98->unk24 - 1; - struct DodrioBerryPickingSubstruct_31A0_14 * ptr = &gUnknown_02022C98->unk_32CC.unk_14; + struct DodrioSubstruct_31A0_14 * ptr = &gUnknown_02022C98->unk32CC.unk14; switch (a1) { @@ -2014,13 +2162,13 @@ bool32 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[r5][a0][r7]) { 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 @@ -2034,7 +2182,7 @@ bool32 sub_8026634(u8 a0, u8 a1, u8 a2) if (a2 == gUknnown_082F45AF[r5][a0][r7]) { gUnknown_02022C98->unkA8[a0] = 4; - gUnknown_02022C98->unk_31A0[a0].unk_34 = 1; + gUnknown_02022C98->unk31A0[a0].unk2C.unk8 = 1; } } return FALSE; @@ -2048,7 +2196,7 @@ void sub_802671C(void) u8 r10 = 0; u8 i; u8 r2; - struct DodrioBerryPickingStruct *ptr; + struct DodrioStruct *ptr; gUnknown_02022C98->unk120 = 0; @@ -2059,14 +2207,14 @@ void sub_802671C(void) if (gUnknown_02022C98->unkC4[i] == 0 || gUnknown_02022C98->unkC4[i] == 1) { gUnknown_02022C98->unk120 = 1; - if (ptr->unk_32CC.unk_14.unk_B[i] >= 10) + if (ptr->unk32CC.unk14.unkB[i] >= 10) { - ptr->unk_32CC.unk_14.unk_B[i] = 10; + ptr->unk32CC.unk14.unkB[i] = 10; gUnknown_02022C98->unkC4[i] = 3; if (gUnknown_02022C98->unk148[i] == 0) { gUnknown_02022C98->unk148[i] = 1; - PlaySE(SE_FUUSEN1 + ptr->unk_32CC.unk_14.unk_0[i]); + PlaySE(SE_FUUSEN1 + ptr->unk32CC.unk14.unk0[i]); } if (gUnknown_02022C98->unk40 < 10 || r10 == 1) { @@ -2077,7 +2225,7 @@ void sub_802671C(void) gUnknown_02022C98->unk40++; } sub_8026F1C(3, i, 0); - sub_8027234(0); + sub_8027234(FALSE); } } else @@ -2087,10 +2235,10 @@ void sub_802671C(void) { r3 = 2; } - r2 = gUnknown_082F7A88[r3][ptr->unk_32CC.unk_14.unk_0[i]]; + r2 = gUnknown_082F7A88[r3][ptr->unk32CC.unk14.unk0[i]]; if (++gUnknown_02022C98->unkD0[i] >= r2) { - ptr->unk_32CC.unk_14.unk_B[i]++; + ptr->unk32CC.unk14.unkB[i]++; gUnknown_02022C98->unkD0[i] = 0; } sub_8026324(); @@ -2101,12 +2249,12 @@ void sub_802671C(void) gUnknown_02022C98->unk120 = 1; if (++gUnknown_02022C98->unkDC[i] >= 20) { - gUnknown_02022C98->unk_31A0[gUnknown_02022C98->unkB8[i]].unk_30 = 0; + 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->unk_32CC.unk_14.unk_B[i] = 1; - ptr->unk_32CC.unk_14.unk_0[i] = sub_8026DB0(sub_8026D8C(i), i); + ptr->unk32CC.unk14.unkB[i] = 1; + ptr->unk32CC.unk14.unk0[i] = sub_8026DB0(sub_8026D8C(i), i); } } else if (gUnknown_02022C98->unkC4[i] == 3) @@ -2118,22 +2266,15 @@ void sub_802671C(void) gUnknown_02022C98->unkDC[i] = 0; gUnknown_02022C98->unkD0[i] = 0; gUnknown_02022C98->unkC4[i] = 0; - ptr->unk_32CC.unk_14.unk_B[i] = 1; - gUnknown_02022C98->unkE8[i] = ptr->unk_32CC.unk_14.unk_0[i]; - ptr->unk_32CC.unk_14.unk_0[i] = sub_8026DB0(sub_8026D8C(i), i); + 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); } } } } } -void sub_8028BF8(u8 arg0, u8 arg1); -void sub_8028CA4(u8 arg0, u8 arg1); -void sub_8028C7C(u8 arg0, u8 arg1); -void sub_80286B4(u8 arg0, u8 arg1); -void sub_80288D4(u8 arg0); -u8 sub_8027DFC(u32 arg0); - void sub_8026988(void) { u8 i, first, count; @@ -2142,29 +2283,29 @@ void sub_8026988(void) count = gUnknown_02022C98->unk48; for (i = first; i < count; i++) { - struct DodrioBerryPickingSubstruct_31A0 *ptr = &gUnknown_02022C98->unk_31A0[gUnknown_02022C98->multiplayerId]; + struct DodrioSubstruct_31A0 *ptr = &gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId]; u8 var = gUnknown_082F449C[gUnknown_02022C98->unk24 - 1][gUnknown_02022C98->multiplayerId][i]; - if (ptr->unk_14.unk_B[var] != 0) - sub_8028BF8(i, 0); + if (ptr->unk14.unkB[var] != 0) + sub_8028BF8(i, FALSE); else - sub_8028BF8(i, 1); + sub_8028BF8(i, TRUE); - if (ptr->unk_14.unk_B[var] > 9) + if (ptr->unk14.unkB[var] > 9) { - sub_8028CA4(i, ptr->unk_14.unk_0[var] + 3); - sub_8028C7C(i, ptr->unk_14.unk_B[var] * 2 - 1); + sub_8028CA4(i, ptr->unk14.unk0[var] + 3); + sub_8028C7C(i, ptr->unk14.unkB[var] * 2 - 1); } - else if (ptr->unk_14.unk_0[var] == 3) + else if (ptr->unk14.unk0[var] == 3) { - ptr->unk_14.unk_B[var] = 7; + ptr->unk14.unkB[var] = 7; sub_8028CA4(i, 6); - sub_8028C7C(i, ptr->unk_14.unk_B[var] * 2 - 1); + sub_8028C7C(i, ptr->unk14.unkB[var] * 2 - 1); } else { - sub_8028CA4(i, ptr->unk_14.unk_0[var]); - sub_8028C7C(i, ptr->unk_14.unk_B[var] * 2); + sub_8028CA4(i, ptr->unk14.unk0[var]); + sub_8028C7C(i, ptr->unk14.unkB[var] * 2); } } } @@ -2176,8 +2317,8 @@ void sub_8026A88(void) count = gUnknown_02022C98->unk24; for (i = 0; i < count; i++) { - struct DodrioBerryPickingSubstruct_31A0 *ptr = &gUnknown_02022C98->unk_31A0[i]; - sub_80286B4(i, ptr->unk_2C); + struct DodrioSubstruct_31A0 *ptr = &gUnknown_02022C98->unk31A0[i]; + sub_80286B4(i, ptr->unk2C.unk0); } } @@ -2291,10 +2432,10 @@ bool32 sub_8026C90(void) { for (i = first; i < count; i++) { - struct DodrioBerryPickingSubstruct_31A0 *ptr = &gUnknown_02022C98->unk_31A0[gUnknown_02022C98->multiplayerId]; + struct DodrioSubstruct_31A0 *ptr = &gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId]; u8 var = gUnknown_082F449C[gUnknown_02022C98->unk24 - 1][gUnknown_02022C98->multiplayerId][i]; - if (ptr->unk_14.unk_B[var] != 10) + if (ptr->unk14.unkB[var] != 10) return FALSE; } return TRUE; @@ -2311,9 +2452,2504 @@ void sub_8026D1C(u8 arg0) gUnknown_02022C98->unk90[arg0]++; } -/* u8 sub_8026D8C(u8 arg0) { - return gUnknown_082F7BA4[0x1AC + (gUnknown_02022C98->unk24 - 1) * 11 + arg0]; + return gUnknown_082F4648[gUnknown_02022C98->unk24 - 1][arg0]; +} + +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); +} + +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; + } +} + +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; +} + +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; + } +} + +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; + } +} + +void sub_80272A4(void) +{ + u8 i; + for (i = 0; i < gUnknown_02022C98->unk24; i++) + gUnknown_02022C98->unk4A[i][5] = gUnknown_02022C98->unk114; +} + +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(); +} + +const s16 gUnknown_082F7B24[] = {10, 30, 50, 50}; + +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]; +} + +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); +} + +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; +} + +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; +} + +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]--; + } +} + +void sub_8027608(void) +{ + gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 0; +} + +u16 sub_802762C(void) +{ + return gUnknown_02022C98->unk4A[gUnknown_02022C98->multiplayerId][4] + FIRST_BERRY_INDEX; +} + +u8 sub_8027650(void) +{ + return gUnknown_02022C98->unk24; +} + +u8 *sub_8027660(u8 id) +{ + if (gReceivedRemoteLinkPlayers) + return gLinkPlayers[id].name; + else + return gUnknown_02022C98->unk31A0[id].name; +} + +u16 sub_80276A0(u8 arg0, u8 arg1) +{ + return gUnknown_02022C98->unk4A[arg0][arg1]; +} + +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; +} + +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); +} + +u16 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; +} + +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]; +} + +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; +} + +void sub_802793C(struct DodrioSubstruct_3308 *dst, u8 id) +{ + *dst = gUnknown_02022C98->unk3308[id]; +} + +// Unused function +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; +} + +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;? +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 +u32 Min(u32 a, u32 b) +{ + if (a < b) + return a; + else + return b; +} + +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. +const struct WindowTemplate gUnknown_082F7B2C = +{ + .bg = 0, + .tilemapLeft = 5, + .tilemapTop = 1, + .width = 20, + .height = 11, + .paletteNum = 15, + .baseBlock = 0x1, +}; + +const u8 *const gUnknown_082F7B34[3] = {gText_BerriesPicked, gText_BestScore, gText_BerriesInRowFivePlayers}; +const u8 gUnknown_082F7B40[] = {4, 7, 4}; + +ALIGNED(4) +const u8 gUnknown_082F7B44[][2] = {{25}, {41}, {57}}; +const u8 gUnknown_082F7B4A[][2] = {{25}, {41}, {73}}; + +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; + } +} + +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? +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}, +}; + +const u8 gUnknown_082F7B78[] = _("あいうえおかき"); +const u8 gUnknown_082F7B80[] = _("ABCDEFG"); +const u8 gUnknown_082F7B88[] = _("0123456"); + +const u8 *const gUnknown_082F7B90[] = +{ + gUnknown_082F7B78, + gUnknown_082F7B78, + gUnknown_082F7B78, + gUnknown_082F7B80, + gUnknown_082F7B88 +}; + +void sub_8027D20(void) +{ + gUnknown_02022C98->unk24 = GetLinkPlayerCount(); +} + +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; +}; + +void sub_8027DD0(u32 arg0) +{ + struct UnkPacket1 packet; + packet.id = 1; + packet.unk4 = arg0; + sub_800FE50(&packet); +} + +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 +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 +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 + +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; +}; + +void sub_80282EC(u8 arg0) +{ + struct UnkPacket3 packet; + packet.id = 3; + packet.unk4 = arg0; + sub_800FE50(&packet); +} + +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; +}; + +void sub_8028350(u32 arg0) +{ + struct UnkPacket4 packet; + packet.id = 4; + packet.unk4 = arg0; + sub_800FE50(&packet); +} + +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 +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. +const u32 sUnused[] = {255, 0}; + +const struct WindowTemplate gUnknown_082F7BBC = +{ + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 28, + .height = 2, + .paletteNum = 13, + .baseBlock = 0x13, +}; +const struct WindowTemplate gUnknown_082F7BC4 = +{ + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 5, + .width = 28, + .height = 14, + .paletteNum = 13, + .baseBlock = 0x4B, +}; +const struct WindowTemplate gUnknown_082F7BCC = +{ + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 5, + .width = 28, + .height = 7, + .paletteNum = 13, + .baseBlock = 0x4B, +}; +const struct WindowTemplate gUnknown_082F7BD4 = +{ + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 8, + .width = 19, + .height = 3, + .paletteNum = 13, + .baseBlock = 0x13, +}; +const struct WindowTemplate gUnknown_082F7BDC = +{ + .bg = 0, + .tilemapLeft = 22, + .tilemapTop = 7, + .width = 6, + .height = 4, + .paletteNum = 13, + .baseBlock = 0x4C, +}; +const struct WindowTemplate gUnknown_082F7BE4 = +{ + .bg = 0, + .tilemapLeft = 4, + .tilemapTop = 6, + .width = 22, + .height = 5, + .paletteNum = 13, + .baseBlock = 0x13, +}; +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. +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 +}; + +const u16 gDodrioBerryBgPal1[] = INCBIN_U16("graphics/link_games/dodrioberry_bg1.gbapal", + "graphics/link_games/dodrioberry_bg2.gbapal"); +const u16 gDodrioBerryPkmnPal[] = INCBIN_U16("graphics/link_games/dodrioberry_pkmn.gbapal"); +const u16 gDodrioBerryShinyPal[] = INCBIN_U16("graphics/link_games/dodrioberry_shiny.gbapal"); +const u16 gDodrioBerryStatusPal[] = INCBIN_U16("graphics/link_games/dodrioberry_status.gbapal"); +const u16 gDodrioBerrySpritesPal[] = INCBIN_U16("graphics/link_games/dodrioberry_berrysprites.gbapal"); +const u32 gDodrioBerrySpritesGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_berrysprites.4bpp.lz"); +const u16 gDodrioBerryPlatformPal[] = INCBIN_U16("graphics/link_games/dodrioberry_platform.gbapal"); +const u32 gDodrioBerryBgGfx1[] = INCBIN_U32("graphics/link_games/dodrioberry_bg1.4bpp.lz"); +const u32 gDodrioBerryBgGfx2[] = INCBIN_U32("graphics/link_games/dodrioberry_bg2.4bpp.lz"); +const u32 gDodrioBerryStatusGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_status.4bpp.lz"); +const u32 gDodrioBerryPlatformGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_platform.4bpp.lz"); +const u32 gDodrioBerryPkmnGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_pkmn.4bpp.lz"); +const u32 gDodrioBerryBgTilemap1[] = INCBIN_U32("graphics/link_games/dodrioberry_bg1.bin.lz"); +const u32 gDodrioBerryBgTilemap2Right[] = INCBIN_U32("graphics/link_games/dodrioberry_bg2right.bin.lz"); +const u32 gDodrioBerryBgTilemap2Left[] = INCBIN_U32("graphics/link_games/dodrioberry_bg2left.bin.lz"); + +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 +}; + +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) +}; + +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) +}; + +const union AnimCmd *const sSpriteAnimTable_82FB2D4[] = +{ + sSpriteAnim_82FB2CC +}; + +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); +} + +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); +} + +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; + } +} + +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; +} + +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; +} + +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; +} + +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; +} + +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. + } +} + +void sub_8028654(bool8 invisible, u8 id) +{ + gSprites[*gUnknown_02022C9C[id]].invisible = invisible; +} + +void sub_802868C(bool8 invisible, u8 count) +{ + u8 i; + for (i = 0; i < count; i++) + sub_8028654(invisible, i); +} + +void sub_80286B4(u8 id, u8 frameNum) +{ + StartSpriteAnim(&gSprites[*gUnknown_02022C9C[id]], frameNum); +} + +void nullsub_15(struct Sprite *sprite) +{ + +} + +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; + } +} + +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); +} + +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); +} + +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; +} + +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); + } +} + +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. +const u8 sUnused2[] = {0xD4, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0xFB, 0x0, 0x0}; + +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); +} + +const s16 gUnknown_082FB31C[] = {88, 128, 168, 208}; + +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); +} + +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]); + } +} + +void sub_8028BF8(u8 id, bool8 invisible) +{ + gSprites[*gUnknown_02022CB8[id]].invisible = invisible; +} + +void sub_8028C30(bool8 invisible) +{ + u8 i; + for (i = 0; i < 4; i++) + gSprites[*gUnknown_02022CE4[i]].invisible = invisible; +} + +void sub_8028C7C(u8 id, u8 y) +{ + gSprites[*gUnknown_02022CB8[id]].pos1.y = y * 8; +} + +void sub_8028CA4(u16 id, u8 frameNum) +{ + StartSpriteAnim(&gSprites[*gUnknown_02022CB8[id]], frameNum); +} + +// Unused +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 + +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; + } + } + } +} + +const s16 gUnknown_082FB356[][2] = {{230, 55}, {30, 74}}; + +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); +} + +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]; + } +} + +void sub_8028E4C(void) +{ + u8 i; + for (i = 0; i < 2; i++) + { + struct Sprite *sprite = &gSprites[*gUnknown_02022CB0[i]]; + sprite->sKeepPosX = FALSE; + } +} + +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]); + } +} + +void sub_8028EC8(bool8 invisible) +{ + u8 i; + for (i = 0; i < 2; i++) + gSprites[*gUnknown_02022CB0[i]].invisible = invisible; +} + +#undef sKeepPosX + +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; +} + +void sub_8028FCC(void) +{ + u8 i; + for (i = 0; i < 11; i++) + { + sub_8028BF8(i, TRUE); + sub_8028C7C(i, 1); + } + sub_80289E8(FALSE); +} + +void sub_8028FF8(u8 frameId) +{ + LoadBgTiles(0, GetWindowFrameTilesPal(frameId)->tiles, 0x120, 1); + LoadPalette(GetWindowFrameTilesPal(frameId)->pal, 0xA0, 0x20); +} + +void sub_802902C(void) +{ + LoadUserWindowBorderGfx_(0, 0xA, 0xB0); +} + +void sub_802903C(void) +{ + gUnknown_02022CF8->unk3000 = 0; + gUnknown_02022CF8->unk3014 = 0; + gUnknown_02022CF8->unk3018 = 0; + gUnknown_02022CF8->unk3020 = 0; + gUnknown_02022CF8->unk3024 = 0; +} + +void sub_8029074(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); +} + +void sub_8029174(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); +} + +void sub_8029274(struct DodrioSubstruct_0160 *ptr) +{ + gUnknown_02022CF8 = ptr; + gUnknown_02022CF8->unk3000 = 0; + gUnknown_02022CF8->unk3014 = 0; + gUnknown_02022CF8->unk3018 = 0; + gUnknown_02022CF8->unk3020 = 0; + gUnknown_02022CF8->unk3024 = 0; + gUnknown_02022CF8->unk3004 = CreateTask(sub_8029314, 3); + sub_802A72C(sub_8029338); +} + +void sub_80292D4(void) +{ + FreeAllWindowBuffers(); +} + +struct +{ + u8 id; + void (*func)(void); +} extern const gUnknown_082FB40C[]; + +// Data used by functions below. +struct WinCoords +{ + u8 left; + u8 top; +}; + +const u8 gUnknown_082FB380[][3] = +{ + {1, 2, 3}, + {1, 4, 5}, + {1, 8, 9}, + {1, 6, 7}, +}; + +const struct WinCoords gUnknown_082FB38C[] = {{12, 6}}; +const struct WinCoords gUnknown_082FB390[] = {{9, 10}, {15, 6}}; +const struct WinCoords gUnknown_082FB398[] = {{12, 6}, {18, 10}, {6, 10}}; +const struct WinCoords gUnknown_082FB3A4[] = {{9, 10}, {15, 6}, {21, 10}, {3, 6}}; +const struct WinCoords gUnknown_082FB3B4[] = {{12, 6}, {18, 10}, {23, 6}, {1, 6}, {6, 10}}; + +const struct WinCoords *const gUnknown_082FB3C8[] = +{ + gUnknown_082FB38C, + gUnknown_082FB390, + gUnknown_082FB398, + gUnknown_082FB3A4, + gUnknown_082FB3B4, +}; + +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); + } +} + +void sub_8029314(u8 taskId) +{ + if (!gUnknown_02022CF8->unk3000) + sub_802A75C()(); +} + +void sub_8029338(void) +{ + switch (gUnknown_02022CF8->unk3014) + { + case 0: + sub_802A7A8(); + gUnknown_02022CF8->unk3014++; + break; + case 1: + if (sub_802A8E8() == TRUE) + gUnknown_02022CF8->unk3014++; + 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->unk3014++; + break; + case 3: + ShowBg(0); + ShowBg(3); + ShowBg(1); + ShowBg(2); + gUnknown_02022CF8->unk3014++; + break; + case 4: + sub_8028FF8(gSaveBlock2Ptr->optionsWindowFrameType); + sub_802902C(); + gUnknown_02022CF8->unk3014++; + break; + default: + gUnknown_02022CF8->unk3000 = 1; + break; + } +} + +void sub_8029440(void) +{ + u8 i, playersCount, id, colorsId, *name; + u32 left; + struct WindowTemplate window; + const struct WinCoords *ptr; + + switch (gUnknown_02022CF8->unk3014) + { + 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->unk3014++; + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + { + playersCount = sub_8027650(); + for (i = 0; i < playersCount; i++) + PutWindowTilemap(gUnknown_02022CF8->unk3008[i]); + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->unk3014++; + } + break; + default: + if (++gUnknown_02022CF8->unk3014 > 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->unk3000 = 1; + } + break; + } } -*/ 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()) {