2014-04-18 15:39:15 +02:00
|
|
|
--Minetest
|
2016-02-19 10:03:02 +01:00
|
|
|
--Copyright (C) 2013 sapier
|
2014-04-18 15:39:15 +02:00
|
|
|
--
|
|
|
|
--This program is free software; you can redistribute it and/or modify
|
|
|
|
--it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
--the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
|
|
|
|
--
|
|
|
|
--You should have received a copy of the GNU Lesser General Public License along
|
|
|
|
--with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
2016-02-19 10:03:02 +01:00
|
|
|
--------------------------------------------------------------------------------
|
2014-04-18 15:39:15 +02:00
|
|
|
|
2016-03-05 11:48:02 +01:00
|
|
|
local labels = {
|
|
|
|
leaves = {
|
|
|
|
fgettext("Opaque Leaves"),
|
|
|
|
fgettext("Simple Leaves"),
|
|
|
|
fgettext("Fancy Leaves")
|
|
|
|
},
|
|
|
|
node_highlighting = {
|
|
|
|
fgettext("Node Outlining"),
|
2017-05-12 00:18:36 +02:00
|
|
|
fgettext("Node Highlighting"),
|
|
|
|
fgettext("None")
|
2016-03-05 11:48:02 +01:00
|
|
|
},
|
|
|
|
filters = {
|
|
|
|
fgettext("No Filter"),
|
|
|
|
fgettext("Bilinear Filter"),
|
|
|
|
fgettext("Trilinear Filter")
|
|
|
|
},
|
|
|
|
mipmap = {
|
|
|
|
fgettext("No Mipmap"),
|
|
|
|
fgettext("Mipmap"),
|
|
|
|
fgettext("Mipmap + Aniso. Filter")
|
|
|
|
},
|
|
|
|
antialiasing = {
|
|
|
|
fgettext("None"),
|
|
|
|
fgettext("2x"),
|
|
|
|
fgettext("4x"),
|
|
|
|
fgettext("8x")
|
2021-06-06 18:51:21 +02:00
|
|
|
},
|
|
|
|
shadow_levels = {
|
|
|
|
fgettext("Disabled"),
|
|
|
|
fgettext("Very Low"),
|
|
|
|
fgettext("Low"),
|
|
|
|
fgettext("Medium"),
|
|
|
|
fgettext("High"),
|
|
|
|
fgettext("Ultra High")
|
2016-03-05 11:48:02 +01:00
|
|
|
}
|
2015-10-18 10:41:52 +02:00
|
|
|
}
|
|
|
|
|
2016-03-05 11:48:02 +01:00
|
|
|
local dd_options = {
|
|
|
|
leaves = {
|
|
|
|
table.concat(labels.leaves, ","),
|
|
|
|
{"opaque", "simple", "fancy"}
|
|
|
|
},
|
|
|
|
node_highlighting = {
|
|
|
|
table.concat(labels.node_highlighting, ","),
|
2017-05-12 00:18:36 +02:00
|
|
|
{"box", "halo", "none"}
|
2016-03-05 11:48:02 +01:00
|
|
|
},
|
|
|
|
filters = {
|
|
|
|
table.concat(labels.filters, ","),
|
|
|
|
{"", "bilinear_filter", "trilinear_filter"}
|
|
|
|
},
|
|
|
|
mipmap = {
|
|
|
|
table.concat(labels.mipmap, ","),
|
|
|
|
{"", "mip_map", "anisotropic_filter"}
|
|
|
|
},
|
|
|
|
antialiasing = {
|
|
|
|
table.concat(labels.antialiasing, ","),
|
|
|
|
{"0", "2", "4", "8"}
|
2021-06-06 18:51:21 +02:00
|
|
|
},
|
|
|
|
shadow_levels = {
|
|
|
|
table.concat(labels.shadow_levels, ","),
|
|
|
|
{ "0", "1", "2", "3", "4", "5" }
|
2016-03-05 11:48:02 +01:00
|
|
|
}
|
2016-02-19 10:03:02 +01:00
|
|
|
}
|
2015-07-08 11:20:07 +02:00
|
|
|
|
2016-03-05 11:48:02 +01:00
|
|
|
local getSettingIndex = {
|
|
|
|
Leaves = function()
|
2014-12-12 20:49:19 +01:00
|
|
|
local style = core.settings:get("leaves_style")
|
2016-03-05 11:48:02 +01:00
|
|
|
for idx, name in pairs(dd_options.leaves[2]) do
|
|
|
|
if style == name then return idx end
|
|
|
|
end
|
|
|
|
return 1
|
|
|
|
end,
|
|
|
|
NodeHighlighting = function()
|
2014-12-12 20:49:19 +01:00
|
|
|
local style = core.settings:get("node_highlighting")
|
2016-03-05 11:48:02 +01:00
|
|
|
for idx, name in pairs(dd_options.node_highlighting[2]) do
|
|
|
|
if style == name then return idx end
|
|
|
|
end
|
|
|
|
return 1
|
|
|
|
end,
|
|
|
|
Filter = function()
|
2014-12-12 20:49:19 +01:00
|
|
|
if core.settings:get(dd_options.filters[2][3]) == "true" then
|
2016-03-05 11:48:02 +01:00
|
|
|
return 3
|
2014-12-12 20:49:19 +01:00
|
|
|
elseif core.settings:get(dd_options.filters[2][3]) == "false" and
|
|
|
|
core.settings:get(dd_options.filters[2][2]) == "true" then
|
2016-03-05 11:48:02 +01:00
|
|
|
return 2
|
|
|
|
end
|
|
|
|
return 1
|
|
|
|
end,
|
|
|
|
Mipmap = function()
|
2014-12-12 20:49:19 +01:00
|
|
|
if core.settings:get(dd_options.mipmap[2][3]) == "true" then
|
2016-03-05 11:48:02 +01:00
|
|
|
return 3
|
2014-12-12 20:49:19 +01:00
|
|
|
elseif core.settings:get(dd_options.mipmap[2][3]) == "false" and
|
|
|
|
core.settings:get(dd_options.mipmap[2][2]) == "true" then
|
2016-03-05 11:48:02 +01:00
|
|
|
return 2
|
2015-10-15 21:32:31 +02:00
|
|
|
end
|
2016-03-05 11:48:02 +01:00
|
|
|
return 1
|
|
|
|
end,
|
|
|
|
Antialiasing = function()
|
2014-12-12 20:49:19 +01:00
|
|
|
local antialiasing_setting = core.settings:get("fsaa")
|
2016-03-05 11:48:02 +01:00
|
|
|
for i = 1, #dd_options.antialiasing[2] do
|
|
|
|
if antialiasing_setting == dd_options.antialiasing[2][i] then
|
|
|
|
return i
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return 1
|
2021-06-06 18:51:21 +02:00
|
|
|
end,
|
|
|
|
ShadowMapping = function()
|
|
|
|
local shadow_setting = core.settings:get("shadow_levels")
|
|
|
|
for i = 1, #dd_options.shadow_levels[2] do
|
|
|
|
if shadow_setting == dd_options.shadow_levels[2][i] then
|
|
|
|
return i
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return 1
|
2016-02-19 10:03:02 +01:00
|
|
|
end
|
2016-03-05 11:48:02 +01:00
|
|
|
}
|
2015-10-24 22:31:54 +02:00
|
|
|
|
2016-02-19 10:03:02 +01:00
|
|
|
local function antialiasing_fname_to_name(fname)
|
2016-03-05 11:48:02 +01:00
|
|
|
for i = 1, #labels.antialiasing do
|
|
|
|
if fname == labels.antialiasing[i] then
|
|
|
|
return dd_options.antialiasing[2][i]
|
2015-10-24 22:31:54 +02:00
|
|
|
end
|
|
|
|
end
|
2016-02-19 10:03:02 +01:00
|
|
|
return 0
|
|
|
|
end
|
2015-10-24 22:31:54 +02:00
|
|
|
|
2016-02-19 10:03:02 +01:00
|
|
|
local function formspec(tabview, name, tabdata)
|
|
|
|
local tab_string =
|
2017-11-13 02:42:57 +01:00
|
|
|
"box[0,0;3.75,4.5;#999999]" ..
|
2016-03-03 21:48:18 +01:00
|
|
|
"checkbox[0.25,0;cb_smooth_lighting;" .. fgettext("Smooth Lighting") .. ";"
|
2014-12-12 20:49:19 +01:00
|
|
|
.. dump(core.settings:get_bool("smooth_lighting")) .. "]" ..
|
2016-03-03 21:48:18 +01:00
|
|
|
"checkbox[0.25,0.5;cb_particles;" .. fgettext("Particles") .. ";"
|
2014-12-12 20:49:19 +01:00
|
|
|
.. dump(core.settings:get_bool("enable_particles")) .. "]" ..
|
2016-02-19 10:03:02 +01:00
|
|
|
"checkbox[0.25,1;cb_3d_clouds;" .. fgettext("3D Clouds") .. ";"
|
2014-12-12 20:49:19 +01:00
|
|
|
.. dump(core.settings:get_bool("enable_3d_clouds")) .. "]" ..
|
2016-02-19 10:03:02 +01:00
|
|
|
"checkbox[0.25,1.5;cb_opaque_water;" .. fgettext("Opaque Water") .. ";"
|
2014-12-12 20:49:19 +01:00
|
|
|
.. dump(core.settings:get_bool("opaque_water")) .. "]" ..
|
2016-02-19 10:03:02 +01:00
|
|
|
"checkbox[0.25,2.0;cb_connected_glass;" .. fgettext("Connected Glass") .. ";"
|
2014-12-12 20:49:19 +01:00
|
|
|
.. dump(core.settings:get_bool("connected_glass")) .. "]" ..
|
2017-11-13 02:42:57 +01:00
|
|
|
"dropdown[0.25,2.8;3.5;dd_node_highlighting;" .. dd_options.node_highlighting[1] .. ";"
|
2016-03-05 11:48:02 +01:00
|
|
|
.. getSettingIndex.NodeHighlighting() .. "]" ..
|
2017-11-13 02:42:57 +01:00
|
|
|
"dropdown[0.25,3.6;3.5;dd_leaves_style;" .. dd_options.leaves[1] .. ";"
|
2016-03-05 11:48:02 +01:00
|
|
|
.. getSettingIndex.Leaves() .. "]" ..
|
2017-11-13 02:42:57 +01:00
|
|
|
"box[4,0;3.75,4.5;#999999]" ..
|
|
|
|
"label[4.25,0.1;" .. fgettext("Texturing:") .. "]" ..
|
|
|
|
"dropdown[4.25,0.55;3.5;dd_filters;" .. dd_options.filters[1] .. ";"
|
2016-03-05 11:48:02 +01:00
|
|
|
.. getSettingIndex.Filter() .. "]" ..
|
2017-11-13 02:42:57 +01:00
|
|
|
"dropdown[4.25,1.35;3.5;dd_mipmap;" .. dd_options.mipmap[1] .. ";"
|
2016-03-05 11:48:02 +01:00
|
|
|
.. getSettingIndex.Mipmap() .. "]" ..
|
2017-11-13 02:42:57 +01:00
|
|
|
"label[4.25,2.15;" .. fgettext("Antialiasing:") .. "]" ..
|
|
|
|
"dropdown[4.25,2.6;3.5;dd_antialiasing;" .. dd_options.antialiasing[1] .. ";"
|
2016-03-05 11:48:02 +01:00
|
|
|
.. getSettingIndex.Antialiasing() .. "]" ..
|
2017-11-13 02:42:57 +01:00
|
|
|
"label[4.25,3.45;" .. fgettext("Screen:") .. "]" ..
|
2017-11-13 20:02:26 +01:00
|
|
|
"checkbox[4.25,3.6;cb_autosave_screensize;" .. fgettext("Autosave Screen Size") .. ";"
|
2014-12-12 20:49:19 +01:00
|
|
|
.. dump(core.settings:get_bool("autosave_screensize")) .. "]" ..
|
2018-07-21 09:26:40 +02:00
|
|
|
"box[8,0;3.75,4.5;#999999]"
|
|
|
|
|
|
|
|
local video_driver = core.settings:get("video_driver")
|
2020-10-25 18:01:03 +01:00
|
|
|
local shaders_enabled = core.settings:get_bool("enable_shaders")
|
|
|
|
if video_driver == "opengl" then
|
2018-07-21 09:26:40 +02:00
|
|
|
tab_string = tab_string ..
|
|
|
|
"checkbox[8.25,0;cb_shaders;" .. fgettext("Shaders") .. ";"
|
|
|
|
.. tostring(shaders_enabled) .. "]"
|
2020-10-25 18:01:03 +01:00
|
|
|
elseif video_driver == "ogles2" then
|
|
|
|
tab_string = tab_string ..
|
|
|
|
"checkbox[8.25,0;cb_shaders;" .. fgettext("Shaders (experimental)") .. ";"
|
|
|
|
.. tostring(shaders_enabled) .. "]"
|
2018-07-21 09:26:40 +02:00
|
|
|
else
|
|
|
|
core.settings:set_bool("enable_shaders", false)
|
2020-10-25 18:01:03 +01:00
|
|
|
shaders_enabled = false
|
2018-07-21 09:26:40 +02:00
|
|
|
tab_string = tab_string ..
|
|
|
|
"label[8.38,0.2;" .. core.colorize("#888888",
|
|
|
|
fgettext("Shaders (unavailable)")) .. "]"
|
|
|
|
end
|
2016-02-19 10:03:02 +01:00
|
|
|
|
2020-08-27 21:46:57 +02:00
|
|
|
tab_string = tab_string ..
|
|
|
|
"button[8,4.75;3.95,1;btn_change_keys;"
|
|
|
|
.. fgettext("Change Keys") .. "]"
|
2016-05-13 02:22:31 +02:00
|
|
|
|
2016-02-19 10:03:02 +01:00
|
|
|
tab_string = tab_string ..
|
2017-11-17 22:45:39 +01:00
|
|
|
"button[0,4.75;3.95,1;btn_advanced_settings;"
|
2019-01-26 14:14:06 +01:00
|
|
|
.. fgettext("All Settings") .. "]"
|
2016-02-19 10:03:02 +01:00
|
|
|
|
|
|
|
|
2014-12-12 20:49:19 +01:00
|
|
|
if core.settings:get("touchscreen_threshold") ~= nil then
|
2016-02-19 10:03:02 +01:00
|
|
|
tab_string = tab_string ..
|
2018-11-18 11:31:19 +01:00
|
|
|
"label[4.3,4.2;" .. fgettext("Touchthreshold: (px)") .. "]" ..
|
|
|
|
"dropdown[4.25,4.65;3.5;dd_touchthreshold;0,10,20,30,40,50;" ..
|
|
|
|
((tonumber(core.settings:get("touchscreen_threshold")) / 10) + 1) ..
|
|
|
|
"]box[4.0,4.5;3.75,1.0;#999999]"
|
2016-02-19 10:03:02 +01:00
|
|
|
end
|
|
|
|
|
2018-07-21 09:26:40 +02:00
|
|
|
if shaders_enabled then
|
2016-02-19 10:03:02 +01:00
|
|
|
tab_string = tab_string ..
|
2020-10-12 22:29:31 +02:00
|
|
|
"checkbox[8.25,0.5;cb_tonemapping;" .. fgettext("Tone Mapping") .. ";"
|
2014-12-12 20:49:19 +01:00
|
|
|
.. dump(core.settings:get_bool("tone_mapping")) .. "]" ..
|
2020-10-12 22:29:31 +02:00
|
|
|
"checkbox[8.25,1;cb_waving_water;" .. fgettext("Waving Liquids") .. ";"
|
2014-12-12 20:49:19 +01:00
|
|
|
.. dump(core.settings:get_bool("enable_waving_water")) .. "]" ..
|
2020-10-12 22:29:31 +02:00
|
|
|
"checkbox[8.25,1.5;cb_waving_leaves;" .. fgettext("Waving Leaves") .. ";"
|
2014-12-12 20:49:19 +01:00
|
|
|
.. dump(core.settings:get_bool("enable_waving_leaves")) .. "]" ..
|
2020-10-12 22:29:31 +02:00
|
|
|
"checkbox[8.25,2;cb_waving_plants;" .. fgettext("Waving Plants") .. ";"
|
2021-06-06 18:51:21 +02:00
|
|
|
.. dump(core.settings:get_bool("enable_waving_plants")) .. "]"..
|
|
|
|
"label[8.25,3.0;" .. fgettext("Dynamic shadows: ") .. "]" ..
|
|
|
|
"dropdown[8.25,3.5;3.5;dd_shadows;" .. dd_options.shadow_levels[1] .. ";"
|
|
|
|
.. getSettingIndex.ShadowMapping() .. "]"
|
2015-10-15 21:32:31 +02:00
|
|
|
else
|
2016-02-19 10:03:02 +01:00
|
|
|
tab_string = tab_string ..
|
2017-06-10 20:14:26 +02:00
|
|
|
"label[8.38,0.7;" .. core.colorize("#888888",
|
|
|
|
fgettext("Tone Mapping")) .. "]" ..
|
2020-10-12 22:29:31 +02:00
|
|
|
"label[8.38,1.2;" .. core.colorize("#888888",
|
2019-03-27 01:18:43 +01:00
|
|
|
fgettext("Waving Liquids")) .. "]" ..
|
2020-10-12 22:29:31 +02:00
|
|
|
"label[8.38,1.7;" .. core.colorize("#888888",
|
2017-06-10 20:14:26 +02:00
|
|
|
fgettext("Waving Leaves")) .. "]" ..
|
2020-10-12 22:29:31 +02:00
|
|
|
"label[8.38,2.2;" .. core.colorize("#888888",
|
2021-06-06 18:51:21 +02:00
|
|
|
fgettext("Waving Plants")) .. "]"..
|
|
|
|
"label[8.38,2.7;" .. core.colorize("#888888",
|
|
|
|
fgettext("Dynamic shadows")) .. "]"
|
2016-02-19 10:03:02 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
return tab_string
|
2014-04-18 15:39:15 +02:00
|
|
|
end
|
|
|
|
|
2016-02-19 10:03:02 +01:00
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
local function handle_settings_buttons(this, fields, tabname, tabdata)
|
2015-10-18 10:41:52 +02:00
|
|
|
|
2016-02-19 10:03:02 +01:00
|
|
|
if fields["btn_advanced_settings"] ~= nil then
|
|
|
|
local adv_settings_dlg = create_adv_settings_dlg()
|
|
|
|
adv_settings_dlg:set_parent(this)
|
|
|
|
this:hide()
|
|
|
|
adv_settings_dlg:show()
|
2021-11-22 18:26:46 +01:00
|
|
|
--mm_game_theme.update("singleplayer", current_game())
|
2015-10-15 21:32:31 +02:00
|
|
|
return true
|
2014-06-19 18:17:35 +02:00
|
|
|
end
|
2016-02-19 10:03:02 +01:00
|
|
|
if fields["cb_smooth_lighting"] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("smooth_lighting", fields["cb_smooth_lighting"])
|
2015-10-15 21:32:31 +02:00
|
|
|
return true
|
2014-06-19 18:17:35 +02:00
|
|
|
end
|
2016-02-19 10:03:02 +01:00
|
|
|
if fields["cb_particles"] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("enable_particles", fields["cb_particles"])
|
2016-02-19 10:03:02 +01:00
|
|
|
return true
|
2015-10-03 16:01:39 +02:00
|
|
|
end
|
2016-02-19 10:03:02 +01:00
|
|
|
if fields["cb_3d_clouds"] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("enable_3d_clouds", fields["cb_3d_clouds"])
|
2016-02-19 10:03:02 +01:00
|
|
|
return true
|
2015-10-03 16:01:39 +02:00
|
|
|
end
|
2016-02-19 10:03:02 +01:00
|
|
|
if fields["cb_opaque_water"] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("opaque_water", fields["cb_opaque_water"])
|
2016-02-19 10:03:02 +01:00
|
|
|
return true
|
2015-10-03 16:01:39 +02:00
|
|
|
end
|
2016-02-19 10:03:02 +01:00
|
|
|
if fields["cb_connected_glass"] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("connected_glass", fields["cb_connected_glass"])
|
2016-02-19 10:03:02 +01:00
|
|
|
return true
|
2015-10-03 16:01:39 +02:00
|
|
|
end
|
2017-05-05 13:47:11 +02:00
|
|
|
if fields["cb_autosave_screensize"] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("autosave_screensize", fields["cb_autosave_screensize"])
|
2017-05-05 13:47:11 +02:00
|
|
|
return true
|
|
|
|
end
|
2016-02-19 10:03:02 +01:00
|
|
|
if fields["cb_shaders"] then
|
2021-11-26 19:33:24 +01:00
|
|
|
core.settings:set("enable_shaders", fields["cb_shaders"])
|
2016-02-19 10:03:02 +01:00
|
|
|
return true
|
2014-04-18 15:39:15 +02:00
|
|
|
end
|
2016-03-03 21:48:18 +01:00
|
|
|
if fields["cb_tonemapping"] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("tone_mapping", fields["cb_tonemapping"])
|
2016-03-03 21:48:18 +01:00
|
|
|
return true
|
2016-02-19 10:03:02 +01:00
|
|
|
end
|
|
|
|
if fields["cb_waving_water"] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("enable_waving_water", fields["cb_waving_water"])
|
2016-02-19 10:03:02 +01:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
if fields["cb_waving_leaves"] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("enable_waving_leaves", fields["cb_waving_leaves"])
|
2016-02-19 10:03:02 +01:00
|
|
|
end
|
|
|
|
if fields["cb_waving_plants"] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("enable_waving_plants", fields["cb_waving_plants"])
|
2014-04-18 15:39:15 +02:00
|
|
|
return true
|
|
|
|
end
|
2015-10-15 21:32:31 +02:00
|
|
|
if fields["btn_change_keys"] then
|
|
|
|
core.show_keys_menu()
|
|
|
|
return true
|
2014-04-18 15:39:15 +02:00
|
|
|
end
|
2016-02-19 10:03:02 +01:00
|
|
|
if fields["cb_touchscreen_target"] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("touchtarget", fields["cb_touchscreen_target"])
|
2016-02-19 10:03:02 +01:00
|
|
|
return true
|
|
|
|
end
|
2014-06-19 18:17:35 +02:00
|
|
|
|
2016-02-19 10:03:02 +01:00
|
|
|
--Note dropdowns have to be handled LAST!
|
|
|
|
local ddhandled = false
|
|
|
|
|
2016-03-05 11:48:02 +01:00
|
|
|
for i = 1, #labels.leaves do
|
|
|
|
if fields["dd_leaves_style"] == labels.leaves[i] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("leaves_style", dd_options.leaves[2][i])
|
2016-03-03 21:48:18 +01:00
|
|
|
ddhandled = true
|
|
|
|
end
|
|
|
|
end
|
2016-03-05 11:48:02 +01:00
|
|
|
for i = 1, #labels.node_highlighting do
|
|
|
|
if fields["dd_node_highlighting"] == labels.node_highlighting[i] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("node_highlighting", dd_options.node_highlighting[2][i])
|
2016-03-03 21:48:18 +01:00
|
|
|
ddhandled = true
|
|
|
|
end
|
2016-02-19 10:03:02 +01:00
|
|
|
end
|
2016-03-05 11:48:02 +01:00
|
|
|
if fields["dd_filters"] == labels.filters[1] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("bilinear_filter", "false")
|
|
|
|
core.settings:set("trilinear_filter", "false")
|
2016-02-19 10:03:02 +01:00
|
|
|
ddhandled = true
|
2016-03-05 11:48:02 +01:00
|
|
|
elseif fields["dd_filters"] == labels.filters[2] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("bilinear_filter", "true")
|
|
|
|
core.settings:set("trilinear_filter", "false")
|
2016-02-19 10:03:02 +01:00
|
|
|
ddhandled = true
|
2016-03-05 11:48:02 +01:00
|
|
|
elseif fields["dd_filters"] == labels.filters[3] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("bilinear_filter", "false")
|
|
|
|
core.settings:set("trilinear_filter", "true")
|
2016-02-19 10:03:02 +01:00
|
|
|
ddhandled = true
|
|
|
|
end
|
2016-03-05 11:48:02 +01:00
|
|
|
if fields["dd_mipmap"] == labels.mipmap[1] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("mip_map", "false")
|
|
|
|
core.settings:set("anisotropic_filter", "false")
|
2016-02-19 10:03:02 +01:00
|
|
|
ddhandled = true
|
2016-03-05 11:48:02 +01:00
|
|
|
elseif fields["dd_mipmap"] == labels.mipmap[2] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("mip_map", "true")
|
|
|
|
core.settings:set("anisotropic_filter", "false")
|
2016-02-19 10:03:02 +01:00
|
|
|
ddhandled = true
|
2016-03-05 11:48:02 +01:00
|
|
|
elseif fields["dd_mipmap"] == labels.mipmap[3] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("mip_map", "true")
|
|
|
|
core.settings:set("anisotropic_filter", "true")
|
2016-02-19 10:03:02 +01:00
|
|
|
ddhandled = true
|
|
|
|
end
|
|
|
|
if fields["dd_antialiasing"] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("fsaa",
|
2016-02-19 10:03:02 +01:00
|
|
|
antialiasing_fname_to_name(fields["dd_antialiasing"]))
|
|
|
|
ddhandled = true
|
|
|
|
end
|
|
|
|
if fields["dd_touchthreshold"] then
|
2014-12-12 20:49:19 +01:00
|
|
|
core.settings:set("touchscreen_threshold", fields["dd_touchthreshold"])
|
2016-02-19 10:03:02 +01:00
|
|
|
ddhandled = true
|
|
|
|
end
|
|
|
|
|
2021-06-06 18:51:21 +02:00
|
|
|
for i = 1, #labels.shadow_levels do
|
|
|
|
if fields["dd_shadows"] == labels.shadow_levels[i] then
|
|
|
|
core.settings:set("shadow_levels", dd_options.shadow_levels[2][i])
|
|
|
|
ddhandled = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if fields["dd_shadows"] == labels.shadow_levels[1] then
|
|
|
|
core.settings:set("enable_dynamic_shadows", "false")
|
|
|
|
else
|
|
|
|
local shadow_presets = {
|
|
|
|
[2] = { 80, 512, "true", 0, "false" },
|
|
|
|
[3] = { 120, 1024, "true", 1, "false" },
|
|
|
|
[4] = { 350, 2048, "true", 1, "false" },
|
|
|
|
[5] = { 350, 2048, "true", 2, "true" },
|
|
|
|
[6] = { 450, 4096, "true", 2, "true" },
|
|
|
|
}
|
|
|
|
local s = shadow_presets[table.indexof(labels.shadow_levels, fields["dd_shadows"])]
|
|
|
|
if s then
|
2021-06-30 17:10:28 +02:00
|
|
|
core.settings:set("enable_dynamic_shadows", "true")
|
2021-06-06 18:51:21 +02:00
|
|
|
core.settings:set("shadow_map_max_distance", s[1])
|
|
|
|
core.settings:set("shadow_map_texture_size", s[2])
|
|
|
|
core.settings:set("shadow_map_texture_32bit", s[3])
|
|
|
|
core.settings:set("shadow_filters", s[4])
|
|
|
|
core.settings:set("shadow_map_color", s[5])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-02-19 10:03:02 +01:00
|
|
|
return ddhandled
|
2015-10-15 21:32:31 +02:00
|
|
|
end
|
2014-06-19 18:17:35 +02:00
|
|
|
|
2016-03-31 10:26:39 +02:00
|
|
|
return {
|
2015-10-18 10:41:52 +02:00
|
|
|
name = "settings",
|
|
|
|
caption = fgettext("Settings"),
|
2016-02-19 10:03:02 +01:00
|
|
|
cbf_formspec = formspec,
|
|
|
|
cbf_button_handler = handle_settings_buttons
|
2015-10-18 10:41:52 +02:00
|
|
|
}
|