I am very proud of myself at this point...
This commit is contained in:
parent
816189bc09
commit
9750d2709c
52
xabina.adb
52
xabina.adb
@ -89,7 +89,8 @@ function xabina return integer is
|
|||||||
collide : boolean := false;
|
collide : boolean := false;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
type map_constant_list is array (map_list) of map_constant_type;
|
type map_constant_list is array (map_list) of map_constant_type;
|
||||||
|
type map_variable_list is array (map_height, map_width) of map_list;
|
||||||
|
|
||||||
map_constant_data : constant map_constant_list := (
|
map_constant_data : constant map_constant_list := (
|
||||||
(ENTITY_MAP, to_unbounded_string ("Stone Wall"), '#', COLOUR_GREY, EFFECT_BOLD, true),
|
(ENTITY_MAP, to_unbounded_string ("Stone Wall"), '#', COLOUR_GREY, EFFECT_BOLD, true),
|
||||||
@ -102,6 +103,19 @@ function xabina return integer is
|
|||||||
(ENTITY_MAP, to_unbounded_string ("Swamp (deep)"), '~', COLOUR_GREEN, EFFECT_BOLD, true)
|
(ENTITY_MAP, to_unbounded_string ("Swamp (deep)"), '~', COLOUR_GREEN, EFFECT_BOLD, true)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
map_variable_data : map_variable_list;
|
||||||
|
|
||||||
|
procedure generate_map is
|
||||||
|
begin
|
||||||
|
for y in map_height
|
||||||
|
loop
|
||||||
|
for x in map_width
|
||||||
|
loop
|
||||||
|
map_variable_data (y, x) := WOODEN_FLOOR;
|
||||||
|
end loop;
|
||||||
|
end loop;
|
||||||
|
end generate_map;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- Item
|
-- Item
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -519,7 +533,7 @@ function xabina return integer is
|
|||||||
procedure render_screen_delete is begin put (ESCAPE & "[2J"); end render_screen_delete;
|
procedure render_screen_delete is begin put (ESCAPE & "[2J"); end render_screen_delete;
|
||||||
procedure render_screen_offset is begin put (ESCAPE & "[H"); end render_screen_offset;
|
procedure render_screen_offset is begin put (ESCAPE & "[H"); end render_screen_offset;
|
||||||
procedure render_cursor_hide is begin put (ESCAPE & "[?25l"); end render_cursor_hide;
|
procedure render_cursor_hide is begin put (ESCAPE & "[?25l"); end render_cursor_hide;
|
||||||
procedure render_cursor_show is begin put (ESCAPE & "[?25l"); end render_cursor_show;
|
procedure render_cursor_show is begin put (ESCAPE & "[?25h"); end render_cursor_show;
|
||||||
procedure render_realignment is begin put (CARRIAGE_RETURN & LINE_FEED); end render_realignment;
|
procedure render_realignment is begin put (CARRIAGE_RETURN & LINE_FEED); end render_realignment;
|
||||||
|
|
||||||
procedure render_character (symbol : character := ' ';
|
procedure render_character (symbol : character := ' ';
|
||||||
@ -557,6 +571,28 @@ function xabina return integer is
|
|||||||
screen_effect (y, x) := effect;
|
screen_effect (y, x) := effect;
|
||||||
end insert_character;
|
end insert_character;
|
||||||
|
|
||||||
|
procedure insert_map is
|
||||||
|
symbol : character := ' ';
|
||||||
|
colour : character := COLOUR_WHITE;
|
||||||
|
effect : character := EFFECT_NORMAL;
|
||||||
|
begin
|
||||||
|
for y in screen_height
|
||||||
|
loop
|
||||||
|
for x in screen_width
|
||||||
|
loop
|
||||||
|
symbol := map_constant_data (map_variable_data (map_height (y), map_width (x))).symbol;
|
||||||
|
colour := map_constant_data (map_variable_data (map_height (y), map_width (x))).colour;
|
||||||
|
effect := map_constant_data (map_variable_data (map_height (y), map_width (x))).effect;
|
||||||
|
insert_character (symbol, colour, effect, y, x);
|
||||||
|
end loop;
|
||||||
|
end loop;
|
||||||
|
end insert_map;
|
||||||
|
|
||||||
|
procedure insert_player is
|
||||||
|
begin
|
||||||
|
insert_character ('@', COLOUR_CYAN, EFFECT_BOLD, screen_height (player.y), screen_width (player.x));
|
||||||
|
end insert_player;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- Main
|
-- Main
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -573,17 +609,13 @@ begin
|
|||||||
render_screen_offset;
|
render_screen_offset;
|
||||||
render_cursor_hide;
|
render_cursor_hide;
|
||||||
|
|
||||||
|
generate_map;
|
||||||
|
|
||||||
loop
|
loop
|
||||||
exit when active = false;
|
exit when active = false;
|
||||||
signal := CANCEL;
|
signal := CANCEL;
|
||||||
for y in screen_height
|
insert_map;
|
||||||
loop
|
insert_player;
|
||||||
for x in screen_width
|
|
||||||
loop
|
|
||||||
insert_character ('.', COLOUR_GREY, EFFECT_BOLD, y, x);
|
|
||||||
end loop;
|
|
||||||
end loop;
|
|
||||||
insert_character ('@', COLOUR_CYAN, EFFECT_BOLD, screen_height (player.y), screen_width (player.x));
|
|
||||||
render_screen;
|
render_screen;
|
||||||
get_immediate (signal);
|
get_immediate (signal);
|
||||||
action_list (character'pos (signal)).all;
|
action_list (character'pos (signal)).all;
|
||||||
|
Loading…
Reference in New Issue
Block a user