diff options
-rw-r--r-- | gflib/text.c | 54 | ||||
-rw-r--r-- | gflib/text.h | 4 |
2 files changed, 26 insertions, 32 deletions
diff --git a/gflib/text.c b/gflib/text.c index f4b5444e8..d46ac7c0e 100644 --- a/gflib/text.c +++ b/gflib/text.c @@ -21,7 +21,7 @@ static u16 gLastTextFgColor; static u16 gLastTextShadowColor; const struct FontInfo *gFonts; -u8 gUnknown_03002F84; +bool8 gUnknown_03002F84; struct Struct_03002F90 gUnknown_03002F90; TextFlags gTextFlags; @@ -205,7 +205,7 @@ bool16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, voi CopyWindowToVram(gTempTextPrinter.printerTemplate.windowId, 2); gTextPrinters[printerTemplate->windowId].active = 0; } - gUnknown_03002F84 = 0; + gUnknown_03002F84 = FALSE; return TRUE; } @@ -213,7 +213,7 @@ void RunTextPrinters(void) { int i; - if (gUnknown_03002F84 == 0) + if (!gUnknown_03002F84) { for (i = 0; i < NUM_TEXT_PRINTERS; ++i) { @@ -592,7 +592,7 @@ u16 Font0Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (subStruct->hasGlyphIdBeenSet == FALSE) + if (!subStruct->hasGlyphIdBeenSet) { subStruct->glyphId = 0; subStruct->hasGlyphIdBeenSet = TRUE; @@ -604,7 +604,7 @@ u16 Font1Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (subStruct->hasGlyphIdBeenSet == FALSE) + if (!subStruct->hasGlyphIdBeenSet) { subStruct->glyphId = 1; subStruct->hasGlyphIdBeenSet = TRUE; @@ -616,7 +616,7 @@ u16 Font2Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (subStruct->hasGlyphIdBeenSet == FALSE) + if (!subStruct->hasGlyphIdBeenSet) { subStruct->glyphId = 2; subStruct->hasGlyphIdBeenSet = TRUE; @@ -628,7 +628,7 @@ u16 Font3Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (subStruct->hasGlyphIdBeenSet == FALSE) + if (!subStruct->hasGlyphIdBeenSet) { subStruct->glyphId = 3; subStruct->hasGlyphIdBeenSet = TRUE; @@ -640,7 +640,7 @@ u16 Font4Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (subStruct->hasGlyphIdBeenSet == FALSE) + if (!subStruct->hasGlyphIdBeenSet) { subStruct->glyphId = 4; subStruct->hasGlyphIdBeenSet = TRUE; @@ -652,7 +652,7 @@ u16 Font5Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (subStruct->hasGlyphIdBeenSet == FALSE) + if (!subStruct->hasGlyphIdBeenSet) { subStruct->glyphId = 5; subStruct->hasGlyphIdBeenSet = TRUE; @@ -664,7 +664,7 @@ u16 Font7Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (subStruct->hasGlyphIdBeenSet == FALSE) + if (!subStruct->hasGlyphIdBeenSet) { subStruct->glyphId = 7; subStruct->hasGlyphIdBeenSet = TRUE; @@ -676,7 +676,7 @@ u16 Font8Func(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (subStruct->hasGlyphIdBeenSet == FALSE) + if (!subStruct->hasGlyphIdBeenSet) { subStruct->glyphId = 8; subStruct->hasGlyphIdBeenSet = TRUE; @@ -688,7 +688,7 @@ void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter) { struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); - if (gTextFlags.autoScroll == 1) + if (gTextFlags.autoScroll == TRUE) { subStruct->autoScrollDelay = 0; } @@ -704,7 +704,7 @@ void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter) struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields); const u8 *arrowTiles; - if (gTextFlags.autoScroll == 0) + if (!gTextFlags.autoScroll) { if (subStruct->downArrowDelay != 0) { @@ -780,7 +780,7 @@ bool8 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter) bool16 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter) { bool8 result = FALSE; - if (gTextFlags.autoScroll != 0) + if (gTextFlags.autoScroll) { result = TextPrinterWaitAutoMode(textPrinter); } @@ -799,17 +799,14 @@ bool16 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter) bool16 TextPrinterWait(struct TextPrinter *textPrinter) { bool16 result = FALSE; - if (gTextFlags.autoScroll != 0) + if (gTextFlags.autoScroll) { result = TextPrinterWaitAutoMode(textPrinter); } - else + else if (gMain.newKeys & (A_BUTTON | B_BUTTON)) { - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) - { - result = TRUE; - PlaySE(SE_SELECT); - } + result = TRUE; + PlaySE(SE_SELECT); } return result; } @@ -825,7 +822,7 @@ void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *c else { FillWindowPixelRect(windowId, (bgColor << 4) | bgColor, x, y, 0x8, 0x10); - if (drawArrow == 0) + if (!drawArrow) { switch (gTextFlags.useAlternateDownArrow) { @@ -1017,10 +1014,10 @@ u16 RenderText(struct TextPrinter *textPrinter) textPrinter->minLetterSpacing = *textPrinter->printerTemplate.currentChar++; return 2; case EXT_CTRL_CODE_JPN: - textPrinter->japanese = 1; + textPrinter->japanese = TRUE; return 2; case EXT_CTRL_CODE_ENG: - textPrinter->japanese = 0; + textPrinter->japanese = FALSE; return 2; } break; @@ -1081,13 +1078,10 @@ u16 RenderText(struct TextPrinter *textPrinter) textPrinter->printerTemplate.currentX += width; } } + else if (textPrinter->japanese) + textPrinter->printerTemplate.currentX += (gUnknown_03002F90.unk80 + textPrinter->printerTemplate.letterSpacing); else - { - if (textPrinter->japanese) - textPrinter->printerTemplate.currentX += (gUnknown_03002F90.unk80 + textPrinter->printerTemplate.letterSpacing); - else - textPrinter->printerTemplate.currentX += gUnknown_03002F90.unk80; - } + textPrinter->printerTemplate.currentX += gUnknown_03002F90.unk80; return 0; case 1: if (TextPrinterWait(textPrinter)) diff --git a/gflib/text.h b/gflib/text.h index ba74cde6e..0d0f3341d 100644 --- a/gflib/text.h +++ b/gflib/text.h @@ -322,7 +322,7 @@ struct TextPrinter u8 delayCounter; u8 scrollDistance; u8 minLetterSpacing; // 0x20 - u8 japanese; + bool8 japanese; }; struct FontInfo @@ -372,7 +372,7 @@ struct Struct_03002F90 extern TextFlags gTextFlags; -extern u8 gUnknown_03002F84; +extern bool8 gUnknown_03002F84; extern struct Struct_03002F90 gUnknown_03002F90; void SetFontsPointer(const struct FontInfo *fonts); |