Added unlimited movement by target...

This commit is contained in:
Ognjen Milan Robovic 2024-06-02 09:48:57 -04:00
parent c7253308a3
commit 300c1b78e3
4 changed files with 58 additions and 38 deletions

View File

@ -134,13 +134,13 @@ procedure main is
movement => (10, 20),
attributes => attribute.default,
skills => skill.default,
resources => ((101, 240), (103, 240), (107, 240), (109, 240), (113, 240), (127, 240)),
resources => ((29, 480), (11, 240), (23, 240), (13, 240), (17, 240), (7, 240)),
materials => material.default,
equipments => (equipment.chest => equipment.elven_armour,
equipment.head => equipment.elven_helmet,
equipment.hands => equipment.leather_gauntlets,
equipment.feet => equipment.leather_greaves,
equipment.main_hand => equipment.jade_sword,
equipments => (equipment.chest => equipment.iron_chestplate,
equipment.head => equipment.iron_helmet,
equipment.hands => equipment.iron_gauntlets,
equipment.feet => equipment.iron_greaves,
equipment.main_hand => equipment.iron_sword,
others => equipment.none),
item_count => 0,
items => (others => equipment.none)
@ -325,10 +325,13 @@ begin
height => core.icon,
action => view_show (index));
--
core.draw (view_icon (index), core.window_width - core.icon * (view'pos (view'last) + 1) + core.icon * view'pos (index), core.window_height - core.icon,
core.draw (data => view_icon (index),
x => core.window_width - core.icon * (view'pos (view'last) + 1) + core.icon * view'pos (index),
y => core.window_height - core.icon,
ignore => true,
u => 0,
v => boolean'pos (view_list (index)) * core.icon);
u => 0,
v => boolean'pos (view_list (index)) * core.icon,
factor => 1);
end loop;
--
resource.draw_points (world.map.chads (1).resources, (preview_width - 5 * core.icon * resource.count) / 2, core.base);

View File

@ -33,7 +33,7 @@ package body material is
if data (index).value > 0 then
ui.draw_icon (icon (index), -(description (index).name), move_x, y);
ui.draw_text_box (move_x, y + core.icon, core.icon, core.icon);
ui.write (data (index).value'image, move_x + 4, y + core.icon + 8, (255, 255, 255, 255), 15, true);
ui.write (data (index).value'image, move_x, y + core.icon + 8, (255, 255, 255, 255), 15, true);
--
move_x := move_x + core.icon;
end if;

View File

@ -57,7 +57,7 @@ package body skill is
--
ui.draw_icon (icon (index), -(description (index).text), move_x, move_y);
ui.draw_text_box (move_x + core.icon, move_y, core.icon, core.icon);
ui.write (data (index).value'image, move_x + core.icon + 4, move_y + 8, (255, 255, 255, 255), 15, true);
ui.write (data (index).value'image, move_x + core.icon, move_y + 8, (255, 255, 255, 255), 15, true);
--
ui.write (-(description (index).name), move_x + 2 * core.icon + 4, move_y + 8, (255, 255, 255, 255), 15, true);
--

View File

@ -81,7 +81,10 @@ package body world is
------------------------------------------------------------------------------------------
procedure draw_tiles (offset, view_from, view_to : in core.vector) is
time : float := 0.0;
time : float := 0.0;
step : core.vector := core.camera;
size : constant integer := core.base * core.zoom;
hits : natural := 0;
begin
time := core.time;
--
@ -93,8 +96,8 @@ package body world is
--
if map.views (horizontal, vertical) then
core.draw (data => tiles (map.kind),
x => offset.x + (horizontal - core.camera.x) * core.base * core.zoom,
y => offset.y + (vertical - core.camera.y) * core.base * core.zoom,
x => offset.x + (horizontal - core.camera.x) * size,
y => offset.y + (vertical - core.camera.y) * size,
u => core.base * map.tiles (horizontal, vertical),
v => core.base * (core.animation_time mod tiles (map.kind).frames),
width => core.base,
@ -103,38 +106,50 @@ package body world is
--
core.increment (drawn_tiles);
--
if core.cursor.x > offset.x + (horizontal - core.camera.x ) * core.base * core.zoom - 6
and core.cursor.x < offset.x + (horizontal - core.camera.x + 1) * core.base * core.zoom + 6
and core.cursor.y > offset.y + (vertical - core.camera.y ) * core.base * core.zoom - 6
and core.cursor.y < offset.y + (vertical - core.camera.y + 1) * core.base * core.zoom + 6
if core.cursor_inside (x => offset.x + (horizontal - core.camera.x) * size,
y => offset.y + (vertical - core.camera.y) * size,
width => size,
height => size)
and core.cursor_mode = core.cursor_left
and not ui.prioritize then
target.x := horizontal;
target.y := vertical;
--
target.x := horizontal;
target.y := vertical;
core.cursor_mode := core.cursor_none;
end if;
--
if core.cursor_inside (x => offset.x + (target.x - core.camera.x) * size,
y => offset.y + (target.y - core.camera.y) * size,
width => size,
height => size)
and core.cursor_mode = core.cursor_left
and not ui.prioritize then
world.map.chads (1).x := horizontal + 1;
world.map.chads (1).y := vertical;
end if;
end if;
end loop;
end loop;
--
core.draw (data => arrow_target,
x => offset.x + (target.x - core.camera.x) * core.base * core.zoom,
y => offset.y + (target.y - core.camera.y) * core.base * core.zoom,
factor => core.zoom);
--
if target /= (-1, -1) then
declare step : core.vector := core.camera;
size : constant integer := core.base * core.zoom;
begin
--~loop exit when step.x = target.x - 1;
--~loop exit when step.y = target.y - 1;
step := core.camera;
hits := 0;
--
core.draw (data => arrow_target,
x => offset.x + (target.x - core.camera.x) * size,
y => offset.y + (target.y - core.camera.y) * size,
factor => core.zoom);
--
loop
exit when (step.x = target.x - 1 and step.y = target.y - 1) or (hits = 6);
--
if step.x < target.x and step.y < target.y then
core.draw (arrow_lower_right, offset.x + (step.x + 1 - core.camera.x) * size, offset.y + (step.y + 1 - core.camera.y) * size, factor => core.zoom);
step.x := step.x + 1; step.y := step.y + 1;
step.x := step.x + 1;
step.y := step.y + 1;
elsif step.x > target.x and step.y < target.y then
core.draw (arrow_lower_left, offset.x + (step.x - 1 - core.camera.x) * size, offset.y + (step.y + 1 - core.camera.y) * size, factor => core.zoom);
step.x := step.x - 1; step.y := step.y + 1;
step.x := step.x - 1;
step.y := step.y + 1;
elsif step.x = target.x and step.y < target.y then
core.draw (arrow_lower, offset.x + (step.x - core.camera.x) * size, offset.y + (step.y + 1 - core.camera.y) * size, factor => core.zoom);
step.y := step.y + 1;
@ -146,17 +161,19 @@ package body world is
step.x := step.x - 1;
elsif step.x < target.x and step.y > target.y then
core.draw (arrow_upper_right, offset.x + (step.x + 1 - core.camera.x) * size, offset.y + (step.y - 1 - core.camera.y) * size, factor => core.zoom);
step.x := step.x + 1; step.y := step.y - 1;
step.x := step.x + 1;
step.y := step.y - 1;
elsif step.x > target.x and step.y > target.y then
core.draw (arrow_upper_left, offset.x + (step.x - 1 - core.camera.x) * size, offset.y + (step.y - 1 - core.camera.y) * size, factor => core.zoom);
step.x := step.x - 1; step.y := step.y - 1;
step.x := step.x - 1;
step.y := step.y - 1;
elsif step.x = target.x and step.y > target.y then
core.draw (arrow_upper, offset.x + (step.x - core.camera.x) * size, offset.y + (step.y - 1 - core.camera.y) * size, factor => core.zoom);
step.y := step.y - 1;
end if;
--~end loop;
--~end loop;
end;
--
hits := hits + 1;
end loop;
end if;
--
draw_tiles_timer := natural (1_000_000.0 * (core.time - time));