display-name: "Games/Traffic Dept. 2192"
meta: {"Working": "All images"}

if (file.name like "*.pal")
{
	palette
	{
		size: 256
		format: "R6G6B6"
	}
}

palette: "td.pal"

if (file.name like ["*.scr", "*.hlp", "city.td", "javelin.td"])
{
	palette
	{
		size: 256
		format: "R6G6B6"
	}
	image
	{
		format: "I8"
		width: 320
		height: 200
	}
}

if (file.name like ["*.blk", "*.cmm"])
{
	folder: "Tiles"

	data(768) unknown //looks like a palette, but isn't used

	image
	{
		format: "I8"
		data-size: file.remaining-bytes
		width: 32
		height: 32
		tiles-across: 8
	}
}

if (file.name like "*.dat" and file.name != "tdstatus.dat")
{
	text
}

if (file.name like "newFaces*")
{
	loop while(file.remaining-bytes > 0)
	{
		palette
		{
			size: 256
			format: "R6G6B6"
		}

		image
		{
			format: "I8"
			width: 160
			height: 100
		}
	}
}

image-size-table:
{
	["????17*"]: { "width": 320, "height": 90},
	["????19*"]: { "width": 320, "height": 36},
	"mine.td":   { "width": 32,  "height": 32},
	"lander.td": { "width": 32,  "height":  160}
}

if (file.name like ["????17*", "????19*", "mine.td", "lander.td"])
{
	image
	{
		format: "I8"
		width: image-size-table[file.name].width
		height: image-size-table[file.name].height
		data-size: file.size
	}
}

image-size-table-2:
{
	["????13*"]: {"width": 202, "height": 86},
	["????14*"]: {"width": 200, "height": 200},
	["????15*"]: {"width": 255, "height": 121},
	["????16*"]: {"width": 150, "height": 170},
	["????18*"]: {"width": 170, "height": 104},
	["????20*"]: {"width": 320, "height": 100},
	["secret*"]: {"width": 320, "height": 32},
	["pic4.td"]: {"width": 100, "height": 150}
}

if (file.name like ["*.pic", "pic4.td"])
{
	palette
	{
		size: 256
		format: "R6G6B6"
	}

	image
	{
		format: "I8"
		width: image-size-table-2[file.name].width
		height: image-size-table-2[file.name].height
		data-size: file.remaining-bytes
	}
}

sprite-size-table:
{
	"td.dun": {"width":	32, "height": 32},
	["*.ccm"]:{"width":	32, "height": 32},
	"td.hel": {"width":	32, "height": 32},
	"td.shp": {"width":	32, "height": 32},
	"td.exp": {"width":	32, "height": 32},
	"td.fac": {"width":	28, "height": 28},
	"td.lt2": {"width":	5,  "height": 5},
	"td.ltr": {"width":	12,	"height": 16},
	"td.sss": {"width":	320, "height": 32},
	"td.win": {"width":	320, "height": 32},
	"td.wea": {"width":	36,	"height": 18},
	["*"] : { "width": 40, "height": 40}
}

//td.sss is incorrect
if (file.name like ["*.dun", "*.hel", "*.exp", "*.fac", "*.h2", "*.joy", "*.ltr", "*.lt2", "*.shr", "*.sc2", "*.sc3", "*.shp", "*.sss", "*.win", "*.wea", "*.ccm"])
{
	folder: "Sprites"

	image
	{
		format: "I8"
		width: sprite-size-table[file.name].width
		height: sprite-size-table[file.name].height
		tiles-across: 320 / width
		data-size: file.size
	}
}

palette: "tdmen.pal"

if (file.name == "td.men")
{
	image
	{
		format: "I8"
		width: 160
		height: 100
	}

	image
	{
		format: "I8"
		width: 320
		height: 200
	}

	image
	{
		format: "I8"
		width: 320
		height: 128
	}

	image
	{
		format: "I8"
		width: 100
		height: 20
		data-size: 124960 - 120960
	}

	image
	{
		format: "I8"
		width: 100
		height: 20
	}

	image
	{
		format: "I8"
		width: 160
		height: 14
	}
}

if (file.name like "*.voc")
{
	interpret-as "sound-VOC"
}

if (file.name like "*.cmf")
{
	folder: "Music"
}