diff --git a/source/world.adb b/source/world.adb index db62f7f..0b5905a 100644 --- a/source/world.adb +++ b/source/world.adb @@ -36,6 +36,36 @@ package body world is ------------------------------------------------------------------------------------------ + procedure earth_to_water_transition is + matrix : array (0 .. 1, 0 .. 1) of natural; + begin + for x in 1 .. map.width - 2 loop + for y in 1 .. map.height - 2 loop + matrix (0, 0) := boolean'pos (map.tiles (x - 1, y - 1) not in 18 .. 23); + matrix (1, 0) := boolean'pos (map.tiles (x, y - 1) not in 18 .. 23); + matrix (0, 1) := boolean'pos (map.tiles (x - 1, y ) not in 18 .. 23); + matrix (1, 1) := boolean'pos (map.tiles (x, y ) not in 18 .. 23); + -- + if map.tiles (x, y) not in 18 .. 23 and map.tiles (x, y + 1) in 18 .. 23 then map.tiles (x, y ) := 24; end if; + if map.tiles (x, y) in 18 .. 23 and map.tiles (x, y + 1) not in 18 .. 23 then map.tiles (x, y + 1) := 25; end if; + if map.tiles (x, y) not in 18 .. 23 and map.tiles (x + 1, y ) in 18 .. 23 then map.tiles (x, y ) := 26; end if; + if map.tiles (x, y) in 18 .. 23 and map.tiles (x + 1, y ) not in 18 .. 23 then map.tiles (x + 1, y ) := 27; end if; + -- + if matrix = ((1, 1), (1, 0)) then map.tiles (x - 1, y - 1) := 28; + elsif matrix = ((1, 0), (1, 1)) then map.tiles (x, y - 1) := 29; + elsif matrix = ((1, 1), (0, 1)) then map.tiles (x - 1, y ) := 30; + elsif matrix = ((0, 1), (1, 1)) then map.tiles (x, y ) := 31; + elsif matrix = ((0, 0), (0, 1)) then map.tiles (x, y ) := 32; + elsif matrix = ((0, 1), (0, 0)) then map.tiles (x - 1, y ) := 33; + elsif matrix = ((0, 0), (1, 0)) then map.tiles (x, y - 1) := 34; + elsif matrix = ((1, 0), (0, 0)) then map.tiles (x - 1, y - 1) := 35; + end if; + end loop; + end loop; + end earth_to_water_transition; + + ------------------------------------------------------------------------------------------ + procedure configure is begin core.echo (core.comment, "Configuring world components..."); @@ -121,52 +151,11 @@ package body world is end loop; end loop; end loop; - -- - for x in -lake_reach - 1 .. lake_reach + 2 loop - for y in -lake_reach - 1 .. lake_reach + 2 loop - declare matrix : array (0 .. 1, 0 .. 1) of natural := (others => (others => 0)); - begin - matrix (0, 0) := boolean'pos (map.tiles (lake_x + x - 1, lake_y + y - 1) not in 18 .. 23); - matrix (1, 0) := boolean'pos (map.tiles (lake_x + x, lake_y + y - 1) not in 18 .. 23); - matrix (0, 1) := boolean'pos (map.tiles (lake_x + x - 1, lake_y + y) not in 18 .. 23); - matrix (1, 1) := boolean'pos (map.tiles (lake_x + x, lake_y + y) not in 18 .. 23); - -- - if map.tiles (lake_x + x, lake_y + y) not in 18 .. 23 and map.tiles (lake_x + x, lake_y + y + 1) in 18 .. 23 then - map.tiles (lake_x + x, lake_y + y) := 24; - end if; - if map.tiles (lake_x + x, lake_y + y) in 18 .. 23 and map.tiles (lake_x + x, lake_y + y + 1) not in 18 .. 23 then -- - map.tiles (lake_x + x, lake_y + y + 1) := 25; - end if; - if map.tiles (lake_x + x, lake_y + y) not in 18 .. 23 and map.tiles (lake_x + x + 1, lake_y + y) in 18 .. 23 then - map.tiles (lake_x + x, lake_y + y) := 26; - end if; - if map.tiles (lake_x + x, lake_y + y) in 18 .. 23 and map.tiles (lake_x + x + 1, lake_y + y) not in 18 .. 23 then -- - map.tiles (lake_x + x + 1, lake_y + y) := 27; - end if; - -- - if matrix = ((1, 1), (1, 0)) then - map.tiles (lake_x + x - 1, lake_y + y - 1) := 28; - elsif matrix = ((1, 1), (0, 1)) then - map.tiles (lake_x + x - 1, lake_y + y) := 30; - elsif matrix = ((1, 0), (1, 1)) then - map.tiles (lake_x + x, lake_y + y - 1) := 29; - elsif matrix = ((0, 1), (1, 1)) then - map.tiles (lake_x + x, lake_y + y) := 31; - elsif matrix = ((0, 0), (0, 1)) then - map.tiles (lake_x + x, lake_y + y) := 32; - elsif matrix = ((0, 0), (1, 0)) then - map.tiles (lake_x + x, lake_y + y - 1) := 34; - elsif matrix = ((0, 1), (0, 0)) then - map.tiles (lake_x + x - 1, lake_y + y) := 33; - elsif matrix = ((1, 0), (0, 0)) then - map.tiles (lake_x + x - 1, lake_y + y - 1) := 35; - end if; - end; - end loop; - end loop; end; end loop; -- + earth_to_water_transition; + -- for x in 0 .. width - 1 loop for y in 0 .. height - 1 loop if map.tiles (x, y) > 17 then