Action2/Vehicles

From GRFSpecs
< Action2
Revision as of 09:07, 18 June 2011 by Pm-bot (talk | contribs) (Bot: Automated text replacement (--= +==))
Jump to navigationJump to search

Introduction

Action 2

Defining set-IDs for vehicles.


For features 0, 1, 2 and 3 (vehicles), action2 is mainly used to define sets of sprites that show one vehicle in various states of load for one particular type of cargo.

Syntax

For vehicles, the data looks as follows:

<Sprite-number> * <Length> 02 <veh-type> <set-id> <num-loadtypes> <num-loadingtypes> <loadtypes...>
Element Size Description
<Sprite-number> dec A sequential sprite number
<length> dec The total number of bytes used in this action
02 B Defines an action2
<veh-type> B For what type of vehicle should the following sprites be used?
<set-id> B Set-ID of this action2
<num-loadtypes> B Number of different states while moving
<num-loadingtypes> B Number of different states while loading/unloading
<loadtypes> W Sets from the most recent action1 to use for various states of loading.

Description

Sprite-number

This is just the number you are at.

Length

Count the number of bytes in this action.

veh-type

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

00 for trains

01 for road vehicles

02 for ships

03 for planes

Set-id

This is the number that you give this set of sprites. You can choose any value between 00 and FF, and you can reuse them within a grf file at a later point (if being equal to an existing set-ID, the existing one is overwritten and the new one is used).

num-loadtypes

This is the number of different graphics that the vehicle has while it's not loading or unloading, depending on the amount of cargo it carries. For example, if it has two states, full or empty, this would be 02. If it has three states, full, half full or empty, this would be 03.

num-loadingtypes

Same as num-loadtypes, except this is used while the vehicle is loading or unloading. For example if the vehicle is closed, it might only have one state when moving (i.e. num-loadtypes is 01), but show several load states when it is being loaded or unloaded and thus open.

Neither num-loadtypes nor num-loadingtypes may be zero, there must be at least one state for each.

loadtypes

The sprite sets to use for the states of load. Each entry is a WORD value in little endian format, and refers to the most recent action1 sets. For example, action1 sets 4, 5 and 7 would be encoded as -+04 00+-, -+05 00+- and -+07 00+-, respectively. Note the additional 00 which is needed because it must be a word value here.

The first entries of these are used when not loading. There have to be num-loadtypes of these. After this follow the sets to use while loading/unloading, and there must be num-loadingtype of those.

Note that you can share action1 sets between several action2 entries. For example, you might have a wagon that can hold coal or iron ore, and it would look the same if it's empty. Then the empty sprite set could be shared by the action2 entries for iron ore and coal.

Notes

Do not skip an action2 using action9 (unless it skips the whole file). Action2 must not be skipped by action9 or the patch will most likely crash. Skip or modify action3 instead. Skipping an action2 with an action7 has no effect.

If there is only one load type, it is shown for all loads.

If there are two load types, the first is shown below 50%, the other above 50%. If there are three load types, they are shown above/below 33% and 66%. If there are four load types, they are shown above/below 25%, 50% and 75%, etc.

Example

Something to go here