@@ -19,7 +19,7 @@ package construction is | |||
kind : faction.enumeration; | |||
price : resource.points; | |||
frames : integer; | |||
evoke : effect.enumeration; | |||
evoke : effect.value; | |||
end record; | |||
------------------------------------------------------------------------------------------ | |||
@@ -1,22 +0,0 @@ | |||
-- | |||
with core; | |||
package body effect is | |||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | |||
sprite : array (enumeration) of core.sprite; | |||
------------------------------------------------------------------------------------------ | |||
procedure draw (value : in enumeration; x, y : in integer) is | |||
begin | |||
null; | |||
end draw; | |||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | |||
end effect; |
@@ -8,29 +8,44 @@ package effect is | |||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | |||
type enumeration is ( | |||
none, one | |||
type operation_index is ( | |||
idle, | |||
add, | |||
subtract, | |||
multiply, | |||
divide, | |||
increment, | |||
decrement | |||
); | |||
------------------------------------------------------------------------------------------ | |||
type information is record | |||
name : core.short_string; | |||
make : boolean; | |||
end record; | |||
type operator_index is ( | |||
attribute, | |||
skill, | |||
resource | |||
); | |||
------------------------------------------------------------------------------------------ | |||
count : constant natural := enumeration'pos (enumeration'last) + 1; | |||
type value is record | |||
operation : operation_index; | |||
operator : operator_index; | |||
modifier : integer; | |||
permanent : boolean; | |||
duration : natural; | |||
end record; | |||
trait : constant array (enumeration) of information := ( | |||
("- ", true), | |||
("- ", true) | |||
); | |||
none : value; | |||
------------------------------------------------------------------------------------------ | |||
procedure draw (value : in enumeration; x, y : in integer); | |||
--~count : constant natural := enumeration'pos (enumeration'last) + 1; | |||
--~trait : constant array (enumeration) of information := ( | |||
--~((others => null), (others => (others => 0))), | |||
--~((others => null), (others => (others => 0))), | |||
--~((others => null), (others => (others => 0))), | |||
--~((others => null), (others => (others => 0))) | |||
--~); | |||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | |||
@@ -47,7 +47,7 @@ package equipment is | |||
kind : slot; | |||
attributes : attribute.points; | |||
favor : faction.enumeration; | |||
evoke : effect.enumeration; | |||
evoke : effect.value; | |||
end record; | |||
type equip_array is array (slot) of enumeration; | |||
@@ -35,7 +35,7 @@ package magic is | |||
name : core.short_string; | |||
kind : school; | |||
level : level_limit; | |||
evoke : effect.enumeration; | |||
evoke : effect.value; | |||
text : core.long_string; | |||
end record; | |||
@@ -18,7 +18,7 @@ package unit is | |||
name : core.short_string; | |||
kind : faction.enumeration; | |||
attributes : attribute.points; | |||
evoke : effect.enumeration; | |||
evoke : effect.value; | |||
text : core.long_string; | |||
end record; | |||
@@ -2,7 +2,7 @@ | |||
-- | |||
-- GNU General Public Licence (version 3 or later) | |||
with core, ui, resource, equipment, unit, construction, chad; | |||
with core, ui, resource, equipment, unit, construction, chad, effect; | |||
package body world is | |||
@@ -10,6 +10,8 @@ package body world is | |||
view_reach : constant integer := 96; | |||
landmark_limit : constant integer := 360; | |||
location_limit : constant integer := 60; | |||
construction_limit : constant natural := 120; | |||
equipment_limit : constant natural := 600; | |||
unit_limit : constant natural := 600; | |||
@@ -46,10 +48,15 @@ package body world is | |||
corner_lower_right := core.import_sprite (core.folder & "/game/world/frame/corner_lower_right.png", 1, 1); | |||
-- | |||
for index in landmark_index loop | |||
declare file : constant string := core.lowercase (index'image); | |||
begin | |||
landmarks (index) := core.import_sprite (core.folder & "/game/world/landmark/" & file & ".png", trait (index).frames, 1); | |||
end; | |||
landmarks (index) := core.import_sprite (file_path => core.folder & "/game/world/landmark/" & core.lowercase (index'image) & ".png", | |||
frames => landmark_trait (index).frames, | |||
states => 1); | |||
end loop; | |||
-- | |||
for index in location_index loop | |||
locations (index) := core.import_sprite (file_path => core.folder & "/game/world/location/" & core.lowercase (index'image) & ".png", | |||
frames => location_trait (index).frames, | |||
states => location_trait (index).states); | |||
end loop; | |||
end configure; | |||
@@ -74,6 +81,7 @@ package body world is | |||
map.clips := new boolean_matrix (0 .. map.width - 1, 0 .. map.height - 1); | |||
map.views := new boolean_matrix (0 .. map.width - 1, 0 .. map.height - 1); | |||
map.landmarks := new entity_array (1 .. landmark_limit); | |||
map.locations := new entity_array (1 .. location_limit); | |||
map.constructions := new entity_array (1 .. construction_limit); | |||
map.equipments := new entity_array (1 .. equipment_limit); | |||
map.units := new entity_array (1 .. unit_limit); | |||
@@ -108,7 +116,7 @@ package body world is | |||
map.landmarks (index).x := core.random (6, map.width - 6); | |||
map.landmarks (index).y := core.random (6, map.height - 6); | |||
-- | |||
if trait (landmark_index'val (map.landmarks (index).index)).clip then | |||
if landmark_trait (landmark_index'val (map.landmarks (index).index)).clip then | |||
declare reach_x : constant natural := landmarks (landmark_index'val (map.landmarks (index).index)).width / core.base; | |||
reach_y : constant natural := landmarks (landmark_index'val (map.landmarks (index).index)).height / core.base; | |||
begin | |||
@@ -121,6 +129,24 @@ package body world is | |||
end if; | |||
end loop; | |||
-- | |||
for index in 1 .. location_limit loop | |||
map.locations (index).index := core.random (0, location_count - 1); | |||
map.locations (index).x := core.random (6, map.width - 6); | |||
map.locations (index).y := core.random (6, map.height - 6); | |||
-- | |||
if location_trait (location_index'val (map.locations (index).index)).clip then | |||
declare reach_x : constant natural := locations (location_index'val (map.locations (index).index)).width / core.base; | |||
reach_y : constant natural := locations (location_index'val (map.locations (index).index)).height / core.base; | |||
begin | |||
for x in 0 .. reach_x - 1 loop | |||
for y in 0 .. reach_y - 1 loop | |||
map.clips (map.locations (index).x + x, map.locations (index).y + y) := true; | |||
end loop; | |||
end loop; | |||
end; | |||
end if; | |||
end loop; | |||
-- | |||
for index in 1 .. construction_limit loop | |||
map.constructions (index).index := core.random (0, construction.count - 1); | |||
map.constructions (index).x := core.random (6, map.width - 6); | |||
@@ -238,7 +264,23 @@ package body world is | |||
height => landmarks (landmark_index'val (map.landmarks (index).index)).height) | |||
and core.cursor_mode = 2 | |||
and not ui.prioritize then | |||
core.write_text_box (trait (landmark_index'val (map.landmarks (index).index)).name); | |||
core.write_text_box (landmark_trait (landmark_index'val (map.landmarks (index).index)).name); | |||
end if; | |||
end if; | |||
end loop; | |||
-- | |||
for index in 1 .. location_limit loop | |||
if map.views (map.locations (index).x, map.locations (index).y) then | |||
core.draw (data => locations (location_index'val (map.locations (index).index)), | |||
x => offset.x + (map.locations (index).x - core.camera.x) * core.base * core.zoom, | |||
y => offset.y + (map.locations (index).y - core.camera.y) * core.base * core.zoom); | |||
if core.cursor_inside (x => offset.x + (map.locations (index).x - core.camera.x) * core.base * core.zoom, | |||
y => offset.y + (map.locations (index).y - core.camera.y) * core.base * core.zoom, | |||
width => locations (location_index'val (map.locations (index).index)).width, | |||
height => locations (location_index'val (map.locations (index).index)).height) | |||
and core.cursor_mode = 2 | |||
and not ui.prioritize then | |||
core.write_text_box (location_trait (location_index'val (map.locations (index).index)).name); | |||
end if; | |||
end if; | |||
end loop; | |||
@@ -319,6 +361,16 @@ package body world is | |||
height => landmarks (landmark_index'val (map.landmarks (index).index)).height); | |||
end loop; | |||
-- | |||
for index in 1 .. location_limit loop | |||
core.render_image (data => locations (location_index'val (map.locations (index).index)), | |||
x => map.locations (index).x * core.base, | |||
y => map.locations (index).y * core.base, | |||
u => 0, | |||
v => 0, | |||
width => locations (location_index'val (map.locations (index).index)).width, | |||
height => locations (location_index'val (map.locations (index).index)).height); | |||
end loop; | |||
-- | |||
for index in 1 .. construction_limit loop | |||
core.render_image (data => construction.sprite (construction.enumeration'val (map.constructions (index).index)), | |||
x => map.constructions (index).x * core.base, | |||
@@ -2,7 +2,7 @@ | |||
-- | |||
-- GNU General Public Licence (version 3 or later) | |||
with core, equipment, unit, construction, chad; | |||
with core, equipment, unit, construction, chad, effect; | |||
package world is | |||
@@ -12,8 +12,6 @@ package world 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, | |||
@@ -21,13 +19,27 @@ package world is | |||
asters, daffodils, royal_grave, grave, humble_grave, wooden_wide_sign | |||
); | |||
type landmark_trait is record | |||
type location_index is ( | |||
well_of_agility, well_of_knowledge, well_of_strength | |||
); | |||
------------------------------------------------------------------------------------------ | |||
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; | |||
x, y : integer; | |||
@@ -47,6 +59,7 @@ package world is | |||
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; | |||
@@ -59,11 +72,12 @@ package world is | |||
biome_count : constant natural := biome'pos (biome'last) + 1; | |||
landmarks : array (landmark_index) of core.sprite; | |||
locations : array (location_index) of core.sprite; | |||
landmark_limit : constant integer := 360; | |||
landmark_count : constant natural := landmark_index'pos (landmark_index'last) + 1; | |||
location_count : constant natural := location_index'pos (location_index'last) + 1; | |||
trait : constant array (landmark_index) of landmark_trait := ( | |||
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), | |||
@@ -90,6 +104,12 @@ package world is | |||
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, 1, effect.none), | |||
well_of_knowledge => ("Well of Knowledge ", true, 4, 1, effect.none), | |||
well_of_strength => ("Well of Strength ", true, 4, 1, effect.none) | |||
); | |||
map : information; | |||
------------------------------------------------------------------------------------------ | |||