Duke Nukem II CZone Format
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.
|BYTE||solidTileset||Graphics for the solid tileset|
|BYTE||maskedTileset||Graphics for the masked tileset|
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.
Each individual attribute value is a bitmask. The meaning of the bits is as follows:
|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)|
Bits 11, 12, 13, and 15 are not used by the game, and simply ignored if they are set. The tileset "czone9" has bit 15 set on some of its tiles (horns), but it has no effect. Most likely a leftover from an earlier point in the game's development.
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
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.
This file format was reverse engineered by Dave Bollinger. Most of this info came from the specs on his website. lethal guitar verified that unknown/unused tile attribute bits are not used by the game. 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!)