BSP (Source)/Game-Specific: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Small visual delicacy)
(Added notes for Dark Messiah)
Line 12: Line 12:
byte thin; // is a thin side?
byte thin; // is a thin side?
};</source>
};</source>
== {{game link|Dark Messiah of Might and Magic}} ==
Dark Messiah maps have a strange version number, it is possibly split into two shorts:
<source lang="cpp">struct dheader_dm_t
{
int ident;                // BSP file identifier
short version;              // BSP file version (20)
short unknown;              // always 4?
lump_t lumps[HEADER_LUMPS];  // lump directory array
int mapRevision;          // the map's revision (iteration, version) number
};</source>
Static props use a modified <code>StaticPropLumpV6_t</code> structure, which contains additional 72 bytes for unknown purposes at the end:
<source lang="cpp">struct StaticPropLumpV6_dm_t
{
Vector m_Origin;
QAngle m_Angles;
unsigned short m_PropType;
unsigned short m_FirstLeaf;
unsigned short m_LeafCount;
unsigned char m_Solid;
unsigned char m_Flags;
int m_Skin;
float m_FadeMinDist;
float m_FadeMaxDist;
Vector m_LightingOrigin;
float m_flForcedFadeScale;
unsigned short m_nMinDXLevel;
unsigned short m_nMaxDXLevel;
byte m_unknown[72];
};</source>
Furthermore, the DirectX levels seem to have different ranges.


== {{game link|Left 4 Dead 2}} ==
== {{game link|Left 4 Dead 2}} ==

Revision as of 02:38, 6 August 2011

This page documents some game-specific differences in the BSP file format, compared to the format used for the traditional engine branches.

Alien Swarm Alien Swarm and Portal 2 Portal 2

Both games use a slightly different dbrushside_t structure:

struct dbrushside_t
{
	unsigned short		planenum;	// facing out of the leaf
	short			texinfo;
	short			dispinfo;	// displacement info (BSPVERSION 7)
	byte			bevel;		// is the side a bevel plane? (BSPVERSION 7)
	byte			thin;		// is a thin side?
};

Dark Messiah of Might and Magic Dark Messiah of Might and Magic

Dark Messiah maps have a strange version number, it is possibly split into two shorts:

struct dheader_dm_t
{
	int	ident;                // BSP file identifier
	short	version;              // BSP file version (20)
	short	unknown;              // always 4?
	lump_t	lumps[HEADER_LUMPS];  // lump directory array
	int	mapRevision;          // the map's revision (iteration, version) number
};


Static props use a modified StaticPropLumpV6_t structure, which contains additional 72 bytes for unknown purposes at the end:

struct StaticPropLumpV6_dm_t
{
	Vector			m_Origin;
	QAngle			m_Angles;
	unsigned short		m_PropType;
	unsigned short		m_FirstLeaf;
	unsigned short		m_LeafCount;
	unsigned char		m_Solid;
	unsigned char		m_Flags;
	int			m_Skin;
	float			m_FadeMinDist;
	float			m_FadeMaxDist;
	Vector			m_LightingOrigin;
	float			m_flForcedFadeScale;
	unsigned short		m_nMinDXLevel;
	unsigned short		m_nMaxDXLevel;
	byte			m_unknown[72];
};

Furthermore, the DirectX levels seem to have different ranges.

Left 4 Dead 2 Left 4 Dead 2

version and filelen in lump_t are swapped:

struct lump_t
{
	int	version;	// lump format version
	int	fileofs;	// offset into file (bytes)
	int	filelen;	// length of lump(bytes)
	char	fourCC[4];	// lump ident code
};

The Ship: Murder Party The Ship

Static props use a modified StaticPropLumpV5_t structure, which contains null-padded target name strings.

struct StaticPropLumpV5_ship_t
{
	Vector		m_Origin;
	QAngle		m_Angles;
	unsigned short	m_PropType;
	unsigned short	m_FirstLeaf;
	unsigned short	m_LeafCount;
	unsigned char	m_Solid;
	unsigned char	m_Flags;
	int		m_Skin;
	float		m_FadeMinDist;
	float		m_FadeMaxDist;
	Vector		m_LightingOrigin;
	float		m_flForcedFadeScale;
	char		m_TargetName[128];
};

Vampire: The Masquerade – Bloodlines

Version 17 BSP files contain a substantially modified dface_t structure. The known elements are:

MAXLIGHTMAPS changed from 4 to 8 // 4 lightstyle for day + 4 for night = 8 ( nightime lightmapping system )

struct dface_bsp17_t
{
	colorRGBExp32	m_AvgLightColor[MAXLIGHTMAPS]; // For computing lighting information
	unsigned short	planenum;
	byte		side;	// faces opposite to the node's plane direction
	byte		onNode; // 1 of on node, 0 if in leaf
	int		firstedge;		// we must support > 64k edges
	short		numedges;	
	short		texinfo;
	short		dispinfo;
	short		surfaceFogVolumeID;
	byte		styles[MAXLIGHTMAPS];	// lighting info
	byte		day[MAXLIGHTMAPS];		// Nightime lightmapping system
	byte		night[MAXLIGHTMAPS];		// Nightime lightmapping system
	int		lightofs;		// start of [numstyles*surfsize] samples
	float		area;
	int		m_LightmapTextureMinsInLuxels[2];
	int		m_LightmapTextureSizeInLuxels[2];
	int		origFace;    // reference the original face this face was derived from
	unsigned int	smoothingGroups;
};

The extra data seems to be related to lighting of the face, and makes the length of the structure 104 bytes per face. Both the face lump and the original face lump in version 17 files use this structure.