diff --git a/build/android/app/build.gradle b/build/android/app/build.gradle index f6f3efaa..0bf4ef0b 100644 --- a/build/android/app/build.gradle +++ b/build/android/app/build.gradle @@ -2,13 +2,13 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { - compileSdkVersion 31 - buildToolsVersion '31.0.0' + compileSdkVersion 32 + buildToolsVersion '32.0.0' ndkVersion '23.1.7779620' defaultConfig { applicationId 'com.multicraft.game' minSdkVersion 19 - targetSdkVersion 31 + targetSdkVersion 32 versionCode 200 versionName "1.19.0" } @@ -66,9 +66,9 @@ dependencies { implementation project(':native') /* Third-party libraries */ - implementation 'androidx.appcompat:appcompat:1.4.0' - implementation 'androidx.appcompat:appcompat-resources:1.4.0' - implementation 'com.google.android.material:material:1.4.0' + implementation 'androidx.appcompat:appcompat:1.4.1' + implementation 'androidx.appcompat:appcompat-resources:1.4.1' + implementation 'com.google.android.material:material:1.5.0' implementation 'io.reactivex.rxjava3:rxjava:3.0.13' implementation 'io.reactivex.rxjava3:rxandroid:3.0.0' implementation 'net.lingala.zip4j:zip4j:2.9.1' diff --git a/build/android/build.gradle b/build/android/build.gradle index 54f3c4ec..d3253cbe 100644 --- a/build/android/build.gradle +++ b/build/android/build.gradle @@ -7,9 +7,9 @@ buildscript { maven { url 'https://plugins.gradle.org/m2/' } } dependencies { - classpath 'com.android.tools.build:gradle:7.0.4' + classpath 'com.android.tools.build:gradle:7.1.1' classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10' - classpath 'de.undercouch:gradle-download-task:4.1.2' + classpath 'de.undercouch:gradle-download-task:5.0.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } diff --git a/build/android/gradle/wrapper/gradle-wrapper.properties b/build/android/gradle/wrapper/gradle-wrapper.properties index c5f111d5..d1439826 100644 --- a/build/android/gradle/wrapper/gradle-wrapper.properties +++ b/build/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Dec 27 10:51:18 CET 2021 +#Wed Feb 09 21:22:41 EET 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/build/android/native/build.gradle b/build/android/native/build.gradle index f2290f2c..bb518b82 100644 --- a/build/android/native/build.gradle +++ b/build/android/native/build.gradle @@ -2,12 +2,12 @@ apply plugin: 'com.android.library' apply plugin: 'de.undercouch.download' android { - compileSdkVersion 31 - buildToolsVersion '31.0.0' + compileSdkVersion 32 + buildToolsVersion '32.0.0' ndkVersion '23.1.7779620' defaultConfig { minSdkVersion 19 - targetSdkVersion 31 + targetSdkVersion 32 externalNativeBuild { ndkBuild { arguments '-j' + Runtime.getRuntime().availableProcessors(), diff --git a/build/iOS/deps/libcurl.sh b/build/iOS/deps/libcurl.sh index 9b67301b..5a67e84a 100755 --- a/build/iOS/deps/libcurl.sh +++ b/build/iOS/deps/libcurl.sh @@ -1,7 +1,7 @@ #!/bin/bash -e . sdk.sh -CURL_VERSION=7.81.0 +CURL_VERSION=7.82.0 if [ ! -d libcurl-src ]; then wget https://curl.haxx.se/download/curl-$CURL_VERSION.tar.gz diff --git a/builtin/mainmenu/init.lua b/builtin/mainmenu/init.lua index d05743ea..1f5856d0 100644 --- a/builtin/mainmenu/init.lua +++ b/builtin/mainmenu/init.lua @@ -63,13 +63,7 @@ tabs.credits = dofile(menupath .. DIR_DELIM .. "tab_credits.lua") tabs.local_game = dofile(menupath .. DIR_DELIM .. "tab_local.lua") tabs.play_online = dofile(menupath .. DIR_DELIM .. "tab_online.lua") -local htabs = {} -local hpath = menupath .. DIR_DELIM .. "hosting" .. DIR_DELIM .. "init.lua" -local hosting = io.open(hpath, "r") -if hosting then - htabs = dofile(hpath) - io.close(hosting) -end +local func = loadfile(menupath .. DIR_DELIM .. "hosting" .. DIR_DELIM .. "init.lua") -------------------------------------------------------------------------------- local function main_event_handler(_, event) @@ -110,12 +104,12 @@ local function init_globals() tv_main:add(tabs.local_game) end - tv_main:add(tabs.play_online) - - for _, page in pairs(htabs) do - tv_main:add(page) + if func then + func(tv_main) end + tv_main:add(tabs.play_online) + tv_main:add(tabs.settings) if not mobile then diff --git a/builtin/mainmenu/tab_settings_simple.lua b/builtin/mainmenu/tab_settings_simple.lua index c0a24d86..775efaf2 100644 --- a/builtin/mainmenu/tab_settings_simple.lua +++ b/builtin/mainmenu/tab_settings_simple.lua @@ -79,10 +79,10 @@ local function formspec(tabview, name, tabdata) tonumber(fps <= 30 and 1 or fps == 35 and 2 or fps == 45 and 3 or 4) .. "]" .. "label[4.25,1.5;" .. fgettext("Viewing range") .. ":]" .. - "dropdown[4.25,1.95;3.5;dd_viewing_range;25,30,40,60,80,100,125,150,175,200;" .. - tonumber(range <= 25 and 1 or range == 30 and 2 or range == 40 and 3 or - range == 60 and 4 or range == 80 and 5 or range == 100 and 6 or range == 125 and 7 or - range == 150 and 8 or range == 175 and 9 or 10) .. "]" .. + "dropdown[4.25,1.95;3.5;dd_viewing_range;30,40,60,80,100,125,150,175,200;" .. + tonumber(range <= 30 and 1 or range == 40 and 2 or range == 60 and 3 or + range == 80 and 4 or range == 100 and 5 or range == 125 and 6 or + range == 150 and 7 or range == 175 and 8 or 9) .. "]" .. "label[4.25,2.85;" .. fgettext("Node highlighting") .. ":]" .. "dropdown[4.25,3.3;3.5;dd_node_highlighting;" .. dd_options.node_highlighting[1] .. ";" diff --git a/src/config.h b/src/config.h index 72d32e09..495b89d7 100644 --- a/src/config.h +++ b/src/config.h @@ -17,8 +17,8 @@ #define PROJECT_NAME_C "MultiCraft" #define STATIC_SHAREDIR "" #define VERSION_MAJOR 1 - #define VERSION_MINOR 19 - #define VERSION_PATCH 0 + #define VERSION_MINOR 21 + #define VERSION_PATCH 1 #define VERSION_STRING STR(VERSION_MAJOR) "." STR(VERSION_MINOR) "." STR(VERSION_PATCH) #endif diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index a6d21e8d..7e7fbf31 100755 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -380,7 +380,6 @@ void set_default_settings(Settings *settings) { settings->setDefault("high_precision_fpu", "true"); settings->setDefault("enable_console", "false"); - // settings->setDefault("mainmenu_last_selected_world", "1"); settings->setDefault("device_is_tablet", "false"); // Altered settings for macOS @@ -428,7 +427,7 @@ void set_default_settings(Settings *settings) { settings->setDefault("client_mapblock_limit", "50"); settings->setDefault("fps_max", "30"); settings->setDefault("pause_fps_max", "5"); - settings->setDefault("viewing_range", "25"); + settings->setDefault("viewing_range", "30"); settings->setDefault("smooth_lighting", "false"); settings->setDefault("enable_3d_clouds", "false"); settings->setDefault("active_block_range", "1"); @@ -448,9 +447,8 @@ void set_default_settings(Settings *settings) { settings->setDefault("client_mapblock_limit", "200"); settings->setDefault("fps_max", "35"); settings->setDefault("pause_fps_max", "10"); - settings->setDefault("viewing_range", "30"); + settings->setDefault("viewing_range", "40"); settings->setDefault("smooth_lighting", "false"); - settings->setDefault("enable_3d_clouds", "false"); settings->setDefault("cloud_radius", "6"); settings->setDefault("active_block_range", "1"); settings->setDefault("dedicated_server_step", "0.2"); @@ -471,13 +469,11 @@ void set_default_settings(Settings *settings) { settings->setDefault("client_mapblock_limit", "300"); settings->setDefault("fps_max", "35"); settings->setDefault("viewing_range", "60"); - settings->setDefault("cloud_radius", "6"); settings->setDefault("active_block_range", "2"); settings->setDefault("max_block_generate_distance", "3"); } else { // high settings settings->setDefault("client_mapblock_limit", "500"); - settings->setDefault("viewing_range", "80"); settings->setDefault("max_block_generate_distance", "5"); #ifdef __IOS__ @@ -578,9 +574,13 @@ void set_default_settings(Settings *settings) { // 5.5" iPhone Plus settings->setDefault("hud_scaling", "0.65"); settings->setDefault("mouse_sensitivity", "0.3"); - settings->setDefault("font_size", font_small); - } else if (SDVersion5and8Inch || SDVersion6and1Inch || SDVersion6and5Inch) { - // 5.8+" iPhones + } else if (SDVersion5and8Inch || SDVersion6and1Inch) { + // 5.8" and 6.1" iPhones + settings->setDefault("hud_scaling", "0.8"); + settings->setDefault("mouse_sensitivity", "0.35"); + settings->setDefault("selectionbox_width", "6"); + } else if SDVersion6and5Inch { + // 6.5" iPhone settings->setDefault("hud_scaling", "0.85"); settings->setDefault("mouse_sensitivity", "0.35"); settings->setDefault("selectionbox_width", "6"); @@ -589,7 +589,6 @@ void set_default_settings(Settings *settings) { settings->setDefault("hud_scaling", "0.9"); settings->setDefault("mouse_sensitivity", "0.25"); settings->setDefault("selectionbox_width", "6"); - settings->setDefault("device_is_tablet", "false"); } else { // iPad settings->setDefault("mouse_sensitivity", "0.3"); @@ -597,11 +596,12 @@ void set_default_settings(Settings *settings) { } // Settings for the Rounded Screen and Home Bar - UIWindow *window = UIApplication.sharedApplication.windows.firstObject; + UIWindow *window = UIApplication.sharedApplication.keyWindow; + CGFloat safeAreaBottom = window.safeAreaInsets.bottom; - if (window.safeAreaInsets.bottom > 0) { - settings->setDefault("hud_move_upwards", "20"); - if (SDVersioniPhone12Series) + if (safeAreaBottom > 0) { + settings->setDefault("hud_move_upwards", std::to_string(safeAreaBottom)); + if SDVersioniPhone12Series settings->setDefault("round_screen", "75"); else settings->setDefault("round_screen", "35"); diff --git a/src/game.cpp b/src/game.cpp index b4fe6066..98ec3d5f 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1689,17 +1689,6 @@ void Game::run() while (device->run() && !(*kill || g_gamecallback->shutdown_requested || (server && server->getShutdownRequested()))) { -#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 = device->getVideoDriver()->getScreenSize(); @@ -1719,6 +1708,16 @@ void Game::run() */ limitFps(&draw_times, &dtime); +#if defined(__MACH__) && defined(__APPLE__) && !defined(__IOS__) + if (!device->isWindowFocused()) { + sleep_ms(50); + continue; + } +#elif defined(__ANDROID__) || defined(__IOS__) + if (device->isWindowMinimized()) + continue; +#endif + updateStats(&stats, draw_times, dtime); updateInteractTimers(dtime); @@ -3186,19 +3185,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()); @@ -4634,6 +4620,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 } // Note: This will free (using delete[])! \p msg. If you want to use it later, diff --git a/src/touchscreengui.cpp b/src/touchscreengui.cpp index deeae25c..2b6dbf4d 100644 --- a/src/touchscreengui.cpp +++ b/src/touchscreengui.cpp @@ -401,12 +401,11 @@ void TouchScreenGUI::handleButtonEvent(touch_gui_button_id button, assert(pos != btn->ids.end()); btn->ids.erase(pos); - if (!btn->ids.empty()) - return; - - translated->KeyInput.PressedDown = false; - btn->repeatcounter = -1; - m_receiver->OnEvent(*translated); + if (btn->ids.empty()) { + translated->KeyInput.PressedDown = false; + btn->repeatcounter = -1; + m_receiver->OnEvent(*translated); + } } delete translated; }