heightmap data is stored in some form of Block Truncation Coding The grayscale image is divided into 8x8 sub-blocks each block is represented by two "layers" Layer_1 is a 32-bit value that is used as the base level for all 64 pixels in the block Layer_2 is 64 8-bit values ( one 8-bit value for each pixel in the block ) To determine the height of a pixel the corresponding Layer_2 value is multiplied by 128 then added to the corresponding Layer_1 value The Layer_2 entries can be re-used by different blocks to save space ( dictionary compression ) // note: LAYER1 contains two heightmaps ( of the same dimensions ) // one for line of sight and one for movement? http://forum.dark-omen.org/tools/general-modding-questions-t1210.0.html // however, TERR_HEADER's size, width, height, and num_blocks_layer1 members are all missing the second heightmap struct TERR_HEADER { char id[4]; // 'TERR' DWORD size; DWORD width; DWORD height; DWORD num_blocks_layer2; DWORD num_blocks_layer1; }; struct LAYER1 { DWORD size; struct BLOCK { DWORD base_height; DWORD layer2_offset; // bytes from &layer2.blocks[0] } blocks[1]; }; struct LAYER2 { DWORD size; struct BLOCK { BYTE delta[8][8]; } blocks[1]; };