#textdomain wesnoth

# internal macros (do not use in terrain-graphics.cfg)
#these macros are generic macros used to build more complicated macros
#they have no default parameters, these should be provided by the implementers

#define GENERIC_SINGLE_PLFB TERRAIN PROB LAYER FLAG BUILDER IMAGESTEM
    [terrain_graphics]
        map="
, *
* , *
, 1
* , *
, *"

        [tile]
            pos=1
            type={TERRAIN}
            set_no_flag={FLAG}
        [/tile]

        probability={PROB}
        [image]
            name={BUILD_IMAGE {BUILDER} {IMAGESTEM} ()}
            variations=";2;3;4;5;6;7;8;9;10;11"
            layer={LAYER}
            base=90,144
            center=90,144
        [/image]
    [/terrain_graphics]
#enddef

# experimental 1-hex rule
#define GENERIC_SINGLEHEX_PLFB VALUE PROB LAYER FLAG BUILDER IMAGESTEM
    [terrain_graphics]
        [tile]
            x=0
            y=0
            type={VALUE}
            set_no_flag={FLAG}
            [image]
                name={BUILD_IMAGE {BUILDER} {IMAGESTEM} ()}
                variations=";2;3;4;5;6;7;8;9;10;11"
                layer={LAYER}
            [/image]
        [/tile]

        probability={PROB}
    [/terrain_graphics]
#enddef

#define GENERIC_RESTRICTED_PLFB TERRAIN ADJACENT PROB LAYER FLAG BUILDER IMAGESTEM ROTATION
    [terrain_graphics]
        map="
,  2
*,   *
,  1
*,   *
,  *"

        [tile]
            pos=2
            type={ADJACENT}
        [/tile]

        [tile]
            pos=1
            type={TERRAIN}
            set_no_flag={FLAG}
        [/tile]

        probability={PROB}
        rotations=n,ne,se,s,sw,nw

        [image]
            name={BUILD_IMAGE {BUILDER} {IMAGESTEM} {ROTATION}}
            variations=";2;3;4;5;6;7;8;9;10;11"
            base=90,144
            center=90,144
            layer={LAYER}
        [/image]
    [/terrain_graphics]
#enddef

#define GENERIC_RESTRICTED2_N_NE_PLFB TERRAIN ADJACENT PROB LAYER FLAG BUILDER IMAGESTEM ROTATION
    [terrain_graphics]
        map="
,  2
*,   2
,  1
*,   *
,  *"

        [tile]
            pos=2
            type={ADJACENT}
        [/tile]
        [tile]
            pos=1
            type={TERRAIN}
            set_no_flag={FLAG}
        [/tile]

        probability={PROB}
        rotations=n,ne,se,s,sw,nw

        [image]
            name={BUILD_IMAGE {BUILDER} {IMAGESTEM} {ROTATION}}
            variations=";2;3;4;5;6;7;8;9;10;11"
            base=90,144
            center=90,144
            layer={LAYER}
        [/image]
    [/terrain_graphics]
#enddef

#define GENERIC_RESTRICTED2_N_SE_PLFB TERRAIN ADJACENT PROB LAYER FLAG BUILDER IMAGESTEM ROTATION
    [terrain_graphics]
        map="
,  2
*,   *
,  1
*,   2
,  *"

        [tile]
            pos=2
            type={ADJACENT}
        [/tile]
        [tile]
            pos=1
            type={TERRAIN}
            set_no_flag={FLAG}
        [/tile]

        probability={PROB}
        rotations=n,ne,se,s,sw,nw

        [image]
            name={BUILD_IMAGE {BUILDER} {IMAGESTEM} {ROTATION}}
            variations=";2;3;4;5;6;7;8;9;10;11"
            base=90,144
            center=90,144
            layer={LAYER}
        [/image]
    [/terrain_graphics]
#enddef

#define GENERIC_RESTRICTED2_N_S_PLFB TERRAIN ADJACENT PROB LAYER FLAG BUILDER IMAGESTEM ROTATION
    [terrain_graphics]
        map="
,  2
*,   *
,  1
*,   *
,  2"

        [tile]
            pos=2
            type={ADJACENT}
        [/tile]
        [tile]
            pos=1
            type={TERRAIN}
            set_no_flag={FLAG}
        [/tile]

        probability={PROB}
        rotations=n,ne,se,s,sw,nw

        [image]
            name={BUILD_IMAGE {BUILDER} {IMAGESTEM} {ROTATION}}
            variations=";2;3;4;5;6;7;8;9;10;11"
            base=90,144
            center=90,144
            layer={LAYER}
        [/image]
    [/terrain_graphics]
#enddef

#
# TERRAIN is next to at least two ADJACENT-hexes
#
#define GENERIC_RESTRICTED2_PLFB TERRAIN ADJACENT PROB LAYER FLAG BUILDER IMAGESTEM ROTATION
    {GENERIC_RESTRICTED2_N_NE_PLFB ({TERRAIN}) ({ADJACENT}) {PROB} {LAYER} {FLAG} {BUILDER} {IMAGESTEM} {ROTATION}}
    {GENERIC_RESTRICTED2_N_SE_PLFB ({TERRAIN}) ({ADJACENT}) {PROB} {LAYER} {FLAG} {BUILDER} {IMAGESTEM} {ROTATION}}
    {GENERIC_RESTRICTED2_N_S_PLFB  ({TERRAIN}) ({ADJACENT}) {PROB} {LAYER} {FLAG} {BUILDER} {IMAGESTEM} {ROTATION}}
#enddef

#define GENERIC_RESTRICTED3_N_NE_SE_PLFB TERRAIN ADJACENT PROB LAYER FLAG BUILDER IMAGESTEM ROTATION
    [terrain_graphics]
        map="
,  2
*,   2
,  1
*,   2
,  *"

        [tile]
            pos=2
            type={ADJACENT}
        [/tile]

        [tile]
            pos=1
            type={TERRAIN}
            set_no_flag={FLAG}
        [/tile]

        probability={PROB}
        rotations=n,ne,se,s,sw,nw

        [image]
            name={BUILD_IMAGE {BUILDER} {IMAGESTEM} {ROTATION}}
            variations=";2;3;4;5;6;7;8;9;10;11"
            base=90,144
            center=90,144
            layer={LAYER}
        [/image]
    [/terrain_graphics]
#enddef

#define GENERIC_RESTRICTED3_N_NE_S_PLFB TERRAIN ADJACENT PROB LAYER FLAG BUILDER IMAGESTEM ROTATION
    [terrain_graphics]
        map="
,  2
*,   2
,  1
*,   *
,  2"

        [tile]
            pos=2
            type={ADJACENT}
        [/tile]

        [tile]
            pos=1
            type={TERRAIN}
            set_no_flag={FLAG}
        [/tile]

        probability={PROB}
        rotations=n,ne,se,s,sw,nw

        [image]
            name={BUILD_IMAGE {BUILDER} {IMAGESTEM} {ROTATION}}
            variations=";2;3;4;5;6;7;8;9;10;11"
            base=90,144
            center=90,144
            layer={LAYER}
        [/image]
    [/terrain_graphics]
#enddef

#define GENERIC_RESTRICTED3_N_NE_SW_PLFB TERRAIN ADJACENT PROB LAYER FLAG BUILDER IMAGESTEM ROTATION
    [terrain_graphics]
        map="
,  2
*,   2
,  1
2,   *
,  *"

        [tile]
            pos=2
            type={ADJACENT}
        [/tile]

        [tile]
            pos=1
            type={TERRAIN}
            set_no_flag={FLAG}
        [/tile]

        probability={PROB}
        rotations=n,ne,se,s,sw,nw

        [image]
            name={BUILD_IMAGE {BUILDER} {IMAGESTEM} {ROTATION}}
            variations=";2;3;4;5;6;7;8;9;10;11"
            base=90,144
            center=90,144
            layer={LAYER}
        [/image]
    [/terrain_graphics]
#enddef

#define GENERIC_RESTRICTED3_N_SE_SW_PLFB TERRAIN ADJACENT PROB LAYER FLAG BUILDER IMAGESTEM ROTATION
    [terrain_graphics]
        map="
,  2
*,   *
,  1
2,   2
,  *"

        [tile]
            pos=2
            type={ADJACENT}
        [/tile]

        [tile]
            pos=1
            type={TERRAIN}
            set_no_flag={FLAG}
        [/tile]

        probability={PROB}
        rotations=n,ne,se,s,sw,nw

        [image]
            name={BUILD_IMAGE {BUILDER} {IMAGESTEM} {ROTATION}}
            variations=";2;3;4;5;6;7;8;9;10;11"
            base=90,144
            center=90,144
            layer={LAYER}
        [/image]
    [/terrain_graphics]
#enddef

#
# TERRAIN ist next to at least three ADJACENT-hexes
#
#define GENERIC_RESTRICTED3_PLFB TERRAIN ADJACENT PROB LAYER FLAG BUILDER IMAGESTEM ROTATION
    {GENERIC_RESTRICTED3_N_NE_SE_PLFB ({TERRAIN}) ({ADJACENT}) {PROB} {LAYER} {FLAG} {BUILDER} {IMAGESTEM} {ROTATION}}
    {GENERIC_RESTRICTED3_N_NE_S_PLFB  ({TERRAIN}) ({ADJACENT}) {PROB} {LAYER} {FLAG} {BUILDER} {IMAGESTEM} {ROTATION}}
    {GENERIC_RESTRICTED3_N_NE_SW_PLFB ({TERRAIN}) ({ADJACENT}) {PROB} {LAYER} {FLAG} {BUILDER} {IMAGESTEM} {ROTATION}}
    {GENERIC_RESTRICTED3_N_SE_SW_PLFB ({TERRAIN}) ({ADJACENT}) {PROB} {LAYER} {FLAG} {BUILDER} {IMAGESTEM} {ROTATION}}
#enddef

# Simplified macro for defining ImagePathFunction-using variations of water
# terrains. Assumes 15 frames, sets flag to "base" and layer to "-1000".
#define ANIMATED_WATER_15 TERRAINLIST IPF TIME IMAGESTEM
    [terrain_graphics]
        [tile]
            x=0
            y=0
            type={TERRAINLIST}
            set_no_flag=base
            # we put [image] in [tile] for performance reason
            # this assumes that the image fit into the hex
            [image]
                name={IMAGESTEM}-A01.png{IPF}:{TIME},{IMAGESTEM}-A02.png{IPF}:{TIME},{IMAGESTEM}-A03.png{IPF}:{TIME},{IMAGESTEM}-A04.png{IPF}:{TIME},{IMAGESTEM}-A05.png{IPF}:{TIME},{IMAGESTEM}-A06.png{IPF}:{TIME},{IMAGESTEM}-A07.png{IPF}:{TIME},{IMAGESTEM}-A08.png{IPF}:{TIME},{IMAGESTEM}-A09.png{IPF}:{TIME},{IMAGESTEM}-A10.png{IPF}:{TIME},{IMAGESTEM}-A11.png{IPF}:{TIME},{IMAGESTEM}-A12.png{IPF}:{TIME},{IMAGESTEM}-A13.png{IPF}:{TIME},{IMAGESTEM}-A14.png{IPF}:{TIME},{IMAGESTEM}-A15.png{IPF}:{TIME}
                layer=-1000
            [/image]
        [/tile]
    [/terrain_graphics]
#enddef

# Simplified macro for defining ImagePathFunction-using water transitions.
# Note: the animations are disabled for now.
#define ANIMATED_WATER_15_TRANSITION TERRAINLIST ADJACENT LAYER IPF TIME IMAGESTEM
    [terrain_graphics]
        map="
, 2
* , *
, 1
* , *
, *"
        [tile]
            pos=1
            type={ADJACENT}
            set_no_flag=transition-@R0
            # we put [image] in [tile] for performance reason
            # this assumes that the image fit into the hex
            [image]
                name={IMAGESTEM}-A01-@R0.png{IPF}:{TIME},{IMAGESTEM}-A02-@R0.png{IPF}:{TIME},{IMAGESTEM}-A03-@R0.png{IPF}:{TIME},{IMAGESTEM}-A04-@R0.png{IPF}:{TIME},{IMAGESTEM}-A05-@R0.png{IPF}:{TIME},{IMAGESTEM}-A06-@R0.png{IPF}:{TIME},{IMAGESTEM}-A07-@R0.png{IPF}:{TIME},{IMAGESTEM}-A08-@R0.png{IPF}:{TIME},{IMAGESTEM}-A09-@R0.png{IPF}:{TIME},{IMAGESTEM}-A10-@R0.png{IPF}:{TIME},{IMAGESTEM}-A11-@R0.png{IPF}:{TIME},{IMAGESTEM}-A12-@R0.png{IPF}:{TIME},{IMAGESTEM}-A13-@R0.png{IPF}:{TIME},{IMAGESTEM}-A14-@R0.png{IPF}:{TIME},{IMAGESTEM}-A15-@R0.png{IPF}:{TIME}
                layer={LAYER}
            [/image]
        [/tile]
        [tile]
            pos=2
            type={TERRAINLIST}
        [/tile]

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