Added resource cheats...

This commit is contained in:
Ognjen Milan Robovic 2024-05-22 21:22:34 -04:00
parent 724a037413
commit fc6d0c44f2
3 changed files with 51 additions and 7 deletions

View File

@ -126,7 +126,13 @@ procedure main is
signal_v => ui_main_style'access,
signal_kp_add => zoom_in'access,
signal_kp_subtract => zoom_out'access,
signal_m => world.reveal_map'access,
signal_f1 => world.resource_cheat_1'access,
signal_f2 => world.resource_cheat_2'access,
signal_f3 => world.resource_cheat_3'access,
signal_f4 => world.resource_cheat_4'access,
signal_f5 => world.resource_cheat_5'access,
signal_f6 => world.resource_cheat_6'access,
signal_f7 => world.reveal_map'access,
signal_f => toggle_fullscreen'access,
others => idle_skip'access
);
@ -321,7 +327,7 @@ begin
view_show (index));
end loop;
--
resource.draw_points (player.resources, (preview_width - 4 * icon * resource.count) / 2, (if view_list (map_preview_panel) then icon else 0));
resource.draw_points (world.map.chads (1).resources, (preview_width - 4 * icon * resource.count) / 2, (if view_list (map_preview_panel) then icon else 0));
--
signal_list (signal_mode).all;
--
@ -341,7 +347,7 @@ begin
ui.synchronize;
end loop gameplay_loop;
--~world.mapshot (folder & "/test.png");
world.mapshot (folder & "/test.png");
------------------------------------------------------------------------------------------

View File

@ -343,6 +343,12 @@ package body world is
procedure mapshot (file_path : in string) is
begin
if not map_is_revealed then
core.echo (core.warning, "You need to reveal entire map in order to make a mapshot.");
--
return;
end if;
--
core.create_image (map.width, map.height);
--
for vertical in 0 .. map.height - 1 loop
@ -406,14 +412,18 @@ package body world is
------------------------------------------------------------------------------------------
procedure reveal_map is
function map_is_revealed return boolean is
begin
for x in 0 .. map.width - 1 loop
for y in 0 .. map.height - 1 loop
map.views (x, y) := true;
if map.views (x, y) = false then
return false;
end if;
end loop;
end loop;
end reveal_map;
--
return true;
end map_is_revealed;
------------------------------------------------------------------------------------------
@ -425,6 +435,26 @@ package body world is
map.chads (map.chad_count) := data;
end add_chad;
------------------------------------------------------------------------------------------
procedure resource_cheat_1 is begin map.chads (1).resources (resource.gold) := map.chads (1).resources (resource.gold) + 127; end resource_cheat_1;
procedure resource_cheat_2 is begin map.chads (1).resources (resource.wood) := map.chads (1).resources (resource.wood) + 127; end resource_cheat_2;
procedure resource_cheat_3 is begin map.chads (1).resources (resource.stone) := map.chads (1).resources (resource.stone) + 127; end resource_cheat_3;
procedure resource_cheat_4 is begin map.chads (1).resources (resource.metal) := map.chads (1).resources (resource.metal) + 127; end resource_cheat_4;
procedure resource_cheat_5 is begin map.chads (1).resources (resource.leather) := map.chads (1).resources (resource.leather) + 127; end resource_cheat_5;
procedure resource_cheat_6 is begin map.chads (1).resources (resource.gem) := map.chads (1).resources (resource.gem) + 127; end resource_cheat_6;
------------------------------------------------------------------------------------------
procedure reveal_map is
begin
for x in 0 .. map.width - 1 loop
for y in 0 .. map.height - 1 loop
map.views (x, y) := true;
end loop;
end loop;
end reveal_map;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end world;

View File

@ -122,10 +122,18 @@ package world is
procedure mapshot (file_path : in string);
procedure reveal_map;
function map_is_revealed return boolean;
procedure add_chad (data : in chad.value);
procedure resource_cheat_1;
procedure resource_cheat_2;
procedure resource_cheat_3;
procedure resource_cheat_4;
procedure resource_cheat_5;
procedure resource_cheat_6;
procedure reveal_map;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end world;