DO/Sprite Format

From Dark Omen Wiki

< DO
Jump to: navigation, search

An article about the sprite format (*.spr)

Version 1.2, 20th of November, 1999 by Mikademus

This page is obsolete. For up-to-date information see Updated Sprite Format


Contents

Terminology

Sprite: A animated picture consisting of an aggregate of several bitmap fairies.

Fairy: A bitmap making out a single frame of a sprite.

Introduction

The format used by Warhammer: Dark Omen™ (© Electronic Arts) is not altogether complicated. Every .SPR-file is initiated with a 32-byte header, followed by a section containing specific information about every fairy used for the sprite. After this comes a section containing the settings for all the sprite’s colors, finally followed by the fairy data itself.

All values printed herein are in decimal format, unless otherwise noted.

The Sprite header

The header start at offset 0 and runs to offset 31 (32 bytes in length). The following tabulation specified the relevant and/or identified values:

Offset Information
0-3 "WHDO" – Sprite format ID shared by all .SPR files
4 Information specific to every sprite file
5 Information specific to every sprite file
20 Number of colors in palette block
28 Number of fairies in sprite

The Fairy Information Block

This section start at offset 32 and contains as many entries as the number of fairies in the sprite. Every entry is 32 bytes long, creating a block the size of 32 times the number of fairies (For example, the section in BERNHD.SPR is 32x104=3328 bytes large).

Note that all entries are words (2 bytes in length), except the fairy start position which is in longint format (4 bytes). Also note that to obtain the absolute starting position of any fairy, the start position of the first fairy (obtained by adding the header size, information block size, and color block size) must be added to the relative start position.

Offset Information
0 Always 4, perhaps an ID denoting a new entry?
2 Always 16. Function unknown.
4 A value always above 64K. Function unknown.
6 A value always above 64K. Function unknown.
8 The fairy X-size (in pixels)
10 The fairy Y-size (in pixels)
12-15 The fairy start position in the data block in longint format. First fairy starts at position zero, which makes these relative coordinates.
16 Size of fairy bitmap (can be a longint, but offs. 18 is always zero)
20 Identical to offs. 16 above
24 Fairy action identification, can be 0, 16, 32, 48 or 64. Every file does not necessarily have all values represented. See specific section, below.

Actions

A sprite is composed of series of eight frames. Every one of these series result in a 360-degree rotation around a moment of every action the sprite can perform. If a sprite has two frames assigned for an action, lets say for example that walking consists of two step a gait, then the first eight fairies are the first step from all eight directions, and the next eight are the second step.

Two control what action the fairies represent, they are assigned an action control value in their portion of the fairy information block. The values also represent different status for different types of units. The values can assume one of the following decimal values:

Value Meaning
0 Running: the unit runs wildly. These are used both for ordered charges and disordered routs

For ballistic weapons, including the Imperial Steam Tank, this value means that it is in functional order

16 Hold: The unit holds position or moves orderly

For ballistic weapons, this value means that the machinery is destroyed

32 Attacking: the unit attacks with Mêlée weapons
48 Death: the unit's corpse
61 Ice magic: the unit casts Ice Book magic.
62 Ranged fire: the unit fires its hand-carried ranged weapon. This does not include ballistic units.
63 Bright magic: the unit casts Bright Book magic
64 Dark magic: the unit casts Dark Book Magic.

Frames are always placed in order of action, i.e. hold/move fairies are located before ranged fire frames. Values above 16 have no meaning for ballistic units; they only contain frames designated 0 or 16. When adapting units, make sure there are fairies for all actions that are assigned! (For example, if assigning a Bright Spellbook and Bows, make sure there are both casting Bright Magic and firing ranged weapons fairies).

Note! Missiles (the M_*.SPR sprites) carry additional values that as of yet have not been investigated. It is also likely that actions have a predetermined number of frames, for example moving could consist of four series of eight fairies. This, also, have yet to be ascertained.

The palette color information block

The palette contains information on all colors used by the sprite saved in an unorthodox variant of typical 4-byte RGBA format (where the Red, Green, Blue and Alpha channels are saved as separate bytes with values ranging from 0-255, together forming a four-byte length color information packet. This type of color information is handled by sending a value to windows in the order AABBGGRR; for example $00FFFFFF is bright white with no transparency). The colors in this palette are however described in ARGB-order, thus the byte-order must be adjusted for the colors to be correctly displayed outside of the actual game. The alpha channel is consistently set to zero, indicating that it is not used in the game.

The size of this block is hence four bytes times the number of colors used in the sprite.

The fairy data block

This section contains the raw image data of every fairy, where one byte of data represents one pixel of the color corresponding to the color data at the indexed position in the palette, making this an interesting mix between traditional 8-bit and truecolor techniques.

A bit less involved: if a byte reads “15”, the correct color to output would be the one described in palette entry 15.

Personal tools
communication