FONT (File Format): Difference between revisions

no edit summary
>Aruki
>Aruki
No edit summary
Line 285: Line 285:
| colspan=2 {{unknown|End of entry}}
| colspan=2 {{unknown|End of entry}}
|}
|}
== Textures ==
Starting with version 4, textures used by FONT files are encoded in a bit of an unorthodox manner. The textures are ostensibly C4, but it appears that the game probably replaces the palette colors with different ones at runtime, which means trying to decode them as-is will turn out junk. Fortunately, the correct colors are fairly intuitive to guess at, so the textures can be decoded as such: For each 4-bit palette index, each bit determines whether a given color channel should be set to 0 or 255. Bit 3 (the MSB) refers to the red channel, bit 2 refers to the green channel, bit 1 refers to the blue channel, and bit 0 (the LSB) refers to the alpha channel. This would correspond to the following RGB5A3 color palettes:
<pre>0 (0000) - 0x8000 (none)
1 (0001) - 0x7000 (alpha)
2 (0010) - 0xFC00 (blue)
3 (0011) - 0x7F00 (blue/alpha)
4 (0100) - 0x83E0 (green)
5 (0101) - 0x70F0 (green/alpha)
6 (0110) - 0xFFE0 (green/blue)
7 (0111) - 0x7FF0 (green/blue/alpha)
8 (1000) - 0x801F (red)
9 (1001) - 0x700F (red/alpha)
10 (1010) - 0xFC1F (red/blue)
11 (1011) - 0x7F0F (red/blue/alpha)
12 (1100) - 0x83FF (red/green)
13 (1101) - 0x70FF (red/green/alpha)
14 (1110) - 0xFFFF (red/green/blue)
15 (1111) - 0x7FFF (red/green/blue/alpha)</pre>
Note: ''Donkey Kong Country Returns'' features some font textures that use C8 instead of C4, but the palette indices still only range from 0 to 15, so the same method still applies.


[[Category:File Formats]]
[[Category:File Formats]]
Anonymous user