diff --git a/asm/easy_chat.s b/asm/easy_chat.s index caf096f09..50e707ac3 100644 --- a/asm/easy_chat.s +++ b/asm/easy_chat.s @@ -5,1544 +5,6 @@ .text - thumb_func_start sub_811CE94 -sub_811CE94: @ 811CE94 - push {r4,lr} - ldr r4, =gUnknown_0203A11C - movs r0, 0x98 - lsls r0, 5 - bl Alloc - adds r2, r0, 0 - str r2, [r4] - cmp r2, 0 - beq _0811CEFC - movs r1, 0 - strh r1, [r2] - movs r3, 0xB6 - lsls r3, 2 - adds r0, r2, r3 - str r1, [r0] - adds r3, 0x4 - adds r0, r2, r3 - str r1, [r0] - adds r3, 0x4 - adds r0, r2, r3 - str r1, [r0] - adds r3, 0x4 - adds r0, r2, r3 - str r1, [r0] - adds r3, 0x4 - adds r0, r2, r3 - str r1, [r0] - adds r3, 0x4 - adds r0, r2, r3 - str r1, [r0] - adds r3, 0x4 - adds r0, r2, r3 - str r1, [r0] - adds r3, 0x4 - adds r0, r2, r3 - str r1, [r0] - adds r3, 0x4 - adds r0, r2, r3 - str r1, [r0] - adds r3, 0x4 - adds r0, r2, r3 - str r1, [r0] - bl sub_811BC70 - ldr r1, [r4] - strb r0, [r1, 0xA] - movs r0, 0x1 - b _0811CEFE - .pool -_0811CEFC: - movs r0, 0 -_0811CEFE: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_811CE94 - - thumb_func_start sub_811CF04 -sub_811CF04: @ 811CF04 - push {lr} - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x3 - 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, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r1, 0xC1 - lsls r1, 6 - movs r0, 0 - bl SetGpuReg - pop {r0} - bx r0 - thumb_func_end sub_811CF04 - - thumb_func_start sub_811CF64 -sub_811CF64: @ 811CF64 - push {r4,lr} - bl ResetPaletteFade - ldr r0, =gEasyChatMode_Pal - movs r1, 0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_08597B14 - movs r1, 0x10 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_08597B34 - movs r1, 0x40 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_08597C1C - movs r1, 0xA0 - movs r2, 0x8 - bl LoadPalette - ldr r4, =gUnknown_08597C24 - adds r0, r4, 0 - movs r1, 0xB0 - movs r2, 0xC - bl LoadPalette - adds r0, r4, 0 - movs r1, 0xF0 - movs r2, 0xC - bl LoadPalette - adds r0, r4, 0 - movs r1, 0x30 - movs r2, 0xC - bl LoadPalette - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_811CF64 - - thumb_func_start sub_811CFCC -sub_811CFCC: @ 811CFCC - push {r4,r5,lr} - sub sp, 0x14 - bl sub_811BA88 - adds r5, r0, 0 - cmp r5, 0 - beq _0811D020 - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x90 - bl GetStringCenterAlignXOffset - adds r4, r0, 0 - movs r0, 0 - movs r1, 0 - bl FillWindowPixelBuffer - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x1 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r0, 0x2 - str r0, [sp, 0xC] - movs r0, 0x3 - str r0, [sp, 0x10] - movs r0, 0 - movs r1, 0x1 - adds r2, r5, 0 - adds r3, r4, 0 - bl sub_811D058 - movs r0, 0 - bl PutWindowTilemap - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram -_0811D020: - add sp, 0x14 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_811CFCC - - thumb_func_start sub_811D028 -sub_811D028: @ 811D028 - push {r4-r6,lr} - sub sp, 0xC - ldr r4, [sp, 0x1C] - ldr r5, [sp, 0x20] - ldr r6, [sp, 0x24] - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - lsls r3, 24 - lsrs r3, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - str r4, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - bl AddTextPrinterParameterized - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_811D028 - - thumb_func_start sub_811D058 -sub_811D058: @ 811D058 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - mov r9, r3 - ldr r3, [sp, 0x30] - ldr r4, [sp, 0x34] - mov r8, r4 - ldr r7, [sp, 0x38] - mov r10, r7 - ldr r5, [sp, 0x3C] - ldr r6, [sp, 0x40] - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r4, r9 - lsls r4, 24 - lsrs r4, 24 - mov r9, r4 - lsls r3, 24 - lsrs r3, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - lsrs r6, 24 - add r4, sp, 0xC - mov r7, r10 - strb r7, [r4] - strb r5, [r4, 0x1] - strb r6, [r4, 0x2] - str r4, [sp] - mov r4, r8 - lsls r4, 24 - asrs r4, 24 - str r4, [sp, 0x4] - str r2, [sp, 0x8] - mov r2, r9 - bl AddTextPrinterParameterized3 - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_811D058 - - thumb_func_start sub_811D0BC -sub_811D0BC: @ 811D0BC - push {lr} - sub sp, 0xC - movs r0, 0x20 - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0xE0 - bl LoadUserWindowBorderGfx - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0xE - bl sub_8098858 - movs r0, 0 - bl sub_811D104 - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0xC - pop {r0} - bx r0 - thumb_func_end sub_811D0BC - - thumb_func_start sub_811D104 -sub_811D104: @ 811D104 - push {lr} - sub sp, 0x14 - lsls r0, 24 - lsrs r1, r0, 24 - movs r0, 0 - str r0, [sp, 0x10] - str r0, [sp, 0xC] - cmp r1, 0x9 - bhi _0811D1BC - lsls r0, r1, 2 - ldr r1, =_0811D124 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0811D124: - .4byte _0811D14C - .4byte _0811D16A - .4byte _0811D156 - .4byte _0811D160 - .4byte _0811D174 - .4byte _0811D180 - .4byte _0811D18C - .4byte _0811D19C - .4byte _0811D1A8 - .4byte _0811D1B4 -_0811D14C: - add r1, sp, 0x10 - add r0, sp, 0xC - bl sub_811BAD0 - b _0811D1BC -_0811D156: - add r1, sp, 0x10 - add r0, sp, 0xC - bl sub_811BB40 - b _0811D1BC -_0811D160: - add r1, sp, 0x10 - add r0, sp, 0xC - bl sub_811BB08 - b _0811D1BC -_0811D16A: - add r1, sp, 0x10 - add r0, sp, 0xC - bl sub_811BB88 - b _0811D1BC -_0811D174: - ldr r0, =gText_CreateAQuiz - str r0, [sp, 0xC] - b _0811D1BC - .pool -_0811D180: - ldr r0, =gText_SelectTheAnswer - str r0, [sp, 0xC] - b _0811D1BC - .pool -_0811D18C: - ldr r0, =gText_OnlyOnePhrase - str r0, [sp, 0xC] - ldr r0, =gText_OriginalSongWillBeUsed - b _0811D1BA - .pool -_0811D19C: - ldr r0, =gText_LyricsCantBeDeleted - str r0, [sp, 0xC] - b _0811D1BC - .pool -_0811D1A8: - ldr r0, =gText_CombineTwoWordsOrPhrases3 - str r0, [sp, 0xC] - b _0811D1BC - .pool -_0811D1B4: - ldr r0, =gText_YouCannotQuitHere - str r0, [sp, 0xC] - ldr r0, =gText_SectionMustBeCompleted -_0811D1BA: - str r0, [sp, 0x10] -_0811D1BC: - movs r0, 0x1 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r2, [sp, 0xC] - cmp r2, 0 - beq _0811D1E0 - movs r0, 0x1 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r3, 0 - bl sub_811D028 -_0811D1E0: - ldr r2, [sp, 0x10] - cmp r2, 0 - beq _0811D1FC - movs r0, 0x11 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r3, 0 - bl sub_811D028 -_0811D1FC: - movs r0, 0x1 - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0x14 - pop {r0} - bx r0 - .pool - thumb_func_end sub_811D104 - - thumb_func_start sub_811D214 -sub_811D214: @ 811D214 - push {lr} - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =gUnknown_08597C84 - movs r1, 0x1 - movs r2, 0xE - bl CreateYesNoMenu - pop {r0} - bx r0 - .pool - thumb_func_end sub_811D214 - - thumb_func_start sub_811D230 -sub_811D230: @ 811D230 - push {r4-r6,lr} - sub sp, 0x8 - bl sub_811BA68 - lsls r0, 24 - ldr r6, =0xffffff00 - ldr r4, [sp] - ands r4, r6 - movs r1, 0x3 - orrs r4, r1 - str r4, [sp] - ldr r1, =gUnknown_08597C30 - lsrs r0, 22 - adds r0, r1 - ldrb r3, [r0] - lsls r1, r3, 27 - lsrs r1, 19 - ldr r5, =0xffff00ff - adds r2, r5, 0 - ands r2, r4 - orrs r2, r1 - lsrs r3, 5 - lsls r3, 16 - ldr r1, =0xff00ffff - ands r2, r1 - orrs r2, r3 - str r2, [sp] - ldrb r3, [r0, 0x1] - lsls r3, 24 - ldr r1, =0x00ffffff - ands r1, r2 - orrs r1, r3 - str r1, [sp] - ldrb r1, [r0, 0x2] - ldr r0, [sp, 0x4] - ands r0, r6 - orrs r0, r1 - ands r0, r5 - movs r1, 0xB0 - lsls r1, 4 - orrs r0, r1 - ldr r1, =0x0000ffff - ands r0, r1 - movs r1, 0xD8 - lsls r1, 15 - orrs r0, r1 - str r0, [sp, 0x4] - mov r0, sp - bl AddWindow - ldr r1, =gUnknown_0203A11C - ldr r1, [r1] - strh r0, [r1, 0x2] - lsls r0, 24 - lsrs r0, 24 - bl PutWindowTilemap - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_811D230 - - thumb_func_start sub_811D2C8 -sub_811D2C8: @ 811D2C8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - bl sub_811BA94 - adds r4, r0, 0 - bl sub_811BAAC - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x10] - bl sub_811BAA0 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x14] - bl sub_811BA68 - lsls r0, 24 - lsrs r6, r0, 24 - movs r0, 0 - mov r8, r0 - cmp r6, 0x7 - bne _0811D302 - movs r1, 0x1 - mov r8, r1 -_0811D302: - ldr r0, =gUnknown_0203A11C - ldr r0, [r0] - ldrb r0, [r0, 0x2] - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r7, 0 - ldr r0, [sp, 0x14] - cmp r7, r0 - bge _0811D402 -_0811D316: - add r0, sp, 0xC - ldr r1, =gUnknown_08597C8C - movs r2, 0x4 - bl memcpy - mov r1, r8 - cmp r1, 0 - beq _0811D32C - add r1, sp, 0xC - movs r0, 0x6 - strb r0, [r1, 0x2] -_0811D32C: - ldr r0, =gUnknown_0203A11C - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0xB - movs r0, 0xFF - strb r0, [r1, 0xB] - adds r0, r2, 0 - add r1, sp, 0xC - bl StringAppend - adds r2, r0, 0 - movs r5, 0 - lsls r0, r7, 4 - mov r9, r0 - adds r1, r7, 0x1 - mov r10, r1 - b _0811D3CE - .pool -_0811D358: - ldrh r0, [r4] - ldr r1, =0x0000ffff - cmp r0, r1 - beq _0811D374 - adds r1, r0, 0 - adds r0, r2, 0 - bl CopyEasyChatWord - adds r2, r0, 0 - adds r4, 0x2 - b _0811D3A2 - .pool -_0811D374: - adds r4, 0x2 - mov r0, r8 - cmp r0, 0 - bne _0811D3A8 - adds r0, r2, 0 - movs r1, 0 - movs r2, 0x4 - bl WriteColorChangeControlCode - adds r2, r0, 0 - movs r1, 0xAE - movs r0, 0xB -_0811D38C: - strb r1, [r2] - adds r2, 0x1 - subs r0, 0x1 - cmp r0, 0 - bge _0811D38C - adds r0, r2, 0 - movs r1, 0 - movs r2, 0x2 - bl WriteColorChangeControlCode - adds r2, r0, 0 -_0811D3A2: - mov r1, r8 - cmp r1, 0 - beq _0811D3AE -_0811D3A8: - add r1, sp, 0xC - movs r0, 0x3 - strb r0, [r1, 0x2] -_0811D3AE: - adds r0, r2, 0 - add r1, sp, 0xC - bl StringAppend - adds r2, r0, 0 - cmp r6, 0x2 - beq _0811D3C4 - cmp r6, 0x7 - beq _0811D3C4 - cmp r6, 0x8 - bne _0811D3CC -_0811D3C4: - cmp r5, 0 - bne _0811D3CC - cmp r7, 0x4 - beq _0811D3D4 -_0811D3CC: - adds r5, 0x1 -_0811D3CE: - ldr r0, [sp, 0x10] - cmp r5, r0 - blt _0811D358 -_0811D3D4: - movs r0, 0xFF - strb r0, [r2] - ldr r0, =gUnknown_0203A11C - ldr r2, [r0] - ldrb r0, [r2, 0x2] - adds r2, 0xB - mov r1, r9 - adds r1, 0x1 - lsls r1, 24 - lsrs r1, 24 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl sub_811D028 - mov r7, r10 - ldr r1, [sp, 0x14] - cmp r7, r1 - blt _0811D316 -_0811D402: - ldr r0, =gUnknown_0203A11C - ldr r0, [r0] - ldrb r0, [r0, 0x2] - 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_811D2C8 - - thumb_func_start sub_811D424 -sub_811D424: @ 811D424 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - mov r8, r0 - bl sub_811BA68 - lsls r0, 24 - lsrs r6, r0, 24 - movs r0, 0 - str r0, [sp] - ldr r2, =0x01000200 - mov r0, sp - mov r1, r8 - bl CpuFastSet - cmp r6, 0x2 - beq _0811D450 - cmp r6, 0x8 - bne _0811D4D4 -_0811D450: - ldr r0, =gUnknown_08597C30 - lsls r2, r6, 2 - adds r2, r0 - ldrb r1, [r2] - lsls r3, r1, 27 - lsrs r0, r3, 27 - ldrb r4, [r2, 0x1] - adds r5, r0, r4 - lsls r1, 24 - lsrs r0, r1, 29 - ldrb r2, [r2, 0x2] - adds r2, r0 - mov r12, r2 - adds r6, r0, 0 - cmp r6, r12 - blt _0811D472 - b _0811D5D6 -_0811D472: - mov r9, r3 -_0811D474: - mov r0, r9 - lsrs r3, r0, 27 - subs r7, r3, 0x1 - lsls r2, r6, 5 - adds r0, r2, r7 - lsls r0, 1 - add r0, r8 - ldr r4, =0x00001005 - adds r1, r4, 0 - strh r1, [r0] - adds r7, r3, 0 - adds r3, r2, 0 - adds r4, r6, 0x1 - cmp r7, r5 - bge _0811D4AE - movs r0, 0x80 - lsls r0, 5 - adds r2, r0, 0 - lsls r1, r7, 1 - lsls r0, r6, 6 - add r0, r8 - adds r0, r1, r0 - subs r7, r5, r7 -_0811D4A2: - strh r2, [r0] - adds r0, 0x2 - subs r7, 0x1 - cmp r7, 0 - bne _0811D4A2 - adds r7, r5, 0 -_0811D4AE: - adds r0, r3, r7 - lsls r0, 1 - add r0, r8 - ldr r2, =0x00001007 - adds r1, r2, 0 - strh r1, [r0] - adds r6, r4, 0 - cmp r6, r12 - blt _0811D474 - b _0811D5D6 - .pool -_0811D4D4: - ldr r4, =gUnknown_08597C30 - mov r10, r4 - lsls r6, 2 - mov r9, r6 - mov r3, r9 - add r3, r10 - ldrb r0, [r3] - lsls r2, r0, 24 - lsrs r1, r2, 29 - subs r6, r1, 0x1 - lsls r0, 27 - lsrs r4, r0, 27 - subs r7, r4, 0x1 - adds r0, r4, 0 - ldrb r1, [r3, 0x1] - adds r5, r0, r1 - lsrs r2, 29 - ldrb r3, [r3, 0x2] - adds r3, r2 - mov r12, r3 - lsls r0, r6, 5 - adds r0, r7 - lsls r0, 1 - add r0, r8 - ldr r2, =0x00001001 - adds r1, r2, 0 - strh r1, [r0] - adds r7, r4, 0 - cmp r7, r5 - bge _0811D52A - ldr r4, =0x00001002 - adds r2, r4, 0 - lsls r1, r7, 1 - lsls r0, r6, 6 - add r0, r8 - adds r1, r0 - subs r7, r5, r7 -_0811D51E: - strh r2, [r1] - adds r1, 0x2 - subs r7, 0x1 - cmp r7, 0 - bne _0811D51E - adds r7, r5, 0 -_0811D52A: - lsls r0, r6, 5 - adds r0, r7 - lsls r0, 1 - add r0, r8 - ldr r2, =0x00001003 - adds r1, r2, 0 - strh r1, [r0] - adds r6, 0x1 - cmp r6, r12 - bge _0811D590 - ldr r0, =gUnknown_08597C30 - add r0, r9 - ldrb r0, [r0] - lsls r3, r0, 27 -_0811D546: - lsrs r0, r3, 27 - subs r7, r0, 0x1 - lsls r1, r6, 5 - adds r1, r7 - lsls r1, 1 - add r1, r8 - ldr r4, =0x00001005 - adds r2, r4, 0 - strh r2, [r1] - adds r7, r0, 0 - adds r4, r6, 0x1 - cmp r7, r5 - bge _0811D57C - movs r0, 0x80 - lsls r0, 5 - adds r2, r0, 0 - lsls r1, r7, 1 - lsls r0, r6, 6 - add r0, r8 - adds r1, r0 - subs r7, r5, r7 -_0811D570: - strh r2, [r1] - adds r1, 0x2 - subs r7, 0x1 - cmp r7, 0 - bne _0811D570 - adds r7, r5, 0 -_0811D57C: - lsls r0, r6, 5 - adds r0, r7 - lsls r0, 1 - add r0, r8 - ldr r2, =0x00001007 - adds r1, r2, 0 - strh r1, [r0] - adds r6, r4, 0 - cmp r6, r12 - blt _0811D546 -_0811D590: - mov r0, r9 - add r0, r10 - ldrb r2, [r0] - lsls r2, 27 - lsrs r2, 27 - subs r7, r2, 0x1 - lsls r3, r6, 5 - adds r0, r3, r7 - lsls r0, 1 - add r0, r8 - ldr r4, =0x00001009 - adds r1, r4, 0 - strh r1, [r0] - adds r7, r2, 0 - cmp r7, r5 - bge _0811D5CA - ldr r0, =0x0000100a - adds r2, r0, 0 - lsls r1, r7, 1 - lsls r0, r6, 6 - add r0, r8 - adds r0, r1, r0 - subs r7, r5, r7 -_0811D5BE: - strh r2, [r0] - adds r0, 0x2 - subs r7, 0x1 - cmp r7, 0 - bne _0811D5BE - adds r7, r5, 0 -_0811D5CA: - adds r0, r3, r7 - lsls r0, 1 - add r0, r8 - ldr r2, =0x0000100b - adds r1, r2, 0 - strh r1, [r0] -_0811D5D6: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_811D424 - - thumb_func_start sub_811D60C -sub_811D60C: @ 811D60C - push {r4,lr} - sub sp, 0x8 - movs r0, 0x3 - bl GetBgTilemapBuffer - adds r4, r0, 0 - bl sub_811BA68 - lsls r0, 24 - ldr r1, =gUnknown_08597C30 - lsrs r0, 22 - adds r0, r1 - ldrb r1, [r0, 0x3] - cmp r1, 0x2 - beq _0811D63E - cmp r1, 0x2 - bgt _0811D638 - cmp r1, 0x1 - beq _0811D64C - b _0811D67C - .pool -_0811D638: - cmp r1, 0x3 - beq _0811D668 - b _0811D67C -_0811D63E: - movs r0, 0xA8 - lsls r0, 3 - adds r4, r0 - movs r0, 0x20 - str r0, [sp] - str r1, [sp, 0x4] - b _0811D65A -_0811D64C: - movs r0, 0xC0 - lsls r0, 3 - adds r4, r0 - movs r0, 0x20 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] -_0811D65A: - movs r0, 0x3 - adds r1, r4, 0 - movs r2, 0 - movs r3, 0xB - bl CopyToBgTilemapBufferRect - b _0811D67C -_0811D668: - movs r0, 0x20 - str r0, [sp] - movs r0, 0x4 - str r0, [sp, 0x4] - movs r0, 0x3 - adds r1, r4, 0 - movs r2, 0 - movs r3, 0xA - bl CopyToBgTilemapBufferRect -_0811D67C: - add sp, 0x8 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_811D60C - - thumb_func_start sub_811D684 -sub_811D684: @ 811D684 - push {lr} - movs r0, 0x2 - bl PutWindowTilemap - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - pop {r0} - bx r0 - thumb_func_end sub_811D684 - - thumb_func_start sub_811D698 -sub_811D698: @ 811D698 - push {r4,lr} - adds r4, r0, 0 - bl sub_811DD84 - movs r0, 0x2 - movs r1, 0x11 - bl FillWindowPixelBuffer - cmp r4, 0x1 - beq _0811D6BC - cmp r4, 0x1 - bcc _0811D6B6 - cmp r4, 0x2 - beq _0811D6C2 - b _0811D6C6 -_0811D6B6: - bl sub_811D6F4 - b _0811D6C6 -_0811D6BC: - bl sub_811D758 - b _0811D6C6 -_0811D6C2: - bl sub_811D794 -_0811D6C6: - movs r0, 0x2 - movs r1, 0x2 - bl CopyWindowToVram - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_811D698 - - thumb_func_start sub_811D6D4 -sub_811D6D4: @ 811D6D4 - push {lr} - bl sub_811BBB0 - lsls r0, 24 - cmp r0, 0 - bne _0811D6E8 - movs r0, 0 - bl sub_811D698 - b _0811D6EE -_0811D6E8: - movs r0, 0x1 - bl sub_811D698 -_0811D6EE: - pop {r0} - bx r0 - thumb_func_end sub_811D6D4 - - thumb_func_start sub_811D6F4 -sub_811D6F4: @ 811D6F4 - push {r4-r7,lr} - sub sp, 0xC - movs r5, 0 - movs r7, 0x61 -_0811D6FC: - movs r4, 0 - lsls r0, r7, 24 - lsrs r6, r0, 24 -_0811D702: - lsls r0, r5, 24 - lsrs r0, 24 - adds r5, 0x1 - bl sub_811F3B8 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x16 - beq _0811D742 - bl sub_811F424 - adds r2, r0, 0 - movs r0, 0x54 - adds r3, r4, 0 - muls r3, r0 - adds r3, 0xA - lsls r3, 24 - lsrs r3, 24 - str r6, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r0, 0x2 - movs r1, 0x1 - bl sub_811D028 - adds r4, 0x1 - cmp r4, 0x1 - ble _0811D702 - adds r7, 0x10 - b _0811D6FC -_0811D742: - bl sub_811BBBC - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl sub_811DDAC - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_811D6F4 - - thumb_func_start sub_811D758 -sub_811D758: @ 811D758 - push {r4-r6,lr} - sub sp, 0xC - movs r5, 0 - movs r4, 0xC2 - lsls r4, 23 - ldr r6, =gUnknown_08597C90 -_0811D764: - ldm r6!, {r2} - lsrs r0, r4, 24 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r0, 0x2 - movs r1, 0x1 - movs r3, 0xA - bl sub_811D028 - movs r0, 0x80 - lsls r0, 21 - adds r4, r0 - adds r5, 0x1 - cmp r5, 0x3 - bls _0811D764 - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_811D758 - - thumb_func_start sub_811D794 -sub_811D794: @ 811D794 - push {lr} - movs r0, 0 - movs r1, 0x4 - bl sub_811D864 - pop {r0} - bx r0 - thumb_func_end sub_811D794 - - thumb_func_start sub_811D7A4 -sub_811D7A4: @ 811D7A4 - push {r4,lr} - bl sub_811BBDC - adds r4, r0, 0 - adds r4, 0x3 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_811D950 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_811D864 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_811D7A4 - - thumb_func_start sub_811D7C8 -sub_811D7C8: @ 811D7C8 - push {r4,lr} - bl sub_811BBDC - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_811D950 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_811D864 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_811D7C8 - - thumb_func_start sub_811D7EC -sub_811D7EC: @ 811D7EC - push {r4,r5,lr} - bl sub_811BBDC - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - adds r0, r5, 0x4 - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_811BBE8 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bls _0811D80E - adds r4, r0, 0 -_0811D80E: - cmp r5, r4 - bcs _0811D828 - subs r4, r5 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_811D950 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_811D864 -_0811D828: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_811D7EC - - thumb_func_start sub_811D830 -sub_811D830: @ 811D830 - push {r4,r5,lr} - bl sub_811BBDC - lsls r0, 24 - lsrs r5, r0, 24 - bl sub_811DE48 - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - bcs _0811D85C - subs r4, r0, r5 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_811D950 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_811D864 -_0811D85C: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_811D830 - - thumb_func_start sub_811D864 -sub_811D864: @ 811D864 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - str r1, [sp, 0x14] - lsls r1, r0, 1 - mov r8, r1 - lsls r0, 4 - adds r1, r0, 0 - adds r1, 0x60 - movs r0, 0xFF - ands r1, r0 - adds r1, 0x1 - movs r0, 0 - b _0811D930 -_0811D88E: - movs r6, 0 - movs r2, 0x10 - adds r2, r1 - mov r9, r2 - adds r0, 0x1 - mov r10, r0 - lsls r0, r1, 24 - lsrs r7, r0, 24 -_0811D89E: - mov r1, r8 - lsls r0, r1, 16 - lsrs r0, 16 - movs r2, 0x1 - add r8, r2 - bl sub_811F578 - lsls r0, 16 - lsrs r4, r0, 16 - ldr r0, =0x0000ffff - cmp r4, r0 - beq _0811D926 - ldr r5, =gUnknown_0203A11C - ldr r0, [r5] - adds r0, 0xCC - adds r1, r4, 0 - movs r2, 0 - bl CopyEasyChatWordPadded - adds r0, r4, 0 - bl sub_811BF88 - adds r1, r0, 0 - cmp r1, 0 - bne _0811D8FC - ldr r2, [r5] - adds r2, 0xCC - movs r0, 0xD - adds r3, r6, 0 - muls r3, r0 - adds r3, 0x3 - lsls r3, 27 - lsrs r3, 24 - str r7, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - str r1, [sp, 0x8] - movs r0, 0x2 - movs r1, 0x1 - bl sub_811D028 - b _0811D926 - .pool -_0811D8FC: - ldr r2, [r5] - adds r2, 0xCC - movs r0, 0xD - adds r3, r6, 0 - muls r3, r0 - adds r3, 0x3 - lsls r3, 27 - lsrs r3, 24 - str r7, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x5 - str r0, [sp, 0xC] - movs r0, 0x3 - str r0, [sp, 0x10] - movs r0, 0x2 - movs r1, 0x1 - bl sub_811D058 -_0811D926: - adds r6, 0x1 - cmp r6, 0x1 - ble _0811D89E - mov r1, r9 - mov r0, r10 -_0811D930: - ldr r2, [sp, 0x14] - cmp r0, r2 - blt _0811D88E - movs r0, 0x2 - movs r1, 0x2 - bl CopyWindowToVram - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_811D864 - - thumb_func_start sub_811D950 -sub_811D950: @ 811D950 - push {r4,r5,lr} - sub sp, 0x8 - lsls r0, 24 - lsls r1, 24 - lsrs r0, 20 - adds r3, r0, 0 - adds r3, 0x60 - movs r0, 0xFF - ands r3, r0 - lsrs r0, r1, 20 - adds r1, r3, r0 - cmp r1, 0xFF - ble _0811D97C - ldr r0, =0xffffff00 - adds r4, r1, r0 - movs r0, 0x80 - lsls r0, 1 - subs r0, r3 - b _0811D97E - .pool -_0811D97C: - movs r4, 0 -_0811D97E: - movs r5, 0xE0 - str r5, [sp] - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0x4] - movs r0, 0x2 - movs r1, 0x11 - movs r2, 0 - bl FillWindowPixelRect - cmp r4, 0 - beq _0811D9AA - str r5, [sp] - lsls r0, r4, 16 - lsrs r0, 16 - str r0, [sp, 0x4] - movs r0, 0x2 - movs r1, 0x11 - movs r2, 0 - movs r3, 0 - bl FillWindowPixelRect -_0811D9AA: - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_811D950 - - thumb_func_start sub_811D9B4 -sub_811D9B4: @ 811D9B4 - push {lr} - movs r0, 0x2 - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r0, 0x2 - movs r1, 0x2 - bl CopyWindowToVram - pop {r0} - bx r0 - thumb_func_end sub_811D9B4 - - thumb_func_start sub_811D9CC -sub_811D9CC: @ 811D9CC - push {lr} - ldr r1, =gUnknown_0203A11C - cmp r0, 0x6 - bhi _0811DA86 - lsls r0, 2 - ldr r1, =_0811D9E8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0811D9E8: - .4byte _0811DA04 - .4byte _0811DA18 - .4byte _0811DA28 - .4byte _0811DA3C - .4byte _0811DA50 - .4byte _0811DA64 - .4byte _0811DA78 -_0811DA04: - ldr r1, =gUnknown_0203A11C - ldr r2, [r1] - movs r0, 0 - strb r0, [r2, 0x6] - ldr r2, [r1] - movs r0, 0xA - b _0811DA84 - .pool -_0811DA18: - ldr r1, =gUnknown_0203A11C - ldr r2, [r1] - movs r3, 0 - movs r0, 0x9 - b _0811DA44 - .pool -_0811DA28: - ldr r1, =gUnknown_0203A11C - ldr r2, [r1] - movs r0, 0xB - strb r0, [r2, 0x6] - ldr r2, [r1] - movs r0, 0x11 - b _0811DA84 - .pool -_0811DA3C: - ldr r1, =gUnknown_0203A11C - ldr r2, [r1] - movs r3, 0 - movs r0, 0x11 -_0811DA44: - strb r0, [r2, 0x6] - ldr r0, [r1] - strb r3, [r0, 0x7] - b _0811DA86 - .pool -_0811DA50: - ldr r1, =gUnknown_0203A11C - ldr r2, [r1] - movs r0, 0x11 - strb r0, [r2, 0x6] - ldr r2, [r1] - movs r0, 0xA - b _0811DA84 - .pool -_0811DA64: - ldr r1, =gUnknown_0203A11C - ldr r2, [r1] - movs r0, 0x12 - strb r0, [r2, 0x6] - ldr r2, [r1] - movs r0, 0x16 - b _0811DA84 - .pool -_0811DA78: - ldr r1, =gUnknown_0203A11C - ldr r2, [r1] - movs r0, 0x16 - strb r0, [r2, 0x6] - ldr r2, [r1] - movs r0, 0x12 -_0811DA84: - strb r0, [r2, 0x7] -_0811DA86: - ldr r1, [r1] - ldrb r0, [r1, 0x6] - movs r3, 0x1 - negs r3, r3 - adds r2, r3, 0 - ldrb r3, [r1, 0x7] - cmp r0, r3 - bcs _0811DA98 - movs r2, 0x1 -_0811DA98: - strb r2, [r1, 0x8] - pop {r0} - bx r0 - .pool - thumb_func_end sub_811D9CC - - thumb_func_start sub_811DAA4 -sub_811DAA4: @ 811DAA4 - push {r4,lr} - ldr r4, =gUnknown_0203A11C - ldr r1, [r4] - ldrb r2, [r1, 0x6] - ldrb r0, [r1, 0x7] - cmp r2, r0 - beq _0811DAD4 - ldrb r0, [r1, 0x8] - adds r0, r2, r0 - strb r0, [r1, 0x6] - ldr r0, [r4] - ldrb r0, [r0, 0x6] - bl sub_811DADC - ldr r0, [r4] - ldrb r1, [r0, 0x6] - ldrb r0, [r0, 0x7] - eors r1, r0 - negs r0, r1 - orrs r0, r1 - lsrs r0, 31 - b _0811DAD6 - .pool -_0811DAD4: - movs r0, 0 -_0811DAD6: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_811DAA4 - thumb_func_start sub_811DADC sub_811DADC: @ 811DADC push {r4,lr} diff --git a/include/graphics.h b/include/graphics.h index 6a1933ddd..7cc847524 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4892,5 +4892,6 @@ extern const u16 gFrontierPassMapCursor_Pal[]; // Easy Chat Screen extern const u32 gEasyChatWindow_Gfx[]; extern const u32 gEasyChatWindow_Tilemap[]; +extern const u16 gEasyChatMode_Pal[]; #endif //GUARD_GRAPHICS_H diff --git a/include/strings.h b/include/strings.h index af1625140..a3e743943 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2422,5 +2422,13 @@ extern const u8 gText_AllTextBeingEditedWill[]; extern const u8 gText_BeDeletedThatOkay[]; extern const u8 gText_Lady[]; extern const u8 gText_F700sQuiz[]; +extern const u8 gText_CreateAQuiz[]; +extern const u8 gText_SelectTheAnswer[]; +extern const u8 gText_OriginalSongWillBeUsed[]; +extern const u8 gText_LyricsCantBeDeleted[]; +extern const u8 gText_CombineTwoWordsOrPhrases3[]; +extern const u8 gText_OnlyOnePhrase[]; +extern const u8 gText_YouCannotQuitHere[]; +extern const u8 gText_SectionMustBeCompleted[]; #endif // GUARD_STRINGS_H diff --git a/src/easy_chat.c b/src/easy_chat.c index 741064c5b..5c55cd2ca 100644 --- a/src/easy_chat.c +++ b/src/easy_chat.c @@ -20,6 +20,7 @@ #include "string_util.h" #include "strings.h" #include "task.h" +#include "text_window.h" #include "window.h" #include "constants/flags.h" #include "constants/songs.h" @@ -76,11 +77,27 @@ struct EasyChatScreen struct Unk203A11C { u16 unk0; - u8 filler2[0x2]; + u16 windowId; u16 unk4; - u8 filler6[0x2FA]; - u8 unk300[BG_SCREEN_SIZE]; - u8 unkB00[BG_SCREEN_SIZE]; + u8 unk6; + u8 unk7; + s8 unk8; + u8 filler9[0x1]; + u8 unkA; + u8 unkB[0xC1]; + u8 unkCC[0x20C]; + int unk2D8; + int unk2DC; + int unk2E0; + int unk2E4; + int unk2E8; + int unk2EC; + int unk2F0; + int unk2F4; + int unk2F8; + int unk2FC; + u16 unk300[BG_SCREEN_SIZE / 2]; + u16 unkB00[BG_SCREEN_SIZE / 2]; }; struct Unk08597C30 @@ -174,17 +191,17 @@ static void sub_811B9A0(void); static u8 sub_811BA1C(void); static int sub_811BF20(void); static u16 sub_811BF40(void); -u8 sub_811CE94(void); -void sub_811CF64(void); -void sub_811CF04(void); -void sub_811D60C(void); -void sub_811D424(u8 *); -void sub_811D230(void); +static bool8 sub_811CE94(void); +static void sub_811CF64(void); +static void sub_811CF04(void); +static void sub_811D60C(void); +static void sub_811D424(u16 *); +static void sub_811D230(void); void sub_811E948(void); -void sub_811CFCC(void); -void sub_811D0BC(void); -void sub_811D2C8(void); -void sub_811D684(void); +static void sub_811CFCC(void); +static void sub_811D0BC(void); +static void sub_811D2C8(void); +static void sub_811D684(void); void sub_811DE90(void); void sub_811DEC4(void); void sub_811DE5C(u8, u8, u8, u8); @@ -223,16 +240,16 @@ static bool8 sub_811CE54(void); void sub_811DF60(u8, u8); int sub_811E920(int); void sub_811DF90(void); -void sub_811D104(u8); -void sub_811D214(u8); +static void sub_811D104(u8); +static void sub_811D214(u8); void sub_811DFB0(void); -void sub_811D6D4(void); -void sub_811D9CC(int); +static void sub_811D6D4(void); +static void sub_811D9CC(int); void sub_811E3AC(void); bool8 sub_811E418(void); void sub_811DFC8(void); void sub_811E6E0(int); -bool8 sub_811DAA4(void); +static bool8 sub_811DAA4(void); void sub_811E64C(void); void sub_811E050(void); void sub_811E4AC(void); @@ -244,18 +261,27 @@ void sub_811E578(void); void sub_811E088(void); void sub_811DDAC(s16, u8); bool8 sub_811DE10(void); -void sub_811D9B4(void); -void sub_811D698(int); +static void sub_811D9B4(void); +static void sub_811D698(u32); void sub_811E288(void); void sub_811E794(void); void sub_811E380(void); void sub_811E7F8(void); void sub_811E30C(void); -void sub_811D7A4(void); -void sub_811D7C8(void); +static void sub_811D7A4(void); +static void sub_811D7C8(void); int sub_811DE48(void); -void sub_811D7EC(void); -void sub_811D830(void); +static void sub_811D7EC(void); +static void sub_811D830(void); +void sub_811D058(u8, u8, const u8 *, u8, u8, u8, u8, u8, u8); +void sub_811DD84(void); +static void sub_811D6F4(void); +static void sub_811D758(void); +static void sub_811D794(void); +const u8 *sub_811F424(u8); +static void sub_811D864(u8, u8); +static void sub_811D950(u8, u8); +void sub_811DADC(u8); u8 *CopyEasyChatWordPadded(u8 *, u16, u16); extern const struct { @@ -271,6 +297,13 @@ extern const struct BgTemplate gUnknown_08597C54[4]; extern const struct WindowTemplate gUnknown_08597C64[]; extern const u32 gUnknown_08597B54[]; extern const struct Unk08597C30 gUnknown_08597C30[]; +extern const u16 gUnknown_08597B14[]; +extern const u16 gUnknown_08597B34[]; +extern const u16 gUnknown_08597C1C[]; +extern const u16 gUnknown_08597C24[]; +extern const struct WindowTemplate gUnknown_08597C84; +extern const u8 gUnknown_08597C8C[4]; +extern const u8 *const gUnknown_08597C90[4]; void sub_811A20C(u8 kind, u16 *words, MainCallback callback, u8 sizeParam) { @@ -2023,19 +2056,19 @@ u8 sub_811BAC4(void) return gEasyChatScreen->mainCursorRow; } -void sub_811BAD0(const u8 **str1, const u8 **str2) +static void GetEasyChatInstructionsText(const u8 **str1, const u8 **str2) { *str1 = gEasyChatScreenTemplates[gEasyChatScreen->templateId].instructionsText1; *str2 = gEasyChatScreenTemplates[gEasyChatScreen->templateId].instructionsText2; } -void sub_811BB08(const u8 **str1, const u8 **str2) +static void GetEasyChatConfirmText(const u8 **str1, const u8 **str2) { *str1 = gEasyChatScreenTemplates[gEasyChatScreen->templateId].confirmText1; *str2 = gEasyChatScreenTemplates[gEasyChatScreen->templateId].confirmText2; } -void sub_811BB40(const u8 **str1, const u8 **str2) +static void sub_811BB40(const u8 **str1, const u8 **str2) { switch (gEasyChatScreen->kind) { @@ -2056,7 +2089,7 @@ void sub_811BB40(const u8 **str1, const u8 **str2) } -void sub_811BB88(const u8 **str1, const u8 **str2) +static void GetEasyChatConfirmDeletionText(const u8 **str1, const u8 **str2) { *str1 = gText_AllTextBeingEditedWill; *str2 = gText_BeDeletedThatOkay; @@ -2133,7 +2166,7 @@ int sub_811BC2C(void) return 0; } -int sub_811BC70(void) +static int sub_811BC70(void) { return sub_811BA3C(); } @@ -3187,3 +3220,535 @@ static bool8 sub_811CE54(void) return TRUE; } + +static bool8 sub_811CE94(void) +{ + gUnknown_0203A11C = Alloc(sizeof(*gUnknown_0203A11C)); + if (!gUnknown_0203A11C) + return FALSE; + + gUnknown_0203A11C->unk0 = 0; + gUnknown_0203A11C->unk2D8 = 0; + gUnknown_0203A11C->unk2DC = 0; + gUnknown_0203A11C->unk2E0 = 0; + gUnknown_0203A11C->unk2E4 = 0; + gUnknown_0203A11C->unk2E8 = 0; + gUnknown_0203A11C->unk2EC = 0; + gUnknown_0203A11C->unk2F0 = 0; + gUnknown_0203A11C->unk2F4 = 0; + gUnknown_0203A11C->unk2F8 = 0; + gUnknown_0203A11C->unk2FC = 0; + gUnknown_0203A11C->unkA = sub_811BC70(); + return TRUE; +} + +static void sub_811CF04(void) +{ + ChangeBgX(3, 0, 0); + ChangeBgY(3, 0, 0); + ChangeBgX(1, 0, 0); + ChangeBgY(1, 0, 0); + ChangeBgX(2, 0, 0); + ChangeBgY(2, 0, 0); + ChangeBgX(0, 0, 0); + ChangeBgY(0, 0, 0); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON); +} + +static void sub_811CF64(void) +{ + ResetPaletteFade(); + LoadPalette(gEasyChatMode_Pal, 0, 32); + LoadPalette(gUnknown_08597B14, 1 * 16, 32); + LoadPalette(gUnknown_08597B34, 4 * 16, 32); + LoadPalette(gUnknown_08597C1C, 10 * 16, 8); + LoadPalette(gUnknown_08597C24, 11 * 16, 12); + LoadPalette(gUnknown_08597C24, 15 * 16, 12); + LoadPalette(gUnknown_08597C24, 3 * 16, 12); +} + +static void sub_811CFCC(void) +{ + int xOffset; + const u8 *titleText = sub_811BA88(); + if (!titleText) + return; + + xOffset = GetStringCenterAlignXOffset(1, titleText, 144); + FillWindowPixelBuffer(0, 0); + sub_811D058(0, 1, titleText, xOffset, 1, 0xFF, 0, 2, 3); + PutWindowTilemap(0); + CopyWindowToVram(0, 3); +} + +void sub_811D028(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16)) +{ + AddTextPrinterParameterized(windowId, fontId, str, x, y, speed, callback); +} + +void sub_811D058(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, u8 red, u8 green, u8 blue) +{ + u8 color[3]; + color[0] = red; + color[1] = green; + color[2] = blue; + AddTextPrinterParameterized3(windowId, fontId, left, top, color, speed, str); +} + +static void sub_811D0BC(void) +{ + FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 17); + LoadUserWindowBorderGfx(1, 1, 0xE0); + sub_8098858(1, 1, 14); + sub_811D104(0); + PutWindowTilemap(1); + CopyBgTilemapBufferToVram(0); +} + +static void sub_811D104(u8 arg0) +{ + const u8 *text2 = NULL; + const u8 *text1 = NULL; + switch (arg0) + { + case 0: + GetEasyChatInstructionsText(&text1, &text2); + break; + case 2: + sub_811BB40(&text1, &text2); + break; + case 3: + GetEasyChatConfirmText(&text1, &text2); + break; + case 1: + GetEasyChatConfirmDeletionText(&text1, &text2); + break; + case 4: + text1 = gText_CreateAQuiz; + break; + case 5: + text1 = gText_SelectTheAnswer; + break; + case 6: + text1 = gText_OnlyOnePhrase; + text2 = gText_OriginalSongWillBeUsed; + break; + case 7: + text1 = gText_LyricsCantBeDeleted; + break; + case 8: + text1 = gText_CombineTwoWordsOrPhrases3; + break; + case 9: + text1 = gText_YouCannotQuitHere; + text2 = gText_SectionMustBeCompleted; + break; + } + + FillWindowPixelBuffer(1, 0x11); + if (text1) + sub_811D028(1, 1, text1, 0, 1, 0xFF, 0); + + if (text2) + sub_811D028(1, 1, text2, 0, 17, 0xFF, 0); + + CopyWindowToVram(1, 3); +} + +static void sub_811D214(u8 initialCursorPos) +{ + CreateYesNoMenu(&gUnknown_08597C84, 1, 14, initialCursorPos); +} + +static void sub_811D230(void) +{ + u8 var0; + struct WindowTemplate template; + + var0 = sub_811BA68(); + template.bg = 3; + template.tilemapLeft = gUnknown_08597C30[var0].unk0_0; + template.tilemapTop = gUnknown_08597C30[var0].unk0_5; + template.width = gUnknown_08597C30[var0].unk1; + template.height = gUnknown_08597C30[var0].unk2; + template.paletteNum = 11; + template.baseBlock = 0x6C; + gUnknown_0203A11C->windowId = AddWindow(&template); + PutWindowTilemap(gUnknown_0203A11C->windowId); +} + +static void sub_811D2C8(void) +{ + u8 spC[4]; + u16 *ecWord; + u8 numColumns, numRows; + u8 *str; + int var0; + int var1; + int i, j, k; + + ecWord = sub_811BA94(); + numColumns = sub_811BAAC(); + numRows = sub_811BAA0(); + var0 = sub_811BA68(); + var1 = 0; + if (var0 == 7) + var1 = 1; + + FillWindowPixelBuffer(gUnknown_0203A11C->windowId, 0x11); + for (i = 0; i < numRows; i++) + { + memcpy(spC, gUnknown_08597C8C, sizeof(gUnknown_08597C8C)); + if (var1) + spC[2] = 6; + + str = gUnknown_0203A11C->unkB; + gUnknown_0203A11C->unkB[0] = EOS; + str = StringAppend(str, spC); + for (j = 0; j < numColumns; j++) + { + if (*ecWord != 0xFFFF) + { + str = CopyEasyChatWord(str, *ecWord); + ecWord++; + } + else + { + ecWord++; + if (!var1) + { + str = WriteColorChangeControlCode(str, 0, 4); + for (k = 0; k < 12; k++) + { + *str = CHAR_HYPHEN; + str++; + } + + str = WriteColorChangeControlCode(str, 0, 2); + } + } + + if (var1) + spC[2] = 3; + + str = StringAppend(str, spC); + if (var0 == 2 || var0 == 7 || var0 == 8) + { + if (j == 0 && i == 4) + break; + } + } + + *str = EOS; + sub_811D028(gUnknown_0203A11C->windowId, 1, gUnknown_0203A11C->unkB, 0, i * 16 + 1, 0xFF, 0); + } + + CopyWindowToVram(gUnknown_0203A11C->windowId, 3); +} + +static void sub_811D424(u16 *tilemap) +{ + u8 var0; + int right, bottom; + int x, y; + + var0 = sub_811BA68(); + CpuFastFill(0, tilemap, BG_SCREEN_SIZE); + if (var0 == 2 || var0 == 8) + { + right = gUnknown_08597C30[var0].unk0_0 + gUnknown_08597C30[var0].unk1; + bottom = gUnknown_08597C30[var0].unk0_5 + gUnknown_08597C30[var0].unk2; + for (y = gUnknown_08597C30[var0].unk0_5; y < bottom; y++) + { + x = gUnknown_08597C30[var0].unk0_0 - 1; + tilemap[y * 32 + x] = 0x1005; + x++; + for (; x < right; x++) + tilemap[y * 32 + x] = 0x1000; + + tilemap[y* 32 + x] = 0x1007; + } + } + else + { + y = gUnknown_08597C30[var0].unk0_5 - 1; + x = gUnknown_08597C30[var0].unk0_0 - 1; + right = gUnknown_08597C30[var0].unk0_0 + gUnknown_08597C30[var0].unk1; + bottom = gUnknown_08597C30[var0].unk0_5 + gUnknown_08597C30[var0].unk2; + tilemap[y * 32 + x] = 0x1001; + x++; + for (; x < right; x++) + tilemap[y * 32 + x] = 0x1002; + + tilemap[y * 32 + x] = 0x1003; + y++; + for (; y < bottom; y++) + { + x = gUnknown_08597C30[var0].unk0_0 - 1; + tilemap[y * 32 + x] = 0x1005; + x++; + for (; x < right; x++) + tilemap[y * 32 + x] = 0x1000; + + tilemap[y* 32 + x] = 0x1007; + } + + x = gUnknown_08597C30[var0].unk0_0 - 1; + tilemap[y * 32 + x] = 0x1009; + x++; + for (; x < right; x++) + tilemap[y * 32 + x] = 0x100A; + + tilemap[y * 32 + x] = 0x100B; + } +} + +static void sub_811D60C(void) +{ + u8 var0; + u16 *tilemap; + + tilemap = GetBgTilemapBuffer(3); + var0 = sub_811BA68(); + switch (gUnknown_08597C30[var0].unk3) + { + case 2: + tilemap += 0x2A0; + CopyToBgTilemapBufferRect(3, tilemap, 0, 11, 32, 2); + break; + case 1: + tilemap += 0x300; + CopyToBgTilemapBufferRect(3, tilemap, 0, 11, 32, 2); + break; + case 3: + CopyToBgTilemapBufferRect(3, tilemap, 0, 10, 32, 4); + break; + } +} + +static void sub_811D684(void) +{ + PutWindowTilemap(2); + CopyBgTilemapBufferToVram(2); +} + +static void sub_811D698(u32 arg0) +{ + sub_811DD84(); + FillWindowPixelBuffer(2, 0x11); + switch (arg0) + { + case 0: + sub_811D6F4(); + break; + case 1: + sub_811D758(); + break; + case 2: + sub_811D794(); + break; + } + + CopyWindowToVram(2, 2); +} + +static void sub_811D6D4(void) +{ + if (!sub_811BBB0()) + sub_811D698(0); + else + sub_811D698(1); +} + +static void sub_811D6F4(void) +{ + int i; + int x, y; + + i = 0; + y = 97; + while (1) + { + for (x = 0; x < 2; x++) + { + u8 index = sub_811F3B8(i++); + if (index == 22) + { + sub_811DDAC(sub_811BBBC(), 0); + return; + } + + sub_811D028(2, 1, sub_811F424(index), x * 84 + 10, y, 0xFF, NULL); + } + + y += 16; + } +} + +static void sub_811D758(void) +{ + u32 i; + + for (i = 0; i < 4; i++) + sub_811D028(2, 1, gUnknown_08597C90[i], 10, 97 + i * 16, 0xFF, NULL); +} + +static void sub_811D794(void) +{ + sub_811D864(0, 4); +} + +static void sub_811D7A4(void) +{ + u8 var0 = sub_811BBDC() + 3; + sub_811D950(var0, 1); + sub_811D864(var0, 1); +} + +static void sub_811D7C8(void) +{ + u8 var0 = sub_811BBDC(); + sub_811D950(var0, 1); + sub_811D864(var0, 1); +} + +static void sub_811D7EC(void) +{ + u8 var0 = sub_811BBDC(); + u8 var1 = var0 + 4; + u8 var2 = sub_811BBE8() + 1; + if (var1 > var2) + var1 = var2; + + if (var0 < var1) + { + u8 var3 = var1 - var0; + sub_811D950(var0, var3); + sub_811D864(var0, var3); + } +} + +static void sub_811D830(void) +{ + u8 var0 = sub_811BBDC(); + u8 var1 = sub_811DE48(); + if (var0 < var1) + { + u8 var2 = var1 - var0; + sub_811D950(var0, var2); + sub_811D864(var0, var2); + } +} + +static void sub_811D864(u8 arg0, u8 arg1) +{ + int i, j; + u16 easyChatWord; + u8 *str; + int y; + int var0; + + var0 = arg0 * 2; + y = (arg0 * 16 + 96) & 0xFF; + y++; + for (i = 0; i < arg1; i++) + { + for (j = 0; j < 2; j++) + { + easyChatWord = sub_811F578(var0++); + if (easyChatWord != 0xFFFF) + { + CopyEasyChatWordPadded(gUnknown_0203A11C->unkCC, easyChatWord, 0); + if (!sub_811BF88(easyChatWord)) + sub_811D028(2, 1, gUnknown_0203A11C->unkCC, (j * 13 + 3) * 8, y, 0xFF, NULL); + else + sub_811D058(2, 1, gUnknown_0203A11C->unkCC, (j * 13 + 3) * 8, y, 0xFF, 1, 5, 3); + } + } + + y += 16; + } + + CopyWindowToVram(2, 2); +} + +static void sub_811D950(u8 arg0, u8 arg1) +{ + int y; + int var0; + int var1; + int var2; + + y = (arg0 * 16 + 96) & 0xFF; + var2 = arg1 * 16; + var0 = y + var2; + if (var0 > 255) + { + var1 = var0 - 256; + var2 = 256 - y; + } + else + { + var1 = 0; + } + + FillWindowPixelRect(2, 0x11, 0, y, 224, var2); + if (var1) + FillWindowPixelRect(2, 0x11, 0, 0, 224, var1); +} + +static void sub_811D9B4(void) +{ + FillWindowPixelBuffer(2, 0x11); + CopyWindowToVram(2, 2); +} + +static void sub_811D9CC(int arg0) +{ + switch (arg0) + { + case 0: + gUnknown_0203A11C->unk6 = 0; + gUnknown_0203A11C->unk7 = 10; + break; + case 1: + gUnknown_0203A11C->unk6 = 9; + gUnknown_0203A11C->unk7 = 0; + break; + case 2: + gUnknown_0203A11C->unk6 = 11; + gUnknown_0203A11C->unk7 = 17; + break; + case 3: + gUnknown_0203A11C->unk6 = 17; + gUnknown_0203A11C->unk7 = 0; + break; + case 4: + gUnknown_0203A11C->unk6 = 17; + gUnknown_0203A11C->unk7 = 10; + break; + case 5: + gUnknown_0203A11C->unk6 = 18; + gUnknown_0203A11C->unk7 = 22; + break; + case 6: + gUnknown_0203A11C->unk6 = 22; + gUnknown_0203A11C->unk7 = 18; + break; + } + + gUnknown_0203A11C->unk8 = gUnknown_0203A11C->unk6 < gUnknown_0203A11C->unk7 ? 1 : -1; +} + +static bool8 sub_811DAA4(void) +{ + u8 var0, var1; + if (gUnknown_0203A11C->unk6 == gUnknown_0203A11C->unk7) + return FALSE; + + gUnknown_0203A11C->unk6 += gUnknown_0203A11C->unk8; + sub_811DADC(gUnknown_0203A11C->unk6); + var0 = gUnknown_0203A11C->unk6; + var1 = gUnknown_0203A11C->unk7; + return (var0 ^ var1) > 0; +}