Difference between revisions of "TerrainMacrosWML"

From The Battle for Wesnoth Wiki
(KEEP_BASE TERRAIN_PATTERN IMAGESTEM)
(additional links)
 
(47 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{DevFeature1.9}}
 
This page is entirely base on the 1.9 macros, they are very close to the 1.8 macros, but no attempt has been done to document the difference
 
 
== Documentation format  ==
 
here is an example of macro
 
 
this is a macro with default parameters. It means that the following macros exist
 
* SOME_MACRO
 
* SOME_MACRO_P
 
* SOME_MACRO_PL
 
* SOME_MARCRO_PLF
 
* SOME_MACRO_PLFB
 
* SOME_MACRO_L
 
* SOME_MACRO_LF
 
* SOME_MACRO_LFB
 
* SOME_MACRO_F
 
* SOME_MACRO_FB
 
* SOME_MACRO_B
 
 
 
=== SOME_MACRO PARAM1 P=PROB=100 L=LAYER=0 F=FLAG=overlay B=BUILDER=IMAGE_SINGLE IMAGESTEM ===
 
 
This macro is an example for documentation
 
 
''' Images used '''
 
* IMAGESTEM_n
 
* IMAGESTEM_tr
 
 
''' Parameters '''
 
* '''Param1''': description of a mandatory param
 
* '''P=Prob''': description of an optional param
 
 
''' Flag Handling '''
 
how does this macro handle flags
 
  
 
== Flag Management ==
 
== Flag Management ==
Line 40: Line 6:
 
* '''village''': is set when a village is added on a tile.
 
* '''village''': is set when a village is added on a tile.
 
* '''transition-@R*''': is set on a tile which has a transition on it's corresponding side set (i.e if there is a transition with the tile at its north, transition-n will be set) possible values: ''n,ne,nw,s,se,sw'' Also not that the macros handl it in a reciprocal way. in other word if a tile has transition-n set, it's northern neighbour should have transition-s set
 
* '''transition-@R*''': is set on a tile which has a transition on it's corresponding side set (i.e if there is a transition with the tile at its north, transition-n will be set) possible values: ''n,ne,nw,s,se,sw'' Also not that the macros handl it in a reciprocal way. in other word if a tile has transition-n set, it's northern neighbour should have transition-s set
 +
* '''overlay-connect-@R*''' : used for bridges, the bridge on this tile. The bridge "actually has" an "exit direction" in the @R direction indicated.
 +
* '''overlay-away-@R*''' : used for bridges, the bridge does NOT have an exit on the given direction, but would be expected to...
 +
 +
 +
'''A note about ''overlay-@R'' and ''overlay-away-@R'' flags '''
 +
 +
Suppose we have a ''n->s'' bridge hex who's ''ne'' neighbour is a ''ne->sw'' bridge. This mean that the ''n->s'' is actually a turn in the bridge that should use a graphic depicting a ''s->ne'' corner.
 +
 +
In that case the tile will have ''overlay-s'' and ''overlay-ne'' set (the directions where the bridge actually exits) and ''overlay-away-n'' (the direction where the bridge would exit according to terrain codes, but doesnt because of overall layout)
  
 
== Layer Management ==
 
== Layer Management ==
 
* '''-1000''': default layer for base tiles
 
* '''-1000''': default layer for base tiles
 +
* '''-80''': overlays that should always be drawn under units (like rails etc...)
 
* '''0''': default layer for overlays and villages
 
* '''0''': default layer for overlays and villages
 +
Normal units are drawn above layer 0, except if the basey of the tile is > 56 in which case they are drawn below
 
* '''1''': used by the base tile of castles/keeps
 
* '''1''': used by the base tile of castles/keeps
 +
Flying/moving units are always drawn over terrain
 +
== Precedence Management ==
 +
TBSL
 +
== Base Management ==
 +
TBSL
 +
 +
== Macro naming convention ==
 +
for some common types of tiles, we have a lot of variation of macros. To simplify, they follow a naming convention
 +
 +
=== Macro names ===
 +
Type is the type of macros (like KEEP,OVERLAY etc...) we are using
 +
 +
* '''TYPE'''''_PLFB'' : puts an image on a tile
 +
* '''TYPE_RANDOM'''''_LFB'' : puts an image from a random set on a tile
 +
* '''TYPE_RESTRICTED[23]'''''_PLFB'': puts an image on a tile if the tile has one [two or three] neighbours of a given type
 +
* '''TYPE_RESTRICTED[23]_RANDOM'''''_PLFB'': combination of above
 +
* '''TYPE_ROTATION_RESTRICTED[23]'''''_PLFB'': combination of above + the images will be named according to where the neighbours are
 +
* '''TYPE_ROTATION_RESTRICTED[23]_RANDOM'''''_PLFB'': combination of above
  
== Common Parameters ==
+
here ''_PLFB'' means any combination of _P _PL _PF etc... will also be correct macro names with the corresponding parameters
  
These parameters are very common in animations, we document them here to avoid repetition
+
each section describing a type will explain what values for PLFB are used for the functions that don't have them as parameters
* '''PROB''' : The probability of the rules generated by the macros of being applied. See the discussion in [[TerrainGraphicsTutorial#Cumulative_Probabilities]] for complications
+
 
* '''LAYER''' : The layer that will be used for the generated rules
+
=== Macro Parameters ===
* '''BUILDER''' : the builder macro that will be used to create the animations  in the image= field of the generated terrain code. See the dicussion at the begining of the builder section
+
 
 +
These macros always have the parameters in the same orders (not all macros have all parameters, see below
 +
 
 +
TERRAIN ADJACENT PROB LAYER FLAG BUILDER IMAGESTEM
 +
 
 +
* '''TERRAIN''' : the type of terrain to put the image on
 +
* '''ADJACENT''' : ''only for restricted'' the type of neighbours to test for
 +
* '''PROB''' : ''only for _P'' The probability of the rules generated by the macros of being applied.
 +
* '''LAYER''' : ''only for _L'' The layer that will be used for the generated rules
 +
* '''FLAG''' : ''only for _F'' A flag to test and set on the tile
 +
* '''BUILDER''' : ''only for _B'' the builder macro that will be used to create the animations  in the image= field of the generated terrain code. See the dicussion at the begining of the builder section
 
* '''IMAGESTEM''': the basename on which filenames will be based.
 
* '''IMAGESTEM''': the basename on which filenames will be based.
 +
 +
 +
=== Image Names ===
 +
* '''_RANDOM_'''
 +
** {{BUILDER} {IMAGESTEM} ()}
 +
** {{BUILDER} {IMAGESTEM}2 ()}
 +
** {{BUILDER} {IMAGESTEM}3 ()}
 +
** ''etc up to 11''
 +
* '''_ROTATION_'''
 +
** '''1''' : {{BUILDER} {IMAGESTEM} (-@R0)} with @R0 being the orientation of the neighbouring tile
 +
** '''2''' : {{BUILDER} {IMAGESTEM} (-@R0-@R1)} with @R0 and @R1 being the orientations of the neighbouring tiles
 +
** '''3''' : {{BUILDER} {IMAGESTEM} (-@R0-@R1-@R2)} with @R0, @R1 and @R2 being the orientations of the neighbouring tiles
 +
* '''_RANDOM_ + _ROTATION_'''
 +
** {{BUILDER} {IMAGESTEM}# (-@R#)} ''similar to above with all combinations''
 +
 +
== The TEST_COMPLETE macro ==
 +
 +
there is one more macro which exist for most families of macro
 +
 +
#define TYPE_COMPLETE_LFB TERRAIN ADJACENT LAYER FLAG BUILDER IMAGESTEM
 +
    {TYPE_ROTATION_RESTRICTED3_RANDOM_LFB  ({TERRAIN})  ({ADJACENT}) {LAYER} {FLAG} {BUILDER} {IMAGESTEM}-small (-@R0-@R1-@R2)}
 +
    {TYPE_ROTATION_RESTRICTED2_RANDOM_LFB  ({TERRAIN})  ({ADJACENT}) {LAYER} {FLAG} {BUILDER} {IMAGESTEM}-small (-@R0-@R1)}
 +
    {TYPE_ROTATION_RESTRICTED_RANDOM_LFB  ({TERRAIN})  ({ADJACENT}) {LAYER} {FLAG} {BUILDER} {IMAGESTEM}-small (-@R0)}
 +
    {TYPE_RESTRICTED_RANDOM_LFB            ({TERRAIN})  ({ADJACENT}) {LAYER} {FLAG} {BUILDER} {IMAGESTEM}-small ()}
 +
    {TYPE_SINGLE_RANDOM_LFB                ({TERRAIN})              {LAYER} {FLAG} {BUILDER} {IMAGESTEM}}
 +
#enddef
 +
 +
This macro is a simpler way of handling the most common case of "use a smaller variation when next to some terrains"
 +
 +
* If it has three neighbours, it will try IMAGESTEM-small#-R1-R2-R3
 +
* if it has two neighbour or the correct image wasn't found, it will try two-sided variations
 +
* if it has one neighbour or the correct image wasn't found, it will try one sided variations
 +
* if it has still not found anything, it will try IMAGESTEM-small
 +
* if it has no neighbour or still hasn't found anything, it will try based on IMAGESTEM
  
 
== Image Builder macros ==
 
== Image Builder macros ==
Line 157: Line 196:
  
 
== Base tile related macros ==
 
== Base tile related macros ==
These are the main macros to attach an image to the tile
 
=== KEEP_BASE TERRAINLIST P=PROB=100 L=LAYER=-1 F=FLAG=base B=BUILDER=IMAGE_SINGLE IMAGESTEM ===
 
  
This macro will add a tile on a single hex using IMAGESTEM as the image
+
Base terrains have all the combinations of macros as described in the naming convention section with the following definition
  
''''The layer is forced to 1''''
+
* '''TYPE''' : the name for all macros starts with '''TERRAIN_BASE'''
 
+
* '''PROB''' : 100
''' Images Used '''
+
* '''LAYER''': -1000
* IMAGESTEM.png
+
* '''FLAG'''': ''base''
''' Flag Management '''
+
* '''BUILDER''': IMAGE_SINGLE
* ''base'' is checked and set
 
''' Parameters '''
 
* '''TERRAIN_PATTERN''': a regexp describing the hex where this rule should be applied
 
 
 
=== TERRAIN_BASE TERRAIN P=PROB=100 L=LAYER=-1000 F=FLAG=base B=BUILDER=IMAGE_SINGLE IMAGESTEM ===
 
adds the base tile for matching hex (single hex)
 
 
 
''' Images Used '''
 
IMAGESTEM
 
 
 
''' Parameters '''  
 
* '''TERRAIN''': regexp for terrain to match
 
* '''FLAG''': this flag is set/checked for when matching terrain
 
 
 
=== TERRAIN_BASE_RANDOM TERRAINLIST L=LAYER=-1000 F=FLAG=base IMAGESTEM ===
 
similar to TERRAIN_BASE but takes an image from a set built from IMAGESTEM
 
 
 
''' Images Used '''
 
* {IMAGESTEM}
 
* {IMAGESTEM}2
 
* {IMAGESTEM}3
 
* {IMAGESTEM}4
 
* {IMAGESTEM}5
 
* {IMAGESTEM}6
 
* {IMAGESTEM}7
 
* {IMAGESTEM}8
 
* {IMAGESTEM}9
 
 
 
 
 
''' Parameters '''  
 
* '''TERRAIN''': regexp for terrain to match
 
* '''FLAG''': this flag is set/checked for when matching terrain
 
  
 
== Overlay related macros==
 
== Overlay related macros==
  
=== OVERLAY TERRAINLIST P=PROB=100 L=LAYER=0 F=FLAG=overlay B=BUILDER=IMAGE_SINGLE IMAGESTEM ===
+
Overlays have all the combinations of macros as described in the naming convention section with the following definition
 
 
adds the IMAGESTEM overlay on matching hex
 
  
note that the images are placed with the following parameters
+
* '''TYPE''' : the name for all macros starts with '''OVERLAY'''
* base=90,144
+
* '''PROB''' : 100
* center=90,144
+
* '''LAYER''': 0
 +
* '''FLAG'''': ''overlay''
 +
* '''BUILDER''': IMAGE_SINGLE
  
''' Images Used '''
+
== Keep related macros ==
IMAGESTEM
 
  
''' Parameters '''
+
Keeps are base terrains (they use the same flag) but drawn on layer -1
* '''TERRAINLIST''': regexp for terrain to match
 
* '''FLAG''': this flag is set/checked for when matching terrain
 
  
''' Flage management '''
+
Keeps have all the combinations of macros as described in the naming convention section with the following definition
the FLAG parameter is test and set
 
  
=== OVERLAY_RANDOM TERRAIN L=LAYER=0 F=FLAG=overlay IMAGESTEM ===
+
* '''TYPE''' : the name for all macros starts with '''KEEP_BASE'''
=== OVERLAY_RANDOM TERRAIN L=LAYER=0 F=FLAG=overlay B=BUILDER=IMAGE_SINGLE IMAGESTEM ===
+
* '''PROB''' : 100
 +
* '''LAYER''': -1
 +
* '''FLAG'''': ''base''
 +
* '''BUILDER''': IMAGE_SINGLE
  
similar to OVERLAY but takes an image from a random set
+
== Village related macros ==
 
 
note that the images are placed with the following parameters
 
* base=90,144
 
* center=90,144
 
 
 
''' Images Used '''
 
* {IMAGESTEM}
 
* {IMAGESTEM}2
 
* {IMAGESTEM}3
 
* {IMAGESTEM}4
 
* {IMAGESTEM}5
 
* {IMAGESTEM}6
 
* {IMAGESTEM}7
 
* {IMAGESTEM}8
 
* {IMAGESTEM}9
 
 
 
''' Parameters '''
 
* '''TERRAINLIST''': regexp for terrain to match
 
* '''FLAG''': this flag is set/checked for when matching terrain
 
 
 
''' Flage management '''
 
the FLAG parameter is test and set
 
 
 
=== OVERLAY_RESTRICTED TERRAIN ADJACENT P=PROB=100 L=LAYER=0 F=FLAG=overlay IMAGESTEM ===
 
 
 
similar to OVERLAY but the tile must be next to at least one ADJACENT
 
 
 
note that the images are placed with the following parameters
 
* base=90,144
 
* center=90,144
 
 
 
''' Images Used '''
 
* {IMAGESTEM}
 
 
 
 
 
''' Parameters '''
 
* '''TERRAINLIST''': regexp for terrain to match
 
* '''FLAG''': this flag is set/checked for when matching terrain
 
* '''ADJACENT''': regexp describing what the tile must be next to
 
''' Flage management '''
 
the FLAG parameter is test and set
 
 
 
=== OVERLAY_RESTRICTED2 TERRAIN ADJACENT P=PROB=100 L=LAYER=0 F=FLAG=overlay IMAGESTEM ===
 
similar to OVERLAY but the tile must be next to at least two ADJACENT
 
 
 
note that the images are placed with the following parameters
 
* base=90,144
 
* center=90,144
 
 
 
''' Images Used '''
 
* {IMAGESTEM}
 
 
 
 
 
''' Parameters '''
 
* '''TERRAINLIST''': regexp for terrain to match
 
* '''FLAG''': this flag is set/checked for when matching terrain
 
* '''ADJACENT''': regexp describing what the tile must be next to
 
''' Flage management '''
 
the FLAG parameter is test and set
 
  
  
=== OVERLAY_RESTRICTED3 TERRAIN ADJACENT P=PROB=100 L=LAYER=0 F=FLAG=overlay IMAGESTEM ===
+
villages have all the combinations of macros as described in the naming convention section with the following definition
  
similar to OVERLAY but the tile must be next to at least three ADJACENT
+
* '''TYPE''' : the name for all macros starts with '''VILLAGE'''
 
+
* '''PROB''' : 100
note that the images are placed with the following parameters
+
* '''LAYER''': 0
* base=90,144
+
* '''FLAG'''': ''village''
* center=90,144
+
* '''BUILDER''': IMAGE_SINGLE
 
 
''' Images Used '''
 
* {IMAGESTEM}
 
 
 
 
 
''' Parameters '''
 
* '''TERRAINLIST''': regexp for terrain to match
 
* '''FLAG''': this flag is set/checked for when matching terrain
 
* '''ADJACENT''': regexp describing what the tile must be next to
 
''' Flage management '''
 
the FLAG parameter is test and set
 
 
 
 
 
=== OVERLAY_ROTATION_RESTRICTED TERRAIN  ADJACENT P=PROB=100 L=LAYER=0 F=FLAG=overlay IMAGESTEM ===
 
 
 
 
 
will place on TERRAIN with at least one ADJACENT, but will add an -@R# to IMAGESTEM to show on which side the ADJACENT is
 
 
 
note that the images are placed with the following parameters
 
* base=90,144
 
* center=90,144
 
 
 
''' Images Used '''
 
* {IMAGESTEM}-@R0 (''n,ne,se,s,sw,nw'' : the direction of ADJACENT)
 
 
 
 
 
''' Parameters '''
 
* '''TERRAIN''': regexp for terrain to match
 
* '''FLAG''': this flag is set/checked for when matching terrain
 
* '''ADJACENT''': regexp describing what the tile must be next to
 
''' Flage management '''
 
the FLAG parameter is test and set on the TERRAIN tile
 
 
 
=== OVERLAY_ROTATION_RESTRICTED2 TERRAIN  ADJACENT P=PROB=100 L=LAYER=0 F=FLAG=overlay IMAGESTEM ===
 
 
 
will place on TERRAIN with at least two neighbouring ADJACENT, but will add an -@R#-@R# to IMAGESTEM to show on which side the ADJACENT are
 
 
 
note that the images are placed with the following parameters
 
* base=90,144
 
* center=90,144
 
 
 
''' Images Used '''
 
* {IMAGESTEM}-@R0-@R1 (''n,ne,se,s,sw,nw'' : the direction of ADJACENT)
 
 
 
 
 
''' Parameters '''
 
* '''TERRAIN''': regexp for terrain to match
 
* '''FLAG''': this flag is set/checked for when matching terrain
 
* '''ADJACENT''': regexp describing what the tile must be next to
 
''' Flage management '''
 
the FLAG parameter is test and set on the TERRAIN tile
 
  
 
== Transition related macros ==
 
== Transition related macros ==
=== TRANSITION_BASE TERRAIN ADJACENT P=PROB=100 L=LAYER=-500 F=FLAG=transition B=BUILDER=IMAGE_SINGLE IMAGESTEM ===
 
 
This is the most basic form of transition, it will try to put a transition between the tile TERRAIN and ADJACENT
 
 
It will try to find the best matching image (with ''n,ne,se,s,sw,nw'' for @R flags)
 
  
i.e if your TERRAIN matches 2 ADJACENT tiles,
+
=== Generic Functions ===
* it will not match for 4 sided and 3 sided images
+
transitions have most of the macros as described in the naming convention section with the following definition
* it will try 2 sided transitions with PROB (see also the FLAG discussion below)
 
* if it doesn't match it will 1 sided transition similarly
 
  
'''Images Used'''
+
* '''TYPE''' : the name for all macros starts with '''TRANSITION'''
* {{BUILDER} {IMAGESTEM} -@R0-@R1-@R2-@R3}
+
* '''PROB''' : 100
* {{BUILDER} {IMAGESTEM} -@R0-@R1-@R2}
+
* '''LAYER''': -500
* {{BUILDER} {IMAGESTEM} -@R0-@R1}
+
* '''FLAG''': ''transition-@<side>''
* {{BUILDER} {IMAGESTEM} -@R0}
+
* '''BUILDER''': IMAGE_SINGLE
'''Flag Management'''
 
  
This macro checks flags according to the common transition policy, i.e it will check that both this tile and the ADJACENT neighbours don't have the transition-@R# flags before applying.
 
  
suppose our TERRAIN has two ADJACENT on north and north east
+
However, unlike all previous type of macros, they are related to a ''side'' instead of the whole hex. Thus the following rules
  
it will check the following flags before adding {{BUILDER} {IMAGESTEM} -n-ne}
+
* There are no ROTATION macros. Since they are always side related.
* TERRAIN has neither transition-n nor transition-ne set
+
* All images are named as if they were ROTATION macros since they are all side related
* the north ADJACENT doesn't have transition-s set
+
* There is no SINGLE variation since it doesn't make sense to have it (a side is always relative to two hex)
* the north east ADJACENT doesn't have transition-sw set
+
* The flags are set and tested on a side related basis. i.e there can be more than one transition per tile, if they don't cover the same direction
if the conditions are met, it will apply the transition and set all the flags mentionned above
+
* for RESTRICTED2 and RESTRICTED3, we only check for neighbouring hex of the ADJACENT type. This makes more sense for borders
 +
* the COMPLETE variant looks as follows
  
it will then try to apply {{BUILDER} {IMAGESTEM} -n} and check the following flags
 
* TERRAIN has neither transition-n set
 
* the north ADJACENT doesn't have transition-s set
 
(note that if the first rule applied, it will have set some flags and this rule will always fail)
 
again, if it can apply, it will set the flags mentionned above
 
  
it will then try to apply {{BUILDER} {IMAGESTEM} -ne} and check the following flags
+
#define BORDER_COMPLETE_LFB TERRAIN ADJACENT LAYER FLAG BUILDER IMAGESTEM
* TERRAIN has neither transition-ne set
+
    {BORDER_RESTRICTED3_RANDOM_LFB  ({TERRAIN})  ({ADJACENT}) {LAYER} {FLAG} {BUILDER} {IMAGESTEM}}
* the north ADJACENT doesn't have transition-sw set
+
    {BORDER_RESTRICTED2_RANDOM_LFB  ({TERRAIN})  ({ADJACENT}) {LAYER} {FLAG} {BUILDER} {IMAGESTEM}}
(note that if the first rule applied, it will have set some flags and this rule will always fail, however this rule could be applied with the second rule above since no flag contradict)
+
    {BORDER_RESTRICTED_RANDOM_LFB  ({TERRAIN})  ({ADJACENT}) {LAYER} {FLAG} {BUILDER} {IMAGESTEM}}
again, if it can apply, it will set the flags mentionned above
+
    {BORDER_RESTRICTED_RANDOM_LFB  ({TERRAIN})  ({ADJACENT}) {LAYER} {FLAG} {BUILDER} {IMAGESTEM}}
 +
#enddef
  
 
=== DISABLE_BASE_TRANSITIONS TERRAINLIST ===
 
=== DISABLE_BASE_TRANSITIONS TERRAINLIST ===
Line 390: Line 272:
 
'''Flag Management'''
 
'''Flag Management'''
 
will set all transition-@R* on the TERRAINLIST tiles
 
will set all transition-@R* on the TERRAINLIST tiles
 +
=== DISABLE_BASE_TRANSITIONS_F TERRAINLIST FLAG ===
 +
This macro will set all <FLAG>-@R* on the tile (''n,ne,se,s,sw'')  thus preventing any other transition from being added
  
== Village related macros ==
+
'''Flag Management'''
=== VILLAGE_RANDOM TERRAINLIST IMAGESTEM ===
+
will set all <FLAG>-@R* on the TERRAINLIST tiles
equivalent to {OVERLAY_RANDOM_LF ({TERRAINLIST}) 0 village {IMAGESTEM} }
+
 
 +
== Track Type macros ==
 +
 
 +
These macros handle anything that is layed in a connected way over multiple tiles (typically bridges and tiles)
  
i.e puts a village on layer 0 using the ''village'' flag
+
=== the TRACK macro ===
=== VILLAGE TERRAIN P=PROB=100 L=LAYER=0 F=FLAG=village B=BUILDER=IMAGE_SINGLE IMAGESTEM ===
 
equivalent to {OVERLAY_PLFB ({TERRAIN}) {PROB} {LAYER} {FLAG} {BUILDER} {IMAGESTEM} }
 
  
the point is to have different default arguments (in particular
+
'''TRACK_''LF'' <NWSEterrain> <NSterrain> <NESWterrain> <basename'''
  
== TO BE DOCUMENTED ==
+
This macro will add the base terrain on the three terrains corresponding to the three directions.This macro will awlays take random variations, and defaults to layer -80 with flag=overlay
=== misc ideas ===
 
* move/get rid of KEEP_BASE, move stuff from random.cfg and tiles.cfg to base.cfg so all stuff related to the base tile is in base.cfg
 
* get rid of deprecated macros
 
* the macros TERRAIN_BASE_RANDOM and OVERLAY_RANDOM and TERRAIN_BASE/OVERLAY could be merged into one function
 
* unify the way overlay/village/base (including random) macros work to all call a common backend with different default parameters
 
  
=== misc.cfg ===
+
The images used are named
#meta-macro WALL_TRANSITION TERRAIN ADJACENT P=PROB=100 L=LAYER=0 F=FLAG=overlay IMAGESTEM
+
* base#-ns.png : non-connected on a north-south orientation,
#meta-macro WALL_TRANSITION2 TERRAIN1 TERRAIN2 ADJACENT P=PROB=100 L=LAYER=0 F=FLAG=overlay IMAGESTEM
+
* base#-nesw.png : non connected on a north-east south-west orientation
#meta-macro WALL_TRANSITION3 TERRAIN1 TERRAIN2 TERRAIN3 P=PROB=100 L=LAYER=0 F=FLAG=overlay IMAGESTEM
+
* base#-senw.png : non connected on a south-east north-west orientation
 +
* base#-<connections> : tile used when the bridge is connected on the corresponding sides (separated by '-', ordered clockwise starting with north)
  
#define SIMPLE_OVERLAY_TERRAIN TERRAINLIST RESTRICTING IMAGESTEM
+
'''NOTE:''' the engine will use the straight tile when it doesn't find any fitting tile
  
=== bridges.cfg ===
+
'''NOTE:''' if some connection tiles don't seem to be used properly, please post a screenshot from the editor with terrain names enabled and contact boucman
#define IMAGE_L_N LAYER NAME
 
#define DOCK_END IMAGESTEM WATER_TERRAIN_NAME BRIDGETYPE_NAME BEACHSIDE_AFFIX X Y
 
#define RAMP_BRIDGE IMAGESTEM BRIDGETYPE_NAME BRIDGES_VALUE R0 R1 R2 R3 R4 R5 S0 S1 S2 S3 S4 S5
 
#define RAMP_END IMAGESTEM WATER_TERRAIN_NAME NOTERM_AFFIX BRIDGETYPE_NAME R0 R1 R2 R3 R4 R5 X Y
 
#define BRIDGE_Y BRIDGETYPE1_NAME BRIDGETYPE2_NAME BRIDGETYPE3_NAME Y_IMAGE R0 R1 R2 R3 R4 R5 S0 S1 S2 S3 S4 S5
 
#define BRIDGECONNECT BRIDGETYPE_NAME R0 R1 R2 R3 R4 R5 X Y
 
#define CORNER ANGLE_IMAGE BRIDGETYPE1_NAME BRIDGETYPE2_NAME A1 A2 A3 A4 A5 A6 S0 S1 S2 S3 S4 S5
 
#define BRIDGE SE_NW_VALUE N_S_VALUE NE_SW_VALUE WATER_TERRAIN_NAME NOTERM_AFFIX IMAGESTEM
 
  
 +
'''NOTE''' you will notice that there is no builder. Builders are incompatible with bridges (in other word,the IMAGE_SINGLE builder is hardwired)
  
 +
=== Transition related macros ===
 +
Bridges are tricky because you usually don't want the same transitions depending if the bridge ends on a given edge or not.
  
=== canyon.cfg ===
+
The following macros help
#define TRANS_0 TERRAIN
 
#define TRANS_1 TERRAIN
 
#define TRANS_2 TERRAIN
 
#define TRANS_3 TERRAIN
 
#define TRANS_4 TERRAIN
 
#define TRANS_5 TERRAIN
 
#define CANYON TERRAIN IMAGESTEM
 
=== castles.cfg ===
 
#define TERRAIN_ADJACENT_CORNER_LAYER TERRAIN1 TERRAIN2 TERRAIN3 LAYER BASE_POSITION IMAGESTEM
 
#define TERRAIN_ADJACENT_CORNER TERRAIN1 TERRAIN2 TERRAIN3 BASE_POSITION IMAGESTEM
 
#define TERRAIN_ADJACENT_CORNER_FLAG1 TERRAIN1 TERRAIN2 TERRAIN3 BASE_POSITION FLAG IMAGESTEM
 
#define TERRAIN_ADJACENT_CORNER_PROB TERRAIN1 TERRAIN2 TERRAIN3 BASE_POSITION IMAGESTEM PROB
 
=== foresetcastle.cfg ===
 
#define FORESTADJCASTLEA FOREST_ID ID PROB TILE_IMAGE
 
#define FORESTADJCASTLES FOREST_ID ID PROB TILE_IMAGE
 
#define FORESTADJCASTLEO FOREST_ID ID PROB TILE_IMAGE
 
#define FORESTADJCASTLE FOREST_ID ID PROB TILE_IMAGE
 
#define FORESTADJ FOREST_ID ID PROB TILE_IMAGE
 
#define MOUNTAINADJCASTLEA FOREST_ID ID PROB TILE_IMAGE
 
=== forest.cfg ===
 
#define SINGLE_FOREST_TILE TERRAINLIST PROB IMAGESTEM
 
#define SINGLE_FOREST_TILE_RESTRICTED TERRAINLIST ADJACENT PROB IMAGESTEM
 
#define SIMPLE_FOREST_TERRAIN TERRAINLIST ADJACENT IMAGESTEM
 
=== mountains.cfg ===
 
#define MOUNTAINS_2x2 TERRAIN PROB FLAG IMAGESTEM
 
#define MOUNTAINS_2x4_NW_SE TERRAIN PROB FLAG IMAGESTEM
 
#define MOUNTAINS_2x4_SW_NE TERRAIN PROB FLAG IMAGESTEM
 
#define MOUNTAINS_1x3_NW_SE TERRAIN PROB FLAG IMAGESTEM
 
#define MOUNTAINS_1x3_SW_NE TERRAIN PROB FLAG IMAGESTEM
 
#define MOUNTAIN_SINGLE TERRAIN PROB FLAG IMAGESTEM
 
#define PEAKS_LARGE TERRAIN PROB FLAG IMAGESTEM
 
#define PEAKS_1x2_SW_NE TERRAIN PROB FLAG IMAGESTEM
 
=== rails.cfg ===
 
#define RAIL_SWITCH IMAGESTEM BRIDGETYPE_NAME BRIDGETYPE_JOIN_NAME SWITCHSIDE_AFFIX MAINRAIL_AFFIX SWITCH_REVERSE_AFFIX X Y
 
#define RAIL_END IMAGESTEM BRIDGETYPE_NAME TRACKSIDE_AFFIX X Y
 
#define RAILWAY SE_NW_VALUE N_S_VALUE NE_SW_VALUE IMAGESTEM
 
  
=== walls.cfg ===
+
'''TRACK_BORDER_RESTRICTED_''PLF'' <terrain> <adjacent> <IMAGE>'''
#define IMAGE_NW BUILDER IMAGESTEM
 
#define IMAGE_N BUILDER IMAGESTEM
 
#define IMAGE_NE BUILDER IMAGESTEM
 
#define IMAGE_SE BUILDER IMAGESTEM
 
#define IMAGE_S BUILDER IMAGESTEM
 
#define IMAGE_SW BUILDER IMAGESTEM
 
#define IMAGE_NW_N BUILDER IMAGESTEM
 
#define IMAGE_N_NE BUILDER IMAGESTEM
 
#define IMAGE_NE_SE BUILDER IMAGESTEM
 
#define IMAGE_SE_S BUILDER IMAGESTEM
 
#define IMAGE_S_SW BUILDER IMAGESTEM
 
#define IMAGE_SW_NW BUILDER IMAGESTEM
 
#define IMAGE_NW_N_NE BUILDER IMAGESTEM
 
#define IMAGE_N_NE_SE BUILDER IMAGESTEM
 
#define IMAGE_NE_SE_S BUILDER IMAGESTEM
 
#define IMAGE_SE_S_SW BUILDER IMAGESTEM
 
#define IMAGE_S_SW_NW BUILDER IMAGESTEM
 
#define IMAGE_SW_NW_N BUILDER IMAGESTEM
 
#define IMAGE_N_NE_SE_S BUILDER IMAGESTEM
 
#define IMAGE_S_SW_NW_N BUILDER IMAGESTEM
 
#define IMAGE_NW_N_NE_SE BUILDER IMAGESTEM
 
#define IMAGE_SW_NW_N_NE BUILDER IMAGESTEM
 
#define IMAGE_NE_SE_S_SW BUILDER IMAGESTEM
 
#define IMAGE_SE_S_SW_NW BUILDER IMAGESTEM
 
#define IMAGE_NW_N_NE_SE_S BUILDER IMAGESTEM
 
#define IMAGE_N_NE_SE_S_SW BUILDER IMAGESTEM
 
#define IMAGE_NE_SE_S_SW_NW BUILDER IMAGESTEM
 
#define IMAGE_SE_S_SW_NW_N BUILDER IMAGESTEM
 
#define IMAGE_S_SW_NW_N_NE BUILDER IMAGESTEM
 
#define IMAGE_SW_NW_N_NE_SE BUILDER IMAGESTEM
 
#define IMAGE_N_NE_SE_S_SW_NW BUILDER IMAGESTEM
 
#define WALL_1_VARIATION PROB TERRAIN_PATTERN ADJACENT BUILDER IMAGESTEM
 
#define WALL_ADJACENT_1 TERRAIN_PATTERN ADJACENT BUILDER IMAGESTEM
 
#define WALL_2_VARIATION PROB TERRAIN_PATTERN ADJACENT BUILDER IMAGESTEM
 
#define WALL_ADJACENT_2 TERRAIN_PATTERN ADJACENT BUILDER IMAGESTEM
 
#define WALL_ADJACENT_3 TERRAIN_PATTERN ADJACENT BUILDER IMAGESTEM
 
#define WALL_ADJACENT_4 TERRAIN_PATTERN ADJACENT BUILDER IMAGESTEM
 
#define WALL_ADJACENT_5 TERRAIN_PATTERN ADJACENT BUILDER IMAGESTEM
 
#define WALL_ADJACENT_6 TERRAIN_PATTERN ADJACENT BUILDER IMAGESTEM
 
#define DISABLE_WALLS TERRAIN1 TERRAIN2 TERRAIN3
 
#define WALL_ADJACENT TERRAIN_PATTERN ADJACENT BUILDER IMAGESTEM BASE_NAME
 
  
=== adjacent.cfg ===
+
Will match only if terrain is a bridge, on the side matching adjacent, and if the bridge does have a connection or ending on the given side.
* #define TERRAIN_ADJACENT_4_FL LAYER TERRAIN ADJACENT IMAGESTEM FLAG
 
* #define TERRAIN_ADJACENT_3_FL LAYER TERRAIN ADJACENT IMAGESTEM FLAG
 
* #define TERRAIN_ADJACENT_2_FL LAYER TERRAIN ADJACENT IMAGESTEM FLAG
 
* #define TERRAIN_ADJACENT_1_FL LAYER TERRAIN_PATTERN ADJACENT IMAGESTEM FLAG
 
* #define TERRAIN_ADJACENT_FL LAYER TERRAIN_PATTERN ADJACENT IMAGESTEM FLAG
 
* #define TERRAIN_ADJACENT LAYER TERRAIN_PATTERN ADJACENT IMAGESTEM
 
* #define TERRAIN_ADJACENT_OV LAYER TERRAIN_PATTERN ADJACENT IMAGESTEM
 
* #define TERRAIN_ADJACENT_CUSTOM LAYER TERRAIN_PATTERN ADJACENT IMAGESTEM FLAG
 
* #define TERRAIN_ADJACENT_3_DIFFERENT LAYER TERRAIN_PATTERN ADJACENT OTHER_TERRAIN_PATTERN IMAGESTEM FLAG
 
=== base.cfg ===
 
* #define TERRAIN_BASE_PROB_FL TERRAIN_PATTERN IMAGESTEM PROB FLAG LAYER
 
* #define TERRAIN_BASE_FL TERRAIN_PATTERN IMAGESTEM FLAG LAYER
 
* #define TERRAIN_BASE_PROB TERRAIN_PATTERN IMAGESTEM PROB
 
* #define TERRAIN_BASE_PROB_OV TERRAIN_PATTERN IMAGESTEM PROB
 
* #define TERRAIN_BASE_OV TERRAIN_PATTERN IMAGESTEM
 
* #define TERRAIN_BASE_DEFAULT IMAGESTEM
 
  
=== builder.cfg ===
+
Note that adjacent can be a bridge too, but this macro won't check that adjacent exits on the corresponding side
* #define ANIMATION_01_INTERNAL IMAGESTEM POSTFIX DURATION
 
* #define ANIMATION_02_INTERNAL IMAGESTEM POSTFIX DURATION
 
* #define ANIMATION_03_INTERNAL IMAGESTEM POSTFIX DURATION
 
* #define ANIMATION_04_INTERNAL IMAGESTEM POSTFIX DURATION
 
* #define ANIMATION_05_INTERNAL IMAGESTEM POSTFIX DURATION
 
* #define ANIMATION_06_INTERNAL IMAGESTEM POSTFIX DURATION
 
* #define ANIMATION_07_INTERNAL IMAGESTEM POSTFIX DURATION
 
* #define ANIMATION_08_INTERNAL IMAGESTEM POSTFIX DURATION
 
* #define ANIMATION_09_INTERNAL IMAGESTEM POSTFIX DURATION
 
* #define ANIMATION_10_INTERNAL IMAGESTEM POSTFIX DURATION
 
* #define ANIMATION_11_INTERNAL IMAGESTEM POSTFIX DURATION
 
* #define ANIMATION_12_INTERNAL IMAGESTEM POSTFIX DURATION
 
* #define ANIMATION_13_INTERNAL IMAGESTEM POSTFIX DURATION
 
* #define ANIMATION_14_INTERNAL IMAGESTEM POSTFIX DURATION
 
* #define ANIMATION_15_INTERNAL IMAGESTEM POSTFIX DURATION
 
* #define ANIMATION_16_INTERNAL IMAGESTEM POSTFIX DURATION
 
* #define ANIMATION_17_INTERNAL IMAGESTEM POSTFIX DURATION
 
* #define ANIMATION_18_INTERNAL IMAGESTEM POSTFIX DURATION
 
* #define BUILD_IMAGE BUILDER IMAGESTEM POSTFIX
 
=== building.cfg ===
 
this file needs probably be removed it's dangerous since it sets flags that are unused anywhere else
 
* #define BUILDING TERRAIN IMAGE_WML
 
* #define BUILDING_PROBABILITY TERRAIN IMAGE_WML PROB
 
  
=== compat.cfg ===
+
the image will be drawn on the <terrain> hex with the orientation appended to it
* #define TERRAIN_ADJACENT_CORNER_BOTH INNER_TERRAIN_PATTERN OUTER_TERRAIN_PATTERN IMAGESTEM
 
* #define TERRAIN_OVERLAY_PROB TERRAIN_PATTERN FLAG PROB IMAGESTEM
 
* #define SHEX TYPE FLAG PROB TILE_NAME
 
* #define SHEX_DOUBLE TYPE FLAG PROB TILE1_NAME TILE2_NAME
 
* #define SHEX_LAYER TYPE FLAG LAYER PROB TILE_NAME
 
=== corner_overlay.cfg ===
 
* #meta-macro CORNER_OVERLAY TERRAIN ADJACENT1 ADJACENT2 P=PROB=100 L=LAYER=0 B=BASE=(54,72) F=FLAG=overlay IMAGE
 
* #define DISABLE_CORNER_TRANSITIONS_F TERRAIN FLAG
 
* #define DISABLE_CORNER_TRANSITIONS TERRAIN
 
  
=== restricted-transitions ===
+
'''TRACK_BORDER_RESTRICTED_RANDOM_''LF''''' similar, with random variations
* #define OVERLAY_RESTRICTED2_N_NE_PLF TERRAIN ADJACENT PROB LAYER FLAG IMAGESTEM
 
* #define OVERLAY_RESTRICTED2_N_SE_PLF TERRAIN ADJACENT PROB LAYER FLAG IMAGESTEM
 
* #define OVERLAY_RESTRICTED2_N_S_PLF TERRAIN ADJACENT PROB LAYER FLAG IMAGESTEM
 
* #define OVERLAY_RESTRICTED3_N_NE_SE_PLF TERRAIN ADJACENT PROB LAYER FLAG IMAGESTEM
 
* #define OVERLAY_RESTRICTED3_N_NE_S_PLF TERRAIN ADJACENT PROB LAYER FLAG IMAGESTEM
 
* #define OVERLAY_RESTRICTED3_N_NE_SW_PLF TERRAIN ADJACENT PROB LAYER FLAG IMAGESTEM
 
* #define OVERLAY_RESTRICTED3_N_SE_SW_PLF TERRAIN ADJACENT PROB LAYER FLAG IMAGESTEM
 
  
=== transitions_base ===
+
== See Also ==
* #define TRANSITION1_BASE_PLFB TERRAIN ADJACENT PROB LAYER FLAG BUILDER IMAGESTEM
+
* [[Terrain]]
* #define TRANSITION2_BASE_PLFB TERRAIN ADJACENT PROB LAYER FLAG BUILDER IMAGESTEM
+
* [[TerrainWML]]
* #define TRANSITION3_BASE_PLFB TERRAIN ADJACENT PROB LAYER FLAG BUILDER IMAGESTEM
+
* [[TerrainGraphicsWML]]
* #define TRANSITION4_BASE_PLFB TERRAIN ADJACENT PROB LAYER FLAG BUILDER IMAGESTEM
+
* [https://www.wesnoth.org/macro-reference.html WML Macros]
* #define DISABLE_BASE_TRANSITIONS_F TERRAIN FLAG
 
  
=== transitions_overlay ===
+
[[Category:WML_Reference]]
* #meta-macro TRANSITION1_OVERLAY TERRAIN  ADJACENT P=PROB=100 L=LAYER=0 F=FLAG=overlay IMAGE
 
* #meta-macro TRANSITION2_OVERLAY TERRAIN  ADJACENT P=PROB=100 L=LAYER=0 F=FLAG=overlay IMAGE
 
=== util.cfg ===
 
* #define VIMG BASE_STRING NAME_STRING
 
* #define DISABLE_TRANSITIONS TERRAIN_PATTERN
 
* #define FLAG_IF_ADJACENT TERRAIN ADJACENT FLAG
 

Latest revision as of 17:44, 7 May 2023

Flag Management

This section lists the common flags used by macros and their high level signification

  • base: is set on all hex when the base tile is set.
  • overlay: is set on all hex that have something drawn on the hex itself (i.e not a transition) over the base terrain.
  • village: is set when a village is added on a tile.
  • transition-@R*: is set on a tile which has a transition on it's corresponding side set (i.e if there is a transition with the tile at its north, transition-n will be set) possible values: n,ne,nw,s,se,sw Also not that the macros handl it in a reciprocal way. in other word if a tile has transition-n set, it's northern neighbour should have transition-s set
  • overlay-connect-@R* : used for bridges, the bridge on this tile. The bridge "actually has" an "exit direction" in the @R direction indicated.
  • overlay-away-@R* : used for bridges, the bridge does NOT have an exit on the given direction, but would be expected to...


A note about overlay-@R and overlay-away-@R flags

Suppose we have a n->s bridge hex who's ne neighbour is a ne->sw bridge. This mean that the n->s is actually a turn in the bridge that should use a graphic depicting a s->ne corner.

In that case the tile will have overlay-s and overlay-ne set (the directions where the bridge actually exits) and overlay-away-n (the direction where the bridge would exit according to terrain codes, but doesnt because of overall layout)

Layer Management

  • -1000: default layer for base tiles
  • -80: overlays that should always be drawn under units (like rails etc...)
  • 0: default layer for overlays and villages

Normal units are drawn above layer 0, except if the basey of the tile is > 56 in which case they are drawn below

  • 1: used by the base tile of castles/keeps

Flying/moving units are always drawn over terrain

Precedence Management

TBSL

Base Management

TBSL

Macro naming convention

for some common types of tiles, we have a lot of variation of macros. To simplify, they follow a naming convention

Macro names

Type is the type of macros (like KEEP,OVERLAY etc...) we are using

  • TYPE_PLFB : puts an image on a tile
  • TYPE_RANDOM_LFB : puts an image from a random set on a tile
  • TYPE_RESTRICTED[23]_PLFB: puts an image on a tile if the tile has one [two or three] neighbours of a given type
  • TYPE_RESTRICTED[23]_RANDOM_PLFB: combination of above
  • TYPE_ROTATION_RESTRICTED[23]_PLFB: combination of above + the images will be named according to where the neighbours are
  • TYPE_ROTATION_RESTRICTED[23]_RANDOM_PLFB: combination of above

here _PLFB means any combination of _P _PL _PF etc... will also be correct macro names with the corresponding parameters

each section describing a type will explain what values for PLFB are used for the functions that don't have them as parameters

Macro Parameters

These macros always have the parameters in the same orders (not all macros have all parameters, see below

TERRAIN ADJACENT PROB LAYER FLAG BUILDER IMAGESTEM
  • TERRAIN : the type of terrain to put the image on
  • ADJACENT : only for restricted the type of neighbours to test for
  • PROB : only for _P The probability of the rules generated by the macros of being applied.
  • LAYER : only for _L The layer that will be used for the generated rules
  • FLAG : only for _F A flag to test and set on the tile
  • BUILDER : only for _B the builder macro that will be used to create the animations in the image= field of the generated terrain code. See the dicussion at the begining of the builder section
  • IMAGESTEM: the basename on which filenames will be based.


Image Names

  • _RANDOM_
    • {{BUILDER} {IMAGESTEM} ()}
    • {{BUILDER} {IMAGESTEM}2 ()}
    • {{BUILDER} {IMAGESTEM}3 ()}
    • etc up to 11
  • _ROTATION_
    • 1 : {{BUILDER} {IMAGESTEM} (-@R0)} with @R0 being the orientation of the neighbouring tile
    • 2 : {{BUILDER} {IMAGESTEM} (-@R0-@R1)} with @R0 and @R1 being the orientations of the neighbouring tiles
    • 3 : {{BUILDER} {IMAGESTEM} (-@R0-@R1-@R2)} with @R0, @R1 and @R2 being the orientations of the neighbouring tiles
  • _RANDOM_ + _ROTATION_
    • {{BUILDER} {IMAGESTEM}# (-@R#)} similar to above with all combinations

The TEST_COMPLETE macro

there is one more macro which exist for most families of macro

#define TYPE_COMPLETE_LFB TERRAIN ADJACENT LAYER FLAG BUILDER IMAGESTEM
   {TYPE_ROTATION_RESTRICTED3_RANDOM_LFB  ({TERRAIN})  ({ADJACENT}) {LAYER} {FLAG} {BUILDER} {IMAGESTEM}-small (-@R0-@R1-@R2)}
   {TYPE_ROTATION_RESTRICTED2_RANDOM_LFB  ({TERRAIN})  ({ADJACENT}) {LAYER} {FLAG} {BUILDER} {IMAGESTEM}-small (-@R0-@R1)}
   {TYPE_ROTATION_RESTRICTED_RANDOM_LFB   ({TERRAIN})  ({ADJACENT}) {LAYER} {FLAG} {BUILDER} {IMAGESTEM}-small (-@R0)}
   {TYPE_RESTRICTED_RANDOM_LFB            ({TERRAIN})  ({ADJACENT}) {LAYER} {FLAG} {BUILDER} {IMAGESTEM}-small ()}
   {TYPE_SINGLE_RANDOM_LFB                ({TERRAIN})               {LAYER} {FLAG} {BUILDER} {IMAGESTEM}}
#enddef

This macro is a simpler way of handling the most common case of "use a smaller variation when next to some terrains"

  • If it has three neighbours, it will try IMAGESTEM-small#-R1-R2-R3
  • if it has two neighbour or the correct image wasn't found, it will try two-sided variations
  • if it has one neighbour or the correct image wasn't found, it will try one sided variations
  • if it has still not found anything, it will try IMAGESTEM-small
  • if it has no neighbour or still hasn't found anything, it will try based on IMAGESTEM

Image Builder macros

The problem

suppose we want to animate a transition with the following line

image=image1;image2;image3

Since it's a transition, we would like to write something like (simplified)

{TRANSITION_BASE <parameters> image1;image2;image3}

However, for a north transition, the macro would expand to something similar to

image=image1;image2;image3-n

Which is wrong, we want the prefix added to all images in the animation

image=image1-n;image2-n;image3-n

To get the result we want, we use macro indirection. In other word, we have a set of macros who take two parameters

#define BUILDER IMAGESTEM POSTFIX

Which are in charge of returning what should be on the right side of the image= So, with the following macro

#define MY_BUILDER IMAGESTEM POSTFIX
{IMAGESTEM}1{POSTFIX};{IMAGESTEM}2{POSTFIX};{IMAGESTEM}3{POSTFIX};

and the following code in the TRANSITION_BASE macro

image={{BUILDER} {IMAGESTEM} -n}

a call to

{TRANSITION_BASE_B <parameters> MY_BUILDER image}

would correctly expand.

Common parameters for all builders

All builders must have exactly the same parameters

  • IMAGESTEM : the base name of the image from which to build
  • POSTFIX : a postfix to add to all images

IMAGE_SINGLE IMAGESTEM POSTFIX

builds a single image image= line (i.e not animated) mainly used as default value for BUILDER parameter of meta-macros

ANIMATION_03 IMAGESTEM POSTFIX

builds a Three image animation, each image being displayed for 100 ms Images Used

  • IMAGESTEM-A01
  • IMAGESTEM-A02
  • IMAGESTEM-A03

ANIMATION_04 IMAGESTEM POSTFIX

builds a four image animation, each image being displayed for 100 ms Images Used

  • IMAGESTEM-A01
  • IMAGESTEM-A02
  • IMAGESTEM-A03
  • IMAGESTEM-A04

ANIMATION_10 IMAGESTEM POSTFIX

builds a ten image animation, each image being displayed for 100 ms Images Used

  • IMAGESTEM-A01
  • IMAGESTEM-A02
  • IMAGESTEM-A03
  • IMAGESTEM-A04
  • IMAGESTEM-A05
  • IMAGESTEM-A06
  • IMAGESTEM-A07
  • IMAGESTEM-A08
  • IMAGESTEM-A09
  • IMAGESTEM-A10

ANIMATION_15 IMAGESTEM POSTFIX

builds a fifteen image animation, each image being displayed for 100 ms Images Used

  • IMAGESTEM-A01
  • IMAGESTEM-A02
  • IMAGESTEM-A03
  • IMAGESTEM-A04
  • IMAGESTEM-A05
  • IMAGESTEM-A06
  • IMAGESTEM-A07
  • IMAGESTEM-A08
  • IMAGESTEM-A09
  • IMAGESTEM-A10
  • IMAGESTEM-A11
  • IMAGESTEM-A12
  • IMAGESTEM-A13
  • IMAGESTEM-A14
  • IMAGESTEM-A15

ANIMATION_04_140 IMAGESTEM POSTFIX

builds a four image animation, each image being displayed for 140 ms Images Used

  • IMAGESTEM-A01
  • IMAGESTEM-A02
  • IMAGESTEM-A03
  • IMAGESTEM-A04

ANIMATION_18_70 IMAGESTEM POSTFIX

builds a eighteen image animation, each image being displayed for 100 ms Images Used

  • IMAGESTEM-A01
  • IMAGESTEM-A02
  • IMAGESTEM-A03
  • IMAGESTEM-A04
  • IMAGESTEM-A05
  • IMAGESTEM-A06
  • IMAGESTEM-A07
  • IMAGESTEM-A08
  • IMAGESTEM-A09
  • IMAGESTEM-A10
  • IMAGESTEM-A11
  • IMAGESTEM-A12
  • IMAGESTEM-A13
  • IMAGESTEM-A14
  • IMAGESTEM-A15
  • IMAGESTEM-A16
  • IMAGESTEM-A17
  • IMAGESTEM-A18


Base tile related macros

Base terrains have all the combinations of macros as described in the naming convention section with the following definition

  • TYPE : the name for all macros starts with TERRAIN_BASE
  • PROB : 100
  • LAYER: -1000
  • FLAG': base
  • BUILDER: IMAGE_SINGLE

Overlay related macros

Overlays have all the combinations of macros as described in the naming convention section with the following definition

  • TYPE : the name for all macros starts with OVERLAY
  • PROB : 100
  • LAYER: 0
  • FLAG': overlay
  • BUILDER: IMAGE_SINGLE

Keep related macros

Keeps are base terrains (they use the same flag) but drawn on layer -1

Keeps have all the combinations of macros as described in the naming convention section with the following definition

  • TYPE : the name for all macros starts with KEEP_BASE
  • PROB : 100
  • LAYER: -1
  • FLAG': base
  • BUILDER: IMAGE_SINGLE

Village related macros

villages have all the combinations of macros as described in the naming convention section with the following definition

  • TYPE : the name for all macros starts with VILLAGE
  • PROB : 100
  • LAYER: 0
  • FLAG': village
  • BUILDER: IMAGE_SINGLE

Transition related macros

Generic Functions

transitions have most of the macros as described in the naming convention section with the following definition

  • TYPE : the name for all macros starts with TRANSITION
  • PROB : 100
  • LAYER: -500
  • FLAG: transition-@<side>
  • BUILDER: IMAGE_SINGLE


However, unlike all previous type of macros, they are related to a side instead of the whole hex. Thus the following rules

  • There are no ROTATION macros. Since they are always side related.
  • All images are named as if they were ROTATION macros since they are all side related
  • There is no SINGLE variation since it doesn't make sense to have it (a side is always relative to two hex)
  • The flags are set and tested on a side related basis. i.e there can be more than one transition per tile, if they don't cover the same direction
  • for RESTRICTED2 and RESTRICTED3, we only check for neighbouring hex of the ADJACENT type. This makes more sense for borders
  • the COMPLETE variant looks as follows


#define BORDER_COMPLETE_LFB TERRAIN ADJACENT LAYER FLAG BUILDER IMAGESTEM
   {BORDER_RESTRICTED3_RANDOM_LFB  ({TERRAIN})  ({ADJACENT}) {LAYER} {FLAG} {BUILDER} {IMAGESTEM}}
   {BORDER_RESTRICTED2_RANDOM_LFB  ({TERRAIN})  ({ADJACENT}) {LAYER} {FLAG} {BUILDER} {IMAGESTEM}}
   {BORDER_RESTRICTED_RANDOM_LFB   ({TERRAIN})  ({ADJACENT}) {LAYER} {FLAG} {BUILDER} {IMAGESTEM}}
   {BORDER_RESTRICTED_RANDOM_LFB   ({TERRAIN})  ({ADJACENT}) {LAYER} {FLAG} {BUILDER} {IMAGESTEM}}
#enddef

DISABLE_BASE_TRANSITIONS TERRAINLIST

This macro will set all transition-@R* on the tile (n,ne,se,s,sw) thus preventing any other transition from being added

Flag Management will set all transition-@R* on the TERRAINLIST tiles

DISABLE_BASE_TRANSITIONS_F TERRAINLIST FLAG

This macro will set all <FLAG>-@R* on the tile (n,ne,se,s,sw) thus preventing any other transition from being added

Flag Management will set all <FLAG>-@R* on the TERRAINLIST tiles

Track Type macros

These macros handle anything that is layed in a connected way over multiple tiles (typically bridges and tiles)

the TRACK macro

TRACK_LF <NWSEterrain> <NSterrain> <NESWterrain> <basename

This macro will add the base terrain on the three terrains corresponding to the three directions.This macro will awlays take random variations, and defaults to layer -80 with flag=overlay

The images used are named

  • base#-ns.png : non-connected on a north-south orientation,
  • base#-nesw.png : non connected on a north-east south-west orientation
  • base#-senw.png : non connected on a south-east north-west orientation
  • base#-<connections> : tile used when the bridge is connected on the corresponding sides (separated by '-', ordered clockwise starting with north)

NOTE: the engine will use the straight tile when it doesn't find any fitting tile

NOTE: if some connection tiles don't seem to be used properly, please post a screenshot from the editor with terrain names enabled and contact boucman

NOTE you will notice that there is no builder. Builders are incompatible with bridges (in other word,the IMAGE_SINGLE builder is hardwired)

Transition related macros

Bridges are tricky because you usually don't want the same transitions depending if the bridge ends on a given edge or not.

The following macros help

TRACK_BORDER_RESTRICTED_PLF <terrain> <adjacent> <IMAGE>

Will match only if terrain is a bridge, on the side matching adjacent, and if the bridge does have a connection or ending on the given side.

Note that adjacent can be a bridge too, but this macro won't check that adjacent exits on the corresponding side

the image will be drawn on the <terrain> hex with the orientation appended to it

TRACK_BORDER_RESTRICTED_RANDOM_LF similar, with random variations

See Also

This page was last edited on 7 May 2023, at 17:44.