diff --git a/src/client/game.cpp b/src/client/game.cpp index b043ce8a4..d2933ad70 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -4354,8 +4354,6 @@ void Game::showPauseMenu() bool hasRealKeyboard = porting::hasRealKeyboard(); if (simple_singleplayer_mode && hasRealKeyboard) ypos -= 0.6f; -#endif -#ifdef __IOS__ ypos += 0.5f; #endif const bool high_dpi = RenderingEngine::isHighDpi(); diff --git a/src/client/inputhandler.cpp b/src/client/inputhandler.cpp index 69ee3d8f8..9d525c223 100644 --- a/src/client/inputhandler.cpp +++ b/src/client/inputhandler.cpp @@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "settings.h" #ifdef __IOS__ -#include "porting_ios.h" +#include "porting.h" extern "C" void external_pause_game(); #endif diff --git a/src/client/minimap.cpp b/src/client/minimap.cpp index 5e028c97c..59bea0c21 100644 --- a/src/client/minimap.cpp +++ b/src/client/minimap.cpp @@ -193,18 +193,12 @@ Minimap::Minimap(Client *client) // Initialize minimap modes addMode(MINIMAP_TYPE_OFF); -#if !defined(__ANDROID__) && !defined(__IOS__) addMode(MINIMAP_TYPE_SURFACE, 256); addMode(MINIMAP_TYPE_SURFACE, 128); -#endif addMode(MINIMAP_TYPE_SURFACE, 64); -#if !defined(__ANDROID__) && !defined(__IOS__) - addMode(MINIMAP_TYPE_RADAR, 512); addMode(MINIMAP_TYPE_RADAR, 256); addMode(MINIMAP_TYPE_RADAR, 128); -#else addMode(MINIMAP_TYPE_RADAR, 64); -#endif // Initialize minimap data data = new MinimapData; @@ -362,9 +356,6 @@ void Minimap::addMode(MinimapModeDef mode) porting::mt_snprintf(label_buf, sizeof(label_buf), mode.label.c_str(), zoom); mode.label = label_buf; -#if defined(__ANDROID__) || defined(__IOS__) - mode.label = mode.label.substr(0, mode.label.find(", ")); -#endif } m_modes.push_back(mode); diff --git a/src/client/renderingengine.cpp b/src/client/renderingengine.cpp index dd6742f86..ce8f5faa5 100644 --- a/src/client/renderingengine.cpp +++ b/src/client/renderingengine.cpp @@ -53,7 +53,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #endif -#ifdef __ANDROID__ +#if defined(__ANDROID__) || defined(__IOS__) #include "defaultsettings.h" #endif @@ -143,6 +143,10 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver) #endif m_device = createDeviceEx(params); +#if defined(__ANDROID__) || defined(__IOS__) + FATAL_ERROR_IF(!m_device, ("Device create failed. Driver Type: \"" + + std::string(RenderingEngine::getVideoDriverName(driverType)) + "\".").c_str()); +#endif driver = m_device->getVideoDriver(); s_singleton = this; @@ -152,11 +156,10 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver) m_device->getGUIEnvironment()->setSkin(skin); skin->drop(); -#ifdef __ANDROID__ +#if defined(__ANDROID__) || defined(__IOS__) // Apply settings according to screen size // We can get real screen size only after device initialization finished - if (m_device) - set_default_settings(); + set_default_settings(); #endif } diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 184b3c26a..01be808e7 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -536,7 +536,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("max_objects_per_block", "16"); settings->setDefault("doubletap_jump", "true"); settings->setDefault("gui_scaling_filter_txr2img", "false"); settings->setDefault("autosave_screensize", "false"); @@ -559,13 +558,14 @@ void set_default_settings() #endif settings->setDefault("client_unload_unused_data_timeout", "60"); settings->setDefault("client_mapblock_limit", "50"); - settings->setDefault("fps_max", "30"); + settings->setDefault("fps_max", "35"); settings->setDefault("fps_max_unfocused", "10"); settings->setDefault("viewing_range", "30"); settings->setDefault("smooth_lighting", "false"); settings->setDefault("enable_3d_clouds", "false"); settings->setDefault("active_object_send_range_blocks", "1"); settings->setDefault("active_block_range", "1"); + settings->setDefault("max_objects_per_block", "16"); settings->setDefault("dedicated_server_step", "0.2"); settings->setDefault("abm_interval", "3.0"); settings->setDefault("chunksize", "3"); @@ -586,14 +586,15 @@ void set_default_settings() settings->setDefault("smooth_lighting", "false"); settings->setDefault("active_object_send_range_blocks", "1"); settings->setDefault("active_block_range", "2"); + settings->setDefault("max_objects_per_block", "16"); settings->setDefault("dedicated_server_step", "0.2"); settings->setDefault("abm_interval", "2.0"); settings->setDefault("chunksize", "3"); settings->setDefault("max_block_generate_distance", "2"); settings->setDefault("arm_inertia", "false"); #ifdef __ANDROID__ - } else if (memoryMax >= 4 && memoryMax < 6) { - // medium settings for 4.1-6GB RAM + } else if (memoryMax >= 4 && memoryMax <= 5) { + // medium settings for 4.1-5GB RAM #elif __IOS__ } else if (([SDVersion deviceVersion] == iPhone6S) || ([SDVersion deviceVersion] == iPhone6SPlus) || ([SDVersion deviceVersion] == iPhoneSE) || ([SDVersion deviceVersion] == iPhone7) || ([SDVersion deviceVersion] == iPhone7Plus) || @@ -607,6 +608,7 @@ void set_default_settings() settings->setDefault("viewing_range", "60"); settings->setDefault("active_object_send_range_blocks", "2"); settings->setDefault("active_block_range", "2"); + settings->setDefault("max_objects_per_block", "32"); settings->setDefault("max_block_generate_distance", "3"); } else { // high settings @@ -624,7 +626,7 @@ void set_default_settings() // Android Settings #ifdef __ANDROID__ // Switch to olges2 with shaders on powerful Android devices - if (memoryMax >= 6) { + if (memoryMax > 5) { settings->setDefault("video_driver", "ogles2"); settings->setDefault("enable_shaders", "true"); } else { @@ -669,7 +671,7 @@ void set_default_settings() // iOS Settings #ifdef __IOS__ // Switch to olges2 with shaders in new iOS versions - if (IOS_VERSION_AVAILABLE("13.0")) { + if (IOS_VERSION_AVAILABLE("14.0")) { settings->setDefault("video_driver", "ogles2"); settings->setDefault("enable_shaders", "true"); } else { @@ -690,7 +692,7 @@ void set_default_settings() settings->setDefault("touch_sensitivity", "0.27"); } else if SDVersion5and5Inch { // 5.5" iPhone Plus - settings->setDefault("hud_scaling", "0.65"); + settings->setDefault("hud_scaling", "0.6"); settings->setDefault("touch_sensitivity", "0.3"); } else if (SDVersion5and8Inch || SDVersion6and1Inch) { // 5.8" and 6.1" iPhones @@ -725,7 +727,8 @@ void set_default_settings() } // Settings for the Rounded Screen and Home Bar - if SDVersionRoundScreen { + int RoundScreen = porting::getRoundScreen(); + if (RoundScreen > 0) { int upwards = 25, round = 40; if SDVersioniPhone12Series { upwards = 20, round = 90; diff --git a/src/gui/guiEngine.cpp b/src/gui/guiEngine.cpp index 9d1387f39..4f20d1cf1 100644 --- a/src/gui/guiEngine.cpp +++ b/src/gui/guiEngine.cpp @@ -640,7 +640,7 @@ void GUIEngine::updateTopLeftTextSize() { core::rect rect(0, 0, g_fontengine->getTextWidth(m_toplefttext.c_str()), g_fontengine->getTextHeight()); - rect += v2s32(5 + g_settings->getU16("round_screen"), 0); + rect += v2s32(5 + g_settings->getU16("round_screen") * 1.1, 0); m_irr_toplefttext->remove(); m_irr_toplefttext = gui::StaticText::add(RenderingEngine::get_gui_env(), diff --git a/src/gui/modalMenu.cpp b/src/gui/modalMenu.cpp index 37f3c762d..3272dfc46 100644 --- a/src/gui/modalMenu.cpp +++ b/src/gui/modalMenu.cpp @@ -401,7 +401,7 @@ bool GUIModalMenu::preprocessEvent(const SEvent &event) if (!ret && m_hovered && m_hovered != focused) ret = m_hovered->OnEvent(mouse_event); if (event.TouchInput.Event == ETIE_LEFT_UP) { - m_pointer = v2s32(0, 0); + m_pointer = AbsoluteClippingRect.UpperLeftCorner; leave(); } return ret; diff --git a/src/gui/modalMenu.h b/src/gui/modalMenu.h index ddecb97f7..7fd5c7b45 100644 --- a/src/gui/modalMenu.h +++ b/src/gui/modalMenu.h @@ -52,8 +52,8 @@ public: void quitMenu(); void removeChildren(); - virtual void regenerateGui(v2u32 screensize) = 0; - virtual void drawMenu() = 0; + virtual void regenerateGui(v2u32 screensize) {}; + virtual void drawMenu() {}; virtual bool preprocessEvent(const SEvent &event); virtual bool OnEvent(const SEvent &event) { return false; }; virtual bool pausesGame() { return false; } // Used for pause menu diff --git a/src/script/lua_api/l_util.cpp b/src/script/lua_api/l_util.cpp index 41d7f9605..389e36b28 100644 --- a/src/script/lua_api/l_util.cpp +++ b/src/script/lua_api/l_util.cpp @@ -494,12 +494,12 @@ int ModApiUtil::l_sha1(lua_State *L) int ModApiUtil::l_upgrade(lua_State *L) { NO_MAP_LOCK_REQUIRED; -#ifdef __ANDROID__ +#if defined(__ANDROID__) || defined(__IOS__) const std::string item_name = luaL_checkstring(L, 1); porting::upgrade(item_name); lua_pushboolean(L, true); #else - // Not implemented on non-Android platforms + // Not implemented on other platforms lua_pushnil(L); #endif diff --git a/src/server.h b/src/server.h index 93c9d3e38..c5b7795ff 100644 --- a/src/server.h +++ b/src/server.h @@ -280,10 +280,12 @@ public: // Envlock and conlock should be locked when using scriptapi ServerScripting *getScriptIface(){ return m_script; } +#if USE_SQLITE // actions: time-reversed list // Return value: success/failure bool rollbackRevertActions(const std::list &actions, std::list *log); +#endif // IGameDef interface // Under envlock