DELT LFD Resource Type Author: Jagged Fel (jaggedfel621@gmail.com) Site: http://idmr.empirereborn.net Updated: 2009.10.05 ===== The DELT resource is image data found in the Concourse and menus. It is a compressed indexed bitmap, with the color array being defined in a PLTT resource. Information about the PLTT resource can be found in Resource_PLTT.txt. ===== DELT Structure The following values are used through this and all of my file definitions unless otherwise specified: NAME LENGTH DESC ---- ------ ---- BYTE 1 unsigned 8-bit CHAR 1 ASCII character SHORT 2 signed Int16 INT 4 signed Int32 -- 0x00 Header 0x10 SHORT Left 0x12 SHORT Top 0x14 SHORT Right 0x16 SHORT Bottom 0x18 Row[] SHORT Reserved (0) -- struct Header (size 0x10) { 0x0 CHAR[4] "DELT" 0x4 CHAR[8] Name 0xC INT Length } struct Row { SHORT Length SHORT Left SHORT Top #if (Length&1 == 0) BYTE[Length] ColorIndexes #else OpCode[] #endif } struct OpCode { BYTE Value #if (Value&1 == 0) (Read) BYTE[Value/2] ColorIndexes #else (Repeat) BYTE ColorIndex #endif } ===== DELT Details As one might expect, the four SHORT values define the outline of the image data. The Width and Height are simply the difference plus one (to get from zero-indexed to true size). -- Row -- Rows read from the top down, left to right. The first SHORT for a given row gives the number of pixels defined in that row, which can be defined in two different ways. If Length is even, then the entire set of row definitions are simply uncompressed indexed values. If Length is odd, then the OpCodes apply for the image and everything after this paragraph actually applies. In either case, the Length value is evaluated to (Length >> 1) pixels. The use of Row.Left is used when "broken" images are used, creating blank spots in the image when overlaps are required. An example of this would be the galaxy image in the Tour of Duty screen. On the map itself, there is a blank spot where the officer's head is. Note that because of blank creations, it is possible to have two Row declarations with the same Top value. For Rows that do not have blank spots, the Length is typically the full width of the image and Row.Left will match Delt.Left. After Left and Top, each pixel in a given Row is assigned an index value to the palette that has been defined for that image. There are two different types of OpCodes, which are distinguished by the first-order bit. Odd OpCodes are Repeat instructions, while even OpCodes are Read instructions. The OpCode array continues until the number of pixels processed equals Row.Length. -- Repeat OpCode -- This operation takes one parameter, ColorIndex. Another OpCode immediately follows ColorIndex. The number of occurances is calculated by (Value >> 1), such that 07 Occurs three times 09 Occurs four times 0B Occurs five times .. -- Read OpCode -- This OpCode instructs the application to read a given number of pixels and translate them directly to the image. The number of ColorIndexes to be read is given by (Value >> 1), such that 04 Reads two pixels 06 Reads three pixels 08 Reads four pixels ... After the given number of pixels has been read, the next BYTE will be another OpCode. =====