xhads/source/world.ads

169 lines
7.0 KiB
Ada

-- Copyright (c) 2024 - Ognjen 'xolatile' Milan Robovic
--
-- GNU General Public Licence (version 3 or later)
with core, material, equipment, unit, construction, chad, effect;
package world is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
type biome is (
ash, sand, grass, rough, snow, swamp
);
type landmark_index is (
dead_tree, mossy_rock, palm_tree, pine_tree, pine_forest, reeds,
rock, snowed_pine_tree, snowed_rock, spiky_rock, wooden_sign, wooden_arrow_sign,
rune_stone, snowed_rune_stone, mossy_rune_stone, snowed_pine_forest, hyacinths, orchids,
asters, daffodils, royal_grave, grave, humble_grave, wooden_wide_sign
);
type location_index is (
well_of_agility, well_of_knowledge, well_of_strength, old_dwarven_grave, huge_ancient_urn, banana_tree
);
------------------------------------------------------------------------------------------
type landmark_stats is record
name : core.short_string;
spawn : biome;
clip : boolean;
frames : integer;
end record;
type location_stats is record
name : core.short_string;
clip : boolean;
frames : integer;
states : integer;
evoke : effect.value;
end record;
type entity_trait is record
index : natural;
state : natural;
x, y : integer;
end record;
type integer_matrix is array (natural range <>, natural range <>) of integer;
type boolean_matrix is array (natural range <>, natural range <>) of boolean;
type entity_array is array (natural range <>) of entity_trait;
type information is record
kind : biome;
width : natural;
height : natural;
chad_count : natural;
chad_limit : natural;
tiles : access integer_matrix;
clips : access boolean_matrix;
views : access boolean_matrix;
landmarks : access entity_array;
locations : access entity_array;
constructions : access entity_array;
equipments : access entity_array;
units : access entity_array;
chads : access chad.value_array;
end record;
------------------------------------------------------------------------------------------
biome_count : constant natural := biome'pos (biome'last) + 1;
landmarks : array (landmark_index) of core.sprite;
locations : array (location_index) of core.sprite;
landmark_count : constant natural := landmark_index'pos (landmark_index'last) + 1;
location_count : constant natural := location_index'pos (location_index'last) + 1;
landmark_trait : 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)
);
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)),
--
banana_tree => ("Banana Tree ", true, 4, 3, (effect.take_material, material.enumeration'pos (material.banana), 4, true, 600))
);
map : information;
draw_tiles_timer : natural := 0;
draw_views_timer : natural := 0;
draw_landmarks_timer : natural := 0;
draw_locations_timer : natural := 0;
draw_constructions_timer : natural := 0;
draw_equipments_timer : natural := 0;
draw_units_timer : natural := 0;
draw_world_timer : natural := 0;
drawn_tiles : natural := 0;
drawn_views : natural := 0;
drawn_landmarks : natural := 0;
drawn_locations : natural := 0;
drawn_constructions : natural := 0;
drawn_equipments : natural := 0;
drawn_units : natural := 0;
------------------------------------------------------------------------------------------
procedure configure;
procedure make (index : in biome; width, height, chad_limit : in natural);
procedure save (file_name : in string);
procedure load (file_name : in string);
procedure draw;
procedure mapshot (file_path : in string);
function map_is_revealed return boolean;
procedure add_chad (data : in chad.value);
procedure resource_cheat_1;
procedure resource_cheat_2;
procedure resource_cheat_3;
procedure resource_cheat_4;
procedure resource_cheat_5;
procedure resource_cheat_6;
procedure reveal_map;
procedure player_up;
procedure player_down;
procedure player_left;
procedure player_right;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end world;