Added world drawing clips...
This commit is contained in:
parent
f570df92d5
commit
af9227f365
@ -31,16 +31,16 @@ package body core is
|
||||
|
||||
procedure draw_state_box (x, y : in integer) is
|
||||
begin
|
||||
render_string (c_string ("Cursor X :" & integer'image (cursor_x)), x, y + 0, 16#CCCCCC#, false);
|
||||
render_string (c_string ("Cursor Y :" & integer'image (cursor_y)), x, y + 32, 16#CCCCCC#, false);
|
||||
render_string (c_string ("Cursor Mode :" & integer'image (cursor_mode)), x, y + 64, 16#CCCCCC#, false);
|
||||
render_string (c_string ("Signal Code :" & signal_code'image (signal_code'val (signal_mode))), x, y + 96, 16#CCCCCC#, false);
|
||||
render_string (c_string ("Camera X :" & integer'image (camera.x)), x, y + 128, 16#CCCCCC#, false);
|
||||
render_string (c_string ("Camera Y :" & integer'image (camera.y)), x, y + 160, 16#CCCCCC#, false);
|
||||
render_string (c_string ("Global Time :" & integer'image (global_time)), x, y + 192, 16#CCCCCC#, false);
|
||||
render_string (c_string ("Gameplay Time :" & integer'image (gameplay_time)), x, y + 224, 16#CCCCCC#, false);
|
||||
render_string (c_string ("Animation Time :" & integer'image (animation_time)), x, y + 256, 16#CCCCCC#, false);
|
||||
render_string (c_string ("Framerate :" & integer'image (framerate)), x, y + 288, 16#CCCCCC#, false);
|
||||
render_string (c_string ("Cursor X :" & integer'image (cursor_x)), x, y + 0, 16#CCCCCC#, true);
|
||||
render_string (c_string ("Cursor Y :" & integer'image (cursor_y)), x, y + 32, 16#CCCCCC#, true);
|
||||
render_string (c_string ("Cursor Mode :" & integer'image (cursor_mode)), x, y + 64, 16#CCCCCC#, true);
|
||||
render_string (c_string ("Signal Code :" & signal_code'image (signal_code'val (signal_mode))), x, y + 96, 16#CCCCCC#, true);
|
||||
render_string (c_string ("Camera X :" & integer'image (camera.x)), x, y + 128, 16#CCCCCC#, true);
|
||||
render_string (c_string ("Camera Y :" & integer'image (camera.y)), x, y + 160, 16#CCCCCC#, true);
|
||||
render_string (c_string ("Global Time :" & integer'image (global_time)), x, y + 192, 16#CCCCCC#, true);
|
||||
render_string (c_string ("Gameplay Time :" & integer'image (gameplay_time)), x, y + 224, 16#CCCCCC#, true);
|
||||
render_string (c_string ("Animation Time :" & integer'image (animation_time)), x, y + 256, 16#CCCCCC#, true);
|
||||
render_string (c_string ("Framerate :" & integer'image (framerate)), x, y + 288, 16#CCCCCC#, true);
|
||||
end draw_state_box;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
@ -35,7 +35,7 @@ begin
|
||||
|
||||
core.fairy_synchronize (6); -- CALLING SUBROUTINE DEFINED IN FORTRAN
|
||||
|
||||
world.make (world.rough, 80, 40);
|
||||
world.make (world.swamp, 80, 40);
|
||||
|
||||
gameplay: loop
|
||||
exit when core.engine_active = false;
|
||||
@ -92,9 +92,9 @@ begin
|
||||
--~for this in magic.blizzard .. magic.winter_circle loop magic.draw (this, 112 * (magic.codex'pos (this) - magic.codex'pos (magic.time_statis)) - 60, 112 * 6 + 64); end loop;
|
||||
--
|
||||
--~for index in item.codex loop item.draw (index, 32 * (item.codex'pos (index) / 10) + 32, 32 * (item.codex'pos (index) mod 10) + 32); end loop;
|
||||
for index in attribute.codex loop attribute.draw (index, 32 * attribute.codex'pos (index) + 64, 64); end loop;
|
||||
for index in resource.codex loop resource.draw (index, 32 * resource.codex'pos (index) + 64, 96); end loop;
|
||||
for index in skill.codex loop skill.draw (index, 32 * skill.codex'pos (index) + 64, 128); end loop;
|
||||
--~for index in attribute.codex loop attribute.draw (index, 32 * attribute.codex'pos (index) + 64, 64); end loop;
|
||||
--~for index in resource.codex loop resource.draw (index, 32 * resource.codex'pos (index) + 64, 96); end loop;
|
||||
--~for index in skill.codex loop skill.draw (index, 32 * skill.codex'pos (index) + 64, 128); end loop;
|
||||
--
|
||||
core.draw_state_box (1352, 32);
|
||||
end loop gameplay;
|
||||
|
@ -116,6 +116,7 @@ extern int syntax_select (char * string, int * length);
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
|
||||
static int file_list_active = 0;
|
||||
static int file_list_count = 0;
|
||||
|
@ -41,6 +41,9 @@ package body world is
|
||||
|
||||
limit : constant limit_array := (29, 64, 70, 94, 51, 94);
|
||||
|
||||
landmark_limit : constant integer := 140;
|
||||
construction_limit : constant integer := 10;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure configure is
|
||||
@ -70,8 +73,8 @@ package body world is
|
||||
map.width := width;
|
||||
map.height := height;
|
||||
map.block := new block_array (0 .. width - 1, 0 .. height - 1);
|
||||
map.landmark := new entity_array (0 .. 24);
|
||||
map.construction := new entity_array (0 .. 11);
|
||||
map.landmark := new entity_array (0 .. landmark_limit);
|
||||
map.construction := new entity_array (0 .. construction_limit);
|
||||
--
|
||||
for x in 0 .. width - 1
|
||||
loop
|
||||
@ -81,14 +84,14 @@ package body world is
|
||||
end loop;
|
||||
end loop;
|
||||
--
|
||||
for object in 0 .. 24
|
||||
for object in 0 .. landmark_limit
|
||||
loop
|
||||
map.landmark (object).index := core.random_integer (0, limit (index));
|
||||
map.landmark (object).x := core.base * core.random_integer (1, map.width - 1);
|
||||
map.landmark (object).y := core.base * core.random_integer (1, map.height - 1);
|
||||
end loop;
|
||||
--
|
||||
for object in 0 .. 11
|
||||
for object in 0 .. construction_limit
|
||||
loop
|
||||
map.construction (object).index := core.random_integer (0, construction.codex'pos (construction.codex'last));
|
||||
map.construction (object).x := core.base * core.random_integer (1, map.width - 1);
|
||||
@ -99,8 +102,8 @@ package body world is
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw (x, y, width, height : in integer; show_grid : in boolean) is
|
||||
crop_width : constant integer := width mod core.base;
|
||||
crop_height : constant integer := height mod core.base;
|
||||
crop_width : integer := width mod core.base;
|
||||
crop_height : integer := height mod core.base;
|
||||
u, v : integer;
|
||||
begin
|
||||
for move_y in 0 .. height / core.base - 1
|
||||
@ -132,9 +135,27 @@ package body world is
|
||||
--
|
||||
core.crop (blocks, x + width - crop_width, y + height - crop_height, u, v, crop_width, crop_height);
|
||||
--
|
||||
for object in 0 .. 24
|
||||
for object in 0 .. landmark_limit
|
||||
loop
|
||||
core.draw (landmarks (map.terrain) (map.landmark (object).index), map.landmark (object).x, map.landmark (object).y);
|
||||
if map.landmark (object).x > width
|
||||
or map.landmark (object).y > height then
|
||||
goto skip_drawing_out_of_view_landmark;
|
||||
end if;
|
||||
--
|
||||
crop_width := landmarks (map.terrain) (map.landmark (object).index).width;
|
||||
crop_height := landmarks (map.terrain) (map.landmark (object).index).height;
|
||||
--
|
||||
if (map.landmark (object).x + landmarks (map.terrain) (map.landmark (object).index).width) > width then
|
||||
crop_width := crop_width - (map.landmark (object).x + landmarks (map.terrain) (map.landmark (object).index).width) mod width;
|
||||
end if;
|
||||
--
|
||||
if (map.landmark (object).y + landmarks (map.terrain) (map.landmark (object).index).height) > height then
|
||||
crop_height := crop_height - (map.landmark (object).y + landmarks (map.terrain) (map.landmark (object).index).height) mod height;
|
||||
end if;
|
||||
--
|
||||
core.crop (landmarks (map.terrain) (map.landmark (object).index), x + map.landmark (object).x, y + map.landmark (object).y, 0, 0, crop_width, crop_height);
|
||||
--
|
||||
<<skip_drawing_out_of_view_landmark>>
|
||||
end loop;
|
||||
--
|
||||
if show_grid then
|
||||
@ -142,9 +163,16 @@ package body world is
|
||||
core.hexagonal_grid (x, y, width, height, true);
|
||||
end if;
|
||||
--
|
||||
for object in 0 .. 11
|
||||
for object in 0 .. construction_limit
|
||||
loop
|
||||
if map.construction (object).x > width
|
||||
or map.construction (object).y > height then
|
||||
goto skip_drawing_out_of_view_construction;
|
||||
end if;
|
||||
--
|
||||
construction.draw (construction.codex'val (map.construction (object).index), map.construction (object).x, map.construction (object).y);
|
||||
--
|
||||
<<skip_drawing_out_of_view_construction>>
|
||||
end loop;
|
||||
end draw;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user