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

Added an option to the graphics mode selection to use a custom tileset by...

Added an option to the graphics mode selection to use a custom tileset by entering a folder name and a few parameters


git-svn-id: http://svn.net-core.org/repos/t-engine4@3848 51575b47-30f0-44d4-a5cc-537603b46e54
parent 2de446ed
No related branches found
No related tags found
No related merge requests found
......@@ -360,7 +360,7 @@ end
function _M:setupDisplayMode(reboot, mode)
if not mode or mode == "init" then
local gfx = config.settings.tome.gfx
self:saveSettings("tome.gfx", ('tome.gfx = {tiles=%q, size=%q}\n'):format(gfx.tiles, gfx.size))
self:saveSettings("tome.gfx", ('tome.gfx = {tiles=%q, size=%q, tiles_custom_dir=%q, tiles_custom_moddable=%s, tiles_custom_adv=%s}\n'):format(gfx.tiles, gfx.size, gfx.tiles_custom_dir or "", gfx.tiles_custom_moddable and "true" or "false", gfx.tiles_custom_adv and "true" or "false"))
if reboot then
self.change_res_dialog = true
......@@ -375,9 +375,9 @@ function _M:setupDisplayMode(reboot, mode)
local gfx = config.settings.tome.gfx
-- Select tiles
Tiles.prefix = "/data/gfx/"
if gfx.tiles ~= "mushroom" then
Tiles.prefix = "/data/gfx/"..gfx.tiles.."/"
Tiles.prefix = "/data/gfx/"..gfx.tiles.."/"
if config.settings.tome.gfx.tiles == "customtiles" then
Tiles.prefix = "/data/gfx/"..config.settings.tome.gfx.tiles_custom_dir.."/"
end
print("[DISPLAY MODE] Tileset: "..gfx.tiles)
print("[DISPLAY MODE] Size: "..gfx.size)
......@@ -411,8 +411,9 @@ function _M:setupDisplayMode(reboot, mode)
elseif gfx.tiles == "oldrpg" then
Map.tiles.nicer_tiles = true
Map.tiles.no_moddable_tiles = true
elseif gfx.tiles == "mushroom" then
Map.tiles.no_moddable_tiles = true
elseif gfx.tiles == "customtiles" then
Map.tiles.no_moddable_tiles = not config.settings.tome.gfx.tiles_custom_moddable
Map.tiles.nicer_tiles = config.settings.tome.gfx.tiles_custom_adv
end
if self.level then
......
......@@ -36,7 +36,7 @@ newTalent = function(t)
end
t.tactical = tacts
end
--[[
if t.image then
if type(t.image) == "boolean" then
local name = t.name:gsub(" ", ""):lower()
......@@ -48,7 +48,7 @@ newTalent = function(t)
end
t.image_texture = t.image:glTexture()
end
]]
return oldNewTalent(t)
end
......
......@@ -20,6 +20,10 @@
require "engine.class"
local Dialog = require "engine.ui.Dialog"
local List = require "engine.ui.List"
local Button = require "engine.ui.Button"
local Checkbox = require "engine.ui.Checkbox"
local Textzone = require "engine.ui.Textzone"
local Textbox = require "engine.ui.Textbox"
local GetQuantity = require "engine.dialogs.GetQuantity"
local Map = require "engine.Map"
......@@ -60,7 +64,37 @@ function _M:init()
end
function _M:doCustomTiles()
local d = Dialog.new("Custom Tileset")
local d = Dialog.new("Custom Tileset", 100, 100)
local help = Textzone.new{width=500, auto_height=true, text=[[You can configure the game to use a custom tileset.
You must place all files of your tileset in a subfolder of the modules's data/gfx/ folder, just like the existing tilesets.
Each tile must be correctly named according to the existing tilesets.]]}
local dir = Textbox.new{title="Folder: ", text="", chars=30, max_len=50, fct=function() end}
local moddable_tiles = Checkbox.new{title="Use moddable tiles (equipment showing on player)", default=false, fct=function() end }
local adv_tiles = Checkbox.new{title="Use advanced tiles (transitions, wide tiles, ...)", default=false, fct=function() end }
local ok = Button.new{text="Use custom tileset", fct=function()
config.settings.tome.gfx.tiles = "customtiles"
config.settings.tome.gfx.tiles_custom_dir = dir.text
config.settings.tome.gfx.tiles_custom_moddable = moddable_tiles.checked
config.settings.tome.gfx.tiles_custom_adv = adv_tiles.checked
self.changed = true
self:use{change_sel = "main"}
game:unregisterDialog(d)
end}
local cancel = Button.new{text="Cancel", fct=function() game:unregisterDialog(d) end}
d:loadUI{
{left=0, top=0, ui=help},
{left=0, top=help.h, ui=dir},
{left=0, top=help.h+dir.h, ui=moddable_tiles},
{left=0, top=help.h+dir.h+moddable_tiles.h, ui=adv_tiles},
{left=0, bottom=0, ui=ok},
{right=0, bottom=0, ui=cancel},
}
d:setFocus(dir)
d:setupUI(true, true)
game:registerDialog(d)
end
function _M:use(item)
......
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