Duke Nukem II CZone Format

From ModdingWiki
Jump to: navigation, search
Duke Nukem II CZone Format
File:Duke Nukem II CZone Format.png
There is no image of a tileset in this format — upload one!
Format typeTileset
HardwareEGA
Max tile countFixed
PaletteExternal
Tile names?No
Minimum tile size (pixels)8×8
Maximum tile size (pixels)8×8
Plane count4-5
Plane arrangementByte-planar
Transparent pixels?Yes
Hitmap pixels?No
Metadata?None
Supports sub-tilesets?No
Compressed tiles?No
Hidden data?No
Games

The CZone format stores three blocks of data - the behaviour of each tile in a tileset, a collection of images for the "solid" background tiles, and a collection of images for the "masked" foreground tiles.

File format

Data type Name Description
BYTE[3600] attributeData Attribute data
BYTE[32000] solidTileset Graphics for the solid tileset
BYTE[6400] maskedTileset Graphics for the masked tileset

Attribute Data

The attribute data consists of 1000 UINT16LE values (settings for the solid tiles), followed by 800 UINT16LE values (five values for each masked tile). It seems like only the first value for each masked tile is actually used by the game.

Bit Description
15  ??? [used on horns in CZone9]
14 climbable (chains/ladders)
13  ??? [unused]
12  ??? [unused]
11  ??? [unused]
10 fast animation
9 conveyor belt ->
8 conveyor belt <-
7 can hang on it (pipes, vines etc.)
6 burns away when shot
5 draw in front
4 animate (uses current tile and next 3 tiles)
3 block right
2 block left
1 block up
0 block down

Solid Tileset

The solid tileset is comprised of 1000 tiles. Each tile is 8x8 pixels, and for best effect when presenting it to a user/designer it should be displayed in a grid 40 tiles wide by 25 tiles high.

The tiles are stored in Cosmo Tileset Format. The first plane is blue, followed by green, red and then intensity.

Since the tiles are 8x8, each plane's scanline fits into one byte. At eight pixels tall that makes each plane occupy eight bytes, and with four planes the whole tile takes up 32 bytes. This means you can seek to any tile with a simple formula:

iOffset = iTileIndex * 32

Masked Tileset

The masked tileset is almost identical to the solid tileset, except that there are only 160 tiles (so only four rows high, but still 40 tiles wide) and of course being a masked tileset, there are five planes. The first plane is transparency, followed by blue, green, red and intensity as with the solid tiles.

Credits

This file format was reverse engineered by Dave Bollinger. Most of this info came from the specs on his website. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)