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

New "cavernous tunnel" map generator

parent 6c513293
No related branches found
No related tags found
No related merge requests found
......@@ -120,6 +120,7 @@ project "TEngine"
configuration "linux"
libdirs {"/opt/SDL-2.0/lib/"}
links { "dl", "SDL2", "SDL2_ttf", "SDL2_image", "png", "openal", "vorbisfile", "GL", "GLU", "m", "pthread" }
linkoptions { "-Wl,-E" }
defines { [[TENGINE_HOME_PATH='".t-engine"']], 'SELFEXE_LINUX' }
if steamlin64 then steamlin64() end
......
......@@ -422,7 +422,7 @@ function _M:loadAddons(mod, saveuse)
if saveuse then
-- The savefile requires it, but we couldnt activate it, abord
core.game.setRebootMessage(([[The savefile requires the #YELLOW#%s#WHITE# addon.
Some of its features require being online and could not be enabled. To prevent damaging the savefile loading was aborded.
Some of its features require being online and could not be enabled. To prevent damaging the savefile loading was aborted.
You may try to force loading if you are sure the savefile does not use that addon, at your own risk, by checking the "Ignore unloadable addons" checkbox on the load game screen..]]):format(add.long_name))
util.showMainMenu(nil, nil, nil, nil, nil, nil, "show_ignore_addons_not_loading=true")
......
......@@ -64,10 +64,17 @@ function _M:generateGuardian(guardian)
local x, y = nil, nil
if self.guardian_spot then
local spot = self.level:pickSpot(self.guardian_spot)
local spot
if self.guardian_spot == "default_up" then
spot = self.level.default_up
elseif self.guardian_spot == "default_down" then
spot = self.level.default_down
else
spot = self.level:pickSpot(self.guardian_spot)
end
if spot then
x, y = spot.x, spot.y
print("Selecting guardian spot", x, y)
x, y = util.findFreeGrid(spot.x, spot.y, 3, true, {[Map.ACTOR]=true})
print("Selecting guardian spot", x, y, "from", spot.x, spot.y)
end
end
......
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009 - 2014 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
require "engine.class"
local Map = require "engine.Map"
require "engine.Generator"
module(..., package.seeall, class.inherit(engine.Generator))
function _M:init(zone, map, level, data)
engine.Generator.init(self, zone, map, level)
self.data = data
self.grid_list = zone.grid_list
end
function _M:makePath(sx, sy, ex, ey, wd, excentricity, points)
local ln = 0
local path = core.noise.new(1)
local j = sy
local dir = true
for i = sx, ex do
for jj = j - wd, j + wd do if self.map:isBound(i, jj) then self.map(i, jj, Map.TERRAIN, self:resolve(".")) end end
points[#points+1] = {x=i, y=j}
if i < ex - 10 then
local n = path:fbm_perlin(150 * i / self.map.w, 4)
if ln < -excentricity or ln > excentricity then
if (ln > 0 and n < 0) or (ln < 0 and n > 0) then dir = not dir end
j = util.bound(j + (dir and -1 or 1), 0, self.map.h - 1)
end
ln = n
else
-- Close in on the exit
if j < ey then j = j + 1
elseif j > ey then j = j - 1
end
end
end
end
function _M:generate(lev, old_lev)
for i = 0, self.map.w - 1 do for j = 0, self.map.h - 1 do
self.map(i, j, Map.TERRAIN, self:resolve("#"))
end end
local points = {}
self:makePath(0, self.data.start, self.map.w - 1, self.data.stop, 1, 0.35, points)
for i = 1, 10 do
local sp, ep
repeat
sp = rng.table(points)
ep = rng.table(points)
until ep.x - sp.x > 80
self:makePath(sp.x, sp.y, ep.x, ep.y, 0, 0.25, points)
end
local ux, uy = 0, self.data.start
self.map(ux, uy, Map.TERRAIN, self:resolve("up"))
local dx, dy
if lev < self.zone.max_level or self.data.force_last_stair then
dx, dy = self.map.w - 1, self.data.stop
self.map(dx, dy, Map.TERRAIN, self:resolve("down"))
end
-- Make stairs
local spots = {}
return ux, uy, dx, dy, spots
end
......@@ -467,6 +467,7 @@ newEntity{ base = "BASE_MACE",
rarity = 340,
require = { stat = { str=42 } },
cost = 350,
metallic = false,
material_level = 3,
combat = {
dam = 40,
......
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