Skip to content

Map File Formats

shartte edited this page Apr 3, 2015 · 35 revisions

Map List (rules/maplist.mes)

Contains a list of all the maps that are defined in the module.

At most 200 maps are supported. This is a limit imposed by the in-memory representation of this file.

The file itself is pretty self-explanatory.

In-Memory Representation

Memory address 0x10AA9540 has a pointer to 200 elements of MapListEntry. Memory address 0x10AA95A0 holds the current number of loaded maps in the array above.

/*
  For any type other than NONE, there is only one map that can have that type.
  The last map id with that type is stored in the array @ 0x10AA95B4. 
  Map ID for MT_START is set to 1 automatically if it's zero. But MT_START is no 
  longer used due to the vignettes.
*/
enum MapType {
  MT_NONE = 0, // Means normal maps
  MT_START, // Arcanum leftover
  MT_SHOPPING, // Is used for the main menu background
  MT_TUTORIAL // Tutorial entry point
};

enum MapFlag {
  MF_DAYNIGHT_XFER = 1,
  MF_OUTDOOR = 2,
  MF_UNFOGGED = 4,
  MF_BEDREST = 8
};

struct MapListEntry {
  int id; // The key of the mes line
  int flags; // See MapFlag
  char name[256]; // Directory name, really
  int worldmap; // Default is -1, one map has 0, but seems to never be used
  int area;
  int movie;
  int padding; 
  int64_t startTileX; // The two numbers directly following the name
  int64_t startTileY;
};

Map Properties (map.prp)

Found in the map directory. Has the following structure:

struct MapProperties {
  int artId; // Lookup key for art/ground/ground.mes
  int unused; // Mostly 0, sometimes garbage (cccccccc, stack pointers)
  uint64_t limitX; // Seems to be number of tiles on X axis. Always 960
  uint64_t limitY; // Seems to be number of tiles on Y axis. Always 960
};

The art id of the current map is stored at 0x1080FA58.

Map Start Location (startloc.txt)

This file is actually optional. It may have been used for the start location within the editor only.

The format is a simple text file that has a X position on the first line and Y position on the second line.

Example (for Hommlet):

487
506

Measured in tiles. It is stored in memory location 0x10AA9590 as a 64-bit integer (lower 32-bit are X, upper 32-bit are Y).

Global Lighting (global.lit)

Seems optional.

struct GlobalLighting {
  bool enabled; // 32-bit repr
  D3DLIGHT8 light; // Describes the light.
};

TODO: This does not seem to be entirely correct, since it's only reading 0x30 bytes.

The light direction vector is automatically normalized after loading it.

Description of D3DLIGHT8

fog.col

Optional, and unknown purpose.

struct FogCol {
  int unk1;
  float unk2;
};

The first value seems to be unused entirely, while the second seems to be used somewhere deep within the townmap UI.

Path Nodes (pathnodes.pnd)

Stored on a per-map basis in pathnode.pnd. Actually seems to be optional.

The file has the following structure (with no padding):

000000 DWORD count
repeat count times:
  000000 DWORD id
  000004 DWORD x
  000008 DWORD y
  00000C FLOAT xoffset
  000010 FLOAT yoffset
  000014 DWORD neighbourCount
  repeat neighbourCount times:
    000000 DWORD neighbourId

Explored Tile Data (etd00y00x)

This data stores what areas of the map have already been uncovered by the player so fog of war becomes persistent.

It's stored in four files for each map in the savegame directory:

  • etd000000
  • etd000001
  • etd001000
  • etd001001

Speculation: etd means explored tile data

The number of files is capped and cannot change, since the in-memory reprsentation is not in dynamic memory. The data is stored 1:1 at 0x11E61560. First byte seems to be a flag that if true, sets all data to 0xFF (possible meaning it all has been explored).

Speculation: Given one bit storage per sampling point (explored/unexplored) the files could contain 512x512 bits of data in total.

Map Extension File (mapinfo.txt)

Optional file present in the map folder. Supports one command per line, the following commands are possible:

Command Used in Vanilla Effect
SoundScheme: X,Y Yes Controls the active sound schemes for the map. See sound\schemeindex.mes. Two different schemes can be active at once. 0 means that no scheme should be used (i.e. X,0 if only scheme X should be active).
Reverb: X,Y,Z Yes X is the number of the MSS room type to be applied (see table below). Y is the "dry reverb" (percentage 0-100). Z is the "wet reverb" (percentage 0-100). The room type may only be applied to 3D positioned sound, while the reverb applies to all sounds. Example: Reverb: 8,50,50. NOTE: This has to be used after the SoundScheme command, since that command resets the reverb.
LightScheme: X No Sets the lighting scheme to the specified number (1 or 2) from rules\Lighting Schemes.mes. This effectively specifies if there is daytime dependent ambient lighting (1) or not (2).
ground: X No Seems to overwrite the art id found in map.prp with X.

MSS Room Types

The following room types (see reverb command above) are supported by MSS:

Name Number
GENERIC 0
PADDEDCELL 1
ROOM 2
BATHROOM 3
LIVINGROOM 4
STONEROOM 5
AUDITORIUM 6
CONCERTHALL 7
CAVE 8
ARENA 9
HANGAR 10
CARPETEDHALLWAY 11
HALLWAY 12
STONECORRIDOR 13
ALLEY 14
FOREST 15
CITY 16
MOUNTAINS 17
QUARRY 18
PLAIN 19
PARKINGLOT 20
SEWERPIPE 21
UNDERWATER 22
DRUGGED 23
DIZZY 24
PSYCHOTIC 25

Map Limits (rules\maplimits.mes)

The map id (i.e. 5001) is used to look a line in this file. The line has the following format:

{5001}{8180,-8708,-8180,-18172}

If no line can be found, 9000,0,-9000,-18000 is assumed.