Difference between revisions of "Action2/Single Set"

From GRFSpecs
Jump to navigationJump to search
m (→‎Action 2: remove unwanted heading)
(→‎Introduction: added roadtypes and tramtypes)
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
 
== Introduction ==
 
== Introduction ==
  +
{| |-
  +
!Feature !! Version !! Associated graphics
  +
|-
  +
|Canals || {{ottdp|0.6|2.5}} || Depends on [[Action3#ids | Action3 ID]]; see [[Action0/Canals | Action0]]
  +
|-
  +
|Cargos || {{ottdp|0.6|2.5}} || Single icon sprite
  +
|-
  +
|Airports || {{ottdp|1.1|no}} || Single preview image
  +
|-
  +
|Railtypes || {{ottdp|1.0|no|ottdrev=r19056}} || Depends on [[Action3/Railtypes#cargo-type| Action3 'cargo' type]]
  +
|-
  +
|Roadtypes || {{ottdp|1.10}} || Depends on [[Action3/Roadtypes#cargo-type| Action3 'cargo' type]]
  +
|-
  +
|Tramtypes || {{ottdp|1.10}} || Depends on [[Action3/Tramtypes#cargo-type| Action3 'cargo' type]]
  +
|}
   
  +
The Action2 for these features defines only a single spriteset, therefore the action2 you need isn't too complicated.
Defining set-IDs for cargoes, railtypes and airports.
 
   
The only graphics associated to cargoes is their icon that is shown in the station window, therefore the action2 you need isn't too complicated.
+
The only graphics associated to cargoes is their icon that is shown in the station window.
   
The graphics associated with railtypes are somewhat more complicated, but all their logic is in variational action2s and the action3; the standard action2 is again not complicated.
+
The graphics associated with railtypes, roadtypes, and tramtypes are somewhat more complicated, but all their logic is in variational action2s and the action3; the standard action2 is again not complicated.
   
 
The only graphics associated with airports is their preview sprite. The default size for the preview sprite is 230x140. The airport build GUI will automatically scale if you have a smaller or larger image, but it will probably look best if you make sure it is no larger than the default size.
 
The only graphics associated with airports is their preview sprite. The default size for the preview sprite is 230x140. The airport build GUI will automatically scale if you have a smaller or larger image, but it will probably look best if you make sure it is no larger than the default size.
   
  +
Do not skip an Action2 using [[Action9]] (unless it skips the whole file). Action2 must not be skipped by Action9 or TTDPatch will most likely crash. Skip or modify [[Action3]] instead. Skipping an Action2 with an [[Action7]] has no effect.
==Syntax==
 
   
 
== Syntax ==
<Sprite-number> * <Length> 02 0B/10 <set-id> 01 00 <set>
 
  +
 
<Sprite-number> * <Length> 02 <feature> <set-id> 01 00 <set>
   
 
{|
 
{|
Line 23: Line 39:
 
|02||B||Defines action2
 
|02||B||Defines action2
 
|-
 
|-
  +
|<feature>||B||[[Features | Feature]] being defined
|0B/10||B||Sprites are used for feature 0B - cargoes, or feature 10 - rail types
 
 
|-
 
|-
 
|<set-id>||B||What set-ID this action2 defines
 
|<set-id>||B||What set-ID this action2 defines
Line 36: Line 52:
 
You may note that this is the same as the action2 entry for vehicles, but with num_loadtypes=1 and num_loadingtypes=0, and only one set number.
 
You may note that this is the same as the action2 entry for vehicles, but with num_loadtypes=1 and num_loadingtypes=0, and only one set number.
   
==Description==
+
== Description ==
   
===Sprite-number===
+
=== Sprite-number ===
   
 
This is just the number you are at.
 
This is just the number you are at.
   
===Length===
+
=== Length ===
   
 
Count the number of bytes in this action.
 
Count the number of bytes in this action.
   
===Set===
+
=== set-id ===
  +
  +
This defines the ID of the current action 2. This ID will later be referred to by [[Action3|action 3]], or a variational/random action 2.
  +
  +
You can reuse action 2 IDs, and there's no restriction on the order in which they are defined.
  +
  +
=== set ===
   
  +
The sprite set to use for displaying. Entry is a WORD value in little endian format, and refers to the most recent action1 set. For example, action1 set 3 would be encoded as 03 00. Note the additional 00 which is needed because it must be a word value here.
A '''WORD''' value, the number of the sprite set to be used. (Don't forget that sprite set numbering starts from zero)
+
(Don't forget that sprite set numbering starts from zero)

Latest revision as of 12:31, 28 December 2019

Introduction

Feature Version Associated graphics
Canals Supported by OpenTTD 0.60.6 Supported by TTDPatch 2.52.5 Depends on Action3 ID; see Action0
Cargos Supported by OpenTTD 0.60.6 Supported by TTDPatch 2.52.5 Single icon sprite
Airports Supported by OpenTTD 1.11.1 Not supported by TTDPatch Single preview image
Railtypes Supported by OpenTTD 1.0 (r19056)1.0 Not supported by TTDPatch Depends on Action3 'cargo' type
Roadtypes Supported by OpenTTD 1.101.10 Not supported by TTDPatch Depends on Action3 'cargo' type
Tramtypes Supported by OpenTTD 1.101.10 Not supported by TTDPatch Depends on Action3 'cargo' type

The Action2 for these features defines only a single spriteset, therefore the action2 you need isn't too complicated.

The only graphics associated to cargoes is their icon that is shown in the station window.

The graphics associated with railtypes, roadtypes, and tramtypes are somewhat more complicated, but all their logic is in variational action2s and the action3; the standard action2 is again not complicated.

The only graphics associated with airports is their preview sprite. The default size for the preview sprite is 230x140. The airport build GUI will automatically scale if you have a smaller or larger image, but it will probably look best if you make sure it is no larger than the default size.

Do not skip an Action2 using Action9 (unless it skips the whole file). Action2 must not be skipped by Action9 or TTDPatch will most likely crash. Skip or modify Action3 instead. Skipping an Action2 with an Action7 has no effect.

Syntax

<Sprite-number> * <Length> 02 <feature> <set-id> 01 00 <set>
Element Size Description
<Sprite-number> dec A sequential sprite number
<length> dec The total number of bytes used in this action
02 B Defines action2
<feature> B Feature being defined
<set-id> B What set-ID this action2 defines
01 B A literal 01 byte
00 B A literal 00 byte
<set> W Number of set to use from the last action 1

You may note that this is the same as the action2 entry for vehicles, but with num_loadtypes=1 and num_loadingtypes=0, and only one set number.

Description

Sprite-number

This is just the number you are at.

Length

Count the number of bytes in this action.

set-id

This defines the ID of the current action 2. This ID will later be referred to by action 3, or a variational/random action 2.

You can reuse action 2 IDs, and there's no restriction on the order in which they are defined.

set

The sprite set to use for displaying. Entry is a WORD value in little endian format, and refers to the most recent action1 set. For example, action1 set 3 would be encoded as 03 00. Note the additional 00 which is needed because it must be a word value here. (Don't forget that sprite set numbering starts from zero)