2024-04-25 00:27:13 -04:00
|
|
|
-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic
|
|
|
|
--
|
|
|
|
-- GNU General Public Licence (version 3 or later)
|
|
|
|
|
2024-05-08 15:43:44 -04:00
|
|
|
with core, ui, effect, attribute, faction;
|
2024-02-15 21:03:09 -05:00
|
|
|
|
|
|
|
package body unit is
|
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
2024-03-11 15:35:56 -04:00
|
|
|
view_width : constant integer := 48;
|
|
|
|
view_height : constant integer := 64;
|
|
|
|
|
2024-05-21 11:14:17 -04:00
|
|
|
base : array (faction.fairy .. faction.imp) of core.sprite;
|
2024-05-21 12:15:51 -04:00
|
|
|
--~icon : array (enumeration) of core.sprite;
|
|
|
|
--~view : array (enumeration) of core.sprite;
|
2024-02-15 21:03:09 -05:00
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
procedure configure is
|
|
|
|
begin
|
2024-03-11 08:42:25 -04:00
|
|
|
core.echo (core.comment, "Configuring unit components...");
|
|
|
|
--
|
2024-05-21 11:14:17 -04:00
|
|
|
for index in faction.fairy .. faction.imp loop
|
|
|
|
base (index) := core.import_sprite (core.folder & "/game/unit/" & core.lowercase (faction.enumeration'image (index)) & "/base.png", 4, 6);
|
2024-02-15 21:03:09 -05:00
|
|
|
end loop;
|
|
|
|
end configure;
|
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
|
2024-05-21 12:15:51 -04:00
|
|
|
procedure draw (index : in enumeration; state : in core.animation; x, y : in integer) is
|
|
|
|
begin
|
2024-06-01 11:27:59 -04:00
|
|
|
core.draw (base (description (index).kind), x, y, state => state);
|
2024-05-21 12:15:51 -04:00
|
|
|
--
|
|
|
|
for slot in equipment.slot loop
|
2024-06-02 11:12:17 -04:00
|
|
|
core.draw (equipment.sprite (description (index).equipments (slot)), x, y, state => state);
|
2024-05-21 12:15:51 -04:00
|
|
|
end loop;
|
|
|
|
end draw;
|
2024-02-15 21:03:09 -05:00
|
|
|
|
2024-03-11 12:50:29 -04:00
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
|
2024-05-21 11:14:17 -04:00
|
|
|
--~procedure draw_icon (index : in enumeration; x, y : in integer) is
|
|
|
|
--~begin
|
2024-06-01 11:27:59 -04:00
|
|
|
--~ui.draw_overicon (icon (index), description (index).text, x, y);
|
2024-05-21 11:14:17 -04:00
|
|
|
--~end draw_icon;
|
2024-03-11 12:50:29 -04:00
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
|
2024-05-21 11:14:17 -04:00
|
|
|
--~procedure draw_view (index : in enumeration; x, y : in integer) is
|
|
|
|
--~offset : constant integer := 4;
|
|
|
|
--~begin
|
|
|
|
--~core.draw (view (index), x + offset, y + offset);
|
|
|
|
--~ui.draw_icon_menu (x, y, view_width + 2 * offset, view_height + 2 * offset);
|
|
|
|
--~end draw_view;
|
2024-03-11 12:50:29 -04:00
|
|
|
|
2024-02-15 21:03:09 -05:00
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
end unit;
|