fix header porting import and fix devices filtering conditionals
* Minor cleanup and improvements, cherry picked modified from commit
66b1aafb4b
This commit is contained in:
parent
4fb563aed3
commit
880579ea15
@ -4359,8 +4359,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();
|
||||
|
@ -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
|
||||
|
||||
|
@ -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);
|
||||
|
@ -53,7 +53,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include <winuser.h>
|
||||
#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,10 +156,9 @@ 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();
|
||||
#endif
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -640,7 +640,7 @@ void GUIEngine::updateTopLeftTextSize()
|
||||
{
|
||||
core::rect<s32> 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(),
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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<RollbackAction> &actions,
|
||||
std::list<std::string> *log);
|
||||
#endif
|
||||
|
||||
// IGameDef interface
|
||||
// Under envlock
|
||||
|
Loading…
x
Reference in New Issue
Block a user