Sprite bank file
From Worms Knowledge Base
Revision as of 17:08, 9 August 2012 by Pac-Man (Talk | contribs) (Added class="wikitable" to tables for design)
(Up to File formats)
A sprite bank file is used to store multiple Sprite file in a very efficient manner. All sprites in a BNK file are compressed using Team17 compression and they all share one palette.
BNK files are used both by Worms World Party and Worms World Party Aqua in their gfx.dir and water.dir files.
File Format
Size | Type | Description |
---|---|---|
4 | int32 | Signature. The magic number used to identify the BNK file. Hex: 0x424E4B1A, ASCII: "BNK\1A" |
4 | int32 | File Length The total length of the file. |
2 | int16 | Palette Count The number of palette entries, excluding back color. |
3 * i | byte[,] | Palette The palette used for all frames in the file. Each palette entry is 3 bytes long, stored in BGR format. (sized as new byte[PaletteCount, 3]) |
0 to 3 | byte[] | Padding Padding is added to put the data in 4 byte position. (pos + 2) % 4 |
4 | int32 | Sprite Count The total number of sprites stored in the file. |
12 * i | Sprite[] | Sprite Info The data explaining how to get and display the sprite animations. (sized as new Sprite[SpriteCount]) |
4 | int32 | Frame Count The total number of frames stored in the file. |
12 * i | Frame[] | Frame Info The data explaining how to get and display the individual frames of a sprite animation. (sized as new Frame[FrameCount]) |
4 | int32 | Stream Count The total number of compressed data streams stored in the file. |
12 * i | Stream[] | Stream Info The data explaining how to get and decompress the image data streams. (sized as new Stream[StreamCount]]) |
var | Stream[] | Stream Data The compressed image data streams. |
The Sprite Struct
Size | Type | Description |
---|---|---|
2 | int16 | Flags The play back settings. |
2 | int16 | Width The cell width of the animation. |
2 | int16 | Height The cell height of the animation. |
2 | int16 | Frame Start The starting frame number for the animation. |
2 | int16 | Frame Count The total number of frames for the animation. |
1 | byte | Unknown Unknown, but important. |
1 | byte | Frame Rate The tick delay between frames. |
The Frame Struct
Size | Type | Description |
---|---|---|
2 | int16 | Stream The stream number that the frame image data is stored in. |
2 | int16 | Data Position The starting position of the frame image data in the decompressed stream. |
2 | int16 | Left Offset The left offset of the image data relative to the sprite cell. |
2 | int16 | Up Offset The up offset of the image data relative to the sprite cell. |
2 | int16 | Right Offset The right offset of the image data relative to the sprite cell. |
2 | int16 | Down Offset The down offset of the image data relative to the sprite cell. |
The Stream Struct
Size | Type | Description |
---|---|---|
4 | int32 | Compressed Position The starting position of the compressed data stream. |
4 | int32 | Decompressed Length The total length of the decompressed data stream. |
4 | int32 | Unknown Unknown, most likely useless. |
var | byte[] | Compressed Image Data The compressed data stream's binary data. (see Decompression Routine in Team17 compression) |