diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index ed32e4643..7a1af4c17 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -403,6 +403,38 @@ .byte \param0 .byte \param1 .endm + + @ Help macros for 5 uses of moveend command + + @ All cases + .macro moveendall + setbyte sMOVEEND_STATE, 0 + moveend 0, 0 + .endm + + @ Chosen case + .macro moveendcase case:req + setbyte sMOVEEND_STATE, \case + moveend 1, 0 + .endm + + @ All cases from (inclusive) + .macro moveendfrom from:req + setbyte sMOVEEND_STATE, \from + moveend 0, 0 + .endm + + @ All cases from 0 to (not inclusive) + .macro moveendto to:req + setbyte sMOVEEND_STATE, 0 + moveend 2, \to + .endm + + @ Cases from (inclusive) to (not inclusive) + .macro moveendfromto from:req, to:req + setbyte sMOVEEND_STATE, \from + moveend 2, \to + .endm .macro typecalc2 .byte 0x4a diff --git a/asm/mevent_801BAAC.s b/asm/mevent_801BAAC.s deleted file mode 100755 index 1253aab2d..000000000 --- a/asm/mevent_801BAAC.s +++ /dev/null @@ -1,2622 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_801BAAC -sub_801BAAC: @ 801BAAC - push {r4-r7,lr} - adds r5, r0, 0 - adds r6, r1, 0 - cmp r5, 0 - beq _0801BAC8 - cmp r6, 0 - beq _0801BAC8 - ldr r7, =gUnknown_02022C74 - ldr r0, =0x0000145c - bl AllocZeroed - str r0, [r7] - cmp r0, 0 - bne _0801BAD4 -_0801BAC8: - movs r0, 0 - b _0801BB3E - .pool -_0801BAD4: - movs r4, 0xA6 - lsls r4, 1 - adds r1, r5, 0 - adds r2, r4, 0 - bl memcpy - ldr r1, [r7] - adds r1, r4 - adds r0, r6, 0 - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldr r2, [r7] - ldrb r1, [r2, 0x8] - lsls r0, r1, 26 - lsrs r0, 28 - cmp r0, 0x7 - bls _0801BB06 - movs r0, 0x3D - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x8] -_0801BB06: - ldr r2, [r7] - ldrb r1, [r2, 0x8] - lsls r0, r1, 30 - lsrs r0, 30 - cmp r0, 0x2 - bls _0801BB1A - movs r0, 0x4 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x8] -_0801BB1A: - ldr r1, [r7] - ldrb r0, [r1, 0x9] - cmp r0, 0x7 - bls _0801BB26 - movs r0, 0 - strb r0, [r1, 0x9] -_0801BB26: - ldr r0, [r7] - movs r1, 0xB8 - lsls r1, 1 - adds r2, r0, r1 - ldrb r0, [r0, 0x8] - lsls r0, 26 - lsrs r0, 28 - lsls r0, 4 - ldr r1, =gUnknown_082F1D60 - adds r0, r1 - str r0, [r2] - movs r0, 0x1 -_0801BB3E: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801BAAC - - thumb_func_start sub_801BB48 -sub_801BB48: @ 801BB48 - push {r4,lr} - ldr r4, =gUnknown_02022C74 - ldr r0, [r4] - cmp r0, 0 - beq _0801BB64 - ldr r2, =0x0000145c - movs r1, 0 - bl memset - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] -_0801BB64: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801BB48 - - thumb_func_start sub_801BB74 -sub_801BB74: @ 801BB74 - push {r4-r6,lr} - sub sp, 0x24 - ldr r5, =gUnknown_02022C74 - ldr r0, [r5] - cmp r0, 0 - bne _0801BB8C - movs r0, 0x1 - negs r0, r0 - b _0801BD98 - .pool -_0801BB8C: - movs r4, 0xBA - lsls r4, 1 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0x7 - bls _0801BB9A - b _0801BD70 -_0801BB9A: - lsls r0, 2 - ldr r1, =_0801BBA8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801BBA8: - .4byte _0801BBC8 - .4byte _0801BBDA - .4byte _0801BBE8 - .4byte _0801BC8C - .4byte _0801BD14 - .4byte _0801BD1A - .4byte _0801BD34 - .4byte _0801BD3A -_0801BBC8: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _0801BD86 -_0801BBDA: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _0801BBE6 - b _0801BD86 -_0801BBE6: - b _0801BD96 -_0801BBE8: - movs r5, 0x1E - str r5, [sp] - movs r4, 0x14 - str r4, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r5, [sp] - str r4, [sp, 0x4] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r5, [sp] - str r4, [sp, 0x4] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - ldr r5, =gUnknown_02022C74 - ldr r0, [r5] - movs r1, 0xB8 - lsls r1, 1 - adds r0, r1 - ldr r0, [r0] - ldr r1, [r0, 0x4] - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - movs r2, 0 - movs r3, 0x8 - bl decompress_and_copy_tile_data_to_vram - ldr r4, =gUnknown_082F0E1C - adds r0, r4, 0 - bl AddWindow - ldr r1, [r5] - movs r2, 0xBB - lsls r2, 1 - adds r1, r2 - strh r0, [r1] - adds r0, r4, 0 - adds r0, 0x8 - bl AddWindow - ldr r1, [r5] - movs r2, 0xBC - lsls r2, 1 - adds r1, r2 - strh r0, [r1] - adds r4, 0x10 - adds r0, r4, 0 - bl AddWindow - ldr r1, [r5] - movs r2, 0xBD - lsls r2, 1 - adds r1, r2 - strh r0, [r1] - b _0801BD86 - .pool -_0801BC8C: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0 - beq _0801BC9A - b _0801BD96 -_0801BC9A: - movs r0, 0x1 - bl stdpal_get - movs r1, 0x20 - movs r2, 0x20 - bl LoadPalette - ldr r2, =gPaletteFade - ldrb r0, [r2, 0x8] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2, 0x8] - ldr r5, =gUnknown_02022C74 - ldr r0, [r5] - movs r4, 0xB8 - lsls r4, 1 - adds r0, r4 - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x10 - movs r2, 0x20 - bl LoadPalette - ldr r1, [r5] - adds r4, r1, r4 - ldr r0, [r4] - ldr r0, [r0, 0x8] - ldr r4, =0x0000045c - adds r1, r4 - bl LZ77UnCompWram - ldr r1, [r5] - adds r1, r4 - movs r2, 0x1E - str r2, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - str r6, [sp, 0x8] - str r6, [sp, 0xC] - str r2, [sp, 0x10] - str r0, [sp, 0x14] - movs r0, 0x1 - str r0, [sp, 0x18] - movs r0, 0x8 - str r0, [sp, 0x1C] - str r6, [sp, 0x20] - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl CopyRectToBgTilemapBufferRect - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - b _0801BD86 - .pool -_0801BD14: - bl sub_801BEF8 - b _0801BD86 -_0801BD1A: - movs r0, 0 - bl sub_801C178 - movs r0, 0x1 - bl sub_801C178 - movs r0, 0x2 - bl sub_801C178 - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - b _0801BD86 -_0801BD34: - bl LoadMonIconPalettes - b _0801BD86 -_0801BD3A: - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x8] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x8] - bl sub_801C4C0 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - bl UpdatePaletteFade - b _0801BD86 - .pool -_0801BD70: - bl UpdatePaletteFade - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _0801BD96 - ldr r0, [r5] - adds r0, r4 - strb r1, [r0] - movs r0, 0x1 - b _0801BD98 -_0801BD86: - ldr r0, =gUnknown_02022C74 - ldr r1, [r0] - movs r0, 0xBA - lsls r0, 1 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_0801BD96: - movs r0, 0 -_0801BD98: - add sp, 0x24 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801BB74 - - thumb_func_start sub_801BDA4 -sub_801BDA4: @ 801BDA4 - push {r4,r5,lr} - sub sp, 0x8 - adds r2, r0, 0 - ldr r5, =gUnknown_02022C74 - ldr r0, [r5] - cmp r0, 0 - bne _0801BDBC - movs r0, 0x1 - negs r0, r0 - b _0801BEEC - .pool -_0801BDBC: - movs r4, 0xBA - lsls r4, 1 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0x5 - bls _0801BDCA - b _0801BEC4 -_0801BDCA: - lsls r0, 2 - ldr r1, =_0801BDD8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801BDD8: - .4byte _0801BDF0 - .4byte _0801BE02 - .4byte _0801BE0E - .4byte _0801BE56 - .4byte _0801BE94 - .4byte _0801BE9E -_0801BDF0: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _0801BEDA -_0801BE02: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - beq _0801BEDA - b _0801BEEA -_0801BE0E: - movs r5, 0x1E - str r5, [sp] - movs r4, 0x14 - str r4, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r5, [sp] - str r4, [sp, 0x4] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r5, [sp] - str r4, [sp, 0x4] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - b _0801BEDA -_0801BE56: - movs r0, 0x1 - bl HideBg - movs r0, 0x2 - bl HideBg - ldr r4, =gUnknown_02022C74 - ldr r0, [r4] - movs r1, 0xBD - lsls r1, 1 - adds r0, r1 - ldrb r0, [r0] - bl RemoveWindow - ldr r0, [r4] - movs r1, 0xBC - lsls r1, 1 - adds r0, r1 - ldrb r0, [r0] - bl RemoveWindow - ldr r0, [r4] - movs r1, 0xBB - lsls r1, 1 - adds r0, r1 - ldrb r0, [r0] - bl RemoveWindow - b _0801BEDA - .pool -_0801BE94: - bl sub_801C61C - bl FreeMonIconPalettes - b _0801BEDA -_0801BE9E: - ldr r0, =gUnknown_02022C60 - ldrb r0, [r0] - adds r1, r2, 0 - bl sub_80186EC - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - b _0801BEDA - .pool -_0801BEC4: - bl UpdatePaletteFade - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _0801BEEA - ldr r0, [r5] - adds r0, r4 - strb r1, [r0] - movs r0, 0x1 - b _0801BEEC -_0801BEDA: - ldr r0, =gUnknown_02022C74 - ldr r1, [r0] - movs r0, 0xBA - lsls r0, 1 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_0801BEEA: - movs r0, 0 -_0801BEEC: - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801BDA4 - - thumb_func_start sub_801BEF8 -sub_801BEF8: @ 801BEF8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - movs r5, 0 - mov r0, sp - movs r1, 0 - movs r2, 0x6 - bl memset - ldr r4, =gUnknown_02022C74 - ldr r1, [r4] - ldr r2, =0x0000018b - adds r0, r1, r2 - adds r1, 0xA - movs r2, 0x28 - bl memcpy - ldr r0, [r4] - ldr r3, =0x000001b3 - adds r1, r0, r3 - movs r0, 0xFF - strb r0, [r1] - ldr r1, [r4] - movs r2, 0xDA - lsls r2, 1 - adds r0, r1, r2 - adds r1, 0x32 - movs r2, 0x28 - bl memcpy - ldr r0, [r4] - movs r3, 0xEE - lsls r3, 1 - adds r0, r3 - movs r1, 0x1 - negs r1, r1 - strb r1, [r0] - ldr r1, [r4] - ldr r0, [r1, 0x4] - ldr r2, =0x000f423f - cmp r0, r2 - bls _0801BF54 - str r2, [r1, 0x4] -_0801BF54: - ldr r1, [r4] - ldr r2, =0x000001dd - adds r0, r1, r2 - ldr r1, [r1, 0x4] - movs r2, 0 - movs r3, 0x6 - bl ConvertIntToDecimalStringN - adds r6, r4, 0 -_0801BF66: - ldr r2, [r6] - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r4, r1, r5 - adds r0, r4, r2 - movs r3, 0xF2 - lsls r3, 1 - adds r0, r3 - adds r1, r2 - adds r1, 0x5A - movs r2, 0x28 - bl memcpy - ldr r1, [r6] - movs r0, 0x83 - lsls r0, 2 - adds r1, r0 - adds r1, r4 - movs r2, 0x1 - negs r2, r2 - adds r7, r2, 0 - movs r0, 0xFF - strb r0, [r1] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x3 - bls _0801BF66 - ldr r6, =gUnknown_02022C74 - ldr r1, [r6] - movs r3, 0xA2 - lsls r3, 2 - adds r0, r1, r3 - adds r1, 0xFA - movs r2, 0x28 - bl memcpy - ldr r0, [r6] - movs r4, 0xAC - lsls r4, 2 - adds r0, r4 - movs r1, 0x1 - negs r1, r1 - adds r4, r1, 0 - movs r1, 0xFF - strb r1, [r0] - ldr r1, [r6] - ldrb r0, [r1, 0x8] - lsls r0, 30 - lsrs r0, 30 - cmp r0, 0x1 - beq _0801C018 - cmp r0, 0x1 - bgt _0801BFF0 - cmp r0, 0 - beq _0801BFF6 - b _0801C168 - .pool -_0801BFF0: - cmp r0, 0x2 - beq _0801C028 - b _0801C168 -_0801BFF6: - ldr r2, =0x000002b1 - adds r0, r1, r2 - movs r3, 0x91 - lsls r3, 1 - adds r1, r3 - movs r2, 0x28 - bl memcpy - ldr r1, [r6] - ldr r0, =0x000002d9 - adds r1, r0 - b _0801C01C - .pool -_0801C018: - ldr r2, =0x000002b1 - adds r1, r2 -_0801C01C: - ldrb r0, [r1] - orrs r0, r4 - strb r0, [r1] - b _0801C168 - .pool -_0801C028: - ldr r3, =0x000002b1 - adds r0, r1, r3 - ldrb r1, [r0] - orrs r1, r7 - strb r1, [r0] - mov r3, sp - ldr r1, [r6] - movs r4, 0xA6 - lsls r4, 1 - adds r0, r1, r4 - ldrh r0, [r0] - ldr r2, =0x000003e7 - cmp r0, r2 - bls _0801C046 - adds r0, r2, 0 -_0801C046: - strh r0, [r3] - mov r3, sp - movs r4, 0xA7 - lsls r4, 1 - adds r0, r1, r4 - ldrh r0, [r0] - cmp r0, r2 - bls _0801C058 - adds r0, r2, 0 -_0801C058: - strh r0, [r3, 0x2] - mov r3, sp - movs r4, 0xA8 - lsls r4, 1 - adds r0, r1, r4 - ldrh r0, [r0] - cmp r0, r2 - bls _0801C06A - adds r0, r2, 0 -_0801C06A: - strh r0, [r3, 0x4] - movs r5, 0 -_0801C06E: - lsls r4, r5, 1 - adds r4, r5 - lsls r4, 4 - movs r0, 0xB7 - lsls r0, 2 - adds r4, r0 - ldr r0, [r6] - adds r0, r4 - adds r0, 0x2A - movs r1, 0xFF - movs r2, 0x4 - bl memset - ldr r0, [r6] - adds r0, r4 - adds r0, 0x1 - movs r1, 0xFF - movs r2, 0x29 - bl memset - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x7 - bls _0801C06E - movs r5, 0 - movs r6, 0 - ldr r1, =gUnknown_02022C74 - mov r8, r1 - movs r2, 0x91 - lsls r2, 1 - mov r10, r2 - ldr r7, =0x00000175 - movs r3, 0xB7 - lsls r3, 2 - mov r9, r3 -_0801C0B6: - mov r4, r8 - ldr r2, [r4] - mov r0, r10 - adds r1, r2, r0 - adds r0, r1, r5 - ldrb r3, [r0] - cmp r3, 0xF7 - beq _0801C0F8 - ldr r1, =0x00000175 - adds r0, r2, r1 - ldrb r1, [r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 4 - adds r0, r6, r0 - ldr r4, =0x000002dd - adds r1, r2, r4 - adds r1, r0 - strb r3, [r1] - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - b _0801C15E - .pool -_0801C0F8: - adds r0, r5, 0x1 - adds r0, r1, r0 - ldrb r3, [r0] - cmp r3, 0x2 - bls _0801C108 - adds r0, r5, 0x2 - lsls r0, 16 - b _0801C15C -_0801C108: - adds r0, r2, r7 - ldrb r1, [r0] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 4 - add r0, r9 - adds r0, r2, r0 - adds r0, 0x2A - lsls r1, r3, 1 - add r1, sp - ldrh r1, [r1] - movs r2, 0x2 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - mov r0, r8 - ldr r1, [r0] - adds r0, r1, r7 - ldrb r2, [r0] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 4 - adds r0, r1, r0 - adds r4, r5, 0x2 - add r1, r10 - adds r1, r4 - ldrb r1, [r1] - add r0, r9 - strb r1, [r0] - mov r2, r8 - ldr r1, [r2] - adds r1, r7 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r2] - adds r0, r7 - ldrb r0, [r0] - cmp r0, 0x7 - bhi _0801C168 - movs r6, 0 - lsls r0, r4, 16 -_0801C15C: - lsrs r5, r0, 16 -_0801C15E: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x27 - bls _0801C0B6 -_0801C168: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_801BEF8 - - thumb_func_start sub_801C178 -sub_801C178: @ 801C178 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - lsls r0, 24 - lsrs r4, r0, 24 - mov r8, r4 - movs r0, 0 - str r0, [sp, 0xC] - ldr r7, =gUnknown_02022C74 - ldr r0, [r7] - lsls r1, r4, 1 - movs r2, 0xBB - lsls r2, 1 - adds r0, r2 - adds r0, r1 - ldrh r0, [r0] - lsls r6, r0, 24 - lsrs r5, r6, 24 - adds r0, r5, 0 - bl PutWindowTilemap - adds r0, r5, 0 - movs r1, 0 - bl FillWindowPixelBuffer - cmp r4, 0x1 - beq _0801C2A0 - cmp r4, 0x1 - bgt _0801C1C4 - cmp r4, 0 - beq _0801C1D0 - mov r9, r6 - b _0801C498 - .pool -_0801C1C4: - mov r0, r8 - cmp r0, 0x2 - bne _0801C1CC - b _0801C304 -_0801C1CC: - mov r9, r6 - b _0801C498 -_0801C1D0: - ldr r2, [r7] - movs r1, 0xB8 - lsls r1, 1 - mov r10, r1 - adds r0, r2, r1 - ldr r0, [r0] - ldrb r0, [r0] - lsls r0, 28 - lsrs r0, 28 - lsls r1, r0, 1 - adds r1, r0 - ldr r0, =gUnknown_082F0E10 - mov r8, r0 - add r1, r8 - str r1, [sp] - ldr r1, [sp, 0xC] - str r1, [sp, 0x4] - ldr r0, =0x0000018b - adds r2, r0 - str r2, [sp, 0x8] - adds r0, r5, 0 - movs r1, 0x3 - movs r2, 0 - movs r3, 0x1 - bl AddTextPrinterParameterized3 - ldr r4, [r7] - movs r1, 0xDA - lsls r1, 1 - mov r9, r1 - add r4, r9 - movs r0, 0x3 - movs r1, 0x2 - bl GetFontAttribute - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x3 - adds r1, r4, 0 - bl GetStringWidth - movs r1, 0xA0 - subs r1, r0 - cmp r1, 0 - bge _0801C22E - movs r1, 0 -_0801C22E: - lsls r2, r1, 24 - lsrs r2, 24 - ldr r3, [r7] - mov r1, r10 - adds r0, r3, r1 - ldr r0, [r0] - ldrb r1, [r0] - lsls r1, 28 - lsrs r1, 28 - lsls r0, r1, 1 - adds r0, r1 - add r0, r8 - str r0, [sp] - ldr r0, [sp, 0xC] - str r0, [sp, 0x4] - add r3, r9 - str r3, [sp, 0x8] - adds r0, r5, 0 - movs r1, 0x3 - movs r3, 0x11 - bl AddTextPrinterParameterized3 - ldr r2, [r7] - ldr r0, [r2, 0x4] - mov r9, r6 - cmp r0, 0 - bne _0801C266 - b _0801C498 -_0801C266: - mov r1, r10 - adds r0, r2, r1 - ldr r0, [r0] - ldrb r1, [r0] - lsls r1, 28 - lsrs r1, 28 - lsls r0, r1, 1 - adds r0, r1 - add r0, r8 - str r0, [sp] - ldr r0, [sp, 0xC] - str r0, [sp, 0x4] - ldr r1, =0x000001dd - adds r0, r2, r1 - str r0, [sp, 0x8] - adds r0, r5, 0 - movs r1, 0x1 - movs r2, 0xA6 - movs r3, 0x11 - bl AddTextPrinterParameterized3 - b _0801C498 - .pool -_0801C2A0: - mov r9, r6 -_0801C2A2: - ldr r2, [sp, 0xC] - lsls r4, r2, 24 - asrs r4, 24 - lsls r3, r4, 4 - adds r3, 0x2 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =gUnknown_02022C74 - ldr r2, [r0] - movs r1, 0xB8 - lsls r1, 1 - adds r0, r2, r1 - ldr r0, [r0] - ldrb r0, [r0] - lsrs r0, 4 - lsls r1, r0, 1 - adds r1, r0 - ldr r0, =gUnknown_082F0E10 - adds r1, r0 - str r1, [sp] - movs r0, 0 - str r0, [sp, 0x4] - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r4 - movs r1, 0xF2 - lsls r1, 1 - adds r0, r1 - adds r2, r0 - str r2, [sp, 0x8] - mov r2, r9 - lsrs r0, r2, 24 - movs r1, 0x3 - movs r2, 0 - bl AddTextPrinterParameterized3 - adds r4, 0x1 - lsls r4, 24 - lsrs r0, r4, 24 - str r0, [sp, 0xC] - asrs r4, 24 - cmp r4, 0x3 - ble _0801C2A2 - b _0801C498 - .pool -_0801C304: - ldr r4, =gUnknown_082F0E18 - ldr r2, [r7] - ldrb r0, [r2, 0x8] - lsls r0, 30 - lsrs r0, 30 - adds r0, r4 - ldrb r3, [r0] - movs r1, 0xB8 - lsls r1, 1 - adds r0, r2, r1 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - lsls r0, 28 - lsrs r0, 28 - lsls r1, r0, 1 - adds r1, r0 - ldr r0, =gUnknown_082F0E10 - mov r10, r0 - add r1, r10 - str r1, [sp] - ldr r1, [sp, 0xC] - str r1, [sp, 0x4] - movs r1, 0xA2 - lsls r1, 2 - adds r0, r2, r1 - str r0, [sp, 0x8] - adds r0, r5, 0 - movs r1, 0x3 - movs r2, 0 - bl AddTextPrinterParameterized3 - ldr r2, [r7] - ldrb r1, [r2, 0x8] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x2 - beq _0801C398 - lsls r0, r1, 30 - lsrs r0, 30 - adds r0, r4 - ldrb r3, [r0] - adds r3, 0x10 - lsls r3, 24 - lsrs r3, 24 - movs r1, 0xB8 - lsls r1, 1 - adds r0, r2, r1 - ldr r0, [r0] - ldrb r1, [r0, 0x1] - lsls r1, 28 - lsrs r1, 28 - lsls r0, r1, 1 - adds r0, r1 - add r0, r10 - str r0, [sp] - ldr r0, [sp, 0xC] - str r0, [sp, 0x4] - ldr r1, =0x000002b1 - adds r0, r2, r1 - str r0, [sp, 0x8] - adds r0, r5, 0 - movs r1, 0x3 - movs r2, 0 - bl AddTextPrinterParameterized3 - mov r9, r6 - b _0801C498 - .pool -_0801C398: - movs r2, 0 - mov r8, r2 - lsls r0, r1, 30 - lsrs r0, 30 - adds r0, r4 - ldrb r0, [r0] - adds r4, r0, 0 - adds r4, 0x10 - movs r0, 0x3 - movs r1, 0x2 - bl GetFontAttribute - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, [r7] - ldr r1, =0x00000175 - adds r0, r1 - mov r9, r6 - ldr r1, [sp, 0xC] - ldrb r0, [r0] - cmp r1, r0 - bge _0801C498 - str r5, [sp, 0x10] - lsls r0, r4, 24 - lsrs r0, 24 - str r0, [sp, 0x14] - mov r10, r2 -_0801C3CE: - mov r0, r8 - lsls r2, r0, 24 - lsrs r2, 24 - ldr r3, [r7] - movs r1, 0xB8 - lsls r1, 1 - adds r0, r3, r1 - ldr r0, [r0] - ldrb r1, [r0, 0x1] - lsls r1, 28 - lsrs r1, 28 - lsls r0, r1, 1 - adds r0, r1 - ldr r1, =gUnknown_082F0E10 - adds r0, r1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - ldr r1, [sp, 0xC] - lsls r0, r1, 24 - asrs r6, r0, 24 - lsls r0, r6, 1 - adds r0, r6 - lsls r5, r0, 4 - movs r0, 0xB7 - lsls r0, 2 - adds r4, r5, r0 - adds r3, r4 - adds r3, 0x1 - str r3, [sp, 0x8] - ldr r0, [sp, 0x10] - movs r1, 0x3 - ldr r3, [sp, 0x14] - bl AddTextPrinterParameterized3 - ldr r1, [r7] - adds r0, r1, r5 - ldr r2, =0x00000306 - adds r0, r2 - ldrb r0, [r0] - cmp r0, 0xFF - beq _0801C482 - adds r1, r4 - adds r1, 0x1 - movs r0, 0x3 - mov r2, r10 - bl GetStringWidth - add r8, r0 - mov r0, r8 - lsls r2, r0, 24 - lsrs r2, 24 - ldr r3, [r7] - movs r1, 0xB8 - lsls r1, 1 - adds r0, r3, r1 - ldr r0, [r0] - ldrb r1, [r0, 0x1] - lsls r1, 28 - lsrs r1, 28 - lsls r0, r1, 1 - adds r0, r1 - ldr r1, =gUnknown_082F0E10 - adds r0, r1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - adds r3, r4 - adds r3, 0x2A - str r3, [sp, 0x8] - ldr r0, [sp, 0x10] - movs r1, 0x3 - ldr r3, [sp, 0x14] - bl AddTextPrinterParameterized3 - ldr r1, [r7] - adds r1, r4 - adds r1, 0x2A - movs r0, 0x3 - mov r2, r10 - bl GetStringWidth - ldr r1, [r7] - adds r1, r5 - movs r2, 0xB7 - lsls r2, 2 - adds r1, r2 - ldrb r1, [r1] - adds r0, r1 - add r8, r0 -_0801C482: - adds r1, r6, 0x1 - lsls r1, 24 - lsrs r0, r1, 24 - str r0, [sp, 0xC] - asrs r1, 24 - ldr r0, [r7] - ldr r2, =0x00000175 - adds r0, r2 - ldrb r0, [r0] - cmp r1, r0 - blt _0801C3CE -_0801C498: - mov r1, r9 - lsrs r0, r1, 24 - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801C178 - - thumb_func_start sub_801C4C0 -sub_801C4C0: @ 801C4C0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - movs r7, 0 - ldr r4, =gUnknown_02022C74 - ldr r0, [r4] - movs r1, 0xBE - lsls r1, 1 - adds r0, r1 - movs r1, 0xFF - strb r1, [r0] - ldr r0, [r4] - movs r2, 0xA9 - lsls r2, 1 - adds r1, r0, r2 - ldrh r0, [r1] - cmp r0, 0 - beq _0801C52C - bl sub_80D2E84 - lsls r0, 16 - lsrs r0, 16 - ldr r1, =SpriteCallbackDummy - str r7, [sp] - str r7, [sp, 0x4] - movs r2, 0xDC - movs r3, 0x14 - bl sub_80D2D78 - ldr r1, [r4] - movs r2, 0xBE - lsls r2, 1 - adds r1, r2 - strb r0, [r1] - ldr r2, =gSprites - ldr r0, [r4] - movs r1, 0xBE - lsls r1, 1 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r2, [r0, 0x5] - movs r1, 0xD - negs r1, r1 - ands r1, r2 - movs r2, 0x8 - orrs r1, r2 - strb r1, [r0, 0x5] -_0801C52C: - ldr r1, [r4] - ldrb r0, [r1, 0x9] - cmp r0, 0 - beq _0801C5EE - ldrb r1, [r1, 0x8] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x1 - bne _0801C5EE - ldr r0, =gUnknown_082F1D00 - bl LoadCompressedSpriteSheetUsingHeap - ldr r0, [r4] - movs r2, 0xB8 - lsls r2, 1 - adds r0, r2 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - lsrs r0, 4 - lsls r0, 3 - ldr r1, =gUnknown_082F1D08 - adds r0, r1 - bl LoadSpritePalette - ldr r0, [r4] - ldrb r0, [r0, 0x9] - cmp r7, r0 - bcs _0801C5EE - adds r6, r4, 0 - ldr r0, =0x0000017d - mov r10, r0 - movs r1, 0 - mov r9, r1 - movs r2, 0xFF - mov r8, r2 -_0801C572: - ldr r1, [r6] - lsls r4, r7, 1 - add r1, r10 - adds r1, r4 - ldrb r0, [r1] - mov r2, r8 - orrs r0, r2 - strb r0, [r1] - ldr r1, [r6] - movs r0, 0xBF - lsls r0, 1 - adds r1, r0 - adds r1, r4 - ldrb r0, [r1] - orrs r0, r2 - strb r0, [r1] - lsls r1, r7, 5 - movs r0, 0xD8 - subs r5, r0, r1 - ldr r0, =gUnknown_082F1D48 - adds r1, r5, 0 - movs r2, 0x90 - movs r3, 0x8 - bl CreateSprite - ldr r1, [r6] - add r1, r10 - adds r1, r4 - strb r0, [r1] - ldr r0, [r6] - movs r1, 0xAA - lsls r1, 1 - adds r0, r1 - adds r1, r0, r4 - ldrh r0, [r1] - cmp r0, 0 - beq _0801C5E0 - bl sub_80D2E84 - lsls r0, 16 - lsrs r0, 16 - mov r2, r9 - str r2, [sp] - str r2, [sp, 0x4] - ldr r1, =SpriteCallbackDummy - adds r2, r5, 0 - movs r3, 0x88 - bl sub_80D2D78 - ldr r1, [r6] - movs r2, 0xBF - lsls r2, 1 - adds r1, r2 - adds r1, r4 - strb r0, [r1] -_0801C5E0: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r0, [r6] - ldrb r0, [r0, 0x9] - cmp r7, r0 - bcc _0801C572 -_0801C5EE: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801C4C0 - - thumb_func_start sub_801C61C -sub_801C61C: @ 801C61C - push {r4-r7,lr} - movs r5, 0 - ldr r4, =gUnknown_02022C74 - ldr r0, [r4] - movs r2, 0xBE - lsls r2, 1 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0xFF - beq _0801C640 - adds r1, r0, 0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl sub_80D2EF8 -_0801C640: - ldr r0, [r4] - ldrb r2, [r0, 0x9] - cmp r2, 0 - beq _0801C6B4 - ldrb r1, [r0, 0x8] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x1 - bne _0801C6B4 - cmp r5, r2 - bcs _0801C6A4 - adds r6, r4, 0 - ldr r7, =gSprites -_0801C65A: - ldr r0, [r6] - lsls r4, r5, 1 - ldr r1, =0x0000017d - adds r0, r1 - adds r1, r0, r4 - ldrb r0, [r1] - cmp r0, 0xFF - beq _0801C678 - adds r1, r0, 0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - bl DestroySprite -_0801C678: - ldr r0, [r6] - movs r2, 0xBF - lsls r2, 1 - adds r0, r2 - adds r1, r0, r4 - ldrb r0, [r1] - cmp r0, 0xFF - beq _0801C696 - adds r1, r0, 0 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - bl sub_80D2EF8 -_0801C696: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, [r6] - ldrb r0, [r0, 0x9] - cmp r5, r0 - bcc _0801C65A -_0801C6A4: - movs r4, 0x80 - lsls r4, 8 - adds r0, r4, 0 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl FreeSpritePaletteByTag -_0801C6B4: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801C61C - - thumb_func_start sub_801C6C8 -sub_801C6C8: @ 801C6C8 - push {r4-r6,lr} - adds r4, r0, 0 - cmp r4, 0 - beq _0801C6DE - ldr r5, =gUnknown_02022C78 - ldr r0, =0x000013a4 - bl AllocZeroed - str r0, [r5] - cmp r0, 0 - bne _0801C6EC -_0801C6DE: - movs r0, 0 - b _0801C71C - .pool -_0801C6EC: - movs r6, 0xDE - lsls r6, 1 - adds r1, r4, 0 - adds r2, r6, 0 - bl memcpy - ldr r1, [r5] - ldrb r0, [r1, 0x3] - cmp r0, 0x7 - bls _0801C704 - movs r0, 0 - strb r0, [r1, 0x3] -_0801C704: - ldr r2, [r5] - adds r3, r2, r6 - ldrb r0, [r2, 0x3] - lsls r0, 4 - ldr r1, =gUnknown_082F24C8 - adds r0, r1 - str r0, [r3] - ldr r0, =0x000001c1 - adds r1, r2, r0 - movs r0, 0xFF - strb r0, [r1] - movs r0, 0x1 -_0801C71C: - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801C6C8 - - thumb_func_start sub_801C72C -sub_801C72C: @ 801C72C - push {r4,lr} - ldr r4, =gUnknown_02022C78 - ldr r0, [r4] - cmp r0, 0 - beq _0801C748 - ldr r2, =0x000013a4 - movs r1, 0 - bl memset - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] -_0801C748: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801C72C - - thumb_func_start sub_801C758 -sub_801C758: @ 801C758 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x24 - ldr r5, =gUnknown_02022C78 - ldr r0, [r5] - cmp r0, 0 - bne _0801C778 - movs r0, 0x1 - negs r0, r0 - b _0801CA3A - .pool -_0801C778: - movs r4, 0xE0 - lsls r4, 1 - adds r0, r4 - ldrb r0, [r0] - lsrs r0, 1 - cmp r0, 0x6 - bls _0801C788 - b _0801CA04 -_0801C788: - lsls r0, 2 - ldr r1, =_0801C798 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801C798: - .4byte _0801C7B4 - .4byte _0801C7C6 - .4byte _0801C82C - .4byte _0801C8D4 - .4byte _0801C990 - .4byte _0801C996 - .4byte _0801C9A8 -_0801C7B4: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _0801CA1E -_0801C7C6: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - beq _0801C7D2 - b _0801CA38 -_0801C7D2: - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x40 - movs r1, 0xF0 - bl SetGpuReg - ldr r1, =0x00001a98 - movs r0, 0x44 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0x1F - bl SetGpuReg - movs r0, 0x4A - movs r1, 0x1B - bl SetGpuReg - movs r1, 0x80 - lsls r1, 6 - movs r0, 0 - bl SetGpuRegBits - b _0801CA1E - .pool -_0801C82C: - movs r5, 0x1E - str r5, [sp] - movs r4, 0x14 - str r4, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r5, [sp] - str r4, [sp, 0x4] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r5, [sp] - str r4, [sp, 0x4] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r5, [sp] - str r4, [sp, 0x4] - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - ldr r5, =gUnknown_02022C78 - ldr r0, [r5] - movs r1, 0xDE - lsls r1, 1 - adds r0, r1 - ldr r0, [r0] - ldr r1, [r0, 0x4] - movs r0, 0 - str r0, [sp] - movs r0, 0x3 - movs r2, 0 - movs r3, 0x8 - bl decompress_and_copy_tile_data_to_vram - ldr r4, =gUnknown_082F1DE8 - adds r0, r4, 0 - bl AddWindow - ldr r1, [r5] - movs r2, 0xE4 - lsls r2, 1 - adds r1, r2 - strh r0, [r1] - adds r4, 0x8 - adds r0, r4, 0 - bl AddWindow - ldr r1, [r5] - movs r3, 0xE5 - lsls r3, 1 - adds r1, r3 - strh r0, [r1] - b _0801CA1E - .pool -_0801C8D4: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0 - beq _0801C8E2 - b _0801CA38 -_0801C8E2: - movs r0, 0x1 - bl stdpal_get - movs r1, 0x20 - movs r2, 0x20 - bl LoadPalette - ldr r2, =gPaletteFade - ldrb r0, [r2, 0x8] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2, 0x8] - ldr r0, =gUnknown_02022C78 - mov r8, r0 - ldr r0, [r0] - movs r4, 0xDE - lsls r4, 1 - adds r0, r4 - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x10 - movs r2, 0x20 - bl LoadPalette - mov r2, r8 - ldr r1, [r2] - adds r4, r1, r4 - ldr r0, [r4] - ldr r0, [r0, 0x8] - movs r6, 0xE9 - lsls r6, 2 - adds r1, r6 - bl LZ77UnCompWram - mov r3, r8 - ldr r1, [r3] - adds r1, r6 - movs r4, 0x1E - str r4, [sp] - movs r5, 0x3 - str r5, [sp, 0x4] - str r7, [sp, 0x8] - str r7, [sp, 0xC] - str r4, [sp, 0x10] - str r5, [sp, 0x14] - movs r0, 0x1 - mov r10, r0 - str r0, [sp, 0x18] - movs r2, 0x8 - mov r9, r2 - str r2, [sp, 0x1C] - str r7, [sp, 0x20] - movs r2, 0 - movs r3, 0 - bl CopyRectToBgTilemapBufferRect - mov r3, r8 - ldr r1, [r3] - adds r1, r6 - str r4, [sp] - movs r0, 0x17 - str r0, [sp, 0x4] - str r7, [sp, 0x8] - str r5, [sp, 0xC] - str r4, [sp, 0x10] - str r0, [sp, 0x14] - mov r0, r10 - str r0, [sp, 0x18] - mov r2, r9 - str r2, [sp, 0x1C] - str r7, [sp, 0x20] - movs r0, 0x3 - movs r2, 0 - movs r3, 0x3 - bl CopyRectToBgTilemapBufferRect - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - b _0801CA1E - .pool -_0801C990: - bl sub_801CDCC - b _0801CA1E -_0801C996: - bl sub_801CE7C - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - b _0801CA1E -_0801C9A8: - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x8] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x8] - ldr r4, =gUnknown_02022C78 - ldr r1, [r4] - movs r3, 0xE5 - lsls r3, 2 - adds r0, r1, r3 - movs r2, 0xE3 - lsls r2, 1 - adds r1, r2 - bl AddScrollIndicatorArrowPair - ldr r1, [r4] - ldr r3, =0x000001c1 - adds r2, r1, r3 - movs r1, 0 - strb r0, [r2] - movs r0, 0x1 - negs r0, r0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - bl UpdatePaletteFade - b _0801CA1E - .pool -_0801CA04: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _0801CA38 - ldr r0, [r5] - adds r0, r4 - ldrb r2, [r0] - movs r1, 0x1 - ands r1, r2 - strb r1, [r0] - movs r0, 0x1 - b _0801CA3A -_0801CA1E: - ldr r0, =gUnknown_02022C78 - ldr r2, [r0] - movs r0, 0xE0 - lsls r0, 1 - adds r2, r0 - ldrb r3, [r2] - lsrs r1, r3, 1 - adds r1, 0x1 - lsls r1, 1 - movs r0, 0x1 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] -_0801CA38: - movs r0, 0 -_0801CA3A: - add sp, 0x24 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801C758 - - thumb_func_start sub_801CA50 -sub_801CA50: @ 801CA50 - push {r4,r5,lr} - sub sp, 0x8 - adds r2, r0, 0 - ldr r5, =gUnknown_02022C78 - ldr r0, [r5] - cmp r0, 0 - bne _0801CA68 - movs r0, 0x1 - negs r0, r0 - b _0801CC2A - .pool -_0801CA68: - movs r4, 0xE0 - lsls r4, 1 - adds r0, r4 - ldrb r0, [r0] - lsrs r0, 1 - cmp r0, 0x5 - bls _0801CA78 - b _0801CBF4 -_0801CA78: - lsls r0, 2 - ldr r1, =_0801CA88 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801CA88: - .4byte _0801CAA0 - .4byte _0801CAB2 - .4byte _0801CAF4 - .4byte _0801CB54 - .4byte _0801CB84 - .4byte _0801CBC0 -_0801CAA0: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _0801CC0E -_0801CAB2: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - beq _0801CABE - b _0801CC28 -_0801CABE: - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x40 - movs r1, 0 - bl SetGpuReg - movs r0, 0x44 - movs r1, 0 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0 - bl SetGpuReg - movs r0, 0x4A - movs r1, 0 - bl SetGpuReg - movs r1, 0x80 - lsls r1, 6 - movs r0, 0 - bl ClearGpuRegBits - b _0801CC0E -_0801CAF4: - movs r4, 0x1E - str r4, [sp] - movs r5, 0x14 - str r5, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r5, [sp, 0x4] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - movs r5, 0x18 - str r5, [sp, 0x4] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r5, [sp, 0x4] - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - b _0801CC0E -_0801CB54: - movs r0, 0x1 - bl HideBg - movs r0, 0x2 - bl HideBg - ldr r4, =gUnknown_02022C78 - ldr r0, [r4] - movs r1, 0xE5 - lsls r1, 1 - adds r0, r1 - ldrb r0, [r0] - bl RemoveWindow - ldr r0, [r4] - movs r2, 0xE4 - lsls r2, 1 - adds r0, r2 - ldrb r0, [r0] - bl RemoveWindow - b _0801CC0E - .pool -_0801CB84: - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - ldr r4, =gUnknown_02022C78 - ldr r0, [r4] - ldr r2, =0x000001c1 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0xFF - beq _0801CC0E - bl RemoveScrollIndicatorArrowPair - ldr r0, [r4] - ldr r2, =0x000001c1 - adds r1, r0, r2 - movs r0, 0xFF - strb r0, [r1] - b _0801CC0E - .pool -_0801CBC0: - ldr r0, =gUnknown_02022C60 - ldrb r0, [r0] - adds r1, r2, 0 - bl sub_80186EC - movs r0, 0x3 - bl sub_8018798 - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - b _0801CC0E - .pool -_0801CBF4: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _0801CC28 - ldr r0, [r5] - adds r0, r4 - ldrb r2, [r0] - movs r1, 0x1 - ands r1, r2 - strb r1, [r0] - movs r0, 0x1 - b _0801CC2A -_0801CC0E: - ldr r0, =gUnknown_02022C78 - ldr r2, [r0] - movs r0, 0xE0 - lsls r0, 1 - adds r2, r0 - ldrb r3, [r2] - lsrs r1, r3, 1 - adds r1, 0x1 - lsls r1, 1 - movs r0, 0x1 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] -_0801CC28: - movs r0, 0 -_0801CC2A: - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801CA50 - - thumb_func_start sub_801CC38 -sub_801CC38: @ 801CC38 - push {r4,r5,lr} - ldr r4, =gUnknown_02022C78 - ldr r2, [r4] - movs r5, 0xE0 - lsls r5, 1 - adds r0, r2, r5 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0801CC72 - ldr r0, =0x000001c1 - adds r1, r2, r0 - ldrb r0, [r1] - cmp r0, 0xFF - beq _0801CC72 - bl RemoveScrollIndicatorArrowPair - ldr r0, [r4] - ldr r2, =0x000001c1 - adds r1, r0, r2 - movs r0, 0xFF - strb r0, [r1] - ldr r1, [r4] - adds r1, r5 - ldrb r0, [r1] - movs r2, 0x1 - orrs r0, r2 - strb r0, [r1] -_0801CC72: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801CC38 - - thumb_func_start sub_801CC80 -sub_801CC80: @ 801CC80 - push {r4,lr} - ldr r4, =gUnknown_02022C78 - ldr r2, [r4] - movs r1, 0xE0 - lsls r1, 1 - adds r0, r2, r1 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0801CCC0 - movs r3, 0xE5 - lsls r3, 2 - adds r0, r2, r3 - movs r3, 0xE3 - lsls r3, 1 - adds r1, r2, r3 - bl AddScrollIndicatorArrowPair - ldr r1, [r4] - ldr r2, =0x000001c1 - adds r1, r2 - strb r0, [r1] - ldr r1, [r4] - movs r3, 0xE0 - lsls r3, 1 - adds r1, r3 - ldrb r2, [r1] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - strb r0, [r1] -_0801CCC0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801CC80 - - thumb_func_start sub_801CCD0 -sub_801CCD0: @ 801CCD0 - push {r4-r6,lr} - lsls r0, 16 - lsrs r4, r0, 16 - adds r3, r4, 0 - ldr r2, =gUnknown_02022C78 - ldr r0, [r2] - mov r12, r0 - movs r0, 0xE1 - lsls r0, 1 - add r0, r12 - ldrb r1, [r0] - movs r5, 0x1 - adds r0, r5, 0 - ands r0, r1 - adds r6, r2, 0 - cmp r0, 0 - beq _0801CD00 - bl sub_801CFA4 -_0801CCF6: - movs r0, 0xFF - b _0801CDC6 - .pool -_0801CD00: - cmp r4, 0x2 - beq _0801CD1C - cmp r4, 0x2 - bgt _0801CD0E - cmp r4, 0x1 - beq _0801CD18 - b _0801CCF6 -_0801CD0E: - cmp r3, 0x40 - beq _0801CD20 - cmp r3, 0x80 - beq _0801CD50 - b _0801CCF6 -_0801CD18: - movs r0, 0 - b _0801CDC6 -_0801CD1C: - movs r0, 0x1 - b _0801CDC6 -_0801CD20: - movs r0, 0xE3 - lsls r0, 1 - add r0, r12 - ldrh r0, [r0] - cmp r0, 0 - beq _0801CCF6 - movs r0, 0xE0 - lsls r0, 1 - add r0, r12 - ldrb r1, [r0] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _0801CCF6 - ldr r2, =0x000001c3 - add r2, r12 - ldrb r1, [r2] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - b _0801CD7E - .pool -_0801CD50: - movs r0, 0xE3 - lsls r0, 1 - add r0, r12 - movs r1, 0xE2 - lsls r1, 1 - add r1, r12 - ldrh r0, [r0] - ldrh r1, [r1] - cmp r0, r1 - beq _0801CCF6 - movs r0, 0xE0 - lsls r0, 1 - add r0, r12 - ldrb r1, [r0] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _0801CCF6 - ldr r2, =0x000001c3 - add r2, r12 - ldrb r0, [r2] - movs r1, 0x1 - orrs r0, r1 -_0801CD7E: - strb r0, [r2] - ldr r2, [r6] - movs r4, 0xE1 - lsls r4, 1 - adds r2, r4 - ldrb r0, [r2] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2] - ldr r3, [r6] - adds r3, r4 - ldrb r1, [r3] - movs r2, 0x1 - adds r0, r2, 0 - ands r0, r1 - movs r1, 0x4 - orrs r0, r1 - strb r0, [r3] - ldr r1, [r6] - adds r4, 0x1 - adds r1, r4 - ldrb r3, [r1] - adds r0, r2, 0 - ands r0, r3 - strb r0, [r1] - ldr r0, [r6] - adds r0, r4 - ldrb r0, [r0] - ands r2, r0 - cmp r2, 0 - beq _0801CDC4 - movs r0, 0x3 - b _0801CDC6 - .pool -_0801CDC4: - movs r0, 0x2 -_0801CDC6: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801CCD0 - - thumb_func_start sub_801CDCC -sub_801CDCC: @ 801CDCC - push {r4-r6,lr} - movs r5, 0 - ldr r4, =gUnknown_02022C78 - ldr r1, [r4] - movs r2, 0xE7 - lsls r2, 1 - adds r0, r1, r2 - adds r1, 0x4 - movs r2, 0x28 - bl memcpy - ldr r0, [r4] - movs r3, 0xFB - lsls r3, 1 - adds r1, r0, r3 - movs r0, 0xFF - strb r0, [r1] - adds r6, r4, 0 -_0801CDF0: - ldr r2, [r6] - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r4, r1, r5 - adds r0, r4, r2 - ldr r3, =0x000001f7 - adds r0, r3 - adds r1, r2 - adds r1, 0x2C - movs r2, 0x28 - bl memcpy - ldr r0, [r6] - ldr r1, =0x0000021f - adds r0, r1 - adds r0, r4 - movs r1, 0xFF - strb r1, [r0] - cmp r5, 0x7 - bls _0801CE34 - ldr r1, [r6] - ldr r2, =0x000001f7 - adds r0, r1, r2 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0xFF - beq _0801CE34 - movs r3, 0xE2 - lsls r3, 1 - adds r1, r3 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] -_0801CE34: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x9 - bls _0801CDF0 - ldr r2, =gUnknown_02022C78 - ldr r1, [r2] - movs r4, 0xE5 - lsls r4, 2 - adds r1, r4 - ldr r0, =gUnknown_082F1DF8 - ldm r0!, {r3-r5} - stm r1!, {r3-r5} - ldr r0, [r0] - str r0, [r1] - ldr r2, [r2] - movs r5, 0xE2 - lsls r5, 1 - adds r0, r2, r5 - ldrh r1, [r0] - movs r3, 0xE7 - lsls r3, 2 - adds r0, r2, r3 - strh r1, [r0] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801CDCC - - thumb_func_start sub_801CE7C -sub_801CE7C: @ 801CE7C - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - movs r5, 0 - ldr r6, =gUnknown_02022C78 - ldr r0, [r6] - movs r7, 0xE4 - lsls r7, 1 - adds r0, r7 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r0, [r6] - movs r4, 0xE5 - lsls r4, 1 - adds r0, r4 - ldrb r0, [r0] - bl PutWindowTilemap - ldr r0, [r6] - adds r0, r7 - ldrb r0, [r0] - movs r1, 0 - bl FillWindowPixelBuffer - ldr r0, [r6] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0 - bl FillWindowPixelBuffer - ldr r4, [r6] - movs r0, 0xE7 - lsls r0, 1 - mov r8, r0 - add r4, r8 - movs r0, 0x3 - movs r1, 0x2 - bl GetFontAttribute - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x3 - adds r1, r4, 0 - bl GetStringWidth - movs r1, 0xE0 - subs r1, r0 - lsrs r0, r1, 31 - adds r1, r0 - asrs r1, 1 - cmp r1, 0 - bge _0801CEEC - movs r1, 0 -_0801CEEC: - ldr r4, [r6] - adds r0, r4, r7 - ldrb r0, [r0] - lsls r2, r1, 24 - lsrs r2, 24 - movs r3, 0xDE - lsls r3, 1 - adds r1, r4, r3 - ldr r1, [r1] - ldrb r1, [r1] - lsls r1, 28 - lsrs r1, 28 - lsls r3, r1, 1 - adds r3, r1 - ldr r1, =gUnknown_082F1DE0 - adds r3, r1 - str r3, [sp] - str r5, [sp, 0x4] - add r4, r8 - str r4, [sp, 0x8] - movs r1, 0x3 - movs r3, 0x6 - bl AddTextPrinterParameterized3 -_0801CF1C: - ldr r6, =gUnknown_02022C78 - ldr r4, [r6] - movs r1, 0xE5 - lsls r1, 1 - adds r0, r4, r1 - ldrb r0, [r0] - lsls r3, r5, 4 - adds r3, 0x2 - lsls r3, 24 - lsrs r3, 24 - movs r2, 0xDE - lsls r2, 1 - adds r1, r4, r2 - ldr r1, [r1] - ldrb r1, [r1] - lsrs r1, 4 - lsls r2, r1, 1 - adds r2, r1 - ldr r1, =gUnknown_082F1DE0 - adds r2, r1 - str r2, [sp] - movs r1, 0 - str r1, [sp, 0x4] - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r5 - ldr r2, =0x000001f7 - adds r1, r2 - adds r4, r1 - str r4, [sp, 0x8] - movs r1, 0x3 - movs r2, 0 - bl AddTextPrinterParameterized3 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x9 - bls _0801CF1C - ldr r0, [r6] - movs r3, 0xE4 - lsls r3, 1 - adds r0, r3 - ldrb r0, [r0] - movs r1, 0x3 - bl CopyWindowToVram - ldr r0, [r6] - movs r1, 0xE5 - lsls r1, 1 - adds r0, r1 - ldrb r0, [r0] - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801CE7C - - thumb_func_start sub_801CFA4 -sub_801CFA4: @ 801CFA4 - push {r4-r6,lr} - ldr r0, =gUnknown_02022C78 - ldr r1, [r0] - movs r2, 0xE1 - lsls r2, 1 - adds r0, r1, r2 - ldrb r0, [r0] - lsrs r4, r0, 1 - lsls r4, 8 - ldr r6, =0x000001c3 - adds r0, r1, r6 - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0801CFE4 - movs r0, 0x2 - adds r1, r4, 0 - movs r2, 0x1 - bl ChangeBgY - movs r0, 0x3 - adds r1, r4, 0 - movs r2, 0x1 - bl ChangeBgY - b _0801CFF8 - .pool -_0801CFE4: - movs r0, 0x2 - adds r1, r4, 0 - movs r2, 0x2 - bl ChangeBgY - movs r0, 0x3 - adds r1, r4, 0 - movs r2, 0x2 - bl ChangeBgY -_0801CFF8: - ldr r3, =gUnknown_02022C78 - ldr r0, [r3] - ldr r2, =0x000001c3 - adds r5, r0, r2 - ldrb r4, [r5] - lsrs r1, r4, 1 - movs r6, 0xE1 - lsls r6, 1 - adds r0, r6 - ldrb r0, [r0] - lsrs r0, 1 - adds r1, r0 - lsls r1, 1 - movs r6, 0x1 - adds r0, r6, 0 - ands r0, r4 - orrs r0, r1 - strb r0, [r5] - ldr r1, [r3] - adds r2, r1, r2 - ldrb r2, [r2] - lsrs r0, r2, 1 - cmp r0, 0xF - bls _0801D070 - adds r0, r6, 0 - ands r0, r2 - cmp r0, 0 - beq _0801D044 - movs r0, 0xE3 - lsls r0, 1 - adds r1, r0 - ldrh r0, [r1] - adds r0, 0x1 - b _0801D04E - .pool -_0801D044: - movs r2, 0xE3 - lsls r2, 1 - adds r1, r2 - ldrh r0, [r1] - subs r0, 0x1 -_0801D04E: - strh r0, [r1] - ldr r0, [r3] - movs r6, 0xE1 - lsls r6, 1 - adds r2, r0, r6 - ldrb r1, [r2] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldr r0, [r3] - ldr r1, =0x000001c3 - adds r2, r0, r1 - ldrb r1, [r2] - movs r0, 0x1 - ands r0, r1 - strb r0, [r2] -_0801D070: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801CFA4 - - .align 2, 0 @ don't pad with nop diff --git a/asm/union_room.s b/asm/union_room.s index b83d579c7..ca5ad6853 100755 --- a/asm/union_room.s +++ b/asm/union_room.s @@ -5,8 +5,6 @@ .text - @ file boundary? - thumb_func_start sub_8018424 sub_8018424: @ 8018424 push {lr} diff --git a/asm/union_room_chat.s b/asm/union_room_chat.s deleted file mode 100755 index e3259a2c2..000000000 --- a/asm/union_room_chat.s +++ /dev/null @@ -1,5772 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_801DD98 -sub_801DD98: @ 801DD98 - push {r4,lr} - ldr r4, =gUnknown_02022C84 - movs r0, 0xDE - lsls r0, 1 - bl Alloc - str r0, [r4] - bl sub_801DDD0 - ldr r1, =gKeyRepeatStartDelay - movs r0, 0x14 - strh r0, [r1] - movs r0, 0 - bl SetVBlankCallback - ldr r0, =c2_081284E0 - bl SetMainCallback2 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801DD98 - - thumb_func_start sub_801DDD0 -sub_801DDD0: @ 801DDD0 - push {r4-r7,lr} - adds r4, r0, 0 - movs r5, 0 - movs r0, 0 - strh r0, [r4, 0x4] - strh r0, [r4, 0x6] - strb r5, [r4, 0x10] - strb r5, [r4, 0x11] - strb r5, [r4, 0x12] - strb r5, [r4, 0x14] - strb r5, [r4, 0x15] - strb r5, [r4, 0x16] - movs r0, 0xFF - strb r0, [r4, 0x1A] - bl GetLinkPlayerCount - strb r0, [r4, 0xD] - bl GetMultiplayerId - strb r0, [r4, 0x13] - strb r5, [r4, 0x17] - strb r5, [r4, 0x18] - movs r1, 0xC8 - lsls r1, 1 - adds r0, r4, r1 - bl sub_801EF1C - ldr r7, =gSaveBlock1Ptr - ldr r6, =0x00003c88 - adds r4, 0xB9 - movs r5, 0x9 -_0801DE0E: - ldr r1, [r7] - adds r1, r6 - adds r0, r4, 0 - bl StringCopy - adds r6, 0x15 - adds r4, 0x15 - subs r5, 0x1 - cmp r5, 0 - bge _0801DE0E - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801DDD0 - - thumb_func_start sub_801DE30 -sub_801DE30: @ 801DE30 - push {r4,lr} - ldr r4, =gUnknown_02022C84 - ldr r0, [r4] - ldrb r0, [r0, 0xE] - bl DestroyTask - ldr r0, [r4] - ldrb r0, [r0, 0xF] - bl DestroyTask - ldr r0, [r4] - bl Free - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801DE30 - - thumb_func_start c2_081284E0 -c2_081284E0: @ 801DE54 - push {r4-r6,lr} - sub sp, 0x4 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r6, r0, r1 - ldrb r0, [r6] - cmp r0, 0x1 - beq _0801DE8C - cmp r0, 0x1 - bgt _0801DE74 - cmp r0, 0 - beq _0801DE7A - b _0801DF04 - .pool -_0801DE74: - cmp r0, 0x2 - beq _0801DEC8 - b _0801DF04 -_0801DE7A: - bl ResetTasks - bl ResetSpriteData - bl FreeAllSpritePalettes - bl sub_801F4D0 - b _0801DEBC -_0801DE8C: - bl sub_801F5B8 - bl sub_801F534 - adds r5, r0, 0 - cmp r5, 0 - bne _0801DF04 - movs r4, 0x1 - negs r4, r4 - adds r0, r4, 0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - str r5, [sp] - adds r0, r4, 0 - adds r1, r4, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, =sub_801DF20 - bl SetVBlankCallback -_0801DEBC: - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] - b _0801DF04 - .pool -_0801DEC8: - bl UpdatePaletteFade - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0801DF04 - ldr r0, =sub_801DF38 - bl SetMainCallback2 - ldr r0, =sub_801DF54 - movs r1, 0x8 - bl CreateTask - ldr r4, =gUnknown_02022C84 - ldr r1, [r4] - strb r0, [r1, 0xE] - ldr r0, =sub_801F2B4 - movs r1, 0x7 - bl CreateTask - ldr r1, [r4] - strb r0, [r1, 0xF] - bl sub_800E0E8 - movs r0, 0xE8 - movs r1, 0x96 - bl CreateWirelessStatusIndicatorSprite -_0801DF04: - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end c2_081284E0 - - thumb_func_start sub_801DF20 -sub_801DF20: @ 801DF20 - push {lr} - bl TransferPlttBuffer - bl LoadOam - bl ProcessSpriteCopyRequests - bl ScanlineEffect_InitHBlankDmaTransfer - pop {r0} - bx r0 - thumb_func_end sub_801DF20 - - thumb_func_start sub_801DF38 -sub_801DF38: @ 801DF38 - push {lr} - bl RunTasks - bl sub_801F5B8 - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_801DF38 - - thumb_func_start sub_801DF54 -sub_801DF54: @ 801DF54 - push {r4,lr} - ldr r4, =gUnknown_02022C84 - ldr r0, [r4] - ldrb r0, [r0, 0x17] - cmp r0, 0x2 - beq _0801DF7A - cmp r0, 0x2 - bgt _0801DF70 - cmp r0, 0x1 - beq _0801DF76 - b _0801DF8A - .pool -_0801DF70: - cmp r0, 0x3 - beq _0801DF7E - b _0801DF8A -_0801DF76: - movs r0, 0x6 - b _0801DF80 -_0801DF7A: - movs r0, 0x7 - b _0801DF80 -_0801DF7E: - movs r0, 0x8 -_0801DF80: - bl sub_801EBD4 - ldr r1, [r4] - movs r0, 0 - strb r0, [r1, 0x17] -_0801DF8A: - ldr r1, =gUnknown_082F2A7C - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrh r0, [r0, 0x4] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801DF54 - - thumb_func_start sub_801DFAC -sub_801DFAC: @ 801DFAC - push {r4,lr} - ldr r4, =gUnknown_02022C84 - ldr r0, [r4] - ldrh r1, [r0, 0x6] - cmp r1, 0x1 - beq _0801DFE0 - cmp r1, 0x1 - bgt _0801DFC8 - cmp r1, 0 - beq _0801DFCE - b _0801E028 - .pool -_0801DFC8: - cmp r1, 0x2 - beq _0801E018 - b _0801E028 -_0801DFCE: - movs r1, 0xC8 - lsls r1, 1 - adds r0, r1 - bl sub_801EF24 - ldr r1, [r4] - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] -_0801DFE0: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _0801E028 - bl sub_8011A9C - cmp r0, 0 - bne _0801E028 - ldr r4, =gUnknown_02022C84 - ldr r1, [r4] - movs r0, 0xC8 - lsls r0, 1 - adds r1, r0 - movs r0, 0 - movs r2, 0x28 - bl SendBlock - lsls r0, 24 - cmp r0, 0 - beq _0801E028 - ldr r1, [r4] - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] - b _0801E028 - .pool -_0801E018: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _0801E028 - movs r0, 0x1 - bl sub_801EBD4 -_0801E028: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_801DFAC - - thumb_func_start sub_801E030 -sub_801E030: @ 801E030 - push {r4,r5,lr} - ldr r5, =gUnknown_02022C84 - ldr r3, [r5] - ldrh r0, [r3, 0x6] - cmp r0, 0 - beq _0801E048 - cmp r0, 0x1 - beq _0801E0F6 - b _0801E118 - .pool -_0801E048: - ldr r1, =gMain - ldrh r2, [r1, 0x2E] - movs r0, 0x8 - ands r0, r2 - cmp r0, 0 - beq _0801E068 - ldrb r0, [r3, 0x15] - cmp r0, 0 - beq _0801E118 - movs r0, 0x4 - bl sub_801EBD4 - b _0801E118 - .pool -_0801E068: - movs r0, 0x4 - ands r0, r2 - cmp r0, 0 - beq _0801E078 - movs r0, 0x2 - bl sub_801EBD4 - b _0801E118 -_0801E078: - ldrh r1, [r1, 0x30] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0801E0A4 - ldrb r0, [r3, 0x15] - cmp r0, 0 - beq _0801E09C - bl sub_801ED68 - movs r0, 0x8 - movs r1, 0 - bl sub_801F5EC - ldr r1, [r5] - movs r0, 0x1 - strh r0, [r1, 0x6] - b _0801E118 -_0801E09C: - movs r0, 0x3 - bl sub_801EBD4 - b _0801E118 -_0801E0A4: - movs r4, 0x1 - adds r0, r4, 0 - ands r0, r2 - cmp r0, 0 - beq _0801E0C0 - bl sub_801EC94 - movs r0, 0x8 - movs r1, 0 - bl sub_801F5EC - movs r0, 0x2 - movs r1, 0x1 - b _0801E0EC -_0801E0C0: - movs r0, 0x80 - lsls r0, 1 - ands r0, r2 - cmp r0, 0 - beq _0801E0E0 - ldrb r0, [r3, 0x10] - cmp r0, 0x3 - beq _0801E0D8 - bl sub_801ED94 - movs r0, 0x8 - b _0801E0EA -_0801E0D8: - movs r0, 0x5 - bl sub_801EBD4 - b _0801E118 -_0801E0E0: - bl sub_801EBE4 - cmp r0, 0 - beq _0801E118 - movs r0, 0x1 -_0801E0EA: - movs r1, 0 -_0801E0EC: - bl sub_801F5EC - ldr r0, [r5] - strh r4, [r0, 0x6] - b _0801E118 -_0801E0F6: - movs r0, 0 - bl sub_801F644 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - bl sub_801F644 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r4, 0 - bne _0801E118 - cmp r1, 0 - bne _0801E118 - ldr r0, [r5] - strh r1, [r0, 0x6] -_0801E118: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801E030 - - thumb_func_start sub_801E120 -sub_801E120: @ 801E120 - push {r4-r6,lr} - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrh r0, [r0, 0x6] - cmp r0, 0x4 - bls _0801E12E - b _0801E23A -_0801E12E: - lsls r0, 2 - ldr r1, =_0801E140 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801E140: - .4byte _0801E154 - .4byte _0801E15E - .4byte _0801E17C - .4byte _0801E208 - .4byte _0801E21C -_0801E154: - movs r0, 0x3 - movs r1, 0 - bl sub_801F5EC - b _0801E16A -_0801E15E: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E23A -_0801E16A: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] - b _0801E23A - .pool -_0801E17C: - bl Menu_ProcessInput - lsls r0, 24 - asrs r0, 8 - lsrs r6, r0, 16 - asrs r4, r0, 16 - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _0801E1B4 - adds r0, 0x1 - cmp r4, r0 - beq _0801E1D4 - movs r0, 0x4 - movs r1, 0 - bl sub_801F5EC - ldr r5, =gUnknown_02022C84 - ldr r2, [r5] - ldrb r0, [r2, 0x10] - cmp r0, r4 - beq _0801E1DC - cmp r4, 0x3 - ble _0801E1EC - b _0801E1DC - .pool -_0801E1B4: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0801E23A - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - bl Menu_MoveCursor - b _0801E23A - .pool -_0801E1D4: - movs r0, 0x4 - movs r1, 0 - bl sub_801F5EC -_0801E1DC: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x3 - strh r0, [r1, 0x6] - b _0801E23A - .pool -_0801E1EC: - movs r1, 0 - strb r1, [r2, 0x11] - ldr r0, [r5] - strb r1, [r0, 0x12] - movs r0, 0x5 - movs r1, 0x1 - bl sub_801F5EC - ldr r0, [r5] - strb r6, [r0, 0x10] - ldr r1, [r5] - movs r0, 0x4 - strh r0, [r1, 0x6] - b _0801E23A -_0801E208: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E23A - movs r0, 0x1 - bl sub_801EBD4 - b _0801E23A -_0801E21C: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E23A - movs r0, 0x1 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E23A - movs r0, 0x1 - bl sub_801EBD4 -_0801E23A: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_801E120 - - thumb_func_start sub_801E240 -sub_801E240: @ 801E240 - push {r4,r5,lr} - ldr r1, =gUnknown_02022C84 - ldr r0, [r1] - ldrh r0, [r0, 0x6] - adds r2, r1, 0 - cmp r0, 0xA - bls _0801E250 - b _0801E458 -_0801E250: - lsls r0, 2 - ldr r1, =_0801E264 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801E264: - .4byte _0801E290 - .4byte _0801E2A8 - .4byte _0801E2C4 - .4byte _0801E322 - .4byte _0801E3D4 - .4byte _0801E424 - .4byte _0801E458 - .4byte _0801E458 - .4byte _0801E378 - .4byte _0801E338 - .4byte _0801E35C -_0801E290: - movs r0, 0x6 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x1 - strh r0, [r1, 0x6] - b _0801E458 - .pool -_0801E2A8: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - beq _0801E2B6 - b _0801E458 -_0801E2B6: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x2 - strh r0, [r1, 0x6] - b _0801E458 - .pool -_0801E2C4: - bl sub_801FF08 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _0801E2E6 - cmp r1, 0 - bgt _0801E2DE - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0801E396 - b _0801E458 -_0801E2DE: - cmp r1, 0x1 - beq _0801E2E4 - b _0801E458 -_0801E2E4: - b _0801E396 -_0801E2E6: - ldr r4, =gUnknown_02022C84 - ldr r1, [r4] - ldrb r0, [r1, 0x13] - cmp r0, 0 - bne _0801E310 - movs r2, 0xC8 - lsls r2, 1 - adds r0, r1, r2 - bl sub_801EFD0 - movs r0, 0x7 - movs r1, 0 - bl sub_801F5EC - ldr r1, [r4] - movs r0, 0x9 - strh r0, [r1, 0x6] - b _0801E458 - .pool -_0801E310: - movs r2, 0xC8 - lsls r2, 1 - adds r0, r1, r2 - bl sub_801EF7C - ldr r1, [r4] - movs r0, 0x4 - strh r0, [r1, 0x6] - b _0801E458 -_0801E322: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - beq _0801E330 - b _0801E458 -_0801E330: - movs r0, 0x1 - bl sub_801EBD4 - b _0801E458 -_0801E338: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - beq _0801E346 - b _0801E458 -_0801E346: - movs r0, 0x14 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0xA - strh r0, [r1, 0x6] - b _0801E458 - .pool -_0801E35C: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - beq _0801E36A - b _0801E458 -_0801E36A: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x8 - strh r0, [r1, 0x6] - b _0801E458 - .pool -_0801E378: - bl sub_801FF08 - lsls r0, 24 - asrs r5, r0, 24 - cmp r5, 0 - beq _0801E3AC - cmp r5, 0 - bgt _0801E392 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - beq _0801E396 - b _0801E458 -_0801E392: - cmp r5, 0x1 - bne _0801E458 -_0801E396: - movs r0, 0x7 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x3 - strh r0, [r1, 0x6] - b _0801E458 - .pool -_0801E3AC: - bl sub_80104B0 - ldr r4, =gUnknown_02022C84 - ldr r0, [r4] - movs r1, 0xC8 - lsls r1, 1 - adds r0, r1 - bl sub_801EFD0 - ldr r0, [r4] - movs r1, 0x4 - strh r1, [r0, 0x6] - movs r2, 0xDC - lsls r2, 1 - adds r0, r2 - strh r5, [r0] - b _0801E458 - .pool -_0801E3D4: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _0801E414 - bl sub_8011A9C - cmp r0, 0 - bne _0801E414 - ldr r4, =gUnknown_02022C84 - ldr r1, [r4] - movs r0, 0xC8 - lsls r0, 1 - adds r1, r0 - movs r0, 0 - movs r2, 0x28 - bl SendBlock - lsls r0, 24 - cmp r0, 0 - beq _0801E414 - ldr r1, [r4] - ldrb r0, [r1, 0x13] - cmp r0, 0 - bne _0801E410 - movs r0, 0x6 - b _0801E412 - .pool -_0801E410: - movs r0, 0x5 -_0801E412: - strh r0, [r1, 0x6] -_0801E414: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0801E458 - b _0801E42C - .pool -_0801E424: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0801E438 -_0801E42C: - movs r0, 0x9 - bl sub_801EBD4 - b _0801E458 - .pool -_0801E438: - ldr r3, [r2] - movs r1, 0xDC - lsls r1, 1 - adds r2, r3, r1 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - lsls r0, 16 - movs r1, 0x96 - lsls r1, 17 - cmp r0, r1 - bls _0801E458 - movs r0, 0 - strh r0, [r2] - movs r0, 0x4 - strh r0, [r3, 0x6] -_0801E458: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801E240 - - thumb_func_start sub_801E460 -sub_801E460: @ 801E460 - push {r4,lr} - ldr r1, =gUnknown_02022C84 - ldr r0, [r1] - ldrh r0, [r0, 0x6] - adds r2, r1, 0 - cmp r0, 0x7 - bls _0801E470 - b _0801E5BC -_0801E470: - lsls r0, 2 - ldr r1, =_0801E484 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801E484: - .4byte _0801E4A4 - .4byte _0801E4C8 - .4byte _0801E4E8 - .4byte _0801E50C - .4byte _0801E540 - .4byte _0801E560 - .4byte _0801E584 - .4byte _0801E5A8 -_0801E4A4: - ldr r0, =sub_801F2B4 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - beq _0801E4B2 - b _0801E5BC -_0801E4B2: - movs r0, 0x7 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - b _0801E59A - .pool -_0801E4C8: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E5BC - movs r0, 0x12 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - b _0801E59A - .pool -_0801E4E8: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E5BC - ldr r4, =gUnknown_02022C84 - ldr r0, [r4] - movs r1, 0xC8 - lsls r1, 1 - adds r0, r1 - bl sub_801EFA8 - ldr r1, [r4] - b _0801E59A - .pool -_0801E50C: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _0801E5BC - bl sub_8011A9C - cmp r0, 0 - bne _0801E5BC - ldr r4, =gUnknown_02022C84 - ldr r1, [r4] - movs r0, 0xC8 - lsls r0, 1 - adds r1, r0 - movs r0, 0 - movs r2, 0x28 - bl SendBlock - lsls r0, 24 - cmp r0, 0 - beq _0801E5BC - ldr r1, [r4] - b _0801E59A - .pool -_0801E540: - bl GetBlockReceivedStatus - movs r1, 0x1 - ands r1, r0 - cmp r1, 0 - beq _0801E5BC - bl sub_8011A9C - cmp r0, 0 - bne _0801E5BC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - b _0801E59A - .pool -_0801E560: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _0801E5BC - bl sub_8011A9C - adds r4, r0, 0 - cmp r4, 0 - bne _0801E5BC - bl sub_800AC34 - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - strh r4, [r1, 0xA] - b _0801E59A - .pool -_0801E584: - ldr r1, [r2] - ldrh r0, [r1, 0xA] - cmp r0, 0x95 - bhi _0801E590 - adds r0, 0x1 - strh r0, [r1, 0xA] -_0801E590: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0801E5BC - ldr r1, [r2] -_0801E59A: - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] - b _0801E5BC - .pool -_0801E5A8: - ldr r1, [r2] - ldrh r0, [r1, 0xA] - cmp r0, 0x95 - bls _0801E5B8 - movs r0, 0x9 - bl sub_801EBD4 - b _0801E5BC -_0801E5B8: - adds r0, 0x1 - strh r0, [r1, 0xA] -_0801E5BC: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_801E460 - - thumb_func_start sub_801E5C4 -sub_801E5C4: @ 801E5C4 - push {r4,r5,lr} - ldr r5, =gUnknown_02022C84 - ldr r1, [r5] - ldrh r0, [r1, 0x6] - cmp r0, 0x1 - beq _0801E604 - cmp r0, 0x1 - bgt _0801E5E0 - cmp r0, 0 - beq _0801E5EA - b _0801E662 - .pool -_0801E5E0: - cmp r0, 0x2 - beq _0801E62E - cmp r0, 0x3 - beq _0801E650 - b _0801E662 -_0801E5EA: - ldr r0, =sub_801F2B4 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _0801E662 - movs r0, 0x7 - movs r1, 0 - bl sub_801F5EC - b _0801E640 - .pool -_0801E604: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E662 - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _0801E662 - bl sub_8011A9C - adds r4, r0, 0 - cmp r4, 0 - bne _0801E662 - bl sub_800AC34 - ldr r1, [r5] - strh r4, [r1, 0xA] - b _0801E642 -_0801E62E: - ldrh r0, [r1, 0xA] - cmp r0, 0x95 - bhi _0801E638 - adds r0, 0x1 - strh r0, [r1, 0xA] -_0801E638: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0801E662 -_0801E640: - ldr r1, [r5] -_0801E642: - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] - b _0801E662 - .pool -_0801E650: - ldrh r0, [r1, 0xA] - cmp r0, 0x95 - bls _0801E65E - movs r0, 0x9 - bl sub_801EBD4 - b _0801E662 -_0801E65E: - adds r0, 0x1 - strh r0, [r1, 0xA] -_0801E662: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801E5C4 - - thumb_func_start sub_801E668 -sub_801E668: @ 801E668 - push {r4,lr} - ldr r1, =gUnknown_02022C84 - ldr r0, [r1] - ldrh r0, [r0, 0x6] - adds r2, r1, 0 - cmp r0, 0x4 - bhi _0801E75C - lsls r0, 2 - ldr r1, =_0801E688 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801E688: - .4byte _0801E69C - .4byte _0801E6C8 - .4byte _0801E6F0 - .4byte _0801E724 - .4byte _0801E748 -_0801E69C: - ldr r0, =sub_801F2B4 - bl FuncIsActiveTask - lsls r0, 24 - cmp r0, 0 - bne _0801E75C - ldr r4, =gUnknown_02022C84 - ldr r0, [r4] - ldrb r0, [r0, 0x13] - cmp r0, 0 - beq _0801E6BA - movs r0, 0x7 - movs r1, 0 - bl sub_801F5EC -_0801E6BA: - ldr r1, [r4] - b _0801E73A - .pool -_0801E6C8: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E75C - ldr r4, =gUnknown_02022C84 - ldr r0, [r4] - ldrb r0, [r0, 0x13] - cmp r0, 0 - beq _0801E6E6 - movs r0, 0x13 - movs r1, 0 - bl sub_801F5EC -_0801E6E6: - ldr r1, [r4] - b _0801E73A - .pool -_0801E6F0: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0801E75C - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _0801E75C - bl sub_8011A9C - adds r4, r0, 0 - cmp r4, 0 - bne _0801E75C - bl sub_800AC34 - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - strh r4, [r1, 0xA] - b _0801E73A - .pool -_0801E724: - ldr r1, [r2] - ldrh r0, [r1, 0xA] - cmp r0, 0x95 - bhi _0801E730 - adds r0, 0x1 - strh r0, [r1, 0xA] -_0801E730: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0801E75C - ldr r1, [r2] -_0801E73A: - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] - b _0801E75C - .pool -_0801E748: - ldr r1, [r2] - ldrh r0, [r1, 0xA] - cmp r0, 0x95 - bls _0801E758 - movs r0, 0x9 - bl sub_801EBD4 - b _0801E75C -_0801E758: - adds r0, 0x1 - strh r0, [r1, 0xA] -_0801E75C: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_801E668 - - thumb_func_start sub_801E764 -sub_801E764: @ 801E764 - push {r4,lr} - ldr r1, =gUnknown_02022C84 - ldr r0, [r1] - ldrh r0, [r0, 0x6] - adds r4, r1, 0 - cmp r0, 0x4 - bhi _0801E830 - lsls r0, 2 - ldr r1, =_0801E784 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801E784: - .4byte _0801E798 - .4byte _0801E7C0 - .4byte _0801E7F4 - .4byte _0801E802 - .4byte _0801E820 -_0801E798: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0801E7AC - movs r0, 0x1 - bl sub_801EBD4 - b _0801E830 - .pool -_0801E7AC: - ldr r0, [r4] - movs r1, 0xC8 - lsls r1, 1 - adds r0, r1 - bl sub_801EF4C - ldr r1, [r4] - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] -_0801E7C0: - bl IsLinkTaskFinished - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0801E830 - bl sub_8011A9C - cmp r0, 0 - bne _0801E830 - ldr r4, =gUnknown_02022C84 - ldr r1, [r4] - movs r0, 0xC8 - lsls r0, 1 - adds r1, r0 - movs r0, 0 - movs r2, 0x28 - bl SendBlock - lsls r0, 24 - cmp r0, 0 - beq _0801E830 - ldr r1, [r4] - b _0801E812 - .pool -_0801E7F4: - bl sub_801EE10 - movs r0, 0x8 - movs r1, 0 - bl sub_801F5EC - b _0801E80E -_0801E802: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E830 -_0801E80E: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] -_0801E812: - ldrh r0, [r1, 0x6] - adds r0, 0x1 - strh r0, [r1, 0x6] - b _0801E830 - .pool -_0801E820: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _0801E830 - movs r0, 0x1 - bl sub_801EBD4 -_0801E830: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_801E764 - - thumb_func_start sub_801E838 -sub_801E838: @ 801E838 - push {r4,lr} - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrh r0, [r0, 0x6] - cmp r0, 0x6 - bls _0801E846 - b _0801E968 -_0801E846: - lsls r0, 2 - ldr r1, =_0801E858 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801E858: - .4byte _0801E874 - .4byte _0801E8A4 - .4byte _0801E8F8 - .4byte _0801E910 - .4byte _0801E920 - .4byte _0801E934 - .4byte _0801E94C -_0801E874: - bl sub_801EDC4 - cmp r0, 0 - beq _0801E890 - movs r0, 0x9 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x2 - b _0801E966 - .pool -_0801E890: - movs r0, 0xD - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x5 - b _0801E966 - .pool -_0801E8A4: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0801E8CC - bl sub_801EDE0 - movs r0, 0xB - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x3 - b _0801E966 - .pool -_0801E8CC: - movs r4, 0x2 - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - beq _0801E8DA - movs r0, 0xA - b _0801E95A -_0801E8DA: - bl sub_801EBE4 - cmp r0, 0 - beq _0801E968 - movs r0, 0x1 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - strh r4, [r0, 0x6] - b _0801E968 - .pool -_0801E8F8: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E968 - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x1 - b _0801E966 - .pool -_0801E910: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E968 - movs r0, 0xA - b _0801E95A -_0801E920: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E968 - movs r0, 0x1 - bl sub_801EBD4 - b _0801E968 -_0801E934: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801E968 - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x6 - b _0801E966 - .pool -_0801E94C: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _0801E968 - movs r0, 0x7 -_0801E95A: - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x4 -_0801E966: - strh r0, [r1, 0x6] -_0801E968: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801E838 - - thumb_func_start sub_801E978 -sub_801E978: @ 801E978 - push {r4,lr} - sub sp, 0x4 - ldr r1, =gUnknown_02022C84 - ldr r0, [r1] - ldrh r0, [r0, 0x6] - adds r4, r1, 0 - cmp r0, 0xD - bls _0801E98A - b _0801EBC2 -_0801E98A: - lsls r0, 2 - ldr r1, =_0801E99C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801E99C: - .4byte _0801E9D4 - .4byte _0801E9EE - .4byte _0801EA14 - .4byte _0801EA58 - .4byte _0801EA7C - .4byte _0801EA98 - .4byte _0801EADC - .4byte _0801EB04 - .4byte _0801EB28 - .4byte _0801EB40 - .4byte _0801EB64 - .4byte _0801EB72 - .4byte _0801EB88 - .4byte _0801EBA8 -_0801E9D4: - ldr r1, [r4] - ldrb r0, [r1, 0x18] - cmp r0, 0 - bne _0801E9DE - b _0801EB82 -_0801E9DE: - movs r0, 0x7 - movs r1, 0 - bl sub_801F5EC - ldr r1, [r4] - movs r0, 0x1 - strh r0, [r1, 0x6] - b _0801EBC2 -_0801E9EE: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - beq _0801E9FC - b _0801EBC2 -_0801E9FC: - movs r0, 0xE - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x2 - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EA14: - bl sub_801FF08 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _0801EA40 - cmp r1, 0 - bgt _0801EA2E - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0801EA34 - b _0801EBC2 -_0801EA2E: - cmp r1, 0x1 - beq _0801EA34 - b _0801EBC2 -_0801EA34: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - b _0801EB82 - .pool -_0801EA40: - movs r0, 0x7 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x3 - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EA58: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - beq _0801EA66 - b _0801EBC2 -_0801EA66: - movs r0, 0xF - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x4 - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EA7C: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - beq _0801EA8A - b _0801EBC2 -_0801EA8A: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x5 - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EA98: - bl sub_801FF08 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - beq _0801EAC4 - cmp r1, 0 - bgt _0801EAB2 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0801EAB8 - b _0801EBC2 -_0801EAB2: - cmp r1, 0x1 - beq _0801EAB8 - b _0801EBC2 -_0801EAB8: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - b _0801EB82 - .pool -_0801EAC4: - movs r0, 0x7 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x6 - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EADC: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801EBC2 - movs r0, 0x10 - movs r1, 0 - bl sub_801F5EC - bl sub_801EE2C - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x7 - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EB04: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801EBC2 - bl SetContinueGameWarpStatusToDynamicWarp - movs r0, 0 - bl TrySavingData - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x8 - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EB28: - movs r0, 0x11 - movs r1, 0 - bl sub_801F5EC - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x9 - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EB40: - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801EBC2 - movs r0, 0x37 - bl PlaySE - bl ClearContinueGameWarpStatus2 - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0xA - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EB64: - ldr r1, [r4] - movs r0, 0 - strb r0, [r1, 0x19] - ldr r1, [r4] - movs r0, 0xB - strh r0, [r1, 0x6] - b _0801EBC2 -_0801EB72: - ldr r0, [r4] - ldrb r1, [r0, 0x19] - adds r1, 0x1 - strb r1, [r0, 0x19] - ldr r1, [r4] - ldrb r0, [r1, 0x19] - cmp r0, 0x78 - bls _0801EBC2 -_0801EB82: - movs r0, 0xC - strh r0, [r1, 0x6] - b _0801EBC2 -_0801EB88: - movs r1, 0x1 - negs r1, r1 - movs r0, 0 - str r0, [sp] - adds r0, r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0xD - strh r0, [r1, 0x6] - b _0801EBC2 - .pool -_0801EBA8: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0801EBC2 - bl sub_801F544 - bl sub_801DE30 - ldr r0, =CB2_ReturnToField - bl SetMainCallback2 -_0801EBC2: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801E978 - - thumb_func_start sub_801EBD4 -sub_801EBD4: @ 801EBD4 - ldr r1, =gUnknown_02022C84 - ldr r1, [r1] - movs r2, 0 - strh r0, [r1, 0x4] - strh r2, [r1, 0x6] - bx lr - .pool - thumb_func_end sub_801EBD4 - - thumb_func_start sub_801EBE4 -sub_801EBE4: @ 801EBE4 - push {lr} - ldr r0, =gMain - ldrh r2, [r0, 0x30] - movs r0, 0x40 - ands r0, r2 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0 - bne _0801EC6E - movs r0, 0x80 - ands r0, r2 - cmp r0, 0 - beq _0801EC24 - ldr r0, =gUnknown_02022C84 - ldr r2, [r0] - ldr r1, =gUnknown_082F2AA4 - ldrb r0, [r2, 0x10] - adds r0, r1 - ldrb r1, [r2, 0x12] - ldrb r0, [r0] - cmp r1, r0 - bcs _0801EC20 - adds r0, r1, 0x1 - b _0801EC88 - .pool -_0801EC20: - strb r3, [r2, 0x12] - b _0801EC8A -_0801EC24: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - ldrb r0, [r1, 0x10] - cmp r0, 0x3 - beq _0801EC6A - movs r0, 0x20 - ands r0, r2 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0 - beq _0801EC52 - ldrb r0, [r1, 0x11] - cmp r0, 0 - beq _0801EC4C - subs r0, 0x1 - strb r0, [r1, 0x11] - b _0801EC8A - .pool -_0801EC4C: - movs r0, 0x4 - strb r0, [r1, 0x11] - b _0801EC8A -_0801EC52: - movs r0, 0x10 - ands r0, r2 - cmp r0, 0 - beq _0801EC6A - ldrb r0, [r1, 0x11] - cmp r0, 0x3 - bhi _0801EC66 - adds r0, 0x1 - strb r0, [r1, 0x11] - b _0801EC8A -_0801EC66: - strb r3, [r1, 0x11] - b _0801EC8A -_0801EC6A: - movs r0, 0 - b _0801EC8C -_0801EC6E: - ldr r0, =gUnknown_02022C84 - ldr r2, [r0] - ldrb r0, [r2, 0x12] - cmp r0, 0 - beq _0801EC80 - subs r0, 0x1 - b _0801EC88 - .pool -_0801EC80: - ldr r0, =gUnknown_082F2AA4 - ldrb r1, [r2, 0x10] - adds r1, r0 - ldrb r0, [r1] -_0801EC88: - strb r0, [r2, 0x12] -_0801EC8A: - movs r0, 0x1 -_0801EC8C: - pop {r1} - bx r1 - .pool - thumb_func_end sub_801EBE4 - - thumb_func_start sub_801EC94 -sub_801EC94: @ 801EC94 - push {r4-r6,lr} - sub sp, 0x18 - ldr r0, =gUnknown_02022C84 - ldr r5, [r0] - ldrb r0, [r5, 0x10] - cmp r0, 0x3 - beq _0801ECDC - ldr r3, =gUnknown_082F2BA8 - ldrb r1, [r5, 0x12] - lsls r1, 2 - adds r2, r0, 0 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r1, r0 - adds r1, r3 - ldr r4, [r1] - ldrb r0, [r5, 0x11] - cmp r0, 0 - beq _0801ECCE - adds r1, r0, 0 -_0801ECBE: - ldrb r0, [r4] - cmp r0, 0xF9 - bne _0801ECC6 - adds r4, 0x1 -_0801ECC6: - adds r4, 0x1 - subs r1, 0x1 - cmp r1, 0 - bne _0801ECBE -_0801ECCE: - movs r5, 0x1 - b _0801ED02 - .pool -_0801ECDC: - ldrb r0, [r5, 0x12] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 2 - adds r1, r0 - adds r1, 0xB9 - adds r1, r5, r1 - mov r0, sp - bl StringCopy - movs r1, 0 - strb r1, [r0] - movs r1, 0xFF - strb r1, [r0, 0x1] - mov r4, sp - mov r0, sp - bl StringLength_Multibyte - adds r5, r0, 0 -_0801ED02: - ldr r6, =gUnknown_02022C84 - ldr r1, [r6] - ldrb r0, [r1, 0x15] - strb r0, [r1, 0x14] - cmp r4, 0 - beq _0801ED5A - bl sub_801EE84 - adds r2, r0, 0 - subs r5, 0x1 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - beq _0801ED56 - ldr r0, [r6] - ldrb r0, [r0, 0x15] - cmp r0, 0xE - bhi _0801ED56 - adds r3, r6, 0 -_0801ED28: - ldrb r0, [r4] - cmp r0, 0xF9 - bne _0801ED34 - strb r0, [r2] - adds r4, 0x1 - adds r2, 0x1 -_0801ED34: - ldrb r0, [r4] - strb r0, [r2] - adds r4, 0x1 - adds r2, 0x1 - ldr r1, [r3] - ldrb r0, [r1, 0x15] - adds r0, 0x1 - strb r0, [r1, 0x15] - subs r5, 0x1 - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - beq _0801ED56 - ldr r0, [r3] - ldrb r0, [r0, 0x15] - cmp r0, 0xE - bls _0801ED28 -_0801ED56: - movs r0, 0xFF - strb r0, [r2] -_0801ED5A: - add sp, 0x18 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801EC94 - - thumb_func_start sub_801ED68 -sub_801ED68: @ 801ED68 - push {r4,lr} - ldr r4, =gUnknown_02022C84 - ldr r1, [r4] - ldrb r0, [r1, 0x15] - strb r0, [r1, 0x14] - ldr r0, [r4] - ldrb r0, [r0, 0x15] - cmp r0, 0 - beq _0801ED8A - bl sub_801EEA8 - movs r1, 0xFF - strb r1, [r0] - ldr r1, [r4] - ldrb r0, [r1, 0x15] - subs r0, 0x1 - strb r0, [r1, 0x15] -_0801ED8A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801ED68 - - thumb_func_start sub_801ED94 -sub_801ED94: @ 801ED94 - push {lr} - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - ldrb r0, [r1, 0x15] - subs r0, 0x1 - strb r0, [r1, 0x14] - bl sub_801EEA8 - adds r2, r0, 0 - ldrb r0, [r2] - cmp r0, 0xF9 - beq _0801EDB8 - ldr r1, =gUnknown_082F2AA8 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0801EDB8 - strb r0, [r2] -_0801EDB8: - pop {r0} - bx r0 - .pool - thumb_func_end sub_801ED94 - - thumb_func_start sub_801EDC4 -sub_801EDC4: @ 801EDC4 - push {lr} - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x15] - cmp r0, 0 - bne _0801EDD8 - movs r0, 0 - b _0801EDDA - .pool -_0801EDD8: - movs r0, 0x1 -_0801EDDA: - pop {r1} - bx r1 - thumb_func_end sub_801EDC4 - - thumb_func_start sub_801EDE0 -sub_801EDE0: @ 801EDE0 - push {r4,lr} - bl sub_801F114 - adds r1, r0, 0 - ldr r4, =gUnknown_02022C84 - ldr r0, [r4] - ldrb r3, [r0, 0x12] - lsls r2, r3, 2 - adds r2, r3 - lsls r2, 2 - adds r2, r3 - adds r2, 0xB9 - adds r0, r2 - bl StringCopy - ldr r1, [r4] - movs r0, 0x1 - strb r0, [r1, 0x18] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801EDE0 - - thumb_func_start sub_801EE10 -sub_801EE10: @ 801EE10 - ldr r1, =gUnknown_02022C84 - ldr r2, [r1] - movs r0, 0xFF - strb r0, [r2, 0x1A] - ldr r2, [r1] - movs r3, 0 - movs r0, 0xF - strb r0, [r2, 0x14] - ldr r0, [r1] - strb r3, [r0, 0x15] - bx lr - .pool - thumb_func_end sub_801EE10 - - thumb_func_start sub_801EE2C -sub_801EE2C: @ 801EE2C - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r0, =gSaveBlock1Ptr - mov r8, r0 - ldr r7, =gUnknown_02022C84 - movs r6, 0xB9 - ldr r5, =0x00003c88 - movs r4, 0x9 -_0801EE3E: - mov r1, r8 - ldr r0, [r1] - adds r0, r5 - ldr r1, [r7] - adds r1, r6 - bl StringCopy - adds r6, 0x15 - adds r5, 0x15 - subs r4, 0x1 - cmp r4, 0 - bge _0801EE3E - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801EE2C - - thumb_func_start sub_801EE6C -sub_801EE6C: @ 801EE6C - ldr r2, =gUnknown_02022C84 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 2 - adds r1, r0 - adds r1, 0xB9 - ldr r0, [r2] - adds r0, r1 - bx lr - .pool - thumb_func_end sub_801EE6C - - thumb_func_start sub_801EE84 -sub_801EE84: @ 801EE84 - push {lr} - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0x1A - ldrb r0, [r0, 0x1A] - cmp r0, 0xFF - beq _0801EE9C -_0801EE94: - adds r1, 0x1 - ldrb r0, [r1] - cmp r0, 0xFF - bne _0801EE94 -_0801EE9C: - adds r0, r1, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_801EE84 - - thumb_func_start sub_801EEA8 -sub_801EEA8: @ 801EEA8 - push {lr} - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - adds r2, r0, 0 - adds r2, 0x1A - adds r1, r2, 0 - ldrb r0, [r0, 0x1A] - cmp r0, 0xFF - beq _0801EECC -_0801EEBA: - adds r2, r1, 0 - ldrb r0, [r2] - cmp r0, 0xF9 - bne _0801EEC4 - adds r1, r2, 0x1 -_0801EEC4: - adds r1, 0x1 - ldrb r0, [r1] - cmp r0, 0xFF - bne _0801EEBA -_0801EECC: - adds r0, r2, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_801EEA8 - - thumb_func_start sub_801EED8 -sub_801EED8: @ 801EED8 - push {r4,lr} - ldr r4, =gUnknown_02022C84 - ldr r0, [r4] - adds r0, 0x1A - bl StringLength_Multibyte - adds r2, r0, 0 - ldr r0, [r4] - adds r1, r0, 0 - adds r1, 0x1A - movs r4, 0 - cmp r2, 0xA - bls _0801EF0C - subs r2, 0xA - movs r3, 0 - cmp r4, r2 - bcs _0801EF0C -_0801EEFA: - ldrb r0, [r1] - cmp r0, 0xF9 - bne _0801EF02 - adds r1, 0x1 -_0801EF02: - adds r1, 0x1 - adds r4, 0x1 - adds r3, 0x1 - cmp r3, r2 - bcc _0801EEFA -_0801EF0C: - lsls r0, r4, 16 - lsrs r0, 16 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801EED8 - - thumb_func_start sub_801EF1C -sub_801EF1C: @ 801EF1C - movs r1, 0 - strb r1, [r0] - bx lr - thumb_func_end sub_801EF1C - - thumb_func_start sub_801EF24 -sub_801EF24: @ 801EF24 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x2 - strb r0, [r4] - adds r0, r4, 0x1 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - bl StringCopy - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x13] - strb r0, [r4, 0x9] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801EF24 - - thumb_func_start sub_801EF4C -sub_801EF4C: @ 801EF4C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x1 - strb r0, [r4] - adds r0, r4, 0x1 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - bl StringCopy - adds r4, 0x9 - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - adds r1, 0x1A - adds r0, r4, 0 - bl StringCopy - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801EF4C - - thumb_func_start sub_801EF7C -sub_801EF7C: @ 801EF7C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x3 - strb r0, [r4] - adds r0, r4, 0x1 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - bl StringCopy - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x13] - strb r0, [r4, 0x9] - bl sub_8011A50 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801EF7C - - thumb_func_start sub_801EFA8 -sub_801EFA8: @ 801EFA8 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x4 - strb r0, [r4] - adds r0, r4, 0x1 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - bl StringCopy - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x13] - strb r0, [r4, 0x9] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801EFA8 - - thumb_func_start sub_801EFD0 -sub_801EFD0: @ 801EFD0 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x5 - strb r0, [r4] - adds r0, r4, 0x1 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - bl StringCopy - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x13] - strb r0, [r4, 0x9] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801EFD0 - - thumb_func_start sub_801EFF8 -sub_801EFF8: @ 801EFF8 - push {r4-r6,lr} - adds r6, r0, 0 - adds r5, r1, 0 - ldrb r0, [r5] - adds r1, r0, 0 - adds r4, r5, 0x1 - adds r5, r4, 0 - adds r5, 0x8 - cmp r0, 0x2 - beq _0801F020 - cmp r0, 0x2 - bgt _0801F016 - cmp r0, 0x1 - beq _0801F044 - b _0801F0A8 -_0801F016: - cmp r1, 0x3 - beq _0801F07A - cmp r1, 0x5 - beq _0801F06E - b _0801F0A8 -_0801F020: - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x13] - ldrb r1, [r4, 0x8] - cmp r0, r1 - beq _0801F0A8 - bl DynamicPlaceholderTextUtil_Reset - movs r0, 0 - adds r1, r4, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - ldr r1, =gText_F700JoinedChat - b _0801F094 - .pool -_0801F044: - adds r0, r6, 0 - adds r1, r4, 0 - bl StringCopy - movs r1, 0xFC - strb r1, [r0] - adds r0, 0x1 - movs r1, 0x13 - strb r1, [r0] - adds r0, 0x1 - movs r1, 0x2A - strb r1, [r0] - adds r0, 0x1 - movs r1, 0xF0 - strb r1, [r0] - adds r0, 0x1 - adds r1, r5, 0 - bl StringCopy - movs r0, 0x1 - b _0801F0AA -_0801F06E: - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - adds r0, 0x79 - adds r1, r4, 0 - bl StringCopy -_0801F07A: - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x13] - ldrb r5, [r5] - cmp r0, r5 - beq _0801F0A8 - bl DynamicPlaceholderTextUtil_Reset - movs r0, 0 - adds r1, r4, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - ldr r1, =gText_F700LeftChat -_0801F094: - adds r0, r6, 0 - bl DynamicPlaceholderTextUtil_ExpandPlaceholders - movs r0, 0x1 - b _0801F0AA - .pool -_0801F0A8: - movs r0, 0 -_0801F0AA: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801EFF8 - - thumb_func_start sub_801F0B0 -sub_801F0B0: @ 801F0B0 - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x10] - bx lr - .pool - thumb_func_end sub_801F0B0 - - thumb_func_start sub_801F0BC -sub_801F0BC: @ 801F0BC - ldr r2, =gUnknown_02022C84 - ldr r3, [r2] - ldrb r2, [r3, 0x11] - strb r2, [r0] - ldrb r0, [r3, 0x12] - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_801F0BC - - thumb_func_start sub_801F0D0 -sub_801F0D0: @ 801F0D0 - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - adds r0, 0x1A - bx lr - .pool - thumb_func_end sub_801F0D0 - - thumb_func_start sub_801F0DC -sub_801F0DC: @ 801F0DC - push {lr} - bl sub_801F0D0 - bl StringLength_Multibyte - pop {r1} - bx r1 - thumb_func_end sub_801F0DC - - thumb_func_start sub_801F0EC -sub_801F0EC: @ 801F0EC - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r3, [r0, 0x15] - ldrb r2, [r0, 0x14] - subs r0, r3, r2 - cmp r0, 0 - bge _0801F108 - negs r0, r0 - str r3, [r4] - b _0801F10A - .pool -_0801F108: - str r2, [r4] -_0801F10A: - str r0, [r1] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_801F0EC - - thumb_func_start sub_801F114 -sub_801F114: @ 801F114 - push {lr} - bl sub_801EED8 - lsls r0, 16 - lsrs r2, r0, 16 - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0x1A - cmp r2, 0 - beq _0801F13A -_0801F12A: - ldrb r0, [r1] - cmp r0, 0xF9 - bne _0801F132 - adds r1, 0x1 -_0801F132: - adds r1, 0x1 - subs r2, 0x1 - cmp r2, 0 - bne _0801F12A -_0801F13A: - adds r0, r1, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_801F114 - - thumb_func_start sub_801F144 -sub_801F144: @ 801F144 - push {r4,lr} - bl sub_801EED8 - lsls r0, 16 - lsrs r4, r0, 16 - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0x1A - movs r2, 0 - movs r3, 0 - cmp r2, r4 - bcs _0801F174 -_0801F15E: - ldrb r0, [r1] - cmp r0, 0xF9 - bne _0801F166 - adds r1, 0x1 -_0801F166: - adds r1, 0x1 - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - adds r3, 0x1 - cmp r3, r4 - bcc _0801F15E -_0801F174: - adds r0, r2, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801F144 - - thumb_func_start sub_801F180 -sub_801F180: @ 801F180 - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - adds r0, 0x39 - bx lr - .pool - thumb_func_end sub_801F180 - - thumb_func_start sub_801F18C -sub_801F18C: @ 801F18C - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x16] - bx lr - .pool - thumb_func_end sub_801F18C - - thumb_func_start sub_801F198 -sub_801F198: @ 801F198 - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - ldrb r0, [r0, 0x15] - bx lr - .pool - thumb_func_end sub_801F198 - - thumb_func_start sub_801F1A4 -sub_801F1A4: @ 801F1A4 - push {lr} - bl sub_801EEA8 - ldrb r1, [r0] - cmp r1, 0xFF - bhi _0801F1BE - ldr r0, =gUnknown_082F2AA8 - adds r0, r1, r0 - ldrb r0, [r0] - cmp r0, r1 - beq _0801F1BE - cmp r0, 0 - bne _0801F1C8 -_0801F1BE: - movs r0, 0x3 - b _0801F1CA - .pool -_0801F1C8: - movs r0, 0 -_0801F1CA: - pop {r1} - bx r1 - thumb_func_end sub_801F1A4 - - thumb_func_start sub_801F1D0 -sub_801F1D0: @ 801F1D0 - ldr r0, =gUnknown_02022C84 - ldr r0, [r0] - adds r0, 0x79 - bx lr - .pool - thumb_func_end sub_801F1D0 - - thumb_func_start copy_strings_to_sav1 -copy_strings_to_sav1: @ 801F1DC - push {r4,lr} - ldr r4, =gSaveBlock1Ptr - ldr r0, [r4] - ldr r1, =0x00003c88 - adds r0, r1 - ldr r1, =gText_Hello - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00003c9d - adds r0, r1 - ldr r1, =gText_Pokemon2 - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00003cb2 - adds r0, r1 - ldr r1, =gText_Trade - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00003cc7 - adds r0, r1 - ldr r1, =gText_Battle - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00003cdc - adds r0, r1 - ldr r1, =gText_Lets - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00003cf1 - adds r0, r1 - ldr r1, =gText_Ok - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00003d06 - adds r0, r1 - ldr r1, =gText_Sorry - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00003d1b - adds r0, r1 - ldr r1, =gText_YayUnkF9F9 - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00003d30 - adds r0, r1 - ldr r1, =gText_ThankYou - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00003d45 - adds r0, r1 - ldr r1, =gText_ByeBye - bl StringCopy - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end copy_strings_to_sav1 - - thumb_func_start sub_801F2B4 -sub_801F2B4: @ 801F2B4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0x7 - bls _0801F2CE - b _0801F4C4 -_0801F2CE: - lsls r0, 2 - ldr r1, =_0801F2E0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801F2E0: - .4byte _0801F300 - .4byte _0801F30E - .4byte _0801F4A8 - .4byte _0801F35C - .4byte _0801F448 - .4byte _0801F480 - .4byte _0801F494 - .4byte _0801F438 -_0801F300: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0801F30A - b _0801F49C -_0801F30A: - movs r0, 0x1 - strh r0, [r4] -_0801F30E: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - adds r2, r0, 0 - strh r0, [r4, 0x8] - ldr r3, =gUnknown_02022C84 - ldr r0, [r3] - ldrb r1, [r0, 0xD] - movs r5, 0x8 - ldrsh r0, [r4, r5] - cmp r1, r0 - beq _0801F33C - movs r0, 0x2 - strh r0, [r4] - ldr r0, [r3] - strb r2, [r0, 0xD] - b _0801F4C4 - .pool -_0801F33C: - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x6] - cmp r0, 0 - bne _0801F354 - bl sub_8011A9C - cmp r0, 0 - beq _0801F354 - b _0801F4C4 -_0801F354: - movs r0, 0 - strh r0, [r4, 0x2] - movs r0, 0x3 - strh r0, [r4] -_0801F35C: - movs r1, 0x2 - ldrsh r0, [r4, r1] - cmp r0, 0x4 - bgt _0801F396 - movs r2, 0x6 - ldrsh r0, [r4, r2] - movs r3, 0x2 - ldrsh r1, [r4, r3] - asrs r0, r1 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0801F396 - movs r2, 0x1 -_0801F378: - ldrh r0, [r4, 0x2] - adds r0, 0x1 - strh r0, [r4, 0x2] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x4 - bgt _0801F396 - movs r5, 0x6 - ldrsh r0, [r4, r5] - movs r3, 0x2 - ldrsh r1, [r4, r3] - asrs r0, r1 - ands r0, r2 - cmp r0, 0 - beq _0801F378 -_0801F396: - ldrh r1, [r4, 0x2] - movs r5, 0x2 - ldrsh r0, [r4, r5] - cmp r0, 0x5 - bne _0801F3A2 - b _0801F4C0 -_0801F3A2: - strh r1, [r4, 0x4] - lsls r0, r1, 24 - lsrs r0, 24 - bl ResetBlockReceivedFlag - movs r1, 0x2 - ldrsh r0, [r4, r1] - lsls r0, 8 - ldr r1, =gBlockRecvBuffer - adds r0, r1 - ldrb r0, [r0] - subs r0, 0x1 - cmp r0, 0x4 - bhi _0801F3E4 - lsls r0, 2 - ldr r1, =_0801F3D0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801F3D0: - .4byte _0801F3E4 - .4byte _0801F3E8 - .4byte _0801F3EC - .4byte _0801F3F0 - .4byte _0801F3F4 -_0801F3E4: - movs r0, 0x3 - b _0801F3F6 -_0801F3E8: - movs r0, 0x3 - b _0801F3F6 -_0801F3EC: - movs r0, 0x4 - b _0801F3F6 -_0801F3F0: - movs r0, 0x5 - b _0801F3F6 -_0801F3F4: - movs r0, 0x6 -_0801F3F6: - strh r0, [r4, 0xA] - ldr r5, =gUnknown_02022C84 - ldr r0, [r5] - adds r0, 0x39 - movs r2, 0x2 - ldrsh r1, [r4, r2] - lsls r1, 8 - ldr r2, =gBlockRecvBuffer - adds r1, r2 - bl sub_801EFF8 - cmp r0, 0 - beq _0801F42C - ldr r0, [r5] - ldrh r1, [r4, 0x2] - strb r1, [r0, 0x16] - movs r0, 0xC - movs r1, 0x2 - bl sub_801F5EC - movs r0, 0x7 - b _0801F42E - .pool -_0801F42C: - ldrh r0, [r4, 0xA] -_0801F42E: - strh r0, [r4] - ldrh r0, [r4, 0x2] - adds r0, 0x1 - strh r0, [r4, 0x2] - b _0801F4C4 -_0801F438: - movs r0, 0x2 - bl sub_801F644 - lsls r0, 24 - cmp r0, 0 - bne _0801F4C4 - ldrh r0, [r4, 0xA] - b _0801F4C2 -_0801F448: - ldr r6, =gUnknown_02022C84 - ldr r0, [r6] - ldrb r0, [r0, 0x13] - cmp r0, 0 - bne _0801F47C - movs r3, 0x4 - ldrsh r0, [r4, r3] - cmp r0, 0 - beq _0801F47C - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _0801F474 - bl sub_80104B0 - ldr r1, [r6] - movs r0, 0x1 - b _0801F49A - .pool -_0801F474: - movs r5, 0x4 - ldrsh r0, [r4, r5] - bl sub_8011DE0 -_0801F47C: - movs r0, 0x3 - b _0801F4C2 -_0801F480: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - ldrb r0, [r1, 0x13] - cmp r0, 0 - beq _0801F49C - movs r0, 0x2 - b _0801F49A - .pool -_0801F494: - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - movs r0, 0x3 -_0801F49A: - strb r0, [r1, 0x17] -_0801F49C: - adds r0, r5, 0 - bl DestroyTask - b _0801F4C4 - .pool -_0801F4A8: - bl sub_8011A9C - cmp r0, 0 - bne _0801F4C4 - ldr r0, =gUnknown_02022C84 - ldr r1, [r0] - ldrb r0, [r1, 0x13] - cmp r0, 0 - bne _0801F4C0 - ldrb r0, [r1, 0xD] - bl sub_80110B8 -_0801F4C0: - movs r0, 0x1 -_0801F4C2: - strh r0, [r4] -_0801F4C4: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801F2B4 - - thumb_func_start sub_801F4D0 -sub_801F4D0: @ 801F4D0 - push {r4,lr} - ldr r4, =gUnknown_02022C88 - ldr r0, =0x00002168 - bl Alloc - str r0, [r4] - cmp r0, 0 - beq _0801F52C - bl sub_8020890 - cmp r0, 0 - beq _0801F52C - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_082F2C60 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - ldr r0, =gUnknown_082F2C70 - bl InitWindows - bl reset_temp_tile_data_buffers - bl sub_8020770 - ldr r0, [r4] - bl sub_801F574 - bl sub_801F580 - movs r0, 0 - movs r1, 0 - bl sub_801F5EC - movs r0, 0x1 - b _0801F52E - .pool -_0801F52C: - movs r0, 0 -_0801F52E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801F4D0 - - thumb_func_start sub_801F534 -sub_801F534: @ 801F534 - push {lr} - movs r0, 0 - bl sub_801F644 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_801F534 - - thumb_func_start sub_801F544 -sub_801F544: @ 801F544 - push {r4,lr} - bl sub_80208D0 - ldr r4, =gUnknown_02022C88 - ldr r0, [r4] - cmp r0, 0 - beq _0801F55A - bl Free - movs r0, 0 - str r0, [r4] -_0801F55A: - bl FreeAllWindowBuffers - ldr r1, =gScanlineEffect - movs r0, 0x3 - strb r0, [r1, 0x15] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801F544 - - thumb_func_start sub_801F574 -sub_801F574: @ 801F574 - movs r2, 0 - movs r1, 0xFF - strh r1, [r0, 0x18] - strh r1, [r0, 0x1E] - strh r2, [r0, 0x1A] - bx lr - thumb_func_end sub_801F574 - - thumb_func_start sub_801F580 -sub_801F580: @ 801F580 - push {r4,r5,lr} - ldr r1, =gUnknown_02022C88 - ldr r0, [r1] - cmp r0, 0 - beq _0801F5A8 - movs r2, 0 - adds r4, r1, 0 - ldr r5, =sub_801FDD8 - movs r3, 0 -_0801F592: - ldr r0, [r4] - lsls r1, r2, 3 - adds r0, r1 - str r5, [r0] - strb r3, [r0, 0x4] - ldr r0, [r4] - adds r0, r1 - strb r3, [r0, 0x5] - adds r2, 0x1 - cmp r2, 0x2 - ble _0801F592 -_0801F5A8: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801F580 - - thumb_func_start sub_801F5B8 -sub_801F5B8: @ 801F5B8 - push {r4-r6,lr} - ldr r1, =gUnknown_02022C88 - ldr r0, [r1] - cmp r0, 0 - beq _0801F5E0 - movs r5, 0 - adds r6, r1, 0 -_0801F5C6: - ldr r1, [r6] - lsls r4, r5, 3 - adds r1, r4 - adds r0, r1, 0x5 - ldr r1, [r1] - bl _call_via_r1 - ldr r1, [r6] - adds r1, r4 - strb r0, [r1, 0x4] - adds r5, 0x1 - cmp r5, 0x2 - ble _0801F5C6 -_0801F5E0: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801F5B8 - - thumb_func_start sub_801F5EC -sub_801F5EC: @ 801F5EC - push {r4-r7,lr} - lsls r0, 16 - lsrs r6, r0, 16 - lsls r1, 24 - ldr r3, =gUnknown_02022C88 - ldr r0, [r3] - lsrs r1, 21 - adds r0, r1 - ldr r2, =sub_801FDD8 - str r2, [r0] - movs r4, 0 - adds r5, r3, 0 - adds r3, r1, 0 - mov r12, r4 - ldr r1, =gUnknown_082F2C98 - movs r7, 0x1 - adds r2, r1, 0x4 -_0801F60E: - ldrh r0, [r1] - cmp r0, r6 - bne _0801F634 - ldr r1, [r5] - adds r1, r3 - ldr r0, [r2] - str r0, [r1] - strb r7, [r1, 0x4] - ldr r0, [r5] - adds r0, r3 - mov r1, r12 - strb r1, [r0, 0x5] - b _0801F63E - .pool -_0801F634: - adds r1, 0x8 - adds r2, 0x8 - adds r4, 0x1 - cmp r4, 0x14 - bls _0801F60E -_0801F63E: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_801F5EC - - thumb_func_start sub_801F644 -sub_801F644: @ 801F644 - lsls r0, 24 - ldr r1, =gUnknown_02022C88 - ldr r1, [r1] - lsrs r0, 21 - adds r1, r0 - ldrb r0, [r1, 0x4] - bx lr - .pool - thumb_func_end sub_801F644 - - thumb_func_start sub_801F658 -sub_801F658: @ 801F658 - push {r4,lr} - adds r4, r0, 0 - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _0801F6EE - ldrb r0, [r4] - cmp r0, 0x6 - bhi _0801F6E4 - lsls r0, 2 - ldr r1, =_0801F67C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801F67C: - .4byte _0801F698 - .4byte _0801F6A2 - .4byte _0801F6A8 - .4byte _0801F6AE - .4byte _0801F6B4 - .4byte _0801F6BA - .4byte _0801F6CC -_0801F698: - bl sub_8020480 - bl sub_8020538 - b _0801F6E8 -_0801F6A2: - bl sub_8020584 - b _0801F6E8 -_0801F6A8: - bl sub_80205B4 - b _0801F6E8 -_0801F6AE: - bl task_tutorial_story_unknown - b _0801F6E8 -_0801F6B4: - bl sub_8020680 - b _0801F6E8 -_0801F6BA: - bl sub_80206A4 - bl sub_80206D0 - bl sub_8020740 - bl sub_80206E8 - b _0801F6E8 -_0801F6CC: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801F6E8 - bl sub_80208E8 - bl sub_8020A68 - bl sub_8020B20 - b _0801F6E8 -_0801F6E4: - movs r0, 0 - b _0801F6F0 -_0801F6E8: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] -_0801F6EE: - movs r0, 0x1 -_0801F6F0: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801F658 - - thumb_func_start sub_801F6F8 -sub_801F6F8: @ 801F6F8 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801F708 - cmp r0, 0x1 - beq _0801F716 - b _0801F720 -_0801F708: - bl sub_80203B0 - movs r0, 0x3 - movs r1, 0x3 - bl CopyWindowToVram - b _0801F720 -_0801F716: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801F728 -_0801F720: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - movs r0, 0x1 -_0801F728: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801F6F8 - - thumb_func_start sub_801F730 -sub_801F730: @ 801F730 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801F740 - cmp r0, 0x1 - beq _0801F74E - b _0801F758 -_0801F740: - bl sub_802040C - movs r0, 0x3 - movs r1, 0x3 - bl CopyWindowToVram - b _0801F758 -_0801F74E: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801F760 -_0801F758: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - movs r0, 0x1 -_0801F760: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801F730 - - thumb_func_start sub_801F768 -sub_801F768: @ 801F768 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0x1 - beq _0801F79E - cmp r0, 0x1 - bgt _0801F77C - cmp r0, 0 - beq _0801F782 - b _0801F7C4 -_0801F77C: - cmp r0, 0x2 - beq _0801F7AA - b _0801F7C4 -_0801F782: - movs r0, 0x1 - bl sub_802091C - bl sub_8020320 - cmp r0, 0 - bne _0801F7CA - bl sub_80201A4 - movs r0, 0x2 - movs r1, 0x2 - bl CopyWindowToVram - b _0801F7C4 -_0801F79E: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - beq _0801F7C4 - b _0801F7CA -_0801F7AA: - bl sub_8020368 - cmp r0, 0 - bne _0801F7CA - bl sub_802093C - movs r0, 0 - bl sub_802091C - bl sub_8020B80 - movs r0, 0 - b _0801F7CC -_0801F7C4: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] -_0801F7CA: - movs r0, 0x1 -_0801F7CC: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801F768 - - thumb_func_start sub_801F7D4 -sub_801F7D4: @ 801F7D4 - push {lr} - bl sub_802093C - movs r0, 0 - pop {r1} - bx r1 - thumb_func_end sub_801F7D4 - - thumb_func_start sub_801F7E0 -sub_801F7E0: @ 801F7E0 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801F7F0 - cmp r0, 0x1 - beq _0801F814 - b _0801F81E -_0801F7F0: - movs r0, 0 - movs r1, 0 - bl sub_801FF18 - movs r0, 0x17 - movs r1, 0xB - movs r2, 0x1 - bl sub_801FDDC - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - b _0801F81E - .pool -_0801F814: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801F826 -_0801F81E: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - movs r0, 0x1 -_0801F826: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801F7E0 - - thumb_func_start sub_801F82C -sub_801F82C: @ 801F82C - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801F83C - cmp r0, 0x1 - beq _0801F84C - b _0801F862 -_0801F83C: - bl sub_8020094 - bl sub_801FEBC - movs r0, 0 - bl CopyBgTilemapBufferToVram - b _0801F862 -_0801F84C: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801F868 - bl sub_80200C8 - bl sub_801FEE4 - movs r0, 0 - b _0801F86A -_0801F862: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] -_0801F868: - movs r0, 0x1 -_0801F86A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801F82C - - thumb_func_start sub_801F870 -sub_801F870: @ 801F870 - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801F882 - cmp r0, 0x1 - beq _0801F8BA - b _0801F8CC -_0801F882: - add r1, sp, 0x8 - add r0, sp, 0x4 - bl sub_801F0EC - ldr r0, [sp, 0x4] - lsls r0, 16 - lsrs r0, 16 - ldr r1, [sp, 0x8] - lsls r1, 16 - lsrs r1, 16 - movs r2, 0 - bl sub_80200EC - bl sub_801F0D0 - adds r1, r0, 0 - movs r0, 0x2 - str r0, [sp] - movs r0, 0 - movs r2, 0x3 - movs r3, 0x1 - bl sub_8020118 - movs r0, 0x1 - movs r1, 0x2 - bl CopyWindowToVram - b _0801F8CC -_0801F8BA: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801F8D2 - bl sub_8020B80 - movs r0, 0 - b _0801F8D4 -_0801F8CC: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] -_0801F8D2: - movs r0, 0x1 -_0801F8D4: - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801F870 - - thumb_func_start sub_801F8DC -sub_801F8DC: @ 801F8DC - push {r4-r6,lr} - sub sp, 0x4 - adds r6, r0, 0 - ldrb r0, [r6] - cmp r0, 0x1 - beq _0801F938 - cmp r0, 0x1 - bgt _0801F8F2 - cmp r0, 0 - beq _0801F8FC - b _0801F972 -_0801F8F2: - cmp r0, 0x2 - beq _0801F95C - cmp r0, 0x3 - beq _0801F96E - b _0801F972 -_0801F8FC: - bl sub_801F144 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - bl sub_801F114 - adds r5, r0, 0 - bl StringLength_Multibyte - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - movs r2, 0x66 - bl sub_80200EC - movs r0, 0x5 - str r0, [sp] - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0 - movs r3, 0x4 - bl sub_8020118 - movs r0, 0x1 - movs r1, 0x2 - bl CopyWindowToVram - b _0801F972 -_0801F938: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801F978 - movs r0, 0x1 - movs r1, 0x10 - bl sub_801FF18 - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - b _0801F972 - .pool -_0801F95C: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801F978 - movs r0, 0x1 - bl sub_80209AC - b _0801F972 -_0801F96E: - movs r0, 0 - b _0801F97A -_0801F972: - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] -_0801F978: - movs r0, 0x1 -_0801F97A: - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801F8DC - - thumb_func_start sub_801F984 -sub_801F984: @ 801F984 - push {r4-r6,lr} - sub sp, 0x4 - adds r6, r0, 0 - ldrb r0, [r6] - cmp r0, 0x1 - beq _0801F9E0 - cmp r0, 0x1 - bgt _0801F99A - cmp r0, 0 - beq _0801F9A4 - b _0801FA1A -_0801F99A: - cmp r0, 0x2 - beq _0801FA00 - cmp r0, 0x3 - beq _0801FA16 - b _0801FA1A -_0801F9A4: - bl sub_801F144 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - bl sub_801F114 - adds r5, r0, 0 - bl StringLength_Multibyte - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - movs r2, 0 - bl sub_80200EC - movs r0, 0x2 - str r0, [sp] - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0x3 - movs r3, 0x1 - bl sub_8020118 - movs r0, 0x1 - movs r1, 0x2 - bl CopyWindowToVram - b _0801FA1A -_0801F9E0: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801FA20 - bl sub_8020094 - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - b _0801FA1A - .pool -_0801FA00: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801FA20 - movs r0, 0 - bl sub_80209AC - bl sub_80200C8 - b _0801FA1A -_0801FA16: - movs r0, 0 - b _0801FA22 -_0801FA1A: - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] -_0801FA20: - movs r0, 0x1 -_0801FA22: - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801F984 - - thumb_func_start sub_801FA2C -sub_801FA2C: @ 801FA2C - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FA3C - cmp r0, 0x1 - beq _0801FA50 - b _0801FA5E -_0801FA3C: - bl sub_80201A4 - movs r0, 0x2 - movs r1, 0x2 - bl CopyWindowToVram - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FA5E -_0801FA50: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801FA5E - movs r0, 0 - b _0801FA60 -_0801FA5E: - movs r0, 0x1 -_0801FA60: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FA2C - - thumb_func_start sub_801FA68 -sub_801FA68: @ 801FA68 - push {r4-r6,lr} - adds r6, r0, 0 - ldrb r0, [r6] - cmp r0, 0x4 - bhi _0801FB3A - lsls r0, 2 - ldr r1, =_0801FA80 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801FA80: - .4byte _0801FA94 - .4byte _0801FAC0 - .4byte _0801FAF0 - .4byte _0801FB14 - .4byte _0801FADE -_0801FA94: - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrh r5, [r0, 0x1A] - bl sub_801F180 - adds r4, r0, 0 - bl sub_801F18C - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_8020420 - movs r0, 0 - movs r1, 0x2 - bl CopyWindowToVram - b _0801FB34 - .pool -_0801FAC0: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - bne _0801FB3A - ldr r0, =gUnknown_02022C88 - ldr r1, [r0] - ldrh r0, [r1, 0x1A] - cmp r0, 0x8 - bhi _0801FAE8 - adds r0, 0x1 - strh r0, [r1, 0x1A] - movs r0, 0x4 - strb r0, [r6] -_0801FADE: - movs r0, 0 - b _0801FB3C - .pool -_0801FAE8: - strh r2, [r1, 0x1C] - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] -_0801FAF0: - movs r0, 0 - movs r1, 0 - movs r2, 0x5 - movs r3, 0x11 - bl ScrollWindow - movs r0, 0 - movs r1, 0x2 - bl CopyWindowToVram - ldr r0, =gUnknown_02022C88 - ldr r1, [r0] - ldrh r0, [r1, 0x1C] - adds r0, 0x1 - strh r0, [r1, 0x1C] - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] -_0801FB14: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801FB3A - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrh r0, [r0, 0x1C] - cmp r0, 0x2 - bhi _0801FB34 - ldrb r0, [r6] - subs r0, 0x1 - b _0801FB38 - .pool -_0801FB34: - ldrb r0, [r6] - adds r0, 0x1 -_0801FB38: - strb r0, [r6] -_0801FB3A: - movs r0, 0x1 -_0801FB3C: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801FA68 - - thumb_func_start sub_801FB44 -sub_801FB44: @ 801FB44 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FB54 - cmp r0, 0x1 - beq _0801FB60 - b _0801FB66 -_0801FB54: - bl sub_80209E0 - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FB66 -_0801FB60: - bl sub_8020A1C - b _0801FB68 -_0801FB66: - movs r0, 0x1 -_0801FB68: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FB44 - - thumb_func_start sub_801FB70 -sub_801FB70: @ 801FB70 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FB80 - cmp r0, 0x1 - beq _0801FBA0 - b _0801FBAA -_0801FB80: - movs r0, 0x3 - movs r1, 0x10 - bl sub_801FF18 - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FBAA - .pool -_0801FBA0: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801FBAC -_0801FBAA: - movs r0, 0x1 -_0801FBAC: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FB70 - - thumb_func_start sub_801FBB4 -sub_801FBB4: @ 801FBB4 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FBC4 - cmp r0, 0x1 - beq _0801FBE4 - b _0801FBEE -_0801FBC4: - movs r0, 0x4 - movs r1, 0 - bl sub_801FF18 - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FBEE - .pool -_0801FBE4: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801FBF0 -_0801FBEE: - movs r0, 0x1 -_0801FBF0: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FBB4 - - thumb_func_start sub_801FBF8 -sub_801FBF8: @ 801FBF8 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FC08 - cmp r0, 0x1 - beq _0801FC38 - b _0801FC42 -_0801FC08: - bl DynamicPlaceholderTextUtil_Reset - bl sub_801F1D0 - adds r1, r0, 0 - movs r0, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - movs r0, 0x5 - movs r1, 0 - bl sub_801FF18 - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FC42 - .pool -_0801FC38: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801FC44 -_0801FC42: - movs r0, 0x1 -_0801FC44: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FBF8 - - thumb_func_start sub_801FC4C -sub_801FC4C: @ 801FC4C - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FC5C - cmp r0, 0x1 - beq _0801FC88 - b _0801FC92 -_0801FC5C: - movs r0, 0x6 - movs r1, 0 - bl sub_801FF18 - movs r0, 0x17 - movs r1, 0xA - movs r2, 0x1 - bl sub_801FDDC - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FC92 - .pool -_0801FC88: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801FC94 -_0801FC92: - movs r0, 0x1 -_0801FC94: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FC4C - - thumb_func_start sub_801FC9C -sub_801FC9C: @ 801FC9C - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FCAC - cmp r0, 0x1 - beq _0801FCD8 - b _0801FCE2 -_0801FCAC: - movs r0, 0x7 - movs r1, 0 - bl sub_801FF18 - movs r0, 0x17 - movs r1, 0xA - movs r2, 0x1 - bl sub_801FDDC - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FCE2 - .pool -_0801FCD8: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801FCE4 -_0801FCE2: - movs r0, 0x1 -_0801FCE4: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FC9C - - thumb_func_start sub_801FCEC -sub_801FCEC: @ 801FCEC - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FCFC - cmp r0, 0x1 - beq _0801FD1C - b _0801FD26 -_0801FCFC: - movs r0, 0x8 - movs r1, 0 - bl sub_801FF18 - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FD26 - .pool -_0801FD1C: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801FD28 -_0801FD26: - movs r0, 0x1 -_0801FD28: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FCEC - - thumb_func_start sub_801FD30 -sub_801FD30: @ 801FD30 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FD40 - cmp r0, 0x1 - beq _0801FD74 - b _0801FD7E -_0801FD40: - bl DynamicPlaceholderTextUtil_Reset - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - movs r0, 0 - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr - movs r0, 0x9 - movs r1, 0 - bl sub_801FF18 - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FD7E - .pool -_0801FD74: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801FD80 -_0801FD7E: - movs r0, 0x1 -_0801FD80: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FD30 - - thumb_func_start sub_801FD88 -sub_801FD88: @ 801FD88 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _0801FD98 - cmp r0, 0x1 - beq _0801FDC4 - b _0801FDCE -_0801FD98: - movs r0, 0xA - movs r1, 0 - bl sub_801FF18 - movs r0, 0x17 - movs r1, 0xA - movs r2, 0x1 - bl sub_801FDDC - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - ldrb r0, [r0, 0x1E] - movs r1, 0x3 - bl CopyWindowToVram - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _0801FDCE - .pool -_0801FDC4: - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - lsrs r0, 24 - b _0801FDD0 -_0801FDCE: - movs r0, 0x1 -_0801FDD0: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801FD88 - - thumb_func_start sub_801FDD8 -sub_801FDD8: @ 801FDD8 - movs r0, 0 - bx lr - thumb_func_end sub_801FDD8 - - thumb_func_start sub_801FDDC -sub_801FDDC: @ 801FDDC - push {r4-r7,lr} - sub sp, 0x14 - lsls r0, 24 - lsls r1, 24 - lsls r2, 24 - lsrs r7, r2, 24 - ldr r4, =0xffffff00 - ldr r2, [sp, 0xC] - ands r2, r4 - lsrs r0, 16 - ldr r3, =0xffff00ff - ands r2, r3 - orrs r2, r0 - lsrs r1, 8 - ldr r0, =0xff00ffff - ands r2, r0 - orrs r2, r1 - ldr r0, =0x00ffffff - ands r2, r0 - movs r0, 0xC0 - lsls r0, 19 - orrs r2, r0 - str r2, [sp, 0xC] - ldr r0, [sp, 0x10] - ands r0, r4 - movs r1, 0x4 - orrs r0, r1 - ands r0, r3 - movs r1, 0xE0 - lsls r1, 4 - orrs r0, r1 - ldr r1, =0x0000ffff - ands r0, r1 - movs r1, 0xA4 - lsls r1, 15 - orrs r0, r1 - str r0, [sp, 0x10] - add r0, sp, 0xC - bl AddWindow - adds r1, r0, 0 - ldr r5, =gUnknown_02022C88 - ldr r0, [r5] - movs r6, 0 - strh r1, [r0, 0x18] - lsls r0, r1, 16 - lsrs r0, 16 - cmp r0, 0xFF - beq _0801FE94 - lsls r0, r1, 24 - lsrs r0, 24 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, [r5] - ldrb r0, [r0, 0x18] - bl PutWindowTilemap - ldr r0, [r5] - ldrb r0, [r0, 0x18] - ldr r2, =gText_Yes - movs r1, 0x1 - str r1, [sp] - movs r4, 0xFF - str r4, [sp, 0x4] - str r6, [sp, 0x8] - movs r3, 0x8 - bl AddTextPrinterParameterized - ldr r0, [r5] - ldrb r0, [r0, 0x18] - ldr r2, =gText_No - movs r1, 0x11 - str r1, [sp] - str r4, [sp, 0x4] - str r6, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl AddTextPrinterParameterized - ldr r0, [r5] - ldrb r0, [r0, 0x18] - movs r1, 0x1 - movs r2, 0xD - bl sub_8098858 - ldr r0, [r5] - ldrb r0, [r0, 0x18] - movs r1, 0x2 - adds r2, r7, 0 - bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed -_0801FE94: - add sp, 0x14 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801FDDC - - thumb_func_start sub_801FEBC -sub_801FEBC: @ 801FEBC - push {r4,lr} - ldr r4, =gUnknown_02022C88 - ldr r0, [r4] - ldrh r0, [r0, 0x18] - cmp r0, 0xFF - beq _0801FEDA - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl ClearStdWindowAndFrameToTransparent - ldr r0, [r4] - ldrb r0, [r0, 0x18] - bl ClearWindowTilemap -_0801FEDA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801FEBC - - thumb_func_start sub_801FEE4 -sub_801FEE4: @ 801FEE4 - push {r4,lr} - ldr r4, =gUnknown_02022C88 - ldr r0, [r4] - ldrh r0, [r0, 0x18] - cmp r0, 0xFF - beq _0801FEFE - lsls r0, 24 - lsrs r0, 24 - bl RemoveWindow - ldr r1, [r4] - movs r0, 0xFF - strh r0, [r1, 0x18] -_0801FEFE: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801FEE4 - - thumb_func_start sub_801FF08 -sub_801FF08: @ 801FF08 - push {lr} - bl Menu_ProcessInput - lsls r0, 24 - asrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_801FF08 - - thumb_func_start sub_801FF18 -sub_801FF18: @ 801FF18 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x1C - adds r7, r0, 0 - lsls r1, 16 - lsrs r1, 16 - mov r9, r1 - ldr r1, =0xffffff00 - ldr r3, [sp, 0x14] - ands r3, r1 - ldr r2, =0xffff00ff - ands r3, r2 - movs r0, 0x80 - lsls r0, 4 - orrs r3, r0 - ldr r0, =0xff00ffff - ands r3, r0 - movs r0, 0x80 - lsls r0, 13 - orrs r3, r0 - ldr r5, =0x00ffffff - ands r3, r5 - movs r0, 0xA8 - lsls r0, 21 - orrs r3, r0 - str r3, [sp, 0x14] - ldr r0, [sp, 0x18] - ands r0, r1 - movs r1, 0x4 - orrs r0, r1 - ands r0, r2 - movs r1, 0xE0 - lsls r1, 4 - orrs r0, r1 - ldr r1, =0x0000ffff - ands r0, r1 - movs r1, 0xD4 - lsls r1, 15 - orrs r0, r1 - str r0, [sp, 0x18] - ldr r1, =gUnknown_082F2D40 - lsls r0, r7, 1 - adds r0, r7 - lsls r0, 2 - adds r4, r0, r1 - ldrb r0, [r4, 0xA] - cmp r0, 0 - beq _0801FF98 - lsls r0, r3, 16 - movs r1, 0xF9 - lsls r1, 24 - adds r0, r1 - lsrs r0, 16 - ands r2, r3 - orrs r2, r0 - lsrs r1, r2, 24 - adds r1, 0x7 - lsls r1, 24 - adds r0, r5, 0 - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x14] -_0801FF98: - add r0, sp, 0x14 - bl AddWindow - ldr r5, =gUnknown_02022C88 - ldr r1, [r5] - strh r0, [r1, 0x1E] - ldrh r0, [r1, 0x1E] - mov r8, r0 - cmp r0, 0xFF - beq _08020082 - ldrb r0, [r4, 0x9] - cmp r0, 0 - beq _0801FFE0 - adds r0, r1, 0 - adds r0, 0x22 - ldr r1, [r4] - bl DynamicPlaceholderTextUtil_ExpandPlaceholders - ldr r0, [r5] - adds r6, r0, 0 - adds r6, 0x22 - b _0801FFE2 - .pool -_0801FFE0: - ldr r6, [r4] -_0801FFE2: - mov r0, r9 - lsls r1, r0, 8 - movs r0, 0 - movs r2, 0 - bl ChangeBgY - mov r1, r8 - lsls r0, r1, 24 - lsrs r5, r0, 24 - adds r0, r5, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - adds r0, r5, 0 - bl PutWindowTilemap - ldr r1, =gUnknown_082F2D40 - lsls r0, r7, 1 - adds r0, r7 - lsls r0, 2 - adds r4, r0, r1 - ldrb r0, [r4, 0x4] - cmp r0, 0x1 - bne _08020050 - adds r0, r5, 0 - movs r1, 0xA - movs r2, 0x2 - bl sub_80989E0 - ldrb r3, [r4, 0x5] - adds r3, 0x8 - lsls r3, 24 - lsrs r3, 24 - ldrb r0, [r4, 0x6] - adds r0, 0x8 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - ldrb r0, [r4, 0x7] - str r0, [sp, 0xC] - ldrb r0, [r4, 0x8] - str r0, [sp, 0x10] - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r6, 0 - bl AddTextPrinterParameterized5 - b _0802007A - .pool -_08020050: - adds r0, r5, 0 - movs r1, 0xA - movs r2, 0x2 - bl sub_8098858 - ldrb r3, [r4, 0x5] - ldrb r0, [r4, 0x6] - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - ldrb r0, [r4, 0x7] - str r0, [sp, 0xC] - ldrb r0, [r4, 0x8] - str r0, [sp, 0x10] - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r6, 0 - bl AddTextPrinterParameterized5 -_0802007A: - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - mov r1, r8 - strh r1, [r0, 0x1E] -_08020082: - add sp, 0x1C - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801FF18 - - thumb_func_start sub_8020094 -sub_8020094: @ 8020094 - push {r4,lr} - ldr r4, =gUnknown_02022C88 - ldr r0, [r4] - ldrh r0, [r0, 0x1E] - cmp r0, 0xFF - beq _080200B2 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl ClearStdWindowAndFrameToTransparent - ldr r0, [r4] - ldrb r0, [r0, 0x1E] - bl ClearWindowTilemap -_080200B2: - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020094 - - thumb_func_start sub_80200C8 -sub_80200C8: @ 80200C8 - push {r4,lr} - ldr r4, =gUnknown_02022C88 - ldr r0, [r4] - ldrh r0, [r0, 0x1E] - cmp r0, 0xFF - beq _080200E2 - lsls r0, 24 - lsrs r0, 24 - bl RemoveWindow - ldr r1, [r4] - movs r0, 0xFF - strh r0, [r1, 0x1E] -_080200E2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80200C8 - - thumb_func_start sub_80200EC -sub_80200EC: @ 80200EC - push {lr} - sub sp, 0x8 - adds r3, r0, 0 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 19 - lsrs r3, 16 - lsls r1, 19 - lsrs r1, 16 - str r1, [sp] - movs r0, 0xE - str r0, [sp, 0x4] - movs r0, 0x1 - adds r1, r2, 0 - adds r2, r3, 0 - movs r3, 0x1 - bl FillWindowPixelRect - add sp, 0x8 - pop {r0} - bx r0 - thumb_func_end sub_80200EC - - thumb_func_start sub_8020118 -sub_8020118: @ 8020118 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x34 - mov r10, r1 - ldr r1, [sp, 0x54] - lsls r0, 16 - lsrs r5, r0, 16 - mov r9, r5 - lsls r2, 24 - lsrs r4, r2, 24 - mov r8, r4 - lsls r3, 24 - lsrs r7, r3, 24 - lsls r1, 24 - lsrs r6, r1, 24 - cmp r4, 0 - beq _08020154 - bl sub_801F198 - adds r1, r0, 0 - subs r1, r5 - lsls r1, 16 - lsrs r1, 16 - adds r0, r5, 0 - adds r2, r4, 0 - bl sub_80200EC -_08020154: - add r0, sp, 0xC - mov r1, r8 - strb r1, [r0] - strb r7, [r0, 0x1] - strb r6, [r0, 0x2] - add r4, sp, 0x10 - movs r0, 0xFC - strb r0, [r4] - movs r0, 0x14 - strb r0, [r4, 0x1] - movs r0, 0x8 - strb r0, [r4, 0x2] - mov r0, sp - adds r0, 0x13 - mov r1, r10 - bl StringCopy - mov r0, r9 - lsls r2, r0, 27 - lsrs r2, 24 - add r1, sp, 0xC - str r1, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x2 - movs r3, 0x1 - bl AddTextPrinterParameterized3 - add sp, 0x34 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8020118 - - thumb_func_start sub_80201A4 -sub_80201A4: @ 80201A4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4C - movs r0, 0x2 - movs r1, 0xFF - bl FillWindowPixelBuffer - bl sub_801F0B0 - lsls r0, 24 - lsrs r2, r0, 24 - add r1, sp, 0xC - movs r0, 0 - strb r0, [r1] - movs r0, 0xE - strb r0, [r1, 0x1] - movs r0, 0xD - strb r0, [r1, 0x2] - cmp r2, 0x3 - beq _08020240 - add r1, sp, 0x10 - movs r0, 0xFC - strb r0, [r1] - movs r0, 0x14 - strb r0, [r1, 0x1] - movs r0, 0x8 - strb r0, [r1, 0x2] - str r0, [sp, 0x40] - str r1, [sp, 0x44] - cmp r2, 0x2 - bne _080201EC - movs r1, 0x6 - str r1, [sp, 0x40] -_080201EC: - movs r7, 0 - movs r6, 0 - lsls r0, r2, 2 - ldr r1, =gUnknown_082F2BA8 - adds r0, r2 - lsls r0, 3 - adds r4, r0, r1 - ldr r0, [sp, 0x40] - lsls r5, r0, 24 -_080201FE: - ldr r1, [r4] - cmp r1, 0 - bne _08020206 - b _0802030C -_08020206: - mov r0, sp - adds r0, 0x13 - bl StringCopy - lsls r3, r6, 24 - lsrs r3, 24 - add r1, sp, 0xC - str r1, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, [sp, 0x44] - str r0, [sp, 0x8] - movs r0, 0x2 - movs r1, 0 - lsrs r2, r5, 24 - bl AddTextPrinterParameterized3 - adds r4, 0x4 - adds r7, 0x1 - adds r0, r6, 0 - adds r0, 0xC - lsls r0, 16 - lsrs r6, r0, 16 - cmp r7, 0x9 - ble _080201FE - b _0802030C - .pool -_08020240: - movs r1, 0x4 - str r1, [sp, 0x40] - movs r7, 0 - movs r6, 0 -_08020248: - adds r0, r7, 0 - bl sub_801EE6C - adds r5, r0, 0 - movs r0, 0 - adds r1, r5, 0 - movs r2, 0 - bl GetStringWidth - cmp r0, 0x28 - bgt _08020286 - lsls r3, r6, 24 - lsrs r3, 24 - add r4, sp, 0xC - str r4, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x2 - movs r1, 0 - movs r4, 0x80 - lsls r4, 19 - lsrs r2, r4, 24 - bl AddTextPrinterParameterized3 - adds r0, r7, 0x1 - str r0, [sp, 0x48] - adds r6, 0xC - mov r10, r6 - b _08020300 -_08020286: - adds r0, r5, 0 - bl StringLength_Multibyte - adds r4, r0, 0 - mov r1, sp - adds r1, 0x10 - str r1, [sp, 0x44] - ldr r0, [sp, 0x40] - lsls r0, 24 - mov r8, r0 - lsls r1, r6, 24 - mov r9, r1 - adds r0, r7, 0x1 - str r0, [sp, 0x48] - adds r6, 0xC - mov r10, r6 - ldr r7, [sp, 0x40] - adds r7, 0x23 - ldr r6, [sp, 0x44] -_080202AC: - subs r4, 0x1 - adds r0, r6, 0 - adds r1, r5, 0 - adds r2, r4, 0 - bl StringCopyN_Multibyte - movs r0, 0 - adds r1, r6, 0 - movs r2, 0 - bl GetStringWidth - cmp r0, 0x23 - bgt _080202AC - mov r1, r8 - lsrs r2, r1, 24 - mov r0, r9 - lsrs r4, r0, 24 - add r1, sp, 0xC - str r1, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r1, [sp, 0x44] - str r1, [sp, 0x8] - movs r0, 0x2 - movs r1, 0 - adds r3, r4, 0 - bl AddTextPrinterParameterized3 - adds r2, r7, 0 - add r0, sp, 0xC - str r0, [sp] - movs r1, 0x1 - negs r1, r1 - str r1, [sp, 0x4] - ldr r0, =gText_Ellipsis - str r0, [sp, 0x8] - movs r0, 0x2 - movs r1, 0 - adds r3, r4, 0 - bl AddTextPrinterParameterized3 -_08020300: - ldr r7, [sp, 0x48] - mov r4, r10 - lsls r0, r4, 16 - lsrs r6, r0, 16 - cmp r7, 0x9 - ble _08020248 -_0802030C: - add sp, 0x4C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80201A4 - - thumb_func_start sub_8020320 -sub_8020320: @ 8020320 - push {r4,lr} - ldr r1, =gUnknown_02022C88 - ldr r2, [r1] - ldrh r3, [r2, 0x20] - movs r4, 0x20 - ldrsh r0, [r2, r4] - cmp r0, 0x37 - bgt _08020354 - adds r0, r3, 0 - adds r0, 0xC - strh r0, [r2, 0x20] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x37 - ble _08020348 - movs r0, 0x38 - strh r0, [r2, 0x20] - b _08020354 - .pool -_08020348: - movs r1, 0x20 - ldrsh r0, [r2, r1] - bl sub_80207C0 - movs r0, 0x1 - b _08020360 -_08020354: - ldr r0, [r1] - movs r4, 0x20 - ldrsh r0, [r0, r4] - bl sub_8020818 - movs r0, 0 -_08020360: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8020320 - - thumb_func_start sub_8020368 -sub_8020368: @ 8020368 - push {r4,lr} - ldr r1, =gUnknown_02022C88 - ldr r2, [r1] - ldrh r3, [r2, 0x20] - movs r4, 0x20 - ldrsh r0, [r2, r4] - cmp r0, 0 - ble _0802039C - adds r0, r3, 0 - subs r0, 0xC - strh r0, [r2, 0x20] - lsls r0, 16 - cmp r0, 0 - bgt _08020390 - movs r0, 0 - strh r0, [r2, 0x20] - b _0802039C - .pool -_08020390: - movs r1, 0x20 - ldrsh r0, [r2, r1] - bl sub_80207C0 - movs r0, 0x1 - b _080203A8 -_0802039C: - ldr r0, [r1] - movs r4, 0x20 - ldrsh r0, [r0, r4] - bl sub_8020818 - movs r0, 0 -_080203A8: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8020368 - - thumb_func_start sub_80203B0 -sub_80203B0: @ 80203B0 - push {r4,r5,lr} - sub sp, 0xC - movs r0, 0x3 - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r0, 0x3 - movs r1, 0x1 - movs r2, 0xD - bl sub_8098858 - movs r5, 0xE - str r5, [sp] - movs r4, 0x5 - str r4, [sp, 0x4] - ldr r0, =gUnknown_082F2DC8 - str r0, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x2 - movs r2, 0x8 - movs r3, 0x1 - bl PrintTextArray - bl sub_801F0B0 - lsls r0, 24 - lsrs r0, 24 - str r5, [sp] - str r4, [sp, 0x4] - str r0, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x2 - movs r2, 0 - movs r3, 0x1 - bl sub_81983AC - movs r0, 0x3 - bl PutWindowTilemap - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80203B0 - - thumb_func_start sub_802040C -sub_802040C: @ 802040C - push {lr} - movs r0, 0x3 - movs r1, 0 - bl ClearStdWindowAndFrameToTransparent - movs r0, 0x3 - bl ClearWindowTilemap - pop {r0} - bx r0 - thumb_func_end sub_802040C - - thumb_func_start sub_8020420 -sub_8020420: @ 8020420 - push {r4,r5,lr} - sub sp, 0x10 - adds r5, r1, 0 - lsls r0, 16 - lsrs r0, 16 - lsls r2, 24 - add r3, sp, 0xC - movs r1, 0x1 - strb r1, [r3] - lsrs r2, 23 - adds r1, r2, 0x2 - strb r1, [r3, 0x1] - adds r1, r3, 0 - adds r2, 0x3 - strb r2, [r1, 0x2] - lsls r4, r0, 4 - subs r4, r0 - lsls r3, r4, 16 - lsrs r3, 16 - movs r0, 0xA8 - str r0, [sp] - movs r0, 0xF - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0x11 - movs r2, 0 - bl FillWindowPixelRect - adds r4, 0x1 - lsls r4, 24 - lsrs r4, 24 - add r0, sp, 0xC - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0 - movs r1, 0x2 - movs r2, 0 - adds r3, r4, 0 - bl AddTextPrinterParameterized3 - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8020420 - - thumb_func_start sub_8020480 -sub_8020480: @ 8020480 - push {lr} - 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 - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuRegBits - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r1, 0xE0 - lsls r1, 8 - movs r0, 0 - bl ClearGpuRegBits - movs r1, 0x80 - lsls r1, 6 - movs r0, 0 - bl SetGpuRegBits - ldr r1, =0x000040f0 - movs r0, 0x40 - bl SetGpuReg - movs r0, 0x44 - movs r1, 0x90 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0x3D - bl SetGpuReg - movs r0, 0x4A - movs r1, 0x3F - bl SetGpuReg - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020480 - - thumb_func_start sub_8020538 -sub_8020538: @ 8020538 - push {r4,lr} - ldr r4, =gUnknown_02022C88 - ldr r1, [r4] - movs r0, 0x94 - lsls r0, 1 - adds r1, r0 - movs r0, 0 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r0, =0x00000928 - adds r1, r0 - movs r0, 0x1 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r0, =0x00001128 - adds r1, r0 - movs r0, 0x3 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r0, =0x00001928 - adds r1, r0 - movs r0, 0x2 - bl SetBgTilemapBuffer - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020538 - - thumb_func_start sub_8020584 -sub_8020584: @ 8020584 - push {lr} - sub sp, 0x8 - movs r1, 0xC0 - lsls r1, 19 - movs r0, 0 - movs r2, 0x20 - movs r3, 0x1 - bl RequestDma3Fill - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0x8 - pop {r0} - bx r0 - thumb_func_end sub_8020584 - - thumb_func_start sub_80205B4 -sub_80205B4: @ 80205B4 - push {lr} - sub sp, 0x4 - ldr r0, =gUnknown_08DD4BD0 - movs r1, 0x70 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_08DD4BB0 - movs r1, 0xC0 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gUnknown_08DD4BF0 - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r1, =gUnknown_08DD4C4C - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80205B4 - - thumb_func_start task_tutorial_story_unknown -task_tutorial_story_unknown: @ 8020604 - push {r4,r5,lr} - sub sp, 0x4 - ldr r0, =gLinkMiscMenu_Pal - movs r1, 0 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gLinkMiscMenu_Gfx - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - adds r5, r0, 0 - cmp r5, 0 - beq _0802064E - movs r1, 0x88 - lsls r1, 2 - adds r0, r5, r1 - ldr r4, =gUnknown_02022C88 - ldr r1, [r4] - ldr r2, =0x00002128 - adds r1, r2 - movs r2, 0x8 - bl CpuFastSet - movs r1, 0x84 - lsls r1, 3 - adds r0, r5, r1 - ldr r1, [r4] - ldr r2, =0x00002148 - adds r1, r2 - movs r2, 0x8 - bl CpuFastSet -_0802064E: - ldr r1, =gLinkMiscMenu_Tilemap - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end task_tutorial_story_unknown - - thumb_func_start sub_8020680 -sub_8020680: @ 8020680 - push {lr} - ldr r0, =gUnknown_082F2C20 - movs r1, 0x80 - movs r2, 0x20 - bl LoadPalette - ldr r1, =0x06004020 - movs r0, 0 - movs r2, 0x20 - movs r3, 0x1 - bl RequestDma3Fill - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020680 - - thumb_func_start sub_80206A4 -sub_80206A4: @ 80206A4 - push {lr} - ldr r0, =gUnknown_082F2C40 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0 - bl PutWindowTilemap - movs r0, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - pop {r0} - bx r0 - .pool - thumb_func_end sub_80206A4 - - thumb_func_start sub_80206D0 -sub_80206D0: @ 80206D0 - push {lr} - movs r0, 0x2 - bl PutWindowTilemap - bl sub_80201A4 - movs r0, 0x2 - movs r1, 0x3 - bl CopyWindowToVram - pop {r0} - bx r0 - thumb_func_end sub_80206D0 - - thumb_func_start sub_80206E8 -sub_80206E8: @ 80206E8 - push {r4,lr} - sub sp, 0xC - add r1, sp, 0x8 - movs r0, 0 - strb r0, [r1] - movs r0, 0xFF - strb r0, [r1, 0x1] - movs r4, 0 -_080206F8: - ldr r0, =gUnknown_02022C88 - ldr r1, [r0] - ldr r0, =0x00002128 - adds r1, r0 - lsls r2, r4, 19 - lsrs r2, 16 - movs r0, 0x8 - str r0, [sp] - movs r0, 0x10 - str r0, [sp, 0x4] - movs r0, 0x1 - movs r3, 0 - bl BlitBitmapToWindow - adds r4, 0x1 - cmp r4, 0xE - ble _080206F8 - movs r0, 0x1 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0x1 - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80206E8 - - thumb_func_start sub_8020740 -sub_8020740: @ 8020740 - push {lr} - movs r0, 0x3 - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r0, 0x3 - movs r1, 0x1 - movs r2, 0xD0 - bl LoadUserWindowBorderGfx - movs r0, 0x3 - movs r1, 0xA - movs r2, 0x20 - bl LoadUserWindowBorderGfx_ - ldr r0, =gUnknown_0860F074 - movs r1, 0xE0 - movs r2, 0x20 - bl LoadPalette - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020740 - - thumb_func_start sub_8020770 -sub_8020770: @ 8020770 - push {lr} - sub sp, 0x10 - ldr r0, =0xa2600001 - str r0, [sp, 0x4] - ldr r0, =0x04000014 - str r0, [sp] - mov r2, sp - movs r1, 0 - movs r0, 0x1 - strb r0, [r2, 0x8] - mov r0, sp - strb r1, [r0, 0x9] - ldr r0, =gUnknown_02022C88 - ldr r0, [r0] - strh r1, [r0, 0x20] - str r1, [sp, 0xC] - add r0, sp, 0xC - ldr r1, =gScanlineEffectRegBuffers - ldr r2, =0x010003c0 - bl CpuFastSet - ldr r0, [sp] - ldr r1, [sp, 0x4] - ldr r2, [sp, 0x8] - bl ScanlineEffect_SetParams - add sp, 0x10 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020770 - - thumb_func_start sub_80207C0 -sub_80207C0: @ 80207C0 - push {r4,r5,lr} - sub sp, 0x4 - lsls r0, 16 - lsrs r0, 16 - mov r1, sp - strh r0, [r1] - ldr r5, =gScanlineEffect - ldrb r0, [r5, 0x14] - lsls r1, r0, 4 - subs r1, r0 - lsls r1, 7 - ldr r4, =gScanlineEffectRegBuffers - adds r1, r4 - ldr r2, =0x01000090 - mov r0, sp - bl CpuSet - mov r0, sp - adds r0, 0x2 - movs r1, 0 - strh r1, [r0] - ldrb r2, [r5, 0x14] - lsls r1, r2, 4 - subs r1, r2 - lsls r1, 7 - movs r2, 0x90 - lsls r2, 1 - adds r4, r2 - adds r1, r4 - ldr r2, =0x01000010 - bl CpuSet - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80207C0 - - thumb_func_start sub_8020818 -sub_8020818: @ 8020818 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x8 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - mov r0, sp - strh r4, [r0] - ldr r5, =gScanlineEffectRegBuffers - ldr r0, =0x01000090 - mov r9, r0 - mov r0, sp - adds r1, r5, 0 - mov r2, r9 - bl CpuSet - mov r0, sp - adds r0, 0x2 - movs r6, 0 - strh r6, [r0] - movs r2, 0x90 - lsls r2, 1 - adds r1, r5, r2 - ldr r2, =0x01000010 - mov r8, r2 - bl CpuSet - add r0, sp, 0x4 - strh r4, [r0] - movs r2, 0xF0 - lsls r2, 3 - adds r1, r5, r2 - mov r2, r9 - bl CpuSet - mov r0, sp - adds r0, 0x6 - strh r6, [r0] - movs r1, 0x8A - lsls r1, 4 - adds r5, r1 - adds r1, r5, 0 - mov r2, r8 - bl CpuSet - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020818 - - thumb_func_start sub_8020890 -sub_8020890: @ 8020890 - push {r4,r5,lr} - movs r5, 0 - ldr r4, =gUnknown_082F3134 -_08020896: - adds r0, r4, 0 - bl LoadCompressedSpriteSheet - adds r4, 0x8 - adds r5, 0x1 - cmp r5, 0x4 - bls _08020896 - ldr r0, =gUnknown_082F315C - bl LoadSpritePalette - ldr r4, =gUnknown_02022C8C - movs r0, 0x18 - bl Alloc - str r0, [r4] - cmp r0, 0 - beq _080208C8 - movs r0, 0x1 - b _080208CA - .pool -_080208C8: - movs r0, 0 -_080208CA: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8020890 - - thumb_func_start sub_80208D0 -sub_80208D0: @ 80208D0 - push {lr} - ldr r0, =gUnknown_02022C8C - ldr r0, [r0] - cmp r0, 0 - beq _080208DE - bl Free -_080208DE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80208D0 - - thumb_func_start sub_80208E8 -sub_80208E8: @ 80208E8 - push {lr} - ldr r0, =gUnknown_082F319C - movs r1, 0xA - movs r2, 0x18 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_02022C8C - ldr r2, [r1] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - str r1, [r2] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80208E8 - - thumb_func_start sub_802091C -sub_802091C: @ 802091C - ldr r1, =gUnknown_02022C8C - ldr r1, [r1] - ldr r2, [r1] - adds r2, 0x3E - movs r1, 0x1 - ands r0, r1 - lsls r0, 2 - ldrb r3, [r2] - movs r1, 0x5 - negs r1, r1 - ands r1, r3 - orrs r1, r0 - strb r1, [r2] - bx lr - .pool - thumb_func_end sub_802091C - - thumb_func_start sub_802093C -sub_802093C: @ 802093C - push {r4,r5,lr} - sub sp, 0x4 - bl sub_801F0B0 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - mov r5, sp - adds r5, 0x1 - mov r0, sp - adds r1, r5, 0 - bl sub_801F0BC - cmp r4, 0x3 - beq _0802097C - ldr r4, =gUnknown_02022C8C - ldr r0, [r4] - ldr r0, [r0] - movs r1, 0 - bl StartSpriteAnim - ldr r1, [r4] - ldr r2, [r1] - mov r0, sp - ldrb r0, [r0] - lsls r0, 3 - adds r0, 0xA - strh r0, [r2, 0x20] - ldr r2, [r1] - b _08020992 - .pool -_0802097C: - ldr r4, =gUnknown_02022C8C - ldr r0, [r4] - ldr r0, [r0] - movs r1, 0x2 - bl StartSpriteAnim - ldr r2, [r4] - ldr r1, [r2] - movs r0, 0x18 - strh r0, [r1, 0x20] - ldr r2, [r2] -_08020992: - ldrb r1, [r5] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, 0x18 - strh r0, [r2, 0x22] - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_802093C - - thumb_func_start sub_80209AC -sub_80209AC: @ 80209AC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 2 - ldr r0, =gUnknown_082F2DF0+2 - adds r4, r0 - movs r0, 0 - bl IndexOfSpritePaletteTag - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 4 - ldr r0, =0x01010000 - adds r1, r0 - lsrs r1, 16 - adds r0, r4, 0 - movs r2, 0x4 - bl LoadPalette - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80209AC - - thumb_func_start sub_80209E0 -sub_80209E0: @ 80209E0 - push {lr} - bl sub_801F0B0 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - beq _08020A00 - ldr r0, =gUnknown_02022C8C - ldr r0, [r0] - ldr r0, [r0] - movs r1, 0x1 - bl StartSpriteAnim - b _08020A0C - .pool -_08020A00: - ldr r0, =gUnknown_02022C8C - ldr r0, [r0] - ldr r0, [r0] - movs r1, 0x3 - bl StartSpriteAnim -_08020A0C: - ldr r0, =gUnknown_02022C8C - ldr r1, [r0] - movs r0, 0 - strh r0, [r1, 0x14] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80209E0 - - thumb_func_start sub_8020A1C -sub_8020A1C: @ 8020A1C - push {r4,lr} - ldr r4, =gUnknown_02022C8C - ldr r1, [r4] - ldrh r0, [r1, 0x14] - cmp r0, 0x3 - bls _08020A30 -_08020A28: - movs r0, 0 - b _08020A62 - .pool -_08020A30: - adds r0, 0x1 - strh r0, [r1, 0x14] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x3 - bls _08020A60 - bl sub_801F0B0 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - beq _08020A54 - ldr r0, [r4] - ldr r0, [r0] - movs r1, 0 - bl StartSpriteAnim - b _08020A28 -_08020A54: - ldr r0, [r4] - ldr r0, [r0] - movs r1, 0x2 - bl StartSpriteAnim - b _08020A28 -_08020A60: - movs r0, 0x1 -_08020A62: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8020A1C - - thumb_func_start sub_8020A68 -sub_8020A68: @ 8020A68 - push {r4,r5,lr} - ldr r0, =gUnknown_082F31BC - movs r1, 0x4C - movs r2, 0x98 - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_02022C8C - ldr r2, [r5] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r4, =gSprites - adds r1, r4 - str r1, [r2, 0x8] - ldr r0, =gUnknown_082F31D4 - movs r1, 0x40 - movs r2, 0x98 - movs r3, 0x1 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r2, [r5] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - str r1, [r2, 0x4] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020A68 - - thumb_func_start sub_8020ABC -sub_8020ABC: @ 8020ABC - push {r4,lr} - adds r4, r0, 0 - bl sub_801F198 - adds r3, r0, 0 - cmp r3, 0xF - bne _08020AD8 - adds r0, r4, 0 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - b _08020AEC -_08020AD8: - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x5 - negs r1, r1 - ands r1, r0 - strb r1, [r2] - lsls r0, r3, 3 - adds r0, 0x4C - strh r0, [r4, 0x20] -_08020AEC: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8020ABC - - thumb_func_start sub_8020AF4 -sub_8020AF4: @ 8020AF4 - push {lr} - adds r1, r0, 0 - ldrh r0, [r1, 0x2E] - adds r0, 0x1 - movs r2, 0 - strh r0, [r1, 0x2E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x4 - ble _08020B1A - strh r2, [r1, 0x2E] - ldrh r0, [r1, 0x24] - adds r0, 0x1 - strh r0, [r1, 0x24] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x4 - ble _08020B1A - strh r2, [r1, 0x24] -_08020B1A: - pop {r0} - bx r0 - thumb_func_end sub_8020AF4 - - thumb_func_start sub_8020B20 -sub_8020B20: @ 8020B20 - push {r4,r5,lr} - ldr r0, =gUnknown_082F322C - movs r1, 0x8 - movs r2, 0x98 - movs r3, 0x3 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_02022C8C - ldr r2, [r5] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r4, =gSprites - adds r1, r4 - str r1, [r2, 0xC] - ldr r0, =gUnknown_082F3244 - movs r1, 0x20 - movs r2, 0x98 - movs r3, 0x4 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r2, [r5] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - str r1, [r2, 0x10] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020B20 - - thumb_func_start sub_8020B80 -sub_8020B80: @ 8020B80 - push {r4,lr} - bl sub_801F0B0 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bne _08020BB8 - bl sub_801F0DC - cmp r0, 0 - beq _08020BC2 - ldr r3, =gUnknown_02022C8C - ldr r0, [r3] - ldr r1, [r0, 0x10] - adds r1, 0x3E - ldrb r2, [r1] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r0, [r3] - ldr r0, [r0, 0x10] - movs r1, 0x3 - bl StartSpriteAnim - b _08020BF6 - .pool -_08020BB8: - bl sub_801F1A4 - adds r4, r0, 0 - cmp r4, 0x3 - bne _08020BD8 -_08020BC2: - ldr r0, =gUnknown_02022C8C - ldr r0, [r0] - ldr r1, [r0, 0x10] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - b _08020BF6 - .pool -_08020BD8: - ldr r3, =gUnknown_02022C8C - ldr r0, [r3] - ldr r1, [r0, 0x10] - adds r1, 0x3E - ldrb r2, [r1] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r0, [r3] - ldr r0, [r0, 0x10] - lsls r1, r4, 24 - lsrs r1, 24 - bl StartSpriteAnim -_08020BF6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8020B80 - - .align 2, 0 @ don't pad with nop diff --git a/charmap.txt b/charmap.txt index 2ccac19d3..26d48e101 100644 --- a/charmap.txt +++ b/charmap.txt @@ -424,7 +424,7 @@ PLAY_SE = FC 10 CLEAR = FC 11 SKIP = FC 12 CLEAR_TO = FC 13 -UNKNOWN_14 = FC 14 +MIN_LETTER_SPACING = FC 14 JPN = FC 15 ENG = FC 16 PAUSE_MUSIC = FC 17 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index ae0e36be1..a3ba7eb08 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -284,8 +284,7 @@ BattleScript_HitFromAtkAnimation:: seteffectwithchance tryfaintmon BS_TARGET, FALSE, NULL BattleScript_MoveEnd:: - setbyte sMOVEEND_STATE, 0x0 - moveend 0x0, 0x0 + moveendall end BattleScript_MakeMoveMissed:: @@ -423,8 +422,7 @@ BattleScript_ExplosionLoop: resultmessage waitmessage 0x40 tryfaintmon BS_TARGET, FALSE, NULL - setbyte sMOVEEND_STATE, 0x0 - moveend 0x2, 0x10 + moveendto ATK49_NEXT_TARGET jumpifnexttargetvalid BattleScript_ExplosionLoop tryfaintmon BS_ATTACKER, FALSE, NULL end @@ -432,8 +430,7 @@ BattleScript_ExplosionMissed: effectivenesssound resultmessage waitmessage 0x40 - setbyte sMOVEEND_STATE, 0x0 - moveend 0x2, 0x10 + moveendto ATK49_NEXT_TARGET jumpifnexttargetvalid BattleScript_ExplosionLoop tryfaintmon BS_ATTACKER, FALSE, NULL end @@ -657,8 +654,7 @@ BattleScript_DoMultiHit:: printstring STRINGID_EMPTYSTRING3 waitmessage 0x1 addbyte sMULTIHIT_STRING + 4, 0x1 - setbyte sMOVEEND_STATE, 0x0 - moveend 0x2, 0x10 + moveendto ATK49_NEXT_TARGET jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_FOE_ENDURED, BattleScript_MultiHitPrintStrings decrementmultihit BattleScript_MultiHitLoop goto BattleScript_MultiHitPrintStrings @@ -674,10 +670,8 @@ BattleScript_MultiHitPrintStrings:: BattleScript_MultiHitEnd:: seteffectwithchance tryfaintmon BS_TARGET, FALSE, NULL - setbyte sMOVEEND_STATE, 0x2 - moveend 0x1, 0x0 - setbyte sMOVEEND_STATE, 0x4 - moveend 0x0, 0x0 + moveendcase ATK49_SYNCHRONIZE_TARGET + moveendfrom ATK49_STATUS_IMMUNITY_ABILITIES end BattleScript_EffectConversion:: @@ -1441,8 +1435,7 @@ BattleScript_DoTripleKickAttack:: waitmessage 0x40 printstring STRINGID_EMPTYSTRING3 waitmessage 0x1 - setbyte sMOVEEND_STATE, 0x0 - moveend 0x2, 0x10 + moveendto ATK49_NEXT_TARGET jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_FOE_ENDURED, BattleScript_TripleKickPrintStrings decrementmultihit BattleScript_TripleKickLoop goto BattleScript_TripleKickPrintStrings @@ -1461,8 +1454,7 @@ BattleScript_TripleKickPrintStrings:: BattleScript_TripleKickEnd:: seteffectwithchance tryfaintmon BS_TARGET, FALSE, NULL - setbyte sMOVEEND_STATE, 0xE - moveend 0x0, 0x0 + moveendfrom ATK49_UPDATE_LAST_MOVES end BattleScript_EffectThief:: @@ -1893,8 +1885,7 @@ BattleScript_DoHitAllWithUndergroundBonus:: printstring STRINGID_EMPTYSTRING3 waitmessage 0x1 tryfaintmon BS_TARGET, FALSE, NULL - setbyte sMOVEEND_STATE, 0x0 - moveend 0x2, 0x10 + moveendto ATK49_NEXT_TARGET jumpifnexttargetvalid BattleScript_HitsAllWithUndergroundBonusLoop end BattleScript_HitAllWithUndergroundBonusMissed:: @@ -1903,8 +1894,7 @@ BattleScript_HitAllWithUndergroundBonusMissed:: effectivenesssound resultmessage waitmessage 0x40 - setbyte sMOVEEND_STATE, 0x0 - moveend 0x2, 0x10 + moveendto ATK49_NEXT_TARGET jumpifnexttargetvalid BattleScript_HitsAllWithUndergroundBonusLoop end @@ -1995,8 +1985,7 @@ BattleScript_BeatUpAttack:: resultmessage waitmessage 0x40 tryfaintmon BS_TARGET, FALSE, NULL - setbyte sMOVEEND_STATE, 0x0 - moveend 0x2, 0x10 + moveendto ATK49_NEXT_TARGET goto BattleScript_BeatUpLoop BattleScript_BeatUpEnd:: end @@ -2617,8 +2606,7 @@ BattleScript_TeeterDanceLoop:: resultmessage waitmessage 0x40 BattleScript_TeeterDanceDoMoveEndIncrement:: - setbyte sMOVEEND_STATE, 0x0 - moveend 0x2, 0x10 + moveendto ATK49_NEXT_TARGET BattleScript_TeeterDanceLoopIncrement:: addbyte gBattlerTarget, 0x1 jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_TeeterDanceLoop @@ -3140,10 +3128,8 @@ BattleScript_DoSwitchOut:: switchinanim BS_ATTACKER, FALSE waitstate switchineffects BS_ATTACKER - setbyte sMOVEEND_STATE, 0x4 - moveend 0x1, 0x0 - setbyte sMOVEEND_STATE, 0xF - moveend 0x1, 0x0 + moveendcase ATK49_STATUS_IMMUNITY_ABILITIES + moveendcase ATK49_MIRROR_MOVE end2 BattleScript_PursuitDmgOnSwitchOut:: @@ -3166,8 +3152,7 @@ BattleScript_PursuitDmgOnSwitchOut:: resultmessage waitmessage 0x40 tryfaintmon BS_TARGET, FALSE, NULL - setbyte sMOVEEND_STATE, 0x3 - moveend 0x2, 0x6 + moveendfromto ATK49_MOVE_END_ABILITIES, ATK49_CHOICE_MOVE various4 BS_TARGET jumpifbyte CMP_EQUAL, gBattleCommunication, 0x0, BattleScript_PursuitDmgOnSwitchOutRet setbyte sGIVEEXP_STATE, 0x0 @@ -3395,8 +3380,7 @@ BattleScript_DisabledNoMore:: BattleScript_SelectingDisabledMoveInPalace:: printstring STRINGID_PKMNMOVEISDISABLED BattleScript_SelectingUnusableMoveInPalace:: - setbyte sMOVEEND_STATE, 0x0 - moveend 0x2, 0x10 + moveendto ATK49_NEXT_TARGET end BattleScript_EncoredNoMore:: @@ -3425,8 +3409,7 @@ BattleScript_SpikesOnAttacker:: BattleScript_SpikesOnAttackerFainted:: setbyte sGIVEEXP_STATE, 0x0 getexp BS_ATTACKER - setbyte sMOVEEND_STATE, 0x0 - moveend 0x0, 0x0 + moveendall goto BattleScript_HandleFaintedMon BattleScript_SpikesOnTarget:: @@ -3441,8 +3424,7 @@ BattleScript_SpikesOnTarget:: BattleScript_SpikesOnTargetFainted:: setbyte sGIVEEXP_STATE, 0x0 getexp BS_TARGET - setbyte sMOVEEND_STATE, 0x0 - moveend 0x0, 0x0 + moveendall goto BattleScript_HandleFaintedMon BattleScript_SpikesOnFaintedBattler:: @@ -3457,8 +3439,7 @@ BattleScript_SpikesOnFaintedBattler:: BattleScript_SpikesOnFaintedBattlerFainted:: setbyte sGIVEEXP_STATE, 0x0 getexp BS_FAINTED - setbyte sMOVEEND_STATE, 0x0 - moveend 0x0, 0x0 + moveendall goto BattleScript_HandleFaintedMon BattleScript_PrintHurtBySpikes:: @@ -3562,10 +3543,8 @@ BattleScript_DoFutureAttackHit:: tryfaintmon BS_TARGET, FALSE, NULL atk24 BattleScript_FutureAttackEnd BattleScript_FutureAttackEnd:: - setbyte sMOVEEND_STATE, 0x0 - moveend 0x1, 0x0 - setbyte sMOVEEND_STATE, 0xB - moveend 0x2, 0xE + moveendcase ATK49_RAGE + moveendfromto ATK49_ITEM_EFFECTS_ALL, ATK49_UPDATE_LAST_MOVES setbyte gMoveResultFlags, 0 end2 @@ -4254,8 +4233,7 @@ BattleScript_AbilityCuredStatus:: BattleScript_IgnoresWhileAsleep:: printstring STRINGID_PKMNIGNORESASLEEP waitmessage 0x40 - setbyte sMOVEEND_STATE, 0x0 - moveend 0x2, 0x10 + moveendto ATK49_NEXT_TARGET end BattleScript_IgnoresAndUsesRandomMove:: @@ -4271,8 +4249,7 @@ BattleScript_MoveUsedLoafingAround:: BattleScript_82DB6C7:: printfromtable gInobedientStringIds waitmessage 0x40 - setbyte sMOVEEND_STATE, 0x0 - moveend 0x2, 0x10 + moveendto ATK49_NEXT_TARGET end BattleScript_IgnoresAndFallsAsleep:: @@ -4280,8 +4257,7 @@ BattleScript_IgnoresAndFallsAsleep:: waitmessage 0x40 setmoveeffect MOVE_EFFECT_SLEEP | MOVE_EFFECT_AFFECTS_USER seteffectprimary - setbyte sMOVEEND_STATE, 0x0 - moveend 0x2, 0x10 + moveendto ATK49_NEXT_TARGET end BattleScript_IgnoresAndHitsItself:: diff --git a/data/mevent_801BAAC.s b/data/mevent_801BAAC.s deleted file mode 100755 index 37c1ae46f..000000000 --- a/data/mevent_801BAAC.s +++ /dev/null @@ -1,254 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gUnknown_082F0E10:: @ 82F0E10 - .byte 0x00, 0x02, 0x03 - .byte 0x00, 0x01, 0x02 - - .align 2 -gUnknown_082F0E18:: @ 82F0E18 - .byte 0x07, 0x04, 0x07, 0x00 - - .align 2 -gUnknown_082F0E1C:: @ 82F0E1C - window_template 0x01, 0x01, 0x01, 0x19, 0x04, 0x02, 0x029C - window_template 0x01, 0x01, 0x06, 0x1C, 0x08, 0x02, 0x01BC - window_template 0x01, 0x01, 0x0E, 0x1C, 0x05, 0x02, 0x0130 - - .align 2 -gWonderCardBgPal1:: @ 82F0E34 - .incbin "graphics/wonder_transfers/wonder_card_1.gbapal" - - .align 2 -gWonderCardBgPal2:: @ 82F0E54 - .incbin "graphics/wonder_transfers/wonder_card_2.gbapal" - - .align 2 -gWonderCardBgPal3:: @ 82F0E74 - .incbin "graphics/wonder_transfers/wonder_card_3.gbapal" - - .align 2 -gWonderCardBgPal4:: @ 82F0E94 - .incbin "graphics/wonder_transfers/wonder_card_4.gbapal" - - .align 2 -gWonderCardBgPal5:: @ 82F0EB4 - .incbin "graphics/wonder_transfers/wonder_card_5.gbapal" - - .align 2 -gWonderCardBgPal6:: @ 82F0ED4 - .incbin "graphics/wonder_transfers/wonder_card_6.gbapal" - - .align 2 -gWonderCardBgPal7:: @ 82F0EF4 - .incbin "graphics/wonder_transfers/wonder_card_7.gbapal" - - .align 2 -gWonderCardBgPal8:: @ 82F0F14 - .incbin "graphics/wonder_transfers/wonder_card_8.gbapal" - - .align 2 -gWonderCardBgGfx1:: @ 82F0F34 - .incbin "graphics/wonder_transfers/wonder_card_1.4bpp.lz" - - .align 2 -gWonderCardBgTilemap1:: @ 82F1030 - .incbin "graphics/wonder_transfers/wonder_card_1.bin.lz" - - .align 2 -gWonderCardBgGfx2:: @ 82F1124 - .incbin "graphics/wonder_transfers/wonder_card_2.4bpp.lz" - - .align 2 -gWonderCardBgTilemap2:: @ 82F1218 - .incbin "graphics/wonder_transfers/wonder_card_2.bin.lz" - - .align 2 -gWonderCardBgGfx3:: @ 82F1300 - .incbin "graphics/wonder_transfers/wonder_card_3.4bpp.lz" - - .align 2 -gWonderCardBgTilemap3:: @ 82F13D4 - .incbin "graphics/wonder_transfers/wonder_card_3.bin.lz" - - .align 2 -gWonderCardBgGfx7:: @ 82F14A8 - .incbin "graphics/wonder_transfers/wonder_card_7.4bpp.lz" - - .align 2 -gWonderCardBgTilemap7:: @ 82F16DC - .incbin "graphics/wonder_transfers/wonder_card_7.bin.lz" - - .align 2 -gWonderCardBgGfx8:: @ 82F1824 - .incbin "graphics/wonder_transfers/wonder_card_8.4bpp.lz" - - .align 2 -gWonderCardBgTilemap8:: @ 82F1A54 - .incbin "graphics/wonder_transfers/wonder_card_8.bin.lz" - - .align 2 -gWonderCardShadowPal1:: @ 82F1B9C - .incbin "graphics/wonder_transfers/wonder_card_shadow_1.gbapal" - - .align 2 -gWonderCardShadowPal2:: @ 82F1BBC - .incbin "graphics/wonder_transfers/wonder_card_shadow_2.gbapal" - - .align 2 -gWonderCardShadowPal3:: @ 82F1BDC - .incbin "graphics/wonder_transfers/wonder_card_shadow_3.gbapal" - - .align 2 -gWonderCardShadowPal4:: @ 82F1BFC - .incbin "graphics/wonder_transfers/wonder_card_shadow_4.gbapal" - - .align 2 -gWonderCardShadowPal5:: @ 82F1C1C - .incbin "graphics/wonder_transfers/wonder_card_shadow_5.gbapal" - - .align 2 -gWonderCardShadowPal6:: @ 82F1C3C - .incbin "graphics/wonder_transfers/wonder_card_shadow_6.gbapal" - - .align 2 -gWonderCardShadowPal7:: @ 82F1C5C - .incbin "graphics/wonder_transfers/wonder_card_shadow_7.gbapal" - - .align 2 -gWonderCardShadowPal8:: @ 82F1C7C - .incbin "graphics/wonder_transfers/wonder_card_shadow_8.gbapal" - - .align 2 -gWonderCardShadowGfx:: @ 82F1C9C - .incbin "graphics/wonder_transfers/wonder_card_shadow.4bpp.lz" - - .align 2 -gUnknown_082F1D00:: @ 82F1D00 struct CompressedSpriteSheet - .4byte gWonderCardShadowGfx - .2byte 0x0100 - .2byte 0x8000 - - .align 2 -gUnknown_082F1D08:: @ 82F1D08 struct SpritePalette - .4byte gWonderCardShadowPal1 - .2byte 0x8000 - - .align 2 - .4byte gWonderCardShadowPal2 - .2byte 0x8000 - - .align 2 - .4byte gWonderCardShadowPal3 - .2byte 0x8000 - - .align 2 - .4byte gWonderCardShadowPal4 - .2byte 0x8000 - - .align 2 - .4byte gWonderCardShadowPal5 - .2byte 0x8000 - - .align 2 - .4byte gWonderCardShadowPal6 - .2byte 0x8000 - - .align 2 - .4byte gWonderCardShadowPal7 - .2byte 0x8000 - - .align 2 - .4byte gWonderCardShadowPal8 - .2byte 0x8000 - - .align 2 -gUnknown_082F1D48:: @ 82F1D48 - spr_template 0x8000, 0x8000, gUnknown_08524934, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082F1D60:: @ 82F1D60 - .4byte 0x00000001, gWonderCardBgGfx1, gWonderCardBgTilemap1, gWonderCardBgPal1 - .4byte 0x00001001, gWonderCardBgGfx2, gWonderCardBgTilemap2, gWonderCardBgPal2 - .4byte 0x00002001, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal3 - .4byte 0x00003001, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal4 - .4byte 0x00004001, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal5 - .4byte 0x00005001, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal6 - .4byte 0x00006001, gWonderCardBgGfx7, gWonderCardBgTilemap7, gWonderCardBgPal7 - .4byte 0x00007001, gWonderCardBgGfx8, gWonderCardBgTilemap8, gWonderCardBgPal8 - -gUnknown_082F1DE0:: @ 82F1DE0 - .byte 0x00, 0x02, 0x03, 0x00, 0x01, 0x02, 0x00, 0x00 - -gUnknown_082F1DE8:: @ 82F1DE8 - window_template 0x00, 0x01, 0x00, 0x1C, 0x03, 0x02, 0x02AC - window_template 0x02, 0x01, 0x03, 0x1C, 0x14, 0x02, 0x007C - -gUnknown_082F1DF8:: @ 82F1DF8 - .4byte 0x0318e802, 0x000098e8, 0x10000002, 0x00001000 - - .align 2 -gWonderNewsPal1:: @ 82F1E08 - .incbin "graphics/wonder_transfers/wonder_news_1.gbapal" - - .align 2 -gWonderNewsPal7:: @ 82F1E28 - .incbin "graphics/wonder_transfers/wonder_news_7.gbapal" - - .align 2 -gWonderNewsPal8:: @ 82F1E48 - .incbin "graphics/wonder_transfers/wonder_news_8.gbapal" - - .align 2 -gWonderNewsGfx1:: @ 82F1E68 - .incbin "graphics/wonder_transfers/wonder_news_1.4bpp.lz" - - .align 2 -gWonderNewsTilemap1:: @ 82F1EE8 - .incbin "graphics/wonder_transfers/wonder_news_1.bin.lz" - - .align 2 -gWonderNewsGfx2:: @ 82F1FC4 - .incbin "graphics/wonder_transfers/wonder_news_2.4bpp.lz" - - .align 2 -gWonderNewsTilemap2:: @ 82F1FF4 - .incbin "graphics/wonder_transfers/wonder_news_2.bin.lz" - - .align 2 -gWonderNewsGfx3:: @ 82F20B4 - .incbin "graphics/wonder_transfers/wonder_news_3.4bpp.lz" - - .align 2 -gWonderNewsTilemap3:: @ 82F2124 - .incbin "graphics/wonder_transfers/wonder_news_3.bin.lz" - - .align 2 -gWonderNewsGfx7:: @ 82F21F0 - .incbin "graphics/wonder_transfers/wonder_news_7.4bpp.lz" - - .align 2 -gWonderNewsTilemap7:: @ 82F2280 - .incbin "graphics/wonder_transfers/wonder_news_7.bin.lz" - - .align 2 -gWonderNewsGfx8:: @ 82F235C - .incbin "graphics/wonder_transfers/wonder_news_8.4bpp.lz" - - .align 2 -gWonderNewsTilemap8:: @ 82F23EC - .incbin "graphics/wonder_transfers/wonder_news_8.bin.lz" - - .align 2 -gUnknown_082F24C8:: @ 82F24C8 - .4byte 0x00000001, gWonderNewsGfx1, gWonderNewsTilemap1, gWonderNewsPal1 - .4byte 0x00000001, gWonderNewsGfx2, gWonderNewsTilemap2, gWonderCardBgPal2 - .4byte 0x00000001, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal3 - .4byte 0x00000001, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal4 - .4byte 0x00000001, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal5 - .4byte 0x00000001, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal6 - .4byte 0x00000001, gWonderNewsGfx7, gWonderNewsTilemap7, gWonderNewsPal7 - .4byte 0x00000001, gWonderNewsGfx8, gWonderNewsTilemap8, gWonderNewsPal8 diff --git a/data/union_room_chat.s b/data/union_room_chat.s index 41ca06d9a..143678cd4 100755 --- a/data/union_room_chat.s +++ b/data/union_room_chat.s @@ -3,23 +3,6 @@ .section .rodata - .align 2 -gUnknown_082F2A7C:: @ 82F2A7C - .4byte sub_801DFAC - .4byte sub_801E030 - .4byte sub_801E120 - .4byte sub_801E240 - .4byte sub_801E764 - .4byte sub_801E838 - .4byte sub_801E460 - .4byte sub_801E5C4 - .4byte sub_801E668 - .4byte sub_801E978 - - .align 2 -gUnknown_082F2AA4:: @ 82F2AA4 - .byte 0x09, 0x09, 0x09, 0x09 - .align 2 gUnknown_082F2AA8:: @ 82F2AA8 .byte 0x00, 0x16, 0x17, 0x68, 0x19, 0x1a, 0x1b, 0x1c @@ -57,36 +40,9 @@ gUnknown_082F2AA8:: @ 82F2AA8 .align 2 gUnknown_082F2BA8:: @ 82F2BA8 - .4byte gUnknown_0862B9F9 - .4byte gUnknown_0862B9FF - .4byte gUnknown_0862BA05 - .4byte gUnknown_0862BA0B - .4byte gUnknown_0862BA11 - .4byte gUnknown_0862BA17 - .4byte gUnknown_0862BA1D - .4byte gUnknown_0862BA23 - .4byte gUnknown_0862BA29 - .4byte gUnknown_0862BA2F - .4byte gUnknown_0862BA35 - .4byte gUnknown_0862BA3B - .4byte gUnknown_0862BA41 - .4byte gUnknown_0862BA47 - .4byte gUnknown_0862BA4D - .4byte gUnknown_0862BA53 - .4byte gUnknown_0862BA59 - .4byte gUnknown_0862BA5F - .4byte gUnknown_0862BA65 - .4byte gUnknown_0862BA6B - .4byte gUnknown_0862BA79 - .4byte gUnknown_0862BA84 - .4byte gUnknown_0862BA8F - .4byte gUnknown_0862BA9A - .4byte gUnknown_0862BAA3 - .4byte gUnknown_0862BAAE - .4byte gUnknown_0862BAB9 - .4byte gUnknown_0862BAC4 - .4byte gUnknown_0862BACF - .4byte gUnknown_0862BADA + .4byte gUnknown_0862B9F9, gUnknown_0862B9FF, gUnknown_0862BA05, gUnknown_0862BA0B, gUnknown_0862BA11, gUnknown_0862BA17, gUnknown_0862BA1D, gUnknown_0862BA23, gUnknown_0862BA29, gUnknown_0862BA2F + .4byte gUnknown_0862BA35, gUnknown_0862BA3B, gUnknown_0862BA41, gUnknown_0862BA47, gUnknown_0862BA4D, gUnknown_0862BA53, gUnknown_0862BA59, gUnknown_0862BA5F, gUnknown_0862BA65, gUnknown_0862BA6B + .4byte gUnknown_0862BA79, gUnknown_0862BA84, gUnknown_0862BA8F, gUnknown_0862BA9A, gUnknown_0862BAA3, gUnknown_0862BAAE, gUnknown_0862BAB9, gUnknown_0862BAC4, gUnknown_0862BACF, gUnknown_0862BADA .align 2 gUnknown_082F2C20:: @ 82F2C20 diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index e8a2980a5..894bd13b6 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -95,8 +95,6 @@ // statchange defines #define STAT_CHANGE_BS_PTR 0x1 #define STAT_CHANGE_NOT_PROTECT_AFFECTED 0x20 -#define STAT_CHANGE_WORKED 0 -#define STAT_CHANGE_DIDNT_WORK 1 // atk48 #define ATK48_STAT_NEGATIVE 0x1 @@ -104,6 +102,26 @@ #define ATK48_ONLY_MULTIPLE 0x4 #define ATK48_DONT_CHECK_LOWER 0x8 +// atk49, moveend cases +#define ATK49_RAGE 0 +#define ATK49_DEFROST 1 +#define ATK49_SYNCHRONIZE_TARGET 2 +#define ATK49_MOVE_END_ABILITIES 3 +#define ATK49_STATUS_IMMUNITY_ABILITIES 4 +#define ATK49_SYNCHRONIZE_ATTACKER 5 +#define ATK49_CHOICE_MOVE 6 +#define ATK49_CHANGED_ITEMS 7 +#define ATK49_ATTACKER_INVISIBLE 8 +#define ATK49_ATTACKER_VISIBLE 9 +#define ATK49_TARGET_VISIBLE 10 +#define ATK49_ITEM_EFFECTS_ALL 11 +#define ATK49_KINGSROCK_SHELLBELL 12 +#define ATK49_SUBSTITUTE 13 +#define ATK49_UPDATE_LAST_MOVES 14 +#define ATK49_MIRROR_MOVE 15 +#define ATK49_NEXT_TARGET 16 +#define ATK49_COUNT 17 + #define BIT_HP 0x1 #define BIT_ATK 0x2 #define BIT_DEF 0x4 diff --git a/include/global.h b/include/global.h index d738deb3c..0506c036e 100644 --- a/include/global.h +++ b/include/global.h @@ -962,7 +962,8 @@ struct SaveBlock1 /*0x3B24*/ u8 seen2[DEX_FLAGS_NO]; /*0x3B58*/ LilycoveLady lilycoveLady; /*0x3B98*/ struct TrainerNameRecord trainerNameRecords[20]; - /*0x3C88*/ u8 unk3C88[11][20]; + /*0x3C88*/ u8 unk3C88[10][21]; + /*0x3D5A*/ u8 filler3D5A[0xA]; /*0x3D64*/ struct SaveTrainerHill trainerHill; /*0x3D70*/ struct WaldaPhrase waldaPhrase; // sizeof: 0x3D88 diff --git a/include/graphics.h b/include/graphics.h index 03840b6ff..b49b2a661 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4908,4 +4908,13 @@ extern const u16 gEasyChatRightWindow_Pal[]; // Use Pokeblock extern const u32 gUsePokeblockCondition_Gfx[]; +// Union Room Chat +extern const u16 gUnknown_08DD4BB0[]; +extern const u16 gUnknown_08DD4BD0[]; +extern const u32 gUnknown_08DD4BF0[]; +extern const u32 gUnknown_08DD4C4C[]; +extern const u16 gLinkMiscMenu_Pal[]; +extern const u32 gLinkMiscMenu_Gfx[]; +extern const u32 gLinkMiscMenu_Tilemap[]; + #endif //GUARD_GRAPHICS_H diff --git a/include/link.h b/include/link.h index 714b6bf15..719b0f067 100644 --- a/include/link.h +++ b/include/link.h @@ -236,7 +236,6 @@ u32 LinkMain1(u8 *shouldAdvanceLinkState, u16 *sendCmd, u16 (*recvCmds)[CMD_LENG void LinkVSync(void); void Timer3Intr(void); void SerialCB(void); -u8 GetLinkPlayerCount(void); bool32 InUnionRoom(void); void sub_800E0E8(void); bool8 IsLinkTaskFinished(void); diff --git a/include/link_rfu.h b/include/link_rfu.h index 199df27aa..d8f374ff9 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -285,5 +285,9 @@ bool8 sub_800DF34(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx); s32 sub_800E87C(u8 idx); void sub_8011BA4(void); void sub_8010198(void); +bool32 sub_8011A9C(void); +void sub_80104B0(void); +void sub_8011A50(void); +void sub_80110B8(u32 a0); #endif //GUARD_LINK_RFU_H diff --git a/include/menu.h b/include/menu.h index a119b4a07..b4c3cb2b5 100644 --- a/include/menu.h +++ b/include/menu.h @@ -101,5 +101,6 @@ void sub_8198314(void); void sub_8198180(const u8 *string, u8 a2, bool8 copyToVram); void AddTextPrinterWithCustomSpeedForMessage(bool8 allowSkippingDelayWithButtonPress, u8 speed); void sub_8198C78(void); +void PrintTextArray(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *strs); #endif // GUARD_MENU_H diff --git a/include/strings.h b/include/strings.h index 400e48036..4a65e6875 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2592,4 +2592,18 @@ extern const u8 gUnknown_085EE154[]; // Berry Powder Menu extern const u8 gText_Powder[]; +// Union Room Chat +extern const u8 gText_F700JoinedChat[]; +extern const u8 gText_F700LeftChat[]; +extern const u8 gText_Hello[]; +extern const u8 gText_Pokemon2[]; +extern const u8 gText_Trade[]; +extern const u8 gText_Battle[]; +extern const u8 gText_Lets[]; +extern const u8 gText_Ok[]; +extern const u8 gText_Sorry[]; +extern const u8 gText_YayUnkF9F9[]; +extern const u8 gText_ThankYou[]; +extern const u8 gText_ByeBye[]; + #endif // GUARD_STRINGS_H diff --git a/include/text.h b/include/text.h index d8f2fd8a3..eba3d0c4e 100644 --- a/include/text.h +++ b/include/text.h @@ -99,6 +99,8 @@ // #define EXT_CTRL_CODE_CLEAR 0x11 // +#define EXT_CTRL_CODE_CLEAR_TO 0x13 +#define EXT_CTRL_CODE_MIN_LETTER_SPACING 0x14 #define EXT_CTRL_CODE_JPN 0x15 #define EXT_CTRL_CODE_ENG 0x16 diff --git a/include/union_room.h b/include/union_room.h new file mode 100644 index 000000000..7634e4763 --- /dev/null +++ b/include/union_room.h @@ -0,0 +1,9 @@ +#ifndef GUARD_UNION_ROOM_H +#define GUARD_UNION_ROOM_H + +extern bool8 gUnknown_02022C60; + +void sub_8018798(u8); +void sub_80186EC(bool8, bool32); + +#endif //GUARD_UNION_ROOM_H diff --git a/include/union_room_chat.h b/include/union_room_chat.h new file mode 100755 index 000000000..17e482525 --- /dev/null +++ b/include/union_room_chat.h @@ -0,0 +1,7 @@ +#ifndef GUARD_UNION_ROOM_CHAT_H +#define GUARD_UNION_ROOM_CHAT_H + +void sub_801DD98(void); +void copy_strings_to_sav1(void); + +#endif // GUARD_UNION_ROOM_CHAT_H diff --git a/ld_script.txt b/ld_script.txt index 7f2fb8733..f1ed87a04 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -57,12 +57,12 @@ SECTIONS { src/union_room.o(.text); asm/union_room.o(.text); src/mevent2.o(.text); - asm/mevent_801BAAC.o(.text); + src/mevent_801BAAC.o(.text); asm/mevent_server.o(.text); asm/mevent_server_ish.o(.text); asm/mevent_server_helpers.o(.text); src/mevent_news.o(.text); - asm/union_room_chat.o(.text); + src/union_room_chat.o(.text); asm/berry_crush.o(.text); src/berry_powder.o(.text); asm/dodrio_berry_picking.o(.text); @@ -410,8 +410,9 @@ SECTIONS { src/union_room.o(.rodata); data/union_room.o(.rodata); src/mevent2.o(.rodata); - data/mevent_801BAAC.o(.rodata); + src/mevent_801BAAC.o(.rodata); data/mevent_server.o(.rodata); + src/union_room_chat.o(.rodata); data/union_room_chat.o(.rodata); data/berry_crush.o(.rodata); data/berry_powder.o(.rodata); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 0eb6dfec0..0a0c34ad2 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -4480,28 +4480,6 @@ static void atk48_playstatchangeanimation(void) } } -enum -{ - ATK49_RAGE, - ATK49_DEFROST, - ATK49_SYNCHRONIZE_TARGET, - ATK49_MOVE_END_ABILITIES, - ATK49_STATUS_IMMUNITY_ABILITIES, - ATK49_SYNCHRONIZE_ATTACKER, - ATK49_CHOICE_MOVE, - ATK49_CHANGED_ITEMS, - ATK49_ATTACKER_INVISIBLE, - ATK49_ATTACKER_VISIBLE, - ATK49_TARGET_VISIBLE, - ATK49_ITEM_EFFECTS_ALL, - ATK49_KINGSROCK_SHELLBELL, - ATK49_SUBSTITUTE, - ATK49_UPDATE_LAST_MOVES, - ATK49_MIRROR_MOVE, - ATK49_NEXT_TARGET, - ATK49_COUNT, -}; - static void atk49_moveend(void) { s32 i; @@ -7210,6 +7188,9 @@ static void atk88_negativedamage(void) gBattlescriptCurrInstr++; } +#define STAT_CHANGE_WORKED 0 +#define STAT_CHANGE_DIDNT_WORK 1 + static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) { bool8 certain = FALSE; diff --git a/src/link_rfu.c b/src/link_rfu.c index 07fa04dd2..945806459 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -4741,7 +4741,7 @@ bool32 sub_8011A80(void) return FALSE; } -u8 sub_8011A9C(void) +bool32 sub_8011A9C(void) { return gUnknown_03005000.unk_ce8; } diff --git a/src/mevent_801BAAC.c b/src/mevent_801BAAC.c new file mode 100644 index 000000000..857ca3fde --- /dev/null +++ b/src/mevent_801BAAC.c @@ -0,0 +1,825 @@ +#include "global.h" +#include "constants/species.h" +#include "bg.h" +#include "gpu_regs.h" +#include "palette.h" +#include "decompress.h" +#include "alloc.h" +#include "menu.h" +#include "pokemon_icon.h" +#include "union_room.h" +#include "list_menu.h" +#include "text_window.h" +#include "string_util.h" +#include "link_rfu.h" +#include "mevent.h" + +struct UnkStruct_8467FB8 +{ + u8 textPal1:4; + u8 textPal2:4; + u8 textPal3:4; + u8 textPal4:4; + const u32 * tiles; + const u32 * map; + const u16 * pal; +}; + +struct UnkStruct_203F3C8_02DC +{ + u8 unk_00; + u8 unk_01[41]; + u8 unk_42[4]; +}; + +struct UnkStruct_203F3C8 +{ + /*0000*/ struct MEventBuffer_32E0_Sub unk_0000; + /*014c*/ struct MEventBuffer_3430_Sub unk_014C; + /*0170*/ const struct UnkStruct_8467FB8 * unk_0170; + /*0174*/ u8 unk_0174; + /*0175*/ u8 unk_0175; + /*0176*/ u16 unk_0176[3]; + /*017C*/ u8 unk_017C; + /*017D*/ u8 unk_017D[7][2]; + /*018B*/ u8 unk_018B[41]; + /*01B4*/ u8 unk_01B4[41]; + /*01DD*/ u8 unk_01DD[7]; + /*01E4*/ u8 unk_01E4[4][41]; + /*0288*/ u8 unk_0288[41]; + /*02B1*/ u8 unk_02B1[41]; + /*02DC*/ struct UnkStruct_203F3C8_02DC unk_02DC[8]; + /*045C*/ u8 buffer_045C[0x1000]; +}; + +EWRAM_DATA struct UnkStruct_203F3C8 * gUnknown_02022C74 = NULL; + +void sub_801BEF8(void); +void sub_801C178(u8 whichWindow); +void sub_801C4C0(void); +void sub_801C61C(void); + +extern const struct OamData gUnknown_08524934; + +const u8 gUnknown_082F0E10[][3] = { + {0, 2, 3}, + {0, 1, 2} +}; +const u8 ALIGNED(4) gUnknown_082F0E18[3] = {7, 4, 7}; +const struct WindowTemplate gUnknown_082F0E1C[] = { + { + .bg = 1, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 25, + .height = 4, + .paletteNum = 2, + .baseBlock = 0x029c + }, { + .bg = 1, + .tilemapLeft = 1, + .tilemapTop = 6, + .width = 28, + .height = 8, + .paletteNum = 2, + .baseBlock = 0x01bc + }, { + .bg = 1, + .tilemapLeft = 1, + .tilemapTop = 14, + .width = 28, + .height = 5, + .paletteNum = 2, + .baseBlock = 0x0130 + } +}; + +const u16 gWonderCardBgPal1[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_1.gbapal"); +const u16 gWonderCardBgPal2[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_2.gbapal"); +const u16 gWonderCardBgPal3[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_3.gbapal"); +const u16 gWonderCardBgPal4[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_4.gbapal"); +const u16 gWonderCardBgPal5[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_5.gbapal"); +const u16 gWonderCardBgPal6[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_6.gbapal"); +const u16 gWonderCardBgPal7[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_7.gbapal"); +const u16 gWonderCardBgPal8[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_8.gbapal"); +const u32 gWonderCardBgGfx1[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_1.4bpp.lz"); +const u32 gWonderCardBgTilemap1[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_1.bin.lz"); +const u32 gWonderCardBgGfx2[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_2.4bpp.lz"); +const u32 gWonderCardBgTilemap2[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_2.bin.lz"); +const u32 gWonderCardBgGfx3[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_3.4bpp.lz"); +const u32 gWonderCardBgTilemap3[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_3.bin.lz"); +const u32 gWonderCardBgGfx7[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_7.4bpp.lz"); +const u32 gWonderCardBgTilemap7[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_7.bin.lz"); +const u32 gWonderCardBgGfx8[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_8.4bpp.lz"); +const u32 gWonderCardBgTilemap8[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_8.bin.lz"); +const u16 gWonderCardShadowPal1[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_shadow_1.gbapal"); +const u16 gWonderCardShadowPal2[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_shadow_2.gbapal"); +const u16 gWonderCardShadowPal3[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_shadow_3.gbapal"); +const u16 gWonderCardShadowPal4[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_shadow_4.gbapal"); +const u16 gWonderCardShadowPal5[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_shadow_5.gbapal"); +const u16 gWonderCardShadowPal6[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_shadow_6.gbapal"); +const u16 gWonderCardShadowPal7[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_shadow_7.gbapal"); +const u16 gWonderCardShadowPal8[] = INCBIN_U16("graphics/wonder_transfers/wonder_card_shadow_8.gbapal"); +const u32 gWonderCardShadowGfx[] = INCBIN_U32("graphics/wonder_transfers/wonder_card_shadow.4bpp.lz"); + +const struct CompressedSpriteSheet gUnknown_082F1D00 = { + gWonderCardShadowGfx, 0x100, 0x8000 +}; +const struct SpritePalette gUnknown_082F1D08[] = { + {gWonderCardShadowPal1, 0x8000}, + {gWonderCardShadowPal2, 0x8000}, + {gWonderCardShadowPal3, 0x8000}, + {gWonderCardShadowPal4, 0x8000}, + {gWonderCardShadowPal5, 0x8000}, + {gWonderCardShadowPal6, 0x8000}, + {gWonderCardShadowPal7, 0x8000}, + {gWonderCardShadowPal8, 0x8000} +}; +const struct SpriteTemplate gUnknown_082F1D48 = { + 0x8000, 0x8000, &gUnknown_08524934, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy +}; +const struct UnkStruct_8467FB8 gUnknown_082F1D60[8] = { + {1, 0, 0, 0, gWonderCardBgGfx1, gWonderCardBgTilemap1, gWonderCardBgPal1}, + {1, 0, 0, 1, gWonderCardBgGfx2, gWonderCardBgTilemap2, gWonderCardBgPal2}, + {1, 0, 0, 2, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal3}, + {1, 0, 0, 3, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal4}, + {1, 0, 0, 4, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal5}, + {1, 0, 0, 5, gWonderCardBgGfx3, gWonderCardBgTilemap3, gWonderCardBgPal6}, + {1, 0, 0, 6, gWonderCardBgGfx7, gWonderCardBgTilemap7, gWonderCardBgPal7}, + {1, 0, 0, 7, gWonderCardBgGfx8, gWonderCardBgTilemap8, gWonderCardBgPal8} +}; + +bool32 sub_801BAAC(struct MEventBuffer_32E0_Sub * r5, struct MEventBuffer_3430_Sub * r6) +{ + if (r5 == NULL || r6 == NULL) + return FALSE; + gUnknown_02022C74 = AllocZeroed(sizeof(struct UnkStruct_203F3C8)); + if (gUnknown_02022C74 == NULL) + return FALSE; + gUnknown_02022C74->unk_0000 = *r5; + gUnknown_02022C74->unk_014C = *r6; + if (gUnknown_02022C74->unk_0000.unk_08_2 >= ARRAY_COUNT(gUnknown_082F1D60)) + gUnknown_02022C74->unk_0000.unk_08_2 = 0; + if (gUnknown_02022C74->unk_0000.unk_08_0 >= ARRAY_COUNT(gUnknown_082F0E18)) + gUnknown_02022C74->unk_0000.unk_08_0 = 0; + if (gUnknown_02022C74->unk_0000.unk_09 > ARRAY_COUNT(gUnknown_02022C74->unk_017D)) + gUnknown_02022C74->unk_0000.unk_09 = 0; + gUnknown_02022C74->unk_0170 = &gUnknown_082F1D60[gUnknown_02022C74->unk_0000.unk_08_2]; + return TRUE; +} + +void sub_801BB48(void) +{ + if (gUnknown_02022C74 != NULL) + { + *gUnknown_02022C74 = (struct UnkStruct_203F3C8){}; + Free(gUnknown_02022C74); + gUnknown_02022C74 = NULL; + } +} + +s32 sub_801BB74(void) +{ + if (gUnknown_02022C74 == NULL) + return -1; + switch(gUnknown_02022C74->unk_0174) + { + case 0: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); + break; + case 1: + if (UpdatePaletteFade()) + return 0; + break; + case 2: + FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(0); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + decompress_and_copy_tile_data_to_vram(2, gUnknown_02022C74->unk_0170->tiles, 0, 0x008, 0); + gUnknown_02022C74->unk_0176[0] = AddWindow(&gUnknown_082F0E1C[0]); + gUnknown_02022C74->unk_0176[1] = AddWindow(&gUnknown_082F0E1C[1]); + gUnknown_02022C74->unk_0176[2] = AddWindow(&gUnknown_082F0E1C[2]); + break; + case 3: + if (free_temp_tile_data_buffers_if_possible()) + return 0; + LoadPalette(stdpal_get(1), 0x20, 0x20); + gPaletteFade.bufferTransferDisabled = TRUE; + LoadPalette(gUnknown_02022C74->unk_0170->pal, 0x10, 0x20); + LZ77UnCompWram(gUnknown_02022C74->unk_0170->map, gUnknown_02022C74->buffer_045C); + CopyRectToBgTilemapBufferRect(2, gUnknown_02022C74->buffer_045C, 0, 0, 30, 20, 0, 0, 30, 20, 1, 0x008, 0); + CopyBgTilemapBufferToVram(2); + break; + case 4: + sub_801BEF8(); + break; + case 5: + sub_801C178(0); + sub_801C178(1); + sub_801C178(2); + CopyBgTilemapBufferToVram(1); + break; + case 6: + LoadMonIconPalettes(); + break; + case 7: + ShowBg(1); + ShowBg(2); + gPaletteFade.bufferTransferDisabled = FALSE; + sub_801C4C0(); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); + UpdatePaletteFade(); + break; + default: + if (UpdatePaletteFade()) + return 0; + gUnknown_02022C74->unk_0174 = 0; + return 1; + } + ++gUnknown_02022C74->unk_0174; + return 0; +} + +s32 sub_801BDA4(bool32 flag) +{ + if (gUnknown_02022C74 == NULL) + return -1; + switch (gUnknown_02022C74->unk_0174) + { + case 0: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); + break; + case 1: + if (UpdatePaletteFade()) + return 0; + break; + case 2: + FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(0); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + break; + case 3: + HideBg(1); + HideBg(2); + RemoveWindow(gUnknown_02022C74->unk_0176[2]); + RemoveWindow(gUnknown_02022C74->unk_0176[1]); + RemoveWindow(gUnknown_02022C74->unk_0176[0]); + break; + case 4: + sub_801C61C(); + FreeMonIconPalettes(); + break; + case 5: + sub_80186EC(gUnknown_02022C60, flag); + CopyBgTilemapBufferToVram(0); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); + break; + default: + if (UpdatePaletteFade()) + return 0; + gUnknown_02022C74->unk_0174 = 0; + return 1; + } + ++gUnknown_02022C74->unk_0174; + return 0; +} + +void sub_801BEF8(void) +{ + u16 i = 0; + u16 r6; + u16 sp0[3] = {0, 0, 0}; + + memcpy(gUnknown_02022C74->unk_018B, gUnknown_02022C74->unk_0000.unk_0A, 40); + gUnknown_02022C74->unk_018B[40] = EOS; + memcpy(gUnknown_02022C74->unk_01B4, gUnknown_02022C74->unk_0000.unk_32, 40); + gUnknown_02022C74->unk_01B4[40] = EOS; + if (gUnknown_02022C74->unk_0000.unk_04 > 999999) + gUnknown_02022C74->unk_0000.unk_04 = 999999; + ConvertIntToDecimalStringN(gUnknown_02022C74->unk_01DD, gUnknown_02022C74->unk_0000.unk_04, STR_CONV_MODE_LEFT_ALIGN, 6); + for (i = 0; i < 4; i++) + { + memcpy(gUnknown_02022C74->unk_01E4[i], gUnknown_02022C74->unk_0000.unk_5A[i], 40); + gUnknown_02022C74->unk_01E4[i][40] = EOS; + } + memcpy(gUnknown_02022C74->unk_0288, gUnknown_02022C74->unk_0000.unk_FA, 40); + gUnknown_02022C74->unk_0288[40] = EOS; + switch (gUnknown_02022C74->unk_0000.unk_08_0) + { + case 0: + memcpy(gUnknown_02022C74->unk_02B1, gUnknown_02022C74->unk_0000.unk_122, 40); + gUnknown_02022C74->unk_02B1[40] = EOS; + break; + case 1: + gUnknown_02022C74->unk_02B1[00] = EOS; + break; + case 2: + gUnknown_02022C74->unk_02B1[00] = EOS; + sp0[0] = gUnknown_02022C74->unk_014C.unk_00 < 999 ? gUnknown_02022C74->unk_014C.unk_00 : 999; + sp0[1] = gUnknown_02022C74->unk_014C.unk_02 < 999 ? gUnknown_02022C74->unk_014C.unk_02 : 999; + sp0[2] = gUnknown_02022C74->unk_014C.unk_04 < 999 ? gUnknown_02022C74->unk_014C.unk_04 : 999; + for (i = 0; i < 8; i++) + { + memset(gUnknown_02022C74->unk_02DC[i].unk_42, EOS, 4); + memset(gUnknown_02022C74->unk_02DC[i].unk_01, EOS, 41); + } + for (i = 0, r6 = 0; i < 40; i++) + { + if (gUnknown_02022C74->unk_0000.unk_122[i] != 0xF7) + { + gUnknown_02022C74->unk_02DC[gUnknown_02022C74->unk_0175].unk_01[r6] = gUnknown_02022C74->unk_0000.unk_122[i]; + r6++; + } + else + { + u8 r3 = gUnknown_02022C74->unk_0000.unk_122[i + 1]; + if (r3 > 2) + { + i += 2; + } + else + { + ConvertIntToDecimalStringN(gUnknown_02022C74->unk_02DC[gUnknown_02022C74->unk_0175].unk_42, sp0[r3], STR_CONV_MODE_LEADING_ZEROS, 3); + gUnknown_02022C74->unk_02DC[gUnknown_02022C74->unk_0175].unk_00 = gUnknown_02022C74->unk_0000.unk_122[i + 2]; + gUnknown_02022C74->unk_0175++; + if (gUnknown_02022C74->unk_0175 > 7) + break; + r6 = 0; + i += 2; + } + } + } + } +} + +void sub_801C178(u8 whichWindow) +{ + s8 sp0C = 0; + s32 windowId = gUnknown_02022C74->unk_0176[whichWindow]; + PutWindowTilemap(windowId); + FillWindowPixelBuffer(windowId, 0); + switch (whichWindow) + { + case 0: + { + s32 x; + AddTextPrinterParameterized3(windowId, 3, 0, 1, gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal1], 0, gUnknown_02022C74->unk_018B); + x = 160 - GetStringWidth(3, gUnknown_02022C74->unk_01B4, GetFontAttribute(3, 2)); + if (x < 0) + x = 0; + AddTextPrinterParameterized3(windowId, 3, x, 17, gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal1], 0, gUnknown_02022C74->unk_01B4); + if (gUnknown_02022C74->unk_0000.unk_04 != 0) + { + AddTextPrinterParameterized3(windowId, 1, 166, 17, gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal1], 0, gUnknown_02022C74->unk_01DD); + } + break; + } + case 1: + for (; sp0C < 4; sp0C++) + { + AddTextPrinterParameterized3(windowId, 3, 0, 16 * sp0C + 2, gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal2], 0, gUnknown_02022C74->unk_01E4[sp0C]); + } + break; + case 2: + AddTextPrinterParameterized3(windowId, 3, 0, gUnknown_082F0E18[gUnknown_02022C74->unk_0000.unk_08_0], gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal3], 0, gUnknown_02022C74->unk_0288); + if (gUnknown_02022C74->unk_0000.unk_08_0 != 2) + { + AddTextPrinterParameterized3(windowId, 3, 0, 16 + gUnknown_082F0E18[gUnknown_02022C74->unk_0000.unk_08_0], gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal3], 0, gUnknown_02022C74->unk_02B1); + } + else + { + s32 x = 0; + s32 y = gUnknown_082F0E18[gUnknown_02022C74->unk_0000.unk_08_0] + 16; + s32 spacing = GetFontAttribute(3, 2); + for (; sp0C < gUnknown_02022C74->unk_0175; sp0C++) + { + AddTextPrinterParameterized3(windowId, 3, x, y, gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal3], 0, gUnknown_02022C74->unk_02DC[sp0C].unk_01); + if (gUnknown_02022C74->unk_02DC[sp0C].unk_42[0] != EOS) + { + x += GetStringWidth(3, gUnknown_02022C74->unk_02DC[sp0C].unk_01, spacing); + AddTextPrinterParameterized3(windowId, 3, x, y, gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal3], 0, gUnknown_02022C74->unk_02DC[sp0C].unk_42); + x += GetStringWidth(3, gUnknown_02022C74->unk_02DC[sp0C].unk_42, spacing) + gUnknown_02022C74->unk_02DC[sp0C].unk_00; + } + } + } + break; + } + CopyWindowToVram(windowId, 3); +} + +void sub_801C4C0(void) +{ + u8 r7 = 0; + gUnknown_02022C74->unk_017C = 0xFF; + if (gUnknown_02022C74->unk_014C.unk_06 != SPECIES_NONE) + { + gUnknown_02022C74->unk_017C = sub_80D2D78(sub_80D2E84(gUnknown_02022C74->unk_014C.unk_06), SpriteCallbackDummy, 0xDC, 0x14, 0, FALSE); + gSprites[gUnknown_02022C74->unk_017C].oam.priority = 2; + } + if (gUnknown_02022C74->unk_0000.unk_09 != 0 && gUnknown_02022C74->unk_0000.unk_08_0 == 1) + { + LoadCompressedSpriteSheetUsingHeap(&gUnknown_082F1D00); + LoadSpritePalette(&gUnknown_082F1D08[gUnknown_02022C74->unk_0170->textPal4]); + for (; r7 < gUnknown_02022C74->unk_0000.unk_09; r7++) + { + gUnknown_02022C74->unk_017D[r7][0] = 0xFF; + gUnknown_02022C74->unk_017D[r7][1] = 0xFF; + gUnknown_02022C74->unk_017D[r7][0] = CreateSprite(&gUnknown_082F1D48, 0xd8 - 32 * r7, 0x90, 8); + if (gUnknown_02022C74->unk_014C.unk_08[0][r7] != 0) + { + gUnknown_02022C74->unk_017D[r7][1] = sub_80D2D78(sub_80D2E84(gUnknown_02022C74->unk_014C.unk_08[0][r7]), SpriteCallbackDummy, 0xd8 - 32 * r7, 0x88, 0, 0); + } + } + } +} + +void sub_801C61C(void) +{ + u8 r6 = 0; + if (gUnknown_02022C74->unk_017C != 0xFF) + sub_80D2EF8(&gSprites[gUnknown_02022C74->unk_017C]); + if (gUnknown_02022C74->unk_0000.unk_09 != 0 && gUnknown_02022C74->unk_0000.unk_08_0 == 1) + { + for (; r6 < gUnknown_02022C74->unk_0000.unk_09; r6++) + { + if (gUnknown_02022C74->unk_017D[r6][0] != 0xFF) + { + DestroySprite(&gSprites[gUnknown_02022C74->unk_017D[r6][0]]); + } + if (gUnknown_02022C74->unk_017D[r6][1] != 0xFF) + { + sub_80D2EF8(&gSprites[gUnknown_02022C74->unk_017D[r6][1]]); + } + } + FreeSpriteTilesByTag(0x8000); + FreeSpritePaletteByTag(0x8000); + } +} + +struct UnkStruct_203F3CC +{ + /*0000*/ struct MEventBuffer_3120_Sub unk_0000; + /*01bc*/ const struct UnkStruct_8467FB8 * unk_01BC; + /*01c0*/ u8 unk_01C0_0:1; + u8 unk_01C0_1:7; + /*01c1*/ u8 unk_01C1; + /*01c2*/ u8 unk_01C2_0:1; + u8 unk_01C2_1:7; + /*01c3*/ u8 unk_01C3_0:1; + u8 unk_01C3_1:7; + /*01c4*/ u16 unk_01C4; + /*01c6*/ u16 unk_01C6; + /*01c8*/ u16 unk_01C8[2]; + /*01cc*/ u8 filler_01CC[2]; + /*01ce*/ u8 unk_01CE[41]; + /*01f7*/ u8 unk_01F7[10][41]; + /*0394*/ struct ScrollArrowsTemplate unk_0394; + /*03a4*/ u8 buffer_03A4[0x1000]; +}; + +EWRAM_DATA struct UnkStruct_203F3CC * gUnknown_02022C78 = NULL; + +void sub_801CDCC(void); +void sub_801CE7C(void); +void sub_801CFA4(void); + +const u8 gUnknown_082F1DE0[][3] = { + {0, 2, 3}, + {0, 1, 2} +}; +const struct WindowTemplate gUnknown_082F1DE8[] = { + { + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 0, + .width = 28, + .height = 3, + .paletteNum = 2, + .baseBlock = 0x2AC + }, { + .bg = 2, + .tilemapLeft = 1, + .tilemapTop = 3, + .width = 28, + .height = 20, + .paletteNum = 2, + .baseBlock = 0x07C + } +}; +const struct ScrollArrowsTemplate gUnknown_082F1DF8 = { + 0x02, 0xe8, 0x18, 0x03, 0xe8, 0x98, + 0x0000, 0x0002, 0x1000, 0x1000, 0x0 +}; +const u16 gWonderNewsPal1[] = INCBIN_U16("graphics/wonder_transfers/wonder_news_1.gbapal"); +const u16 gWonderNewsPal7[] = INCBIN_U16("graphics/wonder_transfers/wonder_news_7.gbapal"); +const u16 gWonderNewsPal8[] = INCBIN_U16("graphics/wonder_transfers/wonder_news_8.gbapal"); +const u32 gWonderNewsGfx1[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_1.4bpp.lz"); +const u32 gWonderNewsTilemap1[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_1.bin.lz"); +const u32 gWonderNewsGfx2[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_2.4bpp.lz"); +const u32 gWonderNewsTilemap2[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_2.bin.lz"); +const u32 gWonderNewsGfx3[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_3.4bpp.lz"); +const u32 gWonderNewsTilemap3[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_3.bin.lz"); +const u32 gWonderNewsGfx7[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_7.4bpp.lz"); +const u32 gWonderNewsTilemap7[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_7.bin.lz"); +const u32 gWonderNewsGfx8[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_8.4bpp.lz"); +const u32 gWonderNewsTilemap8[] = INCBIN_U32("graphics/wonder_transfers/wonder_news_8.bin.lz"); + +const struct UnkStruct_8467FB8 gUnknown_082F24C8[] = { + {1, 0, 0, 0, gWonderNewsGfx1, gWonderNewsTilemap1, gWonderNewsPal1}, + {1, 0, 0, 0, gWonderNewsGfx2, gWonderNewsTilemap2, gWonderCardBgPal2}, + {1, 0, 0, 0, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal3}, + {1, 0, 0, 0, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal4}, + {1, 0, 0, 0, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal5}, + {1, 0, 0, 0, gWonderNewsGfx3, gWonderNewsTilemap3, gWonderCardBgPal6}, + {1, 0, 0, 0, gWonderNewsGfx7, gWonderNewsTilemap7, gWonderNewsPal7}, + {1, 0, 0, 0, gWonderNewsGfx8, gWonderNewsTilemap8, gWonderNewsPal8} +}; + +bool32 sub_801C6C8(const struct MEventBuffer_3120_Sub * a0) +{ + if (a0 == NULL) + return FALSE; + gUnknown_02022C78 = AllocZeroed(sizeof(struct UnkStruct_203F3CC)); + if (gUnknown_02022C78 == NULL) + return FALSE; + gUnknown_02022C78->unk_0000 = *a0; + if (gUnknown_02022C78->unk_0000.unk_03 >= ARRAY_COUNT(gUnknown_082F24C8)) + gUnknown_02022C78->unk_0000.unk_03 = 0; + gUnknown_02022C78->unk_01BC = &gUnknown_082F24C8[gUnknown_02022C78->unk_0000.unk_03]; + gUnknown_02022C78->unk_01C1 = 0xFF; + return TRUE; +} + +void sub_801C72C(void) +{ + if (gUnknown_02022C78 != NULL) + { + *gUnknown_02022C78 = (struct UnkStruct_203F3CC){}; + Free(gUnknown_02022C78); + gUnknown_02022C78 = NULL; + } +} + +s32 sub_801C758(void) +{ + if (gUnknown_02022C78 == NULL) + return -1; + + switch (gUnknown_02022C78->unk_01C0_1) + { + case 0: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); + break; + case 1: + if (UpdatePaletteFade()) + return 0; + ChangeBgY(0, 0, 0); + ChangeBgY(1, 0, 0); + ChangeBgY(2, 0, 0); + ChangeBgY(3, 0, 0); + SetGpuReg(REG_OFFSET_WIN0H, 0xF0); + SetGpuReg(REG_OFFSET_WIN0V, 0x1A98); + SetGpuReg(REG_OFFSET_WININ, 0x1F); + SetGpuReg(REG_OFFSET_WINOUT, 0x1B); + SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); + break; + case 2: + FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(3, 0x000, 0, 0, 30, 20); + CopyBgTilemapBufferToVram(0); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); + decompress_and_copy_tile_data_to_vram(3, gUnknown_02022C78->unk_01BC->tiles, 0, 8, 0); + gUnknown_02022C78->unk_01C8[0] = AddWindow(&gUnknown_082F1DE8[0]); + gUnknown_02022C78->unk_01C8[1] = AddWindow(&gUnknown_082F1DE8[1]); + break; + case 3: + if (free_temp_tile_data_buffers_if_possible()) + return 0; + LoadPalette(stdpal_get(1), 0x20, 0x20); + gPaletteFade.bufferTransferDisabled = TRUE; + LoadPalette(gUnknown_02022C78->unk_01BC->pal, 0x10, 0x20); + LZ77UnCompWram(gUnknown_02022C78->unk_01BC->map, gUnknown_02022C78->buffer_03A4); + CopyRectToBgTilemapBufferRect(1, gUnknown_02022C78->buffer_03A4, 0, 0, 30, 3, 0, 0, 30, 3, 1, 8, 0); + CopyRectToBgTilemapBufferRect(3, gUnknown_02022C78->buffer_03A4, 0, 3, 30, 23, 0, 3, 30, 23, 1, 8, 0); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(3); + break; + case 4: + sub_801CDCC(); + break; + case 5: + sub_801CE7C(); + CopyBgTilemapBufferToVram(0); + CopyBgTilemapBufferToVram(2); + break; + case 6: + ShowBg(1); + ShowBg(2); + ShowBg(3); + gPaletteFade.bufferTransferDisabled = FALSE; + gUnknown_02022C78->unk_01C1 = AddScrollIndicatorArrowPair(&gUnknown_02022C78->unk_0394, &gUnknown_02022C78->unk_01C6); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); + UpdatePaletteFade(); + break; + default: + if (UpdatePaletteFade()) + return 0; + gUnknown_02022C78->unk_01C0_1 = 0; + return 1; + } + + ++gUnknown_02022C78->unk_01C0_1; + return 0; +} + +s32 sub_801CA50(bool32 flag) +{ + if (gUnknown_02022C78 == NULL) + return -1; + switch (gUnknown_02022C78->unk_01C0_1) + { + case 0: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); + break; + case 1: + if (UpdatePaletteFade()) + return 0; + ChangeBgY(2, 0, 0); + SetGpuReg(REG_OFFSET_WIN0H, 0); + SetGpuReg(REG_OFFSET_WIN0V, 0); + SetGpuReg(REG_OFFSET_WININ, 0); + SetGpuReg(REG_OFFSET_WINOUT, 0); + ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); + break; + case 2: + FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 24); + FillBgTilemapBufferRect_Palette0(3, 0x000, 0, 0, 30, 24); + CopyBgTilemapBufferToVram(0); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(3); + break; + case 3: + HideBg(1); + HideBg(2); + RemoveWindow(gUnknown_02022C78->unk_01C8[1]); + RemoveWindow(gUnknown_02022C78->unk_01C8[0]); + break; + case 4: + ChangeBgY(2, 0, 0); + ChangeBgY(3, 0, 0); + if (gUnknown_02022C78->unk_01C1 != 0xFF) + { + RemoveScrollIndicatorArrowPair(gUnknown_02022C78->unk_01C1); + gUnknown_02022C78->unk_01C1 = 0xFF; + } + break; + case 5: + sub_80186EC(gUnknown_02022C60, flag); + sub_8018798(3); + CopyBgTilemapBufferToVram(0); + CopyBgTilemapBufferToVram(3); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); + break; + default: + if (UpdatePaletteFade()) + return 0; + gUnknown_02022C78->unk_01C0_1 = 0; + return 1; + } + ++gUnknown_02022C78->unk_01C0_1; + return 0; +} + +void sub_801CC38(void) +{ + if (!gUnknown_02022C78->unk_01C0_0 && gUnknown_02022C78->unk_01C1 != 0xFF) + { + RemoveScrollIndicatorArrowPair(gUnknown_02022C78->unk_01C1); + gUnknown_02022C78->unk_01C1 = 0xFF; + gUnknown_02022C78->unk_01C0_0 = TRUE; + } +} + + +void sub_801CC80(void) +{ + if (gUnknown_02022C78->unk_01C0_0) + { + gUnknown_02022C78->unk_01C1 = AddScrollIndicatorArrowPair(&gUnknown_02022C78->unk_0394, &gUnknown_02022C78->unk_01C6); + gUnknown_02022C78->unk_01C0_0 = FALSE; + } +} + +u8 sub_801CCD0(u16 input) +{ + if (gUnknown_02022C78->unk_01C2_0) + { + sub_801CFA4(); + return 0xFF; + } + switch (input) + { + case A_BUTTON: + return 0; + case B_BUTTON: + return 1; + case DPAD_UP: + if (gUnknown_02022C78->unk_01C6 == 0) + return 0xFF; + if (gUnknown_02022C78->unk_01C0_0) + return 0xFF; + gUnknown_02022C78->unk_01C3_0 = FALSE; + break; + case DPAD_DOWN: + if (gUnknown_02022C78->unk_01C6 == gUnknown_02022C78->unk_01C4) + return 0xFF; + if (gUnknown_02022C78->unk_01C0_0) + return 0xFF; + gUnknown_02022C78->unk_01C3_0 = TRUE; + break; + default: + return 0xFF; + } + gUnknown_02022C78->unk_01C2_0 = TRUE; + gUnknown_02022C78->unk_01C2_1 = 2; + gUnknown_02022C78->unk_01C3_1 = 0; + if (gUnknown_02022C78->unk_01C3_0 == FALSE) + return 2; + else + return 3; +} + +void sub_801CDCC(void) +{ + u8 i = 0; + memcpy(gUnknown_02022C78->unk_01CE, gUnknown_02022C78->unk_0000.unk_04, 40); + gUnknown_02022C78->unk_01CE[40] = EOS; + for (; i < 10; ++i) + { + memcpy(gUnknown_02022C78->unk_01F7[i], gUnknown_02022C78->unk_0000.unk_2C[i], 40); + gUnknown_02022C78->unk_01F7[i][40] = EOS; + if (i > 7 && gUnknown_02022C78->unk_01F7[i][0] != EOS) + ++gUnknown_02022C78->unk_01C4; + } + gUnknown_02022C78->unk_0394 = gUnknown_082F1DF8; + gUnknown_02022C78->unk_0394.fullyDownThreshold = gUnknown_02022C78->unk_01C4; +} + +void sub_801CE7C(void) +{ + u8 i = 0; + s32 x; + PutWindowTilemap(gUnknown_02022C78->unk_01C8[0]); + PutWindowTilemap(gUnknown_02022C78->unk_01C8[1]); + FillWindowPixelBuffer(gUnknown_02022C78->unk_01C8[0], 0); + FillWindowPixelBuffer(gUnknown_02022C78->unk_01C8[1], 0); + x = (0xe0 - GetStringWidth(3, gUnknown_02022C78->unk_01CE, GetFontAttribute(3, 2))) / 2; + if (x < 0) + x = 0; + AddTextPrinterParameterized3(gUnknown_02022C78->unk_01C8[0], 3, x, 6, gUnknown_082F1DE0[gUnknown_02022C78->unk_01BC->textPal1], 0, gUnknown_02022C78->unk_01CE); + for (; i < 10; ++i) + { + AddTextPrinterParameterized3(gUnknown_02022C78->unk_01C8[1], 3, 0, 16 * i + 2, gUnknown_082F1DE0[gUnknown_02022C78->unk_01BC->textPal2], 0, gUnknown_02022C78->unk_01F7[i]); + } + CopyWindowToVram(gUnknown_02022C78->unk_01C8[0], 3); + CopyWindowToVram(gUnknown_02022C78->unk_01C8[1], 3); +} + +void sub_801CFA4(void) +{ + u16 r4 = gUnknown_02022C78->unk_01C2_1; + r4 <<= 8; + if (gUnknown_02022C78->unk_01C3_0) + { + ChangeBgY(2, r4, 1); + ChangeBgY(3, r4, 1); + } + else + { + ChangeBgY(2, r4, 2); + ChangeBgY(3, r4, 2); + } + gUnknown_02022C78->unk_01C3_1 += gUnknown_02022C78->unk_01C2_1; + if (gUnknown_02022C78->unk_01C3_1 > 15) + { + if (gUnknown_02022C78->unk_01C3_0) + ++gUnknown_02022C78->unk_01C6; + else + --gUnknown_02022C78->unk_01C6; + gUnknown_02022C78->unk_01C2_0 = FALSE; + gUnknown_02022C78->unk_01C3_1 = 0; + } +} diff --git a/src/new_game.c b/src/new_game.c index 97988497d..19f3461b4 100644 --- a/src/new_game.c +++ b/src/new_game.c @@ -43,9 +43,8 @@ #include "field_specials.h" #include "berry_powder.h" #include "mevent.h" +#include "union_room_chat.h" - -extern void copy_strings_to_sav1(void); extern void ResetPokeJumpResults(void); extern const u8 EventScript_ResetAllMapFlags[]; diff --git a/src/text.c b/src/text.c index be4bf2697..43834eab4 100644 --- a/src/text.c +++ b/src/text.c @@ -1601,7 +1601,7 @@ u16 RenderText(struct TextPrinter *textPrinter) textPrinter->printerTemplate.currentX = *textPrinter->printerTemplate.currentChar + textPrinter->printerTemplate.x; textPrinter->printerTemplate.currentChar++; return 2; - case 19: + case EXT_CTRL_CODE_CLEAR_TO: { widthHelper = *textPrinter->printerTemplate.currentChar; widthHelper += textPrinter->printerTemplate.x; @@ -1615,7 +1615,7 @@ u16 RenderText(struct TextPrinter *textPrinter) } } return 2; - case 20: + case EXT_CTRL_CODE_MIN_LETTER_SPACING: textPrinter->minLetterSpacing = *textPrinter->printerTemplate.currentChar++; return 2; case EXT_CTRL_CODE_JPN: diff --git a/src/union_room.c b/src/union_room.c index 6928f13d6..338063ef1 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -43,6 +43,7 @@ #include "rom_8011DC0.h" #include "easy_chat.h" #include "event_obj_lock.h" +#include "union_room_chat.h" EWRAM_DATA u8 gUnknown_02022C20[12] = {}; EWRAM_DATA u8 gUnknown_02022C2C = 0; @@ -95,7 +96,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_801DD98(void); void sub_802A9A8(u8 monId, MainCallback callback); void sub_802493C(u8 monId, MainCallback callback); void sub_8020C70(MainCallback callback); diff --git a/src/union_room_chat.c b/src/union_room_chat.c new file mode 100755 index 000000000..85cfa6e2e --- /dev/null +++ b/src/union_room_chat.c @@ -0,0 +1,2630 @@ +#include "global.h" +#include "alloc.h" +#include "bg.h" +#include "decompress.h" +#include "dma3.h" +#include "dynamic_placeholder_text_util.h" +#include "gpu_regs.h" +#include "graphics.h" +#include "link.h" +#include "link_rfu.h" +#include "load_save.h" +#include "main.h" +#include "menu.h" +#include "overworld.h" +#include "palette.h" +#include "save.h" +#include "scanline_effect.h" +#include "sound.h" +#include "sprite.h" +#include "string_util.h" +#include "strings.h" +#include "task.h" +#include "text.h" +#include "text_window.h" +#include "window.h" +#include "constants/rgb.h" +#include "constants/songs.h" + +struct UnionRoomChat +{ + u8 filler0[0x4]; + u16 unk4; + u16 unk6; + u8 filler8[0x2]; + u16 unkA; + u8 fillerC[0x1]; + u8 unkD; + u8 unkE; + u8 unkF; + u8 unk10; + u8 unk11; + u8 unk12; + u8 unk13; + u8 unk14; + u8 unk15; + u8 unk16; + u8 unk17; + u8 unk18; + u8 unk19; + u8 unk1A[0x1F]; + u8 unk39[0x40]; + u8 unk79[0x40]; + u8 unkB9[10][21]; + u8 filler18B[0x5]; + u8 unk190[0x28]; + u16 unk1B8; +}; + +struct UnionRoomChat2_Unk0 +{ + bool32 (* unk0)(u8 *); + u8 unk4; + u8 unk5; +}; + +struct UnionRoomChat2 +{ + struct UnionRoomChat2_Unk0 unk0[3]; + u16 unk18; + u16 unk1A; + u16 unk1C; + u16 unk1E; + s16 unk20; + u8 unk22[0x106]; + u8 unk128[BG_SCREEN_SIZE]; + u8 unk928[BG_SCREEN_SIZE]; + u8 unk1128[BG_SCREEN_SIZE]; + u8 unk1928[BG_SCREEN_SIZE]; + u8 unk2128[0x20]; + u8 unk2148[0x20]; +}; + +struct UnionRoomChat3 +{ + struct Sprite *unk0; + struct Sprite *unk4; + struct Sprite *unk8; + struct Sprite *unkC; + struct Sprite *unk10; + u16 unk14; +}; + +struct Unk82F2C98 +{ + u16 unk0; + bool32 (* unk4)(u8 *); +}; + +struct Unk82F2D40 +{ + const u8 *unk0; + u8 unk4; + u8 unk5; + u8 unk6; + u8 unk7; + u8 unk8; + u8 unk9; + u8 unkA; +}; + +static void sub_801DDD0(struct UnionRoomChat *); +static void c2_081284E0(void); +static void sub_801DF20(void); +static void sub_801DF38(void); +static void sub_801DF54(u8 taskId); +static void sub_801DFAC(void); +static void sub_801E030(void); +static void sub_801E120(void); +static void sub_801E240(void); +static void sub_801E460(void); +static void sub_801E5C4(void); +static void sub_801E668(void); +static void sub_801E764(void); +static void sub_801E838(void); +static void sub_801E978(void); +static void sub_801EBD4(u16); +static bool32 sub_801EBE4(void); +static void sub_801EC94(void); +static void sub_801ED68(void); +static void sub_801ED94(void); +static bool32 sub_801EDC4(void); +static void sub_801EDE0(void); +static void sub_801EE10(void); +static void sub_801EE2C(void); +static u8 *sub_801EE84(void); +static u8 *sub_801EEA8(void); +static void sub_801EF1C(u8 *); +static void sub_801EF24(u8 *); +static void sub_801EF4C(u8 *); +static void sub_801EF7C(u8 *); +static void sub_801EFA8(u8 *); +static void sub_801EFD0(u8 *); +static u8 *sub_801F114(void); +static void sub_801F2B4(u8 taskId); +static bool8 sub_801F4D0(void); +static bool32 sub_801F534(void); +static void sub_801F544(void); +static void sub_801F5B8(void); +static void sub_801F5EC(u16, u8); +static bool8 sub_801F644(u8); +static s8 sub_801FF08(void); +static bool32 sub_8020890(void); +static void sub_8020770(void); +static void sub_801F574(struct UnionRoomChat2 *); +static void sub_801F580(void); +static void sub_80208D0(void); +static bool32 sub_801FDD8(u8 *); +static void sub_8020480(void); +static void sub_8020538(void); +static void sub_8020584(void); +static void sub_80205B4(void); +static void sub_8020604(void); +static void sub_8020680(void); +static void sub_80206A4(void); +static void sub_80206D0(void); +static void sub_8020740(void); +static void sub_80206E8(void); +static void sub_80208E8(void); +static void sub_8020A68(void); +static void sub_8020B20(void); +static void sub_80203B0(void); +static void sub_802040C(void); +static void sub_802091C(bool32); +static bool32 sub_8020320(void); +static void sub_80201A4(void); +static bool32 sub_8020368(void); +static void sub_802093C(void); +static void sub_8020B80(void); +static void sub_801FF18(int, u16); +static void sub_801FDDC(u8, u8, u8); +static void sub_8020094(void); +static void sub_801FEBC(void); +static void sub_80200C8(void); +static void sub_801FEE4(void); +static void sub_80200EC(u16, u16, u8); +static void sub_8020118(u16, u8 *, u8, u8, u8); +static void sub_80209AC(int); +static void sub_8020420(u16, u8 *, u8); +static void sub_80209E0(void); +static bool32 sub_8020A1C(void); +static void sub_80207C0(s16); +static void sub_8020818(s16); + +extern struct UnionRoomChat *gUnknown_02022C84; +extern struct UnionRoomChat2 *gUnknown_02022C88; +extern struct UnionRoomChat3 *gUnknown_02022C8C; + +extern const u8 *const gUnknown_082F2BA8[][10]; +extern const u8 gUnknown_082F2AA8[]; +extern const struct BgTemplate gUnknown_082F2C60[4]; +extern const struct WindowTemplate gUnknown_082F2C70[]; +extern const struct Unk82F2C98 gUnknown_082F2C98[]; +extern const struct Unk82F2D40 gUnknown_082F2D40[]; +extern const u8 gText_Ellipsis[]; +extern const struct MenuAction gUnknown_082F2DC8[]; +extern const u16 gUnknown_082F2C20[]; +extern const u16 gUnknown_082F2C40[]; +extern const struct CompressedSpriteSheet gUnknown_082F3134[]; +extern const struct SpritePalette gUnknown_082F315C; +extern const struct SpriteTemplate gUnknown_082F319C; +extern const u16 gUnknown_082F2DF0[]; +extern const struct SpriteTemplate gUnknown_082F31BC; +extern const struct SpriteTemplate gUnknown_082F31D4; +extern const struct SpriteTemplate gUnknown_082F322C; +extern const struct SpriteTemplate gUnknown_082F3244; + + +void sub_801DD98(void) +{ + gUnknown_02022C84 = Alloc(sizeof(*gUnknown_02022C84)); + sub_801DDD0(gUnknown_02022C84); + gKeyRepeatStartDelay = 20; + SetVBlankCallback(NULL); + SetMainCallback2(c2_081284E0); +} + +static void sub_801DDD0(struct UnionRoomChat *unionRoomChat) +{ + int i; + + unionRoomChat->unk4 = 0; + unionRoomChat->unk6 = 0; + unionRoomChat->unk10 = 0; + unionRoomChat->unk11 = 0; + unionRoomChat->unk12 = 0; + unionRoomChat->unk14 = 0; + unionRoomChat->unk15 = 0; + unionRoomChat->unk16 = 0; + unionRoomChat->unk1A[0] = EOS; + unionRoomChat->unkD = GetLinkPlayerCount(); + unionRoomChat->unk13 = GetMultiplayerId(); + unionRoomChat->unk17 = 0; + unionRoomChat->unk18 = 0; + sub_801EF1C(unionRoomChat->unk190); + for (i = 0; i < 10; i++) + StringCopy(unionRoomChat->unkB9[i], gSaveBlock1Ptr->unk3C88[i]); +} + +void sub_801DE30(void) +{ + DestroyTask(gUnknown_02022C84->unkE); + DestroyTask(gUnknown_02022C84->unkF); + Free(gUnknown_02022C84); +} + +static void c2_081284E0(void) +{ + switch (gMain.state) + { + case 0: + ResetTasks(); + ResetSpriteData(); + FreeAllSpritePalettes(); + sub_801F4D0(); + gMain.state++; + break; + case 1: + sub_801F5B8(); + if (!sub_801F534()) + { + BlendPalettes(0xFFFFFFFF, 16, RGB_BLACK); + BeginNormalPaletteFade(0xFFFFFFFF, -1, 16, 0, RGB_BLACK); + SetVBlankCallback(sub_801DF20); + gMain.state++; + } + break; + case 2: + UpdatePaletteFade(); + if (!gPaletteFade.active) + { + SetMainCallback2(sub_801DF38); + gUnknown_02022C84->unkE = CreateTask(sub_801DF54, 8); + gUnknown_02022C84->unkF = CreateTask(sub_801F2B4, 7); + sub_800E0E8(); + CreateWirelessStatusIndicatorSprite(232, 150); + } + break; + } +} + +static void sub_801DF20(void) +{ + TransferPlttBuffer(); + LoadOam(); + ProcessSpriteCopyRequests(); + ScanlineEffect_InitHBlankDmaTransfer(); +} + +static void sub_801DF38(void) +{ + RunTasks(); + sub_801F5B8(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +void (*const gUnknown_082F2A7C[])(void) = +{ + sub_801DFAC, + sub_801E030, + sub_801E120, + sub_801E240, + sub_801E764, + sub_801E838, + sub_801E460, + sub_801E5C4, + sub_801E668, + sub_801E978, +}; + +static void sub_801DF54(u8 taskId) +{ + switch (gUnknown_02022C84->unk17) + { + case 1: + sub_801EBD4(6); + gUnknown_02022C84->unk17 = 0; + break; + case 2: + sub_801EBD4(7); + gUnknown_02022C84->unk17 = 0; + break; + case 3: + sub_801EBD4(8); + gUnknown_02022C84->unk17 = 0; + break; + } + + gUnknown_082F2A7C[gUnknown_02022C84->unk4](); +} + +static void sub_801DFAC(void) +{ + switch (gUnknown_02022C84->unk6) + { + case 0: + sub_801EF24(gUnknown_02022C84->unk190); + gUnknown_02022C84->unk6++; + // fall through + case 1: + if (IsLinkTaskFinished() && !sub_8011A9C()) + { + if (SendBlock(0, gUnknown_02022C84->unk190, sizeof(gUnknown_02022C84->unk190))) + gUnknown_02022C84->unk6++; + } + break; + case 2: + if (IsLinkTaskFinished()) + sub_801EBD4(1); + break; + } +} + +static void sub_801E030(void) +{ + bool8 var0, var1; + + switch (gUnknown_02022C84->unk6) + { + case 0: + if (gMain.newKeys & START_BUTTON) + { + if (gUnknown_02022C84->unk15) + sub_801EBD4(4); + } + else if (gMain.newKeys & SELECT_BUTTON) + { + sub_801EBD4(2); + } + else if (gMain.newAndRepeatedKeys & B_BUTTON) + { + if (gUnknown_02022C84->unk15) + { + sub_801ED68(); + sub_801F5EC(8, 0); + gUnknown_02022C84->unk6 = 1; + } + else + { + sub_801EBD4(3); + } + } + else if (gMain.newKeys & A_BUTTON) + { + sub_801EC94(); + sub_801F5EC(8, 0); + sub_801F5EC(2, 1); + gUnknown_02022C84->unk6 = 1; + } + else if (gMain.newKeys & R_BUTTON) + { + if (gUnknown_02022C84->unk10 != 3) + { + sub_801ED94(); + sub_801F5EC(8, 0); + gUnknown_02022C84->unk6 = 1; + } + else + { + sub_801EBD4(5); + } + } + else if (sub_801EBE4()) + { + sub_801F5EC(1, 0); + gUnknown_02022C84->unk6 = 1; + } + break; + case 1: + var0 = sub_801F644(0); + var1 = sub_801F644(1); + if (!var0 && !var1) + gUnknown_02022C84->unk6 = 0; + break; + } +} + +static void sub_801E120(void) +{ + s16 input; + int var0; + + switch (gUnknown_02022C84->unk6) + { + case 0: + sub_801F5EC(3, 0); + gUnknown_02022C84->unk6++; + break; + case 1: + if (!sub_801F644(0)) + gUnknown_02022C84->unk6++; + break; + case 2: + input = Menu_ProcessInput(); + switch (input) + { + default: + sub_801F5EC(4, 0); + var0 = 1; + if (gUnknown_02022C84->unk10 == input || input > 3) + var0 = 0; + break; + case MENU_NOTHING_CHOSEN: + if (gMain.newKeys & SELECT_BUTTON) + { + PlaySE(SE_SELECT); + Menu_MoveCursor(1); + } + return; + case MENU_B_PRESSED: + sub_801F5EC(4, 0); + gUnknown_02022C84->unk6 = 3; + return; + } + + if (!var0) + { + gUnknown_02022C84->unk6 = 3; + return; + } + + gUnknown_02022C84->unk11 = 0; + gUnknown_02022C84->unk12 = 0; + sub_801F5EC(5, 1); + gUnknown_02022C84->unk10 = input; + gUnknown_02022C84->unk6 = 4; + break; + case 3: + if (!sub_801F644(0)) + sub_801EBD4(1); + break; + case 4: + if (!sub_801F644(0) && !sub_801F644(1)) + sub_801EBD4(1); + break; + } +} + +static void sub_801E240(void) +{ + s8 input; + + switch (gUnknown_02022C84->unk6) + { + case 0: + sub_801F5EC(6, 0); + gUnknown_02022C84->unk6 = 1; + break; + case 1: + if (!sub_801F644(0)) + gUnknown_02022C84->unk6 = 2; + break; + case 2: + input = sub_801FF08(); + switch (input) + { + case -1: + case 1: + sub_801F5EC(7, 0); + gUnknown_02022C84->unk6 = 3; + break; + case 0: + if (gUnknown_02022C84->unk13 == 0) + { + sub_801EFD0(gUnknown_02022C84->unk190); + sub_801F5EC(7, 0); + gUnknown_02022C84->unk6 = 9; + } + else + { + sub_801EF7C(gUnknown_02022C84->unk190); + gUnknown_02022C84->unk6 = 4; + } + break; + } + break; + case 3: + if (!sub_801F644(0)) + sub_801EBD4(1); + break; + case 9: + if (!sub_801F644(0)) + { + sub_801F5EC(20, 0); + gUnknown_02022C84->unk6 = 10; + } + break; + case 10: + if (!sub_801F644(0)) + gUnknown_02022C84->unk6 = 8; + break; + case 8: + input = sub_801FF08(); + switch (input) + { + case -1: + case 1: + sub_801F5EC(7, 0); + gUnknown_02022C84->unk6 = 3; + break; + case 0: + sub_80104B0(); + sub_801EFD0(gUnknown_02022C84->unk190); + gUnknown_02022C84->unk6 = 4; + gUnknown_02022C84->unk1B8 = 0; + break; + } + break; + case 4: + if (IsLinkTaskFinished() && !sub_8011A9C() && SendBlock(0, gUnknown_02022C84->unk190, sizeof(gUnknown_02022C84->unk190))) + { + if (!gUnknown_02022C84->unk13) + gUnknown_02022C84->unk6 = 6; + else + gUnknown_02022C84->unk6 = 5; + } + + if (!gReceivedRemoteLinkPlayers) + sub_801EBD4(9); + break; + case 5: + if (!gReceivedRemoteLinkPlayers) + { + sub_801EBD4(9); + } + else if (++gUnknown_02022C84->unk1B8 > 300) + { + gUnknown_02022C84->unk1B8 = 0; + gUnknown_02022C84->unk6 = 4; + } + break; + } +} + +static void sub_801E460(void) +{ + switch (gUnknown_02022C84->unk6) + { + case 0: + if (!FuncIsActiveTask(sub_801F2B4)) + { + sub_801F5EC(7, 0); + gUnknown_02022C84->unk6++; + } + break; + case 1: + if (!sub_801F644(0)) + { + sub_801F5EC(18, 0); + gUnknown_02022C84->unk6++; + } + break; + case 2: + if (!sub_801F644(0)) + { + sub_801EFA8(gUnknown_02022C84->unk190); + gUnknown_02022C84->unk6++; + } + break; + case 3: + if (IsLinkTaskFinished() && !sub_8011A9C() && SendBlock(0, gUnknown_02022C84->unk190, sizeof(gUnknown_02022C84->unk190))) + gUnknown_02022C84->unk6++; + break; + case 4: + if ((GetBlockReceivedStatus() & 1) && !sub_8011A9C()) + gUnknown_02022C84->unk6++; + break; + case 5: + if (IsLinkTaskFinished() && !sub_8011A9C()) + { + sub_800AC34(); + gUnknown_02022C84->unkA = 0; + gUnknown_02022C84->unk6++; + } + break; + case 6: + if (gUnknown_02022C84->unkA < 150) + gUnknown_02022C84->unkA++; + + if (!gReceivedRemoteLinkPlayers) + gUnknown_02022C84->unk6++; + break; + case 7: + if (gUnknown_02022C84->unkA >= 150) + sub_801EBD4(9); + else + gUnknown_02022C84->unkA++; + break; + } +} + +static void sub_801E5C4(void) +{ + switch (gUnknown_02022C84->unk6) + { + case 0: + if (!FuncIsActiveTask(sub_801F2B4)) + { + sub_801F5EC(7, 0); + gUnknown_02022C84->unk6++; + } + break; + case 1: + if (!sub_801F644(0) && IsLinkTaskFinished() && !sub_8011A9C()) + { + sub_800AC34(); + gUnknown_02022C84->unkA = 0; + gUnknown_02022C84->unk6++; + } + break; + case 2: + if (gUnknown_02022C84->unkA < 150) + gUnknown_02022C84->unkA++; + + if (!gReceivedRemoteLinkPlayers) + gUnknown_02022C84->unk6++; + break; + case 3: + if (gUnknown_02022C84->unkA >= 150) + sub_801EBD4(9); + else + gUnknown_02022C84->unkA++; + break; + } +} + +static void sub_801E668(void) +{ + switch (gUnknown_02022C84->unk6) + { + case 0: + if (!FuncIsActiveTask(sub_801F2B4)) + { + if (gUnknown_02022C84->unk13) + sub_801F5EC(7, 0); + + gUnknown_02022C84->unk6++; + } + break; + case 1: + if (!sub_801F644(0)) + { + if (gUnknown_02022C84->unk13) + sub_801F5EC(19, 0); + + gUnknown_02022C84->unk6++; + } + break; + case 2: + if (sub_801F644(0) != TRUE && IsLinkTaskFinished() && !sub_8011A9C()) + { + sub_800AC34(); + gUnknown_02022C84->unkA = 0; + gUnknown_02022C84->unk6++; + } + break; + case 3: + if (gUnknown_02022C84->unkA < 150) + gUnknown_02022C84->unkA++; + + if (!gReceivedRemoteLinkPlayers) + gUnknown_02022C84->unk6++; + break; + case 4: + if (gUnknown_02022C84->unkA >= 150) + sub_801EBD4(9); + else + gUnknown_02022C84->unkA++; + break; + } +} + +static void sub_801E764(void) +{ + switch (gUnknown_02022C84->unk6) + { + case 0: + if (!gReceivedRemoteLinkPlayers) + { + sub_801EBD4(1); + break; + } + + sub_801EF4C(gUnknown_02022C84->unk190); + gUnknown_02022C84->unk6++; + // fall through + case 1: + if (IsLinkTaskFinished() == TRUE && !sub_8011A9C() && SendBlock(0, gUnknown_02022C84->unk190, sizeof(gUnknown_02022C84->unk190))) + gUnknown_02022C84->unk6++; + break; + case 2: + sub_801EE10(); + sub_801F5EC(8, 0); + gUnknown_02022C84->unk6++; + break; + case 3: + if (!sub_801F644(0)) + gUnknown_02022C84->unk6++; + break; + case 4: + if (IsLinkTaskFinished()) + sub_801EBD4(1); + break; + } +} + +static void sub_801E838(void) +{ + switch (gUnknown_02022C84->unk6) + { + case 0: + if (sub_801EDC4()) + { + sub_801F5EC(9, 0); + gUnknown_02022C84->unk6 = 2; + } + else + { + sub_801F5EC(13, 0); + gUnknown_02022C84->unk6 = 5; + } + break; + case 1: + if (gMain.newKeys & A_BUTTON) + { + sub_801EDE0(); + sub_801F5EC(11, 0); + gUnknown_02022C84->unk6 = 3; + } + else if (gMain.newKeys & B_BUTTON) + { + sub_801F5EC(10, 0); + gUnknown_02022C84->unk6 = 4; + } + else if (sub_801EBE4()) + { + sub_801F5EC(1, 0); + gUnknown_02022C84->unk6 = 2; + } + break; + case 2: + if (!sub_801F644(0)) + gUnknown_02022C84->unk6 = 1; + break; + case 3: + if (!sub_801F644(0)) + { + sub_801F5EC(10, 0); + gUnknown_02022C84->unk6 = 4; + } + break; + case 4: + if (!sub_801F644(0)) + sub_801EBD4(1); + break; + case 5: + if (!sub_801F644(0)) + gUnknown_02022C84->unk6 = 6; + break; + case 6: + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + sub_801F5EC(7, 0); + gUnknown_02022C84->unk6 = 4; + } + break; + } +} + +static void sub_801E978(void) +{ + s8 input; + + switch (gUnknown_02022C84->unk6) + { + case 0: + if (!gUnknown_02022C84->unk18) + { + gUnknown_02022C84->unk6 = 12; + } + else + { + sub_801F5EC(7, 0); + gUnknown_02022C84->unk6 = 1; + } + break; + case 1: + if (!sub_801F644(0)) + { + sub_801F5EC(14, 0); + gUnknown_02022C84->unk6 = 2; + } + break; + case 2: + input = sub_801FF08(); + switch (input) + { + case -1: + case 1: + gUnknown_02022C84->unk6 = 12; + break; + case 0: + sub_801F5EC(7, 0); + gUnknown_02022C84->unk6 = 3; + break; + } + break; + case 3: + if (!sub_801F644(0)) + { + sub_801F5EC(15, 0); + gUnknown_02022C84->unk6 = 4; + } + break; + case 4: + if (!sub_801F644(0)) + gUnknown_02022C84->unk6 = 5; + break; + case 5: + input = sub_801FF08(); + switch (input) + { + case -1: + case 1: + gUnknown_02022C84->unk6 = 12; + break; + case 0: + sub_801F5EC(7, 0); + gUnknown_02022C84->unk6 = 6; + break; + } + break; + case 6: + if (!sub_801F644(0)) + { + sub_801F5EC(16, 0); + sub_801EE2C(); + gUnknown_02022C84->unk6 = 7; + } + break; + case 7: + if (!sub_801F644(0)) + { + SetContinueGameWarpStatusToDynamicWarp(); + TrySavingData(SAVE_NORMAL); + gUnknown_02022C84->unk6 = 8; + } + break; + case 8: + sub_801F5EC(17, 0); + gUnknown_02022C84->unk6 = 9; + break; + case 9: + if (!sub_801F644(0)) + { + PlaySE(SE_SAVE); + ClearContinueGameWarpStatus2(); + gUnknown_02022C84->unk6 = 10; + } + break; + case 10: + gUnknown_02022C84->unk19 = 0; + gUnknown_02022C84->unk6 = 11; + break; + case 11: + gUnknown_02022C84->unk19++; + if (gUnknown_02022C84->unk19 > 120) + gUnknown_02022C84->unk6 = 12; + break; + case 12: + BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 16, RGB_BLACK); + gUnknown_02022C84->unk6 = 13; + break; + case 13: + if (!gPaletteFade.active) + { + sub_801F544(); + sub_801DE30(); + SetMainCallback2(CB2_ReturnToField); + } + break; + } +} + +static void sub_801EBD4(u16 arg0) +{ + gUnknown_02022C84->unk4 = arg0; + gUnknown_02022C84->unk6 = 0; +} + +static const u8 sUnknown_082F2AA4[] = {9, 9, 9, 9}; + +static bool32 sub_801EBE4(void) +{ + if (!(gMain.newAndRepeatedKeys & DPAD_UP)) + { + if (gMain.newAndRepeatedKeys & DPAD_DOWN) + { + if (gUnknown_02022C84->unk12 < sUnknown_082F2AA4[gUnknown_02022C84->unk10]) + gUnknown_02022C84->unk12++; + else + gUnknown_02022C84->unk12 = 0; + + return TRUE; + } + + if (gUnknown_02022C84->unk10 != 3) + { + if (gMain.newAndRepeatedKeys & DPAD_LEFT) + { + if (gUnknown_02022C84->unk11) + gUnknown_02022C84->unk11--; + else + gUnknown_02022C84->unk11 = 4; + } + else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + { + if (gUnknown_02022C84->unk11 > 3) + gUnknown_02022C84->unk11 = 0; + else + gUnknown_02022C84->unk11++; + } + else + { + return FALSE; + } + + return TRUE; + } + + return FALSE; + } + else + { + if (gUnknown_02022C84->unk12) + gUnknown_02022C84->unk12--; + else + gUnknown_02022C84->unk12 = sUnknown_082F2AA4[gUnknown_02022C84->unk10]; + + return TRUE; + } +} + +static void sub_801EC94(void) +{ + int i; + const u8 *charsStr; + int strLength; + u8 *str; + u8 buffer[21]; + + if (gUnknown_02022C84->unk10 != 3) + { + charsStr = gUnknown_082F2BA8[gUnknown_02022C84->unk10][gUnknown_02022C84->unk12]; + for (i = 0; i < gUnknown_02022C84->unk11; i++) + { + if (*charsStr == CHAR_SPECIAL_F9) + charsStr++; + charsStr++; + } + + strLength = 1; + } + else + { + u8 *tempStr = StringCopy(buffer, gUnknown_02022C84->unkB9[gUnknown_02022C84->unk12]); + tempStr[0] = CHAR_SPACE; + tempStr[1] = EOS; + charsStr = buffer; + strLength = StringLength_Multibyte(buffer); + } + + gUnknown_02022C84->unk14 = gUnknown_02022C84->unk15; + if (!charsStr) + return; + + str = sub_801EE84(); + while (--strLength != -1 && gUnknown_02022C84->unk15 < 15) + { + if (*charsStr == CHAR_SPECIAL_F9) + { + *str = *charsStr; + charsStr++; + str++; + } + + *str = *charsStr; + charsStr++; + str++; + + gUnknown_02022C84->unk15++; + } + + *str = EOS; +} + +static void sub_801ED68(void) +{ + gUnknown_02022C84->unk14 = gUnknown_02022C84->unk15; + if (gUnknown_02022C84->unk15) + { + u8 *str = sub_801EEA8(); + *str = EOS; + gUnknown_02022C84->unk15--; + } +} + +static void sub_801ED94(void) +{ + u8 *str; + u8 character; + + gUnknown_02022C84->unk14 = gUnknown_02022C84->unk15 - 1; + str = sub_801EEA8(); + if (*str != CHAR_SPECIAL_F9) + { + character = gUnknown_082F2AA8[*str]; + if (character) + *str = character; + } +} + +static bool32 sub_801EDC4(void) +{ + if (gUnknown_02022C84->unk15) + return TRUE; + else + return FALSE; +} + +static void sub_801EDE0(void) +{ + u8 *src = sub_801F114(); + StringCopy(gUnknown_02022C84->unkB9[gUnknown_02022C84->unk12], src); + gUnknown_02022C84->unk18 = 1; +} + +static void sub_801EE10(void) +{ + gUnknown_02022C84->unk1A[0] = EOS; + gUnknown_02022C84->unk14 = 15; + gUnknown_02022C84->unk15 = 0; +} + +static void sub_801EE2C(void) +{ + int i; + for (i = 0; i < 10; i++) + StringCopy(gSaveBlock1Ptr->unk3C88[i], gUnknown_02022C84->unkB9[i]); +} + +static u8 *sub_801EE6C(int arg0) +{ + return gUnknown_02022C84->unkB9[arg0]; +} + +static u8 *sub_801EE84(void) +{ + u8 *str = gUnknown_02022C84->unk1A; + while (*str != EOS) + str++; + + return str; +} + +static u8 *sub_801EEA8(void) +{ + u8 *str = gUnknown_02022C84->unk1A; + u8 *str2 = str; + while (*str != EOS) + { + str2 = str; + if (*str == CHAR_SPECIAL_F9) + str++; + str++; + } + + return str2; +} + +static u16 sub_801EED8(void) +{ + u8 *str; + u32 i, numChars, strLength; + + strLength = StringLength_Multibyte(gUnknown_02022C84->unk1A); + str = gUnknown_02022C84->unk1A; + numChars = 0; + if (strLength > 10) + { + strLength -= 10; + for (i = 0; i < strLength; i++) + { + if (*str == CHAR_SPECIAL_F9) + str++; + + str++; + numChars++; + } + } + + return numChars; +} + +static void sub_801EF1C(u8 *arg0) +{ + arg0[0] = CHAR_SPACE; +} + +static void sub_801EF24(u8 *arg0) +{ + arg0[0] = 2; + StringCopy(&arg0[1], gSaveBlock2Ptr->playerName); + arg0[1 + (PLAYER_NAME_LENGTH + 1)] = gUnknown_02022C84->unk13; +} + +static void sub_801EF4C(u8 *arg0) +{ + arg0[0] = 1; + StringCopy(&arg0[1], gSaveBlock2Ptr->playerName); + StringCopy(&arg0[1 + (PLAYER_NAME_LENGTH + 1)], gUnknown_02022C84->unk1A); +} + +static void sub_801EF7C(u8 *arg0) +{ + arg0[0] = 3; + StringCopy(&arg0[1], gSaveBlock2Ptr->playerName); + arg0[1 + (PLAYER_NAME_LENGTH + 1)] = gUnknown_02022C84->unk13; + sub_8011A50(); +} + +static void sub_801EFA8(u8 *arg0) +{ + arg0[0] = 4; + StringCopy(&arg0[1], gSaveBlock2Ptr->playerName); + arg0[1 + (PLAYER_NAME_LENGTH + 1)] = gUnknown_02022C84->unk13; +} + +static void sub_801EFD0(u8 *arg0) +{ + arg0[0] = 5; + StringCopy(&arg0[1], gSaveBlock2Ptr->playerName); + arg0[1 + (PLAYER_NAME_LENGTH + 1)] = gUnknown_02022C84->unk13; +} + +static bool32 sub_801EFF8(u8 *arg0, u8 *arg1) +{ + u8 *tempStr; + u8 var0 = *arg1; + u8 *str = arg1 + 1; + arg1 = str; + arg1 += 8; + + switch (var0) + { + case 2: + if (gUnknown_02022C84->unk13 != str[8]) + { + DynamicPlaceholderTextUtil_Reset(); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, str); + DynamicPlaceholderTextUtil_ExpandPlaceholders(arg0, gText_F700JoinedChat); + return TRUE; + } + break; + case 1: + tempStr = StringCopy(arg0, str); + *(tempStr++) = EXT_CTRL_CODE_BEGIN; + *(tempStr++) = EXT_CTRL_CODE_CLEAR_TO; + *(tempStr++) = 42; + *(tempStr++) = CHAR_COLON; + StringCopy(tempStr, arg1); + return TRUE; + case 5: + StringCopy(gUnknown_02022C84->unk79, str); + // fall through + case 3: + if (gUnknown_02022C84->unk13 != *arg1) + { + DynamicPlaceholderTextUtil_Reset(); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, str); + DynamicPlaceholderTextUtil_ExpandPlaceholders(arg0, gText_F700LeftChat); + return TRUE; + } + break; + } + + return FALSE; +} + +static u8 sub_801F0B0(void) +{ + return gUnknown_02022C84->unk10; +} + +static void sub_801F0BC(u8 *arg0, u8 *arg1) +{ + *arg0 = gUnknown_02022C84->unk11; + *arg1 = gUnknown_02022C84->unk12; +} + +static u8 *sub_801F0D0(void) +{ + return gUnknown_02022C84->unk1A; +} + +static int sub_801F0DC(void) +{ + u8 *str = sub_801F0D0(); + return StringLength_Multibyte(str); +} + +static void sub_801F0EC(u32 *arg0, u32 *arg1) +{ + int diff = gUnknown_02022C84->unk15 - gUnknown_02022C84->unk14; + if (diff < 0) + { + diff *= -1; + *arg0 = gUnknown_02022C84->unk15; + } + else + { + *arg0 = gUnknown_02022C84->unk14; + } + + *arg1 = diff; +} + +static u8 *sub_801F114(void) +{ + int i; + u16 numChars = sub_801EED8(); + u8 *str = gUnknown_02022C84->unk1A; + for (i = 0; i < numChars; i++) + { + if (*str == CHAR_SPECIAL_F9) + *str++; + + str++; + } + + return str; +} + +static u16 sub_801F144(void) +{ + u16 count; + u32 i; + u16 numChars = sub_801EED8(); + u8 *str = gUnknown_02022C84->unk1A; + for (count = 0, i = 0; i < numChars; count++, i++) + { + if (*str == CHAR_SPECIAL_F9) + str++; + + str++; + } + + return count; +} + +static u8 *sub_801F180(void) +{ + return gUnknown_02022C84->unk39; +} + +static u8 sub_801F18C(void) +{ + return gUnknown_02022C84->unk16; +} + +static int sub_801F198(void) +{ + return gUnknown_02022C84->unk15; +} + +static int sub_801F1A4(void) +{ + u8 *str = sub_801EEA8(); + u32 character = *str; + if (character > 0xFF || gUnknown_082F2AA8[character] == character || gUnknown_082F2AA8[character] == 0) + return 3; + else + return 0; +} + +static u8 *sub_801F1D0(void) +{ + return gUnknown_02022C84->unk79; +} + +void copy_strings_to_sav1(void) +{ + StringCopy(gSaveBlock1Ptr->unk3C88[0], gText_Hello); + StringCopy(gSaveBlock1Ptr->unk3C88[1], gText_Pokemon2); + StringCopy(gSaveBlock1Ptr->unk3C88[2], gText_Trade); + StringCopy(gSaveBlock1Ptr->unk3C88[3], gText_Battle); + StringCopy(gSaveBlock1Ptr->unk3C88[4], gText_Lets); + StringCopy(gSaveBlock1Ptr->unk3C88[5], gText_Ok); + StringCopy(gSaveBlock1Ptr->unk3C88[6], gText_Sorry); + StringCopy(gSaveBlock1Ptr->unk3C88[7], gText_YayUnkF9F9); + StringCopy(gSaveBlock1Ptr->unk3C88[8], gText_ThankYou); + StringCopy(gSaveBlock1Ptr->unk3C88[9], gText_ByeBye); +} + +static void sub_801F2B4(u8 taskId) +{ + u8 *buffer; + s16 *data = gTasks[taskId].data; + + switch (data[0]) + { + case 0: + if (!gReceivedRemoteLinkPlayers) + { + DestroyTask(taskId); + return; + } + + data[0] = 1; + // fall through + case 1: + data[4] = GetLinkPlayerCount(); + if (gUnknown_02022C84->unkD != data[4]) + { + data[0] = 2; + gUnknown_02022C84->unkD = data[4]; + return; + } + + data[3] = GetBlockReceivedStatus(); + if (!data[3] && sub_8011A9C()) + return; + + data[1] = 0; + data[0] = 3; + // fall through + case 3: + for (; data[1] < 5 && ((data[3] >> data[1]) & 1) == 0; data[1]++) + ; + + if (data[1] == 5) + { + data[0] = 1; + return; + } + + data[2] = data[1]; + ResetBlockReceivedFlag(data[2]); + buffer = (u8 *)gBlockRecvBuffer[data[1]]; + switch (buffer[0]) + { + default: + case 1: data[5] = 3; break; + case 2: data[5] = 3; break; + case 3: data[5] = 4; break; + case 4: data[5] = 5; break; + case 5: data[5] = 6; break; + } + + if (sub_801EFF8(gUnknown_02022C84->unk39, (u8 *)gBlockRecvBuffer[data[1]])) + { + gUnknown_02022C84->unk16 = data[1]; + sub_801F5EC(12, 2); + data[0] = 7; + } + else + { + data[0] = data[5]; + } + + data[1]++; + break; + case 7: + if (!sub_801F644(2)) + data[0] = data[5]; + break; + case 4: + if (!gUnknown_02022C84->unk13 && data[2]) + { + if (GetLinkPlayerCount() == 2) + { + sub_80104B0(); + gUnknown_02022C84->unk17 = 1; + DestroyTask(taskId); + return; + } + + sub_8011DE0(data[2]); + } + + data[0] = 3; + break; + case 5: + if (gUnknown_02022C84->unk13) + gUnknown_02022C84->unk17 = 2; + + DestroyTask(taskId); + break; + case 6: + gUnknown_02022C84->unk17 = 3; + DestroyTask(taskId); + break; + case 2: + if (!sub_8011A9C()) + { + if (!gUnknown_02022C84->unk13) + sub_80110B8(gUnknown_02022C84->unkD); + + data[0] = 1; + } + break; + } +} + +static bool8 sub_801F4D0(void) +{ + gUnknown_02022C88 = Alloc(sizeof(*gUnknown_02022C88)); + if (gUnknown_02022C88 && sub_8020890()) + { + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_082F2C60, ARRAY_COUNT(gUnknown_082F2C60)); + InitWindows(gUnknown_082F2C70); + reset_temp_tile_data_buffers(); + sub_8020770(); + sub_801F574(gUnknown_02022C88); + sub_801F580(); + sub_801F5EC(0, 0); + return TRUE; + } + else + { + return FALSE; + } +} + +static bool32 sub_801F534(void) +{ + return sub_801F644(0); +} + +static void sub_801F544(void) +{ + sub_80208D0(); + if (gUnknown_02022C88) + FREE_AND_SET_NULL(gUnknown_02022C88); + + FreeAllWindowBuffers(); + gScanlineEffect.state = 3; +} + +static void sub_801F574(struct UnionRoomChat2 *arg0) +{ + arg0->unk18 = 0xFF; + arg0->unk1E = 0xFF; + arg0->unk1A = 0; +} + +static void sub_801F580(void) +{ + int i; + + if (!gUnknown_02022C88) + return; + + for (i = 0; i < 3; i++) + { + gUnknown_02022C88->unk0[i].unk0 = sub_801FDD8; + gUnknown_02022C88->unk0[i].unk4 = 0; + gUnknown_02022C88->unk0[i].unk5 = 0; + } +} + +static void sub_801F5B8(void) +{ + int i; + + if (!gUnknown_02022C88) + return; + + for (i = 0; i < 3; i++) + { + gUnknown_02022C88->unk0[i].unk4 = + gUnknown_02022C88->unk0[i].unk0(&gUnknown_02022C88->unk0[i].unk5); + } +} + +static void sub_801F5EC(u16 arg0, u8 arg1) +{ + u32 i; + + gUnknown_02022C88->unk0[arg1].unk0 = sub_801FDD8; + for (i = 0; i < 21; i++) + { + if (gUnknown_082F2C98[i].unk0 == arg0) + { + gUnknown_02022C88->unk0[arg1].unk0 = gUnknown_082F2C98[i].unk4; + gUnknown_02022C88->unk0[arg1].unk4 = 1; + gUnknown_02022C88->unk0[arg1].unk5 = 0; + break; + } + } +} + +static bool8 sub_801F644(u8 arg0) +{ + return gUnknown_02022C88->unk0[arg0].unk4; +} + +bool32 sub_801F658(u8 *state) +{ + if (free_temp_tile_data_buffers_if_possible() == TRUE) + return TRUE; + + switch (*state) + { + case 0: + sub_8020480(); + sub_8020538(); + break; + case 1: + sub_8020584(); + break; + case 2: + sub_80205B4(); + break; + case 3: + sub_8020604(); + break; + case 4: + sub_8020680(); + break; + case 5: + sub_80206A4(); + sub_80206D0(); + sub_8020740(); + sub_80206E8(); + break; + case 6: + if (!IsDma3ManagerBusyWithBgCopy()) + { + sub_80208E8(); + sub_8020A68(); + sub_8020B20(); + } + break; + default: + return FALSE; + } + + (*state)++; + return TRUE; +} + +bool32 sub_801F6F8(u8 *state) +{ + switch (*state) + { + case 0: + sub_80203B0(); + CopyWindowToVram(3, 3); + break; + case 1: + return IsDma3ManagerBusyWithBgCopy(); + } + + (*state)++; + return TRUE; +} + +bool32 sub_801F730(u8 *state) +{ + switch (*state) + { + case 0: + sub_802040C(); + CopyWindowToVram(3, 3); + break; + case 1: + return IsDma3ManagerBusyWithBgCopy(); + } + + (*state)++; + return TRUE; +} + +bool32 sub_801F768(u8 *state) +{ + switch (*state) + { + case 0: + sub_802091C(TRUE); + if (sub_8020320()) + return TRUE; + + sub_80201A4(); + CopyWindowToVram(2, 2); + break; + case 1: + if (IsDma3ManagerBusyWithBgCopy()) + return TRUE; + break; + case 2: + if (sub_8020368()) + return TRUE; + + sub_802093C(); + sub_802091C(FALSE); + sub_8020B80(); + return FALSE; + } + + (*state)++; + return TRUE; +} + +bool32 sub_801F7D4(u8 *state) +{ + sub_802093C(); + return FALSE; +} + +bool32 sub_801F7E0(u8 *state) +{ + switch (*state) + { + case 0: + sub_801FF18(0, 0); + sub_801FDDC(23, 11, 1); + CopyWindowToVram(gUnknown_02022C88->unk1E, 3); + break; + case 1: + return IsDma3ManagerBusyWithBgCopy(); + } + + (*state)++; + return TRUE; +} + +bool32 sub_801F82C(u8 *state) +{ + switch (*state) + { + case 0: + sub_8020094(); + sub_801FEBC(); + CopyBgTilemapBufferToVram(0); + break; + case 1: + if (IsDma3ManagerBusyWithBgCopy()) + return TRUE; + + sub_80200C8(); + sub_801FEE4(); + return FALSE; + } + + (*state)++; + return TRUE; +} + +bool32 sub_801F870(u8 *state) +{ + u32 var0, var1; + u8 *str; + + switch (*state) + { + case 0: + sub_801F0EC(&var0, &var1); + sub_80200EC(var0, var1, 0); + str = sub_801F0D0(); + sub_8020118(0, str, 3, 1, 2); + CopyWindowToVram(1, 2); + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + { + sub_8020B80(); + return FALSE; + } + return TRUE; + } + + (*state)++; + return TRUE; +} + +bool32 sub_801F8DC(u8 *state) +{ + u16 var0; + u8 *str; + u16 length; + + switch (*state) + { + case 0: + var0 = sub_801F144(); + str = sub_801F114(); + length = StringLength_Multibyte(str); + sub_80200EC(var0, length, PIXEL_FILL(6)); + sub_8020118(var0, str, 0, 4, 5); + CopyWindowToVram(1, 2); + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + { + sub_801FF18(1, 16); + CopyWindowToVram(gUnknown_02022C88->unk1E, 3); + } + else + { + return TRUE; + } + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + sub_80209AC(1); + else + return TRUE; + break; + case 3: + return FALSE; + } + + (*state)++; + return TRUE; +} + +bool32 sub_801F984(u8 *state) +{ + u16 var0; + u8 *str; + u16 length; + + switch (*state) + { + case 0: + var0 = sub_801F144(); + str = sub_801F114(); + length = StringLength_Multibyte(str); + sub_80200EC(var0, length, PIXEL_FILL(0)); + sub_8020118(var0, str, 3, 1, 2); + CopyWindowToVram(1, 2); + break; + case 1: + if (!IsDma3ManagerBusyWithBgCopy()) + { + sub_8020094(); + CopyWindowToVram(gUnknown_02022C88->unk1E, 3); + } + else + { + return TRUE; + } + break; + case 2: + if (!IsDma3ManagerBusyWithBgCopy()) + { + sub_80209AC(0); + sub_80200C8(); + } + else + { + return TRUE; + } + break; + case 3: + return FALSE; + } + + (*state)++; + return TRUE; +} + +bool32 sub_801FA2C(u8 *state) +{ + switch (*state) + { + case 0: + sub_80201A4(); + CopyWindowToVram(2, 2); + (*state)++; + break; + case 1: + if (IsDma3ManagerBusyWithBgCopy()) + return TRUE; + else + return FALSE; + } + + return TRUE; +} + +bool32 sub_801FA68(u8 *state) +{ + u16 var0; + u8 *str; + u8 var1; + + switch (*state) + { + case 0: + var0 = gUnknown_02022C88->unk1A; + str = sub_801F180(); + var1 = sub_801F18C(); + sub_8020420(var0, str, var1); + CopyWindowToVram(0, 2); + break; + case 1: + if (IsDma3ManagerBusyWithBgCopy()) + return TRUE; + + if (gUnknown_02022C88->unk1A < 9) + { + gUnknown_02022C88->unk1A++; + *state = 4; + return FALSE; + } + else + { + gUnknown_02022C88->unk1C = 0; + (*state)++; + } + // fall through + case 2: + ScrollWindow(0, 0, 5, PIXEL_FILL(1)); + CopyWindowToVram(0, 2); + gUnknown_02022C88->unk1C++; + (*state)++; + // fall through + case 3: + if (IsDma3ManagerBusyWithBgCopy()) + return TRUE; + + if (gUnknown_02022C88->unk1C < 3) + { + (*state)--; + return TRUE; + } + break; + case 4: + return FALSE; + default: + return TRUE; + } + + (*state)++; + return TRUE; +} + +bool32 sub_801FB44(u8 *state) +{ + switch (*state) + { + case 0: + sub_80209E0(); + (*state)++; + break; + case 1: + return sub_8020A1C(); + } + + return TRUE; +} + +bool32 sub_801FB70(u8 *state) +{ + switch (*state) + { + case 0: + sub_801FF18(3, 16); + CopyWindowToVram(gUnknown_02022C88->unk1E, 3); + (*state)++; + break; + case 1: + return IsDma3ManagerBusyWithBgCopy(); + } + + return TRUE; +} + +bool32 sub_801FBB4(u8 *state) +{ + switch (*state) + { + case 0: + sub_801FF18(4, 0); + CopyWindowToVram(gUnknown_02022C88->unk1E, 3); + (*state)++; + break; + case 1: + return IsDma3ManagerBusyWithBgCopy(); + } + + return TRUE; +} + +bool32 sub_801FBF8(u8 *state) +{ + u8 *str; + + switch (*state) + { + case 0: + DynamicPlaceholderTextUtil_Reset(); + str = sub_801F1D0(); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, str); + sub_801FF18(5, 0); + CopyWindowToVram(gUnknown_02022C88->unk1E, 3); + (*state)++; + break; + case 1: + return IsDma3ManagerBusyWithBgCopy(); + } + + return TRUE; +} + +bool32 sub_801FC4C(u8 *state) +{ + switch (*state) + { + case 0: + sub_801FF18(6, 0); + sub_801FDDC(23, 10, 1); + CopyWindowToVram(gUnknown_02022C88->unk1E, 3); + (*state)++; + break; + case 1: + return IsDma3ManagerBusyWithBgCopy(); + } + + return TRUE; +} + +bool32 sub_801FC9C(u8 *state) +{ + switch (*state) + { + case 0: + sub_801FF18(7, 0); + sub_801FDDC(23, 10, 1); + CopyWindowToVram(gUnknown_02022C88->unk1E, 3); + (*state)++; + break; + case 1: + return IsDma3ManagerBusyWithBgCopy(); + } + + return TRUE; +} + +bool32 sub_801FCEC(u8 *state) +{ + switch (*state) + { + case 0: + sub_801FF18(8, 0); + CopyWindowToVram(gUnknown_02022C88->unk1E, 3); + (*state)++; + break; + case 1: + return IsDma3ManagerBusyWithBgCopy(); + } + + return TRUE; +} + +bool32 sub_801FD30(u8 *state) +{ + switch (*state) + { + case 0: + DynamicPlaceholderTextUtil_Reset(); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gSaveBlock2Ptr->playerName); + sub_801FF18(9, 0); + CopyWindowToVram(gUnknown_02022C88->unk1E, 3); + (*state)++; + break; + case 1: + return IsDma3ManagerBusyWithBgCopy(); + } + + return TRUE; +} + +bool32 sub_801FD88(u8 *state) +{ + switch (*state) + { + case 0: + sub_801FF18(10, 0); + sub_801FDDC(23, 10, 1); + CopyWindowToVram(gUnknown_02022C88->unk1E, 3); + (*state)++; + break; + case 1: + return IsDma3ManagerBusyWithBgCopy(); + } + + return TRUE; +} + +static bool32 sub_801FDD8(u8 *arg0) +{ + return FALSE; +} + +static void sub_801FDDC(u8 left, u8 top, u8 initialCursorPos) +{ + struct WindowTemplate template; + template.bg = 0; + template.tilemapLeft = left; + template.tilemapTop = top; + template.width = 6; + template.height = 4; + template.paletteNum = 14; + template.baseBlock = 0x52; + gUnknown_02022C88->unk18 = AddWindow(&template); + if (gUnknown_02022C88->unk18 != 0xFF) + { + FillWindowPixelBuffer(gUnknown_02022C88->unk18, PIXEL_FILL(1)); + PutWindowTilemap(gUnknown_02022C88->unk18); + AddTextPrinterParameterized(gUnknown_02022C88->unk18, 1, gText_Yes, 8, 1, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(gUnknown_02022C88->unk18, 1, gText_No, 8, 17, TEXT_SPEED_FF, NULL); + sub_8098858(gUnknown_02022C88->unk18, 1, 13); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(gUnknown_02022C88->unk18, 2, initialCursorPos); + } +} + +static void sub_801FEBC(void) +{ + if (gUnknown_02022C88->unk18 != 0xFF) + { + ClearStdWindowAndFrameToTransparent(gUnknown_02022C88->unk18, FALSE); + ClearWindowTilemap(gUnknown_02022C88->unk18); + } +} + +static void sub_801FEE4(void) +{ + if (gUnknown_02022C88->unk18 != 0xFF) + { + RemoveWindow(gUnknown_02022C88->unk18); + gUnknown_02022C88->unk18 = 0xFF; + } +} + +static s8 sub_801FF08(void) +{ + return Menu_ProcessInput(); +} + +static void sub_801FF18(int arg0, u16 arg1) +{ + const u8 *str; + int windowId; + struct WindowTemplate template; + template.bg = 0; + template.tilemapLeft = 8; + template.tilemapTop = 16; + template.width = 21; + template.height = 4; + template.paletteNum = 14; + template.baseBlock = 0x6A; + if (gUnknown_082F2D40[arg0].unkA) + { + template.tilemapLeft -= 7; + template.width += 7; + } + + gUnknown_02022C88->unk1E = AddWindow(&template); + windowId = gUnknown_02022C88->unk1E; + if (gUnknown_02022C88->unk1E == 0xFF) + return; + + if (gUnknown_082F2D40[arg0].unk9) + { + DynamicPlaceholderTextUtil_ExpandPlaceholders(gUnknown_02022C88->unk22, gUnknown_082F2D40[arg0].unk0); + str = gUnknown_02022C88->unk22; + } + else + { + str = gUnknown_082F2D40[arg0].unk0; + } + + ChangeBgY(0, arg1 * 256, 0); + FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); + PutWindowTilemap(windowId); + if (gUnknown_082F2D40[arg0].unk4 == 1) + { + sub_80989E0(windowId, 0xA, 2); + AddTextPrinterParameterized5( + windowId, + 1, + str, + gUnknown_082F2D40[arg0].unk5 + 8, + gUnknown_082F2D40[arg0].unk6 + 8, + TEXT_SPEED_FF, + NULL, + gUnknown_082F2D40[arg0].unk7, + gUnknown_082F2D40[arg0].unk8); + } + else + { + sub_8098858(windowId, 0xA, 2); + AddTextPrinterParameterized5( + windowId, + 1, + str, + gUnknown_082F2D40[arg0].unk5, + gUnknown_082F2D40[arg0].unk6, + TEXT_SPEED_FF, + NULL, + gUnknown_082F2D40[arg0].unk7, + gUnknown_082F2D40[arg0].unk8); + } + + gUnknown_02022C88->unk1E = windowId; +} + +static void sub_8020094(void) +{ + if (gUnknown_02022C88->unk1E != 0xFF) + { + ClearStdWindowAndFrameToTransparent(gUnknown_02022C88->unk1E, FALSE); + ClearWindowTilemap(gUnknown_02022C88->unk1E); + } + + ChangeBgY(0, 0, 0); +} + +static void sub_80200C8(void) +{ + if (gUnknown_02022C88->unk1E != 0xFF) + { + RemoveWindow(gUnknown_02022C88->unk1E); + gUnknown_02022C88->unk1E = 0xFF; + } +} + +static void sub_80200EC(u16 x, u16 width, u8 fillValue) +{ + FillWindowPixelRect(1, fillValue, x * 8, 1, width * 8, 14); +} + +static void sub_8020118(u16 x, u8 *str, u8 fillValue, u8 arg3, u8 arg4) +{ + u8 *str2; + u8 sp[38]; + if (fillValue) + sub_80200EC(x, sub_801F198() - x, fillValue); + + sp[0] = fillValue; + sp[1] = arg3; + sp[2] = arg4; + str2 = &sp[4]; + str2[0] = EXT_CTRL_CODE_BEGIN; + str2[1] = EXT_CTRL_CODE_MIN_LETTER_SPACING; + str2[2] = 8; + StringCopy(&str2[3], str); + AddTextPrinterParameterized3(1, 2, x * 8, 1, sp, TEXT_SPEED_FF, str2); +} + +static void sub_80201A4(void) +{ + u8 var0; + int i; + int var1; + u16 left; + u16 top; + u8 sp[52]; + u8 *str; + u8 *str2; + + FillWindowPixelBuffer(2, PIXEL_FILL(15)); + var0 = sub_801F0B0(); + sp[0] = 0; + sp[1] = 14; + sp[2] = 13; + if (var0 != 3) + { + str = &sp[4]; + str[0] = EXT_CTRL_CODE_BEGIN; + str[1] = EXT_CTRL_CODE_MIN_LETTER_SPACING; + var1 = 8; + str[2] = var1; + left = var1; + if (var0 == 2) + left = 6; + + for (i = 0, top = 0; i < 10; i++, top += 12) + { + if (!gUnknown_082F2BA8[var0][i]) + return; + + StringCopy(&sp[7], gUnknown_082F2BA8[var0][i]); + AddTextPrinterParameterized3(2, 0, left, top, sp, TEXT_SPEED_FF, &sp[4]); + } + } + else + { + left = 4; + for (i = 0, top = 0; i < 10; i++, top += 12) + { + str2 = sub_801EE6C(i); + if (GetStringWidth(0, str2, 0) <= 40) + { + AddTextPrinterParameterized3(2, 0, left, top, sp, TEXT_SPEED_FF, str2); + } + else + { + int length = StringLength_Multibyte(str2); + do + { + length--; + StringCopyN_Multibyte(&sp[4], str2, length); + } while (GetStringWidth(0, &sp[4], 0) > 35); + + AddTextPrinterParameterized3(2, 0, left, top, sp, TEXT_SPEED_FF, &sp[4]); + AddTextPrinterParameterized3(2, 0, left + 35, top, sp, TEXT_SPEED_FF, gText_Ellipsis); + } + } + } +} + +static bool32 sub_8020320(void) +{ + if (gUnknown_02022C88->unk20 < 56) + { + gUnknown_02022C88->unk20 += 12; + if (gUnknown_02022C88->unk20 >= 56) + gUnknown_02022C88->unk20 = 56; + + if (gUnknown_02022C88->unk20 < 56) + { + sub_80207C0(gUnknown_02022C88->unk20); + return TRUE; + } + } + + sub_8020818(gUnknown_02022C88->unk20); + return FALSE; +} + +static bool32 sub_8020368(void) +{ + if (gUnknown_02022C88->unk20 > 0) + { + gUnknown_02022C88->unk20 -= 12; + if (gUnknown_02022C88->unk20 <= 0) + gUnknown_02022C88->unk20 = 0; + + if (gUnknown_02022C88->unk20 > 0) + { + sub_80207C0(gUnknown_02022C88->unk20); + return TRUE; + } + } + + sub_8020818(gUnknown_02022C88->unk20); + return FALSE; +} + +static void sub_80203B0(void) +{ + FillWindowPixelBuffer(3, PIXEL_FILL(1)); + sub_8098858(3, 1, 13); + PrintTextArray(3, 2, 8, 1, 14, 5, gUnknown_082F2DC8); + sub_81983AC(3, 2, 0, 1, 14, 5, sub_801F0B0()); + PutWindowTilemap(3); +} + +static void sub_802040C(void) +{ + ClearStdWindowAndFrameToTransparent(3, FALSE); + ClearWindowTilemap(3); +} + +static void sub_8020420(u16 row, u8 *str, u8 arg2) +{ + u8 color[3]; + color[0] = 1; + color[1] = arg2 * 2 + 2; + color[2] = arg2 * 2 + 3; + FillWindowPixelRect(0, PIXEL_FILL(1), 0, row * 15, 168, 15); + AddTextPrinterParameterized3(0, 2, 0, row * 15 + 1, color, TEXT_SPEED_FF, str); +} + +static void sub_8020480(void) +{ + 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); + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON | DISPCNT_OBJWIN_ON); + SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(64, 240)); + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(0, 144)); + SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG0 | WININ_WIN0_BG2 | WININ_WIN0_BG3 + | WININ_WIN0_OBJ | WININ_WIN0_CLR); + SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR); +} + +static void sub_8020538(void) +{ + SetBgTilemapBuffer(0, gUnknown_02022C88->unk128); + SetBgTilemapBuffer(1, gUnknown_02022C88->unk928); + SetBgTilemapBuffer(3, gUnknown_02022C88->unk1128); + SetBgTilemapBuffer(2, gUnknown_02022C88->unk1928); +} + +static void sub_8020584(void) +{ + RequestDma3Fill(0, (void *)BG_CHAR_ADDR(0), 0x20, 1); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32); + CopyBgTilemapBufferToVram(0); +} + +static void sub_80205B4(void) +{ + LoadPalette(gUnknown_08DD4BD0, 0x70, 0x20); + LoadPalette(gUnknown_08DD4BB0, 0xC0, 0x20); + decompress_and_copy_tile_data_to_vram(1, gUnknown_08DD4BF0, 0, 0, 0); + CopyToBgTilemapBuffer(1, gUnknown_08DD4C4C, 0, 0); + CopyBgTilemapBufferToVram(1); +} + +static void sub_8020604(void) +{ + u8 *ptr; + + LoadPalette(gLinkMiscMenu_Pal, 0, 0x20); + ptr = decompress_and_copy_tile_data_to_vram(2, gLinkMiscMenu_Gfx, 0, 0, 0); + if (ptr) + { + CpuFastCopy(&ptr[0x220], gUnknown_02022C88->unk2128, 0x20); + CpuFastCopy(&ptr[0x420], gUnknown_02022C88->unk2148, 0x20); + } + + CopyToBgTilemapBuffer(2, gLinkMiscMenu_Tilemap, 0, 0); + CopyBgTilemapBufferToVram(2); +} + +static void sub_8020680(void) +{ + LoadPalette(gUnknown_082F2C20, 0x80, 0x20); + RequestDma3Fill(0, (void *)BG_CHAR_ADDR(1) + 0x20, 0x20, 1); +} + +static void sub_80206A4(void) +{ + LoadPalette(gUnknown_082F2C40, 0xF0, 0x20); + PutWindowTilemap(0); + FillWindowPixelBuffer(0, PIXEL_FILL(1)); + CopyWindowToVram(0, 3); +} + +static void sub_80206D0(void) +{ + PutWindowTilemap(2); + sub_80201A4(); + CopyWindowToVram(2, 3); +} + +static void sub_80206E8(void) +{ + int i; + u8 var0[2]; + var0[0] = 0; + var0[1] = 0xFF; + + for (i = 0; i < 15; i++) + BlitBitmapToWindow(1, gUnknown_02022C88->unk2128, i * 8, 0, 8, 16); + + FillWindowPixelBuffer(1, PIXEL_FILL(0)); + PutWindowTilemap(1); + CopyWindowToVram(1, 3); +} + +static void sub_8020740(void) +{ + FillWindowPixelBuffer(3, PIXEL_FILL(1)); + LoadUserWindowBorderGfx(3, 1, 0xD0); + LoadUserWindowBorderGfx_(3, 0xA, 0x20); + LoadPalette(gUnknown_0860F074, 0xE0, 0x20); +} + +static void sub_8020770(void) +{ + struct ScanlineEffectParams params; + params.dmaControl = SCANLINE_EFFECT_DMACNT_16BIT; + params.dmaDest = ®_BG1HOFS; + params.initState = 1; + params.unused9 = 0; + gUnknown_02022C88->unk20 = 0; + CpuFastFill(0, gScanlineEffectRegBuffers, sizeof(gScanlineEffectRegBuffers)); + ScanlineEffect_SetParams(params); +} + +static void sub_80207C0(s16 arg0) +{ + CpuFill16(arg0, gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer], 0x120); + CpuFill16(0, gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer] + 0x90, 0x20); +} + +static void sub_8020818(s16 arg0) +{ + CpuFill16(arg0, gScanlineEffectRegBuffers[0], 0x120); + CpuFill16(0, gScanlineEffectRegBuffers[0] + 0x90, 0x20); + CpuFill16(arg0, gScanlineEffectRegBuffers[0] + 0x3C0, 0x120); + CpuFill16(0, gScanlineEffectRegBuffers[0] + 0x450, 0x20); +} + +static bool32 sub_8020890(void) +{ + u32 i; + for (i = 0; i < 5; i++) + LoadCompressedSpriteSheet(&gUnknown_082F3134[i]); + + LoadSpritePalette(&gUnknown_082F315C); + gUnknown_02022C8C = Alloc(0x18); + if (!gUnknown_02022C8C) + return FALSE; + + return TRUE; +} + +static void sub_80208D0(void) +{ + if (gUnknown_02022C8C) + Free(gUnknown_02022C8C); +} + +static void sub_80208E8(void) +{ + u8 spriteId = CreateSprite(&gUnknown_082F319C, 10, 24, 0); + gUnknown_02022C8C->unk0 = &gSprites[spriteId]; +} + +static void sub_802091C(bool32 invisible) +{ + gUnknown_02022C8C->unk0->invisible = invisible; +} + +static void sub_802093C(void) +{ + u8 x, y; + u8 var2 = sub_801F0B0(); + sub_801F0BC(&x, &y); + if (var2 != 3) + { + StartSpriteAnim(gUnknown_02022C8C->unk0, 0); + gUnknown_02022C8C->unk0->pos1.x = x * 8 + 10; + gUnknown_02022C8C->unk0->pos1.y = y * 12 + 24; + } + else + { + StartSpriteAnim(gUnknown_02022C8C->unk0, 2); + gUnknown_02022C8C->unk0->pos1.x = 24; + gUnknown_02022C8C->unk0->pos1.y = y * 12 + 24; + } +} + +static void sub_80209AC(int arg0) +{ + const u16 *palette = &gUnknown_082F2DF0[arg0 * 2 + 1]; + u8 index = IndexOfSpritePaletteTag(0); + LoadPalette(palette, index * 16 + 0x101, 4); +} + +static void sub_80209E0(void) +{ + if (sub_801F0B0() != 3) + StartSpriteAnim(gUnknown_02022C8C->unk0, 1); + else + StartSpriteAnim(gUnknown_02022C8C->unk0, 3); + + gUnknown_02022C8C->unk14 = 0; +} + +static bool32 sub_8020A1C(void) +{ + if (gUnknown_02022C8C->unk14 > 3) + return FALSE; + + if (++gUnknown_02022C8C->unk14 > 3) + { + if (sub_801F0B0() != 3) + StartSpriteAnim(gUnknown_02022C8C->unk0, 0); + else + StartSpriteAnim(gUnknown_02022C8C->unk0, 2); + + return FALSE; + } + + return TRUE; +} + +static void sub_8020A68(void) +{ + u8 spriteId = CreateSprite(&gUnknown_082F31BC, 76, 152, 2); + gUnknown_02022C8C->unk8 = &gSprites[spriteId]; + spriteId = CreateSprite(&gUnknown_082F31D4, 64, 152, 1); + gUnknown_02022C8C->unk4 = &gSprites[spriteId]; +} + +void sub_8020ABC(struct Sprite *sprite) +{ + int var0 = sub_801F198(); + if (var0 == 15) + { + sprite->invisible = 1; + } + else + { + sprite->invisible = 0; + sprite->pos1.x = var0 * 8 + 76; + } +} + +void sub_8020AF4(struct Sprite *sprite) +{ + if (++sprite->data[0] > 4) + { + sprite->data[0] = 0; + if (++sprite->pos2.x > 4) + sprite->pos2.x = 0; + } +} + +static void sub_8020B20(void) +{ + u8 spriteId = CreateSprite(&gUnknown_082F322C, 8, 152, 3); + gUnknown_02022C8C->unkC = &gSprites[spriteId]; + spriteId = CreateSprite(&gUnknown_082F3244, 32, 152, 4); + gUnknown_02022C8C->unk10 = &gSprites[spriteId]; + gUnknown_02022C8C->unk10->invisible = 1; +} + +static void sub_8020B80(void) +{ + if (sub_801F0B0() == 3) + { + if (sub_801F0DC() != 0) + { + gUnknown_02022C8C->unk10->invisible = 0; + StartSpriteAnim(gUnknown_02022C8C->unk10, 3); + } + else + { + gUnknown_02022C8C->unk10->invisible = 1; + } + } + else + { + int anim = sub_801F1A4(); + if (anim == 3) + { + gUnknown_02022C8C->unk10->invisible = 1; + } + else + { + gUnknown_02022C8C->unk10->invisible = 0; + StartSpriteAnim(gUnknown_02022C8C->unk10, anim); + } + } + +}