diff options
Diffstat (limited to 'src/unk_text_util_2.c')
-rw-r--r-- | src/unk_text_util_2.c | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/src/unk_text_util_2.c b/src/unk_text_util_2.c index 4821ed776..bbc256915 100644 --- a/src/unk_text_util_2.c +++ b/src/unk_text_util_2.c @@ -15,86 +15,86 @@ u16 Font6Func(struct TextPrinter *textPrinter) u16 char_; struct TextPrinterSubStruct *sub; - sub = &textPrinter->sub_union.sub; + sub = &textPrinter->subUnion.sub; switch (textPrinter->state) { case 0: - if (gMain.heldKeys & (A_BUTTON | B_BUTTON) && sub->font_type_upper) + if (gMain.heldKeys & (A_BUTTON | B_BUTTON) && sub->hasPrintBeenSpedUp) { textPrinter->delayCounter = 0; } - if (textPrinter->delayCounter && textPrinter->text_speed) + if (textPrinter->delayCounter && textPrinter->textSpeed) { textPrinter->delayCounter --; - if (gTextFlags.flag_0 && gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (gTextFlags.canABSpeedUpPrint && gMain.newKeys & (A_BUTTON | B_BUTTON)) { - sub->font_type_upper = TRUE; + sub->hasPrintBeenSpedUp = TRUE; textPrinter->delayCounter = 0; } return 3; } - if (gTextFlags.flag_2) + if (gTextFlags.autoScroll) { textPrinter->delayCounter = 3; } else { - textPrinter->delayCounter = textPrinter->text_speed; + textPrinter->delayCounter = textPrinter->textSpeed; } - char_ = *textPrinter->subPrinter.current_text_offset ++; + char_ = *textPrinter->printerTemplate.currentChar++; switch (char_) { case EOS: return 1; case CHAR_NEWLINE: - textPrinter->subPrinter.currentX = textPrinter->subPrinter.x; - textPrinter->subPrinter.currentY += gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing; + textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x; + textPrinter->printerTemplate.currentY += gFonts[textPrinter->printerTemplate.fontId].maxLetterHeight + textPrinter->printerTemplate.lineSpacing; return 2; case PLACEHOLDER_BEGIN: - textPrinter->subPrinter.current_text_offset ++; + textPrinter->printerTemplate.currentChar++; return 2; case EXT_CTRL_CODE_BEGIN: - char_ = *textPrinter->subPrinter.current_text_offset ++; + char_ = *textPrinter->printerTemplate.currentChar++; switch (char_) { case 1: - textPrinter->subPrinter.fgColor = *textPrinter->subPrinter.current_text_offset ++; - GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + textPrinter->printerTemplate.fgColor = *textPrinter->printerTemplate.currentChar++; + GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor); return 2; case 2: - textPrinter->subPrinter.bgColor = *textPrinter->subPrinter.current_text_offset ++; - GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + textPrinter->printerTemplate.bgColor = *textPrinter->printerTemplate.currentChar++; + GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor); return 2; case 3: - textPrinter->subPrinter.shadowColor = *textPrinter->subPrinter.current_text_offset ++; - GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + textPrinter->printerTemplate.shadowColor = *textPrinter->printerTemplate.currentChar++; + GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor); return 2; case 4: - textPrinter->subPrinter.fgColor = *textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.bgColor = *++ textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.shadowColor = *++ textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.current_text_offset ++; + textPrinter->printerTemplate.fgColor = *textPrinter->printerTemplate.currentChar; + textPrinter->printerTemplate.bgColor = *++textPrinter->printerTemplate.currentChar; + textPrinter->printerTemplate.shadowColor = *++textPrinter->printerTemplate.currentChar; + textPrinter->printerTemplate.currentChar++; - GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor); return 2; case 5: - textPrinter->subPrinter.current_text_offset ++; + textPrinter->printerTemplate.currentChar++; return 2; case 6: - sub->font_type = *textPrinter->subPrinter.current_text_offset; - textPrinter->subPrinter.current_text_offset ++; + sub->glyphId = *textPrinter->printerTemplate.currentChar; + textPrinter->printerTemplate.currentChar++; return 2; case 7: return 2; case 8: - textPrinter->delayCounter = *textPrinter->subPrinter.current_text_offset ++; + textPrinter->delayCounter = *textPrinter->printerTemplate.currentChar++; textPrinter->state = 6; return 2; case 9: textPrinter->state = 1; - if (gTextFlags.flag_2) + if (gTextFlags.autoScroll) { - sub->frames_visible_counter = 0; + sub->autoScrollDelay = 0; } return 3; case 10: @@ -102,19 +102,19 @@ u16 Font6Func(struct TextPrinter *textPrinter) return 3; case 11: case 16: - textPrinter->subPrinter.current_text_offset += 2; + textPrinter->printerTemplate.currentChar += 2; return 2; case 12: - char_ = *++textPrinter->subPrinter.current_text_offset; + char_ = *++textPrinter->printerTemplate.currentChar; break; case 13: - textPrinter->subPrinter.currentX = textPrinter->subPrinter.x + *textPrinter->subPrinter.current_text_offset ++; + textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x + *textPrinter->printerTemplate.currentChar++; return 2; case 14: - textPrinter->subPrinter.currentY = textPrinter->subPrinter.y + *textPrinter->subPrinter.current_text_offset ++; + textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y + *textPrinter->printerTemplate.currentChar++; return 2; case 15: - FillWindowPixelBuffer(textPrinter->subPrinter.windowId, textPrinter->subPrinter.bgColor | (textPrinter->subPrinter.bgColor << 4)); + FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, textPrinter->printerTemplate.bgColor | (textPrinter->printerTemplate.bgColor << 4)); return 2; } break; @@ -127,15 +127,15 @@ u16 Font6Func(struct TextPrinter *textPrinter) TextPrinterInitDownArrowCounters(textPrinter); return 3; case 0xF9: - char_ = *textPrinter->subPrinter.current_text_offset ++ | 0x100; + char_ = *textPrinter->printerTemplate.currentChar++| 0x100; break; case 0xF8: - textPrinter->subPrinter.current_text_offset ++; + textPrinter->printerTemplate.currentChar++; return 0; } DecompressGlyphFont6(char_); CopyGlyphToWindow(textPrinter); - textPrinter->subPrinter.currentX += gUnknown_03002F90[0x80] + textPrinter->subPrinter.letterSpacing; + textPrinter->printerTemplate.currentX += gUnknown_03002F90.unk80 + textPrinter->printerTemplate.letterSpacing; return 0; case 1: if (TextPrinterWait(textPrinter)) @@ -146,9 +146,9 @@ u16 Font6Func(struct TextPrinter *textPrinter) case 2: if (TextPrinterWaitWithDownArrow(textPrinter)) { - FillWindowPixelBuffer(textPrinter->subPrinter.windowId, textPrinter->subPrinter.bgColor | (textPrinter->subPrinter.bgColor << 4)); - textPrinter->subPrinter.currentX = textPrinter->subPrinter.x; - textPrinter->subPrinter.currentY = textPrinter->subPrinter.y; + FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, textPrinter->printerTemplate.bgColor | (textPrinter->printerTemplate.bgColor << 4)); + textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x; + textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y; textPrinter->state = 0; } return 3; @@ -156,8 +156,8 @@ u16 Font6Func(struct TextPrinter *textPrinter) if (TextPrinterWaitWithDownArrow(textPrinter)) { TextPrinterClearDownArrow(textPrinter); - textPrinter->scrollDistance = gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing; - textPrinter->subPrinter.currentX = textPrinter->subPrinter.x; + textPrinter->scrollDistance = gFonts[textPrinter->printerTemplate.fontId].maxLetterHeight + textPrinter->printerTemplate.lineSpacing; + textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x; textPrinter->state = 4; } return 3; @@ -166,15 +166,15 @@ u16 Font6Func(struct TextPrinter *textPrinter) { if (textPrinter->scrollDistance < sUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed]) { - ScrollWindow(textPrinter->subPrinter.windowId, 0, textPrinter->scrollDistance, textPrinter->subPrinter.bgColor | (textPrinter->subPrinter.bgColor << 4)); + ScrollWindow(textPrinter->printerTemplate.windowId, 0, textPrinter->scrollDistance, textPrinter->printerTemplate.bgColor | (textPrinter->printerTemplate.bgColor << 4)); textPrinter->scrollDistance = 0; } else { - ScrollWindow(textPrinter->subPrinter.windowId, 0, sUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed], textPrinter->subPrinter.bgColor | (textPrinter->subPrinter.bgColor << 4)); + ScrollWindow(textPrinter->printerTemplate.windowId, 0, sUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed], textPrinter->printerTemplate.bgColor | (textPrinter->printerTemplate.bgColor << 4)); textPrinter->scrollDistance -= sUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed]; } - CopyWindowToVram(textPrinter->subPrinter.windowId, 2); + CopyWindowToVram(textPrinter->printerTemplate.windowId, 2); } else { @@ -206,12 +206,12 @@ static void DecompressGlyphFont6(u16 glyph) const u16 *glyphs; glyphs = sFont6BrailleGlyphs + 0x100 * (glyph / 8) + 0x10 * (glyph % 8); - DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90); - DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90 + 0x20)); - DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90 + 0x40)); - DecompressGlyphTile(glyphs + 0x88, (u16 *)(gUnknown_03002F90 + 0x60)); - gUnknown_03002F90[0x80] = 0x10; - gUnknown_03002F90[0x81] = 0x10; + DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90.unk0); + DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90.unk20)); + DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90.unk40)); + DecompressGlyphTile(glyphs + 0x88, (u16 *)(gUnknown_03002F90.unk60)); + gUnknown_03002F90.unk80 = 0x10; + gUnknown_03002F90.unk81 = 0x10; } u8 GetGlyphWidthFont6(void) |