Contents |
.SPR files are small archives containing images, typically animated monster sprites. The images in .SPR files can be compressed with RLE compression.
Note: as with all RO file formats, integers are in little endian.
struct SprFile { // Offset
unsigned char signature[2]; // 0
uint8 compressed; // 2
uint8 unknown; // 3
uint16 numberOfImages; // 4
Image images[numberOfImages]; // 6
PaletteEntry palette[256]; // EOF - sizeof(PaletteEntry * 256) = EOF - 1024
}
The layout of the Image structure depends on whether this .SPR file is compressed (indicated by the 'compressed' field in the header).
This is the layout for compressed .SPR files:
struct Image { // Offset
uint16 width; // 0
uint16 height; // 2
uint16 compressedLength; // 4
unsigned char data[compressedLength]; // 6
} // Size: 6 + compressedLength bytes
This is the layout for uncompressed .SPR files:
struct Image { // Offset
uint16 width; // 0
uint16 height; // 2
unsigned char data[width*height]; // 4
} // Size: 4 + width * height bytes
struct PaletteEntry { // Offset
uint8 red; // 0
uint8 green; // 1
uint8 blue // 2
uint8 alpha; // 4
} // Size: 4 bytes