- UID
- 14542
- 阅读权限
- 150
- 注册时间
- 2007-8-13
- 最后登录
- 2020-12-6
- 在线时间
- 603 小时
- 性别
- 男
- 生日
- 1994 年 12 月 2 日
- 情感状态
- 待解救
圣徒
- 耕战
- 315
- 鹰币
- 385290
- 天龙币
- 0
- 回帖
- 2437
|
发表于 2011-2-16 18:59:46
|
显示全部楼层
Genie uses the SLP format to store its graphics. The reason behind the name "SLP" is unknown, but
it is known that Ensemble Studios used the name internally because each file has the string
"ArtDesk 1.00 SLP Writer" embedded in it. The format allows for special features such as player
colors, but is a bit dated when compared to the possibilities modern standards (such as PNG)
allow. Following is a description of the format.
Data format
The first item in an SLP file is the header, of the following format:
struct file_header
{
char version[4];
long num_frames;
char comment[24];
};
version: Given as a string, usually "2.0N".
num_frames: The total number of frames in the SLP.
comment: The above string "ArtDesk 1.00 SLP Writer".
Following is frame information, one of the following structures for each frame (see num_frames
above):
struct frame_info
{
unsigned long cmd_table_offset;
unsigned long outline_table_offset;
unsigned long palette_offset;
unsigned long properties;
long width;
long height;
long hotspot_x;
long hotspot_y;
};
properties: This value is suspected to change which palette the SLP uses, but the possible options
seem to be the same so this has never been confirmed.
hotspot_x, hotspot_y: These points set the hotspot of a frame, which is the "center" of the unit.
A unit's coordinates in a scenario specify the location of this pixel.
Per-frame data
The following data are repeated as a whole for each frame.
The first data are edge structures, one for each row. To conserve disk space, commands (see below)
are only included for the necessary area, and these edges specify the blank space surrounding a
unit.
struct rowedge
{
short left, right;
};
Following are an array of longs, specifying the offset for the commands (see below) for each row.
These are not actually necessary as the commands can be read sequentially, but can be used for
checking purposes.
After the array is the command data itself. Each command is a single-byte integer followed by
command-specific data. To make the data very compact, the command byte sometimes also contains the
command-specific data. For example, the Color List command (0x00) only uses the least-significant
bits to specify the command type and the rest of the byte is the number of palette indices to
follow.
The following are the known commands:
Value Command name Pixel count Description
0x00 Color list >>2 An array of palette indices. This is about as bitmap as it gets in SLPs.
0x01 Skip >>2 or next The specified number of pixels are transparent.
0x02 Big color list >>4 * 256 and next An array of palette indexes. Supports a greater number
of pixels than the above color list.
0x03 Big skip >>4 * 256 and next The specified number of pixels are transparent. Supports a
greater number of pixels than the above skip.
0x06 Player color list >>4 or next An array of player color indexes. The actual palette index
is given by adding ([player number] * 16) + 16 to these values.
0x07 Fill >>4 or next Fills the specified number of pixels with the following palette index.
0x0A Player color fill >>4 or next Same as above, but using the player color formula (see
Player color list).
0x0B Shadow transparent >>4 or next Specifies the shadow for a unit, but most SLPs do not use
this.
0x0E Shadow player next Unknown.
0x0F End of row 0 Specifies the end of commands for this row.
0x4E Outline 1 When normally drawing a unit, this single pixel acts normally. When the unit is
behind something, this pixel is replaced with the player color.
0x5E Outline span next Same function as above, but supports multiple pixels.
Possible pixel count values:
Next byte: Stored in the next byte.
>>2: Command byte right-shifted 2 bits.
>>4 or next: Either the command byte right-shifted 4 bits or in the next byte if the former is 0.
>>2 or next: Either the command byte right-shifted 2 bits or in the next byte if the former is 0.
>>2 * 256 and next: The command byte right-shifted 2 bits and then added to the next byte's value.
>>4 * 256 and next: The command byte right-shifted 4 bits and then added to the next byte's value. |
|