Jazz Jackrabbit Bonus Format

From ModdingWiki
Jump to navigation Jump to search
Jazz Jackrabbit Bonus Format
There is no image of a tileset in this format — upload one!
Format typeTileset
Max tile countUnknown
Tile names?No
Minimum tile size (pixels)0×0
Maximum tile size (pixels)16,383×65,535
Plane count1
Plane arrangementLinear
Transparent pixels?No
Hitmap pixels?No
Supports sub-tilesets?No
Compressed tiles?No
Hidden data?No

The Jazz Jackrabbit file BONUS.000 contains the bonus font and sprites, including Jazz. These sprites are warped in-level to look 3D. the file itself is a combination sprite and font file. As such it includes characteristics of both formats.

There is a 4-byte header of two words that gives the total number of entries and the total number of sprite entries in the file. From this the total number of font entries can be calculated.

After this comes the data, first sprites, then font. Though a sprite entry can be any format, in practice the masked sprites (Jazz) come first and the unmasked ones (bonus level objects) last. It is also notable that the default file has one 0x1 size sprite, entry 15, which consists of nothing by an 8-byte sprite header. ($0000 $0001 $0000 $0000) that can cause trouble. There are several other placeholder sprites that are very small.

Sprite entries

The sprite format is similar, but not quite identical to the Jazz Jackrabbit Sprite Format; the main difference being that there is no mask data segment and there is no such thing as an empty sprite entry. (Placeholders are used instead.) The unmasked sprites are also not composed of interlaced images. The two types are as follows:

'Unmasked' sprite entry:
0     2           Sprite width
2     2           Sprite height
4     2           'Pixel data' size $FFFF to indicate sprite is 'unmasked'
6     2           Image size
8     w*v         Image, exactly what it sounds like

'Masked' sprite entry:
0     2           Sprite width \ 4
2     2           Sprite height (Excluding extra height)
4     2           Pixel data size, number of nonzero-value pixels in sprite mask, the total
                  'Pixel data' size will be four times this value.
6     2           Image size, [Height] + 1 * [width]
8      w * h \ 4   Squashed sprite mask, each byte is worth four pixels of sprite. Values are between
                  0-15, with the last four bits of each byte controlling whether the four pixels are
                  masked, and in what order.
wh/4  4 * pd      Pixel data 1,2... The color of each pixel of the sprite. The decompressed mask is
                  divided into columns, much like the 'unmasked' sprites above. This data then controls
                  the color of each column. Since the mask has an entry for every four pixels, this
                  will occasionally need a color entry for a pixel that is not supposed to be masked
                  color 0 is used for this. (However, zero value mask entries aren't given any data
                  here.) This is difficult to envision without a diagram.

Font entries

Font entries follow sprites. They are more closely related to unmasked sprites than to any of the Jazz Jackrabbit Font Format formats though, as they need to be partially transparent.

0     2          Character width for display
2     2          Character height
4     4          Image size. Complex. Font characters are stored like unmasked sprites as four 
                 interlaced images. This means the character's coded width must divide by 4 .
                 Thus a character 17 pixels wide is rounded up to 20. This value is the 'real'
                 character width * character height divided by 4. And the character is made of
                 four of these images. Thus a 10x10 character would have a value of 12x10/4 = 30.
                 The 'extra' width columns are not displayed by the game.
8     IS * 4     Font data, four images of [Image Size] bytes each