From a020b928247295c1d7ab2afca673a36b4cf50a03 Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Fri, 21 Feb 2025 02:00:00 +0300 Subject: [PATCH] /apps/demos/crawl: facing textures --- apps/demos/crawl/data/assets/castledoors.png | 3 +++ apps/demos/crawl/data/assets/lever.png | 3 +++ apps/demos/crawl/data/levels/00.lvl | 4 +++ apps/demos/crawl/data/scripts/render.lua | 27 ++++++++++++++++++++ 4 files changed, 37 insertions(+) create mode 100644 apps/demos/crawl/data/assets/castledoors.png create mode 100644 apps/demos/crawl/data/assets/lever.png diff --git a/apps/demos/crawl/data/assets/castledoors.png b/apps/demos/crawl/data/assets/castledoors.png new file mode 100644 index 0000000..a185564 --- /dev/null +++ b/apps/demos/crawl/data/assets/castledoors.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d62c53d1f085ce8f308aac04a14e5d7b3002e1bad7382e40814641e6dbcf2501 +size 11508 diff --git a/apps/demos/crawl/data/assets/lever.png b/apps/demos/crawl/data/assets/lever.png new file mode 100644 index 0000000..f515550 --- /dev/null +++ b/apps/demos/crawl/data/assets/lever.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:abd02981d1d72a1af4a3170432237136b94017a1ed217e66fccfb285af5519f8 +size 1020 diff --git a/apps/demos/crawl/data/levels/00.lvl b/apps/demos/crawl/data/levels/00.lvl index 8631102..1677b04 100644 --- a/apps/demos/crawl/data/levels/00.lvl +++ b/apps/demos/crawl/data/levels/00.lvl @@ -24,9 +24,13 @@ X door open_on_signal : sg_torch0 tile_texture : /assets/mossy_rock.png + face : horizon + face_texture : /assets/castledoors.png / lever on_interact_emit : sg_torch0 tile_texture : /assets/mossy_rock.png + face : observer + face_texture : /assets/lever.png @meta -- Arbitrary sections could be defined with value pairs. diff --git a/apps/demos/crawl/data/scripts/render.lua b/apps/demos/crawl/data/scripts/render.lua index f0819e1..805fb33 100644 --- a/apps/demos/crawl/data/scripts/render.lua +++ b/apps/demos/crawl/data/scripts/render.lua @@ -54,6 +54,33 @@ function render_dungeon(dungeon) texture_region = { w = 128, h = 128 }, } end + + if dungeon.grid[y][x].face_texture ~= nil then + if dungeon.grid[y][x].face == "horizon" then + draw_quad { + texture = dungeon.grid[y][x].face_texture, + v3 = { x = y * 2, y = 2, z = x * 2 + 1 }, + v2 = { x = y * 2, y = 0, z = x * 2 + 1 }, + v1 = { x = y * 2 + 2, y = 0, z = x * 2 + 1 }, + v0 = { x = y * 2 + 2, y = 2, z = x * 2 + 1 }, + texture_region = { w = 64, h = 96 }, + } + draw_quad { + texture = dungeon.grid[y][x].face_texture, + v3 = { x = y * 2 + 2, y = 2, z = x * 2 + 1 }, + v2 = { x = y * 2 + 2, y = 0, z = x * 2 + 1 }, + v1 = { x = y * 2, y = 0, z = x * 2 + 1 }, + v0 = { x = y * 2, y = 2, z = x * 2 + 1 }, + texture_region = { w = 64, h = 96 }, + } + elseif dungeon.grid[y][x].face == "observer" then + draw_billboard { + texture = dungeon.grid[y][x].face_texture, + position = { x = y * 2 + 1, y = 1, z = x * 2 + 1 }, + size = { x = 1, y = 1 }, + } + end + end end end end