Zone 66 Level Format

From ModdingWiki
Jump to navigation Jump to search
Zone 66 Level Format
Zone 66 Level Format.png
Format typeMap/level
Map type2D cell-based
Layer countN/A
Tile size (pixels)32×32
Viewport (pixels)320×200
Cell dimensions256×256
Games

The Zone 66 Level Format is made up of a collection of files for each level in the game.

File format

  • Each level is a fixed size of 256×256 cells, with 32×32 pixel tiles.
  • The files are named as mapX... where X is a character between A and H. A is episode 1, B is episode 2, etc.
  • All maps are drawn with the palette found in mpal.z66.

Signature

There is no signature, however careful processing of the files can be used to check whether the format is correct:

  • mapX.z66 must be exactly 65536 bytes in length.
  • mapXdat.z66 must be n×2 bytes in length, where n is the maximum value in mapX.z66

mapX.z66

This file contains the map background. It is 65536 bytes long (256×256 bytes) and contains one byte for each cell in the level.

Each byte is an index into the tile mapping table stored in mapXdat.z66

mapXdat.z66

Note that this file is NOT compressed.

This file contains a mapping between 8-bit tile codes and 16-bit tile numbers. It is an array of up to 256 UINT16LE values.

Data type Name Description
UINT16LE count Number of tile mapping codes
UINT16LE animCount Number of animated tile structures
UINT16LE[count * 2] bgMap List of tileset indices for up to 256 background layer map codes plus another 256 codes for destroyed tiles
UINT8[count] destroyScore Points awarded when this tile is destroyed
UINT8[count] canDestroy 0=invulnerable, 1=tile can be destroyed
ANIM[animCount] anim Information about animated tiles

The bgMap array holds the index of the tileset image to use for each map code. There are two entries for each code, the first is the tileset index of the normal tile, the second is the tileset index of the destroyed tile. So map code 0 corresponds to the first (normal) and second (destroyed) entries in this array. Map code 1 uses the third (normal) and fourth (destroyed) entries, and so on.

The ANIM structure is as follows:

Data type Name Description
UINT16LE mapCode Map code of tile to animate ! confirm
UINT16LE frameFirst Tileset index of first animation frame
UINT16LE frameLast Tileset index of last animation frame
UINT8 loopFlag 0=jump (from last frame back to first), 1=ping-pong (play forward, then in reverse)
UINT8 reserved1 Used only internally by the game
UINT8 reserved2 Used only internally by the game
UINT8 speed Number of ticks between frames

Each value read from mapX.z66 is looked up here (i.e. if the value read was 9 then the tenth value in this file would be read. The tenth value is the UINT16LE at offset 4+9*2=22). This value is then an index into the tileset stored in mapXgrfx.z66.

mapXgrfx.z66

This is the tileset containing images for each cell in the map. It is in a different format to the other tilesets (which are in Zone 66 Tileset Format). Instead, this file contains no header or other data. It is simply 32×32 8bpp images one after the other. A given cell index t will begin at offset t * 32 * 32 in this file.

mapXdat3.z66

! Document this format from http://forum.xentax.com/viewtopic.php?p=45050#p45050

Credits

This file format was reverse engineered by john_doe. 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!)