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

Added an option to set scroll distance. Set it high enough and you get always centered scrolling

git-svn-id: http://svn.net-core.org/repos/t-engine4@4027 51575b47-30f0-44d4-a5cc-537603b46e54
parent 422aefa9
No related branches found
No related tags found
No related merge requests found
......@@ -172,7 +172,7 @@ function _M:move(x, y, force)
local ox, oy = self.x, self.y
local moved = mod.class.Actor.move(self, x, y, force)
if moved then
game.level.map:moveViewSurround(self.x, self.y, 8, 8)
game.level.map:moveViewSurround(self.x, self.y, config.settings.tome.scroll_dist, config.settings.tome.scroll_dist)
game.level.map.attrs(self.x, self.y, "walked", true)
if self.describeFloor then self:describeFloor(self.x, self.y) end
......
......@@ -62,6 +62,18 @@ function _M:generateList()
local list = {}
local i = 0
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Defines the distance from the screen edge at which scrolling will start. If set high enough the game will always center on the player.#WHITE#"}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Scroll distance#WHITE##{normal}#", status=function(item)
return tostring(config.settings.tome.scroll_dist)
end, fct=function(item)
game:registerDialog(GetQuantity.new("Scroll distance", "From 1 to 20", config.settings.tome.scroll_dist, 20, function(qty)
qty = util.bound(qty, 1, 20)
game:saveSettings("tome.scroll_dist", ("tome.scroll_dist = %d\n"):format(qty))
config.settings.tome.scroll_dist = qty
self.c_list:drawItem(item)
end, 1))
end,}
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Saves in the background, allowing you to continue playing. If disabled you will have to wait until the saving is done, but it will be faster.#WHITE#"}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Save in the background#WHITE##{normal}#", status=function(item)
return tostring(config.settings.background_saves and "enabled" or "disabled")
......@@ -70,16 +82,7 @@ function _M:generateList()
game:saveSettings("background_saves", ("background_saves = %s\n"):format(tostring(config.settings.background_saves)))
self.c_list:drawItem(item)
end,}
--[[
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Autosaves the whole game when switching zones. This is safer but can make playing a bit slower while it saves. Savefiles will also be somewhat bigger.#WHITE#"}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Autosave when leaving a zone#WHITE##{normal}#", status=function(item)
return tostring(config.settings.tome.autosave and "enabled" or "disabled")
end, fct=function(item)
config.settings.tome.autosave = not config.settings.tome.autosave
game:saveSettings("tome.autosave", ("tome.autosave = %s\n"):format(tostring(config.settings.tome.autosave)))
self.c_list:drawItem(item)
end,}
]]
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Forces the game to save each level instead of each zone.\nThis makes it save more often but the game will use less memory when deep in a dungeon.\n\n#LIGHT_RED#Changing this option will not affect already visited zones.#WHITE#"}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Zone save per level#WHITE##{normal}#", status=function(item)
return tostring(config.settings.tome.save_zone_levels and "enabled" or "disabled")
......@@ -191,7 +194,7 @@ function _M:generateList()
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Log fade time#WHITE##{normal}#", status=function(item)
return tostring(config.settings.tome.log_fade)
end, fct=function(item)
game:registerDialog(GetQuantity.new("Fade time (in seconds)", "From 2 to 20", config.settings.tome.log_fade, 20, function(qty)
game:registerDialog(GetQuantity.new("Fade time (in seconds)", "From 0 to 20", config.settings.tome.log_fade, 20, function(qty)
qty = util.bound(qty, 0, 20)
game:saveSettings("tome.log_fade", ("tome.log_fade = %d\n"):format(qty))
config.settings.tome.log_fade = qty
......
......@@ -66,6 +66,7 @@ if not config.settings.tome.fonts then config.settings.tome.fonts = {type="fanta
if not config.settings.tome.ui_theme then config.settings.tome.ui_theme = "stone" end
if not config.settings.tome.log_lines then config.settings.tome.log_lines = 5 end
if not config.settings.tome.log_fade then config.settings.tome.log_fade = 3 end
if not config.settings.tome.scroll_dist then config.settings.tome.scroll_dist = 8 end
Map.smooth_scroll = config.settings.tome.smooth_move
Map.faction_danger_check = function(self, e) return e.rank > 3 end
......
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