Jump to content

Font: Difference between revisions

m
no edit summary
(Created page with "The font stores all characters the game uses for drawing text. There are two types of characters: Narrow characters are 8x16 px in size (two tiles), and wide characters are 16x16 px in size (four tiles). '''Warning:''' In Boktai 1, wide characters are structured differently than described here. In Boktai 1, each wide character is 0x48 bytes in size, whereas in Boktai 2 and 3 each wide character is 0x80 bytes in size. The format of Boktai 1 wide characters still needs to...")
 
mNo edit summary
Line 1: Line 1:
The font stores all characters the game uses for drawing text. There are two types of characters: Narrow characters are 8x16 px in size (two tiles), and wide characters are 16x16 px in size (four tiles).
The font stores all characters the game uses for drawing text. There are two types of characters: Narrow characters are 8x16 px in size (two tiles), and wide characters are 16x16 px in size (four tiles).
The font is stored in the directory with id_low=0x6d24, id_high=0xa705 in the [[master file table]]. That directory will contain a single font file with id=0x3f51.


'''Warning:''' In Boktai 1, wide characters are structured differently than described here. In Boktai 1, each wide character is 0x48 bytes in size, whereas in Boktai 2 and 3 each wide character is 0x80 bytes in size. The format of Boktai 1 wide characters still needs to be reverse engineered.
'''Warning:''' In Boktai 1, wide characters are structured differently than described here. In Boktai 1, each wide character is 0x48 bytes in size, whereas in Boktai 2 and 3 each wide character is 0x80 bytes in size. The format of Boktai 1 wide characters still needs to be reverse engineered.
Line 38: Line 40:


<syntaxhighlight lang="c">
<syntaxhighlight lang="c">
void DrawNarrowCharacter(int x, int y, char* text, FontHeader* font) {
void DrawWideCharacter(int x, int y, char* text, FontHeader* font) {
     char high = text[0];
     char high = text[0];
     char low = text[1];
     char low = text[1];
    // Combine the two bytes, and clear the top bit
     int charIndex = ((high & 0x7f) << 8) | low
     int charIndex = ((high & 0x7f) << 8) | low