MTXM
The terrain the game draws: one 16-bit tile number per tile, including the tiles of placed doodads. A tile number is a tile group of the tileset times 16 plus the tile's place in the group, 0 to 15.
| Name | MTXM (4D 54 58 4D) |
|---|---|
| Size | 2 bytes per tile: width × height × 2. |
| Read by | The game. |
| Required | Yes. The game does not load a map without it. |
| More than one copy | Every copy is written over the start of the same fixed-size space, in file order, so a later copy replaces only as many bytes as it carries. |
| In scmJS | Read, and written again when you change what it holds. |
Tile (x, y), counting from 0 at the top left, is at byte (y × width + x) × 2.
What a tile number points at#
A tile number is a tile group and a variation: the group is the number divided by 16, and the variation the remainder. Tile 0x0132 is group 19, variation 2. The groups are the records of the tileset's CV5 file, 52 bytes each:
| Offset | Type | Holds |
|---|---|---|
| 0 | u16 | The terrain type the group belongs to; 1 for a doodad's group |
| 2 | u16 | Flags: buildability and walkability in the low byte, ground height in the high byte |
| 4 | u16 × 4 | Links for the left, top, right and bottom sides, which the isometric brush matches (ISOM) |
| 12 | u16 × 4 | Stack links for the same sides, which say how pieces of a cliff face continue above and below |
| 20 | u16 × 16 | The megatile of each of the 16 variations |
A megatile is a 32 × 32 picture made of sixteen 8 × 8 minitiles, and leads to its pixels as Game data describes. Walkability and height are kept per minitile, in the VF4 file.
A doodad's group keeps other things where terrain groups keep their links: the sprite or
unit drawn over it at offset 4, its name in stat_txt.tbl at 8, its number in the
tileset's doodad list (the number a DD2 record stores) at 12, and its width and
height in tiles at 14 and 16. A doodad spans one group per row of tiles: row r of a doodad
whose first group is g is group g + r, and column c is variation c.