Refactored new experimental string allocaitons in World and Attribute packages...

This commit is contained in:
Ognjen Milan Robovic 2024-06-04 07:34:20 -04:00
parent 5d6e67face
commit 336041173c
4 changed files with 142 additions and 142 deletions

View File

@ -3,7 +3,6 @@
-- GNU General Public Licence (version 3 or later)
with core;
use core;
package attribute is
@ -16,9 +15,9 @@ package attribute is
------------------------------------------------------------------------------------------
type definition is record
base : core.point;
name : core.unstring;
text : core.unstring;
base : core.point;
name : access string;
text : access string;
end record;
type points is array (enumeration) of core.point;
@ -31,12 +30,12 @@ package attribute is
default : constant points := (others => (1, 12));
description : constant array (enumeration) of definition := (
offense => ((1, 12), +("Offense"), +("Offense attribute determines your damage modifier when attacking.")),
defense => ((1, 12), +("Defense"), +("D-FENS attribute determines how much damage your reflect and receive.")),
wisdom => ((1, 12), +("Wisdom"), +("Wisdom attribute determines how much mana your chad has.")),
stamina => ((1, 12), +("Stamina"), +("Stamina attribute determines how fast you recover from being wounded.")),
speed => ((1, 12), +("Speed"), +("Speed attribute determines how far you can walk per turn.")),
reach => ((1, 12), +("Reach"), +("Reach attribute determines your range modifier when shooting or casting."))
offense => ((1, 12), new string' ("Offense"), new string' ("Offense attribute determines your damage modifier when attacking.")),
defense => ((1, 12), new string' ("Defense"), new string' ("D-FENS attribute determines how much damage your reflect and receive.")),
wisdom => ((1, 12), new string' ("Wisdom"), new string' ("Wisdom attribute determines how much mana your chad has.")),
stamina => ((1, 12), new string' ("Stamina"), new string' ("Stamina attribute determines how fast you recover from being wounded.")),
speed => ((1, 12), new string' ("Speed"), new string' ("Speed attribute determines how far you can walk per turn.")),
reach => ((1, 12), new string' ("Reach"), new string' ("Reach attribute determines your range modifier when shooting or casting."))
);
icon : array (enumeration) of core.sprite;

View File

@ -382,7 +382,7 @@ begin
declare move_x : integer := x;
begin
for index in attribute.enumeration loop
ui.draw_icon (attribute.icon (index), -(attribute.description (index).text), move_x, y + 96 + 3 * 8);
ui.draw_icon (attribute.icon (index), attribute.description (index).text.all, move_x, y + 96 + 3 * 8);
ui.draw_text_box (move_x, y + 96 + 3 * 8 + core.icon, core.icon, core.icon);
ui.write (player.attributes (index).value'image, move_x + 4, y + 96 + 3 * 8 + core.icon + 8, (others => 255), 15, true);
--

View File

@ -4,8 +4,11 @@
with core, ui, attribute, skill, resource, equipment, unit, construction, chad, effect;
use type core.cursor_code;
use type core.point;
use core;
--~use type core.cursor_code;
--~use type core.signal_code;
--~use type core.point;
package body world is
@ -238,7 +241,7 @@ package body world is
height => landmarks (landmark_index'val (map.landmarks (index).index)).height)
and core.cursor_mode = core.cursor_middle
and not ui.prioritize then
core.write_text_box (-(landmark_description (landmark_index'val (map.landmarks (index).index)).name));
core.write_text_box (landmark_description (landmark_index'val (map.landmarks (index).index)).name.all);
end if;
end if;
end loop;
@ -271,7 +274,7 @@ package body world is
height => locations (location_index'val (map.locations (index).index)).height)
and core.cursor_mode = core.cursor_middle
and not ui.prioritize then
core.write_text_box (-(location_description (location_index'val (map.locations (index).index)).name));
core.write_text_box (location_description (location_index'val (map.locations (index).index)).name.all);
end if;
end if;
--
@ -302,7 +305,7 @@ package body world is
when effect.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) & " "
& (-(attribute.description (attribute_index).name)) & " attribute points.");
& attribute.description (attribute_index).name.all & " attribute points.");
--
when effect.modify_skill => skill_index := skill.enumeration'val (data.modifier);
player.skills (skill_index) := player.skills (skill_index) + data.amount;

View File

@ -4,8 +4,6 @@
with core, attribute, skill, resource, material, equipment, unit, construction, chad, effect;
use core;
package world is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -31,18 +29,18 @@ package world is
------------------------------------------------------------------------------------------
type landmark_stats is record
name : core.unstring;
spawn : biome;
clip : boolean;
frames : integer;
name : access string;
spawn : biome;
clip : boolean;
frames : integer;
end record;
type location_stats is record
name : core.unstring;
clip : boolean;
frames : integer;
states : integer;
evoke : effect.information;
name : access string;
clip : boolean;
frames : integer;
states : integer;
evoke : effect.information;
end record;
type entity_description is record
@ -83,130 +81,130 @@ package world is
location_count : constant natural := location_index'pos (location_index'last) + 1;
landmark_description : constant array (landmark_index) of landmark_stats := (
dead_tree => (+("Dead Tree"), ash, true, 1),
mossy_rock => (+("Mossy Rock"), swamp, true, 1),
palm_tree => (+("Palm Tree"), sand, true, 4),
pine_tree => (+("Pine Tree"), grass, true, 4),
pine_forest => (+("Pine Forest"), grass, true, 4),
reeds => (+("Reeds"), swamp, false, 4),
rock => (+("Rock"), sand, true, 1),
snowed_pine_tree => (+("Snowed Pine Tree"), snow, true, 4),
snowed_rock => (+("Snowed Rock"), snow, true, 1),
spiky_rock => (+("Spiky Rock"), ash, true, 1),
wooden_sign => (+("Wooden Sign"), grass, false, 1),
wooden_arrow_sign => (+("Wooden Arrow Sign"), grass, false, 1),
rune_stone => (+("Rune Stone"), grass, true, 4),
snowed_rune_stone => (+("Snowed Rune Stone"), snow, true, 1),
mossy_rune_stone => (+("Mossy Rune Stone"), swamp, true, 4),
snowed_pine_forest => (+("Snowed Pine Forest"), snow, true, 4),
hyacinths => (+("Hyacinths"), grass, false, 1),
orchids => (+("Orchids"), grass, false, 1),
asters => (+("Asters"), grass, false, 1),
daffodils => (+("Daffodils"), grass, false, 1),
royal_grave => (+("Royal Grave"), ash, true, 1),
grave => (+("Grave"), ash, true, 1),
humble_grave => (+("Humble Grave"), ash, true, 1),
wooden_wide_sign => (+("Wooden Wide Sign"), grass, false, 1),
birch_tree => (+("Birch Tree"), grass, true, 4),
fir_tree => (+("Fir Tree"), grass, true, 4),
oak_tree => (+("Oak Tree"), grass, true, 4),
old_willow_tree => (+("Old Willow Tree"), swamp, true, 4)
dead_tree => (new string' ("Dead Tree"), ash, true, 1),
mossy_rock => (new string' ("Mossy Rock"), swamp, true, 1),
palm_tree => (new string' ("Palm Tree"), sand, true, 4),
pine_tree => (new string' ("Pine Tree"), grass, true, 4),
pine_forest => (new string' ("Pine Forest"), grass, true, 4),
reeds => (new string' ("Reeds"), swamp, false, 4),
rock => (new string' ("Rock"), sand, true, 1),
snowed_pine_tree => (new string' ("Snowed Pine Tree"), snow, true, 4),
snowed_rock => (new string' ("Snowed Rock"), snow, true, 1),
spiky_rock => (new string' ("Spiky Rock"), ash, true, 1),
wooden_sign => (new string' ("Wooden Sign"), grass, false, 1),
wooden_arrow_sign => (new string' ("Wooden Arrow Sign"), grass, false, 1),
rune_stone => (new string' ("Rune Stone"), grass, true, 4),
snowed_rune_stone => (new string' ("Snowed Rune Stone"), snow, true, 1),
mossy_rune_stone => (new string' ("Mossy Rune Stone"), swamp, true, 4),
snowed_pine_forest => (new string' ("Snowed Pine Forest"), snow, true, 4),
hyacinths => (new string' ("Hyacinths"), grass, false, 1),
orchids => (new string' ("Orchids"), grass, false, 1),
asters => (new string' ("Asters"), grass, false, 1),
daffodils => (new string' ("Daffodils"), grass, false, 1),
royal_grave => (new string' ("Royal Grave"), ash, true, 1),
grave => (new string' ("Grave"), ash, true, 1),
humble_grave => (new string' ("Humble Grave"), ash, true, 1),
wooden_wide_sign => (new string' ("Wooden Wide Sign"), grass, false, 1),
birch_tree => (new string' ("Birch Tree"), grass, true, 4),
fir_tree => (new string' ("Fir Tree"), grass, true, 4),
oak_tree => (new string' ("Oak Tree"), grass, true, 4),
old_willow_tree => (new string' ("Old Willow Tree"), swamp, true, 4)
);
location_description : constant array (location_index) of location_stats := (
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.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))
well_of_agility => (new string' ("Well of Agility"), true, 4, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.speed), 2, false, 0)),
well_of_knowledge => (new string' ("Well of Knowledge"), true, 4, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.wisdom), 2, false, 0)),
well_of_strength => (new string' ("Well of Strength"), true, 4, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.offense), 2, false, 0)),
old_dwarven_grave => (new string' ("Old Dwarven Grave"), true, 1, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.defense), 1, false, 0)),
huge_ancient_urn => (new string' ("Huge Ancient Urn"), true, 1, 3, (effect.modify_attribute, attribute.enumeration'pos (attribute.offense), 1, false, 0)),
banana_tree => (new string' ("Banana Tree"), true, 4, 3, (effect.modify_material, material.enumeration'pos (material.banana), 4, true, 600)),
apple_tree => (new string' ("Apple Tree"), true, 4, 3, (effect.modify_material, material.enumeration'pos (material.apple), 6, true, 600)),
cherry_tree => (new string' ("Cherry Tree"), true, 4, 3, (effect.modify_material, material.enumeration'pos (material.cherry), 6, true, 600)),
lemon_tree => (new string' ("Lemon Tree"), true, 4, 3, (effect.modify_material, material.enumeration'pos (material.lemon), 6, true, 600)),
orange_tree => (new string' ("Orange Tree"), true, 4, 3, (effect.modify_material, material.enumeration'pos (material.orange), 6, true, 600)),
pear_tree => (new string' ("Pear Tree"), true, 4, 3, (effect.modify_material, material.enumeration'pos (material.pear), 6, true, 600)),
peach_tree => (new string' ("Peach Tree"), true, 4, 3, (effect.modify_material, material.enumeration'pos (material.peach), 6, true, 600)),
plum_tree => (new string' ("Plum Tree"), true, 4, 3, (effect.modify_material, material.enumeration'pos (material.plum), 6, true, 600))
);
month_name : constant array (1 .. 12) of core.unstring := (
+("I <> Month of Red-Haired Goddess"),
+("II <> Month of Xorana"),
+("III <> Month of Heneal"),
+("IV <> Month of Evelor"),
+("V <> Month of Orohan"),
+("VI <> Month of Aezora"),
+("VII <> Month of Mitena"),
+("VIII <> Month of Sheila"),
+("IX <> Month of Iliona"),
+("X <> Month of Uldrae"),
+("XI <> Month of Kanako"),
+("XII <> Month of Time-Rebirth")
month_name : constant array (1 .. 12) of access string := (
new string' ("I <> Month of Red-Haired Goddess"),
new string' ("II <> Month of Xorana"),
new string' ("III <> Month of Heneal"),
new string' ("IV <> Month of Evelor"),
new string' ("V <> Month of Orohan"),
new string' ("VI <> Month of Aezora"),
new string' ("VII <> Month of Mitena"),
new string' ("VIII <> Month of Sheila"),
new string' ("IX <> Month of Iliona"),
new string' ("X <> Month of Uldrae"),
new string' ("XI <> Month of Kanako"),
new string' ("XII <> Month of Time-Rebirth")
);
week_name : constant array (1 .. 52) of core.unstring := (
+("I <> Week of Miners"),
+("II <> Week of Flora"),
+("III <> Week of Alchemists"),
+("IV <> Week of Shape"),
+("V <> Week of Sword"),
+("VI <> Week of Necromancers"),
+("VII <> Week of Fauna"),
+("VIII <> Week of --"),
+("IX <> Week of Guards"),
+("X <> Week of Blacksmiths"),
+("XI <> Week of Archers"),
+("XII <> Week of --"),
+("XIII <> Week of Sound"),
+("XIV <> Week of Water"),
+("XV <> Week of Bankers"),
+("XVI <> Week of --"),
+("XVII <> Week of --"),
+("XVIII <> Week of Thaumaturgs"),
+("XIX <> Week of Stonecutters"),
+("XX <> Week of --"),
+("XXI <> Week of --"),
+("XXII <> Week of Logic"),
+("XXIII <> Week of Mystics"),
+("XXIV <> Week of Diplomats"),
+("XXV <> Week of Boots"),
+("XXVI <> Week of Shield"),
+("XXVII <> Week of Advisors"),
+("XXVIII <> Week of Architects"),
+("XXIX <> Week of Flame"),
+("XXX <> Week of Value"),
+("XXXI <> Week of Healers"),
+("XXXII <> Week of Spear"),
+("XXXIII <> Week of --"),
+("XXXIV <> Week of Leaders"),
+("XXXV <> Week of Skirmishers"),
+("XXXVI <> Week of Lubmerjacks"),
+("XXXVII <> Week of Pathfinders"),
+("XXXVIII <> Week of --"),
+("XXXIX <> Week of --"),
+("XL <> Week of Helmet"),
+("XLI <> Week of Leatherers"),
+("XLII <> Week of --"),
+("XLIII <> Week of --"),
+("XLIV <> Week of Sorcerers"),
+("XLV <> Week of Gloves"),
+("XLVI <> Week of Earth"),
+("XLVII <> Week of Explorers"),
+("XLVIII <> Week of --"),
+("XLIX <> Week of Strategists"),
+("L <> Week of Gemologists"),
+("LI <> Week of Merchants"),
+("LII <> Week of World")
week_name : constant array (1 .. 52) of access string := (
new string' ("I <> Week of Miners"),
new string' ("II <> Week of Flora"),
new string' ("III <> Week of Alchemists"),
new string' ("IV <> Week of Shape"),
new string' ("V <> Week of Sword"),
new string' ("VI <> Week of Necromancers"),
new string' ("VII <> Week of Fauna"),
new string' ("VIII <> Week of --"),
new string' ("IX <> Week of Guards"),
new string' ("X <> Week of Blacksmiths"),
new string' ("XI <> Week of Archers"),
new string' ("XII <> Week of --"),
new string' ("XIII <> Week of Sound"),
new string' ("XIV <> Week of Water"),
new string' ("XV <> Week of Bankers"),
new string' ("XVI <> Week of --"),
new string' ("XVII <> Week of --"),
new string' ("XVIII <> Week of Thaumaturgs"),
new string' ("XIX <> Week of Stonecutters"),
new string' ("XX <> Week of --"),
new string' ("XXI <> Week of --"),
new string' ("XXII <> Week of Logic"),
new string' ("XXIII <> Week of Mystics"),
new string' ("XXIV <> Week of Diplomats"),
new string' ("XXV <> Week of Boots"),
new string' ("XXVI <> Week of Shield"),
new string' ("XXVII <> Week of Advisors"),
new string' ("XXVIII <> Week of Architects"),
new string' ("XXIX <> Week of Flame"),
new string' ("XXX <> Week of Value"),
new string' ("XXXI <> Week of Healers"),
new string' ("XXXII <> Week of Spear"),
new string' ("XXXIII <> Week of --"),
new string' ("XXXIV <> Week of Leaders"),
new string' ("XXXV <> Week of Skirmishers"),
new string' ("XXXVI <> Week of Lubmerjacks"),
new string' ("XXXVII <> Week of Pathfinders"),
new string' ("XXXVIII <> Week of --"),
new string' ("XXXIX <> Week of --"),
new string' ("XL <> Week of Helmet"),
new string' ("XLI <> Week of Leatherers"),
new string' ("XLII <> Week of --"),
new string' ("XLIII <> Week of --"),
new string' ("XLIV <> Week of Sorcerers"),
new string' ("XLV <> Week of Gloves"),
new string' ("XLVI <> Week of Earth"),
new string' ("XLVII <> Week of Explorers"),
new string' ("XLVIII <> Week of --"),
new string' ("XLIX <> Week of Strategists"),
new string' ("L <> Week of Gemologists"),
new string' ("LI <> Week of Merchants"),
new string' ("LII <> Week of World")
);
day_name : constant array (1 .. 7) of core.unstring := (
+("I <> Day of Sun"),
+("II <> Day of Mother-Moon"),
+("III <> Day of Daughter-Moon"),
+("IV <> Day of All-Earth"),
+("V <> Day of All-Water"),
+("VI <> Day of All-Sky"),
+("VII <> Day of Deities")
day_name : constant array (1 .. 7) of access string := (
new string' ("I <> Day of Sun"),
new string' ("II <> Day of Mother-Moon"),
new string' ("III <> Day of Daughter-Moon"),
new string' ("IV <> Day of All-Earth"),
new string' ("V <> Day of All-Water"),
new string' ("VI <> Day of All-Sky"),
new string' ("VII <> Day of Deities")
);
map : definition;