WAL

WAL is a texture file format used by to store brush textures. It is a modified version of Quake I's miptex format, containing four mipmaps, two strings (used for animation), as well as three metadata values. The first two metadata values are bitfields, indicating information about a brush's face (surface flags) and a brush's contents (content flags). The third metadata value is an integer value, traditionally used for determining the brightness of texlights (although some compilers use it for other purposes on non-emissive surfaces, such as for smoothing groups in Arghrad).
The surface flags and contents flags used by Quake II would serve the basis for those used by Source.
== Technical ==
The header of a WAL file can be represented by the following C struct (from in the Quake II source code release):
#define	MIPLEVELS	4
typedef struct miptex_s
{
	char		name[32];			// 31 chars plus null terminator
	unsigned	width, height;
	unsigned	offsets[MIPLEVELS];		// four mip maps stored
	char		animname[32];			// next frame in animation chain
	int			flags;
	int			contents;
	int			value;
} miptex_t;
It is then followed by raw 8-bit image data for each mipmap, at the offsets relative to the start of the file.
== Texture flags ==
These sections list and describe the various standard surface and content flags used in , as well as the equivalent VMT parameters to achieve the same or similar result in .
=== Surface flags ===
Surface flags on different faces of a brush generally do not need to match. If two or more conflicting flags are assigned, then the flag with the lowest bit value will take priority.
Bit	Flag name 	VMT equivalent 	Description
 	SURF_LIGHT 	N/A 	Treats this face as a texlight, with brightness dependent upon the surface value.
 	SURF_SLICK 	N/A 	Makes this face slippery.
 	SURF_SKY 	 	Face is is not drawn, and the skybox is drawn behind all visible faces when this face is in the PVS.
 	SURF_WARP 	Requires custom shader; see GLSL example for reference	"Warp" the texture on this face, like water.
 	SURF_TRANS33 	 	Render the face as translucent, at 33% or 66% opacity, respectively.
Most source ports, including the remaster, will render any texels using palette index 255 (or true color images with an alpha of less than 127) as fully transparent.
While these flags can technically be combined, the behavior for such is not standardized. Some engines (such as Yamagi) will prioritize one or the other, others (such as Q2EX) will render the face at 50% opacity, and a small few will instead render the face with binary transparency.
 	SURF_TRANS66 	 	Render the face as translucent, at 33% or 66% opacity, respectively.
Most source ports, including the remaster, will render any texels using palette index 255 (or true color images with an alpha of less than 127) as fully transparent.
While these flags can technically be combined, the behavior for such is not standardized. Some engines (such as Yamagi) will prioritize one or the other, others (such as Q2EX) will render the face at 50% opacity, and a small few will instead render the face with binary transparency.
 	SURF_FLOWING 	material proxy 	Texture scrolls from top to bottom.
Note that this is different from textures in , which scroll from left to right (and require a func_conveyor, which this does not).
 	SURF_NODRAW 	 	Do not render this face in-game.
 	SURF_HINT 	 	Used on hint brushes.
 	SURF_SKIP 	 	Completely ignore. Causes unexpected results when applied to anything other than hint brushes; use SURF_NODRAW for other brushes.
 	SURF_ALPHATEST 	 	Use binary transparency, using either palette index 255 of an 8-bit texture or the alpha channel of 32-bit texture as a transparency mask.
 	SURF_N64_UV 	 	Halves texture sizes, without requiring setting texture scale in the editor to 2.0.
 	SURF_N64_SCROLL_X 	material proxy 	Scrolls the texture on the X axis. Slower than SURF_FLOWING.
 	SURF_N64_SCROLL_Y 	material proxy 	Scrolls the texture on the Y axis. Slower than SURF_FLOWING.
 	SURF_N64_SCROLL_FLIP	material proxy 	Inverts the scroll direction.
=== Content flags ===
Content flags on different faces of a brush almost always need to match. Mismatched contents will result in Compiler errors, and leaves it up to the Compiler to decide what contents a brush should have. If two or more conflicting flags are assigned, then the flag with the lowest bit value will take priority.
Bit 	Flag name 	VMT equivalent 	Description
0x00000000	N/A 	N/A 	No contents, sometimes known as "CONTENTS_EMPTY".
This cannot be assigned to a texture or surface via normal means, as brush faces with the contents field set to zero in the WAL and MAP file will be treated as solid.
0x00000001	CONTENTS_SOLID 	N/A 	Default contents. Generally no need to set manually.
0x00000002	CONTENTS_WINDOW 	N/A 	Prevents the renderer from drawing the backfaces of a brush.
0x00000004	CONTENTS_AUX 	N/A 	No effect (unused).
Some compilers, such as ericw-tools, treat it as an alias for a combination of CONTENTS_MIST and CONTENTS_WINDOW.
0x00000008	CONTENTS_LAVA 	, along with a brush	Makes brush swimmable. CONTENTS_LAVA and CONTENTS_SLIME also deal periodic damage to the anyone or anything in them, with lava dealing more damage than slime.
0x00000010	CONTENTS_SLIME 	, along with a brush	Makes brush swimmable. CONTENTS_LAVA and CONTENTS_SLIME also deal periodic damage to the anyone or anything in them, with lava dealing more damage than slime.
0x00000020	CONTENTS_WATER 	 	Makes brush swimmable. CONTENTS_LAVA and CONTENTS_SLIME also deal periodic damage to the anyone or anything in them, with lava dealing more damage than slime.
0x00000040	CONTENTS_MIST 	 	Disables collision, and sometimes disables backface culling.
0x00000800	CONTENTS_NO_WATERJUMP 	N/A 	Disables the auto-jumping that occurs when the player is floating across the top of a liquid and approaches a low ledge.
0x00004000	CONTENTS_PROJECTILECLIP	N/A 	Blocks moving entities using CONTENTS_PROJECTILE. No effect on hitscan weapons.
0x00008000	CONTENTS_AREAPORTAL 	N/A 	Used on areaportals.
0x00010000	CONTENTS_PLAYERCLIP 	 	Blocks player and bot movement.
0x00020000	CONTENTS_MONSTERCLIP 	 	Blocks monster (NPC) movement.
0x00040000	CONTENTS_CURRENT_0 	N/A 	Pushes stuff inside it in the specified direction. These flags can be stacked to go in diagonal directions. Effectively acts like .
ZHLT and derivatives have tool textures that serve a similar purpose.
0x00080000	CONTENTS_CURRENT_90 	N/A 	Pushes stuff inside it in the specified direction. These flags can be stacked to go in diagonal directions. Effectively acts like .
ZHLT and derivatives have tool textures that serve a similar purpose.
0x00100000	CONTENTS_CURRENT_180 	N/A 	Pushes stuff inside it in the specified direction. These flags can be stacked to go in diagonal directions. Effectively acts like .
ZHLT and derivatives have tool textures that serve a similar purpose.
0x00200000	CONTENTS_CURRENT_270 	N/A 	Pushes stuff inside it in the specified direction. These flags can be stacked to go in diagonal directions. Effectively acts like .
ZHLT and derivatives have tool textures that serve a similar purpose.
0x00400000	CONTENTS_CURRENT_UP 	N/A 	Pushes stuff inside it in the specified direction. These flags can be stacked to go in diagonal directions. Effectively acts like .
ZHLT and derivatives have tool textures that serve a similar purpose.
0x00800000	CONTENTS_CURRENT_DOWN 	N/A 	Pushes stuff inside it in the specified direction. These flags can be stacked to go in diagonal directions. Effectively acts like .
ZHLT and derivatives have tool textures that serve a similar purpose.
0x1000000 	CONTENTS_ORIGIN 	 	Sets the origin of brush entities.
0x2000000 	CONTENTS_MONSTER 	N/A 	Internal flag, do not set.
0x4000000 	CONTENTS_DEADMONSTER 	N/A 	Internal flag, do not set.
0x8000000 	CONTENTS_DETAIL 	 	Brush does not chop structural brushes, and does not affect VIS. It may, however, still affect visibility.
0x10000000	CONTENTS_TRANSLUCENT 	N/A 	Marks brush as able to be seen through.
Automatically set by SURF_TRANS33 and SURF_TRANS66, and in some compilers, SURF_ALPHATEST.
0x20000000	CONTENTS_LADDER 	 	Makes climbable.
0x40000000	CONTENTS_PLAYER 	N/A 	Internal flag, do not set.
0x10000000	CONTENTS_PROJECTILE 	N/A 	Internal flag, do not set.
== Variants ==
* Daikatana WALs are mostly identical to Quake 2 WALs, but have 8 mipmaps instead of 4. This makes them more suitable for hardware renderers than Quake 2's format.
* SWL files are used by .
* M8 is a variation of Quake 2 WALs that stores its own palette. Like WAD3, this adds 768 bytes to the file size.
* M32 is a variation of Quake 2 WALs that stores its mipmaps in an uncompressed 32-bit RGBA format, best suited for textures with translucency.
* WAL_JSON is a JSON file used by ericw-tools which can store the metadata found in a WAL, allowing compiling maps with textures that use other texture formats (TGA, PNG, or JPG) without also creating an associated WAL file. It also adds a color value to override the color of texlights.
== External links ==
* Surface and content flags documentation from the "Rust" tutorials
Category:File formats