diff --git a/source/attribute.adb b/source/attribute.adb index cfb5b07..6dd5dbd 100644 --- a/source/attribute.adb +++ b/source/attribute.adb @@ -8,6 +8,8 @@ package body attribute is procedure configure is begin + core.echo (core.comment, "Configuring attribute components..."); + -- for index in codex loop sprite (index) := core.load_sprite ("./sprite/attribute/" & core.lowercase (codex'image (index)) & ".png", 1, 1); diff --git a/source/chad.adb b/source/chad.adb index d321a2e..0d293b8 100644 --- a/source/chad.adb +++ b/source/chad.adb @@ -8,6 +8,8 @@ package body chad is procedure configure is begin + core.echo (core.comment, "Configuring chad components..."); + -- for index in codex loop --~sprite (index) := core.load_sprite ("./sprite/chad/" & core.lowercase (codex'image (index)) & ".png", 1, 1); diff --git a/source/construction.adb b/source/construction.adb index c6e080e..f5eff67 100644 --- a/source/construction.adb +++ b/source/construction.adb @@ -16,6 +16,8 @@ package body construction is procedure configure is begin + core.echo (core.comment, "Configuring construction components..."); + -- for index in codex loop declare diff --git a/source/core.adb b/source/core.adb index 64e22ea..9a87f82 100644 --- a/source/core.adb +++ b/source/core.adb @@ -6,8 +6,56 @@ package body core is ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + procedure terminal (colour : in terminal_colour := white; effect : in terminal_effect := normal) is + format : string := character'val (27) & "[" & character'val (terminal_effect'pos (effect) + 48) & ";3" & character'val (terminal_colour'pos (colour) + 48) & "m"; + begin + put (format); + end terminal; + + ------------------------------------------------------------------------------------------ + + procedure echo (status : in echo_status; message : in string) is + begin + put ("["); + -- + case status is + when failure => terminal (red, bold); put ("Failure"); terminal; + when warning => terminal (yellow, bold); put ("Warning"); terminal; + when success => terminal (green, bold); put ("Success"); terminal; + when comment => terminal (grey, bold); put ("Comment"); terminal; + end case; + -- + put_line ("] " & message); + end echo; + + ------------------------------------------------------------------------------------------ + + procedure dash is + begin + terminal (grey, bold); + put ("------------------------------------------------------------------------------------------"); + put ("------------------------------------------------------------------------------------------"); + terminal; + new_line; + end dash; + + ------------------------------------------------------------------------------------------ + + procedure semi_dash is + begin + terminal (grey, bold); + put (" "); + put ("------------------------------------------------------------------------------------------"); + terminal; + new_line; + end semi_dash; + + ------------------------------------------------------------------------------------------ + procedure configure is begin + echo (comment, "Configuring core game engine components..."); + -- engine_configure; -- hexagon_grid_sprite := load_sprite ("./sprite/ui/hexagon_grid_tile.png", 1, 1); @@ -66,13 +114,6 @@ package body core is ------------------------------------------------------------------------------------------ - function sigmoid (value : in boolean) return integer is - begin - return (if value then -1 else 1); - end sigmoid; - - ------------------------------------------------------------------------------------------ - function c_string (ada_string : string) return string is begin return (ada_string & character'val (0)); diff --git a/source/core.ads b/source/core.ads index 274dc42..7439204 100644 --- a/source/core.ads +++ b/source/core.ads @@ -5,6 +5,19 @@ package core is ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + type terminal_colour is ( + grey, red, green, yellow, blue, pink, + cyan, white + ); + + type terminal_effect is ( + normal, bold, italic, underline, blink, invert + ); + + type echo_status is ( + failure, warning, success, comment + ); + type signal_code is ( signal_none, signal_space, signal_zero, signal_one, signal_two, signal_three, signal_four, signal_five, signal_six, signal_seven, signal_eight, signal_nine, @@ -87,6 +100,13 @@ package core is ------------------------------------------------------------------------------------------ + procedure terminal (colour : in terminal_colour := white; effect : in terminal_effect := normal); + + procedure echo (status : in echo_status; message : in string); + + procedure dash; + procedure semi_dash; + procedure configure; procedure synchronize; @@ -95,7 +115,6 @@ package core is function flip_coin return integer; function roll_dice return integer; function by_chance (chance : in integer) return integer; - function sigmoid (value : in boolean) return integer; function c_string (ada_string : in string) return string; function clip (value, minimum, maximum : in integer) return integer; diff --git a/source/deity.ads b/source/deity.ads index 54a8d3c..f133cae 100644 --- a/source/deity.ads +++ b/source/deity.ads @@ -11,7 +11,7 @@ package deity is ------------------------------------------------------------------------------------------ - subtype piety_limit is natural range -30 .. 30; + subtype piety_limit is integer range -30 .. 30; type information is record diff --git a/source/item.adb b/source/item.adb index e054396..f293056 100644 --- a/source/item.adb +++ b/source/item.adb @@ -16,6 +16,8 @@ package body item is procedure configure is begin + core.echo (core.comment, "Configuring item components..."); + -- for index in codex loop declare diff --git a/source/magic.adb b/source/magic.adb index 4a8b0e5..062ca7d 100644 --- a/source/magic.adb +++ b/source/magic.adb @@ -16,6 +16,8 @@ package body magic is procedure configure is begin + core.echo (core.comment, "Configuring magic components..."); + -- for index in codex loop declare diff --git a/source/main.adb b/source/main.adb index 0e957d7..7b03200 100644 --- a/source/main.adb +++ b/source/main.adb @@ -19,6 +19,13 @@ procedure main is begin + core.dash; + core.echo (core.comment, "Copyright (C) 2024 -- Ognjen 'xolatile' Milan Robovic"); + core.echo (core.comment, "Version -- 1.0.0"); + core.echo (core.comment, "License -- GNU/GPLv3+"); + core.echo (core.comment, "Xhads is free software, you can redistribute it and modify it under the terms of the GNU General Public License by Free Software Foundation."); + core.dash; + core.configure; ui.configure; attribute.configure; @@ -40,6 +47,8 @@ begin preview_height := core.window_height; ui.active := ui.steam; + core.echo (core.success, "Successfully initialized game data, entering main gameplay loop."); + gameplay: loop core.synchronize; -- diff --git a/source/might.adb b/source/might.adb index e33c288..e413f84 100644 --- a/source/might.adb +++ b/source/might.adb @@ -16,6 +16,8 @@ package body might is procedure configure is begin + core.echo (core.comment, "Configuring might components..."); + -- for index in codex loop declare diff --git a/source/resource.adb b/source/resource.adb index 23b918f..336946e 100644 --- a/source/resource.adb +++ b/source/resource.adb @@ -8,6 +8,8 @@ package body resource is procedure configure is begin + core.echo (core.comment, "Configuring resource components..."); + -- for index in codex loop sprite (index) := core.load_sprite ("./sprite/resource/" & core.lowercase (codex'image (index)) & ".png", 1, 1); diff --git a/source/skill.adb b/source/skill.adb index 43c060f..6960efb 100644 --- a/source/skill.adb +++ b/source/skill.adb @@ -8,6 +8,8 @@ package body skill is procedure configure is begin + core.echo (core.comment, "Configuring skill components..."); + -- for index in codex loop sprite (index) := core.load_sprite ("./sprite/skill/" & core.lowercase (codex'image (index)) & ".png", 1, 1); diff --git a/source/ui.adb b/source/ui.adb index c1c83d6..2c797af 100644 --- a/source/ui.adb +++ b/source/ui.adb @@ -81,6 +81,8 @@ package body ui is end loop; end load_ui; begin + core.echo (core.comment, "Configuring UI components..."); + -- load_ui (default, "default/"); load_ui (steam, "steam/"); -- diff --git a/source/unit.adb b/source/unit.adb index 6d833ca..e839244 100644 --- a/source/unit.adb +++ b/source/unit.adb @@ -15,6 +15,8 @@ package body unit is procedure configure is begin + core.echo (core.comment, "Configuring unit components..."); + -- for index in codex loop declare diff --git a/source/world.adb b/source/world.adb index a81b9fb..196482a 100644 --- a/source/world.adb +++ b/source/world.adb @@ -30,6 +30,8 @@ package body world is procedure configure is begin + core.echo (core.comment, "Configuring world components..."); + -- blocks := core.load_sprite ("./sprite/world/terrain/terrain.png", 1, 1); -- for index in codex