	1 * 1	00 04 07 01 ROAD
		08 "ISRI"

		// Sprite layout
		1A 02
			// 00 (x)
			41
			\dx00000F8D \wx0002 // ground sprite
			10 // register
			\dx8000042D \wx0002 // ground overlay sprite (child)
			00 00 80 // x/y/z offset
			11 // register

			// 01 (y)
			41
			\dx00000F8D \wx0002 // ground sprite
			10 // register
			\dx8000042E \wx0002 // ground overlay sprite (child)
			00 00 80 // x/y/z offset
			11 // register

		0B 02 // use callback to determine layout

		0C FE // only allow a width of 1

		11 00 // no pylons
		14 FF // no wires

		15 FF // prevent trains entering the tile from any direction


	// Offset for crossing differs depending on orientation
	1 * 1	02 04 33 // ID
		81 41 // platform info and position
		18 01 // shift 24 and mask bit 0 for tile orientation
		01
		\wx8005 01 01 // y orientation
		\wx8006 // x orientation

	// For tiles with perpendicular road to S; check if tile to N is a perpendicular road
	1 * 1	02 04 30 // ID
		85 68 F0 // station info parameter -1/0; check tile to N
		00 \wx0FFF // mask 12 bits for tile ID, type and dir.
		05
		\wx0033 ROAD 0D ROAD 0D // cross-roads
		\wx0033 ROAD_FENCED 0D ROAD_FENCED 0D // cross-roads
		\wx0033 ROAD_CROSSING 05 ROAD_CROSSING 05 // cross-roads
		\wx0033 ROAD_ENTRY_N 0D ROAD_ENTRY_N 0D // cross-roads
		\wx0033 RV_ACCESS_N 0D RV_ACCESS_N 0D // cross-roads
		\wx8004 // t-junction S

	// For tiles with no perpendicular road to S; check if tile to N is a perpendicular road
	1 * 1	02 04 31 // ID
		85 68 F0 // station info parameter -1/0; check tile to N
		00 \wx0FFF // mask 12 bits for tile ID, type and dir.
		05
		\wx8002 ROAD 0D ROAD 0D // t-junction N
		\wx8002 ROAD_FENCED 0D ROAD_FENCED 0D // t-junction N
		\wx8002 ROAD_CROSSING 05 ROAD_CROSSING 05 // t-junction N
		\wx8002 ROAD_ENTRY_N 0D ROAD_ENTRY_N 0D // t-junction N
		\wx8002 RV_ACCESS_N 0D RV_ACCESS_N 0D // t-junction N
		\wx8000 // straight road

	// For all tiles; check if tile to S is a perpendicular road
	1 * 1	02 04 32 // ID
		85 68 10 // station info parameter +1/0; check tile to S
		00 \wx0FFF // mask 12 bits for tile ID, type and direction
		05
		\wx0030 ROAD 0D ROAD 0D // perpendicular road to S
		\wx0030 ROAD_FENCED 0D ROAD_FENCED 0D // perpendicular road to S
		\wx0030 ROAD_CROSSING 05 ROAD_CROSSING 05 // perpendicular road crossing to S
		\wx0030 ROAD_ENTRY_S 0D ROAD_ENTRY_S 0D // perpendicular road entry to S
		\wx0030 RV_ACCESS_S 0D RV_ACCESS_S 0D // perpendicular road ramp to S
		\wx0031 // else

//@@WARNING DISABLE 100

	1 * 1	02 04 02 // ID
		85
		7E 32 // get tile type offset
		20 \wx7FFF
		\2sto 1A
		20 \wx0011 // store in register
		\2rst
		7E BF // get normal/snow/desert offset
		20 \wx7FFF
		\2sto 1A
		00 \wx0010 // store in register
		01
		\wx00CD \w0 \w0
		\wx00CD

//@@WARNING DISABLE 170

	// Purchase
	1 * 1	02 04 04 // ID
		81
		1A // all bits on
		20 00 // val = 0
		\2sto 1A
		20 11 // store in register
		\2rst
		1A // all bits on
		20 00 // val = 0
		\2sto 1A
		00 10 // store in register
		01
		\wx00CD 00 00
		\wx00CD

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

	1 * 1	02 04 01 // ID
		81 0C // check callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0002 // real sprites

	// For purchase list
	1 * 1	02 04 03 // ID
		81 0C // check callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0004 // real sprites

	1 * 1	03 04
		01 ROAD
		01
		FF \wx0003 // purchase
		\wx0001


	1 * 1	00 04 07 01 ROAD_FENCED
		08 "ISRI"

		// Sprite layout
		1A 02
			// 00 (x)
			43
			\dx00000F8D \wx0002 // ground sprite
			10 // register
			\dx8000042D \wx0002 // ground overlay sprite (child)
			00 00 80 // x/y/z offset
			11 // register
			\dx8000842D \wx0041 // fence NW
			00 00 00 // x/y/z offset
			10 01 08 // x/y/z extent
			01 // register
			05 // value for variable 10
			\dx8000842F \wx0041 // fence SE
			00 0F 00 // x/y/z offset
			10 01 08 // x/y/z extent
			03 // register
			05 // value for variable 10

			// 01 (y)
			43
			\dx00000F8D \wx0002 // ground sprite
			10 // register
			\dx8000042E \wx0002 // ground overlay sprite (child)
			00 00 80 // x/y/z offset
			11 // register
			\dx8000842E \wx0041 // fence NE
			00 00 00 // x/y/z offset
			01 10 08 // x/y/z extent
			01 // register
			05 // value for variable 10
			\dx80008430 \wx0041 // fence SW
			0F 00 00 // x/y/z offset
			01 10 08 // x/y/z extent
			03 // register
			05 // value for variable 10

		0B 02 // use callback to determine layout

		0C FE // only allow a width of 1

		11 00 // no pylons
		14 FF // no wires

		15 FF // prevent trains entering the tile from any direction


	// Test variable 10 for real sprites
	1 * 1	02 04 1B // ID
		81 10 // additional information for sprite selection
		00 0F
		01
		\wx00D2 05 05 // fence sprites
		\wx00CD // road sprites

	// Offset for cross-roads differs depending on orientation
	1 * 1	02 04 23 // ID
		81 41 // platform info and position
		18 01 // shift 24 and mask bit 0 for tile orientation
		01
		\wx8005 01 01 // y orientation
		\wx8006 // x orientation

	// For tiles with perpendicular road to S; check if tile to N is a perpendicular road
	1 * 1	02 04 20 // ID
		85 68 F0 // station info param -1/0; check tile to N
		00 \wx0FFF // mask 12 bits for tile ID, type and dir.
		05
		\wx0023 ROAD 0D ROAD 0D // cross-roads
		\wx0023 ROAD_FENCED 0D ROAD_FENCED 0D // cross-roads
		\wx0023 ROAD_CROSSING 05 ROAD_CROSSING 05 // cross-roads
		\wx0023 ROAD_ENTRY_N 0D ROAD_ENTRY_N 0D // cross-roads
		\wx0023 RV_ACCESS_N 0D RV_ACCESS_N 0D // cross-roads
		\wx8004 // t-junction S

	// For tiles with no perpendicular road to S; check if tile to N is a perpendicular road
	1 * 1	02 04 21 // ID
		85 68 F0 // station info param -1/0; check tile to N
		00 \wx0FFF // mask 12 bits for tile ID, type and dir.
		05
		\wx8002 ROAD 0D ROAD 0D // t-junction N
		\wx8002 ROAD_FENCED 0D ROAD_FENCED 0D // t-junction N
		\wx8002 ROAD_CROSSING 05 ROAD_CROSSING 05 // t-junction N
		\wx8002 ROAD_ENTRY_N 0D ROAD_ENTRY_N 0D // t-junction N
		\wx8002 RV_ACCESS_N 0D RV_ACCESS_N 0D // t-junction N
		\wx8000 // straight road

	// For all tiles; check if tile to S is a perpendicular road
	1 * 1	02 04 22 // ID
		85 68 10 // station info param +1/0; check tile to S
		00 \wx0FFF // mask 12 bits for tile ID, type and direction
		05
		\wx0020 ROAD 0D ROAD 0D // perpendicular road to S
		\wx0020 ROAD_FENCED 0D ROAD_FENCED 0D // perpendicular road to S
		\wx0020 ROAD_CROSSING 05 ROAD_CROSSING 05 // perpendicular road crossing to S
		\wx0020 ROAD_ENTRY_S 0D ROAD_ENTRY_S 0D // perpendicular road entry to S
		\wx0020 RV_ACCESS_S 0D RV_ACCESS_S 0D // perpendicular road ramp to S
		\wx0021 // else

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

	1 * 1	02 04 02 // ID
		85 
		7E 22 // get tile type offset
		20 \wx7FFF
		\2sto 1A 
		20 \wx0011 // store in register
		\2rst
		7E B7 // get fence to NW
		20 \wx7FFF
		\2sto 1A
		20 \wx0001 // store in register
		\2rst
		7E B5 // get fence to SE
		20 \wx7FFF
		\2sto 1A
		20 \wx0003 // store in register
		\2rst
		7E BF // get normal/snow/desert offset
		20 \wx7FFF
		\2sto 1A
		00 \wx0010 // store in register
		01
		\wx001B \w0 \w0
		\wx001B

	// Purchase
	1 * 1	02 04 04 // ID
		81
		1A // all bits on
		20 01 // val = 1
		\2sto 1A
		20 01 // store in register - fence to NW
		\2rst
		1A // all bits on
		20 00 // val = 0
		\2sto 1A
		20 03 // store in register - fence to SE
		\2sto 1A 
		20 11 // store in register - tile type offset
		\2sto 1A
		00 10 // store in register - normal/snow/desert offset
		01
		\wx001B 00 00
		\wx001B

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

	1 * 1	02 04 01 // ID
		81 0C // check callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0002 // real images

	// For purchase list
	1 * 1	02 04 03 // ID
		81 0C // check callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0004 // real images

	1 * 1	03 04
		01 ROAD_FENCED
		01
		FF \wx0003 // purchase
		\wx0001


	1 * 1	00 04 06 01 ROAD_CROSSING
		08 "ISRI"

		// Sprite layout
		1A 04
			// 00 (x)
			41
			\dx000003F4 \wx0002 // ground sprite
			10 // register
			\dx8000042D \wx0002 // ground overlay sprite (child)
			00 00 80 // x/y/z offset
			0A // register

			// 01 (y)
			41
			\dx000003F3 \wx0002 // ground sprite
			10 // register
			\dx8000042E \wx0002 // ground overlay sprite (child)
			00 00 80 // x/y/z offset
			0A // register

			// 02 (x) puchase
			41
			\dx000003F4 \wx0000 // ground sprite
			\dx8000042D \wx0002 // ground overlay sprite (child)
			00 00 80 // x/y/z offset
			0A // register

			// 03 (y) puchase
			41
			\dx000003F3 \wx0000 // ground sprite
			\dx8000042E \wx0002 // ground overlay sprite (child)
			00 00 80 // x/y/z offset
			0A // register


		0B 02 // use callback to determine layout

		0D FE // only allow a length of 1

		11 00 // no pylons
		14 FF // no wires


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

	1 * 1	02 04 15 // ID
		85
		7E BA // get overlay offset
		20 \wx00FF
		\2sto 1A
		20 \wx000A // store in register - overlay 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 - ground sprite offset
		01
		\wx00F6 \w0 \w0
		\wx00F6

	// Purchase
	1 * 1	02 04 16 // ID
		85
		7E B9 // get overlay offset
		20 \wx00FF
		\2sto 1A
		00 \wx000A // store in register - overlay offset
		01
		\wx00F6 \w0 \w0
		\wx00F6

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

	1 * 1	02 04 01 // ID
		81 0C // callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0015 // real sprites

	// Purchase
	1 * 1	02 04 02 // ID
		81 0C // callback
		00 FF
		01
		\wx8002 14 14 // sprite layout
		\wx0016 // real sprites

	1 * 1	03 04
		01 ROAD_CROSSING
		01
		FF \wx0002 // purchase
		\wx0001


	1 * 1	00 04 07 01 TRUCK_PARKING
		08 "ISRI"

		// Sprite layout
		1A 02
			// 00 (x)
			45
			\dx00000F8D \wx0002 // ground sprite
			10 // register
			\dx8000042D \wx0000 // ground overlay sprite (child)
			00 00 80 // x/y/z offset
			\dx00008C1F \wx0003 // vehicle 1
			00 01 00 // x/y/z offset
			03 08 0A // x/y/z extent
			01 11 // registers
			\dx00008C1F \wx0003 // vehicle 2
			04 01 00 // x/y/z offset
			03 08 0A // x/y/z extent
			02 11 // registers
			\dx00008C1F \wx0003 // vehicle 3
			08 01 00 // x/y/z offset
			03 08 0A // x/y/z extent
			03 11 // registers
			\dx00008C1F \wx0003 // vehicle 4
			0C 01 00 // x/y/z offset
			03 08 0A // x/y/z extent
			04 11 // registers

			// 01 (y)
			45
			\dx00000F8D \wx0002 // ground sprite
			10 // register
			\dx8000042E \wx0000 // ground overlay sprite (child)
			00 00 80 // x/y/z offset
			\dx00008C21 \wx0003 // vehicle 1
			01 00 00 // x/y/z offset
			08 03 0A // x/y/z extent
			01 11 // registers
			\dx00008C21 \wx0003 // vehicle 2
			01 04 00 // x/y/z offset
			08 03 0A // x/y/z extent
			02 11 // registers
			\dx00008C21 \wx0003 // vehicle 3
			01 08 00 // x/y/z offset
			08 03 0A // x/y/z extent
			03 11 // registers
			\dx00008C21 \wx0003 // vehicle 4
			01 0C 00 // x/y/z offset
			08 03 0A // x/y/z extent
			04 11 // registers


		0B 02 // use callback to determine layout

		10 \w600 // set little / lots threshold

		11 00 // no pylons
		14 FF // no wires

		15 FF // prevent trains entering the tile from any direction

	1 * 1	01 04 01 02
	1 images/newroads4.pcx       4  115  01   31  64  -31   0 // x, ground overlay
	1 images/newroads4.pcx      72  115  01   31  64  -31   0 // y, ground overlay

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


	// Randomisation for cargo thresholds
	1 * 1	02 04 02 // ID
		80
		02 // no more cargo
		12 // use bits 18 and 19
		04
		\wx8000
		\wx8040
		\wx8080
		\wx80C0

	1 * 1	02 04 31 // ID
		81 7D 21 // read register
		00 FF
		01
		\wx8000 00 00
		\wx8001

	1 * 1	02 04 32 // ID
		81 7D 21 // read register
		00 FF
		01
		\wx8000 00 01
		\wx8001

	1 * 1	02 04 33 // ID
		81 7D 21 // read register
		00 FF
		01
		\wx8000 00 02
		\wx8001

	1 * 1	02 04 34 // ID
		81 7D 21 // read register
		00 FF
		01
		\wx8000 00 03
		\wx8001

	// randomisation for vehicle positions
	1 * 1	02 04 36 // ID
		80
		00 // don't re-randomise
		10 // use bits 16 and 17
		04
		\wx0031
		\wx0033
		\wx0034
		\wx0032

	1 * 1	02 04 37 // ID
		80
		00 // don't re-randomise
		10 // use bits 16 and 17
		04
		\wx0032
		\wx0031
		\wx0033
		\wx0034

	1 * 1	02 04 38 // ID
		80
		00 // don't re-randomise
		10 // use bits 16 and 17
		04
		\wx0033
		\wx0034
		\wx0032
		\wx0031

	1 * 1	02 04 39 // ID
		80
		00 // don't re-randomise
		10 // use bits 16 and 17
		04
		\wx0034
		\wx0032
		\wx0031
		\wx0033

	1 * 1	02 04 15 // ID
		85 01 // year from 1920
		00 \wx00FF
		02
		\wx80C0 \w0 \w53 // to 1973
		\wx8000 \w54 \w85 // 1974 to 2005
		\wx8180 // 2006 onwards

// Offsets for truck varieties from base set
	// coal truck      0x0
	// mail truck      0x8
	// oil tanker      0x10
	// livestock truck 0x18
	// goods truck     0x20
	// food truck      0x28
	// grain truck     0x30
	// wood truck      0x38
	// flatbed truck   0x40
	// ore truck       0x48
	// armoured van    0x50
	// water tanker    0x90
	// fruit truck     0x98
	// rubber truck    0xA0

	// Select truck variety suitable for cargo
	1 * 1	02 04 1C // ID
		85
		7D 20 // read register for this cargo type
		00 \wx00FF
		28
		\wx8008 \wx0002 \wx0002 // mail
		\wx8010 \wx0003 \wx0003 // oil
		\wx8018 \wx0004 \wx0004 // livestock
		\wx8020 \wx0005 \wx0005 // goods
		\wx8030 \wx0006 \wx0006 // grain
		\wx8038 \wx0007 \wx0007 // wood
		\wx8048 \wx0008 \wx0008 // iron ore
		\wx8040 \wx0009 \wx0009 // steel
		\wx8050 \wx000A \wx000A // valuables
		\wx8038 \wx000B \wx000B // paper
		\wx8028 \wx000C \wx000C // food
		\wx8098 \wx000D \wx000D // fruit
		\wx8048 \wx000E \wx000E // copper ore
		\wx8090 \wx000F \wx000F // water
		\wx80A0 \wx0010 \wx0010 // rubber
		\wx8030 \wx0011 \wx0012 // wheat/maize
		\wx8038 \wx0013 \wx0013 // tropic wood
		\wx8050 \wx0014 \wx0015 // gold/diamonds
		\wx8048 \wx0016 \wx0019 // clay/gravel/lime/sand
		\wx8010 \wx001A \wx001A // petrol
		\wx8020 \wx001B \wx001B // wood products
		\wx8040 \wx001C \wx001D // copper/lumber
		\wx8028 \wx001E \wx001E // fish
		\wx8020 \wx001F \wx0022 // wool/glass/ceramics/bricks
		\wx8040 \wx0023 \wx0023 // vehicles
		\wx8010 \wx0024 \wx0027 // fertiliser/dyes/refined products/plastic
		\wx8048 \wx0028 \wx0028 // bauxite
		\wx8090 \wx0029 \wx0029 // alcohol
		\wx8020 \wx002A \wx002B // building materials/engineering supplies
		\wx8030 \wx002C \wx002C // plant fibres
		\wx8020 \wx002D \wx002D // farm supplies
		\wx8098 \wx002E \wx002E // fruit (and veg)
		\wx8090 \wx002F \wx002F // milk
		\wx8020 \wx0030 \wx0030 // manufacturing supplies
		\wx8040 \wx0031 \wx0032 // recyclables/scrap metal
		\wx8030 \wx0033 \wx0036 // sugar beet/sugar cane/cereals/oil seed
		\wx8028 \wx0037 \wx0038 // sugar/coffee
		\wx8030 \wx0039 \wx0039 // beans
		\wx8048 \wx003A \wx003A // nitrates
		\wx8020 \wx003B \wx003B // vehicle parts
		\wx8000 // coal

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

	1 * 1	02 04 10 // ID
		85
		7D 20 // read register for this cargo type
		20 \wxFFFF
		\2rst
		7B 60 // get amount of cargo waiting
		20 \wxFFFF
		\2+
		7E 02 // add random value
		20 \wx00FF
		\2u>>
		1A
		20 \wx0008 // shift right 8 bits (val = val / 0x100)
		\2<
		1A
		20 \wx0004 // clamp val at max of 4
		\2sto 1A
		20 \wx0021 // store in register
		\2rst
		7E 36 // get visible flag for truck 1
		20 \wx00FF
		\2sto 1A
		20 \wx0001 // store in register
		\2rst
		7E 37 // get visible flag for truck 2
		20 \wx00FF
		\2sto 1A
		20 \wx0002 // store in register
		\2rst
		7E 38 // get visible flag for truck 3
		20 \wx00FF
		\2sto 1A
		20 \wx0003 // store in register
		\2rst
		7E 39 // get visible flag for truck 4
		20 \wx00FF
		\2sto 1A
		20 \wx0004 // store in register
		\2rst
		7E 15 // get year offset
		20 \wx0FFF
		\2+
		7E 1C // add offset for truck variety
		20 \wx0FFF
		\2sto 1A
		20 \wx0011 // store in register
		\2rst
		7E BF // get normal/snow/desert offset
		20 \wx7FFF
		\2sto 1A
		00 \wx0010 // store in register
		01
		\wx0000 \w0 \w0
		\wx0000

	// Purchase
	1 * 1	02 04 11 // ID
		85
		1A // all bits on
		20 \wx0001 // val = 1
		\2sto 1A
		20 \wx0001 // store in register
		\2sto 1A
		20 \wx0002 // store in register
		\2sto 1A
		20 \wx0003 // store in register
		\2sto 1A
		20 \wx0004 // store in register
		\2rst
		7E 15 // get year offset
		20 \wx0FFF
		\2+ 1A
		20 \wx0020 // goods offset
		\2sto 1A
		20 \wx0011 // store in register
		\2rst
		1A // all bits on
		20 \wx0000
		\2sto 1A
		00 \wx0010 // store in register
		01
		\wx0000 \w0 \w0
		\wx0000

	// Empty
	1 * 1	02 04 12 // ID
		85
		1A // all bits on
		20 \wx0000 // val = 0
		\2sto 1A
		20 \wx0001 // store in register
		\2sto 1A
		20 \wx0002 // store in register
		\2sto 1A
		20 \wx0003 // store in register
		\2sto 1A
		20 \wx0004 // store in register
		\2sto 1A
		20 \wx0011 // store in register
		\2rst
		7E BF // get normal/snow/desert offset
		20 \wx7FFF
		\2sto 1A
		00 \wx0010 // store in register
		01
		\wx0000 \w0 \w0
		\wx0000

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

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

// Store cargo id in register 0x20 and check for callback 0x14
#define CCB(a, b) 1 * 1	02 04 a 85 1A 20 b 00 \2sto 1A 20 \wx0020 \2rst 0C 00 \wxFFFF 01 \wx8000 \wx0014 \wx0014 \wx0010

CCB(21, 01) // coal
CCB(22, 02) // mail
CCB(23, 03) // oil
CCB(24, 04) // livestock
CCB(25, 05) // goods
CCB(26, 06) // grain
CCB(27, 07) // wood
CCB(28, 08) // iron ore
CCB(29, 09) // steel
CCB(2A, 0A) // valuables
CCB(2B, 0B) // paper
CCB(2C, 0C) // food
CCB(2D, 0D) // fruit
CCB(2E, 0E) // copper ore
CCB(2F, 0F) // water
CCB(30, 10) // rubber
CCB(31, 11) // wheat
CCB(32, 12) // maize
CCB(33, 13) // tropic wood
CCB(34, 14) // gold
CCB(35, 15) // diamonds
CCB(36, 16) // clay
CCB(37, 17) // gravel
CCB(38, 18) // lime
CCB(39, 19) // sand
CCB(3A, 1A) // petrol
CCB(3B, 1B) // wood products
CCB(3C, 1C) // copper
CCB(3D, 1D) // lumber
CCB(3E, 1E) // fish
CCB(3F, 1F) // wool
CCB(40, 20) // glass
CCB(41, 21) // ceramics
CCB(42, 22) // bricks
CCB(43, 23) // vehicles
CCB(44, 24) // fertiliser
CCB(45, 25) // dyes
CCB(46, 26) // refined products
CCB(47, 27) // plastic
CCB(48, 28) // bauxite
CCB(49, 29) // alcohol
CCB(4A, 2A) // building materials
CCB(4B, 2B) // engineering supplies
CCB(4C, 2C) // plant fibres
CCB(4D, 2D) // farm supplies
CCB(4E, 2E) // fruit (and veg)
CCB(4F, 2F) // milk
CCB(50, 30) // manufacturing supplies
CCB(51, 31) // recyclables
CCB(52, 32) // scrap metal
CCB(53, 33) // sugar beet
CCB(54, 34) // sugar cane
CCB(55, 35) // cereals
CCB(56, 36) // oil seed
CCB(57, 37) // sugar
CCB(58, 38) // coffee
CCB(59, 39) // beans
CCB(5A, 3A) // nitrates
CCB(5B, 3B) // vehicle parts

#undef CCB

	// Empty
	1 * 1	02 04 04 // ID
		81 0C // check callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0012 // real sprites

	// Purchase list
	1 * 1	02 04 07 // ID
		81 0C // check callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0011 // real sprites

	1 * 1	03 04
		01 TRUCK_PARKING
		3C
		01 \wx0021 // coal
		02 \wx0022 // mail
		03 \wx0023 // oil
		04 \wx0024 // livestock
		05 \wx0025 // goods
		06 \wx0026 // grain
		07 \wx0027 // wood
		08 \wx0028 // iron ore
		09 \wx0029 // steel
		0A \wx002A // valuables
		0B \wx002B // paper
		0C \wx002C // food
		0D \wx002D // fruit
		0E \wx002E // copper ore
		0F \wx002F // water
		10 \wx0030 // rubber
		11 \wx0031 // wheat
		12 \wx0032 // maize
		13 \wx0033 // tropic wood
		14 \wx0034 // gold
		15 \wx0035 // diamonds
		16 \wx0036 // clay
		17 \wx0037 // gravel
		18 \wx0038 // lime
		19 \wx0039 // sand
		1A \wx003A // petrol
		1B \wx003B // wood products
		1C \wx003C // copper
		1D \wx003D // lumber
		1E \wx003E // fish
		1F \wx003F // wool
		20 \wx0040 // glass
		21 \wx0041 // ceramics
		22 \wx0042 // bricks
		23 \wx0043 // vehicles
		24 \wx0044 // fertiliser
		25 \wx0045 // dyes
		26 \wx0046 // refined products
		27 \wx0047 // plastic
		28 \wx0048 // bauxite
		29 \wx0049 // alcohol
		2A \wx004A // building materials
		2B \wx004B // engineering supplies
		2C \wx004C // plant fibres
		2D \wx004D // farm supplies
		2E \wx004E // fruit (and veg)
		2F \wx004F // milk
		30 \wx0050 // manufacturing supplies
		31 \wx0051 // recyclables
		32 \wx0052 // scrap metal
		33 \wx0053 // sugar beet
		34 \wx0054 // sugar cane
		35 \wx0055 // cereals
		36 \wx0056 // oil seed
		37 \wx0057 // sugar
		38 \wx0058 // coffee
		39 \wx0059 // beans
		3A \wx005A // nitrates
		3B \wx005B // vehicle parts
		FF \wx0007 // purchase
		\wx0004 // empty


	1 * 1	00 04 08 01 ROAD_ENTRY_S
		08 "ISRI"

		// Sprite layout
		1A 02
			// 00 (x)
			43
			\dx00000F8D \wx0002 // ground sprite
			10 // register
			\dx8000042D \wx0000 // ground overlay sprite
			00 00 00 // x/y/z offset
			10 10 08 // x/y/z extent
			\dx8000842D \wx0041 // fence NW
			00 00 00 // x/y/z offset
			10 01 08 // x/y/z extent
			01 // register
			05 // value for variable 10
			\dx8000842F \wx0041 // fence SE
			00 0F 00 // x/y/z offset
			10 01 08 // x/y/z extent
			03 // register
			05 // value for variable 10

			// 01 (y)
			43
			\dx00000F8D \wx0002 // ground sprite
			10 // register
			\dx8000042E \wx0000 // ground overlay sprite
			00 00 00 // x/y/z offset
			10 10 08 // x/y/z extent
			\dx8000842E \wx0041 // fence NE
			00 00 00 // x/y/z offset
			01 10 08 // x/y/z extent
			01 // register
			05 // value for variable 10
			\dx80008430 \wx0041 // fence SW
			0F 00 00 // x/y/z offset
			01 10 08 // x/y/z extent
			03 // register
			05 // value for variable 10

		0B 02 // use callback to determine layout

		// Only allow 1 x 1
		0C FE
		0D FE

		11 00 // no pylons
		14 FF // no wires

		15 FF // prevent trains entering the tile from any direction


	1 * 1	01 04 01 02
	1 images/newroads4.pcx    4  221  01  32  65 -32   0 // 042D x, road entry S
	1 images/newroads4.pcx   72  221  01  32  64 -31   0 // 042E y, road entry S

	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
		\wx00D2 05 05 // fence sprites
		\wx0000 // entrance sprites

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

	1 * 1	02 04 02 // ID
		85
		7E B7 // get fence to NW
		20 \wx7FFF
		\2sto 1A
		20 \wx0001 // store in register
		\2rst
		7E B5 // get fence to SE
		20 \wx7FFF
		\2sto 1A
		20 \wx0003 // store in register
		\2rst
		7E BF // get normal/snow/desert offset
		20 \wx7FFF
		\2sto 1A
		00 \wx0010 // store in register
		01
		\wx001B \w0 \w0
		\wx001B

	// Purchase
	1 * 1	02 04 04 // ID
		81
		1A // all bits on
		20 01 // val = 1
		\2sto 1A
		20 01 // store in register - fence to NW
		\2sto 1A
		20 03 // store in register - fence to SE
		\2rst
		1A // all bits on
		20 00 // val = 0
		\2sto 1A
		00 10 // store in register - normal/snow/desert offset
		01
		\wx001B 00 00
		\wx001B

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

	1 * 1	02 04 01 // ID
		81 0C // check callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0002 // real sprites

	// For purchase list
	1 * 1	02 04 03 // ID
		81 0C // check callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0004 // real sprites

	1 * 1	03 04
		01 ROAD_ENTRY_S
		01
		FF \wx0003 // purchase
		\wx0001


	1 * 1	00 04 08 01 ROAD_ENTRY_N
		08 "ISRI"

		0A ROAD_ENTRY_S // copy sprite layout

		0B 02 // use callback to determine layout

		// Only allow 1 x 1
		0C FE
		0D FE

		11 00 // no pylons
		14 FF // no wires

		15 FF // prevent trains entering the tile from any direction

	1 * 1	01 04 01 02
	1 images/newroads4.pcx    4  263  01  40  64 -31  -9 // 042D x, road entry N
	1 images/newroads4.pcx   72  263  01  40  65 -32  -9 // 042E y, road entry 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
		\wx00D2 05 05 // fence sprites
		\wx0000 // entrance sprites

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

	1 * 1	02 04 02 // ID
		85
		7E B7 // get fence to NW
		20 \wx7FFF
		\2sto 1A
		20 \wx0001 // store in register
		\2rst
		7E B5 // get fence to SE
		20 \wx7FFF
		\2sto 1A
		20 \wx0003 // store in register
		\2rst
		7E BF // get normal/snow/desert offset
		20 \wx7FFF
		\2sto 1A
		00 \wx0010 // store in register
		01
		\wx001B \w0 \w0
		\wx001B

	// Purchase
	1 * 1	02 04 04 // ID
		81
		1A // all bits on
		20 01 // val = 1
		\2sto 1A
		20 01 // store in register - fence to NW
		\2sto 1A
		20 03 // store in register - fence to SE
		\2rst
		1A // all bits on
		20 00 // val = 0
		\2sto 1A
		00 10 // store in register - normal/snow/desert offset
		01
		\wx001B 00 00
		\wx001B

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

	1 * 1	02 04 01 // ID
		81 0C // check callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0002 // real sprites

	// For purchase list
	1 * 1	02 04 03 // ID
		81 0C // check callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0004 // real sprites

	1 * 1	03 04
		01 ROAD_ENTRY_N
		01
		FF \wx0003 // purchase
		\wx0001


	1 * 1	00 04 08 01 RV_ACCESS_N
		08 "ISRI"

		// Sprite layout
		1A 02
			// 00 (x)
			41
			\dx00000F8D \wx0002 // ground sprite
			10 // register
			\dx8000042D \wx0000 // ground overlay sprite
			00 00 00 // x/y/z offset
			10 10 03 // x/y/z extent

			// 01 (y)
			41
			\dx00000F8D \wx0002 // ground sprite
			10 // register
			\dx8000042E \wx0000 // ground overlay sprite
			00 00 00 // x/y/z offset
			10 10 03 // x/y/z extent

		0B 02 // use callback to determine layout

		// Only allow 1 x 1
		0C FE
		0D FE

		11 00 // no pylons
		14 FF // no wires

		15 FF // prevent trains entering the tile from any direction

	1 * 1	01 04 01 02
	1 images/newroads4.pcx     4  310  01   31  64  -31   0 // x
	1 images/newroads4.pcx    72  310  01   31  64  -31   0 // y

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

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

	1 * 1	02 04 02 // ID
		85
		7E BF // get normal/snow/desert offset
		20 \wx7FFF
		\2sto 1A
		00 \wx0010 // store in register
		01
		\wx0000 \w0 \w0
		\wx0000

	// Purchase
	1 * 1	02 04 04 // ID
		81
		1A // all bits on
		20 00 // val = 0
		\2sto 1A
		00 10 // store in register
		01
		\wx0000 00 00
		\wx0000

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

	1 * 1	02 04 01 // ID
		81 0C // check callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0002 // real sprites

	// For purchase list
	1 * 1	02 04 03 // ID
		81 0C // check callback
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0004 // real sprites

	1 * 1	03 04
		01 RV_ACCESS_N
		01
		FF \wx0003 // purchase
		\wx0001


	1 * 1	00 04 08 01 RV_ACCESS_S
		08 "ISRI"

		0A RV_ACCESS_N // copy sprite layout

		0B 02 // use callback to determine layout

		// Only allow 1 x 1
		0C FE
		0D FE

		11 00 // no pylons
		14 FF // no wires

		15 FF // prevent trains entering the tile from any direction

	1 * 1	01 04 01 02
	1 images/newroads4.pcx     4  348  01   31  64  -31   0 // x
	1 images/newroads4.pcx    72  348  01   31  64  -31   0 // y

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

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

	1 * 1	02 04 02 // ID
		85
		7E BF // get normal/snow/desert offset
		20 \wx7FFF
		\2sto 1A
		00 \wx0010 // store in register
		01
		\wx0000 \w0 \w0
		\wx0000

	// Purchase
	1 * 1	02 04 04 // ID
		81
		1A // all bits on
		20 00 // val = 0
		\2sto 1A
		00 10 // store in register
		01
		\wx0000 00 00
		\wx0000

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

	1 * 1	02 04 01 // ID
		81 0C // check variable 0C (callback number)
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0002 // real sprites

	// For purchase list
	1 * 1	02 04 03 // ID
		81 0C // check variable 0C (callback number)
		00 FF
		01
		\wx8000 14 14 // sprite layout
		\wx0004 // real sprites

	1 * 1	03 04
		01 RV_ACCESS_S
		01
		FF \wx0003 // purchase
		\wx0001
