forked from Mirrorlandia_minetest/minetest
Update settings tab + some misc. clean-up
This commit is contained in:
parent
096a01ffef
commit
335ad705e6
@ -151,8 +151,8 @@ local function parse_setting_line(settings, line, read_all, base_level, allow_se
|
|||||||
if setting_type == "float" then
|
if setting_type == "float" then
|
||||||
local default, min, max = remaining_line:match("^"
|
local default, min, max = remaining_line:match("^"
|
||||||
-- first float is required, the last 2 are optional
|
-- first float is required, the last 2 are optional
|
||||||
.. "(" .. CHAR_CLASSES.FLOAT .. "+)" .. CHAR_CLASSES.SPACE .. "?"
|
.. "(" .. CHAR_CLASSES.FLOAT .. "+)" .. CHAR_CLASSES.SPACE .. "*"
|
||||||
.. "(" .. CHAR_CLASSES.FLOAT .. "*)" .. CHAR_CLASSES.SPACE .. "?"
|
.. "(" .. CHAR_CLASSES.FLOAT .. "*)" .. CHAR_CLASSES.SPACE .. "*"
|
||||||
.. "(" .. CHAR_CLASSES.FLOAT .. "*)"
|
.. "(" .. CHAR_CLASSES.FLOAT .. "*)"
|
||||||
.."$")
|
.."$")
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Dropdown labels : Leaves
|
||||||
local leaves_style_labels = {
|
local leaves_style_labels = {
|
||||||
fgettext("Opaque Leaves"),
|
fgettext("Opaque Leaves"),
|
||||||
fgettext("Simple Leaves"),
|
fgettext("Simple Leaves"),
|
||||||
@ -24,10 +25,22 @@ local leaves_style_labels = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local leaves_style = {
|
local leaves_style = {
|
||||||
{leaves_style_labels[1] .. "," .. leaves_style_labels[2] .. "," .. leaves_style_labels[3]},
|
table.concat(leaves_style_labels, ","),
|
||||||
{"opaque", "simple", "fancy"},
|
{"opaque", "simple", "fancy"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Dropdown labels : Node highlighting
|
||||||
|
local node_highlighting_style_labels = {
|
||||||
|
fgettext("Node Outlining"),
|
||||||
|
fgettext("Node Highlighting")
|
||||||
|
}
|
||||||
|
|
||||||
|
local node_highlighting_style = {
|
||||||
|
table.concat(node_highlighting_style_labels, ","),
|
||||||
|
{"box", "halo"},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Dropdown labels : Textures filtering
|
||||||
local dd_filter_labels = {
|
local dd_filter_labels = {
|
||||||
fgettext("No Filter"),
|
fgettext("No Filter"),
|
||||||
fgettext("Bilinear Filter"),
|
fgettext("Bilinear Filter"),
|
||||||
@ -35,10 +48,11 @@ local dd_filter_labels = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local filters = {
|
local filters = {
|
||||||
{dd_filter_labels[1] .. "," .. dd_filter_labels[2] .. "," .. dd_filter_labels[3]},
|
table.concat(dd_filter_labels, ","),
|
||||||
{"", "bilinear_filter", "trilinear_filter"},
|
{"", "bilinear_filter", "trilinear_filter"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Dropdown labels : Mip-mapping
|
||||||
local dd_mipmap_labels = {
|
local dd_mipmap_labels = {
|
||||||
fgettext("No Mipmap"),
|
fgettext("No Mipmap"),
|
||||||
fgettext("Mipmap"),
|
fgettext("Mipmap"),
|
||||||
@ -46,20 +60,11 @@ local dd_mipmap_labels = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local mipmap = {
|
local mipmap = {
|
||||||
{dd_mipmap_labels[1] .. "," .. dd_mipmap_labels[2] .. "," .. dd_mipmap_labels[3]},
|
table.concat(dd_mipmap_labels, ","),
|
||||||
{"", "mip_map", "anisotropic_filter"},
|
{"", "mip_map", "anisotropic_filter"},
|
||||||
}
|
}
|
||||||
|
|
||||||
local function getLeavesStyleSettingIndex()
|
-- Dropdown labels : Anti-aliasing
|
||||||
local style = core.setting_get("leaves_style")
|
|
||||||
if (style == leaves_style[2][3]) then
|
|
||||||
return 3
|
|
||||||
elseif (style == leaves_style[2][2]) then
|
|
||||||
return 2
|
|
||||||
end
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
|
|
||||||
local dd_antialiasing_labels = {
|
local dd_antialiasing_labels = {
|
||||||
fgettext("None"),
|
fgettext("None"),
|
||||||
fgettext("2x"),
|
fgettext("2x"),
|
||||||
@ -68,34 +73,54 @@ local dd_antialiasing_labels = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local antialiasing = {
|
local antialiasing = {
|
||||||
{dd_antialiasing_labels[1] .. "," .. dd_antialiasing_labels[2] .. "," ..
|
table.concat(dd_antialiasing_labels, ","),
|
||||||
dd_antialiasing_labels[3] .. "," .. dd_antialiasing_labels[4]},
|
|
||||||
{"0", "2", "4", "8"}
|
{"0", "2", "4", "8"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Dropdown index getter : Leaves
|
||||||
|
local function getLeavesStyleSettingIndex()
|
||||||
|
local style = core.setting_get("leaves_style")
|
||||||
|
for idx, name in pairs(leaves_style[2]) do
|
||||||
|
if style == name then return idx end
|
||||||
|
end
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Dropdown index getter : Node highlighting
|
||||||
|
local function getNodeHighlightingSettingIndex()
|
||||||
|
local style = core.setting_get("node_highlighting")
|
||||||
|
for idx, name in pairs(node_highlighting_style[2]) do
|
||||||
|
if style == name then return idx end
|
||||||
|
end
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Dropdown index getter : Textures filtering
|
||||||
local function getFilterSettingIndex()
|
local function getFilterSettingIndex()
|
||||||
if (core.setting_get(filters[2][3]) == "true") then
|
if core.setting_get(filters[2][3]) == "true" then
|
||||||
return 3
|
return 3
|
||||||
end
|
elseif core.setting_get(filters[2][3]) == "false" and
|
||||||
if (core.setting_get(filters[2][3]) == "false" and core.setting_get(filters[2][2]) == "true") then
|
core.setting_get(filters[2][2]) == "true" then
|
||||||
return 2
|
return 2
|
||||||
end
|
end
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Dropdown index getter : Mip-mapping
|
||||||
local function getMipmapSettingIndex()
|
local function getMipmapSettingIndex()
|
||||||
if (core.setting_get(mipmap[2][3]) == "true") then
|
if core.setting_get(mipmap[2][3]) == "true" then
|
||||||
return 3
|
return 3
|
||||||
end
|
elseif core.setting_get(mipmap[2][3]) == "false" and
|
||||||
if (core.setting_get(mipmap[2][3]) == "false" and core.setting_get(mipmap[2][2]) == "true") then
|
core.setting_get(mipmap[2][2]) == "true" then
|
||||||
return 2
|
return 2
|
||||||
end
|
end
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Dropdown index getter : Anti-aliasing
|
||||||
local function getAntialiasingSettingIndex()
|
local function getAntialiasingSettingIndex()
|
||||||
local antialiasing_setting = core.setting_get("fsaa")
|
local antialiasing_setting = core.setting_get("fsaa")
|
||||||
for i = 1, #(antialiasing[2]) do
|
for i = 1, #antialiasing[2] do
|
||||||
if antialiasing_setting == antialiasing[2][i] then
|
if antialiasing_setting == antialiasing[2][i] then
|
||||||
return i
|
return i
|
||||||
end
|
end
|
||||||
@ -104,7 +129,7 @@ local function getAntialiasingSettingIndex()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function antialiasing_fname_to_name(fname)
|
local function antialiasing_fname_to_name(fname)
|
||||||
for i = 1, #(dd_antialiasing_labels) do
|
for i = 1, #dd_antialiasing_labels do
|
||||||
if fname == dd_antialiasing_labels[i] then
|
if fname == dd_antialiasing_labels[i] then
|
||||||
return antialiasing[2][i]
|
return antialiasing[2][i]
|
||||||
end
|
end
|
||||||
@ -113,14 +138,10 @@ local function antialiasing_fname_to_name(fname)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function dlg_confirm_reset_formspec(data)
|
local function dlg_confirm_reset_formspec(data)
|
||||||
local retval =
|
return "size[8,3]" ..
|
||||||
"size[8,3]" ..
|
|
||||||
"label[1,1;" .. fgettext("Are you sure to reset your singleplayer world?") .. "]" ..
|
"label[1,1;" .. fgettext("Are you sure to reset your singleplayer world?") .. "]" ..
|
||||||
"button[1,2;2.6,0.5;dlg_reset_singleplayer_confirm;" ..
|
"button[1,2;2.6,0.5;dlg_reset_singleplayer_confirm;" .. fgettext("Yes") .. "]" ..
|
||||||
fgettext("Yes") .. "]" ..
|
"button[4,2;2.8,0.5;dlg_reset_singleplayer_cancel;" .. fgettext("No") .. "]"
|
||||||
"button[4,2;2.8,0.5;dlg_reset_singleplayer_cancel;" ..
|
|
||||||
fgettext("No!!!") .. "]"
|
|
||||||
return retval
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function dlg_confirm_reset_btnhandler(this, fields, dialogdata)
|
local function dlg_confirm_reset_btnhandler(this, fields, dialogdata)
|
||||||
@ -129,7 +150,7 @@ local function dlg_confirm_reset_btnhandler(this, fields, dialogdata)
|
|||||||
local worldlist = core.get_worlds()
|
local worldlist = core.get_worlds()
|
||||||
local found_singleplayerworld = false
|
local found_singleplayerworld = false
|
||||||
|
|
||||||
for i = 1, #worldlist, 1 do
|
for i = 1, #worldlist do
|
||||||
if worldlist[i].name == "singleplayerworld" then
|
if worldlist[i].name == "singleplayerworld" then
|
||||||
found_singleplayerworld = true
|
found_singleplayerworld = true
|
||||||
gamedata.worldindex = i
|
gamedata.worldindex = i
|
||||||
@ -141,12 +162,10 @@ local function dlg_confirm_reset_btnhandler(this, fields, dialogdata)
|
|||||||
end
|
end
|
||||||
|
|
||||||
core.create_world("singleplayerworld", 1)
|
core.create_world("singleplayerworld", 1)
|
||||||
|
|
||||||
worldlist = core.get_worlds()
|
worldlist = core.get_worlds()
|
||||||
|
|
||||||
found_singleplayerworld = false
|
found_singleplayerworld = false
|
||||||
|
|
||||||
for i = 1, #worldlist, 1 do
|
for i = 1, #worldlist do
|
||||||
if worldlist[i].name == "singleplayerworld" then
|
if worldlist[i].name == "singleplayerworld" then
|
||||||
found_singleplayerworld = true
|
found_singleplayerworld = true
|
||||||
gamedata.worldindex = i
|
gamedata.worldindex = i
|
||||||
@ -170,41 +189,12 @@ local function showconfirm_reset(tabview)
|
|||||||
new_dlg:show()
|
new_dlg:show()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function gui_scale_to_scrollbar()
|
|
||||||
local current_value = tonumber(core.setting_get("gui_scaling"))
|
|
||||||
|
|
||||||
if (current_value == nil) or current_value < 0.25 then
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
if current_value <= 1.25 then
|
|
||||||
return ((current_value - 0.25)/ 1.0) * 700
|
|
||||||
end
|
|
||||||
if current_value <= 6 then
|
|
||||||
return ((current_value -1.25) * 100) + 700
|
|
||||||
end
|
|
||||||
|
|
||||||
return 1000
|
|
||||||
end
|
|
||||||
|
|
||||||
local function scrollbar_to_gui_scale(value)
|
|
||||||
value = tonumber(value)
|
|
||||||
|
|
||||||
if (value <= 700) then
|
|
||||||
return ((value / 700) * 1.0) + 0.25
|
|
||||||
end
|
|
||||||
if (value <= 1000) then
|
|
||||||
return ((value - 700) / 100) + 1.25
|
|
||||||
end
|
|
||||||
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
|
|
||||||
local function formspec(tabview, name, tabdata)
|
local function formspec(tabview, name, tabdata)
|
||||||
local tab_string =
|
local tab_string =
|
||||||
"box[0,0;3.5,4.3;#999999]" ..
|
"box[0,0;3.5,4.5;#999999]" ..
|
||||||
"checkbox[0.25,0;cb_smooth_lighting;" .. fgettext("Smooth Lighting")
|
"checkbox[0.25,0;cb_smooth_lighting;" .. fgettext("Smooth Lighting") .. ";"
|
||||||
.. ";" .. dump(core.setting_getbool("smooth_lighting")) .. "]" ..
|
.. dump(core.setting_getbool("smooth_lighting")) .. "]" ..
|
||||||
"checkbox[0.25,0.5;cb_particles;" .. fgettext("Enable Particles") .. ";"
|
"checkbox[0.25,0.5;cb_particles;" .. fgettext("Particles") .. ";"
|
||||||
.. dump(core.setting_getbool("enable_particles")) .. "]" ..
|
.. dump(core.setting_getbool("enable_particles")) .. "]" ..
|
||||||
"checkbox[0.25,1;cb_3d_clouds;" .. fgettext("3D Clouds") .. ";"
|
"checkbox[0.25,1;cb_3d_clouds;" .. fgettext("3D Clouds") .. ";"
|
||||||
.. dump(core.setting_getbool("enable_3d_clouds")) .. "]" ..
|
.. dump(core.setting_getbool("enable_3d_clouds")) .. "]" ..
|
||||||
@ -212,20 +202,20 @@ local function formspec(tabview, name, tabdata)
|
|||||||
.. dump(core.setting_getbool("opaque_water")) .. "]" ..
|
.. dump(core.setting_getbool("opaque_water")) .. "]" ..
|
||||||
"checkbox[0.25,2.0;cb_connected_glass;" .. fgettext("Connected Glass") .. ";"
|
"checkbox[0.25,2.0;cb_connected_glass;" .. fgettext("Connected Glass") .. ";"
|
||||||
.. dump(core.setting_getbool("connected_glass")) .. "]" ..
|
.. dump(core.setting_getbool("connected_glass")) .. "]" ..
|
||||||
"checkbox[0.25,2.5;cb_node_highlighting;" .. fgettext("Node Highlighting") .. ";"
|
"dropdown[0.25,2.8;3.3;dd_node_highlighting;" .. node_highlighting_style[1] .. ";"
|
||||||
.. dump(core.setting_getbool("enable_node_highlighting")) .. "]" ..
|
.. getNodeHighlightingSettingIndex() .. "]" ..
|
||||||
"dropdown[0.25,3.4;3.3;dd_leaves_style;" .. leaves_style[1][1] .. ";"
|
"dropdown[0.25,3.6;3.3;dd_leaves_style;" .. leaves_style[1] .. ";"
|
||||||
.. getLeavesStyleSettingIndex() .. "]" ..
|
.. getLeavesStyleSettingIndex() .. "]" ..
|
||||||
"box[3.75,0;3.75,3.45;#999999]" ..
|
"box[3.75,0;3.75,3.45;#999999]" ..
|
||||||
"label[3.85,0.1;" .. fgettext("Texturing:") .. "]" ..
|
"label[3.85,0.1;" .. fgettext("Texturing:") .. "]" ..
|
||||||
"dropdown[3.85,0.55;3.85;dd_filters;" .. filters[1][1] .. ";"
|
"dropdown[3.85,0.55;3.85;dd_filters;" .. filters[1] .. ";"
|
||||||
.. getFilterSettingIndex() .. "]" ..
|
.. getFilterSettingIndex() .. "]" ..
|
||||||
"dropdown[3.85,1.35;3.85;dd_mipmap;" .. mipmap[1][1] .. ";"
|
"dropdown[3.85,1.35;3.85;dd_mipmap;" .. mipmap[1] .. ";"
|
||||||
.. getMipmapSettingIndex() .. "]" ..
|
.. getMipmapSettingIndex() .. "]" ..
|
||||||
"label[3.85,2.15;" .. fgettext("Antialiasing:") .. "]" ..
|
"label[3.85,2.15;" .. fgettext("Antialiasing:") .. "]" ..
|
||||||
"dropdown[3.85,2.6;3.85;dd_antialiasing;" .. antialiasing[1][1] .. ";"
|
"dropdown[3.85,2.6;3.85;dd_antialiasing;" .. antialiasing[1] .. ";"
|
||||||
.. getAntialiasingSettingIndex() .. "]" ..
|
.. getAntialiasingSettingIndex() .. "]" ..
|
||||||
"box[7.75,0;4,4;#999999]" ..
|
"box[7.75,0;4,4.4;#999999]" ..
|
||||||
"checkbox[8,0;cb_shaders;" .. fgettext("Shaders") .. ";"
|
"checkbox[8,0;cb_shaders;" .. fgettext("Shaders") .. ";"
|
||||||
.. dump(core.setting_getbool("enable_shaders")) .. "]"
|
.. dump(core.setting_getbool("enable_shaders")) .. "]"
|
||||||
|
|
||||||
@ -236,37 +226,40 @@ local function formspec(tabview, name, tabdata)
|
|||||||
|
|
||||||
if core.setting_get("touchscreen_threshold") ~= nil then
|
if core.setting_get("touchscreen_threshold") ~= nil then
|
||||||
tab_string = tab_string ..
|
tab_string = tab_string ..
|
||||||
"label[4.3,4.1;" .. fgettext("Touchthreshold (px)") .. "]" ..
|
"label[4.3,4.1;" .. fgettext("Touchthreshold (px)") .. "]" ..
|
||||||
"dropdown[3.85,4.55;3.85;dd_touchthreshold;0,10,20,30,40,50;" ..
|
"dropdown[3.85,4.55;3.85;dd_touchthreshold;0,10,20,30,40,50;" ..
|
||||||
((tonumber(core.setting_get("touchscreen_threshold"))/10)+1) .. "]"
|
((tonumber(core.setting_get("touchscreen_threshold")) / 10) + 1) .. "]"
|
||||||
end
|
end
|
||||||
|
|
||||||
if core.setting_getbool("enable_shaders") then
|
if core.setting_getbool("enable_shaders") then
|
||||||
tab_string = tab_string ..
|
tab_string = tab_string ..
|
||||||
"checkbox[8,0.5;cb_bumpmapping;" .. fgettext("Bumpmapping") .. ";"
|
"checkbox[8,0.5;cb_bumpmapping;" .. fgettext("Bump Mapping") .. ";"
|
||||||
.. dump(core.setting_getbool("enable_bumpmapping")) .. "]" ..
|
.. dump(core.setting_getbool("enable_bumpmapping")) .. "]" ..
|
||||||
"checkbox[8,1.0;cb_generate_normalmaps;" .. fgettext("Generate Normalmaps") .. ";"
|
"checkbox[8,1;cb_tonemapping;" .. fgettext("Tone Mapping") .. ";"
|
||||||
.. dump(core.setting_getbool("generate_normalmaps")) .. "]" ..
|
.. dump(core.setting_getbool("tone_mapping")) .. "]" ..
|
||||||
"checkbox[8,1.5;cb_parallax;" .. fgettext("Parallax Occlusion") .. ";"
|
"checkbox[8,1.5;cb_generate_normalmaps;" .. fgettext("Normal Mapping") .. ";"
|
||||||
.. dump(core.setting_getbool("enable_parallax_occlusion")) .. "]" ..
|
.. dump(core.setting_getbool("generate_normalmaps")) .. "]" ..
|
||||||
"checkbox[8,2.0;cb_waving_water;" .. fgettext("Waving Water") .. ";"
|
"checkbox[8,2;cb_parallax;" .. fgettext("Parallax Occlusion") .. ";"
|
||||||
.. dump(core.setting_getbool("enable_waving_water")) .. "]" ..
|
.. dump(core.setting_getbool("enable_parallax_occlusion")) .. "]" ..
|
||||||
"checkbox[8,2.5;cb_waving_leaves;" .. fgettext("Waving Leaves") .. ";"
|
"checkbox[8,2.5;cb_waving_water;" .. fgettext("Waving Water") .. ";"
|
||||||
.. dump(core.setting_getbool("enable_waving_leaves")) .. "]" ..
|
.. dump(core.setting_getbool("enable_waving_water")) .. "]" ..
|
||||||
"checkbox[8,3.0;cb_waving_plants;" .. fgettext("Waving Plants") .. ";"
|
"checkbox[8,3;cb_waving_leaves;" .. fgettext("Waving Leaves") .. ";"
|
||||||
.. dump(core.setting_getbool("enable_waving_plants")) .. "]"
|
.. dump(core.setting_getbool("enable_waving_leaves")) .. "]" ..
|
||||||
|
"checkbox[8,3.5;cb_waving_plants;" .. fgettext("Waving Plants") .. ";"
|
||||||
|
.. dump(core.setting_getbool("enable_waving_plants")) .. "]"
|
||||||
else
|
else
|
||||||
tab_string = tab_string ..
|
tab_string = tab_string ..
|
||||||
"tablecolumns[color;text]" ..
|
"tablecolumns[color;text]" ..
|
||||||
"tableoptions[background=#00000000;highlight=#00000000;border=false]" ..
|
"tableoptions[background=#00000000;highlight=#00000000;border=false]" ..
|
||||||
"table[8.33,0.7;3.5,4;shaders;" ..
|
"table[8.33,0.7;3.5,4;shaders;" ..
|
||||||
"#888888," .. fgettext("Bumpmapping") .. "," ..
|
"#888888," .. fgettext("Bump Mapping") .. "," ..
|
||||||
"#888888," .. fgettext("Generate Normalmaps") .. "," ..
|
"#888888," .. fgettext("Tone Mapping") .. "," ..
|
||||||
"#888888," .. fgettext("Parallax Occlusion") .. "," ..
|
"#888888," .. fgettext("Normal Mapping") .. "," ..
|
||||||
"#888888," .. fgettext("Waving Water") .. "," ..
|
"#888888," .. fgettext("Parallax Occlusion") .. "," ..
|
||||||
"#888888," .. fgettext("Waving Leaves") .. "," ..
|
"#888888," .. fgettext("Waving Water") .. "," ..
|
||||||
"#888888," .. fgettext("Waving Plants") .. "," ..
|
"#888888," .. fgettext("Waving Leaves") .. "," ..
|
||||||
";1]"
|
"#888888," .. fgettext("Waving Plants") .. "," ..
|
||||||
|
";1]"
|
||||||
end
|
end
|
||||||
|
|
||||||
return tab_string
|
return tab_string
|
||||||
@ -283,7 +276,6 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
|||||||
--mm_texture.update("singleplayer", current_game())
|
--mm_texture.update("singleplayer", current_game())
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if fields["cb_smooth_lighting"] then
|
if fields["cb_smooth_lighting"] then
|
||||||
core.setting_set("smooth_lighting", fields["cb_smooth_lighting"])
|
core.setting_set("smooth_lighting", fields["cb_smooth_lighting"])
|
||||||
return true
|
return true
|
||||||
@ -304,13 +296,9 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
|||||||
core.setting_set("connected_glass", fields["cb_connected_glass"])
|
core.setting_set("connected_glass", fields["cb_connected_glass"])
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
if fields["cb_node_highlighting"] then
|
|
||||||
core.setting_set("enable_node_highlighting", fields["cb_node_highlighting"])
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
if fields["cb_shaders"] then
|
if fields["cb_shaders"] then
|
||||||
if (core.setting_get("video_driver") == "direct3d8"
|
if (core.setting_get("video_driver") == "direct3d8" or
|
||||||
or core.setting_get("video_driver") == "direct3d9") then
|
core.setting_get("video_driver") == "direct3d9") then
|
||||||
core.setting_set("enable_shaders", "false")
|
core.setting_set("enable_shaders", "false")
|
||||||
gamedata.errormessage = fgettext("To enable shaders the OpenGL driver needs to be used.")
|
gamedata.errormessage = fgettext("To enable shaders the OpenGL driver needs to be used.")
|
||||||
else
|
else
|
||||||
@ -320,9 +308,15 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
|||||||
end
|
end
|
||||||
if fields["cb_bumpmapping"] then
|
if fields["cb_bumpmapping"] then
|
||||||
core.setting_set("enable_bumpmapping", fields["cb_bumpmapping"])
|
core.setting_set("enable_bumpmapping", fields["cb_bumpmapping"])
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
if fields["cb_tonemapping"] then
|
||||||
|
core.setting_set("tone_mapping", fields["cb_tonemapping"])
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
if fields["cb_generate_normalmaps"] then
|
if fields["cb_generate_normalmaps"] then
|
||||||
core.setting_set("generate_normalmaps", fields["cb_generate_normalmaps"])
|
core.setting_set("generate_normalmaps", fields["cb_generate_normalmaps"])
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
if fields["cb_parallax"] then
|
if fields["cb_parallax"] then
|
||||||
core.setting_set("enable_parallax_occlusion", fields["cb_parallax"])
|
core.setting_set("enable_parallax_occlusion", fields["cb_parallax"])
|
||||||
@ -339,17 +333,6 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
|||||||
core.setting_set("enable_waving_plants", fields["cb_waving_plants"])
|
core.setting_set("enable_waving_plants", fields["cb_waving_plants"])
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if fields["sb_gui_scaling"] then
|
|
||||||
local event = core.explode_scrollbar_event(fields["sb_gui_scaling"])
|
|
||||||
|
|
||||||
if event.type == "CHG" then
|
|
||||||
local tosave = string.format("%.2f",scrollbar_to_gui_scale(event.value))
|
|
||||||
core.setting_set("gui_scaling", tosave)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if fields["btn_change_keys"] then
|
if fields["btn_change_keys"] then
|
||||||
core.show_keys_menu()
|
core.show_keys_menu()
|
||||||
return true
|
return true
|
||||||
@ -366,15 +349,17 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
|||||||
--Note dropdowns have to be handled LAST!
|
--Note dropdowns have to be handled LAST!
|
||||||
local ddhandled = false
|
local ddhandled = false
|
||||||
|
|
||||||
if fields["dd_leaves_style"] == leaves_style_labels[1] then
|
for i = 1, #leaves_style_labels do
|
||||||
core.setting_set("leaves_style", leaves_style[2][1])
|
if fields["dd_leaves_style"] == leaves_style_labels[i] then
|
||||||
ddhandled = true
|
core.setting_set("leaves_style", leaves_style[2][i])
|
||||||
elseif fields["dd_leaves_style"] == leaves_style_labels[2] then
|
ddhandled = true
|
||||||
core.setting_set("leaves_style", leaves_style[2][2])
|
end
|
||||||
ddhandled = true
|
end
|
||||||
elseif fields["dd_leaves_style"] == leaves_style_labels[3] then
|
for i = 1, #node_highlighting_style_labels do
|
||||||
core.setting_set("leaves_style", leaves_style[2][3])
|
if fields["dd_node_highlighting"] == node_highlighting_style_labels[i] then
|
||||||
ddhandled = true
|
core.setting_set("node_highlighting", node_highlighting_style[2][i])
|
||||||
|
ddhandled = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if fields["dd_filters"] == dd_filter_labels[1] then
|
if fields["dd_filters"] == dd_filter_labels[1] then
|
||||||
core.setting_set("bilinear_filter", "false")
|
core.setting_set("bilinear_filter", "false")
|
||||||
@ -408,7 +393,7 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
|||||||
ddhandled = true
|
ddhandled = true
|
||||||
end
|
end
|
||||||
if fields["dd_touchthreshold"] then
|
if fields["dd_touchthreshold"] then
|
||||||
core.setting_set("touchscreen_threshold",fields["dd_touchthreshold"])
|
core.setting_set("touchscreen_threshold", fields["dd_touchthreshold"])
|
||||||
ddhandled = true
|
ddhandled = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user