Difference between revisions of "Action1"

From GRFSpecs
Jump to navigationJump to search
m (13 revisions)
(fix tables and stuff lost in conversion)
Line 1: Line 1:
   
 
==Introduction==
'''''Define a set of real sprites'''''
 
 
=Action 1=
 
 
 
Defining a set of real sprites.
 
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 [[Action8|Action 8]].
 
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 [[Action8|Action 8]].
   
  +
==Syntax==
-=Format=-
 
   
 
The data looks as follows:
 
The data looks as follows:
   
<pre> -+&lt;sprite-number&gt; * &lt;length&gt; 01 &lt;feature&gt; &lt;num-sets&gt; &lt;num-ent&gt;+-</pre>
+
<sprite-number> * <length> '''01''' <feature> <num-sets> <num-ent>
   
  +
{| |-
||'''Element'''|[[GRFActionsDetailed|'''Size''']]|'''Description'''
+
!Element!![[GRFActionsDetailed||Size]]!!Description
 
  +
|-
&lt;sprite-number&gt;|dec|A sequential sprite number
+
|<sprite-number>||dec||A sequential sprite number
 
  +
|-
&lt;length&gt;|dec|The total number of bytes used in this action
+
|<length>||dec||The total number of bytes used in this action
 
  +
|-
01|B|Defines action 01
+
|01||B||Defines action 01
 
  +
|-
&lt;feature&gt;|B|The feature that following sprites should be used for (s.b.)
+
|<feature>||B||The feature that following sprites should be used for (s.b.)
 
  +
|-
&lt;num-sets&gt;|B|The number of sprite sets you have (one sprite set is one vehicle/station/ship etc)
+
|<num-sets>||B||The number of sprite sets you have (one sprite set is one vehicle/station/ship etc)
 
  +
|-
&lt;num-ent&gt;|B*|The number of views the sprite has||
+
|<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.
 
The block of data that always follows after action 01 should consist of num-sets * num-ent RealSprites.
   
  +
==Descriptions==
-=Filling in the terms=-
 
   
 
===sprite-number===
 
===sprite-number===
Line 47: Line 43:
   
 
00 for trains
 
00 for trains
 
 
01 for road vehicles
 
01 for road vehicles
 
 
02 for ships
 
02 for ships
 
 
03 for planes
 
03 for planes
 
 
04 for stations
 
04 for stations
 
 
05 for canals
 
05 for canals
 
 
06 for bridges
 
06 for bridges
 
 
07 for houses
 
07 for houses
 
 
09 for industry tiles
 
09 for industry tiles
 
 
0B for cargos
 
0B for cargos
 
 
0F for newobjects
 
0F for newobjects
 
 
10 for rail types (since OpenTTD r18969)
 
10 for rail types (since OpenTTD r18969)
   
 
===num-sets===
 
===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 [[Action2|Action 2]] and [[Action3|Action 3]])
 
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 [[Action2|Action 2]] and [[Action3|Action 3]])
   
Line 78: Line 62:
 
This sets how many different views each entry has.
 
This sets how many different views each entry has.
   
For vehicles, this corresponds to the different directions it can be in. &nbsp;If your vehicle is symmetrical you need 4 views, and if it isn't symmetrical then use 8 views.
+
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.
 
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 [[Action3|Action 3]].
 
For canals, it depends on the canal feature, see [[Action3|Action 3]].
   
Line 88: Line 71:
 
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.
 
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 &quot;extended byte&quot; (see [[GRFActionsDetailed]]).
+
Since TTDPatch 2.0.1 alpha 49, this value is a so-called "extended byte" (see [[GRFActionsDetailed]]).
   
Since 2.0.1 alpha 63, it is possible to have &lt;num-ent&gt;=0. This is useful for defining an action 1/2 combination that only serves as invalid callback result. &nbsp;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.
+
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.
   
-=Example=-
+
==Example==
   
 
Below is an example of what a real Action 1 pseudo-sprite could look like with the sprite entries under it.
 
Below is an example of what a real Action 1 pseudo-sprite could look like with the sprite entries under it.
   
<pre>2 * 4 01 00 01 08
+
2 * 4 01 00 01 08
 
3 C:\TTD\SPRITES\mytrain.pcx 66 8 01 18 8 -3 -10
 
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
 
4 C:\TTD\SPRITES\mytrain.pcx 82 8 09 15 20 -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
 
5 C:\TTD\SPRITES\mytrain.pcx 114 8 01 12 28 -14 -6
+
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
 
6 C:\TTD\SPRITES\mytrain.pcx 162 8 09 16 20 -4 -8
+
10 C:\TTD\SPRITES\mytrain.pcx 290 8 09 15 20 -4 -7</pre>
 
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</pre>
 
 
||'''Byte'''|'''Meaning'''
 
 
2|&lt;sprite-number&gt;
 
 
4|&lt;length&gt; of the action in bytes; start counting at 01 (&lt;action&gt;)
 
 
01|&lt;action&gt;: sets this pseudo-sprite to function as action 1
 
 
00|&lt;feature&gt;: In this case Train
 
 
01|&lt;num-sets&gt;: 1 Set of views
 
   
  +
{| |-
08|&lt;num-ent&gt;: 8 views of this train||
 
 
!'''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

Revision as of 05:33, 14 June 2011

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 [[GRFActionsDetailed 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.

Descriptions

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:

00 for trains 01 for road vehicles 02 for ships 03 for planes 04 for stations 05 for canals 06 for bridges 07 for houses 09 for industry tiles 0B for cargos 0F for newobjects 10 for rail types (since OpenTTD r18969)

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).

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.

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