gGlyphInfo to struct

This commit is contained in:
PikalaxALT
2021-03-23 09:17:23 -04:00
parent bccdee5299
commit ff7f7744b7
6 changed files with 120 additions and 125 deletions
+9
View File
@@ -168,6 +168,15 @@ enum
FONTATTR_COLOR_SHADOW FONTATTR_COLOR_SHADOW
}; };
struct GlyphInfo
{
u8 pixels[0x80];
u8 width;
u8 height;
};
extern struct GlyphInfo gGlyphInfo;
struct TextPrinterSubStruct struct TextPrinterSubStruct
{ {
u8 glyphId:4; // 0x14 u8 glyphId:4; // 0x14
+7 -9
View File
@@ -4,8 +4,6 @@
#include "text.h" #include "text.h"
#include "sound.h" #include "sound.h"
extern u8 gGlyphInfo[];
static const u8 gUnknown_846FB08[] = {1, 2, 4}; static const u8 gUnknown_846FB08[] = {1, 2, 4};
static const u16 sFont6BrailleGlyphs[] = INCBIN_U16("graphics/fonts/font6.fwjpnfont"); static const u16 sFont6BrailleGlyphs[] = INCBIN_U16("graphics/fonts/font6.fwjpnfont");
@@ -136,7 +134,7 @@ u16 Font6Func(struct TextPrinter *textPrinter)
} }
DecompressGlyphFont6(char_); DecompressGlyphFont6(char_);
CopyGlyphToWindow(textPrinter); CopyGlyphToWindow(textPrinter);
textPrinter->printerTemplate.currentX += gGlyphInfo[0x80] + textPrinter->printerTemplate.letterSpacing; textPrinter->printerTemplate.currentX += gGlyphInfo.width + textPrinter->printerTemplate.letterSpacing;
return 0; return 0;
case 1: case 1:
if (TextPrinterWait(textPrinter)) if (TextPrinterWait(textPrinter))
@@ -207,12 +205,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 *)gGlyphInfo); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20));
DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo.pixels + 0x40));
DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo.pixels + 0x60));
gGlyphInfo[0x80] = 0x10; gGlyphInfo.width = 0x10;
gGlyphInfo[0x81] = 0x10; gGlyphInfo.height = 0x10;
} }
s32 GetGlyphWidthFont6(u16 font_type, bool32 isJapanese) s32 GetGlyphWidthFont6(u16 font_type, bool32 isJapanese)
-7
View File
@@ -6,17 +6,10 @@
#include "help_system.h" #include "help_system.h"
#include "list_menu.h" #include "list_menu.h"
#include "strings.h" #include "strings.h"
#include "event_data.h"
#include "constants/songs.h" #include "constants/songs.h"
#define ZERO 0 #define ZERO 0
struct {
u8 pixels[0x80];
u8 width;
u8 height;
} extern gGlyphInfo;
bool8 gHelpSystemEnabled; bool8 gHelpSystemEnabled;
struct HelpSystemVideoState struct HelpSystemVideoState
+93 -94
View File
@@ -6,7 +6,6 @@
#include "dynamic_placeholder_text_util.h" #include "dynamic_placeholder_text_util.h"
#include "constants/songs.h" #include "constants/songs.h"
extern u8 gGlyphInfo[0x90];
extern const struct OamData gOamData_AffineOff_ObjNormal_16x16; extern const struct OamData gOamData_AffineOff_ObjNormal_16x16;
static void DecompressGlyphFont3(u16 glyphId, bool32 isJapanese); static void DecompressGlyphFont3(u16 glyphId, bool32 isJapanese);
@@ -792,8 +791,8 @@ u16 RenderText(struct TextPrinter *textPrinter)
break; break;
case CHAR_KEYPAD_ICON: case CHAR_KEYPAD_ICON:
currChar = *textPrinter->printerTemplate.currentChar++; currChar = *textPrinter->printerTemplate.currentChar++;
gGlyphInfo[0x80] = DrawKeypadIcon(textPrinter->printerTemplate.windowId, currChar, textPrinter->printerTemplate.currentX, textPrinter->printerTemplate.currentY); gGlyphInfo.width = DrawKeypadIcon(textPrinter->printerTemplate.windowId, currChar, textPrinter->printerTemplate.currentX, textPrinter->printerTemplate.currentY);
textPrinter->printerTemplate.currentX += gGlyphInfo[0x80] + textPrinter->printerTemplate.letterSpacing; textPrinter->printerTemplate.currentX += gGlyphInfo.width + textPrinter->printerTemplate.letterSpacing;
return 0; return 0;
case EOS: case EOS:
return 1; return 1;
@@ -824,8 +823,8 @@ u16 RenderText(struct TextPrinter *textPrinter)
if (textPrinter->minLetterSpacing) if (textPrinter->minLetterSpacing)
{ {
textPrinter->printerTemplate.currentX += gGlyphInfo[0x80]; textPrinter->printerTemplate.currentX += gGlyphInfo.width;
width = textPrinter->minLetterSpacing - gGlyphInfo[0x80]; width = textPrinter->minLetterSpacing - gGlyphInfo.width;
if (width > 0) if (width > 0)
{ {
ClearTextSpan(textPrinter, width); ClearTextSpan(textPrinter, width);
@@ -835,9 +834,9 @@ u16 RenderText(struct TextPrinter *textPrinter)
else else
{ {
if (textPrinter->japanese) if (textPrinter->japanese)
textPrinter->printerTemplate.currentX += (gGlyphInfo[0x80] + textPrinter->printerTemplate.letterSpacing); textPrinter->printerTemplate.currentX += (gGlyphInfo.width + textPrinter->printerTemplate.letterSpacing);
else else
textPrinter->printerTemplate.currentX += gGlyphInfo[0x80]; textPrinter->printerTemplate.currentX += gGlyphInfo.width;
} }
return 0; return 0;
case 1: case 1:
@@ -1264,8 +1263,8 @@ u8 RenderTextFont9(u8 *pixels, u8 fontId, u8 *str, int a3, int a4, int a5, int a
break; break;
default: default:
DecompressGlyphFont9(temp); DecompressGlyphFont9(temp);
CpuCopy32(gGlyphInfo, pixels, 0x20); CpuCopy32(gGlyphInfo.pixels, pixels, 0x20);
CpuCopy32(gGlyphInfo + 0x40, pixels + 0x20, 0x20); CpuCopy32(gGlyphInfo.pixels + 0x40, pixels + 0x20, 0x20);
pixels += 0x40; pixels += 0x40;
break; break;
} }
@@ -1362,18 +1361,18 @@ void DecompressGlyphFont0(u16 glyphId, bool32 isJapanese)
if (isJapanese == 1) if (isJapanese == 1)
{ {
glyphs = sFont0JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF)); glyphs = sFont0JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF));
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo.pixels + 0x40));
gGlyphInfo[0x80] = 8; gGlyphInfo.width = 8;
gGlyphInfo[0x81] = 12; gGlyphInfo.height = 12;
} }
else else
{ {
glyphs = sFont0LatinGlyphs + (0x10 * glyphId); glyphs = sFont0LatinGlyphs + (0x10 * glyphId);
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x40)); DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x40));
gGlyphInfo[0x80] = sFont0LatinGlyphWidths[glyphId]; gGlyphInfo.width = sFont0LatinGlyphWidths[glyphId];
gGlyphInfo[0x81] = 13; gGlyphInfo.height = 13;
} }
} }
@@ -1393,20 +1392,20 @@ void DecompressGlyphFont1(u16 glyphId, bool32 isJapanese)
{ {
int eff; int eff;
glyphs = sFont1JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & (eff = 0xF))); // shh, no questions, only matching now glyphs = sFont1JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & (eff = 0xF))); // shh, no questions, only matching now
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo.pixels + 0x40));
gGlyphInfo[0x80] = 8; gGlyphInfo.width = 8;
gGlyphInfo[0x81] = 16; gGlyphInfo.height = 16;
} }
else else
{ {
glyphs = sFont1LatinGlyphs + (0x20 * glyphId); glyphs = sFont1LatinGlyphs + (0x20 * glyphId);
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20));
DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo.pixels + 0x40));
DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo.pixels + 0x60));
gGlyphInfo[0x80] = sFont1LatinGlyphWidths[glyphId]; gGlyphInfo.width = sFont1LatinGlyphWidths[glyphId];
gGlyphInfo[0x81] = 14; gGlyphInfo.height = 14;
} }
} }
@@ -1432,21 +1431,21 @@ void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese)
for(i = 0; i < 0x80; i++) for(i = 0; i < 0x80; i++)
{ {
gGlyphInfo[i] = lastColor | lastColor << 4; gGlyphInfo.pixels[i] = lastColor | lastColor << 4;
// Game Freak, please. writing the same values over and over... // Game Freak, please. writing the same values over and over...
gGlyphInfo[0x80] = 10; gGlyphInfo.width = 10;
gGlyphInfo[0x81] = 12; gGlyphInfo.height = 12;
} }
} }
else else
{ {
glyphs = sFont2JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); glyphs = sFont2JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7));
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20));
DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo.pixels + 0x40));
DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo.pixels + 0x60));
gGlyphInfo[0x80] = sFont2JapaneseGlyphWidths[glyphId]; gGlyphInfo.width = sFont2JapaneseGlyphWidths[glyphId];
gGlyphInfo[0x81] = 12; gGlyphInfo.height = 12;
} }
} }
else else
@@ -1457,21 +1456,21 @@ void DecompressGlyphFont2(u16 glyphId, bool32 isJapanese)
for(i = 0; i < 0x80; i++) for(i = 0; i < 0x80; i++)
{ {
gGlyphInfo[i] = lastColor | lastColor << 4; gGlyphInfo.pixels[i] = lastColor | lastColor << 4;
// but why // but why
gGlyphInfo[0x80] = sFont2LatinGlyphWidths[0]; gGlyphInfo.width = sFont2LatinGlyphWidths[0];
gGlyphInfo[0x81] = 14; gGlyphInfo.height = 14;
} }
} }
else else
{ {
glyphs = sFont2LatinGlyphs + (0x20 * glyphId); glyphs = sFont2LatinGlyphs + (0x20 * glyphId);
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20));
DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo.pixels + 0x40));
DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo.pixels + 0x60));
gGlyphInfo[0x80] = sFont2LatinGlyphWidths[glyphId]; gGlyphInfo.width = sFont2LatinGlyphWidths[glyphId];
gGlyphInfo[0x81] = 14; gGlyphInfo.height = 14;
} }
} }
} }
@@ -1505,21 +1504,21 @@ static void DecompressGlyphFont3(u16 glyphId, bool32 isJapanese)
for(i = 0; i < 0x80; i++) for(i = 0; i < 0x80; i++)
{ {
gGlyphInfo[i] = lastColor | lastColor << 4; gGlyphInfo.pixels[i] = lastColor | lastColor << 4;
// Game Freak, please. writing the same values over and over... // Game Freak, please. writing the same values over and over...
gGlyphInfo[0x80] = 10; gGlyphInfo.width = 10;
gGlyphInfo[0x81] = 12; gGlyphInfo.height = 12;
} }
} }
else else
{ {
glyphs = sFont2JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); glyphs = sFont2JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7));
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20));
DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo.pixels + 0x40));
DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo.pixels + 0x60));
gGlyphInfo[0x80] = 10; gGlyphInfo.width = 10;
gGlyphInfo[0x81] = 12; gGlyphInfo.height = 12;
} }
} }
else else
@@ -1548,21 +1547,21 @@ static void DecompressGlyphFont4(u16 glyphId, bool32 isJapanese)
for(i = 0; i < 0x80; i++) for(i = 0; i < 0x80; i++)
{ {
gGlyphInfo[i] = lastColor | lastColor << 4; gGlyphInfo.pixels[i] = lastColor | lastColor << 4;
// Game Freak, please. writing the same values over and over... // Game Freak, please. writing the same values over and over...
gGlyphInfo[0x80] = 10; gGlyphInfo.width = 10;
gGlyphInfo[0x81] = 12; gGlyphInfo.height = 12;
} }
} }
else else
{ {
glyphs = sFont4JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); glyphs = sFont4JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7));
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20));
DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo.pixels + 0x40));
DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo.pixels + 0x60));
gGlyphInfo[0x80] = sFont4JapaneseGlyphWidths[glyphId]; gGlyphInfo.width = sFont4JapaneseGlyphWidths[glyphId];
gGlyphInfo[0x81] = 12; gGlyphInfo.height = 12;
} }
} }
else else
@@ -1573,21 +1572,21 @@ static void DecompressGlyphFont4(u16 glyphId, bool32 isJapanese)
for(i = 0; i < 0x80; i++) for(i = 0; i < 0x80; i++)
{ {
gGlyphInfo[i] = lastColor | lastColor << 4; gGlyphInfo.pixels[i] = lastColor | lastColor << 4;
// but why // but why
gGlyphInfo[0x80] = sFont4LatinGlyphWidths[0]; gGlyphInfo.width = sFont4LatinGlyphWidths[0];
gGlyphInfo[0x81] = 14; gGlyphInfo.height = 14;
} }
} }
else else
{ {
glyphs = sFont4LatinGlyphs + (0x20 * glyphId); glyphs = sFont4LatinGlyphs + (0x20 * glyphId);
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20));
DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo.pixels + 0x40));
DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo.pixels + 0x60));
gGlyphInfo[0x80] = sFont4LatinGlyphWidths[glyphId]; gGlyphInfo.width = sFont4LatinGlyphWidths[glyphId];
gGlyphInfo[0x81] = 14; gGlyphInfo.height = 14;
} }
} }
} }
@@ -1619,21 +1618,21 @@ void DecompressGlyphFont5(u16 glyphId, bool32 isJapanese)
for(i = 0; i < 0x80; i++) for(i = 0; i < 0x80; i++)
{ {
gGlyphInfo[i] = lastColor | lastColor << 4; gGlyphInfo.pixels[i] = lastColor | lastColor << 4;
// Game Freak, please. writing the same values over and over... // Game Freak, please. writing the same values over and over...
gGlyphInfo[0x80] = 10; gGlyphInfo.width = 10;
gGlyphInfo[0x81] = 12; gGlyphInfo.height = 12;
} }
} }
else else
{ {
glyphs = sFont5JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7)); glyphs = sFont5JapaneseGlyphs + (0x100 * (glyphId >> 0x3)) + (0x10 * (glyphId & 0x7));
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20));
DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo.pixels + 0x40));
DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo + 0x60)); DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo.pixels + 0x60));
gGlyphInfo[0x80] = sFont5JapaneseGlyphWidths[glyphId]; gGlyphInfo.width = sFont5JapaneseGlyphWidths[glyphId];
gGlyphInfo[0x81] = 12; gGlyphInfo.height = 12;
} }
} }
else else
@@ -1644,21 +1643,21 @@ void DecompressGlyphFont5(u16 glyphId, bool32 isJapanese)
for(i = 0; i < 0x80; i++) for(i = 0; i < 0x80; i++)
{ {
gGlyphInfo[i] = lastColor | lastColor << 4; gGlyphInfo.pixels[i] = lastColor | lastColor << 4;
// but why // but why
gGlyphInfo[0x80] = sFont5LatinGlyphWidths[0]; gGlyphInfo.width = sFont5LatinGlyphWidths[0];
gGlyphInfo[0x81] = 14; gGlyphInfo.height = 14;
} }
} }
else else
{ {
glyphs = sFont5LatinGlyphs + (0x20 * glyphId); glyphs = sFont5LatinGlyphs + (0x20 * glyphId);
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo + 0x20)); DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20));
DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo + 0x40)); DecompressGlyphTile(glyphs + 0x10, (u16 *)(gGlyphInfo.pixels + 0x40));
DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo + 0x60)); DecompressGlyphTile(glyphs + 0x18, (u16 *)(gGlyphInfo.pixels + 0x60));
gGlyphInfo[0x80] = sFont5LatinGlyphWidths[glyphId]; gGlyphInfo.width = sFont5LatinGlyphWidths[glyphId];
gGlyphInfo[0x81] = 14; gGlyphInfo.height = 14;
} }
} }
} }
@@ -1679,8 +1678,8 @@ s32 GetGlyphWidthFont5(u16 glyphId, bool32 isJapanese)
void DecompressGlyphFont9(u16 glyphId) void DecompressGlyphFont9(u16 glyphId)
{ {
const u16* glyphs = sFont9JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF)); const u16* glyphs = sFont9JapaneseGlyphs + (0x100 * (glyphId >> 0x4)) + (0x8 * (glyphId & 0xF));
DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo); DecompressGlyphTile(glyphs, (u16 *)gGlyphInfo.pixels);
DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo + 0x40)); DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo.pixels + 0x40));
gGlyphInfo[0x80] = 8; gGlyphInfo.width = 8;
gGlyphInfo[0x81] = 12; gGlyphInfo.height = 12;
} }
+10 -14
View File
@@ -1,10 +1,6 @@
#include "global.h" #include "global.h"
#include "main.h"
#include "palette.h"
#include "string_util.h"
#include "window.h" #include "window.h"
#include "text.h" #include "text.h"
#include "blit.h"
static EWRAM_DATA struct TextPrinter sTempTextPrinter = {0}; static EWRAM_DATA struct TextPrinter sTempTextPrinter = {0};
static EWRAM_DATA struct TextPrinter sTextPrinters[NUM_TEXT_PRINTERS] = {0}; static EWRAM_DATA struct TextPrinter sTextPrinters[NUM_TEXT_PRINTERS] = {0};
@@ -15,7 +11,7 @@ static u16 sLastTextFgColor;
static u16 sLastTextShadowColor; static u16 sLastTextShadowColor;
const struct FontInfo *gFonts; const struct FontInfo *gFonts;
u8 gGlyphInfo[0x90]; struct GlyphInfo gGlyphInfo;
static const u8 sFontHalfRowOffsets[] = static const u8 sFontHalfRowOffsets[] =
{ {
@@ -219,7 +215,7 @@ u8 GetLastTextColor(u8 colorType)
u8 * src, * dst; \ u8 * src, * dst; \
u32 v8; \ u32 v8; \
\ \
src = gGlyphInfo + (heightOffset / 8 * 0x40) + (widthOffset / 8 * 0x20); \ src = gGlyphInfo.pixels + (heightOffset / 8 * 0x40) + (widthOffset / 8 * 0x20); \
for (yAdd = 0, v3 = a6 + heightOffset; yAdd < height; yAdd++, v3++) \ for (yAdd = 0, v3 = a6 + heightOffset; yAdd < height; yAdd++, v3++) \
{ \ { \
v8 = *(u32 *)src; \ v8 = *(u32 *)src; \
@@ -242,14 +238,14 @@ void CopyGlyphToWindow(struct TextPrinter *textPrinter)
int r0, r1; int r0, r1;
u8 r2; u8 r2;
if (gWindows[textPrinter->printerTemplate.windowId].window.width * 8 - textPrinter->printerTemplate.currentX < gGlyphInfo[0x80]) if (gWindows[textPrinter->printerTemplate.windowId].window.width * 8 - textPrinter->printerTemplate.currentX < gGlyphInfo.width)
r0 = gWindows[textPrinter->printerTemplate.windowId].window.width * 8 - textPrinter->printerTemplate.currentX; r0 = gWindows[textPrinter->printerTemplate.windowId].window.width * 8 - textPrinter->printerTemplate.currentX;
else else
r0 = gGlyphInfo[0x80]; r0 = gGlyphInfo.width;
if (gWindows[textPrinter->printerTemplate.windowId].window.height * 8 - textPrinter->printerTemplate.currentY < gGlyphInfo[0x81]) if (gWindows[textPrinter->printerTemplate.windowId].window.height * 8 - textPrinter->printerTemplate.currentY < gGlyphInfo.height)
r1 = gWindows[textPrinter->printerTemplate.windowId].window.height * 8 - textPrinter->printerTemplate.currentY; r1 = gWindows[textPrinter->printerTemplate.windowId].window.height * 8 - textPrinter->printerTemplate.currentY;
else else
r1 = gGlyphInfo[0x81]; r1 = gGlyphInfo.height;
r2 = 0; r2 = 0;
if (r0 > 8) if (r0 > 8)
@@ -285,14 +281,14 @@ void sub_8003614(void * tileData, u16 currentX, u16 currentY, u16 width, u16 hei
u8 r2; u8 r2;
u16 r3; u16 r3;
if (width - currentX < gGlyphInfo[0x80]) if (width - currentX < gGlyphInfo.width)
r0 = width - currentX; r0 = width - currentX;
else else
r0 = gGlyphInfo[0x80]; r0 = gGlyphInfo.width;
if (height - currentY < gGlyphInfo[0x81]) if (height - currentY < gGlyphInfo.height)
r1 = height - currentY; r1 = height - currentY;
else else
r1 = gGlyphInfo[0x81]; r1 = gGlyphInfo.height;
r2 = 0; r2 = 0;
r3 = (width + (width & 7)) >> 3; r3 = (width + (width & 7)) >> 3;
+1 -1
View File
@@ -4,7 +4,7 @@
.include "bg.o" .include "bg.o"
.align 2 .align 2
.include "text_printer.o" .include "text_printer.o"
.align 2 .align 4
.include "window.o" .include "window.o"
.align 2 .align 2
.include "text.o" .include "text.o"