Menu

Sprite Table

Tggtt

Sprite Table

Description

Sprite table is employed to define a few metadata of the sprites found in a sprite file of the original Deadlock and its sequel (every known version on every platform). It involves the image dimensions, offset of the raw file and the relative position to be drawn.

Each tuple of the "spritetable" was named "spriteinfo". Technically, "spritetable" is an array of that structure.

Structure (DL1)

The "spriteinfo" structure is 128 bit long defined as follows:

Size (bits) Signed Type Name
16 Yes Integer X Position
16 Yes Integer Y Position
16 No Integer Width
16 No Integer Height
32 -- -- Padding
32 No Integer Offset

Structure (DL2)

The "spriteinfo" structure is 128 bit long defined as follows:

Size (bits) Signed Type Name
16 No Integer Width
16 No Integer Height
32 -- -- Padding
32 No Integer Offset
16 Yes Integer X Position
16 Yes Integer Y Position
Notes:
  • We have not found a Width, Height or Offset value that goes beyond half of its max value, therefore, they could be signed but it was irrelevant;
  • It is unclear whether the padding was manually set or it was set by the compilers;
  • The structure seems to be the same for both platforms but the byte ordering is dependent on the underlying hardware;
  • It was not tested with the MacOS data, still, it seems to be the same structure in the opposite byte order.

Structure in C

 /** spriteinfo structure,
 * Each line represents 32 bit of data.**/
 typedef
 struct spriteinfo
 {
#ifdef DL_1
   int16_t x; int16_t y; 
#endif
   uint16_t width; uint16_t height;
   uint32_t padding;
   uint32_t offset;
#ifdef DL_2
   int16_t x; int16_t y; 
#endif
 } spriteinfo_t;

Known Instances

Platform Sequel Version Container Offset Dump Offset Array Length Size (bytes)
Windows DL1 1.20 (pt_br) 0x65CE0 0x481CE4 5615 89840
Windows DL1 1.31 (en) 0x67C7C 0x481880 5615 89840
MacOS DL1 1.0 (en) 0xFDC66 unknown 5615 (guessed) approx. 81802 (RLE compressed)
Windows DL2 1.0 Demo (en) 0xCCE58 unknown 7509 120144
Windows DL2 1.00 (en) 0xD7FD8 unknown 7361 117776
Windows DL2 1.20 (en) 0xDBDB0 0x4DCFAC 7361 117776

The "Huh?" Marker

There is an isolated "Huh?" (0x48 0x75 0x68 0x3F) after the table finishes, always near to the ending of table.
This is common to all Deadlock versions (including MacOS and the sequel).

It has proven effective since the "Cr.", "%d", "SPRITELG.DAT" or "SPRITENW.DAT" that also happen to be close to the table are not unique and as common as the "Huh?" sequence (all case sensitive).


Related

Decoding Project Blog: 2014/02/initial-version-of-sprite-decoder-added-to-decode-repository
Decode Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.