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; with core;
package body item is package body equipment is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure configure is procedure configure is
begin begin
core.echo (core.comment, "Configuring item components..."); core.echo (core.comment, "Configuring equipment components...");
-- --
for index in enumeration loop for index in enumeration loop
declare folder : constant string := core.lowercase (slot'image (trait (index).kind)); declare folder : constant string := core.lowercase (slot'image (trait (index).kind));
file : constant string := core.lowercase (enumeration'image (index)); file : constant string := core.lowercase (enumeration'image (index));
begin 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;
end loop; end loop;
end configure; 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; with core, effect, attribute, faction;
package item is package equipment is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -47,7 +47,7 @@ package item is
end record; end record;
type value is record type value is record
data : enumeration := item.none; data : enumeration := equipment.none;
show : boolean := true; show : boolean := true;
end record; 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; 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; 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, might, magic, equipment, 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, equipment, unit, construction, chad, world;
use core; use core;
@ -154,7 +154,7 @@ begin
resource.configure; resource.configure;
--~might.configure; --~might.configure;
--~magic.configure; --~magic.configure;
item.configure; equipment.configure;
unit.configure; unit.configure;
construction.configure; construction.configure;
chad.configure; chad.configure;

View File

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

View File

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

View File

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

View File

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