---------------------------------------------------------------------------- | The Wing Commander Prophecy RLE Format | | By Mario "HCl" Brito | ---------------------------------------------------------------------------- Early Wing Commander games use RLE techniques to code it's images, and Prophecy is no exception, so it's important to document how to decode these images. There are 2 types of RLE images in Prophecy: 8-bit and 16-bit RLE, and these must be handled in a slightly different way. I will present below a C-like routine that explains how to uncompress a 16-bit RLE: 1> while (there's more RLE data to process) 2> { 3> func = readWord(); 4> size = readWord(); 5> 6> switch (func) 7> { 8> case 0: 9> repeat "size" times: 10> { 11> index = readWord(); 12> color24 = palette[index]; 13> store color24 in bitmap 14> } 15> break; 16> 17> case 1: 18> index = readWord(); 19> color24 = palette[index]; 20> repeat "size" times: 21> { 22> store color24 in bitmap 23> } 24> break; 25> 26> default: 27> skip "size" pixels in destination bitmap 28> } 29> } It seems odd to have a palette in 16-bit RLEs, but that's exactly what happens, check pal files pal555.pal and pal565.pal To unpack 8-bit RLEs, simply read bytes instead of words, the process is otherwise the same. -> Thanks go to Origin Systems INC for creating Wing Commander Prophecy and Wing Commander Secret Ops. Mario "HCl" Brito mbrito@student.dei.uc.pt