Commit accfd911cd978c08e603b69ed3c7d84cf8b2a3f6

Authored by DarkGod
1 parent c0d6fc4c

fixed maze generator with werid values of widen

... ... @@ -35,11 +35,17 @@ function _M:init(zone, map, grid_list, data)
35 35 end
36 36
37 37 function _M:generate(lev, old_lev)
  38 + local lastx, lasty = 0, 0
  39 +
38 40 local do_tile = function(i, j, wall)
39 41 for ii = 0, self.data.widen_w-1 do for jj = 0, self.data.widen_h-1 do
40 42 self.map(i*self.data.widen_w+ii, j*self.data.widen_h+jj, Map.TERRAIN, self:resolve(wall and "wall" or "floor"))
41 43 end end
42 44 self.map.room_map[i][j].maze_wall = wall
  45 + if not wall then
  46 + lastx = math.max(lastx, i)
  47 + lasty = math.max(lasty, j)
  48 + end
43 49 end
44 50
45 51 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)
94 100 end
95 101 -- Always starts at 1, 1
96 102 local ux, uy = 1 * self.data.widen_w, 1 * self.data.widen_h
97   - 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))
  103 + local dx, dy = lastx * self.data.widen_w, lasty * self.data.widen_h
  104 + -- 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))
98 105 self.map(ux, uy, Map.TERRAIN, self:resolve("up"))
99 106 self.map.room_map[ux][uy].special = "exit"
100 107 if lev < self.zone.max_level or self.data.force_last_stair then
... ...
... ... @@ -172,7 +172,6 @@ return {
172 172 zone:triggerHook{"InfiniteDungeon:getLayouts", layouts=layouts}
173 173
174 174 local layout = rng.table(layouts)
175   - local layout = layouts[4]
176 175 data.generator.map = layout
177 176
178 177 local vgrids = {
... ... @@ -196,7 +195,6 @@ return {
196 195 }
197 196 zone:triggerHook{"InfiniteDungeon:getGrids", grids=vgrids}
198 197 local vgrid = rng.table(vgrids)
199   - -- local vgrid = vgrids[#vgrids]
200 198
201 199 data.generator.map.floor = vgrid.floor
202 200 data.generator.map['.'] = vgrid.floor
... ...