Refactored locations and removed transitional state...
Before Width: | Height: | Size: 711 B After Width: | Height: | Size: 674 B |
Before Width: | Height: | Size: 779 B After Width: | Height: | Size: 740 B |
Before Width: | Height: | Size: 662 B After Width: | Height: | Size: 627 B |
Before Width: | Height: | Size: 397 B After Width: | Height: | Size: 390 B |
Before Width: | Height: | Size: 706 B After Width: | Height: | Size: 668 B |
Before Width: | Height: | Size: 384 B After Width: | Height: | Size: 381 B |
Before Width: | Height: | Size: 690 B After Width: | Height: | Size: 654 B |
Before Width: | Height: | Size: 704 B After Width: | Height: | Size: 668 B |
Before Width: | Height: | Size: 700 B After Width: | Height: | Size: 665 B |
Before Width: | Height: | Size: 662 B After Width: | Height: | Size: 627 B |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 1.5 KiB |
@ -24,6 +24,15 @@ package location is
|
||||
evoke : effect.information;
|
||||
end record;
|
||||
|
||||
type information is record
|
||||
index : enumeration;
|
||||
used : boolean;
|
||||
x : integer;
|
||||
y : integer;
|
||||
end record;
|
||||
|
||||
type informations is array (natural range <>) of information;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
count : constant natural := enumeration'pos (enumeration'last) + 1;
|
||||
|
@ -109,7 +109,7 @@ package body world is
|
||||
for index in location.enumeration loop
|
||||
location.game (index) := core.import_sprite (file_path => core.folder & "/game/world/location/" & core.lowercase (index'image) & ".png",
|
||||
frames => location.description (index).frames,
|
||||
states => location.description (index).states);
|
||||
states => 2);
|
||||
end loop;
|
||||
end configure;
|
||||
|
||||
@ -141,7 +141,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 landmark.informations (1 .. landmark_limit);
|
||||
map.locations := new entity_array (1 .. location_limit);
|
||||
map.locations := new location.informations (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);
|
||||
@ -195,8 +195,8 @@ package body world is
|
||||
end loop;
|
||||
--
|
||||
for index in 1 .. location_limit loop
|
||||
map.locations (index).index := core.random (0, location.count - 1);
|
||||
map.locations (index).state := 0;
|
||||
map.locations (index).index := location.enumeration'val (core.random (0, location.count - 1));
|
||||
map.locations (index).used := false;
|
||||
<<repeat_location_generation>>
|
||||
map.locations (index).x := core.random (6, map.width - 6);
|
||||
map.locations (index).y := core.random (6, map.height - 6);
|
||||
@ -205,9 +205,9 @@ package body world is
|
||||
goto repeat_location_generation;
|
||||
end if;
|
||||
--
|
||||
if location.description (location.enumeration'val (map.locations (index).index)).clip then
|
||||
declare reach_x : constant natural := location.game (location.enumeration'val (map.locations (index).index)).width / core.base;
|
||||
reach_y : constant natural := location.game (location.enumeration'val (map.locations (index).index)).height / core.base;
|
||||
if location.description (map.locations (index).index).clip then
|
||||
declare reach_x : constant natural := location.game (map.locations (index).index).width / core.base;
|
||||
reach_y : constant natural := location.game (map.locations (index).index).height / core.base;
|
||||
begin
|
||||
for x in 0 .. reach_x - 1 loop
|
||||
for y in 0 .. reach_y - 1 loop
|
||||
@ -298,10 +298,15 @@ package body world is
|
||||
end loop;
|
||||
end loop;
|
||||
--
|
||||
for index in 1 .. landmark_limit loop core.io.write (file, landmark.enumeration'pos (map.landmarks (index).index)); end loop;
|
||||
for index in 1 .. landmark_limit loop core.io.write (file, landmark.enumeration'pos (map.landmarks (index).index)); end loop;
|
||||
for index in 1 .. location_limit loop core.io.write (file, location.enumeration'pos (map.locations (index).index)); end loop;
|
||||
--
|
||||
for index in 1 .. location_limit loop core.io.write (file, boolean'pos (map.locations (index).used)); end loop;
|
||||
--
|
||||
for index in 1 .. landmark_limit loop core.io.write (file, map.landmarks (index).x); end loop;
|
||||
for index in 1 .. landmark_limit loop core.io.write (file, map.landmarks (index).y); end loop;
|
||||
for index in 1 .. location_limit loop save_entity (file, map.locations (index)); end loop;
|
||||
for index in 1 .. location_limit loop core.io.write (file, map.locations (index).x); end loop;
|
||||
for index in 1 .. location_limit loop core.io.write (file, map.locations (index).y); end loop;
|
||||
for index in 1 .. construction_limit loop save_entity (file, map.constructions (index)); end loop;
|
||||
for index in 1 .. equipment_limit loop save_entity (file, map.equipments (index)); end loop;
|
||||
for index in 1 .. unit_limit loop save_entity (file, map.units (index)); end loop;
|
||||
@ -377,9 +382,15 @@ package body world is
|
||||
end loop;
|
||||
--
|
||||
for index in 1 .. landmark_limit loop core.io.read (file, this); map.landmarks (index).index := landmark.enumeration'val (this); end loop;
|
||||
for index in 1 .. location_limit loop core.io.read (file, this); map.locations (index).index := location.enumeration'val (this); end loop;
|
||||
--
|
||||
for index in 1 .. location_limit loop core.io.read (file, this); map.locations (index).used := boolean'val (this); end loop;
|
||||
--
|
||||
for index in 1 .. landmark_limit loop core.io.read (file, map.landmarks (index).x); end loop;
|
||||
for index in 1 .. landmark_limit loop core.io.read (file, map.landmarks (index).y); end loop;
|
||||
for index in 1 .. location_limit loop load_entity (file, map.locations (index)); end loop;
|
||||
for index in 1 .. location_limit loop core.io.read (file, map.locations (index).x); end loop;
|
||||
for index in 1 .. location_limit loop core.io.read (file, map.locations (index).y); end loop;
|
||||
--
|
||||
for index in 1 .. construction_limit loop load_entity (file, map.constructions (index)); end loop;
|
||||
for index in 1 .. equipment_limit loop load_entity (file, map.equipments (index)); end loop;
|
||||
for index in 1 .. unit_limit loop load_entity (file, map.units (index)); end loop;
|
||||
@ -526,13 +537,13 @@ package body world is
|
||||
end loop;
|
||||
--
|
||||
for index in 1 .. location_limit loop
|
||||
core.render_image (data => location.game (location.enumeration'val (map.locations (index).index)),
|
||||
core.render_image (data => location.game (map.locations (index).index),
|
||||
x => map.locations (index).x * core.base,
|
||||
y => map.locations (index).y * core.base,
|
||||
u => 0,
|
||||
v => 0,
|
||||
width => location.game (location.enumeration'val (map.locations (index).index)).width,
|
||||
height => location.game (location.enumeration'val (map.locations (index).index)).height);
|
||||
width => location.game (map.locations (index).index).width,
|
||||
height => location.game (map.locations (index).index).height);
|
||||
end loop;
|
||||
--
|
||||
for index in 1 .. construction_limit loop
|
||||
@ -880,37 +891,33 @@ package body world is
|
||||
if map.views (map.locations (index).x, map.locations (index).y)
|
||||
and map.locations (index).x > view_from.x and map.locations (index).x < view_from.x + view_to.x
|
||||
and map.locations (index).y > view_from.y and map.locations (index).y < view_from.y + view_to.y then
|
||||
core.draw (data => location.game (location.enumeration'val (map.locations (index).index)),
|
||||
core.draw (data => location.game (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,
|
||||
state => core.animation'val (map.locations (index).state));
|
||||
state => core.animation'val (boolean'pos (map.locations (index).used)));
|
||||
--
|
||||
core.increment (drawn_locations);
|
||||
--
|
||||
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 => location.game (location.enumeration'val (map.locations (index).index)).width,
|
||||
height => location.game (location.enumeration'val (map.locations (index).index)).height)
|
||||
width => location.game (map.locations (index).index).width,
|
||||
height => location.game (map.locations (index).index).height)
|
||||
and core.cursor_mode = core.cursor_middle
|
||||
and not ui.prioritize then
|
||||
core.write_text_box (location.description (location.enumeration'val (map.locations (index).index)).name.all);
|
||||
core.write_text_box (location.description (map.locations (index).index).name.all);
|
||||
end if;
|
||||
end if;
|
||||
--
|
||||
if map.locations (index).state = 1 and core.animation_time = 0 then
|
||||
map.locations (index).state := 2;
|
||||
end if;
|
||||
--
|
||||
if core.camera.x > map.locations (index).x - 2
|
||||
and core.camera.x < map.locations (index).x + 1 + location.game (location.enumeration'val (map.locations (index).index)).width / core.base
|
||||
and core.camera.x < map.locations (index).x + 1 + location.game (map.locations (index).index).width / core.base
|
||||
and core.camera.y > map.locations (index).y - 2
|
||||
and core.camera.y < map.locations (index).y + 1 + location.game (location.enumeration'val (map.locations (index).index)).height / core.base
|
||||
and map.locations (index).state = 0
|
||||
and core.camera.y < map.locations (index).y + 1 + location.game (map.locations (index).index).height / core.base
|
||||
and map.locations (index).used = false
|
||||
and core.signal_code'pos (core.signal_mode) = core.signal_code'pos (core.signal_e)
|
||||
and not ui.prioritize then
|
||||
declare player : chad.information renames world.map.chads (1);
|
||||
--
|
||||
data : effect.information := location.description (location.enumeration'val (map.locations (index).index)).evoke;
|
||||
data : effect.information := location.description (map.locations (index).index).evoke;
|
||||
--
|
||||
attribute_index : attribute.enumeration;
|
||||
skill_index : skill.enumeration;
|
||||
@ -942,7 +949,7 @@ package body world is
|
||||
end case;
|
||||
end;
|
||||
--
|
||||
map.locations (index).state := 1;
|
||||
map.locations (index).used := true;
|
||||
end if;
|
||||
end loop;
|
||||
--
|
||||
|
@ -32,7 +32,7 @@ package world is
|
||||
clips : access boolean_matrix;
|
||||
views : access boolean_matrix;
|
||||
landmarks : access landmark.informations;
|
||||
locations : access entity_array;
|
||||
locations : access location.informations;
|
||||
constructions : access entity_array;
|
||||
equipments : access entity_array;
|
||||
units : access entity_array;
|
||||
|