From 963dcfb84d0877eb33edc2f41e18cd8076f95739 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 28 Mar 2019 09:59:08 -0400 Subject: [PATCH] sub_80173E0 --- asm/union_room.s | 214 ----------------------------------------------- src/union_room.c | 77 ++++++++++++++--- 2 files changed, 65 insertions(+), 226 deletions(-) diff --git a/asm/union_room.s b/asm/union_room.s index 79bd7d96f..a310dcaa6 100755 --- a/asm/union_room.s +++ b/asm/union_room.s @@ -5,220 +5,6 @@ .text - thumb_func_start sub_80173E0 -sub_80173E0: @ 80173E0 - push {r4,r5,lr} - sub sp, 0x10 - ldr r5, [sp, 0x1C] - ldr r4, [sp, 0x20] - lsls r3, 24 - lsrs r3, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r4, 24 - lsrs r4, 24 - str r2, [sp] - mov r2, sp - strb r0, [r2, 0x4] - mov r0, sp - strb r1, [r0, 0x5] - strb r3, [r0, 0x6] - strb r5, [r0, 0x7] - strb r3, [r0, 0x8] - strb r5, [r0, 0x9] - ldrb r1, [r2, 0xC] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0xC] - ldr r2, =gTextFlags - ldrb r1, [r2] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - cmp r4, 0x6 - bls _08017422 - b _0801756E -_08017422: - lsls r0, r4, 2 - ldr r1, =_08017434 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08017434: - .4byte _08017450 - .4byte _0801747C - .4byte _080174A8 - .4byte _080174D4 - .4byte _08017500 - .4byte _0801752C - .4byte _08017544 -_08017450: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x20 - orrs r0, r1 - strb r0, [r2, 0xC] - ldrb r1, [r2, 0xD] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0xD] - ands r0, r3 - movs r1, 0x30 - b _0801756A -_0801747C: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x40 - orrs r0, r1 - strb r0, [r2, 0xC] - ldrb r1, [r2, 0xD] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0xD] - ands r0, r3 - movs r1, 0x50 - b _0801756A -_080174A8: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x60 - orrs r0, r1 - strb r0, [r2, 0xC] - ldrb r1, [r2, 0xD] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0xD] - ands r0, r3 - movs r1, 0x70 - b _0801756A -_080174D4: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x10 - orrs r0, r1 - strb r0, [r2, 0xC] - ldrb r1, [r2, 0xD] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0xD] - ands r0, r3 - movs r1, 0x30 - b _0801756A -_08017500: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x10 - orrs r0, r1 - strb r0, [r2, 0xC] - ldrb r1, [r2, 0xD] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2, 0xD] - ands r0, r3 - movs r1, 0x30 - b _0801756A -_0801752C: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r4, 0xF - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0x70 - b _0801755A -_08017544: - mov r0, sp - movs r1, 0 - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r2, sp - ldrb r1, [r2, 0xC] - movs r4, 0xF - movs r3, 0xF - adds r0, r3, 0 - ands r0, r1 - movs r1, 0xE0 -_0801755A: - orrs r0, r1 - strb r0, [r2, 0xC] - mov r1, sp - ldrb r0, [r1, 0xD] - orrs r0, r4 - strb r0, [r1, 0xD] - ands r0, r3 - movs r1, 0x90 -_0801756A: - orrs r0, r1 - strb r0, [r2, 0xD] -_0801756E: - mov r0, sp - movs r1, 0xFF - movs r2, 0 - bl AddTextPrinter - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80173E0 - thumb_func_start sub_8017580 sub_8017580: @ 8017580 push {r4-r7,lr} diff --git a/src/union_room.c b/src/union_room.c index f153801a2..7a45724e5 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -3946,19 +3946,72 @@ void sub_80173D4(void) EnableBothScriptContexts(); } -/* void sub_80173E0(u8 windowId, u8 arg1, const u8 *str, u8 arg3, u8 arg4, u8 arg5) { - struct TextPrinterTemplate sp0 = { - .currentChar = str, - .windowId = windowId, - .fontId = arg1, - .x = arg3, - .y = arg4, - .currentX = arg3, - .currentY = arg4 - }; + struct TextPrinterTemplate sp0; - // to be continued + sp0.currentChar = str; + sp0.windowId = windowId; + sp0.fontId = arg1; + sp0.x = arg3; + sp0.y = arg4; + sp0.currentX = arg3; + sp0.currentY = arg4; + sp0.unk = 0; + + gTextFlags.useAlternateDownArrow = FALSE; + switch (arg5) + { + case 0: + sp0.letterSpacing = 0; + sp0.lineSpacing = 0; + sp0.fgColor = 2; + sp0.bgColor = 1; + sp0.shadowColor = 3; + break; + case 1: + sp0.letterSpacing = 0; + sp0.lineSpacing = 0; + sp0.fgColor = 4; + sp0.bgColor = 1; + sp0.shadowColor = 5; + break; + case 2: + sp0.letterSpacing = 0; + sp0.lineSpacing = 0; + sp0.fgColor = 6; + sp0.bgColor = 1; + sp0.shadowColor = 7; + break; + case 3: + sp0.letterSpacing = 0; + sp0.lineSpacing = 0; + sp0.fgColor = 1; + sp0.bgColor = 1; + sp0.shadowColor = 3; + break; + case 4: + sp0.letterSpacing = 0; + sp0.lineSpacing = 0; + sp0.fgColor = 1; + sp0.bgColor = 2; + sp0.shadowColor = 3; + break; + case 5: + sp0.letterSpacing = 0; + sp0.lineSpacing = 0; + sp0.fgColor = 7; + sp0.bgColor = 15; + sp0.shadowColor = 9; + break; + case 6: + sp0.letterSpacing = 0; + sp0.lineSpacing = 0; + sp0.fgColor = 14; + sp0.bgColor = 15; + sp0.shadowColor = 9; + break; + } + + AddTextPrinter(&sp0, 0xFF, NULL); } -*/