From 7b65d4e0db65b5adf89fa93470ea38d5857f035b Mon Sep 17 00:00:00 2001 From: xolatile Date: Sun, 19 May 2024 13:57:13 -0400 Subject: [PATCH] Reimplementing zoom factor related map border rednering... --- source/core.adb | 8 ++++---- source/main.adb | 2 +- source/world.adb | 37 ++++++++++++++++++------------------- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/source/core.adb b/source/core.adb index 321d98c..60c22c7 100644 --- a/source/core.adb +++ b/source/core.adb @@ -317,11 +317,11 @@ package body core is procedure draw_horizontally (data : in sprite; x, y, width, factor : in integer; tint : in colour := (others => 255)) is begin for move in 0 .. width / data.width - 1 loop - draw (data, x + move * data.width, y, tint => tint, factor => 1); + draw (data, x + move * data.width, y, tint => tint, factor => factor); end loop; -- if width mod data.width > 0 then - draw (data, x + (width / data.width) * data.width, y, 0, 0, width mod data.width, data.height, tint => tint, factor => 1); + draw (data, x + (width / data.width) * data.width, y, 0, 0, width mod data.width, data.height, tint => tint, factor => factor); end if; end draw_horizontally; @@ -330,11 +330,11 @@ package body core is procedure draw_vertically (data : in sprite; x, y, height, factor : in integer; tint : in colour := (others => 255)) is begin for move in 0 .. height / data.height - 1 loop - draw (data, x, y + move * data.height, tint => tint, factor => 1); + draw (data, x, y + move * data.height, tint => tint, factor => factor); end loop; -- if height mod data.height > 0 then - draw (data, x, y + (height / data.height) * data.height, 0, 0, data.width, height mod data.height, tint => tint, factor => 1); + draw (data, x, y + (height / data.height) * data.height, 0, 0, data.width, height mod data.height, tint => tint, factor => factor); end if; end draw_vertically; diff --git a/source/main.adb b/source/main.adb index 815f530..e7d9e08 100644 --- a/source/main.adb +++ b/source/main.adb @@ -219,7 +219,7 @@ begin world.configure; --~ai.configure; - world.make (world.swamp, 240, 180, 8); + world.make (world.swamp, 60, 40, 8); world.add_chad (player); dash; diff --git a/source/world.adb b/source/world.adb index 0cd97db..c3ef6bb 100644 --- a/source/world.adb +++ b/source/world.adb @@ -10,11 +10,11 @@ package body world is view_reach : constant integer := 96; - landmark_limit : constant integer := 360; + landmark_limit : constant integer := 60; location_limit : constant integer := 60; - construction_limit : constant natural := 120; - equipment_limit : constant natural := 600; - unit_limit : constant natural := 600; + construction_limit : constant natural := 10; + equipment_limit : constant natural := 60; + unit_limit : constant natural := 60; earth : core.sprite; --~water : core.sprite; @@ -203,22 +203,21 @@ package body world is end loop; end loop; -- - --~declare factor : constant integer := core.base * core.zoom; - --~x : constant integer := factor * (-1- core.camera.x) + offset.x; - --~y : constant integer := factor * (-1- core.camera.y) + offset.y; - --~width : constant integer := core.base * (map.width + 2); - --~height : constant integer := core.base * (map.height + 2); - --~begin - --~core.draw_horizontally (border_upper, x + factor, y, width - 2 * factor, core.zoom); - --~core.draw_horizontally (border_lower, x + factor, y + height - factor, width - 2 * factor, core.zoom); - --~core.draw_vertically (border_left, x, y + factor, height - 2 * factor, core.zoom); - --~core.draw_vertically (border_right, x + width - factor, y + factor, height - 2 * factor, core.zoom); - --~-- + declare x : constant integer := core.base * core.zoom * (-1 - core.camera.x) + offset.x; + y : constant integer := core.base * core.zoom * (-1 - core.camera.y) + offset.y; + width : constant integer := core.base * core.zoom * (map.width + 2); + height : constant integer := core.base * core.zoom * (map.height + 2); + begin + core.draw_horizontally (border_upper, x + core.base * core.zoom, y, width - 2 * core.base * core.zoom, core.zoom); + core.draw_horizontally (border_lower, x + core.base * core.zoom, y - core.base * core.zoom + height, width - 2 * core.base * core.zoom, core.zoom); + core.draw_vertically (border_left, x, y + core.base * core.zoom, height - 2 * core.base * core.zoom, core.zoom); + core.draw_vertically (border_right, x - core.base * core.zoom + width, y + core.base * core.zoom, height - 2 * core.base * core.zoom, core.zoom); + -- --~core.draw (corner_upper_left, x, y, core.zoom); - --~core.draw (corner_upper_right, x + width - core.base, y, core.zoom); - --~core.draw (corner_lower_left, x, y + height - core.base, core.zoom); - --~core.draw (corner_lower_right, x + width - core.base, y + height - core.base, core.zoom); - --~end; + --~core.draw (corner_upper_right, x + width - core.base * core.zoom, y, core.zoom); + --~core.draw (corner_lower_left, x, y + height - core.base * core.zoom, core.zoom); + --~core.draw (corner_lower_right, x + width - core.base * core.zoom, y + height - core.base * core.zoom, core.zoom); + end; -- for vertical in 0 .. map.height - 1 loop exit when offset.y + (vertical - core.camera.y) * core.base * core.zoom > core.window_height;