Changed materials and inventory...
This commit is contained in:
parent
614c0fdd0b
commit
0fc1c90019
BIN
icon/material/none.png
Normal file
BIN
icon/material/none.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 111 B |
@ -23,11 +23,6 @@ package chad is
|
||||
bonus_resource : resource.enumeration;
|
||||
end record;
|
||||
|
||||
item_limit : constant natural := 24;
|
||||
skill_limit : constant natural := 8;
|
||||
|
||||
type item_array is array (0 .. item_limit - 1) of equipment.enumeration;
|
||||
|
||||
type information is record
|
||||
index : enumeration := ada;
|
||||
state : core.animation := core.idle;
|
||||
@ -40,10 +35,8 @@ package chad is
|
||||
attributes : attribute.points := attribute.default;
|
||||
skills : skill.points := (others => (others => <>));
|
||||
resources : resource.points := resource.default;
|
||||
materials : material.points := material.default;
|
||||
materials : material.points := (others => (others => <>));
|
||||
equipments : equipment.equip_array := equipment.default;
|
||||
item_count : natural := 0;
|
||||
items : item_array := (others => equipment.none);
|
||||
end record;
|
||||
|
||||
type informations is array (natural range <>) of information;
|
||||
|
@ -104,11 +104,12 @@ procedure main is
|
||||
player : chad.information := (
|
||||
skills => ((skill.archery, 1, 3), (skill.athletics, 1, 3), (skill.tactics, 1, 3), others => <>),
|
||||
--
|
||||
equipments => (equipment.chest => equipment.iron_chestplate,
|
||||
equipment.head => equipment.iron_helmet,
|
||||
equipment.hands => equipment.iron_gauntlets,
|
||||
equipment.feet => equipment.iron_greaves,
|
||||
equipment.main_hand => equipment.iron_sword,
|
||||
equipments => (equipment.chest => equipment.crystal_chestplate,
|
||||
equipment.head => equipment.crystal_helmet,
|
||||
equipment.hands => equipment.crystal_gauntlets,
|
||||
equipment.feet => equipment.crystal_greaves,
|
||||
equipment.main_hand => equipment.crystal_greatsword,
|
||||
equipment.full_body => equipment.cyan_robe,
|
||||
others => equipment.none),
|
||||
--
|
||||
others => <>
|
||||
@ -238,7 +239,7 @@ begin
|
||||
world.insert_chad (player);
|
||||
world.insert_chad (opponent);
|
||||
|
||||
world.load ("heyo");
|
||||
--~world.load ("heyo");
|
||||
|
||||
ui.active := ui.style'val (faction.enumeration'pos (chad.description (player.index).kind) + 1);
|
||||
|
||||
@ -295,17 +296,17 @@ begin
|
||||
(preview_width - 5 * core.icon * resource.count) / 2 + (5 * core.icon) * resource.enumeration'pos (index) + core.icon, core.base, 4 * core.icon, core.icon, 10);
|
||||
end loop;
|
||||
--
|
||||
declare move_x : integer := (preview_width - core.icon * material.count) / 2;
|
||||
begin
|
||||
for index in material.enumeration loop
|
||||
if world.map.chads (1).materials (index).value > 0 then
|
||||
ui.draw_icon (material.icon (index), material.description (index).name.all, move_x, core.base + core.icon);
|
||||
ui.draw_text (world.map.chads (1).materials (index).value'image, move_x, core.base + 2 * core.icon, core.icon, core.icon, 10);
|
||||
--
|
||||
move_x := move_x + core.icon;
|
||||
end if;
|
||||
end loop;
|
||||
end;
|
||||
--~declare move_x : integer := (preview_width - core.icon * material.count) / 2;
|
||||
--~begin
|
||||
--~for index in material.enumeration loop
|
||||
--~if world.map.chads (1).materials (index).value > 0 then
|
||||
--~ui.draw_icon (material.icon (index), material.description (index).name.all, move_x, core.base + core.icon);
|
||||
--~ui.draw_text (world.map.chads (1).materials (index).value'image, move_x, core.base + 2 * core.icon, core.icon, core.icon, 10);
|
||||
--~--
|
||||
--~move_x := move_x + core.icon;
|
||||
--~end if;
|
||||
--~end loop;
|
||||
--~end;
|
||||
--
|
||||
signal_list (core.signal_mode).all;
|
||||
--
|
||||
|
@ -9,6 +9,7 @@ package material is
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
type enumeration is (
|
||||
none,
|
||||
sulphur, mercury, mint, cinnamon, apple, peach,
|
||||
pear, banana, orange, plum, cherry, lemon,
|
||||
potato, wheat, carrot, cucumber, onion, garlic,
|
||||
@ -19,19 +20,27 @@ package material is
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
type definition is record
|
||||
name : access string;
|
||||
cost : natural;
|
||||
name : access string := new string'("--");
|
||||
cost : natural := 0;
|
||||
end record;
|
||||
|
||||
type points is array (enumeration) of core.point;
|
||||
type point is record
|
||||
index : enumeration := none;
|
||||
value : natural := 0;
|
||||
limit : natural := 0;
|
||||
end record;
|
||||
|
||||
subtype limit is natural range 0 .. 31;
|
||||
|
||||
type points is array (limit) of point;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
count : constant natural := enumeration'pos (enumeration'last) + 1;
|
||||
|
||||
default : constant points := (others => (1, 12));
|
||||
|
||||
description : constant array (enumeration) of definition := (
|
||||
none => (others => <>),
|
||||
--
|
||||
sulphur => (new string'("Sulphur"), 11),
|
||||
mercury => (new string'("Mercury"), 13),
|
||||
mint => (new string'("Mint"), 3),
|
||||
|
@ -18,8 +18,6 @@ package skill is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
subtype limit is natural range 0 .. 7;
|
||||
|
||||
type definition is record
|
||||
name : access string := new string'("--");
|
||||
text : access string := new string'("--");
|
||||
@ -31,6 +29,8 @@ package skill is
|
||||
limit : natural := 0;
|
||||
end record;
|
||||
|
||||
subtype limit is natural range 0 .. 7;
|
||||
|
||||
type points is array (limit) of point;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user