Difference between revisions of "SPR Spritesheet"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m (→‎Data: added clarification about 3 bits per pixel)
(added note about compression)
Line 7: Line 7:
 
== Data ==
 
== Data ==
 
Each set of 4 bits is the palette color index of the pixel. The spritesheet is 256 pixels wide.
 
Each set of 4 bits is the palette color index of the pixel. The spritesheet is 256 pixels wide.
The lower half of unit spritesheets (the part with the parts for attacks) has compressed regions representing "there are this many 0s here"
+
 
 +
The lower half of unit spritesheets (the part with the parts for attacks) has compressed regions (see [[Decompress Attack spritesheet]]).
 +
 
 +
The compression algorithm is: 0 - some half byte - how many 0s there are
 +
 
 +
if halfbyte = 0, 1 digit in number of 0s
 +
 
 +
if halfbyte = 7, 2 digits in number of 0s
 +
 
 +
if halfbyte = 8, 3 digits in number of 0s
 +
 
 +
if halfbyte != [0,7,8], number of 0s = halfbyte
 +
 
 +
Example: 08100 is the hex string for 256 0s (128 bytes of 0)

Revision as of 13:00, 17 January 2025

SPR (Unit Sprite) files contain the bitmap data for a sprite. Sp2 are similar format used for extra images used by MON shp types. Note:

Palette Data

The file starts with the palette data and contains 256 colors (512 bytes), 16 palettes of 16 colors each. Palette's use 2 bytes per color, 1 bit for alpha, followed by 5 bits per channel (B,G,R). The first 8 palettes are for the unit, the second 8 palettes are for the portrait.

Data

Each set of 4 bits is the palette color index of the pixel. The spritesheet is 256 pixels wide.

The lower half of unit spritesheets (the part with the parts for attacks) has compressed regions (see Decompress Attack spritesheet).

The compression algorithm is: 0 - some half byte - how many 0s there are

if halfbyte = 0, 1 digit in number of 0s

if halfbyte = 7, 2 digits in number of 0s

if halfbyte = 8, 3 digits in number of 0s

if halfbyte != [0,7,8], number of 0s = halfbyte

Example: 08100 is the hex string for 256 0s (128 bytes of 0)