From 2f59a0c840e9101c87e2d59fabf34116b3328121 Mon Sep 17 00:00:00 2001 From: Lars Hofhansl Date: Sat, 10 Dec 2016 10:31:17 -0800 Subject: Process ABMs in a spherical volume instead of cubic Increase active_block_range default to a 3 mapblock radius. --- src/defaultsettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/defaultsettings.cpp') diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 0b4be6322..5bcd7da3d 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -273,7 +273,7 @@ void set_default_settings(Settings *settings) settings->setDefault("profiler_print_interval", "0"); settings->setDefault("enable_mapgen_debug_info", "false"); settings->setDefault("active_object_send_range_blocks", "3"); - settings->setDefault("active_block_range", "2"); + settings->setDefault("active_block_range", "3"); //settings->setDefault("max_simultaneous_block_sends_per_client", "1"); // This causes frametime jitter on client side, or does it? settings->setDefault("max_simultaneous_block_sends_per_client", "10"); -- cgit v1.2.3 From 094a5a73d3b9817d07c52754749f0828c4005b8c Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 8 Dec 2016 17:37:13 -0800 Subject: Redo light.cpp. Remake the light_decode_table. The table starts out without pre-filled in values since those are always discarded by the code apparently. We calculate a pseudo curve with gamma power function, and then apply a new adjustment table. The adjustment table is setup to make the default gamma of 2.2 look decent: not too dark at light level 3 or so, but too dark at 1 and below to be playable. The curve is much smoother than before and looks reasonable at the whole range, offering a pleasant decay of light levels away from lights. The `display_gamma` setting now actually does something logical: the game is darker at values below 2.2, and brighter at values above 2.2. At 3.0, the game is very bright, but still has a good light scale. At 1.1 or so, the bottom 5 light levels are virtually black, but you can still see enough detail at light levels 7-8, so the range and spread is adequate. I must add that my monitor is somewhat dark to begin with, since I have a `hc` screen that doesn't dynamic range colors or try to pull up `black` pixels for me (it is tuned for accurate color and light levels), so this should look even better on more dynamic display tunings. --- builtin/settingtypes.txt | 4 +- minetest.conf.example | 2 +- src/defaultsettings.cpp | 2 +- src/light.cpp | 351 ++++------------------------------------------- 4 files changed, 28 insertions(+), 331 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 3a740f3ca..8668e1472 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -442,9 +442,9 @@ fov (Field of view) int 72 30 160 # This requires the "zoom" privilege on the server. zoom_fov (Field of view for zoom) int 15 15 160 -# Adjust the gamma encoding for the light tables. Lower numbers are brighter. +# Adjust the gamma encoding for the light tables. Higher numbers are brighter. # This setting is for the client only and is ignored by the server. -display_gamma (Gamma) float 1.8 1.0 3.0 +display_gamma (Gamma) float 2.2 1.0 3.0 # Path to texture directory. All textures are first searched from here. texture_path (Texture path) path diff --git a/minetest.conf.example b/minetest.conf.example index b1d6c86bd..262f95115 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -508,7 +508,7 @@ # Adjust the gamma encoding for the light tables. Lower numbers are brighter. # This setting is for the client only and is ignored by the server. # type: float min: 1 max: 3 -# display_gamma = 1.8 +# display_gamma = 2.2 # Path to texture directory. All textures are first searched from here. # type: path diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 5bcd7da3d..52f4cfec8 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -112,7 +112,7 @@ void set_default_settings(Settings *settings) settings->setDefault("leaves_style", "fancy"); settings->setDefault("connected_glass", "false"); settings->setDefault("smooth_lighting", "true"); - settings->setDefault("display_gamma", "1.8"); + settings->setDefault("display_gamma", "2.2"); settings->setDefault("texture_path", ""); settings->setDefault("shader_path", ""); settings->setDefault("video_driver", "opengl"); diff --git a/src/light.cpp b/src/light.cpp index 5dc01fcf0..4a3ca5a60 100644 --- a/src/light.cpp +++ b/src/light.cpp @@ -26,29 +26,9 @@ with this program; if not, write to the Free Software Foundation, Inc., // Length of LIGHT_MAX+1 means LIGHT_MAX is the last value. // LIGHT_SUN is read as LIGHT_MAX from here. -u8 light_LUT[LIGHT_MAX+1] = -{ - /* Middle-raised variation of a_n+1 = a_n * 0.786 - * Length of LIGHT_MAX+1 means LIGHT_MAX is the last value. - * LIGHT_SUN is read as LIGHT_MAX from here. - */ - 8, - 11+2, - 14+7, - 18+10, - 22+15, - 29+20, - 37+20, - 47+15, - 60+10, - 76+7, - 97+5, - 123+2, - 157, - 200, - 255, -}; +u8 light_LUT[LIGHT_MAX+1]; +// the const ref to light_LUT is what is actually used in the code. const u8 *light_decode_table = light_LUT; /** Initialize or update the light value tables using the specified \p gamma. @@ -65,26 +45,26 @@ void set_light_table(float gamma) { static const float brightness_step = 255.0f / (LIGHT_MAX + 1); - /* These are adjustment values that are added to the calculated light value - * after gamma is applied. Currently they are used so that given a gamma - * of 1.8 the light values set by this function are the same as those - * hardcoded in the initalizer list for the declaration of light_LUT. - */ + // this table is pure arbitrary values, made so that + // at gamma 2.2 the game looks not too dark at light=1, + // and mostly linear for the rest of the scale. + // we could try to inverse the gamma power function, but this + // is simpler and quicker. static const int adjustments[LIGHT_MAX + 1] = { - 7, - 7, - 7, - 5, - 2, - 0, - -7, - -20, - -31, - -39, - -43, - -45, - -40, - -25, + -67, + -91, + -125, + -115, + -104, + -85, + -70, + -63, + -56, + -49, + -42, + -35, + -28, + -22, 0 }; @@ -93,296 +73,13 @@ void set_light_table(float gamma) float brightness = brightness_step; for (size_t i = 0; i < LIGHT_MAX; i++) { - light_LUT[i] = (u8)(255 * powf(brightness / 255.0f, gamma)); + light_LUT[i] = (u8)(255 * powf(brightness / 255.0f, 1.0 / gamma)); light_LUT[i] = rangelim(light_LUT[i] + adjustments[i], 0, 255); - if (i > 1 && light_LUT[i] < light_LUT[i-1]) - light_LUT[i] = light_LUT[i-1] + 1; + if (i > 1 && light_LUT[i] < light_LUT[i - 1]) + light_LUT[i] = light_LUT[i - 1] + 1; brightness += brightness_step; } light_LUT[LIGHT_MAX] = 255; } #endif - - -#if 0 -/* -Made using this and: -- adding 220 as the second last one -- replacing the third last one (212) with 195 - -#!/usr/bin/python - -from math import * -from sys import stdout - -# We want 0 at light=0 and 255 at light=LIGHT_MAX -LIGHT_MAX = 14 -#FACTOR = 0.69 -#FACTOR = 0.75 -FACTOR = 0.83 -START_FROM_ZERO = False - -L = [] -if START_FROM_ZERO: - for i in range(1,LIGHT_MAX+1): - L.append(int(round(255.0 * FACTOR ** (i-1)))) - L.append(0) -else: - for i in range(1,LIGHT_MAX+1): - L.append(int(round(255.0 * FACTOR ** (i-1)))) - L.append(255) - -L.reverse() -for i in L: - stdout.write(str(i)+",\n") -*/ -u8 light_decode_table[LIGHT_MAX+1] = -{ -23, -27, -33, -40, -48, -57, -69, -83, -100, -121, -146, -176, -195, -220, -255, -}; -#endif - -#if 0 -// This is good -// a_n+1 = a_n * 0.786 -// Length of LIGHT_MAX+1 means LIGHT_MAX is the last value. -// LIGHT_SUN is read as LIGHT_MAX from here. -u8 light_decode_table[LIGHT_MAX+1] = -{ -8, -11, -14, -18, -22, -29, -37, -47, -60, -76, -97, -123, -157, -200, -255, -}; -#endif - -#if 0 -// Use for debugging in dark -u8 light_decode_table[LIGHT_MAX+1] = -{ -58, -64, -72, -80, -88, -98, -109, -121, -135, -150, -167, -185, -206, -229, -255, -}; -#endif - -// This is reasonable with classic lighting with a light source -/*u8 light_decode_table[LIGHT_MAX+1] = -{ -2, -3, -4, -6, -9, -13, -18, -25, -32, -35, -45, -57, -69, -79, -255 -};*/ - - -// As in minecraft, a_n+1 = a_n * 0.8 -// NOTE: This doesn't really work that well because this defines -// LIGHT_MAX as dimmer than LIGHT_SUN -// NOTE: Uh, this has had 34 left out; forget this. -/*u8 light_decode_table[LIGHT_MAX+1] = -{ -8, -11, -14, -17, -21, -27, -42, -53, -66, -83, -104, -130, -163, -204, -255, -};*/ - -// This was a quick try of more light, manually quickly made -/*u8 light_decode_table[LIGHT_MAX+1] = -{ -0, -7, -11, -15, -21, -29, -42, -53, -69, -85, -109, -135, -167, -205, -255, -};*/ - -// This was used for a long time, manually made -/*u8 light_decode_table[LIGHT_MAX+1] = -{ -0, -6, -8, -11, -14, -19, -26, -34, -45, -61, -81, -108, -143, -191, -255, -};*/ - -/*u8 light_decode_table[LIGHT_MAX+1] = -{ -0, -3, -6, -10, -18, -25, -35, -50, -75, -95, -120, -150, -185, -215, -255, -};*/ -/*u8 light_decode_table[LIGHT_MAX+1] = -{ -0, -5, -12, -22, -35, -50, -65, -85, -100, -120, -140, -160, -185, -215, -255, -};*/ -// LIGHT_MAX is 14, 0-14 is 15 values -/*u8 light_decode_table[LIGHT_MAX+1] = -{ -0, -9, -12, -14, -16, -20, -26, -34, -45, -61, -81, -108, -143, -191, -255, -};*/ - -#if 0 -/* -#!/usr/bin/python - -from math import * -from sys import stdout - -# We want 0 at light=0 and 255 at light=LIGHT_MAX -LIGHT_MAX = 14 -#FACTOR = 0.69 -FACTOR = 0.75 - -L = [] -for i in range(1,LIGHT_MAX+1): - L.append(int(round(255.0 * FACTOR ** (i-1)))) -L.append(0) - -L.reverse() -for i in L: - stdout.write(str(i)+",\n") -*/ -u8 light_decode_table[LIGHT_MAX+1] = -{ -0, -6, -8, -11, -14, -19, -26, -34, -45, -61, -81, -108, -143, -191, -255, -}; -#endif - - -- cgit v1.2.3 From 7ae7f1ea4cbbda7d7849a1240ce30d867e850bfb Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Sun, 9 Oct 2016 14:36:22 -0400 Subject: Enable mod security by default --- builtin/settingtypes.txt | 2 +- minetest.conf.example | 2 +- src/defaultsettings.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 8668e1472..779224be4 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -1186,7 +1186,7 @@ mgvalleys_np_inter_valley_slope (Valley Slope) noise_params 0.5, 0.5, (128, 128, [*Security] # Prevent mods from doing insecure things like running shell commands. -secure.enable_security (Enable mod security) bool false +secure.enable_security (Enable mod security) bool true # Comma-separated list of trusted mods that are allowed to access insecure # functions even when mod security is on (via request_insecure_environment()). diff --git a/minetest.conf.example b/minetest.conf.example index bf70f5e51..13b2dc7a7 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -1530,7 +1530,7 @@ # Prevent mods from doing insecure things like running shell commands. # type: bool -# secure.enable_security = false +# secure.enable_security = true # Comma-separated list of trusted mods that are allowed to access insecure # functions even when mod security is on (via request_insecure_environment()). diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 52f4cfec8..1096b8904 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -303,7 +303,7 @@ void set_default_settings(Settings *settings) settings->setDefault("emergequeue_limit_diskonly", "32"); settings->setDefault("emergequeue_limit_generate", "32"); settings->setDefault("num_emerge_threads", "1"); - settings->setDefault("secure.enable_security", "false"); + settings->setDefault("secure.enable_security", "true"); settings->setDefault("secure.trusted_mods", ""); settings->setDefault("secure.http_mods", ""); -- cgit v1.2.3 From 80023660979e19b3607fdfb573adb76cb60da5f1 Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Thu, 15 Oct 2015 13:16:26 -0400 Subject: Organize defaultsettings.cpp --- src/defaultsettings.cpp | 219 +++++++++++++++++++++++------------------------- 1 file changed, 107 insertions(+), 112 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 1096b8904..14a88b7a6 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -23,14 +23,39 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "config.h" #include "constants.h" #include "porting.h" +#include "util/string.h" void set_default_settings(Settings *settings) { // Client and server - + settings->setDefault("language", ""); settings->setDefault("name", ""); + settings->setDefault("bind_address", ""); + settings->setDefault("serverlist_url", "servers.minetest.net"); - // Client stuff + // Client + settings->setDefault("address", ""); + settings->setDefault("enable_sound", "true"); + settings->setDefault("sound_volume", "0.8"); + settings->setDefault("enable_mesh_cache", "false"); + settings->setDefault("enable_vbo", "true"); + settings->setDefault("free_move", "false"); + settings->setDefault("fast_move", "false"); + settings->setDefault("noclip", "false"); + settings->setDefault("screenshot_path", "."); + settings->setDefault("screenshot_format", "png"); + settings->setDefault("screenshot_quality", "0"); + settings->setDefault("client_unload_unused_data_timeout", "600"); + settings->setDefault("client_mapblock_limit", "5000"); + settings->setDefault("enable_build_where_you_stand", "false" ); + settings->setDefault("send_pre_v25_init", "false"); + settings->setDefault("curl_timeout", "5000"); + settings->setDefault("curl_parallel_limit", "8"); + settings->setDefault("curl_file_download_timeout", "300000"); + settings->setDefault("curl_verify_cert", "true"); + settings->setDefault("enable_remote_media_server", "true"); + + // Keymap settings->setDefault("remote_port", "30000"); settings->setDefault("keymap_forward", "KEY_KEY_W"); settings->setDefault("keymap_autorun", ""); @@ -52,31 +77,20 @@ void set_default_settings(Settings *settings) settings->setDefault("keymap_fastmove", "KEY_KEY_J"); settings->setDefault("keymap_noclip", "KEY_KEY_H"); settings->setDefault("keymap_cinematic", ""); - settings->setDefault("keymap_screenshot", "KEY_F12"); settings->setDefault("keymap_toggle_hud", "KEY_F1"); settings->setDefault("keymap_toggle_chat", "KEY_F2"); settings->setDefault("keymap_toggle_force_fog_off", "KEY_F3"); - settings->setDefault("keymap_toggle_update_camera", #if DEBUG - "KEY_F4"); + settings->setDefault("keymap_toggle_update_camera", "KEY_F4"); #else - ""); + settings->setDefault("keymap_toggle_update_camera", ""); #endif settings->setDefault("keymap_toggle_debug", "KEY_F5"); settings->setDefault("keymap_toggle_profiler", "KEY_F6"); settings->setDefault("keymap_camera_mode", "KEY_F7"); + settings->setDefault("keymap_screenshot", "KEY_F12"); settings->setDefault("keymap_increase_viewing_range_min", "+"); settings->setDefault("keymap_decrease_viewing_range_min", "-"); - settings->setDefault("enable_build_where_you_stand", "false" ); - settings->setDefault("3d_mode", "none"); - settings->setDefault("3d_paralax_strength", "0.025"); - settings->setDefault("aux1_descends", "false"); - settings->setDefault("doubletap_jump", "false"); - settings->setDefault("always_fly_fast", "true"); - settings->setDefault("directional_colored_fog", "true"); - settings->setDefault("tooltip_show_delay", "400"); - settings->setDefault("zoom_fov", "15"); - // Some (temporary) keys for debugging settings->setDefault("keymap_print_debug_stacks", "KEY_KEY_P"); settings->setDefault("keymap_quicktune_prev", "KEY_HOME"); @@ -84,31 +98,28 @@ void set_default_settings(Settings *settings) settings->setDefault("keymap_quicktune_dec", "KEY_NEXT"); settings->setDefault("keymap_quicktune_inc", "KEY_PRIOR"); - // Show debug info by default? - #ifdef NDEBUG + // Visuals +#ifdef NDEBUG settings->setDefault("show_debug", "false"); - #else +#else settings->setDefault("show_debug", "true"); - #endif - +#endif + settings->setDefault("fsaa", "0"); + settings->setDefault("enable_fog", "true"); + settings->setDefault("fog_start", "0.4"); + settings->setDefault("3d_mode", "none"); + settings->setDefault("3d_paralax_strength", "0.025"); + settings->setDefault("tooltip_show_delay", "400"); + settings->setDefault("zoom_fov", "15"); settings->setDefault("fps_max", "60"); settings->setDefault("pause_fps_max", "20"); settings->setDefault("viewing_range", "100"); - settings->setDefault("map_generation_limit", "31000"); settings->setDefault("screenW", "800"); settings->setDefault("screenH", "600"); settings->setDefault("fullscreen", "false"); settings->setDefault("fullscreen_bpp", "24"); - settings->setDefault("fsaa", "0"); settings->setDefault("vsync", "false"); - settings->setDefault("address", ""); - settings->setDefault("random_input", "false"); - settings->setDefault("client_unload_unused_data_timeout", "600"); - settings->setDefault("client_mapblock_limit", "5000"); - settings->setDefault("enable_fog", "true"); - settings->setDefault("fog_start", "0.4"); settings->setDefault("fov", "72"); - settings->setDefault("view_bobbing", "true"); settings->setDefault("leaves_style", "fancy"); settings->setDefault("connected_glass", "false"); settings->setDefault("smooth_lighting", "true"); @@ -116,21 +127,10 @@ void set_default_settings(Settings *settings) settings->setDefault("texture_path", ""); settings->setDefault("shader_path", ""); settings->setDefault("video_driver", "opengl"); - settings->setDefault("free_move", "false"); - settings->setDefault("noclip", "false"); - settings->setDefault("continuous_forward", "false"); - settings->setDefault("enable_joysticks", "false"); - settings->setDefault("repeat_joystick_button_time", "0.17"); - settings->setDefault("joystick_frustum_sensitivity", "170"); settings->setDefault("cinematic", "false"); settings->setDefault("camera_smoothing", "0"); settings->setDefault("cinematic_camera_smoothing", "0.7"); - settings->setDefault("fast_move", "false"); - settings->setDefault("invert_mouse", "false"); settings->setDefault("enable_clouds", "true"); - settings->setDefault("screenshot_path", "."); - settings->setDefault("screenshot_format", "png"); - settings->setDefault("screenshot_quality", "0"); settings->setDefault("view_bobbing_amount", "1.0"); settings->setDefault("fall_bobbing_amount", "0.0"); settings->setDefault("enable_3d_clouds", "true"); @@ -142,7 +142,6 @@ void set_default_settings(Settings *settings) settings->setDefault("console_alpha", "200"); settings->setDefault("selectionbox_color", "(0,0,0)"); settings->setDefault("selectionbox_width", "2"); - settings->setDefault("inventory_items_animations", "false"); settings->setDefault("node_highlighting", "box"); settings->setDefault("crosshair_color", "(255,255,255)"); settings->setDefault("crosshair_alpha", "255"); @@ -150,20 +149,28 @@ void set_default_settings(Settings *settings) settings->setDefault("gui_scaling", "1.0"); settings->setDefault("gui_scaling_filter", "false"); settings->setDefault("gui_scaling_filter_txr2img", "true"); - settings->setDefault("mouse_sensitivity", "0.2"); - settings->setDefault("enable_sound", "true"); - settings->setDefault("sound_volume", "0.8"); settings->setDefault("desynchronize_mapblock_texture_animation", "true"); settings->setDefault("hud_hotbar_max_width", "1.0"); settings->setDefault("enable_local_map_saving", "false"); settings->setDefault("show_entity_selectionbox", "true"); + settings->setDefault("texture_clean_transparent", "false"); + settings->setDefault("texture_min_size", "64"); + settings->setDefault("ambient_occlusion_gamma", "2.2"); + settings->setDefault("enable_shaders", "true"); + settings->setDefault("enable_particles", "true"); + + settings->setDefault("enable_minimap", "true"); + settings->setDefault("minimap_shape_round", "true"); + settings->setDefault("minimap_double_scan_height", "true"); + // Effects + settings->setDefault("directional_colored_fog", "true"); + settings->setDefault("view_bobbing", "true"); + settings->setDefault("inventory_items_animations", "false"); settings->setDefault("mip_map", "false"); settings->setDefault("anisotropic_filter", "false"); settings->setDefault("bilinear_filter", "false"); settings->setDefault("trilinear_filter", "false"); - settings->setDefault("texture_clean_transparent", "false"); - settings->setDefault("texture_min_size", "64"); settings->setDefault("tone_mapping", "false"); settings->setDefault("enable_bumpmapping", "false"); settings->setDefault("enable_parallax_occlusion", "false"); @@ -180,35 +187,29 @@ void set_default_settings(Settings *settings) settings->setDefault("water_wave_speed", "5.0"); settings->setDefault("enable_waving_leaves", "false"); settings->setDefault("enable_waving_plants", "false"); - settings->setDefault("ambient_occlusion_gamma", "2.2"); - settings->setDefault("enable_shaders", "true"); - settings->setDefault("repeat_rightclick_time", "0.25"); - settings->setDefault("enable_particles", "true"); - settings->setDefault("enable_mesh_cache", "false"); - settings->setDefault("enable_vbo", "true"); - - settings->setDefault("enable_minimap", "true"); - settings->setDefault("minimap_shape_round", "true"); - settings->setDefault("minimap_double_scan_height", "true"); - settings->setDefault("send_pre_v25_init", "false"); - - settings->setDefault("curl_timeout", "5000"); - settings->setDefault("curl_parallel_limit", "8"); - settings->setDefault("curl_file_download_timeout", "300000"); - settings->setDefault("curl_verify_cert", "true"); - settings->setDefault("enable_remote_media_server", "true"); + // Input + settings->setDefault("invert_mouse", "false"); + settings->setDefault("mouse_sensitivity", "0.2"); + settings->setDefault("repeat_rightclick_time", "0.25"); + settings->setDefault("random_input", "false"); + settings->setDefault("aux1_descends", "false"); + settings->setDefault("doubletap_jump", "false"); + settings->setDefault("always_fly_fast", "true"); + settings->setDefault("continuous_forward", "false"); + settings->setDefault("enable_joysticks", "false"); + settings->setDefault("repeat_joystick_button_time", "0.17"); + settings->setDefault("joystick_frustum_sensitivity", "170"); - settings->setDefault("serverlist_url", "servers.minetest.net"); + // Main menu + settings->setDefault("main_menu_path", ""); + settings->setDefault("main_menu_mod_mgr", "1"); + settings->setDefault("main_menu_game_mgr", "0"); + settings->setDefault("modstore_download_url", "https://forum.minetest.net/media/"); + settings->setDefault("modstore_listmods_url", "https://forum.minetest.net/mmdb/mods/"); + settings->setDefault("modstore_details_url", "https://forum.minetest.net/mmdb/mod/*/"); settings->setDefault("serverlist_file", "favoriteservers.txt"); - settings->setDefault("server_announce", "false"); - settings->setDefault("server_url", ""); - settings->setDefault("server_address", ""); - settings->setDefault("server_name", ""); - settings->setDefault("server_description", ""); - - settings->setDefault("disable_escape_sequences", "false"); #if USE_FREETYPE settings->setDefault("freetype", "true"); @@ -221,41 +222,43 @@ void set_default_settings(Settings *settings) settings->setDefault("fallback_font_shadow", "1"); settings->setDefault("fallback_font_shadow_alpha", "128"); - std::stringstream fontsize; - fontsize << TTF_DEFAULT_FONT_SIZE; + std::string font_size_str = std::to_string(TTF_DEFAULT_FONT_SIZE); - settings->setDefault("font_size", fontsize.str()); - settings->setDefault("mono_font_size", fontsize.str()); - settings->setDefault("fallback_font_size", fontsize.str()); + settings->setDefault("fallback_font_size", font_size_str); #else settings->setDefault("freetype", "false"); settings->setDefault("font_path", porting::getDataPath("fonts" DIR_DELIM "lucida_sans")); settings->setDefault("mono_font_path", porting::getDataPath("fonts" DIR_DELIM "mono_dejavu_sans")); - std::stringstream fontsize; - fontsize << DEFAULT_FONT_SIZE; - - settings->setDefault("font_size", fontsize.str()); - settings->setDefault("mono_font_size", fontsize.str()); + std::string font_size_str = to_string(DEFAULT_FONT_SIZE); #endif + settings->setDefault("font_size", font_size_str); + settings->setDefault("mono_font_size", font_size_str); + + + // Server + settings->setDefault("disable_escape_sequences", "false"); - // Server stuff - // "map-dir" doesn't exist by default. + // Network + settings->setDefault("enable_ipv6", "true"); + settings->setDefault("ipv6_server", "false"); settings->setDefault("workaround_window_size","5"); settings->setDefault("max_packets_per_iteration","1024"); settings->setDefault("port", "30000"); - settings->setDefault("bind_address", ""); + settings->setDefault("strict_protocol_version_checking", "false"); + settings->setDefault("player_transfer_distance", "0"); + settings->setDefault("max_simultaneous_block_sends_per_client", "10"); + settings->setDefault("max_simultaneous_block_sends_server_total", "40"); + settings->setDefault("time_send_interval", "5"); + settings->setDefault("default_game", "minetest"); settings->setDefault("motd", ""); settings->setDefault("max_users", "15"); - settings->setDefault("strict_protocol_version_checking", "false"); settings->setDefault("creative_mode", "false"); settings->setDefault("enable_damage", "true"); - settings->setDefault("fixed_map_seed", ""); settings->setDefault("give_initial_stuff", "false"); settings->setDefault("default_password", ""); settings->setDefault("default_privs", "interact, shout"); - settings->setDefault("player_transfer_distance", "0"); settings->setDefault("enable_pvp", "true"); settings->setDefault("disallow_empty_password", "false"); settings->setDefault("disable_anticheat", "false"); @@ -271,18 +274,13 @@ void set_default_settings(Settings *settings) settings->setDefault("ask_reconnect_on_crash", "false"); settings->setDefault("profiler_print_interval", "0"); - settings->setDefault("enable_mapgen_debug_info", "false"); settings->setDefault("active_object_send_range_blocks", "3"); settings->setDefault("active_block_range", "3"); //settings->setDefault("max_simultaneous_block_sends_per_client", "1"); // This causes frametime jitter on client side, or does it? - settings->setDefault("max_simultaneous_block_sends_per_client", "10"); - settings->setDefault("max_simultaneous_block_sends_server_total", "40"); settings->setDefault("max_block_send_distance", "9"); - settings->setDefault("max_block_generate_distance", "7"); settings->setDefault("block_send_optimize_distance", "4"); settings->setDefault("max_clearobjects_extra_loaded_blocks", "4096"); - settings->setDefault("time_send_interval", "5"); settings->setDefault("time_speed", "72"); settings->setDefault("server_unload_unused_data_timeout", "29"); settings->setDefault("max_objects_per_block", "64"); @@ -307,7 +305,7 @@ void set_default_settings(Settings *settings) settings->setDefault("secure.trusted_mods", ""); settings->setDefault("secure.http_mods", ""); - // physics stuff + // Physics settings->setDefault("movement_acceleration_default", "3"); settings->setDefault("movement_acceleration_air", "2"); settings->setDefault("movement_acceleration_fast", "10"); @@ -321,32 +319,30 @@ void set_default_settings(Settings *settings) settings->setDefault("movement_liquid_sink", "10"); settings->setDefault("movement_gravity", "9.81"); - //liquid stuff + // Liquids settings->setDefault("liquid_loop_max", "100000"); settings->setDefault("liquid_queue_purge_time", "0"); settings->setDefault("liquid_update", "1.0"); - //mapgen stuff + // Mapgen settings->setDefault("mg_name", "v7"); settings->setDefault("water_level", "1"); settings->setDefault("chunksize", "5"); settings->setDefault("mg_flags", "dungeons"); + settings->setDefault("fixed_map_seed", ""); + settings->setDefault("map_generation_limit", "31000"); + settings->setDefault("max_block_generate_distance", "7"); + settings->setDefault("enable_mapgen_debug_info", "false"); - // IPv6 - settings->setDefault("enable_ipv6", "true"); - settings->setDefault("ipv6_server", "false"); - - settings->setDefault("main_menu_path", ""); - settings->setDefault("main_menu_mod_mgr", "1"); - settings->setDefault("main_menu_game_mgr", "0"); - settings->setDefault("modstore_download_url", "https://forum.minetest.net/media/"); - settings->setDefault("modstore_listmods_url", "https://forum.minetest.net/mmdb/mods/"); - settings->setDefault("modstore_details_url", "https://forum.minetest.net/mmdb/mod/*/"); + // Server list announcing + settings->setDefault("server_announce", "false"); + settings->setDefault("server_url", ""); + settings->setDefault("server_address", ""); + settings->setDefault("server_name", ""); + settings->setDefault("server_description", ""); settings->setDefault("high_precision_fpu", "true"); - settings->setDefault("language", ""); - #ifdef __ANDROID__ settings->setDefault("screenW", "0"); settings->setDefault("screenH", "0"); @@ -375,13 +371,12 @@ void set_default_settings(Settings *settings) settings->setDefault("viewing_range", "25"); settings->setDefault("inventory_image_hack", "false"); - //check for device with small screen + // Check for a device with a small screen float x_inches = ((double) porting::getDisplaySize().X / (160 * porting::getDisplayDensity())); if (x_inches < 3.5) { settings->setDefault("hud_scaling", "0.6"); - } - else if (x_inches < 4.5) { + } else if (x_inches < 4.5) { settings->setDefault("hud_scaling", "0.7"); } settings->setDefault("curl_verify_cert","false"); @@ -393,7 +388,7 @@ void set_default_settings(Settings *settings) void override_default_settings(Settings *settings, Settings *from) { std::vector names = from->getNames(); - for(size_t i=0; isetDefault(name, from->get(name)); } -- cgit v1.2.3 From f0c6feca97ee412b26c96521724dcd63104185bd Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 14 Jan 2017 12:28:43 +0100 Subject: Fix build with freetype support disabled --- src/defaultsettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/defaultsettings.cpp') diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 14a88b7a6..59cfdd50d 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -230,7 +230,7 @@ void set_default_settings(Settings *settings) settings->setDefault("font_path", porting::getDataPath("fonts" DIR_DELIM "lucida_sans")); settings->setDefault("mono_font_path", porting::getDataPath("fonts" DIR_DELIM "mono_dejavu_sans")); - std::string font_size_str = to_string(DEFAULT_FONT_SIZE); + std::string font_size_str = std::to_string(DEFAULT_FONT_SIZE); #endif settings->setDefault("font_size", font_size_str); settings->setDefault("mono_font_size", font_size_str); -- cgit v1.2.3 From 6d5a40713347424084af8ba04e76278961506881 Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Sat, 21 Jan 2017 19:30:42 +0100 Subject: Add show_statusline_on_connect setting (#5084) Add show_statusline_on_connect setting --- builtin/settingtypes.txt | 3 +++ minetest.conf.example | 6 +++++- src/defaultsettings.cpp | 1 + src/server.cpp | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 2dfe86e04..0f416bc9a 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -703,6 +703,9 @@ map-dir (Map directory) path # Setting it to -1 disables the feature. item_entity_ttl (Item entity TTL) int 900 +# If enabled, show the server status message on player connection. +show_statusline_on_connect (Status message on connection) bool true + # Enable players getting damage and dying. enable_damage (Damage) bool false diff --git a/minetest.conf.example b/minetest.conf.example index 3b686aa61..515b6cfd4 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -841,6 +841,10 @@ # type: int # item_entity_ttl = 900 +# If enabled, show the server status message on player connection. +# type: bool +# show_statusline_on_connect = true + # Enable players getting damage and dying. # type: bool # enable_damage = false @@ -1558,7 +1562,7 @@ # profiler.default_report_format = txt # The file path relative to your worldpath in which profiles will be saved to. -# +# # type: string # profiler.report_path = "" diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 59cfdd50d..e154a63c8 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -255,6 +255,7 @@ void set_default_settings(Settings *settings) settings->setDefault("motd", ""); settings->setDefault("max_users", "15"); settings->setDefault("creative_mode", "false"); + settings->setDefault("show_statusline_on_connect", "true"); settings->setDefault("enable_damage", "true"); settings->setDefault("give_initial_stuff", "false"); settings->setDefault("default_password", ""); diff --git a/src/server.cpp b/src/server.cpp index 1656b9f5a..7e1ab30ac 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1118,7 +1118,7 @@ PlayerSAO* Server::StageTwoClientInit(u16 peer_id) SendDeathscreen(peer_id, false, v3f(0,0,0)); // Note things in chat if not in simple singleplayer mode - if(!m_simple_singleplayer_mode) { + if (!m_simple_singleplayer_mode && g_settings->getBool("show_statusline_on_connect")) { // Send information about server to player in chat SendChatMessage(peer_id, getStatusString()); } -- cgit v1.2.3 From 0c9189d10989f85cd5148107b643dc17a49c06ff Mon Sep 17 00:00:00 2001 From: Ezhh Date: Sun, 29 Jan 2017 16:10:17 +0000 Subject: Add console height setting (#5136) --- builtin/settingtypes.txt | 3 +++ minetest.conf.example | 4 ++++ src/defaultsettings.cpp | 1 + src/game.cpp | 3 ++- 4 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/defaultsettings.cpp') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 581eef315..c81dde7de 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -477,6 +477,9 @@ fall_bobbing_amount (Fall bobbing) float 0.0 # - pageflip: quadbuffer based 3d. 3d_mode (3D mode) enum none none,anaglyph,interlaced,topbottom,sidebyside,pageflip +# In-game chat console height, between 0.1 (10%) and 1.0 (100%). +console_height (Console height) float 1.0 0.1 1.0 + # In-game chat console background color (R,G,B). console_color (Console color) string (0,0,0) diff --git a/minetest.conf.example b/minetest.conf.example index 642b028c7..5c7533e93 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -548,6 +548,10 @@ # type: enum values: none, anaglyph, interlaced, topbottom, sidebyside, pageflip # 3d_mode = none +# In-game chat console height, between 0.1 (10%) and 1.0 (100%). +# type: float +# console_height = 1.0 + # In-game chat console background color (R,G,B). # type: string # console_color = (0,0,0) diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index e154a63c8..84046f61c 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -138,6 +138,7 @@ void set_default_settings(Settings *settings) settings->setDefault("cloud_radius", "12"); settings->setDefault("menu_clouds", "true"); settings->setDefault("opaque_water", "false"); + settings->setDefault("console_height", "1.0"); settings->setDefault("console_color", "(0,0,0)"); settings->setDefault("console_alpha", "200"); settings->setDefault("selectionbox_color", "(0,0,0)"); diff --git a/src/game.cpp b/src/game.cpp index 4b4597a7a..1cb054cab 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2627,7 +2627,8 @@ void Game::processKeyInput(VolatileRunFlags *flags, } else if (wasKeyDown(KeyType::CMD)) { openConsole(0.2, L"/"); } else if (wasKeyDown(KeyType::CONSOLE)) { - openConsole(1); + openConsole(core::clamp( + g_settings->getFloat("console_height"), 0.1f, 1.0f)); } else if (wasKeyDown(KeyType::FREEMOVE)) { toggleFreeMove(statustext_time); } else if (wasKeyDown(KeyType::JUMP)) { -- cgit v1.2.3 From 5707b739f38cc5cf651de5b69d91d4f46511dac0 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Wed, 8 Feb 2017 23:00:37 -0800 Subject: Change default nodetimer_interval to 0.2s. (#5193) We want to reduce the chance that we get lots and lots of node timers all happening once a second, because we're better off doing small bits of work as they are available. Reducing this to 0.2 seconds will greatly reduce the total amount of nodetimers that elapse at the same instance, while not effecting total work load. This results in a far better chance of the server keeping up with work loads. --- builtin/settingtypes.txt | 2 +- minetest.conf.example | 2 +- src/defaultsettings.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index c81dde7de..0e8783f83 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -840,7 +840,7 @@ active_block_mgmt_interval (Active Block Management interval) float 2.0 abm_interval (Active Block Modifier interval) float 1.0 # Length of time between NodeTimer execution cycles -nodetimer_interval (NodeTimer interval) float 1.0 +nodetimer_interval (NodeTimer interval) float 0.2 # If enabled, invalid world data won't cause the server to shut down. # Only enable this if you know what you are doing. diff --git a/minetest.conf.example b/minetest.conf.example index 5c7533e93..a90cc7d8e 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -1027,7 +1027,7 @@ # Length of time between NodeTimer execution cycles # type: float -# nodetimer_interval = 1.0 +# nodetimer_interval = 0.2 # If enabled, invalid world data won't cause the server to shut down. # Only enable this if you know what you are doing. diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 84046f61c..bdf1f92ca 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -295,7 +295,7 @@ void set_default_settings(Settings *settings) settings->setDefault("dedicated_server_step", "0.1"); settings->setDefault("active_block_mgmt_interval", "2.0"); settings->setDefault("abm_interval", "1.0"); - settings->setDefault("nodetimer_interval", "1.0"); + settings->setDefault("nodetimer_interval", "0.2"); settings->setDefault("ignore_world_load_errors", "false"); settings->setDefault("remote_media", ""); settings->setDefault("debug_log_level", "action"); -- cgit v1.2.3 From eb49009d023e6e3b5d59a97b8fb5fed5eee83296 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Tue, 14 Feb 2017 01:08:17 -0800 Subject: FreeType: address font license issues (#5230) It appears we were shipping font files without license text, and I had my doubts about the bitmap fonts being usable directly. This replaces existing TTF fonts with Apache-2.0 licensed fonts from chome core (Cousine, Arimo, Tinos). Include the full license file for all three fonts. The Lucida Sans font bitmap is removed entirely for non-freetype builds. There is therefore only mono fonts for non-freetype builds. --- fonts/Arimo-LICENSE.txt | 202 ++++++++++++++++++++++++++++++++++++++++ fonts/Arimo-Regular.ttf | Bin 0 -> 436876 bytes fonts/Cousine-LICENSE.txt | 202 ++++++++++++++++++++++++++++++++++++++++ fonts/Cousine-Regular.ttf | Bin 0 -> 309040 bytes fonts/DroidSansFallbackFull.ttf | Bin 4529044 -> 0 bytes fonts/Tinos-LICENSE.txt | 202 ++++++++++++++++++++++++++++++++++++++++ fonts/Tinos-Regular.ttf | Bin 0 -> 475996 bytes fonts/liberationmono.ttf | Bin 333636 -> 0 bytes fonts/liberationsans.ttf | Bin 133828 -> 0 bytes fonts/lucida_sans_10.xml | Bin 156248 -> 0 bytes fonts/lucida_sans_100.png | Bin 12012 -> 0 bytes fonts/lucida_sans_11.xml | Bin 157272 -> 0 bytes fonts/lucida_sans_110.png | Bin 14739 -> 0 bytes fonts/lucida_sans_12.xml | Bin 157058 -> 0 bytes fonts/lucida_sans_120.png | Bin 16295 -> 0 bytes fonts/lucida_sans_14.xml | Bin 159272 -> 0 bytes fonts/lucida_sans_140.png | Bin 42429 -> 0 bytes fonts/lucida_sans_16.xml | Bin 160744 -> 0 bytes fonts/lucida_sans_160.png | Bin 48106 -> 0 bytes fonts/lucida_sans_18.xml | Bin 162284 -> 0 bytes fonts/lucida_sans_180.png | Bin 56766 -> 0 bytes fonts/lucida_sans_20.xml | Bin 162438 -> 0 bytes fonts/lucida_sans_200.png | Bin 69059 -> 0 bytes fonts/lucida_sans_22.xml | Bin 162936 -> 0 bytes fonts/lucida_sans_220.png | Bin 74427 -> 0 bytes fonts/lucida_sans_24.xml | Bin 166358 -> 0 bytes fonts/lucida_sans_240.png | Bin 83532 -> 0 bytes fonts/lucida_sans_26.xml | Bin 167054 -> 0 bytes fonts/lucida_sans_260.png | Bin 93958 -> 0 bytes fonts/lucida_sans_28.xml | Bin 167156 -> 0 bytes fonts/lucida_sans_280.png | Bin 101952 -> 0 bytes fonts/lucida_sans_36.xml | Bin 169606 -> 0 bytes fonts/lucida_sans_360.png | Bin 143453 -> 0 bytes fonts/lucida_sans_4.xml | Bin 136910 -> 0 bytes fonts/lucida_sans_40.png | Bin 7642 -> 0 bytes fonts/lucida_sans_48.xml | Bin 171972 -> 0 bytes fonts/lucida_sans_480.png | Bin 205578 -> 0 bytes fonts/lucida_sans_56.xml | Bin 174174 -> 0 bytes fonts/lucida_sans_560.png | Bin 246505 -> 0 bytes fonts/lucida_sans_6.xml | Bin 140552 -> 0 bytes fonts/lucida_sans_60.png | Bin 13992 -> 0 bytes fonts/lucida_sans_8.xml | Bin 154564 -> 0 bytes fonts/lucida_sans_80.png | Bin 9740 -> 0 bytes fonts/lucida_sans_9.xml | Bin 154830 -> 0 bytes fonts/lucida_sans_90.png | Bin 10704 -> 0 bytes src/defaultsettings.cpp | 8 +- 46 files changed, 610 insertions(+), 4 deletions(-) create mode 100644 fonts/Arimo-LICENSE.txt create mode 100644 fonts/Arimo-Regular.ttf create mode 100644 fonts/Cousine-LICENSE.txt create mode 100644 fonts/Cousine-Regular.ttf delete mode 100644 fonts/DroidSansFallbackFull.ttf create mode 100644 fonts/Tinos-LICENSE.txt create mode 100644 fonts/Tinos-Regular.ttf delete mode 100644 fonts/liberationmono.ttf delete mode 100644 fonts/liberationsans.ttf delete mode 100755 fonts/lucida_sans_10.xml delete mode 100755 fonts/lucida_sans_100.png delete mode 100755 fonts/lucida_sans_11.xml delete mode 100755 fonts/lucida_sans_110.png delete mode 100755 fonts/lucida_sans_12.xml delete mode 100755 fonts/lucida_sans_120.png delete mode 100755 fonts/lucida_sans_14.xml delete mode 100755 fonts/lucida_sans_140.png delete mode 100755 fonts/lucida_sans_16.xml delete mode 100755 fonts/lucida_sans_160.png delete mode 100755 fonts/lucida_sans_18.xml delete mode 100755 fonts/lucida_sans_180.png delete mode 100755 fonts/lucida_sans_20.xml delete mode 100755 fonts/lucida_sans_200.png delete mode 100755 fonts/lucida_sans_22.xml delete mode 100755 fonts/lucida_sans_220.png delete mode 100755 fonts/lucida_sans_24.xml delete mode 100755 fonts/lucida_sans_240.png delete mode 100755 fonts/lucida_sans_26.xml delete mode 100755 fonts/lucida_sans_260.png delete mode 100755 fonts/lucida_sans_28.xml delete mode 100755 fonts/lucida_sans_280.png delete mode 100755 fonts/lucida_sans_36.xml delete mode 100755 fonts/lucida_sans_360.png delete mode 100755 fonts/lucida_sans_4.xml delete mode 100755 fonts/lucida_sans_40.png delete mode 100755 fonts/lucida_sans_48.xml delete mode 100755 fonts/lucida_sans_480.png delete mode 100755 fonts/lucida_sans_56.xml delete mode 100755 fonts/lucida_sans_560.png delete mode 100755 fonts/lucida_sans_6.xml delete mode 100755 fonts/lucida_sans_60.png delete mode 100755 fonts/lucida_sans_8.xml delete mode 100755 fonts/lucida_sans_80.png delete mode 100755 fonts/lucida_sans_9.xml delete mode 100755 fonts/lucida_sans_90.png (limited to 'src/defaultsettings.cpp') diff --git a/fonts/Arimo-LICENSE.txt b/fonts/Arimo-LICENSE.txt new file mode 100644 index 000000000..75b52484e --- /dev/null +++ b/fonts/Arimo-LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/fonts/Arimo-Regular.ttf b/fonts/Arimo-Regular.ttf new file mode 100644 index 000000000..9be443c7d Binary files /dev/null and b/fonts/Arimo-Regular.ttf differ diff --git a/fonts/Cousine-LICENSE.txt b/fonts/Cousine-LICENSE.txt new file mode 100644 index 000000000..75b52484e --- /dev/null +++ b/fonts/Cousine-LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/fonts/Cousine-Regular.ttf b/fonts/Cousine-Regular.ttf new file mode 100644 index 000000000..4d6990a25 Binary files /dev/null and b/fonts/Cousine-Regular.ttf differ diff --git a/fonts/DroidSansFallbackFull.ttf b/fonts/DroidSansFallbackFull.ttf deleted file mode 100644 index a9df00585..000000000 Binary files a/fonts/DroidSansFallbackFull.ttf and /dev/null differ diff --git a/fonts/Tinos-LICENSE.txt b/fonts/Tinos-LICENSE.txt new file mode 100644 index 000000000..75b52484e --- /dev/null +++ b/fonts/Tinos-LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/fonts/Tinos-Regular.ttf b/fonts/Tinos-Regular.ttf new file mode 100644 index 000000000..ae5030d14 Binary files /dev/null and b/fonts/Tinos-Regular.ttf differ diff --git a/fonts/liberationmono.ttf b/fonts/liberationmono.ttf deleted file mode 100644 index 7260bd65e..000000000 Binary files a/fonts/liberationmono.ttf and /dev/null differ diff --git a/fonts/liberationsans.ttf b/fonts/liberationsans.ttf deleted file mode 100644 index 59d2e251b..000000000 Binary files a/fonts/liberationsans.ttf and /dev/null differ diff --git a/fonts/lucida_sans_10.xml b/fonts/lucida_sans_10.xml deleted file mode 100755 index d54e9f6a6..000000000 Binary files a/fonts/lucida_sans_10.xml and /dev/null differ diff --git a/fonts/lucida_sans_100.png b/fonts/lucida_sans_100.png deleted file mode 100755 index 9f3dc25c8..000000000 Binary files a/fonts/lucida_sans_100.png and /dev/null differ diff --git a/fonts/lucida_sans_11.xml b/fonts/lucida_sans_11.xml deleted file mode 100755 index 33d06c376..000000000 Binary files a/fonts/lucida_sans_11.xml and /dev/null differ diff --git a/fonts/lucida_sans_110.png b/fonts/lucida_sans_110.png deleted file mode 100755 index 1c98efcca..000000000 Binary files a/fonts/lucida_sans_110.png and /dev/null differ diff --git a/fonts/lucida_sans_12.xml b/fonts/lucida_sans_12.xml deleted file mode 100755 index 382981dcf..000000000 Binary files a/fonts/lucida_sans_12.xml and /dev/null differ diff --git a/fonts/lucida_sans_120.png b/fonts/lucida_sans_120.png deleted file mode 100755 index c106feb27..000000000 Binary files a/fonts/lucida_sans_120.png and /dev/null differ diff --git a/fonts/lucida_sans_14.xml b/fonts/lucida_sans_14.xml deleted file mode 100755 index 99398d792..000000000 Binary files a/fonts/lucida_sans_14.xml and /dev/null differ diff --git a/fonts/lucida_sans_140.png b/fonts/lucida_sans_140.png deleted file mode 100755 index d314dc5b3..000000000 Binary files a/fonts/lucida_sans_140.png and /dev/null differ diff --git a/fonts/lucida_sans_16.xml b/fonts/lucida_sans_16.xml deleted file mode 100755 index b07c1119f..000000000 Binary files a/fonts/lucida_sans_16.xml and /dev/null differ diff --git a/fonts/lucida_sans_160.png b/fonts/lucida_sans_160.png deleted file mode 100755 index 233ee9d42..000000000 Binary files a/fonts/lucida_sans_160.png and /dev/null differ diff --git a/fonts/lucida_sans_18.xml b/fonts/lucida_sans_18.xml deleted file mode 100755 index 881aff18d..000000000 Binary files a/fonts/lucida_sans_18.xml and /dev/null differ diff --git a/fonts/lucida_sans_180.png b/fonts/lucida_sans_180.png deleted file mode 100755 index 68cbe3bc8..000000000 Binary files a/fonts/lucida_sans_180.png and /dev/null differ diff --git a/fonts/lucida_sans_20.xml b/fonts/lucida_sans_20.xml deleted file mode 100755 index 329c226c0..000000000 Binary files a/fonts/lucida_sans_20.xml and /dev/null differ diff --git a/fonts/lucida_sans_200.png b/fonts/lucida_sans_200.png deleted file mode 100755 index 7b57632b8..000000000 Binary files a/fonts/lucida_sans_200.png and /dev/null differ diff --git a/fonts/lucida_sans_22.xml b/fonts/lucida_sans_22.xml deleted file mode 100755 index 14d0cc2b9..000000000 Binary files a/fonts/lucida_sans_22.xml and /dev/null differ diff --git a/fonts/lucida_sans_220.png b/fonts/lucida_sans_220.png deleted file mode 100755 index 4f385f4d4..000000000 Binary files a/fonts/lucida_sans_220.png and /dev/null differ diff --git a/fonts/lucida_sans_24.xml b/fonts/lucida_sans_24.xml deleted file mode 100755 index 5956f46e6..000000000 Binary files a/fonts/lucida_sans_24.xml and /dev/null differ diff --git a/fonts/lucida_sans_240.png b/fonts/lucida_sans_240.png deleted file mode 100755 index 8fc4e9d6b..000000000 Binary files a/fonts/lucida_sans_240.png and /dev/null differ diff --git a/fonts/lucida_sans_26.xml b/fonts/lucida_sans_26.xml deleted file mode 100755 index ae10ff8d7..000000000 Binary files a/fonts/lucida_sans_26.xml and /dev/null differ diff --git a/fonts/lucida_sans_260.png b/fonts/lucida_sans_260.png deleted file mode 100755 index 9bae8de5b..000000000 Binary files a/fonts/lucida_sans_260.png and /dev/null differ diff --git a/fonts/lucida_sans_28.xml b/fonts/lucida_sans_28.xml deleted file mode 100755 index c1b3361d3..000000000 Binary files a/fonts/lucida_sans_28.xml and /dev/null differ diff --git a/fonts/lucida_sans_280.png b/fonts/lucida_sans_280.png deleted file mode 100755 index 527fa3734..000000000 Binary files a/fonts/lucida_sans_280.png and /dev/null differ diff --git a/fonts/lucida_sans_36.xml b/fonts/lucida_sans_36.xml deleted file mode 100755 index ca300d6de..000000000 Binary files a/fonts/lucida_sans_36.xml and /dev/null differ diff --git a/fonts/lucida_sans_360.png b/fonts/lucida_sans_360.png deleted file mode 100755 index eecf35e33..000000000 Binary files a/fonts/lucida_sans_360.png and /dev/null differ diff --git a/fonts/lucida_sans_4.xml b/fonts/lucida_sans_4.xml deleted file mode 100755 index edc5af951..000000000 Binary files a/fonts/lucida_sans_4.xml and /dev/null differ diff --git a/fonts/lucida_sans_40.png b/fonts/lucida_sans_40.png deleted file mode 100755 index 5c10c1ed3..000000000 Binary files a/fonts/lucida_sans_40.png and /dev/null differ diff --git a/fonts/lucida_sans_48.xml b/fonts/lucida_sans_48.xml deleted file mode 100755 index c8c75974d..000000000 Binary files a/fonts/lucida_sans_48.xml and /dev/null differ diff --git a/fonts/lucida_sans_480.png b/fonts/lucida_sans_480.png deleted file mode 100755 index 928a0d723..000000000 Binary files a/fonts/lucida_sans_480.png and /dev/null differ diff --git a/fonts/lucida_sans_56.xml b/fonts/lucida_sans_56.xml deleted file mode 100755 index 9f2cc831e..000000000 Binary files a/fonts/lucida_sans_56.xml and /dev/null differ diff --git a/fonts/lucida_sans_560.png b/fonts/lucida_sans_560.png deleted file mode 100755 index 7afb09912..000000000 Binary files a/fonts/lucida_sans_560.png and /dev/null differ diff --git a/fonts/lucida_sans_6.xml b/fonts/lucida_sans_6.xml deleted file mode 100755 index 069c9aa80..000000000 Binary files a/fonts/lucida_sans_6.xml and /dev/null differ diff --git a/fonts/lucida_sans_60.png b/fonts/lucida_sans_60.png deleted file mode 100755 index 0efcd9e32..000000000 Binary files a/fonts/lucida_sans_60.png and /dev/null differ diff --git a/fonts/lucida_sans_8.xml b/fonts/lucida_sans_8.xml deleted file mode 100755 index 44f0e6a74..000000000 Binary files a/fonts/lucida_sans_8.xml and /dev/null differ diff --git a/fonts/lucida_sans_80.png b/fonts/lucida_sans_80.png deleted file mode 100755 index 287c65663..000000000 Binary files a/fonts/lucida_sans_80.png and /dev/null differ diff --git a/fonts/lucida_sans_9.xml b/fonts/lucida_sans_9.xml deleted file mode 100755 index 99aa6447c..000000000 Binary files a/fonts/lucida_sans_9.xml and /dev/null differ diff --git a/fonts/lucida_sans_90.png b/fonts/lucida_sans_90.png deleted file mode 100755 index 822a465f2..000000000 Binary files a/fonts/lucida_sans_90.png and /dev/null differ diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index bdf1f92ca..4e4c2f92c 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -214,11 +214,11 @@ void set_default_settings(Settings *settings) #if USE_FREETYPE settings->setDefault("freetype", "true"); - settings->setDefault("font_path", porting::getDataPath("fonts" DIR_DELIM "liberationsans.ttf")); + settings->setDefault("font_path", porting::getDataPath("fonts" DIR_DELIM "Arimo-Regular.ttf")); settings->setDefault("font_shadow", "1"); settings->setDefault("font_shadow_alpha", "127"); - settings->setDefault("mono_font_path", porting::getDataPath("fonts" DIR_DELIM "liberationmono.ttf")); - settings->setDefault("fallback_font_path", porting::getDataPath("fonts" DIR_DELIM "DroidSansFallbackFull.ttf")); + settings->setDefault("mono_font_path", porting::getDataPath("fonts" DIR_DELIM "Cousine-Regular.ttf")); + settings->setDefault("fallback_font_path", porting::getDataPath("fonts" DIR_DELIM "Tinos-Regular.ttf")); settings->setDefault("fallback_font_shadow", "1"); settings->setDefault("fallback_font_shadow_alpha", "128"); @@ -228,7 +228,7 @@ void set_default_settings(Settings *settings) settings->setDefault("fallback_font_size", font_size_str); #else settings->setDefault("freetype", "false"); - settings->setDefault("font_path", porting::getDataPath("fonts" DIR_DELIM "lucida_sans")); + settings->setDefault("font_path", porting::getDataPath("fonts" DIR_DELIM "mono_dejavu_sans")); settings->setDefault("mono_font_path", porting::getDataPath("fonts" DIR_DELIM "mono_dejavu_sans")); std::string font_size_str = std::to_string(DEFAULT_FONT_SIZE); -- cgit v1.2.3 From d0ce27edd8e9a30330c81a69ccca52b02056c286 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Tue, 14 Feb 2017 15:01:25 -0800 Subject: Revert part of eb49009d023e6e3b5d59a97b8fb5fed5eee83296 (#5230) This reverts the removal of Droid Sans as fallback font. The license for this font used to be GPL2. I've updated the font files to Liberation 2.00, which are SIL, and do not require us to ship source code. I've attempted to fix all the attribution and license strings, and used the strings as provided by redhat for attribution to make sure they're correct. Last, I've removed a bunch of executable bits on files that do not need them. Fixes #5231 --- README.txt | 17 +-- fonts/Arimo-LICENSE.txt | 204 +------------------------------- fonts/Cousine-LICENSE.txt | 204 +------------------------------- fonts/DroidSansFallbackFull-LICENSE.txt | 13 ++ fonts/DroidSansFallbackFull.ttf | Bin 0 -> 4529044 bytes fonts/Tinos-LICENSE.txt | 202 ------------------------------- fonts/Tinos-Regular.ttf | Bin 475996 -> 0 bytes fonts/mono_dejavu_sans_10.xml | Bin fonts/mono_dejavu_sans_100.png | Bin fonts/mono_dejavu_sans_11.xml | Bin fonts/mono_dejavu_sans_110.png | Bin fonts/mono_dejavu_sans_12.xml | Bin fonts/mono_dejavu_sans_120.png | Bin fonts/mono_dejavu_sans_14.xml | Bin fonts/mono_dejavu_sans_140.png | Bin fonts/mono_dejavu_sans_16.xml | Bin fonts/mono_dejavu_sans_160.png | Bin fonts/mono_dejavu_sans_18.xml | Bin fonts/mono_dejavu_sans_180.png | Bin fonts/mono_dejavu_sans_20.xml | Bin fonts/mono_dejavu_sans_200.png | Bin fonts/mono_dejavu_sans_22.xml | Bin fonts/mono_dejavu_sans_220.png | Bin fonts/mono_dejavu_sans_24.xml | Bin fonts/mono_dejavu_sans_240.png | Bin fonts/mono_dejavu_sans_26.xml | Bin fonts/mono_dejavu_sans_260.png | Bin fonts/mono_dejavu_sans_28.xml | Bin fonts/mono_dejavu_sans_280.png | Bin fonts/mono_dejavu_sans_4.xml | Bin fonts/mono_dejavu_sans_40.png | Bin fonts/mono_dejavu_sans_6.xml | Bin fonts/mono_dejavu_sans_60.png | Bin fonts/mono_dejavu_sans_8.xml | Bin fonts/mono_dejavu_sans_80.png | Bin fonts/mono_dejavu_sans_9.xml | Bin fonts/mono_dejavu_sans_90.png | Bin src/defaultsettings.cpp | 2 +- 38 files changed, 23 insertions(+), 619 deletions(-) create mode 100644 fonts/DroidSansFallbackFull-LICENSE.txt create mode 100644 fonts/DroidSansFallbackFull.ttf delete mode 100644 fonts/Tinos-LICENSE.txt delete mode 100644 fonts/Tinos-Regular.ttf mode change 100755 => 100644 fonts/mono_dejavu_sans_10.xml mode change 100755 => 100644 fonts/mono_dejavu_sans_100.png mode change 100755 => 100644 fonts/mono_dejavu_sans_11.xml mode change 100755 => 100644 fonts/mono_dejavu_sans_110.png mode change 100755 => 100644 fonts/mono_dejavu_sans_12.xml mode change 100755 => 100644 fonts/mono_dejavu_sans_120.png mode change 100755 => 100644 fonts/mono_dejavu_sans_14.xml mode change 100755 => 100644 fonts/mono_dejavu_sans_140.png mode change 100755 => 100644 fonts/mono_dejavu_sans_16.xml mode change 100755 => 100644 fonts/mono_dejavu_sans_160.png mode change 100755 => 100644 fonts/mono_dejavu_sans_18.xml mode change 100755 => 100644 fonts/mono_dejavu_sans_180.png mode change 100755 => 100644 fonts/mono_dejavu_sans_20.xml mode change 100755 => 100644 fonts/mono_dejavu_sans_200.png mode change 100755 => 100644 fonts/mono_dejavu_sans_22.xml mode change 100755 => 100644 fonts/mono_dejavu_sans_220.png mode change 100755 => 100644 fonts/mono_dejavu_sans_24.xml mode change 100755 => 100644 fonts/mono_dejavu_sans_240.png mode change 100755 => 100644 fonts/mono_dejavu_sans_26.xml mode change 100755 => 100644 fonts/mono_dejavu_sans_260.png mode change 100755 => 100644 fonts/mono_dejavu_sans_28.xml mode change 100755 => 100644 fonts/mono_dejavu_sans_280.png mode change 100755 => 100644 fonts/mono_dejavu_sans_4.xml mode change 100755 => 100644 fonts/mono_dejavu_sans_40.png mode change 100755 => 100644 fonts/mono_dejavu_sans_6.xml mode change 100755 => 100644 fonts/mono_dejavu_sans_60.png mode change 100755 => 100644 fonts/mono_dejavu_sans_8.xml mode change 100755 => 100644 fonts/mono_dejavu_sans_80.png mode change 100755 => 100644 fonts/mono_dejavu_sans_9.xml mode change 100755 => 100644 fonts/mono_dejavu_sans_90.png (limited to 'src/defaultsettings.cpp') diff --git a/README.txt b/README.txt index 4c02763ca..0727d10ea 100644 --- a/README.txt +++ b/README.txt @@ -527,25 +527,18 @@ THE SOFTWARE. Fonts --------------- -DejaVu Sans Mono: - - Fonts are (c) Bitstream (see below). DejaVu changes are in public domain. - Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below) - Bitstream Vera Fonts Copyright: Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a trademark of Bitstream, Inc. -Arev Fonts Copyright: - - Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved. - -Liberation Fonts Copyright: +Arimo - Apache License, version 2.0 + Digitized data copyright (c) 2010-2012 Google Corporation. - Copyright (c) 2007 Red Hat, Inc. All rights reserved. LIBERATION is a trademark of Red Hat, Inc. +Cousine - Apache License, version 2.0 + Digitized data copyright (c) 2010-2012 Google Corporation. -DroidSansFallback: +DroidSansFallBackFull: Copyright (C) 2008 The Android Open Source Project diff --git a/fonts/Arimo-LICENSE.txt b/fonts/Arimo-LICENSE.txt index 75b52484e..d68578f6a 100644 --- a/fonts/Arimo-LICENSE.txt +++ b/fonts/Arimo-LICENSE.txt @@ -1,202 +1,2 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +Arimo - Apache License, version 2.0 +Arimo-Regular.ttf: Digitized data copyright (c) 2010-2012 Google Corporation. diff --git a/fonts/Cousine-LICENSE.txt b/fonts/Cousine-LICENSE.txt index 75b52484e..c84465f01 100644 --- a/fonts/Cousine-LICENSE.txt +++ b/fonts/Cousine-LICENSE.txt @@ -1,202 +1,2 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +Cousine - Apache License, version 2.0 +Cousine-Regular.ttf: Digitized data copyright (c) 2010-2012 Google Corporation. diff --git a/fonts/DroidSansFallbackFull-LICENSE.txt b/fonts/DroidSansFallbackFull-LICENSE.txt new file mode 100644 index 000000000..d3a2eaa8c --- /dev/null +++ b/fonts/DroidSansFallbackFull-LICENSE.txt @@ -0,0 +1,13 @@ +Copyright (C) 2008 The Android Open Source Project + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/fonts/DroidSansFallbackFull.ttf b/fonts/DroidSansFallbackFull.ttf new file mode 100644 index 000000000..a9df00585 Binary files /dev/null and b/fonts/DroidSansFallbackFull.ttf differ diff --git a/fonts/Tinos-LICENSE.txt b/fonts/Tinos-LICENSE.txt deleted file mode 100644 index 75b52484e..000000000 --- a/fonts/Tinos-LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/fonts/Tinos-Regular.ttf b/fonts/Tinos-Regular.ttf deleted file mode 100644 index ae5030d14..000000000 Binary files a/fonts/Tinos-Regular.ttf and /dev/null differ diff --git a/fonts/mono_dejavu_sans_10.xml b/fonts/mono_dejavu_sans_10.xml old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_100.png b/fonts/mono_dejavu_sans_100.png old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_11.xml b/fonts/mono_dejavu_sans_11.xml old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_110.png b/fonts/mono_dejavu_sans_110.png old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_12.xml b/fonts/mono_dejavu_sans_12.xml old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_120.png b/fonts/mono_dejavu_sans_120.png old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_14.xml b/fonts/mono_dejavu_sans_14.xml old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_140.png b/fonts/mono_dejavu_sans_140.png old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_16.xml b/fonts/mono_dejavu_sans_16.xml old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_160.png b/fonts/mono_dejavu_sans_160.png old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_18.xml b/fonts/mono_dejavu_sans_18.xml old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_180.png b/fonts/mono_dejavu_sans_180.png old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_20.xml b/fonts/mono_dejavu_sans_20.xml old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_200.png b/fonts/mono_dejavu_sans_200.png old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_22.xml b/fonts/mono_dejavu_sans_22.xml old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_220.png b/fonts/mono_dejavu_sans_220.png old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_24.xml b/fonts/mono_dejavu_sans_24.xml old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_240.png b/fonts/mono_dejavu_sans_240.png old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_26.xml b/fonts/mono_dejavu_sans_26.xml old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_260.png b/fonts/mono_dejavu_sans_260.png old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_28.xml b/fonts/mono_dejavu_sans_28.xml old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_280.png b/fonts/mono_dejavu_sans_280.png old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_4.xml b/fonts/mono_dejavu_sans_4.xml old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_40.png b/fonts/mono_dejavu_sans_40.png old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_6.xml b/fonts/mono_dejavu_sans_6.xml old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_60.png b/fonts/mono_dejavu_sans_60.png old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_8.xml b/fonts/mono_dejavu_sans_8.xml old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_80.png b/fonts/mono_dejavu_sans_80.png old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_9.xml b/fonts/mono_dejavu_sans_9.xml old mode 100755 new mode 100644 diff --git a/fonts/mono_dejavu_sans_90.png b/fonts/mono_dejavu_sans_90.png old mode 100755 new mode 100644 diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 4e4c2f92c..b333ff087 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -218,7 +218,7 @@ void set_default_settings(Settings *settings) settings->setDefault("font_shadow", "1"); settings->setDefault("font_shadow_alpha", "127"); settings->setDefault("mono_font_path", porting::getDataPath("fonts" DIR_DELIM "Cousine-Regular.ttf")); - settings->setDefault("fallback_font_path", porting::getDataPath("fonts" DIR_DELIM "Tinos-Regular.ttf")); + settings->setDefault("fallback_font_path", porting::getDataPath("fonts" DIR_DELIM "DroidSansFallbackFull.ttf")); settings->setDefault("fallback_font_shadow", "1"); settings->setDefault("fallback_font_shadow_alpha", "128"); -- cgit v1.2.3 From d34f149bdc4f72db904d948413fa6b3f649dca7b Mon Sep 17 00:00:00 2001 From: paramat Date: Mon, 6 Mar 2017 08:35:13 +0000 Subject: Climb speed: Increase default setting from 2 to 3 --- builtin/settingtypes.txt | 2 +- minetest.conf.example | 2 +- src/defaultsettings.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 0e8783f83..4e800e25b 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -799,7 +799,7 @@ movement_acceleration_fast (Fast mode acceleration) float 10 movement_speed_walk (Walking speed) float 4 movement_speed_crouch (Crouch speed) float 1.35 movement_speed_fast (Fast mode speed) float 20 -movement_speed_climb (Climbing speed) float 2 +movement_speed_climb (Climbing speed) float 3 movement_speed_jump (Jumping speed) float 6.5 movement_speed_descend (Descending speed) float 6 movement_liquid_fluidity (Liquid fluidity) float 1 diff --git a/minetest.conf.example b/minetest.conf.example index a90cc7d8e..d53a00fd9 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -965,7 +965,7 @@ # movement_speed_fast = 20 # type: float -# movement_speed_climb = 2 +# movement_speed_climb = 3 # type: float # movement_speed_jump = 6.5 diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index b333ff087..e9ee1135f 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -314,7 +314,7 @@ void set_default_settings(Settings *settings) settings->setDefault("movement_speed_walk", "4"); settings->setDefault("movement_speed_crouch", "1.35"); settings->setDefault("movement_speed_fast", "20"); - settings->setDefault("movement_speed_climb", "2"); + settings->setDefault("movement_speed_climb", "3"); settings->setDefault("movement_speed_jump", "6.5"); settings->setDefault("movement_liquid_fluidity", "1"); settings->setDefault("movement_liquid_fluidity_smooth", "0.5"); -- cgit v1.2.3 From ba4b704ebf24952ab9a84c914b8ad6c45dabfaba Mon Sep 17 00:00:00 2001 From: Lars Hofhansl Date: Mon, 27 Feb 2017 23:06:15 -0800 Subject: Allow server side occlusion culling. --- builtin/settingtypes.txt | 6 +++++ minetest.conf.example | 6 +++++ src/clientiface.cpp | 8 ++++++ src/clientmap.cpp | 67 +----------------------------------------------- src/defaultsettings.cpp | 1 + src/map.cpp | 66 +++++++++++++++++++++++++++++++++++++++++++++++ src/map.h | 4 +++ 7 files changed, 92 insertions(+), 66 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 4e800e25b..ffd872c20 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -864,6 +864,12 @@ liquid_update (Liquid update tick) float 1.0 # Stated in mapblocks (16 nodes) block_send_optimize_distance (block send optimize distance) int 4 2 +# If enabled the server will perform map block occlusion culling based on +# on the eye position of the player. This can reduce the number of blocks +# sent to the client 50-80%. The client will not longer receive most invisible +# so that the utility of noclip mode is reduced. +server_side_occlusion_culling (Server side occlusion culling) bool false + [*Mapgen] # Name of map generator to be used when creating a new world. diff --git a/minetest.conf.example b/minetest.conf.example index d53a00fd9..08d00d62a 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -1056,6 +1056,12 @@ # type: int min: 2 # block_send_optimize_distance = 4 +# If enabled the server will perform map block occlusion culling based on +# on the eye position of the player. This can reduce the number of blocks +# sent to the client 50-80%. The client will not longer receive most invisible +# so that the utility of noclip mode is reduced. +server_side_occlusion_culling = false + ## Mapgen # Name of map generator to be used when creating a new world. diff --git a/src/clientiface.cpp b/src/clientiface.cpp index 0eb68c9c1..76a34c392 100644 --- a/src/clientiface.cpp +++ b/src/clientiface.cpp @@ -197,6 +197,9 @@ void RemoteClient::GetNextBlocks ( s32 nearest_sent_d = -1; //bool queue_is_full = false; + const v3s16 cam_pos_nodes = floatToInt(camera_pos, BS); + const bool occ_cull = g_settings->getBool("server_side_occlusion_culling"); + s16 d; for(d = d_start; d <= d_max; d++) { /* @@ -298,6 +301,11 @@ void RemoteClient::GetNextBlocks ( if(block->getDayNightDiff() == false) continue; } + + if (occ_cull && !block_is_invalid && + env->getMap().isBlockOccluded(block, cam_pos_nodes)) { + continue; + } } /* diff --git a/src/clientmap.cpp b/src/clientmap.cpp index fb70a97e9..4cae03bf2 100644 --- a/src/clientmap.cpp +++ b/src/clientmap.cpp @@ -109,35 +109,6 @@ void ClientMap::OnRegisterSceneNode() ISceneNode::OnRegisterSceneNode(); } -static bool isOccluded(Map *map, v3s16 p0, v3s16 p1, float step, float stepfac, - float start_off, float end_off, u32 needed_count, INodeDefManager *nodemgr) -{ - float d0 = (float)BS * p0.getDistanceFrom(p1); - v3s16 u0 = p1 - p0; - v3f uf = v3f(u0.X, u0.Y, u0.Z) * BS; - uf.normalize(); - v3f p0f = v3f(p0.X, p0.Y, p0.Z) * BS; - u32 count = 0; - for(float s=start_off; sgetNodeNoEx(p); - bool is_transparent = false; - const ContentFeatures &f = nodemgr->get(n); - if(f.solidness == 0) - is_transparent = (f.visual_solidness != 2); - else - is_transparent = (f.solidness != 2); - if(!is_transparent){ - count++; - if(count >= needed_count) - return true; - } - step *= stepfac; - } - return false; -} - void ClientMap::getBlocksInViewRange(v3s16 cam_pos_nodes, v3s16 *p_blocks_min, v3s16 *p_blocks_max) { @@ -273,43 +244,7 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver) /* Occlusion culling */ - v3s16 cpn = block->getPos() * MAP_BLOCKSIZE; - cpn += v3s16(MAP_BLOCKSIZE / 2, MAP_BLOCKSIZE / 2, MAP_BLOCKSIZE / 2); - float step = BS * 1; - float stepfac = 1.1; - float startoff = BS * 1; - // The occlusion search of 'isOccluded()' must stop short of the target - // point by distance 'endoff' (end offset) to not enter the target mapblock. - // For the 8 mapblock corners 'endoff' must therefore be the maximum diagonal - // of a mapblock, because we must consider all view angles. - // sqrt(1^2 + 1^2 + 1^2) = 1.732 - float endoff = -BS * MAP_BLOCKSIZE * 1.732050807569; - v3s16 spn = cam_pos_nodes; - s16 bs2 = MAP_BLOCKSIZE / 2 + 1; - // to reduce the likelihood of falsely occluded blocks - // require at least two solid blocks - // this is a HACK, we should think of a more precise algorithm - u32 needed_count = 2; - if (occlusion_culling_enabled && - // For the central point of the mapblock 'endoff' can be halved - isOccluded(this, spn, cpn, - step, stepfac, startoff, endoff / 2.0f, needed_count, m_nodedef) && - isOccluded(this, spn, cpn + v3s16(bs2,bs2,bs2), - step, stepfac, startoff, endoff, needed_count, m_nodedef) && - isOccluded(this, spn, cpn + v3s16(bs2,bs2,-bs2), - step, stepfac, startoff, endoff, needed_count, m_nodedef) && - isOccluded(this, spn, cpn + v3s16(bs2,-bs2,bs2), - step, stepfac, startoff, endoff, needed_count, m_nodedef) && - isOccluded(this, spn, cpn + v3s16(bs2,-bs2,-bs2), - step, stepfac, startoff, endoff, needed_count, m_nodedef) && - isOccluded(this, spn, cpn + v3s16(-bs2,bs2,bs2), - step, stepfac, startoff, endoff, needed_count, m_nodedef) && - isOccluded(this, spn, cpn + v3s16(-bs2,bs2,-bs2), - step, stepfac, startoff, endoff, needed_count, m_nodedef) && - isOccluded(this, spn, cpn + v3s16(-bs2,-bs2,bs2), - step, stepfac, startoff, endoff, needed_count, m_nodedef) && - isOccluded(this, spn, cpn + v3s16(-bs2,-bs2,-bs2), - step, stepfac, startoff, endoff, needed_count, m_nodedef)) { + if (occlusion_culling_enabled && isBlockOccluded(block, cam_pos_nodes)) { blocks_occlusion_culled++; continue; } diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index e9ee1135f..483c9cff6 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -282,6 +282,7 @@ void set_default_settings(Settings *settings) // This causes frametime jitter on client side, or does it? settings->setDefault("max_block_send_distance", "9"); settings->setDefault("block_send_optimize_distance", "4"); + settings->setDefault("server_side_occlusion_culling", "false"); settings->setDefault("max_clearobjects_extra_loaded_blocks", "4096"); settings->setDefault("time_speed", "72"); settings->setDefault("server_unload_unused_data_timeout", "29"); diff --git a/src/map.cpp b/src/map.cpp index a1502befa..43a49dc2f 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1157,6 +1157,72 @@ void Map::removeNodeTimer(v3s16 p) block->m_node_timers.remove(p_rel); } +bool Map::isOccluded(v3s16 p0, v3s16 p1, float step, float stepfac, + float start_off, float end_off, u32 needed_count) +{ + float d0 = (float)BS * p0.getDistanceFrom(p1); + v3s16 u0 = p1 - p0; + v3f uf = v3f(u0.X, u0.Y, u0.Z) * BS; + uf.normalize(); + v3f p0f = v3f(p0.X, p0.Y, p0.Z) * BS; + u32 count = 0; + for(float s=start_off; sget(n); + if(f.drawtype == NDT_NORMAL){ + // not transparent, see ContentFeature::updateTextures + count++; + if(count >= needed_count) + return true; + } + step *= stepfac; + } + return false; +} + +bool Map::isBlockOccluded(MapBlock *block, v3s16 cam_pos_nodes) { + v3s16 cpn = block->getPos() * MAP_BLOCKSIZE; + cpn += v3s16(MAP_BLOCKSIZE / 2, MAP_BLOCKSIZE / 2, MAP_BLOCKSIZE / 2); + float step = BS * 1; + float stepfac = 1.1; + float startoff = BS * 1; + // The occlusion search of 'isOccluded()' must stop short of the target + // point by distance 'endoff' (end offset) to not enter the target mapblock. + // For the 8 mapblock corners 'endoff' must therefore be the maximum diagonal + // of a mapblock, because we must consider all view angles. + // sqrt(1^2 + 1^2 + 1^2) = 1.732 + float endoff = -BS * MAP_BLOCKSIZE * 1.732050807569; + v3s16 spn = cam_pos_nodes; + s16 bs2 = MAP_BLOCKSIZE / 2 + 1; + // to reduce the likelihood of falsely occluded blocks + // require at least two solid blocks + // this is a HACK, we should think of a more precise algorithm + u32 needed_count = 2; + + return ( + // For the central point of the mapblock 'endoff' can be halved + isOccluded(spn, cpn, + step, stepfac, startoff, endoff / 2.0f, needed_count) && + isOccluded(spn, cpn + v3s16(bs2,bs2,bs2), + step, stepfac, startoff, endoff, needed_count) && + isOccluded(spn, cpn + v3s16(bs2,bs2,-bs2), + step, stepfac, startoff, endoff, needed_count) && + isOccluded(spn, cpn + v3s16(bs2,-bs2,bs2), + step, stepfac, startoff, endoff, needed_count) && + isOccluded(spn, cpn + v3s16(bs2,-bs2,-bs2), + step, stepfac, startoff, endoff, needed_count) && + isOccluded(spn, cpn + v3s16(-bs2,bs2,bs2), + step, stepfac, startoff, endoff, needed_count) && + isOccluded(spn, cpn + v3s16(-bs2,bs2,-bs2), + step, stepfac, startoff, endoff, needed_count) && + isOccluded(spn, cpn + v3s16(-bs2,-bs2,bs2), + step, stepfac, startoff, endoff, needed_count) && + isOccluded(spn, cpn + v3s16(-bs2,-bs2,-bs2), + step, stepfac, startoff, endoff, needed_count)); +} + /* ServerMap */ diff --git a/src/map.h b/src/map.h index c4181a49f..aeb05c704 100644 --- a/src/map.h +++ b/src/map.h @@ -314,6 +314,7 @@ public: void transforming_liquid_add(v3s16 p); s32 transforming_liquid_size(); + bool isBlockOccluded(MapBlock *block, v3s16 cam_pos_nodes); protected: friend class LuaVoxelManip; @@ -335,6 +336,9 @@ protected: // This stores the properties of the nodes on the map. INodeDefManager *m_nodedef; + bool isOccluded(v3s16 p0, v3s16 p1, float step, float stepfac, + float start_off, float end_off, u32 needed_count); + private: f32 m_transforming_liquid_loop_count_multiplier; u32 m_unprocessed_count; -- cgit v1.2.3 From ff8069694748707d4435ebd109c99ff20212826f Mon Sep 17 00:00:00 2001 From: Lars Hofhansl Date: Fri, 3 Mar 2017 12:40:50 -0800 Subject: Enable server side occlusion culling by default. --- builtin/settingtypes.txt | 2 +- minetest.conf.example | 2 +- src/defaultsettings.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index ffd872c20..cba03e983 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -868,7 +868,7 @@ block_send_optimize_distance (block send optimize distance) int 4 2 # on the eye position of the player. This can reduce the number of blocks # sent to the client 50-80%. The client will not longer receive most invisible # so that the utility of noclip mode is reduced. -server_side_occlusion_culling (Server side occlusion culling) bool false +server_side_occlusion_culling (Server side occlusion culling) bool true [*Mapgen] diff --git a/minetest.conf.example b/minetest.conf.example index 08d00d62a..8caeeb7d2 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -1060,7 +1060,7 @@ # on the eye position of the player. This can reduce the number of blocks # sent to the client 50-80%. The client will not longer receive most invisible # so that the utility of noclip mode is reduced. -server_side_occlusion_culling = false +server_side_occlusion_culling = true ## Mapgen diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 483c9cff6..d67a60b07 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -282,7 +282,7 @@ void set_default_settings(Settings *settings) // This causes frametime jitter on client side, or does it? settings->setDefault("max_block_send_distance", "9"); settings->setDefault("block_send_optimize_distance", "4"); - settings->setDefault("server_side_occlusion_culling", "false"); + settings->setDefault("server_side_occlusion_culling", "true"); settings->setDefault("max_clearobjects_extra_loaded_blocks", "4096"); settings->setDefault("time_speed", "72"); settings->setDefault("server_unload_unused_data_timeout", "29"); -- cgit v1.2.3 From 44ca9c9cb2079fa97068adb8ee894c5ae13a9975 Mon Sep 17 00:00:00 2001 From: nerzhul Date: Mon, 13 Mar 2017 15:55:30 +0100 Subject: [CSM] Add enable_client_modding param (default: false) --- builtin/settingtypes.txt | 3 +++ minetest.conf.example | 5 +++++ src/client.cpp | 10 +++++++++- src/client.h | 2 ++ src/clientenvironment.cpp | 4 +++- src/defaultsettings.cpp | 1 + src/game.cpp | 21 +++++++++++++-------- src/network/clientpackethandler.cpp | 6 ++++-- src/script/cpp_api/s_client.cpp | 3 +-- 9 files changed, 41 insertions(+), 14 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index cba03e983..ff17973fa 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -264,6 +264,9 @@ show_entity_selectionbox (Show entity selection boxes) bool true # when connecting to the server. enable_remote_media_server (Connect to external media server) bool true +# Enable Lua modding support on client. +enable_client_modding (Client modding) bool false + # URL to the server list displayed in the Multiplayer Tab. serverlist_url (Serverlist URL) string servers.minetest.net diff --git a/minetest.conf.example b/minetest.conf.example index 8caeeb7d2..283dc13f1 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -282,6 +282,11 @@ # type: bool # enable_remote_media_server = true +# Enable Lua modding support on client. +# This support is experimental and API can change. +# type: bool +enable_client_modding (Client modding) bool false + # URL to the server list displayed in the Multiplayer Tab. # type: string # serverlist_url = servers.minetest.net diff --git a/src/client.cpp b/src/client.cpp index 049616c63..4ddabd814 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -248,7 +248,8 @@ Client::Client( m_recommended_send_interval(0.1), m_removed_sounds_check_timer(0), m_state(LC_Created), - m_localdb(NULL) + m_localdb(NULL), + m_script(NULL) { // Add local player m_env.setLocalPlayer(new LocalPlayer(this, playername)); @@ -262,6 +263,7 @@ Client::Client( g_settings->getBool("enable_bumpmapping") || g_settings->getBool("enable_parallax_occlusion")); + m_modding_enabled = g_settings->getBool("enable_client_modding"); m_script = new ClientScripting(this); m_env.setScript(m_script); } @@ -270,6 +272,11 @@ void Client::initMods() { m_script->loadMod(getBuiltinLuaPath() + DIR_DELIM "init.lua", BUILTIN_MOD_NAME); + // If modding is not enabled, don't load mods, just builtin + if (!m_modding_enabled) { + return; + } + ClientModConfiguration modconf(getClientModsLuaPath()); std::vector mods = modconf.getMods(); std::vector unsatisfied_mods = modconf.getUnsatisfiedMods(); @@ -327,6 +334,7 @@ const ModSpec* Client::getModSpec(const std::string &modname) const void Client::Stop() { + // Don't disable this part when modding is disabled, it's used in builtin m_script->on_shutdown(); //request all client managed threads to stop m_mesh_update_thread.stop(); diff --git a/src/client.h b/src/client.h index dc4469350..7f9cc559b 100644 --- a/src/client.h +++ b/src/client.h @@ -572,6 +572,7 @@ public: } ClientScripting *getScript() { return m_script; } + const bool moddingEnabled() const { return m_modding_enabled; } inline void pushToEventQueue(const ClientEvent &event) { @@ -722,6 +723,7 @@ private: bool m_cache_use_tangent_vertices; ClientScripting *m_script; + bool m_modding_enabled; DISABLE_CLASS_COPY(Client); }; diff --git a/src/clientenvironment.cpp b/src/clientenvironment.cpp index 1175d00c0..7a74c897c 100644 --- a/src/clientenvironment.cpp +++ b/src/clientenvironment.cpp @@ -245,7 +245,9 @@ void ClientEnvironment::step(float dtime) } } - m_script->environment_step(dtime); + if (m_client->moddingEnabled()) { + m_script->environment_step(dtime); + } /* A quick draft of lava damage diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index d67a60b07..fbf15b2ea 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -54,6 +54,7 @@ void set_default_settings(Settings *settings) settings->setDefault("curl_file_download_timeout", "300000"); settings->setDefault("curl_verify_cert", "true"); settings->setDefault("enable_remote_media_server", "true"); + settings->setDefault("enable_client_modding", "false"); // Keymap settings->setDefault("remote_port", "30000"); diff --git a/src/game.cpp b/src/game.cpp index 612bd2536..10ec5d594 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -179,6 +179,8 @@ struct LocalFormspecHandler : public TextDest { return; } } + + // Don't disable this part when modding is disabled, it's used in builtin m_client->getScript()->on_formspec_input(m_formname, fields); } @@ -3185,9 +3187,10 @@ void Game::processClientEvents(CameraOrientation *cam, float *damage_flash) for ( ; event.type != CE_NONE; event = client->getClientEvent()) { - if (event.type == CE_PLAYER_DAMAGE && - client->getHP() != 0) { - client->getScript()->on_damage_taken(event.player_damage.amount); + if (event.type == CE_PLAYER_DAMAGE && client->getHP() != 0) { + if (client->moddingEnabled()) { + client->getScript()->on_damage_taken(event.player_damage.amount); + } *damage_flash += 95.0 + 3.2 * event.player_damage.amount; *damage_flash = MYMIN(*damage_flash, 127.0); @@ -3202,6 +3205,7 @@ void Game::processClientEvents(CameraOrientation *cam, float *damage_flash) cam->camera_yaw = event.player_force_move.yaw; cam->camera_pitch = event.player_force_move.pitch; } else if (event.type == CE_DEATHSCREEN) { + // This should be enabled for death formspec in builtin client->getScript()->on_death(); /* Handle visualization */ @@ -3902,7 +3906,7 @@ void Game::handleDigging(GameRunData *runData, if (!runData->digging) { infostream << "Started digging" << std::endl; - if (client->getScript()->on_punchnode(nodepos, n)) + if (client->moddingEnabled() && client->getScript()->on_punchnode(nodepos, n)) return; client->interact(0, pointed); runData->digging = true; @@ -3971,7 +3975,7 @@ void Game::handleDigging(GameRunData *runData, } else { infostream << "Digging completed" << std::endl; client->setCrack(-1, v3s16(0, 0, 0)); - + runData->dig_time = 0; runData->digging = false; @@ -3993,9 +3997,10 @@ void Game::handleDigging(GameRunData *runData, bool is_valid_position; MapNode wasnode = map.getNodeNoEx(nodepos, &is_valid_position); if (is_valid_position) { - bool block = client->getScript()->on_dignode(nodepos, wasnode); - if (block) { - return; + if (client->moddingEnabled()) { + if (client->getScript()->on_dignode(nodepos, wasnode)) { + return; + } } client->removeNode(nodepos); } diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index 97fa93e95..9bcc58110 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -413,7 +413,7 @@ void Client::handleCommand_ChatMessage(NetworkPacket* pkt) } // If chat message not consummed by client lua API - if (!m_script->on_receiving_message(wide_to_utf8(message))) { + if (!moddingEnabled() || !m_script->on_receiving_message(wide_to_utf8(message))) { pushToChatQueue(message); } } @@ -526,7 +526,9 @@ void Client::handleCommand_HP(NetworkPacket* pkt) player->hp = hp; - m_script->on_hp_modification(hp); + if (moddingEnabled()) { + m_script->on_hp_modification(hp); + } if (hp < oldhp) { // Add to ClientEvent queue diff --git a/src/script/cpp_api/s_client.cpp b/src/script/cpp_api/s_client.cpp index 8c5e3796b..154dd6194 100644 --- a/src/script/cpp_api/s_client.cpp +++ b/src/script/cpp_api/s_client.cpp @@ -155,8 +155,7 @@ bool ScriptApiClient::on_dignode(v3s16 p, MapNode node) // Call functions runCallbacks(2, RUN_CALLBACKS_MODE_OR); - bool blocked = lua_toboolean(L, -1); - return blocked; + return lua_toboolean(L, -1); } bool ScriptApiClient::on_punchnode(v3s16 p, MapNode node) -- cgit v1.2.3 From 4d5177ff708c7e696eead18200e240047ff520fe Mon Sep 17 00:00:00 2001 From: number Zero Date: Sat, 18 Feb 2017 21:53:05 +0300 Subject: Add mesh generation delay --- builtin/settingtypes.txt | 4 ++++ minetest.conf.example | 5 +++++ src/client.cpp | 9 ++++++++- src/client.h | 3 ++- src/defaultsettings.cpp | 1 + src/settings_translation_file.cpp | 2 ++ 6 files changed, 22 insertions(+), 2 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index ff17973fa..d2bdf030a 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -511,6 +511,10 @@ hud_hotbar_max_width (Maximum hotbar width) float 1.0 # Enables caching of facedir rotated meshes. enable_mesh_cache (Mesh cache) bool false +# Delay between mesh updates on the client in ms. Increasing this will slow +# down the rate of mesh updates, thus reducing jitter on slower clients. +mesh_generation_interval (Mapblock mesh generation delay) int 0 0 50 + # Enables minimap. enable_minimap (Minimap) bool true diff --git a/minetest.conf.example b/minetest.conf.example index 283dc13f1..fd76d98e0 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -594,6 +594,11 @@ enable_client_modding (Client modding) bool false # type: bool # enable_mesh_cache = false +# Delay between mesh updates on the client in ms. Increasing this will slow +# down the rate of mesh updates, thus reducing jitter on slower clients. +# type: int min: 0 max: 50 +# mesh_generation_interval = 0 + # Enables minimap. # type: bool # enable_minimap = true diff --git a/src/client.cpp b/src/client.cpp index 0c4819bc5..8bbaa83bd 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -157,6 +157,12 @@ QueuedMeshUpdate *MeshUpdateQueue::pop() MeshUpdateThread */ +MeshUpdateThread::MeshUpdateThread() : UpdateThread("Mesh") +{ + m_generation_interval = g_settings->getU16("mesh_generation_interval"); + m_generation_interval = rangelim(m_generation_interval, 0, 50); +} + void MeshUpdateThread::enqueueUpdate(v3s16 p, MeshMakeData *data, bool ack_block_to_server, bool urgent) { @@ -168,7 +174,8 @@ void MeshUpdateThread::doUpdate() { QueuedMeshUpdate *q; while ((q = m_queue_in.pop())) { - + if (m_generation_interval) + sleep_ms(m_generation_interval); ScopeProfiler sp(g_profiler, "Client: Mesh making"); MapBlockMesh *mesh_new = new MapBlockMesh(q->data, m_camera_offset); diff --git a/src/client.h b/src/client.h index b1310424d..4a4d296f2 100644 --- a/src/client.h +++ b/src/client.h @@ -120,13 +120,14 @@ class MeshUpdateThread : public UpdateThread { private: MeshUpdateQueue m_queue_in; + int m_generation_interval; protected: virtual void doUpdate(); public: - MeshUpdateThread() : UpdateThread("Mesh") {} + MeshUpdateThread(); void enqueueUpdate(v3s16 p, MeshMakeData *data, bool ack_block_to_server, bool urgent); diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index fbf15b2ea..396b69b3a 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -38,6 +38,7 @@ void set_default_settings(Settings *settings) settings->setDefault("enable_sound", "true"); settings->setDefault("sound_volume", "0.8"); settings->setDefault("enable_mesh_cache", "false"); + settings->setDefault("mesh_generation_interval", "0"); settings->setDefault("enable_vbo", "true"); settings->setDefault("free_move", "false"); settings->setDefault("fast_move", "false"); diff --git a/src/settings_translation_file.cpp b/src/settings_translation_file.cpp index 39223d9ce..9ec21c415 100644 --- a/src/settings_translation_file.cpp +++ b/src/settings_translation_file.cpp @@ -245,6 +245,8 @@ fake_function() { gettext("Maximum proportion of current window to be used for hotbar.\nUseful if there's something to be displayed right or left of hotbar."); gettext("Mesh cache"); gettext("Enables caching of facedir rotated meshes."); + gettext("Mapblock mesh generation delay"); + gettext("Delay between mesh updates on the client in ms. Increasing this will slow\ndown the rate of mesh updates, thus reducing jitter on slower clients."); gettext("Minimap"); gettext("Enables minimap."); gettext("Round minimap"); -- cgit v1.2.3 From e70e15134c95d37241bb6f6124105c0f1c08ab8a Mon Sep 17 00:00:00 2001 From: red-001 Date: Fri, 24 Mar 2017 23:43:36 +0000 Subject: Change command prefix to "." and add "help" command. --- builtin/client/chatcommands.lua | 22 +++++++++---- builtin/common/chatcommands.lua | 73 ++++++++++++++++++++++++++++++++++++++++- builtin/game/chatcommands.lua | 55 ------------------------------- builtin/settingtypes.txt | 4 +++ minetest.conf.example | 5 +++ src/client/keys.h | 1 + src/defaultsettings.cpp | 1 + src/game.cpp | 3 ++ src/guiKeyChangeMenu.cpp | 2 ++ 9 files changed, 103 insertions(+), 63 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/builtin/client/chatcommands.lua b/builtin/client/chatcommands.lua index 43b4d9a72..7a1b4b6b7 100644 --- a/builtin/client/chatcommands.lua +++ b/builtin/client/chatcommands.lua @@ -2,27 +2,35 @@ core.register_on_sending_chat_messages(function(message) - if not (message:sub(1,1) == "/") then - return false + local first_char = message:sub(1,1) + if first_char == "/" or first_char == "." then + core.display_chat_message("issued command: " .. message) end - core.display_chat_message("issued command: " .. message) + if first_char ~= "." then + return false + end - local cmd, param = string.match(message, "^/([^ ]+) *(.*)") + local cmd, param = string.match(message, "^%.([^ ]+) *(.*)") if not param then param = "" end - local cmd_def = core.registered_chatcommands[cmd] + if not cmd then + core.display_chat_message("-!- Empty command") + return true + end + local cmd_def = core.registered_chatcommands[cmd] if cmd_def then core.set_last_run_mod(cmd_def.mod_origin) local _, message = cmd_def.func(param) if message then core.display_chat_message(message) end - return true + else + core.display_chat_message("-!- Invalid command: " .. cmd) end - return false + return true end) diff --git a/builtin/common/chatcommands.lua b/builtin/common/chatcommands.lua index ef3a24410..05dd94e8d 100644 --- a/builtin/common/chatcommands.lua +++ b/builtin/common/chatcommands.lua @@ -27,4 +27,75 @@ function core.override_chatcommand(name, redefinition) rawset(chatcommand, k, v) end core.registered_chatcommands[name] = chatcommand -end \ No newline at end of file +end + +local cmd_marker = "/" + +if INIT == "client" then + cmd_marker = "." +end + +local function do_help_cmd(name, param) + local function format_help_line(cmd, def) + local msg = core.colorize("#00ffff", cmd_marker .. cmd) + if def.params and def.params ~= "" then + msg = msg .. " " .. def.params + end + if def.description and def.description ~= "" then + msg = msg .. ": " .. def.description + end + return msg + end + if param == "" then + local cmds = {} + for cmd, def in pairs(core.registered_chatcommands) do + if INIT == "client" or core.check_player_privs(name, def.privs) then + cmds[#cmds + 1] = cmd + end + end + table.sort(cmds) + return true, "Available commands: " .. table.concat(cmds, " ") .. "\n" + .. "Use '"..cmd_marker.."help ' to get more information," + .. " or '"..cmd_marker.."help all' to list everything." + elseif param == "all" then + local cmds = {} + for cmd, def in pairs(core.registered_chatcommands) do + if INIT == "client" or core.check_player_privs(name, def.privs) then + cmds[#cmds + 1] = format_help_line(cmd, def) + end + end + table.sort(cmds) + return true, "Available commands:\n"..table.concat(cmds, "\n") + elseif INIT == "game" and param == "privs" then + local privs = {} + for priv, def in pairs(core.registered_privileges) do + privs[#privs + 1] = priv .. ": " .. def.description + end + table.sort(privs) + return true, "Available privileges:\n"..table.concat(privs, "\n") + else + local cmd = param + local def = core.registered_chatcommands[cmd] + if not def then + return false, "Command not available: "..cmd + else + return true, format_help_line(cmd, def) + end + end +end + +if INIT == "client" then + core.register_chatcommand("help", { + params = "[all/]", + description = "Get help for commands", + func = function(param) + return do_help_cmd(nil, param) + end, + }) +else + core.register_chatcommand("help", { + params = "[all/privs/]", + description = "Get help for commands or list privileges", + func = do_help_cmd, + }) +end diff --git a/builtin/game/chatcommands.lua b/builtin/game/chatcommands.lua index 745b012e6..b4fa4f828 100644 --- a/builtin/game/chatcommands.lua +++ b/builtin/game/chatcommands.lua @@ -82,61 +82,6 @@ core.register_chatcommand("admin", { end, }) -core.register_chatcommand("help", { - privs = {}, - params = "[all/privs/]", - description = "Get help for commands or list privileges", - func = function(name, param) - local function format_help_line(cmd, def) - local msg = core.colorize("#00ffff", "/"..cmd) - if def.params and def.params ~= "" then - msg = msg .. " " .. def.params - end - if def.description and def.description ~= "" then - msg = msg .. ": " .. def.description - end - return msg - end - if param == "" then - local msg = "" - local cmds = {} - for cmd, def in pairs(core.registered_chatcommands) do - if core.check_player_privs(name, def.privs) then - cmds[#cmds + 1] = cmd - end - end - table.sort(cmds) - return true, "Available commands: " .. table.concat(cmds, " ") .. "\n" - .. "Use '/help ' to get more information," - .. " or '/help all' to list everything." - elseif param == "all" then - local cmds = {} - for cmd, def in pairs(core.registered_chatcommands) do - if core.check_player_privs(name, def.privs) then - cmds[#cmds + 1] = format_help_line(cmd, def) - end - end - table.sort(cmds) - return true, "Available commands:\n"..table.concat(cmds, "\n") - elseif param == "privs" then - local privs = {} - for priv, def in pairs(core.registered_privileges) do - privs[#privs + 1] = priv .. ": " .. def.description - end - table.sort(privs) - return true, "Available privileges:\n"..table.concat(privs, "\n") - else - local cmd = param - local def = core.registered_chatcommands[cmd] - if not def then - return false, "Command not available: "..cmd - else - return true, format_help_line(cmd, def) - end - end - end, -}) - core.register_chatcommand("privs", { params = "", description = "Print privileges of player", diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index d2bdf030a..e63697f61 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -156,6 +156,10 @@ keymap_chat (Chat key) key KEY_KEY_T # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_cmd (Command key) key / +# Key for opening the chat window to type local commands. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_cmd_local (Command key) key . + # Key for opening the chat console. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keyman_console (Console key) key KEY_F10 diff --git a/minetest.conf.example b/minetest.conf.example index fd76d98e0..78488432f 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -148,6 +148,11 @@ # type: key # keymap_cmd = / +# Key for opening the chat window to type local commands. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +# type: key +# keymap_cmd_local = . + # Key for opening the chat console. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key diff --git a/src/client/keys.h b/src/client/keys.h index 6467c443e..25f3e44d2 100644 --- a/src/client/keys.h +++ b/src/client/keys.h @@ -42,6 +42,7 @@ public: INVENTORY, CHAT, CMD, + CMD_LOCAL, CONSOLE, MINIMAP, FREEMOVE, diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 396b69b3a..5b66c583a 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -72,6 +72,7 @@ void set_default_settings(Settings *settings) settings->setDefault("keymap_special1", "KEY_KEY_E"); settings->setDefault("keymap_chat", "KEY_KEY_T"); settings->setDefault("keymap_cmd", "/"); + settings->setDefault("keymap_cmd_local", "."); settings->setDefault("keymap_minimap", "KEY_F9"); settings->setDefault("keymap_console", "KEY_F10"); settings->setDefault("keymap_rangeselect", "KEY_KEY_R"); diff --git a/src/game.cpp b/src/game.cpp index 9d52e4326..62d2405f2 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1034,6 +1034,7 @@ void KeyCache::populate() key[KeyType::INVENTORY] = getKeySetting("keymap_inventory"); key[KeyType::CHAT] = getKeySetting("keymap_chat"); key[KeyType::CMD] = getKeySetting("keymap_cmd"); + key[KeyType::CMD_LOCAL] = getKeySetting("keymap_cmd_local"); key[KeyType::CONSOLE] = getKeySetting("keymap_console"); key[KeyType::MINIMAP] = getKeySetting("keymap_minimap"); key[KeyType::FREEMOVE] = getKeySetting("keymap_freemove"); @@ -2449,6 +2450,8 @@ void Game::processKeyInput() openConsole(0.2, L""); } else if (wasKeyDown(KeyType::CMD)) { openConsole(0.2, L"/"); + } else if (wasKeyDown(KeyType::CMD_LOCAL)) { + openConsole(0.2, L"."); } else if (wasKeyDown(KeyType::CONSOLE)) { openConsole(core::clamp(g_settings->getFloat("console_height"), 0.1f, 1.0f)); } else if (wasKeyDown(KeyType::FREEMOVE)) { diff --git a/src/guiKeyChangeMenu.cpp b/src/guiKeyChangeMenu.cpp index 07137d1bc..e85ee8271 100644 --- a/src/guiKeyChangeMenu.cpp +++ b/src/guiKeyChangeMenu.cpp @@ -53,6 +53,7 @@ enum GUI_ID_KEY_CINEMATIC_BUTTON, GUI_ID_KEY_CHAT_BUTTON, GUI_ID_KEY_CMD_BUTTON, + GUI_ID_KEY_CMD_LOCAL_BUTTON, GUI_ID_KEY_CONSOLE_BUTTON, GUI_ID_KEY_SNEAK_BUTTON, GUI_ID_KEY_DROP_BUTTON, @@ -408,6 +409,7 @@ void GUIKeyChangeMenu::init_keys() this->add_key(GUI_ID_KEY_INVENTORY_BUTTON, wgettext("Inventory"), "keymap_inventory"); this->add_key(GUI_ID_KEY_CHAT_BUTTON, wgettext("Chat"), "keymap_chat"); this->add_key(GUI_ID_KEY_CMD_BUTTON, wgettext("Command"), "keymap_cmd"); + this->add_key(GUI_ID_KEY_CMD_LOCAL_BUTTON, wgettext("Local command"), "keymap_cmd_local"); this->add_key(GUI_ID_KEY_CONSOLE_BUTTON, wgettext("Console"), "keymap_console"); this->add_key(GUI_ID_KEY_FLY_BUTTON, wgettext("Toggle fly"), "keymap_freemove"); this->add_key(GUI_ID_KEY_FAST_BUTTON, wgettext("Toggle fast"), "keymap_fastmove"); -- cgit v1.2.3 From ec0c4d33db9e0b7b3e541757e34c04c08c3b48c9 Mon Sep 17 00:00:00 2001 From: paramat Date: Thu, 23 Mar 2017 00:18:59 +0000 Subject: Map generation limit: Make per-world The setting limits map generation but affects nothing else. Add 'mapgen_limit' to global mapgen parameters. Move 'blockpos_over_mapgen_limit()' to the only place it is called from: map.cpp. Allow teleportation to any part of the world even if over the set mapgen limit. Simplify the reading of this limit in mgvalleys. Remove the 'map_generation_limit' setting. --- builtin/game/chatcommands.lua | 2 +- builtin/settingtypes.txt | 11 ++++------- minetest.conf.example | 11 ++++------- src/defaultsettings.cpp | 2 +- src/map.cpp | 13 +++++++++++++ src/map.h | 1 + src/mapblock.h | 14 +------------- src/mapgen.cpp | 24 ++++++++++++++---------- src/mapgen.h | 3 +++ src/mapgen_valleys.cpp | 9 +++------ src/mapgen_valleys.h | 2 -- 11 files changed, 45 insertions(+), 47 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/builtin/game/chatcommands.lua b/builtin/game/chatcommands.lua index b4fa4f828..16f5f3be9 100644 --- a/builtin/game/chatcommands.lua +++ b/builtin/game/chatcommands.lua @@ -303,7 +303,7 @@ core.register_chatcommand("teleport", { p.y = tonumber(p.y) p.z = tonumber(p.z) if p.x and p.y and p.z then - local lm = tonumber(minetest.setting_get("map_generation_limit") or 31000) + local lm = 31000 if p.x < -lm or p.x > lm or p.y < -lm or p.y > lm or p.z < -lm or p.z > lm then return false, "Cannot teleport out of map bounds!" end diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index e63697f61..c9e0f7b87 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -893,13 +893,10 @@ water_level (Water level) int 1 # From how far blocks are generated for clients, stated in mapblocks (16 nodes). max_block_generate_distance (Max block generate distance) int 6 -# Where the map generator stops. -# Please note: -# - Limited to 31000 (setting above has no effect) -# - The map generator works in groups of 80x80x80 nodes (5x5x5 MapBlocks). -# - Those groups have an offset of -32, -32 nodes from the origin. -# - Only groups which are within the map_generation_limit are generated -map_generation_limit (Map generation limit) int 31000 0 31000 +# Limit of map generation, in nodes, in all 6 directions from (0, 0, 0). +# Only mapchunks completely within the mapgen limit are generated. +# Value is stored per-world. +mapgen_limit (Map generation limit) int 31000 0 31000 # Global map generation attributes. # In Mapgen v6 the 'decorations' flag controls all decorations except trees diff --git a/minetest.conf.example b/minetest.conf.example index 78488432f..a45a9948a 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -1092,14 +1092,11 @@ server_side_occlusion_culling = true # type: int # max_block_generate_distance = 6 -# Where the map generator stops. -# Please note: -# - Limited to 31000 (setting above has no effect) -# - The map generator works in groups of 80x80x80 nodes (5x5x5 MapBlocks). -# - Those groups have an offset of -32, -32 nodes from the origin. -# - Only groups which are within the map_generation_limit are generated +# Limit of map generation, in nodes, in all 6 directions from (0, 0, 0). +# Only mapchunks completely within the mapgen limit are generated. +# Value is stored per-world. # type: int min: 0 max: 31000 -# map_generation_limit = 31000 +# mapgen_limit = 31000 # Global map generation attributes. # In Mapgen v6 the 'decorations' flag controls all decorations except trees diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 5b66c583a..4b50b991b 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -333,10 +333,10 @@ void set_default_settings(Settings *settings) // Mapgen settings->setDefault("mg_name", "v7"); settings->setDefault("water_level", "1"); + settings->setDefault("mapgen_limit", "31000"); settings->setDefault("chunksize", "5"); settings->setDefault("mg_flags", "dungeons"); settings->setDefault("fixed_map_seed", ""); - settings->setDefault("map_generation_limit", "31000"); settings->setDefault("max_block_generate_distance", "7"); settings->setDefault("enable_mapgen_debug_info", "false"); diff --git a/src/map.cpp b/src/map.cpp index 504760d09..b690ea3b3 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1367,6 +1367,19 @@ s16 ServerMap::getWaterLevel() return getMapgenParams()->water_level; } +bool ServerMap::blockpos_over_mapgen_limit(v3s16 p) +{ + const s16 mapgen_limit_bp = rangelim( + getMapgenParams()->mapgen_limit, 0, MAX_MAP_GENERATION_LIMIT) / + MAP_BLOCKSIZE; + return p.X < -mapgen_limit_bp || + p.X > mapgen_limit_bp || + p.Y < -mapgen_limit_bp || + p.Y > mapgen_limit_bp || + p.Z < -mapgen_limit_bp || + p.Z > mapgen_limit_bp; +} + bool ServerMap::initBlockMake(v3s16 blockpos, BlockMakeData *data) { s16 csize = getMapgenParams()->chunksize; diff --git a/src/map.h b/src/map.h index aeb05c704..ea8dc76d1 100644 --- a/src/map.h +++ b/src/map.h @@ -379,6 +379,7 @@ public: /* Blocks are generated by using these and makeBlock(). */ + bool blockpos_over_mapgen_limit(v3s16 p); bool initBlockMake(v3s16 blockpos, BlockMakeData *data); void finishBlockMake(BlockMakeData *data, std::map *changed_blocks); diff --git a/src/mapblock.h b/src/mapblock.h index be2edc791..c48f337e0 100644 --- a/src/mapblock.h +++ b/src/mapblock.h @@ -32,6 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "modifiedstate.h" #include "util/numeric.h" // getContainerPos #include "settings.h" +#include "mapgen.h" class Map; class NodeMetadataList; @@ -689,19 +690,6 @@ inline bool blockpos_over_max_limit(v3s16 p) p.Z > max_limit_bp; } -inline bool blockpos_over_mapgen_limit(v3s16 p) -{ - const s16 mapgen_limit_bp = rangelim( - g_settings->getS16("map_generation_limit"), 0, MAX_MAP_GENERATION_LIMIT) / - MAP_BLOCKSIZE; - return p.X < -mapgen_limit_bp || - p.X > mapgen_limit_bp || - p.Y < -mapgen_limit_bp || - p.Y > mapgen_limit_bp || - p.Z < -mapgen_limit_bp || - p.Z > mapgen_limit_bp; -} - /* Returns the position of the block where the node is located */ diff --git a/src/mapgen.cpp b/src/mapgen.cpp index a0b9990b7..6f3ea7cb0 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -97,11 +97,12 @@ STATIC_ASSERT( Mapgen::Mapgen() { - generating = false; - id = -1; - seed = 0; - water_level = 0; - flags = 0; + generating = false; + id = -1; + seed = 0; + water_level = 0; + mapgen_limit = 0; + flags = 0; vm = NULL; ndef = NULL; @@ -114,11 +115,12 @@ Mapgen::Mapgen() Mapgen::Mapgen(int mapgenid, MapgenParams *params, EmergeManager *emerge) : gennotify(emerge->gen_notify_on, &emerge->gen_notify_on_deco_ids) { - generating = false; - id = mapgenid; - water_level = params->water_level; - flags = params->flags; - csize = v3s16(1, 1, 1) * (params->chunksize * MAP_BLOCKSIZE); + generating = false; + id = mapgenid; + water_level = params->water_level; + mapgen_limit = params->mapgen_limit; + flags = params->flags; + csize = v3s16(1, 1, 1) * (params->chunksize * MAP_BLOCKSIZE); /* We are losing half our entropy by doing this, but it is necessary to @@ -1005,6 +1007,7 @@ void MapgenParams::readParams(const Settings *settings) this->mgtype = Mapgen::getMapgenType(mg_name); settings->getS16NoEx("water_level", water_level); + settings->getS16NoEx("mapgen_limit", mapgen_limit); settings->getS16NoEx("chunksize", chunksize); settings->getFlagStrNoEx("mg_flags", flags, flagdesc_mapgen); @@ -1022,6 +1025,7 @@ void MapgenParams::writeParams(Settings *settings) const settings->set("mg_name", Mapgen::getMapgenName(mgtype)); settings->setU64("seed", seed); settings->setS16("water_level", water_level); + settings->setS16("mapgen_limit", mapgen_limit); settings->setS16("chunksize", chunksize); settings->setFlagStr("mg_flags", flags, flagdesc_mapgen, U32_MAX); diff --git a/src/mapgen.h b/src/mapgen.h index 7aac1e6a0..c4e1652e8 100644 --- a/src/mapgen.h +++ b/src/mapgen.h @@ -124,6 +124,7 @@ struct MapgenParams { s16 chunksize; u64 seed; s16 water_level; + s16 mapgen_limit; u32 flags; BiomeParams *bparams; @@ -133,6 +134,7 @@ struct MapgenParams { chunksize(5), seed(0), water_level(1), + mapgen_limit(MAX_MAP_GENERATION_LIMIT), flags(MG_CAVES | MG_LIGHT | MG_DECORATIONS), bparams(NULL) { @@ -158,6 +160,7 @@ class Mapgen { public: s32 seed; int water_level; + int mapgen_limit; u32 flags; bool generating; int id; diff --git a/src/mapgen_valleys.cpp b/src/mapgen_valleys.cpp index ccf797eff..76a7a0582 100644 --- a/src/mapgen_valleys.cpp +++ b/src/mapgen_valleys.cpp @@ -70,9 +70,6 @@ MapgenValleys::MapgenValleys(int mapgenid, MapgenValleysParams *params, EmergeMa // NOTE: MapgenValleys has a hard dependency on BiomeGenOriginal this->m_bgen = (BiomeGenOriginal *)biomegen; - this->map_gen_limit = MYMIN(MAX_MAP_GENERATION_LIMIT, - g_settings->getU16("map_generation_limit")); - BiomeParamsOriginal *bp = (BiomeParamsOriginal *)params->bparams; this->spflags = params->spflags; @@ -621,7 +618,7 @@ void MapgenValleys::generateCaves(s16 max_stone_y, s16 large_cave_depth) const float massive_cave_threshold = 0.6f; // mct: 1 = small rare caves, 0.5 1/3rd ground volume, 0 = 1/2 ground volume. - float yblmin = -map_gen_limit + massive_cave_blend * 1.5f; + float yblmin = -mapgen_limit + massive_cave_blend * 1.5f; float yblmax = massive_cave_depth - massive_cave_blend * 1.5f; bool made_a_big_one = false; @@ -646,11 +643,11 @@ void MapgenValleys::generateCaves(s16 max_stone_y, s16 large_cave_depth) // lava_depth varies between one and ten as you approach // the bottom of the world. - s16 lava_depth = ceil((lava_max_height - node_min.Y + 1) * 10.f / map_gen_limit); + s16 lava_depth = ceil((lava_max_height - node_min.Y + 1) * 10.f / mapgen_limit); // This allows random lava spawns to be less common at the surface. s16 lava_chance = MYCUBE(lava_features_lim) * lava_depth; // water_depth varies between ten and one on the way down. - s16 water_depth = ceil((map_gen_limit - abs(node_min.Y) + 1) * 10.f / map_gen_limit); + s16 water_depth = ceil((mapgen_limit - abs(node_min.Y) + 1) * 10.f / mapgen_limit); // This allows random water spawns to be more common at the surface. s16 water_chance = MYCUBE(water_features_lim) * water_depth; diff --git a/src/mapgen_valleys.h b/src/mapgen_valleys.h index 6dd7ebc47..4a7a11bcc 100644 --- a/src/mapgen_valleys.h +++ b/src/mapgen_valleys.h @@ -101,8 +101,6 @@ public: private: BiomeGenOriginal *m_bgen; - float map_gen_limit; - bool humid_rivers; bool use_altitude_chill; float humidity_adjust; -- cgit v1.2.3 From bce0d458d8cda70c10d78ea9ec476474f0a6f01a Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 2 Apr 2017 23:00:34 +0100 Subject: Add Joystick type detection and Xbox controller support * Add joystick type detection (with joystick_type setting to override it) * Fix multiple joysticks from interfering with each other by only reading from one (add joystick_id setting) * Add support for Xbox controllers --- builtin/settingtypes.txt | 6 +++ minetest.conf.example | 9 +++- src/client/clientlauncher.cpp | 51 ++++++++++-------- src/client/clientlauncher.h | 1 + src/client/joystick_controller.cpp | 104 ++++++++++++++++++++++++++++++++----- src/client/joystick_controller.h | 9 +++- src/defaultsettings.cpp | 2 + src/game.h | 1 - 8 files changed, 146 insertions(+), 37 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index dc3164e44..d95f8cf41 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -107,6 +107,12 @@ continuous_forward (Continuous forward) bool false # Enable Joysticks enable_joysticks (Enable Joysticks) bool false +# The identifier of the joystick to use +joystick_id (Joystick ID) int 0 + +# The type of joystick +joystick_type (Joystick Type) enum auto auto,generic,xbox + # The time in seconds it takes between repeated events # when holding down a joystick button combination. repeat_joystick_button_time (Joystick button repetition interval) float 0.17 diff --git a/minetest.conf.example b/minetest.conf.example index 292a645e3..cfc66f168 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -87,6 +87,14 @@ # type: bool # enable_joysticks = false +# The identifier of the joystick to use +# type: int +# joystick_id = 0 + +# The type of joystick +# type: enum values: auto,generic,xbox +# joystick_type = auto + # The time in seconds it takes between repeated events # when holding down a joystick button combination. # type: float @@ -1786,4 +1794,3 @@ server_side_occlusion_culling = true # Print the engine's profiling data in regular intervals (in seconds). 0 = disable. Useful for developers. # type: int # profiler_print_interval = 0 - diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp index 3ec7be7d9..249f6727a 100644 --- a/src/client/clientlauncher.cpp +++ b/src/client/clientlauncher.cpp @@ -127,10 +127,7 @@ bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args) device->setResizable(true); - if (random_input) - input = new RandomInputHandler(); - else - input = new RealInputHandler(device, receiver); + init_input(); smgr = device->getSceneManager(); smgr->getParameters()->setAttribute(scene::ALLOW_ZWRITE_ON_TRANSPARENT, true); @@ -337,6 +334,33 @@ bool ClientLauncher::init_engine() return device != NULL; } +void ClientLauncher::init_input() +{ + if (random_input) + input = new RandomInputHandler(); + else + input = new RealInputHandler(device, receiver); + + if (g_settings->getBool("enable_joysticks")) { + irr::core::array infos; + std::vector joystick_infos; + + // Make sure this is called maximum once per + // irrlicht device, otherwise it will give you + // multiple events for the same joystick. + if (device->activateJoysticks(infos)) { + infostream << "Joystick support enabled" << std::endl; + joystick_infos.reserve(infos.size()); + for (u32 i = 0; i < infos.size(); i++) { + joystick_infos.push_back(infos[i]); + } + input->joystick.onJoystickConnect(joystick_infos); + } else { + errorstream << "Could not activate joystick support." << std::endl; + } + } +} + bool ClientLauncher::launch_game(std::string &error_message, bool reconnect_requested, GameParams &game_params, const Settings &cmd_args) @@ -566,25 +590,8 @@ bool ClientLauncher::create_engine_device() device = createDeviceEx(params); - if (device) { - if (g_settings->getBool("enable_joysticks")) { - irr::core::array infos; - std::vector joystick_infos; - // Make sure this is called maximum once per - // irrlicht device, otherwise it will give you - // multiple events for the same joystick. - if (device->activateJoysticks(infos)) { - infostream << "Joystick support enabled" << std::endl; - joystick_infos.reserve(infos.size()); - for (u32 i = 0; i < infos.size(); i++) { - joystick_infos.push_back(infos[i]); - } - } else { - errorstream << "Could not activate joystick support." << std::endl; - } - } + if (device) porting::initIrrlicht(device); - } return device != NULL; } diff --git a/src/client/clientlauncher.h b/src/client/clientlauncher.h index b10bbebc9..ab22d7aaa 100644 --- a/src/client/clientlauncher.h +++ b/src/client/clientlauncher.h @@ -91,6 +91,7 @@ public: protected: void init_args(GameParams &game_params, const Settings &cmd_args); bool init_engine(); + void init_input(); bool launch_game(std::string &error_message, bool reconnect_requested, GameParams &game_params, const Settings &cmd_args); diff --git a/src/client/joystick_controller.cpp b/src/client/joystick_controller.cpp index ef8d18ab0..311cd22fb 100644 --- a/src/client/joystick_controller.cpp +++ b/src/client/joystick_controller.cpp @@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "keys.h" #include "settings.h" #include "gettime.h" +#include "../util/string.h" bool JoystickButtonCmb::isTriggered(const irr::SEvent::SJoystickEvent &ev) const { @@ -42,7 +43,7 @@ bool JoystickAxisCmb::isTriggered(const irr::SEvent::SJoystickEvent &ev) const #define JLO_B_PB(A, B, C) jlo.button_keys.push_back(JoystickButtonCmb(A, B, C)) #define JLO_A_PB(A, B, C, D) jlo.axis_keys.push_back(JoystickAxisCmb(A, B, C, D)) -static JoystickLayout create_default_layout() +JoystickLayout create_default_layout() { JoystickLayout jlo; @@ -103,11 +104,59 @@ static JoystickLayout create_default_layout() return jlo; } -static const JoystickLayout default_layout = create_default_layout(); +JoystickLayout create_xbox_layout() +{ + JoystickLayout jlo; + + jlo.axes_dead_border = 7000; + + const JoystickAxisLayout axes[JA_COUNT] = { + {0, 1}, // JA_SIDEWARD_MOVE + {1, 1}, // JA_FORWARD_MOVE + {2, 1}, // JA_FRUSTUM_HORIZONTAL + {3, 1}, // JA_FRUSTUM_VERTICAL + }; + memcpy(jlo.axes, axes, sizeof(jlo.axes)); + + // The back button means "ESC". + JLO_B_PB(KeyType::ESC, 1 << 8, 1 << 8); // back + JLO_B_PB(KeyType::ESC, 1 << 9, 1 << 9); // start + + // 4 Buttons + JLO_B_PB(KeyType::JUMP, 1 << 0, 1 << 0); // A/green + JLO_B_PB(KeyType::ESC, 1 << 1, 1 << 1); // B/red + JLO_B_PB(KeyType::SPECIAL1, 1 << 2, 1 << 2); // X/blue + JLO_B_PB(KeyType::INVENTORY, 1 << 3, 1 << 3); // Y/yellow + + // Analog Sticks + JLO_B_PB(KeyType::SPECIAL1, 1 << 11, 1 << 11); // left + JLO_B_PB(KeyType::SNEAK, 1 << 12, 1 << 12); // right + + // Triggers + JLO_B_PB(KeyType::MOUSE_L, 1 << 6, 1 << 6); // lt + JLO_B_PB(KeyType::MOUSE_R, 1 << 7, 1 << 7); // rt + JLO_B_PB(KeyType::SCROLL_UP, 1 << 4, 1 << 4); // lb + JLO_B_PB(KeyType::SCROLL_DOWN, 1 << 5, 1 << 5); // rb + + // D-PAD + JLO_B_PB(KeyType::ZOOM, 1 << 15, 1 << 15); // up + JLO_B_PB(KeyType::DROP, 1 << 13, 1 << 13); // left + JLO_B_PB(KeyType::SCREENSHOT, 1 << 14, 1 << 14); // right + JLO_B_PB(KeyType::FREEMOVE, 1 << 16, 1 << 16); // down + + // Movement buttons, important for vessels + JLO_A_PB(KeyType::FORWARD, 1, 1, 1024); + JLO_A_PB(KeyType::BACKWARD, 1, -1, 1024); + JLO_A_PB(KeyType::LEFT, 0, 1, 1024); + JLO_A_PB(KeyType::RIGHT, 0, -1, 1024); + + return jlo; +} JoystickController::JoystickController() { - m_layout = &default_layout; + m_joystick_id = 0; + doubling_dtime = g_settings->getFloat("repeat_joystick_button_time"); for (size_t i = 0; i < KeyType::INTERNAL_ENUM_COUNT; i++) { @@ -116,23 +165,54 @@ JoystickController::JoystickController() clear(); } +void JoystickController::onJoystickConnect(const std::vector &joystick_infos) +{ + s32 id = g_settings->getS32("joystick_id"); + std::string layout = g_settings->get("joystick_type"); + + if (id < 0 || id >= joystick_infos.size()) { + // TODO: auto detection + id = 0; + } + + if (id >= 0 && id < joystick_infos.size()) { + if (layout.empty() || layout == "auto") + setLayoutFromControllerName(joystick_infos[id].Name.c_str()); + else + setLayoutFromControllerName(layout); + } + + m_joystick_id = id; +} + +void JoystickController::setLayoutFromControllerName(std::string name) { + if (lowercase(name).find("xbox") >= 0) { + m_layout = create_xbox_layout(); + } else { + m_layout = create_default_layout(); + } +} + bool JoystickController::handleEvent(const irr::SEvent::SJoystickEvent &ev) { + if (ev.Joystick != m_joystick_id) + return false; + m_internal_time = getTimeMs() / 1000.f; std::bitset keys_pressed; // First generate a list of keys pressed - for (size_t i = 0; i < m_layout->button_keys.size(); i++) { - if (m_layout->button_keys[i].isTriggered(ev)) { - keys_pressed.set(m_layout->button_keys[i].key); + for (size_t i = 0; i < m_layout.button_keys.size(); i++) { + if (m_layout.button_keys[i].isTriggered(ev)) { + keys_pressed.set(m_layout.button_keys[i].key); } } - for (size_t i = 0; i < m_layout->axis_keys.size(); i++) { - if (m_layout->axis_keys[i].isTriggered(ev)) { - keys_pressed.set(m_layout->axis_keys[i].key); + for (size_t i = 0; i < m_layout.axis_keys.size(); i++) { + if (m_layout.axis_keys[i].isTriggered(ev)) { + keys_pressed.set(m_layout.axis_keys[i].key); } } @@ -153,7 +233,7 @@ bool JoystickController::handleEvent(const irr::SEvent::SJoystickEvent &ev) } for (size_t i = 0; i < JA_COUNT; i++) { - const JoystickAxisLayout &ax_la = m_layout->axes[i]; + const JoystickAxisLayout &ax_la = m_layout.axes[i]; m_axes_vals[i] = ax_la.invert * ev.Axis[ax_la.axis_id]; } @@ -172,8 +252,8 @@ void JoystickController::clear() s16 JoystickController::getAxisWithoutDead(JoystickAxis axis) { s16 v = m_axes_vals[axis]; - if (((v > 0) && (v < m_layout->axes_dead_border)) || - ((v < 0) && (v > -m_layout->axes_dead_border))) + if (((v > 0) && (v < m_layout.axes_dead_border)) || + ((v < 0) && (v > -m_layout.axes_dead_border))) return 0; return v; } diff --git a/src/client/joystick_controller.h b/src/client/joystick_controller.h index ed0ee4068..867a0c3f2 100644 --- a/src/client/joystick_controller.h +++ b/src/client/joystick_controller.h @@ -98,6 +98,9 @@ class JoystickController { public: JoystickController(); + + void onJoystickConnect(const std::vector &joystick_infos); + bool handleEvent(const irr::SEvent::SJoystickEvent &ev); void clear(); @@ -146,10 +149,14 @@ public: f32 doubling_dtime; private: - const JoystickLayout *m_layout; + void setLayoutFromControllerName(std::string name); + + JoystickLayout m_layout; s16 m_axes_vals[JA_COUNT]; + u8 m_joystick_id; + std::bitset m_pressed_keys; f32 m_internal_time; diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 4b50b991b..3f4ce6337 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -203,6 +203,8 @@ void set_default_settings(Settings *settings) settings->setDefault("always_fly_fast", "true"); settings->setDefault("continuous_forward", "false"); settings->setDefault("enable_joysticks", "false"); + settings->setDefault("joystick_id", "0"); + settings->setDefault("joystick_type", ""); settings->setDefault("repeat_joystick_button_time", "0.17"); settings->setDefault("joystick_frustum_sensitivity", "170"); diff --git a/src/game.h b/src/game.h index 19992ce3d..eaedca165 100644 --- a/src/game.h +++ b/src/game.h @@ -171,4 +171,3 @@ void the_game(bool *kill, bool simple_singleplayer_mode); #endif - -- cgit v1.2.3 From 676951d90dc7807733288c3c66952bb0394e2e7c Mon Sep 17 00:00:00 2001 From: adrido Date: Fri, 7 Apr 2017 07:14:39 +0200 Subject: Windows: Skip cmd for release builds (#5416) --- CMakeLists.txt | 1 - src/CMakeLists.txt | 10 +++++++++- src/defaultsettings.cpp | 1 + src/main.cpp | 20 +++++++++++++++----- src/porting.cpp | 14 ++++++++++++++ src/porting.h | 3 +++ 6 files changed, 42 insertions(+), 7 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/CMakeLists.txt b/CMakeLists.txt index b804cf5b6..aa7deaa11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,6 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE) endif() - # Included stuff set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e11c32df9..edb291545 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -709,7 +709,11 @@ if(MSVC) # EHa enables SEH exceptions (used for catching segfaults) set(CMAKE_CXX_FLAGS_RELEASE "/EHa /Ox /GL /FD /MT /GS- /Zi /arch:SSE /fp:fast /D NDEBUG /D _HAS_ITERATOR_DEBUGGING=0 /TP") #set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG /NODEFAULTLIB:\"libcmtd.lib\" /NODEFAULTLIB:\"libcmt.lib\"") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG /DEBUG /OPT:REF /OPT:ICF") + set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG /INCREMENTAL:NO /DEBUG /OPT:REF /OPT:ICF") + + + set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup") + set(CMAKE_CXX_FLAGS_SEMIDEBUG "/MDd /Zi /Ob0 /O1 /RTC1") @@ -759,6 +763,10 @@ else() if(USE_GPROF) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg") endif() + + if(MINGW) + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mwindows") + endif() endif() diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 3f4ce6337..52ff4c068 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -350,6 +350,7 @@ void set_default_settings(Settings *settings) settings->setDefault("server_description", ""); settings->setDefault("high_precision_fpu", "true"); + settings->setDefault("enable_console", "false"); #ifdef __ANDROID__ settings->setDefault("screenW", "0"); diff --git a/src/main.cpp b/src/main.cpp index 3599a36ce..1ec278981 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,9 +17,6 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -// This would get rid of the console window -//#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup") - #include "irrlicht.h" // createDevice #include "mainmenumanager.h" @@ -44,6 +41,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "gameparams.h" #include "database.h" #include "config.h" +#include "porting.h" #if USE_CURSES #include "terminal_chat_console.h" #endif @@ -134,7 +132,6 @@ static OptionList allowed_options; int main(int argc, char *argv[]) { int retval; - debug_set_exception_handler(); g_logger.registerThread("Main"); @@ -145,11 +142,15 @@ int main(int argc, char *argv[]) if (!cmd_args_ok || cmd_args.getFlag("help") || cmd_args.exists("nonopt1")) { + porting::attachOrCreateConsole(); print_help(allowed_options); return cmd_args_ok ? 0 : 1; } + if (cmd_args.getFlag("console")) + porting::attachOrCreateConsole(); if (cmd_args.getFlag("version")) { + porting::attachOrCreateConsole(); print_version(); return 0; } @@ -191,6 +192,9 @@ int main(int argc, char *argv[]) if (!init_common(cmd_args, argc, argv)) return 1; + if (g_settings->getBool("enable_console")) + porting::attachOrCreateConsole(); + #ifndef __ANDROID__ // Run unit tests if (cmd_args.getFlag("run-unittests")) { @@ -200,9 +204,13 @@ int main(int argc, char *argv[]) GameParams game_params; #ifdef SERVER + porting::attachOrCreateConsole(); game_params.is_dedicated_server = true; #else - game_params.is_dedicated_server = cmd_args.getFlag("server"); + const bool isServer = cmd_args.getFlag("server"); + if (isServer) + porting::attachOrCreateConsole(); + game_params.is_dedicated_server = isServer; #endif if (!game_configure(&game_params, cmd_args)) @@ -303,6 +311,8 @@ static void set_allowed_options(OptionList *allowed_options) _("Set password")))); allowed_options->insert(std::make_pair("go", ValueSpec(VALUETYPE_FLAG, _("Disable main menu")))); + allowed_options->insert(std::make_pair("console", ValueSpec(VALUETYPE_FLAG, + _("Starts with the console (Windows only)")))); #endif } diff --git a/src/porting.cpp b/src/porting.cpp index 4786a2a39..9d859da7d 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -929,4 +929,18 @@ bool secure_rand_fill_buf(void *buf, size_t len) #endif +void attachOrCreateConsole(void) +{ +#ifdef _WIN32 + static bool consoleAllocated = false; + const bool redirected = (_fileno(stdout) == -2 || _fileno(stdout) == -1); // If output is redirected to e.g a file + if (!consoleAllocated && redirected && (AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole())) { + freopen("CONOUT$", "w", stdout); + freopen("CONOUT$", "w", stderr); + consoleAllocated = true; + } +#endif +} + + } //namespace porting diff --git a/src/porting.h b/src/porting.h index 902547ea9..aa389d02c 100644 --- a/src/porting.h +++ b/src/porting.h @@ -377,6 +377,9 @@ bool setXorgWindowIconFromPath(IrrlichtDevice *device, void setWin32ExceptionHandler(); bool secure_rand_fill_buf(void *buf, size_t len); + +// This attaches to the parents process console, or creates a new one if it doesnt exist. +void attachOrCreateConsole(void); } // namespace porting #ifdef __ANDROID__ -- cgit v1.2.3 From 71ffe699d0d8e5cd2594eb74d0d767eeb8a09cea Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Fri, 7 Apr 2017 17:10:26 +0200 Subject: Settings: Update documentation (#5534) Now documented (sorted a-z): enable_console enable_particles creative_mode hud_scaling inventory_image_hack keymap_console keymap_zoom shader_path view_bobbing --- builtin/settingtypes.txt | 49 ++++++++++++++++++++++++++++++++------ minetest.conf.example | 61 +++++++++++++++++++++++++++++++++++++++++------- src/defaultsettings.cpp | 1 - 3 files changed, 95 insertions(+), 16 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index d95f8cf41..a3b91fe74 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -206,6 +206,10 @@ keymap_screenshot (Screenshot) key KEY_F12 # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_drop (Drop item key) key KEY_KEY_Q +# Key to use view zoom when possible. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_zoom (View zoom key) key KEY_KEY_Z + # Key for toggling the display of the HUD. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_toggle_hud (HUD toggle key) key KEY_F1 @@ -214,6 +218,10 @@ keymap_toggle_hud (HUD toggle key) key KEY_F1 # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_toggle_chat (Chat toggle key) key KEY_F2 +# Key for toggling the display of the large chat console. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_console (Large chat console key) key KEY_F10 + # Key for toggling the display of the fog. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_toggle_force_fog_off (Fog toggle key) key KEY_F3 @@ -275,6 +283,7 @@ show_entity_selectionbox (Show entity selection boxes) bool true enable_remote_media_server (Connect to external media server) bool true # Enable Lua modding support on client. +# This support is experimental and API can change. enable_client_modding (Client modding) bool false # URL to the server list displayed in the Multiplayer Tab. @@ -317,6 +326,9 @@ enable_3d_clouds (3D clouds) bool true # Method used to highlight selected object. node_highlighting (Node highlighting) enum box box,halo +# Adds particles when digging a node. +enable_particles (Digging particles) bool true + [***Filtering] # Use mip mapping to scale textures. May slightly increase performance. @@ -353,9 +365,12 @@ fsaa (FSAA) enum 0 0,1,2,4,8,16 [***Shaders] # Shaders allow advanced visual effects and may increase performance on some video cards. -# Thy only work with the OpenGL video backend. +# This only works with the OpenGL video backend. enable_shaders (Shaders) bool true +# Path to shader directory. If no path is defined, default location will be used. +shader_path (Shader path) path + [****Tone Mapping] # Enables filmic tone mapping @@ -390,7 +405,7 @@ enable_parallax_occlusion (Parallax occlusion) bool false parallax_occlusion_mode (Parallax occlusion mode) int 1 0 1 # Strength of parallax. -3d_parallax_strength (Parallax occlusion strength) float 0.025 +3d_paralax_strength (Parallax occlusion strength) float 0.025 # Number of parallax occlusion iterations. parallax_occlusion_iterations (Parallax occlusion iterations) int 4 @@ -472,13 +487,16 @@ cloud_height (Cloud height) int 120 # Values larger than 26 will start to produce sharp cutoffs at cloud area corners. cloud_radius (Cloud radius) int 12 +# Enables view bobbing when walking. +view_bobbing (Enable view bobbing) bool true + # Multiplier for view bobbing. # For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double. -view_bobbing_amount (View bobbing) float 1.0 +view_bobbing_amount (View bobbing factor) float 1.0 # Multiplier for fall bobbing. # For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double. -fall_bobbing_amount (Fall bobbing) float 0.0 +fall_bobbing_amount (Fall bobbing factor) float 0.0 # 3D support. # Currently supported: @@ -518,6 +536,9 @@ desynchronize_mapblock_texture_animation (Desynchronize block animation) bool tr # Useful if there's something to be displayed right or left of hotbar. hud_hotbar_max_width (Maximum hotbar width) float 1.0 +# Modifies the size of the hudbar elements. +hud_scaling (HUD scale factor) float 1.0 + # Enables caching of facedir rotated meshes. enable_mesh_cache (Mesh cache) bool false @@ -548,9 +569,16 @@ ambient_occlusion_gamma (Ambient occlusion gamma) float 2.2 0.25 4.0 # Enables animation of inventory items. inventory_items_animations (Inventory items animations) bool false +# Android systems only: Tries to create inventory textures from meshes +# when no supported render was found. +inventory_image_hack (Inventory image hack) bool false + # Fraction of the visible distance at which fog starts to be rendered fog_start (Fog Start) float 0.4 0.0 0.99 +# Makes all liquids opaque +opaque_water (Opaque liquids) bool false + [**Menus] # Use a cloud animation for the main menu background. @@ -617,6 +645,10 @@ screenshot_quality (Screenshot quality) int 0 0 100 # Adjust dpi configuration to your screen (non X11/Android only) e.g. for 4k screens. screen_dpi (DPI) int 72 +# Windows systems only: Start Minetest with the command line window in the background. +# Contains the same information as the file debug.txt (default name). +enable_console (Enable console window) bool false + [*Sound] enable_sound (Sound) bool true @@ -729,6 +761,9 @@ show_statusline_on_connect (Status message on connection) bool true # Enable players getting damage and dying. enable_damage (Damage) bool false +# Enable creative mode for new created maps. +creative_mode (Creative) bool false + # A chosen map seed for a new map, leave empty for random. # Will be overridden when creating a new world in the main menu. fixed_map_seed (Fixed map seed) string @@ -972,6 +1007,7 @@ mgv5_cavern_threshold (Cavern threshold) float 0.7 mgv5_np_filler_depth (Filler depth noise) noise_params 0, 1, (150, 150, 150), 261, 4, 0.7, 2.0 # Variation of terrain vertical scale. +# When noise is < -0.55 terrain is near-flat. mgv5_np_factor (Factor noise) noise_params 0, 1, (250, 250, 250), 920381, 3, 0.45, 2.0 # Y-level of average terrain surface. @@ -1059,7 +1095,7 @@ mgv6_np_apple_trees (Apple trees noise) noise_params 0, 1, (100, 100, 100), 3429 # Floatlands are currently experimental and subject to change. # Flags that are not specified in the flag string are not modified from the default. # Flags starting with 'no' are used to explicitly disable them. -mgv7_spflags (Mapgen v7 specific flags) flags mountains,ridges,caverns mountains,ridges,floatlands,caverns,nomountains,noridges,nofloatlands,nocaverns +mgv7_spflags (Mapgen v7 specific flags) flags mountains,ridges,nofloatlands,caverns mountains,ridges,floatlands,caverns,nomountains,noridges,nofloatlands,nocaverns # Controls width of tunnels, a smaller value creates wider tunnels. mgv7_cave_width (Cave width) float 0.09 @@ -1137,7 +1173,7 @@ mgv7_np_cave2 (Cave2 noise) noise_params 0, 12, (67, 67, 67), 10325, 3, 0.5, 2.0 # Occasional lakes and hills can be added to the flat world. # Flags that are not specified in the flag string are not modified from the default. # Flags starting with 'no' are used to explicitly disable them. -mgflat_spflags (Mapgen flat specific flags) flags lakes,hills,,nolakes,nohills +mgflat_spflags (Mapgen flat specific flags) flags nolakes,nohills lakes,hills,nolakes,nohills # Y of flat ground. mgflat_ground_level (Ground level) int 8 @@ -1349,7 +1385,6 @@ profiler.load (Load the game profiler) bool false profiler.default_report_format (Default report format) enum txt txt,csv,lua,json,json_pretty # The file path relative to your worldpath in which profiles will be saved to. -# profiler.report_path (Report path) string "" [***Instrumentation] diff --git a/minetest.conf.example b/minetest.conf.example index cfc66f168..9e9039bf2 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -211,6 +211,11 @@ # type: key # keymap_drop = KEY_KEY_Q +# Key to use view zoom when possible. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +# type: key +# keymap_zoom = KEY_KEY_Z + # Key for toggling the display of the HUD. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key @@ -221,6 +226,11 @@ # type: key # keymap_toggle_chat = KEY_F2 +# Key for toggling the display of the large chat console. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +# type: key +# keymap_console = KEY_F10 + # Key for toggling the display of the fog. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key @@ -298,7 +308,7 @@ # Enable Lua modding support on client. # This support is experimental and API can change. # type: bool -enable_client_modding (Client modding) bool false +# enable_client_modding = false # URL to the server list displayed in the Multiplayer Tab. # type: string @@ -350,6 +360,10 @@ enable_client_modding (Client modding) bool false # type: enum values: box, halo # node_highlighting = box +# Adds particles when digging a node. +# type: bool +# enable_particles = true + #### Filtering # Use mip mapping to scale textures. May slightly increase performance. @@ -393,10 +407,14 @@ enable_client_modding (Client modding) bool false #### Shaders # Shaders allow advanced visual effects and may increase performance on some video cards. -# Thy only work with the OpenGL video backend. +# This only works with the OpenGL video backend. # type: bool # enable_shaders = true +# Path to shader directory. If no path is defined, default location will be used. +# type: path +# shader_path = + ##### Tone Mapping # Enables filmic tone mapping @@ -439,7 +457,7 @@ enable_client_modding (Client modding) bool false # Strength of parallax. # type: float -# 3d_parallax_strength = 0.025 +# 3d_paralax_strength = 0.025 # Number of parallax occlusion iterations. # type: int @@ -545,6 +563,10 @@ enable_client_modding (Client modding) bool false # type: int # cloud_radius = 12 +# Enables view bobbing when walking. +# type: bool +# view_bobbing = true + # Multiplier for view bobbing. # For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double. # type: float @@ -567,7 +589,7 @@ enable_client_modding (Client modding) bool false # 3d_mode = none # In-game chat console height, between 0.1 (10%) and 1.0 (100%). -# type: float +# type: float min: 0.1 max: 1 # console_height = 1.0 # In-game chat console background color (R,G,B). @@ -603,6 +625,10 @@ enable_client_modding (Client modding) bool false # type: float # hud_hotbar_max_width = 1.0 +# Modifies the size of the hudbar elements. +# type: float +# hud_scaling = 1.0 + # Enables caching of facedir rotated meshes. # type: bool # enable_mesh_cache = false @@ -641,10 +667,19 @@ enable_client_modding (Client modding) bool false # type: bool # inventory_items_animations = false +# Android systems only: Tries to create inventory textures from meshes +# when no supported render was found. +# type: bool +# inventory_image_hack = false + # Fraction of the visible distance at which fog starts to be rendered # type: float min: 0 max: 0.99 # fog_start = 0.4 +# Makes all liquids opaque +# type: bool +# opaque_water = false + ### Menus # Use a cloud animation for the main menu background. @@ -734,6 +769,11 @@ enable_client_modding (Client modding) bool false # type: int # screen_dpi = 72 +# Windows systems only: Start Minetest with the command line window in the background. +# Contains the same information as the file debug.txt (default name). +# type: bool +# enable_console = false + ## Sound # type: bool @@ -876,6 +916,10 @@ enable_client_modding (Client modding) bool false # type: bool # enable_damage = false +# Enable creative mode for new created maps. +# type: bool +# creative_mode = false + # A chosen map seed for a new map, leave empty for random. # Will be overridden when creating a new world in the main menu. # type: string @@ -1083,7 +1127,8 @@ enable_client_modding (Client modding) bool false # on the eye position of the player. This can reduce the number of blocks # sent to the client 50-80%. The client will not longer receive most invisible # so that the utility of noclip mode is reduced. -server_side_occlusion_culling = true +# type: bool +# server_side_occlusion_culling = true ## Mapgen @@ -1433,7 +1478,7 @@ server_side_occlusion_culling = true # type: float # mgflat_cave_width = 0.09 -# Terrain noise threshold for optional lakes. +# Terrain noise threshold for lakes. # Controls proportion of world area covered by lakes. # Adjust towards 0.0 for a larger proportion. # type: float @@ -1443,7 +1488,7 @@ server_side_occlusion_culling = true # type: float # mgflat_lake_steepness = 48.0 -# Terrain noise threshold for optional hills. +# Terrain noise threshold for hills. # Controls proportion of world area covered by hills. # Adjust towards 0.0 for a larger proportion. # type: float @@ -1678,7 +1723,6 @@ server_side_occlusion_culling = true # profiler.default_report_format = txt # The file path relative to your worldpath in which profiles will be saved to. -# # type: string # profiler.report_path = "" @@ -1794,3 +1838,4 @@ server_side_occlusion_culling = true # Print the engine's profiling data in regular intervals (in seconds). 0 = disable. Useful for developers. # type: int # profiler_print_interval = 0 + diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 52ff4c068..2a49a0eca 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -263,7 +263,6 @@ void set_default_settings(Settings *settings) settings->setDefault("creative_mode", "false"); settings->setDefault("show_statusline_on_connect", "true"); settings->setDefault("enable_damage", "true"); - settings->setDefault("give_initial_stuff", "false"); settings->setDefault("default_password", ""); settings->setDefault("default_privs", "interact, shout"); settings->setDefault("enable_pvp", "true"); -- cgit v1.2.3 From 0a8834608d21998bd05b899bd91ddc2196762926 Mon Sep 17 00:00:00 2001 From: number Zero Date: Thu, 12 Jan 2017 12:19:36 +0300 Subject: Hard-coded undersampling. Adds uniform undersampling for the 3D rendered scene. GUI elements are not undersampled, resulting in better playability for users with low-performance platforms with readable fonts and formspecs. The undersampling setting can be set to 0 (disabled), 2, 3, 4 pixels which translates into a resolution reduction of x4, x9 or x16, and is significant. --- builtin/settingtypes.txt | 5 +++++ minetest.conf.example | 6 +++++ src/defaultsettings.cpp | 1 + src/drawscene.cpp | 47 +++++++++++++++++++++++++++++++++------ src/settings_translation_file.cpp | 2 ++ 5 files changed, 54 insertions(+), 7 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index a3b91fe74..2c74d6c44 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -362,6 +362,11 @@ texture_min_size (Minimum texture size for filters) int 64 # when set to higher number than 0. fsaa (FSAA) enum 0 0,1,2,4,8,16 +# Undersampling is similar to using lower screen resolution, but it applies +# to the game world only, keeping the GUI intact. +# It should give significant performance boost at the cost of less detailed image. +undersampling (Undersampling) enum 0 0,2,3,4 + [***Shaders] # Shaders allow advanced visual effects and may increase performance on some video cards. diff --git a/minetest.conf.example b/minetest.conf.example index 9e9039bf2..d147ebfac 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -404,6 +404,12 @@ # type: enum values: 0, 1, 2, 4, 8, 16 # fsaa = 0 +# Undersampling is similar to using lower screen resolution, but it applies +# to the game world only, keeping the GUI intact. +# It should give significant performance boost at the cost of less detailed image. +# type: enum values: 0, 2, 3, 4 +# undersampling = 0 + #### Shaders # Shaders allow advanced visual effects and may increase performance on some video cards. diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 2a49a0eca..c6ced5931 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -108,6 +108,7 @@ void set_default_settings(Settings *settings) settings->setDefault("show_debug", "true"); #endif settings->setDefault("fsaa", "0"); + settings->setDefault("undersampling", "0"); settings->setDefault("enable_fog", "true"); settings->setDefault("fog_start", "0.4"); settings->setDefault("3d_mode", "none"); diff --git a/src/drawscene.cpp b/src/drawscene.cpp index 663c8828c..421b96f12 100644 --- a/src/drawscene.cpp +++ b/src/drawscene.cpp @@ -459,10 +459,37 @@ void draw_pageflip_3d_mode(Camera& camera, bool show_hud, #endif } -void draw_plain(Camera &camera, bool show_hud, Hud &hud, - video::IVideoDriver *driver, bool draw_wield_tool, - Client &client, gui::IGUIEnvironment *guienv) +// returns (size / coef), rounded upwards +inline int scaledown(int coef, int size) { + return (size + coef - 1) / coef; +} + +void draw_plain(Camera &camera, bool show_hud, + Hud &hud, video::IVideoDriver *driver, + scene::ISceneManager *smgr, const v2u32 &screensize, + bool draw_wield_tool, Client &client, gui::IGUIEnvironment *guienv, + video::SColor skycolor) +{ + // Undersampling-specific stuff + static video::ITexture *image = NULL; + static v2u32 last_pixelated_size = v2u32(0, 0); + int undersampling = g_settings->getU16("undersampling"); + v2u32 pixelated_size; + v2u32 dest_size; + if (undersampling > 0) { + pixelated_size = v2u32(scaledown(undersampling, screensize.X), + scaledown(undersampling, screensize.Y)); + dest_size = v2u32(undersampling * pixelated_size.X, undersampling * pixelated_size.Y); + if (pixelated_size != last_pixelated_size) { + init_texture(driver, pixelated_size, &image, "mt_drawimage_img1"); + last_pixelated_size = pixelated_size; + } + driver->setRenderTarget(image, true, true, skycolor); + } + + // Render + smgr->drawAll(); driver->setTransform(video::ETS_WORLD, core::IdentityMatrix); if (show_hud) { hud.drawSelectionMesh(); @@ -470,10 +497,18 @@ void draw_plain(Camera &camera, bool show_hud, Hud &hud, camera.drawWieldedTool(); } } + + // Upscale lowres render + if (undersampling > 0) { + driver->setRenderTarget(0, true, true); + driver->draw2DImage(image, + irr::core::rect(0, 0, dest_size.X, dest_size.Y), + irr::core::rect(0, 0, pixelated_size.X, pixelated_size.Y)); + } } void draw_scene(video::IVideoDriver *driver, scene::ISceneManager *smgr, - Camera &camera, Client& client, LocalPlayer *player, Hud &hud, + Camera &camera, Client &client, LocalPlayer *player, Hud &hud, Minimap &mapper, gui::IGUIEnvironment *guienv, const v2u32 &screensize, const video::SColor &skycolor, bool show_hud, bool show_minimap) @@ -496,8 +531,6 @@ void draw_scene(video::IVideoDriver *driver, scene::ISceneManager *smgr, const std::string &draw_mode = g_settings->get("3d_mode"); - smgr->drawAll(); - if (draw_mode == "anaglyph") { draw_anaglyph_3d_mode(camera, show_hud, hud, driver, @@ -531,7 +564,7 @@ void draw_scene(video::IVideoDriver *driver, scene::ISceneManager *smgr, } else { draw_plain(camera, show_hud, hud, driver, - draw_wield_tool, client, guienv); + smgr, screensize, draw_wield_tool, client, guienv, skycolor); } /* diff --git a/src/settings_translation_file.cpp b/src/settings_translation_file.cpp index 9ec21c415..93f2688d7 100644 --- a/src/settings_translation_file.cpp +++ b/src/settings_translation_file.cpp @@ -152,6 +152,8 @@ fake_function() { gettext("When using bilinear/trilinear/anisotropic filters, low-resolution textures\ncan be blurred, so automatically upscale them with nearest-neighbor\ninterpolation to preserve crisp pixels. This sets the minimum texture size\nfor the upscaled textures; higher values look sharper, but require more\nmemory. Powers of 2 are recommended. Setting this higher than 1 may not\nhave a visible effect unless bilinear/trilinear/anisotropic filtering is\nenabled."); gettext("FSAA"); gettext("Experimental option, might cause visible spaces between blocks\nwhen set to higher number than 0."); + gettext("Undersampling"); + gettext("Undersampling is similar to using lower screen resolution, but it applies\nto the game world only, keeping the GUI intact.\nIt should give significant performance boost at the cost of less detailed image."); gettext("Shaders"); gettext("Shaders"); gettext("Shaders allow advanced visual effects and may increase performance on some video cards.\nThy only work with the OpenGL video backend."); -- cgit v1.2.3 From 04cc9de8f2fbcb11f133c88f02fc11504b3ea6f3 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 15 Apr 2017 10:55:52 +0300 Subject: MeshUpdateQueue: Add a MapBlock cache that minimizes the amount of MapBlock copying done in the main thread Cache size is configurable by the meshgen_block_cache_size (default 20 MB). New profiler stats: - MeshUpdateQueue MapBlock cache hit % - MeshUpdateQueue MapBlock cache size kB Removes one type of stutter that was seen on the client when received MapBlocks were being handled. (the "MeshMakeData::fill" stutter) Kind of related to at least #5239 Originally preceded by these commits, now includes them: - Move the mesh generator thread into src/mesh_generator_thread.{cpp,h} - mesh_generator_thread.cpp: Update code style - MeshUpdateThread: Modify interface to house a different implementation: Actual functionality will be changed by next commits. - MeshMakeData: Add fillBlockData() interface (so that caller can fill in stuff from eg. a MapBlock cache) --- build/android/jni/Android.mk | 1 + builtin/settingtypes.txt | 5 + minetest.conf.example | 6 + src/CMakeLists.txt | 1 + src/client.cpp | 178 ++--------------------- src/client.h | 83 +---------- src/defaultsettings.cpp | 1 + src/mapblock.h | 5 + src/mapblock_mesh.cpp | 54 +++---- src/mapblock_mesh.h | 6 + src/mesh_generator_thread.cpp | 329 ++++++++++++++++++++++++++++++++++++++++++ src/mesh_generator_thread.h | 135 +++++++++++++++++ 12 files changed, 526 insertions(+), 278 deletions(-) create mode 100644 src/mesh_generator_thread.cpp create mode 100644 src/mesh_generator_thread.h (limited to 'src/defaultsettings.cpp') diff --git a/build/android/jni/Android.mk b/build/android/jni/Android.mk index fd104db06..2929eaba1 100644 --- a/build/android/jni/Android.mk +++ b/build/android/jni/Android.mk @@ -185,6 +185,7 @@ LOCAL_SRC_FILES := \ jni/src/mapnode.cpp \ jni/src/mapsector.cpp \ jni/src/mesh.cpp \ + jni/src/mesh_generator_thread.cpp \ jni/src/metadata.cpp \ jni/src/mg_biome.cpp \ jni/src/mg_decoration.cpp \ diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 2c74d6c44..5dc48c00e 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -551,6 +551,11 @@ enable_mesh_cache (Mesh cache) bool false # down the rate of mesh updates, thus reducing jitter on slower clients. mesh_generation_interval (Mapblock mesh generation delay) int 0 0 50 +# Size of the MapBlock cache of the mesh generator. Increasing this will +# increase the cache hit %, reducing the data being copied from the main +# thread, thus reducing jitter. +meshgen_block_cache_size (Mapblock mesh generator's MapBlock cache size MB) int 20 0 1000 + # Enables minimap. enable_minimap (Minimap) bool true diff --git a/minetest.conf.example b/minetest.conf.example index d147ebfac..9b50a775d 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -644,6 +644,12 @@ # type: int min: 0 max: 50 # mesh_generation_interval = 0 +# Size of the MapBlock cache of the mesh generator. Increasing this will +# increase the cache hit %, reducing the data being copied from the main +# thread, thus reducing jitter. +# type: int min: 0 max: 1000 +# meshgen_block_cache_size = 20 + # Enables minimap. # type: bool # enable_minimap = true diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index edb291545..37f72a44d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -522,6 +522,7 @@ set(client_SRCS main.cpp mapblock_mesh.cpp mesh.cpp + mesh_generator_thread.cpp minimap.cpp particles.cpp shader.cpp diff --git a/src/client.cpp b/src/client.cpp index 5ca51bd9c..7b962cd94 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -50,147 +50,6 @@ with this program; if not, write to the Free Software Foundation, Inc., extern gui::IGUIEnvironment* guienv; -/* - QueuedMeshUpdate -*/ - -QueuedMeshUpdate::QueuedMeshUpdate(): - p(-1337,-1337,-1337), - data(NULL), - ack_block_to_server(false) -{ -} - -QueuedMeshUpdate::~QueuedMeshUpdate() -{ - if(data) - delete data; -} - -/* - MeshUpdateQueue -*/ - -MeshUpdateQueue::MeshUpdateQueue() -{ -} - -MeshUpdateQueue::~MeshUpdateQueue() -{ - MutexAutoLock lock(m_mutex); - - for(std::vector::iterator - i = m_queue.begin(); - i != m_queue.end(); ++i) - { - QueuedMeshUpdate *q = *i; - delete q; - } -} - -/* - peer_id=0 adds with nobody to send to -*/ -void MeshUpdateQueue::addBlock(v3s16 p, MeshMakeData *data, bool ack_block_to_server, bool urgent) -{ - DSTACK(FUNCTION_NAME); - - assert(data); // pre-condition - - MutexAutoLock lock(m_mutex); - - if(urgent) - m_urgents.insert(p); - - /* - Find if block is already in queue. - If it is, update the data and quit. - */ - for(std::vector::iterator - i = m_queue.begin(); - i != m_queue.end(); ++i) - { - QueuedMeshUpdate *q = *i; - if(q->p == p) - { - if(q->data) - delete q->data; - q->data = data; - if(ack_block_to_server) - q->ack_block_to_server = true; - return; - } - } - - /* - Add the block - */ - QueuedMeshUpdate *q = new QueuedMeshUpdate; - q->p = p; - q->data = data; - q->ack_block_to_server = ack_block_to_server; - m_queue.push_back(q); -} - -// Returned pointer must be deleted -// Returns NULL if queue is empty -QueuedMeshUpdate *MeshUpdateQueue::pop() -{ - MutexAutoLock lock(m_mutex); - - bool must_be_urgent = !m_urgents.empty(); - for(std::vector::iterator - i = m_queue.begin(); - i != m_queue.end(); ++i) - { - QueuedMeshUpdate *q = *i; - if(must_be_urgent && m_urgents.count(q->p) == 0) - continue; - m_queue.erase(i); - m_urgents.erase(q->p); - return q; - } - return NULL; -} - -/* - MeshUpdateThread -*/ - -MeshUpdateThread::MeshUpdateThread() : UpdateThread("Mesh") -{ - m_generation_interval = g_settings->getU16("mesh_generation_interval"); - m_generation_interval = rangelim(m_generation_interval, 0, 50); -} - -void MeshUpdateThread::enqueueUpdate(v3s16 p, MeshMakeData *data, - bool ack_block_to_server, bool urgent) -{ - m_queue_in.addBlock(p, data, ack_block_to_server, urgent); - deferUpdate(); -} - -void MeshUpdateThread::doUpdate() -{ - QueuedMeshUpdate *q; - while ((q = m_queue_in.pop())) { - if (m_generation_interval) - sleep_ms(m_generation_interval); - ScopeProfiler sp(g_profiler, "Client: Mesh making"); - - MapBlockMesh *mesh_new = new MapBlockMesh(q->data, m_camera_offset); - - MeshUpdateResult r; - r.p = q->p; - r.mesh = mesh_new; - r.ack_block_to_server = q->ack_block_to_server; - - m_queue_out.push_back(r); - - delete q; - } -} - /* Client */ @@ -220,7 +79,7 @@ Client::Client( m_nodedef(nodedef), m_sound(sound), m_event(event), - m_mesh_update_thread(), + m_mesh_update_thread(this), m_env( new ClientMap(this, control, device->getSceneManager()->getRootSceneNode(), @@ -269,12 +128,6 @@ Client::Client( m_minimap = new Minimap(device, this); m_cache_save_interval = g_settings->getU16("server_map_save_interval"); - m_cache_smooth_lighting = g_settings->getBool("smooth_lighting"); - m_cache_enable_shaders = g_settings->getBool("enable_shaders"); - m_cache_use_tangent_vertices = m_cache_enable_shaders && ( - g_settings->getBool("enable_bumpmapping") || - g_settings->getBool("enable_parallax_occlusion")); - m_modding_enabled = g_settings->getBool("enable_client_modding"); m_script = new ClientScripting(this); m_env.setScript(m_script); @@ -1605,6 +1458,11 @@ int Client::getCrackLevel() return m_crack_level; } +v3s16 Client::getCrackPos() +{ + return m_crack_pos; +} + void Client::setCrack(int level, v3s16 pos) { int old_crack_level = m_crack_level; @@ -1670,28 +1528,14 @@ void Client::typeChatMessage(const std::wstring &message) void Client::addUpdateMeshTask(v3s16 p, bool ack_to_server, bool urgent) { + // Check if the block exists to begin with. In the case when a non-existing + // neighbor is automatically added, it may not. In that case we don't want + // to tell the mesh update thread about it. MapBlock *b = m_env.getMap().getBlockNoCreateNoEx(p); - if(b == NULL) + if (b == NULL) return; - /* - Create a task to update the mesh of the block - */ - - MeshMakeData *data = new MeshMakeData(this, m_cache_enable_shaders, - m_cache_use_tangent_vertices); - - { - //TimeTaker timer("data fill"); - // Release: ~0ms - // Debug: 1-6ms, avg=2ms - data->fill(b); - data->setCrack(m_crack_level, m_crack_pos); - data->setSmoothLighting(m_cache_smooth_lighting); - } - - // Add task to queue - m_mesh_update_thread.enqueueUpdate(p, data, ack_to_server, urgent); + m_mesh_update_thread.updateBlock(&m_env.getMap(), p, ack_to_server, urgent); } void Client::addUpdateMeshTaskWithEdge(v3s16 blockpos, bool ack_to_server, bool urgent) diff --git a/src/client.h b/src/client.h index e565acd93..e7fcb597d 100644 --- a/src/client.h +++ b/src/client.h @@ -36,6 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "particles.h" #include "mapnode.h" #include "tileanimation.h" +#include "mesh_generator_thread.h" struct MeshMakeData; class MapBlockMesh; @@ -54,88 +55,12 @@ struct MinimapMapblock; class Camera; class NetworkPacket; -struct QueuedMeshUpdate -{ - v3s16 p; - MeshMakeData *data; - bool ack_block_to_server; - - QueuedMeshUpdate(); - ~QueuedMeshUpdate(); -}; - enum LocalClientState { LC_Created, LC_Init, LC_Ready }; -/* - A thread-safe queue of mesh update tasks -*/ -class MeshUpdateQueue -{ -public: - MeshUpdateQueue(); - - ~MeshUpdateQueue(); - - /* - peer_id=0 adds with nobody to send to - */ - void addBlock(v3s16 p, MeshMakeData *data, - bool ack_block_to_server, bool urgent); - - // Returned pointer must be deleted - // Returns NULL if queue is empty - QueuedMeshUpdate * pop(); - - u32 size() - { - MutexAutoLock lock(m_mutex); - return m_queue.size(); - } - -private: - std::vector m_queue; - std::set m_urgents; - Mutex m_mutex; -}; - -struct MeshUpdateResult -{ - v3s16 p; - MapBlockMesh *mesh; - bool ack_block_to_server; - - MeshUpdateResult(): - p(-1338,-1338,-1338), - mesh(NULL), - ack_block_to_server(false) - { - } -}; - -class MeshUpdateThread : public UpdateThread -{ -private: - MeshUpdateQueue m_queue_in; - int m_generation_interval; - -protected: - virtual void doUpdate(); - -public: - - MeshUpdateThread(); - - void enqueueUpdate(v3s16 p, MeshMakeData *data, - bool ack_block_to_server, bool urgent); - MutexedQueue m_queue_out; - - v3s16 m_camera_offset; -}; - enum ClientEventType { CE_NONE, @@ -471,6 +396,7 @@ public: float getAnimationTime(); int getCrackLevel(); + v3s16 getCrackPos(); void setCrack(int level, v3s16 pos); u16 getHP(); @@ -726,11 +652,6 @@ private: IntervalLimiter m_localdb_save_interval; u16 m_cache_save_interval; - // TODO: Add callback to update these when g_settings changes - bool m_cache_smooth_lighting; - bool m_cache_enable_shaders; - bool m_cache_use_tangent_vertices; - ClientScripting *m_script; bool m_modding_enabled; UNORDERED_MAP m_mod_storages; diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index c6ced5931..573b5e2d8 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -39,6 +39,7 @@ void set_default_settings(Settings *settings) settings->setDefault("sound_volume", "0.8"); settings->setDefault("enable_mesh_cache", "false"); settings->setDefault("mesh_generation_interval", "0"); + settings->setDefault("meshgen_block_cache_size", "20"); settings->setDefault("enable_vbo", "true"); settings->setDefault("free_move", "false"); settings->setDefault("fast_move", "false"); diff --git a/src/mapblock.h b/src/mapblock.h index 7ff613fe8..8816dc817 100644 --- a/src/mapblock.h +++ b/src/mapblock.h @@ -154,6 +154,11 @@ public: raiseModified(MOD_STATE_WRITE_NEEDED, MOD_REASON_REALLOCATE); } + MapNode* getData() + { + return data; + } + //// //// Modification tracking methods //// diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp index eddb061b4..933dfc32a 100644 --- a/src/mapblock_mesh.cpp +++ b/src/mapblock_mesh.cpp @@ -48,49 +48,43 @@ MeshMakeData::MeshMakeData(Client *client, bool use_shaders, m_use_tangent_vertices(use_tangent_vertices) {} -void MeshMakeData::fill(MapBlock *block) +void MeshMakeData::fillBlockDataBegin(const v3s16 &blockpos) { - m_blockpos = block->getPos(); + m_blockpos = blockpos; v3s16 blockpos_nodes = m_blockpos*MAP_BLOCKSIZE; - /* - Copy data - */ - - // Allocate this block + neighbors m_vmanip.clear(); VoxelArea voxel_area(blockpos_nodes - v3s16(1,1,1) * MAP_BLOCKSIZE, blockpos_nodes + v3s16(1,1,1) * MAP_BLOCKSIZE*2-v3s16(1,1,1)); m_vmanip.addArea(voxel_area); +} - { - //TimeTaker timer("copy central block data"); - // 0ms +void MeshMakeData::fillBlockData(const v3s16 &block_offset, MapNode *data) +{ + v3s16 data_size(MAP_BLOCKSIZE, MAP_BLOCKSIZE, MAP_BLOCKSIZE); + VoxelArea data_area(v3s16(0,0,0), data_size - v3s16(1,1,1)); - // Copy our data - block->copyTo(m_vmanip); - } - { - //TimeTaker timer("copy neighbor block data"); - // 0ms + v3s16 bp = m_blockpos + block_offset; + v3s16 blockpos_nodes = bp * MAP_BLOCKSIZE; + m_vmanip.copyFrom(data, data_area, v3s16(0,0,0), blockpos_nodes, data_size); +} + +void MeshMakeData::fill(MapBlock *block) +{ + fillBlockDataBegin(block->getPos()); - /* - Copy neighbors. This is lightning fast. - Copying only the borders would be *very* slow. - */ + fillBlockData(v3s16(0,0,0), block->getData()); - // Get map - Map *map = block->getParent(); + // Get map for reading neigbhor blocks + Map *map = block->getParent(); - for(u16 i=0; i<26; i++) - { - const v3s16 &dir = g_26dirs[i]; - v3s16 bp = m_blockpos + dir; - MapBlock *b = map->getBlockNoCreateNoEx(bp); - if(b) - b->copyTo(m_vmanip); - } + for (u16 i=0; i<26; i++) { + const v3s16 &dir = g_26dirs[i]; + v3s16 bp = m_blockpos + dir; + MapBlock *b = map->getBlockNoCreateNoEx(bp); + if(b) + fillBlockData(dir, b->getData()); } } diff --git a/src/mapblock_mesh.h b/src/mapblock_mesh.h index 916703f3e..25c699e1c 100644 --- a/src/mapblock_mesh.h +++ b/src/mapblock_mesh.h @@ -52,6 +52,12 @@ struct MeshMakeData MeshMakeData(Client *client, bool use_shaders, bool use_tangent_vertices = false); + /* + Copy block data manually (to allow optimizations by the caller) + */ + void fillBlockDataBegin(const v3s16 &blockpos); + void fillBlockData(const v3s16 &block_offset, MapNode *data); + /* Copy central data directly from block, and other data from parent of block. diff --git a/src/mesh_generator_thread.cpp b/src/mesh_generator_thread.cpp new file mode 100644 index 000000000..126bf6327 --- /dev/null +++ b/src/mesh_generator_thread.cpp @@ -0,0 +1,329 @@ +/* +Minetest +Copyright (C) 2013, 2017 celeron55, Perttu Ahola + +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. +*/ + +#include "mesh_generator_thread.h" +#include "settings.h" +#include "profiler.h" +#include "client.h" +#include "mapblock.h" +#include "map.h" + +/* + CachedMapBlockData +*/ + +CachedMapBlockData::CachedMapBlockData(): + p(-1337,-1337,-1337), + data(NULL), + refcount_from_queue(0), + last_used_timestamp(time(0)) +{ +} + +CachedMapBlockData::~CachedMapBlockData() +{ + assert(refcount_from_queue == 0); + + if (data) + delete[] data; +} + +/* + QueuedMeshUpdate +*/ + +QueuedMeshUpdate::QueuedMeshUpdate(): + p(-1337,-1337,-1337), + ack_block_to_server(false), + urgent(false), + crack_level(-1), + crack_pos(0,0,0), + data(NULL) +{ +} + +QueuedMeshUpdate::~QueuedMeshUpdate() +{ + if (data) + delete data; +} + +/* + MeshUpdateQueue +*/ + +MeshUpdateQueue::MeshUpdateQueue(Client *client): + m_client(client) +{ + m_cache_enable_shaders = g_settings->getBool("enable_shaders"); + m_cache_use_tangent_vertices = m_cache_enable_shaders && ( + g_settings->getBool("enable_bumpmapping") || + g_settings->getBool("enable_parallax_occlusion")); + m_cache_smooth_lighting = g_settings->getBool("smooth_lighting"); + m_meshgen_block_cache_size = g_settings->getS32("meshgen_block_cache_size"); +} + +MeshUpdateQueue::~MeshUpdateQueue() +{ + MutexAutoLock lock(m_mutex); + + for (std::vector::iterator i = m_queue.begin(); + i != m_queue.end(); ++i) { + QueuedMeshUpdate *q = *i; + delete q; + } +} + +void MeshUpdateQueue::addBlock(Map *map, v3s16 p, bool ack_block_to_server, bool urgent) +{ + DSTACK(FUNCTION_NAME); + + MutexAutoLock lock(m_mutex); + + cleanupCache(); + + /* + Cache the block data (force-update the center block, don't update the + neighbors but get them if they aren't already cached) + */ + std::vector cached_blocks; + size_t cache_hit_counter = 0; + cached_blocks.reserve(3*3*3); + v3s16 dp; + for (dp.X = -1; dp.X <= 1; dp.X++) + for (dp.Y = -1; dp.Y <= 1; dp.Y++) + for (dp.Z = -1; dp.Z <= 1; dp.Z++) { + v3s16 p1 = p + dp; + CachedMapBlockData *cached_block; + if (dp == v3s16(0, 0, 0)) + cached_block = cacheBlock(map, p1, FORCE_UPDATE); + else + cached_block = cacheBlock(map, p1, SKIP_UPDATE_IF_ALREADY_CACHED, + &cache_hit_counter); + cached_blocks.push_back(cached_block); + } + g_profiler->avg("MeshUpdateQueue MapBlock cache hit %", + 100.0f * cache_hit_counter / cached_blocks.size()); + + /* + Mark the block as urgent if requested + */ + if (urgent) + m_urgents.insert(p); + + /* + Find if block is already in queue. + If it is, update the data and quit. + */ + for (std::vector::iterator i = m_queue.begin(); + i != m_queue.end(); ++i) { + QueuedMeshUpdate *q = *i; + if (q->p == p) { + // NOTE: We are not adding a new position to the queue, thus + // refcount_from_queue stays the same. + if(ack_block_to_server) + q->ack_block_to_server = true; + q->crack_level = m_client->getCrackLevel(); + q->crack_pos = m_client->getCrackPos(); + return; + } + } + + /* + Add the block + */ + QueuedMeshUpdate *q = new QueuedMeshUpdate; + q->p = p; + q->ack_block_to_server = ack_block_to_server; + q->crack_level = m_client->getCrackLevel(); + q->crack_pos = m_client->getCrackPos(); + m_queue.push_back(q); + + // This queue entry is a new reference to the cached blocks + for (size_t i=0; irefcount_from_queue++; + } +} + +// Returned pointer must be deleted +// Returns NULL if queue is empty +QueuedMeshUpdate *MeshUpdateQueue::pop() +{ + MutexAutoLock lock(m_mutex); + + bool must_be_urgent = !m_urgents.empty(); + for (std::vector::iterator i = m_queue.begin(); + i != m_queue.end(); ++i) { + QueuedMeshUpdate *q = *i; + if(must_be_urgent && m_urgents.count(q->p) == 0) + continue; + m_queue.erase(i); + m_urgents.erase(q->p); + fillDataFromMapBlockCache(q); + return q; + } + return NULL; +} + +CachedMapBlockData* MeshUpdateQueue::cacheBlock(Map *map, v3s16 p, UpdateMode mode, + size_t *cache_hit_counter) +{ + std::map::iterator it = + m_cache.find(p); + if (it != m_cache.end()) { + // Already in cache + CachedMapBlockData *cached_block = it->second; + if (mode == SKIP_UPDATE_IF_ALREADY_CACHED) { + if (cache_hit_counter) + (*cache_hit_counter)++; + return cached_block; + } + MapBlock *b = map->getBlockNoCreateNoEx(p); + if (b) { + if (cached_block->data == NULL) + cached_block->data = + new MapNode[MAP_BLOCKSIZE * MAP_BLOCKSIZE * MAP_BLOCKSIZE]; + memcpy(cached_block->data, b->getData(), + MAP_BLOCKSIZE * MAP_BLOCKSIZE * MAP_BLOCKSIZE * sizeof(MapNode)); + } else { + delete[] cached_block->data; + cached_block->data = NULL; + } + return cached_block; + } else { + // Not yet in cache + CachedMapBlockData *cached_block = new CachedMapBlockData(); + m_cache[p] = cached_block; + MapBlock *b = map->getBlockNoCreateNoEx(p); + if (b) { + cached_block->data = + new MapNode[MAP_BLOCKSIZE * MAP_BLOCKSIZE * MAP_BLOCKSIZE]; + memcpy(cached_block->data, b->getData(), + MAP_BLOCKSIZE * MAP_BLOCKSIZE * MAP_BLOCKSIZE * sizeof(MapNode)); + } + return cached_block; + } +} + +CachedMapBlockData* MeshUpdateQueue::getCachedBlock(const v3s16 &p) +{ + std::map::iterator it = m_cache.find(p); + if (it != m_cache.end()) { + return it->second; + } + return NULL; +} + +void MeshUpdateQueue::fillDataFromMapBlockCache(QueuedMeshUpdate *q) +{ + MeshMakeData *data = new MeshMakeData(m_client, m_cache_enable_shaders, + m_cache_use_tangent_vertices); + q->data = data; + + data->fillBlockDataBegin(q->p); + + int t_now = time(0); + + // Collect data for 3*3*3 blocks from cache + v3s16 dp; + for (dp.X = -1; dp.X <= 1; dp.X++) + for (dp.Y = -1; dp.Y <= 1; dp.Y++) + for (dp.Z = -1; dp.Z <= 1; dp.Z++) { + v3s16 p = q->p + dp; + CachedMapBlockData *cached_block = getCachedBlock(p); + if (cached_block) { + cached_block->refcount_from_queue--; + cached_block->last_used_timestamp = t_now; + if (cached_block->data) + data->fillBlockData(dp, cached_block->data); + } + } + + data->setCrack(q->crack_level, q->crack_pos); + data->setSmoothLighting(m_cache_smooth_lighting); +} + +void MeshUpdateQueue::cleanupCache() +{ + const int mapblock_kB = MAP_BLOCKSIZE * MAP_BLOCKSIZE * MAP_BLOCKSIZE * + sizeof(MapNode) / 1000; + g_profiler->avg("MeshUpdateQueue MapBlock cache size kB", + mapblock_kB * m_cache.size()); + + // The cache size is kept roughly below cache_soft_max_size, not letting + // anything get older than cache_seconds_max or deleted before 2 seconds. + const int cache_seconds_max = 10; + const int cache_soft_max_size = m_meshgen_block_cache_size * 1000 / mapblock_kB; + int cache_seconds = MYMAX(2, cache_seconds_max - + m_cache.size() / (cache_soft_max_size / cache_seconds_max)); + + int t_now = time(0); + + for (std::map::iterator it = m_cache.begin(); + it != m_cache.end(); ) { + CachedMapBlockData *cached_block = it->second; + if (cached_block->refcount_from_queue == 0 && + cached_block->last_used_timestamp < t_now - cache_seconds) { + m_cache.erase(it++); + } else { + ++it; + } + } +} + +/* + MeshUpdateThread +*/ + +MeshUpdateThread::MeshUpdateThread(Client *client): + UpdateThread("Mesh"), + m_queue_in(client) +{ + m_generation_interval = g_settings->getU16("mesh_generation_interval"); + m_generation_interval = rangelim(m_generation_interval, 0, 50); +} + +void MeshUpdateThread::updateBlock(Map *map, v3s16 p, bool ack_block_to_server, + bool urgent) +{ + // Allow the MeshUpdateQueue to do whatever it wants + m_queue_in.addBlock(map, p, ack_block_to_server, urgent); + deferUpdate(); +} + +void MeshUpdateThread::doUpdate() +{ + QueuedMeshUpdate *q; + while ((q = m_queue_in.pop())) { + if (m_generation_interval) + sleep_ms(m_generation_interval); + ScopeProfiler sp(g_profiler, "Client: Mesh making"); + + MapBlockMesh *mesh_new = new MapBlockMesh(q->data, m_camera_offset); + + MeshUpdateResult r; + r.p = q->p; + r.mesh = mesh_new; + r.ack_block_to_server = q->ack_block_to_server; + + m_queue_out.push_back(r); + + delete q; + } +} diff --git a/src/mesh_generator_thread.h b/src/mesh_generator_thread.h new file mode 100644 index 000000000..e74861862 --- /dev/null +++ b/src/mesh_generator_thread.h @@ -0,0 +1,135 @@ +/* +Minetest +Copyright (C) 2013, 2017 celeron55, Perttu Ahola + +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. +*/ + +#ifndef MESH_GENERATOR_THREAD_HEADER +#define MESH_GENERATOR_THREAD_HEADER + +#include "mapblock_mesh.h" +#include "threading/mutex_auto_lock.h" +#include "util/thread.h" + +struct CachedMapBlockData +{ + v3s16 p; + MapNode *data; // A copy of the MapBlock's data member + int refcount_from_queue; + int last_used_timestamp; + + CachedMapBlockData(); + ~CachedMapBlockData(); +}; + +struct QueuedMeshUpdate +{ + v3s16 p; + bool ack_block_to_server; + bool urgent; + int crack_level; + v3s16 crack_pos; + MeshMakeData *data; // This is generated in MeshUpdateQueue::pop() + + QueuedMeshUpdate(); + ~QueuedMeshUpdate(); +}; + +/* + A thread-safe queue of mesh update tasks and a cache of MapBlock data +*/ +class MeshUpdateQueue +{ + enum UpdateMode { + FORCE_UPDATE, + SKIP_UPDATE_IF_ALREADY_CACHED, + }; +public: + MeshUpdateQueue(Client *client); + + ~MeshUpdateQueue(); + + // Caches the block at p and its neighbors (if needed) and queues a mesh + // update for the block at p + void addBlock(Map *map, v3s16 p, bool ack_block_to_server, bool urgent); + + // Returned pointer must be deleted + // Returns NULL if queue is empty + QueuedMeshUpdate * pop(); + + u32 size() + { + MutexAutoLock lock(m_mutex); + return m_queue.size(); + } + +private: + Client *m_client; + std::vector m_queue; + std::set m_urgents; + std::map m_cache; + Mutex m_mutex; + + // TODO: Add callback to update these when g_settings changes + bool m_cache_enable_shaders; + bool m_cache_use_tangent_vertices; + bool m_cache_smooth_lighting; + int m_meshgen_block_cache_size; + + CachedMapBlockData* cacheBlock(Map *map, v3s16 p, UpdateMode mode, + size_t *cache_hit_counter=NULL); + CachedMapBlockData* getCachedBlock(const v3s16 &p); + void fillDataFromMapBlockCache(QueuedMeshUpdate *q); + void cleanupCache(); +}; + +struct MeshUpdateResult +{ + v3s16 p; + MapBlockMesh *mesh; + bool ack_block_to_server; + + MeshUpdateResult(): + p(-1338,-1338,-1338), + mesh(NULL), + ack_block_to_server(false) + { + } +}; + +class MeshUpdateThread : public UpdateThread +{ +public: + MeshUpdateThread(Client *client); + + // Caches the block at p and its neighbors (if needed) and queues a mesh + // update for the block at p + void updateBlock(Map *map, v3s16 p, bool ack_block_to_server, bool urgent); + + v3s16 m_camera_offset; + MutexedQueue m_queue_out; + +private: + MeshUpdateQueue m_queue_in; + + // TODO: Add callback to update these when g_settings changes + int m_generation_interval; + +protected: + virtual void doUpdate(); +}; + +#endif -- cgit v1.2.3 From db17225a976e20c6628afe70dd6b230673287b4d Mon Sep 17 00:00:00 2001 From: Louis Pearson Date: Tue, 25 Apr 2017 06:11:51 -0500 Subject: Footsteps without view bobbing (#5645) * Remove redundant view_bobbing setting Also fixes bug where disabling view_bobbing disables footstep sounds. * Removes redundant view_bobbing setting Setting view_bobbing amount to 0 is now the only way to turn view_bobbing on and off. Also fixed a bug where footstep sounds would not play when view_bobbing was disabled. --- builtin/settingtypes.txt | 5 +---- minetest.conf.example | 7 +------ po/be/minetest.po | 2 +- po/ca/minetest.po | 2 +- po/cs/minetest.po | 2 +- po/da/minetest.po | 2 +- po/de/minetest.po | 2 +- po/eo/minetest.po | 2 +- po/es/minetest.po | 2 +- po/et/minetest.po | 2 +- po/fr/minetest.po | 2 +- po/he/minetest.po | 2 +- po/hu/minetest.po | 2 +- po/id/minetest.po | 2 +- po/it/minetest.po | 2 +- po/ja/minetest.po | 2 +- po/jbo/minetest.po | 2 +- po/ko/minetest.po | 2 +- po/ky/minetest.po | 2 +- po/lt/minetest.po | 2 +- po/minetest.pot | 2 +- po/ms/minetest.po | 2 +- po/nb/minetest.po | 2 +- po/nl/minetest.po | 2 +- po/pl/minetest.po | 2 +- po/pt/minetest.po | 2 +- po/pt_BR/minetest.po | 2 +- po/ro/minetest.po | 2 +- po/ru/minetest.po | 2 +- po/sr_Cyrl/minetest.po | 2 +- po/sw/minetest.po | 2 +- po/tr/minetest.po | 2 +- po/uk/minetest.po | 2 +- po/zh_CN/minetest.po | 2 +- po/zh_TW/minetest.po | 2 +- src/camera.cpp | 9 +++------ src/camera.h | 1 - src/defaultsettings.cpp | 1 - src/settings_translation_file.cpp | 2 +- 39 files changed, 39 insertions(+), 52 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 5dc48c00e..29a96ab8e 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -492,10 +492,7 @@ cloud_height (Cloud height) int 120 # Values larger than 26 will start to produce sharp cutoffs at cloud area corners. cloud_radius (Cloud radius) int 12 -# Enables view bobbing when walking. -view_bobbing (Enable view bobbing) bool true - -# Multiplier for view bobbing. +# Enable view bobbing and amount of view bobbing. # For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double. view_bobbing_amount (View bobbing factor) float 1.0 diff --git a/minetest.conf.example b/minetest.conf.example index bdd6fd7f4..ecbadb556 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -569,11 +569,7 @@ # type: int # cloud_radius = 12 -# Enables view bobbing when walking. -# type: bool -# view_bobbing = true - -# Multiplier for view bobbing. +# Enable view bobbing and amount of view bobbing. # For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double. # type: float # view_bobbing_amount = 1.0 @@ -1815,4 +1811,3 @@ # Print the engine's profiling data in regular intervals (in seconds). 0 = disable. Useful for developers. # type: int # profiler_print_interval = 0 - diff --git a/po/be/minetest.po b/po/be/minetest.po index 2466caea7..95a39697f 100644 --- a/po/be/minetest.po +++ b/po/be/minetest.po @@ -3670,7 +3670,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" "Множнік калыхання пры праглядзе.\n" diff --git a/po/ca/minetest.po b/po/ca/minetest.po index eaf350f89..32b247ffc 100644 --- a/po/ca/minetest.po +++ b/po/ca/minetest.po @@ -3465,7 +3465,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/cs/minetest.po b/po/cs/minetest.po index c7d1720f0..917bc652b 100644 --- a/po/cs/minetest.po +++ b/po/cs/minetest.po @@ -3383,7 +3383,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/da/minetest.po b/po/da/minetest.po index b1aa649ba..c2bbd1477 100644 --- a/po/da/minetest.po +++ b/po/da/minetest.po @@ -3663,7 +3663,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/de/minetest.po b/po/de/minetest.po index a81fd0d56..ac51254cc 100644 --- a/po/de/minetest.po +++ b/po/de/minetest.po @@ -3746,7 +3746,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" "Faktor für Auf- und Abbewegung (grafischer Effekt).\n" diff --git a/po/eo/minetest.po b/po/eo/minetest.po index adf29a0b6..71dd16892 100644 --- a/po/eo/minetest.po +++ b/po/eo/minetest.po @@ -3387,7 +3387,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/es/minetest.po b/po/es/minetest.po index 72438dc26..6cd0e184e 100644 --- a/po/es/minetest.po +++ b/po/es/minetest.po @@ -3526,7 +3526,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/et/minetest.po b/po/et/minetest.po index 94c9c7207..3cde4052b 100644 --- a/po/et/minetest.po +++ b/po/et/minetest.po @@ -3403,7 +3403,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/fr/minetest.po b/po/fr/minetest.po index f3aec72a6..9d1c0331a 100644 --- a/po/fr/minetest.po +++ b/po/fr/minetest.po @@ -3709,7 +3709,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" "Facteur de mouvement de bras.\n" diff --git a/po/he/minetest.po b/po/he/minetest.po index 2e5367a9d..1b88f9111 100644 --- a/po/he/minetest.po +++ b/po/he/minetest.po @@ -3301,7 +3301,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/hu/minetest.po b/po/hu/minetest.po index a461b6a6b..b5824cc6b 100644 --- a/po/hu/minetest.po +++ b/po/hu/minetest.po @@ -3615,7 +3615,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/id/minetest.po b/po/id/minetest.po index 20464ab7a..4a3a24c48 100644 --- a/po/id/minetest.po +++ b/po/id/minetest.po @@ -3580,7 +3580,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/it/minetest.po b/po/it/minetest.po index b41f38cab..df5a7d0da 100644 --- a/po/it/minetest.po +++ b/po/it/minetest.po @@ -3720,7 +3720,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" "Moltiplicatore per l'ondeggiamento visivo.\n" diff --git a/po/ja/minetest.po b/po/ja/minetest.po index f26036749..32e01a81b 100644 --- a/po/ja/minetest.po +++ b/po/ja/minetest.po @@ -3535,7 +3535,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/jbo/minetest.po b/po/jbo/minetest.po index 12ac80a39..749d53c35 100644 --- a/po/jbo/minetest.po +++ b/po/jbo/minetest.po @@ -3348,7 +3348,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/ko/minetest.po b/po/ko/minetest.po index 9bee4ee70..34bc7ddec 100644 --- a/po/ko/minetest.po +++ b/po/ko/minetest.po @@ -3507,7 +3507,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" "화면 흔들림 멀티플라이어\n" diff --git a/po/ky/minetest.po b/po/ky/minetest.po index 72c729f8d..52704f78d 100644 --- a/po/ky/minetest.po +++ b/po/ky/minetest.po @@ -3403,7 +3403,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/lt/minetest.po b/po/lt/minetest.po index 7556e0309..c00c0df84 100644 --- a/po/lt/minetest.po +++ b/po/lt/minetest.po @@ -3383,7 +3383,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/minetest.pot b/po/minetest.pot index 46a74b448..1dddd0a71 100644 --- a/po/minetest.pot +++ b/po/minetest.pot @@ -2279,7 +2279,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/ms/minetest.po b/po/ms/minetest.po index 97f7a75f3..e53039522 100644 --- a/po/ms/minetest.po +++ b/po/ms/minetest.po @@ -2481,7 +2481,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/nb/minetest.po b/po/nb/minetest.po index 28bcb3f90..d3a8bdc67 100644 --- a/po/nb/minetest.po +++ b/po/nb/minetest.po @@ -3314,7 +3314,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/nl/minetest.po b/po/nl/minetest.po index 68e3e7b6d..be29ac829 100644 --- a/po/nl/minetest.po +++ b/po/nl/minetest.po @@ -3719,7 +3719,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" "Vermenigvuldigingsfactor van loopbeweging.\n" diff --git a/po/pl/minetest.po b/po/pl/minetest.po index 8af82c0d6..0bf0ea84f 100644 --- a/po/pl/minetest.po +++ b/po/pl/minetest.po @@ -3674,7 +3674,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/pt/minetest.po b/po/pt/minetest.po index cef144845..992d0d608 100644 --- a/po/pt/minetest.po +++ b/po/pt/minetest.po @@ -3509,7 +3509,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/pt_BR/minetest.po b/po/pt_BR/minetest.po index 76d473a96..648b13a1c 100644 --- a/po/pt_BR/minetest.po +++ b/po/pt_BR/minetest.po @@ -3711,7 +3711,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" "Multiplicador para sacudir a exibição.\n" diff --git a/po/ro/minetest.po b/po/ro/minetest.po index a9efb035f..4b0a724ea 100644 --- a/po/ro/minetest.po +++ b/po/ro/minetest.po @@ -3429,7 +3429,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/ru/minetest.po b/po/ru/minetest.po index 4406ec5a0..c3f2465a3 100644 --- a/po/ru/minetest.po +++ b/po/ru/minetest.po @@ -3628,7 +3628,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/sr_Cyrl/minetest.po b/po/sr_Cyrl/minetest.po index 0a0078f23..2d8739639 100644 --- a/po/sr_Cyrl/minetest.po +++ b/po/sr_Cyrl/minetest.po @@ -3359,7 +3359,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/sw/minetest.po b/po/sw/minetest.po index abf0da24d..b33e622aa 100644 --- a/po/sw/minetest.po +++ b/po/sw/minetest.po @@ -3644,7 +3644,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" "Mengi kwa ajili ya Mwoneko kando.\n" diff --git a/po/tr/minetest.po b/po/tr/minetest.po index 707ce11d9..5db7287d4 100644 --- a/po/tr/minetest.po +++ b/po/tr/minetest.po @@ -3477,7 +3477,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/uk/minetest.po b/po/uk/minetest.po index 0035c792f..5271f4a5d 100644 --- a/po/uk/minetest.po +++ b/po/uk/minetest.po @@ -3350,7 +3350,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/zh_CN/minetest.po b/po/zh_CN/minetest.po index 410d98082..0503513e9 100644 --- a/po/zh_CN/minetest.po +++ b/po/zh_CN/minetest.po @@ -3421,7 +3421,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" diff --git a/po/zh_TW/minetest.po b/po/zh_TW/minetest.po index 7718ae462..55716950d 100644 --- a/po/zh_TW/minetest.po +++ b/po/zh_TW/minetest.po @@ -3608,7 +3608,7 @@ msgstr "" #: src/settings_translation_file.cpp msgid "" -"Multiplier for view bobbing.\n" +"Enable view bobbing and amount of view bobbing.\n" "For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double." msgstr "" "視野晃動的倍數。\n" diff --git a/src/camera.cpp b/src/camera.cpp index 7e83dadeb..b119bbfbb 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -102,7 +102,6 @@ Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control, m_cache_view_bobbing_amount = g_settings->getFloat("view_bobbing_amount"); m_cache_fov = g_settings->getFloat("fov"); m_cache_zoom_fov = g_settings->getFloat("zoom_fov"); - m_cache_view_bobbing = g_settings->getBool("view_bobbing"); m_nametags.clear(); } @@ -280,8 +279,8 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, v3f rel_cam_target = v3f(0,0,1); v3f rel_cam_up = v3f(0,1,0); - if (m_view_bobbing_anim != 0 && m_camera_mode < CAMERA_MODE_THIRD) - { + if (m_cache_view_bobbing_amount != 0.0f && m_view_bobbing_anim != 0.0f && + m_camera_mode < CAMERA_MODE_THIRD) { f32 bobfrac = my_modf(m_view_bobbing_anim * 2); f32 bobdir = (m_view_bobbing_anim < 0.5) ? 1.0 : -1.0; @@ -467,9 +466,7 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, const bool swimming = (movement_XZ || player->swimming_vertical) && player->in_liquid; const bool climbing = movement_Y && player->is_climbing; if ((walking || swimming || climbing) && - m_cache_view_bobbing && - (!g_settings->getBool("free_move") || !m_client->checkLocalPrivilege("fly"))) - { + (!g_settings->getBool("free_move") || !m_client->checkLocalPrivilege("fly"))) { // Start animation m_view_bobbing_state = 1; m_view_bobbing_speed = MYMIN(speed.getLength(), 70); diff --git a/src/camera.h b/src/camera.h index f57efdf10..e4c1d0b25 100644 --- a/src/camera.h +++ b/src/camera.h @@ -231,7 +231,6 @@ private: f32 m_cache_view_bobbing_amount; f32 m_cache_fov; f32 m_cache_zoom_fov; - bool m_cache_view_bobbing; std::list m_nametags; }; diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 573b5e2d8..d45e386cf 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -171,7 +171,6 @@ void set_default_settings(Settings *settings) // Effects settings->setDefault("directional_colored_fog", "true"); - settings->setDefault("view_bobbing", "true"); settings->setDefault("inventory_items_animations", "false"); settings->setDefault("mip_map", "false"); settings->setDefault("anisotropic_filter", "false"); diff --git a/src/settings_translation_file.cpp b/src/settings_translation_file.cpp index d34665181..47601135d 100644 --- a/src/settings_translation_file.cpp +++ b/src/settings_translation_file.cpp @@ -242,7 +242,7 @@ fake_function() { gettext("Enable view bobbing"); gettext("Enables view bobbing when walking."); gettext("View bobbing factor"); - gettext("Multiplier for view bobbing.\nFor example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."); + gettext("Enable view bobbing and amount of view bobbing.\nFor example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."); gettext("Fall bobbing factor"); gettext("Multiplier for fall bobbing.\nFor example: 0 for no view bobbing; 1.0 for normal; 2.0 for double."); gettext("3D mode"); -- cgit v1.2.3 From 21e0a049f81eb0d34adaf45646b11569eeadec52 Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Fri, 5 May 2017 13:47:11 +0200 Subject: Save minetest screen width/height options when modified (#5683) * Save minetest screen width/height options when modified * Add autosave_screensize setting (default true) * Fix @SmallJoker comments --- builtin/mainmenu/tab_settings.lua | 9 ++++++++- builtin/settingtypes.txt | 3 +++ minetest.conf.example | 4 ++++ src/defaultsettings.cpp | 1 + src/game.cpp | 16 ++++++++++++++++ src/guiEngine.cpp | 20 ++++++++++++++++++-- 6 files changed, 50 insertions(+), 3 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/builtin/mainmenu/tab_settings.lua b/builtin/mainmenu/tab_settings.lua index e59572a41..8a97d8334 100644 --- a/builtin/mainmenu/tab_settings.lua +++ b/builtin/mainmenu/tab_settings.lua @@ -190,7 +190,7 @@ local function formspec(tabview, name, tabdata) .. getSettingIndex.NodeHighlighting() .. "]" .. "dropdown[0.25,3.6;3.3;dd_leaves_style;" .. dd_options.leaves[1] .. ";" .. getSettingIndex.Leaves() .. "]" .. - "box[3.75,0;3.75,3.45;#999999]" .. + "box[3.75,0;3.75,4.45;#999999]" .. "label[3.85,0.1;" .. fgettext("Texturing:") .. "]" .. "dropdown[3.85,0.55;3.85;dd_filters;" .. dd_options.filters[1] .. ";" .. getSettingIndex.Filter() .. "]" .. @@ -199,6 +199,9 @@ local function formspec(tabview, name, tabdata) "label[3.85,2.15;" .. fgettext("Antialiasing:") .. "]" .. "dropdown[3.85,2.6;3.85;dd_antialiasing;" .. dd_options.antialiasing[1] .. ";" .. getSettingIndex.Antialiasing() .. "]" .. + "label[3.85,3.45;" .. fgettext("Screen:") .. "]" .. + "checkbox[3.85,3.6;cb_autosave_screensize;" .. fgettext("Autosave screen size") .. ";" + .. dump(core.setting_getbool("autosave_screensize")) .. "]" .. "box[7.75,0;4,4.4;#999999]" .. "checkbox[8,0;cb_shaders;" .. fgettext("Shaders") .. ";" .. dump(core.setting_getbool("enable_shaders")) .. "]" @@ -290,6 +293,10 @@ local function handle_settings_buttons(this, fields, tabname, tabdata) core.setting_set("connected_glass", fields["cb_connected_glass"]) return true end + if fields["cb_autosave_screensize"] then + core.setting_set("autosave_screensize", fields["cb_autosave_screensize"]) + return true + end if fields["cb_shaders"] then if (core.setting_get("video_driver") == "direct3d8" or core.setting_get("video_driver") == "direct3d9") then diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 29a96ab8e..4b82a1e0e 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -459,6 +459,9 @@ screenW (Screen width) int 800 # Height component of the initial window size. screenH (Screen height) int 600 +# Save window size automatically when modified. +autosave_screensize (Autosave Screen Size) bool true + # Fullscreen mode. fullscreen (Full screen) bool false diff --git a/minetest.conf.example b/minetest.conf.example index ecbadb556..b9efc432a 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -526,6 +526,10 @@ # type: int # screenH = 600 +# Save the window size automatically when modified. +# type: bool +# autosave_screensize = true + # Fullscreen mode. # type: bool # fullscreen = false diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index d45e386cf..434c887e8 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -121,6 +121,7 @@ void set_default_settings(Settings *settings) settings->setDefault("viewing_range", "100"); settings->setDefault("screenW", "800"); settings->setDefault("screenH", "600"); + settings->setDefault("autosave_screensize", "true"); settings->setDefault("fullscreen", "false"); settings->setDefault("fullscreen_bpp", "24"); settings->setDefault("vsync", "false"); diff --git a/src/game.cpp b/src/game.cpp index be0cc8fd5..ace647456 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1629,10 +1629,26 @@ void Game::run() && client->checkPrivilege("fast"); #endif + irr::core::dimension2d previous_screen_size(g_settings->getU16("screenW"), + g_settings->getU16("screenH")); + while (device->run() && !(*kill || g_gamecallback->shutdown_requested || (server && server->getShutdownRequested()))) { + const irr::core::dimension2d ¤t_screen_size = + device->getVideoDriver()->getScreenSize(); + // Verify if window size has changed and save it if it's the case + // Ensure evaluating settings->getBool after verifying screensize + // First condition is cheaper + if (previous_screen_size != current_screen_size && + current_screen_size != irr::core::dimension2d(0,0) && + g_settings->getBool("autosave_screensize")) { + g_settings->setU16("screenW", current_screen_size.Width); + g_settings->setU16("screenH", current_screen_size.Height); + previous_screen_size = current_screen_size; + } + /* Must be called immediately after a device->run() call because it * uses device->getTimer()->getTime() */ diff --git a/src/guiEngine.cpp b/src/guiEngine.cpp index ebc4aac44..2d1bd6d44 100644 --- a/src/guiEngine.cpp +++ b/src/guiEngine.cpp @@ -262,8 +262,24 @@ void GUIEngine::run() unsigned int text_height = g_fontengine->getTextHeight(); - while(m_device->run() && (!m_startgame) && (!m_kill)) - { + irr::core::dimension2d previous_screen_size(g_settings->getU16("screenW"), + g_settings->getU16("screenH")); + + while (m_device->run() && (!m_startgame) && (!m_kill)) { + + const irr::core::dimension2d ¤t_screen_size = + m_device->getVideoDriver()->getScreenSize(); + // Verify if window size has changed and save it if it's the case + // Ensure evaluating settings->getBool after verifying screensize + // First condition is cheaper + if (previous_screen_size != current_screen_size && + current_screen_size != irr::core::dimension2d(0,0) && + g_settings->getBool("autosave_screensize")) { + g_settings->setU16("screenW", current_screen_size.Width); + g_settings->setU16("screenH", current_screen_size.Height); + previous_screen_size = current_screen_size; + } + //check if we need to update the "upper left corner"-text if (text_height != g_fontengine->getTextHeight()) { updateTopLeftTextSize(); -- cgit v1.2.3 From 07c17db11450f235b67895ce39a5aef67458107d Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 3 Jul 2014 07:46:19 +0200 Subject: Add configurable key bindings for hotbar scrolling, and for changing volume. --- builtin/settingtypes.txt | 20 ++++++++++++++++++++ minetest.conf.example | 25 +++++++++++++++++++++++++ src/client/keys.h | 5 +++++ src/defaultsettings.cpp | 5 +++++ src/game.cpp | 35 +++++++++++++++++++++++++++++++++-- src/guiKeyChangeMenu.cpp | 24 ++++++++++++++++++------ src/settings_translation_file.cpp | 10 ++++++++++ 7 files changed, 116 insertions(+), 8 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 4b82a1e0e..61c04e616 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -186,6 +186,26 @@ keymap_fastmove (Fast key) key KEY_KEY_J # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_noclip (Noclip key) key KEY_KEY_H +# Key for selecting the next item in the hotbar. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_hotbar_next (Hotbar next key) key KEY_KEY_N + +# Key for selecting the previous item in the hotbar. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_hotbar_previous (Hotbar previous key) key KEY_KEY_B + +# Key for muting the game. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_mute (Mute key) key KEY_KEY_M + +# Key for increasing the volume. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_increase_volume (Inc. volume key) key + +# Key for decreasing the volume. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +keymap_decrease_volume (Dec. volume key) key + # Key for toggling autorun. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 keymap_autorun (Autorun key) key diff --git a/minetest.conf.example b/minetest.conf.example index b9efc432a..6c6ce91b8 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -186,6 +186,31 @@ # type: key # keymap_noclip = KEY_KEY_H +# Key for selecting the next item in the hotbar. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +# type: key +# keymap_hotbar_next = KEY_KEY_N + +# Key for selecting the previous item in the hotbar. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +# type: key +# keymap_hotbar_previous = KEY_KEY_B + +# Key for muting the game. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +# type: key +# keymap_mute = KEY_KEY_M + +# Key for increasing the volume. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +# type: key +# keymap_increase_volume = + +# Key for decreasing the volume. +# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 +# type: key +# keymap_decrease_volume = + # Key for toggling autorun. # See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3 # type: key diff --git a/src/client/keys.h b/src/client/keys.h index 76ae38ff0..9478737f6 100644 --- a/src/client/keys.h +++ b/src/client/keys.h @@ -50,6 +50,11 @@ public: FREEMOVE, FASTMOVE, NOCLIP, + HOTBAR_PREV, + HOTBAR_NEXT, + MUTE, + INC_VOLUME, + DEC_VOLUME, CINEMATIC, SCREENSHOT, TOGGLE_HUD, diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 434c887e8..c583220bd 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -80,6 +80,11 @@ void set_default_settings(Settings *settings) settings->setDefault("keymap_freemove", "KEY_KEY_K"); settings->setDefault("keymap_fastmove", "KEY_KEY_J"); settings->setDefault("keymap_noclip", "KEY_KEY_H"); + settings->setDefault("keymap_hotbar_next", "KEY_KEY_N"); + settings->setDefault("keymap_hotbar_previous", "KEY_KEY_B"); + settings->setDefault("keymap_mute", "KEY_KEY_M"); + settings->setDefault("keymap_increase_volume", ""); + settings->setDefault("keymap_decrease_volume", ""); settings->setDefault("keymap_cinematic", ""); settings->setDefault("keymap_toggle_hud", "KEY_F1"); settings->setDefault("keymap_toggle_chat", "KEY_F2"); diff --git a/src/game.cpp b/src/game.cpp index 61282b463..9de473231 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1049,6 +1049,11 @@ void KeyCache::populate() key[KeyType::FREEMOVE] = getKeySetting("keymap_freemove"); key[KeyType::FASTMOVE] = getKeySetting("keymap_fastmove"); key[KeyType::NOCLIP] = getKeySetting("keymap_noclip"); + key[KeyType::HOTBAR_PREV] = getKeySetting("keymap_hotbar_previous"); + key[KeyType::HOTBAR_NEXT] = getKeySetting("keymap_hotbar_next"); + key[KeyType::MUTE] = getKeySetting("keymap_mute"); + key[KeyType::INC_VOLUME] = getKeySetting("keymap_increase_volume"); + key[KeyType::DEC_VOLUME] = getKeySetting("keymap_decrease_volume"); key[KeyType::CINEMATIC] = getKeySetting("keymap_cinematic"); key[KeyType::SCREENSHOT] = getKeySetting("keymap_screenshot"); key[KeyType::TOGGLE_HUD] = getKeySetting("keymap_toggle_hud"); @@ -2493,6 +2498,30 @@ void Game::processKeyInput() toggleFast(); } else if (wasKeyDown(KeyType::NOCLIP)) { toggleNoClip(); + } else if (wasKeyDown(KeyType::MUTE)) { + float volume = g_settings->getFloat("sound_volume"); + if (volume < 0.001f) { + g_settings->setFloat("sound_volume", 1.0f); + m_statustext = narrow_to_wide(gettext("Volume changed to 100%")); + } else { + g_settings->setFloat("sound_volume", 0.0f); + m_statustext = narrow_to_wide(gettext("Volume changed to 0%")); + } + runData.statustext_time = 0; + } else if (wasKeyDown(KeyType::INC_VOLUME)) { + float new_volume = rangelim(g_settings->getFloat("sound_volume") + 0.1f, 0.0f, 1.0f); + char buf[100]; + g_settings->setFloat("sound_volume", new_volume); + snprintf(buf, sizeof(buf), gettext("Volume changed to %d%%"), myround(new_volume * 100)); + m_statustext = narrow_to_wide(buf); + runData.statustext_time = 0; + } else if (wasKeyDown(KeyType::DEC_VOLUME)) { + float new_volume = rangelim(g_settings->getFloat("sound_volume") - 0.1f, 0.0f, 1.0f); + char buf[100]; + g_settings->setFloat("sound_volume", new_volume); + snprintf(buf, sizeof(buf), gettext("Volume changed to %d%%"), myround(new_volume * 100)); + m_statustext = narrow_to_wide(buf); + runData.statustext_time = 0; } else if (wasKeyDown(KeyType::CINEMATIC)) { toggleCinematic(); } else if (wasKeyDown(KeyType::SCREENSHOT)) { @@ -2560,11 +2589,13 @@ void Game::processItemSelection(u16 *new_playeritem) s32 dir = wheel; - if (input->joystick.wasKeyDown(KeyType::SCROLL_DOWN)) { + if (input->joystick.wasKeyDown(KeyType::SCROLL_DOWN) || + wasKeyDown(KeyType::HOTBAR_NEXT)) { dir = -1; } - if (input->joystick.wasKeyDown(KeyType::SCROLL_UP)) { + if (input->joystick.wasKeyDown(KeyType::SCROLL_UP) || + wasKeyDown(KeyType::HOTBAR_PREV)) { dir = 1; } diff --git a/src/guiKeyChangeMenu.cpp b/src/guiKeyChangeMenu.cpp index e85ee8271..ae53c56f9 100644 --- a/src/guiKeyChangeMenu.cpp +++ b/src/guiKeyChangeMenu.cpp @@ -58,6 +58,11 @@ enum GUI_ID_KEY_SNEAK_BUTTON, GUI_ID_KEY_DROP_BUTTON, GUI_ID_KEY_INVENTORY_BUTTON, + GUI_ID_KEY_HOTBAR_PREV_BUTTON, + GUI_ID_KEY_HOTBAR_NEXT_BUTTON, + GUI_ID_KEY_MUTE_BUTTON, + GUI_ID_KEY_DEC_VOLUME_BUTTON, + GUI_ID_KEY_INC_VOLUME_BUTTON, GUI_ID_KEY_DUMP_BUTTON, GUI_ID_KEY_RANGE_BUTTON, GUI_ID_KEY_ZOOM_BUTTON, @@ -109,7 +114,7 @@ void GUIKeyChangeMenu::removeChildren() void GUIKeyChangeMenu::regenerateGui(v2u32 screensize) { removeChildren(); - v2s32 size(620, 430); + v2s32 size(745, 430); core::rect < s32 > rect(screensize.X / 2 - size.X / 2, screensize.Y / 2 - size.Y / 2, screensize.X / 2 + size.X / 2, @@ -146,15 +151,17 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize) { core::rect < s32 > rect(0, 0, 100, 30); - rect += topleft + v2s32(offset.X + 115, offset.Y - 5); + rect += topleft + v2s32(offset.X + 120, offset.Y - 5); const wchar_t *text = wgettext(k->key.name()); k->button = Environment->addButton(rect, this, k->id, text); delete[] text; } - if(i + 1 == KMaxButtonPerColumns) - offset = v2s32(260, 60); - else + if ((i + 1) % KMaxButtonPerColumns == 0) { + offset.X += 230; + offset.Y = 60; + } else { offset += v2s32(0, 25); + } } { @@ -215,7 +222,7 @@ void GUIKeyChangeMenu::drawMenu() video::SColor bgcolor(140, 0, 0, 0); { - core::rect < s32 > rect(0, 0, 620, 620); + core::rect < s32 > rect(0, 0, 745, 620); rect += AbsoluteRect.UpperLeftCorner; driver->draw2DRectangle(bgcolor, rect, &AbsoluteClippingRect); } @@ -407,6 +414,11 @@ void GUIKeyChangeMenu::init_keys() this->add_key(GUI_ID_KEY_SNEAK_BUTTON, wgettext("Sneak"), "keymap_sneak"); this->add_key(GUI_ID_KEY_DROP_BUTTON, wgettext("Drop"), "keymap_drop"); this->add_key(GUI_ID_KEY_INVENTORY_BUTTON, wgettext("Inventory"), "keymap_inventory"); + this->add_key(GUI_ID_KEY_HOTBAR_PREV_BUTTON,wgettext("Prev. item"), "keymap_hotbar_previous"); + this->add_key(GUI_ID_KEY_HOTBAR_NEXT_BUTTON,wgettext("Next item"), "keymap_hotbar_next"); + this->add_key(GUI_ID_KEY_MUTE_BUTTON, wgettext("Mute"), "keymap_mute"); + this->add_key(GUI_ID_KEY_DEC_VOLUME_BUTTON,wgettext("Dec. volume"), "keymap_decrease_volume"); + this->add_key(GUI_ID_KEY_INC_VOLUME_BUTTON,wgettext("Inc. volume"), "keymap_increase_volume"); this->add_key(GUI_ID_KEY_CHAT_BUTTON, wgettext("Chat"), "keymap_chat"); this->add_key(GUI_ID_KEY_CMD_BUTTON, wgettext("Command"), "keymap_cmd"); this->add_key(GUI_ID_KEY_CMD_LOCAL_BUTTON, wgettext("Local command"), "keymap_cmd_local"); diff --git a/src/settings_translation_file.cpp b/src/settings_translation_file.cpp index 47601135d..383da33a7 100644 --- a/src/settings_translation_file.cpp +++ b/src/settings_translation_file.cpp @@ -77,6 +77,16 @@ fake_function() { gettext("Key for toggling fast mode.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3"); gettext("Noclip key"); gettext("Key for toggling noclip mode.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3"); + gettext("Hotbar next key"); + gettext("Key for selecting the next item in the hotbar.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3"); + gettext("Hotbar previous key"); + gettext("Key for selecting the previous item in the hotbar.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3"); + gettext("Mute key"); + gettext("Key for muting the game.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3"); + gettext("Inc. volume key"); + gettext("Key for increasing the volume.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3"); + gettext("Dec. volume key"); + gettext("Key for decreasing the volume.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3"); gettext("Autorun key"); gettext("Key for toggling autorun.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3"); gettext("Cinematic mode key"); -- cgit v1.2.3 From 39f4a2f607d44738d60db84eba4b30e3d7450204 Mon Sep 17 00:00:00 2001 From: Pierre-Adrien Langrognet Date: Sun, 21 May 2017 23:06:51 +0200 Subject: [CSM] Add send_chat_message and run_server_chatcommand API functions (#5747) * [CSM] Add send_chat_message and run_server_chatcommand API functions * Add client-side chat message rate limiting * Limit out chat queue size * [CSM] Add minetest.clear_out_chat_queue API function and .clear_chat_queue chatcommand * Last fixes/cleanups before merge --- builtin/client/chatcommands.lua | 12 +++++++++ builtin/settingtypes.txt | 3 +++ doc/client_lua_api.md | 10 ++++++-- minetest.conf.example | 4 +++ src/client.cpp | 54 ++++++++++++++++++++++++++++++++++++++--- src/client.h | 8 ++++++ src/defaultsettings.cpp | 1 + src/script/lua_api/l_client.cpp | 19 +++++++++++++++ src/script/lua_api/l_client.h | 6 +++++ 9 files changed, 111 insertions(+), 6 deletions(-) (limited to 'src/defaultsettings.cpp') diff --git a/builtin/client/chatcommands.lua b/builtin/client/chatcommands.lua index f425216f5..2b8cc4acd 100644 --- a/builtin/client/chatcommands.lua +++ b/builtin/client/chatcommands.lua @@ -51,3 +51,15 @@ core.register_chatcommand("disconnect", { core.disconnect() end, }) + +core.register_chatcommand("clear_chat_queue", { + description = core.gettext("Clear the out chat queue"), + func = function(param) + core.clear_out_chat_queue() + return true, core.gettext("The out chat queue is now empty") + end, +}) + +function core.run_server_chatcommand(cmd, param) + core.send_chat_message("/" .. cmd .. " " .. param) +end diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 463ca0be9..0ec33c628 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -312,6 +312,9 @@ serverlist_url (Serverlist URL) string servers.minetest.net # File in client/serverlist/ that contains your favorite servers displayed in the Multiplayer Tab. serverlist_file (Serverlist file) string favoriteservers.txt +# Maximum size of the out chat queue. 0 to disable queueing and -1 to make the queue size unlimited +max_out_chat_queue_size (Maximum size of the out chat queue) int 20 + [*Graphics] [**In-Game] diff --git a/doc/client_lua_api.md b/doc/client_lua_api.md index ce0746df4..b3e494cc1 100644 --- a/doc/client_lua_api.md +++ b/doc/client_lua_api.md @@ -721,6 +721,12 @@ Call these functions only at load time! ### Player * `minetest.get_wielded_item()` * Returns the itemstack the local player is holding +* `minetest.send_chat_message(message)` + * Act as if `message` was typed by the player into the terminal. +* `minetest.run_server_chatcommand(cmd, param)` + * Alias for `minetest.send_chat_message("/" .. cmd .. " " .. param)` +* `minetest.clear_out_chat_queue()` + * Clears the out chat queue * `minetest.localplayer` * Reference to the LocalPlayer object. See [`LocalPlayer`](#localplayer) class reference for methods. @@ -836,7 +842,7 @@ Please do not try to access the reference until the camera is initialized, other * Returns with same syntax as above * `get_fov()` * Returns: - + ```lua { x = number, @@ -845,7 +851,7 @@ Please do not try to access the reference until the camera is initialized, other actual = number } ``` - + * `get_pos()` * Returns position of camera with view bobbing * `get_offset()` diff --git a/minetest.conf.example b/minetest.conf.example index e9add1597..5e1609de6 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -343,6 +343,10 @@ # type: string # serverlist_file = favoriteservers.txt +# Maximum size of the out chat queue. 0 to disable queueing and -1 to make the queue size unlimited +# type: int min: -1 +max_out_chat_queue_size = 20 + ## Graphics ### In-Game diff --git a/src/client.cpp b/src/client.cpp index a36f5413f..a5228132d 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -104,6 +104,8 @@ Client::Client( m_animation_time(0), m_crack_level(-1), m_crack_pos(0,0,0), + m_last_chat_message_sent(time(NULL)), + m_chat_message_allowance(5.0f), m_map_seed(0), m_password(password), m_chosen_auth_mech(AUTH_MECHANISM_NONE), @@ -400,6 +402,14 @@ void Client::step(float dtime) } } + /* + Send pending messages on out chat queue + */ + if (!m_out_chat_queue.empty() && canSendChatMessage()) { + sendChatMessage(m_out_chat_queue.front()); + m_out_chat_queue.pop(); + } + /* Handle environment */ @@ -1158,13 +1168,50 @@ void Client::sendInventoryAction(InventoryAction *a) Send(&pkt); } +bool Client::canSendChatMessage() const +{ + u32 now = time(NULL); + float time_passed = now - m_last_chat_message_sent; + + float virt_chat_message_allowance = m_chat_message_allowance + time_passed * + (CLIENT_CHAT_MESSAGE_LIMIT_PER_10S / 8.0f); + + if (virt_chat_message_allowance < 1.0f) + return false; + + return true; +} + void Client::sendChatMessage(const std::wstring &message) { - NetworkPacket pkt(TOSERVER_CHAT_MESSAGE, 2 + message.size() * sizeof(u16)); + const s16 max_queue_size = g_settings->getS16("max_out_chat_queue_size"); + if (canSendChatMessage()) { + u32 now = time(NULL); + float time_passed = now - m_last_chat_message_sent; + m_last_chat_message_sent = time(NULL); - pkt << message; + m_chat_message_allowance += time_passed * (CLIENT_CHAT_MESSAGE_LIMIT_PER_10S / 8.0f); + if (m_chat_message_allowance > CLIENT_CHAT_MESSAGE_LIMIT_PER_10S) + m_chat_message_allowance = CLIENT_CHAT_MESSAGE_LIMIT_PER_10S; - Send(&pkt); + m_chat_message_allowance -= 1.0f; + + NetworkPacket pkt(TOSERVER_CHAT_MESSAGE, 2 + message.size() * sizeof(u16)); + + pkt << message; + + Send(&pkt); + } else if (m_out_chat_queue.size() < (u16) max_queue_size || max_queue_size == -1) { + m_out_chat_queue.push(message); + } else { + infostream << "Could not queue chat message because maximum out chat queue size (" + << max_queue_size << ") is reached." << std::endl; + } +} + +void Client::clearOutChatQueue() +{ + m_out_chat_queue = std::queue(); } void Client::sendChangePassword(const std::string &oldpassword, @@ -1924,4 +1971,3 @@ std::string Client::getModStoragePath() const { return porting::path_user + DIR_DELIM + "client" + DIR_DELIM + "mod_storage"; } - diff --git a/src/client.h b/src/client.h index cc0d4699d..b4145c76f 100644 --- a/src/client.h +++ b/src/client.h @@ -38,6 +38,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "tileanimation.h" #include "mesh_generator_thread.h" +#define CLIENT_CHAT_MESSAGE_LIMIT_PER_10S 10.0f + struct MeshMakeData; class MapBlockMesh; class IWritableTextureSource; @@ -360,6 +362,7 @@ public: const StringMap &fields); void sendInventoryAction(InventoryAction *a); void sendChatMessage(const std::wstring &message); + void clearOutChatQueue(); void sendChangePassword(const std::string &oldpassword, const std::string &newpassword); void sendDamage(u8 damage); @@ -565,6 +568,8 @@ private: inline std::string getPlayerName() { return m_env.getLocalPlayer()->getName(); } + bool canSendChatMessage() const; + float m_packetcounter_timer; float m_connection_reinit_timer; float m_avg_rtt_timer; @@ -612,6 +617,9 @@ private: //s32 m_daynight_i; //u32 m_daynight_ratio; std::queue m_chat_queue; + std::queue m_out_chat_queue; + u32 m_last_chat_message_sent; + float m_chat_message_allowance; // The authentication methods we can use to enter sudo mode (=change password) u32 m_sudo_auth_methods; diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index c583220bd..0a44069fd 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -57,6 +57,7 @@ void set_default_settings(Settings *settings) settings->setDefault("curl_verify_cert", "true"); settings->setDefault("enable_remote_media_server", "true"); settings->setDefault("enable_client_modding", "false"); + settings->setDefault("max_out_chat_queue_size", "20"); // Keymap settings->setDefault("remote_port", "30000"); diff --git a/src/script/lua_api/l_client.cpp b/src/script/lua_api/l_client.cpp index 09b832ccf..0b7450af2 100644 --- a/src/script/lua_api/l_client.cpp +++ b/src/script/lua_api/l_client.cpp @@ -85,6 +85,23 @@ int ModApiClient::l_display_chat_message(lua_State *L) return 1; } +// send_chat_message(message) +int ModApiClient::l_send_chat_message(lua_State *L) +{ + if (!lua_isstring(L,1)) + return 0; + std::string message = luaL_checkstring(L, 1); + getClient(L)->sendChatMessage(utf8_to_wide(message)); + return 0; +} + +// clear_out_chat_queue() +int ModApiClient::l_clear_out_chat_queue(lua_State *L) +{ + getClient(L)->clearOutChatQueue(); + return 0; +} + // get_player_names() int ModApiClient::l_get_player_names(lua_State *L) { @@ -317,6 +334,8 @@ void ModApiClient::Initialize(lua_State *L, int top) API_FCT(get_current_modname); API_FCT(print); API_FCT(display_chat_message); + API_FCT(send_chat_message); + API_FCT(clear_out_chat_queue); API_FCT(get_player_names); API_FCT(set_last_run_mod); API_FCT(get_last_run_mod); diff --git a/src/script/lua_api/l_client.h b/src/script/lua_api/l_client.h index 09b74addd..fe5780fb1 100644 --- a/src/script/lua_api/l_client.h +++ b/src/script/lua_api/l_client.h @@ -37,6 +37,12 @@ private: // display_chat_message(message) static int l_display_chat_message(lua_State *L); + // send_chat_message(message) + static int l_send_chat_message(lua_State *L); + + // clear_out_chat_queue() + static int l_clear_out_chat_queue(lua_State *L); + // get_player_names() static int l_get_player_names(lua_State *L); -- cgit v1.2.3