From 1930b02b3055b3ce28c23653f1e46f16173bbecf Mon Sep 17 00:00:00 2001 From: xolatile Date: Thu, 6 Jun 2024 04:39:03 -0400 Subject: [PATCH] Refactoring player information sub-menu... --- source/equipment.ads | 2 +- source/main.adb | 149 +++++++++++++++++++++++++++------------------------ 2 files changed, 80 insertions(+), 71 deletions(-) diff --git a/source/equipment.ads b/source/equipment.ads index e701c93..626a66d 100644 --- a/source/equipment.ads +++ b/source/equipment.ads @@ -61,7 +61,7 @@ package equipment is default : constant equip_array := (others => none); description : constant array (enumeration) of definition := ( - none => (others => <>), + none => (others => <>), -- golden_axe => (new string'("Golden Axe"), main_hand, (2, 0, 0, 0, 0, 0), faction.fairy, effect.none), golden_battleaxe => (new string'("Golden Battleaxe"), main_hand, (3, 0, 0, 0, 0, 1), faction.fairy, effect.none), diff --git a/source/main.adb b/source/main.adb index 19c7837..9dbc862 100644 --- a/source/main.adb +++ b/source/main.adb @@ -137,6 +137,81 @@ procedure main is procedure zoom_in is begin core.zoom := 2; end zoom_in; procedure zoom_out is begin core.zoom := 1; end zoom_out; + ------------------------------------------------------------------------------------------ + + procedure player_information is + x : constant integer := preview_width + core.icon; + y : constant integer := core.icon; + width : constant integer := side_panel - 2 * core.icon; + height : constant integer := 640; + offset : constant integer := 8; + begin + ui.draw_frame ("--", x, y, width, height); + ui.draw_sprite (chad.view (player.index), chad.description (player.index).name.all, x + offset, y + offset, 0); + ui.draw_text_box (x + chad.view_width + 2 * offset, y + offset, width - chad.view_width - 3 * offset, core.icon); + ui.write (chad.description (player.index).name.all, x + chad.view_width + 2 * offset + 5, y + offset + 5); + -- + declare move_x : integer := x + chad.view_width + 2 * offset; + begin + for index in attribute.enumeration loop + ui.draw_icon (attribute.icon (index), attribute.description (index).text.all, move_x, y + core.icon + offset); + ui.draw_text_box (move_x, y + 2 * core.icon + offset, core.icon, core.icon); + ui.write (player.attributes (index).value'image, move_x + 3, y + 2 * core.icon + offset + 9, code => true); + -- + move_x := move_x + core.icon; + end loop; + end; + --~ui.draw_tiny_fill_bar (x + chad.view_width + 2 * 8, y + 1 * core.icon + 8, 360 - chad.view_width - 8, float (player.health.value) / float (player.health.limit), (127, 0, 0, 255)); + --~ui.draw_tiny_fill_bar (x + chad.view_width + 2 * 8, y + 2 * core.icon + 8, 360 - chad.view_width - 8, float (player.mana.value) / float (player.mana.limit), (0, 0, 127, 255)); + --~ui.draw_tiny_fill_bar (x + chad.view_width + 2 * 8, y + 3 * core.icon + 8, 360 - chad.view_width - 8, float (player.movement.value) / float (player.movement.limit), (0, 127, 0, 255)); + -- + --~ui.write (text => "Health " & player.health.value'image & " /" & player.health.limit'image, + --~x => x + chad.view_width + core.icon + 3 * 8, + --~y => y + 2 * 8, + --~tint => (255, 127, 127, 255), + --~size => 15, + --~code => true); + --~ui.write (text => "Mana " & player.mana.value'image & " /" & player.mana.limit'image, + --~x => x + chad.view_width + core.icon + 3 * 8, + --~y => y + core.icon + 2 * 8, + --~tint => (127, 127, 255, 255), + --~size => 15, + --~code => true); + --~ui.write (text => "Stamina" & player.movement.value'image & " /" & player.movement.limit'image, + --~x => x + chad.view_width + core.icon + 3 * 8, + --~y => y + 2 * core.icon + 2 * 8, + --~tint => (127, 255, 127, 255), + --~size => 15, + --~code => true); + -- + --~for index_y in 0 .. 3 loop + --~for index_x in 0 .. 5 loop + --~ui.draw_icon (data => equipment.icon (player.items (6 * index_y + index_x)), + --~text => equipment.description (player.items (6 * index_y + index_x)).name.all, + --~x => x + index_x * core.icon, + --~y => y + 96 + 4 * 8 + 2 * core.icon + index_y * core.icon); + --~end loop; + --~end loop; + -- + --~declare move_x : integer := x; + --~move_y : integer := y + 96 + 5 * 8 + 6 * core.icon; + --~begin + --~for index in skill.enumeration loop + --~if (skill.enumeration'pos (index) + 1) mod (skill.count / 2 + 1) = 0 then + --~move_x := x + 2 * core.icon + 120; + --~move_y := y + 96 + 5 * 8 + 6 * core.icon; + --~end if; + --~-- + --~ui.draw_icon (skill.icon (index), skill.description (index).text.all, move_x, move_y); + --~ui.draw_text_box (move_x + core.icon, move_y, core.icon, core.icon); + --~ui.write (player.skills (index).value'image, move_x + core.icon, move_y + 8, (others => 255), 15, true); + --~ui.write (skill.description (index).name.all, move_x + 2 * core.icon + 4, move_y + 8, (others => 255), 15, true); + --~-- + --~move_y := move_y + core.icon; + --~end loop; + --~end; + end player_information; + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ begin @@ -294,7 +369,7 @@ begin --~core.cursor_mode := core.cursor_none; - --~world.load ("heyo"); + world.load ("heyo"); ui.active := ui.style'val (faction.enumeration'pos (chad.description (player.index).kind) + 1); @@ -322,75 +397,7 @@ begin if view_list (status_preview_panel) then ui.draw_tiny_menu (preview_width, 0, side_panel, preview_height); -- - declare player : chad.information := world.map.chads (1); - x : integer := preview_width + core.icon; - y : integer := core.icon; - begin - ui.draw_frame ("--", x, y, 360 + 2 * 8, 96 + 2 * 8); - -- - ui.draw_sprite (chad.view (player.index), chad.description (player.index).name.all, x + 8, y + 8, 0); - -- - ui.draw_tiny_fill_bar (x + chad.view_width + 2 * 8, y + 1 * core.icon + 8, 360 - chad.view_width - 8, float (player.health.value) / float (player.health.limit), (127, 0, 0, 255)); - ui.draw_tiny_fill_bar (x + chad.view_width + 2 * 8, y + 2 * core.icon + 8, 360 - chad.view_width - 8, float (player.mana.value) / float (player.mana.limit), (0, 0, 127, 255)); - ui.draw_tiny_fill_bar (x + chad.view_width + 2 * 8, y + 3 * core.icon + 8, 360 - chad.view_width - 8, float (player.movement.value) / float (player.movement.limit), (0, 127, 0, 255)); - -- - ui.write (text => "Health " & player.health.value'image & " /" & player.health.limit'image, - x => x + chad.view_width + core.icon + 3 * 8, - y => y + 2 * 8, - tint => (255, 127, 127, 255), - size => 15, - code => true); - ui.write (text => "Mana " & player.mana.value'image & " /" & player.mana.limit'image, - x => x + chad.view_width + core.icon + 3 * 8, - y => y + core.icon + 2 * 8, - tint => (127, 127, 255, 255), - size => 15, - code => true); - ui.write (text => "Stamina" & player.movement.value'image & " /" & player.movement.limit'image, - x => x + chad.view_width + core.icon + 3 * 8, - y => y + 2 * core.icon + 2 * 8, - tint => (127, 255, 127, 255), - size => 15, - code => true); - -- - declare move_x : integer := x; - begin - for index in attribute.enumeration loop - ui.draw_icon (attribute.icon (index), attribute.description (index).text.all, move_x, y + 96 + 3 * 8); - ui.draw_text_box (move_x, y + 96 + 3 * 8 + core.icon, core.icon, core.icon); - ui.write (player.attributes (index).value'image, move_x + 4, y + 96 + 3 * 8 + core.icon + 8, (others => 255), 15, true); - -- - move_x := move_x + core.icon; - end loop; - end; - -- - for index_y in 0 .. 3 loop - for index_x in 0 .. 5 loop - ui.draw_icon (data => equipment.icon (player.items (6 * index_y + index_x)), - text => equipment.description (player.items (6 * index_y + index_x)).name.all, - x => x + index_x * core.icon, - y => y + 96 + 4 * 8 + 2 * core.icon + index_y * core.icon); - end loop; - end loop; - -- - declare move_x : integer := x; - move_y : integer := y + 96 + 5 * 8 + 6 * core.icon; - begin - for index in skill.enumeration loop - if (skill.enumeration'pos (index) + 1) mod (skill.count / 2 + 1) = 0 then - move_x := x + 2 * core.icon + 120; - move_y := y + 96 + 5 * 8 + 6 * core.icon; - end if; - -- - ui.draw_icon (skill.icon (index), skill.description (index).text.all, move_x, move_y); - ui.draw_text_box (move_x + core.icon, move_y, core.icon, core.icon); - ui.write (player.skills (index).value'image, move_x + core.icon, move_y + 8, (others => 255), 15, true); - ui.write (skill.description (index).name.all, move_x + 2 * core.icon + 4, move_y + 8, (others => 255), 15, true); - -- - move_y := move_y + core.icon; - end loop; - end; - end; + player_information; -- ui.draw_end_turn_button (x => core.window_width - side_panel + side_panel / 2 - core.icon, y => core.window_height - core.icon - text_box_height - 106 - 2 * core.icon); @@ -468,4 +475,6 @@ begin core.dash; +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + end main;