TEXTURE1 and TEXTURE2

The TEXTURE1 and TEXTURE2 lumps define how wall patches from the WAD file should combine to form wall textures.

In an era where space is expensive, a map texture inside a WAD is to a texture seen inside the game, as a MOD file is to an MP3 file. In other words, it is decomposed into smaller textures in such a way that repeating areas are only stored once. At startup time (to be precise, during "R_Init: Init DOOM refresh daemon"), the patches inside the WAD are read and combined into Wall Textures, or how the source code refers to, 'map textures'.

Binary data
The binary contents of the TEXTURE1 and TEXTURE2 lumps start with a header of flexible size, followed by all of the map textures.

All integers are 4 bytes long in x86-style little-endian order. Their values can never exceed 231-1, since Doom reads them as signed ints. Short integers are 2 bytes long and are otherwise equal to integers.

Map textures structure, binary data
The binary contents of the maptexture_t structure starts with a header of 22 bytes, followed by all the the map patches.

Map patches structure, binary data
The binary contents of the mappatch_t structure contains 10 bytes defining how the patch should be drawn inside the texture.