	1 * 1	00 04 06 01 FRUIT_STAT
		08 "ISRA"

		// Sprite layout
		1A 0A
			// 00 (x) - fruit platforms
			43
			\dx000003F4 \wx0002 // ground sprite - track
			10 // register
			\dx8000042D \wx0040 // ground overlay (child) - platforms
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx8000842D \wx0006 // fruit back
			00 00 00 // x/y/z offset
			10 03 0A // x/y/z extent
			11 13 // register
			\dx8000842D \wx0006 // fruit front
			00 0D 00 // x/y/z offset
			10 03 0A // x/y/z extent
			12 13 // register

			// 01 (y) - fruit platforms
			43
			\dx000003F3 \wx0002 // ground sprite - track
			10 // register
			\dx8000042E \wx0040 // ground overlay (child) - platforms
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx80008431 \wx0006 // fruit back
			00 00 00 // x/y/z offset
			03 10 0A // x/y/z extent
			11 13 // register
			\dx80008431 \wx0006 // fruit front
			0D 00 00 // x/y/z offset
			03 10 0A // x/y/z extent
			12 13 // register

			// 02 (x) - office
			43
			\dx000003F4 \wx0002 // ground sprite - track
			10 // register
			\dx8000042D \wx0040 // ground overlay (child) - platforms
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx80000443 \wx0000 // office
			00 00 00 // x/y/z offset
			10 05 0E // x/y/z extent
			\dx80000455 \wx0001 // snow
			00 00 80 // x/y/z offset
			02 // register

			// 03 (y) - office
			43
			\dx000003F3 \wx0002 // ground sprite - track
			10 // register
			\dx8000042E \wx0040 // ground overlay (child) - platforms
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx80000444 \wx0000 // office
			00 00 00 // x/y/z offset
			05 10 0E // x/y/z extent
			\dx80000456 \wx0001 // snow
			00 00 80 // x/y/z offset
			02 // register

			// 04 (x) - office 2 or empty platform
			44
			\dx000003F4 \wx0002 // ground sprite - track
			10 // register
			\dx8000042D \wx0040 // ground overlay (child) - platforms
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx8000043D \wx0001 // office
			00 00 00 // x/y/z offset
			10 05 0E // x/y/z extent
			04 // register
			\dx8000044F \wx0001 // snow
			00 00 80 // x/y/z offset
			02 // register
			\dx8000842D \wx0047 // fruit front
			00 0D 00 // x/y/z offset
			10 03 0A // x/y/z extent
			04 12 13 // register
			05 // value for variable 10

			// 05 (y) - office 2 or empty platform
			44
			\dx000003F3 \wx0002 // ground sprite - track
			10 // register
			\dx8000042E \wx0040 // ground overlay (child) - platforms
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx8000043E \wx0001 // office
			00 00 00 // x/y/z offset
			05 10 0E // x/y/z extent
			04 // register
			\dx80000450 \wx0001 // snow
			00 00 80 // x/y/z offset
			02 // register
			\dx80008431 \wx0047 // fruit front
			0D 00 00 // x/y/z offset
			03 10 0A // x/y/z extent
			04 12 13 // register
			05 // value for variable 10

			// 06 (x) - forklift platform
			43
			\dx000003F4 \wx0002 // ground sprite - track
			10 // register
			\dx8000042D \wx0040 // ground overlay (child) - platforms
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx8000842D \wx0002 // forklift
			05 01 00 // x/y/z offset
			06 02 09 // x/y/z extent
			08 // register
			\dx80000433 \wx0003 // cargo
			0A 01 80 // x/y/z offset
			03 06 // registers

			// 07 (y) - forklift platform
			43
			\dx000003F3 \wx0002 // ground sprite - track
			10 // register
			\dx8000042E \wx0040 // ground overlay (child) - platforms
			00 00 80 // x/y/z offset
			04 // value for variable 10
			\dx8000842F \wx0002 // forklift
			01 05 00 // x/y/z offset
			02 06 09 // x/y/z extent
			08 // register
			\dx80000434 \wx0003 // cargo
			00 01 80 // x/y/z offset
			03 06 // registers

			// 08 (x) Purchase
			41
			\dx000003F4 \wx0000 // ground sprite - track
			\dx8000842D \wx0000
			00 00 00 // x/y/z offset
			10 10 20 // x/y/z extent

			// 09 (y) Purchase
			41
			\dx000003F3 \wx0000 // ground sprite - track
			\dx8000842E \wx0000
			00 00 00 // x/y/z offset
			10 10 20 // x/y/z extent


		0B 02 // use callback for sprite layout

		10 \w600 // set little/lots threshold
		12 \dx00002000 // cargo types for randomisation triggers

		11 FF // pylon placement (all)


	// Purchase list
	1 * 1	01 04 01 02
	1 images/purchaseicons.pcx   19  667  01  49  64 -31 -18 // 042D x
	1 images/purchaseicons.pcx   91  667  01  49  64 -31 -18 // 042E y

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


// Real sprites
// ------------
	// Test variable 10 for real sprites - fruit platform
	1 * 1	02 04 1B // ID
		81 10 // additional information for sprite selection
		00 0F
		01
		\wx00FD 04 04 // ground overlay sprites
		\wx00E2 // fruit sprites

	// Test variable 10 for real sprites - fruit platform - empty
	1 * 1	02 04 1C // ID
		81 10 // additional information for sprite selection
		00 0F
		01
		\wx00FD 04 04 // ground overlay sprites
		\wx00E1 // fruit sprites - empty

	// Test variable 10 for real sprites - office
	1 * 1	02 04 17 // ID
		81 10 // additional information for sprite selection
		00 0F
		01
		\wx00FD 04 04 // ground overlay sprites
		\wx00EE // office sprites

	// Test variable 10 for real sprites - office 2 with fruit
	1 * 1	02 04 18 // ID
		81 10 // additional information for sprite selection
		00 0F
		02
		\wx00FD 04 04 // ground overlay sprites
		\wx00E2 05 05 // fruit sprites
		\wx00EE // office sprites

	// Test variable 10 for real sprites - office 2 with fruit - empty
	1 * 1	02 04 19 // ID
		81 10 // additional information for sprite selection
		00 0F
		02
		\wx00FD 04 04 // ground overlay sprites
		\wx00E1 05 05 // fruit sprites - empty
		\wx00EE // office sprites

	// Test variable 10 for real sprites - forklift
	1 * 1	02 04 1A // ID
		81 10 // additional information for sprite selection
		00 0F
		01
		\wx00FD 04 04 // ground overlay sprites
		\wx00D1 // forklift sprites


// Fruit platforms
	// Select fruit variety back
	1 * 1	02 04 40 // ID
		80
		00 // no more cargo (triggered by random in graphics chain)
		10 // use bits 16 and 17
		04
		\wx8003
		\wx8000
		\wx8001
		\wx8002

	// Select fruit variety front
	1 * 1	02 04 41 // ID
		80
		00 // no more cargo (triggered by random in graphics chain)
		10 // use bits 16 and 17
		04
		\wx8000
		\wx8001
		\wx8002
		\wx8003

	// Recolour sprite for beans
	1 * 1	02 04 48 // ID
		85
		7F 10 // read parameter for recolour sprite base
		20 \wx7FFF
		\2+
		1A // all bits on
		00 \w15 // add offset of recolour sprite for beans
		00
		\w0

	// Return recolour sprite for cargo id in register 20
	1 * 1	02 04 47 // ID
		81
		7D 20 // read register 20 for this cargo type
		00 FF
		01
		\wx0048 39 39 // beans
		\wx8000

// Forklift
	// Random cargo thresholds
	1 * 1	02 04 42 // ID
		80
		00 // no more cargo (triggered by random in graphics chain)
		12 // use bits 18 and 19
		04
		\wx8000
		\wx8019
		\wx8032
		\wx804B

	// Cargo show/hide
	1 * 1	02 04 43 // ID
		85
		7D 20 // read register 20 for this cargo type
		20 \wxFFFF
		\2rst
		7B 60 // get amount of cargo waiting
		20 \wxFFFF
		\2+
		7E 42 // add random value
		00 \wx00FF
		01
		\wx8000 \w0 \w100 // hide cargo
		\wx8001 // show cargo

	// Random forklift variety
	1 * 1	02 04 44 // ID
		80
		00 // don't re-randomise
		10 // use bit 16
		02
		\wx8000
		\wx8001

	// Random forklift crate variety
	1 * 1	02 04 45 // ID
		80
		00 // don't re-randomise
		11 // use bit 17
		02
		\wx8000
		\wx8002

// Office
	// Office 2 - platform 0 only
	1 * 1	02 04 46 // ID
		81 41 // platform info and position
		08 0F // platform number
		01
		\wx8001 00 00
		\wx8000

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

	// Fruit platform
	1 * 1	02 04 21 // ID
		85
		7E 47 // get recolour sprite for this cargo
		20 \wx7FFF
		\2sto 1A
		20 \wx0013 // store in register - recolour sprite
		\2rst
		7E 40 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0011 // store in register
		\2rst
		7E 41 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0012 // store in register
		\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
		01
		\wx001B \w0 \w0
		\wx001B

	// Fruit platform - empty
	1 * 1	02 04 26 // ID
		85
		1A // all bits on
		20 \w0 // val = 0
		\2sto 1A
		20 \wx0013 // store in register - recolour sprite
		\2sto 1A
		20 \wx0011 // store in register - fruit variety offset
		\2sto 1A
		20 \wx0012 // store in register - fruit variety offset
		\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
		01
		\wx001C \w0 \w0
		\wx001C

	// Office
	1 * 1	02 04 22 // ID
		85
		7E BB // get snow overlay flag
		20 \wx00FF
		\2sto 1A
		20 \wx0002 // store in register
		\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
		01
		\wx0017 \w0 \w0
		\wx0017

	// Office 2 or empty platform
	1 * 1	02 04 23 // ID
		85
		7E 47 // get recolour sprite for this cargo
		20 \wx7FFF
		\2sto 1A
		20 \wx0013 // store in register - recolour sprite
		\2rst
		7E 41 // get random fruit variety offset
		20 \wx00FF
		\2sto 1A
		20 \wx0012 // store in register
		\2rst
		7E 46 // get office 2 visibility
		20 \wx00FF
		\2sto 1A
		20 \wx0004 // store in register
		\2rst
		7E BB // get snow overlay flag
		20 \wx00FF
		\2sto 1A
		20 \wx0002 // store in register
		\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
		01
		\wx0018 \w0 \w0
		\wx0018

	// Office 2 or empty platform - empty
	1 * 1	02 04 27 // ID
		85
		1A // all bits on
		20 \w0 // val = 0
		\2sto 1A
		20 \wx0013 // store in register - recolour sprite
		\2sto 1A
		20 \wx0012 // store in register - fruit variety offset
		\2rst
		7E 46 // get office 2 visibility
		20 \wx00FF
		\2sto 1A
		20 \wx0004 // store in register
		\2rst
		7E BB // get snow overlay flag
		20 \wx00FF
		\2sto 1A
		20 \wx0002 // store in register
		\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
		01
		\wx0019 \w0 \w0
		\wx0019

	// Forklift
	1 * 1	02 04 24 // ID
		85
		7E 44 // get random offset for forklift
		20 \wx00FF
		\2sto 1A
		20 \wx0008 // store in register
		\2rst
		7E 45 // get random offset for crate
		20 \wx00FF
		\2sto 1A
		20 \wx0006 // store in register
		\2rst
		7E 43 // get show/hide flag for crate
		20 \wx00FF
		\2sto 1A
		20 \wx0003 // store in register
		\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
		01
		\wx001A \w0 \w0
		\wx001A

	// Forklift - no suitable cargo
	1 * 1	02 04 25 // ID
		85
		7E 44 // get random offset for forklift
		20 \wx00FF
		\2sto 1A
		20 \wx0008 // store in register
		\2rst 1A
		20 \w0 // always hide fruit
		\2sto 1A
		20 \wx0006 // store in register
		\2sto 1A
		20 \wx0003 // store in register
		\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
		01
		\wx001A \w0 \w0
		\wx001A

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

	// Fruit or beans
	1 * 1	02 04 20 // ID
		81 68 00 // station info param 0/0; check this tile
		0A 0F
		03
		\wx0021 01 01 // part 00/01 - fruit platforms
		\wx0022 05 05 // part 02/03 - office
		\wx0023 09 09 // part 04/05 - office2 (or empty platform)
		\wx0024 // part 06/07 - forklift

	// No suitable cargo
	1 * 1	02 04 1F // ID
		81 68 00 // station info param 0/0; check this tile
		0A 0F
		03
		\wx0026 01 01 // part 00/01 - fruit platforms
		\wx0022 05 05 // part 02/03 - office
		\wx0027 09 09 // part 04/05 - office2 (or empty platform)
		\wx0025 // part 06/07 - forklift


// Callback 14
// -----------
	1 * 1	02 04 10 // ID
		81 68 00 // station info param 0/0; check this tile
		0A 0F
		03
		\wx8000 01 01 // part 00/01 - fruit platforms
		\wx8002 05 05 // part 02/03 - office
		\wx8004 09 09 // part 04/05 - office2 (or empty platform)
		\wx8006 // part 06/07 - forklift


// Callback 24
// -----------
	// Platform 0
	1 * 1	02 04 31 // ID
		81 10 // platform info and relative position
		00 07 // position along platform from N mod 8
		03
		\wx8002 01 01 // office
		\wx8004 02 02 // office2 (or empty platform)
		\wx8006 03 03 // forklift
		\wx8000 // fruit platforms

	// Platform 1
	1 * 1	02 04 32 // ID
		81 10 // platform info and relative position
		00 07 // position along platform from N mod 8
		03
		\wx8004 00 00 // office2 (or empty platform)
		\wx8004 06 06 // office2 (or empty platform)
		\wx8006 05 05 // forklift
		\wx8000 // fruit platforms

	// Platform 2
	1 * 1	02 04 33 // ID
		81 10 // platform info and relative position
		00 07 // position along platform from N mod 8
		04
		\wx8004 00 00 // office2 (or empty platform)
		\wx8002 02 02 // office
		\wx8004 03 03 // office2 (or empty platform)
		\wx8006 07 07 // forklift
		\wx8000 // fruit platforms

	// Platform 3
	1 * 1	02 04 34 // ID
		81 10 // platform info and relative position
		00 07 // position along platform from N mod 8
		03
		\wx8006 02 02 // forklift
		\wx8002 05 05 // office
		\wx8004 06 06 // office2 (or empty platform)
		\wx8000 // fruit platforms

	1 * 1	02 04 35 // ID
		81 10 // platform info and relative position
		08 03 // platform number from N mod 4
		03
		\wx0031 00 00
		\wx0032 01 01
		\wx0033 02 02
		\wx0034

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

	// Fruit
	1 * 1	02 04 07 // ID
		85
		1A // all bits on
		20 \wx000D // cargo id for fruit
		\2sto 1A
		20 \wx0020 // store in register
		\2rst
		0C // callback
		00 \wxFFFF
		01
		\wx0010 \wx0014 \wx0014 // sprite layout
		\wx0020 // real sprites

	// Fruit (and veg)
	1 * 1	02 04 06 // ID
		85
		1A // all bits on
		20 \wx002E // cargo id for fruit (and veg)
		\2sto 1A
		20 \wx0020 // store in register
		\2rst
		0C // callback
		00 \wxFFFF
		01
		\wx0010 \wx0014 \wx0014 // sprite layout
		\wx0020 // real sprites

	// Beans
	1 * 1	02 04 0A // ID
		85
		1A // all bits on
		20 \wx0039 // cargo id for beans
		\2sto 1A
		20 \wx0020 // store in register
		\2rst
		0C // callback
		00 \wxFFFF
		01
		\wx0010 \wx0014 \wx0014 // sprite layout
		\wx0020 // real sprites

	// Purchase
	1 * 1	02 04 08 // ID
		81 0C // callback
		00 FF
		02
		\wx8008 14 14 // sprite layout
		\wx0035 24 24 // station layout
		\wx0002 // real sprites

//@@WARNING DISABLE 113

	// Random action 2 outside callback triggers re-randomisation
	1 * 1	02 04 0B // ID
		80
		02 // no more cargo
		10 // trigger bits 16 to 19
		10
		\wx001F
		\wx001F
		\wx001F
		\wx001F
		\wx001F
		\wx001F
		\wx001F
		\wx001F
		\wx001F
		\wx001F
		\wx001F
		\wx001F
		\wx001F
		\wx001F
		\wx001F
		\wx001F

	// Forklifts
	// Random action 2 outside callback triggers re-randomisation
	1 * 1	02 04 0C // ID
		80
		02 // no more cargo
		11 // trigger bits 17 to 19
		08
		\wx001F
		\wx001F
		\wx001F
		\wx001F
		\wx001F
		\wx001F
		\wx001F
		\wx001F

//@@WARNING ENABLE 113

	// Only re-randomise bits 17 to 19 for forklift
	1 * 1	02 04 0D // ID
		81 68 00 // station info param 0/0 - check this tile
		0A 0F
		03
		\wx000B 01 01 // part 00/01 - fruit platforms
		\wx001F 05 05 // part 02/03 - office
		\wx000B 09 09 // part 04/05 - office2 (or empty platform)
		\wx000C // part 06/07 - forklift

	// No suitable cargo
	1 * 1	02 04 09 // ID
		81 0C // callback
		00 FF
		01
		\wx0010 14 14 // sprite layout
		\wx000D // real sprites

	1 * 1	03 04
		01 FRUIT_STAT
		04
		0D \wx0007 // fruit
		2E \wx0006 // fruit (and veg)
		39 \wx000A // beans
		FF \wx0008 // purchase
		\wx0009 // no suitable cargo
