74 lines
2.7 KiB
Ada
74 lines
2.7 KiB
Ada
-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic
|
|
--
|
|
-- GNU General Public Licence (version 3 or later)
|
|
|
|
with core, ui;
|
|
|
|
package body equipment is
|
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
function "/" (a, b : in enumeration) return boolean is
|
|
begin
|
|
return natural (enumeration'pos (a)) /= natural (enumeration'pos (b));
|
|
end "/";
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
procedure configure is
|
|
begin
|
|
core.echo (core.comment, "Configuring equipment components...");
|
|
--
|
|
for index in enumeration loop
|
|
declare folder : constant string := core.lowercase (slot'image (trait (index).kind));
|
|
file : constant string := core.lowercase (enumeration'image (index));
|
|
begin
|
|
sprite (index) := core.import_sprite (core.folder & "/game/equipment/" & folder & "/" & file & ".png", 4, 6);
|
|
icon_sprite (index) := core.import_sprite (core.folder & "/icon/equipment/" & folder & "/" & file & ".png", 1, 1);
|
|
end;
|
|
end loop;
|
|
end configure;
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
procedure draw (index : in enumeration; state : in core.animation; x, y : in integer) is
|
|
begin
|
|
--~if index = none then
|
|
--~return;
|
|
--~end if;
|
|
--
|
|
core.draw (sprite (index), x, y, state => state);
|
|
end draw;
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
procedure draw_plus (index : in enumeration; state : in core.animation; x, y : in integer) is
|
|
begin
|
|
draw (index, state, x, y);
|
|
--
|
|
if core.cursor_inside (x, y, sprite (index).width, sprite (index).height)
|
|
and core.cursor_mode = 2
|
|
and index / none
|
|
and not ui.prioritize then
|
|
core.write_text_box (trait (index).name);
|
|
end if;
|
|
end draw_plus;
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
--~procedure draw_icon (index : in enumeration; x, y : in integer) is
|
|
--~begin
|
|
--~core.draw (icon_sprite (index), x, y, factor => 1);
|
|
--~end draw_icon;
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
function exist (index : in enumeration) return boolean is
|
|
begin
|
|
return index / none;
|
|
end exist;
|
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
end equipment;
|