diff options
author | red031000 <rubenru09@aol.com> | 2021-03-10 22:41:14 +0000 |
---|---|---|
committer | red031000 <rubenru09@aol.com> | 2021-03-10 22:41:14 +0000 |
commit | c00f7030cbfd128dec0387d7ea9e45885d0d0f93 (patch) | |
tree | 708183788a0d74cd9b594bbbe174d48001a34b4c | |
parent | 253e743399d41bd5b3a10b65308a962924563196 (diff) |
paramatised2 and 3
-rw-r--r-- | arm9/asm/unk_0201BCBC.s | 94 | ||||
-rw-r--r-- | arm9/src/text.c | 46 | ||||
-rw-r--r-- | include/text.h | 2 |
3 files changed, 48 insertions, 94 deletions
diff --git a/arm9/asm/unk_0201BCBC.s b/arm9/asm/unk_0201BCBC.s index 777ebe72..b87c3b7b 100644 --- a/arm9/asm/unk_0201BCBC.s +++ b/arm9/asm/unk_0201BCBC.s @@ -11,100 +11,6 @@ .text - thumb_func_start AddTextPrinterParameterized2 -AddTextPrinterParameterized2: ; 0x0201BDE0 - push {r3, lr} - sub sp, #0x18 - str r0, [sp, #0x4] - lsl r0, r3, #0x18 - lsr r3, r0, #0x18 - ldr r0, [sp, #0x20] - str r2, [sp, #0x0] - add r2, sp, #0x0 - strb r1, [r2, #0x9] - lsl r0, r0, #0x18 - strb r3, [r2, #0xa] - lsr r0, r0, #0x18 - strb r0, [r2, #0xb] - strb r3, [r2, #0xc] - strb r0, [r2, #0xd] - ldr r0, _0201BE38 ; =gFonts - lsl r1, r1, #0x3 - ldr r0, [r0, #0x0] - add r1, r0, r1 - ldrb r0, [r1, #0x2] - strb r0, [r2, #0xe] - ldrb r0, [r1, #0x3] - strb r0, [r2, #0xf] - ldrb r0, [r1, #0x4] - ldr r1, [sp, #0x28] - strb r0, [r2, #0x10] - lsr r0, r1, #0x10 - strb r0, [r2, #0x11] - lsr r0, r1, #0x8 - strb r0, [r2, #0x13] - strb r1, [r2, #0x12] - mov r0, #0x0 - strh r0, [r2, #0x14] - strb r0, [r2, #0x16] - mov r0, #0xff - strb r0, [r2, #0x17] - ldr r1, [sp, #0x24] - ldr r2, [sp, #0x2c] - add r0, sp, #0x0 - bl AddTextPrinter - add sp, #0x18 - pop {r3, pc} - nop -_0201BE38: .word gFonts - - thumb_func_start AddTextPrinterParameterized3 -AddTextPrinterParameterized3: ; 0x0201BE3C - push {r3, lr} - sub sp, #0x18 - str r0, [sp, #0x4] - lsl r0, r3, #0x18 - lsr r3, r0, #0x18 - ldr r0, [sp, #0x20] - str r2, [sp, #0x0] - add r2, sp, #0x0 - strb r1, [r2, #0x9] - lsl r0, r0, #0x18 - strb r3, [r2, #0xa] - lsr r0, r0, #0x18 - strb r0, [r2, #0xb] - strb r3, [r2, #0xc] - strb r0, [r2, #0xd] - ldr r0, [sp, #0x2c] - strb r0, [r2, #0xe] - ldr r0, [sp, #0x30] - strb r0, [r2, #0xf] - ldr r0, _0201BE94 ; =gFonts - ldr r3, [r0, #0x0] - lsl r0, r1, #0x3 - add r0, r3, r0 - ldrb r0, [r0, #0x4] - ldr r1, [sp, #0x28] - strb r0, [r2, #0x10] - lsr r0, r1, #0x10 - strb r0, [r2, #0x11] - lsr r0, r1, #0x8 - strb r0, [r2, #0x13] - strb r1, [r2, #0x12] - mov r0, #0x0 - strh r0, [r2, #0x14] - strb r0, [r2, #0x16] - mov r0, #0xff - strb r0, [r2, #0x17] - ldr r1, [sp, #0x24] - ldr r2, [sp, #0x34] - add r0, sp, #0x0 - bl AddTextPrinter - add sp, #0x18 - pop {r3, pc} - nop -_0201BE94: .word gFonts - thumb_func_start AddTextPrinter AddTextPrinter: ; 0x0201BE98 push {r3-r7, lr} diff --git a/arm9/src/text.c b/arm9/src/text.c index 1a62608d..0379769f 100644 --- a/arm9/src/text.c +++ b/arm9/src/text.c @@ -107,3 +107,49 @@ THUMB_FUNC u16 AddTextPrinterParameterized(u32 windowId, u8 fontId, const u8 *st printerTemplate.unk4 = 255; return AddTextPrinter(&printerTemplate, speed, callback); } + +THUMB_FUNC u16 AddTextPrinterParameterized2(u32 windowId, u8 fontId, const u8 *str, u32 x, u32 y, u32 speed, u32 colors, void (*callback)(void *, u16)) +{ + struct TextPrinterTemplate printerTemplate; + + printerTemplate.windowId = windowId; + printerTemplate.currentChar = str; + printerTemplate.fontId = fontId; + printerTemplate.x = (u8)x; + printerTemplate.y = (u8)y; + printerTemplate.currentX = (u8)x; + printerTemplate.currentY = (u8)y; + printerTemplate.letterSpacing = gFonts[fontId].letterSpacing; + printerTemplate.lineSpacing = gFonts[fontId].lineSpacing; + printerTemplate.unk = gFonts[fontId].unk; + printerTemplate.fgColor = colors >> 16; + printerTemplate.shadowColor = colors >> 8; + printerTemplate.bgColor = colors; + printerTemplate.unk2 = 0; + printerTemplate.unk3 = 0; + printerTemplate.unk4 = 255; + return AddTextPrinter(&printerTemplate, speed, callback); +} + +THUMB_FUNC u16 AddTextPrinterParameterized3(u32 windowId, u8 fontId, const u8 *str, u32 x, u32 y, u32 speed, u32 colors, u32 letterSpacing, u32 lineSpacing, void (*callback)(void *, u16)) +{ + struct TextPrinterTemplate printerTemplate; + + printerTemplate.windowId = windowId; + printerTemplate.currentChar = str; + printerTemplate.fontId = fontId; + printerTemplate.x = (u8)x; + printerTemplate.y = (u8)y; + printerTemplate.currentX = (u8)x; + printerTemplate.currentY = (u8)y; + printerTemplate.letterSpacing = letterSpacing; + printerTemplate.lineSpacing = lineSpacing; + printerTemplate.unk = gFonts[fontId].unk; + printerTemplate.fgColor = colors >> 16; + printerTemplate.shadowColor = colors >> 8; + printerTemplate.bgColor = colors; + printerTemplate.unk2 = 0; + printerTemplate.unk3 = 0; + printerTemplate.unk4 = 255; + return AddTextPrinter(&printerTemplate, speed, callback); +} diff --git a/include/text.h b/include/text.h index ca7ea133..edc5f58c 100644 --- a/include/text.h +++ b/include/text.h @@ -60,5 +60,7 @@ void FUN_0201BD5C(void); u8 FUN_0201BD70(u32 param0); void FUN_0201BCFC(u32 param0); u16 AddTextPrinterParameterized(u32 windowId, u8 fontId, const u8 *str, u32 x, u32 y, u32 speed, void (*callback)(void *, u16)); +u16 AddTextPrinterParameterized2(u32 windowId, u8 fontId, const u8 *str, u32 x, u32 y, u32 speed, u32 colors, void (*callback)(void *, u16)); +u16 AddTextPrinterParameterized3(u32 windowId, u8 fontId, const u8 *str, u32 x, u32 y, u32 speed, u32 colors, u32 letterSpacing, u32 lineSpacing, void (*callback)(void *, u16)); #endif //POKEDIAMOND_TEXT_H |