Retarded changes, experimenting...
This commit is contained in:
parent
1732e4669f
commit
a2a7ccbc9e
331
xabina.adb
331
xabina.adb
@ -23,63 +23,91 @@ function xabina return integer is
|
|||||||
-- System
|
-- System
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
type integer_subrange is
|
SIGNAL_A : constant character := 'a';
|
||||||
record
|
SIGNAL_B : constant character := 'b';
|
||||||
minimum : integer := 0;
|
SIGNAL_C : constant character := 'c';
|
||||||
maximum : integer := 0;
|
SIGNAL_D : constant character := 'd';
|
||||||
end record;
|
SIGNAL_E : constant character := 'e';
|
||||||
|
SIGNAL_F : constant character := 'f';
|
||||||
|
SIGNAL_G : constant character := 'g';
|
||||||
|
SIGNAL_H : constant character := 'h';
|
||||||
|
SIGNAL_I : constant character := 'i';
|
||||||
|
SIGNAL_J : constant character := 'j';
|
||||||
|
SIGNAL_K : constant character := 'k';
|
||||||
|
SIGNAL_L : constant character := 'l';
|
||||||
|
SIGNAL_M : constant character := 'm';
|
||||||
|
SIGNAL_N : constant character := 'n';
|
||||||
|
SIGNAL_O : constant character := 'o';
|
||||||
|
SIGNAL_P : constant character := 'p';
|
||||||
|
SIGNAL_Q : constant character := 'q';
|
||||||
|
SIGNAL_R : constant character := 'r';
|
||||||
|
SIGNAL_S : constant character := 's';
|
||||||
|
SIGNAL_T : constant character := 't';
|
||||||
|
SIGNAL_U : constant character := 'u';
|
||||||
|
SIGNAL_V : constant character := 'v';
|
||||||
|
SIGNAL_W : constant character := 'w';
|
||||||
|
SIGNAL_X : constant character := 'x';
|
||||||
|
SIGNAL_Y : constant character := 'y';
|
||||||
|
SIGNAL_Z : constant character := 'z';
|
||||||
|
|
||||||
type natural_subrange is
|
SIGNAL_0 : constant character := '0';
|
||||||
record
|
SIGNAL_1 : constant character := '1';
|
||||||
minimum : natural := 0;
|
SIGNAL_2 : constant character := '2';
|
||||||
maximum : natural := 0;
|
SIGNAL_3 : constant character := '3';
|
||||||
end record;
|
SIGNAL_4 : constant character := '4';
|
||||||
|
SIGNAL_5 : constant character := '5';
|
||||||
|
SIGNAL_6 : constant character := '6';
|
||||||
|
SIGNAL_7 : constant character := '7';
|
||||||
|
SIGNAL_8 : constant character := '8';
|
||||||
|
SIGNAL_9 : constant character := '9';
|
||||||
|
|
||||||
type signal_list is (
|
SIGNAL_DOT : constant character := '.';
|
||||||
SIGNAL_A, SIGNAL_B, SIGNAL_C, SIGNAL_D, SIGNAL_E, SIGNAL_F, SIGNAL_G, SIGNAL_H,
|
SIGNAL_COMMA : constant character := ',';
|
||||||
SIGNAL_I, SIGNAL_J, SIGNAL_K, SIGNAL_L, SIGNAL_M, SIGNAL_N, SIGNAL_O, SIGNAL_P,
|
SIGNAL_SEMICOLON : constant character := ';';
|
||||||
SIGNAL_Q, SIGNAL_R, SIGNAL_S, SIGNAL_T, SIGNAL_U, SIGNAL_V, SIGNAL_W, SIGNAL_X,
|
SIGNAL_SLASH : constant character := '/';
|
||||||
SIGNAL_Y, SIGNAL_Z, SIGNAL_0, SIGNAL_1, SIGNAL_2, SIGNAL_3, SIGNAL_4, SIGNAL_5,
|
SIGNAL_BACKSLASH : constant character := '\';
|
||||||
SIGNAL_6, SIGNAL_7, SIGNAL_8, SIGNAL_9, SIGNAL_ESCAPE, SIGNAL_TABULATOR, SIGNAL_RETURN, SIGNAL_NEW_LINE,
|
SIGNAL_QUOTE : constant character := ''';
|
||||||
SIGNAL_SLASH, SIGNAL_BACKSLASH, SIGNAL_QUOTE, SIGNAL_BACKQUOTE, SIGNAL_SPACE, SIGNAL_BACKSPACE, SIGNAL_DOT, SIGNAL_IDLE
|
SIGNAL_BACKQUOTE : constant character := '`';
|
||||||
);
|
SIGNAL_SPACE : constant character := ' ';
|
||||||
|
|
||||||
type colours is (
|
SIGNAL_BACKSPACE : constant character := character'val ( 8);
|
||||||
COLOUR_GREY, COLOUR_RED, COLOUR_GREEN, COLOUR_YELLOW, COLOUR_BLUE, COLOUR_PINK, COLOUR_CYAN, COLOUR_WHITE
|
SIGNAL_TABULATOR : constant character := character'val ( 9);
|
||||||
);
|
SIGNAL_LINE_FEED : constant character := character'val (13);
|
||||||
|
SIGNAL_IDLE : constant character := character'val (24);
|
||||||
|
|
||||||
type effects is (
|
type signal_list is mod 128;
|
||||||
EFFECT_NORMAL, EFFECT_BOLD, EFFECT_ITALIC, EFFECT_UNDERLINE, EFFECT_BLINK, EFFECT_REVERSE
|
|
||||||
);
|
|
||||||
|
|
||||||
escape : constant character := character'val (27);
|
COLOUR_GREY : constant character := '0';
|
||||||
|
COLOUR_RED : constant character := '1';
|
||||||
|
COLOUR_GREEN : constant character := '2';
|
||||||
|
COLOUR_YELLOW : constant character := '3';
|
||||||
|
COLOUR_BLUE : constant character := '4';
|
||||||
|
COLOUR_PINK : constant character := '5';
|
||||||
|
COLOUR_CYAN : constant character := '6';
|
||||||
|
COLOUR_WHITE : constant character := '7';
|
||||||
|
|
||||||
|
EFFECT_NORMAL : constant character := '0';
|
||||||
|
EFFECT_BOLD : constant character := '1';
|
||||||
|
EFFECT_ITALIC : constant character := '3';
|
||||||
|
EFFECT_UNDERLINE : constant character := '4';
|
||||||
|
EFFECT_BLINK : constant character := '5';
|
||||||
|
EFFECT_REVERSE : constant character := '7';
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
function format_symbol (
|
function format_symbol (
|
||||||
symbol : character := ' ';
|
symbol : character := ' ';
|
||||||
colour : colours := COLOUR_WHITE;
|
colour : character := COLOUR_WHITE;
|
||||||
effect : effects := EFFECT_NORMAL
|
effect : character := EFFECT_NORMAL
|
||||||
) return string is
|
) return string is
|
||||||
format : string (1 .. 12) := escape & "[E;3CmS" & escape & "[0m";
|
format : string (1 .. 12) := escape & "[E;3CmS" & escape & "[0m";
|
||||||
begin
|
begin
|
||||||
case effect is
|
|
||||||
when EFFECT_NORMAL => format (3) := '0';
|
|
||||||
when EFFECT_BOLD => format (3) := '1';
|
|
||||||
when EFFECT_ITALIC => format (3) := '3';
|
|
||||||
when EFFECT_UNDERLINE => format (3) := '4';
|
|
||||||
when EFFECT_BLINK => format (3) := '5';
|
|
||||||
when EFFECT_REVERSE => format (3) := '7';
|
|
||||||
end case;
|
|
||||||
case colour is
|
|
||||||
when COLOUR_GREY => format (6) := '0';
|
|
||||||
when COLOUR_RED => format (6) := '1';
|
|
||||||
when COLOUR_GREEN => format (6) := '2';
|
|
||||||
when COLOUR_YELLOW => format (6) := '3';
|
|
||||||
when COLOUR_BLUE => format (6) := '4';
|
|
||||||
when COLOUR_PINK => format (6) := '5';
|
|
||||||
when COLOUR_CYAN => format (6) := '6';
|
|
||||||
when COLOUR_WHITE => format (6) := '7';
|
|
||||||
end case;
|
|
||||||
format (8) := symbol;
|
format (8) := symbol;
|
||||||
|
format (6) := colour;
|
||||||
|
format (3) := effect;
|
||||||
return format;
|
return format;
|
||||||
end format_symbol;
|
end format_symbol;
|
||||||
|
|
||||||
@ -87,18 +115,18 @@ function xabina return integer is
|
|||||||
-- Entity
|
-- Entity
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
type entities is (
|
type entity_list is (
|
||||||
ENTITY_NULL, ENTITY_MENU, ENTITY_MAP, ENTITY_ITEM, ENTITY_MAGIC, ENTITY_AMMUNITION, ENTITY_WEAPON, ENTITY_ARMOUR,
|
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_GOBLIN, ENTITY_PLAYER
|
ENTITY_SCROLL, ENTITY_POTION, ENTITY_CONSUMABLE, ENTITY_NOTE, ENTITY_PLANT, ENTITY_ANIMAL, ENTITY_GOBLIN, ENTITY_PLAYER
|
||||||
);
|
);
|
||||||
|
|
||||||
type entity_constant_type is tagged
|
type entity_constant_type is tagged
|
||||||
record
|
record
|
||||||
entity : entities := ENTITY_NULL; -- Entity identifier.
|
entity : entity_list := ENTITY_NULL; -- Entity identifier.
|
||||||
name : unbounded_string := null_unbounded_string; -- Entity general name.
|
name : unbounded_string := null_unbounded_string; -- Entity general name.
|
||||||
symbol : character := ' '; -- Entity ASCII character representation.
|
symbol : character := ' '; -- Entity ASCII character representation.
|
||||||
colour : colours := COLOUR_WHITE; -- Entity VT100 escape sequence colour.
|
colour : character := COLOUR_WHITE; -- Entity VT100 escape sequence colour.
|
||||||
effect : effects := EFFECT_NORMAL; -- Entity VT100 escape sequence effect.
|
effect : character := EFFECT_NORMAL; -- Entity VT100 escape sequence effect.
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
type entity_variable_type is tagged
|
type entity_variable_type is tagged
|
||||||
@ -274,28 +302,28 @@ function xabina return integer is
|
|||||||
|
|
||||||
type ammunition_constant_type is new entity_constant_type with
|
type ammunition_constant_type is new entity_constant_type with
|
||||||
record
|
record
|
||||||
value : natural := 0;
|
value : natural := 0;
|
||||||
weight : natural := 0;
|
weight : natural := 0;
|
||||||
dual_wield : boolean := false;
|
dual_wield : boolean := false;
|
||||||
amount_limit : natural := 0;
|
amount_limit : natural := 0;
|
||||||
attack_range : natural_subrange := (0, 0);
|
attack_range : natural := 0;
|
||||||
distance_range : natural_subrange := (0, 0);
|
distance_range : natural := 0;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
type ammunition_variable_type is new entity_variable_type with
|
type ammunition_variable_type is new entity_variable_type with
|
||||||
record
|
record
|
||||||
amount : natural_subrange := (0, 0);
|
amount : natural := 0;
|
||||||
enchantment : natural := 0;
|
enchantment : natural := 0;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
type ammunition_constant_list is array (ammunition_list) of ammunition_constant_type;
|
type ammunition_constant_list is array (ammunition_list) of ammunition_constant_type;
|
||||||
type ammunition_variable_list is array (ammunition_mark) of ammunition_variable_type;
|
type ammunition_variable_list is array (ammunition_mark) of ammunition_variable_type;
|
||||||
|
|
||||||
ammunition_constant_data : constant ammunition_constant_list := (
|
ammunition_constant_data : constant ammunition_constant_list := (
|
||||||
(ENTITY_AMMUNITION, to_unbounded_string ("Arrows"), '^', COLOUR_RED, EFFECT_NORMAL, 11, 13, false, 23, (0, 7), (17, 67)),
|
(ENTITY_AMMUNITION, to_unbounded_string ("Arrows"), '^', COLOUR_RED, EFFECT_NORMAL, 11, 13, false, 23, 7, 67),
|
||||||
(ENTITY_AMMUNITION, to_unbounded_string ("Bolts"), '^', COLOUR_RED, EFFECT_NORMAL, 13, 23, false, 29, (0, 5), (17, 67)),
|
(ENTITY_AMMUNITION, to_unbounded_string ("Bolts"), '^', COLOUR_RED, EFFECT_NORMAL, 13, 23, false, 29, 5, 67),
|
||||||
(ENTITY_AMMUNITION, to_unbounded_string ("Slingshots"), '^', COLOUR_RED, EFFECT_NORMAL, 5, 7, true, 43, (0, 7), (17, 67)),
|
(ENTITY_AMMUNITION, to_unbounded_string ("Slingshots"), '^', COLOUR_RED, EFFECT_NORMAL, 5, 7, true, 43, 7, 67),
|
||||||
(ENTITY_AMMUNITION, to_unbounded_string ("Jarids"), '^', COLOUR_RED, EFFECT_NORMAL, 29, 37, true, 7, (0, 7), (17, 67))
|
(ENTITY_AMMUNITION, to_unbounded_string ("Jarids"), '^', COLOUR_RED, EFFECT_NORMAL, 29, 37, true, 7, 7, 67)
|
||||||
);
|
);
|
||||||
|
|
||||||
ammunition_variable_data : ammunition_variable_list;
|
ammunition_variable_data : ammunition_variable_list;
|
||||||
@ -314,12 +342,12 @@ function xabina return integer is
|
|||||||
|
|
||||||
type weapon_constant_type is new entity_constant_type with
|
type weapon_constant_type is new entity_constant_type with
|
||||||
record
|
record
|
||||||
dual_wield : boolean := false;
|
dual_wield : boolean := false;
|
||||||
value : natural := 0;
|
value : natural := 0;
|
||||||
weight : natural := 0;
|
weight : natural := 0;
|
||||||
attack_range : natural_subrange := (0, 0);
|
attack_range : natural := 0;
|
||||||
defense_range : natural_subrange := (0, 0);
|
defense_range : natural := 0;
|
||||||
distance_range : natural_subrange := (0, 0);
|
distance_range : natural := 0;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
type weapon_variable_type is new entity_variable_type with
|
type weapon_variable_type is new entity_variable_type with
|
||||||
@ -332,30 +360,30 @@ function xabina return integer is
|
|||||||
type weapon_variable_list is array (weapon_mark) of weapon_variable_type;
|
type weapon_variable_list is array (weapon_mark) of weapon_variable_type;
|
||||||
|
|
||||||
weapon_constant_data : constant weapon_constant_list := (
|
weapon_constant_data : constant weapon_constant_list := (
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Iron Sword"), 'l', COLOUR_RED, EFFECT_NORMAL, true, 11, 31, (3, 7), (0, 2), (0, 1)),
|
(ENTITY_WEAPON, to_unbounded_string ("Iron Sword"), 'l', COLOUR_RED, EFFECT_NORMAL, true, 11, 31, 7, 2, 1),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Iron Greatsword"), 'L', COLOUR_RED, EFFECT_BOLD, false, 23, 67, (5, 11), (1, 3), (0, 2)),
|
(ENTITY_WEAPON, to_unbounded_string ("Iron Greatsword"), 'L', COLOUR_RED, EFFECT_BOLD, false, 23, 67, 11, 3, 2),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Iron Axe"), 'r', COLOUR_RED, EFFECT_NORMAL, true, 13, 43, (1, 7), (0, 2), (0, 1)),
|
(ENTITY_WEAPON, to_unbounded_string ("Iron Axe"), 'r', COLOUR_RED, EFFECT_NORMAL, true, 13, 43, 7, 2, 1),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Iron Battleaxe"), 'T', COLOUR_RED, EFFECT_BOLD, false, 19, 73, (6, 13), (1, 2), (0, 2)),
|
(ENTITY_WEAPON, to_unbounded_string ("Iron Battleaxe"), 'T', COLOUR_RED, EFFECT_BOLD, false, 19, 73, 13, 2, 2),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Iron Spear"), 'I', COLOUR_RED, EFFECT_BOLD, false, 17, 53, (4, 10), (2, 4), (0, 2)),
|
(ENTITY_WEAPON, to_unbounded_string ("Iron Spear"), 'I', COLOUR_RED, EFFECT_BOLD, false, 17, 53, 10, 4, 2),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Iron Shield"), 'o', COLOUR_RED, EFFECT_NORMAL, true, 13, 37, (0, 3), (4, 9), (0, 1)),
|
(ENTITY_WEAPON, to_unbounded_string ("Iron Shield"), 'o', COLOUR_RED, EFFECT_NORMAL, true, 13, 37, 3, 9, 1),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Iron Mace"), 'i', COLOUR_RED, EFFECT_NORMAL, true, 11, 41, (3, 8), (0, 2), (0, 1)),
|
(ENTITY_WEAPON, to_unbounded_string ("Iron Mace"), 'i', COLOUR_RED, EFFECT_NORMAL, true, 11, 41, 8, 2, 1),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Iron Hammer"), 't', COLOUR_RED, EFFECT_NORMAL, true, 13, 47, (4, 7), (0, 3), (0, 1)),
|
(ENTITY_WEAPON, to_unbounded_string ("Iron Hammer"), 't', COLOUR_RED, EFFECT_NORMAL, true, 13, 47, 7, 3, 1),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Bronze Sword"), 'l', COLOUR_RED, EFFECT_NORMAL, true, 11, 31, (3, 7), (0, 2), (0, 1)),
|
(ENTITY_WEAPON, to_unbounded_string ("Bronze Sword"), 'l', COLOUR_RED, EFFECT_NORMAL, true, 11, 31, 7, 2, 1),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Bronze Greatsword"), 'L', COLOUR_RED, EFFECT_BOLD, false, 23, 67, (5, 11), (1, 3), (0, 2)),
|
(ENTITY_WEAPON, to_unbounded_string ("Bronze Greatsword"), 'L', COLOUR_RED, EFFECT_BOLD, false, 23, 67, 11, 3, 2),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Bronze Axe"), 'r', COLOUR_RED, EFFECT_NORMAL, true, 13, 43, (1, 7), (0, 2), (0, 1)),
|
(ENTITY_WEAPON, to_unbounded_string ("Bronze Axe"), 'r', COLOUR_RED, EFFECT_NORMAL, true, 13, 43, 7, 2, 1),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Bronze Battleaxe"), 'T', COLOUR_RED, EFFECT_BOLD, false, 19, 73, (6, 13), (1, 2), (0, 2)),
|
(ENTITY_WEAPON, to_unbounded_string ("Bronze Battleaxe"), 'T', COLOUR_RED, EFFECT_BOLD, false, 19, 73, 13, 2, 2),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Bronze Spear"), 'I', COLOUR_RED, EFFECT_BOLD, false, 17, 53, (4, 10), (2, 4), (0, 2)),
|
(ENTITY_WEAPON, to_unbounded_string ("Bronze Spear"), 'I', COLOUR_RED, EFFECT_BOLD, false, 17, 53, 10, 4, 2),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Bronze Shield"), 'o', COLOUR_RED, EFFECT_NORMAL, true, 13, 37, (0, 3), (4, 9), (0, 1)),
|
(ENTITY_WEAPON, to_unbounded_string ("Bronze Shield"), 'o', COLOUR_RED, EFFECT_NORMAL, true, 13, 37, 3, 9, 1),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Bronze Mace"), 'i', COLOUR_RED, EFFECT_NORMAL, true, 11, 41, (3, 8), (0, 2), (0, 1)),
|
(ENTITY_WEAPON, to_unbounded_string ("Bronze Mace"), 'i', COLOUR_RED, EFFECT_NORMAL, true, 11, 41, 8, 2, 1),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Bronze Hammer"), 't', COLOUR_RED, EFFECT_NORMAL, true, 13, 47, (4, 7), (0, 3), (0, 1)),
|
(ENTITY_WEAPON, to_unbounded_string ("Bronze Hammer"), 't', COLOUR_RED, EFFECT_NORMAL, true, 13, 47, 7, 3, 1),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Brass Sword"), 'l', COLOUR_RED, EFFECT_NORMAL, true, 11, 31, (3, 7), (0, 2), (0, 1)),
|
(ENTITY_WEAPON, to_unbounded_string ("Brass Sword"), 'l', COLOUR_RED, EFFECT_NORMAL, true, 11, 31, 7, 2, 1),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Brass Greatsword"), 'L', COLOUR_RED, EFFECT_BOLD, false, 23, 67, (5, 11), (1, 3), (0, 2)),
|
(ENTITY_WEAPON, to_unbounded_string ("Brass Greatsword"), 'L', COLOUR_RED, EFFECT_BOLD, false, 23, 67, 11, 3, 2),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Brass Axe"), 'r', COLOUR_RED, EFFECT_NORMAL, true, 13, 43, (1, 7), (0, 2), (0, 1)),
|
(ENTITY_WEAPON, to_unbounded_string ("Brass Axe"), 'r', COLOUR_RED, EFFECT_NORMAL, true, 13, 43, 7, 2, 1),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Brass Battleaxe"), 'T', COLOUR_RED, EFFECT_BOLD, false, 19, 73, (6, 13), (1, 2), (0, 2)),
|
(ENTITY_WEAPON, to_unbounded_string ("Brass Battleaxe"), 'T', COLOUR_RED, EFFECT_BOLD, false, 19, 73, 13, 2, 2),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Brass Spear"), 'I', COLOUR_RED, EFFECT_BOLD, false, 17, 53, (4, 10), (2, 4), (0, 2)),
|
(ENTITY_WEAPON, to_unbounded_string ("Brass Spear"), 'I', COLOUR_RED, EFFECT_BOLD, false, 17, 53, 10, 4, 2),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Brass Shield"), 'o', COLOUR_RED, EFFECT_NORMAL, true, 13, 37, (0, 3), (4, 9), (0, 1)),
|
(ENTITY_WEAPON, to_unbounded_string ("Brass Shield"), 'o', COLOUR_RED, EFFECT_NORMAL, true, 13, 37, 3, 9, 1),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Brass Mace"), 'i', COLOUR_RED, EFFECT_NORMAL, true, 11, 41, (3, 8), (0, 2), (0, 1)),
|
(ENTITY_WEAPON, to_unbounded_string ("Brass Mace"), 'i', COLOUR_RED, EFFECT_NORMAL, true, 11, 41, 8, 2, 1),
|
||||||
(ENTITY_WEAPON, to_unbounded_string ("Brass Hammer"), 't', COLOUR_RED, EFFECT_NORMAL, true, 13, 47, (4, 7), (0, 3), (0, 1))
|
(ENTITY_WEAPON, to_unbounded_string ("Brass Hammer"), 't', COLOUR_RED, EFFECT_NORMAL, true, 13, 47, 7, 3, 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
weapon_variable_data : weapon_variable_list;
|
weapon_variable_data : weapon_variable_list;
|
||||||
@ -372,9 +400,9 @@ function xabina return integer is
|
|||||||
|
|
||||||
type armour_constant_type is new entity_constant_type with
|
type armour_constant_type is new entity_constant_type with
|
||||||
record
|
record
|
||||||
value : natural := 0;
|
value : natural := 0;
|
||||||
weight : natural := 0;
|
weight : natural := 0;
|
||||||
defense_range : natural_subrange := (0, 0);
|
defense_range : natural := 0;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
type armour_variable_type is new entity_variable_type with
|
type armour_variable_type is new entity_variable_type with
|
||||||
@ -387,14 +415,14 @@ function xabina return integer is
|
|||||||
type armour_variable_list is array (armour_mark) of armour_variable_type;
|
type armour_variable_list is array (armour_mark) of armour_variable_type;
|
||||||
|
|
||||||
armour_constant_data : constant armour_constant_list := (
|
armour_constant_data : constant armour_constant_list := (
|
||||||
(ENTITY_ARMOUR, to_unbounded_string ("Iron Helmet"), 'm', COLOUR_YELLOW, EFFECT_NORMAL, 11, 31, (3, 7)),
|
(ENTITY_ARMOUR, to_unbounded_string ("Iron Helmet"), 'm', COLOUR_YELLOW, EFFECT_NORMAL, 11, 31, 7),
|
||||||
(ENTITY_ARMOUR, to_unbounded_string ("Iron Chestplate"), 'M', COLOUR_YELLOW, EFFECT_BOLD, 23, 67, (5, 11)),
|
(ENTITY_ARMOUR, to_unbounded_string ("Iron Chestplate"), 'M', COLOUR_YELLOW, EFFECT_BOLD, 23, 67, 11),
|
||||||
(ENTITY_ARMOUR, to_unbounded_string ("Iron Gauntlets"), 'i', COLOUR_YELLOW, EFFECT_NORMAL, 13, 43, (1, 7)),
|
(ENTITY_ARMOUR, to_unbounded_string ("Iron Gauntlets"), 'i', COLOUR_YELLOW, EFFECT_NORMAL, 13, 43, 7),
|
||||||
(ENTITY_ARMOUR, to_unbounded_string ("Iron Greaves"), 'I', COLOUR_YELLOW, EFFECT_NORMAL, 19, 73, (6, 13)),
|
(ENTITY_ARMOUR, to_unbounded_string ("Iron Greaves"), 'I', COLOUR_YELLOW, EFFECT_NORMAL, 19, 73, 13),
|
||||||
(ENTITY_ARMOUR, to_unbounded_string ("Iron Cuisse"), 'Y', COLOUR_YELLOW, EFFECT_BOLD, 17, 53, (4, 10)),
|
(ENTITY_ARMOUR, to_unbounded_string ("Iron Cuisse"), 'Y', COLOUR_YELLOW, EFFECT_BOLD, 17, 53, 10),
|
||||||
(ENTITY_ARMOUR, to_unbounded_string ("Iron Fauld"), '-', COLOUR_YELLOW, EFFECT_NORMAL, 13, 37, (0, 3)),
|
(ENTITY_ARMOUR, to_unbounded_string ("Iron Fauld"), '-', COLOUR_YELLOW, EFFECT_NORMAL, 13, 37, 3),
|
||||||
(ENTITY_ARMOUR, to_unbounded_string ("Iron Gardbrace"), 'v', COLOUR_YELLOW, EFFECT_NORMAL, 11, 41, (3, 8)),
|
(ENTITY_ARMOUR, to_unbounded_string ("Iron Gardbrace"), 'v', COLOUR_YELLOW, EFFECT_NORMAL, 11, 41, 8),
|
||||||
(ENTITY_ARMOUR, to_unbounded_string ("Iron Rerebrace"), 'V', COLOUR_YELLOW, EFFECT_NORMAL, 13, 47, (4, 7))
|
(ENTITY_ARMOUR, to_unbounded_string ("Iron Rerebrace"), 'V', COLOUR_YELLOW, EFFECT_NORMAL, 13, 47, 7)
|
||||||
);
|
);
|
||||||
|
|
||||||
armour_variable_data : armour_variable_list;
|
armour_variable_data : armour_variable_list;
|
||||||
@ -474,11 +502,11 @@ function xabina return integer is
|
|||||||
|
|
||||||
type goblin_constant_type is new entity_constant_type with
|
type goblin_constant_type is new entity_constant_type with
|
||||||
record
|
record
|
||||||
health_limit : natural := 0;
|
health_limit : natural := 0;
|
||||||
armour_limit : natural := 0;
|
armour_limit : natural := 0;
|
||||||
mana_limit : natural := 0;
|
mana_limit : natural := 0;
|
||||||
stamina_limit : natural := 0;
|
stamina_limit : natural := 0;
|
||||||
attack_range : natural_subrange := (0, 0);
|
attack_range : natural := 0;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
type goblin_variable_type is new entity_variable_type with
|
type goblin_variable_type is new entity_variable_type with
|
||||||
@ -497,30 +525,21 @@ function xabina return integer is
|
|||||||
-- Gameplay
|
-- Gameplay
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
x : natural := 0;
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- Terminal
|
-- Terminal
|
||||||
-- -- Currently constant, gonna use either my xurses library or <termios.h> C bindings.
|
-- -- Currently constant, gonna use either my xurses library or <termios.h> C bindings.
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
type procedure_pointer is access procedure;
|
||||||
|
|
||||||
|
type action_data is array (signal_list) of procedure_pointer;
|
||||||
|
|
||||||
active : boolean := true;
|
active : boolean := true;
|
||||||
button : character := character'val (0);
|
signal : character := SIGNAL_IDLE;
|
||||||
signal : signal_list := SIGNAL_IDLE;
|
|
||||||
width : natural := 120;
|
width : natural := 120;
|
||||||
height : natural := 40;
|
height : natural := 40;
|
||||||
buffer : unbounded_string := null_unbounded_string;
|
buffer : unbounded_string := null_unbounded_string;
|
||||||
|
|
||||||
--~procedure synchronize is
|
|
||||||
--~begin
|
|
||||||
--~signal := character'val (0);
|
|
||||||
--~put (to_string (buffer));
|
|
||||||
--~get_immediate (signal);
|
|
||||||
--~if signal = escape then
|
|
||||||
--~active := false;
|
|
||||||
--~end if;
|
|
||||||
--~end synchronize;
|
|
||||||
|
|
||||||
procedure action_idle is
|
procedure action_idle is
|
||||||
begin
|
begin
|
||||||
null;
|
null;
|
||||||
@ -531,25 +550,21 @@ function xabina return integer is
|
|||||||
active := false;
|
active := false;
|
||||||
end action_exit;
|
end action_exit;
|
||||||
|
|
||||||
type procedure_pointer is access procedure;
|
|
||||||
|
|
||||||
type action_data is array (signal_list) of procedure_pointer;
|
|
||||||
|
|
||||||
action_list : action_data := (others => action_idle'access);
|
action_list : action_data := (others => action_idle'access);
|
||||||
|
|
||||||
procedure bind (
|
procedure bind (
|
||||||
key : signal_list := SIGNAL_IDLE;
|
key : character := SIGNAL_IDLE;
|
||||||
act : procedure_pointer := action_idle'access
|
act : procedure_pointer := action_idle'access
|
||||||
) is
|
) is
|
||||||
begin
|
begin
|
||||||
action_list (key) := act;
|
action_list (character'pos (key)) := act;
|
||||||
end bind;
|
end bind;
|
||||||
|
|
||||||
procedure unbind (
|
procedure unbind (
|
||||||
key : signal_list := SIGNAL_IDLE
|
key : character := SIGNAL_IDLE
|
||||||
) is
|
) is
|
||||||
begin
|
begin
|
||||||
action_list (key) := action_idle'access;
|
action_list (character'pos (key)) := action_idle'access;
|
||||||
end unbind;
|
end unbind;
|
||||||
|
|
||||||
procedure action_draw is
|
procedure action_draw is
|
||||||
@ -564,69 +579,23 @@ function xabina return integer is
|
|||||||
begin
|
begin
|
||||||
|
|
||||||
bind (SIGNAL_Q, action_exit'access);
|
bind (SIGNAL_Q, action_exit'access);
|
||||||
bind (SIGNAL_D, action_draw'access);
|
bind (SIGNAL_E, action_draw'access);
|
||||||
|
|
||||||
loop
|
loop
|
||||||
exit when active = false;
|
exit when active = false;
|
||||||
buffer := to_unbounded_string (escape & "[H");
|
buffer := to_unbounded_string (escape & "[H");
|
||||||
|
signal := CANCEL;
|
||||||
for y in 1 .. height
|
for y in 1 .. height
|
||||||
loop
|
loop
|
||||||
for x in 1 .. width
|
for x in 1 .. width
|
||||||
loop
|
loop
|
||||||
buffer := buffer & format_symbol ('X', COLOUR_GREY, EFFECT_BOLD);
|
buffer := buffer & format_symbol ('X', COLOUR_GREY, EFFECT_BOLD);
|
||||||
end loop;
|
end loop;
|
||||||
buffer := buffer & character'val (13);
|
buffer := buffer & carriage_return & line_feed;
|
||||||
buffer := buffer & character'val (10);
|
|
||||||
end loop;
|
end loop;
|
||||||
button := character'val (0);
|
put (to_string (buffer)); -- still reachable
|
||||||
put (to_string (buffer));
|
get_immediate (signal);
|
||||||
get_immediate (button);
|
action_list (character'pos (signal)).all;
|
||||||
case button is
|
|
||||||
--~SIGNAL_6, SIGNAL_7, SIGNAL_8, SIGNAL_9, SIGNAL_ESCAPE, SIGNAL_TABULATOR, SIGNAL_RETURN, SIGNAL_NEW_LINE,
|
|
||||||
--~SIGNAL_SLASH, SIGNAL_BACKSLASH, SIGNAL_QUOTE, SIGNAL_BACKQUOTE, SIGNAL_SPACE, SIGNAL_BACKSPACE, SIGNAL_DOT, SIGNAL_ESCAPE
|
|
||||||
when 'a' | 'A' => signal := SIGNAL_A;
|
|
||||||
when 'b' | 'B' => signal := SIGNAL_B;
|
|
||||||
when 'c' | 'C' => signal := SIGNAL_C;
|
|
||||||
when 'd' | 'D' => signal := SIGNAL_D;
|
|
||||||
when 'e' | 'E' => signal := SIGNAL_E;
|
|
||||||
when 'f' | 'F' => signal := SIGNAL_F;
|
|
||||||
when 'g' | 'G' => signal := SIGNAL_G;
|
|
||||||
when 'h' | 'H' => signal := SIGNAL_H;
|
|
||||||
when 'i' | 'I' => signal := SIGNAL_I;
|
|
||||||
when 'j' | 'J' => signal := SIGNAL_J;
|
|
||||||
when 'k' | 'K' => signal := SIGNAL_K;
|
|
||||||
when 'l' | 'L' => signal := SIGNAL_L;
|
|
||||||
when 'm' | 'M' => signal := SIGNAL_M;
|
|
||||||
when 'n' | 'N' => signal := SIGNAL_N;
|
|
||||||
when 'o' | 'O' => signal := SIGNAL_O;
|
|
||||||
when 'p' | 'P' => signal := SIGNAL_P;
|
|
||||||
when 'q' | 'Q' => signal := SIGNAL_Q;
|
|
||||||
when 'r' | 'R' => signal := SIGNAL_R;
|
|
||||||
when 's' | 'S' => signal := SIGNAL_S;
|
|
||||||
when 't' | 'T' => signal := SIGNAL_T;
|
|
||||||
when 'u' | 'U' => signal := SIGNAL_U;
|
|
||||||
when 'v' | 'V' => signal := SIGNAL_V;
|
|
||||||
when 'w' | 'W' => signal := SIGNAL_W;
|
|
||||||
when 'x' | 'X' => signal := SIGNAL_X;
|
|
||||||
when 'y' | 'Y' => signal := SIGNAL_Y;
|
|
||||||
when 'z' | 'Z' => signal := SIGNAL_Z;
|
|
||||||
when '0' => signal := SIGNAL_0;
|
|
||||||
when '1' => signal := SIGNAL_1;
|
|
||||||
when '2' => signal := SIGNAL_2;
|
|
||||||
when '3' => signal := SIGNAL_3;
|
|
||||||
when '4' => signal := SIGNAL_4;
|
|
||||||
when '5' => signal := SIGNAL_5;
|
|
||||||
when '6' => signal := SIGNAL_6;
|
|
||||||
when '7' => signal := SIGNAL_7;
|
|
||||||
when '8' => signal := SIGNAL_8;
|
|
||||||
when '9' => signal := SIGNAL_9;
|
|
||||||
when escape => signal := SIGNAL_ESCAPE;
|
|
||||||
when others => signal := SIGNAL_IDLE;
|
|
||||||
end case;
|
|
||||||
action_list (signal).all;
|
|
||||||
if button = escape then
|
|
||||||
active := false;
|
|
||||||
end if;
|
|
||||||
end loop;
|
end loop;
|
||||||
|
|
||||||
--~for this in magic_list
|
--~for this in magic_list
|
||||||
|
Loading…
Reference in New Issue
Block a user