	1 * 1	00 04 0A 01 GANTRY_OLD_N
		08 "ISRI"

		// Sprite layout
		1A 04
			// 00 (x)
			44
			\dx000003F4 \wx0002 // ground sprite
			10 // register
			\dx8000042D \wx0040 // ground overlay sprite (child)
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx8000842D \wx0007 // crane back
			00 00 00 // x/y/z offset
			10 05 11 // x/y/z extent
			01 05 12 // registers
			\dx8000843A \wx0007 // crane front
			00 0B 00 // x/y/z offset
			10 05 11 // x/y/z extent
			01 05 12 // registers
			\dx80008447 \wx0007 // crane top
			00 00 11 // x/y/z offset
			10 10 29 // x/y/z extent
			01 05 12 // registers

			// 01 (y)
			44
			\dx000003F3 \wx0002 // ground sprite
			10 // register
			\dx8000042E \wx0040 // ground overlay sprite (child)
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx80008454 \wx0007 // crane back
			00 00 00 // x/y/z offset
			05 10 11 // x/y/z extent
			01 05 12 // registers
			\dx80008461 \wx0007 // crane front
			0B 00 00 // x/y/z offset
			05 10 11 // x/y/z extent
			01 05 12 // registers
			\dx8000846E \wx0007 // crane top
			00 00 11 // x/y/z offset
			10 10 29 // x/y/z extent
			01 05 12 // registers

			// 02 (x) purchase
			44
			\dx000003F4 \wx0000 // ground sprite
			\dx8000042D \wx0040 // ground overlay sprite (child)
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx80000433 \wx0000 // crane back
			00 00 00 // x/y/z offset
			10 05 11 // x/y/z extent
			\dx80000440 \wx0000 // crane front
			00 0B 00 // x/y/z offset
			10 05 11 // x/y/z extent
			\dx8000044D \wx0000 // crane top
			00 00 11 // x/y/z offset
			10 10 29 // x/y/z extent

			// 03 (y) purchase
			44
			\dx000003F3 \wx0000 // ground sprite
			\dx8000042E \wx0040 // ground overlay sprite (child)
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx8000045A \wx0000 // crane back
			00 00 00 // x/y/z offset
			05 10 11 // x/y/z extent
			\dx80000467 \wx0000 // crane front
			0B 00 00 // x/y/z offset
			05 10 11 // x/y/z extent
			\dx80000474 \wx0000 // crane top
			00 00 11 // x/y/z offset
			10 10 29 // x/y/z extent

		0B 06 // use callback to determine layout (2) and animation frame (4)

		0C FE // only allow 1 platform
		0D C1 // disallow platform length 1 and > 6

		14 FF // wires (none)
		11 00 // pylon placement (none)

		16 \wx0151 // animation info 82 frames looping
		17 05      // animation speed 2^5 ticks per frame (~800ms)
		18 \wx0018 // animation triggers - train enters (0x08), train leaves (0x10)


	1 * 1	01 04 01 4E
//@@LET xpos = 3
//@@LET ypos = 4
//@@LET xsize = 23
//@@LET ysize = 19
//@@LET xrel = -21
//@@LET yrel = -3
//@@LET xsizeh = 11
//@@LET xsizeh1 = (xsize xsizeh -)
//@@LET xposh = (xpos xsizeh1 +)
//@@LET xrelh = (xrel xposh + xpos - 16 -)

	1 images/gantryold1.pcx (xposh 8 +) (ypos) 01 (ysize) (xsizeh 8 -)  (xrelh)     (yrel 12 +) // 042D x, back
	1 images/gantryold1.pcx (xposh 4 +) (ypos) 01 (ysize) (xsizeh 4 -)  (xrelh)     (yrel 10 +) // 042E x, back
	1 images/gantryold1.pcx (xposh)     (ypos) 01 (ysize) (xsizeh)      (xrelh)     (yrel  8 +) // 042F x, back
	1 images/gantryold1.pcx (xposh 4 -) (ypos) 01 (ysize) (xsizeh 4 +)  (xrelh)     (yrel  6 +) // 0430 x, back
	1 images/gantryold1.pcx (xposh 8 -) (ypos) 01 (ysize) (xsizeh 8 +)  (xrelh)     (yrel  4 +) // 0431 x, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 -) (yrel  2 +) // 0432 x, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel)      (yrel)      // 0433 x, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 +) (yrel  2 -) // 0434 x, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 +) (xrel  8 +) (yrel  4 -) // 0435 x, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 +) (xrel 12 +) (yrel  6 -) // 0436 x, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1)     (xrel 16 +) (yrel  8 -) // 0437 x, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 -) (xrel 20 +) (yrel 10 -) // 0438 x, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 -) (xrel 24 +) (yrel 12 -) // 0439 x, back

//@@LET xpos = 29
//@@LET ypos = 4
//@@LET xsize = 25
//@@LET ysize = 26
//@@LET xrel = -23
//@@LET yrel = -11
//@@LET xsizeh = 11
//@@LET xsizeh1 = (xsize xsizeh -)
//@@LET xposh = (xpos xsizeh1 +)
//@@LET xrelh = (xrel xposh + xpos - 16 -)

	1 images/gantryold1.pcx (xposh 8 +) (ypos) 01 (ysize) (xsizeh 8 -)  (xrelh)     (yrel 12 +) // 043A x, front
	1 images/gantryold1.pcx (xposh 4 +) (ypos) 01 (ysize) (xsizeh 4 -)  (xrelh)     (yrel 10 +) // 043B x, front
	1 images/gantryold1.pcx (xposh)     (ypos) 01 (ysize) (xsizeh)      (xrelh)     (yrel  8 +) // 043C x, front
	1 images/gantryold1.pcx (xposh 4 -) (ypos) 01 (ysize) (xsizeh 4 +)  (xrelh)     (yrel  6 +) // 043D x, front
	1 images/gantryold1.pcx (xposh 8 -) (ypos) 01 (ysize) (xsizeh 8 +)  (xrelh)     (yrel  4 +) // 043E x, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 -) (yrel  2 +) // 043F x, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel)      (yrel)      // 0440 x, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 +) (yrel  2 -) // 0441 x, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 +) (xrel  8 +) (yrel  4 -) // 0442 x, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 +) (xrel 12 +) (yrel  6 -) // 0443 x, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1)     (xrel 16 +) (yrel  8 -) // 0444 x, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 -) (xrel 20 +) (yrel 10 -) // 0445 x, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 -) (xrel 24 +) (yrel 12 -) // 0446 x, front

//@@LET xpos = 86
//@@LET ypos = 4
//@@LET xsize = 45
//@@LET ysize = 52
//@@LET xrel = -25
//@@LET yrel = -28
//@@LET xsizeh = 20
//@@LET xsizeh1 = (xsize xsizeh -)
//@@LET xposh = (xpos xsizeh1 +)
//@@LET xrelh = (xrel xposh + xpos - 16 -)

	1 images/gantryold1.pcx (xposh 8 +) (ypos) 01 (ysize) (xsizeh 8 -)  (xrelh)     (yrel 12 +) // 0447 x, crane n
	1 images/gantryold1.pcx (xposh 4 +) (ypos) 01 (ysize) (xsizeh 4 -)  (xrelh)     (yrel 10 +) // 0448 x, crane n
	1 images/gantryold1.pcx (xposh)     (ypos) 01 (ysize) (xsizeh)      (xrelh)     (yrel  8 +) // 0449 x, crane n
	1 images/gantryold1.pcx (xposh 4 -) (ypos) 01 (ysize) (xsizeh 4 +)  (xrelh)     (yrel  6 +) // 044A x, crane n
	1 images/gantryold1.pcx (xposh 8 -) (ypos) 01 (ysize) (xsizeh 8 +)  (xrelh)     (yrel  4 +) // 044B x, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 -) (yrel  2 +) // 044C x, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel)      (yrel)      // 044D x, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 +) (yrel  2 -) // 044E x, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 +) (xrel  8 +) (yrel  4 -) // 044F x, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 +) (xrel 12 +) (yrel  6 -) // 0450 x, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1)     (xrel 16 +) (yrel  8 -) // 0451 x, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 -) (xrel 20 +) (yrel 10 -) // 0452 x, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 -) (xrel 24 +) (yrel 12 -) // 0453 x, crane n

//@@LET xpos = 189
//@@LET ypos = 4
//@@LET xsize = 23
//@@LET ysize = 19
//@@LET xrel = 0
//@@LET yrel = -3
//@@LET xsizeh = 11
//@@LET xsizeh1 = (xsize xsizeh -)
//@@LET xposh = (xpos xsizeh1 +)
//@@LET xrelh = (xrel xposh + xpos - 16 -)

	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 -) (xrel 24 +) (yrel 12 +) // 0454 y, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 -) (xrel 20 +) (yrel 10 +) // 0455 y, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1)     (xrel 16 +) (yrel  8 +) // 0456 y, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 +) (xrel 12 +) (yrel  6 +) // 0457 y, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 +) (xrel  8 +) (yrel  4 +) // 0458 y, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 +) (yrel  2 +) // 0459 y, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel)      (yrel)      // 045A y, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 -) (yrel  2 -) // 045B y, back
	1 images/gantryold1.pcx (xposh 8 -) (ypos) 01 (ysize) (xsizeh 8 +)  (xrelh)     (yrel  4 -) // 045C y, back
	1 images/gantryold1.pcx (xposh 4 -) (ypos) 01 (ysize) (xsizeh 4 +)  (xrelh)     (yrel  6 -) // 045D y, back
	1 images/gantryold1.pcx (xposh)     (ypos) 01 (ysize) (xsizeh)      (xrelh)     (yrel  8 -) // 045E y, back
	1 images/gantryold1.pcx (xposh 4 +) (ypos) 01 (ysize) (xsizeh 4 -)  (xrelh)     (yrel 10 -) // 045F y, back
	1 images/gantryold1.pcx (xposh 8 +) (ypos) 01 (ysize) (xsizeh 8 -)  (xrelh)     (yrel 12 -) // 0460 y, back

//@@LET xpos = 215
//@@LET ypos = 4
//@@LET xsize = 25
//@@LET ysize = 26
//@@LET xrel = 0
//@@LET yrel = -11
//@@LET xsizeh = 11
//@@LET xsizeh1 = (xsize xsizeh -)
//@@LET xposh = (xpos xsizeh1 +)
//@@LET xrelh = (xrel xposh + xpos - 16 -)

	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 -) (xrel 24 +) (yrel 12 +) // 0461 y, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 -) (xrel 20 +) (yrel 10 +) // 0462 y, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1)     (xrel 16 +) (yrel  8 +) // 0463 y, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 +) (xrel 12 +) (yrel  6 +) // 0464 y, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 +) (xrel  8 +) (yrel  4 +) // 0465 y, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 +) (yrel  2 +) // 0466 y, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel)      (yrel)      // 0467 y, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 -) (yrel  2 -) // 0468 y, front
	1 images/gantryold1.pcx (xposh 8 -) (ypos) 01 (ysize) (xsizeh 8 +)  (xrelh)     (yrel  4 -) // 0469 y, front
	1 images/gantryold1.pcx (xposh 4 -) (ypos) 01 (ysize) (xsizeh 4 +)  (xrelh)     (yrel  6 -) // 046A y, front
	1 images/gantryold1.pcx (xposh)     (ypos) 01 (ysize) (xsizeh)      (xrelh)     (yrel  8 -) // 046B y, front
	1 images/gantryold1.pcx (xposh 4 +) (ypos) 01 (ysize) (xsizeh 4 -)  (xrelh)     (yrel 10 -) // 046C y, front
	1 images/gantryold1.pcx (xposh 8 +) (ypos) 01 (ysize) (xsizeh 8 -)  (xrelh)     (yrel 12 -) // 046D y, front

//@@LET xpos = 270
//@@LET ypos = 4
//@@LET xsize = 45
//@@LET ysize = 52
//@@LET xrel = -18
//@@LET yrel = -28
//@@LET xsizeh = 32
//@@LET xsizeh1 = (xsize xsizeh -)
//@@LET xposh = (xpos xsizeh1 +)
//@@LET xrelh = (xrel xposh + xpos - 16 -)

	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 -) (xrel 24 +) (yrel 12 +) // 046E y, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 -) (xrel 20 +) (yrel 10 +) // 046F y, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1)     (xrel 16 +) (yrel  8 +) // 0470 y, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 +) (xrel 12 +) (yrel  6 +) // 0471 y, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 +) (xrel  8 +) (yrel  4 +) // 0472 y, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 +) (yrel  2 +) // 0473 y, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel)      (yrel)      // 0474 y, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 -) (yrel  2 -) // 0475 y, crane n
	1 images/gantryold1.pcx (xposh 8 -) (ypos) 01 (ysize) (xsizeh 8 +)  (xrelh)     (yrel  4 -) // 0476 y, crane n
	1 images/gantryold1.pcx (xposh 4 -) (ypos) 01 (ysize) (xsizeh 4 +)  (xrelh)     (yrel  6 -) // 0477 y, crane n
	1 images/gantryold1.pcx (xposh)     (ypos) 01 (ysize) (xsizeh)      (xrelh)     (yrel  8 -) // 0478 y, crane n
	1 images/gantryold1.pcx (xposh 4 +) (ypos) 01 (ysize) (xsizeh 4 -)  (xrelh)     (yrel 10 -) // 0479 y, crane n
	1 images/gantryold1.pcx (xposh 8 +) (ypos) 01 (ysize) (xsizeh 8 -)  (xrelh)     (yrel 12 -) // 047A y, crane n

	1 * 1	02 04
		00 // ID
		00 01
		\w0

// frame     : current frame of animation (0 to 81)
// a_frame   : adjusted frame number for direction change (0 to 40, 40 to 0)
// t_frame   : frame number for tile (0 to 14)

// Frames
// frame:      0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 ...
// t_frame t0: 6  7  8  9 10 11 12 13 14
//         t1:       0  1  2  3  4  5  6  7  8  9 10 11 12 13 14
//         t2:                               0  1  2  3  4  5  6  7  8  9 10 11 12 13 14
//         t3:                                                       0  1  2  3  4  5  6  7 ...

// t1 sprite offset:    0  1  2  3  4  5  6  7  8  9 10 11 12
// t1 visible:       0  1  1  1  1  1  1  1  1  1  1  1  1  1  0


	// Test variable 10 for real sprites
	1 * 1	02 04 1B // ID
		81 10 // additional information for sprite selection
		00 0F
		01
		\wx0080 04 04 // ground overlay sprites
		\wx0000 // crane sprites

// Assign register values for sprite layout
// ----------------------------------------
	// Get animation frame of south tile
	1 * 1	02 04 0A // ID
		81 41 // platform info and relative position
		24 0F // position along platform from south
		\2rst
		7B 66 // animation frame of nearby tile using position from south as parameter
		00 FF
		00 // return frame
		\wx8000

	// Calculate a_frame for reverse movement
	1 * 1	02 04 50 // ID
		81 1A // all bits on
		20 \b81 // max_frame = 81
		\2-
		7D 25 // read register for frame of south tile
		00 FF
		00 // return a_frame = max_frame - frame
		\wx8000

	// Set a_frame to frame for forward movement
	1 * 1	02 04 51 // ID
		81
		7D 25 // read register for frame of south tile
		00 FF
		00 // return a_frame = frame
		\wx8000

	// Select movement direction
	1 * 1	02 04 52 // ID
		81 7E 0A // animation frame - south tile
		20 FF
		\2sto 1A
		00 25 // store in register to prevent multiple calls to frame of nearby tile
		01
		\wx0051 \b0 \b40 // frames 0 to 40
		\wx0050 // frames 41 to max

	// Calculate t_frame {t_frame = (a_frame + 6) - (p_pos * 8)}
	1 * 1	02 04 53 // ID
		81 7E 52 // get a_frame
		20 FF
		\2+
		1A // all bits on
		20 \b6 // val + 6
		\2-
		41 // platform info, get position along platform from south
		21 78 // shift 1 and mask 4 bits to give p_pos * 8
		\2> // result = max(val1, val2)
		1A // all bits on
		20 \b0 // result is capped at min 0
		\2< // result = min(val1, val2)
		1A // all bits on
		00 \b14 // result is capped at max 14
		00 // return t_frame
		\wx8000

	// Movement sprite offset
	1 * 1	02 04 61 // ID
		81 7E 53 // get tile frame (0 to 14)
		20 FF
		\2-
		1A // all bits on
		20 \b1 // val - 1
		\2> // result = max(val1, val2)
		1A // all bits on
		20 \b0 // result is capped at min 0
		\2< // result = min(val1, val2)
		1A // all bits on
		00 \b12 // result is capped at max 12
		00 // return sprite offset
		\wx8000

	// Check for animated tile
	1 * 1	02 04 5A // ID
		81 41 // platform info and relative position
		04 0F // position along platform from south
		01
		\wx0061 00 05 // if valid animation tile
		\wx8000 // hide

	// Hide sprites
	1 * 1	02 04 63 // ID
		81 7E 53 // get tile frame (0 to 14)
		00 FF
		01
		\wx8001 \b1 \b13 // t_frame 1 to 13 - show
		\wx8000 // hide

	// Check for animated tile
	1 * 1	02 04 62 // ID
		81 41 // platform info and relative position
		04 0F // position along platform from south
		01
		\wx0063 00 05 // if valid animation tile
		\wx8000 // hide


// Selection of recolour sprite
	1 * 1	02 04 6A // ID
		85
		7F 10 // read parameter for recolour sprite base
		20 \wx7FFF
		\2+
		1A // all bits on
		00 \w3 // add offset of 1st recolour sprite
		00
		\wx8000

	1 * 1	02 04 6B // ID
		85
		7F 10 // read parameter for recolour sprite base
		20 \wx7FFF
		\2+
		1A // all bits on
		00 \w4 // add offset of 2nd recolour sprite
		00
		\wx8000

	1 * 1	02 04 6C // ID
		85
		7F 10 // read parameter for recolour sprite base
		20 \wx7FFF
		\2+
		1A // all bits on
		00 \w5 // add offset of 3rd recolour sprite
		00
		\wx8000

	// Random colours
	1 * 1	02 04 02 // ID
		80
		00 // don't re-randomise
		00 // use bits 0 and 1
		04
		\wx8000
		\wx006A
		\wx006B
		\wx006C


//@@WARNING DISABLE 100
//@@WARNING DISABLE 170

	1 * 1	02 04 15 // ID
		85
		7E 02 // get random colours
		20 \wx7FFF
		\2sto 1A
		20 \wx0012 // store in register - recolour offset
		\2rst
		7E 5A // get sprite offset
		20 \wx7FFF
		\2sto 1A
		20 \wx0005 // store in register - sprite offset
		\2rst
		7E 62 // get hide/show flag
		20 \wx7FFF
		\2sto 1A
		20 \wx0001 // store in register - show crane flag
		\2rst
		7E BE // get normal/snow/desert offset
		20 \wx7FFF
		\2+
		7E BD // add monorail/maglev offset
		20 \wx00FF
		\2sto 1A
		00 \wx0010 // store in register - ground sprite offset
		01
		\wx001B \w0 \w0
		\wx001B

//@@WARNING ENABLE 170
//@@WARNING ENABLE 100


// Callback 140 - Animation control
// --------------------------------
	1 * 1	02 04 5B // ID
		81 18 // extra callback info - reason for call
		00 FF
		02
		\wx80FE 03 03 // vehicle enters station - start
		\wx80FF 04 04 // vehicle leaves station - stop
		\wx80FD

// Callback 141 - Next animation frame
// -----------------------------------
	// Calculate new frame for reverse movement
	1 * 1	02 04 56 // ID
		81 1A // all bits on
		20 \b81 // max_frame = 81
		\2-
		4A // animation frame
		00 FF
		00 // return new_frame = max_frame - frame
		\wx8000

	// Animation frame control - determine point to reverse direction
	// {max_frame = (plat_length - 1) * 8}
	1 * 1	02 04 55 // ID
		81 41 // platform info and relative position
		30 0F // platform length
		\2< // result = min(val1, val2)
		1A // all bits on
		20 \b6 // result is capped at max 6
		\2-
		1A // all bits on
		20 \b1 // val - 1
		\2<<
		1A // all bits on
		20 \b3 // val * 8 - gives max frame for this platform length
		\2-
		4A // animation frame
		00 FF // subtract animation frame from max frame
		01
		\wx0056 00 00 // if animation frame = max frame, set new frame
		\wx80FE // continue

	1 * 1	02 04 5C // ID
		81 41 // platform info and relative position
		04 0F // position along platform from south
		01
		\wx0055 00 00 // if most southerly tile
		\wx80FE // continue

// -----------------------------------

	1 * 1	02 04 10 // ID
		85 0C // callback
		00 \wxFFFF
		03
		\wx8000 \wx0014 \wx0014 // sprite layout
		\wx005B \wx0140 \wx0140 // animation control
		\wx005C \wx0141 \wx0141 // animation frame
		\wx0015 // real sprites

	// For purchase list
	1 * 1	02 04 11 // ID
		85 0C // callback
		00 \wxFFFF
		01
		\wx8002 \wx0014 \wx0014 // sprite layout
		\wx001B // real sprites

	1 * 1	03 04
		01 GANTRY_OLD_N
		01
		FF \wx0011 // purchase
		\wx0010



	1 * 1	00 04 0B 01 GANTRY_OLD_N_NT
		08 "ISRI"

		// Sprite layout
		1A 02
			// 00 (x)
			44
			\dx00000F8D \wx0002 // ground sprite
			10 // register
			\dx8000042F \wx0040 // ground overlay sprite (child)
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx8000842D \wx0007 // crane back
			00 00 00 // x/y/z offset
			10 05 11 // x/y/z extent
			01 05 12 // registers
			\dx8000843A \wx0007 // crane front
			00 0B 00 // x/y/z offset
			10 05 11 // x/y/z extent
			01 05 12 // registers
			\dx80008447 \wx0007 // crane top
			00 00 11 // x/y/z offset
			10 10 29 // x/y/z extent
			01 05 12 // registers

			// 01 (y)
			44
			\dx00000F8D \wx0002 // ground sprite
			10 // register
			\dx80000430 \wx0040 // ground overlay sprite (child)
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx80008454 \wx0007 // crane back
			00 00 00 // x/y/z offset
			05 10 11 // x/y/z extent
			01 05 12 // registers
			\dx80008461 \wx0007 // crane front
			0B 00 00 // x/y/z offset
			05 10 11 // x/y/z extent
			01 05 12 // registers
			\dx8000846E \wx0007 // crane top
			00 00 11 // x/y/z offset
			10 10 29 // x/y/z extent
			01 05 12 // registers


		0B 06 // use callback to determine layout (2) and animation frame (4)

		0C FE // only allow 1 platform
		0D C1 // disallow platform length 1 and > 6

		11 00 // pylon placement (none)
		14 FF // wires (none)

		15 FF // prevent trains entering the tile

		16 \wx0151 // animation info 82 frames looping
		17 05      // animation speed 2^5 ticks per frame (~800ms)
		18 \wx0006 // animation triggers - cargo arrives (2), cargo removed (4)


	// Test variable 10 for real sprites
	1 * 1	02 04 1B // ID
		81 10 // additional information for sprite selection
		00 0F
		01
		\wx0080 04 04 // ground overlay sprites
		\wx0000 // crane sprites

// Assign register values for sprite layout
// ----------------------------------------

//@@WARNING DISABLE 100
//@@WARNING DISABLE 170

	1 * 1	02 04 15 // ID
		85
		7E 02 // get random colours
		20 \wx7FFF
		\2sto 1A
		20 \wx0012 // store in register - recolour offset
		\2rst
		7E 5A // get sprite offset
		20 \wx7FFF
		\2sto 1A
		20 \wx0005 // store in register - sprite offset
		\2rst
		7E 62 // get hide/show flag
		20 \wx7FFF
		\2sto 1A
		20 \wx0001 // store in register - show crane flag
		\2rst
		7E BF // get normal/snow/desert offset
		20 \wx7FFF
		\2sto 1A
		00 \wx0010 // store in register- ground sprite offset
		01
		\wx001B \w0 \w0
		\wx001B

	// Purchase
	1 * 1	02 04 16 // ID
		85
		1A // all bits on
		20 \w0 // val = 0
		\2sto 1A
		20 \wx0012 // store in register - recolour offset
		\2rst
		1A // all bits on
		20 \w6 // val = 6
		\2sto 1A
		20 \wx0005 // store in register - sprite offset
		\2rst
		1A // all bits on
		20 \w1 // val = 1
		\2sto 1A
		20 \wx0001 // store in register - show crane flag
		\2rst
		1A // all bits on
		20 \w0 // val = 0
		\2sto 1A
		00 \wx0010 // store in register - ground sprite offset
		01
		\wx001B \w0 \w0
		\wx001B

//@@WARNING ENABLE 170
//@@WARNING ENABLE 100


// Callback 140 - Animation control
// --------------------------------
	1 * 1	02 04 5B // ID
		81 18 // extra callback info - reason for call
		00 FF
		02
		\wx80FE 01 01 // cargo arrives - start
		\wx80FF 02 02 // cargo completely taken - stop
		\wx80FD // do nothing

// --------------------------------

	1 * 1	02 04 10 // ID
		85 0C // callback
		00 \wxFFFF
		03
		\wx8000 \wx0014 \wx0014 // sprite layout
		\wx005B \wx0140 \wx0140 // animation control
		\wx005C \wx0141 \wx0141 // animation frame
		\wx0015 // real sprites

	// For purchase list
	1 * 1	02 04 11 // ID
		85 0C // callback
		00 \wxFFFF
		01
		\wx8000 \wx0014 \wx0014 // sprite layout
		\wx0016 // real sprites

	1 * 1	03 04
		01 GANTRY_OLD_N_NT
		01
		FF \wx0011 // purchase
		\wx0010


	1 * 1	00 04 0A 01 GANTRY_OLD_S
		08 "ISRI"
		0A GANTRY_OLD_N // copy sprite layout

		0B 06 // use callback to determine layout (2) and animation frame (4)

		0C FE // only allow 1 platform
		0D C1 // disallow platform length 1 and > 6

		14 FF // wires (none)
		11 00 // pylon placement (none)

		16 \wx0151 // animation info 82 frames looping
		17 05      // animation speed 2^5 ticks per frame (~800ms)
		18 \wx0018 // animation triggers - train enters (0x08), train leaves (0x10)


	1 * 1	01 04 01 4E
//@@LET xpos = 3
//@@LET ypos = 4
//@@LET xsize = 23
//@@LET ysize = 19
//@@LET xrel = -21
//@@LET yrel = -3
//@@LET xsizeh = 11
//@@LET xsizeh1 = (xsize xsizeh -)
//@@LET xposh = (xpos xsizeh1 +)
//@@LET xrelh = (xrel xposh + xpos - 16 -)

	1 images/gantryold1.pcx (xposh 8 +) (ypos) 01 (ysize) (xsizeh 8 -)  (xrelh)     (yrel 12 +) // 042D x, back
	1 images/gantryold1.pcx (xposh 4 +) (ypos) 01 (ysize) (xsizeh 4 -)  (xrelh)     (yrel 10 +) // 042E x, back
	1 images/gantryold1.pcx (xposh)     (ypos) 01 (ysize) (xsizeh)      (xrelh)     (yrel  8 +) // 042F x, back
	1 images/gantryold1.pcx (xposh 4 -) (ypos) 01 (ysize) (xsizeh 4 +)  (xrelh)     (yrel  6 +) // 0430 x, back
	1 images/gantryold1.pcx (xposh 8 -) (ypos) 01 (ysize) (xsizeh 8 +)  (xrelh)     (yrel  4 +) // 0431 x, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 -) (yrel  2 +) // 0432 x, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel)      (yrel)      // 0433 x, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 +) (yrel  2 -) // 0434 x, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 +) (xrel  8 +) (yrel  4 -) // 0435 x, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 +) (xrel 12 +) (yrel  6 -) // 0436 x, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1)     (xrel 16 +) (yrel  8 -) // 0437 x, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 -) (xrel 20 +) (yrel 10 -) // 0438 x, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 -) (xrel 24 +) (yrel 12 -) // 0439 x, back

//@@LET xpos = 57
//@@LET ypos = 4
//@@LET xsize = 25
//@@LET ysize = 26
//@@LET xrel = -23
//@@LET yrel = -11
//@@LET xsizeh = 11
//@@LET xsizeh1 = (xsize xsizeh -)
//@@LET xposh = (xpos xsizeh1 +)
//@@LET xrelh = (xrel xposh + xpos - 16 -)

	1 images/gantryold1.pcx (xposh 8 +) (ypos) 01 (ysize) (xsizeh 8 -)  (xrelh)     (yrel 12 +) // 043A x, front
	1 images/gantryold1.pcx (xposh 4 +) (ypos) 01 (ysize) (xsizeh 4 -)  (xrelh)     (yrel 10 +) // 043B x, front
	1 images/gantryold1.pcx (xposh)     (ypos) 01 (ysize) (xsizeh)      (xrelh)     (yrel  8 +) // 043C x, front
	1 images/gantryold1.pcx (xposh 4 -) (ypos) 01 (ysize) (xsizeh 4 +)  (xrelh)     (yrel  6 +) // 043D x, front
	1 images/gantryold1.pcx (xposh 8 -) (ypos) 01 (ysize) (xsizeh 8 +)  (xrelh)     (yrel  4 +) // 043E x, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 -) (yrel  2 +) // 043F x, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel)      (yrel)      // 0440 x, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 +) (yrel  2 -) // 0441 x, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 +) (xrel  8 +) (yrel  4 -) // 0442 x, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 +) (xrel 12 +) (yrel  6 -) // 0443 x, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1)     (xrel 16 +) (yrel  8 -) // 0444 x, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 -) (xrel 20 +) (yrel 10 -) // 0445 x, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 -) (xrel 24 +) (yrel 12 -) // 0446 x, front

//@@LET xpos = 134
//@@LET ypos = 4
//@@LET xsize = 52
//@@LET ysize = 46
//@@LET xrel = -17
//@@LET yrel = -22
//@@LET xsizeh = 23
//@@LET xsizeh1 = (xsize xsizeh -)
//@@LET xposh = (xpos xsizeh1 +)
//@@LET xrelh = (xrel xposh + xpos - 16 -)

	1 images/gantryold1.pcx (xposh 8 +) (ypos) 01 (ysize) (xsizeh 8 -)  (xrelh)     (yrel 12 +) // 0447 x, crane n
	1 images/gantryold1.pcx (xposh 4 +) (ypos) 01 (ysize) (xsizeh 4 -)  (xrelh)     (yrel 10 +) // 0448 x, crane n
	1 images/gantryold1.pcx (xposh)     (ypos) 01 (ysize) (xsizeh)      (xrelh)     (yrel  8 +) // 0449 x, crane n
	1 images/gantryold1.pcx (xposh 4 -) (ypos) 01 (ysize) (xsizeh 4 +)  (xrelh)     (yrel  6 +) // 044A x, crane n
	1 images/gantryold1.pcx (xposh 8 -) (ypos) 01 (ysize) (xsizeh 8 +)  (xrelh)     (yrel  4 +) // 044B x, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 -) (yrel  2 +) // 044C x, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel)      (yrel)      // 044D x, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 +) (yrel  2 -) // 044E x, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 +) (xrel  8 +) (yrel  4 -) // 044F x, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 +) (xrel 12 +) (yrel  6 -) // 0450 x, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1)     (xrel 16 +) (yrel  8 -) // 0451 x, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 -) (xrel 20 +) (yrel 10 -) // 0452 x, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 -) (xrel 24 +) (yrel 12 -) // 0453 x, crane n

//@@LET xpos = 189
//@@LET ypos = 4
//@@LET xsize = 23
//@@LET ysize = 19
//@@LET xrel = 0
//@@LET yrel = -3
//@@LET xsizeh = 11
//@@LET xsizeh1 = (xsize xsizeh -)
//@@LET xposh = (xpos xsizeh1 +)
//@@LET xrelh = (xrel xposh + xpos - 16 -)

	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 -) (xrel 24 +) (yrel 12 +) // 0454 y, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 -) (xrel 20 +) (yrel 10 +) // 0455 y, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1)     (xrel 16 +) (yrel  8 +) // 0456 y, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 +) (xrel 12 +) (yrel  6 +) // 0457 y, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 +) (xrel  8 +) (yrel  4 +) // 0458 y, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 +) (yrel  2 +) // 0459 y, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel)      (yrel)      // 045A y, back
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 -) (yrel  2 -) // 045B y, back
	1 images/gantryold1.pcx (xposh 8 -) (ypos) 01 (ysize) (xsizeh 8 +)  (xrelh)     (yrel  4 -) // 045C y, back
	1 images/gantryold1.pcx (xposh 4 -) (ypos) 01 (ysize) (xsizeh 4 +)  (xrelh)     (yrel  6 -) // 045D y, back
	1 images/gantryold1.pcx (xposh)     (ypos) 01 (ysize) (xsizeh)      (xrelh)     (yrel  8 -) // 045E y, back
	1 images/gantryold1.pcx (xposh 4 +) (ypos) 01 (ysize) (xsizeh 4 -)  (xrelh)     (yrel 10 -) // 045F y, back
	1 images/gantryold1.pcx (xposh 8 +) (ypos) 01 (ysize) (xsizeh 8 -)  (xrelh)     (yrel 12 -) // 0460 y, back

//@@LET xpos = 243
//@@LET ypos = 4
//@@LET xsize = 25
//@@LET ysize = 26
//@@LET xrel = 0
//@@LET yrel = -11
//@@LET xsizeh = 11
//@@LET xsizeh1 = (xsize xsizeh -)
//@@LET xposh = (xpos xsizeh1 +)
//@@LET xrelh = (xrel xposh + xpos - 16 -)

	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 -) (xrel 24 +) (yrel 12 +) // 0461 y, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 -) (xrel 20 +) (yrel 10 +) // 0462 y, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1)     (xrel 16 +) (yrel  8 +) // 0463 y, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 +) (xrel 12 +) (yrel  6 +) // 0464 y, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 +) (xrel  8 +) (yrel  4 +) // 0465 y, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 +) (yrel  2 +) // 0466 y, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel)      (yrel)      // 0467 y, front
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 -) (yrel  2 -) // 0468 y, front
	1 images/gantryold1.pcx (xposh 8 -) (ypos) 01 (ysize) (xsizeh 8 +)  (xrelh)     (yrel  4 -) // 0469 y, front
	1 images/gantryold1.pcx (xposh 4 -) (ypos) 01 (ysize) (xsizeh 4 +)  (xrelh)     (yrel  6 -) // 046A y, front
	1 images/gantryold1.pcx (xposh)     (ypos) 01 (ysize) (xsizeh)      (xrelh)     (yrel  8 -) // 046B y, front
	1 images/gantryold1.pcx (xposh 4 +) (ypos) 01 (ysize) (xsizeh 4 -)  (xrelh)     (yrel 10 -) // 046C y, front
	1 images/gantryold1.pcx (xposh 8 +) (ypos) 01 (ysize) (xsizeh 8 -)  (xrelh)     (yrel 12 -) // 046D y, front

//@@LET xpos = 318
//@@LET ypos = 4
//@@LET xsize = 52
//@@LET ysize = 46
//@@LET xrel = -33
//@@LET yrel = -22
//@@LET xsizeh = 29
//@@LET xsizeh1 = (xsize xsizeh -)
//@@LET xposh = (xpos xsizeh1 +)
//@@LET xrelh = (xrel xposh + xpos - 16 -)

	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 -) (xrel 24 +) (yrel 12 +) // 046E y, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 -) (xrel 20 +) (yrel 10 +) // 046F y, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1)     (xrel 16 +) (yrel  8 +) // 0470 y, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 4 +) (xrel 12 +) (yrel  6 +) // 0471 y, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsizeh1 8 +) (xrel  8 +) (yrel  4 +) // 0472 y, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 +) (yrel  2 +) // 0473 y, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel)      (yrel)      // 0474 y, crane n
	1 images/gantryold1.pcx (xpos)      (ypos) 01 (ysize) (xsize)       (xrel  4 -) (yrel  2 -) // 0475 y, crane n
	1 images/gantryold1.pcx (xposh 8 -) (ypos) 01 (ysize) (xsizeh 8 +)  (xrelh)     (yrel  4 -) // 0476 y, crane n
	1 images/gantryold1.pcx (xposh 4 -) (ypos) 01 (ysize) (xsizeh 4 +)  (xrelh)     (yrel  6 -) // 0477 y, crane n
	1 images/gantryold1.pcx (xposh)     (ypos) 01 (ysize) (xsizeh)      (xrelh)     (yrel  8 -) // 0478 y, crane n
	1 images/gantryold1.pcx (xposh 4 +) (ypos) 01 (ysize) (xsizeh 4 -)  (xrelh)     (yrel 10 -) // 0479 y, crane n
	1 images/gantryold1.pcx (xposh 8 +) (ypos) 01 (ysize) (xsizeh 8 -)  (xrelh)     (yrel 12 -) // 047A y, crane n

	1 * 1	02 04
		00 // ID
		00 01
		\w0


	// Test variable 10 for real sprites
	1 * 1	02 04 1B // ID
		81 10 // additional information for sprite selection
		00 0F
		01
		\wx0080 04 04 // ground overlay sprites
		\wx0000 // crane sprites

// Assign register values for sprite layout
// ----------------------------------------

//@@WARNING DISABLE 100
//@@WARNING DISABLE 170

	1 * 1	02 04 15 // ID
		85
		7E 02 // get random colours
		20 \wx7FFF
		\2sto 1A
		20 \wx0012 // store in register - recolour offset
		\2rst
		7E 5A // get sprite offset
		20 \wx7FFF
		\2sto 1A
		20 \wx0005 // store in register - sprite offset
		\2rst
		7E 62 // get hide/show flag
		20 \wx7FFF
		\2sto 1A
		20 \wx0001 // store in register - show crane flag
		\2rst
		7E BE // get normal/snow/desert offset
		20 \wx7FFF
		\2+
		7E BD // add monorail/maglev offset
		20 \wx00FF
		\2sto 1A
		00 \wx0010 // store in register - ground sprite offset
		01
		\wx001B \w0 \w0
		\wx001B

//@@WARNING ENABLE 170
//@@WARNING ENABLE 100


// Callback 140 - Animation control
// --------------------------------
	1 * 1	02 04 5B // ID
		81 18 // extra callback info - reason for call
		00 FF
		02
		\wx80FE 03 03 // vehicle enters station - start
		\wx80FF 04 04 // vehicle leaves station - stop
		\wx80FD

// --------------------------------


	1 * 1	02 04 10 // ID
		85 0C // callback
		00 \wxFFFF
		03
		\wx8000 \wx0014 \wx0014 // sprite layout
		\wx005B \wx0140 \wx0140 // animation control
		\wx005C \wx0141 \wx0141 // animation frame
		\wx0015 // real sprites

	// For purchase list
	1 * 1	02 04 11 // ID
		85 0C // callback
		00 \wxFFFF
		01
		\wx8002 \wx0014 \wx0014 // sprite layout
		\wx001B // real sprites

	1 * 1	03 04
		01 GANTRY_OLD_S
		01
		FF \wx0011 // purchase
		\wx0010


	1 * 1	00 04 0B 01 GANTRY_OLD_S_NT
		08 "ISRI"
		0A GANTRY_OLD_N_NT // copy sprite layout

		0B 06 // use callback to determine layout (2) and animation frame (4)

		0C FE // only allow 1 platform
		0D C1 // disallow platform length 1 and > 6

		11 00 // pylon placement (none)
		14 FF // wires (none)

		15 FF // prevent trains entering the tile

		16 \wx0151 // animation info 82 frames looping
		17 05      // animation speed 2^5 ticks per frame (~800ms)
		18 \wx0006 // animation triggers - cargo arrives (2), cargo removed (4)


	// Test variable 10 for real sprites
	1 * 1	02 04 1B // ID
		81 10 // additional information for sprite selection
		00 0F
		01
		\wx0080 04 04 // if variable 10 = 4 - get ground overlay sprites
		\wx0000 // else

// Assign register values for sprite layout
// ----------------------------------------

//@@WARNING DISABLE 100
//@@WARNING DISABLE 170

	1 * 1	02 04 15 // ID
		85
		7E 02 // get random colours
		20 \wx7FFF
		\2sto 1A
		20 \wx0012 // store in register - recolour offset
		\2rst
		7E 5A // get sprite offset
		20 \wx7FFF
		\2sto 1A
		20 \wx0005 // store in register - sprite offset
		\2rst
		7E 62 // get hide/show flag
		20 \wx7FFF
		\2sto 1A
		20 \wx0001 // store in register - show crane flag
		\2rst
		7E BF // get normal/snow/desert offset
		20 \wx7FFF
		\2sto 1A
		00 \wx0010 // store in register - ground sprite offset
		01
		\wx001B \w0 \w0
		\wx001B

	// Purchase
	1 * 1	02 04 16 // ID
		85
		1A // all bits on
		20 \w0 // val = 0
		\2sto 1A
		20 \wx0012 // store in register - recolour offset
		\2rst
		1A // all bits on
		20 \w6 // val = 6
		\2sto 1A
		20 \wx0005 // store in register - sprite offset
		\2rst
		1A // all bits on
		20 \w1 // val = 1
		\2sto 1A
		20 \wx0001 // store in register - show crane flag
		\2rst
		1A // all bits on
		20 \w0 // val = 0
		\2sto 1A
		00 \wx0010 // store in register - ground sprite offset
		01
		\wx001B \w0 \w0
		\wx001B

//@@WARNING ENABLE 170
//@@WARNING ENABLE 100


// Callback 140 - Animation control
// --------------------------------
	1 * 1	02 04 5B // ID
		81 18 // extra callback info - reason for call
		00 FF
		02
		\wx80FE 01 01 // cargo arrives - start
		\wx80FF 02 02 // cargo completely taken - stop
		\wx80FD // do nothing

// --------------------------------


	1 * 1	02 04 10 // ID
		85 0C // callback
		00 \wxFFFF
		03
		\wx8000 \wx0014 \wx0014 // sprite layout
		\wx005B \wx0140 \wx0140 // animation control
		\wx005C \wx0141 \wx0141 // animation frame
		\wx0015 // real sprites

	// For purchase list
	1 * 1	02 04 11 // ID
		85 0C // callback
		00 \wxFFFF
		01
		\wx8000 \wx0014 \wx0014 // sprite layout
		\wx0016 // real sprites

	1 * 1	03 04
		01 GANTRY_OLD_S_NT
		01
		FF \wx0011 // purchase
		\wx0010
