Revised Unit package to use indexed arrays...
This commit is contained in:
parent
572372a3bf
commit
b71493497a
@ -23,7 +23,7 @@ procedure main is
|
|||||||
player : chad.data := (
|
player : chad.data := (
|
||||||
index => chad.ognjen,
|
index => chad.ognjen,
|
||||||
attributes => (1, 2, 3, 4, 5, 6),
|
attributes => (1, 2, 3, 4, 5, 6),
|
||||||
skills => (1, 2, 3, 4, 5, 6, others => 12),
|
skills => (1, 2, 3, 4, 5, 6, 7, 8, 9, others => 0),
|
||||||
resources => (1, 2, 3, 4, 5, 6)
|
resources => (1, 2, 3, 4, 5, 6)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ begin
|
|||||||
|
|
||||||
ui.configure;
|
ui.configure;
|
||||||
|
|
||||||
play (import_song (c_string ("./song/main_menu.ogg")).index);
|
--~play (import_song (c_string ("./song/main_menu.ogg")).index);
|
||||||
|
|
||||||
attribute.configure;
|
attribute.configure;
|
||||||
skill.configure;
|
skill.configure;
|
||||||
|
@ -57,16 +57,16 @@ package body unit is
|
|||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure full_draw (data : in value; x, y : in integer) is
|
procedure draw_data (index : in natural; x, y : in integer) is
|
||||||
begin
|
begin
|
||||||
draw (data.kind, data.state, x, y);
|
draw (list (index).kind, list (index).state, x, y);
|
||||||
--
|
--
|
||||||
for index in item.slot loop
|
for item_index in item.slot loop
|
||||||
if data.items (index).allow then
|
if list (index).items (item_index).allow then
|
||||||
item.draw (data.items (index).index, data.state, x, y);
|
item.draw (list (index).items (item_index).index, list (index).state, x, y);
|
||||||
end if;
|
end if;
|
||||||
end loop;
|
end loop;
|
||||||
end full_draw;
|
end draw_data;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ package unit is
|
|||||||
text : core.long_string;
|
text : core.long_string;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
type value is record
|
type data is record
|
||||||
kind : enumeration;
|
kind : enumeration;
|
||||||
state : core.animation;
|
state : core.animation;
|
||||||
attributes : attribute.points;
|
attributes : attribute.points;
|
||||||
@ -30,6 +30,8 @@ package unit is
|
|||||||
items : item.list;
|
items : item.list;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
|
type data_array is array (0 .. 100) of data;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
count : constant natural := enumeration'pos (enumeration'last) + 1;
|
count : constant natural := enumeration'pos (enumeration'last) + 1;
|
||||||
@ -43,7 +45,7 @@ package unit is
|
|||||||
("Kobold ", faction.kobold, (others => 1), effect.none, " ")
|
("Kobold ", faction.kobold, (others => 1), effect.none, " ")
|
||||||
);
|
);
|
||||||
|
|
||||||
list : array (0 .. 100) of value := (
|
list : data_array := (
|
||||||
others => (dwarf_base, core.idle, (others => 1), (
|
others => (dwarf_base, core.idle, (others => 1), (
|
||||||
item.main_hand => (item.iron_sword, true),
|
item.main_hand => (item.iron_sword, true),
|
||||||
item.full_body => (item.cyan_tunic, true),
|
item.full_body => (item.cyan_tunic, true),
|
||||||
@ -60,7 +62,7 @@ package unit is
|
|||||||
procedure icon (index : in enumeration; x, y : in integer);
|
procedure icon (index : in enumeration; x, y : in integer);
|
||||||
procedure view (index : in enumeration; x, y : in integer);
|
procedure view (index : in enumeration; x, y : in integer);
|
||||||
|
|
||||||
procedure full_draw (data : in value; x, y : in integer);
|
procedure draw_data (index : in natural; x, y : in integer);
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ package body world is
|
|||||||
--
|
--
|
||||||
for index in 1 .. 90 loop
|
for index in 1 .. 90 loop
|
||||||
if map.views (map.units (index).x, map.units (index).y) then
|
if map.views (map.units (index).x, map.units (index).y) then
|
||||||
unit.full_draw (unit.list (map.units (index).index),
|
unit.draw_data (map.units (index).index,
|
||||||
offset.x + (map.units (index).x - core.camera.x) * core.base * core.zoom,
|
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);
|
offset.y + (map.units (index).y - core.camera.y) * core.base * core.zoom);
|
||||||
end if;
|
end if;
|
||||||
|
Loading…
Reference in New Issue
Block a user