From 4d2d8779bfb56385b5e35d3010d28a248780f134 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 2 Aug 2019 00:41:55 +0200 Subject: [PATCH] Dodrio berry picking decompiled --- asm/dodrio_berry_picking.s | 2099 -------------------------------- data/dodrio_berry_picking.s | 41 - include/berry_crush.h | 2 + include/dodrio_berry_picking.h | 8 + include/menu.h | 2 +- include/strings.h | 16 + ld_script.txt | 2 - src/dodrio_berry_picking.c | 1482 ++++++++++++++-------- src/union_room.c | 74 +- 9 files changed, 1069 insertions(+), 2657 deletions(-) delete mode 100755 asm/dodrio_berry_picking.s delete mode 100755 data/dodrio_berry_picking.s create mode 100644 include/dodrio_berry_picking.h diff --git a/asm/dodrio_berry_picking.s b/asm/dodrio_berry_picking.s deleted file mode 100755 index 5445da44bd..0000000000 --- a/asm/dodrio_berry_picking.s +++ /dev/null @@ -1,2099 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - - - - thumb_func_start sub_80296A8 -sub_80296A8: @ 80296A8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x6C - lsls r0, 24 - movs r1, 0 - mov r8, r1 - movs r6, 0 - lsrs r7, r0, 24 - add r4, sp, 0x2C - ldr r1, =gUnknown_082FB45C - adds r0, r4, 0 - movs r2, 0x5 - bl memcpy - movs r5, 0 - cmp r5, r7 - bcs _080296F8 - add r4, sp, 0x34 -_080296D2: - mov r0, sp - adds r0, r5 - adds r0, 0x2C - strb r5, [r0] - add r0, sp, 0x5C - adds r1, r5, 0 - bl sub_802793C - lsls r2, r5, 3 - adds r2, r4, r2 - ldr r0, [sp, 0x5C] - ldr r1, [sp, 0x60] - str r0, [r2] - str r1, [r2, 0x4] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, r7 - bcc _080296D2 -_080296F8: - bl sub_8027748 - cmp r0, 0 - beq _0802972E -_08029700: - movs r5, 0 - cmp r5, r7 - bcs _08029728 - add r2, sp, 0x34 - add r1, sp, 0x2C -_0802970A: - lsls r0, r5, 3 - adds r0, r2, r0 - ldrb r0, [r0] - cmp r0, r8 - bne _0802971E - adds r0, r1, r6 - strb r5, [r0] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 -_0802971E: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, r7 - bcc _0802970A -_08029728: - mov r8, r6 - cmp r6, r7 - bcc _08029700 -_0802972E: - movs r5, 0 - ldr r4, =gText_SpacePoints - cmp r5, r7 - bcs _08029754 - add r1, sp, 0x34 - add r6, sp, 0x38 - subs r3, r7, 0x1 -_0802973C: - lsls r2, r5, 3 - adds r0, r6, r2 - ldr r0, [r0] - cmp r0, 0 - bne _0802974A - adds r0, r1, r2 - strb r3, [r0] -_0802974A: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, r7 - bcc _0802973C -_08029754: - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0 - bl GetStringWidth - movs r1, 0xD8 - subs r1, r0 - str r1, [sp, 0x64] - movs r5, 0 - cmp r5, r7 - bcs _08029860 - mov r2, sp - adds r2, 0x34 - str r2, [sp, 0x68] - ldr r3, =0x00003009 - mov r10, r3 -_08029774: - movs r0, 0 - mov r8, r0 - mov r0, sp - adds r0, r5 - adds r0, 0x2C - ldrb r0, [r0] - adds r4, r0, 0 - lsls r1, r4, 3 - add r0, sp, 0x38 - adds r0, r1 - ldr r0, [r0] - mov r9, r0 - ldr r2, =gUnknown_02022CF8 - ldr r0, [r2] - add r0, r10 - ldrb r0, [r0] - ldr r2, =gUnknown_082FB3DC - ldr r3, [sp, 0x68] - adds r1, r3, r1 - ldrb r1, [r1] - lsls r1, 2 - adds r1, r2 - ldr r2, [r1] - ldr r3, =gUnknown_082FB402 - lsls r1, r5, 1 - adds r1, r3 - ldrb r6, [r1] - str r6, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - mov r3, r8 - str r3, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl AddTextPrinterParameterized - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bne _080297CC - movs r0, 0x2 - mov r8, r0 -_080297CC: - adds r0, r4, 0 - bl sub_8027660 - adds r3, r0, 0 - ldr r1, =gUnknown_02022CF8 - ldr r0, [r1] - add r0, r10 - ldrb r0, [r0] - mov r2, r8 - lsls r1, r2, 1 - add r1, r8 - ldr r2, =gUnknown_082FB380 - adds r1, r2 - str r1, [sp] - movs r1, 0x1 - negs r1, r1 - str r1, [sp, 0x4] - str r3, [sp, 0x8] - movs r1, 0x1 - movs r2, 0x1C - adds r3, r6, 0 - bl AddTextPrinterParameterized3 - add r0, sp, 0xC - mov r1, r9 - movs r2, 0 - movs r3, 0x7 - bl ConvertIntToDecimalStringN - movs r0, 0x1 - add r1, sp, 0xC - movs r2, 0x1 - negs r2, r2 - bl GetStringWidth - adds r3, r0, 0 - ldr r2, =gUnknown_02022CF8 - ldr r0, [r2] - add r0, r10 - ldrb r0, [r0] - ldr r1, [sp, 0x64] - subs r3, r1, r3 - lsls r3, 24 - lsrs r3, 24 - str r6, [sp] - movs r2, 0xFF - str r2, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - add r2, sp, 0xC - bl AddTextPrinterParameterized - ldr r2, =gUnknown_02022CF8 - ldr r0, [r2] - add r0, r10 - ldrb r0, [r0] - ldr r1, [sp, 0x64] - lsls r3, r1, 24 - str r6, [sp] - movs r2, 0xFF - str r2, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - ldr r2, =gText_SpacePoints - lsrs r3, 24 - bl AddTextPrinterParameterized - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, r7 - bcc _08029774 -_08029860: - add sp, 0x6C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80296A8 - - thumb_func_start sub_802988C -sub_802988C: @ 802988C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - bl sub_8027650 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0xC] - ldr r6, =gUnknown_02022CF8 - ldr r1, [r6] - ldr r2, =0x00003014 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0xB - bls _080298B2 - b _08029FA8 -_080298B2: - lsls r0, 2 - ldr r1, =_080298C8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080298C8: - .4byte _080298F8 - .4byte _08029914 - .4byte _0802996C - .4byte _08029B6C - .4byte _08029BB8 - .4byte _08029BFC - .4byte _08029C60 - .4byte _08029C9C - .4byte _08029CE0 - .4byte _08029DA0 - .4byte _08029F08 - .4byte _08029F5C -_080298F8: - bl sub_802784C - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r0, =0x0000301c - adds r2, r1, r0 - movs r0, 0 - strh r0, [r2] - b _08029F8A - .pool -_08029914: - ldr r6, =gUnknown_082F7BBC - adds r0, r6, 0 - bl AddWindow - ldr r4, =gUnknown_02022CF8 - ldr r1, [r4] - ldr r2, =0x00003008 - mov r8, r2 - add r1, r8 - strb r0, [r1] - movs r0, 0x8 - adds r0, r6 - mov r9, r0 - bl AddWindow - ldr r1, [r4] - ldr r5, =0x00003009 - adds r1, r5 - strb r0, [r1] - ldr r0, [r4] - add r0, r8 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r4] - adds r0, r5 - ldrb r0, [r0] - bl ClearWindowTilemap - adds r0, r6, 0 - bl sub_8029174 - mov r0, r9 - bl sub_8029174 - b _08029F88 - .pool -_0802996C: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r5, =0x00003008 - adds r0, r5 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r4] - ldr r1, =0x00003009 - mov r9, r1 - add r0, r9 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r2, =gText_BerryPickingResults - mov r8, r2 - movs r2, 0x1 - negs r2, r2 - movs r0, 0x1 - mov r1, r8 - bl GetStringWidth - adds r1, r0, 0 - movs r0, 0xE0 - subs r0, r1 - lsrs r3, r0, 1 - ldr r0, [r4] - adds r0, r5 - ldrb r0, [r0] - lsls r3, 24 - lsrs r3, 24 - movs r1, 0x1 - str r1, [sp] - movs r6, 0xFF - str r6, [sp, 0x4] - movs r5, 0 - str r5, [sp, 0x8] - mov r2, r8 - bl AddTextPrinterParameterized - ldr r0, [r4] - add r0, r9 - ldrb r0, [r0] - ldr r2, =gText_10P30P50P50P - movs r1, 0x11 - str r1, [sp] - str r6, [sp, 0x4] - str r5, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x44 - bl AddTextPrinterParameterized - mov r9, r5 - ldr r0, [sp, 0xC] - cmp r9, r0 - bcc _080299E2 - b _08029B2A -_080299E2: - movs r4, 0 - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 24 - cmp r9, r0 - bne _080299F2 - movs r4, 0x2 -_080299F2: - mov r0, r9 - bl sub_8027660 - adds r6, r0, 0 - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r1, =0x00003009 - adds r0, r1 - ldrb r0, [r0] - mov r2, r9 - lsls r5, r2, 1 - ldr r2, =gUnknown_082FB3F8 - adds r1, r5, r2 - ldrb r3, [r1] - lsls r1, r4, 1 - adds r1, r4 - ldr r2, =gUnknown_082FB380 - adds r1, r2 - str r1, [sp] - movs r4, 0x1 - negs r4, r4 - str r4, [sp, 0x4] - str r6, [sp, 0x8] - movs r1, 0x1 - movs r2, 0 - bl AddTextPrinterParameterized3 - movs r7, 0 - mov r8, r5 - mov r0, r9 - adds r0, 0x1 - str r0, [sp, 0x10] - ldr r1, =gStringVar4 - mov r10, r1 -_08029A36: - mov r0, r9 - adds r1, r7, 0 - bl sub_80276A0 - lsls r0, 16 - lsrs r0, 16 - ldr r1, =0x0000270f - bl Min - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r7, 0 - bl sub_802778C - ldr r1, =0x0000270f - bl Min - lsls r0, 16 - lsrs r6, r0, 16 - mov r0, r10 - adds r1, r4, 0 - movs r2, 0 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - movs r0, 0x1 - mov r1, r10 - movs r2, 0x1 - negs r2, r2 - bl GetStringWidth - adds r5, r0, 0 - cmp r6, r4 - bne _08029AE0 - cmp r6, 0 - beq _08029AE0 - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - lsls r1, r7, 1 - ldr r2, =gUnknown_082FB3F0 - adds r1, r2 - ldrb r2, [r1] - subs r2, r5 - lsls r2, 24 - lsrs r2, 24 - ldr r1, =gUnknown_082FB3F8 - add r1, r8 - ldrb r3, [r1] - ldr r1, =gUnknown_082FB380 + 3 - str r1, [sp] - movs r1, 0x1 - negs r1, r1 - str r1, [sp, 0x4] - mov r1, r10 - str r1, [sp, 0x8] - movs r1, 0x1 - bl AddTextPrinterParameterized3 - b _08029B10 - .pool -_08029AE0: - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - lsls r1, r7, 1 - ldr r2, =gUnknown_082FB3F0 - adds r1, r2 - ldrb r3, [r1] - subs r3, r5 - lsls r3, 24 - lsrs r3, 24 - ldr r1, =gUnknown_082FB3F8 - add r1, r8 - ldrb r1, [r1] - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - ldr r2, =gStringVar4 - bl AddTextPrinterParameterized -_08029B10: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0x3 - bls _08029A36 - ldr r1, [sp, 0x10] - lsls r0, r1, 24 - lsrs r0, 24 - mov r9, r0 - ldr r2, [sp, 0xC] - cmp r9, r2 - bcs _08029B2A - b _080299E2 -_08029B2A: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, [r4] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r4] - ldr r0, =0x00003014 - adds r1, r0 - b _08029F8E - .pool -_08029B6C: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _08029B90 - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r0, [r4] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - bl PutWindowTilemap -_08029B90: - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0 - bl sub_8028C30 - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r0, =0x00003014 - adds r1, r0 - b _08029F8E - .pool -_08029BB8: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x0000301c - adds r2, r0, r1 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1D - bhi _08029BD0 - b _08029FF8 -_08029BD0: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08029BDE - b _08029FF8 -_08029BDE: - movs r0, 0 - strh r0, [r2] - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - bl sub_8028C30 - b _08029F88 - .pool -_08029BFC: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r5, =0x00003008 - adds r0, r5 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r4] - ldr r1, =0x00003009 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r6, =gText_AnnouncingRankings - movs r2, 0x1 - negs r2, r2 - movs r0, 0x1 - adds r1, r6, 0 - bl GetStringWidth - adds r1, r0, 0 - movs r0, 0xE0 - subs r0, r1 - lsrs r3, r0, 1 - ldr r0, [r4] - adds r0, r5 - ldrb r0, [r0] - lsls r3, 24 - lsrs r3, 24 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r6, 0 - bl AddTextPrinterParameterized - b _08029F88 - .pool -_08029C60: - ldr r0, [sp, 0xC] - bl sub_80296A8 - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, [r4] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r4] - ldr r0, =0x00003014 - adds r1, r0 - b _08029F8E - .pool -_08029C9C: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _08029CC0 - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r0, [r4] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - bl PutWindowTilemap -_08029CC0: - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r0, =0x00003014 - adds r1, r0 - b _08029F8E - .pool -_08029CE0: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x0000301c - adds r2, r0, r1 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1D - bhi _08029CF8 - b _08029FF8 -_08029CF8: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _08029D06 - b _08029FF8 -_08029D06: - movs r0, 0 - strh r0, [r2] - movs r0, 0x5 - bl PlaySE - bl sub_8027748 - ldr r1, =0x00000bb7 - cmp r0, r1 - bhi _08029D3C - ldr r0, [r4] - ldr r2, =0x00003014 - adds r0, r2 - movs r1, 0x7F - strb r1, [r0] - b _08029D4C - .pool -_08029D3C: - bl StopMapMusic - ldr r1, [r4] - ldr r0, =0x00003014 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_08029D4C: - movs r0, 0x1E - str r0, [sp] - movs r0, 0xF - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0x5 - bl FillBgTilemapBufferRect_Palette0 - ldr r5, =gUnknown_02022CF8 - ldr r0, [r5] - ldr r4, =0x00003009 - adds r0, r4 - ldrb r0, [r0] - bl RemoveWindow - ldr r6, =gUnknown_082F7BCC - adds r0, r6, 0 - bl AddWindow - ldr r1, [r5] - adds r1, r4 - strb r0, [r1] - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl ClearWindowTilemap - adds r0, r6, 0 - bl sub_8029174 - b _08029FF8 - .pool -_08029DA0: - ldr r0, =0x0000016f - bl PlayNewMapMusic - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r6, =0x00003008 - adds r0, r6 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r4] - ldr r1, =0x00003009 - mov r10, r1 - add r0, r10 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r5, =gText_AnnouncingPrizes - movs r2, 0x1 - negs r2, r2 - movs r0, 0x1 - adds r1, r5, 0 - bl GetStringWidth - adds r1, r0, 0 - movs r0, 0xE0 - subs r0, r1 - lsrs r3, r0, 1 - ldr r0, [r4] - adds r0, r6 - ldrb r0, [r0] - lsls r3, 24 - lsrs r3, 24 - movs r2, 0x1 - mov r9, r2 - str r2, [sp] - movs r1, 0xFF - mov r8, r1 - str r1, [sp, 0x4] - movs r6, 0 - str r6, [sp, 0x8] - movs r1, 0x1 - adds r2, r5, 0 - bl AddTextPrinterParameterized - bl DynamicPlaceholderTextUtil_Reset - bl sub_802762C - lsls r0, 16 - lsrs r0, 16 - ldr r5, =gStringVar1 - adds r1, r5, 0 - bl CopyItemName - movs r0, 0 - adds r1, r5, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - ldr r7, =gStringVar4 - ldr r1, =gText_FirstPlacePrize - adds r0, r7, 0 - bl DynamicPlaceholderTextUtil_ExpandPlaceholders - ldr r0, [r4] - add r0, r10 - ldrb r0, [r0] - mov r2, r9 - str r2, [sp] - mov r1, r8 - str r1, [sp, 0x4] - str r6, [sp, 0x8] - movs r1, 0x1 - adds r2, r7, 0 - movs r3, 0 - bl AddTextPrinterParameterized - bl sub_80279C8 - lsls r0, 24 - lsrs r4, r0, 24 - adds r6, r4, 0 - cmp r4, 0 - beq _08029EC8 - cmp r4, 0x3 - beq _08029EC8 - bl DynamicPlaceholderTextUtil_Reset - bl sub_802762C - lsls r0, 16 - lsrs r0, 16 - adds r1, r5, 0 - bl CopyItemName - movs r0, 0 - adds r1, r5, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - cmp r4, 0x2 - bne _08029E9C - ldr r1, =gText_CantHoldAnyMore - adds r0, r7, 0 - bl DynamicPlaceholderTextUtil_ExpandPlaceholders - b _08029EA8 - .pool -_08029E9C: - cmp r6, 0x1 - bne _08029EA8 - ldr r1, =gText_FilledStorageSpace - adds r0, r7, 0 - bl DynamicPlaceholderTextUtil_ExpandPlaceholders -_08029EA8: - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - ldr r2, =gStringVar4 - movs r1, 0x29 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized -_08029EC8: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, [r4] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r4] - ldr r0, =0x00003014 - adds r1, r0 - b _08029F8E - .pool -_08029F08: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _08029F2C - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r0, [r4] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - bl PutWindowTilemap -_08029F2C: - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, =0x0000020b - movs r1, 0x14 - movs r2, 0xA - bl FadeOutAndFadeInNewMapMusic - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r0, =0x00003014 - adds r1, r0 - b _08029F8E - .pool -_08029F5C: - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x0000301c - adds r2, r0, r1 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x1D - bls _08029FF8 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08029FF8 - movs r0, 0 - strh r0, [r2] - movs r0, 0x5 - bl PlaySE -_08029F88: - ldr r1, [r4] -_08029F8A: - ldr r2, =0x00003014 - adds r1, r2 -_08029F8E: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08029FF8 - .pool -_08029FA8: - ldr r5, =0x00003008 - adds r0, r1, r5 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r6] - ldr r4, =0x00003009 - adds r0, r4 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r6] - adds r0, r5 - ldrb r0, [r0] - bl RemoveWindow - ldr r0, [r6] - adds r0, r4 - ldrb r0, [r0] - bl RemoveWindow - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, [r6] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - movs r1, 0x1 - str r1, [r0] -_08029FF8: - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802988C - - thumb_func_start sub_802A010 -sub_802A010: @ 802A010 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - ldr r1, =gUnknown_02022CF8 - ldr r2, [r1] - ldr r3, =0x00003014 - adds r0, r2, r3 - ldrb r6, [r0] - adds r7, r1, 0 - cmp r6, 0x1 - beq _0802A0CC - cmp r6, 0x1 - bgt _0802A040 - cmp r6, 0 - beq _0802A04E - b _0802A2FC - .pool -_0802A040: - cmp r6, 0x2 - bne _0802A046 - b _0802A194 -_0802A046: - cmp r6, 0x3 - bne _0802A04C - b _0802A1D0 -_0802A04C: - b _0802A2FC -_0802A04E: - ldr r0, =gUnknown_082F7BD4 - mov r9, r0 - bl AddWindow - ldr r1, [r7] - ldr r4, =0x00003008 - adds r1, r4 - strb r0, [r1] - movs r1, 0x8 - add r1, r9 - mov r8, r1 - mov r0, r8 - bl AddWindow - ldr r1, [r7] - ldr r2, =0x00003009 - adds r1, r2 - strb r0, [r1] - ldr r0, [r7] - adds r0, r4 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r7] - ldr r3, =0x00003009 - adds r0, r3 - ldrb r0, [r0] - bl ClearWindowTilemap - mov r0, r9 - bl sub_8029174 - mov r0, r8 - bl sub_8029074 - ldr r1, [r7] - ldr r0, =0x00003014 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r7] - ldr r1, =0x00003020 - adds r0, r1 - strb r6, [r0] - ldr r0, [r7] - ldr r2, =0x00003024 - adds r0, r2 - strb r6, [r0] - b _0802A35E - .pool -_0802A0CC: - ldr r3, =0x00003008 - mov r8, r3 - adds r0, r2, r3 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r7] - ldr r1, =0x00003009 - mov r10, r1 - add r0, r10 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r7] - add r0, r8 - ldrb r0, [r0] - ldr r2, =gText_WantToPlayAgain - movs r1, 0x5 - str r1, [sp] - movs r3, 0xFF - mov r9, r3 - str r3, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldr r0, [r7] - add r0, r10 - ldrb r0, [r0] - ldr r2, =gText_Yes - str r6, [sp] - mov r3, r9 - str r3, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl AddTextPrinterParameterized - ldr r0, [r7] - add r0, r10 - ldrb r0, [r0] - ldr r2, =gText_No - movs r1, 0x11 - str r1, [sp] - mov r3, r9 - str r3, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl AddTextPrinterParameterized - ldr r0, [r7] - add r0, r10 - ldrb r0, [r0] - ldr r2, =gText_SelectorArrow2 - str r6, [sp] - mov r3, r9 - str r3, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldr r0, [r7] - add r0, r8 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, [r7] - add r0, r10 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r7] - ldr r2, =0x00003014 - adds r1, r2 - b _0802A2EA - .pool -_0802A194: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802A1B6 - ldr r0, [r7] - ldr r3, =0x00003008 - adds r0, r3 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r0, [r7] - ldr r1, =0x00003009 - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap -_0802A1B6: - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r1, [r7] - ldr r2, =0x00003014 - adds r1, r2 - b _0802A2EA - .pool -_0802A1D0: - ldr r3, =0x00003020 - adds r0, r2, r3 - ldrb r5, [r0] - cmp r5, 0 - bne _0802A1DC - movs r5, 0x1 -_0802A1DC: - ldr r0, =0x00003009 - mov r8, r0 - adds r0, r2, r0 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r7] - add r0, r8 - ldrb r0, [r0] - ldr r2, =gText_Yes - movs r1, 0x1 - str r1, [sp] - movs r3, 0xFF - mov r10, r3 - str r3, [sp, 0x4] - movs r1, 0 - mov r9, r1 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl AddTextPrinterParameterized - ldr r0, [r7] - add r0, r8 - ldrb r0, [r0] - ldr r2, =gText_No - movs r1, 0x11 - str r1, [sp] - mov r3, r10 - str r3, [sp, 0x4] - mov r1, r9 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl AddTextPrinterParameterized - ldr r0, [r7] - add r0, r8 - ldrb r0, [r0] - ldr r2, =gText_SelectorArrow2 - subs r1, r5, 0x1 - lsls r1, 4 - adds r1, 0x1 - lsls r1, 24 - lsrs r1, 24 - str r1, [sp] - mov r3, r10 - str r3, [sp, 0x4] - mov r1, r9 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldr r0, [r7] - add r0, r8 - ldrb r0, [r0] - movs r1, 0x3 - bl CopyWindowToVram - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r5, 0x1 - movs r2, 0x1 - ands r2, r1 - cmp r2, 0 - beq _0802A294 - movs r0, 0x5 - bl PlaySE - ldr r0, [r7] - ldr r3, =0x00003020 - adds r1, r0, r3 - ldrb r0, [r1] - cmp r0, 0 - bne _0802A2E4 - strb r5, [r1] - b _0802A2E4 - .pool -_0802A294: - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0 - beq _0802A2CC - movs r0, 0x5 - bl PlaySE - ldr r0, [r7] - ldr r2, =0x00003020 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0x1 - beq _0802A2C2 - cmp r0, 0x1 - bgt _0802A2BC - cmp r0, 0 - beq _0802A2C2 - b _0802A35E - .pool -_0802A2BC: - cmp r0, 0x2 - beq _0802A2C8 - b _0802A35E -_0802A2C2: - movs r0, 0x2 - strb r0, [r1] - b _0802A35E -_0802A2C8: - strb r5, [r1] - b _0802A35E -_0802A2CC: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0802A35E - movs r0, 0x5 - bl PlaySE - ldr r0, [r7] - ldr r3, =0x00003020 - adds r0, r3 - movs r1, 0x2 - strb r1, [r0] -_0802A2E4: - ldr r1, [r7] - ldr r0, =0x00003014 - adds r1, r0 -_0802A2EA: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0802A35E - .pool -_0802A2FC: - ldr r0, [r7] - ldr r2, =0x00003020 - adds r1, r0, r2 - ldrb r1, [r1] - ldr r3, =0x00003024 - adds r0, r3 - strb r1, [r0] - ldr r0, [r7] - ldr r6, =0x00003008 - adds r0, r6 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r7] - ldr r1, =0x00003009 - adds r0, r1 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r7] - adds r0, r6 - ldrb r0, [r0] - bl RemoveWindow - ldr r0, [r7] - ldr r2, =0x00003009 - adds r0, r2 - ldrb r0, [r0] - bl RemoveWindow - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, [r7] - movs r3, 0xC0 - lsls r3, 6 - adds r0, r3 - movs r1, 0x1 - str r1, [r0] -_0802A35E: - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802A010 - - thumb_func_start sub_802A380 -sub_802A380: @ 802A380 - push {r4-r6,lr} - sub sp, 0x10 - ldr r5, =gUnknown_02022CF8 - ldr r0, [r5] - ldr r6, =0x00003014 - adds r0, r6 - ldrb r4, [r0] - cmp r4, 0x1 - beq _0802A3D8 - cmp r4, 0x1 - bgt _0802A3A4 - cmp r4, 0 - beq _0802A3AE - b _0802A420 - .pool -_0802A3A4: - cmp r4, 0x2 - beq _0802A3EC - cmp r4, 0x3 - beq _0802A404 - b _0802A420 -_0802A3AE: - movs r0, 0 - movs r1, 0 - bl DrawDialogueFrame - ldr r2, =gText_SavingDontTurnOffPower - str r4, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized2 - b _0802A410 - .pool -_0802A3D8: - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - ldr r1, [r5] - ldr r0, =0x00003014 - adds r1, r0 - b _0802A414 - .pool -_0802A3EC: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802A448 - ldr r0, =sub_8153688 - movs r1, 0 - bl CreateTask - b _0802A410 - .pool -_0802A404: - ldr r0, =sub_8153688 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _0802A448 -_0802A410: - ldr r1, [r5] - adds r1, r6 -_0802A414: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0802A448 - .pool -_0802A420: - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - movs r1, 0x1 - str r1, [r0] -_0802A448: - add sp, 0x10 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802A380 - - thumb_func_start sub_802A454 -sub_802A454: @ 802A454 - push {r4-r6,lr} - sub sp, 0xC - ldr r1, =gUnknown_02022CF8 - ldr r2, [r1] - ldr r6, =0x00003014 - adds r0, r2, r6 - ldrb r0, [r0] - adds r5, r1, 0 - cmp r0, 0x1 - beq _0802A4AC - cmp r0, 0x1 - bgt _0802A47C - cmp r0, 0 - beq _0802A482 - b _0802A520 - .pool -_0802A47C: - cmp r0, 0x2 - beq _0802A4F4 - b _0802A520 -_0802A482: - ldr r4, =gUnknown_082F7BEC - adds r0, r4, 0 - bl AddWindow - ldr r1, [r5] - ldr r2, =0x00003008 - adds r1, r2 - strb r0, [r1] - ldr r0, [r5] - adds r0, r2 - ldrb r0, [r0] - bl ClearWindowTilemap - adds r0, r4, 0 - bl sub_8029174 - b _0802A510 - .pool -_0802A4AC: - ldr r4, =0x00003008 - adds r0, r2, r4 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - ldr r2, =gText_CommunicationStandby3 - movs r1, 0x5 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r5] - ldr r0, =0x00003014 - adds r1, r0 - b _0802A514 - .pool -_0802A4F4: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802A50A - ldr r0, [r5] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap -_0802A50A: - movs r0, 0 - bl CopyBgTilemapBufferToVram -_0802A510: - ldr r1, [r5] - adds r1, r6 -_0802A514: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0802A52C - .pool -_0802A520: - ldr r0, [r5] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - movs r1, 0x1 - str r1, [r0] -_0802A52C: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_802A454 - - thumb_func_start sub_802A534 -sub_802A534: @ 802A534 - push {r4,r5,lr} - sub sp, 0x8 - ldr r5, =gUnknown_02022CF8 - ldr r0, [r5] - ldr r4, =0x00003008 - adds r0, r4 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl RemoveWindow - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, [r5] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - movs r1, 0x1 - str r1, [r0] - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802A534 - - thumb_func_start sub_802A588 -sub_802A588: @ 802A588 - push {r4-r7,lr} - sub sp, 0xC - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r7, =0x00003014 - adds r2, r1, r7 - ldrb r5, [r2] - adds r6, r0, 0 - cmp r5, 0x1 - beq _0802A610 - cmp r5, 0x1 - bgt _0802A5B0 - cmp r5, 0 - beq _0802A5BA - b _0802A6A4 - .pool -_0802A5B0: - cmp r5, 0x2 - beq _0802A658 - cmp r5, 0x3 - beq _0802A684 - b _0802A6A4 -_0802A5BA: - ldr r4, =gUnknown_082F7BE4 - adds r0, r4, 0 - bl AddWindow - ldr r1, [r6] - ldr r2, =0x00003008 - adds r1, r2 - strb r0, [r1] - ldr r0, [r6] - adds r0, r2 - ldrb r0, [r0] - bl ClearWindowTilemap - adds r0, r4, 0 - bl sub_8029174 - ldr r1, [r6] - adds r1, r7 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r6] - ldr r2, =0x0000301c - adds r1, r0, r2 - movs r2, 0 - strh r5, [r1] - ldr r1, =0x00003020 - adds r0, r1 - strb r2, [r0] - ldr r0, [r6] - adds r1, 0x4 - adds r0, r1 - strb r2, [r0] - b _0802A6EA - .pool -_0802A610: - ldr r4, =0x00003008 - adds r0, r1, r4 - ldrb r0, [r0] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r6] - adds r0, r4 - ldrb r0, [r0] - ldr r2, =gText_SomeoneDroppedOut - movs r1, 0x5 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldr r0, [r6] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x2 - bl CopyWindowToVram - ldr r1, [r6] - ldr r2, =0x00003014 - adds r1, r2 - b _0802A678 - .pool -_0802A658: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0802A66E - ldr r0, [r6] - ldr r1, =0x00003008 - adds r0, r1 - ldrb r0, [r0] - bl PutWindowTilemap -_0802A66E: - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r1, [r6] - adds r1, r7 -_0802A678: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0802A6EA - .pool -_0802A684: - ldr r0, =0x0000301c - adds r1, r0 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x77 - bls _0802A6EA - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] - b _0802A6EA - .pool -_0802A6A4: - ldr r0, [r6] - ldr r1, =0x00003024 - adds r0, r1 - movs r1, 0x5 - strb r1, [r0] - ldr r0, [r6] - ldr r4, =0x00003008 - adds r0, r4 - ldrb r0, [r0] - bl ClearWindowTilemap - ldr r0, [r6] - adds r0, r4 - ldrb r0, [r0] - bl RemoveWindow - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - ldr r0, [r6] - movs r2, 0xC0 - lsls r2, 6 - adds r0, r2 - movs r1, 0x1 - str r1, [r0] -_0802A6EA: - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802A588 - - thumb_func_start unused_0 -unused_0: @ 802A6FC - push {r4,lr} - ldr r4, =gUnknown_02022CF8 - ldr r0, [r4] - ldr r1, =0x00003004 - adds r0, r1 - ldrb r0, [r0] - bl DestroyTask - ldr r0, [r4] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - movs r1, 0x1 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end unused_0 - - thumb_func_start nullsub_16 -nullsub_16: @ 802A728 - bx lr - thumb_func_end nullsub_16 - - thumb_func_start sub_802A72C -sub_802A72C: @ 802A72C - push {r4,lr} - ldr r2, =gUnknown_02022CF8 - ldr r1, [r2] - ldr r3, =0x00003014 - adds r1, r3 - movs r3, 0 - strb r3, [r1] - ldr r1, [r2] - movs r4, 0xC0 - lsls r4, 6 - adds r2, r1, r4 - str r3, [r2] - ldr r2, =0x00003028 - adds r1, r2 - str r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802A72C - - thumb_func_start sub_802A75C -sub_802A75C: @ 802A75C - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r1, =0x00003028 - adds r0, r1 - ldr r0, [r0] - bx lr - .pool - thumb_func_end sub_802A75C - - thumb_func_start sub_802A770 -sub_802A770: @ 802A770 - push {lr} - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - movs r1, 0xC0 - lsls r1, 6 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0x1 - beq _0802A78C - movs r0, 0x1 - b _0802A78E - .pool -_0802A78C: - movs r0, 0 -_0802A78E: - pop {r1} - bx r1 - thumb_func_end sub_802A770 - - thumb_func_start sub_802A794 -sub_802A794: @ 802A794 - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r1, =0x00003024 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_802A794 - - thumb_func_start sub_802A7A8 -sub_802A7A8: @ 802A7A8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - movs r3, 0xC0 - lsls r3, 19 - movs r4, 0xC0 - lsls r4, 9 - add r0, sp, 0x4 - mov r8, r0 - mov r2, sp - movs r6, 0 - ldr r1, =0x040000d4 - movs r5, 0x80 - lsls r5, 5 - ldr r7, =0x81000800 - movs r0, 0x81 - lsls r0, 24 - mov r12, r0 -_0802A7CE: - strh r6, [r2] - mov r0, sp - str r0, [r1] - str r3, [r1, 0x4] - str r7, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r3, r5 - subs r4, r5 - cmp r4, r5 - bhi _0802A7CE - strh r6, [r2] - mov r2, sp - str r2, [r1] - str r3, [r1, 0x4] - lsrs r0, r4, 1 - mov r2, r12 - orrs r0, r2 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - movs r0, 0xE0 - lsls r0, 19 - movs r3, 0x80 - lsls r3, 3 - movs r4, 0 - str r4, [sp, 0x4] - ldr r2, =0x040000d4 - mov r1, r8 - str r1, [r2] - str r0, [r2, 0x4] - lsrs r0, r3, 2 - movs r1, 0x85 - lsls r1, 24 - orrs r0, r1 - str r0, [r2, 0x8] - ldr r0, [r2, 0x8] - movs r1, 0xA0 - lsls r1, 19 - mov r0, sp - strh r4, [r0] - str r0, [r2] - str r1, [r2, 0x4] - lsrs r3, 1 - movs r0, 0x81 - lsls r0, 24 - orrs r3, r0 - str r3, [r2, 0x8] - ldr r0, [r2, 0x8] - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_082F7BA4 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - bl InitStandardTextBoxWindows - bl sub_8197200 - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - ldr r4, =gUnknown_02022CF8 - ldr r1, [r4] - movs r0, 0x3 - bl SetBgTilemapBuffer - ldr r1, [r4] - movs r2, 0x80 - lsls r2, 5 - adds r1, r2 - movs r0, 0x1 - bl SetBgTilemapBuffer - ldr r1, [r4] - movs r0, 0x80 - lsls r0, 6 - adds r1, r0 - movs r0, 0x2 - bl SetBgTilemapBuffer - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802A7A8 - - thumb_func_start sub_802A8E8 -sub_802A8E8: @ 802A8E8 - push {lr} - sub sp, 0x4 - ldr r0, =gUnknown_02022CF8 - ldr r0, [r0] - ldr r2, =0x00003018 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0x5 - bhi _0802A982 - lsls r0, 2 - ldr r1, =_0802A910 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0802A910: - .4byte _0802A928 - .4byte _0802A938 - .4byte _0802A93E - .4byte _0802A94C - .4byte _0802A964 - .4byte _0802A972 -_0802A928: - ldr r0, =gDodrioBerryBgPal1 - movs r1, 0 - movs r2, 0x40 - bl LoadPalette - b _0802A98A - .pool -_0802A938: - bl reset_temp_tile_data_buffers - b _0802A98A -_0802A93E: - ldr r1, =gDodrioBerryBgGfx1 - movs r0, 0 - str r0, [sp] - movs r0, 0x3 - b _0802A954 - .pool -_0802A94C: - ldr r1, =gDodrioBerryBgGfx2 - movs r0, 0 - str r0, [sp] - movs r0, 0x1 -_0802A954: - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - b _0802A98A - .pool -_0802A964: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0802A98A - b _0802A998 -_0802A972: - movs r0, 0x3 - bl stdpal_get - movs r1, 0xD0 - movs r2, 0x20 - bl LoadPalette - b _0802A98A -_0802A982: - movs r0, 0 - strb r0, [r1] - movs r0, 0x1 - b _0802A99A -_0802A98A: - ldr r0, =gUnknown_02022CF8 - ldr r1, [r0] - ldr r0, =0x00003018 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_0802A998: - movs r0, 0 -_0802A99A: - add sp, 0x4 - pop {r1} - bx r1 - .pool - thumb_func_end sub_802A8E8 - - .align 2, 0 @ don't pad with nop diff --git a/data/dodrio_berry_picking.s b/data/dodrio_berry_picking.s deleted file mode 100755 index 64fabcff35..0000000000 --- a/data/dodrio_berry_picking.s +++ /dev/null @@ -1,41 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - - - .align 2 -gUnknown_082FB3DC:: @ 82FB3DC - .4byte gText_1Colon - .4byte gText_2Colon - .4byte gText_3Colon - .4byte gText_4Colon - .4byte gText_5Colon - - .align 2 -gUnknown_082FB3F0:: @ 82FB3F0 - .2byte 0x005c, 0x0084, 0x00ac, 0x00d4 - -gUnknown_082FB3F8:: @ 82FB3F8 - .2byte 0x0021, 0x0031, 0x0041, 0x0051, 0x0061 - -gUnknown_082FB402:: @ 82FB402 - .2byte 0x0011, 0x0021, 0x0031, 0x0041, 0x0051 - - .align 2 -gUnknown_082FB40C:: @ 82FB40C - .4byte 0x00000000, sub_8029338 - .4byte 0x00000001, sub_8029440 - .4byte 0x00000002, sub_802988C - .4byte 0x00000003, sub_802A010 - .4byte 0x00000004, sub_802A380 - .4byte 0x00000005, sub_802A454 - .4byte 0x00000006, sub_802A534 - .4byte 0x00000007, sub_802A588 - .4byte 0x00000008, unused_0 - .4byte 0x00000009, nullsub_16 - - .align 2 -gUnknown_082FB45C:: @ 82FB45C - .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00 diff --git a/include/berry_crush.h b/include/berry_crush.h index 101450a337..8909ae821b 100755 --- a/include/berry_crush.h +++ b/include/berry_crush.h @@ -1,6 +1,8 @@ #ifndef GUARD_BERRY_CRUSH_H #define GUARD_BERRY_CRUSH_H +#include "main.h" + void sub_8020C70(MainCallback callback); #endif // GUARD_BERRY_CRUSH_H diff --git a/include/dodrio_berry_picking.h b/include/dodrio_berry_picking.h new file mode 100644 index 0000000000..55e8fa8808 --- /dev/null +++ b/include/dodrio_berry_picking.h @@ -0,0 +1,8 @@ +#ifndef GUARD_DODRIO_BERRY_PICKING_H +#define GUARD_DODRIO_BERRY_PICKING_H + +void sub_802493C(u16 a0, void (*callback)(void)); +void sub_8027A5C(void); +void sub_8027AAC(void); + +#endif // GUARD_DODRIO_BERRY_PICKING_H diff --git a/include/menu.h b/include/menu.h index 08cad40bd1..62e2558dc1 100644 --- a/include/menu.h +++ b/include/menu.h @@ -25,7 +25,7 @@ void InitStandardTextBoxWindows(void); void sub_8197200(void); u16 RunTextPrintersAndIsPrinter0Active(void); void sub_81973A4(void); -void DrawDialogueFrame(u8, u8); +void DrawDialogueFrame(u8 windowId, bool8 copyToVram); void ClearStdWindowAndFrame(u8 windowId, bool8 copyToVram); u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 fgColor, u8 bgColor, u8 shadowColor); void PrintPlayerNameOnWindow(u8, const u8*, u16, u16); diff --git a/include/strings.h b/include/strings.h index dfec425d5d..7e80a2ac1e 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2728,5 +2728,21 @@ extern const u8 gText_BerryPickingRecords[]; extern const u8 gText_BerriesPicked[]; extern const u8 gText_BerriesInRowFivePlayers[]; extern const u8 gText_BestScore[]; +extern const u8 gText_1Colon[]; +extern const u8 gText_2Colon[]; +extern const u8 gText_3Colon[]; +extern const u8 gText_4Colon[]; +extern const u8 gText_5Colon[]; +extern const u8 gText_SpacePoints[]; +extern const u8 gText_10P30P50P50P[]; +extern const u8 gText_AnnouncingPrizes[]; +extern const u8 gText_AnnouncingRankings[]; +extern const u8 gText_FirstPlacePrize[]; +extern const u8 gText_CantHoldAnyMore[]; +extern const u8 gText_FilledStorageSpace[]; +extern const u8 gText_BerryPickingResults[]; +extern const u8 gText_WantToPlayAgain[]; +extern const u8 gText_CommunicationStandby3[]; +extern const u8 gText_SomeoneDroppedOut[]; #endif // GUARD_STRINGS_H diff --git a/ld_script.txt b/ld_script.txt index 9bb3dbb41c..c3fd2a830b 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -75,7 +75,6 @@ SECTIONS { asm/berry_crush.o(.text*); src/berry_powder.o(.text*); src/dodrio_berry_picking.o(.text*); - asm/dodrio_berry_picking.o(.text*); src/pokemon_jump.o(.text*); asm/pokemon_jump.o(.text*); src/rtc.o(.text*); @@ -447,7 +446,6 @@ SECTIONS { data/berry_crush.o(.rodata); data/berry_powder.o(.rodata); src/dodrio_berry_picking.o(.rodata); - data/dodrio_berry_picking.o(.rodata); src/pokemon_jump.o(.rodata); data/pokemon_jump.o(.rodata); src/rtc.o(.rodata); diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c index 9fec2b35d9..3940375c1d 100644 --- a/src/dodrio_berry_picking.c +++ b/src/dodrio_berry_picking.c @@ -1,45 +1,43 @@ #include "global.h" #include "alloc.h" -#include "palette.h" -#include "window.h" -#include "text_window.h" #include "bg.h" -#include "gpu_regs.h" +#include "dodrio_berry_picking.h" +#include "dynamic_placeholder_text_util.h" #include "event_data.h" -#include "random.h" +#include "gpu_regs.h" +#include "international_string_util.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 "main.h" +#include "palette.h" #include "pokemon_jump.h" +#include "random.h" +#include "save.h" +#include "script.h" +#include "sound.h" +#include "string_util.h" +#include "strings.h" +#include "task.h" +#include "text_window.h" +#include "window.h" +#include "constants/items.h" +#include "constants/songs.h" +#include "constants/species.h" struct DodrioSubstruct_0160 { - /*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 unk3000; - /*0x3004 : 0x3164*/ u8 unk3004; - /*0x3008 : 0x3168*/ u8 ALIGNED(4) unk3008[5]; - /*0x300D : 0x316D*/ u8 fill6[0x3014 - 0x300d]; - /*0x3014 : 0x3174*/ u8 unk3014; + /*0x0000 : 0x3000*/ u16 ALIGNED(4) tilemapBuffers[3][BG_SCREEN_SIZE]; + /*0x3000 : 0x3160*/ bool32 finished; + /*0x3004 : 0x3164*/ u8 ALIGNED(4) unk3004; + /*0x3008 : 0x3168*/ u8 ALIGNED(4) unk3008[10]; + /*0x3014 : 0x3174*/ u8 ALIGNED(4) state; /*0x3018 : 0x3178*/ u8 ALIGNED(4) unk3018; - /*0x301C : 0x317C*/ u8 ALIGNED(4) unk301C; + /*0x301C : 0x317C*/ u16 ALIGNED(4) unk301C; /*0x3020 : 0x3180*/ u8 ALIGNED(4) unk3020; /*0x3024 : 0x3184*/ u8 ALIGNED(4) unk3024; - /*0x3025 : 0x3185*/ u8 filler_3025[0x318C - 0x3185]; + /*0x3024 : 0x3184*/ void (*unk3028)(void); }; // size = 0x302C struct DodrioStruct_2022CF4 @@ -57,14 +55,11 @@ struct DodrioSubstruct_31A0_14 u8 unkB[11]; }; -// Possibly an array[4]? struct DodrioSubstruct_31A0_2C { u8 unk0; - u8 fill0[3]; - u8 unk4; - u8 fill1[3]; - u8 unk8; + u8 ALIGNED(4) unk4; + u8 ALIGNED(4) unk8; }; struct DodrioSubstruct_31A0 @@ -90,80 +85,50 @@ struct DodrioSubstruct_3308 struct DodrioStruct { /*0x0000*/ void (*savedCallback)(void); - /*0x0004*/ u8 unk04; - /*0x0005*/ u8 filler_0005[3]; - /*0x0008*/ u8 unk08; - /*0x0009*/ u8 filler_0009[3]; - /*0x000C*/ u8 unk0C; - /*0x000D*/ u8 filler_000D[3]; - /*0x0010*/ u8 unk10; - /*0x0011*/ u8 filler_0011[3]; - /*0x0014*/ u8 unk14; - /*0x0015*/ u8 filler_0015[3]; - /*0x0018*/ u8 unk18; - /*0x0019*/ u8 filler_0019[3]; - /*0x001C*/ u8 unk1C; - /*0x001D*/ u8 filler_001D[3]; - /*0x0020*/ u8 unk20; - /*0x0021*/ u8 filler_0021[3]; - /*0x0024*/ u8 unk24; - /*0x0025*/ u8 filler_0025[3]; - /*0x0028*/ u8 multiplayerId; + /*0x0004*/ u8 ALIGNED(4) unk04; + /*0x0008*/ u8 ALIGNED(4) unk08; + /*0x000C*/ u8 ALIGNED(4) unk0C; + /*0x0010*/ u8 ALIGNED(4) unk10; + /*0x0014*/ u8 ALIGNED(4) unk14; + /*0x0018*/ u8 ALIGNED(4) unk18; + /*0x001C*/ u8 ALIGNED(4) unk1C; + /*0x0020*/ u8 ALIGNED(4) unk20; + /*0x0024*/ u8 ALIGNED(4) unk24; + /*0x0028*/ u8 ALIGNED(4) multiplayerId; /*0x0029*/ u8 filler_0029[7]; - /*0x0030*/ u8 unk30; - /*0x0031*/ u8 filler_0031[3]; - /*0x0034*/ u8 unk34[5]; - /*0x0039*/ u8 filler_0039[3]; - /*0x003C*/ u8 unk3C; - /*0x003D*/ u8 filler_003D[3]; - /*0x0040*/ u8 unk40; - /*0x0041*/ u8 filler_0041[3]; - /*0x0044*/ u8 unk44; - /*0x0045*/ u8 filler_0045[3]; - /*0x0048*/ u8 unk48; - // align 1 + /*0x0030*/ u8 ALIGNED(4) unk30; + /*0x0034*/ u8 ALIGNED(4) unk34[5]; + /*0x003C*/ u8 ALIGNED(4) unk3C; + /*0x0040*/ u8 ALIGNED(4) unk40; + /*0x0044*/ u8 ALIGNED(4) unk44; + /*0x0048*/ u8 ALIGNED(4) unk48; /*0x004A*/ u16 unk4A[5][6]; /*0x0086*/ u16 unk86[5]; - /*0x0090*/ u8 unk90[5]; - /*0x0095*/ u8 filler_0095[3]; - /*0x0098*/ u8 unk98[4]; - /*0x009C*/ u8 unk9C[12]; - /*0x00A8*/ u8 unkA8[5]; - /*0x00AD*/ u8 filler_00AD[3]; - /*0x00B0*/ u8 unkB0[5]; - /*0x00B5*/ u8 filler_00B5[3]; - /*0x00B8*/ u8 unkB8[5]; - /*0x00BD*/ u8 filler_00BD[7]; - /*0x00C4*/ u8 unkC4[11]; - /*0x00CF*/ u8 filler_00CF[1]; - /*0x00D0*/ u8 unkD0[11]; - /*0x00DB*/ u8 filler_00DB[1]; - /*0x00DC*/ u8 unkDC[11]; - /*0x00E7*/ u8 filler_0xE7[1]; - /*0x00E8*/ u8 unkE8[5]; - /*0x00ED*/ u8 filler_00ED[7]; - /*0x00F4*/ u8 unkF4[11][2]; - /*0x010A*/ u8 filler_010A[2]; - /*0x010C*/ u8 unk10C[5]; + /*0x0090*/ u8 ALIGNED(4) unk90[5]; + /*0x0098*/ u8 ALIGNED(4) unk98[4]; + /*0x009C*/ u8 ALIGNED(4) unk9C[11]; + /*0x00A8*/ u8 ALIGNED(4) unkA8[5]; + /*0x00B0*/ u8 ALIGNED(4) unkB0[5]; + /*0x00B8*/ u8 ALIGNED(4) unkB8[11]; + /*0x00C4*/ u8 ALIGNED(4) unkC4[11]; + /*0x00D0*/ u8 ALIGNED(4) unkD0[11]; + /*0x00DC*/ u8 ALIGNED(4) unkDC[11]; + /*0x00E8*/ u8 ALIGNED(4) unkE8[11]; + /*0x00F4*/ u8 ALIGNED(4) unkF4[11][2]; + /*0x010C*/ u8 ALIGNED(4) unk10C[5]; /*0x0112*/ u16 unk112; /*0x0114*/ u16 unk114; - // align 2 /*0x0118*/ u32 unk118; /*0x011C*/ u32 unk11C; /*0x0120*/ u32 unk120; - /*0x0124*/ u8 unk124; - /*0x0125*/ u8 filler_0125[3]; - /*0x0128*/ u8 unk128; - // align 2 + /*0x0124*/ u8 ALIGNED(4) unk124; + /*0x0128*/ u8 ALIGNED(4) unk128; /*0x012C*/ u32 unk12C; /*0x0130*/ u32 unk130[5]; - /*0x0144*/ u8 unk144; - /*0x0145*/ u8 filler_0145[3]; - /*0x0148*/ u8 unk148[11]; - /*0x0153*/ u8 filler_0153[1]; - /*0x0154*/ u8 unk154; - /*0x0155*/ u8 filler_0155[3]; - /*0x0158*/ u8 unk158[5]; + /*0x0144*/ u8 ALIGNED(4) unk144; + /*0x0148*/ u8 ALIGNED(4) unk148[11]; + /*0x0154*/ u8 ALIGNED(4) unk154; + /*0x0158*/ u8 ALIGNED(4) unk158[5]; /*0x0160*/ struct DodrioSubstruct_0160 unk160; /*0x318C*/ struct DodrioSubstruct_318C unk318C[5]; /*0x31A0*/ struct DodrioSubstruct_31A0 unk31A0[5]; @@ -171,132 +136,142 @@ struct DodrioStruct /*0x3308*/ struct DodrioSubstruct_3308 unk3308[5]; }; // size = 0x3330 -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 DodrioStruct_2022CF4 * gUnknown_02022CF4 = NULL; -EWRAM_DATA struct DodrioSubstruct_0160 * gUnknown_02022CF8 = NULL; +EWRAM_DATA static struct DodrioStruct * gUnknown_02022C98 = NULL; +EWRAM_DATA static u16 *gUnknown_02022C9C[5] = {NULL}; +EWRAM_DATA static u16 *gUnknown_02022CB0[2] = {NULL}; +EWRAM_DATA static u16 *gUnknown_02022CB8[11] = {NULL}; +EWRAM_DATA static u16 *gUnknown_02022CE4[4] = {NULL}; +EWRAM_DATA static struct DodrioStruct_2022CF4 *gUnknown_02022CF4 = NULL; +EWRAM_DATA static struct DodrioSubstruct_0160 *gUnknown_02022CF8 = NULL; static bool32 gUnknown_03000DB0; -void sub_8024A1C(void); -void sub_8024A30(struct DodrioStruct *); -void sub_8024BC8(u8 taskId); -void sub_8024DBC(void); -void sub_8024E00(void); -void sub_8024E38(void); -void sub_8024F10(void); -void sub_8024F38(void); -void sub_8024FFC(void); -void sub_80250D4(void); -void sub_8025158(void); -void sub_8025198(void); -void sub_8025230(void); -void sub_8025324(void); -void sub_8025470(void); -void sub_8025644(void); -void sub_80256AC(void); -void sub_8025758(void); -void sub_802589C(u8 taskId); -void sub_8025910(u8 taskId); -void sub_8025D04(void); -void sub_8025D50(void); -void sub_8025E0C(void); -void sub_8025ED8(void); -void sub_8025F48(void); -void sub_8026044(void); -void sub_80261CC(void); -void sub_80261E4(void); -void sub_80261F8(struct DodrioSubstruct_318C *, struct Pokemon *); -void sub_802620C(TaskFunc, u8); -void sub_802621C(TaskFunc); -void sub_8026240(u8); -bool32 sub_8026264(void); -void sub_80262C0(void); -bool32 sub_8026634(u8, u8, u8); -void sub_802671C(void); -void sub_8026AF4(void); -void sub_8026B28(void); -void sub_8026B5C(u8, u8*, u8*); -bool32 sub_8026BB8(void); -void sub_8026C28(void); -bool32 sub_8026C50(void); -bool32 sub_8026C90(void); -void sub_8026D1C(u8); -u8 sub_8026D8C(u8); -u8 sub_8026DB0(u8, u8); -void sub_8026F1C(u8, u8, u8); -void sub_8027234(bool32 arg0); -void sub_80272A4(void); -void sub_80272E8(void); -void sub_80273F0(void); -void sub_802749C(void); -u8 sub_8027518(u8); -void sub_8027554(void); -void sub_8027608(void); -u32 sub_8027748(void); -void sub_8027DD0(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(u32 arg0, u8 *arg1); -void sub_8028350(u32 arg0); -u32 sub_8028374(u32 arg0); -void sub_80283A8(void); -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 count); -void sub_802868C(bool8 invisible, u8 count); -void sub_8028734(void); -void sub_80287E4(void); -void sub_80289E8(bool8 invisible); -void sub_80286E4(void); -bool32 sub_8028828(void); -void sub_8028A34(void); -void sub_8028A88(void); -void sub_8028B80(void); -void sub_8028D44(void); -void sub_8028DFC(void); -void sub_8028E4C(void); -void sub_8028E84(void); -void sub_8028EC8(bool8 invisible); -void sub_8028FCC(void); -void sub_802903C(void); -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); +static void sub_8024A1C(void); +static void sub_8024A30(struct DodrioStruct *); +static void sub_8024BC8(u8 taskId); +static void sub_8024DBC(void); +static void sub_8024E00(void); +static void sub_8024E38(void); +static void sub_8024F10(void); +static void sub_8024F38(void); +static void sub_8024FFC(void); +static void sub_80250D4(void); +static void sub_8025158(void); +static void sub_8025198(void); +static void sub_8025230(void); +static void sub_8025324(void); +static void sub_8025470(void); +static void sub_8025644(void); +static void sub_80256AC(void); +static void sub_8025758(void); +static void sub_802589C(u8 taskId); +static void sub_8025910(u8 taskId); +static void sub_8025D04(void); +static void sub_8025D50(void); +static void sub_8025E0C(void); +static void sub_8025ED8(void); +static void sub_8025F48(void); +static void sub_8026044(void); +static void sub_80261CC(void); +static void sub_80261E4(void); +static void sub_80261F8(struct DodrioSubstruct_318C *, struct Pokemon *); +static void sub_802620C(TaskFunc, u8); +static void sub_802621C(TaskFunc); +static void sub_8026240(u8); +static bool32 sub_8026264(void); +static void sub_80262C0(void); +static bool32 sub_8026634(u8, u8, u8); +static void sub_802671C(void); +static void sub_8026AF4(void); +static void sub_8026B28(void); +static void sub_8026B5C(u8, u8*, u8*); +static bool32 sub_8026BB8(void); +static void sub_8026C28(void); +static bool32 sub_8026C50(void); +static bool32 sub_8026C90(void); +static void sub_8026D1C(u8); +static u8 sub_8026D8C(u8); +static u8 sub_8026DB0(u8, u8); +static void sub_8026F1C(u8, u8, u8); +static void sub_8027234(bool32 arg0); +static void sub_80272A4(void); +static void sub_80272E8(void); +static void sub_80273F0(void); +static void sub_802749C(void); +static u8 sub_8027518(u8); +static void sub_8027554(void); +static void sub_8027608(void); +static u32 sub_8027748(void); +static void sub_8027DD0(u32 arg0); +static void sub_8027E30(struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 arg6, u32 arg7, u32 arg8); +static u32 sub_8028164(u32 unused, struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 *arg6, u32 *arg7, u32 *arg8); +static void sub_80282EC(u8); +static u32 sub_8028318(u32 arg0, u8 *arg1); +static void sub_8028350(u32 arg0); +static u32 sub_8028374(u32 arg0); +static void sub_80283A8(void); +static void sub_8028408(struct DodrioSubstruct_318C *arg0, u8 arg1, u8 id, u8 arg3); +static void sub_80284CC(u8); +static void sub_8028504(u8); +static void sub_8028614(u8 count); +static void sub_802868C(bool8 invisible, u8 count); +static void sub_8028734(void); +static void sub_80287E4(void); +static void sub_80289E8(bool8 invisible); +static void sub_80286E4(void); +static bool32 sub_8028828(void); +static void sub_8028A34(void); +static void sub_8028A88(void); +static void sub_8028B80(void); +static void sub_8028D44(void); +static void sub_8028DFC(void); +static void sub_8028E4C(void); +static void sub_8028E84(void); +static void sub_8028EC8(bool8 invisible); +static void sub_8028FCC(void); +static void sub_802903C(void); +static void sub_8029274(struct DodrioSubstruct_0160 *PTR); +static void sub_80292E0(u8); +static bool32 sub_802A770(void); +static u8 sub_802A794(void); +static void sub_8028BF8(u8 id, bool8 invisible); +static void sub_8028C30(bool8 invisible); +static void sub_8028CA4(u16 id, u8 frameNum); +static void sub_8028C7C(u8 id, u8 y); +static void sub_80286B4(u8 id, u8 frameNum); +static u8 sub_8026E70(u8 arg0, u8 arg1); +static void sub_80288D4(u8 arg0); +static u32 sub_8027DFC(u32 arg0); +static u32 IncrementWithLimit(u32 arg0, u32 arg1); +static u32 Min(u32 arg0, u32 arg1); +static u32 sub_80276C0(u8 arg0); +static void sub_8027ACC(u8 taskId); +static void sub_8029314(u8 taskId); +static void sub_8027BEC(u8 windowId, s32 width); +static void nullsub_15(struct Sprite *sprite); +static void sub_80284A8(struct Sprite *sprite); +static u32 sub_802853C(struct Sprite *sprite); +static u32 sub_80285AC(struct Sprite *sprite); +static s16 sub_8028F14(u8 arg0, u8 arg1); +static void sub_8028654(bool8 invisible, u8 id); +static void sub_8029338(void); +static bool32 sub_802A8E8(void); +static void sub_802A7A8(void); +static void sub_802A72C(void (*func)(void)); +static void (*sub_802A75C(void))(void); +static void sub_8029338(void); +static void sub_8029440(void); +static void sub_802988C(void); +static void sub_802A010(void); +static void sub_802A380(void); +static void sub_802A454(void); +static void sub_802A534(void); +static void sub_802A588(void); +static void sub_802A6FC(void); +static void nullsub_16(void); // const rom data -const u8 gUnknown_082F449C[5][5][11] = +static const u8 gUnknown_082F449C[5][5][11] = { { {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, @@ -325,7 +300,7 @@ const u8 gUnknown_082F449C[5][5][11] = }, }; -const u8 gUknnown_082F45AF[5][5][3] = +static const u8 gUknnown_082F45AF[5][5][3] = { { {4, 5, 6}, @@ -354,7 +329,7 @@ const u8 gUknnown_082F45AF[5][5][3] = }, }; -const u8 gUnknown_082F45FA[5][5][3] = +static const u8 gUnknown_082F45FA[5][5][3] = { { {1, 0, 1}, @@ -384,7 +359,7 @@ const u8 gUnknown_082F45FA[5][5][3] = }; ALIGNED(4) -const u8 gUnknown_082F4648[5][11] = +static const u8 gUnknown_082F4648[5][11] = { {9, 9, 9, 9, 1, 1, 1, 9, 9, 9, 9}, {9, 9, 9, 0, 0, 1, 1, 0, 9, 9, 9}, @@ -393,7 +368,7 @@ const u8 gUnknown_082F4648[5][11] = {3, 3, 4, 4, 0, 0, 1, 1, 2, 2, 3}, }; -const u8 gUnknown_082F467F[5][5] = +static const u8 gUnknown_082F467F[5][5] = { {5}, {4, 6}, @@ -403,7 +378,7 @@ const u8 gUnknown_082F467F[5][5] = }; // Duplicate and unused gfx. Feel free to remove. -const u32 sDuplicateGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_bg1.gbapal", +static const u32 sDuplicateGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_bg1.gbapal", "graphics/link_games/dodrioberry_bg2.gbapal", "graphics/link_games/dodrioberry_pkmn.gbapal", "graphics/link_games/dodrioberry_shiny.gbapal", @@ -421,7 +396,7 @@ const u32 sDuplicateGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_bg1.gbap "graphics/link_games/dodrioberry_bg2left.bin.lz"); -const u8 gUnknown_082F7A88[][3] = +static const u8 gUnknown_082F7A88[][3] = { {40, 24, 13}, {32, 19, 10}, @@ -429,20 +404,20 @@ const u8 gUnknown_082F7A88[][3] = }; ALIGNED(4) -const u8 gUnknown_082F7A94[] = {8, 5, 8, 11, 15}; +static const u8 gUnknown_082F7A94[] = {8, 5, 8, 11, 15}; ALIGNED(4) -const u8 gUnknown_082F7A9C[] = {5, 10, 20, 30, 50, 70, 100}; +static const u8 gUnknown_082F7A9C[] = {5, 10, 20, 30, 50, 70, 100}; ALIGNED(4) -const u8 gUnknown_082F7AA4[][10] = +static const u8 gUnknown_082F7AA4[][10] = { {15, 16, 17, 18, 19, 19, 18, 17, 16, 15}, {20, 21, 22, 23, 24, 25, 26, 27, 28, 29}, {30, 31, 32, 33, 34, 34, 33, 32, 31, 30}, }; -void (*const gUnknown_082F7AC4[])(void) = +static void (*const gUnknown_082F7AC4[])(void) = { sub_8024DBC, sub_8024E00, @@ -458,7 +433,7 @@ void (*const gUnknown_082F7AC4[])(void) = sub_80250D4 }; -void (*const gUnknown_082F7AF4[])(void) = +static void (*const gUnknown_082F7AF4[])(void) = { sub_8024DBC, sub_8024E00, @@ -475,7 +450,7 @@ void (*const gUnknown_082F7AF4[])(void) = }; // code -void sub_802493C(u16 a0, void (*a1)(void)) +void sub_802493C(u16 a0, void (*callback)(void)) { gUnknown_03000DB0 = FALSE; @@ -483,7 +458,7 @@ void sub_802493C(u16 a0, void (*a1)(void)) { sub_8024A1C(); sub_8024A30(gUnknown_02022C98); - gUnknown_02022C98->savedCallback = a1; + gUnknown_02022C98->savedCallback = callback; gUnknown_02022C98->multiplayerId = GetMultiplayerId(); gUnknown_02022C98->unk32CC = gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId]; sub_80261F8(&gUnknown_02022C98->unk318C[gUnknown_02022C98->multiplayerId], &gPlayerParty[a0]); @@ -496,19 +471,19 @@ void sub_802493C(u16 a0, void (*a1)(void)) } else { - SetMainCallback2(a1); + SetMainCallback2(callback); return; } } -void sub_8024A1C(void) +static void sub_8024A1C(void) { ResetTasks(); ResetSpriteData(); FreeAllSpritePalettes(); } -void sub_8024A30(struct DodrioStruct * data) +static void sub_8024A30(struct DodrioStruct * data) { u8 i; @@ -562,7 +537,7 @@ void sub_8024A30(struct DodrioStruct * data) } } -void sub_8024BC8(u8 taskId) +static void sub_8024BC8(u8 taskId) { u8 r4, r5; @@ -635,7 +610,7 @@ void sub_8024BC8(u8 taskId) } } -void sub_8024D4C(u8 taskId) +static void sub_8024D4C(u8 taskId) { sub_8025D04(); gUnknown_082F7AC4[gUnknown_02022C98->unk18](); @@ -646,7 +621,7 @@ void sub_8024D4C(u8 taskId) sub_8025D50(); } -void sub_8024D84(u8 taskId) +static void sub_8024D84(u8 taskId) { sub_8025E0C(); gUnknown_082F7AF4[gUnknown_02022C98->unk18](); @@ -657,7 +632,7 @@ void sub_8024D84(u8 taskId) sub_8025ED8(); } -void sub_8024DBC(void) +static void sub_8024DBC(void) { switch (gUnknown_02022C98->unk10) { @@ -673,7 +648,7 @@ void sub_8024DBC(void) } } -void sub_8024E00(void) +static void sub_8024E00(void) { if (gUnknown_02022C98->unk10 == 0) { @@ -687,7 +662,7 @@ void sub_8024E00(void) } } -void sub_8024E38(void) +static void sub_8024E38(void) { switch (gUnknown_02022C98->unk10) { @@ -728,7 +703,7 @@ void sub_8024E38(void) } } -void sub_8024F10(void) +static void sub_8024F10(void) { if (gUnknown_02022C98->unk10 == 0) { @@ -739,7 +714,7 @@ void sub_8024F10(void) } } -void sub_8024F38(void) +static void sub_8024F38(void) { if (gUnknown_02022C98->unk10 == 0) { @@ -786,7 +761,7 @@ void sub_8024F38(void) } } -void sub_8024FFC(void) +static void sub_8024FFC(void) { if (gUnknown_02022C98->unk40 < 10) { @@ -823,7 +798,7 @@ void sub_8024FFC(void) sub_8026044(); } -void sub_80250D4(void) +static void sub_80250D4(void) { u8 i; @@ -848,14 +823,14 @@ void sub_80250D4(void) } } -void sub_8025158(void) +static void sub_8025158(void) { sub_8026044(); if (sub_8026C90() == 1) sub_8026240(5); } -bool32 sub_8025170(void) +static bool32 sub_8025170(void) { u8 r4 = GetBlockReceivedStatus(); u8 r0 = sub_800A9D8(); @@ -870,7 +845,7 @@ bool32 sub_8025170(void) } } -void sub_8025198(void) +static void sub_8025198(void) { switch (gUnknown_02022C98->unk10) { @@ -908,7 +883,7 @@ void sub_8025198(void) } } -void sub_8025230(void) +static void sub_8025230(void) { u8 i; @@ -947,7 +922,7 @@ void sub_8025230(void) } } -void sub_8025324(void) +static void sub_8025324(void) { u8 sp00 = 1; u8 i; @@ -1009,7 +984,7 @@ void sub_8025324(void) } } -void sub_8025470(void) +static void sub_8025470(void) { u8 sp0; u8 i; @@ -1101,7 +1076,7 @@ void sub_8025470(void) } } -void sub_8025644(void) +static void sub_8025644(void) { switch (gUnknown_02022C98->unk10) { @@ -1131,7 +1106,7 @@ void sub_8025644(void) } } -void sub_80256AC(void) +static void sub_80256AC(void) { switch (gUnknown_02022C98->unk10) { @@ -1167,7 +1142,7 @@ void sub_80256AC(void) } } -void sub_8025758(void) +static void sub_8025758(void) { switch (gUnknown_02022C98->unk10) { @@ -1230,7 +1205,7 @@ void sub_8025758(void) } } -void sub_802589C(u8 taskId) +static void sub_802589C(u8 taskId) { switch (gUnknown_02022C98->unk10) { @@ -1264,7 +1239,7 @@ void sub_802589C(u8 taskId) } } -void sub_8025910(u8 taskId) +static void sub_8025910(u8 taskId) { s16 * data = gTasks[taskId].data; u8 i; @@ -1303,7 +1278,7 @@ void sub_8025910(u8 taskId) } } -void sub_80259FC(void) +static void sub_80259FC(void) { u8 i; u8 r7 = gUnknown_02022C98->unk24; @@ -1370,7 +1345,7 @@ void sub_80259FC(void) } } -void sub_8025C0C(void) +static void sub_8025C0C(void) { u8 i; u8 r6 = gUnknown_02022C98->unk24; @@ -1401,7 +1376,7 @@ void sub_8025C0C(void) } } -void sub_8025D04(void) +static void sub_8025D04(void) { switch (gUnknown_02022C98->unk18) { @@ -1421,7 +1396,7 @@ void sub_8025D04(void) } } -void sub_8025D50(void) +static void sub_8025D50(void) { switch (gUnknown_02022C98->unk18) { @@ -1434,7 +1409,7 @@ void sub_8025D50(void) } } -void sub_8025E0C(void) +static void sub_8025E0C(void) { switch (gUnknown_02022C98->unk18) { @@ -1447,7 +1422,7 @@ void sub_8025E0C(void) } } -void sub_8025ED8(void) +static void sub_8025ED8(void) { switch (gUnknown_02022C98->unk18) { @@ -1470,7 +1445,7 @@ void sub_8025ED8(void) } } -void sub_8025F48(void) +static void sub_8025F48(void) { if (gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 == 0) { @@ -1510,7 +1485,7 @@ void sub_8025F48(void) } } -void sub_8026044(void) +static void sub_8026044(void) { u8 r8 = gUnknown_02022C98->unk44; u8 r7 = gUnknown_02022C98->unk48; @@ -1568,7 +1543,7 @@ void sub_8026044(void) } } -void sub_80261CC(void) +static void sub_80261CC(void) { RunTasks(); AnimateSprites(); @@ -1576,24 +1551,24 @@ void sub_80261CC(void) UpdatePaletteFade(); } -void sub_80261E4(void) +static void sub_80261E4(void) { TransferPlttBuffer(); LoadOam(); ProcessSpriteCopyRequests(); } -void sub_80261F8(struct DodrioSubstruct_318C * a0, struct Pokemon * a1) +static void sub_80261F8(struct DodrioSubstruct_318C * a0, struct Pokemon * a1) { a0->isShiny = IsMonShiny(a1); } -void sub_802620C(TaskFunc func, u8 priority) +static void sub_802620C(TaskFunc func, u8 priority) { CreateTask(func, priority); } -void sub_802621C(TaskFunc func) +static void sub_802621C(TaskFunc func) { gUnknown_02022C98->unk04 = CreateTask(func, 1); gUnknown_02022C98->unk10 = 0; @@ -1601,7 +1576,7 @@ void sub_802621C(TaskFunc func) gUnknown_02022C98->unk14 = 0; } -void sub_8026240(u8 a0) +static void sub_8026240(u8 a0) { gUnknown_02022C98->unk1C = gUnknown_02022C98->unk18; gUnknown_02022C98->unk18 = a0; @@ -1609,7 +1584,7 @@ void sub_8026240(u8 a0) gUnknown_02022C98->unk14 = 0; } -bool32 sub_8026264(void) +static bool32 sub_8026264(void) { u8 r2 = gUnknown_02022C98->unk14 / 4; gUnknown_02022C98->unk14++; @@ -1632,7 +1607,7 @@ bool32 sub_8026264(void) } } -void sub_80262C0(void) +static void sub_80262C0(void) { u8 i; u8 start = gUnknown_02022C98->unk44; @@ -1647,7 +1622,7 @@ void sub_80262C0(void) } #ifdef NONMATCHING -void sub_8026324(void) +static void sub_8026324(void) { u8 sp0 = gUnknown_02022C98->unk44; u8 sp4 = gUnknown_02022C98->unk48; @@ -1755,7 +1730,7 @@ void sub_8026324(void) } #else NAKED -void sub_8026324(void) +static void sub_8026324(void) { asm_unified("\tpush {r4-r7,lr}\n" "\tmov r7, r10\n" @@ -2143,7 +2118,7 @@ void sub_8026324(void) } #endif // NONMATCHING -bool32 sub_8026634(u8 a0, u8 a1, u8 a2) +static bool32 sub_8026634(u8 a0, u8 a1, u8 a2) { s32 r7 = 0; u8 r5 = gUnknown_02022C98->unk24 - 1; @@ -2188,7 +2163,7 @@ bool32 sub_8026634(u8 a0, u8 a1, u8 a2) return FALSE; } -void sub_802671C(void) +static void sub_802671C(void) { u8 r1 = gUnknown_02022C98->unk44; u8 r9 = gUnknown_02022C98->unk48; @@ -2275,7 +2250,7 @@ void sub_802671C(void) } } -void sub_8026988(void) +static void sub_8026988(void) { u8 i, first, count; @@ -2310,7 +2285,7 @@ void sub_8026988(void) } } -void sub_8026A88(void) +static void sub_8026A88(void) { u8 i, count; @@ -2322,7 +2297,7 @@ void sub_8026A88(void) } } -void sub_8026AC8(void) +static void sub_8026AC8(void) { u8 i, count; @@ -2331,7 +2306,7 @@ void sub_8026AC8(void) sub_80286B4(i, 4); } -void sub_8026AF4(void) +static void sub_8026AF4(void) { sub_8026988(); if (gUnknown_02022C98->unk40 > 9) @@ -2343,7 +2318,7 @@ void sub_8026AF4(void) } // This function is literally the same as the one above...Why? -void sub_8026B28(void) +static void sub_8026B28(void) { sub_8026988(); if (gUnknown_02022C98->unk40 > 9) @@ -2354,7 +2329,7 @@ void sub_8026B28(void) sub_80288D4(gUnknown_02022C98->unk40); } -void sub_8026B5C(u8 arg0, u8 *arg1, u8 *arg2) +static void sub_8026B5C(u8 arg0, u8 *arg1, u8 *arg2) { switch (arg0) { @@ -2376,7 +2351,7 @@ void sub_8026B5C(u8 arg0, u8 *arg1, u8 *arg2) } } -bool32 sub_8026BB8(void) +static bool32 sub_8026BB8(void) { u8 i, count; @@ -2399,7 +2374,7 @@ bool32 sub_8026BB8(void) return TRUE; } -void sub_8026C28(void) +static void sub_8026C28(void) { u8 i; @@ -2407,7 +2382,7 @@ void sub_8026C28(void) gUnknown_02022C98->unk158[i] = 0; } -bool32 sub_8026C50(void) +static bool32 sub_8026C50(void) { if (gUnknown_02022C98->unk40 > 9 && gUnknown_02022C98->unk120 == 0) { @@ -2419,7 +2394,7 @@ bool32 sub_8026C50(void) return FALSE; } -bool32 sub_8026C90(void) +static bool32 sub_8026C90(void) { u8 i, first, count; @@ -2445,19 +2420,19 @@ bool32 sub_8026C90(void) return FALSE; } -void sub_8026D1C(u8 arg0) +static void sub_8026D1C(u8 arg0) { u8 var = gUnknown_082F7A9C[gUnknown_02022C98->unk90[arg0] % 7] + (gUnknown_02022C98->unk90[arg0] / 7) * 100; if (gUnknown_02022C98->unk86[arg0] >= var) gUnknown_02022C98->unk90[arg0]++; } -u8 sub_8026D8C(u8 arg0) +static u8 sub_8026D8C(u8 arg0) { return gUnknown_082F4648[gUnknown_02022C98->unk24 - 1][arg0]; } -u8 sub_8026DB0(u8 arg0, u8 arg1) +static u8 sub_8026DB0(u8 arg0, u8 arg1) { u8 i, var3; u8 count = gUnknown_02022C98->unk24 - 1; @@ -2483,7 +2458,7 @@ u8 sub_8026DB0(u8 arg0, u8 arg1) return sub_8026E70(var3, arg1); } -u8 sub_8026E70(u8 arg0, u8 arg1) +static u8 sub_8026E70(u8 arg0, u8 arg1) { u8 var = gUnknown_02022C98->unkE8[arg1]; switch (arg0 % 7) @@ -2517,7 +2492,7 @@ u8 sub_8026E70(u8 arg0, u8 arg1) } } -bool32 sub_8026EEC(u16 arg0[5][6]) +static bool32 sub_8026EEC(u16 arg0[5][6]) { int sum, i; for (sum = 0, i = 0; i < GetLinkPlayerCount(); sum += arg0[i][3], i++) @@ -2529,7 +2504,7 @@ bool32 sub_8026EEC(u16 arg0[5][6]) return FALSE; } -void sub_8026F1C(u8 arg0, u8 arg1, u8 arg2) +static void sub_8026F1C(u8 arg0, u8 arg1, u8 arg2) { u8 var; u8 count = gUnknown_02022C98->unk24; @@ -2669,7 +2644,7 @@ void sub_8026F1C(u8 arg0, u8 arg1, u8 arg2) } } -void sub_8027234(bool32 arg0) +static void sub_8027234(bool32 arg0) { if (gUnknown_02022C98->unk24 != 5) return; @@ -2689,14 +2664,14 @@ void sub_8027234(bool32 arg0) } } -void sub_80272A4(void) +static 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) +static void sub_80272E8(void) { u8 i, j; @@ -2724,9 +2699,9 @@ void sub_80272E8(void) sub_8026988(); } -const s16 gUnknown_082F7B24[] = {10, 30, 50, 50}; +static const s16 gUnknown_082F7B24[] = {10, 30, 50, 50}; -void sub_80273F0(void) +static void sub_80273F0(void) { u8 i, var = 0, var2 = 0; @@ -2741,7 +2716,7 @@ void sub_80273F0(void) gUnknown_02022C98->unk4A[i][4] = gUnknown_082F7AA4[var][var2]; } -u32 sub_802745C(u8 arg0) +static u32 sub_802745C(u8 arg0) { u32 sum = gUnknown_02022C98->unk4A[arg0][0] + gUnknown_02022C98->unk4A[arg0][1] @@ -2749,7 +2724,7 @@ u32 sub_802745C(u8 arg0) return min(sum, 9999); } -void sub_802749C(void) +static void sub_802749C(void) { u32 berriesPicked = Min(sub_802745C(gUnknown_02022C98->multiplayerId), 9999); u32 score = Min(sub_80276C0(gUnknown_02022C98->multiplayerId), 999990); @@ -2762,7 +2737,7 @@ void sub_802749C(void) gSaveBlock2Ptr->berryPick.berriesPickedInRow = gUnknown_02022C98->unk114; } -u8 sub_8027518(u8 arg0) +static u8 sub_8027518(u8 arg0) { u8 i, saved; @@ -2773,7 +2748,7 @@ u8 sub_8027518(u8 arg0) return saved; } -void sub_8027554(void) +static void sub_8027554(void) { if (gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] == 0) { @@ -2806,22 +2781,22 @@ void sub_8027554(void) } } -void sub_8027608(void) +static void sub_8027608(void) { gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 0; } -u16 sub_802762C(void) +static u16 sub_802762C(void) { return gUnknown_02022C98->unk4A[gUnknown_02022C98->multiplayerId][4] + FIRST_BERRY_INDEX; } -u8 sub_8027650(void) +static u8 sub_8027650(void) { return gUnknown_02022C98->unk24; } -u8 *sub_8027660(u8 id) +static u8 *sub_8027660(u8 id) { if (gReceivedRemoteLinkPlayers) return gLinkPlayers[id].name; @@ -2829,12 +2804,12 @@ u8 *sub_8027660(u8 id) return gUnknown_02022C98->unk31A0[id].name; } -u16 sub_80276A0(u8 arg0, u8 arg1) +static u16 sub_80276A0(u8 arg0, u8 arg1) { return gUnknown_02022C98->unk4A[arg0][arg1]; } -u32 sub_80276C0(u8 arg0) +static u32 sub_80276C0(u8 arg0) { u8 i; u32 var, sum = 0; @@ -2849,7 +2824,7 @@ u32 sub_80276C0(u8 arg0) return sum - var; } -u32 sub_8027748(void) +static u32 sub_8027748(void) { u8 i, count = gUnknown_02022C98->unk24; u32 maxVar = sub_80276C0(0); @@ -2863,7 +2838,7 @@ u32 sub_8027748(void) return Min(maxVar, 999990); } -u16 sub_802778C(u8 arg0) +static u32 sub_802778C(u8 arg0) { u8 i, count = gUnknown_02022C98->unk24; u16 maxVar = gUnknown_02022C98->unk4A[0][arg0]; @@ -2877,7 +2852,7 @@ u16 sub_802778C(u8 arg0) return maxVar; } -u32 sub_80277D0(u8 arg0) +static u32 sub_80277D0(u8 arg0) { u32 vals[5], temp; s16 r6 = TRUE; @@ -2902,7 +2877,7 @@ u32 sub_80277D0(u8 arg0) return vals[arg0]; } -u32 sub_802784C(void) +static u32 sub_802784C(void) { u8 i, r10 = 0, r8 = 0, r9 = 0, count = gUnknown_02022C98->unk24; @@ -2939,13 +2914,13 @@ u32 sub_802784C(void) return 0; } -void sub_802793C(struct DodrioSubstruct_3308 *dst, u8 id) +static void sub_802793C(struct DodrioSubstruct_3308 *dst, u8 id) { *dst = gUnknown_02022C98->unk3308[id]; } // Unused function -u8 sub_802795C(u8 arg0) +static u8 sub_802795C(u8 arg0) { u8 i, ret = 0, count = gUnknown_02022C98->unk24; u32 var, vars[5] = {0}; @@ -2963,7 +2938,7 @@ u8 sub_802795C(u8 arg0) return ret; } -u8 sub_80279C8(void) +static u8 sub_80279C8(void) { u8 multiplayerId = gUnknown_02022C98->multiplayerId; u16 itemId = sub_802762C(); @@ -2980,7 +2955,7 @@ u8 sub_80279C8(void) } // Really? What next, u32 Add(u32 a)return a+1;? -u32 IncrementWithLimit(u32 a, u32 max) +static u32 IncrementWithLimit(u32 a, u32 max) { if (a < max) return a + 1; @@ -2989,7 +2964,7 @@ u32 IncrementWithLimit(u32 a, u32 max) } // Gamefreak pls, min(a, b) ((a) < (b) ? (a) : (b)) is a well-known macro -u32 Min(u32 a, u32 b) +static u32 Min(u32 a, u32 b) { if (a < b) return a; @@ -2997,7 +2972,7 @@ u32 Min(u32 a, u32 b) return b; } -u8 sub_8027A48(u8 id) +static u8 sub_8027A48(u8 id) { return gUnknown_02022C98->unk34[id]; } @@ -3025,7 +3000,7 @@ void sub_8027AAC(void) } // Data related to printing saved results. -const struct WindowTemplate gUnknown_082F7B2C = +static const struct WindowTemplate gUnknown_082F7B2C = { .bg = 0, .tilemapLeft = 5, @@ -3036,14 +3011,14 @@ const struct WindowTemplate gUnknown_082F7B2C = .baseBlock = 0x1, }; -const u8 *const gUnknown_082F7B34[3] = {gText_BerriesPicked, gText_BestScore, gText_BerriesInRowFivePlayers}; -const u8 gUnknown_082F7B40[] = {4, 7, 4}; +static const u8 *const gUnknown_082F7B34[3] = {gText_BerriesPicked, gText_BestScore, gText_BerriesInRowFivePlayers}; +static 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}}; +static const u8 gUnknown_082F7B44[][2] = {{25}, {41}, {57}}; +static const u8 gUnknown_082F7B4A[][2] = {{25}, {41}, {73}}; -void sub_8027ACC(u8 taskId) +static void sub_8027ACC(u8 taskId) { struct WindowTemplate window; s32 i, width, widthCurr; @@ -3093,7 +3068,7 @@ void sub_8027ACC(u8 taskId) } } -void sub_8027BEC(u8 windowId, s32 width) +static void sub_8027BEC(u8 windowId, s32 width) { s32 i, x, numWidth; s32 results[3]; @@ -3117,7 +3092,7 @@ void sub_8027BEC(u8 windowId, s32 width) } // Debug functions? -const u16 gUnknown_082F7B50[][4] = +static const u16 gUnknown_082F7B50[][4] = { {9999, 0, 90, 9999}, {9999, 9999, 70, 9999}, @@ -3126,11 +3101,11 @@ const u16 gUnknown_082F7B50[][4] = {9999, 9999, 9999, 0}, }; -const u8 gUnknown_082F7B78[] = _("あいうえおかき"); -const u8 gUnknown_082F7B80[] = _("ABCDEFG"); -const u8 gUnknown_082F7B88[] = _("0123456"); +static const u8 gUnknown_082F7B78[] = _("あいうえおかき"); +static const u8 gUnknown_082F7B80[] = _("ABCDEFG"); +static const u8 gUnknown_082F7B88[] = _("0123456"); -const u8 *const gUnknown_082F7B90[] = +static const u8 *const gUnknown_082F7B90[] = { gUnknown_082F7B78, gUnknown_082F7B78, @@ -3139,12 +3114,12 @@ const u8 *const gUnknown_082F7B90[] = gUnknown_082F7B88 }; -void sub_8027D20(void) +static void sub_8027D20(void) { gUnknown_02022C98->unk24 = GetLinkPlayerCount(); } -void sub_8027D38(void) +static void sub_8027D38(void) { u8 i, playerId; @@ -3165,7 +3140,7 @@ struct UnkPacket1 u8 ALIGNED(4) unk4; }; -void sub_8027DD0(u32 arg0) +static void sub_8027DD0(u32 arg0) { struct UnkPacket1 packet; packet.id = 1; @@ -3173,7 +3148,7 @@ void sub_8027DD0(u32 arg0) sub_800FE50(&packet); } -u32 sub_8027DFC(u32 arg0) +static u32 sub_8027DFC(u32 arg0) { struct UnkPacket1 *packet; @@ -3231,7 +3206,7 @@ struct UnkPacket2 }; #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) +static void sub_8027E30(struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 arg6, u32 arg7, u32 arg8) { struct UnkPacket2 packet; struct DodrioSubstruct_31A0_14 *ptr = &arg0->unk14; @@ -3284,7 +3259,7 @@ void sub_8027E30(struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_ } #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) +static void sub_8027E30(struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 arg6, u32 arg7, u32 arg8) { asm_unified(" push {r4-r7,lr}\n\ mov r7, r10\n\ @@ -3699,7 +3674,7 @@ void sub_8027E30(struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_ } #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) +static u32 sub_8028164(u32 unused, struct DodrioSubstruct_31A0 *arg0, struct DodrioSubstruct_31A0_2C *arg1, struct DodrioSubstruct_31A0_2C *arg2, struct DodrioSubstruct_31A0_2C *arg3, struct DodrioSubstruct_31A0_2C *arg4, struct DodrioSubstruct_31A0_2C *arg5, u8 *arg6, u32 *arg7, u32 *arg8) { struct UnkPacket2 *packet; struct DodrioSubstruct_31A0_14 *ptr = &arg0->unk14; @@ -3769,7 +3744,7 @@ struct UnkPacket3 u8 ALIGNED(4) unk4; }; -void sub_80282EC(u8 arg0) +static void sub_80282EC(u8 arg0) { struct UnkPacket3 packet; packet.id = 3; @@ -3777,7 +3752,7 @@ void sub_80282EC(u8 arg0) sub_800FE50(&packet); } -u32 sub_8028318(u32 arg0, u8 *arg1) +static u32 sub_8028318(u32 arg0, u8 *arg1) { struct UnkPacket3 *packet; @@ -3800,7 +3775,7 @@ struct UnkPacket4 u32 unk4; }; -void sub_8028350(u32 arg0) +static void sub_8028350(u32 arg0) { struct UnkPacket4 packet; packet.id = 4; @@ -3808,7 +3783,7 @@ void sub_8028350(u32 arg0) sub_800FE50(&packet); } -u32 sub_8028374(u32 arg0) +static u32 sub_8028374(u32 arg0) { struct UnkPacket4 *packet; @@ -3823,7 +3798,7 @@ u32 sub_8028374(u32 arg0) } // Large chunk of data -const struct BgTemplate gUnknown_082F7BA4[] = +static const struct BgTemplate gUnknown_082F7BA4[] = { { .bg = 0, @@ -3864,29 +3839,30 @@ const struct BgTemplate gUnknown_082F7BA4[] = }; // Unknown unreferenced data, feel free to remove. -const u32 sUnused[] = {255, 0}; +static const u32 sUnused[] = {255, 0}; -const struct WindowTemplate gUnknown_082F7BBC = +static const struct WindowTemplate gUnknown_082F7BBC[] = { - .bg = 0, - .tilemapLeft = 1, - .tilemapTop = 1, - .width = 28, - .height = 2, - .paletteNum = 13, - .baseBlock = 0x13, + { + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 28, + .height = 2, + .paletteNum = 13, + .baseBlock = 0x13, + }, + { + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 5, + .width = 28, + .height = 14, + .paletteNum = 13, + .baseBlock = 0x4B, + } }; -const struct WindowTemplate gUnknown_082F7BC4 = -{ - .bg = 0, - .tilemapLeft = 1, - .tilemapTop = 5, - .width = 28, - .height = 14, - .paletteNum = 13, - .baseBlock = 0x4B, -}; -const struct WindowTemplate gUnknown_082F7BCC = +static const struct WindowTemplate gUnknown_082F7BCC = { .bg = 0, .tilemapLeft = 1, @@ -3896,27 +3872,28 @@ const struct WindowTemplate gUnknown_082F7BCC = .paletteNum = 13, .baseBlock = 0x4B, }; -const struct WindowTemplate gUnknown_082F7BD4 = +static const struct WindowTemplate gUnknown_082F7BD4[] = { - .bg = 0, - .tilemapLeft = 1, - .tilemapTop = 8, - .width = 19, - .height = 3, - .paletteNum = 13, - .baseBlock = 0x13, + { + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 8, + .width = 19, + .height = 3, + .paletteNum = 13, + .baseBlock = 0x13, + }, + { + .bg = 0, + .tilemapLeft = 22, + .tilemapTop = 7, + .width = 6, + .height = 4, + .paletteNum = 13, + .baseBlock = 0x4C, + } }; -const struct WindowTemplate gUnknown_082F7BDC = -{ - .bg = 0, - .tilemapLeft = 22, - .tilemapTop = 7, - .width = 6, - .height = 4, - .paletteNum = 13, - .baseBlock = 0x4C, -}; -const struct WindowTemplate gUnknown_082F7BE4 = +static const struct WindowTemplate gUnknown_082F7BE4 = { .bg = 0, .tilemapLeft = 4, @@ -3926,7 +3903,7 @@ const struct WindowTemplate gUnknown_082F7BE4 = .paletteNum = 13, .baseBlock = 0x13, }; -const struct WindowTemplate gUnknown_082F7BEC = +static const struct WindowTemplate gUnknown_082F7BEC = { .bg = 0, .tilemapLeft = 5, @@ -3938,7 +3915,7 @@ const struct WindowTemplate gUnknown_082F7BEC = }; // This is an unused copy of the tables from the top of the file. Feel free to remove. -const u8 sDuplicateArray[] = +static const u8 sDuplicateArray[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 3, 8, 9, 0, 0, 1, 2, 5, 6, 3, 4, 5, 8, 9, 0, 0, 0, 0, @@ -3955,24 +3932,24 @@ const u8 sDuplicateArray[] = 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", +static 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"); +static const u16 gDodrioBerryPkmnPal[] = INCBIN_U16("graphics/link_games/dodrioberry_pkmn.gbapal"); +static const u16 gDodrioBerryShinyPal[] = INCBIN_U16("graphics/link_games/dodrioberry_shiny.gbapal"); +static const u16 gDodrioBerryStatusPal[] = INCBIN_U16("graphics/link_games/dodrioberry_status.gbapal"); +static const u16 gDodrioBerrySpritesPal[] = INCBIN_U16("graphics/link_games/dodrioberry_berrysprites.gbapal"); +static const u32 gDodrioBerrySpritesGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_berrysprites.4bpp.lz"); +static const u16 gDodrioBerryPlatformPal[] = INCBIN_U16("graphics/link_games/dodrioberry_platform.gbapal"); +static const u32 gDodrioBerryBgGfx1[] = INCBIN_U32("graphics/link_games/dodrioberry_bg1.4bpp.lz"); +static const u32 gDodrioBerryBgGfx2[] = INCBIN_U32("graphics/link_games/dodrioberry_bg2.4bpp.lz"); +static const u32 gDodrioBerryStatusGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_status.4bpp.lz"); +static const u32 gDodrioBerryPlatformGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_platform.4bpp.lz"); +static const u32 gDodrioBerryPkmnGfx[] = INCBIN_U32("graphics/link_games/dodrioberry_pkmn.4bpp.lz"); +static const u32 gDodrioBerryBgTilemap1[] = INCBIN_U32("graphics/link_games/dodrioberry_bg1.bin.lz"); +static const u32 gDodrioBerryBgTilemap2Right[] = INCBIN_U32("graphics/link_games/dodrioberry_bg2right.bin.lz"); +static const u32 gDodrioBerryBgTilemap2Left[] = INCBIN_U32("graphics/link_games/dodrioberry_bg2left.bin.lz"); -const struct OamData sOamData_82FB1E0 = +static const struct OamData sOamData_82FB1E0 = { .y = 0, .affineMode = 0, @@ -4023,7 +4000,7 @@ static const struct OamData sOamData_82FB1F0 = .affineParam = 0 }; -const struct OamData sOamData_82FB1F8 = +static const struct OamData sOamData_82FB1F8 = { .y = 0, .affineMode = 0, @@ -4070,7 +4047,7 @@ static const union AnimCmd sSpriteAnim_82FB220[] = ANIMCMD_JUMP(0) }; -const union AnimCmd *const sSpriteAnimTable_82FB228[] = +static const union AnimCmd *const sSpriteAnimTable_82FB228[] = { sSpriteAnim_82FB200, sSpriteAnim_82FB208, @@ -4177,12 +4154,12 @@ static const union AnimCmd sSpriteAnim_82FB2CC[] = ANIMCMD_JUMP(0) }; -const union AnimCmd *const sSpriteAnimTable_82FB2D4[] = +static const union AnimCmd *const sSpriteAnimTable_82FB2D4[] = { sSpriteAnim_82FB2CC }; -void sub_80283A8(void) +static void sub_80283A8(void) { void *ptr = AllocZeroed(0x3000); struct SpritePalette pal1 = {gDodrioBerryPkmnPal, 0}; @@ -4200,7 +4177,7 @@ void sub_80283A8(void) LoadSpritePalette(&pal2); } -void sub_8028408(struct DodrioSubstruct_318C *arg0, u8 arg1, u8 id, u8 arg3) +static void sub_8028408(struct DodrioSubstruct_318C *arg0, u8 arg1, u8 id, u8 arg3) { struct SpriteTemplate sprTemplate = { @@ -4218,7 +4195,7 @@ void sub_8028408(struct DodrioSubstruct_318C *arg0, u8 arg1, u8 id, u8 arg3) sub_8028654(TRUE, id); } -void sub_80284A8(struct Sprite *sprite) +static void sub_80284A8(struct Sprite *sprite) { switch (sprite->data[0]) { @@ -4233,7 +4210,7 @@ void sub_80284A8(struct Sprite *sprite) } } -void sub_80284CC(u8 unused) +static void sub_80284CC(u8 unused) { struct Sprite *sprite = &gSprites[*gUnknown_02022C9C[GetMultiplayerId()]]; sprite->data[0] = 1; @@ -4243,7 +4220,7 @@ void sub_80284CC(u8 unused) sprite->data[4] = 0; } -void sub_8028504(u8 unused) +static void sub_8028504(u8 unused) { struct Sprite *sprite = &gSprites[*gUnknown_02022C9C[GetMultiplayerId()]]; sprite->data[0] = 2; @@ -4253,7 +4230,7 @@ void sub_8028504(u8 unused) sprite->data[4] = 0; } -u32 sub_802853C(struct Sprite *sprite) +static u32 sub_802853C(struct Sprite *sprite) { s8 var; u8 mod = (++sprite->data[1] / 2) % 4; @@ -4282,7 +4259,7 @@ u32 sub_802853C(struct Sprite *sprite) return 0; } -u32 sub_80285AC(struct Sprite *sprite) +static u32 sub_80285AC(struct Sprite *sprite) { u8 mod = (++sprite->data[1] / 13) % 4; @@ -4297,7 +4274,7 @@ u32 sub_80285AC(struct Sprite *sprite) return 0; } -void sub_8028614(u8 count) +static void sub_8028614(u8 count) { u8 i; for (i = 0; i < count; i++) @@ -4309,29 +4286,29 @@ void sub_8028614(u8 count) } } -void sub_8028654(bool8 invisible, u8 id) +static void sub_8028654(bool8 invisible, u8 id) { gSprites[*gUnknown_02022C9C[id]].invisible = invisible; } -void sub_802868C(bool8 invisible, u8 count) +static 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) +static void sub_80286B4(u8 id, u8 frameNum) { StartSpriteAnim(&gSprites[*gUnknown_02022C9C[id]], frameNum); } -void nullsub_15(struct Sprite *sprite) +static void nullsub_15(struct Sprite *sprite) { } -void sub_80286E4(void) +static void sub_80286E4(void) { u8 i; for (i = 0; i < 10; i++) @@ -4343,7 +4320,7 @@ void sub_80286E4(void) } } -void sub_8028734(void) +static void sub_8028734(void) { u8 i; void *ptr = AllocZeroed(0x180); @@ -4375,7 +4352,7 @@ void sub_8028734(void) Free(ptr); } -void sub_80287E4(void) +static void sub_80287E4(void) { u8 i; for (i = 0; i < 10; i++) @@ -4387,7 +4364,7 @@ void sub_80287E4(void) FREE_AND_SET_NULL(gUnknown_02022CF4); } -bool32 sub_8028828(void) +static bool32 sub_8028828(void) { u8 i; bool32 r3 = FALSE; @@ -4415,7 +4392,7 @@ bool32 sub_8028828(void) return TRUE; } -void sub_80288D4(u8 arg0) +static void sub_80288D4(u8 arg0) { u8 i; @@ -4448,7 +4425,7 @@ void sub_80288D4(u8 arg0) } } -void sub_80289E8(bool8 invisible) +static void sub_80289E8(bool8 invisible) { u8 i; for (i = 0; i < 10; i++) @@ -4456,9 +4433,9 @@ void sub_80289E8(bool8 invisible) } // Unknown unused data, feel free to remove. -const u8 sUnused2[] = {0xD4, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0xFB, 0x0, 0x0}; +static const u8 sUnused2[] = {0xD4, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0xFB, 0x0, 0x0}; -void sub_8028A34(void) +static void sub_8028A34(void) { void *ptr = AllocZeroed(0x480); struct SpritePalette sprPal = {gDodrioBerrySpritesPal, 3}; @@ -4474,9 +4451,9 @@ void sub_8028A34(void) Free(ptr); } -const s16 gUnknown_082FB31C[] = {88, 128, 168, 208}; +static const s16 gUnknown_082FB31C[] = {88, 128, 168, 208}; -void sub_8028A88(void) +static void sub_8028A88(void) { u8 i; s16 x; @@ -4522,7 +4499,7 @@ void sub_8028A88(void) sub_8028C30(TRUE); } -void sub_8028B80(void) +static void sub_8028B80(void) { struct Sprite *sprite; u8 i; @@ -4543,30 +4520,30 @@ void sub_8028B80(void) } } -void sub_8028BF8(u8 id, bool8 invisible) +static void sub_8028BF8(u8 id, bool8 invisible) { gSprites[*gUnknown_02022CB8[id]].invisible = invisible; } -void sub_8028C30(bool8 invisible) +static 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) +static void sub_8028C7C(u8 id, u8 y) { gSprites[*gUnknown_02022CB8[id]].pos1.y = y * 8; } -void sub_8028CA4(u16 id, u8 frameNum) +static void sub_8028CA4(u16 id, u8 frameNum) { StartSpriteAnim(&gSprites[*gUnknown_02022CB8[id]], frameNum); } // Unused -void sub_8028CD0(u8 spriteId) +static void sub_8028CD0(u8 spriteId) { gSprites[spriteId].pos1.x = 20 * spriteId + 50; gSprites[spriteId].pos1.y = 50; @@ -4580,7 +4557,7 @@ void sub_8028CD0(u8 spriteId) #define sKeepPosX data[10] #endif // NONMATCHING -void sub_8028CF4(struct Sprite *sprite) +static void sub_8028CF4(struct Sprite *sprite) { u8 i; static const u8 array[] = {30, 20}; @@ -4598,9 +4575,9 @@ void sub_8028CF4(struct Sprite *sprite) } } -const s16 gUnknown_082FB356[][2] = {{230, 55}, {30, 74}}; +static const s16 gUnknown_082FB356[][2] = {{230, 55}, {30, 74}}; -void sub_8028D44(void) +static void sub_8028D44(void) { u8 i; void *ptr = AllocZeroed(0x400); @@ -4633,7 +4610,7 @@ void sub_8028D44(void) Free(ptr); } -void sub_8028DFC(void) +static void sub_8028DFC(void) { u8 i; for (i = 0; i < 2; i++) @@ -4645,7 +4622,7 @@ void sub_8028DFC(void) } } -void sub_8028E4C(void) +static void sub_8028E4C(void) { u8 i; for (i = 0; i < 2; i++) @@ -4655,7 +4632,7 @@ void sub_8028E4C(void) } } -void sub_8028E84(void) +static void sub_8028E84(void) { u8 i; for (i = 0; i < 2; i++) @@ -4667,7 +4644,7 @@ void sub_8028E84(void) } } -void sub_8028EC8(bool8 invisible) +static void sub_8028EC8(bool8 invisible) { u8 i; for (i = 0; i < 2; i++) @@ -4676,7 +4653,7 @@ void sub_8028EC8(bool8 invisible) #undef sKeepPosX -s16 sub_8028F14(u8 arg0, u8 arg1) +static s16 sub_8028F14(u8 arg0, u8 arg1) { s16 x = 0; switch (arg1) @@ -4723,7 +4700,7 @@ s16 sub_8028F14(u8 arg0, u8 arg1) return x * 8; } -void sub_8028FCC(void) +static void sub_8028FCC(void) { u8 i; for (i = 0; i < 11; i++) @@ -4734,27 +4711,27 @@ void sub_8028FCC(void) sub_80289E8(FALSE); } -void sub_8028FF8(u8 frameId) +static void sub_8028FF8(u8 frameId) { LoadBgTiles(0, GetWindowFrameTilesPal(frameId)->tiles, 0x120, 1); LoadPalette(GetWindowFrameTilesPal(frameId)->pal, 0xA0, 0x20); } -void sub_802902C(void) +static void sub_802902C(void) { LoadUserWindowBorderGfx_(0, 0xA, 0xB0); } -void sub_802903C(void) +static void sub_802903C(void) { - gUnknown_02022CF8->unk3000 = 0; - gUnknown_02022CF8->unk3014 = 0; + gUnknown_02022CF8->finished = FALSE; + gUnknown_02022CF8->state = 0; gUnknown_02022CF8->unk3018 = 0; gUnknown_02022CF8->unk3020 = 0; gUnknown_02022CF8->unk3024 = 0; } -void sub_8029074(struct WindowTemplate *winTempl) +static void sub_8029074(const struct WindowTemplate *winTempl) { u8 pal = 0xA; @@ -4768,7 +4745,7 @@ void sub_8029074(struct WindowTemplate *winTempl) FillBgTilemapBufferRect(0, 9, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop + winTempl->height, 1, 1, pal); } -void sub_8029174(struct WindowTemplate *winTempl) +static void sub_8029174(const struct WindowTemplate *winTempl) { u8 pal = 0xB; @@ -4782,11 +4759,11 @@ void sub_8029174(struct WindowTemplate *winTempl) FillBgTilemapBufferRect(0, 18, winTempl->tilemapLeft + winTempl->width, winTempl->tilemapTop + winTempl->height, 1, 1, pal); } -void sub_8029274(struct DodrioSubstruct_0160 *ptr) +static void sub_8029274(struct DodrioSubstruct_0160 *ptr) { gUnknown_02022CF8 = ptr; - gUnknown_02022CF8->unk3000 = 0; - gUnknown_02022CF8->unk3014 = 0; + gUnknown_02022CF8->finished = FALSE; + gUnknown_02022CF8->state = 0; gUnknown_02022CF8->unk3018 = 0; gUnknown_02022CF8->unk3020 = 0; gUnknown_02022CF8->unk3024 = 0; @@ -4794,17 +4771,11 @@ void sub_8029274(struct DodrioSubstruct_0160 *ptr) sub_802A72C(sub_8029338); } -void sub_80292D4(void) +static void sub_80292D4(void) { FreeAllWindowBuffers(); } -struct -{ - u8 id; - void (*func)(void); -} extern const gUnknown_082FB40C[]; - // Data used by functions below. struct WinCoords { @@ -4812,7 +4783,7 @@ struct WinCoords u8 top; }; -const u8 gUnknown_082FB380[][3] = +static const u8 gUnknown_082FB380[][3] = { {1, 2, 3}, {1, 4, 5}, @@ -4820,13 +4791,13 @@ const u8 gUnknown_082FB380[][3] = {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}}; +static const struct WinCoords gUnknown_082FB38C[] = {{12, 6}}; +static const struct WinCoords gUnknown_082FB390[] = {{9, 10}, {15, 6}}; +static const struct WinCoords gUnknown_082FB398[] = {{12, 6}, {18, 10}, {6, 10}}; +static const struct WinCoords gUnknown_082FB3A4[] = {{9, 10}, {15, 6}, {21, 10}, {3, 6}}; +static const struct WinCoords gUnknown_082FB3B4[] = {{12, 6}, {18, 10}, {23, 6}, {1, 6}, {6, 10}}; -const struct WinCoords *const gUnknown_082FB3C8[] = +static const struct WinCoords *const gUnknown_082FB3C8[] = { gUnknown_082FB38C, gUnknown_082FB390, @@ -4835,7 +4806,38 @@ const struct WinCoords *const gUnknown_082FB3C8[] = gUnknown_082FB3B4, }; -void sub_80292E0(u8 arg0) +static const u8 *const gUnknown_082FB3DC[] = +{ + gText_1Colon, + gText_2Colon, + gText_3Colon, + gText_4Colon, + gText_5Colon, +}; + +static const u16 gUnknown_082FB3F0[] = {92, 132, 172, 212}; +static const u16 gUnknown_082FB3F8[] = {33, 49, 65, 81, 97}; +static const u16 gUnknown_082FB402[] = {17, 33, 49, 65, 81}; + +struct +{ + u8 id; + void (*func)(void); +} const gUnknown_082FB40C[] = +{ + {0, sub_8029338}, + {1, sub_8029440}, + {2, sub_802988C}, + {3, sub_802A010}, + {4, sub_802A380}, + {5, sub_802A454}, + {6, sub_802A534}, + {7, sub_802A588}, + {8, sub_802A6FC}, + {9, nullsub_16}, +}; + +static void sub_80292E0(u8 arg0) { u8 i; for (i = 0; i < 10; i++) @@ -4845,23 +4847,23 @@ void sub_80292E0(u8 arg0) } } -void sub_8029314(u8 taskId) +static void sub_8029314(u8 taskId) { - if (!gUnknown_02022CF8->unk3000) + if (!gUnknown_02022CF8->finished) sub_802A75C()(); } -void sub_8029338(void) +static void sub_8029338(void) { - switch (gUnknown_02022CF8->unk3014) + switch (gUnknown_02022CF8->state) { case 0: sub_802A7A8(); - gUnknown_02022CF8->unk3014++; + gUnknown_02022CF8->state++; break; case 1: if (sub_802A8E8() == TRUE) - gUnknown_02022CF8->unk3014++; + gUnknown_02022CF8->state++; break; case 2: CopyToBgTilemapBuffer(3, gDodrioBerryBgTilemap1, 0, 0); @@ -4870,34 +4872,34 @@ void sub_8029338(void) CopyBgTilemapBufferToVram(3); CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(2); - gUnknown_02022CF8->unk3014++; + gUnknown_02022CF8->state++; break; case 3: ShowBg(0); ShowBg(3); ShowBg(1); ShowBg(2); - gUnknown_02022CF8->unk3014++; + gUnknown_02022CF8->state++; break; case 4: sub_8028FF8(gSaveBlock2Ptr->optionsWindowFrameType); sub_802902C(); - gUnknown_02022CF8->unk3014++; + gUnknown_02022CF8->state++; break; default: - gUnknown_02022CF8->unk3000 = 1; + gUnknown_02022CF8->finished = TRUE; break; } } -void sub_8029440(void) +static void sub_8029440(void) { u8 i, playersCount, id, colorsId, *name; u32 left; struct WindowTemplate window; const struct WinCoords *ptr; - switch (gUnknown_02022CF8->unk3014) + switch (gUnknown_02022CF8->state) { case 0: playersCount = sub_8027650(); @@ -4925,7 +4927,7 @@ void sub_8029440(void) window.baseBlock += 0xE; sub_8029174(&window); } - gUnknown_02022CF8->unk3014++; + gUnknown_02022CF8->state++; break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) @@ -4934,11 +4936,11 @@ void sub_8029440(void) for (i = 0; i < playersCount; i++) PutWindowTilemap(gUnknown_02022CF8->unk3008[i]); CopyBgTilemapBufferToVram(0); - gUnknown_02022CF8->unk3014++; + gUnknown_02022CF8->state++; } break; default: - if (++gUnknown_02022CF8->unk3014 > 180) + if (++gUnknown_02022CF8->state > 180) { playersCount = sub_8027650(); for (i = 0; i < playersCount; i++) @@ -4948,8 +4950,534 @@ void sub_8029440(void) } FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); CopyBgTilemapBufferToVram(0); - gUnknown_02022CF8->unk3000 = 1; + gUnknown_02022CF8->finished = TRUE; } break; } } + +static void sub_80296A8(u8 playersCount_) +{ + u8 i, r8 = 0, r6 = 0; + u8 playersCount = playersCount_; // Pointless variable, I know, but it's needed to match. + u8 *name; + u32 x, numWidth; + u8 numString[32]; + u8 array[5] = {0, 1, 2, 3, 4}; + struct DodrioSubstruct_3308 temp, structArray[5]; + + for (i = 0; i < playersCount; i++) + { + array[i] = i; + sub_802793C(&temp, i); + structArray[i] = temp; + } + + if (sub_8027748() != 0) + { + do + { + for (i = 0; i < playersCount; i++) + { + if (structArray[i].unk0 == r8) + { + array[r6] = i; + r6++; + } + } + r8 = r6; + } while (r6 < playersCount); + } + + for (i = 0; i < playersCount; i++) + { + if (structArray[i].unk4 == 0) + structArray[i].unk0 = playersCount - 1; + } + + x = 216 - GetStringWidth(1, gText_SpacePoints, 0); + for (i = 0; i < playersCount; i++) + { + u8 colorsId = 0; + u8 id = array[i]; + u32 points = structArray[id].unk4; + + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gUnknown_082FB3DC[structArray[id].unk0], 8, gUnknown_082FB402[i], -1, NULL); + if (id == GetMultiplayerId()) + colorsId = 2; + name = sub_8027660(id); + AddTextPrinterParameterized3(gUnknown_02022CF8->unk3008[1], 1, 28, gUnknown_082FB402[i], gUnknown_082FB380[colorsId], -1, name); + ConvertIntToDecimalStringN(numString, points, STR_CONV_MODE_LEFT_ALIGN, 7); + numWidth = GetStringWidth(1, numString, -1); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, numString, x - numWidth, gUnknown_082FB402[i], -1, NULL); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_SpacePoints, x, gUnknown_082FB402[i], -1, NULL); + } +} + +static void sub_802988C(void) +{ + u8 i, j, itemGiveRet, playersCount = sub_8027650(); + u8 *name; + u32 strWidth, x; + + switch (gUnknown_02022CF8->state) + { + case 0: + sub_802784C(); + gUnknown_02022CF8->unk301C = 0; + gUnknown_02022CF8->state++; + break; + case 1: + gUnknown_02022CF8->unk3008[0] = AddWindow(&gUnknown_082F7BBC[0]); + gUnknown_02022CF8->unk3008[1] = AddWindow(&gUnknown_082F7BBC[1]); + ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); + ClearWindowTilemap(gUnknown_02022CF8->unk3008[1]); + sub_8029174(&gUnknown_082F7BBC[0]); + sub_8029174(&gUnknown_082F7BBC[1]); + gUnknown_02022CF8->state++; + break; + case 2: + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[0], PIXEL_FILL(1)); + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[1], PIXEL_FILL(1)); + strWidth = GetStringWidth(1, gText_BerryPickingResults, -1); + x = (224 - strWidth) / 2; + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[0], 1, gText_BerryPickingResults, x, 1, -1, NULL); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_10P30P50P50P, 68, 17, -1, NULL); + for (i = 0; i < playersCount; i++) + { + u8 colorsId = 0; + if (i == GetMultiplayerId()) + colorsId = 2; + + name = sub_8027660(i); + AddTextPrinterParameterized3(gUnknown_02022CF8->unk3008[1], 1, 0, gUnknown_082FB3F8[i], gUnknown_082FB380[colorsId], -1, name); + for (j = 0; j < 4; j++) + { + u32 width; + u16 result1 = Min(sub_80276A0(i, j), 9999); + u16 result2 = Min(sub_802778C(j), 9999); + + ConvertIntToDecimalStringN(gStringVar4, result1, STR_CONV_MODE_LEFT_ALIGN, 4); + width = GetStringWidth(1, gStringVar4, -1); + if (result2 == result1 && result2 != 0) + AddTextPrinterParameterized3(gUnknown_02022CF8->unk3008[1], 1, gUnknown_082FB3F0[j] - width, gUnknown_082FB3F8[i], gUnknown_082FB380[1], -1, gStringVar4); + else + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gStringVar4, gUnknown_082FB3F0[j] - width, gUnknown_082FB3F8[i], -1, NULL); + } + } + CopyWindowToVram(gUnknown_02022CF8->unk3008[0], 2); + CopyWindowToVram(gUnknown_02022CF8->unk3008[1], 2); + gUnknown_02022CF8->state++; + break; + case 3: + if (!IsDma3ManagerBusyWithBgCopy()) + { + PutWindowTilemap(gUnknown_02022CF8->unk3008[0]); + PutWindowTilemap(gUnknown_02022CF8->unk3008[1]); + } + CopyBgTilemapBufferToVram(0); + sub_8028C30(FALSE); + gUnknown_02022CF8->state++; + break; + case 4: + if (++gUnknown_02022CF8->unk301C >= 30 && gMain.newKeys & A_BUTTON) + { + gUnknown_02022CF8->unk301C = 0; + PlaySE(SE_SELECT); + sub_8028C30(TRUE); + gUnknown_02022CF8->state++; + } + break; + case 5: + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[0], PIXEL_FILL(1)); + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[1], PIXEL_FILL(1)); + strWidth = GetStringWidth(1, gText_AnnouncingRankings, -1); + x = (224 - strWidth) / 2; + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[0], 1, gText_AnnouncingRankings, x, 1, -1, NULL); + gUnknown_02022CF8->state++; + break; + case 6: + sub_80296A8(playersCount); + CopyWindowToVram(gUnknown_02022CF8->unk3008[0], 2); + CopyWindowToVram(gUnknown_02022CF8->unk3008[1], 2); + gUnknown_02022CF8->state++; + break; + case 7: + if (!IsDma3ManagerBusyWithBgCopy()) + { + PutWindowTilemap(gUnknown_02022CF8->unk3008[0]); + PutWindowTilemap(gUnknown_02022CF8->unk3008[1]); + } + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->state++; + break; + case 8: + if (++gUnknown_02022CF8->unk301C >= 30 && gMain.newKeys & A_BUTTON) + { + gUnknown_02022CF8->unk301C = 0; + PlaySE(SE_SELECT); + if (sub_8027748() < 3000) + { + gUnknown_02022CF8->state = 127; + } + else + { + StopMapMusic(); + gUnknown_02022CF8->state++; + } + + FillBgTilemapBufferRect_Palette0(0, 0, 0, 5, 30, 15); + RemoveWindow(gUnknown_02022CF8->unk3008[1]); + gUnknown_02022CF8->unk3008[1] = AddWindow(&gUnknown_082F7BCC); + ClearWindowTilemap(gUnknown_02022CF8->unk3008[1]); + sub_8029174(&gUnknown_082F7BCC); + } + break; + case 9: + PlayNewMapMusic(MUS_FANFA1); + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[0], PIXEL_FILL(1)); + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[1], PIXEL_FILL(1)); + strWidth = GetStringWidth(1, gText_AnnouncingPrizes, -1); + x = (224 - strWidth) / 2; + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[0], 1, gText_AnnouncingPrizes, x, 1, -1, NULL); + DynamicPlaceholderTextUtil_Reset(); + CopyItemName(sub_802762C(), gStringVar1); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1); + DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gText_FirstPlacePrize); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gStringVar4, 0, 1, -1, NULL); + itemGiveRet = sub_80279C8(); + if (itemGiveRet != 0 && itemGiveRet != 3) + { + DynamicPlaceholderTextUtil_Reset(); + CopyItemName(sub_802762C(), gStringVar1); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1); + if (itemGiveRet == 2) + DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gText_CantHoldAnyMore); + else if (itemGiveRet == 1) + DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gText_FilledStorageSpace); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gStringVar4, 0, 41, -1, NULL); + } + CopyWindowToVram(gUnknown_02022CF8->unk3008[0], 2); + CopyWindowToVram(gUnknown_02022CF8->unk3008[1], 2); + gUnknown_02022CF8->state++; + break; + case 10: + if (!IsDma3ManagerBusyWithBgCopy()) + { + PutWindowTilemap(gUnknown_02022CF8->unk3008[0]); + PutWindowTilemap(gUnknown_02022CF8->unk3008[1]); + } + CopyBgTilemapBufferToVram(0); + FadeOutAndFadeInNewMapMusic(MUS_RG_WIN_YASEI, 20, 10); + gUnknown_02022CF8->state++; + break; + case 11: + if (++gUnknown_02022CF8->unk301C >= 30 && gMain.newKeys & A_BUTTON) + { + gUnknown_02022CF8->unk301C = 0; + PlaySE(SE_SELECT); + gUnknown_02022CF8->state++; + } + break; + default: + ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); + ClearWindowTilemap(gUnknown_02022CF8->unk3008[1]); + RemoveWindow(gUnknown_02022CF8->unk3008[0]); + RemoveWindow(gUnknown_02022CF8->unk3008[1]); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->finished = TRUE; + break; + } +} + +static void sub_802A010(void) +{ + u8 y; + + switch (gUnknown_02022CF8->state) + { + case 0: + gUnknown_02022CF8->unk3008[0] = AddWindow(&gUnknown_082F7BD4[0]); + gUnknown_02022CF8->unk3008[1] = AddWindow(&gUnknown_082F7BD4[1]); + ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); + ClearWindowTilemap(gUnknown_02022CF8->unk3008[1]); + sub_8029174(&gUnknown_082F7BD4[0]); + sub_8029074(&gUnknown_082F7BD4[1]); + gUnknown_02022CF8->state++; + gUnknown_02022CF8->unk3020 = 0; + gUnknown_02022CF8->unk3024 = 0; + break; + case 1: + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[0], PIXEL_FILL(1)); + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[1], PIXEL_FILL(1)); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[0], 1, gText_WantToPlayAgain, 0, 5, -1, NULL); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_Yes, 8, 1, -1, NULL); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_No, 8, 17, -1, NULL); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_SelectorArrow2, 0, 1, -1, NULL); + CopyWindowToVram(gUnknown_02022CF8->unk3008[0], 2); + CopyWindowToVram(gUnknown_02022CF8->unk3008[1], 2); + gUnknown_02022CF8->state++; + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + { + PutWindowTilemap(gUnknown_02022CF8->unk3008[0]); + PutWindowTilemap(gUnknown_02022CF8->unk3008[1]); + } + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->state++; + break; + case 3: + y = gUnknown_02022CF8->unk3020; + if (y == 0) + y = 1; + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[1], PIXEL_FILL(1)); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_Yes, 8, 1, -1, NULL); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_No, 8, 17, -1, NULL); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_SelectorArrow2, 0, ((y - 1) * 16) + 1, -1, NULL); + CopyWindowToVram(gUnknown_02022CF8->unk3008[1], 3); + // Increment state only if A or B button have been pressed. + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + if (gUnknown_02022CF8->unk3020 == 0) + gUnknown_02022CF8->unk3020 = 1; + gUnknown_02022CF8->state++; + } + else if (gMain.newKeys & (DPAD_UP | DPAD_DOWN)) + { + PlaySE(SE_SELECT); + switch (gUnknown_02022CF8->unk3020) + { + case 0: + gUnknown_02022CF8->unk3020 = 2; + break; + case 1: + gUnknown_02022CF8->unk3020 = 2; + break; + case 2: + gUnknown_02022CF8->unk3020 = 1; + break; + } + } + else if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + gUnknown_02022CF8->unk3020 = 2; + gUnknown_02022CF8->state++; + } + break; + default: + gUnknown_02022CF8->unk3024 = gUnknown_02022CF8->unk3020; + ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); + ClearWindowTilemap(gUnknown_02022CF8->unk3008[1]); + RemoveWindow(gUnknown_02022CF8->unk3008[0]); + RemoveWindow(gUnknown_02022CF8->unk3008[1]); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->finished = TRUE; + break; + } +} + +static void sub_802A380(void) +{ + switch (gUnknown_02022CF8->state) + { + case 0: + DrawDialogueFrame(0, FALSE); + AddTextPrinterParameterized2(0, 1, gText_SavingDontTurnOffPower, 0, NULL, 2, 1, 3); + gUnknown_02022CF8->state++; + break; + case 1: + CopyWindowToVram(0, 3); + gUnknown_02022CF8->state++; + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + { + CreateTask(sub_8153688, 0); + gUnknown_02022CF8->state++; + } + break; + case 3: + if (!FuncIsActiveTask(sub_8153688)) + gUnknown_02022CF8->state++; + break; + default: + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->finished = TRUE; + break; + } +} + +static void sub_802A454(void) +{ + switch (gUnknown_02022CF8->state) + { + case 0: + gUnknown_02022CF8->unk3008[0] = AddWindow(&gUnknown_082F7BEC); + ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); + sub_8029174(&gUnknown_082F7BEC); + gUnknown_02022CF8->state++; + break; + case 1: + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[0], PIXEL_FILL(1)); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[0], 1, gText_CommunicationStandby3, 0, 5, -1, NULL); + CopyWindowToVram(gUnknown_02022CF8->unk3008[0], 2); + gUnknown_02022CF8->state++; + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + PutWindowTilemap(gUnknown_02022CF8->unk3008[0]); + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->state++; + break; + default: + gUnknown_02022CF8->finished = TRUE; + break; + } +} + +static void sub_802A534(void) +{ + ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); + RemoveWindow(gUnknown_02022CF8->unk3008[0]); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->finished = TRUE; +} + +static void sub_802A588(void) +{ + switch (gUnknown_02022CF8->state) + { + case 0: + gUnknown_02022CF8->unk3008[0] = AddWindow(&gUnknown_082F7BE4); + ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); + sub_8029174(&gUnknown_082F7BE4); + gUnknown_02022CF8->state++; + gUnknown_02022CF8->unk301C = 0; + gUnknown_02022CF8->unk3020 = 0; + gUnknown_02022CF8->unk3024 = 0; + break; + case 1: + FillWindowPixelBuffer(gUnknown_02022CF8->unk3008[0], PIXEL_FILL(1)); + AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[0], 1, gText_SomeoneDroppedOut, 0, 5, -1, NULL); + CopyWindowToVram(gUnknown_02022CF8->unk3008[0], 2); + gUnknown_02022CF8->state++; + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + PutWindowTilemap(gUnknown_02022CF8->unk3008[0]); + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->state++; + break; + case 3: + if (++gUnknown_02022CF8->unk301C >= 120) + gUnknown_02022CF8->state++; + break; + default: + gUnknown_02022CF8->unk3024 = 5; + ClearWindowTilemap(gUnknown_02022CF8->unk3008[0]); + RemoveWindow(gUnknown_02022CF8->unk3008[0]); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(0); + gUnknown_02022CF8->finished = TRUE; + break; + } +} + +static void sub_802A6FC(void) +{ + DestroyTask(gUnknown_02022CF8->unk3004); + gUnknown_02022CF8->finished = TRUE; +} + +static void nullsub_16(void) +{ + +} + +static void sub_802A72C(void (*func)(void)) +{ + gUnknown_02022CF8->state = 0; + gUnknown_02022CF8->finished = FALSE; + gUnknown_02022CF8->unk3028 = func; +} + +static void (*sub_802A75C(void))(void) +{ + return gUnknown_02022CF8->unk3028; +} + +static bool32 sub_802A770(void) +{ + if (gUnknown_02022CF8->finished == TRUE) + return FALSE; + else + return TRUE; +} + +static u8 sub_802A794(void) +{ + return gUnknown_02022CF8->unk3024; +} + +static void sub_802A7A8(void) +{ + DmaClearLarge16(3, (void *)VRAM, VRAM_SIZE, 0x1000); + DmaClear32(3,(void *)OAM, OAM_SIZE); + DmaClear16(3, (void *)PLTT, PLTT_SIZE); + SetGpuReg(REG_OFFSET_DISPCNT, 0); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_082F7BA4, ARRAY_COUNT(gUnknown_082F7BA4)); + ChangeBgX(0, 0, 0); + ChangeBgY(0, 0, 0); + ChangeBgX(1, 0, 0); + ChangeBgY(1, 0, 0); + ChangeBgX(2, 0, 0); + ChangeBgY(2, 0, 0); + ChangeBgX(3, 0, 0); + ChangeBgY(3, 0, 0); + InitStandardTextBoxWindows(); + sub_8197200(); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); + SetBgTilemapBuffer(3, gUnknown_02022CF8->tilemapBuffers[0]); + SetBgTilemapBuffer(1, gUnknown_02022CF8->tilemapBuffers[1]); + SetBgTilemapBuffer(2, gUnknown_02022CF8->tilemapBuffers[2]); +} + +static bool32 sub_802A8E8(void) +{ + switch (gUnknown_02022CF8->unk3018) + { + case 0: + LoadPalette(gDodrioBerryBgPal1, 0, sizeof(gDodrioBerryBgPal1)); + break; + case 1: + reset_temp_tile_data_buffers(); + break; + case 2: + decompress_and_copy_tile_data_to_vram(3, gDodrioBerryBgGfx1, 0, 0, 0); + break; + case 3: + decompress_and_copy_tile_data_to_vram(1, gDodrioBerryBgGfx2, 0, 0, 0); + break; + case 4: + if (free_temp_tile_data_buffers_if_possible() == TRUE) + return FALSE; + break; + case 5: + LoadPalette(stdpal_get(3), 0xD0, 0x20); + break; + default: + gUnknown_02022CF8->unk3018 = 0; + return TRUE; + } + + gUnknown_02022CF8->unk3018++; + return FALSE; +} diff --git a/src/union_room.c b/src/union_room.c index 486771af73..01288c8cc0 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -1,53 +1,54 @@ #include "global.h" -#include "window.h" +#include "alloc.h" +#include "battle.h" +#include "berry_crush.h" #include "bg.h" -#include "random.h" -#include "string_util.h" -#include "task.h" +#include "cable_club.h" +#include "data.h" +#include "decompress.h" +#include "dodrio_berry_picking.h" +#include "dynamic_placeholder_text_util.h" +#include "easy_chat.h" #include "event_data.h" +#include "event_obj_lock.h" +#include "field_control_avatar.h" +#include "field_player_avatar.h" +#include "field_screen_effect.h" +#include "field_weather.h" +#include "international_string_util.h" +#include "librfu.h" #include "link.h" #include "link_rfu.h" -#include "librfu.h" -#include "alloc.h" -#include "menu.h" #include "list_menu.h" +#include "load_save.h" +#include "menu.h" #include "menu_helpers.h" +#include "mevent.h" +#include "mystery_gift.h" +#include "overworld.h" +#include "palette.h" +#include "party_menu.h" +#include "pokemon_jump.h" +#include "random.h" #include "script.h" +#include "script_pokemon_util_80F87D8.h" #include "sound.h" -#include "constants/songs.h" -#include "constants/game_stat.h" -#include "constants/maps.h" -#include "constants/species.h" -#include "constants/rgb.h" -#include "constants/battle_frontier.h" +#include "start_menu.h" +#include "string_util.h" +#include "strings.h" +#include "task.h" #include "trade.h" #include "trainer_card.h" -#include "overworld.h" -#include "battle.h" -#include "load_save.h" -#include "cable_club.h" -#include "field_control_avatar.h" -#include "party_menu.h" -#include "field_weather.h" -#include "palette.h" -#include "decompress.h" -#include "start_menu.h" -#include "data.h" -#include "field_screen_effect.h" -#include "script_pokemon_util_80F87D8.h" -#include "international_string_util.h" -#include "field_player_avatar.h" -#include "strings.h" -#include "mevent.h" -#include "dynamic_placeholder_text_util.h" #include "union_room.h" -#include "easy_chat.h" -#include "event_obj_lock.h" #include "union_room_chat.h" -#include "berry_crush.h" -#include "mystery_gift.h" #include "union_room_player_avatar.h" -#include "pokemon_jump.h" +#include "window.h" +#include "constants/battle_frontier.h" +#include "constants/game_stat.h" +#include "constants/maps.h" +#include "constants/rgb.h" +#include "constants/songs.h" +#include "constants/species.h" EWRAM_DATA u8 gUnknown_02022C20[12] = {}; EWRAM_DATA u8 gUnknown_02022C2C = 0; @@ -98,7 +99,6 @@ bool32 sub_8017678(struct UnkStruct_Shared *arg0, struct UnkStruct_Shared *arg1) u32 sub_8018120(struct TradeUnkStruct *arg0, u8 multiplayerId); void sub_801807C(struct TradeUnkStruct *arg0); void sub_801AC54(void); -void sub_802493C(u8 monId, MainCallback callback); void sub_80149D8(void); void MG_DrawTextBorder(u8 windowId); s8 mevent_message_print_and_prompt_yes_no(u8 *textState, u8 *arg1, u8 arg2, const u8 *str);