diff --git a/README.md b/README.md index 14408bbf4..f3ffa6c57 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ MultiCraft Open Source is a free open-source voxel game engine with easy modding MultiCraft is based on the Minetest project, which is developed by a [number of contributors](https://github.com/minetest/minetest/graphs/contributors). -Copyright © 2014-2021 Maksim Gamarnik [MoNTE48] & MultiCraft Development Team. +Copyright © 2014-2022 Maksim Gamarnik [MoNTE48] & MultiCraft Development Team. Table of Contents ------------------ diff --git a/builtin/game/sscsm/client.lua b/builtin/game/sscsm/client.lua index 89c2a5c4d..fc65569fc 100644 --- a/builtin/game/sscsm/client.lua +++ b/builtin/game/sscsm/client.lua @@ -327,7 +327,7 @@ core.register_on_receiving_chat_message(function(message) for _, func in ipairs(callbacks) do local ok, err = pcall(func, msg) if not ok then - core.log('error', '[SSCSM] ' .. tostring(err)) + sscsm.com_send("sscsm:error", tostring(err)) end end return true diff --git a/builtin/mainmenu/tab_settings_simple.lua b/builtin/mainmenu/tab_settings_simple.lua index 7a6b7ffbf..082c9d04b 100644 --- a/builtin/mainmenu/tab_settings_simple.lua +++ b/builtin/mainmenu/tab_settings_simple.lua @@ -48,6 +48,7 @@ local function formspec(tabview, name, tabdata) local range = tonumber(core.settings:get("viewing_range")) local sensitivity = tonumber(core.settings:get("mouse_sensitivity")) * 2000 local touchtarget = core.settings:get_bool("touchtarget") or false + local fancy_leaves = core.settings:get("leaves_style") == "fancy" local sound = tonumber(core.settings:get("sound_volume")) ~= 0 and true or false local tab_string = @@ -67,7 +68,7 @@ local function formspec(tabview, name, tabdata) "checkbox[0.25,2.3;cb_inventory_items_animations;" .. fgettext("Inv. animations") .. ";" .. dump(core.settings:get_bool("inventory_items_animations")) .. "]" .. "checkbox[0.25,2.9;cb_fancy_leaves;" .. fgettext("Fancy Leaves") .. ";" - .. dump(sound) .. "]" .. + .. dump(fancy_leaves) .. "]" .. "checkbox[0.25,3.5;cb_touchtarget;" .. fgettext("Touchtarget") .. ";" .. dump(touchtarget) .. "]" .. "checkbox[0.25,4.1;cb_sound;" .. fgettext("Sound") .. ";" @@ -141,9 +142,6 @@ end -------------------------------------------------------------------------------- local function handle_settings_buttons(this, fields, tabname, tabdata) - -- Note dropdowns have to be handled LAST! - local ddhandled = false - --[[if fields["btn_advanced_settings"] ~= nil then local adv_settings_dlg = create_adv_settings_dlg() adv_settings_dlg:set_parent(this) @@ -180,8 +178,8 @@ local function handle_settings_buttons(this, fields, tabname, tabdata) return true end if fields["cb_fancy_leaves"] then - core.settings:set("dd_leaves_style", fields["cb_fancy_leaves"] and "fancy" or "opaque") - ddhandled = true + core.settings:set("leaves_style", fields["cb_fancy_leaves"] and "fancy" or "opaque") + return true end if fields["cb_touchtarget"] then core.settings:set("touchtarget", fields["cb_touchtarget"]) @@ -215,6 +213,9 @@ local function handle_settings_buttons(this, fields, tabname, tabdata) return true end]] + -- Note dropdowns have to be handled LAST! + local ddhandled = false + if fields["cb_touchscreen_target"] then core.settings:set("touchtarget", fields["cb_touchscreen_target"]) ddhandled = true diff --git a/misc/multicraft-icon.ico b/misc/multicraft-icon.ico index daba9bc1b..594417261 100644 Binary files a/misc/multicraft-icon.ico and b/misc/multicraft-icon.ico differ diff --git a/misc/multicraft-xorg-icon-128.png b/misc/multicraft-xorg-icon-128.png index 9faad9de3..ab8eb23de 100644 Binary files a/misc/multicraft-xorg-icon-128.png and b/misc/multicraft-xorg-icon-128.png differ diff --git a/po/ru/minetest.po b/po/ru/minetest.po index 7c46a625b..277dfb041 100644 --- a/po/ru/minetest.po +++ b/po/ru/minetest.po @@ -5303,7 +5303,7 @@ msgstr "Максимальное количество пакетов за ите #: src/settings_translation_file.cpp msgid "Maximum FPS" -msgstr "Максимум кадровой частоты (FPS)" +msgstr "Максимальный FPS" #: src/settings_translation_file.cpp msgid "Maximum FPS when the window is not focused, or when the game is paused." diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp index fa6b8dd17..3633aaf96 100644 --- a/src/client/clientlauncher.cpp +++ b/src/client/clientlauncher.cpp @@ -38,14 +38,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #if USE_SOUND #include "sound_openal.h" #endif -#ifdef __IOS__ -namespace irr { - class CIrrDeviceiOS : public IrrlichtDevice { - public: - void *getViewController(); - }; -} -#endif /* mainmenumanager.h */ diff --git a/src/client/game.cpp b/src/client/game.cpp index 72d0e238c..f3bce9614 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -692,7 +692,7 @@ public: void pauseGame(); #endif #ifdef __IOS__ - void customStatustext(const std::wstring &text, float time); + void customStatustext(const std::wstring &text); #endif protected: @@ -1108,17 +1108,6 @@ void Game::run() while (RenderingEngine::run() && !(*kill || g_gamecallback->shutdown_requested || (server && server->isShutdownRequested()))) { -#if defined(__MACH__) && defined(__APPLE__) && !defined(__IOS__) - if (!device->isWindowFocused()) { - sleep_ms(50); - continue; - } -#elif defined(__ANDROID__) || defined(__IOS__) - if (device->isWindowMinimized()) { - sleep_ms(50); - continue; - } -#endif const irr::core::dimension2d ¤t_screen_size = RenderingEngine::get_video_driver()->getScreenSize(); @@ -1138,6 +1127,20 @@ void Game::run() // + Sleep time until the wanted FPS are reached limitFps(&draw_times, &dtime); +#if defined(__MACH__) && defined(__APPLE__) && !defined(__IOS__) + if (!device->isWindowFocused()) { + if (m_does_lost_focus_pause_game && !isMenuActive()) + showPauseMenu(); + sleep_ms(50); + continue; + } +#elif defined(__ANDROID__) || defined(__IOS__) + if (device->isWindowMinimized()) { + sleep_ms(50); + continue; + } +#endif + // Prepare render data for next iteration updateStats(&stats, draw_times, dtime); @@ -1197,7 +1200,7 @@ void Game::shutdown() g_touchscreengui->hide(); #endif - showOverlayMessage(N_("Shutting down..."), 0, 0, false); + showOverlayMessage(N_("Shutting down..."), 0, 0); if (clouds) clouds->drop(); @@ -2558,19 +2561,6 @@ void Game::updatePlayerControl(const CameraOrientation &cam) inline void Game::step(f32 *dtime) { -#if defined(__ANDROID__) || defined(__IOS__) - if (g_menumgr.pausesGame()) { - runData.pause_game_timer += *dtime; - float disconnect_time = 180.0f; -#ifdef __IOS__ - disconnect_time = simple_singleplayer_mode ? 60.0f : 120.0f; -#endif - if (runData.pause_game_timer > disconnect_time) { - g_gamecallback->disconnect(); - return; - } - } -#endif bool can_be_and_is_paused = (simple_singleplayer_mode && g_menumgr.pausesGame()); @@ -4145,7 +4135,8 @@ inline void Game::limitFps(FpsControl *fps_timings, f32 *dtime) #endif #if defined(__MACH__) && defined(__APPLE__) && !defined(__IOS__) // FPS limiting causes freezes on macOS - frametime_min = 0; + if (!g_menumgr.pausesGame()) + frametime_min = 0; #endif if (fps_timings->busy_time < frametime_min) { @@ -4170,6 +4161,20 @@ inline void Game::limitFps(FpsControl *fps_timings, f32 *dtime) *dtime = 0; fps_timings->last_time = time; + +#if defined(__ANDROID__) || defined(__IOS__) + if (g_menumgr.pausesGame()) { + runData.pause_game_timer += *dtime; + float disconnect_time = 180.0f; +#ifdef __IOS__ + disconnect_time = simple_singleplayer_mode ? 60.0f : 120.0f; +#endif + if (runData.pause_game_timer > disconnect_time) { + g_gamecallback->disconnect(); + return; + } + } +#endif } void Game::showOverlayMessage(const char *msg, float dtime, int percent, bool draw_clouds) @@ -4226,13 +4231,9 @@ void Game::pauseGame() #endif #ifdef __IOS__ -void Game::customStatustext(const std::wstring &text, float time) +void Game::customStatustext(const std::wstring &text) { - m_statustext = text; - if (m_statustext == L"") - runData.statustext_time = 0; - else - runData.statustext_time = time; + m_game_ui->showStatusText(text); } #endif @@ -4339,14 +4340,14 @@ void Game::showPauseMenu() str_formspec_escape(control_text); #endif -#ifndef __IOS__ float ypos = simple_singleplayer_mode ? 0.7f : 0.1f; -#else - float ypos = 1.5f; +#if __IOS__ + ypos += 0.5f; #endif std::ostringstream os; os << "formspec_version[1]" << SIZE_TAG + << "no_prepend[]" << "bgcolor[#00000060;true]" << "button_exit[3.5," << (ypos++) << ";4,0.5;btn_continue;" << strgettext("Continue") << "]"; @@ -4368,8 +4369,10 @@ void Game::showPauseMenu() #endif os << "button_exit[3.5," << (ypos++) << ";4,0.5;btn_exit_menu;" << strgettext("Exit to Menu") << "]"; +#ifndef __IOS__ os << "button_exit[3.5," << (ypos++) << ";4,0.5;btn_exit_os;" << strgettext("Exit to OS") << "]" +#endif /* << "textarea[7.5,0.25;3.9,6.25;;" << control_text << ";]" << "textarea[0.4,0.25;3.9,6.25;;" << PROJECT_NAME_C " " VERSION_STRING "\n" << "\n" @@ -4523,11 +4526,11 @@ extern "C" void external_pause_game() #endif #ifdef __IOS__ -extern "C" void external_statustext(const char *text, float duration) +extern "C" void external_statustext(const char *text) { if (!g_game) return; std::wstring s = utf8_to_wide(std::string(text)); - g_game->customStatustext(s, duration); + g_game->customStatustext(s); } #endif diff --git a/src/client/inputhandler.cpp b/src/client/inputhandler.cpp index ff9b3fb32..ec618b00e 100644 --- a/src/client/inputhandler.cpp +++ b/src/client/inputhandler.cpp @@ -23,15 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "gui/mainmenumanager.h" #include "hud.h" -#if defined(__ANDROID__) -#include "porting_android.h" -#endif - #ifdef __IOS__ #include "porting_ios.h" -#endif - -#if defined(__IOS__) extern "C" void external_pause_game(); #endif diff --git a/src/client/renderingengine.cpp b/src/client/renderingengine.cpp index 0a42b1981..f1e0558c6 100644 --- a/src/client/renderingengine.cpp +++ b/src/client/renderingengine.cpp @@ -60,6 +60,15 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "defaultsettings.h" #endif +#ifdef __IOS__ +namespace irr { + class CIrrDeviceiOS : public IrrlichtDevice { + public: + void *getViewController(); + }; +} +#endif + RenderingEngine *RenderingEngine::s_singleton = nullptr; @@ -138,7 +147,7 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver) params.EventReceiver = receiver; params.HighPrecisionFPU = g_settings->getBool("high_precision_fpu"); params.ZBufferBits = 24; -#if defined(__ANDROID__) || defined(__IOS__) +#ifdef __ANDROID__ params.PrivateData = porting::app_global; #endif #if ENABLE_GLES diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 8158b00a0..f14cbe944 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -76,7 +76,7 @@ void set_default_settings() settings->setDefault("enable_remote_media_server", "true"); settings->setDefault("enable_client_modding", "true"); settings->setDefault("max_out_chat_queue_size", "20"); - settings->setDefault("pause_on_lost_focus", "false"); + settings->setDefault("pause_on_lost_focus", "true"); settings->setDefault("enable_register_confirmation", "false"); // Keymap @@ -248,7 +248,7 @@ void set_default_settings() settings->setDefault("transparency_sorting", "true"); settings->setDefault("texture_clean_transparent", "false"); settings->setDefault("texture_min_size", "0"); - settings->setDefault("ambient_occlusion_gamma", "2.2"); + settings->setDefault("ambient_occlusion_gamma", "1.8"); #if ENABLE_GLES settings->setDefault("enable_shaders", "false"); #else @@ -528,7 +528,6 @@ void set_default_settings() settings->setDefault("emergequeue_limit_diskonly", "16"); settings->setDefault("emergequeue_limit_generate", "16"); settings->setDefault("curl_verify_cert", "false"); - settings->setDefault("pause_on_lost_focus", "true"); settings->setDefault("max_objects_per_block", "16"); settings->setDefault("doubletap_jump", "true"); settings->setDefault("gui_scaling_filter_txr2img", "false"); diff --git a/src/light.cpp b/src/light.cpp index 66080e851..dcde81167 100644 --- a/src/light.cpp +++ b/src/light.cpp @@ -74,7 +74,7 @@ void set_light_table(float gamma) params.gamma = rangelim(gamma, 0.33f, 3.0f); // Boundary values should be fixed - light_LUT[0] = 10; + light_LUT[0] = 20; light_LUT[LIGHT_SUN] = 255; for (size_t i = 1; i < LIGHT_SUN; i++) { diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index 57e3b9dac..159a5246d 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -1437,6 +1437,8 @@ void Client::handleCommand_LocalPlayerAnimations(NetworkPacket* pkt) *pkt >> player->local_animations[2]; *pkt >> player->local_animations[3]; *pkt >> player->local_animation_speed; + + player->last_animation = -1; } void Client::handleCommand_EyeOffset(NetworkPacket* pkt) diff --git a/src/porting.h b/src/porting.h index e733de4c1..d762570a0 100644 --- a/src/porting.h +++ b/src/porting.h @@ -286,10 +286,10 @@ inline const char *getPlatformName() defined(__NetBSD__) || defined(__OpenBSD__) "BSD" #elif defined(__APPLE__) && defined(__MACH__) - #if TARGET_OS_MAC - "OSX" - #elif TARGET_OS_IPHONE + #if TARGET_OS_IPHONE "iOS" + #elif TARGET_OS_MAC + "OSX" #else "Apple" #endif diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp index b02512c58..8bf212092 100644 --- a/src/script/lua_api/l_mainmenu.cpp +++ b/src/script/lua_api/l_mainmenu.cpp @@ -755,6 +755,10 @@ bool ModApiMainMenu::mayModifyPath(std::string path) if (fs::PathStartsWith(path, fs::RemoveRelativePathComponents(porting::path_cache))) return true; + std::string path_share = fs::RemoveRelativePathComponents(porting::path_share); + if (fs::PathStartsWith(path, path_share + DIR_DELIM "builtin")) + return true; + return false; }