
# Defines a terrain that has a transition image of the form: "void-n-ne-se-s.png"
# example: {TERRAIN_ADJACENT_4 gt !gt grassland}
# This will add 4-tile transitions from terrains of type g or t to terrains of
# any other type, using the filename grassland-x-x-x-x.png

#define TERRAIN_ADJACENT_PREC_4_FL LAYER TERRAIN ADJACENT IMAGE FLAG
[terrain_graphics]

	map="
, 2
.,  3
, 1
.,  4
, 5
"
	[tile]
		pos=1
		type={ADJACENT}

		no_flag={FLAG}-@R0,{FLAG}-@R1,{FLAG}-@R2,{FLAG}-@R3
		set_flag={FLAG}-@R0,{FLAG}-@R1,{FLAG}-@R2,{FLAG}-@R3

		[image]
			layer={LAYER}
			name={IMAGE}-@R0-@R1-@R2-@R3
		[/image]
	[/tile]
	[tile]
		pos=2
		type={TERRAIN}
		no_flag={FLAG}-@R3
		set_flag={FLAG}-@R3
	[/tile]
	[tile]
		pos=3
		type={TERRAIN}
		no_flag={FLAG}-@R4
		set_flag={FLAG}-@R4
	[/tile]
	[tile]
		pos=4
		type={TERRAIN}
		no_flag={FLAG}-@R5
		set_flag={FLAG}-@R5
	[/tile]
	[tile]
		pos=5
		type={TERRAIN}
		no_flag={FLAG}-@R0
		set_flag={FLAG}-@R0
	[/tile]

	precedence=-100
	rotations=n,ne,se,s,sw,nw
[/terrain_graphics]
#enddef

# Same as above, but for 3-tile transitions.

#define TERRAIN_ADJACENT_PREC_3_FL LAYER TERRAIN ADJACENT IMAGE FLAG
[terrain_graphics]
	map="
, 2
.,  3
, 1
.,  4
, .
"
	[tile]
		pos=1
		type={ADJACENT}

		no_flag={FLAG}-@R0,{FLAG}-@R1,{FLAG}-@R2
		set_flag={FLAG}-@R0,{FLAG}-@R1,{FLAG}-@R2

		[image]
			layer={LAYER}
			name={IMAGE}-@R0-@R1-@R2
		[/image]
	[/tile]
	[tile]
		pos=2
		type={TERRAIN}
		no_flag={FLAG}-@R3
		set_flag={FLAG}-@R3
	[/tile]
	[tile]
		pos=3
		type={TERRAIN}
		no_flag={FLAG}-@R4
		set_flag={FLAG}-@R4
	[/tile]
	[tile]
		pos=4
		type={TERRAIN}
		no_flag={FLAG}-@R5
		set_flag={FLAG}-@R5
	[/tile]

	precedence=-100
	rotations=n,ne,se,s,sw,nw
[/terrain_graphics]
#enddef

# Same as above, but for 2-tile transitions.

#define TERRAIN_ADJACENT_PREC_2_FL LAYER TERRAIN ADJACENT IMAGE FLAG
[terrain_graphics]
	map="
, 2
.,  3
, 1
.,  .
, .
"
	[tile]
		pos=1
		type={ADJACENT}

		no_flag={FLAG}-@R0,{FLAG}-@R1
		set_flag={FLAG}-@R0,{FLAG}-@R1

		[image]
			layer={LAYER}
			name={IMAGE}-@R0-@R1
		[/image]
	[/tile]
	[tile]
		pos=2
		type={TERRAIN}
		no_flag={FLAG}-@R3
		set_flag={FLAG}-@R3
	[/tile]
	[tile]
		pos=3
		type={TERRAIN}
		no_flag={FLAG}-@R4
		set_flag={FLAG}-@R4
	[/tile]

	precedence=-100
	rotations=n,ne,se,s,sw,nw
[/terrain_graphics]
#enddef

# Same as above, but for 1-tile (simple) transitions.

#define TERRAIN_ADJACENT_PREC_1_FL LAYER TERRAIN ADJACENT IMAGE FLAG
[terrain_graphics]

	map="
, 2
.,  .
, 1
.,  .
, .
"
	[tile]
		pos=1
		type={ADJACENT}

		no_flag={FLAG}-@R0
		set_flag={FLAG}-@R0

		[image]
			layer={LAYER}
			name={IMAGE}-@R0
		[/image]
	[/tile]
	[tile]
		pos=2
		type={TERRAIN}
		no_flag={FLAG}-@R3
		set_flag={FLAG}-@R3
	[/tile]

	precedence=-100
	rotations=n,ne,se,s,sw,nw
[/terrain_graphics]
#enddef

# Defines a terrain that could have 4-tile, 3-tile, 2-tile, or 1-tile
# transitions to other terrains. The larger transitions have greater priority
# and go first.

#define TERRAIN_ADJACENT_PREC_FL LAYER TERRAIN ADJACENT IMAGE FLAG
{TERRAIN_ADJACENT_PREC_4_FL ({LAYER}) ({TERRAIN}) ({ADJACENT}) {IMAGE} {FLAG}}
{TERRAIN_ADJACENT_PREC_3_FL ({LAYER}) ({TERRAIN}) ({ADJACENT}) {IMAGE} {FLAG}}
{TERRAIN_ADJACENT_PREC_2_FL ({LAYER}) ({TERRAIN}) ({ADJACENT}) {IMAGE} {FLAG}}
{TERRAIN_ADJACENT_PREC_1_FL ({LAYER}) ({TERRAIN}) ({ADJACENT}) {IMAGE} {FLAG}}
#enddef

#define TERRAIN_ADJACENT_PREC LAYER TERRAIN ADJACENT IMAGE
{TERRAIN_ADJACENT_PREC_FL ({LAYER}) ({TERRAIN}) ({ADJACENT}) {IMAGE} transition}
#enddef

