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...
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

141 рядки
5.4KB

  1. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  2. -- Copyright (c) 2023 - Ognjen 'xolatile' Milan Robovic
  3. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  4. -- 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
  5. -- 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
  6. -- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  7. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  8. with ada.text_io;
  9. package core is
  10. ------------------------------------------------------------------------------------------
  11. type screen_width is mod 120;
  12. type screen_height is mod 40;
  13. type screen_matrix is array (screen_height, screen_width) of character;
  14. ------------------------------------------------------------------------------------------
  15. type colour_type is
  16. record
  17. grey : character := '0';
  18. red : character := '1';
  19. green : character := '2';
  20. yellow : character := '3';
  21. blue : character := '4';
  22. pink : character := '5';
  23. cyan : character := '6';
  24. white : character := '7';
  25. end record;
  26. type effect_type is
  27. record
  28. normal : character := '0';
  29. bold : character := '1';
  30. italic : character := '3';
  31. underline : character := '4';
  32. blink : character := '5';
  33. contra : character := '7';
  34. end record;
  35. cancel : constant character := character'val (24);
  36. carriage_return : constant character := character'val (10);
  37. line_feed : constant character := character'val (13);
  38. escape : constant character := character'val (27);
  39. ------------------------------------------------------------------------------------------
  40. type description is new string (1 .. 144);
  41. type list is (
  42. none, menu, map, item, magic, ammunition, weapon, armour,
  43. scroll, potion, consumable, note, plant, animal, monster, player
  44. );
  45. ------------------------------------------------------------------------------------------
  46. type constant_type is tagged
  47. record
  48. entity : list := core.none; -- Entity identifier.
  49. name : string (1 .. 20) := "- "; -- Entity general name.
  50. symbol : character := ' '; -- Entity ASCII character representation.
  51. colour : character := '7'; -- Entity VT100 escape sequence colour.
  52. effect : character := '0'; -- Entity VT100 escape sequence effect.
  53. end record;
  54. type variable_type is tagged
  55. record
  56. y : integer := 0; -- Global Y coordinate.
  57. x : integer := 0; -- Global X coordinate.
  58. end record;
  59. ------------------------------------------------------------------------------------------
  60. type soul_type is
  61. record
  62. envy : natural := 0;
  63. gluttony : natural := 0;
  64. greed : natural := 0;
  65. lust : natural := 0;
  66. pride : natural := 0;
  67. sloth : natural := 0;
  68. wrath : natural := 0;
  69. end record;
  70. type health_type is
  71. record
  72. head : natural := 0;
  73. chest : natural := 0;
  74. stomach : natural := 0;
  75. left_arm : natural := 0;
  76. right_arm : natural := 0;
  77. left_leg : natural := 0;
  78. right_leg : natural := 0;
  79. end record;
  80. type mana_type is
  81. record
  82. stamina : natural := 0;
  83. fear : natural := 0;
  84. pain : natural := 0;
  85. thirst : natural := 0;
  86. hunger : natural := 0;
  87. exhaustion : natural := 0;
  88. solitude : natural := 0;
  89. end record;
  90. ------------------------------------------------------------------------------------------
  91. colour : colour_type;
  92. effect : effect_type;
  93. screen_symbol : screen_matrix := (others => (others => cancel));
  94. screen_colour : screen_matrix := (others => (others => colour.white));
  95. screen_effect : screen_matrix := (others => (others => effect.normal));
  96. ------------------------------------------------------------------------------------------
  97. function randomize (minimum : natural;
  98. maximum : natural) return natural;
  99. procedure screen_delete;
  100. procedure screen_offset;
  101. procedure screen_hide_cursor;
  102. procedure screen_show_cursor;
  103. procedure screen_new_line;
  104. procedure render_character (symbol : character;
  105. colour : character;
  106. effect : character;
  107. y : screen_height;
  108. x : screen_width);
  109. procedure render_buffer;
  110. ------------------------------------------------------------------------------------------
  111. end core;