Renamed Item package, minor changes...

This commit is contained in:
Ognjen Milan Robovic 2024-05-11 03:38:33 -04:00
parent f7e3d41b05
commit 4e3d5cfa61
7 changed files with 36 additions and 36 deletions

View File

@ -4,19 +4,19 @@
with core;
package body item is
package body equipment is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure configure is
begin
core.echo (core.comment, "Configuring item components...");
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 ("./sprite/item/" & folder & "/" & file & ".png", 4, 6);
sprite (index) := core.import_sprite ("./sprite/equipment/" & folder & "/" & file & ".png", 4, 6);
end;
end loop;
end configure;
@ -30,4 +30,4 @@ package body item is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end item;
end equipment;

View File

@ -4,7 +4,7 @@
with core, effect, attribute, faction;
package item is
package equipment is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -47,7 +47,7 @@ package item is
end record;
type value is record
data : enumeration := item.none;
data : enumeration := equipment.none;
show : boolean := true;
end record;
@ -55,7 +55,7 @@ package item is
------------------------------------------------------------------------------------------
empty : constant value := (item.none, false);
empty : constant value := (equipment.none, false);
count : constant natural := enumeration'pos (enumeration'last) + 1;
@ -180,4 +180,4 @@ package item is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end item;
end equipment;

View File

@ -4,8 +4,8 @@
pragma ada_2012;
--~with core, ui, effect, attribute, skill, resource, faction, might, magic, item, unit, construction, chad, deity, world, ai;
with core, ui, effect, attribute, skill, resource, faction, item, unit, construction, chad, world;
--~with core, ui, effect, attribute, skill, resource, faction, might, magic, equipment, unit, construction, chad, deity, world, ai;
with core, ui, effect, attribute, skill, resource, faction, equipment, unit, construction, chad, world;
use core;
@ -154,7 +154,7 @@ begin
resource.configure;
--~might.configure;
--~magic.configure;
item.configure;
equipment.configure;
unit.configure;
construction.configure;
chad.configure;

View File

@ -62,9 +62,9 @@ package body unit is
begin
draw (values (limit).kind, values (limit).state, x, y);
--
for item_index in item.slot loop
if values (limit).items (item_index).show then
item.draw (values (limit).items (item_index).data, values (limit).state, x, y);
for equipment_index in equipment.slot loop
if values (limit).equipments (equipment_index).show then
equipment.draw (values (limit).equipments (equipment_index).data, values (limit).state, x, y);
end if;
end loop;
end draw_full;

View File

@ -2,7 +2,7 @@
--
-- GNU General Public Licence (version 3 or later)
with core, effect, attribute, faction, item;
with core, effect, attribute, faction, equipment;
package unit is
@ -27,7 +27,7 @@ package unit is
kind : enumeration := imp_base;
state : core.animation := core.idle;
attributes : attribute.points := (others => 0);
items : item.equip_array := (others => item.empty);
equipments : equipment.equip_array := (others => equipment.empty);
end record;
type value_limit is range 0 .. 100;
@ -50,16 +50,16 @@ package unit is
values : value_array := (
("Dwarf Berserker ", dwarf_base, core.idle, (3, 2, 1, 3, 2, 2),
(item.main_hand => (item.mithril_axe, true),
others => item.empty)),
(equipment.main_hand => (equipment.mithril_axe, true),
others => equipment.empty)),
--
("Dwarf Berserker ", dwarf_base, core.idle, (3, 2, 1, 3, 2, 2),
(item.main_hand => (item.mithril_battleaxe, true),
others => item.empty)),
(equipment.main_hand => (equipment.mithril_battleaxe, true),
others => equipment.empty)),
--
("Dwarf Berserker ", dwarf_base, core.idle, (3, 2, 1, 3, 2, 2),
(item.main_hand => (item.mithril_mace, true),
others => item.empty)),
(equipment.main_hand => (equipment.mithril_mace, true),
others => equipment.empty)),
--
others => default_value
);

View File

@ -2,7 +2,7 @@
--
-- GNU General Public Licence (version 3 or later)
with core, ui, resource, item, unit, construction;
with core, ui, resource, equipment, unit, construction;
package body world is
@ -65,7 +65,7 @@ package body world is
map.views := new view_array (0 .. map.width - 1, 0 .. map.height - 1);
map.landmarks := new entity_array (1 .. landmark_limit);
map.constructions := new entity_array (1 .. 30);
map.items := new entity_array (1 .. 60);
map.equipments := new entity_array (1 .. 60);
map.units := new entity_array (1 .. 90);
--
for x in 0 .. width - 1 loop
@ -111,9 +111,9 @@ package body world is
end loop;
--
for index in 1 .. 60 loop
map.items (index).index := core.random (0, item.count - 1);
map.items (index).x := core.random (0, map.width - 1);
map.items (index).y := core.random (0, map.height - 1);
map.equipments (index).index := core.random (0, equipment.count - 1);
map.equipments (index).x := core.random (0, map.width - 1);
map.equipments (index).y := core.random (0, map.height - 1);
end loop;
--
for index in 1 .. 90 loop
@ -211,11 +211,11 @@ package body world is
end loop;
--
for index in 1 .. 60 loop
if map.views (map.items (index).x, map.items (index).y) then
item.draw (item.enumeration'val (map.items (index).index),
if map.views (map.equipments (index).x, map.equipments (index).y) then
equipment.draw (equipment.enumeration'val (map.equipments (index).index),
core.idle,
offset.x + (map.items (index).x - core.camera.x) * core.base * core.zoom,
offset.y + (map.items (index).y - core.camera.y) * core.base * core.zoom);
offset.x + (map.equipments (index).x - core.camera.x) * core.base * core.zoom,
offset.y + (map.equipments (index).y - core.camera.y) * core.base * core.zoom);
end if;
end loop;
--
@ -281,13 +281,13 @@ package body world is
end loop;
--
for index in 1 .. 60 loop
core.render_image (data => item.sprite (item.enumeration'val (map.items (index).index)),
core.render_image (data => equipment.sprite (equipment.enumeration'val (map.equipments (index).index)),
x => map.landmarks (index).x * core.base,
y => map.landmarks (index).y * core.base,
u => 0,
v => 0,
width => item.sprite (item.enumeration'val (map.items (index).index)).width,
height => item.sprite (item.enumeration'val (map.items (index).index)).height);
width => equipment.sprite (equipment.enumeration'val (map.equipments (index).index)).width,
height => equipment.sprite (equipment.enumeration'val (map.equipments (index).index)).height);
end loop;
--
core.export_image (file_path);

View File

@ -2,7 +2,7 @@
--
-- GNU General Public Licence (version 3 or later)
with core, item, unit, construction;
with core, equipment, unit, construction;
package world is
@ -44,7 +44,7 @@ package world is
views : access view_array;
landmarks : access entity_array;
constructions : access entity_array;
items : access entity_array;
equipments : access entity_array;
units : access entity_array;
end record;