Standard Build .MAP format version 3

File structure:
	INT32	mapVersion	Map format version, must be 3
	INT32	posX	Starting position, X coordinate
	INT32	posY	Starting position, Y coordinate
	INT32	posZ	Starting position, Z coordinate
	INT16	ang	Starting position, angle
	INT16	curSectNum	Starting position, current sector
	INT16	numSectors	How many sectors
	INT16	numWalls	How many walls
	INT16	numSprites	How many sprites
	sector_t	sector[]	Each sector, read numSectors entries
	wall_t	wall[]	Each wall, read numWalls entries
	sprite_t	sprite[]	Each sprite, read numSprites entries

Sector_t:
	UINT16	wallPtr	Index of first wall
	UINT16	wallNum	How many walls
	INT8	ceilingStat	Ceiling flags
	INT8	ceilingPanning Ceiling texture panning
	INT8	ceilingShade	Ceiling shading level
	INT32	ceilingZ	Ceiling elevation
	INT16	ceilingPicNum	Ceiling texture number
	INT16	ceilingHeiNum	Ceiling slope value
	INT8	floorStat	Floor flags
	INT8	floorPanning	Floor texture panning
	INT8	floorShade	Floor shading level
	INT32	floorZ	Floor elevation
	INT16	floorPicNum	Floor texture number
	INT16	floorHeiNum	Floor slope value
	INT32	tag	Sector tags (loTag & hiTag)

Wall_t:
	INT32	x	First point, X coordinate
	INT32	y	First point, Y coordinate
	INT16	point2	Index of second point
	INT8	cstat	Wall flags
	INT8	shade	Wall shading level
	UINT8	xRepeat	Texture scale (horizontal)
	UINT8	yRepeat	Texture scale (vertical)
	UINT8	panning	Texture panning
	INT16	picNum	Wall tile number
	INT16	overpicNum	Wall tile number (for masks)
	INT16	nextSector1	Sector located behind first point (?)
	INT16	nextWall1	Wall located behind first point (?)
	INT16	nextSector2	Sector located behind second point (?)
	INT16	nextWall2	Wall located behind second point (?)
	INT32	tag	Wall tags (loTag & hiTag)

Sprite_t
	INT32	x	X coordinate
	INT32	y	Y coordinate
	INT32	z	Z coordinate
	INT8	cstat	Sprite flags
	INT8	shade	Sprite shading level
	UINT8	xRepeat	Sprite scale (horizontal)
	UINT8	yRepeat	Sprite scale (vertical)
	INT16	picNum	Sprite tile number
	INT16	ang	Angle
	INT16	vel	Velocity
	INT16	zvel	Vertical velocity
	INT16	owner	Owner (for projectiles)
	INT16	sectNum	Current position (in sector)
	INT16	statNum	Current action (used by game code)
	INT32	tag	Sprite tags (loTag & hiTag)
	INT32	extra	Pointer (used by the engine)

Sector flags (used by ceilingStat and floorStat):
	stat_cParallaxing	0x0001	Parallax sky
	stat_cSloped	0x0002	This surface is sloped
	stat_cSwap	0x0004	Swap X/Y
	stat_cSmoosh	0x0008	Texture appears smaller
	stat_cFlipX	0x0010	Flip texture X axis
	stat_cFlipY	0x0020	Flip texture Y axis
	stat_cAlign	0x0040	Align texture to first wall

Wall flags (bits 10-15 are reserved):
	cstat_wBlocking	0x0001	Both sides blocked
	cstat_wSwapWalls	0x0002	Bottom wall uses wall texture and alignment from sector located behind the wall
	cstat_wBottomAlign	0x0004	Bottom-aligned texture
	cstat_wFlipX	0x0008	Flip texture X axis
	cstat_wMasked	0x0010	Display wall between floor and ceiling levels
	cstat_wOneWay	0x0020	One side blocked
	cstat_wHitscan	0x0040	Catch hit-scan (bullets)
	cstat_wTrans1	0x0080	Translucence (+25%)
	cstat_wFlipY	0x0100	Flip texture Y axis
	cstat_wTrans2	0x0200	Translucence (+50%)

Sprite flags (bits 10-14 are reserved):
	cstat_sBlocking	0x0001	Sprite is solid
	cstat_sTrans1	0x0002	Translucence (+25%)
	cstat_sFlipX	0x0004	Flip X axis
	cstat_sFlipY	0x0008	Flip Y axis
	cstat_sFaceSprite	0x0010	Default (follows view angle)
	cstat_sWallSprite	0x0020	Wall sprite ("flat")
	cstat_sFloorSprite	0x0040	Flat sprite (parallel to floor/ceiling)
	cstat_sOneSided	0x0080	Displayed only from one side (wall sprites)
	cstat_sRealCentered 0x0100	Real centering
	cstat_sHitscan	0x0200	Catch hit-scan (bullets)
	cstat_sTrans2	0x0400	Translucence (+50%)
	cstat_sInvisible	0x8000	Sprite is invisible


Standard Build .MAP format version 4
This format is used by Rock'n Shaolin/Legend of the Seven Paladins 3D (Sep 1994 - Accend Incorporated), and some maps in Lame Duke (3D Realms).

Structure:
	INT32	mapVersion	Map format version, must be 4
	INT32	posX	Starting position, X coordinate
	INT32	posY	Starting position, Y coordinate
	INT32	posZ	Starting position, Z coordinate
	INT16	ang	Starting position, angle
	INT16	curSectNum	Starting position, current sector
	INT16	numSectors	How many sectors
	INT16	numWalls	How many walls
	INT16	numSprites	How many sprites
	sector_t	sector[]	Each sector, read numSectors entries
	wall_t	wall[]	Each wall, read numWalls entries
	sprite_t	sprite[]	Each sprite, read numSprites entries

Sector_t:
	UINT16	wallPtr	Index of first wall
	UINT16	wallNum	How many walls
	INT8	ceilingStat	Ceiling flags
	INT8	ceilingXPanning	Ceiling texture panning (horizontal)
	INT8	ceilingYPanning	Ceiling texture panning (vertical)
	INT8	ceilingShade	Ceiling shading level
	INT32	ceilingZ	Ceiling elevation
	INT16	ceilingPicNum	Ceiling texture number
	INT16	ceilingHeiNum	Ceiling slope value
	INT8	floorStat	Floor flags
	INT8	floorXPanning	Floor texture panning (horizontal)
	INT8	floorYPanning	Floor texture panning (vertical)
	INT8	floorShade	Floor shading level
	INT32	floorZ	Floor elevation
	INT16	floorPicNum	Floor texture number
	INT16	floorHeiNum	Floor slope value
	INT32	tag	Sector tags (loTag & hiTag)

Wall_t:
	INT32	x	First point, X coordinate
	INT32	y	First point, Y coordinate
	INT16	point2	Index of second point
	INT8	cstat	Wall flags
	INT8	shade	Wall shading level
	UINT8	xRepeat	Texture scale (horizontal)
	UINT8	yRepeat	Texture scale (vertical)
	UINT8	xPanning	Texture panning (horizontal)
	UINT8	yPanning	Texture panning (vertical)
	INT16	picNum	Wall tile number
	INT16	overpicNum	Wall tile number (for masks)
	INT16	nextSector1	Sector located behind first point (?)
	INT16	nextWall1	Wall located behind first point (?)
	INT16	nextSector2	Sector located behind second point (?)
	INT16	nextWall2	Wall located behind second point (?)
	INT32	tag	Wall tags (loTag & hiTag)

Sprite_t:
	INT32	x	X coordinate
	INT32	y	Y coordinate
	INT32	z	Z coordinate
	INT8	cstat	Sprite flags
	INT8	shade	Sprite shading level
	UINT8	xRepeat	Sprite scale (horizontal)
	UINT8	yRepeat	Sprite scale (vertical)
	INT16	picNum	Sprite tile number
	INT16	ang	Angle
	INT16	xvel	Velocity, X axis
	INT16	yvel	Velocity, Y axis
	INT16	zvel	Vertical velocity
	INT16	owner	Owner (for projectiles)
	INT16	sectNum	Current position (in sector)
	INT16	statNum	Current action (used by game code)
	INT32	tag	Sprite tags (loTag & hiTag)
	INT32	extra	Pointer (used by the engine)

Sector flags (used by ceilingStat and floorStat):
	stat_cParallaxing	0x0001	Parallax sky
	stat_cSloped	0x0002	This surface is sloped
	stat_cSwap	0x0004	Swap X/Y
	stat_cSmoosh	0x0008	Texture appears smaller
	stat_cFlipX	0x0010	Flip texture X axis
	stat_cFlipY	0x0020	Flip texture Y axis
	stat_cAlign	0x0040	Align texture to first wall

Wall flags (bits 10-15 are reserved):
	cstat_wBlocking	0x0001	Both sides blocked
	cstat_wSwapWalls	0x0002	Bottom wall uses wall texture and alignment from sector located behind the wall
	cstat_wBottomAlign	0x0004	Bottom-aligned texture
	cstat_wFlipX	0x0008	Flip texture X axis
	cstat_wMasked	0x0010	Display wall between floor and ceiling levels
	cstat_wOneWay	0x0020	One side blocked
	cstat_wHitscan	0x0040	Catch hit-scan (bullets)
	cstat_wTrans1	0x0080	Translucence (+25%)
	cstat_wFlipY	0x0100	Flip texture Y axis
	cstat_wTrans2	0x0200	Translucence (+50%)

Sprite flags (bits 10-14 are reserved):
	cstat_sBlocking	0x0001	Sprite is solid
	cstat_sTrans1	0x0002	Translucence (+25%)
	cstat_sFlipX	0x0004	Flip X axis
	cstat_sFlipY	0x0008	Flip Y axis
	cstat_sFaceSprite	0x0010	Default (follows view angle)
	cstat_sWallSprite	0x0020	Wall sprite ("flat")
	cstat_sFloorSprite	0x0040	Flat sprite (parallel to floor/ceiling)
	cstat_sOneSided	0x0080	Displayed only from one side (wall sprites)
	cstat_sRealCentered 0x0100	Real centering
	cstat_sHitscan	0x0200	Catch hit-scan (bullets)
	cstat_sTrans2	0x0400	Translucence (+50%)
	cstat_sInvisible	0x8000	Sprite is invisible


Standard Build .MAP format version 5
This format is used by most maps of Lame Duke (3D Realms).

Structure:
	INT32	mapVersion	Map format version, must be 5
	INT32	posX	Starting position, X coordinate
	INT32	posY	Starting position, Y coordinate
	INT32	posZ	Starting position, Z coordinate
	INT16	ang	Starting position, angle
	INT16	curSectNum	Starting position, current sector
	INT16	numSectors	How many sectors
	sector_t	sector[]	Each sector, read numSectors entries
	INT16	numWalls	How many walls
	wall_t	wall[]	Each wall, read numWalls entries
	INT16	numSprites	How many sprites
	sprite_t	sprite[]	Each sprite, read numSprites entries

Sector_t:
	UINT16	wallPtr	Index of first wall
	UINT16	wallNum	How many walls
	INT16	ceilingPicNum	Ceiling texture number
	INT16	floorPicNum	Floor texture number
	INT16	ceilingHeiNum	Ceiling slope value
	INT16	floorHeiNum	Floor slope value
	INT32	ceilingZ	Ceiling elevation
	INT32	floorZ	Floor elevation
	INT8	ceilingShade	Ceiling shading level
	INT8	floorShade	Floor shading level
	INT8	ceilingXPanning	Ceiling texture panning (horizontal)
	INT8	floorXPanning	Floor texture panning (horizontal)
	INT8	ceilingYPanning	Ceiling texture panning (vertical)
	INT8	floorYPanning	Floor texture panning (vertical)
	INT8	ceilingStat	Ceiling flags
	INT8	floorStat	Floor flags
	INT8	ceilingPal	Ceiling palette swap index
	INT8	floorPal	Floor palette swap index
	INT8	visibility	How much distance affects shading
	INT16	loTag	Sector loTag
	INT16	hiTag	Sector hiTag
	INT16	extra	Extra data index

Wall_t:
	INT32	x	First point, X coordinate
	INT32	y	First point, Y coordinate
	INT16	point2	Index of second point
	INT16	picNum	Wall tile number
	INT16	overpicNum	Wall tile number (for masks)
	INT8	shade	Wall shading level
	INT16	cstat	Wall flags
	UINT8	xRepeat	Texture scale (horizontal)
	UINT8	yRepeat	Texture scale (vertical)
	UINT8	xPanning	Texture panning (horizontal)
	UINT8	yPanning	Texture panning (vertical)
	INT16	nextSector1	Sector located behind first point (?)
	INT16	nextWall1	Wall located behind first point (?)
	INT16	nextSector2	Sector located behind second point (?)
	INT16	nextWall2	Wall located behind second point (?)
	INT16	loTag	Wall loTag
	INT16	hiTag	Wall hiTag
	INT16	extra	Extra data index

Sprite_t:
	INT32	x	X coordinate
	INT32	y	Y coordinate
	INT32	z	Z coordinate
	INT8	cstat	Sprite flags
	INT8	shade	Sprite shading level
	UINT8	xRepeat	Sprite scale (horizontal)
	UINT8	yRepeat	Sprite scale (vertical)
	INT16	picNum	Sprite tile number
	INT16	ang	Angle
	INT16	xvel	Velocity, X axis
	INT16	yvel	Velocity, Y axis
	INT16	zvel	Vertical velocity
	INT16	owner	Owner (for projectiles)
	INT16	sectNum	Current position (in sector)
	INT16	statNum	Current action (used by game code)
	INT16	loTag	Sprite loTag
	INT16	hiTag	Sprite hiTag
	INT16	extra	Extra data index

Sector flags (used by ceilingStat and floorStat):
	stat_cParallaxing	0x0001	Parallax sky
	stat_cSloped	0x0002	This surface is sloped
	stat_cSwap	0x0004	Swap X/Y
	stat_cSmoosh	0x0008	Texture appears smaller
	stat_cFlipX	0x0010	Flip texture X axis
	stat_cFlipY	0x0020	Flip texture Y axis
	stat_cAlign	0x0040	Align texture to first wall

Wall flags (bits 10-15 are reserved):
	cstat_wBlocking	0x0001	Both sides blocked
	cstat_wSwapWalls	0x0002	Bottom wall uses wall texture and alignment from sector located behind the wall
	cstat_wBottomAlign	0x0004	Bottom-aligned texture
	cstat_wFlipX	0x0008	Flip texture X axis
	cstat_wMasked	0x0010	Display wall between floor and ceiling levels
	cstat_wOneWay	0x0020	One side blocked
	cstat_wHitscan	0x0040	Catch hit-scan (bullets)
	cstat_wTrans1	0x0080	Translucence (+25%)
	cstat_wFlipY	0x0100	Flip texture Y axis
	cstat_wTrans2	0x0200	Translucence (+50%)

Sprite flags (bits 10-14 are reserved):
	cstat_sBlocking	0x0001	Sprite is solid
	cstat_sTrans1	0x0002	Translucence (+25%)
	cstat_sFlipX	0x0004	Flip X axis
	cstat_sFlipY	0x0008	Flip Y axis
	cstat_sFaceSprite	0x0010	Default (follows view angle)
	cstat_sWallSprite	0x0020	Wall sprite ("flat")
	cstat_sFloorSprite	0x0040	Flat sprite (parallel to floor/ceiling)
	cstat_sOneSided	0x0080	Displayed only from one side (wall sprites)
	cstat_sRealCentered 0x0100	Real centering
	cstat_sHitscan	0x0200	Catch hit-scan (bullets)
	cstat_sTrans2	0x0400	Translucence (+50%)
	cstat_sInvisible	0x8000	Sprite is invisible


Standard Build .MAP format version 6
This format is used by Witchaven (Jul 1995 - Capstone Software), William Shatner's TekWar (Aug 1995 - Capstone Software), and Powerslave (Dec 1996 - Lobotomy Software).

Structure:
	INT32	mapVersion	Map format version, must be 6
	INT32	posX	Starting position, X coordinate
	INT32	posY	Starting position, Y coordinate
	INT32	posZ	Starting position, Z coordinate
	INT16	ang	Starting position, angle
	INT16	curSectNum	Starting position, current sector
	INT16	numSectors	How many sectors
	sector_t	sector[]	Each sector, read numSectors entries
	INT16	numWalls	How many walls
	wall_t	wall[]	Each wall, read numWalls entries
	INT16	numSprites	How many sprites
	sprite_t	sprite[]	Each sprite, read numSprites entries

Sector_t:
	UINT16	wallPtr	Index of first wall
	UINT16	wallNum	How many walls
	INT16	ceilingPicNum	Ceiling texture number
	INT16	floorPicNum	Floor texture number
	INT16	ceilingHeiNum	Ceiling slope value
	INT16	floorHeiNum	Floor slope value
	INT32	ceilingZ	Ceiling elevation
	INT32	floorZ	Floor elevation
	INT8	ceilingShade	Ceiling shading level
	INT8	floorShade	Floor shading level
	INT8	ceilingXPanning	Ceiling texture panning (horizontal)
	INT8	floorXPanning	Floor texture panning (horizontal)
	INT8	ceilingYPanning	Ceiling texture panning (vertical)
	INT8	floorYPanning	Floor texture panning (vertical)
	INT8	ceilingStat	Ceiling flags
	INT8	floorStat	Floor flags
	INT8	ceilingPal	Ceiling palette swap index
	INT8	floorPal	Floor palette swap index
	INT8	visibility	How much distance affects shading
	INT16	loTag	Sector loTag
	INT16	hiTag	Sector hiTag
	INT16	extra	Extra data index

Wall_t:
	INT32	x	First point, X coordinate
	INT32	y	First point, Y coordinate
	INT16	point2	Index of second point
	INT16	nextSector	Sector located behind wall
	INT16	nextWall	Wall located behind wall
	INT16	picNum	Wall tile number
	INT16	overpicNum	Wall tile number (for masks)
	INT8	shade	Wall shading level
	INT8	pal	Wall palette swap index
	INT16	cstat	Wall flags
	UINT8	xRepeat	Texture scale (horizontal)
	UINT8	yRepeat	Texture scale (vertical)
	UINT8	xPanning	Texture panning (horizontal)
	UINT8	yPanning	Texture panning (vertical)
	INT16	loTag	Wall loTag
	INT16	hiTag	Wall hiTag
	INT16	extra	Extra data index

Sprite_t:
	INT32	x	X coordinate
	INT32	y	Y coordinate
	INT32	z	Z coordinate
	INT16	cstat	Sprite flags
	INT8	shade	Sprite shading level
	INT8	pal	Sprite palette swap index
	INT8	clipDist	Collision radius
	UINT8	xRepeat	Sprite scale (horizontal)
	UINT8	yRepeat	Sprite scale (vertical)
	INT8	xOffset	X-axis offset
	INT8	yOffset	Y-axis offset
	INT16	picNum	Sprite tile number
	INT16	ang	Angle
	INT16	xvel	Velocity, X axis
	INT16	yvel	Velocity, Y axis
	INT16	zvel	Vertical velocity
	INT16	owner	Owner (for projectiles)
	INT16	sectNum	Current position (in sector)
	INT16	statNum	Current action (used by game code)
	INT16	loTag	Sprite loTag
	INT16	hiTag	Sprite hiTag
	INT16	extra	Extra data index

Sector flags (used by ceilingStat and floorStat):
	stat_cParallaxing	0x0001	Parallax sky
	stat_cSloped	0x0002	This surface is sloped
	stat_cSwap	0x0004	Swap X/Y
	stat_cSmoosh	0x0008	Texture appears smaller
	stat_cFlipX	0x0010	Flip texture X axis
	stat_cFlipY	0x0020	Flip texture Y axis
	stat_cAlign	0x0040	Align texture to first wall

Wall flags (bits 10-15 are reserved):
	cstat_wBlocking	0x0001	Both sides blocked
	cstat_wSwapWalls	0x0002	Bottom wall uses wall texture and alignment from sector located behind the wall
	cstat_wBottomAlign	0x0004	Bottom-aligned texture
	cstat_wFlipX	0x0008	Flip texture X axis
	cstat_wMasked	0x0010	Display wall between floor and ceiling levels
	cstat_wOneWay	0x0020	One side blocked
	cstat_wHitscan	0x0040	Catch hit-scan (bullets)
	cstat_wTrans1	0x0080	Translucence (+25%)
	cstat_wFlipY	0x0100	Flip texture Y axis
	cstat_wTrans2	0x0200	Translucence (+50%)

Sprite flags (bits 10-14 are reserved):
	cstat_sBlocking	0x0001	Sprite is solid
	cstat_sTrans1	0x0002	Translucence (+25%)
	cstat_sFlipX	0x0004	Flip X axis
	cstat_sFlipY	0x0008	Flip Y axis
	cstat_sFaceSprite	0x0010	Default (follows view angle)
	cstat_sWallSprite	0x0020	Wall sprite ("flat")
	cstat_sFloorSprite	0x0040	Flat sprite (parallel to floor/ceiling)
	cstat_sOneSided	0x0080	Displayed only from one side (wall sprites)
	cstat_sRealCentered 0x0100	Real centering
	cstat_sHitscan	0x0200	Catch hit-scan (bullets)
	cstat_sTrans2	0x0400	Translucence (+50%)
	cstat_sInvisible	0x8000	Sprite is invisible


Standard Build .MAP format version 7
This format is used by Duke Nukem 3D (Jan 1996 - 3D Realms), Witchaven II (May 1996 - Capstone Software), Fate (unreleased - DogBone Software), Redneck Rampage (Apr 1997 - Xatrix Entertainment), Shadow Warrior (May 1997 - 3D Realms), Nam (Jun 1998 - GT Interactive Software), PaintBrawl (Sep 1998 - Creative Carnage), and WWII GI (Jul 1999 - TNT Team).

Structure:
	INT32	mapVersion	Map format version, must be 7
	INT32	posX	Starting position, X coordinate
	INT32	posY	Starting position, Y coordinate
	INT32	posZ	Starting position, Z coordinate
	INT16	ang	Starting position, angle
	INT16	curSectNum	Starting position, current sector
	INT16	numSectors	How many sectors
	sector_t	sector[]	Each sector, read numSectors entries
	INT16	numWalls	How many walls
	wall_t	wall[]	Each wall, read numWalls entries
	INT16	numSprites	How many sprites
	sprite_t	sprite[]	Each sprite, read numSprites entries

Sector_t:
	INT16	wallPtr	Index of first wall
	INT16	wallNum	How many walls
	INT32	ceilingZ	Ceiling elevation
	INT32	floorZ	Floor elevation
	INT16	ceilingStat	Ceiling flags
	INT16	floorStat	Floor flags
	INT16	ceilingPicNum	Ceiling texture number
	INT16	ceilingHeiNum	Ceiling slope value
	INT8	ceilingShade	Ceiling shading level
	INT8	ceilingPal	Ceiling palette swap index
	INT8	ceilingXPanning	Ceiling texture panning (horizontal)
	INT8	ceilingYPanning	Ceiling texture panning (vertical)
	INT16	floorPicNum	Floor texture number
	INT16	floorHeiNum	Floor slope value
	INT8	floorShade	Floor shading level
	INT8	floorPal	Floor palette swap index
	INT8	floorXPanning	Floor texture panning (horizontal)
	INT8	floorYPanning	Floor texture panning (vertical)
	INT8	visibility	How much distance affects shading
	INT8	filler	Always NULL
	INT16	loTag	Sector loTag
	INT16	hiTag	Sector hiTag
	INT16	extra	Extra data index

Wall_t:
	INT32	x	First point, X coordinate
	INT32	y	First point, Y coordinate
	INT16	point2	Index of second point
	INT16	nextWall	Wall located behind wall
	INT16	nextSector	Sector located behind wall
	INT16	cstat	Wall flags
	INT16	picNum	Wall tile number
	INT16	overpicNum	Wall tile number (for masks)
	INT8	shade	Wall shading level
	INT8	pal	Wall palette swap index
	UINT8	xRepeat	Texture scale (horizontal)
	UINT8	yRepeat	Texture scale (vertical)
	UINT8	xPanning	Texture panning (horizontal)
	UINT8	yPanning	Texture panning (vertical)
	INT16	loTag	Wall loTag
	INT16	hiTag	Wall hiTag
	INT16	extra	Extra data index

Sprite_t:
	INT32	x	X coordinate
	INT32	y	Y coordinate
	INT32	z	Z coordinate
	INT16	cstat	Sprite flags
	INT16	picNum	Sprite tile number
	INT8	shade	Sprite shading level
	INT8	pal	Sprite palette swap index
	INT8	clipDist	Collision radius
	INT8	filler	Always NULL
	UINT8	xRepeat	Sprite scale (horizontal)
	UINT8	yRepeat	Sprite scale (vertical)
	INT8	xOffset	X-axis offset
	INT8	yOffset	Y-axis offset
	INT16	sectNum	Current position (in sector)
	INT16	statNum	Current action (used by game code)
	INT16	ang	Angle
	INT16	owner	Owner (for projectiles)
	INT16	xvel	Velocity, X axis
	INT16	yvel	Velocity, Y axis
	INT16	zvel	Vertical velocity
	INT16	loTag	Sprite loTag
	INT16	hiTag	Sprite hiTag
	INT16	extra	Extra data index

Sector flags (used by ceilingStat and floorStat):
	stat_cParallaxing	0x0001	Parallax sky
	stat_cSloped	0x0002	This surface is sloped
	stat_cSwap	0x0004	Swap X/Y
	stat_cSmoosh	0x0008	Texture appears smaller
	stat_cFlipX	0x0010	Flip texture X axis
	stat_cFlipY	0x0020	Flip texture Y axis
	stat_cAlign	0x0040	Align texture to first wall

Wall flags (bits 10-15 are reserved):
	cstat_wBlocking	0x0001	Both sides blocked
	cstat_wSwapWalls	0x0002	Bottom wall uses wall texture and alignment from sector located behind the wall
	cstat_wBottomAlign	0x0004	Bottom-aligned texture
	cstat_wFlipX	0x0008	Flip texture X axis
	cstat_wMasked	0x0010	Display wall between floor and ceiling levels
	cstat_wOneWay	0x0020	One side blocked
	cstat_wHitscan	0x0040	Catch hit-scan (bullets)
	cstat_wTrans1	0x0080	Translucence (+25%)
	cstat_wFlipY	0x0100	Flip texture Y axis
	cstat_wTrans2	0x0200	Translucence (+50%)

Sprite flags (bits 10-14 are reserved):
	cstat_sBlocking	0x0001	Sprite is solid
	cstat_sTrans1	0x0002	Translucence (+25%)
	cstat_sFlipX	0x0004	Flip X axis
	cstat_sFlipY	0x0008	Flip Y axis
	cstat_sFaceSprite	0x0010	Default (follows view angle)
	cstat_sWallSprite	0x0020	Wall sprite ("flat")
	cstat_sFloorSprite	0x0040	Flat sprite (parallel to floor/ceiling)
	cstat_sOneSided	0x0080	Displayed only from one side (wall sprites)
	cstat_sRealCentered 0x0100	Real centering
	cstat_sHitscan	0x0200	Catch hit-scan (bullets)
	cstat_sTrans2	0x0400	Translucence (+50%)
	cstat_sInvisible	0x8000	Sprite is invisible


Monolith's Blood map format
Blood uses a slightly modified version of standard Build map version 7. Blood Map Version 7.00 is encrypted and has a 128-byte long meta chunk. There's also an "extra" chunk for sectors, walls and sprites. That extra chunk appears right after the entry requiring it (.extra != -1), and is 60 bytes long for sectors, 24 bytes for walls, and 56 for sprites. The file ends with a UINT32 checksum to detect changes. Note that retail version of Blood uses map version 7.00, even though BB9.MAP is still version 6.30 (clear); MapEdit is able to open both types of file, but will only save 7.00.

Version 6.00 (used in the Blood alpha) and 6.30 (basically 7.00 without encryption nor meta chunk) are identical in structure. Maybe the content of extra chunks changed (different flag values, other organization), but regardless their size is the same in 7.00, 6.30 and 6.00.

The big difficulty when dealing with Blood maps is the decryption process: information must be decrypted as it is read, because previously read information is used to decipher following chunks. Thankfully, the encryption method doesn't alter the length of the information, so you can just use structures to load data and then provide a byte pointer to that structure to decode it easily. The encryption algorithm is "chr[i] ^= (unsigned char)(encryptionKey + i)" (or "chr[i] = chr[i] XOR ((encryptionKey + i) AND &hFF)"). Note that "i" is reset at the beginning of each chunk/entry.

Structure:
	header_t	Head	43 bytes
	meta_t	Meta	128 bytes (only in version 7.00)
		Skies	(2^(numSkies + 1)) bytes, content unknown
	Sectors	40 bytes per entry (sector_t) + 60 bytes per "extra" chunk (sectorXtra_t), read numSectors entries
	Walls	32 bytes per entry (wall_t) + 24 bytes per "extra" chunk (wallXtra_t), read numWalls entries
	Sprites	44 bytes per entry (sprite_t) + 56 bytes per "extra" chunk (spriteXtra_t), read numSprites entries
	UINT32	checksum	Checksum of the whole file to prevent file manipulation

Header_t: (6 first bytes are clear, next 37 bytes are encrypted using "0x4D")
	UINT32	Signature	0x1A4D4C42 (appears as "BLM" + 0x1A in file)
	UINT8	VersionMin	Minor version
	UINT8	VersionMaj	Major version
	INT32	posX	Start point, X coordinate
	INT32	posY	Start point, Y coordinate
	INT32	posZ	Start point, Z coordinate
	INT16	ang	Start direction (0 to 4096)
	INT16	curSectNum	Starting sector (-1 if Build didn't compute the starting sector yet)
	UINT16	numSkies	?? it's used to compute the length of the sky table, but I have no idea what it represents exactly ??
	UINT32	skyMisc	?? related to sky, maybe the scrolling speed, the width in pixels, the north orientation, some display flags ??
	UINT32	Reserved (appears as "Matt" or 0x00000000 in file)
	UINT8	?? 0, 1 or 2 ??
	UINT32	mapRevision	Revision number (how many times the map has been saved, includes auto saves)
	UINT16	numSectors	How many sectors
	UINT16	numWalls	How many walls
	UINT16	numSprites	How many sprites

Meta_t (128 bytes, encrypted using "numWalls" -- only present in version 7.0)
	CHAR[64]	copyright	NULL-padded copyright notice string, reads "Copyright 1997 Monolith Productions.  All Rights Reserved"
	UINT32	xtraSpr	Length in bytes of one entry in the extra sprite table, MUST be 56
	UINT32	xtraWal	Length in bytes of one entry in the extra wall table, MUST be 24
	UINT32	xtraSec	Length in bytes of one entry in the extra sector table, MUST be 60
	CHAR[52]	padding	Should be NULL

Sky_t: (at least 2 bytes long)
	?	CHAR[]	??	?? read (2^(numSkies + 1)) bytes of info. No idea what it is exactly.

Sector_t: (40 bytes, encrypted using "mapRevision * sizeof(sector_t)")
	INT16	wallPtr	Index of first wall
	INT16	wallNum	How many walls
	INT32	ceilingZ	Ceiling elevation
	INT32	floorZ	Floor elevation
	INT16	ceilingStat	Ceiling flags
	INT16	floorStat	Floor flags
	INT16	ceilingPicNum	Ceiling texture number
	INT16	ceilingHeiNum	Ceiling slope value
	INT8	ceilingShade	Ceiling shading level
	INT8	ceilingPal	Ceiling palette swap index
	INT8	ceilingXPanning	Ceiling texture panning (horizontal)
	INT8	ceilingYPanning	Ceiling texture panning (vertical)
	INT16	floorPicNum	Floor texture number
	INT16	floorHeiNum	Floor slope value
	INT8	floorShade	Floor shading level
	INT8	floorPal	Floor palette swap index
	INT8	floorXPanning	Floor texture panning (horizontal)
	INT8	floorYPanning	Floor texture panning (vertical)
	INT8	visibility	Visibility (?)
	INT8	filler	Always NULL
	INT16	loTag	Sector loTag
	INT16	hiTag	Sector hiTag
	INT16	extra	Extra data index, read sectorExt_t if above 0

SectorExt_t (60 bytes, clear)

Wall_t: (32 bytes, encrypted using "(mapRevision * sizeof(sector_t)) OR 0x4D")
	INT32	x	First point, X coordinate 
	INT32	y	First point, Y coordinate
	INT16	point2	Index of second point
	INT16	nextWall	Wall located behind wall
	INT16	nextSector	Sector located behind wall
	INT16	cstat	Wall flags
	INT16	picNum	Wall tile number
	INT16	overpicNum	Wall tile number (for masks)
	INT8	shade	Wall shading level
	INT8	pal	Wall palette swap index 
	UINT8	xRepeat	Texture scale (horizontal)
	UINT8	yRepeat	Texture scale (vertical)
	UINT8	xPanning	Texture panning (horizontal)
	UINT8	yPanning	Texture panning (vertical)
	INT16	loTag	Wall loTag
	INT16	hiTag	Wall hiTag
	INT16	extra	Extra data index, read wallExt_t if above 0

WallExt_t (24 bytes, clear)

Sprite_t: (44 bytes, encrypted using "(mapRevision * sizeof(sprite_t)) OR 0x4D")
	INT32	x	X coordinate
	INT32	y	Y coordinate
	INT32	z	Z coordinate
	INT16	cstat	Sprite flags
	INT16	picNum	Sprite tile number
	INT8	shade	Sprite shading level
	INT8	pal	Sprite palette swap index
	INT8	clipDist	Collision radius
	INT8	filler	Always NULL
	UINT8	xRepeat	Sprite scale (horizontal)
	UINT8	yRepeat	Sprite scale (vertical)
	INT8	xOffset	X-axis offset
	INT8	yOffset	Y-axis offset
	INT16	sectNum	Current position (in sector)
	INT16	statNum	Current action (used by the game code)
	INT16	ang	Angle
	INT16	owner	Owner (for projectiles)
	INT16	xvel	Velocity, X axis
	INT16	yvel	Velocity, Y axis
	INT16	zvel	Vertical velocity
	INT16	loTag	Sprite loTag
	INT16	hiTag	Sprite hiTag
	INT16	extra	Extra data index, read spriteExt_t if above 0

spriteExt_t (56 bytes, clear)