summaryrefslogtreecommitdiff
path: root/arm9/src/text.c
diff options
context:
space:
mode:
Diffstat (limited to 'arm9/src/text.c')
-rw-r--r--arm9/src/text.c186
1 files changed, 36 insertions, 150 deletions
diff --git a/arm9/src/text.c b/arm9/src/text.c
index aadb84c0..3034baab 100644
--- a/arm9/src/text.c
+++ b/arm9/src/text.c
@@ -7,7 +7,10 @@ const struct FontInfo *gFonts = NULL;
u16 UNK_021C5734[0x100];
u32 UNK_021C5714[8];
-u8 UNK_021C570C[8];
+u16 UNK_021C570E;
+u16 UNK_021C5710;
+u16 UNK_021C5712;
+u8 UNK_021C570C;
extern u32 FUN_0200CA7C(void (*func)(u32, struct TextPrinter *), struct TextPrinter *printer, u32 param2);
@@ -187,7 +190,7 @@ THUMB_FUNC u16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u32 s
printer->printerTemplate = *printerTemplate;
printer->printerTemplate.currentChar = String_c_str((struct String *)printer->printerTemplate.currentChar); //TODO clean up
printer->callback = callback;
- UNK_021C570C[0] = 0;
+ UNK_021C570C = 0;
FUN_0201C1A8(printer);
if (speed != 0xff && speed != 0)
{
@@ -222,7 +225,7 @@ THUMB_FUNC u16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u32 s
THUMB_FUNC void RunTextPrinter(u32 param0, struct TextPrinter *printer)
{
#pragma unused(param0)
- if (UNK_021C570C[0] == 0)
+ if (UNK_021C570C == 0)
{
if (printer->Unk29 == 0)
{
@@ -268,156 +271,39 @@ THUMB_FUNC u32 RenderFont(struct TextPrinter *printer)
}
}
-#ifdef NONMATCHING
THUMB_FUNC void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor)
{
- u32 fg12, bg12, shadow12;
- u32 temp;
-
- u16 *current = UNK_021C570C;
-
- bg12 = bgColor << 12;
- fg12 = fgColor << 12;
- shadow12 = shadowColor << 12;
-
- temp = (bgColor << 8) | (bgColor << 4) | bgColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (fgColor << 8) | (bgColor << 4) | bgColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (shadowColor << 8) | (bgColor << 4) | bgColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (bgColor << 8) | (fgColor << 4) | bgColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (fgColor << 8) | (fgColor << 4) | bgColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (shadowColor << 8) | (fgColor << 4) | bgColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (bgColor << 8) | (shadowColor << 4) | bgColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (fgColor << 8) | (shadowColor << 4) | bgColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (shadowColor << 8) | (shadowColor << 4) | bgColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (bgColor << 8) | (bgColor << 4) | fgColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (fgColor << 8) | (bgColor << 4) | fgColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (shadowColor << 8) | (bgColor << 4) | fgColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (bgColor << 8) | (fgColor << 4) | fgColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (fgColor << 8) | (fgColor << 4) | fgColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (shadowColor << 8) | (fgColor << 4) | fgColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (bgColor << 8) | (shadowColor << 4) | fgColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (fgColor << 8) | (shadowColor << 4) | fgColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (shadowColor << 8) | (shadowColor << 4) | fgColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (bgColor << 8) | (bgColor << 4) | shadowColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (fgColor << 8) | (bgColor << 4) | shadowColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (shadowColor << 8) | (bgColor << 4) | shadowColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (bgColor << 8) | (fgColor << 4) | shadowColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (fgColor << 8) | (fgColor << 4) | shadowColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (shadowColor << 8) | (fgColor << 4) | shadowColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (bgColor << 8) | (shadowColor << 4) | shadowColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (fgColor << 8) | (shadowColor << 4) | shadowColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
-
- temp = (shadowColor << 8) | (shadowColor << 4) | shadowColor;
- *(current++) = (bg12) | temp;
- *(current++) = (fg12) | temp;
- *(current++) = (shadow12) | temp;
+ s32 r5 = 0;
+ u32 sp20[4];
+ s32 i; // sp14
+ s32 j; // sp10
+ s32 k; // spC
+ s32 l; // r3
+
+ sp20[0] = 0;
+ sp20[1] = fgColor;
+ sp20[2] = shadowColor;
+ sp20[3] = bgColor;
+
+ // FIXME: Need these to be accessed by a pointer to UNK_021C570C
+ UNK_021C5712 = bgColor;
+ UNK_021C570E = fgColor;
+ UNK_021C5710 = shadowColor;
+
+ for (i = 0; i < 4; i++)
+ {
+ for (j = 0; j < 4; j++)
+ {
+ for (k = 0; k < 4; k++)
+ {
+ for (l = 0; l < 4; l++)
+ {
+ UNK_021C5734[r5++] = (u16)((sp20[l] << 12) | (sp20[k] << 8) | (sp20[j] << 4) | (sp20[i] << 0));
+ }
+ }
+ }
+ }
}
-#else
-GLOBAL_ASM("asm/nonmatchings/GenerateFontHalfRowLookupTable.s")
-#endif
THUMB_FUNC void DecompressGlyphTile(const u16 *src, u16 *dst)
{