From ecc6e0ba6829df4585a3baee74abfc5ad09a77e4 Mon Sep 17 00:00:00 2001 From: xolatile Date: Wed, 5 Jun 2024 08:29:55 -0400 Subject: [PATCH] Added certain default values... --- source/chad.ads | 28 ++++++++++++++-------------- source/effect.ads | 12 ++++++------ source/equipment.ads | 5 ++++- source/main.adb | 14 +------------- source/material.ads | 2 +- source/resource.ads | 2 ++ source/world.adb | 4 ++++ source/world.ads | 43 ++++++++++++++++++++++--------------------- 8 files changed, 54 insertions(+), 56 deletions(-) diff --git a/source/chad.ads b/source/chad.ads index 6ddd06d..0857344 100644 --- a/source/chad.ads +++ b/source/chad.ads @@ -27,20 +27,20 @@ package chad is type item_array is array (0 .. item_limit - 1) of equipment.enumeration; type information is record - index : enumeration; - state : core.animation; - x : integer; - y : integer; - health : core.point; - mana : core.point; - movement : core.point; - attributes : attribute.points; - skills : skill.points; - resources : resource.points; - materials : material.points; - equipments : equipment.equip_array; - item_count : natural; - items : item_array; + index : enumeration := ada; + state : core.animation := core.idle; + x : integer := 0; + y : integer := 0; + health : core.point := (12, 12); + mana : core.point := (12, 12); + movement : core.point := (12, 12); + attributes : attribute.points := attribute.default; + skills : skill.points := skill.default; + resources : resource.points := resource.default; + materials : material.points := material.default; + equipments : equipment.equip_array := equipment.default; + item_count : natural := 0; + items : item_array := (others => equipment.none); end record; type informations is array (natural range <>) of information; diff --git a/source/effect.ads b/source/effect.ads index acb6fc1..1f82528 100644 --- a/source/effect.ads +++ b/source/effect.ads @@ -17,14 +17,14 @@ package effect is ------------------------------------------------------------------------------------------ type information is record - kind : enumeration; - modifier : integer; - amount : integer; - permanent : boolean; - duration : natural; + kind : enumeration := idle; + modifier : integer := 0; + amount : integer := 0; + permanent : boolean := false; + duration : natural := 0; end record; - none : constant information := (idle, 0, 0, false, 0); + none : constant information := (others => <>); ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ diff --git a/source/equipment.ads b/source/equipment.ads index 88e4c71..daeb046 100644 --- a/source/equipment.ads +++ b/source/equipment.ads @@ -56,8 +56,11 @@ package equipment is count : constant natural := enumeration'pos (enumeration'last) + 1; + default : constant equip_array := (others => none); + description : constant array (enumeration) of definition := ( - none => (new string'("--"), full_body, (0, 0, 0, 0, 0, 0), faction.neutral, effect.none), + none => (others => <>), + -- golden_axe => (new string'("Golden Axe"), main_hand, (2, 0, 0, 0, 0, 0), faction.fairy, effect.none), golden_battleaxe => (new string'("Golden Battleaxe"), main_hand, (3, 0, 0, 0, 0, 0), faction.fairy, effect.none), golden_bow => (new string'("Golden Bow"), main_hand, (1, 0, 0, 0, 0, 0), faction.fairy, effect.none), diff --git a/source/main.adb b/source/main.adb index b44028a..d96f43f 100644 --- a/source/main.adb +++ b/source/main.adb @@ -109,25 +109,13 @@ procedure main is text_box_height : integer := 0; player : chad.information := ( - index => chad.ada, - state => core.idle, - x => 0, - y => 0, - health => (30, 40), - mana => (20, 30), - movement => (10, 20), - attributes => attribute.default, - skills => skill.default, - resources => ((29, 480), (11, 240), (23, 240), (13, 240), (17, 240), (7, 240)), - materials => material.default, equipments => (equipment.chest => equipment.iron_chestplate, equipment.head => equipment.iron_helmet, equipment.hands => equipment.iron_gauntlets, equipment.feet => equipment.iron_greaves, equipment.main_hand => equipment.iron_sword, others => equipment.none), - item_count => 0, - items => (others => equipment.none) + others => <> ); ------------------------------------------------------------------------------------------ diff --git a/source/material.ads b/source/material.ads index fc3234e..a63bafa 100644 --- a/source/material.ads +++ b/source/material.ads @@ -29,7 +29,7 @@ package material is count : constant natural := enumeration'pos (enumeration'last) + 1; - default : constant points := (others => (1, 12)); + default : constant points := (others => (0, 12)); description : constant array (enumeration) of definition := ( sulphur => (new string'("Sulphur"), 11), diff --git a/source/resource.ads b/source/resource.ads index b314328..f95b8cf 100644 --- a/source/resource.ads +++ b/source/resource.ads @@ -27,6 +27,8 @@ package resource is count : constant natural := enumeration'pos (enumeration'last) + 1; + default : constant points := (others => (12, 240)); + description : constant array (enumeration) of definition := ( gold => ((24, 480), new string'("Gold"), new string'("Gold is precious yellowish shiny metal, valued since ancient times.")), wood => ((12, 240), new string'("Wood"), new string'("Wood is just bundle of lignin and cellulose, nothing more.")), diff --git a/source/world.adb b/source/world.adb index 0663326..2245b32 100644 --- a/source/world.adb +++ b/source/world.adb @@ -111,6 +111,10 @@ package body world is y => offset.y + (vertical - core.camera.y) * size, width => size, height => size) + and core.cursor_inside (x => core.window_width / 2 - 6 * size, + y => core.window_height / 2 - 6 * size, + width => 12 * size, + height => 12 * size) and core.cursor_mode = core.cursor_left and not ui.prioritize then target.x := horizontal; diff --git a/source/world.ads b/source/world.ads index 0941952..bd6001e 100644 --- a/source/world.ads +++ b/source/world.ads @@ -117,29 +117,30 @@ package world is 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)) + 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 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") + month_name : constant array (1 .. 13) of access string := ( + new string'("I <> Month of Life"), + new string'("II <> Month of Red-Haired Goddess"), + new string'("III <> Month of Xorana"), + new string'("IV <> Month of Heneal"), + new string'("V <> Month of Evelor"), + new string'("VI <> Month of Orohan"), + new string'("VII <> Month of Aezora"), + new string'("VIII <> Month of Mitena"), + new string'("IX <> Month of Sheila"), + new string'("X <> Month of Iliona"), + new string'("XI <> Month of Uldrae"), + new string'("XII <> Month of Kanako"), + new string'("XIII <> Month of Death") ); week_name : constant array (1 .. 52) of access string := (