Action1

From GRFSpecs
Revision as of 23:54, 22 September 2005 by dmccoy (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Define a set of real sprites

Action 1

Defining a set of real sprites.

-=Introduction=-

Action 01 is used to define sets of real sprites (as opposed to pseudo-sprites). It can be put anywhere in the .nfo file after action 8.

-=Format=-

The data looks as follows:

 -+<Sprite-number> * <Length> 01 <feature> <num-sets> <num-ent>+-

This is normally followed by a set of these kind of lines

 x C:\TTD\sprites\wiki.pcx 82 8 01 20 8 -3 -12

  x C:\TTD\sprites\wiki.pcx 98 8 09 17 20 -13 -8

  x C:\TTD\sprites\wiki.pcx 146 8 01 12 30 -14 -7

  x C:\TTD\sprites\wiki.pcx 194 8 09 18 20 -4 -9

||Element|Size|Description

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

<length>|dec|The total number of bytes used in this action, usually 4.

01|B|Defines action 01

<feature>|B|For what type of vehicle/station should the following sprites be used?

<num-sets>|B|The number of sprite sets you have (one sprite set is one vehicle/station/ship etc)

<num-ent>|B*|The number of views the sprite has||

The block of data that always follows after action 01 should consist of num-sets x num-ent lines. In this example it should be 1 set that has 4 sides so there are 4 lines below it that directs towards the pcx.  I'll explain it a bit more at the end of this page.

-=Filling in the terms=-

Sprite-number

This is just the number you are at.

Length

Count the number of bytes in this action (usually 4)

feature

This sets the type of feature that you wish to change. Set it to

00 for trains

01 for road vehicles

02 for ships

03 for planes

04 for stations

05 for canals

07 for houses

09 for industry tiles

0B for cargos

num-sets

The amount of stations, vehicles, ships, etc that the following sprites represent (be warned, one spriteset can be used for more as one vehicle, or truck; you will see this when you reach Action 2 and Action 3)

num-ent

This sets how many different views each entry has.

For vehicles, this corresponds to the different directions it can be in.  If your vehicle is symmetrical you need 4 views, and if it isn't symmetrical then use 8 views.

A station should normally be 12 (hex) because a station is made out of 18 (decimal) sprites, although if you use a different sprite layout for your station this number may vary.

For canals, it depends on the canal feature, see action 3.

For houses and industry tiles, this should be between 1 and 4 and specifies the number of different construction stages. Sprites after the first four are always ignored. See also action 2 and 3.

For cargos, this should always be 1. The following sprites should be no larger than 10x10 pixels or they won't fit into the station window correctly.

Since TTDPatch 2.0.1 alpha 49, this value is a so-called "extended byte" (see GRFActionsDetailed).

the data block below the action 01 line

All lines below the Action 1 line direct towards the PCX file you made, so this is where you did it all for in the first place :). It should always consist of of num-sets * num-ent lines, like I said before.

As you probably understand by now, all lines in the NFO are numbered, so these lines are numbered. Then the location of the PCX follows, after that the magic starts again.

The first 2 numbers gives the location of the -+upper left+- corner of the sprite in the PCX file. So the first sprite in this PCX starts at the 8th row and the 82 column.

The next number is the compression. Unlike the other numbers, this one is a hexadecimal bit-field. It is not fully understood, but the known bits are as follows (See also the file format page):

||bit|value|meaning

0|1|Must be set.

1|2|Store compressed size internally.

3|8|Sprite is in chunked data format (aka "tile compression")||The chunked data format is designed to compress tiles and diagonal views of vehicles; things with lots of transparency around the edges, and a contiguous block of non-transparent pixels in the middle. Using the chunked data format may provide advantages in drawing speed, but I have found very few sprites that actually compress smaller when chunked.

The following 2 numbers give the size of the sprite, on the first sprite this is 20 pixels long and 8 high.

The final 2 numbers give set the x and y location of the sprite in TTD.

-=Example=-

Below is an example of what a real Action 1 pseudo-sprite could look like with the sprite entries under it.

2 * 4 01 00 01 08

3 C:\TTD\SPRITES\mytrain.pcx 66 8 01 18 8 -3 -10

4 C:\TTD\SPRITES\mytrain.pcx 82 8 09 15 20 -14 -6

5 C:\TTD\SPRITES\mytrain.pcx 114 8 01 12 28 -14 -6

6 C:\TTD\SPRITES\mytrain.pcx 162 8 09 16 20 -4 -8

7 C:\TTD\SPRITES\mytrain.pcx 194 8 01 18 8 -3 -10

8 C:\TTD\SPRITES\mytrain.pcx 210 8 09 16 20 -14 -7

9 C:\TTD\SPRITES\mytrain.pcx 242 8 01 12 28 -14 -6

10 C:\TTD\SPRITES\mytrain.pcx 290 8 09 15 20 -4 -7

||Byte|Meaning

2|<sprite-number>

4|<length> of the action in bytes; start counting at 01 (<action>)

01|<action>: sets this pseudo-sprite to function as action 1

00|<feature>: In this case Train

01|<num-sets>: 1 Set of views

08|<num-ent>: 8 views of this train||