Major changes done, now grinding code style...
This commit is contained in:
parent
a02d7bdbcf
commit
ac2516439d
@ -119,13 +119,15 @@ package body core is
|
|||||||
--
|
--
|
||||||
texture_count := texture_count + 1;
|
texture_count := texture_count + 1;
|
||||||
this.index := texture_count - 1;
|
this.index := texture_count - 1;
|
||||||
this.width := texture_array (this.index).width / states;
|
this.width := texture_array (this.index).width / frames;
|
||||||
this.height := texture_array (this.index).height / frames;
|
this.height := texture_array (this.index).height / states;
|
||||||
this.frames := frames;
|
this.frames := frames;
|
||||||
this.states := states;
|
this.states := states;
|
||||||
--
|
--
|
||||||
if this.width = 0 or this.height = 0 then
|
if this.width = 0 or this.height = 0 then
|
||||||
echo (failure, file_path);
|
echo (failure, "Sprite not imported: " & file_path);
|
||||||
|
else
|
||||||
|
echo (import, this.index'image & file_path & this.frames'image & this.states'image & this.width'image & this.height'image);
|
||||||
end if;
|
end if;
|
||||||
--
|
--
|
||||||
return this;
|
return this;
|
||||||
@ -171,12 +173,12 @@ package body core is
|
|||||||
state : in integer := 0) is
|
state : in integer := 0) is
|
||||||
resize : vector := (0, 0);
|
resize : vector := (0, 0);
|
||||||
begin
|
begin
|
||||||
resize.x := (if width = 0 then texture_array (data.index).width else width);
|
resize.x := (if width = 0 then data.width else width);
|
||||||
resize.y := (if height = 0 then texture_array (data.index).height else height);
|
resize.y := (if height = 0 then data.height else height);
|
||||||
--
|
--
|
||||||
ray.draw_texture (data => texture_array (data.index),
|
ray.draw_texture (data => texture_array (data.index),
|
||||||
uv => (float ((animation_time mod data.frames) * u), float (v), float (resize.x), float (resize.y)),
|
uv => (float (if u = 0 then (animation_time mod data.frames) * data.width else u), float (v), float (resize.x), float (resize.y)),
|
||||||
view => (float (x), float (y), float (resize.x) * float (zoom), float (resize.y) * float (zoom)));
|
view => (float (x), float (y), float (resize.x) * float (zoom), float (resize.y) * float (zoom)));
|
||||||
end draw;
|
end draw;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
@ -250,7 +252,7 @@ package body core is
|
|||||||
echo (comment, "-- Initializing Raylib audio device data...");
|
echo (comment, "-- Initializing Raylib audio device data...");
|
||||||
ray.open_audio_device;
|
ray.open_audio_device;
|
||||||
--
|
--
|
||||||
ray.randomization (25071997);
|
ray.randomization (19970725);
|
||||||
ray.set_target_fps (60);
|
ray.set_target_fps (60);
|
||||||
--
|
--
|
||||||
echo (success, "Initialized core components.");
|
echo (success, "Initialized core components.");
|
||||||
|
@ -20,19 +20,18 @@ package body world is
|
|||||||
|
|
||||||
type landmark_value is record
|
type landmark_value is record
|
||||||
index : landmark_index;
|
index : landmark_index;
|
||||||
x : integer;
|
x, y : integer;
|
||||||
y : integer;
|
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
type tile_array is array (natural range <>, natural range <>) of integer;
|
type tile_array is array (natural range <>, natural range <>) of integer;
|
||||||
type landmark_array is array (natural range <>) of landmark_value;
|
type landmark_array is array (natural range <>) of landmark_value;
|
||||||
|
|
||||||
type information is record
|
type information is record
|
||||||
terrain : biome;
|
kind : biome;
|
||||||
width : natural;
|
width : natural;
|
||||||
height : natural;
|
height : natural;
|
||||||
tiles : access tile_array;
|
tiles : access tile_array;
|
||||||
landmarks : access landmark_array;
|
landmarks : access landmark_array;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
@ -42,18 +41,18 @@ package body world is
|
|||||||
tiles : core.sprite;
|
tiles : core.sprite;
|
||||||
landmarks : array (landmark_index) of core.sprite;
|
landmarks : array (landmark_index) of core.sprite;
|
||||||
|
|
||||||
landmark_limit : constant integer := 7;
|
landmark_limit : constant integer := 40;
|
||||||
|
|
||||||
trait : constant array (landmark_index) of landmark_trait := (
|
trait : constant array (landmark_index) of landmark_trait := (
|
||||||
(ash, true, 1),
|
dead_tree => (ash, true, 1),
|
||||||
(swamp, true, 1),
|
mossy_rock => (swamp, true, 1),
|
||||||
(cave, true, 4),
|
palm_tree => (cave, true, 4),
|
||||||
(grass, true, 4),
|
pine_tree => (grass, true, 4),
|
||||||
(swamp, false, 4),
|
reeds => (swamp, false, 4),
|
||||||
(cave, true, 1),
|
rock => (cave, true, 1),
|
||||||
(snow, true, 4),
|
snowed_pine_tree => (snow, true, 4),
|
||||||
(snow, true, 1),
|
snowed_rock => (snow, true, 1),
|
||||||
(ash, true, 1)
|
spiky_rock => (ash, true, 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
@ -83,7 +82,7 @@ package body world is
|
|||||||
core.echo (core.comment, "-- -- Map height :" & height'image);
|
core.echo (core.comment, "-- -- Map height :" & height'image);
|
||||||
core.echo (core.comment, "-- -- Landmark count :" & landmark_limit'image);
|
core.echo (core.comment, "-- -- Landmark count :" & landmark_limit'image);
|
||||||
--
|
--
|
||||||
map.terrain := index;
|
map.kind := index;
|
||||||
map.width := width;
|
map.width := width;
|
||||||
map.height := height;
|
map.height := height;
|
||||||
map.tiles := new tile_array (0 .. width - 1, 0 .. height - 1);
|
map.tiles := new tile_array (0 .. width - 1, 0 .. height - 1);
|
||||||
@ -91,14 +90,14 @@ package body world is
|
|||||||
--
|
--
|
||||||
for x in 0 .. width - 1 loop
|
for x in 0 .. width - 1 loop
|
||||||
for y in 0 .. height - 1 loop
|
for y in 0 .. height - 1 loop
|
||||||
map.tiles (x, y) := (x * x + x * y + y * y) mod 24;
|
map.tiles (x, y) := core.random (0, 23);
|
||||||
end loop;
|
end loop;
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
for index in 1 .. landmark_limit loop
|
for index in 1 .. landmark_limit loop
|
||||||
map.landmarks (index).index := landmark_index'val (core.random (0, 8));
|
map.landmarks (index).index := landmark_index'val (core.random (0, 8));
|
||||||
map.landmarks (index).x := core.base * core.random (1, 24);
|
map.landmarks (index).x := core.base * core.random (1, 90);
|
||||||
map.landmarks (index).y := core.base * core.random (1, 24);
|
map.landmarks (index).y := core.base * core.random (1, 60);
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
core.echo (core.success, "Finished procedurally generating new map.");
|
core.echo (core.success, "Finished procedurally generating new map.");
|
||||||
@ -111,19 +110,18 @@ package body world is
|
|||||||
begin
|
begin
|
||||||
for move_y in 0 .. core.window_height / core.base / core.zoom + 1 loop
|
for move_y in 0 .. core.window_height / core.base / core.zoom + 1 loop
|
||||||
for move_x in 0 .. core.window_width / core.base / core.zoom + 1 loop
|
for move_x in 0 .. core.window_width / core.base / core.zoom + 1 loop
|
||||||
u := core.base * biome'pos (map.terrain) * 4;
|
u := core.base * biome'pos (map.kind) * 4;
|
||||||
v := core.base * map.tiles (core.camera.x + move_x, core.camera.y + move_y);
|
v := core.base * map.tiles (core.camera.x + move_x, core.camera.y + move_y);
|
||||||
--
|
--
|
||||||
core.draw (tiles, (move_x - 1) * core.base * core.zoom, (move_y - 1) * core.base * core.zoom, u, v, core.base, core.base);
|
core.draw (tiles, (move_x - 1) * core.base * core.zoom, (move_y - 1) * core.base * core.zoom, u, v, core.base, core.base);
|
||||||
end loop;
|
end loop;
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
--~for index in 1 .. landmark_limit loop
|
for index in 1 .. landmark_limit loop
|
||||||
--~core.draw (landmarks (map.landmarks (index).index),
|
core.draw (data => landmarks (map.landmarks (index).index),
|
||||||
--~map.landmarks (index).x - core.camera.x * core.base,
|
x => map.landmarks (index).x - core.camera.x * core.base,
|
||||||
--~map.landmarks (index).y - core.camera.y * core.base,
|
y => map.landmarks (index).y - core.camera.y * core.base);
|
||||||
--~x, y, core.base, core.base);
|
end loop;
|
||||||
--~end loop;
|
|
||||||
end draw;
|
end draw;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user