Prehistorik 2 data file format By Jesses (mail at pre2 dot mine dot nu) and Dorten Visit https://pre2.mine.nu for more Prehistorik 2 stuff Main file, v0.9. Version history: 0.9 - 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 and .TRK files format.txt Format of uncompressed level files SPRSIZE.BIN Sprite size table PRE2.PAL Palette information SQZ files are compressed with either DIET or ZIV (the Moktar/TTF compressor). The COMPRESS.TXT file explains how to uncompress them. This is what the various files are; all are compressed with DIET, unless otherwise mentioned (e.g. ZIV). Music (regular .MOD format): *.TRK 320*200*4 pics: BACK*.SQZ - Level backgrounds GAMEOVER.SQZ - Game over screen MOTIF.SQZ - Background during beginner/expert choice and level code entry MENU2.SQZ - Background during the demo 640*200*4 pics: MAP.SQZ - The between-levels scrolling map 320*200*8 pics: MENU.SQZ - Menu TITUS.SQZ - Titus logo. ZIV-compressed. CASTLE.SQZ - "To enter you must be an expert eater!". ZIV-compressed. THEEND.SQZ - End screen. ZIV-compressed. 320*(200+93.2)*8 pics: PRESENT.SQZ - Title screen. ZIV-compressed. 640*415*(2+2) pics: LEVELH.SQZ - Together, these two files contain the developer's photo. It LEVELI.SQZ uses a grayscale palette. tiles: FRONT.SQZ - Contains 163 tile sprites for masked tiles UNION.SQZ - Contains 544 shared tile sprites levels: LEVEL*.SQZ (except LEVELH and LEVELI) sprites: SPRITES.SQZ misc: ALLFONTS.SQZ - Contains... all fonts! KEYB.SQZ - Unknown, probably used as input for the demo. ZIV-compressed. SAMPLE.SQZ - Unknown. Likely the SFX samples, but not in an obvious audio encoding. Probably needs another decoding step. The bitmap format used for the 4-bit pics is planar; so, you get 4 monochrome pictures one after the other, one per plane. One special case: the pic in LEVELH+LEVELI has planes 0/1 in LEVELH and planes 2/3 in LEVELI, so in effect these two files need to be treated as if they were concatenated. 8-bit pics are simply packed pixel format, with an included palette. The palette comes first at offset 0, and consists of 256 RGB triplets where each component is in the range 0 to 63. After that, at offset 768, comes exactly 65536 bytes of pixel data, as it would appear in VGA memory. It's 320*200 plus some padding. Here there is also a special case: in PRESENT.SQZ, an additional 320*93.2 image is stored after the first 65536 bytes. It contains the part of the image with the title "Prehistorik 2", which is faded in during the game. 93.2 lines means that it contains 93 full lines and 64 pixels on the last line, which covers exactly the title logo part of the image. The bitmap format used for the tiles and sprites: The format of a tile (and a sprite too) is 4-bit planar. I.e. for a 16*16 image (like a tile) it goes like this: 32 bytes of monochrome 16*16 bitmap for plane 0 32 bytes of monochrome 16*16 bitmap for plane 1 32 bytes of monochrome 16*16 bitmap for plane 2 32 bytes of monochrome 16*16 bitmap for plane 3 Each monochrome image is as you'd expect a monochrome image to be: a simple w*h array with each byte holding 8 pixels. Sprites always have a multiple-of-8 width. They also have a transparent color, 0, which makes for easy ANDing/XORing them on screen. The file SPRITES.SQZ holds them, but only the images; the (variable) sprite sizes are stored in the exe. You'll need a table to display then, which can be found in the file SPRSIZE.BIN. It contains 2 bytes for each sprite: width and height. However, for sprite #156 (the game boy) the height actually is 19! The other values are correct however. Tiles are always 16*16, luckily :-) About the palettes, they're in the exe file. There are 10 palettes to choose from, which you can find in the file PRE2.PAL. Each palette contains 8-bit B, G, R, 0 values for each of the 16 colors in a palette. Here's a string showing which level uses which palette (i.e. palette for level 2 is 1): 0134568899222298