Implementing HoM&M3-like water due to performance...
This commit is contained in:
parent
dc45310370
commit
c4ac4e759c
@ -16,7 +16,7 @@ package body world is
|
||||
chad_limit : constant natural := 8;
|
||||
|
||||
earth : core.sprite;
|
||||
water : core.sprite;
|
||||
--~water : core.sprite;
|
||||
dark : core.sprite;
|
||||
border_upper : core.sprite;
|
||||
border_lower : core.sprite;
|
||||
@ -34,7 +34,7 @@ package body world is
|
||||
core.echo (core.comment, "Configuring world components...");
|
||||
--
|
||||
earth := core.import_sprite (core.folder & "/game/world/terrain/earth.png", 1, 1);
|
||||
water := core.import_sprite (core.folder & "/game/world/terrain/water.png", 1, 1);
|
||||
--~water := core.import_sprite (core.folder & "/game/world/terrain/water.png", 1, 1);
|
||||
dark := core.import_sprite (core.folder & "/game/world/dark.png", 1, 1);
|
||||
border_upper := core.import_sprite (core.folder & "/game/world/frame/border_upper.png", 1, 1);
|
||||
border_lower := core.import_sprite (core.folder & "/game/world/frame/border_lower.png", 1, 1);
|
||||
@ -69,8 +69,8 @@ package body world is
|
||||
map.height := height;
|
||||
--
|
||||
map.earth := new integer_matrix (0 .. map.width - 1, 0 .. map.height - 1);
|
||||
map.water := new integer_matrix (0 .. map.width - 1, 0 .. map.height - 1);
|
||||
map.is_water := new boolean_matrix (0 .. map.width - 1, 0 .. map.height - 1);
|
||||
--~map.water := new integer_matrix (0 .. map.width - 1, 0 .. map.height - 1);
|
||||
--~map.is_water := new boolean_matrix (0 .. map.width - 1, 0 .. map.height - 1);
|
||||
map.clips := new boolean_matrix (0 .. map.width - 1, 0 .. map.height - 1);
|
||||
map.views := new boolean_matrix (0 .. map.width - 1, 0 .. map.height - 1);
|
||||
map.landmarks := new entity_array (1 .. landmark_limit);
|
||||
@ -83,13 +83,26 @@ package body world is
|
||||
for x in 0 .. width - 1 loop
|
||||
for y in 0 .. height - 1 loop
|
||||
map.earth (x, y) := (if core.random (0, 23) < 19 then core.random (0, 11) else core.random (0, 23));
|
||||
map.is_water (x, y) := (if core.random (0, 31) = 19 then true else false);
|
||||
map.water (x, y) := (if map.is_water (x, y) then core.random (0, 7) else 0);
|
||||
--~map.is_water (x, y) := (if x > 9 and x < width - 9 and y > 9 and y < height - 9 then core.random (0, 1023) = 0 else false);
|
||||
--~map.water (x, y) := (if map.is_water (x, y) then core.random (0, 7) else 0);
|
||||
map.clips (x, y) := false;
|
||||
map.views (x, y) := false;
|
||||
end loop;
|
||||
end loop;
|
||||
--
|
||||
--~for x in 9 .. width - 9 loop
|
||||
--~for y in 9 .. height - 9 loop
|
||||
--~if map.is_water (x, y) then
|
||||
--~for extend_x in -3 .. 3 loop
|
||||
--~for extend_y in -2 .. 2 loop
|
||||
--~map.is_water (extend_x + x, extend_y + y) := core.random (0, 3) /= 0;
|
||||
--~map.water (extend_x + x, extend_y + y) := (if map.is_water (extend_x + x, extend_y + y) then core.random (0, 7) else 0);
|
||||
--~end loop;
|
||||
--~end loop;
|
||||
--~end if;
|
||||
--~end loop;
|
||||
--~end loop;
|
||||
--
|
||||
for index in 1 .. landmark_limit loop
|
||||
map.landmarks (index).index := core.random (0, landmark_count - 1);
|
||||
map.landmarks (index).x := core.random (6, map.width - 6);
|
||||
@ -190,26 +203,26 @@ package body world is
|
||||
v => core.base * map.earth (horizontal, vertical),
|
||||
width => core.base,
|
||||
height => core.base);
|
||||
if map.is_water (horizontal, vertical) then
|
||||
core.draw (data => water,
|
||||
x => offset.x + (horizontal - core.camera.x) * core.base * core.zoom,
|
||||
y => offset.y + (vertical - core.camera.y) * core.base * core.zoom,
|
||||
u => core.base * biome'pos (map.kind) * 4 + (core.animation_time mod 4) * core.base,
|
||||
v => core.base * map.water (horizontal, vertical),
|
||||
width => core.base,
|
||||
height => core.base);
|
||||
end if;
|
||||
--
|
||||
if core.cursor.x > offset.x + (horizontal - core.camera.x ) * core.base * core.zoom - 6
|
||||
and core.cursor.x < offset.x + (horizontal - core.camera.x + 1) * core.base * core.zoom + 6
|
||||
and core.cursor.y > offset.y + (vertical - core.camera.y ) * core.base * core.zoom - 6
|
||||
and core.cursor.y < offset.y + (vertical - core.camera.y + 1) * core.base * core.zoom + 6
|
||||
and core.cursor_mode = 1
|
||||
and not ui.prioritize then
|
||||
core.camera.x := horizontal;
|
||||
core.camera.y := vertical;
|
||||
core.cursor_mode := 0;
|
||||
end if;
|
||||
--~if map.is_water (horizontal, vertical) then
|
||||
--~core.draw (data => water,
|
||||
--~x => offset.x + (horizontal - core.camera.x) * core.base * core.zoom,
|
||||
--~y => offset.y + (vertical - core.camera.y) * core.base * core.zoom,
|
||||
--~u => core.base * biome'pos (map.kind) * 4 + (core.animation_time mod 4) * core.base,
|
||||
--~v => core.base * map.water (horizontal, vertical),
|
||||
--~width => core.base,
|
||||
--~height => core.base);
|
||||
--~end if;
|
||||
--~--
|
||||
--~if core.cursor.x > offset.x + (horizontal - core.camera.x ) * core.base * core.zoom - 6
|
||||
--~and core.cursor.x < offset.x + (horizontal - core.camera.x + 1) * core.base * core.zoom + 6
|
||||
--~and core.cursor.y > offset.y + (vertical - core.camera.y ) * core.base * core.zoom - 6
|
||||
--~and core.cursor.y < offset.y + (vertical - core.camera.y + 1) * core.base * core.zoom + 6
|
||||
--~and core.cursor_mode = 1
|
||||
--~and not ui.prioritize then
|
||||
--~core.camera.x := horizontal;
|
||||
--~core.camera.y := vertical;
|
||||
--~core.cursor_mode := 0;
|
||||
--~end if;
|
||||
end if;
|
||||
end loop;
|
||||
end loop;
|
||||
@ -250,12 +263,7 @@ package body world is
|
||||
and map.equipments (index).y = core.camera.y
|
||||
and core.signal_code'pos (core.signal_mode) = core.signal_code'pos (core.signal_e) then
|
||||
if chad.take_equipment_item (map.chad_data (1), equipment.enumeration'val (map.equipments (index).index)) then
|
||||
--~core.echo (core.comment, "Took item: " & equipment.trait (equipment.enumeration'val (map.equipments (index).index)).name);
|
||||
--
|
||||
map.equipments (index).index := equipment.enumeration'pos (equipment.none);
|
||||
--~map.equipments (index).index := 0;
|
||||
--~else
|
||||
--~core.echo (core.warning, "Nope item: " & equipment.trait (equipment.enumeration'val (map.equipments (index).index)).name);
|
||||
end if;
|
||||
end if;
|
||||
end loop;
|
||||
|
@ -35,15 +35,15 @@ package world is
|
||||
|
||||
type integer_matrix is array (natural range <>, natural range <>) of integer;
|
||||
type boolean_matrix is array (natural range <>, natural range <>) of boolean;
|
||||
type entity_array is array (natural range <>) of entity_trait;
|
||||
type entity_array is array (natural range <>) of entity_trait;
|
||||
|
||||
type information is record
|
||||
kind : biome;
|
||||
width : natural;
|
||||
height : natural;
|
||||
earth : access integer_matrix;
|
||||
water : access integer_matrix;
|
||||
is_water : access boolean_matrix;
|
||||
--~water : access integer_matrix;
|
||||
--~is_water : access boolean_matrix;
|
||||
clips : access boolean_matrix;
|
||||
views : access boolean_matrix;
|
||||
landmarks : access entity_array;
|
||||
|
Loading…
Reference in New Issue
Block a user