diff --git a/source/chad.adb b/source/chad.adb index d6123f2..7967c7a 100644 --- a/source/chad.adb +++ b/source/chad.adb @@ -8,38 +8,6 @@ package body chad is ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - view_width : constant integer := 64; - view_height : constant integer := 96; - - sprite : array (enumeration) of core.sprite; - view : array (enumeration) of core.sprite; - - ------------------------------------------------------------------------------------------ - - procedure configure is - begin - core.echo (core.comment, "Configuring chad components..."); - -- - for index in enumeration loop - sprite (index) := core.import_sprite (core.folder & "/game/chad/" & core.lowercase (enumeration'image (index)) & ".png", 4, 6); - view (index) := core.import_sprite (core.folder & "/view/chad/" & core.lowercase (enumeration'image (index)) & ".png", 1, 1); - null; - end loop; - end configure; - - ------------------------------------------------------------------------------------------ - - procedure draw (player : in information; x, y : in integer) is - begin - core.draw (sprite (player.index), x, y, state => player.state); - -- - for index in equipment.slot loop - core.draw (equipment.sprite (player.equipments (index)), x, y, state => player.state); - end loop; - end draw; - - ------------------------------------------------------------------------------------------ - procedure draw_data (player : in information; x, y : in integer) is offset : constant integer := 8; begin diff --git a/source/chad.ads b/source/chad.ads index bbdcd8f..6f824e6 100644 --- a/source/chad.ads +++ b/source/chad.ads @@ -60,11 +60,14 @@ package chad is marina => ("Marina Ann Hantzis ", faction.imp, attribute.reach, skill.necromancy, resource.gold) ); + view_width : constant integer := 64; + view_height : constant integer := 96; + + sprite : array (enumeration) of core.sprite; + view : array (enumeration) of core.sprite; + ------------------------------------------------------------------------------------------ - procedure configure; - - procedure draw (player : in information; x, y : in integer); procedure draw_data (player : in information; x, y : in integer); ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/source/main.adb b/source/main.adb index 7800190..f158a88 100644 --- a/source/main.adb +++ b/source/main.adb @@ -264,7 +264,13 @@ begin end; end loop; - chad.configure; + core.echo (core.comment, "Configuring" & chad.count'image & "chad components..."); + -- + for index in chad.enumeration loop + chad.sprite (index) := core.import_sprite (core.folder & "/game/chad/" & core.lowercase (chad.enumeration'image (index)) & ".png", 4, 6); + chad.view (index) := core.import_sprite (core.folder & "/view/chad/" & core.lowercase (chad.enumeration'image (index)) & ".png", 1, 1); + end loop; + world.configure; --~ai.configure; diff --git a/source/world.adb b/source/world.adb index 39a3528..330590a 100644 --- a/source/world.adb +++ b/source/world.adb @@ -405,9 +405,17 @@ package body world is -- for index in 1 .. map.chad_count loop if map.views (map.chads (index).x, map.chads (index).y) then - chad.draw (map.chads (index), - offset.x + (map.chads (index).x - core.camera.x) * core.base * core.zoom, - offset.y + (map.chads (index).y - core.camera.y) * core.base * core.zoom); + core.draw (data => chad.sprite (map.chads (index).index), + x => offset.x + (map.chads (index).x - core.camera.x) * core.base * core.zoom, + y => offset.y + (map.chads (index).y - core.camera.y) * core.base * core.zoom, + state => map.chads (index).state); + -- + for slot in equipment.slot loop + core.draw (data => equipment.sprite (map.chads (index).equipments (slot)), + x => offset.x + (map.chads (index).x - core.camera.x) * core.base * core.zoom, + y => offset.y + (map.chads (index).y - core.camera.y) * core.base * core.zoom, + state => map.chads (index).state); + end loop; -- core.increment (drawn_units); end if;