mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Document some text-related things
This commit is contained in:
parent
5cb8ec4247
commit
6cceb05cb7
@ -1,4 +1,4 @@
|
|||||||
gFonts
|
gFonts
|
||||||
gUnknown_03002F84
|
gDisableTextPrinters
|
||||||
gUnknown_03002F90
|
gCurGlyph
|
||||||
gTextFlags
|
gTextFlags
|
||||||
|
232
gflib/text.c
232
gflib/text.c
@ -21,8 +21,8 @@ static u16 gLastTextFgColor;
|
|||||||
static u16 gLastTextShadowColor;
|
static u16 gLastTextShadowColor;
|
||||||
|
|
||||||
const struct FontInfo *gFonts;
|
const struct FontInfo *gFonts;
|
||||||
u8 gUnknown_03002F84;
|
u8 gDisableTextPrinters;
|
||||||
struct Struct_03002F90 gUnknown_03002F90;
|
struct TextGlyph gCurGlyph;
|
||||||
TextFlags gTextFlags;
|
TextFlags gTextFlags;
|
||||||
|
|
||||||
const u8 gFontHalfRowOffsets[] =
|
const u8 gFontHalfRowOffsets[] =
|
||||||
@ -204,7 +204,7 @@ bool16 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, voi
|
|||||||
CopyWindowToVram(gTempTextPrinter.printerTemplate.windowId, 2);
|
CopyWindowToVram(gTempTextPrinter.printerTemplate.windowId, 2);
|
||||||
gTextPrinters[printerTemplate->windowId].active = 0;
|
gTextPrinters[printerTemplate->windowId].active = 0;
|
||||||
}
|
}
|
||||||
gUnknown_03002F84 = 0;
|
gDisableTextPrinters = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ void RunTextPrinters(void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (gUnknown_03002F84 == 0)
|
if (gDisableTextPrinters == 0)
|
||||||
{
|
{
|
||||||
for (i = 0; i < NUM_TEXT_PRINTERS; ++i)
|
for (i = 0; i < NUM_TEXT_PRINTERS; ++i)
|
||||||
{
|
{
|
||||||
@ -461,9 +461,9 @@ u8 GetLastTextColor(u8 colorType)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 *glyphPixels, s32 width, s32 height)
|
||||||
{
|
{
|
||||||
u32 xAdd, yAdd, r5, bits, toOrr, dummyX;
|
u32 xAdd, yAdd, pixelData, bits, toOrr, dummyX;
|
||||||
u8 *dst;
|
u8 *dst;
|
||||||
|
|
||||||
xAdd = j + width;
|
xAdd = j + width;
|
||||||
@ -471,69 +471,69 @@ inline static void GLYPH_COPY(u8 *windowTiles, u32 widthOffset, u32 j, u32 i, u3
|
|||||||
dummyX = j;
|
dummyX = j;
|
||||||
for (; i < yAdd; i++)
|
for (; i < yAdd; i++)
|
||||||
{
|
{
|
||||||
r5 = *ptr++;
|
pixelData = *glyphPixels++;
|
||||||
for (j = dummyX; j < xAdd; j++)
|
for (j = dummyX; j < xAdd; j++)
|
||||||
{
|
{
|
||||||
if ((toOrr = r5 & 0xF))
|
if ((toOrr = pixelData & 0xF))
|
||||||
{
|
{
|
||||||
dst = windowTiles + ((j / 8) * 32) + ((j % 8) / 2) + ((i / 8) * widthOffset) + ((i % 8) * 4);
|
dst = windowTiles + ((j / 8) * 32) + ((j % 8) / 2) + ((i / 8) * widthOffset) + ((i % 8) * 4);
|
||||||
bits = ((j & 1) * 4);
|
bits = ((j & 1) * 4);
|
||||||
*dst = (toOrr << bits) | (*dst & (0xF0 >> bits));
|
*dst = (toOrr << bits) | (*dst & (0xF0 >> bits));
|
||||||
}
|
}
|
||||||
r5 >>= 4;
|
pixelData >>= 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CopyGlyphToWindow(struct TextPrinter *textPrinter)
|
void CopyGlyphToWindow(struct TextPrinter *textPrinter)
|
||||||
{
|
{
|
||||||
struct Window *win;
|
struct Window *window;
|
||||||
struct WindowTemplate *winTempl;
|
struct WindowTemplate *template;
|
||||||
u32 *unkStruct;
|
u32 *glyphPixels;
|
||||||
u32 currX, currY, widthOffset;
|
u32 currX, currY, widthOffset;
|
||||||
s32 r4, r0;
|
s32 glyphWidth, glyphHeight;
|
||||||
u8 *windowTiles;
|
u8 *windowTiles;
|
||||||
|
|
||||||
win = &gWindows[textPrinter->printerTemplate.windowId];
|
window = &gWindows[textPrinter->printerTemplate.windowId];
|
||||||
winTempl = &win->window;
|
template = &window->window;
|
||||||
|
|
||||||
if ((r4 = (winTempl->width * 8) - textPrinter->printerTemplate.currentX) > gUnknown_03002F90.width)
|
if ((glyphWidth = (template->width * 8) - textPrinter->printerTemplate.currentX) > gCurGlyph.width)
|
||||||
r4 = gUnknown_03002F90.width;
|
glyphWidth = gCurGlyph.width;
|
||||||
|
|
||||||
if ((r0 = (winTempl->height * 8) - textPrinter->printerTemplate.currentY) > gUnknown_03002F90.height)
|
if ((glyphHeight = (template->height * 8) - textPrinter->printerTemplate.currentY) > gCurGlyph.height)
|
||||||
r0 = gUnknown_03002F90.height;
|
glyphHeight = gCurGlyph.height;
|
||||||
|
|
||||||
currX = textPrinter->printerTemplate.currentX;
|
currX = textPrinter->printerTemplate.currentX;
|
||||||
currY = textPrinter->printerTemplate.currentY;
|
currY = textPrinter->printerTemplate.currentY;
|
||||||
unkStruct = (u32 *)&gUnknown_03002F90.unk0;
|
glyphPixels = gCurGlyph.gfxBufferTop;
|
||||||
windowTiles = win->tileData;
|
windowTiles = window->tileData;
|
||||||
widthOffset = winTempl->width * 32;
|
widthOffset = template->width * 32;
|
||||||
|
|
||||||
if (r4 < 9)
|
if (glyphWidth < 9)
|
||||||
{
|
{
|
||||||
if (r0 < 9)
|
if (glyphHeight < 9)
|
||||||
{
|
{
|
||||||
GLYPH_COPY(windowTiles, widthOffset, currX, currY, unkStruct, r4, r0);
|
GLYPH_COPY(windowTiles, widthOffset, currX, currY, glyphPixels, glyphWidth, glyphHeight);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GLYPH_COPY(windowTiles, widthOffset, currX, currY, unkStruct, r4, 8);
|
GLYPH_COPY(windowTiles, widthOffset, currX, currY, glyphPixels, glyphWidth, 8);
|
||||||
GLYPH_COPY(windowTiles, widthOffset, currX, currY + 8, unkStruct + 16, r4, r0 - 8);
|
GLYPH_COPY(windowTiles, widthOffset, currX, currY + 8, glyphPixels + 16, glyphWidth, glyphHeight - 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (r0 < 9)
|
if (glyphHeight < 9)
|
||||||
{
|
{
|
||||||
GLYPH_COPY(windowTiles, widthOffset, currX, currY, unkStruct, 8, r0);
|
GLYPH_COPY(windowTiles, widthOffset, currX, currY, glyphPixels, 8, glyphHeight);
|
||||||
GLYPH_COPY(windowTiles, widthOffset, currX + 8, currY, unkStruct + 8, r4 - 8, r0);
|
GLYPH_COPY(windowTiles, widthOffset, currX + 8, currY, glyphPixels + 8, glyphWidth - 8, glyphHeight);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GLYPH_COPY(windowTiles, widthOffset, currX, currY, unkStruct, 8, 8);
|
GLYPH_COPY(windowTiles, widthOffset, currX, currY, glyphPixels, 8, 8);
|
||||||
GLYPH_COPY(windowTiles, widthOffset, currX + 8, currY, unkStruct + 8, r4 - 8, 8);
|
GLYPH_COPY(windowTiles, widthOffset, currX + 8, currY, glyphPixels + 8, glyphWidth - 8, 8);
|
||||||
GLYPH_COPY(windowTiles, widthOffset, currX, currY + 8, unkStruct + 16, 8, r0 - 8);
|
GLYPH_COPY(windowTiles, widthOffset, currX, currY + 8, glyphPixels + 16, 8, glyphHeight - 8);
|
||||||
GLYPH_COPY(windowTiles, widthOffset, currX + 8, currY + 8, unkStruct + 24, r4 - 8, r0 - 8);
|
GLYPH_COPY(windowTiles, widthOffset, currX + 8, currY + 8, glyphPixels + 24, glyphWidth - 8, glyphHeight - 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -542,7 +542,7 @@ void ClearTextSpan(struct TextPrinter *textPrinter, u32 width)
|
|||||||
{
|
{
|
||||||
struct Window *window;
|
struct Window *window;
|
||||||
struct Bitmap pixels_data;
|
struct Bitmap pixels_data;
|
||||||
struct Struct_03002F90 *gUnk;
|
struct TextGlyph *glyph;
|
||||||
u8* glyphHeight;
|
u8* glyphHeight;
|
||||||
|
|
||||||
if (gLastTextBgColor != 0)
|
if (gLastTextBgColor != 0)
|
||||||
@ -552,8 +552,8 @@ void ClearTextSpan(struct TextPrinter *textPrinter, u32 width)
|
|||||||
pixels_data.width = window->window.width << 3;
|
pixels_data.width = window->window.width << 3;
|
||||||
pixels_data.height = window->window.height << 3;
|
pixels_data.height = window->window.height << 3;
|
||||||
|
|
||||||
gUnk = &gUnknown_03002F90;
|
glyph = &gCurGlyph;
|
||||||
glyphHeight = &gUnk->height;
|
glyphHeight = &glyph->height;
|
||||||
|
|
||||||
FillBitmapRect4Bit(
|
FillBitmapRect4Bit(
|
||||||
&pixels_data,
|
&pixels_data,
|
||||||
@ -1015,8 +1015,8 @@ u16 RenderText(struct TextPrinter *textPrinter)
|
|||||||
break;
|
break;
|
||||||
case CHAR_KEYPAD_ICON:
|
case CHAR_KEYPAD_ICON:
|
||||||
currChar = *textPrinter->printerTemplate.currentChar++;
|
currChar = *textPrinter->printerTemplate.currentChar++;
|
||||||
gUnknown_03002F90.width = DrawKeypadIcon(textPrinter->printerTemplate.windowId, currChar, textPrinter->printerTemplate.currentX, textPrinter->printerTemplate.currentY);
|
gCurGlyph.width = DrawKeypadIcon(textPrinter->printerTemplate.windowId, currChar, textPrinter->printerTemplate.currentX, textPrinter->printerTemplate.currentY);
|
||||||
textPrinter->printerTemplate.currentX += gUnknown_03002F90.width + textPrinter->printerTemplate.letterSpacing;
|
textPrinter->printerTemplate.currentX += gCurGlyph.width + textPrinter->printerTemplate.letterSpacing;
|
||||||
return 0;
|
return 0;
|
||||||
case EOS:
|
case EOS:
|
||||||
return 1;
|
return 1;
|
||||||
@ -1050,8 +1050,8 @@ u16 RenderText(struct TextPrinter *textPrinter)
|
|||||||
|
|
||||||
if (textPrinter->minLetterSpacing)
|
if (textPrinter->minLetterSpacing)
|
||||||
{
|
{
|
||||||
textPrinter->printerTemplate.currentX += gUnknown_03002F90.width;
|
textPrinter->printerTemplate.currentX += gCurGlyph.width;
|
||||||
width = textPrinter->minLetterSpacing - gUnknown_03002F90.width;
|
width = textPrinter->minLetterSpacing - gCurGlyph.width;
|
||||||
if (width > 0)
|
if (width > 0)
|
||||||
{
|
{
|
||||||
ClearTextSpan(textPrinter, width);
|
ClearTextSpan(textPrinter, width);
|
||||||
@ -1061,9 +1061,9 @@ u16 RenderText(struct TextPrinter *textPrinter)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (textPrinter->japanese)
|
if (textPrinter->japanese)
|
||||||
textPrinter->printerTemplate.currentX += (gUnknown_03002F90.width + textPrinter->printerTemplate.letterSpacing);
|
textPrinter->printerTemplate.currentX += (gCurGlyph.width + textPrinter->printerTemplate.letterSpacing);
|
||||||
else
|
else
|
||||||
textPrinter->printerTemplate.currentX += gUnknown_03002F90.width;
|
textPrinter->printerTemplate.currentX += gCurGlyph.width;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
case 1:
|
case 1:
|
||||||
@ -1499,8 +1499,8 @@ u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str)
|
|||||||
DecompressGlyphFont1(temp, 1);
|
DecompressGlyphFont1(temp, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
CpuCopy32(gUnknown_03002F90.unk0, pixels, 0x20);
|
CpuCopy32(gCurGlyph.gfxBufferTop, pixels, 0x20);
|
||||||
CpuCopy32(gUnknown_03002F90.unk40, pixels + 0x20, 0x20);
|
CpuCopy32(gCurGlyph.gfxBufferBottom, pixels + 0x20, 0x20);
|
||||||
pixels += 0x40;
|
pixels += 0x40;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1592,30 +1592,30 @@ void DecompressGlyphFont0(u16 glyphId, bool32 isJapanese)
|
|||||||
if (isJapanese == 1)
|
if (isJapanese == 1)
|
||||||
{
|
{
|
||||||
glyphs = gFont0JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF));
|
glyphs = gFont0JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF));
|
||||||
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
|
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
|
||||||
DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40
|
DecompressGlyphTile(glyphs + 0x80, gCurGlyph.gfxBufferBottom);
|
||||||
gUnknown_03002F90.width = 8; // gGlyphWidth
|
gCurGlyph.width = 8;
|
||||||
gUnknown_03002F90.height = 12; // gGlyphHeight
|
gCurGlyph.height = 12;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glyphs = gFont0LatinGlyphs + (0x20 * glyphId);
|
glyphs = gFont0LatinGlyphs + (0x20 * glyphId);
|
||||||
gUnknown_03002F90.width = gFont0LatinGlyphWidths[glyphId];
|
gCurGlyph.width = gFont0LatinGlyphWidths[glyphId];
|
||||||
|
|
||||||
if (gUnknown_03002F90.width <= 8)
|
if (gCurGlyph.width <= 8)
|
||||||
{
|
{
|
||||||
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
|
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
|
||||||
DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
|
DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
|
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
|
||||||
DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20);
|
DecompressGlyphTile(glyphs + 0x8, gCurGlyph.gfxBufferTop + 8);
|
||||||
DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
|
DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom);
|
||||||
DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60);
|
DecompressGlyphTile(glyphs + 0x18, gCurGlyph.gfxBufferBottom + 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
gUnknown_03002F90.height = 13;
|
gCurGlyph.height = 13;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1635,30 +1635,30 @@ void DecompressGlyphFont7(u16 glyphId, bool32 isJapanese)
|
|||||||
{
|
{
|
||||||
int eff;
|
int eff;
|
||||||
glyphs = gFont1JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & (eff = 0xF))); // shh, no questions, only matching now
|
glyphs = gFont1JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & (eff = 0xF))); // shh, no questions, only matching now
|
||||||
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
|
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
|
||||||
DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40
|
DecompressGlyphTile(glyphs + 0x80, gCurGlyph.gfxBufferBottom);
|
||||||
gUnknown_03002F90.width = 8; // gGlyphWidth
|
gCurGlyph.width = 8;
|
||||||
gUnknown_03002F90.height = 15; // gGlyphHeight
|
gCurGlyph.height = 15;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glyphs = gFont7LatinGlyphs + (0x20 * glyphId);
|
glyphs = gFont7LatinGlyphs + (0x20 * glyphId);
|
||||||
gUnknown_03002F90.width = gFont7LatinGlyphWidths[glyphId];
|
gCurGlyph.width = gFont7LatinGlyphWidths[glyphId];
|
||||||
|
|
||||||
if (gUnknown_03002F90.width <= 8)
|
if (gCurGlyph.width <= 8)
|
||||||
{
|
{
|
||||||
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
|
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
|
||||||
DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
|
DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
|
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
|
||||||
DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20);
|
DecompressGlyphTile(glyphs + 0x8, gCurGlyph.gfxBufferTop + 8);
|
||||||
DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
|
DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom);
|
||||||
DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60);
|
DecompressGlyphTile(glyphs + 0x18, gCurGlyph.gfxBufferBottom + 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
gUnknown_03002F90.height = 15;
|
gCurGlyph.height = 15;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1677,30 +1677,30 @@ void DecompressGlyphFont8(u16 glyphId, bool32 isJapanese)
|
|||||||
if (isJapanese == TRUE)
|
if (isJapanese == TRUE)
|
||||||
{
|
{
|
||||||
glyphs = gFont0JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF));
|
glyphs = gFont0JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF));
|
||||||
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
|
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
|
||||||
DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40
|
DecompressGlyphTile(glyphs + 0x80, gCurGlyph.gfxBufferBottom);
|
||||||
gUnknown_03002F90.width = 8; // gGlyphWidth
|
gCurGlyph.width = 8;
|
||||||
gUnknown_03002F90.height = 12; // gGlyphHeight
|
gCurGlyph.height = 12;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glyphs = gFont8LatinGlyphs + (0x20 * glyphId);
|
glyphs = gFont8LatinGlyphs + (0x20 * glyphId);
|
||||||
gUnknown_03002F90.width = gFont8LatinGlyphWidths[glyphId];
|
gCurGlyph.width = gFont8LatinGlyphWidths[glyphId];
|
||||||
|
|
||||||
if (gUnknown_03002F90.width <= 8)
|
if (gCurGlyph.width <= 8)
|
||||||
{
|
{
|
||||||
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
|
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
|
||||||
DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
|
DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
|
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
|
||||||
DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20);
|
DecompressGlyphTile(glyphs + 0x8, gCurGlyph.gfxBufferTop + 8);
|
||||||
DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
|
DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom);
|
||||||
DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60);
|
DecompressGlyphTile(glyphs + 0x18, gCurGlyph.gfxBufferBottom + 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
gUnknown_03002F90.height = 12;
|
gCurGlyph.height = 12;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1719,32 +1719,32 @@ void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese)
|
|||||||
if (isJapanese == TRUE)
|
if (isJapanese == TRUE)
|
||||||
{
|
{
|
||||||
glyphs = gFont2JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7));
|
glyphs = gFont2JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7));
|
||||||
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
|
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
|
||||||
DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20); // gUnknown_03002F90 + 0x40
|
DecompressGlyphTile(glyphs + 0x8, gCurGlyph.gfxBufferTop + 8);
|
||||||
DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x20
|
DecompressGlyphTile(glyphs + 0x80, gCurGlyph.gfxBufferBottom); // gCurGlyph + 0x20
|
||||||
DecompressGlyphTile(glyphs + 0x88, gUnknown_03002F90.unk60); // gUnknown_03002F90 + 0x60
|
DecompressGlyphTile(glyphs + 0x88, gCurGlyph.gfxBufferBottom + 8); // gCurGlyph + 0x60
|
||||||
gUnknown_03002F90.width = gFont2JapaneseGlyphWidths[glyphId]; // gGlyphWidth
|
gCurGlyph.width = gFont2JapaneseGlyphWidths[glyphId];
|
||||||
gUnknown_03002F90.height = 14; // gGlyphHeight
|
gCurGlyph.height = 14;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glyphs = gFont2LatinGlyphs + (0x20 * glyphId);
|
glyphs = gFont2LatinGlyphs + (0x20 * glyphId);
|
||||||
gUnknown_03002F90.width = gFont2LatinGlyphWidths[glyphId];
|
gCurGlyph.width = gFont2LatinGlyphWidths[glyphId];
|
||||||
|
|
||||||
if (gUnknown_03002F90.width <= 8)
|
if (gCurGlyph.width <= 8)
|
||||||
{
|
{
|
||||||
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
|
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
|
||||||
DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
|
DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
|
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
|
||||||
DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20);
|
DecompressGlyphTile(glyphs + 0x8, gCurGlyph.gfxBufferTop + 8);
|
||||||
DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
|
DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom);
|
||||||
DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60);
|
DecompressGlyphTile(glyphs + 0x18, gCurGlyph.gfxBufferBottom + 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
gUnknown_03002F90.height = 14;
|
gCurGlyph.height = 14;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1764,30 +1764,30 @@ void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese)
|
|||||||
{
|
{
|
||||||
int eff;
|
int eff;
|
||||||
glyphs = gFont1JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & (eff = 0xF))); // shh, no questions, only matching now
|
glyphs = gFont1JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & (eff = 0xF))); // shh, no questions, only matching now
|
||||||
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
|
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
|
||||||
DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40
|
DecompressGlyphTile(glyphs + 0x80, gCurGlyph.gfxBufferBottom);
|
||||||
gUnknown_03002F90.width = 8; // gGlyphWidth
|
gCurGlyph.width = 8;
|
||||||
gUnknown_03002F90.height = 15; // gGlyphHeight
|
gCurGlyph.height = 15;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glyphs = gFont1LatinGlyphs + (0x20 * glyphId);
|
glyphs = gFont1LatinGlyphs + (0x20 * glyphId);
|
||||||
gUnknown_03002F90.width = gFont1LatinGlyphWidths[glyphId];
|
gCurGlyph.width = gFont1LatinGlyphWidths[glyphId];
|
||||||
|
|
||||||
if (gUnknown_03002F90.width <= 8)
|
if (gCurGlyph.width <= 8)
|
||||||
{
|
{
|
||||||
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
|
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
|
||||||
DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
|
DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
|
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
|
||||||
DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20);
|
DecompressGlyphTile(glyphs + 0x8, gCurGlyph.gfxBufferTop + 8);
|
||||||
DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
|
DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom);
|
||||||
DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60);
|
DecompressGlyphTile(glyphs + 0x18, gCurGlyph.gfxBufferBottom + 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
gUnknown_03002F90.height = 15;
|
gCurGlyph.height = 15;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1804,8 +1804,8 @@ void DecompressGlyphFont9(u16 glyphId)
|
|||||||
const u16* glyphs;
|
const u16* glyphs;
|
||||||
|
|
||||||
glyphs = gFont9JapaneseGlyphs + (0x100 * (glyphId >> 4)) + (0x8 * (glyphId & 0xF));
|
glyphs = gFont9JapaneseGlyphs + (0x100 * (glyphId >> 4)) + (0x8 * (glyphId & 0xF));
|
||||||
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
|
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
|
||||||
DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40);
|
DecompressGlyphTile(glyphs + 0x80, gCurGlyph.gfxBufferBottom);
|
||||||
gUnknown_03002F90.width = 8;
|
gCurGlyph.width = 8;
|
||||||
gUnknown_03002F90.height = 12;
|
gCurGlyph.height = 12;
|
||||||
}
|
}
|
||||||
|
12
gflib/text.h
12
gflib/text.h
@ -360,20 +360,18 @@ typedef struct {
|
|||||||
bool8 forceMidTextSpeed:1;
|
bool8 forceMidTextSpeed:1;
|
||||||
} TextFlags;
|
} TextFlags;
|
||||||
|
|
||||||
struct Struct_03002F90
|
struct TextGlyph
|
||||||
{
|
{
|
||||||
u32 unk0[8];
|
u32 gfxBufferTop[16];
|
||||||
u32 unk20[8];
|
u32 gfxBufferBottom[16];
|
||||||
u32 unk40[8];
|
|
||||||
u32 unk60[8];
|
|
||||||
u8 width;
|
u8 width;
|
||||||
u8 height;
|
u8 height;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TextFlags gTextFlags;
|
extern TextFlags gTextFlags;
|
||||||
|
|
||||||
extern u8 gUnknown_03002F84;
|
extern u8 gDisableTextPrinters;
|
||||||
extern struct Struct_03002F90 gUnknown_03002F90;
|
extern struct TextGlyph gCurGlyph;
|
||||||
|
|
||||||
void SetFontsPointer(const struct FontInfo *fonts);
|
void SetFontsPointer(const struct FontInfo *fonts);
|
||||||
void DeactivateAllTextPrinters(void);
|
void DeactivateAllTextPrinters(void);
|
||||||
|
@ -425,21 +425,21 @@ static void StartBardSong(bool8 useTemporaryLyrics)
|
|||||||
gTasks[taskId].tUseTemporaryLyrics = useTemporaryLyrics;
|
gTasks[taskId].tUseTemporaryLyrics = useTemporaryLyrics;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_81206F0(void)
|
static void EnableTextPrinters(void)
|
||||||
{
|
{
|
||||||
gUnknown_03002F84 = FALSE;
|
gDisableTextPrinters = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BardSong_TextSubPrinter(struct TextPrinterTemplate * printer, u16 a1)
|
static void BardSong_DisableTextPrinters(struct TextPrinterTemplate * printer, u16 a1)
|
||||||
{
|
{
|
||||||
gUnknown_03002F84 = TRUE;
|
gDisableTextPrinters = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8120708(const u8 * src)
|
static void sub_8120708(const u8 * src)
|
||||||
{
|
{
|
||||||
DrawDialogueFrame(0, 0);
|
DrawDialogueFrame(0, 0);
|
||||||
AddTextPrinterParameterized(0, 1, src, 0, 1, 1, BardSong_TextSubPrinter);
|
AddTextPrinterParameterized(0, 1, src, 0, 1, 1, BardSong_DisableTextPrinters);
|
||||||
gUnknown_03002F84 = TRUE;
|
gDisableTextPrinters = TRUE;
|
||||||
CopyWindowToVram(0, 3);
|
CopyWindowToVram(0, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -620,7 +620,7 @@ static void Task_BardSong(u8 taskId)
|
|||||||
else if (gStringVar4[task->tCharIndex] == CHAR_SPACE)
|
else if (gStringVar4[task->tCharIndex] == CHAR_SPACE)
|
||||||
{
|
{
|
||||||
|
|
||||||
sub_81206F0();
|
EnableTextPrinters();
|
||||||
task->tCharIndex++;
|
task->tCharIndex++;
|
||||||
task->tState = 2;
|
task->tState = 2;
|
||||||
task->data[2] = 0;
|
task->data[2] = 0;
|
||||||
@ -640,7 +640,7 @@ static void Task_BardSong(u8 taskId)
|
|||||||
else if (gStringVar4[task->tCharIndex] == CHAR_SONG_WORD_SEPARATOR)
|
else if (gStringVar4[task->tCharIndex] == CHAR_SONG_WORD_SEPARATOR)
|
||||||
{
|
{
|
||||||
gStringVar4[task->tCharIndex] = CHAR_SPACE; // restore it back to a space
|
gStringVar4[task->tCharIndex] = CHAR_SPACE; // restore it back to a space
|
||||||
sub_81206F0();
|
EnableTextPrinters();
|
||||||
task->tCharIndex++;
|
task->tCharIndex++;
|
||||||
task->data[2] = 0;
|
task->data[2] = 0;
|
||||||
}
|
}
|
||||||
@ -649,7 +649,7 @@ static void Task_BardSong(u8 taskId)
|
|||||||
switch (task->data[1])
|
switch (task->data[1])
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
sub_81206F0();
|
EnableTextPrinters();
|
||||||
task->data[1]++;
|
task->data[1]++;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
|
|
||||||
ALIGNED(4)
|
ALIGNED(4)
|
||||||
static const u8 sUnknown_08616124[] = {1, 2, 4};
|
static const u8 sScrollDistances[] = {1, 2, 4};
|
||||||
static const u16 sFont6BrailleGlyphs[] = INCBIN_U16("graphics/fonts/font6.fwjpnfont");
|
static const u16 sFont6BrailleGlyphs[] = INCBIN_U16("graphics/fonts/font6.fwjpnfont");
|
||||||
|
|
||||||
static void DecompressGlyphFont6(u16);
|
static void DecompressGlyphFont6(u16);
|
||||||
@ -135,7 +135,7 @@ u16 Font6Func(struct TextPrinter *textPrinter)
|
|||||||
}
|
}
|
||||||
DecompressGlyphFont6(char_);
|
DecompressGlyphFont6(char_);
|
||||||
CopyGlyphToWindow(textPrinter);
|
CopyGlyphToWindow(textPrinter);
|
||||||
textPrinter->printerTemplate.currentX += gUnknown_03002F90.width + textPrinter->printerTemplate.letterSpacing;
|
textPrinter->printerTemplate.currentX += gCurGlyph.width + textPrinter->printerTemplate.letterSpacing;
|
||||||
return 0;
|
return 0;
|
||||||
case 1:
|
case 1:
|
||||||
if (TextPrinterWait(textPrinter))
|
if (TextPrinterWait(textPrinter))
|
||||||
@ -164,15 +164,15 @@ u16 Font6Func(struct TextPrinter *textPrinter)
|
|||||||
case 4:
|
case 4:
|
||||||
if (textPrinter->scrollDistance)
|
if (textPrinter->scrollDistance)
|
||||||
{
|
{
|
||||||
if (textPrinter->scrollDistance < sUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed])
|
if (textPrinter->scrollDistance < sScrollDistances[gSaveBlock2Ptr->optionsTextSpeed])
|
||||||
{
|
{
|
||||||
ScrollWindow(textPrinter->printerTemplate.windowId, 0, textPrinter->scrollDistance, PIXEL_FILL(textPrinter->printerTemplate.bgColor));
|
ScrollWindow(textPrinter->printerTemplate.windowId, 0, textPrinter->scrollDistance, PIXEL_FILL(textPrinter->printerTemplate.bgColor));
|
||||||
textPrinter->scrollDistance = 0;
|
textPrinter->scrollDistance = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ScrollWindow(textPrinter->printerTemplate.windowId, 0, sUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed], PIXEL_FILL(textPrinter->printerTemplate.bgColor));
|
ScrollWindow(textPrinter->printerTemplate.windowId, 0, sScrollDistances[gSaveBlock2Ptr->optionsTextSpeed], PIXEL_FILL(textPrinter->printerTemplate.bgColor));
|
||||||
textPrinter->scrollDistance -= sUnknown_08616124[gSaveBlock2Ptr->optionsTextSpeed];
|
textPrinter->scrollDistance -= sScrollDistances[gSaveBlock2Ptr->optionsTextSpeed];
|
||||||
}
|
}
|
||||||
CopyWindowToVram(textPrinter->printerTemplate.windowId, 2);
|
CopyWindowToVram(textPrinter->printerTemplate.windowId, 2);
|
||||||
}
|
}
|
||||||
@ -206,12 +206,12 @@ static void DecompressGlyphFont6(u16 glyph)
|
|||||||
const u16 *glyphs;
|
const u16 *glyphs;
|
||||||
|
|
||||||
glyphs = sFont6BrailleGlyphs + 0x100 * (glyph / 8) + 0x10 * (glyph % 8);
|
glyphs = sFont6BrailleGlyphs + 0x100 * (glyph / 8) + 0x10 * (glyph % 8);
|
||||||
DecompressGlyphTile(glyphs, (u16 *)gUnknown_03002F90.unk0);
|
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
|
||||||
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90.unk20));
|
DecompressGlyphTile(glyphs + 0x8, gCurGlyph.gfxBufferTop + 8);
|
||||||
DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90.unk40));
|
DecompressGlyphTile(glyphs + 0x80, gCurGlyph.gfxBufferBottom);
|
||||||
DecompressGlyphTile(glyphs + 0x88, (u16 *)(gUnknown_03002F90.unk60));
|
DecompressGlyphTile(glyphs + 0x88, gCurGlyph.gfxBufferBottom + 8);
|
||||||
gUnknown_03002F90.width = 0x10;
|
gCurGlyph.width = 0x10;
|
||||||
gUnknown_03002F90.height = 0x10;
|
gCurGlyph.height = 0x10;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetGlyphWidthFont6(u16 glyphId, bool32 isJapanese)
|
u32 GetGlyphWidthFont6(u16 glyphId, bool32 isJapanese)
|
||||||
|
@ -16,10 +16,10 @@ gWindowBgTilemapBuffers:
|
|||||||
gFonts:
|
gFonts:
|
||||||
.space 4
|
.space 4
|
||||||
.align 2
|
.align 2
|
||||||
gUnknown_03002F84:
|
gDisableTextPrinters:
|
||||||
.space 1
|
.space 1
|
||||||
.align 4
|
.align 4
|
||||||
gUnknown_03002F90:
|
gCurGlyph:
|
||||||
.space 132
|
.space 132
|
||||||
.align 2
|
.align 2
|
||||||
gTextFlags:
|
gTextFlags:
|
||||||
|
Loading…
Reference in New Issue
Block a user