Refactored player renaming...
This commit is contained in:
parent
2228636d65
commit
d9fe7fa0b6
108
source/world.adb
108
source/world.adb
@ -903,42 +903,46 @@ package body world is
|
|||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure restore_points is
|
procedure restore_points is
|
||||||
|
player : chad.information renames map.chads (1);
|
||||||
begin
|
begin
|
||||||
map.chads (1).health.value := map.chads (1).health.limit;
|
player.health.value := player.health.limit;
|
||||||
map.chads (1).mana.value := map.chads (1).mana.limit;
|
player.mana.value := player.mana.limit;
|
||||||
map.chads (1).stamina.value := map.chads (1).stamina.limit;
|
player.stamina.value := player.stamina.limit;
|
||||||
end restore_points;
|
end restore_points;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure increase_attributes is
|
procedure increase_attributes is
|
||||||
|
player : chad.information renames map.chads (1);
|
||||||
begin
|
begin
|
||||||
for index in attribute.enumeration loop
|
for index in attribute.enumeration loop
|
||||||
map.chads (1).attributes (index) := map.chads (1).attributes (index) + 1;
|
player.attributes (index) := player.attributes (index) + 1;
|
||||||
end loop;
|
end loop;
|
||||||
end increase_attributes;
|
end increase_attributes;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure increase_resources is
|
procedure increase_resources is
|
||||||
|
player : chad.information renames map.chads (1);
|
||||||
begin
|
begin
|
||||||
for index in resource.enumeration loop
|
for index in resource.enumeration loop
|
||||||
map.chads (1).resources (index) := map.chads (1).resources (index) + 10;
|
player.resources (index) := player.resources (index) + 10;
|
||||||
end loop;
|
end loop;
|
||||||
end increase_resources;
|
end increase_resources;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure player_up is
|
procedure player_up is
|
||||||
|
player : chad.information renames map.chads (1);
|
||||||
begin
|
begin
|
||||||
if map.chads (1).stamina.value = 0 then return; end if;
|
if player.stamina.value = 0 then return; end if;
|
||||||
core.decrement (map.chads (1).y);
|
core.decrement (player.y);
|
||||||
core.clip (map.chads (1).y, 0, map.height - 1);
|
core.clip (player.y, 0, map.height - 1);
|
||||||
map.chads (1).stamina := map.chads (1).stamina - 1;
|
player.stamina := player.stamina - 1;
|
||||||
if map.clips (map.chads (1).x, map.chads (1).y) then
|
if map.clips (player.x, player.y) then
|
||||||
core.increment (map.chads (1).y);
|
core.increment (player.y);
|
||||||
if map.chads (1).stamina.value > 0 then
|
if player.stamina.value > 0 then
|
||||||
map.chads (1).stamina := map.chads (1).stamina + 1;
|
player.stamina := player.stamina + 1;
|
||||||
end if;
|
end if;
|
||||||
end if;
|
end if;
|
||||||
end player_up;
|
end player_up;
|
||||||
@ -946,15 +950,16 @@ package body world is
|
|||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure player_down is
|
procedure player_down is
|
||||||
|
player : chad.information renames map.chads (1);
|
||||||
begin
|
begin
|
||||||
if map.chads (1).stamina.value = 0 then return; end if;
|
if player.stamina.value = 0 then return; end if;
|
||||||
core.increment (map.chads (1).y);
|
core.increment (player.y);
|
||||||
core.clip (map.chads (1).y, 0, map.height - 1);
|
core.clip (player.y, 0, map.height - 1);
|
||||||
map.chads (1).stamina := map.chads (1).stamina - 1;
|
player.stamina := player.stamina - 1;
|
||||||
if map.clips (map.chads (1).x, map.chads (1).y) then
|
if map.clips (player.x, player.y) then
|
||||||
core.decrement (map.chads (1).y);
|
core.decrement (player.y);
|
||||||
if map.chads (1).stamina.value > 0 then
|
if player.stamina.value > 0 then
|
||||||
map.chads (1).stamina := map.chads (1).stamina + 1;
|
player.stamina := player.stamina + 1;
|
||||||
end if;
|
end if;
|
||||||
end if;
|
end if;
|
||||||
end player_down;
|
end player_down;
|
||||||
@ -962,15 +967,16 @@ package body world is
|
|||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure player_left is
|
procedure player_left is
|
||||||
|
player : chad.information renames map.chads (1);
|
||||||
begin
|
begin
|
||||||
if map.chads (1).stamina.value = 0 then return; end if;
|
if player.stamina.value = 0 then return; end if;
|
||||||
core.decrement (map.chads (1).x);
|
core.decrement (player.x);
|
||||||
core.clip (map.chads (1).x, 0, map.width - 1);
|
core.clip (player.x, 0, map.width - 1);
|
||||||
map.chads (1).stamina := map.chads (1).stamina - 1;
|
player.stamina := player.stamina - 1;
|
||||||
if map.clips (map.chads (1).x, map.chads (1).y) then
|
if map.clips (player.x, player.y) then
|
||||||
core.increment (map.chads (1).x);
|
core.increment (player.x);
|
||||||
if map.chads (1).stamina.value > 0 then
|
if player.stamina.value > 0 then
|
||||||
map.chads (1).stamina := map.chads (1).stamina + 1;
|
player.stamina := player.stamina + 1;
|
||||||
end if;
|
end if;
|
||||||
end if;
|
end if;
|
||||||
end player_left;
|
end player_left;
|
||||||
@ -978,15 +984,16 @@ package body world is
|
|||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure player_right is
|
procedure player_right is
|
||||||
|
player : chad.information renames map.chads (1);
|
||||||
begin
|
begin
|
||||||
if map.chads (1).stamina.value = 0 then return; end if;
|
if player.stamina.value = 0 then return; end if;
|
||||||
core.increment (map.chads (1).x);
|
core.increment (player.x);
|
||||||
core.clip (map.chads (1).x, 0, map.width - 1);
|
core.clip (player.x, 0, map.width - 1);
|
||||||
map.chads (1).stamina := map.chads (1).stamina - 1;
|
player.stamina := player.stamina - 1;
|
||||||
if map.clips (map.chads (1).x, map.chads (1).y) then
|
if map.clips (player.x, player.y) then
|
||||||
core.decrement (map.chads (1).x);
|
core.decrement (player.x);
|
||||||
if map.chads (1).stamina.value > 0 then
|
if player.stamina.value > 0 then
|
||||||
map.chads (1).stamina := map.chads (1).stamina + 1;
|
player.stamina := player.stamina + 1;
|
||||||
end if;
|
end if;
|
||||||
end if;
|
end if;
|
||||||
end player_right;
|
end player_right;
|
||||||
@ -1011,6 +1018,8 @@ package body world is
|
|||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure draw_tiles (offset, view_from, view_to : in core.vector) is
|
procedure draw_tiles (offset, view_from, view_to : in core.vector) is
|
||||||
|
player : chad.information renames map.chads (1);
|
||||||
|
--
|
||||||
step : core.vector := core.camera;
|
step : core.vector := core.camera;
|
||||||
size : constant integer := core.base * core.zoom;
|
size : constant integer := core.base * core.zoom;
|
||||||
hits : natural := 0;
|
hits : natural := 0;
|
||||||
@ -1052,8 +1061,8 @@ package body world is
|
|||||||
height => size)
|
height => size)
|
||||||
and core.cursor_mode = core.cursor_left
|
and core.cursor_mode = core.cursor_left
|
||||||
and not ui.prioritize then
|
and not ui.prioritize then
|
||||||
world.map.chads (1).x := horizontal + 1;
|
player.x := horizontal + 1;
|
||||||
world.map.chads (1).y := vertical;
|
player.y := vertical;
|
||||||
end if;
|
end if;
|
||||||
end if;
|
end if;
|
||||||
end loop;
|
end loop;
|
||||||
@ -1109,6 +1118,7 @@ package body world is
|
|||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure compute_world_visibility_grid (offset : in core.vector) is
|
procedure compute_world_visibility_grid (offset : in core.vector) is
|
||||||
|
player : chad.information renames map.chads (1);
|
||||||
begin
|
begin
|
||||||
for vertical in 0 .. map.height - 1 loop
|
for vertical in 0 .. map.height - 1 loop
|
||||||
exit when offset.y + (vertical - core.camera.y) * core.base * core.zoom > core.window_height;
|
exit when offset.y + (vertical - core.camera.y) * core.base * core.zoom > core.window_height;
|
||||||
@ -1116,7 +1126,7 @@ package body world is
|
|||||||
for horizontal in 0 .. map.width - 1 loop
|
for horizontal in 0 .. map.width - 1 loop
|
||||||
exit when offset.x + (horizontal - core.camera.x) * core.base * core.zoom > core.window_width;
|
exit when offset.x + (horizontal - core.camera.x) * core.base * core.zoom > core.window_width;
|
||||||
--
|
--
|
||||||
if not ((horizontal - core.camera.x) ** 2 + (vertical - core.camera.y) ** 2 > map.chads (1).attributes (attribute.reach).value * 64) then
|
if not ((horizontal - core.camera.x) ** 2 + (vertical - core.camera.y) ** 2 > player.attributes (attribute.reach).value * 64) then
|
||||||
map.views (horizontal, vertical) := true;
|
map.views (horizontal, vertical) := true;
|
||||||
end if;
|
end if;
|
||||||
end loop;
|
end loop;
|
||||||
@ -1258,6 +1268,7 @@ package body world is
|
|||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure draw_locations (offset, view_from, view_to : in core.vector) is
|
procedure draw_locations (offset, view_from, view_to : in core.vector) is
|
||||||
|
player : chad.information renames map.chads (1);
|
||||||
begin
|
begin
|
||||||
for index in 1 .. map.location_count.limit loop
|
for index in 1 .. map.location_count.limit loop
|
||||||
if map.views (map.locations (index).x, map.locations (index).y)
|
if map.views (map.locations (index).x, map.locations (index).y)
|
||||||
@ -1276,9 +1287,7 @@ package body world is
|
|||||||
and map.locations (index).used = false
|
and map.locations (index).used = false
|
||||||
and core.signal_mode = core.signal_e
|
and core.signal_mode = core.signal_e
|
||||||
and not ui.prioritize then
|
and not ui.prioritize then
|
||||||
declare player : chad.information renames world.map.chads (1);
|
declare data : effect.information := location.description (map.locations (index).index).evoke;
|
||||||
--
|
|
||||||
data : effect.information := location.description (map.locations (index).index).evoke;
|
|
||||||
done : boolean := false;
|
done : boolean := false;
|
||||||
--
|
--
|
||||||
attribute_index : attribute.enumeration;
|
attribute_index : attribute.enumeration;
|
||||||
@ -1354,6 +1363,8 @@ package body world is
|
|||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure draw_equipments (offset, view_from, view_to : in core.vector) is
|
procedure draw_equipments (offset, view_from, view_to : in core.vector) is
|
||||||
|
player : chad.information renames map.chads (1);
|
||||||
|
--
|
||||||
swap : equipment.enumeration;
|
swap : equipment.enumeration;
|
||||||
begin
|
begin
|
||||||
for index in 1 .. map.equipment_count.limit loop
|
for index in 1 .. map.equipment_count.limit loop
|
||||||
@ -1367,12 +1378,12 @@ package body world is
|
|||||||
--
|
--
|
||||||
if map.equipments (index).x = core.camera.x and map.equipments (index).y = core.camera.y then
|
if map.equipments (index).x = core.camera.x and map.equipments (index).y = core.camera.y then
|
||||||
if core.signal_mode = core.signal_e and equipment_valid (map.equipments (index).index) then
|
if core.signal_mode = core.signal_e and equipment_valid (map.equipments (index).index) then
|
||||||
if equipment_valid (map.chads (1).equipments (equipment.description (map.equipments (index).index).slot)) then
|
if equipment_valid (player.equipments (equipment.description (map.equipments (index).index).slot)) then
|
||||||
swap := map.chads (1).equipments (equipment.description (map.equipments (index).index).slot);
|
swap := player.equipments (equipment.description (map.equipments (index).index).slot);
|
||||||
map.chads (1).equipments (equipment.description (map.equipments (index).index).slot) := map.equipments (index).index;
|
player.equipments (equipment.description (map.equipments (index).index).slot) := map.equipments (index).index;
|
||||||
map.equipments (index).index := swap;
|
map.equipments (index).index := swap;
|
||||||
else
|
else
|
||||||
map.chads (1).equipments (equipment.description (map.equipments (index).index).slot) := map.equipments (index).index;
|
player.equipments (equipment.description (map.equipments (index).index).slot) := map.equipments (index).index;
|
||||||
map.equipments (index).index := equipment.none;
|
map.equipments (index).index := equipment.none;
|
||||||
end if;
|
end if;
|
||||||
end if;
|
end if;
|
||||||
@ -1416,6 +1427,7 @@ package body world is
|
|||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure draw_alternative (offset, view_from, view_to : in core.vector) is
|
procedure draw_alternative (offset, view_from, view_to : in core.vector) is
|
||||||
|
player : chad.information renames map.chads (1);
|
||||||
begin
|
begin
|
||||||
for vertical in view_from.y .. view_from.y + view_to.y loop
|
for vertical in view_from.y .. view_from.y + view_to.y loop
|
||||||
exit when vertical > map.height - 1;
|
exit when vertical > map.height - 1;
|
||||||
@ -1423,7 +1435,7 @@ package body world is
|
|||||||
for horizontal in view_from.x .. view_from.x + view_to.x loop
|
for horizontal in view_from.x .. view_from.x + view_to.x loop
|
||||||
exit when horizontal > map.width - 1;
|
exit when horizontal > map.width - 1;
|
||||||
--
|
--
|
||||||
if (horizontal - core.camera.x) ** 2 + (vertical - core.camera.y) ** 2 > map.chads (1).attributes (attribute.reach).value * 32 then
|
if (horizontal - core.camera.x) ** 2 + (vertical - core.camera.y) ** 2 > player.attributes (attribute.reach).value * 32 then
|
||||||
core.draw (data => dark,
|
core.draw (data => dark,
|
||||||
x => offset.x + (horizontal - core.camera.x) * core.base * core.zoom,
|
x => offset.x + (horizontal - core.camera.x) * core.base * core.zoom,
|
||||||
y => offset.y + (vertical - core.camera.y) * core.base * core.zoom);
|
y => offset.y + (vertical - core.camera.y) * core.base * core.zoom);
|
||||||
|
Loading…
Reference in New Issue
Block a user