diff --git a/asm/union_room_chat.s b/asm/union_room_chat.s index fd9d4ebf2..4bc7f3ce5 100755 --- a/asm/union_room_chat.s +++ b/asm/union_room_chat.s @@ -5,1203 +5,6 @@ .text - 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} diff --git a/src/union_room_chat.c b/src/union_room_chat.c index cc482d929..df35d164c 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -16,6 +16,8 @@ #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" @@ -52,7 +54,7 @@ struct UnionRoomChat struct UnionRoomChat2_Unk0 { - int (* unk0)(u8 *); + bool32 (* unk0)(u8 *); u8 unk4; u8 unk5; }; @@ -62,11 +64,17 @@ struct UnionRoomChat2 struct UnionRoomChat2_Unk0 unk0[3]; u16 unk18; u16 unk1A; - u8 filler1C[0x2]; + u16 unk1C; u16 unk1E; u8 filler20[0x2148]; }; +struct Unk82F2C98 +{ + u16 unk0; + bool32 (* unk4)(u8 *); +}; + static void sub_801DDD0(struct UnionRoomChat *); static void c2_081284E0(void); static void sub_801DF20(void); @@ -105,15 +113,48 @@ static bool8 sub_801F4D0(void); static bool32 sub_801F534(void); static void sub_801F544(void); static void sub_801F5B8(void); -void sub_801F5EC(u16, u8); -bool8 sub_801F644(u8); -s8 sub_801FF08(void); +static void sub_801F5EC(u16, u8); +static bool8 sub_801F644(u8); +static s8 sub_801FF08(void); bool32 sub_8020890(void); void sub_8020770(void); static void sub_801F574(struct UnionRoomChat2 *); static void sub_801F580(void); void sub_80208D0(void); -int sub_801FDD8(u8 *); +static bool32 sub_801FDD8(u8 *); +void sub_8020480(void); +void sub_8020538(void); +void sub_8020584(void); +void sub_80205B4(void); +void task_tutorial_story_unknown(void); +void sub_8020680(void); +void sub_80206A4(void); +void sub_80206D0(void); +void sub_8020740(void); +void sub_80206E8(void); +void sub_80208E8(void); +void sub_8020A68(void); +void sub_8020B20(void); +void sub_80203B0(void); +void sub_802040C(void); +void sub_802091C(int); +bool32 sub_8020320(void); +void sub_80201A4(void); +bool32 sub_8020368(void); +void sub_802093C(void); +void sub_8020B80(void); +void sub_801FF18(int, u16); +static void sub_801FDDC(u8, u8, u8); +void sub_8020094(void); +static void sub_801FEBC(void); +void sub_80200C8(void); +static void sub_801FEE4(void); +void sub_80200EC(u16, u16, u8); +void sub_8020118(u16, u8 *, u8, u8, u16); +void sub_80209AC(int); +void sub_8020420(u16, u8 *, u8); +void sub_80209E0(void); +bool32 sub_8020A1C(void); extern struct UnionRoomChat *gUnknown_02022C84; extern struct UnionRoomChat2 *gUnknown_02022C88; @@ -122,6 +163,7 @@ 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[]; void sub_801DD98(void) @@ -1158,7 +1200,7 @@ void sub_801F0BC(u8 *arg0, u8 *arg1) *arg1 = gUnknown_02022C84->unk12; } -u8 *sub_801F0D0(void) +static u8 *sub_801F0D0(void) { return gUnknown_02022C84->unk1A; } @@ -1169,7 +1211,7 @@ int sub_801F0DC(void) return StringLength_Multibyte(str); } -void sub_801F0EC(int *arg0, int *arg1) +void sub_801F0EC(u32 *arg0, u32 *arg1) { int diff = gUnknown_02022C84->unk15 - gUnknown_02022C84->unk14; if (diff < 0) @@ -1443,3 +1485,570 @@ static void sub_801F5B8(void) 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: + task_tutorial_story_unknown(); + 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(1); + 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(0); + 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(); +}