Skip to content
Snippets Groups Projects
Commit accfd911 authored by DarkGod's avatar DarkGod
Browse files

fixed maze generator with werid values of widen

parent c0d6fc4c
No related branches found
No related tags found
No related merge requests found
......@@ -35,11 +35,17 @@ function _M:init(zone, map, grid_list, data)
end
function _M:generate(lev, old_lev)
local lastx, lasty = 0, 0
local do_tile = function(i, j, wall)
for ii = 0, self.data.widen_w-1 do for jj = 0, self.data.widen_h-1 do
self.map(i*self.data.widen_w+ii, j*self.data.widen_h+jj, Map.TERRAIN, self:resolve(wall and "wall" or "floor"))
end end
self.map.room_map[i][j].maze_wall = wall
if not wall then
lastx = math.max(lastx, i)
lasty = math.max(lasty, j)
end
end
for i = 0, self.data.w - 1 do for j = 0, self.data.h - 1 do
......@@ -94,7 +100,8 @@ function _M:generate(lev, old_lev)
end
-- Always starts at 1, 1
local ux, uy = 1 * self.data.widen_w, 1 * self.data.widen_h
local dx, dy = math.floor(self.map.w/2)*2-1-2*(1-math.mod(self.map.w,2)), math.floor(self.map.h/2)*2-1-2*(1-math.mod(self.map.h,2))
local dx, dy = lastx * self.data.widen_w, lasty * self.data.widen_h
-- local dx, dy = math.floor(self.map.w/2)*2-1-2*(1-math.mod(self.map.w,2)), math.floor(self.map.h/2)*2-1-2*(1-math.mod(self.map.h,2))
self.map(ux, uy, Map.TERRAIN, self:resolve("up"))
self.map.room_map[ux][uy].special = "exit"
if lev < self.zone.max_level or self.data.force_last_stair then
......
......@@ -172,7 +172,6 @@ return {
zone:triggerHook{"InfiniteDungeon:getLayouts", layouts=layouts}
local layout = rng.table(layouts)
local layout = layouts[4]
data.generator.map = layout
local vgrids = {
......@@ -196,7 +195,6 @@ return {
}
zone:triggerHook{"InfiniteDungeon:getGrids", grids=vgrids}
local vgrid = rng.table(vgrids)
-- local vgrid = vgrids[#vgrids]
data.generator.map.floor = vgrid.floor
data.generator.map['.'] = vgrid.floor
......
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