+==========================================================================================+ |Dangerous Dave in Copyright Infringement graphics format: | +==========================================================================================+ This is the EGAPICS.DD2 file format, containing the tiles and sprites for Dave in Copyright Infringement Dave uses EGA type graphics, in which an image is stored as 4 'planes' of data. (Blue, green, red and intensity, sprites are also unmasked) In each plane 8 pixels are stored per byte, (this is why graphic sizes tend to be multiples of 8 pixels wide.) giving in total an approximately 4-bit form of storage. EGAPICS.DD2 is 'raw data'; much like a bitmap, with a header. The header tells Dave where in the file to read from, and how much. A pixel (Or rather 8 pixels) is composed by adding all the values from the four planes for each pixel. So black is 0000, and dark blue is 1000 (Light blue is 1001) etc. In summary: GRAPHICS -> 4 PLANES -> 8 PIXEL LINES -> 0\1 BITS BGRL: COLOR 0000: Black 0001: Dark grey 0010: Red 0011: Light red 0100: Green 0101: Light green 0110: Brown 0111: Light brown (Yellow) 1000: Dark blue 1001: Light blue 1010: Purple 1011: Light purple (Pink) 1100: Turqoise 1101: Light Turquoise 1110: Grey 1111: White +------------------------------------------------------------------------------------------+ |DDiCI Graphics file (EGAPICS.DD2): | +------------------------------------------------------------------------------------------+ A note about Dave is that it can only retrieve data from 'rounded ($X0) addresses; this means that all pointers end in 0 ($00030, $00150...) and that any data not stored starting at a rounded address will be 'clipped' (Though the sprites have a way around this...) The graphic names are not required and do little. Many of the values in Dave are zero and so can be ignored, unless you want to do something fancy with your files. The locations are always the actual location divided by 16, (In hex just lop a zero off the end of the address, so $0890 becomes $0089) This is seen later on in Keen, abeit a bit differently. Note also that the header doesn't have the plane size in it, and indeed the planes can be different sizes (But they shouldn't be.) This is because the primitive Dave engine loads the graphics consecutively rather than as seperate modules like in Keen. (That is it reads the file like a long piece of tape rather than a book. Keen needs 'page numbers' and 'chapter lengths' to tell it where in various 'books' to read from, Dave just reads stuff from one tape at four different addresses.) Another special note is the sprite 'masking'; since DDiCI has the sprites and other graphics together, it can't use a seperate 'masking' plane like later games did. Instead EACH of the rgbi planes has a seperate 'mask data' segment after EVERY sprite data segment. These masks are all identical but all four are needed for a sprite to be masked, as each ONLY masks its own plane. Another difference is the sprites themselves. Keen engine games store 4 copies of every sprite for smooth movement, but while Keen can derive these 'extra' frames from the first sprite in the EGA, Dave has to have all these seperately, meaning four sprites are used for every one of Dave's animations. When you extract these you will be able to see the pattern, each of the four frames is two pixels further right than the previous. (Meaning that three of the frames must be 8 pixels wider than the first.) ------------------------------------------------------------------------------- FILE STRUCTURE: HEADER UNMASKED ENTRIES ... .. . SPRITE ENTRIES ... .. B PLANE G PLANE R PLANE I PLANE --------------------------------------------------- PLANE STRUCTURE: FONT DATA TILE DATA IMAGE DATA SPRITE DATA --------------------------------------------------- ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- FILE: --------------------------------------------------- HEADER: 0 2 Blank Blank 2 4 Font start Start of font \ 16 6 4 Tile start Start of tiles \ 16 10 4 Image start Start of images \ 16 14 4 Sprit start Start of sprites \ 16 18 4 Image en st Start of image header entries \ 16 22 4 Sprit en st Start of sprite graphics header entries \ 16 26 4 Blue pl st Start of the blue plane (At end of header) 30 4 Green pl st Start of green plane 34 4 Red pl st Start of red plane 38 2 Inten pl st Start of intensity plane 40 2 Num font Number of font entries 42 2 Num til Number of tiles 44 2 Num unmsk Number of unmasked images in file 46 2 Num spr Number of sprite images 48 16x Image ent Image entries ? 32x Mask ent Sprite entries --------------------------------------------------- --------------------------------------------------- BODY: ? x B plane Blue plane data +x x G plane Green plane data +2x x R plane Red plane data +3x x I plane Intensity plane data --------------------------------------------------- --------------------------------------------------- IMAGE ENTRY STRUCTURE: ? 2 Width Image width \ 8 +2 2 Height Image height +4 4 Offset Offset from plane start to start reading data +8 8 Name Image name --------------------------------------------------- --------------------------------------------------- SPRITE ENTRY STRUCTURE: ? 2 Width Sprite width \ 8 +2 2 Height Sprite height +4 4 Offset Offset from plane start to start reading data +8 4 Mask offset Offset for mask data, = [Offset] + [Height] * [Width] +12 8 Hitbox The hitbox co-ords; starting from 0,0; the left, then top, then right then bottom limits of the sprite's hitbox; each two bytes long. +20 12 Name Sprite name --------------------------------------------------- -------------------------------------------------------------------------------