From c16f5dd4e32230e3bcfef610b168117e1a3a3f88 Mon Sep 17 00:00:00 2001 From: xolatile Date: Wed, 8 May 2024 18:06:37 -0400 Subject: [PATCH] Circled map revealing thing and had dinner... --- source/world.adb | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/source/world.adb b/source/world.adb index 63fa596..80d526e 100644 --- a/source/world.adb +++ b/source/world.adb @@ -8,6 +8,8 @@ package body world is ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + view_reach : constant integer := 48; + dark : core.sprite; ------------------------------------------------------------------------------------------ @@ -108,9 +110,6 @@ package body world is -- offset : core.vector := ((core.window_width - core.base) / 2, (core.window_height - core.base) / 2); - -- - render : core.vector := (map.width - 1, - map.height - 1); begin view; -- @@ -175,10 +174,7 @@ package body world is for horizontal in 0 .. map.width - 1 loop exit when offset.x + (horizontal - core.camera.x) * core.base * core.zoom > core.window_width; -- - if not (horizontal > core.camera.x - 6 - and horizontal < core.camera.x + 6 - and vertical > core.camera.y - 6 - and vertical < core.camera.y + 6) then + if (horizontal - core.camera.x) ** 2 + (vertical - core.camera.y) ** 2 > view_reach then core.draw (data => dark, x => offset.x + (horizontal - core.camera.x) * core.base * core.zoom, y => offset.y + (vertical - core.camera.y) * core.base * core.zoom); @@ -190,11 +186,23 @@ package body world is ------------------------------------------------------------------------------------------ procedure view is - view_reach : constant integer := 12; + offset : core.vector := ((core.window_width - core.base) / 2, + (core.window_height - core.base) / 2); begin - for x in 0 .. view_reach loop - for y in 0 .. view_reach loop - map.views ((x + core.camera.x - view_reach / 2) mod map.width, (y + core.camera.y - view_reach / 2) mod map.height) := true; + --~for x in 0 .. view_reach loop + --~for y in 0 .. view_reach loop + --~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; + for vertical in 0 .. map.height - 1 loop + exit when offset.y + (vertical - core.camera.y) * core.base * core.zoom > core.window_height; + -- + for horizontal in 0 .. map.width - 1 loop + exit when offset.x + (horizontal - core.camera.x) * core.base * core.zoom > core.window_width; + -- + if not ((horizontal - core.camera.x) ** 2 + (vertical - core.camera.y) ** 2 > view_reach * 2) then + map.views (horizontal, vertical) := true; + end if; end loop; end loop; end view;