Action8

From GRFSpecs
Revision as of 17:24, 22 January 2004 by Hyronymus (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Action 8

Action 8

Giving your .grf file an ID

-=Why does your .grf file need an ID?=-

There are many new graphic sets available to TTD players.  Of course, we need to make sure that we never get sets mixed up.  To make sure this will never happen you can set an ID.  Another useful feature of Action 8 is the ability to include useful information into the final .grf file. Here, we explain how Action 8 works.

-=Format=-

Like all other pseudo-sprites, Action 8 consists of hexadecimal bits. There is no limitation in the total amount of hexadecimal bits you can use in Action 8. One term does have a limit though. Let's give an example of what an Action 8 line looks like:

-+<Sprite-number> * <Length> <Action> <Version> <Grf-id> <Description> <Moreinfo>+-

Here is a short overview of what every term means:

||Byte|Description

<-+Sprite-number+-> |A sequential sprite number

<-+Length+-> |The total numer of bytes in the action

<-+Action+-> |Action type.  In this case, 08

<-+Version+-> |Graphics version

<-+Grf-id+-> |A unique ID for your .grf file

<-+Description+-> |A comment field, usually for .grf file name

<-+Moreinfo+-> |Another comment field, usually for copyright||

-=Filling in the terms=-

Now that you know what an Action 8 looks like it's time to explain how you should fill in the several terms in Action 8. It seems wise to discuss each term seperatly.

Sprite-number

Action 8 must be the first pseudosprite after the first line in the .NFO file. Remember that in the first line of the .NFO file you tell the computer how many (pseudo-)sprites there are in the .grf file. This first line is numbered 0 and doesn't count in the total amount of (pseudo-)sprites in the .NFO file. According to this, Action 8 will be sprite-number 1.

There is one exception to this rule. You can have several Action 7's before your first Action 8. If you have n Action 7's before Action 8, Action 8 will have spritenumber n+1.

Length

The total numer of bytes in Action 8.  Start counting from <-+Action+->, the bit that sets the pseudo-sprite to act as the specified action.

Action

The type of action this pseudo-sprites defines. It should be 08 here because we want this pseudo-sprite to act as Action 8.

Version

This should be the graphics version that your file will support. Valid values are:

||TTDPatch version|Value

2.0r1 Stable TTDPatch + current alpha series|

05

2.0    Stable TTDPatch|

04

1.9.1 alpha 28 - 2.0 Stable TTDPatch|

01

1.9.1 before alpha 28|

00

||

Entries for 00 and 01 are included only for completeness, and to aid with updating existing graphics.  They should not be used with new graphics. Using these old values may break future compatibility. Features have been added since these early versions and some early actions refer to other current actions.

Grf-id

This is a series of 4 bytes.  It's almost a convention to use the first two bytes for the creator's initials in ASCII code, e.g.  54 57 for "TW" (see below). The last two bytes should be numbers. This can be a version number, but you should take care if you plan on producing multiple sets.

Description

This comment field should contain a brief description of the set, converted into hexadecimal bytes, null-terminated (ending in 00).  If you miss the final 00 here, this and other sprites may fail.

Moreinfo

This is an additional comment field to store even more information about the set, possibly for a brief copyright notice or other attribution. This field is also null-terminated.  If you miss the final 00 here, this and other sprites may fail.

-=Example=-

Below is an example of what a real Action 8 pseudo-sprite could look like.

-+1 * 43 08 05 54 57 01 06 20 54 75 74 6F 72 69 61 6C 20 65 78 61 6D 70 6C 65 00 20 43 6F 70 79 72 69 67 68 74 3A 20 53 79 73 74 65 6D 00+-

Let's clarify it bit by bit. In order to understand what the bits say you could use a hexadecimal editor.

||Byte|Meaning

-+1+-

|<-+Sprite-number+->

-+43+-

|<-+Length+-> of the action in bytes; start counting at 08 (<-+Action+->)

-+08+-

|<-+Action+->: sets this pseudo-sprite to function as Action 8

-+05+-

|<-+Version+->: this .grf file works with TTDPatch 2.0r1 + alpha series

-+54 57 01 06+-

|<-+Grf-id+->: ASCII code for TW, then the numbers 1 and 6

-+20 54 .. 65 00+-

|<-+Description+->, null-terminated : Tutorial example

-+20 43 .. 6D 00+-

|<-+Moreinfo+->, null-terminated : Copyright: sytem||