From 1becd3bd795224be24a37b68b6d66539e0abac88 Mon Sep 17 00:00:00 2001 From: xolatile Date: Mon, 10 Jun 2024 10:19:24 -0400 Subject: [PATCH] Removed popup box, added attribute cheat, refactored help menu... --- source/core.adb | 4 ---- source/core.ads | 3 --- source/location.ads | 16 ++++++++-------- source/main.adb | 1 + source/ui.adb | 31 ------------------------------- source/world.adb | 21 +++++++++++++++------ source/world.ads | 1 + 7 files changed, 25 insertions(+), 52 deletions(-) diff --git a/source/core.adb b/source/core.adb index e1755b1..36c0619 100644 --- a/source/core.adb +++ b/source/core.adb @@ -439,12 +439,8 @@ package body core is ------------------------------------------------------------------------------------------ function read_help_box return string is begin return to_string (help_box.text); end read_help_box; - function read_text_box return string is begin return to_string (text_box.text); end read_text_box; - - ------------------------------------------------------------------------------------------ procedure write_help_box (text : in string) is begin help_box.text := to_unbounded_string (text); end write_help_box; - procedure write_text_box (text : in string) is begin text_box.text := to_unbounded_string (text); end write_text_box; ------------------------------------------------------------------------------------------ diff --git a/source/core.ads b/source/core.ads index ef80777..b3d5ecc 100644 --- a/source/core.ads +++ b/source/core.ads @@ -111,7 +111,6 @@ package core is zoom : natural := 1; help_box : string_box_data; - text_box : string_box_data; global_image : ray.image; @@ -204,10 +203,8 @@ package core is procedure overlay; function read_help_box return string; - function read_text_box return string; procedure write_help_box (text : in string); - procedure write_text_box (text : in string); procedure save_point (here : in core.io.file_type; data : in point); procedure load_point (here : in core.io.file_type; data : out point); diff --git a/source/location.ads b/source/location.ads index ae569f6..89fcd23 100644 --- a/source/location.ads +++ b/source/location.ads @@ -42,14 +42,14 @@ package location is well_of_strength => (new string'("Well of Strength"), true, 4, (effect.modify_attribute, attribute.enumeration'pos (attribute.offense), 2, false, 0)), old_dwarven_grave => (new string'("Old Dwarven Grave"), true, 1, (effect.modify_attribute, attribute.enumeration'pos (attribute.defense), 1, false, 0)), huge_ancient_urn => (new string'("Huge Ancient Urn"), true, 1, (effect.modify_attribute, attribute.enumeration'pos (attribute.offense), 1, false, 0)), - banana_tree => (new string'("Banana Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.banana), 4, true, 600)), - apple_tree => (new string'("Apple Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.apple), 6, true, 600)), - cherry_tree => (new string'("Cherry Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.cherry), 6, true, 600)), - lemon_tree => (new string'("Lemon Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.lemon), 6, true, 600)), - orange_tree => (new string'("Orange Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.orange), 6, true, 600)), - pear_tree => (new string'("Pear Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.pear), 6, true, 600)), - peach_tree => (new string'("Peach Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.peach), 6, true, 600)), - plum_tree => (new string'("Plum Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.plum), 6, true, 600)), + banana_tree => (new string'("Banana Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.banana), 4, true, 12)), + apple_tree => (new string'("Apple Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.apple), 6, true, 12)), + cherry_tree => (new string'("Cherry Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.cherry), 6, true, 12)), + lemon_tree => (new string'("Lemon Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.lemon), 6, true, 12)), + orange_tree => (new string'("Orange Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.orange), 6, true, 12)), + pear_tree => (new string'("Pear Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.pear), 6, true, 12)), + peach_tree => (new string'("Peach Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.peach), 6, true, 12)), + plum_tree => (new string'("Plum Tree"), true, 4, (effect.modify_material, material.enumeration'pos (material.plum), 6, true, 12)), pillars_of_observation => (new string'("Pillars of Observation"), true, 1, (effect.modify_attribute, attribute.enumeration'pos (attribute.reach), 2, false, 0)) ); diff --git a/source/main.adb b/source/main.adb index 9cece16..6666d64 100644 --- a/source/main.adb +++ b/source/main.adb @@ -46,6 +46,7 @@ procedure main is core.signal_f6 => world.resource_cheat_6'access, core.signal_f7 => world.reveal_map'access, core.signal_f8 => world.restore_points'access, + core.signal_f9 => world.increase_attributes'access, others => core.idle_skip'access ); diff --git a/source/ui.adb b/source/ui.adb index 5f2262d..7d681ce 100644 --- a/source/ui.adb +++ b/source/ui.adb @@ -85,8 +85,6 @@ package body ui is procedure draw_background (index : in element; x, y, width, height : in integer; action : core.pointer := core.idle_skip'access); - procedure draw_popup_box; - ------------------------------------------------------------------------------------------ procedure configure is @@ -115,12 +113,6 @@ package body ui is prioritize := false; -- draw (cursor, core.cursor.x, core.cursor.y); - -- - if core.cursor_mode = core.cursor_middle then - draw_popup_box; - end if; - -- - core.write_text_box ("--"); end synchronize; ------------------------------------------------------------------------------------------ @@ -688,29 +680,6 @@ package body ui is end if; end draw_background; - ------------------------------------------------------------------------------------------ - - procedure draw_popup_box is - width : constant integer := 320; - height : constant integer := core.icon; - middle : constant integer := sprite (active, text_middle).width; - offset : constant integer := 16; - begin - draw_background (text_middle, core.cursor.x + middle + offset, core.cursor.y + middle + offset, width - 2 * middle, height - 2 * middle); - -- - draw_horizontally (text_upper, core.cursor.x + middle + offset, core.cursor.y + offset, width - 2 * middle); - draw_horizontally (text_lower, core.cursor.x + middle + offset, core.cursor.y + height - middle + offset, width - 2 * middle); - draw_vertically (text_left, core.cursor.x + offset, core.cursor.y + middle + offset, height - 2 * middle); - draw_vertically (text_right, core.cursor.x + width - middle + offset, core.cursor.y + middle + offset, height - 2 * middle); - -- - draw (text_upper_left, core.cursor.x + offset, core.cursor.y + offset); - draw (text_upper_right, core.cursor.x + width - middle + offset, core.cursor.y + offset); - draw (text_lower_left, core.cursor.x + offset, core.cursor.y + height - middle + offset); - draw (text_lower_right, core.cursor.x + width - middle + offset, core.cursor.y + height - middle + offset); - -- - ui.write (core.read_text_box, core.cursor.x + 4 + offset, core.cursor.y + 6 + offset); - end draw_popup_box; - ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end ui; diff --git a/source/world.adb b/source/world.adb index f1e3f71..ee1a1d7 100644 --- a/source/world.adb +++ b/source/world.adb @@ -280,7 +280,7 @@ package body world is core.draw (landmark.game (data), x, y, factor => factor); -- if core.cursor_inside (x, y, landmark.game (data).width * factor, landmark.game (data).height * factor) and core.cursor_mode = core.cursor_middle then - core.write_text_box (landmark.description (data).name.all); + ui.draw_text (landmark.description (data).name.all, core.cursor.x + core.icon, core.cursor.y, border => 10); end if; end draw_landmark; @@ -291,7 +291,7 @@ package body world is core.draw (location.game (data), x, y, state => core.animation'val (boolean'pos (used)), factor => factor); -- if core.cursor_inside (x, y, location.game (data).width * factor, location.game (data).height * factor) and core.cursor_mode = core.cursor_middle then - core.write_text_box (location.description (data).name.all); + ui.draw_text (location.description (data).name.all, core.cursor.x + core.icon, core.cursor.y, border => 10); end if; end draw_location; @@ -302,7 +302,7 @@ package body world is core.draw (construction.game (data), x, y, factor => factor); -- if core.cursor_inside (x, y, construction.game (data).width * factor, construction.game (data).height * factor) and core.cursor_mode = core.cursor_middle then - core.write_text_box (construction.description (data).name.all); + ui.draw_text (construction.description (data).name.all, core.cursor.x + core.icon, core.cursor.y, border => 10); end if; end draw_construction; @@ -312,8 +312,8 @@ package body world is begin core.draw (equipment.game (data), x, y, state => core.idle, factor => factor); -- - if core.cursor_inside (x, y, equipment.game (data).width * factor, equipment.game (data).height * factor) and core.cursor_mode = core.cursor_middle and equipment_valid (data) then - core.write_text_box (equipment.description (data).name.all); + if core.cursor_inside (x, y, equipment.game (data).width * factor, equipment.game (data).height * factor) and core.cursor_mode = core.cursor_middle then + ui.draw_text (equipment.description (data).name.all, core.cursor.x + core.icon, core.cursor.y, border => 10); end if; end draw_equipment; @@ -328,7 +328,7 @@ package body world is end loop; -- if core.cursor_inside (x, y, core.base * factor, core.base * factor) and core.cursor_mode = core.cursor_middle then - core.write_text_box (unit.description (data).name.all); + ui.draw_text (unit.description (data).name.all, core.cursor.x + core.icon, core.cursor.y, border => 10); end if; end draw_unit; @@ -776,6 +776,15 @@ package body world is ------------------------------------------------------------------------------------------ + procedure increase_attributes is + begin + for index in attribute.enumeration loop + map.chads (1).attributes (index) := map.chads (1).attributes (index) + 1; + end loop; + end increase_attributes; + + ------------------------------------------------------------------------------------------ + procedure player_up is begin if map.chads (1).movement.value = 0 then return; end if; diff --git a/source/world.ads b/source/world.ads index b27dbb3..5b748a6 100644 --- a/source/world.ads +++ b/source/world.ads @@ -89,6 +89,7 @@ package world is procedure resource_cheat_6; procedure reveal_map; procedure restore_points; + procedure increase_attributes; procedure player_up; procedure player_down;