Circled map revealing thing and had dinner...

This commit is contained in:
Ognjen Milan Robovic 2024-05-08 18:06:37 -04:00
parent e73d65ec9a
commit c16f5dd4e3

View File

@ -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;