Refactoring yet again...
This commit is contained in:
parent
4d36dcb5da
commit
b2b79513b3
@ -96,13 +96,13 @@ procedure main is
|
||||
--~new string'(core.folder & "/source/world.ads")
|
||||
--~);
|
||||
|
||||
side_panel : integer := 0;
|
||||
preview_width : integer := 0;
|
||||
preview_height : integer := 0;
|
||||
text_box_height : integer := 0;
|
||||
side_panel : integer := 0;
|
||||
text_box_height : integer := 0;
|
||||
map_frame_width : integer := 0;
|
||||
map_frame_height : integer := 0;
|
||||
|
||||
player : chad.information := (
|
||||
skills => ((skill.archery, 1, 3), (skill.athletics, 1, 3), (skill.tactics, 1, 3), others => <>),
|
||||
skills => ((skill.archery, 1, 3), (skill.athletics, 3, 3), (skill.tactics, 1, 3), (skill.eremnokinesis, 2, 3), others => <>),
|
||||
--
|
||||
equipments => (equipment.chest => equipment.crystal_chestplate,
|
||||
equipment.head => equipment.crystal_helmet,
|
||||
@ -241,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);
|
||||
|
||||
@ -250,26 +250,21 @@ begin
|
||||
--
|
||||
exit when core.engine_active = false;
|
||||
--
|
||||
if not view_list (status_preview_panel) then
|
||||
side_panel := 0;
|
||||
else
|
||||
side_panel := 480;
|
||||
end if;
|
||||
--
|
||||
preview_width := core.window_width - side_panel;
|
||||
preview_height := core.window_height - text_box_height;
|
||||
text_box_height := 32;
|
||||
side_panel := (if view_list (status_preview_panel) then 480 else 0);
|
||||
text_box_height := core.icon;
|
||||
map_frame_width := core.window_width - side_panel;
|
||||
map_frame_height := core.window_height - text_box_height;
|
||||
--
|
||||
world.draw;
|
||||
--
|
||||
if view_list (map_preview_panel) then
|
||||
ui.draw_menu (0, 0, preview_width, preview_height);
|
||||
ui.draw_menu (0, 0, map_frame_width, map_frame_height);
|
||||
end if;
|
||||
--
|
||||
if view_list (status_preview_panel) then
|
||||
ui.draw_tiny_menu (preview_width, 0, side_panel, preview_height);
|
||||
ui.draw_tiny_menu (map_frame_width, 0, side_panel, map_frame_height);
|
||||
--
|
||||
world.view_chad_information (world.map.chads (1), preview_width + core.icon, core.icon, side_panel - 2 * core.icon);
|
||||
world.view_chad_information (world.map.chads (1), map_frame_width + core.icon, core.icon, side_panel - 2 * core.icon);
|
||||
--
|
||||
ui.draw_console_box (x => core.window_width - core.icon - (side_panel - 2 * core.icon),
|
||||
y => core.window_height - core.icon - text_box_height - 106,
|
||||
@ -293,12 +288,12 @@ begin
|
||||
--
|
||||
for index in resource.enumeration loop
|
||||
ui.draw_icon (resource.icon (index), resource.description (index).text.all,
|
||||
(preview_width - 5 * core.icon * resource.count) / 2 + (5 * core.icon) * resource.enumeration'pos (index), core.base);
|
||||
(map_frame_width - 5 * core.icon * resource.count) / 2 + (5 * core.icon) * resource.enumeration'pos (index), core.base);
|
||||
ui.draw_text (world.map.chads (1).resources (index).value'image & " /" & world.map.chads (1).resources (index).limit'image,
|
||||
(preview_width - 5 * core.icon * resource.count) / 2 + (5 * core.icon) * resource.enumeration'pos (index) + core.icon, core.base, 4 * core.icon, core.icon, 10);
|
||||
(map_frame_width - 5 * core.icon * resource.count) / 2 + (5 * core.icon) * resource.enumeration'pos (index) + core.icon, core.base, 4 * core.icon, core.icon, 10);
|
||||
end loop;
|
||||
--
|
||||
--~declare move_x : integer := (preview_width - core.icon * material.count) / 2;
|
||||
--~declare move_x : integer := (map_frame_width - core.icon * material.count) / 2;
|
||||
--~begin
|
||||
--~for index in material.enumeration loop
|
||||
--~if world.map.chads (1).materials (index).value > 0 then
|
||||
|
@ -495,7 +495,7 @@ package body world is
|
||||
|
||||
procedure view_chad_information (data : in chad.information; x, y, width : in integer) is
|
||||
offset : constant integer := 8;
|
||||
height : constant integer := chad.view_height + 12 * core.icon + 3 * core.base + 2 * offset;
|
||||
height : constant integer := chad.view_height + 12 * core.icon + 4 * core.base + 2 * offset;
|
||||
--
|
||||
orient : core.vector := (0, 0);
|
||||
begin
|
||||
@ -506,9 +506,10 @@ package body world is
|
||||
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);
|
||||
orient := orient + view_chad_skills (data, x + offset, y + offset + orient.y + 3 * core.base, width - 2 * offset);
|
||||
ui.draw_separator ( x + offset, y + offset + orient.y + 3 * core.base, width - 2 * offset);
|
||||
orient := orient + view_chad_inventory (data, x + offset, y + offset + orient.y + 4 * core.base, width - 2 * offset);
|
||||
end view_chad_information;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
@ -1138,6 +1139,7 @@ package body world 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;
|
||||
skip : integer := 0;
|
||||
begin
|
||||
ui.draw_sprite (chad.view (data.index), chad.description (data.index).name.all, x, y, 0, review_chad'access);
|
||||
--
|
||||
@ -1148,8 +1150,10 @@ package body world is
|
||||
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);
|
||||
ui.draw_icon (attribute.icon (index), attribute.description (index).text.all, x + chad.view_width + skip, y + core.icon);
|
||||
ui.draw_text (data.attributes (index).value'image, x + chad.view_width + skip, y + 2 * core.icon, core.icon, core.icon, core.more);
|
||||
--
|
||||
skip := skip + core.icon;
|
||||
end loop;
|
||||
--
|
||||
return (width, chad.view_height);
|
||||
@ -1174,20 +1178,13 @@ package body world 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;
|
||||
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) * 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) * limit + core.icon,
|
||||
y => y + (index / 2) * core.icon,
|
||||
width => limit - core.icon,
|
||||
height => core.icon,
|
||||
offset => core.more);
|
||||
ui.draw_icon_and_text (data => skill.icon (data.skills (index).index),
|
||||
text => skill.description (data.skills (index).index).name.all & data.skills (index).value'image,
|
||||
x => x + (index mod 2) * (width / 2),
|
||||
y => y + (index / 2) * core.icon,
|
||||
width => width / 2);
|
||||
end loop;
|
||||
--
|
||||
return (width, (count / 2) * core.icon);
|
||||
@ -1216,7 +1213,7 @@ package body world is
|
||||
begin
|
||||
for index_y in 0 .. 3 loop
|
||||
for index_x in 0 .. 7 loop
|
||||
ui.draw_icon (data => material.icon (data.materials (8 * index_y + index_x).index),
|
||||
ui.draw_icon (data => material.icon (data.materials (8 * index_y + index_x).index),
|
||||
text => material.description (data.materials (8 * index_y + index_x).index).name.all,
|
||||
x => x + index_x * core.icon,
|
||||
y => y + index_y * core.icon);
|
||||
|
Loading…
Reference in New Issue
Block a user