|
|
@@ -2,7 +2,7 @@ |
|
|
|
-- |
|
|
|
-- GNU General Public Licence (version 3 or later) |
|
|
|
|
|
|
|
with core, resource, item, unit, construction, world; |
|
|
|
with core, ui, resource, item, unit, construction, world; |
|
|
|
|
|
|
|
package body world is |
|
|
|
|
|
|
@@ -41,7 +41,7 @@ package body world is |
|
|
|
tiles : core.sprite; |
|
|
|
landmarks : array (landmark_index) of core.sprite; |
|
|
|
|
|
|
|
landmark_limit : constant integer := 40; |
|
|
|
landmark_limit : constant integer := 120; |
|
|
|
|
|
|
|
trait : constant array (landmark_index) of landmark_trait := ( |
|
|
|
dead_tree => (ash, true, 1), |
|
|
@@ -96,8 +96,8 @@ package body world is |
|
|
|
-- |
|
|
|
for index in 1 .. landmark_limit loop |
|
|
|
map.landmarks (index).index := landmark_index'val (core.random (0, 8)); |
|
|
|
map.landmarks (index).x := core.base * core.random (1, 90); |
|
|
|
map.landmarks (index).y := core.base * core.random (1, 60); |
|
|
|
map.landmarks (index).x := core.random (0, width - 1); |
|
|
|
map.landmarks (index).y := core.random (0, height - 1); |
|
|
|
end loop; |
|
|
|
-- |
|
|
|
core.echo (core.success, "Finished procedurally generating new map."); |
|
|
@@ -106,20 +106,22 @@ package body world is |
|
|
|
------------------------------------------------------------------------------------------ |
|
|
|
|
|
|
|
procedure draw is |
|
|
|
u, v : integer; |
|
|
|
offset : core.vector := ((core.window_width - core.base) / 2, (core.window_height - core.base) / 2); |
|
|
|
u : integer := 0; |
|
|
|
v : integer := 0; |
|
|
|
offset : core.vector := ((core.window_width - core.base) / 2, |
|
|
|
(core.window_height - core.base) / 2); |
|
|
|
render : core.vector := ((if (core.window_width / core.base / core.zoom + 1 < width - 1) then core.window_width / core.base / core.zoom + 1 else width - 1), |
|
|
|
(if (core.window_height / core.base / core.zoom + 1 < height - 1) then core.window_height / core.base / core.zoom + 1 else height - 1)); |
|
|
|
begin |
|
|
|
for move_y in 0 .. core.window_height / core.base / core.zoom + 1 loop |
|
|
|
--~for move_y in 0 .. 10 loop |
|
|
|
exit when core.camera.y > map.height; |
|
|
|
for move_y in 0 .. render.y loop |
|
|
|
--~exit when core.camera.y + move_y > render.y; |
|
|
|
-- |
|
|
|
for move_x in 0 .. core.window_width / core.base / core.zoom + 1 loop |
|
|
|
--~for move_x in 0 .. 10 loop |
|
|
|
exit when core.camera.x > map.width; |
|
|
|
for move_x in 0 .. render.x loop |
|
|
|
--~exit when core.camera.x + move_x > render.x; |
|
|
|
-- |
|
|
|
u := core.base * biome'pos (map.kind) * 4; |
|
|
|
v := core.base * map.tiles (if core.camera.x + move_x, |
|
|
|
if core.camera.y + move_y); |
|
|
|
v := core.base * map.tiles ((core.camera.x + move_x) mod width, |
|
|
|
(core.camera.y + move_y) mod height); |
|
|
|
-- |
|
|
|
core.draw (data => tiles, |
|
|
|
x => offset.x + (move_x - core.camera.x) * core.base * core.zoom, |
|
|
@@ -128,13 +130,22 @@ package body world is |
|
|
|
v => v, |
|
|
|
width => core.base-1, |
|
|
|
height => core.base-1); |
|
|
|
-- |
|
|
|
if core.cursor.x > offset.x + (move_x - core.camera.x) * core.base * core.zoom |
|
|
|
and core.cursor.x < offset.x + (move_x - core.camera.x) * core.base * core.zoom + core.base * core.zoom |
|
|
|
and core.cursor.y > offset.y + (move_y - core.camera.y) * core.base * core.zoom |
|
|
|
and core.cursor.y < offset.y + (move_y - core.camera.y) * core.base * core.zoom + core.base * core.zoom |
|
|
|
and core.cursor_mode = 1 and not ui.prioritize then |
|
|
|
core.camera.x := move_x; |
|
|
|
core.camera.y := move_y; |
|
|
|
end if; |
|
|
|
end loop; |
|
|
|
end loop; |
|
|
|
-- |
|
|
|
for index in 1 .. landmark_limit loop |
|
|
|
core.draw (data => landmarks (map.landmarks (index).index), |
|
|
|
x => (map.landmarks (index).x - core.camera.x * core.base) * core.zoom, |
|
|
|
y => (map.landmarks (index).y - core.camera.y * core.base) * core.zoom); |
|
|
|
x => offset.x + (map.landmarks (index).x - core.camera.x) * core.base * core.zoom, |
|
|
|
y => offset.y + (map.landmarks (index).y - core.camera.y) * core.base * core.zoom); |
|
|
|
end loop; |
|
|
|
end draw; |
|
|
|
--~procedure draw is |
|
|
|