From 24203e09924c88d1f0059cf8f9c5c94e72bfe3a7 Mon Sep 17 00:00:00 2001 From: xolatile Date: Sun, 19 May 2024 06:43:46 -0400 Subject: [PATCH] Adding water slowly but surely... --- game/world/terrain/{terrain.png => earth.png} | Bin game/world/terrain/water.png | Bin 0 -> 5119 bytes source/core.adb | 4 ++-- source/main.adb | 8 ++------ source/world.adb | 24 +++++++++--------------- source/world.ads | 2 +- 6 files changed, 14 insertions(+), 24 deletions(-) rename game/world/terrain/{terrain.png => earth.png} (100%) create mode 100644 game/world/terrain/water.png diff --git a/game/world/terrain/terrain.png b/game/world/terrain/earth.png similarity index 100% rename from game/world/terrain/terrain.png rename to game/world/terrain/earth.png diff --git a/game/world/terrain/water.png b/game/world/terrain/water.png new file mode 100644 index 0000000000000000000000000000000000000000..8b6d3771ef120b4920e2aa5a893a3e26692cfc06 GIT binary patch literal 5119 zcmc&&c|4Ts+ka*zM4^a~tz#)MA*m!wltQ6IF|t&aLzZT;4~A2RYEa4^LnTH@_H}Tw zRhV%YTb7YM%S>aNkumd|p;W*3^Zxbz@y_#k=Dx1$`@NUvzMlKKulu=YVRnX}Pl68s z0Dj}Mr!E2j2*tjEt=w!&rGKU?yWsUXYl8rQgL0f36p*Fo2LQqa#-~nR3ivcPIOn@Z zOX#jsiuh|oN4}OF#Y#7~4(u4)@nV-)gyma<_Lp@#4)2|1&P&1+E2(|_V8W^gzM#EL z!h{CSG5FlFI{vk`zTv4LB@$b4PMR5pw`^v`%E++)d*)_{R2e}4V2>n;2;f!MRCxSX zR8+G=Ym#+zTd>dR{&ba|m{P-Kx=OwjZ>Kb7JZO4ql{8hvZ~-W!1X?}bob=#y@SJ!7 zChHy+Sp{XScIMd?_oVM!wXse5IA^^~QGXWl06o(!%Zw-Zuk_4Q29{QW3*7Q`HTCqrRo{j!2&hF?X8NC(_RCpvg`LD@FzHSYm_NXXz1=D9O5k z&n=*HQnix$+b)y{>iIL4KWE2~bQz;aR%cx(tK z&F0yYhH}Tbf(F5r>AD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rCx;&)VA3;AcntpTJ z1VYI76xBhPL2?;}+-Ic>vzFH|?Cnh9*GYi!dNdXiI$Y=CHGV5f;d zo%a*PhcY3I&-1!8I<2DFff<+-#8_xyZ+>QEb+7Q|RWin$;QK|8+Bk<4{u+)u?7S^QJ+KtB1Y zcr$W;DhS4-AO1p))Vcvb=CxTmO#Zu9^)PhOPp2Tzzd9vMW7AuYqkH-+T?xs}Gqc#D z$<|SJI0IT6NUKH_FeN?OkW2`2+4>^^M>`{fsfve7Uq_OEs`Knn_HXl~R~BO+IE+Y* ztHa#&>1G#kb;7Y2P2Si4|1L>_Gf3s8byvX}vHppusx2%jc`@%g{C zn~jMW)@OTw2EGyPuZju=36Qx0h*WDfPl-LW|B>4Np6LIsIVv*+GkvbU4g51ciSty( Mr_D~iF>s9d5BJuVrT_o{ literal 0 HcmV?d00001 diff --git a/source/core.adb b/source/core.adb index 936f52d..63ef1fe 100644 --- a/source/core.adb +++ b/source/core.adb @@ -292,8 +292,8 @@ package body core is new_tint : ray.colour := (ray.colour_range (tint.r), ray.colour_range (tint.g), ray.colour_range (tint.b), ray.colour_range (tint.a)); begin ray.draw_texture (data => texture_array (data.index), - uv => (x => float (if u > 0 then u else (animation_time mod data.frames) * data.width), - y => float (animation'pos (state) * data.height), + uv => (x => float (if u > 0 then u else (animation_time mod data.frames) * data.width), + y => float (if v > 0 then v else (animation'pos (state) mod data.states) * data.height), width => new_width, height => new_height), view => (x => float (x), diff --git a/source/main.adb b/source/main.adb index ee80e89..de0979b 100644 --- a/source/main.adb +++ b/source/main.adb @@ -217,7 +217,7 @@ begin world.configure; --~ai.configure; - world.make (world.grass, 240, 180); + world.make (world.swamp, 240, 180); world.add_chad (player, (0, 0, 0)); @@ -314,11 +314,7 @@ begin view_show (index)); end loop; -- - resource.draw_points (player.resources, (preview_width - 4 * icon * resource.count) / 2, (if view_list (map_preview_panel) then icon else 0)); - ui.draw_fill_bar ((preview_width - 320) / 2, 4 * (if view_list (map_preview_panel) then icon else 0), 320, 0.0); - ui.draw_tiny_fill_bar ((preview_width - 160) / 2, 5 * (if view_list (map_preview_panel) then icon else 0), 160, 0.3, (255, 255, 0, 255)); - ui.draw_fill_bar ((preview_width - 320) / 2 + 400, 4 * (if view_list (map_preview_panel) then icon else 0), 320, 0.6); - ui.draw_tiny_fill_bar ((preview_width - 160) / 2 + 400, 5 * (if view_list (map_preview_panel) then icon else 0), 160, 0.6, (255, 0, 255, 255)); + resource.draw_points (player.resources, (preview_width - 4 * icon * resource.count) / 2, (if view_list (map_preview_panel) then icon else 0)); -- signal_list (signal_mode).all; -- diff --git a/source/world.adb b/source/world.adb index 69d378a..4a3e4f0 100644 --- a/source/world.adb +++ b/source/world.adb @@ -15,7 +15,7 @@ package body world is unit_limit : constant natural := 600; chad_limit : constant natural := 8; - tiles : core.sprite; + earth : core.sprite; dark : core.sprite; border_upper : core.sprite; border_lower : core.sprite; @@ -32,7 +32,7 @@ package body world is begin core.echo (core.comment, "Configuring world components..."); -- - tiles := core.import_sprite (core.folder & "/game/world/terrain/terrain.png", 1, 1); + earth := core.import_sprite (core.folder & "/game/world/terrain/earth.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); @@ -66,7 +66,7 @@ package body world is map.width := width; map.height := height; -- - map.tiles := new tile_array (0 .. map.width - 1, 0 .. map.height - 1); + map.earth := new tile_array (0 .. map.width - 1, 0 .. map.height - 1); map.clips := new clip_array (0 .. map.width - 1, 0 .. map.height - 1); map.views := new view_array (0 .. map.width - 1, 0 .. map.height - 1); map.landmarks := new entity_array (1 .. landmark_limit); @@ -78,7 +78,7 @@ package body world is -- for x in 0 .. width - 1 loop for y in 0 .. height - 1 loop - map.tiles (x, y) := (if core.random (0, 23) < 20 then 0 else core.random (0, 23)); + map.earth (x, y) := (if core.random (0, 23) < 17 then 0 else core.random (0, 23)); map.clips (x, y) := false; map.views (x, y) := false; end loop; @@ -138,9 +138,6 @@ package body world is ------------------------------------------------------------------------------------------ procedure draw is - u : integer := 0; - v : integer := 0; - -- offset : core.vector := ((core.window_width - core.base) / 2, (core.window_height - core.base) / 2); begin @@ -180,14 +177,11 @@ package body world is exit when offset.x + (horizontal - core.camera.x) * core.base * core.zoom > core.window_width; -- if map.views (horizontal, vertical) then - u := core.base * biome'pos (map.kind) * 4; - v := core.base * map.tiles (horizontal, vertical); - -- - core.draw (data => tiles, + core.draw (data => earth, x => offset.x + (horizontal - core.camera.x) * core.base * core.zoom, y => offset.y + (vertical - core.camera.y) * core.base * core.zoom, - u => u, - v => v, + u => core.base * biome'pos (map.kind) * 4, + v => core.base * map.earth (horizontal, vertical), width => core.base, height => core.base); if core.cursor.x > offset.x + (horizontal - core.camera.x ) * core.base * core.zoom - 6 @@ -281,11 +275,11 @@ package body world is -- for vertical in 0 .. map.height - 1 loop for horizontal in 0 .. map.width - 1 loop - core.render_image (data => tiles, + core.render_image (data => earth, x => horizontal * core.base, y => vertical * core.base, u => core.base * biome'pos (map.kind) * 4, - v => core.base * map.tiles (horizontal, vertical), + v => core.base * map.earth (horizontal, vertical), width => core.base, height => core.base); end loop; diff --git a/source/world.ads b/source/world.ads index 9a7ad91..463fa17 100644 --- a/source/world.ads +++ b/source/world.ads @@ -42,7 +42,7 @@ package world is kind : biome; width : natural; height : natural; - tiles : access tile_array; + earth : access tile_array; clips : access clip_array; views : access view_array; landmarks : access entity_array;