Battlezone MAT (Terrain Material)

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.

Zone Material Block

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).

Material Entry

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.

1512 118 7 6 54 32 10
Base Next Cap Flip Rotation (Unused) Variant
Mix

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.

Mix

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).

MixImg+X+ZDescription
0+U+VNormal
1-V+URotate +90
2-U-VRotate 180
3+V-URotate -90
4-U+VFlip across z
5-V-UFlip across -x,+z diagonal
6+U-VFlip across x
7+V+UFlip across +x,+z diagonal
8+U+VNormal
9-V+URotate +90
10-U-VRotate 180
11+V-URotate -90
12-V-UFlip across -x,+z diagonal
13+U-VFlip across x
14+V+UFlip across +x,+z diagonal
15-U+VFlip across z