@@ -53,11 +53,16 @@ procedure main is | |||||
procedure zoom_in is begin core.zoom := 2; end zoom_in; | procedure zoom_in is begin core.zoom := 2; end zoom_in; | ||||
procedure zoom_out is begin core.zoom := 1; end zoom_out; | procedure zoom_out is begin core.zoom := 1; end zoom_out; | ||||
procedure move_camera_up is begin core.move_camera_up; if world.map.clips (core.camera.x, core.camera.y) then core.increment (core.camera.y); end if; end move_camera_up; | |||||
procedure move_camera_down is begin core.move_camera_down; if world.map.clips (core.camera.x, core.camera.y) then core.decrement (core.camera.y); end if; end move_camera_down; | |||||
procedure move_camera_left is begin core.move_camera_left; if world.map.clips (core.camera.x, core.camera.y) then core.increment (core.camera.x); end if; end move_camera_left; | |||||
procedure move_camera_right is begin core.move_camera_right; if world.map.clips (core.camera.x, core.camera.y) then core.decrement (core.camera.x); end if; end move_camera_right; | |||||
signal_list : constant array (core.signal_code) of access procedure := ( | signal_list : constant array (core.signal_code) of access procedure := ( | ||||
core.signal_up => core.move_camera_up'access, | |||||
core.signal_down => core.move_camera_down'access, | |||||
core.signal_left => core.move_camera_left'access, | |||||
core.signal_right => core.move_camera_right'access, | |||||
core.signal_up => move_camera_up'access, | |||||
core.signal_down => move_camera_down'access, | |||||
core.signal_left => move_camera_left'access, | |||||
core.signal_right => move_camera_right'access, | |||||
core.signal_v => ui_main_style'access, | core.signal_v => ui_main_style'access, | ||||
core.signal_kp_add => zoom_in'access, | core.signal_kp_add => zoom_in'access, | ||||
core.signal_kp_subtract => zoom_out'access, | core.signal_kp_subtract => zoom_out'access, | ||||
@@ -38,6 +38,7 @@ package body world is | |||||
map.height := height; | map.height := height; | ||||
-- | -- | ||||
map.tiles := new tile_array (0 .. map.width - 1, 0 .. map.height - 1); | map.tiles := 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.landmarks := new entity_array (1 .. landmark_limit); | map.landmarks := new entity_array (1 .. landmark_limit); | ||||
map.constructions := new entity_array (1 .. 30); | map.constructions := new entity_array (1 .. 30); | ||||
map.items := new entity_array (1 .. 60); | map.items := new entity_array (1 .. 60); | ||||
@@ -45,6 +46,7 @@ package body world is | |||||
for x in 0 .. width - 1 loop | for x in 0 .. width - 1 loop | ||||
for y in 0 .. height - 1 loop | for y in 0 .. height - 1 loop | ||||
map.tiles (x, y) := (core.random (0, 23) * core.random (0, 23)) mod 24; | map.tiles (x, y) := (core.random (0, 23) * core.random (0, 23)) mod 24; | ||||
map.clips (x, y) := false; | |||||
end loop; | end loop; | ||||
end loop; | end loop; | ||||
-- | -- | ||||
@@ -52,6 +54,9 @@ package body world is | |||||
map.landmarks (index).index := core.random (0, 8); | map.landmarks (index).index := core.random (0, 8); | ||||
map.landmarks (index).x := core.random (0, map.width - 1); | map.landmarks (index).x := core.random (0, map.width - 1); | ||||
map.landmarks (index).y := core.random (0, map.height - 1); | map.landmarks (index).y := core.random (0, map.height - 1); | ||||
if trait (landmark_index'val (map.landmarks (index).index)).clip then | |||||
map.clips (map.landmarks (index).x, map.landmarks (index).y) := true; | |||||
end if; | |||||
end loop; | end loop; | ||||
-- | -- | ||||
for index in 1 .. 30 loop | for index in 1 .. 30 loop | ||||
@@ -31,6 +31,7 @@ package world is | |||||
end record; | end record; | ||||
type tile_array is array (natural range <>, natural range <>) of integer; | type tile_array is array (natural range <>, natural range <>) of integer; | ||||
type clip_array is array (natural range <>, natural range <>) of boolean; | |||||
type entity_array is array (natural range <>) of entity_trait; | type entity_array is array (natural range <>) of entity_trait; | ||||
type information is record | type information is record | ||||
@@ -38,6 +39,7 @@ package world is | |||||
width : natural; | width : natural; | ||||
height : natural; | height : natural; | ||||
tiles : access tile_array; | tiles : access tile_array; | ||||
clips : access clip_array; | |||||
landmarks : access entity_array; | landmarks : access entity_array; | ||||
constructions : access entity_array; | constructions : access entity_array; | ||||
items : access entity_array; | items : access entity_array; | ||||