Z Map Format

From ModdingWiki
Jump to navigation Jump to search
Z Map Format
File:Z Map Format.png
There is no image of a map in this format — upload one!
Format typeMap/level
Map type2D tile-based
Layer count1
Tile size (pixels)16×16
Viewport (pixels)544×368 (SVGA)
Games
Z

Levels in Z store terrain and supporting data in LEVELnn.MAP. The shipped maps inspected by the repository use version 0xF7.

File format

Offset Data type Name Description
0 UINT8 version 0xF7.
1 BYTE[0x1a00] sectionA Initial copy to the buffer referenced by static address 0xf40a8.
0x1a01 BYTE[0xac8] sectionB Copied to 0x17aa58.
0x24c9 BYTE[0x2a8] sectionC Copied to 0xd09cc.
0x2771 BYTE[0x8020] map Names, dimensions and cell planes.
0xa791 BYTE[0x1e0] skipped Skipped by this loader.
0xa971 BYTE[0x3300] sectionD Replaces the buffer referenced by 0xf40a8.

Total length is 56433 bytes (0xdc71). Section addresses are static executable addresses, not file offsets. The auxiliary sections are preserved by the parser; their complete semantic schemas have not been established.

Map block

Offset Data type Name Description
0x00 char[13] tileset NUL-terminated tileset name.
0x0d BYTE unknown Preserve.
0x0e char[13] tileset2 Second tileset name.
0x1b BYTE unknown Preserve.
0x1c UINT16LE width Active width in tiles.
0x1e UINT16LE height Active height in tiles.
0x20 BYTE[16384] plane0 Low 8 bits of tile graphic index.
0x4020 BYTE[16384] plane1 High tile bit and terrain classification.

Offsets in this table are relative to the map block. Both planes always have a 128-byte row stride, even when the active width is smaller. For cell (x,y), use i = y*128+x and tile = plane0[i] | ((plane1[i] & 0x80) << 1). The low seven bits of plane 1 are terrain/behaviour data, not more graphic-index bits. Tile pictures are 16×16 pixels in the matching BLK file.

Notes

Other version branches are mentioned in the RE notes, but the parser supports only 0xF7. Preserve unknown sections when editing. The two stored planes describe one terrain layer, not two independently drawable tile layers.

Source code

From re-z, the open-source browser port:

Credits

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