Major revision, work in progress...

This commit is contained in:
Ognjen Milan Robovic 2024-05-31 07:14:00 -04:00
parent 39b7a9c0b9
commit 4d52aea6ac
20 changed files with 237 additions and 339 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 887 B

View File

@ -9,8 +9,22 @@ package body attribute is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure configure is
procedure enter (data : in out information; minimum, maximum : in integer; name, text : in string) is
begin
data.base := (minimum, maximum);
data.name := core.unbound (name);
data.text := core.unbound (text);
end enter;
--
structure : ui.structure;
begin
enter (trait (offense), 1, 12, "Offense", "Offense attribute determines your damage modifier when attacking.");
enter (trait (defense), 1, 12, "Defense", "D-FENS attribute determines how much damage your reflect and receive.");
enter (trait (wisdom), 1, 12, "Wisdom", "Wisdom attribute determines how much mana your chad has.");
enter (trait (stamina), 1, 12, "Stamina", "Stamina attribute determines how fast you recover from being wounded.");
enter (trait (speed), 1, 12, "Speed", "Speed attribute determines how far you can walk per turn.");
enter (trait (reach), 1, 12, "Reach", "Reach attribute determines your range modifier when shooting or casting.");
--
core.echo (core.comment, "Configuring attribute components...");
--
structure.title := "Attribute Menu ";
@ -27,21 +41,17 @@ package body attribute is
for index in enumeration loop
icon (index) := core.import_sprite (core.folder & "/icon/attribute/" & core.lowercase (enumeration'image (index)) & ".png", 1, 1);
--
ui.add_structure_button (icon => icon (index),
name => trait (index).name,
text => trait (index).text);
ui.add_structure_button (icon (index), trait (index).name, trait (index).text);
end loop;
end configure;
------------------------------------------------------------------------------------------
procedure draw_points (data : in points := (others => (0, 0));
x : in integer := 0;
y : in integer := 0) is
procedure draw_points (data : in points; x, y : in integer) is
move_x : integer := x;
begin
for index in enumeration loop
ui.draw_icon (icon (index), trait (index).text, move_x, y);
ui.draw_icon (icon (index), core.bound (trait (index).text), move_x, y);
ui.draw_text_box (move_x, y + core.icon, core.icon, core.icon);
ui.write (data (index).value'image, move_x + 4, y + core.icon + 8, (255, 255, 255, 255), 15, true);
--

View File

@ -15,9 +15,9 @@ package attribute is
------------------------------------------------------------------------------------------
type information is record
name : core.short_string;
base : core.point;
text : core.long_string;
name : core.unstring;
text : core.unstring;
end record;
type points is array (enumeration) of core.point;
@ -29,24 +29,14 @@ package attribute is
count : constant natural := enumeration'pos (enumeration'last) + 1;
trait : constant array (enumeration) of information := (
offense => ("Offense ", (1, 12), "Offense attribute determines your damage modifier when attacking. "),
defense => ("Defense ", (1, 12), "D-FENS attribute determines how much damage your reflect and receive. "),
wisdom => ("Wisdom ", (1, 12), "Wisdom attribute determines how much mana your chad has. "),
stamina => ("Stamina ", (1, 12), "Stamina attribute determines how fast you recover from being wounded. "),
speed => ("Speed ", (1, 12), "Speed attribute determines how far you can walk per turn. "),
reach => ("Reach ", (1, 12), "Reach attribute determines your range modifier when shooting or casting.")
);
icon : array (enumeration) of core.sprite;
trait : array (enumeration) of information;
icon : array (enumeration) of core.sprite;
------------------------------------------------------------------------------------------
procedure configure;
procedure draw_points (data : in points := (others => (0, 0));
x : in integer := 0;
y : in integer := 0);
procedure draw_points (data : in points; x, y : in integer);
procedure save_points (here : in core.io.file_type; data : in points);
procedure load_points (here : in core.io.file_type; data : out points);

View File

@ -70,6 +70,11 @@ package core is
package io is new ada.sequential_io (integer);
subtype unstring is ada.strings.unbounded.unbounded_string;
--
function bound (data : in unstring) return string renames ada.strings.unbounded.to_string;
function unbound (data : in string) return unstring renames ada.strings.unbounded.to_unbounded_string;
------------------------------------------------------------------------------------------
folder : constant string := ".";

View File

@ -2,7 +2,7 @@
--
-- GNU General Public Licence (version 3 or later)
with core, notification, attribute, skill, resource, deity, material, magic, equipment, unit, construction, chad, world;
with core, ui, attribute, skill, resource, material, chad, world;
use type core.point;
@ -11,44 +11,35 @@ package body effect is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure apply (data : in value) is
begin
case data.operation is
when idle => null;
when offense => core.increment (world.map.chads (1).attributes (attribute.offense).value, data.modifier);
when defense => core.increment (world.map.chads (1).attributes (attribute.defense).value, data.modifier);
when wisdom => core.increment (world.map.chads (1).attributes (attribute.wisdom).value, data.modifier);
when stamina => core.increment (world.map.chads (1).attributes (attribute.stamina).value, data.modifier);
when speed => core.increment (world.map.chads (1).attributes (attribute.speed).value, data.modifier);
when reach => core.increment (world.map.chads (1).attributes (attribute.reach).value, data.modifier);
when alchemy => core.increment (world.map.chads (1).skills (skill.alchemy).value, data.modifier);
when archery => core.increment (world.map.chads (1).skills (skill.archery).value, data.modifier);
when architecture => core.increment (world.map.chads (1).skills (skill.architecture).value, data.modifier);
when athletics => core.increment (world.map.chads (1).skills (skill.athletics).value, data.modifier);
when diplomacy => core.increment (world.map.chads (1).skills (skill.diplomacy).value, data.modifier);
when estates => core.increment (world.map.chads (1).skills (skill.estates).value, data.modifier);
when exploration => core.increment (world.map.chads (1).skills (skill.exploration).value, data.modifier);
when leadership => core.increment (world.map.chads (1).skills (skill.leadership).value, data.modifier);
when logistics => core.increment (world.map.chads (1).skills (skill.logistics).value, data.modifier);
when medicine => core.increment (world.map.chads (1).skills (skill.medicine).value, data.modifier);
when mercantile => core.increment (world.map.chads (1).skills (skill.mercantile).value, data.modifier);
when mysticism => core.increment (world.map.chads (1).skills (skill.mysticism).value, data.modifier);
when necromancy => core.increment (world.map.chads (1).skills (skill.necromancy).value, data.modifier);
when resistance => core.increment (world.map.chads (1).skills (skill.resistance).value, data.modifier);
when skirmish => core.increment (world.map.chads (1).skills (skill.skirmish).value, data.modifier);
when sorcery => core.increment (world.map.chads (1).skills (skill.sorcery).value, data.modifier);
when tactics => core.increment (world.map.chads (1).skills (skill.tactics).value, data.modifier);
when thaumaturgy => core.increment (world.map.chads (1).skills (skill.thaumaturgy).value, data.modifier);
when gold => core.increment (world.map.chads (1).resources (resource.gold).value, data.modifier);
when wood => core.increment (world.map.chads (1).resources (resource.wood).value, data.modifier);
when stone => core.increment (world.map.chads (1).resources (resource.stone).value, data.modifier);
when metal => core.increment (world.map.chads (1).resources (resource.metal).value, data.modifier);
when leather => core.increment (world.map.chads (1).resources (resource.leather).value, data.modifier);
when gem => core.increment (world.map.chads (1).resources (resource.gem).value, data.modifier);
--
when take_material => core.increment (world.map.chads (1).materials (material.enumeration'val (data.modifier)).value, data.amount);
end case;
player : chad.value renames world.map.chads (1);
--
notification.show (data.notify);
attribute_index : attribute.enumeration;
skill_index : skill.enumeration;
resource_index : resource.enumeration;
material_index : material.enumeration;
begin
case data.kind is
when idle => null;
--
when modify_attribute => attribute_index := attribute.enumeration'val (data.modifier);
player.attributes (attribute_index) := player.attributes (attribute_index) + data.amount;
ui.echo ("Player " & (if data.amount < 0 then "lost" else "gained") & integer'image (abs data.amount) & " "
& core.bound (attribute.trait (attribute_index).name) & " attribute points.");
--
when modify_skill => skill_index := skill.enumeration'val (data.modifier);
player.skills (skill_index) := player.skills (skill_index) + data.amount;
ui.echo ("Player " & (if data.amount < 0 then "lost" else "gained") & integer'image (abs data.amount) & " "
& core.bound (skill.trait (skill_index).name) & " skill points.");
--
when modify_resource => resource_index := resource.enumeration'val (data.modifier);
player.resources (resource_index) := player.resources (resource_index) + data.amount;
ui.echo ("Player " & (if data.amount < 0 then "lost" else "gained") & integer'image (abs data.amount) & " "
& core.bound (resource.trait (resource_index).name) & " resource points.");
--
when modify_material => material_index := material.enumeration'val (data.modifier);
player.materials (material_index) := player.materials (material_index) + data.amount;
ui.echo ("+" & data.amount'image & " " & core.bound (material.trait (material_index).name));
end case;
end apply;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -2,34 +2,29 @@
--
-- GNU General Public Licence (version 3 or later)
with notification;
package effect is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
type operation_index is (
type enumeration is (
idle,
offense, defense, wisdom, stamina, speed, reach,
alchemy, archery, architecture, athletics, diplomacy, estates,
exploration, leadership, logistics, medicine, mercantile, mysticism,
necromancy, resistance, skirmish, sorcery, tactics, thaumaturgy,
gold, wood, stone, metal, leather, gem,
take_material
modify_attribute,
modify_skill,
modify_resource,
modify_material
);
------------------------------------------------------------------------------------------
type value is record
operation : operation_index;
kind : enumeration;
modifier : integer;
amount : natural;
amount : integer;
permanent : boolean;
duration : natural;
notify : notification.enumeration;
end record;
none : constant value := (idle, 0, 0, false, 0, notification.none);
none : constant value := (idle, 0, 0, false, 0);
------------------------------------------------------------------------------------------

View File

@ -4,7 +4,7 @@
pragma ada_2012;
with core, ui, notification, effect, attribute, skill, resource, faction, deity, material, magic, equipment, unit, construction, chad, world;
with core, ui, effect, attribute, skill, resource, faction, deity, material, magic, equipment, unit, construction, chad, world;
with ada.strings.unbounded;
use ada.strings.unbounded;
@ -180,7 +180,7 @@ begin
core.echo (core.comment, "Copyright (C) 2024 -- Ognjen 'xolatile' Milan Robovic");
core.echo (core.comment, "Version -- 1.0.0");
core.echo (core.comment, "License -- GNU/GPLv3+");
core.echo (core.comment, "Xhads is free software, you can redistribute it and modify it under the terms of the GNU General Public License by Free Software Foundation.");
core.echo (core.comment, "Xorana is free software, you can redistribute it and modify it under the terms of the GNU General Public License by Free Software Foundation.");
core.dash;
core.initialize;
@ -293,11 +293,18 @@ begin
if view_list (status_preview_panel) then
ui.draw_tiny_menu (preview_width, 0, side_panel, preview_height);
chad.draw_data (world.map.chads (1), preview_width + 32, 32);
--
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,
width => side_panel - 2 * core.icon,
height => 106);
--~ui.draw_state_box (preview_width + 32, 32);
end if;
--
if view_list (text_box_panel) then
ui.draw_help_box (0, core.window_height - text_box_height, core.window_width - core.icon * (view'pos (view'last) + 1), text_box_height);
--
ui.write (core.framerate'image, core.window_width - 5 * core.icon + 3, core.window_height - 27);
end if;
--
for index in view loop
@ -312,35 +319,26 @@ begin
--
signal_list (core.signal_mode).all;
--
--~magic.menu (0, 0, true);
--~might.menu (0, 0, true);
--~ui.write ("draw_tiles_timer :" & world.draw_tiles_timer'image, 1440, 700 - 40, size => 15, code => true);
--~ui.write ("draw_views_timer :" & world.draw_views_timer'image, 1440, 720 - 40, size => 15, code => true);
--~ui.write ("draw_landmarks_timer :" & world.draw_landmarks_timer'image, 1440, 740 - 40, size => 15, code => true);
--~ui.write ("draw_locations_timer :" & world.draw_locations_timer'image, 1440, 760 - 40, size => 15, code => true);
--~ui.write ("draw_constructions_timer :" & world.draw_constructions_timer'image, 1440, 780 - 40, size => 15, code => true);
--~ui.write ("draw_equipments_timer :" & world.draw_equipments_timer'image, 1440, 800 - 40, size => 15, code => true);
--~ui.write ("draw_units_timer :" & world.draw_units_timer'image, 1440, 820 - 40, size => 15, code => true);
--~ui.write ("draw_world_timer :" & world.draw_world_timer'image, 1440, 840 - 40, size => 15, code => true);
--
--~deity.draw (deity.AEZORA, 300, 300);
--~deity.draw (deity.ULDRAE, 500, 300);
--
ui.write (core.framerate'image, core.window_width - 5 * core.icon + 3, core.window_height - 27);
--
ui.write ("draw_tiles_timer :" & world.draw_tiles_timer'image, 1440, 700 - 40, size => 15, code => true);
ui.write ("draw_views_timer :" & world.draw_views_timer'image, 1440, 720 - 40, size => 15, code => true);
ui.write ("draw_landmarks_timer :" & world.draw_landmarks_timer'image, 1440, 740 - 40, size => 15, code => true);
ui.write ("draw_locations_timer :" & world.draw_locations_timer'image, 1440, 760 - 40, size => 15, code => true);
ui.write ("draw_constructions_timer :" & world.draw_constructions_timer'image, 1440, 780 - 40, size => 15, code => true);
ui.write ("draw_equipments_timer :" & world.draw_equipments_timer'image, 1440, 800 - 40, size => 15, code => true);
ui.write ("draw_units_timer :" & world.draw_units_timer'image, 1440, 820 - 40, size => 15, code => true);
ui.write ("draw_world_timer :" & world.draw_world_timer'image, 1440, 840 - 40, size => 15, code => true);
--
ui.write (world.drawn_tiles'image, 1380, 700 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
ui.write (world.drawn_views'image, 1380, 720 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
ui.write (world.drawn_landmarks'image, 1380, 740 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
ui.write (world.drawn_locations'image, 1380, 760 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
ui.write (world.drawn_constructions'image, 1380, 780 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
ui.write (world.drawn_equipments'image, 1380, 800 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
ui.write (world.drawn_units'image, 1380, 820 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
--~ui.write (world.drawn_tiles'image, 1380, 700 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
--~ui.write (world.drawn_views'image, 1380, 720 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
--~ui.write (world.drawn_landmarks'image, 1380, 740 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
--~ui.write (world.drawn_locations'image, 1380, 760 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
--~ui.write (world.drawn_constructions'image, 1380, 780 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
--~ui.write (world.drawn_equipments'image, 1380, 800 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
--~ui.write (world.drawn_units'image, 1380, 820 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
--
core.camera.x := world.map.chads (1).x;
core.camera.y := world.map.chads (1).y;
--
notification.synchronize;
ui.synchronize;
end loop gameplay_loop;

View File

@ -26,7 +26,7 @@ package body material is
begin
for index in enumeration loop
if data (index).value > 0 then
ui.draw_icon (icon (index), trait (index).name, move_x, y);
ui.draw_icon (icon (index), core.bound (trait (index).name), move_x, y);
ui.draw_text_box (move_x, y + core.icon, core.icon, core.icon);
ui.write (data (index).value'image, move_x + 4, y + core.icon + 8, (255, 255, 255, 255), 15, true);
--

View File

@ -19,7 +19,7 @@ package material is
------------------------------------------------------------------------------------------
type information is record
name : core.short_string;
name : core.unstring;
cost : natural;
end record;
@ -30,34 +30,34 @@ package material is
count : constant natural := enumeration'pos (enumeration'last) + 1;
trait : constant array (enumeration) of information := (
sulphur => ("Sulphur ", 7),
mercury => ("Mercury ", 13),
mint => ("Mint ", 3),
cinnamon => ("Cinnamon ", 5),
apple => ("Apple ", 2),
peach => ("Peach ", 2),
pear => ("Pear ", 2),
banana => ("Banana ", 3),
orange => ("Orange ", 3),
plum => ("Plum ", 3),
cherry => ("Cherry ", 3),
lemon => ("Lemon ", 2),
potato => ("Potato ", 1),
wheat => ("Wheat ", 1),
carrot => ("Carrot ", 2),
cucumber => ("Cucumber ", 3),
onion => ("Onion ", 2),
garlic => ("Garlic ", 2),
eggplant => ("Eggplant ", 3),
tomato => ("Tomato ", 2),
meat => ("Meat ", 3),
fish_meat => ("Fish Meat ", 2),
skull => ("Skull ", 1),
animal_skull => ("Animal Skull ", 1),
bone => ("Bone ", 1),
rib_cage => ("Rib Cage ", 1),
animal_skin => ("Animal Skin ", 5),
animal_fur => ("Animal Fur ", 7)
sulphur => (core.unbound ("Sulphur"), 7),
mercury => (core.unbound ("Mercury"), 13),
mint => (core.unbound ("Mint"), 3),
cinnamon => (core.unbound ("Cinnamon"), 5),
apple => (core.unbound ("Apple"), 2),
peach => (core.unbound ("Peach"), 2),
pear => (core.unbound ("Pear"), 2),
banana => (core.unbound ("Banana"), 3),
orange => (core.unbound ("Orange"), 3),
plum => (core.unbound ("Plum"), 3),
cherry => (core.unbound ("Cherry"), 3),
lemon => (core.unbound ("Lemon"), 2),
potato => (core.unbound ("Potato"), 1),
wheat => (core.unbound ("Wheat"), 1),
carrot => (core.unbound ("Carrot"), 2),
cucumber => (core.unbound ("Cucumber"), 3),
onion => (core.unbound ("Onion"), 2),
garlic => (core.unbound ("Garlic"), 2),
eggplant => (core.unbound ("Eggplant"), 3),
tomato => (core.unbound ("Tomato"), 2),
meat => (core.unbound ("Meat"), 3),
fish_meat => (core.unbound ("Fish Meat"), 2),
skull => (core.unbound ("Skull"), 1),
animal_skull => (core.unbound ("Animal Skull"), 1),
bone => (core.unbound ("Bone"), 1),
rib_cage => (core.unbound ("Rib Cage"), 1),
animal_skin => (core.unbound ("Animal Skin"), 5),
animal_fur => (core.unbound ("Animal Fur"), 7)
);
default : points := (others => (1, 12));

View File

@ -1,69 +0,0 @@
-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic
--
-- GNU General Public Licence (version 3 or later)
with core, ui;
package body notification is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
type information is record
name : core.short_string;
text : core.long_string;
end record;
------------------------------------------------------------------------------------------
shown : array (enumeration) of boolean := (others => false);
trait : constant array (enumeration) of information := (
none => ("-- ", "-- "),
well_of_strength => ("Gold ", "#1Gold#0 is precious yellowish shiny metal, valued since ancient times. "),
well_of_agility => ("Wood ", "#1Wood#0 is just bundle of lignin and cellulose, nothing more. "),
well_of_knowledge => ("Leather ", "#1Leather#0 is general purpose resource, used for decorations. ")
);
------------------------------------------------------------------------------------------
procedure draw (index : in enumeration; x, y : in integer; center : in boolean := false) is
use type core.signal_code;
begin
ui.draw_tiny_menu (x, y, 960, 128);
--
ui.write (trait (index).name, x + 32, y + 32);
ui.write (trait (index).text, x + 32, y + 64);
--
if core.signal_mode = core.signal_space then
shown (index) := false;
end if;
end draw;
------------------------------------------------------------------------------------------
procedure show (index : in enumeration) is begin if index = none then return; end if; shown (index) := true; end show;
procedure hide (index : in enumeration) is begin if index = none then return; end if; shown (index) := false; end hide;
------------------------------------------------------------------------------------------
procedure iconflow (icon : in core.sprite; data, x, y : in integer) is
begin
core.draw (icon, x, y, factor => 1);
--
ui.write (data'image, x + core.icon, y, (if data < 0 then (255, 0, 0, 255) else (0, 0, 255, 255)), 15, true);
end iconflow;
------------------------------------------------------------------------------------------
procedure synchronize is
begin
for index in enumeration loop
if shown (index) then
draw (index, core.center_x (960), core.center_y (128));
end if;
end loop;
end synchronize;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end notification;

View File

@ -1,29 +0,0 @@
-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic
--
-- GNU General Public Licence (version 3 or later)
with core;
package notification is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
type enumeration is (
none,
well_of_strength,
well_of_agility,
well_of_knowledge
);
------------------------------------------------------------------------------------------
procedure show (index : in enumeration);
procedure hide (index : in enumeration);
procedure iconflow (icon : in core.sprite; data, x, y : in integer);
procedure synchronize;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end notification;

View File

@ -9,8 +9,22 @@ package body resource is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure configure is
procedure enter (data : in out information; minimum, maximum : in integer; name, text : in string) is
begin
data.base := (minimum, maximum);
data.name := core.unbound (name);
data.text := core.unbound (text);
end enter;
--
structure : ui.structure;
begin
enter (trait (gold), 24, 480, "Gold", "Gold is precious yellowish shiny metal, valued since ancient times.");
enter (trait (wood), 12, 240, "Wood", "Wood is just bundle of lignin and cellulose, nothing more.");
enter (trait (stone), 12, 240, "Stone", "Stone is essential building block for most constructions in this world.");
enter (trait (metal), 12, 240, "Metal", "Metal as a resource is mixture of commonly found metalic elements.");
enter (trait (leather), 12, 240, "Leather", "Leather is general purpose resource, used for armours and decorations.");
enter (trait (gem), 12, 240, "Gem", "Gem as a resource is same as metal, just mixture of various gems.");
--
core.echo (core.comment, "Configuring resource components...");
--
structure.title := "Resource Menu ";
@ -37,8 +51,8 @@ package body resource is
frame_width : constant integer := 4 * core.icon;
begin
for index in enumeration loop
ui.draw_icon (icon (index), trait (index).text, x + (core.icon + frame_width) * enumeration'pos (index), y);
ui.draw_frame (trait (index).text, x + (core.icon + frame_width) * enumeration'pos (index) + core.icon, y, frame_width, core.icon);
ui.draw_icon (icon (index), core.bound (trait (index).text), x + (core.icon + frame_width) * enumeration'pos (index), y);
ui.draw_frame (core.bound (trait (index).text), x + (core.icon + frame_width) * enumeration'pos (index) + core.icon, y, frame_width, core.icon);
--
ui.write (text => data (index).value'image & " /" & data (index).limit'image,
x => x + (core.icon + frame_width) * enumeration'pos (index) + core.icon - 1,

View File

@ -15,9 +15,9 @@ package resource is
------------------------------------------------------------------------------------------
type information is record
name : core.short_string;
base : core.point;
text : core.long_string;
name : core.unstring;
text : core.unstring;
end record;
type points is array (enumeration) of core.point;
@ -27,16 +27,8 @@ package resource is
count : constant natural := enumeration'pos (enumeration'last) + 1;
trait : constant array (enumeration) of information := (
gold => ("Gold ", (24, 480), "Gold is precious yellowish shiny metal, valued since ancient times. "),
wood => ("Wood ", (12, 240), "Wood is just bundle of lignin and cellulose, nothing more. "),
stone => ("Stone ", (12, 240), "Stone is essential building block for most constructions in this world. "),
metal => ("Metal ", (12, 240), "Metal as a resource is mixture of commonly found metalic elements. "),
leather => ("Leather ", (12, 240), "Leather is general purpose resource, used for armours and decorations. "),
gem => ("Gem ", (12, 240), "Gem as a resource is same as metal, just mixture of various gems. ")
);
icon : array (enumeration) of core.sprite;
trait : array (enumeration) of information;
icon : array (enumeration) of core.sprite;
------------------------------------------------------------------------------------------

View File

@ -9,8 +9,34 @@ package body skill is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure configure is
procedure enter (data : in out information; minimum, maximum : in integer; name, text : in string) is
begin
data.base := (minimum, maximum);
data.name := core.unbound (name);
data.text := core.unbound (text);
end enter;
--
structure : ui.structure;
begin
enter (trait (alchemy), 0, 24, "Alchemy", "Alchemy skill determines effectiveness of your vials and potions.");
enter (trait (archery), 0, 24, "Archery", "Archery skill determines effectiveness and range or your archers.");
enter (trait (architecture), 0, 24, "Architecture", "Architecture decreases time spent on building constructions.");
enter (trait (athletics), 0, 24, "Athletics", "Athletics increases movement speed of all your units, since they train.");
enter (trait (diplomacy), 0, 24, "Diplomacy", "Diplomacy helps you to avoid starting a battle you can't win.");
enter (trait (estates), 0, 24, "Estates", "Estates makes you the ultimate crypto-bro, establishing a blockchain.");
enter (trait (exploration), 0, 24, "Exploration", "Exploration is quite self-explanatory.");
enter (trait (leadership), 0, 24, "Leadership", "Leadership is the default skill for any true chad, like God intended.");
enter (trait (logistics), 0, 24, "Logistics", "Logistics is a nightmare in real life, but this is only a game.");
enter (trait (medicine), 0, 24, "Medicine", "Medicine skill makes you swallow pills like a kid in a drugstore.");
enter (trait (mercantile), 0, 24, "Mercantile", "Mercantile is the skill of any true-born nosy person, otherwise useless.");
enter (trait (mysticism), 0, 24, "Mysticism", "Mysticism allows you to have 60 cats, drink wine and talk weird.");
enter (trait (necromancy), 0, 24, "Necromancy", "Necromancy lets you not to waste the bones after every battle.");
enter (trait (resistance), 0, 24, "Resistence", "Resistence skill increases defense points of all your units slightly.");
enter (trait (skirmish), 0, 24, "Skirmish", "Skirmish makes your units go berserk when they have little health left.");
enter (trait (sorcery), 0, 24, "Sorcery", "Sorcery skill is appropriately named useless skill to have in real life.");
enter (trait (tactics), 0, 24, "Tactics", "Tactics is the opposite of skirmish, master it and lose in every battle.");
enter (trait (thaumaturgy), 0, 24, "Thaumaturgy", "Thaumaturgy lets you do nothing, and hope that the best will happen.");
--
core.echo (core.comment, "Configuring skill components...");
--
structure.title := "Skill Menu ";
@ -49,11 +75,11 @@ package body skill is
move_y := y;
end if;
--
ui.draw_icon (icon (index), trait (index).text, move_x, move_y);
ui.draw_icon (icon (index), core.bound (trait (index).text), move_x, move_y);
ui.draw_text_box (move_x + core.icon, move_y, core.icon, core.icon);
ui.write (data (index).value'image, move_x + core.icon + 4, move_y + 8, (255, 255, 255, 255), 15, true);
--
ui.write (trait (index).name, move_x + 2 * core.icon + 4, move_y + 8, (255, 255, 255, 255), 15, true);
ui.write (core.bound (trait (index).name), move_x + 2 * core.icon + 4, move_y + 8, (255, 255, 255, 255), 15, true);
--
move_y := move_y + core.icon;
end loop;

View File

@ -17,9 +17,9 @@ package skill is
------------------------------------------------------------------------------------------
type information is record
name : core.short_string;
base : core.point;
text : core.long_string;
name : core.unstring;
text : core.unstring;
end record;
type points is array (enumeration) of core.point;
@ -31,28 +31,8 @@ package skill is
count : constant natural := enumeration'pos (enumeration'last) + 1;
trait : constant array (enumeration) of information := (
alchemy => ("Alchemy ", (0, 24), "Alchemy skill determines effectiveness of your vials and potions. "),
archery => ("Archery ", (0, 24), "Archery skill determines effectiveness and range or your archers. "),
architecture => ("Architecture ", (0, 24), "Architecture decreases time spent on building constructions. "),
athletics => ("Athletics ", (0, 24), "Athletics increases movement speed of all your units, since they train. "),
diplomacy => ("Diplomacy ", (0, 24), "Diplomacy helps you to avoid starting a battle you can't win. "),
estates => ("Estates ", (0, 24), "Estates makes you the ultimate crypto-bro, establishing a blockchain. "),
exploration => ("Exploration ", (0, 24), "Exploration is quite self-explanatory... "),
leadership => ("Leadership ", (0, 24), "Leadership is the default skill for any true chad, like God intended. "),
logistics => ("Logistics ", (0, 24), "Logistics is a nightmare in real life, but this is only a game. "),
medicine => ("Medicine ", (0, 24), "Medicine skill makes you swallow pills like a kid in a drugstore. "),
mercantile => ("Mercantile ", (0, 24), "Mercantile is the skill of any true-born nosy person, otherwise useless."),
mysticism => ("Mysticism ", (0, 24), "Mysticism allows you to have 60 cats, drink wine and talk weird. "),
necromancy => ("Necromancy ", (0, 24), "Necromancy lets you not to waste the bones after every battle. "),
resistance => ("Resistence ", (0, 24), "Resistence skill increases defense points of all your units slightly. "),
skirmish => ("Skirmish ", (0, 24), "Skirmish makes your units go berserk when they have little health left. "),
sorcery => ("Sorcery ", (0, 24), "Sorcery skill is appropriately named useless skill to have in real life."),
tactics => ("Tactics ", (0, 24), "Tactics is the opposite of skirmish, master it and lose in every battle."),
thaumaturgy => ("Thaumaturgy ", (0, 24), "Thaumaturgy lets you do nothing, and hope that the best will happen. ")
);
icon : array (enumeration) of core.sprite;
trait : array (enumeration) of information;
icon : array (enumeration) of core.sprite;
------------------------------------------------------------------------------------------

View File

@ -78,6 +78,11 @@ package body ui is
monospace : core.font;
console_message_limit : constant natural := 6;
console_message_count : natural := 0;
--
console_message_array : array (0 .. console_message_limit - 1) of ada.strings.unbounded.unbounded_string;
------------------------------------------------------------------------------------------
procedure draw (index : in element := none;
@ -94,11 +99,6 @@ package body ui is
procedure draw_horizontally (index : in element; x, y, width : in integer; action : core.pointer := core.idle_skip'access; tint : in core.colour := (others => 255)) is
begin
core.draw_horizontally (sprite (active, index), x, y, width, 1, tint);
--
--~if core.cursor_mode = 1 and cursor_inside (x, y, width / core.zoom, sprite (active, index).height / core.zoom) then
--~action.all;
--~core.cursor_mode := 0;
--~end if;
end draw_horizontally;
------------------------------------------------------------------------------------------
@ -106,11 +106,6 @@ package body ui is
procedure draw_vertically (index : in element; x, y, height : in integer; action : core.pointer := core.idle_skip'access; tint : in core.colour := (others => 255)) is
begin
core.draw_vertically (sprite (active, index), x, y, height, 1, tint);
--
--~if core.cursor_mode = 1 and cursor_inside (x, y, sprite (active, index).width / core.zoom, height / core.zoom) then
--~action.all;
--~core.cursor_mode := 0;
--~end if;
end draw_vertically;
------------------------------------------------------------------------------------------
@ -195,8 +190,8 @@ package body ui is
for x in 0 .. data.gui_n - 1 loop
case data.gui_list (x).kind is
when gui_button =>
draw_button (text => data.gui_list (x).text,
description => data.gui_list (x).info,
draw_button (text => core.bound (data.gui_list (x).text),
description => core.bound (data.gui_list (x).info),
icon => data.gui_list (x).image,
x => button_data.x,
y => button_data.y,
@ -267,9 +262,18 @@ package body ui is
------------------------------------------------------------------------------------------
procedure write (text : in string; x, y : in integer; tint : in core.colour := (others => 255); size : in natural := 0; code : in boolean := false) is
procedure echo (message : in string) is
begin
core.write (text, x, y, tint, (if size = 0 then font (active).scale else size), (if code then monospace else font (active)));
console_message_array (console_message_count) := ada.strings.unbounded.to_unbounded_string (message);
--
console_message_count := (console_message_count + 1) mod console_message_limit;
end echo;
------------------------------------------------------------------------------------------
procedure write (text : in string; x, y : in integer; tint : in core.colour := (others => 255); size : in natural := 15; code : in boolean := false) is
begin
core.write (text, x, y, tint, (if code then 15 else font (active).scale), (if code then monospace else font (active)));
end write;
------------------------------------------------------------------------------------------
@ -596,6 +600,26 @@ package body ui is
------------------------------------------------------------------------------------------
procedure draw_console_box (x, y, width, height : in integer) is
offset : constant integer := 8;
font_width : constant integer := 9;
font_height : constant integer := 15;
characters_per_width : constant integer := width / font_width;
characters_per_height : constant integer := height / font_height;
begin
draw_text_box (x, y, width, height);
--
for index in 0 .. console_message_limit - 1 loop
ui.write (text => ada.strings.unbounded.to_string (console_message_array ((index + console_message_count) mod console_message_limit)),
x => x + offset,
y => y + offset + index * font_height,
size => 15,
code => true);
end loop;
end draw_console_box;
------------------------------------------------------------------------------------------
procedure add_structure (data : in structure) is
begin
structure_array (structure_count) := data;
@ -607,7 +631,7 @@ package body ui is
------------------------------------------------------------------------------------------
procedure add_structure_button (icon : in core.sprite; name : in core.short_string; text : in core.long_string := "") is
procedure add_structure_button (icon : in core.sprite; name : in core.unstring; text : in core.unstring) is
index : natural renames structure_array (structure_count - 1).gui_n;
begin
structure_array (structure_count - 1).gui_list (index).kind := gui_button;
@ -615,11 +639,6 @@ package body ui is
structure_array (structure_count - 1).gui_list (index).info := text;
structure_array (structure_count - 1).gui_list (index).number := 0;
structure_array (structure_count - 1).gui_list (index).image := icon;
--~structure_array (structure_count - 1).gui_list (structure_array (structure_count - 1).gui_n).kind := gui_button;
--~structure_array (structure_count - 1).gui_list (structure_array (structure_count - 1).gui_n).text := name;
--~structure_array (structure_count - 1).gui_list (structure_array (structure_count - 1).gui_n).info := text;
--~structure_array (structure_count - 1).gui_list (structure_array (structure_count - 1).gui_n).number := 0;
--~structure_array (structure_count - 1).gui_list (structure_array (structure_count - 1).gui_n).image := icon;
--
core.increment (index);
end add_structure_button;

View File

@ -21,11 +21,11 @@ package ui is
------------------------------------------------------------------------------------------
type gui_data is record
kind : enumeration := gui_none;
text : core.short_string := "-- ";
info : core.long_string := "-- ";
number : integer := 0;
image : core.sprite := (others => 0);
kind : enumeration := gui_none;
text : core.unstring := core.unbound ("--");
info : core.unstring := core.unbound ("--");
number : integer := 0;
image : core.sprite := (others => 0);
end record;
empty : gui_data;
@ -58,7 +58,9 @@ package ui is
procedure configure;
procedure synchronize;
procedure write (text : in string; x, y : in integer; tint : in core.colour := (others => 255); size : in natural := 0; code : in boolean := false);
procedure echo (message : in string);
procedure write (text : in string; x, y : in integer; tint : in core.colour := (others => 255); size : in natural := 15; code : in boolean := false);
procedure draw_icon (data : in core.sprite; text : in string; x, y : in integer; action : core.pointer := core.idle_skip'access);
procedure draw_overicon (data : in core.sprite; text : in string; x, y : in integer; action : core.pointer := core.idle_skip'access);
@ -82,11 +84,12 @@ package ui is
procedure draw_tiny_menu (x, y, width, height : in integer);
procedure draw_icon_menu (x, y, width, height : in integer);
procedure draw_state_box (x, y : in integer);
procedure draw_state_box (x, y : in integer);
procedure draw_console_box (x, y, width, height : in integer);
procedure add_structure (data : in structure);
procedure add_structure_button (icon : in core.sprite; name : in core.short_string; text : in core.long_string := "");
procedure add_structure_button (icon : in core.sprite; name : in core.unstring; text : in core.unstring);
procedure add_structure_orient;
procedure write_ada_code (text : in core.string_box_data; x, y : in integer);

View File

@ -162,9 +162,8 @@ package body world is
------------------------------------------------------------------------------------------
procedure draw_locations (offset, view_from, view_to : in core.vector) is
time : float := 0.0;
sprite : core.sprite;
number : integer;
time : float := 0.0;
sprite : core.sprite;
begin
time := core.time;
--
@ -189,29 +188,7 @@ package body world is
end if;
end if;
--
if map.locations (index).state = 1 and core.animation_time = 0 then
number := effect.operation_index'pos (location_trait (location_index'val (map.locations (index).index)).evoke.operation);
--
case location_trait (location_index'val (map.locations (index).index)).evoke.operation is
when effect.offense .. effect.reach => sprite := attribute.icon (attribute.enumeration'val (number - 1));
when effect.archery .. effect.thaumaturgy => sprite := skill.icon (skill.enumeration'val (number - 7));
when effect.gold .. effect.gem => sprite := resource.icon (resource.enumeration'val (number - 25));
--
when effect.take_material => sprite := material.icon (material.enumeration'val (
location_trait (location_index'val (map.locations (index).index)).evoke.modifier
));
--
when others => null;
end case;
--
number := location_trait (location_index'val (map.locations (index).index)).evoke.amount;
--
notification.iconflow (icon => sprite,
data => number,
--~x => core.camera.x * core.base,
--~y => (core.camera.y + 1) * core.base + (core.global_time + core.gameplay_framerate) mod core.gameplay_framerate);
x => 900, y => 450);
--
if map.locations (index).state = 1 and core.animation_time = 0 then
map.locations (index).state := 2;
end if;
--
@ -359,10 +336,6 @@ package body world is
if map.tiles (x, y) in 18 .. 23 and map.tiles (x, y + 1) not in 18 .. 23 then map.tiles (x, y + 1) := 25; end if;
if map.tiles (x, y) not in 18 .. 23 and map.tiles (x + 1, y ) in 18 .. 23 then map.tiles (x, y ) := 26; end if;
if map.tiles (x, y) in 18 .. 23 and map.tiles (x + 1, y ) not in 18 .. 23 then map.tiles (x + 1, y ) := 27; end if;
--~if matrix (1, 1) = 1 and map.tiles (x, y + 1) in 18 .. 23 then map.tiles (x, y ) := 24; end if;
--~if matrix (1, 1) = 0 and map.tiles (x, y + 1) not in 18 .. 23 then map.tiles (x, y + 1) := 25; end if;
--~if matrix (1, 1) = 1 and map.tiles (x + 1, y ) in 18 .. 23 then map.tiles (x, y ) := 26; end if;
--~if matrix (1, 1) = 0 and map.tiles (x + 1, y ) not in 18 .. 23 then map.tiles (x + 1, y ) := 27; end if;
--
if matrix = ((1, 1), (1, 0)) then map.tiles (x - 1, y - 1) := 28;
elsif matrix = ((1, 0), (1, 1)) then map.tiles (x, y - 1) := 29;

View File

@ -2,7 +2,7 @@
--
-- GNU General Public Licence (version 3 or later)
with core, notification, material, equipment, unit, construction, chad, effect;
with core, attribute, skill, resource, material, equipment, unit, construction, chad, effect;
package world is
@ -111,20 +111,20 @@ package world is
);
location_trait : constant array (location_index) of location_stats := (
well_of_agility => ("Well of Agility ", true, 4, 3, (effect.speed, 2, 0, false, 0, notification.well_of_agility)),
well_of_knowledge => ("Well of Knowledge ", true, 4, 3, (effect.wisdom, 2, 0, false, 0, notification.well_of_knowledge)),
well_of_strength => ("Well of Strength ", true, 4, 3, (effect.offense, 2, 0, false, 0, notification.well_of_strength)),
old_dwarven_grave => ("Old Dwarven Grave ", true, 1, 3, (effect.defense, 1, 0, false, 0, notification.none)),
huge_ancient_urn => ("Huge Ancient Urn ", true, 1, 3, (effect.offense, 1, 0, false, 0, notification.none)),
well_of_agility => ("Well of Agility ", true, 4, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.speed), 2, false, 0)),
well_of_knowledge => ("Well of Knowledge ", true, 4, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.wisdom), 2, false, 0)),
well_of_strength => ("Well of Strength ", true, 4, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.offense), 2, false, 0)),
old_dwarven_grave => ("Old Dwarven Grave ", true, 1, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.defense), 1, false, 0)),
huge_ancient_urn => ("Huge Ancient Urn ", true, 1, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.offense), 1, false, 0)),
--
banana_tree => ("Banana Tree ", true, 4, 3, (effect.take_material, material.enumeration'pos (material.banana), 4, true, 600, notification.none)),
apple_tree => ("Apple Tree ", true, 4, 3, (effect.take_material, material.enumeration'pos (material.apple), 6, true, 600, notification.none)),
cherry_tree => ("Cherry Tree ", true, 4, 3, (effect.take_material, material.enumeration'pos (material.cherry), 6, true, 600, notification.none)),
lemon_tree => ("Lemon Tree ", true, 4, 3, (effect.take_material, material.enumeration'pos (material.lemon), 6, true, 600, notification.none)),
orange_tree => ("Orange Tree ", true, 4, 3, (effect.take_material, material.enumeration'pos (material.orange), 6, true, 600, notification.none)),
pear_tree => ("Pear Tree ", true, 4, 3, (effect.take_material, material.enumeration'pos (material.pear), 6, true, 600, notification.none)),
peach_tree => ("Peach Tree ", true, 4, 3, (effect.take_material, material.enumeration'pos (material.peach), 6, true, 600, notification.none)),
plum_tree => ("Plum Tree ", true, 4, 3, (effect.take_material, material.enumeration'pos (material.plum), 6, true, 600, notification.none))
banana_tree => ("Banana Tree ", true, 4, 3, (effect.modify_material, material.enumeration'pos (material.banana), 4, true, 600)),
apple_tree => ("Apple Tree ", true, 4, 3, (effect.modify_material, material.enumeration'pos (material.apple), 6, true, 600)),
cherry_tree => ("Cherry Tree ", true, 4, 3, (effect.modify_material, material.enumeration'pos (material.cherry), 6, true, 600)),
lemon_tree => ("Lemon Tree ", true, 4, 3, (effect.modify_material, material.enumeration'pos (material.lemon), 6, true, 600)),
orange_tree => ("Orange Tree ", true, 4, 3, (effect.modify_material, material.enumeration'pos (material.orange), 6, true, 600)),
pear_tree => ("Pear Tree ", true, 4, 3, (effect.modify_material, material.enumeration'pos (material.pear), 6, true, 600)),
peach_tree => ("Peach Tree ", true, 4, 3, (effect.modify_material, material.enumeration'pos (material.peach), 6, true, 600)),
plum_tree => ("Plum Tree ", true, 4, 3, (effect.modify_material, material.enumeration'pos (material.plum), 6, true, 600))
);
map : information;

BIN
ui/ada_grayscale.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB