Doom format

From ZDoom Wiki

Jump to: navigation, search

Doom format is the map format originally used by Doom, Doom II, and Heretic. Maps can be converted to Hexen format using ZWADCONV. A technical description of the Doom map format follows.

Header - a 12 byte sequence. 80, 87, 65, 68, 11, 0, 0, 0, 212, 2, 0, 0, 0

   * Bytes 0-3: WAD type - either PWAD or IWAD (characters). 80, 87, 65, 68
   * Bytes 4-7: Number of lumps (long integer). 11, 0, 0, 0
   * Bytes 8-12: File offset to the beginning of the directory (long integer). 212, 2, 0, 0, 0 

Directory entries - a series of 16 byte sequences. 13, 0, 0, 0, 10, 0, 0, 0, 84, 72, 73, 78, 71, 83, 0, 0

   * Bytes 0-3: The file offset to the start of the lump (long integer). 13, 0, 0, 0
   * Bytes 4-7: Size of the lump (long integer). 10, 0, 0, 0
   * Bytes 8-15: The name of the lump padded with zeros (characters). 84, 72, 73, 78, 71, 83, 0, 0 

Lumps - a bunch of different kinds of data of variable length.

   * THINGS - 10 bytes
         o Bytes 0-2: Location (x) (short)
         o Bytes 2-4: Location (y) (short)
         o Bytes 4-6: Facing angle (short)
         o Bytes 6-8: Type ID (short)
         o Bytes 8-10: Flags (short) 
   * LINEDEFS - 12 bytes
         o Bytes 0-2: Start VERTEX (short)
         o Bytes 2-4: End VERTEX (short)
         o Bytes 4-6: Attributes (short)
         o Bytes 6-8: Special effects type (short)
         o Bytes 8-10: Tag (short)
         o Bytes 10-12: Right SIDEDEF (short)
         o Bytes 12-14: Left SIDEDEF (short) 
   * SIDEDEFS - 30 bytes
         o Bytes 0-2: Texture x offset (short)
         o Bytes 0-4: Texture y offset (short)
         o Bytes 4-12: Upper texture name (8 byte string)
         o Bytes 12-20: Lower texture name (8 byte string)
         o Bytes 20-28: Middle texture name (8 byte string)
         o Bytes 28-30: Sector id (short) 
   * VERTEXES - 4 bytes
         o Bytes 0-2: x coordinate (short)
         o Bytes 2-4: y coordinate (short) 
   * SEGS (created by node builder)
   * SSECTORS (created by node builder)
   * NODES (created by node builder)
   * SECTORS - 26 bytes
         o Bytes 0-2: Floor height (short)
         o Bytes 2-4: Ceiling height (short)
         o Bytes 4-12: Floor texture (8 byte string)
         o Bytes 12-20: Ceiling texture (8 byte string)
         o Bytes 20-22: Light level (short)
         o Bytes 22-24: Special sector (short)
         o Bytes 24-26: Tag (short) 
   * REJECT (created by node builder)
   * BLOCKMAP (created by node builder) 

All long integers are 32 bit unsigned longs in little-endian format (shorts are signed, 16 bits, little-endian as well). So the byte sequence 212 2 0 0 is really 0 0 2 212 which translates to 724 decimal.

Personal tools