diff --git a/build/android/Makefile b/build/android/Makefile index eb447ef41..5f14c9165 100644 --- a/build/android/Makefile +++ b/build/android/Makefile @@ -61,10 +61,10 @@ COMPILER_VERSION = 4.9 # TARGET_ABI = x86 # TARGET_LIBDIR = x86 # TARGET_TOOLCHAIN = x86 -# TARGET_CFLAGS_ADDON = -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves +# TARGET_CFLAGS_ADDON = -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden # TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON) # TARGET_LDFLAGS_ADDON = -Wl,--no-warn-mismatch,--gc-sections -# TARGET_ARCH = x86 +# ARGET_ARCH = x86 # CROSS_PREFIX = i686-linux-android- # COMPILER_VERSION = 4.9 @@ -107,12 +107,12 @@ CURL_TIMESTAMP = $(CURL_DIR)/timestamp CURL_TIMESTAMP_INT = $(ANDR_ROOT)/deps/curl_timestamp CURL_URL_HTTP = http://dl.uxnr.de/mirror/curl/curl-${CURL_VERSION}.tar.bz2 -GMP_VERSION = 6.1.0 -GMP_DIR = $(ANDR_ROOT)/deps/gmp -GMP_LIB = $(GMP_DIR)/usr/lib/libgmp.so -GMP_TIMESTAMP = $(GMP_DIR)/timestamp -GMP_TIMESTAMP_INT = $(ANDR_ROOT)/deps/gmp_timestamp -GMP_URL_HTTP = https://gmplib.org/download/gmp/gmp-$(GMP_VERSION).tar.bz2 +MPIR_VERSION = 2.7.2 +MPIR_DIR = $(ANDR_ROOT)/deps/mpir +MPIR_LIB = $(MPIR_DIR)/usr/lib/libmpir.a +MPIR_TIMESTAMP = $(MPIR_DIR)/timestamp +MPIR_TIMESTAMP_INT = $(ANDR_ROOT)/deps/mpir_timestamp +MPIR_URL_HTTP = http://mpir.org/mpir-$(MPIR_VERSION).tar.bz2 FREETYPE_VERSION = 2.6.3 FREETYPE_DIR = $(ANDR_ROOT)/deps/freetype @@ -299,7 +299,7 @@ openssl_download : openssl : $(OPENSSL_LIB) -$(OPENSSL_LIB): $(OPENSSL_TIMESTAMP) $(GMP_LIB) +$(OPENSSL_LIB): $(OPENSSL_TIMESTAMP) $(MPIR_LIB) @REFRESH=0; \ if [ ! -e ${OPENSSL_TIMESTAMP_INT} ] ; then \ echo "${OPENSSL_TIMESTAMP_INT} doesn't exist"; \ @@ -317,7 +317,7 @@ $(OPENSSL_LIB): $(OPENSSL_TIMESTAMP) $(GMP_LIB) --install-dir=$${TOOLCHAIN} --platform=${APP_PLATFORM}; \ export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \ CC=${CROSS_PREFIX}gcc ./Configure no-ssl2 no-ssl3 no-hw enable-gmp \ - -DL_ENDIAN -I${GMP_DIR} -L${GMP_DIR}/usr/lib android-${TARGET_ARCH}; \ + -DL_ENDIAN -I${MPIR_DIR} -L${MPIR_DIR}/usr/lib android-${TARGET_ARCH}; \ CC=${CROSS_PREFIX}gcc ANDROID_DEV=/tmp/ndk-${TARGET_HOST} make depend; \ CC=${CROSS_PREFIX}gcc ANDROID_DEV=/tmp/ndk-${TARGET_HOST} make build_libs; \ touch ${OPENSSL_TIMESTAMP}; \ @@ -572,61 +572,59 @@ $(CURL_LIB): $(CURL_TIMESTAMP) clean_curl : $(RM) -R ${CURL_DIR} -$(GMP_TIMESTAMP) : gmp_download - @LAST_MODIF=$$(find ${GMP_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ +$(MPIR_TIMESTAMP) : mpir_download + @LAST_MODIF=$$(find ${MPIR_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \ - touch ${GMP_TIMESTAMP}; \ + touch ${MPIR_TIMESTAMP}; \ fi -gmp_download : - @if [ ! -d "${GMP_DIR}" ] ; then \ - echo "gmp sources missing, downloading..."; \ +mpir_download : + @if [ ! -d "${MPIR_DIR}" ] ; then \ + echo "mpir sources missing, downloading..."; \ mkdir -p ${ANDR_ROOT}/deps; \ cd deps; \ - wget ${GMP_URL_HTTP} || exit 1; \ - tar -xjf gmp-${GMP_VERSION}.tar.bz2 || exit 1; \ - rm gmp-${GMP_VERSION}.tar.bz2; \ - mv gmp-${GMP_VERSION} gmp; \ + wget ${MPIR_URL_HTTP} || exit 1; \ + tar -xjf mpir-${MPIR_VERSION}.tar.bz2 || exit 1; \ + rm mpir-${MPIR_VERSION}.tar.bz2; \ + mv mpir-${MPIR_VERSION} mpir; \ fi -gmp : $(GMP_LIB) +mpir : $(MPIR_LIB) -$(GMP_LIB): $(GMP_TIMESTAMP) +$(MPIR_LIB): $(MPIR_TIMESTAMP) @REFRESH=0; \ - if [ ! -e ${GMP_TIMESTAMP_INT} ] ; then \ + if [ ! -e ${MPIR_TIMESTAMP_INT} ] ; then \ REFRESH=1; \ fi; \ - if [ ! -e ${GMP_LIB} ] ; then \ + if [ ! -e ${MPIR_LIB} ] ; then \ REFRESH=1; \ fi; \ - if [ ${GMP_TIMESTAMP} -nt ${GMP_TIMESTAMP_INT} ] ; then \ + if [ ${MPIR_TIMESTAMP} -nt ${MPIR_TIMESTAMP_INT} ] ; then \ REFRESH=1; \ fi; \ if [ $$REFRESH -ne 0 ] ; then \ - mkdir -p ${GMP_DIR}; \ - echo "changed timestamp for gmp detected building..."; \ - cd deps/gmp; \ + mkdir -p ${MPIR_DIR}; \ + echo "changed timestamp for mpir detected building..."; \ + cd deps/mpir; \ export CROSS_PREFIX=${CROSS_PREFIX}; \ - export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-gmp; \ + export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-mpir; \ ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \ --toolchain=${TARGET_TOOLCHAIN}-${COMPILER_VERSION} \ --platform=${APP_PLATFORM} --install-dir=$${TOOLCHAIN}; \ export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \ export CC=${CROSS_PREFIX}gcc; \ export CXX=${CROSS_PREFIX}g++; \ - export LIBGMP_LDFLAGS="-avoid-version"; \ - export LIBGMPXX_LDFLAGS="-avoid-version"; \ ./configure --host=${TARGET_HOST} --prefix=/usr; \ - $(MAKE) install DESTDIR=/${GMP_DIR} || exit 1; \ - touch ${GMP_TIMESTAMP}; \ - touch ${GMP_TIMESTAMP_INT}; \ + $(MAKE) install DESTDIR=/${MPIR_DIR} || exit 1; \ + touch ${MPIR_TIMESTAMP}; \ + touch ${MPIR_TIMESTAMP_INT}; \ $(RM) -rf $${TOOLCHAIN}; \ else \ - echo "nothing to be done for gmp"; \ + echo "nothing to be done for mpir"; \ fi -clean_gmp: - $(RM) -R deps/gmp +clean_mpir: + $(RM) -R deps/mpir sqlite3_download: deps/sqlite/sqlite3.c @@ -753,7 +751,7 @@ assets : $(ASSETS_TIMESTAMP) clean_assets : @$(RM) -r assets -apk: local.properties $(ICONV_LIB) $(IRRLICHT_LIB) $(CURL_LIB) $(GMP_LIB) $(LUAJIT_LIB) \ +apk: local.properties $(ICONV_LIB) $(IRRLICHT_LIB) $(CURL_LIB) $(MPIR_LIB) $(LUAJIT_LIB) \ $(OPENAL_LIB) $(VORBIS_LIB) prep_srcdir $(ANDR_ROOT)/jni/src/android_version.h \ $(ANDR_ROOT)/jni/src/android_version_githash.h sqlite3_download @$(MAKE) assets; \ diff --git a/build/android/jni/Android.mk b/build/android/jni/Android.mk index 860cb3d32..0762bf7b8 100644 --- a/build/android/jni/Android.mk +++ b/build/android/jni/Android.mk @@ -4,7 +4,7 @@ LOCAL_PATH := $(call my-dir)/.. include $(CLEAR_VARS) LOCAL_MODULE := Irrlicht -LOCAL_SRC_FILES := deps/irrlicht/lib/Android/libIrrlicht.a +LOCAL_SRC_FILES := deps/irrlicht/source/Irrlicht/Android/obj/local/$(APP_ABI)/libIrrlicht.a include $(PREBUILT_STATIC_LIBRARY) include $(CLEAR_VARS) @@ -33,9 +33,9 @@ LOCAL_SRC_FILES := deps/libvorbis-android/obj/local/$(APP_ABI)/libvorbis.a include $(PREBUILT_STATIC_LIBRARY) include $(CLEAR_VARS) -LOCAL_MODULE := gmp -LOCAL_SRC_FILES := deps/gmp/usr/lib/libgmp.so -include $(PREBUILT_SHARED_LIBRARY) +LOCAL_MODULE := mpir +LOCAL_SRC_FILES := deps/mpir/usr/lib/libmpir.a +include $(PREBUILT_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := LuaJIT @@ -75,7 +75,8 @@ LOCAL_CFLAGS += -pg endif ifeq ($(TARGET_ARCH_ABI),x86) -LOCAL_CFLAGS += -mhard-float -Ofast -fno-fast-math -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -Wno-deprecated-declarations -fvisibility=hidden -fno-stack-protector +LOCAL_CFLAGS += -mhard-float -Ofast -fno-fast-math -funsafe-math-optimizations -fno-trapping-math -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden -fno-stack-protector +LOCAL_CXXFLAGS += -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden LOCAL_LDFLAGS = -Wl,--no-warn-mismatch,--gc-sections LOCAL_DISABLE_FATAL_LINKER_WARNINGS := true endif @@ -91,7 +92,7 @@ LOCAL_C_INCLUDES := \ deps/curl/include \ deps/openal-soft/include \ deps/libvorbis-android/jni/include \ - deps/gmp/usr/include \ + deps/mpir/usr/include \ deps/sqlite/ \ deps/luajit/src @@ -288,9 +289,7 @@ LOCAL_SRC_FILES += \ # JSONCPP LOCAL_SRC_FILES += jni/src/json/jsoncpp.cpp -LOCAL_SHARED_LIBRARIES := gmp - -LOCAL_STATIC_LIBRARIES := Irrlicht freetype curl iconv LuaJIT openal vorbis android_native_app_glue $(PROFILER_LIBS) +LOCAL_STATIC_LIBRARIES := Irrlicht freetype curl iconv LuaJIT openal vorbis mpir android_native_app_glue $(PROFILER_LIBS) LOCAL_LDLIBS := -lEGL -llog -lGLESv1_CM -lGLESv2 -lz -landroid -lOpenSLES diff --git a/build/android/patches/irrlicht-optimization.patch b/build/android/patches/irrlicht-optimization.patch index 75e27f2ca..dae8f2963 100644 --- a/build/android/patches/irrlicht-optimization.patch +++ b/build/android/patches/irrlicht-optimization.patch @@ -1,6 +1,6 @@ --- irrlicht/source/Irrlicht/Android/jni/Android.mk.orig 2016-02-15 05:33:03.000000000 +0200 +++ irrlicht/source/Irrlicht/Android/jni/Android.mk 2016-02-15 05:34:34.913711815 +0200 -@@ -11,7 +11,11 @@ +@@ -11,7 +11,17 @@ ifndef NDEBUG LOCAL_CFLAGS += -g -D_DEBUG else @@ -9,6 +9,12 @@ +LOCAL_CFLAGS += -mfpu=vfpv3-d16 -D_NDK_MATH_NO_SOFTFP=1 -mhard-float -march=armv7-a -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden +LOCAL_CXXFLAGS += -mfpu=vfpv3-d16 -D_NDK_MATH_NO_SOFTFP=1 -mhard-float -march=armv7-a -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden +LOCAL_LDFLAGS += -Wl,--no-warn-mismatch,--gc-sections -lm_hard ++endif ++ifeq ($(TARGET_ARCH_ABI),x86) ++LOCAL_CFLAGS += -mhard-float -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden -fno-stack-protector ++LOCAL_CXXFLAGS += -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden ++LOCAL_LDFLAGS = -Wl,--no-warn-mismatch,--gc-sections ++LOCAL_DISABLE_FATAL_LINKER_WARNINGS := true +endif endif diff --git a/builtin/mainmenu/init.lua b/builtin/mainmenu/init.lua index 608135227..d32d5a2f8 100644 --- a/builtin/mainmenu/init.lua +++ b/builtin/mainmenu/init.lua @@ -95,7 +95,7 @@ local function init_globals() -- Create main tabview local tv_main = tabview_create("maintab", {x = 12, y = 5.2}, {x = 0, y = 0}) - --tv_main:set_autosave_tab(true) + tv_main:set_autosave_tab(true) tv_main:add(tabs.singleplayer) tv_main:add(tabs.multiplayer) tv_main:add(tabs.server) @@ -111,9 +111,7 @@ local function init_globals() tv_main:set_global_event_handler(main_event_handler) tv_main:set_fixed_size(false) - --if PLATFORM ~= "Android" then - -- tv_main:set_tab(core.setting_get("maintab_LAST")) - --end + tv_main:set_tab(core.setting_get("maintab_LAST")) ui.set_default("maintab") tv_main:show() @@ -129,7 +127,6 @@ local function init_globals() core.sound_play("main_menu", false) minetest.set_clouds(false) - --core.set_background("background", defaulttexturedir .. "background.jpg"); mm_texture.set_dirt_bg() end diff --git a/src/clientmap.cpp b/src/clientmap.cpp index f83c704b2..93cdff371 100644 --- a/src/clientmap.cpp +++ b/src/clientmap.cpp @@ -247,6 +247,10 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver) block->mesh->updateCameraOffset(m_camera_offset); float range = 100000 * BS; + #ifdef __ANDROID__ + range = m_control.wanted_range * 4 * BS; + #endif + if (m_control.range_all == false) range = m_control.wanted_range * BS; diff --git a/src/config.h b/src/config.h index 46032cc3f..93d02d74f 100644 --- a/src/config.h +++ b/src/config.h @@ -12,7 +12,7 @@ #if defined USE_CMAKE_CONFIG_H #include "cmake_config.h" -#elif defined (__ANDROID__) || defined (ANDROID) +#elif defined (__ANDROID__) #define PROJECT_NAME "MultiCraft" #define PROJECT_NAME_C "MultiCraft" #define STATIC_SHAREDIR "" diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index ca1acb5c2..36e4f5718 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -183,7 +183,7 @@ void set_default_settings(Settings *settings) settings->setDefault("enable_vbo", "true"); settings->setDefault("enable_minimap", "true"); - settings->setDefault("minimap_shape_round", "false"); + settings->setDefault("minimap_shape_round", "true"); settings->setDefault("minimap_double_scan_height", "false"); settings->setDefault("send_pre_v25_init", "true"); @@ -215,7 +215,7 @@ void set_default_settings(Settings *settings) settings->setDefault("fallback_font_shadow_alpha", "128"); std::stringstream fontsize; - fontsize << DEFAULT_FONT_SIZE; + fontsize << TTF_DEFAULT_FONT_SIZE - 5; settings->setDefault("font_size", fontsize.str()); settings->setDefault("mono_font_size", fontsize.str()); @@ -362,7 +362,6 @@ void set_default_settings(Settings *settings) settings->setDefault("directional_colored_fog", "false"); settings->setDefault("viewing_range", "25"); - settings->setDefault("viewing_range_secondary", "150"); settings->setDefault("inventory_image_hack", "false"); // check for device with small screen @@ -376,6 +375,7 @@ void set_default_settings(Settings *settings) // small 4" phones settings->setDefault("hud_scaling", "0.5"); settings->setDefault("gui_scaling", "1.0"); + settings->setDefault("mouse_sensitivity", "0.15"); } if (x_inches > 5) { // tablets diff --git a/src/environment.cpp b/src/environment.cpp index 1724b3aba..c421a4898 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -2008,7 +2008,7 @@ void ServerEnvironment::activateObjects(MapBlock *block, u32 dtime_s) <<" objects)"<m_static_objects.m_stored.size() > g_settings->getU16("max_objects_per_block")); if (large_amount) { - verbosestream<<"suspiciously large amount of objects detected: " + infostream<<"suspiciously large amount of objects detected: " <m_static_objects.m_stored.size()<<" in " <getPos()) <<"; removing all of them."<getTextHeight()); - guitext_chat->setRelativePosition(rect); // Don't show chat if disabled or empty or profiler is enabled guitext_chat->setVisible( @@ -2327,7 +2325,7 @@ bool Game::connectToServer(const std::string &playername, // Only time out if we aren't waiting for the server we started if ((*address != "") && (wait_time > 10)) { *error_message = "Connection timed out."; - errorstream << *error_message << std::endl; + infostream << *error_message << std::endl; break; } @@ -2473,7 +2471,7 @@ inline bool Game::handleCallbacks() if (g_gamecallback->changepassword_requested) { (new GUIPasswordChange(guienv, guiroot, -1, - &g_menumgr, client))->drop(); + &g_menumgr, client))->drop(); g_gamecallback->changepassword_requested = false; } @@ -3078,24 +3076,21 @@ void Game::decreaseViewRange(float *statustext_time) void Game::toggleFullViewRange(float *statustext_time) { #ifdef __ANDROID__ - static s16 other_range = g_settings->getS16("viewing_range_secondary"); - s16 range_new = other_range; - other_range = g_settings->getS16("viewing_range"); - - g_settings->set("viewing_range", itos(range_new)); - - //statustext = utf8_to_wide("Viewing range changed to " - // + itos(range_new)); + static const wchar_t *msg[] = { + L"Disabled far viewing range", + L"Enabled far viewing range" + }; #else static const wchar_t *msg[] = { L"Disabled full viewing range", L"Enabled full viewing range" }; +#endif + draw_control->range_all = !draw_control->range_all; infostream << msg[draw_control->range_all] << std::endl; statustext = msg[draw_control->range_all]; *statustext_time = 0; -#endif } @@ -3967,6 +3962,9 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, if (draw_control->range_all) { runData->fog_range = 100000 * BS; + #ifdef __ANDROID__ + runData->fog_range = 0.9 * draw_control->wanted_range * 4 * BS; + #endif } else { runData->fog_range = 0.9 * draw_control->wanted_range * BS; } diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index 0fcc6f97e..740dabdb6 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -2998,8 +2998,8 @@ bool GUIFormSpecMenu::preprocessEvent(const SEvent& event) else if (event.TouchInput.touchedCount == 2) { dont_send_event = true; } - else if (event.TouchInput.touchedCount > 5) { - errorstream + else if (event.TouchInput.touchedCount > 3) { + infostream << "GUIFormSpecMenu::preprocessEvent to many multitouch events " << event.TouchInput.touchedCount << " ignoring them" << std::endl; } diff --git a/src/guiFormSpecMenu.h b/src/guiFormSpecMenu.h index 93588ceb0..22f17af0b 100644 --- a/src/guiFormSpecMenu.h +++ b/src/guiFormSpecMenu.h @@ -553,3 +553,4 @@ public: }; #endif + diff --git a/src/httpfetch.cpp b/src/httpfetch.cpp index 69474a58c..506efa5d9 100644 --- a/src/httpfetch.cpp +++ b/src/httpfetch.cpp @@ -381,7 +381,7 @@ const HTTPFetchResult * HTTPFetchOngoing::complete(CURLcode res) } if (res != CURLE_OK) { - errorstream << request.url << " not found (" + infostream << request.url << " not found (" << curl_easy_strerror(res) << ")" << " (response code " << result.response_code << ")" << std::endl; diff --git a/src/hud.h b/src/hud.h index 85886b216..a4af4be37 100644 --- a/src/hud.h +++ b/src/hud.h @@ -190,4 +190,4 @@ void drawItemStack(video::IVideoDriver *driver, #endif -#endif \ No newline at end of file +#endif diff --git a/src/keycode.cpp b/src/keycode.cpp index 86b816ff9..29ceae601 100644 --- a/src/keycode.cpp +++ b/src/keycode.cpp @@ -316,7 +316,7 @@ KeyPress::KeyPress(const irr::SEvent::SKeyInput &in, bool prefer_character) int written = wctomb(&m_name[0], Char); if(written < 0){ std::string hexstr = hex_encode((const char*)&Char, sizeof(Char)); - infostream<<"KeyPress: Unexpected multibyte character "<indices.push_back(j); } -} \ No newline at end of file +} diff --git a/src/mapblock_mesh.h b/src/mapblock_mesh.h index 64a879e6f..407f0bbe0 100644 --- a/src/mapblock_mesh.h +++ b/src/mapblock_mesh.h @@ -220,3 +220,4 @@ TileSpec getNodeTileN(MapNode mn, v3s16 p, u8 tileindex, MeshMakeData *data); TileSpec getNodeTile(MapNode mn, v3s16 p, v3s16 dir, MeshMakeData *data); #endif + diff --git a/src/mapgen_fractal.cpp b/src/mapgen_fractal.cpp index 0b0cf7f93..d2b118f5f 100644 --- a/src/mapgen_fractal.cpp +++ b/src/mapgen_fractal.cpp @@ -743,4 +743,4 @@ void MapgenFractal::generateCaves(s16 max_stone_y) CaveV5 cave(this, &ps); cave.makeCave(node_min, node_max, max_stone_y); } -} \ No newline at end of file +} diff --git a/src/mapgen_fractal.h b/src/mapgen_fractal.h index fd99032b9..6107328e0 100644 --- a/src/mapgen_fractal.h +++ b/src/mapgen_fractal.h @@ -131,4 +131,4 @@ struct MapgenFactoryFractal : public MapgenFactory { }; }; -#endif \ No newline at end of file +#endif diff --git a/src/script/cpp_api/s_player.cpp b/src/script/cpp_api/s_player.cpp index 88fa7df2d..b143c6def 100644 --- a/src/script/cpp_api/s_player.cpp +++ b/src/script/cpp_api/s_player.cpp @@ -194,3 +194,4 @@ ScriptApiPlayer::~ScriptApiPlayer() { } + diff --git a/src/touchscreengui.cpp b/src/touchscreengui.cpp index ad34b7901..bd8bff6f4 100644 --- a/src/touchscreengui.cpp +++ b/src/touchscreengui.cpp @@ -39,7 +39,7 @@ using namespace irr::core; extern Settings *g_settings; -const char *touchgui_button_imagenames[] = { +const char* touchgui_button_imagenames[] = { "up_one.png", "up_two.png", "up_three.png", @@ -155,14 +155,15 @@ TouchScreenGUI::TouchScreenGUI(IrrlichtDevice *device, IEventReceiver* receiver) m_buttons[i].repeatdelay = BUTTON_REPEAT_DELAY; } - m_screensize = m_device->getVideoDriver()->getScreenSize(); + m_screensize = device->getVideoDriver()->getScreenSize(); } void TouchScreenGUI::loadButtonTexture(button_info* btn, const char* path, rect button_rect) { unsigned int tid; video::ITexture *texture = guiScalingImageButton(m_device->getVideoDriver(), - m_texturesource->getTexture(path, &tid), button_rect.getWidth(), button_rect.getHeight()); + m_texturesource->getTexture(path, &tid), button_rect.getWidth(), + button_rect.getHeight()); if (texture) { btn->guibutton->setUseAlphaChannel(true); if (g_settings->getBool("gui_scaling_filter")) { @@ -193,7 +194,7 @@ void TouchScreenGUI::initButton(touch_gui_button_id id, rect button_rect, btn->immediate_release = immediate_release; btn->ids.clear(); - loadButtonTexture(btn,touchgui_button_imagenames[id], button_rect); + loadButtonTexture(btn,touchgui_button_imagenames[id],button_rect); } static int getMaxControlPadSize(float density) { @@ -219,8 +220,7 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc) u32 button_size = getGuiButtonSize(); m_visible = true; m_texturesource = tsrc; - m_control_pad_rect = rect( - 0, m_screensize.Y - control_pad_size, + m_control_pad_rect = rect(0, m_screensize.Y - control_pad_size, 0 + control_pad_size, m_screensize.Y); /* @@ -231,7 +231,6 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc) */ int number = 0; - for (int y = 0; y < 3; ++y) for (int x = 0; x < 3; ++x, ++number) { v2s32 tl; @@ -277,20 +276,19 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc) id = right_id; caption = L">"; break; - } if (id != after_last_element_id) { initButton(id, button_rect, caption, false); - } + } } /* init inventory button */ initButton(inventory_id, - rect(m_screensize.X-(button_size), - m_screensize.Y-(button_size), - m_screensize.X, - m_screensize.Y), - L"inv", false, SLOW_BUTTON_REPEAT); + rect(m_screensize.X-(button_size), + m_screensize.Y-(button_size), + m_screensize.X, + m_screensize.Y), + L"inv", false, SLOW_BUTTON_REPEAT); /* init drop button */ initButton(drop_id, @@ -307,6 +305,7 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc) m_screensize.X-(button_size), m_screensize.Y), L"H", false, SLOW_BUTTON_REPEAT); + /* init jump button */ initButton(jump_id, rect(m_screensize.X-(button_size*2), @@ -500,6 +499,7 @@ void TouchScreenGUI::handleButtonEvent(touch_gui_button_id button, delete translated; } + void TouchScreenGUI::handleReleaseEvent(int evt_id) { touch_gui_button_id button = getButtonID(evt_id); @@ -566,7 +566,6 @@ void TouchScreenGUI::handleReleaseEvent(int evt_id) } } - void TouchScreenGUI::translateEvent(const SEvent &event) { if (!m_visible) { @@ -598,9 +597,7 @@ void TouchScreenGUI::translateEvent(const SEvent &event) /* handle button events */ if (button != after_last_element_id) { handleButtonEvent(button, eventID, true); - } - else if (isHUDButton(event)) - { + } else if (isHUDButton(event)) { /* already handled in isHUDButton() */ } else if (m_control_pad_rect.isPointInside(v2s32(toadd.X, toadd.Y))) { // ignore events inside the control pad not already handled @@ -653,7 +650,7 @@ void TouchScreenGUI::translateEvent(const SEvent &event) s32 dy = Y - m_pointerpos[event.TouchInput.ID].Y; /* adapt to similar behaviour as pc screen */ - double d = g_settings->getFloat("mouse_sensitivity") ; + double d = g_settings->getFloat("mouse_sensitivity"); double old_yaw = m_camera_yaw; double old_pitch = m_camera_pitch; @@ -682,7 +679,7 @@ void TouchScreenGUI::translateEvent(const SEvent &event) ->getRayFromScreenCoordinates( v2s32(event.TouchInput.X,event.TouchInput.Y)); } - }else { + } else { handleChangedButton(event); } } @@ -745,7 +742,7 @@ bool TouchScreenGUI::doubleTapDetection() m_key_events[1].x = m_move_downlocation.X; m_key_events[1].y = m_move_downlocation.Y; - u32 delta = porting::getDeltaMs(m_key_events[0].down_time,getTimeMs()); + u32 delta = porting::getDeltaMs(m_key_events[0].down_time, getTimeMs()); if (delta > 400) return false; diff --git a/src/touchscreengui.h b/src/touchscreengui.h index 5dca7ede9..391021a0b 100644 --- a/src/touchscreengui.h +++ b/src/touchscreengui.h @@ -99,7 +99,6 @@ private: std::map > m_hud_rects; std::map m_hud_ids; bool m_visible; // is the gui visible - rect controlpadarea; /* value in degree */ double m_camera_yaw; @@ -160,9 +159,6 @@ private: /* handle released hud buttons */ bool isReleaseHUDButton(int eventID); - - /* get size of regular gui control button */ - int getGuiButtonSize(); /* handle double taps */ bool doubleTapDetection(); @@ -170,6 +166,9 @@ private: /* handle release event */ void handleReleaseEvent(int evt_id); + /* get size of regular gui control button */ + int getGuiButtonSize(); + /* doubleclick detection variables */ struct key_event { unsigned int down_time; diff --git a/src/util/srp.cpp b/src/util/srp.cpp index 0d3c938a3..844f73d16 100644 --- a/src/util/srp.cpp +++ b/src/util/srp.cpp @@ -41,8 +41,10 @@ #include -#if USE_SYSTEM_GMP || defined (__ANDROID__) || defined (ANDROID) +#if USE_SYSTEM_GMP #include +#elif defined (__ANDROID__) + #include #else #include #endif diff --git a/src/util/string.cpp b/src/util/string.cpp index 865020c4e..d28467391 100644 --- a/src/util/string.cpp +++ b/src/util/string.cpp @@ -732,4 +732,4 @@ static bool parseNamedColorString(const std::string &value, video::SColor &color void str_replace(std::string &str, char from, char to) { std::replace(str.begin(), str.end(), from, to); -} \ No newline at end of file +} diff --git a/src/wieldmesh.cpp b/src/wieldmesh.cpp index d9a955c55..1387c37d7 100644 --- a/src/wieldmesh.cpp +++ b/src/wieldmesh.cpp @@ -543,4 +543,4 @@ scene::IMesh * getExtrudedMesh(ITextureSource *tsrc, scaleMesh(mesh, v3f(2.0, 2.0, 2.0)); return mesh; -} \ No newline at end of file +} diff --git a/src/wieldmesh.h b/src/wieldmesh.h index 377a8fdc4..034f4fa48 100644 --- a/src/wieldmesh.h +++ b/src/wieldmesh.h @@ -81,4 +81,4 @@ scene::IMesh *getItemMesh(IGameDef *gamedef, const ItemStack &item); scene::IMesh *getExtrudedMesh(ITextureSource *tsrc, const std::string &imagename); -#endif \ No newline at end of file +#endif diff --git a/textures/base/pack/menu_bg.png b/textures/base/pack/menu_bg.png deleted file mode 100644 index ed7e34f61..000000000 Binary files a/textures/base/pack/menu_bg.png and /dev/null differ diff --git a/textures/base/pack/server_flags_favorite.png b/textures/base/pack/server_flags_favorite.png deleted file mode 100644 index 6a3fc5efe..000000000 Binary files a/textures/base/pack/server_flags_favorite.png and /dev/null differ diff --git a/textures/base/server_flags_favorite.png b/textures/base/server_flags_favorite.png new file mode 100644 index 000000000..989bfe5b2 Binary files /dev/null and b/textures/base/server_flags_favorite.png differ