== Build .MAP 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