A Terrain Material file has no header and contains an array of zone material blocks. The zone map controls the layout of these blocks in world space but Battlezone uses row-major order starting at the southwest corner of the map.
Each zone material block is a 64 by 64 array of material entries in row-major order starting at the southwest corner of the zone. Successive entries in a row are at increasing X positions (west to east). Successive rows are at increasing Z positions (south to north).
Each material entry is a 16-bit bitfield and determines the texture and texture coordinates applied to the corresponding 2 by 2 terrain tile. The file data uses little-endian byte ordering so the byte containing Cap, Flip, Rotation, Mix, and Variant comes first and the byte containing Base and Next comes second.
If Base and Next are the same, the tile will be solid. Otherwise, the tile will be a cap or diagonal depending on the Cap bit. Each solid tile for a given material and cap or diagonal tile for a given pair of materials can have up to four distinct textures selected by Variant.
Cap, Flip, and Rotation combine to form the Mix index. The terrain system uses the Mix index to look up texture coordinates for vertices within a terrain tile. Note that cap (0 through 7) and diagonal (8 through 15) yield different texture coordinates when applying flip (4 through 7 and 12 through 15).
|4||-U||+V||Flip across z|
|5||-V||-U||Flip across -x,+z diagonal|
|6||+U||-V||Flip across x|
|7||+V||+U||Flip across +x,+z diagonal|
|12||-V||-U||Flip across -x,+z diagonal|
|13||+U||-V||Flip across x|
|14||+V||+U||Flip across +x,+z diagonal|
|15||-U||+V||Flip across z|