xabina/core.ads
2023-10-15 16:17:17 -04:00

141 lines
5.4 KiB
Ada

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Copyright (c) 2023 - Ognjen 'xolatile' Milan Robovic
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Xabina is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either
-- version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
-- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
with ada.text_io;
package core is
------------------------------------------------------------------------------------------
type screen_width is mod 120;
type screen_height is mod 40;
type screen_matrix is array (screen_height, screen_width) of character;
------------------------------------------------------------------------------------------
type colour_type is
record
grey : character := '0';
red : character := '1';
green : character := '2';
yellow : character := '3';
blue : character := '4';
pink : character := '5';
cyan : character := '6';
white : character := '7';
end record;
type effect_type is
record
normal : character := '0';
bold : character := '1';
italic : character := '3';
underline : character := '4';
blink : character := '5';
contra : character := '7';
end record;
cancel : constant character := character'val (24);
carriage_return : constant character := character'val (10);
line_feed : constant character := character'val (13);
escape : constant character := character'val (27);
------------------------------------------------------------------------------------------
type description is new string (1 .. 144);
type list is (
none, menu, map, item, magic, ammunition, weapon, armour,
scroll, potion, consumable, note, plant, animal, monster, player
);
------------------------------------------------------------------------------------------
type constant_type is tagged
record
entity : list := core.none; -- Entity identifier.
name : string (1 .. 20) := "- "; -- Entity general name.
symbol : character := ' '; -- Entity ASCII character representation.
colour : character := '7'; -- Entity VT100 escape sequence colour.
effect : character := '0'; -- Entity VT100 escape sequence effect.
end record;
type variable_type is tagged
record
y : integer := 0; -- Global Y coordinate.
x : integer := 0; -- Global X coordinate.
end record;
------------------------------------------------------------------------------------------
type soul_type is
record
envy : natural := 0;
gluttony : natural := 0;
greed : natural := 0;
lust : natural := 0;
pride : natural := 0;
sloth : natural := 0;
wrath : natural := 0;
end record;
type health_type is
record
head : natural := 0;
chest : natural := 0;
stomach : natural := 0;
left_arm : natural := 0;
right_arm : natural := 0;
left_leg : natural := 0;
right_leg : natural := 0;
end record;
type mana_type is
record
stamina : natural := 0;
fear : natural := 0;
pain : natural := 0;
thirst : natural := 0;
hunger : natural := 0;
exhaustion : natural := 0;
solitude : natural := 0;
end record;
------------------------------------------------------------------------------------------
colour : colour_type;
effect : effect_type;
screen_symbol : screen_matrix := (others => (others => cancel));
screen_colour : screen_matrix := (others => (others => colour.white));
screen_effect : screen_matrix := (others => (others => effect.normal));
------------------------------------------------------------------------------------------
function randomize (minimum : natural;
maximum : natural) return natural;
procedure screen_delete;
procedure screen_offset;
procedure screen_hide_cursor;
procedure screen_show_cursor;
procedure screen_new_line;
procedure render_character (symbol : character;
colour : character;
effect : character;
y : screen_height;
x : screen_width);
procedure render_buffer;
------------------------------------------------------------------------------------------
end core;