/apps/demos/crawl: dont scale by 2

This commit is contained in:
veclavtalica 2025-02-23 17:28:45 +03:00
parent 9134e51817
commit d2938da8e2
2 changed files with 37 additions and 37 deletions

View File

@ -57,9 +57,9 @@ function game_tick()
draw_camera { draw_camera {
position = { position = {
x = ctx.udata.player.position_lerp.y * 2 + 1 - ctx.udata.player.direction.x / 2, x = ctx.udata.player.position_lerp.y + 0.5 - ctx.udata.player.direction.x / 2,
y = 1, y = 0.5,
z = ctx.udata.player.position_lerp.x * 2 + 1 - ctx.udata.player.direction.z / 2, z = ctx.udata.player.position_lerp.x + 0.5 - ctx.udata.player.direction.z / 2,
}, },
direction = ctx.udata.player.direction_lerp, direction = ctx.udata.player.direction_lerp,
} }

View File

@ -5,52 +5,52 @@ function render_dungeon(dungeon)
if dungeon.grid[y][x].wall_texture ~= nil then if dungeon.grid[y][x].wall_texture ~= nil then
draw_quad { draw_quad {
texture = dungeon.grid[y][x].wall_texture, texture = dungeon.grid[y][x].wall_texture,
v3 = { x = y * 2, y = 2, z = x * 2 }, v3 = { x = y, y = 1, z = x },
v2 = { x = y * 2, y = 0, z = x * 2 }, v2 = { x = y, y = 0, z = x },
v1 = { x = y * 2 + 2, y = 0, z = x * 2 }, v1 = { x = y + 1, y = 0, z = x },
v0 = { x = y * 2 + 2, y = 2, z = x * 2 }, v0 = { x = y + 1, y = 1, z = x },
texture_region = { w = 128, h = 128 }, texture_region = { w = 128, h = 128 },
} }
draw_quad { draw_quad {
texture = dungeon.grid[y][x].wall_texture, texture = dungeon.grid[y][x].wall_texture,
v3 = { x = y * 2 + 2, y = 2, z = x * 2 }, v3 = { x = y + 1, y = 1, z = x },
v2 = { x = y * 2 + 2, y = 0, z = x * 2 }, v2 = { x = y + 1, y = 0, z = x },
v1 = { x = y * 2 + 2, y = 0, z = x * 2 + 2 }, v1 = { x = y + 1, y = 0, z = x + 1 },
v0 = { x = y * 2 + 2, y = 2, z = x * 2 + 2 }, v0 = { x = y + 1, y = 1, z = x + 1 },
texture_region = { w = 128, h = 128 }, texture_region = { w = 128, h = 128 },
} }
draw_quad { draw_quad {
texture = dungeon.grid[y][x].wall_texture, texture = dungeon.grid[y][x].wall_texture,
v3 = { x = y * 2 + 2, y = 2, z = x * 2 + 2 }, v3 = { x = y + 1, y = 1, z = x + 1 },
v2 = { x = y * 2 + 2, y = 0, z = x * 2 + 2 }, v2 = { x = y + 1, y = 0, z = x + 1 },
v1 = { x = y * 2, y = 0, z = x * 2 + 2 }, v1 = { x = y, y = 0, z = x + 1 },
v0 = { x = y * 2, y = 2, z = x * 2 + 2 }, v0 = { x = y, y = 1, z = x + 1 },
texture_region = { w = 128, h = 128 }, texture_region = { w = 128, h = 128 },
} }
draw_quad { draw_quad {
texture = dungeon.grid[y][x].wall_texture, texture = dungeon.grid[y][x].wall_texture,
v3 = { x = y * 2, y = 2, z = x * 2 + 2 }, v3 = { x = y, y = 1, z = x + 1 },
v2 = { x = y * 2, y = 0, z = x * 2 + 2 }, v2 = { x = y, y = 0, z = x + 1 },
v1 = { x = y * 2, y = 0, z = x * 2 }, v1 = { x = y, y = 0, z = x },
v0 = { x = y * 2, y = 2, z = x * 2 }, v0 = { x = y, y = 1, z = x },
texture_region = { w = 128, h = 128 }, texture_region = { w = 128, h = 128 },
} }
elseif dungeon.grid[y][x].tile_texture ~= nil then elseif dungeon.grid[y][x].tile_texture ~= nil then
draw_quad { draw_quad {
texture = dungeon.grid[y][x].tile_texture, texture = dungeon.grid[y][x].tile_texture,
v0 = { x = y * 2 + 2, y = 0, z = x * 2 }, v0 = { x = y + 1, y = 0, z = x },
v1 = { x = y * 2, y = 0, z = x * 2 }, v1 = { x = y, y = 0, z = x },
v2 = { x = y * 2, y = 0, z = x * 2 + 2 }, v2 = { x = y, y = 0, z = x + 1 },
v3 = { x = y * 2 + 2, y = 0, z = x * 2 + 2}, v3 = { x = y + 1, y = 0, z = x + 1},
texture_region = { w = 128, h = 128 }, texture_region = { w = 128, h = 128 },
} }
draw_quad { draw_quad {
texture = dungeon.grid[y][x].tile_texture, texture = dungeon.grid[y][x].tile_texture,
v3 = { x = y * 2 + 2, y = 2, z = x * 2 }, v3 = { x = y + 1, y = 1, z = x },
v2 = { x = y * 2, y = 2, z = x * 2 }, v2 = { x = y, y = 1, z = x },
v1 = { x = y * 2, y = 2, z = x * 2 + 2 }, v1 = { x = y, y = 1, z = x + 1 },
v0 = { x = y * 2 + 2, y = 2, z = x * 2 + 2}, v0 = { x = y + 1, y = 1, z = x + 1},
texture_region = { w = 128, h = 128 }, texture_region = { w = 128, h = 128 },
} }
end end
@ -59,25 +59,25 @@ function render_dungeon(dungeon)
if dungeon.grid[y][x].face == "horizon" then if dungeon.grid[y][x].face == "horizon" then
draw_quad { draw_quad {
texture = dungeon.grid[y][x].face_texture, texture = dungeon.grid[y][x].face_texture,
v3 = { x = y * 2, y = 2, z = x * 2 + 1 }, v3 = { x = y, y = 1, z = x + 1 },
v2 = { x = y * 2, y = 0, z = x * 2 + 1 }, v2 = { x = y, y = 0, z = x + 1 },
v1 = { x = y * 2 + 2, y = 0, z = x * 2 + 1 }, v1 = { x = y + 1, y = 0, z = x + 1 },
v0 = { x = y * 2 + 2, y = 2, z = x * 2 + 1 }, v0 = { x = y + 1, y = 1, z = x + 1 },
texture_region = { w = 64, h = 96 }, texture_region = { w = 64, h = 96 },
} }
draw_quad { draw_quad {
texture = dungeon.grid[y][x].face_texture, texture = dungeon.grid[y][x].face_texture,
v3 = { x = y * 2 + 2, y = 2, z = x * 2 + 1 }, v3 = { x = y + 1, y = 1, z = x + 1 },
v2 = { x = y * 2 + 2, y = 0, z = x * 2 + 1 }, v2 = { x = y + 1, y = 0, z = x + 1 },
v1 = { x = y * 2, y = 0, z = x * 2 + 1 }, v1 = { x = y, y = 0, z = x + 1 },
v0 = { x = y * 2, y = 2, z = x * 2 + 1 }, v0 = { x = y, y = 1, z = x + 1 },
texture_region = { w = 64, h = 96 }, texture_region = { w = 64, h = 96 },
} }
elseif dungeon.grid[y][x].face == "observer" then elseif dungeon.grid[y][x].face == "observer" then
draw_billboard { draw_billboard {
texture = dungeon.grid[y][x].face_texture, texture = dungeon.grid[y][x].face_texture,
position = { x = y * 2 + 1, y = 1, z = x * 2 + 1 }, position = { x = y + 0.5, y = 0.5, z = x + 0.5 },
size = { x = 1, y = 1 }, size = { x = 0.5, y = 0.5 },
} }
end end
end end