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

fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@1098 51575b47-30f0-44d4-a5cc-537603b46e54
parent 08cc3473
No related branches found
No related tags found
No related merge requests found
......@@ -80,12 +80,18 @@ function _M:act()
end
end
-- Precompute FOV form, for speed
local fovdist = {}
for i = 0, 30 * 30 do
fovdist[i] = math.max((20 - math.sqrt(i)) / 14, 0.6)
end
function _M:playerFOV()
-- Clean FOV before computing it
game.level.map:cleanFOV()
-- Compute both the normal and the lite FOV, using cache
self:computeFOV(self.sight or 20, "block_sight", function(x, y, dx, dy, sqdist)
game.level.map:apply(x, y, math.max((20 - math.sqrt(sqdist)) / 14, 0.6))
game.level.map:apply(x, y, fovdist[sqdist])
end, true, false, true)
self:computeFOV(self.lite, "block_sight", function(x, y, dx, dy, sqdist) game.level.map:applyLite(x, y) end, true, true, true)
end
......
......@@ -182,7 +182,7 @@ function _M:act()
end
end
-- Precompute FOV form
-- Precompute FOV form, for speed
local fovdist = {}
for i = 0, 30 * 30 do
fovdist[i] = math.max((20 - math.sqrt(i)) / 14, 0.6)
......
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