Action1

From GRFSpecs
Revision as of 14:36, 15 August 2011 by Frosch (talk | contribs) (version tags)
Jump to navigationJump to search

Introduction

Defining a set of real sprites. 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.

Syntax

The data looks as follows:

<sprite-number> * <length> 01 <feature> <num-sets> <num-ent>
Element Size Description
<sprite-number> dec A sequential sprite number
<length> dec The total number of bytes used in this action
01 B Defines action 01
<feature> B The feature that following sprites should be used for (s.b.)
<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 * num-ent RealSprites.

Description

sprite-number

This is just the number you are at.

length

Count the number of bytes in this action.

Feature

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

Value Feature
00 Trains
01 Road Vehicles
02 Ships
03 Aircraft
04 Stations
05 Canals/Rivers
07 Houses
09 Industry Tiles
0A Industries
0B Cargos
0D Airports
0F Objects
10 Railtypes
11 Airport Tiles

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.

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

Supported by OpenTTD 0.60.6 Supported by TTDPatch 2.5 (2.0.1 alpha 63)2.5 Since TTDPatch 2.0.1 alpha 63, it is possible to have <num-ent>=0. This is useful for defining an action 1/2 combination that only serves as invalid callback result. If the .grf file defines no graphics otherwise, this way callbacks can return an explicit failure code without needing any actual sprites to be allocated. This is also needed if the feature has no graphics at all.

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