diff --git a/source/main.adb b/source/main.adb index 0ae2673..ad41a7f 100644 --- a/source/main.adb +++ b/source/main.adb @@ -112,6 +112,8 @@ procedure main is equipment.full_body => equipment.cyan_robe, others => equipment.none), -- + materials => ((material.apple, 1, 12), (material.skull, 1, 6), others => <>), + -- others => <> ); @@ -239,7 +241,7 @@ begin world.insert_chad (player); world.insert_chad (opponent); - --~world.load ("heyo"); + world.load ("heyo"); ui.active := ui.style'val (faction.enumeration'pos (chad.description (player.index).kind) + 1); diff --git a/source/world.adb b/source/world.adb index 593e2a2..931ab4d 100644 --- a/source/world.adb +++ b/source/world.adb @@ -36,11 +36,11 @@ package body world is procedure compute_world_visibility_grid (offset : in core.vector); procedure compute_world_frame (offset : in core.vector); - function view_chad_basics (data : in chad.information; x, y, limit : in integer) return core.vector; - function view_chad_points (data : in chad.information; x, y, limit : in integer) return core.vector; - function view_chad_skills (data : in chad.information; x, y, limit : in integer) return core.vector; - function view_chad_equipment (data : in chad.information; x, y, limit : in integer) return core.vector; - function view_chad_inventory (data : in chad.information; x, y, limit : in integer) return core.vector; + function view_chad_basics (data : in chad.information; x, y, width : in integer) return core.vector; + function view_chad_points (data : in chad.information; x, y, width : in integer) return core.vector; + function view_chad_skills (data : in chad.information; x, y, width : in integer) return core.vector; + function view_chad_equipment (data : in chad.information; x, y, width : in integer) return core.vector; + function view_chad_inventory (data : in chad.information; x, y, width : in integer) return core.vector; procedure draw_tiles (offset, view_from, view_to : in core.vector); procedure draw_landmarks (offset, view_from, view_to : in core.vector); @@ -493,37 +493,22 @@ package body world is ------------------------------------------------------------------------------------------ - procedure view_chad_information (data : in chad.information; x, y, limit : in integer) is + procedure view_chad_information (data : in chad.information; x, y, width : in integer) is offset : constant integer := 8; - width : constant integer := limit; - height : constant integer := chad.view_height + 11 * core.icon + 4 * core.base + 2 * offset; - side : constant integer := chad.view_width + attribute.count * core.icon; + height : constant integer := chad.view_height + 12 * core.icon + 3 * core.base + 2 * offset; -- orient : core.vector := (0, 0); begin ui.draw_frame (x, y, width, height); -- - orient := orient + view_chad_basics (data, x + offset, y + offset, limit - 2 * offset); - ui.draw_separator ( x + offset, y + offset + orient.y, limit - 2 * offset); - orient := orient + view_chad_points (data, x + offset, y + offset + orient.y + 1 * core.base, limit - 2 * offset); - ui.draw_separator ( x + offset, y + offset + orient.y + 1 * core.base, limit - 2 * offset); - orient := orient + view_chad_equipment (data, x + offset, y + offset + orient.y + 2 * core.base, limit - 2 * offset); - orient := orient + view_chad_skills (data, x + offset, y + offset + orient.y + 2 * core.base, limit - 2 * offset); - ui.draw_separator ( x + offset, y + offset + orient.y + 2 * core.base, limit - 2 * offset); - orient := orient + view_chad_inventory (data, x + offset, y + offset + orient.y + 3 * core.base, limit - 2 * offset); - --~-- - --~at_y := at_y + 3 * core.icon; - --~-- - --~ui.draw_separator (at_x, at_y, width - 2 * offset); - --~-- - --~at_y := at_y + core.base; - --~-- - --~for index in 0 .. 7 loop - --~review_unit_data := data.units (index).index; - --~ui.draw_icon_menu (at_x + index * core.icon, at_y, core.icon, 3 * core.icon, "--"); - --~ui.draw_icon_menu (at_x + index * core.icon, at_y, core.icon, 3 * core.icon, unit.description (data.units (index).index).name.all, review_unit'access); - --~draw_unit (data.units (index).index, core.walk, at_x + index * core.icon + 8, at_y + 8, 1); - --~end loop; + orient := orient + view_chad_basics (data, x + offset, y + offset, width - 2 * offset); + ui.draw_separator ( x + offset, y + offset + orient.y, width - 2 * offset); + orient := orient + view_chad_points (data, x + offset, y + offset + orient.y + 1 * core.base, width - 2 * offset); + ui.draw_separator ( x + offset, y + offset + orient.y + 1 * core.base, width - 2 * offset); + orient := orient + view_chad_equipment (data, x + offset, y + offset + orient.y + 2 * core.base, width - 2 * offset); + orient := orient + view_chad_skills (data, x + offset, y + offset + orient.y + 2 * core.base, width - 2 * offset); + ui.draw_separator ( x + offset, y + offset + orient.y + 2 * core.base, width - 2 * offset); + orient := orient + view_chad_inventory (data, x + offset, y + offset + orient.y + 3 * core.base, width - 2 * offset); end view_chad_information; ------------------------------------------------------------------------------------------ @@ -1151,66 +1136,66 @@ package body world is ------------------------------------------------------------------------------------------ - function view_chad_basics (data : in chad.information; x, y, limit : in integer) return core.vector is + function view_chad_basics (data : in chad.information; x, y, width : in integer) return core.vector is side : constant integer := chad.view_width + attribute.count * core.icon; begin ui.draw_sprite (chad.view (data.index), chad.description (data.index).name.all, x, y, 0, review_chad'access); -- - ui.draw_text_box (x + chad.view_width, y, limit - chad.view_width, core.icon); + ui.draw_text_box (x + chad.view_width, y, width - chad.view_width, core.icon); ui.write (chad.description (data.index).name.all, x + chad.view_width + core.less, y + core.less); -- - ui.draw_text (chad.description (data.index).title.all, x + side, y + 1 * core.icon, limit - side, core.icon, core.more); - ui.draw_text ("Level" & data.level'image, x + side, y + 2 * core.icon, limit - side, core.icon, core.more); + ui.draw_text (chad.description (data.index).title.all, x + side, y + 1 * core.icon, width - side, core.icon, core.more); + ui.draw_text ("Level" & data.level'image, x + side, y + 2 * core.icon, width - side, core.icon, core.more); -- for index in attribute.enumeration loop ui.draw_icon (attribute.icon (index), attribute.description (index).text.all, x + chad.view_width + attribute.enumeration'pos (index) * core.icon, y + core.icon); ui.draw_text (data.attributes (index).value'image, x + attribute.enumeration'pos (index) * core.icon + chad.view_width, y + 2 * core.icon, core.icon, core.icon, core.more); end loop; -- - return (limit, chad.view_height); + return (width, chad.view_height); end view_chad_basics; ------------------------------------------------------------------------------------------ - function view_chad_points (data : in chad.information; x, y, limit : in integer) return core.vector is + function view_chad_points (data : in chad.information; x, y, width : in integer) return core.vector is begin - ui.draw_tiny_fill_bar (x, y + 0 * core.icon + core.icon, limit, float (data.health.value) / float (data.health.limit), (127, 0, 0, 255)); - ui.draw_tiny_fill_bar (x, y + 1 * core.icon + core.icon, limit, float (data.mana.value) / float (data.mana.limit), (0, 0, 127, 255)); - ui.draw_tiny_fill_bar (x, y + 2 * core.icon + core.icon, limit, float (data.stamina.value) / float (data.stamina.limit), (0, 127, 0, 255)); + ui.draw_tiny_fill_bar (x, y + 0 * core.icon + core.icon, width, float (data.health.value) / float (data.health.limit), (127, 0, 0, 255)); + ui.draw_tiny_fill_bar (x, y + 1 * core.icon + core.icon, width, float (data.mana.value) / float (data.mana.limit), (0, 0, 127, 255)); + ui.draw_tiny_fill_bar (x, y + 2 * core.icon + core.icon, width, float (data.stamina.value) / float (data.stamina.limit), (0, 127, 0, 255)); -- ui.write ("Health " & data.health.value'image & " /" & data.health.limit'image, x + core.icon, y + 0 * core.icon + core.more, code => true); ui.write ("Mana " & data.mana.value'image & " /" & data.mana.limit'image, x + core.icon, y + 1 * core.icon + core.more, code => true); ui.write ("Stamina" & data.stamina.value'image & " /" & data.stamina.limit'image, x + core.icon, y + 2 * core.icon + core.more, code => true); -- - return (limit, 3 * core.icon); + return (width, 3 * core.icon); end view_chad_points; ------------------------------------------------------------------------------------------ - function view_chad_skills (data : in chad.information; x, y, limit : in integer) return core.vector is + function view_chad_skills (data : in chad.information; x, y, width : in integer) return core.vector is count : constant natural := skill.limit'last + 1; - width : constant natural := limit / 2; + limit : constant natural := width / 2; begin for index in skill.limit loop ui.draw_icon (data => skill.icon (data.skills (index).index), text => skill.description (data.skills (index).index).text.all, - x => x + (index mod 2) * width, + x => x + (index mod 2) * limit, y => y + (index / 2) * core.icon); -- ui.draw_text (text => skill.description (data.skills (index).index).name.all & data.skills (index).value'image, - x => x + (index mod 2) * width + core.icon, + x => x + (index mod 2) * limit + core.icon, y => y + (index / 2) * core.icon, - width => width - core.icon, + width => limit - core.icon, height => core.icon, offset => core.more); end loop; -- - return (limit, (count / 2) * core.icon); + return (width, (count / 2) * core.icon); end view_chad_skills; ------------------------------------------------------------------------------------------ - function view_chad_equipment (data : in chad.information; x, y, limit : in integer) return core.vector is + function view_chad_equipment (data : in chad.information; x, y, width : in integer) return core.vector is count : constant natural := equipment.kind'pos (equipment.kind'last) + 1; begin for index in equipment.kind loop @@ -1220,14 +1205,14 @@ package body world is y => y); end loop; -- - ui.draw_text ("Equipment", x + count * core.icon, y, limit - count * core.icon, core.icon, core.more); + ui.draw_text ("Equipment", x + count * core.icon, y, width - count * core.icon, core.icon, core.more); -- - return (limit, core.icon); + return (width, core.icon); end view_chad_equipment; ------------------------------------------------------------------------------------------ - function view_chad_inventory (data : in chad.information; x, y, limit : in integer) return core.vector is + function view_chad_inventory (data : in chad.information; x, y, width : in integer) return core.vector is begin for index_y in 0 .. 3 loop for index_x in 0 .. 7 loop @@ -1238,7 +1223,7 @@ package body world is end loop; end loop; -- - return (limit, 4 * core.icon); + return (width, 4 * core.icon); end view_chad_inventory; ------------------------------------------------------------------------------------------ diff --git a/source/world.ads b/source/world.ads index 0d09ce6..a213a0f 100644 --- a/source/world.ads +++ b/source/world.ads @@ -73,7 +73,7 @@ package world is procedure review_unit; procedure review_chad; - procedure view_chad_information (data : in chad.information; x, y, limit : in integer); + procedure view_chad_information (data : in chad.information; x, y, width : in integer); procedure make (index : in biome.enumeration; width, height, landmark_limit, location_limit, construction_limit, equipment_limit, unit_limit, chad_limit : in natural);