Darkvater wrote:I thought action13 for the state-machine and positions-code as there is no action so far I have seen that uses anything close to this.
I take it you haven't looked too closely at station prop 09[0]. If Action 0 can be subverted to do that, it can be subverted to do absolutely anything.
[0] MB has written a prop 0E that is 58263 bytes long. Yes, there are five digits there, and no, MB didn't just tack an extra 55k of data on the end for no good reason. NFORenum tells me that there is not a single extra byte, and I am inclined to believe it.
DaleStan wrote:I may have a go at writing a spec for the necessary properties ... later.
And here goes:
This was basically constructed by reading airport_movement.h and building an NFO format around it. Some named constants in airport_movement.h were unclear to me and were left as "NAMED_CONSTANT", instead of "Text description".
The international airport uses some constructs I cannot parse:
Code: Select all
{0,HANGAR,NOTHING_block,2}, {0,255,TERM_GROUP1_block,0}, {0,255,TERM_GROUP2_ENTER1_block,1}, {0,HELITAKEOFF,HELIPAD1_block,2}, {0,0,0,2},
What do the 255s mean? I thought they meant "never take this branch", but there's no point in putting that anywhere except in the first entry.
In any case, this format cannot encode that.
Prop 16 contains the feature of the vehicles that will use this station, default is 00. (So the high nibble is always 0, contrary to my previous post.) (Currently only 00 and 03 are supported)
Prop 17 defines airport movement data and the state machine. It is variable-lengthed and formatted as follows:
<num-pos> <pos-data>...
<num-pos> is a byte.
<pos-data> is variable-length and repeated <num-data>+1 times.
It consists of:
<X> <Y> <flag> <direction> <block> (<heading> <check-block> <next>)* [FF]
<X> and <Y> are words, interpreted as signed integers. (Significance of AirportMovingData::x and AirportMovingData::y?)
<flags> is a bit mask:
0 : Do not clamp speed
1 : This is an airplane take-off location
2 : AMED_SLOWTURN
3 : This is an airplane landing location
4 : Force aircraft facing (see <direction>)
5 : AMED_BRAKE
6 : This is a helicopter take-off location
7 : This is a helicopter landing location
If both bits 1 and 3 are set, this is the point where airplanes enter this state machine.
If both bits 6 and 7 are set, this is the point where choppers enter this state machine.
<direction> is a byte, and ignored unless bit 4 of <flags> is set. If that bit is set, the aircraft is turned to face the specified direction.
<block> is a byte, indicating which block this position is a part of. Block 00 may have any number of aircraft in it at any one time; all others may have at most one at a time.
<heading> <check-block> <next> triples are repeated as necesary and terminate with either a triple with a <heading> of FE, or an FF byte.
<heading> is a byte.
If the high bit of <heading> is clear, the low seven bits specify the terminal/pad this aircraft is going to. If necessary, use the state machine to keep planes and choppers separate.
The following special values are also available:
80: HANGAR
81: TAKEOFF
82: STARTTAKEOFF
83: ENDTAKEOFF
84: HELITAKEOFF
85: FLYING
86: LANDING
87: ENDLANDING
88: HELILANDING
89: HELIENDLANDING
FE: All headings not previously mentioned (marks the last <heading> <check-block> <next> triple)
<check-block> is a byte, indicating which block must be clear before traveling to <next>. As in <block>, block 00 is may have any number of aircraft in it, and is therefore always clear. If <check-block> matches <next> -> <block>, that block is not checked.
<next> is the locations that this aircraft will go to once <check-block> is clear.
Prop 18 functions as prop 0A and 0F, but copies prop 17 instead.
Prop 19 sets the hangar postions. It consists of a byte counting the number of hangars, and then that many <X> <Y> pairs (both bytes, as unsigned integers) giving the (X,Y) offset of each hangar from the north corner of the airport.
Prop 1A sets the number of terminals and helipads in each terminal/helipad group:
<num-term-groups> <num-pad-groups> <num-terms>... <num-pads>...
All are bytes.
<num-terms> appears <num-term-groups> times; <num-pads> appears <num-pad-group> times.
The sum of all <num-terms> and <num-pads> must not exceed 128.
Prop 1B is a byte which sets the airport type (small/large/heliport) for the purposes of LA build permissions, crash probablilty, and vehicle variable 44. Oil rig (03) exists internally, but may not be set by .grf files.
The <heading>s 00..7F (in prop 17) are assigned by this property; 00 to the first item in the first group, 01 to the next item on the first group or the first item in the next group, &c.
Prop 1C sets the types of aircraft that can land here:
00 : airplanes only
01 : all
02 : choppers only
Properties 08, 09, 0A, 0B, 10, 12, and 13 function as for rail stations, except that bit 1 of prop 0B must be set.
Properties 0C, 0D 0E, 0F, 11, and 14 are meaningless (and ignored) in the context of airports.
Callback 13 works as for rail stations.
Callback 14 works as for rail stations, but may also return 100h to indicate "Build no tile here."
Callback 3C (no action 0 bit) is called whenever a plane with a set minimum-runway-length wants to switch to a LANDING or STARTTAKEOFF position (may be adjusted once these named constants are explained), and whenever a plane is given orders to this airport (assuming it passes prop 1C).
Variable 10 contains the position that the plane wishes to enter, or FFFFFFFF if an order was added.
The low byte of the return contains the length of this runway (ignored when 10 is FFFFFFFF), and the high byte contains the length of the longest runway at this airport.
Actions 1..3 work as for rail stations.
Action 4 works as for rail stations for C5xx IDs, and possibly for the C4xx IDs.
The third byte of vehicle variable 44 will have at least the following distinct (and airport-independent) values:
- In hangar
- On a pad
- Taxiing
- Taking off
- Landing
- In flight
Example: the Country Airport (aka Small Airport) would read as follows:
Code: Select all
17 16 //Prop 17, 16h locations
35 00 03 00 10 03 00 // 00 In hangar
80 00 01 // HANGAR: go to 01
FF
35 00 1B 00 00 00 09 // 01 Taxi to right outside depot
80 00 00 // HANGAR: go to 00
00 01 02 // Terminal 1: check TERM1_block and go to 02
01 00 04 // Terminal 2: go to 04
84 00 13 // HELITAKEOFF: go to 13
FE 00 06 // ELSE: goto 06
20 00 17 00 10 07 01 // 02 Terminal 1
00 00 01 // Terminal 1: go to 01
FF
0A 00 17 00 10 07 02 // 03 Terminal 2
01 00 05 // Terminal 2: go to 05
FF
2B 00 25 00 00 00 09 // 04 Going towards terminal 2
01 00 05 // Terminal 2: go to 05
80 00 01 // HANGAR: go to 01
81 00 06 // TAKEOFF: go to 06
84 00 01 // HELITAKEOFF: go to 01
FF
18 00 25 00 00 00 09 // 05 Going towards terminal 2
01 02 03 // Terminal 1: check TERM1_block and go to 03
FE 00 04 // ELSE: go to 04
35 00 25 00 00 00 09 // 06 Going for takeoff
FE 00 07 // Always go to 07
3D 00 28 00 10 01 09 // 07 Taxi to start of runway (takeoff)
FE 00 08 // Always go to 08
03 00 28 00 01 00 00 // 08 Accelerate to end of runway
FE 00 09 // Always go to 09
B1 FE 28 00 03 00 00 // 09 Take off
FF // The aircraft has left this state machine.
B1 00 28 00 05 00 00 // 0A Fly to landing position in air
86 00 0B // LANDING: go to 0B
88 00 14 // HELILANDING: goto 14
FE 00 15 // ELSE: go to 0F
38 00 28 00 09 00 09 // 0B Going down for land
FE 00 0C // Always go to 0C
03 00 28 00 21 00 09 // 0C Just landed, brake until end of runway
FE 00 0D // Always go to 0D
07 00 28 00 00 00 09 // 0D Just landed, turn around and taxi 1 square
87 00 0E // ENDLANDING: go to 0E
01 00 05 // Terminal 2: go to 05
FE 00 0E // ELSE: go to 0E
35 00 28 00 00 00 09 // 0E Taxi from runway to crossing
FE 00 01
E1 FE C1 00 05 00 00 // 0F Fly around waiting for a landing spot (north-east)
FE 00 10
01 00 01 00 CF 00 00 // 10 Fly around waiting for a landing spot (north-west)
FE 00 11
01 01 01 00 05 00 00 // 11 Fly around waiting for a landing spot (south-west)
FE 00 12
11 01 31 00 05 00 00 // 12 Fly around waiting for a landing spot (south)
FE 00 0A
2C 00 25 00 42 00 00 // 13 Helicopter takeoff
FF // The aircraft has left this state machine
2C 00 28 00 05 00 09 // 14 In position above landing spot helicopter
FE 00 15
2C 00 28 00 80 00 09 // 15 Helicopter landing
FE 00 01
19 01 03 00 // one depot, at (3,0)
1A 01 00 // one terminal group and no helipad groups
02 // (Terminal) group containing 2 items; gets <headings> 00..01
Example: The International airport's props 19..1A would be:
Code: Select all
19 02 00 03 06 01 // two depots, at (0,3) and (6,1)
1A 02 01 // two terminal groups and one helipad group
03 // (terminal) group containing three items; gets <heading>s 00..02
03 // (terminal) group containing three items; gets <heading>s 03..05
02 // (helipad) group containing two items; gets <heading>s 06..07