Added constructions and items into world data painlessly...
This commit is contained in:
parent
6d997367d4
commit
5fef023964
@ -33,11 +33,14 @@ package body world is
|
||||
core.echo (core.comment, "-- -- Map height :" & height'image);
|
||||
core.echo (core.comment, "-- -- Landmark count :" & landmark_limit'image);
|
||||
--
|
||||
map.kind := index;
|
||||
map.width := width;
|
||||
map.height := height;
|
||||
map.tiles := new tile_array (0 .. map.width - 1, 0 .. map.height - 1);
|
||||
map.landmarks := new entity_array (1 .. landmark_limit);
|
||||
map.kind := index;
|
||||
map.width := width;
|
||||
map.height := height;
|
||||
--
|
||||
map.tiles := new tile_array (0 .. map.width - 1, 0 .. map.height - 1);
|
||||
map.landmarks := new entity_array (1 .. landmark_limit);
|
||||
map.constructions := new entity_array (1 .. 30);
|
||||
map.items := new entity_array (1 .. 60);
|
||||
--
|
||||
for x in 0 .. width - 1 loop
|
||||
for y in 0 .. height - 1 loop
|
||||
@ -51,6 +54,17 @@ package body world is
|
||||
map.landmarks (index).y := core.random (0, map.height - 1);
|
||||
end loop;
|
||||
--
|
||||
for index in 1 .. 30 loop
|
||||
map.constructions (index).index := core.random (0, construction.count - 1);
|
||||
map.constructions (index).x := core.random (0, map.width - 1);
|
||||
map.constructions (index).y := core.random (0, map.height - 1);
|
||||
end loop;
|
||||
--
|
||||
for index in 1 .. 60 loop
|
||||
map.items (index).index := core.random (0, item.count - 1);
|
||||
map.items (index).x := core.random (0, map.width - 1);
|
||||
map.items (index).y := core.random (0, map.height - 1);
|
||||
end loop;
|
||||
--
|
||||
core.echo (core.success, "Finished procedurally generating new map.");
|
||||
end make;
|
||||
@ -58,11 +72,13 @@ package body world is
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw is
|
||||
u : integer := 0;
|
||||
v : integer := 0;
|
||||
u : integer := 0;
|
||||
v : integer := 0;
|
||||
--
|
||||
offset : core.vector := ((core.window_width - core.base) / 2,
|
||||
(core.window_height - core.base) / 2);
|
||||
render : core.vector := (map.width - 1,
|
||||
--
|
||||
render : core.vector := (map.width - 1,
|
||||
map.height - 1);
|
||||
begin
|
||||
for vertical in 0 .. map.height - 1 loop
|
||||
@ -99,6 +115,18 @@ package body world is
|
||||
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;
|
||||
--
|
||||
for index in 1 .. 30 loop
|
||||
construction.draw (construction.enumeration'val (map.constructions (index).index),
|
||||
offset.x + (map.constructions (index).x - core.camera.x) * core.base * core.zoom,
|
||||
offset.y + (map.constructions (index).y - core.camera.y) * core.base * core.zoom);
|
||||
end loop;
|
||||
--
|
||||
for index in 1 .. 60 loop
|
||||
item.draw (item.enumeration'val (map.items (index).index),
|
||||
offset.x + (map.items (index).x - core.camera.x) * core.base * core.zoom,
|
||||
offset.y + (map.items (index).y - core.camera.y) * core.base * core.zoom);
|
||||
end loop;
|
||||
end draw;
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -40,6 +40,7 @@ package world is
|
||||
tiles : access tile_array;
|
||||
landmarks : access entity_array;
|
||||
constructions : access entity_array;
|
||||
items : access entity_array;
|
||||
end record;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user