|
|
@@ -15,7 +15,7 @@ package body world is |
|
|
|
unit_limit : constant natural := 600; |
|
|
|
chad_limit : constant natural := 8; |
|
|
|
|
|
|
|
tiles : core.sprite; |
|
|
|
earth : core.sprite; |
|
|
|
dark : core.sprite; |
|
|
|
border_upper : core.sprite; |
|
|
|
border_lower : core.sprite; |
|
|
@@ -32,7 +32,7 @@ package body world is |
|
|
|
begin |
|
|
|
core.echo (core.comment, "Configuring world components..."); |
|
|
|
-- |
|
|
|
tiles := core.import_sprite (core.folder & "/game/world/terrain/terrain.png", 1, 1); |
|
|
|
earth := core.import_sprite (core.folder & "/game/world/terrain/earth.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,7 +66,7 @@ package body world is |
|
|
|
map.width := width; |
|
|
|
map.height := height; |
|
|
|
-- |
|
|
|
map.tiles := new tile_array (0 .. map.width - 1, 0 .. map.height - 1); |
|
|
|
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.landmarks := new entity_array (1 .. landmark_limit); |
|
|
@@ -78,7 +78,7 @@ package body world is |
|
|
|
-- |
|
|
|
for x in 0 .. width - 1 loop |
|
|
|
for y in 0 .. height - 1 loop |
|
|
|
map.tiles (x, y) := (if core.random (0, 23) < 20 then 0 else core.random (0, 23)); |
|
|
|
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; |
|
|
|
end loop; |
|
|
@@ -138,9 +138,6 @@ package body world is |
|
|
|
------------------------------------------------------------------------------------------ |
|
|
|
|
|
|
|
procedure draw is |
|
|
|
u : integer := 0; |
|
|
|
v : integer := 0; |
|
|
|
-- |
|
|
|
offset : core.vector := ((core.window_width - core.base) / 2, |
|
|
|
(core.window_height - core.base) / 2); |
|
|
|
begin |
|
|
@@ -180,14 +177,11 @@ package body world is |
|
|
|
exit when offset.x + (horizontal - core.camera.x) * core.base * core.zoom > core.window_width; |
|
|
|
-- |
|
|
|
if map.views (horizontal, vertical) then |
|
|
|
u := core.base * biome'pos (map.kind) * 4; |
|
|
|
v := core.base * map.tiles (horizontal, vertical); |
|
|
|
-- |
|
|
|
core.draw (data => tiles, |
|
|
|
core.draw (data => earth, |
|
|
|
x => offset.x + (horizontal - core.camera.x) * core.base * core.zoom, |
|
|
|
y => offset.y + (vertical - core.camera.y) * core.base * core.zoom, |
|
|
|
u => u, |
|
|
|
v => v, |
|
|
|
u => core.base * biome'pos (map.kind) * 4, |
|
|
|
v => core.base * map.earth (horizontal, vertical), |
|
|
|
width => core.base, |
|
|
|
height => core.base); |
|
|
|
if core.cursor.x > offset.x + (horizontal - core.camera.x ) * core.base * core.zoom - 6 |
|
|
@@ -281,11 +275,11 @@ package body world is |
|
|
|
-- |
|
|
|
for vertical in 0 .. map.height - 1 loop |
|
|
|
for horizontal in 0 .. map.width - 1 loop |
|
|
|
core.render_image (data => tiles, |
|
|
|
core.render_image (data => earth, |
|
|
|
x => horizontal * core.base, |
|
|
|
y => vertical * core.base, |
|
|
|
u => core.base * biome'pos (map.kind) * 4, |
|
|
|
v => core.base * map.tiles (horizontal, vertical), |
|
|
|
v => core.base * map.earth (horizontal, vertical), |
|
|
|
width => core.base, |
|
|
|
height => core.base); |
|
|
|
end loop; |
|
|
|