Переглянути джерело

Circled map revealing thing and had dinner...

master
Ognjen Milan Robovic 3 тижднів тому
джерело
коміт
c16f5dd4e3
1 змінених файлів з 19 додано та 11 видалено
  1. +19
    -11
      source/world.adb

+ 19
- 11
source/world.adb Переглянути файл

@@ -8,6 +8,8 @@ package body world is


------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


view_reach : constant integer := 48;

dark : core.sprite; dark : core.sprite;


------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
@@ -108,9 +110,6 @@ package body world is
-- --
offset : core.vector := ((core.window_width - core.base) / 2, offset : core.vector := ((core.window_width - core.base) / 2,
(core.window_height - core.base) / 2); (core.window_height - core.base) / 2);
--
render : core.vector := (map.width - 1,
map.height - 1);
begin begin
view; view;
-- --
@@ -175,10 +174,7 @@ package body world is
for horizontal in 0 .. map.width - 1 loop for horizontal in 0 .. map.width - 1 loop
exit when offset.x + (horizontal - core.camera.x) * core.base * core.zoom > core.window_width; 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, core.draw (data => dark,
x => offset.x + (horizontal - core.camera.x) * core.base * core.zoom, x => offset.x + (horizontal - core.camera.x) * core.base * core.zoom,
y => offset.y + (vertical - core.camera.y) * 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 procedure view is
view_reach : constant integer := 12;
offset : core.vector := ((core.window_width - core.base) / 2,
(core.window_height - core.base) / 2);
begin 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 loop; end loop;
end view; end view;


Завантаження…
Відмінити
Зберегти