142 lines
6.1 KiB
Ada
142 lines
6.1 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.
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
-- Experimental minimal terminal rogue-like game in Ada programming language. I used to write a lot of Ada programs some time ago, then went in full C and assembly mode, and came
|
|
-- back to Ada, but realized that I keep my folders messy... Since it's bothersome to find my old Ada projects and share them here, I decided that the most easy thing to do is to
|
|
-- write a new program in Ada, a tiny game. Work in progress, it's messy and ugly for now...
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
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 entity_list is (
|
|
entity_null, entity_menu, entity_map, entity_item, entity_magic, entity_ammunition, entity_weapon, entity_armour,
|
|
entity_scroll, entity_potion, entity_consumable, entity_note, entity_plant, entity_animal, entity_monster, entity_player
|
|
);
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
type entity_constant_type is tagged
|
|
record
|
|
entity : entity_list := entity_null; -- 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 entity_variable_type is tagged
|
|
record
|
|
x : integer := 0; -- Global X coordinate.
|
|
y : integer := 0; -- Global Y 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 mind_type is
|
|
record
|
|
fear : natural := 0;
|
|
pain : natural := 0;
|
|
thirst : natural := 0;
|
|
hunger : natural := 0;
|
|
exhaustion : natural := 0;
|
|
solitude : natural := 0;
|
|
faith : natural := 0;
|
|
end record;
|
|
|
|
type body_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;
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
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));
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
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 := '7';
|
|
effect : character := '0';
|
|
y : screen_height := 0;
|
|
x : screen_width := 0);
|
|
|
|
procedure render_buffer;
|
|
|
|
------------------------------------------------------------------------------------------
|
|
|
|
end core;
|