FANDOM


MAZExxxx.DAT files contain the information for each map, where xxxx is the map ID in decimal. It does not contain the specific graphic information. A seperate *.TIL file must be loaded for the minimap, as well as seperate *.WAL and *.SRF files for the 3D window. If the mapID is greater than 99, the first x becomes a literal X. ie, MAZEX123.DAT is the file for map ID 123.

Note that "outdoor" vs "indoor" is somewhat of a misnomer. It should really be "overworld" vs "innerworld": innerworld consists of towns, towers, caves, etc... while the overworld consists of the vast outside area, including the sky road on the Darkside of Xeen.

Usage Edit

A map is composed of 16x16 tiles. Each tile in the map is comprised of four 4 bit nibbles. The (0, 0) coordinate is in the lower left, which differs from most systems which have (0, 0) in the upper left. In order to draw the map correctly, it must be flipped vertically.

Wall Data Edit

The first 512 bytes of the file form a 16x16x4 array of nibbles. Each tile is therefore comprised of a single uint16. This tile represents the physical map data.

Outdoor Edit

The low nibble of the low byte is the base surface, denoted as iBase, comprised of the ground surfaces such as water, grass, paths, etc. It can be found as {iBase = map[y*32+x]&0x0F;}. It is a reference into a table of OUTDOOR.TIL for 2D map drawing and SRF files for 3D map drawing as follows:

  • 0 = no surface drawn, the default ground sprite shows through
  • 1 = DIRT.SRF
  • 2 = GRASS.SRF
  • 3 = SNOW.SRF
  • 4 = SWAMP.SRF
  • 5 = LAVA.SRF
  • 6 = DESERT.SRF
  • 7 = ROAD.SRF
  • 8 = WATER.SRF
  • 9 = TFLR.SRF
  • 10 = SKY.SRF
  • 11 = CROAD.SRF
  • 12 = SEWER.SRF
  • 13 = CLOUD.SRF
  • 14 = SCORTCH.SRF (TODO: my notes say "SCORTCH" but should it be "SCORCH"? did I misspell it in my notes or is the file itself actually misspelled? A: It is actually misspelled, "SCORCH.SRF" hashes to 0x526A, which is not in the CC table of contents, but the hash of "SCORTCH.SRF", 0x2ACD, is.)
  • 15 = SPACE.SRF

The high nibble of the low byte is the middle layer, denoted as iMiddle, comprised of wall layers such as mountains, trees, and wall. It can be found as {iMiddle = (map[y*32+x]>>4)&0x0F;}

The low nibble of the high byte is the top layer, denoted as iTop, comprised of objects, such as towers, towns, and tents. It can be found as {iTop = (map[y*32+x]>>8)&0x0F;} This does not draw them in the 3D view, this is strictly for the 2D map. A corresponding entry in the MOB file must be made for the 3D view. This can allow you to place things on the 2D map that can't be seen in the 3D view (or perhaps were present but was removed), or vice versa, having something appear in the 3D view that doesn't appear on the 2D map.

The high nibble of the high byte is the overlay layer, denoted as iOverlay. It currently serves an unknown purpose. It can be found as {iOverlay = (map[y*32+x]>>12)&0x0F;}

Indoor Edit

Each nibble (4 bits) of the cell data represents a wall, facing towards the centre of the cell, starting with north at the lowest nibble and working clockwise. It does not automatically imply an outward facing wall. For example, if all four walls for a given tile are populated, then the player standing in that tile will be surrounded by walls, but if the player were to be one tile north of that tile and turn around, the "north" wall would appear to have disappeared, unless the tile to the north had a corresponding "south" wall placed. Usually you will want to place corresponding walls in both tiles, but it is not necessary and can give a sort of "illusion" or "trap" wall effect, depending on the direction the player is walking.

The actual values of the wall are references into the FWL and SWL sprite files for 3D rendering, and the respective TIL as noted in the Environment_Set. (TODO: My note says something about this not being a direct mapping. What the heck was I talking about? Probably something like a wall value of 0 means no wall, 1 means regular wall, 2 means torch frames, 3 means door, etc... or something to do with the WallTypes value)

Mapping---

Wall Value (0-15)

Value inside combined FWL1/2

0-7 = tileset1.FWL

8+ = tileset2.FWL

1 9
2 17
3 11
4 8
5 0
6 15
7 16 (unless tileset CAVE is being used .. then 15 again)
8 0
9 10
10 14
11 6
12 1
13 8
14 12
15 13

Note that while the outdoor map has an explicit "object" layer for displaying things on the 2D map, no such layer exists for indoor: objects are placed exclusively from the MOB file.

Cell Flags Edit

This is a 16x16 array, each byte corresponding to the equivalent map tile. It is a bit array representing certain "features" depending if you are on an indoor or outdoor map.

Outdoor Edit

  • 0x80 = Grate (used only as a reference, there is a "grate" object)
  • 0x40 = Water (requires swimming or walk on water, cannot rest on this tile)
  • 0x20 = Drain (used only as a reference, there is a "drain" object)
  • 0x10 = Event auto executes (used for signs, benches, etc...)
  • 0x08 = Object exists (used only as a reference)

The lowest 3 bits (0x04, 0x02, 0x01) indicate if there are monsters present in the left, centre, and right positions of that tile. It's not clear what, if anything, this is used for since it stores the monsters MOB file anyway.

Indoor Edit

Similar to outdoor:

  • 0x80 = ??
  • 0x40 = Water (requires swimming or walk on water, cannot rest on this tile)
  • 0x20 = unknown (TODO: not aware of any indoor map that has this set. If you find one, please post it to the talk page for investigation)
  • 0x10 = Event auto executes (used for signs, benches, etc...)
  • 0x08 = Inside (if set, then the player is "inside" and there is a ceiling to be drawn from the sky sprite. If not set, then the player is "outside" and the regular SKY.SKY sprite is drawn)

The lowest 3 bits are actually a numbered value (found as cell&0x0F) that references the ground of the tile, drawn from the corresponding SRF file exactly the same as above in the outdoor maps wall data. If the water flag (0x40) is set, then this surface value is ignored and set to 8, always using WATER.SRF.

ToDo: It seems if ground tile position 4 resolves to 0 it will draw water regardless of flag. There are no sleep or walk restrictions unless the water flag is set. No other positions seem to have this functionality.

2D Outdoor Map Drawing Edit

Each tile is 4 layered 10x8 pixel frame sprite. Each layer is drawn on top of the last, taking advantage of transparency. The frames are all used from the same file. If the map is an outdoor map (mazeFlags2 & 0x8000 == TRUE) then the default file to load is OUTDOOR.TIL.

To draw the first two layers, you must use indirect lookup. The bottom layer is frame number at surfaceTypes[iBase] and consists of such tiles as water, dirt, road, and lava. The second layer is frame number at wallTyps[iMiddle]+16 and consists of such tiles as trees and mountains. The third and forth layer are mapped directly to the tile file as frame number iTop+32 and iOverlay+48 respectively.

Pseudocode for displaying the map Edit

for (y = 0; y < 16; y++) {
	for (x = 0; x < 16; x++) {
		iBase = (map[y*16 + x] & 0x0F);
		iMiddle = (map[y*16 + x]>>4 & 0x0F);
		iTop = (map[y*16 + x]>>8 & 0x0F);
		iOverlay = (map[y*16 + x]>>12 & 0x0F);
		tileset.drawSprite(surfaceTypes[iBase], x*10, 128-(y*8));
		tileset.drawSprite(wallTypes[iMiddle]+16, x*10, 128-(y*8));
		tileset.drawSprite(iTop+32, x*10, 128-(y*8));
		tileset.drawSprite(iOverlay+48, x*10, 128-(y*8));
	}
}

Note that the y position is 128-(y*8). This is to account for the fact that the origin (0,0) of the map is in the lower left, whereas most systems have the origin at the upper left. Without this simple subtraction, the map would appear upside down.

3D Window Drawing Edit

Outdoors Edit

The outdoor display works by populating a list of "DrawStruct" structures, and then draws that list.

The following list is updated with the expected sprite/frame values and then rendered to the screen.

NOTE: X and Y are offset by 8 to account for drawing inside the "window" which has an 8 pixel border. Developers intending to change this behaviour should account for this offset.

Outdoor DrawStruct list Edit

Default SpriteFrameXYScaleFlagsDescription
0x0000 0 8 8 0 0x0000 Top half of sky
0x0000 1 8 25 0 0x0000 Bottom half of sky
0x0000 0 8 67 0 0x0000 Ground
0x0000 0 8 67 0 0x0000 Surface tile 4 steps forward, 3 left
0x0000 0 38 67 0 0x0000 Surface tile 4 steps forward, 2 left
0x0000 0 84 67 0 0x0000 Surface tile 4 steps forward, 1 left
0x0000 0 134 67 0 0x0000 Surface tile 4 steps forward, 3 right
0x0000 0 117 67 0 0x0000 Surface tile 4 steps forward, 2 right
0x0000 0 117 67 0 0x0000 Surface tile 4 steps forward, 1 right
0x0000 0 103 67 0 0x0000 Surface tile directly 4 steps forward
0x0000 0 8 73 0 0x0000 Surface tile 3 steps forward, 3 left
0x0000 0 8 73 0 0x0000 Surface tile 3 steps forward, 2 left
0x0000 0 30 73 0 0x0000 Surface tile 3 steps forward, 1 left
0x0000 0 181 73 0 0x0000 Surface tile 3 steps forward, 3 right
0x0000 0 154 73 0 0x0000 Surface tile 3 steps forward, 2 right
0x0000 0 129 73 0 0x0000 Surface tile 3 steps forward, 1 right
0x0000 0 87 73 0 0x0000 Surface tile directly 3 steps forward
0x0000 0 8 81 0 0x0000 Surface tile 2 steps forward, 2 left
0x0000 0 8 81 0 0x0000 Surface tile 2 steps forward, 1 left
0x0000 0 202 81 0 0x0000 Surface tile 2 steps forward, 2 right
0x0000 0 145 81 0 0x0000 Surface tile 2 steps forward, 1 right
0x0000 0 63 81 0 0x0000 Surface tile directly 2 steps forward
0x0000 0 8 93 0 0x0000 Surface tile 1 step forward, 1 left
0x0000 0 169 93 0 0x0000 Surface tile 1 step forward, 1 right
0x0000 0 31 93 0 0x0000 Surface tile directly 1 step forward
0x0000 0 8 109 0 0x0000 Surface tile directly 1 step left
0x0000 0 201 109 0 0x0000 Surface tile directly 1 step right
0x0000 0 8 109 0 0x0000 Surface tile player is currently on
0x0000 1 -64 61 14 0x2000 Wall tile 4 steps forward, 4 steps left
0x0000 1 -40 61 14 0x0000 Wall tile 4 steps forward, 3 steps left
0x0000 1 -16 61 14 0x0000 Wall tile 4 steps forward, 2 steps left
0x0000 1 8 61 14 0x0000 Wall tile 4 steps forward 1 step left
0x0000 1 128 61 14 0xA000 Wall tile 4 steps forward, 4 steps right
0x0000 1 104 61 14 0x8000 Wall tile 4 steps forward, 3 steps right
0x0000 1 80 61 14 0x8000 Wall tile 4 steps forward, 2 steps right
0x0000 1 56 61 14 0x8000 Wall tile 4 steps forward, 1 step right
0x0000 1 32 61 14 0x0000 Wall tile directly 4 steps forward
0xFFFF 0 -9 61 14 0x0000 Outdoor object directly 4 steps forward
0xFFFF 0 -58 61 14 0x0000 Outdoor object 4 steps forward, 1 step left
0xFFFF 0 40 61 14 0x0000 Outdoor object 4 steps forward, 1 step right
0xFFFF 0 -82 61 14 0x0000 Outdoor object 4 steps forward, 2 steps left
0xFFFF 0 64 61 14 0x0000 Outdoor object 4 steps forward, 2 steps right
0xFFFF 0 -41 61 14 0x0000 Monsters 4 steps forward ???
0xFFFF 0 -26 61 14 0x0000 Monsters 4 steps forward ???
0xFFFF 0 -34 61 14 0x0000 Monsters 4 steps forward ???
0xFFFF 0 -16 61 14 0x0000 Monsters 4 steps forward ???
0xFFFF 0 23 61 14 0x0000 Monsters 4 steps forward ???
0xFFFF 0 16 61 14 0x0000 Monsters 4 steps forward ???
0xFFFF 0 -58 61 14 0x0000 Monsters 4 steps forward ???
0xFFFF 0 40 61 14 0x0000 Monsters 4 steps forward ???
0xFFFF 0 -17 61 14 0x0000 Monsters 4 steps forward ???
0xFFFF 0 -1 58 14 0x0000 Monsters 4 steps forward ???
0xFFFF 0 -9 58 14 0x0000 Monsters 4 steps forward ???
0xFFFF 0 72 58 12 0x0000 Projectile Weapon sprite 4 steps forward
0xFFFF 0 72 58 12 0x8000 Projectile Weapon sprite 4 steps forward
0xFFFF 0 69 63 12 0x0000 Projectile Weapon sprite 4 steps forward
0xFFFF 0 75 63 12 0x8000 Projectile Weapon sprite 4 steps forward
0xFFFF 0 73 53 12 0x0000 Projectile Weapon sprite 4 steps forward
0xFFFF 0 71 53 12 0x8000 Projectile Weapon sprite 4 steps forward
0xFFFF 0 80 57 12 0x0000 Projectile Weapon sprite 4 steps forward
0xFFFF 0 64 57 12 0x8000 Projectile Weapon sprite 4 steps forward
0x0000 2 -11 54 8 0x0000 Wall tile 3 steps forward, 2 steps left
0x0000 1 -21 54 11 0x0000 Wall tile 3 steps forward, 1 step left
0x0000 2 165 54 8 0x8000 Wall tile 3 steps forward, 2 steps right
0x0000 1 86 54 11 0x8000 Wall tile 3 steps forward, 1 step right
0x0000 1 33 54 11 0x0000 Wall tile directly 3 steps forward
0xFFFF 0 -8 54 12 0x0000 Outdoor object directly 3 steps forward
0xFFFF 0 -73 54 12 0x0000 Outdoor object 3 steps forward, 1 step left
0xFFFF 0 57 54 12 0x0000 Outdoor object 3 steps forward, 1 step right
0xFFFF 0 -65 54 12 0x0000 Monsters 3 steps forward ???
0xFFFF 0 -81 54 12 0x0000 Monsters 3 steps forward ???
0xFFFF 0 49 54 12 0x0000 Monsters 3 steps forward ???
0xFFFF 0 65 54 12 0x0000 Monsters 3 steps forward ???
0xFFFF 0 -24 54 12 0x0000 Monsters 3 steps forward ???
0xFFFF 0 9 50 12 0x0000 Monsters 3 steps forward ???
0xFFFF 0 -8 50 12 0x0000 Monsters 3 steps forward ???
0xFFFF 0 72 53 8 0x0000 Projectile Weapon sprite 3 steps forward
0xFFFF 0 72 53 8 0x8000 Projectile Weapon sprite 3 steps forward
0xFFFF 0 77 58 8 0x0000 Projectile Weapon sprite 3 steps forward
0xFFFF 0 67 58 8 0x8000 Projectile Weapon sprite 3 steps forward
0xFFFF 0 81 47 8 0x0000 Projectile Weapon sprite 3 steps forward
0xFFFF 0 63 47 8 0x8000 Projectile Weapon sprite 3 steps forward
0xFFFF 0 94 52 8 0x0000 Projectile Weapon sprite 3 steps forward
0xFFFF 0 50 52 8 0x8000 Projectile Weapon sprite 3 steps forward
0x0000 2 8 40 0 0x0000 Wall tile 2 steps forward, 1 step left
0x0000 2 146 40 0 0x8000 Wall tile 2 steps forward, 1 step right
0x0000 1 32 40 6 0x0000 Wall tile directly 2 steps forward
0xFFFF 0 -7 30 7 0x0000 Outdoor object directly 2 steps forward
0xFFFF 0 -112 30 7 0x2000 Outdoor object 2 steps forward, 1 step left
0xFFFF 0 98 30 7 0x2000 Outdoor object 2 steps forward, 1 step right
0xFFFF 0 -112 30 8 0x2000 Monsters 2 steps forward ???
0xFFFF 0 98 30 8 0x2000 Monsters 2 steps forward ???
0xFFFF 0 -38 30 8 0x0000 Monsters 2 steps forward ???
0xFFFF 0 25 30 8 0x0000 Monsters 2 steps forward ???
0xFFFF 0 -7 30 8 0x0000 Monsters 2 steps forward ???
0xFFFF 0 72 48 4 0x0000 Projectile Weapon sprite 2 steps forward
0xFFFF 0 72 48 4 0x8000 Projectile Weapon sprite 2 steps forward
0xFFFF 0 85 53 4 0x0000 Projectile Weapon sprite 2 steps forward
0xFFFF 0 59 53 4 0x8000 Projectile Weapon sprite 2 steps forward
0xFFFF 0 89 41 4 0x0000 Projectile Weapon sprite 2 steps forward
0xFFFF 0 55 41 4 0x8000 Projectile Weapon sprite 2 steps forward
0xFFFF 0 106 47 4 0x0000 Projectile Weapon sprite 2 steps forward
0xFFFF 0 38 47 4 0x8000 Projectile Weapon sprite 2 steps forward
0x0000 0 8 24 0 0x0000 Wall tile 1 step forward, 1 step left
0x0000 0 169 24 0 0x8000 Wall tile 1 step forward, 1 step right
0x0000 1 32 24 0 0x0000 Wall tile directly 1 step forward
0x0000 0 -23 40 0 0x2000
0x0000 0 200 40 0 0xA000
0x0000 0 8 47 0 0x0000 Wall tile directly 1 step left
0x0000 0 169 47 0 0x8000 Wall tile directly 1 step right
0x0000 1 -56 -4 0x8000 0x6000 Wall tile player is currently on
0xFFFF 0 -5 2 0 0x6000
0xFFFF 0 -67 2 0 0x6000
0xFFFF 0 44 73 0 0x0000
0xFFFF 0 44 73 0 0x0000
0xFFFF 0 58 14 0 0x6000
0xFFFF 0 169 73 0 0x0000
0xFFFF 0 169 73 0 0x0000
0xFFFF 0 -5 14 0 0x6000
0xFFFF 0 110 73 0 0x0000
0xFFFF 0 110 73 0 0x0000
0xFFFF 0 -5 14 0 0x6000
0xFFFF 0 110 73 0 0x0000
0xFFFF 0 110 73 0 0x0000
0xFFFF 0 72 43 0 0x0000 Projectile Weapon sprite 1 steps forward
0xFFFF 0 72 43 0 0x8000 Projectile Weapon sprite 1 steps forward
0xFFFF 0 93 48 0 0x0000 Projectile Weapon sprite 1 steps forward
0xFFFF 0 51 48 0 0x8000 Projectile Weapon sprite 1 steps forward
0xFFFF 0 97 36 0 0x0000 Projectile Weapon sprite 1 steps forward
0xFFFF 0 47 36 0 0x8000 Projectile Weapon sprite 1 steps forward
0xFFFF 0 118 42 0 0x0000 Projectile Weapon sprite 1 steps forward
0xFFFF 0 26 42 0 0x8000 Projectile Weapon sprite 1 steps forward

TODO: Remainder of descriptions. How sprites/frames are updated. I know this, but am feeling too lazy to finish it now, -- Wizard

Indoors Edit

Indoor DrawStruct list Edit

Default SpriteSIXYFrameFlagsDescription
0xFFFF 0 8 8 0 0x0000 Top half of sky
0xFFFF 1 8 25 0 0x0000 Bottom half of sky
0xFFFF 0 8 67 0 0x0000 Ground
0xFFFF 0 8 67 0 0x0000 Surface tile 4 steps forward, 3 steps left
0xFFFF 0 38 67 0 0x0000 Surface tile 4 steps forward, 2 steps left
0xFFFF 0 84 67 0 0x0000 Surface tile 4 steps forward, 1 steps left
0xFFFF 0 134 67 0 0x0000 Surface tile 4 steps forward, 3 steps right
0xFFFF 0 117 67 0 0x0000 Surface tile 4 steps forward, 2 steps right
0xFFFF 0 117 67 0 0x0000 Surface tile 4 steps forward, 1 steps right
0xFFFF 0 103 67 0 0x0000 Surface tile directly 4 steps forward
0xFFFF 0 8 73 0 0x0000 Surface tile 3 steps forward, 3 steps left
0xFFFF 0 8 73 0 0x0000 Surface tile 3 steps forward, 2 steps left
0xFFFF 0 30 73 0 0x0000 Surface tile 3 steps forward, 1 steps left
0xFFFF 0 181 73 0 0x0000 Surface tile 3 steps forward, 3 steps right
0xFFFF 0 154 73 0 0x0000 Surface tile 3 steps forward, 2 steps right
0xFFFF 0 129 73 0 0x0000 Surface tile 3 steps forward, 1 steps right
0xFFFF 0 87 73 0 0x0000 Surface tile directly 3 steps forward
0xFFFF 0 8 81 0 0x0000 Surface tile 2 steps forward, 2 left
0xFFFF 0 8 81 0 0x0000 Surface tile 2 steps forward, 1 left
0xFFFF 0 202 81 0 0x0000 Surface tile 2 steps forward, 2 right
0xFFFF 0 145 81 0 0x0000 Surface tile 2 steps forward, 1 right
0xFFFF 0 63 81 0 0x0000 Surface tile directly 2 steps forward
0xFFFF 0 8 93 0 0x0000 Surface tile 1 step forward, 1 left
0xFFFF 0 169 93 0 0x0000 Surface tile 1 step forward, 1 right
0xFFFF 0 31 93 0 0x0000 Surface tile directly 1 step forward
0xFFFF 0 8 109 0 0x0000 Surface tile directly 1 step left
0xFFFF 0 201 109 0 0x0000 Surface tile directly 1 step right
0xFFFF 0 8 109 0 0x0000 Surface tile player is currently on
0xFFFF 7 8 64 0 0x0000 Far distant wall
0xFFFF 22 32 60 0 0x0000 Side wall for tile 4 steps forward, 4 steps left
0xFFFF 20 56 60 0 0x0000 Side wall for tile 4 steps forward, 3 steps left
0xFFFF 18 80 60 0 0x0000 Side wall for tile 4 steps forward, 2 steps left
0xFFFF 16 104 60 0 0x0000 Side wall for tile 4 steps forward, 1 steps left
0xFFFF 23 152 60 0 0x8000 Side wall for tile 4 steps forward, 4 steps right
0xFFFF 21 144 60 0 0x8000 Side wall for tile 4 steps forward, 3 steps right
0xFFFF 19 131 60 0 0x8000 Side wall for tile 4 steps forward, 2 steps right
0xFFFF 17 120 60 0 0x8000 Side wall for tile 4 steps forward, 1 steps right
0xFFFF 14 8 60 0 0x0000 Facing wall for tile 4 steps forward, 4 steps left
0xFFFF 12 32 60 0 0x0000 Facing wall for tile 4 steps forward, 3 steps left
0xFFFF 10 56 60 0 0x0000 Facing wall for tile 4 steps forward, 2 steps left
0xFFFF 14 80 60 0 0x0000 Facing wall for tile 4 steps forward, 1 steps left
0xFFFF 14 104 60 0 0x0000 Facing wall for tile directly 4 steps forward
0xFFFF 14 128 60 0 0x0000 Facing wall for tile 4 steps forward, 1 steps right
0xFFFF 14 152 60 0 0x0000 Facing wall for tile 4 steps forward, 2 steps right
0xFFFF 8 176 60 0 0x0000 Facing wall for tile 4 steps forward, 3 steps right
0xFFFF 8 200 60 0 0x0000 Facing wall for tile 4 steps forward, 4 steps right
0xFFFF 0 -64 61 14 0x0000
0xFFFF 0 -40 61 14 0x0000
0xFFFF 0 -16 61 14 0x0000
0xFFFF 0 8 61 14 0x0000
0xFFFF 0 32 61 14 0x0000
0xFFFF 0 56 61 14 0x0000
0xFFFF 0 80 61 14 0x0000
0xFFFF 0 104 61 14 0x0000
0xFFFF 0 128 61 14 0x0000
0xFFFF 0 -9 58 14 0x0000
0xFFFF 0 -34 58 14 0x0000
0xFFFF 0 16 58 14 0x0000
0xFFFF 0 -58 58 14 0x0000
0xFFFF 0 40 58 14 0x0000
0xFFFF 0 -41 58 14 0x0000
0xFFFF 0 -26 58 14 0x0000
0xFFFF 0 -34 58 14 0x0000
0xFFFF 0 -16 58 14 0x0000
0xFFFF 0 23 58 14 0x0000
0xFFFF 0 16 58 14 0x0000
0xFFFF 0 -58 58 14 0x0000
0xFFFF 0 40 58 14 0x0000
0xFFFF 0 -17 58 14 0x0000
0xFFFF 0 -1 58 14 0x0000
0xFFFF 0 -9 58 14 0x0000
0xFFFF 14 8 58 0 0x0000 Side wall for tile 3 steps forward, 4 steps left
0xFFFF 12 8 55 0 0x0000 Side wall for tile 3 steps forward, 3 steps left
0xFFFF 10 32 52 0 0x0000 Side wall for tile 3 steps forward, 2 steps left
0xFFFF 14 88 52 0 0x0000 Side wall for tile 3 steps forward, 1 steps left
0xFFFF 14 128 52 0 0x8000 Side wall for tile 3 steps forward, 1 steps right
0xFFFF 14 152 52 0 0x8000 Side wall for tile 3 steps forward, 2 steps right
0xFFFF 0 176 55 0 0x8000 Side wall for tile 3 steps forward, 3 steps right
0xFFFF 0 200 58 0 0x8000 Side wall for tile 3 steps forward, 4 steps right
0xFFFF 0 72 58 12 0x0000 POW? sprite 4 steps forward
0xFFFF 0 72 58 12 0x8000 POW? sprite 4 steps forward
0xFFFF 0 69 63 12 0x0000 POW? sprite 4 steps forward
0xFFFF 0 75 63 12 0x8000 POW? sprite 4 steps forward
0xFFFF 0 73 53 12 0x0000 POW? sprite 4 steps forward
0xFFFF 0 71 53 12 0x8000 POW? sprite 4 steps forward
0xFFFF 0 80 57 12 0x0000 POW? sprite 4 steps forward
0xFFFF 0 64 57 12 0x8000 POW? sprite 4 steps forward
0xFFFF 7 -24 52 0 0x2000 Facing wall for tile 3 steps forward, 2 steps left
0xFFFF 7 32 52 0 0x0000 Facing wall for tile 3 steps forward, 1 step left
0xFFFF 7 88 52 0 0x0000 Facing wall for tile directly 3 steps forward
0xFFFF 0 144 52 0 0x0000 Facing wall for tile 3 steps forward, 1 step right
0xFFFF 0 200 52 0 0x2000 Facing wall for tile 3 steps forward, 2 steps right
0xFFFF 0 -79 52 11 0x2000
0xFFFF 0 -27 52 11 0x0000
0xFFFF 0 32 52 11 0x0000
0xFFFF 0 89 52 11 0x0000
0xFFFF 0 145 52 11 0x2000
0xFFFF 0 -8 50 12 0x0000
0xFFFF 0 -65 50 12 0x0000
0xFFFF 0 49 50 12 0x0000
0xFFFF 0 -65 50 12 0x0000
0xFFFF 0 -81 50 12 0x0000
0xFFFF 0 49 50 12 0x0000
0xFFFF 0 65 50 12 0x0000
0xFFFF 0 -24 50 12 0x0000
0xFFFF 0 9 50 12 0x0000
0xFFFF 0 -8 50 12 0x0000
0xFFFF 7 8 48 0 0x0000 Side wall for tile 2 steps forward, 2 steps left
0xFFFF 7 64 40 0 0x0000 Side wall for tile 2 steps forward, 1 steps left
0xFFFF 6 144 40 0 0x8000 Side wall for tile 2 steps forward, 1 steps right
0xFFFF 6 200 48 0 0x8000 Side wall for tile 2 steps forward, 2 steps right
0xFFFF 0 72 53 8 0x0000 POW? sprite 3 steps forward
0xFFFF 0 72 53 8 0x8000 POW? sprite 3 steps forward
0xFFFF 0 77 58 8 0x0000 POW? sprite 3 steps forward
0xFFFF 0 67 58 8 0x8000 POW? sprite 3 steps forward
0xFFFF 0 81 47 8 0x0000 POW? sprite 3 steps forward
0xFFFF 0 63 47 8 0x8000 POW? sprite 3 steps forward
0xFFFF 0 94 52 8 0x0000 POW? sprite 3 steps forward
0xFFFF 0 50 52 8 0x8000 POW? sprite 3 steps forward
0xFFFF 6 -40 40 0 0x2000 Facing wall for tile 2 steps forward, 1 step left
0xFFFF 6 64 40 0 0x0000 Facing wall for tile directly 2 steps forward
0xFFFF 0 168 40 0 0x2000 Facing wall for tile 2 steps forward, 1 step right
0xFFFF 0 -72 40 6 0x2000
0xFFFF 0 32 40 6 0x0000
0xFFFF 0 137 40 6 0x2000
0xFFFF 0 -7 25 7 0x0000
0xFFFF 0 -112 25 7 0x2000
0xFFFF 0 98 25 7 0x2000
0xFFFF 0 -112 29 8 0x2000
0xFFFF 0 98 29 8 0x2000
0xFFFF 0 -38 29 8 0x0000
0xFFFF 0 25 29 8 0x0000
0xFFFF 0 -7 29 8 0x0000
0xFFFF 6 32 24 0 0x0000 Side wall for tile 1 step forward, 1 steps left
0xFFFF 0 168 24 0 0x8000 Side wall for tile 1 step forward, 1 steps right
0xFFFF 0 72 48 4 0x0000 POW? sprite 2 steps forward
0xFFFF 0 72 48 4 0x8000 POW? sprite 2 steps forward
0xFFFF 0 85 53 4 0x0000 POW? sprite 2 steps forward
0xFFFF 0 59 53 4 0x8000 POW? sprite 2 steps forward
0xFFFF 0 89 41 4 0x0000 POW? sprite 2 steps forward
0xFFFF 0 55 41 4 0x8000 POW? sprite 2 steps forward
0xFFFF 0 106 47 4 0x0000 POW? sprite 2 steps forward
0xFFFF 0 38 47 4 0x8000 POW? sprite 2 steps forward
0xFFFF 0 -136 24 0 0x2000 Facing wall for tile 1 step forward, 1 step left
0xFFFF 0 8 12 0 0x0000 Side wall for tile directly 1 step left
0xFFFF 0 32 24 0 0x0000 Facing wall for tile 1 step forward, 1 step right
0xFFFF 0 200 12 0 0x8000 Side wall for tile directly 1 step right
0xFFFF 0 200 24 0 0x2000 Facing wall for tile directly 1 step forward
0xFFFF 0 32 24 0 0x0000
0xFFFF 0 -5 2 0 0x6000
0xFFFF 0 -67 10 0 0x6000
0xFFFF 0 44 73 0 0x0000
0xFFFF 0 44 73 0 0x0000
0xFFFF 0 58 14 0 0x6000
0xFFFF 0 169 73 0 0x0000
0xFFFF 0 169 73 0 0x0000
0xFFFF 0 -5 14 0 0x6000
0xFFFF 0 110 73 0 0x0000
0xFFFF 0 110 73 0 0x0000
0xFFFF 0 -5 14 0 0x6000
0xFFFF 0 110 73 0 0x0000
0xFFFF 0 110 73 0 0x0000
0xFFFF 0 72 43 0 0x0000 POW? sprite 1 steps forward
0xFFFF 0 72 43 0 0x8000 POW? sprite 1 steps forward
0xFFFF 0 93 48 0 0x0000 POW? sprite 1 steps forward
0xFFFF 0 51 48 0 0x8000 POW? sprite 1 steps forward
0xFFFF 0 97 36 0 0x0000 POW? sprite 1 steps forward
0xFFFF 0 47 36 0 0x8000 POW? sprite 1 steps forward
0xFFFF 0 118 42 0 0x0000 POW? sprite 1 steps forward
0xFFFF 0 26 42 0 0x8000 POW? sprite 1 steps forward

TODO: everything else

File Format Edit

512 bytes: WallData, 16x16 uint16 values comprising the visual map data (floors, walls, etc...)
256 bytes: CellFlag, 16x16 bytes, each byte holding the flags for one tile
2 bytes: mazenumber, uint16 value indicating this map ID (see above)
"SurrMazes":
2 bytes: uint16 value indicating the map ID to the north
2 bytes: uint16 value indicating the map ID to the east
2 bytes: uint16 value indicating the map ID to the south
2 bytes: uint16 value indicating the map ID to the west
2 bytes: mazeFlags
2 bytes: mazeFlags2
16 bytes: wallTypes, 16 byte array of wall types, used for indirect lookup
16 bytes: surfaceTypes, 16 byte array of surface types (ie, floors) used for indirect lookup
1 byte: floor type, the default floor type (lookup table, used by indoor maps)
1 byte: runX, the X coordinate the party will land at if they run from a fight
1 byte: wallNoPass, wall values greater than or equal to this value cannot be walked through at all.
1 byte: surfNoPass, suface values greater than or equal to this value cannot be stepped on (typically only ever 0x0F, space).
1 byte: unlockDoor, the difficulty of unlocking a door on this map
1 byte: unlockBox, the difficulty of unlocking a chest on this map
1 byte: bashDoor, the difficulty of bashing through a door
1 byte: bashGrate, the difficulty of bashing through a grate
1 byte: bashWall, the difficulty of bashing through a wall (note that there are other requirements to bash through a wall, even if the party is strong enough)
1 byte: chanceToRun, the difficulty of running from a fight
1 byte: runY, the Y coordinate the party will land at if they run from a fight
1 byte: trapDamage, the level of damage the party will receive from traps on this map
1 byte: wallKind, the type of walls, used in a lookup table
1 byte: tavernTips, lookup table for the text file used by the tavern, if any
32 bytes: 16x16 bit array indicating which tiles have been "seen"
32 bytes: 16x16 bit array indicating which tiles have been "stepped on"

The first 512 bytes is a 16x16x2 byte array and contains 4 layers (4 bits per layer) of map data. See above for usage notes.

The next 256 bytes hold flags, one byte per tile. They seem to correspond to positions on the map (as a 16x16 byte array). For example, water tiles have a value of 0x40, tiles with a sign have a value of 0x10. This is because:

  • 0x80 = Grate
  • 0x40 = You can't rest on this tile (e.g. water)
  • 0x20 = Drain
  • 0x10 = Event
  • 0x08 = Object
  • 0x07 = Monsters (3 bits = 3 monsters)

The next two bytes are an unsigned int indicating the ID of this map. It is usually the same as the ID listed in the file name, but it was recently discovered that, on rare occasions, the file is renamed and this value not updated (in SWORDS). In such instances, this value should be ignored, as it is no longer correct. It is only used when stitching multiple maps together to generate larger maps, such as in towns and dungeons, so can be safely ignored.

The next 4 unsigned ints are the IDs of the maps which are to be loaded as the player crosses the north, east, south, and west borders of the current map respectively. Each map is to be loaded by filename as listed above, with IDs 1-99 being file MAZE00xx.DAT, and IDs 100-255 being file MAZEXxxx.DAT. Always use the filename; as mentioned, the current map ID is mostly superfluous and occasionally incorrect. A map ID of zero means no map is located in that direction, and the game will render it as "space" tiles.

"mazeflags" is a uint16 bitfield of restrictions. For the bits below which represent spells, an attempt to cast them will result in a "Spell Failed" message, while an attempt to save (where prohibited) will result in a message stating that the Gods of Game Restoration have deemed this area off-limits.

0x0040 = Etheralize
0x0080 = ?
0x0100 = Town Portal
0x0200 = Super Shelter
0x0400 = Time Distortion
0x0800 = Lloyd's Beacon
0x1000 = Teleport
0x2000 = ?
0x4000 = Rest
0x8000 = Save

Maze Flags 2:

0x4000 = Is Dark
0x8000 = Is an Outdoors map (if not set, this is an Indoors map)

The next 16 bytes is an array of bytes used for indirect lookup indicating the wall type. In 2D map viewing, it is an indirect lookup from the map data to the loaded TIL file.

The next 16 bytes is an array of bytes used for indirect lookup indicating the surface (ie, ground) tiles. It is used in similar fashion to the wallType array.

The next 13 bytes require more investigation.

The next 32 bytes is a 16x16 bit array indicating which tiles have been "seen" for auto mapping purposes.

The final 32 bytes is a 16x16 bit array indicating which tiles have been "stepped on".

TODO: Fill in the unknowns in the file format.

Example for Wall Data (First 512 Bytes)Edit

The following matrices shows an example for WallData (first 512 Bytes in a DAT-File). Map is already

flipped vertically.


Clouds of Xeen, Outdoor Map, Area A1:


Ground Layer:Edit

06 06 06 15 15 15 15 15 15 15 15 15 15 15 15 15
06 06 15 15 15 15 15 06 06 15 15 15 06 06 06 06
06 15 15 15 15 06 06 06 06 06 06 06 06 06 06 06
15 15 15 15 06 06 06 06 06 06 06 06 06 06 06 06
15 15 06 06 06 06 06 06 06 06 06 06 06 06 06 06
15 15 06 06 06 06 06 06 06 06 06 06 06 06 06 06
15 15 06 06 06 06 06 06 06 06 06 06 06 06 06 06
15 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
15 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
15 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
15 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
15 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
15 15 06 06 06 06 06 06 06 06 06 06 06 06 06 06
15 15 06 06 06 06 06 06 06 06 06 06 06 06 06 06
15 15 06 06 06 06 06 06 06 06 06 06 06 06 06 06
15 15 06 06 06 06 06 06 06 06 06 06 06 06 06 06

Middle Layer:Edit

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 01 01 00 00 00 00 00 00 00 00 00
00 00 00 00 01 01 00 00 00 01 00 00 00 00 00 00
00 00 01 01 01 00 00 00 00 01 00 00 00 00 00 00
00 00 01 11 00 00 00 00 01 01 01 01 00 01 00 00
00 00 01 00 00 00 00 01 01 00 00 01 01 01 00 00
00 00 00 00 00 00 01 01 00 00 00 01 00 00 00 00
00 00 00 00 00 00 01 00 00 00 00 01 00 00 00 00
00 00 00 00 01 01 01 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 01 01 01 01 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Top Layer:Edit

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 05 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 13 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Overlay Layer:Edit

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.