Changed Construction and Equipment packages...
This commit is contained in:
parent
5d3a5c3041
commit
92c283f1ca
@ -40,7 +40,7 @@ package body chad is
|
||||
core.draw (sprite (player.index), x, y, state => player.state);
|
||||
--
|
||||
for index in equipment.slot loop
|
||||
equipment.draw (player.equipments (index), player.state, x, y);
|
||||
core.draw (equipment.sprite (player.equipments (index)), x, y, state => player.state);
|
||||
end loop;
|
||||
end draw;
|
||||
|
||||
|
@ -1,45 +0,0 @@
|
||||
-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic
|
||||
--
|
||||
-- GNU General Public Licence (version 3 or later)
|
||||
|
||||
with core, ui, effect, resource, faction;
|
||||
|
||||
package body construction is
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
procedure configure is
|
||||
begin
|
||||
core.echo (core.comment, "Configuring construction components...");
|
||||
--
|
||||
for index in enumeration loop
|
||||
declare folder : constant string := core.lowercase (faction.enumeration'image (description (index).kind));
|
||||
file : constant string := core.lowercase (enumeration'image (index));
|
||||
begin
|
||||
sprite (index) := core.import_sprite (core.folder & "/game/construction/" & folder & "/" & file & ".png", description (index).frames, 1);
|
||||
end;
|
||||
end loop;
|
||||
end configure;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw (index : in enumeration; x, y : in integer) is
|
||||
begin
|
||||
core.draw (sprite (index), x, y);
|
||||
end draw;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw_plus (index : in enumeration; x, y : in integer) is
|
||||
use type core.cursor_code;
|
||||
begin
|
||||
draw (index, x, y);
|
||||
--
|
||||
if core.cursor_inside (x, y, sprite (index).width, sprite (index).height) and core.cursor_mode = core.cursor_middle and not ui.prioritize then
|
||||
core.write_text_box (-(description (index).name));
|
||||
end if;
|
||||
end draw_plus;
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
end construction;
|
@ -39,13 +39,6 @@ package construction is
|
||||
|
||||
sprite : array (enumeration) of core.sprite;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure configure;
|
||||
|
||||
procedure draw (index : in enumeration; x, y : in integer);
|
||||
procedure draw_plus (index : in enumeration; x, y : in integer);
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
end construction;
|
||||
|
@ -1,59 +0,0 @@
|
||||
-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic
|
||||
--
|
||||
-- GNU General Public Licence (version 3 or later)
|
||||
|
||||
with core, ui;
|
||||
|
||||
package body equipment is
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function "=" (a, b : in enumeration) return boolean is begin return natural (enumeration'pos (a)) = natural (enumeration'pos (b)); end "=";
|
||||
function "/" (a, b : in enumeration) return boolean is begin return natural (enumeration'pos (a)) /= natural (enumeration'pos (b)); end "/";
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure configure is
|
||||
time : float := 0.0;
|
||||
begin
|
||||
time := core.time;
|
||||
--
|
||||
core.echo (core.comment, "Configuring" & count'image & " equipment components...");
|
||||
--
|
||||
for index in enumeration loop
|
||||
declare folder : constant string := core.lowercase (slot'image (description (index).kind));
|
||||
file : constant string := core.lowercase (enumeration'image (index));
|
||||
begin
|
||||
sprite (index) := core.import_sprite (core.folder & "/game/equipment/" & folder & "/" & file & ".png", 4, 6);
|
||||
icon (index) := core.import_sprite (core.folder & "/icon/equipment/" & folder & "/" & file & ".png", 1, 1);
|
||||
end;
|
||||
end loop;
|
||||
--
|
||||
core.echo (core.success, "Successfully configured equipment information in" & natural'image (natural (1_000_000.0 * (core.time - time))) & " microseconds.");
|
||||
end configure;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw (index : in enumeration; state : in core.animation; x, y : in integer) is
|
||||
begin
|
||||
core.draw (sprite (index), x, y, state => state);
|
||||
end draw;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw_plus (index : in enumeration; state : in core.animation; x, y : in integer) is
|
||||
use type core.cursor_code;
|
||||
begin
|
||||
draw (index, state, x, y);
|
||||
--
|
||||
if core.cursor_inside (x, y, sprite (index).width, sprite (index).height)
|
||||
and core.cursor_mode = core.cursor_middle
|
||||
and index / none
|
||||
and not ui.prioritize then
|
||||
core.write_text_box (-(description (index).name));
|
||||
end if;
|
||||
end draw_plus;
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
end equipment;
|
@ -200,16 +200,6 @@ package equipment is
|
||||
sprite : array (enumeration) of core.sprite;
|
||||
icon : array (enumeration) of core.sprite;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
function "=" (a, b : in enumeration) return boolean;
|
||||
function "/" (a, b : in enumeration) return boolean;
|
||||
|
||||
procedure configure;
|
||||
|
||||
procedure draw (index : in enumeration; state : in core.animation; x, y : in integer);
|
||||
procedure draw_plus (index : in enumeration; state : in core.animation; x, y : in integer);
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
end equipment;
|
||||
|
@ -223,10 +223,31 @@ begin
|
||||
material.icon (index) := core.import_sprite (core.folder & "/icon/material/" & core.lowercase (material.enumeration'image (index)) & ".png", 1, 1);
|
||||
end loop;
|
||||
|
||||
equipment.configure;
|
||||
core.echo (core.comment, "Configuring" & equipment.count'image & " equipment components...");
|
||||
--
|
||||
for index in equipment.enumeration loop
|
||||
declare folder : constant string := core.lowercase (equipment.slot'image (equipment.description (index).kind));
|
||||
file : constant string := core.lowercase (equipment.enumeration'image (index));
|
||||
begin
|
||||
equipment.sprite (index) := core.import_sprite (core.folder & "/game/equipment/" & folder & "/" & file & ".png", 4, 6);
|
||||
equipment.icon (index) := core.import_sprite (core.folder & "/icon/equipment/" & folder & "/" & file & ".png", 1, 1);
|
||||
end;
|
||||
end loop;
|
||||
|
||||
unit.configure;
|
||||
deity.configure;
|
||||
construction.configure;
|
||||
|
||||
core.echo (core.comment, "Configuring" & construction.count'image & "construction components...");
|
||||
--
|
||||
for index in construction.enumeration loop
|
||||
declare folder : constant string := core.lowercase (faction.enumeration'image (construction.description (index).kind));
|
||||
file : constant string := core.lowercase (construction.enumeration'image (index));
|
||||
frames : constant integer := construction.description (index).frames;
|
||||
begin
|
||||
construction.sprite (index) := core.import_sprite (core.folder & "/game/construction/" & folder & "/" & file & ".png", frames, 1);
|
||||
end;
|
||||
end loop;
|
||||
|
||||
chad.configure;
|
||||
world.configure;
|
||||
--~ai.configure;
|
||||
|
@ -33,7 +33,7 @@ package body unit is
|
||||
core.draw (base (description (index).kind), x, y, state => state);
|
||||
--
|
||||
for slot in equipment.slot loop
|
||||
equipment.draw (description (index).equipments (slot), state, x, y);
|
||||
core.draw (equipment.sprite (description (index).equipments (slot)), x, y, state => state);
|
||||
end loop;
|
||||
end draw;
|
||||
|
||||
|
@ -298,7 +298,11 @@ package body world is
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw_constructions (offset, view_from, view_to : in core.vector) is
|
||||
time : float := 0.0;
|
||||
time : float := 0.0;
|
||||
x : integer := 0;
|
||||
y : integer := 0;
|
||||
--
|
||||
this : construction.enumeration;
|
||||
begin
|
||||
time := core.time;
|
||||
--
|
||||
@ -306,9 +310,17 @@ package body world is
|
||||
if map.views (map.constructions (index).x, map.constructions (index).y)
|
||||
and map.constructions (index).x > view_from.x and map.constructions (index).x < view_from.x + view_to.x
|
||||
and map.constructions (index).y > view_from.y and map.constructions (index).y < view_from.y + view_to.y then
|
||||
construction.draw_plus (construction.enumeration'val (map.constructions (index).index),
|
||||
offset.x + (map.constructions (index).x - core.camera.x) * core.base * core.zoom,
|
||||
offset.y + (map.constructions (index).y - core.camera.y) * core.base * core.zoom);
|
||||
x := offset.x + (map.constructions (index).x - core.camera.x) * core.base * core.zoom;
|
||||
y := offset.y + (map.constructions (index).y - core.camera.y) * core.base * core.zoom;
|
||||
this := construction.enumeration'val (map.constructions (index).index);
|
||||
--
|
||||
core.draw (construction.sprite (this), x, y);
|
||||
--
|
||||
if core.cursor_inside (x, y, construction.sprite (this).width, construction.sprite (this).height)
|
||||
and core.cursor_mode = core.cursor_middle
|
||||
and not ui.prioritize then
|
||||
core.write_text_box (-(construction.description (this).name));
|
||||
end if;
|
||||
--
|
||||
core.increment (drawn_constructions);
|
||||
end if;
|
||||
@ -321,6 +333,10 @@ package body world is
|
||||
|
||||
procedure draw_equipments (offset, view_from, view_to : in core.vector) is
|
||||
time : float := 0.0;
|
||||
x : integer := 0;
|
||||
y : integer := 0;
|
||||
--
|
||||
this : equipment.enumeration;
|
||||
begin
|
||||
time := core.time;
|
||||
--
|
||||
@ -328,10 +344,18 @@ package body world is
|
||||
if map.views (map.equipments (index).x, map.equipments (index).y)
|
||||
and map.equipments (index).x > view_from.x and map.equipments (index).x < view_from.x + view_to.x
|
||||
and map.equipments (index).y > view_from.y and map.equipments (index).y < view_from.y + view_to.y then
|
||||
equipment.draw_plus (equipment.enumeration'val (map.equipments (index).index),
|
||||
core.idle,
|
||||
offset.x + (map.equipments (index).x - core.camera.x) * core.base * core.zoom,
|
||||
offset.y + (map.equipments (index).y - core.camera.y) * core.base * core.zoom);
|
||||
x := offset.x + (map.equipments (index).x - core.camera.x) * core.base * core.zoom;
|
||||
y := offset.y + (map.equipments (index).y - core.camera.y) * core.base * core.zoom;
|
||||
this := equipment.enumeration'val (map.equipments (index).index);
|
||||
--
|
||||
core.draw (equipment.sprite (this), x, y, state => core.idle);
|
||||
--
|
||||
if core.cursor_inside (x, y, equipment.sprite (this).width, equipment.sprite (this).height)
|
||||
and core.cursor_mode = core.cursor_middle
|
||||
and equipment.enumeration'pos (this) /= equipment.enumeration'pos (equipment.none)
|
||||
and not ui.prioritize then
|
||||
core.write_text_box (-(equipment.description (this).name));
|
||||
end if;
|
||||
--
|
||||
core.increment (drawn_equipments);
|
||||
end if;
|
||||
|
Loading…
Reference in New Issue
Block a user