Major unit refactoring...
This commit is contained in:
parent
b71493497a
commit
4f46b202df
@ -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),
|
||||
|
@ -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.");
|
||||
|
@ -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;
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -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);
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user