Skip to content
Snippets Groups Projects
Commit d489fdd3 authored by dg's avatar dg
Browse files

better abashed tiles

git-svn-id: http://svn.net-core.org/repos/t-engine4@3434 51575b47-30f0-44d4-a5cc-537603b46e54
parent beac243c
No related branches found
No related tags found
No related merge requests found
Showing
with 66 additions and 23 deletions
......@@ -98,28 +98,22 @@ function _M:addPond(x, y, spots)
end
-- Smooth the pond
for i = 1, self.do_ponds.size.w do
for j = 1, self.do_ponds.size.h do
if not pmap[i][j] then
local nb = 0
for ii = -1, 1 do for jj = -1, 1 do if (ii ~= 0 or jj ~= 0) and pmap[i+ii] then
if pmap[i+ii][j+jj] then nb = nb + 1 end
end end end
if nb >= 4 then pmap[i][j] = self.do_ponds.pond[1][2] end
end
end
end
for i = 1, self.do_ponds.size.w do
for j = 1, self.do_ponds.size.h do
if pmap[i][j] then
local nb = 0
for ii = -1, 1 do for jj = -1, 1 do if (ii ~= 0 or jj ~= 0) and pmap[i+ii] then
if pmap[i+ii][j+jj] then nb = nb + 1 end
end end end
if nb <= 3 then pmap[i][j] = nil end
end
for i = 1, self.do_ponds.size.w do for j = 1, self.do_ponds.size.h do
local g1 = pmap[i-1] and pmap[i-1][j+1]
local g2 = pmap[i] and pmap[i][j+1]
local g3 = pmap[i+1] and pmap[i+1][j+1]
local g4 = pmap[i-1] and pmap[i-1][j]
local g6 = pmap[i+1] and pmap[i+1][j]
local g7 = pmap[i-1] and pmap[i-1][j-1]
local g8 = pmap[i] and pmap[i][j-1]
local g9 = pmap[i+1] and pmap[i+1][j-1]
if not g8 and not g4 and not g6 and g2 then pmap[i][j] = nil
elseif not g2 and not g4 and not g6 and g8 then pmap[i][j] = nil
elseif not g6 and not g2 and not g8 and g4 then pmap[i][j] = nil
elseif not g4 and not g2 and not g8 and g6 then pmap[i][j] = nil
end
end
end end
-- Draw the pond
for i = 1, self.do_ponds.size.w do
......
......@@ -116,6 +116,23 @@ function _M:makePod(x, y, radius, room_id, data)
for i = -radius + y, radius + y do
quadrant(-radius + x, i)
end
for i = -radius + x, radius + x do for j = -radius + y, radius + y do
local g1 = self.map.room_map[i-1] and self.map.room_map[i-1][j+1].room == room_id
local g2 = self.map.room_map[i] and self.map.room_map[i][j+1].room == room_id
local g3 = self.map.room_map[i+1] and self.map.room_map[i+1][j+1].room == room_id
local g4 = self.map.room_map[i-1] and self.map.room_map[i-1][j].room == room_id
local g6 = self.map.room_map[i+1] and self.map.room_map[i+1][j].room == room_id
local g7 = self.map.room_map[i-1] and self.map.room_map[i-1][j-1].room == room_id
local g8 = self.map.room_map[i] and self.map.room_map[i][j-1].room == room_id
local g9 = self.map.room_map[i+1] and self.map.room_map[i+1][j-1].room == room_id
if not g8 and not g4 and not g6 and g2 then self.map(i, j, Map.TERRAIN, self:resolve('#')) self.map.room_map[i][j].room = nil
elseif not g2 and not g4 and not g6 and g8 then self.map(i, j, Map.TERRAIN, self:resolve('#')) self.map.room_map[i][j].room = nil
elseif not g6 and not g2 and not g8 and g4 then self.map(i, j, Map.TERRAIN, self:resolve('#')) self.map.room_map[i][j].room = nil
elseif not g4 and not g2 and not g8 and g6 then self.map(i, j, Map.TERRAIN, self:resolve('#')) self.map.room_map[i][j].room = nil
end
end end
end
......
......@@ -524,6 +524,7 @@ function _M:changeLevel(lev, zone, keep_old_lev, force_down)
-- Post process walls
self.nicer_tiles:postProcessLevelTiles(self.level)
self.nicer_tiles:postProcessLevelTiles(self.level)
-- Check if we need to switch the current guardian
self.state:zoneCheckBackupGuardian()
......
......@@ -212,6 +212,10 @@ function _M:niceTileGrassSand(level, i, j, g, nt)
self:niceTileGenericBorders(level, i, j, g, nt, "sand", {grass=true})
end
function _M:niceTileOuterSpace(level, i, j, g, nt)
self:niceTileGenericBorders(level, i, j, g, nt, "rocks", {void=true})
end
-- This array is precomputed, it holds the possible combinations of walls and the nice tile they generate
-- The data is bit-encoded
local full_wall3d = {
......
......@@ -29,7 +29,8 @@ newEntity{
}
newEntity{
define_as = "VOID_WALL",
define_as = "OUTERSPACE",
type = "void", subtype = "void",
name = "void",
display = ' ',
_noalpha = false,
......@@ -57,3 +58,29 @@ newEntity{
does_block_move = true,
_noalpha = false,
}
-----------------------------------------
-- Floating platforms
-----------------------------------------
newEntity{
define_as = "FLOATING_ROCKS",
type = "floor", subtype = "rocks",
name = "floating rocks", image = "terrain/floating_rocks05_01.png",
display = '.', color_r=255, color_g=255, color_b=255,
_noalpha = false,
nice_tiler = { method="outerSpace",
replace_wrong="OUTERSPACE",
rocks="FLOATING_ROCKS_5",
void8={"FLOATING_ROCKS_8", 100, 1, 1}, void2={"FLOATING_ROCKS_2", 100, 1, 1}, void4={"FLOATING_ROCKS_4", 100, 1, 1}, void6={"FLOATING_ROCKS_6", 100, 1, 1}, void1={"FLOATING_ROCKS_1", 100, 1, 1}, void3={"FLOATING_ROCKS_3", 100, 1, 1}, void7={"FLOATING_ROCKS_7", 100, 1, 1}, void9={"FLOATING_ROCKS_9", 100, 1, 1}, inner_void1="FLOATING_ROCKS_1I", inner_void3="FLOATING_ROCKS_3I", inner_void7="FLOATING_ROCKS_7I", inner_void9="FLOATING_ROCKS_9I",
},
}
newEntity{base="FLOATING_ROCKS", define_as = "FLOATING_ROCKS_5", image="terrain/floating_rocks05_01.png"}
for i = 1, 9 do for j = 1, 1 do
if i ~= 5 then newEntity{base="FLOATING_ROCKS", define_as = "FLOATING_ROCKS_"..i..j, image="terrain/floating_rocks0"..i.."_0"..j..".png"} end
end end
newEntity{base="FLOATING_ROCKS", define_as = "FLOATING_ROCKS_1I", image="terrain/floating_rocks_inner01_01.png"}
newEntity{base="FLOATING_ROCKS", define_as = "FLOATING_ROCKS_3I", image="terrain/floating_rocks_inner03_01.png"}
newEntity{base="FLOATING_ROCKS", define_as = "FLOATING_ROCKS_7I", image="terrain/floating_rocks_inner07_01.png"}
newEntity{base="FLOATING_ROCKS", define_as = "FLOATING_ROCKS_9I", image="terrain/floating_rocks_inner09_01.png"}
......@@ -42,7 +42,7 @@ return { generator = function()
else x = width y = rng.range(0, height)
end
end
local vel = rng.float(0.3, 2)
local vel = rng.float(vel_min or 0.3, vel_max or 2)
return {
life = life / vel,
......
game/modules/tome/data/gfx/shockbolt/terrain/floating_rocks01_01.png

8.52 KiB

game/modules/tome/data/gfx/shockbolt/terrain/floating_rocks01_02.png

8.2 KiB

game/modules/tome/data/gfx/shockbolt/terrain/floating_rocks02_01.png

11.3 KiB

game/modules/tome/data/gfx/shockbolt/terrain/floating_rocks03_01.png

8.51 KiB

game/modules/tome/data/gfx/shockbolt/terrain/floating_rocks03_02.png

9.12 KiB

game/modules/tome/data/gfx/shockbolt/terrain/floating_rocks04_01.png

10.7 KiB

game/modules/tome/data/gfx/shockbolt/terrain/floating_rocks05_01.png

10.7 KiB

game/modules/tome/data/gfx/shockbolt/terrain/floating_rocks06_01.png

10.2 KiB

game/modules/tome/data/gfx/shockbolt/terrain/floating_rocks07_01.png

6.89 KiB

game/modules/tome/data/gfx/shockbolt/terrain/floating_rocks07_02.png

6.93 KiB

game/modules/tome/data/gfx/shockbolt/terrain/floating_rocks08_01.png

9.87 KiB

game/modules/tome/data/gfx/shockbolt/terrain/floating_rocks09_01.png

7.01 KiB

game/modules/tome/data/gfx/shockbolt/terrain/floating_rocks09_02.png

6.33 KiB

game/modules/tome/data/gfx/shockbolt/terrain/floating_rocks_inner01_01.png

10.6 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment