Added prototype notifications, they are bad...

This commit is contained in:
Ognjen Milan Robovic 2024-05-29 09:26:10 -04:00
parent a71e4f9a36
commit 2241ba8279
7 changed files with 114 additions and 21 deletions

View File

@ -2,7 +2,7 @@
--
-- GNU General Public Licence (version 3 or later)
with core, attribute, skill, resource, deity, material, magic, equipment, unit, construction, chad, world;
with core, notification, attribute, skill, resource, deity, material, magic, equipment, unit, construction, chad, world;
use type core.point;
@ -47,6 +47,8 @@ package body effect is
--
when take_material => core.increment (world.map.chads (1).materials (material.enumeration'val (data.modifier)).value, data.amount);
end case;
--
notification.show (data.notify);
end apply;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -2,6 +2,8 @@
--
-- GNU General Public Licence (version 3 or later)
with notification;
package effect is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -24,9 +26,10 @@ package effect is
amount : natural;
permanent : boolean;
duration : natural;
notify : notification.enumeration;
end record;
none : constant value := (idle, 0, 0, false, 0);
none : constant value := (idle, 0, 0, false, 0, notification.none);
------------------------------------------------------------------------------------------

View File

@ -4,7 +4,7 @@
pragma ada_2012;
with core, ui, effect, attribute, skill, resource, faction, deity, material, magic, equipment, unit, construction, chad, world;
with core, ui, notification, effect, attribute, skill, resource, faction, deity, material, magic, equipment, unit, construction, chad, world;
with ada.strings.unbounded;
use ada.strings.unbounded;
@ -340,6 +340,7 @@ begin
core.camera.x := world.map.chads (1).x;
core.camera.y := world.map.chads (1).y;
--
notification.synchronize;
ui.synchronize;
end loop gameplay_loop;

60
source/notification.adb Normal file
View File

@ -0,0 +1,60 @@
-- 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.cursor_inside (x, y, 960, 128) and 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 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;

27
source/notification.ads Normal file
View File

@ -0,0 +1,27 @@
-- 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 synchronize;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end notification;

View File

@ -15,10 +15,10 @@ package body world is
lake_count : constant natural := 6;
landmark_limit : constant integer := 90;
location_limit : constant integer := 30;
construction_limit : constant natural := 60;
equipment_limit : constant natural := 600;
landmark_limit : constant integer := 480;
location_limit : constant integer := 240;
construction_limit : constant natural := 120;
equipment_limit : constant natural := 300;
unit_limit : constant natural := 60;
tiles : array (biome) of core.sprite;

View File

@ -2,7 +2,7 @@
--
-- GNU General Public Licence (version 3 or later)
with core, material, equipment, unit, construction, chad, effect;
with core, notification, 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)),
well_of_knowledge => ("Well of Knowledge ", true, 4, 3, (effect.wisdom, 2, 0, false, 0)),
well_of_strength => ("Well of Strength ", true, 4, 3, (effect.offense, 2, 0, false, 0)),
old_dwarven_grave => ("Old Dwarven Grave ", true, 1, 3, (effect.defense, 1, 0, false, 0)),
huge_ancient_urn => ("Huge Ancient Urn ", true, 1, 3, (effect.offense, 1, 0, false, 0)),
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)),
--
banana_tree => ("Banana Tree ", true, 4, 3, (effect.take_material, material.enumeration'pos (material.banana), 4, true, 600)),
apple_tree => ("Apple Tree ", true, 4, 3, (effect.take_material, material.enumeration'pos (material.apple), 6, true, 600)),
cherry_tree => ("Cherry Tree ", true, 4, 3, (effect.take_material, material.enumeration'pos (material.cherry), 6, true, 600)),
lemon_tree => ("Lemon Tree ", true, 4, 3, (effect.take_material, material.enumeration'pos (material.lemon), 6, true, 600)),
orange_tree => ("Orange Tree ", true, 4, 3, (effect.take_material, material.enumeration'pos (material.orange), 6, true, 600)),
pear_tree => ("Pear Tree ", true, 4, 3, (effect.take_material, material.enumeration'pos (material.pear), 6, true, 600)),
peach_tree => ("Peach Tree ", true, 4, 3, (effect.take_material, material.enumeration'pos (material.peach), 6, true, 600)),
plum_tree => ("Plum Tree ", true, 4, 3, (effect.take_material, material.enumeration'pos (material.plum), 6, true, 600))
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))
);
map : information;