|
|
@@ -510,19 +510,7 @@ package body world is |
|
|
|
orient := orient + view_chad_equipment (data, x + offset, y + offset + orient.y + 2 * core.base, limit - 2 * offset); |
|
|
|
orient := orient + view_chad_skills (data, x + offset, y + offset + orient.y + 2 * core.base, limit - 2 * offset); |
|
|
|
ui.draw_separator ( x + offset, y + offset + orient.y + 2 * core.base, limit - 2 * offset); |
|
|
|
-- |
|
|
|
--~ui.draw_separator (at_x, at_y, width - 2 * offset); |
|
|
|
--~-- |
|
|
|
--~at_y := at_y + core.base; |
|
|
|
--~-- |
|
|
|
--~for index_y in 0 .. 2 loop |
|
|
|
--~for index_x in 0 .. 7 loop |
|
|
|
--~ui.draw_icon (data => equipment.icon (data.items (8 * index_y + index_x)), |
|
|
|
--~text => equipment.description (data.items (8 * index_y + index_x)).name.all, |
|
|
|
--~x => at_x + index_x * core.icon, |
|
|
|
--~y => at_y + index_y * core.icon); |
|
|
|
--~end loop; |
|
|
|
--~end loop; |
|
|
|
orient := orient + view_chad_inventory (data, x + offset, y + offset + orient.y + 3 * core.base, limit - 2 * offset); |
|
|
|
--~-- |
|
|
|
--~at_y := at_y + 3 * core.icon; |
|
|
|
--~-- |
|
|
@@ -672,23 +660,26 @@ package body world is |
|
|
|
-- |
|
|
|
for index in attribute.enumeration loop core.save_point (file, map.chads (chad_index).attributes (index)); end loop; |
|
|
|
for index in resource.enumeration loop core.save_point (file, map.chads (chad_index).resources (index)); end loop; |
|
|
|
for index in material.enumeration loop core.save_point (file, map.chads (chad_index).materials (index)); end loop; |
|
|
|
-- |
|
|
|
for index in skill.limit loop core.io.write (file, skill.enumeration'pos (map.chads (chad_index).skills (index).index)); end loop; |
|
|
|
for index in skill.limit loop core.io.write (file, map.chads (chad_index).skills (index).value); end loop; |
|
|
|
for index in skill.limit loop core.io.write (file, map.chads (chad_index).skills (index).limit); end loop; |
|
|
|
-- |
|
|
|
for index in material.limit loop core.io.write (file, material.enumeration'pos (map.chads (chad_index).materials (index).index)); end loop; |
|
|
|
for index in material.limit loop core.io.write (file, map.chads (chad_index).materials (index).value); end loop; |
|
|
|
for index in material.limit loop core.io.write (file, map.chads (chad_index).materials (index).limit); end loop; |
|
|
|
-- |
|
|
|
for kind in equipment.kind loop |
|
|
|
core.io.write (file, equipment.enumeration'pos (map.chads (chad_index).equipments (kind))); |
|
|
|
end loop; |
|
|
|
-- |
|
|
|
core.io.write (file, map.chads (chad_index).item_count); |
|
|
|
-- |
|
|
|
if map.chads (chad_index).item_count > 0 then |
|
|
|
for index in 0 .. map.chads (chad_index).item_count - 1 loop |
|
|
|
core.io.write (file, equipment.enumeration'pos (map.chads (chad_index).items (index))); |
|
|
|
end loop; |
|
|
|
end if; |
|
|
|
--~core.io.write (file, map.chads (chad_index).item_count); |
|
|
|
--~-- |
|
|
|
--~if map.chads (chad_index).item_count > 0 then |
|
|
|
--~for index in 0 .. map.chads (chad_index).item_count - 1 loop |
|
|
|
--~core.io.write (file, equipment.enumeration'pos (map.chads (chad_index).items (index))); |
|
|
|
--~end loop; |
|
|
|
--~end if; |
|
|
|
end loop; |
|
|
|
-- |
|
|
|
core.io.close (file); |
|
|
@@ -764,23 +755,26 @@ package body world is |
|
|
|
-- |
|
|
|
for index in attribute.enumeration loop core.load_point (file, map.chads (chad_index).attributes (index)); end loop; |
|
|
|
for index in resource.enumeration loop core.load_point (file, map.chads (chad_index).resources (index)); end loop; |
|
|
|
for index in material.enumeration loop core.load_point (file, map.chads (chad_index).materials (index)); end loop; |
|
|
|
-- |
|
|
|
for index in skill.limit loop core.io.read (file, this); map.chads (chad_index).skills (index).index := skill.enumeration'val (this); end loop; |
|
|
|
for index in skill.limit loop core.io.read (file, map.chads (chad_index).skills (index).value); end loop; |
|
|
|
for index in skill.limit loop core.io.read (file, map.chads (chad_index).skills (index).limit); end loop; |
|
|
|
-- |
|
|
|
for index in material.limit loop core.io.read (file, this); map.chads (chad_index).materials (index).index := material.enumeration'val (this); end loop; |
|
|
|
for index in material.limit loop core.io.read (file, map.chads (chad_index).materials (index).value); end loop; |
|
|
|
for index in material.limit loop core.io.read (file, map.chads (chad_index).materials (index).limit); end loop; |
|
|
|
-- |
|
|
|
for kind in equipment.kind loop |
|
|
|
core.io.read (file, this); map.chads (chad_index).equipments (kind) := equipment.enumeration'val (this); |
|
|
|
end loop; |
|
|
|
-- |
|
|
|
core.io.read (file, map.chads (chad_index).item_count); |
|
|
|
-- |
|
|
|
if map.chads (chad_index).item_count > 0 then |
|
|
|
for index in 0 .. map.chads (chad_index).item_count - 1 loop |
|
|
|
core.io.read (file, this); map.chads (chad_index).items (index) := equipment.enumeration'val (this); |
|
|
|
end loop; |
|
|
|
end if; |
|
|
|
--~core.io.read (file, map.chads (chad_index).item_count); |
|
|
|
--~-- |
|
|
|
--~if map.chads (chad_index).item_count > 0 then |
|
|
|
--~for index in 0 .. map.chads (chad_index).item_count - 1 loop |
|
|
|
--~core.io.read (file, this); map.chads (chad_index).items (index) := equipment.enumeration'val (this); |
|
|
|
--~end loop; |
|
|
|
--~end if; |
|
|
|
end loop; |
|
|
|
-- |
|
|
|
core.io.close (file); |
|
|
@@ -1235,7 +1229,16 @@ package body world is |
|
|
|
|
|
|
|
function view_chad_inventory (data : in chad.information; x, y, limit : in integer) return core.vector is |
|
|
|
begin |
|
|
|
return (0, 0); |
|
|
|
for index_y in 0 .. 3 loop |
|
|
|
for index_x in 0 .. 7 loop |
|
|
|
ui.draw_icon (data => material.icon (data.materials (8 * index_y + index_x).index), |
|
|
|
text => material.description (data.materials (8 * index_y + index_x).index).name.all, |
|
|
|
x => x + index_x * core.icon, |
|
|
|
y => y + index_y * core.icon); |
|
|
|
end loop; |
|
|
|
end loop; |
|
|
|
-- |
|
|
|
return (limit, 4 * core.icon); |
|
|
|
end view_chad_inventory; |
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------ |
|
|
@@ -1282,7 +1285,7 @@ package body world is |
|
|
|
attribute_index : attribute.enumeration; |
|
|
|
--~skill_index : skill.enumeration; |
|
|
|
resource_index : resource.enumeration; |
|
|
|
material_index : material.enumeration; |
|
|
|
--~material_index : material.enumeration; |
|
|
|
begin |
|
|
|
case data.kind is |
|
|
|
when effect.idle => null; |
|
|
@@ -1292,7 +1295,6 @@ package body world is |
|
|
|
ui.echo ("Player " & (if data.amount < 0 then "lost" else "gained") & integer'image (abs data.amount) & " " |
|
|
|
& attribute.description (attribute_index).name.all & " attribute points."); |
|
|
|
-- |
|
|
|
when effect.modify_skill => null; |
|
|
|
--~when effect.modify_skill => skill_index := skill.enumeration'val (data.modifier); |
|
|
|
--~player.skills (skill_index) := player.skills (skill_index) + data.amount; |
|
|
|
--~ui.echo ("Player " & (if data.amount < 0 then "lost" else "gained") & integer'image (abs data.amount) & " " |
|
|
@@ -1303,9 +1305,10 @@ package body world is |
|
|
|
ui.echo ("Player " & (if data.amount < 0 then "lost" else "gained") & integer'image (abs data.amount) & " " |
|
|
|
& resource.description (resource_index).name.all & " resource points."); |
|
|
|
-- |
|
|
|
when effect.modify_material => material_index := material.enumeration'val (data.modifier); |
|
|
|
player.materials (material_index) := player.materials (material_index) + data.amount; |
|
|
|
ui.echo ("+" & data.amount'image & " " & material.description (material_index).name.all); |
|
|
|
--~when effect.modify_material => material_index := material.enumeration'val (data.modifier); |
|
|
|
--~player.materials (material_index) := player.materials (material_index) + data.amount; |
|
|
|
--~ui.echo ("+" & data.amount'image & " " & material.description (material_index).name.all); |
|
|
|
when others => null; |
|
|
|
end case; |
|
|
|
end; |
|
|
|
-- |
|
|
@@ -1344,15 +1347,15 @@ package body world is |
|
|
|
y => offset.y + (map.equipments (index).y - core.camera.y) * core.base * core.zoom, |
|
|
|
factor => core.zoom); |
|
|
|
-- |
|
|
|
if map.equipments (index).x = core.camera.x and map.equipments (index).y = core.camera.y then |
|
|
|
if map.chads (1).item_count < chad.item_limit and equipment_valid (map.equipments (index).index) then |
|
|
|
map.chads (1).items (map.chads (1).item_count) := map.equipments (index).index; |
|
|
|
-- |
|
|
|
core.increment (map.chads (1).item_count); |
|
|
|
-- |
|
|
|
map.equipments (index).index := equipment.none; |
|
|
|
end if; |
|
|
|
end if; |
|
|
|
--~if map.equipments (index).x = core.camera.x and map.equipments (index).y = core.camera.y then |
|
|
|
--~if map.chads (1).item_count < chad.item_limit and equipment_valid (map.equipments (index).index) then |
|
|
|
--~map.chads (1).items (map.chads (1).item_count) := map.equipments (index).index; |
|
|
|
--~-- |
|
|
|
--~core.increment (map.chads (1).item_count); |
|
|
|
--~-- |
|
|
|
--~map.equipments (index).index := equipment.none; |
|
|
|
--~end if; |
|
|
|
--~end if; |
|
|
|
end if; |
|
|
|
end loop; |
|
|
|
end draw_equipments; |
|
|
|