Titus the Fox / Moktar level file format by Jesses (mail at ttf dot mine dot nu) Visit https://ttf.mine.nu for more TTF/Moktar stuff Main file, v1.0. Version history: 1.0 - initial version This set of files describes the file format of the Titus the Fox / Moktar data files. Included files: main.txt This file compress.txt Describes how to decompress .SQZ format.txt Format of uncompressed level files, and also .LVL files made with MTF SPREXP.SIZ Sprite size table for Titus the Fox SPRITES.SIZ Sprite size table for Moktar unpack.pl Perl implementation of the decompression explained in compress.txt SQZ files are compressed with either LZW or Huffman; the COMPRESS.TXT file explains how to uncompress them. FORMAT.TXT deals with the uncompressed versions of LEVEL*.SQZ files (except LEVELA.SQZ). The 'x' in LEVELx.SQZ signifies which level it contains, but these 'x' values are not equal to the actual level numbers. The order of the 'x' values as the levels appear in the game is '0J123456789BCEFG' for Moktar, i.e. LEVEL7.SQZ contains level 9. TTF lacks level F so it has only 15 levels (including the ending). As for the remaining SQZ files that come with the game: FONTS.SQZ - Contains bitmaps of the font used in the game. KEYB.SQZ - This is unused in the full game; probably this holds the keyboard input sequence needed to make the player move automatically in the non-playable demo. LEVELA.SQZ - Holds no level, but the photo seen when completing the game. It is stored in 16-color planar format, i.e. first a 320*200 monochrome image for plane 0, then three additional ones for planes 1, 2, 3. Palette is simply grayscale. MENU.SQZ - The menu. First 3*256 bytes are the palette, followed by a 256-color 320*200 image. MENUEGA.SQZ - The menu, in 16-color planar format. SPREXP.SQZ - This holds TTF's sprites used in-game. Each sprite is stored in 16-color planar format; however, the sizes of each sprite vary and they are not stored in the file. You need the sprite size table (which is stored inside the game's executable) to view sprites. The file SPREXP.SIZ contains this table; it has two bytes per sprite, respectively the width and height in pixels. SPRITES.SQZ - Moktar version of SPREXP.SQZ. Sizes are in SPRITES.SIZ. TITRE(EGA).SQZ - Title screen, in 16 and 256 color versions. TITUS.SQZ - Titus company logo, 256 colors. Besides the above-mentioned 256-color bitmaps, the entire game is in 16 colors. 16-color bitmaps are stored in "planar" format. How does that look like? It's actually a one-bit-per-pixel bitmap, repeated four times. So, there are four complete monochrome images, one after the other. For 16*16 bitmaps this means 16*16 bits (or 32 bytes) per monochrome image, and this four times. To get a pixel's 4-bit color value, you have to combine the four individual bits from each monochrome image, also called "bitplane". So, for a 16*16 4-bit planar image, pixel (0, 0) is composed of byte 0 bit 0, byte 32 bit 0, byte 64 bit 0 and byte 96 bit 0. Why this wacky format? It's how the PC's 16-color graphics modes organise memory internally, making it more easy for the game to load its files. All used 16-color palettes are again only stored inside the executable. For the level files, there is a basic 15-color palette (actually only 14 are used, due to two blacks) with a 16th color that changes per level. Sprites just use the current level's palette, with the exception of color 0 being transparent. Here is a table with the 16 RGB triples in a level palette, values ranging 0..63: 0: 0, 0, 0 1: 60, 60, 60 2: 0 , 0 , 0 3: 24, 8 , 0 4: 28, 16, 0 5: 40, 24, 16 6: 48, 40, 24 7: 60, 48, 32 8: 16, 8 , 0 9: 28, 20, 20 10: 40, 32, 32 11: 12, 12, 28 12: 24, 24, 40 13: 32, 32, 48 14: varies between levels! 15: 8 , 8 , 24 As colors 0 and 2 are the same, I made MTF change all colors 0 in the original LEVELx.SQZ files to 2 when loading them, so color 0 is available for other funny tricks (none played yet). Meaning, if you end up making some code that loads an original level and saves it somehow, do the 0->2 conversion as well ;-). The varying color, #14, has the following palette in the first 14 levels, ordered as they appear in-game: 1: 0,16,0 2: 0,16,0 3: 0,16,0 4: 20,12,12 5: 40,12,4 6: 20,12,12 7: 20,12,12 8: 0,16,0 9: 40,28,12 10: 0,20,16 11: 40,28,12 12: 40,28,12 13: 40,28,12 14: 40,28,12 The remaining levels for Moktar: 15: 40,28,12 16: 48,8,0 And for TTF: 15: 48,8,0