Documenting and whitespace fixing

This commit is contained in:
PokeCodec 2020-09-03 10:30:20 -04:00
parent e8f2298498
commit ae9a60eb2a
3 changed files with 74 additions and 75 deletions

View File

@ -482,7 +482,7 @@ u8 GetLastTextColor(u8 colorType)
const u32 toOrr = r5 & 0xF; \ const u32 toOrr = r5 & 0xF; \
if (toOrr) \ if (toOrr) \
{ \ { \
dst = windowTiles + ((j / 8) * 32) + ((j & 7) >> 1) + ((i / 8) * widthOffset) + ((i & 7) * 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)); \
} \ } \
@ -491,7 +491,6 @@ u8 GetLastTextColor(u8 colorType)
} \ } \
} }
void CopyGlyphToWindow(struct TextPrinter *textPrinter) void CopyGlyphToWindow(struct TextPrinter *textPrinter)
{ {
struct Window *win; struct Window *win;
@ -505,12 +504,12 @@ void CopyGlyphToWindow(struct TextPrinter *textPrinter)
winTempl = &win->window; winTempl = &win->window;
r4 = (winTempl->width * 8) - textPrinter->printerTemplate.currentX; r4 = (winTempl->width * 8) - textPrinter->printerTemplate.currentX;
if (r4 > gUnknown_03002F90.unk80) if (r4 > gUnknown_03002F90.width)
r4 = gUnknown_03002F90.unk80; r4 = gUnknown_03002F90.width;
r0 = (winTempl->height * 8) - textPrinter->printerTemplate.currentY; r0 = (winTempl->height * 8) - textPrinter->printerTemplate.currentY;
if (r0 > gUnknown_03002F90.unk81) if (r0 > gUnknown_03002F90.height)
r0 = gUnknown_03002F90.unk81; r0 = gUnknown_03002F90.height;
currX = textPrinter->printerTemplate.currentX; currX = textPrinter->printerTemplate.currentX;
currY = textPrinter->printerTemplate.currentY; currY = textPrinter->printerTemplate.currentY;
@ -576,7 +575,7 @@ void ClearTextSpan(struct TextPrinter *textPrinter, u32 width)
pixels_data.height = window->window.height << 3; pixels_data.height = window->window.height << 3;
gUnk = &gUnknown_03002F90; gUnk = &gUnknown_03002F90;
glyphHeight = &gUnk->unk81; glyphHeight = &gUnk->height;
FillBitmapRect4Bit( FillBitmapRect4Bit(
&pixels_data, &pixels_data,
@ -1035,8 +1034,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.unk80 = DrawKeypadIcon(textPrinter->printerTemplate.windowId, currChar, textPrinter->printerTemplate.currentX, textPrinter->printerTemplate.currentY); gUnknown_03002F90.width = DrawKeypadIcon(textPrinter->printerTemplate.windowId, currChar, textPrinter->printerTemplate.currentX, textPrinter->printerTemplate.currentY);
textPrinter->printerTemplate.currentX += gUnknown_03002F90.unk80 + textPrinter->printerTemplate.letterSpacing; textPrinter->printerTemplate.currentX += gUnknown_03002F90.width + textPrinter->printerTemplate.letterSpacing;
return 0; return 0;
case EOS: case EOS:
return 1; return 1;
@ -1070,8 +1069,8 @@ u16 RenderText(struct TextPrinter *textPrinter)
if (textPrinter->minLetterSpacing) if (textPrinter->minLetterSpacing)
{ {
textPrinter->printerTemplate.currentX += gUnknown_03002F90.unk80; textPrinter->printerTemplate.currentX += gUnknown_03002F90.width;
width = textPrinter->minLetterSpacing - gUnknown_03002F90.unk80; width = textPrinter->minLetterSpacing - gUnknown_03002F90.width;
if (width > 0) if (width > 0)
{ {
ClearTextSpan(textPrinter, width); ClearTextSpan(textPrinter, width);
@ -1079,9 +1078,9 @@ u16 RenderText(struct TextPrinter *textPrinter)
} }
} }
else if (textPrinter->japanese) else if (textPrinter->japanese)
textPrinter->printerTemplate.currentX += (gUnknown_03002F90.unk80 + textPrinter->printerTemplate.letterSpacing); textPrinter->printerTemplate.currentX += (gUnknown_03002F90.width + textPrinter->printerTemplate.letterSpacing);
else else
textPrinter->printerTemplate.currentX += gUnknown_03002F90.unk80; textPrinter->printerTemplate.currentX += gUnknown_03002F90.width;
return 0; return 0;
case 1: case 1:
if (TextPrinterWait(textPrinter)) if (TextPrinterWait(textPrinter))
@ -1612,15 +1611,15 @@ void DecompressGlyphFont0(u16 glyphId, bool32 isJapanese)
glyphs = gFont0JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF)); glyphs = gFont0JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF));
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0); DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40 DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40
gUnknown_03002F90.unk80 = 8; // gGlyphWidth gUnknown_03002F90.width = 8; // gGlyphWidth
gUnknown_03002F90.unk81 = 12; // gGlyphHeight gUnknown_03002F90.height = 12; // gGlyphHeight
} }
else else
{ {
glyphs = gFont0LatinGlyphs + (0x20 * glyphId); glyphs = gFont0LatinGlyphs + (0x20 * glyphId);
gUnknown_03002F90.unk80 = gFont0LatinGlyphWidths[glyphId]; gUnknown_03002F90.width = gFont0LatinGlyphWidths[glyphId];
if (gUnknown_03002F90.unk80 <= 8) if (gUnknown_03002F90.width <= 8)
{ {
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0); DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40); DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
@ -1633,7 +1632,7 @@ void DecompressGlyphFont0(u16 glyphId, bool32 isJapanese)
DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60); DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60);
} }
gUnknown_03002F90.unk81 = 13; gUnknown_03002F90.height = 13;
} }
} }
@ -1655,15 +1654,15 @@ void DecompressGlyphFont7(u16 glyphId, bool32 isJapanese)
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, gUnknown_03002F90.unk0);
DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40 DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40
gUnknown_03002F90.unk80 = 8; // gGlyphWidth gUnknown_03002F90.width = 8; // gGlyphWidth
gUnknown_03002F90.unk81 = 15; // gGlyphHeight gUnknown_03002F90.height = 15; // gGlyphHeight
} }
else else
{ {
glyphs = gFont7LatinGlyphs + (0x20 * glyphId); glyphs = gFont7LatinGlyphs + (0x20 * glyphId);
gUnknown_03002F90.unk80 = gFont7LatinGlyphWidths[glyphId]; gUnknown_03002F90.width = gFont7LatinGlyphWidths[glyphId];
if (gUnknown_03002F90.unk80 <= 8) if (gUnknown_03002F90.width <= 8)
{ {
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0); DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40); DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
@ -1676,7 +1675,7 @@ void DecompressGlyphFont7(u16 glyphId, bool32 isJapanese)
DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60); DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60);
} }
gUnknown_03002F90.unk81 = 15; gUnknown_03002F90.height = 15;
} }
} }
@ -1697,15 +1696,15 @@ void DecompressGlyphFont8(u16 glyphId, bool32 isJapanese)
glyphs = gFont0JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF)); glyphs = gFont0JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF));
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0); DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40 DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40
gUnknown_03002F90.unk80 = 8; // gGlyphWidth gUnknown_03002F90.width = 8; // gGlyphWidth
gUnknown_03002F90.unk81 = 12; // gGlyphHeight gUnknown_03002F90.height = 12; // gGlyphHeight
} }
else else
{ {
glyphs = gFont8LatinGlyphs + (0x20 * glyphId); glyphs = gFont8LatinGlyphs + (0x20 * glyphId);
gUnknown_03002F90.unk80 = gFont8LatinGlyphWidths[glyphId]; gUnknown_03002F90.width = gFont8LatinGlyphWidths[glyphId];
if (gUnknown_03002F90.unk80 <= 8) if (gUnknown_03002F90.width <= 8)
{ {
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0); DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40); DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
@ -1718,7 +1717,7 @@ void DecompressGlyphFont8(u16 glyphId, bool32 isJapanese)
DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60); DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60);
} }
gUnknown_03002F90.unk81 = 12; gUnknown_03002F90.height = 12;
} }
} }
@ -1741,15 +1740,15 @@ void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese)
DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20); // gUnknown_03002F90 + 0x40 DecompressGlyphTile(glyphs + 0x8, gUnknown_03002F90.unk20); // gUnknown_03002F90 + 0x40
DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x20 DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x20
DecompressGlyphTile(glyphs + 0x88, gUnknown_03002F90.unk60); // gUnknown_03002F90 + 0x60 DecompressGlyphTile(glyphs + 0x88, gUnknown_03002F90.unk60); // gUnknown_03002F90 + 0x60
gUnknown_03002F90.unk80 = gFont2JapaneseGlyphWidths[glyphId]; // gGlyphWidth gUnknown_03002F90.width = gFont2JapaneseGlyphWidths[glyphId]; // gGlyphWidth
gUnknown_03002F90.unk81 = 14; // gGlyphHeight gUnknown_03002F90.height = 14; // gGlyphHeight
} }
else else
{ {
glyphs = gFont2LatinGlyphs + (0x20 * glyphId); glyphs = gFont2LatinGlyphs + (0x20 * glyphId);
gUnknown_03002F90.unk80 = gFont2LatinGlyphWidths[glyphId]; gUnknown_03002F90.width = gFont2LatinGlyphWidths[glyphId];
if (gUnknown_03002F90.unk80 <= 8) if (gUnknown_03002F90.width <= 8)
{ {
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0); DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40); DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
@ -1762,7 +1761,7 @@ void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese)
DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60); DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60);
} }
gUnknown_03002F90.unk81 = 14; gUnknown_03002F90.height = 14;
} }
} }
@ -1784,15 +1783,15 @@ void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese)
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, gUnknown_03002F90.unk0);
DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40 DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); // gUnknown_03002F90 + 0x40
gUnknown_03002F90.unk80 = 8; // gGlyphWidth gUnknown_03002F90.width = 8; // gGlyphWidth
gUnknown_03002F90.unk81 = 15; // gGlyphHeight gUnknown_03002F90.height = 15; // gGlyphHeight
} }
else else
{ {
glyphs = gFont1LatinGlyphs + (0x20 * glyphId); glyphs = gFont1LatinGlyphs + (0x20 * glyphId);
gUnknown_03002F90.unk80 = gFont1LatinGlyphWidths[glyphId]; gUnknown_03002F90.width = gFont1LatinGlyphWidths[glyphId];
if (gUnknown_03002F90.unk80 <= 8) if (gUnknown_03002F90.width <= 8)
{ {
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0); DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40); DecompressGlyphTile(glyphs + 0x10, gUnknown_03002F90.unk40);
@ -1805,7 +1804,7 @@ void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese)
DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60); DecompressGlyphTile(glyphs + 0x18, gUnknown_03002F90.unk60);
} }
gUnknown_03002F90.unk81 = 15; gUnknown_03002F90.height = 15;
} }
} }
@ -1824,6 +1823,6 @@ void DecompressGlyphFont9(u16 glyphId)
glyphs = gFont9JapaneseGlyphs + (0x100 * (glyphId >> 4)) + (0x8 * (glyphId & 0xF)); glyphs = gFont9JapaneseGlyphs + (0x100 * (glyphId >> 4)) + (0x8 * (glyphId & 0xF));
DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0); DecompressGlyphTile(glyphs, gUnknown_03002F90.unk0);
DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40); DecompressGlyphTile(glyphs + 0x80, gUnknown_03002F90.unk40);
gUnknown_03002F90.unk80 = 8; gUnknown_03002F90.width = 8;
gUnknown_03002F90.unk81 = 12; gUnknown_03002F90.height = 12;
} }

View File

@ -373,8 +373,8 @@ struct Struct_03002F90
u32 unk20[8]; u32 unk20[8];
u32 unk40[8]; u32 unk40[8];
u32 unk60[8]; u32 unk60[8];
u8 unk80; u8 width;
u8 unk81; u8 height;
}; };
extern TextFlags gTextFlags; extern TextFlags gTextFlags;

View File

@ -135,7 +135,7 @@ u16 Font6Func(struct TextPrinter *textPrinter)
} }
DecompressGlyphFont6(char_); DecompressGlyphFont6(char_);
CopyGlyphToWindow(textPrinter); CopyGlyphToWindow(textPrinter);
textPrinter->printerTemplate.currentX += gUnknown_03002F90.unk80 + textPrinter->printerTemplate.letterSpacing; textPrinter->printerTemplate.currentX += gUnknown_03002F90.width + textPrinter->printerTemplate.letterSpacing;
return 0; return 0;
case 1: case 1:
if (TextPrinterWait(textPrinter)) if (TextPrinterWait(textPrinter))
@ -210,8 +210,8 @@ static void DecompressGlyphFont6(u16 glyph)
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90.unk20)); DecompressGlyphTile(glyphs + 0x8, (u16 *)(gUnknown_03002F90.unk20));
DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90.unk40)); DecompressGlyphTile(glyphs + 0x80, (u16 *)(gUnknown_03002F90.unk40));
DecompressGlyphTile(glyphs + 0x88, (u16 *)(gUnknown_03002F90.unk60)); DecompressGlyphTile(glyphs + 0x88, (u16 *)(gUnknown_03002F90.unk60));
gUnknown_03002F90.unk80 = 0x10; gUnknown_03002F90.width = 0x10;
gUnknown_03002F90.unk81 = 0x10; gUnknown_03002F90.height = 0x10;
} }
u32 GetGlyphWidthFont6(u16 glyphId, bool32 isJapanese) u32 GetGlyphWidthFont6(u16 glyphId, bool32 isJapanese)