Westwood SHP Format (Lands of Lore)
The most commonly used sprite format in Lands of Lore: The Throne of Chaos is a compressed collection of 8-bit frames, where each frame can have its own set of dimensions. There is one single file in the first Legend of Kyrandia game that also uses this format, namely bead.cps.
This structure does not really offer much advantage over the original format, given the fact index tables generally don't compress well since they contain little repetition, and the frames data itself already supports compression in the Dune II SHP format. The only way a significant file size decrease can be gained is if the data in the different frames contain sufficient duplicate byte ranges, and if the frames in the embedded Dune II SHP file are left uncompressed. The game files in Lands of Lore generally don't disable the internal frame compression, though, resulting in files that are rarely smaller than the embedded one.
The file starts with the same header also found in the CPS format:
|UINT16LE||FileSize||File size. For compression method 0 and 4, this only counts the bytes behind this value, making it two bytes less than the actual file size.|
If PaletteSize is not 0, this header is followed by an array of PaletteSize containing the embedded palette. The rest of the file is the compressed data. The embedded palette is most likely never used; SHP files are typically sprites drawn onto a scene that already has a palette, and even for the later TD SHP format, which has an option to embed a palette as well, no files were ever found that use it.
The five different used compression methods are simply the ones found in the CPS format:
- 0x0000: uncompressed
- 0x0001: Westwood LZW-12
- 0x0002: Westwood LZW-14
- 0x0003: Westwood RLE
- 0x0004: Westwood LCW
As mentioned, the contents of the decompressed data are simply files in the 1.07 variant of the Dune II SHP Format. Many of the files in the game have frames processed with the index remapping system which changes the colour indices on the index to consecutive numbers, though besides the battle opponent files (see next section), the function of this remapping is unknown. It is possible that the game uses it to change the used palette ranges with the aid of internal tables.
All shape files that define battle opponents have the same frame structure. The normal content frames all have the same dimensions, and are remapped with the index remapping system. Frame #16 is special: it contains a table defining custom remap colours for the character, is only as large as it needs to be for the table, and is never remapped.
The frame ranges are defined as follows:
|0-3||Walking towards the player.|
|4-7||Walking to the left. These are mirrored by the game for walking to the right.|
|8-11||Walking away from the player.|
|12||Hit by the player.|
|13-15||Attacking the player|
|16||Remap table. This is a series of vertical columns, with the first column defining the original colours in the graphics, and the following columns defining alternate colour ranges for them. It has a 1-pixel transparent edge at the right side and the bottom. If no remap is defined, this ends up as a 1×1 transparent frame, though if there are no further frames, this frame is sometimes left off altogether.|
Beyond frame 16 can be more sets of 16 frames which contain overlays for the 0-15 frames range to add variations to the opponent, changing details like the face, armour or armament.
The frame configurations in the different shapes of the final boss in the game are slightly different, but like the normal ones, they have remapped frames, with a remap table frame at index 16.
The following tools are able to work with files in this format.
|Name||Platform||View images in this format?||Convert/export to another file/format?||Import from another file/format?||Access hidden data?||Edit metadata?||Notes|
|Engie File Converter||Windows||Yes||Yes||Yes||N/A||N/A|