MAP.DAT

From UFOpaedia
Jump to: navigation, search

This file is only used by tactical saves. It is not automatically generated at the beginning nor end of battle, unlike certain other files.

The length (in bytes) is equal to the width of the map multiplied by the height multiplied by the depth (offsets 2, 3 and 4 of WGLOB.DAT), all multiplied by four. This file is not erased between writes, so if a "small" map (40x40x4, 25,600 bytes) is saved over a slot where a previous "larger" map was (50x50x4, 40,000 bytes), then the file will still be 40,000 bytes - though the last 14,400 of these should be ignored.

The contents detail each tile that makes up the battlescape map (stored in order of left to right, top to bottom, top floor to bottom floor). Essentially, it's a bunch of map module files crammed together; which modules are determined by GEODATA.DAT during Battlescape Map Generation. By creating a copy of these maps for each battle, it becomes possible to keep track of battlescape damage (eg, that barn you blew up) without altering the original versions.

Each "position" of the map (that is, each tile you can move your mouse cursor over) is represented by four bytes. Each of these maps to a separate index within the associated MCD array:

Map Record.png
  • The first byte links to the tile that represents the ground (eg, grass, dirt, pavement, etc).
  • The second byte links to the tile that represents the west-facing wall (eg, a barn wall, brick wall, fence, etc).
  • The third byte links to the tile that represents the north-facing wall (eg, a barn wall, brick wall, fence, etc).
  • The forth byte links to the tile that represents an abstract object (eg, a fridge, a haybale, a tree, a chair, etc).

If a given offset is set to 0, then no tile of that type exists at that location (for example, not every map position has to have a wall in it). If no "ground tile" is set for a location at ground level, the game will automatically place dirt there (from the second entry of BLANKS.MCD).

See Also