|
|
@@ -16,6 +16,7 @@ package body world is |
|
|
|
chad_limit : constant natural := 8; |
|
|
|
|
|
|
|
earth : core.sprite; |
|
|
|
water : core.sprite; |
|
|
|
dark : core.sprite; |
|
|
|
border_upper : core.sprite; |
|
|
|
border_lower : core.sprite; |
|
|
@@ -33,6 +34,7 @@ package body world is |
|
|
|
core.echo (core.comment, "Configuring world components..."); |
|
|
|
-- |
|
|
|
earth := core.import_sprite (core.folder & "/game/world/terrain/earth.png", 1, 1); |
|
|
|
water := core.import_sprite (core.folder & "/game/world/terrain/water.png", 1, 1); |
|
|
|
dark := core.import_sprite (core.folder & "/game/world/dark.png", 1, 1); |
|
|
|
border_upper := core.import_sprite (core.folder & "/game/world/frame/border_upper.png", 1, 1); |
|
|
|
border_lower := core.import_sprite (core.folder & "/game/world/frame/border_lower.png", 1, 1); |
|
|
@@ -66,9 +68,11 @@ package body world is |
|
|
|
map.width := width; |
|
|
|
map.height := height; |
|
|
|
-- |
|
|
|
map.earth := new tile_array (0 .. map.width - 1, 0 .. map.height - 1); |
|
|
|
map.clips := new clip_array (0 .. map.width - 1, 0 .. map.height - 1); |
|
|
|
map.views := new view_array (0 .. map.width - 1, 0 .. map.height - 1); |
|
|
|
map.earth := new integer_matrix (0 .. map.width - 1, 0 .. map.height - 1); |
|
|
|
map.water := new integer_matrix (0 .. map.width - 1, 0 .. map.height - 1); |
|
|
|
map.is_water := new boolean_matrix (0 .. map.width - 1, 0 .. map.height - 1); |
|
|
|
map.clips := new boolean_matrix (0 .. map.width - 1, 0 .. map.height - 1); |
|
|
|
map.views := new boolean_matrix (0 .. map.width - 1, 0 .. map.height - 1); |
|
|
|
map.landmarks := new entity_array (1 .. landmark_limit); |
|
|
|
map.constructions := new entity_array (1 .. construction_limit); |
|
|
|
map.equipments := new entity_array (1 .. equipment_limit); |
|
|
@@ -78,9 +82,11 @@ package body world is |
|
|
|
-- |
|
|
|
for x in 0 .. width - 1 loop |
|
|
|
for y in 0 .. height - 1 loop |
|
|
|
map.earth (x, y) := (if core.random (0, 23) < 17 then 0 else core.random (0, 23)); |
|
|
|
map.clips (x, y) := false; |
|
|
|
map.views (x, y) := false; |
|
|
|
map.earth (x, y) := (if core.random (0, 23) < 19 then core.random (0, 11) else core.random (0, 23)); |
|
|
|
map.is_water (x, y) := (if core.random (0, 31) = 19 then true else false); |
|
|
|
map.water (x, y) := (if map.is_water (x, y) then core.random (0, 7) else 0); |
|
|
|
map.clips (x, y) := false; |
|
|
|
map.views (x, y) := false; |
|
|
|
end loop; |
|
|
|
end loop; |
|
|
|
-- |
|
|
@@ -184,6 +190,16 @@ package body world is |
|
|
|
v => core.base * map.earth (horizontal, vertical), |
|
|
|
width => core.base, |
|
|
|
height => core.base); |
|
|
|
if map.is_water (horizontal, vertical) then |
|
|
|
core.draw (data => water, |
|
|
|
x => offset.x + (horizontal - core.camera.x) * core.base * core.zoom, |
|
|
|
y => offset.y + (vertical - core.camera.y) * core.base * core.zoom, |
|
|
|
u => core.base * biome'pos (map.kind) * 4 + (core.animation_time mod 4) * core.base, |
|
|
|
v => core.base * map.water (horizontal, vertical), |
|
|
|
width => core.base, |
|
|
|
height => core.base); |
|
|
|
end if; |
|
|
|
-- |
|
|
|
if core.cursor.x > offset.x + (horizontal - core.camera.x ) * core.base * core.zoom - 6 |
|
|
|
and core.cursor.x < offset.x + (horizontal - core.camera.x + 1) * core.base * core.zoom + 6 |
|
|
|
and core.cursor.y > offset.y + (vertical - core.camera.y ) * core.base * core.zoom - 6 |
|
|
|