Jump to content

MAP.DAT: Difference between revisions

From UFOpaedia
Little more information about MAP files.
m categorizing
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This file is only used by tactical saves.
This file is ''only'' used by tactical saves. It is not automatically generated at the beginning nor end of battle, unlike [[Saved_Game_Files#Missdat_Files|certain other files]].


Length of wglob[2]*wglob[3]*wglob[4]*4 bytes.
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 first 3 bytes indicate the width, length and height of the map module. After that, the actual cell data starts with each record containing 4 bytes. Each byte points to a different object in the MCD array summarized below.
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 [[MAPS|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.


*The first byte is the ground.
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|MCD array]]:
*The second is the west wall.
*The third is the north wall.
*The forth is the contents (not usable objects - dirt and stuff).


Tiles are stored in order of left to right, top to bottom, top floor to bottom floor.
[[Image:Map_Record.png|right]]
* 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).


<b>Note:</b> When opening map files with MS-EDIT, open it in 4-column widths, but remember that the ground tile of the cell will be found at the last byte in the row <b>above</b>.
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==
==See Also==
* [[Saved Game Files]]
* [[Saved Game Files]]
* [[Saved_Game_Files#Battlescape_Files|Battlescape Files]]
* [[Saved_Game_Files#Battlescape_Files|Battlescape Files]]
* [[MAPS|MAPS Folder]]
* [[TERRAIN|MCD Info]]
[[Category:Game Files]]
[[Category:Game Files]]
[[Category:Enemy Unknown/UFO Defense]]

Latest revision as of 04:39, 23 July 2013

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:

  • 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