summaryrefslogtreecommitdiff
path: root/gflib/text.c
diff options
context:
space:
mode:
authorluckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com>2020-11-07 18:06:37 -0500
committerluckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com>2020-11-07 18:06:37 -0500
commita29b18ed2f27c2991b0894a69fa04738ba9522ca (patch)
tree4db08c6d6a2d585a0a42ee6f023faa9f6e8d13fb /gflib/text.c
parent8d2d34aae9767f283b3c34140920828e37540d23 (diff)
parent8b1c2c946b3b58cc938f0496a9af11a641749a1e (diff)
Merge branch 'master' of https://github.com/pret/pokeemerald
Diffstat (limited to 'gflib/text.c')
-rw-r--r--gflib/text.c86
1 files changed, 46 insertions, 40 deletions
diff --git a/gflib/text.c b/gflib/text.c
index a995c70a1..4cbad1376 100644
--- a/gflib/text.c
+++ b/gflib/text.c
@@ -21,7 +21,7 @@ static u16 gLastTextFgColor;
static u16 gLastTextShadowColor;
const struct FontInfo *gFonts;
-bool8 gUnknown_03002F84;
+u8 gUnknown_03002F84;
struct Struct_03002F90 gUnknown_03002F90;
TextFlags gTextFlags;
@@ -154,7 +154,7 @@ u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8
printerTemplate.currentY = y;
printerTemplate.letterSpacing = gFonts[fontId].letterSpacing;
printerTemplate.lineSpacing = gFonts[fontId].lineSpacing;
- printerTemplate.style = gFonts[fontId].style;
+ printerTemplate.unk = gFonts[fontId].unk;
printerTemplate.fgColor = gFonts[fontId].fgColor;
printerTemplate.bgColor = gFonts[fontId].bgColor;
printerTemplate.shadowColor = gFonts[fontId].shadowColor;
@@ -205,7 +205,7 @@ bool16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, voi
CopyWindowToVram(gTempTextPrinter.printerTemplate.windowId, 2);
gTextPrinters[printerTemplate->windowId].active = 0;
}
- gUnknown_03002F84 = FALSE;
+ gUnknown_03002F84 = 0;
return TRUE;
}
@@ -213,7 +213,7 @@ void RunTextPrinters(void)
{
int i;
- if (!gUnknown_03002F84)
+ if (gUnknown_03002F84 == 0)
{
for (i = 0; i < NUM_TEXT_PRINTERS; ++i)
{
@@ -451,18 +451,18 @@ u8 GetLastTextColor(u8 colorType)
{
switch (colorType)
{
- case COLOR_FOREGROUND:
+ case 0:
return gLastTextFgColor;
- case COLOR_BACKGROUND:
+ case 2:
return gLastTextBgColor;
- case COLOR_SHADOW:
+ case 1:
return gLastTextShadowColor;
default:
return 0;
}
}
-inline static void GLYPH_COPY(u8 *windowTiles, u32 widthOffset, u32 j, u32 i, u32 *ptr, s32 width, s32 height) //
+inline static void GLYPH_COPY(u8 *windowTiles, u32 widthOffset, u32 j, u32 i, u32 *ptr, s32 width, s32 height)
{
u32 xAdd, yAdd, r5, bits, toOrr, dummyX;
u8 *dst;
@@ -570,7 +570,7 @@ u16 Font0Func(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
- if (!subStruct->hasGlyphIdBeenSet)
+ if (subStruct->hasGlyphIdBeenSet == FALSE)
{
subStruct->glyphId = 0;
subStruct->hasGlyphIdBeenSet = TRUE;
@@ -582,7 +582,7 @@ u16 Font1Func(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
- if (!subStruct->hasGlyphIdBeenSet)
+ if (subStruct->hasGlyphIdBeenSet == FALSE)
{
subStruct->glyphId = 1;
subStruct->hasGlyphIdBeenSet = TRUE;
@@ -594,7 +594,7 @@ u16 Font2Func(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
- if (!subStruct->hasGlyphIdBeenSet)
+ if (subStruct->hasGlyphIdBeenSet == FALSE)
{
subStruct->glyphId = 2;
subStruct->hasGlyphIdBeenSet = TRUE;
@@ -606,7 +606,7 @@ u16 Font3Func(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
- if (!subStruct->hasGlyphIdBeenSet)
+ if (subStruct->hasGlyphIdBeenSet == FALSE)
{
subStruct->glyphId = 3;
subStruct->hasGlyphIdBeenSet = TRUE;
@@ -618,7 +618,7 @@ u16 Font4Func(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
- if (!subStruct->hasGlyphIdBeenSet)
+ if (subStruct->hasGlyphIdBeenSet == FALSE)
{
subStruct->glyphId = 4;
subStruct->hasGlyphIdBeenSet = TRUE;
@@ -630,7 +630,7 @@ u16 Font5Func(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
- if (!subStruct->hasGlyphIdBeenSet)
+ if (subStruct->hasGlyphIdBeenSet == FALSE)
{
subStruct->glyphId = 5;
subStruct->hasGlyphIdBeenSet = TRUE;
@@ -642,7 +642,7 @@ u16 Font7Func(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
- if (!subStruct->hasGlyphIdBeenSet)
+ if (subStruct->hasGlyphIdBeenSet == FALSE)
{
subStruct->glyphId = 7;
subStruct->hasGlyphIdBeenSet = TRUE;
@@ -654,7 +654,7 @@ u16 Font8Func(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
- if (!subStruct->hasGlyphIdBeenSet)
+ if (subStruct->hasGlyphIdBeenSet == FALSE)
{
subStruct->glyphId = 8;
subStruct->hasGlyphIdBeenSet = TRUE;
@@ -666,7 +666,7 @@ void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter)
{
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
- if (gTextFlags.autoScroll == TRUE)
+ if (gTextFlags.autoScroll == 1)
{
subStruct->autoScrollDelay = 0;
}
@@ -682,7 +682,7 @@ void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter)
struct TextPrinterSubStruct *subStruct = (struct TextPrinterSubStruct *)(&textPrinter->subStructFields);
const u8 *arrowTiles;
- if (!gTextFlags.autoScroll)
+ if (gTextFlags.autoScroll == 0)
{
if (subStruct->downArrowDelay != 0)
{
@@ -758,7 +758,7 @@ bool8 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter)
bool16 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter)
{
bool8 result = FALSE;
- if (gTextFlags.autoScroll)
+ if (gTextFlags.autoScroll != 0)
{
result = TextPrinterWaitAutoMode(textPrinter);
}
@@ -777,14 +777,17 @@ bool16 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter)
bool16 TextPrinterWait(struct TextPrinter *textPrinter)
{
bool16 result = FALSE;
- if (gTextFlags.autoScroll)
+ if (gTextFlags.autoScroll != 0)
{
result = TextPrinterWaitAutoMode(textPrinter);
}
- else if (JOY_NEW(A_BUTTON | B_BUTTON))
+ else
{
- result = TRUE;
- PlaySE(SE_SELECT);
+ if (JOY_NEW(A_BUTTON | B_BUTTON))
+ {
+ result = TRUE;
+ PlaySE(SE_SELECT);
+ }
}
return result;
}
@@ -800,7 +803,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)
+ if (drawArrow == 0)
{
switch (gTextFlags.useAlternateDownArrow)
{
@@ -992,10 +995,10 @@ u16 RenderText(struct TextPrinter *textPrinter)
textPrinter->minLetterSpacing = *textPrinter->printerTemplate.currentChar++;
return 2;
case EXT_CTRL_CODE_JPN:
- textPrinter->japanese = TRUE;
+ textPrinter->japanese = 1;
return 2;
case EXT_CTRL_CODE_ENG:
- textPrinter->japanese = FALSE;
+ textPrinter->japanese = 0;
return 2;
}
break;
@@ -1056,10 +1059,13 @@ u16 RenderText(struct TextPrinter *textPrinter)
textPrinter->printerTemplate.currentX += width;
}
}
- else if (textPrinter->japanese)
- textPrinter->printerTemplate.currentX += (gUnknown_03002F90.width + textPrinter->printerTemplate.letterSpacing);
else
- textPrinter->printerTemplate.currentX += gUnknown_03002F90.width;
+ {
+ if (textPrinter->japanese)
+ textPrinter->printerTemplate.currentX += (gUnknown_03002F90.width + textPrinter->printerTemplate.letterSpacing);
+ else
+ textPrinter->printerTemplate.currentX += gUnknown_03002F90.width;
+ }
return 0;
case 1:
if (TextPrinterWait(textPrinter))
@@ -1545,7 +1551,7 @@ void SetDefaultFontsPointer(void)
u8 GetFontAttribute(u8 fontId, u8 attributeId)
{
- u8 result = 0;
+ int result = 0;
switch (attributeId)
{
case FONTATTR_MAX_LETTER_WIDTH:
@@ -1560,8 +1566,8 @@ u8 GetFontAttribute(u8 fontId, u8 attributeId)
case FONTATTR_LINE_SPACING:
result = gFontInfos[fontId].lineSpacing;
break;
- case FONTATTR_STYLE:
- result = gFontInfos[fontId].style;
+ case FONTATTR_UNKNOWN:
+ result = gFontInfos[fontId].unk;
break;
case FONTATTR_COLOR_FOREGROUND:
result = gFontInfos[fontId].fgColor;
@@ -1591,7 +1597,7 @@ void DecompressGlyphFont0(u16 glyphId, bool32 isJapanese)
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40
gUnknown_03002F90.width = 8; // gGlyphWidth
- gUnknown_03002F90.height = 12; // gGlyphHeight
+ gUnknown_03002F90.height = 12; // gGlyphHeight
}
else
{
@@ -1634,7 +1640,7 @@ void DecompressGlyphFont7(u16 glyphId, bool32 isJapanese)
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40
gUnknown_03002F90.width = 8; // gGlyphWidth
- gUnknown_03002F90.height = 15; // gGlyphHeight
+ gUnknown_03002F90.height = 15; // gGlyphHeight
}
else
{
@@ -1676,7 +1682,7 @@ void DecompressGlyphFont8(u16 glyphId, bool32 isJapanese)
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40
gUnknown_03002F90.width = 8; // gGlyphWidth
- gUnknown_03002F90.height = 12; // gGlyphHeight
+ gUnknown_03002F90.height = 12; // gGlyphHeight
}
else
{
@@ -1716,10 +1722,10 @@ void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese)
{
glyphs = gFont2JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7));
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
- DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20);
- DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40);
- DecompressGlyphTile(glyphs + 0x88, gUnknown_03002F90.unk60);
- gUnknown_03002F90.width = gFont2JapaneseGlyphWidths[glyphId]; // gGlyphWidth
+ DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20); // gUnknown_03002F90 + 0x40
+ DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x20
+ DecompressGlyphTile(glyphs + 0x88, gUnknown_03002F90.unk60); // gUnknown_03002F90 + 0x60
+ gUnknown_03002F90.width = gFont2JapaneseGlyphWidths[glyphId]; // gGlyphWidth
gUnknown_03002F90.height = 14; // gGlyphHeight
}
else
@@ -1763,7 +1769,7 @@ void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese)
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40
gUnknown_03002F90.width = 8; // gGlyphWidth
- gUnknown_03002F90.height = 15; // gGlyphHeight
+ gUnknown_03002F90.height = 15; // gGlyphHeight
}
else
{