#textdomain wesnoth

# Defines a terrain that has a transition image of the form: "void-n-ne-se-s.png"
# example: {TERRAIN_ADJACENT_4 gt !gt grassland}

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

#define TRANSITION1_BASE_PLF TERRAIN ADJACENT PROB LAYER FLAG IMAGESTEM
    [terrain_graphics]
        map="
,  2
.,   .
,  1
.,   .
,  ."
        [tile]
            pos=1
            type={ADJACENT}

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

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

        probability={PROB}
        rotations=n,ne,se,s,sw,nw
    [/terrain_graphics]
#enddef

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

#define TRANSITION2_BASE_PLF TERRAIN ADJACENT PROB LAYER FLAG IMAGESTEM
    [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={IMAGESTEM}-@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]

        probability={PROB}
        rotations=n,ne,se,s,sw,nw
    [/terrain_graphics]
#enddef

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

#define TRANSITION3_BASE_PLF TERRAIN ADJACENT PROB LAYER FLAG IMAGESTEM
    [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={IMAGESTEM}-@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]

        probability={PROB}
        rotations=n,ne,se,s,sw,nw
    [/terrain_graphics]
#enddef

# 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 TRANSITION4_BASE_PLF TERRAIN ADJACENT PROB LAYER FLAG IMAGESTEM
    [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={IMAGESTEM}-@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]

        probability={PROB}
        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 TRANSITION_BASE_PLF TERRAIN ADJACENT PROB LAYER FLAG IMAGESTEM
    {TRANSITION4_BASE_PLF ({TERRAIN}) ({ADJACENT}) ({PROB}) ({LAYER}) {FLAG} {IMAGESTEM} }
    {TRANSITION3_BASE_PLF ({TERRAIN}) ({ADJACENT}) ({PROB}) ({LAYER}) {FLAG} {IMAGESTEM} }
    {TRANSITION2_BASE_PLF ({TERRAIN}) ({ADJACENT}) ({PROB}) ({LAYER}) {FLAG} {IMAGESTEM} }
    {TRANSITION1_BASE_PLF ({TERRAIN}) ({ADJACENT}) ({PROB}) ({LAYER}) {FLAG} {IMAGESTEM} }
#enddef

#meta-macro TRANSITION_BASE TERRAIN ADJACENT P=PROB=100 L=LAYER=-500 F=FLAG=transition IMAGESTEM

# This utility macro disables standard transitions on a given terrain type. It
# is used for castles and keeps, as those have custom transitions.

#define DISABLE_BASE_TRANSITIONS_F TERRAIN FLAG
    [terrain_graphics]
        [tile]
            x=0
            y=0
            type={TERRAIN}
            set_flag={FLAG}-n,{FLAG}-ne,{FLAG}-se,{FLAG}-s,{FLAG}-sw,{FLAG}-nw
        [/tile]
    [/terrain_graphics]
#enddef

#define DISABLE_BASE_TRANSITIONS TERRAINLIST
    {DISABLE_BASE_TRANSITIONS_F {TERRAINLIST} transition}
#enddef

#The following code is autogenerated by expand-terrain-macros.py
#generated from: #meta-macro TRANSITION_BASE TERRAINLIST ADJACENT P=PROB=100 L=LAYER=-500 F=FLAG=transition IMAGESTEM
#Please do not modify
#define TRANSITION_BASE_LF TERRAINLIST ADJACENT LAYER FLAG IMAGESTEM
    {TRANSITION_BASE_PLF ({TERRAINLIST}) ({ADJACENT}) 100 ({LAYER}) ({FLAG}) ({IMAGESTEM})}
#enddef
#define TRANSITION_BASE_PF TERRAINLIST ADJACENT PROB FLAG IMAGESTEM
    {TRANSITION_BASE_PLF ({TERRAINLIST}) ({ADJACENT}) ({PROB}) -500 ({FLAG}) ({IMAGESTEM})}
#enddef
#define TRANSITION_BASE_F TERRAINLIST ADJACENT FLAG IMAGESTEM
    {TRANSITION_BASE_PLF ({TERRAINLIST}) ({ADJACENT}) 100 -500 ({FLAG}) ({IMAGESTEM})}
#enddef
#define TRANSITION_BASE_PL TERRAINLIST ADJACENT PROB LAYER IMAGESTEM
    {TRANSITION_BASE_PLF ({TERRAINLIST}) ({ADJACENT}) ({PROB}) ({LAYER}) transition ({IMAGESTEM})}
#enddef
#define TRANSITION_BASE_L TERRAINLIST ADJACENT LAYER IMAGESTEM
    {TRANSITION_BASE_PLF ({TERRAINLIST}) ({ADJACENT}) 100 ({LAYER}) transition ({IMAGESTEM})}
#enddef
#define TRANSITION_BASE_P TERRAINLIST ADJACENT PROB IMAGESTEM
    {TRANSITION_BASE_PLF ({TERRAINLIST}) ({ADJACENT}) ({PROB}) -500 transition ({IMAGESTEM})}
#enddef
#define TRANSITION_BASE TERRAINLIST ADJACENT IMAGESTEM
    {TRANSITION_BASE_PLF ({TERRAINLIST}) ({ADJACENT}) 100 -500 transition ({IMAGESTEM})}
#enddef
#end of generated code
