Refactoring player informations...

This commit is contained in:
Ognjen Milan Robovic 2024-06-06 10:00:51 -04:00
parent 32a37a88f4
commit f1bee9dc6a
2 changed files with 16 additions and 30 deletions

View File

@ -140,6 +140,8 @@ procedure main is
------------------------------------------------------------------------------------------
procedure player_information is
player_1 : chad.information renames world.map.chads (1);
--
x : constant integer := preview_width + core.icon;
y : constant integer := core.icon;
width : constant integer := side_panel - 2 * core.icon;
@ -149,16 +151,16 @@ procedure main is
at_y : integer := 0;
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_sprite (chad.view (player_1.index), chad.description (player_1.index).name.all, x + offset, y + offset, 0);
ui.draw_text_box (x + chad.view_width + offset, y + offset, width - chad.view_width - 2 * offset, core.icon);
ui.write (chad.description (player.index).name.all, x + chad.view_width + offset + 5, y + offset + 5);
ui.write (chad.description (player_1.index).name.all, x + chad.view_width + offset + 5, y + offset + 5);
--
ui.draw_text_box (x => x + chad.view_width + attribute.count * core.icon + offset,
y => y + core.icon + offset,
width => width - chad.view_width - attribute.count * core.icon - 2 * offset,
height => core.icon);
--
ui.write (text => chad.description (player.index).title.all,
ui.write (text => chad.description (player_1.index).title.all,
x => x + chad.view_width + attribute.count * core.icon + offset + 10,
y => y + core.icon + offset + 10,
code => true);
@ -168,7 +170,7 @@ procedure main is
width => width - chad.view_width - attribute.count * core.icon - 2 * offset,
height => core.icon);
--
ui.write (text => "Level" & player.level'image,
ui.write (text => "Level" & player_1.level'image,
x => x + chad.view_width + attribute.count * core.icon + offset + 10,
y => y + 2 * core.icon + offset + 10,
code => true);
@ -178,7 +180,7 @@ procedure main is
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 + 5, y + 2 * core.icon + offset + 10, code => true);
ui.write (player_1.attributes (index).value'image, move_x + 5, y + 2 * core.icon + offset + 10, code => true);
--
move_x := move_x + core.icon;
end loop;
@ -187,33 +189,18 @@ procedure main is
at_x := x + offset;
at_y := y + offset + chad.view_height + core.icon;
--
ui.draw_tiny_fill_bar (at_x, at_y + 0 * core.icon, width - 2 * offset, float (player.health.value) / float (player.health.limit), (127, 0, 0, 255));
ui.draw_tiny_fill_bar (at_x, at_y + 1 * core.icon, width - 2 * offset, float (player.mana.value) / float (player.mana.limit), (0, 0, 127, 255));
ui.draw_tiny_fill_bar (at_x, at_y + 2 * core.icon, width - 2 * offset, float (player.movement.value) / float (player.movement.limit), (0, 127, 0, 255));
ui.draw_tiny_fill_bar (at_x, at_y + 0 * core.icon, width - 2 * offset, float (player_1.health.value) / float (player_1.health.limit), (127, 0, 0, 255));
ui.draw_tiny_fill_bar (at_x, at_y + 1 * core.icon, width - 2 * offset, float (player_1.mana.value) / float (player_1.mana.limit), (0, 0, 127, 255));
ui.draw_tiny_fill_bar (at_x, at_y + 2 * core.icon, width - 2 * offset, float (player_1.movement.value) / float (player_1.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);
ui.write ("Health " & player_1.health.value'image & " /" & player_1.health.limit'image, at_x + core.icon, at_y - core.icon + 10, code => true);
ui.write ("Mana " & player_1.mana.value'image & " /" & player_1.mana.limit'image, at_x + core.icon, at_y + 10, code => true);
ui.write ("Movement" & player_1.movement.value'image & " /" & player_1.movement.limit'image, at_x + core.icon, at_y + core.icon + 10, 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,
--~ui.draw_icon (data => equipment.icon (player_1.items (6 * index_y + index_x)),
--~text => equipment.description (player_1.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;
@ -230,7 +217,7 @@ procedure main is
--~--
--~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 (player_1.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;

View File

@ -893,7 +893,6 @@ package body world is
and map.locations (index).state = 0
and core.signal_code'pos (core.signal_mode) = core.signal_code'pos (core.signal_e)
and not ui.prioritize then
--~effect.apply ();
declare player : chad.information renames world.map.chads (1);
--
data : effect.information := location_description (location_index'val (map.locations (index).index)).evoke;