home
download
installation
documentation
port notes
links

Map File Format

Wolfenstein 3D maps are always 64 x 64 squares, or tiles. For each map there are two planes. One plane identifies the walls, doors and floors. The other plane identifes the position of other objects. Each map plane is a two dimensional array of tilevalues.

The mapdump program may be used to extract the map data and produce pictures of them.

File Format

The map data is contained in the file GAMEMAPS.xxx. Each map compressed and preceeded by a header. The offset to each header is given in another file MAPHEAD.xxx. This file is defined by this structure in id_ca.c:

	typedef struct
	{
		unsigned	RLEWtag;
		long		headeroffsets[100];
		byte		tileinfo[];
	} mapfiletype;

The RLEWtag is used in the RLE compression. The headeroffsets are the file offsets for each map to the headers in the GAMEMAPS.xxx file. The tileinfo is not used.

The headers in the GAMEMAPS.xxx file are defined by this structure from id_ca.h:


	typedef	struct
	{
		long		planestart[3];
		unsigned short	planelength[3];
		unsigned short	width,height;
		char		name[16];
	} maptype;

planestart and planelength are indexed by the plane number. The structure allows for three planes, but only two are ever used. planestart gives the offset into the GAMEMAPS.xxx file for each plane. planelength gives the (compressed) length of the data in the file. width and height give the dimensions of the map, which is always 64 x 64.

The map data is compressed with a run length encoding scheme, and then, depending on the game version, possibly compressed with another encoding scheme, referred to in the code as CARMACIZED.

CARMACIZED

CARMACIZED data is decoded with the function CAL_CarmackExpand in id_ca.c. Analysis to follow later.

RLEW

Continuous runs of the same value are replaced with a tag followed by a count and then the value. The scheme used encodes the data as a sequence of 16 bit words (hence the W in RLEW). Decoding the RLEW stream is straightforward, and is done by the function CA_RLEWexpand in id_ca.c.

Last updated 6th March 1999
© Copyright 1999 David Haslam dch@sirius.demon.co.uk