NeoLemmix Old Graphic Set Format

The NeoLemmix graphic set format is very similar to the standard Lemmings one, except with some unused bytes being repurposed. Thus, I recommend first reading ccexplore's information on the standard Lemmings graphic sets. A graphic set consists of two files; a GROUNDxO.DAT file and a VGAGRx.DAT file.

The VGAGRx.DAT file just contains two sections, which both contain planar bitmaps - the first section has terrain bitmaps, the second has object bitmaps. It does not contain any information about those bitmaps; the metainfo is found in the GROUNDxO.DAT files. The planar bitmaps are either 4-bit, 5-bit or 19-bit (the GROUNDxO.DAT file contains information on which bit depth is used). In the case of 4-bit or 5-bit images, they are palette based; the first 8 colors are hardcoded while the remaining 8 or 24 are defined in the GROUNDxO.DAT file. In the case of 19-bit images, they are RGB-based with 6 bits per color, with the 19th (highest) bit being a transparency mask.

The structure of the GROUNDxO.DAT file is as follows. Note that it only contains room for 64 terrain pieces and 16 objects. A graphic set in NeoLemmix (or even recent version of traditional Lemmix) can in fact contain up to 128 terrains and 32 objects. In the case of a graphic set with extra objects and/or terrains, the structure of the file is repeated at the end (you could think of it as simply being two GROUNDxO.DAT files in one; with the second one's palette entries being ignored).

Note that all multi-byte values in the GROUNDxO.DAT file are in little-endian format.

Object Data
The first part of the file is the object data. There are 16 slots. The second slot is always assumed to be a window; all other objects are assumed to not be a window (but can be anything else). An empty slot should be blanked out with 00s.
OffsetData
0x00Animation flags. This is a bitwise value:
Bit0 - If set, the animation must be triggered instead of being constantly animated
Bit1 - Should be set on windows, otherwise not set
0x01Unused (except on the first object, where it contains flags about the style as a whole - see later)
0x02Animation start frame index
0x03Number of animation frames
0x04Object width
0x05Object height
0x06
0x07
Number of bytes of data for each animation frame
0x08
0x09
Offset of the mask from each frame's bitmap data. This is unused and should not be assumed to be correct in graphic sets with 19-bit graphics.
0x0A
0x0B
If extended location flag is set, then these are taken as the two high bytes of the object's graphic's base location
0x0C
0x0D
Unused, leave it as 00
Note: 0x0D may be set in Cheapo graphic sets converted using LemSet. This value is unused by the NeoLemmix engine, but is used by CheapoCon.
0x0E
0x0F
Trigger area's X coordinate, note that the value in these bytes is multiplied by 4 before it's used. EG: a value of 2 corresponds to a coordinate of 8 (2 * 4 = 8).
0x10
0x11
Trigger area's Y coordinate, note that the value in these bytes is multiplied by 4, then 4 is subtracted from it, before it's used. EG: a value of 2 corresponds to a coordinate of 4 (2 * 4 = 8; 8 - 4 = 4).
0x12Trigger area's width, note that the value in this byte is multiplied by 4 before it's used. EG: a value of 2 corresponds to a width of 8 (2 * 4 = 8).
0x13Trigger area's height, note that the value in this byte is multiplied by 4 before it's used. EG: a value of 2 corresponds to a height of 8 (2 * 4 = 8).
0x14Trigger area effect, see below for a list of effects.
0x15
0x16
Object graphic's base location in the VGAGR section
0x17
0x18
Object graphic's preview image location in the VGAGR section (can, but does not have to be, one of its usual animation frames); note that this is overridden for some specific images
0x19Trigger position/size offsets. This should be read as four two-bit values, which are subtracted from the X, Y, width and height respectively (starting from the value of the two highest bits). This is ignored if Trigger Adjustments isn't turned on in the graphic sets options flags.
0x1AKey frame number. Only some objects use this.
0x1BSound effect when triggered. Only some objects use this.

Terrain Data
After the object data is the terrain data. There are 64 slots. An empty slot should be blanked out with 00s.
OffsetData
0x00Terrain piece width
0x01Terrain piece height
0x02
0x03
Terrain piece image location in the VGAGR section
0x04
0x05
Terrain piece's mask location in the VGAGR section; this is ignored and should not be assumed to be correct in graphic sets using 19-bit images.
0x06Bit7 is on if the piece is steel, otherwise is off. (Ignored if autosteel flag is off)
The remaining bits are taken as a 3rd (high) byte of the image's location if extended locations are on
0x07A 3rd (high) byte of the image mask's location

Palette Data
The final part of a GROUNDxO.DAT file is the palette. The first 24 bytes are leftovers from standard lemmings which are the EGA palettes; these are unused in NeoLemmix. The remainder are 24 entries of 3 bytes each; these are 18-bit color values (the high two bits in each byte are unused). Only the first 8 are used in graphic sets with 4-bit or 19-bit images (all 24 are used in graphic sets with 5-bit images). The 19-bit image graphic sets do not use these colors for their terrain pieces or objects, but can use them for skill panel graphics and lemming animations so they should still be set.


Graphic Sets Options Flags
The byte at 0x01 in the first object's metadata has some flags about the graphic set as a whole. These are read bitwise, as follows:
BitData
Bit0If this is on, the graphic set uses 5-bit graphics, otherwise it uses 4-bit graphics. (If the 19-bit graphics flag is set, then that overrides this one.)
Bit1This must be on to use the trigger set adjustments (byte 0x19 in each object data entry).
Bit2This must be on to mark terrain pieces as steel (for use with autosteel).
Bit3If this bit is on, the graphic set uses the Xmas Palette instead of the standard one for the 8 fixed colors.
Bit4If this bit is on, LemSet will refuse to decompile the graphic set; NeoLemmix itself does not use it.
Bit5This must be on to use the extra high bytes of image locations in the VGAGR files.
Bit6If this is on, the graphic set uses 19-bit graphics (regardless of Bit0's setting).
Bit7Unused; leave it off.