WORLD.DAT
The original XCOM file is 13320 bytes long, while TFTD is 14660 bytes long. However, each uses the same 20-byte record format giving the original 666 entries and TFTD 733 entries. This file describes the terrain on the geoscape screen using quadrilateral polygons and triangles.
The first 16 bytes of file contain the points for the polygon. 4 sets of 2 short (2-byte) integers, designating the 'X' and 'Y' coordinate (or latitude and longitude if you prefer). If the last set has an x value of -1 then it is to be rendered as a triangle, otherwise it is a quad.
The last 4 bytes in the record contain the terrain type. This could be a long integer or 2 short integers as the last 2 bytes in each record are 0.
Structure
Offsets | Meaning | Values |
---|---|---|
0-1 | First X coordinate | 0 - 2880 |
2-3 | First Y coordinate | -720 - 720 |
4-5 | Second X coordinate | 0 - 2880 |
6-7 | Second Y coordinate | -720 - 720 |
8-9 | Third X coordinate | 0 - 2880 |
10-11 | Third Y coordinate | -720 - 720 |
12-13 | Fourth* X coordinate | 0 - 2880 |
14-15 | Fourth* Y coordinate | -720 - 720 |
16-19 | Terrain Type/Texture | 0-12 |
* As mentioned above, the fourth coordinate could be (-1, 0) denoting a triangle
As the possible latitude values range from 0 to 2880 and the longitude values range from -720 to 720, the resulting map could be said to have a resolution of 00°07'30".
Texture / Terrain Type
The final value in each record points to the texture type to be displayed for that polygon. It also serves to determine the terrain type used when you start a battle in that area.
UFO TFTD 0: Forest / Jungle 0: (Nothing?) 1: Farm 1: Pipes 2: Farm 2: Crashed Plane 3: Farm 3: Atlantis 4: Farm 4: Mu 5: Mountain 5: Sunken Galleon 6: Forest / Jungle 6: Sunken Liner 7: Desert 7: Volcanic 8: Desert 8: (Nothing?) 9: Polar 9: Volcanic 10: Forest / Jungle 10: Sunken Liner 11: Forest / Jungle 11: Pipes 12: Polar 12: Mu
In UFO, terrain types 0, 6, 10 and 11 will produce forest missions in the northern hemisphere and jungle mission in the south.
For TFTD, the terrain type is always selected randomly from a choice of three - Coral, Seabed Rubbish, and whatever the terrain type for that actual polygon is. In the case of a type 0 or 8, the mission will always be in either the Coral or Seabed Rubbish terrains.
Although TFTD has three choices of underwater depth that can be associated with any given mission (plus a forth "depth" for surface missions), that value is not derived from this file. Most likely it's taken from the LOC.DAT record that points to the mission in concern.
TFTD seems to have overlapping polygons at places whereas XCOM didn't (exception to the poles, which is probably because these polygon's are rendered to a sphere not a flat surface).
--Pi Masta 15:24, 10 April 2007 (PDT)
Each polygon has it's light calculated individually, This gives rise to the effect of a large area of the same texture having different colors.
The country and regional borders must be stored in the executable somewhere. I've tried hard looking for the position of cities in there hoping the position would be near it's ENGLISH.DAT index, but I haven't had much luck.
--Pi Masta 16:06, 10 April 2007 (PDT)