Refactored equipment slot and kind...

This commit is contained in:
Ognjen Milan Robovic 2024-06-06 10:31:17 -04:00
parent f1bee9dc6a
commit e34d94adb6
11 changed files with 21 additions and 13 deletions

BIN
icon/engine/chest.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

BIN
icon/engine/feet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

BIN
icon/engine/full_body.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

BIN
icon/engine/hands.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

BIN
icon/engine/head.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

BIN
icon/engine/main_hand.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B

BIN
icon/engine/neck.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

BIN
icon/engine/off_hand.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

View File

@ -8,7 +8,7 @@ package equipment is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
type slot is ( type kind is (
full_body, head, chest, hands, feet, neck, full_body, head, chest, hands, feet, neck,
main_hand, off_hand main_hand, off_hand
); );
@ -46,13 +46,13 @@ package equipment is
type definition is record type definition is record
name : access string := new string'("--"); name : access string := new string'("--");
kind : slot := full_body; slot : kind := full_body;
attributes : attribute.bonus := (others => 0); attributes : attribute.bonus := (others => 0);
favor : faction.enumeration := faction.neutral; favor : faction.enumeration := faction.neutral;
evoke : effect.information := effect.none; evoke : effect.information := effect.none;
end record; end record;
type equip_array is array (slot) of enumeration; type equip_array is array (kind) of enumeration;
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
@ -214,6 +214,7 @@ package equipment is
sprite : array (enumeration) of core.sprite; sprite : array (enumeration) of core.sprite;
icon : array (enumeration) of core.sprite; icon : array (enumeration) of core.sprite;
slot : array (kind) of core.sprite;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -281,13 +281,20 @@ begin
core.echo (core.comment, "Configuring" & equipment.count'image & " equipment components..."); core.echo (core.comment, "Configuring" & equipment.count'image & " equipment components...");
-- --
for index in equipment.enumeration loop for index in equipment.enumeration loop
declare folder : constant string := core.lowercase (equipment.slot'image (equipment.description (index).kind)); declare folder : constant string := core.lowercase (equipment.kind'image (equipment.description (index).slot));
file : constant string := core.lowercase (equipment.enumeration'image (index)); file : constant string := core.lowercase (equipment.enumeration'image (index));
begin begin
equipment.sprite (index) := core.import_sprite (core.folder & "/game/equipment/" & folder & "/" & file & ".png", 4, 6); equipment.sprite (index) := core.import_sprite (core.folder & "/game/equipment/" & folder & "/" & file & ".png", 4, 6);
equipment.icon (index) := core.import_sprite (core.folder & "/icon/equipment/" & folder & "/" & file & ".png", 1, 1); equipment.icon (index) := core.import_sprite (core.folder & "/icon/equipment/" & folder & "/" & file & ".png", 1, 1);
end; end;
end loop; end loop;
--
for index in equipment.kind loop
declare file : constant string := core.lowercase (equipment.kind'image (index));
begin
equipment.slot (index) := core.import_sprite (core.folder & "/icon/engine/" & file & ".png", 1, 1);
end;
end loop;
core.echo (core.comment, "Configuring" & unit.count'image & " unit components..."); core.echo (core.comment, "Configuring" & unit.count'image & " unit components...");
-- --

View File

@ -320,8 +320,8 @@ package body world is
for index in resource.enumeration loop core.save_point (file, map.chads (1).resources (index)); end loop; for index in resource.enumeration loop core.save_point (file, map.chads (1).resources (index)); end loop;
for index in material.enumeration loop core.save_point (file, map.chads (1).materials (index)); end loop; for index in material.enumeration loop core.save_point (file, map.chads (1).materials (index)); end loop;
-- --
for index in equipment.slot loop for kind in equipment.kind loop
core.io.write (file, equipment.enumeration'pos (map.chads (1).equipments (index))); core.io.write (file, equipment.enumeration'pos (map.chads (1).equipments (kind)));
end loop; end loop;
-- --
core.io.write (file, map.chads (1).item_count); core.io.write (file, map.chads (1).item_count);
@ -389,8 +389,8 @@ package body world is
for index in resource.enumeration loop core.load_point (file, map.chads (1).resources (index)); end loop; for index in resource.enumeration loop core.load_point (file, map.chads (1).resources (index)); end loop;
for index in material.enumeration loop core.load_point (file, map.chads (1).materials (index)); end loop; for index in material.enumeration loop core.load_point (file, map.chads (1).materials (index)); end loop;
-- --
for index in equipment.slot loop for kind in equipment.kind loop
core.io.read (file, this); map.chads (1).equipments (index) := equipment.enumeration'val (this); core.io.read (file, this); map.chads (1).equipments (kind) := equipment.enumeration'val (this);
end loop; end loop;
-- --
core.io.read (file, map.chads (1).item_count); core.io.read (file, map.chads (1).item_count);
@ -1030,10 +1030,10 @@ package body world is
y => offset.y + (map.units (index).y - core.camera.y) * core.base * core.zoom, y => offset.y + (map.units (index).y - core.camera.y) * core.base * core.zoom,
state => core.animation'val (map.units (index).state)); state => core.animation'val (map.units (index).state));
-- --
for slot in equipment.slot loop for kind in equipment.kind loop
if equipment.enumeration'pos (unit.description (unit.enumeration'val (map.units (index).index)).equipments (slot)) if equipment.enumeration'pos (unit.description (unit.enumeration'val (map.units (index).index)).equipments (kind))
/= equipment.enumeration'pos (equipment.none) then /= equipment.enumeration'pos (equipment.none) then
core.draw (data => equipment.sprite (unit.description (unit.enumeration'val (map.units (index).index)).equipments (slot)), core.draw (data => equipment.sprite (unit.description (unit.enumeration'val (map.units (index).index)).equipments (kind)),
x => offset.x + (map.units (index).x - core.camera.x) * core.base * core.zoom, x => offset.x + (map.units (index).x - core.camera.x) * core.base * core.zoom,
y => offset.y + (map.units (index).y - core.camera.y) * core.base * core.zoom, y => offset.y + (map.units (index).y - core.camera.y) * core.base * core.zoom,
state => core.animation'val (map.units (index).state)); state => core.animation'val (map.units (index).state));
@ -1051,8 +1051,8 @@ package body world is
y => offset.y + (map.chads (index).y - core.camera.y) * core.base * core.zoom, y => offset.y + (map.chads (index).y - core.camera.y) * core.base * core.zoom,
state => map.chads (index).state); state => map.chads (index).state);
-- --
for slot in equipment.slot loop for kind in equipment.kind loop
core.draw (data => equipment.sprite (map.chads (index).equipments (slot)), core.draw (data => equipment.sprite (map.chads (index).equipments (kind)),
x => offset.x + (map.chads (index).x - core.camera.x) * core.base * core.zoom, x => offset.x + (map.chads (index).x - core.camera.x) * core.base * core.zoom,
y => offset.y + (map.chads (index).y - core.camera.y) * core.base * core.zoom, y => offset.y + (map.chads (index).y - core.camera.y) * core.base * core.zoom,
state => map.chads (index).state); state => map.chads (index).state);