mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-06 20:31:38 +00:00
100 lines
2.7 KiB
INI
100 lines
2.7 KiB
INI
#textdomain wesnoth
|
|
# Utility macros for manipulating map terrain and overlays.
|
|
|
|
# These don't depend on any other macros. Please don't change this.
|
|
# ! in comments is used in generating HTML documentation, ignore it otherwise.
|
|
|
|
#define MODIFY_TERRAIN TERRAIN X Y
|
|
# Changes the terrain at a given list of coordinates
|
|
#
|
|
# For example, we could make 14,15 and 14,16 grassland:
|
|
#! {MODIFY_TERRAIN Gg (14,14) (15,16)}
|
|
[terrain]
|
|
terrain={TERRAIN}
|
|
x={X}
|
|
y={Y}
|
|
[/terrain]
|
|
#enddef
|
|
|
|
#define MODIFY_TERRAIN_MASK X Y MASK_VALUE RULES_WML
|
|
# Changes the terrain for a given area
|
|
[terrain_mask]
|
|
x={X}
|
|
y={Y}
|
|
mask={MASK_VALUE}
|
|
{RULES_WML}
|
|
[/terrain_mask]
|
|
#enddef
|
|
|
|
#define RANDOM_FEATURE_PLACEMENT_ON X_SPAN Y_SPAN FILTER NUMBER IMAGE MOD_WML
|
|
# Place NUMBER copies of the IMAGE on map hexes matching FILTER in the
|
|
# region specified by X_SPAN and Y_SPAN. Insert MOD_WML in the image
|
|
# declaration (useful for alpha hacks). Does not check for collisions.
|
|
#
|
|
# This call will scatter 20 copies of a pine-tree graphic over grassland:
|
|
#! {RANDOM_FEATURE_PLACEMENT_ON 1-44 1-30 (terrain=Gg) 20 scenery/pine1.png ()}
|
|
[store_locations]
|
|
x={X_SPAN}
|
|
y={Y_SPAN}
|
|
{FILTER}
|
|
variable=random_placement_locations
|
|
[/store_locations]
|
|
|
|
{VARIABLE_OP random_string format "0..$random_placement_locations.length"}
|
|
|
|
{VARIABLE REPEAT_i 0}
|
|
|
|
[while]
|
|
[variable]
|
|
name=REPEAT_i
|
|
less_than={NUMBER}
|
|
[/variable]
|
|
|
|
[do]
|
|
{RANDOM $random_string}
|
|
|
|
{VARIABLE_OP random_placement_x format "$random_placement_locations[$random].x"}
|
|
{VARIABLE_OP random_placement_y format "$random_placement_locations[$random].y"}
|
|
|
|
[item]
|
|
image={IMAGE}
|
|
x,y=$random_placement_x,$random_placement_y
|
|
{MOD_WML}
|
|
[/item]
|
|
|
|
{VARIABLE_OP REPEAT_i add 1}
|
|
[/do]
|
|
[/while]
|
|
|
|
{CLEAR_VARIABLE REPEAT_i}
|
|
|
|
{CLEAR_VARIABLE random_placement_locations}
|
|
#enddef
|
|
|
|
#define MAP_DIMENSIONS XSIZE_NAME YSIZE_NAME
|
|
# Place the X and Y dimensions of the current map in XSIZE_NAME, YSIZE_NAME.
|
|
[store_locations]
|
|
variable=GET_MAP_temp
|
|
y=1
|
|
[/store_locations]
|
|
[set_variable]
|
|
name={XSIZE_NAME}
|
|
value=$GET_MAP_temp.length
|
|
[/set_variable]
|
|
[clear_variable]
|
|
name=GET_MAP_temp
|
|
[/clear_variable]
|
|
[store_locations]
|
|
variable=GET_MAP_temp
|
|
x=1
|
|
[/store_locations]
|
|
[set_variable]
|
|
name={YSIZE_NAME}
|
|
value=$GET_MAP_temp.length
|
|
[/set_variable]
|
|
[clear_variable]
|
|
name=GET_MAP_temp
|
|
[/clear_variable]
|
|
#enddef
|
|
|