ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

TMP

From ModEnc
Revision as of 17:58, 15 August 2019 by Crimsonum (talk | contribs) (Expanded the article with known information.)
Jump to: navigation, search

TMP files are terrain files used in Tiberian Sun through Yuri's Revenge. They constitute the solid, mostly indestructible terrain upon which every other game object is layered. TMPs come in various shapes, each comprised of one or more tiles1. Furthermore, TMPs are divided into tilesets, which define certain attributes that each TMP in the set should have.

TMP files use the same theater-specific file extensions as TerrainTypes: .tem, .sno, etc.

The maximum tile size of a TMP file is 10x10 tiles.

Tiles

Tiles are the diamond-shaped, single-cell pieces that make up a TMP file. Each tile is composed of two images: a normal image that covers the cell shape, plus an optional "extra" image perpendicular to the normal image. This extra image is essential for creating the illusion of a 3D-environment, as it allows for hiding terrain and objects behind it, thus creating a sense of depth, or the filling of space between tiles at different height levels.

In addition to graphics, each tile has several parameters that specify characteristics such as height, land type and slope type.

File Format

A TMP file consists of two parts, the file header and tile headers.

struct FileHeader
{
	unsigned int BlockWidth; // size in blocks
	unsigned int BlockHeight;
	unsigned int BlockImageWidth; // size of each block
	unsigned int BlockImageHeight;
};

Following the file header is an index of pointers to each tile header.

struct TileHeader
{
	signed int TileX; // tile offset
	signed int TileY;
	unsigned int ExtraDataOffset;
	unsigned int ZDataoffset;
	unsigned int ExtraZDataoffset;
	signed int ExtraX; // extra image offset
	signed int ExtraY;
	unsigned int ExtraWidth;
	unsigned int ExtraHeight;
	unsigned char Bitfield; // three of the bits specify whether the tile has an extra image, Z data, and damaged art (applies only to bridges), respectively.
	BYTE padding[3];
	unsigned char Height;
	unsigned char LandType; // see LandTypes
	unsigned char SlopeType;
	RGB LowRadarColor; // color to show on the radar for this tile at the lowest map height
	RGB HighRadarColor; // color to show on the radar for this tile at the highest map height
	BYTE padding[3];
}

The graphics are encoded after the tile header.

For more information on the file format, see TMP documentation.

TileSets

TileSets define certain characteristics to a group of TMP files, such as whether Tiberium/ore can grow on the tiles, or whether they can be deformed or burrowed through. Each TileSet has its own section in the theater control file.

A TileSet has a practical limit of 99 TMPs.

Footnotes

1 Confusingly, both TMPs and the tiles that make up a TMP file are both referred to as "tiles" in different contexts.

2 Sometimes referred to as terrain type (not to be confused with TerrainTypes)