diff --git a/source/item.ads b/source/item.ads index b91b27a..63c2e5c 100644 --- a/source/item.ads +++ b/source/item.ads @@ -9,11 +9,12 @@ package item is ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ type slot is ( - full_body, head, chest, hands, feet, - neck, main_hand, off_hand + full_body, head, chest, hands, feet, neck, + main_hand, off_hand ); type enumeration is ( + none, -- 04.05.2024. bone_chestplate, bronze_chestplate, chainmail_chestplate, crystal_chestplate, golden_chestplate, iron_chestplate, leather_chestplate, mithril_chestplate, steel_chestplate, bone_greaves, bronze_greaves, chainmail_greaves, @@ -46,17 +47,20 @@ package item is end record; type value is record - index : enumeration; - allow : boolean; + data : enumeration := item.none; + show : boolean := true; end record; - type list is array (slot) of value; + type equip_array is array (slot) of value; ------------------------------------------------------------------------------------------ + empty : constant value := (item.none, false); + count : constant natural := enumeration'pos (enumeration'last) + 1; trait : constant array (enumeration) of information := ( + ("-- ", head, (0, 0, 0, 0, 0, 0), faction.neutral, effect.none), ("bone_chestplate, ", chest, (0, 0, 0, 0, 0, 0), faction.neutral, effect.none), ("bronze_chestplate, ", chest, (0, 0, 0, 0, 0, 0), faction.neutral, effect.none), ("chainmail_chestplate, ", chest, (0, 0, 0, 0, 0, 0), faction.neutral, effect.none), diff --git a/source/main.adb b/source/main.adb index fe189c3..8f70749 100644 --- a/source/main.adb +++ b/source/main.adb @@ -208,7 +208,7 @@ begin world.configure; --~ai.configure; - world.make (world.grass, 240, 180); + world.make (world.grass, 60, 40); dash; echo (success, "Successfully initialized game data, entering main gameplay loop."); diff --git a/source/unit.adb b/source/unit.adb index b476613..0acbea8 100644 --- a/source/unit.adb +++ b/source/unit.adb @@ -57,16 +57,17 @@ package body unit is ------------------------------------------------------------------------------------------ - procedure draw_data (index : in natural; x, y : in integer) is + procedure draw_full (index : in natural; x, y : in integer) is + limit : constant value_count := value_count (index); begin - draw (list (index).kind, list (index).state, x, y); + draw (values (limit).kind, values (limit).state, x, y); -- for item_index in item.slot loop - if list (index).items (item_index).allow then - item.draw (list (index).items (item_index).index, list (index).state, x, y); + if values (limit).items (item_index).show then + item.draw (values (limit).items (item_index).data, values (limit).state, x, y); end if; end loop; - end draw_data; + end draw_full; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/source/unit.ads b/source/unit.ads index 29973e6..41911a1 100644 --- a/source/unit.ads +++ b/source/unit.ads @@ -22,15 +22,16 @@ package unit is text : core.long_string; end record; - type data is record - kind : enumeration; - state : core.animation; - attributes : attribute.points; - -- - items : item.list; + type value is record + name : core.short_string := "-- "; + kind : enumeration := imp_base; + state : core.animation := core.idle; + attributes : attribute.points := (others => 0); + items : item.equip_array := (others => item.empty); end record; - type data_array is array (0 .. 100) of data; + type value_count is range 0 .. 100; + type value_array is array (value_count) of value; ------------------------------------------------------------------------------------------ @@ -45,13 +46,22 @@ package unit is ("Kobold ", faction.kobold, (others => 1), effect.none, " ") ); - list : data_array := ( - others => (dwarf_base, core.idle, (others => 1), ( - item.main_hand => (item.iron_sword, true), - item.full_body => (item.cyan_tunic, true), - item.head => (item.iron_helmet, true), - item.feet => (item.iron_greaves, true), - others => (item.iron_sword, false))) + default_value : value; + + 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)), + -- + ("Dwarf Berserker ", dwarf_base, core.idle, (3, 2, 1, 3, 2, 2), + (item.main_hand => (item.mithril_battleaxe, true), + others => item.empty)), + -- + ("Dwarf Berserker ", dwarf_base, core.idle, (3, 2, 1, 3, 2, 2), + (item.main_hand => (item.mithril_mace, true), + others => item.empty)), + -- + others => default_value ); ------------------------------------------------------------------------------------------ @@ -62,7 +72,7 @@ package unit is procedure icon (index : in enumeration; x, y : in integer); procedure view (index : in enumeration; x, y : in integer); - procedure draw_data (index : in natural; x, y : in integer); + procedure draw_full (index : in natural; x, y : in integer); ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/source/world.adb b/source/world.adb index 57ba979..c45fa31 100644 --- a/source/world.adb +++ b/source/world.adb @@ -221,7 +221,7 @@ package body world is -- for index in 1 .. 90 loop if map.views (map.units (index).x, map.units (index).y) then - unit.draw_data (map.units (index).index, + unit.draw_full (map.units (index).index, offset.x + (map.units (index).x - core.camera.x) * core.base * core.zoom, offset.y + (map.units (index).y - core.camera.y) * core.base * core.zoom); end if;