@@ -23,10 +23,8 @@ procedure main is | |||||
map_preview_panel, status_preview_panel, text_box_panel | map_preview_panel, status_preview_panel, text_box_panel | ||||
); | ); | ||||
view_icon : array (view) of core.sprite; | |||||
view_list : array (view) of boolean := (others => true); | |||||
view_icon : array (view) of core.sprite := (others => (others => 0)); | |||||
view_list : array (view) of boolean := (others => true); | |||||
view_text : array (view) of core.long_string := ( | view_text : array (view) of core.long_string := ( | ||||
"Toggle map preview panel. ", | "Toggle map preview panel. ", | ||||
"Toggle status preview panel. ", | "Toggle status preview panel. ", | ||||
@@ -48,6 +46,7 @@ procedure main is | |||||
procedure move_camera_up is | procedure move_camera_up is | ||||
begin | begin | ||||
core.move_camera_up; | core.move_camera_up; | ||||
core.camera.y := core.clip (core.camera.y, 0, world.map.height - 1); | |||||
if world.map.clips (core.camera.x, core.camera.y) then | if world.map.clips (core.camera.x, core.camera.y) then | ||||
core.increment (core.camera.y); | core.increment (core.camera.y); | ||||
end if; | end if; | ||||
@@ -56,6 +55,7 @@ procedure main is | |||||
procedure move_camera_down is | procedure move_camera_down is | ||||
begin | begin | ||||
core.move_camera_down; | core.move_camera_down; | ||||
core.camera.y := core.clip (core.camera.y, 0, world.map.height - 1); | |||||
if world.map.clips (core.camera.x, core.camera.y) then | if world.map.clips (core.camera.x, core.camera.y) then | ||||
core.decrement (core.camera.y); | core.decrement (core.camera.y); | ||||
end if; | end if; | ||||
@@ -64,6 +64,7 @@ procedure main is | |||||
procedure move_camera_left is | procedure move_camera_left is | ||||
begin | begin | ||||
core.move_camera_left; | core.move_camera_left; | ||||
core.camera.x := core.clip (core.camera.x, 0, world.map.width - 1); | |||||
if world.map.clips (core.camera.x, core.camera.y) then | if world.map.clips (core.camera.x, core.camera.y) then | ||||
core.increment (core.camera.x); | core.increment (core.camera.x); | ||||
end if; | end if; | ||||
@@ -72,6 +73,7 @@ procedure main is | |||||
procedure move_camera_right is | procedure move_camera_right is | ||||
begin | begin | ||||
core.move_camera_right; | core.move_camera_right; | ||||
core.camera.x := core.clip (core.camera.x, 0, world.map.width - 1); | |||||
if world.map.clips (core.camera.x, core.camera.y) then | if world.map.clips (core.camera.x, core.camera.y) then | ||||
core.decrement (core.camera.x); | core.decrement (core.camera.x); | ||||
end if; | end if; | ||||
@@ -125,7 +127,7 @@ begin | |||||
world.configure; | world.configure; | ||||
ai.configure; | ai.configure; | ||||
world.make (world.grass, 140, 120); | |||||
world.make (world.swamp, 120, 60); | |||||
core.dash; | core.dash; | ||||
core.echo (core.success, "Successfully initialized game data, entering main gameplay loop."); | core.echo (core.success, "Successfully initialized game data, entering main gameplay loop."); | ||||
@@ -137,7 +139,7 @@ begin | |||||
ui.active := ui.imp; | ui.active := ui.imp; | ||||
core.camera := (55, 50); | |||||
core.camera := (1, 1); | |||||
------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ||||
@@ -156,9 +158,6 @@ begin | |||||
preview_height := core.window_height - text_box_height; | preview_height := core.window_height - text_box_height; | ||||
text_box_height := 32; | text_box_height := 32; | ||||
-- | -- | ||||
core.camera.x := core.clip (core.camera.x, 0, world.map.width - 1); | |||||
core.camera.y := core.clip (core.camera.y, 0, world.map.height - 1); | |||||
-- | |||||
world.draw; | world.draw; | ||||
-- | -- | ||||
if view_list (map_preview_panel) then | if view_list (map_preview_panel) then | ||||
@@ -153,14 +153,14 @@ package body ui is | |||||
------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ||||
procedure draw_structure (data : in structure) is | procedure draw_structure (data : in structure) is | ||||
offset : constant integer := core.icon; | |||||
offset : constant integer := core.icon / 4; | |||||
new_width : constant integer := (if data.resize then 320 else data.width); | new_width : constant integer := (if data.resize then 320 else data.width); | ||||
new_height : constant integer := (if data.resize then data.gui_n * (3 * core.icon / 2) + 2 * offset else data.height); | |||||
new_height : constant integer := (if data.resize then data.gui_n * (core.icon + 2 * offset) + 2 * core.icon else data.height); | |||||
new_x : constant integer := (if data.center then (core.window_width - new_width) / 2 else data.x); | new_x : constant integer := (if data.center then (core.window_width - new_width) / 2 else data.x); | ||||
new_y : constant integer := (if data.center then (core.window_height - new_height) / 2 else data.y); | new_y : constant integer := (if data.center then (core.window_height - new_height) / 2 else data.y); | ||||
-- | -- | ||||
at_x : integer := new_x + offset; | |||||
at_y : integer := new_y + offset; | |||||
at_x : integer := new_x + core.icon; | |||||
at_y : integer := new_y + core.icon; | |||||
begin | begin | ||||
draw_tiny_menu (new_x, new_y, new_width, new_height); | draw_tiny_menu (new_x, new_y, new_width, new_height); | ||||
draw_title_bar (new_x, new_y, new_width, data.title); | draw_title_bar (new_x, new_y, new_width, data.title); | ||||
@@ -168,13 +168,13 @@ package body ui is | |||||
for x in 0 .. data.gui_n - 1 loop | for x in 0 .. data.gui_n - 1 loop | ||||
case data.gui_list (x).kind is | case data.gui_list (x).kind is | ||||
when gui_button => | when gui_button => | ||||
draw_frame (data.gui_list (x).info, at_x, at_y, new_width - 2 * offset, 3 * core.icon / 2); | |||||
draw_icon (data.gui_list (x).image, data.gui_list (x).info, at_x + core.icon / 4, at_y + core.icon / 4); | |||||
write (data.gui_list (x).text, at_x + 5 * core.icon / 4, at_y + 2 + core.icon / 4); | |||||
if cursor_inside (at_x, at_y, new_width - 2 * offset - core.icon - 2, 3 * core.icon / 2) then | |||||
draw (cursor, at_x + new_width - 96, at_y); | |||||
end if; | |||||
at_y := at_y + 3 * core.icon / 2; | |||||
draw_frame (data.gui_list (x).info, at_x, at_y, new_width - 2 * core.icon, core.icon + 2 * offset); | |||||
draw_icon (data.gui_list (x).image, data.gui_list (x).info, at_x + offset, at_y + offset); | |||||
write (data.gui_list (x).text, at_x + core.icon + offset, at_y + offset + 2); | |||||
--~if cursor_inside (at_x, at_y, new_width - 2 * offset - core.icon - 2, 3 * core.icon / 2) then | |||||
--~draw (cursor, at_x + new_width - 96, at_y); | |||||
--~end if; | |||||
at_y := at_y + core.icon + 2 * offset; | |||||
when others => null; | when others => null; | ||||
end case; | end case; | ||||
end loop; | end loop; | ||||
@@ -172,7 +172,7 @@ package body world is | |||||
begin | begin | ||||
for x in 0 .. view_reach loop | for x in 0 .. view_reach loop | ||||
for y in 0 .. view_reach loop | for y in 0 .. view_reach loop | ||||
map.views (x + core.camera.x - view_reach / 2, y + core.camera.y - view_reach / 2) := true; | |||||
map.views ((x + core.camera.x - view_reach / 2) mod map.width, (y + core.camera.y - view_reach / 2) mod map.height) := true; | |||||
end loop; | end loop; | ||||
end loop; | end loop; | ||||
end view; | end view; | ||||