Added chads and more chad information, also refactored UI...
This commit is contained in:
parent
f06b32f8ae
commit
6e85588237
@ -8,7 +8,11 @@ package body chad is
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
sprite : array (enumeration) of core.sprite;
|
||||
view_width : constant integer := 64;
|
||||
view_height : constant integer := 96;
|
||||
|
||||
sprite : array (enumeration) of core.sprite;
|
||||
view_sprite : array (enumeration) of core.sprite;
|
||||
|
||||
pepe_the_frog : core.sprite;
|
||||
alice_the_mad : core.sprite;
|
||||
@ -23,7 +27,8 @@ package body chad is
|
||||
alice_the_mad := core.import_sprite ("./sprite/unit/alice_the_mad.png", 4, 6);
|
||||
--
|
||||
for index in enumeration loop
|
||||
--~sprite (index) := core.import_sprite ("./sprite/chad/" & core.lowercase (enumeration'image (index)) & ".png", 4, 6);
|
||||
sprite (index) := core.import_sprite ("./sprite/chad/" & core.lowercase (enumeration'image (index)) & ".png", 4, 6);
|
||||
view_sprite (index) := core.import_sprite ("./sprite/chad/view/" & core.lowercase (enumeration'image (index)) & ".png", 1, 1);
|
||||
null;
|
||||
end loop;
|
||||
end configure;
|
||||
@ -37,6 +42,13 @@ package body chad is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure view (index : in enumeration; x, y : in integer) is
|
||||
begin
|
||||
ui.draw_sprite (view_sprite (index), trait (index).name, x, y, 0);
|
||||
end view;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw_data (player : in data; x, y : in integer) is
|
||||
begin
|
||||
attribute.draw_points (player.attributes, x, y, true);
|
||||
|
@ -24,6 +24,9 @@ package chad is
|
||||
|
||||
type data is record
|
||||
index : enumeration;
|
||||
health : core.point;
|
||||
mana : core.point;
|
||||
stamina : core.point;
|
||||
attributes : attribute.points;
|
||||
skills : skill.points;
|
||||
resources : resource.points;
|
||||
@ -47,6 +50,7 @@ package chad is
|
||||
procedure configure;
|
||||
|
||||
procedure draw (index : in enumeration; x, y : in integer);
|
||||
procedure view (index : in enumeration; x, y : in integer);
|
||||
procedure draw_data (player : in data; x, y : in integer);
|
||||
|
||||
procedure draw_pepe;
|
||||
|
@ -46,6 +46,46 @@ package body core is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
function "+" (data : in point; modifier : in natural) return point is
|
||||
this : point := data;
|
||||
begin
|
||||
this.value := (if (data.value + modifier) > data.limit then data.limit else (data.value + modifier));
|
||||
--
|
||||
return this;
|
||||
end "+";
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
function "-" (data : in point; modifier : in natural) return point is
|
||||
this : point := data;
|
||||
begin
|
||||
this.value := (if (data.value - modifier) <= 0 then 0 else (data.value - modifier));
|
||||
--
|
||||
return this;
|
||||
end "-";
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
function "*" (data : in point; modifier : in natural) return point is
|
||||
this : point := data;
|
||||
begin
|
||||
this.value := (if (data.value * modifier) > data.limit then data.limit else (data.value * modifier));
|
||||
--
|
||||
return this;
|
||||
end "*";
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
function "/" (data : in point; modifier : in natural) return point is
|
||||
this : point := data;
|
||||
begin
|
||||
this.value := (if (data.value / modifier) <= 0 then 0 else (data.value / modifier));
|
||||
--
|
||||
return this;
|
||||
end "/";
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure echo (status : in echo_status;
|
||||
text : in string) is
|
||||
begin
|
||||
@ -265,27 +305,27 @@ package body core is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw_horizontally (data : in sprite; x, y, width : in integer) is
|
||||
procedure draw_horizontally (data : in sprite; x, y, width, factor : in integer) is
|
||||
begin
|
||||
for move in 0 .. width / data.width - 1 loop
|
||||
draw (data, x + move * data.width, y);
|
||||
draw (data, x + move * data.width, y, factor => 1);
|
||||
end loop;
|
||||
--
|
||||
if width mod data.width > 0 then
|
||||
draw (data, x + (width / data.width) * data.width, y, 0, 0, width mod data.width, data.height);
|
||||
draw (data, x + (width / data.width) * data.width, y, 0, 0, width mod data.width, data.height, factor => 1);
|
||||
end if;
|
||||
end draw_horizontally;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw_vertically (data : in sprite; x, y, height : in integer) is
|
||||
procedure draw_vertically (data : in sprite; x, y, height, factor : in integer) is
|
||||
begin
|
||||
for move in 0 .. height / data.height - 1 loop
|
||||
draw (data, x, y + move * data.height);
|
||||
draw (data, x, y + move * data.height, factor => 1);
|
||||
end loop;
|
||||
--
|
||||
if height mod data.height > 0 then
|
||||
draw (data, x, y + (height / data.height) * data.height, 0, 0, data.width, height mod data.height);
|
||||
draw (data, x, y + (height / data.height) * data.height, 0, 0, data.width, height mod data.height, factor => 1);
|
||||
end if;
|
||||
end draw_vertically;
|
||||
|
||||
|
@ -44,6 +44,10 @@ package core is
|
||||
|
||||
type pointer is access procedure;
|
||||
|
||||
type point is record
|
||||
value, limit : natural;
|
||||
end record;
|
||||
|
||||
type vector is record x, y : integer; end record;
|
||||
type sprite is record index, width, height, frames, states : integer; end record;
|
||||
type font is record index, scale, space : integer; end record;
|
||||
@ -107,6 +111,11 @@ package core is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
function "+" (data : in point; modifier : in natural) return point;
|
||||
function "-" (data : in point; modifier : in natural) return point;
|
||||
function "*" (data : in point; modifier : in natural) return point;
|
||||
function "/" (data : in point; modifier : in natural) return point;
|
||||
|
||||
procedure echo (status : in echo_status; text : in string);
|
||||
|
||||
procedure dash;
|
||||
@ -148,8 +157,8 @@ package core is
|
||||
factor : in integer := zoom;
|
||||
tint : in colour := (others => 255));
|
||||
|
||||
procedure draw_horizontally (data : in sprite; x, y, width : in integer);
|
||||
procedure draw_vertically (data : in sprite; x, y, height : in integer);
|
||||
procedure draw_horizontally (data : in sprite; x, y, width, factor : in integer);
|
||||
procedure draw_vertically (data : in sprite; x, y, height, factor : in integer);
|
||||
|
||||
procedure write (text : in string := "";
|
||||
x : in integer := 0;
|
||||
|
@ -32,7 +32,7 @@ package body magic is
|
||||
|
||||
procedure view (index : in enumeration; x, y : in integer) is
|
||||
begin
|
||||
ui.draw_sprite (view_sprite (index), trait (index).text, x, y, 8);
|
||||
ui.draw_sprite (view_sprite (index), trait (index).text, x, y, 0);
|
||||
end view;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
@ -22,7 +22,10 @@ procedure main is
|
||||
text_box_height : integer := 0;
|
||||
|
||||
player : chad.data := (
|
||||
index => chad.ognjen,
|
||||
index => chad.ada,
|
||||
health => (30, 40),
|
||||
mana => (20, 30),
|
||||
stamina => (10, 20),
|
||||
attributes => (1, 2, 3, 4, 5, 6),
|
||||
skills => (1, 2, 3, 4, 5, 6, 7, 8, 9, others => 0),
|
||||
resources => (101, 103, 107, 109, 113, 127)
|
||||
@ -283,8 +286,31 @@ begin
|
||||
end if;
|
||||
--
|
||||
if view_list (status_preview_panel) then
|
||||
ui.draw_tiny_menu (preview_width, 0, side_panel, preview_height);
|
||||
chad.draw_data (player, preview_width + 32, 32);
|
||||
ui.draw_tiny_menu (preview_width, 0, side_panel, preview_height);
|
||||
chad.draw_data (player, preview_width + 32, 128);
|
||||
chad.view (chad.ada, preview_width + 32, 32);
|
||||
ui.draw_tiny_fill_bar (preview_width + 32 + 64, 32 + 32, 128, float (player.health.value) / float (player.health.limit));
|
||||
ui.draw_tiny_fill_bar (preview_width + 32 + 64, 32 + 64, 128, float (player.mana.value) / float (player.mana.limit));
|
||||
ui.draw_tiny_fill_bar (preview_width + 32 + 64, 32 + 96, 128, float (player.stamina.value) / float (player.stamina.limit));
|
||||
--
|
||||
ui.write (text => "Health " & player.health.value'image & " /" & player.health.limit'image,
|
||||
x => preview_width + 32 + 64 + 128 + 2,
|
||||
y => 32 + 8,
|
||||
tint => (255, 0, 0, 255),
|
||||
size => 15,
|
||||
code => true);
|
||||
ui.write (text => "Mana " & player.mana.value'image & " /" & player.mana.limit'image,
|
||||
x => preview_width + 32 + 64 + 128 + 2,
|
||||
y => 64 + 8,
|
||||
tint => (0, 0, 255, 255),
|
||||
size => 15,
|
||||
code => true);
|
||||
ui.write (text => "Stamina" & player.stamina.value'image & " /" & player.stamina.limit'image,
|
||||
x => preview_width + 32 + 64 + 128 + 2,
|
||||
y => 96 + 8,
|
||||
tint => (0, 255, 0, 255),
|
||||
size => 15,
|
||||
code => true);
|
||||
--~ui.draw_state_box (preview_width + 32, 32);
|
||||
end if;
|
||||
--
|
||||
@ -305,7 +331,7 @@ begin
|
||||
--
|
||||
signal_list (signal_mode).all;
|
||||
--
|
||||
--~magic.menu (0, 0, true);
|
||||
magic.menu (0, 0, true);
|
||||
--~might.menu (0, 0, true);
|
||||
--
|
||||
chad.draw_alice;
|
||||
|
@ -83,21 +83,15 @@ package body ui is
|
||||
y : in integer := 0;
|
||||
width : in integer := 0;
|
||||
height : in integer := 0) is
|
||||
save_zoom : natural := core.zoom;
|
||||
begin
|
||||
core.zoom := 1;
|
||||
core.draw (sprite (active, index), x, y, 0, 0, width, height);
|
||||
core.zoom := save_zoom;
|
||||
core.draw (sprite (active, index), x, y, 0, 0, width, height, factor => 1);
|
||||
end draw;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw_horizontally (index : in element; x, y, width : in integer; action : core.pointer := core.idle_skip'access) is
|
||||
save_zoom : natural := core.zoom;
|
||||
begin
|
||||
core.zoom := 1;
|
||||
core.draw_horizontally (sprite (active, index), x, y, width);
|
||||
core.zoom := save_zoom;
|
||||
core.draw_horizontally (sprite (active, index), x, y, width, factor => 1);
|
||||
--
|
||||
--~if core.cursor_mode = 1 and cursor_inside (x, y, width / core.zoom, sprite (active, index).height / core.zoom) then
|
||||
--~action.all;
|
||||
@ -108,11 +102,8 @@ package body ui is
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw_vertically (index : in element; x, y, height : in integer; action : core.pointer := core.idle_skip'access) is
|
||||
save_zoom : natural := core.zoom;
|
||||
begin
|
||||
core.zoom := 1;
|
||||
core.draw_vertically (sprite (active, index), x, y, height);
|
||||
core.zoom := save_zoom;
|
||||
core.draw_vertically (sprite (active, index), x, y, height, factor => 1);
|
||||
--
|
||||
--~if core.cursor_mode = 1 and cursor_inside (x, y, sprite (active, index).width / core.zoom, height / core.zoom) then
|
||||
--~action.all;
|
||||
|
@ -157,15 +157,15 @@ package body world is
|
||||
width : integer := core.base * core.zoom * (map.width + 2);
|
||||
height : integer := core.base * core.zoom * (map.height + 2);
|
||||
begin
|
||||
core.draw_horizontally (border_upper, x + core.base, y, width - 2 * core.base);
|
||||
core.draw_horizontally (border_lower, x + core.base, y + height - core.base, width - 2 * core.base);
|
||||
core.draw_vertically (border_left, x, y + core.base, height - 2 * core.base);
|
||||
core.draw_vertically (border_right, x + width - core.base, y + core.base, height - 2 * core.base);
|
||||
core.draw_horizontally (border_upper, x + core.base, y, width - 2 * core.base, core.zoom);
|
||||
core.draw_horizontally (border_lower, x + core.base, y + height - core.base, width - 2 * core.base, core.zoom);
|
||||
core.draw_vertically (border_left, x, y + core.base, height - 2 * core.base, core.zoom);
|
||||
core.draw_vertically (border_right, x + width - core.base, y + core.base, height - 2 * core.base, core.zoom);
|
||||
--
|
||||
core.draw (corner_upper_left, x, y);
|
||||
core.draw (corner_upper_right, x + width - core.base, y);
|
||||
core.draw (corner_lower_left, x, y + height - core.base);
|
||||
core.draw (corner_lower_right, x + width - core.base, y + height - core.base);
|
||||
core.draw (corner_upper_left, x, y, core.zoom);
|
||||
core.draw (corner_upper_right, x + width - core.base, y, core.zoom);
|
||||
core.draw (corner_lower_left, x, y + height - core.base, core.zoom);
|
||||
core.draw (corner_lower_right, x + width - core.base, y + height - core.base, core.zoom);
|
||||
end;
|
||||
--
|
||||
for vertical in 0 .. map.height - 1 loop
|
||||
|
BIN
sprite/chad/ada.png
Normal file
BIN
sprite/chad/ada.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
sprite/chad/gentle_flower.png
Normal file
BIN
sprite/chad/gentle_flower.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 991 B |
BIN
sprite/chad/horned_maiden.png
Normal file
BIN
sprite/chad/horned_maiden.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
sprite/chad/silent_autumn.png
Normal file
BIN
sprite/chad/silent_autumn.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
sprite/chad/view/ada.png
Normal file
BIN
sprite/chad/view/ada.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Loading…
Reference in New Issue
Block a user